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 jse=Object.defineProperty;var Lse=(e,t,n)=>t in e?jse(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Me=(e,t,n)=>Lse(e,typeof t!="symbol"?t+"":t,n);function Dse(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&&!Array.isArray(s)){for(const r in s)if(r!=="default"&&!(r in e)){const i=Object.getOwnPropertyDescriptor(s,r);i&&Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:()=>s[r]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(r){if(r.ep)return;r.ep=!0;const i=n(r);fetch(r.href,i)}})();var Ux=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function W2(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Dz={exports:{}},G2={};/**
 * @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 Ose=Symbol.for("react.transitional.element"),Pse=Symbol.for("react.fragment");function Oz(e,t,n){var s=null;if(n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),"key"in t){n={};for(var r in t)r!=="key"&&(n[r]=t[r])}else n=t;return t=n.ref,{$$typeof:Ose,type:e,key:s,ref:t!==void 0?t:null,props:n}}G2.Fragment=Pse;G2.jsx=Oz;G2.jsxs=Oz;Dz.exports=G2;var u=Dz.exports,Pz={exports:{}},Un={};/**
 * @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 S7=Symbol.for("react.transitional.element"),Bse=Symbol.for("react.portal"),$se=Symbol.for("react.fragment"),zse=Symbol.for("react.strict_mode"),Fse=Symbol.for("react.profiler"),qse=Symbol.for("react.consumer"),Hse=Symbol.for("react.context"),Use=Symbol.for("react.forward_ref"),Vse=Symbol.for("react.suspense"),Wse=Symbol.for("react.memo"),Bz=Symbol.for("react.lazy"),Gse=Symbol.for("react.activity"),iI=Symbol.iterator;function Kse(e){return e===null||typeof e!="object"?null:(e=iI&&e[iI]||e["@@iterator"],typeof e=="function"?e:null)}var $z={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},zz=Object.assign,Fz={};function D0(e,t,n){this.props=e,this.context=t,this.refs=Fz,this.updater=n||$z}D0.prototype.isReactComponent={};D0.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};D0.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function qz(){}qz.prototype=D0.prototype;function C7(e,t,n){this.props=e,this.context=t,this.refs=Fz,this.updater=n||$z}var T7=C7.prototype=new qz;T7.constructor=C7;zz(T7,D0.prototype);T7.isPureReactComponent=!0;var oI=Array.isArray;function FC(){}var xr={H:null,A:null,T:null,S:null},Hz=Object.prototype.hasOwnProperty;function E7(e,t,n){var s=n.ref;return{$$typeof:S7,type:e,key:t,ref:s!==void 0?s:null,props:n}}function Yse(e,t){return E7(e.type,t,e.props)}function A7(e){return typeof e=="object"&&e!==null&&e.$$typeof===S7}function Xse(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var aI=/\/+/g;function _S(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Xse(""+e.key):t.toString(36)}function Qse(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(FC,FC):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function cp(e,t,n,s,r){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(i){case"bigint":case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case S7:case Bse:o=!0;break;case Bz:return o=e._init,cp(o(e._payload),t,n,s,r)}}if(o)return r=r(e),o=s===""?"."+_S(e,0):s,oI(r)?(n="",o!=null&&(n=o.replace(aI,"$&/")+"/"),cp(r,t,n,"",function(c){return c})):r!=null&&(A7(r)&&(r=Yse(r,n+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(aI,"$&/")+"/")+o)),t.push(r)),1;o=0;var a=s===""?".":s+":";if(oI(e))for(var l=0;l<e.length;l++)s=e[l],i=a+_S(s,l),o+=cp(s,t,n,i,r);else if(l=Kse(e),typeof l=="function")for(e=l.call(e),l=0;!(s=e.next()).done;)s=s.value,i=a+_S(s,l++),o+=cp(s,t,n,i,r);else if(i==="object"){if(typeof e.then=="function")return cp(Qse(e),t,n,s,r);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return o}function yv(e,t,n){if(e==null)return e;var s=[],r=0;return cp(e,s,"","",function(i){return t.call(n,i,r++)}),s}function Jse(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var lI=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Zse={map:yv,forEach:function(e,t,n){yv(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return yv(e,function(){t++}),t},toArray:function(e){return yv(e,function(t){return t})||[]},only:function(e){if(!A7(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Un.Activity=Gse;Un.Children=Zse;Un.Component=D0;Un.Fragment=$se;Un.Profiler=Fse;Un.PureComponent=C7;Un.StrictMode=zse;Un.Suspense=Vse;Un.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=xr;Un.__COMPILER_RUNTIME={__proto__:null,c:function(e){return xr.H.useMemoCache(e)}};Un.cache=function(e){return function(){return e.apply(null,arguments)}};Un.cacheSignal=function(){return null};Un.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var s=zz({},e.props),r=e.key;if(t!=null)for(i in t.key!==void 0&&(r=""+t.key),t)!Hz.call(t,i)||i==="key"||i==="__self"||i==="__source"||i==="ref"&&t.ref===void 0||(s[i]=t[i]);var i=arguments.length-2;if(i===1)s.children=n;else if(1<i){for(var o=Array(i),a=0;a<i;a++)o[a]=arguments[a+2];s.children=o}return E7(e.type,r,s)};Un.createContext=function(e){return e={$$typeof:Hse,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:qse,_context:e},e};Un.createElement=function(e,t,n){var s,r={},i=null;if(t!=null)for(s in t.key!==void 0&&(i=""+t.key),t)Hz.call(t,s)&&s!=="key"&&s!=="__self"&&s!=="__source"&&(r[s]=t[s]);var o=arguments.length-2;if(o===1)r.children=n;else if(1<o){for(var a=Array(o),l=0;l<o;l++)a[l]=arguments[l+2];r.children=a}if(e&&e.defaultProps)for(s in o=e.defaultProps,o)r[s]===void 0&&(r[s]=o[s]);return E7(e,i,r)};Un.createRef=function(){return{current:null}};Un.forwardRef=function(e){return{$$typeof:Use,render:e}};Un.isValidElement=A7;Un.lazy=function(e){return{$$typeof:Bz,_payload:{_status:-1,_result:e},_init:Jse}};Un.memo=function(e,t){return{$$typeof:Wse,type:e,compare:t===void 0?null:t}};Un.startTransition=function(e){var t=xr.T,n={};xr.T=n;try{var s=e(),r=xr.S;r!==null&&r(n,s),typeof s=="object"&&s!==null&&typeof s.then=="function"&&s.then(FC,lI)}catch(i){lI(i)}finally{t!==null&&n.types!==null&&(t.types=n.types),xr.T=t}};Un.unstable_useCacheRefresh=function(){return xr.H.useCacheRefresh()};Un.use=function(e){return xr.H.use(e)};Un.useActionState=function(e,t,n){return xr.H.useActionState(e,t,n)};Un.useCallback=function(e,t){return xr.H.useCallback(e,t)};Un.useContext=function(e){return xr.H.useContext(e)};Un.useDebugValue=function(){};Un.useDeferredValue=function(e,t){return xr.H.useDeferredValue(e,t)};Un.useEffect=function(e,t){return xr.H.useEffect(e,t)};Un.useEffectEvent=function(e){return xr.H.useEffectEvent(e)};Un.useId=function(){return xr.H.useId()};Un.useImperativeHandle=function(e,t,n){return xr.H.useImperativeHandle(e,t,n)};Un.useInsertionEffect=function(e,t){return xr.H.useInsertionEffect(e,t)};Un.useLayoutEffect=function(e,t){return xr.H.useLayoutEffect(e,t)};Un.useMemo=function(e,t){return xr.H.useMemo(e,t)};Un.useOptimistic=function(e,t){return xr.H.useOptimistic(e,t)};Un.useReducer=function(e,t,n){return xr.H.useReducer(e,t,n)};Un.useRef=function(e){return xr.H.useRef(e)};Un.useState=function(e){return xr.H.useState(e)};Un.useSyncExternalStore=function(e,t,n){return xr.H.useSyncExternalStore(e,t,n)};Un.useTransition=function(){return xr.H.useTransition()};Un.version="19.2.4";Pz.exports=Un;var m=Pz.exports;const Uz=W2(m),K2=Dse({__proto__:null,default:Uz},[m]);var Vz={exports:{}},Y2={},Wz={exports:{}},Gz={};/**
 * @license React
 * scheduler.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */(function(e){function t(O,X){var z=O.length;O.push(X);e:for(;0<z;){var U=z-1>>>1,D=O[U];if(0<r(D,X))O[U]=X,O[z]=D,z=U;else break e}}function n(O){return O.length===0?null:O[0]}function s(O){if(O.length===0)return null;var X=O[0],z=O.pop();if(z!==X){O[0]=z;e:for(var U=0,D=O.length,G=D>>>1;U<G;){var q=2*(U+1)-1,N=O[q],ee=q+1,re=O[ee];if(0>r(N,z))ee<D&&0>r(re,N)?(O[U]=re,O[ee]=z,U=ee):(O[U]=N,O[q]=z,U=q);else if(ee<D&&0>r(re,z))O[U]=re,O[ee]=z,U=ee;else break e}}return X}function r(O,X){var z=O.sortIndex-X.sortIndex;return z!==0?z:O.id-X.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var l=[],c=[],d=1,h=null,f=3,p=!1,g=!1,y=!1,w=!1,v=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;function k(O){for(var X=n(c);X!==null;){if(X.callback===null)s(c);else if(X.startTime<=O)s(c),X.sortIndex=X.expirationTime,t(l,X);else break;X=n(c)}}function T(O){if(y=!1,k(O),!g)if(n(l)!==null)g=!0,C||(C=!0,A());else{var X=n(c);X!==null&&F(T,X.startTime-O)}}var C=!1,S=-1,_=5,L=-1;function M(){return w?!0:!(e.unstable_now()-L<_)}function I(){if(w=!1,C){var O=e.unstable_now();L=O;var X=!0;try{e:{g=!1,y&&(y=!1,b(S),S=-1),p=!0;var z=f;try{t:{for(k(O),h=n(l);h!==null&&!(h.expirationTime>O&&M());){var U=h.callback;if(typeof U=="function"){h.callback=null,f=h.priorityLevel;var D=U(h.expirationTime<=O);if(O=e.unstable_now(),typeof D=="function"){h.callback=D,k(O),X=!0;break t}h===n(l)&&s(l),k(O)}else s(l);h=n(l)}if(h!==null)X=!0;else{var G=n(c);G!==null&&F(T,G.startTime-O),X=!1}}break e}finally{h=null,f=z,p=!1}X=void 0}}finally{X?A():C=!1}}}var A;if(typeof x=="function")A=function(){x(I)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,B=P.port2;P.port1.onmessage=I,A=function(){B.postMessage(null)}}else A=function(){v(I,0)};function F(O,X){S=v(function(){O(e.unstable_now())},X)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(O){O.callback=null},e.unstable_forceFrameRate=function(O){0>O||125<O?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):_=0<O?Math.floor(1e3/O):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(O){switch(f){case 1:case 2:case 3:var X=3;break;default:X=f}var z=f;f=X;try{return O()}finally{f=z}},e.unstable_requestPaint=function(){w=!0},e.unstable_runWithPriority=function(O,X){switch(O){case 1:case 2:case 3:case 4:case 5:break;default:O=3}var z=f;f=O;try{return X()}finally{f=z}},e.unstable_scheduleCallback=function(O,X,z){var U=e.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?U+z:U):z=U,O){case 1:var D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=z+D,O={id:d++,callback:X,priorityLevel:O,startTime:z,expirationTime:D,sortIndex:-1},z>U?(O.sortIndex=z,t(c,O),n(l)===null&&O===n(c)&&(y?(b(S),S=-1):y=!0,F(T,z-U))):(O.sortIndex=D,t(l,O),g||p||(g=!0,C||(C=!0,A()))),O},e.unstable_shouldYield=M,e.unstable_wrapCallback=function(O){var X=f;return function(){var z=f;f=X;try{return O.apply(this,arguments)}finally{f=z}}}})(Gz);Wz.exports=Gz;var ere=Wz.exports,Kz={exports:{}},Bo={};/**
 * @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 tre=m;function Yz(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function hd(){}var Do={d:{f:hd,r:function(){throw Error(Yz(522))},D:hd,C:hd,L:hd,m:hd,X:hd,S:hd,M:hd},p:0,findDOMNode:null},nre=Symbol.for("react.portal");function sre(e,t,n){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:nre,key:s==null?null:""+s,children:e,containerInfo:t,implementation:n}}var S1=tre.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function X2(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}Bo.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Do;Bo.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(Yz(299));return sre(e,t,null,n)};Bo.flushSync=function(e){var t=S1.T,n=Do.p;try{if(S1.T=null,Do.p=2,e)return e()}finally{S1.T=t,Do.p=n,Do.d.f()}};Bo.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,Do.d.C(e,t))};Bo.prefetchDNS=function(e){typeof e=="string"&&Do.d.D(e)};Bo.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,s=X2(n,t.crossOrigin),r=typeof t.integrity=="string"?t.integrity:void 0,i=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?Do.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:s,integrity:r,fetchPriority:i}):n==="script"&&Do.d.X(e,{crossOrigin:s,integrity:r,fetchPriority:i,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};Bo.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=X2(t.as,t.crossOrigin);Do.d.M(e,{crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0})}}else t==null&&Do.d.M(e)};Bo.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,s=X2(n,t.crossOrigin);Do.d.L(e,n,{crossOrigin:s,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0,type:typeof t.type=="string"?t.type:void 0,fetchPriority:typeof t.fetchPriority=="string"?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy=="string"?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet=="string"?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes=="string"?t.imageSizes:void 0,media:typeof t.media=="string"?t.media:void 0})}};Bo.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=X2(t.as,t.crossOrigin);Do.d.m(e,{as:typeof t.as=="string"&&t.as!=="script"?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0})}else Do.d.m(e)};Bo.requestFormReset=function(e){Do.d.r(e)};Bo.unstable_batchedUpdates=function(e,t){return e(t)};Bo.useFormState=function(e,t,n){return S1.H.useFormState(e,t,n)};Bo.useFormStatus=function(){return S1.H.useHostTransitionStatus()};Bo.version="19.2.4";function Xz(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Xz)}catch(e){console.error(e)}}Xz(),Kz.exports=Bo;var _l=Kz.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 Ei=ere,Qz=m,rre=_l;function Ue(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function Jz(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function ib(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function Zz(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function eF(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function cI(e){if(ib(e)!==e)throw Error(Ue(188))}function ire(e){var t=e.alternate;if(!t){if(t=ib(e),t===null)throw Error(Ue(188));return t!==e?null:e}for(var n=e,s=t;;){var r=n.return;if(r===null)break;var i=r.alternate;if(i===null){if(s=r.return,s!==null){n=s;continue}break}if(r.child===i.child){for(i=r.child;i;){if(i===n)return cI(r),e;if(i===s)return cI(r),t;i=i.sibling}throw Error(Ue(188))}if(n.return!==s.return)n=r,s=i;else{for(var o=!1,a=r.child;a;){if(a===n){o=!0,n=r,s=i;break}if(a===s){o=!0,s=r,n=i;break}a=a.sibling}if(!o){for(a=i.child;a;){if(a===n){o=!0,n=i,s=r;break}if(a===s){o=!0,s=i,n=r;break}a=a.sibling}if(!o)throw Error(Ue(189))}}if(n.alternate!==s)throw Error(Ue(190))}if(n.tag!==3)throw Error(Ue(188));return n.stateNode.current===n?e:t}function tF(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=tF(e),t!==null)return t;e=e.sibling}return null}var kr=Object.assign,ore=Symbol.for("react.element"),bv=Symbol.for("react.transitional.element"),t1=Symbol.for("react.portal"),bp=Symbol.for("react.fragment"),nF=Symbol.for("react.strict_mode"),qC=Symbol.for("react.profiler"),sF=Symbol.for("react.consumer"),yu=Symbol.for("react.context"),M7=Symbol.for("react.forward_ref"),HC=Symbol.for("react.suspense"),UC=Symbol.for("react.suspense_list"),N7=Symbol.for("react.memo"),Ed=Symbol.for("react.lazy"),VC=Symbol.for("react.activity"),are=Symbol.for("react.memo_cache_sentinel"),uI=Symbol.iterator;function Tg(e){return e===null||typeof e!="object"?null:(e=uI&&e[uI]||e["@@iterator"],typeof e=="function"?e:null)}var lre=Symbol.for("react.client.reference");function WC(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===lre?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case bp:return"Fragment";case qC:return"Profiler";case nF:return"StrictMode";case HC:return"Suspense";case UC:return"SuspenseList";case VC:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case t1:return"Portal";case yu:return e.displayName||"Context";case sF:return(e._context.displayName||"Context")+".Consumer";case M7:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case N7:return t=e.displayName||null,t!==null?t:WC(e.type)||"Memo";case Ed:t=e._payload,e=e._init;try{return WC(e(t))}catch{}}return null}var n1=Array.isArray,En=Qz.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,qs=rre.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Df={pending:!1,data:null,method:null,action:null},GC=[],vp=-1;function Pc(e){return{current:e}}function qi(e){0>vp||(e.current=GC[vp],GC[vp]=null,vp--)}function yr(e,t){vp++,GC[vp]=e.current,e.current=t}var Ac=Pc(null),iy=Pc(null),Jd=Pc(null),Vx=Pc(null);function Wx(e,t){switch(yr(Jd,t),yr(iy,e),yr(Ac,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?gR(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=gR(t),e=_H(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}qi(Ac),yr(Ac,e)}function o0(){qi(Ac),qi(iy),qi(Jd)}function KC(e){e.memoizedState!==null&&yr(Vx,e);var t=Ac.current,n=_H(t,e.type);t!==n&&(yr(iy,e),yr(Ac,n))}function Gx(e){iy.current===e&&(qi(Ac),qi(iy)),Vx.current===e&&(qi(Vx),gy._currentValue=Df)}var SS,dI;function mf(e){if(SS===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);SS=t&&t[1]||"",dI=-1<n.stack.indexOf(`
    at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
`+SS+e+dI}var CS=!1;function TS(e,t){if(!e||CS)return"";CS=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var h=function(){throw Error()};if(Object.defineProperty(h.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(h,[])}catch(p){var f=p}Reflect.construct(e,[],h)}else{try{h.call()}catch(p){f=p}e.call(h.prototype)}}else{try{throw Error()}catch(p){f=p}(h=e())&&typeof h.catch=="function"&&h.catch(function(){})}}catch(p){if(p&&f&&typeof p.stack=="string")return[p.stack,f.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var r=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");r&&r.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var i=s.DetermineComponentFrameRoot(),o=i[0],a=i[1];if(o&&a){var l=o.split(`
`),c=a.split(`
`);for(r=s=0;s<l.length&&!l[s].includes("DetermineComponentFrameRoot");)s++;for(;r<c.length&&!c[r].includes("DetermineComponentFrameRoot");)r++;if(s===l.length||r===c.length)for(s=l.length-1,r=c.length-1;1<=s&&0<=r&&l[s]!==c[r];)r--;for(;1<=s&&0<=r;s--,r--)if(l[s]!==c[r]){if(s!==1||r!==1)do if(s--,r--,0>r||l[s]!==c[r]){var d=`
`+l[s].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),d}while(1<=s&&0<=r);break}}}finally{CS=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?mf(n):""}function cre(e,t){switch(e.tag){case 26:case 27:case 5:return mf(e.type);case 16:return mf("Lazy");case 13:return e.child!==t&&t!==null?mf("Suspense Fallback"):mf("Suspense");case 19:return mf("SuspenseList");case 0:case 15:return TS(e.type,!1);case 11:return TS(e.type.render,!1);case 1:return TS(e.type,!0);case 31:return mf("Activity");default:return""}}function hI(e){try{var t="",n=null;do t+=cre(e,n),n=e,e=e.return;while(e);return t}catch(s){return`
Error generating stack: `+s.message+`
`+s.stack}}var YC=Object.prototype.hasOwnProperty,I7=Ei.unstable_scheduleCallback,ES=Ei.unstable_cancelCallback,ure=Ei.unstable_shouldYield,dre=Ei.unstable_requestPaint,Ea=Ei.unstable_now,hre=Ei.unstable_getCurrentPriorityLevel,rF=Ei.unstable_ImmediatePriority,iF=Ei.unstable_UserBlockingPriority,Kx=Ei.unstable_NormalPriority,fre=Ei.unstable_LowPriority,oF=Ei.unstable_IdlePriority,mre=Ei.log,pre=Ei.unstable_setDisableYieldValue,ob=null,Aa=null;function zd(e){if(typeof mre=="function"&&pre(e),Aa&&typeof Aa.setStrictMode=="function")try{Aa.setStrictMode(ob,e)}catch{}}var Ma=Math.clz32?Math.clz32:bre,gre=Math.log,yre=Math.LN2;function bre(e){return e>>>=0,e===0?32:31-(gre(e)/yre|0)|0}var vv=256,wv=262144,xv=4194304;function pf(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Q2(e,t,n){var s=e.pendingLanes;if(s===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var a=s&134217727;return a!==0?(s=a&~i,s!==0?r=pf(s):(o&=a,o!==0?r=pf(o):n||(n=a&~e,n!==0&&(r=pf(n))))):(a=s&~i,a!==0?r=pf(a):o!==0?r=pf(o):n||(n=s&~e,n!==0&&(r=pf(n)))),r===0?0:t!==0&&t!==r&&!(t&i)&&(i=r&-r,n=t&-t,i>=n||i===32&&(n&4194048)!==0)?t:r}function ab(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function vre(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function aF(){var e=xv;return xv<<=1,!(xv&62914560)&&(xv=4194304),e}function AS(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function lb(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function wre(e,t,n,s,r,i){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var a=e.entanglements,l=e.expirationTimes,c=e.hiddenUpdates;for(n=o&~n;0<n;){var d=31-Ma(n),h=1<<d;a[d]=0,l[d]=-1;var f=c[d];if(f!==null)for(c[d]=null,d=0;d<f.length;d++){var p=f[d];p!==null&&(p.lane&=-536870913)}n&=~h}s!==0&&lF(e,s,0),i!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=i&~(o&~t))}function lF(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-Ma(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|n&261930}function cF(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-Ma(n),r=1<<s;r&t|e[s]&t&&(e[s]|=t),n&=~r}}function uF(e,t){var n=t&-t;return n=n&42?1:R7(n),n&(e.suspendedLanes|t)?0:n}function R7(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function j7(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function dF(){var e=qs.p;return e!==0?e:(e=window.event,e===void 0?32:LH(e.type))}function fI(e,t){var n=qs.p;try{return qs.p=e,t()}finally{qs.p=n}}var Rh=Math.random().toString(36).slice(2),to="__reactFiber$"+Rh,ia="__reactProps$"+Rh,O0="__reactContainer$"+Rh,XC="__reactEvents$"+Rh,xre="__reactListeners$"+Rh,kre="__reactHandles$"+Rh,mI="__reactResources$"+Rh,cb="__reactMarker$"+Rh;function L7(e){delete e[to],delete e[ia],delete e[XC],delete e[xre],delete e[kre]}function wp(e){var t=e[to];if(t)return t;for(var n=e.parentNode;n;){if(t=n[O0]||n[to]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=xR(e);e!==null;){if(n=e[to])return n;e=xR(e)}return t}e=n,n=e.parentNode}return null}function P0(e){if(e=e[to]||e[O0]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function s1(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(Ue(33))}function $p(e){var t=e[mI];return t||(t=e[mI]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function $i(e){e[cb]=!0}var hF=new Set,fF={};function hm(e,t){a0(e,t),a0(e+"Capture",t)}function a0(e,t){for(fF[e]=t,e=0;e<t.length;e++)hF.add(t[e])}var _re=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]*$"),pI={},gI={};function Sre(e){return YC.call(gI,e)?!0:YC.call(pI,e)?!1:_re.test(e)?gI[e]=!0:(pI[e]=!0,!1)}function Jw(e,t,n){if(Sre(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var s=t.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function kv(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+n)}}function tu(e,t,n,s){if(s===null)e.removeAttribute(n);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+s)}}function sl(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function mF(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Cre(e,t,n){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var r=s.get,i=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(o){n=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function QC(e){if(!e._valueTracker){var t=mF(e)?"checked":"value";e._valueTracker=Cre(e,t,""+e[t])}}function pF(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=mF(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function Yx(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Tre=/[\n"\\]/g;function cl(e){return e.replace(Tre,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function JC(e,t,n,s,r,i,o,a){e.name="",o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?e.type=o:e.removeAttribute("type"),t!=null?o==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+sl(t)):e.value!==""+sl(t)&&(e.value=""+sl(t)):o!=="submit"&&o!=="reset"||e.removeAttribute("value"),t!=null?ZC(e,o,sl(t)):n!=null?ZC(e,o,sl(n)):s!=null&&e.removeAttribute("value"),r==null&&i!=null&&(e.defaultChecked=!!i),r!=null&&(e.checked=r&&typeof r!="function"&&typeof r!="symbol"),a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"?e.name=""+sl(a):e.removeAttribute("name")}function gF(e,t,n,s,r,i,o,a){if(i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(e.type=i),t!=null||n!=null){if(!(i!=="submit"&&i!=="reset"||t!=null)){QC(e);return}n=n!=null?""+sl(n):"",t=t!=null?""+sl(t):n,a||t===e.value||(e.value=t),e.defaultValue=t}s=s??r,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=a?e.checked:!!s,e.defaultChecked=!!s,o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(e.name=o),QC(e)}function ZC(e,t,n){t==="number"&&Yx(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function zp(e,t,n,s){if(e=e.options,t){t={};for(var r=0;r<n.length;r++)t["$"+n[r]]=!0;for(n=0;n<e.length;n++)r=t.hasOwnProperty("$"+e[n].value),e[n].selected!==r&&(e[n].selected=r),r&&s&&(e[n].defaultSelected=!0)}else{for(n=""+sl(n),t=null,r=0;r<e.length;r++){if(e[r].value===n){e[r].selected=!0,s&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function yF(e,t,n){if(t!=null&&(t=""+sl(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+sl(n):""}function bF(e,t,n,s){if(t==null){if(s!=null){if(n!=null)throw Error(Ue(92));if(n1(s)){if(1<s.length)throw Error(Ue(93));s=s[0]}n=s}n==null&&(n=""),t=n}n=sl(t),e.defaultValue=n,s=e.textContent,s===n&&s!==""&&s!==null&&(e.value=s),QC(e)}function l0(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ere=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 yI(e,t,n){var s=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?s?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":s?e.setProperty(t,n):typeof n!="number"||n===0||Ere.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function vF(e,t,n){if(t!=null&&typeof t!="object")throw Error(Ue(62));if(e=e.style,n!=null){for(var s in n)!n.hasOwnProperty(s)||t!=null&&t.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var r in t)s=t[r],t.hasOwnProperty(r)&&n[r]!==s&&yI(e,r,s)}else for(var i in t)t.hasOwnProperty(i)&&yI(e,i,t[i])}function D7(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Are=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"]]),Mre=/^[\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 Zw(e){return Mre.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function bu(){}var e6=null;function O7(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var xp=null,Fp=null;function bI(e){var t=P0(e);if(t&&(e=t.stateNode)){var n=e[ia]||null;e:switch(e=t.stateNode,t.type){case"input":if(JC(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+cl(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var r=s[ia]||null;if(!r)throw Error(Ue(90));JC(s,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name)}}for(t=0;t<n.length;t++)s=n[t],s.form===e.form&&pF(s)}break e;case"textarea":yF(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&zp(e,!!n.multiple,t,!1)}}}var MS=!1;function wF(e,t,n){if(MS)return e(t,n);MS=!0;try{var s=e(t);return s}finally{if(MS=!1,(xp!==null||Fp!==null)&&(c_(),xp&&(t=xp,e=Fp,Fp=xp=null,bI(t),e)))for(t=0;t<e.length;t++)bI(e[t])}}function oy(e,t){var n=e.stateNode;if(n===null)return null;var s=n[ia]||null;if(s===null)return null;n=s[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(Ue(231,t,typeof n));return n}var Lu=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),t6=!1;if(Lu)try{var Eg={};Object.defineProperty(Eg,"passive",{get:function(){t6=!0}}),window.addEventListener("test",Eg,Eg),window.removeEventListener("test",Eg,Eg)}catch{t6=!1}var Fd=null,P7=null,ex=null;function xF(){if(ex)return ex;var e,t=P7,n=t.length,s,r="value"in Fd?Fd.value:Fd.textContent,i=r.length;for(e=0;e<n&&t[e]===r[e];e++);var o=n-e;for(s=1;s<=o&&t[n-s]===r[i-s];s++);return ex=r.slice(e,1<s?1-s:void 0)}function tx(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function _v(){return!0}function vI(){return!1}function aa(e){function t(n,s,r,i,o){this._reactName=n,this._targetInst=r,this.type=s,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(i):i[a]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?_v:vI,this.isPropagationStopped=vI,this}return kr(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=_v)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=_v)},persist:function(){},isPersistent:_v}),t}var fm={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},J2=aa(fm),ub=kr({},fm,{view:0,detail:0}),Nre=aa(ub),NS,IS,Ag,Z2=kr({},ub,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:B7,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Ag&&(Ag&&e.type==="mousemove"?(NS=e.screenX-Ag.screenX,IS=e.screenY-Ag.screenY):IS=NS=0,Ag=e),NS)},movementY:function(e){return"movementY"in e?e.movementY:IS}}),wI=aa(Z2),Ire=kr({},Z2,{dataTransfer:0}),Rre=aa(Ire),jre=kr({},ub,{relatedTarget:0}),RS=aa(jre),Lre=kr({},fm,{animationName:0,elapsedTime:0,pseudoElement:0}),Dre=aa(Lre),Ore=kr({},fm,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Pre=aa(Ore),Bre=kr({},fm,{data:0}),xI=aa(Bre),$re={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},zre={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"},Fre={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function qre(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Fre[e])?!!t[e]:!1}function B7(){return qre}var Hre=kr({},ub,{key:function(e){if(e.key){var t=$re[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=tx(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?zre[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:B7,charCode:function(e){return e.type==="keypress"?tx(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?tx(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Ure=aa(Hre),Vre=kr({},Z2,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),kI=aa(Vre),Wre=kr({},ub,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:B7}),Gre=aa(Wre),Kre=kr({},fm,{propertyName:0,elapsedTime:0,pseudoElement:0}),Yre=aa(Kre),Xre=kr({},Z2,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Qre=aa(Xre),Jre=kr({},fm,{newState:0,oldState:0}),Zre=aa(Jre),eie=[9,13,27,32],$7=Lu&&"CompositionEvent"in window,C1=null;Lu&&"documentMode"in document&&(C1=document.documentMode);var tie=Lu&&"TextEvent"in window&&!C1,kF=Lu&&(!$7||C1&&8<C1&&11>=C1),_I=" ",SI=!1;function _F(e,t){switch(e){case"keyup":return eie.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function SF(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var kp=!1;function nie(e,t){switch(e){case"compositionend":return SF(t);case"keypress":return t.which!==32?null:(SI=!0,_I);case"textInput":return e=t.data,e===_I&&SI?null:e;default:return null}}function sie(e,t){if(kp)return e==="compositionend"||!$7&&_F(e,t)?(e=xF(),ex=P7=Fd=null,kp=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return kF&&t.locale!=="ko"?null:t.data;default:return null}}var rie={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 CI(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!rie[e.type]:t==="textarea"}function CF(e,t,n,s){xp?Fp?Fp.push(s):Fp=[s]:xp=s,t=fk(t,"onChange"),0<t.length&&(n=new J2("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var T1=null,ay=null;function iie(e){wH(e,0)}function e_(e){var t=s1(e);if(pF(t))return e}function TI(e,t){if(e==="change")return t}var TF=!1;if(Lu){var jS;if(Lu){var LS="oninput"in document;if(!LS){var EI=document.createElement("div");EI.setAttribute("oninput","return;"),LS=typeof EI.oninput=="function"}jS=LS}else jS=!1;TF=jS&&(!document.documentMode||9<document.documentMode)}function AI(){T1&&(T1.detachEvent("onpropertychange",EF),ay=T1=null)}function EF(e){if(e.propertyName==="value"&&e_(ay)){var t=[];CF(t,ay,e,O7(e)),wF(iie,t)}}function oie(e,t,n){e==="focusin"?(AI(),T1=t,ay=n,T1.attachEvent("onpropertychange",EF)):e==="focusout"&&AI()}function aie(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return e_(ay)}function lie(e,t){if(e==="click")return e_(t)}function cie(e,t){if(e==="input"||e==="change")return e_(t)}function uie(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var La=typeof Object.is=="function"?Object.is:uie;function ly(e,t){if(La(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(s=0;s<n.length;s++){var r=n[s];if(!YC.call(t,r)||!La(e[r],t[r]))return!1}return!0}function MI(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function NI(e,t){var n=MI(e);e=0;for(var s;n;){if(n.nodeType===3){if(s=e+n.textContent.length,e<=t&&s>=t)return{node:n,offset:t-e};e=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=MI(n)}}function AF(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?AF(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function MF(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Yx(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Yx(e.document)}return t}function z7(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var die=Lu&&"documentMode"in document&&11>=document.documentMode,_p=null,n6=null,E1=null,s6=!1;function II(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;s6||_p==null||_p!==Yx(s)||(s=_p,"selectionStart"in s&&z7(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),E1&&ly(E1,s)||(E1=s,s=fk(n6,"onSelect"),0<s.length&&(t=new J2("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=_p)))}function nf(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Sp={animationend:nf("Animation","AnimationEnd"),animationiteration:nf("Animation","AnimationIteration"),animationstart:nf("Animation","AnimationStart"),transitionrun:nf("Transition","TransitionRun"),transitionstart:nf("Transition","TransitionStart"),transitioncancel:nf("Transition","TransitionCancel"),transitionend:nf("Transition","TransitionEnd")},DS={},NF={};Lu&&(NF=document.createElement("div").style,"AnimationEvent"in window||(delete Sp.animationend.animation,delete Sp.animationiteration.animation,delete Sp.animationstart.animation),"TransitionEvent"in window||delete Sp.transitionend.transition);function mm(e){if(DS[e])return DS[e];if(!Sp[e])return e;var t=Sp[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in NF)return DS[e]=t[n];return e}var IF=mm("animationend"),RF=mm("animationiteration"),jF=mm("animationstart"),hie=mm("transitionrun"),fie=mm("transitionstart"),mie=mm("transitioncancel"),LF=mm("transitionend"),DF=new Map,r6="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(" ");r6.push("scrollEnd");function Bl(e,t){DF.set(e,t),hm(t,[e])}var Xx=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},tl=[],Cp=0,F7=0;function t_(){for(var e=Cp,t=F7=Cp=0;t<e;){var n=tl[t];tl[t++]=null;var s=tl[t];tl[t++]=null;var r=tl[t];tl[t++]=null;var i=tl[t];if(tl[t++]=null,s!==null&&r!==null){var o=s.pending;o===null?r.next=r:(r.next=o.next,o.next=r),s.pending=r}i!==0&&OF(n,r,i)}}function n_(e,t,n,s){tl[Cp++]=e,tl[Cp++]=t,tl[Cp++]=n,tl[Cp++]=s,F7|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function q7(e,t,n,s){return n_(e,t,n,s),Qx(e)}function pm(e,t){return n_(e,null,null,t),Qx(e)}function OF(e,t,n){e.lanes|=n;var s=e.alternate;s!==null&&(s.lanes|=n);for(var r=!1,i=e.return;i!==null;)i.childLanes|=n,s=i.alternate,s!==null&&(s.childLanes|=n),i.tag===22&&(e=i.stateNode,e===null||e._visibility&1||(r=!0)),e=i,i=i.return;return e.tag===3?(i=e.stateNode,r&&t!==null&&(r=31-Ma(n),e=i.hiddenUpdates,s=e[r],s===null?e[r]=[t]:s.push(t),t.lane=n|536870912),i):null}function Qx(e){if(50<O1)throw O1=0,C6=null,Error(Ue(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Tp={};function pie(e,t,n,s){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function _a(e,t,n,s){return new pie(e,t,n,s)}function H7(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _u(e,t){var n=e.alternate;return n===null?(n=_a(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function PF(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function nx(e,t,n,s,r,i){var o=0;if(s=e,typeof e=="function")H7(e)&&(o=1);else if(typeof e=="string")o=woe(e,n,Ac.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case VC:return e=_a(31,n,t,r),e.elementType=VC,e.lanes=i,e;case bp:return Of(n.children,r,i,t);case nF:o=8,r|=24;break;case qC:return e=_a(12,n,t,r|2),e.elementType=qC,e.lanes=i,e;case HC:return e=_a(13,n,t,r),e.elementType=HC,e.lanes=i,e;case UC:return e=_a(19,n,t,r),e.elementType=UC,e.lanes=i,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case yu:o=10;break e;case sF:o=9;break e;case M7:o=11;break e;case N7:o=14;break e;case Ed:o=16,s=null;break e}o=29,n=Error(Ue(130,e===null?"null":typeof e,"")),s=null}return t=_a(o,n,t,r),t.elementType=e,t.type=s,t.lanes=i,t}function Of(e,t,n,s){return e=_a(7,e,s,t),e.lanes=n,e}function OS(e,t,n){return e=_a(6,e,null,t),e.lanes=n,e}function BF(e){var t=_a(18,null,null,0);return t.stateNode=e,t}function PS(e,t,n){return t=_a(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var RI=new WeakMap;function ul(e,t){if(typeof e=="object"&&e!==null){var n=RI.get(e);return n!==void 0?n:(t={value:e,source:t,stack:hI(t)},RI.set(e,t),t)}return{value:e,source:t,stack:hI(t)}}var Ep=[],Ap=0,Jx=null,cy=0,rl=[],il=0,dh=null,vc=1,wc="";function du(e,t){Ep[Ap++]=cy,Ep[Ap++]=Jx,Jx=e,cy=t}function $F(e,t,n){rl[il++]=vc,rl[il++]=wc,rl[il++]=dh,dh=e;var s=vc;e=wc;var r=32-Ma(s)-1;s&=~(1<<r),n+=1;var i=32-Ma(t)+r;if(30<i){var o=r-r%5;i=(s&(1<<o)-1).toString(32),s>>=o,r-=o,vc=1<<32-Ma(t)+r|n<<r|s,wc=i+e}else vc=1<<i|n<<r|s,wc=e}function U7(e){e.return!==null&&(du(e,1),$F(e,1,0))}function V7(e){for(;e===Jx;)Jx=Ep[--Ap],Ep[Ap]=null,cy=Ep[--Ap],Ep[Ap]=null;for(;e===dh;)dh=rl[--il],rl[il]=null,wc=rl[--il],rl[il]=null,vc=rl[--il],rl[il]=null}function zF(e,t){rl[il++]=vc,rl[il++]=wc,rl[il++]=dh,vc=t.id,wc=t.overflow,dh=e}var no=null,wr=null,xs=!1,Zd=null,dl=!1,i6=Error(Ue(519));function hh(e){var t=Error(Ue(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw uy(ul(t,e)),i6}function jI(e){var t=e.stateNode,n=e.type,s=e.memoizedProps;switch(t[to]=e,t[ia]=s,n){case"dialog":hs("cancel",t),hs("close",t);break;case"iframe":case"object":case"embed":hs("load",t);break;case"video":case"audio":for(n=0;n<my.length;n++)hs(my[n],t);break;case"source":hs("error",t);break;case"img":case"image":case"link":hs("error",t),hs("load",t);break;case"details":hs("toggle",t);break;case"input":hs("invalid",t),gF(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":hs("invalid",t);break;case"textarea":hs("invalid",t),bF(t,s.value,s.defaultValue,s.children)}n=s.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||s.suppressHydrationWarning===!0||kH(t.textContent,n)?(s.popover!=null&&(hs("beforetoggle",t),hs("toggle",t)),s.onScroll!=null&&hs("scroll",t),s.onScrollEnd!=null&&hs("scrollend",t),s.onClick!=null&&(t.onclick=bu),t=!0):t=!1,t||hh(e,!0)}function LI(e){for(no=e.return;no;)switch(no.tag){case 5:case 31:case 13:dl=!1;return;case 27:case 3:dl=!0;return;default:no=no.return}}function Hm(e){if(e!==no)return!1;if(!xs)return LI(e),xs=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||N6(e.type,e.memoizedProps)),n=!n),n&&wr&&hh(e),LI(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Ue(317));wr=wR(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Ue(317));wr=wR(e)}else t===27?(t=wr,jh(e.type)?(e=L6,L6=null,wr=e):wr=t):wr=no?yl(e.stateNode.nextSibling):null;return!0}function Vf(){wr=no=null,xs=!1}function BS(){var e=Zd;return e!==null&&(Xo===null?Xo=e:Xo.push.apply(Xo,e),Zd=null),e}function uy(e){Zd===null?Zd=[e]:Zd.push(e)}var o6=Pc(null),gm=null,vu=null;function jd(e,t,n){yr(o6,t._currentValue),t._currentValue=n}function Su(e){e._currentValue=o6.current,qi(o6)}function a6(e,t,n){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===n)break;e=e.return}}function l6(e,t,n,s){var r=e.child;for(r!==null&&(r.return=e);r!==null;){var i=r.dependencies;if(i!==null){var o=r.child;i=i.firstContext;e:for(;i!==null;){var a=i;i=r;for(var l=0;l<t.length;l++)if(a.context===t[l]){i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),a6(i.return,n,e),s||(o=null);break e}i=a.next}}else if(r.tag===18){if(o=r.return,o===null)throw Error(Ue(341));o.lanes|=n,i=o.alternate,i!==null&&(i.lanes|=n),a6(o,n,e),o=null}else o=r.child;if(o!==null)o.return=r;else for(o=r;o!==null;){if(o===e){o=null;break}if(r=o.sibling,r!==null){r.return=o.return,o=r;break}o=o.return}r=o}}function B0(e,t,n,s){e=null;for(var r=t,i=!1;r!==null;){if(!i){if(r.flags&524288)i=!0;else if(r.flags&262144)break}if(r.tag===10){var o=r.alternate;if(o===null)throw Error(Ue(387));if(o=o.memoizedProps,o!==null){var a=r.type;La(r.pendingProps.value,o.value)||(e!==null?e.push(a):e=[a])}}else if(r===Vx.current){if(o=r.alternate,o===null)throw Error(Ue(387));o.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(gy):e=[gy])}r=r.return}e!==null&&l6(t,e,n,s),t.flags|=262144}function Zx(e){for(e=e.firstContext;e!==null;){if(!La(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Wf(e){gm=e,vu=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function so(e){return FF(gm,e)}function Sv(e,t){return gm===null&&Wf(e),FF(e,t)}function FF(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},vu===null){if(e===null)throw Error(Ue(308));vu=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else vu=vu.next=t;return n}var gie=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,s){e.push(s)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},yie=Ei.unstable_scheduleCallback,bie=Ei.unstable_NormalPriority,di={$$typeof:yu,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function W7(){return{controller:new gie,data:new Map,refCount:0}}function db(e){e.refCount--,e.refCount===0&&yie(bie,function(){e.controller.abort()})}var A1=null,c6=0,c0=0,qp=null;function vie(e,t){if(A1===null){var n=A1=[];c6=0,c0=yE(),qp={status:"pending",value:void 0,then:function(s){n.push(s)}}}return c6++,t.then(DI,DI),t}function DI(){if(--c6===0&&A1!==null){qp!==null&&(qp.status="fulfilled");var e=A1;A1=null,c0=0,qp=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function wie(e,t){var n=[],s={status:"pending",value:null,reason:null,then:function(r){n.push(r)}};return e.then(function(){s.status="fulfilled",s.value=t;for(var r=0;r<n.length;r++)(0,n[r])(t)},function(r){for(s.status="rejected",s.reason=r,r=0;r<n.length;r++)(0,n[r])(void 0)}),s}var OI=En.S;En.S=function(e,t){tH=Ea(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&vie(e,t),OI!==null&&OI(e,t)};var Pf=Pc(null);function G7(){var e=Pf.current;return e!==null?e:ur.pooledCache}function sx(e,t){t===null?yr(Pf,Pf.current):yr(Pf,t.pool)}function qF(){var e=G7();return e===null?null:{parent:di._currentValue,pool:e}}var $0=Error(Ue(460)),K7=Error(Ue(474)),s_=Error(Ue(542)),ek={then:function(){}};function PI(e){return e=e.status,e==="fulfilled"||e==="rejected"}function HF(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(bu,bu),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,$I(e),e;default:if(typeof t.status=="string")t.then(bu,bu);else{if(e=ur,e!==null&&100<e.shellSuspendCounter)throw Error(Ue(482));e=t,e.status="pending",e.then(function(s){if(t.status==="pending"){var r=t;r.status="fulfilled",r.value=s}},function(s){if(t.status==="pending"){var r=t;r.status="rejected",r.reason=s}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,$I(e),e}throw Bf=t,$0}}function gf(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Bf=n,$0):n}}var Bf=null;function BI(){if(Bf===null)throw Error(Ue(459));var e=Bf;return Bf=null,e}function $I(e){if(e===$0||e===s_)throw Error(Ue(483))}var Hp=null,dy=0;function Cv(e){var t=dy;return dy+=1,Hp===null&&(Hp=[]),HF(Hp,e,t)}function Mg(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Tv(e,t){throw t.$$typeof===ore?Error(Ue(525)):(e=Object.prototype.toString.call(t),Error(Ue(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function UF(e){function t(v,b){if(e){var x=v.deletions;x===null?(v.deletions=[b],v.flags|=16):x.push(b)}}function n(v,b){if(!e)return null;for(;b!==null;)t(v,b),b=b.sibling;return null}function s(v){for(var b=new Map;v!==null;)v.key!==null?b.set(v.key,v):b.set(v.index,v),v=v.sibling;return b}function r(v,b){return v=_u(v,b),v.index=0,v.sibling=null,v}function i(v,b,x){return v.index=x,e?(x=v.alternate,x!==null?(x=x.index,x<b?(v.flags|=67108866,b):x):(v.flags|=67108866,b)):(v.flags|=1048576,b)}function o(v){return e&&v.alternate===null&&(v.flags|=67108866),v}function a(v,b,x,k){return b===null||b.tag!==6?(b=OS(x,v.mode,k),b.return=v,b):(b=r(b,x),b.return=v,b)}function l(v,b,x,k){var T=x.type;return T===bp?d(v,b,x.props.children,k,x.key):b!==null&&(b.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Ed&&gf(T)===b.type)?(b=r(b,x.props),Mg(b,x),b.return=v,b):(b=nx(x.type,x.key,x.props,null,v.mode,k),Mg(b,x),b.return=v,b)}function c(v,b,x,k){return b===null||b.tag!==4||b.stateNode.containerInfo!==x.containerInfo||b.stateNode.implementation!==x.implementation?(b=PS(x,v.mode,k),b.return=v,b):(b=r(b,x.children||[]),b.return=v,b)}function d(v,b,x,k,T){return b===null||b.tag!==7?(b=Of(x,v.mode,k,T),b.return=v,b):(b=r(b,x),b.return=v,b)}function h(v,b,x){if(typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint")return b=OS(""+b,v.mode,x),b.return=v,b;if(typeof b=="object"&&b!==null){switch(b.$$typeof){case bv:return x=nx(b.type,b.key,b.props,null,v.mode,x),Mg(x,b),x.return=v,x;case t1:return b=PS(b,v.mode,x),b.return=v,b;case Ed:return b=gf(b),h(v,b,x)}if(n1(b)||Tg(b))return b=Of(b,v.mode,x,null),b.return=v,b;if(typeof b.then=="function")return h(v,Cv(b),x);if(b.$$typeof===yu)return h(v,Sv(v,b),x);Tv(v,b)}return null}function f(v,b,x,k){var T=b!==null?b.key:null;if(typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint")return T!==null?null:a(v,b,""+x,k);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case bv:return x.key===T?l(v,b,x,k):null;case t1:return x.key===T?c(v,b,x,k):null;case Ed:return x=gf(x),f(v,b,x,k)}if(n1(x)||Tg(x))return T!==null?null:d(v,b,x,k,null);if(typeof x.then=="function")return f(v,b,Cv(x),k);if(x.$$typeof===yu)return f(v,b,Sv(v,x),k);Tv(v,x)}return null}function p(v,b,x,k,T){if(typeof k=="string"&&k!==""||typeof k=="number"||typeof k=="bigint")return v=v.get(x)||null,a(b,v,""+k,T);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case bv:return v=v.get(k.key===null?x:k.key)||null,l(b,v,k,T);case t1:return v=v.get(k.key===null?x:k.key)||null,c(b,v,k,T);case Ed:return k=gf(k),p(v,b,x,k,T)}if(n1(k)||Tg(k))return v=v.get(x)||null,d(b,v,k,T,null);if(typeof k.then=="function")return p(v,b,x,Cv(k),T);if(k.$$typeof===yu)return p(v,b,x,Sv(b,k),T);Tv(b,k)}return null}function g(v,b,x,k){for(var T=null,C=null,S=b,_=b=0,L=null;S!==null&&_<x.length;_++){S.index>_?(L=S,S=null):L=S.sibling;var M=f(v,S,x[_],k);if(M===null){S===null&&(S=L);break}e&&S&&M.alternate===null&&t(v,S),b=i(M,b,_),C===null?T=M:C.sibling=M,C=M,S=L}if(_===x.length)return n(v,S),xs&&du(v,_),T;if(S===null){for(;_<x.length;_++)S=h(v,x[_],k),S!==null&&(b=i(S,b,_),C===null?T=S:C.sibling=S,C=S);return xs&&du(v,_),T}for(S=s(S);_<x.length;_++)L=p(S,v,_,x[_],k),L!==null&&(e&&L.alternate!==null&&S.delete(L.key===null?_:L.key),b=i(L,b,_),C===null?T=L:C.sibling=L,C=L);return e&&S.forEach(function(I){return t(v,I)}),xs&&du(v,_),T}function y(v,b,x,k){if(x==null)throw Error(Ue(151));for(var T=null,C=null,S=b,_=b=0,L=null,M=x.next();S!==null&&!M.done;_++,M=x.next()){S.index>_?(L=S,S=null):L=S.sibling;var I=f(v,S,M.value,k);if(I===null){S===null&&(S=L);break}e&&S&&I.alternate===null&&t(v,S),b=i(I,b,_),C===null?T=I:C.sibling=I,C=I,S=L}if(M.done)return n(v,S),xs&&du(v,_),T;if(S===null){for(;!M.done;_++,M=x.next())M=h(v,M.value,k),M!==null&&(b=i(M,b,_),C===null?T=M:C.sibling=M,C=M);return xs&&du(v,_),T}for(S=s(S);!M.done;_++,M=x.next())M=p(S,v,_,M.value,k),M!==null&&(e&&M.alternate!==null&&S.delete(M.key===null?_:M.key),b=i(M,b,_),C===null?T=M:C.sibling=M,C=M);return e&&S.forEach(function(A){return t(v,A)}),xs&&du(v,_),T}function w(v,b,x,k){if(typeof x=="object"&&x!==null&&x.type===bp&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case bv:e:{for(var T=x.key;b!==null;){if(b.key===T){if(T=x.type,T===bp){if(b.tag===7){n(v,b.sibling),k=r(b,x.props.children),k.return=v,v=k;break e}}else if(b.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Ed&&gf(T)===b.type){n(v,b.sibling),k=r(b,x.props),Mg(k,x),k.return=v,v=k;break e}n(v,b);break}else t(v,b);b=b.sibling}x.type===bp?(k=Of(x.props.children,v.mode,k,x.key),k.return=v,v=k):(k=nx(x.type,x.key,x.props,null,v.mode,k),Mg(k,x),k.return=v,v=k)}return o(v);case t1:e:{for(T=x.key;b!==null;){if(b.key===T)if(b.tag===4&&b.stateNode.containerInfo===x.containerInfo&&b.stateNode.implementation===x.implementation){n(v,b.sibling),k=r(b,x.children||[]),k.return=v,v=k;break e}else{n(v,b);break}else t(v,b);b=b.sibling}k=PS(x,v.mode,k),k.return=v,v=k}return o(v);case Ed:return x=gf(x),w(v,b,x,k)}if(n1(x))return g(v,b,x,k);if(Tg(x)){if(T=Tg(x),typeof T!="function")throw Error(Ue(150));return x=T.call(x),y(v,b,x,k)}if(typeof x.then=="function")return w(v,b,Cv(x),k);if(x.$$typeof===yu)return w(v,b,Sv(v,x),k);Tv(v,x)}return typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint"?(x=""+x,b!==null&&b.tag===6?(n(v,b.sibling),k=r(b,x),k.return=v,v=k):(n(v,b),k=OS(x,v.mode,k),k.return=v,v=k),o(v)):n(v,b)}return function(v,b,x,k){try{dy=0;var T=w(v,b,x,k);return Hp=null,T}catch(S){if(S===$0||S===s_)throw S;var C=_a(29,S,null,v.mode);return C.lanes=k,C.return=v,C}finally{}}}var Gf=UF(!0),VF=UF(!1),Ad=!1;function Y7(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function u6(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function eh(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function th(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,zs&2){var r=s.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),s.pending=t,t=Qx(e),OF(e,null,n),t}return n_(e,s,t,n),Qx(e)}function M1(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,cF(e,n)}}function $S(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var r=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};i===null?r=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?r=i=t:i=i.next=t}else r=i=t;n={baseState:s.baseState,firstBaseUpdate:r,lastBaseUpdate:i,shared:s.shared,callbacks:s.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var d6=!1;function N1(){if(d6){var e=qp;if(e!==null)throw e}}function I1(e,t,n,s){d6=!1;var r=e.updateQueue;Ad=!1;var i=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(a!==null){r.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?i=c:o.next=c,o=l;var d=e.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==o&&(a===null?d.firstBaseUpdate=c:a.next=c,d.lastBaseUpdate=l))}if(i!==null){var h=r.baseState;o=0,d=c=l=null,a=i;do{var f=a.lane&-536870913,p=f!==a.lane;if(p?(ys&f)===f:(s&f)===f){f!==0&&f===c0&&(d6=!0),d!==null&&(d=d.next={lane:0,tag:a.tag,payload:a.payload,callback:null,next:null});e:{var g=e,y=a;f=t;var w=n;switch(y.tag){case 1:if(g=y.payload,typeof g=="function"){h=g.call(w,h,f);break e}h=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=y.payload,f=typeof g=="function"?g.call(w,h,f):g,f==null)break e;h=kr({},h,f);break e;case 2:Ad=!0}}f=a.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=r.callbacks,p===null?r.callbacks=[f]:p.push(f))}else p={lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(c=d=p,l=h):d=d.next=p,o|=f;if(a=a.next,a===null){if(a=r.shared.pending,a===null)break;p=a,a=p.next,p.next=null,r.lastBaseUpdate=p,r.shared.pending=null}}while(!0);d===null&&(l=h),r.baseState=l,r.firstBaseUpdate=c,r.lastBaseUpdate=d,i===null&&(r.shared.lanes=0),mh|=o,e.lanes=o,e.memoizedState=h}}function WF(e,t){if(typeof e!="function")throw Error(Ue(191,e));e.call(t)}function GF(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)WF(n[e],t)}var u0=Pc(null),tk=Pc(0);function zI(e,t){e=Bu,yr(tk,e),yr(u0,t),Bu=e|t.baseLanes}function h6(){yr(tk,Bu),yr(u0,u0.current)}function X7(){Bu=tk.current,qi(u0),qi(tk)}var Da=Pc(null),gl=null;function Ld(e){var t=e.alternate;yr(Zr,Zr.current&1),yr(Da,e),gl===null&&(t===null||u0.current!==null||t.memoizedState!==null)&&(gl=e)}function f6(e){yr(Zr,Zr.current),yr(Da,e),gl===null&&(gl=e)}function KF(e){e.tag===22?(yr(Zr,Zr.current),yr(Da,e),gl===null&&(gl=e)):Dd()}function Dd(){yr(Zr,Zr.current),yr(Da,Da.current)}function xa(e){qi(Da),gl===e&&(gl=null),qi(Zr)}var Zr=Pc(0);function nk(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||R6(n)||j6(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Du=0,Yn=null,nr=null,ci=null,sk=!1,Up=!1,Kf=!1,rk=0,hy=0,Vp=null,xie=0;function Hr(){throw Error(Ue(321))}function Q7(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!La(e[n],t[n]))return!1;return!0}function J7(e,t,n,s,r,i){return Du=i,Yn=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,En.H=e===null||e.memoizedState===null?Cq:cE,Kf=!1,i=n(s,r),Kf=!1,Up&&(i=XF(t,n,s,r)),YF(e),i}function YF(e){En.H=fy;var t=nr!==null&&nr.next!==null;if(Du=0,ci=nr=Yn=null,sk=!1,hy=0,Vp=null,t)throw Error(Ue(300));e===null||hi||(e=e.dependencies,e!==null&&Zx(e)&&(hi=!0))}function XF(e,t,n,s){Yn=e;var r=0;do{if(Up&&(Vp=null),hy=0,Up=!1,25<=r)throw Error(Ue(301));if(r+=1,ci=nr=null,e.updateQueue!=null){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}En.H=Tq,i=t(n,s)}while(Up);return i}function kie(){var e=En.H,t=e.useState()[0];return t=typeof t.then=="function"?hb(t):t,e=e.useState()[0],(nr!==null?nr.memoizedState:null)!==e&&(Yn.flags|=1024),t}function Z7(){var e=rk!==0;return rk=0,e}function eE(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function tE(e){if(sk){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}sk=!1}Du=0,ci=nr=Yn=null,Up=!1,hy=rk=0,Vp=null}function Eo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ci===null?Yn.memoizedState=ci=e:ci=ci.next=e,ci}function ei(){if(nr===null){var e=Yn.alternate;e=e!==null?e.memoizedState:null}else e=nr.next;var t=ci===null?Yn.memoizedState:ci.next;if(t!==null)ci=t,nr=e;else{if(e===null)throw Yn.alternate===null?Error(Ue(467)):Error(Ue(310));nr=e,e={memoizedState:nr.memoizedState,baseState:nr.baseState,baseQueue:nr.baseQueue,queue:nr.queue,next:null},ci===null?Yn.memoizedState=ci=e:ci=ci.next=e}return ci}function r_(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function hb(e){var t=hy;return hy+=1,Vp===null&&(Vp=[]),e=HF(Vp,e,t),t=Yn,(ci===null?t.memoizedState:ci.next)===null&&(t=t.alternate,En.H=t===null||t.memoizedState===null?Cq:cE),e}function i_(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return hb(e);if(e.$$typeof===yu)return so(e)}throw Error(Ue(438,String(e)))}function nE(e){var t=null,n=Yn.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var s=Yn.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(t={data:s.data.map(function(r){return r.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=r_(),Yn.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),s=0;s<e;s++)n[s]=are;return t.index++,n}function Ou(e,t){return typeof t=="function"?t(e):t}function rx(e){var t=ei();return sE(t,nr,e)}function sE(e,t,n){var s=e.queue;if(s===null)throw Error(Ue(311));s.lastRenderedReducer=n;var r=e.baseQueue,i=s.pending;if(i!==null){if(r!==null){var o=r.next;r.next=i.next,i.next=o}t.baseQueue=r=i,s.pending=null}if(i=e.baseState,r===null)e.memoizedState=i;else{t=r.next;var a=o=null,l=null,c=t,d=!1;do{var h=c.lane&-536870913;if(h!==c.lane?(ys&h)===h:(Du&h)===h){var f=c.revertLane;if(f===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),h===c0&&(d=!0);else if((Du&f)===f){c=c.next,f===c0&&(d=!0);continue}else h={lane:0,revertLane:c.revertLane,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},l===null?(a=l=h,o=i):l=l.next=h,Yn.lanes|=f,mh|=f;h=c.action,Kf&&n(i,h),i=c.hasEagerState?c.eagerState:n(i,h)}else f={lane:h,revertLane:c.revertLane,gesture:c.gesture,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},l===null?(a=l=f,o=i):l=l.next=f,Yn.lanes|=h,mh|=h;c=c.next}while(c!==null&&c!==t);if(l===null?o=i:l.next=a,!La(i,e.memoizedState)&&(hi=!0,d&&(n=qp,n!==null)))throw n;e.memoizedState=i,e.baseState=o,e.baseQueue=l,s.lastRenderedState=i}return r===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function zS(e){var t=ei(),n=t.queue;if(n===null)throw Error(Ue(311));n.lastRenderedReducer=e;var s=n.dispatch,r=n.pending,i=t.memoizedState;if(r!==null){n.pending=null;var o=r=r.next;do i=e(i,o.action),o=o.next;while(o!==r);La(i,t.memoizedState)||(hi=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,s]}function QF(e,t,n){var s=Yn,r=ei(),i=xs;if(i){if(n===void 0)throw Error(Ue(407));n=n()}else n=t();var o=!La((nr||r).memoizedState,n);if(o&&(r.memoizedState=n,hi=!0),r=r.queue,rE(eq.bind(null,s,r,e),[e]),r.getSnapshot!==t||o||ci!==null&&ci.memoizedState.tag&1){if(s.flags|=2048,d0(9,{destroy:void 0},ZF.bind(null,s,r,n,t),null),ur===null)throw Error(Ue(349));i||Du&127||JF(s,t,n)}return n}function JF(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Yn.updateQueue,t===null?(t=r_(),Yn.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function ZF(e,t,n,s){t.value=n,t.getSnapshot=s,tq(t)&&nq(e)}function eq(e,t,n){return n(function(){tq(t)&&nq(e)})}function tq(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!La(e,n)}catch{return!0}}function nq(e){var t=pm(e,2);t!==null&&sa(t,e,2)}function m6(e){var t=Eo();if(typeof e=="function"){var n=e;if(e=n(),Kf){zd(!0);try{n()}finally{zd(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ou,lastRenderedState:e},t}function sq(e,t,n,s){return e.baseState=n,sE(e,nr,typeof s=="function"?s:Ou)}function _ie(e,t,n,s,r){if(a_(e))throw Error(Ue(485));if(e=t.action,e!==null){var i={payload:r,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(o){i.listeners.push(o)}};En.T!==null?n(!0):i.isTransition=!1,s(i),n=t.pending,n===null?(i.next=t.pending=i,rq(t,i)):(i.next=n.next,t.pending=n.next=i)}}function rq(e,t){var n=t.action,s=t.payload,r=e.state;if(t.isTransition){var i=En.T,o={};En.T=o;try{var a=n(r,s),l=En.S;l!==null&&l(o,a),FI(e,t,a)}catch(c){p6(e,t,c)}finally{i!==null&&o.types!==null&&(i.types=o.types),En.T=i}}else try{i=n(r,s),FI(e,t,i)}catch(c){p6(e,t,c)}}function FI(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(s){qI(e,t,s)},function(s){return p6(e,t,s)}):qI(e,t,n)}function qI(e,t,n){t.status="fulfilled",t.value=n,iq(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,rq(e,n)))}function p6(e,t,n){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=n,iq(t),t=t.next;while(t!==s)}e.action=null}function iq(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function oq(e,t){return t}function HI(e,t){if(xs){var n=ur.formState;if(n!==null){e:{var s=Yn;if(xs){if(wr){t:{for(var r=wr,i=dl;r.nodeType!==8;){if(!i){r=null;break t}if(r=yl(r.nextSibling),r===null){r=null;break t}}i=r.data,r=i==="F!"||i==="F"?r:null}if(r){wr=yl(r.nextSibling),s=r.data==="F!";break e}}hh(s)}s=!1}s&&(t=n[0])}}return n=Eo(),n.memoizedState=n.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:oq,lastRenderedState:t},n.queue=s,n=kq.bind(null,Yn,s),s.dispatch=n,s=m6(!1),i=lE.bind(null,Yn,!1,s.queue),s=Eo(),r={state:t,dispatch:null,action:e,pending:null},s.queue=r,n=_ie.bind(null,Yn,r,i,n),r.dispatch=n,s.memoizedState=e,[t,n,!1]}function UI(e){var t=ei();return aq(t,nr,e)}function aq(e,t,n){if(t=sE(e,t,oq)[0],e=rx(Ou)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=hb(t)}catch(o){throw o===$0?s_:o}else s=t;t=ei();var r=t.queue,i=r.dispatch;return n!==t.memoizedState&&(Yn.flags|=2048,d0(9,{destroy:void 0},Sie.bind(null,r,n),null)),[s,i,e]}function Sie(e,t){e.action=t}function VI(e){var t=ei(),n=nr;if(n!==null)return aq(t,n,e);ei(),t=t.memoizedState,n=ei();var s=n.queue.dispatch;return n.memoizedState=e,[t,s,!1]}function d0(e,t,n,s){return e={tag:e,create:n,deps:s,inst:t,next:null},t=Yn.updateQueue,t===null&&(t=r_(),Yn.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(s=n.next,n.next=e,e.next=s,t.lastEffect=e),e}function lq(){return ei().memoizedState}function ix(e,t,n,s){var r=Eo();Yn.flags|=e,r.memoizedState=d0(1|t,{destroy:void 0},n,s===void 0?null:s)}function o_(e,t,n,s){var r=ei();s=s===void 0?null:s;var i=r.memoizedState.inst;nr!==null&&s!==null&&Q7(s,nr.memoizedState.deps)?r.memoizedState=d0(t,i,n,s):(Yn.flags|=e,r.memoizedState=d0(1|t,i,n,s))}function WI(e,t){ix(8390656,8,e,t)}function rE(e,t){o_(2048,8,e,t)}function Cie(e){Yn.flags|=4;var t=Yn.updateQueue;if(t===null)t=r_(),Yn.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function cq(e){var t=ei().memoizedState;return Cie({ref:t,nextImpl:e}),function(){if(zs&2)throw Error(Ue(440));return t.impl.apply(void 0,arguments)}}function uq(e,t){return o_(4,2,e,t)}function dq(e,t){return o_(4,4,e,t)}function hq(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function fq(e,t,n){n=n!=null?n.concat([e]):null,o_(4,4,hq.bind(null,t,e),n)}function iE(){}function mq(e,t){var n=ei();t=t===void 0?null:t;var s=n.memoizedState;return t!==null&&Q7(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function pq(e,t){var n=ei();t=t===void 0?null:t;var s=n.memoizedState;if(t!==null&&Q7(t,s[1]))return s[0];if(s=e(),Kf){zd(!0);try{e()}finally{zd(!1)}}return n.memoizedState=[s,t],s}function oE(e,t,n){return n===void 0||Du&1073741824&&!(ys&261930)?e.memoizedState=t:(e.memoizedState=n,e=sH(),Yn.lanes|=e,mh|=e,n)}function gq(e,t,n,s){return La(n,t)?n:u0.current!==null?(e=oE(e,n,s),La(e,t)||(hi=!0),e):!(Du&42)||Du&1073741824&&!(ys&261930)?(hi=!0,e.memoizedState=n):(e=sH(),Yn.lanes|=e,mh|=e,t)}function yq(e,t,n,s,r){var i=qs.p;qs.p=i!==0&&8>i?i:8;var o=En.T,a={};En.T=a,lE(e,!1,t,n);try{var l=r(),c=En.S;if(c!==null&&c(a,l),l!==null&&typeof l=="object"&&typeof l.then=="function"){var d=wie(l,s);R1(e,t,d,Na(e))}else R1(e,t,s,Na(e))}catch(h){R1(e,t,{then:function(){},status:"rejected",reason:h},Na())}finally{qs.p=i,o!==null&&a.types!==null&&(o.types=a.types),En.T=o}}function Tie(){}function g6(e,t,n,s){if(e.tag!==5)throw Error(Ue(476));var r=bq(e).queue;yq(e,r,t,Df,n===null?Tie:function(){return vq(e),n(s)})}function bq(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Df,baseState:Df,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ou,lastRenderedState:Df},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ou,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function vq(e){var t=bq(e);t.next===null&&(t=e.alternate.memoizedState),R1(e,t.next.queue,{},Na())}function aE(){return so(gy)}function wq(){return ei().memoizedState}function xq(){return ei().memoizedState}function Eie(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Na();e=eh(n);var s=th(t,e,n);s!==null&&(sa(s,t,n),M1(s,t,n)),t={cache:W7()},e.payload=t;return}t=t.return}}function Aie(e,t,n){var s=Na();n={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},a_(e)?_q(t,n):(n=q7(e,t,n,s),n!==null&&(sa(n,e,s),Sq(n,t,s)))}function kq(e,t,n){var s=Na();R1(e,t,n,s)}function R1(e,t,n,s){var r={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(a_(e))_q(t,r);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,a=i(o,n);if(r.hasEagerState=!0,r.eagerState=a,La(a,o))return n_(e,t,r,0),ur===null&&t_(),!1}catch{}finally{}if(n=q7(e,t,r,s),n!==null)return sa(n,e,s),Sq(n,t,s),!0}return!1}function lE(e,t,n,s){if(s={lane:2,revertLane:yE(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},a_(e)){if(t)throw Error(Ue(479))}else t=q7(e,n,s,2),t!==null&&sa(t,e,2)}function a_(e){var t=e.alternate;return e===Yn||t!==null&&t===Yn}function _q(e,t){Up=sk=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Sq(e,t,n){if(n&4194048){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,cF(e,n)}}var fy={readContext:so,use:i_,useCallback:Hr,useContext:Hr,useEffect:Hr,useImperativeHandle:Hr,useLayoutEffect:Hr,useInsertionEffect:Hr,useMemo:Hr,useReducer:Hr,useRef:Hr,useState:Hr,useDebugValue:Hr,useDeferredValue:Hr,useTransition:Hr,useSyncExternalStore:Hr,useId:Hr,useHostTransitionStatus:Hr,useFormState:Hr,useActionState:Hr,useOptimistic:Hr,useMemoCache:Hr,useCacheRefresh:Hr};fy.useEffectEvent=Hr;var Cq={readContext:so,use:i_,useCallback:function(e,t){return Eo().memoizedState=[e,t===void 0?null:t],e},useContext:so,useEffect:WI,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,ix(4194308,4,hq.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ix(4194308,4,e,t)},useInsertionEffect:function(e,t){ix(4,2,e,t)},useMemo:function(e,t){var n=Eo();t=t===void 0?null:t;var s=e();if(Kf){zd(!0);try{e()}finally{zd(!1)}}return n.memoizedState=[s,t],s},useReducer:function(e,t,n){var s=Eo();if(n!==void 0){var r=n(t);if(Kf){zd(!0);try{n(t)}finally{zd(!1)}}}else r=t;return s.memoizedState=s.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},s.queue=e,e=e.dispatch=Aie.bind(null,Yn,e),[s.memoizedState,e]},useRef:function(e){var t=Eo();return e={current:e},t.memoizedState=e},useState:function(e){e=m6(e);var t=e.queue,n=kq.bind(null,Yn,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:iE,useDeferredValue:function(e,t){var n=Eo();return oE(n,e,t)},useTransition:function(){var e=m6(!1);return e=yq.bind(null,Yn,e.queue,!0,!1),Eo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var s=Yn,r=Eo();if(xs){if(n===void 0)throw Error(Ue(407));n=n()}else{if(n=t(),ur===null)throw Error(Ue(349));ys&127||JF(s,t,n)}r.memoizedState=n;var i={value:n,getSnapshot:t};return r.queue=i,WI(eq.bind(null,s,i,e),[e]),s.flags|=2048,d0(9,{destroy:void 0},ZF.bind(null,s,i,n,t),null),n},useId:function(){var e=Eo(),t=ur.identifierPrefix;if(xs){var n=wc,s=vc;n=(s&~(1<<32-Ma(s)-1)).toString(32)+n,t="_"+t+"R_"+n,n=rk++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=xie++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:aE,useFormState:HI,useActionState:HI,useOptimistic:function(e){var t=Eo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=lE.bind(null,Yn,!0,n),n.dispatch=t,[e,t]},useMemoCache:nE,useCacheRefresh:function(){return Eo().memoizedState=Eie.bind(null,Yn)},useEffectEvent:function(e){var t=Eo(),n={impl:e};return t.memoizedState=n,function(){if(zs&2)throw Error(Ue(440));return n.impl.apply(void 0,arguments)}}},cE={readContext:so,use:i_,useCallback:mq,useContext:so,useEffect:rE,useImperativeHandle:fq,useInsertionEffect:uq,useLayoutEffect:dq,useMemo:pq,useReducer:rx,useRef:lq,useState:function(){return rx(Ou)},useDebugValue:iE,useDeferredValue:function(e,t){var n=ei();return gq(n,nr.memoizedState,e,t)},useTransition:function(){var e=rx(Ou)[0],t=ei().memoizedState;return[typeof e=="boolean"?e:hb(e),t]},useSyncExternalStore:QF,useId:wq,useHostTransitionStatus:aE,useFormState:UI,useActionState:UI,useOptimistic:function(e,t){var n=ei();return sq(n,nr,e,t)},useMemoCache:nE,useCacheRefresh:xq};cE.useEffectEvent=cq;var Tq={readContext:so,use:i_,useCallback:mq,useContext:so,useEffect:rE,useImperativeHandle:fq,useInsertionEffect:uq,useLayoutEffect:dq,useMemo:pq,useReducer:zS,useRef:lq,useState:function(){return zS(Ou)},useDebugValue:iE,useDeferredValue:function(e,t){var n=ei();return nr===null?oE(n,e,t):gq(n,nr.memoizedState,e,t)},useTransition:function(){var e=zS(Ou)[0],t=ei().memoizedState;return[typeof e=="boolean"?e:hb(e),t]},useSyncExternalStore:QF,useId:wq,useHostTransitionStatus:aE,useFormState:VI,useActionState:VI,useOptimistic:function(e,t){var n=ei();return nr!==null?sq(n,nr,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:nE,useCacheRefresh:xq};Tq.useEffectEvent=cq;function FS(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:kr({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var y6={enqueueSetState:function(e,t,n){e=e._reactInternals;var s=Na(),r=eh(s);r.payload=t,n!=null&&(r.callback=n),t=th(e,r,s),t!==null&&(sa(t,e,s),M1(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=Na(),r=eh(s);r.tag=1,r.payload=t,n!=null&&(r.callback=n),t=th(e,r,s),t!==null&&(sa(t,e,s),M1(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Na(),s=eh(n);s.tag=2,t!=null&&(s.callback=t),t=th(e,s,n),t!==null&&(sa(t,e,n),M1(t,e,n))}};function GI(e,t,n,s,r,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,i,o):t.prototype&&t.prototype.isPureReactComponent?!ly(n,s)||!ly(r,i):!0}function KI(e,t,n,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,s),t.state!==e&&y6.enqueueReplaceState(t,t.state,null)}function Yf(e,t){var n=t;if("ref"in t){n={};for(var s in t)s!=="ref"&&(n[s]=t[s])}if(e=e.defaultProps){n===t&&(n=kr({},n));for(var r in e)n[r]===void 0&&(n[r]=e[r])}return n}function Eq(e){Xx(e)}function Aq(e){console.error(e)}function Mq(e){Xx(e)}function ik(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function YI(e,t,n){try{var s=e.onCaughtError;s(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(r){setTimeout(function(){throw r})}}function b6(e,t,n){return n=eh(n),n.tag=3,n.payload={element:null},n.callback=function(){ik(e,t)},n}function Nq(e){return e=eh(e),e.tag=3,e}function Iq(e,t,n,s){var r=n.type.getDerivedStateFromError;if(typeof r=="function"){var i=s.value;e.payload=function(){return r(i)},e.callback=function(){YI(t,n,s)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch=="function"&&(e.callback=function(){YI(t,n,s),typeof r!="function"&&(nh===null?nh=new Set([this]):nh.add(this));var a=s.stack;this.componentDidCatch(s.value,{componentStack:a!==null?a:""})})}function Mie(e,t,n,s,r){if(n.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=n.alternate,t!==null&&B0(t,n,r,!0),n=Da.current,n!==null){switch(n.tag){case 31:case 13:return gl===null?uk():n.alternate===null&&Vr===0&&(Vr=3),n.flags&=-257,n.flags|=65536,n.lanes=r,s===ek?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([s]):t.add(s),JS(e,s,r)),!1;case 22:return n.flags|=65536,s===ek?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([s])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([s]):n.add(s)),JS(e,s,r)),!1}throw Error(Ue(435,n.tag))}return JS(e,s,r),uk(),!1}if(xs)return t=Da.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=r,s!==i6&&(e=Error(Ue(422),{cause:s}),uy(ul(e,n)))):(s!==i6&&(t=Error(Ue(423),{cause:s}),uy(ul(t,n))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,s=ul(s,n),r=b6(e.stateNode,s,r),$S(e,r),Vr!==4&&(Vr=2)),!1;var i=Error(Ue(520),{cause:s});if(i=ul(i,n),D1===null?D1=[i]:D1.push(i),Vr!==4&&(Vr=2),t===null)return!0;s=ul(s,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=r&-r,n.lanes|=e,e=b6(n.stateNode,s,e),$S(n,e),!1;case 1:if(t=n.type,i=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||i!==null&&typeof i.componentDidCatch=="function"&&(nh===null||!nh.has(i))))return n.flags|=65536,r&=-r,n.lanes|=r,r=Nq(r),Iq(r,e,n,s),$S(n,r),!1}n=n.return}while(n!==null);return!1}var uE=Error(Ue(461)),hi=!1;function Xi(e,t,n,s){t.child=e===null?VF(t,null,n,s):Gf(t,e.child,n,s)}function XI(e,t,n,s,r){n=n.render;var i=t.ref;if("ref"in s){var o={};for(var a in s)a!=="ref"&&(o[a]=s[a])}else o=s;return Wf(t),s=J7(e,t,n,o,i,r),a=Z7(),e!==null&&!hi?(eE(e,t,r),Pu(e,t,r)):(xs&&a&&U7(t),t.flags|=1,Xi(e,t,s,r),t.child)}function QI(e,t,n,s,r){if(e===null){var i=n.type;return typeof i=="function"&&!H7(i)&&i.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=i,Rq(e,t,i,s,r)):(e=nx(n.type,null,s,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!dE(e,r)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:ly,n(o,s)&&e.ref===t.ref)return Pu(e,t,r)}return t.flags|=1,e=_u(i,s),e.ref=t.ref,e.return=t,t.child=e}function Rq(e,t,n,s,r){if(e!==null){var i=e.memoizedProps;if(ly(i,s)&&e.ref===t.ref)if(hi=!1,t.pendingProps=s=i,dE(e,r))e.flags&131072&&(hi=!0);else return t.lanes=e.lanes,Pu(e,t,r)}return v6(e,t,n,s,r)}function jq(e,t,n,s){var r=s.children,i=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if(t.flags&128){if(i=i!==null?i.baseLanes|n:n,e!==null){for(s=t.child=e.child,r=0;s!==null;)r=r|s.lanes|s.childLanes,s=s.sibling;s=r&~i}else s=0,t.child=null;return JI(e,t,i,n,s)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&sx(t,i!==null?i.cachePool:null),i!==null?zI(t,i):h6(),KF(t);else return s=t.lanes=536870912,JI(e,t,i!==null?i.baseLanes|n:n,n,s)}else i!==null?(sx(t,i.cachePool),zI(t,i),Dd(),t.memoizedState=null):(e!==null&&sx(t,null),h6(),Dd());return Xi(e,t,r,n),t.child}function r1(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function JI(e,t,n,s,r){var i=G7();return i=i===null?null:{parent:di._currentValue,pool:i},t.memoizedState={baseLanes:n,cachePool:i},e!==null&&sx(t,null),h6(),KF(t),e!==null&&B0(e,t,s,!0),t.childLanes=r,null}function ox(e,t){return t=ok({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function ZI(e,t,n){return Gf(t,e.child,null,n),e=ox(t,t.pendingProps),e.flags|=2,xa(t),t.memoizedState=null,e}function Nie(e,t,n){var s=t.pendingProps,r=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(xs){if(s.mode==="hidden")return e=ox(t,s),t.lanes=536870912,r1(null,e);if(f6(t),(e=wr)?(e=CH(e,dl),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:dh!==null?{id:vc,overflow:wc}:null,retryLane:536870912,hydrationErrors:null},n=BF(e),n.return=t,t.child=n,no=t,wr=null)):e=null,e===null)throw hh(t);return t.lanes=536870912,null}return ox(t,s)}var i=e.memoizedState;if(i!==null){var o=i.dehydrated;if(f6(t),r)if(t.flags&256)t.flags&=-257,t=ZI(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(Ue(558));else if(hi||B0(e,t,n,!1),r=(n&e.childLanes)!==0,hi||r){if(s=ur,s!==null&&(o=uF(s,n),o!==0&&o!==i.retryLane))throw i.retryLane=o,pm(e,o),sa(s,e,o),uE;uk(),t=ZI(e,t,n)}else e=i.treeContext,wr=yl(o.nextSibling),no=t,xs=!0,Zd=null,dl=!1,e!==null&&zF(t,e),t=ox(t,s),t.flags|=4096;return t}return e=_u(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function ax(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(Ue(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function v6(e,t,n,s,r){return Wf(t),n=J7(e,t,n,s,void 0,r),s=Z7(),e!==null&&!hi?(eE(e,t,r),Pu(e,t,r)):(xs&&s&&U7(t),t.flags|=1,Xi(e,t,n,r),t.child)}function eR(e,t,n,s,r,i){return Wf(t),t.updateQueue=null,n=XF(t,s,n,r),YF(e),s=Z7(),e!==null&&!hi?(eE(e,t,i),Pu(e,t,i)):(xs&&s&&U7(t),t.flags|=1,Xi(e,t,n,i),t.child)}function tR(e,t,n,s,r){if(Wf(t),t.stateNode===null){var i=Tp,o=n.contextType;typeof o=="object"&&o!==null&&(i=so(o)),i=new n(s,i),t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=y6,t.stateNode=i,i._reactInternals=t,i=t.stateNode,i.props=s,i.state=t.memoizedState,i.refs={},Y7(t),o=n.contextType,i.context=typeof o=="object"&&o!==null?so(o):Tp,i.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o=="function"&&(FS(t,n,o,s),i.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(o=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),o!==i.state&&y6.enqueueReplaceState(i,i.state,null),I1(t,s,i,r),N1(),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){i=t.stateNode;var a=t.memoizedProps,l=Yf(n,a);i.props=l;var c=i.context,d=n.contextType;o=Tp,typeof d=="object"&&d!==null&&(o=so(d));var h=n.getDerivedStateFromProps;d=typeof h=="function"||typeof i.getSnapshotBeforeUpdate=="function",a=t.pendingProps!==a,d||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(a||c!==o)&&KI(t,i,s,o),Ad=!1;var f=t.memoizedState;i.state=f,I1(t,s,i,r),N1(),c=t.memoizedState,a||f!==c||Ad?(typeof h=="function"&&(FS(t,n,h,s),c=t.memoizedState),(l=Ad||GI(t,n,l,s,f,c,o))?(d||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=c),i.props=s,i.state=c,i.context=o,s=l):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{i=t.stateNode,u6(e,t),o=t.memoizedProps,d=Yf(n,o),i.props=d,h=t.pendingProps,f=i.context,c=n.contextType,l=Tp,typeof c=="object"&&c!==null&&(l=so(c)),a=n.getDerivedStateFromProps,(c=typeof a=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(o!==h||f!==l)&&KI(t,i,s,l),Ad=!1,f=t.memoizedState,i.state=f,I1(t,s,i,r),N1();var p=t.memoizedState;o!==h||f!==p||Ad||e!==null&&e.dependencies!==null&&Zx(e.dependencies)?(typeof a=="function"&&(FS(t,n,a,s),p=t.memoizedState),(d=Ad||GI(t,n,d,s,f,p,l)||e!==null&&e.dependencies!==null&&Zx(e.dependencies))?(c||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(s,p,l),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(s,p,l)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=p),i.props=s,i.state=p,i.context=l,s=d):(typeof i.componentDidUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),s=!1)}return i=s,ax(e,t),s=(t.flags&128)!==0,i||s?(i=t.stateNode,n=s&&typeof n.getDerivedStateFromError!="function"?null:i.render(),t.flags|=1,e!==null&&s?(t.child=Gf(t,e.child,null,r),t.child=Gf(t,null,n,r)):Xi(e,t,n,r),t.memoizedState=i.state,e=t.child):e=Pu(e,t,r),e}function nR(e,t,n,s){return Vf(),t.flags|=256,Xi(e,t,n,s),t.child}var qS={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function HS(e){return{baseLanes:e,cachePool:qF()}}function US(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Sa),e}function Lq(e,t,n){var s=t.pendingProps,r=!1,i=(t.flags&128)!==0,o;if((o=i)||(o=e!==null&&e.memoizedState===null?!1:(Zr.current&2)!==0),o&&(r=!0,t.flags&=-129),o=(t.flags&32)!==0,t.flags&=-33,e===null){if(xs){if(r?Ld(t):Dd(),(e=wr)?(e=CH(e,dl),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:dh!==null?{id:vc,overflow:wc}:null,retryLane:536870912,hydrationErrors:null},n=BF(e),n.return=t,t.child=n,no=t,wr=null)):e=null,e===null)throw hh(t);return j6(e)?t.lanes=32:t.lanes=536870912,null}var a=s.children;return s=s.fallback,r?(Dd(),r=t.mode,a=ok({mode:"hidden",children:a},r),s=Of(s,r,n,null),a.return=t,s.return=t,a.sibling=s,t.child=a,s=t.child,s.memoizedState=HS(n),s.childLanes=US(e,o,n),t.memoizedState=qS,r1(null,s)):(Ld(t),w6(t,a))}var l=e.memoizedState;if(l!==null&&(a=l.dehydrated,a!==null)){if(i)t.flags&256?(Ld(t),t.flags&=-257,t=VS(e,t,n)):t.memoizedState!==null?(Dd(),t.child=e.child,t.flags|=128,t=null):(Dd(),a=s.fallback,r=t.mode,s=ok({mode:"visible",children:s.children},r),a=Of(a,r,n,null),a.flags|=2,s.return=t,a.return=t,s.sibling=a,t.child=s,Gf(t,e.child,null,n),s=t.child,s.memoizedState=HS(n),s.childLanes=US(e,o,n),t.memoizedState=qS,t=r1(null,s));else if(Ld(t),j6(a)){if(o=a.nextSibling&&a.nextSibling.dataset,o)var c=o.dgst;o=c,s=Error(Ue(419)),s.stack="",s.digest=o,uy({value:s,source:null,stack:null}),t=VS(e,t,n)}else if(hi||B0(e,t,n,!1),o=(n&e.childLanes)!==0,hi||o){if(o=ur,o!==null&&(s=uF(o,n),s!==0&&s!==l.retryLane))throw l.retryLane=s,pm(e,s),sa(o,e,s),uE;R6(a)||uk(),t=VS(e,t,n)}else R6(a)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,wr=yl(a.nextSibling),no=t,xs=!0,Zd=null,dl=!1,e!==null&&zF(t,e),t=w6(t,s.children),t.flags|=4096);return t}return r?(Dd(),a=s.fallback,r=t.mode,l=e.child,c=l.sibling,s=_u(l,{mode:"hidden",children:s.children}),s.subtreeFlags=l.subtreeFlags&65011712,c!==null?a=_u(c,a):(a=Of(a,r,n,null),a.flags|=2),a.return=t,s.return=t,s.sibling=a,t.child=s,r1(null,s),s=t.child,a=e.child.memoizedState,a===null?a=HS(n):(r=a.cachePool,r!==null?(l=di._currentValue,r=r.parent!==l?{parent:l,pool:l}:r):r=qF(),a={baseLanes:a.baseLanes|n,cachePool:r}),s.memoizedState=a,s.childLanes=US(e,o,n),t.memoizedState=qS,r1(e.child,s)):(Ld(t),n=e.child,e=n.sibling,n=_u(n,{mode:"visible",children:s.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function w6(e,t){return t=ok({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function ok(e,t){return e=_a(22,e,null,t),e.lanes=0,e}function VS(e,t,n){return Gf(t,e.child,null,n),e=w6(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function sR(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),a6(e.return,t,n)}function WS(e,t,n,s,r,i){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:n,tailMode:r,treeForkCount:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=s,o.tail=n,o.tailMode=r,o.treeForkCount=i)}function Dq(e,t,n){var s=t.pendingProps,r=s.revealOrder,i=s.tail;s=s.children;var o=Zr.current,a=(o&2)!==0;if(a?(o=o&1|2,t.flags|=128):o&=1,yr(Zr,o),Xi(e,t,s,n),s=xs?cy:0,!a&&e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&sR(e,n,t);else if(e.tag===19)sR(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(r){case"forwards":for(n=t.child,r=null;n!==null;)e=n.alternate,e!==null&&nk(e)===null&&(r=n),n=n.sibling;n=r,n===null?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null),WS(t,!1,r,n,i,s);break;case"backwards":case"unstable_legacy-backwards":for(n=null,r=t.child,t.child=null;r!==null;){if(e=r.alternate,e!==null&&nk(e)===null){t.child=r;break}e=r.sibling,r.sibling=n,n=r,r=e}WS(t,!0,n,null,i,s);break;case"together":WS(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function Pu(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),mh|=t.lanes,!(n&t.childLanes))if(e!==null){if(B0(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(Ue(153));if(t.child!==null){for(e=t.child,n=_u(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=_u(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function dE(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&Zx(e)))}function Iie(e,t,n){switch(t.tag){case 3:Wx(t,t.stateNode.containerInfo),jd(t,di,e.memoizedState.cache),Vf();break;case 27:case 5:KC(t);break;case 4:Wx(t,t.stateNode.containerInfo);break;case 10:jd(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,f6(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(Ld(t),t.flags|=128,null):n&t.child.childLanes?Lq(e,t,n):(Ld(t),e=Pu(e,t,n),e!==null?e.sibling:null);Ld(t);break;case 19:var r=(e.flags&128)!==0;if(s=(n&t.childLanes)!==0,s||(B0(e,t,n,!1),s=(n&t.childLanes)!==0),r){if(s)return Dq(e,t,n);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),yr(Zr,Zr.current),s)break;return null;case 22:return t.lanes=0,jq(e,t,n,t.pendingProps);case 24:jd(t,di,e.memoizedState.cache)}return Pu(e,t,n)}function Oq(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)hi=!0;else{if(!dE(e,n)&&!(t.flags&128))return hi=!1,Iie(e,t,n);hi=!!(e.flags&131072)}else hi=!1,xs&&t.flags&1048576&&$F(t,cy,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=gf(t.elementType),t.type=e,typeof e=="function")H7(e)?(s=Yf(e,s),t.tag=1,t=tR(null,t,e,s,n)):(t.tag=0,t=v6(null,t,e,s,n));else{if(e!=null){var r=e.$$typeof;if(r===M7){t.tag=11,t=XI(null,t,e,s,n);break e}else if(r===N7){t.tag=14,t=QI(null,t,e,s,n);break e}}throw t=WC(e)||e,Error(Ue(306,t,""))}}return t;case 0:return v6(e,t,t.type,t.pendingProps,n);case 1:return s=t.type,r=Yf(s,t.pendingProps),tR(e,t,s,r,n);case 3:e:{if(Wx(t,t.stateNode.containerInfo),e===null)throw Error(Ue(387));s=t.pendingProps;var i=t.memoizedState;r=i.element,u6(e,t),I1(t,s,null,n);var o=t.memoizedState;if(s=o.cache,jd(t,di,s),s!==i.cache&&l6(t,[di],n,!0),N1(),s=o.element,i.isDehydrated)if(i={element:s,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){t=nR(e,t,s,n);break e}else if(s!==r){r=ul(Error(Ue(424)),t),uy(r),t=nR(e,t,s,n);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(wr=yl(e.firstChild),no=t,xs=!0,Zd=null,dl=!0,n=VF(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Vf(),s===r){t=Pu(e,t,n);break e}Xi(e,t,s,n)}t=t.child}return t;case 26:return ax(e,t),e===null?(n=_R(t.type,null,t.pendingProps,null))?t.memoizedState=n:xs||(n=t.type,e=t.pendingProps,s=mk(Jd.current).createElement(n),s[to]=t,s[ia]=e,io(s,n,e),$i(s),t.stateNode=s):t.memoizedState=_R(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return KC(t),e===null&&xs&&(s=t.stateNode=TH(t.type,t.pendingProps,Jd.current),no=t,dl=!0,r=wr,jh(t.type)?(L6=r,wr=yl(s.firstChild)):wr=r),Xi(e,t,t.pendingProps.children,n),ax(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&xs&&((r=s=wr)&&(s=aoe(s,t.type,t.pendingProps,dl),s!==null?(t.stateNode=s,no=t,wr=yl(s.firstChild),dl=!1,r=!0):r=!1),r||hh(t)),KC(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,s=i.children,N6(r,i)?s=null:o!==null&&N6(r,o)&&(t.flags|=32),t.memoizedState!==null&&(r=J7(e,t,kie,null,null,n),gy._currentValue=r),ax(e,t),Xi(e,t,s,n),t.child;case 6:return e===null&&xs&&((e=n=wr)&&(n=loe(n,t.pendingProps,dl),n!==null?(t.stateNode=n,no=t,wr=null,e=!0):e=!1),e||hh(t)),null;case 13:return Lq(e,t,n);case 4:return Wx(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=Gf(t,null,s,n):Xi(e,t,s,n),t.child;case 11:return XI(e,t,t.type,t.pendingProps,n);case 7:return Xi(e,t,t.pendingProps,n),t.child;case 8:return Xi(e,t,t.pendingProps.children,n),t.child;case 12:return Xi(e,t,t.pendingProps.children,n),t.child;case 10:return s=t.pendingProps,jd(t,t.type,s.value),Xi(e,t,s.children,n),t.child;case 9:return r=t.type._context,s=t.pendingProps.children,Wf(t),r=so(r),s=s(r),t.flags|=1,Xi(e,t,s,n),t.child;case 14:return QI(e,t,t.type,t.pendingProps,n);case 15:return Rq(e,t,t.type,t.pendingProps,n);case 19:return Dq(e,t,n);case 31:return Nie(e,t,n);case 22:return jq(e,t,n,t.pendingProps);case 24:return Wf(t),s=so(di),e===null?(r=G7(),r===null&&(r=ur,i=W7(),r.pooledCache=i,i.refCount++,i!==null&&(r.pooledCacheLanes|=n),r=i),t.memoizedState={parent:s,cache:r},Y7(t),jd(t,di,r)):(e.lanes&n&&(u6(e,t),I1(t,null,null,n),N1()),r=e.memoizedState,i=t.memoizedState,r.parent!==s?(r={parent:s,cache:s},t.memoizedState=r,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=r),jd(t,di,s)):(s=i.cache,jd(t,di,s),s!==r.cache&&l6(t,[di],n,!0))),Xi(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(Ue(156,t.tag))}function nu(e){e.flags|=4}function GS(e,t,n,s,r){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(r&335544128)===r)if(e.stateNode.complete)e.flags|=8192;else if(oH())e.flags|=8192;else throw Bf=ek,K7}else e.flags&=-16777217}function rR(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!MH(t))if(oH())e.flags|=8192;else throw Bf=ek,K7}function Ev(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?aF():536870912,e.lanes|=t,h0|=t)}function Ng(e,t){if(!xs)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function vr(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,s=0;if(t)for(var r=e.child;r!==null;)n|=r.lanes|r.childLanes,s|=r.subtreeFlags&65011712,s|=r.flags&65011712,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)n|=r.lanes|r.childLanes,s|=r.subtreeFlags,s|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=s,e.childLanes=n,t}function Rie(e,t,n){var s=t.pendingProps;switch(V7(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return vr(t),null;case 1:return vr(t),null;case 3:return n=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),Su(di),o0(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Hm(t)?nu(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,BS())),vr(t),null;case 26:var r=t.type,i=t.memoizedState;return e===null?(nu(t),i!==null?(vr(t),rR(t,i)):(vr(t),GS(t,r,null,s,n))):i?i!==e.memoizedState?(nu(t),vr(t),rR(t,i)):(vr(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&nu(t),vr(t),GS(t,r,e,s,n)),null;case 27:if(Gx(t),n=Jd.current,r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&nu(t);else{if(!s){if(t.stateNode===null)throw Error(Ue(166));return vr(t),null}e=Ac.current,Hm(t)?jI(t):(e=TH(r,s,n),t.stateNode=e,nu(t))}return vr(t),null;case 5:if(Gx(t),r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&nu(t);else{if(!s){if(t.stateNode===null)throw Error(Ue(166));return vr(t),null}if(i=Ac.current,Hm(t))jI(t);else{var o=mk(Jd.current);switch(i){case 1:i=o.createElementNS("http://www.w3.org/2000/svg",r);break;case 2:i=o.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;default:switch(r){case"svg":i=o.createElementNS("http://www.w3.org/2000/svg",r);break;case"math":i=o.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;case"script":i=o.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof s.is=="string"?o.createElement("select",{is:s.is}):o.createElement("select"),s.multiple?i.multiple=!0:s.size&&(i.size=s.size);break;default:i=typeof s.is=="string"?o.createElement(r,{is:s.is}):o.createElement(r)}}i[to]=t,i[ia]=s;e:for(o=t.child;o!==null;){if(o.tag===5||o.tag===6)i.appendChild(o.stateNode);else if(o.tag!==4&&o.tag!==27&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break e;for(;o.sibling===null;){if(o.return===null||o.return===t)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}t.stateNode=i;e:switch(io(i,r,s),r){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&nu(t)}}return vr(t),GS(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&nu(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(Ue(166));if(e=Jd.current,Hm(t)){if(e=t.stateNode,n=t.memoizedProps,s=null,r=no,r!==null)switch(r.tag){case 27:case 5:s=r.memoizedProps}e[to]=t,e=!!(e.nodeValue===n||s!==null&&s.suppressHydrationWarning===!0||kH(e.nodeValue,n)),e||hh(t,!0)}else e=mk(e).createTextNode(s),e[to]=t,t.stateNode=e}return vr(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(s=Hm(t),n!==null){if(e===null){if(!s)throw Error(Ue(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Ue(557));e[to]=t}else Vf(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;vr(t),e=!1}else n=BS(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(xa(t),t):(xa(t),null);if(t.flags&128)throw Error(Ue(558))}return vr(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=Hm(t),s!==null&&s.dehydrated!==null){if(e===null){if(!r)throw Error(Ue(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(Ue(317));r[to]=t}else Vf(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;vr(t),r=!1}else r=BS(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(xa(t),t):(xa(t),null)}return xa(t),t.flags&128?(t.lanes=n,t):(n=s!==null,e=e!==null&&e.memoizedState!==null,n&&(s=t.child,r=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(r=s.alternate.memoizedState.cachePool.pool),i=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(i=s.memoizedState.cachePool.pool),i!==r&&(s.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Ev(t,t.updateQueue),vr(t),null);case 4:return o0(),e===null&&bE(t.stateNode.containerInfo),vr(t),null;case 10:return Su(t.type),vr(t),null;case 19:if(qi(Zr),s=t.memoizedState,s===null)return vr(t),null;if(r=(t.flags&128)!==0,i=s.rendering,i===null)if(r)Ng(s,!1);else{if(Vr!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=nk(e),i!==null){for(t.flags|=128,Ng(s,!1),e=i.updateQueue,t.updateQueue=e,Ev(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)PF(n,e),n=n.sibling;return yr(Zr,Zr.current&1|2),xs&&du(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&Ea()>lk&&(t.flags|=128,r=!0,Ng(s,!1),t.lanes=4194304)}else{if(!r)if(e=nk(i),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,Ev(t,e),Ng(s,!0),s.tail===null&&s.tailMode==="hidden"&&!i.alternate&&!xs)return vr(t),null}else 2*Ea()-s.renderingStartTime>lk&&n!==536870912&&(t.flags|=128,r=!0,Ng(s,!1),t.lanes=4194304);s.isBackwards?(i.sibling=t.child,t.child=i):(e=s.last,e!==null?e.sibling=i:t.child=i,s.last=i)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Ea(),e.sibling=null,n=Zr.current,yr(Zr,r?n&1|2:n&1),xs&&du(t,s.treeForkCount),e):(vr(t),null);case 22:case 23:return xa(t),X7(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?n&536870912&&!(t.flags&128)&&(vr(t),t.subtreeFlags&6&&(t.flags|=8192)):vr(t),n=t.updateQueue,n!==null&&Ev(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==n&&(t.flags|=2048),e!==null&&qi(Pf),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Su(di),vr(t),null;case 25:return null;case 30:return null}throw Error(Ue(156,t.tag))}function jie(e,t){switch(V7(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Su(di),o0(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Gx(t),null;case 31:if(t.memoizedState!==null){if(xa(t),t.alternate===null)throw Error(Ue(340));Vf()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(xa(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Ue(340));Vf()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return qi(Zr),null;case 4:return o0(),null;case 10:return Su(t.type),null;case 22:case 23:return xa(t),X7(),e!==null&&qi(Pf),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Su(di),null;case 25:return null;default:return null}}function Pq(e,t){switch(V7(t),t.tag){case 3:Su(di),o0();break;case 26:case 27:case 5:Gx(t);break;case 4:o0();break;case 31:t.memoizedState!==null&&xa(t);break;case 13:xa(t);break;case 19:qi(Zr);break;case 10:Su(t.type);break;case 22:case 23:xa(t),X7(),e!==null&&qi(Pf);break;case 24:Su(di)}}function fb(e,t){try{var n=t.updateQueue,s=n!==null?n.lastEffect:null;if(s!==null){var r=s.next;n=r;do{if((n.tag&e)===e){s=void 0;var i=n.create,o=n.inst;s=i(),o.destroy=s}n=n.next}while(n!==r)}}catch(a){Ys(t,t.return,a)}}function fh(e,t,n){try{var s=t.updateQueue,r=s!==null?s.lastEffect:null;if(r!==null){var i=r.next;s=i;do{if((s.tag&e)===e){var o=s.inst,a=o.destroy;if(a!==void 0){o.destroy=void 0,r=t;var l=n,c=a;try{c()}catch(d){Ys(r,l,d)}}}s=s.next}while(s!==i)}}catch(d){Ys(t,t.return,d)}}function Bq(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{GF(t,n)}catch(s){Ys(e,e.return,s)}}}function $q(e,t,n){n.props=Yf(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(s){Ys(e,t,s)}}function j1(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof n=="function"?e.refCleanup=n(s):n.current=s}}catch(r){Ys(e,t,r)}}function xc(e,t){var n=e.ref,s=e.refCleanup;if(n!==null)if(typeof s=="function")try{s()}catch(r){Ys(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(r){Ys(e,t,r)}else n.current=null}function zq(e){var t=e.type,n=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&s.focus();break e;case"img":n.src?s.src=n.src:n.srcSet&&(s.srcset=n.srcSet)}}catch(r){Ys(e,e.return,r)}}function KS(e,t,n){try{var s=e.stateNode;toe(s,e.type,n,t),s[ia]=t}catch(r){Ys(e,e.return,r)}}function Fq(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&jh(e.type)||e.tag===4}function YS(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Fq(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&jh(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function x6(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=bu));else if(s!==4&&(s===27&&jh(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(x6(e,t,n),e=e.sibling;e!==null;)x6(e,t,n),e=e.sibling}function ak(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(s!==4&&(s===27&&jh(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(ak(e,t,n),e=e.sibling;e!==null;)ak(e,t,n),e=e.sibling}function qq(e){var t=e.stateNode,n=e.memoizedProps;try{for(var s=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);io(t,s,n),t[to]=e,t[ia]=n}catch(i){Ys(e,e.return,i)}}var fu=!1,ui=!1,XS=!1,iR=typeof WeakSet=="function"?WeakSet:Set,Bi=null;function Lie(e,t){if(e=e.containerInfo,A6=bk,e=MF(e),z7(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var r=s.anchorOffset,i=s.focusNode;s=s.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,c=0,d=0,h=e,f=null;t:for(;;){for(var p;h!==n||r!==0&&h.nodeType!==3||(a=o+r),h!==i||s!==0&&h.nodeType!==3||(l=o+s),h.nodeType===3&&(o+=h.nodeValue.length),(p=h.firstChild)!==null;)f=h,h=p;for(;;){if(h===e)break t;if(f===n&&++c===r&&(a=o),f===i&&++d===s&&(l=o),(p=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=p}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(M6={focusedElem:e,selectionRange:n},bk=!1,Bi=t;Bi!==null;)if(t=Bi,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Bi=e;else for(;Bi!==null;){switch(t=Bi,i=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n<e.length;n++)r=e[n],r.ref.impl=r.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&i!==null){e=void 0,n=t,r=i.memoizedProps,i=i.memoizedState,s=n.stateNode;try{var g=Yf(n.type,r);e=s.getSnapshotBeforeUpdate(g,i),s.__reactInternalSnapshotBeforeUpdate=e}catch(y){Ys(n,n.return,y)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)I6(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":I6(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(Ue(163))}if(e=t.sibling,e!==null){e.return=t.return,Bi=e;break}Bi=t.return}}function Hq(e,t,n){var s=n.flags;switch(n.tag){case 0:case 11:case 15:ru(e,n),s&4&&fb(5,n);break;case 1:if(ru(e,n),s&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(o){Ys(n,n.return,o)}else{var r=Yf(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(o){Ys(n,n.return,o)}}s&64&&Bq(n),s&512&&j1(n,n.return);break;case 3:if(ru(e,n),s&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{GF(e,t)}catch(o){Ys(n,n.return,o)}}break;case 27:t===null&&s&4&&qq(n);case 26:case 5:ru(e,n),t===null&&s&4&&zq(n),s&512&&j1(n,n.return);break;case 12:ru(e,n);break;case 31:ru(e,n),s&4&&Wq(e,n);break;case 13:ru(e,n),s&4&&Gq(e,n),s&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Hie.bind(null,n),coe(e,n))));break;case 22:if(s=n.memoizedState!==null||fu,!s){t=t!==null&&t.memoizedState!==null||ui,r=fu;var i=ui;fu=s,(ui=t)&&!i?cu(e,n,(n.subtreeFlags&8772)!==0):ru(e,n),fu=r,ui=i}break;case 30:break;default:ru(e,n)}}function Uq(e){var t=e.alternate;t!==null&&(e.alternate=null,Uq(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&L7(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Er=null,Yo=!1;function su(e,t,n){for(n=n.child;n!==null;)Vq(e,t,n),n=n.sibling}function Vq(e,t,n){if(Aa&&typeof Aa.onCommitFiberUnmount=="function")try{Aa.onCommitFiberUnmount(ob,n)}catch{}switch(n.tag){case 26:ui||xc(n,t),su(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:ui||xc(n,t);var s=Er,r=Yo;jh(n.type)&&(Er=n.stateNode,Yo=!1),su(e,t,n),P1(n.stateNode),Er=s,Yo=r;break;case 5:ui||xc(n,t);case 6:if(s=Er,r=Yo,Er=null,su(e,t,n),Er=s,Yo=r,Er!==null)if(Yo)try{(Er.nodeType===9?Er.body:Er.nodeName==="HTML"?Er.ownerDocument.body:Er).removeChild(n.stateNode)}catch(i){Ys(n,t,i)}else try{Er.removeChild(n.stateNode)}catch(i){Ys(n,t,i)}break;case 18:Er!==null&&(Yo?(e=Er,bR(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),g0(e)):bR(Er,n.stateNode));break;case 4:s=Er,r=Yo,Er=n.stateNode.containerInfo,Yo=!0,su(e,t,n),Er=s,Yo=r;break;case 0:case 11:case 14:case 15:fh(2,n,t),ui||fh(4,n,t),su(e,t,n);break;case 1:ui||(xc(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"&&$q(n,t,s)),su(e,t,n);break;case 21:su(e,t,n);break;case 22:ui=(s=ui)||n.memoizedState!==null,su(e,t,n),ui=s;break;default:su(e,t,n)}}function Wq(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{g0(e)}catch(n){Ys(t,t.return,n)}}}function Gq(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{g0(e)}catch(n){Ys(t,t.return,n)}}function Die(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new iR),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new iR),t;default:throw Error(Ue(435,e.tag))}}function Av(e,t){var n=Die(e);t.forEach(function(s){if(!n.has(s)){n.add(s);var r=Uie.bind(null,e,s);s.then(r,r)}})}function Uo(e,t){var n=t.deletions;if(n!==null)for(var s=0;s<n.length;s++){var r=n[s],i=e,o=t,a=o;e:for(;a!==null;){switch(a.tag){case 27:if(jh(a.type)){Er=a.stateNode,Yo=!1;break e}break;case 5:Er=a.stateNode,Yo=!1;break e;case 3:case 4:Er=a.stateNode.containerInfo,Yo=!0;break e}a=a.return}if(Er===null)throw Error(Ue(160));Vq(i,o,r),Er=null,Yo=!1,i=r.alternate,i!==null&&(i.return=null),r.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Kq(t,e),t=t.sibling}var Rl=null;function Kq(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Uo(t,e),Vo(e),s&4&&(fh(3,e,e.return),fb(3,e),fh(5,e,e.return));break;case 1:Uo(t,e),Vo(e),s&512&&(ui||n===null||xc(n,n.return)),s&64&&fu&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?s:n.concat(s))));break;case 26:var r=Rl;if(Uo(t,e),Vo(e),s&512&&(ui||n===null||xc(n,n.return)),s&4){var i=n!==null?n.memoizedState:null;if(s=e.memoizedState,n===null)if(s===null)if(e.stateNode===null){e:{s=e.type,n=e.memoizedProps,r=r.ownerDocument||r;t:switch(s){case"title":i=r.getElementsByTagName("title")[0],(!i||i[cb]||i[to]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=r.createElement(s),r.head.insertBefore(i,r.querySelector("head > title"))),io(i,s,n),i[to]=e,$i(i),s=i;break e;case"link":var o=CR("link","href",r).get(s+(n.href||""));if(o){for(var a=0;a<o.length;a++)if(i=o[a],i.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&i.getAttribute("rel")===(n.rel==null?null:n.rel)&&i.getAttribute("title")===(n.title==null?null:n.title)&&i.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(a,1);break t}}i=r.createElement(s),io(i,s,n),r.head.appendChild(i);break;case"meta":if(o=CR("meta","content",r).get(s+(n.content||""))){for(a=0;a<o.length;a++)if(i=o[a],i.getAttribute("content")===(n.content==null?null:""+n.content)&&i.getAttribute("name")===(n.name==null?null:n.name)&&i.getAttribute("property")===(n.property==null?null:n.property)&&i.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&i.getAttribute("charset")===(n.charSet==null?null:n.charSet)){o.splice(a,1);break t}}i=r.createElement(s),io(i,s,n),r.head.appendChild(i);break;default:throw Error(Ue(468,s))}i[to]=e,$i(i),s=i}e.stateNode=s}else TR(r,e.type,e.stateNode);else e.stateNode=SR(r,s,e.memoizedProps);else i!==s?(i===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):i.count--,s===null?TR(r,e.type,e.stateNode):SR(r,s,e.memoizedProps)):s===null&&e.stateNode!==null&&KS(e,e.memoizedProps,n.memoizedProps)}break;case 27:Uo(t,e),Vo(e),s&512&&(ui||n===null||xc(n,n.return)),n!==null&&s&4&&KS(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Uo(t,e),Vo(e),s&512&&(ui||n===null||xc(n,n.return)),e.flags&32){r=e.stateNode;try{l0(r,"")}catch(g){Ys(e,e.return,g)}}s&4&&e.stateNode!=null&&(r=e.memoizedProps,KS(e,r,n!==null?n.memoizedProps:r)),s&1024&&(XS=!0);break;case 6:if(Uo(t,e),Vo(e),s&4){if(e.stateNode===null)throw Error(Ue(162));s=e.memoizedProps,n=e.stateNode;try{n.nodeValue=s}catch(g){Ys(e,e.return,g)}}break;case 3:if(ux=null,r=Rl,Rl=pk(t.containerInfo),Uo(t,e),Rl=r,Vo(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{g0(t.containerInfo)}catch(g){Ys(e,e.return,g)}XS&&(XS=!1,Yq(e));break;case 4:s=Rl,Rl=pk(e.stateNode.containerInfo),Uo(t,e),Vo(e),Rl=s;break;case 12:Uo(t,e),Vo(e);break;case 31:Uo(t,e),Vo(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Av(e,s)));break;case 13:Uo(t,e),Vo(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(l_=Ea()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Av(e,s)));break;case 22:r=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,c=fu,d=ui;if(fu=c||r,ui=d||l,Uo(t,e),ui=d,fu=c,Vo(e),s&8192)e:for(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,r&&(n===null||l||fu||ui||yf(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(i=l.stateNode,r)o=i.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none";else{a=l.stateNode;var h=l.memoizedProps.style,f=h!=null&&h.hasOwnProperty("display")?h.display:null;a.style.display=f==null||typeof f=="boolean"?"":(""+f).trim()}}catch(g){Ys(l,l.return,g)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=r?"":l.memoizedProps}catch(g){Ys(l,l.return,g)}}}else if(t.tag===18){if(n===null){l=t;try{var p=l.stateNode;r?vR(p,!0):vR(l.stateNode,!1)}catch(g){Ys(l,l.return,g)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}s&4&&(s=e.updateQueue,s!==null&&(n=s.retryQueue,n!==null&&(s.retryQueue=null,Av(e,n))));break;case 19:Uo(t,e),Vo(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Av(e,s)));break;case 30:break;case 21:break;default:Uo(t,e),Vo(e)}}function Vo(e){var t=e.flags;if(t&2){try{for(var n,s=e.return;s!==null;){if(Fq(s)){n=s;break}s=s.return}if(n==null)throw Error(Ue(160));switch(n.tag){case 27:var r=n.stateNode,i=YS(e);ak(e,i,r);break;case 5:var o=n.stateNode;n.flags&32&&(l0(o,""),n.flags&=-33);var a=YS(e);ak(e,a,o);break;case 3:case 4:var l=n.stateNode.containerInfo,c=YS(e);x6(e,c,l);break;default:throw Error(Ue(161))}}catch(d){Ys(e,e.return,d)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Yq(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Yq(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ru(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Hq(e,t.alternate,t),t=t.sibling}function yf(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:fh(4,t,t.return),yf(t);break;case 1:xc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&$q(t,t.return,n),yf(t);break;case 27:P1(t.stateNode);case 26:case 5:xc(t,t.return),yf(t);break;case 22:t.memoizedState===null&&yf(t);break;case 30:yf(t);break;default:yf(t)}e=e.sibling}}function cu(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,r=e,i=t,o=i.flags;switch(i.tag){case 0:case 11:case 15:cu(r,i,n),fb(4,i);break;case 1:if(cu(r,i,n),s=i,r=s.stateNode,typeof r.componentDidMount=="function")try{r.componentDidMount()}catch(c){Ys(s,s.return,c)}if(s=i,r=s.updateQueue,r!==null){var a=s.stateNode;try{var l=r.shared.hiddenCallbacks;if(l!==null)for(r.shared.hiddenCallbacks=null,r=0;r<l.length;r++)WF(l[r],a)}catch(c){Ys(s,s.return,c)}}n&&o&64&&Bq(i),j1(i,i.return);break;case 27:qq(i);case 26:case 5:cu(r,i,n),n&&s===null&&o&4&&zq(i),j1(i,i.return);break;case 12:cu(r,i,n);break;case 31:cu(r,i,n),n&&o&4&&Wq(r,i);break;case 13:cu(r,i,n),n&&o&4&&Gq(r,i);break;case 22:i.memoizedState===null&&cu(r,i,n),j1(i,i.return);break;case 30:break;default:cu(r,i,n)}t=t.sibling}}function hE(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&db(n))}function fE(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&db(e))}function El(e,t,n,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Xq(e,t,n,s),t=t.sibling}function Xq(e,t,n,s){var r=t.flags;switch(t.tag){case 0:case 11:case 15:El(e,t,n,s),r&2048&&fb(9,t);break;case 1:El(e,t,n,s);break;case 3:El(e,t,n,s),r&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&db(e)));break;case 12:if(r&2048){El(e,t,n,s),e=t.stateNode;try{var i=t.memoizedProps,o=i.id,a=i.onPostCommit;typeof a=="function"&&a(o,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(l){Ys(t,t.return,l)}}else El(e,t,n,s);break;case 31:El(e,t,n,s);break;case 13:El(e,t,n,s);break;case 23:break;case 22:i=t.stateNode,o=t.alternate,t.memoizedState!==null?i._visibility&2?El(e,t,n,s):L1(e,t):i._visibility&2?El(e,t,n,s):(i._visibility|=2,up(e,t,n,s,(t.subtreeFlags&10256)!==0||!1)),r&2048&&hE(o,t);break;case 24:El(e,t,n,s),r&2048&&fE(t.alternate,t);break;default:El(e,t,n,s)}}function up(e,t,n,s,r){for(r=r&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var i=e,o=t,a=n,l=s,c=o.flags;switch(o.tag){case 0:case 11:case 15:up(i,o,a,l,r),fb(8,o);break;case 23:break;case 22:var d=o.stateNode;o.memoizedState!==null?d._visibility&2?up(i,o,a,l,r):L1(i,o):(d._visibility|=2,up(i,o,a,l,r)),r&&c&2048&&hE(o.alternate,o);break;case 24:up(i,o,a,l,r),r&&c&2048&&fE(o.alternate,o);break;default:up(i,o,a,l,r)}t=t.sibling}}function L1(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,s=t,r=s.flags;switch(s.tag){case 22:L1(n,s),r&2048&&hE(s.alternate,s);break;case 24:L1(n,s),r&2048&&fE(s.alternate,s);break;default:L1(n,s)}t=t.sibling}}var i1=8192;function Um(e,t,n){if(e.subtreeFlags&i1)for(e=e.child;e!==null;)Qq(e,t,n),e=e.sibling}function Qq(e,t,n){switch(e.tag){case 26:Um(e,t,n),e.flags&i1&&e.memoizedState!==null&&xoe(n,Rl,e.memoizedState,e.memoizedProps);break;case 5:Um(e,t,n);break;case 3:case 4:var s=Rl;Rl=pk(e.stateNode.containerInfo),Um(e,t,n),Rl=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=i1,i1=16777216,Um(e,t,n),i1=s):Um(e,t,n));break;default:Um(e,t,n)}}function Jq(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Ig(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var s=t[n];Bi=s,eH(s,e)}Jq(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Zq(e),e=e.sibling}function Zq(e){switch(e.tag){case 0:case 11:case 15:Ig(e),e.flags&2048&&fh(9,e,e.return);break;case 3:Ig(e);break;case 12:Ig(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,lx(e)):Ig(e);break;default:Ig(e)}}function lx(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var s=t[n];Bi=s,eH(s,e)}Jq(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:fh(8,t,t.return),lx(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,lx(t));break;default:lx(t)}e=e.sibling}}function eH(e,t){for(;Bi!==null;){var n=Bi;switch(n.tag){case 0:case 11:case 15:fh(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var s=n.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:db(n.memoizedState.cache)}if(s=n.child,s!==null)s.return=n,Bi=s;else e:for(n=e;Bi!==null;){s=Bi;var r=s.sibling,i=s.return;if(Uq(s),s===n){Bi=null;break e}if(r!==null){r.return=i,Bi=r;break e}Bi=i}}}var Oie={getCacheForType:function(e){var t=so(di),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return so(di).controller.signal}},Pie=typeof WeakMap=="function"?WeakMap:Map,zs=0,ur=null,fs=null,ys=0,Ks=0,va=null,qd=!1,z0=!1,mE=!1,Bu=0,Vr=0,mh=0,$f=0,pE=0,Sa=0,h0=0,D1=null,Xo=null,k6=!1,l_=0,tH=0,lk=1/0,ck=null,nh=null,Si=0,sh=null,f0=null,Cu=0,_6=0,S6=null,nH=null,O1=0,C6=null;function Na(){return zs&2&&ys!==0?ys&-ys:En.T!==null?yE():dF()}function sH(){if(Sa===0)if(!(ys&536870912)||xs){var e=wv;wv<<=1,!(wv&3932160)&&(wv=262144),Sa=e}else Sa=536870912;return e=Da.current,e!==null&&(e.flags|=32),Sa}function sa(e,t,n){(e===ur&&(Ks===2||Ks===9)||e.cancelPendingCommit!==null)&&(m0(e,0),Hd(e,ys,Sa,!1)),lb(e,n),(!(zs&2)||e!==ur)&&(e===ur&&(!(zs&2)&&($f|=n),Vr===4&&Hd(e,ys,Sa,!1)),Bc(e))}function rH(e,t,n){if(zs&6)throw Error(Ue(327));var s=!n&&(t&127)===0&&(t&e.expiredLanes)===0||ab(e,t),r=s?zie(e,t):QS(e,t,!0),i=s;do{if(r===0){z0&&!s&&Hd(e,t,0,!1);break}else{if(n=e.current.alternate,i&&!Bie(n)){r=QS(e,t,!1),i=!1;continue}if(r===2){if(i=t,e.errorRecoveryDisabledLanes&i)var o=0;else o=e.pendingLanes&-536870913,o=o!==0?o:o&536870912?536870912:0;if(o!==0){t=o;e:{var a=e;r=D1;var l=a.current.memoizedState.isDehydrated;if(l&&(m0(a,o).flags|=256),o=QS(a,o,!1),o!==2){if(mE&&!l){a.errorRecoveryDisabledLanes|=i,$f|=i,r=4;break e}i=Xo,Xo=r,i!==null&&(Xo===null?Xo=i:Xo.push.apply(Xo,i))}r=o}if(i=!1,r!==2)continue}}if(r===1){m0(e,0),Hd(e,t,0,!0);break}e:{switch(s=e,i=r,i){case 0:case 1:throw Error(Ue(345));case 4:if((t&4194048)!==t)break;case 6:Hd(s,t,Sa,!qd);break e;case 2:Xo=null;break;case 3:case 5:break;default:throw Error(Ue(329))}if((t&62914560)===t&&(r=l_+300-Ea(),10<r)){if(Hd(s,t,Sa,!qd),Q2(s,0,!0)!==0)break e;Cu=t,s.timeoutHandle=SH(oR.bind(null,s,n,Xo,ck,k6,t,Sa,$f,h0,qd,i,"Throttled",-0,0),r);break e}oR(s,n,Xo,ck,k6,t,Sa,$f,h0,qd,i,null,-0,0)}}break}while(!0);Bc(e)}function oR(e,t,n,s,r,i,o,a,l,c,d,h,f,p){if(e.timeoutHandle=-1,h=t.subtreeFlags,h&8192||(h&16785408)===16785408){h={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:bu},Qq(t,i,h);var g=(i&62914560)===i?l_-Ea():(i&4194048)===i?tH-Ea():0;if(g=koe(h,g),g!==null){Cu=i,e.cancelPendingCommit=g(lR.bind(null,e,t,i,n,s,r,o,a,l,d,h,null,f,p)),Hd(e,i,o,!c);return}}lR(e,t,i,n,s,r,o,a,l)}function Bie(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var s=0;s<n.length;s++){var r=n[s],i=r.getSnapshot;r=r.value;try{if(!La(i(),r))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Hd(e,t,n,s){t&=~pE,t&=~$f,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var r=t;0<r;){var i=31-Ma(r),o=1<<i;s[i]=-1,r&=~o}n!==0&&lF(e,n,t)}function c_(){return zs&6?!0:(mb(0),!1)}function gE(){if(fs!==null){if(Ks===0)var e=fs.return;else e=fs,vu=gm=null,tE(e),Hp=null,dy=0,e=fs;for(;e!==null;)Pq(e.alternate,e),e=e.return;fs=null}}function m0(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,roe(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Cu=0,gE(),ur=e,fs=n=_u(e.current,null),ys=t,Ks=0,va=null,qd=!1,z0=ab(e,t),mE=!1,h0=Sa=pE=$f=mh=Vr=0,Xo=D1=null,k6=!1,t&8&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var r=31-Ma(s),i=1<<r;t|=e[r],s&=~i}return Bu=t,t_(),n}function iH(e,t){Yn=null,En.H=fy,t===$0||t===s_?(t=BI(),Ks=3):t===K7?(t=BI(),Ks=4):Ks=t===uE?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,va=t,fs===null&&(Vr=1,ik(e,ul(t,e.current)))}function oH(){var e=Da.current;return e===null?!0:(ys&4194048)===ys?gl===null:(ys&62914560)===ys||ys&536870912?e===gl:!1}function aH(){var e=En.H;return En.H=fy,e===null?fy:e}function lH(){var e=En.A;return En.A=Oie,e}function uk(){Vr=4,qd||(ys&4194048)!==ys&&Da.current!==null||(z0=!0),!(mh&134217727)&&!($f&134217727)||ur===null||Hd(ur,ys,Sa,!1)}function QS(e,t,n){var s=zs;zs|=2;var r=aH(),i=lH();(ur!==e||ys!==t)&&(ck=null,m0(e,t)),t=!1;var o=Vr;e:do try{if(Ks!==0&&fs!==null){var a=fs,l=va;switch(Ks){case 8:gE(),o=6;break e;case 3:case 2:case 9:case 6:Da.current===null&&(t=!0);var c=Ks;if(Ks=0,va=null,Mp(e,a,l,c),n&&z0){o=0;break e}break;default:c=Ks,Ks=0,va=null,Mp(e,a,l,c)}}$ie(),o=Vr;break}catch(d){iH(e,d)}while(!0);return t&&e.shellSuspendCounter++,vu=gm=null,zs=s,En.H=r,En.A=i,fs===null&&(ur=null,ys=0,t_()),o}function $ie(){for(;fs!==null;)cH(fs)}function zie(e,t){var n=zs;zs|=2;var s=aH(),r=lH();ur!==e||ys!==t?(ck=null,lk=Ea()+500,m0(e,t)):z0=ab(e,t);e:do try{if(Ks!==0&&fs!==null){t=fs;var i=va;t:switch(Ks){case 1:Ks=0,va=null,Mp(e,t,i,1);break;case 2:case 9:if(PI(i)){Ks=0,va=null,aR(t);break}t=function(){Ks!==2&&Ks!==9||ur!==e||(Ks=7),Bc(e)},i.then(t,t);break e;case 3:Ks=7;break e;case 4:Ks=5;break e;case 7:PI(i)?(Ks=0,va=null,aR(t)):(Ks=0,va=null,Mp(e,t,i,7));break;case 5:var o=null;switch(fs.tag){case 26:o=fs.memoizedState;case 5:case 27:var a=fs;if(o?MH(o):a.stateNode.complete){Ks=0,va=null;var l=a.sibling;if(l!==null)fs=l;else{var c=a.return;c!==null?(fs=c,u_(c)):fs=null}break t}}Ks=0,va=null,Mp(e,t,i,5);break;case 6:Ks=0,va=null,Mp(e,t,i,6);break;case 8:gE(),Vr=6;break e;default:throw Error(Ue(462))}}Fie();break}catch(d){iH(e,d)}while(!0);return vu=gm=null,En.H=s,En.A=r,zs=n,fs!==null?0:(ur=null,ys=0,t_(),Vr)}function Fie(){for(;fs!==null&&!ure();)cH(fs)}function cH(e){var t=Oq(e.alternate,e,Bu);e.memoizedProps=e.pendingProps,t===null?u_(e):fs=t}function aR(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=eR(n,t,t.pendingProps,t.type,void 0,ys);break;case 11:t=eR(n,t,t.pendingProps,t.type.render,t.ref,ys);break;case 5:tE(t);default:Pq(n,t),t=fs=PF(t,Bu),t=Oq(n,t,Bu)}e.memoizedProps=e.pendingProps,t===null?u_(e):fs=t}function Mp(e,t,n,s){vu=gm=null,tE(t),Hp=null,dy=0;var r=t.return;try{if(Mie(e,r,t,n,ys)){Vr=1,ik(e,ul(n,e.current)),fs=null;return}}catch(i){if(r!==null)throw fs=r,i;Vr=1,ik(e,ul(n,e.current)),fs=null;return}t.flags&32768?(xs||s===1?e=!0:z0||ys&536870912?e=!1:(qd=e=!0,(s===2||s===9||s===3||s===6)&&(s=Da.current,s!==null&&s.tag===13&&(s.flags|=16384))),uH(t,e)):u_(t)}function u_(e){var t=e;do{if(t.flags&32768){uH(t,qd);return}e=t.return;var n=Rie(t.alternate,t,Bu);if(n!==null){fs=n;return}if(t=t.sibling,t!==null){fs=t;return}fs=t=e}while(t!==null);Vr===0&&(Vr=5)}function uH(e,t){do{var n=jie(e.alternate,e);if(n!==null){n.flags&=32767,fs=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){fs=e;return}fs=e=n}while(e!==null);Vr=6,fs=null}function lR(e,t,n,s,r,i,o,a,l){e.cancelPendingCommit=null;do d_();while(Si!==0);if(zs&6)throw Error(Ue(327));if(t!==null){if(t===e.current)throw Error(Ue(177));if(i=t.lanes|t.childLanes,i|=F7,wre(e,n,i,o,a,l),e===ur&&(fs=ur=null,ys=0),f0=t,sh=e,Cu=n,_6=i,S6=r,nH=s,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Vie(Kx,function(){return pH(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,t.subtreeFlags&13878||s){s=En.T,En.T=null,r=qs.p,qs.p=2,o=zs,zs|=4;try{Lie(e,t,n)}finally{zs=o,qs.p=r,En.T=s}}Si=1,dH(),hH(),fH()}}function dH(){if(Si===1){Si=0;var e=sh,t=f0,n=(t.flags&13878)!==0;if(t.subtreeFlags&13878||n){n=En.T,En.T=null;var s=qs.p;qs.p=2;var r=zs;zs|=4;try{Kq(t,e);var i=M6,o=MF(e.containerInfo),a=i.focusedElem,l=i.selectionRange;if(o!==a&&a&&a.ownerDocument&&AF(a.ownerDocument.documentElement,a)){if(l!==null&&z7(a)){var c=l.start,d=l.end;if(d===void 0&&(d=c),"selectionStart"in a)a.selectionStart=c,a.selectionEnd=Math.min(d,a.value.length);else{var h=a.ownerDocument||document,f=h&&h.defaultView||window;if(f.getSelection){var p=f.getSelection(),g=a.textContent.length,y=Math.min(l.start,g),w=l.end===void 0?y:Math.min(l.end,g);!p.extend&&y>w&&(o=w,w=y,y=o);var v=NI(a,y),b=NI(a,w);if(v&&b&&(p.rangeCount!==1||p.anchorNode!==v.node||p.anchorOffset!==v.offset||p.focusNode!==b.node||p.focusOffset!==b.offset)){var x=h.createRange();x.setStart(v.node,v.offset),p.removeAllRanges(),y>w?(p.addRange(x),p.extend(b.node,b.offset)):(x.setEnd(b.node,b.offset),p.addRange(x))}}}}for(h=[],p=a;p=p.parentNode;)p.nodeType===1&&h.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a<h.length;a++){var k=h[a];k.element.scrollLeft=k.left,k.element.scrollTop=k.top}}bk=!!A6,M6=A6=null}finally{zs=r,qs.p=s,En.T=n}}e.current=t,Si=2}}function hH(){if(Si===2){Si=0;var e=sh,t=f0,n=(t.flags&8772)!==0;if(t.subtreeFlags&8772||n){n=En.T,En.T=null;var s=qs.p;qs.p=2;var r=zs;zs|=4;try{Hq(e,t.alternate,t)}finally{zs=r,qs.p=s,En.T=n}}Si=3}}function fH(){if(Si===4||Si===3){Si=0,dre();var e=sh,t=f0,n=Cu,s=nH;t.subtreeFlags&10256||t.flags&10256?Si=5:(Si=0,f0=sh=null,mH(e,e.pendingLanes));var r=e.pendingLanes;if(r===0&&(nh=null),j7(n),t=t.stateNode,Aa&&typeof Aa.onCommitFiberRoot=="function")try{Aa.onCommitFiberRoot(ob,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=En.T,r=qs.p,qs.p=2,En.T=null;try{for(var i=e.onRecoverableError,o=0;o<s.length;o++){var a=s[o];i(a.value,{componentStack:a.stack})}}finally{En.T=t,qs.p=r}}Cu&3&&d_(),Bc(e),r=e.pendingLanes,n&261930&&r&42?e===C6?O1++:(O1=0,C6=e):O1=0,mb(0)}}function mH(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,db(t)))}function d_(){return dH(),hH(),fH(),pH()}function pH(){if(Si!==5)return!1;var e=sh,t=_6;_6=0;var n=j7(Cu),s=En.T,r=qs.p;try{qs.p=32>n?32:n,En.T=null,n=S6,S6=null;var i=sh,o=Cu;if(Si=0,f0=sh=null,Cu=0,zs&6)throw Error(Ue(331));var a=zs;if(zs|=4,Zq(i.current),Xq(i,i.current,o,n),zs=a,mb(0,!1),Aa&&typeof Aa.onPostCommitFiberRoot=="function")try{Aa.onPostCommitFiberRoot(ob,i)}catch{}return!0}finally{qs.p=r,En.T=s,mH(e,t)}}function cR(e,t,n){t=ul(n,t),t=b6(e.stateNode,t,2),e=th(e,t,2),e!==null&&(lb(e,2),Bc(e))}function Ys(e,t,n){if(e.tag===3)cR(e,e,n);else for(;t!==null;){if(t.tag===3){cR(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(nh===null||!nh.has(s))){e=ul(n,e),n=Nq(2),s=th(t,n,2),s!==null&&(Iq(n,s,t,e),lb(s,2),Bc(s));break}}t=t.return}}function JS(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new Pie;var r=new Set;s.set(t,r)}else r=s.get(t),r===void 0&&(r=new Set,s.set(t,r));r.has(n)||(mE=!0,r.add(n),e=qie.bind(null,e,t,n),t.then(e,e))}function qie(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ur===e&&(ys&n)===n&&(Vr===4||Vr===3&&(ys&62914560)===ys&&300>Ea()-l_?!(zs&2)&&m0(e,0):pE|=n,h0===ys&&(h0=0)),Bc(e)}function gH(e,t){t===0&&(t=aF()),e=pm(e,t),e!==null&&(lb(e,t),Bc(e))}function Hie(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),gH(e,n)}function Uie(e,t){var n=0;switch(e.tag){case 31:case 13:var s=e.stateNode,r=e.memoizedState;r!==null&&(n=r.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(Ue(314))}s!==null&&s.delete(t),gH(e,n)}function Vie(e,t){return I7(e,t)}var dk=null,dp=null,T6=!1,hk=!1,ZS=!1,Ud=0;function Bc(e){e!==dp&&e.next===null&&(dp===null?dk=dp=e:dp=dp.next=e),hk=!0,T6||(T6=!0,Gie())}function mb(e,t){if(!ZS&&hk){ZS=!0;do for(var n=!1,s=dk;s!==null;){if(e!==0){var r=s.pendingLanes;if(r===0)var i=0;else{var o=s.suspendedLanes,a=s.pingedLanes;i=(1<<31-Ma(42|e)+1)-1,i&=r&~(o&~a),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(n=!0,uR(s,i))}else i=ys,i=Q2(s,s===ur?i:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),!(i&3)||ab(s,i)||(n=!0,uR(s,i));s=s.next}while(n);ZS=!1}}function Wie(){yH()}function yH(){hk=T6=!1;var e=0;Ud!==0&&soe()&&(e=Ud);for(var t=Ea(),n=null,s=dk;s!==null;){var r=s.next,i=bH(s,t);i===0?(s.next=null,n===null?dk=r:n.next=r,r===null&&(dp=n)):(n=s,(e!==0||i&3)&&(hk=!0)),s=r}Si!==0&&Si!==5||mb(e),Ud!==0&&(Ud=0)}function bH(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,r=e.expirationTimes,i=e.pendingLanes&-62914561;0<i;){var o=31-Ma(i),a=1<<o,l=r[o];l===-1?(!(a&n)||a&s)&&(r[o]=vre(a,t)):l<=t&&(e.expiredLanes|=a),i&=~a}if(t=ur,n=ys,n=Q2(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,n===0||e===t&&(Ks===2||Ks===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&ES(s),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||ab(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(s!==null&&ES(s),j7(n)){case 2:case 8:n=iF;break;case 32:n=Kx;break;case 268435456:n=oF;break;default:n=Kx}return s=vH.bind(null,e),n=I7(n,s),e.callbackPriority=t,e.callbackNode=n,t}return s!==null&&s!==null&&ES(s),e.callbackPriority=2,e.callbackNode=null,2}function vH(e,t){if(Si!==0&&Si!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(d_()&&e.callbackNode!==n)return null;var s=ys;return s=Q2(e,e===ur?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(rH(e,s,t),bH(e,Ea()),e.callbackNode!=null&&e.callbackNode===n?vH.bind(null,e):null)}function uR(e,t){if(d_())return null;rH(e,t,!0)}function Gie(){ioe(function(){zs&6?I7(rF,Wie):yH()})}function yE(){if(Ud===0){var e=c0;e===0&&(e=vv,vv<<=1,!(vv&261888)&&(vv=256)),Ud=e}return Ud}function dR(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Zw(""+e)}function hR(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function Kie(e,t,n,s,r){if(t==="submit"&&n&&n.stateNode===r){var i=dR((r[ia]||null).action),o=s.submitter;o&&(t=(t=o[ia]||null)?dR(t.formAction):o.getAttribute("formAction"),t!==null&&(i=t,o=null));var a=new J2("action","action",null,s,r);e.push({event:a,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Ud!==0){var l=o?hR(r,o):new FormData(r);g6(n,{pending:!0,data:l,method:r.method,action:i},null,l)}}else typeof i=="function"&&(a.preventDefault(),l=o?hR(r,o):new FormData(r),g6(n,{pending:!0,data:l,method:r.method,action:i},i,l))},currentTarget:r}]})}}for(var e3=0;e3<r6.length;e3++){var t3=r6[e3],Yie=t3.toLowerCase(),Xie=t3[0].toUpperCase()+t3.slice(1);Bl(Yie,"on"+Xie)}Bl(IF,"onAnimationEnd");Bl(RF,"onAnimationIteration");Bl(jF,"onAnimationStart");Bl("dblclick","onDoubleClick");Bl("focusin","onFocus");Bl("focusout","onBlur");Bl(hie,"onTransitionRun");Bl(fie,"onTransitionStart");Bl(mie,"onTransitionCancel");Bl(LF,"onTransitionEnd");a0("onMouseEnter",["mouseout","mouseover"]);a0("onMouseLeave",["mouseout","mouseover"]);a0("onPointerEnter",["pointerout","pointerover"]);a0("onPointerLeave",["pointerout","pointerover"]);hm("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));hm("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));hm("onBeforeInput",["compositionend","keypress","textInput","paste"]);hm("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));hm("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));hm("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var my="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(" "),Qie=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(my));function wH(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var s=e[n],r=s.event;s=s.listeners;e:{var i=void 0;if(t)for(var o=s.length-1;0<=o;o--){var a=s[o],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==i&&r.isPropagationStopped())break e;i=a,r.currentTarget=c;try{i(r)}catch(d){Xx(d)}r.currentTarget=null,i=l}else for(o=0;o<s.length;o++){if(a=s[o],l=a.instance,c=a.currentTarget,a=a.listener,l!==i&&r.isPropagationStopped())break e;i=a,r.currentTarget=c;try{i(r)}catch(d){Xx(d)}r.currentTarget=null,i=l}}}}function hs(e,t){var n=t[XC];n===void 0&&(n=t[XC]=new Set);var s=e+"__bubble";n.has(s)||(xH(t,e,2,!1),n.add(s))}function n3(e,t,n){var s=0;t&&(s|=4),xH(n,e,s,t)}var Mv="_reactListening"+Math.random().toString(36).slice(2);function bE(e){if(!e[Mv]){e[Mv]=!0,hF.forEach(function(n){n!=="selectionchange"&&(Qie.has(n)||n3(n,!1,e),n3(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Mv]||(t[Mv]=!0,n3("selectionchange",!1,t))}}function xH(e,t,n,s){switch(LH(t)){case 2:var r=Coe;break;case 8:r=Toe;break;default:r=kE}n=r.bind(null,t,n,e),r=void 0,!t6||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(r=!0),s?r!==void 0?e.addEventListener(t,n,{capture:!0,passive:r}):e.addEventListener(t,n,!0):r!==void 0?e.addEventListener(t,n,{passive:r}):e.addEventListener(t,n,!1)}function s3(e,t,n,s,r){var i=s;if(!(t&1)&&!(t&2)&&s!==null)e:for(;;){if(s===null)return;var o=s.tag;if(o===3||o===4){var a=s.stateNode.containerInfo;if(a===r)break;if(o===4)for(o=s.return;o!==null;){var l=o.tag;if((l===3||l===4)&&o.stateNode.containerInfo===r)return;o=o.return}for(;a!==null;){if(o=wp(a),o===null)return;if(l=o.tag,l===5||l===6||l===26||l===27){s=i=o;continue e}a=a.parentNode}}s=s.return}wF(function(){var c=i,d=O7(n),h=[];e:{var f=DF.get(e);if(f!==void 0){var p=J2,g=e;switch(e){case"keypress":if(tx(n)===0)break e;case"keydown":case"keyup":p=Ure;break;case"focusin":g="focus",p=RS;break;case"focusout":g="blur",p=RS;break;case"beforeblur":case"afterblur":p=RS;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":p=wI;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=Rre;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=Gre;break;case IF:case RF:case jF:p=Dre;break;case LF:p=Yre;break;case"scroll":case"scrollend":p=Nre;break;case"wheel":p=Qre;break;case"copy":case"cut":case"paste":p=Pre;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=kI;break;case"toggle":case"beforetoggle":p=Zre}var y=(t&4)!==0,w=!y&&(e==="scroll"||e==="scrollend"),v=y?f!==null?f+"Capture":null:f;y=[];for(var b=c,x;b!==null;){var k=b;if(x=k.stateNode,k=k.tag,k!==5&&k!==26&&k!==27||x===null||v===null||(k=oy(b,v),k!=null&&y.push(py(b,k,x))),w)break;b=b.return}0<y.length&&(f=new p(f,g,null,n,d),h.push({event:f,listeners:y}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",f&&n!==e6&&(g=n.relatedTarget||n.fromElement)&&(wp(g)||g[O0]))break e;if((p||f)&&(f=d.window===d?d:(f=d.ownerDocument)?f.defaultView||f.parentWindow:window,p?(g=n.relatedTarget||n.toElement,p=c,g=g?wp(g):null,g!==null&&(w=ib(g),y=g.tag,g!==w||y!==5&&y!==27&&y!==6)&&(g=null)):(p=null,g=c),p!==g)){if(y=wI,k="onMouseLeave",v="onMouseEnter",b="mouse",(e==="pointerout"||e==="pointerover")&&(y=kI,k="onPointerLeave",v="onPointerEnter",b="pointer"),w=p==null?f:s1(p),x=g==null?f:s1(g),f=new y(k,b+"leave",p,n,d),f.target=w,f.relatedTarget=x,k=null,wp(d)===c&&(y=new y(v,b+"enter",g,n,d),y.target=x,y.relatedTarget=w,k=y),w=k,p&&g)t:{for(y=Jie,v=p,b=g,x=0,k=v;k;k=y(k))x++;k=0;for(var T=b;T;T=y(T))k++;for(;0<x-k;)v=y(v),x--;for(;0<k-x;)b=y(b),k--;for(;x--;){if(v===b||b!==null&&v===b.alternate){y=v;break t}v=y(v),b=y(b)}y=null}else y=null;p!==null&&fR(h,f,p,y,!1),g!==null&&w!==null&&fR(h,w,g,y,!0)}}e:{if(f=c?s1(c):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var C=TI;else if(CI(f))if(TF)C=cie;else{C=aie;var S=oie}else p=f.nodeName,!p||p.toLowerCase()!=="input"||f.type!=="checkbox"&&f.type!=="radio"?c&&D7(c.elementType)&&(C=TI):C=lie;if(C&&(C=C(e,c))){CF(h,C,n,d);break e}S&&S(e,f,c),e==="focusout"&&c&&f.type==="number"&&c.memoizedProps.value!=null&&ZC(f,"number",f.value)}switch(S=c?s1(c):window,e){case"focusin":(CI(S)||S.contentEditable==="true")&&(_p=S,n6=c,E1=null);break;case"focusout":E1=n6=_p=null;break;case"mousedown":s6=!0;break;case"contextmenu":case"mouseup":case"dragend":s6=!1,II(h,n,d);break;case"selectionchange":if(die)break;case"keydown":case"keyup":II(h,n,d)}var _;if($7)e:{switch(e){case"compositionstart":var L="onCompositionStart";break e;case"compositionend":L="onCompositionEnd";break e;case"compositionupdate":L="onCompositionUpdate";break e}L=void 0}else kp?_F(e,n)&&(L="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(L="onCompositionStart");L&&(kF&&n.locale!=="ko"&&(kp||L!=="onCompositionStart"?L==="onCompositionEnd"&&kp&&(_=xF()):(Fd=d,P7="value"in Fd?Fd.value:Fd.textContent,kp=!0)),S=fk(c,L),0<S.length&&(L=new xI(L,e,null,n,d),h.push({event:L,listeners:S}),_?L.data=_:(_=SF(n),_!==null&&(L.data=_)))),(_=tie?nie(e,n):sie(e,n))&&(L=fk(c,"onBeforeInput"),0<L.length&&(S=new xI("onBeforeInput","beforeinput",null,n,d),h.push({event:S,listeners:L}),S.data=_)),Kie(h,e,c,n,d)}wH(h,t)})}function py(e,t,n){return{instance:e,listener:t,currentTarget:n}}function fk(e,t){for(var n=t+"Capture",s=[];e!==null;){var r=e,i=r.stateNode;if(r=r.tag,r!==5&&r!==26&&r!==27||i===null||(r=oy(e,n),r!=null&&s.unshift(py(e,r,i)),r=oy(e,t),r!=null&&s.push(py(e,r,i))),e.tag===3)return s;e=e.return}return[]}function Jie(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function fR(e,t,n,s,r){for(var i=t._reactName,o=[];n!==null&&n!==s;){var a=n,l=a.alternate,c=a.stateNode;if(a=a.tag,l!==null&&l===s)break;a!==5&&a!==26&&a!==27||c===null||(l=c,r?(c=oy(n,i),c!=null&&o.unshift(py(n,c,l))):r||(c=oy(n,i),c!=null&&o.push(py(n,c,l)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Zie=/\r\n?/g,eoe=/\u0000|\uFFFD/g;function mR(e){return(typeof e=="string"?e:""+e).replace(Zie,`
`).replace(eoe,"")}function kH(e,t){return t=mR(t),mR(e)===t}function er(e,t,n,s,r,i){switch(n){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||l0(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&l0(e,""+s);break;case"className":kv(e,"class",s);break;case"tabIndex":kv(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":kv(e,n,s);break;case"style":vF(e,s,i);break;case"data":if(t!=="object"){kv(e,"data",s);break}case"src":case"href":if(s===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(n);break}s=Zw(""+s),e.setAttribute(n,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof i=="function"&&(n==="formAction"?(t!=="input"&&er(e,t,"name",r.name,r,null),er(e,t,"formEncType",r.formEncType,r,null),er(e,t,"formMethod",r.formMethod,r,null),er(e,t,"formTarget",r.formTarget,r,null)):(er(e,t,"encType",r.encType,r,null),er(e,t,"method",r.method,r,null),er(e,t,"target",r.target,r,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(n);break}s=Zw(""+s),e.setAttribute(n,s);break;case"onClick":s!=null&&(e.onclick=bu);break;case"onScroll":s!=null&&hs("scroll",e);break;case"onScrollEnd":s!=null&&hs("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(Ue(61));if(n=s.__html,n!=null){if(r.children!=null)throw Error(Ue(60));e.innerHTML=n}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}n=Zw(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(n,""+s):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":s===!0?e.setAttribute(n,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(n,s):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(n,s):e.removeAttribute(n);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(n):e.setAttribute(n,s);break;case"popover":hs("beforetoggle",e),hs("toggle",e),Jw(e,"popover",s);break;case"xlinkActuate":tu(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":tu(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":tu(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":tu(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":tu(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":tu(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":tu(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":tu(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":tu(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":Jw(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=Are.get(n)||n,Jw(e,n,s))}}function E6(e,t,n,s,r,i){switch(n){case"style":vF(e,s,i);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(Ue(61));if(n=s.__html,n!=null){if(r.children!=null)throw Error(Ue(60));e.innerHTML=n}}break;case"children":typeof s=="string"?l0(e,s):(typeof s=="number"||typeof s=="bigint")&&l0(e,""+s);break;case"onScroll":s!=null&&hs("scroll",e);break;case"onScrollEnd":s!=null&&hs("scrollend",e);break;case"onClick":s!=null&&(e.onclick=bu);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!fF.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(r=n.endsWith("Capture"),t=n.slice(2,r?n.length-7:void 0),i=e[ia]||null,i=i!=null?i[n]:null,typeof i=="function"&&e.removeEventListener(t,i,r),typeof s=="function")){typeof i!="function"&&i!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,s,r);break e}n in e?e[n]=s:s===!0?e.setAttribute(n,""):Jw(e,n,s)}}}function io(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":hs("error",e),hs("load",e);var s=!1,r=!1,i;for(i in n)if(n.hasOwnProperty(i)){var o=n[i];if(o!=null)switch(i){case"src":s=!0;break;case"srcSet":r=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(Ue(137,t));default:er(e,t,i,o,n,null)}}r&&er(e,t,"srcSet",n.srcSet,n,null),s&&er(e,t,"src",n.src,n,null);return;case"input":hs("invalid",e);var a=i=o=r=null,l=null,c=null;for(s in n)if(n.hasOwnProperty(s)){var d=n[s];if(d!=null)switch(s){case"name":r=d;break;case"type":o=d;break;case"checked":l=d;break;case"defaultChecked":c=d;break;case"value":i=d;break;case"defaultValue":a=d;break;case"children":case"dangerouslySetInnerHTML":if(d!=null)throw Error(Ue(137,t));break;default:er(e,t,s,d,n,null)}}gF(e,i,a,l,c,o,r,!1);return;case"select":hs("invalid",e),s=o=i=null;for(r in n)if(n.hasOwnProperty(r)&&(a=n[r],a!=null))switch(r){case"value":i=a;break;case"defaultValue":o=a;break;case"multiple":s=a;default:er(e,t,r,a,n,null)}t=i,n=o,e.multiple=!!s,t!=null?zp(e,!!s,t,!1):n!=null&&zp(e,!!s,n,!0);return;case"textarea":hs("invalid",e),i=r=s=null;for(o in n)if(n.hasOwnProperty(o)&&(a=n[o],a!=null))switch(o){case"value":s=a;break;case"defaultValue":r=a;break;case"children":i=a;break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(Ue(91));break;default:er(e,t,o,a,n,null)}bF(e,s,r,i);return;case"option":for(l in n)if(n.hasOwnProperty(l)&&(s=n[l],s!=null))switch(l){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:er(e,t,l,s,n,null)}return;case"dialog":hs("beforetoggle",e),hs("toggle",e),hs("cancel",e),hs("close",e);break;case"iframe":case"object":hs("load",e);break;case"video":case"audio":for(s=0;s<my.length;s++)hs(my[s],e);break;case"image":hs("error",e),hs("load",e);break;case"details":hs("toggle",e);break;case"embed":case"source":case"link":hs("error",e),hs("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(c in n)if(n.hasOwnProperty(c)&&(s=n[c],s!=null))switch(c){case"children":case"dangerouslySetInnerHTML":throw Error(Ue(137,t));default:er(e,t,c,s,n,null)}return;default:if(D7(t)){for(d in n)n.hasOwnProperty(d)&&(s=n[d],s!==void 0&&E6(e,t,d,s,n,void 0));return}}for(a in n)n.hasOwnProperty(a)&&(s=n[a],s!=null&&er(e,t,a,s,n,null))}function toe(e,t,n,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var r=null,i=null,o=null,a=null,l=null,c=null,d=null;for(p in n){var h=n[p];if(n.hasOwnProperty(p)&&h!=null)switch(p){case"checked":break;case"value":break;case"defaultValue":l=h;default:s.hasOwnProperty(p)||er(e,t,p,null,s,h)}}for(var f in s){var p=s[f];if(h=n[f],s.hasOwnProperty(f)&&(p!=null||h!=null))switch(f){case"type":i=p;break;case"name":r=p;break;case"checked":c=p;break;case"defaultChecked":d=p;break;case"value":o=p;break;case"defaultValue":a=p;break;case"children":case"dangerouslySetInnerHTML":if(p!=null)throw Error(Ue(137,t));break;default:p!==h&&er(e,t,f,p,s,h)}}JC(e,o,a,l,c,d,i,r);return;case"select":p=o=a=f=null;for(i in n)if(l=n[i],n.hasOwnProperty(i)&&l!=null)switch(i){case"value":break;case"multiple":p=l;default:s.hasOwnProperty(i)||er(e,t,i,null,s,l)}for(r in s)if(i=s[r],l=n[r],s.hasOwnProperty(r)&&(i!=null||l!=null))switch(r){case"value":f=i;break;case"defaultValue":a=i;break;case"multiple":o=i;default:i!==l&&er(e,t,r,i,s,l)}t=a,n=o,s=p,f!=null?zp(e,!!n,f,!1):!!s!=!!n&&(t!=null?zp(e,!!n,t,!0):zp(e,!!n,n?[]:"",!1));return;case"textarea":p=f=null;for(a in n)if(r=n[a],n.hasOwnProperty(a)&&r!=null&&!s.hasOwnProperty(a))switch(a){case"value":break;case"children":break;default:er(e,t,a,null,s,r)}for(o in s)if(r=s[o],i=n[o],s.hasOwnProperty(o)&&(r!=null||i!=null))switch(o){case"value":f=r;break;case"defaultValue":p=r;break;case"children":break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(Ue(91));break;default:r!==i&&er(e,t,o,r,s,i)}yF(e,f,p);return;case"option":for(var g in n)if(f=n[g],n.hasOwnProperty(g)&&f!=null&&!s.hasOwnProperty(g))switch(g){case"selected":e.selected=!1;break;default:er(e,t,g,null,s,f)}for(l in s)if(f=s[l],p=n[l],s.hasOwnProperty(l)&&f!==p&&(f!=null||p!=null))switch(l){case"selected":e.selected=f&&typeof f!="function"&&typeof f!="symbol";break;default:er(e,t,l,f,s,p)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var y in n)f=n[y],n.hasOwnProperty(y)&&f!=null&&!s.hasOwnProperty(y)&&er(e,t,y,null,s,f);for(c in s)if(f=s[c],p=n[c],s.hasOwnProperty(c)&&f!==p&&(f!=null||p!=null))switch(c){case"children":case"dangerouslySetInnerHTML":if(f!=null)throw Error(Ue(137,t));break;default:er(e,t,c,f,s,p)}return;default:if(D7(t)){for(var w in n)f=n[w],n.hasOwnProperty(w)&&f!==void 0&&!s.hasOwnProperty(w)&&E6(e,t,w,void 0,s,f);for(d in s)f=s[d],p=n[d],!s.hasOwnProperty(d)||f===p||f===void 0&&p===void 0||E6(e,t,d,f,s,p);return}}for(var v in n)f=n[v],n.hasOwnProperty(v)&&f!=null&&!s.hasOwnProperty(v)&&er(e,t,v,null,s,f);for(h in s)f=s[h],p=n[h],!s.hasOwnProperty(h)||f===p||f==null&&p==null||er(e,t,h,f,s,p)}function pR(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function noe(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),s=0;s<n.length;s++){var r=n[s],i=r.transferSize,o=r.initiatorType,a=r.duration;if(i&&a&&pR(o)){for(o=0,a=r.responseEnd,s+=1;s<n.length;s++){var l=n[s],c=l.startTime;if(c>a)break;var d=l.transferSize,h=l.initiatorType;d&&pR(h)&&(l=l.responseEnd,o+=d*(l<a?1:(a-c)/(l-c)))}if(--s,t+=8*(i+o)/(r.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var A6=null,M6=null;function mk(e){return e.nodeType===9?e:e.ownerDocument}function gR(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function _H(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function N6(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var r3=null;function soe(){var e=window.event;return e&&e.type==="popstate"?e===r3?!1:(r3=e,!0):(r3=null,!1)}var SH=typeof setTimeout=="function"?setTimeout:void 0,roe=typeof clearTimeout=="function"?clearTimeout:void 0,yR=typeof Promise=="function"?Promise:void 0,ioe=typeof queueMicrotask=="function"?queueMicrotask:typeof yR<"u"?function(e){return yR.resolve(null).then(e).catch(ooe)}:SH;function ooe(e){setTimeout(function(){throw e})}function jh(e){return e==="head"}function bR(e,t){var n=t,s=0;do{var r=n.nextSibling;if(e.removeChild(n),r&&r.nodeType===8)if(n=r.data,n==="/$"||n==="/&"){if(s===0){e.removeChild(r),g0(t);return}s--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")s++;else if(n==="html")P1(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,P1(n);for(var i=n.firstChild;i;){var o=i.nextSibling,a=i.nodeName;i[cb]||a==="SCRIPT"||a==="STYLE"||a==="LINK"&&i.rel.toLowerCase()==="stylesheet"||n.removeChild(i),i=o}}else n==="body"&&P1(e.ownerDocument.body);n=r}while(n);g0(t)}function vR(e,t){var n=e;e=0;do{var s=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=s}while(n)}function I6(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":I6(n),L7(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function aoe(e,t,n,s){for(;e.nodeType===1;){var r=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[cb])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(i=e.getAttribute("rel"),i==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(i!==r.rel||e.getAttribute("href")!==(r.href==null||r.href===""?null:r.href)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin)||e.getAttribute("title")!==(r.title==null?null:r.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(i=e.getAttribute("src"),(i!==(r.src==null?null:r.src)||e.getAttribute("type")!==(r.type==null?null:r.type)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin))&&i&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var i=r.name==null?null:""+r.name;if(r.type==="hidden"&&e.getAttribute("name")===i)return e}else return e;if(e=yl(e.nextSibling),e===null)break}return null}function loe(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=yl(e.nextSibling),e===null))return null;return e}function CH(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=yl(e.nextSibling),e===null))return null;return e}function R6(e){return e.data==="$?"||e.data==="$~"}function j6(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function coe(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var s=function(){t(),n.removeEventListener("DOMContentLoaded",s)};n.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function yl(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var L6=null;function wR(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return yl(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function xR(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function TH(e,t,n){switch(t=mk(n),e){case"html":if(e=t.documentElement,!e)throw Error(Ue(452));return e;case"head":if(e=t.head,!e)throw Error(Ue(453));return e;case"body":if(e=t.body,!e)throw Error(Ue(454));return e;default:throw Error(Ue(451))}}function P1(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);L7(e)}var vl=new Map,kR=new Set;function pk(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ku=qs.d;qs.d={f:uoe,r:doe,D:hoe,C:foe,L:moe,m:poe,X:yoe,S:goe,M:boe};function uoe(){var e=Ku.f(),t=c_();return e||t}function doe(e){var t=P0(e);t!==null&&t.tag===5&&t.type==="form"?vq(t):Ku.r(e)}var F0=typeof document>"u"?null:document;function EH(e,t,n){var s=F0;if(s&&typeof t=="string"&&t){var r=cl(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof n=="string"&&(r+='[crossorigin="'+n+'"]'),kR.has(r)||(kR.add(r),e={rel:e,crossOrigin:n,href:t},s.querySelector(r)===null&&(t=s.createElement("link"),io(t,"link",e),$i(t),s.head.appendChild(t)))}}function hoe(e){Ku.D(e),EH("dns-prefetch",e,null)}function foe(e,t){Ku.C(e,t),EH("preconnect",e,t)}function moe(e,t,n){Ku.L(e,t,n);var s=F0;if(s&&e&&t){var r='link[rel="preload"][as="'+cl(t)+'"]';t==="image"&&n&&n.imageSrcSet?(r+='[imagesrcset="'+cl(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(r+='[imagesizes="'+cl(n.imageSizes)+'"]')):r+='[href="'+cl(e)+'"]';var i=r;switch(t){case"style":i=p0(e);break;case"script":i=q0(e)}vl.has(i)||(e=kr({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),vl.set(i,e),s.querySelector(r)!==null||t==="style"&&s.querySelector(pb(i))||t==="script"&&s.querySelector(gb(i))||(t=s.createElement("link"),io(t,"link",e),$i(t),s.head.appendChild(t)))}}function poe(e,t){Ku.m(e,t);var n=F0;if(n&&e){var s=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+cl(s)+'"][href="'+cl(e)+'"]',i=r;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=q0(e)}if(!vl.has(i)&&(e=kr({rel:"modulepreload",href:e},t),vl.set(i,e),n.querySelector(r)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(gb(i)))return}s=n.createElement("link"),io(s,"link",e),$i(s),n.head.appendChild(s)}}}function goe(e,t,n){Ku.S(e,t,n);var s=F0;if(s&&e){var r=$p(s).hoistableStyles,i=p0(e);t=t||"default";var o=r.get(i);if(!o){var a={loading:0,preload:null};if(o=s.querySelector(pb(i)))a.loading=5;else{e=kr({rel:"stylesheet",href:e,"data-precedence":t},n),(n=vl.get(i))&&vE(e,n);var l=o=s.createElement("link");$i(l),io(l,"link",e),l._p=new Promise(function(c,d){l.onload=c,l.onerror=d}),l.addEventListener("load",function(){a.loading|=1}),l.addEventListener("error",function(){a.loading|=2}),a.loading|=4,cx(o,t,s)}o={type:"stylesheet",instance:o,count:1,state:a},r.set(i,o)}}}function yoe(e,t){Ku.X(e,t);var n=F0;if(n&&e){var s=$p(n).hoistableScripts,r=q0(e),i=s.get(r);i||(i=n.querySelector(gb(r)),i||(e=kr({src:e,async:!0},t),(t=vl.get(r))&&wE(e,t),i=n.createElement("script"),$i(i),io(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},s.set(r,i))}}function boe(e,t){Ku.M(e,t);var n=F0;if(n&&e){var s=$p(n).hoistableScripts,r=q0(e),i=s.get(r);i||(i=n.querySelector(gb(r)),i||(e=kr({src:e,async:!0,type:"module"},t),(t=vl.get(r))&&wE(e,t),i=n.createElement("script"),$i(i),io(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},s.set(r,i))}}function _R(e,t,n,s){var r=(r=Jd.current)?pk(r):null;if(!r)throw Error(Ue(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=p0(n.href),n=$p(r).hoistableStyles,s=n.get(t),s||(s={type:"style",instance:null,count:0,state:null},n.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=p0(n.href);var i=$p(r).hoistableStyles,o=i.get(e);if(o||(r=r.ownerDocument||r,o={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(e,o),(i=r.querySelector(pb(e)))&&!i._p&&(o.instance=i,o.state.loading=5),vl.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},vl.set(e,n),i||voe(r,e,n,o.state))),t&&s===null)throw Error(Ue(528,""));return o}if(t&&s!==null)throw Error(Ue(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=q0(n),n=$p(r).hoistableScripts,s=n.get(t),s||(s={type:"script",instance:null,count:0,state:null},n.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(Ue(444,e))}}function p0(e){return'href="'+cl(e)+'"'}function pb(e){return'link[rel="stylesheet"]['+e+"]"}function AH(e){return kr({},e,{"data-precedence":e.precedence,precedence:null})}function voe(e,t,n,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),io(t,"link",n),$i(t),e.head.appendChild(t))}function q0(e){return'[src="'+cl(e)+'"]'}function gb(e){return"script[async]"+e}function SR(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+cl(n.href)+'"]');if(s)return t.instance=s,$i(s),s;var r=kr({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),$i(s),io(s,"style",r),cx(s,n.precedence,e),t.instance=s;case"stylesheet":r=p0(n.href);var i=e.querySelector(pb(r));if(i)return t.state.loading|=4,t.instance=i,$i(i),i;s=AH(n),(r=vl.get(r))&&vE(s,r),i=(e.ownerDocument||e).createElement("link"),$i(i);var o=i;return o._p=new Promise(function(a,l){o.onload=a,o.onerror=l}),io(i,"link",s),t.state.loading|=4,cx(i,n.precedence,e),t.instance=i;case"script":return i=q0(n.src),(r=e.querySelector(gb(i)))?(t.instance=r,$i(r),r):(s=n,(r=vl.get(i))&&(s=kr({},n),wE(s,r)),e=e.ownerDocument||e,r=e.createElement("script"),$i(r),io(r,"link",s),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(Ue(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(s=t.instance,t.state.loading|=4,cx(s,n.precedence,e));return t.instance}function cx(e,t,n){for(var s=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=s.length?s[s.length-1]:null,i=r,o=0;o<s.length;o++){var a=s[o];if(a.dataset.precedence===t)i=a;else if(i!==r)break}i?i.parentNode.insertBefore(e,i.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function vE(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function wE(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var ux=null;function CR(e,t,n){if(ux===null){var s=new Map,r=ux=new Map;r.set(n,s)}else r=ux,s=r.get(n),s||(s=new Map,r.set(n,s));if(s.has(e))return s;for(s.set(e,null),n=n.getElementsByTagName(e),r=0;r<n.length;r++){var i=n[r];if(!(i[cb]||i[to]||e==="link"&&i.getAttribute("rel")==="stylesheet")&&i.namespaceURI!=="http://www.w3.org/2000/svg"){var o=i.getAttribute(t)||"";o=e+o;var a=s.get(o);a?a.push(i):s.set(o,[i])}}return s}function TR(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function woe(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function MH(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function xoe(e,t,n,s){if(n.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&!(n.state.loading&4)){if(n.instance===null){var r=p0(s.href),i=t.querySelector(pb(r));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=gk.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=i,$i(i);return}i=t.ownerDocument||t,s=AH(s),(r=vl.get(r))&&vE(s,r),i=i.createElement("link"),$i(i);var o=i;o._p=new Promise(function(a,l){o.onload=a,o.onerror=l}),io(i,"link",s),n.instance=i}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=gk.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var i3=0;function koe(e,t){return e.stylesheets&&e.count===0&&dx(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var s=setTimeout(function(){if(e.stylesheets&&dx(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&i3===0&&(i3=62500*noe());var r=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&dx(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>i3?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(r)}}:null}function gk(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)dx(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var yk=null;function dx(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,yk=new Map,t.forEach(_oe,e),yk=null,gk.call(e))}function _oe(e,t){if(!(t.state.loading&4)){var n=yk.get(e);if(n)var s=n.get(null);else{n=new Map,yk.set(e,n);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i<r.length;i++){var o=r[i];(o.nodeName==="LINK"||o.getAttribute("media")!=="not all")&&(n.set(o.dataset.precedence,o),s=o)}s&&n.set(null,s)}r=t.instance,o=r.getAttribute("data-precedence"),i=n.get(o)||s,i===s&&n.set(null,r),n.set(o,r),this.count++,s=gk.bind(this),r.addEventListener("load",s),r.addEventListener("error",s),i?i.parentNode.insertBefore(r,i.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(r,e.firstChild)),t.state.loading|=4}}var gy={$$typeof:yu,Provider:null,Consumer:null,_currentValue:Df,_currentValue2:Df,_threadCount:0};function Soe(e,t,n,s,r,i,o,a,l){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=AS(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=AS(0),this.hiddenUpdates=AS(null),this.identifierPrefix=s,this.onUncaughtError=r,this.onCaughtError=i,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=l,this.incompleteTransitions=new Map}function NH(e,t,n,s,r,i,o,a,l,c,d,h){return e=new Soe(e,t,n,o,l,c,d,h,a),t=1,i===!0&&(t|=24),i=_a(3,null,null,t),e.current=i,i.stateNode=e,t=W7(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:s,isDehydrated:n,cache:t},Y7(i),e}function IH(e){return e?(e=Tp,e):Tp}function RH(e,t,n,s,r,i){r=IH(r),s.context===null?s.context=r:s.pendingContext=r,s=eh(t),s.payload={element:n},i=i===void 0?null:i,i!==null&&(s.callback=i),n=th(e,s,t),n!==null&&(sa(n,e,t),M1(n,e,t))}function ER(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function xE(e,t){ER(e,t),(e=e.alternate)&&ER(e,t)}function jH(e){if(e.tag===13||e.tag===31){var t=pm(e,67108864);t!==null&&sa(t,e,67108864),xE(e,67108864)}}function AR(e){if(e.tag===13||e.tag===31){var t=Na();t=R7(t);var n=pm(e,t);n!==null&&sa(n,e,t),xE(e,t)}}var bk=!0;function Coe(e,t,n,s){var r=En.T;En.T=null;var i=qs.p;try{qs.p=2,kE(e,t,n,s)}finally{qs.p=i,En.T=r}}function Toe(e,t,n,s){var r=En.T;En.T=null;var i=qs.p;try{qs.p=8,kE(e,t,n,s)}finally{qs.p=i,En.T=r}}function kE(e,t,n,s){if(bk){var r=D6(s);if(r===null)s3(e,t,s,vk,n),MR(e,s);else if(Aoe(r,e,t,n,s))s.stopPropagation();else if(MR(e,s),t&4&&-1<Eoe.indexOf(e)){for(;r!==null;){var i=P0(r);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var o=pf(i.pendingLanes);if(o!==0){var a=i;for(a.pendingLanes|=2,a.entangledLanes|=2;o;){var l=1<<31-Ma(o);a.entanglements[1]|=l,o&=~l}Bc(i),!(zs&6)&&(lk=Ea()+500,mb(0))}}break;case 31:case 13:a=pm(i,2),a!==null&&sa(a,i,2),c_(),xE(i,2)}if(i=D6(s),i===null&&s3(e,t,s,vk,n),i===r)break;r=i}r!==null&&s.stopPropagation()}else s3(e,t,s,null,n)}}function D6(e){return e=O7(e),_E(e)}var vk=null;function _E(e){if(vk=null,e=wp(e),e!==null){var t=ib(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=Zz(t),e!==null)return e;e=null}else if(n===31){if(e=eF(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return vk=e,null}function LH(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(hre()){case rF:return 2;case iF:return 8;case Kx:case fre:return 32;case oF:return 268435456;default:return 32}default:return 32}}var O6=!1,rh=null,ih=null,oh=null,yy=new Map,by=new Map,Od=[],Eoe="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 MR(e,t){switch(e){case"focusin":case"focusout":rh=null;break;case"dragenter":case"dragleave":ih=null;break;case"mouseover":case"mouseout":oh=null;break;case"pointerover":case"pointerout":yy.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":by.delete(t.pointerId)}}function Rg(e,t,n,s,r,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:s,nativeEvent:i,targetContainers:[r]},t!==null&&(t=P0(t),t!==null&&jH(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function Aoe(e,t,n,s,r){switch(t){case"focusin":return rh=Rg(rh,e,t,n,s,r),!0;case"dragenter":return ih=Rg(ih,e,t,n,s,r),!0;case"mouseover":return oh=Rg(oh,e,t,n,s,r),!0;case"pointerover":var i=r.pointerId;return yy.set(i,Rg(yy.get(i)||null,e,t,n,s,r)),!0;case"gotpointercapture":return i=r.pointerId,by.set(i,Rg(by.get(i)||null,e,t,n,s,r)),!0}return!1}function DH(e){var t=wp(e.target);if(t!==null){var n=ib(t);if(n!==null){if(t=n.tag,t===13){if(t=Zz(n),t!==null){e.blockedOn=t,fI(e.priority,function(){AR(n)});return}}else if(t===31){if(t=eF(n),t!==null){e.blockedOn=t,fI(e.priority,function(){AR(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function hx(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=D6(e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);e6=s,n.target.dispatchEvent(s),e6=null}else return t=P0(n),t!==null&&jH(t),e.blockedOn=n,!1;t.shift()}return!0}function NR(e,t,n){hx(e)&&n.delete(t)}function Moe(){O6=!1,rh!==null&&hx(rh)&&(rh=null),ih!==null&&hx(ih)&&(ih=null),oh!==null&&hx(oh)&&(oh=null),yy.forEach(NR),by.forEach(NR)}function Nv(e,t){e.blockedOn===t&&(e.blockedOn=null,O6||(O6=!0,Ei.unstable_scheduleCallback(Ei.unstable_NormalPriority,Moe)))}var Iv=null;function IR(e){Iv!==e&&(Iv=e,Ei.unstable_scheduleCallback(Ei.unstable_NormalPriority,function(){Iv===e&&(Iv=null);for(var t=0;t<e.length;t+=3){var n=e[t],s=e[t+1],r=e[t+2];if(typeof s!="function"){if(_E(s||n)===null)continue;break}var i=P0(n);i!==null&&(e.splice(t,3),t-=3,g6(i,{pending:!0,data:r,method:n.method,action:s},s,r))}}))}function g0(e){function t(l){return Nv(l,e)}rh!==null&&Nv(rh,e),ih!==null&&Nv(ih,e),oh!==null&&Nv(oh,e),yy.forEach(t),by.forEach(t);for(var n=0;n<Od.length;n++){var s=Od[n];s.blockedOn===e&&(s.blockedOn=null)}for(;0<Od.length&&(n=Od[0],n.blockedOn===null);)DH(n),n.blockedOn===null&&Od.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(s=0;s<n.length;s+=3){var r=n[s],i=n[s+1],o=r[ia]||null;if(typeof i=="function")o||IR(n);else if(o){var a=null;if(i&&i.hasAttribute("formAction")){if(r=i,o=i[ia]||null)a=o.formAction;else if(_E(r)!==null)continue}else a=o.action;typeof a=="function"?n[s+1]=a:(n.splice(s,3),s-=3),IR(n)}}}function OH(){function e(i){i.canIntercept&&i.info==="react-transition"&&i.intercept({handler:function(){return new Promise(function(o){return r=o})},focusReset:"manual",scroll:"manual"})}function t(){r!==null&&(r(),r=null),s||setTimeout(n,20)}function n(){if(!s&&!navigation.transition){var i=navigation.currentEntry;i&&i.url!=null&&navigation.navigate(i.url,{state:i.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,r=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),r!==null&&(r(),r=null)}}}function SE(e){this._internalRoot=e}h_.prototype.render=SE.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Ue(409));var n=t.current,s=Na();RH(n,s,e,t,null,null)};h_.prototype.unmount=SE.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;RH(e.current,2,null,e,null,null),c_(),t[O0]=null}};function h_(e){this._internalRoot=e}h_.prototype.unstable_scheduleHydration=function(e){if(e){var t=dF();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Od.length&&t!==0&&t<Od[n].priority;n++);Od.splice(n,0,e),n===0&&DH(e)}};var RR=Qz.version;if(RR!=="19.2.4")throw Error(Ue(527,RR,"19.2.4"));qs.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(Ue(188)):(e=Object.keys(e).join(","),Error(Ue(268,e)));return e=ire(t),e=e!==null?tF(e):null,e=e===null?null:e.stateNode,e};var Noe={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:En,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Rv=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Rv.isDisabled&&Rv.supportsFiber)try{ob=Rv.inject(Noe),Aa=Rv}catch{}}Y2.createRoot=function(e,t){if(!Jz(e))throw Error(Ue(299));var n=!1,s="",r=Eq,i=Aq,o=Mq;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onUncaughtError!==void 0&&(r=t.onUncaughtError),t.onCaughtError!==void 0&&(i=t.onCaughtError),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=NH(e,1,!1,null,null,n,s,null,r,i,o,OH),e[O0]=t.current,bE(e),new SE(t)};Y2.hydrateRoot=function(e,t,n){if(!Jz(e))throw Error(Ue(299));var s=!1,r="",i=Eq,o=Aq,a=Mq,l=null;return n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(r=n.identifierPrefix),n.onUncaughtError!==void 0&&(i=n.onUncaughtError),n.onCaughtError!==void 0&&(o=n.onCaughtError),n.onRecoverableError!==void 0&&(a=n.onRecoverableError),n.formState!==void 0&&(l=n.formState)),t=NH(e,1,!0,t,n??null,s,r,l,i,o,a,OH),t.context=IH(null),n=t.current,s=Na(),s=R7(s),r=eh(s),r.callback=null,th(n,r,s),n=s,t.current.lanes=n,lb(t,n),Bc(t),e[O0]=t.current,bE(e),new h_(t)};Y2.version="19.2.4";function PH(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(PH)}catch(e){console.error(e)}}PH(),Vz.exports=Y2;var P6=Vz.exports;const Ioe=W2(P6);/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Roe="agent";function joe(e){return e===Roe}var Loe=3e4,Doe=new Set(["authorized","expired","error","cancelled"]),Ooe=class{constructor(e){this.client=e}async start(e){let t=await this.client.startDeviceFlow(e),n=this.client;return{deviceFlowId:t.deviceFlowId,providerId:t.providerId,userCode:t.userCode,verificationUri:t.verificationUri,verificationUriComplete:t.verificationUriComplete,expiresAt:t.expiresAt,intervalMs:t.intervalMs,attached:t.attached,cancel:()=>n.cancelDeviceFlow(t.deviceFlowId,{clientId:e.clientId}),awaitCompletion:async(s={})=>await Poe(n,t,e.clientId,s)}}status(e,t){return this.client.getDeviceFlow(e,t)}cancel(e,t){return this.client.cancelDeviceFlow(e,t)}};async function Poe(e,t,n,s){return await Boe(e,t,n,s)}async function jR(e,t,n,s){try{return await e.getDeviceFlow(t.deviceFlowId,{clientId:n,signal:s})}catch(r){if(r instanceof $u&&r.status===404)return{deviceFlowId:t.deviceFlowId,providerId:t.providerId,status:"error",errorKind:"not_found_or_evicted",hint:"device-flow not found on daemon (evicted past terminal grace, daemon restart, or unknown deviceFlowId)",createdAt:Date.now()};throw r}}function LR(e,t={}){if(e!==void 0&&Number.isFinite(e)&&!(t.allowZero?e<0:e<=0))return e}async function Boe(e,t,n,s){var d;let r=s.signal,i=LR(s.timeoutMs,{allowZero:!0}),o=LR(s.pollOverrideMs),a=i!==void 0?Date.now()+i:t.expiresAt+Loe,l=Math.max(1e3,o??t.intervalMs??5e3),c=l;for(;;){if(r!=null&&r.aborted)throw B6(r);if(Date.now()>=a)return await jR(e,t,n,r);let h=await jR(e,t,n,r);if(h.intervalMs&&h.intervalMs!==c&&(c=h.intervalMs,l=h.intervalMs,(d=s.onThrottled)==null||d.call(s,h.intervalMs)),Doe.has(h.status))return h;await $oe(l,r)}}async function $oe(e,t){if(t!=null&&t.aborted)throw B6(t);await new Promise((n,s)=>{let r=setTimeout(()=>{o(),n()},e),i=()=>{o(),s(B6(t))};function o(){clearTimeout(r),t==null||t.removeEventListener("abort",i)}t&&t.addEventListener("abort",i,{once:!0})})}function B6(e){let t=e==null?void 0:e.reason;return t instanceof Error?t:typeof t=="string"?new Error(t):new Error("aborted")}var $u=class extends Error{constructor(t,n,s){super(s);Me(this,"status");Me(this,"body");this.name="DaemonHttpError",this.status=t,this.body=n}},DR=class extends Error{constructor(e){super(e??"Transport connection closed"),this.name="DaemonTransportClosedError"}},zoe=class extends Error{constructor(e){super(e),this.name="SseFramingError"}},OR=16*1024*1024;async function*Foe(e,t){let n=e.getReader(),s=new TextDecoder,r="",i;t&&(i=()=>{n.cancel().catch(()=>{})},t.aborted?i():t.addEventListener("abort",i,{once:!0}));try{for(;;){if(t!=null&&t.aborted)return;let o,a;try{({value:o,done:a}=await n.read())}catch(c){if(t!=null&&t.aborted)return;throw c}if(a){if(r+=s.decode(),r.length>0){let c=PR(r);for(let d of c.frames){let h=o3(d);h&&(yield h)}if(c.tail.length>0){let d=o3(c.tail);d&&(yield d)}}return}if(r+=s.decode(o,{stream:!0}),r.length>OR)throw new zoe(`parseSseStream: unread buffer exceeded ${OR} UTF-16 code units without a frame separator — upstream likely not SSE`);let l=PR(r);if(l.frames.length>0)for(let c of l.frames){let d=o3(c);d&&(yield d)}r=l.tail}}finally{t&&i&&t.removeEventListener("abort",i);try{await n.cancel()}catch{}}}function PR(e){let t=[],n=0;for(;n<e.length;){let s=e.indexOf(`

`,n);if(s===-1){let i=e.indexOf(`\r
\r
`,n);if(i===-1)break;t.push(e.slice(n,i)),n=i+4;continue}let r=e.slice(n,s).indexOf(`\r
\r
`);if(r!==-1){let i=n+r;t.push(e.slice(n,i)),n=i+4}else t.push(e.slice(n,s)),n=s+2}return{frames:t,tail:e.slice(n)}}function o3(e){if(!e)return;let t=[];for(let s of e.split(/\r?\n/)){if(!s.startsWith("data:"))continue;let r=s.slice(5);t.push(r.startsWith(" ")?r.slice(1):r)}if(t.length===0)return;let n=t.join(`
`);try{let s=JSON.parse(n);if(typeof s!="object"||s===null||Array.isArray(s)||s.v!==1||typeof s.type!="string")return;let r=s.id;return r!==void 0&&(!Number.isSafeInteger(r)||r<1)?void 0:s}catch{return}}var qoe=class{constructor(e,t,n){Me(this,"baseUrl");Me(this,"token");Me(this,"_fetch");Me(this,"_disposed",!1);Me(this,"type","rest");Me(this,"supportsReplay",!0);Me(this,"restFetch");this.baseUrl=e,this.token=t,this._fetch=n,this.restFetch=n}get connected(){return!this._disposed}async fetch(e,t,n){if(this._disposed)throw new DR;return this._fetch(e,t)}async*subscribeEvents(e,t={}){var d;if(this._disposed)throw new DR;let n={Accept:"text/event-stream"};this.token&&(n.Authorization=`Bearer ${this.token}`),t.lastEventId!==void 0&&(n["Last-Event-ID"]=String(t.lastEventId));let s=new AbortController,r,i=t.connectTimeoutMs;i&&Number.isFinite(i)&&(r=setTimeout(()=>s.abort(new DOMException("Initial connect timed out","TimeoutError")),i),typeof r=="object"&&r&&"unref"in r&&r.unref());let o=t.signal?Hoe([t.signal,s.signal]):s.signal,a=`${this.baseUrl}/session/${encodeURIComponent(e)}/events`;t.maxQueued!==void 0&&(a+=`?maxQueued=${encodeURIComponent(String(t.maxQueued))}`);let l;try{l=await this._fetch(a,{headers:n,signal:o})}finally{r!==void 0&&clearTimeout(r)}if(!l.ok){let h;try{let p=await l.text();try{h=JSON.parse(p)}catch{h=p}}catch{}let f=h&&typeof h=="object"&&"error"in h?String(h.error):`HTTP ${l.status}`;throw new $u(l.status,h,`GET /session/:id/events: ${f}`)}let c=l.headers.get("content-type")??"";if(!c.toLowerCase().includes("text/event-stream")){try{await((d=l.body)==null?void 0:d.cancel())}catch{}throw new $u(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*Foe(l.body,t.signal)}dispose(){this._disposed=!0}};function Hoe(e){let t=AbortSignal.any;if(typeof t=="function")return t.call(AbortSignal,e);let n=new AbortController,s=[],r=()=>{for(;s.length>0;){let i=s.pop();try{i==null||i()}catch{}}};for(let i of e){if(i.aborted)return n.abort(i.reason),r(),n.signal;let o=()=>{n.abort(i.reason),r()};i.addEventListener("abort",o,{once:!0}),s.push(()=>i.removeEventListener("abort",o))}return n.signal.addEventListener("abort",r,{once:!0}),n.signal}var jv="/workspace/memory/remember",Lv="/workspace/memory/forget",Dv="/workspace/memory/dream",wk=20,Uoe=3e4,Voe=65e3,Woe=9e4,BR=2147483647,Goe=5,hp=33e4,Koe="X-Qwen-Client-Id",rt=encodeURIComponent;function $R(e){let t=e.trim();if(!t)throw new Error("rule must be a non-empty string");return t}function BH(e){if(e===void 0)return Goe;if(e===null||e===0||e===1/0)return 1/0;if(!Number.isInteger(e)||e<0)throw new TypeError("bad maxPendingPromptsPerSession");return e}function Yoe(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===47;)t--;return t===e.length?e:e.slice(0,t)}function Xoe(){var e,t;try{let n=(t=(e=globalThis.process)==null?void 0:e.env)==null?void 0:t.QWEN_SERVER_TOKEN;if(typeof n!="string")return;let s=n.trim();return s.length===0?void 0:s}catch{return}}var zR=class extends Error{constructor(e,t,n){super(`Pending prompts full: "${e}" (${n}/${t})`),this.name="DaemonPendingPromptLimitError",this.sessionId=e,this.limit=t,this.pendingCount=n}};function $H(e){return typeof e=="object"&&e!==null&&e._daemonTurnError===!0}var $6=class{constructor(e){Me(this,"baseUrl");Me(this,"token");Me(this,"_fetch");Me(this,"fetchTimeoutMs");Me(this,"promptLimit");Me(this,"promptCounts",Object.create(null));Me(this,"transport");Me(this,"_authFlow");var n;this.baseUrl=Yoe(e.baseUrl),this.token=e.token??Xoe(),this._fetch=e.fetch??((n=e.transport)==null?void 0:n.restFetch)??globalThis.fetch.bind(globalThis);let t=e.fetchTimeoutMs??Uoe;this.fetchTimeoutMs=Number.isFinite(t)&&t>0?t:0,this.promptLimit=BH(e.maxPendingPromptsPerSession),this.transport=e.transport??new qoe(this.baseUrl,this.token,this._fetch)}get auth(){return this._authFlow||(this._authFlow=new Ooe(this)),this._authFlow}get maxPendingPromptsPerSession(){return this.promptLimit}reservePromptSlot(e,t=this.promptLimit){if(t===1/0)return()=>{};let n=this.promptCounts,s=n[e]??0;if(s>=t)throw new zR(e,t,s);n[e]=s+1;let r;return()=>{r||(r=!0,(n[e]??0)<=1?delete n[e]:--n[e])}}async fetchWithTimeout(e,t={},n,s,r="transport"){let i=this.fetchTimeoutMs;if(s!==void 0&&Number.isFinite(s)&&s>=0&&(i=s),!i||!Number.isFinite(i)){let d=r==="rest"?await this._fetch(e,t):await this.transport.fetch(e,t);return n?n(d):d}let o=new AbortController,a=setTimeout(()=>{o.abort(new DOMException("timeout","TimeoutError"))},i);typeof a=="object"&&a&&"unref"in a&&a.unref();let l=t.signal??void 0,c=l?a3([l,o.signal]):o.signal;try{let d=r==="rest"?await this._fetch(e,{...t,signal:c}):await this.transport.fetch(e,{...t,signal:c});return n?await n(d):d}finally{clearTimeout(a)}}headers(e={},t){let n={...e};return this.token&&(n.Authorization=`Bearer ${this.token}`),t&&(n[Koe]=t),n}async failOnError(e,t,n){let s;try{let i=await e.text();if(i.length>0)try{s=JSON.parse(i)}catch{s=i}}catch{}let r=s&&typeof s=="object"&&"error"in s?String(s.error):`HTTP ${e.status}`;if(n&&e.status===503&&s&&typeof s=="object"){let i=s;if(i.code==="prompt_queue_full")return new zR(typeof i.sessionId=="string"?i.sessionId:n,typeof i.limit=="number"?i.limit:0,typeof i.pendingCount=="number"?i.pendingCount:0)}return new $u(e.status,s,`${t}: ${r}`)}async jsonRequest(e,t,n={}){let s=n.body!==void 0;return await this.fetchWithTimeout(`${this.baseUrl}${e}`,{...n.method?{method:n.method}:{},headers:this.headers(s?{"Content-Type":"application/json"}:{},n.clientId),...s?{body:JSON.stringify(n.body)}:{},...n.signal?{signal:n.signal}:{}},async r=>{if(!r.ok)throw await this.failOnError(r,t);return await r.json()},n.timeoutMs,n.mode)}async workspaceJsonRequest(e,t,n,s={}){return await this.jsonRequest(`/workspaces/${e}${t}`,n,s)}async sessionExportRequest(e,t,n={}){let s=n.format??"html",r=n.format?`?format=${rt(n.format)}`:"";return await this.fetchWithTimeout(`${this.baseUrl}${e}${r}`,{headers:this.headers({},n.clientId)},async i=>{var c;if(!i.ok)throw await this.failOnError(i,t);let o=await i.text(),a=i.headers.get("content-type")??"",l=((c=/filename="([^"]+)"/i.exec(i.headers.get("content-disposition")??""))==null?void 0:c[1])??`export.${s}`;return{content:o,filename:l,mimeType:a,format:s}},void 0,"rest")}async workspaceNoContentRequest(e,t,n,s={}){return await this.fetchWithTimeout(`${this.baseUrl}/workspaces/${e}${t}`,{...s.method?{method:s.method}:{},headers:this.headers({},s.clientId)},async r=>{var i,o;if(r.status===204){try{await((i=r.body)==null?void 0:i.cancel())}catch{}return}if(r.status===404&&s.okNotFoundCode){let a=await this.failOnError(r,n);if(((o=a.body)==null?void 0:o.code)===s.okNotFoundCode)return;throw a}throw await this.failOnError(r,n)},s.timeoutMs)}workspaceById(e){return new FR(this,rt(e))}workspaceByCwd(e){return new FR(this,rt(e))}async health(){return await this.fetchWithTimeout(`${this.baseUrl}/health`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /health");return await e.json()})}async capabilities(){return await this.fetchWithTimeout(`${this.baseUrl}/capabilities`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /capabilities");return await e.json()})}async daemonStatus(e="summary"){let t=e==="summary"?"":`?detail=${e}`;return await this.jsonRequest(`/daemon/status${t}`,"GET /daemon/status")}async usageDashboard(e={}){let t=new URLSearchParams;e.range!==void 0&&t.set("range",e.range),e.heatmapDays!==void 0&&t.set("heatmapDays",String(e.heatmapDays));let n=t.toString();return await this.jsonRequest(`/usage/dashboard${n?`?${n}`:""}`,"GET /usage/dashboard")}async workspaceMcp(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/mcp");return await e.json()})}async workspaceGit(){return await this.jsonRequest("/workspace/git","GET /workspace/git",{mode:"rest"})}async workspaceMcpTools(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${rt(e)}/tools`,{headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/mcp/:server/tools");return await t.json()})}async workspaceMcpResources(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${rt(e)}/resources`,{headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/mcp/:server/resources");return await t.json()})}async workspaceSkills(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/skills`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/skills");return await e.json()})}async workspaceAcpPreheat(e){let t=e??5e3,n=e!==void 0?`?timeoutMs=${encodeURIComponent(e)}`:"";return await this.fetchWithTimeout(`${this.baseUrl}/workspace/acp/preheat${n}`,{method:"POST",headers:this.headers()},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /workspace/acp/preheat");return await s.json()},t+2e3)}async workspaceAcpStatus(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/acp/status`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/acp/status");return await e.json()})}async workspaceProviders(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/providers`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/providers");return await e.json()})}async workspaceHooks(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/hooks`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/hooks");return await e.json()})}async sessionHooks(e){return await this.fetchWithTimeout(`${this.baseUrl}/session/${rt(e)}/hooks`,{headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /session/:id/hooks");return await t.json()})}async workspaceExtensions(){return await this.jsonRequest("/workspace/extensions","GET /workspace/extensions",{mode:"rest"})}async installExtension(e,t){return await this.jsonRequest("/workspace/extensions/install","POST /workspace/extensions/install",{method:"POST",body:e,clientId:t,mode:"rest"})}async extensionOperationStatus(e){return await this.jsonRequest(`/workspace/extensions/operations/${rt(e)}`,"GET /workspace/extensions/operations/:operationId",{mode:"rest"})}async checkExtensionUpdates(e){return await this.jsonRequest("/workspace/extensions/check-updates","POST /workspace/extensions/check-updates",{method:"POST",body:{},clientId:e,mode:"rest"})}async refreshExtensions(e){return await this.jsonRequest("/workspace/extensions/refresh","POST /workspace/extensions/refresh",{method:"POST",body:{},clientId:e,mode:"rest"})}async enableExtension(e,t,n){return await this.jsonRequest(`/workspace/extensions/${rt(e)}/enable`,"POST /workspace/extensions/:name/enable",{method:"POST",body:t,clientId:n,mode:"rest"})}async disableExtension(e,t,n){return await this.jsonRequest(`/workspace/extensions/${rt(e)}/disable`,"POST /workspace/extensions/:name/disable",{method:"POST",body:t,clientId:n,mode:"rest"})}async updateExtension(e,t){return await this.jsonRequest(`/workspace/extensions/${rt(e)}/update`,"POST /workspace/extensions/:name/update",{method:"POST",body:{},clientId:t,mode:"rest"})}async uninstallExtension(e,t){return await this.jsonRequest(`/workspace/extensions/${rt(e)}`,"DELETE /workspace/extensions/:name",{method:"DELETE",clientId:t,mode:"rest"})}async extensionCatalog(){return await this.jsonRequest("/extensions","GET /extensions",{mode:"rest"})}async installUserExtension(e,t){return await this.jsonRequest("/extensions/install","POST /extensions/install",{method:"POST",body:e,clientId:t,mode:"rest"})}async checkUserExtensionUpdates(e){return await this.jsonRequest("/extensions/check-updates","POST /extensions/check-updates",{method:"POST",body:{},clientId:e,mode:"rest"})}async updateUserExtension(e,t){return await this.jsonRequest(`/extensions/${rt(e)}/update`,"POST /extensions/:extensionId/update",{method:"POST",body:{},clientId:t,mode:"rest"})}async uninstallUserExtension(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/extensions/${rt(e)}`,{method:"DELETE",headers:this.headers({},t)},async n=>{var s;if(n.status===204){await((s=n.body)==null?void 0:s.cancel().catch(()=>{}));return}if(!n.ok)throw await this.failOnError(n,"DELETE /extensions/:extensionId");return await n.json()},void 0,"rest")}async setExtensionDefaultActivation(e,t,n){return await this.jsonRequest(`/extensions/${rt(e)}/activation`,"PUT /extensions/:extensionId/activation",{method:"PUT",body:{state:t},clientId:n,mode:"rest"})}async extensionOperation(e,t){return await this.jsonRequest(`/extensions/operations/${rt(e)}`,"GET /extensions/operations/:operationId",t?{signal:t,mode:"rest"}:{mode:"rest"})}async waitForExtensionOperation(e,t={}){var a;let n=t.pollIntervalMs??1e3,s=t.timeoutMs??10*6e4,r=s!==Number.POSITIVE_INFINITY,i=Date.now()+s,o=()=>new Error(`Timed out waiting for extension operation ${e.operationId}. The server operation was not cancelled.`);for(;;){(a=t.signal)==null||a.throwIfAborted();let l=i-Date.now();if(l<=0||Number.isNaN(l))throw o();let c;if(!r)c=await this.extensionOperation(e.operationId,t.signal);else{let h=new AbortController,f=t.signal?a3([t.signal,h.signal]):h.signal,p,g=new Promise((y,w)=>{let v=()=>{let x=o();w(x),h.abort(x)},b=()=>{let x=i-Date.now();if(x<=0){v();return}p=setTimeout(()=>{Date.now()>=i?v():b()},Math.min(x,BR))};b()});try{c=await Promise.race([this.extensionOperation(e.operationId,f),g])}finally{p!==void 0&&clearTimeout(p),h.abort()}}if(c.status!=="queued"&&c.status!=="running")return c;let d=i-Date.now();if(d<=0)throw o();await new Promise((h,f)=>{var y,w;let p=setTimeout(()=>{var v;(v=t.signal)==null||v.removeEventListener("abort",g),h()},Math.min(n,d,BR)),g=()=>{var v,b;clearTimeout(p),(v=t.signal)==null||v.removeEventListener("abort",g),f(((b=t.signal)==null?void 0:b.reason)??new DOMException("Aborted","AbortError"))};(y=t.signal)==null||y.addEventListener("abort",g,{once:!0}),(w=t.signal)!=null&&w.aborted&&g()})}}async readWorkspaceFile(e,t={},n){let s=new URL(`${this.baseUrl}/file`);return s.searchParams.set("path",e),t.maxBytes!==void 0&&s.searchParams.set("maxBytes",String(t.maxBytes)),t.line!==void 0&&s.searchParams.set("line",String(t.line)),t.limit!==void 0&&s.searchParams.set("limit",String(t.limit)),await this.fetchWithTimeout(s.toString(),{headers:this.headers({},n)},async r=>{if(!r.ok)throw await this.failOnError(r,"GET /file");return await r.json()})}async readWorkspaceFileBytes(e,t={},n){let s=new URL(`${this.baseUrl}/file/bytes`);return s.searchParams.set("path",e),t.offset!==void 0&&s.searchParams.set("offset",String(t.offset)),t.maxBytes!==void 0&&s.searchParams.set("maxBytes",String(t.maxBytes)),await this.fetchWithTimeout(s.toString(),{headers:this.headers({},n)},async r=>{if(!r.ok)throw await this.failOnError(r,"GET /file/bytes");return await r.json()})}async fileStat(e){let t=new URL(`${this.baseUrl}/stat`);return t.searchParams.set("path",e),await this.fetchWithTimeout(t.toString(),{headers:this.headers()},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /stat");return await n.json()})}async dirList(e){let t=new URL(`${this.baseUrl}/list`);return t.searchParams.set("path",e),await this.fetchWithTimeout(t.toString(),{headers:this.headers()},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /list");return await n.json()})}async glob(e){let t=new URL(`${this.baseUrl}/glob`);return t.searchParams.set("pattern",e),await this.fetchWithTimeout(t.toString(),{headers:this.headers()},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /glob");return await n.json()})}async writeWorkspaceFile(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/file/write`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify(e)},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /file/write");return await n.json()})}async editWorkspaceFile(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/file/edit`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify(e)},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /file/edit");return await n.json()})}async workspaceMemory(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/memory`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/memory");return await e.json()})}async writeWorkspaceMemory(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/memory`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify(e)},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /workspace/memory");return await n.json()})}async rememberWorkspaceMemory(e,t={}){return await this.jsonRequest(jv,`POST ${jv}`,{method:"POST",body:{content:e,contextMode:t.contextMode??"workspace"},clientId:t.clientId})}async getWorkspaceMemoryRememberTask(e,t){return await this.jsonRequest(`${jv}/${rt(e)}`,`GET ${jv}/:taskId`,{clientId:t==null?void 0:t.clientId})}async forgetWorkspaceMemory(e,t={}){return await this.jsonRequest(Lv,`POST ${Lv}`,{method:"POST",body:{query:e},clientId:t.clientId})}async getWorkspaceMemoryForgetTask(e,t){return await this.jsonRequest(`${Lv}/${rt(e)}`,`GET ${Lv}/:taskId`,{clientId:t==null?void 0:t.clientId})}async dreamWorkspaceMemory(e={}){return await this.jsonRequest(Dv,`POST ${Dv}`,{method:"POST",body:{},clientId:e.clientId})}async getWorkspaceMemoryDreamTask(e,t){return await this.jsonRequest(`${Dv}/${rt(e)}`,`GET ${Dv}/:taskId`,{clientId:t==null?void 0:t.clientId})}async listWorkspaceAgents(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/agents`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/agents");return await e.json()})}async createWorkspaceAgent(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/agents`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify(e)},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /workspace/agents");return await n.json()})}async generateWorkspaceAgent(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/agents/generate`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({description:e})},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /workspace/agents/generate");return await n.json()},hp)}async getWorkspaceAgent(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/agents/${rt(e)}`,{headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/agents/:agentType");return await t.json()})}async updateWorkspaceAgent(e,t,n={},s){let r=n.scope?`${this.baseUrl}/workspace/agents/${rt(e)}?scope=${rt(n.scope)}`:`${this.baseUrl}/workspace/agents/${rt(e)}`;return await this.fetchWithTimeout(r,{method:"POST",headers:this.headers({"Content-Type":"application/json"},s),body:JSON.stringify(t)},async i=>{if(!i.ok)throw await this.failOnError(i,"POST /workspace/agents/:agentType");return await i.json()})}async deleteWorkspaceAgent(e,t={},n){let s=t.scope?`${this.baseUrl}/workspace/agents/${rt(e)}?scope=${rt(t.scope)}`:`${this.baseUrl}/workspace/agents/${rt(e)}`;return await this.fetchWithTimeout(s,{method:"DELETE",headers:this.headers({},n)},async r=>{var i;if(r.status===204){try{await((i=r.body)==null?void 0:i.cancel())}catch{}return}if(r.status===404){let o=await this.failOnError(r,"DELETE /workspace/agents/:agentType"),a=o.body;if(a&&a.code==="agent_not_found")return;throw o}throw await this.failOnError(r,"DELETE /workspace/agents/:agentType")})}async workspaceEnv(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/env`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/env");return await e.json()})}async workspacePreflight(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/preflight`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/preflight");return await e.json()})}async workspaceTools(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/tools`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/tools");return await e.json()})}async createOrAttachSession(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({cwd:e.workspaceCwd,...e.modelServiceId?{modelServiceId:e.modelServiceId}:{},...e.sessionScope!==void 0?{sessionScope:e.sessionScope}:{},...e.approvalMode!==void 0?{approvalMode:e.approvalMode}:{}})},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /session");return await n.json()})}async listWorkspaceSessions(e,t){return(await this.listWorkspaceSessionsPage(e,t)).sessions}async listWorkspaceSessionsPage(e,t){let n=(t==null?void 0:t.pageSize)??wk,s=Math.max(1,Math.min(1e3,Math.round(Number.isFinite(n)?n:wk))),r=new URLSearchParams({size:String(s)});return(t==null?void 0:t.cursor)!==void 0&&r.set("cursor",t.cursor),(t==null?void 0:t.archiveState)!==void 0&&r.set("archiveState",t.archiveState),(t==null?void 0:t.view)!==void 0&&r.set("view",t.view),(t==null?void 0:t.group)!==void 0&&r.set("group",t.group),(t==null?void 0:t.parentSessionId)!==void 0&&r.set("parentSessionId",t.parentSessionId),await this.jsonRequest(`/workspace/${rt(e)}/sessions?${r.toString()}`,"GET /workspace/sessions")}async listSessionGroups(e){return await this.jsonRequest(`/workspace/${rt(e)}/session-groups`,"GET /workspace/session-groups")}async createSessionGroup(e,t){return(await this.jsonRequest(`/workspace/${rt(e)}/session-groups`,"POST /workspace/session-groups",{method:"POST",body:t})).group}async updateSessionGroup(e,t,n){return(await this.jsonRequest(`/workspace/${rt(e)}/session-groups/${rt(t)}`,"PATCH /workspace/session-groups/:groupId",{method:"PATCH",body:n})).group}async deleteSessionGroup(e,t){return await this.jsonRequest(`/workspace/${rt(e)}/session-groups/${rt(t)}`,"DELETE /workspace/session-groups/:groupId",{method:"DELETE"})}async updateSessionOrganization(e,t,n){return await this.jsonRequest(`/session/${rt(e)}/organization`,"PATCH /session/:id/organization",{method:"PATCH",body:t,clientId:n})}async loadSession(e,t={},n){return this.restoreSession("load",e,t,n)}async exportSession(e,t={}){return await this.sessionExportRequest(`/session/${rt(e)}/export`,"GET /session/:id/export",t)}async getSessionTranscriptPage(e,t={}){let n=new URLSearchParams;t.cursor!==void 0&&n.set("cursor",t.cursor),t.limit!==void 0&&n.set("limit",String(t.limit));let s=n.toString();return await this.jsonRequest(`/session/${rt(e)}/transcript${s?`?${s}`:""}`,"GET /session/:id/transcript",{clientId:t.clientId,mode:"rest"})}async resumeSession(e,t={},n){return this.restoreSession("resume",e,t,n)}async branchSession(e,t={},n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${rt(e)}/branch`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify({name:t.name})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/branch");return await s.json()})}async forkSession(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${rt(e)}/fork`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify({directive:t.directive})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/fork");return await s.json()})}async sessionContext(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${rt(e)}/context`,{headers:this.headers({},t)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/context");return await n.json()})}async sessionStatus(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${rt(e)}/status`,{headers:this.headers({},t)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/status");return await n.json()})}async sessionContextUsage(e,t={},n){let s=new URLSearchParams;t.detail===!0&&s.set("detail","true");let r=s.toString();return await this.fetchWithTimeout(`${this.baseUrl}/session/${rt(e)}/context-usage${r?`?${r}`:""}`,{headers:this.headers({},n)},async i=>{if(!i.ok)throw await this.failOnError(i,"GET /session/:id/context-usage");return await i.json()})}async sessionSupportedCommands(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${rt(e)}/supported-commands`,{headers:this.headers({},t)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/supported-commands");return await n.json()})}async sessionTasks(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${rt(e)}/tasks`,{headers:this.headers({},t)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/tasks");return await n.json()})}async sessionLspStatus(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${rt(e)}/lsp`,{headers:this.headers({},t)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/lsp");return await n.json()})}async sessionTaskCancel(e,t,n,s){return await this.fetchWithTimeout(`${this.baseUrl}/session/${rt(e)}/tasks/${rt(t)}/cancel`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},s),body:JSON.stringify({kind:n})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/tasks/:taskId/cancel");return await r.json()})}async sessionGoalClear(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${rt(e)}/goal/clear`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({})},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /session/:id/goal/clear");return await n.json()})}async sessionStats(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${rt(e)}/stats`,{headers:this.headers({},t)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/stats");return await n.json()})}async restoreSession(e,t,n,s){return await this.fetchWithTimeout(`${this.baseUrl}/session/${rt(t)}/${e}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},s),body:JSON.stringify({cwd:n.workspaceCwd,...n.approvalMode!==void 0?{approvalMode:n.approvalMode}:{}})},async r=>{if(!r.ok)throw await this.failOnError(r,`POST /session/:id/${e}`);return await r.json()})}async setSessionApprovalMode(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${rt(e)}/approval-mode`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({mode:t,...(n==null?void 0:n.persist)===!0?{persist:!0}:{}})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/approval-mode");return await s.json()})}async getRewindSnapshots(e){return await this.fetchWithTimeout(`${this.baseUrl}/session/${rt(e)}/rewind/snapshots`,{method:"GET",headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /session/:id/rewind/snapshots");return await t.json()},void 0,"rest")}async rewindSession(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${rt(e)}/rewind`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({promptId:t,...(n==null?void 0:n.rewindFiles)!==void 0?{rewindFiles:n.rewindFiles}:{}})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/rewind");return await s.json()},void 0,"rest")}async recapSession(e,t){let n=await this.transport.fetch(`${this.baseUrl}/session/${rt(e)}/recap`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t==null?void 0:t.clientId),body:"{}",signal:t==null?void 0:t.signal});if(!n.ok)throw await this.failOnError(n,"POST /session/:id/recap");return await n.json()}async btwSession(e,t,n){let s=await this.transport.fetch(`${this.baseUrl}/session/${rt(e)}/btw`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({question:t}),signal:n==null?void 0:n.signal});if(!s.ok)throw await this.failOnError(s,"POST /session/:id/btw");return await s.json()}async enqueueMidTurnMessage(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${rt(e)}/mid-turn-message`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({message:t}),signal:n==null?void 0:n.signal},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/mid-turn-message");return await s.json()})}async getPendingPrompts(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${rt(e)}/pending-prompts`,{method:"GET",headers:this.headers({},t==null?void 0:t.clientId)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/pending-prompts");return await n.json()})}async removePendingPrompt(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${rt(e)}/pending-prompts/${rt(t)}`,{method:"DELETE",headers:this.headers({},n==null?void 0:n.clientId)},async s=>{if(!s.ok)throw await this.failOnError(s,"DELETE /session/:id/pending-prompts/:promptId");return await s.json()})}async shellCommand(e,t,n){let s=await this.transport.fetch(`${this.baseUrl}/session/${rt(e)}/shell`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({command:t}),signal:n==null?void 0:n.signal});if(!s.ok)throw await this.failOnError(s,"POST /session/:id/shell");return await s.json()}async setWorkspaceToolEnabled(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/tools/${rt(e)}/enable`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({enabled:t})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /workspace/tools/:name/enable");return await s.json()})}async setWorkspaceSkillEnabled(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/skills/${rt(e)}/enable`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({enabled:t})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /workspace/skills/:name/enable");return await s.json()})}async workspaceSettings(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/settings`,{method:"GET",headers:this.headers({},e==null?void 0:e.clientId)},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/settings");return await t.json()})}async setWorkspaceSetting(e,t,n,s){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/settings`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},s==null?void 0:s.clientId),body:JSON.stringify({scope:e,key:t,value:n})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /workspace/settings");return await r.json()})}async deleteModel(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/models`,{method:"DELETE",headers:this.headers({"Content-Type":"application/json"},t==null?void 0:t.clientId),body:JSON.stringify(e)},async n=>{if(!n.ok)throw await this.failOnError(n,"DELETE /workspace/models");return await n.json()})}async workspaceVoice(e){return await this.jsonRequest("/workspace/voice","GET /workspace/voice",{clientId:e})}async setWorkspaceVoice(e,t){return await this.jsonRequest("/workspace/voice","POST /workspace/voice",{method:"POST",body:e,clientId:t})}async transcribeWorkspaceVoice(e,t){return await this.voiceTranscriptionRequest("/workspace/voice/transcribe","POST /workspace/voice/transcribe",e,t)}async workspaceVoiceTranscriptionRequest(e,t,n){return await this.voiceTranscriptionRequest(`/workspaces/${e}/voice/transcribe`,"POST /workspaces/:workspace/voice/transcribe",t,n)}async voiceTranscriptionRequest(e,t,n,s){let r=s.voiceModel?`?${new URLSearchParams({voiceModel:s.voiceModel}).toString()}`:"";return await this.fetchWithTimeout(`${this.baseUrl}${e}${r}`,{method:"POST",headers:this.headers({"Content-Type":s.mimeType},s.clientId),body:n},async i=>{if(!i.ok)throw await this.failOnError(i,t);return await i.json()},s.timeoutMs??Voe,"rest")}async workspaceTrust(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/trust`,{method:"GET",headers:this.headers({},e==null?void 0:e.clientId)},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/trust");return await t.json()})}async requestWorkspaceTrustChange(e,t){return await this.jsonRequest("/workspace/trust/request","POST /workspace/trust/request",{method:"POST",body:e,clientId:t})}async workspacePermissions(e){return await this.jsonRequest("/workspace/permissions","GET /workspace/permissions",{clientId:e==null?void 0:e.clientId})}async setWorkspacePermissionRules(e,t,n,s){return await this.jsonRequest("/workspace/permissions","POST /workspace/permissions",{method:"POST",body:{scope:e,ruleType:t,rules:[...n]},clientId:s==null?void 0:s.clientId})}async addWorkspacePermissionRule(e,t,n,s){let r=$R(n),i=await this.workspacePermissions(s),o=i[e].rules[t];return o.includes(r)?i:await this.setWorkspacePermissionRules(e,t,[...o,r],s)}async removeWorkspacePermissionRule(e,t,n,s){let r=$R(n),i=await this.workspacePermissions(s),o=i[e].rules[t];return o.includes(r)?await this.setWorkspacePermissionRules(e,t,o.filter(a=>a!==r),s):i}async restartMcpServer(e,t){let n=(t==null?void 0:t.entryIndex)===void 0?"":`?entryIndex=${rt(String(t.entryIndex))}`;return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${rt(e)}/restart${n}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t==null?void 0:t.clientId),body:"{}"},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /workspace/mcp/:server/restart");return await s.json()},(t==null?void 0:t.timeoutMs)??hp)}async reload(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/reload`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},e==null?void 0:e.clientId),body:"{}"},async t=>{if(!t.ok)throw await this.failOnError(t,"POST /workspace/reload");return await t.json()},e==null?void 0:e.timeoutMs)}async reloadChannelWorker(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/channel/reload`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},e==null?void 0:e.clientId),body:"{}"},async t=>{if(!t.ok)throw await this.failOnError(t,"POST /workspace/channel/reload");return await t.json()},(e==null?void 0:e.timeoutMs)??213e4)}async getChannelWorkerControl(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/channel`,{method:"GET",headers:this.headers({},e==null?void 0:e.clientId)},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/channel");return await t.json()},e==null?void 0:e.timeoutMs)}async setChannelWorkerSelection(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/channel`,{method:"PUT",headers:this.headers({"Content-Type":"application/json"},t==null?void 0:t.clientId),body:JSON.stringify({selection:e})},async n=>{if(!n.ok)throw await this.failOnError(n,"PUT /workspace/channel");return await n.json()},(t==null?void 0:t.timeoutMs)??213e4)}async stopChannelWorker(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/channel`,{method:"DELETE",headers:this.headers({},e==null?void 0:e.clientId)},async t=>{if(!t.ok)throw await this.failOnError(t,"DELETE /workspace/channel");return await t.json()},(e==null?void 0:e.timeoutMs)??213e4)}async manageMcpServer(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${rt(e)}/${rt(t)}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:"{}"},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /workspace/mcp/:server/:action");return await s.json()},(n==null?void 0:n.timeoutMs)??hp)}async addRuntimeMcpServer(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/servers`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t==null?void 0:t.clientId),body:JSON.stringify(e)},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /workspace/mcp/servers");return await n.json()},(t==null?void 0:t.timeoutMs)??hp)}async removeRuntimeMcpServer(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/servers/${rt(e)}`,{method:"DELETE",headers:this.headers({},t==null?void 0:t.clientId)},async n=>{if(!n.ok)throw await this.failOnError(n,"DELETE /workspace/mcp/servers/:name");return await n.json()},(t==null?void 0:t.timeoutMs)??hp)}async initWorkspace(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/init`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},e==null?void 0:e.clientId),body:JSON.stringify((e==null?void 0:e.force)===!0?{force:!0}:{})},async t=>{if(!t.ok)throw await this.failOnError(t,"POST /workspace/init");return await t.json()})}async setupGithub(e,t){return await this.jsonRequest("/workspace/setup-github","POST /workspace/setup-github",{method:"POST",body:e,clientId:t,timeoutMs:Woe})}async setSessionModel(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${rt(e)}/model`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify({modelId:t})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/model");return await s.json()})}async setSessionLanguage(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${rt(e)}/language`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({language:t,syncOutputLanguage:(n==null?void 0:n.syncOutputLanguage)??!1})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/language");return await s.json()})}async prompt(e,t,n,s){n==null||n.throwIfAborted();let r=this.reservePromptSlot(e),i=!0;try{let o=await this.transport.fetch(`${this.baseUrl}/session/${rt(e)}/prompt`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},s),body:JSON.stringify(t),signal:n});if(o.status===202){let a=await o.json();i=!1;try{return await this._awaitTurnComplete(e,a.promptId,a.lastEventId,n,s)}finally{r()}}if(!o.ok)throw await this.failOnError(o,"POST /session/:id/prompt",e);return await o.json()}finally{i&&r()}}async promptNonBlocking(e,t,n,s){let r=await this.transport.fetch(`${this.baseUrl}/session/${rt(e)}/prompt`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},s),body:JSON.stringify(t),signal:n});if(r.status===202)return await r.json();if(!r.ok)throw await this.failOnError(r,"POST /session/:id/prompt",e);return await r.json()}async _awaitTurnComplete(e,t,n,s,r){let i=new AbortController,o=s?a3([s,i.signal]):i.signal;try{let a=this.subscribeEvents(e,{lastEventId:n,signal:o});for await(let l of a){let c=CE(l,t);if(c!==void 0)return c}throw new Error("SSE stream ended")}catch(a){throw s!=null&&s.aborted&&a instanceof DOMException&&a.name==="AbortError"&&this.cancel(e,r).catch(()=>{}),a}finally{i.signal.aborted||i.abort()}}async heartbeat(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${rt(e)}/heartbeat`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:"{}"},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /session/:id/heartbeat");return await n.json()})}async cancel(e,t){await this.fetchWithTimeout(`${this.baseUrl}/session/${rt(e)}/cancel`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:"{}"},async n=>{var s;if(!n.ok&&n.status!==204)throw await this.failOnError(n,"POST /session/:id/cancel");try{await((s=n.body)==null?void 0:s.cancel())}catch{}})}async*subscribeEvents(e,t={}){yield*this.transport.subscribeEvents(e,{lastEventId:t.lastEventId,maxQueued:t.maxQueued,signal:t.signal,connectTimeoutMs:this.fetchTimeoutMs||void 0})}async respondToPermission(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/permission/${rt(e)}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify(t)},async s=>{var r,i;if(s.status===200){try{await((r=s.body)==null?void 0:r.cancel())}catch{}return!0}if(s.status===404){try{await((i=s.body)==null?void 0:i.cancel())}catch{}return!1}throw await this.failOnError(s,"POST /permission/:requestId")})}async respondToSessionPermission(e,t,n,s){return await this.fetchWithTimeout(`${this.baseUrl}/session/${rt(e)}/permission/${rt(t)}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},s),body:JSON.stringify(n)},async r=>{var i,o;if(r.status===200){try{await((i=r.body)==null?void 0:i.cancel())}catch{}return!0}if(r.status===404){try{await((o=r.body)==null?void 0:o.cancel())}catch{}return!1}throw await this.failOnError(r,"POST /session/:id/permission/:requestId")})}async closeSession(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${rt(e)}`,{method:"DELETE",headers:this.headers({},t)},async n=>{var s;if(n.status===204||n.status===404){try{await((s=n.body)==null?void 0:s.cancel())}catch{}return}throw await this.failOnError(n,"DELETE /session/:id")})}async detachSession(e,t){if(t)return await this.fetchWithTimeout(`${this.baseUrl}/session/${rt(e)}/detach`,{method:"POST",headers:this.headers({},t)},async n=>{var s;if(n.status===204||n.status===404){try{await((s=n.body)==null?void 0:s.cancel())}catch{}return}throw await this.failOnError(n,"POST /session/:id/detach")})}async deleteSessionsData(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/sessions/delete`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({sessionIds:e})},async n=>{if(n.ok)return await n.json();throw await this.failOnError(n,"POST /sessions/delete")})}async archiveSessionsData(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/sessions/archive`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({sessionIds:e})},async n=>{if(n.ok)return await n.json();throw await this.failOnError(n,"POST /sessions/archive")})}async unarchiveSessionsData(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/sessions/unarchive`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({sessionIds:e})},async n=>{if(n.ok)return await n.json();throw await this.failOnError(n,"POST /sessions/unarchive")})}async startDeviceFlow(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/device-flow`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},e.clientId),body:JSON.stringify({providerId:e.providerId})},async t=>{if(t.status!==200&&t.status!==201)throw await this.failOnError(t,"POST /workspace/auth/device-flow");return await t.json()})}async getDeviceFlow(e,t={}){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/device-flow/${rt(e)}`,{headers:this.headers({},t.clientId),signal:t.signal},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /workspace/auth/device-flow/:id");return await n.json()})}async cancelDeviceFlow(e,t={}){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/device-flow/${rt(e)}`,{method:"DELETE",headers:this.headers({},t.clientId)},async n=>{var s;if(n.status===204||n.status===404){try{await((s=n.body)==null?void 0:s.cancel())}catch{}return}throw await this.failOnError(n,"DELETE /workspace/auth/device-flow/:id")})}async getAuthStatus(e={}){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/status`,{headers:this.headers({},e.clientId)},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/auth/status");return await t.json()})}async getAuthProviders(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/providers`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/auth/providers");return await e.json()})}async installAuthProvider(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/provider`,{method:"POST",headers:this.headers({"Content-Type":"application/json"}),body:JSON.stringify(e)},async t=>{if(!t.ok)throw await this.failOnError(t,"POST /workspace/auth/provider");return await t.json()})}async addWorkspace(e,t={}){return await this.fetchWithTimeout(`${this.baseUrl}/workspaces`,{method:"POST",headers:this.headers({"Content-Type":"application/json"}),body:JSON.stringify({cwd:e,...t.persist?{persist:!0}:{}})},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /workspaces");return await n.json()})}dispose(){this.transport.dispose()}async listSessionArtifacts(e,t){return await this.jsonRequest(`/session/${rt(e)}/artifacts`,"GET /session/:id/artifacts",{clientId:t})}async addSessionArtifact(e,t,n){return await this.jsonRequest(`/session/${rt(e)}/artifacts`,"POST /session/:id/artifacts",{method:"POST",body:t,clientId:n})}async removeSessionArtifact(e,t,n){return await this.jsonRequest(`/session/${rt(e)}/artifacts/${rt(t)}`,"DELETE /session/:id/artifacts/:artifactId",{method:"DELETE",clientId:n})}async updateSessionMetadata(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${rt(e)}/metadata`,{method:"PATCH",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify(t)},async s=>{if(s.status===200){let r=await s.json();return typeof r.displayName=="string"?{displayName:r.displayName}:{}}throw await this.failOnError(s,"PATCH /session/:id/metadata")})}},FR=class{constructor(e,t){this.client=e,this.workspaceSelector=t}workspaceMcp(){return this.get("/mcp","GET /workspaces/:workspace/mcp")}workspaceVoice(e){return this.client.workspaceJsonRequest(this.workspaceSelector,"/voice","GET /workspaces/:workspace/voice",{clientId:e,mode:"rest"})}setWorkspaceVoice(e,t){return this.client.workspaceJsonRequest(this.workspaceSelector,"/voice","POST /workspaces/:workspace/voice",{method:"POST",body:e,clientId:t,mode:"rest"})}transcribeWorkspaceVoice(e,t){return this.client.workspaceVoiceTranscriptionRequest(this.workspaceSelector,e,t)}workspaceGit(){return this.client.workspaceJsonRequest(this.workspaceSelector,"/git","GET /workspaces/:workspace/git",{mode:"rest"})}workspaceSkills(){return this.get("/skills","GET /workspaces/:workspace/skills")}workspaceProviders(){return this.get("/providers","GET /workspaces/:workspace/providers")}workspaceHooks(){return this.get("/hooks","GET /workspaces/:workspace/hooks")}workspaceEnv(){return this.get("/env","GET /workspaces/:workspace/env")}workspacePreflight(){return this.get("/preflight","GET /workspaces/:workspace/preflight")}workspaceTools(){return this.get("/tools","GET /workspaces/:workspace/tools")}workspaceMemory(){return this.get("/memory","GET /workspaces/:workspace/memory")}remove(e){let t=(e==null?void 0:e.force)===void 0?void 0:{force:e.force};return this.client.workspaceJsonRequest(this.workspaceSelector,"","DELETE /workspaces/:workspace",{method:"DELETE",...t?{body:t}:{},...(e==null?void 0:e.timeoutMs)!==void 0?{timeoutMs:e.timeoutMs}:{},mode:"rest"})}writeWorkspaceMemory(e,t){return this.post("/memory","POST /workspaces/:workspace/memory",{...e,scope:"workspace"},t)}listWorkspaceAgents(){return this.get("/agents","GET /workspaces/:workspace/agents")}createWorkspaceAgent(e,t){return this.post("/agents","POST /workspaces/:workspace/agents",{...e,scope:e.scope??"workspace"},t)}getWorkspaceAgent(e){return this.get(`/agents/${rt(e)}`,"GET /workspaces/:workspace/agents/:agentType")}updateWorkspaceAgent(e,t,n={}){let s=n.scope?`?scope=${rt(n.scope)}`:"";return this.post(`/agents/${rt(e)}${s}`,"POST /workspaces/:workspace/agents/:agentType",t,n.clientId)}async deleteWorkspaceAgent(e,t={}){let n=t.scope?`?scope=${rt(t.scope)}`:"";return await this.client.workspaceNoContentRequest(this.workspaceSelector,`/agents/${rt(e)}${n}`,"DELETE /workspaces/:workspace/agents/:agentType",{method:"DELETE",clientId:t.clientId,okNotFoundCode:"agent_not_found"})}listWorkspaceSessionsPage(e){let t=(e==null?void 0:e.pageSize)??wk,n=Math.max(1,Math.min(1e3,Math.round(Number.isFinite(t)?t:wk))),s=new URLSearchParams({size:String(n)});return(e==null?void 0:e.cursor)!==void 0&&s.set("cursor",e.cursor),(e==null?void 0:e.archiveState)!==void 0&&s.set("archiveState",e.archiveState),(e==null?void 0:e.view)!==void 0&&s.set("view",e.view),(e==null?void 0:e.group)!==void 0&&s.set("group",e.group),(e==null?void 0:e.parentSessionId)!==void 0&&s.set("parentSessionId",e.parentSessionId),this.get(`/sessions?${s.toString()}`,"GET /workspaces/:workspace/sessions")}async listWorkspaceSessions(e){return(await this.listWorkspaceSessionsPage(e)).sessions}getSessionTranscriptPage(e,t={}){let n=new URLSearchParams;t.cursor!==void 0&&n.set("cursor",t.cursor),t.limit!==void 0&&n.set("limit",String(t.limit));let s=n.size>0?`?${n.toString()}`:"";return this.client.workspaceJsonRequest(this.workspaceSelector,`/session/${rt(e)}/transcript${s}`,"GET /workspaces/:workspace/session/:id/transcript",{clientId:t.clientId,mode:"rest"})}exportSession(e,t={}){return this.client.sessionExportRequest(`/workspaces/${this.workspaceSelector}/session/${rt(e)}/export`,"GET /workspaces/:workspace/session/:id/export",t)}listSessionGroups(){return this.get("/session-groups","GET /workspaces/:workspace/session-groups")}async createSessionGroup(e){return(await this.post("/session-groups","POST /workspaces/:workspace/session-groups",e)).group}async updateSessionGroup(e,t){return(await this.client.workspaceJsonRequest(this.workspaceSelector,`/session-groups/${rt(e)}`,"PATCH /workspaces/:workspace/session-groups/:groupId",{method:"PATCH",body:t})).group}deleteSessionGroup(e){return this.client.workspaceJsonRequest(this.workspaceSelector,`/session-groups/${rt(e)}`,"DELETE /workspaces/:workspace/session-groups/:groupId",{method:"DELETE"})}updateSessionOrganization(e,t,n){return this.client.workspaceJsonRequest(this.workspaceSelector,`/session/${rt(e)}/organization`,"PATCH /workspaces/:workspace/session/:id/organization",{method:"PATCH",body:t,clientId:n})}deleteSessionsData(e,t){return this.post("/sessions/delete","POST /workspaces/:workspace/sessions/delete",{sessionIds:e},t)}archiveSessionsData(e,t){return this.post("/sessions/archive","POST /workspaces/:workspace/sessions/archive",{sessionIds:e},t)}unarchiveSessionsData(e,t){return this.post("/sessions/unarchive","POST /workspaces/:workspace/sessions/unarchive",{sessionIds:e},t)}readWorkspaceFile(e,t={},n){let s=new URLSearchParams({path:e});return t.maxBytes!==void 0&&s.set("maxBytes",String(t.maxBytes)),t.line!==void 0&&s.set("line",String(t.line)),t.limit!==void 0&&s.set("limit",String(t.limit)),this.get(`/file?${s.toString()}`,"GET /workspaces/:workspace/file",n)}readWorkspaceFileBytes(e,t={},n){let s=new URLSearchParams({path:e});return t.offset!==void 0&&s.set("offset",String(t.offset)),t.maxBytes!==void 0&&s.set("maxBytes",String(t.maxBytes)),this.get(`/file/bytes?${s.toString()}`,"GET /workspaces/:workspace/file/bytes",n)}fileStat(e){let t=new URLSearchParams({path:e});return this.get(`/stat?${t.toString()}`,"GET /workspaces/:workspace/stat")}dirList(e){let t=new URLSearchParams({path:e});return this.get(`/list?${t.toString()}`,"GET /workspaces/:workspace/list")}glob(e){let t=new URLSearchParams({pattern:e});return this.get(`/glob?${t.toString()}`,"GET /workspaces/:workspace/glob")}writeWorkspaceFile(e,t){return this.post("/file/write","POST /workspaces/:workspace/file/write",e,t)}editWorkspaceFile(e,t){return this.post("/file/edit","POST /workspaces/:workspace/file/edit",e,t)}workspaceSettings(e){return this.get("/settings","GET /workspaces/:workspace/settings",e==null?void 0:e.clientId)}setWorkspaceSetting(e,t,n,s){return this.post("/settings","POST /workspaces/:workspace/settings",{scope:e,key:t,value:n},s==null?void 0:s.clientId)}workspaceTrust(e){return this.get("/trust","GET /workspaces/:workspace/trust",e==null?void 0:e.clientId)}requestWorkspaceTrustChange(e,t){return this.post("/trust/request","POST /workspaces/:workspace/trust/request",e,t)}workspacePermissions(e){return this.get("/permissions","GET /workspaces/:workspace/permissions",e==null?void 0:e.clientId)}setWorkspacePermissionRules(e,t,n){return this.post("/permissions","POST /workspaces/:workspace/permissions",{scope:"workspace",ruleType:e,rules:[...t]},n==null?void 0:n.clientId)}setWorkspaceToolEnabled(e,t,n){return this.post(`/tools/${rt(e)}/enable`,"POST /workspaces/:workspace/tools/:name/enable",{enabled:t},n==null?void 0:n.clientId)}setWorkspaceSkillEnabled(e,t,n){return this.post(`/skills/${rt(e)}/enable`,"POST /workspaces/:workspace/skills/:name/enable",{enabled:t},n==null?void 0:n.clientId)}restartMcpServer(e,t){let n=(t==null?void 0:t.entryIndex)===void 0?"":`?entryIndex=${rt(String(t.entryIndex))}`;return this.post(`/mcp/${rt(e)}/restart${n}`,"POST /workspaces/:workspace/mcp/:server/restart",{},t==null?void 0:t.clientId,(t==null?void 0:t.timeoutMs)??hp)}reload(e){return this.post("/reload","POST /workspaces/:workspace/reload",{},e==null?void 0:e.clientId,e==null?void 0:e.timeoutMs)}initWorkspace(e){return this.post("/init","POST /workspaces/:workspace/init",(e==null?void 0:e.force)===!0?{force:!0}:{},e==null?void 0:e.clientId)}workspaceExtensions(){return this.client.workspaceJsonRequest(this.workspaceSelector,"/extensions","GET /workspaces/:workspace/extensions",{mode:"rest"})}setExtensionActivation(e,t,n){return this.client.workspaceJsonRequest(this.workspaceSelector,`/extensions/${rt(e)}/activation`,"PUT /workspaces/:workspace/extensions/:extensionId/activation",{method:"PUT",body:{state:t},clientId:n,mode:"rest"})}clearExtensionActivation(e,t){return this.client.workspaceJsonRequest(this.workspaceSelector,`/extensions/${rt(e)}/activation`,"DELETE /workspaces/:workspace/extensions/:extensionId/activation",{method:"DELETE",clientId:t,mode:"rest"})}refreshExtensionRuntime(e){return this.client.workspaceJsonRequest(this.workspaceSelector,"/extensions/refresh","POST /workspaces/:workspace/extensions/refresh",{method:"POST",body:{},clientId:e,mode:"rest"})}get(e,t,n){return this.client.workspaceJsonRequest(this.workspaceSelector,e,t,{clientId:n})}post(e,t,n,s,r){return this.client.workspaceJsonRequest(this.workspaceSelector,e,t,{method:"POST",body:n,clientId:s,timeoutMs:r})}};function a3(e){let t=AbortSignal.any;if(typeof t=="function")return t.call(AbortSignal,e);let n=new AbortController,s=[],r=()=>{for(;s.length>0;){let i=s.pop();try{i==null||i()}catch{}}};for(let i of e){if(i.aborted)return n.abort(i.reason),r(),n.signal;let o=()=>{n.abort(i.reason),r()};i.addEventListener("abort",o,{once:!0}),s.push(()=>i.removeEventListener("abort",o))}return n.signal.addEventListener("abort",r,{once:!0}),n.signal}function CE(e,t){if(e.type==="turn_complete"){let n=e.data;if(n.promptId===t)return{stopReason:n.stopReason??"end_turn"}}if(e.type==="turn_error"){let n=e.data;if(n.promptId===t)throw Object.assign(new $u(500,n.code??"turn_error",n.message??"Prompt failed"),{_daemonTurnError:!0})}}function qR(e){return"promptId"in e&&"lastEventId"in e}var jg=class fx{constructor(t){Me(this,"client");Me(this,"session");Me(this,"state");Me(this,"replaySnapshot");Me(this,"hasActivePrompt");Me(this,"lastSeenEventId");Me(this,"subscriptionActive",!1);Me(this,"reattaching");Me(this,"promptLimit");Me(this,"_pendingPrompts",new Map);this.client=t.client,this.session={...t.session},this.state={...t.state??{}},this.hasActivePrompt=t.hasActivePrompt??!1,this.replaySnapshot=t.replaySnapshot??{compactedReplay:[],liveJournal:[]},this.lastSeenEventId=Ov(t.lastEventId),this.promptLimit=t.maxPendingPromptsPerSession===void 0?t.client.maxPendingPromptsPerSession:BH(t.maxPendingPromptsPerSession)}static async createOrAttach(t,n={},s){let r=await t.createOrAttachSession(n,s),i=!r.attached||n.modelServiceId||n.approvalMode?0:void 0;return new fx({client:t,session:r,hasActivePrompt:r.hasActivePrompt,lastEventId:i})}static async load(t,n,s={},r){let{state:i,hasActivePrompt:o,compactedReplay:a,liveJournal:l,lastEventId:c,...d}=await t.loadSession(n,s,r);return new fx({client:t,session:d,hasActivePrompt:o,state:i,lastEventId:c??0,replaySnapshot:{compactedReplay:a??[],liveJournal:l??[]}})}static async resume(t,n,s={},r){let{state:i,hasActivePrompt:o,lastEventId:a,...l}=await t.resumeSession(n,s,r);return new fx({client:t,session:l,hasActivePrompt:o,state:i,lastEventId:a??0})}get sessionId(){return this.session.sessionId}get workspaceCwd(){return this.session.workspaceCwd}get attached(){return this.session.attached}get clientId(){return this.session.clientId}get lastEventId(){return this.lastSeenEventId}setLastEventId(t){this.lastSeenEventId=Ov(t)}async prompt(t,n){if(n==null||n.throwIfAborted(),!this.subscriptionActive)return await this.withClientIdSelfHeal(()=>this.client.prompt(this.sessionId,t,n,this.clientId));let s=this.client.reservePromptSlot(this.sessionId,this.promptLimit),r;try{if(r=await this.withClientIdSelfHeal(()=>this.client.promptNonBlocking(this.sessionId,t,n,this.clientId)),!qR(r))return s(),r;if(!this.subscriptionActive)throw Error("SSE stream ended")}catch(i){throw s(),i}return new Promise((i,o)=>{let a=()=>{let c=this._pendingPrompts.get(r.promptId);c&&this._pendingPrompts.delete(r.promptId)&&(this.client.cancel(this.sessionId,this.clientId).catch(()=>{}),c.reject(n.reason??new DOMException("Aborted","AbortError")))},l=()=>n==null?void 0:n.removeEventListener("abort",a);this._pendingPrompts.set(r.promptId,{resolve:c=>{l(),s(),i(c)},reject:c=>{l(),s(),o(c)}}),n!=null&&n.aborted?a():n==null||n.addEventListener("abort",a,{once:!0})})}async submitPrompt(t,n){n==null||n.throwIfAborted();let s=await this.withClientIdSelfHeal(()=>this.client.promptNonBlocking(this.sessionId,t,n,this.clientId));if(!qR(s))throw new Error("Expected non-blocking prompt acceptance");return s}async withClientIdSelfHeal(t){try{return await t()}catch(n){if(!Qoe(n))throw n;return await this.reattach(),await t()}}async reattach(){if(this.reattaching)return this.reattaching;this.reattaching=this.client.resumeSession(this.sessionId,{workspaceCwd:this.workspaceCwd}).then(t=>{this.session.clientId=t.clientId});try{await this.reattaching}finally{this.reattaching=void 0}}async cancel(){await this.client.cancel(this.sessionId,this.clientId)}async heartbeat(){return await this.client.heartbeat(this.sessionId,this.clientId)}async artifacts(){return await this.client.listSessionArtifacts(this.sessionId,this.clientId)}async addArtifact(t){return await this.client.addSessionArtifact(this.sessionId,t,this.clientId)}async removeArtifact(t){return await this.client.removeSessionArtifact(this.sessionId,t,this.clientId)}async setModel(t){return await this.client.setSessionModel(this.sessionId,t,this.clientId)}async getRewindSnapshots(){return await this.client.getRewindSnapshots(this.sessionId)}async rewind(t,n){return await this.client.rewindSession(this.sessionId,t,{clientId:this.clientId,...(n==null?void 0:n.rewindFiles)!==void 0?{rewindFiles:n.rewindFiles}:{}})}async fork(t){return await this.client.forkSession(this.sessionId,{directive:t},this.clientId)}async recap(t){return await this.client.recapSession(this.sessionId,{...t!=null&&t.signal?{signal:t.signal}:{},...this.clientId?{clientId:this.clientId}:{}})}async btw(t,n){return await this.client.btwSession(this.sessionId,t,{...n!=null&&n.signal?{signal:n.signal}:{},...this.clientId?{clientId:this.clientId}:{}})}async enqueueMidTurnMessage(t,n){return await this.client.enqueueMidTurnMessage(this.sessionId,t,{...n!=null&&n.signal?{signal:n.signal}:{},...this.clientId?{clientId:this.clientId}:{}})}async getPendingPrompts(){return await this.client.getPendingPrompts(this.sessionId,{...this.clientId?{clientId:this.clientId}:{}})}async removePendingPrompt(t){return await this.client.removePendingPrompt(this.sessionId,t,{...this.clientId?{clientId:this.clientId}:{}})}async shellCommand(t,n){return await this.client.shellCommand(this.sessionId,t,{...n?{signal:n}:{},...this.clientId?{clientId:this.clientId}:{}})}async context(){return await this.client.sessionContext(this.sessionId,this.clientId)}async status(){return await this.client.sessionStatus(this.sessionId,this.clientId)}async contextUsage(t={}){return await this.client.sessionContextUsage(this.sessionId,t,this.clientId)}async supportedCommands(){return await this.client.sessionSupportedCommands(this.sessionId,this.clientId)}async tasks(){return await this.client.sessionTasks(this.sessionId,this.clientId)}async lspStatus(){return await this.client.sessionLspStatus(this.sessionId,this.clientId)}async cancelTask(t,n){return await this.client.sessionTaskCancel(this.sessionId,t,n,this.clientId)}async clearGoal(){return await this.client.sessionGoalClear(this.sessionId,this.clientId)}async stats(){return await this.client.sessionStats(this.sessionId,this.clientId)}async respondToPermission(t,n){return await this.client.respondToPermission(t,n,this.clientId)}async respondToSessionPermission(t,n){return await this.client.respondToSessionPermission(this.sessionId,t,n,this.clientId)}async close(){return await this.client.closeSession(this.sessionId,this.clientId)}async detach(){return await this.client.detachSession(this.sessionId,this.clientId)}async updateMetadata(t){return await this.client.updateSessionMetadata(this.sessionId,t,this.clientId)}events(t={}){return this.openEventSubscription(t)}subscribeEvents(t={}){return this.openEventSubscription(t)}openEventSubscription(t){let n=Ov(t.lastEventId),s=!1,r=!1,i=()=>{r||(r=!0,this.subscriptionActive=!1)},o=()=>{if(!s){if(this.subscriptionActive)throw new Error("subscription active");this.subscriptionActive=!0,s=!0}},a=this.iterateEvents({...t,lastEventId:n},i);return{next:async l=>(r||o(),await a.next(l)),return:async()=>{try{return await a.return(void 0)}finally{i()}},throw:async l=>{try{return await a.throw(l)}finally{i()}},[Symbol.asyncIterator](){return this}}}async*iterateEvents(t,n){try{let{resume:s=!0,...r}=t,i=r.lastEventId??(s?this.lastSeenEventId:void 0);for await(let o of this.client.subscribeEvents(this.sessionId,{...r,lastEventId:i}))this._dispatchTurnEvent(o),yield o,o.id!==void 0&&(this.lastSeenEventId=Math.max(this.lastSeenEventId??0,Ov(o.id)))}finally{this._rejectAllPending(new Error("SSE stream ended")),n()}}_dispatchTurnEvent(t){var r;if(t.type!=="turn_complete"&&t.type!=="turn_error")return;let n=(r=t.data)==null?void 0:r.promptId;if(!n)return;let s=this._pendingPrompts.get(n);if(s){this._pendingPrompts.delete(n);try{let i=CE(t,n);i!==void 0&&s.resolve(i)}catch(i){s.reject(i)}}}_rejectAllPending(t){for(let[,n]of this._pendingPrompts)n.reject(t);this._pendingPrompts.clear()}};function Ov(e){if(e!==void 0){if(!Number.isInteger(e)||e<0)throw new TypeError("invalid lastEventId");return e}}function Qoe(e){return e instanceof $u&&e.status===400&&typeof e.body=="object"&&e.body!==null&&e.body.code==="invalid_client_id"}var zH="mid_turn_message_injected",TE="pending_prompt_added",EE="pending_prompt_started",AE="pending_prompt_completed",Joe=["session_update","permission_request","permission_resolved","permission_already_resolved","model_switched","model_switch_failed","session_died","session_closed","session_metadata_updated","session_recording_degraded","artifact_changed",zH,TE,EE,AE,"client_evicted","slow_client_warning","stream_error","state_resync_required","history_truncated","mcp_budget_warning","mcp_child_refused_batch","memory_changed","agent_changed","auth_device_flow_started","auth_device_flow_throttled","auth_device_flow_authorized","auth_device_flow_failed","auth_device_flow_cancelled","approval_mode_changed","tool_toggled","settings_changed","trust_change_requested","workspace_initialized","github_setup_completed","mcp_server_restarted","mcp_server_restart_refused","settings_reloaded","mcp_server_added","mcp_server_removed","extensions_changed","permission_partial_vote","permission_forbidden","prompt_cancelled","replay_complete","followup_suggestion","user_shell_command","user_shell_result","turn_complete","turn_error","session_rewound","session_branched","session_snapshot","git_branch_changed"];new Set(Joe);var Zoe=["missing_binary","blocked_egress","auth_env_error","init_timeout","protocol_error","missing_file","parse_error","budget_exhausted","mcp_budget_would_exceed","mcp_server_spawn_failed","invalid_config","prompt_deadline_exceeded","writer_idle_timeout","model_stream_interrupted"],f_=["plan","default","auto-edit","auto","yolo"],z6="daemon-plan";function Kt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function We(e,t){if(!Kt(e))return;let n=e[t];return typeof n=="string"?n:void 0}function Os(e,t){if(Kt(e))for(let n of t){let s=e[n];if(typeof s=="string"&&s.trim().length>0)return s}}function ph(e){if(e===void 0)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)??String(e)}catch{return String(e)}}function zu(e){return ph(wu(e))}function wu(e,t=0){return t>16?"[truncated]":Array.isArray(e)?e.map(n=>wu(n,t+1)):Kt(e)?Object.fromEntries(Object.entries(e).map(([n,s])=>[n,FH(n)?"[redacted]":wu(s,t+1)])):e}function FH(e){let t=e.toLowerCase().replace(/[^a-z0-9]/g,"");return t==="authorization"||t==="auth"||t==="cookie"||t==="setcookie"||t==="credential"||t==="credentials"||t==="passphrase"||t==="xauthkey"||t.endsWith("password")||t.endsWith("token")||t.endsWith("secret")||t.endsWith("secretkey")||t.endsWith("accesskey")||t.endsWith("apikey")||t.endsWith("privatekey")||t.includes("accesstoken")||t.includes("refreshtoken")||t.includes("bearertoken")||t.includes("personalaccesstoken")}function l3(e){if(typeof e=="string")return e;if(!Kt(e))return"";let t=e.text;return typeof t=="string"?t:""}function eae(e){if(typeof e=="string")return{kind:"text",text:e};if(!Kt(e))return;let t=e.type;if(t==="text"||t===void 0){let n=e.text;return typeof n=="string"?{kind:"text",text:n}:void 0}if(t==="image"){let n=Kt(e.source)?e.source:void 0,s,r;return n&&(s=typeof n.url=="string"?n.url:void 0,r=typeof n.data=="string"?n.data:void 0),!s&&!r&&(r=typeof e.data=="string"?e.data:void 0,s=typeof e.url=="string"?e.url:void 0),!s&&!r?void 0:{kind:"image",mediaType:(typeof e.mediaType=="string"?e.mediaType:void 0)??(typeof e.mimeType=="string"?e.mimeType:void 0)??(typeof e.media_type=="string"?e.media_type:void 0)??(n&&typeof n.mediaType=="string"?n.mediaType:void 0)??"image/*",source:{...s?{url:s}:{},...r?{data:r}:{}}}}if(t==="audio"){let n=Kt(e.source)?e.source:void 0;if(!n)return;let s=(typeof e.mediaType=="string"?e.mediaType:void 0)??"audio/*",r=typeof n.url=="string"?n.url:void 0,i=typeof n.data=="string"?n.data:void 0;return!r&&!i?void 0:{kind:"audio",mediaType:s,source:{...r?{url:r}:{},...i?{data:i}:{}}}}if(t==="resource"||t==="resource_link"){let n=typeof e.uri=="string"?e.uri:void 0;if(!n)return;let s=typeof e.mediaType=="string"?e.mediaType:void 0,r=typeof e.description=="string"?e.description:void 0;return{kind:"resource",uri:n,...s?{mediaType:s}:{},...r?{description:r}:{}}}}var tae=64;function xk(e,t=0){if(t>tae)return"[output truncated]";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(s=>xk(s,t+1)).filter(Boolean).join(`
`);if(!Kt(e))return e===void 0?"":ph(e);for(let s of["text","output","stdout","stderr","rawOutput"]){let r=e[s];if(typeof r=="string")return r}let n=e.content;if(n!==void 0){let s=xk(n,t+1);if(s)return s}return ph(e)}var nae=new Set(Zoe),qH=new Set(["qwen","qwen-oauth"]),sae=new Set(["in_flight","disabled","budget_would_exceed"]),HR="malformed memory_changed payload",UR=4096,VR="Session recording stopped after a write failure. New messages for the affected session will not be saved. Check disk space and permissions, then start a new session to resume recording.";function rae(e,t={}){let n=hae(e,t);switch(e.type){case"session_update":return fae(e,n,t);case"shell_output":{let s=xk(e.data),r=q6(e.data),i=H6(e.data);return s?[{...n,type:i==="user-shell"?"user.shell.output":"shell.output",text:s,...r?{stream:r}:{}}]:[]}case"permission_request":return wae(e,n);case"permission_resolved":case"permission_already_resolved":return xae(e,n);case"model_switched":return[{...n,type:"model.changed",modelId:We(e.data,"modelId")??"unknown"}];case"model_switch_failed":return[{...n,type:"error",recoverable:!0,text:We(e.data,"error")??"Model switch failed (no details available)"}];case"session_died":{let s=c3(We(e.data,"errorKind"));return[{...n,type:"error",recoverable:!1,...s?{errorKind:s}:{},text:We(e.data,"reason")??"Session died (no details available)"}]}case"session_closed":return[{...n,type:"status",text:`Session closed: ${We(e.data,"reason")??"closed"}`}];case"session_recording_degraded":return!We(e.data,"sessionId")||We(e.data,"reason")!=="write_failed"?ks(e,n,"malformed recording state"):[{...n,type:"error",recoverable:!0,code:"session_recording_degraded",text:VR}];case"session_snapshot":{if(!Kt(e.data)||!We(e.data,"sessionId"))return ks(e,n,"malformed recording snapshot");let s=e.data.recordingDegraded;return s!==void 0&&typeof s!="boolean"?ks(e,n,"malformed recording snapshot"):s===!0?[{...n,type:"error",recoverable:!0,code:"session_recording_degraded",text:VR}]:[]}case"client_evicted":return[{...n,type:"error",recoverable:!0,text:We(e.data,"reason")??"SSE client evicted (no details available)"}];case"slow_client_warning":return[{...n,type:"status",text:"SSE stream is lagging"}];case"stream_error":{let s=c3(We(e.data,"errorKind"));return[{...n,type:"error",recoverable:!0,...s?{errorKind:s}:{},text:We(e.data,"error")??"SSE stream error (no details available)"}]}case"turn_error":{let s=We(e.data,"code"),r=c3(We(e.data,"errorKind")),i=We(e.data,"promptId");return[{...n,type:"error",source:"turn_error",recoverable:!0,...s?{code:s}:{},...r?{errorKind:r}:{},...i?{promptId:i}:{},text:We(e.data,"message")??"Prompt failed (no details available)"}]}case"state_resync_required":return oae(e,n);case"history_truncated":return aae(e,n);case"session_rewound":return lae(e,n);case"session_branched":return cae(e,n);case"prompt_cancelled":{let s=Kae(e.data,"reason");return[{...n,type:"prompt.cancelled",...s?{reason:s}:{}}]}case"followup_suggestion":return uae(e,n);case"mid_turn_message_injected":return dae(e,n);case"pending_prompt_added":case"pending_prompt_started":case"pending_prompt_completed":return[];case"user_shell_command":{let s=We(e.data,"command"),r=We(e.data,"cwd");return s?[{...n,type:"user.shell.command",command:s,...r?{cwd:r}:{}},{...n,type:"user.text.delta",text:`$ ${s}`}]:[]}case"user_shell_result":{let s=lr(e.data,"exitCode"),r=Kt(e.data)&&e.data.aborted===!0?"Shell command was aborted":`Shell command exited with code ${s??"unknown"}`;return[{...n,type:"status",text:r}]}case"replay_complete":{let s=lr(e.data,"replayedCount")??0,r=lr(e.data,"lastReplayedEventId")??lr(e.data,"lastEventId");return[{...n,type:"session.replay_complete",replayedCount:s,...r!==void 0?{lastReplayedEventId:r}:{}}]}case"session_metadata_updated":return Tae(e,n);case"approval_mode_changed":return Aae(e,n);case"git_branch_changed":return[];case"memory_changed":return Mae(e,n);case"agent_changed":return Nae(e,n);case"tool_toggled":return Iae(e,n);case"settings_changed":return Rae(e,n);case"settings_reloaded":return jae(e,n);case"trust_change_requested":return Dae(e,n);case"workspace_initialized":return Lae(e,n);case"github_setup_completed":return Oae(e,n);case"mcp_budget_warning":return Pae(e,n);case"mcp_child_refused_batch":return Bae(e,n);case"mcp_server_restarted":return $ae(e,n);case"mcp_server_restart_refused":return zae(e,n);case"extensions_changed":return Fae(e,n);case"artifact_changed":return Eae(e,n);case"auth_device_flow_started":return qae(e,n);case"auth_device_flow_throttled":return Hae(e,n);case"auth_device_flow_authorized":return Uae(e,n);case"auth_device_flow_failed":return Vae(e,n);case"auth_device_flow_cancelled":return Gae(e,n);default:return iae(e,n)}}function iae(e,t){return[{...t,type:"debug",text:`${e.type} (unrecognized daemon event): ${zu(e.data)}`}]}function oae(e,t){let n=We(e.data,"reason"),s=lr(e.data,"lastDeliveredId"),r=lr(e.data,"earliestAvailableId");return!n||s===void 0||r===void 0?ks(e,t,"malformed state_resync_required payload"):[{...t,type:"session.state_resync_required",reason:n,lastDeliveredId:s,earliestAvailableId:r}]}function aae(e,t){let n=We(e.data,"reason"),s=lr(e.data,"truncatedEvents"),r=lr(e.data,"retainedEvents"),i=lr(e.data,"maxBytes");return n!=="replay_window_exceeded"||s===void 0||r===void 0||i===void 0||!Kt(e.data)||typeof e.data.fullTranscriptAvailable!="boolean"?ks(e,t,"malformed history_truncated payload"):[{...t,type:"status",text:`History truncated: retained ${r}, dropped ${s} (window ${i} bytes).`,source:"history_truncated"}]}function lae(e,t){let n=We(e.data,"promptId"),s=lr(e.data,"targetTurnIndex");if(!n||s===void 0)return ks(e,t,"malformed session_rewound payload");let r=We(e.data,"sessionId");return[{...t,type:"session.rewound",promptId:n,targetTurnIndex:s,...r?{sessionId:r}:{}}]}function cae(e,t){let n=We(e.data,"sourceSessionId"),s=We(e.data,"newSessionId"),r=We(e.data,"displayName");return!n||!s||!r?ks(e,t,"malformed session_branched payload"):[{...t,type:"session.branched",sourceSessionId:n,newSessionId:s,displayName:r}]}function uae(e,t){let n=We(e.data,"sessionId"),s=We(e.data,"suggestion"),r=We(e.data,"promptId");return!n||!s||!r?ks(e,t,"malformed followup_suggestion payload"):[{...t,type:"followup.suggestion",sessionId:n,suggestion:s,promptId:r}]}function dae(e,t){if(!Kt(e.data))return ks(e,t,"malformed mid_turn_message_injected");let n=Array.isArray(e.data.messages)?e.data.messages.filter(s=>typeof s=="string"&&s.length>0):[];return n.length===0?ks(e,t,"malformed mid_turn_message_injected"):[{...t,type:"status",text:`Inserted message: ${n.join(`
`)}`,source:"mid_turn_message_injected",data:e.data}]}function hae(e,t){let n=HH(e);return{...e.id!==void 0?{eventId:e.id}:{},...n!==void 0?{serverTimestamp:n}:{},...e.originatorClientId?{originatorClientId:e.originatorClientId}:{},...t.includeRawEvent?{rawEvent:{...e,data:wu(e.data)}}:{}}}function HH(e){let t=e.serverTimestamp;if(typeof t=="number"&&Number.isFinite(t))return t;let n=e._meta;if(Kt(n)){let s=n.serverTimestamp;if(typeof s=="number"&&Number.isFinite(s))return s}if(Kt(e.data)){let s=e.data._meta;if(Kt(s)){let i=s.serverTimestamp;if(typeof i=="number"&&Number.isFinite(i))return i}let r=e.data.update;if(Kt(r)){let i=r._meta;if(Kt(i)){let o=i.serverTimestamp;if(typeof o=="number"&&Number.isFinite(o))return o;let a=i.timestamp;if(typeof a=="number"&&Number.isFinite(a))return a}}}}function fae(e,t,n){let s=kae(e.data);if(!s)return[{...t,type:"debug",text:`session_update: ${zu(e.data)}`}];let r=We(s,"sessionUpdate");switch(r){case"user_message_chunk":{if(n.suppressOwnUserEcho&&n.clientId&&e.originatorClientId===n.clientId)return[];let i=GR(s),o=s.content,a=eae(o);if(a){if(a.kind==="image"){let c=a.source.data,d=a.mediaType||"image/*";if(d==="image/*"&&c){let h=(c.startsWith("data:")?c.split(",")[1]??"":c).slice(0,10);h.startsWith("iVBORw0KGg")?d="image/png":h.startsWith("/9j/")?d="image/jpeg":h.startsWith("R0lGOD")?d="image/gif":h.startsWith("UklGR")&&(d="image/webp")}return c?[{...t,type:"user.image.delta",data:c,mimeType:d}]:[]}return a.kind==="text"?a.text?[{...t,type:"user.text.delta",text:a.text,...i?{meta:i}:{}}]:[]:[]}let l=l3(o);return l?[{...t,type:"user.text.delta",text:l,...i?{meta:i}:{}}]:[]}case"agent_message_chunk":{let i=l3(s.content),o=WR(s),a=GR(s),l=[];i&&l.push({...t,type:"assistant.text.delta",text:i,...o?{parentToolCallId:o}:{},...a?{meta:a}:{}});let c=mae(s);return c&&l.push({...t,type:"assistant.usage",usage:c,...o?{parentToolCallId:o}:{}}),l}case"agent_thought_chunk":{let i=l3(s.content);if(!i)return[];let o=WR(s);return[{...t,type:"thought.text.delta",text:i,...o?{parentToolCallId:o}:{}}]}case"tool_call":case"tool_call_update":return[pae(s,t)];case"shell_output":case"tool_output":{let i=xk(s),o=q6(s)??q6(e.data),a=H6(s)??H6(e.data);return i?[{...t,type:a==="user-shell"?"user.shell.output":"shell.output",text:i,...o?{stream:o}:{}}]:[]}case"available_commands_update":{let i=(Array.isArray(s.availableCommands)?s.availableCommands:[]).filter(Kt);return[{...t,type:"session.available_commands",count:i.length,commands:i}]}case"plan":return[gae(s,t)];case"current_mode_update":return[];default:return[{...t,type:"debug",text:`${r??"session_update"}: ${zu(s)}`}]}}function WR(e){let t=Kt(e._meta)?e._meta:void 0;return t?We(t,"parentToolCallId"):void 0}function GR(e){let t=Kt(e._meta)?e._meta:void 0;return t?{...t}:void 0}function mae(e){let t=Kt(e._meta)?e._meta:void 0,n=t&&Kt(t.usage)?t.usage:void 0;if(!n)return;let s=lr(n,"inputTokens"),r=lr(n,"outputTokens");if(s===void 0&&r===void 0)return;let i=lr(n,"cachedReadTokens");return{inputTokens:s??0,outputTokens:r??0,...i!==void 0?{cachedTokens:i}:{}}}function pae(e,t){let n=Kt(e._meta)?e._meta:void 0,s=We(e,"toolName")??We(e,"name")??(n?We(n,"toolName"):void 0)??(n?We(n,"name"):void 0),r=We(e,"kind"),i=We(e,"title")??s??r,o=e.rawInput??e.input??e.args,a=e.rawOutput??e.output??e.result,l=o!==void 0?wu(o):void 0,c=a!==void 0?wu(a):void 0,d=e.content!==void 0?wu(e.content):void 0,h=e.locations!==void 0?wu(e.locations):void 0,f=We(e,"toolCallId"),p=We(e,"status");if(!f)return{...t,type:"error",code:"daemon.protocol.tool_update_missing_tool_call_id",recoverable:!0,text:`Tool update missing toolCallId${i?` (${i})`:""}`};let{provenance:g,serverId:y}=vae(e,s),w=We(e,"parentToolCallId")??(n?We(n,"parentToolCallId"):void 0),v=w&&w!==f?w:void 0,b=We(e,"subagentType")??(n?We(n,"subagentType"):void 0);return{...t,type:"tool.update",toolCallId:f,...p?{status:p}:{},...i?{title:i}:{},...s?{toolName:s}:{},...r?{toolKind:r}:{},...d!==void 0?{content:d}:{},...h!==void 0?{locations:h}:{},...g?{provenance:g}:{},...y?{serverId:y}:{},...v?{parentToolCallId:v}:{},...b?{subagentType:b}:{},...l!==void 0?{rawInput:l}:{},...c!==void 0?{rawOutput:c}:{},...l!==void 0?{details:F6(zu(l))}:c!==void 0?{details:F6(zu(c))}:{}}}function gae(e,t){let n=Array.isArray(e.entries)?e.entries:[],s=F6(yae(n)),r=t.eventId!==void 0?`${z6}-${t.eventId}`:z6,i=Kt(e._meta)?e._meta:void 0,o=i&&Kt(i.stats)?i.stats:void 0;return{...t,type:"tool.update",toolCallId:r,title:"Updated Plan",status:"completed",toolName:"todo_write",toolKind:"updated_plan",content:[{type:"content",content:{type:"text",text:s}}],rawOutput:o?{entries:n,stats:o}:{entries:n}}}function yae(e){return e.flatMap(t=>{if(!Kt(t))return[];let n=We(t,"content");return n?[`- [${bae(We(t,"status"))}] ${n}`]:[]}).join(`
`)}function bae(e){switch(e){case"completed":return"x";case"in_progress":return"-";default:return" "}}function vae(e,t){let n=We(e,"provenance"),s=We(e,"serverId");if(n==="builtin"||n==="mcp"||n==="subagent")return{provenance:n,...n==="mcp"&&s?{serverId:s}:{}};if(t&&t.startsWith("mcp__")){let r=t.slice(5),i=r.indexOf("__");if(i>0)return{provenance:"mcp",serverId:r.slice(0,i)}}return{}}function c3(e){if(e)return nae.has(e)?e:void 0}function F6(e){return e.length<=UR?e:`${e.slice(0,UR)}... [truncated]`}function wae(e,t){if(!Kt(e.data))return[{...t,type:"debug",text:`permission_request: ${zu(e.data)}`}];let n=We(e.data,"requestId");if(!n)return[{...t,type:"debug",text:`permission_request: ${zu(e.data)}`}];let s=e.data.toolCall!==void 0?wu(e.data.toolCall):void 0;return[{...t,type:"permission.request",requestId:n,sessionId:We(e.data,"sessionId"),title:Cae(s),options:_ae(e.data.options),toolCall:s}]}function xae(e,t){let n=We(e.data,"requestId");if(!n)return[{...t,type:"debug",text:`${e.type}: ${zu(e.data)}`}];let s=We(e.data,"voterClientId")??t.originatorClientId;return[{...t,type:"permission.resolved",requestId:n,outcome:Sae(e.data),...s?{voterClientId:s}:{}}]}function kae(e){if(!Kt(e))return;let t=e.update;return Kt(t)?t:e}function _ae(e){return Array.isArray(e)?e.flatMap(t=>{if(!Kt(t))return[];let n=We(t,"optionId");return n?[{optionId:n,label:We(t,"label")??We(t,"title")??We(t,"name")??n,...We(t,"description")?{description:We(t,"description")}:{},raw:t}]:[]}):[]}function Sae(e){if(!Kt(e))return ph(e);let t=e.outcome;if(typeof t=="string")return t;if(Kt(t)){let n=We(t,"outcome")??"selected",s=We(t,"optionId");return s?`${n}:${s}`:n}return Os(e,["status","reason"])??ph(e)}function Cae(e){return Kt(e)?We(e,"title")??We(e,"name")??We(e,"kind")??We(e,"toolName")??"Tool permission":"Tool permission"}function q6(e){let t=We(e,"stream");return t==="stdout"||t==="stderr"?t:void 0}function H6(e){if(!Kt(e))return;let t=We(e,"source");if(t)return t;let n=e._meta;return Kt(n)?We(n,"source"):void 0}function ks(e,t,n){return[{...t,type:"debug",text:`${e.type}: ${n}`}]}function Tae(e,t){let n=We(e.data,"sessionId");if(!n)return ks(e,t,"missing sessionId");let s=We(e.data,"displayName");return[{...t,type:"session.metadata.changed",sessionId:n,...s!==void 0?{displayName:s}:{}}]}function Eae(e,t){let n=We(e.data,"sessionId"),s=Kt(e.data)?e.data.change:void 0;if(!n||!Kt(s))return ks(e,t,"malformed artifact_changed payload");let r=We(s,"action"),i=We(s,"artifactId");return!r||!i?ks(e,t,"missing action or artifactId"):[{...t,type:"session.artifact.changed",sessionId:n,change:s}]}function Aae(e,t){let n=We(e.data,"sessionId"),s=We(e.data,"previous"),r=We(e.data,"next");if(!n||!s||!r)return ks(e,t,"missing sessionId / previous / next");let i=Kt(e.data)&&typeof e.data.persisted=="boolean"?e.data.persisted:!1;return[{...t,type:"session.approval_mode.changed",sessionId:n,previous:s,next:r,persisted:i}]}function Mae(e,t){var o;let n=We(e.data,"scope");if(n==="managed"){let a=We(e.data,"source"),l=We(e.data,"taskId"),c=(o=e.data)==null?void 0:o.touchedScopes;return!(a&&l&&Array.isArray(c))||c.some(d=>d!=="user"&&d!=="project")?ks(e,t,HR):[{...t,type:"workspace.memory.changed",scope:n,source:a,taskId:l,touchedScopes:c}]}let s=We(e.data,"filePath"),r=We(e.data,"mode"),i=lr(Kt(e.data)?e.data:void 0,"bytesWritten");return n!=="workspace"&&n!=="global"||!s||r!=="append"&&r!=="replace"||i===void 0?ks(e,t,HR):[{...t,type:"workspace.memory.changed",scope:n,filePath:s,mode:r,bytesWritten:i}]}function Nae(e,t){let n=We(e.data,"change"),s=We(e.data,"name"),r=We(e.data,"level");return n!=="created"&&n!=="updated"&&n!=="deleted"||!s||r!=="project"&&r!=="user"?ks(e,t,"malformed agent_changed payload"):[{...t,type:"workspace.agent.changed",change:n,name:s,level:r}]}function Iae(e,t){let n=We(e.data,"toolName"),s=Kt(e.data)&&typeof e.data.enabled=="boolean"?e.data.enabled:void 0;return!n||s===void 0?ks(e,t,"malformed tool_toggled payload"):[{...t,type:"workspace.tool.toggled",toolName:n,enabled:s}]}function Rae(e,t){let n=We(e.data,"key"),s=We(e.data,"scope");return n?[{...t,type:"workspace.settings.changed",key:n,scope:s??"workspace",value:Kt(e.data)?e.data.value:void 0}]:ks(e,t,"malformed settings_changed payload")}function jae(e,t){return Kt(e.data)?[{...t,type:"workspace.settings.changed",key:"settings_reloaded",scope:"workspace",value:e.data}]:ks(e,t,"malformed settings_reloaded payload")}function Lae(e,t){let n=We(e.data,"path"),s=We(e.data,"action");return!n||s!=="created"&&s!=="overwrote"&&s!=="noop"?ks(e,t,"malformed workspace_initialized payload"):[{...t,type:"workspace.initialized",path:n,action:s}]}function Dae(e,t){let n=We(e.data,"workspaceCwd"),s=We(e.data,"desiredState"),r=We(e.data,"reason");return!n||s!=="trusted"&&s!=="untrusted"?ks(e,t,"bad trust_change_requested payload"):[{...t,type:"workspace.trust.change.requested",workspaceCwd:n,desiredState:s,...r!==void 0?{reason:r}:{}}]}function Oae(e,t){let n=We(e.data,"releaseTag"),s=We(e.data,"readmeUrl");if(!n||!s||!Kt(e.data))return ks(e,t,"malformed github_setup_completed payload");let r=e.data.workflows,i=e.data.warnings;return[{...t,type:"workspace.github.setup.completed",releaseTag:n,readmeUrl:s,...typeof e.data.secretsUrl=="string"?{secretsUrl:e.data.secretsUrl}:{},workflows:Array.isArray(r)?r:[],gitignore:e.data.gitignore,warnings:Array.isArray(i)?i.filter(o=>typeof o=="string"):[]}]}function Pae(e,t){if(!Kt(e.data))return ks(e,t,"non-object payload");let n=lr(e.data,"liveCount"),s=lr(e.data,"reservedCount"),r=lr(e.data,"budget"),i=lr(e.data,"thresholdRatio"),o=We(e.data,"mode");return n===void 0||s===void 0||r===void 0||i===void 0||o!=="warn"&&o!=="enforce"?ks(e,t,"malformed mcp_budget_warning payload"):[{...t,type:"workspace.mcp.budget_warning",liveCount:n,reservedCount:s,budget:r,thresholdRatio:i,mode:o}]}function Bae(e,t){if(!Kt(e.data))return ks(e,t,"non-object payload");let n=Array.isArray(e.data.refusedServers)?e.data.refusedServers.filter(Kt).map(o=>{let a=We(o,"name"),l=We(o,"transport"),c=We(o,"reason");return!a||!l||c!=="budget_exhausted"?null:{name:a,transport:l,reason:"budget_exhausted"}}).filter(o=>o!==null):[],s=lr(e.data,"budget"),r=lr(e.data,"liveCount"),i=lr(e.data,"reservedCount");return n.length===0||s===void 0||r===void 0||i===void 0?ks(e,t,"malformed mcp_child_refused_batch payload"):[{...t,type:"workspace.mcp.child_refused",refusedServers:n,budget:s,liveCount:r,reservedCount:i}]}function $ae(e,t){let n=We(e.data,"serverName"),s=lr(e.data,"durationMs");return!n||s===void 0?ks(e,t,"malformed mcp_server_restarted payload"):[{...t,type:"workspace.mcp.server_restarted",serverName:n,durationMs:s}]}function zae(e,t){let n=We(e.data,"serverName"),s=We(e.data,"reason");return!n||!s||!sae.has(s)?ks(e,t,"malformed mcp_server_restart_refused payload"):[{...t,type:"workspace.mcp.server_restart_refused",serverName:n,reason:s}]}function Fae(e,t){let n=lr(e.data,"refreshed"),s=lr(e.data,"failed"),r=We(e.data,"status"),i=We(e.data,"source"),o=We(e.data,"name"),a=We(e.data,"version"),l=We(e.data,"error");return n===void 0||s===void 0||r!==void 0&&r!=="installed"&&r!=="enabled"&&r!=="disabled"&&r!=="updated"&&r!=="uninstalled"&&r!=="failed"?ks(e,t,"malformed extensions_changed payload"):[{...t,type:"workspace.extensions.changed",refreshed:n,failed:s,...r?{status:r}:{},...i?{source:i}:{},...o?{name:o}:{},...a?{version:a}:{},...l?{error:l}:{}}]}function qae(e,t){let n=We(e.data,"deviceFlowId"),s=We(e.data,"providerId"),r=lr(e.data,"expiresAt");return!n||!s||!qH.has(s)||r===void 0?ks(e,t,"malformed auth_device_flow_started payload"):[{...t,type:"auth.device_flow.started",deviceFlowId:n,providerId:s,expiresAt:r}]}function Hae(e,t){let n=We(e.data,"deviceFlowId"),s=lr(e.data,"intervalMs");return!n||s===void 0?ks(e,t,"malformed auth_device_flow_throttled payload"):[{...t,type:"auth.device_flow.throttled",deviceFlowId:n,intervalMs:s}]}function Uae(e,t){let n=We(e.data,"deviceFlowId"),s=We(e.data,"providerId");if(!n||!s||!qH.has(s))return ks(e,t,"malformed auth_device_flow_authorized payload");let r=lr(e.data,"expiresAt"),i=We(e.data,"accountAlias");return[{...t,type:"auth.device_flow.authorized",deviceFlowId:n,providerId:s,...r!==void 0?{expiresAt:r}:{},...i?{accountAlias:i}:{}}]}function Vae(e,t){let n=We(e.data,"deviceFlowId"),s=We(e.data,"errorKind");if(!n||!Wae(s))return ks(e,t,"malformed auth_device_flow_failed payload");let r=We(e.data,"hint");return[{...t,type:"auth.device_flow.failed",deviceFlowId:n,errorKind:s,...r?{hint:r}:{}}]}function Wae(e){return typeof e=="string"&&e.trim().length>0}function Gae(e,t){let n=We(e.data,"deviceFlowId");return n?[{...t,type:"auth.device_flow.cancelled",deviceFlowId:n}]:ks(e,t,"malformed auth_device_flow_cancelled payload")}function lr(e,t){if(!Kt(e))return;let n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Kae(e,t){if(!Kt(e))return;let n=e[t];return typeof n=="string"&&n.length>0?n:void 0}var Yae=8;function kk(e,t={},n=0){if(n>Yae){let g=t.title??t.toolName??t.toolKind;return{kind:"generic",...g?{summary:g}:{}}}if(Kt(e)){let g=e.rawInput??e.input??e.args;if(g!==void 0&&g!==e){let y=kk(g,{title:t.title??Os(e,["title"]),toolName:t.toolName??Os(e,["toolName","name"]),toolKind:t.toolKind??Os(e,["kind"])},n+1);if(y.kind!=="generic"||!y.summary)return y}}let s=ele(e);if(s.length>0)return{kind:"ask_user_question",questions:s};let r=Zae(e,t);if(r)return r;let i=rle(e,t);if(i)return i;let o=ile(e,t);if(o)return o;let a=ole(e,t);if(a)return a;let l=Xae(e,t);if(l)return l;let c=Qae(e,t);if(c)return c;let d=Jae(e);if(d)return d;let h=ale(e,t);if(h)return h;let f=lle(e);if(f)return f;if(Kt(e)){let g=Os(e,["command","cmd"]);if(g){let w=Os(e,["cwd","directory","workingDirectory"]);return{kind:"command",command:g,...w?{cwd:w}:{}}}let y=nle(e);if(y.length>0)return{kind:"key_value",rows:y}}let p=t.title??t.toolName??t.toolKind;return{kind:"generic",...p?{summary:p}:{}}}function Xae(e,t={}){if(!Kt(e))return;let n=Os(e,["path","filePath","file_path","absolutePath"]);if(!n)return;let s=Os(e,["oldText","old_text","old_str","oldString"]),r=Os(e,["newText","new_text","new_str","newString"]),i=(t.toolName??"").toLowerCase(),o=/(?:^|[_-])(write|create|edit|replace|save|update|overwrite|modify|patch|generate)(?:$|[_-])/.test(i)||!!s,a=r===void 0&&o?Os(e,["content"]):void 0,l=r??a,c=Os(e,["patch","diff","unified_diff"]);if(!(!s&&!l&&!c))return{kind:"file_diff",path:n,...s?{oldText:s}:{},...l?{newText:l}:{},...c?{patch:c}:{}}}function Qae(e,t){if(!Kt(e))return;let n=Os(e,["path","filePath","file_path","absolutePath"]);if(!n)return;let s=t.toolName??Os(e,["toolName","name"]),r=s!==void 0&&/read|view|cat/i.test(s),i=e.lineRange??e.line_range??e.range,o;if(Array.isArray(i)&&i.length===2&&typeof i[0]=="number"&&typeof i[1]=="number")o=[i[0],i[1]];else{let a=e.offset,l=e.limit;typeof a=="number"&&typeof l=="number"&&l>0&&(o=[a+1,a+l])}if(!(!r&&!o))return{kind:"file_read",path:n,...o?{range:o}:{}}}function Jae(e){if(!Kt(e))return;let t=Os(e,["url","uri","href"]);if(!t||!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(t))return;let n=Os(e,["method","httpMethod"]);return{kind:"web_fetch",url:t,...n?{method:n}:{}}}function Zae(e,t){let n=t.toolName??(Kt(e)?Os(e,["toolName","name"]):void 0);if(!n||!n.startsWith("mcp__"))return;let s=n.slice(5),r=s.indexOf("__");if(r<=0)return;let i=s.slice(0,r),o=s.slice(r+2),a;if(Kt(e)){let l=e.arguments??e.args??e;if(Kt(l)){let c=Object.entries(l).filter(([d])=>d!=="name"&&d!=="toolName").slice(0,1).map(([d,h])=>{let f=typeof h=="string"?h:JSON.stringify(h),p=f.length>60?`${f.slice(0,60)}…`:f;return`${d}=${p}`})[0];c&&(a=c)}}return{kind:"mcp_invocation",serverId:i,toolName:o,...a?{argsSummary:a}:{}}}function ele(e){return!Kt(e)||!Array.isArray(e.questions)?[]:e.questions.filter(Kt).map(t=>{let n=Os(t,["header","title","label"]),s=Os(t,["question","prompt","text"])??"Question",r=Array.isArray(t.options)?t.options.filter(Kt).map(tle):[];return{...n?{header:n}:{},question:s,options:r,raw:t}})}function tle(e){let t=Os(e,["label","title","value"])??"Option",n=Os(e,["description","detail","text"]);return{label:t,...n?{description:n}:{},raw:e}}function nle(e){let t=[],n=[["Path",["path","filePath","file_path","absolutePath"]],["Cwd",["cwd","directory","workingDirectory"]],["Query",["query","pattern","search"]],["Note",["description","reason"]]];for(let[s,r]of n){let i=Os(e,r);i&&t.push({label:s,value:i})}if(t.length>0)return t;for(let[s,r]of Object.entries(e).slice(0,4))r==null||Array.isArray(r)||Kt(r)||t.push({label:s,value:FH(s)?"[redacted]":zu(r)});return t}var KR=50,sle=5;function rle(e,t){let n=t.toolName??"";if(!(/^task$/i.test(n)||/(?:^|_)(?:delegate|subagent|spawn[_-]?task)$/i.test(n)||/agent/i.test(t.toolKind??""))||!Kt(e))return;let s=Os(e,["subagent_type","agent","agentName","agent_name","subagent"]),r=Os(e,["prompt","task","description","instruction","query"]);if(!s&&!r)return;let i=Os(e,["parentDelegationId","parent_delegation_id","parent_id"]);return{kind:"subagent_delegation",agentName:s??"subagent",task:r??"(no task description)",...i?{parentDelegationId:i}:{}}}function ile(e,t){if(!Kt(e))return;let n=Os(e,["query","pattern","search","q"]);if(!n)return;let s=t.toolName??"";if(!(/(grep|search|find|ripgrep|rg|glob|lookup)/i.test(s)||typeof e.resultCount=="number"||Array.isArray(e.results)||Array.isArray(e.matches)))return;let r=typeof e.resultCount=="number"?e.resultCount:typeof e.total=="number"?e.total:Array.isArray(e.results)?e.results.length:Array.isArray(e.matches)?e.matches.length:void 0,i,o=e.results??e.matches;return Array.isArray(o)&&(i=o.slice(0,sle).map(a=>typeof a=="string"?a:Kt(a)?Os(a,["path","file","name","title","text"])??ph(a).slice(0,120):String(a)).filter(Boolean),i.length===0&&(i=void 0)),{kind:"search",query:n,...r!==void 0?{resultCount:r}:{},...i?{top:i}:{}}}function ole(e,t){let n=t.toolName??"";if(!/(image[_-]?gen|generate[_-]?image|diffusion|dalle|imagen|flux|stable[_-]?diffusion|midjourney|sora)/i.test(n)||!Kt(e))return;let s=Os(e,["prompt","description","query"]);if(!s)return;let r=Os(e,["thumbnailUrl","thumbnail","url","imageUrl","preview"]),i=Os(e,["model","modelId","model_name"]);return{kind:"image_generation",prompt:s,...r?{thumbnailUrl:r}:{},...i?{model:i}:{}}}function ale(e,t){if(!Kt(e))return;let n=Os(e,["code","snippet","source"]);if(!n)return;let s=Os(e,["language","lang","codeLanguage","syntax"]),r=t.toolName??"",i=/(repl|format|prettier|eslint|tsc|compile|exec[_-]?code)/i.test(r);if(!s&&!i)return;let o=Os(e,["origin","source_location","path"]);return{kind:"code_block",code:n,...s?{language:s}:{},...o?{origin:o}:{}}}function lle(e){if(!Kt(e))return;let t=e.columns,n=e.rows;if(Array.isArray(t)&&Array.isArray(n)){let r=t.filter(o=>typeof o=="string").slice(0,30);if(r.length===0)return;let i=n.slice(0,KR).map(o=>Array.isArray(o)?o.map(a=>typeof a=="string"?a:ph(a).slice(0,80)):[]);return{kind:"tabular",columns:r,rows:i,...n.length>i.length?{totalRows:n.length}:{}}}let s=e.data??e.records;if(Array.isArray(s)&&s.length>0&&Kt(s[0])){let r=Object.keys(s[0]).slice(0,30);if(r.length===0)return;let i=s.slice(0,KR).map(o=>{let a=o;return r.map(l=>{let c=a[l];return typeof c=="string"?c:ph(c).slice(0,80)})});return{kind:"tabular",columns:r,rows:i,...s.length>i.length?{totalRows:s.length}:{}}}}var cle=1e3,zf="__trimmed_tool_block__",m_="__trimmed_permission_block__",U6=1e5,YR=`
[truncated]
`,ule=16;function dle(e={}){return{blocks:[],blockIndexById:{},toolBlockByCallId:{},trimmedToolNotificationByCallId:{},permissionBlockByRequestId:{},activeAssistantBlockByParent:{},activeThoughtBlockByParent:{},toolProgress:{},awaitingResync:!1,resyncRequiredCount:0,nextOrdinal:1,now:e.now??Date.now(),maxBlocks:e.maxBlocks??cle}}var ME=new Set(["pending","confirming","running","in_progress"]),hle=new Set(["completed","success","failed","error","canceled","cancelled"]),fle=new Set(["session.state_resync_required","assistant.done","status","debug","error"]);function mle(e,t,n={}){let s=GH(e,n);jE(s);let r=LE(s,"user",t,void 0,void 0,n.meta);return n.images&&n.images.length>0&&(r.images=[...n.images]),$c(s,r),s.activeUserBlockId=r.id,KH(s)}function ple(e,t,n={}){if(t.length===0)return e;let s=GH(e,n);for(let i of t)gle(s,i);let r=KH(s);return Object.freeze(r.blocks),r}function NE(e){let t={};return e.forEach((n,s)=>{t[n.id]=s}),t}function gle(e,t){var n;if(t.eventId!==void 0&&(e.lastEventId=Math.max(e.lastEventId??0,t.eventId)),e.awaitingResync&&!fle.has(t.type)){typeof console<"u"&&((n=console.warn)==null||n.call(console,`[daemon-ui] dropping event \`${t.type}\` while awaitingResync; state may be stale until session reconnect (lastResyncRequired: ${e.lastResyncRequired?JSON.stringify(e.lastResyncRequired):"unknown"})`));return}switch(t.type){case"user.shell.command":e.pendingUserShellCommand={command:t.command,...t.cwd?{cwd:t.cwd}:{}};break;case"user.text.delta":e.activeUserBlockId||(e.lastFollowupSuggestion=void 0),u3(e,"user","activeUserBlockId",t.text,t);break;case"user.image.delta":{if(e.activeUserBlockId){let s=wl(e,e.activeUserBlockId);s&&s.kind==="user"&&(s.images=[...s.images??[],{data:t.data,mimeType:t.mimeType}])}else{let s=LE(e,"user","");s.images=[{data:t.data,mimeType:t.mimeType}],$c(e,s),e.activeUserBlockId=s.id}break}case"assistant.text.delta":u3(e,"assistant","activeAssistantBlockId",t.text,t);break;case"assistant.done":jE(e,t),(t.reason==="cancelled"||t.reason==="error")&&V6(e);break;case"assistant.usage":vle(e,t);break;case"thought.text.delta":u3(e,"thought","activeThoughtBlockId",t.text,t);break;case"tool.update":WH(e,t);break;case"shell.output":kle(e,t);break;case"user.shell.output":_le(e,t);break;case"permission.request":Sle(e,t);break;case"permission.resolved":Cle(e,t);break;case"model.changed":B1(e,"status",`Model switched: ${t.modelId}`,t);break;case"status":case"debug":case"error":B1(e,t.type,t.text,t);break;case"session.approval_mode.changed":e.approvalMode=t.next;break;case"session.metadata.changed":case"session.artifact.changed":case"session.available_commands":break;case"session.state_resync_required":yle(e,t);break;case"prompt.cancelled":V6(e),t.reason!=="forward_failed"&&Tle(e,t);break;case"followup.suggestion":e.lastFollowupSuggestion={suggestion:t.suggestion,promptId:t.promptId};break;case"session.replay_complete":break;case"session.rewound":Ale(e,t.targetTurnIndex);break;case"session.branched":B1(e,"status",`Branched conversation "${t.displayName}". You are now in the branch.`,t);break}}function yle(e,t){e.awaitingResync=!0,e.resyncRequiredCount+=1,e.lastResyncRequired={reason:t.reason,lastDeliveredId:t.lastDeliveredId,earliestAvailableId:t.earliestAvailableId},V6(e),B1(e,"error",`State resync required: ${ble(t.lastDeliveredId,t.earliestAvailableId)}.`,t)}function ble(e,t){let n=e+1,s=t-1;return s<n?"no events lost (resync requested without gap)":s===n?`missed 1 daemon event (id ${n})`:`missed daemon events ${n}-${s}`}function p_(e,t,n){let s=wl(e,t);((s==null?void 0:s.kind)==="assistant"||(s==null?void 0:s.kind)==="thought")&&(s.streaming=!1,s.updatedAt=e.now,(n==null?void 0:n.eventId)!==void 0&&(s.eventId=n.eventId),s.serverTimestamp===void 0&&(n==null?void 0:n.serverTimestamp)!==void 0&&(s.serverTimestamp=n.serverTimestamp))}function UH(e,t){p_(e,e.activeAssistantBlockId,t),e.activeAssistantBlockId=void 0}function vle(e,t){let n=wl(e,e.activeAssistantBlockId);if(!n||n.kind!=="assistant")return;let s=n.usage;n.usage={inputTokens:((s==null?void 0:s.inputTokens)??0)+t.usage.inputTokens,outputTokens:((s==null?void 0:s.outputTokens)??0)+t.usage.outputTokens,cachedTokens:((s==null?void 0:s.cachedTokens)??0)+(t.usage.cachedTokens??0)},n.updatedAt=e.now}function VH(e,t){p_(e,e.activeThoughtBlockId,t),e.activeThoughtBlockId=void 0}function IE(e,t,n){p_(e,e.activeAssistantBlockByParent[t],n),delete e.activeAssistantBlockByParent[t]}function RE(e,t,n){p_(e,e.activeThoughtBlockByParent[t],n),delete e.activeThoughtBlockByParent[t]}function u3(e,t,n,s,r){let i=t!=="user"&&"parentToolCallId"in r?r.parentToolCallId:void 0,o=i!=null?t==="assistant"?e.activeAssistantBlockByParent:t==="thought"?e.activeThoughtBlockByParent:void 0:void 0,a=o&&i!=null?o[i]:e[n],l=wl(e,a);if(l&&l.kind===t&&wle(l,r)){l.text=OE(l.text,s),l.updatedAt=e.now,r.eventId!==void 0&&(l.eventId=r.eventId),r.serverTimestamp!==void 0&&(l.serverTimestamp=r.serverTimestamp),"meta"in r&&r.meta&&(l.meta={...l.meta,...r.meta}),(t==="assistant"||t==="thought")&&(l.streaming=!0);return}let c=LE(e,t,s,r.eventId,r.serverTimestamp,"meta"in r?r.meta:void 0);(t==="assistant"||t==="thought")&&(c.streaming=!0),t==="thought"&&(c.collapsed=!0),i!=null&&(c.parentToolCallId=i),$c(e,c),o&&i!=null?o[i]=c.id:e[n]=c.id,i!=null?(t==="assistant"&&RE(e,i),t==="thought"&&IE(e,i)):(t!=="user"&&(e.activeUserBlockId=void 0),t!=="assistant"&&UH(e),t!=="thought"&&VH(e))}function wle(e,t){var n,s;return e.kind!=="user"&&e.kind!=="assistant"&&e.kind!=="thought"||((n=e.meta)==null?void 0:n.qwenDiscreteMessage)===!0?!1:!("meta"in t)||((s=t.meta)==null?void 0:s.qwenDiscreteMessage)!==!0}function jE(e,t){UH(e,t);for(let n of Object.keys(e.activeAssistantBlockByParent))IE(e,n,t);for(let n of Object.keys(e.activeThoughtBlockByParent))RE(e,n,t);VH(e,t)}function WH(e,t){let n=e.toolBlockByCallId[t.toolCallId];if(n===zf){if(Ele(t))return delete e.toolBlockByCallId[t.toolCallId],delete e.trimmedToolNotificationByCallId[t.toolCallId],WH(e,t);e.trimmedToolNotificationByCallId[t.toolCallId]||(e.trimmedToolNotificationByCallId[t.toolCallId]=!0,B1(e,"error",`Tool ${t.toolCallId} output trimmed (max blocks reached)`,t,{clearActiveText:!1}));return}let s=wl(e,n);if((s==null?void 0:s.kind)==="tool"){if(t.title!==void 0&&(s.title=t.title),t.status!==void 0&&(s.status=t.status),t.rawInput!==void 0&&(s.preview=kk(t.rawInput,{title:t.title,toolName:t.toolName,toolKind:t.toolKind})),s.updatedAt=e.now,t.eventId!==void 0&&(s.eventId=t.eventId),t.details&&(s.details=t.details),t.content!==void 0&&(s.content=t.content),t.locations!==void 0&&(s.locations=t.locations),t.rawInput!==void 0&&(s.rawInput=t.rawInput),t.rawOutput!==void 0&&(s.rawOutput=t.rawOutput),t.toolName&&(s.toolName=t.toolName),t.toolKind&&(s.toolKind=t.toolKind),t.parentToolCallId&&!s.parentToolCallId&&(s.parentToolCallId=t.parentToolCallId),s.parentToolCallId&&!s.parentBlockId){let o=e.toolBlockByCallId[s.parentToolCallId];o&&o!==zf&&(s.parentBlockId=o)}t.subagentType&&!s.subagentType&&(s.subagentType=t.subagentType),XR(e,t.toolCallId,t.status);return}let r=t.parentToolCallId&&e.toolBlockByCallId[t.parentToolCallId]!==zf?e.toolBlockByCallId[t.parentToolCallId]:void 0,i={id:Lh(e,"tool"),kind:"tool",toolCallId:t.toolCallId,title:t.title??t.toolName??t.toolKind??"Tool",status:t.status??"pending",preview:kk(t.rawInput,{title:t.title,toolName:t.toolName,toolKind:t.toolKind}),clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...t.eventId!==void 0?{eventId:t.eventId}:{},...t.serverTimestamp!==void 0?{serverTimestamp:t.serverTimestamp}:{},...t.details?{details:t.details}:{},...t.content!==void 0?{content:t.content}:{},...t.locations!==void 0?{locations:t.locations}:{},...t.rawInput!==void 0?{rawInput:t.rawInput}:{},...t.rawOutput!==void 0?{rawOutput:t.rawOutput}:{},...t.toolName?{toolName:t.toolName}:{},...t.toolKind?{toolKind:t.toolKind}:{},...t.parentToolCallId?{parentToolCallId:t.parentToolCallId}:{},...t.subagentType?{subagentType:t.subagentType}:{},...r?{parentBlockId:r}:{}};$c(e,i),e.toolBlockByCallId[t.toolCallId]=i.id;for(let o of e.blocks)if(o.kind==="tool"&&o.parentToolCallId===t.toolCallId&&!o.parentBlockId){let a=wl(e,o.id);(a==null?void 0:a.kind)==="tool"&&(a.parentBlockId=i.id)}XR(e,t.toolCallId,t.status??"pending"),ym(e,t.parentToolCallId)}function XR(e,t,n){if(n!==void 0){if(ME.has(n)){e.currentToolCallId=t;return}if(hle.has(n)){e.currentToolCallId===t&&(e.currentToolCallId=xle(e));return}}}function xle(e){for(let t=e.blocks.length-1;t>=0;t-=1){let n=e.blocks[t];if((n==null?void 0:n.kind)==="tool"&&ME.has(n.status))return n.toolCallId}}function V6(e){for(let t of Object.values(e.toolBlockByCallId)){if(t===zf)continue;let n=wl(e,t);!n||n.kind!=="tool"||ME.has(n.status)&&(n.status="cancelled",n.updatedAt=e.now)}e.currentToolCallId=void 0}function kle(e,t){if(!t.text)return;let n=e.blocks[e.blocks.length-1];if((n==null?void 0:n.kind)==="shell"&&n.stream===t.stream){let r=wl(e,n.id);(r==null?void 0:r.kind)==="shell"&&(r.text=OE(r.text,t.text),r.updatedAt=e.now,t.eventId!==void 0&&(r.eventId=t.eventId));return}let s={id:Lh(e,"shell"),kind:"shell",text:yb(t.text),clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...t.eventId!==void 0?{eventId:t.eventId}:{},...t.serverTimestamp!==void 0?{serverTimestamp:t.serverTimestamp}:{},...t.stream?{stream:t.stream}:{}};$c(e,s),ym(e)}function _le(e,t){if(!t.text)return;let n=e.blocks[e.blocks.length-1];if((n==null?void 0:n.kind)==="user_shell"&&n.stream===t.stream&&!e.pendingUserShellCommand){let o=wl(e,n.id);(o==null?void 0:o.kind)==="user_shell"&&(o.text=OE(o.text,t.text),o.updatedAt=e.now,t.eventId!==void 0&&(o.eventId=t.eventId));return}let s=e.pendingUserShellCommand,r=(n==null?void 0:n.kind)==="user_shell"?n:void 0,i={id:Lh(e,"user-shell"),kind:"user_shell",text:yb(t.text),command:(s==null?void 0:s.command)??(r==null?void 0:r.command)??"",...s!=null&&s.cwd||r!=null&&r.cwd?{cwd:(s==null?void 0:s.cwd)??(r==null?void 0:r.cwd)}:{},clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...t.eventId!==void 0?{eventId:t.eventId}:{},...t.serverTimestamp!==void 0?{serverTimestamp:t.serverTimestamp}:{},...t.stream?{stream:t.stream}:{}};e.pendingUserShellCommand=void 0,$c(e,i),ym(e)}function Sle(e,t){let n=e.permissionBlockByRequestId[t.requestId];if(n===m_)return;let s=wl(e,n),r=kk(t.toolCall,{title:t.title});if((s==null?void 0:s.kind)==="permission"){s.title=t.title,s.options=t.options.map(o=>({...o})),s.toolCall=t.toolCall,s.preview=r,s.updatedAt=e.now,t.eventId!==void 0&&(s.eventId=t.eventId);return}let i={id:Lh(e,"permission"),kind:"permission",requestId:t.requestId,title:t.title,options:t.options.map(o=>({...o})),preview:r,clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...t.eventId!==void 0?{eventId:t.eventId}:{},...t.serverTimestamp!==void 0?{serverTimestamp:t.serverTimestamp}:{},...t.sessionId?{sessionId:t.sessionId}:{},...t.toolCall!==void 0?{toolCall:t.toolCall}:{}};$c(e,i),e.permissionBlockByRequestId[t.requestId]=i.id,ym(e)}function Cle(e,t){let n=e.permissionBlockByRequestId[t.requestId];if(n===void 0||n===m_)return;let s=wl(e,n);if((s==null?void 0:s.kind)==="permission"){s.resolved=t.outcome,s.updatedAt=e.now,t.eventId!==void 0&&(s.eventId=t.eventId);return}let r={id:Lh(e,"permission"),kind:"permission",requestId:t.requestId,title:`Permission resolved: ${t.requestId}`,options:[],preview:{kind:"generic",summary:t.outcome},resolved:t.outcome,clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...t.eventId!==void 0?{eventId:t.eventId}:{},...t.serverTimestamp!==void 0?{serverTimestamp:t.serverTimestamp}:{}};$c(e,r),e.permissionBlockByRequestId[t.requestId]=r.id,ym(e)}function B1(e,t,n,s,r={}){let i={id:Lh(e,t),kind:t,text:yb(n),clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...(s==null?void 0:s.eventId)!==void 0?{eventId:s.eventId}:{},...(s==null?void 0:s.serverTimestamp)!==void 0?{serverTimestamp:s.serverTimestamp}:{},...(s==null?void 0:s.type)==="error"&&s.code?{code:s.code}:{},...(s==null?void 0:s.type)==="error"&&s.promptId?{promptId:s.promptId}:{},...(s==null?void 0:s.type)==="error"&&s.errorKind?{errorKind:s.errorKind}:{},...(s==null?void 0:s.type)==="error"&&s.source?{source:s.source}:{},...((s==null?void 0:s.type)==="status"||(s==null?void 0:s.type)==="debug")&&s.source?{source:s.source}:{},...((s==null?void 0:s.type)==="status"||(s==null?void 0:s.type)==="debug")&&s.data!==void 0?{data:s.data}:{},...(s==null?void 0:s.type)==="session.branched"?{source:"session_branched",data:{sourceSessionId:s.sourceSessionId,newSessionId:s.newSessionId,displayName:s.displayName}}:{}};$c(e,i),r.clearActiveText!==!1&&ym(e)}function Tle(e,t){let n={id:Lh(e,"prompt_cancelled"),kind:"prompt_cancelled",clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...t.reason?{reason:t.reason}:{},...t.eventId!==void 0?{eventId:t.eventId}:{},...t.serverTimestamp!==void 0?{serverTimestamp:t.serverTimestamp}:{}};$c(e,n),ym(e)}function LE(e,t,n,s,r,i){return{id:Lh(e,t),kind:t,text:yb(n),clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...s!==void 0?{eventId:s}:{},...r!==void 0?{serverTimestamp:r}:{},...i?{meta:{...i}}:{}}}function GH(e,t){return{...e,now:t.now??Date.now(),maxBlocks:t.maxBlocks??e.maxBlocks,blocks:e.blocks,blockIndexById:e.blockIndexById,toolBlockByCallId:{...e.toolBlockByCallId},activeAssistantBlockByParent:{...e.activeAssistantBlockByParent},activeThoughtBlockByParent:{...e.activeThoughtBlockByParent},trimmedToolNotificationByCallId:{...e.trimmedToolNotificationByCallId},permissionBlockByRequestId:{...e.permissionBlockByRequestId},toolProgress:Object.fromEntries(Object.entries(e.toolProgress).map(([n,s])=>[n,{...s}])),lastResyncRequired:e.lastResyncRequired!==void 0?{...e.lastResyncRequired}:void 0,lastFollowupSuggestion:e.lastFollowupSuggestion}}function KH(e){if(e.blocks.length<=e.maxBlocks)return e;let t=e.blocks.slice(-e.maxBlocks),n=new Set(t.map(s=>s.id));e.blocks=t,e.blockIndexById=NE(t),_k.set(e,e.blocks);for(let[s,r]of Object.entries(e.toolBlockByCallId))n.has(r)||(e.toolBlockByCallId[s]=zf);Ile(e);for(let[s]of Object.entries(e.trimmedToolNotificationByCallId))e.toolBlockByCallId[s]!==zf&&delete e.trimmedToolNotificationByCallId[s];for(let[s,r]of Object.entries(e.permissionBlockByRequestId))n.has(r)||(e.permissionBlockByRequestId[s]=m_);Rle(e);for(let s of e.blocks)if(s.kind==="tool"&&s.parentBlockId&&!n.has(s.parentBlockId)){let r=wl(e,s.id);(r==null?void 0:r.kind)==="tool"&&(r.parentBlockId=void 0)}n.has(e.activeUserBlockId??"")||(e.activeUserBlockId=void 0),n.has(e.activeAssistantBlockId??"")||(e.activeAssistantBlockId=void 0),n.has(e.activeThoughtBlockId??"")||(e.activeThoughtBlockId=void 0);for(let[s,r]of Object.entries(e.activeAssistantBlockByParent))n.has(r)||delete e.activeAssistantBlockByParent[s];for(let[s,r]of Object.entries(e.activeThoughtBlockByParent))n.has(r)||delete e.activeThoughtBlockByParent[s];return e}function Ele(e){return e.toolCallId===z6||e.toolKind==="updated_plan"}var _k=new WeakMap;function DE(e){_k.get(e)!==e.blocks&&(e.blocks=[...e.blocks],e.blockIndexById={...e.blockIndexById},_k.set(e,e.blocks))}function Ale(e,t){var r;let n=0,s=-1;for(let i=0;i<e.blocks.length;i+=1)if(((r=e.blocks[i])==null?void 0:r.kind)==="user"){if(s=i,n===t){QR(e,i);return}n+=1}s>=0&&t>=n&&QR(e,s)}function QR(e,t){DE(e),e.blocks=e.blocks.slice(0,t),_k.set(e,e.blocks),Mle(e)}function Mle(e){e.blockIndexById=NE(e.blocks),e.toolBlockByCallId={},e.permissionBlockByRequestId={},e.trimmedToolNotificationByCallId={},e.activeUserBlockId=void 0,e.activeAssistantBlockId=void 0,e.activeThoughtBlockId=void 0,e.activeAssistantBlockByParent={},e.activeThoughtBlockByParent={},e.currentToolCallId=void 0,e.pendingUserShellCommand=void 0,e.lastFollowupSuggestion=void 0;let t=new Set;for(let n of e.blocks)n.kind==="tool"?(e.toolBlockByCallId[n.toolCallId]=n.id,t.add(n.toolCallId)):n.kind==="permission"&&(e.permissionBlockByRequestId[n.requestId]=n.id);for(let n of Object.keys(e.toolProgress))t.has(n)||delete e.toolProgress[n]}function $c(e,t){DE(e),e.blockIndexById[t.id]=e.blocks.length,e.blocks.push(t)}function wl(e,t){if(!t)return;let n=e.blockIndexById[t];if(n===void 0)return;let s=e.blocks[n];if(!s||s.id!==t)return;let r=Nle(s);return DE(e),e.blocks[n]=r,r}function Nle(e){return e.kind==="permission"?{...e,options:e.options.map(t=>uc(t)),toolCall:uc(e.toolCall),preview:uc(e.preview)}:e.kind==="tool"?{...e,preview:uc(e.preview),content:uc(e.content),locations:uc(e.locations),rawInput:uc(e.rawInput),rawOutput:uc(e.rawOutput)}:{...e}}function Lh(e,t){let n=`${t}-${e.nextOrdinal}`;return e.nextOrdinal+=1,n}function ym(e,t){t?(IE(e,t),RE(e,t)):(jE(e),e.activeUserBlockId=void 0)}function OE(e,t){return e.length>=U6?e:yb(e+t)}function yb(e){if(e.length<=U6)return e;let t=Math.max(0,U6-YR.length);return`${e.slice(0,t)}${YR}`}function Ile(e){let t=Math.max(0,e.maxBlocks),n=Object.entries(e.toolBlockByCallId).filter(([,r])=>r===zf).map(([r])=>r),s=n.length-t;if(!(s<=0))for(let r of n.slice(0,s))delete e.toolBlockByCallId[r],delete e.trimmedToolNotificationByCallId[r]}function Rle(e){let t=Math.max(0,e.maxBlocks),n=Object.entries(e.permissionBlockByRequestId).filter(([,r])=>r===m_).map(([r])=>r),s=n.length-t;if(!(s<=0))for(let r of n.slice(0,s))delete e.permissionBlockByRequestId[r]}function uc(e,t=0){return t>ule?e:Array.isArray(e)?e.map(n=>uc(n,t+1)):Kt(e)?Object.fromEntries(Object.entries(e).map(([n,s])=>[n,uc(s,t+1)])):e}function jle(e={}){let t=JR(e),n=new Set,s=!1,r=()=>{for(let o of n)try{o()}catch(a){Lle(a)}},i=()=>{s||(s=!0,queueMicrotask(()=>{s=!1,r()}))};return{getSnapshot(){return t},subscribe(o){return n.add(o),()=>{n.delete(o)}},dispatch(o){let a=Array.isArray(o)?o:[o];a.length!==0&&(t=ple(t,a),i())},appendLocalUserMessage(o,a,l){t=mle(t,o,{images:a,meta:l}),i()},reset(o={}){t=JR({maxBlocks:o.maxBlocks??t.maxBlocks,...o}),i()},clearAwaitingResync(){t.awaitingResync&&(t={...t,awaitingResync:!1},i())},clearFollowupSuggestion(){t.lastFollowupSuggestion!==void 0&&(t={...t,lastFollowupSuggestion:void 0},i())}}}function Lle(e){var s;let t=globalThis.reportError;if(typeof t=="function"){t(e);return}let n=(s=globalThis.console)==null?void 0:s.error;typeof n=="function"&&n.call(globalThis.console,e)}function JR(e){let t=e.blocks?[...e.blocks]:[];return{...dle({maxBlocks:e.maxBlocks,now:e.now}),...e,blocks:t,blockIndexById:NE(t),toolBlockByCallId:{...e.toolBlockByCallId??{}},trimmedToolNotificationByCallId:{...e.trimmedToolNotificationByCallId??{}},permissionBlockByRequestId:{...e.permissionBlockByRequestId??{}},toolProgress:{...e.toolProgress??{}},activeAssistantBlockByParent:{...e.activeAssistantBlockByParent??{}},activeThoughtBlockByParent:{...e.activeThoughtBlockByParent??{}},lastResyncRequired:e.lastResyncRequired!==void 0?{...e.lastResyncRequired}:void 0,lastFollowupSuggestion:e.lastFollowupSuggestion!==void 0?{...e.lastFollowupSuggestion}:void 0}}var Dle="web-shell:goal-status:v1:";/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function ZR(e,t){var n;if(!e)return{models:[]};const s=new Set,r=[];let i=(n=e.current)==null?void 0:n.modelId;const o=e.approvalMode;let a;for(const l of e.providers)for(const c of l.models){!i&&c.isCurrent&&(i=c.modelId),a===void 0&&(i?c.modelId===i:c.isCurrent)&&(a=c.contextLimit);const d=[l.authType,c.modelId,c.baseUrl??"",c.envKey??""].join("\0");s.has(d)||(s.add(d),r.push({id:c.modelId,baseModelId:c.baseModelId,label:c.name||c.modelId,authType:l.authType,...c.contextLimit!==void 0?{contextWindow:c.contextLimit}:{},...c.modalities!==void 0?{modalities:c.modalities}:{},...c.baseUrl!==void 0?{baseUrl:c.baseUrl}:{},...c.envKey!==void 0?{envKey:c.envKey}:{},...c.isRuntime?{isRuntime:!0}:{}}))}return{models:r,currentModel:i,currentMode:o,contextWindow:a}}function Ole(e){var t;const n=Zi((t=e==null?void 0:e.state)==null?void 0:t.models);if(!n)return;const s=Ur(n,"currentModelId")??Ur(n,"currentModel"),r=n.availableModels,i=[];let o;if(Array.isArray(r))for(const a of r){const l=Zi(a),c=Ur(l,"modelId")??Ur(l,"id")??Ur(l,"value");if(!c)continue;const d=Zi(l==null?void 0:l._meta),h=o1(d,"contextLimit")??o1(d,"contextWindow")??o1(l,"contextLimit")??o1(l,"contextWindow");o===void 0&&s!==void 0&&c===s&&(o=h),i.push({id:c,baseModelId:Ur(l,"baseModelId")??Fle(c),label:Ur(l,"name")??Ur(l,"label")??c,...h!==void 0?{contextWindow:h}:{}})}if(!(!s&&i.length===0))return{models:i,currentModel:s,contextWindow:o}}function YH(e){if(!e)return{commands:[],skills:[]};const t=e.availableCommands.map(s=>{var r;return{name:s.name,description:s.description||"",...(r=s.input)!=null&&r.hint?{argumentHint:s.input.hint}:{},...JH(s._meta),raw:s}}),n=e.availableSkills.map(s=>({name:s,description:"",raw:{name:s,description:"",input:null,_meta:{source:"skill"}}}));return{commands:XH(t,n),skills:e.availableSkills}}function ej(e){if(!e)return{commands:[],skills:[]};const t=e.skills.filter(s=>s.status==="ok");return{commands:t.map(s=>({name:s.name,description:s.description||"",...s.argumentHint?{argumentHint:s.argumentHint}:{},raw:{name:s.name,description:s.description||"",input:s.argumentHint?{hint:s.argumentHint}:null,_meta:{source:"skill"}}})),skills:t.map(s=>s.name)}}function XH(...e){const t=new Map;for(const n of e)for(const s of n){const r=t.get(s.name);r?t.set(s.name,{...r,...s,description:s.description||r.description,argumentHint:s.argumentHint??r.argumentHint,raw:s.raw}):t.set(s.name,s)}return[...t.values()]}function Ple(e,t){var n;if(e.type==="session_update"){const s=Zi((n=Zi(e.data))==null?void 0:n.update),r=QH(s);if(r&&t(i=>({...i,tokenUsage:r,tokenCount:PE(r)})),Ur(s,"sessionUpdate")==="available_commands_update"){const{commands:i,skills:o}=zle(s);t(a=>({...a,commands:i,skills:o}))}return}switch(e.type){case"git_branch_changed":{const s=Zi(e.data),r=Ur(s,"workspaceCwd"),i=Ur(s,"branch");t(o=>r&&r!==o.workspaceCwd?o:{...o,gitBranch:i});break}case"session_metadata_updated":{const s=Zi(e.data);Object.prototype.hasOwnProperty.call(s??{},"displayName")&&t(r=>({...r,displayName:Ur(s,"displayName")}));break}case"model_switched":{const s=Ur(Zi(e.data),"modelId");s&&t(r=>({...r,currentModel:s}));break}case"approval_mode_changed":{const s=Zi(e.data),r=Ur(s,"next")??Ur(s,"mode");r&&t(i=>({...i,currentMode:r}));break}}}function tj(e){const t=Ur(e,"displayName");return t!=null&&t.trim()?t:void 0}function Ble(e){var t;const n=Zi((t=e==null?void 0:e.state)==null?void 0:t.modes);return Ur(n,"currentModeId")??Ur(n,"currentMode")}function PE(e){const t=(e==null?void 0:e.inputTokens)??(e==null?void 0:e.totalTokens);if(t!==void 0&&t>0)return t;if(!e)return;const n=Object.values(e).reduce((s,r)=>s+(typeof r=="number"?r:0),0);return n>0?n:void 0}function $le(e){var t;for(let n=e.length-1;n>=0;n--)try{const s=e[n];if(s.type!=="session_update")continue;const r=Zi((t=Zi(s.data))==null?void 0:t.update),i=QH(r);if(i)return i}catch{}}function QH(e){const t=Zi(e==null?void 0:e._meta);if((t==null?void 0:t.parentToolCallId)!==void 0)return;const n=Zi(t==null?void 0:t.usage),s={...Lg(n,"inputTokens"),...Lg(n,"outputTokens"),...Lg(n,"totalTokens"),...Lg(n,"thoughtTokens"),...Lg(n,"cachedReadTokens")};return PE(s)!==void 0?s:void 0}function Lg(e,t){const n=o1(e,t);return n!==void 0&&n>=0?{[t]:n}:{}}function zle(e){if(!e)return{commands:[],skills:[]};const n=(Array.isArray(e.availableCommands)?e.availableCommands:[]).flatMap(i=>{var o;const a=Zi(i),l=Ur(a,"name");if(!l)return[];const c=Zi(a==null?void 0:a.input),d={name:l,description:Ur(a,"description")??"",input:c?{hint:Ur(c,"hint")??""}:null,_meta:Zi(a==null?void 0:a._meta)??null};return[{name:l,description:d.description??"",...(o=d.input)!=null&&o.hint?{argumentHint:d.input.hint}:{},...JH(d._meta),raw:d}]}),s=Array.isArray(e.availableSkills)?e.availableSkills.filter(i=>typeof i=="string"):[],r=s.map(i=>({name:i,description:"",raw:{name:i,description:"",input:null,_meta:{source:"skill"}}}));return{commands:XH(n,r),skills:s}}function JH(e){const n=Ur(e??void 0,"source");return{...n?{source:n}:{}}}function Zi(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function Ur(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function o1(e,t){const n=e==null?void 0:e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Fle(e){const t=e.lastIndexOf(")"),n=e.lastIndexOf("(");return n>=0&&t===e.length-1&&n<t?e.slice(0,n):e}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function nj(e,t=[]){const n=[{type:"text",text:e}];for(const s of t){const r=s.mimeType??s.mediaType??s.media_type;r&&r!=="image/*"?n.push({type:"image",data:s.data,mimeType:r}):n.push({type:"image",data:s.data})}return n}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const qle=3e4;function Hle(e,t,n){const s=Number.isFinite(t)&&t>0?t:1e3,r=Number.isFinite(n)&&n>0?Math.max(s,n):s,i=s*2**Math.max(0,e-1),o=Math.min(i,r),a=.8+Math.random()*.4;return Math.min(r,Math.max(1,Math.round(o*a)))}async function ut(e,t,n=qle){let s;try{return await Promise.race([e,new Promise((r,i)=>{s=setTimeout(()=>{i(new Error(`${t} after ${n}ms`))},n)})])}finally{s!==void 0&&clearTimeout(s)}}function Ule(e,t){return e<=0||t.aborted?Promise.resolve():new Promise(n=>{const s=setTimeout(r,e);function r(){clearTimeout(s),t.removeEventListener("abort",r),n()}t.addEventListener("abort",r,{once:!0})})}function Xr(e){e.current!==void 0&&(clearTimeout(e.current),e.current=void 0)}function Vle(e,t,n="replay",s=80,r){Xr(t),t.current=setTimeout(()=>{t.current=void 0,e.getSnapshot().activeAssistantBlockId&&(e.dispatch({type:"assistant.done",reason:n}),r==null||r())},s)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Wle="qwen-code-webui-client-id:session:";function d3(e,t){if(e)return e;if(typeof window>"u")return h3();try{if(t){const n=window.sessionStorage.getItem(ZH(t));if(n)return n}return h3()}catch{return h3()}}function mx(e,t){if(!(!e||!t||typeof window>"u"))try{window.sessionStorage.setItem(ZH(t),e)}catch{}}async function sj(e){if(!e.clientId)return;const t={"X-Qwen-Client-Id":e.clientId};e.token&&(t.Authorization=`Bearer ${e.token}`);const n=`${Gle(e.baseUrl)}/session/${encodeURIComponent(e.sessionId)}/detach`,s=await fetch(n,{method:"POST",headers:t,keepalive:!0});if(!(s.status===204||s.status===404))throw new Error(`Detach client failed (${s.status})`)}function h3(){return`webui_${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}function ZH(e){return`${Wle}${encodeURIComponent(e)}`}function Gle(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===47;)t-=1;return t===e.length?e:e.slice(0,t)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Kle(e,t){const n={...e};return(!t||e.sessionId===t)&&(delete n.sessionId,delete n.clientId,delete n.displayName,delete n.tokenUsage,delete n.tokenCount,delete n.supportedCommands,delete n.context),{...n,status:"connected",loadingTranscript:void 0,catchingUp:void 0,error:void 0,errorStatus:void 0,missingSession:!1}}function Yle({store:e,sessionRef:t,activePromptsRef:n,settledPromptsRef:s,pendingSessionLoadRef:r,pendingSessionLoadIdRef:i,heartbeatSupportedRef:o,manualSessionClearRef:a,skipNextCleanupDetachSessionIdRef:l,passiveAssistantDoneTimerRef:c,getCreateSessionRequest:d,createDetachedSession:h,getConnection:f,hasSessionActivePrompt:p,resetCurrentSessionActivePrompt:g,addNotice:y,setConnection:w,setPromptStatus:v,setRestoreSessionId:b,setRestoreWorkspaceCwd:x,setRestoreMode:k,setRestoreSessionNonce:T,setAttachSessionNonce:C,setNewSessionNonce:S}){function _(){for(const[,I]of n.current)I.controller.abort();n.current.clear(),s.current.clear(),v("idle"),Xr(c),r.current&&(l.current===r.current.sessionId&&(l.current=void 0),clearTimeout(r.current.timeout),r.current.reject(new DOMException("Session cleared","AbortError")),r.current=void 0),e.reset(),b(void 0),x(void 0)}function L(I,A){const P=i.current+1;return i.current=P,r.current&&(clearTimeout(r.current.timeout),r.current.reject(new DOMException(`Session ${A} superseded by a newer request`,"AbortError"))),new Promise((F,O)=>{const X=setTimeout(()=>{var z;((z=r.current)==null?void 0:z.id)===P&&(r.current=void 0,O($s(y,`${ece(A)} session failed`,new Error(`Session ${A} timed out`),tce(A))))},3e4);r.current={id:P,sessionId:I,mode:A,timeout:X,resolve:F,reject:O}})}function M(I,A,P){var B;a.current=!1;const F=L(I,A),O=t.current,X=O==null?void 0:O.sessionId,z=X?n.current.get(X):void 0;return(B=z==null?void 0:z.reject)==null||B.call(z,new DOMException("Session switch interrupted prompt wait","AbortError")),X&&n.current.delete(X),g(),O&&O.detach().catch(U=>{console.warn("[DaemonSessionActions] detach before session switch failed:",U)}),t.current=void 0,w(U=>({...U,status:"connecting",sessionId:I,clientId:void 0,displayName:void 0,error:void 0,errorStatus:void 0,missingSession:!1,loadingTranscript:!0,catchingUp:void 0})),v("idle"),s.current.clear(),Xr(c),e.reset(),k(A),b(I),x(P??f().workspaceCwd),T(U=>U+1),F.catch(U=>{throw a1(U)||w(D=>({...D,loadingTranscript:void 0,catchingUp:void 0})),U})}return{async sendPrompt(I,A){var P,B,F,O;const X=rr(y,t.current,"Prompt failed","send_prompt"),z=X.sessionId;if(n.current.has(z))throw $s(y,"Prompt failed","A prompt is already in progress","send_prompt");Xr(c),v("waiting");const U=new AbortController;n.current.set(z,{controller:U});try{const D=((A==null?void 0:A.images)??[]).map(ee=>({data:ee.data,mimeType:ee.mimeType||ee.mediaType||ee.media_type||"image/*"})),G=A!=null&&A.inputAnnotations&&A.inputAnnotations.length>0?A.inputAnnotations:void 0;(A==null?void 0:A.optimisticUserMessage)!==!1&&e.appendLocalUserMessage(I,D,G?{inputAnnotations:G}:void 0);const q={prompt:nj(I,D)};G&&(q._meta={inputAnnotations:G}),A!=null&&A.retry&&(q.retry=!0);const N=await X.submitPrompt(q,U.signal);return(P=A==null?void 0:A.onAdmitted)==null||P.call(A),await Xle(n.current,s.current,z,U,N.promptId)}catch(D){if(a1(D))return((B=t.current)==null?void 0:B.sessionId)===z&&e.dispatch({type:"assistant.done",reason:"cancelled"}),{stopReason:"cancelled"};throw $H(D)?D:(((F=t.current)==null?void 0:F.sessionId)===z&&e.dispatch({type:"assistant.done",reason:"error"}),$s(y,"Prompt failed",D,"send_prompt"))}finally{const D=n.current.get(z);(D==null?void 0:D.controller)===U&&n.current.delete(z),((O=t.current)==null?void 0:O.sessionId)===z&&!p()&&v("idle")}},async submitPrompt(I,A){var P;const B=rr(y,t.current,"Prompt failed","send_prompt");if(A!=null&&A.sessionId&&B.sessionId!==A.sessionId)throw new Error("Session changed before prompt submission");const F=((A==null?void 0:A.images)??[]).map(U=>({data:U.data,mimeType:U.mimeType||U.mediaType||U.media_type||"image/*"})),O=A!=null&&A.inputAnnotations&&A.inputAnnotations.length>0?A.inputAnnotations:void 0;(A==null?void 0:A.optimisticUserMessage)!==!1&&e.appendLocalUserMessage(I,F,O?{inputAnnotations:O}:void 0);const X={prompt:nj(I,F)};O&&(X._meta={inputAnnotations:O}),A!=null&&A.retry&&(X.retry=!0);const z=await B.submitPrompt(X);if((P=A==null?void 0:A.signal)!=null&&P.aborted)throw await B.removePendingPrompt(z.promptId).catch(U=>{console.warn("[submitPrompt] removePendingPrompt failed after abort",U),y({severity:"error",category:"user_action",operation:"send_prompt",code:"daemon.send_prompt.pending_cleanup_failed",message:"Prompt was accepted after cancellation but could not be removed from the queue.",debugMessage:U instanceof Error?U.message:String(U),recoverable:!0})}),A.signal.reason??new DOMException("Aborted","AbortError");return{promptId:z.promptId}},async cancel(){var I,A;const P=rr(y,t.current,"Cancel failed","cancel_prompt"),B=n.current.get(P.sessionId);B==null||B.controller.abort(),Xr(c);const F=B?new AbortController:void 0;F&&n.current.set(P.sessionId,{controller:F});try{await ut(P.cancel(),"Cancel timed out")}catch(O){throw $s(y,"Cancel failed",O,"cancel_prompt")}finally{F&&((I=n.current.get(P.sessionId))==null?void 0:I.controller)===F&&n.current.delete(P.sessionId),((A=t.current)==null?void 0:A.sessionId)===P.sessionId&&!p()&&v("idle")}},async setModel(I){const A=rr(y,t.current,"Set model failed","switch_model");try{const P=await ut(A.setModel(I),"Set model timed out");return w(B=>({...B,currentModel:I})),P}catch(P){throw $s(y,"Set model failed",P,"switch_model")}},async setApprovalMode(I,A){const P=rr(y,t.current,"Set approval mode failed","set_approval_mode");try{const B=await ut(P.client.setSessionApprovalMode(P.sessionId,I,{persist:A==null?void 0:A.persist,clientId:P.clientId}),"Set approval mode timed out");return w(F=>({...F,currentMode:B.mode||I})),B}catch(B){throw $s(y,"Set approval mode failed",B,"set_approval_mode")}},async respondToPermission(I,A){const P=rr(y,t.current,"Permission response failed","submit_permission");try{return await ut(P.respondToSessionPermission(I,A),"Permission response timed out")}catch(B){throw $s(y,"Permission response failed",B,"submit_permission")}},async submitPermission(I,A,P){const B=rr(y,t.current,"Permission response failed","submit_permission"),F=A!==void 0&&A.length>0?{outcome:{outcome:"selected",optionId:A},...P?{answers:P}:{}}:{outcome:{outcome:"cancelled"},...P?{answers:P}:{}};try{return await ut(B.respondToSessionPermission(I,F),"Permission response timed out")}catch(O){throw $s(y,"Permission response failed",O,"submit_permission")}},async heartbeat(){const I=t.current;if(!(!I||!o.current))return ut(I.heartbeat(),"Heartbeat timed out")},async listSessions(I){const A=t.current;if(!A)return[];try{return await ut(A.client.listWorkspaceSessions(A.workspaceCwd,I),"List sessions timed out")}catch(P){throw $s(y,"List sessions failed",P,"list_sessions")}},async loadSession(I,A){return M(I,"load",A==null?void 0:A.workspaceCwd)},async resumeSession(I,A){return M(I,"resume",A==null?void 0:A.workspaceCwd)},async createSession(I){try{a.current=!1;const A=(I==null?void 0:I.approvalMode)!==void 0?{approvalMode:I.approvalMode}:{},P=t.current,B=P&&f().sessionId===P.sessionId?P:void 0;if(B){const O=await ut(B.client.createOrAttachSession({...d(),...(I==null?void 0:I.workspaceCwd)!==void 0?{workspaceCwd:I.workspaceCwd}:{},...A}),"Create session timed out");return mx(O.clientId,O.sessionId),O}const F=await ut(h(I==null?void 0:I.workspaceCwd,A),"Create session timed out");if(a.current){try{await ut(F.detach(),"Detach cleared session timed out")}catch(O){console.warn("[DaemonSessionActions] detach after interrupted create failed:",O)}throw new DOMException("Session creation interrupted","AbortError")}return mx(F.clientId,F.sessionId),t.current=F,l.current=F.sessionId,w(O=>({...O,status:"connected",sessionId:F.sessionId,...F.clientId?{clientId:F.clientId}:{},workspaceCwd:F.workspaceCwd,error:void 0,errorStatus:void 0,missingSession:!1})),F}catch(A){throw $s(y,`Create session failed${I!=null&&I.workspaceCwd?` (workspace: ${I.workspaceCwd})`:""}`,A,"create_session")}},async attachSession(){const I=rr(y,t.current,"Attach session failed","attach_session"),A=L(I.sessionId,"attach");return C(P=>P+1),A},async clearSession(){const I=t.current;if(a.current=!0,_(),t.current=void 0,w(A=>Kle(A,I==null?void 0:I.sessionId)),I)try{await ut(I.detach(),"Clear session timed out")}catch(A){console.warn("[DaemonSessionActions] detach on clear failed:",A)}},async newSession(){a.current=!1,_(),w(I=>({...I,missingSession:!1,error:void 0,errorStatus:void 0})),S(I=>I+1)},async releaseSession(I){try{const A=rr(y,t.current,"Release session failed","release_session");await ut(A.client.closeSession(I),"Release session timed out")}catch(A){throw $s(y,"Release session failed",A,"release_session")}},async closeSession(){const I=rr(y,t.current,"Close session failed","close_session");try{await ut(I.close(),"Close session timed out")}catch(A){throw $s(y,"Close session failed",A,"close_session")}},async refreshCommands(){const I=rr(y,t.current,"Refresh commands failed","refresh_commands");try{const A=await ut(I.supportedCommands(),"Refresh commands timed out"),{commands:P,skills:B}=YH(A);w(F=>({...F,commands:P,skills:B,supportedCommands:A}))}catch(A){throw $s(y,"Refresh commands failed",A,"refresh_commands")}},async getContext(){const I=rr(y,t.current,"Load context failed","load_context");try{const A=await ut(I.context(),"Load context timed out");return w(P=>({...P,context:A,currentMode:Qle(A)??P.currentMode,currentModel:Jle(A)??P.currentModel})),A}catch(A){throw $s(y,"Load context failed",A,"load_context")}},async getContextUsage(I){const A=rr(y,t.current,"Load context usage failed","load_context_usage");try{return await ut(A.contextUsage(I),"Load context usage timed out")}catch(P){throw $s(y,"Load context usage failed",P,"load_context_usage")}},async renameSession(I){const A=rr(y,t.current,"Rename session failed","rename_session");try{return await ut(A.updateMetadata({displayName:I}),"Rename session timed out")}catch(P){throw $s(y,"Rename session failed",P,"rename_session")}},async recapSession(){const I=rr(y,t.current,"Recap session failed","recap_session");try{return await ut(I.recap(),"Recap session timed out")}catch(A){throw $s(y,"Recap session failed",A,"recap_session")}},async getRewindSnapshots(){const I=rr(y,t.current,"Load rewind snapshots failed","rewind_snapshots");try{return await ut(I.getRewindSnapshots(),"Load rewind snapshots timed out")}catch(A){throw $s(y,"Load rewind snapshots failed",A,"rewind_snapshots")}},async rewindSession(I,A){const P=rr(y,t.current,"Rewind session failed","rewind_session");try{return await ut(P.rewind(I,A),"Rewind session timed out")}catch(B){throw $s(y,"Rewind session failed",B,"rewind_session")}},async btwSession(I,A){var P;const B=rr(y,t.current,"Side question failed","btw_session");try{return await ut(B.btw(I,A),"Side question timed out")}catch(F){throw(P=A==null?void 0:A.signal)!=null&&P.aborted||a1(F)?F:$s(y,"Side question failed",F,"btw_session")}},async enqueueMidTurnMessage(I,A){const P=t.current;if(!P)return{accepted:!1};try{return await P.enqueueMidTurnMessage(I,A)}catch(B){return B instanceof DOMException&&B.name==="AbortError"||console.debug("[enqueueMidTurnMessage] push failed; kept for next turn",B),{accepted:!1}}},async getPendingPrompts(I){const A=t.current;if(!A)return{pendingPrompts:[]};if(I!=null&&I.sessionId&&A.sessionId!==I.sessionId)throw new Error("Session changed before pending prompts refresh");return await A.getPendingPrompts()},async removePendingPrompt(I,A){const P=t.current;return P?A!=null&&A.sessionId&&P.sessionId!==A.sessionId?await P.client.removePendingPrompt(A.sessionId,I):await P.removePendingPrompt(I):{removed:!1}},async sendShellCommand(I){var A,P;const B=rr(y,t.current,"Shell command failed","send_shell_command"),F=`${B.sessionId}:shell`;v("waiting");const O=new AbortController;n.current.set(F,{controller:O});try{return await B.shellCommand(I,O.signal)}catch(X){throw $s(y,"Shell command failed",X,"send_shell_command")}finally{((A=n.current.get(F))==null?void 0:A.controller)===O&&n.current.delete(F),((P=t.current)==null?void 0:P.sessionId)===B.sessionId&&!p()&&v("idle")}},async getTasks(){const I=rr(y,t.current,"Get tasks failed","load_tasks");try{return await ut(I.tasks(),"Get tasks timed out")}catch(A){throw $s(y,"Get tasks failed",A,"load_tasks")}},async cancelTask(I,A){const P=rr(y,t.current,"Cancel task failed","cancel_task");try{return await ut(P.cancelTask(I,A),"Cancel task timed out")}catch(B){throw $s(y,"Cancel task failed",B,"cancel_task")}},async clearGoal(){const I=rr(y,t.current,"Clear goal failed","clear_goal");try{return await ut(I.clearGoal(),"Clear goal timed out")}catch(A){throw $s(y,"Clear goal failed",A,"clear_goal")}},async getStats(){const I=rr(y,t.current,"Load stats failed","load_stats");try{return await ut(I.stats(),"Load stats timed out")}catch(A){throw $s(y,"Load stats failed",A,"load_stats")}},async loadArtifacts(){const I=rr(y,t.current,"Load artifacts failed","load_artifacts");try{return await ut(I.artifacts(),"Load artifacts timed out")}catch(A){throw $s(y,"Load artifacts failed",A,"load_artifacts")}},async respondToGlobalPermission(I,A){const P=rr(y,t.current,"Global permission response failed","submit_permission");try{return await ut(P.client.respondToPermission(I,A),"Global permission response timed out")}catch(B){throw $s(y,"Global permission response failed",B,"submit_permission")}},async branchSession(I){const A=rr(y,t.current,"Branch session failed","branch_session");try{const P=await ut(A.client.branchSession(A.sessionId,{name:I},A.clientId),"Branch session timed out");return mx(P.clientId,P.sessionId),M(P.sessionId,"load").catch(B=>{a1(B)||$s(y,"Branch session failed",B,"branch_session")}),{sessionId:P.sessionId,displayName:P.displayName}}catch(P){throw $s(y,"Branch session failed",P,"branch_session")}},async forkSession(I){const A=rr(y,t.current,"Fork session failed","fork_session");try{return await ut(A.fork(I),"Fork session timed out")}catch(P){throw $s(y,"Fork session failed",P,"fork_session")}}}}function Xle(e,t,n,s,r){return new Promise((i,o)=>{const a=W6(n,r),l=t.get(a);if(l){t.delete(a),l.status==="resolved"?i(l.result):o(l.error);return}const c=e.get(n);if((c==null?void 0:c.controller)!==s){o(new DOMException("Aborted","AbortError"));return}if(c.promptId!==void 0&&c.promptId!==r){o(new Error(`Prompt accepted with unexpected id ${r}`));return}if(s.signal.aborted){e.delete(n),o(s.signal.reason??new DOMException("Aborted","AbortError"));return}const d=()=>{s.signal.removeEventListener("abort",h)},h=()=>{const f=e.get(n);(f==null?void 0:f.controller)===s&&e.delete(n),d(),o(s.signal.reason??new DOMException("Aborted","AbortError"))};e.set(n,{...c,promptId:r,resolve:f=>{d(),i(f)},reject:f=>{d(),o(f)}}),s.signal.addEventListener("abort",h,{once:!0})})}function W6(e,t){return JSON.stringify([e,t])}function Qle(e){const t=typeof e.state.modes=="object"&&e.state.modes!==null?e.state.modes:void 0,n=(t==null?void 0:t.currentModeId)??(t==null?void 0:t.currentMode);return typeof n=="string"?n:void 0}function Jle(e){const t=typeof e.state.models=="object"&&e.state.models!==null?e.state.models:void 0,n=(t==null?void 0:t.currentModelId)??(t==null?void 0:t.currentModel);return typeof n=="string"?n:void 0}function rr(e,t,n,s){if(!t)throw $s(e,n,"Daemon session is not connected",s);return t}function $s(e,t,n,s){if(a1(n)){if(n instanceof Error)return n;const i=n instanceof DOMException?n.message:"Aborted",o=new Error(i);return o.name="AbortError",o}const r=n instanceof Error?n.message:String(n);return e({severity:"error",category:"user_action",operation:s,code:`daemon.${s}.failed`,message:`${t}: ${r}`,debugMessage:r,recoverable:!0}),Zle(n instanceof Error?n:new Error(r))}function a1(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function Zle(e){return Object.assign(e,{_alreadyDispatched:!0})}function ece(e){return e.charAt(0).toUpperCase()+e.slice(1)}function tce(e){return e==="resume"?"resume_session":e==="attach"?"attach_session":"load_session"}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const nce=33e4;function sce({getClient:e,getWorkspaceCwd:t,baseUrl:n,token:s}){return{async listSessions(r){const i=Qt(e,"List sessions failed"),o=t();return o?ut(i.listWorkspaceSessionsPage(o,r).then(a=>a.sessions),"List sessions timed out"):[]},async listSessionsPage(r){const i=Qt(e,"List sessions failed"),o=t();return o?ut(i.listWorkspaceSessionsPage(o,r),"List sessions timed out"):{sessions:[]}},async listSessionGroups(){const r=Qt(e,"List session groups failed"),i=t();return i?ut(r.listSessionGroups(i),"List session groups timed out"):{groups:[],colorOptions:[]}},async createSessionGroup(r){const i=Qt(e,"Create session group failed"),o=f3(t);return ut(i.createSessionGroup(o,r),"Create session group timed out")},async updateSessionGroup(r,i){const o=Qt(e,"Update session group failed"),a=f3(t);return ut(o.updateSessionGroup(a,r,i),"Update session group timed out")},async deleteSessionGroup(r){const i=Qt(e,"Delete session group failed"),o=f3(t);return ut(i.deleteSessionGroup(o,r),"Delete session group timed out")},async updateSessionOrganization(r,i){const o=Qt(e,"Update session organization failed");return ut(o.updateSessionOrganization(r,i),"Update session organization timed out")},async deleteSession(r){const i=Qt(e,"Delete session failed"),o=await ut(i.deleteSessionsData([r]),"Delete session timed out");if(o.errors.length>0)throw new Error(o.errors[0].error);return o.removed.length>0||o.notFound.length>0},async deleteSessions(r){const i=Qt(e,"Delete sessions failed");return ut(i.deleteSessionsData(r),"Delete sessions timed out")},async exportSession(r,i="html"){const o=Qt(e,"Export session failed");return ut(o.exportSession(r,{format:i}),"Export session timed out")},async archiveSession(r){const i=Qt(e,"Archive session failed"),o=await ut(i.archiveSessionsData([r]),"Archive session timed out");if(o.errors.length>0)throw new Error(o.errors[0].error);return o.archived.length>0||o.alreadyArchived.length>0},async unarchiveSession(r){const i=Qt(e,"Unarchive session failed"),o=await ut(i.unarchiveSessionsData([r]),"Unarchive session timed out");if(o.errors.length>0)throw new Error(o.errors[0].error);return o.unarchived.length>0||o.alreadyActive.length>0},async loadMcpStatus(){const r=Qt(e,"Load MCP status failed");return ut(r.workspaceMcp(),"Load MCP status timed out")},async loadMcpTools(r){const i=Qt(e,"Load MCP tools failed");try{return await ut(i.workspaceMcpTools(r),"Load MCP tools timed out")}catch{return{v:1,workspaceCwd:"",serverName:r,initialized:!1,acpChannelLive:!1,tools:[],errors:[{kind:"mcp_tools",status:"error",error:"The connected daemon does not expose MCP tool details."}]}}},async loadMcpResources(r){const i=Qt(e,"Load MCP resources failed");try{return await ut(i.workspaceMcpResources(r),"Load MCP resources timed out")}catch{return{v:1,workspaceCwd:"",serverName:r,initialized:!1,acpChannelLive:!1,resources:[],errors:[{kind:"mcp_resources",status:"error",error:"The connected daemon does not expose MCP resource details."}]}}},async restartMcpServer(r){const i=Qt(e,"Restart MCP server failed");return ut(i.restartMcpServer(r),"Restart MCP server timed out",5*6e4)},async manageMcpServer(r,i){const o=Qt(e,"Manage MCP server failed"),a=i==="authenticate"?10*6e4:5*6e4;return ut(o.manageMcpServer(r,i),"Manage MCP server timed out",a)},async loadDaemonStatus(r){const i=Qt(e,"Load daemon status failed");return ut(i.daemonStatus(r),"Load daemon status timed out")},async loadUsageDashboard(r){const i=Qt(e,"Load usage dashboard failed");return ut(i.usageDashboard(r),"Load usage dashboard timed out")},async loadSkillsStatus(){const r=Qt(e,"Load skills failed");return ut(r.workspaceSkills(),"Load skills timed out")},async loadExtensionsStatus(){const r=Qt(e,"Load extensions failed");return ut(r.workspaceExtensions(),"Load extensions timed out")},async loadToolsStatus(){const r=Qt(e,"Load tools failed");return ut(r.workspaceTools(),"Load tools timed out")},async setWorkspaceToolEnabled(r,i){const o=Qt(e,"Set tool enabled failed");return ut(o.setWorkspaceToolEnabled(r,i),"Set tool enabled timed out")},async loadSettingsStatus(){const r=Qt(e,"Load settings failed");return ut(r.workspaceSettings(),"Load settings timed out")},async setWorkspaceSetting(r,i,o){const a=Qt(e,"Set setting failed");return ut(a.setWorkspaceSetting(r,i,o),"Set setting timed out")},async loadMemoryStatus(){const r=Qt(e,"Load memory failed");return ut(r.workspaceMemory(),"Load memory timed out")},async readWorkspaceFile(r){const i=Qt(e,"Read workspace file failed");return ut(i.readWorkspaceFile(r),"Read workspace file timed out")},async writeMemory(r){const i=Qt(e,"Write memory failed");return ut(i.writeWorkspaceMemory(r),"Write memory timed out")},async listAgents(){const r=Qt(e,"List agents failed");return ut(r.listWorkspaceAgents(),"List agents timed out")},async getAgent(r){const i=Qt(e,"Get agent failed");return ut(i.getWorkspaceAgent(r),"Get agent timed out")},async createAgent(r){const i=Qt(e,"Create agent failed");return ut(i.createWorkspaceAgent(r),"Create agent timed out")},async generateAgent(r){const i=Qt(e,"Generate agent failed");return ut(i.generateWorkspaceAgent(r),"Generate agent timed out",nce)},async deleteAgent(r,i){const o=Qt(e,"Delete agent failed");return ut(o.deleteWorkspaceAgent(r,i?{scope:i}:{}),"Delete agent timed out")},async globWorkspace(r,i){Qt(e,"Glob workspace failed");const o=fd(n,"/glob");o.searchParams.set("pattern",r),(i==null?void 0:i.maxResults)!==void 0&&o.searchParams.set("maxResults",String(i.maxResults)),(i==null?void 0:i.includeIgnored)!==void 0&&o.searchParams.set("includeIgnored",i.includeIgnored?"1":"0"),(i==null?void 0:i.cwd)!==void 0&&o.searchParams.set("cwd",i.cwd);const a=await ut(fetch(md(o,n),{headers:Og(s)}),"Glob workspace timed out");if(!a.ok)throw new Error(await pd(a,"GET /glob"));const l=await a.json();return{matches:Array.isArray(l.matches)?l.matches.filter(c=>typeof c=="string"):[]}},async loadProviders(){const r=Qt(e,"Load providers failed");return ut(r.workspaceProviders(),"Load providers timed out")},async readFileBytes(r,i){const o=Qt(e,"Read file bytes failed");return ut(o.readWorkspaceFileBytes(r,i??{}),"Read file bytes timed out")},async writeFile(r){const i=Qt(e,"Write file failed");return ut(i.writeWorkspaceFile(r),"Write file timed out")},async editFile(r){const i=Qt(e,"Edit file failed");return ut(i.editWorkspaceFile(r),"Edit file timed out")},async stat(r){Qt(e,"Stat file failed");const i=fd(n,"/stat");i.searchParams.set("path",r);const o=await ut(fetch(md(i,n),{headers:Og(s)}),"Stat file timed out");if(!o.ok)throw new Error(await pd(o,"GET /stat"));return await o.json()},async listDirectory(r){Qt(e,"List directory failed");const i=fd(n,"/list");i.searchParams.set("path",r);const o=await ut(fetch(md(i,n),{headers:Og(s)}),"List directory timed out");if(!o.ok)throw new Error(await pd(o,"GET /list"));return await o.json()},async listScheduledTasks(r){Qt(e,"List scheduled tasks failed");const i=Dg(r),o=fd(n,i),a=await ut(fetch(md(o,n),{headers:Og(s)}),"List scheduled tasks timed out");if(!a.ok)throw new Error(await pd(a,`GET ${i}`));const l=await a.json();return Array.isArray(l.tasks)?l.tasks:[]},async createScheduledTask(r,i){Qt(e,"Create scheduled task failed");const o=Dg(i),a=fd(n,o),l=await ut(fetch(md(a,n),{method:"POST",headers:m3(s),body:JSON.stringify(r)}),"Create scheduled task timed out");if(!l.ok)throw new Error(await pd(l,`POST ${o}`));return await l.json()},async updateScheduledTask(r,i,o){Qt(e,"Update scheduled task failed");const a=Dg(o,`/${encodeURIComponent(r)}`),l=fd(n,a),c=await ut(fetch(md(l,n),{method:"PATCH",headers:m3(s),body:JSON.stringify(i)}),"Update scheduled task timed out");if(!c.ok)throw new Error(await pd(c,`PATCH ${a}`));return await c.json()},async runScheduledTask(r,i){Qt(e,"Run scheduled task failed");const o=Dg(i,`/${encodeURIComponent(r)}/run`),a=fd(n,o),l=await ut(fetch(md(a,n),{method:"POST",headers:m3(s)}),"Run scheduled task timed out");if(!l.ok)throw new Error(await pd(l,`POST ${o}`));return await l.json()},async deleteScheduledTask(r,i){Qt(e,"Delete scheduled task failed");const o=Dg(i,`/${encodeURIComponent(r)}`),a=fd(n,o),l=await ut(fetch(md(a,n),{method:"DELETE",headers:Og(s)}),"Delete scheduled task timed out");if(!l.ok)throw new Error(await pd(l,`DELETE ${o}`))},async loadEnv(){const r=Qt(e,"Load env failed");return ut(r.workspaceEnv(),"Load env timed out")},async loadPreflight(){const r=Qt(e,"Load preflight failed");return ut(r.workspacePreflight(),"Load preflight timed out")},async initWorkspace(r){const i=Qt(e,"Init workspace failed");return ut(i.initWorkspace(r),"Init workspace timed out")},async updateAgent(r,i,o){const a=Qt(e,"Update agent failed");return ut(a.updateWorkspaceAgent(r,i,o?{scope:o}:{}),"Update agent timed out")},async installExtension(r,i){const o=Qt(e,"Install extension failed");return ut(o.installExtension(r,i),"Install extension timed out")},async extensionOperationStatus(r){const i=Qt(e,"Load extension operation failed");return ut(i.extensionOperationStatus(r),"Load extension operation timed out")},async checkExtensionUpdates(r){const i=Qt(e,"Check extension updates failed");return ut(i.checkExtensionUpdates(r),"Check extension updates timed out")},async refreshExtensions(r){const i=Qt(e,"Refresh extensions failed");return ut(i.refreshExtensions(r),"Refresh extensions timed out")},async enableExtension(r,i,o){const a=Qt(e,"Enable extension failed");return ut(a.enableExtension(r,i,o),"Enable extension timed out")},async disableExtension(r,i,o){const a=Qt(e,"Disable extension failed");return ut(a.disableExtension(r,i,o),"Disable extension timed out")},async updateExtension(r,i){const o=Qt(e,"Update extension failed");return ut(o.updateExtension(r,i),"Update extension timed out")},async uninstallExtension(r,i){const o=Qt(e,"Uninstall extension failed");return ut(o.uninstallExtension(r,i),"Uninstall extension timed out")},async startDeviceFlow(r){const i=Qt(e,"Start device flow failed");return ut(i.startDeviceFlow({providerId:r}),"Start device flow timed out")},async getDeviceFlow(r,i){const o=Qt(e,"Get device flow failed");return ut(o.getDeviceFlow(r,i),"Get device flow timed out")},async cancelDeviceFlow(r){const i=Qt(e,"Cancel device flow failed");return ut(i.cancelDeviceFlow(r),"Cancel device flow timed out")},async getAuthStatus(){const r=Qt(e,"Get auth status failed");return ut(r.getAuthStatus(),"Get auth status timed out")},async getAuthProviders(){const r=Qt(e,"Get auth providers failed");return ut(r.getAuthProviders(),"Get auth providers timed out")},async installAuthProvider(r){const i=Qt(e,"Install auth provider failed");return ut(i.installAuthProvider(r),"Install auth provider timed out")},async deleteModel(r){const i=Qt(e,"Delete model failed");return ut(i.deleteModel(r),"Delete model timed out")},async addWorkspace(r,i){const o=Qt(e,"Add workspace failed");return ut(o.addWorkspace(r,i),"Add workspace timed out")},async removeWorkspace(r,i){const a=Qt(e,"Remove workspace failed").workspaceById(r).remove(i);return(i==null?void 0:i.timeoutMs)===0?a:ut(a,"Remove workspace timed out",i==null?void 0:i.timeoutMs)}}}function Qt(e,t){const n=e();if(!n)throw new Error(`${t}: DaemonClient is not connected`);return n}function f3(e){const t=e();if(!t)throw new Error("Daemon workspace is not connected");return t}function Dg(e,t=""){return e?`/workspaces/${encodeURIComponent(e)}/scheduled-tasks${t}`:`/scheduled-tasks${t}`}function Og(e){const t={};return e&&(t.Authorization=`Bearer ${e}`),t}function m3(e){const t={"Content-Type":"application/json"};return e&&(t.Authorization=`Bearer ${e}`),t}function fd(e,t){const n=eU(e),s=typeof window>"u"?"http://localhost":window.location.origin;return new URL(`${n}${t}`,s)}function md(e,t){return eU(t)?e.toString():`${e.pathname}${e.search}`}function eU(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===47;)t--;return t===e.length?e:e.slice(0,t)}async function pd(e,t){try{const n=await e.json(),s=typeof n.error=="string"?n.error:typeof n.message=="string"?n.message:void 0;return s?`${t}: ${s}`:`${t}: HTTP ${e.status}`}catch{return`${t}: HTTP ${e.status}`}}const BE=m.createContext(void 0);let Pg;function rce({baseUrl:e,token:t,workspaceCwd:n,autoConnect:s=!0,transport:r,children:i}){const o=m.useMemo(()=>s?new $6({baseUrl:e,token:t,transport:r}):void 0,[s,e,t,r]),a=m.useRef(o);a.current=o;const l=m.useRef(void 0),c=m.useRef(void 0),d=m.useRef(n),[h,f]=m.useState(void 0),[p,g]=m.useState(s?"connecting":"idle"),[y,w]=m.useState(void 0),v=m.useCallback(()=>{if(!o)return Promise.reject(new Error("Daemon workspace client unavailable"));if(l.current!==o&&(l.current=o,c.current=void 0),!c.current){const T=o.capabilities().catch(C=>{throw c.current===T&&(c.current=void 0),C});c.current=T}return c.current},[o]),b=m.useCallback(()=>{if(!o)return Promise.reject(new Error("Daemon workspace client unavailable"));l.current=o;const T=o.capabilities().catch(C=>{throw c.current===T&&(c.current=void 0,w(C instanceof Error?C:new Error(String(C))),g("error")),C});return c.current=T,T.then(C=>(l.current===o&&c.current===T&&(f(C),g("connected"),w(void 0)),C))},[o]);m.useEffect(()=>{if(!o)return;g("connecting"),w(void 0),f(void 0),Pg===o&&(Pg=void 0);let T=!1;return v().then(C=>{T||(f(C),g("connected"))}).catch(C=>{T||(w(C instanceof Error?C:new Error(String(C))),g("error"))}),()=>{T=!0,Pg=o,queueMicrotask(()=>{Pg===o&&(Pg=void 0,o.dispose())})}},[o,v]),d.current=(h==null?void 0:h.workspaceCwd)??n;const x=m.useMemo(()=>sce({getClient:()=>a.current,getWorkspaceCwd:()=>d.current,baseUrl:e,token:t}),[e,t]),k=m.useMemo(()=>{if(o)return{client:o,token:t,baseUrl:e,workspaceCwd:(h==null?void 0:h.workspaceCwd)??n,status:p,error:y,capabilities:h,getCapabilities:v,refreshCapabilities:b,actions:x}},[o,t,e,n,p,y,h,v,b,x]);return u.jsx(BE.Provider,{value:k,children:i})}function Dh(){const e=m.useContext(BE);if(!e)throw new Error("useDaemonWorkspace must be used within DaemonWorkspaceProvider");return e}function $o(){return Dh().actions}function tU(){return m.useContext(BE)}function ice(e){if(e.length===0)return"idle";const t=e[e.length-1];if((t==null?void 0:t.kind)==="thought"&&rj(t))return"thinking";if((t==null?void 0:t.kind)==="assistant"&&rj(t)||(t==null?void 0:t.kind)==="tool"&&ij(t))return"responding";for(let n=e.length-1;n>=0;n--){const s=e[n];if(s.kind==="user")break;if(s.kind==="tool"&&ij(s))return"responding"}return"idle"}function oce(e,t){const n=ice(e);return t==="idle"?"idle":n!=="idle"||t===void 0?n:t==="waiting"?"waiting":"responding"}function rj(e){return e.streaming===!0}function ij(e){return e.status==="running"||e.status==="in_progress"}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const G6=new Set;let Sk;function oj(){return Sk}function ace(e){return G6.add(e),()=>{G6.delete(e)}}function lce(e){Sk={...e},nU()}function Pv(){Sk!==void 0&&(Sk=void 0,nU())}function nU(){for(const e of G6)e()}function cce(e){if(!e||typeof e!="object")return;const t=e;if(t.type!=="followup_suggestion")return;const n=t.data;if(!n||typeof n!="object")return;const s=n,r=s.sessionId,i=s.suggestion,o=s.promptId;if(!(typeof r!="string"||typeof i!="string"||i.length===0||typeof o!="string"))return{sessionId:r,suggestion:i,promptId:o}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const K6=new Set,sU=Object.freeze([]),p3=64;let Vd=sU;function aj(){return Vd}function uce(e){return K6.add(e),()=>{K6.delete(e)}}function dce(e){const t=[...Vd,{sessionId:e.sessionId,messages:[...e.messages],...e.originatorClientId?{originatorClientId:e.originatorClientId}:{}}];if(t.length>p3){const n=t.length-p3;console.debug(`[mid-turn] sidechannel buffer over ${p3}; evicting ${n} oldest batch(es)`),Vd=t.slice(n)}else Vd=t;rU()}function hce(e){if(e.length===0||Vd.length===0)return;const t=new Set(e),n=Vd.filter(s=>!t.has(s));n.length!==Vd.length&&(Vd=n.length===0?sU:n,rU())}function rU(){for(const e of K6)e()}function fce(e){if(!e||typeof e!="object")return;const t=e;if(t.type!==zH)return;const n=t.data;if(!n||typeof n!="object")return;const s=n,r=s.sessionId,i=s.messages;if(typeof r!="string"||!Array.isArray(i))return;const o=i.filter(l=>typeof l=="string"&&l.length>0);if(o.length===0)return;const a=t.originatorClientId;return{sessionId:r,messages:o,...typeof a=="string"?{originatorClientId:a}:{}}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Y6=new Set,X6=new Set;let iU=0,Wp=[];function mce(){return iU}function lj(){return Wp}function pce(e){return Y6.add(e),()=>{Y6.delete(e)}}function gce(e){return X6.add(e),()=>{X6.delete(e)}}function yce(){iU++;for(const e of Y6)try{e()}catch(t){console.error("[pendingPromptVersion] listener error",t)}}function oU(){for(const e of X6)try{e()}catch(t){console.error("[pendingPromptEvents] listener error",t)}}function bce(e){if(e.length===0)return;const t=new Set(e),n=Wp.filter(s=>!t.has(s));n.length!==Wp.length&&(Wp=n,oU())}function vce(e){const t=aU(e);return t?(Wp=[...Wp,t].slice(-200),oU(),(t.type===TE||t.type===EE||t.type===AE)&&yce(),!0):!1}function wce(e){return aU(e)!==void 0}function aU(e){if(!e||typeof e!="object")return;const t=e,n=t.type,s=t.data;if(!s||typeof s!="object")return;const r=s;if(typeof r.sessionId=="string"&&((n===TE||n===EE||n===AE)&&typeof r.promptId=="string"||(n==="turn_complete"||n==="turn_error")&&typeof r.promptId=="string"))return e}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const lU=[404,410],xce=new Set(lU);function $1(e){return e!==void 0&&xce.has(e)}function Ql(e,t){return $1(t)&&!$1(e)?t:e}function Md(e,t){const n=HH(e);return{type:"assistant.done",reason:t,eventId:e.id,...n!==void 0?{serverTimestamp:n}:{}}}const cU=m.createContext(void 0),uU=m.createContext(void 0),$E=m.createContext(void 0),dU=m.createContext(void 0),hU=m.createContext(void 0),fU=m.createContext(void 0),zE=new Set([401,403]),kce=new Set([...zE,...lU]),_ce=2e5,Sce={memoryVersion:0,agentsVersion:0,toolsVersion:0,settingsVersion:0,mcpVersion:0,extensionsVersion:0,artifactsVersion:0,initVersion:0,authVersion:0},Cce=Symbol("unhandled session");function mU(e){const{baseUrl:t,token:n,workspaceCwd:s,sessionId:r,clientId:i,createSessionRequest:o,maxQueued:a=1024,maxBlocks:l=_ce,suppressOwnUserEcho:c=!0,includeRawEvent:d=!1,autoConnect:h=!0,autoReconnect:f=!0,reconnectDelayMs:p=1e3,maxReconnectDelayMs:g=1e4,heartbeatIntervalMs:y=3e4,heartbeatFailureThreshold:w=3,loadWarnings:v,children:b}=e,x=tU(),k=t??(x==null?void 0:x.baseUrl),T=n??(x==null?void 0:x.token),C=s??(x==null?void 0:x.workspaceCwd),S=m.useRef(x==null?void 0:x.client);S.current=x==null?void 0:x.client;const _=m.useRef(x==null?void 0:x.capabilities);_.current=x==null?void 0:x.capabilities;const L=m.useRef(x==null?void 0:x.getCapabilities);L.current=x==null?void 0:x.getCapabilities;const M=m.useRef(!1),A=m.useRef(r).current,P=A===void 0,B=m.useRef(C);B.current=C;const F=m.useRef(C);C&&(F.current=C);const O=m.useMemo(()=>jle({maxBlocks:l}),[l]),X=m.useRef(void 0),z=m.useRef(void 0),U=m.useRef(new Map),D=m.useRef(new Map),G=m.useRef(void 0),q=m.useRef(0),N=m.useRef(void 0),ee=m.useRef(!1),re=m.useRef({consecutiveFailures:0}),Q=m.useRef(!1),K=m.useRef(void 0),se=m.useRef(new WeakSet),te=m.useRef({suppressOwnUserEcho:c,includeRawEvent:d}),ce=m.useRef({reconnectDelayMs:p,maxReconnectDelayMs:g}),oe=m.useRef(v),de=m.useRef(void 0);(!de.current||i)&&(de.current=d3(i)),te.current={suppressOwnUserEcho:c,includeRawEvent:d},ce.current={reconnectDelayMs:p,maxReconnectDelayMs:g},oe.current=v;const Te=o==null?void 0:o.modelServiceId,qe=o==null?void 0:o.sessionScope,Ne=m.useRef(o);Ne.current=o;const[ge,Ee]=m.useState("idle"),[_t,Ct]=m.useState(A),[Je,at]=m.useState(void 0),[Oe,Fe]=m.useState("load"),[ue,vt]=m.useState(0),[ye,je]=m.useState(0),[Ye,Nt]=m.useState(0),[Rt,rn]=m.useState({status:h?"connecting":"idle",...A?{sessionId:A}:{}}),on=m.useRef(Rt);on.current=Rt,m.useEffect(()=>{x!=null&&x.capabilities&&rn(wt=>wt.capabilities===x.capabilities?wt:{...wt,capabilities:x.capabilities})},[x==null?void 0:x.capabilities]);const Bn=m.useRef(0),[bs,Ss]=m.useState([]),Ie=m.useCallback(wt=>{const It={...wt,id:wt.id??`daemon-notice-${Date.now()}-${++Bn.current}`,createdAt:wt.createdAt??Date.now()};return Ss(Vn=>Vn.some(kn=>kn.id===It.id)?Vn:[...Vn.slice(-49),It]),It},[]),lt=m.useCallback(wt=>{Ss(It=>It.filter(Vn=>Vn.id!==wt))},[]),ne=m.useCallback(()=>{Ss([])},[]),he=m.useMemo(()=>({notices:bs,dismissNotice:lt,clearNotices:ne}),[ne,lt,bs]),[Ve,we]=m.useState(Sce),Bt=m.useRef(()=>!1),Et=m.useRef(!1);m.useEffect(()=>(Et.current=!0,()=>{Et.current=!1}),[]),m.useEffect(()=>{if(!h)return;if(!S.current&&!k){rn({status:"error",error:"DaemonSessionProvider requires a baseUrl prop or an ancestor DaemonWorkspaceProvider."});return}const wt=new AbortController;let It=!1;return(async()=>{var kn,ln,Wn,Jn,Cs,fr,Xs,Vs,_n,fn,qn;const Zn=S.current??new $6({baseUrl:k,token:T});let $n,es,ss=_t,Ps=!_t&&Ye>0,jr=0,Ui=()=>!1,Bs=!1;for(;!It&&!wt.signal.aborted;){let zr=!1;try{let gs=!1,ts=!1,mn=!1,Rn=!1,br,Se;if(!$n){const Xe=X.current;Xe&&!_t&&!ss&&!Ps&&($n=Xe,ss=Xe.sessionId,z.current=Xe.sessionId,Rn=!0)}if(!$n){rn(Pe=>({...Pe,status:"connecting",error:void 0,errorStatus:Ql(void 0,Pe.errorStatus)}));const Xe=L.current,Ft=_.current??(Xe?await Xe():await Zn.capabilities());if(It||wt.signal.aborted)return;es=Ft,ee.current=Array.isArray(Ft.features)&&Ft.features.includes("client_heartbeat");const zn=Je??B.current??Ft.workspaceCwd;if(F.current=zn,(P||Q.current)&&!_t&&!ss&&!Ps){const[Pe,ct,pt,gn]=await Promise.allSettled([Zn.workspaceProviders(),Zn.workspaceSkills(),Zn.workspaceAcpStatus(),zn?Zn.workspaceByCwd(zn).workspaceGit():Zn.workspaceGit()]);Pe.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceProviders failed in deferred connect:",Pe.reason),ct.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceSkills failed in deferred connect:",ct.reason),pt.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceAcpStatus failed in deferred connect:",pt.reason);const pn=Pe.status==="fulfilled"?Pe.value:void 0,Ln=ZR(pn),{commands:is,skills:Sr}=ej(ct.status==="fulfilled"?ct.value:void 0),si=ct.status==="rejected"||Q.current&&is.length===0;rn(ri=>({...ri,status:"connected",workspaceCwd:zn,gitBranch:gn.status==="fulfilled"?gn.value.branch??void 0:void 0,models:Ln.models,currentModel:Ln.currentModel,currentMode:Ln.currentMode,contextWindow:Ln.contextWindow,providers:pn,capabilities:Ft,commands:si?ri.commands:is,skills:si?ri.skills:Sr})),pt.status==="fulfilled"&&!pt.value.channelLive&&!M.current&&(M.current=!0,(async()=>{try{const ri=await Zn.workspaceAcpPreheat(5e3);if(It||wt.signal.aborted||!ri.ready||on.current.sessionId)return;const Ha=await Zn.workspaceSkills();if(It||wt.signal.aborted||on.current.sessionId)return;const{commands:Fo,skills:Ua}=ej(Ha);rn(lo=>lo.sessionId?lo:{...lo,commands:Fo,skills:Ua})}catch(ri){console.warn("[DaemonSessionProvider] ACP preheat for workspace skills failed:",ri)}finally{M.current=!1}})());return}const gi=_t&&Oe==="resume"?jg.resume:jg.load,Us=_t??ss,ni=i?de.current:d3(void 0,Us);zr=!!_t,Us&&rn(Pe=>({...Pe,sessionId:Us,error:void 0,errorStatus:void 0,missingSession:!1,loadingTranscript:!0}));const rs=_t?await gi(Zn,_t,{workspaceCwd:zn},ni):ss?await jg.load(Zn,ss,{workspaceCwd:zn},ni):await jg.createOrAttach(Zn,{...Te!==void 0?{modelServiceId:Te}:{},...Ps?{sessionScope:"thread"}:qe!==void 0?{sessionScope:qe}:{},workspaceCwd:zn},ni);if(zr=!1,!i&&rs.clientId&&(de.current=rs.clientId,mx(rs.clientId,rs.sessionId)),It||wt.signal.aborted){sj({baseUrl:k,token:T,sessionId:rs.sessionId,clientId:rs.clientId}).catch(Pe=>console.warn("[DaemonSessionProvider] detach failed:",Pe));return}const Fr=z.current;Fr!==rs.sessionId&&ne(),Fr!==void 0&&rs.sessionId!==Fr?(Ee("idle"),Xr(N),mn=!0):Fr!==void 0&&(rs.replaySnapshot.compactedReplay.length+rs.replaySnapshot.liveJournal.length>0?(Ee("idle"),Xr(N),mn=!0):(O.dispatch({type:"assistant.done",reason:"reconnected"}),O.getSnapshot().awaitingResync&&O.clearAwaitingResync())),gs=Fr!==void 0&&Fr===rs.sessionId,ts=rs.replaySnapshot.compactedReplay.length>0||rs.replaySnapshot.liveJournal.length>0;const qa=[...rs.replaySnapshot.compactedReplay,...rs.replaySnapshot.liveJournal];br=$le(qa),Se=PE(br),$n=rs,ss=$n.sessionId,Ps=!1,z.current=$n.sessionId,X.current=$n}const xe=$n,kt=se.current.has(xe);let Ot=xe.hasActivePrompt===!0&&!kt;const xt=()=>{se.current.add(xe),Ot=!1},An=()=>Ot||U.current.has(xe.sessionId);Ui=An,Bt.current=An,Ee(An()?"streaming":"idle");const Gn=G.current,Js=(Gn==null?void 0:Gn.sessionId)===xe.sessionId?Gn:void 0,{compactedReplay:jn,liveJournal:yn}=xe.replaySnapshot,Mn=[...jn,...yn],Lr=ts&&Mn.length>0;if(mn&&!Lr&&O.reset(),Lr){const Xe={...te.current,suppressOwnUserEcho:!1},Ft=[];for(const zn of Mn)try{const gi=uj(zn,xe.clientId,Xe,rn,{updateConnection:!1});if(Ft.push(...dj(zn,gi,Ie,lt)),zn.type==="turn_complete"){const Us=((kn=zn.data)==null?void 0:kn.stopReason)??"end_turn";Ft.push(Md(zn,Us))}else zn.type==="turn_error"&&Ft.push(Md(zn,"error"))}catch(gi){const Us=gi instanceof Error?gi.message:String(gi);Ie({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.replay_event_malformed",message:"Skipped malformed replay event",debugMessage:Us,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed replay event:",gi)}mn&&O.reset(),Ft.length>0&&(O.dispatch(Ft),fj(Ft,we));for(const zn of Mn)cj(U.current,D.current,xe.sessionId,zn,O,Ee,N,{requireBoundPromptId:!0});rn(zn=>({...zn,catchingUp:void 0}))}rn(Xe=>({...Xe,status:"connected",sessionId:xe.sessionId,...xe.clientId?{clientId:xe.clientId}:{},workspaceCwd:xe.workspaceCwd,displayName:tj(xe.state)??(Xe.sessionId===xe.sessionId?Xe.displayName:void 0),tokenUsage:br!==void 0?br:Xe.sessionId===xe.sessionId?Xe.tokenUsage:void 0,tokenCount:Se!==void 0?Se:Xe.sessionId===xe.sessionId?Xe.tokenCount??0:0,loadingTranscript:void 0,catchingUp:Lr?Xe.catchingUp:gs||xe.lastEventId!=null||void 0})),Js&&(G.current=void 0,clearTimeout(Js.timeout),K.current===xe.sessionId&&(K.current=void 0),Js.resolve());const ti=Rn&&on.current.commands!==void 0&&on.current.skills!==void 0&&on.current.supportedCommands!==void 0&&on.current.context!==void 0,_r=xe.workspaceCwd?Zn.workspaceByCwd(xe.workspaceCwd).workspaceGit():Zn.workspaceGit(),[W,fe,Ae,He]=await Promise.allSettled([ti?Promise.resolve(void 0):Zn.workspaceProviders(),ti?Promise.resolve(void 0):xe.supportedCommands(),ti?Promise.resolve(void 0):xe.context(),_r]),Ge=(W==null?void 0:W.status)==="fulfilled"?W.value:void 0,zt=(fe==null?void 0:fe.status)==="fulfilled"?fe.value:void 0,dn=(Ae==null?void 0:Ae.status)==="fulfilled"?Ae.value:void 0,hn=(He==null?void 0:He.status)==="fulfilled"?He.value.branch??void 0:void 0,ds=[(W==null?void 0:W.status)==="rejected"?(ln=oe.current)==null?void 0:ln.models:void 0,(fe==null?void 0:fe.status)==="rejected"?(Wn=oe.current)==null?void 0:Wn.commands:void 0,(Ae==null?void 0:Ae.status)==="rejected"?(Jn=oe.current)==null?void 0:Jn.context:void 0].filter(Xe=>!!Xe),Ws=ZR(Ge),Ms=Ole(dn),Ts=Ms&&Ms.models.length>0?Ms.models:Ws.models,Gr=(Ms==null?void 0:Ms.currentModel)??Ws.currentModel,ie=Gr===Ws.currentModel?Ws.contextWindow:(Cs=Ws.models.find(Xe=>Xe.id===Gr))==null?void 0:Cs.contextWindow,ve=(Ms==null?void 0:Ms.contextWindow)??((fr=Ts.find(Xe=>Xe.id===Gr))==null?void 0:fr.contextWindow)??ie,{commands:Le,skills:tt}=YH(zt),cn=Ble(dn)??Ws.currentMode;rn(Xe=>Xe.sessionId!==xe.sessionId?Xe:{...Xe,status:"connected",sessionId:xe.sessionId,...xe.clientId?{clientId:xe.clientId}:{},workspaceCwd:xe.workspaceCwd,commands:zt!==void 0?Le:Xe.commands,skills:zt!==void 0?tt:Xe.skills,models:Ts.length>0?Ts:Xe.models,currentModel:Gr??Xe.currentModel,currentMode:cn??Xe.currentMode,displayName:tj(xe.state)??Xe.displayName,contextWindow:ve??Xe.contextWindow,providers:Ge??Xe.providers,supportedCommands:zt??Xe.supportedCommands,context:dn??Xe.context,gitBranch:He.status==="fulfilled"?hn:Xe.gitBranch,capabilities:es??Xe.capabilities,loadingTranscript:void 0,catchingUp:Lr?Xe.catchingUp:gs||xe.lastEventId!=null||void 0}),ds.length>0&&O.dispatch(ds.map(Xe=>({type:"status",text:Xe})));let en=!1,Sn=!1;const Gs=()=>{const Xe=U.current.get(xe.sessionId);Xe==null||Xe.controller.abort(),U.current.delete(xe.sessionId),Ot&&xt(),Xr(N),Ee("idle"),O.reset(),xe.setLastEventId(0),ss=xe.sessionId,Sn=!0,$n=void 0,X.current=void 0,Bt.current=()=>!1,rn(Ft=>({...Ft,status:"connecting",error:void 0,errorStatus:Ql(void 0,Ft.errorStatus)}))};for await(const Xe of xe.events({signal:wt.signal,maxQueued:a})){if(((Xs=X.current)==null?void 0:Xs.sessionId)!==xe.sessionId)break;en||(en=!0,jr=0);try{const Ft=cce(Xe);if(Ft){lce(Ft);continue}const zn=fce(Xe);zn&&dce(zn),wce(Xe)&&(vce(Xe),Xe.type==="pending_prompt_started"&&(Xr(N),Ee("waiting")));const gi=uj(Xe,xe.clientId,te.current,rn),Us=dj(Xe,gi,Ie,lt);if(Xe.type==="state_resync_required"&&(typeof Xe.data=="object"&&Xe.data!==null?Xe.data.reason:void 0)==="epoch_reset"){Gs();break}if(fj(Us,we),Us.length>0){const ct=g3(Us);Ee(pt=>pt==="waiting"||pt==="idle"&&ct?"streaming":pt)}const ni=cj(U.current,D.current,xe.sessionId,Xe,O,Ee,N);let rs=!1;if(!ni&&Ot&&(Xe.type==="turn_complete"||Xe.type==="turn_error")){xt(),rs=!0,Xr(N);const ct=Xe.type==="turn_complete"?((Vs=Xe.data)==null?void 0:Vs.stopReason)??"end_turn":"error";O.dispatch(Md(Xe,ct)),An()||Ee("idle")}const qa=!An()&&O.getSnapshot().activeAssistantBlockId!=null?Us.filter(ct=>ct.type!=="debug"):Us;O.dispatch(qa);for(const ct of Us)if(ct.type==="prompt.cancelled"&&(Ot||ct.originatorClientId!==xe.clientId)){O.dispatch(Md(Xe,"cancelled"));const pt=Ot;xt(),rs=!0,Xr(N),pt||U.current.delete(xe.sessionId),An()||Ee("idle")}else ct.type==="session.replay_complete"&&(rn(pt=>({...pt,catchingUp:void 0})),O.getSnapshot().awaitingResync&&O.clearAwaitingResync(),An()||(Xr(N),O.dispatch({type:"assistant.done",reason:"replay_complete"}),Ee("idle")));const Pe=!ni&&!rs&&!An();if(Pe&&(Us.some(pt=>pt.type==="user.text.delta")?Ee("waiting"):g3(Us)&&Ee(pt=>pt==="idle"?"streaming":pt)),Pe&&Xe.type==="turn_complete"){Xr(N);const ct=((_n=Xe.data)==null?void 0:_n.stopReason)??"end_turn";O.dispatch(Md(Xe,ct)),Ee("idle")}else Pe&&Xe.type==="turn_error"?(Xr(N),O.dispatch(Md(Xe,"error")),Ee("idle")):Pe&&g3(Us)&&Vle(O,N,"passive_observer",3e3,()=>Ee("idle"));if(Xe.type==="state_resync_required"&&(typeof Xe.data=="object"&&Xe.data!==null?Xe.data.reason:void 0)!=="epoch_reset"){An()||(Ee("idle"),Xr(N)),O.reset(),console.warn("[DaemonSessionProvider] ring eviction detected, reloading session (sessionId=%s)",xe.sessionId),Sn=!0,$n=void 0,X.current=void 0,Bt.current=()=>!1,rn(pt=>({...pt,status:"connecting",error:void 0,errorStatus:Ql(void 0,pt.errorStatus)}));break}if(Xe.type==="session_closed"&&((fn=Xe.data)==null?void 0:fn.reason)==="client_close"){Bs=!0;const ct=xe.sessionId,pt=U.current.get(ct);pt==null||pt.controller.abort(),U.current.delete(ct),$n=void 0,X.current=void 0;break}}catch(Ft){const zn=Ft instanceof Error?Ft.message:String(Ft);Ie({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.event_malformed",message:"Skipped malformed daemon event",debugMessage:zn,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed daemon event:",Ft)}}if(Bs){O.dispatch({type:"assistant.done",reason:"cancelled"}),Ee("idle"),Xr(N),rn(Xe=>({...Xe,status:"disconnected",sessionId:void 0,error:void 0,errorStatus:void 0,missingSession:!1}));return}if(Q.current){$n=void 0,X.current=void 0,Bt.current=()=>!1;return}!It&&!wt.signal.aborted&&!Sn&&(((qn=X.current)==null?void 0:qn.sessionId)===xe.sessionId&&(console.debug("[DaemonSessionProvider] SSE stream ended"),An()||(Xr(N),Ee("idle"),O.dispatch({type:"assistant.done",reason:"stream_ended"}))),rn(Xe=>({...Xe,status:Xe.status==="error"?"error":"disconnected",error:Xe.status==="error"?Xe.error:void 0,errorStatus:Ql(void 0,Xe.errorStatus)})))}catch(gs){if(It||wt.signal.aborted)return;const ts=gs instanceof Error?gs.message:String(gs),mn=Ck(gs),Rn=$n==null?void 0:$n.sessionId,br=Pce(gs),Se=Oce(gs);if(Rn&&(br||Se)){const kt=U.current.get(Rn);kt==null||kt.controller.abort(),U.current.delete(Rn)}(br||Se||!Ui())&&(Xr(N),Ee("idle"));const xe=G.current;if(xe&&(xe.sessionId===_t||xe.sessionId===ss)&&(K.current===xe.sessionId&&(K.current=void 0),G.current=void 0,clearTimeout(xe.timeout),xe.reject(gs)),br||Se){if($n=void 0,X.current=void 0,br){rn(Ot=>({...Ot,status:"error",sessionId:void 0,error:ts,errorStatus:Ql(mn,Ot.errorStatus),missingSession:!1,capabilities:es??Ot.capabilities,loadingTranscript:void 0,catchingUp:void 0}));return}const kt=zr&&$1(mn);console.warn("[DaemonSessionProvider] terminal session error (sessionId=%s, status=%d, message=%s)",Rn,mn,ts),rn(Ot=>({...Ot,status:"disconnected",sessionId:void 0,error:ts,errorStatus:Ql(mn,Ot.errorStatus),missingSession:kt||Ot.missingSession===!0,capabilities:es??Ot.capabilities,loadingTranscript:void 0,catchingUp:void 0}));return}else console.debug("[DaemonSessionProvider] retriable SSE error, preserving session for delta resume (sessionId=%s)",$n==null?void 0:$n.sessionId);if(!f){$n=void 0,X.current=void 0,rn(kt=>({...kt,status:"error",error:ts,errorStatus:Ql(mn,kt.errorStatus),missingSession:!1}));return}rn(kt=>({...kt,status:"disconnected",error:ts,errorStatus:Ql(mn,kt.errorStatus),missingSession:!1,loadingTranscript:void 0}))}if(!f){X.current=void 0,rn(gs=>({...gs,status:"disconnected",loadingTranscript:void 0,catchingUp:void 0}));return}jr+=1;const sr=ce.current,Qs=Hle(jr,sr.reconnectDelayMs,sr.maxReconnectDelayMs);rn(gs=>({...gs,status:"disconnected",error:`Reconnecting in ${Qs}ms`})),await Ule(Qs,wt.signal)}})(),()=>{const kn=X.current;It=!0,wt.abort(),Bt.current=()=>!1,Ee("idle"),Xr(N);const ln=(kn==null?void 0:kn.sessionId)===K.current,Wn=!Et.current;G.current&&(!ln||Wn)&&(clearTimeout(G.current.timeout),G.current.reject(new DOMException("Session load interrupted by cleanup","AbortError")),G.current=void 0),(!ln||Wn)&&(kn!=null&&kn.clientId)&&sj({baseUrl:k,token:T,sessionId:kn.sessionId,clientId:kn.clientId}).catch(Jn=>console.warn("[DaemonSessionProvider] detach failed:",Jn)),(!ln||Wn)&&(X.current=void 0)}},[h,f,k,T,s,Te,qe,a,O,_t,Je,Oe,ue,ye,Ye,i,P,ne,Ie,lt]),m.useEffect(()=>{if(!ee.current||Rt.status!=="connected"||y<=0||w<=0||!Rt.sessionId)return;re.current.sessionId!==Rt.sessionId&&(re.current={sessionId:Rt.sessionId,consecutiveFailures:0});const wt=re.current;let It=!1;const Vn=setInterval(()=>{const kn=X.current;kn&&kn.heartbeat().then(()=>{It||(wt.consecutiveFailures>=w&&rn(ln=>ln.sessionId===kn.sessionId?{...ln,status:"connected",error:void 0,errorStatus:void 0}:ln),wt.consecutiveFailures=0,wt.lastHttpError=void 0)}).catch(ln=>{var Wn,Jn,Cs,fr,Xs;if(It)return;wt.consecutiveFailures+=1;const Vs=ln instanceof Error?ln.message:"Session heartbeat failed",_n=Ck(ln);if(_n!==void 0){const es=(Wn=wt.lastHttpError)==null?void 0:Wn.status;wt.lastHttpError={status:Ql(_n,es)??_n,message:$1(es)?((Jn=wt.lastHttpError)==null?void 0:Jn.message)??Vs:Vs}}if(wt.consecutiveFailures<w)return;const fn=(Cs=wt.lastHttpError)==null?void 0:Cs.status,qn=((fr=wt.lastHttpError)==null?void 0:fr.message)??Vs,Zn=fn!==void 0&&zE.has(fn),$n=$1(fn);if(Zn||$n){const es=kn.sessionId;console.warn($n?"[DaemonSessionProvider] heartbeat detected missing session (sessionId=%s, status=%d)":"[DaemonSessionProvider] heartbeat auth failure (sessionId=%s, status=%d)",es,fn);const ss=U.current.get(es);ss==null||ss.controller.abort(),U.current.delete(es),Xr(N),Ee("idle"),((Xs=X.current)==null?void 0:Xs.sessionId)===es&&($n&&(Q.current=!0),X.current=void 0)}rn(es=>es.sessionId===kn.sessionId?{...es,status:Zn?"error":"disconnected",error:qn,errorStatus:Ql(fn,es.errorStatus),missingSession:$n,...Zn||$n?{sessionId:void 0,loadingTranscript:void 0,catchingUp:void 0}:{}}:es)})},y);return()=>{It=!0,clearInterval(Vn)}},[Rt.sessionId,Rt.status,w,y]);const Tt=m.useMemo(()=>Yle({store:O,sessionRef:X,activePromptsRef:U,settledPromptsRef:D,pendingSessionLoadRef:G,pendingSessionLoadIdRef:q,heartbeatSupportedRef:ee,manualSessionClearRef:Q,skipNextCleanupDetachSessionIdRef:K,passiveAssistantDoneTimerRef:N,hasSessionActivePrompt:()=>Bt.current(),resetCurrentSessionActivePrompt:()=>{Bt.current=()=>!1},getCreateSessionRequest:()=>{var wt;return{...Ne.current,sessionScope:"thread",workspaceCwd:F.current??((wt=X.current)==null?void 0:wt.workspaceCwd)}},createDetachedSession:(wt,It)=>{var Vn;const kn=S.current??new $6({baseUrl:k,token:T}),ln={...Ne.current,sessionScope:"thread",workspaceCwd:wt??F.current??((Vn=X.current)==null?void 0:Vn.workspaceCwd),...(It==null?void 0:It.approvalMode)!==void 0?{approvalMode:It.approvalMode}:{}},Wn=i?de.current:d3(void 0);return jg.createOrAttach(kn,ln,Wn)},getConnection:()=>on.current,addNotice:Ie,setConnection:rn,setPromptStatus:Ee,setRestoreSessionId:Ct,setRestoreWorkspaceCwd:at,setRestoreMode:Fe,setRestoreSessionNonce:vt,setAttachSessionNonce:je,setNewSessionNonce:Nt}),[Ie,i,k,T,O]),an=m.useRef(Cce);return m.useEffect(()=>{if(an.current===r)return;an.current=r;const wt=on.current.sessionId;if(r===wt)return;const It=r?Tt.loadSession(r):wt?Tt.clearSession():void 0;It&&It.catch(Vn=>{console.warn("[DaemonSessionProvider] controlled session transition failed:",Vn)})},[Tt,r]),u.jsx(cU.Provider,{value:O,children:u.jsx(uU.Provider,{value:Rt,children:u.jsx(dU.Provider,{value:ge,children:u.jsx(hU.Provider,{value:he,children:u.jsx(fU.Provider,{value:Ve,children:u.jsx($E.Provider,{value:Tt,children:b})})})})})})}function cj(e,t,n,s,r,i,o,a={}){var l;if(s.type!=="turn_complete"&&s.type!=="turn_error")return!1;const c=(l=s.data)==null?void 0:l.promptId;if(!c)return!1;const d=e.get(n);if(!d||a.requireBoundPromptId&&d.promptId===void 0||d.promptId!==void 0&&d.promptId!==c)return!1;Xr(o);try{const h=CE(s,c);if(!h)return!1;r.dispatch(Md(s,h.stopReason)),i("idle"),d.resolve?(e.delete(n),d.resolve(h)):(e.delete(n),t.set(W6(n,c),{status:"resolved",result:h}))}catch(h){r.dispatch(Md(s,"error")),i("idle"),d.reject?(e.delete(n),d.reject(h)):(e.delete(n),t.set(W6(n,c),{status:"rejected",error:h}))}return!0}function Tce(e){return e.type==="turn_complete"}function uj(e,t,n,s,r={}){Ece(e),r.updateConnection!==!1&&Ple(e,s);const i=rae(e,{clientId:t,suppressOwnUserEcho:n.suppressOwnUserEcho,includeRawEvent:n.includeRawEvent}),o=jce(e);return Tce(e)?o?[o]:[]:o?[...i,o]:i}function Ece(e){e.type==="settings_reloaded"&&console.debug("[DaemonSessionProvider] settings reloaded:",Ace(e))}function Ace(e){const t={};if(e.id!==void 0&&(t.eventId=e.id),!ka(e.data))return t.payload="non-object",t;const n=Mce(e.data.env),s=z1(e.data.changedKeys),r=z1(e.data.sessionsRefreshed),i=z1(e.data.sessionsSkipped),o=e.data.childReloaded,a=Mc(e.data,"childError");return n&&(t.env=n),s&&(t.changedKeys=s),typeof o=="boolean"&&(t.childReloaded=o),r&&(t.sessionsRefreshed=r),i&&(t.sessionsSkipped=i),a&&(t.childError=a),t}function Mce(e){if(ka(e))return{updatedKeys:z1(e.updatedKeys)??[],removedKeys:z1(e.removedKeys)??[]}}function z1(e){if(Array.isArray(e))return e.filter(t=>typeof t=="string")}function dj(e,t,n,s){if(e.type==="session_snapshot"&&ka(e.data)&&e.data.recordingDegraded===!1){const i=Mc(e.data,"sessionId");i&&s(`daemon.session_recording_degraded:${i}`)}const r=[];for(const i of t){if(i.type!=="error"){r.push(i);continue}if(e.type==="turn_error"){r.push(i);continue}const o=n(Nce(e,i));(o.category==="protocol"||o.category==="connection")&&console.warn("[DaemonSessionProvider] daemon notice:",o)}return r}function Nce(e,t){const n={message:t.text,debugMessage:t.text,recoverable:t.recoverable};switch(e.type){case"session_recording_degraded":case"session_snapshot":{const s=ka(e.data)?Mc(e.data,"sessionId"):void 0;return{...n,...s?{id:`daemon.session_recording_degraded:${s}`}:{},severity:"warning",category:"system",operation:"record_session",code:"daemon.session_recording_degraded"}}case"model_switch_failed":return{...n,severity:"error",category:"user_action",operation:"switch_model",code:"daemon.switch_model.failed"};case"session_died":return{...n,severity:"error",category:"connection",operation:"stream",code:t.errorKind??"daemon.session_died"};case"client_evicted":return{...n,severity:"warning",category:"connection",operation:"stream",code:"daemon.client_evicted"};case"stream_error":return{...n,severity:"warning",category:"connection",operation:"stream",code:t.errorKind??"daemon.stream_error"};default:return{...n,severity:"warning",category:"protocol",operation:"normalize_event",code:t.code??"daemon.protocol.error"}}}function g_(){const e=m.useContext(cU);if(!e)throw new Error("useDaemonTranscriptStore must be used within DaemonSessionProvider");return e}function bb(){const e=g_(),t=m.useCallback(()=>e.getSnapshot().blocks,[e]);return m.useSyncExternalStore(e.subscribe,t,t)}function y_(){const e=bb(),t=pU();return m.useMemo(()=>oce(e,t),[e,t])}function H0(){const e=m.useContext($E);if(!e)throw new Error("useDaemonActions must be used within DaemonSessionProvider");return e}function Ice(){return m.useContext($E)}function Yu(){return m.useContext(fU)}function pU(){const e=m.useContext(dU);if(!e)throw new Error("useDaemonPromptStatus must be used within DaemonSessionProvider");return e}function Ba(){const e=m.useContext(uU);if(!e)throw new Error("useDaemonConnection must be used within DaemonSessionProvider");return e}function Rce(){const e=m.useContext(hU);if(!e)throw new Error("useDaemonSessionNotices must be used within DaemonSessionProvider");return e}function g3(e){return e.some(t=>t.type==="assistant.text.delta"||t.type==="thought.text.delta"||t.type==="tool.update")}function jce(e){if(e.type!=="session_update")return null;const t=ka(e.data)?e.data:void 0,n=ka(t==null?void 0:t.update)?t.update:ka(e.data)?e.data:void 0;if(!n||n.sessionUpdate!=="agent_message_chunk")return null;const s=n._meta;if(!ka(s))return null;const r=Lce(s.goalStatus);if(r)return hj(e,r);const i=Dce(s.goalTerminal);if(i)return hj(e,i);const o=s.stopHookLoop;if(!ka(o))return null;const a=o.goal;return!ka(a)||!Mc(a,"condition"),null}function hj(e,t){return{type:"status",...e.id!==void 0?{eventId:e.id}:{},...e.originatorClientId?{originatorClientId:e.originatorClientId}:{},text:"",source:"goal",data:t}}function Lce(e){if(!ka(e))return null;const t=Mc(e,"kind");if(t!=="set"&&t!=="cleared"&&t!=="achieved"&&t!=="failed"&&t!=="aborted")return null;const n=Mc(e,"condition");if(!n)return null;const s=F1(e,"iterations"),r=F1(e,"durationMs"),i=F1(e,"setAt"),o=Mc(e,"lastReason");return{kind:t,condition:n,...s!==void 0?{iterations:s}:{},...r!==void 0?{durationMs:r}:{},...i!==void 0?{setAt:i}:{},...o?{lastReason:o}:{}}}function Dce(e){if(!ka(e))return null;const t=Mc(e,"kind");if(t!=="achieved"&&t!=="failed"&&t!=="aborted")return null;const n=Mc(e,"condition");if(!n)return null;const s=F1(e,"iterations"),r=F1(e,"durationMs"),i=Mc(e,"lastReason");return{kind:t,condition:n,...s!==void 0?{iterations:s}:{},...r!==void 0?{durationMs:r}:{},...i?{lastReason:i}:{}}}function Mc(e,t){const n=e[t];return typeof n=="string"?n:void 0}function F1(e,t){const n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function fj(e,t){let n=0,s=0,r=0,i=0,o=0,a=0,l=0,c,d=0,h=0;for(const f of e)switch(f.type){case"workspace.memory.changed":n+=1;break;case"workspace.agent.changed":s+=1;break;case"workspace.tool.toggled":r+=1;break;case"workspace.settings.changed":i+=1;break;case"workspace.mcp.budget_warning":case"workspace.mcp.child_refused":case"workspace.mcp.server_restarted":case"workspace.mcp.server_restart_refused":o+=1;break;case"workspace.extensions.changed":a+=1,c={...f.status?{status:f.status}:{},...f.source?{source:f.source}:{},...f.name?{name:f.name}:{},...f.version?{version:f.version}:{},...f.error?{error:f.error}:{},refreshed:f.refreshed,failed:f.failed};break;case"session.artifact.changed":l+=1;break;case"workspace.initialized":d+=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":h+=1;break}n+s+r+i+o+a+l+d+h!==0&&t(f=>({memoryVersion:f.memoryVersion+n,agentsVersion:f.agentsVersion+s,toolsVersion:f.toolsVersion+r,settingsVersion:f.settingsVersion+i,mcpVersion:f.mcpVersion+o,extensionsVersion:f.extensionsVersion+a,artifactsVersion:f.artifactsVersion+l,...c?{lastExtensionChange:c}:{},initVersion:f.initVersion+d,authVersion:f.authVersion+h}))}function Oce(e){const t=Ck(e);return t!==void 0&&kce.has(t)}function Pce(e){const t=Ck(e);return t!==void 0&&zE.has(t)}function Ck(e){if(e instanceof $u||ka(e)&&typeof e.status=="number")return e.status}function ka(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Xu(e,t){const{autoLoad:n=!1,enabled:s=!0}=t,[r,i]=m.useState({data:void 0,loading:!1,error:void 0}),o=m.useRef(0),a=m.useCallback(async()=>{if(!s)return;const l=++o.current;i(c=>({...c,loading:!0,error:void 0}));try{const c=await e();return l!==o.current?void 0:(i({data:c,loading:!1,error:void 0}),c)}catch(c){if(l!==o.current)return;const d=c instanceof Error?c:new Error(String(c));i(h=>({...h,loading:!1,error:d}));return}},[s,e]);return m.useEffect(()=>{!n||!s||a()},[n,s,a]),{...r,reload:a}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function U0(e,t,n){const s=m.useRef(!1);m.useEffect(()=>{if(!(e===void 0||!n)){if(!s.current){s.current=!0;return}t()}},[n,t,e])}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Bce(e={}){var t;const n=$o(),s=m.useCallback(()=>n.listAgents(),[n]),r=Xu(s,e),i=Yu();return U0(i==null?void 0:i.agentsVersion,r.reload,e.autoLoad===!0||r.data!==void 0),{...r,status:r.data,agents:((t=r.data)==null?void 0:t.agents)??[],getAgent:n.getAgent,createAgent:n.createAgent,generateAgent:n.generateAgent,deleteAgent:n.deleteAgent,updateAgent:n.updateAgent}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function gU(e={}){const t=$o(),n=m.useCallback(()=>t.loadMcpStatus(),[t]),s=Xu(n,e),r=Yu();return U0(r==null?void 0:r.mcpVersion,s.reload,e.autoLoad===!0||s.data!==void 0),{...s,status:s.data,loadTools:t.loadMcpTools,loadResources:t.loadMcpResources,restartServer:t.restartMcpServer,manageServer:t.manageMcpServer}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function $ce(e={}){var t;const n=$o(),s=m.useCallback(()=>n.loadMemoryStatus(),[n]),r=Xu(s,e),i=Yu();return U0(i==null?void 0:i.memoryVersion,r.reload,e.autoLoad===!0||r.data!==void 0),{...r,status:r.data,files:((t=r.data)==null?void 0:t.files)??[],readFile:n.readWorkspaceFile,writeMemory:n.writeMemory}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function ah(e={}){const{pageSize:t,cursor:n,archiveState:s,view:r,group:i,...o}=e,a=Dh(),l=Ice(),c=m.useCallback(()=>{const T={...t!==void 0?{pageSize:t}:{},...n!==void 0?{cursor:n}:{},...s!==void 0?{archiveState:s}:{},...r!==void 0?{view:r}:{},...i!==void 0?{group:i}:{}};return a.actions.listSessionsPage(T)},[s,n,i,t,r,a.actions]),d=!!a.workspaceCwd,h=Xu(c,{...o,enabled:(o.enabled??!0)&&d}),f=h.reload,p=m.useCallback(async()=>{const T=await f();return T==null?void 0:T.sessions},[f]),g=h.data,y=(g==null?void 0:g.sessions)??[],w=m.useCallback(async T=>{const C=await a.actions.deleteSession(T);return C&&p(),C},[a.actions,p]),v=m.useCallback(async T=>{const C=await a.actions.deleteSessions(T);return(C.removed.length>0||C.notFound.length>0)&&p(),C},[a.actions,p]),b=m.useCallback((T,C="html")=>a.actions.exportSession(T,C),[a.actions]),x=m.useCallback(async T=>{const C=await a.actions.archiveSession(T);return C&&p(),C},[a.actions,p]),k=m.useCallback(async T=>{const C=await a.actions.unarchiveSession(T);return C&&p(),C},[a.actions,p]);return{...h,data:g!==void 0?y:void 0,reload:p,sessions:y,nextCursor:g==null?void 0:g.nextCursor,liveMergeFailed:(g==null?void 0:g.liveMergeFailed)===!0,truncated:(g==null?void 0:g.truncated)===!0,loadSession:l==null?void 0:l.loadSession,resumeSession:l==null?void 0:l.resumeSession,newSession:l==null?void 0:l.newSession,releaseSession:l==null?void 0:l.releaseSession,deleteSession:w,deleteSessions:v,exportSession:b,archiveSession:x,unarchiveSession:k}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Q6(e={}){const{detail:t="summary",...n}=e,s=$o(),r=m.useCallback(()=>s.loadDaemonStatus(t),[s,t]),i=Xu(r,n);return{...i,report:i.data}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function zce(e={}){const{range:t,heatmapDays:n,...s}=e,r=$o(),i=m.useCallback(()=>r.loadUsageDashboard({range:t,heatmapDays:n}),[r,t,n]),o=Xu(i,s);return{...o,dashboard:o.data}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function yU(e={}){var t;const n=$o(),s=m.useCallback(()=>n.loadToolsStatus(),[n]),r=Xu(s,e),i=Yu();return U0(i==null?void 0:i.toolsVersion,r.reload,e.autoLoad===!0||r.data!==void 0),{...r,status:r.data,tools:((t=r.data)==null?void 0:t.tools)??[],setEnabled:n.setWorkspaceToolEnabled}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Fce(e={}){var t;const n=$o(),s=m.useCallback(()=>n.loadSettingsStatus(),[n]),r=Xu(s,e),i=Yu();return U0(i==null?void 0:i.settingsVersion,r.reload,e.autoLoad===!0||r.data!==void 0),{...r,status:r.data,settings:((t=r.data)==null?void 0:t.settings)??[],setValue:n.setWorkspaceSetting}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function qce(e={}){var t,n;const s=$o(),r=m.useCallback(()=>s.loadProviders(),[s]),i=Xu(r,e),o=Yu();return U0(o==null?void 0:o.settingsVersion,i.reload,e.autoLoad===!0||i.data!==void 0),{...i,status:i.data,providers:((t=i.data)==null?void 0:t.providers)??[],current:(n=i.data)==null?void 0:n.current}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Hce=300,Uce=100,fp=Object.freeze({suggestion:null,isVisible:!1,shownAt:0});function y3(e){var t;const n=e;(t=n.clearFollowupSuggestion)==null||t.call(n)}function Vce(e){const{enabled:t=!0,onStateChange:n,getOnAccept:s,getOnOutcome:r}=e;let i=fp,o=null,a=!1,l=null;function c(w){i=w,n(w)}function d(){o&&(clearTimeout(o),o=null),l&&(clearTimeout(l),l=null)}return{setSuggestion:w=>{if(o&&(clearTimeout(o),o=null),!w){c(fp);return}t&&(o=setTimeout(()=>{c({suggestion:w,isVisible:!0,shownAt:Date.now()})},Hce))},accept:(w,v)=>{var b;if(a)return;o&&(clearTimeout(o),o=null),a=!0;const x=i.suggestion,{shownAt:k}=i;if(!x){a=!1;return}try{(b=r())==null||b({outcome:"accepted",accept_method:w,time_ms:k>0?Date.now()-k:0,suggestion_length:x.length})}catch(T){console.error("[followup] onOutcome callback threw:",T)}c(fp),queueMicrotask(()=>{var T;try{v!=null&&v.skipOnAccept||(T=s())==null||T(x)}catch(C){console.error("[followup] onAccept callback threw:",C)}finally{l&&clearTimeout(l),l=setTimeout(()=>{a=!1},Uce)}})},dismiss:()=>{var w;if(o&&(clearTimeout(o),o=null),!(!i.isVisible&&!i.suggestion)){if(i.isVisible&&i.suggestion)try{(w=r())==null||w({outcome:"ignored",time_ms:i.shownAt>0?Date.now()-i.shownAt:0,suggestion_length:i.suggestion.length})}catch(v){console.error("[followup] onOutcome callback threw:",v)}c(fp)}},clear:()=>{d(),a=!1,c(fp)},cleanup:()=>{d(),a=!1}}}function bU(e={}){const{enabled:t=!0,onAccept:n,onOutcome:s}=e,r=g_(),i=Ba().sessionId,[o,a]=m.useState(fp),l=m.useRef(n);l.current=n;const c=m.useRef(s);c.current=s;const d=m.useSyncExternalStore(r.subscribe,()=>r.getSnapshot().lastFollowupSuggestion,()=>r.getSnapshot().lastFollowupSuggestion),h=m.useSyncExternalStore(ace,oj,oj),f=(h==null?void 0:h.sessionId)===i?h:d,p=m.useMemo(()=>Vce({enabled:t,onStateChange:a,getOnAccept:()=>l.current,getOnOutcome:()=>c.current}),[t]),{setSuggestion:g}=p;m.useEffect(()=>(t||p.clear(),()=>p.cleanup()),[p,t]);const y=m.useRef(void 0),w=m.useRef(i);m.useEffect(()=>{const k=w.current;w.current=i,k!==void 0&&i!==void 0&&k!==i&&(p.clear(),Pv(),y.current=void 0)},[p,i]),m.useEffect(()=>{const k=f==null?void 0:f.promptId;k!==y.current&&(y.current=k,g((f==null?void 0:f.suggestion)??null))},[f,g]);const v=m.useCallback(()=>{p.clear(),y3(r),Pv(),y.current=void 0},[p,r]),b=m.useCallback((k,T)=>{p.accept(k,T),y3(r),Pv(),y.current=void 0},[p,r]),x=m.useCallback(()=>{p.dismiss(),y3(r),Pv(),y.current=void 0},[p,r]);return m.useMemo(()=>({followupState:o,onAcceptFollowup:b,onDismissFollowup:x,clear:v}),[o,b,x,v])}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Wce(){const e=m.useSyncExternalStore(uce,aj,aj),t=m.useCallback(n=>hce(n),[]);return{batches:e,consume:t}}const mj=[];function Gce(e,t){return e===t?!1:e.length!==t.length?!0:e.some((n,s)=>!Object.is(n,t[s]))}class Fu extends m.Component{constructor(){super(...arguments);Me(this,"state",{error:null,resetKeys:this.props.resetKeys??mj});Me(this,"reset",()=>{this.setState({error:null})})}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,s){const r=n.resetKeys??mj;return Gce(s.resetKeys,r)?{error:null,resetKeys:r}:null}componentDidCatch(n,s){console.error(`[web-shell] ${this.props.label??"render"} failed:`,n,s.componentStack)}render(){const{error:n}=this.state;if(n===null)return this.props.children;const{fallback:s}=this.props;return typeof s=="function"?s(n,this.reset):s}}const pj={en:{title:"Something went wrong",body:"An unexpected error occurred and this content could not be displayed.",retry:"Try again"},"zh-CN":{title:"出了点问题",body:"发生意外错误，无法显示此内容。",retry:"重试"}},Kce={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0.75rem",padding:"2rem",minHeight:"8rem",height:"100%",textAlign:"center",color:"inherit"},Yce={margin:0,fontSize:"1rem",fontWeight:600},Xce={margin:0,fontSize:"0.85rem",opacity:.7,maxWidth:"32rem"},Qce={appearance:"none",cursor:"pointer",padding:"0.4rem 1rem",fontSize:"0.85rem",borderRadius:"6px",border:"1px solid rgba(128, 128, 128, 0.4)",background:"transparent",color:"inherit"};function Jce({error:e,onRetry:t,language:n="en"}){const s=pj[n]??pj.en;return u.jsxs("div",{role:"alert",style:Kce,"data-web-shell-error":!0,children:[u.jsx("p",{style:Yce,children:s.title}),u.jsx("p",{style:Xce,children:s.body}),!1,u.jsx("button",{type:"button",style:Qce,onClick:t,children:s.retry})]})}/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vU=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim();/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Zce=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const eue=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,s)=>s?s.toUpperCase():n.toLowerCase());/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gj=e=>{const t=eue(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */var b3={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const tue=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},nue=m.createContext({}),sue=()=>m.useContext(nue),rue=m.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:s,className:r="",children:i,iconNode:o,...a},l)=>{const{size:c=24,strokeWidth:d=2,absoluteStrokeWidth:h=!1,color:f="currentColor",className:p=""}=sue()??{},g=s??h?Number(n??d)*24/Number(t??c):n??d;return m.createElement("svg",{ref:l,...b3,width:t??c??b3.width,height:t??c??b3.height,stroke:e??f,strokeWidth:g,className:vU("lucide",p,r),...!i&&!tue(a)&&{"aria-hidden":"true"},...a},[...o.map(([y,w])=>m.createElement(y,w)),...Array.isArray(i)?i:[i]])});/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Xn=(e,t)=>{const n=m.forwardRef(({className:s,...r},i)=>m.createElement(rue,{ref:i,iconNode:t,className:vU(`lucide-${Zce(gj(e))}`,`lucide-${e}`,s),...r}));return n.displayName=gj(e),n};/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const iue=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],oue=Xn("activity",iue);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const aue=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]],lue=Xn("archive-restore",aue);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const cue=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],uue=Xn("archive",cue);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const due=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],hue=Xn("bot",due);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fue=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],mue=Xn("calendar-clock",fue);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const pue=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],gue=Xn("check",pue);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yue=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],b_=Xn("chevron-down",yue);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bue=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],FE=Xn("chevron-right",bue);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vue=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],wue=Xn("chevron-up",vue);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xue=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],kue=Xn("columns-2",xue);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _ue=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Sue=Xn("database",_ue);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Cue=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Tue=Xn("download",Cue);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Eue=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],v3=Xn("ellipsis-vertical",Eue);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Aue=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],Mue=Xn("flask-conical",Aue);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Nue=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M2 10h20",key:"1ir3d8"}]],wU=Xn("folder-closed",Nue);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Iue=[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]],Rue=Xn("folder-input",Iue);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jue=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Lue=Xn("folder-open",jue);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Due=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"m9.5 10.5 5 5",key:"ra9qjz"}],["path",{d:"m14.5 10.5-5 5",key:"l2rkpq"}]],Oue=Xn("folder-x",Due);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Pue=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],yj=Xn("info",Pue);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Bue=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],$ue=Xn("layout-grid",Bue);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zue=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Fue=Xn("loader-circle",zue);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const que=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],Hue=Xn("maximize-2",que);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Uue=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],Vue=Xn("minimize-2",Uue);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Wue=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],Gue=Xn("moon",Wue);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Kue=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],Yue=Xn("palette",Kue);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Xue=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],Que=Xn("panel-left-close",Xue);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Jue=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],Zue=Xn("panel-left-open",Jue);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ede=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],xU=Xn("pencil",ede);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const tde=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],nde=Xn("pin",tde);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const sde=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],bj=Xn("plus",sde);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const rde=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],vj=Xn("search",rde);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ide=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],ode=Xn("server",ide);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ade=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],kU=Xn("settings-2",ade);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const lde=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],cde=Xn("settings",lde);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ude=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],dde=Xn("shield",ude);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hde=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],fde=Xn("sliders-horizontal",hde);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mde=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],wj=Xn("square-pen",mde);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const pde=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],gde=Xn("sun",pde);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yde=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],px=Xn("trash-2",yde);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bde=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],vde=Xn("wifi-off",bde);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wde=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],xde=Xn("wrench",wde);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const kde=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],_U=Xn("x",kde);function SU(e){for(const t of e){if(!_de(t))continue;const n=t;if(n.resolved)continue;const s=Np(n.toolCall),r=typeof(s==null?void 0:s.toolCallId)=="string"?s.toolCallId:typeof(s==null?void 0:s.id)=="string"?s.id:void 0,i=typeof(s==null?void 0:s.kind)=="string"?s.kind:void 0,o=Np(s==null?void 0:s._meta),a=typeof(o==null?void 0:o.toolName)=="string"?o.toolName:void 0;return{id:n.requestId,sessionId:n.sessionId,toolCallId:r,title:n.title,toolKind:i,toolName:a,content:[{type:"text",text:n.title||"Tool permission"}],options:n.options.map(l=>({id:l.optionId,label:l.label,kind:Cde(l.raw)})),rawInput:Sde(n.toolCall)}}return null}function _de(e){return e.kind==="permission"}function Sde(e){const t=Np(e);return t?Np(t.rawInput)??Np(t.input)??Np(t.args)??t:void 0}function Np(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function Cde(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e.kind;return t==="allow_once"||t==="allow_always"||t==="reject_once"||t==="reject_always"?t:void 0}function Tde(e,t,n){const s=new Array(e);return new Proxy(s,{get(r,i,o){if(typeof i=="string"){const a=i.charCodeAt(0);if(a>=48&&a<=57){const l=+i;if(Number.isInteger(l)&&l>=0&&l<e){let c=r[l];if(!c){const d=t[l*2];c=r[l]={index:l,key:n(l),start:d,size:t[l*2+1],end:d+t[l*2+1],lane:0}}return c}}if(i==="length")return e}return Reflect.get(r,i,o)}})}function Vm(e,t,n){let s=n.initialDeps??[],r,i=!0;function o(){const a=e();return(a.length!==s.length||a.some((c,d)=>s[d]!==c))&&(s=a,r=t(...a),n!=null&&n.onChange&&!(i&&n.skipInitialOnChange)&&n.onChange(r),i=!1),r}return o.updateDeps=a=>{s=a},o}function xj(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const Ede=(e,t)=>Math.abs(e-t)<1.01,Ade=(e,t,n)=>{let s;return function(...r){e.clearTimeout(s),s=e.setTimeout(()=>t.apply(this,r),n)}};let Bg;const w3=()=>{if(Bg!==void 0)return Bg;if(typeof navigator>"u")return Bg=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Bg=!0;const e=navigator.maxTouchPoints;return Bg=navigator.platform==="MacIntel"&&e!==void 0&&e>0},kj=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Mde=e=>e,Nde=e=>{const t=Math.max(e.startIndex-e.overscan,0),s=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=new Array(s);for(let i=0;i<s;i++)r[i]=t+i;return r},Ide=(e,t)=>{const n=e.scrollElement;if(!n)return;const s=e.targetWindow;if(!s)return;const r=o=>{const{width:a,height:l}=o;t({width:Math.round(a),height:Math.round(l)})};if(r(kj(n)),!s.ResizeObserver)return()=>{};const i=new s.ResizeObserver(o=>{const a=()=>{const l=o[0];if(l!=null&&l.borderBoxSize){const c=l.borderBoxSize[0];if(c){r({width:c.inlineSize,height:c.blockSize});return}}r(kj(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},Tk={passive:!0},Rde=typeof window>"u"?!0:"onscrollend"in window,jde=(e,t,n)=>{const s=e.scrollElement;if(!s)return;const r=e.targetWindow;if(!r)return;const i=e.options.useScrollendEvent&&Rde;let o=0;const a=i?null:Ade(r,()=>t(o,!1),e.options.isScrollingResetDelay),l=h=>()=>{o=n(s),a==null||a(),t(o,h)},c=l(!0),d=l(!1);return s.addEventListener("scroll",c,Tk),i&&s.addEventListener("scrollend",d,Tk),()=>{s.removeEventListener("scroll",c),i&&s.removeEventListener("scrollend",d)}},Lde=(e,t)=>jde(e,t,n=>{const{horizontal:s,isRtl:r}=e.options;return s?n.scrollLeft*(r&&-1||1):n.scrollTop}),Dde=(e,t,n)=>{if(n.options.useCachedMeasurements){const s=n.indexFromElement(e),r=n.options.getItemKey(s);return n.itemSizeCache.get(r)??n.options.estimateSize(s)}if(t!=null&&t.borderBoxSize){const s=t.borderBoxSize[0];if(s)return Math.round(s[n.options.horizontal?"inlineSize":"blockSize"])}if(!t){const s=n.indexFromElement(e),r=n.options.getItemKey(s),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},Ode=(e,{adjustments:t=0,behavior:n},s)=>{var r,i;(i=(r=s.scrollElement)==null?void 0:r.scrollTo)==null||i.call(r,{[s.options.horizontal?"left":"top"]:e+t,behavior:n})},Pde=Ode;class Bde{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var n,s,r;return((r=(s=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:s.now)==null?void 0:r.call(s))??Date.now()},this.observer=(()=>{let n=null;const s=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(r=>{r.forEach(i=>{const o=()=>{const a=i.target,l=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);for(const[c,d]of this.elementsCache)if(d===a){this.elementsCache.delete(c);break}return}this.shouldMeasureDuringScroll(l)&&this.resizeItem(l,this.options.measureElement(a,i,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var r;(r=s())==null||r.disconnect(),n=null},observe:r=>{var i;return(i=s())==null?void 0:i.observe(r,{box:"border-box"})},unobserve:r=>{var i;return(i=s())==null?void 0:i.unobserve(r)}}})(),this.range=null,this.setOptions=n=>{var s,r;const i={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Mde,rangeExtractor:Nde,onChange:()=>{},measureElement:Dde,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const f in n){const p=n[f];p!==void 0&&(i[f]=p)}const o=this.options;let a=null,l=null,c=!1;if(o!==void 0&&o.enabled&&i.enabled&&i.anchorTo==="end"&&this.scrollElement!==null){const f=o.count,p=i.count,g=this.getMeasurements(),y=f>0?((s=g[0])==null?void 0:s.key)??o.getItemKey(0):null,w=f>0?((r=g[f-1])==null?void 0:r.key)??o.getItemKey(f-1):null;if(p!==f||f>0&&p>0&&(i.getItemKey(0)!==y||i.getItemKey(p-1)!==w)){c=!0;const x=f>0?this.getVirtualItemForOffset(this.getScrollOffset())??g[0]:null;x&&(a=[x.key,this.getScrollOffset()-x.start]);const k=i.followOnAppend===!0?"auto":i.followOnAppend||null;k&&p>f&&this.isAtEnd(o.scrollEndThreshold)&&(f===0||i.getItemKey(p-1)!==w)&&(l=k)}}this.options=i,c&&(this.pendingMin=0,this.itemSizeCacheVersion++);let d=!1,h=0;if(a&&this.scrollOffset!==null){const[f,p]=a,g=this.getMeasurements(),{count:y,getItemKey:w}=this.options;let v=0;for(;v<y&&w(v)!==f;)v++;if(v<y){const b=g[v];if(b){const x=b.start+p;x!==this.scrollOffset&&(h=x-this.scrollOffset,this.scrollOffset=x,d=!0)}}}(d||l)&&(this.pendingScrollAnchor=[d?a[0]:null,d?a[1]:0,l,h])},this.notify=n=>{var s,r;(r=(s=this.options).onChange)==null||r.call(s,this,n)},this.maybeNotify=Vm(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}if(this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,o)=>{this._intendedScrollOffset!==null&&Math.abs(i-this._intendedScrollOffset)<1.5&&(i=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=o,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const i=this.scrollElement,o=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},a=()=>{this._iosTouching=!1,!(!w3()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",o,Tk),i.addEventListener("touchend",a,Tk),this.unsubs.push(()=>{i.removeEventListener("touchstart",o),i.removeEventListener("touchend",a),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const r=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,r&&this.scrollElement&&this.options.enabled){const[i,o,a,l]=r;i!==null&&!a&&(w3()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?l!==0&&(this._iosDeferredAdjustment+=l):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),a&&this.scrollToEnd({behavior:a})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const n=this.getScrollOffset(),s=this.getMaxScrollOffset();if(n<0||n>s)return;const r=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=r,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,s)=>{const r=new Map,i=new Map;for(let o=s-1;o>=0;o--){const a=n[o];if(r.has(a.lane))continue;const l=i.get(a.lane);if(l==null||a.end>l.end?i.set(a.lane,a):a.end<l.end&&r.set(a.lane,!0),r.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((o,a)=>o.end===a.end?o.index-a.index:o.end-a.end)[0]:void 0},this.getMeasurementOptions=Vm(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(n,s,r,i,o,a,l)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:n,paddingStart:s,scrollMargin:r,getItemKey:i,enabled:o,lanes:a,laneAssignmentMode:l}),{key:!1}),this.getMeasurements=Vm(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:s,scrollMargin:r,getItemKey:i,enabled:o,lanes:a,laneAssignmentMode:l},c)=>{const d=this.itemSizeCache;if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const g of this.laneAssignments.keys())g>=n&&this.laneAssignments.delete(g);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(g=>{this.itemSizeCache.set(g.key,g.size)}));const h=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),a===1){const g=this.options.gap,y=n*2;let w=this._flatMeasurements;if(!w||w.length<y){const x=new Float64Array(y);w&&h>0&&x.set(w.subarray(0,h*2)),w=x,this._flatMeasurements=w}let v;if(h===0)v=s+r;else{const x=h-1;v=w[x*2]+w[x*2+1]+g}for(let x=h;x<n;x++){const k=i(x),T=d.get(k),C=typeof T=="number"?T:this.options.estimateSize(x);w[x*2]=v,w[x*2+1]=C,v+=C+g}const b=Tde(n,w,i);return this.measurementsCache=b,b}const f=this.measurementsCache.slice(0,h),p=new Array(a).fill(void 0);for(let g=0;g<h;g++){const y=f[g];y&&(p[y.lane]=g)}for(let g=h;g<n;g++){const y=i(g),w=this.laneAssignments.get(g);let v,b;const x=l==="estimate"||d.has(y);if(w!==void 0&&this.options.lanes>1){v=w;const S=p[v],_=S!==void 0?f[S]:void 0;b=_?_.end+this.options.gap:s+r}else{const S=this.options.lanes===1?f[g-1]:this.getFurthestMeasurement(f,g);b=S?S.end+this.options.gap:s+r,v=S?S.lane:g%this.options.lanes,this.options.lanes>1&&x&&this.laneAssignments.set(g,v)}const k=d.get(y),T=typeof k=="number"?k:this.options.estimateSize(g),C=b+T;f[g]={index:g,start:b,size:T,end:C,key:y,lane:v},p[v]=g}return this.measurementsCache=f,f},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Vm(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,s,r,i)=>this.range=n.length>0&&s>0?$de({measurements:n,outerSize:s,scrollOffset:r,lanes:i,flat:i===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Vm(()=>{let n=null,s=null;const r=this.calculateRange();return r&&(n=r.startIndex,s=r.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,s]},(n,s,r,i,o)=>i===null||o===null?[]:n({startIndex:i,endIndex:o,overscan:s,count:r}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const s=this.options.indexAttribute,r=n.getAttribute(s);return r?parseInt(r,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var s;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const r=this.scrollState.index??((s=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:s.index);if(r!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),o=Math.max(0,r-i),a=Math.min(this.options.count-1,r+i);return n>=o&&n<=a}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((o,a)=>{o.isConnected||(this.observer.unobserve(o),this.elementsCache.delete(a))});return}const s=this.indexFromElement(n),r=this.options.getItemKey(s),i=this.elementsCache.get(r);i!==n&&(i&&this.observer.unobserve(i),this.observer.observe(n),this.elementsCache.set(r,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,s)=>{var r,i;if(n<0||n>=this.options.count)return;let o,a,l;const c=this._flatMeasurements;if(this.options.lanes===1&&c!==null)l=this.options.getItemKey(n),a=c[n*2],o=c[n*2+1];else{const f=this.measurementsCache[n];if(!f)return;l=f.key,a=f.start,o=f.size}const d=this.itemSizeCache.get(l)??o,h=s-d;if(h!==0){const f=this.options.anchorTo==="end"&&((r=this.scrollState)==null?void 0:r.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,p=f?this.getTotalSize():0,g=((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[n]??{index:n,key:l,start:a,size:o,end:a+o,lane:0},h,this):a<this.getScrollOffset()+this.scrollAdjustments&&this.scrollDirection!=="backward");(this.pendingMin===null||n<this.pendingMin)&&(this.pendingMin=n),this.itemSizeCache.set(l,s),this.itemSizeCacheVersion++,f?this.applyScrollAdjustment(this.getTotalSize()-p):g&&this.applyScrollAdjustment(h),this.notify(!1)}},this.getVirtualItems=Vm(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,s)=>{const r=[];for(let i=0,o=n.length;i<o;i++){const a=n[i],l=s[a];r.push(l)}return r},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const s=this.getMeasurements();if(s.length===0)return;const r=this._flatMeasurements,i=this.options.lanes===1&&r!=null,o=CU(0,s.length-1,i?a=>r[a*2]:a=>xj(s[a]).start,n);return xj(s[o])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(n=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=n,this.getOffsetForAlignment=(n,s,r=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),o=this.getScrollOffset();s==="auto"&&(s=n>=o+i?"end":"start"),s==="center"?n+=(r-i)/2:s==="end"&&(n-=i);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,n),0)},this.getOffsetForIndex=(n,s="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const r=this.getSize(),i=this.getScrollOffset(),o=this.measurementsCache[n];if(!o)return;if(s==="auto")if(o.end>=i+r-this.options.scrollPaddingEnd)s="end";else if(o.start<=i+this.options.scrollPaddingStart)s="start";else return[i,s];if(s==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),s];const a=s==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,s,o.size),s]},this.scrollToOffset=(n,{align:s="start",behavior:r="auto"}={})=>{const i=this.getOffsetForAlignment(n,s),o=this.now();this.scrollState={index:null,align:s,behavior:r,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:s="auto",behavior:r="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const i=this.getOffsetForIndex(n,s);if(!i)return;const[o,a]=i,l=this.now();this.scrollState={index:n,align:a,behavior:r,startedAt:l,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:s="auto"}={})=>{const r=this.getScrollOffset()+n,i=this.now();this.scrollState={index:null,align:"start",behavior:s,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:n="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:n});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:n})},this.getTotalSize=()=>{var n;const s=this.getMeasurements();let r;if(s.length===0)r=this.options.paddingStart;else if(this.options.lanes===1){const i=s.length-1,o=this._flatMeasurements;o!=null?r=o[i*2]+o[i*2+1]:r=((n=s[i])==null?void 0:n.end)??0}else{const i=Array(this.options.lanes).fill(null);let o=s.length-1;for(;o>=0&&i.some(a=>a===null);){const a=s[o];i[a.lane]===null&&(i[a.lane]=a.end),o--}r=Math.max(...i.filter(a=>a!==null))}return Math.max(r-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const n=[];if(this.itemSizeCache.size===0)return n;const s=this.getMeasurements();for(const r of s)r&&this.itemSizeCache.has(r.key)&&n.push({index:r.index,key:r.key,start:r.start,size:r.size,end:r.end,lane:r.lane});return n},this._scrollToOffset=(n,{adjustments:s,behavior:r})=>{this._intendedScrollOffset=n+(s??0),this.options.scrollToFn(n,{behavior:r,adjustments:s},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,n){t!==0&&(w3()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=t:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:n}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const s=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,r=s?s[0]:this.scrollState.lastTargetOffset,i=1,o=r!==this.scrollState.lastTargetOffset;if(!o&&Ede(r,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=i){this.getScrollOffset()!==r&&this._scrollToOffset(r,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,o){const a=this.getSize()||600,l=Math.abs(r-this.getScrollOffset()),c=this.scrollState.behavior==="smooth"&&l>a;this.scrollState.lastTargetOffset=r,c||(this.scrollState.behavior="auto"),this._scrollToOffset(r,{adjustments:void 0,behavior:c?"smooth":"auto"})}this.scheduleScrollReconcile()}}const CU=(e,t,n,s)=>{for(;e<=t;){const r=(e+t)/2|0,i=n(r);if(i<s)e=r+1;else if(i>s)t=r-1;else return r}return e>0?e-1:0};function $de({measurements:e,outerSize:t,scrollOffset:n,lanes:s,flat:r}){const i=e.length-1,o=r?d=>r[d*2]:d=>e[d].start,a=r?d=>r[d*2]+r[d*2+1]:d=>e[d].end;if(e.length<=s)return{startIndex:0,endIndex:i};let l=CU(0,i,o,n),c=l;if(s===1)for(;c<i&&a(c)<n+t;)c++;else if(s>1){const d=Array(s).fill(0);for(;c<i&&d.some(f=>f<n+t);){const f=e[c];d[f.lane]=f.end,c++}const h=Array(s).fill(n+t);for(;l>=0&&h.some(f=>f>=n);){const f=e[l];h[f.lane]=f.start,l--}l=Math.max(0,l-l%s),c=Math.min(i,c+(s-1-c%s))}return{startIndex:l,endIndex:c}}const x3=typeof document<"u"?m.useLayoutEffect:m.useEffect;function zde({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n="transform",...s}){const r=m.useReducer(c=>c+1,0)[1],i=m.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});i.current.enabled=t,i.current.mode=n;const o=c=>{const d=i.current;if(!d.enabled)return;const h=c.getTotalSize();if(d.container&&h!==d.lastSize){d.lastSize=h;const v=c.options.horizontal?"width":"height";d.container.style[v]=`${h}px`}const f=!!c.options.horizontal,p=d.mode==="transform",g=f?"left":"top",y=c.options.scrollMargin,w=c.getVirtualItems();for(const v of w){const b=v.start-y,x=c.elementsCache.get(v.key);x&&d.lastPositions.get(x)!==b&&(d.lastPositions.set(x,b),p?x.style.transform=f?`translate3d(${b}px, 0, 0)`:`translate3d(0, ${b}px, 0)`:x.style[g]=`${b}px`)}},a={...s,onChange:(c,d)=>{var h;const f=i.current;let p=!0;if(f.enabled){o(c);const g=c.range,y=f.prevRange;p=!y||y.isScrolling!==c.isScrolling||y.startIndex!==(g==null?void 0:g.startIndex)||y.endIndex!==(g==null?void 0:g.endIndex),p&&(f.prevRange=g?{startIndex:g.startIndex,endIndex:g.endIndex,isScrolling:c.isScrolling}:null)}p&&(e&&d?_l.flushSync(r):r()),(h=s.onChange)==null||h.call(s,c,d)}},[l]=m.useState(()=>{const c=new Bde(a);return Object.assign(c,{containerRef:d=>{const h=i.current;if(h.container=d,h.lastSize=null,d&&h.enabled){const f=c.getTotalSize();h.lastSize=f;const p=c.options.horizontal?"width":"height";d.style[p]=`${f}px`}}})});return l.setOptions(a),x3(()=>l._didMount(),[]),x3(()=>l._willUpdate()),x3(()=>{o(l)}),l}function Fde(e){return zde({observeElementRect:Ide,observeElementOffset:Lde,scrollToFn:Pde,...e})}function TU(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function qde(e){var t;return((t=TU(e))==null?void 0:t.type)==="task_execution"}function v_(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||e.subTools||e.subContent||qde(e.rawOutput)?!0:!!((n=e.args)!=null&&n.subagent_type)}function EU(e){var n;if(!v_(e))return!1;const t=TU(e.rawOutput);return(t==null?void 0:t.status)==="background"||((n=e.args)==null?void 0:n.run_in_background)===!0}const AU=m.createContext({}),_j=AU.Provider;function zc(){return m.useContext(AU)}const Hde=["en","zh-CN"],qE={"git.currentBranch":e=>`Current Git branch: ${(e==null?void 0:e.branch)??""}`,"workspace.paneLabel":e=>`Workspace: ${(e==null?void 0:e.name)??""}`,"about.auth":"Auth","about.baseUrl":"Base URL","about.fastModel":"Fast Model","about.memoryUsage":"Memory Usage","about.model":"Model","about.noProxy":"no proxy","about.noSandbox":"no sandbox","about.platform":"OS","about.proxy":"Proxy","about.qwenCode":"Qwen Code","about.runtime":"Runtime","about.sandbox":"Sandbox","about.sessionId":"Session ID","about.title":"Status","agent.back":"Back","agent.builtInBadge":"(built-in)","agent.action.delete":"Delete Agent","agent.action.edit":"Edit Agent","agent.action.view":"View Agent","agent.chooseAction":e=>`Choose action for ${(e==null?void 0:e.name)??""}`,"agent.chooseActionTitle":"Choose Action","agent.colorLabel":"Color: ","agent.colorUpdated":e=>`Updated color for ${(e==null?void 0:e.name)??""}`,"agent.create":"Create a new subagent","agent.create.button":"Create Agent","agent.create.confirm":"Confirm and Save","agent.create.desc":"Create a new subagent","agent.create.descPlaceholder":"What does this agent do?","agent.create.describeAgent":"Describe Your Subagent","agent.create.description":"Description","agent.create.editAgain":"Edit","agent.create.enterDescription":"Enter Description","agent.create.enterName":"Enter Subagent Name","agent.create.enterPrompt":"Enter System Prompt","agent.create.generateFailed":e=>`Failed to generate subagent: ${(e==null?void 0:e.error)??"Unknown error"}`,"agent.create.generatingConfig":"Generating subagent configuration...","agent.create.loading":"Creating...","agent.create.location":"Choose Location","agent.create.method":"Choose Generation Method","agent.create.method.manual":"Manual Creation","agent.create.method.qwen":"Generate with Qwen Code","agent.create.method.qwen.recommended":"Generate with Qwen Code (Recommended)","agent.create.method.qwen.desc":"LLM generates name, prompt, and description","agent.create.name":"Name","agent.create.namePlaceholder":"my-agent","agent.create.nameHelp":"Enter a clear, unique name for this subagent.","agent.create.project":"Project","agent.create.project.cli":"Project-level (.qwen/agents/)","agent.create.project.desc":"Create a project-level subagent","agent.create.prompt":"System prompt","agent.create.promptPlaceholder":"You are a specialized agent that...","agent.create.promptPlaceholder.cli":"e.g., You are an expert code reviewer...","agent.create.promptHelp":"Write the system prompt that defines this subagent's behavior. Be comprehensive for best results.","agent.create.preview":"Preview","agent.create.qwenHint":"Describe what this subagent should do and when it should be used. (Be comprehensive for best results)","agent.create.qwenPlaceholder":"> e.g., Expert code reviewer that reviews code based on best practices...","agent.create.required":"Name, description, and system prompt are required.","agent.create.save":"Save Agent","agent.create.scope":"Choose where to save the subagent","agent.create.manualDescHelp":"Describe when and how this subagent should be used.","agent.create.manualDescPlaceholder":"e.g., Reviews code for best practices and potential bugs.","agent.create.toolsSelection":"Select Tools","agent.create.tools.all":"All Tools","agent.create.tools.allDefault":"All Tools (Default)","agent.create.tools.allInfo":"All tools selected, including MCP tools","agent.create.tools.allInfoFallback":"All tools selected, including MCP tools","agent.create.tools.editLabel":"• Edit tools:","agent.create.tools.executionLabel":"• Execution tools:","agent.create.tools.none":"(none)","agent.create.tools.readEdit":"Read & Edit Tools","agent.create.tools.readEditExecute":"Read & Edit & Execution Tools","agent.create.tools.readOnlyLabel":"• Read-only tools:","agent.create.tools.readOnly":"Read-only Tools","agent.create.tools.selected":"Selected tools:","agent.create.user":"User","agent.create.user.cli":"User-level (~/.qwen/agents/)","agent.create.user.desc":"Create a user-level subagent","agent.createFirstHint":"Use '/agents create' to create your first subagent.","agent.created":e=>`Created ${(e==null?void 0:e.name)??""}`,"agent.delete":"Delete","agent.delete.confirm":e=>`Are you sure you want to delete "${(e==null?void 0:e.name)??""}"?`,"agent.delete.loading":"Deleting...","agent.delete.no":"No","agent.delete.title":e=>`Delete ${(e==null?void 0:e.name)??""}`,"agent.delete.yes":"Yes, delete","agent.deleted":e=>`Deleted ${(e==null?void 0:e.name)??""}`,"agent.edit":"Edit","agent.edit.color":"Edit Color","agent.edit.tools":"Edit Tools","agent.editColorTitle":e=>`Edit Color: ${(e==null?void 0:e.name)??""}`,"agent.editTitle":e=>`Edit ${(e==null?void 0:e.name)??""}`,"agent.empty":"No subagents found.","agent.noMatches":"No matching subagents found.","agent.footer.back":"Esc to go back","agent.footer.cliBack":"Enter to select, ↑↓ to navigate, Esc to go back","agent.footer.cliSelect":"Enter to select, ↑↓ to navigate, Esc to close","agent.footer.close":"Esc to close","agent.footer.deleteConfirm":"Enter to confirm, Esc to cancel","agent.footer.enterNext":"Press Enter to continue, Esc to go back","agent.footer.generating":"Esc to cancel","agent.footer.createLocation":"Press Enter to continue, ↑↓ to navigate, Esc to cancel","agent.footer.createContinue":"Press Enter to continue, ↑↓ to navigate, Esc to go back","agent.footer.final":"Press Enter to save, e to save and edit, Esc to go back","agent.footer.nav":"↑↓ navigate · Enter select · Esc back","agent.footer.navBack":"↑↓ navigate · Enter select · Esc back","agent.footer.navSelect":"↑↓ navigate · Enter select · Esc close","agent.footer.viewerBack":"Esc to go back","agent.filePathLabel":"File Path: ","agent.label":"Agent","agent.location":"Location","agent.level.builtin":"Built-in","agent.level.extension":"Extension","agent.level.project":"Project","agent.level.user":"User","agent.manage":"Manage","agent.manage.desc":"Manage existing subagents","agent.modelLabel":"Model: ","agent.overriddenBadge":"(overridden by project level agent)","agent.readonly":"This agent is read-only.","agent.select":"Select an agent.","agent.selectAction":"Select an action","agent.descriptionLabel":"Description:","agent.systemPromptLabel":"System Prompt:","agent.step":e=>`Step ${(e==null?void 0:e.n)??""}`,"agent.tools":"Tools","agent.toolsLabel":"Tools: ","agent.detail.overview":"Basic Information","agent.detail.tools":"Tools","agent.detail.systemPrompt":"System Prompt","agent.toolsUpdated":e=>`Updated tools for ${(e==null?void 0:e.name)??""}`,"agent.usingCount":e=>`Using: ${(e==null?void 0:e.count)??0} agents`,"agent.view":"View","agents.closed":"Agents panel closed.","agents.title":"Agents","subagent.result":"Result","subagent.tools":e=>`Tools (${(e==null?void 0:e.count)??0})`,"subagent.toolsCount":e=>`${(e==null?void 0:e.count)??0} tools`,"subagent.toggleStream":"Toggle agent stream details","subagent.pending":"pending","subagent.running":"running","timeline.parallelAgents":"Parallel agents","timeline.thinking":"Thinking","timeline.assistantUpdate":"Assistant update","timeline.toolCalls":e=>`${(e==null?void 0:e.count)??0} tool call${(e==null?void 0:e.count)===1?"":"s"}`,"timeline.planUpdate":"Plan update","timeline.statusUpdate":"Status update","timeline.userTurn":"User turn","timeline.planDetail":"plan update","timeline.parallelAgentsDetail":e=>`${(e==null?void 0:e.count)??0} parallel agent${(e==null?void 0:e.count)===1?"":"s"}`,"timeline.noActivity":"No activity","timeline.sessionTimeline":"Session timeline","timeline.turnPrefix":e=>`Turn ${(e==null?void 0:e.index)??0}`,"timeline.currentTurn":"Current turn","timeline.kind.thought":"thinking","timeline.kind.commentary":"assistant update","timeline.kind.tool":"tool calls","timeline.kind.agents":"parallel agents","timeline.kind.plan":"plan update","timeline.kind.status":"status update","timeline.kind.none":"turn","common.copy":"Copy","common.open":"Open","common.na":"N/A","common.server":"Server","common.agent":"Agent","common.auto":"auto","common.runtime":"Runtime","common.failedToLoad":"Failed to load","auth.notSet":"(not set)","auth.apiKeyPlaceholder":"sk-...","auth.modelsPlaceholder":"model-id-1, model-id-2","model.usingModel":e=>`Using ${e!=null&&e.isRuntime?"runtime ":""}model: ${(e==null?void 0:e.modelId)??""}`,"mermaid.label":"mermaid","mermaid.errorLabel":"mermaid (error)","user.uploadedImage":e=>`User uploaded image ${(e==null?void 0:e.index)??1}`,"voice.noSpeech":"No speech detected.","voice.stopDictation":"Stop dictation","voice.transcribing":"Transcribing…","voice.starting":"Starting…","voice.errorRetry":e=>`Voice error — click to retry${e!=null&&e.message?`: ${e.message}`:""}`,"voice.noSpeechRetry":"No speech detected — click to retry","voice.startDictation":"Start voice dictation","voice.error":"Voice error","resume.failedToLoad":"Failed to load sessions","toast.dismiss":"Dismiss notification","toast.dismissShort":"Dismiss","insight.ready":"Insight report generated successfully!","request.cancelled":"Request cancelled.","approval.execQuestion":e=>`Allow execution of: '${(e==null?void 0:e.tool)??""}'?`,"approval.changeQuestion":"Apply this change?","approval.launchAgentQuestion":"Launch this agent?","approval.option.allowOnce":"Yes, allow once","approval.option.rejectOnce":"Reject","approval.option.allowAllEdits":"Allow All Edits","approval.option.allowAlwaysProject":"Always allow in this project","approval.option.allowAlwaysUser":"Always allow for this user","approval.option.allowAlwaysServer":"Always allow for this server","approval.option.allowAlwaysTool":"Always allow for this tool","assistant.branch":"Branch","assistant.copy":"Copy","at.category.extensions":"Extensions","at.category.extensions.description":"Reference active extensions","at.category.files":"Files","at.category.files.description":"Reference workspace files","at.category.mcpResources":"MCP resources","at.category.mcpResources.description":"Reference MCP server resources","at.menu":"Reference menu","common.back":"back","common.all":"All","common.cancel":"cancel","common.close":"close","common.fullscreen":"Fullscreen","common.exitFullscreen":"Exit fullscreen","common.continue":"continue","common.current":"current","common.disabled":"disabled","common.enabled":"enabled","common.enterSelect":"Enter to select","common.invalid":"invalid","common.loading":"Loading...","common.retry":"Try again","common.save":"save","common.navigate":"↑↓ to navigate","common.next":"next","common.noResults":"No results","common.previous":"previous","common.expand":"Expand","common.collapse":"Collapse","common.refresh":"refresh","common.search":"Search","common.valid":"valid","common.clients":e=>`${(e==null?void 0:e.count)??0} clients`,"agent.count":e=>`${(e==null?void 0:e.count)??0} agents`,"askUser.submit":"Submit","askUser.ignore":"Ignore","askUser.multiHint":"multiple choice","askUser.progress":e=>`${(e==null?void 0:e.current)??0}/${(e==null?void 0:e.total)??0} questions`,"askUser.selectAnswer":"Select an answer","askUser.typePlaceholder":"Type something...","copy.failedFallback":"Failed to copy to the clipboard","copy.inlineLatexMissing":"No matching inline LaTeX expression found in the last AI output.","copy.latexMissing":"No matching LaTeX block found in the last AI output.","copy.noOutput":"No output in history","copy.noText":"Last AI output contains no text to copy.","copy.codeMissing":"No matching code block found in the last AI output.","copy.outputCopied":"Last output copied to the clipboard","copy.toClipboard":e=>`${(e==null?void 0:e.label)??"Selection"} copied to the clipboard`,"code.copy":"Copy","code.copied":"Copied!","echartsChart.defaultTitle":"Chart Loading","echartsChart.noData":"No data","echartsChart.tableNotice":e=>{const t=Number((e==null?void 0:e.omittedRows)??0),n=Number((e==null?void 0:e.omittedColumns)??0);return t>0&&n>0?`Showing ${(e==null?void 0:e.visibleRows)??0} of ${(e==null?void 0:e.totalRows)??0} rows and ${(e==null?void 0:e.visibleColumns)??0} of ${(e==null?void 0:e.totalColumns)??0} columns`:n>0?`Showing ${(e==null?void 0:e.visibleColumns)??0} of ${(e==null?void 0:e.totalColumns)??0} columns`:`Showing ${(e==null?void 0:e.visibleRows)??0} of ${(e==null?void 0:e.totalRows)??0} rows`},"echartsChart.rendering":"Rendering chart","echartsChart.runtimeUnavailable":"Chart runtime is unavailable.","echartsChart.renderFailed":"Chart render failed.","echartsChart.viewMode":"View mode","echartsChart.showChart":"Show chart","echartsChart.showData":"Show data","echartsChart.chart":"Chart","echartsChart.data":"Data","markdownTable.blank":"(blank)","markdownTable.column":e=>`Column ${(e==null?void 0:e.index)??""}`,"markdownTable.rows":e=>{const t=Number((e==null?void 0:e.count)??0);return`${t} row${t===1?"":"s"}`},"markdownTable.rowsFiltered":e=>`${(e==null?void 0:e.visible)??0}/${(e==null?void 0:e.total)??0} rows`,"markdownTable.hint":"Click headers to sort, open filters from ▾.","markdownTable.filtersActive":e=>{const t=Number((e==null?void 0:e.count)??0);return`${t} filter${t===1?"":"s"}`},"markdownTable.selection.selected":"Selected","markdownTable.selection.nonEmpty":"Non-empty","markdownTable.selection.numeric":"Numeric","markdownTable.selection.sum":"Sum","markdownTable.selection.average":"Average","markdownTable.selection.min":"Min","markdownTable.selection.max":"Max","markdownTable.copyTsv":"Copy TSV","markdownTable.copyVisible":"Quick copy","markdownTable.freezeFirstColumn":"Freeze first column","markdownTable.unfreezeFirstColumn":"Unfreeze first column","markdownTable.density":e=>`Density: ${(e==null?void 0:e.density)??""}`,"markdownTable.density.standard":"Standard","markdownTable.density.compact":"Compact","markdownTable.density.comfortable":"Comfortable","markdownTable.expandLongText":"Expand text","markdownTable.collapseLongText":"Collapse text","markdownTable.emptyValue":"(blank)","markdownTable.hideColumn":"Hide column","markdownTable.showHiddenColumns":e=>{const t=Number((e==null?void 0:e.count)??0);return`Show ${t} hidden column${t===1?"":"s"}`},"markdownTable.moveColumn":e=>`Move ${(e==null?void 0:e.column)??""}`,"markdownTable.resizeColumn":e=>`Resize ${(e==null?void 0:e.column)??""}`,"markdownTable.rowDetails":"Details","markdownTable.rowDetailsAria":e=>`View details for row ${(e==null?void 0:e.index)??""}`,"markdownTable.closeRowDetailsAria":e=>`Hide details for row ${(e==null?void 0:e.index)??""}`,"markdownTable.detailsHeader":"Row details","markdownTable.cellDialogTitle":"Current field value","markdownTable.copyCell":"Copy","markdownTable.close":"Close","markdownTable.actions":"Actions","markdownTable.sortByColumn":e=>`Sort by ${(e==null?void 0:e.column)??""}`,"markdownTable.sortByColumnAsc":e=>`Sort by ${(e==null?void 0:e.column)??""}, ascending`,"markdownTable.sortByColumnDesc":e=>`Sort by ${(e==null?void 0:e.column)??""}, descending`,"markdownTable.filterColumn":e=>`Filter ${(e==null?void 0:e.column)??""}`,"markdownTable.empty":"This table has no data.","markdownTable.emptyFiltered":"No rows match the filters.","markdownTable.sort.asc":"Sort ascending","markdownTable.sort.desc":"Sort descending","markdownTable.sort.clear":"Clear sort","markdownTable.filter.searchPlaceholder":"Search filter values","markdownTable.filter.searchAria":e=>`Search ${(e==null?void 0:e.column)??""}`,"markdownTable.filter.selectVisible":"Select current results","markdownTable.filter.optionLimit":e=>`Showing first ${(e==null?void 0:e.count)??0} items. Search to narrow results.`,"markdownTable.filter.noOptions":"No matches","markdownTable.filter.custom":"Custom filter","markdownTable.filter.numberAria":e=>`Number filter for ${(e==null?void 0:e.column)??""}`,"markdownTable.filter.textAria":e=>`Text filter for ${(e==null?void 0:e.column)??""}`,"markdownTable.filter.numberPlaceholder":"Value","markdownTable.filter.toPlaceholder":"To","markdownTable.filter.textPlaceholder":"Enter filter condition","markdownTable.filter.reset":"Reset","markdownTable.filter.cancel":"Cancel","markdownTable.filter.confirm":"Confirm","markdownTable.filter.text.contains":"Contains","markdownTable.filter.text.equals":"Equals","markdownTable.filter.text.notEquals":"Does not equal","markdownTable.filter.text.startsWith":"Starts with","markdownTable.filter.text.endsWith":"Ends with","markdownTable.filter.number.gt":"Greater than","markdownTable.filter.number.gte":"Greater than or equal to","markdownTable.filter.number.lt":"Less than","markdownTable.filter.number.lte":"Less than or equal to","markdownTable.filter.number.between":"Between","mermaid.rendering":"Rendering diagram...","mermaid.viewCode":"</>","mermaid.viewDiagram":"⊞","contextUsage.active":"active","contextUsage.autocompactBuffer":"Autocompact buffer","contextUsage.bodyLoaded":"body loaded","contextUsage.builtinTools":"Built-in tools","contextUsage.contextWindow":"Context window","contextUsage.detailHint":"Run /context detail for per-item breakdown.","contextUsage.estimatedOverhead":"Estimated pre-conversation overhead","contextUsage.free":"Free","contextUsage.memoryFiles":"Memory files","contextUsage.messages":"Messages","contextUsage.mcpTools":"MCP tools","contextUsage.model":"Model","contextUsage.noSession":"No active session yet. Send your first message before viewing context usage.","contextUsage.noApiResponse":"No API response yet. Send a message to see actual usage.","contextUsage.overLimit":"Context exceeds limit! Use /compress or /clear to reduce.","contextUsage.skills":"Skills","contextUsage.systemPrompt":"System prompt","contextUsage.title":"Context Usage","contextUsage.tokens":"tokens","contextUsage.usageByCategory":"Usage by category","contextUsage.used":"Used","daemon.title":"Daemon Status","daemon.details.loading":"Loading diagnostics...","daemon.details.failed":"Failed to load diagnostics.","daemon.refresh":"Refresh","daemon.loading":"Loading daemon status...","daemon.loadFailed":"Failed to load daemon status","daemon.updatedAt":e=>`Updated ${(e==null?void 0:e.time)??""}`,"daemon.none":"none","daemon.level.ok":"OK","daemon.level.warning":"Warning","daemon.level.error":"Error","daemon.level.unavailable":"Unavailable","daemon.issues.title":"Issues","daemon.overview.title":"Daemon","daemon.overview.version":"Version","daemon.overview.pid":"PID","daemon.overview.mode":"Mode","daemon.overview.uptime":"Uptime","daemon.overview.workspace":"Workspace","daemon.runtime.title":"Runtime","daemon.runtime.activeSessions":"Active sessions","daemon.runtime.activePrompts":"Active prompts","daemon.runtime.idle":"Idle for","daemon.runtime.noActivity":"no activity yet","daemon.runtime.pendingPermissions":"Pending permissions","daemon.runtime.permissionPolicy":"Permission policy","daemon.runtime.channel":"ACP channel","daemon.runtime.channelLive":"live","daemon.runtime.channelDown":"down","daemon.runtime.startingUp":"Runtime is starting...","daemon.runtime.startFailed":"Runtime failed to start","daemon.runtime.channelWorker":"Channel worker","daemon.runtime.channelWorkerRestarts":"Worker restarts","daemon.runtime.memory":"Memory (RSS / heap)","daemon.transport.title":"Transport","daemon.transport.restSse":"REST SSE streams","daemon.transport.acpDisabled":"ACP transport disabled","daemon.transport.acpConnections":"ACP connections","daemon.transport.acpStreams":"ACP streams (session/SSE/WS)","daemon.transport.pendingRequests":"Pending client requests","daemon.transport.rateLimitRejected":"Rate-limit rejects","daemon.security.title":"Security","daemon.security.token":"Bearer token","daemon.security.requireAuth":"Require auth","daemon.security.loopback":"Loopback bind","daemon.security.allowOrigin":"Allowed origins","daemon.security.shell":"Session shell commands","daemon.security.configured":"configured","daemon.security.notConfigured":"not configured","daemon.limits.title":"Limits","daemon.limits.unlimited":"unlimited","daemon.limits.maxSessions":"Max sessions","daemon.limits.maxPendingPrompts":"Max pending prompts / session","daemon.limits.maxConnections":"Max listener connections","daemon.limits.eventRing":"Event ring size","daemon.limits.promptDeadline":"Prompt deadline","daemon.limits.sessionIdle":"Session idle timeout","daemon.capabilities.title":"Capabilities","daemon.capabilities.titleCount":e=>`Capabilities (${(e==null?void 0:e.count)??0})`,"daemon.full.sessions.title":"Sessions","daemon.full.sessions.empty":"No active sessions","daemon.full.session.pendingPrompts":e=>`${(e==null?void 0:e.count)??0} pending prompts`,"daemon.full.session.pendingPermissions":e=>`${(e==null?void 0:e.count)??0} pending permissions`,"daemon.full.session.prompting":"prompting","daemon.full.workspace.title":"Workspace Diagnostics","daemon.full.workspace.empty":"No workspace diagnostics reported","daemon.full.auth.title":"Auth","daemon.full.auth.providers":"Device-flow providers","daemon.full.auth.pending":"Pending device flows","daemon.full.acp.title":"ACP connections","daemon.tab.overview":"Overview","daemon.tab.usage":"Usage","daemon.tab.metrics":"Metrics","daemon.tab.diagnostics":"Diagnostics","daemon.charts.title":"Metrics","daemon.charts.empty":"Collecting metrics… charts appear after the first sample.","daemon.charts.concurrency":"Concurrency","daemon.charts.activePrompts":"Active tasks","daemon.charts.activeSessions":"Sessions","daemon.charts.requests":"Requests","daemon.charts.reqTotal":"Total","daemon.charts.reqErrors":"Errors","daemon.charts.apiLatency":"API latency","daemon.charts.promptLatency":"Prompt latency","daemon.charts.queueWait":"Queue wait","daemon.charts.promptDuration":"Duration","daemon.charts.eventLoop":"Event-loop lag","daemon.charts.eventLoopLag":"Lag p99","daemon.charts.queuedPrompts":"Queued","daemon.charts.reqRejected":"Rejected","daemon.charts.llmLatency":"LLM API latency","daemon.charts.apiHealth":"Model API health","daemon.charts.apiErrors":"API errors","daemon.charts.apiRetries":"Retries","daemon.charts.cpu":"CPU","daemon.charts.pipe":"IPC pipe","daemon.charts.pipeIn":"In","daemon.charts.pipeOut":"Out","daemon.charts.connections":"Connections","daemon.charts.cpuDaemon":"Daemon","daemon.charts.cpuChild":"Child","daemon.charts.rssDaemon":"Daemon RSS","daemon.charts.rssChild":"Child RSS","daemon.charts.memory":"Memory","daemon.charts.heap":"Heap","daemon.charts.tokens":"Token burn","daemon.charts.tokensIn":"Input","daemon.charts.tokensOut":"Output","daemon.charts.peak":"peak","daemon.charts.concurrency.help":"Live load at each sample: prompts running now, prompts queued (accepted but not yet dispatched), and active sessions. Queued rising above active is backpressure.","daemon.charts.requests.help":"Client↔daemon HTTP traffic per window — NOT model calls. Total requests, those returning 4xx/5xx, and those the rate limiter rejected.","daemon.charts.apiLatency.help":"Client↔daemon HTTP request duration (p50/p95) — how fast the daemon answers, not the model. Compare with LLM API latency to separate 'we are slow' from 'the model is slow'.","daemon.charts.llmLatency.help":"Per-round model API round-trip (daemon→model→daemon), p50/p95. Model-side latency, distinct from the HTTP API latency above.","daemon.charts.apiHealth.help":"Provider-side LLM failures. Each failed attempt = 1 error; each automatic backoff = 1 retry. Transient 429/5xx are usually absorbed by retries (errors ≈ retries); errors climbing above retries means calls are failing outright.","daemon.charts.promptLatency.help":"Per prompt (task): p95 time waiting in the per-session queue before dispatch, and p95 end-to-end run time. Rising queue wait signals backpressure.","daemon.charts.eventLoop.help":"Daemon event-loop lag p99 per window — the CPU-saturation / blocking signal. High lag means the daemon is starved and everything slows.","daemon.charts.cpu.help":"CPU utilization (% of all cores) at each sample: the daemon and the ACP child (where LLM/tool work runs). Child at 0% means no child is running.","daemon.charts.memory.help":"Resident memory at each sample: daemon RSS, daemon V8 heap, and ACP child RSS. Steady growth over time hints at a leak.","daemon.charts.pipe.help":"Bytes over the stdio pipe to/from the ACP child per window. Sustained high volume points to chatty framing between daemon and child.","daemon.charts.connections.help":"Live client transport connections at each sample: REST/SSE streams, ACP WebSocket streams, and ACP connections.","daemon.charts.tokens.help":"Input (prompt) and output (completion) tokens attributed to model turns per window — model spend over time.","daemon.usage.today":"Today","daemon.usage.period7d":"7D","daemon.usage.period30d":"30D","daemon.usage.rangeWeek":"Last 7 days","daemon.usage.rangeMonth":"Last 30 days","daemon.usage.rangeGroup":"Summary period","daemon.usage.tokensConsumed":"tokens consumed","daemon.usage.sessions":"Sessions","daemon.usage.requests":"Requests","daemon.usage.tools":"Tools","daemon.usage.changes":"Changes","daemon.usage.breakdownTitle":"Token Breakdown","daemon.usage.inputTokens":"Input tokens","daemon.usage.inputHint":"request + cache read","daemon.usage.outputTokens":"Output tokens","daemon.usage.outputHint":"response + reasoning","daemon.usage.cacheRead":"Cache read","daemon.usage.cacheHint":"cache read share","daemon.usage.heatmapTitle":"Token Heatmap","daemon.usage.heatmapSub":e=>`recent ${(e==null?void 0:e.months)??12} months · daily aggregated tokens`,"daemon.usage.low":"Low","daemon.usage.high":"High","daemon.usage.dowMon":"Mon","daemon.usage.dowWed":"Wed","daemon.usage.dowFri":"Fri","daemon.usage.empty":"No token usage recorded yet.","daemon.usage.loading":"Loading usage…","daemon.usage.failed":"Failed to load usage","daemon.usage.cellTokens":e=>`${(e==null?void 0:e.date)??""} · Tokens: ${(e==null?void 0:e.tokens)??"0"} · Cache: ${(e==null?void 0:e.cache)??0}%`,"daemon.usage.rangeWordToday":"Today","daemon.usage.rangeWordWeek":"7 days","daemon.usage.rangeWordMonth":"30 days","daemon.usage.modelShareTitle":"model share","daemon.usage.modelShareSub":"token share · light green shows cache read","daemon.usage.modelMeta":e=>`${(e==null?void 0:e.tokens)??"0"} tokens · cache ${(e==null?void 0:e.cache)??0}%`,"daemon.usage.skillTitle":"skill calls","daemon.usage.skillSub":"skill name / count","daemon.usage.skillName":"Skill name","daemon.usage.skillCount":"Count","daemon.usage.dailyTokensTitle":"tokens","daemon.usage.dailyTokensSub":"daily token totals","daemon.usage.dailySessionsTitle":"sessions","daemon.usage.dailySessionsSub":"active session counts per day","delete.cannotCurrent":"Cannot delete the current active session.","delete.action":"Delete","delete.deleted":"Session deleted.","delete.deletedCount":e=>`${(e==null?void 0:e.count)??0} session(s) deleted.`,"delete.deleting":"Deleting...","delete.failed":e=>`Failed to delete session.${e!=null&&e.reason?` ${e.reason}`:""}`,"delete.footer":"↑↓ navigate · Space select · Enter delete · Esc cancel","delete.noMatch":e=>`No session matching "${(e==null?void 0:e.query)??""}"`,"delete.none":"No sessions to delete","delete.allFailed":e=>`Failed to delete ${(e==null?void 0:e.count)??0} session(s): ${(e==null?void 0:e.reason)??"unknown error"}`,"delete.nonRemoved":"No sessions were deleted.","delete.notFound":"Session not found — it may have been deleted already.","delete.partialFail":e=>`${(e==null?void 0:e.removed)??0} deleted, ${(e==null?void 0:e.failed)??0} failed: ${(e==null?void 0:e.detail)??"unknown error"}`,"delete.matches":e=>`${(e==null?void 0:e.count)??0} matches`,"delete.pressSearch":"Press / to search; Space to select; Enter to delete","delete.selected":e=>`${(e==null?void 0:e.count)??0} selected`,"delete.title":"Delete Session","time.justNow":"just now","time.minutesAgo":e=>`${(e==null?void 0:e.count)??0} min ago`,"time.hoursAgo":e=>`${(e==null?void 0:e.count)??0}h ago`,"time.daysAgo":e=>`${(e==null?void 0:e.count)??0}d ago`,"dialog.footer.close":"Esc to close","dialog.footer.confirmCancel":"Enter to confirm · Esc to cancel","release.cannotCurrent":"Cannot release the current active session.","release.action":"Release","release.released":"Session released successfully.","release.failed":e=>`Failed to release session.${e!=null&&e.reason?` ${e.reason}`:""}`,"release.footer":"↑↓ to navigate · Enter to release · Esc to cancel","release.inactive":"Only active live sessions can be released.","release.inactiveBadge":"inactive","release.noMatch":e=>`No session matching "${(e==null?void 0:e.query)??""}"`,"release.matches":e=>`${(e==null?void 0:e.count)??0} matches`,"release.none":"No live sessions to release","release.pressSearch":"Press / to search; Enter releases the selected live session","release.releasing":"Releasing...","release.title":"Release Session","dialog.footer.menu":"Esc to menu","dialog.footer.mcpServers":"↑↓ to navigate · Enter details · r refresh · Esc close","dialog.footer.mcpSelect":"↑↓ to navigate · Enter select · Esc back","dialog.footer.modelFast":"↑↓ to navigate · / to search · c for custom · Enter to set fast model · Esc to cancel","dialog.footer.navSelectCancel":"↑↓ to navigate · Enter to select · Esc to cancel","dialog.footer.navSelectClose":"↑↓ to navigate · Enter to select · Esc to close","dialog.footer.navSelectMenu":"↑↓ to navigate · Enter to select · Esc to menu","dialog.footer.navOpenClose":"↑↓ to navigate · Enter to open · Esc to close","dialog.footer.navOpenMenu":"↑↓ to navigate · Enter to open · Esc to menu","dialog.footer.back":"Esc to go back","dialog.footer.backClose":"Esc to close","dialog.footer.saveClose":"↑↓ switch fields · ⌘/Ctrl+Enter to save · Esc to close","dialog.footer.saveMenu":"↑↓ switch fields · ⌘/Ctrl+Enter to save · Esc to menu","dialog.footer.search":"Type to search · Enter to commit · Esc to clear","dialog.footer.select":"Enter to select","editor.escClearHint":"Press Esc again to clear","editor.hintCommands":"commands","editor.hintFiles":"Files","editor.hintNext":"next","editor.hintPrev":"previous","editor.hintSearch":"search","editor.noHistory":"No matching history","editor.placeholder":"Type a message or @ file path","editor.shellPlaceholder":"Enter terminal command","editor.send":"Send message","editor.connectionDisconnected":"Connection interrupted. Please try again after it reconnects.","editor.sessionLoading":"Session is still loading. Try again in a moment.","editor.processing":"Processing. New messages will be queued.","editor.searchHint":"ctrl+r next · tab accept · enter send · esc cancel","editor.searchLabel":"reverse-i-search:","editor.searchPlaceholder":"type to search...","quickActions.open":"more actions","quickActions.title":"more actions","quickActions.mcp":"MCP","quickActions.context":"Context","quickActions.status":"Status","quickActions.stats":"Session","quickActions.memory":"Memory","quickActions.extensions":"Extensions","quickActions.skills":"Skills","quickActions.tools":"Tools","quickActions.agents":"Agents","quickActions.help":"Help","quickActions.theme":"Set theme","quickActions.auth":"Auth","quickActions.settings":"Settings","quickActions.new":"New session","quickActions.resume":"Switch session","quickActions.delete":"Delete session","quickActions.branch":"Copy session","quickActions.rewind":"Rewind session","quickActions.historyQuestion":"Question history","quickActions.recap":"Generate recap","quickActions.copy":"Copy output","quickActions.shellMode":"Shell mode","quickActions.exitShellMode":"Exit Shell","quickActions.setGoal":"Set goal","session.missing":"Current session does not exist","session.new":"New session","workspace.loadFailed":"Failed to load workspace","workspace.notFound":"Workspace not found","workspace.notFoundDescription":"This workspace may have been removed or the link is no longer valid.","workspace.loadFailedDescription":"The workspace service could not be reached. Check the daemon and try again.","scheduledTasks.title":"Scheduled Tasks","scheduledTasks.subtitle":"Run tasks automatically on a schedule, or trigger them manually anytime.","scheduledTasks.loading":"Loading…","scheduledTasks.count":e=>`${(e==null?void 0:e.count)??0} task${Number((e==null?void 0:e.count)??0)===1?"":"s"}`,"scheduledTasks.refresh":"Refresh","scheduledTasks.new":"New scheduled task","scheduledTasks.createViaChat":"Create via chat","scheduledTasks.chatStarter":"Help me set up a recurring scheduled task (keep it long-term). What I want: ","scheduledTasks.name":"Name","scheduledTasks.workspace":"Workspace","scheduledTasks.workspacePrimaryTag":"(primary)","scheduledTasks.taskId":"Task ID","scheduledTasks.schedule":"Schedule","scheduledTasks.type":"Type","scheduledTasks.status":"Status","scheduledTasks.namePlaceholder":"Optional — defaults to the prompt","scheduledTasks.prompt":"Prompt","scheduledTasks.promptPlaceholder":"What should this task do?","scheduledTasks.reference.extension":"Extensions","scheduledTasks.reference.skill":"Skills","scheduledTasks.reference.mcp":"MCP","scheduledTasks.referencePicker":"Reference picker","scheduledTasks.reference.loading":"Loading…","scheduledTasks.reference.empty":"No available items.","scheduledTasks.frequency":"Frequency","scheduledTasks.freq.daily":"Daily","scheduledTasks.freq.weekdays":"Weekdays","scheduledTasks.freq.weekly":"Weekly","scheduledTasks.freq.hourly":"Hourly","scheduledTasks.freq.minutes":"Every N minutes","scheduledTasks.freq.custom":"Custom (cron)","scheduledTasks.time":"Time","scheduledTasks.weekday":"Weekday","scheduledTasks.interval":"Minutes","scheduledTasks.cron":"Cron expression","scheduledTasks.weekdayNames":"Sun,Mon,Tue,Wed,Thu,Fri,Sat","scheduledTasks.human.daily":e=>`Daily at ${(e==null?void 0:e.time)??""}`,"scheduledTasks.human.weekdays":e=>`Weekdays at ${(e==null?void 0:e.time)??""}`,"scheduledTasks.human.weekly":e=>`Every ${(e==null?void 0:e.day)??""} at ${(e==null?void 0:e.time)??""}`,"scheduledTasks.human.hourly":e=>`Hourly at :${(e==null?void 0:e.min)??"00"}`,"scheduledTasks.human.everyMinutes":e=>`Every ${(e==null?void 0:e.n)??""} minutes`,"scheduledTasks.never":"Never run","scheduledTasks.repeats":"Repeats","scheduledTasks.runsOnce":"Runs once","scheduledTasks.lastFired":e=>`Last run: ${(e==null?void 0:e.when)??""}`,"scheduledTasks.runNow":"Run now","scheduledTasks.enable":"Enable","scheduledTasks.disable":"Disable","scheduledTasks.delete":"Delete","scheduledTasks.deleteConfirmTitle":"Delete scheduled task","scheduledTasks.deleteConfirm":e=>`Delete scheduled task "${(e==null?void 0:e.name)??""}"?`,"scheduledTasks.deletedSnapshot":"This scheduled task has been deleted. Showing the snapshot from when it was created.","scheduledTasks.sessionScopedSnapshot":"This is a session-scoped scheduled task. Showing the snapshot from when it was created.","scheduledTasks.empty":"No scheduled tasks yet. Create one to get started.","scheduledTasks.create":"Create","scheduledTasks.creating":"Creating…","scheduledTasks.cancel":"Cancel","scheduledTasks.error.invalidSchedule":"Invalid schedule","scheduledTasks.error.emptyPrompt":"Prompt is required","scheduledTasks.error.promptTooLong":e=>`Prompt exceeds ${(e==null?void 0:e.max)??1e5}-character limit`,"scheduledTasks.error.toggleFailed":"Failed to update task","scheduledTasks.error.deleteFailed":"Failed to delete task","scheduledTasks.edit":"Edit","scheduledTasks.editTitle":"Edit scheduled task","scheduledTasks.save":"Save","scheduledTasks.saving":"Saving…","scheduledTasks.runHistory":e=>`Run history (${(e==null?void 0:e.count)??0})`,"scheduledTasks.viewHistory":e=>`View conversation (${(e==null?void 0:e.count)??0})`,"scheduledTasks.viewHistoryEmpty":"View conversation","scheduledTasks.viewHistoryHint":"Open the task's session to see its runs","scheduledTasks.runKind.catchUp":"late","scheduledTasks.runKind.manual":"manual","scheduledTasks.runKind.withheld":"skipped","scheduledTasks.error.runFailed":"Failed to record the run","scheduledTasks.error.oneShotConsumedButFailed":"The task was deleted but the prompt could not be delivered — it never ran. Recreate it to try again.","scheduledTasks.dueNow":"Due now","scheduledTasks.nextRunTooltip":e=>`Next run: ${(e==null?void 0:e.when)??""}`,"scheduledTasks.dur.d":"d","scheduledTasks.dur.h":"h","scheduledTasks.dur.m":"m","scheduledTasks.dur.s":"s","scheduledTasks.runMode":"Run mode","scheduledTasks.runMode.shared":"Shared session","scheduledTasks.runMode.isolated":"Isolated (fresh session per run)","scheduledTasks.runMode.shared.hint":"Runs accumulate in one session transcript.","scheduledTasks.runMode.isolated.hint":"Each run gets a clean session context.","scheduledTasks.condition":"Precondition (optional)","scheduledTasks.conditionPlaceholder":"e.g. Check whether anything landed on main since yesterday. If nothing did, the task should not run.","scheduledTasks.condition.hint":"Checked in this task's own session before each run. The prompt only runs in a fresh session when the check says yes — otherwise the run is skipped.","scheduledTasks.condition.cardPrefix":"If:","turnOutputs.filesEdited":e=>`Edited ${(e==null?void 0:e.count)??0} files`,"turnOutputs.viewChanges":"View changes","turnOutputs.review":"Review","turnOutputs.collapseFiles":"Collapse files","turnOutputs.showMoreFiles":e=>`Show ${(e==null?void 0:e.count)??0} more files`,"turnOutputs.previousTurn":"Previous turn","turnOutputs.fileCount":e=>`${(e==null?void 0:e.count)??0} files`,"turnOutputs.openFileTree":"Open file tree","turnOutputs.closeFileTree":"Close file tree","sidebar.label":"Workspace sidebar","sidebar.toggleMenu":"Toggle menu","sidebar.newChat":"New chat","sidebar.newTask":"New task","sidebar.plugins":"Plugins","sidebar.project":"Project","sidebar.pinnedSessions":"Pinned","sidebar.workspaceSelectLabel":"Workspace","sidebar.details":"Details","sidebar.workspacePrimary":"Primary","sidebar.workspaceUntrusted":"untrusted","sidebar.workspaceReadOnly":"read-only","sidebar.workspaceTrustToOpen":"Trust this workspace to open the session.","sidebar.addWorkspace":"Add workspace","sidebar.addWorkspaceTitle":"Add Workspace","sidebar.addWorkspacePath":"Directory path","sidebar.addWorkspaceRegister":"Register","sidebar.addWorkspaceCancel":"Cancel","sidebar.addWorkspaceError":"Failed to add workspace","sidebar.addWorkspacePersistenceError":"The daemon did not confirm persistent workspace registration","sidebar.addWorkspaceAbsError":"Path must be absolute","sidebar.addWorkspaceHint":"Enter the absolute path to a project directory.","sidebar.addWorkspacePersist":"Keep after daemon restart","sidebar.addWorkspacePersistHint":"Persist this workspace registration in the daemon configuration.","sidebar.addWorkspaceAdding":"Adding…","sidebar.removeWorkspace":"Remove workspace","sidebar.workspaceActions":"Workspace actions","sidebar.forceRemoveWorkspace":"Force remove","sidebar.removeWorkspaceTitle":"Remove Workspace","sidebar.removeWorkspaceConfirm":e=>`Remove the runtime and persistent registration for “${(e==null?void 0:e.name)??""}”? Files, settings, and session history will not be deleted.`,"sidebar.removeWorkspaceBusy":e=>`“${(e==null?void 0:e.name)??""}” still has active runtime resources. Force removal will terminate them.`,"sidebar.removeWorkspaceCurrentSession":"Switch to another workspace or close the current session before forcing removal.","sidebar.removeWorkspaceInProgress":"Another client is already removing this workspace. Refresh after that operation finishes.","sidebar.removeWorkspaceError":"Failed to remove workspace","sidebar.removeWorkspaceSessions":e=>`Sessions: ${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspacePrompts":e=>`Active prompts: ${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspaceStarts":e=>`Pending session starts: ${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspaceConnections":e=>`ACP connections: ${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspaceMemoryTasks":e=>`Memory tasks: ${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspaceWorkers":e=>`Channel workers: ${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspaceVoiceSessions":e=>`Voice sessions: ${(e==null?void 0:e.count)??0}`,"sidebar.noSessions":"No sessions.","sidebar.projectFallback":"Project","sidebar.sessionsOverview":"Session Overview","sidebar.splitView":"Split View","sidebar.settings":"Settings","sidebar.daemonStatus":"Daemon Status","sidebar.scheduledTasks":"Scheduled Tasks","sidebar.themeLight":"Switch to light theme","sidebar.themeDark":"Switch to dark theme","sidebar.collapse":"Collapse","sidebar.expand":"Expand","sidebar.collapseProject":"Collapse project","sidebar.expandProject":"Expand project","sidebar.search":"Search sessions","sidebar.searchPlaceholder":"Search sessions","sidebar.searchEmpty":"No matching sessions.","sidebar.rename":"Rename","sidebar.renameCurrentOnly":"Only the current session can be renamed","sidebar.export":"Export conversation record","sidebar.exportFailed":"Failed to export session","sidebar.delete":"Delete","sidebar.archive":"Archive","sidebar.unarchive":"Restore","sidebar.moreActions":"More actions","sidebar.archiveCurrentDisabled":"The current session cannot be archived","sidebar.archivedTitle":"Archived","sidebar.archivedEmpty":"No archived sessions.","sidebar.archiveFailed":"Failed to archive session","sidebar.unarchiveFailed":"Failed to restore session","sidebar.loadingSessions":"Loading sessions...","sidebar.loadFailed":"Failed to load sessions. Click to retry.","sidebar.renameFailed":"Failed to rename session","sidebar.deleteFailed":"Failed to delete session","sidebar.newSessionFailed":"Failed to create a new chat","sidebar.switchFailed":"Failed to switch session","sidebar.currentDeleteDisabled":"Current session cannot be deleted","sidebar.deleteConfirmDescription":e=>`Delete "${(e==null?void 0:e.name)??""}"? This cannot be undone.`,"sidebar.clients":e=>`${(e==null?void 0:e.count)??0} client(s)`,"sidebar.running":"Running","sidebar.completedUnread":"Finished","sidebar.pin":"Pin","sidebar.unpin":"Unpin","sidebar.sessionGroup":"Group","sidebar.groupFilter":"Session group","sidebar.groupAll":"All","sidebar.groupPinned":"Pinned","sidebar.groupUngrouped":"Ungrouped","sidebar.groupRecent":"Recent","sidebar.groupCreate":"Create group","sidebar.groupRename":"Rename group","sidebar.groupDelete":"Delete group","sidebar.groupColor":"Group color","sidebar.groupNamePrompt":"Group name","sidebar.groupDeleteConfirm":e=>`Delete group "${(e==null?void 0:e.name)??""}"?`,"sidebar.groupsLoadFailed":"Failed to load session groups","sidebar.groupCreateFailed":"Failed to create group","sidebar.groupAssignFailedAfterCreate":"Group created, but failed to move session into it","sidebar.groupUpdateFailed":"Failed to update group","sidebar.groupDeleteFailed":"Failed to delete group","sidebar.organizationFailed":"Failed to update session organization","sidebar.groupColor.red":"Red","sidebar.groupColor.orange":"Orange","sidebar.groupColor.yellow":"Yellow","sidebar.groupColor.green":"Green","sidebar.groupColor.blue":"Blue","sidebar.groupColor.purple":"Purple","sidebar.groupColor.custom":"Custom…","sidebar.groupColor.picker":"Choose custom group color","sidebar.groupColor.hex":"Hex color","sidebar.groupColor.invalid":"Enter a six-digit Hex color such as #416ef5.","quickKeys.cursor":"Move cursor","quickKeys.escape":"Cancel run","quickKeys.history":"History","quickKeys.retry":"Retry failed","quickKeys.searchHistory":"Search history","quickKeys.tab":"Accept completion","error.unsupportedTheme":"Unsupported theme. Use /theme light or /theme dark.","queue.delete":"Delete","queue.edit":"Edit","queue.insert":"Insert","queue.cleared":"Queue cleared.","queue.deleteTip":"Remove from queue","queue.editTip":"Remove from queue and edit again","queue.insertTip":"Insert this message into the current session; it takes effect on the next model call.","queue.inserted":"Inserted. It takes effect on the next model call.","queue.insertCommandDisabled":"Commands can't be inserted into the running turn; they run after it finishes.","queue.submitting":"Submitting...","queue.editing":"Editing...","queue.removing":"Updating...","queue.submittingDisabled":"Submitting queued message...","queue.commandBlocked":"Slash commands can't be queued while a turn is running.","queue.shellBlocked":"Shell commands can't be queued while a turn is running.","queue.queueFailed":"Failed to queue message","queue.insertFailed":"Failed to insert queued message","queue.deleteFailed":"Failed to move message out of queue","queue.editFailed":"Failed to edit queued message","queue.footer":"Press ↑ to edit the latest queued message · Esc to clear queue","queue.imageCount":e=>`(+${(e==null?void 0:e.count)??0} images)`,"queue.more":e=>`... (+${(e==null?void 0:e.count)??0} more)`,"midTurn.inserted":e=>`Inserted message: ${(e==null?void 0:e.message)??""}`,"help.builtIn":"Built-in commands","help.commandCount":e=>`${(e==null?void 0:e.count)??0} commands`,"help.commandMeta.builtIn":"built-in","help.commandMeta.custom":"custom","help.commandMeta.subcommands":e=>`${(e==null?void 0:e.count)??0} subcommands`,"help.commandsIntro":"Browse built-in commands:","help.customGroup":"Custom, skills, plugins, MCP","help.customIntro":"Browse custom, skill, plugin, and MCP commands:","help.empty":"No commands are currently available.","help.emptyCustom":"No custom commands are currently available.","help.footer":"Tab/Shift+Tab to switch tabs · ↑/↓ or PgUp/PgDn to scroll · Esc to close","help.intro":"Qwen Code understands your codebase, makes edits with your permission, and executes commands right from your terminal.","help.section.shortcuts":"Shortcuts","help.search":"Search commands","help.shortcut.addContext":"Add files or folders as context","help.shortcut.altWords":"Jump through words","help.shortcut.clear":"Clear the screen","help.shortcut.commandMenu":"Open command menu","help.shortcut.completion":"Accept completion or switch help tabs","help.shortcut.history":"Cycle prompt history or scroll lists","help.shortcut.searchHistory":"Search prompt history","help.shortcut.newline":"Insert a newline","help.shortcut.pasteImages":"Paste images","help.shortcut.shell":"Run shell commands","help.shortcut.togglePanel":"Toggle this panel","help.shortcut.retry":"Retry last request","help.shortcut.compact":"Toggle compact mode","retry.hint":"Press Ctrl+Y to retry or click to retry","retry.none":"No failed request to retry.","branch.failed":"Failed to branch session.","branch.success":e=>`Copied session. New session name: "${(e==null?void 0:e.name)??""}". Switched to the new session.`,"fork.empty":"Please provide a directive. Usage: /fork <directive>","fork.failed":e=>`Failed to launch fork: ${(e==null?void 0:e.reason)??""}`,"fork.notStarted":"Background agent was not launched.","fork.started":e=>`Started background agent: "${(e==null?void 0:e.name)??""}". Track it in background tasks.`,"command.hidden":"This command is not available.","help.shortcut.approvals":"Cycle approval modes","help.shortcut.cancel":"Close dialogs or cancel operation","bug.failed":"Failed to load system info for bug report.","bug.popupBlocked":"Popup blocked — please allow popups and try again.","bug.submitted":"Bug report opened in a new tab.","clear.blocked":"Cannot clear while streaming — cancel first (Esc).","error.unknown":"Unknown error","error.modelStreamInterrupted":"Model response stream was interrupted. Please retry.","shell.command":"Shell Command","compact.enabled":"Compact mode enabled","compact.disabled":"Compact mode disabled","compact.hint":"Press Ctrl+O to show full tool output","compact.saveFailed":"Failed to save compact mode","help.subcommands":"subcommands","help.tab.commands":"Built-in commands","help.tab.custom":"custom-commands","help.tab.general":"shortcuts","help.title":"Help","slash.category.custom":"Custom commands","slash.category.skill":"Skill commands","slash.category.system":"System commands","language.changed":e=>`UI language changed to ${(e==null?void 0:e.language)??""}`,"language.current":e=>`Current UI language: ${(e==null?void 0:e.language)??""}`,"language.invalid":"Invalid language. Available: en, zh-CN","language.options":"Available options:","language.set":"Set UI language","language.usage":"Usage: /language ui [en|zh-CN]","localCommand.noSession":"No active session yet. Send your first message before using this command.","local.agents":"Manage subagents","local.bug":"Submit a bug report","local.compress":"Compress the context into a summary","local.compressFast":"Fast context compression without AI","local.config":"Get or set any setting by dot-path key","local.diff":"Show working-tree change stats versus HEAD","local.directory":"Manage workspace directories","local.docs":"Open the full Qwen Code documentation","local.doctor":"Run installation and environment diagnostics","local.dream":"Consolidate managed auto-memory topic files","local.effort":"Set reasoning effort for capable models","local.export":"Export the current session history to a file","local.forget":"Remove matching entries from managed auto-memory","local.hooks":"Manage Qwen Code hooks","local.importConfig":"Import MCP servers from Claude configs","local.init":"Analyze the project and create a QWEN.md file","local.insight":"Generate programming insights from chat history","local.lsp":"Show LSP server status","local.remember":"Save a durable memory to the memory system","local.summary":"Generate a project summary file","local.workflows":"List active and completed workflow runs","skilldesc.batch":"Run batch operations across many files in parallel","skilldesc.dataviz":"Design guidance for charts and data visualizations","skilldesc.extensionCreator":"Create, test, and customize Qwen Code extensions","skilldesc.loop":"Run a prompt on a schedule or self-paced wakeups","skilldesc.newApp":"Workflow for building a new app from scratch","skilldesc.qcHelper":"Answer questions about using Qwen Code","skilldesc.review":"Review changed code for bugs, security, and quality","skilldesc.simplify":"Clean up recent changes for reuse and simplicity","skilldesc.stuck":"Diagnose frozen or slow Qwen Code sessions","skilldesc.agentReproduceAlign":"Align a ported Codex/Claude Code feature with the original","skilldesc.agentReproduceFeature":"Reproduce an existing Codex/Claude Code feature","skilldesc.autofix":"Implement approved issues or address PR review feedback","skilldesc.bugfix":"Fix a bug from a GitHub issue, reproduce-first","skilldesc.codegraph":"Analyze the codebase via graph and vector index","skilldesc.createIssue":"Draft and submit a GitHub issue from an idea","skilldesc.desktopPet":"Create a pixel-art desktop pet for Qwen Code","skilldesc.docsAuditAndRefresh":"Audit and refresh docs/ against the codebase","skilldesc.docsUpdateFromDiff":"Update official docs from local git diff","skilldesc.e2eTesting":"Run end-to-end tests of the Qwen Code CLI","skilldesc.featDev":"End-to-end workflow for a non-trivial feature","skilldesc.memoryLeakDebug":"Diagnose CLI memory leaks via heap snapshots","skilldesc.openworkDesktopSync":"Sync packages/desktop with openwork commit-by-commit","skilldesc.preparePr":"Prepare a GitHub PR title and body from the branch","skilldesc.qwenCodeClaw":"Use Qwen Code as a code-understanding agent","skilldesc.structuredDebugging":"Hypothesis-driven methodology for hard bugs","skilldesc.terminalCapture":"Automate terminal UI screenshot testing","skilldesc.tmuxRealUserTesting":"Real-user testing with tmux, saving logs","skilldesc.triage":"Triage and review Qwen Code issues and PRs","local.approvalMode":"Change approval mode","local.auth":"Connect an LLM provider","auth.title":"Connect a Provider","auth.step.group":"Type","auth.step.provider":"Provider","auth.step.protocol":"Protocol","auth.step.baseUrl":"Base URL","auth.step.apiKey":"API Key","auth.step.models":"Model IDs","auth.step.advanced":"Advanced Config","auth.protocol.openai":"OpenAI-compatible","auth.protocol.openaiDesc":"Standard OpenAI API format (most common)","auth.protocol.anthropic":"Anthropic-compatible","auth.protocol.anthropicDesc":"Anthropic Messages API format","auth.protocol.gemini":"Gemini-compatible","auth.protocol.geminiDesc":"Google Gemini API format","auth.apiKeyRequired":"API key cannot be empty.","auth.baseUrlInvalid":"Base URL must start with http:// or https://.","auth.baseUrlPrompt":"Enter the API endpoint for this protocol.","auth.baseUrlRequired":"Base URL cannot be empty.","auth.documentation":"Documentation","auth.modelsRequired":"Model IDs cannot be empty.","auth.review":"Review","auth.reviewText":"The following JSON will be saved to settings.json:","auth.save":"Save","auth.saving":"Saving...","auth.termsTitle":"Terms of Services and Privacy Notice","auth.continue":"Continue","auth.modelsPrompt":e=>`Enter model IDs separated by commas. Examples: ${(e==null?void 0:e.modelIds)??""}`,"auth.advanced.prompt":"Optional: configure advanced generation settings.","auth.advanced.thinking":"Enable thinking","auth.advanced.thinkingDesc":"Allows the model to perform extended reasoning before responding.","auth.advanced.modality":"Enable modality","auth.advanced.modalityDesc":"Enables multimodal input capabilities (image, video, etc.).","auth.advanced.modalityImage":"Image","auth.advanced.modalityVideo":"Video","auth.advanced.modalityAudio":"Audio","auth.advanced.modalityPdf":"PDF","auth.advanced.contextWindow":"Context window","auth.advanced.contextDesc":"Max input tokens (leave empty to auto-detect from model name).","auth.advanced.contextPlaceholder":"Context window (optional)","local.btw":"Ask a quick side question without affecting the main conversation. Usage: /btw <your question>","btw.empty":"Please provide a question. Usage: /btw <your question>","btw.emptyAnswer":"No response received.","btw.failed":"Failed to answer btw question","btw.answering":"+ Answering...","btw.shortcuts.pending":"Press Escape, Ctrl+C, or Ctrl+D to cancel","btw.shortcuts.done":"Press Space, Enter, or Escape to dismiss","local.clear":"Start a new session with empty context; previous session stays on disk (resumable with /resume)","local.context":'Show context window usage breakdown. Use "/context detail" for per-item breakdown.',"local.copy":"Copy last output or snippet","local.delete":"Delete a session permanently","local.release":"Release a live session","local.rewind":"Rewind the current conversation","local.branch":"Fork the current conversation into a new session","local.fork":"Start a background agent from this conversation","local.help":"Show help and commands","local.language":"Change UI language","local.mcp":"Manage MCP servers","local.memory":"Manage memory","local.model":"Switch model or set fast model","local.new":"Start a new conversation","local.plan":"Enter Plan mode","local.goal":"Set a goal and keep working until it is met","local.recap":"Generate a session recap","recap.label":"Recap","recap.loading":"Generating recap...","recap.empty":"Not enough conversation context for a recap yet.","recap.failed":"Failed to generate recap","rewind.action":"Rewind","rewind.confirm":"Confirm rewind","rewind.empty":"No rewind snapshots are available for this session.","rewind.failed":e=>`Failed to rewind session: ${(e==null?void 0:e.reason)??""}`,"rewind.loading":"Loading rewind snapshots...","rewind.promptFallback":e=>`Prompt ${(e==null?void 0:e.id)??""}`,"rewind.rewinding":"Rewinding...","rewind.subtitle":"Only the conversation is rewound. Files are not changed.","rewind.title":"Rewind Conversation","rewind.turn":e=>`Prompt ${(e==null?void 0:e.turn)??0}`,"local.rename":"Rename current session","rename.empty":"Please enter a session name, for example /rename project debugging, or use /rename --auto.","rename.success":e=>`Session renamed to ${(e==null?void 0:e.name)??""}`,"local.reset":"Reset current conversation","local.resume":"Resume a previous session","local.skills":"View available skills","local.stats":"Show session statistics","local.tasks":"View background tasks","local.status":"Show version info","local.theme":"Change theme","local.settings":"View and edit settings","local.schedule":"Manage scheduled tasks","local.extensions":"Manage extensions. Usage: /extensions manage|install <source>","extensions.label":"extension","extensions.action.failed":e=>`Extension action failed${e!=null&&e.name?` for "${e.name}"`:e!=null&&e.source?` from "${e.source}"`:""}: ${(e==null?void 0:e.error)??"Unknown error"}`,"extensions.commands.refreshFailed":"Failed to refresh extension commands.","extensions.install.failed":e=>`Failed to install extension${e!=null&&e.source?` from "${e.source}"`:""}: ${(e==null?void 0:e.error)??"Unknown error"}`,"extensions.manage.agents":"Agents:","extensions.manage.actions":"Extension actions","extensions.manage.checkingUpdates":"Checking for updates...","extensions.manage.commands":"Commands:","extensions.manage.contextFiles":"Context files:","extensions.manage.count":e=>`${(e==null?void 0:e.count)??0} extensions installed`,"extensions.manage.detailsTitle":"Extension Details","extensions.manage.disable":"Disable Extension","extensions.manage.disabled":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" disabled.`,"extensions.manage.empty":"No extensions installed.","extensions.manage.emptyAgents":"This extension has no agents.","extensions.manage.emptyCommands":"This extension has no commands.","extensions.manage.emptyContextFiles":"This extension has no context files.","extensions.manage.emptyDescription":"Install an extension to add commands, skills, agents, or MCP servers.","extensions.manage.emptyMcpServers":"This extension has no MCP servers.","extensions.manage.emptySkills":"This extension has no skills.","extensions.manage.enable":"Enable Extension","extensions.manage.enabled":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" enabled.`,"extensions.manage.footer.back":"Esc to go back","extensions.manage.footer.confirm":"Enter confirm · Esc cancel","extensions.manage.footer.list":"↑↓ to navigate · Enter select · r refresh · Esc close","extensions.manage.footer.select":"↑↓ to navigate · Enter select · Esc back","extensions.manage.loading":"Loading extensions...","extensions.manage.mcpServers":"MCP servers:","extensions.manage.installType":"Install type:","extensions.manage.name":"Name:","extensions.manage.notUpdatable":"not updatable","extensions.manage.noDescription":"No description","extensions.manage.noMatches":"No matching extensions.","extensions.manage.origin":"Origin:","extensions.manage.overview":"Overview","extensions.manage.path":"Path:","extensions.manage.queued":e=>`Extension action queued for "${(e==null?void 0:e.name)??"extension"}".`,"extensions.manage.refreshed":e=>`Extensions refreshed in ${(e==null?void 0:e.refreshed)??0} session(s), ${(e==null?void 0:e.failed)??0} failed.`,"extensions.manage.restartRequired":"updated; restart required","extensions.manage.settings":"Settings:","extensions.manage.search":"Search extensions…","extensions.manage.skills":"Skills:","extensions.manage.source":"Source:","extensions.manage.status":"Status:","extensions.manage.status.disabled":"disabled","extensions.manage.status.enabled":"enabled","extensions.manage.title":"Manage Extensions","extensions.manage.unknownUpdate":"unknown","extensions.manage.uninstalled":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" uninstalled.`,"extensions.manage.uninstallAction":"Uninstall Extension","extensions.manage.uninstallConfirm":e=>`Uninstall extension "${(e==null?void 0:e.name)??"extension"}"?`,"extensions.manage.upToDate":"up to date","extensions.manage.update":"Update Extension","extensions.manage.updateAvailable":"update available","extensions.manage.updateError":"update check failed","extensions.manage.updateComplete":"updated","extensions.manage.updateStatus":"Update status:","extensions.manage.updating":"updating…","extensions.manage.updated":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" updated.`,"extensions.manage.updatedWithVersion":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" updated to v${(e==null?void 0:e.version)??""}.`,"extensions.manage.version":"Version:","extensions.manage.viewDetails":"View Details","extensions.install.installed":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" installed.`,"extensions.install.installedWithVersion":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" v${(e==null?void 0:e.version)??""} installed.`,"extensions.install.missingOptionValue":e=>`Missing value for ${(e==null?void 0:e.option)??"option"}`,"extensions.install.requestFailed":"Failed to install extension","extensions.install.started":e=>`Installing extension from "${(e==null?void 0:e.source)??""}"...`,"extensions.install.unknownOption":e=>`Unknown option ${(e==null?void 0:e.option)??""}`,"extensions.install.usage":"Usage: /extensions manage|install <source>","extensions.install.waitForSession":"Wait for the session to connect before installing an extension.","local.tools":"List available tools. Usage: /tools [desc]","loadWarning.commands":"Failed to load command list; slash commands may be incomplete.","loadWarning.context":"Failed to load session context; current mode may be inaccurate.","loadWarning.models":"Failed to load model list; some model details may be unavailable.","mcp.action.auth":"Authenticate","mcp.action.authHint":"Not exposed by daemon yet","mcp.action.authMessage":"Daemon serve does not expose MCP authentication yet.","mcp.action.clearAuth":"Clear Authentication","mcp.action.disable":"Disable","mcp.action.done":e=>`${(e==null?void 0:e.action)??"Action"} complete.`,"mcp.action.enable":"Enable","mcp.action.enableMessage":"Daemon serve does not expose MCP enable/disable yet.","mcp.action.failed":e=>`Failed: ${(e==null?void 0:e.error)??""}`,"mcp.action.running":e=>`${(e==null?void 0:e.action)??"Action"}...`,"mcp.action.reauth":"Re-authenticate","mcp.annotation.destructive":"destructive","mcp.annotation.idempotent":"idempotent","mcp.annotation.openWorld":"open-world","mcp.annotation.readOnly":"read-only","mcp.annotations":"Annotations","mcp.oauth.server":"Server","mcp.oauth.starting":e=>`Starting OAuth authentication for MCP server '${(e==null?void 0:e.name)??""}'...`,"mcp.oauth.title":"OAuth Authentication","mcp.clientBudget":e=>`${(e==null?void 0:e.count)??0}/${(e==null?void 0:e.budget)??0} clients · ${(e==null?void 0:e.mode)??"off"}`,"mcp.command":"Command","mcp.description":"Description:","mcp.action.reconnect":"Reconnect","mcp.action.restart":"Restart","mcp.action.tools":"View tools","mcp.action.toolsHint":"Enter to inspect","mcp.empty":"No MCP servers configured.","mcp.emptyTools":"No tools discovered.","mcp.expand":"Expand MCP server","mcp.collapse":"Collapse MCP server","mcp.inputSchema":"Input schema","mcp.loadingStatus":"Loading MCP status...","mcp.loadingTools":"Loading tools...","mcp.name":"Name","mcp.noDescription":"No description","mcp.noMatches":"No matching MCP servers.","mcp.noSchema":"No input schema.","mcp.serverTool":"Server tool","mcp.servers":e=>`${(e==null?void 0:e.count)??0} servers`,"mcp.configuredServers":"Configured MCP servers:","mcp.fromExtension":e=>`(from ${(e==null?void 0:e.name)??""})`,"mcp.extensionMcp":"Extension MCP","mcp.invalidReason":e=>`invalid: ${(e==null?void 0:e.reason)??""}`,"mcp.invalidReasonLabel":"Reason:","mcp.invalidToolHelp":"Tools must have both name and description to be used by the LLM.","mcp.invalidToolWarning":"Warning: This tool cannot be called by the LLM","mcp.manageServers":"Manage MCP servers","mcp.viewDetails":"View details","mcp.parameters":"Parameters:","mcp.required":" required","mcp.resources":"Resources","mcp.resourcesUnavailable":"Resource details unavailable.","mcp.resourceCount":e=>`${(e==null?void 0:e.count)??0} ${(e==null?void 0:e.count)===1?"resource":"resources"}`,"mcp.promptCount":e=>`${(e==null?void 0:e.count)??0} ${(e==null?void 0:e.count)===1?"prompt":"prompts"}`,"mcp.resource.uriLabel":"URI:","mcp.resource.nameLabel":"Name:","mcp.resource.mimeTypeLabel":"MIME Type:","mcp.resource.sizeLabel":"Size:","mcp.resource.bytes":e=>`${(e==null?void 0:e.count)??0} ${(e==null?void 0:e.count)===1?"byte":"bytes"}`,"mcp.scrollPosition":e=>`${(e==null?void 0:e.current)??0}/${(e==null?void 0:e.total)??0}`,"mcp.shortcut.back":"Esc to back","mcp.shortcut.close":"Esc to close","mcp.shortcut.selectBack":"↑↓ to navigate · Enter to select · Esc to back","mcp.shortcut.selectClose":"↑↓ to navigate · Enter to select · Esc to close","mcp.settings":"Settings","mcp.extension":e=>`Extension: ${(e==null?void 0:e.name)??""}`,"mcp.starting":e=>`⏳ MCP servers are starting up (${(e==null?void 0:e.count)??0} initializing)...`,"mcp.startingNote":"Note: First startup may take longer. Tool availability will update automatically.","mcp.restartSkipped":e=>`Skipped ${(e==null?void 0:e.name)??""}: ${(e==null?void 0:e.reason)??""}`,"mcp.restarted":e=>`Restarted ${(e==null?void 0:e.name)??""} in ${(e==null?void 0:e.duration)??0}ms`,"mcp.restartEntries":e=>`Restarted ${(e==null?void 0:e.restarted)??0}/${(e==null?void 0:e.total)??0} ${(e==null?void 0:e.name)??""} entries${e!=null&&e.failedReasons?` (failed: ${e.failedReasons})`:""}`,"mcp.source":"Source","mcp.source.extension":"Extension","mcp.source.project":"Workspace Settings","mcp.source.user":"User Settings","mcp.status":"Status","mcp.status.blocked":"Blocked","mcp.status.connected":"connected","mcp.status.connecting":"connecting","mcp.status.disconnected":"disconnected","mcp.status.disconnectedTitle":"Disconnected","mcp.status.disabled":"disabled","mcp.status.ready":"Ready","mcp.status.starting":"Starting... (first startup may take longer)","mcp.status.unknown":"unknown","mcp.tipDesc":"to show server and tool descriptions","mcp.tipNodesc":"to hide descriptions","mcp.tipSchema":"to show tool parameter schemas","mcp.tips":"💡 Tips:","mcp.toolCount":e=>`${(e==null?void 0:e.count)??0} tool`,"mcp.toolsCount":e=>`${(e==null?void 0:e.count)??0} tools`,"mcp.toolsLabel":"Tools:","mcp.title":"MCP Servers","mcp.toolDetail":"Tool Detail","mcp.tools":"Tools","mcp.toolsForServer":e=>`Tools for ${(e==null?void 0:e.name)??"Server"}`,"mcp.transport":"Transport","mcp.use":"Use","mcp.userMcp":"User MCP","mcp.workingDirectory":"Working Directory","goal.aborted":"Goal aborted","goal.achieved":"Goal achieved","goal.check":"Goal check","goal.cleared":"Goal cleared","goal.failed":"Goal could not be achieved","goal.judge":"Judge","goal.label":"Goal","goal.lastCheck":"Last check","goal.notYetMet":"not yet met","goal.set":"Goal set","goal.statusActive":"/goal active","goal.turn":e=>`${(e==null?void 0:e.count)??0} turn`,"goal.turnLabel":e=>`turn ${(e==null?void 0:e.count)??0}`,"goal.turns":e=>`${(e==null?void 0:e.count)??0} turns`,"memory.add":"Add","memory.add.desc":"Write a durable memory","memory.autoDream":e=>`Auto-dream: ${(e==null?void 0:e.status)??"unknown"} · ${(e==null?void 0:e.lastDream)??"never"} · /dream to run`,"memory.autoDreamUnsupported":"Auto-dream settings are not available from web-shell yet.","memory.autoFolder":"Open auto-memory folder","memory.autoMemory":e=>`Auto-memory: ${(e==null?void 0:e.status)??"unknown"}`,"memory.autoMemoryUnsupported":"Auto-memory settings are not available from web-shell yet.","memory.autoSkill":e=>`Auto-skill: ${(e==null?void 0:e.status)??"unknown"}`,"memory.autoSkillUnsupported":"Auto-skill settings are not available from web-shell yet.","memory.chooseScope":"Choose where to save the memory","memory.closed":"Memory panel closed.","memory.contentEmpty":"Memory content is empty.","memory.file":"Memory file","memory.fileOpen":"Memory file opened.","memory.fileTruncated":"Memory file opened. Content is truncated.","memory.files":"Memory Files","memory.footer":"Enter to confirm · Esc to cancel","memory.footer.back":"Esc to go back","memory.global":"User","memory.global.desc":"Saved to the global user memory file","memory.globalReadUnsupported":"Global memory is outside the bound workspace, so the current daemon file-read API cannot open its content.","memory.loading":"Loading memory...","memory.loadingFile":"Loading memory file...","memory.lastDream":"5 hours ago","memory.menu":"Memory","memory.never":"never","memory.noFiles":"No memory files found.","memory.on":"on","memory.openFolderUnsupported":"Opening the auto-memory folder is not available from web-shell yet.","memory.placeholder":e=>`Write ${(e==null?void 0:e.scope)??"memory"} content...`,"memory.project":"Project","memory.project.desc":"Saved to this workspace memory file","memory.refresh":"Refresh","memory.refresh.desc":"Reload memory file information","memory.refreshed":"Memory refreshed.","memory.save":"Save Memory","memory.savedIn":e=>`Saved in ${(e==null?void 0:e.path)??""}`,"memory.saved":e=>`${(e==null?void 0:e.scope)??"Memory"} saved: ${(e==null?void 0:e.bytes)??0} bytes -> ${(e==null?void 0:e.path)??""}`,"memory.saving":"Saving...","memory.show":"Show","memory.show.desc":"Show configured memory files","memory.status":"Workspace and user memory files","memory.unknown":"unknown","memory.write":"Write memory content","mode.auto":"Classifier Approval","mode.auto.desc":"Uses a classifier to approve safe tool calls and block or ask for risky ones","mode.auto.notice":"Auto mode enabled. An LLM classifier evaluates each tool call and auto-approves safe actions, blocks risky ones. To exit: Shift+Tab or /approval-mode default.","mode.footer":"(Use Enter to select, Esc to cancel)","mode.name.plan":"plan","mode.name.default":"default","mode.name.auto-edit":"auto-edit","mode.name.auto":"auto","mode.name.yolo":"yolo","mode.label.plan":"Plan","mode.label.default":"Ask Approval","mode.label.auto-edit":"Auto Edit","mode.label.auto":"Classifier Approval","mode.label.yolo":"Full Access","mode.listLabel.plan":"Plan (plan)","mode.listLabel.default":"Ask Approval (default)","mode.listLabel.auto-edit":"Auto Edit (auto-edit)","mode.listLabel.auto":"Classifier Approval (auto)","mode.listLabel.yolo":"Full Access (yolo)","mode.desc.plan":"Analyze only, do not modify files or execute commands","mode.desc.default":"Ask before running commands, editing files, or accessing external resources","mode.desc.auto-edit":"Automatically approve file edits and ask before command execution or other sensitive actions","mode.desc.auto":"Evaluate tool risk automatically, run safe actions, and confirm risky ones","mode.desc.yolo":"Automatically approve all tool calls in trusted contexts","mode.select":"Approval Mode","mode.autoApproved":e=>e!=null&&e.tool?`Auto-approved: ${e.tool}`:"Pending tool call auto-approved by mode switch.","mode.auto-edit":"Auto-accept edits","mode.auto-edit.desc":"Automatically approve file read/write operations","mode.default":"Default mode","mode.default.desc":"Ask before each tool call","mode.plan":"Plan mode","mode.plan.desc":"Analyze and plan without running tools","mode.unknown":"unknown mode","mode.yolo":"YOLO mode","mode.yolo.desc":"Automatically approve all operations","plan.title":"Plan","model.contextWindow":"Context Window","model.contextWindow.unknown":"(unknown)","model.current":e=>`current: ${(e==null?void 0:e.model)??"unknown"}`,"model.modality":"Modality","model.modality.text":"text","model.modality.textOnly":"text-only","model.modality.image":"image","model.modality.pdf":"pdf","model.modality.audio":"audio","model.modality.video":"video","model.baseUrl":"Base URL","model.apiKey":"API Key","model.default":"(default)","model.notSet":"(not set)","model.footer":"Enter select, ↑↓ navigate, Esc close","model.searchHint":"Press / to search","model.fastHint":"for suggestions and side tasks","model.noMatch":e=>`No model matching "${(e==null?void 0:e.query)??""}"`,"model.none":"No models available","model.select":"Select Model","model.setFast":"Set Fast Model","model.setVoice":"Set Voice Model","model.setVision":"Set Vision Model","model.switch":"Switch Model","model.unknown":"unknown","resume.current":"current","resume.activePrompt":"active prompt","resume.filter":"Filter","resume.noMatch":e=>`No session matching "${(e==null?void 0:e.query)??""}"`,"resume.none":"No sessions to resume","resume.pressSearch":"Press / to search","resume.search":"Search","resume.title":"Resume Session","parallelAgents.title":"Parallel agents","parallelAgents.done":e=>`${(e==null?void 0:e.done)??0}/${(e==null?void 0:e.total)??0} done`,"skills.available":"Available skills:","skills.none":"No skills are currently available.","skills.empty":"No skills available.","skills.footer":e=>e!=null&&e.name?`Use /skills ${e.name} to invoke · r to refresh · Esc to close`:"r to refresh · Esc to close","skills.invocable":e=>`${(e==null?void 0:e.enabled)??0}/${(e==null?void 0:e.total)??0} invocable`,"skills.details":"Skill details","skills.extension":"Extension","skills.filter.all":"All","skills.filter.bundled":"Built-in","skills.filter.extension":"Extensions","skills.filter.label":"Filter skills by source","skills.filter.project":"Workspace settings","skills.filter.user":"User settings","skills.hint":"Hint","skills.invocation":"Invocation","skills.level":"Scope","skills.level.bundled":"Bundled","skills.level.extension":"Extension","skills.level.project":"Project","skills.level.user":"User","skills.loading":"Loading skills...","skills.model":"Model","skills.modelAccess":"Model access","skills.modelAccess.disabled":"Not model-invocable","skills.modelAccess.enabled":"Model-invocable","skills.modelInvocable":"Model","skills.noDescription":"No description","skills.noMatches":"No matching skills.","skills.run":"Run skill","skills.search":"Search skills…","skills.status":"Status","skills.status.disabled":"disabled","skills.title":"Skills","plugins.extensions":"Extensions","plugins.agents":"Agents","plugins.mcp":"MCP","plugins.sections":"Plugin sections","plugins.skills":"Skills","plugins.title":"Plugins","plugins.tools":"Tools","stats.accepted":"Accepted:","stats.agreementRate":"Overall Agreement Rate:","stats.api":"API","stats.apiTime":"API Time","stats.avgDuration":"Avg Duration","stats.avgLatency":"Avg Latency","stats.cached":"Cached","stats.cacheDesc":"of input tokens were served from the cache, reducing costs.","stats.calls":"Calls","stats.codeChanges":"Code Changes","stats.decisionSummary":"User Decision Summary","stats.duration":"Duration","stats.errors":"Errors","stats.inputTokens":"Input Tokens","stats.metric":"Metric","stats.modelStats":"Model Stats","stats.modelTip":"Tip: For a full token breakdown, run /stats model.","stats.modelUsage":"Model Usage","stats.modified":"Modified:","stats.noApiCalls":"No API calls have been made in this session.","stats.noToolCalls":"No tool calls have been made in this session.","stats.outputTokens":"Output Tokens","stats.overview":"Session Overview","stats.performance":"Performance","stats.prompts":"Prompts","stats.rejected":"Rejected:","stats.reqs":"Reqs","stats.requests":"Requests","stats.savingsHighlight":"Savings Highlight:","stats.successRate":"Success Rate","stats.thoughts":"Thoughts","stats.title":"Session Stats","stats.tokens":"Tokens","stats.toolCalls":"Tool Calls","stats.toolName":"Tool Name","stats.toolStats":"Tool Stats","stats.toolTime":"Tool Time","stats.total":"Total","stats.totalReviewed":"Total Reviewed Suggestions:","status.contextUsed":e=>`${(e==null?void 0:e.pct)??"0.0"}% context used`,"status.disconnected":"Disconnected","status.modeHint":"(shift + tab or click to switch)","status.shortcuts":"? for shortcuts","stream.cancel":"esc to cancel","stream.cancelArmed":"Press Esc again to stop","stream.tokens":e=>`${(e==null?void 0:e.count)??0} tokens`,"theme.current":e=>`current: ${(e==null?void 0:e.theme)??""}`,"theme.auto":"Auto","theme.dark":"Dark","theme.dark.desc":"Terminal-style dark skin.","theme.light":"Light","theme.light.desc":"Terminal-style light skin.","theme.title":"Theme","todo.allDone":"All tasks completed","todo.collapse":"Collapse task list","todo.completedAbove":e=>`✓ ${(e==null?void 0:e.count)??0} completed`,"todo.detail.api":"API","todo.detail.cached":"Cached","todo.detail.end":"End","todo.detail.hide":"Hide task detail","todo.detail.input":"Input","todo.detail.noResources":"Token & time usage wasn't captured for this task.","todo.detail.output":"Output","todo.detail.sectionSpent":"Time spent","todo.detail.sectionTime":"Time","todo.detail.sectionTokens":"Tokens","todo.detail.show":"Show task detail","todo.detail.start":"Start","todo.detail.tool":"Tool","todo.expand":"Expand task list","todo.more":e=>`... ${(e==null?void 0:e.count)??0} more`,"todo.moreAbove":e=>`... ${(e==null?void 0:e.count)??0} earlier`,"todo.showLess":"Show less","todo.stepProgress":e=>`Step ${(e==null?void 0:e.current)??0} / ${(e==null?void 0:e.total)??0}`,"todo.stepFraction":e=>`${(e==null?void 0:e.current)??0} / ${(e==null?void 0:e.total)??0}`,"todo.title":"Current tasks","chat.scrollToBottom":"Scroll to bottom","userMessage.showMore":"Show more","userMessage.showLess":"Collapse","turn.processed":"Processed","turn.processing":"Processing","turn.collapse":"Collapse steps","turn.expand":"Expand steps","turn.cached":"cached","turn.executionSteps":e=>{const t=(e==null?void 0:e.count)??0;return`${t} step${t===1?"":"s"}`},"turn.toolCalls":e=>{const t=(e==null?void 0:e.count)??0;return`${t} tool call${t===1?"":"s"}`},"turn.thinkingCount":e=>{const t=(e==null?void 0:e.count)??0;return`${t} thought${t===1?"":"s"}`},"turn.stopped":"You cancelled this request","message.renderError":"This message could not be displayed.","tasks.title":"Background tasks","tasks.empty":"No tasks currently running","tasks.refreshStale":"Task status may be stale; reconnecting...","tasks.cancelFailed":"Failed to cancel task","tasks.alreadyStopped":"Task already stopped","tasks.moreAbove":e=>`^ ${(e==null?void 0:e.count)??0} more above`,"tasks.moreBelow":e=>`v ${(e==null?void 0:e.count)??0} more below`,"tasks.running":"Running","tasks.completed":"Completed","tasks.failed":"Failed","tasks.cancelled":"Stopped","tasks.paused":"Paused","tasks.kind.shell":"Shell","tasks.kind.monitor":"Monitor","tasks.action.stop":"Stop","tasks.action.abandon":"Abandon","tasks.action.confirmStop":"Confirm stop","tasks.action.confirmAbandon":"Confirm abandon","tasks.action.confirmHint":"This will end the blocking turn.","tasks.pill.agent":e=>`${(e==null?void 0:e.count)??0} local agent`,"tasks.pill.agents":e=>`${(e==null?void 0:e.count)??0} local agents`,"tasks.pill.agentPaused":e=>`${(e==null?void 0:e.count)??0} local agent paused`,"tasks.pill.agentsPaused":e=>`${(e==null?void 0:e.count)??0} local agents paused`,"tasks.pill.done":e=>`${(e==null?void 0:e.count)??0} task done`,"tasks.pill.doneMany":e=>`${(e==null?void 0:e.count)??0} tasks done`,"tasks.pill.monitor":e=>`${(e==null?void 0:e.count)??0} monitor`,"tasks.pill.monitors":e=>`${(e==null?void 0:e.count)??0} monitors`,"tasks.pill.shell":e=>`${(e==null?void 0:e.count)??0} shell`,"tasks.pill.shells":e=>`${(e==null?void 0:e.count)??0} shells`,"tasks.confirmStop":"x again to confirm stop · ends the blocking turn","tasks.shortcut.select":"↑/↓ select","tasks.shortcut.view":"Enter view","tasks.shortcut.stop":"x stop","tasks.shortcut.abandon":"x abandon","tasks.shortcut.listClose":"←/Esc close","tasks.shortcut.detailBack":"← go back","tasks.shortcut.detailClose":"Esc/Enter/Space close","tasks.shortcut.close":"Esc close","tasks.shortcut.cancelConfirm":"Esc cancel","tasks.detail.workingDir":"Working dir","tasks.detail.outputFile":"Output file","tasks.detail.command":"Command","tasks.detail.events":e=>`${(e==null?void 0:e.count)??0} events`,"tasks.detail.exit":e=>`exit ${(e==null?void 0:e.exitCode)??""}`,"tasks.detail.dropped":e=>`${(e==null?void 0:e.count)??0} dropped`,"tasks.detail.error":"Error","tasks.detail.stoppedBecause":"Stopped because","tasks.detail.resumeBlocked":"Resume blocked","tasks.detail.progress":"Progress","tasks.detail.prompt":"Prompt","tasks.detail.type":"Type","tasks.detail.runtime":"Time","tasks.detail.tokenCount":"Tokens","tasks.detail.toolCallCount":"Tool calls","tasks.detail.tokens":e=>`${(e==null?void 0:e.count)??0} tokens`,"tasks.detail.toolCalls":e=>`${(e==null?void 0:e.count)??0} tool calls`,"tasks.detail.nesting":"Nesting","tasks.detail.nestingValue":e=>`Level ${(e==null?void 0:e.level)??"?"} · from ${(e==null?void 0:e.parent)??"?"}`,"tasks.detail.nestingLevel":e=>`Level ${(e==null?void 0:e.level)??"?"}`,"tasks.row.from":e=>`from ${(e==null?void 0:e.parent)??"?"}`,"tasks.row.nested":"nested","tips.items":"Type / to see all available commands.|Use @ to reference file paths.|Press Esc to cancel an in-flight request.|Use Shift+Enter for a newline.|Press ↑↓ to browse message history.","tools.available":"Available tools:","tools.none":"No tools available.","tools.empty":"No built-in tools available. Open a session first.","tools.footer":e=>e!=null&&e.name?`${e!=null&&e.details?"Enter/Space for details · ":""}t to toggle ${e.name} · r to refresh · Esc to close`:"r to refresh · Esc to close","tools.details.hide":"Hide details","tools.details.show":"Show details","tools.description":"Description","tools.details":"Tool details","tools.loading":"Loading tools...","tools.name":"Tool name","tools.noDescription":"No description","tools.noMatches":"No matching tools.","tools.search":"Search tools…","tools.status":"Status","tools.status.disabled":"disabled","tools.status.enabled":"enabled","tools.summary":e=>`${(e==null?void 0:e.enabled)??0}/${(e==null?void 0:e.total)??0} enabled`,"tools.title":"Tools","tools.update.disable":"Disable","tools.update.enable":"Enable","tools.updating":"Updating...","tool.collapse":"▲ Collapse","tool.expand":"Expand","tool.collapseHint":"Collapse","tool.status.failed":"Failed","toolGroup.moreKinds":e=>` +${(e==null?void 0:e.count)??0}`,"toolGroup.summary":e=>`Ran ${(e==null?void 0:e.count)??0} tool${(e==null?void 0:e.count)===1?"":"s"}`,"toolGroup.summary.editedFiles":e=>`Edited ${(e==null?void 0:e.count)??0} file${(e==null?void 0:e.count)===1?"":"s"}`,"toolGroup.summary.ranCommands":e=>`Ran ${(e==null?void 0:e.count)??0} command${(e==null?void 0:e.count)===1?"":"s"}`,"toolGroup.summary.readFiles":e=>`Read ${(e==null?void 0:e.count)??0} file${(e==null?void 0:e.count)===1?"":"s"}`,"toolGroup.summary.searched":e=>`Searched ${(e==null?void 0:e.count)??0} time${(e==null?void 0:e.count)===1?"":"s"}`,"toolGroup.summary.updatedTodos":e=>`Updated task list${(e==null?void 0:e.count)===1?"":` ${(e==null?void 0:e.count)??0} times`}`,"toolGroup.summary.askedUser":"Asked user","toolGroup.summary.otherTools":e=>`Called ${(e==null?void 0:e.count)??0} other tool${(e==null?void 0:e.count)===1?"":"s"}`,"toolGroup.running":e=>`Running ${(e==null?void 0:e.name)??"tool"}${e!=null&&e.duration?` ${e.duration}`:""}${Number((e==null?void 0:e.count)??0)>1?` · ${(e==null?void 0:e.count)??0} tools`:""}`,"toolGroup.runningPrefix":"Running","thinking.expand":"Expand thinking","thinking.collapse":"Collapse thinking","thinking.running":e=>`Thinking${e!=null&&e.duration?` ${e.duration}`:""}`,"thinking.doneBriefly":"Thought briefly","thinking.done":e=>e!=null&&e.duration?`Thought for ${e.duration}`:"Done thinking","sessionsOverview.count":e=>`${(e==null?void 0:e.count)??0} sessions`,"sessionsOverview.current":"Current","sessionsOverview.empty":"No sessions yet","sessionsOverview.loadFailed":"Failed to load sessions","sessionsOverview.loading":"Loading sessions…","sessionsOverview.openElsewhere":"Currently open in another window","sessionsOverview.openInSplit":"Open in split","sessionsOverview.openInSplitHint":"Show the selected sessions side by side in this window","sessionsOverview.openInTab":"Open in new tab","sessionsOverview.openInTabHint":"Open the selected sessions as a split view in a new browser tab","sessionsOverview.popupBlocked":"Pop-up blocked. Allow pop-ups for this site to open sessions in new tabs.","sessionsOverview.refresh":"Refresh","sessionsOverview.selectAll":"Select all","sessionsOverview.splitCap":e=>`Only the first ${(e==null?void 0:e.max)??6} selected sessions will open in the split.`,"sessionsOverview.selectSession":e=>`Select ${(e==null?void 0:e.name)??""}`,"sessionsOverview.status.idle":"Idle","sessionsOverview.status.needsApproval":"Needs approval","sessionsOverview.status.running":"Running","sessionsOverview.title":"Session Overview","splitView.title":"Split View","splitView.count":e=>`${(e==null?void 0:e.count)??0} panes`,"splitView.addPane":"Add session","splitView.closePane":"Close pane","splitView.paneError":"This session pane hit an error","splitView.paneConnectionError":"Connection lost","splitView.outerApprovalPending":"Your main session is waiting for approval.","splitView.goToApproval":"Go to it","splitView.empty":"No sessions in the split. Add one to get started.","splitView.composerPlaceholder":"Message this session…","settings.title":"Settings","settings.loading":"Loading settings...","settings.empty":"No settings available.","settings.footer":"↑↓ Navigate  Enter Toggle  Tab Scope  r Reload  ESC Close","settings.footer.edit":"Enter Save  ESC Cancel","settings.footer.theme":"↑↓ Navigate  Enter Select  ESC Back","settings.scope.user":"User","settings.scope.workspace":"Workspace","settings.value.on":"ON","settings.value.off":"OFF","settings.action.edit":"Edit","settings.action.select":"Select","settings.action.save":"Save","settings.modifiedIn":e=>`(Modified in ${(e==null?void 0:e.scope)??""})`,"settings.alsoModifiedIn":e=>`(Also modified in ${(e==null?void 0:e.scope)??""})`,"settings.invalidNumber":"Invalid number","settings.requiresRestart":"This change requires a restart to take effect.","settings.models.title":"Models","settings.models.add":"+ Add Model","settings.models.setCurrent":"Set current","settings.models.current":"Current","settings.models.runtime":"Runtime","settings.models.delete":"Delete","settings.models.confirmDelete":"Confirm","settings.models.cancel":"Cancel","settings.models.empty":"No configured models yet.","settings.models.loading":"Loading models…","settings.models.deleteFailed":"Failed to delete model","settings.models.fallbacks.title":"Model Fallbacks","settings.models.fallbacks.hint":e=>`Select up to ${(e==null?void 0:e.max)??3}; tried in order when the main model is at capacity.`,"settings.models.fallbacks.confirm":"Confirm","settings.models.fallbacks.empty":"No selectable models.","settings.models.fallbacks.saveFailed":"Failed to save fallback models","settings.models.fallbacks.limitReached":e=>`Maximum of ${(e==null?void 0:e.max)??3} fallback models selected; deselect one to choose another.`,"settings.corrupted":e=>`Settings file was corrupted${(e==null?void 0:e.recovered)==="true"?" (recovered from backup)":""}`,"settings.label.ui.chatWidth":"Chat width","settings.description.ui.chatWidth":"Frontend-only chat content width. Stored in this browser.","settings.option.ui.chatWidth.1000":"Regular","settings.option.ui.chatWidth.wide":"Ultra wide","settings.label.visionModel":"Vision Model","settings.description.visionModel":"Image-capable model used as the vision bridge. Leave empty to auto-select.","welcome.changeModel":"(/model to change)","welcome.defaultModel":"unknown model","welcome.modeHint":"Shift+Tab or /approval-mode","welcome.prompt":"What would you like to do?","welcome.titlePrefix":"Welcome to","welcome.tipLabel":"Tips:"},Ude={...qE,"git.currentBranch":e=>`当前 Git 分支：${(e==null?void 0:e.branch)??""}`,"workspace.paneLabel":e=>`工作区：${(e==null?void 0:e.name)??""}`,"toolName.edit":"编辑","toolName.write_file":"写入文件","toolName.read_file":"读取文件","toolName.grep":"搜索内容","toolName.grep_search":"搜索内容","toolName.glob":"Glob","toolName.run_shell_command":"运行命令","toolName.todo_write":"任务清单","toolName.save_memory":"保存记忆","toolName.agent":"Agent","toolName.skill":"查看技能","toolName.enter_plan_mode":"进入计划模式","toolName.exit_plan_mode":"退出计划模式","toolName.web_fetch":"网络搜索","toolName.webfetch":"网络搜索","toolName.fetch":"网络搜索","toolName.web_search":"网络搜索","toolName.list_directory":"列出文件","toolName.lsp":"LSP","toolName.ask_user_question":"询问用户","toolName.cron_create":"创建定时任务","toolName.cron_list":"定时任务列表","toolName.cron_delete":"删除定时任务","toolName.task_create":"创建任务","toolName.task_update":"更新任务","toolName.task_list":"任务列表","toolName.task_stop":"停止任务","toolName.team_create":"创建团队","toolName.team_delete":"删除团队","toolName.send_message":"发送消息","toolName.structured_output":"结构化输出","toolName.monitor":"监控","toolName.notebook_edit":"编辑 Notebook","toolName.tool_search":"工具搜索","toolName.enter_worktree":"进入 Worktree","toolName.exit_worktree":"退出 Worktree","toolName.workflow":"工作流","toolName.team_plan_approval":"团队计划审批","toolName.loop_wakeup":"循环唤醒","toolName.create_sub_session":"创建子会话","toolName.read_mcp_resource":"读取 MCP 资源","toolName.artifact":"制品","toolName.record_artifact":"记录制品","toolName.bash":"运行命令","toolName.shell":"Shell 命令","toolName.read":"读取文件","toolName.readfile":"读取文件","toolName.write":"写入文件","toolName.writefile":"写入文件","toolName.search":"搜索内容","toolName.todowrite":"任务清单","toolName.savememory":"保存记忆","toolName.askuserquestion":"询问用户","toolName.toolsearch":"工具搜索","about.auth":"认证","about.baseUrl":"Base URL","about.fastModel":"快速模型","about.memoryUsage":"内存使用","about.model":"模型","about.noProxy":"no proxy","about.noSandbox":"no sandbox","about.platform":"操作系统","about.proxy":"代理","about.qwenCode":"Qwen Code","about.runtime":"运行环境","about.sandbox":"沙箱","about.sessionId":"会话 ID","about.title":"状态","agent.back":"返回","agent.builtInBadge":"（内置）","agent.action.delete":"删除智能体","agent.action.edit":"编辑智能体","agent.action.view":"查看智能体","agent.chooseAction":e=>`选择操作：${(e==null?void 0:e.name)??""}`,"agent.chooseActionTitle":"选择操作","agent.colorLabel":"颜色：","agent.colorUpdated":e=>`已更新 ${(e==null?void 0:e.name)??""} 的颜色`,"agent.create":"创建新的智能体","agent.create.button":"创建智能体","agent.create.confirm":"确认并保存","agent.create.desc":"创建新的智能体","agent.create.descPlaceholder":"这个智能体做什么？","agent.create.describeAgent":"描述您的子智能体","agent.create.description":"描述","agent.create.editAgain":"编辑","agent.create.enterDescription":"输入描述","agent.create.enterName":"输入子智能体名称","agent.create.enterPrompt":"输入系统提示词","agent.create.generateFailed":e=>`生成子智能体失败：${(e==null?void 0:e.error)??"未知错误"}`,"agent.create.generatingConfig":"正在生成子智能体配置...","agent.create.loading":"创建中...","agent.create.location":"选择位置","agent.create.method":"选择生成方式","agent.create.method.manual":"手动创建","agent.create.method.qwen":"使用 Qwen Code 生成","agent.create.method.qwen.recommended":"使用 Qwen Code 生成（推荐）","agent.create.method.qwen.desc":"LLM 生成名称、提示词和描述","agent.create.name":"名称","agent.create.namePlaceholder":"my-agent","agent.create.nameHelp":"输入此子智能体清晰且唯一的名称。","agent.create.project":"项目","agent.create.project.cli":"项目级 (.qwen/agents/)","agent.create.project.desc":"创建项目级智能体","agent.create.prompt":"系统提示词","agent.create.promptPlaceholder":"你是一个专门的智能体...","agent.create.promptPlaceholder.cli":"例如：你是一名专业的代码审查员...","agent.create.promptHelp":"编写定义此子智能体行为的系统提示词。为了获得最佳效果，请全面描述。","agent.create.preview":"预览","agent.create.qwenHint":"描述此子智能体应该做什么以及何时使用它。（为了获得最佳效果，请全面描述）","agent.create.qwenPlaceholder":"> 例如：专业的代码审查员，根据最佳实践审查代码...","agent.create.required":"名称、描述和系统提示词均为必填项。","agent.create.save":"保存智能体","agent.create.scope":"选择智能体的保存位置","agent.create.manualDescHelp":"描述此子智能体应该在何时以及如何使用。","agent.create.manualDescPlaceholder":"例如：根据最佳实践和潜在 bug 审查代码。","agent.create.toolsSelection":"选择工具","agent.create.tools.all":"所有工具","agent.create.tools.allDefault":"所有工具（默认）","agent.create.tools.allInfo":"已选择所有工具，包括 MCP 工具","agent.create.tools.allInfoFallback":"已选择所有工具，包括 MCP 工具","agent.create.tools.editLabel":"• 编辑工具:","agent.create.tools.executionLabel":"• 执行工具:","agent.create.tools.none":"（无）","agent.create.tools.readEdit":"读取和编辑工具","agent.create.tools.readEditExecute":"读取、编辑和执行工具","agent.create.tools.readOnlyLabel":"• 只读工具:","agent.create.tools.readOnly":"只读工具","agent.create.tools.selected":"已选择的工具:","agent.create.user":"用户","agent.create.user.cli":"用户级 (~/.qwen/agents/)","agent.create.user.desc":"创建用户级智能体","agent.createFirstHint":"使用 '/agents create' 创建第一个智能体。","agent.created":e=>`已创建 ${(e==null?void 0:e.name)??""}`,"agent.delete":"删除","agent.delete.confirm":e=>`确定要删除 "${(e==null?void 0:e.name)??""}" 吗？`,"agent.delete.loading":"删除中...","agent.delete.no":"否","agent.delete.title":e=>`删除 ${(e==null?void 0:e.name)??""}`,"agent.delete.yes":"是，删除","agent.deleted":e=>`已删除 ${(e==null?void 0:e.name)??""}`,"agent.edit":"编辑","agent.edit.color":"编辑颜色","agent.edit.tools":"编辑工具","agent.editColorTitle":e=>`编辑颜色：${(e==null?void 0:e.name)??""}`,"agent.editTitle":e=>`编辑 ${(e==null?void 0:e.name)??""}`,"agent.empty":"未找到智能体。","agent.noMatches":"未找到匹配的智能体。","agent.footer.back":"Esc 返回","agent.footer.cliBack":"Enter 选择 · ↑↓ 导航 · Esc 返回","agent.footer.cliSelect":"Enter 选择 · ↑↓ 导航 · Esc 关闭","agent.footer.close":"Esc 关闭","agent.footer.deleteConfirm":"Enter 确认，Esc 取消","agent.footer.enterNext":"按 Enter 继续，Esc 返回","agent.footer.generating":"Esc 取消","agent.footer.createLocation":"按 Enter 继续，↑↓ 导航，Esc 取消","agent.footer.createContinue":"按 Enter 继续，↑↓ 导航，Esc 返回","agent.footer.final":"按 Enter 保存，e 保存并编辑，Esc 返回","agent.footer.nav":"↑↓ 导航 · Enter 选择 · Esc 返回","agent.footer.navBack":"↑↓ 导航 · Enter 选择 · Esc 返回","agent.footer.navSelect":"↑↓ 导航 · Enter 选择 · Esc 关闭","agent.footer.viewerBack":"Esc 返回","agent.filePathLabel":"文件路径：","agent.label":"智能体","agent.location":"位置","agent.level.builtin":"内置","agent.level.extension":"扩展","agent.level.project":"项目","agent.level.user":"用户","agent.manage":"管理","agent.manage.desc":"管理已有智能体","agent.modelLabel":"模型：","agent.overriddenBadge":"（已被项目级智能体覆盖）","agent.readonly":"该智能体是只读的。","agent.select":"请选择一个智能体。","agent.selectAction":"选择操作","agent.descriptionLabel":"描述：","agent.systemPromptLabel":"系统提示词：","agent.step":e=>`步骤 ${(e==null?void 0:e.n)??""}`,"agent.tools":"工具","agent.toolsLabel":"工具：","agent.detail.overview":"基本信息","agent.detail.tools":"工具","agent.detail.systemPrompt":"系统提示词","agent.toolsUpdated":e=>`已更新 ${(e==null?void 0:e.name)??""} 的工具`,"agent.usingCount":e=>`使用中：${(e==null?void 0:e.count)??0} 个智能体`,"agent.view":"查看","agents.closed":"智能体面板已关闭。","agents.title":"智能体","subagent.result":"结果","subagent.tools":e=>`工具 (${(e==null?void 0:e.count)??0})`,"subagent.toolsCount":e=>`${(e==null?void 0:e.count)??0} 个工具`,"subagent.toggleStream":"展开/收起子智能体详情","subagent.pending":"等待中","subagent.running":"运行中","timeline.parallelAgents":"并行智能体","timeline.thinking":"思考","timeline.assistantUpdate":"助手更新","timeline.toolCalls":e=>`${(e==null?void 0:e.count)??0} 个工具调用`,"timeline.planUpdate":"计划更新","timeline.statusUpdate":"状态更新","timeline.userTurn":"用户轮次","timeline.planDetail":"计划更新","timeline.parallelAgentsDetail":e=>`${(e==null?void 0:e.count)??0} 个并行智能体`,"timeline.noActivity":"无活动","timeline.sessionTimeline":"会话时间线","timeline.turnPrefix":e=>`第 ${(e==null?void 0:e.index)??0} 轮`,"timeline.currentTurn":"当前轮次","timeline.kind.thought":"思考","timeline.kind.commentary":"助手更新","timeline.kind.tool":"工具调用","timeline.kind.agents":"并行智能体","timeline.kind.plan":"计划更新","timeline.kind.status":"状态更新","timeline.kind.none":"轮次","common.copy":"复制","common.open":"打开","common.na":"不适用","common.server":"服务器","common.agent":"智能体","common.auto":"自动","common.runtime":"运行时","common.failedToLoad":"加载失败","auth.notSet":"（未设置）","auth.apiKeyPlaceholder":"sk-...","auth.modelsPlaceholder":"模型ID-1, 模型ID-2","model.usingModel":e=>`正在使用${e!=null&&e.isRuntime?"运行时":""}模型：${(e==null?void 0:e.modelId)??""}`,"mermaid.label":"mermaid","mermaid.errorLabel":"mermaid（错误）","user.uploadedImage":e=>`用户上传的图片 ${(e==null?void 0:e.index)??1}`,"voice.noSpeech":"未检测到语音。","voice.stopDictation":"停止语音输入","voice.transcribing":"正在转录…","voice.starting":"正在启动…","voice.errorRetry":e=>`语音错误 — 点击重试${e!=null&&e.message?`：${e.message}`:""}`,"voice.noSpeechRetry":"未检测到语音 — 点击重试","voice.startDictation":"开始语音输入","voice.error":"语音错误","resume.failedToLoad":"加载会话失败","toast.dismiss":"关闭通知","toast.dismissShort":"关闭","insight.ready":"Insight 报告已生成！","request.cancelled":"请求已取消。","approval.execQuestion":e=>`允许执行：'${(e==null?void 0:e.tool)??""}'？`,"approval.changeQuestion":"是否继续？","approval.launchAgentQuestion":"启动这个 agent？","approval.option.allowOnce":"是，允许一次","approval.option.rejectOnce":"拒绝","approval.option.allowAllEdits":"允许所有编辑","approval.option.allowAlwaysProject":"项目内始终允许","approval.option.allowAlwaysUser":"对此用户始终允许","approval.option.allowAlwaysServer":"对此服务始终允许","approval.option.allowAlwaysTool":"对此工具始终允许","assistant.branch":"分叉","assistant.copy":"复制","at.category.extensions":"扩展","at.category.extensions.description":"引用已启用扩展","at.category.files":"文件","at.category.files.description":"引用工作区文件","at.category.mcpResources":"MCP 资源","at.category.mcpResources.description":"引用 MCP server 资源","at.menu":"引用菜单","common.back":"返回","common.all":"全部","common.cancel":"取消","common.close":"关闭","common.fullscreen":"全屏","common.exitFullscreen":"退出全屏","common.continue":"继续","common.current":"当前","common.disabled":"已禁用","common.enabled":"已启用","common.enterSelect":"回车选择","common.invalid":"无效","common.loading":"加载中...","common.retry":"重试","common.save":"保存","common.navigate":"↑↓ 导航","common.next":"下一步","common.noResults":"无结果","common.previous":"上一步","common.expand":"展开","common.collapse":"收起","common.refresh":"刷新","common.search":"搜索","common.valid":"有效","common.clients":e=>`${(e==null?void 0:e.count)??0} 个客户端`,"agent.count":e=>`${(e==null?void 0:e.count)??0} 个智能体`,"askUser.submit":"提交","askUser.ignore":"忽略","askUser.multiHint":"可多选","askUser.progress":e=>`${(e==null?void 0:e.current)??0}/${(e==null?void 0:e.total)??0} 个问题`,"askUser.selectAnswer":"选择一个答案","askUser.typePlaceholder":"输入内容...","copy.failedFallback":"复制到剪贴板失败","copy.inlineLatexMissing":"最后一条 AI 输出中没有匹配的行内 LaTeX 表达式。","copy.latexMissing":"最后一条 AI 输出中没有匹配的 LaTeX 块。","copy.noOutput":"历史记录中没有可复制的输出","copy.noText":"最后一条 AI 输出没有可复制的文本。","copy.codeMissing":"最后一条 AI 输出中没有匹配的代码块。","copy.outputCopied":"已复制最后一条输出到剪贴板","copy.toClipboard":e=>`${(e==null?void 0:e.label)??"内容"} 已复制到剪贴板`,"code.copy":"复制","code.copied":"已复制！","echartsChart.defaultTitle":"图表加载中","echartsChart.noData":"暂无数据","echartsChart.tableNotice":e=>{const t=Number((e==null?void 0:e.omittedRows)??0),n=Number((e==null?void 0:e.omittedColumns)??0);return t>0&&n>0?`显示 ${(e==null?void 0:e.visibleRows)??0}/${(e==null?void 0:e.totalRows)??0} 行，${(e==null?void 0:e.visibleColumns)??0}/${(e==null?void 0:e.totalColumns)??0} 列`:n>0?`显示 ${(e==null?void 0:e.visibleColumns)??0}/${(e==null?void 0:e.totalColumns)??0} 列`:`显示 ${(e==null?void 0:e.visibleRows)??0}/${(e==null?void 0:e.totalRows)??0} 行`},"echartsChart.rendering":"正在渲染图表","echartsChart.runtimeUnavailable":"图表运行时不可用。","echartsChart.renderFailed":"图表渲染失败。","echartsChart.viewMode":"视图模式","echartsChart.showChart":"显示图表","echartsChart.showData":"显示数据","echartsChart.chart":"图表","echartsChart.data":"数据","markdownTable.blank":"(空白)","markdownTable.column":e=>`第 ${(e==null?void 0:e.index)??""} 列`,"markdownTable.rows":e=>`${(e==null?void 0:e.count)??0} 行`,"markdownTable.rowsFiltered":e=>`${(e==null?void 0:e.visible)??0}/${(e==null?void 0:e.total)??0} 行`,"markdownTable.hint":"点击表头排序，点击 ▾ 打开筛选。","markdownTable.filtersActive":e=>`${(e==null?void 0:e.count)??0} 个筛选`,"markdownTable.selection.selected":"已选","markdownTable.selection.nonEmpty":"非空","markdownTable.selection.numeric":"数值","markdownTable.selection.sum":"求和","markdownTable.selection.average":"平均","markdownTable.selection.min":"最小","markdownTable.selection.max":"最大","markdownTable.copyTsv":"复制 TSV","markdownTable.copyVisible":"快捷复制","markdownTable.freezeFirstColumn":"冻结首列","markdownTable.unfreezeFirstColumn":"取消冻结首列","markdownTable.density":e=>`密度：${(e==null?void 0:e.density)??""}`,"markdownTable.density.standard":"标准","markdownTable.density.compact":"紧凑","markdownTable.density.comfortable":"舒适","markdownTable.expandLongText":"展开文本","markdownTable.collapseLongText":"收起文本","markdownTable.emptyValue":"(空白)","markdownTable.hideColumn":"隐藏列","markdownTable.showHiddenColumns":e=>`显示 ${(e==null?void 0:e.count)??0} 个隐藏列`,"markdownTable.moveColumn":e=>`移动 ${(e==null?void 0:e.column)??""}`,"markdownTable.resizeColumn":e=>`调整 ${(e==null?void 0:e.column)??""} 列宽`,"markdownTable.rowDetails":"详情","markdownTable.rowDetailsAria":e=>`查看第 ${(e==null?void 0:e.index)??""} 行详情`,"markdownTable.closeRowDetailsAria":e=>`收起第 ${(e==null?void 0:e.index)??""} 行详情`,"markdownTable.detailsHeader":"单行详情","markdownTable.cellDialogTitle":"当前字段值","markdownTable.copyCell":"复制","markdownTable.close":"关闭","markdownTable.actions":"操作","markdownTable.sortByColumn":e=>`按 ${(e==null?void 0:e.column)??""} 排序`,"markdownTable.sortByColumnAsc":e=>`${(e==null?void 0:e.column)??""} 已升序排序`,"markdownTable.sortByColumnDesc":e=>`${(e==null?void 0:e.column)??""} 已降序排序`,"markdownTable.filterColumn":e=>`筛选 ${(e==null?void 0:e.column)??""}`,"markdownTable.empty":"此表格没有数据。","markdownTable.emptyFiltered":"没有符合筛选条件的行。","markdownTable.sort.asc":"升序排序","markdownTable.sort.desc":"降序排序","markdownTable.sort.clear":"清除排序","markdownTable.filter.searchPlaceholder":"搜索筛选值","markdownTable.filter.searchAria":e=>`搜索 ${(e==null?void 0:e.column)??""}`,"markdownTable.filter.selectVisible":"全选当前结果","markdownTable.filter.optionLimit":e=>`已显示前 ${(e==null?void 0:e.count)??0} 项，请搜索缩小范围`,"markdownTable.filter.noOptions":"没有匹配项","markdownTable.filter.custom":"自定义筛选","markdownTable.filter.numberAria":e=>`数字筛选 ${(e==null?void 0:e.column)??""}`,"markdownTable.filter.textAria":e=>`文本筛选 ${(e==null?void 0:e.column)??""}`,"markdownTable.filter.numberPlaceholder":"数值","markdownTable.filter.toPlaceholder":"到","markdownTable.filter.textPlaceholder":"输入筛选条件","markdownTable.filter.reset":"重置","markdownTable.filter.cancel":"取消","markdownTable.filter.confirm":"确认","markdownTable.filter.text.contains":"包含","markdownTable.filter.text.equals":"等于","markdownTable.filter.text.notEquals":"不等于","markdownTable.filter.text.startsWith":"开头是","markdownTable.filter.text.endsWith":"结尾是","markdownTable.filter.number.gt":"大于","markdownTable.filter.number.gte":"大于等于","markdownTable.filter.number.lt":"小于","markdownTable.filter.number.lte":"小于等于","markdownTable.filter.number.between":"区间","mermaid.rendering":"正在渲染图表...","mermaid.viewCode":"</>","mermaid.viewDiagram":"⊞","contextUsage.active":"已激活","contextUsage.autocompactBuffer":"自动压缩缓冲区","contextUsage.bodyLoaded":"已加载正文","contextUsage.builtinTools":"内置工具","contextUsage.contextWindow":"上下文窗口","contextUsage.detailHint":"运行 /context detail 查看逐项明细。","contextUsage.estimatedOverhead":"预估的对话前开销","contextUsage.free":"空闲","contextUsage.memoryFiles":"Memory 文件","contextUsage.messages":"消息","contextUsage.mcpTools":"MCP 工具","contextUsage.model":"模型","contextUsage.noSession":"当前还没有会话。请先发送第一条消息，再查看上下文使用情况。","contextUsage.noApiResponse":"尚无 API 响应。发送一条消息后可查看实际使用量。","contextUsage.overLimit":"上下文已超过限制！请使用 /compress 或 /clear 减少占用。","contextUsage.skills":"Skills","contextUsage.systemPrompt":"系统提示词","contextUsage.title":"上下文使用情况","contextUsage.tokens":"tokens","contextUsage.usageByCategory":"按类别统计","contextUsage.used":"已用","daemon.title":"Daemon 状态","daemon.details.loading":"正在加载诊断信息...","daemon.details.failed":"诊断信息加载失败。","daemon.refresh":"刷新","daemon.loading":"正在加载 Daemon 状态...","daemon.loadFailed":"加载 Daemon 状态失败","daemon.updatedAt":e=>`更新于 ${(e==null?void 0:e.time)??""}`,"daemon.none":"无","daemon.level.ok":"正常","daemon.level.warning":"警告","daemon.level.error":"错误","daemon.level.unavailable":"不可用","daemon.issues.title":"问题","daemon.overview.title":"Daemon","daemon.overview.version":"版本","daemon.overview.pid":"PID","daemon.overview.mode":"模式","daemon.overview.uptime":"运行时长","daemon.overview.workspace":"工作区","daemon.runtime.title":"运行时","daemon.runtime.activeSessions":"活跃会话","daemon.runtime.activePrompts":"执行中的 prompt","daemon.runtime.idle":"空闲时长","daemon.runtime.noActivity":"暂无活动","daemon.runtime.pendingPermissions":"待审批权限","daemon.runtime.permissionPolicy":"权限策略","daemon.runtime.channel":"ACP 通道","daemon.runtime.channelLive":"在线","daemon.runtime.channelDown":"离线","daemon.runtime.startingUp":"运行时启动中...","daemon.runtime.startFailed":"运行时启动失败","daemon.runtime.channelWorker":"通道 Worker","daemon.runtime.channelWorkerRestarts":"Worker 重启次数","daemon.runtime.memory":"内存 (RSS / 堆)","daemon.transport.title":"传输","daemon.transport.restSse":"REST SSE 流","daemon.transport.acpDisabled":"ACP 传输未启用","daemon.transport.acpConnections":"ACP 连接","daemon.transport.acpStreams":"ACP 流 (会话/SSE/WS)","daemon.transport.pendingRequests":"待处理客户端请求","daemon.transport.rateLimitRejected":"限流拒绝数","daemon.security.title":"安全","daemon.security.token":"Bearer 令牌","daemon.security.requireAuth":"强制鉴权","daemon.security.loopback":"回环绑定","daemon.security.allowOrigin":"允许来源","daemon.security.shell":"会话 Shell 命令","daemon.security.configured":"已配置","daemon.security.notConfigured":"未配置","daemon.limits.title":"限制","daemon.limits.unlimited":"无限制","daemon.limits.maxSessions":"最大会话数","daemon.limits.maxPendingPrompts":"每会话最大待处理 prompt 数","daemon.limits.maxConnections":"最大监听连接数","daemon.limits.eventRing":"事件环大小","daemon.limits.promptDeadline":"Prompt 截止时间","daemon.limits.sessionIdle":"会话空闲超时","daemon.capabilities.title":"能力","daemon.capabilities.titleCount":e=>`能力 (${(e==null?void 0:e.count)??0})`,"daemon.full.sessions.title":"会话","daemon.full.sessions.empty":"无活跃会话","daemon.full.session.pendingPrompts":e=>`${(e==null?void 0:e.count)??0} 个待处理 prompt`,"daemon.full.session.pendingPermissions":e=>`${(e==null?void 0:e.count)??0} 个待审批权限`,"daemon.full.session.prompting":"执行中","daemon.full.workspace.title":"工作区诊断","daemon.full.workspace.empty":"未上报工作区诊断","daemon.full.auth.title":"认证","daemon.full.auth.providers":"设备码登录提供方","daemon.full.auth.pending":"进行中的设备码登录","daemon.full.acp.title":"ACP 连接","daemon.tab.overview":"概览","daemon.tab.usage":"用量","daemon.tab.metrics":"指标","daemon.tab.diagnostics":"诊断","daemon.charts.title":"指标图表","daemon.charts.empty":"正在采集指标…首次采样后显示图表。","daemon.charts.concurrency":"并发","daemon.charts.activePrompts":"执行中任务","daemon.charts.activeSessions":"会话","daemon.charts.requests":"请求数","daemon.charts.reqTotal":"总数","daemon.charts.reqErrors":"错误","daemon.charts.apiLatency":"API 耗时","daemon.charts.promptLatency":"Prompt 延迟","daemon.charts.queueWait":"排队等待","daemon.charts.promptDuration":"端到端","daemon.charts.eventLoop":"事件循环延迟","daemon.charts.eventLoopLag":"延迟 p99","daemon.charts.queuedPrompts":"排队中","daemon.charts.reqRejected":"限流拒绝","daemon.charts.llmLatency":"LLM 耗时","daemon.charts.apiHealth":"模型 API 健康","daemon.charts.apiErrors":"API 报错","daemon.charts.apiRetries":"重试","daemon.charts.cpu":"CPU","daemon.charts.pipe":"IPC 管道","daemon.charts.pipeIn":"接收","daemon.charts.pipeOut":"发送","daemon.charts.connections":"连接数","daemon.charts.cpuDaemon":"Daemon","daemon.charts.cpuChild":"子进程","daemon.charts.rssDaemon":"Daemon RSS","daemon.charts.rssChild":"子进程 RSS","daemon.charts.memory":"内存","daemon.charts.heap":"堆","daemon.charts.tokens":"Token 消耗","daemon.charts.tokensIn":"输入","daemon.charts.tokensOut":"输出","daemon.charts.peak":"峰值","daemon.charts.concurrency.help":"每次采样的实时负载:正在执行的 prompt、排队中(已接受未派发)、活跃会话数。排队数超过执行数即出现背压。","daemon.charts.requests.help":"每个窗口内客户端↔守护进程的 HTTP 流量,并非模型调用。总请求数、返回 4xx/5xx 的数量、被限流拒绝的数量。","daemon.charts.apiLatency.help":'客户端↔守护进程 HTTP 请求耗时(p50/p95)——反映守护进程本身快慢,而非模型。与「LLM 耗时」对比可区分是"我们慢"还是"模型慢"。',"daemon.charts.llmLatency.help":"每轮模型 API 往返耗时(守护进程→模型→守护进程),p50/p95。属模型侧延迟,区别于上面的 HTTP「API 耗时」。","daemon.charts.apiHealth.help":"服务商侧 LLM 失败。每次失败尝试 = 1 次报错,每次自动退避 = 1 次重试。瞬时 429/5xx 通常被重试吸收(报错 ≈ 重试);报错高于重试说明调用彻底失败。","daemon.charts.promptLatency.help":"每个 prompt(任务):派发前在会话队列中的等待 p95,以及端到端执行 p95。等待升高即背压信号。","daemon.charts.eventLoop.help":"守护进程事件循环延迟 p99——CPU 饱和 / 阻塞信号。延迟高说明守护进程被拖住,一切都会变慢。","daemon.charts.cpu.help":"每次采样的 CPU 占用(占全部核心百分比):守护进程,以及运行实际 LLM/工具的 ACP 子进程。子进程 0% 表示无子进程运行。","daemon.charts.memory.help":"每次采样的常驻内存:守护进程 RSS、守护进程 V8 堆、ACP 子进程 RSS。若持续增长可能是内存泄漏。","daemon.charts.pipe.help":"每个窗口内经 stdio 管道与 ACP 子进程收发的字节数。持续偏大说明守护进程与子进程间帧交互频繁。","daemon.charts.connections.help":"每次采样的客户端传输连接:REST/SSE 流、ACP WebSocket 流、ACP 连接数。","daemon.charts.tokens.help":"每个窗口内计入模型轮次的输入(prompt)与输出(completion)token——随时间的模型消耗。","daemon.usage.today":"今日","daemon.usage.period7d":"7天","daemon.usage.period30d":"30天","daemon.usage.rangeWeek":"近 7 天","daemon.usage.rangeMonth":"近 30 天","daemon.usage.rangeGroup":"统计周期","daemon.usage.tokensConsumed":"tokens 消耗","daemon.usage.sessions":"会话","daemon.usage.requests":"请求","daemon.usage.tools":"工具","daemon.usage.changes":"改动","daemon.usage.breakdownTitle":"Token 拆分","daemon.usage.inputTokens":"输入 tokens","daemon.usage.inputHint":"请求 + 缓存读取","daemon.usage.outputTokens":"输出 tokens","daemon.usage.outputHint":"响应 + 推理","daemon.usage.cacheRead":"缓存读取","daemon.usage.cacheHint":"缓存读取占比","daemon.usage.heatmapTitle":"Token 热力图","daemon.usage.heatmapSub":e=>`最近 ${(e==null?void 0:e.months)??12} 个月 · 每日 token 汇总`,"daemon.usage.low":"少","daemon.usage.high":"多","daemon.usage.dowMon":"一","daemon.usage.dowWed":"三","daemon.usage.dowFri":"五","daemon.usage.empty":"暂无 token 使用记录。","daemon.usage.loading":"加载用量中…","daemon.usage.failed":"加载用量失败","daemon.usage.cellTokens":e=>`${(e==null?void 0:e.date)??""} · Tokens: ${(e==null?void 0:e.tokens)??"0"} · Cache: ${(e==null?void 0:e.cache)??0}%`,"daemon.usage.rangeWordToday":"今日","daemon.usage.rangeWordWeek":"7 天","daemon.usage.rangeWordMonth":"30 天","daemon.usage.modelShareTitle":"模型份额","daemon.usage.modelShareSub":"token 份额 · 浅绿表示缓存读取","daemon.usage.modelMeta":e=>`${(e==null?void 0:e.tokens)??"0"} tokens · 缓存 ${(e==null?void 0:e.cache)??0}%`,"daemon.usage.skillTitle":"技能调用","daemon.usage.skillSub":"技能名 / 次数","daemon.usage.skillName":"技能名","daemon.usage.skillCount":"次数","daemon.usage.dailyTokensTitle":"Tokens","daemon.usage.dailyTokensSub":"每日 token 总量","daemon.usage.dailySessionsTitle":"会话","daemon.usage.dailySessionsSub":"每日活跃会话数","delete.cannotCurrent":"无法删除当前活动会话。","delete.action":"删除","delete.deleted":"会话已删除。","delete.deletedCount":e=>`已删除 ${(e==null?void 0:e.count)??0} 个会话。`,"delete.deleting":"删除中...","delete.failed":e=>`删除会话失败。${e!=null&&e.reason?` ${e.reason}`:""}`,"delete.footer":"↑↓ 导航 · Space 选择 · Enter 删除 · Esc 取消","delete.noMatch":e=>`没有匹配 "${(e==null?void 0:e.query)??""}" 的会话`,"delete.none":"没有可删除的会话","delete.allFailed":e=>`删除 ${(e==null?void 0:e.count)??0} 个会话失败: ${(e==null?void 0:e.reason)??"未知错误"}`,"delete.nonRemoved":"没有会话被删除。","delete.notFound":"会话未找到，可能已被删除。","delete.partialFail":e=>`已删除 ${(e==null?void 0:e.removed)??0} 个，${(e==null?void 0:e.failed)??0} 个失败: ${(e==null?void 0:e.detail)??"未知错误"}`,"delete.matches":e=>`${(e==null?void 0:e.count)??0} 个匹配`,"delete.pressSearch":"按 / 搜索；Space 选择；Enter 删除","delete.selected":e=>`已选 ${(e==null?void 0:e.count)??0} 个`,"delete.title":"删除会话","time.justNow":"刚刚","time.minutesAgo":e=>`${(e==null?void 0:e.count)??0} 分钟前`,"time.hoursAgo":e=>`${(e==null?void 0:e.count)??0} 小时前`,"time.daysAgo":e=>`${(e==null?void 0:e.count)??0} 天前`,"dialog.footer.close":"Esc 关闭","dialog.footer.confirmCancel":"Enter 确认 · Esc 取消","release.cannotCurrent":"不能释放当前活动会话。","release.action":"释放","release.released":"会话已释放。","release.failed":e=>`释放会话失败。${e!=null&&e.reason?` ${e.reason}`:""}`,"release.footer":"↑↓ 导航 · Enter 释放 · Esc 取消","release.inactive":"只有活跃的 live session 才能释放。","release.inactiveBadge":"非活跃","release.noMatch":e=>`没有匹配 "${(e==null?void 0:e.query)??""}" 的会话`,"release.matches":e=>`${(e==null?void 0:e.count)??0} 个匹配`,"release.none":"没有可释放的 live session","release.pressSearch":"按 / 搜索；Enter 释放选中的 live session","release.releasing":"释放中...","release.title":"释放会话","dialog.footer.menu":"Esc 返回菜单","dialog.footer.mcpServers":"↑↓ 导航 · Enter 查看详情 · r 刷新 · Esc 关闭","dialog.footer.mcpSelect":"↑↓ 导航 · Enter 选择 · Esc 返回","dialog.footer.modelFast":"↑↓ 导航 · / 搜索 · c 自定义 · Enter 设置 fast model · Esc 取消","dialog.footer.navSelectCancel":"↑↓ 导航 · Enter 选择 · Esc 取消","dialog.footer.navSelectClose":"↑↓ 导航 · Enter 选择 · Esc 关闭","dialog.footer.navSelectMenu":"↑↓ 导航 · Enter 选择 · Esc 返回菜单","dialog.footer.navOpenClose":"↑↓ 导航 · Enter 打开 · Esc 关闭","dialog.footer.navOpenMenu":"↑↓ 导航 · Enter 打开 · Esc 返回菜单","dialog.footer.back":"Esc 返回","dialog.footer.backClose":"Esc 关闭","dialog.footer.saveClose":"↑↓ 切换输入框 · ⌘/Ctrl+Enter 保存 · Esc 关闭","dialog.footer.saveMenu":"↑↓ 切换输入框 · ⌘/Ctrl+Enter 保存 · Esc 返回菜单","dialog.footer.search":"输入搜索 · Enter 确认 · Esc 清空","dialog.footer.select":"Enter 选择","editor.escClearHint":"再按一次 Esc 清空","editor.hintCommands":"命令","editor.hintFiles":"文件","editor.hintNext":"下一条","editor.hintPrev":"上一条","editor.hintSearch":"搜索","editor.noHistory":"没有匹配的历史记录","editor.placeholder":"输入消息或 @ 文件路径","editor.shellPlaceholder":"请输入终端命令","editor.send":"发送消息","editor.connectionDisconnected":"连接已中断，请在恢复后重试。","editor.sessionLoading":"会话正在加载，请稍后再发送。","editor.processing":"处理中。新消息会进入队列。","editor.searchHint":"ctrl+r 下一条 · tab 采纳 · enter 发送 · esc 取消","editor.searchLabel":"历史搜索：","editor.searchPlaceholder":"输入以搜索…","quickActions.open":"更多操作","quickActions.title":"更多操作","quickActions.mcp":"MCP","quickActions.context":"上下文","quickActions.status":"运行状态","quickActions.stats":"会话统计","quickActions.memory":"记忆管理","quickActions.extensions":"扩展","quickActions.skills":"技能详情","quickActions.tools":"工具详情","quickActions.agents":"智能体","quickActions.help":"帮助","quickActions.theme":"设置主题","quickActions.auth":"认证","quickActions.settings":"设置","quickActions.new":"新建会话","quickActions.resume":"切换会话","quickActions.delete":"删除会话","quickActions.branch":"复制会话","quickActions.rewind":"回退会话","quickActions.historyQuestion":"历史提问","quickActions.recap":"生成摘要","quickActions.copy":"复制输出","quickActions.shellMode":"Shell模式","quickActions.exitShellMode":"退出Shell","quickActions.setGoal":"设置目标","session.missing":"当前会话不存在","session.new":"新建会话","workspace.loadFailed":"工作区加载失败","workspace.notFound":"工作区不存在","workspace.notFoundDescription":"此工作区可能已被移除，或链接已经失效。","workspace.loadFailedDescription":"无法连接工作区服务，请检查守护进程后重试。","scheduledTasks.title":"定时任务","scheduledTasks.subtitle":"按计划自动执行任务，也可随时手动触发。","scheduledTasks.loading":"加载中…","scheduledTasks.count":e=>`${(e==null?void 0:e.count)??0} 个任务`,"scheduledTasks.refresh":"刷新","scheduledTasks.new":"新建定时任务","scheduledTasks.createViaChat":"通过聊天创建","scheduledTasks.chatStarter":"帮我创建一个长期保留的定时任务，我想：","scheduledTasks.name":"名称","scheduledTasks.workspace":"工作区","scheduledTasks.workspacePrimaryTag":"（主）","scheduledTasks.taskId":"任务 ID","scheduledTasks.schedule":"计划","scheduledTasks.type":"类型","scheduledTasks.status":"状态","scheduledTasks.namePlaceholder":"可选 —— 默认取提示词","scheduledTasks.prompt":"提示词","scheduledTasks.promptPlaceholder":"这个任务要做什么？","scheduledTasks.reference.extension":"扩展","scheduledTasks.reference.skill":"技能","scheduledTasks.reference.mcp":"MCP","scheduledTasks.referencePicker":"引用选择器","scheduledTasks.reference.loading":"加载中…","scheduledTasks.reference.empty":"暂无可选项。","scheduledTasks.frequency":"频率","scheduledTasks.freq.daily":"每天","scheduledTasks.freq.weekdays":"工作日","scheduledTasks.freq.weekly":"每周","scheduledTasks.freq.hourly":"每小时","scheduledTasks.freq.minutes":"每 N 分钟","scheduledTasks.freq.custom":"自定义（cron）","scheduledTasks.time":"时间","scheduledTasks.weekday":"星期","scheduledTasks.interval":"分钟","scheduledTasks.cron":"Cron 表达式","scheduledTasks.weekdayNames":"周日,周一,周二,周三,周四,周五,周六","scheduledTasks.human.daily":e=>`每天 ${(e==null?void 0:e.time)??""}`,"scheduledTasks.human.weekdays":e=>`工作日 ${(e==null?void 0:e.time)??""}`,"scheduledTasks.human.weekly":e=>`每${(e==null?void 0:e.day)??""} ${(e==null?void 0:e.time)??""}`,"scheduledTasks.human.hourly":e=>`每小时 第 ${(e==null?void 0:e.min)??"00"} 分`,"scheduledTasks.human.everyMinutes":e=>`每 ${(e==null?void 0:e.n)??""} 分钟`,"scheduledTasks.never":"尚未运行","scheduledTasks.repeats":"重复","scheduledTasks.runsOnce":"仅一次","scheduledTasks.lastFired":e=>`上次运行：${(e==null?void 0:e.when)??""}`,"scheduledTasks.runNow":"立即运行","scheduledTasks.enable":"启用","scheduledTasks.disable":"停用","scheduledTasks.delete":"删除","scheduledTasks.deleteConfirmTitle":"删除定时任务","scheduledTasks.deleteConfirm":e=>`确定删除定时任务「${(e==null?void 0:e.name)??""}」？`,"scheduledTasks.deletedSnapshot":"这个定时任务已被删除，下面显示的是创建时的快照。","scheduledTasks.sessionScopedSnapshot":"这是一个会话内定时任务，下面显示的是创建时的快照。","scheduledTasks.empty":"还没有定时任务，创建一个开始吧。","scheduledTasks.create":"创建","scheduledTasks.creating":"创建中…","scheduledTasks.cancel":"取消","scheduledTasks.error.invalidSchedule":"计划无效","scheduledTasks.error.emptyPrompt":"提示词不能为空","scheduledTasks.error.promptTooLong":e=>`提示词超过 ${(e==null?void 0:e.max)??1e5} 字符限制`,"scheduledTasks.error.toggleFailed":"更新任务失败","scheduledTasks.error.deleteFailed":"删除任务失败","scheduledTasks.edit":"编辑","scheduledTasks.editTitle":"编辑定时任务","scheduledTasks.save":"保存","scheduledTasks.saving":"保存中…","scheduledTasks.runHistory":e=>`运行记录（${(e==null?void 0:e.count)??0}）`,"scheduledTasks.viewHistory":e=>`查看对话（${(e==null?void 0:e.count)??0}）`,"scheduledTasks.viewHistoryEmpty":"查看对话","scheduledTasks.viewHistoryHint":"打开该任务的会话查看运行详情","scheduledTasks.runKind.catchUp":"补跑","scheduledTasks.runKind.manual":"手动","scheduledTasks.runKind.withheld":"已跳过","scheduledTasks.error.runFailed":"记录运行失败","scheduledTasks.error.oneShotConsumedButFailed":"任务已删除,但提示词未能送达——它没有运行。请重新创建后重试。","scheduledTasks.dueNow":"即将运行","scheduledTasks.nextRunTooltip":e=>`下次运行：${(e==null?void 0:e.when)??""}`,"scheduledTasks.dur.d":"天","scheduledTasks.dur.h":"小时","scheduledTasks.dur.m":"分","scheduledTasks.dur.s":"秒","scheduledTasks.runMode":"运行模式","scheduledTasks.runMode.shared":"共享会话","scheduledTasks.runMode.isolated":"隔离（每次运行新建会话）","scheduledTasks.runMode.shared.hint":"所有运行记录累积在同一个会话中。","scheduledTasks.runMode.isolated.hint":"每次运行获得独立的会话上下文。","scheduledTasks.condition":"前置条件（可选）","scheduledTasks.conditionPlaceholder":"例如：检查昨天以来 main 分支有没有新提交。如果没有，则本次不应执行。","scheduledTasks.condition.hint":'每次触发前，先在本任务自己的会话中检查该条件。只有判定为"是"，才会新建会话执行命令；否则跳过本次运行。',"scheduledTasks.condition.cardPrefix":"若：","turnOutputs.filesEdited":e=>`已编辑 ${(e==null?void 0:e.count)??0} 个文件`,"turnOutputs.viewChanges":"查看更改","turnOutputs.review":"审核","turnOutputs.collapseFiles":"收起文件","turnOutputs.showMoreFiles":e=>`再展示 ${(e==null?void 0:e.count)??0} 个文件`,"turnOutputs.previousTurn":"上轮对话","turnOutputs.fileCount":e=>`${(e==null?void 0:e.count)??0} 个文件`,"turnOutputs.openFileTree":"打开文件树","turnOutputs.closeFileTree":"关闭文件树","sidebar.label":"工作区侧边栏","sidebar.toggleMenu":"切换菜单","sidebar.newChat":"新对话","sidebar.newTask":"新建任务","sidebar.plugins":"插件","sidebar.project":"项目","sidebar.pinnedSessions":"置顶","sidebar.workspaceSelectLabel":"工作区","sidebar.details":"详情","sidebar.workspacePrimary":"主工作区","sidebar.workspaceUntrusted":"未信任","sidebar.workspaceReadOnly":"只读","sidebar.workspaceTrustToOpen":"信任此工作区后才能打开会话。","sidebar.addWorkspace":"添加工作区","sidebar.addWorkspaceTitle":"添加工作区","sidebar.addWorkspacePath":"目录路径","sidebar.addWorkspaceRegister":"注册","sidebar.addWorkspaceCancel":"取消","sidebar.addWorkspaceError":"添加工作区失败","sidebar.addWorkspacePersistenceError":"守护进程未确认工作区已持久化注册","sidebar.addWorkspaceAbsError":"路径必须是绝对路径","sidebar.addWorkspaceHint":"请输入项目目录的绝对路径。","sidebar.addWorkspacePersist":"服务重启后保留","sidebar.addWorkspacePersistHint":"将此工作区注册持久化到守护进程配置中。","sidebar.addWorkspaceAdding":"添加中…","sidebar.removeWorkspace":"移除工作区","sidebar.workspaceActions":"工作区操作","sidebar.forceRemoveWorkspace":"强制移除","sidebar.removeWorkspaceTitle":"移除工作区","sidebar.removeWorkspaceConfirm":e=>`确定移除“${(e==null?void 0:e.name)??""}”的运行时和持久化注册吗？文件、设置和会话历史不会被删除。`,"sidebar.removeWorkspaceBusy":e=>`“${(e==null?void 0:e.name)??""}”仍有活动运行时资源。强制移除会终止这些资源。`,"sidebar.removeWorkspaceCurrentSession":"请先切换到其他工作区或关闭当前会话，再执行强制移除。","sidebar.removeWorkspaceInProgress":"另一个客户端正在移除此工作区，请在操作完成后刷新。","sidebar.removeWorkspaceError":"移除工作区失败","sidebar.removeWorkspaceSessions":e=>`会话：${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspacePrompts":e=>`活动提示：${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspaceStarts":e=>`待启动会话：${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspaceConnections":e=>`ACP 连接：${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspaceMemoryTasks":e=>`Memory 任务：${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspaceWorkers":e=>`Channel worker：${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspaceVoiceSessions":e=>`语音会话：${(e==null?void 0:e.count)??0}`,"sidebar.noSessions":"暂无会话","sidebar.projectFallback":"项目","sidebar.sessionsOverview":"会话总览","sidebar.splitView":"分屏","sidebar.settings":"设置","sidebar.daemonStatus":"Daemon 状态","sidebar.scheduledTasks":"定时任务","sidebar.themeLight":"切换到浅色主题","sidebar.themeDark":"切换到深色主题","sidebar.collapse":"收起","sidebar.expand":"展开","sidebar.collapseProject":"收起项目","sidebar.expandProject":"展开项目","sidebar.search":"搜索会话","sidebar.searchPlaceholder":"搜索会话","sidebar.searchEmpty":"没有匹配的会话。","sidebar.rename":"重命名","sidebar.renameCurrentOnly":"暂仅支持重命名当前会话","sidebar.export":"导出对话记录","sidebar.exportFailed":"导出会话失败","sidebar.delete":"删除","sidebar.archive":"归档","sidebar.unarchive":"恢复","sidebar.moreActions":"更多操作","sidebar.archiveCurrentDisabled":"不能归档当前会话","sidebar.archivedTitle":"已归档","sidebar.archivedEmpty":"没有已归档的会话。","sidebar.archiveFailed":"归档会话失败","sidebar.unarchiveFailed":"恢复会话失败","sidebar.loadingSessions":"正在加载会话...","sidebar.loadFailed":"会话加载失败，点击重试。","sidebar.renameFailed":"重命名会话失败","sidebar.deleteFailed":"删除会话失败","sidebar.newSessionFailed":"创建新对话失败","sidebar.switchFailed":"切换会话失败","sidebar.currentDeleteDisabled":"不能删除当前会话","sidebar.deleteConfirmDescription":e=>`确定删除“${(e==null?void 0:e.name)??""}”吗？删除后不可恢复。`,"sidebar.clients":e=>`${(e==null?void 0:e.count)??0} 个客户端`,"sidebar.running":"运行中","sidebar.completedUnread":"刚完成","sidebar.pin":"置顶","sidebar.unpin":"取消置顶","sidebar.sessionGroup":"分组","sidebar.groupFilter":"会话分组","sidebar.groupAll":"全部","sidebar.groupPinned":"已置顶","sidebar.groupUngrouped":"未分组","sidebar.groupRecent":"最近","sidebar.groupCreate":"新建分组","sidebar.groupRename":"重命名分组","sidebar.groupDelete":"删除分组","sidebar.groupColor":"分组颜色","sidebar.groupNamePrompt":"分组名称","sidebar.groupDeleteConfirm":e=>`确定删除分组“${(e==null?void 0:e.name)??""}”吗？`,"sidebar.groupsLoadFailed":"加载会话分组失败","sidebar.groupCreateFailed":"创建分组失败","sidebar.groupAssignFailedAfterCreate":"分组已创建，但移动会话失败","sidebar.groupUpdateFailed":"更新分组失败","sidebar.groupDeleteFailed":"删除分组失败","sidebar.organizationFailed":"更新会话组织失败","sidebar.groupColor.red":"红色","sidebar.groupColor.orange":"橙色","sidebar.groupColor.yellow":"黄色","sidebar.groupColor.green":"绿色","sidebar.groupColor.blue":"蓝色","sidebar.groupColor.purple":"紫色","sidebar.groupColor.custom":"自定义…","sidebar.groupColor.picker":"选择自定义分组颜色","sidebar.groupColor.hex":"Hex 颜色","sidebar.groupColor.invalid":"请输入六位 Hex 颜色，例如 #416ef5。","quickKeys.cursor":"移动光标","quickKeys.escape":"取消运行","quickKeys.history":"切换历史","quickKeys.retry":"重试失败请求","quickKeys.searchHistory":"搜索历史","quickKeys.tab":"接受补全","error.unsupportedTheme":"不支持该主题。请使用 /theme light 或 /theme dark。","queue.delete":"删除","queue.edit":"编辑","queue.insert":"插入","queue.cleared":"队列已清空。","queue.deleteTip":"移出队列","queue.editTip":"移出队列并将内容放回输入框","queue.insertTip":"将信息插入当前会话，下次模型调用生效。","queue.inserted":"已插入，下次模型调用生效。","queue.insertCommandDisabled":"命令无法插入当前回合。","queue.submitting":"提交中...","queue.editing":"编辑中...","queue.removing":"处理中...","queue.submittingDisabled":"排队消息正在提交中...","queue.commandBlocked":"当前回合运行时，Slash 命令不能进入排队。","queue.shellBlocked":"当前回合运行时，Shell 命令不能进入排队。","queue.queueFailed":"排队消息失败","queue.insertFailed":"插入排队消息失败","queue.deleteFailed":"移出队列失败","queue.editFailed":"编辑排队消息失败","queue.footer":"按 ↑ 编辑最后一条排队消息 · Esc 清空队列","queue.imageCount":e=>`（+${(e==null?void 0:e.count)??0} 张图片）`,"queue.more":e=>`...（还有 ${(e==null?void 0:e.count)??0} 条）`,"midTurn.inserted":e=>`已插入消息：${(e==null?void 0:e.message)??""}`,"help.builtIn":"内置命令","help.commandCount":e=>`${(e==null?void 0:e.count)??0} 个命令`,"help.commandMeta.builtIn":"内置","help.commandMeta.custom":"自定义","help.commandMeta.subcommands":e=>`${(e==null?void 0:e.count)??0} 个子命令`,"help.commandsIntro":"浏览内置命令：","help.customGroup":"自定义、skills、plugins、MCP","help.customIntro":"浏览自定义、skill、plugin 和 MCP 命令：","help.empty":"当前没有可用命令。","help.emptyCustom":"当前没有可用的自定义命令。","help.footer":"Tab/Shift+Tab 切换标签 · ↑/↓ 或 PgUp/PgDn 滚动 · Esc 关闭","help.intro":"Qwen Code 可以理解代码库，在你的许可下修改文件，并直接执行命令。","help.section.shortcuts":"快捷键","help.search":"搜索命令","help.shortcut.addContext":"添加文件或目录作为上下文","help.shortcut.altWords":"按词跳转","help.shortcut.clear":"清屏","help.shortcut.commandMenu":"打开命令菜单","help.shortcut.completion":"接受补全或切换帮助标签","help.shortcut.history":"切换历史 prompt 或滚动列表","help.shortcut.searchHistory":"搜索历史 prompt","help.shortcut.newline":"插入换行","help.shortcut.pasteImages":"粘贴图片","help.shortcut.shell":"运行 shell 命令","help.shortcut.togglePanel":"切换此面板","help.shortcut.retry":"重试上次请求","help.shortcut.compact":"切换紧凑模式","retry.hint":"按 Ctrl+Y 重试或点击重试","retry.none":"没有可重试的失败请求。","branch.failed":"分支会话失败。","branch.success":e=>`已复制会话，新会话名称为： "${(e==null?void 0:e.name)??""}"，当前已切换到新的会话。`,"fork.empty":"请提供任务指令。用法：/fork <指令>","fork.failed":e=>`启动后台智能体失败：${(e==null?void 0:e.reason)??""}`,"fork.notStarted":"后台智能体未启动。","fork.started":e=>`已启动后台智能体："${(e==null?void 0:e.name)??""}"，可在后台任务中查看。`,"command.hidden":"该命令不可用。","help.shortcut.approvals":"切换审批模式","help.shortcut.cancel":"关闭弹窗或取消操作","bug.failed":"加载系统信息失败，无法提交 Bug 报告。","bug.popupBlocked":"弹窗被拦截，请允许弹窗后重试。","bug.submitted":"Bug 报告已在新标签页中打开。","clear.blocked":"流式输出中无法清屏 — 先按 Esc 取消。","error.unknown":"未知错误","error.modelStreamInterrupted":"模型响应流已中断，请重试。","shell.command":"Shell 命令","compact.enabled":"紧凑模式已开启","compact.disabled":"紧凑模式已关闭","compact.hint":"按 Ctrl+O 显示完整工具输出","compact.saveFailed":"保存紧凑模式失败","help.subcommands":"子命令","help.tab.commands":"内置命令","help.tab.custom":"自定义命令","help.tab.general":"快捷键","help.title":"帮助","slash.category.custom":"自定义","slash.category.skill":"Skill","slash.category.system":"系统","language.changed":e=>`UI 语言已切换为 ${(e==null?void 0:e.language)??""}`,"language.current":e=>`当前 UI 语言：${(e==null?void 0:e.language)??""}`,"language.invalid":"语言无效。可用值：en, zh-CN","language.options":"可用选项：","language.set":"设置 UI 语言","language.usage":"用法：/language ui [en|zh-CN]","localCommand.noSession":"当前还没有会话。请先发送第一条消息，再使用这个命令。","local.agents":"管理智能体","local.bug":"提交错误报告","local.compress":"将上下文压缩为摘要","local.compressFast":"无需 AI 的快速上下文压缩","local.config":"通过点分路径键获取或设置配置项","local.diff":"显示工作区相对 HEAD 的改动统计","local.directory":"管理工作区目录","local.docs":"打开完整的 Qwen Code 文档","local.doctor":"运行安装和环境诊断","local.dream":"整合托管的自动记忆主题文件","local.effort":"设置推理模型的思考强度","local.export":"将当前会话历史导出到文件","local.forget":"从托管的自动记忆中移除匹配的条目","local.hooks":"管理 Qwen Code 钩子","local.importConfig":"从 Claude 配置导入 MCP 服务器","local.init":"分析项目并创建 QWEN.md 文件","local.insight":"根据聊天历史生成编程洞察","local.lsp":"显示 LSP 服务器状态","local.remember":"将持久记忆保存到记忆系统","local.summary":"生成项目摘要文件","local.workflows":"列出进行中和已完成的工作流运行","skilldesc.batch":"并行批量处理多个文件","skilldesc.dataviz":"图表与数据可视化设计指南","skilldesc.extensionCreator":"创建、测试和定制 Qwen Code 扩展","skilldesc.loop":"按计划或自定节奏循环运行提示词","skilldesc.newApp":"从零构建新应用的工作流","skilldesc.qcHelper":"解答 Qwen Code 使用相关问题","skilldesc.review":"审查代码变更的正确性、安全、质量与性能","skilldesc.simplify":"清理近期代码变更（复用与精简）","skilldesc.stuck":"诊断卡死或缓慢的 Qwen Code 会话","skilldesc.agentReproduceAlign":"将已移植的 Codex/Claude Code 功能与原版对齐","skilldesc.agentReproduceFeature":"复现 Codex/Claude Code 的现有功能","skilldesc.autofix":"实现已批准的 issue 或处理 PR 审查反馈","skilldesc.bugfix":"按先复现流程修复 GitHub issue 中的 bug","skilldesc.codegraph":"通过图数据库和向量索引分析代码库","skilldesc.createIssue":"根据想法或 bug 描述起草并提交 GitHub issue","skilldesc.desktopPet":"为 Qwen Code 创建像素风桌面宠物","skilldesc.docsAuditAndRefresh":"对照代码库审计并刷新 docs/ 文档","skilldesc.docsUpdateFromDiff":"按本地 git diff 更新官方文档","skilldesc.e2eTesting":"运行 Qwen Code CLI 的端到端测试","skilldesc.featDev":"实现非平凡功能的端到端工作流","skilldesc.memoryLeakDebug":"用堆快照诊断 CLI 内存泄漏","skilldesc.openworkDesktopSync":"将 packages/desktop 与 openwork 逐提交同步","skilldesc.preparePr":"从当前分支准备 GitHub PR 标题和正文","skilldesc.qwenCodeClaw":"将 Qwen Code 用作代码理解智能体","skilldesc.structuredDebugging":"假设驱动的疑难 bug 调试方法","skilldesc.terminalCapture":"自动化终端 UI 截图测试","skilldesc.tmuxRealUserTesting":"用 tmux 做真实用户测试并保存日志","skilldesc.triage":"把关和审查 Qwen Code 的 issue 与 PR","local.approvalMode":"切换审批模式","local.auth":"连接 LLM provider","auth.title":"连接 Provider","auth.step.group":"类型","auth.step.provider":"供应商","auth.step.protocol":"协议","auth.step.baseUrl":"Base URL","auth.step.apiKey":"API Key","auth.step.models":"模型 ID","auth.step.advanced":"高级配置","auth.protocol.openai":"OpenAI 兼容","auth.protocol.openaiDesc":"标准 OpenAI API 格式（最常用）","auth.protocol.anthropic":"Anthropic 兼容","auth.protocol.anthropicDesc":"Anthropic Messages API 格式","auth.protocol.gemini":"Gemini 兼容","auth.protocol.geminiDesc":"Google Gemini API 格式","auth.apiKeyRequired":"API key 不能为空。","auth.baseUrlInvalid":"Base URL 必须以 http:// 或 https:// 开头。","auth.baseUrlPrompt":"输入此协议的 API endpoint。","auth.baseUrlRequired":"Base URL 不能为空。","auth.documentation":"文档","auth.modelsRequired":"模型 ID 不能为空。","auth.review":"确认","auth.reviewText":"以下 JSON 将保存到 settings.json：","auth.save":"保存","auth.saving":"正在保存...","auth.termsTitle":"服务条款和隐私声明","auth.continue":"继续","auth.modelsPrompt":e=>`输入以逗号分隔的模型 ID。例如：${(e==null?void 0:e.modelIds)??""}`,"auth.advanced.prompt":"可选：配置高级生成设置。","auth.advanced.thinking":"启用 thinking","auth.advanced.thinkingDesc":"允许模型在回复前进行扩展推理。","auth.advanced.modality":"启用多模态","auth.advanced.modalityDesc":"启用图片、视频等多模态输入能力。","auth.advanced.modalityImage":"图片","auth.advanced.modalityVideo":"视频","auth.advanced.modalityAudio":"音频","auth.advanced.modalityPdf":"PDF","auth.advanced.contextWindow":"上下文窗口","auth.advanced.contextDesc":"最大输入 token 数（留空则根据模型名称自动检测）。","auth.advanced.contextPlaceholder":"上下文窗口（可选）","local.btw":"快速问一个不影响主对话的侧边问题。用法：/btw <your question>","btw.empty":"请提供一个问题。用法：/btw <你的问题>","btw.emptyAnswer":"未收到回答。","btw.failed":"回答 btw 问题失败","btw.answering":"+ 正在回答...","btw.shortcuts.pending":"按 Escape、Ctrl+C 或 Ctrl+D 取消","btw.shortcuts.done":"按 Space、Enter 或 Escape 关闭","local.clear":"以空上下文开始新会话；之前的会话会保留在磁盘上（可用 /resume 恢复）","local.context":'显示上下文窗口使用情况明细。使用 "/context detail" 查看逐项明细',"local.copy":"复制最后输出或代码片段","local.delete":"永久删除会话","local.release":"释放 live session","local.rewind":"回退当前会话","local.branch":"将当前对话分叉到新会话","local.fork":"基于当前对话启动后台智能体","local.help":"查看帮助和可用命令","local.language":"切换 UI 语言","local.mcp":"管理 MCP servers","local.memory":"管理 memory","local.model":"切换模型或设置 fast model","local.new":"开始新对话","local.plan":"进入 Plan 模式","local.goal":"设置目标并持续工作直到完成","local.recap":"生成会话摘要","recap.label":"回顾","recap.loading":"正在生成摘要...","recap.empty":"对话内容还不够，暂时无法生成摘要。","recap.failed":"生成摘要失败","rewind.action":"回退","rewind.confirm":"确认回退","rewind.empty":"当前会话没有可回退的快照。","rewind.failed":e=>`回退会话失败：${(e==null?void 0:e.reason)??""}`,"rewind.loading":"正在加载可回退的 prompt...","rewind.promptFallback":e=>`Prompt ${(e==null?void 0:e.id)??""}`,"rewind.rewinding":"回退中...","rewind.subtitle":"仅回退会话，不涉及文件。","rewind.title":"回退会话","rewind.turn":e=>`第 ${(e==null?void 0:e.turn)??0} 个 prompt`,"local.rename":"重命名当前会话","rename.empty":"请输入会话名称，例如 /rename 项目调试，或使用 /rename --auto。","rename.success":e=>`会话已重命名为 ${(e==null?void 0:e.name)??""}`,"local.reset":"重置当前对话","local.resume":"恢复历史会话","local.skills":"查看可用 skills","local.stats":"查看会话统计","local.tasks":"查看后台任务","local.status":"查看版本信息","local.theme":"切换主题","local.settings":"查看和编辑设置","local.schedule":"管理定时任务","local.extensions":"管理扩展。用法: /extensions manage|install <source>","extensions.label":"扩展","extensions.action.failed":e=>`扩展操作失败${e!=null&&e.name?`（${e.name}）`:e!=null&&e.source?`（${e.source}）`:""}：${(e==null?void 0:e.error)??"未知错误"}`,"extensions.commands.refreshFailed":"刷新扩展命令失败。","extensions.install.failed":e=>`安装扩展失败${e!=null&&e.source?`（${e.source}）`:""}：${(e==null?void 0:e.error)??"未知错误"}`,"extensions.manage.agents":"智能体：","extensions.manage.actions":"扩展操作","extensions.manage.checkingUpdates":"正在检查更新...","extensions.manage.commands":"命令：","extensions.manage.contextFiles":"上下文文件：","extensions.manage.count":e=>`已安装 ${(e==null?void 0:e.count)??0} 个扩展`,"extensions.manage.detailsTitle":"扩展详情","extensions.manage.disable":"禁用扩展","extensions.manage.disabled":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已禁用。`,"extensions.manage.empty":"未安装扩展。","extensions.manage.emptyAgents":"此扩展没有智能体。","extensions.manage.emptyCommands":"此扩展没有命令。","extensions.manage.emptyContextFiles":"此扩展没有上下文文件。","extensions.manage.emptyDescription":"安装扩展以添加命令、Skills、智能体或 MCP servers。","extensions.manage.emptyMcpServers":"此扩展没有 MCP servers。","extensions.manage.emptySkills":"此扩展没有 Skills。","extensions.manage.enable":"启用扩展","extensions.manage.enabled":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已启用。`,"extensions.manage.footer.back":"Esc 返回","extensions.manage.footer.confirm":"Enter 确认 · Esc 取消","extensions.manage.footer.list":"↑↓ 导航 · Enter 选择 · r 刷新 · Esc 关闭","extensions.manage.footer.select":"↑↓ 导航 · Enter 选择 · Esc 返回","extensions.manage.loading":"正在加载扩展...","extensions.manage.mcpServers":"MCP servers：","extensions.manage.installType":"安装类型：","extensions.manage.name":"名称：","extensions.manage.notUpdatable":"不可更新","extensions.manage.noDescription":"暂无描述","extensions.manage.noMatches":"没有匹配的扩展。","extensions.manage.origin":"来源平台：","extensions.manage.overview":"基本信息","extensions.manage.path":"路径：","extensions.manage.queued":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 的操作已提交。`,"extensions.manage.refreshed":e=>`已刷新 ${(e==null?void 0:e.refreshed)??0} 个 session，${(e==null?void 0:e.failed)??0} 个失败。`,"extensions.manage.restartRequired":"已更新，需要重启","extensions.manage.settings":"设置：","extensions.manage.search":"搜索扩展…","extensions.manage.skills":"Skills：","extensions.manage.source":"来源：","extensions.manage.status":"状态：","extensions.manage.status.disabled":"已禁用","extensions.manage.status.enabled":"已启用","extensions.manage.title":"管理扩展","extensions.manage.unknownUpdate":"未知","extensions.manage.uninstalled":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已卸载。`,"extensions.manage.uninstallAction":"卸载扩展","extensions.manage.uninstallConfirm":e=>`确定卸载扩展 "${(e==null?void 0:e.name)??"扩展"}"？`,"extensions.manage.upToDate":"已是最新","extensions.manage.update":"更新扩展","extensions.manage.updateAvailable":"有可用更新","extensions.manage.updateError":"检查更新失败","extensions.manage.updateComplete":"已更新","extensions.manage.updateStatus":"更新状态：","extensions.manage.updating":"正在更新…","extensions.manage.updated":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已更新。`,"extensions.manage.updatedWithVersion":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已更新到 v${(e==null?void 0:e.version)??""}。`,"extensions.manage.version":"版本：","extensions.manage.viewDetails":"查看详情","extensions.install.installed":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已安装。`,"extensions.install.installedWithVersion":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" v${(e==null?void 0:e.version)??""} 已安装。`,"extensions.install.missingOptionValue":e=>`${(e==null?void 0:e.option)??"选项"} 缺少值`,"extensions.install.requestFailed":"安装扩展失败","extensions.install.started":e=>`正在从 "${(e==null?void 0:e.source)??""}" 安装扩展...`,"extensions.install.unknownOption":e=>`未知选项 ${(e==null?void 0:e.option)??""}`,"extensions.install.usage":"用法: /extensions manage|install <source>","extensions.install.waitForSession":"等待会话连接后再安装扩展。","local.tools":"列出可用工具。用法: /tools [desc]","loadWarning.commands":"命令列表加载失败，斜杠命令可能不完整。","loadWarning.context":"会话上下文加载失败，当前模式可能不准确。","loadWarning.models":"模型列表加载失败，部分模型详情可能不可用。","mcp.action.auth":"认证","mcp.action.authHint":"daemon 尚未暴露","mcp.action.authMessage":"daemon serve 尚未暴露 MCP 认证能力。","mcp.action.clearAuth":"清空认证","mcp.action.disable":"禁用","mcp.action.done":e=>`${(e==null?void 0:e.action)??"操作"}完成。`,"mcp.action.enable":"启用","mcp.action.enableMessage":"daemon serve 尚未暴露 MCP 启用/禁用能力。","mcp.action.failed":e=>`失败：${(e==null?void 0:e.error)??""}`,"mcp.action.running":e=>`${(e==null?void 0:e.action)??"操作"}中...`,"mcp.action.reauth":"重新认证","mcp.annotation.destructive":"破坏性","mcp.annotation.idempotent":"幂等","mcp.annotation.openWorld":"开放世界","mcp.annotation.readOnly":"只读","mcp.annotations":"注解","mcp.oauth.server":"服务器","mcp.oauth.starting":e=>`正在为 MCP server '${(e==null?void 0:e.name)??""}' 启动 OAuth 认证...`,"mcp.oauth.title":"OAuth 认证","mcp.clientBudget":e=>`${(e==null?void 0:e.count)??0}/${(e==null?void 0:e.budget)??0} 个客户端 · ${(e==null?void 0:e.mode)??"off"}`,"mcp.command":"命令","mcp.description":"描述：","mcp.action.reconnect":"重新连接","mcp.action.restart":"重启","mcp.action.tools":"查看工具","mcp.action.toolsHint":"Enter 查看","mcp.empty":"未配置 MCP 服务器。","mcp.emptyTools":"没有发现工具。","mcp.expand":"展开 MCP server","mcp.collapse":"收起 MCP server","mcp.inputSchema":"输入 schema","mcp.loadingStatus":"正在加载 MCP 状态...","mcp.loadingTools":"正在加载工具...","mcp.name":"名称","mcp.noDescription":"没有描述","mcp.noMatches":"没有匹配的 MCP 服务器。","mcp.noSchema":"没有输入 schema。","mcp.serverTool":"服务器工具","mcp.servers":e=>`${(e==null?void 0:e.count)??0} 个服务器`,"mcp.configuredServers":"已配置的 MCP 服务器：","mcp.fromExtension":e=>`（来自 ${(e==null?void 0:e.name)??""}）`,"mcp.extensionMcp":"扩展 MCP","mcp.invalidReason":e=>`无效：${(e==null?void 0:e.reason)??""}`,"mcp.invalidReasonLabel":"原因：","mcp.invalidToolHelp":"工具必须同时包含 name 和 description 才能被 LLM 使用。","mcp.invalidToolWarning":"警告：这个工具不能被 LLM 调用","mcp.manageServers":"管理 MCP servers","mcp.viewDetails":"查看详情","mcp.parameters":"参数：","mcp.required":" 必填","mcp.resources":"资源","mcp.resourcesUnavailable":"无法加载资源详情。","mcp.resourceCount":e=>`${(e==null?void 0:e.count)??0} 个资源`,"mcp.promptCount":e=>`${(e==null?void 0:e.count)??0} 个提示词`,"mcp.resource.uriLabel":"URI：","mcp.resource.nameLabel":"名称：","mcp.resource.mimeTypeLabel":"MIME 类型：","mcp.resource.sizeLabel":"大小：","mcp.resource.bytes":e=>`${(e==null?void 0:e.count)??0} 字节`,"mcp.scrollPosition":e=>`${(e==null?void 0:e.current)??0}/${(e==null?void 0:e.total)??0}`,"mcp.shortcut.back":"Esc 返回","mcp.shortcut.close":"Esc 关闭","mcp.shortcut.selectBack":"↑↓ 导航 · Enter 选择 · Esc 返回","mcp.shortcut.selectClose":"↑↓ 导航 · Enter 选择 · Esc 关闭","mcp.settings":"设置","mcp.extension":e=>`扩展：${(e==null?void 0:e.name)??""}`,"mcp.starting":e=>`⏳ MCP 服务器正在启动（${(e==null?void 0:e.count)??0} 个初始化中）...`,"mcp.startingNote":"注意：首次启动可能需要更长时间。工具可用性会自动更新。","mcp.restartSkipped":e=>`已跳过 ${(e==null?void 0:e.name)??""}：${(e==null?void 0:e.reason)??""}`,"mcp.restarted":e=>`已重启 ${(e==null?void 0:e.name)??""}，耗时 ${(e==null?void 0:e.duration)??0}ms`,"mcp.restartEntries":e=>`已重启 ${(e==null?void 0:e.name)??""} 的 ${(e==null?void 0:e.restarted)??0}/${(e==null?void 0:e.total)??0} 个条目${e!=null&&e.failedReasons?`（失败：${e.failedReasons}）`:""}`,"mcp.source":"来源","mcp.source.extension":"扩展","mcp.source.project":"工作区设置","mcp.source.user":"用户设置","mcp.status":"状态","mcp.status.blocked":"已阻止","mcp.status.connected":"已连接","mcp.status.connecting":"连接中","mcp.status.disconnected":"未连接","mcp.status.disconnectedTitle":"已断开","mcp.status.disabled":"已禁用","mcp.status.ready":"就绪","mcp.status.starting":"启动中...（首次启动可能需要更长时间）","mcp.status.unknown":"未知","mcp.tipDesc":"显示 server 和工具描述","mcp.tipNodesc":"隐藏描述","mcp.tipSchema":"显示工具参数 schema","mcp.tips":"💡 提示：","mcp.toolCount":e=>`${(e==null?void 0:e.count)??0} 个工具`,"mcp.toolsCount":e=>`${(e==null?void 0:e.count)??0} 个工具`,"mcp.toolsLabel":"工具：","mcp.title":"MCP 服务器","mcp.toolDetail":"工具详情","mcp.tools":"工具","mcp.toolsForServer":e=>`${(e==null?void 0:e.name)??"Server"} 的工具`,"mcp.transport":"传输","mcp.use":"使用","mcp.userMcp":"用户 MCP","mcp.workingDirectory":"工作目录","goal.aborted":"目标已中止","goal.achieved":"目标已达成","goal.check":"目标检查","goal.cleared":"目标已清除","goal.failed":"目标未能达成","goal.judge":"判断","goal.label":"目标","goal.lastCheck":"上次检查","goal.notYetMet":"尚未满足","goal.set":"目标已设置","goal.statusActive":"/goal 运行中","goal.turn":e=>`${(e==null?void 0:e.count)??0} 轮`,"goal.turnLabel":e=>`第 ${(e==null?void 0:e.count)??0} 轮`,"goal.turns":e=>`${(e==null?void 0:e.count)??0} 轮`,"memory.add":"添加","memory.add.desc":"写入一条持久 memory","memory.autoDream":e=>`自动整理：${(e==null?void 0:e.status)??"未知"} · ${(e==null?void 0:e.lastDream)??"从未"} · /dream 立即运行`,"memory.autoDreamUnsupported":"web-shell 暂不支持修改自动整理设置。","memory.autoFolder":"打开自动记忆文件夹","memory.autoMemory":e=>`自动记忆：${(e==null?void 0:e.status)??"未知"}`,"memory.autoMemoryUnsupported":"web-shell 暂不支持修改自动记忆设置。","memory.autoSkill":e=>`自动技能：${(e==null?void 0:e.status)??"未知"}`,"memory.autoSkillUnsupported":"web-shell 暂不支持修改自动技能设置。","memory.chooseScope":"选择 memory 的保存位置","memory.closed":"Memory 面板已关闭。","memory.contentEmpty":"Memory 内容为空。","memory.file":"Memory 文件","memory.fileOpen":"Memory 文件已打开。","memory.fileTruncated":"Memory 文件已打开，内容已截断。","memory.files":"Memory 文件","memory.footer":"Enter 确认 · Esc 取消","memory.footer.back":"Esc 返回","memory.global":"用户级","memory.global.desc":"保存到全局用户 memory 文件","memory.globalReadUnsupported":"全局 memory 位于当前 workspace 之外，当前 daemon 文件读取接口不能打开它的内容。","memory.loading":"正在加载 memory...","memory.loadingFile":"正在加载 memory 文件...","memory.lastDream":"5 hours ago","memory.menu":"Memory","memory.never":"从未","memory.noFiles":"未找到 memory 文件。","memory.on":"开","memory.openFolderUnsupported":"web-shell 暂不支持打开自动记忆文件夹。","memory.placeholder":e=>`写入${(e==null?void 0:e.scope)??"memory"}内容...`,"memory.project":"项目级","memory.project.desc":"保存到当前 workspace memory 文件","memory.refresh":"刷新","memory.refresh.desc":"重新加载 memory 文件信息","memory.refreshed":"Memory 已刷新。","memory.save":"保存 Memory","memory.savedIn":e=>`Saved in ${(e==null?void 0:e.path)??""}`,"memory.saved":e=>`${(e==null?void 0:e.scope)??"Memory"} 已保存：${(e==null?void 0:e.bytes)??0} 字节 -> ${(e==null?void 0:e.path)??""}`,"memory.saving":"保存中...","memory.show":"查看","memory.show.desc":"查看已配置的 memory 文件","memory.status":"Workspace 和用户 memory 文件","memory.unknown":"未知","memory.write":"写入 memory 内容","mode.auto":"智能审批","mode.auto.desc":"使用分类器评估工具调用，安全操作自动批准，风险操作阻止或请求确认","mode.auto.notice":"Auto 模式已启用。LLM 分类器会评估每个工具调用，自动批准安全操作，拦截危险操作。退出方式：Shift+Tab 或 /approval-mode default。","mode.footer":"(Enter 选择，Esc 取消)","mode.name.plan":"plan","mode.name.default":"default","mode.name.auto-edit":"auto-edit","mode.name.auto":"auto","mode.name.yolo":"yolo","mode.label.plan":"计划","mode.label.default":"请求批准","mode.label.auto-edit":"自动编辑","mode.label.auto":"智能审批","mode.label.yolo":"完全访问权限","mode.listLabel.plan":"计划（plan）","mode.listLabel.default":"请求批准（default）","mode.listLabel.auto-edit":"自动编辑（auto-edit）","mode.listLabel.auto":"智能审批（auto）","mode.listLabel.yolo":"完全访问权限（yolo）","mode.desc.plan":"仅分析，不修改文件或执行命令","mode.desc.default":"执行命令、编辑文件或访问外部资源前请求确认","mode.desc.auto-edit":"自动批准文件编辑，命令执行等敏感操作仍会询问","mode.desc.auto":"自动评估工具风险，安全操作直接执行，风险操作再确认","mode.desc.yolo":"自动批准所有工具调用，适合可信任务环境","mode.select":"审批模式","mode.autoApproved":e=>e!=null&&e.tool?`已自动批准：${e.tool}`:"切换模式后自动批准了待处理的工具调用。","mode.auto-edit":"自动编辑","mode.auto-edit.desc":"自动批准文件读写操作","mode.default":"默认模式","mode.default.desc":"每次工具调用都需要确认","mode.plan":"Plan 模式","mode.plan.desc":"仅分析和规划，不执行工具","mode.unknown":"未知模式","mode.yolo":"YOLO 模式","mode.yolo.desc":"自动批准所有操作","plan.title":"计划","model.contextWindow":"上下文窗口","model.contextWindow.unknown":"（未知）","model.current":e=>`当前：${(e==null?void 0:e.model)??"未知"}`,"model.modality":"模态","model.modality.text":"文本","model.modality.textOnly":"仅文本","model.modality.image":"图片","model.modality.pdf":"PDF","model.modality.audio":"音频","model.modality.video":"视频","model.baseUrl":"Base URL","model.apiKey":"API Key","model.default":"（默认）","model.notSet":"（未设置）","model.footer":"Enter 选择，↑↓ 导航，Esc 关闭","model.searchHint":"按 / 搜索","model.fastHint":"用于建议和旁路任务","model.noMatch":e=>`没有匹配 "${(e==null?void 0:e.query)??""}" 的模型`,"model.none":"没有可用模型","model.select":"选择模型","model.setFast":"设置 Fast Model","model.setVoice":"设置语音模型","model.setVision":"设置视觉模型","model.switch":"切换模型","model.unknown":"未知","resume.current":"当前","resume.activePrompt":"正在运行","resume.filter":"筛选","resume.noMatch":e=>`没有匹配 "${(e==null?void 0:e.query)??""}" 的会话`,"resume.none":"没有可恢复的会话","resume.pressSearch":"按 / 搜索","resume.search":"搜索","resume.title":"恢复会话","parallelAgents.title":"并行智能体","parallelAgents.done":e=>`${(e==null?void 0:e.done)??0}/${(e==null?void 0:e.total)??0} 完成`,"skills.available":"可用 skills:","skills.none":"当前没有可用 skill。","skills.empty":"没有可用 skill。","skills.footer":e=>e!=null&&e.name?`使用 /skills ${e.name} 调用 · r 刷新 · Esc 关闭`:"r 刷新 · Esc 关闭","skills.invocable":e=>`${(e==null?void 0:e.enabled)??0}/${(e==null?void 0:e.total)??0} 可调用`,"skills.details":"Skill 详情","skills.extension":"所属扩展","skills.filter.all":"全部","skills.filter.bundled":"内置","skills.filter.extension":"扩展","skills.filter.label":"按来源筛选 Skills","skills.filter.project":"工作区设置","skills.filter.user":"用户设置","skills.hint":"提示","skills.invocation":"调用方式","skills.level":"作用域","skills.level.bundled":"内置","skills.level.extension":"扩展","skills.level.project":"项目","skills.level.user":"用户","skills.loading":"正在加载 skills...","skills.model":"模型","skills.modelAccess":"模型调用","skills.modelAccess.disabled":"不可由模型调用","skills.modelAccess.enabled":"可由模型调用","skills.modelInvocable":"模型可用","skills.noDescription":"暂无描述","skills.noMatches":"没有匹配的 Skill。","skills.run":"运行 skill","skills.search":"搜索 Skills…","skills.status":"状态","skills.status.disabled":"已禁用","skills.title":"Skills","plugins.extensions":"扩展","plugins.agents":"智能体","plugins.mcp":"MCP","plugins.sections":"插件分类","plugins.skills":"Skills","plugins.title":"插件","plugins.tools":"工具","stats.accepted":"已接受：","stats.agreementRate":"总体同意率：","stats.api":"API","stats.apiTime":"API 耗时","stats.avgDuration":"平均耗时","stats.avgLatency":"平均延迟","stats.cached":"缓存","stats.cacheDesc":"的输入 Token 来自缓存，降低了成本。","stats.calls":"调用次数","stats.codeChanges":"代码变更","stats.decisionSummary":"用户决策摘要","stats.duration":"时长","stats.errors":"错误数","stats.inputTokens":"输入 Token","stats.metric":"指标","stats.modelStats":"模型统计（技术细节）","stats.modelTip":"提示：运行 /stats model 查看完整 Token 明细。","stats.modelUsage":"模型使用","stats.modified":"已修改：","stats.noApiCalls":"本次会话暂无 API 调用。","stats.noToolCalls":"本次会话暂无工具调用。","stats.outputTokens":"输出 Token","stats.overview":"会话概览","stats.performance":"性能","stats.prompts":"对话轮次","stats.rejected":"已拒绝：","stats.reqs":"请求","stats.requests":"请求数","stats.savingsHighlight":"节省亮点：","stats.successRate":"成功率","stats.thoughts":"思考","stats.title":"会话统计","stats.tokens":"Token","stats.toolCalls":"工具调用","stats.toolName":"工具名称","stats.toolStats":"工具统计（技术细节）","stats.toolTime":"工具耗时","stats.total":"总计","stats.totalReviewed":"已审核建议总数：","status.contextUsed":e=>`上下文已用 ${(e==null?void 0:e.pct)??"0.0"}%`,"status.disconnected":"断开连接","status.modeHint":"(shift + tab 或点击切换)","status.shortcuts":"? 查看快捷键","stream.cancel":"esc 取消","stream.cancelArmed":"再按一次 Esc 停止","stream.tokens":e=>`${(e==null?void 0:e.count)??0} tokens`,"theme.current":e=>`当前：${(e==null?void 0:e.theme)??""}`,"theme.auto":"自动","theme.dark":"暗色","theme.dark.desc":"仿终端暗色皮肤。","theme.light":"亮色","theme.light.desc":"仿终端亮色皮肤。","theme.title":"主题","todo.allDone":"任务已全部完成","todo.collapse":"折叠任务列表","todo.completedAbove":e=>`✓ 已完成 ${(e==null?void 0:e.count)??0} 项`,"todo.detail.api":"API","todo.detail.cached":"缓存","todo.detail.end":"结束","todo.detail.hide":"收起任务明细","todo.detail.input":"输入","todo.detail.noResources":"未采集到该任务的 Token 与耗时明细。","todo.detail.output":"输出","todo.detail.sectionSpent":"耗时","todo.detail.sectionTime":"时间","todo.detail.sectionTokens":"Token","todo.detail.show":"查看任务明细","todo.detail.start":"开始","todo.detail.tool":"工具","todo.expand":"展开任务列表","todo.more":e=>`... 还有 ${(e==null?void 0:e.count)??0} 项`,"todo.moreAbove":e=>`... 前面还有 ${(e==null?void 0:e.count)??0} 项`,"todo.showLess":"收起","todo.stepProgress":e=>`第 ${(e==null?void 0:e.current)??0} / ${(e==null?void 0:e.total)??0} 步`,"todo.stepFraction":e=>`${(e==null?void 0:e.current)??0} / ${(e==null?void 0:e.total)??0}`,"todo.title":"当前任务","chat.scrollToBottom":"回到底部","userMessage.showMore":"显示更多","userMessage.showLess":"收起","turn.processed":"已处理","turn.processing":"处理中","turn.collapse":"折叠步骤","turn.expand":"展开步骤","turn.cached":"缓存","turn.executionSteps":e=>`${(e==null?void 0:e.count)??0} 步`,"turn.toolCalls":e=>`工具 ${(e==null?void 0:e.count)??0} 次`,"turn.thinkingCount":e=>`思考 ${(e==null?void 0:e.count)??0} 次`,"turn.stopped":"你已取消请求","message.renderError":"此消息无法显示。","tasks.title":"后台任务","tasks.empty":"当前没有运行中的任务","tasks.refreshStale":"任务状态可能已过期，正在重连...","tasks.cancelFailed":"取消任务失败","tasks.alreadyStopped":"任务已停止","tasks.moreAbove":e=>`^ 上方还有 ${(e==null?void 0:e.count)??0} 个`,"tasks.moreBelow":e=>`v 下方还有 ${(e==null?void 0:e.count)??0} 个`,"tasks.running":"运行中","tasks.completed":"已完成","tasks.failed":"失败","tasks.cancelled":"已停止","tasks.paused":"已暂停","tasks.kind.shell":"Shell","tasks.kind.monitor":"监控","tasks.action.stop":"停止","tasks.action.abandon":"放弃","tasks.action.confirmStop":"确认停止","tasks.action.confirmAbandon":"确认放弃","tasks.action.confirmHint":"这会终结当前阻塞轮次。","tasks.pill.agent":e=>`${(e==null?void 0:e.count)??0} 个本地智能体`,"tasks.pill.agents":e=>`${(e==null?void 0:e.count)??0} 个本地智能体`,"tasks.pill.agentPaused":e=>`${(e==null?void 0:e.count)??0} 个本地智能体已暂停`,"tasks.pill.agentsPaused":e=>`${(e==null?void 0:e.count)??0} 个本地智能体已暂停`,"tasks.pill.done":e=>`${(e==null?void 0:e.count)??0} 个任务完成`,"tasks.pill.doneMany":e=>`${(e==null?void 0:e.count)??0} 个任务完成`,"tasks.pill.monitor":e=>`${(e==null?void 0:e.count)??0} 个监控`,"tasks.pill.monitors":e=>`${(e==null?void 0:e.count)??0} 个监控`,"tasks.pill.shell":e=>`${(e==null?void 0:e.count)??0} 个 shell`,"tasks.pill.shells":e=>`${(e==null?void 0:e.count)??0} 个 shell`,"tasks.confirmStop":"再按 x 确认停止 · 会终结当前阻塞轮次","tasks.shortcut.select":"↑/↓ 选择","tasks.shortcut.view":"Enter 查看","tasks.shortcut.stop":"x 停止","tasks.shortcut.abandon":"x 放弃","tasks.shortcut.listClose":"←/Esc 关闭","tasks.shortcut.detailBack":"← 返回","tasks.shortcut.detailClose":"Esc/Enter/Space 关闭","tasks.shortcut.close":"Esc 关闭","tasks.shortcut.cancelConfirm":"Esc 取消","tasks.detail.workingDir":"工作目录","tasks.detail.outputFile":"输出文件","tasks.detail.command":"命令","tasks.detail.events":e=>`${(e==null?void 0:e.count)??0} 个事件`,"tasks.detail.exit":e=>`退出码 ${(e==null?void 0:e.exitCode)??""}`,"tasks.detail.dropped":e=>`${(e==null?void 0:e.count)??0} 个已丢弃`,"tasks.detail.error":"错误","tasks.detail.stoppedBecause":"停止原因","tasks.detail.resumeBlocked":"恢复被阻止","tasks.detail.progress":"执行进度","tasks.detail.prompt":"提示词","tasks.detail.type":"类型","tasks.detail.runtime":"时间","tasks.detail.tokenCount":"Tokens","tasks.detail.toolCallCount":"工具数量","tasks.detail.tokens":e=>`${(e==null?void 0:e.count)??0} tokens`,"tasks.detail.toolCalls":e=>`${(e==null?void 0:e.count)??0} 次工具调用`,"tasks.detail.nesting":"嵌套","tasks.detail.nestingValue":e=>`第 ${(e==null?void 0:e.level)??"?"} 层 · 来自 ${(e==null?void 0:e.parent)??"?"}`,"tasks.detail.nestingLevel":e=>`第 ${(e==null?void 0:e.level)??"?"} 层`,"tasks.row.from":e=>`来自 ${(e==null?void 0:e.parent)??"?"}`,"tasks.row.nested":"嵌套","tips.items":"输入 / 查看所有可用命令。|使用 @ 引用文件路径。|按 Esc 取消正在进行的请求。|使用 Shift+Enter 换行。|按 ↑↓ 浏览历史消息。","tools.available":"可用工具:","tools.none":"没有可用工具。","tools.empty":"没有可用的内置工具。请先打开一个会话。","tools.footer":e=>e!=null&&e.name?`${e!=null&&e.details?"Enter/Space 查看详情 · ":""}t 切换 ${e.name} · r 刷新 · Esc 关闭`:"r 刷新 · Esc 关闭","tools.details.hide":"收起详情","tools.details.show":"展开详情","tools.description":"描述","tools.details":"工具详情","tools.loading":"正在加载工具...","tools.name":"工具名称","tools.noDescription":"暂无描述","tools.noMatches":"没有匹配的工具。","tools.search":"搜索工具…","tools.status":"状态","tools.status.disabled":"已禁用","tools.status.enabled":"已启用","tools.summary":e=>`${(e==null?void 0:e.enabled)??0}/${(e==null?void 0:e.total)??0} 已启用`,"tools.title":"工具","tools.update.disable":"禁用","tools.update.enable":"启用","tools.updating":"更新中...","tool.collapse":"▲ 收起","tool.expand":"展开","tool.collapseHint":"收起","tool.status.failed":"执行失败","toolGroup.moreKinds":e=>` +${(e==null?void 0:e.count)??0}`,"toolGroup.summary":e=>`调用了 ${(e==null?void 0:e.count)??0} 个工具`,"toolGroup.summary.editedFiles":e=>`已编辑 ${(e==null?void 0:e.count)??0} 个文件`,"toolGroup.summary.ranCommands":e=>`已运行 ${(e==null?void 0:e.count)??0} 条命令`,"toolGroup.summary.readFiles":e=>`已读取 ${(e==null?void 0:e.count)??0} 个文件`,"toolGroup.summary.searched":e=>`已搜索 ${(e==null?void 0:e.count)??0} 次`,"toolGroup.summary.updatedTodos":e=>Number((e==null?void 0:e.count)??0)>1?`已更新任务清单 ${(e==null?void 0:e.count)??0} 次`:"已更新任务清单","toolGroup.summary.askedUser":"已询问用户","toolGroup.summary.otherTools":e=>`调用了 ${(e==null?void 0:e.count)??0} 个工具`,"toolGroup.running":e=>`正在执行 ${(e==null?void 0:e.name)??"工具"}${e!=null&&e.duration?` ${e.duration}`:""}${Number((e==null?void 0:e.count)??0)>1?` · 共 ${(e==null?void 0:e.count)??0} 个工具`:""}`,"toolGroup.runningPrefix":"正在执行","thinking.expand":"展开思考","thinking.collapse":"收起思考","thinking.running":e=>`正在思考${e!=null&&e.duration?` ${e.duration}`:""}`,"thinking.doneBriefly":"思考片刻","thinking.done":e=>e!=null&&e.duration?`已思考 ${e.duration}`:"思考完成","welcome.changeModel":"(/model 切换)","welcome.defaultModel":"未知模型","sessionsOverview.count":e=>`${(e==null?void 0:e.count)??0} 个会话`,"sessionsOverview.current":"当前","sessionsOverview.empty":"暂无会话","sessionsOverview.loadFailed":"加载会话失败","sessionsOverview.loading":"正在加载会话…","sessionsOverview.openElsewhere":"已在其他窗口打开","sessionsOverview.openInSplit":"打开到分屏","sessionsOverview.openInSplitHint":"在本窗口内并排显示选中的会话","sessionsOverview.openInTab":"在新标签页打开","sessionsOverview.openInTabHint":"在新标签页中以分屏并排打开选中的会话","sessionsOverview.popupBlocked":"弹出窗口被拦截。请允许本站弹窗，以便在新标签页中打开会话。","sessionsOverview.refresh":"刷新","sessionsOverview.selectAll":"全选","sessionsOverview.splitCap":e=>`只有前 ${(e==null?void 0:e.max)??6} 个选中的会话会进入分屏。`,"sessionsOverview.selectSession":e=>`选择 ${(e==null?void 0:e.name)??""}`,"sessionsOverview.status.idle":"空闲","sessionsOverview.status.needsApproval":"待审批","sessionsOverview.status.running":"运行中","sessionsOverview.title":"会话总览","splitView.title":"分屏","splitView.count":e=>`${(e==null?void 0:e.count)??0} 个窗格`,"splitView.addPane":"添加会话","splitView.closePane":"关闭窗格","splitView.paneError":"此会话窗格出错","splitView.paneConnectionError":"连接已断开","splitView.outerApprovalPending":"主会话正在等待审批。","splitView.goToApproval":"前往处理","splitView.empty":"分屏中还没有会话，添加一个开始。","splitView.composerPlaceholder":"给这个会话发消息…","settings.title":"设置","settings.loading":"正在加载设置...","settings.empty":"暂无可用设置。","settings.footer":"↑↓ 导航  Enter 切换  Tab 切换作用域  r 刷新  ESC 关闭","settings.footer.edit":"Enter 保存  ESC 取消","settings.footer.theme":"↑↓ 导航  Enter 选择  ESC 返回","settings.scope.user":"用户","settings.scope.workspace":"工作区","settings.value.on":"开","settings.value.off":"关","settings.action.edit":"编辑","settings.action.select":"选择","settings.action.save":"保存","settings.modifiedIn":e=>`（已在${(e==null?void 0:e.scope)??""}中修改）`,"settings.alsoModifiedIn":e=>`（同时在${(e==null?void 0:e.scope)??""}中修改）`,"settings.invalidNumber":"无效数字","settings.requiresRestart":"此更改需要重启后才能生效。","settings.models.title":"模型","settings.models.add":"+ 增加模型","settings.models.setCurrent":"设为当前","settings.models.current":"当前","settings.models.runtime":"运行时","settings.models.delete":"删除","settings.models.confirmDelete":"确认删除","settings.models.cancel":"取消","settings.models.empty":"暂无配置的模型。","settings.models.loading":"正在加载模型…","settings.models.deleteFailed":"删除模型失败","settings.models.fallbacks.title":"模型回退","settings.models.fallbacks.hint":e=>`最多选择 ${(e==null?void 0:e.max)??3} 个；主模型容量不足时按顺序回退。`,"settings.models.fallbacks.confirm":"确认","settings.models.fallbacks.empty":"暂无可选模型。","settings.models.fallbacks.saveFailed":"保存回退模型失败","settings.models.fallbacks.limitReached":e=>`最多可选 ${(e==null?void 0:e.max)??3} 个回退模型；请先取消一个再选择其他。`,"settings.corrupted":e=>`设置文件已损坏${(e==null?void 0:e.recovered)==="true"?"（已从备份恢复）":""}`,"settings.label.ui.chatWidth":"屏宽","settings.description.ui.chatWidth":"纯前端的聊天内容宽度设置，保存在当前浏览器中。","settings.option.ui.chatWidth.1000":"常规","settings.option.ui.chatWidth.wide":"超宽","settings.category.General":"通用","settings.category.UI":"界面","settings.category.Privacy":"隐私","settings.category.Model":"模型","settings.category.Context":"上下文","settings.category.Tools":"工具","settings.category.Daemon":"守护进程","settings.category.Experimental":"实验性","settings.category.Advanced":"高级","settings.label.general.enableAutoUpdate":"启用自动更新","settings.description.general.enableAutoUpdate":"启动时自动检查并安装更新。","settings.label.general.showSessionRecap":"显示会话回顾","settings.description.general.showSessionRecap":"离开终端一段时间后返回时，自动显示一行“上次停在这里”的回顾。默认关闭。也可以随时使用 /recap 手动触发。","settings.label.general.sessionRecapAwayThresholdMinutes":"会话回顾离开阈值（分钟）","settings.description.general.sessionRecapAwayThresholdMinutes":"终端失焦多少分钟后，下一次重新聚焦时触发自动回顾。默认与 Claude Code 一致为 5 分钟；如果只是短暂切换窗口，可以调高。","settings.label.general.cleanupPeriodDays":"清理周期（天）","settings.description.general.cleanupPeriodDays":"~/.qwen/file-history/ 中用于 /rewind 的会话备份保留天数。后台清理最多每天运行一次。设为 0 表示最小保留（约 1 小时），仍会保护最近一小时触碰过的会话和当前活动会话。","settings.label.general.gitCoAuthor.commit":"归因：commit","settings.description.general.gitCoAuthor.commit":"通过 Qwen Code 创建 commit 时，添加 Co-authored-by trailer，并写入逐文件 AI 归因 git note。关闭后两者都会跳过。","settings.label.general.gitCoAuthor.pr":"归因：PR","settings.description.general.gitCoAuthor.pr":"运行 gh pr create 时，在 PR 描述中追加 Qwen Code 归因行。","settings.label.general.language":"语言：界面","settings.description.general.language":"用户界面的语言。使用 auto 可根据系统设置自动检测；也可以在 ~/.qwen/locales/ 中放置 JS 语言文件来使用自定义语言代码。","settings.label.general.dynamicCommandTranslation":"语言：动态命令翻译","settings.description.general.dynamicCommandTranslation":"为动态 slash command 描述启用 AI 翻译。关闭后动态命令使用原始描述，也不会触发翻译模型调用。","settings.label.general.preventSystemSleep":"运行时防止系统睡眠","settings.description.general.preventSystemSleep":"当 Qwen Code 正在流式生成模型回复或执行工具时防止系统睡眠。空闲输入状态和权限确认状态不会阻止睡眠。","settings.label.ui.theme":"主题","settings.description.ui.theme":"界面的颜色主题。","settings.label.ui.hideTips":"隐藏提示","settings.description.ui.hideTips":"隐藏界面中的帮助提示。","settings.label.ui.enableWelcomeBack":"显示欢迎回来对话框","settings.description.ui.enableWelcomeBack":"回到有历史会话的项目时显示欢迎回来对话框。选择“开始新的聊天会话”后，在项目摘要变化前不会再次显示。","settings.label.ui.enableUserFeedback":"启用用户反馈","settings.description.ui.enableUserFeedback":"对话结束后显示可选反馈对话框，帮助改进 Qwen 表现。","settings.label.ui.enableFollowupSuggestions":"启用后续建议","settings.description.ui.enableFollowupSuggestions":"任务完成后显示上下文相关的后续建议。按 Tab 或右方向键接受，按 Enter 接受并提交。","settings.label.ui.compactMode":"紧凑模式","settings.description.ui.compactMode":"隐藏工具输出和思考内容，显示更简洁的视图（可用 Ctrl+O 切换）。","settings.label.ui.compactInline":"紧凑内联","settings.description.ui.compactInline":"在每个分组内紧凑显示工具内容，而不是跨分组合并。需要先启用紧凑模式。","settings.label.ui.shellOutputMaxLines":"Shell 输出最大行数","settings.description.ui.shellOutputMaxLines":"内联显示的 shell 输出最大行数。设为 0 可取消限制并显示完整输出；隐藏行数仍会通过 +N lines 指示器展示。","settings.label.privacy.usageStatisticsEnabled":"启用使用统计","settings.description.privacy.usageStatisticsEnabled":"启用使用统计收集。","settings.label.fastModel":"快速模型","settings.description.fastModel":"用于生成提示建议和推测执行的模型。留空则使用主模型。较小/更快的模型（例如 qwen3-coder-flash）可以降低延迟和成本。","settings.label.visionModel":"视觉模型","settings.description.visionModel":"用于视觉桥接的图像能力模型。留空则自动选择。","settings.label.context.fileFiltering.respectGitIgnore":"遵守 .gitignore","settings.description.context.fileFiltering.respectGitIgnore":"搜索时遵守 .gitignore 文件。","settings.label.context.fileFiltering.respectQwenIgnore":"遵守 .qwenignore","settings.description.context.fileFiltering.respectQwenIgnore":"搜索时遵守 .qwenignore 文件。","settings.label.context.fileFiltering.enableFuzzySearch":"启用模糊搜索","settings.description.context.fileFiltering.enableFuzzySearch":"搜索文件时启用模糊搜索。","settings.label.tools.toolSearch.enabled":"启用 ToolSearch","settings.description.tools.toolSearch.enabled":"启用后，MCP 工具会通过 ToolSearch 按需加载，以减少提示词大小。对于依赖前缀 KV 缓存的模型（如 DeepSeek），可关闭此项来保持提示词前缀稳定并提高缓存命中率。","settings.label.tools.shell.enableInteractiveShell":"交互式 Shell（PTY）","settings.description.tools.shell.enableInteractiveShell":"使用 node-pty 提供交互式 shell 体验。PTY 不可用时回退到 child_process。","settings.label.tools.computerUse.enabled":"启用 Computer Use","settings.description.tools.computerUse.enabled":"启用后（默认），会注册 9 个 computer_use__* 延迟内置工具。","settings.label.policy.permissionStrategy":"权限协调策略","settings.description.policy.permissionStrategy":"多个客户端连接时权限请求的决策方式。first-responder 表示任意客户端先响应者生效；designated 表示仅提示发起方决策；consensus 表示需要 N-of-M 投票同意；local-only 表示只有 loopback 客户端可决策。需要重启 daemon 后生效。","settings.option.policy.permissionStrategy.first-responder":"先响应者","settings.option.policy.permissionStrategy.designated":"指定发起方","settings.option.policy.permissionStrategy.consensus":"共识法定人数","settings.option.policy.permissionStrategy.local-only":"仅本机","settings.label.experimental.enableCronTools":"启用 Cron/Loop 工具","settings.description.experimental.enableCronTools":"启用会话内 cron/loop 工具（实验性）。启用后，模型可以用 cron_create、cron_list 和 cron_delete 创建周期性提示。也可通过 QWEN_CODE_ENABLE_CRON=1 环境变量启用。","settings.label.experimental.emitToolUseSummaries":"工具使用摘要","settings.description.experimental.emitToolUseSummaries":"每个工具批次完成后生成一个简短的 LLM 标签。紧凑模式下会替代通用的 Tool × N 标题；完整模式下显示为工具组下方的弱化 ● <label> 行。需要配置快速模型。","settings.label.agents.arena.preserveArtifacts":"保留 Arena 产物","settings.description.agents.arena.preserveArtifacts":"启用后，Arena worktree 和会话状态文件会在会话结束或主智能体退出后保留。","welcome.modeHint":"Shift+Tab 或 /approval-mode","welcome.prompt":"你想构建什么？","welcome.titlePrefix":"欢迎使用","welcome.tipLabel":"提示："},Vde={en:qE,"zh-CN":Ude},Wde={en:"English [en]","zh-CN":"中文 [zh-CN]"},MU=m.createContext({language:"en",t:e=>e});function Tu(e){const t=e==null?void 0:e.trim().toLowerCase();return t&&(t==="zh"||t==="zh-cn"||t==="zh_cn")?"zh-CN":"en"}function HE(e){if(typeof e!="string")return;const t=e.trim().toLowerCase().replace(/_/g,"-");if(t){if(t==="auto")return Tu(typeof navigator<"u"?navigator.language:void 0);if(t==="zh"||t==="zh-cn"||t==="chinese"||t==="中文")return"zh-CN";if(t==="en"||t==="en-us"||t==="english")return"en"}}function UE(e){return Wde[e]}function VE(e){const t=Vde[e];return(n,s)=>{const r=t[n]??qE[n]??n;return typeof r=="function"?r(s):r}}function Gde({language:e,children:t}){const n=m.useMemo(()=>({language:e,t:VE(e)}),[e]);return u.jsx(MU.Provider,{value:n,children:t})}function ot(){return m.useContext(MU)}const NU=m.createContext(null);function bm(){return m.useContext(NU)}const Kde="_row_19m4s_1",Yde="_tip_19m4s_13",Xde="_chatRow_19m4s_35",Qde="_chatTip_19m4s_43",Jde="_chatActions_19m4s_56",Zde="_copyButton_19m4s_71",gd={row:Kde,tip:Yde,chatRow:Xde,chatTip:Qde,chatActions:Jde,copyButton:Zde};function J6({timestamp:e,children:t,chatMode:n=!1,copyText:s,copyTitle:r="Copy"}){const[i,o]=m.useState(!1),a=m.useCallback(()=>{var c;s&&((c=navigator.clipboard)==null||c.writeText(s).then(()=>{o(!0),window.setTimeout(()=>o(!1),2e3)}).catch(()=>{}))},[s]);if(e===void 0&&!s)return u.jsx(u.Fragment,{children:t});const l=s?u.jsx("button",{type:"button",className:gd.copyButton,title:r,"aria-label":r,onClick:a,children:i?u.jsx(the,{}):u.jsx(ehe,{})}):null;return e===void 0?u.jsxs("div",{className:n?gd.chatRow:gd.row,children:[t,l]}):u.jsxs("div",{className:n?gd.chatRow:gd.row,children:[t,n?u.jsxs("span",{className:gd.chatActions,children:[u.jsx("span",{className:gd.chatTip,"aria-hidden":"true",children:y0(e)}),l]}):u.jsx("span",{className:gd.tip,"aria-hidden":"true",children:y0(e)})]})}function ehe(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("path",{d:"M5.2 4.4V3.2c0-.7.5-1.2 1.2-1.2h5.4c.7 0 1.2.5 1.2 1.2v5.4c0 .7-.5 1.2-1.2 1.2h-1.2",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.3"}),u.jsx("rect",{x:"3",y:"5.2",width:"7.8",height:"7.8",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]})}function the(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"m3.5 8.3 3 3L12.8 5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function y0(e,t=new Date){const n=new Date(e),s=o=>String(o).padStart(2,"0"),r=`${s(n.getHours())}:${s(n.getMinutes())}:${s(n.getSeconds())}`;return n.getFullYear()===t.getFullYear()&&n.getMonth()===t.getMonth()&&n.getDate()===t.getDate()?r:`${n.getFullYear()}-${s(n.getMonth()+1)}-${s(n.getDate())} ${r}`}const nhe="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2016%2016'%3e%3crect%20x='1.2'%20y='8.8'%20width='6'%20height='6'%20stroke='currentColor'%20stroke-width='1.2'%20/%3e%3crect%20x='1.2'%20y='2.8'%20width='6'%20height='6'%20stroke='currentColor'%20stroke-width='1.2'%20/%3e%3cg%20transform='matrix(0.86602545%200.50000006%20-0.50000006%200.86602545%202.21032266%20-5.24903863)'%3e%3crect%20x='10.9'%20y='1.5'%20width='4.3'%20height='4.3'%20stroke='currentColor'%20stroke-width='1.2'%20/%3e%3c/g%3e%3crect%20x='7.2'%20y='8.8'%20width='6'%20height='6'%20stroke='currentColor'%20stroke-width='1.2'%20/%3e%3c/svg%3e",she="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2020%2020'%3e%3cpath%20d='M18%2018V5H9.5L7.5%202H2L2%2018H5M18%2018H5M18%2018V8.5H5V18'%20stroke='currentColor'%20stroke-linecap='square'/%3e%3c/svg%3e",rhe="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2016%2016'%3e%3cpath%20d='M5.4%201.2v3.2M10.6%201.2v3.2M3.8%204.4h8.4v2.2a4.2%204.2%200%200%201-4.2%204.2%204.2%204.2%200%200%201-4.2-4.2V4.4ZM8%2011v3.8'%20stroke='currentColor'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",ihe="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2016%2016'%3e%3cpath%20d='M9.333333480718995,0.4848014130697632L8.909069580718995,0.9090693330697632L8.666668880718994,1.1514702030697632L7.818136680718994,2.000002323069763L6.000002380718994,3.8181367730697633L4.909069780718994,4.909069373069763L4.484801580718994,5.333333373069763L5.333333480718994,6.181865073069763L5.757597480718994,5.757597373069763L6.002225380718994,5.5129693730697635Q6.399448880718994,5.902126173069763,6.835733380718994,6.315723273069763L0.6516202707189941,12.497309373069763L3.5001483807189944,15.345837373069763L9.749393980718994,9.099145273069762L10.000080580718993,9.349833873069763L10.848612280718994,8.501302173069764L10.424344580718994,8.077038173069763Q9.527247880718994,7.179941973069763,8.407596580718995,6.143646073069763Q7.564285280718994,5.3631170730697635,6.850798580718994,4.664396173069763L8.666666480718995,2.848528273069763L13.151472080718994,7.333333873069763L10.242402580718995,10.242403373069763L9.818134780718994,10.666667373069764L10.666666480718995,11.515199373069763L11.090930480718994,11.090931273069764L13.999998080718994,8.181864173069762L14.848531080718994,7.333333373069763L15.090931080718994,7.090931273069764L15.515198080718994,6.666666873069763L14.666666080718993,5.818134673069763L14.242402080718994,6.242402873069763L14.000000080718994,6.484805973069763L9.515194380718993,2.0000002430697634L9.757597480718994,1.7575974430697632L10.181865180718994,1.3333333730697632L9.333333480718995,0.4848014130697632ZM8.895271280718994,8.256209773069763Q8.340813180718994,7.719207673069763,7.712720380718994,7.1358045730697635L2.348849830718994,12.497482373069763L3.5003215807189942,13.648954373069763L8.895271280718994,8.256209773069763Z'%20fill-rule='evenodd'%20fill='currentColor'/%3e%3c/svg%3e",IU={extension:nhe,file:she,mcp:rhe,skill:ihe};function Z6(e,t){if(!e||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return typeof n=="string"?n:void 0}function RU(e){var t,n,s;return((t=e.serialized)==null?void 0:t.trim())||((n=e.value)==null?void 0:n.trim())||((s=e.label)==null?void 0:s.trim())||e.id}function vm(e,t){if(e)return Z6(t,e)??Z6(IU,e)}function ohe(e,t){const n=[];let s=0;for(const r of t){const i=RU(r);if(!i)continue;const o=e.indexOf(i,s);if(o<0)continue;const a=o+i.length;n.push({type:"reference",start:o,end:a,text:i,reference:{id:r.id,...r.kind?{kind:r.kind}:{},...r.label?{label:r.label}:{},...r.value?{value:r.value}:{},...r.serialized?{serialized:r.serialized}:{},...r.removable!==void 0?{removable:r.removable}:{}}}),s=a}return n}function ahe(e,t){if(!t||t.length===0)return[{type:"text",text:e}];const n=[];let s=0;for(const r of t){if(r.type!=="reference")continue;const{start:i,end:o,text:a}=r,l=r.reference;!l||typeof l.id!="string"||i<s||o<=i||o>e.length||e.slice(i,o)!==a||(s<i&&n.push({type:"text",text:e.slice(s,i)}),n.push({type:"reference",tag:{id:l.id,...l.kind?{kind:l.kind}:{},...l.label?{label:l.label}:{},...l.value?{value:l.value}:{},serialized:l.serialized??a,...l.removable!==void 0?{removable:l.removable}:{}}}),s=o)}return s<e.length&&n.push({type:"text",text:e.slice(s)}),n.length>0?n:[{type:"text",text:e}]}function lhe(e,t){var i,o;const n=((i=e.label)==null?void 0:i.trim())??"",s=((o=e.value)==null?void 0:o.trim())??"";return{tagLabel:(e.kind?Z6(IU,e.kind):void 0)?"":n,tagValue:s,fallback:e.id,iconUrl:vm(e.kind,t)}}const che="modulepreload",uhe=function(e){return"/"+e},Sj={},J=function(t,n,s){let r=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));r=Promise.allSettled(n.map(l=>{if(l=uhe(l),l in Sj)return;Sj[l]=!0;const c=l.endsWith(".css"),d=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${d}`))return;const h=document.createElement("link");if(h.rel=c?"stylesheet":che,c||(h.as="script"),h.crossOrigin="",h.href=l,a&&h.setAttribute("nonce",a),document.head.appendChild(h),c)return new Promise((f,p)=>{h.addEventListener("load",f),h.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${l}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return r.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return t().catch(i)})},gr={Dark:"dark",Light:"light"},jU=[gr.Dark,gr.Light],LU=m.createContext(gr.Dark),dhe=LU.Provider;function V0(){return m.useContext(LU)}const Tf="ui.theme",Ek="general.language";function WE(e,t){return e===gr.Light||e==="Qwen Light"?gr.Light:e===gr.Dark||e==="Qwen Dark"?gr.Dark:t}function DU(e){return e===gr.Light?"Qwen Light":"Qwen Dark"}function Cj(e){const t=[],n=String(e||"");let s=n.indexOf(","),r=0,i=!1;for(;!i;){s===-1&&(s=n.length,i=!0);const o=n.slice(r,s).trim();(o||!i)&&t.push(o),r=s+1,s=n.indexOf(",",r)}return t}function OU(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const hhe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,fhe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,mhe={};function Tj(e,t){return(mhe.jsx?fhe:hhe).test(e)}const phe=/[ \t\n\f\r]/g;function w_(e){return typeof e=="object"?e.type==="text"?Ej(e.value):!1:Ej(e)}function Ej(e){return e.replace(phe,"")===""}class vb{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}vb.prototype.normal={};vb.prototype.property={};vb.prototype.space=void 0;function PU(e,t){const n={},s={};for(const r of e)Object.assign(n,r.property),Object.assign(s,r.normal);return new vb(n,s,t)}function vy(e){return e.toLowerCase()}class la{constructor(t,n){this.attribute=n,this.property=t}}la.prototype.attribute="";la.prototype.booleanish=!1;la.prototype.boolean=!1;la.prototype.commaOrSpaceSeparated=!1;la.prototype.commaSeparated=!1;la.prototype.defined=!1;la.prototype.mustUseProperty=!1;la.prototype.number=!1;la.prototype.overloadedBoolean=!1;la.prototype.property="";la.prototype.spaceSeparated=!1;la.prototype.space=void 0;let ghe=0;const Dn=wm(),li=wm(),eT=wm(),ht=wm(),ir=wm(),Ff=wm(),ba=wm();function wm(){return 2**++ghe}const tT=Object.freeze(Object.defineProperty({__proto__:null,boolean:Dn,booleanish:li,commaOrSpaceSeparated:ba,commaSeparated:Ff,number:ht,overloadedBoolean:eT,spaceSeparated:ir},Symbol.toStringTag,{value:"Module"})),k3=Object.keys(tT);class GE extends la{constructor(t,n,s,r){let i=-1;if(super(t,n),Aj(this,"space",r),typeof s=="number")for(;++i<k3.length;){const o=k3[i];Aj(this,k3[i],(s&tT[o])===tT[o])}}}GE.prototype.defined=!0;function Aj(e,t,n){n&&(e[t]=n)}function W0(e){const t={},n={};for(const[s,r]of Object.entries(e.properties)){const i=new GE(s,e.transform(e.attributes||{},s),r,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(i.mustUseProperty=!0),t[s]=i,n[vy(s)]=s,n[vy(i.attribute)]=s}return new vb(t,n,e.space)}const BU=W0({properties:{ariaActiveDescendant:null,ariaAtomic:li,ariaAutoComplete:null,ariaBusy:li,ariaChecked:li,ariaColCount:ht,ariaColIndex:ht,ariaColSpan:ht,ariaControls:ir,ariaCurrent:null,ariaDescribedBy:ir,ariaDetails:null,ariaDisabled:li,ariaDropEffect:ir,ariaErrorMessage:null,ariaExpanded:li,ariaFlowTo:ir,ariaGrabbed:li,ariaHasPopup:null,ariaHidden:li,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ir,ariaLevel:ht,ariaLive:null,ariaModal:li,ariaMultiLine:li,ariaMultiSelectable:li,ariaOrientation:null,ariaOwns:ir,ariaPlaceholder:null,ariaPosInSet:ht,ariaPressed:li,ariaReadOnly:li,ariaRelevant:null,ariaRequired:li,ariaRoleDescription:ir,ariaRowCount:ht,ariaRowIndex:ht,ariaRowSpan:ht,ariaSelected:li,ariaSetSize:ht,ariaSort:null,ariaValueMax:ht,ariaValueMin:ht,ariaValueNow:ht,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function $U(e,t){return t in e?e[t]:t}function zU(e,t){return $U(e,t.toLowerCase())}const yhe=W0({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ff,acceptCharset:ir,accessKey:ir,action:null,allow:null,allowFullScreen:Dn,allowPaymentRequest:Dn,allowUserMedia:Dn,alpha:Dn,alt:null,as:null,async:Dn,autoCapitalize:null,autoComplete:ir,autoFocus:Dn,autoPlay:Dn,blocking:ir,capture:null,charSet:null,checked:Dn,cite:null,className:ir,closedBy:null,colorSpace:null,cols:ht,colSpan:ht,command:null,commandFor:null,content:null,contentEditable:li,controls:Dn,controlsList:ir,coords:ht|Ff,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Dn,defer:Dn,dir:null,dirName:null,disabled:Dn,download:eT,draggable:li,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Dn,formTarget:null,headers:ir,height:ht,hidden:eT,high:ht,href:null,hrefLang:null,htmlFor:ir,httpEquiv:ir,id:null,imageSizes:null,imageSrcSet:null,inert:Dn,inputMode:null,integrity:null,is:null,isMap:Dn,itemId:null,itemProp:ir,itemRef:ir,itemScope:Dn,itemType:ir,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Dn,low:ht,manifest:null,max:null,maxLength:ht,media:null,method:null,min:null,minLength:ht,multiple:Dn,muted:Dn,name:null,nonce:null,noModule:Dn,noValidate:Dn,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:Dn,optimum:ht,pattern:null,ping:ir,placeholder:null,playsInline:Dn,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Dn,referrerPolicy:null,rel:ir,required:Dn,reversed:Dn,rows:ht,rowSpan:ht,sandbox:ir,scope:null,scoped:Dn,seamless:Dn,selected:Dn,shadowRootClonable:Dn,shadowRootCustomElementRegistry:Dn,shadowRootDelegatesFocus:Dn,shadowRootMode:null,shadowRootSerializable:Dn,shape:null,size:ht,sizes:null,slot:null,span:ht,spellCheck:li,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ht,step:null,style:null,tabIndex:ht,target:null,title:null,translate:null,type:null,typeMustMatch:Dn,useMap:null,value:li,width:ht,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ir,axis:null,background:null,bgColor:null,border:ht,borderColor:null,bottomMargin:ht,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Dn,declare:Dn,event:null,face:null,frame:null,frameBorder:null,hSpace:ht,leftMargin:ht,link:null,longDesc:null,lowSrc:null,marginHeight:ht,marginWidth:ht,noResize:Dn,noHref:Dn,noShade:Dn,noWrap:Dn,object:null,profile:null,prompt:null,rev:null,rightMargin:ht,rules:null,scheme:null,scrolling:li,standby:null,summary:null,text:null,topMargin:ht,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ht,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Dn,disablePictureInPicture:Dn,disableRemotePlayback:Dn,exportParts:Ff,part:ir,prefix:null,property:null,results:ht,security:null,unselectable:null},space:"html",transform:zU}),bhe=W0({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:ba,accentHeight:ht,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ht,amplitude:ht,arabicForm:null,ascent:ht,attributeName:null,attributeType:null,azimuth:ht,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ht,by:null,calcMode:null,capHeight:ht,className:ir,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:ht,diffuseConstant:ht,direction:null,display:null,dur:null,divisor:ht,dominantBaseline:null,download:Dn,dx:null,dy:null,edgeMode:null,editable:null,elevation:ht,enableBackground:null,end:null,event:null,exponent:ht,externalResourcesRequired:null,fill:null,fillOpacity:ht,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:Ff,g2:Ff,glyphName:Ff,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ht,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ht,horizOriginX:ht,horizOriginY:ht,id:null,ideographic:ht,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ht,k:ht,k1:ht,k2:ht,k3:ht,k4:ht,kernelMatrix:ba,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ht,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:ht,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:ht,overlineThickness:ht,paintOrder:null,panose1:null,path:null,pathLength:ht,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ir,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ht,pointsAtY:ht,pointsAtZ:ht,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ba,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ba,rev:ba,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ba,requiredFeatures:ba,requiredFonts:ba,requiredFormats:ba,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:ht,specularExponent:ht,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ht,strikethroughThickness:ht,string:null,stroke:null,strokeDashArray:ba,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ht,strokeOpacity:ht,strokeWidth:null,style:null,surfaceScale:ht,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ba,tabIndex:ht,tableValues:null,target:null,targetX:ht,targetY:ht,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ba,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ht,underlineThickness:ht,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ht,values:null,vAlphabetic:ht,vMathematical:ht,vectorEffect:null,vHanging:ht,vIdeographic:ht,version:null,vertAdvY:ht,vertOriginX:ht,vertOriginY:ht,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ht,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:$U}),FU=W0({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),qU=W0({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:zU}),HU=W0({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),vhe={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"},whe=/[A-Z]/g,Mj=/-[a-z]/g,xhe=/^data[-\w.:]+$/i;function KE(e,t){const n=vy(t);let s=t,r=la;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&xhe.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(Mj,_he);s="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!Mj.test(i)){let o=i.replace(whe,khe);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}r=GE}return new r(s,t)}function khe(e){return"-"+e.toLowerCase()}function _he(e){return e.charAt(1).toUpperCase()}const YE=PU([BU,yhe,FU,qU,HU],"html"),G0=PU([BU,bhe,FU,qU,HU],"svg");function Nj(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function UU(e){return e.join(" ").trim()}var XE={},Ij=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,She=/\n/g,Che=/^\s*/,The=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Ehe=/^:\s*/,Ahe=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Mhe=/^[;\s]*/,Nhe=/^\s+|\s+$/g,Ihe=`
`,Rj="/",jj="*",wf="",Rhe="comment",jhe="declaration";function Lhe(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,s=1;function r(g){var y=g.match(She);y&&(n+=y.length);var w=g.lastIndexOf(Ihe);s=~w?g.length-w:s+g.length}function i(){var g={line:n,column:s};return function(y){return y.position=new o(g),c(),y}}function o(g){this.start=g,this.end={line:n,column:s},this.source=t.source}o.prototype.content=e;function a(g){var y=new Error(t.source+":"+n+":"+s+": "+g);if(y.reason=g,y.filename=t.source,y.line=n,y.column=s,y.source=e,!t.silent)throw y}function l(g){var y=g.exec(e);if(y){var w=y[0];return r(w),e=e.slice(w.length),y}}function c(){l(Che)}function d(g){var y;for(g=g||[];y=h();)y!==!1&&g.push(y);return g}function h(){var g=i();if(!(Rj!=e.charAt(0)||jj!=e.charAt(1))){for(var y=2;wf!=e.charAt(y)&&(jj!=e.charAt(y)||Rj!=e.charAt(y+1));)++y;if(y+=2,wf===e.charAt(y-1))return a("End of comment missing");var w=e.slice(2,y-2);return s+=2,r(w),e=e.slice(y),s+=2,g({type:Rhe,comment:w})}}function f(){var g=i(),y=l(The);if(y){if(h(),!l(Ehe))return a("property missing ':'");var w=l(Ahe),v=g({type:jhe,property:Lj(y[0].replace(Ij,wf)),value:w?Lj(w[0].replace(Ij,wf)):wf});return l(Mhe),v}}function p(){var g=[];d(g);for(var y;y=f();)y!==!1&&(g.push(y),d(g));return g}return c(),p()}function Lj(e){return e?e.replace(Nhe,wf):wf}var Dhe=Lhe,Ohe=Ux&&Ux.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(XE,"__esModule",{value:!0});XE.default=Bhe;const Phe=Ohe(Dhe);function Bhe(e,t){let n=null;if(!e||typeof e!="string")return n;const s=(0,Phe.default)(e),r=typeof t=="function";return s.forEach(i=>{if(i.type!=="declaration")return;const{property:o,value:a}=i;r?t(o,a,i):a&&(n=n||{},n[o]=a)}),n}var x_={};Object.defineProperty(x_,"__esModule",{value:!0});x_.camelCase=void 0;var $he=/^--[a-zA-Z0-9_-]+$/,zhe=/-([a-z])/g,Fhe=/^[^-]+$/,qhe=/^-(webkit|moz|ms|o|khtml)-/,Hhe=/^-(ms)-/,Uhe=function(e){return!e||Fhe.test(e)||$he.test(e)},Vhe=function(e,t){return t.toUpperCase()},Dj=function(e,t){return"".concat(t,"-")},Whe=function(e,t){return t===void 0&&(t={}),Uhe(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(Hhe,Dj):e=e.replace(qhe,Dj),e.replace(zhe,Vhe))};x_.camelCase=Whe;var Ghe=Ux&&Ux.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Khe=Ghe(XE),Yhe=x_;function nT(e,t){var n={};return!e||typeof e!="string"||(0,Khe.default)(e,function(s,r){s&&r&&(n[(0,Yhe.camelCase)(s,t)]=r)}),n}nT.default=nT;var Xhe=nT;const Qhe=W2(Xhe),VU=WU("end"),QE=WU("start");function WU(e){return t;function t(n){const s=n&&n.position&&n.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function Jhe(e){const t=QE(e),n=VU(e);if(t&&n)return{start:t,end:n}}function q1(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Oj(e.position):"start"in e||"end"in e?Oj(e):"line"in e||"column"in e?sT(e):""}function sT(e){return Pj(e&&e.line)+":"+Pj(e&&e.column)}function Oj(e){return sT(e&&e.start)+"-"+sT(e&&e.end)}function Pj(e){return e&&typeof e=="number"?e:1}class vo extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let r="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?r=t:!i.cause&&t&&(o=!0,r=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof s=="string"){const l=s.indexOf(":");l===-1?i.ruleId=s:(i.source=s.slice(0,l),i.ruleId=s.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const a=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=a?a.line:void 0,this.name=q1(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}vo.prototype.file="";vo.prototype.name="";vo.prototype.reason="";vo.prototype.message="";vo.prototype.stack="";vo.prototype.column=void 0;vo.prototype.line=void 0;vo.prototype.ancestors=void 0;vo.prototype.cause=void 0;vo.prototype.fatal=void 0;vo.prototype.place=void 0;vo.prototype.ruleId=void 0;vo.prototype.source=void 0;const JE={}.hasOwnProperty,Zhe=new Map,efe=/[A-Z]/g,tfe=new Set(["table","tbody","thead","tfoot","tr"]),nfe=new Set(["td","th"]),GU="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function sfe(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=dfe(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=ufe(n,t.jsx,t.jsxs)}const r={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?G0:YE,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=KU(r,e,void 0);return i&&typeof i!="string"?i:r.create(e,r.Fragment,{children:i||void 0},void 0)}function KU(e,t,n){if(t.type==="element")return rfe(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return ife(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return afe(e,t,n);if(t.type==="mdxjsEsm")return ofe(e,t);if(t.type==="root")return lfe(e,t,n);if(t.type==="text")return cfe(e,t)}function rfe(e,t,n){const s=e.schema;let r=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(r=G0,e.schema=r),e.ancestors.push(t);const i=XU(e,t.tagName,!1),o=hfe(e,t);let a=eA(e,t);return tfe.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!w_(l):!0})),YU(e,o,i,t),ZE(o,a),e.ancestors.pop(),e.schema=s,e.create(t,i,o,n)}function ife(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}wy(e,t.position)}function ofe(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);wy(e,t.position)}function afe(e,t,n){const s=e.schema;let r=s;t.name==="svg"&&s.space==="html"&&(r=G0,e.schema=r),e.ancestors.push(t);const i=t.name===null?e.Fragment:XU(e,t.name,!0),o=ffe(e,t),a=eA(e,t);return YU(e,o,i,t),ZE(o,a),e.ancestors.pop(),e.schema=s,e.create(t,i,o,n)}function lfe(e,t,n){const s={};return ZE(s,eA(e,t)),e.create(t,e.Fragment,s,n)}function cfe(e,t){return t.value}function YU(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function ZE(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function ufe(e,t,n){return s;function s(r,i,o,a){const c=Array.isArray(o.children)?n:t;return a?c(i,o,a):c(i,o)}}function dfe(e,t){return n;function n(s,r,i,o){const a=Array.isArray(i.children),l=QE(s);return t(r,i,o,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function hfe(e,t){const n={};let s,r;for(r in t.properties)if(r!=="children"&&JE.call(t.properties,r)){const i=mfe(e,r,t.properties[r]);if(i){const[o,a]=i;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&nfe.has(t.tagName)?s=a:n[o]=a}}if(s){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function ffe(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const i=s.data.estree.body[0];i.type;const o=i.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else wy(e,t.position);else{const r=s.name;let i;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const a=s.value.data.estree.body[0];a.type,i=e.evaluater.evaluateExpression(a.expression)}else wy(e,t.position);else i=s.value===null?!0:s.value;n[r]=i}return n}function eA(e,t){const n=[];let s=-1;const r=e.passKeys?new Map:Zhe;for(;++s<t.children.length;){const i=t.children[s];let o;if(e.passKeys){const l=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(l){const c=r.get(l)||0;o=l+"-"+c,r.set(l,c+1)}}const a=KU(e,i,o);a!==void 0&&n.push(a)}return n}function mfe(e,t,n){const s=KE(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?OU(n):UU(n)),s.property==="style"){let r=typeof n=="object"?n:pfe(e,String(n));return e.stylePropertyNameCase==="css"&&(r=gfe(r)),["style",r]}return[e.elementAttributeNameCase==="react"&&s.space?vhe[s.property]||s.property:s.attribute,n]}}function pfe(e,t){try{return Qhe(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,r=new vo("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=GU+"#cannot-parse-style-attribute",r}}function XU(e,t,n){let s;if(!n)s={type:"Literal",value:t};else if(t.includes(".")){const r=t.split(".");let i=-1,o;for(;++i<r.length;){const a=Tj(r[i])?{type:"Identifier",name:r[i]}:{type:"Literal",value:r[i]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(i&&a.type==="Literal"),optional:!1}:a}s=o}else s=Tj(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const r=s.value;return JE.call(e.components,r)?e.components[r]:r}if(e.evaluater)return e.evaluater.evaluateExpression(s);wy(e)}function wy(e,t){const n=new vo("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=GU+"#cannot-handle-mdx-estrees-without-createevaluater",n}function gfe(e){const t={};let n;for(n in e)JE.call(e,n)&&(t[yfe(n)]=e[n]);return t}function yfe(e){let t=e.replace(efe,bfe);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function bfe(e){return"-"+e.toLowerCase()}const _3={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"]},vfe={};function tA(e,t){const n=vfe,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,r=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return QU(e,s,r)}function QU(e,t,n){if(wfe(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Bj(e.children,t,n)}return Array.isArray(e)?Bj(e,t,n):""}function Bj(e,t,n){const s=[];let r=-1;for(;++r<e.length;)s[r]=QU(e[r],t,n);return s.join("")}function wfe(e){return!!(e&&typeof e=="object")}const $j=document.createElement("i");function nA(e){const t="&"+e+";";$j.innerHTML=t;const n=$j.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ia(e,t,n,s){const r=e.length;let i=0,o;if(t<0?t=-t>r?0:r+t:t=t>r?r:t,n=n>0?n:0,s.length<1e4)o=Array.from(s),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);i<s.length;)o=s.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function ol(e,t){return e.length>0?(Ia(e,e.length,0,t),e):t}const zj={}.hasOwnProperty;function JU(e){const t={};let n=-1;for(;++n<e.length;)xfe(t,e[n]);return t}function xfe(e,t){let n;for(n in t){const r=(zj.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){zj.call(r,o)||(r[o]=[]);const a=i[o];kfe(r[o],Array.isArray(a)?a:a?[a]:[])}}}function kfe(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);Ia(e,0,0,s)}function ZU(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Dl(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const jo=Oh(/[A-Za-z]/),po=Oh(/[\dA-Za-z]/),_fe=Oh(/[#-'*+\--9=?A-Z^-~]/);function Ak(e){return e!==null&&(e<32||e===127)}const rT=Oh(/\d/),Sfe=Oh(/[\dA-Fa-f]/),Cfe=Oh(/[!-/:-@[-`{-~]/);function un(e){return e!==null&&e<-2}function dr(e){return e!==null&&(e<0||e===32)}function ps(e){return e===-2||e===-1||e===32}const k_=Oh(new RegExp("\\p{P}|\\p{S}","u")),Xf=Oh(/\s/);function Oh(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function K0(e){const t=[];let n=-1,s=0,r=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&po(e.charCodeAt(n+1))&&po(e.charCodeAt(n+2)))r=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const a=e.charCodeAt(n+1);i<56320&&a>56319&&a<57344?(o=String.fromCharCode(i,a),r=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(s,n),encodeURIComponent(o)),s=n+r+1,o=""),r&&(n+=r,r=0)}return t.join("")+e.slice(s)}function us(e,t,n,s){const r=s?s-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(l){return ps(l)?(e.enter(n),a(l)):t(l)}function a(l){return ps(l)&&i++<r?(e.consume(l),a):(e.exit(n),t(l))}}const Tfe={tokenize:Efe};function Efe(e){const t=e.attempt(this.parser.constructs.contentInitial,s,r);let n;return t;function s(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),us(e,t,"linePrefix")}function r(a){return e.enter("paragraph"),i(a)}function i(a){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(a)}function o(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return un(a)?(e.consume(a),e.exit("chunkText"),i):(e.consume(a),o)}}const Afe={tokenize:Mfe},Fj={tokenize:Nfe};function Mfe(e){const t=this,n=[];let s=0,r,i,o;return a;function a(x){if(s<n.length){const k=n[s];return t.containerState=k[1],e.attempt(k[0].continuation,l,c)(x)}return c(x)}function l(x){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,r&&b();const k=t.events.length;let T=k,C;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){C=t.events[T][1].end;break}v(s);let S=k;for(;S<t.events.length;)t.events[S][1].end={...C},S++;return Ia(t.events,T+1,0,t.events.slice(k)),t.events.length=S,c(x)}return a(x)}function c(x){if(s===n.length){if(!r)return f(x);if(r.currentConstruct&&r.currentConstruct.concrete)return g(x);t.interrupt=!!(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Fj,d,h)(x)}function d(x){return r&&b(),v(s),f(x)}function h(x){return t.parser.lazy[t.now().line]=s!==n.length,o=t.now().offset,g(x)}function f(x){return t.containerState={},e.attempt(Fj,p,g)(x)}function p(x){return s++,n.push([t.currentConstruct,t.containerState]),f(x)}function g(x){if(x===null){r&&b(),v(0),e.consume(x);return}return r=r||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:r,contentType:"flow",previous:i}),y(x)}function y(x){if(x===null){w(e.exit("chunkFlow"),!0),v(0),e.consume(x);return}return un(x)?(e.consume(x),w(e.exit("chunkFlow")),s=0,t.interrupt=void 0,a):(e.consume(x),y)}function w(x,k){const T=t.sliceStream(x);if(k&&T.push(null),x.previous=i,i&&(i.next=x),i=x,r.defineSkip(x.start),r.write(T),t.parser.lazy[x.start.line]){let C=r.events.length;for(;C--;)if(r.events[C][1].start.offset<o&&(!r.events[C][1].end||r.events[C][1].end.offset>o))return;const S=t.events.length;let _=S,L,M;for(;_--;)if(t.events[_][0]==="exit"&&t.events[_][1].type==="chunkFlow"){if(L){M=t.events[_][1].end;break}L=!0}for(v(s),C=S;C<t.events.length;)t.events[C][1].end={...M},C++;Ia(t.events,_+1,0,t.events.slice(S)),t.events.length=C}}function v(x){let k=n.length;for(;k-- >x;){const T=n[k];t.containerState=T[1],T[0].exit.call(t,e)}n.length=x}function b(){r.write([null]),i=void 0,r=void 0,t.containerState._closeFlow=void 0}}function Nfe(e,t,n){return us(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function b0(e){if(e===null||dr(e)||Xf(e))return 1;if(k_(e))return 2}function __(e,t,n){const s=[];let r=-1;for(;++r<e.length;){const i=e[r].resolveAll;i&&!s.includes(i)&&(t=i(t,n),s.push(i))}return t}const iT={name:"attention",resolveAll:Ife,tokenize:Rfe};function Ife(e,t){let n=-1,s,r,i,o,a,l,c,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(s=n;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[s][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[s][1].end.offset-e[s][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h={...e[s][1].end},f={...e[n][1].start};qj(h,-l),qj(f,l),o={type:l>1?"strongSequence":"emphasisSequence",start:h,end:{...e[s][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},i={type:l>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},r={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[s][1].end={...o.start},e[n][1].start={...a.end},c=[],e[s][1].end.offset-e[s][1].start.offset&&(c=ol(c,[["enter",e[s][1],t],["exit",e[s][1],t]])),c=ol(c,[["enter",r,t],["enter",o,t],["exit",o,t],["enter",i,t]]),c=ol(c,__(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),c=ol(c,[["exit",i,t],["enter",a,t],["exit",a,t],["exit",r,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,c=ol(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Ia(e,s-1,n-s+3,c),n=s+c.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function Rfe(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,r=b0(s);let i;return o;function o(l){return i=l,e.enter("attentionSequence"),a(l)}function a(l){if(l===i)return e.consume(l),a;const c=e.exit("attentionSequence"),d=b0(l),h=!d||d===2&&r||n.includes(l),f=!r||r===2&&d||n.includes(s);return c._open=!!(i===42?h:h&&(r||!f)),c._close=!!(i===42?f:f&&(d||!h)),t(l)}}function qj(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const jfe={name:"autolink",tokenize:Lfe};function Lfe(e,t,n){let s=0;return r;function r(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return jo(p)?(e.consume(p),o):p===64?n(p):c(p)}function o(p){return p===43||p===45||p===46||po(p)?(s=1,a(p)):c(p)}function a(p){return p===58?(e.consume(p),s=0,l):(p===43||p===45||p===46||po(p))&&s++<32?(e.consume(p),a):(s=0,c(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||Ak(p)?n(p):(e.consume(p),l)}function c(p){return p===64?(e.consume(p),d):_fe(p)?(e.consume(p),c):n(p)}function d(p){return po(p)?h(p):n(p)}function h(p){return p===46?(e.consume(p),s=0,d):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):f(p)}function f(p){if((p===45||po(p))&&s++<63){const g=p===45?f:h;return e.consume(p),g}return n(p)}}const wb={partial:!0,tokenize:Dfe};function Dfe(e,t,n){return s;function s(i){return ps(i)?us(e,r,"linePrefix")(i):r(i)}function r(i){return i===null||un(i)?t(i):n(i)}}const eV={continuation:{tokenize:Pfe},exit:Bfe,name:"blockQuote",tokenize:Ofe};function Ofe(e,t,n){const s=this;return r;function r(o){if(o===62){const a=s.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return n(o)}function i(o){return ps(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function Pfe(e,t,n){const s=this;return r;function r(o){return ps(o)?us(e,i,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(eV,t,n)(o)}}function Bfe(e){e.exit("blockQuote")}const tV={name:"characterEscape",tokenize:$fe};function $fe(e,t,n){return s;function s(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),r}function r(i){return Cfe(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const nV={name:"characterReference",tokenize:zfe};function zfe(e,t,n){const s=this;let r=0,i,o;return a;function a(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),l}function l(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),i=31,o=po,d(h))}function c(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=Sfe,d):(e.enter("characterReferenceValue"),i=7,o=rT,d(h))}function d(h){if(h===59&&r){const f=e.exit("characterReferenceValue");return o===po&&!nA(s.sliceSerialize(f))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(h)&&r++<i?(e.consume(h),d):n(h)}}const Hj={partial:!0,tokenize:qfe},Uj={concrete:!0,name:"codeFenced",tokenize:Ffe};function Ffe(e,t,n){const s=this,r={partial:!0,tokenize:T};let i=0,o=0,a;return l;function l(C){return c(C)}function c(C){const S=s.events[s.events.length-1];return i=S&&S[1].type==="linePrefix"?S[2].sliceSerialize(S[1],!0).length:0,a=C,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(C)}function d(C){return C===a?(o++,e.consume(C),d):o<3?n(C):(e.exit("codeFencedFenceSequence"),ps(C)?us(e,h,"whitespace")(C):h(C))}function h(C){return C===null||un(C)?(e.exit("codeFencedFence"),s.interrupt?t(C):e.check(Hj,y,k)(C)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(C))}function f(C){return C===null||un(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(C)):ps(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),us(e,p,"whitespace")(C)):C===96&&C===a?n(C):(e.consume(C),f)}function p(C){return C===null||un(C)?h(C):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(C))}function g(C){return C===null||un(C)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(C)):C===96&&C===a?n(C):(e.consume(C),g)}function y(C){return e.attempt(r,k,w)(C)}function w(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),v}function v(C){return i>0&&ps(C)?us(e,b,"linePrefix",i+1)(C):b(C)}function b(C){return C===null||un(C)?e.check(Hj,y,k)(C):(e.enter("codeFlowValue"),x(C))}function x(C){return C===null||un(C)?(e.exit("codeFlowValue"),b(C)):(e.consume(C),x)}function k(C){return e.exit("codeFenced"),t(C)}function T(C,S,_){let L=0;return M;function M(F){return C.enter("lineEnding"),C.consume(F),C.exit("lineEnding"),I}function I(F){return C.enter("codeFencedFence"),ps(F)?us(C,A,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):A(F)}function A(F){return F===a?(C.enter("codeFencedFenceSequence"),P(F)):_(F)}function P(F){return F===a?(L++,C.consume(F),P):L>=o?(C.exit("codeFencedFenceSequence"),ps(F)?us(C,B,"whitespace")(F):B(F)):_(F)}function B(F){return F===null||un(F)?(C.exit("codeFencedFence"),S(F)):_(F)}}}function qfe(e,t,n){const s=this;return r;function r(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return s.parser.lazy[s.now().line]?n(o):t(o)}}const S3={name:"codeIndented",tokenize:Ufe},Hfe={partial:!0,tokenize:Vfe};function Ufe(e,t,n){const s=this;return r;function r(c){return e.enter("codeIndented"),us(e,i,"linePrefix",5)(c)}function i(c){const d=s.events[s.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?l(c):un(c)?e.attempt(Hfe,o,l)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||un(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),a)}function l(c){return e.exit("codeIndented"),t(c)}}function Vfe(e,t,n){const s=this;return r;function r(o){return s.parser.lazy[s.now().line]?n(o):un(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),r):us(e,i,"linePrefix",5)(o)}function i(o){const a=s.events[s.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):un(o)?r(o):n(o)}}const Wfe={name:"codeText",previous:Kfe,resolve:Gfe,tokenize:Yfe};function Gfe(e){let t=e.length-4,n=3,s,r;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s<t;)if(e[s][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(s=n-1,t++;++s<=t;)r===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(r=s):(s===t||e[s][1].type==="lineEnding")&&(e[r][1].type="codeTextData",s!==r+2&&(e[r][1].end=e[s-1][1].end,e.splice(r+2,s-r-2),t-=s-r-2,s=r+2),r=void 0);return e}function Kfe(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Yfe(e,t,n){let s=0,r,i;return o;function o(h){return e.enter("codeText"),e.enter("codeTextSequence"),a(h)}function a(h){return h===96?(e.consume(h),s++,a):(e.exit("codeTextSequence"),l(h))}function l(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),l):h===96?(i=e.enter("codeTextSequence"),r=0,d(h)):un(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(h))}function c(h){return h===null||h===32||h===96||un(h)?(e.exit("codeTextData"),l(h)):(e.consume(h),c)}function d(h){return h===96?(e.consume(h),r++,d):r===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(i.type="codeTextData",c(h))}}class Xfe{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,n,s){const r=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return s&&$g(this.left,s),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),$g(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),$g(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);$g(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);$g(this.left,n.reverse())}}}function $g(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function sV(e){const t={};let n=-1,s,r,i,o,a,l,c;const d=new Xfe(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(s=d.get(n),n&&s[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(l=s[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,Qfe(d,n)),n=t[n],c=!0);else if(s[1]._container){for(i=n,r=void 0;i--;)if(o=d.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(r&&(d.get(r)[1].type="lineEndingBlank"),o[1].type="lineEnding",r=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;r&&(s[1].end={...d.get(r)[1].start},a=d.slice(r,n),a.unshift(s),d.splice(r,n-r+1,a))}}return Ia(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!c}function Qfe(e,t){const n=e.get(t)[1],s=e.get(t)[2];let r=t-1;const i=[];let o=n._tokenizer;o||(o=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],c={};let d,h,f=-1,p=n,g=0,y=0;const w=[y];for(;p;){for(;e.get(++r)[1]!==p;);i.push(r),p._tokenizer||(d=s.sliceStream(p),p.next||d.push(null),h&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),h=p,p=p.next}for(p=n;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(y=f+1,w.push(y),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):w.pop(),f=w.length;f--;){const v=a.slice(w[f],w[f+1]),b=i.pop();l.push([b,b+v.length-1]),e.splice(b,2,v)}for(l.reverse(),f=-1;++f<l.length;)c[g+l[f][0]]=g+l[f][1],g+=l[f][1]-l[f][0]-1;return c}const Jfe={resolve:eme,tokenize:tme},Zfe={partial:!0,tokenize:nme};function eme(e){return sV(e),e}function tme(e,t){let n;return s;function s(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(a)}function r(a){return a===null?i(a):un(a)?e.check(Zfe,o,i)(a):(e.consume(a),r)}function i(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function o(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}function nme(e,t,n){const s=this;return r;function r(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),us(e,i,"linePrefix")}function i(o){if(o===null||un(o))return n(o);const a=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):e.interrupt(s.parser.constructs.flow,n,t)(o)}}function rV(e,t,n,s,r,i,o,a,l){const c=l||Number.POSITIVE_INFINITY;let d=0;return h;function h(v){return v===60?(e.enter(s),e.enter(r),e.enter(i),e.consume(v),e.exit(i),f):v===null||v===32||v===41||Ak(v)?n(v):(e.enter(s),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),y(v))}function f(v){return v===62?(e.enter(i),e.consume(v),e.exit(i),e.exit(r),e.exit(s),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===62?(e.exit("chunkString"),e.exit(a),f(v)):v===null||v===60||un(v)?n(v):(e.consume(v),v===92?g:p)}function g(v){return v===60||v===62||v===92?(e.consume(v),p):p(v)}function y(v){return!d&&(v===null||v===41||dr(v))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(s),t(v)):d<c&&v===40?(e.consume(v),d++,y):v===41?(e.consume(v),d--,y):v===null||v===32||v===40||Ak(v)?n(v):(e.consume(v),v===92?w:y)}function w(v){return v===40||v===41||v===92?(e.consume(v),y):y(v)}}function iV(e,t,n,s,r,i){const o=this;let a=0,l;return c;function c(p){return e.enter(s),e.enter(r),e.consume(p),e.exit(r),e.enter(i),d}function d(p){return a>999||p===null||p===91||p===93&&!l||p===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(e.exit(i),e.enter(r),e.consume(p),e.exit(r),e.exit(s),t):un(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===null||p===91||p===93||un(p)||a++>999?(e.exit("chunkString"),d(p)):(e.consume(p),l||(l=!ps(p)),p===92?f:h)}function f(p){return p===91||p===92||p===93?(e.consume(p),a++,h):h(p)}}function oV(e,t,n,s,r,i){let o;return a;function a(f){return f===34||f===39||f===40?(e.enter(s),e.enter(r),e.consume(f),e.exit(r),o=f===40?41:f,l):n(f)}function l(f){return f===o?(e.enter(r),e.consume(f),e.exit(r),e.exit(s),t):(e.enter(i),c(f))}function c(f){return f===o?(e.exit(i),l(o)):f===null?n(f):un(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),us(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===o||f===null||un(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?h:d)}function h(f){return f===o||f===92?(e.consume(f),d):d(f)}}function H1(e,t){let n;return s;function s(r){return un(r)?(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),n=!0,s):ps(r)?us(e,s,n?"linePrefix":"lineSuffix")(r):t(r)}}const sme={name:"definition",tokenize:ime},rme={partial:!0,tokenize:ome};function ime(e,t,n){const s=this;let r;return i;function i(p){return e.enter("definition"),o(p)}function o(p){return iV.call(s,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return r=Dl(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return dr(p)?H1(e,c)(p):c(p)}function c(p){return rV(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(rme,h,h)(p)}function h(p){return ps(p)?us(e,f,"whitespace")(p):f(p)}function f(p){return p===null||un(p)?(e.exit("definition"),s.parser.defined.push(r),t(p)):n(p)}}function ome(e,t,n){return s;function s(a){return dr(a)?H1(e,r)(a):n(a)}function r(a){return oV(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return ps(a)?us(e,o,"whitespace")(a):o(a)}function o(a){return a===null||un(a)?t(a):n(a)}}const ame={name:"hardBreakEscape",tokenize:lme};function lme(e,t,n){return s;function s(i){return e.enter("hardBreakEscape"),e.consume(i),r}function r(i){return un(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const cme={name:"headingAtx",resolve:ume,tokenize:dme};function ume(e,t){let n=e.length-2,s=3,r,i;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(r={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},i={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},Ia(e,s,n-s+1,[["enter",r,t],["enter",i,t],["exit",i,t],["exit",r,t]])),e}function dme(e,t,n){let s=0;return r;function r(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&s++<6?(e.consume(d),o):d===null||dr(d)?(e.exit("atxHeadingSequence"),a(d)):n(d)}function a(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||un(d)?(e.exit("atxHeading"),t(d)):ps(d)?us(e,a,"whitespace")(d):(e.enter("atxHeadingText"),c(d))}function l(d){return d===35?(e.consume(d),l):(e.exit("atxHeadingSequence"),a(d))}function c(d){return d===null||d===35||dr(d)?(e.exit("atxHeadingText"),a(d)):(e.consume(d),c)}}const hme=["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"],Vj=["pre","script","style","textarea"],fme={concrete:!0,name:"htmlFlow",resolveTo:gme,tokenize:yme},mme={partial:!0,tokenize:vme},pme={partial:!0,tokenize:bme};function gme(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function yme(e,t,n){const s=this;let r,i,o,a,l;return c;function c(N){return d(N)}function d(N){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(N),h}function h(N){return N===33?(e.consume(N),f):N===47?(e.consume(N),i=!0,y):N===63?(e.consume(N),r=3,s.interrupt?t:D):jo(N)?(e.consume(N),o=String.fromCharCode(N),w):n(N)}function f(N){return N===45?(e.consume(N),r=2,p):N===91?(e.consume(N),r=5,a=0,g):jo(N)?(e.consume(N),r=4,s.interrupt?t:D):n(N)}function p(N){return N===45?(e.consume(N),s.interrupt?t:D):n(N)}function g(N){const ee="CDATA[";return N===ee.charCodeAt(a++)?(e.consume(N),a===ee.length?s.interrupt?t:A:g):n(N)}function y(N){return jo(N)?(e.consume(N),o=String.fromCharCode(N),w):n(N)}function w(N){if(N===null||N===47||N===62||dr(N)){const ee=N===47,re=o.toLowerCase();return!ee&&!i&&Vj.includes(re)?(r=1,s.interrupt?t(N):A(N)):hme.includes(o.toLowerCase())?(r=6,ee?(e.consume(N),v):s.interrupt?t(N):A(N)):(r=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(N):i?b(N):x(N))}return N===45||po(N)?(e.consume(N),o+=String.fromCharCode(N),w):n(N)}function v(N){return N===62?(e.consume(N),s.interrupt?t:A):n(N)}function b(N){return ps(N)?(e.consume(N),b):M(N)}function x(N){return N===47?(e.consume(N),M):N===58||N===95||jo(N)?(e.consume(N),k):ps(N)?(e.consume(N),x):M(N)}function k(N){return N===45||N===46||N===58||N===95||po(N)?(e.consume(N),k):T(N)}function T(N){return N===61?(e.consume(N),C):ps(N)?(e.consume(N),T):x(N)}function C(N){return N===null||N===60||N===61||N===62||N===96?n(N):N===34||N===39?(e.consume(N),l=N,S):ps(N)?(e.consume(N),C):_(N)}function S(N){return N===l?(e.consume(N),l=null,L):N===null||un(N)?n(N):(e.consume(N),S)}function _(N){return N===null||N===34||N===39||N===47||N===60||N===61||N===62||N===96||dr(N)?T(N):(e.consume(N),_)}function L(N){return N===47||N===62||ps(N)?x(N):n(N)}function M(N){return N===62?(e.consume(N),I):n(N)}function I(N){return N===null||un(N)?A(N):ps(N)?(e.consume(N),I):n(N)}function A(N){return N===45&&r===2?(e.consume(N),O):N===60&&r===1?(e.consume(N),X):N===62&&r===4?(e.consume(N),G):N===63&&r===3?(e.consume(N),D):N===93&&r===5?(e.consume(N),U):un(N)&&(r===6||r===7)?(e.exit("htmlFlowData"),e.check(mme,q,P)(N)):N===null||un(N)?(e.exit("htmlFlowData"),P(N)):(e.consume(N),A)}function P(N){return e.check(pme,B,q)(N)}function B(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),F}function F(N){return N===null||un(N)?P(N):(e.enter("htmlFlowData"),A(N))}function O(N){return N===45?(e.consume(N),D):A(N)}function X(N){return N===47?(e.consume(N),o="",z):A(N)}function z(N){if(N===62){const ee=o.toLowerCase();return Vj.includes(ee)?(e.consume(N),G):A(N)}return jo(N)&&o.length<8?(e.consume(N),o+=String.fromCharCode(N),z):A(N)}function U(N){return N===93?(e.consume(N),D):A(N)}function D(N){return N===62?(e.consume(N),G):N===45&&r===2?(e.consume(N),D):A(N)}function G(N){return N===null||un(N)?(e.exit("htmlFlowData"),q(N)):(e.consume(N),G)}function q(N){return e.exit("htmlFlow"),t(N)}}function bme(e,t,n){const s=this;return r;function r(o){return un(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return s.parser.lazy[s.now().line]?n(o):t(o)}}function vme(e,t,n){return s;function s(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(wb,t,n)}}const wme={name:"htmlText",tokenize:xme};function xme(e,t,n){const s=this;let r,i,o;return a;function a(D){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(D),l}function l(D){return D===33?(e.consume(D),c):D===47?(e.consume(D),T):D===63?(e.consume(D),x):jo(D)?(e.consume(D),_):n(D)}function c(D){return D===45?(e.consume(D),d):D===91?(e.consume(D),i=0,g):jo(D)?(e.consume(D),b):n(D)}function d(D){return D===45?(e.consume(D),p):n(D)}function h(D){return D===null?n(D):D===45?(e.consume(D),f):un(D)?(o=h,X(D)):(e.consume(D),h)}function f(D){return D===45?(e.consume(D),p):h(D)}function p(D){return D===62?O(D):D===45?f(D):h(D)}function g(D){const G="CDATA[";return D===G.charCodeAt(i++)?(e.consume(D),i===G.length?y:g):n(D)}function y(D){return D===null?n(D):D===93?(e.consume(D),w):un(D)?(o=y,X(D)):(e.consume(D),y)}function w(D){return D===93?(e.consume(D),v):y(D)}function v(D){return D===62?O(D):D===93?(e.consume(D),v):y(D)}function b(D){return D===null||D===62?O(D):un(D)?(o=b,X(D)):(e.consume(D),b)}function x(D){return D===null?n(D):D===63?(e.consume(D),k):un(D)?(o=x,X(D)):(e.consume(D),x)}function k(D){return D===62?O(D):x(D)}function T(D){return jo(D)?(e.consume(D),C):n(D)}function C(D){return D===45||po(D)?(e.consume(D),C):S(D)}function S(D){return un(D)?(o=S,X(D)):ps(D)?(e.consume(D),S):O(D)}function _(D){return D===45||po(D)?(e.consume(D),_):D===47||D===62||dr(D)?L(D):n(D)}function L(D){return D===47?(e.consume(D),O):D===58||D===95||jo(D)?(e.consume(D),M):un(D)?(o=L,X(D)):ps(D)?(e.consume(D),L):O(D)}function M(D){return D===45||D===46||D===58||D===95||po(D)?(e.consume(D),M):I(D)}function I(D){return D===61?(e.consume(D),A):un(D)?(o=I,X(D)):ps(D)?(e.consume(D),I):L(D)}function A(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(e.consume(D),r=D,P):un(D)?(o=A,X(D)):ps(D)?(e.consume(D),A):(e.consume(D),B)}function P(D){return D===r?(e.consume(D),r=void 0,F):D===null?n(D):un(D)?(o=P,X(D)):(e.consume(D),P)}function B(D){return D===null||D===34||D===39||D===60||D===61||D===96?n(D):D===47||D===62||dr(D)?L(D):(e.consume(D),B)}function F(D){return D===47||D===62||dr(D)?L(D):n(D)}function O(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),t):n(D)}function X(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),z}function z(D){return ps(D)?us(e,U,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):U(D)}function U(D){return e.enter("htmlTextData"),o(D)}}const sA={name:"labelEnd",resolveAll:Cme,resolveTo:Tme,tokenize:Eme},kme={tokenize:Ame},_me={tokenize:Mme},Sme={tokenize:Nme};function Cme(e){let t=-1;const n=[];for(;++t<e.length;){const s=e[t][1];if(n.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const r=s.type==="labelImage"?4:2;s.type="data",t+=r}}return e.length!==n.length&&Ia(e,0,e.length,n),e}function Tme(e,t){let n=e.length,s=0,r,i,o,a;for(;n--;)if(r=e[n][1],i){if(r.type==="link"||r.type==="labelLink"&&r._inactive)break;e[n][0]==="enter"&&r.type==="labelLink"&&(r._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(r.type==="labelImage"||r.type==="labelLink")&&!r._balanced&&(i=n,r.type!=="labelLink")){s=2;break}}else r.type==="labelEnd"&&(o=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},d={type:"labelText",start:{...e[i+s+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",l,t],["enter",c,t]],a=ol(a,e.slice(i+1,i+s+3)),a=ol(a,[["enter",d,t]]),a=ol(a,__(t.parser.constructs.insideSpan.null,e.slice(i+s+4,o-3),t)),a=ol(a,[["exit",d,t],e[o-2],e[o-1],["exit",c,t]]),a=ol(a,e.slice(o+1)),a=ol(a,[["exit",l,t]]),Ia(e,i,e.length,a),e}function Eme(e,t,n){const s=this;let r=s.events.length,i,o;for(;r--;)if((s.events[r][1].type==="labelImage"||s.events[r][1].type==="labelLink")&&!s.events[r][1]._balanced){i=s.events[r][1];break}return a;function a(f){return i?i._inactive?h(f):(o=s.parser.defined.includes(Dl(s.sliceSerialize({start:i.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),l):n(f)}function l(f){return f===40?e.attempt(kme,d,o?d:h)(f):f===91?e.attempt(_me,d,o?c:h)(f):o?d(f):h(f)}function c(f){return e.attempt(Sme,d,h)(f)}function d(f){return t(f)}function h(f){return i._balanced=!0,n(f)}}function Ame(e,t,n){return s;function s(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),r}function r(h){return dr(h)?H1(e,i)(h):i(h)}function i(h){return h===41?d(h):rV(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function o(h){return dr(h)?H1(e,l)(h):d(h)}function a(h){return n(h)}function l(h){return h===34||h===39||h===40?oV(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function c(h){return dr(h)?H1(e,d)(h):d(h)}function d(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function Mme(e,t,n){const s=this;return r;function r(a){return iV.call(s,e,i,o,"reference","referenceMarker","referenceString")(a)}function i(a){return s.parser.defined.includes(Dl(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function Nme(e,t,n){return s;function s(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),r}function r(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const Ime={name:"labelStartImage",resolveAll:sA.resolveAll,tokenize:Rme};function Rme(e,t,n){const s=this;return r;function r(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),i}function i(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(a):t(a)}}const jme={name:"labelStartLink",resolveAll:sA.resolveAll,tokenize:Lme};function Lme(e,t,n){const s=this;return r;function r(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(o):t(o)}}const C3={name:"lineEnding",tokenize:Dme};function Dme(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),us(e,t,"linePrefix")}}const gx={name:"thematicBreak",tokenize:Ome};function Ome(e,t,n){let s=0,r;return i;function i(c){return e.enter("thematicBreak"),o(c)}function o(c){return r=c,a(c)}function a(c){return c===r?(e.enter("thematicBreakSequence"),l(c)):s>=3&&(c===null||un(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===r?(e.consume(c),s++,l):(e.exit("thematicBreakSequence"),ps(c)?us(e,a,"whitespace")(c):a(c))}}const Go={continuation:{tokenize:zme},exit:qme,name:"list",tokenize:$me},Pme={partial:!0,tokenize:Hme},Bme={partial:!0,tokenize:Fme};function $me(e,t,n){const s=this,r=s.events[s.events.length-1];let i=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,o=0;return a;function a(p){const g=s.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!s.containerState.marker||p===s.containerState.marker:rT(p)){if(s.containerState.type||(s.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(gx,n,c)(p):c(p);if(!s.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return rT(p)&&++o<10?(e.consume(p),l):(!s.interrupt||o<2)&&(s.containerState.marker?p===s.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):n(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||p,e.check(wb,s.interrupt?n:d,e.attempt(Pme,f,h))}function d(p){return s.containerState.initialBlankLine=!0,i++,f(p)}function h(p){return ps(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):n(p)}function f(p){return s.containerState.size=i+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function zme(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(wb,r,i);function r(a){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,us(e,t,"listItemIndent",s.containerState.size+1)(a)}function i(a){return s.containerState.furtherBlankLines||!ps(a)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,o(a)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(Bme,t,o)(a))}function o(a){return s.containerState._closeFlow=!0,s.interrupt=void 0,us(e,e.attempt(Go,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function Fme(e,t,n){const s=this;return us(e,r,"listItemIndent",s.containerState.size+1);function r(i){const o=s.events[s.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===s.containerState.size?t(i):n(i)}}function qme(e){e.exit(this.containerState.type)}function Hme(e,t,n){const s=this;return us(e,r,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function r(i){const o=s.events[s.events.length-1];return!ps(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const Wj={name:"setextUnderline",resolveTo:Ume,tokenize:Vme};function Ume(e,t){let n=e.length,s,r,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(r=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[r][1].type="setextHeadingText",i?(e.splice(r,0,["enter",o,t]),e.splice(i+1,0,["exit",e[s][1],t]),e[s][1].end={...e[i][1].end}):e[s][1]=o,e.push(["exit",o,t]),e}function Vme(e,t,n){const s=this;let r;return i;function i(c){let d=s.events.length,h;for(;d--;)if(s.events[d][1].type!=="lineEnding"&&s.events[d][1].type!=="linePrefix"&&s.events[d][1].type!=="content"){h=s.events[d][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||h)?(e.enter("setextHeadingLine"),r=c,o(c)):n(c)}function o(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===r?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),ps(c)?us(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||un(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const Wme={tokenize:Gme};function Gme(e){const t=this,n=e.attempt(wb,s,e.attempt(this.parser.constructs.flowInitial,r,us(e,e.attempt(this.parser.constructs.flow,r,e.attempt(Jfe,r)),"linePrefix")));return n;function s(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function r(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Kme={resolveAll:lV()},Yme=aV("string"),Xme=aV("text");function aV(e){return{resolveAll:lV(e==="text"?Qme:void 0),tokenize:t};function t(n){const s=this,r=this.parser.constructs[e],i=n.attempt(r,o,a);return o;function o(d){return c(d)?i(d):a(d)}function a(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return c(d)?(n.exit("data"),i(d)):(n.consume(d),l)}function c(d){if(d===null)return!0;const h=r[d];let f=-1;if(h)for(;++f<h.length;){const p=h[f];if(!p.previous||p.previous.call(s,s.previous))return!0}return!1}}}function lV(e){return t;function t(n,s){let r=-1,i;for(;++r<=n.length;)i===void 0?n[r]&&n[r][1].type==="data"&&(i=r,r++):(!n[r]||n[r][1].type!=="data")&&(r!==i+2&&(n[i][1].end=n[r-1][1].end,n.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(n,s):n}}function Qme(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const s=e[n-1][1],r=t.sliceStream(s);let i=r.length,o=-1,a=0,l;for(;i--;){const c=r[i];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(c===-2)l=!0,a++;else if(c!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const c={type:n===e.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:s.start._bufferIndex+o,_index:s.start._index+i,line:s.end.line,column:s.end.column-a,offset:s.end.offset-a},end:{...s.end}};s.end={...c.start},s.start.offset===s.end.offset?Object.assign(s,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const Jme={42:Go,43:Go,45:Go,48:Go,49:Go,50:Go,51:Go,52:Go,53:Go,54:Go,55:Go,56:Go,57:Go,62:eV},Zme={91:sme},epe={[-2]:S3,[-1]:S3,32:S3},tpe={35:cme,42:gx,45:[Wj,gx],60:fme,61:Wj,95:gx,96:Uj,126:Uj},npe={38:nV,92:tV},spe={[-5]:C3,[-4]:C3,[-3]:C3,33:Ime,38:nV,42:iT,60:[jfe,wme],91:jme,92:[ame,tV],93:sA,95:iT,96:Wfe},rpe={null:[iT,Kme]},ipe={null:[42,95]},ope={null:[]},ape=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ipe,contentInitial:Zme,disable:ope,document:Jme,flow:tpe,flowInitial:epe,insideSpan:rpe,string:npe,text:spe},Symbol.toStringTag,{value:"Module"}));function lpe(e,t,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const r={},i=[];let o=[],a=[];const l={attempt:S(T),check:S(C),consume:b,enter:x,exit:k,interrupt:S(C,{interrupt:!0})},c={code:null,containerState:{},defineSkip:y,events:[],now:g,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:h};let d=t.tokenize.call(c,l);return t.resolveAll&&i.push(t),c;function h(I){return o=ol(o,I),w(),o[o.length-1]!==null?[]:(_(t,0),c.events=__(i,c.events,c),c.events)}function f(I,A){return upe(p(I),A)}function p(I){return cpe(o,I)}function g(){const{_bufferIndex:I,_index:A,line:P,column:B,offset:F}=s;return{_bufferIndex:I,_index:A,line:P,column:B,offset:F}}function y(I){r[I.line]=I.column,M()}function w(){let I;for(;s._index<o.length;){const A=o[s._index];if(typeof A=="string")for(I=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===I&&s._bufferIndex<A.length;)v(A.charCodeAt(s._bufferIndex));else v(A)}}function v(I){d=d(I)}function b(I){un(I)?(s.line++,s.column=1,s.offset+=I===-3?2:1,M()):I!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===o[s._index].length&&(s._bufferIndex=-1,s._index++)),c.previous=I}function x(I,A){const P=A||{};return P.type=I,P.start=g(),c.events.push(["enter",P,c]),a.push(P),P}function k(I){const A=a.pop();return A.end=g(),c.events.push(["exit",A,c]),A}function T(I,A){_(I,A.from)}function C(I,A){A.restore()}function S(I,A){return P;function P(B,F,O){let X,z,U,D;return Array.isArray(B)?q(B):"tokenize"in B?q([B]):G(B);function G(Q){return K;function K(se){const te=se!==null&&Q[se],ce=se!==null&&Q.null,oe=[...Array.isArray(te)?te:te?[te]:[],...Array.isArray(ce)?ce:ce?[ce]:[]];return q(oe)(se)}}function q(Q){return X=Q,z=0,Q.length===0?O:N(Q[z])}function N(Q){return K;function K(se){return D=L(),U=Q,Q.partial||(c.currentConstruct=Q),Q.name&&c.parser.constructs.disable.null.includes(Q.name)?re():Q.tokenize.call(A?Object.assign(Object.create(c),A):c,l,ee,re)(se)}}function ee(Q){return I(U,D),F}function re(Q){return D.restore(),++z<X.length?N(X[z]):O}}}function _(I,A){I.resolveAll&&!i.includes(I)&&i.push(I),I.resolve&&Ia(c.events,A,c.events.length-A,I.resolve(c.events.slice(A),c)),I.resolveTo&&(c.events=I.resolveTo(c.events,c))}function L(){const I=g(),A=c.previous,P=c.currentConstruct,B=c.events.length,F=Array.from(a);return{from:B,restore:O};function O(){s=I,c.previous=A,c.currentConstruct=P,c.events.length=B,a=F,M()}}function M(){s.line in r&&s.column<2&&(s.column=r[s.line],s.offset+=r[s.line]-1)}}function cpe(e,t){const n=t.start._index,s=t.start._bufferIndex,r=t.end._index,i=t.end._bufferIndex;let o;if(n===r)o=[e[n].slice(s,i)];else{if(o=e.slice(n,r),s>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(s):o.shift()}i>0&&o.push(e[r].slice(0,i))}return o}function upe(e,t){let n=-1;const s=[];let r;for(;++n<e.length;){const i=e[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
`;break}case-3:{o=`\r
`;break}case-2:{o=t?" ":"	";break}case-1:{if(!t&&r)continue;o=" ";break}default:o=String.fromCharCode(i)}r=i===-2,s.push(o)}return s.join("")}function dpe(e){const s={constructs:JU([ape,...(e||{}).extensions||[]]),content:r(Tfe),defined:[],document:r(Afe),flow:r(Wme),lazy:{},string:r(Yme),text:r(Xme)};return s;function r(i){return o;function o(a){return lpe(s,i,a)}}}function hpe(e){for(;!sV(e););return e}const Gj=/[\0\t\n\r]/g;function fpe(){let e=1,t="",n=!0,s;return r;function r(i,o,a){const l=[];let c,d,h,f,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),h=0,t="",n&&(i.charCodeAt(0)===65279&&h++,n=void 0);h<i.length;){if(Gj.lastIndex=h,c=Gj.exec(i),f=c&&c.index!==void 0?c.index:i.length,p=i.charCodeAt(f),!c){t=i.slice(h);break}if(p===10&&h===f&&s)l.push(-3),s=void 0;else switch(s&&(l.push(-5),s=void 0),h<f&&(l.push(i.slice(h,f)),e+=f-h),p){case 0:{l.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,l.push(-2);e++<d;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:s=!0,e=1}h=f+1}return a&&(s&&l.push(-5),t&&l.push(t),l.push(null)),l}}const mpe=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function ppe(e){return e.replace(mpe,gpe)}function gpe(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const r=n.charCodeAt(1),i=r===120||r===88;return ZU(n.slice(i?2:1),i?16:10)}return nA(n)||e}const cV={}.hasOwnProperty;function ype(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),bpe(n)(hpe(dpe(n).document().write(fpe()(e,t,!0))))}function bpe(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ct),autolinkProtocol:L,autolinkEmail:L,atxHeading:i(Ne),blockQuote:i(ce),characterEscape:L,characterReference:L,codeFenced:i(oe),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(oe,o),codeText:i(de,o),codeTextData:L,data:L,codeFlowValue:L,definition:i(Te),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(qe),hardBreakEscape:i(ge),hardBreakTrailing:i(ge),htmlFlow:i(Ee,o),htmlFlowData:L,htmlText:i(Ee,o),htmlTextData:L,image:i(_t),label:o,link:i(Ct),listItem:i(at),listItemValue:f,listOrdered:i(Je,h),listUnordered:i(Je),paragraph:i(Oe),reference:N,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(Ne),strong:i(Fe),thematicBreak:i(vt)},exit:{atxHeading:l(),atxHeadingSequence:T,autolink:l(),autolinkEmail:te,autolinkProtocol:se,blockQuote:l(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:re,characterReferenceMarkerNumeric:re,characterReferenceValue:Q,characterReference:K,codeFenced:l(w),codeFencedFence:y,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:M,codeIndented:l(v),codeText:l(F),codeTextData:M,data:M,definition:l(),definitionDestinationString:k,definitionLabelString:b,definitionTitleString:x,emphasis:l(),hardBreakEscape:l(A),hardBreakTrailing:l(A),htmlFlow:l(P),htmlFlowData:M,htmlText:l(B),htmlTextData:M,image:l(X),label:U,labelText:z,lineEnding:I,link:l(O),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ee,resourceDestinationString:D,resourceTitleString:G,resource:q,setextHeading:l(_),setextHeadingLineSequence:S,setextHeadingText:C,strong:l(),thematicBreak:l()}};uV(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(ye){let je={type:"root",children:[]};const Ye={stack:[je],tokenStack:[],config:t,enter:a,exit:c,buffer:o,resume:d,data:n},Nt=[];let Rt=-1;for(;++Rt<ye.length;)if(ye[Rt][1].type==="listOrdered"||ye[Rt][1].type==="listUnordered")if(ye[Rt][0]==="enter")Nt.push(Rt);else{const rn=Nt.pop();Rt=r(ye,rn,Rt)}for(Rt=-1;++Rt<ye.length;){const rn=t[ye[Rt][0]];cV.call(rn,ye[Rt][1].type)&&rn[ye[Rt][1].type].call(Object.assign({sliceSerialize:ye[Rt][2].sliceSerialize},Ye),ye[Rt][1])}if(Ye.tokenStack.length>0){const rn=Ye.tokenStack[Ye.tokenStack.length-1];(rn[1]||Kj).call(Ye,void 0,rn[0])}for(je.position={start:yd(ye.length>0?ye[0][1].start:{line:1,column:1,offset:0}),end:yd(ye.length>0?ye[ye.length-2][1].end:{line:1,column:1,offset:0})},Rt=-1;++Rt<t.transforms.length;)je=t.transforms[Rt](je)||je;return je}function r(ye,je,Ye){let Nt=je-1,Rt=-1,rn=!1,on,Bn,bs,Ss;for(;++Nt<=Ye;){const Ie=ye[Nt];switch(Ie[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ie[0]==="enter"?Rt++:Rt--,Ss=void 0;break}case"lineEndingBlank":{Ie[0]==="enter"&&(on&&!Ss&&!Rt&&!bs&&(bs=Nt),Ss=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ss=void 0}if(!Rt&&Ie[0]==="enter"&&Ie[1].type==="listItemPrefix"||Rt===-1&&Ie[0]==="exit"&&(Ie[1].type==="listUnordered"||Ie[1].type==="listOrdered")){if(on){let lt=Nt;for(Bn=void 0;lt--;){const ne=ye[lt];if(ne[1].type==="lineEnding"||ne[1].type==="lineEndingBlank"){if(ne[0]==="exit")continue;Bn&&(ye[Bn][1].type="lineEndingBlank",rn=!0),ne[1].type="lineEnding",Bn=lt}else if(!(ne[1].type==="linePrefix"||ne[1].type==="blockQuotePrefix"||ne[1].type==="blockQuotePrefixWhitespace"||ne[1].type==="blockQuoteMarker"||ne[1].type==="listItemIndent"))break}bs&&(!Bn||bs<Bn)&&(on._spread=!0),on.end=Object.assign({},Bn?ye[Bn][1].start:Ie[1].end),ye.splice(Bn||Nt,0,["exit",on,Ie[2]]),Nt++,Ye++}if(Ie[1].type==="listItemPrefix"){const lt={type:"listItem",_spread:!1,start:Object.assign({},Ie[1].start),end:void 0};on=lt,ye.splice(Nt,0,["enter",lt,Ie[2]]),Nt++,Ye++,bs=void 0,Ss=!0}}}return ye[je][1]._spread=rn,Ye}function i(ye,je){return Ye;function Ye(Nt){a.call(this,ye(Nt),Nt),je&&je.call(this,Nt)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(ye,je,Ye){this.stack[this.stack.length-1].children.push(ye),this.stack.push(ye),this.tokenStack.push([je,Ye||void 0]),ye.position={start:yd(je.start),end:void 0}}function l(ye){return je;function je(Ye){ye&&ye.call(this,Ye),c.call(this,Ye)}}function c(ye,je){const Ye=this.stack.pop(),Nt=this.tokenStack.pop();if(Nt)Nt[0].type!==ye.type&&(je?je.call(this,ye,Nt[0]):(Nt[1]||Kj).call(this,ye,Nt[0]));else throw new Error("Cannot close `"+ye.type+"` ("+q1({start:ye.start,end:ye.end})+"): it’s not open");Ye.position.end=yd(ye.end)}function d(){return tA(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function f(ye){if(this.data.expectingFirstListItemValue){const je=this.stack[this.stack.length-2];je.start=Number.parseInt(this.sliceSerialize(ye),10),this.data.expectingFirstListItemValue=void 0}}function p(){const ye=this.resume(),je=this.stack[this.stack.length-1];je.lang=ye}function g(){const ye=this.resume(),je=this.stack[this.stack.length-1];je.meta=ye}function y(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const ye=this.resume(),je=this.stack[this.stack.length-1];je.value=ye.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const ye=this.resume(),je=this.stack[this.stack.length-1];je.value=ye.replace(/(\r?\n|\r)$/g,"")}function b(ye){const je=this.resume(),Ye=this.stack[this.stack.length-1];Ye.label=je,Ye.identifier=Dl(this.sliceSerialize(ye)).toLowerCase()}function x(){const ye=this.resume(),je=this.stack[this.stack.length-1];je.title=ye}function k(){const ye=this.resume(),je=this.stack[this.stack.length-1];je.url=ye}function T(ye){const je=this.stack[this.stack.length-1];if(!je.depth){const Ye=this.sliceSerialize(ye).length;je.depth=Ye}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function S(ye){const je=this.stack[this.stack.length-1];je.depth=this.sliceSerialize(ye).codePointAt(0)===61?1:2}function _(){this.data.setextHeadingSlurpLineEnding=void 0}function L(ye){const Ye=this.stack[this.stack.length-1].children;let Nt=Ye[Ye.length-1];(!Nt||Nt.type!=="text")&&(Nt=ue(),Nt.position={start:yd(ye.start),end:void 0},Ye.push(Nt)),this.stack.push(Nt)}function M(ye){const je=this.stack.pop();je.value+=this.sliceSerialize(ye),je.position.end=yd(ye.end)}function I(ye){const je=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ye=je.children[je.children.length-1];Ye.position.end=yd(ye.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(je.type)&&(L.call(this,ye),M.call(this,ye))}function A(){this.data.atHardBreak=!0}function P(){const ye=this.resume(),je=this.stack[this.stack.length-1];je.value=ye}function B(){const ye=this.resume(),je=this.stack[this.stack.length-1];je.value=ye}function F(){const ye=this.resume(),je=this.stack[this.stack.length-1];je.value=ye}function O(){const ye=this.stack[this.stack.length-1];if(this.data.inReference){const je=this.data.referenceType||"shortcut";ye.type+="Reference",ye.referenceType=je,delete ye.url,delete ye.title}else delete ye.identifier,delete ye.label;this.data.referenceType=void 0}function X(){const ye=this.stack[this.stack.length-1];if(this.data.inReference){const je=this.data.referenceType||"shortcut";ye.type+="Reference",ye.referenceType=je,delete ye.url,delete ye.title}else delete ye.identifier,delete ye.label;this.data.referenceType=void 0}function z(ye){const je=this.sliceSerialize(ye),Ye=this.stack[this.stack.length-2];Ye.label=ppe(je),Ye.identifier=Dl(je).toLowerCase()}function U(){const ye=this.stack[this.stack.length-1],je=this.resume(),Ye=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ye.type==="link"){const Nt=ye.children;Ye.children=Nt}else Ye.alt=je}function D(){const ye=this.resume(),je=this.stack[this.stack.length-1];je.url=ye}function G(){const ye=this.resume(),je=this.stack[this.stack.length-1];je.title=ye}function q(){this.data.inReference=void 0}function N(){this.data.referenceType="collapsed"}function ee(ye){const je=this.resume(),Ye=this.stack[this.stack.length-1];Ye.label=je,Ye.identifier=Dl(this.sliceSerialize(ye)).toLowerCase(),this.data.referenceType="full"}function re(ye){this.data.characterReferenceType=ye.type}function Q(ye){const je=this.sliceSerialize(ye),Ye=this.data.characterReferenceType;let Nt;Ye?(Nt=ZU(je,Ye==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Nt=nA(je);const Rt=this.stack[this.stack.length-1];Rt.value+=Nt}function K(ye){const je=this.stack.pop();je.position.end=yd(ye.end)}function se(ye){M.call(this,ye);const je=this.stack[this.stack.length-1];je.url=this.sliceSerialize(ye)}function te(ye){M.call(this,ye);const je=this.stack[this.stack.length-1];je.url="mailto:"+this.sliceSerialize(ye)}function ce(){return{type:"blockquote",children:[]}}function oe(){return{type:"code",lang:null,meta:null,value:""}}function de(){return{type:"inlineCode",value:""}}function Te(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function qe(){return{type:"emphasis",children:[]}}function Ne(){return{type:"heading",depth:0,children:[]}}function ge(){return{type:"break"}}function Ee(){return{type:"html",value:""}}function _t(){return{type:"image",title:null,url:"",alt:null}}function Ct(){return{type:"link",title:null,url:"",children:[]}}function Je(ye){return{type:"list",ordered:ye.type==="listOrdered",start:null,spread:ye._spread,children:[]}}function at(ye){return{type:"listItem",spread:ye._spread,checked:null,children:[]}}function Oe(){return{type:"paragraph",children:[]}}function Fe(){return{type:"strong",children:[]}}function ue(){return{type:"text",value:""}}function vt(){return{type:"thematicBreak"}}}function yd(e){return{line:e.line,column:e.column,offset:e.offset}}function uV(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?uV(e,s):vpe(e,s)}}function vpe(e,t){let n;for(n in t)if(cV.call(t,n))switch(n){case"canContainEols":{const s=t[n];s&&e[n].push(...s);break}case"transforms":{const s=t[n];s&&e[n].push(...s);break}case"enter":case"exit":{const s=t[n];s&&Object.assign(e[n],s);break}}}function Kj(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+q1({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+q1({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+q1({start:t.start,end:t.end})+") is still open")}function wpe(e){const t=this;t.parser=n;function n(s){return ype(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function xpe(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function kpe(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
`}]}function _pe(e,t){const n=t.value?t.value+`
`:"",s={},r=t.lang?t.lang.split(/\s+/):[];r.length>0&&(s.className=["language-"+r[0]]);let i={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function Spe(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Cpe(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Tpe(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),r=K0(s.toLowerCase()),i=e.footnoteOrder.indexOf(s);let o,a=e.footnoteCounts.get(s);a===void 0?(a=0,e.footnoteOrder.push(s),o=e.footnoteOrder.length):o=i+1,a+=1,e.footnoteCounts.set(s,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+r,id:n+"fnref-"+r+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)}function Epe(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Ape(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function dV(e,t){const n=t.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const r=e.all(t),i=r[0];i&&i.type==="text"?i.value="["+i.value:r.unshift({type:"text",value:"["});const o=r[r.length-1];return o&&o.type==="text"?o.value+=s:r.push({type:"text",value:s}),r}function Mpe(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return dV(e,t);const r={src:K0(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(r.title=s.title);const i={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,i),e.applyData(t,i)}function Npe(e,t){const n={src:K0(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,s),e.applyData(t,s)}function Ipe(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,s),e.applyData(t,s)}function Rpe(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return dV(e,t);const r={href:K0(s.url||"")};s.title!==null&&s.title!==void 0&&(r.title=s.title);const i={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function jpe(e,t){const n={href:K0(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function Lpe(e,t,n){const s=e.all(t),r=n?Dpe(n):hV(t),i={},o=[];if(typeof t.checked=="boolean"){const d=s[0];let h;d&&d.type==="element"&&d.tagName==="p"?h=d:(h={type:"element",tagName:"p",properties:{},children:[]},s.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let a=-1;for(;++a<s.length;){const d=s[a];(r||a!==0||d.type!=="element"||d.tagName!=="p")&&o.push({type:"text",value:`
`}),d.type==="element"&&d.tagName==="p"&&!r?o.push(...d.children):o.push(d)}const l=s[s.length-1];l&&(r||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
`});const c={type:"element",tagName:"li",properties:i,children:o};return e.patch(t,c),e.applyData(t,c)}function Dpe(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let s=-1;for(;!t&&++s<n.length;)t=hV(n[s])}return t}function hV(e){const t=e.spread;return t??e.children.length>1}function Ope(e,t){const n={},s=e.all(t);let r=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++r<s.length;){const o=s[r];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function Ppe(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Bpe(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function $pe(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function zpe(e,t){const n=e.all(t),s=n.shift(),r=[];if(s){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(t.children[0],o),r.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=QE(t.children[1]),l=VU(t.children[t.children.length-1]);a&&l&&(o.position={start:a,end:l}),r.push(o)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function Fpe(e,t,n){const s=n?n.children:void 0,i=(s?s.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,a=o?o.length:t.children.length;let l=-1;const c=[];for(;++l<a;){const h=t.children[l],f={},p=o?o[l]:void 0;p&&(f.align=p);let g={type:"element",tagName:i,properties:f,children:[]};h&&(g.children=e.all(h),e.patch(h,g),g=e.applyData(h,g)),c.push(g)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,d),e.applyData(t,d)}function qpe(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Yj=9,Xj=32;function Hpe(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),r=0;const i=[];for(;s;)i.push(Qj(t.slice(r,s.index),r>0,!0),s[0]),r=s.index+s[0].length,s=n.exec(t);return i.push(Qj(t.slice(r),r>0,!1)),i.join("")}function Qj(e,t,n){let s=0,r=e.length;if(t){let i=e.codePointAt(s);for(;i===Yj||i===Xj;)s++,i=e.codePointAt(s)}if(n){let i=e.codePointAt(r-1);for(;i===Yj||i===Xj;)r--,i=e.codePointAt(r-1)}return r>s?e.slice(s,r):""}function Upe(e,t){const n={type:"text",value:Hpe(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Vpe(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const Wpe={blockquote:xpe,break:kpe,code:_pe,delete:Spe,emphasis:Cpe,footnoteReference:Tpe,heading:Epe,html:Ape,imageReference:Mpe,image:Npe,inlineCode:Ipe,linkReference:Rpe,link:jpe,listItem:Lpe,list:Ope,paragraph:Ppe,root:Bpe,strong:$pe,table:zpe,tableCell:qpe,tableRow:Fpe,text:Upe,thematicBreak:Vpe,toml:Bv,yaml:Bv,definition:Bv,footnoteDefinition:Bv};function Bv(){}const fV=-1,S_=0,U1=1,Mk=2,rA=3,iA=4,oA=5,aA=6,mV=7,pV=8,Jj=typeof self=="object"?self:globalThis,Gpe=(e,t)=>{const n=(r,i)=>(e.set(i,r),r),s=r=>{if(e.has(r))return e.get(r);const[i,o]=t[r];switch(i){case S_:case fV:return n(o,r);case U1:{const a=n([],r);for(const l of o)a.push(s(l));return a}case Mk:{const a=n({},r);for(const[l,c]of o)a[s(l)]=s(c);return a}case rA:return n(new Date(o),r);case iA:{const{source:a,flags:l}=o;return n(new RegExp(a,l),r)}case oA:{const a=n(new Map,r);for(const[l,c]of o)a.set(s(l),s(c));return a}case aA:{const a=n(new Set,r);for(const l of o)a.add(s(l));return a}case mV:{const{name:a,message:l}=o;return n(new Jj[a](l),r)}case pV:return n(BigInt(o),r);case"BigInt":return n(Object(BigInt(o)),r);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return n(new DataView(a),o)}}return n(new Jj[i](o),r)};return s},Zj=e=>Gpe(new Map,e)(0),Wm="",{toString:Kpe}={},{keys:Ype}=Object,zg=e=>{const t=typeof e;if(t!=="object"||!e)return[S_,t];const n=Kpe.call(e).slice(8,-1);switch(n){case"Array":return[U1,Wm];case"Object":return[Mk,Wm];case"Date":return[rA,Wm];case"RegExp":return[iA,Wm];case"Map":return[oA,Wm];case"Set":return[aA,Wm];case"DataView":return[U1,n]}return n.includes("Array")?[U1,n]:n.includes("Error")?[mV,n]:[Mk,n]},$v=([e,t])=>e===S_&&(t==="function"||t==="symbol"),Xpe=(e,t,n,s)=>{const r=(o,a)=>{const l=s.push(o)-1;return n.set(a,l),l},i=o=>{if(n.has(o))return n.get(o);let[a,l]=zg(o);switch(a){case S_:{let d=o;switch(l){case"bigint":a=pV,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);d=null;break;case"undefined":return r([fV],o)}return r([a,d],o)}case U1:{if(l){let f=o;return l==="DataView"?f=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(f=new Uint8Array(o)),r([l,[...f]],o)}const d=[],h=r([a,d],o);for(const f of o)d.push(i(f));return h}case Mk:{if(l)switch(l){case"BigInt":return r([l,o.toString()],o);case"Boolean":case"Number":case"String":return r([l,o.valueOf()],o)}if(t&&"toJSON"in o)return i(o.toJSON());const d=[],h=r([a,d],o);for(const f of Ype(o))(e||!$v(zg(o[f])))&&d.push([i(f),i(o[f])]);return h}case rA:return r([a,o.toISOString()],o);case iA:{const{source:d,flags:h}=o;return r([a,{source:d,flags:h}],o)}case oA:{const d=[],h=r([a,d],o);for(const[f,p]of o)(e||!($v(zg(f))||$v(zg(p))))&&d.push([i(f),i(p)]);return h}case aA:{const d=[],h=r([a,d],o);for(const f of o)(e||!$v(zg(f)))&&d.push(i(f));return h}}const{message:c}=o;return r([a,{name:l,message:c}],o)};return i},eL=(e,{json:t,lossy:n}={})=>{const s=[];return Xpe(!(t||n),!!t,new Map,s)(e),s},Nk=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Zj(eL(e,t)):structuredClone(e):(e,t)=>Zj(eL(e,t));function Qpe(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function Jpe(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Zpe(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Qpe,s=e.options.footnoteBackLabel||Jpe,r=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l<e.footnoteOrder.length;){const c=e.footnoteById.get(e.footnoteOrder[l]);if(!c)continue;const d=e.all(c),h=String(c.identifier).toUpperCase(),f=K0(h.toLowerCase());let p=0;const g=[],y=e.footnoteCounts.get(h);for(;y!==void 0&&++p<=y;){g.length>0&&g.push({type:"text",value:" "});let b=typeof n=="string"?n:n(l,p);typeof b=="string"&&(b={type:"text",value:b}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+f+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(l,p),className:["data-footnote-backref"]},children:Array.isArray(b)?b:[b]})}const w=d[d.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const b=w.children[w.children.length-1];b&&b.type==="text"?b.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...g)}else d.push(...g);const v={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(d,!0)};e.patch(c,v),a.push(v)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Nk(o),id:"footnote-label"},children:[{type:"text",value:r}]},{type:"text",value:`
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
`}]}}const xb=function(e){if(e==null)return s0e;if(typeof e=="function")return C_(e);if(typeof e=="object")return Array.isArray(e)?e0e(e):t0e(e);if(typeof e=="string")return n0e(e);throw new Error("Expected function, string, or object as test")};function e0e(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=xb(e[n]);return C_(s);function s(...r){let i=-1;for(;++i<t.length;)if(t[i].apply(this,r))return!0;return!1}}function t0e(e){const t=e;return C_(n);function n(s){const r=s;let i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function n0e(e){return C_(t);function t(n){return n&&n.type===e}}function C_(e){return t;function t(n,s,r){return!!(r0e(n)&&e.call(this,n,typeof s=="number"?s:void 0,r||void 0))}}function s0e(){return!0}function r0e(e){return e!==null&&typeof e=="object"&&"type"in e}const gV=[],i0e=!0,oT=!1,yV="skip";function lA(e,t,n,s){let r;typeof t=="function"&&typeof n!="function"?(s=n,n=t):r=t;const i=xb(r),o=s?-1:1;a(e,void 0,[])();function a(l,c,d){const h=l&&typeof l=="object"?l:{};if(typeof h.type=="string"){const p=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(l.type+(p?"<"+p+">":""))+")"})}return f;function f(){let p=gV,g,y,w;if((!t||i(l,c,d[d.length-1]||void 0))&&(p=o0e(n(l,d)),p[0]===oT))return p;if("children"in l&&l.children){const v=l;if(v.children&&p[0]!==yV)for(y=(s?v.children.length:-1)+o,w=d.concat(v);y>-1&&y<v.children.length;){const b=v.children[y];if(g=a(b,y,w)(),g[0]===oT)return g;y=typeof g[1]=="number"?g[1]:y+o}}return p}}}function o0e(e){return Array.isArray(e)?e:typeof e=="number"?[i0e,e]:e==null?gV:[e]}function cA(e,t,n,s){let r,i,o;typeof t=="function"&&typeof n!="function"?(i=void 0,o=t,r=n):(i=t,o=n,r=s),lA(e,i,a,r);function a(l,c){const d=c[c.length-1],h=d?d.children.indexOf(l):void 0;return o(l,h,d)}}const aT={}.hasOwnProperty,a0e={};function l0e(e,t){const n=t||a0e,s=new Map,r=new Map,i=new Map,o={...Wpe,...n.handlers},a={all:c,applyData:u0e,definitionById:s,footnoteById:r,footnoteCounts:i,footnoteOrder:[],handlers:o,one:l,options:n,patch:c0e,wrap:h0e};return cA(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const h=d.type==="definition"?s:r,f=String(d.identifier).toUpperCase();h.has(f)||h.set(f,d)}}),a;function l(d,h){const f=d.type,p=a.handlers[f];if(aT.call(a.handlers,f)&&p)return p(a,d,h);if(a.options.passThrough&&a.options.passThrough.includes(f)){if("children"in d){const{children:y,...w}=d,v=Nk(w);return v.children=a.all(d),v}return Nk(d)}return(a.options.unknownHandler||d0e)(a,d,h)}function c(d){const h=[];if("children"in d){const f=d.children;let p=-1;for(;++p<f.length;){const g=a.one(f[p],d);if(g){if(p&&f[p-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=tL(g.value)),!Array.isArray(g)&&g.type==="element")){const y=g.children[0];y&&y.type==="text"&&(y.value=tL(y.value))}Array.isArray(g)?h.push(...g):h.push(g)}}}return h}}function c0e(e,t){e.position&&(t.position=Jhe(e))}function u0e(e,t){let n=t;if(e&&e.data){const s=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;if(typeof s=="string")if(n.type==="element")n.tagName=s;else{const o="children"in n?n.children:[n];n={type:"element",tagName:s,properties:{},children:o}}n.type==="element"&&i&&Object.assign(n.properties,Nk(i)),"children"in n&&n.children&&r!==null&&r!==void 0&&(n.children=r)}return n}function d0e(e,t){const n=t.data||{},s="value"in t&&!(aT.call(n,"hProperties")||aT.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function h0e(e,t){const n=[];let s=-1;for(t&&n.push({type:"text",value:`
`});++s<e.length;)s&&n.push({type:"text",value:`
`}),n.push(e[s]);return t&&e.length>0&&n.push({type:"text",value:`
`}),n}function tL(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function nL(e,t){const n=l0e(e,t),s=n.one(e,void 0),r=Zpe(n),i=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return r&&i.children.push({type:"text",value:`
`},r),i}function f0e(e,t){return e&&"run"in e?async function(n,s){const r=nL(n,{file:s,...t});await e.run(r,s)}:function(n,s){return nL(n,{file:s,...e||t})}}function sL(e){if(e)throw e}var yx=Object.prototype.hasOwnProperty,bV=Object.prototype.toString,rL=Object.defineProperty,iL=Object.getOwnPropertyDescriptor,oL=function(t){return typeof Array.isArray=="function"?Array.isArray(t):bV.call(t)==="[object Array]"},aL=function(t){if(!t||bV.call(t)!=="[object Object]")return!1;var n=yx.call(t,"constructor"),s=t.constructor&&t.constructor.prototype&&yx.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!s)return!1;var r;for(r in t);return typeof r>"u"||yx.call(t,r)},lL=function(t,n){rL&&n.name==="__proto__"?rL(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},cL=function(t,n){if(n==="__proto__")if(yx.call(t,n)){if(iL)return iL(t,n).value}else return;return t[n]},m0e=function e(){var t,n,s,r,i,o,a=arguments[0],l=1,c=arguments.length,d=!1;for(typeof a=="boolean"&&(d=a,a=arguments[1]||{},l=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});l<c;++l)if(t=arguments[l],t!=null)for(n in t)s=cL(a,n),r=cL(t,n),a!==r&&(d&&r&&(aL(r)||(i=oL(r)))?(i?(i=!1,o=s&&oL(s)?s:[]):o=s&&aL(s)?s:{},lL(a,{name:n,newValue:e(d,o,r)})):typeof r<"u"&&lL(a,{name:n,newValue:r}));return a};const T3=W2(m0e);function lT(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function p0e(){const e=[],t={run:n,use:s};return t;function n(...r){let i=-1;const o=r.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...r);function a(l,...c){const d=e[++i];let h=-1;if(l){o(l);return}for(;++h<r.length;)(c[h]===null||c[h]===void 0)&&(c[h]=r[h]);r=c,d?g0e(d,a)(...c):o(null,...c)}}function s(r){if(typeof r!="function")throw new TypeError("Expected `middelware` to be a function, not "+r);return e.push(r),t}}function g0e(e,t){let n;return s;function s(...o){const a=e.length>o.length;let l;a&&o.push(r);try{l=e.apply(this,o)}catch(c){const d=c;if(a&&n)throw d;return r(d)}a||(l&&l.then&&typeof l.then=="function"?l.then(i,r):l instanceof Error?r(l):i(l))}function r(o,...a){n||(n=!0,t(o,...a))}function i(o){r(null,o)}}const dc={basename:y0e,dirname:b0e,extname:v0e,join:w0e,sep:"/"};function y0e(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');kb(e);let n=0,s=-1,r=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;r--;)if(e.codePointAt(r)===47){if(i){n=r+1;break}}else s<0&&(i=!0,s=r+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let o=-1,a=t.length-1;for(;r--;)if(e.codePointAt(r)===47){if(i){n=r+1;break}}else o<0&&(i=!0,o=r+1),a>-1&&(e.codePointAt(r)===t.codePointAt(a--)?a<0&&(s=r):(a=-1,s=o));return n===s?s=o:s<0&&(s=e.length),e.slice(n,s)}function b0e(e){if(kb(e),e.length===0)return".";let t=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){t=n;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function v0e(e){kb(e);let t=e.length,n=-1,s=0,r=-1,i=0,o;for(;t--;){const a=e.codePointAt(t);if(a===47){if(o){s=t+1;break}continue}n<0&&(o=!0,n=t+1),a===46?r<0?r=t:i!==1&&(i=1):r>-1&&(i=-1)}return r<0||n<0||i===0||i===1&&r===n-1&&r===s+1?"":e.slice(r,n)}function w0e(...e){let t=-1,n;for(;++t<e.length;)kb(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":x0e(n)}function x0e(e){kb(e);const t=e.codePointAt(0)===47;let n=k0e(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function k0e(e,t){let n="",s=0,r=-1,i=0,o=-1,a,l;for(;++o<=e.length;){if(o<e.length)a=e.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(r===o-1||i===1))if(r!==o-1&&i===2){if(n.length<2||s!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",s=0):(n=n.slice(0,l),s=n.length-1-n.lastIndexOf("/")),r=o,i=0;continue}}else if(n.length>0){n="",s=0,r=o,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(r+1,o):n=e.slice(r+1,o),s=o-r-1;r=o,i=0}else a===46&&i>-1?i++:i=-1}return n}function kb(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const _0e={cwd:S0e};function S0e(){return"/"}function cT(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function C0e(e){if(typeof e=="string")e=new URL(e);else if(!cT(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return T0e(e)}function T0e(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const s=t.codePointAt(n+2);if(s===70||s===102){const r=new TypeError("File URL path must not include encoded / characters");throw r.code="ERR_INVALID_FILE_URL_PATH",r}}return decodeURIComponent(t)}const E3=["history","path","basename","stem","extname","dirname"];class vV{constructor(t){let n;t?cT(t)?n={path:t}:typeof t=="string"||E0e(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":_0e.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<E3.length;){const i=E3[s];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let r;for(r in n)E3.includes(r)||(this[r]=n[r])}get basename(){return typeof this.path=="string"?dc.basename(this.path):void 0}set basename(t){M3(t,"basename"),A3(t,"basename"),this.path=dc.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?dc.dirname(this.path):void 0}set dirname(t){uL(this.basename,"dirname"),this.path=dc.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?dc.extname(this.path):void 0}set extname(t){if(A3(t,"extname"),uL(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=dc.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){cT(t)&&(t=C0e(t)),M3(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?dc.basename(this.path,this.extname):void 0}set stem(t){M3(t,"stem"),A3(t,"stem"),this.path=dc.join(this.dirname||"",t+(this.extname||""))}fail(t,n,s){const r=this.message(t,n,s);throw r.fatal=!0,r}info(t,n,s){const r=this.message(t,n,s);return r.fatal=void 0,r}message(t,n,s){const r=new vo(t,n,s);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function A3(e,t){if(e&&e.includes(dc.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+dc.sep+"`")}function M3(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function uL(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function E0e(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const A0e=function(e){const s=this.constructor.prototype,r=s[e],i=function(){return r.apply(i,arguments)};return Object.setPrototypeOf(i,s),i},M0e={}.hasOwnProperty;class uA extends A0e{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=p0e()}copy(){const t=new uA;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(T3(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(R3("data",this.frozen),this.namespace[t]=n,this):M0e.call(this.namespace,t)&&this.namespace[t]||void 0:t?(R3("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const r=n.call(t,...s);typeof r=="function"&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=zv(t),s=this.parser||this.Parser;return N3("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),N3("process",this.parser||this.Parser),I3("process",this.compiler||this.Compiler),n?r(void 0,n):new Promise(r);function r(i,o){const a=zv(t),l=s.parse(a);s.run(l,a,function(d,h,f){if(d||!h||!f)return c(d);const p=h,g=s.stringify(p,f);R0e(g)?f.value=g:f.result=g,c(d,f)});function c(d,h){d||!h?o(d):i?i(h):n(void 0,h)}}}processSync(t){let n=!1,s;return this.freeze(),N3("processSync",this.parser||this.Parser),I3("processSync",this.compiler||this.Compiler),this.process(t,r),hL("processSync","process",n),s;function r(i,o){n=!0,sL(i),s=o}}run(t,n,s){dL(t),this.freeze();const r=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?i(void 0,s):new Promise(i);function i(o,a){const l=zv(n);r.run(t,l,c);function c(d,h,f){const p=h||t;d?a(d):o?o(p):s(void 0,p,f)}}}runSync(t,n){let s=!1,r;return this.run(t,n,i),hL("runSync","run",s),r;function i(o,a){sL(o),r=a,s=!0}}stringify(t,n){this.freeze();const s=zv(n),r=this.compiler||this.Compiler;return I3("stringify",r),dL(t),r(t,s)}use(t,...n){const s=this.attachers,r=this.namespace;if(R3("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?a(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[d,...h]=c;l(d,h)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(r.settings=T3(!0,r.settings,c.settings))}function a(c){let d=-1;if(c!=null)if(Array.isArray(c))for(;++d<c.length;){const h=c[d];i(h)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,d){let h=-1,f=-1;for(;++h<s.length;)if(s[h][0]===c){f=h;break}if(f===-1)s.push([c,...d]);else if(d.length>0){let[p,...g]=d;const y=s[f][1];lT(y)&&lT(p)&&(p=T3(!0,y,p)),s[f]=[c,p,...g]}}}}const N0e=new uA().freeze();function N3(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function I3(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function R3(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function dL(e){if(!lT(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function hL(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function zv(e){return I0e(e)?e:new vV(e)}function I0e(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function R0e(e){return typeof e=="string"||j0e(e)}function j0e(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const L0e="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",fL=[],mL={allowDangerousHtml:!0},D0e=/^(https?|ircs?|mailto|xmpp)$/i,O0e=[{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 P0e(e){const t=B0e(e),n=$0e(e);return z0e(t.runSync(t.parse(n),n),e)}function B0e(e){const t=e.rehypePlugins||fL,n=e.remarkPlugins||fL,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...mL}:mL;return N0e().use(wpe).use(n).use(f0e,s).use(t)}function $0e(e){const t=e.children||"",n=new vV;return typeof t=="string"&&(n.value=t),n}function z0e(e,t){const n=t.allowedElements,s=t.allowElement,r=t.components,i=t.disallowedElements,o=t.skipHtml,a=t.unwrapDisallowed,l=t.urlTransform||wV;for(const d of O0e)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+L0e+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),cA(e,c),sfe(e,{Fragment:u.Fragment,components:r,ignoreInvalidStyle:!0,jsx:u.jsx,jsxs:u.jsxs,passKeys:!0,passNode:!0});function c(d,h,f){if(d.type==="raw"&&f&&typeof h=="number")return o?f.children.splice(h,1):f.children[h]={type:"text",value:d.value},h;if(d.type==="element"){let p;for(p in _3)if(Object.hasOwn(_3,p)&&Object.hasOwn(d.properties,p)){const g=d.properties[p],y=_3[p];(y===null||y.includes(d.tagName))&&(d.properties[p]=l(String(g||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):i?i.includes(d.tagName):!1;if(!p&&s&&typeof h=="number"&&(p=!s(d,h,f)),p&&f&&typeof h=="number")return a&&d.children?f.children.splice(h,1,...d.children):f.children.splice(h,1),h}}}function wV(e){const t=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),r=e.indexOf("/");return t===-1||r!==-1&&t>r||n!==-1&&t>n||s!==-1&&t>s||D0e.test(e.slice(0,t))?e:""}function Ik(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let s=0,r=n.indexOf(t);for(;r!==-1;)s++,r=n.indexOf(t,r+t.length);return s}function F0e(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function q0e(e,t,n){const r=xb((n||{}).ignore||[]),i=H0e(t);let o=-1;for(;++o<i.length;)lA(e,"text",a);function a(c,d){let h=-1,f;for(;++h<d.length;){const p=d[h],g=f?f.children:void 0;if(r(p,g?g.indexOf(p):void 0,f))return;f=p}if(f)return l(c,d)}function l(c,d){const h=d[d.length-1],f=i[o][0],p=i[o][1];let g=0;const w=h.children.indexOf(c);let v=!1,b=[];f.lastIndex=0;let x=f.exec(c.value);for(;x;){const k=x.index,T={index:x.index,input:x.input,stack:[...d,c]};let C=p(...x,T);if(typeof C=="string"&&(C=C.length>0?{type:"text",value:C}:void 0),C===!1?f.lastIndex=k+1:(g!==k&&b.push({type:"text",value:c.value.slice(g,k)}),Array.isArray(C)?b.push(...C):C&&b.push(C),g=k+x[0].length,v=!0),!f.global)break;x=f.exec(c.value)}return v?(g<c.value.length&&b.push({type:"text",value:c.value.slice(g)}),h.children.splice(w,1,...b)):b=[c],w+b.length}}function H0e(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<n.length;){const r=n[s];t.push([U0e(r[0]),V0e(r[1])])}return t}function U0e(e){return typeof e=="string"?new RegExp(F0e(e),"g"):e}function V0e(e){return typeof e=="function"?e:function(){return e}}const j3="phrasing",L3=["autolink","link","image","label"];function W0e(){return{transforms:[Z0e],enter:{literalAutolink:K0e,literalAutolinkEmail:D3,literalAutolinkHttp:D3,literalAutolinkWww:D3},exit:{literalAutolink:J0e,literalAutolinkEmail:Q0e,literalAutolinkHttp:Y0e,literalAutolinkWww:X0e}}}function G0e(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:j3,notInConstruct:L3},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:j3,notInConstruct:L3},{character:":",before:"[ps]",after:"\\/",inConstruct:j3,notInConstruct:L3}]}}function K0e(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function D3(e){this.config.enter.autolinkProtocol.call(this,e)}function Y0e(e){this.config.exit.autolinkProtocol.call(this,e)}function X0e(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function Q0e(e){this.config.exit.autolinkEmail.call(this,e)}function J0e(e){this.exit(e)}function Z0e(e){q0e(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,ege],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),tge]],{ignore:["link","linkReference"]})}function ege(e,t,n,s,r){let i="";if(!xV(r)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!nge(n)))return!1;const o=sge(n+s);if(!o[0])return!1;const a={type:"link",title:null,url:i+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[a,{type:"text",value:o[1]}]:a}function tge(e,t,n,s){return!xV(s,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function nge(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function sge(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],s=n.indexOf(")");const r=Ik(e,"(");let i=Ik(e,")");for(;s!==-1&&r>i;)e+=n.slice(0,s+1),n=n.slice(s+1),s=n.indexOf(")"),i++;return[e,n]}function xV(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Xf(n)||k_(n))&&(!t||n!==47)}kV.peek=hge;function rge(){this.buffer()}function ige(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function oge(){this.buffer()}function age(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function lge(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Dl(this.sliceSerialize(e)).toLowerCase(),n.label=t}function cge(e){this.exit(e)}function uge(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Dl(this.sliceSerialize(e)).toLowerCase(),n.label=t}function dge(e){this.exit(e)}function hge(){return"["}function kV(e,t,n,s){const r=n.createTracker(s);let i=r.move("[^");const o=n.enter("footnoteReference"),a=n.enter("reference");return i+=r.move(n.safe(n.associationId(e),{after:"]",before:i})),a(),o(),i+=r.move("]"),i}function fge(){return{enter:{gfmFootnoteCallString:rge,gfmFootnoteCall:ige,gfmFootnoteDefinitionLabelString:oge,gfmFootnoteDefinition:age},exit:{gfmFootnoteCallString:lge,gfmFootnoteCall:cge,gfmFootnoteDefinitionLabelString:uge,gfmFootnoteDefinition:dge}}}function mge(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:kV},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(s,r,i,o){const a=i.createTracker(o);let l=a.move("[^");const c=i.enter("footnoteDefinition"),d=i.enter("label");return l+=a.move(i.safe(i.associationId(s),{before:l,after:"]"})),d(),l+=a.move("]:"),s.children&&s.children.length>0&&(a.shift(4),l+=a.move((t?`
`:" ")+i.indentLines(i.containerFlow(s,a.current()),t?_V:pge))),c(),l}}function pge(e,t,n){return t===0?e:_V(e,t,n)}function _V(e,t,n){return(n?"":"    ")+e}const gge=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];SV.peek=xge;function yge(){return{canContainEols:["delete"],enter:{strikethrough:vge},exit:{strikethrough:wge}}}function bge(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:gge}],handlers:{delete:SV}}}function vge(e){this.enter({type:"delete",children:[]},e)}function wge(e){this.exit(e)}function SV(e,t,n,s){const r=n.createTracker(s),i=n.enter("strikethrough");let o=r.move("~~");return o+=n.containerPhrasing(e,{...r.current(),before:o,after:"~"}),o+=r.move("~~"),i(),o}function xge(){return"~"}function kge(e){return e.length}function _ge(e,t){const n=t||{},s=(n.align||[]).concat(),r=n.stringLength||kge,i=[],o=[],a=[],l=[];let c=0,d=-1;for(;++d<e.length;){const y=[],w=[];let v=-1;for(e[d].length>c&&(c=e[d].length);++v<e[d].length;){const b=Sge(e[d][v]);if(n.alignDelimiters!==!1){const x=r(b);w[v]=x,(l[v]===void 0||x>l[v])&&(l[v]=x)}y.push(b)}o[d]=y,a[d]=w}let h=-1;if(typeof s=="object"&&"length"in s)for(;++h<c;)i[h]=pL(s[h]);else{const y=pL(s);for(;++h<c;)i[h]=y}h=-1;const f=[],p=[];for(;++h<c;){const y=i[h];let w="",v="";y===99?(w=":",v=":"):y===108?w=":":y===114&&(v=":");let b=n.alignDelimiters===!1?1:Math.max(1,l[h]-w.length-v.length);const x=w+"-".repeat(b)+v;n.alignDelimiters!==!1&&(b=w.length+b+v.length,b>l[h]&&(l[h]=b),p[h]=b),f[h]=x}o.splice(1,0,f),a.splice(1,0,p),d=-1;const g=[];for(;++d<o.length;){const y=o[d],w=a[d];h=-1;const v=[];for(;++h<c;){const b=y[h]||"";let x="",k="";if(n.alignDelimiters!==!1){const T=l[h]-(w[h]||0),C=i[h];C===114?x=" ".repeat(T):C===99?T%2?(x=" ".repeat(T/2+.5),k=" ".repeat(T/2-.5)):(x=" ".repeat(T/2),k=x):k=" ".repeat(T)}n.delimiterStart!==!1&&!h&&v.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&b==="")&&(n.delimiterStart!==!1||h)&&v.push(" "),n.alignDelimiters!==!1&&v.push(x),v.push(b),n.alignDelimiters!==!1&&v.push(k),n.padding!==!1&&v.push(" "),(n.delimiterEnd!==!1||h!==c-1)&&v.push("|")}g.push(n.delimiterEnd===!1?v.join("").replace(/ +$/,""):v.join(""))}return g.join(`
`)}function Sge(e){return e==null?"":String(e)}function pL(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}const gL={}.hasOwnProperty;function Cge(e,t){const n=t||{};function s(r,...i){let o=s.invalid;const a=s.handlers;if(r&&gL.call(r,e)){const l=String(r[e]);o=gL.call(a,l)?a[l]:s.unknown}if(o)return o.call(this,r,...i)}return s.handlers=n.handlers||{},s.invalid=n.invalid,s.unknown=n.unknown,s}function Tge(e,t,n,s){const r=n.enter("blockquote"),i=n.createTracker(s);i.move("> "),i.shift(2);const o=n.indentLines(n.containerFlow(e,i.current()),Ege);return r(),o}function Ege(e,t,n){return">"+(n?"":" ")+e}function Age(e,t){return yL(e,t.inConstruct,!0)&&!yL(e,t.notInConstruct,!1)}function yL(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let s=-1;for(;++s<t.length;)if(e.includes(t[s]))return!0;return!1}function bL(e,t,n,s){let r=-1;for(;++r<n.unsafe.length;)if(n.unsafe[r].character===`
`&&Age(n.stack,n.unsafe[r]))return/[ \t]/.test(s.before)?"":" ";return`\\
`}function CV(e,t){const n=String(e);let s=n.indexOf(t),r=s,i=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===r?++i>o&&(o=i):i=1,r=s+t.length,s=n.indexOf(t,r);return o}function Mge(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Nge(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function Ige(e,t,n,s){const r=Nge(n),i=e.value||"",o=r==="`"?"GraveAccent":"Tilde";if(Mge(e,n)){const h=n.enter("codeIndented"),f=n.indentLines(i,Rge);return h(),f}const a=n.createTracker(s),l=r.repeat(Math.max(CV(i,r)+1,3)),c=n.enter("codeFenced");let d=a.move(l);if(e.lang){const h=n.enter(`codeFencedLang${o}`);d+=a.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...a.current()})),h()}if(e.lang&&e.meta){const h=n.enter(`codeFencedMeta${o}`);d+=a.move(" "),d+=a.move(n.safe(e.meta,{before:d,after:`
`,encode:["`"],...a.current()})),h()}return d+=a.move(`
`),i&&(d+=a.move(i+`
`)),d+=a.move(l),c(),d}function Rge(e,t,n){return(n?"":"    ")+e}function dA(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function jge(e,t,n,s){const r=dA(n),i=r==='"'?"Quote":"Apostrophe",o=n.enter("definition");let a=n.enter("label");const l=n.createTracker(s);let c=l.move("[");return c+=l.move(n.safe(n.associationId(e),{before:c,after:"]",...l.current()})),c+=l.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":`
`,...l.current()}))),a(),e.title&&(a=n.enter(`title${i}`),c+=l.move(" "+r),c+=l.move(n.safe(e.title,{before:c,after:r,...l.current()})),c+=l.move(r),a()),o(),c}function Lge(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function xy(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Rk(e,t,n){const s=b0(e),r=b0(t);return s===void 0?r===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:r===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?r===void 0?{inside:!1,outside:!1}:r===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:r===void 0?{inside:!1,outside:!1}:r===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}TV.peek=Dge;function TV(e,t,n,s){const r=Lge(n),i=n.enter("emphasis"),o=n.createTracker(s),a=o.move(r);let l=o.move(n.containerPhrasing(e,{after:r,before:a,...o.current()}));const c=l.charCodeAt(0),d=Rk(s.before.charCodeAt(s.before.length-1),c,r);d.inside&&(l=xy(c)+l.slice(1));const h=l.charCodeAt(l.length-1),f=Rk(s.after.charCodeAt(0),h,r);f.inside&&(l=l.slice(0,-1)+xy(h));const p=o.move(r);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:d.outside},a+l+p}function Dge(e,t,n){return n.options.emphasis||"*"}function Oge(e,t){let n=!1;return cA(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,oT}),!!((!e.depth||e.depth<3)&&tA(e)&&(t.options.setext||n))}function Pge(e,t,n,s){const r=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(s);if(Oge(e,n)){const d=n.enter("headingSetext"),h=n.enter("phrasing"),f=n.containerPhrasing(e,{...i.current(),before:`
`,after:`
`});return h(),d(),f+`
`+(r===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
`))+1))}const o="#".repeat(r),a=n.enter("headingAtx"),l=n.enter("phrasing");i.move(o+" ");let c=n.containerPhrasing(e,{before:"# ",after:`
`,...i.current()});return/^[\t ]/.test(c)&&(c=xy(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,n.options.closeAtx&&(c+=" "+o),l(),a(),c}EV.peek=Bge;function EV(e){return e.value||""}function Bge(){return"<"}AV.peek=$ge;function AV(e,t,n,s){const r=dA(n),i=r==='"'?"Quote":"Apostrophe",o=n.enter("image");let a=n.enter("label");const l=n.createTracker(s);let c=l.move("![");return c+=l.move(n.safe(e.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":")",...l.current()}))),a(),e.title&&(a=n.enter(`title${i}`),c+=l.move(" "+r),c+=l.move(n.safe(e.title,{before:c,after:r,...l.current()})),c+=l.move(r),a()),c+=l.move(")"),o(),c}function $ge(){return"!"}MV.peek=zge;function MV(e,t,n,s){const r=e.referenceType,i=n.enter("imageReference");let o=n.enter("label");const a=n.createTracker(s);let l=a.move("![");const c=n.safe(e.alt,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const h=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=d,i(),r==="full"||!c||c!==h?l+=a.move(h+"]"):r==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function zge(){return"!"}NV.peek=Fge;function NV(e,t,n){let s=e.value||"",r="`",i=-1;for(;new RegExp("(^|[^`])"+r+"([^`]|$)").test(s);)r+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++i<n.unsafe.length;){const o=n.unsafe[i],a=n.compilePattern(o);let l;if(o.atBreak)for(;l=a.exec(s);){let c=l.index;s.charCodeAt(c)===10&&s.charCodeAt(c-1)===13&&c--,s=s.slice(0,c)+" "+s.slice(l.index+1)}}return r+s+r}function Fge(){return"`"}function IV(e,t){const n=tA(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}RV.peek=qge;function RV(e,t,n,s){const r=dA(n),i=r==='"'?"Quote":"Apostrophe",o=n.createTracker(s);let a,l;if(IV(e,n)){const d=n.stack;n.stack=[],a=n.enter("autolink");let h=o.move("<");return h+=o.move(n.containerPhrasing(e,{before:h,after:">",...o.current()})),h+=o.move(">"),a(),n.stack=d,h}a=n.enter("link"),l=n.enter("label");let c=o.move("[");return c+=o.move(n.containerPhrasing(e,{before:c,after:"](",...o.current()})),c+=o.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(n.safe(e.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(l=n.enter("destinationRaw"),c+=o.move(n.safe(e.url,{before:c,after:e.title?" ":")",...o.current()}))),l(),e.title&&(l=n.enter(`title${i}`),c+=o.move(" "+r),c+=o.move(n.safe(e.title,{before:c,after:r,...o.current()})),c+=o.move(r),l()),c+=o.move(")"),a(),c}function qge(e,t,n){return IV(e,n)?"<":"["}jV.peek=Hge;function jV(e,t,n,s){const r=e.referenceType,i=n.enter("linkReference");let o=n.enter("label");const a=n.createTracker(s);let l=a.move("[");const c=n.containerPhrasing(e,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const h=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=d,i(),r==="full"||!c||c!==h?l+=a.move(h+"]"):r==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function Hge(){return"["}function hA(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Uge(e){const t=hA(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Vge(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function LV(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function Wge(e,t,n,s){const r=n.enter("list"),i=n.bulletCurrent;let o=e.ordered?Vge(n):hA(n);const a=e.ordered?o==="."?")":".":Uge(n);let l=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&d&&(!d.children||!d.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),LV(n)===o&&d){let h=-1;for(;++h<e.children.length;){const f=e.children[h];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(o=a),n.bulletCurrent=o;const c=n.containerFlow(e,s);return n.bulletLastUsed=o,n.bulletCurrent=i,r(),c}function Gge(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function Kge(e,t,n,s){const r=Gge(n);let i=n.bulletCurrent||hA(n);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let o=i.length+1;(r==="tab"||r==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const a=n.createTracker(s);a.move(i+" ".repeat(o-i.length)),a.shift(o);const l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,a.current()),d);return l(),c;function d(h,f,p){return f?(p?"":" ".repeat(o))+h:(p?i:i+" ".repeat(o-i.length))+h}}function Yge(e,t,n,s){const r=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(e,s);return i(),r(),o}const Xge=xb(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Qge(e,t,n,s){return(e.children.some(function(o){return Xge(o)})?n.containerPhrasing:n.containerFlow).call(n,e,s)}function Jge(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}DV.peek=Zge;function DV(e,t,n,s){const r=Jge(n),i=n.enter("strong"),o=n.createTracker(s),a=o.move(r+r);let l=o.move(n.containerPhrasing(e,{after:r,before:a,...o.current()}));const c=l.charCodeAt(0),d=Rk(s.before.charCodeAt(s.before.length-1),c,r);d.inside&&(l=xy(c)+l.slice(1));const h=l.charCodeAt(l.length-1),f=Rk(s.after.charCodeAt(0),h,r);f.inside&&(l=l.slice(0,-1)+xy(h));const p=o.move(r+r);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:d.outside},a+l+p}function Zge(e,t,n){return n.options.strong||"*"}function e1e(e,t,n,s){return n.safe(e.value,s)}function t1e(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function n1e(e,t,n){const s=(LV(n)+(n.options.ruleSpaces?" ":"")).repeat(t1e(n));return n.options.ruleSpaces?s.slice(0,-1):s}const OV={blockquote:Tge,break:bL,code:Ige,definition:jge,emphasis:TV,hardBreak:bL,heading:Pge,html:EV,image:AV,imageReference:MV,inlineCode:NV,link:RV,linkReference:jV,list:Wge,listItem:Kge,paragraph:Yge,root:Qge,strong:DV,text:e1e,thematicBreak:n1e};function s1e(){return{enter:{table:r1e,tableData:vL,tableHeader:vL,tableRow:o1e},exit:{codeText:a1e,table:i1e,tableData:O3,tableHeader:O3,tableRow:O3}}}function r1e(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function i1e(e){this.exit(e),this.data.inTable=void 0}function o1e(e){this.enter({type:"tableRow",children:[]},e)}function O3(e){this.exit(e)}function vL(e){this.enter({type:"tableCell",children:[]},e)}function a1e(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,l1e));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function l1e(e,t){return t==="|"?t:e}function c1e(e){const t=e||{},n=t.tableCellPadding,s=t.tablePipeAlign,r=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[	 :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:o,tableCell:l,tableRow:a}};function o(p,g,y,w){return c(d(p,y,w),p.align)}function a(p,g,y,w){const v=h(p,y,w),b=c([v]);return b.slice(0,b.indexOf(`
`))}function l(p,g,y,w){const v=y.enter("tableCell"),b=y.enter("phrasing"),x=y.containerPhrasing(p,{...w,before:i,after:i});return b(),v(),x}function c(p,g){return _ge(p,{align:g,alignDelimiters:s,padding:n,stringLength:r})}function d(p,g,y){const w=p.children;let v=-1;const b=[],x=g.enter("table");for(;++v<w.length;)b[v]=h(w[v],g,y);return x(),b}function h(p,g,y){const w=p.children;let v=-1;const b=[],x=g.enter("tableRow");for(;++v<w.length;)b[v]=l(w[v],p,g,y);return x(),b}function f(p,g,y){let w=OV.inlineCode(p,g,y);return y.stack.includes("tableCell")&&(w=w.replace(/\|/g,"\\$&")),w}}function u1e(){return{exit:{taskListCheckValueChecked:wL,taskListCheckValueUnchecked:wL,paragraph:h1e}}}function d1e(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:f1e}}}function wL(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function h1e(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const s=n.children[0];if(s&&s.type==="text"){const r=t.children;let i=-1,o;for(;++i<r.length;){const a=r[i];if(a.type==="paragraph"){o=a;break}}o===n&&(s.value=s.value.slice(1),s.value.length===0?n.children.shift():n.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,n.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function f1e(e,t,n,s){const r=e.children[0],i=typeof e.checked=="boolean"&&r&&r.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",a=n.createTracker(s);i&&a.move(o);let l=OV.listItem(e,t,n,{...s,...a.current()});return i&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(d){return d+o}}function m1e(){return[W0e(),fge(),yge(),s1e(),u1e()]}function p1e(e){return{extensions:[G0e(),mge(e),bge(),c1e(e),d1e()]}}const g1e={tokenize:k1e,partial:!0},PV={tokenize:_1e,partial:!0},BV={tokenize:S1e,partial:!0},$V={tokenize:C1e,partial:!0},y1e={tokenize:T1e,partial:!0},zV={name:"wwwAutolink",tokenize:w1e,previous:qV},FV={name:"protocolAutolink",tokenize:x1e,previous:HV},Qu={name:"emailAutolink",tokenize:v1e,previous:UV},Fc={};function b1e(){return{text:Fc}}let sf=48;for(;sf<123;)Fc[sf]=Qu,sf++,sf===58?sf=65:sf===91&&(sf=97);Fc[43]=Qu;Fc[45]=Qu;Fc[46]=Qu;Fc[95]=Qu;Fc[72]=[Qu,FV];Fc[104]=[Qu,FV];Fc[87]=[Qu,zV];Fc[119]=[Qu,zV];function v1e(e,t,n){const s=this;let r,i;return o;function o(h){return!uT(h)||!UV.call(s,s.previous)||fA(s.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(h))}function a(h){return uT(h)?(e.consume(h),a):h===64?(e.consume(h),l):n(h)}function l(h){return h===46?e.check(y1e,d,c)(h):h===45||h===95||po(h)?(i=!0,e.consume(h),l):d(h)}function c(h){return e.consume(h),r=!0,l}function d(h){return i&&r&&jo(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function w1e(e,t,n){const s=this;return r;function r(o){return o!==87&&o!==119||!qV.call(s,s.previous)||fA(s.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(g1e,e.attempt(PV,e.attempt(BV,i),n),n)(o))}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function x1e(e,t,n){const s=this;let r="",i=!1;return o;function o(h){return(h===72||h===104)&&HV.call(s,s.previous)&&!fA(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),r+=String.fromCodePoint(h),e.consume(h),a):n(h)}function a(h){if(jo(h)&&r.length<5)return r+=String.fromCodePoint(h),e.consume(h),a;if(h===58){const f=r.toLowerCase();if(f==="http"||f==="https")return e.consume(h),l}return n(h)}function l(h){return h===47?(e.consume(h),i?c:(i=!0,l)):n(h)}function c(h){return h===null||Ak(h)||dr(h)||Xf(h)||k_(h)?n(h):e.attempt(PV,e.attempt(BV,d),n)(h)}function d(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function k1e(e,t,n){let s=0;return r;function r(o){return(o===87||o===119)&&s<3?(s++,e.consume(o),r):o===46&&s===3?(e.consume(o),i):n(o)}function i(o){return o===null?n(o):t(o)}}function _1e(e,t,n){let s,r,i;return o;function o(c){return c===46||c===95?e.check($V,l,a)(c):c===null||dr(c)||Xf(c)||c!==45&&k_(c)?l(c):(i=!0,e.consume(c),o)}function a(c){return c===95?s=!0:(r=s,s=void 0),e.consume(c),o}function l(c){return r||s||!i?n(c):t(c)}}function S1e(e,t){let n=0,s=0;return r;function r(o){return o===40?(n++,e.consume(o),r):o===41&&s<n?i(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check($V,t,i)(o):o===null||dr(o)||Xf(o)?t(o):(e.consume(o),r)}function i(o){return o===41&&s++,e.consume(o),r}}function C1e(e,t,n){return s;function s(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(e.consume(a),s):a===38?(e.consume(a),i):a===93?(e.consume(a),r):a===60||a===null||dr(a)||Xf(a)?t(a):n(a)}function r(a){return a===null||a===40||a===91||dr(a)||Xf(a)?t(a):s(a)}function i(a){return jo(a)?o(a):n(a)}function o(a){return a===59?(e.consume(a),s):jo(a)?(e.consume(a),o):n(a)}}function T1e(e,t,n){return s;function s(i){return e.consume(i),r}function r(i){return po(i)?n(i):t(i)}}function qV(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||dr(e)}function HV(e){return!jo(e)}function UV(e){return!(e===47||uT(e))}function uT(e){return e===43||e===45||e===46||e===95||po(e)}function fA(e){let t=e.length,n=!1;for(;t--;){const s=e[t][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){n=!0;break}if(s._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const E1e={tokenize:D1e,partial:!0};function A1e(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:R1e,continuation:{tokenize:j1e},exit:L1e}},text:{91:{name:"gfmFootnoteCall",tokenize:I1e},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:M1e,resolveTo:N1e}}}}function M1e(e,t,n){const s=this;let r=s.events.length;const i=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o;for(;r--;){const l=s.events[r][1];if(l.type==="labelImage"){o=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!o||!o._balanced)return n(l);const c=Dl(s.sliceSerialize({start:o.end,end:s.now()}));return c.codePointAt(0)!==94||!i.includes(c.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function N1e(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},r={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};r.end.column++,r.end.offset++,r.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},r.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},a=[e[n+1],e[n+2],["enter",s,t],e[n+3],e[n+4],["enter",r,t],["exit",r,t],["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",s,t]];return e.splice(n,e.length-n+1,...a),e}function I1e(e,t,n){const s=this,r=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let i=0,o;return a;function a(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),l}function l(h){return h!==94?n(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(h){if(i>999||h===93&&!o||h===null||h===91||dr(h))return n(h);if(h===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return r.includes(Dl(s.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(h)}return dr(h)||(o=!0),i++,e.consume(h),h===92?d:c}function d(h){return h===91||h===92||h===93?(e.consume(h),i++,c):c(h)}}function R1e(e,t,n){const s=this,r=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let i,o=0,a;return l;function l(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(g){return g===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(g)}function d(g){if(o>999||g===93&&!a||g===null||g===91||dr(g))return n(g);if(g===93){e.exit("chunkString");const y=e.exit("gfmFootnoteDefinitionLabelString");return i=Dl(s.sliceSerialize(y)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return dr(g)||(a=!0),o++,e.consume(g),g===92?h:d}function h(g){return g===91||g===92||g===93?(e.consume(g),o++,d):d(g)}function f(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),r.includes(i)||r.push(i),us(e,p,"gfmFootnoteDefinitionWhitespace")):n(g)}function p(g){return t(g)}}function j1e(e,t,n){return e.check(wb,t,e.attempt(E1e,t,n))}function L1e(e){e.exit("gfmFootnoteDefinition")}function D1e(e,t,n){const s=this;return us(e,r,"gfmFootnoteDefinitionIndent",5);function r(i){const o=s.events[s.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(i):n(i)}}function O1e(e){let n=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:i,resolveAll:r};return n==null&&(n=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function r(o,a){let l=-1;for(;++l<o.length;)if(o[l][0]==="enter"&&o[l][1].type==="strikethroughSequenceTemporary"&&o[l][1]._close){let c=l;for(;c--;)if(o[c][0]==="exit"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._open&&o[l][1].end.offset-o[l][1].start.offset===o[c][1].end.offset-o[c][1].start.offset){o[l][1].type="strikethroughSequence",o[c][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},o[c][1].start),end:Object.assign({},o[l][1].end)},h={type:"strikethroughText",start:Object.assign({},o[c][1].end),end:Object.assign({},o[l][1].start)},f=[["enter",d,a],["enter",o[c][1],a],["exit",o[c][1],a],["enter",h,a]],p=a.parser.constructs.insideSpan.null;p&&Ia(f,f.length,0,__(p,o.slice(c+1,l),a)),Ia(f,f.length,0,[["exit",h,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",d,a]]),Ia(o,c-1,l-c+3,f),l=c+f.length-2;break}}for(l=-1;++l<o.length;)o[l][1].type==="strikethroughSequenceTemporary"&&(o[l][1].type="data");return o}function i(o,a,l){const c=this.previous,d=this.events;let h=0;return f;function f(g){return c===126&&d[d.length-1][1].type!=="characterEscape"?l(g):(o.enter("strikethroughSequenceTemporary"),p(g))}function p(g){const y=b0(c);if(g===126)return h>1?l(g):(o.consume(g),h++,p);if(h<2&&!n)return l(g);const w=o.exit("strikethroughSequenceTemporary"),v=b0(g);return w._open=!v||v===2&&!!y,w._close=!y||y===2&&!!v,a(g)}}}class P1e{constructor(){this.map=[]}add(t,n,s){B1e(this,t,n,s)}consume(t){if(this.map.sort(function(i,o){return i[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const s=[];for(;n>0;)n-=1,s.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];s.push(t.slice()),t.length=0;let r=s.pop();for(;r;){for(const i of r)t.push(i);r=s.pop()}this.map.length=0}}function B1e(e,t,n,s){let r=0;if(!(n===0&&s.length===0)){for(;r<e.map.length;){if(e.map[r][0]===t){e.map[r][1]+=n,e.map[r][2].push(...s);return}r+=1}e.map.push([t,n,s])}}function $1e(e,t){let n=!1;const s=[];for(;t<e.length;){const r=e[t];if(n){if(r[0]==="enter")r[1].type==="tableContent"&&s.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(r[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=s.length-1;s[i]=s[i]==="left"?"center":"right"}}else if(r[1].type==="tableDelimiterRow")break}else r[0]==="enter"&&r[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return s}function z1e(){return{flow:{null:{name:"table",tokenize:F1e,resolveAll:q1e}}}}function F1e(e,t,n){const s=this;let r=0,i=0,o;return a;function a(M){let I=s.events.length-1;for(;I>-1;){const B=s.events[I][1].type;if(B==="lineEnding"||B==="linePrefix")I--;else break}const A=I>-1?s.events[I][1].type:null,P=A==="tableHead"||A==="tableRow"?C:l;return P===C&&s.parser.lazy[s.now().line]?n(M):P(M)}function l(M){return e.enter("tableHead"),e.enter("tableRow"),c(M)}function c(M){return M===124||(o=!0,i+=1),d(M)}function d(M){return M===null?n(M):un(M)?i>1?(i=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),p):n(M):ps(M)?us(e,d,"whitespace")(M):(i+=1,o&&(o=!1,r+=1),M===124?(e.enter("tableCellDivider"),e.consume(M),e.exit("tableCellDivider"),o=!0,d):(e.enter("data"),h(M)))}function h(M){return M===null||M===124||dr(M)?(e.exit("data"),d(M)):(e.consume(M),M===92?f:h)}function f(M){return M===92||M===124?(e.consume(M),h):h(M)}function p(M){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(M):(e.enter("tableDelimiterRow"),o=!1,ps(M)?us(e,g,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):g(M))}function g(M){return M===45||M===58?w(M):M===124?(o=!0,e.enter("tableCellDivider"),e.consume(M),e.exit("tableCellDivider"),y):T(M)}function y(M){return ps(M)?us(e,w,"whitespace")(M):w(M)}function w(M){return M===58?(i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(M),e.exit("tableDelimiterMarker"),v):M===45?(i+=1,v(M)):M===null||un(M)?k(M):T(M)}function v(M){return M===45?(e.enter("tableDelimiterFiller"),b(M)):T(M)}function b(M){return M===45?(e.consume(M),b):M===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(M),e.exit("tableDelimiterMarker"),x):(e.exit("tableDelimiterFiller"),x(M))}function x(M){return ps(M)?us(e,k,"whitespace")(M):k(M)}function k(M){return M===124?g(M):M===null||un(M)?!o||r!==i?T(M):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(M)):T(M)}function T(M){return n(M)}function C(M){return e.enter("tableRow"),S(M)}function S(M){return M===124?(e.enter("tableCellDivider"),e.consume(M),e.exit("tableCellDivider"),S):M===null||un(M)?(e.exit("tableRow"),t(M)):ps(M)?us(e,S,"whitespace")(M):(e.enter("data"),_(M))}function _(M){return M===null||M===124||dr(M)?(e.exit("data"),S(M)):(e.consume(M),M===92?L:_)}function L(M){return M===92||M===124?(e.consume(M),_):_(M)}}function q1e(e,t){let n=-1,s=!0,r=0,i=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,c,d,h;const f=new P1e;for(;++n<e.length;){const p=e[n],g=p[1];p[0]==="enter"?g.type==="tableHead"?(a=!1,l!==0&&(xL(f,t,l,c,d),d=void 0,l=0),c={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},f.add(n,0,[["enter",c,t]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(s=!0,h=void 0,i=[0,0,0,0],o=[0,n+1,0,0],a&&(a=!1,d={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},f.add(n,0,[["enter",d,t]])),r=g.type==="tableDelimiterRow"?2:d?3:1):r&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(s=!1,o[2]===0&&(i[1]!==0&&(o[0]=o[1],h=Fv(f,t,i,r,void 0,h),i=[0,0,0,0]),o[2]=n)):g.type==="tableCellDivider"&&(s?s=!1:(i[1]!==0&&(o[0]=o[1],h=Fv(f,t,i,r,void 0,h)),i=o,o=[i[1],n,0,0])):g.type==="tableHead"?(a=!0,l=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(l=n,i[1]!==0?(o[0]=o[1],h=Fv(f,t,i,r,n,h)):o[1]!==0&&(h=Fv(f,t,o,r,n,h)),r=0):r&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(o[3]=n)}for(l!==0&&xL(f,t,l,c,d),f.consume(t.events),n=-1;++n<t.events.length;){const p=t.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=$1e(t.events,n))}return e}function Fv(e,t,n,s,r,i){const o=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(i.end=Object.assign({},mp(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const l=mp(t.events,n[1]);if(i={type:o,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const c=mp(t.events,n[2]),d=mp(t.events,n[3]),h={type:a,start:Object.assign({},c),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",h,t]]),s!==2){const f=t.events[n[2]],p=t.events[n[3]];if(f[1].end=Object.assign({},p[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const g=n[2]+1,y=n[3]-n[2]-1;e.add(g,y,[])}}e.add(n[3]+1,0,[["exit",h,t]])}return r!==void 0&&(i.end=Object.assign({},mp(t.events,r)),e.add(r,0,[["exit",i,t]]),i=void 0),i}function xL(e,t,n,s,r){const i=[],o=mp(t.events,n);r&&(r.end=Object.assign({},o),i.push(["exit",r,t])),s.end=Object.assign({},o),i.push(["exit",s,t]),e.add(n+1,0,i)}function mp(e,t){const n=e[t],s=n[0]==="enter"?"start":"end";return n[1][s]}const H1e={name:"tasklistCheck",tokenize:V1e};function U1e(){return{text:{91:H1e}}}function V1e(e,t,n){const s=this;return r;function r(l){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),i)}function i(l){return dr(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),o):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),o):n(l)}function o(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):n(l)}function a(l){return un(l)?t(l):ps(l)?e.check({tokenize:W1e},t,n)(l):n(l)}}function W1e(e,t,n){return us(e,s,"whitespace");function s(r){return r===null?n(r):t(r)}}function G1e(e){return JU([b1e(),A1e(),O1e(e),z1e(),U1e()])}const K1e={};function kL(e){const t=this,n=e||K1e,s=t.data(),r=s.micromarkExtensions||(s.micromarkExtensions=[]),i=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),o=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);r.push(G1e(n)),i.push(m1e()),o.push(p1e(n))}function Y1e(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:i},exit:{mathFlow:r,mathFlowFence:s,mathFlowFenceMeta:n,mathFlowValue:a,mathText:o,mathTextData:a}};function e(l){const c={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[c]}},l)}function t(){this.buffer()}function n(){const l=this.resume(),c=this.stack[this.stack.length-1];c.type,c.meta=l}function s(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function r(l){const c=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),d=this.stack[this.stack.length-1];d.type,this.exit(l),d.value=c;const h=d.data.hChildren[0];h.type,h.tagName,h.children.push({type:"text",value:c}),this.data.mathFlowInside=void 0}function i(l){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},l),this.buffer()}function o(l){const c=this.resume(),d=this.stack[this.stack.length-1];d.type,this.exit(l),d.value=c,d.data.hChildren.push({type:"text",value:c})}function a(l){this.config.enter.data.call(this,l),this.config.exit.data.call(this,l)}}function X1e(e){let t=(e||{}).singleDollarTextMath;return t==null&&(t=!0),s.peek=r,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:`
`,inConstruct:"mathFlowMeta"},{character:"$",after:t?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:n,inlineMath:s}};function n(i,o,a,l){const c=i.value||"",d=a.createTracker(l),h="$".repeat(Math.max(CV(c,"$")+1,2)),f=a.enter("mathFlow");let p=d.move(h);if(i.meta){const g=a.enter("mathFlowMeta");p+=d.move(a.safe(i.meta,{after:`
`,before:p,encode:["$"],...d.current()})),g()}return p+=d.move(`
`),c&&(p+=d.move(c+`
`)),p+=d.move(h),f(),p}function s(i,o,a){let l=i.value||"",c=1;for(t||c++;new RegExp("(^|[^$])"+"\\$".repeat(c)+"([^$]|$)").test(l);)c++;const d="$".repeat(c);/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^\$|\$$/.test(l))&&(l=" "+l+" ");let h=-1;for(;++h<a.unsafe.length;){const f=a.unsafe[h];if(!f.atBreak)continue;const p=a.compilePattern(f);let g;for(;g=p.exec(l);){let y=g.index;l.codePointAt(y)===10&&l.codePointAt(y-1)===13&&y--,l=l.slice(0,y)+" "+l.slice(g.index+1)}}return d+l+d}function r(){return"$"}}const Q1e={tokenize:J1e,concrete:!0,name:"mathFlow"},_L={tokenize:Z1e,partial:!0};function J1e(e,t,n){const s=this,r=s.events[s.events.length-1],i=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0;let o=0;return a;function a(b){return e.enter("mathFlow"),e.enter("mathFlowFence"),e.enter("mathFlowFenceSequence"),l(b)}function l(b){return b===36?(e.consume(b),o++,l):o<2?n(b):(e.exit("mathFlowFenceSequence"),us(e,c,"whitespace")(b))}function c(b){return b===null||un(b)?h(b):(e.enter("mathFlowFenceMeta"),e.enter("chunkString",{contentType:"string"}),d(b))}function d(b){return b===null||un(b)?(e.exit("chunkString"),e.exit("mathFlowFenceMeta"),h(b)):b===36?n(b):(e.consume(b),d)}function h(b){return e.exit("mathFlowFence"),s.interrupt?t(b):e.attempt(_L,f,w)(b)}function f(b){return e.attempt({tokenize:v,partial:!0},w,p)(b)}function p(b){return(i?us(e,g,"linePrefix",i+1):g)(b)}function g(b){return b===null?w(b):un(b)?e.attempt(_L,f,w)(b):(e.enter("mathFlowValue"),y(b))}function y(b){return b===null||un(b)?(e.exit("mathFlowValue"),g(b)):(e.consume(b),y)}function w(b){return e.exit("mathFlow"),t(b)}function v(b,x,k){let T=0;return us(b,C,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function C(L){return b.enter("mathFlowFence"),b.enter("mathFlowFenceSequence"),S(L)}function S(L){return L===36?(T++,b.consume(L),S):T<o?k(L):(b.exit("mathFlowFenceSequence"),us(b,_,"whitespace")(L))}function _(L){return L===null||un(L)?(b.exit("mathFlowFence"),x(L)):k(L)}}}function Z1e(e,t,n){const s=this;return r;function r(o){return o===null?t(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return s.parser.lazy[s.now().line]?n(o):t(o)}}function eye(e){let n=(e||{}).singleDollarTextMath;return n==null&&(n=!0),{tokenize:s,resolve:tye,previous:nye,name:"mathText"};function s(r,i,o){let a=0,l,c;return d;function d(y){return r.enter("mathText"),r.enter("mathTextSequence"),h(y)}function h(y){return y===36?(r.consume(y),a++,h):a<2&&!n?o(y):(r.exit("mathTextSequence"),f(y))}function f(y){return y===null?o(y):y===36?(c=r.enter("mathTextSequence"),l=0,g(y)):y===32?(r.enter("space"),r.consume(y),r.exit("space"),f):un(y)?(r.enter("lineEnding"),r.consume(y),r.exit("lineEnding"),f):(r.enter("mathTextData"),p(y))}function p(y){return y===null||y===32||y===36||un(y)?(r.exit("mathTextData"),f(y)):(r.consume(y),p)}function g(y){return y===36?(r.consume(y),l++,g):l===a?(r.exit("mathTextSequence"),r.exit("mathText"),i(y)):(c.type="mathTextData",p(y))}}}function tye(e){let t=e.length-4,n=3,s,r;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s<t;)if(e[s][1].type==="mathTextData"){e[t][1].type="mathTextPadding",e[n][1].type="mathTextPadding",n+=2,t-=2;break}}for(s=n-1,t++;++s<=t;)r===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(r=s):(s===t||e[s][1].type==="lineEnding")&&(e[r][1].type="mathTextData",s!==r+2&&(e[r][1].end=e[s-1][1].end,e.splice(r+2,s-r-2),t-=s-r-2,s=r+2),r=void 0);return e}function nye(e){return e!==36||this.events[this.events.length-1][1].type==="characterEscape"}function sye(e){return{flow:{36:Q1e},text:{36:eye(e)}}}class dt extends Error{constructor(t,n){var s="KaTeX parse error: "+t,r,i,o=n&&n.loc;if(o&&o.start<=o.end){var a=o.lexer.input;r=o.start,i=o.end,r===a.length?s+=" at end of input: ":s+=" at position "+(r+1)+": ";var l=a.slice(r,i).replace(/[^]/g,"$&̲"),c;r>15?c="…"+a.slice(r-15,r):c=a.slice(0,r);var d;i+15<a.length?d=a.slice(i,i+15)+"…":d=a.slice(i),s+=c+l+d}super(s),this.name="ParseError",this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,dt.prototype),this.position=r,r!=null&&i!=null&&(this.length=i-r),this.rawMessage=t}}var rye=/([A-Z])/g,iye=e=>e.replace(rye,"-$1").toLowerCase(),oye={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},aye=/[&><"']/g,go=e=>String(e).replace(aye,t=>oye[t]),bx=e=>e.type==="ordgroup"||e.type==="color"?e.body.length===1?bx(e.body[0]):e:e.type==="font"?bx(e.body):e,lye=new Set(["mathord","textord","atom"]),Ju=e=>lye.has(bx(e).type),cye=e=>{var t=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);return t?t[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():"_relative"},jk={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:e=>"#"+e},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:e=>Math.max(0,e),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:e=>Math.max(0,e),cli:"-e, --max-expand <n>",cliProcessor:e=>e==="Infinity"?1/0:parseInt(e)},globalGroup:{type:"boolean",cli:!1}};function uye(e){if(typeof e!="string")return e.enum[0];switch(e){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{};default:throw new Error("Unexpected schema type; settings must declare an explicit default.")}}function dye(e){if(e.default!==void 0)return e.default;var t=Array.isArray(e.type)?e.type[0]:e.type;return uye(t)}function hye(e,t,n,s){var r=n[t];e[t]=r!==void 0?s.processor?s.processor(r):r:dye(s)}class mA{constructor(t){t===void 0&&(t={}),this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,t=t||{};for(var n of Object.keys(jk)){var s=jk[n];s&&hye(this,n,t,s)}}reportNonstrict(t,n,s){var r=this.strict;if(typeof r=="function"&&(r=r(t,n,s)),!(!r||r==="ignore")){if(r===!0||r==="error")throw new dt("LaTeX-incompatible input and strict mode is set to 'error': "+(n+" ["+t+"]"),s);r==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+t+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+r+"': "+n+" ["+t+"]"))}}useStrictBehavior(t,n,s){var r=this.strict;if(typeof r=="function")try{r=r(t,n,s)}catch{r="error"}return!r||r==="ignore"?!1:r===!0||r==="error"?!0:r==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+t+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+r+"': "+n+" ["+t+"]")),!1)}isTrusted(t){if("url"in t&&t.url&&!t.protocol){var n=cye(t.url);if(n==null)return!1;t.protocol=n}var s=typeof this.trust=="function"?this.trust(t):this.trust;return!!s}}let bd=class{constructor(t,n,s){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=t,this.size=n,this.cramped=s}sup(){return fc[fye[this.id]]}sub(){return fc[mye[this.id]]}fracNum(){return fc[pye[this.id]]}fracDen(){return fc[gye[this.id]]}cramp(){return fc[yye[this.id]]}text(){return fc[bye[this.id]]}isTight(){return this.size>=2}};var pA=0,Lk=1,Gp=2,Eu=3,ky=4,hl=5,v0=6,Oo=7,fc=[new bd(pA,0,!1),new bd(Lk,0,!0),new bd(Gp,1,!1),new bd(Eu,1,!0),new bd(ky,2,!1),new bd(hl,2,!0),new bd(v0,3,!1),new bd(Oo,3,!0)],fye=[ky,hl,ky,hl,v0,Oo,v0,Oo],mye=[hl,hl,hl,hl,Oo,Oo,Oo,Oo],pye=[Gp,Eu,ky,hl,v0,Oo,v0,Oo],gye=[Eu,Eu,hl,hl,Oo,Oo,Oo,Oo],yye=[Lk,Lk,Eu,Eu,hl,hl,Oo,Oo],bye=[pA,Lk,Gp,Eu,Gp,Eu,Gp,Eu],On={DISPLAY:fc[pA],TEXT:fc[Gp],SCRIPT:fc[ky],SCRIPTSCRIPT:fc[v0]},dT=[{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 vye(e){for(var t=0;t<dT.length;t++)for(var n=dT[t],s=0;s<n.blocks.length;s++){var r=n.blocks[s];if(e>=r[0]&&e<=r[1])return n.name}return null}var vx=[];dT.forEach(e=>e.blocks.forEach(t=>vx.push(...t)));function VV(e){for(var t=0;t<vx.length;t+=2)if(e>=vx[t]&&e<=vx[t+1])return!0;return!1}var wi=e=>e+" "+e,Gm=80,wye=function(t,n){return"M95,"+(622+t+n)+`
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
c69,-144,104.5,-217.7,106.5,-221
l`+t/2.075+" -"+t+`
c5.3,-9.3,12,-14,20,-14
H400000v`+(40+t)+`H845.2724
s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
M`+(834+t)+" "+n+"h400000v"+(40+t)+"h-400000z"},xye=function(t,n){return"M263,"+(601+t+n)+`c0.7,0,18,39.7,52,119
c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120
c340,-704.7,510.7,-1060.3,512,-1067
l`+t/2.084+" -"+t+`
c4.7,-7.3,11,-11,19,-11
H40000v`+(40+t)+`H1012.3
s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232
c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1
s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26
c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z
M`+(1001+t)+" "+n+"h400000v"+(40+t)+"h-400000z"},kye=function(t,n){return"M983 "+(10+t+n)+`
l`+t/3.13+" -"+t+`
c4,-6.7,10,-10,18,-10 H400000v`+(40+t)+`
H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7
s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744
c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30
c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722
c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5
c53.7,-170.3,84.5,-266.8,92.5,-289.5z
M`+(1001+t)+" "+n+"h400000v"+(40+t)+"h-400000z"},_ye=function(t,n){return"M424,"+(2398+t+n)+`
c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514
c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20
s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121
s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081
l`+t/4.223+" -"+t+`c4,-6.7,10,-10,18,-10 H400000
v`+(40+t)+`H1014.6
s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185
c-2,6,-10,9,-24,9
c-8,0,-12,-0.7,-12,-2z M`+(1001+t)+" "+n+`
h400000v`+(40+t)+"h-400000z"},Sye=function(t,n){return"M473,"+(2713+t+n)+`
c339.3,-1799.3,509.3,-2700,510,-2702 l`+t/5.298+" -"+t+`
c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+t)+`H1017.7
s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9
c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200
c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26
s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,
606zM`+(1001+t)+" "+n+"h400000v"+(40+t)+"H1017.7z"},Cye=function(t){var n=t/2;return"M400000 "+t+" H0 L"+n+" 0 l65 45 L145 "+(t-80)+" H400000z"},Tye=function(t,n,s){var r=s-54-n-t;return"M702 "+(t+n)+"H400000"+(40+t)+`
H742v`+r+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1
h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170
c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667
219 661 l218 661zM702 `+n+"H400000v"+(40+t)+"H742z"},Eye=function(t,n,s){n=1e3*n;var r="";switch(t){case"sqrtMain":r=wye(n,Gm);break;case"sqrtSize1":r=xye(n,Gm);break;case"sqrtSize2":r=kye(n,Gm);break;case"sqrtSize3":r=_ye(n,Gm);break;case"sqrtSize4":r=Sye(n,Gm);break;case"sqrtTall":r=Tye(n,Gm,s)}return r},Aye=function(t,n){switch(t){case"⎜":return wi("M291 0 H417 V"+n+" H291z");case"∣":return wi("M145 0 H188 V"+n+" H145z");case"∥":return wi("M145 0 H188 V"+n+" H145z")+wi("M367 0 H410 V"+n+" H367z");case"⎟":return wi("M457 0 H583 V"+n+" H457z");case"⎢":return wi("M319 0 H403 V"+n+" H319z");case"⎥":return wi("M263 0 H347 V"+n+" H263z");case"⎪":return wi("M384 0 H504 V"+n+" H384z");case"⏐":return wi("M312 0 H355 V"+n+" H312z");case"‖":return wi("M257 0 H300 V"+n+" H257z")+wi("M478 0 H521 V"+n+" H478z");default:return""}},SL={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:wi("M40 281 V428 H0 V94 H40 V241 H400000 v40z"),leftbracketunder:wi("M0 0 h120 V290 H399995 v120 H0z"),leftbracketover:wi("M0 440 h120 V150 H399995 v-120 H0z"),leftmapsto:wi("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:wi("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:wi("M399960 241 V94 h40 V428 h-40 V281 H0 v-40z"),rightbracketunder:wi("M399995 0 h-120 V290 H0 v120 H400000z"),rightbracketover:wi("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`},Mye=function(t,n){switch(t){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v1759 v84 h347 v-84
H403z M403 1759 V0 H319 V1759 v`+n+" v1759 v84 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+n+` v1759 H0 v84 H347z
M347 1759 V0 H263 V1759 v`+n+" v1759 h84z";case"vert":return"M145 15 v585 v"+n+` v585 c2.667,10,9.667,15,21,15
c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15
c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+n+" v585 h43z";case"doublevert":return"M145 15 v585 v"+n+` v585 c2.667,10,9.667,15,21,15
c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15
c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+n+` v585 h43z
M367 15 v585 v`+n+` v585 c2.667,10,9.667,15,21,15
c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15
c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v`+n+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+n+` v1715 h263 v84 H319z
MM319 602 V0 H403 V602 v`+n+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+n+` v1799 H0 v-84 H319z
MM319 602 V0 H403 V602 v`+n+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v602 h84z
M403 1759 V0 H319 V1759 v`+n+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+n+` v602 h84z
M347 1759 V0 h-84 V1759 v`+n+" v602 h84z";case"lparen":return`M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1
c-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,
-36,557 l0,`+(n+84)+`c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,
949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9
c0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,
-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189
l0,-`+(n+92)+`c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,
-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z`;case"rparen":return`M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,
63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5
c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,`+(n+9)+`
c-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664
c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11
c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17
c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558
l0,-`+(n+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};function Nye(e){return"toText"in e}let Y0=class{constructor(t){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=t,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(t){return this.classes.includes(t)}toNode(){for(var t=document.createDocumentFragment(),n=0;n<this.children.length;n++)t.appendChild(this.children[n].toNode());return t}toMarkup(){for(var t="",n=0;n<this.children.length;n++)t+=this.children[n].toMarkup();return t}toText(){return this.children.map(t=>{if(Nye(t))return t.toText();throw new Error("Expected MathDomNode with toText, got "+t.constructor.name)}).join("")}};var hT={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},Iye={ex:!0,em:!0,mu:!0},WV=function(t){return typeof t!="string"&&(t=t.unit),t in hT||t in Iye||t==="ex"},$r=function(t,n){var s;if(t.unit in hT)s=hT[t.unit]/n.fontMetrics().ptPerEm/n.sizeMultiplier;else if(t.unit==="mu")s=n.fontMetrics().cssEmPerMu;else{var r;if(n.style.isTight()?r=n.havingStyle(n.style.text()):r=n,t.unit==="ex")s=r.fontMetrics().xHeight;else if(t.unit==="em")s=r.fontMetrics().quad;else throw new dt("Invalid unit: '"+t.unit+"'");r!==n&&(s*=r.sizeMultiplier/n.sizeMultiplier)}return Math.min(t.number*s,n.maxSize)},bt=function(t){return+t.toFixed(4)+"em"},gh=function(t){return t.filter(n=>n).join(" ")},gA=function(t){var n="";for(var s of Object.keys(t)){var r=t[s];r!==void 0&&(n+=iye(s)+":"+r+";")}return n},GV=function(t,n,s){if(this.classes=t||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=s||{},n){n.style.isTight()&&this.classes.push("mtight");var r=n.getColor();r&&(this.style.color=r)}},KV=function(t){var n=document.createElement(t);n.className=gh(this.classes),Object.assign(n.style,this.style);for(var s of Object.keys(this.attributes))n.setAttribute(s,this.attributes[s]);for(var r=0;r<this.children.length;r++)n.appendChild(this.children[r].toNode());return n},Rye=/[\s"'>/=\x00-\x1f]/,YV=function(t){var n="<"+t;this.classes.length&&(n+=' class="'+go(gh(this.classes))+'"');var s=gA(this.style);s&&(n+=' style="'+go(s)+'"');for(var r of Object.keys(this.attributes)){if(Rye.test(r))throw new dt("Invalid attribute name '"+r+"'");n+=" "+r+'="'+go(this.attributes[r])+'"'}n+=">";for(var i=0;i<this.children.length;i++)n+=this.children[i].toMarkup();return n+="</"+t+">",n};class X0{constructor(t,n,s,r){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,this.italic=void 0,GV.call(this,t,s,r),this.children=n||[]}setAttribute(t,n){this.attributes[t]=n}hasClass(t){return this.classes.includes(t)}toNode(){return KV.call(this,"span")}toMarkup(){return YV.call(this,"span")}}let T_=class{constructor(t,n,s,r){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,GV.call(this,n,r),this.children=s||[],this.setAttribute("href",t)}setAttribute(t,n){this.attributes[t]=n}hasClass(t){return this.classes.includes(t)}toNode(){return KV.call(this,"a")}toMarkup(){return YV.call(this,"a")}};class jye{constructor(t,n,s){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=n,this.src=t,this.classes=["mord"],this.height=0,this.depth=0,this.maxFontSize=0,this.style=s}hasClass(t){return this.classes.includes(t)}toNode(){var t=document.createElement("img");return t.src=this.src,t.alt=this.alt,t.className="mord",Object.assign(t.style,this.style),t}toMarkup(){var t='<img src="'+go(this.src)+'"'+(' alt="'+go(this.alt)+'"'),n=gA(this.style);return n&&(t+=' style="'+go(n)+'"'),t+="'/>",t}}var Lye={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class Oa{constructor(t,n,s,r,i,o,a,l){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=t,this.height=n||0,this.depth=s||0,this.italic=r||0,this.skew=i||0,this.width=o||0,this.classes=a||[],this.style=l||{},this.maxFontSize=0;var c=vye(this.text.charCodeAt(0));c&&this.classes.push(c+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=Lye[this.text])}hasClass(t){return this.classes.includes(t)}toNode(){var t=document.createTextNode(this.text),n=null;return this.italic>0&&(n=document.createElement("span"),n.style.marginRight=bt(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=gh(this.classes)),Object.keys(this.style).length>0&&(n=n||document.createElement("span"),Object.assign(n.style,this.style)),n?(n.appendChild(t),n):t}toMarkup(){var t=!1,n="<span";this.classes.length&&(t=!0,n+=' class="',n+=go(gh(this.classes)),n+='"');var s="";this.italic>0&&(s+="margin-right:"+bt(this.italic)+";"),s+=gA(this.style),s&&(t=!0,n+=' style="'+go(s)+'"');var r=go(this.text);return t?(n+=">",n+=r,n+="</span>",n):r}}class qu{constructor(t,n){this.children=void 0,this.attributes=void 0,this.children=t||[],this.attributes=n||{}}toNode(){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"svg");for(var s of Object.keys(this.attributes))n.setAttribute(s,this.attributes[s]);for(var r=0;r<this.children.length;r++)n.appendChild(this.children[r].toNode());return n}toMarkup(){var t='<svg xmlns="http://www.w3.org/2000/svg"';for(var n of Object.keys(this.attributes))t+=" "+n+'="'+go(this.attributes[n])+'"';t+=">";for(var s=0;s<this.children.length;s++)t+=this.children[s].toMarkup();return t+="</svg>",t}}class yh{constructor(t,n){this.pathName=void 0,this.alternate=void 0,this.pathName=t,this.alternate=n}toNode(){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"path");return this.alternate?n.setAttribute("d",this.alternate):n.setAttribute("d",SL[this.pathName]),n}toMarkup(){return this.alternate?'<path d="'+go(this.alternate)+'"/>':'<path d="'+go(SL[this.pathName])+'"/>'}}class fT{constructor(t){this.attributes=void 0,this.attributes=t||{}}toNode(){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"line");for(var s of Object.keys(this.attributes))n.setAttribute(s,this.attributes[s]);return n}toMarkup(){var t="<line";for(var n of Object.keys(this.attributes))t+=" "+n+'="'+go(this.attributes[n])+'"';return t+="/>",t}}function Dye(e){if(e instanceof Oa)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}function Oye(e){if(e instanceof X0)return e;throw new Error("Expected span<HtmlDomNode> but got "+String(e)+".")}var Pye=e=>e instanceof X0||e instanceof T_||e instanceof Y0,kc={"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]}},qv={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]},CL={Å:"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 XV(e,t){kc[e]=t}function yA(e,t,n){if(!kc[t])throw new Error("Font metrics not found for font: "+t+".");var s=e.charCodeAt(0),r=kc[t][s];if(!r&&e[0]in CL&&(s=CL[e[0]].charCodeAt(0),r=kc[t][s]),!r&&n==="text"&&VV(s)&&(r=kc[t][77]),r)return{depth:r[0],height:r[1],italic:r[2],skew:r[3],width:r[4]}}var P3={};function Bye(e){var t;if(e>=5?t=0:e>=3?t=1:t=2,!P3[t]){var n=P3[t]={cssEmPerMu:qv.quad[t]/18};for(var s in qv)qv.hasOwnProperty(s)&&(n[s]=qv[s][t])}return P3[t]}var Nr={math:{},text:{}};function E(e,t,n,s,r,i){Nr[e][r]={font:t,group:n,replace:s},i&&s&&(Nr[e][s]=Nr[e][r])}var j="math",et="text",$="main",ae="ams",Rr="accent-token",Gt="bin",zo="close",Q0="inner",bn="mathord",pi="op-token",$a="open",_b="punct",le="rel",Zu="spacing",me="textord";E(j,$,le,"≡","\\equiv",!0);E(j,$,le,"≺","\\prec",!0);E(j,$,le,"≻","\\succ",!0);E(j,$,le,"∼","\\sim",!0);E(j,$,le,"⊥","\\perp");E(j,$,le,"⪯","\\preceq",!0);E(j,$,le,"⪰","\\succeq",!0);E(j,$,le,"≃","\\simeq",!0);E(j,$,le,"∣","\\mid",!0);E(j,$,le,"≪","\\ll",!0);E(j,$,le,"≫","\\gg",!0);E(j,$,le,"≍","\\asymp",!0);E(j,$,le,"∥","\\parallel");E(j,$,le,"⋈","\\bowtie",!0);E(j,$,le,"⌣","\\smile",!0);E(j,$,le,"⊑","\\sqsubseteq",!0);E(j,$,le,"⊒","\\sqsupseteq",!0);E(j,$,le,"≐","\\doteq",!0);E(j,$,le,"⌢","\\frown",!0);E(j,$,le,"∋","\\ni",!0);E(j,$,le,"∝","\\propto",!0);E(j,$,le,"⊢","\\vdash",!0);E(j,$,le,"⊣","\\dashv",!0);E(j,$,le,"∋","\\owns");E(j,$,_b,".","\\ldotp");E(j,$,_b,"⋅","\\cdotp");E(j,$,_b,"⋅","·");E(et,$,me,"⋅","·");E(j,$,me,"#","\\#");E(et,$,me,"#","\\#");E(j,$,me,"&","\\&");E(et,$,me,"&","\\&");E(j,$,me,"ℵ","\\aleph",!0);E(j,$,me,"∀","\\forall",!0);E(j,$,me,"ℏ","\\hbar",!0);E(j,$,me,"∃","\\exists",!0);E(j,$,me,"∇","\\nabla",!0);E(j,$,me,"♭","\\flat",!0);E(j,$,me,"ℓ","\\ell",!0);E(j,$,me,"♮","\\natural",!0);E(j,$,me,"♣","\\clubsuit",!0);E(j,$,me,"℘","\\wp",!0);E(j,$,me,"♯","\\sharp",!0);E(j,$,me,"♢","\\diamondsuit",!0);E(j,$,me,"ℜ","\\Re",!0);E(j,$,me,"♡","\\heartsuit",!0);E(j,$,me,"ℑ","\\Im",!0);E(j,$,me,"♠","\\spadesuit",!0);E(j,$,me,"§","\\S",!0);E(et,$,me,"§","\\S");E(j,$,me,"¶","\\P",!0);E(et,$,me,"¶","\\P");E(j,$,me,"†","\\dag");E(et,$,me,"†","\\dag");E(et,$,me,"†","\\textdagger");E(j,$,me,"‡","\\ddag");E(et,$,me,"‡","\\ddag");E(et,$,me,"‡","\\textdaggerdbl");E(j,$,zo,"⎱","\\rmoustache",!0);E(j,$,$a,"⎰","\\lmoustache",!0);E(j,$,zo,"⟯","\\rgroup",!0);E(j,$,$a,"⟮","\\lgroup",!0);E(j,$,Gt,"∓","\\mp",!0);E(j,$,Gt,"⊖","\\ominus",!0);E(j,$,Gt,"⊎","\\uplus",!0);E(j,$,Gt,"⊓","\\sqcap",!0);E(j,$,Gt,"∗","\\ast");E(j,$,Gt,"⊔","\\sqcup",!0);E(j,$,Gt,"◯","\\bigcirc",!0);E(j,$,Gt,"∙","\\bullet",!0);E(j,$,Gt,"‡","\\ddagger");E(j,$,Gt,"≀","\\wr",!0);E(j,$,Gt,"⨿","\\amalg");E(j,$,Gt,"&","\\And");E(j,$,le,"⟵","\\longleftarrow",!0);E(j,$,le,"⇐","\\Leftarrow",!0);E(j,$,le,"⟸","\\Longleftarrow",!0);E(j,$,le,"⟶","\\longrightarrow",!0);E(j,$,le,"⇒","\\Rightarrow",!0);E(j,$,le,"⟹","\\Longrightarrow",!0);E(j,$,le,"↔","\\leftrightarrow",!0);E(j,$,le,"⟷","\\longleftrightarrow",!0);E(j,$,le,"⇔","\\Leftrightarrow",!0);E(j,$,le,"⟺","\\Longleftrightarrow",!0);E(j,$,le,"↦","\\mapsto",!0);E(j,$,le,"⟼","\\longmapsto",!0);E(j,$,le,"↗","\\nearrow",!0);E(j,$,le,"↩","\\hookleftarrow",!0);E(j,$,le,"↪","\\hookrightarrow",!0);E(j,$,le,"↘","\\searrow",!0);E(j,$,le,"↼","\\leftharpoonup",!0);E(j,$,le,"⇀","\\rightharpoonup",!0);E(j,$,le,"↙","\\swarrow",!0);E(j,$,le,"↽","\\leftharpoondown",!0);E(j,$,le,"⇁","\\rightharpoondown",!0);E(j,$,le,"↖","\\nwarrow",!0);E(j,$,le,"⇌","\\rightleftharpoons",!0);E(j,ae,le,"≮","\\nless",!0);E(j,ae,le,"","\\@nleqslant");E(j,ae,le,"","\\@nleqq");E(j,ae,le,"⪇","\\lneq",!0);E(j,ae,le,"≨","\\lneqq",!0);E(j,ae,le,"","\\@lvertneqq");E(j,ae,le,"⋦","\\lnsim",!0);E(j,ae,le,"⪉","\\lnapprox",!0);E(j,ae,le,"⊀","\\nprec",!0);E(j,ae,le,"⋠","\\npreceq",!0);E(j,ae,le,"⋨","\\precnsim",!0);E(j,ae,le,"⪹","\\precnapprox",!0);E(j,ae,le,"≁","\\nsim",!0);E(j,ae,le,"","\\@nshortmid");E(j,ae,le,"∤","\\nmid",!0);E(j,ae,le,"⊬","\\nvdash",!0);E(j,ae,le,"⊭","\\nvDash",!0);E(j,ae,le,"⋪","\\ntriangleleft");E(j,ae,le,"⋬","\\ntrianglelefteq",!0);E(j,ae,le,"⊊","\\subsetneq",!0);E(j,ae,le,"","\\@varsubsetneq");E(j,ae,le,"⫋","\\subsetneqq",!0);E(j,ae,le,"","\\@varsubsetneqq");E(j,ae,le,"≯","\\ngtr",!0);E(j,ae,le,"","\\@ngeqslant");E(j,ae,le,"","\\@ngeqq");E(j,ae,le,"⪈","\\gneq",!0);E(j,ae,le,"≩","\\gneqq",!0);E(j,ae,le,"","\\@gvertneqq");E(j,ae,le,"⋧","\\gnsim",!0);E(j,ae,le,"⪊","\\gnapprox",!0);E(j,ae,le,"⊁","\\nsucc",!0);E(j,ae,le,"⋡","\\nsucceq",!0);E(j,ae,le,"⋩","\\succnsim",!0);E(j,ae,le,"⪺","\\succnapprox",!0);E(j,ae,le,"≆","\\ncong",!0);E(j,ae,le,"","\\@nshortparallel");E(j,ae,le,"∦","\\nparallel",!0);E(j,ae,le,"⊯","\\nVDash",!0);E(j,ae,le,"⋫","\\ntriangleright");E(j,ae,le,"⋭","\\ntrianglerighteq",!0);E(j,ae,le,"","\\@nsupseteqq");E(j,ae,le,"⊋","\\supsetneq",!0);E(j,ae,le,"","\\@varsupsetneq");E(j,ae,le,"⫌","\\supsetneqq",!0);E(j,ae,le,"","\\@varsupsetneqq");E(j,ae,le,"⊮","\\nVdash",!0);E(j,ae,le,"⪵","\\precneqq",!0);E(j,ae,le,"⪶","\\succneqq",!0);E(j,ae,le,"","\\@nsubseteqq");E(j,ae,Gt,"⊴","\\unlhd");E(j,ae,Gt,"⊵","\\unrhd");E(j,ae,le,"↚","\\nleftarrow",!0);E(j,ae,le,"↛","\\nrightarrow",!0);E(j,ae,le,"⇍","\\nLeftarrow",!0);E(j,ae,le,"⇏","\\nRightarrow",!0);E(j,ae,le,"↮","\\nleftrightarrow",!0);E(j,ae,le,"⇎","\\nLeftrightarrow",!0);E(j,ae,le,"△","\\vartriangle");E(j,ae,me,"ℏ","\\hslash");E(j,ae,me,"▽","\\triangledown");E(j,ae,me,"◊","\\lozenge");E(j,ae,me,"Ⓢ","\\circledS");E(j,ae,me,"®","\\circledR");E(et,ae,me,"®","\\circledR");E(j,ae,me,"∡","\\measuredangle",!0);E(j,ae,me,"∄","\\nexists");E(j,ae,me,"℧","\\mho");E(j,ae,me,"Ⅎ","\\Finv",!0);E(j,ae,me,"⅁","\\Game",!0);E(j,ae,me,"‵","\\backprime");E(j,ae,me,"▲","\\blacktriangle");E(j,ae,me,"▼","\\blacktriangledown");E(j,ae,me,"■","\\blacksquare");E(j,ae,me,"⧫","\\blacklozenge");E(j,ae,me,"★","\\bigstar");E(j,ae,me,"∢","\\sphericalangle",!0);E(j,ae,me,"∁","\\complement",!0);E(j,ae,me,"ð","\\eth",!0);E(et,$,me,"ð","ð");E(j,ae,me,"╱","\\diagup");E(j,ae,me,"╲","\\diagdown");E(j,ae,me,"□","\\square");E(j,ae,me,"□","\\Box");E(j,ae,me,"◊","\\Diamond");E(j,ae,me,"¥","\\yen",!0);E(et,ae,me,"¥","\\yen",!0);E(j,ae,me,"✓","\\checkmark",!0);E(et,ae,me,"✓","\\checkmark");E(j,ae,me,"ℶ","\\beth",!0);E(j,ae,me,"ℸ","\\daleth",!0);E(j,ae,me,"ℷ","\\gimel",!0);E(j,ae,me,"ϝ","\\digamma",!0);E(j,ae,me,"ϰ","\\varkappa");E(j,ae,$a,"┌","\\@ulcorner",!0);E(j,ae,zo,"┐","\\@urcorner",!0);E(j,ae,$a,"└","\\@llcorner",!0);E(j,ae,zo,"┘","\\@lrcorner",!0);E(j,ae,le,"≦","\\leqq",!0);E(j,ae,le,"⩽","\\leqslant",!0);E(j,ae,le,"⪕","\\eqslantless",!0);E(j,ae,le,"≲","\\lesssim",!0);E(j,ae,le,"⪅","\\lessapprox",!0);E(j,ae,le,"≊","\\approxeq",!0);E(j,ae,Gt,"⋖","\\lessdot");E(j,ae,le,"⋘","\\lll",!0);E(j,ae,le,"≶","\\lessgtr",!0);E(j,ae,le,"⋚","\\lesseqgtr",!0);E(j,ae,le,"⪋","\\lesseqqgtr",!0);E(j,ae,le,"≑","\\doteqdot");E(j,ae,le,"≓","\\risingdotseq",!0);E(j,ae,le,"≒","\\fallingdotseq",!0);E(j,ae,le,"∽","\\backsim",!0);E(j,ae,le,"⋍","\\backsimeq",!0);E(j,ae,le,"⫅","\\subseteqq",!0);E(j,ae,le,"⋐","\\Subset",!0);E(j,ae,le,"⊏","\\sqsubset",!0);E(j,ae,le,"≼","\\preccurlyeq",!0);E(j,ae,le,"⋞","\\curlyeqprec",!0);E(j,ae,le,"≾","\\precsim",!0);E(j,ae,le,"⪷","\\precapprox",!0);E(j,ae,le,"⊲","\\vartriangleleft");E(j,ae,le,"⊴","\\trianglelefteq");E(j,ae,le,"⊨","\\vDash",!0);E(j,ae,le,"⊪","\\Vvdash",!0);E(j,ae,le,"⌣","\\smallsmile");E(j,ae,le,"⌢","\\smallfrown");E(j,ae,le,"≏","\\bumpeq",!0);E(j,ae,le,"≎","\\Bumpeq",!0);E(j,ae,le,"≧","\\geqq",!0);E(j,ae,le,"⩾","\\geqslant",!0);E(j,ae,le,"⪖","\\eqslantgtr",!0);E(j,ae,le,"≳","\\gtrsim",!0);E(j,ae,le,"⪆","\\gtrapprox",!0);E(j,ae,Gt,"⋗","\\gtrdot");E(j,ae,le,"⋙","\\ggg",!0);E(j,ae,le,"≷","\\gtrless",!0);E(j,ae,le,"⋛","\\gtreqless",!0);E(j,ae,le,"⪌","\\gtreqqless",!0);E(j,ae,le,"≖","\\eqcirc",!0);E(j,ae,le,"≗","\\circeq",!0);E(j,ae,le,"≜","\\triangleq",!0);E(j,ae,le,"∼","\\thicksim");E(j,ae,le,"≈","\\thickapprox");E(j,ae,le,"⫆","\\supseteqq",!0);E(j,ae,le,"⋑","\\Supset",!0);E(j,ae,le,"⊐","\\sqsupset",!0);E(j,ae,le,"≽","\\succcurlyeq",!0);E(j,ae,le,"⋟","\\curlyeqsucc",!0);E(j,ae,le,"≿","\\succsim",!0);E(j,ae,le,"⪸","\\succapprox",!0);E(j,ae,le,"⊳","\\vartriangleright");E(j,ae,le,"⊵","\\trianglerighteq");E(j,ae,le,"⊩","\\Vdash",!0);E(j,ae,le,"∣","\\shortmid");E(j,ae,le,"∥","\\shortparallel");E(j,ae,le,"≬","\\between",!0);E(j,ae,le,"⋔","\\pitchfork",!0);E(j,ae,le,"∝","\\varpropto");E(j,ae,le,"◀","\\blacktriangleleft");E(j,ae,le,"∴","\\therefore",!0);E(j,ae,le,"∍","\\backepsilon");E(j,ae,le,"▶","\\blacktriangleright");E(j,ae,le,"∵","\\because",!0);E(j,ae,le,"⋘","\\llless");E(j,ae,le,"⋙","\\gggtr");E(j,ae,Gt,"⊲","\\lhd");E(j,ae,Gt,"⊳","\\rhd");E(j,ae,le,"≂","\\eqsim",!0);E(j,$,le,"⋈","\\Join");E(j,ae,le,"≑","\\Doteq",!0);E(j,ae,Gt,"∔","\\dotplus",!0);E(j,ae,Gt,"∖","\\smallsetminus");E(j,ae,Gt,"⋒","\\Cap",!0);E(j,ae,Gt,"⋓","\\Cup",!0);E(j,ae,Gt,"⩞","\\doublebarwedge",!0);E(j,ae,Gt,"⊟","\\boxminus",!0);E(j,ae,Gt,"⊞","\\boxplus",!0);E(j,ae,Gt,"⋇","\\divideontimes",!0);E(j,ae,Gt,"⋉","\\ltimes",!0);E(j,ae,Gt,"⋊","\\rtimes",!0);E(j,ae,Gt,"⋋","\\leftthreetimes",!0);E(j,ae,Gt,"⋌","\\rightthreetimes",!0);E(j,ae,Gt,"⋏","\\curlywedge",!0);E(j,ae,Gt,"⋎","\\curlyvee",!0);E(j,ae,Gt,"⊝","\\circleddash",!0);E(j,ae,Gt,"⊛","\\circledast",!0);E(j,ae,Gt,"⋅","\\centerdot");E(j,ae,Gt,"⊺","\\intercal",!0);E(j,ae,Gt,"⋒","\\doublecap");E(j,ae,Gt,"⋓","\\doublecup");E(j,ae,Gt,"⊠","\\boxtimes",!0);E(j,ae,le,"⇢","\\dashrightarrow",!0);E(j,ae,le,"⇠","\\dashleftarrow",!0);E(j,ae,le,"⇇","\\leftleftarrows",!0);E(j,ae,le,"⇆","\\leftrightarrows",!0);E(j,ae,le,"⇚","\\Lleftarrow",!0);E(j,ae,le,"↞","\\twoheadleftarrow",!0);E(j,ae,le,"↢","\\leftarrowtail",!0);E(j,ae,le,"↫","\\looparrowleft",!0);E(j,ae,le,"⇋","\\leftrightharpoons",!0);E(j,ae,le,"↶","\\curvearrowleft",!0);E(j,ae,le,"↺","\\circlearrowleft",!0);E(j,ae,le,"↰","\\Lsh",!0);E(j,ae,le,"⇈","\\upuparrows",!0);E(j,ae,le,"↿","\\upharpoonleft",!0);E(j,ae,le,"⇃","\\downharpoonleft",!0);E(j,$,le,"⊶","\\origof",!0);E(j,$,le,"⊷","\\imageof",!0);E(j,ae,le,"⊸","\\multimap",!0);E(j,ae,le,"↭","\\leftrightsquigarrow",!0);E(j,ae,le,"⇉","\\rightrightarrows",!0);E(j,ae,le,"⇄","\\rightleftarrows",!0);E(j,ae,le,"↠","\\twoheadrightarrow",!0);E(j,ae,le,"↣","\\rightarrowtail",!0);E(j,ae,le,"↬","\\looparrowright",!0);E(j,ae,le,"↷","\\curvearrowright",!0);E(j,ae,le,"↻","\\circlearrowright",!0);E(j,ae,le,"↱","\\Rsh",!0);E(j,ae,le,"⇊","\\downdownarrows",!0);E(j,ae,le,"↾","\\upharpoonright",!0);E(j,ae,le,"⇂","\\downharpoonright",!0);E(j,ae,le,"⇝","\\rightsquigarrow",!0);E(j,ae,le,"⇝","\\leadsto");E(j,ae,le,"⇛","\\Rrightarrow",!0);E(j,ae,le,"↾","\\restriction");E(j,$,me,"‘","`");E(j,$,me,"$","\\$");E(et,$,me,"$","\\$");E(et,$,me,"$","\\textdollar");E(j,$,me,"%","\\%");E(et,$,me,"%","\\%");E(j,$,me,"_","\\_");E(et,$,me,"_","\\_");E(et,$,me,"_","\\textunderscore");E(j,$,me,"∠","\\angle",!0);E(j,$,me,"∞","\\infty",!0);E(j,$,me,"′","\\prime");E(j,$,me,"△","\\triangle");E(j,$,me,"Γ","\\Gamma",!0);E(j,$,me,"Δ","\\Delta",!0);E(j,$,me,"Θ","\\Theta",!0);E(j,$,me,"Λ","\\Lambda",!0);E(j,$,me,"Ξ","\\Xi",!0);E(j,$,me,"Π","\\Pi",!0);E(j,$,me,"Σ","\\Sigma",!0);E(j,$,me,"Υ","\\Upsilon",!0);E(j,$,me,"Φ","\\Phi",!0);E(j,$,me,"Ψ","\\Psi",!0);E(j,$,me,"Ω","\\Omega",!0);E(j,$,me,"A","Α");E(j,$,me,"B","Β");E(j,$,me,"E","Ε");E(j,$,me,"Z","Ζ");E(j,$,me,"H","Η");E(j,$,me,"I","Ι");E(j,$,me,"K","Κ");E(j,$,me,"M","Μ");E(j,$,me,"N","Ν");E(j,$,me,"O","Ο");E(j,$,me,"P","Ρ");E(j,$,me,"T","Τ");E(j,$,me,"X","Χ");E(j,$,me,"¬","\\neg",!0);E(j,$,me,"¬","\\lnot");E(j,$,me,"⊤","\\top");E(j,$,me,"⊥","\\bot");E(j,$,me,"∅","\\emptyset");E(j,ae,me,"∅","\\varnothing");E(j,$,bn,"α","\\alpha",!0);E(j,$,bn,"β","\\beta",!0);E(j,$,bn,"γ","\\gamma",!0);E(j,$,bn,"δ","\\delta",!0);E(j,$,bn,"ϵ","\\epsilon",!0);E(j,$,bn,"ζ","\\zeta",!0);E(j,$,bn,"η","\\eta",!0);E(j,$,bn,"θ","\\theta",!0);E(j,$,bn,"ι","\\iota",!0);E(j,$,bn,"κ","\\kappa",!0);E(j,$,bn,"λ","\\lambda",!0);E(j,$,bn,"μ","\\mu",!0);E(j,$,bn,"ν","\\nu",!0);E(j,$,bn,"ξ","\\xi",!0);E(j,$,bn,"ο","\\omicron",!0);E(j,$,bn,"π","\\pi",!0);E(j,$,bn,"ρ","\\rho",!0);E(j,$,bn,"σ","\\sigma",!0);E(j,$,bn,"τ","\\tau",!0);E(j,$,bn,"υ","\\upsilon",!0);E(j,$,bn,"ϕ","\\phi",!0);E(j,$,bn,"χ","\\chi",!0);E(j,$,bn,"ψ","\\psi",!0);E(j,$,bn,"ω","\\omega",!0);E(j,$,bn,"ε","\\varepsilon",!0);E(j,$,bn,"ϑ","\\vartheta",!0);E(j,$,bn,"ϖ","\\varpi",!0);E(j,$,bn,"ϱ","\\varrho",!0);E(j,$,bn,"ς","\\varsigma",!0);E(j,$,bn,"φ","\\varphi",!0);E(j,$,Gt,"∗","*",!0);E(j,$,Gt,"+","+");E(j,$,Gt,"−","-",!0);E(j,$,Gt,"⋅","\\cdot",!0);E(j,$,Gt,"∘","\\circ",!0);E(j,$,Gt,"÷","\\div",!0);E(j,$,Gt,"±","\\pm",!0);E(j,$,Gt,"×","\\times",!0);E(j,$,Gt,"∩","\\cap",!0);E(j,$,Gt,"∪","\\cup",!0);E(j,$,Gt,"∖","\\setminus",!0);E(j,$,Gt,"∧","\\land");E(j,$,Gt,"∨","\\lor");E(j,$,Gt,"∧","\\wedge",!0);E(j,$,Gt,"∨","\\vee",!0);E(j,$,me,"√","\\surd");E(j,$,$a,"⟨","\\langle",!0);E(j,$,$a,"∣","\\lvert");E(j,$,$a,"∥","\\lVert");E(j,$,zo,"?","?");E(j,$,zo,"!","!");E(j,$,zo,"⟩","\\rangle",!0);E(j,$,zo,"∣","\\rvert");E(j,$,zo,"∥","\\rVert");E(j,$,le,"=","=");E(j,$,le,":",":");E(j,$,le,"≈","\\approx",!0);E(j,$,le,"≅","\\cong",!0);E(j,$,le,"≥","\\ge");E(j,$,le,"≥","\\geq",!0);E(j,$,le,"←","\\gets");E(j,$,le,">","\\gt",!0);E(j,$,le,"∈","\\in",!0);E(j,$,le,"","\\@not");E(j,$,le,"⊂","\\subset",!0);E(j,$,le,"⊃","\\supset",!0);E(j,$,le,"⊆","\\subseteq",!0);E(j,$,le,"⊇","\\supseteq",!0);E(j,ae,le,"⊈","\\nsubseteq",!0);E(j,ae,le,"⊉","\\nsupseteq",!0);E(j,$,le,"⊨","\\models");E(j,$,le,"←","\\leftarrow",!0);E(j,$,le,"≤","\\le");E(j,$,le,"≤","\\leq",!0);E(j,$,le,"<","\\lt",!0);E(j,$,le,"→","\\rightarrow",!0);E(j,$,le,"→","\\to");E(j,ae,le,"≱","\\ngeq",!0);E(j,ae,le,"≰","\\nleq",!0);E(j,$,Zu," ","\\ ");E(j,$,Zu," ","\\space");E(j,$,Zu," ","\\nobreakspace");E(et,$,Zu," ","\\ ");E(et,$,Zu," "," ");E(et,$,Zu," ","\\space");E(et,$,Zu," ","\\nobreakspace");E(j,$,Zu,"","\\nobreak");E(j,$,Zu,"","\\allowbreak");E(j,$,_b,",",",");E(j,$,_b,";",";");E(j,ae,Gt,"⊼","\\barwedge",!0);E(j,ae,Gt,"⊻","\\veebar",!0);E(j,$,Gt,"⊙","\\odot",!0);E(j,$,Gt,"⊕","\\oplus",!0);E(j,$,Gt,"⊗","\\otimes",!0);E(j,$,me,"∂","\\partial",!0);E(j,$,Gt,"⊘","\\oslash",!0);E(j,ae,Gt,"⊚","\\circledcirc",!0);E(j,ae,Gt,"⊡","\\boxdot",!0);E(j,$,Gt,"△","\\bigtriangleup");E(j,$,Gt,"▽","\\bigtriangledown");E(j,$,Gt,"†","\\dagger");E(j,$,Gt,"⋄","\\diamond");E(j,$,Gt,"⋆","\\star");E(j,$,Gt,"◃","\\triangleleft");E(j,$,Gt,"▹","\\triangleright");E(j,$,$a,"{","\\{");E(et,$,me,"{","\\{");E(et,$,me,"{","\\textbraceleft");E(j,$,zo,"}","\\}");E(et,$,me,"}","\\}");E(et,$,me,"}","\\textbraceright");E(j,$,$a,"{","\\lbrace");E(j,$,zo,"}","\\rbrace");E(j,$,$a,"[","\\lbrack",!0);E(et,$,me,"[","\\lbrack",!0);E(j,$,zo,"]","\\rbrack",!0);E(et,$,me,"]","\\rbrack",!0);E(j,$,$a,"(","\\lparen",!0);E(j,$,zo,")","\\rparen",!0);E(et,$,me,"<","\\textless",!0);E(et,$,me,">","\\textgreater",!0);E(j,$,$a,"⌊","\\lfloor",!0);E(j,$,zo,"⌋","\\rfloor",!0);E(j,$,$a,"⌈","\\lceil",!0);E(j,$,zo,"⌉","\\rceil",!0);E(j,$,me,"\\","\\backslash");E(j,$,me,"∣","|");E(j,$,me,"∣","\\vert");E(et,$,me,"|","\\textbar",!0);E(j,$,me,"∥","\\|");E(j,$,me,"∥","\\Vert");E(et,$,me,"∥","\\textbardbl");E(et,$,me,"~","\\textasciitilde");E(et,$,me,"\\","\\textbackslash");E(et,$,me,"^","\\textasciicircum");E(j,$,le,"↑","\\uparrow",!0);E(j,$,le,"⇑","\\Uparrow",!0);E(j,$,le,"↓","\\downarrow",!0);E(j,$,le,"⇓","\\Downarrow",!0);E(j,$,le,"↕","\\updownarrow",!0);E(j,$,le,"⇕","\\Updownarrow",!0);E(j,$,pi,"∐","\\coprod");E(j,$,pi,"⋁","\\bigvee");E(j,$,pi,"⋀","\\bigwedge");E(j,$,pi,"⨄","\\biguplus");E(j,$,pi,"⋂","\\bigcap");E(j,$,pi,"⋃","\\bigcup");E(j,$,pi,"∫","\\int");E(j,$,pi,"∫","\\intop");E(j,$,pi,"∬","\\iint");E(j,$,pi,"∭","\\iiint");E(j,$,pi,"∏","\\prod");E(j,$,pi,"∑","\\sum");E(j,$,pi,"⨂","\\bigotimes");E(j,$,pi,"⨁","\\bigoplus");E(j,$,pi,"⨀","\\bigodot");E(j,$,pi,"∮","\\oint");E(j,$,pi,"∯","\\oiint");E(j,$,pi,"∰","\\oiiint");E(j,$,pi,"⨆","\\bigsqcup");E(j,$,pi,"∫","\\smallint");E(et,$,Q0,"…","\\textellipsis");E(j,$,Q0,"…","\\mathellipsis");E(et,$,Q0,"…","\\ldots",!0);E(j,$,Q0,"…","\\ldots",!0);E(j,$,Q0,"⋯","\\@cdots",!0);E(j,$,Q0,"⋱","\\ddots",!0);E(j,$,me,"⋮","\\varvdots");E(et,$,me,"⋮","\\varvdots");E(j,$,Rr,"ˊ","\\acute");E(j,$,Rr,"ˋ","\\grave");E(j,$,Rr,"¨","\\ddot");E(j,$,Rr,"~","\\tilde");E(j,$,Rr,"ˉ","\\bar");E(j,$,Rr,"˘","\\breve");E(j,$,Rr,"ˇ","\\check");E(j,$,Rr,"^","\\hat");E(j,$,Rr,"⃗","\\vec");E(j,$,Rr,"˙","\\dot");E(j,$,Rr,"˚","\\mathring");E(j,$,bn,"","\\@imath");E(j,$,bn,"","\\@jmath");E(j,$,me,"ı","ı");E(j,$,me,"ȷ","ȷ");E(et,$,me,"ı","\\i",!0);E(et,$,me,"ȷ","\\j",!0);E(et,$,me,"ß","\\ss",!0);E(et,$,me,"æ","\\ae",!0);E(et,$,me,"œ","\\oe",!0);E(et,$,me,"ø","\\o",!0);E(et,$,me,"Æ","\\AE",!0);E(et,$,me,"Œ","\\OE",!0);E(et,$,me,"Ø","\\O",!0);E(et,$,Rr,"ˊ","\\'");E(et,$,Rr,"ˋ","\\`");E(et,$,Rr,"ˆ","\\^");E(et,$,Rr,"˜","\\~");E(et,$,Rr,"ˉ","\\=");E(et,$,Rr,"˘","\\u");E(et,$,Rr,"˙","\\.");E(et,$,Rr,"¸","\\c");E(et,$,Rr,"˚","\\r");E(et,$,Rr,"ˇ","\\v");E(et,$,Rr,"¨",'\\"');E(et,$,Rr,"˝","\\H");E(et,$,Rr,"◯","\\textcircled");var QV={"--":!0,"---":!0,"``":!0,"''":!0};E(et,$,me,"–","--",!0);E(et,$,me,"–","\\textendash");E(et,$,me,"—","---",!0);E(et,$,me,"—","\\textemdash");E(et,$,me,"‘","`",!0);E(et,$,me,"‘","\\textquoteleft");E(et,$,me,"’","'",!0);E(et,$,me,"’","\\textquoteright");E(et,$,me,"“","``",!0);E(et,$,me,"“","\\textquotedblleft");E(et,$,me,"”","''",!0);E(et,$,me,"”","\\textquotedblright");E(j,$,me,"°","\\degree",!0);E(et,$,me,"°","\\degree");E(et,$,me,"°","\\textdegree",!0);E(j,$,me,"£","\\pounds");E(j,$,me,"£","\\mathsterling",!0);E(et,$,me,"£","\\pounds");E(et,$,me,"£","\\textsterling",!0);E(j,ae,me,"✠","\\maltese");E(et,ae,me,"✠","\\maltese");var TL='0123456789/@."';for(var B3=0;B3<TL.length;B3++){var EL=TL.charAt(B3);E(j,$,me,EL,EL)}var AL='0123456789!@*()-=+";:?/.,';for(var $3=0;$3<AL.length;$3++){var ML=AL.charAt($3);E(et,$,me,ML,ML)}var Dk="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var z3=0;z3<Dk.length;z3++){var Hv=Dk.charAt(z3);E(j,$,bn,Hv,Hv),E(et,$,me,Hv,Hv)}E(j,ae,me,"C","ℂ");E(et,ae,me,"C","ℂ");E(j,ae,me,"H","ℍ");E(et,ae,me,"H","ℍ");E(j,ae,me,"N","ℕ");E(et,ae,me,"N","ℕ");E(j,ae,me,"P","ℙ");E(et,ae,me,"P","ℙ");E(j,ae,me,"Q","ℚ");E(et,ae,me,"Q","ℚ");E(j,ae,me,"R","ℝ");E(et,ae,me,"R","ℝ");E(j,ae,me,"Z","ℤ");E(et,ae,me,"Z","ℤ");E(j,$,bn,"h","ℎ");E(et,$,bn,"h","ℎ");var Tn;for(var So=0;So<Dk.length;So++){var qr=Dk.charAt(So);Tn=String.fromCharCode(55349,56320+So),E(j,$,bn,qr,Tn),E(et,$,me,qr,Tn),Tn=String.fromCharCode(55349,56372+So),E(j,$,bn,qr,Tn),E(et,$,me,qr,Tn),Tn=String.fromCharCode(55349,56424+So),E(j,$,bn,qr,Tn),E(et,$,me,qr,Tn),Tn=String.fromCharCode(55349,56580+So),E(j,$,bn,qr,Tn),E(et,$,me,qr,Tn),Tn=String.fromCharCode(55349,56684+So),E(j,$,bn,qr,Tn),E(et,$,me,qr,Tn),Tn=String.fromCharCode(55349,56736+So),E(j,$,bn,qr,Tn),E(et,$,me,qr,Tn),Tn=String.fromCharCode(55349,56788+So),E(j,$,bn,qr,Tn),E(et,$,me,qr,Tn),Tn=String.fromCharCode(55349,56840+So),E(j,$,bn,qr,Tn),E(et,$,me,qr,Tn),Tn=String.fromCharCode(55349,56944+So),E(j,$,bn,qr,Tn),E(et,$,me,qr,Tn),So<26&&(Tn=String.fromCharCode(55349,56632+So),E(j,$,bn,qr,Tn),E(et,$,me,qr,Tn),Tn=String.fromCharCode(55349,56476+So),E(j,$,bn,qr,Tn),E(et,$,me,qr,Tn))}Tn="𝕜";E(j,$,bn,"k",Tn);E(et,$,me,"k",Tn);for(var rf=0;rf<10;rf++){var vd=rf.toString();Tn=String.fromCharCode(55349,57294+rf),E(j,$,bn,vd,Tn),E(et,$,me,vd,Tn),Tn=String.fromCharCode(55349,57314+rf),E(j,$,bn,vd,Tn),E(et,$,me,vd,Tn),Tn=String.fromCharCode(55349,57324+rf),E(j,$,bn,vd,Tn),E(et,$,me,vd,Tn),Tn=String.fromCharCode(55349,57334+rf),E(j,$,bn,vd,Tn),E(et,$,me,vd,Tn)}var mT="ÐÞþ";for(var F3=0;F3<mT.length;F3++){var Uv=mT.charAt(F3);E(j,$,bn,Uv,Uv),E(et,$,me,Uv,Uv)}var pT={mathClass:"mathbf",textClass:"textbf",font:"Main-Bold"},NL={mathClass:"mathnormal",textClass:"textit",font:"Math-Italic"},IL={mathClass:"boldsymbol",textClass:"boldsymbol",font:"Main-BoldItalic"},$ye={mathClass:"mathscr",textClass:"textscr",font:"Script-Regular"},xf={mathClass:"",textClass:"",font:""},RL={mathClass:"mathfrak",textClass:"textfrak",font:"Fraktur-Regular"},jL={mathClass:"mathbb",textClass:"textbb",font:"AMS-Regular"},LL={mathClass:"mathboldfrak",textClass:"textboldfrak",font:"Fraktur-Regular"},gT={mathClass:"mathsf",textClass:"textsf",font:"SansSerif-Regular"},yT={mathClass:"mathboldsf",textClass:"textboldsf",font:"SansSerif-Bold"},DL={mathClass:"mathitsf",textClass:"textitsf",font:"SansSerif-Italic"},bT={mathClass:"mathtt",textClass:"texttt",font:"Typewriter-Regular"},OL=[pT,pT,NL,NL,IL,IL,$ye,xf,xf,xf,RL,RL,jL,jL,LL,LL,gT,gT,yT,yT,DL,DL,xf,xf,bT,bT],zye=[pT,xf,gT,yT,bT],Fye=e=>{var t=e.charCodeAt(0),n=e.charCodeAt(1),s=(t-55296)*1024+(n-56320)+65536;if(119808<=s&&s<120484){var r=Math.floor((s-119808)/26);return OL[r]}else if(120782<=s&&s<=120831){var i=Math.floor((s-120782)/10);return zye[i]}else{if(s===120485||s===120486)return OL[0];if(120486<s&&s<120782)return xf;throw new dt("Unsupported character: "+e)}},E_=function(t,n,s){if(Nr[s][t]){var r=Nr[s][t].replace;r&&(t=r)}return{value:t,metrics:yA(t,n,s)}},Ao=function(t,n,s,r,i){var o=E_(t,n,s),a=o.metrics;t=o.value;var l;if(a){var c=a.italic;(s==="text"||r&&r.font==="mathit")&&(c=0),l=new Oa(t,a.height,a.depth,c,a.skew,a.width,i)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+t+"' in style '"+n+"' and mode '"+s+"'")),l=new Oa(t,0,0,0,0,0,i);if(r){l.maxFontSize=r.sizeMultiplier,r.style.isTight()&&l.classes.push("mtight");var d=r.getColor();d&&(l.style.color=d)}return l},bA=function(t,n,s,r){return r===void 0&&(r=[]),s.font==="boldsymbol"&&E_(t,"Main-Bold",n).metrics?Ao(t,"Main-Bold",n,s,r.concat(["mathbf"])):t==="\\"||Nr[n][t].font==="main"?Ao(t,"Main-Regular",n,s,r):Ao(t,"AMS-Regular",n,s,r.concat(["amsrm"]))},qye=function(t,n,s){return s!=="textord"&&E_(t,"Math-BoldItalic",n).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},A_=function(t,n,s){var r=t.mode,i=t.text,o=["mord"],{font:a,fontFamily:l,fontWeight:c,fontShape:d}=n,h=r==="math"||r==="text"&&!!a,f=h?a:l,p="",g="";if(i.charCodeAt(0)===55349){var y=Fye(i);p=y.font,g=y[r+"Class"]}if(p)return Ao(i,p,r,n,o.concat(g));if(f){var w,v;if(f==="boldsymbol"){var b=qye(i,r,s);w=b.fontName,v=[b.fontClass]}else h?(w=vT[a].fontName,v=[a]):(w=Vv(l,c,d),v=[l,c,d]);if(E_(i,w,r).metrics)return Ao(i,w,r,n,o.concat(v));if(QV.hasOwnProperty(i)&&w.slice(0,10)==="Typewriter"){for(var x=[],k=0;k<i.length;k++)x.push(Ao(i[k],w,r,n,o.concat(v)));return ed(x)}}if(s==="mathord")return Ao(i,"Math-Italic",r,n,o.concat(["mathnormal"]));if(s==="textord"){var T=Nr[r][i]&&Nr[r][i].font;if(T==="ams"){var C=Vv("amsrm",c,d);return Ao(i,C,r,n,o.concat("amsrm",c,d))}else if(T==="main"||!T){var S=Vv("textrm",c,d);return Ao(i,S,r,n,o.concat(c,d))}else{var _=Vv(T,c,d);return Ao(i,_,r,n,o.concat(_,c,d))}}else throw new Error("unexpected type: "+s+" in makeOrd")},Hye=(e,t)=>{if(gh(e.classes)!==gh(t.classes)||e.skew!==t.skew||e.maxFontSize!==t.maxFontSize||e.italic!==0&&e.hasClass("mathnormal"))return!1;if(e.classes.length===1){var n=e.classes[0];if(n==="mbin"||n==="mord")return!1}for(var s of Object.keys(e.style))if(e.style[s]!==t.style[s])return!1;for(var r of Object.keys(t.style))if(e.style[r]!==t.style[r])return!1;return!0},JV=e=>{for(var t=0;t<e.length-1;t++){var n=e[t],s=e[t+1];n instanceof Oa&&s instanceof Oa&&Hye(n,s)&&(n.text+=s.text,n.height=Math.max(n.height,s.height),n.depth=Math.max(n.depth,s.depth),n.italic=s.italic,e.splice(t+1,1),t--)}return e},vA=function(t){for(var n=0,s=0,r=0,i=0;i<t.children.length;i++){var o=t.children[i];o.height>n&&(n=o.height),o.depth>s&&(s=o.depth),o.maxFontSize>r&&(r=o.maxFontSize)}t.height=n,t.depth=s,t.maxFontSize=r},it=function(t,n,s,r){var i=new X0(t,n,s,r);return vA(i),i},bh=(e,t,n,s)=>new X0(e,t,n,s),w0=function(t,n,s){var r=it([t],[],n);return r.height=Math.max(s||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),r.style.borderBottomWidth=bt(r.height),r.maxFontSize=1,r},Uye=function(t,n,s,r){var i=new T_(t,n,s,r);return vA(i),i},ed=function(t){var n=new Y0(t);return vA(n),n},x0=function(t,n){return t instanceof Y0?it([],[t],n):t},Vye=function(t){if(t.positionType==="individualShift"){for(var n=t.children,s=[n[0]],r=-n[0].shift-n[0].elem.depth,i=r,o=1;o<n.length;o++){var a=-n[o].shift-i-n[o].elem.depth,l=a-(n[o-1].elem.height+n[o-1].elem.depth);i=i+a,s.push({type:"kern",size:l}),s.push(n[o])}return{children:s,depth:r}}var c;if(t.positionType==="top"){for(var d=t.positionData,h=0;h<t.children.length;h++){var f=t.children[h];d-=f.type==="kern"?f.size:f.elem.height+f.elem.depth}c=d}else if(t.positionType==="bottom")c=-t.positionData;else{var p=t.children[0];if(p.type!=="elem")throw new Error('First child must have type "elem".');if(t.positionType==="shift")c=-p.elem.depth-t.positionData;else if(t.positionType==="firstBaseline")c=-p.elem.depth;else throw new Error("Invalid positionType "+t.positionType+".")}return{children:t.children,depth:c}},Fs=function(t,n){for(var{children:s,depth:r}=Vye(t),i=0,o=0;o<s.length;o++){var a=s[o];if(a.type==="elem"){var l=a.elem;i=Math.max(i,l.maxFontSize,l.height)}}i+=2;var c=it(["pstrut"],[]);c.style.height=bt(i);for(var d=[],h=r,f=r,p=r,g=0;g<s.length;g++){var y=s[g];if(y.type==="kern")p+=y.size;else{var w=y.elem,v=y.wrapperClasses||[],b=y.wrapperStyle||{},x=it(v,[c,w],void 0,b);x.style.top=bt(-i-p-w.depth),y.marginLeft&&(x.style.marginLeft=y.marginLeft),y.marginRight&&(x.style.marginRight=y.marginRight),d.push(x),p+=w.height+w.depth}h=Math.min(h,p),f=Math.max(f,p)}var k=it(["vlist"],d);k.style.height=bt(f);var T;if(h<0){var C=it([],[]),S=it(["vlist"],[C]);S.style.height=bt(-h);var _=it(["vlist-s"],[new Oa("​")]);T=[it(["vlist-r"],[k,_]),it(["vlist-r"],[S])]}else T=[it(["vlist-r"],[k])];var L=it(["vlist-t"],T);return T.length===2&&L.classes.push("vlist-t2"),L.height=f,L.depth=-h,L},ZV=(e,t)=>{var n=it(["mspace"],[],t),s=$r(e,t);return n.style.marginRight=bt(s),n},Vv=(e,t,n)=>{var s,r;switch(e){case"amsrm":s="AMS";break;case"textrm":s="Main";break;case"textsf":s="SansSerif";break;case"texttt":s="Typewriter";break;default:s=e}return t==="textbf"&&n==="textit"?r="BoldItalic":t==="textbf"?r="Bold":n==="textit"?r="Italic":r="Regular",s+"-"+r},vT={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"}},eW={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},tW=function(t,n){var[s,r,i]=eW[t],o=new yh(s),a=new qu([o],{width:bt(r),height:bt(i),style:"width:"+bt(r),viewBox:"0 0 "+1e3*r+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),l=bh(["overlay"],[a],n);return l.height=i,l.style.height=bt(i),l.style.width=bt(r),l},Dr={number:3,unit:"mu"},of={number:4,unit:"mu"},iu={number:5,unit:"mu"},Wye={mord:{mop:Dr,mbin:of,mrel:iu,minner:Dr},mop:{mord:Dr,mop:Dr,mrel:iu,minner:Dr},mbin:{mord:of,mop:of,mopen:of,minner:of},mrel:{mord:iu,mop:iu,mopen:iu,minner:iu},mopen:{},mclose:{mop:Dr,mbin:of,mrel:iu,minner:Dr},mpunct:{mord:Dr,mop:Dr,mrel:iu,mopen:Dr,mclose:Dr,mpunct:Dr,minner:Dr},minner:{mord:Dr,mop:Dr,mbin:of,mrel:iu,mopen:Dr,mpunct:Dr,minner:Dr}},Gye={mord:{mop:Dr},mop:{mord:Dr,mop:Dr},mbin:{},mrel:{},mopen:{},mclose:{mop:Dr},mpunct:{},minner:{mop:Dr}},nW={},Ok={},Pk={};function $t(e){for(var{type:t,names:n,props:s,handler:r,htmlBuilder:i,mathmlBuilder:o}=e,a={type:t,numArgs:s.numArgs,argTypes:s.argTypes,allowedInArgument:!!s.allowedInArgument,allowedInText:!!s.allowedInText,allowedInMath:s.allowedInMath===void 0?!0:s.allowedInMath,numOptionalArgs:s.numOptionalArgs||0,infix:!!s.infix,primitive:!!s.primitive,handler:r},l=0;l<n.length;++l)nW[n[l]]=a;t&&(i&&(Ok[t]=i),o&&(Pk[t]=o))}function xm(e){var{type:t,htmlBuilder:n,mathmlBuilder:s}=e;$t({type:t,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:s})}var Bk=function(t){return t.type==="ordgroup"&&t.body.length===1?t.body[0]:t},fi=function(t){return t.type==="ordgroup"?t.body:[t]},Kye=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),Yye=new Set(["rightmost","mrel","mclose","mpunct"]),Xye={display:On.DISPLAY,text:On.TEXT,script:On.SCRIPT,scriptscript:On.SCRIPTSCRIPT},Qye={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},Ai=function(t,n,s,r){r===void 0&&(r=[null,null]);for(var i=[],o=0;o<t.length;o++){var a=Hs(t[o],n);if(a instanceof Y0){var l=a.children;i.push(...l)}else i.push(a)}if(JV(i),!s)return i;var c=n;if(t.length===1){var d=t[0];d.type==="sizing"?c=n.havingSize(d.size):d.type==="styling"&&(c=n.havingStyle(Xye[d.style]))}var h=it([r[0]||"leftmost"],[],n),f=it([r[1]||"rightmost"],[],n),p=s==="root";return wT(i,(g,y)=>{var w=y.classes[0],v=g.classes[0];w==="mbin"&&Yye.has(v)?y.classes[0]="mord":v==="mbin"&&Kye.has(w)&&(g.classes[0]="mord")},{node:h},f,p),wT(i,(g,y)=>{var w,v,b=kT(y),x=kT(g),k=b&&x?g.hasClass("mtight")?(w=Gye[b])==null?void 0:w[x]:(v=Wye[b])==null?void 0:v[x]:null;if(k)return ZV(k,c)},{node:h},f,p),i},wT=function(t,n,s,r,i){r&&t.push(r);for(var o=0;o<t.length;o++){var a=t[o],l=sW(a);if(l){wT(l.children,n,s,null,i);continue}var c=!a.hasClass("mspace");if(c){var d=n(a,s.node);d&&(s.insertAfter?s.insertAfter(d):(t.unshift(d),o++))}c?s.node=a:i&&a.hasClass("newline")&&(s.node=it(["leftmost"])),s.insertAfter=(h=>f=>{t.splice(h+1,0,f),o++})(o)}r&&t.pop()},sW=function(t){return t instanceof Y0||t instanceof T_||t instanceof X0&&t.hasClass("enclosing")?t:null},xT=function(t,n){var s=sW(t);if(s){var r=s.children;if(r.length){if(n==="right")return xT(r[r.length-1],"right");if(n==="left")return xT(r[0],"left")}}return t},kT=function(t,n){if(!t)return null;n&&(t=xT(t,n));var s=t.classes[0];return Qye[s]||null},_y=function(t,n){var s=["nulldelimiter"].concat(t.baseSizingClasses());return it(n.concat(s))},Hs=function(t,n,s){if(!t)return it();if(Ok[t.type]){var r=Ok[t.type](t,n);if(s&&n.size!==s.size){r=it(n.sizingClasses(s),[r],n);var i=n.sizeMultiplier/s.sizeMultiplier;r.height*=i,r.depth*=i}return r}else throw new dt("Got group of unknown type: '"+t.type+"'")};function Wv(e,t){var n=it(["base"],e,t),s=it(["strut"]);return s.style.height=bt(n.height+n.depth),n.depth&&(s.style.verticalAlign=bt(-n.depth)),n.children.unshift(s),n}function _T(e,t){var n=null;e.length===1&&e[0].type==="tag"&&(n=e[0].tag,e=e[0].body);var s=Ai(e,t,"root"),r;s.length===2&&s[1].hasClass("tag")&&(r=s.pop());for(var i=[],o=[],a=0;a<s.length;a++)if(o.push(s[a]),s[a].hasClass("mbin")||s[a].hasClass("mrel")||s[a].hasClass("allowbreak")){for(var l=!1;a<s.length-1&&s[a+1].hasClass("mspace")&&!s[a+1].hasClass("newline");)a++,o.push(s[a]),s[a].hasClass("nobreak")&&(l=!0);l||(i.push(Wv(o,t)),o=[])}else s[a].hasClass("newline")&&(o.pop(),o.length>0&&(i.push(Wv(o,t)),o=[]),i.push(s[a]));o.length>0&&i.push(Wv(o,t));var c;n?(c=Wv(Ai(n,t,!0),t),c.classes=["tag"],i.push(c)):r&&i.push(r);var d=it(["katex-html"],i);if(d.setAttribute("aria-hidden","true"),c){var h=c.children[0];h.style.height=bt(d.height+d.depth),d.depth&&(h.style.verticalAlign=bt(-d.depth))}return d}function rW(e){return new Y0(e)}class ft{constructor(t,n,s){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=t,this.attributes={},this.children=n||[],this.classes=s||[]}setAttribute(t,n){this.attributes[t]=n}getAttribute(t){return this.attributes[t]}toNode(){var t=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&t.setAttribute(n,this.attributes[n]);this.classes.length>0&&(t.className=gh(this.classes));for(var s=0;s<this.children.length;s++)if(this.children[s]instanceof mi&&this.children[s+1]instanceof mi){for(var r=this.children[s].toText()+this.children[++s].toText();this.children[s+1]instanceof mi;)r+=this.children[++s].toText();t.appendChild(new mi(r).toNode())}else t.appendChild(this.children[s].toNode());return t}toMarkup(){var t="<"+this.type;for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&(t+=" "+n+'="',t+=go(this.attributes[n]),t+='"');this.classes.length>0&&(t+=' class ="'+go(gh(this.classes))+'"'),t+=">";for(var s=0;s<this.children.length;s++)t+=this.children[s].toMarkup();return t+="</"+this.type+">",t}toText(){return this.children.map(t=>t.toText()).join("")}}let mi=class{constructor(t){this.text=void 0,this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return go(this.toText())}toText(){return this.text}};class iW{constructor(t){this.width=void 0,this.character=void 0,this.width=t,t>=.05555&&t<=.05556?this.character=" ":t>=.1666&&t<=.1667?this.character=" ":t>=.2222&&t<=.2223?this.character=" ":t>=.2777&&t<=.2778?this.character="  ":t>=-.05556&&t<=-.05555?this.character=" ⁣":t>=-.1667&&t<=-.1666?this.character=" ⁣":t>=-.2223&&t<=-.2222?this.character=" ⁣":t>=-.2778&&t<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var t=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return t.setAttribute("width",bt(this.width)),t}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+bt(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var Jye=new Set(["\\imath","\\jmath"]),Zye=new Set(["mrow","mtable"]),xl=function(t,n,s){return Nr[n][t]&&Nr[n][t].replace&&t.charCodeAt(0)!==55349&&!(QV.hasOwnProperty(t)&&s&&(s.fontFamily&&s.fontFamily.slice(4,6)==="tt"||s.font&&s.font.slice(4,6)==="tt"))&&(t=Nr[n][t].replace),new mi(t)},wA=function(t){return t.length===1?t[0]:new ft("mrow",t)},ebe={mathit:"italic",boldsymbol:e=>e.type==="textord"?"bold":"bold-italic",mathbf:"bold",mathbb:"double-struck",mathsfit:"sans-serif-italic",mathfrak:"fraktur",mathscr:"script",mathcal:"script",mathsf:"sans-serif",mathtt:"monospace"},xA=(e,t)=>{if(e.mode==="text"){if(t.fontFamily==="texttt")return"monospace";if(t.fontFamily==="textsf")return t.fontShape==="textit"&&t.fontWeight==="textbf"?"sans-serif-bold-italic":t.fontShape==="textit"?"sans-serif-italic":t.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(t.fontShape==="textit"&&t.fontWeight==="textbf")return"bold-italic";if(t.fontShape==="textit")return"italic";if(t.fontWeight==="textbf")return"bold"}var n=t.font;if(!n||n==="mathnormal")return null;var s=e.mode,r=ebe[n];if(r)return typeof r=="function"?r(e):r;var i=e.text;if(Jye.has(i))return null;if(Nr[s][i]){var o=Nr[s][i].replace;o&&(i=o)}var a=vT[n].fontName;return yA(i,a,s)?vT[n].variant:null};function q3(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){var t=e.children[0];return t instanceof mi&&t.text==="."}else if(e.type==="mo"&&e.children.length===1&&e.getAttribute("separator")==="true"&&e.getAttribute("lspace")==="0em"&&e.getAttribute("rspace")==="0em"){var n=e.children[0];return n instanceof mi&&n.text===","}else return!1}var za=function(t,n,s){if(t.length===1){var r=hr(t[0],n);return s&&r instanceof ft&&r.type==="mo"&&(r.setAttribute("lspace","0em"),r.setAttribute("rspace","0em")),[r]}for(var i=[],o,a=0;a<t.length;a++){var l=hr(t[a],n);if(l instanceof ft&&o instanceof ft){if(l.type==="mtext"&&o.type==="mtext"&&l.getAttribute("mathvariant")===o.getAttribute("mathvariant")){o.children.push(...l.children);continue}else if(l.type==="mn"&&o.type==="mn"){o.children.push(...l.children);continue}else if(q3(l)&&o.type==="mn"){o.children.push(...l.children);continue}else if(l.type==="mn"&&q3(o))l.children=[...o.children,...l.children],i.pop();else if((l.type==="msup"||l.type==="msub")&&l.children.length>=1&&(o.type==="mn"||q3(o))){var c=l.children[0];c instanceof ft&&c.type==="mn"&&(c.children=[...o.children,...c.children],i.pop())}else if(o.type==="mi"&&o.children.length===1){var d=o.children[0];if(d instanceof mi&&d.text==="̸"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var h=l.children[0];h instanceof mi&&h.text.length>0&&(h.text=h.text.slice(0,1)+"̸"+h.text.slice(1),i.pop())}}}i.push(l),o=l}return i},vh=function(t,n,s){return wA(za(t,n,s))},hr=function(t,n){if(!t)return new ft("mrow");if(Pk[t.type])return Pk[t.type](t,n);throw new dt("Got group of unknown type: '"+t.type+"'")};function PL(e,t,n,s,r){var i=za(e,n),o;i.length===1&&i[0]instanceof ft&&Zye.has(i[0].type)?o=i[0]:o=new ft("mrow",i);var a=new ft("annotation",[new mi(t)]);a.setAttribute("encoding","application/x-tex");var l=new ft("semantics",[o,a]),c=new ft("math",[l]);c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),s&&c.setAttribute("display","block");var d=r?"katex":"katex-mathml";return it([d],[c])}var tbe=[[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]],BL=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],$L=function(t,n){return n.size<2?t:tbe[t-1][n.size-1]};class hu{constructor(t){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=t.style,this.color=t.color,this.size=t.size||hu.BASESIZE,this.textSize=t.textSize||this.size,this.phantom=!!t.phantom,this.font=t.font||"",this.fontFamily=t.fontFamily||"",this.fontWeight=t.fontWeight||"",this.fontShape=t.fontShape||"",this.sizeMultiplier=BL[this.size-1],this.maxSize=t.maxSize,this.minRuleThickness=t.minRuleThickness,this._fontMetrics=void 0}extend(t){var n={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};return Object.assign(n,t),new hu(n)}havingStyle(t){return this.style===t?this:this.extend({style:t,size:$L(this.textSize,t)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(t){return this.size===t&&this.textSize===t?this:this.extend({style:this.style.text(),size:t,textSize:t,sizeMultiplier:BL[t-1]})}havingBaseStyle(t){t=t||this.style.text();var n=$L(hu.BASESIZE,t);return this.size===n&&this.textSize===hu.BASESIZE&&this.style===t?this:this.extend({style:t,size:n})}havingBaseSizing(){var t;switch(this.style.id){case 4:case 5:t=3;break;case 6:case 7:t=1;break;default:t=6}return this.extend({style:this.style.text(),size:t})}withColor(t){return this.extend({color:t})}withPhantom(){return this.extend({phantom:!0})}withFont(t){return this.extend({font:t})}withTextFontFamily(t){return this.extend({fontFamily:t,font:""})}withTextFontWeight(t){return this.extend({fontWeight:t,font:""})}withTextFontShape(t){return this.extend({fontShape:t,font:""})}sizingClasses(t){return t.size!==this.size?["sizing","reset-size"+t.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==hu.BASESIZE?["sizing","reset-size"+this.size,"size"+hu.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=Bye(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}hu.BASESIZE=6;var oW=function(t){return new hu({style:t.displayMode?On.DISPLAY:On.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},aW=function(t,n){if(n.displayMode){var s=["katex-display"];n.leqno&&s.push("leqno"),n.fleqn&&s.push("fleqn"),t=it(s,[t])}return t},nbe=function(t,n,s){var r=oW(s),i;if(s.output==="mathml")return PL(t,n,r,s.displayMode,!0);if(s.output==="html"){var o=_T(t,r);i=it(["katex"],[o])}else{var a=PL(t,n,r,s.displayMode,!1),l=_T(t,r);i=it(["katex"],[a,l])}return aW(i,s)},sbe=function(t,n,s){var r=oW(s),i=_T(t,r),o=it(["katex"],[i]);return aW(o,s)},rbe={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":"="},M_=function(t){var n=new ft("mo",[new mi(rbe[t.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},ibe={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]},obe=new Set(["widehat","widecheck","widetilde","utilde"]),N_=function(t,n){function s(){var a=4e5,l=t.label.slice(1);if(obe.has(l)&&"base"in t){var c=t.base.type==="ordgroup"?t.base.body.length:1,d,h,f;if(c>5)l==="widehat"||l==="widecheck"?(d=420,a=2364,f=.42,h=l+"4"):(d=312,a=2340,f=.34,h="tilde4");else{var p=[1,1,2,2,3,3][c];l==="widehat"||l==="widecheck"?(a=[0,1062,2364,2364,2364][p],d=[0,239,300,360,420][p],f=[0,.24,.3,.3,.36,.42][p],h=l+p):(a=[0,600,1033,2339,2340][p],d=[0,260,286,306,312][p],f=[0,.26,.286,.3,.306,.34][p],h="tilde"+p)}var g=new yh(h),y=new qu([g],{width:"100%",height:bt(f),viewBox:"0 0 "+a+" "+d,preserveAspectRatio:"none"});return{span:bh([],[y],n),minWidth:0,height:f}}else{var w=[],v=ibe[l];if(!v)throw new Error('No SVG data for "'+l+'".');var[b,x,k]=v,T=k/1e3,C=b.length,S,_;if(C===1){if(v.length!==4)throw new Error('Expected 4-tuple for single-path SVG data "'+l+'".');S=["hide-tail"],_=[v[3]]}else if(C===2)S=["halfarrow-left","halfarrow-right"],_=["xMinYMin","xMaxYMin"];else if(C===3)S=["brace-left","brace-center","brace-right"],_=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
                    `+C+" children.");for(var L=0;L<C;L++){var M=new yh(b[L]),I=new qu([M],{width:"400em",height:bt(T),viewBox:"0 0 "+a+" "+k,preserveAspectRatio:_[L]+" slice"}),A=bh([S[L]],[I],n);if(C===1)return{span:A,minWidth:x,height:T};A.style.height=bt(T),w.push(A)}return{span:it(["stretchy"],w,n),minWidth:x,height:T}}}var{span:r,minWidth:i,height:o}=s();return r.height=o,r.style.height=bt(o),i>0&&(r.style.minWidth=bt(i)),r},abe=function(t,n,s,r,i){var o,a=t.height+t.depth+s+r;if(/fbox|color|angl/.test(n)){if(o=it(["stretchy",n],[],i),n==="fbox"){var l=i.color&&i.getColor();l&&(o.style.borderColor=l)}}else{var c=[];/^[bx]cancel$/.test(n)&&c.push(new fT({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&c.push(new fT({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var d=new qu(c,{width:"100%",height:bt(a)});o=bh([],[d],i)}return o.height=a,o.style.height=bt(a),o},lbe={bin:1,close:1,inner:1,open:1,punct:1,rel:1},cbe={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1};function ube(e){return e in lbe}function Qn(e,t){if(!e||e.type!==t)throw new Error("Expected node of type "+t+", but got "+(e?"node of type "+e.type:String(e)));return e}function I_(e){var t=R_(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?"node of type "+e.type:String(e)));return t}function R_(e){return e&&(e.type==="atom"||cbe.hasOwnProperty(e.type))?e:null}var lW=e=>{if(e instanceof Oa)return e;if(Pye(e)&&e.children.length===1)return lW(e.children[0])},kA=(e,t)=>{var n,s,r;e&&e.type==="supsub"?(s=Qn(e.base,"accent"),n=s.base,e.base=n,r=Oye(Hs(e,t)),e.base=s):(s=Qn(e,"accent"),n=s.base);var i=Hs(n,t.havingCrampedStyle()),o=s.isShifty&&Ju(n),a=0;if(o){var l,c;a=(l=(c=lW(i))==null?void 0:c.skew)!=null?l:0}var d=s.label==="\\c",h=d?i.height+i.depth:Math.min(i.height,t.fontMetrics().xHeight),f;if(s.isStretchy)f=N_(s,t),f=Fs({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:f,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+bt(2*a)+")",marginLeft:bt(2*a)}:void 0}]});else{var p,g;s.label==="\\vec"?(p=tW("vec",t),g=eW.vec[1]):(p=A_({mode:s.mode,text:s.label},t,"textord"),p=Dye(p),p.italic=0,g=p.width,d&&(h+=p.depth)),f=it(["accent-body"],[p]);var y=s.label==="\\textcircled";y&&(f.classes.push("accent-full"),h=i.height);var w=a;y||(w-=g/2),f.style.left=bt(w),s.label==="\\textcircled"&&(f.style.top=".2em"),f=Fs({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-h},{type:"elem",elem:f}]})}var v=it(["mord","accent"],[f],t);return r?(r.children[0]=v,r.height=Math.max(v.height,r.height),r.classes[0]="mord",r):v},cW=(e,t)=>{var n=e.isStretchy?M_(e.label):new ft("mo",[xl(e.label,e.mode)]),s=new ft("mover",[hr(e.base,t),n]);return s.setAttribute("accent","true"),s},dbe=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));$t({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(e,t)=>{var n=Bk(t[0]),s=!dbe.test(e.funcName),r=!s||e.funcName==="\\widehat"||e.funcName==="\\widetilde"||e.funcName==="\\widecheck";return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:s,isShifty:r,base:n}},htmlBuilder:kA,mathmlBuilder:cW});$t({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,t)=>{var n=t[0],s=e.parser.mode;return s==="math"&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),s="text"),{type:"accent",mode:s,label:e.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:kA,mathmlBuilder:cW});$t({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(e,t)=>{var{parser:n,funcName:s}=e,r=t[0];return{type:"accentUnder",mode:n.mode,label:s,base:r}},htmlBuilder:(e,t)=>{var n=Hs(e.base,t),s=N_(e,t),r=e.label==="\\utilde"?.12:0,i=Fs({positionType:"top",positionData:n.height,children:[{type:"elem",elem:s,wrapperClasses:["svg-align"]},{type:"kern",size:r},{type:"elem",elem:n}]});return it(["mord","accentunder"],[i],t)},mathmlBuilder:(e,t)=>{var n=M_(e.label),s=new ft("munder",[hr(e.base,t),n]);return s.setAttribute("accentunder","true"),s}});var Gv=e=>{var t=new ft("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};$t({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){var{parser:s,funcName:r}=e;return{type:"xArrow",mode:s.mode,label:r,body:t[0],below:n[0]}},htmlBuilder(e,t){var n=t.style,s=t.havingStyle(n.sup()),r=x0(Hs(e.body,s,t),t),i=e.label.slice(0,2)==="\\x"?"x":"cd";r.classes.push(i+"-arrow-pad");var o;e.below&&(s=t.havingStyle(n.sub()),o=x0(Hs(e.below,s,t),t),o.classes.push(i+"-arrow-pad"));var a=N_(e,t),l=-t.fontMetrics().axisHeight+.5*a.height,c=-t.fontMetrics().axisHeight-.5*a.height-.111;(r.depth>.25||e.label==="\\xleftequilibrium")&&(c-=r.depth);var d;if(o){var h=-t.fontMetrics().axisHeight+o.height+.5*a.height+.111;d=Fs({positionType:"individualShift",children:[{type:"elem",elem:r,shift:c},{type:"elem",elem:a,shift:l,wrapperClasses:["svg-align"]},{type:"elem",elem:o,shift:h}]})}else d=Fs({positionType:"individualShift",children:[{type:"elem",elem:r,shift:c},{type:"elem",elem:a,shift:l,wrapperClasses:["svg-align"]}]});return it(["mrel","x-arrow"],[d],t)},mathmlBuilder(e,t){var n=M_(e.label);n.setAttribute("minsize",e.label.charAt(0)==="x"?"1.75em":"3.0em");var s;if(e.body){var r=Gv(hr(e.body,t));if(e.below){var i=Gv(hr(e.below,t));s=new ft("munderover",[n,i,r])}else s=new ft("mover",[n,r])}else if(e.below){var o=Gv(hr(e.below,t));s=new ft("munder",[n,o])}else s=Gv(),s=new ft("mover",[n,s]);return s}});function uW(e,t){var n=Ai(e.body,t,!0);return it([e.mclass],n,t)}function dW(e,t){var n,s=za(e.body,t);return e.mclass==="minner"?n=new ft("mpadded",s):e.mclass==="mord"?e.isCharacterBox?(n=s[0],n.type="mi"):n=new ft("mi",s):(e.isCharacterBox?(n=s[0],n.type="mo"):n=new ft("mo",s),e.mclass==="mbin"?(n.attributes.lspace="0.22em",n.attributes.rspace="0.22em"):e.mclass==="mpunct"?(n.attributes.lspace="0em",n.attributes.rspace="0.17em"):e.mclass==="mopen"||e.mclass==="mclose"?(n.attributes.lspace="0em",n.attributes.rspace="0em"):e.mclass==="minner"&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em")),n}$t({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(e,t){var{parser:n,funcName:s}=e,r=t[0];return{type:"mclass",mode:n.mode,mclass:"m"+s.slice(5),body:fi(r),isCharacterBox:Ju(r)}},htmlBuilder:uW,mathmlBuilder:dW});var j_=e=>{var t=e.type==="ordgroup"&&e.body.length?e.body[0]:e;return t.type==="atom"&&(t.family==="bin"||t.family==="rel")?"m"+t.family:"mord"};$t({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:n}=e;return{type:"mclass",mode:n.mode,mclass:j_(t[0]),body:fi(t[1]),isCharacterBox:Ju(t[1])}}});$t({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(e,t){var{parser:n,funcName:s}=e,r=t[1],i=t[0],o;s!=="\\stackrel"?o=j_(r):o="mrel";var a={type:"op",mode:r.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:s!=="\\stackrel",body:fi(r)},l={type:"supsub",mode:i.mode,base:a,sup:s==="\\underset"?null:i,sub:s==="\\underset"?i:null};return{type:"mclass",mode:n.mode,mclass:o,body:[l],isCharacterBox:Ju(l)}},htmlBuilder:uW,mathmlBuilder:dW});$t({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"pmb",mode:n.mode,mclass:j_(t[0]),body:fi(t[0])}},htmlBuilder(e,t){var n=Ai(e.body,t,!0),s=it([e.mclass],n,t);return s.style.textShadow="0.02em 0.01em 0.04px",s},mathmlBuilder(e,t){var n=za(e.body,t),s=new ft("mstyle",n);return s.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),s}});var hbe={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},zL=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),FL=e=>e.type==="textord"&&e.text==="@",fbe=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;function mbe(e,t,n){var s=hbe[e];switch(s){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(s,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":{var r=n.callFunction("\\\\cdleft",[t[0]],[]),i={type:"atom",text:s,mode:"math",family:"rel"},o=n.callFunction("\\Big",[i],[]),a=n.callFunction("\\\\cdright",[t[1]],[]),l={type:"ordgroup",mode:"math",body:[r,o,a]};return n.callFunction("\\\\cdparent",[l],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var c={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[c],[])}default:return{type:"textord",text:" ",mode:"math"}}}function pbe(e){var t=[];for(e.gullet.beginGroup(),e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,"\\\\")),e.gullet.endGroup(),e.gullet.beginGroup();var n=e.fetch().text;if(n==="&"||n==="\\\\")e.consume();else if(n==="\\end"){t[t.length-1].length===0&&t.pop();break}else throw new dt("Expected \\\\ or \\cr or \\end",e.nextToken)}for(var s=[],r=[s],i=0;i<t.length;i++){for(var o=t[i],a=zL(),l=0;l<o.length;l++)if(!FL(o[l]))a.body.push(o[l]);else{s.push(a),l+=1;var c=I_(o[l]).text,d=new Array(2);if(d[0]={type:"ordgroup",mode:"math",body:[]},d[1]={type:"ordgroup",mode:"math",body:[]},!"=|.".includes(c))if("<>AV".includes(c))for(var h=0;h<2;h++){for(var f=!0,p=l+1;p<o.length;p++){if(fbe(o[p],c)){f=!1,l=p;break}if(FL(o[p]))throw new dt("Missing a "+c+" character to complete a CD arrow.",o[p]);d[h].body.push(o[p])}if(f)throw new dt("Missing a "+c+" character to complete a CD arrow.",o[l])}else throw new dt('Expected one of "<>AV=|." after @',o[l]);var g=mbe(c,d,e),y={type:"styling",body:[g],mode:"math",style:"display",resetFont:!0};s.push(y),a=zL()}i%2===0?s.push(a):s.shift(),s=[],r.push(s)}e.gullet.endGroup(),e.gullet.endGroup();var w=new Array(r[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:r,arraystretch:1,addJot:!0,rowGaps:[null],cols:w,colSeparationType:"CD",hLinesBeforeRow:new Array(r.length+1).fill([])}}$t({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:s}=e;return{type:"cdlabel",mode:n.mode,side:s.slice(4),label:t[0]}},htmlBuilder(e,t){var n=t.havingStyle(t.style.sup()),s=x0(Hs(e.label,n,t),t);return s.classes.push("cd-label-"+e.side),s.style.bottom=bt(.8-s.depth),s.height=0,s.depth=0,s},mathmlBuilder(e,t){var n=new ft("mrow",[hr(e.label,t)]);return n=new ft("mpadded",[n]),n.setAttribute("width","0"),e.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new ft("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});$t({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(e,t){var{parser:n}=e;return{type:"cdlabelparent",mode:n.mode,fragment:t[0]}},htmlBuilder(e,t){var n=x0(Hs(e.fragment,t),t);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(e,t){return new ft("mrow",[hr(e.fragment,t)])}});$t({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:n}=e,s=Qn(t[0],"ordgroup"),r=s.body,i="",o=0;o<r.length;o++){var a=Qn(r[o],"textord");i+=a.text}var l=parseInt(i),c;if(isNaN(l))throw new dt("\\@char has non-numeric argument "+i);if(l<0||l>=1114111)throw new dt("\\@char with invalid code point "+i);return l<=65535?c=String.fromCharCode(l):(l-=65536,c=String.fromCharCode((l>>10)+55296,(l&1023)+56320)),{type:"textord",mode:n.mode,text:c}}});var hW=(e,t)=>{var n=Ai(e.body,t.withColor(e.color),!1);return ed(n)},fW=(e,t)=>{var n=za(e.body,t.withColor(e.color)),s=new ft("mstyle",n);return s.setAttribute("mathcolor",e.color),s};$t({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:n}=e,s=Qn(t[0],"color-token").color,r=t[1];return{type:"color",mode:n.mode,color:s,body:fi(r)}},htmlBuilder:hW,mathmlBuilder:fW});$t({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,t){var{parser:n,breakOnTokenText:s}=e,r=Qn(t[0],"color-token").color;n.gullet.macros.set("\\current@color",r);var i=n.parseExpression(!0,s);return{type:"color",mode:n.mode,color:r,body:i}},htmlBuilder:hW,mathmlBuilder:fW});$t({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(e,t,n){var{parser:s}=e,r=s.gullet.future().text==="["?s.parseSizeGroup(!0):null,i=!s.settings.displayMode||!s.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:s.mode,newLine:i,size:r&&Qn(r,"size").value}},htmlBuilder(e,t){var n=it(["mspace"],[],t);return e.newLine&&(n.classes.push("newline"),e.size&&(n.style.marginTop=bt($r(e.size,t)))),n},mathmlBuilder(e,t){var n=new ft("mspace");return e.newLine&&(n.setAttribute("linebreak","newline"),e.size&&n.setAttribute("height",bt($r(e.size,t)))),n}});var ST={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},mW=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new dt("Expected a control sequence",e);return t},gbe=e=>{var t=e.gullet.popToken();return t.text==="="&&(t=e.gullet.popToken(),t.text===" "&&(t=e.gullet.popToken())),t},pW=(e,t,n,s)=>{var r=e.gullet.macros.get(n.text);r==null&&(n.noexpand=!0,r={tokens:[n],numArgs:0,unexpandable:!e.gullet.isExpandable(n.text)}),e.gullet.macros.set(t,r,s)};$t({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(e){var{parser:t,funcName:n}=e;t.consumeSpaces();var s=t.fetch();if(ST[s.text])return(n==="\\global"||n==="\\\\globallong")&&(s.text=ST[s.text]),Qn(t.parseFunction(),"internal");throw new dt("Invalid token after macro prefix",s)}});$t({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,s=t.gullet.popToken(),r=s.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(r))throw new dt("Expected a control sequence",s);for(var i=0,o,a=[[]];t.gullet.future().text!=="{";)if(s=t.gullet.popToken(),s.text==="#"){if(t.gullet.future().text==="{"){o=t.gullet.future(),a[i].push("{");break}if(s=t.gullet.popToken(),!/^[1-9]$/.test(s.text))throw new dt('Invalid argument number "'+s.text+'"');if(parseInt(s.text)!==i+1)throw new dt('Argument number "'+s.text+'" out of order');i++,a.push([])}else{if(s.text==="EOF")throw new dt("Expected a macro definition");a[i].push(s.text)}var{tokens:l}=t.gullet.consumeArg();return o&&l.unshift(o),(n==="\\edef"||n==="\\xdef")&&(l=t.gullet.expandTokens(l),l.reverse()),t.gullet.macros.set(r,{tokens:l,numArgs:i,delimiters:a},n===ST[n]),{type:"internal",mode:t.mode}}});$t({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,s=mW(t.gullet.popToken());t.gullet.consumeSpaces();var r=gbe(t);return pW(t,s,r,n==="\\\\globallet"),{type:"internal",mode:t.mode}}});$t({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,s=mW(t.gullet.popToken()),r=t.gullet.popToken(),i=t.gullet.popToken();return pW(t,s,i,n==="\\\\globalfuture"),t.gullet.pushToken(i),t.gullet.pushToken(r),{type:"internal",mode:t.mode}}});var l1=function(t,n,s){var r=Nr.math[t]&&Nr.math[t].replace,i=yA(r||t,n,s);if(!i)throw new Error("Unsupported symbol "+t+" and font size "+n+".");return i},_A=function(t,n,s,r){var i=s.havingBaseStyle(n),o=it(r.concat(i.sizingClasses(s)),[t],s),a=i.sizeMultiplier/s.sizeMultiplier;return o.height*=a,o.depth*=a,o.maxFontSize=i.sizeMultiplier,o},gW=function(t,n,s){var r=n.havingBaseStyle(s),i=(1-n.sizeMultiplier/r.sizeMultiplier)*n.fontMetrics().axisHeight;t.classes.push("delimcenter"),t.style.top=bt(i),t.height-=i,t.depth+=i},ybe=function(t,n,s,r,i,o){var a=Ao(t,"Main-Regular",i,r),l=_A(a,n,r,o);return gW(l,r,n),l},bbe=function(t,n,s,r){return Ao(t,"Size"+n+"-Regular",s,r)},yW=function(t,n,s,r,i,o){var a=bbe(t,n,i,r),l=_A(it(["delimsizing","size"+n],[a],r),On.TEXT,r,o);return s&&gW(l,r,On.TEXT),l},H3=function(t,n,s){var r;n==="Size1-Regular"?r="delim-size1":r="delim-size4";var i=it(["delimsizinginner",r],[it([],[Ao(t,n,s)])]);return{type:"elem",elem:i}},U3=function(t,n,s){var r=kc["Size4-Regular"][t.charCodeAt(0)]?kc["Size4-Regular"][t.charCodeAt(0)][4]:kc["Size1-Regular"][t.charCodeAt(0)][4],i=new yh("inner",Aye(t,Math.round(1e3*n))),o=new qu([i],{width:bt(r),height:bt(n),style:"width:"+bt(r),viewBox:"0 0 "+1e3*r+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),a=bh([],[o],s);return a.height=n,a.style.height=bt(n),a.style.width=bt(r),{type:"elem",elem:a}},CT=.008,Kv={type:"kern",size:-1*CT},vbe=new Set(["|","\\lvert","\\rvert","\\vert"]),wbe=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),bW=function(t,n,s,r,i,o){var a,l,c,d,h="",f=0;a=c=d=t,l=null;var p="Size1-Regular";t==="\\uparrow"?c=d="⏐":t==="\\Uparrow"?c=d="‖":t==="\\downarrow"?a=c="⏐":t==="\\Downarrow"?a=c="‖":t==="\\updownarrow"?(a="\\uparrow",c="⏐",d="\\downarrow"):t==="\\Updownarrow"?(a="\\Uparrow",c="‖",d="\\Downarrow"):vbe.has(t)?(c="∣",h="vert",f=333):wbe.has(t)?(c="∥",h="doublevert",f=556):t==="["||t==="\\lbrack"?(a="⎡",c="⎢",d="⎣",p="Size4-Regular",h="lbrack",f=667):t==="]"||t==="\\rbrack"?(a="⎤",c="⎥",d="⎦",p="Size4-Regular",h="rbrack",f=667):t==="\\lfloor"||t==="⌊"?(c=a="⎢",d="⎣",p="Size4-Regular",h="lfloor",f=667):t==="\\lceil"||t==="⌈"?(a="⎡",c=d="⎢",p="Size4-Regular",h="lceil",f=667):t==="\\rfloor"||t==="⌋"?(c=a="⎥",d="⎦",p="Size4-Regular",h="rfloor",f=667):t==="\\rceil"||t==="⌉"?(a="⎤",c=d="⎥",p="Size4-Regular",h="rceil",f=667):t==="("||t==="\\lparen"?(a="⎛",c="⎜",d="⎝",p="Size4-Regular",h="lparen",f=875):t===")"||t==="\\rparen"?(a="⎞",c="⎟",d="⎠",p="Size4-Regular",h="rparen",f=875):t==="\\{"||t==="\\lbrace"?(a="⎧",l="⎨",d="⎩",c="⎪",p="Size4-Regular"):t==="\\}"||t==="\\rbrace"?(a="⎫",l="⎬",d="⎭",c="⎪",p="Size4-Regular"):t==="\\lgroup"||t==="⟮"?(a="⎧",d="⎩",c="⎪",p="Size4-Regular"):t==="\\rgroup"||t==="⟯"?(a="⎫",d="⎭",c="⎪",p="Size4-Regular"):t==="\\lmoustache"||t==="⎰"?(a="⎧",d="⎭",c="⎪",p="Size4-Regular"):(t==="\\rmoustache"||t==="⎱")&&(a="⎫",d="⎩",c="⎪",p="Size4-Regular");var g=l1(a,p,i),y=g.height+g.depth,w=l1(c,p,i),v=w.height+w.depth,b=l1(d,p,i),x=b.height+b.depth,k=0,T=1;if(l!==null){var C=l1(l,p,i);k=C.height+C.depth,T=2}var S=y+x+k,_=Math.max(0,Math.ceil((n-S)/(T*v))),L=S+_*T*v,M=r.fontMetrics().axisHeight;s&&(M*=r.sizeMultiplier);var I=L/2-M,A=[];if(h.length>0){var P=L-y-x,B=Math.round(L*1e3),F=Mye(h,Math.round(P*1e3)),O=new yh(h,F),X=bt(f/1e3),z=bt(B/1e3),U=new qu([O],{width:X,height:z,viewBox:"0 0 "+f+" "+B}),D=bh([],[U],r);D.height=B/1e3,D.style.width=X,D.style.height=z,A.push({type:"elem",elem:D})}else{if(A.push(H3(d,p,i)),A.push(Kv),l===null){var G=L-y-x+2*CT;A.push(U3(c,G,r))}else{var q=(L-y-x-k)/2+2*CT;A.push(U3(c,q,r)),A.push(Kv),A.push(H3(l,p,i)),A.push(Kv),A.push(U3(c,q,r))}A.push(Kv),A.push(H3(a,p,i))}var N=r.havingBaseStyle(On.TEXT),ee=Fs({positionType:"bottom",positionData:I,children:A});return _A(it(["delimsizing","mult"],[ee],N),On.TEXT,r,o)},V3=80,W3=.08,G3=function(t,n,s,r,i){var o=Eye(t,r,s),a=new yh(t,o),l=new qu([a],{width:"400em",height:bt(n),viewBox:"0 0 400000 "+s,preserveAspectRatio:"xMinYMin slice"});return bh(["hide-tail"],[l],i)},xbe=function(t,n){var s=n.havingBaseSizing(),r=_W("\\surd",t*s.sizeMultiplier,kW,s),i=s.sizeMultiplier,o=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),a,l,c,d,h;return r.type==="small"?(d=1e3+1e3*o+V3,t<1?i=1:t<1.4&&(i=.7),l=(1+o+W3)/i,c=(1+o)/i,a=G3("sqrtMain",l,d,o,n),a.style.minWidth="0.853em",h=.833/i):r.type==="large"?(d=(1e3+V3)*V1[r.size],c=(V1[r.size]+o)/i,l=(V1[r.size]+o+W3)/i,a=G3("sqrtSize"+r.size,l,d,o,n),a.style.minWidth="1.02em",h=1/i):(l=t+o+W3,c=t+o,d=Math.floor(1e3*t+o)+V3,a=G3("sqrtTall",l,d,o,n),a.style.minWidth="0.742em",h=1.056),a.height=c,a.style.height=bt(l),{span:a,advanceWidth:h,ruleWidth:(n.fontMetrics().sqrtRuleThickness+o)*i}},vW=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),kbe=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),wW=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),V1=[0,1.2,1.8,2.4,3],xW=function(t,n,s,r,i){if(t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle"),vW.has(t)||wW.has(t))return yW(t,n,!1,s,r,i);if(kbe.has(t))return bW(t,V1[n],!1,s,r,i);throw new dt("Illegal delimiter: '"+t+"'")},_be=[{type:"small",style:On.SCRIPTSCRIPT},{type:"small",style:On.SCRIPT},{type:"small",style:On.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Sbe=[{type:"small",style:On.SCRIPTSCRIPT},{type:"small",style:On.SCRIPT},{type:"small",style:On.TEXT},{type:"stack"}],kW=[{type:"small",style:On.SCRIPTSCRIPT},{type:"small",style:On.SCRIPT},{type:"small",style:On.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],Cbe=function(t){if(t.type==="small")return"Main-Regular";if(t.type==="large")return"Size"+t.size+"-Regular";if(t.type==="stack")return"Size4-Regular";var n=t.type;throw new Error("Add support for delim type '"+n+"' here.")},_W=function(t,n,s,r){for(var i=Math.min(2,3-r.style.size),o=i;o<s.length;o++){var a=s[o];if(a.type==="stack")break;var l=l1(t,Cbe(a),"math"),c=l.height+l.depth;if(a.type==="small"){var d=r.havingBaseStyle(a.style);c*=d.sizeMultiplier}if(c>n)return a}return s[s.length-1]},TT=function(t,n,s,r,i,o){t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle");var a;wW.has(t)?a=_be:vW.has(t)?a=kW:a=Sbe;var l=_W(t,n,a,r);return l.type==="small"?ybe(t,l.style,s,r,i,o):l.type==="large"?yW(t,l.size,s,r,i,o):bW(t,n,s,r,i,o)},K3=function(t,n,s,r,i,o){var a=r.fontMetrics().axisHeight*r.sizeMultiplier,l=901,c=5/r.fontMetrics().ptPerEm,d=Math.max(n-a,s+a),h=Math.max(d/500*l,2*d-c);return TT(t,h,!0,r,i,o)},qL={"\\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}},Tbe=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 HL(e){return"isMiddle"in e}function L_(e,t){var n=R_(e);if(n&&Tbe.has(n.text))return n;throw n?new dt("Invalid delimiter '"+n.text+"' after '"+t.funcName+"'",e):new dt("Invalid delimiter type '"+e.type+"'",e)}$t({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{var n=L_(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:qL[e.funcName].size,mclass:qL[e.funcName].mclass,delim:n.text}},htmlBuilder:(e,t)=>e.delim==="."?it([e.mclass]):xW(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];e.delim!=="."&&t.push(xl(e.delim,e.mode));var n=new ft("mo",t);e.mclass==="mopen"||e.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var s=bt(V1[e.size]);return n.setAttribute("minsize",s),n.setAttribute("maxsize",s),n}});function UL(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}$t({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=e.parser.gullet.macros.get("\\current@color");if(n&&typeof n!="string")throw new dt("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:L_(t[0],e).text,color:n}}});$t({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=L_(t[0],e),s=e.parser;++s.leftrightDepth;var r=s.parseExpression(!1);--s.leftrightDepth,s.expect("\\right",!1);var i=Qn(s.parseFunction(),"leftright-right");return{type:"leftright",mode:s.mode,body:r,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(e,t)=>{UL(e);for(var n=Ai(e.body,t,!0,["mopen","mclose"]),s=0,r=0,i=!1,o=0;o<n.length;o++){var a=n[o];HL(a)?i=!0:(s=Math.max(n[o].height,s),r=Math.max(n[o].depth,r))}s*=t.sizeMultiplier,r*=t.sizeMultiplier;var l;if(e.left==="."?l=_y(t,["mopen"]):l=K3(e.left,s,r,t,e.mode,["mopen"]),n.unshift(l),i)for(var c=1;c<n.length;c++){var d=n[c];if(HL(d)){var h=d.isMiddle;n[c]=K3(h.delim,s,r,h.options,e.mode,[])}}var f;if(e.right===".")f=_y(t,["mclose"]);else{var p=e.rightColor?t.withColor(e.rightColor):t;f=K3(e.right,s,r,p,e.mode,["mclose"])}return n.push(f),it(["minner"],n,t)},mathmlBuilder:(e,t)=>{UL(e);var n=za(e.body,t);if(e.left!=="."){var s=new ft("mo",[xl(e.left,e.mode)]);s.setAttribute("fence","true"),n.unshift(s)}if(e.right!=="."){var r=new ft("mo",[xl(e.right,e.mode)]);r.setAttribute("fence","true"),e.rightColor&&r.setAttribute("mathcolor",e.rightColor),n.push(r)}return wA(n)}});$t({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=L_(t[0],e);if(!e.parser.leftrightDepth)throw new dt("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},htmlBuilder:(e,t)=>{var n;return e.delim==="."?n=_y(t,[]):(n=xW(e.delim,1,t,e.mode,[]),n.isMiddle={delim:e.delim,options:t}),n},mathmlBuilder:(e,t)=>{var n=e.delim==="\\vert"||e.delim==="|"?xl("|","text"):xl(e.delim,e.mode),s=new ft("mo",[n]);return s.setAttribute("fence","true"),s.setAttribute("lspace","0.05em"),s.setAttribute("rspace","0.05em"),s}});var D_=(e,t)=>{var n=x0(Hs(e.body,t),t),s=e.label.slice(1),r=t.sizeMultiplier,i,o,a=Ju(e.body);if(s==="sout")i=it(["stretchy","sout"]),i.height=t.fontMetrics().defaultRuleThickness/r,o=-.5*t.fontMetrics().xHeight;else if(s==="phase"){var l=$r({number:.6,unit:"pt"},t),c=$r({number:.35,unit:"ex"},t),d=t.havingBaseSizing();r=r/d.sizeMultiplier;var h=n.height+n.depth+l+c;n.style.paddingLeft=bt(h/2+l);var f=Math.floor(1e3*h*r),p=Cye(f),g=new qu([new yh("phase",p)],{width:"400em",height:bt(f/1e3),viewBox:"0 0 400000 "+f,preserveAspectRatio:"xMinYMin slice"});i=bh(["hide-tail"],[g],t),i.style.height=bt(h),o=n.depth+l+c}else{/cancel/.test(s)?a||n.classes.push("cancel-pad"):s==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var y,w,v=0;/box/.test(s)?(v=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),y=t.fontMetrics().fboxsep+(s==="colorbox"?0:v),w=y):s==="angl"?(v=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness),y=4*v,w=Math.max(0,.25-n.depth)):(y=a?.2:0,w=y),i=abe(n,s,y,w,t),/fbox|boxed|fcolorbox/.test(s)?(i.style.borderStyle="solid",i.style.borderWidth=bt(v)):s==="angl"&&v!==.049&&(i.style.borderTopWidth=bt(v),i.style.borderRightWidth=bt(v)),o=n.depth+w,e.backgroundColor&&(i.style.backgroundColor=e.backgroundColor,e.borderColor&&(i.style.borderColor=e.borderColor))}var b;if(e.backgroundColor)b=Fs({positionType:"individualShift",children:[{type:"elem",elem:i,shift:o},{type:"elem",elem:n,shift:0}]});else{var x=/cancel|phase/.test(s)?["svg-align"]:[];b=Fs({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:o,wrapperClasses:x}]})}return/cancel/.test(s)&&(b.height=n.height,b.depth=n.depth),/cancel/.test(s)&&!a?it(["mord","cancel-lap"],[b],t):it(["mord"],[b],t)},O_=(e,t)=>{var n,s=new ft(e.label.includes("colorbox")?"mpadded":"menclose",[hr(e.body,t)]);switch(e.label){case"\\cancel":s.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":s.setAttribute("notation","downdiagonalstrike");break;case"\\phase":s.setAttribute("notation","phasorangle");break;case"\\sout":s.setAttribute("notation","horizontalstrike");break;case"\\fbox":s.setAttribute("notation","box");break;case"\\angl":s.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,s.setAttribute("width","+"+2*n+"pt"),s.setAttribute("height","+"+2*n+"pt"),s.setAttribute("lspace",n+"pt"),s.setAttribute("voffset",n+"pt"),e.label==="\\fcolorbox"){var r=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);s.setAttribute("style","border: "+bt(r)+" solid "+e.borderColor)}break;case"\\xcancel":s.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return e.backgroundColor&&s.setAttribute("mathbackground",e.backgroundColor),s};$t({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","hbox"]},handler(e,t,n){var{parser:s,funcName:r}=e,i=Qn(t[0],"color-token").color,o=t[1];return{type:"enclose",mode:s.mode,label:r,backgroundColor:i,body:o}},htmlBuilder:D_,mathmlBuilder:O_});$t({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"]},handler(e,t,n){var{parser:s,funcName:r}=e,i=Qn(t[0],"color-token").color,o=Qn(t[1],"color-token").color,a=t[2];return{type:"enclose",mode:s.mode,label:r,backgroundColor:o,borderColor:i,body:a}},htmlBuilder:D_,mathmlBuilder:O_});$t({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"enclose",mode:n.mode,label:"\\fbox",body:t[0]}}});$t({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\phase"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:s}=e,r=t[0];return{type:"enclose",mode:n.mode,label:s,body:r}},htmlBuilder:D_,mathmlBuilder:O_});$t({type:"enclose",names:["\\sout"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n,funcName:s}=e;n.mode==="math"&&n.settings.reportNonstrict("mathVsSout","LaTeX's \\sout works only in text mode");var r=t[0];return{type:"enclose",mode:n.mode,label:s,body:r}},htmlBuilder:D_,mathmlBuilder:O_});$t({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(e,t){var{parser:n}=e;return{type:"enclose",mode:n.mode,label:"\\angl",body:t[0]}}});var SW={};function qc(e){for(var{type:t,names:n,props:s,handler:r,htmlBuilder:i,mathmlBuilder:o}=e,a={type:t,numArgs:s.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:r},l=0;l<n.length;++l)SW[n[l]]=a;i&&(Ok[t]=i),o&&(Pk[t]=o)}var CW={};function V(e,t){CW[e]=t}class Jo{constructor(t,n,s){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=t,this.start=n,this.end=s}static range(t,n){return n?!t||!t.loc||!n.loc||t.loc.lexer!==n.loc.lexer?null:new Jo(t.loc.lexer,t.loc.start,n.loc.end):t&&t.loc}}class Ra{constructor(t,n){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=t,this.loc=n}range(t,n){return new Ra(n,Jo.range(this,t))}}function VL(e){var t=[];e.consumeSpaces();var n=e.fetch().text;for(n==="\\relax"&&(e.consume(),e.consumeSpaces(),n=e.fetch().text);n==="\\hline"||n==="\\hdashline";)e.consume(),t.push(n==="\\hdashline"),e.consumeSpaces(),n=e.fetch().text;return t}var P_=e=>{var t=e.parser.settings;if(!t.displayMode)throw new dt("{"+e.envName+"} can be used only in display mode.")},Ebe=new Set(["gather","gather*"]);function SA(e){if(!e.includes("ed"))return!e.includes("*")}function Ph(e,t,n){var{hskipBeforeAndAfter:s,addJot:r,cols:i,arraystretch:o,colSeparationType:a,autoTag:l,singleRow:c,emptySingleRow:d,maxNumCols:h,leqno:f}=t;if(e.gullet.beginGroup(),c||e.gullet.macros.set("\\cr","\\\\\\relax"),!o){var p=e.gullet.expandMacroAsText("\\arraystretch");if(p==null)o=1;else if(o=parseFloat(p),!o||o<0)throw new dt("Invalid \\arraystretch: "+p)}e.gullet.beginGroup();var g=[],y=[g],w=[],v=[],b=l!=null?[]:void 0;function x(){l&&e.gullet.macros.set("\\@eqnsw","1",!0)}function k(){b&&(e.gullet.macros.get("\\df@tag")?(b.push(e.subparse([new Ra("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):b.push(!!l&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(x(),v.push(VL(e));;){var T=e.parseExpression(!1,c?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup();var C={type:"ordgroup",mode:e.mode,body:T};n&&(C={type:"styling",mode:e.mode,style:n,resetFont:!0,body:[C]}),g.push(C);var S=e.fetch().text;if(S==="&"){if(h&&g.length===h){if(c||a)throw new dt("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else if(S==="\\end"){k(),g.length===1&&C.type==="styling"&&C.body.length===1&&C.body[0].type==="ordgroup"&&C.body[0].body.length===0&&(y.length>1||!d)&&y.pop(),v.length<y.length+1&&v.push([]);break}else if(S==="\\\\"){e.consume();var _=void 0;e.gullet.future().text!==" "&&(_=e.parseSizeGroup(!0)),w.push(_?_.value:null),k(),v.push(VL(e)),g=[],y.push(g),x()}else throw new dt("Expected & or \\\\ or \\cr or \\end",e.nextToken)}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:e.mode,addJot:r,arraystretch:o,body:y,cols:i,rowGaps:w,hskipBeforeAndAfter:s,hLinesBeforeRow:v,colSeparationType:a,tags:b,leqno:f}}function CA(e){return e.slice(0,1)==="d"?"display":"text"}var Hc=function(t,n){var s,r,i=t.body.length,o=t.hLinesBeforeRow,a=0,l=new Array(i),c=[],d=Math.max(n.fontMetrics().arrayRuleWidth,n.minRuleThickness),h=1/n.fontMetrics().ptPerEm,f=5*h;if(t.colSeparationType&&t.colSeparationType==="small"){var p=n.havingStyle(On.SCRIPT).sizeMultiplier;f=.2778*(p/n.sizeMultiplier)}var g=t.colSeparationType==="CD"?$r({number:3,unit:"ex"},n):12*h,y=3*h,w=t.arraystretch*g,v=.7*w,b=.3*w,x=0;function k(Ye){for(var Nt=0;Nt<Ye.length;++Nt)Nt>0&&(x+=.25),c.push({pos:x,isDashed:Ye[Nt]})}for(k(o[0]),s=0;s<t.body.length;++s){var T=t.body[s],C=v,S=b;a<T.length&&(a=T.length);var _={cells:new Array(T.length),height:0,depth:0,pos:0};for(r=0;r<T.length;++r){var L=Hs(T[r],n);S<L.depth&&(S=L.depth),C<L.height&&(C=L.height),_.cells[r]=L}var M=t.rowGaps[s],I=0;M&&(I=$r(M,n),I>0&&(I+=b,S<I&&(S=I),I=0)),t.addJot&&s<t.body.length-1&&(S+=y),_.height=C,_.depth=S,x+=C,_.pos=x,x+=S+I,l[s]=_,k(o[s+1])}var A=x/2+n.fontMetrics().axisHeight,P=t.cols||[],B=[],F,O,X=[];if(t.tags&&t.tags.some(Ye=>Ye))for(s=0;s<i;++s){var z=l[s],U=z.pos-A,D=t.tags[s],G=void 0;D===!0?G=it(["eqn-num"],[],n):D===!1?G=it([],[],n):G=it([],Ai(D,n,!0),n),G.depth=z.depth,G.height=z.height,X.push({type:"elem",elem:G,shift:U})}for(r=0,O=0;r<a||O<P.length;++r,++O){for(var q,N=P[O],ee=!0;((re=N)==null?void 0:re.type)==="separator";){var re;if(ee||(F=it(["arraycolsep"],[]),F.style.width=bt(n.fontMetrics().doubleRuleSep),B.push(F)),N.separator==="|"||N.separator===":"){var Q=N.separator==="|"?"solid":"dashed",K=it(["vertical-separator"],[],n);K.style.height=bt(x),K.style.borderRightWidth=bt(d),K.style.borderRightStyle=Q,K.style.margin="0 "+bt(-d/2);var se=x-A;se&&(K.style.verticalAlign=bt(-se)),B.push(K)}else throw new dt("Invalid separator type: "+N.separator);O++,N=P[O],ee=!1}if(!(r>=a)){var te=void 0;if(r>0||t.hskipBeforeAndAfter){var ce,oe;te=(ce=(oe=N)==null?void 0:oe.pregap)!=null?ce:f,te!==0&&(F=it(["arraycolsep"],[]),F.style.width=bt(te),B.push(F))}var de=[];for(s=0;s<i;++s){var Te=l[s],qe=Te.cells[r];if(qe){var Ne=Te.pos-A;qe.depth=Te.depth,qe.height=Te.height,de.push({type:"elem",elem:qe,shift:Ne})}}var ge=Fs({positionType:"individualShift",children:de}),Ee=it(["col-align-"+(((q=N)==null?void 0:q.align)||"c")],[ge]);if(B.push(Ee),r<a-1||t.hskipBeforeAndAfter){var _t,Ct;te=(_t=(Ct=N)==null?void 0:Ct.postgap)!=null?_t:f,te!==0&&(F=it(["arraycolsep"],[]),F.style.width=bt(te),B.push(F))}}}var Je=it(["mtable"],B);if(c.length>0){for(var at=w0("hline",n,d),Oe=w0("hdashline",n,d),Fe=[{type:"elem",elem:Je,shift:0}];c.length>0;){var ue=c.pop(),vt=ue.pos-A;ue.isDashed?Fe.push({type:"elem",elem:Oe,shift:vt}):Fe.push({type:"elem",elem:at,shift:vt})}Je=Fs({positionType:"individualShift",children:Fe})}if(X.length===0)return it(["mord"],[Je],n);var ye=Fs({positionType:"individualShift",children:X}),je=it(["tag"],[ye],n);return ed([Je,je])},Abe={c:"center ",l:"left ",r:"right "},Uc=function(t,n){for(var s=[],r=new ft("mtd",[],["mtr-glue"]),i=new ft("mtd",[],["mml-eqn-num"]),o=0;o<t.body.length;o++){for(var a=t.body[o],l=[],c=0;c<a.length;c++)l.push(new ft("mtd",[hr(a[c],n)]));t.tags&&t.tags[o]&&(l.unshift(r),l.push(r),t.leqno?l.unshift(i):l.push(i)),s.push(new ft("mtr",l))}var d=new ft("mtable",s),h=t.arraystretch===.5?.1:.16+t.arraystretch-1+(t.addJot?.09:0);d.setAttribute("rowspacing",bt(h));var f="",p="";if(t.cols&&t.cols.length>0){var g=t.cols,y="",w=!1,v=0,b=g.length;g[0].type==="separator"&&(f+="top ",v=1),g[g.length-1].type==="separator"&&(f+="bottom ",b-=1);for(var x=v;x<b;x++){var k=g[x];k.type==="align"?(p+=Abe[k.align],w&&(y+="none "),w=!0):k.type==="separator"&&w&&(y+=k.separator==="|"?"solid ":"dashed ",w=!1)}d.setAttribute("columnalign",p.trim()),/[sd]/.test(y)&&d.setAttribute("columnlines",y.trim())}if(t.colSeparationType==="align"){for(var T=t.cols||[],C="",S=1;S<T.length;S++)C+=S%2?"0em ":"1em ";d.setAttribute("columnspacing",C.trim())}else t.colSeparationType==="alignat"||t.colSeparationType==="gather"?d.setAttribute("columnspacing","0em"):t.colSeparationType==="small"?d.setAttribute("columnspacing","0.2778em"):t.colSeparationType==="CD"?d.setAttribute("columnspacing","0.5em"):d.setAttribute("columnspacing","1em");var _="",L=t.hLinesBeforeRow;f+=L[0].length>0?"left ":"",f+=L[L.length-1].length>0?"right ":"";for(var M=1;M<L.length-1;M++)_+=L[M].length===0?"none ":L[M][0]?"dashed ":"solid ";return/[sd]/.test(_)&&d.setAttribute("rowlines",_.trim()),f!==""&&(d=new ft("menclose",[d]),d.setAttribute("notation",f.trim())),t.arraystretch&&t.arraystretch<1&&(d=new ft("mstyle",[d]),d.setAttribute("scriptlevel","1")),d},TW=function(t,n){t.envName.includes("ed")||P_(t);var s=[],r=t.envName.includes("at")?"alignat":"align",i=t.envName==="split",o=Ph(t.parser,{cols:s,addJot:!0,autoTag:i?void 0:SA(t.envName),emptySingleRow:!0,colSeparationType:r,maxNumCols:i?2:void 0,leqno:t.parser.settings.leqno},"display"),a=0,l=0,c={type:"ordgroup",mode:t.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var d="",h=0;h<n[0].body.length;h++){var f=Qn(n[0].body[h],"textord");d+=f.text}a=Number(d),l=a*2}var p=!l;o.body.forEach(function(v){for(var b=1;b<v.length;b+=2){var x=Qn(v[b],"styling"),k=Qn(x.body[0],"ordgroup");k.body.unshift(c)}if(p)l<v.length&&(l=v.length);else{var T=v.length/2;if(a<T)throw new dt("Too many math in a row: "+("expected "+a+", but got "+T),v[0])}});for(var g=0;g<l;++g){var y="r",w=0;g%2===1?y="l":g>0&&p&&(w=1),s[g]={type:"align",align:y,pregap:w,postgap:0}}return o.colSeparationType=p?"align":"alignat",o};qc({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var n=R_(t[0]),s=n?[t[0]]:Qn(t[0],"ordgroup").body,r=s.map(function(o){var a=I_(o),l=a.text;if("lcr".includes(l))return{type:"align",align:l};if(l==="|")return{type:"separator",separator:"|"};if(l===":")return{type:"separator",separator:":"};throw new dt("Unknown column alignment: "+l,o)}),i={cols:r,hskipBeforeAndAfter:!0,maxNumCols:r.length};return Ph(e.parser,i,CA(e.envName))},htmlBuilder:Hc,mathmlBuilder:Uc});qc({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){var t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],n="c",s={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if(e.envName.charAt(e.envName.length-1)==="*"){var r=e.parser;if(r.consumeSpaces(),r.fetch().text==="["){if(r.consume(),r.consumeSpaces(),n=r.fetch().text,!"lcr".includes(n))throw new dt("Expected l or c or r",r.nextToken);r.consume(),r.consumeSpaces(),r.expect("]"),r.consume(),s.cols=[{type:"align",align:n}]}}var i=Ph(e.parser,s,CA(e.envName)),o=Math.max(0,...i.body.map(a=>a.length));return i.cols=new Array(o).fill({type:"align",align:n}),t?{type:"leftright",mode:e.mode,body:[i],left:t[0],right:t[1],rightColor:void 0}:i},htmlBuilder:Hc,mathmlBuilder:Uc});qc({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t={arraystretch:.5},n=Ph(e.parser,t,"script");return n.colSeparationType="small",n},htmlBuilder:Hc,mathmlBuilder:Uc});qc({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var n=R_(t[0]),s=n?[t[0]]:Qn(t[0],"ordgroup").body,r=s.map(function(a){var l=I_(a),c=l.text;if("lc".includes(c))return{type:"align",align:c};throw new dt("Unknown column alignment: "+c,a)});if(r.length>1)throw new dt("{subarray} can contain only one column");var i={cols:r,hskipBeforeAndAfter:!1,arraystretch:.5},o=Ph(e.parser,i,"script");if(o.body.length>0&&o.body[0].length>1)throw new dt("{subarray} can contain only one column");return o},htmlBuilder:Hc,mathmlBuilder:Uc});qc({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){var t={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},n=Ph(e.parser,t,CA(e.envName));return{type:"leftright",mode:e.mode,body:[n],left:e.envName.includes("r")?".":"\\{",right:e.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:Hc,mathmlBuilder:Uc});qc({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:TW,htmlBuilder:Hc,mathmlBuilder:Uc});qc({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){Ebe.has(e.envName)&&P_(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:SA(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return Ph(e.parser,t,"display")},htmlBuilder:Hc,mathmlBuilder:Uc});qc({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:TW,htmlBuilder:Hc,mathmlBuilder:Uc});qc({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){P_(e);var t={autoTag:SA(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return Ph(e.parser,t,"display")},htmlBuilder:Hc,mathmlBuilder:Uc});qc({type:"array",names:["CD"],props:{numArgs:0},handler(e){return P_(e),pbe(e.parser)},htmlBuilder:Hc,mathmlBuilder:Uc});V("\\nonumber","\\gdef\\@eqnsw{0}");V("\\notag","\\nonumber");$t({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new dt(e.funcName+" valid only within array environment")}});var WL=SW;$t({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(e,t){var{parser:n,funcName:s}=e,r=t[0];if(r.type!=="ordgroup")throw new dt("Invalid environment name",r);for(var i="",o=0;o<r.body.length;++o)i+=Qn(r.body[o],"textord").text;if(s==="\\begin"){if(!WL.hasOwnProperty(i))throw new dt("No such environment: "+i,r);var a=WL[i],{args:l,optArgs:c}=n.parseArguments("\\begin{"+i+"}",a),d={mode:n.mode,envName:i,parser:n},h=a.handler(d,l,c);n.expect("\\end",!1);var f=n.nextToken,p=Qn(n.parseFunction(),"environment");if(p.name!==i)throw new dt("Mismatch: \\begin{"+i+"} matched by \\end{"+p.name+"}",f);return h}return{type:"environment",mode:n.mode,name:i,nameGroup:r}}});var EW=(e,t)=>{var n=e.font,s=t.withFont(n);return Hs(e.body,s)},AW=(e,t)=>{var n=e.font,s=t.withFont(n);return hr(e.body,s)},GL={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};$t({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(e,t)=>{var{parser:n,funcName:s}=e,r=Bk(t[0]),i=s;return i in GL&&(i=GL[i]),{type:"font",mode:n.mode,font:i.slice(1),body:r}},htmlBuilder:EW,mathmlBuilder:AW});$t({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(e,t)=>{var{parser:n}=e,s=t[0];return{type:"mclass",mode:n.mode,mclass:j_(s),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:s}],isCharacterBox:Ju(s)}}});$t({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:s,breakOnTokenText:r}=e,{mode:i}=n,o=n.parseExpression(!0,r);return{type:"font",mode:i,font:"math"+s.slice(1),body:{type:"ordgroup",mode:n.mode,body:o}}},htmlBuilder:EW,mathmlBuilder:AW});var Mbe=(e,t)=>{var n=t.style,s=n.fracNum(),r=n.fracDen(),i;i=t.havingStyle(s);var o=Hs(e.numer,i,t);if(e.continued){var a=8.5/t.fontMetrics().ptPerEm,l=3.5/t.fontMetrics().ptPerEm;o.height=o.height<a?a:o.height,o.depth=o.depth<l?l:o.depth}i=t.havingStyle(r);var c=Hs(e.denom,i,t),d,h,f;e.hasBarLine?(e.barSize?(h=$r(e.barSize,t),d=w0("frac-line",t,h)):d=w0("frac-line",t),h=d.height,f=d.height):(d=null,h=0,f=t.fontMetrics().defaultRuleThickness);var p,g,y;n.size===On.DISPLAY.size?(p=t.fontMetrics().num1,h>0?g=3*f:g=7*f,y=t.fontMetrics().denom1):(h>0?(p=t.fontMetrics().num2,g=f):(p=t.fontMetrics().num3,g=3*f),y=t.fontMetrics().denom2);var w;if(d){var b=t.fontMetrics().axisHeight;p-o.depth-(b+.5*h)<g&&(p+=g-(p-o.depth-(b+.5*h))),b-.5*h-(c.height-y)<g&&(y+=g-(b-.5*h-(c.height-y)));var x=-(b-.5*h);w=Fs({positionType:"individualShift",children:[{type:"elem",elem:c,shift:y},{type:"elem",elem:d,shift:x},{type:"elem",elem:o,shift:-p}]})}else{var v=p-o.depth-(c.height-y);v<g&&(p+=.5*(g-v),y+=.5*(g-v)),w=Fs({positionType:"individualShift",children:[{type:"elem",elem:c,shift:y},{type:"elem",elem:o,shift:-p}]})}i=t.havingStyle(n),w.height*=i.sizeMultiplier/t.sizeMultiplier,w.depth*=i.sizeMultiplier/t.sizeMultiplier;var k;n.size===On.DISPLAY.size?k=t.fontMetrics().delim1:n.size===On.SCRIPTSCRIPT.size?k=t.havingStyle(On.SCRIPT).fontMetrics().delim2:k=t.fontMetrics().delim2;var T,C;return e.leftDelim==null?T=_y(t,["mopen"]):T=TT(e.leftDelim,k,!0,t.havingStyle(n),e.mode,["mopen"]),e.continued?C=it([]):e.rightDelim==null?C=_y(t,["mclose"]):C=TT(e.rightDelim,k,!0,t.havingStyle(n),e.mode,["mclose"]),it(["mord"].concat(i.sizingClasses(t)),[T,it(["mfrac"],[w]),C],t)},Nbe=(e,t)=>{var n=new ft("mfrac",[hr(e.numer,t),hr(e.denom,t)]);if(!e.hasBarLine)n.setAttribute("linethickness","0px");else if(e.barSize){var s=$r(e.barSize,t);n.setAttribute("linethickness",bt(s))}if(e.leftDelim!=null||e.rightDelim!=null){var r=[];if(e.leftDelim!=null){var i=new ft("mo",[new mi(e.leftDelim.replace("\\",""))]);i.setAttribute("fence","true"),r.push(i)}if(r.push(n),e.rightDelim!=null){var o=new ft("mo",[new mi(e.rightDelim.replace("\\",""))]);o.setAttribute("fence","true"),r.push(o)}return wA(r)}return n},MW=(e,t)=>{if(!t)return e;var n={type:"styling",mode:e.mode,style:t,body:[e]};return n};$t({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(e,t)=>{var{parser:n,funcName:s}=e,r=t[0],i=t[1],o,a=null,l=null;switch(s){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":o=!0;break;case"\\\\atopfrac":o=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":o=!1,a="(",l=")";break;case"\\\\bracefrac":o=!1,a="\\{",l="\\}";break;case"\\\\brackfrac":o=!1,a="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}var c=s==="\\cfrac",d=null;return c||s.startsWith("\\d")?d="display":s.startsWith("\\t")&&(d="text"),MW({type:"genfrac",mode:n.mode,numer:r,denom:i,continued:c,hasBarLine:o,leftDelim:a,rightDelim:l,barSize:null},d)},htmlBuilder:Mbe,mathmlBuilder:Nbe});$t({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(e){var{parser:t,funcName:n,token:s}=e,r;switch(n){case"\\over":r="\\frac";break;case"\\choose":r="\\binom";break;case"\\atop":r="\\\\atopfrac";break;case"\\brace":r="\\\\bracefrac";break;case"\\brack":r="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:t.mode,replaceWith:r,token:s}}});var KL=["display","text","script","scriptscript"],YL=function(t){var n=null;return t.length>0&&(n=t,n=n==="."?null:n),n};$t({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(e,t){var{parser:n}=e,s=t[4],r=t[5],i=Bk(t[0]),o=i.type==="atom"&&i.family==="open"?YL(i.text):null,a=Bk(t[1]),l=a.type==="atom"&&a.family==="close"?YL(a.text):null,c=Qn(t[2],"size"),d,h=null;c.isBlank?d=!0:(h=c.value,d=h.number>0);var f=null,p=t[3];if(p.type==="ordgroup"){if(p.body.length>0){var g=Qn(p.body[0],"textord");f=KL[Number(g.text)]}}else p=Qn(p,"textord"),f=KL[Number(p.text)];return MW({type:"genfrac",mode:n.mode,numer:s,denom:r,continued:!1,hasBarLine:d,barSize:h,leftDelim:o,rightDelim:l},f)}});$t({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(e,t){var{parser:n,funcName:s,token:r}=e;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:Qn(t[0],"size").value,token:r}}});$t({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{var{parser:n,funcName:s}=e,r=t[0],i=Qn(t[1],"infix").size;if(!i)throw new Error("\\\\abovefrac expected size, but got "+String(i));var o=t[2],a=i.number>0;return{type:"genfrac",mode:n.mode,numer:r,denom:o,continued:!1,hasBarLine:a,barSize:i,leftDelim:null,rightDelim:null}}});var NW=(e,t)=>{var n=t.style,s,r;e.type==="supsub"?(s=e.sup?Hs(e.sup,t.havingStyle(n.sup()),t):Hs(e.sub,t.havingStyle(n.sub()),t),r=Qn(e.base,"horizBrace")):r=Qn(e,"horizBrace");var i=Hs(r.base,t.havingBaseStyle(On.DISPLAY)),o=N_(r,t),a;if(r.isOver?a=Fs({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:o,wrapperClasses:["svg-align"]}]}):a=Fs({positionType:"bottom",positionData:i.depth+.1+o.height,children:[{type:"elem",elem:o,wrapperClasses:["svg-align"]},{type:"kern",size:.1},{type:"elem",elem:i}]}),s){var l=it(["minner",r.isOver?"mover":"munder"],[a],t);r.isOver?a=Fs({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:s}]}):a=Fs({positionType:"bottom",positionData:l.depth+.2+s.height+s.depth,children:[{type:"elem",elem:s},{type:"kern",size:.2},{type:"elem",elem:l}]})}return it(["minner",r.isOver?"mover":"munder"],[a],t)},Ibe=(e,t)=>{var n=M_(e.label);return new ft(e.isOver?"mover":"munder",[hr(e.base,t),n])};$t({type:"horizBrace",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:s}=e;return{type:"horizBrace",mode:n.mode,label:s,isOver:s.includes("\\over"),base:t[0]}},htmlBuilder:NW,mathmlBuilder:Ibe});$t({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,s=t[1],r=Qn(t[0],"url").url;return n.settings.isTrusted({command:"\\href",url:r})?{type:"href",mode:n.mode,href:r,body:fi(s)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var n=Ai(e.body,t,!1);return Uye(e.href,[],n,t)},mathmlBuilder:(e,t)=>{var n=vh(e.body,t);return n instanceof ft||(n=new ft("mrow",[n])),n.setAttribute("href",e.href),n}});$t({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,s=Qn(t[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:s}))return n.formatUnsupportedCmd("\\url");for(var r=[],i=0;i<s.length;i++){var o=s[i];o==="~"&&(o="\\textasciitilde"),r.push({type:"textord",mode:"text",text:o})}var a={type:"text",mode:n.mode,font:"\\texttt",body:r};return{type:"href",mode:n.mode,href:s,body:fi(a)}}});$t({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0},handler(e,t){var{parser:n}=e;return{type:"hbox",mode:n.mode,body:fi(t[0])}},htmlBuilder(e,t){var n=Ai(e.body,t.withFont(""),!1);return ed(n)},mathmlBuilder(e,t){return new ft("mrow",za(e.body,t.withFont("")))}});$t({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:s,token:r}=e,i=Qn(t[0],"raw").string,o=t[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var a,l={};switch(s){case"\\htmlClass":l.class=i,a={command:"\\htmlClass",class:i};break;case"\\htmlId":l.id=i,a={command:"\\htmlId",id:i};break;case"\\htmlStyle":l.style=i,a={command:"\\htmlStyle",style:i};break;case"\\htmlData":{for(var c=i.split(","),d=0;d<c.length;d++){var h=c[d],f=h.indexOf("=");if(f<0)throw new dt("\\htmlData key/value '"+h+"' missing equals sign");var p=h.slice(0,f),g=h.slice(f+1);l["data-"+p.trim()]=g}a={command:"\\htmlData",attributes:l};break}default:throw new Error("Unrecognized html command")}return n.settings.isTrusted(a)?{type:"html",mode:n.mode,attributes:l,body:fi(o)}:n.formatUnsupportedCmd(s)},htmlBuilder:(e,t)=>{var n=Ai(e.body,t,!1),s=["enclosing"];e.attributes.class&&s.push(...e.attributes.class.trim().split(/\s+/));var r=it(s,n,t);for(var i in e.attributes)i!=="class"&&e.attributes.hasOwnProperty(i)&&r.setAttribute(i,e.attributes[i]);return r},mathmlBuilder:(e,t)=>vh(e.body,t)});$t({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInArgument:!0,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"htmlmathml",mode:n.mode,html:fi(t[0]),mathml:fi(t[1])}},htmlBuilder:(e,t)=>{var n=Ai(e.html,t,!1);return ed(n)},mathmlBuilder:(e,t)=>vh(e.mathml,t)});var Y3=function(t){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(t))return{number:+t,unit:"bp"};var n=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t);if(!n)throw new dt("Invalid size: '"+t+"' in \\includegraphics");var s={number:+(n[1]+n[2]),unit:n[3]};if(!WV(s))throw new dt("Invalid unit: '"+s.unit+"' in \\includegraphics.");return s};$t({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(e,t,n)=>{var{parser:s}=e,r={number:0,unit:"em"},i={number:.9,unit:"em"},o={number:0,unit:"em"},a="";if(n[0])for(var l=Qn(n[0],"raw").string,c=l.split(","),d=0;d<c.length;d++){var h=c[d].split("=");if(h.length===2){var f=h[1].trim();switch(h[0].trim()){case"alt":a=f;break;case"width":r=Y3(f);break;case"height":i=Y3(f);break;case"totalheight":o=Y3(f);break;default:throw new dt("Invalid key: '"+h[0]+"' in \\includegraphics.")}}}var p=Qn(t[0],"url").url;return a===""&&(a=p,a=a.replace(/^.*[\\/]/,""),a=a.substring(0,a.lastIndexOf("."))),s.settings.isTrusted({command:"\\includegraphics",url:p})?{type:"includegraphics",mode:s.mode,alt:a,width:r,height:i,totalheight:o,src:p}:s.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(e,t)=>{var n=$r(e.height,t),s=0;e.totalheight.number>0&&(s=$r(e.totalheight,t)-n);var r=0;e.width.number>0&&(r=$r(e.width,t));var i={height:bt(n+s)};r>0&&(i.width=bt(r)),s>0&&(i.verticalAlign=bt(-s));var o=new jye(e.src,e.alt,i);return o.height=n,o.depth=s,o},mathmlBuilder:(e,t)=>{var n=new ft("mglyph",[]);n.setAttribute("alt",e.alt);var s=$r(e.height,t),r=0;if(e.totalheight.number>0&&(r=$r(e.totalheight,t)-s,n.setAttribute("valign",bt(-r))),n.setAttribute("height",bt(s+r)),e.width.number>0){var i=$r(e.width,t);n.setAttribute("width",bt(i))}return n.setAttribute("src",e.src),n}});$t({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(e,t){var{parser:n,funcName:s}=e,r=Qn(t[0],"size");if(n.settings.strict){var i=s[1]==="m",o=r.value.unit==="mu";i?(o||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+s+" supports only mu units, "+("not "+r.value.unit+" units")),n.mode!=="math"&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+s+" works only in math mode")):o&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+s+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:r.value}},htmlBuilder(e,t){return ZV(e.dimension,t)},mathmlBuilder(e,t){var n=$r(e.dimension,t);return new iW(n)}});$t({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:s}=e,r=t[0];return{type:"lap",mode:n.mode,alignment:s.slice(5),body:r}},htmlBuilder:(e,t)=>{var n;e.alignment==="clap"?(n=it([],[Hs(e.body,t)]),n=it(["inner"],[n],t)):n=it(["inner"],[Hs(e.body,t)]);var s=it(["fix"],[]),r=it([e.alignment],[n,s],t),i=it(["strut"]);return i.style.height=bt(r.height+r.depth),r.depth&&(i.style.verticalAlign=bt(-r.depth)),r.children.unshift(i),r=it(["thinbox"],[r],t),it(["mord","vbox"],[r],t)},mathmlBuilder:(e,t)=>{var n=new ft("mpadded",[hr(e.body,t)]);if(e.alignment!=="rlap"){var s=e.alignment==="llap"?"-1":"-0.5";n.setAttribute("lspace",s+"width")}return n.setAttribute("width","0px"),n}});$t({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){var{funcName:n,parser:s}=e,r=s.mode;s.switchMode("math");var i=n==="\\("?"\\)":"$",o=s.parseExpression(!1,i);return s.expect(i),s.switchMode(r),{type:"styling",mode:s.mode,style:"text",resetFont:!0,body:o}}});$t({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new dt("Mismatched "+e.funcName)}});var XL=(e,t)=>{switch(t.style.size){case On.DISPLAY.size:return e.display;case On.TEXT.size:return e.text;case On.SCRIPT.size:return e.script;case On.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};$t({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"mathchoice",mode:n.mode,display:fi(t[0]),text:fi(t[1]),script:fi(t[2]),scriptscript:fi(t[3])}},htmlBuilder:(e,t)=>{var n=XL(e,t),s=Ai(n,t,!1);return ed(s)},mathmlBuilder:(e,t)=>{var n=XL(e,t);return vh(n,t)}});var IW=(e,t,n,s,r,i,o)=>{e=it([],[e]);var a=n&&Ju(n),l,c;if(t){var d=Hs(t,s.havingStyle(r.sup()),s);c={elem:d,kern:Math.max(s.fontMetrics().bigOpSpacing1,s.fontMetrics().bigOpSpacing3-d.depth)}}if(n){var h=Hs(n,s.havingStyle(r.sub()),s);l={elem:h,kern:Math.max(s.fontMetrics().bigOpSpacing2,s.fontMetrics().bigOpSpacing4-h.height)}}var f;if(c&&l){var p=s.fontMetrics().bigOpSpacing5+l.elem.height+l.elem.depth+l.kern+e.depth+o;f=Fs({positionType:"bottom",positionData:p,children:[{type:"kern",size:s.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:bt(-i)},{type:"kern",size:l.kern},{type:"elem",elem:e},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:bt(i)},{type:"kern",size:s.fontMetrics().bigOpSpacing5}]})}else if(l){var g=e.height-o;f=Fs({positionType:"top",positionData:g,children:[{type:"kern",size:s.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:bt(-i)},{type:"kern",size:l.kern},{type:"elem",elem:e}]})}else if(c){var y=e.depth+o;f=Fs({positionType:"bottom",positionData:y,children:[{type:"elem",elem:e},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:bt(i)},{type:"kern",size:s.fontMetrics().bigOpSpacing5}]})}else return e;var w=[f];if(l&&i!==0&&!a){var v=it(["mspace"],[],s);v.style.marginRight=bt(i),w.unshift(v)}return it(["mop","op-limits"],w,s)},RW=new Set(["\\smallint"]),J0=(e,t)=>{var n,s,r=!1,i;e.type==="supsub"?(n=e.sup,s=e.sub,i=Qn(e.base,"op"),r=!0):i=Qn(e,"op");var o=t.style,a=!1;o.size===On.DISPLAY.size&&i.symbol&&!RW.has(i.name)&&(a=!0);var l,c;if(i.symbol){var d=a?"Size2-Regular":"Size1-Regular",h="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(h=i.name.slice(1),i.name=h==="oiint"?"\\iint":"\\iiint"),l=Ao(i.name,d,"math",t,["mop","op-symbol",a?"large-op":"small-op"]),c=l.italic,h.length>0){var f=tW(h+"Size"+(a?"2":"1"),t);l=Fs({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:f,shift:a?.08:0}]}),i.name="\\"+h,l.classes.unshift("mop"),l.italic=c}}else if(i.body){var p=Ai(i.body,t,!0);p.length===1&&p[0]instanceof Oa?(l=p[0],l.classes[0]="mop"):l=it(["mop"],p,t)}else{for(var g=[],y=1;y<i.name.length;y++)g.push(bA(i.name[y],i.mode,t));l=it(["mop"],g,t)}var w=0,v=0;if((l instanceof Oa||i.name==="\\oiint"||i.name==="\\oiiint")&&!i.suppressBaseShift){var b;w=(l.height-l.depth)/2-t.fontMetrics().axisHeight,v=(b=l.italic)!=null?b:0}return r?IW(l,n,s,t,o,v,w):(w&&(l.style.position="relative",l.style.top=bt(w)),l)},Sb=(e,t)=>{var n;if(e.symbol)n=new ft("mo",[xl(e.name,e.mode)]),RW.has(e.name)&&n.setAttribute("largeop","false");else if(e.body)n=new ft("mo",za(e.body,t));else{n=new ft("mi",[new mi(e.name.slice(1))]);var s=new ft("mo",[xl("⁡","text")]);e.parentIsSupSub?n=new ft("mrow",[n,s]):n=rW([n,s])}return n},Rbe={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};$t({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(e,t)=>{var{parser:n,funcName:s}=e,r=s;return r.length===1&&(r=Rbe[r]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:J0,mathmlBuilder:Sb});$t({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var{parser:n}=e,s=t[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:fi(s)}},htmlBuilder:J0,mathmlBuilder:Sb});var jbe={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};$t({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e;return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:J0,mathmlBuilder:Sb});$t({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e;return{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:J0,mathmlBuilder:Sb});$t({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0,allowedInArgument:!0},handler(e){var{parser:t,funcName:n}=e,s=n;return s.length===1&&(s=jbe[s]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:J0,mathmlBuilder:Sb});var jW=(e,t)=>{var n,s,r=!1,i;e.type==="supsub"?(n=e.sup,s=e.sub,i=Qn(e.base,"operatorname"),r=!0):i=Qn(e,"operatorname");var o;if(i.body.length>0){for(var a=i.body.map(h=>{var f="text"in h?h.text:void 0;return typeof f=="string"?{type:"textord",mode:h.mode,text:f}:h}),l=Ai(a,t.withFont("mathrm"),!0),c=0;c<l.length;c++){var d=l[c];d instanceof Oa&&(d.text=d.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=it(["mop"],l,t)}else o=it(["mop"],[],t);return r?IW(o,n,s,t,t.style,0,0):o},Lbe=(e,t)=>{for(var n=za(e.body,t.withFont("mathrm")),s=!0,r=0;r<n.length;r++){var i=n[r];if(!(i instanceof iW))if(i instanceof ft)switch(i.type){case"mi":case"mn":case"mspace":case"mtext":break;case"mo":{var o=i.children[0];i.children.length===1&&o instanceof mi?o.text=o.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):s=!1;break}default:s=!1}else s=!1}if(s){var a=n.map(d=>d.toText()).join("");n=[new mi(a)]}var l=new ft("mi",n);l.setAttribute("mathvariant","normal");var c=new ft("mo",[xl("⁡","text")]);return e.parentIsSupSub?new ft("mrow",[l,c]):rW([l,c])};$t({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(e,t)=>{var{parser:n,funcName:s}=e,r=t[0];return{type:"operatorname",mode:n.mode,body:fi(r),alwaysHandleSupSub:s==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:jW,mathmlBuilder:Lbe});V("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");xm({type:"ordgroup",htmlBuilder(e,t){return e.semisimple?ed(Ai(e.body,t,!1)):it(["mord"],Ai(e.body,t,!0),t)},mathmlBuilder(e,t){return vh(e.body,t,!0)}});$t({type:"overline",names:["\\overline"],props:{numArgs:1},handler(e,t){var{parser:n}=e,s=t[0];return{type:"overline",mode:n.mode,body:s}},htmlBuilder(e,t){var n=Hs(e.body,t.havingCrampedStyle()),s=w0("overline-line",t),r=t.fontMetrics().defaultRuleThickness,i=Fs({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*r},{type:"elem",elem:s},{type:"kern",size:r}]});return it(["mord","overline"],[i],t)},mathmlBuilder(e,t){var n=new ft("mo",[new mi("‾")]);n.setAttribute("stretchy","true");var s=new ft("mover",[hr(e.body,t),n]);return s.setAttribute("accent","true"),s}});$t({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,s=t[0];return{type:"phantom",mode:n.mode,body:fi(s)}},htmlBuilder:(e,t)=>{var n=Ai(e.body,t.withPhantom(),!1);return ed(n)},mathmlBuilder:(e,t)=>{var n=za(e.body,t);return new ft("mphantom",n)}});V("\\hphantom","\\smash{\\phantom{#1}}");$t({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,s=t[0];return{type:"vphantom",mode:n.mode,body:s}},htmlBuilder:(e,t)=>{var n=it(["inner"],[Hs(e.body,t.withPhantom())]),s=it(["fix"],[]);return it(["mord","rlap"],[n,s],t)},mathmlBuilder:(e,t)=>{var n=za(fi(e.body),t),s=new ft("mphantom",n),r=new ft("mpadded",[s]);return r.setAttribute("width","0px"),r}});$t({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e,s=Qn(t[0],"size").value,r=t[1];return{type:"raisebox",mode:n.mode,dy:s,body:r}},htmlBuilder(e,t){var n=Hs(e.body,t),s=$r(e.dy,t);return Fs({positionType:"shift",positionData:-s,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new ft("mpadded",[hr(e.body,t)]),s=e.dy.number+e.dy.unit;return n.setAttribute("voffset",s),n}});$t({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}});$t({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(e,t,n){var{parser:s}=e,r=n[0],i=Qn(t[0],"size"),o=Qn(t[1],"size");return{type:"rule",mode:s.mode,shift:r&&Qn(r,"size").value,width:i.value,height:o.value}},htmlBuilder(e,t){var n=it(["mord","rule"],[],t),s=$r(e.width,t),r=$r(e.height,t),i=e.shift?$r(e.shift,t):0;return n.style.borderRightWidth=bt(s),n.style.borderTopWidth=bt(r),n.style.bottom=bt(i),n.width=s,n.height=r+i,n.depth=-i,n.maxFontSize=r*1.125*t.sizeMultiplier,n},mathmlBuilder(e,t){var n=$r(e.width,t),s=$r(e.height,t),r=e.shift?$r(e.shift,t):0,i=t.color&&t.getColor()||"black",o=new ft("mspace");o.setAttribute("mathbackground",i),o.setAttribute("width",bt(n)),o.setAttribute("height",bt(s));var a=new ft("mpadded",[o]);return r>=0?a.setAttribute("height",bt(r)):(a.setAttribute("height",bt(r)),a.setAttribute("depth",bt(-r))),a.setAttribute("voffset",bt(r)),a}});function LW(e,t,n){for(var s=Ai(e,t,!1),r=t.sizeMultiplier/n.sizeMultiplier,i=0;i<s.length;i++){var o=s[i].classes.indexOf("sizing");o<0?Array.prototype.push.apply(s[i].classes,t.sizingClasses(n)):s[i].classes[o+1]==="reset-size"+t.size&&(s[i].classes[o+1]="reset-size"+n.size),s[i].height*=r,s[i].depth*=r}return ed(s)}var QL=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],Dbe=(e,t)=>{var n=t.havingSize(e.size);return LW(e.body,n,t)};$t({type:"sizing",names:QL,props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{breakOnTokenText:n,funcName:s,parser:r}=e,i=r.parseExpression(!1,n);return{type:"sizing",mode:r.mode,size:QL.indexOf(s)+1,body:i}},htmlBuilder:Dbe,mathmlBuilder:(e,t)=>{var n=t.havingSize(e.size),s=za(e.body,n),r=new ft("mstyle",s);return r.setAttribute("mathsize",bt(n.sizeMultiplier)),r}});$t({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(e,t,n)=>{var{parser:s}=e,r=!1,i=!1,o=n[0]&&Qn(n[0],"ordgroup");if(o)for(var a,l=0;l<o.body.length;++l){var c=o.body[l];if(a=I_(c).text,a==="t")r=!0;else if(a==="b")i=!0;else{r=!1,i=!1;break}}else r=!0,i=!0;var d=t[0];return{type:"smash",mode:s.mode,body:d,smashHeight:r,smashDepth:i}},htmlBuilder:(e,t)=>{var n=it([],[Hs(e.body,t)]);if(!e.smashHeight&&!e.smashDepth)return n;if(e.smashHeight&&(n.height=0),e.smashDepth&&(n.depth=0),e.smashHeight&&e.smashDepth)return it(["mord","smash"],[n],t);if(n.children)for(var s=0;s<n.children.length;s++)e.smashHeight&&(n.children[s].height=0),e.smashDepth&&(n.children[s].depth=0);var r=Fs({positionType:"firstBaseline",children:[{type:"elem",elem:n}]});return it(["mord"],[r],t)},mathmlBuilder:(e,t)=>{var n=new ft("mpadded",[hr(e.body,t)]);return e.smashHeight&&n.setAttribute("height","0px"),e.smashDepth&&n.setAttribute("depth","0px"),n}});$t({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){var{parser:s}=e,r=n[0],i=t[0];return{type:"sqrt",mode:s.mode,body:i,index:r}},htmlBuilder(e,t){var n=Hs(e.body,t.havingCrampedStyle());n.height===0&&(n.height=t.fontMetrics().xHeight),n=x0(n,t);var s=t.fontMetrics(),r=s.defaultRuleThickness,i=r;t.style.id<On.TEXT.id&&(i=t.fontMetrics().xHeight);var o=r+i/4,a=n.height+n.depth+o+r,{span:l,ruleWidth:c,advanceWidth:d}=xbe(a,t),h=l.height-c;h>n.height+n.depth+o&&(o=(o+h-n.height-n.depth)/2);var f=l.height-n.height-o-c;n.style.paddingLeft=bt(d);var p=Fs({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+f)},{type:"elem",elem:l},{type:"kern",size:c}]});if(e.index){var g=t.havingStyle(On.SCRIPTSCRIPT),y=Hs(e.index,g,t),w=.6*(p.height-p.depth),v=Fs({positionType:"shift",positionData:-w,children:[{type:"elem",elem:y}]}),b=it(["root"],[v]);return it(["mord","sqrt"],[b,p],t)}else return it(["mord","sqrt"],[p],t)},mathmlBuilder(e,t){var{body:n,index:s}=e;return s?new ft("mroot",[hr(n,t),hr(s,t)]):new ft("msqrt",[hr(n,t)])}});var ET={display:On.DISPLAY,text:On.TEXT,script:On.SCRIPT,scriptscript:On.SCRIPTSCRIPT};function Obe(e){return e in ET}$t({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e,t){var{breakOnTokenText:n,funcName:s,parser:r}=e,i=r.parseExpression(!0,n),o=s.slice(1,s.length-5);if(!Obe(o))throw new Error("Unknown style: "+o);return{type:"styling",mode:r.mode,style:o,body:i}},htmlBuilder(e,t){var n=ET[e.style],s=t.havingStyle(n);return e.resetFont&&(s=s.withFont("")),LW(e.body,s,t)},mathmlBuilder(e,t){var n=ET[e.style],s=t.havingStyle(n);e.resetFont&&(s=s.withFont(""));var r=za(e.body,s),i=new ft("mstyle",r),o={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},a=o[e.style];return i.setAttribute("scriptlevel",a[0]),i.setAttribute("displaystyle",a[1]),i}});var Pbe=function(t,n){var s=t.base;if(s)if(s.type==="op"){var r=s.limits&&(n.style.size===On.DISPLAY.size||s.alwaysHandleSupSub);return r?J0:null}else if(s.type==="operatorname"){var i=s.alwaysHandleSupSub&&(n.style.size===On.DISPLAY.size||s.limits);return i?jW:null}else{if(s.type==="accent")return Ju(s.base)?kA:null;if(s.type==="horizBrace"){var o=!t.sub;return o===s.isOver?NW:null}else return null}else return null};xm({type:"supsub",htmlBuilder(e,t){var n=Pbe(e,t);if(n)return n(e,t);var{base:s,sup:r,sub:i}=e,o=Hs(s,t),a,l,c=t.fontMetrics(),d=0,h=0,f=s&&Ju(s);if(r){var p=t.havingStyle(t.style.sup());a=Hs(r,p,t),f||(d=o.height-p.fontMetrics().supDrop*p.sizeMultiplier/t.sizeMultiplier)}if(i){var g=t.havingStyle(t.style.sub());l=Hs(i,g,t),f||(h=o.depth+g.fontMetrics().subDrop*g.sizeMultiplier/t.sizeMultiplier)}var y;t.style===On.DISPLAY?y=c.sup1:t.style.cramped?y=c.sup3:y=c.sup2;var w=t.sizeMultiplier,v=bt(.5/c.ptPerEm/w),b=null;if(l){var x=e.base&&e.base.type==="op"&&e.base.name&&(e.base.name==="\\oiint"||e.base.name==="\\oiiint");if(o instanceof Oa||x){var k;b=bt(-((k=o.italic)!=null?k:0))}}var T;if(a&&l){d=Math.max(d,y,a.depth+.25*c.xHeight),h=Math.max(h,c.sub2);var C=c.defaultRuleThickness,S=4*C;if(d-a.depth-(l.height-h)<S){h=S-(d-a.depth)+l.height;var _=.8*c.xHeight-(d-a.depth);_>0&&(d+=_,h-=_)}var L=[{type:"elem",elem:l,shift:h,marginRight:v,marginLeft:b},{type:"elem",elem:a,shift:-d,marginRight:v}];T=Fs({positionType:"individualShift",children:L})}else if(l){h=Math.max(h,c.sub1,l.height-.8*c.xHeight);var M=[{type:"elem",elem:l,marginLeft:b,marginRight:v}];T=Fs({positionType:"shift",positionData:h,children:M})}else if(a)d=Math.max(d,y,a.depth+.25*c.xHeight),T=Fs({positionType:"shift",positionData:-d,children:[{type:"elem",elem:a,marginRight:v}]});else throw new Error("supsub must have either sup or sub.");var I=kT(o,"right")||"mord";return it([I],[o,it(["msupsub"],[T])],t)},mathmlBuilder(e,t){var n=!1,s,r;e.base&&e.base.type==="horizBrace"&&(r=!!e.sup,r===e.base.isOver&&(n=!0,s=e.base.isOver)),e.base&&(e.base.type==="op"||e.base.type==="operatorname")&&(e.base.parentIsSupSub=!0);var i=[hr(e.base,t)];e.sub&&i.push(hr(e.sub,t)),e.sup&&i.push(hr(e.sup,t));var o;if(n)o=s?"mover":"munder";else if(e.sub)if(e.sup){var c=e.base;c&&c.type==="op"&&c.limits&&t.style===On.DISPLAY||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(t.style===On.DISPLAY||c.limits)?o="munderover":o="msubsup"}else{var l=e.base;l&&l.type==="op"&&l.limits&&(t.style===On.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||t.style===On.DISPLAY)?o="munder":o="msub"}else{var a=e.base;a&&a.type==="op"&&a.limits&&(t.style===On.DISPLAY||a.alwaysHandleSupSub)||a&&a.type==="operatorname"&&a.alwaysHandleSupSub&&(a.limits||t.style===On.DISPLAY)?o="mover":o="msup"}return new ft(o,i)}});xm({type:"atom",htmlBuilder(e,t){return bA(e.text,e.mode,t,["m"+e.family])},mathmlBuilder(e,t){var n=new ft("mo",[xl(e.text,e.mode)]);if(e.family==="bin"){var s=xA(e,t);s==="bold-italic"&&n.setAttribute("mathvariant",s)}else e.family==="punct"?n.setAttribute("separator","true"):(e.family==="open"||e.family==="close")&&n.setAttribute("stretchy","false");return n}});var DW={mi:"italic",mn:"normal",mtext:"normal"};xm({type:"mathord",htmlBuilder(e,t){return A_(e,t,"mathord")},mathmlBuilder(e,t){var n=new ft("mi",[xl(e.text,e.mode,t)]),s=xA(e,t)||"italic";return s!==DW[n.type]&&n.setAttribute("mathvariant",s),n}});xm({type:"textord",htmlBuilder(e,t){return A_(e,t,"textord")},mathmlBuilder(e,t){var n=xl(e.text,e.mode,t),s=xA(e,t)||"normal",r;return e.mode==="text"?r=new ft("mtext",[n]):/[0-9]/.test(e.text)?r=new ft("mn",[n]):e.text==="\\prime"?r=new ft("mo",[n]):r=new ft("mi",[n]),s!==DW[r.type]&&r.setAttribute("mathvariant",s),r}});var X3={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Q3={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};xm({type:"spacing",htmlBuilder(e,t){if(Q3.hasOwnProperty(e.text)){var n=Q3[e.text].className||"";if(e.mode==="text"){var s=A_(e,t,"textord");return s.classes.push(n),s}else return it(["mspace",n],[bA(e.text,e.mode,t)],t)}else{if(X3.hasOwnProperty(e.text))return it(["mspace",X3[e.text]],[],t);throw new dt('Unknown type of space "'+e.text+'"')}},mathmlBuilder(e,t){var n;if(Q3.hasOwnProperty(e.text))n=new ft("mtext",[new mi(" ")]);else{if(X3.hasOwnProperty(e.text))return new ft("mspace");throw new dt('Unknown type of space "'+e.text+'"')}return n}});var JL=()=>{var e=new ft("mtd",[]);return e.setAttribute("width","50%"),e};xm({type:"tag",mathmlBuilder(e,t){var n=new ft("mtable",[new ft("mtr",[JL(),new ft("mtd",[vh(e.body,t)]),JL(),new ft("mtd",[vh(e.tag,t)])])]);return n.setAttribute("width","100%"),n}});var ZL={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},eD={"\\textbf":"textbf","\\textmd":"textmd"},Bbe={"\\textit":"textit","\\textup":"textup"},tD=(e,t)=>{var n=e.font;if(n){if(ZL[n])return t.withTextFontFamily(ZL[n]);if(eD[n])return t.withTextFontWeight(eD[n]);if(n==="\\emph")return t.fontShape==="textit"?t.withTextFontShape("textup"):t.withTextFontShape("textit")}else return t;return t.withTextFontShape(Bbe[n])};$t({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(e,t){var{parser:n,funcName:s}=e,r=t[0];return{type:"text",mode:n.mode,body:fi(r),font:s}},htmlBuilder(e,t){var n=tD(e,t),s=Ai(e.body,n,!0);return it(["mord","text"],s,n)},mathmlBuilder(e,t){var n=tD(e,t);return vh(e.body,n)}});$t({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"underline",mode:n.mode,body:t[0]}},htmlBuilder(e,t){var n=Hs(e.body,t),s=w0("underline-line",t),r=t.fontMetrics().defaultRuleThickness,i=Fs({positionType:"top",positionData:n.height,children:[{type:"kern",size:r},{type:"elem",elem:s},{type:"kern",size:3*r},{type:"elem",elem:n}]});return it(["mord","underline"],[i],t)},mathmlBuilder(e,t){var n=new ft("mo",[new mi("‾")]);n.setAttribute("stretchy","true");var s=new ft("munder",[hr(e.body,t),n]);return s.setAttribute("accentunder","true"),s}});$t({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(e,t){var{parser:n}=e;return{type:"vcenter",mode:n.mode,body:t[0]}},htmlBuilder(e,t){var n=Hs(e.body,t),s=t.fontMetrics().axisHeight,r=.5*(n.height-s-(n.depth+s));return Fs({positionType:"shift",positionData:r,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new ft("mpadded",[hr(e.body,t)],["vcenter"]);return new ft("mrow",[n])}});$t({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,n){throw new dt("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var n=nD(e),s=[],r=t.havingStyle(t.style.text()),i=0;i<n.length;i++){var o=n[i];o==="~"&&(o="\\textasciitilde"),s.push(Ao(o,"Typewriter-Regular",e.mode,r,["mord","texttt"]))}return it(["mord","text"].concat(r.sizingClasses(t)),JV(s),r)},mathmlBuilder(e,t){var n=new mi(nD(e)),s=new ft("mtext",[n]);return s.setAttribute("mathvariant","monospace"),s}});var nD=e=>e.body.replace(/ /g,e.star?"␣":" "),Wd=nW,OW=`[ \r
	]`,$be="\\\\[a-zA-Z@]+",zbe="\\\\[^\uD800-\uDFFF]",Fbe="("+$be+")"+OW+"*",qbe=`\\\\(
|[ \r	]+
?)[ \r	]*`,AT="[̀-ͯ]",Hbe=new RegExp(AT+"+$"),Ube="("+OW+"+)|"+(qbe+"|")+"([!-\\[\\]-‧‪-퟿豈-]"+(AT+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(AT+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+Fbe)+("|"+zbe+")");class sD{constructor(t,n){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=t,this.settings=n,this.tokenRegex=new RegExp(Ube,"g"),this.catcodes={"%":14,"~":13}}setCatcode(t,n){this.catcodes[t]=n}lex(){var t=this.input,n=this.tokenRegex.lastIndex;if(n===t.length)return new Ra("EOF",new Jo(this,n,n));var s=this.tokenRegex.exec(t);if(s===null||s.index!==n)throw new dt("Unexpected character: '"+t[n]+"'",new Ra(t[n],new Jo(this,n,n+1)));var r=s[6]||s[3]||(s[2]?"\\ ":" ");if(this.catcodes[r]===14){var i=t.indexOf(`
`,this.tokenRegex.lastIndex);return i===-1?(this.tokenRegex.lastIndex=t.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=i+1,this.lex()}return new Ra(r,new Jo(this,n,this.tokenRegex.lastIndex))}}class Vbe{constructor(t,n){t===void 0&&(t={}),n===void 0&&(n={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=n,this.builtins=t,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new dt("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var t=this.undefStack.pop();for(var n in t)t.hasOwnProperty(n)&&(t[n]==null?delete this.current[n]:this.current[n]=t[n])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(t){return this.current.hasOwnProperty(t)||this.builtins.hasOwnProperty(t)}get(t){return this.current.hasOwnProperty(t)?this.current[t]:this.builtins[t]}set(t,n,s){if(s===void 0&&(s=!1),s){for(var r=0;r<this.undefStack.length;r++)delete this.undefStack[r][t];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][t]=n)}else{var i=this.undefStack[this.undefStack.length-1];i&&!i.hasOwnProperty(t)&&(i[t]=this.current[t])}n==null?delete this.current[t]:this.current[t]=n}}var Wbe=CW;V("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});V("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});V("\\@firstoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[0],numArgs:0}});V("\\@secondoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[1],numArgs:0}});V("\\@ifnextchar",function(e){var t=e.consumeArgs(3);e.consumeSpaces();var n=e.future();return t[0].length===1&&t[0][0].text===n.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}});V("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");V("\\TextOrMath",function(e){var t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var rD={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};V("\\char",function(e){var t=e.popToken(),n,s=0;if(t.text==="'")n=8,t=e.popToken();else if(t.text==='"')n=16,t=e.popToken();else if(t.text==="`")if(t=e.popToken(),t.text[0]==="\\")s=t.text.charCodeAt(1);else{if(t.text==="EOF")throw new dt("\\char` missing argument");s=t.text.charCodeAt(0)}else n=10;if(n){if(s=rD[t.text],s==null||s>=n)throw new dt("Invalid base-"+n+" digit "+t.text);for(var r;(r=rD[e.future().text])!=null&&r<n;)s*=n,s+=r,e.popToken()}return"\\@char{"+s+"}"});var TA=(e,t,n,s)=>{var r=e.consumeArg().tokens;if(r.length!==1)throw new dt("\\newcommand's first argument must be a macro name");var i=r[0].text,o=e.isDefined(i);if(o&&!t)throw new dt("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!o&&!n)throw new dt("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var a=0;if(r=e.consumeArg().tokens,r.length===1&&r[0].text==="["){for(var l="",c=e.expandNextToken();c.text!=="]"&&c.text!=="EOF";)l+=c.text,c=e.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new dt("Invalid number of arguments: "+l);a=parseInt(l),r=e.consumeArg().tokens}return o&&s||e.macros.set(i,{tokens:r,numArgs:a}),""};V("\\newcommand",e=>TA(e,!1,!0,!1));V("\\renewcommand",e=>TA(e,!0,!1,!1));V("\\providecommand",e=>TA(e,!0,!0,!0));V("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(n=>n.text).join("")),""});V("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(n=>n.text).join("")),""});V("\\show",e=>{var t=e.popToken(),n=t.text;return console.log(t,e.macros.get(n),Wd[n],Nr.math[n],Nr.text[n]),""});V("\\bgroup","{");V("\\egroup","}");V("~","\\nobreakspace");V("\\lq","`");V("\\rq","'");V("\\aa","\\r a");V("\\AA","\\r A");V("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");V("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");V("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");V("ℬ","\\mathscr{B}");V("ℰ","\\mathscr{E}");V("ℱ","\\mathscr{F}");V("ℋ","\\mathscr{H}");V("ℐ","\\mathscr{I}");V("ℒ","\\mathscr{L}");V("ℳ","\\mathscr{M}");V("ℛ","\\mathscr{R}");V("ℭ","\\mathfrak{C}");V("ℌ","\\mathfrak{H}");V("ℨ","\\mathfrak{Z}");V("\\Bbbk","\\Bbb{k}");V("\\llap","\\mathllap{\\textrm{#1}}");V("\\rlap","\\mathrlap{\\textrm{#1}}");V("\\clap","\\mathclap{\\textrm{#1}}");V("\\mathstrut","\\vphantom{(}");V("\\underbar","\\underline{\\text{#1}}");V("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');V("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");V("\\ne","\\neq");V("≠","\\neq");V("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");V("∉","\\notin");V("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");V("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");V("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");V("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");V("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");V("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");V("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");V("⟂","\\perp");V("‼","\\mathclose{!\\mkern-0.8mu!}");V("∌","\\notni");V("⌜","\\ulcorner");V("⌝","\\urcorner");V("⌞","\\llcorner");V("⌟","\\lrcorner");V("©","\\copyright");V("®","\\textregistered");V("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');V("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');V("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');V("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');V("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");V("⋮","\\vdots");V("\\varGamma","\\mathit{\\Gamma}");V("\\varDelta","\\mathit{\\Delta}");V("\\varTheta","\\mathit{\\Theta}");V("\\varLambda","\\mathit{\\Lambda}");V("\\varXi","\\mathit{\\Xi}");V("\\varPi","\\mathit{\\Pi}");V("\\varSigma","\\mathit{\\Sigma}");V("\\varUpsilon","\\mathit{\\Upsilon}");V("\\varPhi","\\mathit{\\Phi}");V("\\varPsi","\\mathit{\\Psi}");V("\\varOmega","\\mathit{\\Omega}");V("\\substack","\\begin{subarray}{c}#1\\end{subarray}");V("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");V("\\boxed","\\fbox{$\\displaystyle{#1}$}");V("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");V("\\implies","\\DOTSB\\;\\Longrightarrow\\;");V("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");V("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");V("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var iD={",":"\\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"},Gbe=new Set(["bin","rel"]);V("\\dots",function(e){var t="\\dotso",n=e.expandAfterFuture().text;return n in iD?t=iD[n]:(n.slice(0,4)==="\\not"||n in Nr.math&&Gbe.has(Nr.math[n].group))&&(t="\\dotsb"),t});var EA={")":!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};V("\\dotso",function(e){var t=e.future().text;return t in EA?"\\ldots\\,":"\\ldots"});V("\\dotsc",function(e){var t=e.future().text;return t in EA&&t!==","?"\\ldots\\,":"\\ldots"});V("\\cdots",function(e){var t=e.future().text;return t in EA?"\\@cdots\\,":"\\@cdots"});V("\\dotsb","\\cdots");V("\\dotsm","\\cdots");V("\\dotsi","\\!\\cdots");V("\\dotsx","\\ldots\\,");V("\\DOTSI","\\relax");V("\\DOTSB","\\relax");V("\\DOTSX","\\relax");V("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");V("\\,","\\tmspace+{3mu}{.1667em}");V("\\thinspace","\\,");V("\\>","\\mskip{4mu}");V("\\:","\\tmspace+{4mu}{.2222em}");V("\\medspace","\\:");V("\\;","\\tmspace+{5mu}{.2777em}");V("\\thickspace","\\;");V("\\!","\\tmspace-{3mu}{.1667em}");V("\\negthinspace","\\!");V("\\negmedspace","\\tmspace-{4mu}{.2222em}");V("\\negthickspace","\\tmspace-{5mu}{.277em}");V("\\enspace","\\kern.5em ");V("\\enskip","\\hskip.5em\\relax");V("\\quad","\\hskip1em\\relax");V("\\qquad","\\hskip2em\\relax");V("\\tag","\\@ifstar\\tag@literal\\tag@paren");V("\\tag@paren","\\tag@literal{({#1})}");V("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new dt("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});V("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");V("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");V("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");V("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");V("\\newline","\\\\\\relax");V("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var PW=bt(kc["Main-Regular"][84][1]-.7*kc["Main-Regular"][65][1]);V("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+PW+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");V("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+PW+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");V("\\hspace","\\@ifstar\\@hspacer\\@hspace");V("\\@hspace","\\hskip #1\\relax");V("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");V("\\ordinarycolon",":");V("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");V("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');V("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');V("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');V("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');V("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');V("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');V("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');V("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');V("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');V("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');V("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');V("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');V("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');V("∷","\\dblcolon");V("∹","\\eqcolon");V("≔","\\coloneqq");V("≕","\\eqqcolon");V("⩴","\\Coloneqq");V("\\ratio","\\vcentcolon");V("\\coloncolon","\\dblcolon");V("\\colonequals","\\coloneqq");V("\\coloncolonequals","\\Coloneqq");V("\\equalscolon","\\eqqcolon");V("\\equalscoloncolon","\\Eqqcolon");V("\\colonminus","\\coloneq");V("\\coloncolonminus","\\Coloneq");V("\\minuscolon","\\eqcolon");V("\\minuscoloncolon","\\Eqcolon");V("\\coloncolonapprox","\\Colonapprox");V("\\coloncolonsim","\\Colonsim");V("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");V("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");V("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");V("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");V("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");V("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");V("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");V("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");V("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");V("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");V("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");V("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");V("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");V("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");V("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");V("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");V("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");V("\\nleqq","\\html@mathml{\\@nleqq}{≰}");V("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");V("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");V("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");V("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");V("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");V("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");V("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");V("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");V("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");V("\\imath","\\html@mathml{\\@imath}{ı}");V("\\jmath","\\html@mathml{\\@jmath}{ȷ}");V("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");V("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");V("⟦","\\llbracket");V("⟧","\\rrbracket");V("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");V("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");V("⦃","\\lBrace");V("⦄","\\rBrace");V("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");V("⦵","\\minuso");V("\\darr","\\downarrow");V("\\dArr","\\Downarrow");V("\\Darr","\\Downarrow");V("\\lang","\\langle");V("\\rang","\\rangle");V("\\uarr","\\uparrow");V("\\uArr","\\Uparrow");V("\\Uarr","\\Uparrow");V("\\N","\\mathbb{N}");V("\\R","\\mathbb{R}");V("\\Z","\\mathbb{Z}");V("\\alef","\\aleph");V("\\alefsym","\\aleph");V("\\Alpha","\\mathrm{A}");V("\\Beta","\\mathrm{B}");V("\\bull","\\bullet");V("\\Chi","\\mathrm{X}");V("\\clubs","\\clubsuit");V("\\cnums","\\mathbb{C}");V("\\Complex","\\mathbb{C}");V("\\Dagger","\\ddagger");V("\\diamonds","\\diamondsuit");V("\\empty","\\emptyset");V("\\Epsilon","\\mathrm{E}");V("\\Eta","\\mathrm{H}");V("\\exist","\\exists");V("\\harr","\\leftrightarrow");V("\\hArr","\\Leftrightarrow");V("\\Harr","\\Leftrightarrow");V("\\hearts","\\heartsuit");V("\\image","\\Im");V("\\infin","\\infty");V("\\Iota","\\mathrm{I}");V("\\isin","\\in");V("\\Kappa","\\mathrm{K}");V("\\larr","\\leftarrow");V("\\lArr","\\Leftarrow");V("\\Larr","\\Leftarrow");V("\\lrarr","\\leftrightarrow");V("\\lrArr","\\Leftrightarrow");V("\\Lrarr","\\Leftrightarrow");V("\\Mu","\\mathrm{M}");V("\\natnums","\\mathbb{N}");V("\\Nu","\\mathrm{N}");V("\\Omicron","\\mathrm{O}");V("\\plusmn","\\pm");V("\\rarr","\\rightarrow");V("\\rArr","\\Rightarrow");V("\\Rarr","\\Rightarrow");V("\\real","\\Re");V("\\reals","\\mathbb{R}");V("\\Reals","\\mathbb{R}");V("\\Rho","\\mathrm{P}");V("\\sdot","\\cdot");V("\\sect","\\S");V("\\spades","\\spadesuit");V("\\sub","\\subset");V("\\sube","\\subseteq");V("\\supe","\\supseteq");V("\\Tau","\\mathrm{T}");V("\\thetasym","\\vartheta");V("\\weierp","\\wp");V("\\Zeta","\\mathrm{Z}");V("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");V("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");V("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");V("\\bra","\\mathinner{\\langle{#1}|}");V("\\ket","\\mathinner{|{#1}\\rangle}");V("\\braket","\\mathinner{\\langle{#1}\\rangle}");V("\\Bra","\\left\\langle#1\\right|");V("\\Ket","\\left|#1\\right\\rangle");var BW=e=>t=>{var n=t.consumeArg().tokens,s=t.consumeArg().tokens,r=t.consumeArg().tokens,i=t.consumeArg().tokens,o=t.macros.get("|"),a=t.macros.get("\\|");t.macros.beginGroup();var l=h=>f=>{e&&(f.macros.set("|",o),r.length&&f.macros.set("\\|",a));var p=h;if(!h&&r.length){var g=f.future();g.text==="|"&&(f.popToken(),p=!0)}return{tokens:p?r:s,numArgs:0}};t.macros.set("|",l(!1)),r.length&&t.macros.set("\\|",l(!0));var c=t.consumeArg().tokens,d=t.expandTokens([...i,...c,...n]);return t.macros.endGroup(),{tokens:d.reverse(),numArgs:0}};V("\\bra@ket",BW(!1));V("\\bra@set",BW(!0));V("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");V("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");V("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");V("\\angln","{\\angl n}");V("\\blue","\\textcolor{##6495ed}{#1}");V("\\orange","\\textcolor{##ffa500}{#1}");V("\\pink","\\textcolor{##ff00af}{#1}");V("\\red","\\textcolor{##df0030}{#1}");V("\\green","\\textcolor{##28ae7b}{#1}");V("\\gray","\\textcolor{gray}{#1}");V("\\purple","\\textcolor{##9d38bd}{#1}");V("\\blueA","\\textcolor{##ccfaff}{#1}");V("\\blueB","\\textcolor{##80f6ff}{#1}");V("\\blueC","\\textcolor{##63d9ea}{#1}");V("\\blueD","\\textcolor{##11accd}{#1}");V("\\blueE","\\textcolor{##0c7f99}{#1}");V("\\tealA","\\textcolor{##94fff5}{#1}");V("\\tealB","\\textcolor{##26edd5}{#1}");V("\\tealC","\\textcolor{##01d1c1}{#1}");V("\\tealD","\\textcolor{##01a995}{#1}");V("\\tealE","\\textcolor{##208170}{#1}");V("\\greenA","\\textcolor{##b6ffb0}{#1}");V("\\greenB","\\textcolor{##8af281}{#1}");V("\\greenC","\\textcolor{##74cf70}{#1}");V("\\greenD","\\textcolor{##1fab54}{#1}");V("\\greenE","\\textcolor{##0d923f}{#1}");V("\\goldA","\\textcolor{##ffd0a9}{#1}");V("\\goldB","\\textcolor{##ffbb71}{#1}");V("\\goldC","\\textcolor{##ff9c39}{#1}");V("\\goldD","\\textcolor{##e07d10}{#1}");V("\\goldE","\\textcolor{##a75a05}{#1}");V("\\redA","\\textcolor{##fca9a9}{#1}");V("\\redB","\\textcolor{##ff8482}{#1}");V("\\redC","\\textcolor{##f9685d}{#1}");V("\\redD","\\textcolor{##e84d39}{#1}");V("\\redE","\\textcolor{##bc2612}{#1}");V("\\maroonA","\\textcolor{##ffbde0}{#1}");V("\\maroonB","\\textcolor{##ff92c6}{#1}");V("\\maroonC","\\textcolor{##ed5fa6}{#1}");V("\\maroonD","\\textcolor{##ca337c}{#1}");V("\\maroonE","\\textcolor{##9e034e}{#1}");V("\\purpleA","\\textcolor{##ddd7ff}{#1}");V("\\purpleB","\\textcolor{##c6b9fc}{#1}");V("\\purpleC","\\textcolor{##aa87ff}{#1}");V("\\purpleD","\\textcolor{##7854ab}{#1}");V("\\purpleE","\\textcolor{##543b78}{#1}");V("\\mintA","\\textcolor{##f5f9e8}{#1}");V("\\mintB","\\textcolor{##edf2df}{#1}");V("\\mintC","\\textcolor{##e0e5cc}{#1}");V("\\grayA","\\textcolor{##f6f7f7}{#1}");V("\\grayB","\\textcolor{##f0f1f2}{#1}");V("\\grayC","\\textcolor{##e3e5e6}{#1}");V("\\grayD","\\textcolor{##d6d8da}{#1}");V("\\grayE","\\textcolor{##babec2}{#1}");V("\\grayF","\\textcolor{##888d93}{#1}");V("\\grayG","\\textcolor{##626569}{#1}");V("\\grayH","\\textcolor{##3b3e40}{#1}");V("\\grayI","\\textcolor{##21242c}{#1}");V("\\kaBlue","\\textcolor{##314453}{#1}");V("\\kaGreen","\\textcolor{##71B307}{#1}");var $W={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class Kbe{constructor(t,n,s){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=n,this.expansionCount=0,this.feed(t),this.macros=new Vbe(Wbe,n.macros),this.mode=s,this.stack=[]}feed(t){this.lexer=new sD(t,this.settings)}switchMode(t){this.mode=t}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(t){this.stack.push(t)}pushTokens(t){this.stack.push(...t)}scanArgument(t){var n,s,r;if(t){if(this.consumeSpaces(),this.future().text!=="[")return null;n=this.popToken(),{tokens:r,end:s}=this.consumeArg(["]"])}else({tokens:r,start:n,end:s}=this.consumeArg());return this.pushToken(new Ra("EOF",s.loc)),this.pushTokens(r),new Ra("",Jo.range(n,s))}consumeSpaces(){for(;;){var t=this.future();if(t.text===" ")this.stack.pop();else break}}consumeArg(t){var n=[],s=t&&t.length>0;s||this.consumeSpaces();var r=this.future(),i,o=0,a=0;do{if(i=this.popToken(),n.push(i),i.text==="{")++o;else if(i.text==="}"){if(--o,o===-1)throw new dt("Extra }",i)}else if(i.text==="EOF")throw new dt("Unexpected end of input in a macro argument, expected '"+(t&&s?t[a]:"}")+"'",i);if(t&&s)if((o===0||o===1&&t[a]==="{")&&i.text===t[a]){if(++a,a===t.length){n.splice(-a,a);break}}else a=0}while(o!==0||s);return r.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:r,end:i}}consumeArgs(t,n){if(n){if(n.length!==t+1)throw new dt("The length of delimiters doesn't match the number of args!");for(var s=n[0],r=0;r<s.length;r++){var i=this.popToken();if(s[r]!==i.text)throw new dt("Use of the macro doesn't match its definition",i)}}for(var o=[],a=0;a<t;a++)o.push(this.consumeArg(n&&n[a+1]).tokens);return o}countExpansion(t){if(this.expansionCount+=t,this.expansionCount>this.settings.maxExpand)throw new dt("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(t){var n=this.popToken(),s=n.text,r=n.noexpand?null:this._getExpansion(s);if(r==null||t&&r.unexpandable){if(t&&r==null&&s[0]==="\\"&&!this.isDefined(s))throw new dt("Undefined control sequence: "+s);return this.pushToken(n),!1}this.countExpansion(1);var i=r.tokens,o=this.consumeArgs(r.numArgs,r.delimiters);if(r.numArgs){i=i.slice();for(var a=i.length-1;a>=0;--a){var l=i[a];if(l.text==="#"){if(a===0)throw new dt("Incomplete placeholder at end of macro body",l);if(l=i[--a],l.text==="#")i.splice(a+1,1);else if(/^[1-9]$/.test(l.text))i.splice(a,2,...o[+l.text-1]);else throw new dt("Not a valid argument number",l)}}}return this.pushTokens(i),i.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var t=this.stack.pop();return t.treatAsRelax&&(t.text="\\relax"),t}}expandMacro(t){return this.macros.has(t)?this.expandTokens([new Ra(t)]):void 0}expandTokens(t){var n=[],s=this.stack.length;for(this.pushTokens(t);this.stack.length>s;)if(this.expandOnce(!0)===!1){var r=this.stack.pop();r.treatAsRelax&&(r.noexpand=!1,r.treatAsRelax=!1),n.push(r)}return this.countExpansion(n.length),n}expandMacroAsText(t){var n=this.expandMacro(t);return n&&n.map(s=>s.text).join("")}_getExpansion(t){var n=this.macros.get(t);if(n==null)return n;if(t.length===1){var s=this.lexer.catcodes[t];if(s!=null&&s!==13)return}var r=typeof n=="function"?n(this):n;if(typeof r=="string"){var i=0;if(r.includes("#"))for(var o=r.replace(/##/g,"");o.includes("#"+(i+1));)++i;for(var a=new sD(r,this.settings),l=[],c=a.lex();c.text!=="EOF";)l.push(c),c=a.lex();l.reverse();var d={tokens:l,numArgs:i};return d}return r}isDefined(t){return this.macros.has(t)||Wd.hasOwnProperty(t)||Nr.math.hasOwnProperty(t)||Nr.text.hasOwnProperty(t)||$W.hasOwnProperty(t)}isExpandable(t){var n=this.macros.get(t);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:Wd.hasOwnProperty(t)&&!Wd[t].primitive}}var oD=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,Yv=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","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),J3={"́":{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"}},aD={á:"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 zW=class FW{constructor(t,n){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new Kbe(t,n,this.mode),this.settings=n,this.leftrightDepth=0,this.nextToken=null}expect(t,n){if(n===void 0&&(n=!0),this.fetch().text!==t)throw new dt("Expected '"+t+"', got '"+this.fetch().text+"'",this.fetch());n&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(t){this.mode=t,this.gullet.switchMode(t)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var t=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),t}finally{this.gullet.endGroups()}}subparse(t){var n=this.nextToken;this.consume(),this.gullet.pushToken(new Ra("}")),this.gullet.pushTokens(t);var s=this.parseExpression(!1);return this.expect("}"),this.nextToken=n,s}parseExpression(t,n){for(var s=[];;){this.mode==="math"&&this.consumeSpaces();var r=this.fetch();if(FW.endOfExpression.has(r.text)||n&&r.text===n||t&&Wd[r.text]&&Wd[r.text].infix)break;var i=this.parseAtom(n);if(i){if(i.type==="internal")continue}else break;s.push(i)}return this.mode==="text"&&this.formLigatures(s),this.handleInfixNodes(s)}handleInfixNodes(t){for(var n=-1,s,r=0;r<t.length;r++){var i=t[r];if(i.type==="infix"){if(n!==-1)throw new dt("only one infix operator per group",i.token);n=r,s=i.replaceWith}}if(n!==-1&&s){var o,a,l=t.slice(0,n),c=t.slice(n+1);l.length===1&&l[0].type==="ordgroup"?o=l[0]:o={type:"ordgroup",mode:this.mode,body:l},c.length===1&&c[0].type==="ordgroup"?a=c[0]:a={type:"ordgroup",mode:this.mode,body:c};var d;return s==="\\\\abovefrac"?d=this.callFunction(s,[o,t[n],a],[]):d=this.callFunction(s,[o,a],[]),[d]}else return t}handleSupSubscript(t){var n=this.fetch(),s=n.text;this.consume(),this.consumeSpaces();var r;do{var i;r=this.parseGroup(t)}while(((i=r)==null?void 0:i.type)==="internal");if(!r)throw new dt("Expected group after '"+s+"'",n);return r}formatUnsupportedCmd(t){for(var n=[],s=0;s<t.length;s++)n.push({type:"textord",mode:"text",text:t[s]});var r={type:"text",mode:this.mode,body:n},i={type:"color",mode:this.mode,color:this.settings.errorColor,body:[r]};return i}parseAtom(t){var n=this.parseGroup("atom",t);if((n==null?void 0:n.type)==="internal"||this.mode==="text")return n;for(var s,r;;){this.consumeSpaces();var i=this.fetch();if(i.text==="\\limits"||i.text==="\\nolimits"){if(n&&n.type==="op"){var o=i.text==="\\limits";n.limits=o,n.alwaysHandleSupSub=!0}else if(n&&n.type==="operatorname")n.alwaysHandleSupSub&&(n.limits=i.text==="\\limits");else throw new dt("Limit controls must follow a math operator",i);this.consume()}else if(i.text==="^"){if(s)throw new dt("Double superscript",i);s=this.handleSupSubscript("superscript")}else if(i.text==="_"){if(r)throw new dt("Double subscript",i);r=this.handleSupSubscript("subscript")}else if(i.text==="'"){if(s)throw new dt("Double superscript",i);var a={type:"textord",mode:this.mode,text:"\\prime"},l=[a];for(this.consume();this.fetch().text==="'";)l.push(a),this.consume();this.fetch().text==="^"&&l.push(this.handleSupSubscript("superscript")),s={type:"ordgroup",mode:this.mode,body:l}}else if(Yv[i.text]){var c=oD.test(i.text),d=[];for(d.push(new Ra(Yv[i.text])),this.consume();;){var h=this.fetch().text;if(!Yv[h]||oD.test(h)!==c)break;d.unshift(new Ra(Yv[h])),this.consume()}var f=this.subparse(d);c?r={type:"ordgroup",mode:"math",body:f}:s={type:"ordgroup",mode:"math",body:f}}else break}return s||r?{type:"supsub",mode:this.mode,base:n,sup:s,sub:r}:n}parseFunction(t,n){var s=this.fetch(),r=s.text,i=Wd[r];if(!i)return null;if(this.consume(),n&&n!=="atom"&&!i.allowedInArgument)throw new dt("Got function '"+r+"' with no arguments"+(n?" as "+n:""),s);if(this.mode==="text"&&!i.allowedInText)throw new dt("Can't use function '"+r+"' in text mode",s);if(this.mode==="math"&&i.allowedInMath===!1)throw new dt("Can't use function '"+r+"' in math mode",s);var{args:o,optArgs:a}=this.parseArguments(r,i);return this.callFunction(r,o,a,s,t)}callFunction(t,n,s,r,i){var o={funcName:t,parser:this,token:r,breakOnTokenText:i},a=Wd[t];if(a&&a.handler)return a.handler(o,n,s);throw new dt("No function handler for "+t)}parseArguments(t,n){var s=n.numArgs+n.numOptionalArgs;if(s===0)return{args:[],optArgs:[]};for(var r=[],i=[],o=0;o<s;o++){var a=n.argTypes&&n.argTypes[o],l=o<n.numOptionalArgs;("primitive"in n&&n.primitive&&a==null||n.type==="sqrt"&&o===1&&i[0]==null)&&(a="primitive");var c=this.parseGroupOfType("argument to '"+t+"'",a,l);if(l)i.push(c);else if(c!=null)r.push(c);else throw new dt("Null argument, please report this as a bug")}return{args:r,optArgs:i}}parseGroupOfType(t,n,s){switch(n){case"color":return this.parseColorGroup(s);case"size":return this.parseSizeGroup(s);case"url":return this.parseUrlGroup(s);case"math":case"text":return this.parseArgumentGroup(s,n);case"hbox":{var r=this.parseArgumentGroup(s,"text");return r!=null?{type:"styling",mode:r.mode,body:[r],style:"text",resetFont:!0}:null}case"raw":{var i=this.parseStringGroup("raw",s);return i!=null?{type:"raw",mode:"text",string:i.text}:null}case"primitive":{if(s)throw new dt("A primitive argument cannot be optional");var o=this.parseGroup(t);if(o==null)throw new dt("Expected group as "+t,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(s);default:throw new dt("Unknown group type as "+t,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(t,n){var s=this.gullet.scanArgument(n);if(s==null)return null;for(var r="",i;(i=this.fetch()).text!=="EOF";)r+=i.text,this.consume();return this.consume(),s.text=r,s}parseRegexGroup(t,n){for(var s=this.fetch(),r=s,i="",o;(o=this.fetch()).text!=="EOF"&&t.test(i+o.text);)r=o,i+=r.text,this.consume();if(i==="")throw new dt("Invalid "+n+": '"+s.text+"'",s);return s.range(r,i)}parseColorGroup(t){var n=this.parseStringGroup("color",t);if(n==null)return null;var s=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(n.text);if(!s)throw new dt("Invalid color: '"+n.text+"'",n);var r=s[0];return/^[0-9a-f]{6}$/i.test(r)&&(r="#"+r),{type:"color-token",mode:this.mode,color:r}}parseSizeGroup(t){var n,s=!1;if(this.gullet.consumeSpaces(),!t&&this.gullet.future().text!=="{"?n=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):n=this.parseStringGroup("size",t),!n)return null;!t&&n.text.length===0&&(n.text="0pt",s=!0);var r=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(n.text);if(!r)throw new dt("Invalid size: '"+n.text+"'",n);var i={number:+(r[1]+r[2]),unit:r[3]};if(!WV(i))throw new dt("Invalid unit: '"+i.unit+"'",n);return{type:"size",mode:this.mode,value:i,isBlank:s}}parseUrlGroup(t){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var n=this.parseStringGroup("url",t);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),n==null)return null;var s=n.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:s}}parseArgumentGroup(t,n){var s=this.gullet.scanArgument(t);if(s==null)return null;var r=this.mode;n&&this.switchMode(n),this.gullet.beginGroup();var i=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var o={type:"ordgroup",mode:this.mode,loc:s.loc,body:i};return n&&this.switchMode(r),o}parseGroup(t,n){var s=this.fetch(),r=s.text,i;if(r==="{"||r==="\\begingroup"){this.consume();var o=r==="{"?"}":"\\endgroup";this.gullet.beginGroup();var a=this.parseExpression(!1,o),l=this.fetch();this.expect(o),this.gullet.endGroup(),i={type:"ordgroup",mode:this.mode,loc:Jo.range(s,l),body:a,semisimple:r==="\\begingroup"||void 0}}else if(i=this.parseFunction(n,t)||this.parseSymbol(),i==null&&r[0]==="\\"&&!$W.hasOwnProperty(r)){if(this.settings.throwOnError)throw new dt("Undefined control sequence: "+r,s);i=this.formatUnsupportedCmd(r),this.consume()}return i}formLigatures(t){for(var n=t.length-1,s=0;s<n;++s){var r=t[s];if(r.type==="textord"){var i=r.text,o=t[s+1];if(!(!o||o.type!=="textord")){if(i==="-"&&o.text==="-"){var a=t[s+2];s+1<n&&a&&a.type==="textord"&&a.text==="-"?(t.splice(s,3,{type:"textord",mode:"text",loc:Jo.range(r,a),text:"---"}),n-=2):(t.splice(s,2,{type:"textord",mode:"text",loc:Jo.range(r,o),text:"--"}),n-=1)}(i==="'"||i==="`")&&o.text===i&&(t.splice(s,2,{type:"textord",mode:"text",loc:Jo.range(r,o),text:i+i}),n-=1)}}}}parseSymbol(){var t=this.fetch(),n=t.text;if(/^\\verb[^a-zA-Z]/.test(n)){this.consume();var s=n.slice(5),r=s.charAt(0)==="*";if(r&&(s=s.slice(1)),s.length<2||s.charAt(0)!==s.slice(-1))throw new dt(`\\verb assertion failed --
                    please report what input caused this bug`);return s=s.slice(1,-1),{type:"verb",mode:"text",body:s,star:r}}aD.hasOwnProperty(n[0])&&!Nr[this.mode][n[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+n[0]+'" used in math mode',t),n=aD[n[0]]+n.slice(1));var i=Hbe.exec(n);i&&(n=n.substring(0,i.index),n==="i"?n="ı":n==="j"&&(n="ȷ"));var o;if(Nr[this.mode][n]){this.settings.strict&&this.mode==="math"&&mT.includes(n)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',t);var a=Nr[this.mode][n].group,l=Jo.range(t),c;ube(a)?c={type:"atom",mode:this.mode,family:a,loc:l,text:n}:c={type:a,mode:this.mode,loc:l,text:n},o=c}else if(n.charCodeAt(0)>=128)this.settings.strict&&(VV(n.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+n[0]+'" used in math mode',t):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+n[0]+'"'+(" ("+n.charCodeAt(0)+")"),t)),o={type:"textord",mode:"text",loc:Jo.range(t),text:n};else return null;if(this.consume(),i)for(var d=0;d<i[0].length;d++){var h=i[0][d];if(!J3[h])throw new dt("Unknown accent ' "+h+"'",t);var f=J3[h][this.mode]||J3[h].text;if(!f)throw new dt("Accent "+h+" unsupported in "+this.mode+" mode",t);o={type:"accent",mode:this.mode,loc:Jo.range(t),label:f,isStretchy:!1,isShifty:!0,base:o}}return o}};zW.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var AA=function(t,n){if(!(typeof t=="string"||t instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var s=new zW(t,n);delete s.gullet.macros.current["\\df@tag"];var r=s.parse();if(delete s.gullet.macros.current["\\current@color"],delete s.gullet.macros.current["\\color"],s.gullet.macros.get("\\df@tag")){if(!n.displayMode)throw new dt("\\tag works only in display equations");r=[{type:"tag",mode:"text",body:r,tag:s.subparse([new Ra("\\df@tag")])}]}return r},MA=function(t,n,s){n.textContent="";var r=B_(t,s).toNode();n.appendChild(r)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),MA=function(){throw new dt("KaTeX doesn't work in quirks mode.")});var qW=function(t,n){var s=B_(t,n).toMarkup();return s},HW=function(t,n){var s=new mA(n);return AA(t,s)},UW=function(t,n,s){if(s.throwOnError||!(t instanceof dt))throw t;var r=it(["katex-error"],[new Oa(n)]);return r.setAttribute("title",t.toString()),r.setAttribute("style","color:"+s.errorColor),r},B_=function(t,n){var s=new mA(n);try{var r=AA(t,s);return nbe(r,t,s)}catch(i){return UW(i,t,s)}},VW=function(t,n){var s=new mA(n);try{var r=AA(t,s);return sbe(r,t,s)}catch(i){return UW(i,t,s)}},WW="0.16.47",GW={Span:X0,Anchor:T_,SymbolNode:Oa,SvgNode:qu,PathNode:yh,LineNode:fT},MT={version:WW,render:MA,renderToString:qW,ParseError:dt,SETTINGS_SCHEMA:jk,__parse:HW,__renderToDomTree:B_,__renderToHTMLTree:VW,__setFontMetrics:XV,__defineSymbol:E,__defineFunction:$t,__defineMacro:V,__domTree:GW};const F0t=Object.freeze(Object.defineProperty({__proto__:null,ParseError:dt,SETTINGS_SCHEMA:jk,__defineFunction:$t,__defineMacro:V,__defineSymbol:E,__domTree:GW,__parse:HW,__renderToDomTree:B_,__renderToHTMLTree:VW,__setFontMetrics:XV,default:MT,get render(){return MA},renderToString:qW,version:WW},Symbol.toStringTag,{value:"Module"})),Ybe={};function lD(e){const t=this,n=e||Ybe,s=t.data(),r=s.micromarkExtensions||(s.micromarkExtensions=[]),i=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),o=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);r.push(sye(n)),i.push(Y1e()),o.push(X1e(n))}const cD=/[#.]/g;function Xbe(e,t){const n=e||"",s={};let r=0,i,o;for(;r<n.length;){cD.lastIndex=r;const a=cD.exec(n),l=n.slice(r,a?a.index:n.length);l&&(i?i==="#"?s.id=l:Array.isArray(s.className)?s.className.push(l):s.className=[l]:o=l,r+=l.length),a&&(i=a[0],r++)}return{type:"element",tagName:o||t||"div",properties:s,children:[]}}function KW(e,t,n){const s=n?eve(n):void 0;function r(i,o,...a){let l;if(i==null){l={type:"root",children:[]};const c=o;a.unshift(c)}else{l=Xbe(i,t);const c=l.tagName.toLowerCase(),d=s?s.get(c):void 0;if(l.tagName=d||c,Qbe(o))a.unshift(o);else for(const[h,f]of Object.entries(o))Jbe(e,l.properties,h,f)}for(const c of a)NT(l.children,c);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return r}function Qbe(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const t=e,n=Object.keys(e);for(const s of n){const r=t[s];if(r&&typeof r=="object"){if(!Array.isArray(r))return!0;const i=r;for(const o of i)if(typeof o!="number"&&typeof o!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function Jbe(e,t,n,s){const r=KE(e,n);let i;if(s!=null){if(typeof s=="number"){if(Number.isNaN(s))return;i=s}else typeof s=="boolean"?i=s:typeof s=="string"?r.spaceSeparated?i=Nj(s):r.commaSeparated?i=Cj(s):r.commaOrSpaceSeparated?i=Nj(Cj(s).join(" ")):i=uD(r,r.property,s):Array.isArray(s)?i=[...s]:i=r.property==="style"?Zbe(s):String(s);if(Array.isArray(i)){const o=[];for(const a of i)o.push(uD(r,r.property,a));i=o}r.property==="className"&&Array.isArray(t.className)&&(i=t.className.concat(i)),t[r.property]=i}}function NT(e,t){if(t!=null)if(typeof t=="number"||typeof t=="string")e.push({type:"text",value:String(t)});else if(Array.isArray(t))for(const n of t)NT(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?NT(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function uD(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||vy(n)===vy(t)))return!0}return n}function Zbe(e){const t=[];for(const[n,s]of Object.entries(e))t.push([n,s].join(": "));return t.join("; ")}function eve(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const tve=["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"],nve=KW(YE,"div"),sve=KW(G0,"g",tve),Z3={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function rve(e,t){return YW(e,{})||{type:"root",children:[]}}function YW(e,t){const n=ive(e,t);return n&&t.afterTransform&&t.afterTransform(e,n),n}function ive(e,t){switch(e.nodeType){case 1:return cve(e,t);case 3:return ave(e);case 8:return lve(e);case 9:return dD(e,t);case 10:return ove();case 11:return dD(e,t);default:return}}function dD(e,t){return{type:"root",children:XW(e,t)}}function ove(){return{type:"doctype"}}function ave(e){return{type:"text",value:e.nodeValue||""}}function lve(e){return{type:"comment",value:e.nodeValue||""}}function cve(e,t){const n=e.namespaceURI,s=n===Z3.svg?sve:nve,r=n===Z3.html?e.tagName.toLowerCase():e.tagName,i=n===Z3.html&&r==="template"?e.content:e,o=e.getAttributeNames(),a={};let l=-1;for(;++l<o.length;)a[o[l]]=e.getAttribute(o[l])||"";return s(r,a,XW(i,t))}function XW(e,t){const n=e.childNodes,s=[];let r=-1;for(;++r<n.length;){const i=YW(n[r],t);i!==void 0&&s.push(i)}return s}new DOMParser;function uve(e,t){const n=dve(e);return rve(n)}function dve(e){const t=document.createElement("template");return t.innerHTML=e,t.content}const hD=function(e,t,n){const s=xb(n);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++t<e.children.length;)if(s(e.children[t],t,e))return e.children[t]},km=function(e){if(e==null)return mve;if(typeof e=="string")return fve(e);if(typeof e=="object")return hve(e);if(typeof e=="function")return NA(e);throw new Error("Expected function, string, or array as `test`")};function hve(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=km(e[n]);return NA(s);function s(...r){let i=-1;for(;++i<t.length;)if(t[i].apply(this,r))return!0;return!1}}function fve(e){return NA(t);function t(n){return n.tagName===e}}function NA(e){return t;function t(n,s,r){return!!(pve(n)&&e.call(this,n,typeof s=="number"?s:void 0,r||void 0))}}function mve(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function pve(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const fD=/\n/g,mD=/[\t ]+/g,IT=km("br"),pD=km(_ve),gve=km("p"),gD=km("tr"),yve=km(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",kve,Sve]),QW=km(["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 bve(e,t){const n=t||{},s="children"in e?e.children:[],r=QW(e),i=eG(e,{whitespace:n.whitespace||"normal"}),o=[];(e.type==="text"||e.type==="comment")&&o.push(...ZW(e,{breakBefore:!0,breakAfter:!0}));let a=-1;for(;++a<s.length;)o.push(...JW(s[a],e,{whitespace:i,breakBefore:a?void 0:r,breakAfter:a<s.length-1?IT(s[a+1]):r}));const l=[];let c;for(a=-1;++a<o.length;){const d=o[a];typeof d=="number"?c!==void 0&&d>c&&(c=d):d&&(c!==void 0&&c>-1&&l.push(`
`.repeat(c)||" "),c=-1,l.push(d))}return l.join("")}function JW(e,t,n){return e.type==="element"?vve(e,t,n):e.type==="text"?n.whitespace==="normal"?ZW(e,n):wve(e):[]}function vve(e,t,n){const s=eG(e,n),r=e.children||[];let i=-1,o=[];if(yve(e))return o;let a,l;for(IT(e)||gD(e)&&hD(t,e,gD)?l=`
`:gve(e)?(a=2,l=2):QW(e)&&(a=1,l=1);++i<r.length;)o=o.concat(JW(r[i],e,{whitespace:s,breakBefore:i?void 0:a,breakAfter:i<r.length-1?IT(r[i+1]):l}));return pD(e)&&hD(t,e,pD)&&o.push("	"),a&&o.unshift(a),l&&o.push(l),o}function ZW(e,t){const n=String(e.value),s=[],r=[];let i=0;for(;i<=n.length;){fD.lastIndex=i;const l=fD.exec(n),c=l&&"index"in l?l.index:n.length;s.push(xve(n.slice(i,c).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),i===0?t.breakBefore:!0,c===n.length?t.breakAfter:!0)),i=c+1}let o=-1,a;for(;++o<s.length;)s[o].charCodeAt(s[o].length-1)===8203||o<s.length-1&&s[o+1].charCodeAt(0)===8203?(r.push(s[o]),a=void 0):s[o]?(typeof a=="number"&&r.push(a),r.push(s[o]),a=0):(o===0||o===s.length-1)&&r.push(0);return r}function wve(e){return[String(e.value)]}function xve(e,t,n){const s=[];let r=0,i;for(;r<e.length;){mD.lastIndex=r;const o=mD.exec(e);i=o?o.index:e.length,!r&&!i&&o&&!t&&s.push(""),r!==i&&s.push(e.slice(r,i)),r=o?i+o[0].length:i}return r!==i&&!n&&s.push(""),s.join(" ")}function eG(e,t){if(e.type==="element"){const n=e.properties||{};switch(e.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return n.wrap?"pre-wrap":"pre";case"td":case"th":return n.noWrap?"nowrap":t.whitespace;case"textarea":return"pre-wrap"}}return t.whitespace}function kve(e){return!!(e.properties||{}).hidden}function _ve(e){return e.tagName==="td"||e.tagName==="th"}function Sve(e){return e.tagName==="dialog"&&!(e.properties||{}).open}const Cve={},Tve=[];function yD(e){const t=e||Cve;return function(n,s){lA(n,"element",function(r,i){const o=Array.isArray(r.properties.className)?r.properties.className:Tve,a=o.includes("language-math"),l=o.includes("math-display"),c=o.includes("math-inline");let d=l;if(!a&&!l&&!c)return;let h=i[i.length-1],f=r;if(r.tagName==="code"&&a&&h&&h.type==="element"&&h.tagName==="pre"&&(f=h,h=i[i.length-2],d=!0),!h)return;const p=bve(f,{whitespace:"pre"});let g;try{g=MT.renderToString(p,{...t,displayMode:d,throwOnError:!0})}catch(w){const v=w,b=v.name.toLowerCase();s.message("Could not render math with KaTeX",{ancestors:[...i,r],cause:v,place:r.position,ruleId:b,source:"rehype-katex"});try{g=MT.renderToString(p,{...t,displayMode:d,strict:"ignore",throwOnError:!1})}catch{g=[{type:"element",tagName:"span",properties:{className:["katex-error"],style:"color:"+(t.errorColor||"#cc0000"),title:String(w)},children:[{type:"text",value:p}]}]}}typeof g=="string"&&(g=uve(g).children);const y=h.children.indexOf(f);return h.children.splice(y,1,...g),yV})}}const tG=[{id:"abap",name:"ABAP",import:()=>J(()=>import("./abap-DsBKuouk.js"),[])},{id:"actionscript-3",name:"ActionScript",import:()=>J(()=>import("./actionscript-3-D_z4Izcz.js"),[])},{id:"ada",name:"Ada",import:()=>J(()=>import("./ada-727ZlQH0.js"),[])},{id:"angular-html",name:"Angular HTML",import:()=>J(()=>import("./angular-html-LfdN0zeE.js").then(e=>e.f),__vite__mapDeps([0,1,2,3]))},{id:"angular-ts",name:"Angular TypeScript",import:()=>J(()=>import("./angular-ts-CKsD7JZE.js"),__vite__mapDeps([4,0,1,2,3,5]))},{id:"apache",name:"Apache Conf",import:()=>J(()=>import("./apache-Dn00JSTd.js"),[])},{id:"apex",name:"Apex",import:()=>J(()=>import("./apex-COJ4H7py.js"),[])},{id:"apl",name:"APL",import:()=>J(()=>import("./apl-BBq3IX1j.js"),__vite__mapDeps([6,1,2,3,7,8,9]))},{id:"applescript",name:"AppleScript",import:()=>J(()=>import("./applescript-Bu5BbsvL.js"),[])},{id:"ara",name:"Ara",import:()=>J(()=>import("./ara-7O62HKoU.js"),[])},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>J(()=>import("./asciidoc-BPT9niGB.js"),[])},{id:"asm",name:"Assembly",import:()=>J(()=>import("./asm-Dhn9LcZ4.js"),[])},{id:"astro",name:"Astro",import:()=>J(()=>import("./astro-CqkE3fuf.js"),__vite__mapDeps([10,9,2,11,3,12]))},{id:"awk",name:"AWK",import:()=>J(()=>import("./awk-eg146-Ew.js"),[])},{id:"ballerina",name:"Ballerina",import:()=>J(()=>import("./ballerina-Du268qiB.js"),[])},{id:"bat",name:"Batch File",aliases:["batch"],import:()=>J(()=>import("./bat-fje9CFhw.js"),[])},{id:"beancount",name:"Beancount",import:()=>J(()=>import("./beancount-BwXTMy5W.js"),[])},{id:"berry",name:"Berry",aliases:["be"],import:()=>J(()=>import("./berry-3xVqZejG.js"),[])},{id:"bibtex",name:"BibTeX",import:()=>J(()=>import("./bibtex-xW4inM5L.js"),[])},{id:"bicep",name:"Bicep",import:()=>J(()=>import("./bicep-DHo0CJ0O.js"),[])},{id:"blade",name:"Blade",import:()=>J(()=>import("./blade-a8OxSdnT.js"),__vite__mapDeps([13,1,2,3,7,8,14,9]))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>J(()=>import("./bsl-Dgyn0ogV.js"),__vite__mapDeps([15,16]))},{id:"c",name:"C",import:()=>J(()=>import("./c-C3t2pwGQ.js"),[])},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>J(()=>import("./cadence-DNquZEk8.js"),[])},{id:"cairo",name:"Cairo",import:()=>J(()=>import("./cairo--RitsXJZ.js"),__vite__mapDeps([17,18]))},{id:"clarity",name:"Clarity",import:()=>J(()=>import("./clarity-BHOwM8T6.js"),[])},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>J(()=>import("./clojure-DxSadP1t.js"),[])},{id:"cmake",name:"CMake",import:()=>J(()=>import("./cmake-DbXoA79R.js"),[])},{id:"cobol",name:"COBOL",import:()=>J(()=>import("./cobol-PTqiYgYu.js"),__vite__mapDeps([19,1,2,3,8]))},{id:"codeowners",name:"CODEOWNERS",import:()=>J(()=>import("./codeowners-Bp6g37R7.js"),[])},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>J(()=>import("./codeql-sacFqUAJ.js"),[])},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>J(()=>import("./coffee-dyiR41kL.js"),__vite__mapDeps([20,2]))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>J(()=>import("./common-lisp-C7gG9l05.js"),[])},{id:"coq",name:"Coq",import:()=>J(()=>import("./coq-Dsg_Bt_b.js"),[])},{id:"cpp",name:"C++",aliases:["c++"],import:()=>J(()=>import("./cpp-BksuvNSY.js"),__vite__mapDeps([21,22,23,24,14]))},{id:"crystal",name:"Crystal",import:()=>J(()=>import("./crystal-DtDmRg-F.js"),__vite__mapDeps([25,1,2,3,14,24,26]))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>J(()=>import("./csharp-D9R-vmeu.js"),[])},{id:"css",name:"CSS",import:()=>J(()=>import("./css-BPhBrDlE.js"),[])},{id:"csv",name:"CSV",import:()=>J(()=>import("./csv-B0qRVHPH.js"),[])},{id:"cue",name:"CUE",import:()=>J(()=>import("./cue-DtFQj3wx.js"),[])},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>J(()=>import("./cypher-m2LEI-9-.js"),[])},{id:"d",name:"D",import:()=>J(()=>import("./d-BoXegm-a.js"),[])},{id:"dart",name:"Dart",import:()=>J(()=>import("./dart-B9wLZaAG.js"),[])},{id:"dax",name:"DAX",import:()=>J(()=>import("./dax-ClGRhx96.js"),[])},{id:"desktop",name:"Desktop",import:()=>J(()=>import("./desktop-DEIpsLCJ.js"),[])},{id:"diff",name:"Diff",import:()=>J(()=>import("./diff-BgYniUM_.js"),[])},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>J(()=>import("./docker-COcR7UxN.js"),[])},{id:"dotenv",name:"dotEnv",import:()=>J(()=>import("./dotenv-BjQB5zDj.js"),[])},{id:"dream-maker",name:"Dream Maker",import:()=>J(()=>import("./dream-maker-C-nORZOA.js"),[])},{id:"edge",name:"Edge",import:()=>J(()=>import("./edge-D5gP-w-T.js"),__vite__mapDeps([27,11,1,2,3,28]))},{id:"elixir",name:"Elixir",import:()=>J(()=>import("./elixir-CLiX3zqd.js"),__vite__mapDeps([29,1,2,3]))},{id:"elm",name:"Elm",import:()=>J(()=>import("./elm-CmHSxxaM.js"),__vite__mapDeps([30,23,24]))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>J(()=>import("./emacs-lisp-BX77sIaO.js"),[])},{id:"erb",name:"ERB",import:()=>J(()=>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:()=>J(()=>import("./erlang-B-DoSBHF.js"),[])},{id:"fennel",name:"Fennel",import:()=>J(()=>import("./fennel-bCA53EVm.js"),[])},{id:"fish",name:"Fish",import:()=>J(()=>import("./fish-w-ucz2PV.js"),[])},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>J(()=>import("./fluent-Dayu4EKP.js"),[])},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>J(()=>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:()=>J(()=>import("./fortran-free-form-DKXYxT9g.js"),[])},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>J(()=>import("./fsharp-XplgxFYe.js"),__vite__mapDeps([41,42]))},{id:"gdresource",name:"GDResource",import:()=>J(()=>import("./gdresource-BHYsBjWJ.js"),__vite__mapDeps([43,44,45]))},{id:"gdscript",name:"GDScript",import:()=>J(()=>import("./gdscript-DfxzS6Rs.js"),[])},{id:"gdshader",name:"GDShader",import:()=>J(()=>import("./gdshader-SKMF96pI.js"),[])},{id:"genie",name:"Genie",import:()=>J(()=>import("./genie-ajMbGru0.js"),[])},{id:"gherkin",name:"Gherkin",import:()=>J(()=>import("./gherkin--30QC5Em.js"),[])},{id:"git-commit",name:"Git Commit Message",import:()=>J(()=>import("./git-commit-i4q6IMui.js"),__vite__mapDeps([46,47]))},{id:"git-rebase",name:"Git Rebase Message",import:()=>J(()=>import("./git-rebase-B-v9cOL2.js"),__vite__mapDeps([48,26]))},{id:"gleam",name:"Gleam",import:()=>J(()=>import("./gleam-B430Bg39.js"),[])},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>J(()=>import("./glimmer-js-D-cwc0-E.js"),__vite__mapDeps([49,2,11,3,1]))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>J(()=>import("./glimmer-ts-pgjy16dm.js"),__vite__mapDeps([50,11,3,2,1]))},{id:"glsl",name:"GLSL",import:()=>J(()=>import("./glsl-DBO2IWDn.js"),__vite__mapDeps([23,24]))},{id:"gnuplot",name:"Gnuplot",import:()=>J(()=>import("./gnuplot-CM8KxXT1.js"),[])},{id:"go",name:"Go",import:()=>J(()=>import("./go-B1SYOhNW.js"),[])},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>J(()=>import("./graphql-cDcHW_If.js"),__vite__mapDeps([34,2,11,35,36]))},{id:"groovy",name:"Groovy",import:()=>J(()=>import("./groovy-DkBy-JyN.js"),[])},{id:"hack",name:"Hack",import:()=>J(()=>import("./hack-D1yCygmZ.js"),__vite__mapDeps([51,1,2,3,14]))},{id:"haml",name:"Ruby Haml",import:()=>J(()=>import("./haml-B2EZWmdv.js"),__vite__mapDeps([33,2,3]))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>J(()=>import("./handlebars-BQGss363.js"),__vite__mapDeps([52,1,2,3,38]))},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>J(()=>import("./haskell-BILxekzW.js"),[])},{id:"haxe",name:"Haxe",import:()=>J(()=>import("./haxe-C5wWYbrZ.js"),[])},{id:"hcl",name:"HashiCorp HCL",import:()=>J(()=>import("./hcl-HzYwdGDm.js"),[])},{id:"hjson",name:"Hjson",import:()=>J(()=>import("./hjson-T-Tgc4AT.js"),[])},{id:"hlsl",name:"HLSL",import:()=>J(()=>import("./hlsl-ifBTmRxC.js"),[])},{id:"html",name:"HTML",import:()=>J(()=>import("./html-C2L_23MC.js"),__vite__mapDeps([1,2,3]))},{id:"html-derivative",name:"HTML (Derivative)",import:()=>J(()=>import("./html-derivative-CSfWNPLT.js"),__vite__mapDeps([28,1,2,3]))},{id:"http",name:"HTTP",import:()=>J(()=>import("./http-FRrOvY1W.js"),__vite__mapDeps([53,26,9,7,8,34,2,11,35,36]))},{id:"hxml",name:"HXML",import:()=>J(()=>import("./hxml-TIA70rKU.js"),__vite__mapDeps([54,55]))},{id:"hy",name:"Hy",import:()=>J(()=>import("./hy-BMj5Y0dO.js"),[])},{id:"imba",name:"Imba",import:()=>J(()=>import("./imba-bv_oIlVt.js"),__vite__mapDeps([56,11]))},{id:"ini",name:"INI",aliases:["properties"],import:()=>J(()=>import("./ini-BjABl1g7.js"),[])},{id:"java",name:"Java",import:()=>J(()=>import("./java-xI-RfyKK.js"),[])},{id:"javascript",name:"JavaScript",aliases:["js"],import:()=>J(()=>import("./javascript-ySlJ1b_l.js"),[])},{id:"jinja",name:"Jinja",import:()=>J(()=>import("./jinja-DGy0s7-h.js"),__vite__mapDeps([57,1,2,3]))},{id:"jison",name:"Jison",import:()=>J(()=>import("./jison-BqZprYcd.js"),__vite__mapDeps([58,2]))},{id:"json",name:"JSON",import:()=>J(()=>import("./json-BQoSv7ci.js"),[])},{id:"json5",name:"JSON5",import:()=>J(()=>import("./json5-w8dY5SsB.js"),[])},{id:"jsonc",name:"JSON with Comments",import:()=>J(()=>import("./jsonc-TU54ms6u.js"),[])},{id:"jsonl",name:"JSON Lines",import:()=>J(()=>import("./jsonl-DREVFZK8.js"),[])},{id:"jsonnet",name:"Jsonnet",import:()=>J(()=>import("./jsonnet-BfivnA6A.js"),[])},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>J(()=>import("./jssm-P4WzXJd0.js"),[])},{id:"jsx",name:"JSX",import:()=>J(()=>import("./jsx-BAng5TT0.js"),[])},{id:"julia",name:"Julia",aliases:["jl"],import:()=>J(()=>import("./julia-BBuGR-5E.js"),__vite__mapDeps([59,21,22,23,24,14,18,2,60]))},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>J(()=>import("./kotlin-B5lbUyaz.js"),[])},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>J(()=>import("./kusto-mebxcVVE.js"),[])},{id:"latex",name:"LaTeX",import:()=>J(()=>import("./latex-C-cWTeAZ.js"),__vite__mapDeps([61,62,60]))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>J(()=>import("./lean-XBlWyCtg.js"),[])},{id:"less",name:"Less",import:()=>J(()=>import("./less-BfCpw3nA.js"),[])},{id:"liquid",name:"Liquid",import:()=>J(()=>import("./liquid-D3W5UaiH.js"),__vite__mapDeps([63,1,2,3,9]))},{id:"log",name:"Log file",import:()=>J(()=>import("./log-Cc5clBb7.js"),[])},{id:"logo",name:"Logo",import:()=>J(()=>import("./logo-IuBKFhSY.js"),[])},{id:"lua",name:"Lua",import:()=>J(()=>import("./lua-CvWAzNxB.js"),__vite__mapDeps([37,24]))},{id:"luau",name:"Luau",import:()=>J(()=>import("./luau-Du5NY7AG.js"),[])},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>J(()=>import("./make-Bvotw-X0.js"),[])},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>J(()=>import("./markdown-UIAJJxZW.js"),[])},{id:"marko",name:"Marko",import:()=>J(()=>import("./marko-z0MBrx5-.js"),__vite__mapDeps([64,3,65,5,2]))},{id:"matlab",name:"MATLAB",import:()=>J(()=>import("./matlab-D9-PGadD.js"),[])},{id:"mdc",name:"MDC",import:()=>J(()=>import("./mdc-DB_EDNY_.js"),__vite__mapDeps([66,42,38,28,1,2,3]))},{id:"mdx",name:"MDX",import:()=>J(()=>import("./mdx-sdHcTMYB.js"),[])},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>J(()=>import("./mermaid-Ci6OQyBP.js"),[])},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>J(()=>import("./mipsasm-BC5c_5Pe.js"),[])},{id:"mojo",name:"Mojo",import:()=>J(()=>import("./mojo-Tz6hzZYG.js"),[])},{id:"move",name:"Move",import:()=>J(()=>import("./move-DB_GagMm.js"),[])},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>J(()=>import("./narrat-DLbgOhZU.js"),[])},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>J(()=>import("./nextflow-B0XVJmRM.js"),[])},{id:"nginx",name:"Nginx",import:()=>J(()=>import("./nginx-D_VnBJ67.js"),__vite__mapDeps([67,37,24]))},{id:"nim",name:"Nim",import:()=>J(()=>import("./nim-ZlGxZxc3.js"),__vite__mapDeps([68,24,1,2,3,7,8,23,42]))},{id:"nix",name:"Nix",import:()=>J(()=>import("./nix-shcSOmrb.js"),[])},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>J(()=>import("./nushell-D4Tzg5kh.js"),[])},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>J(()=>import("./objective-c-Deuh7S70.js"),[])},{id:"objective-cpp",name:"Objective-C++",import:()=>J(()=>import("./objective-cpp-BUEGK8hf.js"),[])},{id:"ocaml",name:"OCaml",import:()=>J(()=>import("./ocaml-BNioltXt.js"),[])},{id:"pascal",name:"Pascal",import:()=>J(()=>import("./pascal-JqZropPD.js"),[])},{id:"perl",name:"Perl",import:()=>J(()=>import("./perl-CHQXSrWU.js"),__vite__mapDeps([69,1,2,3,7,8,14]))},{id:"php",name:"PHP",import:()=>J(()=>import("./php-B5ebYQev.js"),__vite__mapDeps([70,1,2,3,7,8,14,9]))},{id:"plsql",name:"PL/SQL",import:()=>J(()=>import("./plsql-LKU2TuZ1.js"),[])},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>J(()=>import("./po-BFLt1xDp.js"),[])},{id:"polar",name:"Polar",import:()=>J(()=>import("./polar-DKykz6zU.js"),[])},{id:"postcss",name:"PostCSS",import:()=>J(()=>import("./postcss-B3ZDOciz.js"),[])},{id:"powerquery",name:"PowerQuery",import:()=>J(()=>import("./powerquery-CSHBycmS.js"),[])},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:()=>J(()=>import("./powershell-BIEUsx6d.js"),[])},{id:"prisma",name:"Prisma",import:()=>J(()=>import("./prisma-B48N-Iqd.js"),[])},{id:"prolog",name:"Prolog",import:()=>J(()=>import("./prolog-BY-TUvya.js"),[])},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>J(()=>import("./proto-zocC4JxJ.js"),[])},{id:"pug",name:"Pug",aliases:["jade"],import:()=>J(()=>import("./pug-CM9l7STV.js"),__vite__mapDeps([71,2,3,1]))},{id:"puppet",name:"Puppet",import:()=>J(()=>import("./puppet-Cza_XSSt.js"),[])},{id:"purescript",name:"PureScript",import:()=>J(()=>import("./purescript-Bg-kzb6g.js"),[])},{id:"python",name:"Python",aliases:["py"],import:()=>J(()=>import("./python-DhUJRlN_.js"),[])},{id:"qml",name:"QML",import:()=>J(()=>import("./qml-D8XfuvdV.js"),__vite__mapDeps([72,2]))},{id:"qmldir",name:"QML Directory",import:()=>J(()=>import("./qmldir-C8lEn-DE.js"),[])},{id:"qss",name:"Qt Style Sheets",import:()=>J(()=>import("./qss-DhMKtDLN.js"),[])},{id:"r",name:"R",import:()=>J(()=>import("./r-CwjWoCRV.js"),[])},{id:"racket",name:"Racket",import:()=>J(()=>import("./racket-CzouJOBO.js"),[])},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>J(()=>import("./raku-B1bQXN8T.js"),[])},{id:"razor",name:"ASP.NET Razor",import:()=>J(()=>import("./razor-CNLDkMZG.js"),__vite__mapDeps([73,1,2,3,74]))},{id:"reg",name:"Windows Registry Script",import:()=>J(()=>import("./reg-5LuOXUq_.js"),[])},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>J(()=>import("./regexp-DWJ3fJO_.js"),[])},{id:"rel",name:"Rel",import:()=>J(()=>import("./rel-DJlmqQ1C.js"),[])},{id:"riscv",name:"RISC-V",import:()=>J(()=>import("./riscv-QhoSD0DR.js"),[])},{id:"rst",name:"reStructuredText",import:()=>J(()=>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:()=>J(()=>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:()=>J(()=>import("./rust-Be6lgOlo.js"),[])},{id:"sas",name:"SAS",import:()=>J(()=>import("./sas-BmTFh92c.js"),__vite__mapDeps([77,14]))},{id:"sass",name:"Sass",import:()=>J(()=>import("./sass-BJ4Li9vH.js"),[])},{id:"scala",name:"Scala",import:()=>J(()=>import("./scala-DQVVAn-B.js"),[])},{id:"scheme",name:"Scheme",import:()=>J(()=>import("./scheme-BJGe-b2p.js"),[])},{id:"scss",name:"SCSS",import:()=>J(()=>import("./scss-C31hgJw-.js"),__vite__mapDeps([5,3]))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>J(()=>import("./sdbl-BLhTXw86.js"),[])},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>J(()=>import("./shaderlab-B7qAK45m.js"),__vite__mapDeps([78,79]))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>J(()=>import("./shellscript-atvbtKCR.js"),[])},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>J(()=>import("./shellsession-C_rIy8kc.js"),__vite__mapDeps([80,26]))},{id:"smalltalk",name:"Smalltalk",import:()=>J(()=>import("./smalltalk-DkLiglaE.js"),[])},{id:"solidity",name:"Solidity",import:()=>J(()=>import("./solidity-C1w2a3ep.js"),[])},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>J(()=>import("./soy-C-lX7w71.js"),__vite__mapDeps([81,1,2,3]))},{id:"sparql",name:"SPARQL",import:()=>J(()=>import("./sparql-bYkjHRlG.js"),__vite__mapDeps([82,83]))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>J(()=>import("./splunk-Cf8iN4DR.js"),[])},{id:"sql",name:"SQL",import:()=>J(()=>import("./sql-COK4E0Yg.js"),[])},{id:"ssh-config",name:"SSH Config",import:()=>J(()=>import("./ssh-config-BknIz3MU.js"),[])},{id:"stata",name:"Stata",import:()=>J(()=>import("./stata-DorPZHa4.js"),__vite__mapDeps([84,14]))},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>J(()=>import("./stylus-BeQkCIfX.js"),[])},{id:"svelte",name:"Svelte",import:()=>J(()=>import("./svelte-MSaWC3Je.js"),__vite__mapDeps([85,2,11,3,12]))},{id:"swift",name:"Swift",import:()=>J(()=>import("./swift-BSxZ-RaX.js"),[])},{id:"system-verilog",name:"SystemVerilog",import:()=>J(()=>import("./system-verilog-C7L56vO4.js"),[])},{id:"systemd",name:"Systemd Units",import:()=>J(()=>import("./systemd-CUnW07Te.js"),[])},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>J(()=>import("./talonscript-C1XDQQGZ.js"),[])},{id:"tasl",name:"Tasl",import:()=>J(()=>import("./tasl-CQjiPCtT.js"),[])},{id:"tcl",name:"Tcl",import:()=>J(()=>import("./tcl-DQ1-QYvQ.js"),[])},{id:"templ",name:"Templ",import:()=>J(()=>import("./templ-dwX3ZSMB.js"),__vite__mapDeps([86,87,2,3]))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>J(()=>import("./terraform-BbSNqyBO.js"),[])},{id:"tex",name:"TeX",import:()=>J(()=>import("./tex-rYs2v40G.js"),__vite__mapDeps([62,60]))},{id:"toml",name:"TOML",import:()=>J(()=>import("./toml-CB2ApiWb.js"),[])},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>J(()=>import("./ts-tags-CipyTH0X.js"),__vite__mapDeps([88,11,3,2,23,24,1,14,7,8]))},{id:"tsv",name:"TSV",import:()=>J(()=>import("./tsv-B_m7g4N7.js"),[])},{id:"tsx",name:"TSX",import:()=>J(()=>import("./tsx-B6W0miNI.js"),[])},{id:"turtle",name:"Turtle",import:()=>J(()=>import("./turtle-BMR_PYu6.js"),[])},{id:"twig",name:"Twig",import:()=>J(()=>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:()=>J(()=>import("./typescript-Dj6nwHGl.js"),[])},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>J(()=>import("./typespec-BpWG_bgh.js"),[])},{id:"typst",name:"Typst",aliases:["typ"],import:()=>J(()=>import("./typst-BVUVsWT6.js"),[])},{id:"v",name:"V",import:()=>J(()=>import("./v-CAQ2eGtk.js"),[])},{id:"vala",name:"Vala",import:()=>J(()=>import("./vala-BFOHcciG.js"),[])},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:()=>J(()=>import("./vb-CdO5JTpU.js"),[])},{id:"verilog",name:"Verilog",import:()=>J(()=>import("./verilog-CJaU5se_.js"),[])},{id:"vhdl",name:"VHDL",import:()=>J(()=>import("./vhdl-DYoNaHQp.js"),[])},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>J(()=>import("./viml-m4uW47V2.js"),[])},{id:"vue",name:"Vue",import:()=>J(()=>import("./vue-BuYVFjOK.js"),__vite__mapDeps([90,1,2,3,11,9,28]))},{id:"vue-html",name:"Vue HTML",import:()=>J(()=>import("./vue-html-xdeiXROB.js"),__vite__mapDeps([91,90,1,2,3,11,9,28]))},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>J(()=>import("./vyper-nyqBNV6O.js"),[])},{id:"wasm",name:"WebAssembly",import:()=>J(()=>import("./wasm-C6j12Q_x.js"),[])},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:()=>J(()=>import("./wenyan-7A4Fjokl.js"),[])},{id:"wgsl",name:"WGSL",import:()=>J(()=>import("./wgsl-CB0Krxn9.js"),[])},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>J(()=>import("./wikitext-DCE3LsBG.js"),[])},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>J(()=>import("./wolfram-C3FkfJm5.js"),[])},{id:"xml",name:"XML",import:()=>J(()=>import("./xml-e3z08dGr.js"),__vite__mapDeps([7,8]))},{id:"xsl",name:"XSL",import:()=>J(()=>import("./xsl-Dd0NUgwM.js"),__vite__mapDeps([92,7,8]))},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>J(()=>import("./yaml-CVw76BM1.js"),[])},{id:"zenscript",name:"ZenScript",import:()=>J(()=>import("./zenscript-HnGAYVZD.js"),[])},{id:"zig",name:"Zig",import:()=>J(()=>import("./zig-BVz_zdnA.js"),[])}],Eve=Object.fromEntries(tG.map(e=>[e.id,e.import])),Ave=Object.fromEntries(tG.flatMap(e=>{var t;return((t=e.aliases)==null?void 0:t.map(n=>[n,e.import]))||[]})),Mve={...Eve,...Ave},Nve=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>J(()=>import("./andromeeda-C3khCPGq.js"),[])},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>J(()=>import("./aurora-x-D-2ljcwZ.js"),[])},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>J(()=>import("./ayu-dark-Cv9koXgw.js"),[])},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>J(()=>import("./catppuccin-frappe-CD_QflpE.js"),[])},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>J(()=>import("./catppuccin-latte-DRW-0cLl.js"),[])},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>J(()=>import("./catppuccin-macchiato-C-_shW-Y.js"),[])},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>J(()=>import("./catppuccin-mocha-LGGdnPYs.js"),[])},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>J(()=>import("./dark-plus-C3mMm8J8.js"),[])},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>J(()=>import("./dracula-BzJJZx-M.js"),[])},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>J(()=>import("./dracula-soft-BXkSAIEj.js"),[])},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>J(()=>import("./everforest-dark-BgDCqdQA.js"),[])},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>J(()=>import("./everforest-light-C8M2exoo.js"),[])},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>J(()=>import("./github-dark-DHJKELXO.js"),[])},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>J(()=>import("./github-dark-default-Cuk6v7N8.js"),[])},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>J(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[])},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>J(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[])},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>J(()=>import("./github-light-DAi9KRSo.js"),[])},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>J(()=>import("./github-light-default-D7oLnXFd.js"),[])},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>J(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[])},{id:"houston",displayName:"Houston",type:"dark",import:()=>J(()=>import("./houston-DnULxvSX.js"),[])},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>J(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[])},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>J(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[])},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>J(()=>import("./kanagawa-wave-DWedfzmr.js"),[])},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>J(()=>import("./laserwave-DUszq2jm.js"),[])},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>J(()=>import("./light-plus-B7mTdjB0.js"),[])},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>J(()=>import("./material-theme-D5KoaKCx.js"),[])},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>J(()=>import("./material-theme-darker-BfHTSMKl.js"),[])},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>J(()=>import("./material-theme-lighter-B0m2ddpp.js"),[])},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>J(()=>import("./material-theme-ocean-CyktbL80.js"),[])},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>J(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[])},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>J(()=>import("./min-dark-CafNBF8u.js"),[])},{id:"min-light",displayName:"Min Light",type:"light",import:()=>J(()=>import("./min-light-CTRr51gU.js"),[])},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>J(()=>import("./monokai-D4h5O-jR.js"),[])},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>J(()=>import("./night-owl-C39BiMTA.js"),[])},{id:"nord",displayName:"Nord",type:"dark",import:()=>J(()=>import("./nord-Ddv68eIx.js"),[])},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>J(()=>import("./one-dark-pro-GBQ2dnAY.js"),[])},{id:"one-light",displayName:"One Light",type:"light",import:()=>J(()=>import("./one-light-PoHY5YXO.js"),[])},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>J(()=>import("./plastic-3e1v2bzS.js"),[])},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>J(()=>import("./poimandres-CS3Unz2-.js"),[])},{id:"red",displayName:"Red",type:"dark",import:()=>J(()=>import("./red-bN70gL4F.js"),[])},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>J(()=>import("./rose-pine-CmCqftbK.js"),[])},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>J(()=>import("./rose-pine-dawn-Ds-gbosJ.js"),[])},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>J(()=>import("./rose-pine-moon-CjDtw9vr.js"),[])},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>J(()=>import("./slack-dark-BthQWCQV.js"),[])},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>J(()=>import("./slack-ochin-DqwNpetd.js"),[])},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>J(()=>import("./snazzy-light-Bw305WKR.js"),[])},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>J(()=>import("./solarized-dark-DXbdFlpD.js"),[])},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>J(()=>import("./solarized-light-L9t79GZl.js"),[])},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>J(()=>import("./synthwave-84-CbfX1IO0.js"),[])},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>J(()=>import("./tokyo-night-DBQeEorK.js"),[])},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>J(()=>import("./vesper-BEBZ7ncR.js"),[])},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>J(()=>import("./vitesse-black-Bkuqu6BP.js"),[])},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>J(()=>import("./vitesse-dark-D0r3Knsf.js"),[])},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>J(()=>import("./vitesse-light-CVO1_9PV.js"),[])}],Ive=Object.fromEntries(Nve.map(e=>[e.id,e.import]));let Au=class extends Error{constructor(t){super(t),this.name="ShikiError"}},IA=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function Rve(){return 2147483648}function jve(){return typeof performance<"u"?performance.now():Date.now()}const Lve=(e,t)=>e+(t-e%t)%t;async function Dve(e){let t,n;const s={};function r(p){n=p,s.HEAPU8=new Uint8Array(p),s.HEAPU32=new Uint32Array(p)}function i(p,g,y){s.HEAPU8.copyWithin(p,g,g+y)}function o(p){try{return t.grow(p-n.byteLength+65535>>>16),r(t.buffer),1}catch{}}function a(p){const g=s.HEAPU8.length;p=p>>>0;const y=Rve();if(p>y)return!1;for(let w=1;w<=4;w*=2){let v=g*(1+.2/w);v=Math.min(v,p+100663296);const b=Math.min(y,Lve(Math.max(p,v),65536));if(o(b))return!0}return!1}const l=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function c(p,g,y=1024){const w=g+y;let v=g;for(;p[v]&&!(v>=w);)++v;if(v-g>16&&p.buffer&&l)return l.decode(p.subarray(g,v));let b="";for(;g<v;){let x=p[g++];if(!(x&128)){b+=String.fromCharCode(x);continue}const k=p[g++]&63;if((x&224)===192){b+=String.fromCharCode((x&31)<<6|k);continue}const T=p[g++]&63;if((x&240)===224?x=(x&15)<<12|k<<6|T:x=(x&7)<<18|k<<12|T<<6|p[g++]&63,x<65536)b+=String.fromCharCode(x);else{const C=x-65536;b+=String.fromCharCode(55296|C>>10,56320|C&1023)}}return b}function d(p,g){return p?c(s.HEAPU8,p,g):""}const h={emscripten_get_now:jve,emscripten_memcpy_big:i,emscripten_resize_heap:a,fd_write:()=>0};async function f(){const g=await e({env:h,wasi_snapshot_preview1:h});t=g.memory,r(t.buffer),Object.assign(s,g),s.UTF8ToString=d}return await f(),s}var Ove=Object.defineProperty,Pve=(e,t,n)=>t in e?Ove(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ki=(e,t,n)=>(Pve(e,typeof t!="symbol"?t+"":t,n),n);let Pi=null;function Bve(e){throw new IA(e.UTF8ToString(e.getLastOnigError()))}class $_{constructor(t){ki(this,"utf16Length"),ki(this,"utf8Length"),ki(this,"utf16Value"),ki(this,"utf8Value"),ki(this,"utf16OffsetToUtf8"),ki(this,"utf8OffsetToUtf16");const n=t.length,s=$_._utf8ByteLength(t),r=s!==n,i=r?new Uint32Array(n+1):null;r&&(i[n]=s);const o=r?new Uint32Array(s+1):null;r&&(o[s]=n);const a=new Uint8Array(s);let l=0;for(let c=0;c<n;c++){const d=t.charCodeAt(c);let h=d,f=!1;if(d>=55296&&d<=56319&&c+1<n){const p=t.charCodeAt(c+1);p>=56320&&p<=57343&&(h=(d-55296<<10)+65536|p-56320,f=!0)}r&&(i[c]=l,f&&(i[c+1]=l),h<=127?o[l+0]=c:h<=2047?(o[l+0]=c,o[l+1]=c):h<=65535?(o[l+0]=c,o[l+1]=c,o[l+2]=c):(o[l+0]=c,o[l+1]=c,o[l+2]=c,o[l+3]=c)),h<=127?a[l++]=h:h<=2047?(a[l++]=192|(h&1984)>>>6,a[l++]=128|(h&63)>>>0):h<=65535?(a[l++]=224|(h&61440)>>>12,a[l++]=128|(h&4032)>>>6,a[l++]=128|(h&63)>>>0):(a[l++]=240|(h&1835008)>>>18,a[l++]=128|(h&258048)>>>12,a[l++]=128|(h&4032)>>>6,a[l++]=128|(h&63)>>>0),f&&c++}this.utf16Length=n,this.utf8Length=s,this.utf16Value=t,this.utf8Value=a,this.utf16OffsetToUtf8=i,this.utf8OffsetToUtf16=o}static _utf8ByteLength(t){let n=0;for(let s=0,r=t.length;s<r;s++){const i=t.charCodeAt(s);let o=i,a=!1;if(i>=55296&&i<=56319&&s+1<r){const l=t.charCodeAt(s+1);l>=56320&&l<=57343&&(o=(i-55296<<10)+65536|l-56320,a=!0)}o<=127?n+=1:o<=2047?n+=2:o<=65535?n+=3:n+=4,a&&s++}return n}createString(t){const n=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,n),n}}const oc=class{constructor(e){if(ki(this,"id",++oc.LAST_ID),ki(this,"_onigBinding"),ki(this,"content"),ki(this,"utf16Length"),ki(this,"utf8Length"),ki(this,"utf16OffsetToUtf8"),ki(this,"utf8OffsetToUtf16"),ki(this,"ptr"),!Pi)throw new IA("Must invoke loadWasm first.");this._onigBinding=Pi,this.content=e;const t=new $_(e);this.utf16Length=t.utf16Length,this.utf8Length=t.utf8Length,this.utf16OffsetToUtf8=t.utf16OffsetToUtf8,this.utf8OffsetToUtf16=t.utf8OffsetToUtf16,this.utf8Length<1e4&&!oc._sharedPtrInUse?(oc._sharedPtr||(oc._sharedPtr=Pi.omalloc(1e4)),oc._sharedPtrInUse=!0,Pi.HEAPU8.set(t.utf8Value,oc._sharedPtr),this.ptr=oc._sharedPtr):this.ptr=t.createString(Pi)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===oc._sharedPtr?oc._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};let Cb=oc;ki(Cb,"LAST_ID",0);ki(Cb,"_sharedPtr",0);ki(Cb,"_sharedPtrInUse",!1);class $ve{constructor(t){if(ki(this,"_onigBinding"),ki(this,"_ptr"),!Pi)throw new IA("Must invoke loadWasm first.");const n=[],s=[];for(let a=0,l=t.length;a<l;a++){const c=new $_(t[a]);n[a]=c.createString(Pi),s[a]=c.utf8Length}const r=Pi.omalloc(4*t.length);Pi.HEAPU32.set(n,r/4);const i=Pi.omalloc(4*t.length);Pi.HEAPU32.set(s,i/4);const o=Pi.createOnigScanner(r,i,t.length);for(let a=0,l=t.length;a<l;a++)Pi.ofree(n[a]);Pi.ofree(i),Pi.ofree(r),o===0&&Bve(Pi),this._onigBinding=Pi,this._ptr=o}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(t,n,s){let r=0;if(typeof s=="number"&&(r=s),typeof t=="string"){t=new Cb(t);const i=this._findNextMatchSync(t,n,!1,r);return t.dispose(),i}return this._findNextMatchSync(t,n,!1,r)}_findNextMatchSync(t,n,s,r){const i=this._onigBinding,o=i.findNextOnigScannerMatch(this._ptr,t.id,t.ptr,t.utf8Length,t.convertUtf16OffsetToUtf8(n),r);if(o===0)return null;const a=i.HEAPU32;let l=o/4;const c=a[l++],d=a[l++],h=[];for(let f=0;f<d;f++){const p=t.convertUtf8OffsetToUtf16(a[l++]),g=t.convertUtf8OffsetToUtf16(a[l++]);h[f]={start:p,end:g,length:g-p}}return{index:c,captureIndices:h}}}function zve(e){return typeof e.instantiator=="function"}function Fve(e){return typeof e.default=="function"}function qve(e){return typeof e.data<"u"}function Hve(e){return typeof Response<"u"&&e instanceof Response}function Uve(e){var t;return typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<"u"&&((t=Buffer.isBuffer)==null?void 0:t.call(Buffer,e))||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&e instanceof Uint32Array}let Xv;function Vve(e){if(Xv)return Xv;async function t(){Pi=await Dve(async n=>{let s=e;return s=await s,typeof s=="function"&&(s=await s(n)),typeof s=="function"&&(s=await s(n)),zve(s)?s=await s.instantiator(n):Fve(s)?s=await s.default(n):(qve(s)&&(s=s.data),Hve(s)?typeof WebAssembly.instantiateStreaming=="function"?s=await Wve(s)(n):s=await Gve(s)(n):Uve(s)?s=await e5(s)(n):s instanceof WebAssembly.Module?s=await e5(s)(n):"default"in s&&s.default instanceof WebAssembly.Module&&(s=await e5(s.default)(n))),"instance"in s&&(s=s.instance),"exports"in s&&(s=s.exports),s})}return Xv=t(),Xv}function e5(e){return t=>WebAssembly.instantiate(e,t)}function Wve(e){return t=>WebAssembly.instantiateStreaming(e,t)}function Gve(e){return async t=>{const n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}let Kve;function Yve(){return Kve}async function nG(e){return e&&await Vve(e),{createScanner(t){return new $ve(t.map(n=>typeof n=="string"?n:n.source))},createString(t){return new Cb(t)}}}function Xve(e){return RA(e)}function RA(e){return Array.isArray(e)?Qve(e):e instanceof RegExp?e:typeof e=="object"?Jve(e):e}function Qve(e){let t=[];for(let n=0,s=e.length;n<s;n++)t[n]=RA(e[n]);return t}function Jve(e){let t={};for(let n in e)t[n]=RA(e[n]);return t}function sG(e,...t){return t.forEach(n=>{for(let s in n)e[s]=n[s]}),e}function rG(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?rG(e.substring(0,e.length-1)):e.substr(~t+1)}var t5=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Qv=class{static hasCaptures(e){return e===null?!1:(t5.lastIndex=0,t5.test(e))}static replaceCaptures(e,t,n){return e.replace(t5,(s,r,i,o)=>{let a=n[parseInt(r||i,10)];if(a){let l=t.substring(a.start,a.end);for(;l[0]===".";)l=l.substring(1);switch(o){case"downcase":return l.toLowerCase();case"upcase":return l.toUpperCase();default:return l}}else return s})}};function iG(e,t){return e<t?-1:e>t?1:0}function oG(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,s=t.length;if(n===s){for(let r=0;r<n;r++){let i=iG(e[r],t[r]);if(i!==0)return i}return 0}return n-s}function bD(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function aG(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var lG=class{constructor(e){Me(this,"cache",new Map);this.fn=e}get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.fn(e);return this.cache.set(e,t),t}},$k=class{constructor(e,t,n){Me(this,"_cachedMatchRoot",new lG(e=>this._root.match(e)));this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(twe(e),t)}static createFromParsedTheme(e,t){return swe(e,t)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const t=e.scopeName,s=this._cachedMatchRoot.get(t).find(r=>Zve(e.parent,r.parentScopes));return s?new cG(s.fontStyle,s.foreground,s.background):null}},n5=class wx{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const s of n)t=new wx(t,s);return t}static from(...t){let n=null;for(let s=0;s<t.length;s++)n=new wx(n,t[s]);return n}push(t){return new wx(this,t)}getSegments(){let t=this;const n=[];for(;t;)n.push(t.scopeName),t=t.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(t){return this===t?!0:this.parent===null?!1:this.parent.extends(t)}getExtensionIfDefined(t){const n=[];let s=this;for(;s&&s!==t;)n.push(s.scopeName),s=s.parent;return s===t?n.reverse():void 0}};function Zve(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let s=t[n],r=!1;if(s===">"){if(n===t.length-1)return!1;s=t[++n],r=!0}for(;e&&!ewe(e.scopeName,s);){if(r)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function ewe(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var cG=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function twe(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],s=0;for(let r=0,i=t.length;r<i;r++){let o=t[r];if(!o.settings)continue;let a;if(typeof o.scope=="string"){let h=o.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),a=h.split(",")}else Array.isArray(o.scope)?a=o.scope:a=[""];let l=-1;if(typeof o.settings.fontStyle=="string"){l=0;let h=o.settings.fontStyle.split(" ");for(let f=0,p=h.length;f<p;f++)switch(h[f]){case"italic":l=l|1;break;case"bold":l=l|2;break;case"underline":l=l|4;break;case"strikethrough":l=l|8;break}}let c=null;typeof o.settings.foreground=="string"&&bD(o.settings.foreground)&&(c=o.settings.foreground);let d=null;typeof o.settings.background=="string"&&bD(o.settings.background)&&(d=o.settings.background);for(let h=0,f=a.length;h<f;h++){let g=a[h].trim().split(" "),y=g[g.length-1],w=null;g.length>1&&(w=g.slice(0,g.length-1),w.reverse()),n[s++]=new nwe(y,w,r,l,c,d)}}return n}var nwe=class{constructor(e,t,n,s,r,i){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=s,this.foreground=r,this.background=i}},xu=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(xu||{});function swe(e,t){e.sort((l,c)=>{let d=iG(l.scope,c.scope);return d!==0||(d=oG(l.parentScopes,c.parentScopes),d!==0)?d:l.index-c.index});let n=0,s="#000000",r="#ffffff";for(;e.length>=1&&e[0].scope==="";){let l=e.shift();l.fontStyle!==-1&&(n=l.fontStyle),l.foreground!==null&&(s=l.foreground),l.background!==null&&(r=l.background)}let i=new rwe(t),o=new cG(n,i.getId(s),i.getId(r)),a=new owe(new RT(0,null,-1,0,0),[]);for(let l=0,c=e.length;l<c;l++){let d=e[l];a.insert(0,d.scope,d.parentScopes,d.fontStyle,i.getId(d.foreground),i.getId(d.background))}return new $k(i,o,a)}var rwe=class{constructor(e){Me(this,"_isFrozen");Me(this,"_lastColorId");Me(this,"_id2color");Me(this,"_color2id");if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},iwe=Object.freeze([]),RT=class uG{constructor(t,n,s,r,i){Me(this,"scopeDepth");Me(this,"parentScopes");Me(this,"fontStyle");Me(this,"foreground");Me(this,"background");this.scopeDepth=t,this.parentScopes=n||iwe,this.fontStyle=s,this.foreground=r,this.background=i}clone(){return new uG(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let n=[];for(let s=0,r=t.length;s<r;s++)n[s]=t[s].clone();return n}acceptOverwrite(t,n,s,r){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,n!==-1&&(this.fontStyle=n),s!==0&&(this.foreground=s),r!==0&&(this.background=r)}},owe=class jT{constructor(t,n=[],s={}){Me(this,"_rulesWithParentScopes");this._mainRule=t,this._children=s,this._rulesWithParentScopes=n}static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let s=0,r=0;for(;t.parentScopes[s]===">"&&s++,n.parentScopes[r]===">"&&r++,!(s>=t.parentScopes.length||r>=n.parentScopes.length);){const i=n.parentScopes[r].length-t.parentScopes[s].length;if(i!==0)return i;s++,r++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let s=t.indexOf("."),r,i;if(s===-1?(r=t,i=""):(r=t.substring(0,s),i=t.substring(s+1)),this._children.hasOwnProperty(r))return this._children[r].match(i)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(jT._cmpBySpecificity),n}insert(t,n,s,r,i,o){if(n===""){this._doInsertHere(t,s,r,i,o);return}let a=n.indexOf("."),l,c;a===-1?(l=n,c=""):(l=n.substring(0,a),c=n.substring(a+1));let d;this._children.hasOwnProperty(l)?d=this._children[l]:(d=new jT(this._mainRule.clone(),RT.cloneArr(this._rulesWithParentScopes)),this._children[l]=d),d.insert(t+1,c,s,r,i,o)}_doInsertHere(t,n,s,r,i){if(n===null){this._mainRule.acceptOverwrite(t,s,r,i);return}for(let o=0,a=this._rulesWithParentScopes.length;o<a;o++){let l=this._rulesWithParentScopes[o];if(oG(l.parentScopes,n)===0){l.acceptOverwrite(t,s,r,i);return}}s===-1&&(s=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new RT(t,n,s,r,i))}},k0=class el{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=el.getLanguageId(t),s=el.getTokenType(t),r=el.getFontStyle(t),i=el.getForeground(t),o=el.getBackground(t);console.log({languageId:n,tokenType:s,fontStyle:r,foreground:i,background:o})}static getLanguageId(t){return(t&255)>>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,n,s,r,i,o,a){let l=el.getLanguageId(t),c=el.getTokenType(t),d=el.containsBalancedBrackets(t)?1:0,h=el.getFontStyle(t),f=el.getForeground(t),p=el.getBackground(t);return n!==0&&(l=n),s!==8&&(c=s),r!==null&&(d=r?1:0),i!==-1&&(h=i),o!==0&&(f=o),a!==0&&(p=a),(l<<0|c<<8|d<<10|h<<11|f<<15|p<<24)>>>0}};function zk(e,t){const n=[],s=awe(e);let r=s.next();for(;r!==null;){let l=0;if(r.length===2&&r.charAt(1)===":"){switch(r.charAt(0)){case"R":l=1;break;case"L":l=-1;break;default:console.log(`Unknown priority ${r} in scope selector`)}r=s.next()}let c=o();if(n.push({matcher:c,priority:l}),r!==",")break;r=s.next()}return n;function i(){if(r==="-"){r=s.next();const l=i();return c=>!!l&&!l(c)}if(r==="("){r=s.next();const l=a();return r===")"&&(r=s.next()),l}if(vD(r)){const l=[];do l.push(r),r=s.next();while(vD(r));return c=>t(l,c)}return null}function o(){const l=[];let c=i();for(;c;)l.push(c),c=i();return d=>l.every(h=>h(d))}function a(){const l=[];let c=o();for(;c&&(l.push(c),r==="|"||r===",");){do r=s.next();while(r==="|"||r===",");c=o()}return d=>l.some(h=>h(d))}}function vD(e){return!!e&&!!e.match(/[\w\.:]+/)}function awe(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const s=n[0];return n=t.exec(e),s}}}function dG(e){typeof e.dispose=="function"&&e.dispose()}var Sy=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},lwe=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},cwe=class{constructor(){Me(this,"_references",[]);Me(this,"_seenReferenceKeys",new Set);Me(this,"visitedRule",new Set)}get references(){return this._references}add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},uwe=class{constructor(e,t){Me(this,"seenFullScopeRequests",new Set);Me(this,"seenPartialScopeRequests",new Set);Me(this,"Q");this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Sy(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new cwe;for(const n of e)dwe(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof Sy){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 dwe(e,t,n,s){const r=n.lookup(e.scopeName);if(!r){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const i=n.lookup(t);e instanceof Sy?xx({baseGrammar:i,selfGrammar:r},s):LT(e.ruleName,{baseGrammar:i,selfGrammar:r,repository:r.repository},s);const o=n.injections(e.scopeName);if(o)for(const a of o)s.add(new Sy(a))}function LT(e,t,n){if(t.repository&&t.repository[e]){const s=t.repository[e];Fk([s],t,n)}}function xx(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&Fk(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&Fk(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function Fk(e,t,n){for(const s of e){if(n.visitedRule.has(s))continue;n.visitedRule.add(s);const r=s.repository?sG({},t.repository,s.repository):t.repository;Array.isArray(s.patterns)&&Fk(s.patterns,{...t,repository:r},n);const i=s.include;if(!i)continue;const o=hG(i);switch(o.kind){case 0:xx({...t,selfGrammar:t.baseGrammar},n);break;case 1:xx(t,n);break;case 2:LT(o.ruleName,{...t,repository:r},n);break;case 3:case 4:const a=o.scopeName===t.selfGrammar.scopeName?t.selfGrammar:o.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(a){const l={baseGrammar:t.baseGrammar,selfGrammar:a,repository:r};o.kind===4?LT(o.ruleName,l,n):xx(l,n)}else o.kind===4?n.add(new lwe(o.scopeName,o.ruleName)):n.add(new Sy(o.scopeName));break}}}var hwe=class{constructor(){Me(this,"kind",0)}},fwe=class{constructor(){Me(this,"kind",1)}},mwe=class{constructor(e){Me(this,"kind",2);this.ruleName=e}},pwe=class{constructor(e){Me(this,"kind",3);this.scopeName=e}},gwe=class{constructor(e,t){Me(this,"kind",4);this.scopeName=e,this.ruleName=t}};function hG(e){if(e==="$base")return new hwe;if(e==="$self")return new fwe;const t=e.indexOf("#");if(t===-1)return new pwe(e);if(t===0)return new mwe(e.substring(1));{const n=e.substring(0,t),s=e.substring(t+1);return new gwe(n,s)}}var ywe=/\\(\d+)/,wD=/\\(\d+)/g,bwe=-1,fG=-2;var Tb=class{constructor(t,n,s,r){Me(this,"$location");Me(this,"id");Me(this,"_nameIsCapturing");Me(this,"_name");Me(this,"_contentNameIsCapturing");Me(this,"_contentName");this.$location=t,this.id=n,this._name=s||null,this._nameIsCapturing=Qv.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=Qv.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${rG(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${t}`}getName(t,n){return!this._nameIsCapturing||this._name===null||t===null||n===null?this._name:Qv.replaceCaptures(this._name,t,n)}getContentName(t,n){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Qv.replaceCaptures(this._contentName,t,n)}},vwe=class extends Tb{constructor(t,n,s,r,i){super(t,n,s,r);Me(this,"retokenizeCapturedWithRuleId");this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(t,n){throw new Error("Not supported!")}compile(t,n){throw new Error("Not supported!")}compileAG(t,n,s,r){throw new Error("Not supported!")}},wwe=class extends Tb{constructor(t,n,s,r,i){super(t,n,s,null);Me(this,"_match");Me(this,"captures");Me(this,"_cachedCompiledPatterns");this._match=new Cy(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,n){n.push(this._match)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,s,r){return this._getCachedCompiledPatterns(t).compileAG(t,s,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Ty,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},xD=class extends Tb{constructor(t,n,s,r,i){super(t,n,s,r);Me(this,"hasMissingPatterns");Me(this,"patterns");Me(this,"_cachedCompiledPatterns");this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,n){for(const s of this.patterns)t.getRule(s).collectPatterns(t,n)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,s,r){return this._getCachedCompiledPatterns(t).compileAG(t,s,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Ty,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},DT=class extends Tb{constructor(t,n,s,r,i,o,a,l,c,d){super(t,n,s,r);Me(this,"_begin");Me(this,"beginCaptures");Me(this,"_end");Me(this,"endHasBackReferences");Me(this,"endCaptures");Me(this,"applyEndPatternLast");Me(this,"hasMissingPatterns");Me(this,"patterns");Me(this,"_cachedCompiledPatterns");this._begin=new Cy(i,this.id),this.beginCaptures=o,this._end=new Cy(a||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=l,this.applyEndPatternLast=c||!1,this.patterns=d.patterns,this.hasMissingPatterns=d.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,n){return this._end.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t,n).compile(t)}compileAG(t,n,s,r){return this._getCachedCompiledPatterns(t,n).compileAG(t,s,r)}_getCachedCompiledPatterns(t,n){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Ty;for(const s of this.patterns)t.getRule(s).collectPatterns(t,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,n):this._cachedCompiledPatterns.setSource(0,n)),this._cachedCompiledPatterns}},qk=class extends Tb{constructor(t,n,s,r,i,o,a,l,c){super(t,n,s,r);Me(this,"_begin");Me(this,"beginCaptures");Me(this,"whileCaptures");Me(this,"_while");Me(this,"whileHasBackReferences");Me(this,"hasMissingPatterns");Me(this,"patterns");Me(this,"_cachedCompiledPatterns");Me(this,"_cachedCompiledWhilePatterns");this._begin=new Cy(i,this.id),this.beginCaptures=o,this.whileCaptures=l,this._while=new Cy(a,fG),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,n){return this._while.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,s,r){return this._getCachedCompiledPatterns(t).compileAG(t,s,r)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Ty;for(const n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,n){return this._getCachedCompiledWhilePatterns(t,n).compile(t)}compileWhileAG(t,n,s,r){return this._getCachedCompiledWhilePatterns(t,n).compileAG(t,s,r)}_getCachedCompiledWhilePatterns(t,n){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Ty,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,n||""),this._cachedCompiledWhilePatterns}},mG=class ho{static createCaptureRule(t,n,s,r,i){return t.registerRule(o=>new vwe(n,o,s,r,i))}static getCompiledRuleId(t,n,s){return t.id||n.registerRule(r=>{if(t.id=r,t.match)return new wwe(t.$vscodeTextmateLocation,t.id,t.name,t.match,ho._compileCaptures(t.captures,n,s));if(typeof t.begin>"u"){t.repository&&(s=sG({},s,t.repository));let i=t.patterns;return typeof i>"u"&&t.include&&(i=[{include:t.include}]),new xD(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,ho._compilePatterns(i,n,s))}return t.while?new qk(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,ho._compileCaptures(t.beginCaptures||t.captures,n,s),t.while,ho._compileCaptures(t.whileCaptures||t.captures,n,s),ho._compilePatterns(t.patterns,n,s)):new DT(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,ho._compileCaptures(t.beginCaptures||t.captures,n,s),t.end,ho._compileCaptures(t.endCaptures||t.captures,n,s),t.applyEndPatternLast,ho._compilePatterns(t.patterns,n,s))}),t.id}static _compileCaptures(t,n,s){let r=[];if(t){let i=0;for(const o in t){if(o==="$vscodeTextmateLocation")continue;const a=parseInt(o,10);a>i&&(i=a)}for(let o=0;o<=i;o++)r[o]=null;for(const o in t){if(o==="$vscodeTextmateLocation")continue;const a=parseInt(o,10);let l=0;t[o].patterns&&(l=ho.getCompiledRuleId(t[o],n,s)),r[a]=ho.createCaptureRule(n,t[o].$vscodeTextmateLocation,t[o].name,t[o].contentName,l)}}return r}static _compilePatterns(t,n,s){let r=[];if(t)for(let i=0,o=t.length;i<o;i++){const a=t[i];let l=-1;if(a.include){const c=hG(a.include);switch(c.kind){case 0:case 1:l=ho.getCompiledRuleId(s[a.include],n,s);break;case 2:let d=s[c.ruleName];d&&(l=ho.getCompiledRuleId(d,n,s));break;case 3:case 4:const h=c.scopeName,f=c.kind===4?c.ruleName:null,p=n.getExternalGrammar(h,s);if(p)if(f){let g=p.repository[f];g&&(l=ho.getCompiledRuleId(g,n,p.repository))}else l=ho.getCompiledRuleId(p.repository.$self,n,p.repository);break}}else l=ho.getCompiledRuleId(a,n,s);if(l!==-1){const c=n.getRule(l);let d=!1;if((c instanceof xD||c instanceof DT||c instanceof qk)&&c.hasMissingPatterns&&c.patterns.length===0&&(d=!0),d)continue;r.push(l)}}return{patterns:r,hasMissingPatterns:(t?t.length:0)!==r.length}}},Cy=class pG{constructor(t,n){Me(this,"source");Me(this,"ruleId");Me(this,"hasAnchor");Me(this,"hasBackReferences");Me(this,"_anchorCache");if(t&&typeof t=="string"){const s=t.length;let r=0,i=[],o=!1;for(let a=0;a<s;a++)if(t.charAt(a)==="\\"&&a+1<s){const c=t.charAt(a+1);c==="z"?(i.push(t.substring(r,a)),i.push("$(?!\\n)(?<!\\n)"),r=a+2):(c==="A"||c==="G")&&(o=!0),a++}this.hasAnchor=o,r===0?this.source=t:(i.push(t.substring(r,s)),this.source=i.join(""))}else this.hasAnchor=!1,this.source=t;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=ywe.test(this.source):this.hasBackReferences=!1}clone(){return new pG(this.source,this.ruleId)}setSource(t){this.source!==t&&(this.source=t,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(t,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let s=n.map(r=>t.substring(r.start,r.end));return wD.lastIndex=0,this.source.replace(wD,(r,i)=>aG(s[parseInt(i,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],n=[],s=[],r=[],i,o,a,l;for(i=0,o=this.source.length;i<o;i++)a=this.source.charAt(i),t[i]=a,n[i]=a,s[i]=a,r[i]=a,a==="\\"&&i+1<o&&(l=this.source.charAt(i+1),l==="A"?(t[i+1]="",n[i+1]="",s[i+1]="A",r[i+1]="A"):l==="G"?(t[i+1]="",n[i+1]="G",s[i+1]="",r[i+1]="G"):(t[i+1]=l,n[i+1]=l,s[i+1]=l,r[i+1]=l),i++);return{A0_G0:t.join(""),A0_G1:n.join(""),A1_G0:s.join(""),A1_G1:r.join("")}}resolveAnchors(t,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:t?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},Ty=class{constructor(){Me(this,"_items");Me(this,"_hasAnchors");Me(this,"_cached");Me(this,"_anchorCache");this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(n=>n.source);this._cached=new kD(e,t,this._items.map(n=>n.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let s=this._items.map(r=>r.resolveAnchors(t,n));return new kD(e,s,this._items.map(r=>r.ruleId))}},kD=class{constructor(e,t,n){Me(this,"scanner");this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push("   - "+this.rules[t]+": "+this.regExps[t]);return e.join(`
`)}findNextMatchSync(e,t,n){const s=this.scanner.findNextMatchSync(e,t,n);return s?{ruleId:this.rules[s.index],captureIndices:s.captureIndices}:null}},s5=class{constructor(e,t){this.languageId=e,this.tokenType=t}},gu,xwe=(gu=class{constructor(t,n){Me(this,"_defaultAttributes");Me(this,"_embeddedLanguagesMatcher");Me(this,"_getBasicScopeAttributes",new lG(t=>{const n=this._scopeToLanguage(t),s=this._toStandardTokenType(t);return new s5(n,s)}));this._defaultAttributes=new s5(t,8),this._embeddedLanguagesMatcher=new kwe(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?gu._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const n=t.match(gu.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!")}},Me(gu,"_NULL_SCOPE_METADATA",new s5(0,0)),Me(gu,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),gu),kwe=class{constructor(e){Me(this,"values");Me(this,"scopesRegExp");if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([n,s])=>aG(n));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;const t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}},_D=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function gG(e,t,n,s,r,i,o,a){const l=t.content.length;let c=!1,d=-1;if(o){const p=_we(e,t,n,s,r,i);r=p.stack,s=p.linePos,n=p.isFirstLine,d=p.anchorPosition}const h=Date.now();for(;!c;){if(a!==0&&Date.now()-h>a)return new _D(r,!0);f()}return new _D(r,!1);function f(){const p=Swe(e,t,n,s,r,d);if(!p){i.produce(r,l),c=!0;return}const g=p.captureIndices,y=p.matchedRuleId,w=g&&g.length>0?g[0].end>s:!1;if(y===bwe){const v=r.getRule(e);i.produce(r,g[0].start),r=r.withContentNameScopesList(r.nameScopesList),c1(e,t,n,r,i,v.endCaptures,g),i.produce(r,g[0].end);const b=r;if(r=r.parent,d=b.getAnchorPos(),!w&&b.getEnterPos()===s){r=b,i.produce(r,l),c=!0;return}}else{const v=e.getRule(y);i.produce(r,g[0].start);const b=r,x=v.getName(t.content,g),k=r.contentNameScopesList.pushAttributed(x,e);if(r=r.push(y,s,d,g[0].end===l,null,k,k),v instanceof DT){const T=v;c1(e,t,n,r,i,T.beginCaptures,g),i.produce(r,g[0].end),d=g[0].end;const C=T.getContentName(t.content,g),S=k.pushAttributed(C,e);if(r=r.withContentNameScopesList(S),T.endHasBackReferences&&(r=r.withEndRule(T.getEndWithResolvedBackReferences(t.content,g))),!w&&b.hasSameRuleAs(r)){r=r.pop(),i.produce(r,l),c=!0;return}}else if(v instanceof qk){const T=v;c1(e,t,n,r,i,T.beginCaptures,g),i.produce(r,g[0].end),d=g[0].end;const C=T.getContentName(t.content,g),S=k.pushAttributed(C,e);if(r=r.withContentNameScopesList(S),T.whileHasBackReferences&&(r=r.withEndRule(T.getWhileWithResolvedBackReferences(t.content,g))),!w&&b.hasSameRuleAs(r)){r=r.pop(),i.produce(r,l),c=!0;return}}else if(c1(e,t,n,r,i,v.captures,g),i.produce(r,g[0].end),r=r.pop(),!w){r=r.safePop(),i.produce(r,l),c=!0;return}}g[0].end>s&&(s=g[0].end,n=!1)}}function _we(e,t,n,s,r,i){let o=r.beginRuleCapturedEOL?0:-1;const a=[];for(let l=r;l;l=l.pop()){const c=l.getRule(e);c instanceof qk&&a.push({rule:c,stack:l})}for(let l=a.pop();l;l=a.pop()){const{ruleScanner:c,findOptions:d}=Ewe(l.rule,e,l.stack.endRule,n,s===o),h=c.findNextMatchSync(t,s,d);if(h){if(h.ruleId!==fG){r=l.stack.pop();break}h.captureIndices&&h.captureIndices.length&&(i.produce(l.stack,h.captureIndices[0].start),c1(e,t,n,l.stack,i,l.rule.whileCaptures,h.captureIndices),i.produce(l.stack,h.captureIndices[0].end),o=h.captureIndices[0].end,h.captureIndices[0].end>s&&(s=h.captureIndices[0].end,n=!1))}else{r=l.stack.pop();break}}return{stack:r,linePos:s,anchorPosition:o,isFirstLine:n}}function Swe(e,t,n,s,r,i){const o=Cwe(e,t,n,s,r,i),a=e.getInjections();if(a.length===0)return o;const l=Twe(a,e,t,n,s,r,i);if(!l)return o;if(!o)return l;const c=o.captureIndices[0].start,d=l.captureIndices[0].start;return d<c||l.priorityMatch&&d===c?l:o}function Cwe(e,t,n,s,r,i){const o=r.getRule(e),{ruleScanner:a,findOptions:l}=yG(o,e,r.endRule,n,s===i),c=a.findNextMatchSync(t,s,l);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function Twe(e,t,n,s,r,i,o){let a=Number.MAX_VALUE,l=null,c,d=0;const h=i.contentNameScopesList.getScopeNames();for(let f=0,p=e.length;f<p;f++){const g=e[f];if(!g.matcher(h))continue;const y=t.getRule(g.ruleId),{ruleScanner:w,findOptions:v}=yG(y,t,null,s,r===o),b=w.findNextMatchSync(n,r,v);if(!b)continue;const x=b.captureIndices[0].start;if(!(x>=a)&&(a=x,l=b.captureIndices,c=b.ruleId,d=g.priority,a===r))break}return l?{priorityMatch:d===-1,captureIndices:l,matchedRuleId:c}:null}function yG(e,t,n,s,r){return{ruleScanner:e.compileAG(t,n,s,r),findOptions:0}}function Ewe(e,t,n,s,r){return{ruleScanner:e.compileWhileAG(t,n,s,r),findOptions:0}}function c1(e,t,n,s,r,i,o){if(i.length===0)return;const a=t.content,l=Math.min(i.length,o.length),c=[],d=o[0].end;for(let h=0;h<l;h++){const f=i[h];if(f===null)continue;const p=o[h];if(p.length===0)continue;if(p.start>d)break;for(;c.length>0&&c[c.length-1].endPos<=p.start;)r.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop();if(c.length>0?r.produceFromScopes(c[c.length-1].scopes,p.start):r.produce(s,p.start),f.retokenizeCapturedWithRuleId){const y=f.getName(a,o),w=s.contentNameScopesList.pushAttributed(y,e),v=f.getContentName(a,o),b=w.pushAttributed(v,e),x=s.push(f.retokenizeCapturedWithRuleId,p.start,-1,!1,null,w,b),k=e.createOnigString(a.substring(0,p.end));gG(e,k,n&&p.start===0,p.start,x,r,!1,0),dG(k);continue}const g=f.getName(a,o);if(g!==null){const w=(c.length>0?c[c.length-1].scopes:s.contentNameScopesList).pushAttributed(g,e);c.push(new Awe(w,p.end))}}for(;c.length>0;)r.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var Awe=class{constructor(e,t){Me(this,"scopes");Me(this,"endPos");this.scopes=e,this.endPos=t}};function Mwe(e,t,n,s,r,i,o,a){return new Iwe(e,t,n,s,r,i,o,a)}function SD(e,t,n,s,r){const i=zk(t,Hk),o=mG.getCompiledRuleId(n,s,r.repository);for(const a of i)e.push({debugSelector:t,matcher:a.matcher,ruleId:o,grammar:r,priority:a.priority})}function Hk(e,t){if(t.length<e.length)return!1;let n=0;return e.every(s=>{for(let r=n;r<t.length;r++)if(Nwe(t[r],s))return n=r+1,!0;return!1})}function Nwe(e,t){if(!e)return!1;if(e===t)return!0;const n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]==="."}var Iwe=class{constructor(e,t,n,s,r,i,o,a){Me(this,"_rootId");Me(this,"_lastRuleId");Me(this,"_ruleId2desc");Me(this,"_includedGrammars");Me(this,"_grammarRepository");Me(this,"_grammar");Me(this,"_injections");Me(this,"_basicScopeAttributesProvider");Me(this,"_tokenTypeMatchers");if(this._rootScopeName=e,this.balancedBracketSelectors=i,this._onigLib=a,this._basicScopeAttributesProvider=new xwe(n,s),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=CD(t,null),this._injections=null,this._tokenTypeMatchers=[],r)for(const l of Object.keys(r)){const c=zk(l,Hk);for(const d of c)this._tokenTypeMatchers.push({matcher:d.matcher,type:r[l]})}}get themeProvider(){return this._grammarRepository}dispose(){for(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e={lookup:r=>r===this._rootScopeName?this._grammar:this.getExternalGrammar(r),injections:r=>this._grammarRepository.injections(r)},t=[],n=this._rootScopeName,s=e.lookup(n);if(s){const r=s.injections;if(r)for(let o in r)SD(t,o,r[o],this,s);const i=this._grammarRepository.injections(n);i&&i.forEach(o=>{const a=this.getExternalGrammar(o);if(a){const l=a.injectionSelector;l&&SD(t,l,a,this,a)}})}return t.sort((r,i)=>r.priority-i.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){const t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){const n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=CD(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){const s=this._tokenize(e,t,!1,n);return{tokens:s.lineTokens.getResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}tokenizeLine2(e,t,n=0){const s=this._tokenize(e,t,!0,n);return{tokens:s.lineTokens.getBinaryResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}_tokenize(e,t,n,s){this._rootId===-1&&(this._rootId=mG.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let r;if(!t||t===OT.NULL){r=!0;const c=this._basicScopeAttributesProvider.getDefaultAttributes(),d=this.themeProvider.getDefaults(),h=k0.set(0,c.languageId,c.tokenType,null,d.fontStyle,d.foregroundId,d.backgroundId),f=this.getRule(this._rootId).getName(null,null);let p;f?p=W1.createRootAndLookUpScopeName(f,h,this):p=W1.createRoot("unknown",h),t=new OT(null,this._rootId,-1,-1,!1,null,p,p)}else r=!1,t.reset();e=e+`
`;const i=this.createOnigString(e),o=i.content.length,a=new jwe(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=gG(this,i,r,0,t,a,!0,s);return dG(i),{lineLength:o,lineTokens:a,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function CD(e,t){return e=Xve(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var W1=class ac{constructor(t,n,s){this.parent=t,this.scopePath=n,this.tokenAttributes=s}static fromExtension(t,n){let s=t,r=(t==null?void 0:t.scopePath)??null;for(const i of n)r=n5.push(r,i.scopeNames),s=new ac(s,r,i.encodedTokenAttributes);return s}static createRoot(t,n){return new ac(null,new n5(null,t),n)}static createRootAndLookUpScopeName(t,n,s){const r=s.getMetadataForScope(t),i=new n5(null,t),o=s.themeProvider.themeMatch(i),a=ac.mergeAttributes(n,r,o);return new ac(null,i,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return ac.equals(this,t)}static equals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.scopeName!==n.scopeName||t.tokenAttributes!==n.tokenAttributes)return!1;t=t.parent,n=n.parent}while(!0)}static mergeAttributes(t,n,s){let r=-1,i=0,o=0;return s!==null&&(r=s.fontStyle,i=s.foregroundId,o=s.backgroundId),k0.set(t,n.languageId,n.tokenType,null,r,i,o)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return ac._pushAttributed(this,t,n);const s=t.split(/ /g);let r=this;for(const i of s)r=ac._pushAttributed(r,i,n);return r}static _pushAttributed(t,n,s){const r=s.getMetadataForScope(n),i=t.scopePath.push(n),o=s.themeProvider.themeMatch(i),a=ac.mergeAttributes(t.tokenAttributes,r,o);return new ac(t,i,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){var r;const n=[];let s=this;for(;s&&s!==t;)n.push({encodedTokenAttributes:s.tokenAttributes,scopeNames:s.scopePath.getExtensionIfDefined(((r=s.parent)==null?void 0:r.scopePath)??null)}),s=s.parent;return s===t?n.reverse():void 0}},ll,OT=(ll=class{constructor(t,n,s,r,i,o,a,l){Me(this,"_stackElementBrand");Me(this,"_enterPos");Me(this,"_anchorPos");Me(this,"depth");this.parent=t,this.ruleId=n,this.beginRuleCapturedEOL=i,this.endRule=o,this.nameScopesList=a,this.contentNameScopesList=l,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=s,this._anchorPos=r}equals(t){return t===null?!1:ll._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?W1.equals(t.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.depth!==n.depth||t.ruleId!==n.ruleId||t.endRule!==n.endRule)return!1;t=t.parent,n=n.parent}while(!0)}clone(){return this}static _reset(t){for(;t;)t._enterPos=-1,t._anchorPos=-1,t=t.parent}reset(){ll._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,s,r,i,o,a){return new ll(this,t,n,s,r,i,o,a)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(t){return t.getRule(this.ruleId)}toString(){const t=[];return this._writeString(t,0),"["+t.join(",")+"]"}_writeString(t,n){var s,r;return this.parent&&(n=this.parent._writeString(t,n)),t[n++]=`(${this.ruleId}, ${(s=this.nameScopesList)==null?void 0:s.toString()}, ${(r=this.contentNameScopesList)==null?void 0:r.toString()})`,n}withContentNameScopesList(t){return this.contentNameScopesList===t?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,t)}withEndRule(t){return this.endRule===t?this:new ll(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(t){let n=this;for(;n&&n._enterPos===t._enterPos;){if(n.ruleId===t.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){var t,n,s;return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:((n=this.nameScopesList)==null?void 0:n.getExtensionIfDefined(((t=this.parent)==null?void 0:t.nameScopesList)??null))??[],contentNameScopesList:((s=this.contentNameScopesList)==null?void 0:s.getExtensionIfDefined(this.nameScopesList))??[]}}static pushFrame(t,n){const s=W1.fromExtension((t==null?void 0:t.nameScopesList)??null,n.nameScopesList);return new ll(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,s,W1.fromExtension(s,n.contentNameScopesList))}},Me(ll,"NULL",new ll(null,0,0,0,!1,null,null,null)),ll),Rwe=class{constructor(e,t){Me(this,"balancedBracketScopes");Me(this,"unbalancedBracketScopes");Me(this,"allowAny",!1);this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):zk(n,Hk).map(s=>s.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>zk(n,Hk).map(s=>s.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(const t of this.unbalancedBracketScopes)if(t(e))return!1;for(const t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},jwe=class{constructor(e,t,n,s){Me(this,"_emitBinaryTokens");Me(this,"_lineText");Me(this,"_tokens");Me(this,"_binaryTokens");Me(this,"_lastTokenEndIndex");Me(this,"_tokenTypeOverrides");this.balancedBracketSelectors=s,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){var s;if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let r=(e==null?void 0:e.tokenAttributes)??0,i=!1;if((s=this.balancedBracketSelectors)!=null&&s.matchesAlways&&(i=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const o=(e==null?void 0:e.getScopeNames())??[];for(const a of this._tokenTypeOverrides)a.matcher(o)&&(r=k0.set(r,0,a.type,null,-1,0,0));this.balancedBracketSelectors&&(i=this.balancedBracketSelectors.match(o))}if(i&&(r=k0.set(r,0,8,i,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),this._lastTokenEndIndex=t;return}const n=(e==null?void 0:e.getScopeNames())??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let s=0,r=this._binaryTokens.length;s<r;s++)n[s]=this._binaryTokens[s];return n}},Lwe=class{constructor(e,t){Me(this,"_grammars",new Map);Me(this,"_rawGrammars",new Map);Me(this,"_injectionGrammars",new Map);Me(this,"_theme");this._onigLib=t,this._theme=e}dispose(){for(const e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,s,r){if(!this._grammars.has(e)){let i=this._rawGrammars.get(e);if(!i)return null;this._grammars.set(e,Mwe(e,i,t,n,s,r,this,this._onigLib))}return this._grammars.get(e)}},Dwe=class{constructor(t){Me(this,"_options");Me(this,"_syncRegistry");Me(this,"_ensureGrammarCache");this._options=t,this._syncRegistry=new Lwe($k.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme($k.createFromRawTheme(t,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(t,n,s){return this.loadGrammarWithConfiguration(t,n,{embeddedLanguages:s})}loadGrammarWithConfiguration(t,n,s){return this._loadGrammar(t,n,s.embeddedLanguages,s.tokenTypes,new Rwe(s.balancedBracketSelectors||[],s.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,s,r,i){const o=new uwe(this._syncRegistry,t);for(;o.Q.length>0;)o.Q.map(a=>this._loadSingleGrammar(a.scopeName)),o.processQueue();return this._grammarForScopeName(t,n,s,r,i)}_loadSingleGrammar(t){this._ensureGrammarCache.has(t)||(this._doLoadSingleGrammar(t),this._ensureGrammarCache.set(t,!0))}_doLoadSingleGrammar(t){const n=this._options.loadGrammar(t);if(n){const s=typeof this._options.getInjections=="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(n,s)}}addGrammar(t,n=[],s=0,r=null){return this._syncRegistry.addGrammar(t,n),this._grammarForScopeName(t.scopeName,s,r)}_grammarForScopeName(t,n=0,s=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(t,n,s,r,i)}},PT=OT.NULL;const Owe=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],Pwe=/["&'<>`]/g,Bwe=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,$we=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,zwe=/[|\\{}()[\]^$+*?.]/g,TD=new WeakMap;function Fwe(e,t){if(e=e.replace(t.subset?qwe(t.subset):Pwe,s),t.subset||t.escapeOnly)return e;return e.replace(Bwe,n).replace($we,s);function n(r,i,o){return t.format((r.charCodeAt(0)-55296)*1024+r.charCodeAt(1)-56320+65536,o.charCodeAt(i+2),t)}function s(r,i,o){return t.format(r.charCodeAt(0),o.charCodeAt(i+1),t)}}function qwe(e){let t=TD.get(e);return t||(t=Hwe(e),TD.set(e,t)),t}function Hwe(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(zwe,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const Uwe=/[\dA-Fa-f]/;function Vwe(e,t,n){const s="&#x"+e.toString(16).toUpperCase();return n&&t&&!Uwe.test(String.fromCharCode(t))?s:s+";"}const Wwe=/\d/;function Gwe(e,t,n){const s="&#"+String(e);return n&&t&&!Wwe.test(String.fromCharCode(t))?s:s+";"}const Kwe=["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"],r5={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:"€"},Ywe=["cent","copy","divide","gt","lt","not","para","times"],bG={}.hasOwnProperty,BT={};let Jv;for(Jv in r5)bG.call(r5,Jv)&&(BT[r5[Jv]]=Jv);const Xwe=/[^\dA-Za-z]/;function Qwe(e,t,n,s){const r=String.fromCharCode(e);if(bG.call(BT,r)){const i=BT[r],o="&"+i;return n&&Kwe.includes(i)&&!Ywe.includes(i)&&(!s||t&&t!==61&&Xwe.test(String.fromCharCode(t)))?o:o+";"}return""}function Jwe(e,t,n){let s=Vwe(e,t,n.omitOptionalSemicolons),r;if((n.useNamedReferences||n.useShortestReferences)&&(r=Qwe(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!r)&&n.useShortestReferences){const i=Gwe(e,t,n.omitOptionalSemicolons);i.length<s.length&&(s=i)}return r&&(!n.useShortestReferences||r.length<s.length)?r:s}function Kp(e,t){return Fwe(e,Object.assign({format:Jwe},t))}const Zwe=/^>|^->|<!--|-->|--!>|<!-$/g,exe=[">"],txe=["<",">"];function nxe(e,t,n,s){return s.settings.bogusComments?"<?"+Kp(e.value,Object.assign({},s.settings.characterReferences,{subset:exe}))+">":"<!--"+e.value.replace(Zwe,r)+"-->";function r(i){return Kp(i,Object.assign({},s.settings.characterReferences,{subset:txe}))}}function sxe(e,t,n,s){return"<!"+(s.settings.upperDoctype?"DOCTYPE":"doctype")+(s.settings.tightDoctype?"":" ")+"html>"}const Mi=wG(1),vG=wG(-1),rxe=[];function wG(e){return t;function t(n,s,r){const i=n?n.children:rxe;let o=(s||0)+e,a=i[o];if(!r)for(;a&&w_(a);)o+=e,a=i[o];return a}}const ixe={}.hasOwnProperty;function xG(e){return t;function t(n,s,r){return ixe.call(e,n.tagName)&&e[n.tagName](n,s,r)}}const jA=xG({body:axe,caption:i5,colgroup:i5,dd:dxe,dt:uxe,head:i5,html:oxe,li:cxe,optgroup:hxe,option:fxe,p:lxe,rp:ED,rt:ED,tbody:pxe,td:AD,tfoot:gxe,th:AD,thead:mxe,tr:yxe});function i5(e,t,n){const s=Mi(n,t,!0);return!s||s.type!=="comment"&&!(s.type==="text"&&w_(s.value.charAt(0)))}function oxe(e,t,n){const s=Mi(n,t);return!s||s.type!=="comment"}function axe(e,t,n){const s=Mi(n,t);return!s||s.type!=="comment"}function lxe(e,t,n){const s=Mi(n,t);return s?s.type==="element"&&(s.tagName==="address"||s.tagName==="article"||s.tagName==="aside"||s.tagName==="blockquote"||s.tagName==="details"||s.tagName==="div"||s.tagName==="dl"||s.tagName==="fieldset"||s.tagName==="figcaption"||s.tagName==="figure"||s.tagName==="footer"||s.tagName==="form"||s.tagName==="h1"||s.tagName==="h2"||s.tagName==="h3"||s.tagName==="h4"||s.tagName==="h5"||s.tagName==="h6"||s.tagName==="header"||s.tagName==="hgroup"||s.tagName==="hr"||s.tagName==="main"||s.tagName==="menu"||s.tagName==="nav"||s.tagName==="ol"||s.tagName==="p"||s.tagName==="pre"||s.tagName==="section"||s.tagName==="table"||s.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function cxe(e,t,n){const s=Mi(n,t);return!s||s.type==="element"&&s.tagName==="li"}function uxe(e,t,n){const s=Mi(n,t);return!!(s&&s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd"))}function dxe(e,t,n){const s=Mi(n,t);return!s||s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd")}function ED(e,t,n){const s=Mi(n,t);return!s||s.type==="element"&&(s.tagName==="rp"||s.tagName==="rt")}function hxe(e,t,n){const s=Mi(n,t);return!s||s.type==="element"&&s.tagName==="optgroup"}function fxe(e,t,n){const s=Mi(n,t);return!s||s.type==="element"&&(s.tagName==="option"||s.tagName==="optgroup")}function mxe(e,t,n){const s=Mi(n,t);return!!(s&&s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot"))}function pxe(e,t,n){const s=Mi(n,t);return!s||s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot")}function gxe(e,t,n){return!Mi(n,t)}function yxe(e,t,n){const s=Mi(n,t);return!s||s.type==="element"&&s.tagName==="tr"}function AD(e,t,n){const s=Mi(n,t);return!s||s.type==="element"&&(s.tagName==="td"||s.tagName==="th")}const bxe=xG({body:xxe,colgroup:kxe,head:wxe,html:vxe,tbody:_xe});function vxe(e){const t=Mi(e,-1);return!t||t.type!=="comment"}function wxe(e){const t=new Set;for(const s of e.children)if(s.type==="element"&&(s.tagName==="base"||s.tagName==="title")){if(t.has(s.tagName))return!1;t.add(s.tagName)}const n=e.children[0];return!n||n.type==="element"}function xxe(e){const t=Mi(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&w_(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function kxe(e,t,n){const s=vG(n,t),r=Mi(e,-1,!0);return n&&s&&s.type==="element"&&s.tagName==="colgroup"&&jA(s,n.children.indexOf(s),n)?!1:!!(r&&r.type==="element"&&r.tagName==="col")}function _xe(e,t,n){const s=vG(n,t),r=Mi(e,-1);return n&&s&&s.type==="element"&&(s.tagName==="thead"||s.tagName==="tbody")&&jA(s,n.children.indexOf(s),n)?!1:!!(r&&r.type==="element"&&r.tagName==="tr")}const Zv={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 Sxe(e,t,n,s){const r=s.schema,i=r.space==="svg"?!1:s.settings.omitOptionalTags;let o=r.space==="svg"?s.settings.closeEmptyElements:s.settings.voids.includes(e.tagName.toLowerCase());const a=[];let l;r.space==="html"&&e.tagName==="svg"&&(s.schema=G0);const c=Cxe(s,e.properties),d=s.all(r.space==="html"&&e.tagName==="template"?e.content:e);return s.schema=r,d&&(o=!1),(c||!i||!bxe(e,t,n))&&(a.push("<",e.tagName,c?" "+c:""),o&&(r.space==="svg"||s.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!s.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(d),!o&&(!i||!jA(e,t,n))&&a.push("</"+e.tagName+">"),a.join("")}function Cxe(e,t){const n=[];let s=-1,r;if(t){for(r in t)if(t[r]!==null&&t[r]!==void 0){const i=Txe(e,r,t[r]);i&&n.push(i)}}for(;++s<n.length;){const i=e.settings.tightAttributes?n[s].charAt(n[s].length-1):void 0;s!==n.length-1&&i!=='"'&&i!=="'"&&(n[s]+=" ")}return n.join("")}function Txe(e,t,n){const s=KE(e.schema,t),r=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,i=e.settings.allowDangerousCharacters?0:1;let o=e.quote,a;if(s.overloadedBoolean&&(n===s.attribute||n==="")?n=!0:(s.boolean||s.overloadedBoolean)&&(typeof n!="string"||n===s.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const l=Kp(s.attribute,Object.assign({},e.settings.characterReferences,{subset:Zv.name[r][i]}));return n===!0||(n=Array.isArray(n)?(s.commaSeparated?OU:UU)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?l:(e.settings.preferUnquoted&&(a=Kp(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:Zv.unquoted[r][i]}))),a!==n&&(e.settings.quoteSmart&&Ik(n,o)>Ik(n,e.alternative)&&(o=e.alternative),a=o+Kp(n,Object.assign({},e.settings.characterReferences,{subset:(o==="'"?Zv.single:Zv.double)[r][i],attribute:!0}))+o),l+(a&&"="+a))}const Exe=["<","&"];function kG(e,t,n,s){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:Kp(e.value,Object.assign({},s.settings.characterReferences,{subset:Exe}))}function Axe(e,t,n,s){return s.settings.allowDangerousHtml?e.value:kG(e,t,n,s)}function Mxe(e,t,n,s){return s.all(e)}const Nxe=Cge("type",{invalid:Ixe,unknown:Rxe,handlers:{comment:nxe,doctype:sxe,element:Sxe,raw:Axe,root:Mxe,text:kG}});function Ixe(e){throw new Error("Expected node, not `"+e+"`")}function Rxe(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const jxe={},Lxe={},Dxe=[];function Oxe(e,t){const n=jxe,s=n.quote||'"',r=s==='"'?"'":'"';if(s!=='"'&&s!=="'")throw new Error("Invalid quote `"+s+"`, expected `'` or `\"`");return{one:Pxe,all:Bxe,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||Owe,characterReferences:n.characterReferences||Lxe,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?G0:YE,quote:s,alternative:r}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function Pxe(e,t,n){return Nxe(e,t,n,this)}function Bxe(e){const t=[],n=e&&e.children||Dxe;let s=-1;for(;++s<n.length;)t[s]=this.one(n[s],s,e);return t.join("")}function $xe(e){return Array.isArray(e)?e:[e]}function z_(e,t=!1){var i;const n=e.split(/(\r?\n)/g);let s=0;const r=[];for(let o=0;o<n.length;o+=2){const a=t?n[o]+(n[o+1]||""):n[o];r.push([a,s]),s+=n[o].length,s+=((i=n[o+1])==null?void 0:i.length)||0}return r}function LA(e){return!e||["plaintext","txt","text","plain"].includes(e)}function _G(e){return e==="ansi"||LA(e)}function DA(e){return e==="none"}function SG(e){return DA(e)}function CG(e,t){var s;if(!t)return e;e.properties||(e.properties={}),(s=e.properties).class||(s.class=[]),typeof e.properties.class=="string"&&(e.properties.class=e.properties.class.split(/\s+/g)),Array.isArray(e.properties.class)||(e.properties.class=[]);const n=Array.isArray(t)?t:t.split(/\s+/g);for(const r of n)r&&!e.properties.class.includes(r)&&e.properties.class.push(r);return e}function zxe(e,t){let n=0;const s=[];for(const r of t)r>n&&s.push({...e,content:e.content.slice(n,r),offset:e.offset+n}),n=r;return n<e.content.length&&s.push({...e,content:e.content.slice(n),offset:e.offset+n}),s}function Fxe(e,t){const n=Array.from(t instanceof Set?t:new Set(t)).sort((s,r)=>s-r);return n.length?e.map(s=>s.flatMap(r=>{const i=n.filter(o=>r.offset<o&&o<r.offset+r.content.length).map(o=>o-r.offset).sort((o,a)=>o-a);return i.length?zxe(r,i):r})):e}async function TG(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function Uk(e,t){const n=typeof e=="string"?{}:{...e.colorReplacements},s=typeof e=="string"?e:e.name;for(const[r,i]of Object.entries((t==null?void 0:t.colorReplacements)||{}))typeof i=="string"?n[r]=i:r===s&&Object.assign(n,i);return n}function Ef(e,t){return e&&((t==null?void 0:t[e==null?void 0:e.toLowerCase()])||e)}function EG(e){const t={};return e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle&&(e.fontStyle&xu.Italic&&(t["font-style"]="italic"),e.fontStyle&xu.Bold&&(t["font-weight"]="bold"),e.fontStyle&xu.Underline&&(t["text-decoration"]="underline")),t}function qxe(e){return typeof e=="string"?e:Object.entries(e).map(([t,n])=>`${t}:${n}`).join(";")}function Hxe(e){const t=z_(e,!0).map(([r])=>r);function n(r){if(r===e.length)return{line:t.length-1,character:t[t.length-1].length};let i=r,o=0;for(const a of t){if(i<a.length)break;i-=a.length,o++}return{line:o,character:i}}function s(r,i){let o=0;for(let a=0;a<r;a++)o+=t[a].length;return o+=i,o}return{lines:t,indexToPos:n,posToIndex:s}}class Io extends Error{constructor(t){super(t),this.name="ShikiError"}}const AG=new WeakMap;function F_(e,t){AG.set(e,t)}function Ey(e){return AG.get(e)}class Z0{constructor(...t){Me(this,"_stacks",{});Me(this,"lang");if(t.length===2){const[n,s]=t;this.lang=s,this._stacks=n}else{const[n,s,r]=t;this.lang=s,this._stacks={[r]:n}}}get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new Z0(Object.fromEntries($xe(n).map(s=>[s,PT])),t)}getInternalStack(t=this.theme){return this._stacks[t]}get scopes(){return MD(this._stacks[this.theme])}getScopes(t=this.theme){return MD(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.scopes}}}function MD(e){const t=[],n=new Set;function s(r){var o;if(n.has(r))return;n.add(r);const i=(o=r==null?void 0:r.nameScopesList)==null?void 0:o.scopeName;i&&t.push(i),r.parent&&s(r.parent)}return s(e),t}function Uxe(e,t){if(!(e instanceof Z0))throw new Io("Invalid grammar state");return e.getInternalStack(t)}function Vxe(){const e=new WeakMap;function t(n){if(!e.has(n.meta)){let s=function(o){if(typeof o=="number"){if(o<0||o>n.source.length)throw new Io(`Invalid decoration offset: ${o}. Code length: ${n.source.length}`);return{...r.indexToPos(o),offset:o}}else{const a=r.lines[o.line];if(a===void 0)throw new Io(`Invalid decoration position ${JSON.stringify(o)}. Lines length: ${r.lines.length}`);if(o.character<0||o.character>a.length)throw new Io(`Invalid decoration position ${JSON.stringify(o)}. Line ${o.line} length: ${a.length}`);return{...o,offset:r.posToIndex(o.line,o.character)}}};const r=Hxe(n.source),i=(n.options.decorations||[]).map(o=>({...o,start:s(o.start),end:s(o.end)}));Wxe(i),e.set(n.meta,{decorations:i,converter:r,source:n.source})}return e.get(n.meta)}return{name:"shiki:decorations",tokens(n){var o;if(!((o=this.options.decorations)!=null&&o.length))return;const r=t(this).decorations.flatMap(a=>[a.start.offset,a.end.offset]);return Fxe(n,r)},code(n){var d;if(!((d=this.options.decorations)!=null&&d.length))return;const s=t(this),r=Array.from(n.children).filter(h=>h.type==="element"&&h.tagName==="span");if(r.length!==s.converter.lines.length)throw new Io(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${s.converter.lines.length}). Failed to apply decorations.`);function i(h,f,p,g){const y=r[h];let w="",v=-1,b=-1;if(f===0&&(v=0),p===0&&(b=0),p===Number.POSITIVE_INFINITY&&(b=y.children.length),v===-1||b===-1)for(let k=0;k<y.children.length;k++)w+=MG(y.children[k]),v===-1&&w.length===f&&(v=k+1),b===-1&&w.length===p&&(b=k+1);if(v===-1)throw new Io(`Failed to find start index for decoration ${JSON.stringify(g.start)}`);if(b===-1)throw new Io(`Failed to find end index for decoration ${JSON.stringify(g.end)}`);const x=y.children.slice(v,b);if(!g.alwaysWrap&&x.length===y.children.length)a(y,g,"line");else if(!g.alwaysWrap&&x.length===1&&x[0].type==="element")a(x[0],g,"token");else{const k={type:"element",tagName:"span",properties:{},children:x};a(k,g,"wrapper"),y.children.splice(v,x.length,k)}}function o(h,f){r[h]=a(r[h],f,"line")}function a(h,f,p){var w;const g=f.properties||{},y=f.transform||(v=>v);return h.tagName=f.tagName||"span",h.properties={...h.properties,...g,class:h.properties.class},(w=f.properties)!=null&&w.class&&CG(h,f.properties.class),h=y(h,p)||h,h}const l=[],c=s.decorations.sort((h,f)=>f.start.offset-h.start.offset);for(const h of c){const{start:f,end:p}=h;if(f.line===p.line)i(f.line,f.character,p.character,h);else if(f.line<p.line){i(f.line,f.character,Number.POSITIVE_INFINITY,h);for(let g=f.line+1;g<p.line;g++)l.unshift(()=>o(g,h));i(p.line,0,p.character,h)}}l.forEach(h=>h())}}}function Wxe(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new Io(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let s=t+1;s<e.length;s++){const r=e[s],i=n.start.offset<r.start.offset&&r.start.offset<n.end.offset,o=n.start.offset<r.end.offset&&r.end.offset<n.end.offset,a=r.start.offset<n.start.offset&&n.start.offset<r.end.offset,l=r.start.offset<n.end.offset&&n.end.offset<r.end.offset;if(i||o||a||l){if(o&&o||a&&l)continue;throw new Io(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(r.start)} intersect.`)}}}}function MG(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(MG).join(""):""}const Gxe=[Vxe()];function Vk(e){return[...e.transformers||[],...Gxe]}var Af=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],o5={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",9:"strikethrough"};function Kxe(e,t){const n=e.indexOf("\x1B[",t);if(n!==-1){const s=e.indexOf("m",n);return{sequence:e.substring(n+2,s).split(";"),startPosition:n,position:s+1}}return{position:e.length}}function ND(e,t){let n=1;const s=e[t+n++];let r;if(s==="2"){const i=[e[t+n++],e[t+n++],e[t+n]].map(o=>Number.parseInt(o));i.length===3&&!i.some(o=>Number.isNaN(o))&&(r={type:"rgb",rgb:i})}else if(s==="5"){const i=Number.parseInt(e[t+n]);Number.isNaN(i)||(r={type:"table",index:Number(i)})}return[n,r]}function Yxe(e){const t=[];for(let n=0;n<e.length;n++){const s=e[n],r=Number.parseInt(s);if(!Number.isNaN(r))if(r===0)t.push({type:"resetAll"});else if(r<=9)o5[r]&&t.push({type:"setDecoration",value:o5[r]});else if(r<=29){const i=o5[r-20];i&&t.push({type:"resetDecoration",value:i})}else if(r<=37)t.push({type:"setForegroundColor",value:{type:"named",name:Af[r-30]}});else if(r===38){const[i,o]=ND(e,n);o&&t.push({type:"setForegroundColor",value:o}),n+=i}else if(r===39)t.push({type:"resetForegroundColor"});else if(r<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:Af[r-40]}});else if(r===48){const[i,o]=ND(e,n);o&&t.push({type:"setBackgroundColor",value:o}),n+=i}else r===49?t.push({type:"resetBackgroundColor"}):r>=90&&r<=97?t.push({type:"setForegroundColor",value:{type:"named",name:Af[r-90+8]}}):r>=100&&r<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:Af[r-100+8]}})}return t}function Xxe(){let e=null,t=null,n=new Set;return{parse(s){const r=[];let i=0;do{const o=Kxe(s,i),a=o.sequence?s.substring(i,o.startPosition):s.substring(i);if(a.length>0&&r.push({value:a,foreground:e,background:t,decorations:new Set(n)}),o.sequence){const l=Yxe(o.sequence);for(const c of l)c.type==="resetAll"?(e=null,t=null,n.clear()):c.type==="resetForegroundColor"?e=null:c.type==="resetBackgroundColor"?t=null:c.type==="resetDecoration"&&n.delete(c.value);for(const c of l)c.type==="setForegroundColor"?e=c.value:c.type==="setBackgroundColor"?t=c.value:c.type==="setDecoration"&&n.add(c.value)}i=o.position}while(i<s.length);return r}}}var Qxe={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 Jxe(e=Qxe){function t(a){return e[a]}function n(a){return`#${a.map(l=>Math.max(0,Math.min(l,255)).toString(16).padStart(2,"0")).join("")}`}let s;function r(){if(s)return s;s=[];for(let c=0;c<Af.length;c++)s.push(t(Af[c]));let a=[0,95,135,175,215,255];for(let c=0;c<6;c++)for(let d=0;d<6;d++)for(let h=0;h<6;h++)s.push(n([a[c],a[d],a[h]]));let l=8;for(let c=0;c<24;c++,l+=10)s.push(n([l,l,l]));return s}function i(a){return r()[a]}function o(a){switch(a.type){case"named":return t(a.name);case"rgb":return n(a.rgb);case"table":return i(a.index)}}return{value:o}}function Zxe(e,t,n){const s=Uk(e,n),r=z_(t),i=Jxe(Object.fromEntries(Af.map(a=>{var l;return[a,(l=e.colors)==null?void 0:l[`terminal.ansi${a[0].toUpperCase()}${a.substring(1)}`]]}))),o=Xxe();return r.map(a=>o.parse(a[0]).map(l=>{let c,d;l.decorations.has("reverse")?(c=l.background?i.value(l.background):e.bg,d=l.foreground?i.value(l.foreground):e.fg):(c=l.foreground?i.value(l.foreground):e.fg,d=l.background?i.value(l.background):void 0),c=Ef(c,s),d=Ef(d,s),l.decorations.has("dim")&&(c=eke(c));let h=xu.None;return l.decorations.has("bold")&&(h|=xu.Bold),l.decorations.has("italic")&&(h|=xu.Italic),l.decorations.has("underline")&&(h|=xu.Underline),{content:l.value,offset:a[1],color:c,bgColor:d,fontStyle:h}}))}function eke(e){const t=e.match(/#([0-9a-f]{3})([0-9a-f]{3})?([0-9a-f]{2})?/);if(t)if(t[3]){const s=Math.round(Number.parseInt(t[3],16)/2).toString(16).padStart(2,"0");return`#${t[1]}${t[2]}${s}`}else return t[2]?`#${t[1]}${t[2]}80`:`#${Array.from(t[1]).map(s=>`${s}${s}`).join("")}80`;const n=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:e}function OA(e,t,n={}){const{lang:s="text",theme:r=e.getLoadedThemes()[0]}=n;if(LA(s)||DA(r))return z_(t).map(l=>[{content:l[0],offset:l[1]}]);const{theme:i,colorMap:o}=e.setTheme(r);if(s==="ansi")return Zxe(i,t,n);const a=e.getLanguage(s);if(n.grammarState){if(n.grammarState.lang!==a.name)throw new Au(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${a.name}"`);if(!n.grammarState.themes.includes(i.name))throw new Au(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return nke(t,a,i,o,n)}function tke(...e){if(e.length===2)return Ey(e[1]);const[t,n,s={}]=e,{lang:r="text",theme:i=t.getLoadedThemes()[0]}=s;if(LA(r)||DA(i))throw new Au("Plain language does not have grammar state");if(r==="ansi")throw new Au("ANSI language does not have grammar state");const{theme:o,colorMap:a}=t.setTheme(i),l=t.getLanguage(r);return new Z0(Wk(n,l,o,a,s).stateStack,l.name,o.name)}function nke(e,t,n,s,r){const i=Wk(e,t,n,s,r),o=new Z0(Wk(e,t,n,s,r).stateStack,t.name,n.name);return F_(i.tokens,o),i.tokens}function Wk(e,t,n,s,r){const i=Uk(n,r),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:a=500}=r,l=z_(e);let c=r.grammarState?Uxe(r.grammarState,n.name)??PT:r.grammarContextCode!=null?Wk(r.grammarContextCode,t,n,s,{...r,grammarState:void 0,grammarContextCode:void 0}).stateStack:PT,d=[];const h=[];for(let f=0,p=l.length;f<p;f++){const[g,y]=l[f];if(g===""){d=[],h.push([]);continue}if(o>0&&g.length>=o){d=[],h.push([{content:g,offset:y,color:"",fontStyle:0}]);continue}let w,v,b;r.includeExplanation&&(w=t.tokenizeLine(g,c),v=w.tokens,b=0);const x=t.tokenizeLine2(g,c,a),k=x.tokens.length/2;for(let T=0;T<k;T++){const C=x.tokens[2*T],S=T+1<k?x.tokens[2*T+2]:g.length;if(C===S)continue;const _=x.tokens[2*T+1],L=Ef(s[k0.getForeground(_)],i),M=k0.getFontStyle(_),I={content:g.substring(C,S),offset:y+C,color:L,fontStyle:M};if(r.includeExplanation){const A=[];if(r.includeExplanation!=="scopeName")for(const B of n.settings){let F;switch(typeof B.scope){case"string":F=B.scope.split(/,/).map(O=>O.trim());break;case"object":F=B.scope;break;default:continue}A.push({settings:B,selectors:F.map(O=>O.split(/ /))})}I.explanation=[];let P=0;for(;C+P<S;){const B=v[b],F=g.substring(B.startIndex,B.endIndex);P+=F.length,I.explanation.push({content:F,scopes:r.includeExplanation==="scopeName"?ske(B.scopes):rke(A,B.scopes)}),b+=1}}d.push(I)}h.push(d),d=[],c=x.ruleStack}return{tokens:h,stateStack:c}}function ske(e){return e.map(t=>({scopeName:t}))}function rke(e,t){const n=[];for(let s=0,r=t.length;s<r;s++){const i=t[s];n[s]={scopeName:i,themeMatches:oke(e,i,t.slice(0,s))}}return n}function ID(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function ike(e,t,n){if(!ID(e[e.length-1],t))return!1;let s=e.length-2,r=n.length-1;for(;s>=0&&r>=0;)ID(e[s],n[r])&&(s-=1),r-=1;return s===-1}function oke(e,t,n){const s=[];for(const{selectors:r,settings:i}of e)for(const o of r)if(ike(o,t,n)){s.push(i);break}return s}function NG(e,t,n){const s=Object.entries(n.themes).filter(l=>l[1]).map(l=>({color:l[0],theme:l[1]})),r=s.map(l=>{const c=OA(e,t,{...n,theme:l.theme}),d=Ey(c),h=typeof l.theme=="string"?l.theme:l.theme.name;return{tokens:c,state:d,theme:h}}),i=ake(...r.map(l=>l.tokens)),o=i[0].map((l,c)=>l.map((d,h)=>{const f={content:d.content,variants:{},offset:d.offset};return"includeExplanation"in n&&n.includeExplanation&&(f.explanation=d.explanation),i.forEach((p,g)=>{const{content:y,explanation:w,offset:v,...b}=p[c][h];f.variants[s[g].color]=b}),f})),a=r[0].state?new Z0(Object.fromEntries(r.map(l=>{var c;return[l.theme,(c=l.state)==null?void 0:c.getInternalStack(l.theme)]})),r[0].state.lang):void 0;return a&&F_(o,a),o}function ake(...e){const t=e.map(()=>[]),n=e.length;for(let s=0;s<e[0].length;s++){const r=e.map(l=>l[s]),i=t.map(()=>[]);t.forEach((l,c)=>l.push(i[c]));const o=r.map(()=>0),a=r.map(l=>l[0]);for(;a.every(l=>l);){const l=Math.min(...a.map(c=>c.content.length));for(let c=0;c<n;c++){const d=a[c];d.content.length===l?(i[c].push(d),o[c]+=1,a[c]=r[c][o[c]]):(i[c].push({...d,content:d.content.slice(0,l)}),a[c]={...d,content:d.content.slice(l),offset:d.offset+l})}}}return t}function Gk(e,t,n){let s,r,i,o,a,l;if("themes"in n){const{defaultColor:c="light",cssVariablePrefix:d="--shiki-"}=n,h=Object.entries(n.themes).filter(w=>w[1]).map(w=>({color:w[0],theme:w[1]})).sort((w,v)=>w.color===c?-1:v.color===c?1:0);if(h.length===0)throw new Au("`themes` option must not be empty");const f=NG(e,t,n);if(l=Ey(f),c&&!h.find(w=>w.color===c))throw new Au(`\`themes\` option must contain the defaultColor key \`${c}\``);const p=h.map(w=>e.getTheme(w.theme)),g=h.map(w=>w.color);i=f.map(w=>w.map(v=>lke(v,g,d,c))),l&&F_(i,l);const y=h.map(w=>Uk(w.theme,n));r=h.map((w,v)=>(v===0&&c?"":`${d+w.color}:`)+(Ef(p[v].fg,y[v])||"inherit")).join(";"),s=h.map((w,v)=>(v===0&&c?"":`${d+w.color}-bg:`)+(Ef(p[v].bg,y[v])||"inherit")).join(";"),o=`shiki-themes ${p.map(w=>w.name).join(" ")}`,a=c?void 0:[r,s].join(";")}else if("theme"in n){const c=Uk(n.theme,n);i=OA(e,t,n);const d=e.getTheme(n.theme);s=Ef(d.bg,c),r=Ef(d.fg,c),o=d.name,l=Ey(i)}else throw new Au("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:r,bg:s,themeName:o,rootStyle:a,grammarState:l}}function lke(e,t,n,s){const r={content:e.content,explanation:e.explanation,offset:e.offset},i=t.map(l=>EG(e.variants[l])),o=new Set(i.flatMap(l=>Object.keys(l))),a={};return i.forEach((l,c)=>{for(const d of o){const h=l[d]||"inherit";if(c===0&&s)a[d]=h;else{const f=d==="color"?"":d==="background-color"?"-bg":`-${d}`,p=n+t[c]+(d==="color"?"":f);a[p]=h}}}),r.htmlStyle=a,r}function Kk(e,t,n,s={meta:{},options:n,codeToHast:(r,i)=>Kk(e,r,i),codeToTokens:(r,i)=>Gk(e,r,i)}){var p,g;let r=t;for(const y of Vk(n))r=((p=y.preprocess)==null?void 0:p.call(s,r,n))||r;let{tokens:i,fg:o,bg:a,themeName:l,rootStyle:c,grammarState:d}=Gk(e,r,n);const{mergeWhitespaces:h=!0}=n;h===!0?i=uke(i):h==="never"&&(i=dke(i));const f={...s,get source(){return r}};for(const y of Vk(n))i=((g=y.tokens)==null?void 0:g.call(f,i))||i;return cke(i,{...n,fg:o,bg:a,themeName:l,rootStyle:c},f,d)}function cke(e,t,n,s=Ey(e)){var g,y,w;const r=Vk(t),i=[],o={type:"root",children:[]},{structure:a="classic",tabindex:l="0"}=t;let c={type:"element",tagName:"pre",properties:{class:`shiki ${t.themeName||""}`,style:t.rootStyle||`background-color:${t.bg};color:${t.fg}`,...l!==!1&&l!=null?{tabindex:l.toString()}:{},...Object.fromEntries(Array.from(Object.entries(t.meta||{})).filter(([v])=>!v.startsWith("_")))},children:[]},d={type:"element",tagName:"code",properties:{},children:i};const h=[],f={...n,structure:a,addClassToHast:CG,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return c},get code(){return d},get lines(){return h}};if(e.forEach((v,b)=>{var T,C;b&&(a==="inline"?o.children.push({type:"element",tagName:"br",properties:{},children:[]}):a==="classic"&&i.push({type:"text",value:`
`}));let x={type:"element",tagName:"span",properties:{class:"line"},children:[]},k=0;for(const S of v){let _={type:"element",tagName:"span",properties:{...S.htmlAttrs},children:[{type:"text",value:S.content}]};S.htmlStyle;const L=qxe(S.htmlStyle||EG(S));L&&(_.properties.style=L);for(const M of r)_=((T=M==null?void 0:M.span)==null?void 0:T.call(f,_,b+1,k,x,S))||_;a==="inline"?o.children.push(_):a==="classic"&&x.children.push(_),k+=S.content.length}if(a==="classic"){for(const S of r)x=((C=S==null?void 0:S.line)==null?void 0:C.call(f,x,b+1))||x;h.push(x),i.push(x)}}),a==="classic"){for(const v of r)d=((g=v==null?void 0:v.code)==null?void 0:g.call(f,d))||d;c.children.push(d);for(const v of r)c=((y=v==null?void 0:v.pre)==null?void 0:y.call(f,c))||c;o.children.push(c)}let p=o;for(const v of r)p=((w=v==null?void 0:v.root)==null?void 0:w.call(f,p))||p;return s&&F_(p,s),p}function uke(e){return e.map(t=>{const n=[];let s="",r=0;return t.forEach((i,o)=>{const l=!(i.fontStyle&&i.fontStyle&xu.Underline);l&&i.content.match(/^\s+$/)&&t[o+1]?(r||(r=i.offset),s+=i.content):s?(l?n.push({...i,offset:r,content:s+i.content}):n.push({content:s,offset:r},i),r=0,s=""):n.push(i)}),n})}function dke(e){return e.map(t=>t.flatMap(n=>{if(n.content.match(/^\s+$/))return n;const s=n.content.match(/^(\s*)(.*?)(\s*)$/);if(!s)return n;const[,r,i,o]=s;if(!r&&!o)return n;const a=[{...n,offset:n.offset+r.length,content:i}];return r&&a.unshift({content:r,offset:n.offset}),o&&a.push({content:o,offset:n.offset+r.length+i.length}),a}))}function hke(e,t,n){var i;const s={meta:{},options:n,codeToHast:(o,a)=>Kk(e,o,a),codeToTokens:(o,a)=>Gk(e,o,a)};let r=Oxe(Kk(e,t,n,s));for(const o of Vk(n))r=((i=o.postprocess)==null?void 0:i.call(s,r,n))||r;return r}const RD={light:"#333333",dark:"#bbbbbb"},jD={light:"#fffffe",dark:"#1e1e1e"},LD="__shiki_resolved";function PA(e){var a,l,c,d,h;if(e!=null&&e[LD])return e;const t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||(t.type="dark"),t.colorReplacements={...t.colorReplacements},t.settings||(t.settings=[]);let{bg:n,fg:s}=t;if(!n||!s){const f=t.settings?t.settings.find(p=>!p.name&&!p.scope):void 0;(a=f==null?void 0:f.settings)!=null&&a.foreground&&(s=f.settings.foreground),(l=f==null?void 0:f.settings)!=null&&l.background&&(n=f.settings.background),!s&&((c=t==null?void 0:t.colors)!=null&&c["editor.foreground"])&&(s=t.colors["editor.foreground"]),!n&&((d=t==null?void 0:t.colors)!=null&&d["editor.background"])&&(n=t.colors["editor.background"]),s||(s=t.type==="light"?RD.light:RD.dark),n||(n=t.type==="light"?jD.light:jD.dark),t.fg=s,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let r=0;const i=new Map;function o(f){var g;if(i.has(f))return i.get(f);r+=1;const p=`#${r.toString(16).padStart(8,"0").toLowerCase()}`;return(g=t.colorReplacements)!=null&&g[`#${p}`]?o(f):(i.set(f,p),p)}t.settings=t.settings.map(f=>{var w,v;const p=((w=f.settings)==null?void 0:w.foreground)&&!f.settings.foreground.startsWith("#"),g=((v=f.settings)==null?void 0:v.background)&&!f.settings.background.startsWith("#");if(!p&&!g)return f;const y={...f,settings:{...f.settings}};if(p){const b=o(f.settings.foreground);t.colorReplacements[b]=f.settings.foreground,y.settings.foreground=b}if(g){const b=o(f.settings.background);t.colorReplacements[b]=f.settings.background,y.settings.background=b}return y});for(const f of Object.keys(t.colors||{}))if((f==="editor.foreground"||f==="editor.background"||f.startsWith("terminal.ansi"))&&!((h=t.colors[f])!=null&&h.startsWith("#"))){const p=o(t.colors[f]);t.colorReplacements[p]=t.colors[f],t.colors[f]=p}return Object.defineProperty(t,LD,{enumerable:!1,writable:!1,value:!0}),t}async function IG(e){return Array.from(new Set((await Promise.all(e.filter(t=>!_G(t)).map(async t=>await TG(t).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function RG(e){return(await Promise.all(e.map(async n=>SG(n)?null:PA(await TG(n))))).filter(n=>!!n)}class fke extends Dwe{constructor(n,s,r,i={}){super(n);Me(this,"_resolvedThemes",new Map);Me(this,"_resolvedGrammars",new Map);Me(this,"_langMap",new Map);Me(this,"_langGraph",new Map);Me(this,"_textmateThemeCache",new WeakMap);Me(this,"_loadedThemesCache",null);Me(this,"_loadedLanguagesCache",null);this._resolver=n,this._themes=s,this._langs=r,this._alias=i,this._themes.map(o=>this.loadTheme(o)),this.loadLanguages(this._langs)}getTheme(n){return typeof n=="string"?this._resolvedThemes.get(n):this.loadTheme(n)}loadTheme(n){const s=PA(n);return s.name&&(this._resolvedThemes.set(s.name,s),this._loadedThemesCache=null),s}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(n){let s=this._textmateThemeCache.get(n);s||(s=$k.createFromRawTheme(n),this._textmateThemeCache.set(n,s)),this._syncRegistry.setTheme(s)}getGrammar(n){if(this._alias[n]){const s=new Set([n]);for(;this._alias[n];){if(n=this._alias[n],s.has(n))throw new Io(`Circular alias \`${Array.from(s).join(" -> ")} -> ${n}\``);s.add(n)}}return this._resolvedGrammars.get(n)}loadLanguage(n){var o,a,l,c;if(this.getGrammar(n.name))return;const s=new Set([...this._langMap.values()].filter(d=>{var h;return(h=d.embeddedLangsLazy)==null?void 0:h.includes(n.name)}));this._resolver.addLanguage(n);const r={balancedBracketSelectors:n.balancedBracketSelectors||["*"],unbalancedBracketSelectors:n.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(n.scopeName,n);const i=this.loadGrammarWithConfiguration(n.scopeName,1,r);if(i.name=n.name,this._resolvedGrammars.set(n.name,i),n.aliases&&n.aliases.forEach(d=>{this._alias[d]=n.name}),this._loadedLanguagesCache=null,s.size)for(const d of s)this._resolvedGrammars.delete(d.name),this._loadedLanguagesCache=null,(a=(o=this._syncRegistry)==null?void 0:o._injectionGrammars)==null||a.delete(d.scopeName),(c=(l=this._syncRegistry)==null?void 0:l._grammars)==null||c.delete(d.scopeName),this.loadLanguage(this._langMap.get(d.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(n){for(const i of n)this.resolveEmbeddedLanguages(i);const s=Array.from(this._langGraph.entries()),r=s.filter(([i,o])=>!o);if(r.length){const i=s.filter(([o,a])=>{var l;return a&&((l=a.embeddedLangs)==null?void 0:l.some(c=>r.map(([d])=>d).includes(c)))}).filter(o=>!r.includes(o));throw new Io(`Missing languages ${r.map(([o])=>`\`${o}\``).join(", ")}, required by ${i.map(([o])=>`\`${o}\``).join(", ")}`)}for(const[i,o]of s)this._resolver.addLanguage(o);for(const[i,o]of s)this.loadLanguage(o)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(n){if(this._langMap.set(n.name,n),this._langGraph.set(n.name,n),n.embeddedLangs)for(const s of n.embeddedLangs)this._langGraph.set(s,this._langMap.get(s))}}class mke{constructor(t,n){Me(this,"_langs",new Map);Me(this,"_scopeToLang",new Map);Me(this,"_injections",new Map);Me(this,"_onigLib");this._onigLib={createOnigScanner:s=>t.createScanner(s),createOnigString:s=>t.createString(s)},n.forEach(s=>this.addLanguage(s))}get onigLib(){return this._onigLib}getLangRegistration(t){return this._langs.get(t)}loadGrammar(t){return this._scopeToLang.get(t)}addLanguage(t){this._langs.set(t.name,t),t.aliases&&t.aliases.forEach(n=>{this._langs.set(n,t)}),this._scopeToLang.set(t.scopeName,t),t.injectTo&&t.injectTo.forEach(n=>{this._injections.get(n)||this._injections.set(n,[]),this._injections.get(n).push(t.scopeName)})}getInjections(t){const n=t.split(".");let s=[];for(let r=1;r<=n.length;r++){const i=n.slice(0,r).join(".");s=[...s,...this._injections.get(i)||[]]}return s}}let Fg=0;function pke(e){Fg+=1,e.warnings!==!1&&Fg>=10&&Fg%10===0&&console.warn(`[Shiki] ${Fg} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new Io("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),s=(e.themes||[]).flat(1).map(PA),r=new mke(e.engine,n),i=new fke(r,s,n,e.langAlias);let o;function a(b){w();const x=i.getGrammar(typeof b=="string"?b:b.name);if(!x)throw new Io(`Language \`${b}\` not found, you may need to load it first`);return x}function l(b){if(b==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};w();const x=i.getTheme(b);if(!x)throw new Io(`Theme \`${b}\` not found, you may need to load it first`);return x}function c(b){w();const x=l(b);o!==b&&(i.setTheme(x),o=b);const k=i.getColorMap();return{theme:x,colorMap:k}}function d(){return w(),i.getLoadedThemes()}function h(){return w(),i.getLoadedLanguages()}function f(...b){w(),i.loadLanguages(b.flat(1))}async function p(...b){return f(await IG(b))}function g(...b){w();for(const x of b.flat(1))i.loadTheme(x)}async function y(...b){return w(),g(await RG(b))}function w(){if(t)throw new Io("Shiki instance has been disposed")}function v(){t||(t=!0,i.dispose(),Fg-=1)}return{setTheme:c,getTheme:l,getLanguage:a,getLoadedThemes:d,getLoadedLanguages:h,loadLanguage:p,loadLanguageSync:f,loadTheme:y,loadThemeSync:g,dispose:v,[Symbol.dispose]:v}}async function gke(e={}){e.loadWasm;const[t,n,s]=await Promise.all([RG(e.themes||[]),IG(e.langs||[]),e.engine||nG(e.loadWasm||Yve())]);return pke({...e,themes:t,langs:n,engine:s})}async function yke(e={}){const t=await gke(e);return{getLastGrammarState:(...n)=>tke(t,...n),codeToTokensBase:(n,s)=>OA(t,n,s),codeToTokensWithThemes:(n,s)=>NG(t,n,s),codeToTokens:(n,s)=>Gk(t,n,s),codeToHast:(n,s)=>Kk(t,n,s),codeToHtml:(n,s)=>hke(t,n,s),...t,getInternalContext:()=>t}}function bke(e,t,n){let s,r,i;{const a=e;s=a.langs,r=a.themes,i=a.engine}async function o(a){function l(p){if(typeof p=="string"){if(_G(p))return[];const g=s[p];if(!g)throw new Au(`Language \`${p}\` is not included in this bundle. You may want to load it from external source.`);return g}return p}function c(p){if(SG(p))return"none";if(typeof p=="string"){const g=r[p];if(!g)throw new Au(`Theme \`${p}\` is not included in this bundle. You may want to load it from external source.`);return g}return p}const d=(a.themes??[]).map(p=>c(p)),h=(a.langs??[]).map(p=>l(p)),f=await yke({engine:a.engine??i(),...a,themes:d,langs:h});return{...f,loadLanguage(...p){return f.loadLanguage(...p.map(l))},loadTheme(...p){return f.loadTheme(...p.map(c))}}}return o}const vke=bke({langs:Mve,themes:Ive,engine:()=>nG(J(()=>import("./wasm-CG6Dc4jp.js"),[]))});/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const wke=["github-light-default","github-dark-default"];let ew=null,$T=null;const zT=new Set,a5=new Map,DD=new Set,xke=128,u1=new Map;function jG(e,t,n){return`${t}\0${n}\0${e}`}function kke(e,t){if(u1.size>=xke){const n=u1.keys().next().value;n!==void 0&&u1.delete(n)}u1.set(e,t)}function _ke(e,t,n){return u1.get(jG(e,t,n))??null}function Ske(){return ew||(ew=vke({langs:[],themes:wke}).then(e=>($T=e,e)).catch(e=>{throw ew=null,e})),ew}async function Cke(e){const t=await Ske();if(zT.has(e))return t;if(DD.has(e))throw new Error(`shiki: language "${e}" previously failed to load`);let n=a5.get(e);return n||(n=t.loadLanguage(e).then(()=>{zT.add(e)}).catch(s=>{throw DD.add(e),s}).finally(()=>{a5.delete(e)}),a5.set(e,n)),await n,t}const Tke=1e5,Eke=2e4;function Ake(e){if(e.length>Tke)return!0;let t=0;const n=e.length;for(let s=0;s<=n;s++)if(s===n||e.charCodeAt(s)===10){if(s-t>Eke)return!0;t=s+1}return!1}function OD(e,t,n,s=!0){if($T&&zT.has(t))try{const r=$T.codeToHtml(e,{lang:t,theme:n});return s&&kke(jG(e,t,n),r),r}catch(r){return console.warn("[web-shell] sync highlight failed for lang=%s",t,r),null}return null}const Mke=()=>{},Nke=()=>Mke,LG=m.createContext(Nke);function Ike(){return m.useContext(LG)}const Rke="_tableShell_14nne_1",jke="_densityCompact_14nne_11",Lke="_densityStandard_14nne_21",Dke="_densityComfortable_14nne_29",Oke="_toolbar_14nne_37",Pke="_summary_14nne_48",Bke="_hint_14nne_53",$ke="_selection_14nne_57",zke="_selectionStats_14nne_62",Fke="_selectionMetric_14nne_70",qke="_selectionMetricValue_14nne_74",Hke="_copyButton_14nne_80",Uke="_secondaryButton_14nne_81",Vke="_primaryButton_14nne_82",Wke="_copyCheck_14nne_91",Gke="_scroller_14nne_115",Kke="_table_14nne_1",Yke="_headerCell_14nne_137",Xke="_cell_14nne_138",Qke="_frozenHeaderCell_14nne_161",Jke="_headerControls_14nne_166",Zke="_headerButton_14nne_172",e2e="_filterTrigger_14nne_189",t2e="_headerText_14nne_193",n2e="_sortIcon_14nne_200",s2e="_activeHeaderCell_14nne_216",r2e="_reorderHandle_14nne_220",i2e="_reorderHandleVisible_14nne_243",o2e="_resizeHandle_14nne_263",a2e="_filterTriggerActive_14nne_282",l2e="_filterMenu_14nne_287",c2e="_columnContextMenu_14nne_303",u2e="_columnContextMenuAction_14nne_316",d2e="_filterMenuTitle_14nne_334",h2e="_filterMenuSection_14nne_344",f2e="_filterMenuAction_14nne_352",m2e="_activeAction_14nne_365",p2e="_filterSearch_14nne_374",g2e="_conditionInput_14nne_375",y2e="_conditionSelect_14nne_376",b2e="_filterOptionList_14nne_392",v2e="_filterOption_14nne_392",w2e="_optionLabel_14nne_418",x2e="_optionCount_14nne_426",k2e="_optionLimitHint_14nne_432",_2e="_conditionTitle_14nne_438",S2e="_conditionInputs_14nne_443",C2e="_filterFooter_14nne_448",T2e="_footerSpacer_14nne_455",E2e="_cellContent_14nne_473",A2e="_detailValueContent_14nne_474",M2e="_cellText_14nne_480",N2e="_detailValueText_14nne_481",I2e="_cellContentCollapsed_14nne_487",R2e="_detailValueCollapsed_14nne_488",j2e="_dragging_14nne_495",L2e="_evenRow_14nne_499",D2e="_selectedCell_14nne_507",O2e="_actionHeaderCell_14nne_514",P2e="_actionCell_14nne_515",B2e="_stickyActionHeaderCell_14nne_523",$2e="_stickyActionCell_14nne_524",z2e="_frozenCell_14nne_540",F2e="_hasFrozenColumn_14nne_546",q2e="_rowDetailButton_14nne_593",H2e="_detailRow_14nne_608",U2e="_detailCell_14nne_612",V2e="_detailPanel_14nne_619",W2e="_detailTitle_14nne_625",G2e="_detailItem_14nne_630",K2e="_detailLabel_14nne_637",Y2e="_detailValue_14nne_474",X2e="_themeDark_14nne_652",Q2e="_themeLight_14nne_661",J2e="_cellDialogBackdrop_14nne_670",Z2e="_cellDialog_14nne_670",e_e="_cellDialogCloseIcon_14nne_701",t_e="_cellDialogTitle_14nne_722",n_e="_cellDialogValue_14nne_729",s_e="_cellDialogFooter_14nne_747",r_e="_cellDialogActions_14nne_756",i_e="_cellDialogButton_14nne_762",o_e="_cellDialogPrimaryButton_14nne_778",a_e="_emptyValue_14nne_787",l_e="_emptyState_14nne_792",$e={tableShell:Rke,densityCompact:jke,densityStandard:Lke,densityComfortable:Dke,toolbar:Oke,summary:Pke,hint:Bke,selection:$ke,selectionStats:zke,selectionMetric:Fke,selectionMetricValue:qke,copyButton:Hke,secondaryButton:Uke,primaryButton:Vke,copyCheck:Wke,scroller:Gke,table:Kke,headerCell:Yke,cell:Xke,frozenHeaderCell:Qke,headerControls:Jke,headerButton:Zke,filterTrigger:e2e,headerText:t2e,sortIcon:n2e,activeHeaderCell:s2e,reorderHandle:r2e,reorderHandleVisible:i2e,resizeHandle:o2e,filterTriggerActive:a2e,filterMenu:l2e,columnContextMenu:c2e,columnContextMenuAction:u2e,filterMenuTitle:d2e,filterMenuSection:h2e,filterMenuAction:f2e,activeAction:m2e,filterSearch:p2e,conditionInput:g2e,conditionSelect:y2e,filterOptionList:b2e,filterOption:v2e,optionLabel:w2e,optionCount:x2e,optionLimitHint:k2e,conditionTitle:_2e,conditionInputs:S2e,filterFooter:C2e,footerSpacer:T2e,cellContent:E2e,detailValueContent:A2e,cellText:M2e,detailValueText:N2e,cellContentCollapsed:I2e,detailValueCollapsed:R2e,dragging:j2e,evenRow:L2e,selectedCell:D2e,actionHeaderCell:O2e,actionCell:P2e,stickyActionHeaderCell:B2e,stickyActionCell:$2e,frozenCell:z2e,hasFrozenColumn:F2e,rowDetailButton:q2e,detailRow:H2e,detailCell:U2e,detailPanel:V2e,detailTitle:W2e,detailItem:G2e,detailLabel:K2e,detailValue:Y2e,themeDark:X2e,themeLight:Q2e,cellDialogBackdrop:J2e,cellDialog:Z2e,cellDialogCloseIcon:e_e,cellDialogTitle:t_e,cellDialogValue:n_e,cellDialogFooter:s_e,cellDialogActions:r_e,cellDialogButton:i_e,cellDialogPrimaryButton:o_e,emptyValue:a_e,emptyState:l_e},c_e={contains:"markdownTable.filter.text.contains",equals:"markdownTable.filter.text.equals",notEquals:"markdownTable.filter.text.notEquals",startsWith:"markdownTable.filter.text.startsWith",endsWith:"markdownTable.filter.text.endsWith"},u_e={gt:"markdownTable.filter.number.gt",gte:"markdownTable.filter.number.gte",lt:"markdownTable.filter.number.lt",lte:"markdownTable.filter.number.lte",between:"markdownTable.filter.number.between"},d_e=500,h_e=50,lh=160,DG=80,OG=640,PD=16,PG="application/x-qwen-web-shell-table-column",f_e=60,m_e=3,l5=["standard","compact","comfortable"],p_e={width:lh,minWidth:lh,maxWidth:lh},g_e={width:"auto"};function BD(e){return Math.min(OG,Math.max(DG,e))}const y_e='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])',b_e='a[href]:not([hidden]), button:not([disabled]):not([hidden]), input:not([disabled]):not([hidden]), select:not([disabled]):not([hidden]), textarea:not([disabled]):not([hidden]), [tabindex]:not([tabindex="-1"]):not([hidden])';function v_e(e){return Array.from(e.querySelectorAll(y_e)).filter(t=>!t.hasAttribute("hidden"))}function $D(e){return e?Array.from(e.querySelectorAll(b_e)):[]}function c5(e){return e instanceof Element&&!!e.closest('a, button, input, textarea, select, [contenteditable="true"]')}function w_e(){const e=document.getSelection();return!!(e&&!e.isCollapsed)}function Mf(e,t){return m.isValidElement(e)&&e.type===t}function x_e(e){return e.replace(/\s+/g," ").trim()}function u5(e){return e.length>f_e||e.split(/\r\n|\r|\n/).length>m_e}function k_e(e){const t=l5.indexOf(e);return l5[(t+1)%l5.length]??"standard"}function __e(e){switch(e){case"compact":return $e.densityCompact;case"comfortable":return $e.densityComfortable;case"standard":default:return $e.densityStandard}}function FT(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(FT).join(""):m.isValidElement(e)?e.type==="img"?e.props.alt??"":FT(e.props.children):""}function S_e(e,t){return{key:`${e}-empty-${t}`,content:"",text:"",rawText:"",isHeader:!1}}function BG(e,t){const n=m.Children.toArray(e.props.children).filter(s=>Mf(s,"td")||Mf(s,"th"));return{key:t,cells:n.map((s,r)=>{var o;const i=FT(s.props.children);return{key:`${t}-${r}`,content:s.props.children,text:x_e(i),rawText:i,isHeader:s.type==="th",textAlign:(o=s.props.style)==null?void 0:o.textAlign}})}}function d5(e,t){return m.Children.toArray(e.props.children).filter(n=>Mf(n,"tr")).map((n,s)=>BG(n,`${t}-${s}`))}function C_e(e,t){return{...e,cells:Array.from({length:t},(n,s)=>e.cells[s]??S_e(e.key,s))}}function T_e(e,t){const n=m.Children.toArray(e),s=[],r=[],i=[];if(n.forEach((d,h)=>{Mf(d,"thead")?s.push(...d5(d,`head-${h}`)):Mf(d,"tbody")?r.push(...d5(d,`body-${h}`)):Mf(d,"tfoot")?r.push(...d5(d,`foot-${h}`)):Mf(d,"tr")&&i.push(BG(d,`row-${h}`))}),i.length>0){const[d,...h]=i;d!=null&&d.cells.some(f=>f.isHeader)?(s.push(d),r.push(...h)):r.push(...i)}const o=[...s,...r],a=Math.max(0,...o.map(d=>d.cells.length)),l=s[0];return{headers:Array.from({length:a},(d,h)=>{const f=l==null?void 0:l.cells[h];if(f)return f;const p=t(h);return{key:`header-${h}`,content:p,text:p,rawText:p,isHeader:!0}}),rows:r.map(d=>C_e(d,a)),columnCount:a}}function Mu(e){const t=e.trim(),n=t.endsWith("%"),r=(n?t.slice(0,-1):t).replace(/[$€£¥₹,\s]/g,"");if(!/^-?(\d+(\.\d+)?|\.\d+)$/.test(r))return null;const i=Number(r);return Number.isFinite(i)?n?i/100:i:null}function $G(e,t){const n=Mu(e),s=Mu(t);return n!==null&&s!==null&&n!==s?n-s:e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}function Yk(e){return{minRow:Math.min(e.anchorRow,e.focusRow),maxRow:Math.max(e.anchorRow,e.focusRow)}}function BA(e,t){if(!e)return[];const n=t.indexOf(e.anchorCol),s=t.indexOf(e.focusCol);if(n===-1||s===-1)return[];const r=Math.min(n,s),i=Math.max(n,s);return t.slice(r,i+1)}function Xk(e){const t=e.replace(/[\u200B-\u200D\u2060\u00AD\uFEFF]/g,"").trimStart();return/^[=+\-@]/.test(t)?`'${e}`:e}function qT(e){return((e==null?void 0:e.rawText)??(e==null?void 0:e.text)??"").replace(/[\r\n\t]+/g," ")}function h5(e){return e.rawText||e.text}function zD(e,t,n){if((e[t]??lh)===n)return e;if(n===lh){const r={...e};return delete r[t],r}return{...e,[t]:n}}function FD(e,t,n){if(!e)return"";const{minRow:s,maxRow:r}=Yk(e),i=BA(e,n);if(i.length===0)return"";const o=[];for(let a=s;a<=r;a++){const l=t[a];l&&o.push(i.map(c=>Xk(qT(l.cells[c]))).join("	"))}return o.join(`
`)}function E_e(e,t,n){return n.length===0?"":[n.map(r=>Xk(qT(e[r]))).join("	"),...t.map(r=>n.map(i=>Xk(qT(r.cells[i]))).join("	"))].join(`
`)}function A_e(e,t,n){if(!e)return null;const{minRow:s,maxRow:r}=Yk(e),i=BA(e,n);if(i.length===0)return null;let o=0,a=0,l=0,c=0,d=1/0,h=-1/0,f=!0,p=!0,g;for(let w=s;w<=r;w++){const v=t[w];v&&i.forEach(b=>{const x=v.cells[b];if(!x)return;o+=1;const k=x.text.trim();if(!k)return;a+=1;const T=Mu(k);if(T===null)return;l+=1,c+=T,d=Math.min(d,T),h=Math.max(h,T),f=f&&k.endsWith("%");const C=k.match(/[$€£¥₹]/g),S=(C==null?void 0:C.length)===1?C[0]:void 0;S?g===void 0?g=S:g!==S&&(p=!1):p=!1})}if(o===0)return null;const y=l>0&&f?"percent":l>0&&p&&g?"currency":"number";return{selectedCount:o,nonEmptyCount:a,numericCount:l,sum:c,average:l>0?c/l:0,min:l>0?d:0,max:l>0?h:0,format:y,currencySymbol:g}}function tw(e,t,n){const s=Object.is(e,-0)?0:e,r=n==="en"?"en-US":n;if(t.format==="percent")return new Intl.NumberFormat(r,{style:"percent",maximumFractionDigits:6}).format(s);const i=new Intl.NumberFormat(r,{maximumFractionDigits:6}).format(Math.abs(s));return t.format==="currency"&&t.currencySymbol?`${s<0?"-":""}${t.currencySymbol}${i}`:s<0?`-${i}`:i}function qD(e,t,n){if(t===n)return e;const s=e.indexOf(t),r=e.indexOf(n);if(s===-1||r===-1)return e;const i=[...e],[o]=i.splice(s,1);return o===void 0?e:(i.splice(r,0,o),i)}function M_e(e,t,n,s){if(s.size===0)return qD(e,t,n);const r=e.filter(a=>!s.has(a)),i=qD(r,t,n);if(i===r)return e;let o=0;return e.map(a=>{if(s.has(a))return a;const l=i[o];return o+=1,l??a})}function HD(e){return Array.from({length:e},(t,n)=>n)}function UD(e){return Array.from(e.types).includes(PG)}function G1(e){var t,n;return e?!!(e.selectedValues!==void 0||(t=e.textFilter)!=null&&t.value.trim()||(n=e.numberFilter)!=null&&n.value.trim()):!1}function N_e(e,t){if(!(t!=null&&t.value.trim()))return!0;const n=e.toLowerCase(),s=t.value.trim().toLowerCase();switch(t.operator){case"equals":return n===s;case"notEquals":return n!==s;case"startsWith":return n.startsWith(s);case"endsWith":return n.endsWith(s);case"contains":default:return n.includes(s)}}function I_e(e,t){if(!(t!=null&&t.value.trim()))return!0;const n=Mu(e),s=Mu(t.value);if(n===null||s===null)return!1;switch(t.operator){case"gt":return n>s;case"gte":return n>=s;case"lt":return n<s;case"lte":return n<=s;case"between":{const r=Mu(t.valueTo??"");if(r===null)return!1;const i=Math.min(s,r),o=Math.max(s,r);return n>=i&&n<=o}default:return!0}}function R_e(e,t){return t.selectedValues!==void 0&&!t.selectedValues.includes(e)?!1:N_e(e,t.textFilter)&&I_e(e,t.numberFilter)}function VD(e,t,n){const s=Object.entries(t).map(([r,i])=>[Number(r),i]).filter(([r,i])=>r!==n&&G1(i));return s.length===0?e:e.filter(r=>s.every(([i,o])=>{var a;return R_e(((a=r.cells[i])==null?void 0:a.text)??"",o)}))}function j_e(e,t){return t?e.map((n,s)=>({row:n,index:s})).sort((n,s)=>{var o,a;const r=$G(((o=n.row.cells[t.columnIndex])==null?void 0:o.text)??"",((a=s.row.cells[t.columnIndex])==null?void 0:a.text)??""),i=t.direction==="asc"?r:-r;return i===0?n.index-s.index:i}).map(({row:n})=>n):e}function L_e(e,t,n){const s=new Map;return e.forEach(r=>{var o;const i=((o=r.cells[t])==null?void 0:o.text)??"";s.set(i,(s.get(i)??0)+1)}),Array.from(s.entries()).map(([r,i])=>({value:r,label:r||n,count:i})).sort((r,i)=>$G(r.value,i.value))}function D_e(e,t){let n=0,s=0;return e.forEach(r=>{var o;const i=((o=r.cells[t])==null?void 0:o.text)??"";i&&(n+=1,Mu(i)!==null&&(s+=1))}),n>0&&s/n>=.7}function O_e(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(s=>n.has(s))}function P_e(e,t){var s,r,i;const n={};if(e.selectedValues!==void 0&&!O_e(e.selectedValues,t)&&(n.selectedValues=e.selectedValues),(s=e.textFilter)!=null&&s.value.trim()&&(n.textFilter={operator:e.textFilter.operator,value:e.textFilter.value.trim()}),(r=e.numberFilter)!=null&&r.value.trim()){const o=e.numberFilter.value.trim(),a=(i=e.numberFilter.valueTo)==null?void 0:i.trim();Mu(o)!==null&&(e.numberFilter.operator!=="between"||Mu(a??"")!==null)&&(n.numberFilter={operator:e.numberFilter.operator,value:o,valueTo:a})}return G1(n)?n:void 0}function B_e({columnIndex:e,sortedThisColumn:t,onSort:n}){const{t:s}=ot();return u.jsxs("div",{className:$e.filterMenuSection,children:[u.jsx("button",{className:`${$e.filterMenuAction} ${(t==null?void 0:t.direction)==="asc"?$e.activeAction:""}`,type:"button",onClick:()=>n(e,"asc"),children:s("markdownTable.sort.asc")}),u.jsx("button",{className:`${$e.filterMenuAction} ${(t==null?void 0:t.direction)==="desc"?$e.activeAction:""}`,type:"button",onClick:()=>n(e,"desc"),children:s("markdownTable.sort.desc")}),u.jsx("button",{className:$e.filterMenuAction,type:"button",onClick:()=>n(e,null),children:s("markdownTable.sort.clear")})]})}function $_e({onHideColumn:e}){const{t}=ot();return u.jsx("div",{className:$e.filterMenuSection,children:u.jsx("button",{className:$e.filterMenuAction,type:"button",onClick:e,children:t("markdownTable.hideColumn")})})}function z_e({columnIndex:e,columnName:t,search:n,searchInputRef:s,filteredOptions:r,visibleOptions:i,selectedValues:o,allFilteredSelected:a,onSearchChange:l,onFilteredSelectionChange:c,onToggleValue:d}){const{t:h}=ot();return u.jsxs("div",{className:$e.filterMenuSection,children:[u.jsx("input",{ref:s,className:$e.filterSearch,value:n,onChange:f=>l(f.currentTarget.value),placeholder:h("markdownTable.filter.searchPlaceholder"),name:`markdown-table-option-search-${e}`,"aria-label":h("markdownTable.filter.searchAria",{column:t})}),u.jsxs("label",{className:$e.filterOption,children:[u.jsx("input",{type:"checkbox",name:`markdown-table-filter-all-${e}`,checked:a,onChange:f=>c(f.currentTarget.checked)}),u.jsx("span",{children:h("markdownTable.filter.selectVisible")}),u.jsx("span",{className:$e.optionCount,children:r.length})]}),u.jsxs("div",{className:$e.filterOptionList,children:[i.map((f,p)=>u.jsxs("label",{className:$e.filterOption,children:[u.jsx("input",{type:"checkbox",name:`markdown-table-filter-option-${e}-${p}`,checked:o.has(f.value),onChange:()=>d(f.value)}),u.jsx("span",{className:$e.optionLabel,children:f.label}),u.jsx("span",{className:$e.optionCount,children:f.count})]},f.value)),r.length>i.length&&u.jsx("div",{className:$e.optionLimitHint,children:h("markdownTable.filter.optionLimit",{count:i.length})}),r.length===0&&u.jsx("div",{className:$e.optionLimitHint,children:h("markdownTable.filter.noOptions")})]})]})}function F_e({columnIndex:e,columnName:t,isNumeric:n,textOperator:s,textValue:r,numberOperator:i,numberValue:o,numberValueTo:a,onTextOperatorChange:l,onTextValueChange:c,onNumberOperatorChange:d,onNumberValueChange:h,onNumberValueToChange:f}){const{t:p}=ot();return u.jsxs("div",{className:$e.filterMenuSection,children:[u.jsx("div",{className:$e.conditionTitle,children:p("markdownTable.filter.custom")}),n?u.jsxs(u.Fragment,{children:[u.jsx("select",{className:$e.conditionSelect,value:i,name:`markdown-table-number-operator-${e}`,onChange:g=>d(g.currentTarget.value),"aria-label":p("markdownTable.filter.numberAria",{column:t}),children:Object.entries(u_e).map(([g,y])=>u.jsx("option",{value:g,children:p(y)},g))}),u.jsxs("div",{className:$e.conditionInputs,children:[u.jsx("input",{className:$e.conditionInput,value:o,onChange:g=>h(g.currentTarget.value),placeholder:p("markdownTable.filter.numberPlaceholder"),name:`markdown-table-number-filter-${e}`}),i==="between"&&u.jsx("input",{className:$e.conditionInput,value:a,onChange:g=>f(g.currentTarget.value),placeholder:p("markdownTable.filter.toPlaceholder"),name:`markdown-table-number-filter-to-${e}`})]})]}):u.jsxs(u.Fragment,{children:[u.jsx("select",{className:$e.conditionSelect,value:s,name:`markdown-table-text-operator-${e}`,onChange:g=>l(g.currentTarget.value),"aria-label":p("markdownTable.filter.textAria",{column:t}),children:Object.entries(c_e).map(([g,y])=>u.jsx("option",{value:g,children:p(y)},g))}),u.jsx("input",{className:$e.conditionInput,value:r,onChange:g=>c(g.currentTarget.value),placeholder:p("markdownTable.filter.textPlaceholder"),name:`markdown-table-text-filter-${e}`})]})]})}function q_e({onClear:e,onClose:t,onApply:n}){const{t:s}=ot();return u.jsxs("div",{className:$e.filterFooter,children:[u.jsx("button",{className:$e.secondaryButton,type:"button",onClick:e,children:s("markdownTable.filter.reset")}),u.jsx("span",{className:$e.footerSpacer}),u.jsx("button",{className:$e.secondaryButton,type:"button",onClick:t,children:s("markdownTable.filter.cancel")}),u.jsx("button",{className:$e.primaryButton,type:"button",onClick:n,children:s("markdownTable.filter.confirm")})]})}function H_e({id:e,columnName:t,columnIndex:n,filter:s,isNumeric:r,options:i,sort:o,style:a,menuRef:l,canHideColumn:c,onApply:d,onClose:h,onHideColumn:f,onSort:p}){var q,N,ee,re,Q;const g=m.useMemo(()=>i.map(K=>K.value),[i]),[y,w]=m.useState(""),[v,b]=m.useState(()=>new Set((s==null?void 0:s.selectedValues)??g)),[x,k]=m.useState(((q=s==null?void 0:s.textFilter)==null?void 0:q.operator)??"contains"),[T,C]=m.useState(((N=s==null?void 0:s.textFilter)==null?void 0:N.value)??""),[S,_]=m.useState(((ee=s==null?void 0:s.numberFilter)==null?void 0:ee.operator)??"gt"),[L,M]=m.useState(((re=s==null?void 0:s.numberFilter)==null?void 0:re.value)??""),[I,A]=m.useState(((Q=s==null?void 0:s.numberFilter)==null?void 0:Q.valueTo)??""),P=m.useRef(null);m.useEffect(()=>{var K;(K=P.current)==null||K.focus()},[]);const B=m.useMemo(()=>{const K=y.trim().toLowerCase();return K?i.filter(se=>se.label.toLowerCase().includes(K)):i},[i,y]),F=B.slice(0,500),O=B.length>0&&B.every(K=>v.has(K.value)),X=K=>{b(se=>{const te=new Set(se);return B.forEach(ce=>{K?te.add(ce.value):te.delete(ce.value)}),te})},z=K=>{b(se=>{const te=new Set(se);return te.has(K)?te.delete(K):te.add(K),te})},U=()=>{d(n,P_e({selectedValues:Array.from(v),textFilter:{operator:x,value:T},numberFilter:{operator:S,value:L,valueTo:I}},g))},D=()=>{d(n,void 0)},G=(o==null?void 0:o.columnIndex)===n?o:null;return u.jsxs("div",{ref:l,id:e,className:$e.filterMenu,style:a,role:"dialog","aria-labelledby":`${e}-title`,children:[u.jsx("div",{id:`${e}-title`,className:$e.filterMenuTitle,children:t}),u.jsx(B_e,{columnIndex:n,sortedThisColumn:G,onSort:p}),c&&u.jsx($_e,{onHideColumn:()=>f(n)}),u.jsx(z_e,{columnIndex:n,columnName:t,search:y,searchInputRef:P,filteredOptions:B,visibleOptions:F,selectedValues:v,allFilteredSelected:O,onSearchChange:w,onFilteredSelectionChange:X,onToggleValue:z}),u.jsx(F_e,{columnIndex:n,columnName:t,isNumeric:r,textOperator:x,textValue:T,numberOperator:S,numberValue:L,numberValueTo:I,onTextOperatorChange:k,onTextValueChange:C,onNumberOperatorChange:_,onNumberValueChange:M,onNumberValueToChange:A}),u.jsx(q_e,{onClear:D,onClose:h,onApply:U})]})}function U_e({children:e,fallback:t,toolbarExtra:n}){const{t:s}=ot(),r=m.useMemo(()=>T_e(e,i=>s("markdownTable.column",{index:i+1})),[e,s]);return r.columnCount===0?u.jsx(u.Fragment,{children:t??u.jsx("table",{children:e})}):r.rows.length>d_e||r.columnCount>h_e?u.jsx(u.Fragment,{children:t??u.jsx("table",{children:e})}):u.jsx(V_e,{table:r,toolbarExtra:n})}function V_e({table:e,toolbarExtra:t}){const{language:n,t:s}=ot(),r=V0(),i=Ike(),o=m.useId(),[a,l]=m.useState(null),[c,d]=m.useState({}),[h,f]=m.useState(null),[p,g]=m.useState(null),[y,w]=m.useState(null),[v,b]=m.useState(()=>new Set),[x,k]=m.useState({}),[T,C]=m.useState(()=>HD(e.columnCount)),[S,_]=m.useState(null),[L,M]=m.useState(!1),[I,A]=m.useState(null),[P,B]=m.useState(null),[F,O]=m.useState(null),[X,z]=m.useState(!1),[U,D]=m.useState("standard"),[G,q]=m.useState(!1),[N,ee]=m.useState(!1),[re,Q]=m.useState(!1),[K,se]=m.useState(!1),te=m.useRef(!1),ce=m.useRef(null),oe=m.useRef(null),de=m.useRef(null),Te=m.useRef(0),qe=m.useRef(0),Ne=m.useRef(0),ge=m.useRef(!0),Ee=m.useRef(null),_t=m.useRef(null),Ct=m.useRef(null),Je=m.useRef(null),at=m.useRef(null),Oe=m.useRef(null),Fe=m.useRef(null),ue=m.useRef(0),vt=m.useRef(null),ye=m.useRef(0),je=m.useRef(0),Ye=m.useRef(null),Nt=m.useRef(null),Rt=m.useMemo(()=>`${e.columnCount}\0${e.headers.map(W=>W.text).join("\0")}`,[e.columnCount,e.headers]),rn=m.useRef(Rt),on=m.useCallback(()=>{ue.current&&cancelAnimationFrame(ue.current),ue.current=requestAnimationFrame(()=>{ue.current=0;const W=at.current;W!=null&&W.isConnected&&W.focus()})},[]),Bn=m.useCallback(()=>{g(null),on()},[on]),bs=m.useCallback(()=>{Te.current+=1,ce.current&&(clearTimeout(ce.current),ce.current=null),ee(!1)},[]),Ss=m.useCallback(()=>{qe.current+=1,oe.current&&(clearTimeout(oe.current),oe.current=null),Q(!1)},[]),Ie=m.useCallback(()=>{Ne.current+=1,de.current&&(clearTimeout(de.current),de.current=null),se(!1)},[]),lt=m.useCallback(()=>{ye.current&&(cancelAnimationFrame(ye.current),ye.current=0);const W=vt.current;vt.current=null,W&&f(fe=>fe&&{...fe,focusRow:W.rowIndex,focusCol:W.columnIndex})},[]),ne=m.useCallback(()=>{lt(),te.current=!1,q(!1)},[lt]);m.useEffect(()=>{const W=()=>{document.hidden&&ne()};return window.addEventListener("mouseup",ne),window.addEventListener("blur",ne),document.addEventListener("visibilitychange",W),()=>{window.removeEventListener("mouseup",ne),window.removeEventListener("blur",ne),document.removeEventListener("visibilitychange",W),ye.current&&cancelAnimationFrame(ye.current),ue.current&&cancelAnimationFrame(ue.current)}},[ne]),m.useEffect(()=>{rn.current!==Rt&&(rn.current=Rt,l(null),d({}),f(null),g(null),w(null),b(new Set),k({}),C(HD(e.columnCount)),_(null),M(!1),A(null),B(null),O(null),z(!1),D("standard"),bs(),Ss(),Ie(),te.current=!1,Nt.current=null,q(!1))},[Ss,Ie,bs,e.columnCount,Rt]),m.useEffect(()=>{Ss()},[Ss,h]),m.useEffect(()=>(ge.current=!0,()=>{ge.current=!1,ce.current&&(clearTimeout(ce.current),ce.current=null),oe.current&&(clearTimeout(oe.current),oe.current=null),de.current&&(clearTimeout(de.current),de.current=null)}),[]),m.useEffect(()=>{if(!p)return;const W=Ge=>{var dn,hn;const zt=Ge.target;!((dn=Ct.current)!=null&&dn.contains(zt))&&!((hn=at.current)!=null&&hn.contains(zt))&&g(null)},fe=Ge=>{var Ms;if(Ge.key==="Escape"){Ge.preventDefault(),Bn();return}if(Ge.key!=="Tab")return;const zt=Ct.current,dn=document.activeElement;if(!zt||!(dn instanceof Node)||!zt.contains(dn))return;const hn=v_e(zt);if(hn.length===0)return;const ds=dn instanceof HTMLElement?hn.indexOf(dn):-1,Ws=Ge.shiftKey?ds<=0?hn.length-1:ds-1:ds===-1||ds===hn.length-1?0:ds+1;Ge.preventDefault(),(Ms=hn[Ws])==null||Ms.focus()},Ae=Ge=>{var dn;const zt=Ge.target;zt instanceof Node&&((dn=Ct.current)!=null&&dn.contains(zt))||g(null)},He=()=>g(null);return document.addEventListener("mousedown",W),document.addEventListener("keydown",fe),document.addEventListener("scroll",Ae,!0),window.addEventListener("resize",He),()=>{document.removeEventListener("mousedown",W),document.removeEventListener("keydown",fe),document.removeEventListener("scroll",Ae,!0),window.removeEventListener("resize",He)}},[Bn,p]),m.useEffect(()=>{if(!y)return;const W=He=>{var zt;const Ge=He.target;(zt=Je.current)!=null&&zt.contains(Ge)||w(null)},fe=He=>{He.key==="Escape"&&(He.preventDefault(),w(null))},Ae=()=>w(null);return document.addEventListener("mousedown",W),document.addEventListener("keydown",fe),document.addEventListener("scroll",Ae,!0),window.addEventListener("resize",Ae),()=>{document.removeEventListener("mousedown",W),document.removeEventListener("keydown",fe),document.removeEventListener("scroll",Ae,!0),window.removeEventListener("resize",Ae)}},[y]),m.useEffect(()=>{const W=Ae=>{var Ge,zt;const He=Ae.target;He instanceof Node&&!((Ge=Ee.current)!=null&&Ge.contains(He))&&!((zt=Je.current)!=null&&zt.contains(He))&&_(null)},fe=Ae=>{Ae.defaultPrevented||p||F||y||Ae.key==="Escape"&&_(null)};return document.addEventListener("mousedown",W),document.addEventListener("keydown",fe),()=>{document.removeEventListener("mousedown",W),document.removeEventListener("keydown",fe)}},[F,y,p]);const he=m.useMemo(()=>VD(e.rows,c),[c,e.rows]),Ve=m.useMemo(()=>j_e(he,a),[he,a]);m.useEffect(()=>{f(W=>W&&(Yk(W).maxRow<Ve.length?W:null))},[Ve.length]);const we=m.useMemo(()=>{if(!p)return[];const W=p.columnIndex;return L_e(VD(e.rows,c,W),W,s("markdownTable.blank"))},[c,p,s,e.rows]),Bt=m.useMemo(()=>e.headers.map((W,fe)=>D_e(e.rows,fe)),[e.headers,e.rows]),Et=m.useMemo(()=>T.filter(W=>W>=0&&W<e.columnCount).filter(W=>!v.has(W)),[T,v,e.columnCount]),Tt=L?Et[0]:void 0,an=m.useMemo(()=>{if(!F)return null;const W=Ve.find(fe=>fe.key===F.rowKey);return(W==null?void 0:W.cells[F.columnIndex])??null},[F,Ve]),wt=an==null?void 0:an.text,It=r===gr.Light?$e.themeLight:$e.themeDark;m.useEffect(()=>{bs()},[bs,Et,Ve]),m.useEffect(()=>{if(!I)return;const W=()=>{const Ge=Ye.current;Ye.current=null,je.current&&(cancelAnimationFrame(je.current),je.current=0),Ge!==null&&k(zt=>zD(zt,I.columnIndex,Ge))},fe=Ge=>{Ye.current=BD(I.startWidth+Ge.clientX-I.startX),!je.current&&(je.current=requestAnimationFrame(W))},Ae=()=>{W(),A(null)},He=()=>{document.hidden&&Ae()};return window.addEventListener("mousemove",fe),window.addEventListener("mouseup",Ae),window.addEventListener("blur",Ae),document.addEventListener("visibilitychange",He),()=>{window.removeEventListener("mousemove",fe),window.removeEventListener("mouseup",Ae),window.removeEventListener("blur",Ae),document.removeEventListener("visibilitychange",He),je.current&&(cancelAnimationFrame(je.current),je.current=0),Ye.current=null}},[I]),m.useEffect(()=>{P&&!Ve.some(W=>W.key===P)&&B(null),F&&!Ve.some(W=>W.key===F.rowKey&&W.cells[F.columnIndex])&&O(null)},[F,P,Ve]),m.useEffect(()=>{if(F)return i()},[F,i]),m.useEffect(()=>{F&&Ie()},[F,wt,Ie]),m.useEffect(()=>{var He;if(!F)return;const W=Oe.current;(He=$D(W)[0]??W)==null||He.focus();const Ae=Ge=>{var Ms;if(Ge.defaultPrevented||Ge.isComposing||Ge.keyCode===229)return;if(Ge.key==="Escape"){Ge.preventDefault(),Ge.stopPropagation(),O(null),Ie();return}if(Ge.key!=="Tab")return;const zt=$D(Oe.current);if(zt.length===0){Ge.preventDefault(),(Ms=Oe.current)==null||Ms.focus();return}const dn=zt[0],hn=zt[zt.length-1],ds=document.activeElement,Ws=ds instanceof HTMLElement?zt.indexOf(ds):-1;Ge.shiftKey&&(ds===dn||Ws===-1)?(Ge.preventDefault(),hn==null||hn.focus()):!Ge.shiftKey&&(ds===hn||Ws===-1)&&(Ge.preventDefault(),dn==null||dn.focus())};return document.addEventListener("keydown",Ae),()=>{document.removeEventListener("keydown",Ae);const Ge=Fe.current;Fe.current=null,Ge!=null&&Ge.isConnected&&Ge.focus()}},[F,Ie]);const Vn=(W,fe)=>{f(null),d(Ae=>{const He={...Ae};return fe&&G1(fe)?He[W]=fe:delete He[W],He}),Bn()},kn=(W,fe)=>{f(null),_(W),l(fe?{columnIndex:W,direction:fe}:null)},ln=W=>{f(null),_(W),l(fe=>(fe==null?void 0:fe.columnIndex)!==W?{columnIndex:W,direction:"asc"}:fe.direction==="asc"?{columnIndex:W,direction:"desc"}:null)},Wn=(W,fe)=>{f(null),_(fe),w(null),at.current=W.currentTarget;const Ae=W.currentTarget.getBoundingClientRect(),He=300,Ge=430,zt={columnIndex:fe,left:Math.max(6,Math.min(Ae.right-He,window.innerWidth-He-6)),top:window.innerHeight-Ae.bottom<Ge?Math.max(8,Ae.top-Ge-2):Ae.bottom+2};g(dn=>(dn==null?void 0:dn.columnIndex)===fe?null:zt)},Jn=W=>{Et.length<=1||(f(null),_(fe=>fe===W?null:fe),Bn(),d(fe=>{const Ae={...fe};return delete Ae[W],Ae}),l(fe=>(fe==null?void 0:fe.columnIndex)===W?null:fe),b(fe=>{const Ae=new Set(fe);return Ae.add(W),Ae}))},Cs=()=>{f(null),b(new Set)},fr=()=>{M(W=>!W),w(null)},Xs=(W,fe)=>{if(fe!==Et[0])return;W.preventDefault(),f(null),_(fe),g(null),w({left:Math.max(6,Math.min(W.clientX,window.innerWidth-220-6)),top:Math.max(6,Math.min(W.clientY,window.innerHeight-72-6))})},Vs=()=>{D(W=>k_e(W))},_n=W=>{f(null),O(null),Ie(),B(fe=>fe===W?null:W)},fn=(W,fe)=>{Fe.current=document.activeElement instanceof HTMLElement?document.activeElement:null,f(null),g(null),B(null),Ie(),O({rowKey:W,columnIndex:fe})},qn=()=>{O(null),Ie()},Zn=()=>{if(wt==null||!navigator.clipboard)return;const W=Ne.current;navigator.clipboard.writeText(Xk(wt)).then(()=>{ge.current&&Ne.current===W&&(de.current&&clearTimeout(de.current),se(!0),de.current=setTimeout(()=>se(!1),2e3))}).catch(fe=>console.warn("[web-shell] clipboard write failed:",fe))},$n=m.useMemo(()=>h?Yk(h):null,[h]),es=m.useMemo(()=>new Set(BA(h,Et)),[h,Et]),ss=(W,fe)=>{if(!$n)return!1;const{minRow:Ae,maxRow:He}=$n;return W>=Ae&&W<=He&&es.has(fe)},Ps=(W,fe)=>{const Ae=x[W];if(Ae===void 0){const He=U==="compact"?g_e:p_e;return fe?{...He,...fe}:He}return{width:Ae,minWidth:Ae,maxWidth:Ae,...fe}},jr=(W,fe)=>{W.preventDefault(),W.stopPropagation();const Ae=W.currentTarget.closest("th"),He=Ae==null?void 0:Ae.getBoundingClientRect().width;A({columnIndex:fe,startX:W.clientX,startWidth:x[fe]??(He?Math.round(He):lh)})},Ui=(W,fe)=>{if(W.ctrlKey||W.metaKey||W.altKey||W.shiftKey)return;let Ae=0;if(W.key==="ArrowRight"?Ae=PD:W.key==="ArrowLeft"&&(Ae=-PD),Ae===0)return;W.preventDefault(),W.stopPropagation();const He=W.currentTarget.closest("th"),Ge=He==null?void 0:He.getBoundingClientRect().width;k(zt=>{const dn=zt[fe]??(Ge?Math.round(Ge):lh),hn=BD(dn+Ae);return zD(zt,fe,hn)})},Bs=(W,fe)=>{W.stopPropagation(),_(fe),Nt.current=fe,W.dataTransfer.effectAllowed="move",W.dataTransfer.setData(PG,String(fe))},zr=()=>{Nt.current=null},sr=W=>{Nt.current===null||!UD(W.dataTransfer)||(W.preventDefault(),W.dataTransfer.dropEffect="move")},Qs=(W,fe)=>{const Ae=Nt.current;zr(),!(Ae===null||!UD(W.dataTransfer))&&(W.preventDefault(),W.stopPropagation(),f(null),_(Ae),C(He=>M_e(He,Ae,fe,v)))},gs=(W,fe)=>{p!==null&&g(null),_(null),te.current=!0,f({anchorRow:W,anchorCol:fe,focusRow:W,focusCol:fe})},ts=(W,fe,Ae)=>{var He;W.button!==0||c5(W.target)||(W.preventDefault(),(He=_t.current)==null||He.focus({preventScroll:!0}),gs(fe,Ae))},mn=(W,fe)=>{te.current&&(q(!0),vt.current={rowIndex:W,columnIndex:fe},!ye.current&&(ye.current=requestAnimationFrame(()=>{ye.current=0;const Ae=vt.current;vt.current=null,Ae&&f(He=>He&&{...He,focusRow:Ae.rowIndex,focusCol:Ae.columnIndex})})))},Rn=W=>{var zt;const fe=document.elementFromPoint(W.clientX,W.clientY),Ae=fe==null?void 0:fe.closest("[data-row-index][data-column-index]");if(!Ae||!((zt=Ee.current)!=null&&zt.contains(Ae)))return null;const He=Number(Ae.dataset.rowIndex),Ge=Number(Ae.dataset.columnIndex);return!Number.isInteger(He)||!Number.isInteger(Ge)?null:{rowIndex:He,columnIndex:Ge}},br=(W,fe,Ae)=>{W.touches.length!==1||c5(W.target)||gs(fe,Ae)},Se=W=>{if(!te.current||W.touches.length!==1)return;const fe=W.touches[0];if(!fe)return;const Ae=Rn(fe);Ae&&(W.preventDefault(),mn(Ae.rowIndex,Ae.columnIndex))},xe=()=>{const W=FD(h,Ve,Et);if(!W||!navigator.clipboard)return;const fe=qe.current;navigator.clipboard.writeText(W).then(()=>{ge.current&&qe.current===fe&&(oe.current&&clearTimeout(oe.current),Q(!0),oe.current=setTimeout(()=>Q(!1),2e3))}).catch(Ae=>console.warn("[web-shell] clipboard write failed:",Ae))},kt=()=>{const W=E_e(e.headers,Ve,Et);if(!W||!navigator.clipboard)return;const fe=Te.current;navigator.clipboard.writeText(W).then(()=>{ge.current&&Te.current===fe&&(ce.current&&clearTimeout(ce.current),ee(!0),ce.current=setTimeout(()=>ee(!1),2e3))}).catch(Ae=>console.warn("[web-shell] clipboard write failed:",Ae))},Ot=W=>{if(w_e())return;const fe=FD(h,Ve,Et);fe&&(W.preventDefault(),W.clipboardData.setData("text/plain",fe))},xt=m.useMemo(()=>A_e(h,Ve,Et),[Et,h,Ve]),An=(xt==null?void 0:xt.selectedCount)??0,Gn=Object.values(c).filter(G1).length,Js=s(`markdownTable.density.${U}`),jn=m.useMemo(()=>Ve.some(W=>Et.some(fe=>{const Ae=W.cells[fe];return Ae?u5(h5(Ae)):!1})),[Et,Ve]),yn=Ve.length===e.rows.length?s("markdownTable.rows",{count:e.rows.length}):s("markdownTable.rowsFiltered",{visible:Ve.length,total:e.rows.length}),Mn=p===null?void 0:e.headers[p.columnIndex],Lr=Mn&&p?Mn.text||s("markdownTable.column",{index:p.columnIndex+1}):"",ti=(W,fe)=>{const Ae=h5(W),He=u5(Ae);return u.jsx("div",{className:`${$e.cellContent} ${He&&!fe?$e.cellContentCollapsed:""}`,title:He&&!fe?Ae:void 0,children:u.jsx("div",{className:$e.cellText,children:W.content})})},_r=(W,fe)=>{const Ae=W.text.length===0,He=h5(W),Ge=u5(He);return u.jsx("div",{className:`${$e.detailValueContent} ${Ge&&!fe?$e.detailValueCollapsed:""} ${Ae?$e.emptyValue:""}`,title:Ge&&!fe?He:void 0,children:u.jsx("div",{className:$e.detailValueText,children:Ae?s("markdownTable.emptyValue"):W.content})})};return u.jsxs("div",{ref:Ee,className:`${$e.tableShell} ${__e(U)} ${L?$e.hasFrozenColumn:""} ${G?$e.dragging:""}`,children:[u.jsxs("div",{className:$e.toolbar,children:[u.jsx("span",{className:$e.summary,children:yn}),u.jsx("span",{className:$e.hint,children:s("markdownTable.hint")}),u.jsx("button",{className:$e.copyButton,type:"button",onClick:kt,children:N?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:$e.copyCheck,children:"✓"}),s("code.copied")]}):s("markdownTable.copyVisible")}),v.size>0&&u.jsx("button",{className:$e.copyButton,type:"button",onClick:Cs,children:s("markdownTable.showHiddenColumns",{count:v.size})}),u.jsx("button",{className:$e.copyButton,type:"button",onClick:Vs,children:s("markdownTable.density",{density:Js})}),jn&&u.jsx("button",{className:$e.copyButton,type:"button",onClick:()=>z(W=>!W),children:s(X?"markdownTable.collapseLongText":"markdownTable.expandLongText")}),Gn>0&&u.jsx("span",{className:$e.selection,children:s("markdownTable.filtersActive",{count:Gn})}),An>0&&u.jsxs(u.Fragment,{children:[xt&&u.jsxs("div",{className:$e.selectionStats,children:[u.jsxs("span",{className:$e.selectionMetric,children:[s("markdownTable.selection.selected")," ",u.jsx("strong",{className:$e.selectionMetricValue,children:xt.selectedCount})]}),u.jsxs("span",{className:$e.selectionMetric,children:[s("markdownTable.selection.nonEmpty")," ",u.jsx("strong",{className:$e.selectionMetricValue,children:xt.nonEmptyCount})]}),u.jsxs("span",{className:$e.selectionMetric,children:[s("markdownTable.selection.numeric")," ",u.jsx("strong",{className:$e.selectionMetricValue,children:xt.numericCount})]}),xt.numericCount>0&&u.jsxs(u.Fragment,{children:[u.jsxs("span",{className:$e.selectionMetric,children:[s("markdownTable.selection.sum")," ",u.jsx("strong",{className:$e.selectionMetricValue,children:tw(xt.sum,xt,n)})]}),u.jsxs("span",{className:$e.selectionMetric,children:[s("markdownTable.selection.average")," ",u.jsx("strong",{className:$e.selectionMetricValue,children:tw(xt.average,xt,n)})]}),u.jsxs("span",{className:$e.selectionMetric,children:[s("markdownTable.selection.min")," ",u.jsx("strong",{className:$e.selectionMetricValue,children:tw(xt.min,xt,n)})]}),u.jsxs("span",{className:$e.selectionMetric,children:[s("markdownTable.selection.max")," ",u.jsx("strong",{className:$e.selectionMetricValue,children:tw(xt.max,xt,n)})]})]})]}),u.jsx("button",{className:$e.copyButton,type:"button",onClick:xe,children:re?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:$e.copyCheck,children:"✓"}),s("code.copied")]}):s("markdownTable.copyTsv")})]}),t]}),u.jsxs("div",{ref:_t,className:$e.scroller,tabIndex:0,onCopy:Ot,children:[u.jsxs("table",{className:$e.table,children:[u.jsx("thead",{children:u.jsxs("tr",{children:[u.jsx("th",{className:`${$e.headerCell} ${$e.actionHeaderCell} ${L?$e.stickyActionHeaderCell:""}`,children:s("markdownTable.actions")}),Et.map(W=>{const fe=e.headers[W];if(!fe)return null;const Ae=(a==null?void 0:a.columnIndex)===W,He=G1(c[W]),Ge=(p==null?void 0:p.columnIndex)===W,zt=Ae?a.direction==="asc"?"↑":"↓":"↕",dn=fe.text||s("markdownTable.column",{index:W+1}),hn=Ae?s(a.direction==="asc"?"markdownTable.sortByColumnAsc":"markdownTable.sortByColumnDesc",{column:dn}):s("markdownTable.sortByColumn",{column:dn}),ds=Ae?a.direction==="asc"?"ascending":"descending":"none",Ws=`${o}-filter-${W}`,Ms=fe.textAlign?{textAlign:fe.textAlign}:void 0,Ts=Tt===W,Gr=S===W;return u.jsxs("th",{className:`${$e.headerCell} ${Ts?$e.frozenHeaderCell:""} ${Gr?$e.activeHeaderCell:""}`,"aria-sort":ds,onContextMenu:ie=>Xs(ie,W),onDragOver:sr,onDrop:ie=>Qs(ie,W),style:Ps(W,Ms),title:dn,children:[u.jsxs("div",{className:$e.headerControls,children:[u.jsxs("button",{className:$e.headerButton,type:"button",onClick:()=>ln(W),"aria-label":hn,style:Ms,children:[u.jsx("span",{className:$e.headerText,style:Ms,children:fe.content}),u.jsx("span",{className:$e.sortIcon,"aria-hidden":"true",children:zt})]}),u.jsx("button",{className:`${$e.reorderHandle} ${Gr?$e.reorderHandleVisible:""}`,type:"button",draggable:!0,tabIndex:Gr?0:-1,onDragStart:ie=>Bs(ie,W),onDragEnd:zr,"aria-label":s("markdownTable.moveColumn",{column:dn}),children:"⋮⋮"}),u.jsx("button",{className:`${$e.filterTrigger} ${He?$e.filterTriggerActive:""}`,type:"button",onClick:ie=>Wn(ie,W),"aria-label":s("markdownTable.filterColumn",{column:dn}),"aria-expanded":Ge,"aria-controls":Ge?Ws:void 0,children:"▾"})]}),u.jsx("button",{className:$e.resizeHandle,type:"button",onMouseDown:ie=>jr(ie,W),onKeyDown:ie=>Ui(ie,W),role:"separator","aria-label":s("markdownTable.resizeColumn",{column:dn}),"aria-orientation":"vertical","aria-valuemin":DG,"aria-valuemax":OG,"aria-valuenow":x[W]??lh})]},fe.key)})]})}),u.jsx("tbody",{children:Ve.map((W,fe)=>{const Ae=P===W.key,He=`${o}-detail-${W.key}`;return u.jsxs(m.Fragment,{children:[u.jsxs("tr",{className:fe%2===1?$e.evenRow:void 0,children:[u.jsx("td",{className:`${$e.cell} ${$e.actionCell} ${L?$e.stickyActionCell:""}`,children:u.jsx("button",{className:$e.rowDetailButton,type:"button",onClick:()=>_n(W.key),"aria-expanded":Ae,"aria-controls":He,"aria-label":s(Ae?"markdownTable.closeRowDetailsAria":"markdownTable.rowDetailsAria",{index:fe+1}),children:s("markdownTable.rowDetails")})}),Et.map(Ge=>{const zt=W.cells[Ge];if(!zt)return null;const dn=zt.textAlign?{textAlign:zt.textAlign}:void 0,hn=Tt===Ge;return u.jsx("td",{className:`${$e.cell} ${ss(fe,Ge)?$e.selectedCell:""} ${hn?$e.frozenCell:""}`,style:Ps(Ge,dn),"data-row-index":fe,"data-column-index":Ge,onMouseDown:ds=>ts(ds,fe,Ge),onMouseEnter:()=>mn(fe,Ge),onTouchStart:ds=>br(ds,fe,Ge),onTouchMove:Se,onTouchEnd:ne,onTouchCancel:ne,onDoubleClick:ds=>{c5(ds.target)||fn(W.key,Ge)},children:ti(zt,X)},zt.key)})]}),Ae&&u.jsx("tr",{id:He,className:$e.detailRow,children:u.jsx("td",{className:$e.detailCell,colSpan:Et.length+1,children:u.jsxs("div",{className:$e.detailPanel,children:[u.jsx("div",{className:$e.detailTitle,children:s("markdownTable.detailsHeader")}),Et.map(Ge=>{const zt=e.headers[Ge],dn=W.cells[Ge];return!zt||!dn?null:u.jsxs("div",{className:$e.detailItem,children:[u.jsx("div",{className:$e.detailLabel,title:zt.text,children:zt.content}),u.jsx("div",{className:$e.detailValue,children:_r(dn,X)})]},`${W.key}-detail-${Ge}`)})]})})})]},W.key)})})]}),Ve.length===0&&u.jsx("div",{className:$e.emptyState,children:e.rows.length===0?s("markdownTable.empty"):s("markdownTable.emptyFiltered")})]}),y&&Et.length>0&&u.jsx("div",{ref:Je,className:$e.columnContextMenu,style:{left:y.left,top:y.top},role:"menu",children:u.jsx("button",{className:$e.columnContextMenuAction,type:"button",role:"menuitem",onClick:fr,children:s(L?"markdownTable.unfreezeFirstColumn":"markdownTable.freezeFirstColumn")})}),p&&Mn&&u.jsx(H_e,{id:`${o}-filter-${p.columnIndex}`,columnName:Lr,columnIndex:p.columnIndex,filter:c[p.columnIndex],isNumeric:Bt[p.columnIndex]??!1,options:we,sort:a,style:{left:p.left,top:p.top},menuRef:Ct,canHideColumn:Et.length>1,onApply:Vn,onClose:Bn,onHideColumn:Jn,onSort:kn},p.columnIndex),F&&an&&_l.createPortal(u.jsx("div",{className:`${$e.cellDialogBackdrop} ${It}`,onMouseDown:qn,children:u.jsxs("div",{ref:Oe,className:$e.cellDialog,role:"dialog","aria-modal":"true","aria-labelledby":`${o}-cell-dialog-title`,tabIndex:-1,onMouseDown:W=>W.stopPropagation(),children:[u.jsx("button",{className:$e.cellDialogCloseIcon,type:"button",onClick:qn,"aria-label":s("markdownTable.close"),children:"×"}),u.jsx("div",{id:`${o}-cell-dialog-title`,className:$e.cellDialogTitle,children:s("markdownTable.cellDialogTitle")}),u.jsx("div",{className:$e.cellDialogValue,children:an.content}),u.jsx("div",{className:$e.cellDialogFooter,children:u.jsxs("div",{className:$e.cellDialogActions,children:[u.jsx("button",{className:$e.cellDialogButton,type:"button",onClick:Zn,children:s(K?"code.copied":"markdownTable.copyCell")}),u.jsx("button",{className:`${$e.cellDialogButton} ${$e.cellDialogPrimaryButton}`,type:"button",onClick:qn,children:s("markdownTable.close")})]})})]})}),document.body)]})}const W_e="_content_hisx1_1",G_e="_inlineCode_hisx1_127",K_e="_link_hisx1_139",Y_e="_tableWrapper_hisx1_149",X_e="_table_hisx1_149",Q_e="_image_hisx1_179",J_e="_codeBlock_hisx1_187",Z_e="_codeBlockHeader_hisx1_196",e4e="_codeBlockLang_hisx1_205",t4e="_codeBlockCopy_hisx1_213",n4e="_codeBlockContent_hisx1_231",s4e="_codeBlockPlain_hisx1_251",r4e="_mermaidBlock_hisx1_269",i4e="_mermaidInline_hisx1_281",o4e="_mermaidLoading_hisx1_300",a4e="_mermaidActions_hisx1_307",Ds={content:W_e,inlineCode:G_e,link:K_e,tableWrapper:Y_e,table:X_e,image:Q_e,codeBlock:J_e,codeBlockHeader:Z_e,codeBlockLang:e4e,codeBlockCopy:t4e,codeBlockContent:n4e,codeBlockPlain:s4e,mermaidBlock:r4e,mermaidInline:i4e,mermaidLoading:o4e,mermaidActions:a4e},l4e=new Set(["javascript","typescript","python","rust","go","java","c","cpp","csharp","fsharp","ruby","php","swift","kotlin","scala","bash","fish","powershell","sql","html","css","scss","json","yaml","toml","xml","markdown","dockerfile","graphql","lua","r","matlab","perl","haskell","elixir","erlang","clojure","dart","vue","svelte","astro","tsx","jsx","diff"]),WD={"c++":"cpp","c#":"csharp","f#":"fsharp",ts:"typescript",js:"javascript",py:"python",rb:"ruby",rs:"rust",kt:"kotlin",cs:"csharp",sh:"bash",zsh:"bash",shell:"bash",yml:"yaml",md:"markdown",golang:"go",ps1:"powershell",docker:"dockerfile"};function zG(e){const t=(e||"").toLowerCase(),n=Object.hasOwn(WD,t)?WD[t]:t,s=l4e.has(n)?n:"text";return{label:(e||"").trim()||"text",lang:n,resolvedLang:s}}const FG=/^(https?:|mailto:)/i,c4e=/^data:image\/(png|jpeg|gif|webp);base64,/i;function qG(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:FG.test(t):!1}function eg(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")||c4e.test(t)?!0:FG.test(t):!1}let GD,u4e=0;function d4e({code:e}){const{t}=ot(),n=V0(),[s,r]=m.useState(null),[i,o]=m.useState(null),[a,l]=m.useState("diagram"),[c,d]=m.useState(!1),h=n==="light"?"default":"dark";m.useEffect(()=>{let p=!1;r(null),o(null);const g=setTimeout(()=>{J(()=>import("./mermaid.core-KKudX-JC.js").then(y=>y.bm),[]).then(async y=>{if(p)return;const w=y.default;GD!==h&&(w.initialize({startOnLoad:!1,theme:h,securityLevel:"strict",suppressErrorRendering:!0}),GD=h);try{const v=`mermaid-${++u4e}`,{svg:b}=await w.render(v,e.trim());p||r(b)}catch(v){p||o(v instanceof Error?v.message:"Mermaid render failed")}})},150);return()=>{p=!0,clearTimeout(g)}},[e,h]);const f=()=>{navigator.clipboard.writeText(e).then(()=>{d(!0),setTimeout(()=>d(!1),2e3)},()=>{})};return i?u.jsxs("div",{className:Ds.codeBlock,children:[u.jsx("div",{className:Ds.codeBlockHeader,children:u.jsx("span",{className:Ds.codeBlockLang,children:t("mermaid.errorLabel")})}),u.jsx("pre",{className:`${Ds.codeBlockContent} ${Ds.codeBlockPlain}`,children:u.jsx("code",{children:e})})]}):u.jsxs("div",{className:Ds.codeBlock,children:[u.jsxs("div",{className:Ds.codeBlockHeader,children:[u.jsx("span",{className:Ds.codeBlockLang,children:t("mermaid.label")}),u.jsxs("span",{className:Ds.mermaidActions,children:[u.jsx("button",{className:Ds.codeBlockCopy,onClick:()=>l(a==="diagram"?"code":"diagram"),children:t(a==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),u.jsx("button",{className:Ds.codeBlockCopy,onClick:f,children:t(c?"code.copied":"code.copy")})]})]}),a==="code"?u.jsx("pre",{className:`${Ds.codeBlockContent} ${Ds.codeBlockPlain}`,children:u.jsx("code",{children:e})}):s?u.jsx("div",{className:`${Ds.mermaidBlock} ${Ds.mermaidInline}`,dangerouslySetInnerHTML:{__html:s}}):u.jsx("div",{className:`${Ds.mermaidBlock} ${Ds.mermaidLoading} ${Ds.mermaidInline}`,children:u.jsx("span",{children:t("mermaid.rendering")})})]})}function h4e({className:e,children:t,isStreaming:n}){const{t:s}=ot(),r=V0(),[i,o]=m.useState(null),[a,l]=m.useState(!1),{label:c,lang:d,resolvedLang:h}=zG(HG(e)),f=String(t).replace(/\n$/,""),p=r==="light"?"github-light-default":"github-dark-default";m.useEffect(()=>{if(d==="mermaid"||h==="text"||Ake(f)){o(null);return}const y=_ke(f,h,p);if(y!==null){o(y);return}const w=!n,v=OD(f,h,p,w);if(v!==null){o(v);return}o(null);let b=!1;return Cke(h).then(()=>{if(b)return;const x=OD(f,h,p,w);x!==null&&o(x)}).catch(x=>{b||(console.warn("[web-shell] highlight failed for lang=%s",h,x),o(null))}),()=>{b=!0}},[f,d,h,p,n]);const g=()=>{navigator.clipboard.writeText(f).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)},()=>{})};return d==="mermaid"&&!n?u.jsx(d4e,{code:f}):u.jsxs("div",{className:Ds.codeBlock,children:[u.jsxs("div",{className:Ds.codeBlockHeader,children:[u.jsx("span",{className:Ds.codeBlockLang,children:c}),u.jsx("button",{className:Ds.codeBlockCopy,onClick:g,children:s(a?"code.copied":"code.copy")})]}),i!==null?u.jsx("div",{className:Ds.codeBlockContent,dangerouslySetInnerHTML:{__html:i}}):u.jsx("pre",{className:`${Ds.codeBlockContent} ${Ds.codeBlockPlain}`,children:u.jsx("code",{children:f})})]})}function HG(e){var i;const t=((i=e==null?void 0:e.match(/(?:^|\s)language-([^\s]+)/))==null?void 0:i[1])??"",n=t.match(/^([\w+.#-]+)/);if(!n)return"";const s=n[1]??"",r=t[s.length];return!r||r==="{"||r===":"?s:""}function f4e({children:e}){return u.jsx("code",{className:Ds.inlineCode,children:e})}function KD({children:e}){return u.jsx("div",{className:Ds.tableWrapper,children:u.jsx("table",{className:Ds.table,children:e})})}const UG=m.createContext(!1),VG=m.createContext(void 0);function m4e({className:e,children:t}){const n=m.useContext(UG);return(e==null?void 0:e.startsWith("language-"))||typeof t=="string"&&t.includes(`
`)?u.jsx(p4e,{className:e,isStreaming:n,children:t}):u.jsx(f4e,{children:t})}function p4e({className:e,children:t,isStreaming:n}){var f;const s=m.useContext(VG),r=V0(),{markdown:i}=zc(),o=String(t),a=o.replace(/\n$/,""),l=u.jsx(h4e,{className:e,isStreaming:n,children:o}),c=HG(e),{resolvedLang:d}=zG(c);if(!!s&&!!e&&!!c)try{const p=(f=i==null?void 0:i.renderCodeBlock)==null?void 0:f.call(i,{language:c,resolvedLanguage:d,className:e,code:a,isStreaming:!!n,source:s,theme:r});if(p!=null&&typeof p!="boolean")return u.jsx(Fu,{fallback:l,label:`custom code block component render (lang=${c})`,resetKeys:[c,s,r,n?"streaming":"settled",a],children:p})}catch(p){console.error("[web-shell] custom code block renderer call failed (lang=%s):",c,p)}return l}function g4e({children:e}){return u.jsx(u.Fragment,{children:e})}const HT=/^qwen-session:\/\//i;function y4e(e){return HT.test(e.trim())?e:wV(e)}function b4e({href:e,children:t}){if(e&&HT.test(e.trim())){const s=e.trim().replace(HT,"");return u.jsx("a",{href:"#",role:"button",className:Ds.link,onClick:r=>{r.preventDefault(),r.stopPropagation(),window.dispatchEvent(new CustomEvent("qwen:open-session",{detail:s}))},children:t})}const n=qG(e)?e:void 0;return u.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:Ds.link,children:t})}function v4e({src:e,alt:t}){const n=eg(e)?e:void 0;return u.jsx("img",{src:n,alt:t||"",className:Ds.image})}function WG(e="basic",t=""){return{code:m4e,pre:g4e,a:b4e,img:v4e,table({children:n}){if(e==="advanced"){const s=u.jsx(KD,{children:n});return u.jsx(Fu,{fallback:s,label:"enhanced markdown table",resetKeys:[t],children:u.jsx(U_e,{fallback:s,children:n})})}return u.jsx(KD,{children:n})}}}const w4e=WG(),tg=m.memo(function({content:t,source:n,isStreaming:s,tableMode:r}){const{markdown:i,markdownTableMode:o}=zc(),a=n?i:void 0,l=t&&n&&(a!=null&&a.transformMarkdown)?a.transformMarkdown(t,{source:n}):t,c=s?"basic":r??o??"basic",d=m.useMemo(()=>c==="advanced"?WG("advanced",l):w4e,[c,l]),h=a==null?void 0:a.components,f=m.useMemo(()=>h?{...d,...h,...c==="advanced"?{table:d.table}:{}}:d,[d,c,h]);if(!t)return null;const p=a!=null&&a.remarkPlugins?[kL,lD,...a.remarkPlugins]:[kL,lD],g=a!=null&&a.rehypePlugins?[yD,...a.rehypePlugins]:[yD];return u.jsx("div",{className:n!=="thinking"?Ds.content:void 0,"data-markdown-source":n,children:u.jsx(UG.Provider,{value:!!s,children:u.jsx(VG.Provider,{value:n,children:u.jsx(P0e,{remarkPlugins:p,rehypePlugins:g,components:f,urlTransform:y4e,children:l})})})})});let UT=[],GG=[];(()=>{let e="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(t=>t?parseInt(t,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?GG:UT).push(n=n+e[t])})();function x4e(e){if(e<768)return!1;for(let t=0,n=UT.length;;){let s=t+n>>1;if(e<UT[s])n=s;else if(e>=GG[s])t=s+1;else return!0;if(t==n)return!1}}function YD(e){return e>=127462&&e<=127487}const XD=8205;function k4e(e,t,n=!0,s=!0){return(n?KG:_4e)(e,t,s)}function KG(e,t,n){if(t==e.length)return t;t&&YG(e.charCodeAt(t))&&XG(e.charCodeAt(t-1))&&t--;let s=f5(e,t);for(t+=QD(s);t<e.length;){let r=f5(e,t);if(s==XD||r==XD||n&&x4e(r))t+=QD(r),s=r;else if(YD(r)){let i=0,o=t-2;for(;o>=0&&YD(f5(e,o));)i++,o-=2;if(i%2==0)break;t+=2}else break}return t}function _4e(e,t,n){for(;t>0;){let s=KG(e,t-2,n);if(s<t)return s;t--}return 0}function f5(e,t){let n=e.charCodeAt(t);if(!XG(n)||t+1==e.length)return n;let s=e.charCodeAt(t+1);return YG(s)?(n-55296<<10)+(s-56320)+65536:n}function YG(e){return e>=56320&&e<57344}function XG(e){return e>=55296&&e<56320}function QD(e){return e<65536?1:2}class Is{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,n,s){[t,n]=_0(this,t,n);let r=[];return this.decompose(0,t,r,2),s.length&&s.decompose(0,s.length,r,3),this.decompose(n,this.length,r,1),mc.from(r,this.length-(n-t)+s.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,n=this.length){[t,n]=_0(this,t,n);let s=[];return this.decompose(t,n,s,0),mc.from(s,n-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let n=this.scanIdentical(t,1),s=this.length-this.scanIdentical(t,-1),r=new K1(this),i=new K1(t);for(let o=n,a=n;;){if(r.next(o),i.next(o),o=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(a+=r.value.length,r.done||a>=s)return!0}}iter(t=1){return new K1(this,t)}iterRange(t,n=this.length){return new QG(this,t,n)}iterLines(t,n){let s;if(t==null)s=this.iter();else{n==null&&(n=this.lines+1);let r=this.line(t).from;s=this.iterRange(r,Math.max(r,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new JG(s)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(t.length==0)throw new RangeError("A document must have at least one line");return t.length==1&&!t[0]?Is.empty:t.length<=32?new Qr(t):mc.from(Qr.split(t,[]))}}class Qr extends Is{constructor(t,n=S4e(t)){super(),this.text=t,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(t,n,s,r){for(let i=0;;i++){let o=this.text[i],a=r+o.length;if((n?s:a)>=t)return new C4e(r,a,s,o);r=a+1,s++}}decompose(t,n,s,r){let i=t<=0&&n>=this.length?this:new Qr(JD(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(r&1){let o=s.pop(),a=kx(i.text,o.text.slice(),0,i.length);if(a.length<=32)s.push(new Qr(a,o.length+i.length));else{let l=a.length>>1;s.push(new Qr(a.slice(0,l)),new Qr(a.slice(l)))}}else s.push(i)}replace(t,n,s){if(!(s instanceof Qr))return super.replace(t,n,s);[t,n]=_0(this,t,n);let r=kx(this.text,kx(s.text,JD(this.text,0,t)),n),i=this.length+s.length-(n-t);return r.length<=32?new Qr(r,i):mc.from(Qr.split(r,[]),i)}sliceString(t,n=this.length,s=`
`){[t,n]=_0(this,t,n);let r="";for(let i=0,o=0;i<=n&&o<this.text.length;o++){let a=this.text[o],l=i+a.length;i>t&&o&&(r+=s),t<l&&n>i&&(r+=a.slice(Math.max(0,t-i),n-i)),i=l+1}return r}flatten(t){for(let n of this.text)t.push(n)}scanIdentical(){return 0}static split(t,n){let s=[],r=-1;for(let i of t)s.push(i),r+=i.length+1,s.length==32&&(n.push(new Qr(s,r)),s=[],r=-1);return r>-1&&n.push(new Qr(s,r)),n}}class mc extends Is{constructor(t,n){super(),this.children=t,this.length=n,this.lines=0;for(let s of t)this.lines+=s.lines}lineInner(t,n,s,r){for(let i=0;;i++){let o=this.children[i],a=r+o.length,l=s+o.lines-1;if((n?l:a)>=t)return o.lineInner(t,n,s,r);r=a+1,s=l+1}}decompose(t,n,s,r){for(let i=0,o=0;o<=n&&i<this.children.length;i++){let a=this.children[i],l=o+a.length;if(t<=l&&n>=o){let c=r&((o<=t?1:0)|(l>=n?2:0));o>=t&&l<=n&&!c?s.push(a):a.decompose(t-o,n-o,s,c)}o=l+1}}replace(t,n,s){if([t,n]=_0(this,t,n),s.lines<this.lines)for(let r=0,i=0;r<this.children.length;r++){let o=this.children[r],a=i+o.length;if(t>=i&&n<=a){let l=o.replace(t-i,n-i,s),c=this.lines-o.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let d=this.children.slice();return d[r]=l,new mc(d,this.length-(n-t)+s.length)}return super.replace(i,a,l)}i=a+1}return super.replace(t,n,s)}sliceString(t,n=this.length,s=`
`){[t,n]=_0(this,t,n);let r="";for(let i=0,o=0;i<this.children.length&&o<=n;i++){let a=this.children[i],l=o+a.length;o>t&&i&&(r+=s),t<l&&n>o&&(r+=a.sliceString(t-o,n-o,s)),o=l+1}return r}flatten(t){for(let n of this.children)n.flatten(t)}scanIdentical(t,n){if(!(t instanceof mc))return 0;let s=0,[r,i,o,a]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;r+=n,i+=n){if(r==o||i==a)return s;let l=this.children[r],c=t.children[i];if(l!=c)return s+l.scanIdentical(c,n);s+=l.length+1}}static from(t,n=t.reduce((s,r)=>s+r.length+1,-1)){let s=0;for(let p of t)s+=p.lines;if(s<32){let p=[];for(let g of t)g.flatten(p);return new Qr(p,n)}let r=Math.max(32,s>>5),i=r<<1,o=r>>1,a=[],l=0,c=-1,d=[];function h(p){let g;if(p.lines>i&&p instanceof mc)for(let y of p.children)h(y);else p.lines>o&&(l>o||!l)?(f(),a.push(p)):p instanceof Qr&&l&&(g=d[d.length-1])instanceof Qr&&p.lines+g.lines<=32?(l+=p.lines,c+=p.length+1,d[d.length-1]=new Qr(g.text.concat(p.text),g.length+1+p.length)):(l+p.lines>r&&f(),l+=p.lines,c+=p.length+1,d.push(p))}function f(){l!=0&&(a.push(d.length==1?d[0]:mc.from(d,c)),c=-1,l=d.length=0)}for(let p of t)h(p);return f(),a.length==1?a[0]:new mc(a,n)}}Is.empty=new Qr([""],0);function S4e(e){let t=-1;for(let n of e)t+=n.length+1;return t}function kx(e,t,n=0,s=1e9){for(let r=0,i=0,o=!0;i<e.length&&r<=s;i++){let a=e[i],l=r+a.length;l>=n&&(l>s&&(a=a.slice(0,s-r)),r<n&&(a=a.slice(n-r)),o?(t[t.length-1]+=a,o=!1):t.push(a)),r=l+1}return t}function JD(e,t,n){return kx(e,[""],t,n)}class K1{constructor(t,n=1){this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[t],this.offsets=[n>0?1:(t instanceof Qr?t.text.length:t.children.length)<<1]}nextInner(t,n){for(this.done=this.lineBreak=!1;;){let s=this.nodes.length-1,r=this.nodes[s],i=this.offsets[s],o=i>>1,a=r instanceof Qr?r.text.length:r.children.length;if(o==(n>0?a:0)){if(s==0)return this.done=!0,this.value="",this;n>0&&this.offsets[s-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(n>0?0:1)){if(this.offsets[s]+=n,t==0)return this.lineBreak=!0,this.value=`
`,this;t--}else if(r instanceof Qr){let l=r.text[o+(n<0?-1:0)];if(this.offsets[s]+=n,l.length>Math.max(0,t))return this.value=t==0?l:n>0?l.slice(t):l.slice(0,l.length-t),this;t-=l.length}else{let l=r.children[o+(n<0?-1:0)];t>l.length?(t-=l.length,this.offsets[s]+=n):(n<0&&this.offsets[s]--,this.nodes.push(l),this.offsets.push(n>0?1:(l instanceof Qr?l.text.length:l.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class QG{constructor(t,n,s){this.value="",this.done=!1,this.cursor=new K1(t,n>s?-1:1),this.pos=n>s?t.length:0,this.from=Math.min(n,s),this.to=Math.max(n,s)}nextInner(t,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let s=n<0?this.pos-this.from:this.to-this.pos;t>s&&(t=s),s-=t;let{value:r}=this.cursor.next(t);return this.pos+=(r.length+t)*n,this.value=r.length<=s?r:n<0?r.slice(r.length-s):r.slice(0,s),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class JG{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:n,lineBreak:s,value:r}=this.inner.next(t);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):s?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Is.prototype[Symbol.iterator]=function(){return this.iter()},K1.prototype[Symbol.iterator]=QG.prototype[Symbol.iterator]=JG.prototype[Symbol.iterator]=function(){return this});class C4e{constructor(t,n,s,r){this.from=t,this.to=n,this.number=s,this.text=r}get length(){return this.to-this.from}}function _0(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function Fi(e,t,n=!0,s=!0){return k4e(e,t,n,s)}function T4e(e){return e>=56320&&e<57344}function E4e(e){return e>=55296&&e<56320}function Zo(e,t){let n=e.charCodeAt(t);if(!E4e(n)||t+1==e.length)return n;let s=e.charCodeAt(t+1);return T4e(s)?(n-55296<<10)+(s-56320)+65536:n}function $A(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function pc(e){return e<65536?1:2}const VT=/\r\n?|\n/;var Lo=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(Lo||(Lo={}));class Nc{constructor(t){this.sections=t}get length(){let t=0;for(let n=0;n<this.sections.length;n+=2)t+=this.sections[n];return t}get newLength(){let t=0;for(let n=0;n<this.sections.length;n+=2){let s=this.sections[n+1];t+=s<0?this.sections[n]:s}return t}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(t){for(let n=0,s=0,r=0;n<this.sections.length;){let i=this.sections[n++],o=this.sections[n++];o<0?(t(s,r,i),r+=i):r+=o,s+=i}}iterChangedRanges(t,n=!1){WT(this,t,n)}get invertedDesc(){let t=[];for(let n=0;n<this.sections.length;){let s=this.sections[n++],r=this.sections[n++];r<0?t.push(s,r):t.push(r,s)}return new Nc(t)}composeDesc(t){return this.empty?t:t.empty?this:ZG(this,t)}mapDesc(t,n=!1){return t.empty?this:GT(this,t,n)}mapPos(t,n=-1,s=Lo.Simple){let r=0,i=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=r+a;if(l<0){if(c>t)return i+(t-r);i+=a}else{if(s!=Lo.Simple&&c>=t&&(s==Lo.TrackDel&&r<t&&c>t||s==Lo.TrackBefore&&r<t||s==Lo.TrackAfter&&c>t))return null;if(c>t||c==t&&n<0&&!a)return t==r||n<0?i:i+l;i+=l}r=c}if(t>r)throw new RangeError(`Position ${t} is out of range for changeset of length ${r}`);return i}touchesRange(t,n=t){for(let s=0,r=0;s<this.sections.length&&r<=n;){let i=this.sections[s++],o=this.sections[s++],a=r+i;if(o>=0&&r<=n&&a>=t)return r<t&&a>n?"cover":!0;r=a}return!1}toString(){let t="";for(let n=0;n<this.sections.length;){let s=this.sections[n++],r=this.sections[n++];t+=(t?" ":"")+s+(r>=0?":"+r:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Nc(t)}static create(t){return new Nc(t)}}class _i extends Nc{constructor(t,n){super(t),this.inserted=n}apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return WT(this,(n,s,r,i,o)=>t=t.replace(r,r+(s-n),o),!1),t}mapDesc(t,n=!1){return GT(this,t,n,!0)}invert(t){let n=this.sections.slice(),s=[];for(let r=0,i=0;r<n.length;r+=2){let o=n[r],a=n[r+1];if(a>=0){n[r]=a,n[r+1]=o;let l=r>>1;for(;s.length<l;)s.push(Is.empty);s.push(o?t.slice(i,i+o):Is.empty)}i+=o}return new _i(n,s)}compose(t){return this.empty?t:t.empty?this:ZG(this,t,!0)}map(t,n=!1){return t.empty?this:GT(this,t,n,!0)}iterChanges(t,n=!1){WT(this,t,n)}get desc(){return Nc.create(this.sections)}filter(t){let n=[],s=[],r=[],i=new Ay(this);e:for(let o=0,a=0;;){let l=o==t.length?1e9:t[o++];for(;a<l||a==l&&i.len==0;){if(i.done)break e;let d=Math.min(i.len,l-a);mo(r,d,-1);let h=i.ins==-1?-1:i.off==0?i.ins:0;mo(n,d,h),h>0&&Gd(s,n,i.text),i.forward(d),a+=d}let c=t[o++];for(;a<c;){if(i.done)break e;let d=Math.min(i.len,c-a);mo(n,d,-1),mo(r,d,i.ins==-1?-1:i.off==0?i.ins:0),i.forward(d),a+=d}}return{changes:new _i(n,s),filtered:Nc.create(r)}}toJSON(){let t=[];for(let n=0;n<this.sections.length;n+=2){let s=this.sections[n],r=this.sections[n+1];r<0?t.push(s):r==0?t.push([s]):t.push([s].concat(this.inserted[n>>1].toJSON()))}return t}static of(t,n,s){let r=[],i=[],o=0,a=null;function l(d=!1){if(!d&&!r.length)return;o<n&&mo(r,n-o,-1);let h=new _i(r,i);a=a?a.compose(h.map(a)):h,r=[],i=[],o=0}function c(d){if(Array.isArray(d))for(let h of d)c(h);else if(d instanceof _i){if(d.length!=n)throw new RangeError(`Mismatched change set length (got ${d.length}, expected ${n})`);l(),a=a?a.compose(d.map(a)):d}else{let{from:h,to:f=h,insert:p}=d;if(h>f||h<0||f>n)throw new RangeError(`Invalid change range ${h} to ${f} (in doc of length ${n})`);let g=p?typeof p=="string"?Is.of(p.split(s||VT)):p:Is.empty,y=g.length;if(h==f&&y==0)return;h<o&&l(),h>o&&mo(r,h-o,-1),mo(r,f-h,y),Gd(i,r,g),o=f}}return c(t),l(!a),a}static empty(t){return new _i(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],s=[];for(let r=0;r<t.length;r++){let i=t[r];if(typeof i=="number")n.push(i,-1);else{if(!Array.isArray(i)||typeof i[0]!="number"||i.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(i.length==1)n.push(i[0],0);else{for(;s.length<r;)s.push(Is.empty);s[r]=Is.of(i.slice(1)),n.push(i[0],s[r].length)}}}return new _i(n,s)}static createSet(t,n){return new _i(t,n)}}function mo(e,t,n,s=!1){if(t==0&&n<=0)return;let r=e.length-2;r>=0&&n<=0&&n==e[r+1]?e[r]+=t:r>=0&&t==0&&e[r]==0?e[r+1]+=n:s?(e[r]+=t,e[r+1]+=n):e.push(t,n)}function Gd(e,t,n){if(n.length==0)return;let s=t.length-2>>1;if(s<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<s;)e.push(Is.empty);e.push(n)}}function WT(e,t,n){let s=e.inserted;for(let r=0,i=0,o=0;o<e.sections.length;){let a=e.sections[o++],l=e.sections[o++];if(l<0)r+=a,i+=a;else{let c=r,d=i,h=Is.empty;for(;c+=a,d+=l,l&&s&&(h=h.append(s[o-2>>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)a=e.sections[o++],l=e.sections[o++];t(r,c,i,d,h),r=c,i=d}}}function GT(e,t,n,s=!1){let r=[],i=s?[]:null,o=new Ay(e),a=new Ay(t);for(let l=-1;;){if(o.done&&a.len||a.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&a.ins==-1){let c=Math.min(o.len,a.len);mo(r,c,-1),o.forward(c),a.forward(c)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!n))){let c=a.len;for(mo(r,a.ins,-1);c;){let d=Math.min(o.len,c);o.ins>=0&&l<o.i&&o.len<=d&&(mo(r,0,o.ins),i&&Gd(i,r,o.text),l=o.i),o.forward(d),c-=d}a.next()}else if(o.ins>=0){let c=0,d=o.len;for(;d;)if(a.ins==-1){let h=Math.min(d,a.len);c+=h,d-=h,a.forward(h)}else if(a.ins==0&&a.len<d)d-=a.len,a.next();else break;mo(r,c,l<o.i?o.ins:0),i&&l<o.i&&Gd(i,r,o.text),l=o.i,o.forward(o.len-d)}else{if(o.done&&a.done)return i?_i.createSet(r,i):Nc.create(r);throw new Error("Mismatched change set lengths")}}}function ZG(e,t,n=!1){let s=[],r=n?[]:null,i=new Ay(e),o=new Ay(t);for(let a=!1;;){if(i.done&&o.done)return r?_i.createSet(s,r):Nc.create(s);if(i.ins==0)mo(s,i.len,0,a),i.next();else if(o.len==0&&!o.done)mo(s,0,o.ins,a),r&&Gd(r,s,o.text),o.next();else{if(i.done||o.done)throw new Error("Mismatched change set lengths");{let l=Math.min(i.len2,o.len),c=s.length;if(i.ins==-1){let d=o.ins==-1?-1:o.off?0:o.ins;mo(s,l,d,a),r&&d&&Gd(r,s,o.text)}else o.ins==-1?(mo(s,i.off?0:i.len,l,a),r&&Gd(r,s,i.textBit(l))):(mo(s,i.off?0:i.len,o.off?0:o.ins,a),r&&!o.off&&Gd(r,s,o.text));a=(i.ins>l||o.ins>=0&&o.len>l)&&(a||s.length>c),i.forward2(l),o.forward(l)}}}}class Ay{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i<t.length?(this.len=t[this.i++],this.ins=t[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length?Is.empty:t[n]}textBit(t){let{inserted:n}=this.set,s=this.i-2>>1;return s>=n.length&&!t?Is.empty:n[s].slice(this.off,t==null?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){this.ins==-1?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}class Nf{constructor(t,n,s){this.from=t,this.to=n,this.flags=s}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let t=this.flags&7;return t==7?null:t}get goalColumn(){let t=this.flags>>6;return t==16777215?void 0:t}map(t,n=-1){let s,r;return this.empty?s=r=t.mapPos(this.from,n):(s=t.mapPos(this.from,1),r=t.mapPos(this.to,-1)),s==this.from&&r==this.to?this:new Nf(s,r,this.flags)}extend(t,n=t,s=0){if(t<=this.anchor&&n>=this.anchor)return Be.range(t,n,void 0,void 0,s);let r=Math.abs(t-this.anchor)>Math.abs(n-this.anchor)?t:n;return Be.range(this.anchor,r,void 0,void 0,s)}eq(t,n=!1){return this.anchor==t.anchor&&this.head==t.head&&this.goalColumn==t.goalColumn&&(!n||!this.empty||this.assoc==t.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return Be.range(t.anchor,t.head)}static create(t,n,s){return new Nf(t,n,s)}}class Be{constructor(t,n){this.ranges=t,this.mainIndex=n}map(t,n=-1){return t.empty?this:Be.create(this.ranges.map(s=>s.map(t,n)),this.mainIndex)}eq(t,n=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let s=0;s<this.ranges.length;s++)if(!this.ranges[s].eq(t.ranges[s],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new Be([this.main],0)}addRange(t,n=!0){return Be.create([t].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(t,n=this.mainIndex){let s=this.ranges.slice();return s[n]=t,Be.create(s,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(t=>t.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!="number"||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Be(t.ranges.map(n=>Nf.fromJSON(n)),t.main)}static single(t,n=t){return new Be([Be.range(t,n)],0)}static create(t,n=0){if(t.length==0)throw new RangeError("A selection needs at least one range");for(let s=0,r=0;r<t.length;r++){let i=t[r];if(i.empty?i.from<=s:i.from<s)return Be.normalized(t.slice(),n);s=i.to}return new Be(t,n)}static cursor(t,n=0,s,r){return Nf.create(t,t,(n==0?0:n<0?8:16)|(s==null?7:Math.min(6,s))|(r??16777215)<<6)}static range(t,n,s,r,i){let o=(s??16777215)<<6|(r==null?7:Math.min(6,r));return!i&&t!=n&&(i=n<t?1:-1),n<t?Nf.create(n,t,48|o):Nf.create(t,n,(i?i<0?8:16:0)|o)}static normalized(t,n=0){let s=t[n];t.sort((r,i)=>r.from-i.from),n=t.indexOf(s);for(let r=1;r<t.length;r++){let i=t[r],o=t[r-1];if(i.empty?i.from<=o.to:i.from<o.to){let a=o.from,l=Math.max(i.to,o.to);r<=n&&n--,t.splice(--r,2,i.anchor>i.head?Be.range(l,a):Be.range(a,l))}}return new Be(t,n)}}function eK(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let zA=0;class Ut{constructor(t,n,s,r,i){this.combine=t,this.compareInput=n,this.compare=s,this.isStatic=r,this.id=zA++,this.default=t([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(t={}){return new Ut(t.combine||(n=>n),t.compareInput||((n,s)=>n===s),t.compare||(t.combine?(n,s)=>n===s:FA),!!t.static,t.enables)}of(t){return new _x([],this,0,t)}compute(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new _x(t,this,1,n)}computeN(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new _x(t,this,2,n)}from(t,n){return n||(n=s=>s),this.compute([t],s=>n(s.field(t)))}}function FA(e,t){return e==t||e.length==t.length&&e.every((n,s)=>n===t[s])}class _x{constructor(t,n,s,r){this.dependencies=t,this.facet=n,this.type=s,this.value=r,this.id=zA++}dynamicSlot(t){var n;let s=this.value,r=this.facet.compareInput,i=this.id,o=t[i]>>1,a=this.type==2,l=!1,c=!1,d=[];for(let h of this.dependencies)h=="doc"?l=!0:h=="selection"?c=!0:((n=t[h.id])!==null&&n!==void 0?n:1)&1||d.push(t[h.id]);return{create(h){return h.values[o]=s(h),1},update(h,f){if(l&&f.docChanged||c&&(f.docChanged||f.selection)||KT(h,d)){let p=s(h);if(a?!ZD(p,h.values[o],r):!r(p,h.values[o]))return h.values[o]=p,1}return 0},reconfigure:(h,f)=>{let p,g=f.config.address[i];if(g!=null){let y=Jk(f,g);if(this.dependencies.every(w=>w instanceof Ut?f.facet(w)===h.facet(w):w instanceof ao?f.field(w,!1)==h.field(w,!1):!0)||(a?ZD(p=s(h),y,r):r(p=s(h),y)))return h.values[o]=y,0}else p=s(h);return h.values[o]=p,1}}}}function ZD(e,t,n){if(e.length!=t.length)return!1;for(let s=0;s<e.length;s++)if(!n(e[s],t[s]))return!1;return!0}function KT(e,t){let n=!1;for(let s of t)Y1(e,s)&1&&(n=!0);return n}function A4e(e,t,n){let s=n.map(l=>e[l.id]),r=n.map(l=>l.type),i=s.filter(l=>!(l&1)),o=e[t.id]>>1;function a(l){let c=[];for(let d=0;d<s.length;d++){let h=Jk(l,s[d]);if(r[d]==2)for(let f of h)c.push(f);else c.push(h)}return t.combine(c)}return{create(l){for(let c of s)Y1(l,c);return l.values[o]=a(l),1},update(l,c){if(!KT(l,i))return 0;let d=a(l);return t.compare(d,l.values[o])?0:(l.values[o]=d,1)},reconfigure(l,c){let d=KT(l,s),h=c.config.facets[t.id],f=c.facet(t);if(h&&!d&&FA(n,h))return l.values[o]=f,0;let p=a(l);return t.compare(p,f)?(l.values[o]=f,0):(l.values[o]=p,1)}}}const nw=Ut.define({static:!0});class ao{constructor(t,n,s,r,i){this.id=t,this.createF=n,this.updateF=s,this.compareF=r,this.spec=i,this.provides=void 0}static define(t){let n=new ao(zA++,t.create,t.update,t.compare||((s,r)=>s===r),t);return t.provide&&(n.provides=t.provide(n)),n}create(t){let n=t.facet(nw).find(s=>s.field==this);return((n==null?void 0:n.create)||this.createF)(t)}slot(t){let n=t[this.id]>>1;return{create:s=>(s.values[n]=this.create(s),1),update:(s,r)=>{let i=s.values[n],o=this.updateF(i,r);return this.compareF(i,o)?0:(s.values[n]=o,1)},reconfigure:(s,r)=>{let i=s.facet(nw),o=r.facet(nw),a;return(a=i.find(l=>l.field==this))&&a!=o.find(l=>l.field==this)?(s.values[n]=a.create(s),1):r.config.address[this.id]!=null?(s.values[n]=r.field(this),0):(s.values[n]=this.create(s),1)}}}init(t){return[this,nw.of({field:this,create:t})]}get extension(){return this}}const kf={lowest:4,low:3,default:2,high:1,highest:0};function qg(e){return t=>new tK(t,e)}const Bh={highest:qg(kf.highest),high:qg(kf.high),default:qg(kf.default),low:qg(kf.low),lowest:qg(kf.lowest)};class tK{constructor(t,n){this.inner=t,this.prec=n}}class _m{of(t){return new YT(this,t)}reconfigure(t){return _m.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class YT{constructor(t,n){this.compartment=t,this.inner=n}}class Qk{constructor(t,n,s,r,i,o){for(this.base=t,this.compartments=n,this.dynamicSlots=s,this.address=r,this.staticValues=i,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<s.length;)this.statusTemplate.push(0)}staticFacet(t){let n=this.address[t.id];return n==null?t.default:this.staticValues[n>>1]}static resolve(t,n,s){let r=[],i=Object.create(null),o=new Map;for(let f of M4e(t,n,o))f instanceof ao?r.push(f):(i[f.facet.id]||(i[f.facet.id]=[])).push(f);let a=Object.create(null),l=[],c=[];for(let f of r)a[f.id]=c.length<<1,c.push(p=>f.slot(p));let d=s==null?void 0:s.config.facets;for(let f in i){let p=i[f],g=p[0].facet,y=d&&d[f]||[];if(p.every(w=>w.type==0))if(a[g.id]=l.length<<1|1,FA(y,p))l.push(s.facet(g));else{let w=g.combine(p.map(v=>v.value));l.push(s&&g.compare(w,s.facet(g))?s.facet(g):w)}else{for(let w of p)w.type==0?(a[w.id]=l.length<<1|1,l.push(w.value)):(a[w.id]=c.length<<1,c.push(v=>w.dynamicSlot(v)));a[g.id]=c.length<<1,c.push(w=>A4e(w,g,p))}}let h=c.map(f=>f(a));return new Qk(t,o,h,a,l,i)}}function M4e(e,t,n){let s=[[],[],[],[],[]],r=new Map;function i(o,a){let l=r.get(o);if(l!=null){if(l<=a)return;let c=s[l].indexOf(o);c>-1&&s[l].splice(c,1),o instanceof YT&&n.delete(o.compartment)}if(r.set(o,a),Array.isArray(o))for(let c of o)i(c,a);else if(o instanceof YT){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=t.get(o.compartment)||o.inner;n.set(o.compartment,c),i(c,a)}else if(o instanceof tK)i(o.inner,o.prec);else if(o instanceof ao)s[a].push(o),o.provides&&i(o.provides,a);else if(o instanceof _x)s[a].push(o),o.facet.extensions&&i(o.facet.extensions,kf.default);else{let c=o.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);i(c,a)}}return i(e,kf.default),s.reduce((o,a)=>o.concat(a))}function Y1(e,t){if(t&1)return 2;let n=t>>1,s=e.status[n];if(s==4)throw new Error("Cyclic dependency between fields and/or facets");if(s&2)return s;e.status[n]=4;let r=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|r}function Jk(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}const nK=Ut.define(),XT=Ut.define({combine:e=>e.some(t=>t),static:!0}),sK=Ut.define({combine:e=>e.length?e[0]:void 0,static:!0}),rK=Ut.define(),iK=Ut.define(),oK=Ut.define(),aK=Ut.define({combine:e=>e.length?e[0]:!1});class td{constructor(t,n){this.type=t,this.value=n}static define(){return new N4e}}class N4e{of(t){return new td(this,t)}}class I4e{constructor(t){this.map=t}of(t){return new Pn(this,t)}}class Pn{constructor(t,n){this.type=t,this.value=n}map(t){let n=this.type.map(this.value,t);return n===void 0?void 0:n==this.value?this:new Pn(this.type,n)}is(t){return this.type==t}static define(t={}){return new I4e(t.map||(n=>n))}static mapEffects(t,n){if(!t.length)return t;let s=[];for(let r of t){let i=r.map(n);i&&s.push(i)}return s}}Pn.reconfigure=Pn.define();Pn.appendConfig=Pn.define();class Ci{constructor(t,n,s,r,i,o){this.startState=t,this.changes=n,this.selection=s,this.effects=r,this.annotations=i,this.scrollIntoView=o,this._doc=null,this._state=null,s&&eK(s,n.newLength),i.some(a=>a.type==Ci.time)||(this.annotations=i.concat(Ci.time.of(Date.now())))}static create(t,n,s,r,i,o){return new Ci(t,n,s,r,i,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(t){for(let n of this.annotations)if(n.type==t)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let n=this.annotation(Ci.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]=="."))}}Ci.time=td.define();Ci.userEvent=td.define();Ci.addToHistory=td.define();Ci.remote=td.define();function R4e(e,t){let n=[];for(let s=0,r=0;;){let i,o;if(s<e.length&&(r==t.length||t[r]>=e[s]))i=e[s++],o=e[s++];else if(r<t.length)i=t[r++],o=t[r++];else return n;!n.length||n[n.length-1]<i?n.push(i,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function lK(e,t,n){var s;let r,i,o;return n?(r=t.changes,i=_i.empty(t.changes.length),o=e.changes.compose(t.changes)):(r=t.changes.map(e.changes),i=e.changes.mapDesc(t.changes,!0),o=e.changes.compose(r)),{changes:o,selection:t.selection?t.selection.map(i):(s=e.selection)===null||s===void 0?void 0:s.map(r),effects:Pn.mapEffects(e.effects,r).concat(Pn.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function QT(e,t,n){let s=t.selection,r=Yp(t.annotations);return t.userEvent&&(r=r.concat(Ci.userEvent.of(t.userEvent))),{changes:t.changes instanceof _i?t.changes:_i.of(t.changes||[],n,e.facet(sK)),selection:s&&(s instanceof Be?s:Be.single(s.anchor,s.head)),effects:Yp(t.effects),annotations:r,scrollIntoView:!!t.scrollIntoView}}function cK(e,t,n){let s=QT(e,t.length?t[0]:{},e.doc.length);t.length&&t[0].filter===!1&&(n=!1);for(let i=1;i<t.length;i++){t[i].filter===!1&&(n=!1);let o=!!t[i].sequential;s=lK(s,QT(e,t[i],o?s.changes.newLength:e.doc.length),o)}let r=Ci.create(e,s.changes,s.selection,s.effects,s.annotations,s.scrollIntoView);return L4e(n?j4e(r):r)}function j4e(e){let t=e.startState,n=!0;for(let r of t.facet(rK)){let i=r(e);if(i===!1){n=!1;break}Array.isArray(i)&&(n=n===!0?i:R4e(n,i))}if(n!==!0){let r,i;if(n===!1)i=e.changes.invertedDesc,r=_i.empty(t.doc.length);else{let o=e.changes.filter(n);r=o.changes,i=o.filtered.mapDesc(o.changes).invertedDesc}e=Ci.create(t,r,e.selection&&e.selection.map(i),Pn.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let s=t.facet(iK);for(let r=s.length-1;r>=0;r--){let i=s[r](e);i instanceof Ci?e=i:Array.isArray(i)&&i.length==1&&i[0]instanceof Ci?e=i[0]:e=cK(t,Yp(i),!1)}return e}function L4e(e){let t=e.startState,n=t.facet(oK),s=e;for(let r=n.length-1;r>=0;r--){let i=n[r](e);i&&Object.keys(i).length&&(s=lK(s,QT(t,i,e.changes.newLength),!0))}return s==e?e:Ci.create(t,e.changes,e.selection,s.effects,s.annotations,s.scrollIntoView)}const D4e=[];function Yp(e){return e==null?D4e:Array.isArray(e)?e:[e]}var Mr=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(Mr||(Mr={}));const O4e=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let JT;try{JT=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function P4e(e){if(JT)return JT.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||O4e.test(n)))return!0}return!1}function B4e(e){return t=>{if(!/\S/.test(t))return Mr.Space;if(P4e(t))return Mr.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return Mr.Word;return Mr.Other}}class ws{constructor(t,n,s,r,i,o){this.config=t,this.doc=n,this.selection=s,this.values=r,this.status=t.statusTemplate.slice(),this.computeSlot=i,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)Y1(this,a<<1);this.computeSlot=null}field(t,n=!0){let s=this.config.address[t.id];if(s==null){if(n)throw new RangeError("Field is not present in this state");return}return Y1(this,s),Jk(this,s)}update(...t){return cK(this,t,!0)}applyTransaction(t){let n=this.config,{base:s,compartments:r}=n;for(let a of t.effects)a.is(_m.reconfigure)?(n&&(r=new Map,n.compartments.forEach((l,c)=>r.set(c,l)),n=null),r.set(a.value.compartment,a.value.extension)):a.is(Pn.reconfigure)?(n=null,s=a.value):a.is(Pn.appendConfig)&&(n=null,s=Yp(s).concat(a.value));let i;n?i=t.startState.values.slice():(n=Qk.resolve(s,r,this),i=new ws(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let o=t.startState.facet(XT)?t.newSelection:t.newSelection.asSingle();new ws(n,t.newDoc,o,i,(a,l)=>l.update(a,t),t)}replaceSelection(t){return typeof t=="string"&&(t=this.toText(t)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:t},range:Be.cursor(n.from+t.length)}))}changeByRange(t){let n=this.selection,s=t(n.ranges[0]),r=this.changes(s.changes),i=[s.range],o=Yp(s.effects);for(let a=1;a<n.ranges.length;a++){let l=t(n.ranges[a]),c=this.changes(l.changes),d=c.map(r);for(let f=0;f<a;f++)i[f]=i[f].map(d);let h=r.mapDesc(c,!0);i.push(l.range.map(h)),r=r.compose(d),o=Pn.mapEffects(o,d).concat(Pn.mapEffects(Yp(l.effects),h))}return{changes:r,selection:Be.create(i,n.mainIndex),effects:o}}changes(t=[]){return t instanceof _i?t:_i.of(t,this.doc.length,this.facet(ws.lineSeparator))}toText(t){return Is.of(t.split(this.facet(ws.lineSeparator)||VT))}sliceDoc(t=0,n=this.doc.length){return this.doc.sliceString(t,n,this.lineBreak)}facet(t){let n=this.config.address[t.id];return n==null?t.default:(Y1(this,n),Jk(this,n))}toJSON(t){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(t)for(let s in t){let r=t[s];r instanceof ao&&this.config.address[r.id]!=null&&(n[s]=r.spec.toJSON(this.field(t[s]),this))}return n}static fromJSON(t,n={},s){if(!t||typeof t.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(s){for(let i in s)if(Object.prototype.hasOwnProperty.call(t,i)){let o=s[i],a=t[i];r.push(o.init(l=>o.spec.fromJSON(a,l)))}}return ws.create({doc:t.doc,selection:Be.fromJSON(t.selection),extensions:n.extensions?r.concat([n.extensions]):r})}static create(t={}){let n=Qk.resolve(t.extensions||[],new Map),s=t.doc instanceof Is?t.doc:Is.of((t.doc||"").split(n.staticFacet(ws.lineSeparator)||VT)),r=t.selection?t.selection instanceof Be?t.selection:Be.single(t.selection.anchor,t.selection.head):Be.single(0);return eK(r,s.length),n.staticFacet(XT)||(r=r.asSingle()),new ws(n,s,r,n.dynamicSlots.map(()=>null),(i,o)=>o.create(i),null)}get tabSize(){return this.facet(ws.tabSize)}get lineBreak(){return this.facet(ws.lineSeparator)||`
`}get readOnly(){return this.facet(aK)}phrase(t,...n){for(let s of this.facet(ws.phrases))if(Object.prototype.hasOwnProperty.call(s,t)){t=s[t];break}return n.length&&(t=t.replace(/\$(\$|\d*)/g,(s,r)=>{if(r=="$")return"$";let i=+(r||1);return!i||i>n.length?s:n[i-1]})),t}languageDataAt(t,n,s=-1){let r=[];for(let i of this.facet(nK))for(let o of i(this,n,s))Object.prototype.hasOwnProperty.call(o,t)&&r.push(o[t]);return r}charCategorizer(t){let n=this.languageDataAt("wordChars",t);return B4e(n.length?n[0]:"")}wordAt(t){let{text:n,from:s,length:r}=this.doc.lineAt(t),i=this.charCategorizer(t),o=t-s,a=t-s;for(;o>0;){let l=Fi(n,o,!1);if(i(n.slice(l,o))!=Mr.Word)break;o=l}for(;a<r;){let l=Fi(n,a);if(i(n.slice(a,l))!=Mr.Word)break;a=l}return o==a?null:Be.range(o+s,a+s)}}ws.allowMultipleSelections=XT;ws.tabSize=Ut.define({combine:e=>e.length?e[0]:4});ws.lineSeparator=sK;ws.readOnly=aK;ws.phrases=Ut.define({compare(e,t){let n=Object.keys(e),s=Object.keys(t);return n.length==s.length&&n.every(r=>e[r]==t[r])}});ws.languageData=nK;ws.changeFilter=rK;ws.transactionFilter=iK;ws.transactionExtender=oK;_m.reconfigure=Pn.define();function Vc(e,t,n={}){let s={};for(let r of e)for(let i of Object.keys(r)){let o=r[i],a=s[i];if(a===void 0)s[i]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(n,i))s[i]=n[i](a,o);else throw new Error("Config merge conflict for field "+i)}for(let r in t)s[r]===void 0&&(s[r]=t[r]);return s}class wh{eq(t){return this==t}range(t,n=t){return ZT.create(t,n,this)}}wh.prototype.startSide=wh.prototype.endSide=0;wh.prototype.point=!1;wh.prototype.mapMode=Lo.TrackDel;function qA(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}let ZT=class uK{constructor(t,n,s){this.from=t,this.to=n,this.value=s}static create(t,n,s){return new uK(t,n,s)}};function e8(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class HA{constructor(t,n,s,r){this.from=t,this.to=n,this.value=s,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(t,n,s,r=0){let i=s?this.to:this.from;for(let o=r,a=i.length;;){if(o==a)return o;let l=o+a>>1,c=i[l]-t||(s?this.value[l].endSide:this.value[l].startSide)-n;if(l==o)return c>=0?o:a;c>=0?a=l:o=l+1}}between(t,n,s,r){for(let i=this.findIndex(n,-1e9,!0),o=this.findIndex(s,1e9,!1,i);i<o;i++)if(r(this.from[i]+t,this.to[i]+t,this.value[i])===!1)return!1}map(t,n){let s=[],r=[],i=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let c=this.value[l],d=this.from[l]+t,h=this.to[l]+t,f,p;if(d==h){let g=n.mapPos(d,c.startSide,c.mapMode);if(g==null||(f=p=g,c.startSide!=c.endSide&&(p=n.mapPos(d,c.endSide),p<f)))continue}else if(f=n.mapPos(d,c.startSide),p=n.mapPos(h,c.endSide),f>p||f==p&&c.startSide>0&&c.endSide<=0)continue;(p-f||c.endSide-c.startSide)<0||(o<0&&(o=f),c.point&&(a=Math.max(a,p-f)),s.push(c),r.push(f-o),i.push(p-o))}return{mapped:s.length?new HA(r,i,s,a):null,pos:o}}}class ms{constructor(t,n,s,r){this.chunkPos=t,this.chunk=n,this.nextLayer=s,this.maxPoint=r}static create(t,n,s,r){return new ms(t,n,s,r)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let n of this.chunk)t+=n.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:n=[],sort:s=!1,filterFrom:r=0,filterTo:i=this.length}=t,o=t.filter;if(n.length==0&&!o)return this;if(s&&(n=n.slice().sort(e8)),this.isEmpty)return n.length?ms.of(n):this;let a=new dK(this,null,-1).goto(0),l=0,c=[],d=new Rc;for(;a.value||l<n.length;)if(l<n.length&&(a.from-n[l].from||a.startSide-n[l].value.startSide)>=0){let h=n[l++];d.addInner(h.from,h.to,h.value)||c.push(h)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==n.length||this.chunkEnd(a.chunkIndex)<n[l].from)&&(!o||r>this.chunkEnd(a.chunkIndex)||i<this.chunkPos[a.chunkIndex])&&d.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||r>a.to||i<a.from||o(a.from,a.to,a.value))&&(d.addInner(a.from,a.to,a.value)||c.push(ZT.create(a.from,a.to,a.value))),a.next());return d.finishInner(this.nextLayer.isEmpty&&!c.length?ms.empty:this.nextLayer.update({add:c,filter:o,filterFrom:r,filterTo:i}))}map(t){if(t.empty||this.isEmpty)return this;let n=[],s=[],r=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],l=this.chunk[o],c=t.touchesRange(a,a+l.length);if(c===!1)r=Math.max(r,l.maxPoint),n.push(l),s.push(t.mapPos(a));else if(c===!0){let{mapped:d,pos:h}=l.map(a,t);d&&(r=Math.max(r,d.maxPoint),n.push(d),s.push(h))}}let i=this.nextLayer.map(t);return n.length==0?i:new ms(s,n,i||ms.empty,r)}between(t,n,s){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let i=this.chunkPos[r],o=this.chunk[r];if(n>=i&&t<=i+o.length&&o.between(i,t-i,n-i,s)===!1)return}this.nextLayer.between(t,n,s)}}iter(t=0){return My.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,n=0){return My.from(t).goto(n)}static compare(t,n,s,r,i=-1){let o=t.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=i),a=n.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=i),l=eO(o,a,s),c=new Hg(o,l,i),d=new Hg(a,l,i);s.iterGaps((h,f,p)=>tO(c,h,d,f,p,r)),s.empty&&s.length==0&&tO(c,0,d,0,0,r)}static eq(t,n,s=0,r){r==null&&(r=999999999);let i=t.filter(d=>!d.isEmpty&&n.indexOf(d)<0),o=n.filter(d=>!d.isEmpty&&t.indexOf(d)<0);if(i.length!=o.length)return!1;if(!i.length)return!0;let a=eO(i,o),l=new Hg(i,a,0).goto(s),c=new Hg(o,a,0).goto(s);for(;;){if(l.to!=c.to||!t8(l.active,c.active)||l.point&&(!c.point||!qA(l.point,c.point)))return!1;if(l.to>r)return!0;l.next(),c.next()}}static spans(t,n,s,r,i=-1){let o=new Hg(t,null,i).goto(n),a=n,l=o.openStart;for(;;){let c=Math.min(o.to,s);if(o.point){let d=o.activeForPoint(o.to),h=o.pointFrom<n?d.length+1:o.point.startSide<0?d.length:Math.min(d.length,l);r.point(a,c,o.point,d,h,o.pointRank),l=Math.min(o.openEnd(c),d.length)}else c>a&&(r.span(a,c,o.active,l),l=o.openEnd(c));if(o.to>s)return l+(o.point&&o.to>s?1:0);a=o.to,o.next()}}static of(t,n=!1){let s=new Rc;for(let r of t instanceof ZT?[t]:n?$4e(t):t)s.add(r.from,r.to,r.value);return s.finish()}static join(t){if(!t.length)return ms.empty;let n=t[t.length-1];for(let s=t.length-2;s>=0;s--)for(let r=t[s];r!=ms.empty;r=r.nextLayer)n=new ms(r.chunkPos,r.chunk,n,Math.max(r.maxPoint,n.maxPoint));return n}}ms.empty=new ms([],[],null,-1);function $4e(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let s=e[n];if(e8(t,s)>0)return e.slice().sort(e8);t=s}return e}ms.empty.nextLayer=ms.empty;class Rc{finishChunk(t){this.chunks.push(new HA(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,t&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(t,n,s){this.addInner(t,n,s)||(this.nextLayer||(this.nextLayer=new Rc)).add(t,n,s)}addInner(t,n,s){let r=t-this.lastTo||s.startSide-this.last.endSide;if(r<=0&&(t-this.lastFrom||s.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return r<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(n-this.chunkStart),this.last=s,this.lastFrom=t,this.lastTo=n,this.value.push(s),s.point&&(this.maxPoint=Math.max(this.maxPoint,n-t)),!0)}addChunk(t,n){if((t-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(t);let s=n.value.length-1;return this.last=n.value[s],this.lastFrom=n.from[s]+t,this.lastTo=n.to[s]+t,!0}finish(){return this.finishInner(ms.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let n=ms.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,n}}function eO(e,t,n){let s=new Map;for(let i of e)for(let o=0;o<i.chunk.length;o++)i.chunk[o].maxPoint<=0&&s.set(i.chunk[o],i.chunkPos[o]);let r=new Set;for(let i of t)for(let o=0;o<i.chunk.length;o++){let a=s.get(i.chunk[o]);a!=null&&(n?n.mapPos(a):a)==i.chunkPos[o]&&!(n!=null&&n.touchesRange(a,a+i.chunk[o].length))&&r.add(i.chunk[o])}return r}class dK{constructor(t,n,s,r=0){this.layer=t,this.skip=n,this.minPoint=s,this.rank=r}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(t,n=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(t,n,!1),this}gotoInner(t,n,s){for(;this.chunkIndex<this.layer.chunk.length;){let r=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(r)||this.layer.chunkEnd(this.chunkIndex)<t||r.maxPoint<this.minPoint))break;this.chunkIndex++,s=!1}if(this.chunkIndex<this.layer.chunk.length){let r=this.layer.chunk[this.chunkIndex].findIndex(t-this.layer.chunkPos[this.chunkIndex],n,!0);(!s||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}forward(t,n){(this.to-t||this.endSide-n)<0&&this.gotoInner(t,n,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let t=this.layer.chunkPos[this.chunkIndex],n=this.layer.chunk[this.chunkIndex],s=t+n.from[this.rangeIndex];if(this.from=s,this.to=t+n.to[this.rangeIndex],this.value=n.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=t}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(t){return this.from-t.from||this.startSide-t.startSide||this.rank-t.rank||this.to-t.to||this.endSide-t.endSide}}class My{constructor(t){this.heap=t}static from(t,n=null,s=-1){let r=[];for(let i=0;i<t.length;i++)for(let o=t[i];!o.isEmpty;o=o.nextLayer)o.maxPoint>=s&&r.push(new dK(o,n,s,i));return r.length==1?r[0]:new My(r)}get startSide(){return this.value?this.value.startSide:0}goto(t,n=-1e9){for(let s of this.heap)s.goto(t,n);for(let s=this.heap.length>>1;s>=0;s--)m5(this.heap,s);return this.next(),this}forward(t,n){for(let s of this.heap)s.forward(t,n);for(let s=this.heap.length>>1;s>=0;s--)m5(this.heap,s);(this.to-t||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),m5(this.heap,0)}}}function m5(e,t){for(let n=e[t];;){let s=(t<<1)+1;if(s>=e.length)break;let r=e[s];if(s+1<e.length&&r.compare(e[s+1])>=0&&(r=e[s+1],s++),n.compare(r)<0)break;e[s]=n,e[t]=r,t=s}}class Hg{constructor(t,n,s){this.minPoint=s,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=My.from(t,n,s)}goto(t,n=-1e9){return this.cursor.goto(t,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=n,this.openStart=-1,this.next(),this}forward(t,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(t,n)}removeActive(t){sw(this.active,t),sw(this.activeTo,t),sw(this.activeRank,t),this.minActive=nO(this.active,this.activeTo)}addActive(t){let n=0,{value:s,to:r,rank:i}=this.cursor;for(;n<this.activeRank.length&&(i-this.activeRank[n]||r-this.activeTo[n])>0;)n++;rw(this.active,n,s),rw(this.activeTo,n,r),rw(this.activeRank,n,i),t&&rw(t,n,this.cursor.from),this.minActive=nO(this.active,this.activeTo)}next(){let t=this.to,n=this.point;this.point=null;let s=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>t){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),s&&sw(s,r)}else if(this.cursor.value)if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let i=this.cursor.value;if(!i.point)this.addActive(s),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=i,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=i.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(s){this.openStart=0;for(let r=s.length-1;r>=0&&s[r]<t;r--)this.openStart++}}activeForPoint(t){if(!this.active.length)return this.active;let n=[];for(let s=this.active.length-1;s>=0&&!(this.activeRank[s]<this.pointRank);s--)(this.activeTo[s]>t||this.activeTo[s]==t&&this.active[s].endSide>=this.point.endSide)&&n.push(this.active[s]);return n.reverse()}openEnd(t){let n=0;for(let s=this.activeTo.length-1;s>=0&&this.activeTo[s]>t;s--)n++;return n}}function tO(e,t,n,s,r,i){e.goto(t),n.goto(s);let o=s+r,a=s,l=s-t,c=!!i.boundChange;for(let d=!1;;){let h=e.to+l-n.to,f=h||e.endSide-n.endSide,p=f<0?e.to+l:n.to,g=Math.min(p,o);if(e.point||n.point?(e.point&&n.point&&qA(e.point,n.point)&&t8(e.activeForPoint(e.to),n.activeForPoint(n.to))||i.comparePoint(a,g,e.point,n.point),d=!1):(d&&i.boundChange(a),g>a&&!t8(e.active,n.active)&&i.compareRange(a,g,e.active,n.active),c&&g<o&&(h||e.openEnd(p)!=n.openEnd(p))&&(d=!0)),p>o)break;a=p,f<=0&&e.next(),f>=0&&n.next()}}function t8(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!qA(e[n],t[n]))return!1;return!0}function sw(e,t){for(let n=t,s=e.length-1;n<s;n++)e[n]=e[n+1];e.pop()}function rw(e,t,n){for(let s=e.length-1;s>=t;s--)e[s+1]=e[s];e[t]=n}function nO(e,t){let n=-1,s=1e9;for(let r=0;r<t.length;r++)(t[r]-s||e[r].endSide-e[n].endSide)<0&&(n=r,s=t[r]);return n}function ng(e,t,n=e.length){let s=0;for(let r=0;r<n&&r<e.length;)e.charCodeAt(r)==9?(s+=t-s%t,r++):(s++,r=Fi(e,r));return s}function n8(e,t,n,s){for(let r=0,i=0;;){if(i>=t)return r;if(r==e.length)break;i+=e.charCodeAt(r)==9?n-i%n:1,r=Fi(e,r)}return s===!0?-1:e.length}const s8="ͼ",sO=typeof Symbol>"u"?"__"+s8:Symbol.for(s8),r8=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),rO=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class xh{constructor(t,n){this.rules=[];let{finish:s}=n||{};function r(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function i(o,a,l,c){let d=[],h=/^@(\w+)\b/.exec(o[0]),f=h&&h[1]=="keyframes";if(h&&a==null)return l.push(o[0]+";");for(let p in a){let g=a[p];if(/&/.test(p))i(p.split(/,\s*/).map(y=>o.map(w=>y.replace(/&/,w))).reduce((y,w)=>y.concat(w)),g,l);else if(g&&typeof g=="object"){if(!h)throw new RangeError("The value of a property ("+p+") should be a primitive value.");i(r(p),g,d,f)}else g!=null&&d.push(p.replace(/_.*/,"").replace(/[A-Z]/g,y=>"-"+y.toLowerCase())+": "+g+";")}(d.length||f)&&l.push((s&&!h&&!c?o.map(s):o).join(", ")+" {"+d.join(" ")+"}")}for(let o in t)i(r(o),t[o],this.rules)}getRules(){return this.rules.join(`
`)}static newName(){let t=rO[sO]||1;return rO[sO]=t+1,s8+t.toString(36)}static mount(t,n,s){let r=t[r8],i=s&&s.nonce;r?i&&r.setNonce(i):r=new z4e(t,i),r.mount(Array.isArray(n)?n:[n],t)}}let iO=new Map;class z4e{constructor(t,n){let s=t.ownerDocument||t,r=s.defaultView;if(!t.head&&t.adoptedStyleSheets&&r.CSSStyleSheet){let i=iO.get(s);if(i)return t[r8]=i;this.sheet=new r.CSSStyleSheet,iO.set(s,this)}else this.styleTag=s.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],t[r8]=this}mount(t,n){let s=this.sheet,r=0,i=0;for(let o=0;o<t.length;o++){let a=t[o],l=this.modules.indexOf(a);if(l<i&&l>-1&&(this.modules.splice(l,1),i--,l=-1),l==-1){if(this.modules.splice(i++,0,a),s)for(let c=0;c<a.rules.length;c++)s.insertRule(a.rules[c],r++)}else{for(;i<l;)r+=this.modules[i++].rules.length;r+=a.rules.length,i++}}if(s)n.adoptedStyleSheets.indexOf(this.sheet)<0&&(n.adoptedStyleSheets=[this.sheet,...n.adoptedStyleSheets]);else{let o="";for(let l=0;l<this.modules.length;l++)o+=this.modules[l].getRules()+`
`;this.styleTag.textContent=o;let a=n.head||n;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(t){this.styleTag&&this.styleTag.getAttribute("nonce")!=t&&this.styleTag.setAttribute("nonce",t)}}var kh={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:"'"},Ny={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},F4e=typeof navigator<"u"&&/Mac/.test(navigator.platform),q4e=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var eo=0;eo<10;eo++)kh[48+eo]=kh[96+eo]=String(eo);for(var eo=1;eo<=24;eo++)kh[eo+111]="F"+eo;for(var eo=65;eo<=90;eo++)kh[eo]=String.fromCharCode(eo+32),Ny[eo]=String.fromCharCode(eo);for(var p5 in kh)Ny.hasOwnProperty(p5)||(Ny[p5]=kh[p5]);function H4e(e){var t=F4e&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||q4e&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?Ny:kh)[e.keyCode]||e.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function tr(){var e=arguments[0];typeof e=="string"&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var s in n)if(Object.prototype.hasOwnProperty.call(n,s)){var r=n[s];typeof r=="string"?e.setAttribute(s,r):r!=null&&(e[s]=r)}t++}for(;t<arguments.length;t++)hK(e,arguments[t]);return e}function hK(e,t){if(typeof t=="string")e.appendChild(document.createTextNode(t));else if(t!=null)if(t.nodeType!=null)e.appendChild(t);else if(Array.isArray(t))for(var n=0;n<t.length;n++)hK(e,t[n]);else throw new RangeError("Unsupported child node: "+t)}let Mo=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},i8=typeof document<"u"?document:{documentElement:{style:{}}};const o8=/Edge\/(\d+)/.exec(Mo.userAgent),fK=/MSIE \d/.test(Mo.userAgent),a8=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Mo.userAgent),q_=!!(fK||a8||o8),oO=!q_&&/gecko\/(\d+)/i.test(Mo.userAgent),g5=!q_&&/Chrome\/(\d+)/.exec(Mo.userAgent),aO="webkitFontSmoothing"in i8.documentElement.style,l8=!q_&&/Apple Computer/.test(Mo.vendor),lO=l8&&(/Mobile\/\w+/.test(Mo.userAgent)||Mo.maxTouchPoints>2);var Ht={mac:lO||/Mac/.test(Mo.platform),windows:/Win/.test(Mo.platform),linux:/Linux|X11/.test(Mo.platform),ie:q_,ie_version:fK?i8.documentMode||6:a8?+a8[1]:o8?+o8[1]:0,gecko:oO,gecko_version:oO?+(/Firefox\/(\d+)/.exec(Mo.userAgent)||[0,0])[1]:0,chrome:!!g5,chrome_version:g5?+g5[1]:0,ios:lO,android:/Android\b/.test(Mo.userAgent),webkit:aO,webkit_version:aO?+(/\bAppleWebKit\/(\d+)/.exec(Mo.userAgent)||[0,0])[1]:0,safari:l8,safari_version:l8?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Mo.userAgent)||[0,0])[1]:0,tabSize:i8.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function UA(e,t){for(let n in e)n=="class"&&t.class?t.class+=" "+e.class:n=="style"&&t.style?t.style+=";"+e.style:t[n]=e[n];return t}const Zk=Object.create(null);function VA(e,t,n){if(e==t)return!0;e||(e=Zk),t||(t=Zk);let s=Object.keys(e),r=Object.keys(t);if(s.length-0!=r.length-0)return!1;for(let i of s)if(i!=n&&(r.indexOf(i)==-1||e[i]!==t[i]))return!1;return!0}function U4e(e,t){for(let n=e.attributes.length-1;n>=0;n--){let s=e.attributes[n].name;t[s]==null&&e.removeAttribute(s)}for(let n in t){let s=t[n];n=="style"?e.style.cssText=s:e.getAttribute(n)!=s&&e.setAttribute(n,s)}}function cO(e,t,n){let s=!1;if(t)for(let r in t)n&&r in n||(s=!0,r=="style"?e.style.cssText="":e.removeAttribute(r));if(n)for(let r in n)t&&t[r]==n[r]||(s=!0,r=="style"?e.style.cssText=n[r]:e.setAttribute(r,n[r]));return s}function V4e(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let s=e.attributes[n];t[s.name]=s.value}return t}class Fa{eq(t){return!1}updateDOM(t,n,s){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(t){return!0}coordsAt(t,n,s){return null}get isHidden(){return!1}get editable(){return!1}destroy(t){}}var oo=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(oo||(oo={}));class sn extends wh{constructor(t,n,s,r){super(),this.startSide=t,this.endSide=n,this.widget=s,this.spec=r}get heightRelevant(){return!1}static mark(t){return new Eb(t)}static widget(t){let n=Math.max(-1e4,Math.min(1e4,t.side||0)),s=!!t.block;return n+=s&&!t.inlineOrder?n>0?3e8:-4e8:n>0?1e8:-1e8,new Qf(t,n,n,s,t.widget||null,!1)}static replace(t){let n=!!t.block,s,r;if(t.isBlockGap)s=-5e8,r=4e8;else{let{start:i,end:o}=mK(t,n);s=(i?n?-3e8:-1:5e8)-1,r=(o?n?2e8:1:-6e8)+1}return new Qf(t,s,r,n,t.widget||null,!0)}static line(t){return new Ab(t)}static set(t,n=!1){return ms.of(t,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}sn.none=ms.empty;class Eb extends sn{constructor(t){let{start:n,end:s}=mK(t);super(n?-1:5e8,s?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?UA(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||Zk}eq(t){return this==t||t instanceof Eb&&this.tagName==t.tagName&&VA(this.attrs,t.attrs)}range(t,n=t){if(t>=n)throw new RangeError("Mark decorations may not be empty");return super.range(t,n)}}Eb.prototype.point=!1;class Ab extends sn{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof Ab&&this.spec.class==t.spec.class&&VA(this.spec.attributes,t.spec.attributes)}range(t,n=t){if(n!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,n)}}Ab.prototype.mapMode=Lo.TrackBefore;Ab.prototype.point=!0;class Qf extends sn{constructor(t,n,s,r,i,o){super(n,s,i,t),this.block=r,this.isReplace=o,this.mapMode=r?n<=0?Lo.TrackBefore:Lo.TrackAfter:Lo.TrackDel}get type(){return this.startSide!=this.endSide?oo.WidgetRange:this.startSide<=0?oo.WidgetBefore:oo.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof Qf&&W4e(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(t,n=t){if(this.isReplace&&(t>n||t==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(t,n)}}Qf.prototype.point=!0;function mK(e,t=!1){let{inclusiveStart:n,inclusiveEnd:s}=e;return n==null&&(n=e.inclusive),s==null&&(s=e.inclusive),{start:n??t,end:s??t}}function W4e(e,t){return e==t||!!(e&&t&&e.compare(t))}function Xp(e,t,n,s=0){let r=n.length-1;r>=0&&n[r]+s>=e?n[r]=Math.max(n[r],t):n.push(e,t)}class Iy extends wh{constructor(t,n,s){super(),this.tagName=t,this.attributes=n,this.rank=s}eq(t){return t==this||t instanceof Iy&&this.tagName==t.tagName&&VA(this.attributes,t.attributes)}static create(t){return new Iy(t.tagName,t.attributes||Zk,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(t,n=!1){return ms.of(t,n)}}Iy.prototype.startSide=Iy.prototype.endSide=-1;function Ry(e){let t;return e.nodeType==11?t=e.getSelection?e:e.ownerDocument:t=e,t.getSelection()}function c8(e,t){return t?e==t||e.contains(t.nodeType!=1?t.parentNode:t):!1}function X1(e,t){if(!t.anchorNode)return!1;try{return c8(e,t.anchorNode)}catch{return!1}}function Q1(e){return e.nodeType==3?Ly(e,0,e.nodeValue.length).getClientRects():e.nodeType==1?e.getClientRects():[]}function J1(e,t,n,s){return n?uO(e,t,n,s,-1)||uO(e,t,n,s,1):!1}function _h(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function e2(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function uO(e,t,n,s,r){for(;;){if(e==n&&t==s)return!0;if(t==(r<0?0:Hu(e))){if(e.nodeName=="DIV")return!1;let i=e.parentNode;if(!i||i.nodeType!=1)return!1;t=_h(e)+(r<0?0:1),e=i}else if(e.nodeType==1){if(e=e.childNodes[t+(r<0?-1:0)],e.nodeType==1&&e.contentEditable=="false")return!1;t=r<0?Hu(e):0}else return!1}}function Hu(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function jy(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function G4e(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function pK(e,t){let n=t.width/e.offsetWidth,s=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(s>.995&&s<1.005||!isFinite(s)||Math.abs(t.height-e.offsetHeight)<1)&&(s=1),{scaleX:n,scaleY:s}}function K4e(e,t,n,s,r,i,o,a){let l=e.ownerDocument,c=l.defaultView||window;for(let d=e,h=!1;d&&!h;)if(d.nodeType==1){let f,p=d==l.body,g=1,y=1;if(p)f=G4e(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(d).position)&&(h=!0),d.scrollHeight<=d.clientHeight&&d.scrollWidth<=d.clientWidth){d=d.assignedSlot||d.parentNode;continue}let b=d.getBoundingClientRect();({scaleX:g,scaleY:y}=pK(d,b)),f={left:b.left,right:b.left+d.clientWidth*g,top:b.top,bottom:b.top+d.clientHeight*y}}let w=0,v=0;if(r=="nearest")t.top<f.top+o?(v=t.top-(f.top+o),n>0&&t.bottom>f.bottom+v&&(v=t.bottom-f.bottom+o)):t.bottom>f.bottom-o&&(v=t.bottom-f.bottom+o,n<0&&t.top-v<f.top&&(v=t.top-(f.top+o)));else{let b=t.bottom-t.top,x=f.bottom-f.top;v=(r=="center"&&b<=x?t.top+b/2-x/2:r=="start"||r=="center"&&n<0?t.top-o:t.bottom-x+o)-f.top}if(s=="nearest"?t.left<f.left+i?(w=t.left-(f.left+i),n>0&&t.right>f.right+w&&(w=t.right-f.right+i)):t.right>f.right-i&&(w=t.right-f.right+i,n<0&&t.left<f.left+w&&(w=t.left-(f.left+i))):w=(s=="center"?t.left+(t.right-t.left)/2-(f.right-f.left)/2:s=="start"==a?t.left-i:t.right-(f.right-f.left)+i)-f.left,w||v)if(p)c.scrollBy(w,v);else{let b=0,x=0;if(v){let k=d.scrollTop;d.scrollTop+=v/y,x=(d.scrollTop-k)*y}if(w){let k=d.scrollLeft;d.scrollLeft+=w/g,b=(d.scrollLeft-k)*g}t={left:t.left-b,top:t.top-x,right:t.right-b,bottom:t.bottom-x},b&&Math.abs(b-w)<1&&(s="nearest"),x&&Math.abs(x-v)<1&&(r="nearest")}if(p)break;(t.top<f.top||t.bottom>f.bottom||t.left<f.left||t.right>f.right)&&(t={left:Math.max(t.left,f.left),right:Math.min(t.right,f.right),top:Math.max(t.top,f.top),bottom:Math.min(t.bottom,f.bottom)}),d=d.assignedSlot||d.parentNode}else if(d.nodeType==11)d=d.host;else break}function gK(e,t=!0){let n=e.ownerDocument,s=null,r=null;for(let i=e.parentNode;i&&!(i==n.body||(!t||s)&&r);)if(i.nodeType==1)!r&&i.scrollHeight>i.clientHeight&&(r=i),t&&!s&&i.scrollWidth>i.clientWidth&&(s=i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;return{x:s,y:r}}class Y4e{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:n,focusNode:s}=t;this.set(n,Math.min(t.anchorOffset,n?Hu(n):0),s,Math.min(t.focusOffset,s?Hu(s):0))}set(t,n,s,r){this.anchorNode=t,this.anchorOffset=n,this.focusNode=s,this.focusOffset=r}}let bf=null;Ht.safari&&Ht.safari_version>=26&&(bf=!1);function yK(e){if(e.setActive)return e.setActive();if(bf)return e.focus(bf);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(bf==null?{get preventScroll(){return bf={preventScroll:!0},!0}}:void 0),!bf){bf=!1;for(let n=0;n<t.length;){let s=t[n++],r=t[n++],i=t[n++];s.scrollTop!=r&&(s.scrollTop=r),s.scrollLeft!=i&&(s.scrollLeft=i)}}}let dO;function Ly(e,t,n=t){let s=dO||(dO=document.createRange());return s.setEnd(e,n),s.setStart(e,t),s}function Qp(e,t,n,s){let r={key:t,code:t,keyCode:n,which:n,cancelable:!0};s&&({altKey:r.altKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey,metaKey:r.metaKey}=s);let i=new KeyboardEvent("keydown",r);i.synthetic=!0,e.dispatchEvent(i);let o=new KeyboardEvent("keyup",r);return o.synthetic=!0,e.dispatchEvent(o),i.defaultPrevented||o.defaultPrevented}function X4e(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function Q4e(e,t){let n=t.focusNode,s=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=s)return!1;for(s=Math.min(s,Hu(n));;)if(s){if(n.nodeType!=1)return!1;let r=n.childNodes[s-1];r.contentEditable=="false"?s--:(n=r,s=Hu(n))}else{if(n==e)return!0;s=_h(n),n=n.parentNode}}function bK(e){return e instanceof Window?e.pageYOffset>Math.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4):e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function vK(e,t){for(let n=e,s=t;;){if(n.nodeType==3&&s>0)return{node:n,offset:s};if(n.nodeType==1&&s>0){if(n.contentEditable=="false")return null;n=n.childNodes[s-1],s=Hu(n)}else if(n.parentNode&&!e2(n))s=_h(n),n=n.parentNode;else return null}}function wK(e,t){for(let n=e,s=t;;){if(n.nodeType==3&&s<n.nodeValue.length)return{node:n,offset:s};if(n.nodeType==1&&s<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[s],s=0}else if(n.parentNode&&!e2(n))s=_h(n)+1,n=n.parentNode;else return null}}class Ll{constructor(t,n,s=!0){this.node=t,this.offset=n,this.precise=s}static before(t,n){return new Ll(t.parentNode,_h(t),n)}static after(t,n){return new Ll(t.parentNode,_h(t)+1,n)}}var cr=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(cr||(cr={}));const Jf=cr.LTR,WA=cr.RTL;function xK(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}const J4e=xK("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Z4e=xK("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),u8=Object.create(null),Jl=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);u8[t]=n,u8[n]=-t}function kK(e){return e<=247?J4e[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?Z4e[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}const eSe=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class _c{get dir(){return this.level%2?WA:Jf}constructor(t,n,s){this.from=t,this.to=n,this.level=s}side(t,n){return this.dir==n==t?this.to:this.from}forward(t,n){return t==(this.dir==n)}static find(t,n,s,r){let i=-1;for(let o=0;o<t.length;o++){let a=t[o];if(a.from<=n&&a.to>=n){if(a.level==s)return o;(i<0||(r!=0?r<0?a.from<n:a.to>n:t[i].level>a.level))&&(i=o)}}if(i<0)throw new RangeError("Index out of range");return i}}function _K(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let s=e[n],r=t[n];if(s.from!=r.from||s.to!=r.to||s.direction!=r.direction||!_K(s.inner,r.inner))return!1}return!0}const or=[];function tSe(e,t,n,s,r){for(let i=0;i<=s.length;i++){let o=i?s[i-1].to:t,a=i<s.length?s[i].from:n,l=i?256:r;for(let c=o,d=l,h=l;c<a;c++){let f=kK(e.charCodeAt(c));f==512?f=d:f==8&&h==4&&(f=16),or[c]=f==4?2:f,f&7&&(h=f),d=f}for(let c=o,d=l,h=l;c<a;c++){let f=or[c];if(f==128)c<a-1&&d==or[c+1]&&d&24?f=or[c]=d:or[c]=256;else if(f==64){let p=c+1;for(;p<a&&or[p]==64;)p++;let g=c&&d==8||p<n&&or[p]==8?h==1?1:8:256;for(let y=c;y<p;y++)or[y]=g;c=p-1}else f==8&&h==1&&(or[c]=1);d=f,f&7&&(h=f)}}}function nSe(e,t,n,s,r){let i=r==1?2:1;for(let o=0,a=0,l=0;o<=s.length;o++){let c=o?s[o-1].to:t,d=o<s.length?s[o].from:n;for(let h=c,f,p,g;h<d;h++)if(p=u8[f=e.charCodeAt(h)])if(p<0){for(let y=a-3;y>=0;y-=3)if(Jl[y+1]==-p){let w=Jl[y+2],v=w&2?r:w&4?w&1?i:r:0;v&&(or[h]=or[Jl[y]]=v),a=y;break}}else{if(Jl.length==189)break;Jl[a++]=h,Jl[a++]=f,Jl[a++]=l}else if((g=or[h])==2||g==1){let y=g==r;l=y?0:1;for(let w=a-3;w>=0;w-=3){let v=Jl[w+2];if(v&2)break;if(y)Jl[w+2]|=2;else{if(v&4)break;Jl[w+2]|=4}}}}}function sSe(e,t,n,s){for(let r=0,i=s;r<=n.length;r++){let o=r?n[r-1].to:e,a=r<n.length?n[r].from:t;for(let l=o;l<a;){let c=or[l];if(c==256){let d=l+1;for(;;)if(d==a){if(r==n.length)break;d=n[r++].to,a=r<n.length?n[r].from:t}else if(or[d]==256)d++;else break;let h=i==1,f=(d<t?or[d]:s)==1,p=h==f?h?1:2:s;for(let g=d,y=r,w=y?n[y-1].to:e;g>l;)g==w&&(g=n[--y].from,w=y?n[y-1].to:e),or[--g]=p;l=d}else i=c,l++}}}function d8(e,t,n,s,r,i,o){let a=s%2?2:1;if(s%2==r%2)for(let l=t,c=0;l<n;){let d=!0,h=!1;if(c==i.length||l<i[c].from){let y=or[l];y!=a&&(d=!1,h=y==16)}let f=!d&&a==1?[]:null,p=d?s:s+1,g=l;e:for(;;)if(c<i.length&&g==i[c].from){if(h)break e;let y=i[c];if(!d)for(let w=y.to,v=c+1;;){if(w==n)break e;if(v<i.length&&i[v].from==w)w=i[v++].to;else{if(or[w]==a)break e;break}}if(c++,f)f.push(y);else{y.from>l&&o.push(new _c(l,y.from,p));let w=y.direction==Jf!=!(p%2);h8(e,w?s+1:s,r,y.inner,y.from,y.to,o),l=y.to}g=y.to}else{if(g==n||(d?or[g]!=a:or[g]==a))break;g++}f?d8(e,l,g,s+1,r,f,o):l<g&&o.push(new _c(l,g,p)),l=g}else for(let l=n,c=i.length;l>t;){let d=!0,h=!1;if(!c||l>i[c-1].to){let y=or[l-1];y!=a&&(d=!1,h=y==16)}let f=!d&&a==1?[]:null,p=d?s:s+1,g=l;e:for(;;)if(c&&g==i[c-1].to){if(h)break e;let y=i[--c];if(!d)for(let w=y.from,v=c;;){if(w==t)break e;if(v&&i[v-1].to==w)w=i[--v].from;else{if(or[w-1]==a)break e;break}}if(f)f.push(y);else{y.to<l&&o.push(new _c(y.to,l,p));let w=y.direction==Jf!=!(p%2);h8(e,w?s+1:s,r,y.inner,y.from,y.to,o),l=y.from}g=y.from}else{if(g==t||(d?or[g-1]!=a:or[g-1]==a))break;g--}f?d8(e,g,l,s+1,r,f,o):g<l&&o.push(new _c(g,l,p)),l=g}}function h8(e,t,n,s,r,i,o){let a=t%2?2:1;tSe(e,r,i,s,a),nSe(e,r,i,s,a),sSe(r,i,s,a),d8(e,r,i,t,n,s,o)}function rSe(e,t,n){if(!e)return[new _c(0,0,t==WA?1:0)];if(t==Jf&&!n.length&&!eSe.test(e))return SK(e.length);if(n.length)for(;e.length>or.length;)or[or.length]=256;let s=[],r=t==Jf?0:1;return h8(e,r,r,n,0,e.length,s),s}function SK(e){return[new _c(0,e,0)]}let CK="";function iSe(e,t,n,s,r){var i;let o=s.head-e.from,a=_c.find(t,o,(i=s.bidiLevel)!==null&&i!==void 0?i:-1,s.assoc),l=t[a],c=l.side(r,n);if(o==c){let f=a+=r?1:-1;if(f<0||f>=t.length)return null;l=t[a=f],o=l.side(!r,n),c=l.side(r,n)}let d=Fi(e.text,o,l.forward(r,n));(d<l.from||d>l.to)&&(d=c),CK=e.text.slice(Math.min(o,d),Math.max(o,d));let h=a==(r?t.length-1:0)?null:t[a+(r?1:-1)];return h&&d==c&&h.level+(r?0:1)<l.level?Be.cursor(h.side(!r,n)+e.from,h.forward(r,n)?1:-1,h.level):Be.cursor(d+e.from,l.forward(r,n)?-1:1,l.level)}function oSe(e,t,n){for(let s=t;s<n;s++){let r=kK(e.charCodeAt(s));if(r==1)return Jf;if(r==2||r==4)return WA}return Jf}const TK=Ut.define(),EK=Ut.define(),AK=Ut.define(),MK=Ut.define(),f8=Ut.define(),NK=Ut.define(),IK=Ut.define(),GA=Ut.define(),KA=Ut.define(),RK=Ut.define({combine:e=>e.some(t=>t)}),jK=Ut.define({combine:e=>e.some(t=>t)}),LK=Ut.define();class Jp{constructor(t,n,s,r,i,o=!1){this.range=t,this.y=n,this.x=s,this.yMargin=r,this.xMargin=i,this.isSnapshot=o}map(t){return t.empty?this:new Jp(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new Jp(Be.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const iw=Pn.define({map:(e,t)=>e.map(t)}),DK=Pn.define();function ta(e,t,n){let s=e.facet(MK);s.length?s[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+":",t):console.error(t))}const mu=Ut.define({combine:e=>e.length?e[0]:!0});let aSe=0;const Ip=Ut.define({combine(e){return e.filter((t,n)=>{for(let s=0;s<n;s++)if(e[s].plugin==t.plugin)return!1;return!0})}});class Ir{constructor(t,n,s,r,i){this.id=t,this.create=n,this.domEventHandlers=s,this.domEventObservers=r,this.baseExtensions=i(this),this.extension=this.baseExtensions.concat(Ip.of({plugin:this,arg:void 0}))}of(t){return this.baseExtensions.concat(Ip.of({plugin:this,arg:t}))}static define(t,n){const{eventHandlers:s,eventObservers:r,provide:i,decorations:o}=n||{};return new Ir(aSe++,t,s,r,a=>{let l=[];return o&&l.push(H_.of(c=>{let d=c.plugin(a);return d?o(d):sn.none})),i&&l.push(i(a)),l})}static fromClass(t,n){return Ir.define((s,r)=>new t(s,r),n)}}class y5{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(t){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(s){if(ta(n.state,s,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(t,this.spec.arg)}catch(n){ta(t.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(s){ta(t.state,s,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const OK=Ut.define(),YA=Ut.define(),H_=Ut.define(),PK=Ut.define(),XA=Ut.define(),Mb=Ut.define(),BK=Ut.define();function hO(e,t){let n=e.state.facet(BK);if(!n.length)return n;let s=n.map(i=>i instanceof Function?i(e):i),r=[];return ms.spans(s,t.from,t.to,{point(){},span(i,o,a,l){let c=i-t.from,d=o-t.from,h=r;for(let f=a.length-1;f>=0;f--,l--){let p=a[f].spec.bidiIsolate,g;if(p==null&&(p=oSe(t.text,c,d)),l>0&&h.length&&(g=h[h.length-1]).to==c&&g.direction==p)g.to=d,h=g.inner;else{let y={from:c,to:d,direction:p,inner:[]};h.push(y),h=y.inner}}}}),r}const $K=Ut.define();function QA(e){let t=0,n=0,s=0,r=0;for(let i of e.state.facet($K)){let o=i(e);o&&(o.left!=null&&(t=Math.max(t,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(s=Math.max(s,o.top)),o.bottom!=null&&(r=Math.max(r,o.bottom)))}return{left:t,right:n,top:s,bottom:r}}const d1=Ut.define();class fl{constructor(t,n,s,r){this.fromA=t,this.toA=n,this.fromB=s,this.toB=r}join(t){return new fl(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let n=t.length,s=this;for(;n>0;n--){let r=t[n-1];if(!(r.fromA>s.toA)){if(r.toA<s.fromA)break;s=s.join(r),t.splice(n-1,1)}}return t.splice(n,0,s),t}static extendWithRanges(t,n){if(n.length==0)return t;let s=[];for(let r=0,i=0,o=0;;){let a=r<t.length?t[r].fromB:1e9,l=i<n.length?n[i]:1e9,c=Math.min(a,l);if(c==1e9)break;let d=c+o,h=c,f=d;for(;;)if(i<n.length&&n[i]<=h){let p=n[i+1];i+=2,h=Math.max(h,p);for(let g=r;g<t.length&&t[g].fromB<=h;g++)o=t[g].toA-t[g].toB;f=Math.max(f,p+o)}else if(r<t.length&&t[r].fromB<=h){let p=t[r++];h=Math.max(h,p.toB),f=Math.max(f,p.toA),o=p.toA-p.toB}else break;s.push(new fl(d,f,c,h))}return s}}class t2{constructor(t,n,s){this.view=t,this.state=n,this.transactions=s,this.flags=0,this.startState=t.state,this.changes=_i.empty(this.startState.doc.length);for(let i of s)this.changes=this.changes.compose(i.changes);let r=[];this.changes.iterChangedRanges((i,o,a,l)=>r.push(new fl(i,o,a,l))),this.changedRanges=r}static create(t,n,s){return new t2(t,n,s)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(t=>t.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const lSe=[];class Wr{constructor(t,n,s=0){this.dom=t,this.length=n,this.flags=s,this.parent=null,t.cmTile=this}get breakAfter(){return this.flags&1}get children(){return lSe}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(t){if(this.flags|=2,this.flags&4){this.flags&=-5;let n=this.domAttrs;n&&U4e(this.dom,n)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(t){this.dom=t,t.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t,n=this.posAtStart){let s=n;for(let r of this.children){if(r==t)return s;s+=r.length+r.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}covers(t){return!0}coordsIn(t,n){return null}domPosFor(t,n){let s=_h(this.dom),r=this.length?t>0:n>0;return new Ll(this.parent.dom,s+(r?1:0),t==0||t==this.length)}markDirty(t){this.flags&=-3,t&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let t=this;t;t=t.parent)if(t instanceof V_)return t;return null}static get(t){return t.cmTile}}class U_ extends Wr{constructor(t){super(t,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(t){this.children.push(t),t.parent=this}sync(t){if(this.flags&2)return;super.sync(t);let n=this.dom,s=null,r,i=(t==null?void 0:t.node)==n?t:null,o=0;for(let a of this.children){if(a.sync(t),o+=a.length+a.breakAfter,r=s?s.nextSibling:n.firstChild,i&&r!=a.dom&&(i.written=!0),a.dom.parentNode==n)for(;r&&r!=a.dom;)r=fO(r);else n.insertBefore(a.dom,r);s=a.dom}for(r=s?s.nextSibling:n.firstChild,i&&r&&(i.written=!0);r;)r=fO(r);this.length=o}}function fO(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class V_ extends U_{constructor(t,n){super(n),this.view=t}owns(t){for(;t;t=t.parent)if(t==this)return!0;return!1}isBlock(){return!0}nearest(t){for(;;){if(!t)return null;let n=Wr.get(t);if(n&&this.owns(n))return n;t=t.parentNode}}blockTiles(t){for(let n=[],s=this,r=0,i=0;;)if(r==s.children.length){if(!n.length)return;s=s.parent,s.breakAfter&&i++,r=n.pop()}else{let o=s.children[r++];if(o instanceof Nu)n.push(r),s=o,r=0;else{let a=i+o.length,l=t(o,i);if(l!==void 0)return l;i=a+o.breakAfter}}}resolveBlock(t,n){let s,r=-1,i,o=-1;if(this.blockTiles((a,l)=>{let c=l+a.length;if(t>=l&&t<=c){if(a.isWidget()&&n>=-1&&n<=1){if(a.flags&32)return!0;a.flags&16&&(s=void 0)}(l<t||t==c&&(n<-1?a.length:a.covers(1)))&&(!s||!a.isWidget()&&s.isWidget())&&(s=a,r=t-l),(c>t||t==l&&(n>1?a.length:a.covers(-1)))&&(!i||!a.isWidget()&&i.isWidget())&&(i=a,o=t-l)}}),!s&&!i)throw new Error("No tile at position "+t);return s&&n<0||!i?{tile:s,offset:r}:{tile:i,offset:o}}}class Nu extends U_{constructor(t,n){super(t),this.wrapper=n}isBlock(){return!0}covers(t){return this.children.length?t<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(t,n){let s=new Nu(n||document.createElement(t.tagName),t);return n||(s.flags|=4),s}}class S0 extends U_{constructor(t,n){super(t),this.attrs=n}isLine(){return!0}static start(t,n,s){let r=new S0(n||document.createElement("div"),t);return(!n||!s)&&(r.flags|=4),r}get domAttrs(){return this.attrs}resolveInline(t,n,s){let r=null,i=-1,o=null,a=-1;function l(d,h){for(let f=0,p=0;f<d.children.length&&p<=h;f++){let g=d.children[f],y=p+g.length;y>=h&&(g.isComposite()?l(g,h-p):(!o||o.isHidden&&(n>0||s&&uSe(o,g)))&&(y>h||g.flags&32)?(o=g,a=h-p):(p<h||g.flags&16&&!g.isHidden)&&(r=g,i=h-p)),p=y}}l(this,t);let c=(n<0?r:o)||r||o;return c?{tile:c,offset:c==r?i:a}:null}coordsIn(t,n){let s=this.resolveInline(t,n,!0);return s?s.tile.coordsIn(Math.max(0,s.offset),n):cSe(this)}domIn(t,n){let s=this.resolveInline(t,n);if(s){let{tile:r,offset:i}=s;if(this.dom.contains(r.dom))return r.isText()?new Ll(r.dom,Math.min(r.dom.nodeValue.length,i)):r.domPosFor(i,r.flags&16?1:r.flags&32?-1:n);let o=s.tile.parent,a=!1;for(let l of o.children){if(a)return new Ll(l.dom,0);l==s.tile&&(a=!0)}}return new Ll(this.dom,0)}}function cSe(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=Q1(t);return n[n.length-1]||null}function uSe(e,t){let n=e.coordsIn(0,1),s=t.coordsIn(0,1);return n&&s&&s.top<n.bottom}class ea extends U_{constructor(t,n){super(t),this.mark=n}get domAttrs(){return this.mark.attrs}static of(t,n){let s=new ea(n||document.createElement(t.tagName),t);return n||(s.flags|=4),s}}class If extends Wr{constructor(t,n){super(t,n.length),this.text=n}sync(t){this.flags&2||(super.sync(t),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(t,n){let s=this.dom.nodeValue.length;t>s&&(t=s);let r=t,i=t,o=0;t==0&&n<0||t==s&&n>=0?Ht.chrome||Ht.gecko||(t?(r--,o=1):i<s&&(i++,o=-1)):n<0?r--:i<s&&i++;let a=Ly(this.dom,r,i).getClientRects();if(!a.length)return null;let l=a[(o?o<0:n>=0)?0:a.length-1];return Ht.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),o?jy(l,o<0):l||null}static of(t,n){let s=new If(n||document.createTextNode(t),t);return n||(s.flags|=2),s}}class Zf extends Wr{constructor(t,n,s,r){super(t,n,r),this.widget=s}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(t){return this.flags&48?!1:(this.flags&(t<0?64:128))>0}coordsIn(t,n){return this.coordsInWidget(t,n,!1)}coordsInWidget(t,n,s){let r=this.widget.coordsAt(this.dom,t,n);if(r)return r;if(s)return jy(this.dom.getBoundingClientRect(),this.length?t==0:n<=0);{let i=this.dom.getClientRects(),o=null;if(!i.length)return null;let a=this.flags&16?!0:this.flags&32?!1:t>0;for(let l=a?i.length-1:0;o=i[l],!(t>0?l==0:l==i.length-1||o.top<o.bottom);l+=a?-1:1);return jy(o,!a)}}get overrideDOMText(){if(!this.length)return Is.empty;let{root:t}=this;if(!t)return Is.empty;let n=this.posAtStart;return t.view.state.doc.slice(n,n+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(t,n,s,r,i){return i||(i=t.toDOM(n),t.editable||(i.contentEditable="false")),new Zf(i,s,t,r)}}class n2 extends Wr{constructor(t){let n=document.createElement("img");n.className="cm-widgetBuffer",n.setAttribute("aria-hidden","true"),super(n,0,t)}get isHidden(){return!0}get overrideDOMText(){return Is.empty}coordsIn(t){return this.dom.getBoundingClientRect()}}class dSe{constructor(t){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=t}advance(t,n,s){let{tile:r,index:i,beforeBreak:o,parents:a}=this;for(;t||n>0;)if(r.isComposite())if(o){if(!t)break;s&&s.break(),t--,o=!1}else if(i==r.children.length){if(!t&&!a.length)break;s&&s.leave(r),o=!!r.breakAfter,{tile:r,index:i}=a.pop(),i++}else{let l=r.children[i],c=l.breakAfter;(n>0?l.length<=t:l.length<t)&&(!s||s.skip(l,0,l.length)!==!1||!l.isComposite)?(o=!!c,i++,t-=l.length):(a.push({tile:r,index:i}),r=l,i=0,s&&l.isComposite()&&s.enter(l))}else if(i==r.length)o=!!r.breakAfter,{tile:r,index:i}=a.pop(),i++;else if(t){let l=Math.min(t,r.length-i);s&&s.skip(r,i,i+l),t-=l,i+=l}else break;return this.tile=r,this.index=i,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class hSe{constructor(t,n,s,r){this.from=t,this.to=n,this.wrapper=s,this.rank=r}}class fSe{constructor(t,n,s){this.cache=t,this.root=n,this.blockWrappers=s,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(t,n,s,r){var i;this.flushBuffer();let o=this.ensureMarks(n,s),a=o.lastChild;if(a&&a.isText()&&!(a.flags&8)&&a.length+t.length<512){this.cache.reused.set(a,2);let l=o.children[o.children.length-1]=new If(a.dom,a.text+t);l.parent=o}else o.append(r||If.of(t,(i=this.cache.find(If))===null||i===void 0?void 0:i.dom));this.pos+=t.length,this.afterWidget=null}addComposition(t,n){let s=this.curLine;s.dom!=n.line.dom&&(s.setDOM(this.cache.reused.has(n.line)?b5(n.line.dom):n.line.dom),this.cache.reused.set(n.line,2));let r=s;for(let a=n.marks.length-1;a>=0;a--){let l=n.marks[a],c=r.lastChild;if(c instanceof ea&&c.mark.eq(l.mark))c.dom!=l.dom&&c.setDOM(b5(l.dom)),r=c;else{if(this.cache.reused.get(l)){let h=Wr.get(l.dom);h&&h.setDOM(b5(l.dom))}let d=ea.of(l.mark,l.dom);r.append(d),r=d}this.cache.reused.set(l,2)}let i=Wr.get(t.text);i&&this.cache.reused.set(i,2);let o=new If(t.text,t.text.nodeValue);o.flags|=8,this.pos=t.range.toB,r.append(o)}addInlineWidget(t,n,s){let r=this.afterWidget&&t.flags&48&&(this.afterWidget.flags&48)==(t.flags&48);r||this.flushBuffer();let i=this.ensureMarks(n,s);!r&&!(t.flags&16)&&i.append(this.getBuffer(1)),i.append(t),this.pos+=t.length,this.afterWidget=t}addMark(t,n,s){this.flushBuffer(),this.ensureMarks(n,s).append(t),this.pos+=t.length,this.afterWidget=null}addBlockWidget(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}continueWidget(t){let n=this.afterWidget||this.lastBlock;n.length+=t,this.pos+=t}addLineStart(t,n){var s;t||(t=zK);let r=S0.start(t,n||((s=this.cache.find(S0))===null||s===void 0?void 0:s.dom),!!n);this.getBlockPos().append(this.lastBlock=this.curLine=r)}addLine(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(t){this.blockPosCovered()||this.addLineStart(t)}ensureLine(t){this.curLine||this.addLineStart(t)}ensureMarks(t,n){var s;let r=this.curLine;for(let i=t.length-1;i>=0;i--){let o=t[i],a;if(n>0&&(a=r.lastChild)&&a instanceof ea&&a.mark.eq(o))r=a,n--;else{let l=ea.of(o,(s=this.cache.find(ea,c=>c.mark.eq(o)))===null||s===void 0?void 0:s.dom);r.append(l),r=l,n=0}}return r}endLine(){if(this.curLine){this.flushBuffer();let t=this.curLine.lastChild;(!t||!mO(this.curLine,!1)||t.dom.nodeName!="BR"&&t.isWidget()&&!(Ht.ios&&mO(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(v5,0,32)||new Zf(v5.toDOM(),0,v5,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let t=this.wrappers.length-1;t>=0;t--)this.wrappers[t].to<this.pos&&this.wrappers.splice(t,1);for(let t=this.blockWrappers;t.value&&t.from<=this.pos;t.next())if(t.to>=this.pos){let n=t.rank*102+t.value.rank,s=new hSe(t.from,t.to,t.value,n),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-s.rank||this.wrappers[r-1].to-s.to)<0;)r--;this.wrappers.splice(r,0,s)}this.wrapperPos=this.pos}getBlockPos(){var t;this.updateBlockWrappers();let n=this.root;for(let s of this.wrappers){let r=n.lastChild;if(s.from<this.pos&&r instanceof Nu&&r.wrapper.eq(s.wrapper))n=r;else{let i=Nu.of(s.wrapper,(t=this.cache.find(Nu,o=>o.wrapper.eq(s.wrapper)))===null||t===void 0?void 0:t.dom);n.append(i),n=i}}return n}blockPosCovered(){let t=this.lastBlock;return t!=null&&!t.breakAfter&&(!t.isWidget()||(t.flags&160)>0)}getBuffer(t){let n=2|(t<0?16:32),s=this.cache.find(n2,void 0,1);return s&&(s.flags=n),s||new n2(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class mSe{constructor(t){this.skipCount=0,this.text="",this.textOff=0,this.cursor=t.iter()}skip(t){this.textOff+t<=this.text.length?this.textOff+=t:(this.skipCount+=t-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(t){if(this.textOff==this.text.length){let{value:r,lineBreak:i,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=r;let a=this.textOff=Math.min(t,r.length);return i?null:r.slice(0,a)}let n=Math.min(this.text.length,this.textOff+t),s=this.text.slice(this.textOff,n);return this.textOff=n,s}}const s2=[Zf,S0,If,ea,n2,Nu,V_];for(let e=0;e<s2.length;e++)s2[e].bucket=e;class pSe{constructor(t){this.view=t,this.buckets=s2.map(()=>[]),this.index=s2.map(()=>0),this.reused=new Map}add(t){let n=t.constructor.bucket,s=this.buckets[n];s.length<6?s.push(t):s[this.index[n]=(this.index[n]+1)%6]=t}find(t,n,s=2){let r=t.bucket,i=this.buckets[r],o=this.index[r];for(let a=i.length-1;a>=0;a--){let l=(a+o)%i.length,c=i[l];if((!n||n(c))&&!this.reused.has(c))return i.splice(l,1),l<o&&this.index[r]--,this.reused.set(c,s),c}return null}findWidget(t,n,s){let r=this.buckets[0];if(r.length)for(let i=0,o=0;;i++){if(i==r.length){if(o)return null;o=1,i=0}let a=r[i];if(!this.reused.has(a)&&(o==0?a.widget.compare(t):a.widget.constructor==t.constructor&&t.updateDOM(a.dom,this.view,a.widget)))return r.splice(i,1),i<this.index[0]&&this.index[0]--,a.widget==t&&a.length==n&&(a.flags&497)==s?(this.reused.set(a,1),a):(this.reused.set(a,2),new Zf(a.dom,n,t,a.flags&-498|s))}}reuse(t){return this.reused.set(t,1),t}maybeReuse(t,n=2){if(!this.reused.has(t))return this.reused.set(t,n),t.dom}clear(){for(let t=0;t<this.buckets.length;t++)this.buckets[t].length=this.index[t]=0}}class gSe{constructor(t,n,s,r,i){this.view=t,this.decorations=r,this.disallowBlockEffectsFor=i,this.openWidget=!1,this.openMarks=0,this.cache=new pSe(t),this.text=new mSe(t.state.doc),this.builder=new fSe(this.cache,new V_(t,t.contentDOM),ms.iter(s)),this.cache.reused.set(n,2),this.old=new dSe(n),this.reuseWalker={skip:(o,a,l)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(t,n){let s=n&&this.getCompositionContext(n.text);for(let r=0,i=0,o=0;;){let a=o<t.length?t[o++]:null,l=a?a.fromA:this.old.root.length;if(l>r){let c=l-r;this.preserve(c,!o,!a),r=l,i+=c}if(!a)break;n&&a.fromA<=n.range.fromA&&a.toA>=n.range.toA?(this.forward(a.fromA,n.range.fromA,n.range.fromA<n.range.toA?1:-1),this.emit(i,n.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(n,s),this.text.skip(n.range.toB-n.range.fromB),this.forward(n.range.fromA,a.toA),this.emit(n.range.toB,a.toB)):(this.forward(a.fromA,a.toA),this.emit(i,a.toB)),i=a.toB,r=a.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(t,n,s){let r=vSe(this.old),i=this.openMarks;this.old.advance(t,s?1:-1,{skip:(o,a,l)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(l-a);else{let c=l>0||a<o.length?Zf.of(o.widget,this.view,l-a,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);c.flags&256?(c.flags&=-2,this.builder.addBlockWidget(c)):(this.builder.ensureLine(null),this.builder.addInlineWidget(c,r,i),i=r.length)}else if(o.isText())this.builder.ensureLine(null),!a&&l==o.length&&!this.cache.reused.has(o)?this.builder.addText(o.text,r,i,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(a,l),r,i)),i=r.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof n2)this.cache.add(o);else if(o instanceof ea)this.builder.ensureLine(null),this.builder.addMark(o,r,i),this.cache.reused.set(o,1),i=r.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof ea&&r.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?r.length&&(r.length=i=0):o instanceof ea&&(r.shift(),i=Math.min(i,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(t)}emit(t,n){let s=null,r=this.builder,i=0,o=ms.spans(this.decorations,t,n,{point:(a,l,c,d,h,f)=>{if(c instanceof Qf){if(this.disallowBlockEffectsFor[f]){if(c.block)throw new RangeError("Block decorations may not be specified via plugins");if(l>this.view.state.doc.lineAt(a).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(i=d.length,h>d.length)r.continueWidget(l-a);else{let p=c.widget||(c.block?C0.block:C0.inline),g=ySe(c),y=this.cache.findWidget(p,l-a,g)||Zf.of(p,this.view,l-a,g);c.block?(c.startSide>0&&r.addLineStartIfNotCovered(s),r.addBlockWidget(y)):(r.ensureLine(s),r.addInlineWidget(y,d,h))}s=null}else s=bSe(s,c);l>a&&this.text.skip(l-a)},span:(a,l,c,d)=>{for(let h=a;h<l;){let f=this.text.next(Math.min(512,l-h));f==null?(r.addLineStartIfNotCovered(s),r.addBreak(),h++):(r.ensureLine(s),r.addText(f,c,h==a?d:c.length),h+=f.length),s=null}}});r.addLineStartIfNotCovered(s),this.openWidget=o>i,this.openMarks=o}forward(t,n,s=1){n-t<=10?this.old.advance(n-t,s,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(n-t-10,-1),this.old.advance(5,s,this.reuseWalker))}getCompositionContext(t){let n=[],s=null;for(let r=t.parentNode;;r=r.parentNode){let i=Wr.get(r);if(r==this.view.contentDOM)break;i instanceof ea?n.push(i):i!=null&&i.isLine()?s=i:i instanceof Nu||(r.nodeName=="DIV"&&!s&&r!=this.view.contentDOM?s=new S0(r,zK):s||n.push(ea.of(new Eb({tagName:r.nodeName.toLowerCase(),attributes:V4e(r)}),r)))}return{line:s,marks:n}}}function mO(e,t){let n=s=>{for(let r of s.children)if((t?r.isText():r.length)||n(r))return!0;return!1};return n(e)}function ySe(e){let t=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;return e.block&&(t|=256),t}const zK={class:"cm-line"};function bSe(e,t){let n=t.spec.attributes,s=t.spec.class;return!n&&!s||(e||(e={class:"cm-line"}),n&&UA(n,e),s&&(e.class+=" "+s)),e}function vSe(e){let t=[];for(let n=e.parents.length;n>1;n--){let s=n==e.parents.length?e.tile:e.parents[n].tile;s instanceof ea&&t.push(s.mark)}return t}function b5(e){let t=Wr.get(e);return t&&t.setDOM(e.cloneNode()),e}class C0 extends Fa{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}C0.inline=new C0("span");C0.block=new C0("div");const v5=new class extends Fa{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class pO{constructor(t){this.view=t,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=sn.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new V_(t,t.contentDOM),this.updateInner([new fl(0,0,0,t.state.doc.length)],null)}update(t){var n;let s=t.changedRanges;this.minWidth>0&&s.length&&(s.every(({fromA:d,toA:h})=>h<this.minWidthFrom||d>this.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(t);let r=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?r=this.domChanged.newSel.head:!ASe(t.changes,this.hasComposition)&&!t.selectionSet&&(r=t.state.selection.main.head));let i=r>-1?xSe(this.view,t.changes,r):null;if(this.domChanged=null,this.hasComposition){let{from:d,to:h}=this.hasComposition;s=new fl(d,h,t.changes.mapPos(d,-1),t.changes.mapPos(h,1)).addToSet(s.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(Ht.ie||Ht.chrome)&&!i&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.blockWrappers;this.updateDeco();let l=SSe(o,this.decorations,t.changes);l.length&&(s=fl.extendWithRanges(s,l));let c=TSe(a,this.blockWrappers,t.changes);return c.length&&(s=fl.extendWithRanges(s,c)),i&&!s.some(d=>d.fromA<=i.range.fromA&&d.toA>=i.range.toA)&&(s=i.range.addToSet(s.slice())),this.tile.flags&2&&s.length==0?!1:(this.updateInner(s,i),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,n){this.view.viewState.mustMeasureContent=!0;let{observer:s}=this.view;s.ignore(()=>{if(n||t.length){let o=this.tile,a=new gSe(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&Wr.get(n.text)&&a.cache.reused.set(Wr.get(n.text),2),this.tile=a.run(t,n),m8(o,a.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let i=Ht.chrome||Ht.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(i),i&&(i.written||s.selectionRange.focusNode!=i.node||!this.tile.dom.contains(i.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let i of this.tile.children)i.isWidget()&&i.widget instanceof w5&&r.push(i.dom);s.updateGaps(r)}updateEditContextFormatting(t){this.editContextFormatting=this.editContextFormatting.map(t.changes);for(let n of t.transactions)for(let s of n.effects)s.is(DK)&&(this.editContextFormatting=s.value)}updateSelection(t=!1,n=!1){(t||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:s}=this.tile,r=this.view.root.activeElement,i=r==s,o=!i&&!(this.view.state.facet(mu)||s.tabIndex>-1)&&X1(s,this.view.observer.selectionRange)&&!(r&&s.contains(r));if(!(i||n||o))return;let a=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,c,d;if(l.empty?d=c=this.inlineDOMNearPos(l.anchor,l.assoc||1):(d=this.inlineDOMNearPos(l.head,l.head==l.from?1:-1),c=this.inlineDOMNearPos(l.anchor,l.anchor==l.from?1:-1)),Ht.gecko&&l.empty&&!this.hasComposition&&wSe(c)){let f=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(f,c.node.childNodes[c.offset]||null)),c=d=new Ll(f,0),a=!0}let h=this.view.observer.selectionRange;(a||!h.focusNode||(!J1(c.node,c.offset,h.anchorNode,h.anchorOffset)||!J1(d.node,d.offset,h.focusNode,h.focusOffset))&&!this.suppressWidgetCursorChange(h,l))&&(this.view.observer.ignore(()=>{Ht.android&&Ht.chrome&&s.contains(h.focusNode)&&ESe(h.focusNode,s)&&(s.blur(),s.focus({preventScroll:!0}));let f=Ry(this.view.root);if(f)if(l.empty){if(Ht.gecko){let p=kSe(c.node,c.offset);if(p&&p!=3){let g=(p==1?vK:wK)(c.node,c.offset);g&&(c=new Ll(g.node,g.offset))}}f.collapse(c.node,c.offset),l.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=l.bidiLevel)}else if(f.extend){f.collapse(c.node,c.offset);try{f.extend(d.node,d.offset)}catch{}}else{let p=document.createRange();l.anchor>l.head&&([c,d]=[d,c]),p.setEnd(d.node,d.offset),p.setStart(c.node,c.offset),f.removeAllRanges(),f.addRange(p)}o&&this.view.root.activeElement==s&&(s.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(c,d)),this.impreciseAnchor=c.precise?null:new Ll(h.anchorNode,h.anchorOffset),this.impreciseHead=d.precise?null:new Ll(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(t,n){return this.hasComposition&&n.empty&&J1(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,n=t.state.selection.main,s=Ry(t.root),{anchorNode:r,anchorOffset:i}=t.observer.selectionRange;if(!s||!n.empty||!n.assoc||!s.modify)return;let o=this.lineAt(n.head,n.assoc);if(!o)return;let a=o.posAtStart;if(n.head==a||n.head==a+o.length)return;let l=this.coordsAt(n.head,-1),c=this.coordsAt(n.head,1);if(!l||!c||l.bottom>c.top)return;let d=this.domAtPos(n.head+n.assoc,n.assoc);s.collapse(d.node,d.offset),s.modify("move",n.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let h=t.observer.selectionRange;t.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=n.from&&s.collapse(r,i)}posFromDOM(t,n){let s=this.tile.nearest(t);if(!s)return this.tile.dom.compareDocumentPosition(t)&2?0:this.view.state.doc.length;let r=s.posAtStart;if(s.isComposite()){let i;if(t==s.dom)i=s.dom.childNodes[n];else{let o=Hu(t)==0?0:n==0?-1:1;for(;;){let a=t.parentNode;if(a==s.dom)break;o==0&&a.firstChild!=a.lastChild&&(t==a.firstChild?o=-1:o=1),t=a}o<0?i=t:i=t.nextSibling}if(i==s.dom.firstChild)return r;for(;i&&!Wr.get(i);)i=i.nextSibling;if(!i)return r+s.length;for(let o=0,a=r;;o++){let l=s.children[o];if(l.dom==i)return a;a+=l.length+l.breakAfter}}else return s.isText()?t==s.dom?r+n:r+(n?s.length:0):r}domAtPos(t,n){let{tile:s,offset:r}=this.tile.resolveBlock(t,n);return s.isWidget()?s.domPosFor(t,n):s.domIn(r,n)}inlineDOMNearPos(t,n){let s,r=-1,i=!1,o,a=-1,l=!1;return this.tile.blockTiles((c,d)=>{if(c.isWidget()){if(c.flags&32&&d>=t)return!0;c.flags&16&&(i=!0)}else{let h=d+c.length;if(d<=t&&(s=c,r=t-d,i=h<t),h>=t&&!o&&(o=c,a=t-d,l=d>t),d>t&&o)return!0}}),!s&&!o?this.domAtPos(t,n):(i&&o?s=null:l&&s&&(o=null),s&&n<0||!o?s.domIn(r,n):o.domIn(a,n))}coordsAt(t,n){let{tile:s,offset:r}=this.tile.resolveBlock(t,n);return s.isWidget()?s.widget instanceof w5?null:s.coordsInWidget(r,n,!0):s.coordsIn(r,n)}lineAt(t,n){let{tile:s}=this.tile.resolveBlock(t,n);return s.isLine()?s:null}coordsForChar(t){let{tile:n,offset:s}=this.tile.resolveBlock(t,1);if(!n.isLine())return null;function r(i,o){if(i.isComposite())for(let a of i.children){if(a.length>=o){let l=r(a,o);if(l)return l}if(o-=a.length,o<0)break}else if(i.isText()&&o<i.length){let a=Fi(i.text,o);if(a==o)return null;let l=Ly(i.dom,o,a).getClientRects();for(let c=0;c<l.length;c++){let d=l[c];if(c==l.length-1||d.top<d.bottom&&d.left<d.right)return d}}return null}return r(n,s)}measureVisibleLineHeights(t){let n=[],{from:s,to:r}=t,i=this.view.contentDOM.clientWidth,o=i>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==cr.LTR,c=0,d=(h,f,p)=>{for(let g=0;g<h.children.length&&!(f>r);g++){let y=h.children[g],w=f+y.length,v=y.dom.getBoundingClientRect(),{height:b}=v;if(p&&!g&&(c+=v.top-p.top),y instanceof Nu)w>s&&d(y,f,v);else if(f>=s&&(c>0&&n.push(-c),n.push(b+c),c=0,o)){let x=y.dom.lastChild,k=x?Q1(x):[];if(k.length){let T=k[k.length-1],C=l?T.right-v.left:v.right-T.left;C>a&&(a=C,this.minWidth=i,this.minWidthFrom=f,this.minWidthTo=w)}}p&&g==h.children.length-1&&(c+=p.bottom-v.bottom),f=w+y.breakAfter}};return d(this.tile,0,null),n}textDirectionAt(t){let{tile:n}=this.tile.resolveBlock(t,1);return getComputedStyle(n.dom).direction=="rtl"?cr.RTL:cr.LTR}measureTextSize(){let t=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let a=0,l;for(let c of o.children){if(!c.isText()||/[^ -~]/.test(c.text))return;let d=Q1(c.dom);if(d.length!=1)return;a+=d[0].width,l=d[0].height}if(a)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:a/o.length,textHeight:l}}});if(t)return t;let n=document.createElement("div"),s,r,i;return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(n);let o=Q1(n.firstChild)[0];s=n.getBoundingClientRect().height,r=o&&o.width?o.width/27:7,i=o&&o.height?o.height:s,n.remove()}),{lineHeight:s,charWidth:r,textHeight:i}}computeBlockGapDeco(){let t=[],n=this.view.viewState;for(let s=0,r=0;;r++){let i=r==n.viewports.length?null:n.viewports[r],o=i?i.from-1:this.view.state.doc.length;if(o>s){let a=(n.lineBlockAt(o).bottom-n.lineBlockAt(s).top)/this.view.scaleY;t.push(sn.replace({widget:new w5(a),block:!0,inclusive:!0,isBlockGap:!0}).range(s,o))}if(!i)break;s=i.to+1}return sn.set(t)}updateDeco(){let t=1,n=this.view.state.facet(H_).map(i=>(this.dynamicDecorationMap[t++]=typeof i=="function")?i(this.view):i),s=!1,r=this.view.state.facet(XA).map((i,o)=>{let a=typeof i=="function";return a&&(s=!0),a?i(this.view):i});for(r.length&&(this.dynamicDecorationMap[t++]=s,n.push(ms.join(r))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];t<this.decorations.length;)this.dynamicDecorationMap[t++]=!1;this.blockWrappers=this.view.state.facet(PK).map(i=>typeof i=="function"?i(this.view):i)}scrollIntoView(t){var n;if(t.isSnapshot){let d=this.view.viewState.lineBlockAt(t.range.head);this.view.scrollDOM.scrollTop=d.top-t.yMargin,this.view.scrollDOM.scrollLeft=t.xMargin;return}for(let d of this.view.state.facet(LK))try{if(d(this.view,t.range,t))return!0}catch(h){ta(this.view.state,h,"scroll handler")}let{range:s}=t,r=this.coordsAt(s.head,(n=s.assoc)!==null&&n!==void 0?n:s.empty?0:s.head>s.anchor?-1:1),i;if(!r)return;!s.empty&&(i=this.coordsAt(s.anchor,s.anchor>s.head?-1:1))&&(r={left:Math.min(r.left,i.left),top:Math.min(r.top,i.top),right:Math.max(r.right,i.right),bottom:Math.max(r.bottom,i.bottom)});let o=QA(this.view),a={left:r.left-o.left,top:r.top-o.top,right:r.right+o.right,bottom:r.bottom+o.bottom},{offsetWidth:l,offsetHeight:c}=this.view.scrollDOM;if(K4e(this.view.scrollDOM,a,s.head<s.anchor?-1:1,t.x,t.y,Math.max(Math.min(t.xMargin,l),-l),Math.max(Math.min(t.yMargin,c),-c),this.view.textDirection==cr.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(r.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||r.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let d=this.view.docView.lineAt(s.head,1);d&&d.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(t){let n=s=>s.isWidget()||s.children.some(n);return n(this.tile.resolveBlock(t,1).tile)}destroy(){m8(this.tile)}}function m8(e,t){let n=t==null?void 0:t.get(e);if(n!=1){n==null&&e.destroy();for(let s of e.children)m8(s,t)}}function wSe(e){return e.node.nodeType==1&&e.node.firstChild&&(e.offset==0||e.node.childNodes[e.offset-1].contentEditable=="false")&&(e.offset==e.node.childNodes.length||e.node.childNodes[e.offset].contentEditable=="false")}function FK(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let s=vK(n.focusNode,n.focusOffset),r=wK(n.focusNode,n.focusOffset),i=s||r;if(r&&s&&r.node!=s.node){let a=Wr.get(r.node);if(!a||a.isText()&&a.text!=r.node.nodeValue)i=r;else if(e.docView.lastCompositionAfterCursor){let l=Wr.get(s.node);!l||l.isText()&&l.text!=s.node.nodeValue||(i=r)}}if(e.docView.lastCompositionAfterCursor=i!=s,!i)return null;let o=t-i.offset;return{from:o,to:o+i.node.nodeValue.length,node:i.node}}function xSe(e,t,n){let s=FK(e,n);if(!s)return null;let{node:r,from:i,to:o}=s,a=r.nodeValue;if(/[\n\r]/.test(a)||e.state.doc.sliceString(s.from,s.to)!=a)return null;let l=t.invertedDesc;return{range:new fl(l.mapPos(i),l.mapPos(o),i,o),text:r}}function kSe(e,t){return e.nodeType!=1?0:(t&&e.childNodes[t-1].contentEditable=="false"?1:0)|(t<e.childNodes.length&&e.childNodes[t].contentEditable=="false"?2:0)}let _Se=class{constructor(){this.changes=[]}compareRange(t,n){Xp(t,n,this.changes)}comparePoint(t,n){Xp(t,n,this.changes)}boundChange(t){Xp(t,t,this.changes)}};function SSe(e,t,n){let s=new _Se;return ms.compare(e,t,n,s),s.changes}class CSe{constructor(){this.changes=[]}compareRange(t,n){Xp(t,n,this.changes)}comparePoint(){}boundChange(t){Xp(t,t,this.changes)}}function TSe(e,t,n){let s=new CSe;return ms.compare(e,t,n,s),s.changes}function ESe(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(n.nodeType==1&&n.contentEditable=="false")return!0;return!1}function ASe(e,t){let n=!1;return t&&e.iterChangedRanges((s,r)=>{s<t.to&&r>t.from&&(n=!0)}),n}class w5 extends Fa{constructor(t){super(),this.height=t}toDOM(){let t=document.createElement("div");return t.className="cm-gap",this.updateDOM(t),t}eq(t){return t.height==this.height}updateDOM(t){return t.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function MSe(e,t,n=1){let s=e.charCategorizer(t),r=e.doc.lineAt(t),i=t-r.from;if(r.length==0)return Be.cursor(t);i==0?n=1:i==r.length&&(n=-1);let o=i,a=i;n<0?o=Fi(r.text,i,!1):a=Fi(r.text,i);let l=s(r.text.slice(o,a));for(;o>0;){let c=Fi(r.text,o,!1);if(s(r.text.slice(c,o))!=l)break;o=c}for(;a<r.length;){let c=Fi(r.text,a);if(s(r.text.slice(a,c))!=l)break;a=c}return Be.range(o+r.from,a+r.from)}function NSe(e,t,n,s,r){let i=Math.round((s-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>e.defaultLineHeight*1.5){let a=e.viewState.heightOracle.textHeight,l=Math.floor((r-n.top-(e.defaultLineHeight-a)*.5)/a);i+=l*e.viewState.heightOracle.lineLength}let o=e.state.sliceDoc(n.from,n.to);return n.from+n8(o,i,e.state.tabSize)}function p8(e,t,n){let s=e.lineBlockAt(t);if(Array.isArray(s.type)){let r;for(let i of s.type){if(i.from>t)break;if(!(i.to<t)){if(i.from<t&&i.to>t)return i;(!r||i.type==oo.Text&&(r.type!=i.type||(n<0?i.from<t:i.to>t)))&&(r=i)}}return r||s}return s}function ISe(e,t,n,s){let r=p8(e,t.head,t.assoc||-1),i=!s||r.type!=oo.Text||!(e.lineWrapping||r.widgetLineBreaks)?null:e.coordsAtPos(t.assoc<0&&t.head>r.from?t.head-1:t.head);if(i){let o=e.dom.getBoundingClientRect(),a=e.textDirectionAt(r.from),l=e.posAtCoords({x:n==(a==cr.LTR)?o.right-1:o.left+1,y:(i.top+i.bottom)/2});if(l!=null)return Be.cursor(l,n?-1:1)}return Be.cursor(n?r.to:r.from,n?-1:1)}function gO(e,t,n,s){let r=e.state.doc.lineAt(t.head),i=e.bidiSpans(r),o=e.textDirectionAt(r.from);for(let a=t,l=null;;){let c=iSe(r,i,o,a,n),d=CK;if(!c){if(r.number==(n?e.state.doc.lines:1))return a;d=`
`,r=e.state.doc.line(r.number+(n?1:-1)),i=e.bidiSpans(r),c=e.visualLineSide(r,!n)}if(l){if(!l(d))return a}else{if(!s)return c;l=s(d)}a=c}}function RSe(e,t,n){let s=e.state.charCategorizer(t),r=s(n);return i=>{let o=s(i);return r==Mr.Space&&(r=o),r==o}}function jSe(e,t,n,s){let r=t.head,i=n?1:-1;if(r==(n?e.state.doc.length:0))return Be.cursor(r,t.assoc);let o=t.goalColumn,a,l=e.contentDOM.getBoundingClientRect(),c=e.coordsAtPos(r,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),d=e.documentTop;if(c)o==null&&(o=c.left-l.left),a=i<0?c.top:c.bottom;else{let g=e.viewState.lineBlockAt(r);o==null&&(o=Math.min(l.right-l.left,e.defaultCharacterWidth*(r-g.from))),a=(i<0?g.top:g.bottom)+d}let h=l.left+o,f=e.viewState.heightOracle.textHeight>>1,p=s??f;for(let g=0;;g+=f){let y=a+(p+g)*i,w=g8(e,{x:h,y},!1,i);if(n?y>l.bottom:y<l.top)return Be.cursor(w.pos,w.assoc);let v=e.coordsAtPos(w.pos,w.assoc),b=v?(v.top+v.bottom)/2:0;if(!v||(n?b>a:b<a))return Be.cursor(w.pos,w.assoc,void 0,o)}}function Z1(e,t,n){for(;;){let s=0;for(let r of e)r.between(t-1,t+1,(i,o,a)=>{if(t>i&&t<o){let l=s||n||(t-i<o-t?-1:1);t=l<0?i:o,s=l}});if(!s)return t}}function qK(e,t){let n=null;for(let s=0;s<t.ranges.length;s++){let r=t.ranges[s],i=null;if(r.empty){let o=Z1(e,r.from,0);o!=r.from&&(i=Be.cursor(o,-1))}else{let o=Z1(e,r.from,-1),a=Z1(e,r.to,1);(o!=r.from||a!=r.to)&&(i=Be.range(r.from==r.anchor?o:a,r.from==r.head?o:a))}i&&(n||(n=t.ranges.slice()),n[s]=i)}return n?Be.create(n,t.mainIndex):t}function x5(e,t,n){let s=Z1(e.state.facet(Mb).map(r=>r(e)),n.from,t.head>n.from?-1:1);return s==n.from?n:Be.cursor(s,s<n.from?1:-1)}class gc{constructor(t,n){this.pos=t,this.assoc=n}}function g8(e,t,n,s){let r=e.contentDOM.getBoundingClientRect(),i=r.top+e.viewState.paddingTop,{x:o,y:a}=t,l=a-i,c;for(;;){if(l<0)return new gc(0,1);if(l>e.viewState.docHeight)return new gc(e.state.doc.length,-1);if(c=e.elementAtHeight(l),s==null)break;if(c.type==oo.Text){if(s<0?c.to<e.viewport.from:c.from>e.viewport.to)break;let f=e.docView.coordsAt(s<0?c.from:c.to,s>0?-1:1);if(f&&(s<0?f.top<=l+i:f.bottom>=l+i))break}let h=e.viewState.heightOracle.textHeight/2;l=s>0?c.bottom+h:c.top-h}if(e.viewport.from>=c.to||e.viewport.to<=c.from){if(n)return null;if(c.type==oo.Text){let h=NSe(e,r,c,o,a);return new gc(h,h==c.from?1:-1)}}if(c.type!=oo.Text)return l<(c.top+c.bottom)/2?new gc(c.from,1):new gc(c.to,-1);let d=e.docView.lineAt(c.from,2);return(!d||d.length!=c.length)&&(d=e.docView.lineAt(c.from,-2)),new LSe(e,o,a,e.textDirectionAt(c.from)).scanTile(d,c.from)}class LSe{constructor(t,n,s,r){this.view=t,this.x=n,this.y=s,this.baseDir=r,this.line=null,this.spans=null}bidiSpansAt(t){return(!this.line||this.line.from>t||this.line.to<t)&&(this.line=this.view.state.doc.lineAt(t),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(t,n){let{line:s,spans:r}=this.bidiSpansAt(t);return r[_c.find(r,t-s.from,-1,n)].level==this.baseDir}dirAt(t,n){let{line:s,spans:r}=this.bidiSpansAt(t);return r[_c.find(r,t-s.from,-1,n)].dir}bidiIn(t,n){let{spans:s,line:r}=this.bidiSpansAt(t);return s.length>1||s.length&&(s[0].level!=this.baseDir||s[0].to+r.from<n)}scan(t,n,s=!1){let r=0,i=t.length-1,o=new Set,a=this.bidiIn(t[0],t[i]),l,c,d=-1,h=1e9,f;e:for(;r<i;){let g=i-r,y=r+i>>1;t:if(o.has(y)){let v=r+Math.floor(Math.random()*g);for(let b=0;b<g;b++){if(!o.has(v)){y=v;break t}v++,v==i&&(v=r)}break e}o.add(y);let w=n(y);if(w)for(let v=0;v<w.length;v++){let b=w[v],x=0;if(!(b.width==0&&w.length>1)){if(b.bottom<this.y)(!l||l.bottom<b.bottom)&&(l=b),x=1;else if(b.top>this.y)(!c||c.top>b.top)&&(c=b),x=-1;else{let k=b.left>this.x?this.x-b.left:b.right<this.x?this.x-b.right:0,T=Math.abs(k);T<h&&(d=y,h=T,f=b),k&&(x=k<0==(this.baseDir==cr.LTR)?-1:1)}x==-1&&(!a||this.baseDirAt(t[y],1))?i=y:x==1&&(!a||this.baseDirAt(t[y+1],-1))&&(r=y+1)}}}if(!f){if(!c&&!l)return{i:t[0],after:!1};let g=l&&(!c||this.y-l.bottom<c.top-this.y)?l:c;return this.y=(g.top+g.bottom)/2,this.scan(t,n,!0)}if(h&&!s){let{top:g,bottom:y}=f;if(l&&l.bottom>(g+g+y)/3)return this.y=l.bottom-1,this.scan(t,n,!0);if(c&&c.top<(g+y+y)/3)return this.y=c.top+1,this.scan(t,n,!0)}let p=(a?this.dirAt(t[d],1):this.baseDir)==cr.LTR;return{i:d,after:this.x>(f.left+f.right)/2==p}}scanText(t,n){let s=[];for(let i=0;i<t.length;i=Fi(t.text,i))s.push(n+i);s.push(n+t.length);let r=this.scan(s,i=>{let o=s[i]-n,a=s[i+1]-n;return Ly(t.dom,o,a).getClientRects()});return r.after?new gc(s[r.i+1],-1):new gc(s[r.i],1)}scanTile(t,n){if(!t.length)return new gc(n,1);if(t.children.length==1){let a=t.children[0];if(a.isText())return this.scanText(a,n);if(a.isComposite())return this.scanTile(a,n)}let s=[n];for(let a=0,l=n;a<t.children.length;a++)s.push(l+=t.children[a].length);let r=this.scan(s,a=>{let l=t.children[a];return l.flags&48?null:(l.dom.nodeType==1?l.dom:Ly(l.dom,0,l.length)).getClientRects()}),i=t.children[r.i],o=s[r.i];return i.isText()?this.scanText(i,o):i.isComposite()?this.scanTile(i,o):r.after?new gc(s[r.i+1],-1):new gc(o,1)}}const pp="";class DSe{constructor(t,n){this.points=t,this.view=n,this.text="",this.lineSeparator=n.state.facet(ws.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=pp}readRange(t,n){if(!t)return this;let s=t.parentNode;for(let r=t;;){this.findPointBefore(s,r);let i=this.text.length;this.readNode(r);let o=Wr.get(r),a=r.nextSibling;if(a==n){o!=null&&o.breakAfter&&!a&&s!=this.view.contentDOM&&this.lineBreak();break}let l=Wr.get(a);(o&&l?o.breakAfter:(o?o.breakAfter:e2(r))||e2(a)&&(r.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>i)&&!PSe(a,n)&&this.lineBreak(),r=a}return this.findPointBefore(s,n),this}readTextNode(t){let n=t.nodeValue;for(let s of this.points)s.node==t&&(s.pos=this.text.length+Math.min(s.offset,n.length));for(let s=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,o=1,a;if(this.lineSeparator?(i=n.indexOf(this.lineSeparator,s),o=this.lineSeparator.length):(a=r.exec(n))&&(i=a.index,o=a[0].length),this.append(n.slice(s,i<0?n.length:i)),i<0)break;if(this.lineBreak(),o>1)for(let l of this.points)l.node==t&&l.pos>this.text.length&&(l.pos-=o-1);s=i+o}}readNode(t){let n=Wr.get(t),s=n&&n.overrideDOMText;if(s!=null){this.findPointInside(t,s.length);for(let r=s.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.value)}else t.nodeType==3?this.readTextNode(t):t.nodeName=="BR"?t.nextSibling&&this.lineBreak():t.nodeType==1&&this.readRange(t.firstChild,null)}findPointBefore(t,n){for(let s of this.points)s.node==t&&t.childNodes[s.offset]==n&&(s.pos=this.text.length)}findPointInside(t,n){for(let s of this.points)(t.nodeType==3?s.node==t:t.contains(s.node))&&(s.pos=this.text.length+(OSe(t,s.node,s.offset)?n:0))}}function OSe(e,t,n){for(;;){if(!t||n<Hu(t))return!1;if(t==e)return!0;n=_h(t)+1,t=t.parentNode}}function PSe(e,t){let n;for(;!(e==t||!e);e=e.nextSibling){let s=Wr.get(e);if(!(s!=null&&s.isWidget()))return!1;s&&(n||(n=[])).push(s)}if(n)for(let s of n){let r=s.overrideDOMText;if(r!=null&&r.length)return!1}return!0}class yO{constructor(t,n){this.node=t,this.offset=n,this.pos=-1}}class BSe{constructor(t,n,s,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=n>-1;let{impreciseHead:i,impreciseAnchor:o}=t.docView,a=t.state.selection;if(t.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=HK(t.docView.tile,n,s,0))){let l=i||o?[]:zSe(t),c=new DSe(l,t);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=FSe(l,this.bounds.from)}else{let l=t.observer.selectionRange,c=i&&i.node==l.focusNode&&i.offset==l.focusOffset||!c8(t.contentDOM,l.focusNode)?a.main.head:t.docView.posFromDOM(l.focusNode,l.focusOffset),d=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!c8(t.contentDOM,l.anchorNode)?a.main.anchor:t.docView.posFromDOM(l.anchorNode,l.anchorOffset),h=t.viewport;if((Ht.ios||Ht.chrome)&&a.main.empty&&c!=d&&(h.from>0||h.to<t.state.doc.length)){let f=Math.min(c,d),p=Math.max(c,d),g=h.from-f,y=h.to-p;(g==0||g==1||f==0)&&(y==0||y==-1||p==t.state.doc.length)&&(c=0,d=t.state.doc.length)}if(t.inputState.composing>-1&&a.ranges.length>1)this.newSel=a.replaceRange(Be.range(d,c));else if(t.lineWrapping&&d==c&&!(a.main.empty&&a.main.head==c)&&t.inputState.lastTouchTime>Date.now()-100){let f=t.coordsAtPos(c,-1),p=0;f&&(p=t.inputState.lastTouchY<=f.bottom?-1:1),this.newSel=Be.create([Be.cursor(c,p)])}else this.newSel=Be.single(d,c)}}}function HK(e,t,n,s){if(e.isComposite()){let r=-1,i=-1,o=-1,a=-1;for(let l=0,c=s,d=s;l<e.children.length;l++){let h=e.children[l],f=c+h.length;if(c<t&&f>n)return HK(h,t,n,c);if(f>=t&&r==-1&&(r=l,i=c),c>n&&h.dom.parentNode==e.dom){o=l,a=d;break}d=f,c=f+h.breakAfter}return{from:i,to:a<0?s+e.length:a,startDOM:(r?e.children[r-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:o<e.children.length&&o>=0?e.children[o].dom:null}}else return e.isText()?{from:s,to:s+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function UK(e,t){let n,{newSel:s}=t,{state:r}=e,i=r.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:a,to:l}=t.bounds,c=i.from,d=null;(o===8||Ht.android&&t.text.length<l-a)&&(c=i.to,d="end");let h=r.doc.sliceString(a,l,pp),f,p;!i.empty&&i.from>=a&&i.to<=l&&(t.typeOver||h!=t.text)&&h.slice(0,i.from-a)==t.text.slice(0,i.from-a)&&h.slice(i.to-a)==t.text.slice(f=t.text.length-(h.length-(i.to-a)))?n={from:i.from,to:i.to,insert:Is.of(t.text.slice(i.from-a,f).split(pp))}:(p=VK(h,t.text,c-a,d))&&(Ht.chrome&&o==13&&p.toB==p.from+2&&t.text.slice(p.from,p.toB)==pp+pp&&p.toB--,n={from:a+p.from,to:a+p.toA,insert:Is.of(t.text.slice(p.from,p.toB).split(pp))})}else s&&(!e.hasFocus&&r.facet(mu)||r2(s,i))&&(s=null);if(!n&&!s)return!1;if((Ht.mac||Ht.android)&&n&&n.from==n.to&&n.from==i.head-1&&/^\. ?$/.test(n.insert.toString())&&e.contentDOM.getAttribute("autocorrect")=="off"?(s&&n.insert.length==2&&(s=Be.single(s.main.anchor-1,s.main.head-1)),n={from:n.from,to:n.to,insert:Is.of([n.insert.toString().replace("."," ")])}):r.doc.lineAt(i.from).to<i.to&&e.docView.lineHasWidget(i.to)&&e.inputState.insertingTextAt>Date.now()-50?n={from:i.from,to:i.to,insert:r.toText(e.inputState.insertingText)}:Ht.chrome&&n&&n.from==n.to&&n.from==i.head&&n.insert.toString()==`
 `&&e.lineWrapping&&(s&&(s=Be.single(s.main.anchor-1,s.main.head-1)),n={from:i.from,to:i.to,insert:Is.of([" "])}),n)return JA(e,n,s,o);if(s&&!r2(s,i)){let a=!1,l="select";return e.inputState.lastSelectionTime>Date.now()-50&&(e.inputState.lastSelectionOrigin=="select"&&(a=!0),l=e.inputState.lastSelectionOrigin,l=="select.pointer"&&(s=qK(r.facet(Mb).map(c=>c(e)),s))),e.dispatch({selection:s,scrollIntoView:a,userEvent:l}),!0}else return!1}function JA(e,t,n,s=-1){if(Ht.ios&&e.inputState.flushIOSKey(t))return!0;let r=e.state.selection.main;if(Ht.android&&(t.to==r.to&&(t.from==r.from||t.from==r.from-1&&e.state.sliceDoc(t.from,r.from)==" ")&&t.insert.length==1&&t.insert.lines==2&&Qp(e.contentDOM,"Enter",13)||(t.from==r.from-1&&t.to==r.to&&t.insert.length==0||s==8&&t.insert.length<t.to-t.from&&t.to>r.head)&&Qp(e.contentDOM,"Backspace",8)||t.from==r.from&&t.to==r.to+1&&t.insert.length==0&&Qp(e.contentDOM,"Delete",46)))return!0;let i=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,a=()=>o||(o=$Se(e,t,n));return e.state.facet(NK).some(l=>l(e,t.from,t.to,i,a))||e.dispatch(a()),!0}function $Se(e,t,n){let s,r=e.state,i=r.selection.main,o=-1;if(t.from==t.to&&t.from<i.from||t.from>i.to){let l=t.from<i.from?-1:1,c=l<0?i.from:i.to,d=Z1(r.facet(Mb).map(h=>h(e)),c,l);t.from==d&&(o=d)}if(o>-1)s={changes:t,selection:Be.cursor(t.from+t.insert.length,-1)};else if(t.from>=i.from&&t.to<=i.to&&t.to-t.from>=(i.to-i.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let l=i.from<t.from?r.sliceDoc(i.from,t.from):"",c=i.to>t.to?r.sliceDoc(t.to,i.to):"";s=r.replaceSelection(e.state.toText(l+t.insert.sliceString(0,void 0,e.state.lineBreak)+c))}else{let l=r.changes(t),c=n&&n.main.to<=l.newLength?n.main:void 0;if(r.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=i.to+10&&t.to>=i.to-10){let d=e.state.sliceDoc(t.from,t.to),h,f=n&&FK(e,n.main.head);if(f){let g=t.insert.length-(t.to-t.from);h={from:f.from,to:f.to-g}}else h=e.state.doc.lineAt(i.head);let p=i.to-t.to;s=r.changeByRange(g=>{if(g.from==i.from&&g.to==i.to)return{changes:l,range:c||g.map(l)};let y=g.to-p,w=y-d.length;if(e.state.sliceDoc(w,y)!=d||y>=h.from&&w<=h.to)return{range:g};let v=r.changes({from:w,to:y,insert:t.insert}),b=g.to-i.to;return{changes:v,range:c?Be.range(Math.max(0,c.anchor+b),Math.max(0,c.head+b)):g.map(v)}})}else s={changes:l,selection:c&&r.selection.replaceRange(c)}}let a="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1)),r.update(s,{userEvent:a,scrollIntoView:!0})}function VK(e,t,n,s){let r=Math.min(e.length,t.length),i=0;for(;i<r&&e.charCodeAt(i)==t.charCodeAt(i);)i++;if(i==r&&e.length==t.length)return null;let o=e.length,a=t.length;for(;o>0&&a>0&&e.charCodeAt(o-1)==t.charCodeAt(a-1);)o--,a--;if(s=="end"){let l=Math.max(0,i-Math.min(o,a));n-=o+l-i}if(o<i&&e.length<t.length){let l=n<=i&&n>=o?i-n:0;i-=l,a=i+(a-o),o=i}else if(a<i){let l=n<=i&&n>=a?i-n:0;i-=l,o=i+(o-a),a=i}return{from:i,toA:o,toB:a}}function zSe(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:i}=e.observer.selectionRange;return n&&(t.push(new yO(n,s)),(r!=n||i!=s)&&t.push(new yO(r,i))),t}function FSe(e,t){if(e.length==0)return null;let n=e[0].pos,s=e.length==2?e[1].pos:n;return n>-1&&s>-1?Be.single(n+t,s+t):null}function r2(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class qSe{setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}constructor(t){this.view=t,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=t.hasFocus,Ht.safari&&t.contentDOM.addEventListener("input",()=>null),Ht.gecko&&s3e(t.contentDOM.ownerDocument)}handleEvent(t){!XSe(this.view,t)||this.ignoreDuringComposition(t)||t.type=="keydown"&&this.keydown(t)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(t.type,t)):this.runHandlers(t.type,t))}runHandlers(t,n){let s=this.handlers[t];if(s){for(let r of s.observers)r(this.view,n);for(let r of s.handlers){if(n.defaultPrevented)break;if(r(this.view,n)){n.preventDefault();break}}}}ensureHandlers(t){let n=HSe(t),s=this.handlers,r=this.view.contentDOM;for(let i in n)if(i!="scroll"){let o=!n[i].handlers.length,a=s[i];a&&o!=!a.handlers.length&&(r.removeEventListener(i,this.handleEvent),a=null),a||r.addEventListener(i,this.handleEvent,{passive:o})}for(let i in s)i!="scroll"&&!n[i]&&r.removeEventListener(i,this.handleEvent);this.handlers=n}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&t.keyCode!=27&&GK.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),Ht.android&&Ht.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let n;return Ht.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&!t.shiftKey&&((n=WK.find(s=>s.keyCode==t.keyCode))&&!t.ctrlKey||USe.indexOf(t.key)>-1&&t.ctrlKey)?(this.pendingIOSKey=n||t,setTimeout(()=>this.flushIOSKey(),250),!0):(t.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(t){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&t&&t.from<t.to&&/^\S+$/.test(t.insert.toString())?!1:(this.pendingIOSKey=void 0,Qp(this.view.contentDOM,n.key,n.keyCode,n instanceof KeyboardEvent?n:void 0))}ignoreDuringComposition(t){return!/^key/.test(t.type)||t.synthetic?!1:this.composing>0?!0:Ht.safari&&!Ht.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.view.observer.update(t),this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function bO(e,t){return(n,s)=>{try{return t.call(e,s,n)}catch(r){ta(n.state,r)}}}function HSe(e){let t=Object.create(null);function n(s){return t[s]||(t[s]={observers:[],handlers:[]})}for(let s of e){let r=s.spec,i=r&&r.plugin.domEventHandlers,o=r&&r.plugin.domEventObservers;if(i)for(let a in i){let l=i[a];l&&n(a).handlers.push(bO(s.value,l))}if(o)for(let a in o){let l=o[a];l&&n(a).observers.push(bO(s.value,l))}}for(let s in Ol)n(s).handlers.push(Ol[s]);for(let s in oa)n(s).observers.push(oa[s]);return t}const WK=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],USe="dthko",GK=[16,17,18,20,91,92,224,225],ow=6;function aw(e){return Math.max(0,e)*.7+8}function VSe(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}class WSe{constructor(t,n,s,r){this.view=t,this.startEvent=n,this.style=s,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=gK(t.contentDOM),this.atoms=t.state.facet(Mb).map(o=>o(t));let i=t.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=t.state.facet(ws.allowMultipleSelections)&&GSe(t,n),this.dragging=YSe(t,n)&&XK(n)==1?null:!1}start(t){this.dragging===!1&&this.select(t)}move(t){if(t.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&VSe(this.startEvent,t)<10)return;this.select(this.lastEvent=t);let n=0,s=0,r=0,i=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:a}=this.scrollParents.y.getBoundingClientRect());let l=QA(this.view);t.clientX-l.left<=r+ow?n=-aw(r-t.clientX):t.clientX+l.right>=o-ow&&(n=aw(t.clientX-o)),t.clientY-l.top<=i+ow?s=-aw(i-t.clientY):t.clientY+l.bottom>=a-ow&&(s=aw(t.clientY-a)),this.setScrollSpeed(n,s)}up(t){this.dragging==null&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,n){this.scrollSpeed={x:t,y:n},t||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:t,y:n}=this.scrollSpeed;t&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=t,t=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(t||n)&&this.view.win.scrollBy(t,n),this.dragging===!1&&this.select(this.lastEvent)}select(t){let{view:n}=this,s=qK(this.atoms,this.style.get(t,this.extend,this.multiple));(this.mustSelect||!s.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:s,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(t)&&setTimeout(()=>this.select(this.lastEvent),20)}}function GSe(e,t){let n=e.state.facet(TK);return n.length?n[0](t):Ht.mac?t.metaKey:t.ctrlKey}function KSe(e,t){let n=e.state.facet(EK);return n.length?n[0](t):Ht.mac?!t.altKey:!t.ctrlKey}function YSe(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let s=Ry(e.root);if(!s||s.rangeCount==0)return!0;let r=s.getRangeAt(0).getClientRects();for(let i=0;i<r.length;i++){let o=r[i];if(o.left<=t.clientX&&o.right>=t.clientX&&o.top<=t.clientY&&o.bottom>=t.clientY)return!0}return!1}function XSe(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target,s;n!=e.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(s=Wr.get(n))&&s.isWidget()&&!s.isHidden&&s.widget.ignoreEvent(t))return!1;return!0}const Ol=Object.create(null),oa=Object.create(null),KK=Ht.ie&&Ht.ie_version<15||Ht.ios&&Ht.webkit_version<604;function QSe(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{e.focus(),n.remove(),YK(e,n.value)},50)}function W_(e,t,n){for(let s of e.facet(t))n=s(n,e);return n}function YK(e,t){t=W_(e.state,GA,t);let{state:n}=e,s,r=1,i=n.toText(t),o=i.lines==n.selection.ranges.length;if(y8!=null&&n.selection.ranges.every(l=>l.empty)&&y8==i.toString()){let l=-1;s=n.changeByRange(c=>{let d=n.doc.lineAt(c.from);if(d.from==l)return{range:c};l=d.from;let h=n.toText((o?i.line(r++).text:t)+n.lineBreak);return{changes:{from:d.from,insert:h},range:Be.cursor(c.from+h.length)}})}else o?s=n.changeByRange(l=>{let c=i.line(r++);return{changes:{from:l.from,to:l.to,insert:c.text},range:Be.cursor(l.from+c.length)}}):s=n.replaceSelection(i);e.dispatch(s,{userEvent:"input.paste",scrollIntoView:!0})}oa.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft};oa.wheel=oa.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()};Ol.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1);oa.touchstart=(e,t)=>{let n=e.inputState,s=t.targetTouches[0];n.lastTouchTime=Date.now(),s&&(n.lastTouchX=s.clientX,n.lastTouchY=s.clientY),n.setSelectionOrigin("select.pointer")};oa.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")};Ol.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let s of e.state.facet(AK))if(n=s(e,t),n)break;if(!n&&t.button==0&&(n=ZSe(e,t)),n){let s=!e.hasFocus;e.inputState.startMouseSelection(new WSe(e,t,n,s)),s&&e.observer.ignore(()=>{yK(e.contentDOM);let i=e.root.activeElement;i&&!i.contains(e.contentDOM)&&i.blur()});let r=e.inputState.mouseSelection;if(r)return r.start(t),r.dragging===!1}else e.inputState.setSelectionOrigin("select.pointer");return!1};function vO(e,t,n,s){if(s==1)return Be.cursor(t,n);if(s==2)return MSe(e.state,t,n);{let r=e.docView.lineAt(t,n),i=e.state.doc.lineAt(r?r.posAtEnd:t),o=r?r.posAtStart:i.from,a=r?r.posAtEnd:i.to;return a<e.state.doc.length&&a==i.to&&a++,Be.range(o,a)}}const JSe=Ht.ie&&Ht.ie_version<=11;let wO=null,xO=0,kO=0;function XK(e){if(!JSe)return e.detail;let t=wO,n=kO;return wO=e,kO=Date.now(),xO=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(xO+1)%3:1}function ZSe(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),s=XK(t),r=e.state.selection;return{update(i){i.docChanged&&(n.pos=i.changes.mapPos(n.pos),r=r.map(i.changes))},get(i,o,a){let l=e.posAndSideAtCoords({x:i.clientX,y:i.clientY},!1),c,d=vO(e,l.pos,l.assoc,s);if(n.pos!=l.pos&&!o){let h=vO(e,n.pos,n.assoc,s),f=Math.min(h.from,d.from),p=Math.max(h.to,d.to);d=f<d.from?Be.range(f,p,d.assoc):Be.range(p,f,d.assoc)}return o?r.replaceRange(r.main.extend(d.from,d.to,d.assoc)):a&&s==1&&r.ranges.length>1&&(c=e3e(r,l.pos))?c:a?r.addRange(d):Be.create([d])}}}function e3e(e,t){for(let n=0;n<e.ranges.length;n++){let{from:s,to:r}=e.ranges[n];if(s<=t&&r>=t)return Be.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}Ol.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let r=e.docView.tile.nearest(t.target);if(r&&r.isWidget()){let i=r.posAtStart,o=i+r.length;(i>=n.to||o<=n.from)&&(n=Be.range(i,o))}}let{inputState:s}=e;return s.mouseSelection&&(s.mouseSelection.dragging=!0),s.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",W_(e.state,KA,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1};Ol.dragend=e=>(e.inputState.draggedContent=null,!1);function _O(e,t,n,s){if(n=W_(e.state,GA,n),!n)return;let r=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:i}=e.inputState,o=s&&i&&KSe(e,t)?{from:i.from,to:i.to}:null,a={from:r,insert:n},l=e.state.changes(o?[o,a]:a);e.focus(),e.dispatch({changes:l,selection:{anchor:l.mapPos(r,-1),head:l.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"}),e.inputState.draggedContent=null}Ol.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let s=Array(n.length),r=0,i=()=>{++r==n.length&&_O(e,t,s.filter(o=>o!=null).join(e.state.lineBreak),!1)};for(let o=0;o<n.length;o++){let a=new FileReader;a.onerror=i,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(s[o]=a.result),i()},a.readAsText(n[o])}return!0}else{let s=t.dataTransfer.getData("Text");if(s)return _O(e,t,s,!0),!0}return!1};Ol.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=KK?null:t.clipboardData;return n?(YK(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(QSe(e),!1)};function t3e(e,t){let n=e.dom.parentNode;if(!n)return;let s=n.appendChild(document.createElement("textarea"));s.style.cssText="position: fixed; left: -10000px; top: 10px",s.value=t,s.focus(),s.selectionEnd=t.length,s.selectionStart=0,setTimeout(()=>{s.remove(),e.focus()},50)}function n3e(e){let t=[],n=[],s=!1;for(let r of e.selection.ranges)r.empty||(t.push(e.sliceDoc(r.from,r.to)),n.push(r));if(!t.length){let r=-1;for(let{from:i}of e.selection.ranges){let o=e.doc.lineAt(i);o.number>r&&(t.push(o.text),n.push({from:o.from,to:Math.min(e.doc.length,o.to+1)})),r=o.number}s=!0}return{text:W_(e,KA,t.join(e.lineBreak)),ranges:n,linewise:s}}let y8=null;Ol.copy=Ol.cut=(e,t)=>{if(!X1(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:s,linewise:r}=n3e(e.state);if(!n&&!r)return!1;y8=r?n:null,t.type=="cut"&&!e.state.readOnly&&e.dispatch({changes:s,scrollIntoView:!0,userEvent:"delete.cut"});let i=KK?null:t.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(t3e(e,n),!1)};const QK=td.define();function JK(e,t){let n=[];for(let s of e.facet(IK)){let r=s(e,t);r&&n.push(r)}return n.length?e.update({effects:n,annotations:QK.of(!0)}):null}function ZK(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=JK(e.state,t);n?e.dispatch(n):e.update([])}},10)}oa.focus=e=>{e.inputState.lastFocusTime=Date.now(),!e.scrollDOM.scrollTop&&(e.inputState.lastScrollTop||e.inputState.lastScrollLeft)&&(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),ZK(e)};oa.blur=e=>{e.observer.clearSelectionRange(),ZK(e)};oa.compositionstart=oa.compositionupdate=e=>{e.observer.editContext||(e.inputState.compositionFirstChange==null&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))};oa.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,Ht.chrome&&Ht.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))};oa.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()};Ol.beforeinput=(e,t)=>{var n,s;if((t.inputType=="insertText"||t.inputType=="insertCompositionText")&&(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),t.inputType=="insertReplacementText"&&e.observer.editContext){let i=(n=t.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),o=t.getTargetRanges();if(i&&o.length){let a=o[0],l=e.posAtDOM(a.startContainer,a.startOffset),c=e.posAtDOM(a.endContainer,a.endOffset);return JA(e,{from:l,to:c,insert:e.state.toText(i)},null),!0}}let r;if(Ht.chrome&&Ht.android&&(r=WK.find(i=>i.inputType==t.inputType))&&(e.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete")){let i=((s=window.visualViewport)===null||s===void 0?void 0:s.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>i+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return Ht.ios&&t.inputType=="deleteContentForward"&&e.observer.flushSoon(),Ht.safari&&t.inputType=="insertText"&&e.inputState.composing>=0&&setTimeout(()=>oa.compositionend(e,t),20),!1};const SO=new Set;function s3e(e){SO.has(e)||(SO.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}const CO=["pre-wrap","normal","pre-line","break-spaces"];let T0=!1;function TO(){T0=!1}class r3e{constructor(t){this.lineWrapping=t,this.doc=Is.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(t,n){let s=this.doc.lineAt(n).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(s+=Math.max(0,Math.ceil((n-t-s*this.lineLength*.5)/this.lineLength))),this.lineHeight*s}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return CO.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let n=!1;for(let s=0;s<t.length;s++){let r=t[s];r<0?s++:this.heightSamples[Math.floor(r*10)]||(n=!0,this.heightSamples[Math.floor(r*10)]=!0)}return n}refresh(t,n,s,r,i,o){let a=CO.indexOf(t)>-1,l=Math.abs(n-this.lineHeight)>.3||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=n,this.charWidth=s,this.textHeight=r,this.lineLength=i,l){this.heightSamples={};for(let c=0;c<o.length;c++){let d=o[c];d<0?c++:this.heightSamples[Math.floor(d*10)]=!0}}return l}}class i3e{constructor(t,n){this.from=t,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class jl{constructor(t,n,s,r,i){this.from=t,this.length=n,this.top=s,this.height=r,this._content=i}get type(){return typeof this._content=="number"?oo.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 Qf?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(t){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(t._content)?t._content:[t]);return new jl(this.from,this.length+t.length,this.top,this.height+t.height,n)}}var pr=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}(pr||(pr={}));const Sx=.001;class Po{constructor(t,n,s=2){this.length=t,this.height=n,this.flags=s}get outdated(){return(this.flags&2)>0}set outdated(t){this.flags=(t?2:0)|this.flags&-3}setHeight(t){this.height!=t&&(Math.abs(this.height-t)>Sx&&(T0=!0),this.height=t)}replace(t,n,s){return Po.of(s)}decomposeLeft(t,n){n.push(this)}decomposeRight(t,n){n.push(this)}applyChanges(t,n,s,r){let i=this,o=s.doc;for(let a=r.length-1;a>=0;a--){let{fromA:l,toA:c,fromB:d,toB:h}=r[a],f=i.lineAt(l,pr.ByPosNoHeight,s.setDoc(n),0,0),p=f.to>=c?f:i.lineAt(c,pr.ByPosNoHeight,s,0,0);for(h+=p.to-c,c=p.to;a>0&&f.from<=r[a-1].toA;)l=r[a-1].fromA,d=r[a-1].fromB,a--,l<f.from&&(f=i.lineAt(l,pr.ByPosNoHeight,s,0,0));d+=f.from-l,l=f.from;let g=ZA.build(s.setDoc(o),t,d,h);i=i2(i,i.replace(l,c,g))}return i.updateHeight(s,0)}static empty(){return new wa(0,0,0)}static of(t){if(t.length==1)return t[0];let n=0,s=t.length,r=0,i=0;for(;;)if(n==s)if(r>i*2){let a=t[n-1];a.break?t.splice(--n,1,a.left,null,a.right):t.splice(--n,1,a.left,a.right),s+=1+a.break,r-=a.size}else if(i>r*2){let a=t[s];a.break?t.splice(s,1,a.left,null,a.right):t.splice(s,1,a.left,a.right),s+=2+a.break,i-=a.size}else break;else if(r<i){let a=t[n++];a&&(r+=a.size)}else{let a=t[--s];a&&(i+=a.size)}let o=0;return t[n-1]==null?(o=1,n--):t[n]==null&&(o=1,s++),new a3e(Po.of(t.slice(0,n)),o,Po.of(t.slice(s)))}}function i2(e,t){return e==t?e:(e.constructor!=t.constructor&&(T0=!0),t)}Po.prototype.size=1;const o3e=sn.replace({});class eY extends Po{constructor(t,n,s){super(t,n),this.deco=s,this.spaceAbove=0}mainBlock(t,n){return new jl(n,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(t,n,s,r){return this.spaceAbove&&t<s+this.spaceAbove?new jl(r,0,s,this.spaceAbove,o3e):this.mainBlock(s,r)}lineAt(t,n,s,r,i){let o=this.mainBlock(r,i);return this.spaceAbove?this.blockAt(0,s,r,i).join(o):o}forEachLine(t,n,s,r,i,o){t<=i+this.length&&n>=i&&o(this.lineAt(0,pr.ByPos,s,r,i))}setMeasuredHeight(t){let n=t.heights[t.index++];n<0?(this.spaceAbove=-n,n=t.heights[t.index++]):this.spaceAbove=0,this.setHeight(n)}updateHeight(t,n=0,s=!1,r){return r&&r.from<=n&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}}class wa extends eY{constructor(t,n,s){super(t,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=s}mainBlock(t,n){return new jl(n,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(t,n,s){let r=s[0];return s.length==1&&(r instanceof wa||r instanceof Qi&&r.flags&4)&&Math.abs(this.length-r.length)<10?(r instanceof Qi?r=new wa(r.length,this.height,this.spaceAbove):r.height=this.height,this.outdated||(r.outdated=!1),r):Po.of(s)}updateHeight(t,n=0,s=!1,r){return r&&r.from<=n&&r.more?this.setMeasuredHeight(r):(s||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Qi extends Po{constructor(t){super(t,0)}heightMetrics(t,n){let s=t.doc.lineAt(n).number,r=t.doc.lineAt(n+this.length).number,i=r-s+1,o,a=0;if(t.lineWrapping){let l=Math.min(this.height,t.lineHeight*i);o=l/i,this.length>i+1&&(a=(this.height-l)/(this.length-i-1))}else o=this.height/i;return{firstLine:s,lastLine:r,perLine:o,perChar:a}}blockAt(t,n,s,r){let{firstLine:i,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(n,r);if(n.lineWrapping){let c=r+(t<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(t-s)/this.height))*this.length)),d=n.doc.lineAt(c),h=a+d.length*l,f=Math.max(s,t-h/2);return new jl(d.from,d.length,f,h,0)}else{let c=Math.max(0,Math.min(o-i,Math.floor((t-s)/a))),{from:d,length:h}=n.doc.line(i+c);return new jl(d,h,s+a*c,a,0)}}lineAt(t,n,s,r,i){if(n==pr.ByHeight)return this.blockAt(t,s,r,i);if(n==pr.ByPosNoHeight){let{from:p,to:g}=s.doc.lineAt(t);return new jl(p,g-p,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(s,i),c=s.doc.lineAt(t),d=a+c.length*l,h=c.number-o,f=r+a*h+l*(c.from-i-h);return new jl(c.from,c.length,Math.max(r,Math.min(f,r+this.height-d)),d,0)}forEachLine(t,n,s,r,i,o){t=Math.max(t,i),n=Math.min(n,i+this.length);let{firstLine:a,perLine:l,perChar:c}=this.heightMetrics(s,i);for(let d=t,h=r;d<=n;){let f=s.doc.lineAt(d);if(d==t){let g=f.number-a;h+=l*g+c*(t-i-g)}let p=l+c*f.length;o(new jl(f.from,f.length,h,p,0)),h+=p,d=f.to+1}}replace(t,n,s){let r=this.length-n;if(r>0){let i=s[s.length-1];i instanceof Qi?s[s.length-1]=new Qi(i.length+r):s.push(null,new Qi(r-1))}if(t>0){let i=s[0];i instanceof Qi?s[0]=new Qi(t+i.length):s.unshift(new Qi(t-1),null)}return Po.of(s)}decomposeLeft(t,n){n.push(new Qi(t-1),null)}decomposeRight(t,n){n.push(null,new Qi(this.length-t-1))}updateHeight(t,n=0,s=!1,r){let i=n+this.length;if(r&&r.from<=n+this.length&&r.more){let o=[],a=Math.max(n,r.from),l=-1;for(r.from>n&&o.push(new Qi(r.from-n-1).updateHeight(t,n));a<=i&&r.more;){let d=t.doc.lineAt(a).length;o.length&&o.push(null);let h=r.heights[r.index++],f=0;h<0&&(f=-h,h=r.heights[r.index++]),l==-1?l=h:Math.abs(h-l)>=Sx&&(l=-2);let p=new wa(d,h,f);p.outdated=!1,o.push(p),a+=d+1}a<=i&&o.push(null,new Qi(i-a).updateHeight(t,a));let c=Po.of(o);return(l<0||Math.abs(c.height-this.height)>=Sx||Math.abs(l-this.heightMetrics(t,n).perLine)>=Sx)&&(T0=!0),i2(this,c)}else(s||this.outdated)&&(this.setHeight(t.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class a3e extends Po{constructor(t,n,s){super(t.length+n+s.length,t.height+s.height,n|(t.outdated||s.outdated?2:0)),this.left=t,this.right=s,this.size=t.size+s.size}get break(){return this.flags&1}blockAt(t,n,s,r){let i=s+this.left.height;return t<i?this.left.blockAt(t,n,s,r):this.right.blockAt(t,n,i,r+this.left.length+this.break)}lineAt(t,n,s,r,i){let o=r+this.left.height,a=i+this.left.length+this.break,l=n==pr.ByHeight?t<o:t<a,c=l?this.left.lineAt(t,n,s,r,i):this.right.lineAt(t,n,s,o,a);if(this.break||(l?c.to<a:c.from>a))return c;let d=n==pr.ByPosNoHeight?pr.ByPosNoHeight:pr.ByPos;return l?c.join(this.right.lineAt(a,d,s,o,a)):this.left.lineAt(a,d,s,r,i).join(c)}forEachLine(t,n,s,r,i,o){let a=r+this.left.height,l=i+this.left.length+this.break;if(this.break)t<l&&this.left.forEachLine(t,n,s,r,i,o),n>=l&&this.right.forEachLine(t,n,s,a,l,o);else{let c=this.lineAt(l,pr.ByPos,s,r,i);t<c.from&&this.left.forEachLine(t,c.from-1,s,r,i,o),c.to>=t&&c.from<=n&&o(c),n>c.to&&this.right.forEachLine(c.to+1,n,s,a,l,o)}}replace(t,n,s){let r=this.left.length+this.break;if(n<r)return this.balanced(this.left.replace(t,n,s),this.right);if(t>this.left.length)return this.balanced(this.left,this.right.replace(t-r,n-r,s));let i=[];t>0&&this.decomposeLeft(t,i);let o=i.length;for(let a of s)i.push(a);if(t>0&&EO(i,o-1),n<this.length){let a=i.length;this.decomposeRight(n,i),EO(i,a)}return Po.of(i)}decomposeLeft(t,n){let s=this.left.length;if(t<=s)return this.left.decomposeLeft(t,n);n.push(this.left),this.break&&(s++,t>=s&&n.push(null)),t>s&&this.right.decomposeLeft(t-s,n)}decomposeRight(t,n){let s=this.left.length,r=s+this.break;if(t>=r)return this.right.decomposeRight(t-r,n);t<s&&this.left.decomposeRight(t,n),this.break&&t<r&&n.push(null),n.push(this.right)}balanced(t,n){return t.size>2*n.size||n.size>2*t.size?Po.of(this.break?[t,null,n]:[t,n]):(this.left=i2(this.left,t),this.right=i2(this.right,n),this.setHeight(t.height+n.height),this.outdated=t.outdated||n.outdated,this.size=t.size+n.size,this.length=t.length+this.break+n.length,this)}updateHeight(t,n=0,s=!1,r){let{left:i,right:o}=this,a=n+i.length+this.break,l=null;return r&&r.from<=n+i.length&&r.more?l=i=i.updateHeight(t,n,s,r):i.updateHeight(t,n,s),r&&r.from<=a+o.length&&r.more?l=o=o.updateHeight(t,a,s,r):o.updateHeight(t,a,s),l?this.balanced(i,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function EO(e,t){let n,s;e[t]==null&&(n=e[t-1])instanceof Qi&&(s=e[t+1])instanceof Qi&&e.splice(t-1,3,new Qi(n.length+1+s.length))}const l3e=5;class ZA{constructor(t,n){this.pos=t,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,n){if(this.lineStart>-1){let s=Math.min(n,this.lineEnd),r=this.nodes[this.nodes.length-1];r instanceof wa?r.length+=s-this.pos:(s>this.pos||!this.isCovered)&&this.nodes.push(new wa(s-this.pos,-1,0)),this.writtenTo=s,n>s&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(t,n,s){if(t<n||s.heightRelevant){let r=s.widget?s.widget.estimatedHeight:0,i=s.widget?s.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let o=n-t;s.block?this.addBlock(new eY(o,r,s)):(o||i||r>=l3e)&&this.addLineDeco(r,i,o)}else n>t&&this.span(t,n);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:t,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=n,this.writtenTo<t&&((this.writtenTo<t-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,t-1)),this.nodes.push(null)),this.pos>t&&this.nodes.push(new wa(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,n){let s=new Qi(n-t);return this.oracle.doc.lineAt(t).to==n&&(s.flags|=4),s}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof wa)return t;let n=new wa(0,-1,0);return this.nodes.push(n),n}addBlock(t){this.enterLine();let n=t.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,n&&n.endSide>0&&(this.covering=t)}addLineDeco(t,n,s){let r=this.ensureLine();r.length+=s,r.collapsed+=s,r.widgetHeight=Math.max(r.widgetHeight,t),r.breaks+=n,this.writtenTo=this.pos=this.pos+s}finish(t){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof wa)&&!this.isCovered?this.nodes.push(new wa(0,-1,0)):(this.writtenTo<this.pos||n==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let s=t;for(let r of this.nodes)r instanceof wa&&r.updateHeight(this.oracle,s),s+=r?r.length:1;return this.nodes}static build(t,n,s,r){let i=new ZA(s,t);return ms.spans(n,s,r,i,0),i.finish(s)}}function c3e(e,t,n){let s=new u3e;return ms.compare(e,t,n,s,0),s.changes}class u3e{constructor(){this.changes=[]}compareRange(){}comparePoint(t,n,s,r){(t<n||s&&s.heightRelevant||r&&r.heightRelevant)&&Xp(t,n,this.changes,5)}}function d3e(e,t){let n=e.getBoundingClientRect(),s=e.ownerDocument,r=s.defaultView||window,i=Math.max(0,n.left),o=Math.min(r.innerWidth,n.right),a=Math.max(0,n.top),l=Math.min(r.innerHeight,n.bottom);for(let c=e.parentNode;c&&c!=s.body;)if(c.nodeType==1){let d=c,h=window.getComputedStyle(d);if((d.scrollHeight>d.clientHeight||d.scrollWidth>d.clientWidth)&&h.overflow!="visible"){let f=d.getBoundingClientRect();i=Math.max(i,f.left),o=Math.min(o,f.right),a=Math.max(a,f.top),l=Math.min(c==e.parentNode?r.innerHeight:l,f.bottom)}c=h.position=="absolute"||h.position=="fixed"?d.offsetParent:d.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:i-n.left,right:Math.max(i,o)-n.left,top:a-(n.top+t),bottom:Math.max(a,l)-(n.top+t)}}function h3e(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left<n.innerWidth&&t.right>0&&t.top<n.innerHeight&&t.bottom>0}function f3e(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class k5{constructor(t,n,s,r){this.from=t,this.to=n,this.size=s,this.displaySize=r}static same(t,n){if(t.length!=n.length)return!1;for(let s=0;s<t.length;s++){let r=t[s],i=n[s];if(r.from!=i.from||r.to!=i.to||r.size!=i.size)return!1}return!0}draw(t,n){return sn.replace({widget:new m3e(this.displaySize*(n?t.scaleY:t.scaleX),n)}).range(this.from,this.to)}}class m3e extends Fa{constructor(t,n){super(),this.size=t,this.vertical=n}eq(t){return t.size==this.size&&t.vertical==this.vertical}toDOM(){let t=document.createElement("div");return this.vertical?t.style.height=this.size+"px":(t.style.width=this.size+"px",t.style.height="2px",t.style.display="inline-block"),t}get estimatedHeight(){return this.vertical?this.size:-1}}class AO{constructor(t,n){this.view=t,this.state=n,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=MO,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=cr.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let s=n.facet(YA).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new r3e(s),this.stateDeco=NO(n),this.heightMap=Po.empty().applyChanges(this.stateDeco,Is.empty,this.heightOracle.setDoc(n.doc),[new fl(0,0,0,n.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=sn.set(this.lineGaps.map(r=>r.draw(this,!1))),this.scrollParent=t.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:n}=this.state.selection;for(let s=0;s<=1;s++){let r=s?n.head:n.anchor;if(!t.some(({from:i,to:o})=>r>=i&&r<=o)){let{from:i,to:o}=this.lineBlockAt(r);t.push(new lw(i,o))}}return this.viewports=t.sort((s,r)=>s.from-r.from),this.updateScaler()}updateScaler(){let t=this.scaler;return this.scaler=this.heightMap.height<=7e6?MO:new e9(this.heightOracle,this.heightMap,this.viewports),t.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,t=>{this.viewportLines.push(h1(t,this.scaler))})}update(t,n=null){this.state=t.state;let s=this.stateDeco;this.stateDeco=NO(this.state);let r=t.changedRanges,i=fl.extendWithRanges(r,c3e(s,this.stateDeco,t?t.changes:_i.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);TO(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=o||T0)&&(t.flags|=2),a?(this.scrollAnchorPos=t.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let l=i.length?this.mapViewport(this.viewport,t.changes):this.viewport;(n&&(n.range.head<l.from||n.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,n));let c=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,t.flags|=this.updateForViewport(),(c||!t.changes.empty||t.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(t.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&(t.selectionSet||t.focusChanged)&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(jK)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:t}=this,n=t.contentDOM,s=window.getComputedStyle(n),r=this.heightOracle,i=s.whiteSpace;this.defaultTextDirection=s.direction=="rtl"?cr.RTL:cr.LTR;let o=this.heightOracle.mustRefreshForWrapping(i)||this.mustMeasureContent==="refresh",a=n.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let c=0,d=0;if(a.width&&a.height){let{scaleX:T,scaleY:C}=pK(n,a);(T>.005&&Math.abs(this.scaleX-T)>.005||C>.005&&Math.abs(this.scaleY-C)>.005)&&(this.scaleX=T,this.scaleY=C,c|=16,o=l=!0)}let h=(parseInt(s.paddingTop)||0)*this.scaleY,f=(parseInt(s.paddingBottom)||0)*this.scaleY;(this.paddingTop!=h||this.paddingBottom!=f)&&(this.paddingTop=h,this.paddingBottom=f,c|=18),this.editorWidth!=t.scrollDOM.clientWidth&&(r.lineWrapping&&(l=!0),this.editorWidth=t.scrollDOM.clientWidth,c|=16);let p=gK(this.view.contentDOM,!1).y;p!=this.scrollParent&&(this.scrollParent=p,this.scrollAnchorHeight=-1,this.scrollOffset=0);let g=this.getScrollOffset();this.scrollOffset!=g&&(this.scrollAnchorHeight=-1,this.scrollOffset=g),this.scrolledToBottom=bK(this.scrollParent||t.win);let y=(this.printing?f3e:d3e)(n,this.paddingTop),w=y.top-this.pixelViewport.top,v=y.bottom-this.pixelViewport.bottom;this.pixelViewport=y;let b=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(b!=this.inView&&(this.inView=b,b&&(l=!0)),!this.inView&&!this.scrollTarget&&!h3e(t.dom))return 0;let x=a.width;if((this.contentDOMWidth!=x||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=t.scrollDOM.clientHeight,c|=16),l){let T=t.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(T)&&(o=!0),o||r.lineWrapping&&Math.abs(x-this.contentDOMWidth)>r.charWidth){let{lineHeight:C,charWidth:S,textHeight:_}=t.docView.measureTextSize();o=C>0&&r.refresh(i,C,S,_,Math.max(5,x/S),T),o&&(t.docView.minWidth=0,c|=16)}w>0&&v>0?d=Math.max(w,v):w<0&&v<0&&(d=Math.min(w,v)),TO();for(let C of this.viewports){let S=C.from==this.viewport.from?T:t.docView.measureVisibleLineHeights(C);this.heightMap=(o?Po.empty().applyChanges(this.stateDeco,Is.empty,this.heightOracle,[new fl(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new i3e(C.from,S))}T0&&(c|=2)}let k=!this.viewportIsAppropriate(this.viewport,d)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return k&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(d,this.scrollTarget),c|=this.updateForViewport()),(c&2||k)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,t)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,n){let s=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),r=this.heightMap,i=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,l=new lw(r.lineAt(o-s*1e3,pr.ByHeight,i,0,0).from,r.lineAt(a+(1-s)*1e3,pr.ByHeight,i,0,0).to);if(n){let{head:c}=n.range;if(c<l.from||c>l.to){let d=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),h=r.lineAt(c,pr.ByPos,i,0,0),f;n.y=="center"?f=(h.top+h.bottom)/2-d/2:n.y=="start"||n.y=="nearest"&&c<l.from?f=h.top:f=h.bottom-d,l=new lw(r.lineAt(f-1e3/2,pr.ByHeight,i,0,0).from,r.lineAt(f+d+1e3/2,pr.ByHeight,i,0,0).to)}}return l}mapViewport(t,n){let s=n.mapPos(t.from,-1),r=n.mapPos(t.to,1);return new lw(this.heightMap.lineAt(s,pr.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,pr.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:t,to:n},s=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(t,pr.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(n,pr.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(t==0||r<=o-Math.max(10,Math.min(-s,250)))&&(n==this.state.doc.length||i>=a+Math.max(10,Math.min(s,250)))&&r>o-2*1e3&&i<a+2*1e3}mapLineGaps(t,n){if(!t.length||n.empty)return t;let s=[];for(let r of t)n.touchesRange(r.from,r.to)||s.push(new k5(n.mapPos(r.from),n.mapPos(r.to),r.size,r.displaySize));return s}ensureLineGaps(t,n){let s=this.heightOracle.lineWrapping,r=s?1e4:2e3,i=r>>1,o=r<<1;if(this.defaultTextDirection!=cr.LTR&&!s)return[];let a=[],l=(d,h,f,p)=>{if(h-d<i)return;let g=this.state.selection.main,y=[g.from];g.empty||y.push(g.to);for(let v of y)if(v>d&&v<h){l(d,v-10,f,p),l(v+10,h,f,p);return}let w=g3e(t,v=>v.from>=f.from&&v.to<=f.to&&Math.abs(v.from-d)<i&&Math.abs(v.to-h)<i&&!y.some(b=>v.from<b&&v.to>b));if(!w){if(h<f.to&&n&&s&&n.visibleRanges.some(x=>x.from<=h&&x.to>=h)){let x=n.moveToLineBoundary(Be.cursor(h),!1,!0).head;x>d&&(h=x)}let v=this.gapSize(f,d,h,p),b=s||v<2e6?v:2e6;w=new k5(d,h,v,b)}a.push(w)},c=d=>{if(d.length<o||d.type!=oo.Text)return;let h=p3e(d.from,d.to,this.stateDeco);if(h.total<o)return;let f=this.scrollTarget?this.scrollTarget.range.head:null,p,g;if(s){let y=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,w,v;if(f!=null){let b=uw(h,f),x=((this.visibleBottom-this.visibleTop)/2+y)/d.height;w=b-x,v=b+x}else w=(this.visibleTop-d.top-y)/d.height,v=(this.visibleBottom-d.top+y)/d.height;p=cw(h,w),g=cw(h,v)}else{let y=h.total*this.heightOracle.charWidth,w=r*this.heightOracle.charWidth,v=0;if(y>2e6)for(let C of t)C.from>=d.from&&C.from<d.to&&C.size!=C.displaySize&&C.from*this.heightOracle.charWidth+v<this.pixelViewport.left&&(v=C.size-C.displaySize);let b=this.pixelViewport.left+v,x=this.pixelViewport.right+v,k,T;if(f!=null){let C=uw(h,f),S=((x-b)/2+w)/y;k=C-S,T=C+S}else k=(b-w)/y,T=(x+w)/y;p=cw(h,k),g=cw(h,T)}p>d.from&&l(d.from,p,d,h),g<d.to&&l(g,d.to,d,h)};for(let d of this.viewportLines)Array.isArray(d.type)?d.type.forEach(c):c(d);return a}gapSize(t,n,s,r){let i=uw(r,s)-uw(r,n);return this.heightOracle.lineWrapping?t.height*i:r.total*this.heightOracle.charWidth*i}updateLineGaps(t){k5.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=sn.set(t.map(n=>n.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(t){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let s=[];ms.spans(n,this.viewport.from,this.viewport.to,{span(i,o){s.push({from:i,to:o})},point(){}},20);let r=0;if(s.length!=this.visibleRanges.length)r=12;else for(let i=0;i<s.length&&!(r&8);i++){let o=this.visibleRanges[i],a=s[i];(o.from!=a.from||o.to!=a.to)&&(r|=4,t&&t.mapPos(o.from,-1)==a.from&&t.mapPos(o.to,1)==a.to||(r|=8))}return this.visibleRanges=s,r}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(n=>n.from<=t&&n.to>=t)||h1(this.heightMap.lineAt(t,pr.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return t>=this.viewportLines[0].top&&t<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=t&&n.bottom>=t)||h1(this.heightMap.lineAt(this.scaler.fromDOM(t),pr.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(t){let n=this.lineBlockAtHeight(t+8);return n.from>=this.viewport.from||this.viewportLines[0].top-t>200?n:this.viewportLines[0]}elementAtHeight(t){return h1(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class lw{constructor(t,n){this.from=t,this.to=n}}function p3e(e,t,n){let s=[],r=e,i=0;return ms.spans(n,e,t,{span(){},point(o,a){o>r&&(s.push({from:r,to:o}),i+=o-r),r=a}},20),r<t&&(s.push({from:r,to:t}),i+=t-r),{total:i,ranges:s}}function cw({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let s=Math.floor(e*n);for(let r=0;;r++){let{from:i,to:o}=t[r],a=o-i;if(s<=a)return i+s;s-=a}}function uw(e,t){let n=0;for(let{from:s,to:r}of e.ranges){if(t<=r){n+=t-s;break}n+=r-s}return n/e.total}function g3e(e,t){for(let n of e)if(t(n))return n}const MO={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function NO(e){let t=e.facet(H_).filter(s=>typeof s!="function"),n=e.facet(XA).filter(s=>typeof s!="function");return n.length&&t.push(ms.join(n)),t}class e9{constructor(t,n,s){let r=0,i=0,o=0;this.viewports=s.map(({from:a,to:l})=>{let c=n.lineAt(a,pr.ByPos,t,0,0).top,d=n.lineAt(l,pr.ByPos,t,0,0).bottom;return r+=d-c,{from:a,to:l,top:c,bottom:d,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(n.height-r);for(let a of this.viewports)a.domTop=o+(a.top-i)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),i=a.bottom}toDOM(t){for(let n=0,s=0,r=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||t<i.top)return r+(t-s)*this.scale;if(t<=i.bottom)return i.domTop+(t-i.top);s=i.bottom,r=i.domBottom}}fromDOM(t){for(let n=0,s=0,r=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||t<i.domTop)return s+(t-r)/this.scale;if(t<=i.domBottom)return i.top+(t-i.domTop);s=i.bottom,r=i.domBottom}}eq(t){return t instanceof e9?this.scale==t.scale&&this.viewports.length==t.viewports.length&&this.viewports.every((n,s)=>n.from==t.viewports[s].from&&n.to==t.viewports[s].to):!1}}function h1(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),s=t.toDOM(e.bottom);return new jl(e.from,e.length,n,s-n,Array.isArray(e._content)?e._content.map(r=>h1(r,t)):e._content)}const dw=Ut.define({combine:e=>e.join(" ")}),b8=Ut.define({combine:e=>e.indexOf(!0)>-1}),v8=xh.newName(),tY=xh.newName(),nY=xh.newName(),sY={"&light":"."+tY,"&dark":"."+nY};function w8(e,t,n){return new xh(t,{finish(s){return/&/.test(s)?s.replace(/&\w*/,r=>{if(r=="&")return e;if(!n||!n[r])throw new RangeError(`Unsupported selector: ${r}`);return n[r]}):e+" "+s}})}const y3e=w8("."+v8,{"&":{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"}},sY),b3e={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},_5=Ht.ie&&Ht.ie_version<=11;class v3e{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new Y4e,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(n=>{for(let s of n)this.queue.push(s);(Ht.ie&&Ht.ie_version<=11||Ht.ios&&t.composing)&&n.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Ht.android&&t.constructor.EDIT_CONTEXT!==!1&&!(Ht.chrome&&Ht.chrome_version<126)&&(this.editContext=new x3e(t),t.state.facet(mu)&&(t.contentDOM.editContext=this.editContext.editContext)),_5&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(t.scrollDOM)),this.addWindowListeners(this.win=t.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(n=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(t){(t.type=="change"||!t.type)&&!t.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((n,s)=>n!=t[s]))){this.gapIntersection.disconnect();for(let n of t)this.gapIntersection.observe(n);this.gaps=t}}onSelectionChange(t){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:s}=this,r=this.selectionRange;if(s.state.facet(mu)?s.root.activeElement!=this.dom:!X1(this.dom,r))return;let i=r.anchorNode&&s.docView.tile.nearest(r.anchorNode);if(i&&i.isWidget()&&i.widget.ignoreEvent(t)){n||(this.selectionChanged=!1);return}(Ht.ie&&Ht.ie_version<=11||Ht.android&&Ht.chrome)&&!s.state.selection.main.empty&&r.focusNode&&J1(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,n=Ry(t.root);if(!n)return!1;let s=Ht.safari&&t.root.nodeType==11&&t.root.activeElement==this.dom&&w3e(this.view,n)||n;if(!s||this.selectionRange.eq(s))return!1;let r=X1(this.dom,s);return r&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&Q4e(this.dom,s)?(this.view.inputState.lastFocusTime=0,t.docView.updateSelection(),!1):(this.selectionRange.setRange(s),r&&(this.selectionChanged=!0),!0)}setSelectionRange(t,n){this.selectionRange.set(t.node,t.offset,n.node,n.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let t=0,n=null;for(let s=this.dom;s;)if(s.nodeType==1)!n&&t<this.scrollTargets.length&&this.scrollTargets[t]==s?t++:n||(n=this.scrollTargets.slice(0,t)),n&&n.push(s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;if(t<this.scrollTargets.length&&!n&&(n=this.scrollTargets.slice(0,t)),n){for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);for(let s of this.scrollTargets=n)s.addEventListener("scroll",this.onScroll)}}ignore(t){if(!this.active)return t();try{return this.stop(),t()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,b3e),_5&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),_5&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(t,n){var s;if(!this.delayedAndroidKey){let r=()=>{let i=this.delayedAndroidKey;i&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=i.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&i.force&&Qp(this.dom,i.key,i.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)}(!this.delayedAndroidKey||t=="Enter")&&(this.delayedAndroidKey={key:t,keyCode:n,force:this.lastChange<Date.now()-50||!!(!((s=this.delayedAndroidKey)===null||s===void 0)&&s.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let n=-1,s=-1,r=!1;for(let i of t){let o=this.readMutation(i);o&&(o.typeOver&&(r=!0),n==-1?{from:n,to:s}=o:(n=Math.min(o.from,n),s=Math.max(o.to,s)))}return{from:n,to:s,typeOver:r}}readChange(){let{from:t,to:n,typeOver:s}=this.processRecords(),r=this.selectionChanged&&X1(this.dom,this.selectionRange);if(t<0&&!r)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new BSe(this.view,t,n,s);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let s=this.view.state,r=UK(this.view,n);return this.view.state==s&&(n.domChanged||n.newSel&&!r2(this.view.state.selection,n.newSel.main))&&this.view.update([]),r}readMutation(t){let n=this.view.docView.tile.nearest(t.target);if(!n||n.isWidget())return null;if(n.markDirty(t.type=="attributes"),t.type=="childList"){let s=IO(n,t.previousSibling||t.target.previousSibling,-1),r=IO(n,t.nextSibling||t.target.nextSibling,1);return{from:s?n.posAfter(s):n.posAtStart,to:r?n.posBefore(r):n.posAtEnd,typeOver:!1}}else return t.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}update(t){this.editContext&&(this.editContext.update(t),t.startState.facet(mu)!=t.state.facet(mu)&&(t.view.contentDOM.editContext=t.state.facet(mu)?this.editContext.editContext:null))}destroy(){var t,n,s;this.stop(),(t=this.intersection)===null||t===void 0||t.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(s=this.resizeScroll)===null||s===void 0||s.disconnect();for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function IO(e,t,n){for(;t;){let s=Wr.get(t);if(s&&s.parent==e)return s;let r=t.parentNode;t=r!=e.dom?r:n>0?t.nextSibling:t.previousSibling}return null}function RO(e,t){let n=t.startContainer,s=t.startOffset,r=t.endContainer,i=t.endOffset,o=e.docView.domAtPos(e.state.selection.main.anchor,1);return J1(o.node,o.offset,r,i)&&([n,s,r,i]=[r,i,n,s]),{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:i}}function w3e(e,t){if(t.getComposedRanges){let r=t.getComposedRanges(e.root)[0];if(r)return RO(e,r)}let n=null;function s(r){r.preventDefault(),r.stopImmediatePropagation(),n=r.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",s,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",s,!0),n?RO(e,n):null}class x3e{constructor(t){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(t.state);let n=this.editContext=new window.EditContext({text:t.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,t.state.selection.main.anchor))),selectionEnd:this.toContextPos(t.state.selection.main.head)});this.handlers.textupdate=s=>{let r=t.state.selection.main,{anchor:i,head:o}=r,a=this.toEditorPos(s.updateRangeStart),l=this.toEditorPos(s.updateRangeEnd);t.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:s.updateRangeStart,editorBase:a,drifted:!1});let c=l-a>s.text.length;a==this.from&&i<this.from?a=i:l==this.to&&i>this.to&&(l=i);let d=VK(t.state.sliceDoc(a,l),s.text,(c?r.from:r.to)-a,c?"end":null);if(!d){let f=Be.single(this.toEditorPos(s.selectionStart),this.toEditorPos(s.selectionEnd));r2(f,r)||t.dispatch({selection:f,userEvent:"select"});return}let h={from:d.from+a,to:d.toA+a,insert:Is.of(s.text.slice(d.from,d.toB).split(`
`))};if((Ht.mac||Ht.android)&&h.from==o-1&&/^\. ?$/.test(s.text)&&t.contentDOM.getAttribute("autocorrect")=="off"&&(h={from:a,to:l,insert:Is.of([s.text.replace("."," ")])}),this.pendingContextChange=h,!t.state.readOnly){let f=this.to-this.from+(h.to-h.from+h.insert.length);JA(t,h,Be.single(this.toEditorPos(s.selectionStart,f),this.toEditorPos(s.selectionEnd,f)))}this.pendingContextChange&&(this.revertPending(t.state),this.setSelection(t.state)),h.from<h.to&&!h.insert.length&&t.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,s.updateRangeStart-1),Math.min(n.text.length,s.updateRangeStart+1)))&&this.handlers.compositionend(s)},this.handlers.characterboundsupdate=s=>{let r=[],i=null;for(let o=this.toEditorPos(s.rangeStart),a=this.toEditorPos(s.rangeEnd);o<a;o++){let l=t.coordsForChar(o);i=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||i||new DOMRect,r.push(i)}n.updateCharacterBounds(s.rangeStart,r)},this.handlers.textformatupdate=s=>{let r=[];for(let i of s.getTextFormats()){let o=i.underlineStyle,a=i.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let l=this.toEditorPos(i.rangeStart),c=this.toEditorPos(i.rangeEnd);if(l<c){let d=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;r.push(sn.mark({attributes:{style:d}}).range(l,c))}}}t.dispatch({effects:DK.of(sn.set(r))})},this.handlers.compositionstart=()=>{t.inputState.composing<0&&(t.inputState.composing=0,t.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(t.inputState.composing=-1,t.inputState.compositionFirstChange=null,this.composing){let{drifted:s}=this.composing;this.composing=null,s&&this.reset(t.state)}};for(let s in this.handlers)n.addEventListener(s,this.handlers[s]);this.measureReq={read:s=>{this.editContext.updateControlBounds(s.contentDOM.getBoundingClientRect());let r=Ry(s.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(t){let n=0,s=!1,r=this.pendingContextChange;return t.changes.iterChanges((i,o,a,l,c)=>{if(s)return;let d=c.length-(o-i);if(r&&o>=r.to)if(r.from==i&&r.to==o&&r.insert.eq(c)){r=this.pendingContextChange=null,n+=d,this.to+=d;return}else r=null,this.revertPending(t.state);if(i+=n,o+=n,o<=this.from)this.from+=d,this.to+=d;else if(i<this.to){if(i<this.from||o>this.to||this.to-this.from+c.length>3e4){s=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(o),c.toString()),this.to+=d}n+=d}),r&&!s&&this.revertPending(t.state),!s}update(t){let n=this.pendingContextChange,s=t.startState.selection.main;this.composing&&(this.composing.drifted||!t.changes.touchesRange(s.from,s.to)&&t.transactions.some(r=>!r.isUserEvent("input.type")&&r.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=t.changes.mapPos(this.composing.editorBase)):!this.applyEdits(t)||!this.rangeIsValid(t.state)?(this.pendingContextChange=null,this.reset(t.state)):(t.docChanged||t.selectionSet||n)&&this.setSelection(t.state),(t.geometryChanged||t.docChanged||t.selectionSet)&&t.view.requestMeasure(this.measureReq)}resetRange(t){let{head:n}=t.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(t.doc.length,n+1e4)}reset(t){this.resetRange(t),this.editContext.updateText(0,this.editContext.text.length,t.doc.sliceString(this.from,this.to)),this.setSelection(t)}revertPending(t){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),t.doc.sliceString(n.from,n.to))}setSelection(t){let{main:n}=t.selection,s=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),r=this.toContextPos(n.head);(this.editContext.selectionStart!=s||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(s,r)}rangeIsValid(t){let{head:n}=t.selection.main;return!(this.from>0&&n-this.from<500||this.to<t.doc.length&&this.to-n<500||this.to-this.from>1e4*3)}toEditorPos(t,n=this.to-this.from){t=Math.min(t,n);let s=this.composing;return s&&s.drifted?s.editorBase+(t-s.contextBase):t+this.from}toContextPos(t){let n=this.composing;return n&&n.drifted?n.contextBase+(t-n.editorBase):t-this.from}destroy(){for(let t in this.handlers)this.editContext.removeEventListener(t,this.handlers[t])}}class yt{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);let{dispatch:s}=t;this.dispatchTransactions=t.dispatchTransactions||s&&(r=>r.forEach(i=>s(i,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=t.root||X4e(t.parent)||document,this.viewState=new AO(this,t.state||ws.create(t)),t.scrollTo&&t.scrollTo.is(iw)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Ip).map(r=>new y5(r));for(let r of this.plugins)r.update(this);this.observer=new v3e(this),this.inputState=new qSe(this),this.inputState.ensureHandlers(this.plugins),this.docView=new pO(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...t){let n=t.length==1&&t[0]instanceof Ci?t:t.length==1&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(n,this)}update(t){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,s=!1,r,i=this.state;for(let f of t){if(f.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=f.state}if(this.destroyed){this.viewState.state=i;return}let o=this.hasFocus,a=0,l=null;t.some(f=>f.annotation(QK))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=JK(i,o),l||(a=1));let c=this.observer.delayedAndroidKey,d=null;if(c?(this.observer.clearDelayedAndroidKey(),d=this.observer.readChange(),(d&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(d=null)):this.observer.clear(),i.facet(ws.phrases)!=this.state.facet(ws.phrases))return this.setState(i);r=t2.create(this,i,t),r.flags|=a;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let f of t){if(h&&(h=h.map(f.changes)),f.scrollIntoView){let{main:p}=f.state.selection,{x:g,y}=this.state.facet(yt.cursorScrollMargin);h=new Jp(p.empty?p:Be.cursor(p.head,p.head>p.anchor?-1:1),"nearest","nearest",y,g)}for(let p of f.effects)p.is(iw)&&(h=p.value.clip(this.state))}this.viewState.update(r,h),this.bidiCache=o2.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),n=this.docView.update(r),this.state.facet(d1)!=this.styleModules&&this.mountStyles(),s=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(n,t.some(f=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet(dw)!=r.state.facet(dw)&&(this.viewState.mustMeasureContent=!0),(n||s||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!r.empty)for(let f of this.state.facet(f8))try{f(r)}catch(p){ta(this.state,p,"update listener")}(l||d)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),d&&!UK(this,d)&&c.force&&Qp(this.contentDOM,c.key,c.keyCode)})}setState(t){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=t;return}this.updateState=2;let n=this.hasFocus;try{for(let s of this.plugins)s.destroy(this);this.viewState=new AO(this,t),this.plugins=t.facet(Ip).map(s=>new y5(s)),this.pluginMap.clear();for(let s of this.plugins)s.update(this);this.docView.destroy(),this.docView=new pO(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(t){let n=t.startState.facet(Ip),s=t.state.facet(Ip);if(n!=s){let r=[];for(let i of s){let o=n.indexOf(i);if(o<0)r.push(new y5(i));else{let a=this.plugins[o];a.mustUpdate=t,r.push(a)}}for(let i of this.plugins)i.mustUpdate!=t&&i.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let r of this.plugins)r.mustUpdate=t;for(let r=0;r<this.plugins.length;r++)this.plugins[r].update(this);n!=s&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let t of this.plugins){let n=t.value;if(n&&n.docViewUpdate)try{n.docViewUpdate(this)}catch(s){ta(this.state,s,"doc view update listener")}}}measure(t=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,t&&this.observer.forceFlush();let n=null,s=this.viewState.scrollParent,r=this.viewState.getScrollOffset(),{scrollAnchorPos:i,scrollAnchorHeight:o}=this.viewState;Math.abs(r-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(bK(s||this.win))i=-1,o=this.viewState.heightMap.height;else{let p=this.viewState.scrollAnchorAt(r);i=p.from,o=p.top}this.updateState=1;let l=this.viewState.measure();if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];l&4||([this.measureRequests,c]=[c,this.measureRequests]);let d=c.map(p=>{try{return p.read(this)}catch(g){return ta(this.state,g),jO}}),h=t2.create(this,this.state,[]),f=!1;h.flags|=l,n?n.flags|=l:n=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),f=this.docView.update(h),f&&this.docViewUpdate());for(let p=0;p<c.length;p++)if(d[p]!=jO)try{let g=c[p];g.write&&g.write(d[p],this)}catch(g){ta(this.state,g)}if(f&&this.docView.updateSelection(!0),!h.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let g=((i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)-o)/this.scaleY;if((g>1||g<-1)&&(s==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){r=r+g,s?s.scrollTop+=g:this.win.scrollBy(0,g),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let a of this.state.facet(f8))a(n)}get themeClasses(){return v8+" "+(this.state.facet(b8)?nY:tY)+" "+this.state.facet(dw)}updateAttrs(){let t=LO(this,OK,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(mu)?"true":"false",class:"cm-content",style:`${Ht.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),LO(this,YA,n);let s=this.observer.ignore(()=>{let r=cO(this.contentDOM,this.contentAttrs,n),i=cO(this.dom,this.editorAttrs,t);return r||i});return this.editorAttrs=t,this.contentAttrs=n,s}showAnnouncements(t){let n=!0;for(let s of t)for(let r of s.effects)if(r.is(yt.announce)){n&&(this.announceDOM.textContent=""),n=!1;let i=this.announceDOM.appendChild(document.createElement("div"));i.textContent=r.value}}mountStyles(){this.styleModules=this.state.facet(d1);let t=this.state.facet(yt.cspNonce);xh.mount(this.root,this.styleModules.concat(y3e).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),t){if(this.measureRequests.indexOf(t)>-1)return;if(t.key!=null){for(let n=0;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===t.key){this.measureRequests[n]=t;return}}this.measureRequests.push(t)}}plugin(t){let n=this.pluginMap.get(t);return(n===void 0||n&&n.plugin!=t)&&this.pluginMap.set(t,n=this.plugins.find(s=>s.plugin==t)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,n,s){return x5(this,t,gO(this,t,n,s))}moveByGroup(t,n){return x5(this,t,gO(this,t,n,s=>RSe(this,t.head,s)))}visualLineSide(t,n){let s=this.bidiSpans(t),r=this.textDirectionAt(t.from),i=s[n?s.length-1:0];return Be.cursor(i.side(n,r)+t.from,i.forward(!n,r)?1:-1)}moveToLineBoundary(t,n,s=!0){return ISe(this,t,n,s)}moveVertically(t,n,s){return x5(this,t,jSe(this,t,n,s))}domAtPos(t,n=1){return this.docView.domAtPos(t,n)}posAtDOM(t,n=0){return this.docView.posFromDOM(t,n)}posAtCoords(t,n=!0){this.readMeasured();let s=g8(this,t,n);return s&&s.pos}posAndSideAtCoords(t,n=!0){return this.readMeasured(),g8(this,t,n)}coordsAtPos(t,n=1){this.readMeasured();let s=this.docView.coordsAt(t,n);if(!s||s.left==s.right)return s;let r=this.state.doc.lineAt(t),i=this.bidiSpans(r),o=i[_c.find(i,t-r.from,-1,n)];return jy(s,o.dir==cr.LTR==n>0)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(RK)||t<this.viewport.from||t>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>k3e)return SK(t.length);let n=this.textDirectionAt(t.from),s;for(let i of this.bidiCache)if(i.from==t.from&&i.dir==n&&(i.fresh||_K(i.isolates,s=hO(this,t))))return i.order;s||(s=hO(this,t));let r=rSe(t.text,n,s);return this.bidiCache.push(new o2(t.from,t.to,n,s,!0,r)),r}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||Ht.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{yK(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((t.nodeType==9?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,n={}){var s,r,i,o;return iw.of(new Jp(typeof t=="number"?Be.cursor(t):t,(s=n.y)!==null&&s!==void 0?s:"nearest",(r=n.x)!==null&&r!==void 0?r:"nearest",(i=n.yMargin)!==null&&i!==void 0?i:5,(o=n.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:t,scrollLeft:n}=this.scrollDOM,s=this.viewState.scrollAnchorAt(t);return iw.of(new Jp(Be.cursor(s.from),"start","start",s.top-t,n,!0))}setTabFocusMode(t){t==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof t=="boolean"?this.inputState.tabFocusMode=t?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+t)}static domEventHandlers(t){return Ir.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return Ir.define(()=>({}),{eventObservers:t})}static theme(t,n){let s=xh.newName(),r=[dw.of(s),d1.of(w8(`.${s}`,t))];return n&&n.dark&&r.push(b8.of(!0)),r}static baseTheme(t){return Bh.lowest(d1.of(w8("."+v8,t,sY)))}static findFromDOM(t){var n;let s=t.querySelector(".cm-content"),r=s&&Wr.get(s)||Wr.get(t);return((n=r==null?void 0:r.root)===null||n===void 0?void 0:n.view)||null}}yt.styleModule=d1;yt.inputHandler=NK;yt.clipboardInputFilter=GA;yt.clipboardOutputFilter=KA;yt.scrollHandler=LK;yt.focusChangeEffect=IK;yt.perLineTextDirection=RK;yt.exceptionSink=MK;yt.updateListener=f8;yt.editable=mu;yt.mouseSelectionStyle=AK;yt.dragMovesSelection=EK;yt.clickAddsSelectionRange=TK;yt.decorations=H_;yt.blockWrappers=PK;yt.outerDecorations=XA;yt.atomicRanges=Mb;yt.bidiIsolatedRanges=BK;yt.cursorScrollMargin=Ut.define({combine:e=>{let t=5,n=5;for(let s of e)typeof s=="number"?t=n=s:{x:t,y:n}=s;return{x:t,y:n}}});yt.scrollMargins=$K;yt.darkTheme=b8;yt.cspNonce=Ut.define({combine:e=>e.length?e[0]:""});yt.contentAttributes=YA;yt.editorAttributes=OK;yt.lineWrapping=yt.contentAttributes.of({class:"cm-lineWrapping"});yt.announce=Pn.define();const k3e=4096,jO={};class o2{constructor(t,n,s,r,i,o){this.from=t,this.to=n,this.dir=s,this.isolates=r,this.fresh=i,this.order=o}static update(t,n){if(n.empty&&!t.some(i=>i.fresh))return t;let s=[],r=t.length?t[t.length-1].dir:cr.LTR;for(let i=Math.max(0,t.length-10);i<t.length;i++){let o=t[i];o.dir==r&&!n.touchesRange(o.from,o.to)&&s.push(new o2(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return s}}function LO(e,t,n){for(let s=e.state.facet(t),r=s.length-1;r>=0;r--){let i=s[r],o=typeof i=="function"?i(e):i;o&&UA(o,n)}return n}const _3e=Ht.mac?"mac":Ht.windows?"win":Ht.linux?"linux":"key";function S3e(e,t){const n=e.split(/-(?!$)/);let s=n[n.length-1];s=="Space"&&(s=" ");let r,i,o,a;for(let l=0;l<n.length-1;++l){const c=n[l];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))t=="mac"?a=!0:i=!0;else throw new Error("Unrecognized modifier name: "+c)}return r&&(s="Alt-"+s),i&&(s="Ctrl-"+s),a&&(s="Meta-"+s),o&&(s="Shift-"+s),s}function hw(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n!==!1&&t.shiftKey&&(e="Shift-"+e),e}const C3e=Bh.default(yt.domEventHandlers({keydown(e,t){return iY(rY(t.state),e,t,"editor")}})),E0=Ut.define({enables:C3e}),DO=new WeakMap;function rY(e){let t=e.facet(E0),n=DO.get(t);return n||DO.set(t,n=A3e(t.reduce((s,r)=>s.concat(r),[]))),n}function T3e(e,t,n){return iY(rY(e.state),t,e,n)}let Pd=null;const E3e=4e3;function A3e(e,t=_3e){let n=Object.create(null),s=Object.create(null),r=(o,a)=>{let l=s[o];if(l==null)s[o]=a;else if(l!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},i=(o,a,l,c,d)=>{var h,f;let p=n[o]||(n[o]=Object.create(null)),g=a.split(/ (?!$)/).map(v=>S3e(v,t));for(let v=1;v<g.length;v++){let b=g.slice(0,v).join(" ");r(b,!0),p[b]||(p[b]={preventDefault:!0,stopPropagation:!1,run:[x=>{let k=Pd={view:x,prefix:b,scope:o};return setTimeout(()=>{Pd==k&&(Pd=null)},E3e),!0}]})}let y=g.join(" ");r(y,!1);let w=p[y]||(p[y]={preventDefault:!1,stopPropagation:!1,run:((f=(h=p._any)===null||h===void 0?void 0:h.run)===null||f===void 0?void 0:f.slice())||[]});l&&w.run.push(l),c&&(w.preventDefault=!0),d&&(w.stopPropagation=!0)};for(let o of e){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let d=n[c]||(n[c]=Object.create(null));d._any||(d._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:h}=o;for(let f in d)d[f].run.push(p=>h(p,x8))}let l=o[t]||o.key;if(l)for(let c of a)i(c,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&i(c,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return n}let x8=null;function iY(e,t,n,s){x8=t;let r=H4e(t),i=Zo(r,0),o=pc(i)==r.length&&r!=" ",a="",l=!1,c=!1,d=!1;Pd&&Pd.view==n&&Pd.scope==s&&(a=Pd.prefix+" ",GK.indexOf(t.keyCode)<0&&(c=!0,Pd=null));let h=new Set,f=w=>{if(w){for(let v of w.run)if(!h.has(v)&&(h.add(v),v(n)))return w.stopPropagation&&(d=!0),!0;w.preventDefault&&(w.stopPropagation&&(d=!0),c=!0)}return!1},p=e[s],g,y;return p&&(f(p[a+hw(r,t,!o)])?l=!0:o&&(t.altKey||t.metaKey||t.ctrlKey)&&!(Ht.windows&&t.ctrlKey&&t.altKey)&&!(Ht.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(g=kh[t.keyCode])&&g!=r?(f(p[a+hw(g,t,!0)])||t.shiftKey&&(y=Ny[t.keyCode])!=r&&y!=g&&f(p[a+hw(y,t,!1)]))&&(l=!0):o&&t.shiftKey&&f(p[a+hw(r,t,!0)])&&(l=!0),!l&&f(p._any)&&(l=!0)),c&&(l=!0),l&&d&&t.stopPropagation(),x8=null,l}class qf{constructor(t,n,s,r,i){this.className=t,this.left=n,this.top=s,this.width=r,this.height=i}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,n){return n.className!=this.className?!1:(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",this.width!=null&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,n,s){if(s.empty){let r=t.coordsAtPos(s.head,s.assoc||1);if(!r)return[];let i=oY(t);return[new qf(n,r.left-i.left,r.top-i.top,null,r.bottom-r.top)]}else return M3e(t,n,s)}}function oY(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==cr.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function OO(e,t,n,s){let r=e.coordsAtPos(t,n*2);if(!r)return s;let i=e.dom.getBoundingClientRect(),o=(r.top+r.bottom)/2,a=e.posAtCoords({x:i.left+1,y:o}),l=e.posAtCoords({x:i.right-1,y:o});return a==null||l==null?s:{from:Math.max(s.from,Math.min(a,l)),to:Math.min(s.to,Math.max(a,l))}}function M3e(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let s=Math.max(n.from,e.viewport.from),r=Math.min(n.to,e.viewport.to),i=e.textDirection==cr.LTR,o=e.contentDOM,a=o.getBoundingClientRect(),l=oY(e),c=o.querySelector(".cm-line"),d=c&&window.getComputedStyle(c),h=a.left+(d?parseInt(d.paddingLeft)+Math.min(0,parseInt(d.textIndent)):0),f=a.right-(d?parseInt(d.paddingRight):0),p=p8(e,s,1),g=p8(e,r,-1),y=p.type==oo.Text?p:null,w=g.type==oo.Text?g:null;if(y&&(e.lineWrapping||p.widgetLineBreaks)&&(y=OO(e,s,1,y)),w&&(e.lineWrapping||g.widgetLineBreaks)&&(w=OO(e,r,-1,w)),y&&w&&y.from==w.from&&y.to==w.to)return b(x(n.from,n.to,y));{let T=y?x(n.from,null,y):k(p,!1),C=w?x(null,n.to,w):k(g,!0),S=[];return(y||p).to<(w||g).from-(y&&w?1:0)||p.widgetLineBreaks>1&&T.bottom+e.defaultLineHeight/2<C.top?S.push(v(h,T.bottom,f,C.top)):T.bottom<C.top&&e.elementAtHeight((T.bottom+C.top)/2).type==oo.Text&&(T.bottom=C.top=(T.bottom+C.top)/2),b(T).concat(S).concat(b(C))}function v(T,C,S,_){return new qf(t,T-l.left,C-l.top,Math.max(0,S-T),_-C)}function b({top:T,bottom:C,horizontal:S}){let _=[];for(let L=0;L<S.length;L+=2)_.push(v(S[L],T,S[L+1],C));return _}function x(T,C,S){let _=1e9,L=-1e9,M=[];function I(B,F,O,X,z){let U=e.coordsAtPos(B,B==S.to?-2:2),D=e.coordsAtPos(O,O==S.from?2:-2);!U||!D||(_=Math.min(U.top,D.top,_),L=Math.max(U.bottom,D.bottom,L),z==cr.LTR?M.push(i&&F?h:U.left,i&&X?f:D.right):M.push(!i&&X?h:D.left,!i&&F?f:U.right))}let A=T??S.from,P=C??S.to;for(let B of e.visibleRanges)if(B.to>A&&B.from<P)for(let F=Math.max(B.from,A),O=Math.min(B.to,P);;){let X=e.state.doc.lineAt(F);for(let z of e.bidiSpans(X)){let U=z.from+X.from,D=z.to+X.from;if(U>=O)break;D>F&&I(Math.max(U,F),T==null&&U<=A,Math.min(D,O),C==null&&D>=P,z.dir)}if(F=X.to+1,F>=O)break}return M.length==0&&I(A,T==null,P,C==null,e.textDirection),{top:_,bottom:L,horizontal:M}}function k(T,C){let S=a.top+(C?T.top:T.bottom);return{top:S,bottom:S,horizontal:[]}}}function N3e(e,t){return e.constructor==t.constructor&&e.eq(t)}class I3e{constructor(t,n){this.view=t,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,t)}update(t){t.startState.facet(Cx)!=t.state.facet(Cx)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq))}docViewUpdate(t){this.layer.updateOnDocViewUpdate!==!1&&t.requestMeasure(this.measureReq)}setOrder(t){let n=0,s=t.facet(Cx);for(;n<s.length&&s[n]!=this.layer;)n++;this.dom.style.zIndex=String((this.layer.above?150:-1)-n)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:t,scaleY:n}=this.view;(t!=this.scaleX||n!=this.scaleY)&&(this.scaleX=t,this.scaleY=n,this.dom.style.transform=`scale(${1/t}, ${1/n})`)}draw(t){if(t.length!=this.drawn.length||t.some((n,s)=>!N3e(n,this.drawn[s]))){let n=this.dom.firstChild,s=0;for(let r of t)r.update&&n&&r.constructor&&this.drawn[s].constructor&&r.update(n,this.drawn[s])?(n=n.nextSibling,s++):this.dom.insertBefore(r.draw(),n);for(;n;){let r=n.nextSibling;n.remove(),n=r}this.drawn=t,Ht.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Cx=Ut.define();function aY(e){return[Ir.define(t=>new I3e(t,e)),Cx.of(e)]}const A0=Ut.define({combine(e){return Vc(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(t,n)=>Math.min(t,n),drawRangeCursor:(t,n)=>t||n})}});function lY(e={}){return[A0.of(e),R3e,j3e,L3e,jK.of(!0)]}function cY(e){return e.startState.facet(A0)!=e.state.facet(A0)}const R3e=aY({above:!0,markers(e){let{state:t}=e,n=t.facet(A0),s=[];for(let r of t.selection.ranges){let i=r==t.selection.main;if(r.empty||n.drawRangeCursor&&!(i&&Ht.ios&&n.iosSelectionHandles)){let o=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=r.empty?r:Be.cursor(r.head,r.assoc);for(let l of qf.forRange(e,o,a))s.push(l)}}return s},update(e,t){e.transactions.some(s=>s.selection)&&(t.style.animationName=t.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=cY(e);return n&&PO(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){PO(t.state,e)},class:"cm-cursorLayer"});function PO(e,t){t.style.animationDuration=e.facet(A0).cursorBlinkRate+"ms"}const j3e=aY({above:!1,markers(e){let t=[],{main:n,ranges:s}=e.state.selection;for(let r of s)if(!r.empty)for(let i of qf.forRange(e,"cm-selectionBackground",r))t.push(i);if(Ht.ios&&!n.empty&&e.state.facet(A0).iosSelectionHandles){for(let r of qf.forRange(e,"cm-selectionHandle cm-selectionHandle-start",Be.cursor(n.from,1)))t.push(r);for(let r of qf.forRange(e,"cm-selectionHandle cm-selectionHandle-end",Be.cursor(n.to,1)))t.push(r)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||cY(e)},class:"cm-selectionLayer"}),L3e=Bh.highest(yt.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"}}}})),uY=Pn.define({map(e,t){return e==null?null:t.mapPos(e)}}),f1=ao.define({create(){return null},update(e,t){return e!=null&&(e=t.changes.mapPos(e)),t.effects.reduce((n,s)=>s.is(uY)?s.value:n,e)}}),D3e=Ir.fromClass(class{constructor(e){this.view=e,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(e){var t;let n=e.state.field(f1);n==null?this.cursor!=null&&((t=this.cursor)===null||t===void 0||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(e.startState.field(f1)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(f1),n=t!=null&&e.coordsAtPos(t);if(!n)return null;let s=e.scrollDOM.getBoundingClientRect();return{left:n.left-s.left+e.scrollDOM.scrollLeft*e.scaleX,top:n.top-s.top+e.scrollDOM.scrollTop*e.scaleY,height:n.bottom-n.top}}drawCursor(e){if(this.cursor){let{scaleX:t,scaleY:n}=this.view;e?(this.cursor.style.left=e.left/t+"px",this.cursor.style.top=e.top/n+"px",this.cursor.style.height=e.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(e){this.view.state.field(f1)!=e&&this.view.dispatch({effects:uY.of(e)})}},{eventObservers:{dragover(e){this.setDropPos(this.view.posAtCoords({x:e.clientX,y:e.clientY}))},dragleave(e){(e.target==this.view.contentDOM||!this.view.contentDOM.contains(e.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function O3e(){return[f1,D3e]}function BO(e,t,n,s,r){t.lastIndex=0;for(let i=e.iterRange(n,s),o=n,a;!i.next().done;o+=i.value.length)if(!i.lineBreak)for(;a=t.exec(i.value);)r(o+a.index,a)}function P3e(e,t){let n=e.visibleRanges;if(n.length==1&&n[0].from==e.viewport.from&&n[0].to==e.viewport.to)return n;let s=[];for(let{from:r,to:i}of n)r=Math.max(e.state.doc.lineAt(r).from,r-t),i=Math.min(e.state.doc.lineAt(i).to,i+t),s.length&&s[s.length-1].to>=r?s[s.length-1].to=i:s.push({from:r,to:i});return s}class B3e{constructor(t){const{regexp:n,decoration:s,decorate:r,boundary:i,maxLength:o=1e3}=t;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,r)this.addMatch=(a,l,c,d)=>r(d,c,c+a[0].length,a,l);else if(typeof s=="function")this.addMatch=(a,l,c,d)=>{let h=s(a,l,c);h&&d(c,c+a[0].length,h)};else if(s)this.addMatch=(a,l,c,d)=>d(c,c+a[0].length,s);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=o}createDeco(t){let n=new Rc,s=n.add.bind(n);for(let{from:r,to:i}of P3e(t,this.maxLength))BO(t.state.doc,this.regexp,r,i,(o,a)=>this.addMatch(a,t,o,s));return n.finish()}updateDeco(t,n){let s=1e9,r=-1;return t.docChanged&&t.changes.iterChanges((i,o,a,l)=>{l>=t.view.viewport.from&&a<=t.view.viewport.to&&(s=Math.min(a,s),r=Math.max(l,r))}),t.viewportMoved||r-s>1e3?this.createDeco(t.view):r>-1?this.updateRange(t.view,n.map(t.changes),s,r):n}updateRange(t,n,s,r){for(let i of t.visibleRanges){let o=Math.max(i.from,s),a=Math.min(i.to,r);if(a>=o){let l=t.state.doc.lineAt(o),c=l.to<a?t.state.doc.lineAt(a):l,d=Math.max(i.from,l.from),h=Math.min(i.to,c.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){d=o;break}for(;a<c.to;a++)if(this.boundary.test(c.text[a-c.from])){h=a;break}}let f=[],p,g=(y,w,v)=>f.push(v.range(y,w));if(l==c)for(this.regexp.lastIndex=d-l.from;(p=this.regexp.exec(l.text))&&p.index<h-l.from;)this.addMatch(p,t,p.index+l.from,g);else BO(t.state.doc,this.regexp,d,h,(y,w)=>this.addMatch(w,t,y,g));n=n.update({filterFrom:d,filterTo:h,filter:(y,w)=>y<d||w>h,add:f})}}return n}}const k8=/x/.unicode!=null?"gu":"g",$3e=new RegExp(`[\0-\b
--­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF￹-￼]`,k8),z3e={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 S5=null;function F3e(){var e;if(S5==null&&typeof document<"u"&&document.body){let t=document.body.style;S5=((e=t.tabSize)!==null&&e!==void 0?e:t.MozTabSize)!=null}return S5||!1}const Tx=Ut.define({combine(e){let t=Vc(e,{render:null,specialChars:$3e,addSpecialChars:null});return(t.replaceTabs=!F3e())&&(t.specialChars=new RegExp("	|"+t.specialChars.source,k8)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,k8)),t}});function dY(e={}){return[Tx.of(e),q3e()]}let $O=null;function q3e(){return $O||($O=Ir.fromClass(class{constructor(e){this.view=e,this.decorations=sn.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(Tx)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new B3e({regexp:e.specialChars,decoration:(t,n,s)=>{let{doc:r}=n.state,i=Zo(t[0],0);if(i==9){let o=r.lineAt(s),a=n.state.tabSize,l=ng(o.text,a,s-o.from);return sn.replace({widget:new W3e((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=sn.replace({widget:new V3e(e,i)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(Tx);e.startState.facet(Tx)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(e.view)):this.decorations=this.decorator.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}))}const H3e="•";function U3e(e){return e>=32?H3e:e==10?"␤":String.fromCharCode(9216+e)}class V3e extends Fa{constructor(t,n){super(),this.options=t,this.code=n}eq(t){return t.code==this.code}toDOM(t){let n=U3e(this.code),s=t.state.phrase("Control character")+" "+(z3e[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,s,n);if(r)return r;let i=document.createElement("span");return i.textContent=n,i.title=s,i.setAttribute("aria-label",s),i.className="cm-specialChar",i}ignoreEvent(){return!1}}class W3e extends Fa{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent="	",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}function G3e(){return Y3e}const K3e=sn.line({class:"cm-activeLine"}),Y3e=Ir.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,n=[];for(let s of e.state.selection.ranges){let r=e.lineBlockAt(s.head);r.from>t&&(n.push(K3e.range(r.from)),t=r.from)}return sn.set(n)}},{decorations:e=>e.decorations});class X3e extends Fa{constructor(t){super(),this.content=t}toDOM(t){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(t):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(t){let n=t.firstChild?Q1(t.firstChild):[];if(!n.length)return null;let s=window.getComputedStyle(t.parentNode),r=jy(n[0],s.direction!="rtl"),i=parseInt(s.lineHeight);return r.bottom-r.top>i*1.5?{left:r.left,right:r.right,top:r.top,bottom:r.top+i}:r}ignoreEvent(){return!1}}function zO(e){let t=Ir.fromClass(class{constructor(n){this.view=n,this.placeholder=e?sn.set([sn.widget({widget:new X3e(e),side:1}).range(0)]):sn.none}get decorations(){return this.view.state.doc.length?sn.none:this.placeholder}},{decorations:n=>n.decorations});return typeof e=="string"?[t,yt.contentAttributes.of({"aria-placeholder":e})]:t}const _8=2e3;function Q3e(e,t,n){let s=Math.min(t.line,n.line),r=Math.max(t.line,n.line),i=[];if(t.off>_8||n.off>_8||t.col<0||n.col<0){let o=Math.min(t.off,n.off),a=Math.max(t.off,n.off);for(let l=s;l<=r;l++){let c=e.doc.line(l);c.length<=a&&i.push(Be.range(c.from+o,c.to+a))}}else{let o=Math.min(t.col,n.col),a=Math.max(t.col,n.col);for(let l=s;l<=r;l++){let c=e.doc.line(l),d=n8(c.text,o,e.tabSize,!0);if(d<0)i.push(Be.cursor(c.to));else{let h=n8(c.text,a,e.tabSize);i.push(Be.range(c.from+d,c.from+h))}}}return i}function J3e(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}function FO(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1),s=e.state.doc.lineAt(n),r=n-s.from,i=r>_8?-1:r==s.length?J3e(e,t.clientX):ng(s.text,e.state.tabSize,n-s.from);return{line:s.number,col:i,off:r}}function Z3e(e,t){let n=FO(e,t),s=e.state.selection;return n?{update(r){if(r.docChanged){let i=r.changes.mapPos(r.startState.doc.line(n.line).from),o=r.state.doc.lineAt(i);n={line:o.number,col:n.col,off:Math.min(n.off,o.length)},s=s.map(r.changes)}},get(r,i,o){let a=FO(e,r);if(!a)return s;let l=Q3e(e.state,n,a);return l.length?o?Be.create(l.concat(s.ranges)):Be.create(l):s}}:null}function e5e(e){let t=n=>n.altKey&&n.button==0;return yt.mouseSelectionStyle.of((n,s)=>t(s)?Z3e(n,s):null)}const t5e={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},n5e={style:"cursor: crosshair"};function s5e(e={}){let[t,n]=t5e[e.key||"Alt"],s=Ir.fromClass(class{constructor(r){this.view=r,this.isDown=!1}set(r){this.isDown!=r&&(this.isDown=r,this.view.update([]))}},{eventObservers:{keydown(r){this.set(r.keyCode==t||n(r))},keyup(r){(r.keyCode==t||!n(r))&&this.set(!1)},mousemove(r){this.set(n(r))}}});return[s,yt.contentAttributes.of(r=>{var i;return!((i=r.plugin(s))===null||i===void 0)&&i.isDown?n5e:null})]}const fw="-10000px";class hY{constructor(t,n,s,r){this.facet=n,this.createTooltipView=s,this.removeTooltipView=r,this.input=t.state.facet(n),this.tooltips=this.input.filter(o=>o);let i=null;this.tooltipViews=this.tooltips.map(o=>i=s(o,i))}update(t,n){var s;let r=t.state.facet(this.facet),i=r.filter(l=>l);if(r===this.input){for(let l of this.tooltipViews)l.update&&l.update(t);return!1}let o=[],a=n?[]:null;for(let l=0;l<i.length;l++){let c=i[l],d=-1;if(c){for(let h=0;h<this.tooltips.length;h++){let f=this.tooltips[h];f&&f.create==c.create&&(d=h)}if(d<0)o[l]=this.createTooltipView(c,l?o[l-1]:null),a&&(a[l]=!!c.above);else{let h=o[l]=this.tooltipViews[d];a&&(a[l]=n[d]),h.update&&h.update(t)}}}for(let l of this.tooltipViews)o.indexOf(l)<0&&(this.removeTooltipView(l),(s=l.destroy)===null||s===void 0||s.call(l));return n&&(a.forEach((l,c)=>n[c]=l),n.length=a.length),this.input=r,this.tooltips=i,this.tooltipViews=o,!0}}function r5e(e={}){return Ex.of(e)}function i5e(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const Ex=Ut.define({combine:e=>{var t,n,s;return{position:Ht.ios?"absolute":((t=e.find(r=>r.position))===null||t===void 0?void 0:t.position)||"fixed",parent:((n=e.find(r=>r.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((s=e.find(r=>r.tooltipSpace))===null||s===void 0?void 0:s.tooltipSpace)||i5e}}}),qO=new WeakMap,t9=Ir.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(Ex);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new hY(e,n9,(n,s)=>this.createTooltip(n,s),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,s=e.state.facet(Ex);if(s.position!=this.position&&!this.madeAbsolute){this.position=s.position;for(let r of this.manager.tooltipViews)r.dom.style.position=this.position;n=!0}if(s.parent!=this.parent){this.parent&&this.container.remove(),this.parent=s.parent,this.createContainer();for(let r of this.manager.tooltipViews)this.container.appendChild(r.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),s=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let r=document.createElement("div");r.className="cm-tooltip-arrow",n.dom.appendChild(r)}return n.dom.style.position=this.position,n.dom.style.top=fw,n.dom.style.left="0px",this.container.insertBefore(n.dom,s),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let s of this.manager.tooltipViews)s.dom.remove(),(e=s.destroy)===null||e===void 0||e.call(s);this.parent&&this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:i}=this.manager.tooltipViews[0];if(Ht.safari){let o=i.getBoundingClientRect();n=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else n=!!i.offsetParent&&i.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(e=i.width/this.parent.offsetWidth,t=i.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);let s=this.view.scrollDOM.getBoundingClientRect(),r=QA(this.view);return{visible:{left:s.left+r.left,top:s.top+r.top,right:s.right-r.right,bottom:s.bottom-r.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((i,o)=>{let a=this.manager.tooltipViews[o];return a.getCoords?a.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(Ex).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{visible:n,space:s,scaleX:r,scaleY:i}=e,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:d}=c,h=e.pos[a],f=e.size[a];if(!h||l.clip!==!1&&(h.bottom<=Math.max(n.top,s.top)||h.top>=Math.min(n.bottom,s.bottom)||h.right<Math.max(n.left,s.left)-.1||h.left>Math.min(n.right,s.right)+.1)){d.style.top=fw;continue}let p=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,g=p?7:0,y=f.right-f.left,w=(t=qO.get(c))!==null&&t!==void 0?t:f.bottom-f.top,v=c.offset||a5e,b=this.view.textDirection==cr.LTR,x=f.width>s.right-s.left?b?s.left:s.right-f.width:b?Math.max(s.left,Math.min(h.left-(p?14:0)+v.x,s.right-y)):Math.min(Math.max(s.left,h.left-y+(p?14:0)-v.x),s.right-y),k=this.above[a];!l.strictSide&&(k?h.top-w-g-v.y<s.top:h.bottom+w+g+v.y>s.bottom)&&k==s.bottom-h.bottom>h.top-s.top&&(k=this.above[a]=!k);let T=(k?h.top-s.top:s.bottom-h.bottom)-g;if(T<w&&c.resize!==!1){if(T<this.view.defaultLineHeight){d.style.top=fw;continue}qO.set(c,w),d.style.height=(w=T)/i+"px"}else d.style.height&&(d.style.height="");let C=k?h.top-w-g-v.y:h.bottom+g+v.y,S=x+y;if(c.overlap!==!0)for(let _ of o)_.left<S&&_.right>x&&_.top<C+w&&_.bottom>C&&(C=k?_.top-w-2-g:_.bottom+g+2);if(this.position=="absolute"?(d.style.top=(C-e.parent.top)/i+"px",HO(d,(x-e.parent.left)/r)):(d.style.top=C/i+"px",HO(d,x/r)),p){let _=h.left+(b?v.x:-v.x)-(x+14-7);p.style.left=_/r+"px"}c.overlap!==!0&&o.push({left:x,top:C,right:S,bottom:C+w}),d.classList.toggle("cm-tooltip-above",k),d.classList.toggle("cm-tooltip-below",!k),c.positioned&&c.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=fw}},{eventObservers:{scroll(){this.maybeMeasure()}}});function HO(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const o5e=yt.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"}}}),a5e={x:0,y:0},n9=Ut.define({enables:[t9,o5e]}),a2=Ut.define({combine:e=>e.reduce((t,n)=>t.concat(n),[])});class G_{static create(t){return new G_(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new hY(t,a2,(n,s)=>this.createHostedView(n,s),n=>n.dom.remove())}createHostedView(t,n){let s=t.create(this.view);return s.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(s.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&s.mount&&s.mount(this.view),s}mount(t){for(let n of this.manager.tooltipViews)n.mount&&n.mount(t);this.mounted=!0}positioned(t){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(t)}update(t){this.manager.update(t)}destroy(){var t;for(let n of this.manager.tooltipViews)(t=n.destroy)===null||t===void 0||t.call(n)}passProp(t){let n;for(let s of this.manager.tooltipViews){let r=s[t];if(r!==void 0){if(n===void 0)n=r;else if(n!==r)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const l5e=n9.compute([a2],e=>{let t=e.facet(a2);return t.length===0?null:{pos:Math.min(...t.map(n=>n.pos)),end:Math.max(...t.map(n=>{var s;return(s=n.end)!==null&&s!==void 0?s:n.pos})),create:G_.create,above:t[0].above,arrow:t.some(n=>n.arrow)}}),fY=Ut.define();class c5e{constructor(t,n,s,r,i,o){this.view=t,this.source=n,this.field=s,this.locked=r,this.setHover=i,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(t){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let t=Date.now()-this.lastMove.time;t<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-t):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:t,lastMove:n}=this,s=t.docView.tile.nearest(n.target);if(!s)return;let r,i=1;if(s.isWidget())r=s.posAtStart;else{if(r=t.posAtCoords(n),r==null)return;let o=t.coordsAtPos(r);if(!o||n.y<o.top||n.y>o.bottom||n.x<o.left-t.defaultCharacterWidth||n.x>o.right+t.defaultCharacterWidth)return;let a=t.bidiSpans(t.state.doc.lineAt(r)).find(c=>c.from<=r&&c.to>=r),l=a&&a.dir==cr.RTL?-1:1;i=n.x<o.left?-l:l}this.activateHover(t,r,i)}activateHover(t,n,s,r){let i=this.source(t,n,s),o=a=>{if(a&&!(Array.isArray(a)&&!a.length)){let l=Array.isArray(a)?a:[a];r&&this.locked.set(l,r),t.dispatch({effects:this.setHover.of(l)})}};if(i&&"then"in i){let a=this.pending={pos:n};i.then(l=>{this.pending==a&&(this.pending=null,o(l))},l=>ta(t.state,l,"hover tooltip"))}else o(i)}get tooltip(){let t=this.view.plugin(t9),n=t?t.manager.tooltips.findIndex(s=>s.create==G_.create):-1;return n>-1?t.manager.tooltipViews[n]:null}mousemove(t){var n,s;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:r,tooltip:i}=this;if(r.length&&!this.locked.has(r)&&i&&!u5e(i.dom,t)||this.pending){let{pos:o}=r[0]||this.pending,a=(s=(n=r[0])===null||n===void 0?void 0:n.end)!==null&&s!==void 0?s:o;(o==a?this.view.posAtCoords(this.lastMove)!=o:!d5e(this.view,o,a,t.clientX,t.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length&&!this.locked.has(n)){let{tooltip:s}=this;s&&s.dom.contains(t.relatedTarget)?this.watchTooltipLeave(s.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(t){let n=s=>{t.removeEventListener("mouseleave",n);let{active:r}=this;r.length&&!this.locked.has(r)&&!this.view.dom.contains(s.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};t.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const mw=4;function u5e(e,t){let{left:n,right:s,top:r,bottom:i}=e.getBoundingClientRect(),o;if(o=e.querySelector(".cm-tooltip-arrow")){let a=o.getBoundingClientRect();r=Math.min(a.top,r),i=Math.max(a.bottom,i)}return t.clientX>=n-mw&&t.clientX<=s+mw&&t.clientY>=r-mw&&t.clientY<=i+mw}function d5e(e,t,n,s,r,i){let o=e.scrollDOM.getBoundingClientRect(),a=e.documentTop+e.documentPadding.top+e.contentHeight;if(o.left>s||o.right<s||o.top>r||Math.min(o.bottom,a)<r)return!1;let l=e.posAtCoords({x:s,y:r},!1);return l>=t&&l<=n}function h5e(e,t={}){let n=Pn.define(),s=new WeakMap,r=ao.define({create(){return[]},update(o,a){let l=s.get(o);if(o.length&&(t.hideOnChange&&(a.docChanged||a.selection)?o=[]:l&&l(a)?o=[]:t.hideOn&&(o=o.filter(c=>!t.hideOn(a,c)))),a.docChanged&&o.length){let c=[];for(let d of o){let h=a.changes.mapPos(d.pos,-1,Lo.TrackDel);if(h!=null){let f=Object.assign(Object.create(null),d);f.pos=h,f.end!=null&&(f.end=a.changes.mapPos(f.end)),c.push(f)}}o=c}for(let c of a.effects)c.is(n)&&(o=c.value,l=void 0),(c.is(m5e)&&!c.value||c.value==r)&&(o=[]);return o.length&&l&&s.set(o,l),o},provide:o=>a2.from(o)});const i=Ir.define(o=>new c5e(o,e,r,s,n,t.hoverTime||300));return{active:r,extension:[r,i,fY.of(i),l5e]}}function f5e(e,t,n,s={}){var r;let i=e.state.facet(fY).map(o=>e.plugin(o)).filter(o=>!!o);if(s.tooltip&&s.tooltip.active){let o=i.find(a=>a.field==s.tooltip.active);o&&(i=[o])}for(let o of i)o.activateHover(e,t,n,(r=s.until)!==null&&r!==void 0?r:()=>!1)}function mY(e,t){let n=e.plugin(t9);if(!n)return null;let s=n.manager.tooltips.indexOf(t);return s<0?null:n.manager.tooltipViews[s]}const m5e=Pn.define(),UO=Ut.define({combine(e){let t,n;for(let s of e)t=t||s.topContainer,n=n||s.bottomContainer;return{topContainer:t,bottomContainer:n}}});function s9(e,t){let n=e.plugin(pY),s=n?n.specs.indexOf(t):-1;return s>-1?n.panels[s]:null}const pY=Ir.fromClass(class{constructor(e){this.input=e.state.facet(Dy),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(e));let t=e.state.facet(UO);this.top=new pw(e,!0,t.topContainer),this.bottom=new pw(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(e){let t=e.state.facet(UO);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new pw(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new pw(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(Dy);if(n!=this.input){let s=n.filter(l=>l),r=[],i=[],o=[],a=[];for(let l of s){let c=this.specs.indexOf(l),d;c<0?(d=l(e.view),a.push(d)):(d=this.panels[c],d.update&&d.update(e)),r.push(d),(d.top?i:o).push(d)}this.specs=s,this.panels=r,this.top.sync(i),this.bottom.sync(o);for(let l of a)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let s of this.panels)s.update&&s.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>yt.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class pw{constructor(t,n,s){this.view=t,this.top=n,this.container=s,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(t){for(let n of this.panels)n.destroy&&t.indexOf(n)<0&&n.destroy();this.panels=t,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let t=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;t!=n.dom;)t=VO(t);t=t.nextSibling}else this.dom.insertBefore(n.dom,t);for(;t;)t=VO(t)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let t of this.classes.split(" "))t&&this.container.classList.remove(t);for(let t of(this.classes=this.view.themeClasses).split(" "))t&&this.container.classList.add(t)}}}function VO(e){let t=e.nextSibling;return e.remove(),t}const Dy=Ut.define({enables:pY});function p5e(e,t){let n,s=new Promise(o=>n=o),r=o=>g5e(o,t,n);e.state.field(C5,!1)?e.dispatch({effects:gY.of(r)}):e.dispatch({effects:Pn.appendConfig.of(C5.init(()=>[r]))});let i=yY.of(r);return{close:i,result:s.then(o=>((e.win.queueMicrotask||(l=>e.win.setTimeout(l,10)))(()=>{e.state.field(C5).indexOf(r)>-1&&e.dispatch({effects:i})}),o))}}const C5=ao.define({create(){return[]},update(e,t){for(let n of t.effects)n.is(gY)?e=[n.value].concat(e):n.is(yY)&&(e=e.filter(s=>s!=n.value));return e},provide:e=>Dy.computeN([e],t=>t.field(e))}),gY=Pn.define(),yY=Pn.define();function g5e(e,t,n){let s=t.content?t.content(e,()=>o(null)):null;if(!s){if(s=tr("form"),t.input){let a=tr("input",t.input);/^(text|password|number|email|tel|url)$/.test(a.type)&&a.classList.add("cm-textfield"),a.name||(a.name="input"),s.appendChild(tr("label",(t.label||"")+": ",a))}else s.appendChild(document.createTextNode(t.label||""));s.appendChild(document.createTextNode(" ")),s.appendChild(tr("button",{class:"cm-button",type:"submit"},t.submitLabel||"OK"))}let r=s.nodeName=="FORM"?[s]:s.querySelectorAll("form");for(let a=0;a<r.length;a++){let l=r[a];l.addEventListener("keydown",c=>{c.keyCode==27?(c.preventDefault(),o(null)):c.keyCode==13&&(c.preventDefault(),o(l))}),l.addEventListener("submit",c=>{c.preventDefault(),o(l)})}let i=tr("div",s,tr("button",{onclick:()=>o(null),"aria-label":e.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));t.class&&(i.className=t.class),i.classList.add("cm-dialog");function o(a){i.contains(i.ownerDocument.activeElement)&&e.focus(),n(a)}return{dom:i,top:t.top,mount:()=>{if(t.focus){let a;typeof t.focus=="string"?a=s.querySelector(t.focus):a=s.querySelector("input")||s.querySelector("button"),a&&"select"in a?a.select():a&&"focus"in a&&a.focus()}}}}class Uu extends wh{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Uu.prototype.elementClass="";Uu.prototype.toDOM=void 0;Uu.prototype.mapMode=Lo.TrackBefore;Uu.prototype.startSide=Uu.prototype.endSide=-1;Uu.prototype.point=!0;const Ax=Ut.define(),y5e=Ut.define(),b5e={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>ms.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},ey=Ut.define();function v5e(e){return[bY(),ey.of({...b5e,...e})]}const WO=Ut.define({combine:e=>e.some(t=>t)});function bY(e){return[w5e]}const w5e=Ir.fromClass(class{constructor(e){this.view=e,this.domAfter=null,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(ey).map(t=>new KO(e,t)),this.fixed=!e.state.facet(WO);for(let t of this.gutters)t.config.side=="after"?this.getDOMAfter().appendChild(t.dom):this.dom.appendChild(t.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,s=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(s<(n.to-n.from)*.8)}if(e.geometryChanged){let t=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=t,this.domAfter&&(this.domAfter.style.minHeight=t)}this.view.state.facet(WO)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=ms.iter(this.view.state.facet(Ax),this.view.viewport.from),s=[],r=this.gutters.map(i=>new x5e(i,this.view.viewport,-this.view.documentPadding.top));for(let i of this.view.viewportLineBlocks)if(s.length&&(s=[]),Array.isArray(i.type)){let o=!0;for(let a of i.type)if(a.type==oo.Text&&o){S8(n,s,a.from);for(let l of r)l.line(this.view,a,s);o=!1}else if(a.widget)for(let l of r)l.widget(this.view,a)}else if(i.type==oo.Text){S8(n,s,i.from);for(let o of r)o.line(this.view,i,s)}else if(i.widget)for(let o of r)o.widget(this.view,i);for(let i of r)i.finish();e&&(this.view.scrollDOM.insertBefore(this.dom,t),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(e){let t=e.startState.facet(ey),n=e.state.facet(ey),s=e.docChanged||e.heightChanged||e.viewportChanged||!ms.eq(e.startState.facet(Ax),e.state.facet(Ax),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let r of this.gutters)r.update(e)&&(s=!0);else{s=!0;let r=[];for(let i of n){let o=t.indexOf(i);o<0?r.push(new KO(this.view,i)):(this.gutters[o].update(e),r.push(this.gutters[o]))}for(let i of this.gutters)i.dom.remove(),r.indexOf(i)<0&&i.destroy();for(let i of r)i.config.side=="after"?this.getDOMAfter().appendChild(i.dom):this.dom.appendChild(i.dom);this.gutters=r}return s}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>yt.scrollMargins.of(t=>{let n=t.plugin(e);if(!n||n.gutters.length==0||!n.fixed)return null;let s=n.dom.offsetWidth*t.scaleX,r=n.domAfter?n.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==cr.LTR?{left:s,right:r}:{right:s,left:r}})});function GO(e){return Array.isArray(e)?e:[e]}function S8(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class x5e{constructor(t,n,s){this.gutter=t,this.height=s,this.i=0,this.cursor=ms.iter(t.markers,n.from)}addElement(t,n,s){let{gutter:r}=this,i=(n.top-this.height)/t.scaleY,o=n.height/t.scaleY;if(this.i==r.elements.length){let a=new vY(t,o,i,s);r.elements.push(a),r.dom.appendChild(a.dom)}else r.elements[this.i].update(t,o,i,s);this.height=n.bottom,this.i++}line(t,n,s){let r=[];S8(this.cursor,r,n.from),s.length&&(r=r.concat(s));let i=this.gutter.config.lineMarker(t,n,r);i&&r.unshift(i);let o=this.gutter;r.length==0&&!o.config.renderEmptyElements||this.addElement(t,n,r)}widget(t,n){let s=this.gutter.config.widgetMarker(t,n.widget,n),r=s?[s]:null;for(let i of t.state.facet(y5e)){let o=i(t,n.widget,n);o&&(r||(r=[])).push(o)}r&&this.addElement(t,n,r)}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let n=t.elements.pop();t.dom.removeChild(n.dom),n.destroy()}}}class KO{constructor(t,n){this.view=t,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let s in n.domEventHandlers)this.dom.addEventListener(s,r=>{let i=r.target,o;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let l=i.getBoundingClientRect();o=(l.top+l.bottom)/2}else o=r.clientY;let a=t.lineBlockAtHeight(o-t.documentTop);n.domEventHandlers[s](t,a,r)&&r.preventDefault()});this.markers=GO(n.markers(t)),n.initialSpacer&&(this.spacer=new vY(t,0,0,[n.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(t){let n=this.markers;if(this.markers=GO(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let r=this.config.updateSpacer(this.spacer.markers[0],t);r!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[r])}let s=t.view.viewport;return!ms.eq(this.markers,n,s.from,s.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(t):!1)}destroy(){for(let t of this.elements)t.destroy()}}class vY{constructor(t,n,s,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,n,s,r)}update(t,n,s,r){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=s&&(this.dom.style.marginTop=(this.above=s)?s+"px":""),k5e(this.markers,r)||this.setMarkers(t,r)}setMarkers(t,n){let s="cm-gutterElement",r=this.dom.firstChild;for(let i=0,o=0;;){let a=o,l=i<n.length?n[i++]:null,c=!1;if(l){let d=l.elementClass;d&&(s+=" "+d);for(let h=o;h<this.markers.length;h++)if(this.markers[h].compare(l)){a=h,c=!0;break}}else a=this.markers.length;for(;o<a;){let d=this.markers[o++];if(d.toDOM){d.destroy(r);let h=r.nextSibling;r.remove(),r=h}}if(!l)break;l.toDOM&&(c?r=r.nextSibling:this.dom.insertBefore(l.toDOM(t),r)),c&&o++}this.dom.className=s,this.markers=n}destroy(){this.setMarkers(null,[])}}function k5e(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].compare(t[n]))return!1;return!0}const _5e=Ut.define(),S5e=Ut.define(),Rp=Ut.define({combine(e){return Vc(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(t,n){let s=Object.assign({},t);for(let r in n){let i=s[r],o=n[r];s[r]=i?(a,l,c)=>i(a,l,c)||o(a,l,c):o}return s}})}});class T5 extends Uu{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function E5(e,t){return e.state.facet(Rp).formatNumber(t,e.state)}const C5e=ey.compute([Rp],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(t){return t.state.facet(_5e)},lineMarker(t,n,s){return s.some(r=>r.toDOM)?null:new T5(E5(t,t.state.doc.lineAt(n.from).number))},widgetMarker:(t,n,s)=>{for(let r of t.state.facet(S5e)){let i=r(t,n,s);if(i)return i}return null},lineMarkerChange:t=>t.startState.facet(Rp)!=t.state.facet(Rp),initialSpacer(t){return new T5(E5(t,YO(t.state.doc.lines)))},updateSpacer(t,n){let s=E5(n.view,YO(n.view.state.doc.lines));return s==t.number?t:new T5(s)},domEventHandlers:e.facet(Rp).domEventHandlers,side:"before"}));function T5e(e={}){return[Rp.of(e),bY(),C5e]}function YO(e){let t=9;for(;t<e;)t=t*10+9;return t}const E5e=new class extends Uu{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},A5e=Ax.compute(["selection"],e=>{let t=[],n=-1;for(let s of e.selection.ranges){let r=e.doc.lineAt(s.head).from;r>n&&(n=r,t.push(E5e.range(r)))}return ms.of(t)});function M5e(){return A5e}const N5e=1024;let I5e=0;class A5{constructor(t,n){this.from=t,this.to=n}}class _s{constructor(t={}){this.id=I5e++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=t.combine||null}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof t!="function"&&(t=kl.match(t)),n=>{let s=t(n);return s===void 0?null:[this,s]}}}_s.closedBy=new _s({deserialize:e=>e.split(" ")});_s.openedBy=new _s({deserialize:e=>e.split(" ")});_s.group=new _s({deserialize:e=>e.split(" ")});_s.isolate=new _s({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});_s.contextHash=new _s({perNode:!0});_s.lookAhead=new _s({perNode:!0});_s.mounted=new _s({perNode:!0});class ty{constructor(t,n,s,r=!1){this.tree=t,this.overlay=n,this.parser=s,this.bracketed=r}static get(t){return t&&t.props&&t.props[_s.mounted.id]}}const R5e=Object.create(null);class kl{constructor(t,n,s,r=0){this.name=t,this.props=n,this.id=s,this.flags=r}static define(t){let n=t.props&&t.props.length?Object.create(null):R5e,s=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),r=new kl(t.name||"",n,t.id,s);if(t.props){for(let i of t.props)if(Array.isArray(i)||(i=i(r)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[i[0].id]=i[1]}}return r}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let n=this.prop(_s.group);return n?n.indexOf(t)>-1:!1}return this.id==t}static match(t){let n=Object.create(null);for(let s in t)for(let r of s.split(" "))n[r]=t[s];return s=>{for(let r=s.prop(_s.group),i=-1;i<(r?r.length:0);i++){let o=n[i<0?s.name:r[i]];if(o)return o}}}}kl.none=new kl("",Object.create(null),0,8);const gw=new WeakMap,XO=new WeakMap;var Jr;(function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays",e[e.EnterBracketed=16]="EnterBracketed"})(Jr||(Jr={}));class ro{constructor(t,n,s,r,i){if(this.type=t,this.children=n,this.positions=s,this.length=r,this.props=null,i&&i.length){this.props=Object.create(null);for(let[o,a]of i)this.props[typeof o=="number"?o:o.id]=a}}toString(){let t=ty.get(this);if(t&&!t.overlay)return t.tree.toString();let n="";for(let s of this.children){let r=s.toString();r&&(n&&(n+=","),n+=r)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(t=0){return new T8(this.topNode,t)}cursorAt(t,n=0,s=0){let r=gw.get(this)||this.topNode,i=new T8(r);return i.moveTo(t,n),gw.set(this,i._tree),i}get topNode(){return new Ch(this,0,0,null)}resolve(t,n=0){let s=Oy(gw.get(this)||this.topNode,t,n,!1);return gw.set(this,s),s}resolveInner(t,n=0){let s=Oy(XO.get(this)||this.topNode,t,n,!0);return XO.set(this,s),s}resolveStack(t,n=0){return D5e(this,t,n)}iterate(t){let{enter:n,leave:s,from:r=0,to:i=this.length}=t,o=t.mode||0,a=(o&Jr.IncludeAnonymous)>0;for(let l=this.cursor(o|Jr.IncludeAnonymous);;){let c=!1;if(l.from<=i&&l.to>=r&&(!a&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&s&&(a||!l.type.isAnonymous)&&s(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let n in this.props)t.push([+n,this.props[n]]);return t}balance(t={}){return this.children.length<=8?this:o9(kl.none,this.children,this.positions,0,this.children.length,0,this.length,(n,s,r)=>new ro(this.type,n,s,r,this.propValues),t.makeTree||((n,s,r)=>new ro(kl.none,n,s,r)))}static build(t){return O5e(t)}}ro.empty=new ro(kl.none,[],[],0);class r9{constructor(t,n){this.buffer=t,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new r9(this.buffer,this.index)}}class Sh{constructor(t,n,s){this.buffer=t,this.length=n,this.set=s}get type(){return kl.none}toString(){let t=[];for(let n=0;n<this.buffer.length;)t.push(this.childString(n)),n=this.buffer[n+3];return t.join(",")}childString(t){let n=this.buffer[t],s=this.buffer[t+3],r=this.set.types[n],i=r.name;if(/\W/.test(i)&&!r.isError&&(i=JSON.stringify(i)),t+=4,s==t)return i;let o=[];for(;t<s;)o.push(this.childString(t)),t=this.buffer[t+3];return i+"("+o.join(",")+")"}findChild(t,n,s,r,i){let{buffer:o}=this,a=-1;for(let l=t;l!=n&&!(wY(i,r,o[l+1],o[l+2])&&(a=l,s>0));l=o[l+3]);return a}slice(t,n,s){let r=this.buffer,i=new Uint16Array(n-t),o=0;for(let a=t,l=0;a<n;){i[l++]=r[a++],i[l++]=r[a++]-s;let c=i[l++]=r[a++]-s;i[l++]=r[a++]-t,o=Math.max(o,c)}return new Sh(i,o,this.set)}}function wY(e,t,n,s){switch(e){case-2:return n<t;case-1:return s>=t&&n<t;case 0:return n<t&&s>t;case 1:return n<=t&&s>t;case 2:return s>t;case 4:return!0}}function Oy(e,t,n,s){for(var r;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let o=!s&&e instanceof Ch&&e.index<0?null:e.parent;if(!o)return e;e=o}let i=s?0:Jr.IgnoreOverlays;if(s)for(let o=e,a=o.parent;a;o=a,a=o.parent)o instanceof Ch&&o.index<0&&((r=a.enter(t,n,i))===null||r===void 0?void 0:r.from)!=o.from&&(e=a);for(;;){let o=e.enter(t,n,i);if(!o)return e;e=o}}class xY{cursor(t=0){return new T8(this,t)}getChild(t,n=null,s=null){let r=QO(this,t,n,s);return r.length?r[0]:null}getChildren(t,n=null,s=null){return QO(this,t,n,s)}resolve(t,n=0){return Oy(this,t,n,!1)}resolveInner(t,n=0){return Oy(this,t,n,!0)}matchContext(t){return C8(this.parent,t)}enterUnfinishedNodesBefore(t){let n=this.childBefore(t),s=this;for(;n;){let r=n.lastChild;if(!r||r.to!=n.to)break;r.type.isError&&r.from==r.to?(s=n,n=r.prevSibling):n=r}return s}get node(){return this}get next(){return this.parent}}let Ch=class Mx extends xY{constructor(t,n,s,r){super(),this._tree=t,this.from=n,this.index=s,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,n,s,r,i=0){for(let o=this;;){for(let{children:a,positions:l}=o._tree,c=n>0?a.length:-1;t!=c;t+=n){let d=a[t],h=l[t]+o.from,f;if(!(!(i&Jr.EnterBracketed&&d instanceof ro&&(f=ty.get(d))&&!f.overlay&&f.bracketed&&s>=h&&s<=h+d.length)&&!wY(r,s,h,h+d.length))){if(d instanceof Sh){if(i&Jr.ExcludeBuffers)continue;let p=d.findChild(0,d.buffer.length,n,s-h,r);if(p>-1)return new Kd(new j5e(o,d,t,h),null,p)}else if(i&Jr.IncludeAnonymous||!d.type.isAnonymous||i9(d)){let p;if(!(i&Jr.IgnoreMounts)&&(p=ty.get(d))&&!p.overlay)return new Mx(p.tree,h,t,o);let g=new Mx(d,h,t,o);return i&Jr.IncludeAnonymous||!g.type.isAnonymous?g:g.nextChild(n<0?d.children.length-1:0,n,s,r,i)}}}if(i&Jr.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?t=o.index+n:t=n<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}prop(t){return this._tree.prop(t)}enter(t,n,s=0){let r;if(!(s&Jr.IgnoreOverlays)&&(r=ty.get(this._tree))&&r.overlay){let i=t-this.from,o=s&Jr.EnterBracketed&&r.bracketed;for(let{from:a,to:l}of r.overlay)if((n>0||o?a<=i:a<i)&&(n<0||o?l>=i:l>i))return new Mx(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,n,s)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function QO(e,t,n,s){let r=e.cursor(),i=[];if(!r.firstChild())return i;if(n!=null){for(let o=!1;!o;)if(o=r.type.is(n),!r.nextSibling())return i}for(;;){if(s!=null&&r.type.is(s))return i;if(r.type.is(t)&&i.push(r.node),!r.nextSibling())return s==null?i:[]}}function C8(e,t,n=t.length-1){for(let s=e;n>=0;s=s.parent){if(!s)return!1;if(!s.type.isAnonymous){if(t[n]&&t[n]!=s.name)return!1;n--}}return!0}class j5e{constructor(t,n,s,r){this.parent=t,this.buffer=n,this.index=s,this.start=r}}class Kd extends xY{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,n,s){super(),this.context=t,this._parent=n,this.index=s,this.type=t.buffer.set.types[t.buffer.buffer[s]]}child(t,n,s){let{buffer:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],t,n-this.context.start,s);return i<0?null:new Kd(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}prop(t){return this.type.prop(t)}enter(t,n,s=0){if(s&Jr.ExcludeBuffers)return null;let{buffer:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return i<0?null:new Kd(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,n=t.buffer[this.index+3];return n<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new Kd(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new Kd(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],n=[],{buffer:s}=this.context,r=this.index+4,i=s.buffer[this.index+3];if(i>r){let o=s.buffer[this.index+1];t.push(s.slice(r,i,o)),n.push(0)}return new ro(this.type,t,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function kY(e){if(!e.length)return null;let t=0,n=e[0];for(let i=1;i<e.length;i++){let o=e[i];(o.from>n.from||o.to<n.to)&&(n=o,t=i)}let s=n instanceof Ch&&n.index<0?null:n.parent,r=e.slice();return s?r[t]=s:r.splice(t,1),new L5e(r,n)}class L5e{constructor(t,n){this.heads=t,this.node=n}get next(){return kY(this.heads)}}function D5e(e,t,n){let s=e.resolveInner(t,n),r=null;for(let i=s instanceof Ch?s:s.context.parent;i;i=i.parent)if(i.index<0){let o=i.parent;(r||(r=[s])).push(o.resolve(t,n)),i=o}else{let o=ty.get(i.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let a=new Ch(o.tree,o.overlay[0].from+i.from,-1,i);(r||(r=[s])).push(Oy(a,t,n,!1))}}return r?kY(r):s}class T8{get name(){return this.type.name}constructor(t,n=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=n&~Jr.EnterBracketed,t instanceof Ch)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let s=t._parent;s;s=s._parent)this.stack.unshift(s.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,n){this.index=t;let{start:s,buffer:r}=this.buffer;return this.type=n||r.set.types[r.buffer[t]],this.from=s+r.buffer[t+1],this.to=s+r.buffer[t+2],!0}yield(t){return t?t instanceof Ch?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,n,s){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,n,s,this.mode));let{buffer:r}=this.buffer,i=r.findChild(this.index+4,r.buffer[this.index+3],t,n-this.buffer.start,s);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,n,s=this.mode){return this.buffer?s&Jr.ExcludeBuffers?!1:this.enterChild(1,t,n):this.yield(this._tree.enter(t,n,s))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Jr.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&Jr.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:n}=this.buffer,s=this.stack.length-1;if(t<0){let r=s<0?0:this.stack[s]+4;if(this.index!=r)return this.yieldBuf(n.findChild(r,this.index,-1,0,4))}else{let r=n.buffer[this.index+3];if(r<(s<0?n.buffer.length:n.buffer[this.stack[s]+3]))return this.yieldBuf(r)}return s<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let n,s,{buffer:r}=this;if(r){if(t>0){if(this.index<r.buffer.buffer.length)return!1}else for(let i=0;i<this.index;i++)if(r.buffer.buffer[i+3]<this.index)return!1;({index:n,parent:s}=r)}else({index:n,_parent:s}=this._tree);for(;s;{index:n,_parent:s}=s)if(n>-1)for(let i=n+t,o=t<0?-1:s._tree.children.length;i!=o;i+=t){let a=s._tree.children[i];if(this.mode&Jr.IncludeAnonymous||a instanceof Sh||!a.type.isAnonymous||i9(a))return!1}return!0}move(t,n){if(n&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,n=0){for(;(this.from==this.to||(n<1?this.from>=t:this.from>t)||(n>-1?this.to<=t:this.to<t))&&this.parent(););for(;this.enterChild(1,t,n););return this}get node(){if(!this.buffer)return this._tree;let t=this.bufferNode,n=null,s=0;if(t&&t.context==this.buffer)e:for(let r=this.index,i=this.stack.length;i>=0;){for(let o=t;o;o=o._parent)if(o.index==r){if(r==this.index)return o;n=o,s=i+1;break e}r=this.stack[--i]}for(let r=s;r<this.stack.length;r++)n=new Kd(this.buffer,n,this.stack[r]);return this.bufferNode=new Kd(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(t,n){for(let s=0;;){let r=!1;if(this.type.isAnonymous||t(this)!==!1){if(this.firstChild()){s++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&n&&n(this),r=this.type.isAnonymous,!s)return;if(this.nextSibling())break;this.parent(),s--,r=!0}}}matchContext(t){if(!this.buffer)return C8(this.node.parent,t);let{buffer:n}=this.buffer,{types:s}=n.set;for(let r=t.length-1,i=this.stack.length-1;r>=0;i--){if(i<0)return C8(this._tree,t,r);let o=s[n.buffer[this.stack[i]]];if(!o.isAnonymous){if(t[r]&&t[r]!=o.name)return!1;r--}}return!0}}function i9(e){return e.children.some(t=>t instanceof Sh||!t.type.isAnonymous||i9(t))}function O5e(e){var t;let{buffer:n,nodeSet:s,maxBufferLength:r=N5e,reused:i=[],minRepeatType:o=s.types.length}=e,a=Array.isArray(n)?new r9(n,n.length):n,l=s.types,c=0,d=0;function h(T,C,S,_,L,M){let{id:I,start:A,end:P,size:B}=a,F=d,O=c;if(B<0)if(a.next(),B==-1){let G=i[I];S.push(G),_.push(A-T);return}else if(B==-3){c=I;return}else if(B==-4){d=I;return}else throw new RangeError(`Unrecognized record size: ${B}`);let X=l[I],z,U,D=A-T;if(P-A<=r&&(U=w(a.pos-C,L))){let G=new Uint16Array(U.size-U.skip),q=a.pos-U.size,N=G.length;for(;a.pos>q;)N=v(U.start,G,N);z=new Sh(G,P-U.start,s),D=U.start-T}else{let G=a.pos-B;a.next();let q=[],N=[],ee=I>=o?I:-1,re=0,Q=P;for(;a.pos>G;)ee>=0&&a.id==ee&&a.size>=0?(a.end<=Q-r&&(g(q,N,A,re,a.end,Q,ee,F,O),re=q.length,Q=a.end),a.next()):M>2500?f(A,G,q,N):h(A,G,q,N,ee,M+1);if(ee>=0&&re>0&&re<q.length&&g(q,N,A,re,A,Q,ee,F,O),q.reverse(),N.reverse(),ee>-1&&re>0){let K=p(X,O);z=o9(X,q,N,0,q.length,0,P-A,K,K)}else z=y(X,q,N,P-A,F-P,O)}S.push(z),_.push(D)}function f(T,C,S,_){let L=[],M=0,I=-1;for(;a.pos>C;){let{id:A,start:P,end:B,size:F}=a;if(F>4)a.next();else{if(I>-1&&P<I)break;I<0&&(I=B-r),L.push(A,P,B),M++,a.next()}}if(M){let A=new Uint16Array(M*4),P=L[L.length-2];for(let B=L.length-3,F=0;B>=0;B-=3)A[F++]=L[B],A[F++]=L[B+1]-P,A[F++]=L[B+2]-P,A[F++]=F;S.push(new Sh(A,L[2]-P,s)),_.push(P-T)}}function p(T,C){return(S,_,L)=>{let M=0,I=S.length-1,A,P;if(I>=0&&(A=S[I])instanceof ro){if(!I&&A.type==T&&A.length==L)return A;(P=A.prop(_s.lookAhead))&&(M=_[I]+A.length+P)}return y(T,S,_,L,M,C)}}function g(T,C,S,_,L,M,I,A,P){let B=[],F=[];for(;T.length>_;)B.push(T.pop()),F.push(C.pop()+S-L);T.push(y(s.types[I],B,F,M-L,A-M,P)),C.push(L-S)}function y(T,C,S,_,L,M,I){if(M){let A=[_s.contextHash,M];I=I?[A].concat(I):[A]}if(L>25){let A=[_s.lookAhead,L];I=I?[A].concat(I):[A]}return new ro(T,C,S,_,I)}function w(T,C){let S=a.fork(),_=0,L=0,M=0,I=S.end-r,A={size:0,start:0,skip:0};e:for(let P=S.pos-T;S.pos>P;){let B=S.size;if(S.id==C&&B>=0){A.size=_,A.start=L,A.skip=M,M+=4,_+=4,S.next();continue}let F=S.pos-B;if(B<0||F<P||S.start<I)break;let O=S.id>=o?4:0,X=S.start;for(S.next();S.pos>F;){if(S.size<0)if(S.size==-3||S.size==-4)O+=4;else break e;else S.id>=o&&(O+=4);S.next()}L=X,_+=B,M+=O}return(C<0||_==T)&&(A.size=_,A.start=L,A.skip=M),A.size>4?A:void 0}function v(T,C,S){let{id:_,start:L,end:M,size:I}=a;if(a.next(),I>=0&&_<o){let A=S;if(I>4){let P=a.pos-(I-4);for(;a.pos>P;)S=v(T,C,S)}C[--S]=A,C[--S]=M-T,C[--S]=L-T,C[--S]=_}else I==-3?c=_:I==-4&&(d=_);return S}let b=[],x=[];for(;a.pos>0;)h(e.start||0,e.bufferStart||0,b,x,-1,0);let k=(t=e.length)!==null&&t!==void 0?t:b.length?x[0]+b[0].length:0;return new ro(l[e.topID],b.reverse(),x.reverse(),k)}const JO=new WeakMap;function Nx(e,t){if(!e.isAnonymous||t instanceof Sh||t.type!=e)return 1;let n=JO.get(t);if(n==null){n=1;for(let s of t.children){if(s.type!=e||!(s instanceof ro)){n=1;break}n+=Nx(e,s)}JO.set(t,n)}return n}function o9(e,t,n,s,r,i,o,a,l){let c=0;for(let g=s;g<r;g++)c+=Nx(e,t[g]);let d=Math.ceil(c*1.5/8),h=[],f=[];function p(g,y,w,v,b){for(let x=w;x<v;){let k=x,T=y[x],C=Nx(e,g[x]);for(x++;x<v;x++){let S=Nx(e,g[x]);if(C+S>=d)break;C+=S}if(x==k+1){if(C>d){let S=g[k];p(S.children,S.positions,0,S.children.length,y[k]+b);continue}h.push(g[k])}else{let S=y[x-1]+g[x-1].length-T;h.push(o9(e,g,y,k,x,T,S,null,l))}f.push(T+b-i)}}return p(t,n,s,r,0),(a||l)(h,f,o)}class Hf{constructor(t,n,s,r,i=!1,o=!1){this.from=t,this.to=n,this.tree=s,this.offset=r,this.open=(i?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,n=[],s=!1){let r=[new Hf(0,t.length,t,0,!1,s)];for(let i of n)i.to>t.length&&r.push(i);return r}static applyChanges(t,n,s=128){if(!n.length)return t;let r=[],i=1,o=t.length?t[0]:null;for(let a=0,l=0,c=0;;a++){let d=a<n.length?n[a]:null,h=d?d.fromA:1e9;if(h-l>=s)for(;o&&o.from<h;){let f=o;if(l>=f.from||h<=f.to||c){let p=Math.max(f.from,l)-c,g=Math.min(f.to,h)-c;f=p>=g?null:new Hf(p,g,f.tree,f.offset+c,a>0,!!d)}if(f&&r.push(f),o.to>h)break;o=i<t.length?t[i++]:null}if(!d)break;l=d.toA,c=d.toA-d.toB}return r}}class P5e{startParse(t,n,s){return typeof t=="string"&&(t=new B5e(t)),s=s?s.length?s.map(r=>new A5(r.from,r.to)):[new A5(0,0)]:[new A5(0,t.length)],this.createParse(t,n||[],s)}parse(t,n,s){let r=this.startParse(t,n,s);for(;;){let i=r.advance();if(i)return i}}}class B5e{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,n){return this.string.slice(t,n)}}new _s({perNode:!0});let $5e=0;class al{constructor(t,n,s,r){this.name=t,this.set=n,this.base=s,this.modified=r,this.id=$5e++}toString(){let{name:t}=this;for(let n of this.modified)n.name&&(t=`${n.name}(${t})`);return t}static define(t,n){let s=typeof t=="string"?t:"?";if(t instanceof al&&(n=t),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let r=new al(s,[],null,[]);if(r.set.push(r),n)for(let i of n.set)r.set.push(i);return r}static defineModifier(t){let n=new l2(t);return s=>s.modified.indexOf(n)>-1?s:l2.get(s.base||s,s.modified.concat(n).sort((r,i)=>r.id-i.id))}}let z5e=0;class l2{constructor(t){this.name=t,this.instances=[],this.id=z5e++}static get(t,n){if(!n.length)return t;let s=n[0].instances.find(a=>a.base==t&&F5e(n,a.modified));if(s)return s;let r=[],i=new al(t.name,r,t,n);for(let a of n)a.instances.push(i);let o=q5e(n);for(let a of t.set)if(!a.modified.length)for(let l of o)r.push(l2.get(a,l));return i}}function F5e(e,t){return e.length==t.length&&e.every((n,s)=>n==t[s])}function q5e(e){let t=[[]];for(let n=0;n<e.length;n++)for(let s=0,r=t.length;s<r;s++)t.push(t[s].concat(e[n]));return t.sort((n,s)=>s.length-n.length)}function H5e(e){let t=Object.create(null);for(let n in e){let s=e[n];Array.isArray(s)||(s=[s]);for(let r of n.split(" "))if(r){let i=[],o=2,a=r;for(let h=0;;){if(a=="..."&&h>0&&h+3==r.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!f)throw new RangeError("Invalid path: "+r);if(i.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),h+=f[0].length,h==r.length)break;let p=r[h++];if(h==r.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+r);a=r.slice(h)}let l=i.length-1,c=i[l];if(!c)throw new RangeError("Invalid path: "+r);let d=new Py(s,o,l>0?i.slice(0,l):null);t[c]=d.sort(t[c])}}return _Y.add(t)}const _Y=new _s({combine(e,t){let n,s,r;for(;e||t;){if(!e||t&&e.depth>=t.depth?(r=t,t=t.next):(r=e,e=e.next),n&&n.mode==r.mode&&!r.context&&!n.context)continue;let i=new Py(r.tags,r.mode,r.context);n?n.next=i:s=i,n=i}return s}});class Py{constructor(t,n,s,r){this.tags=t,this.mode=n,this.context=s,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){return!t||t.depth<this.depth?(this.next=t,this):(t.next=this.sort(t.next),t)}get depth(){return this.context?this.context.length:0}}Py.empty=new Py([],2,null);function SY(e,t){let n=Object.create(null);for(let i of e)if(!Array.isArray(i.tag))n[i.tag.id]=i.class;else for(let o of i.tag)n[o.id]=i.class;let{scope:s,all:r=null}=t||{};return{style:i=>{let o=r;for(let a of i)for(let l of a.set){let c=n[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:s}}function U5e(e,t){let n=null;for(let s of e){let r=s.style(t);r&&(n=n?n+" "+r:r)}return n}function V5e(e,t,n,s=0,r=e.length){let i=new W5e(s,Array.isArray(t)?t:[t],n);i.highlightRange(e.cursor(),s,r,"",i.highlighters),i.flush(r)}class W5e{constructor(t,n,s){this.at=t,this.highlighters=n,this.span=s,this.class=""}startSpan(t,n){n!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=n)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,n,s,r,i){let{type:o,from:a,to:l}=t;if(a>=s||l<=n)return;o.isTop&&(i=this.highlighters.filter(p=>!p.scope||p.scope(o)));let c=r,d=G5e(t)||Py.empty,h=U5e(i,d.tags);if(h&&(c&&(c+=" "),c+=h,d.mode==1&&(r+=(r?" ":"")+h)),this.startSpan(Math.max(n,a),c),d.opaque)return;let f=t.tree&&t.tree.prop(_s.mounted);if(f&&f.overlay){let p=t.node.enter(f.overlay[0].from+a,1),g=this.highlighters.filter(w=>!w.scope||w.scope(f.tree.type)),y=t.firstChild();for(let w=0,v=a;;w++){let b=w<f.overlay.length?f.overlay[w]:null,x=b?b.from+a:l,k=Math.max(n,v),T=Math.min(s,x);if(k<T&&y)for(;t.from<T&&(this.highlightRange(t,k,T,r,i),this.startSpan(Math.min(T,t.to),c),!(t.to>=x||!t.nextSibling())););if(!b||x>s)break;v=b.to+a,v>n&&(this.highlightRange(p.cursor(),Math.max(n,b.from+a),Math.min(s,v),"",g),this.startSpan(Math.min(s,v),c))}y&&t.parent()}else if(t.firstChild()){f&&(r="");do if(!(t.to<=n)){if(t.from>=s)break;this.highlightRange(t,n,s,r,i),this.startSpan(Math.min(s,t.to),c)}while(t.nextSibling());t.parent()}}}function G5e(e){let t=e.type.prop(_Y);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}const At=al.define,yw=At(),Nd=At(),ZO=At(Nd),eP=At(Nd),Id=At(),bw=At(Id),M5=At(Id),lc=At(),af=At(lc),Zl=At(),ec=At(),E8=At(),Ug=At(E8),vw=At(),Pt={comment:yw,lineComment:At(yw),blockComment:At(yw),docComment:At(yw),name:Nd,variableName:At(Nd),typeName:ZO,tagName:At(ZO),propertyName:eP,attributeName:At(eP),className:At(Nd),labelName:At(Nd),namespace:At(Nd),macroName:At(Nd),literal:Id,string:bw,docString:At(bw),character:At(bw),attributeValue:At(bw),number:M5,integer:At(M5),float:At(M5),bool:At(Id),regexp:At(Id),escape:At(Id),color:At(Id),url:At(Id),keyword:Zl,self:At(Zl),null:At(Zl),atom:At(Zl),unit:At(Zl),modifier:At(Zl),operatorKeyword:At(Zl),controlKeyword:At(Zl),definitionKeyword:At(Zl),moduleKeyword:At(Zl),operator:ec,derefOperator:At(ec),arithmeticOperator:At(ec),logicOperator:At(ec),bitwiseOperator:At(ec),compareOperator:At(ec),updateOperator:At(ec),definitionOperator:At(ec),typeOperator:At(ec),controlOperator:At(ec),punctuation:E8,separator:At(E8),bracket:Ug,angleBracket:At(Ug),squareBracket:At(Ug),paren:At(Ug),brace:At(Ug),content:lc,heading:af,heading1:At(af),heading2:At(af),heading3:At(af),heading4:At(af),heading5:At(af),heading6:At(af),contentSeparator:At(lc),list:At(lc),quote:At(lc),emphasis:At(lc),strong:At(lc),link:At(lc),monospace:At(lc),strikethrough:At(lc),inserted:At(),deleted:At(),changed:At(),invalid:At(),meta:vw,documentMeta:At(vw),annotation:At(vw),processingInstruction:At(vw),definition:al.defineModifier("definition"),constant:al.defineModifier("constant"),function:al.defineModifier("function"),standard:al.defineModifier("standard"),local:al.defineModifier("local"),special:al.defineModifier("special")};for(let e in Pt){let t=Pt[e];t instanceof al&&(t.name=e)}SY([{tag:Pt.link,class:"tok-link"},{tag:Pt.heading,class:"tok-heading"},{tag:Pt.emphasis,class:"tok-emphasis"},{tag:Pt.strong,class:"tok-strong"},{tag:Pt.keyword,class:"tok-keyword"},{tag:Pt.atom,class:"tok-atom"},{tag:Pt.bool,class:"tok-bool"},{tag:Pt.url,class:"tok-url"},{tag:Pt.labelName,class:"tok-labelName"},{tag:Pt.inserted,class:"tok-inserted"},{tag:Pt.deleted,class:"tok-deleted"},{tag:Pt.literal,class:"tok-literal"},{tag:Pt.string,class:"tok-string"},{tag:Pt.number,class:"tok-number"},{tag:[Pt.regexp,Pt.escape,Pt.special(Pt.string)],class:"tok-string2"},{tag:Pt.variableName,class:"tok-variableName"},{tag:Pt.local(Pt.variableName),class:"tok-variableName tok-local"},{tag:Pt.definition(Pt.variableName),class:"tok-variableName tok-definition"},{tag:Pt.special(Pt.variableName),class:"tok-variableName2"},{tag:Pt.definition(Pt.propertyName),class:"tok-propertyName tok-definition"},{tag:Pt.typeName,class:"tok-typeName"},{tag:Pt.namespace,class:"tok-namespace"},{tag:Pt.className,class:"tok-className"},{tag:Pt.macroName,class:"tok-macroName"},{tag:Pt.propertyName,class:"tok-propertyName"},{tag:Pt.operator,class:"tok-operator"},{tag:Pt.comment,class:"tok-comment"},{tag:Pt.meta,class:"tok-meta"},{tag:Pt.invalid,class:"tok-invalid"},{tag:Pt.punctuation,class:"tok-punctuation"}]);var N5;const m1=new _s,K5e=new _s;class Sc{constructor(t,n,s=[],r=""){this.data=t,this.name=r,ws.prototype.hasOwnProperty("tree")||Object.defineProperty(ws.prototype,"tree",{get(){return bo(this)}}),this.parser=n,this.extension=[Th.of(this),ws.languageData.of((i,o,a)=>{let l=tP(i,o,a),c=l.type.prop(m1);if(!c)return[];let d=i.facet(c),h=l.type.prop(K5e);if(h){let f=l.resolve(o-l.from,a);for(let p of h)if(p.test(f,i)){let g=i.facet(p.facet);return p.type=="replace"?g:g.concat(d)}}return d})].concat(s)}isActiveAt(t,n,s=-1){return tP(t,n,s).type.prop(m1)==this.data}findRegions(t){let n=t.facet(Th);if((n==null?void 0:n.data)==this.data)return[{from:0,to:t.doc.length}];if(!n||!n.allowsNesting)return[];let s=[],r=(i,o)=>{if(i.prop(m1)==this.data){s.push({from:o,to:o+i.length});return}let a=i.prop(_s.mounted);if(a){if(a.tree.prop(m1)==this.data){if(a.overlay)for(let l of a.overlay)s.push({from:l.from+o,to:l.to+o});else s.push({from:o,to:o+i.length});return}else if(a.overlay){let l=s.length;if(r(a.tree,a.overlay[0].from+o),s.length>l)return}}for(let l=0;l<i.children.length;l++){let c=i.children[l];c instanceof ro&&r(c,i.positions[l]+o)}};return r(bo(t),0),s}get allowsNesting(){return!0}}Sc.setState=Pn.define();function tP(e,t,n){let s=e.facet(Th),r=bo(e).topNode;if(!s||s.allowsNesting)for(let i=r;i;i=i.enter(t,n,Jr.ExcludeBuffers|Jr.EnterBracketed))i.type.isTop&&(r=i);return r}function bo(e){let t=e.field(Sc.state,!1);return t?t.tree:ro.empty}class Y5e{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,n){let s=this.cursorPos-this.string.length;return t<s||n>=this.cursorPos?this.doc.sliceString(t,n):this.string.slice(t-s,n-s)}}let Vg=null;class c2{constructor(t,n,s=[],r,i,o,a,l){this.parser=t,this.state=n,this.fragments=s,this.tree=r,this.treeLen=i,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(t,n,s){return new c2(t,n,[],ro.empty,0,s,[],null)}startParse(){return this.parser.startParse(new Y5e(this.state.doc),this.fragments)}work(t,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=ro.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var s;if(typeof t=="number"){let r=Date.now()+t;t=()=>Date.now()>r}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n<this.state.doc.length&&this.parse.stopAt(n);;){let r=this.parse.advance();if(r)if(this.fragments=this.withoutTempSkipped(Hf.addTree(r,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(s=this.parse.stoppedAt)!==null&&s!==void 0?s:this.state.doc.length,this.tree=r,this.parse=null,this.treeLen<(n??this.state.doc.length))this.parse=this.startParse();else return!0;if(t())return!1}})}takeTree(){let t,n;this.parse&&(t=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=t,this.tree=n,this.fragments=this.withoutTempSkipped(Hf.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let n=Vg;Vg=this;try{return t()}finally{Vg=n}}withoutTempSkipped(t){for(let n;n=this.tempSkipped.pop();)t=nP(t,n.from,n.to);return t}changes(t,n){let{fragments:s,tree:r,treeLen:i,viewport:o,skipped:a}=this;if(this.takeTree(),!t.empty){let l=[];if(t.iterChangedRanges((c,d,h,f)=>l.push({fromA:c,toA:d,fromB:h,toB:f})),s=Hf.applyChanges(s,l),r=ro.empty,i=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){a=[];for(let c of this.skipped){let d=t.mapPos(c.from,1),h=t.mapPos(c.to,-1);d<h&&a.push({from:d,to:h})}}}return new c2(this.parser,n,s,r,i,o,a,this.scheduleOn)}updateViewport(t){if(this.viewport.from==t.from&&this.viewport.to==t.to)return!1;this.viewport=t;let n=this.skipped.length;for(let s=0;s<this.skipped.length;s++){let{from:r,to:i}=this.skipped[s];r<t.to&&i>t.from&&(this.fragments=nP(this.fragments,r,i),this.skipped.splice(s--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,n){this.skipped.push({from:t,to:n})}static getSkippingParser(t){return new class extends P5e{createParse(n,s,r){let i=r[0].from,o=r[r.length-1].to;return{parsedPos:i,advance(){let l=Vg;if(l){for(let c of r)l.tempSkipped.push(c);t&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,t]):t)}return this.parsedPos=o,new ro(kl.none,[],[],o-i)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let n=this.fragments;return this.treeLen>=t&&n.length&&n[0].from==0&&n[0].to>=t}static get(){return Vg}}function nP(e,t,n){return Hf.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class M0{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(t.changes,t.state),s=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,s)||n.takeTree(),new M0(n)}static init(t){let n=Math.min(3e3,t.doc.length),s=c2.create(t.facet(Th).parser,t,{from:0,to:n});return s.work(20,n)||s.takeTree(),new M0(s)}}Sc.state=ao.define({create:M0.init,update(e,t){for(let n of t.effects)if(n.is(Sc.setState))return n.value;return t.startState.facet(Th)!=t.state.facet(Th)?M0.init(t.state):e.apply(t)}});let CY=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(CY=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const I5=typeof navigator<"u"&&(!((N5=navigator.scheduling)===null||N5===void 0)&&N5.isInputPending)?()=>navigator.scheduling.isInputPending():null,X5e=Ir.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let n=this.view.state.field(Sc.state).context;(n.updateViewport(t.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:t}=this.view,n=t.field(Sc.state);(n.tree!=n.context.tree||!n.context.isDone(t.doc.length))&&(this.working=CY(this.work))}work(t){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=n+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:s,viewport:{to:r}}=this.view,i=s.field(Sc.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,t&&!I5?Math.max(25,t.timeRemaining()-5):1e9),a=i.context.treeLen<r&&s.doc.length>r+1e3,l=i.context.work(()=>I5&&I5()||Date.now()>o,r+(a?0:1e5));this.chunkBudget-=Date.now()-n,(l||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:Sc.setState.of(new M0(i.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(n=>ta(this.view.state,n)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Th=Ut.define({combine(e){return e.length?e[0]:null},enables:e=>[Sc.state,X5e,yt.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),Q5e=Ut.define(),a9=Ut.define({combine:e=>{if(!e.length)return"  ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(n=>n!=t[0]))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function u2(e){let t=e.facet(a9);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function By(e,t){let n="",s=e.tabSize,r=e.facet(a9)[0];if(r=="	"){for(;t>=s;)n+="	",t-=s;r=" "}for(let i=0;i<t;i++)n+=r;return n}function l9(e,t){e instanceof ws&&(e=new K_(e));for(let s of e.state.facet(Q5e)){let r=s(e,t);if(r!==void 0)return r}let n=bo(e.state);return n.length>=t?Z5e(e,n,t):null}class K_{constructor(t,n={}){this.state=t,this.options=n,this.unit=u2(t)}lineAt(t,n=1){let s=this.state.doc.lineAt(t),{simulateBreak:r,simulateDoubleBreak:i}=this.options;return r!=null&&r>=s.from&&r<=s.to?i&&r==t?{text:"",from:t}:(n<0?r<t:r<=t)?{text:s.text.slice(r-s.from),from:r}:{text:s.text.slice(0,r-s.from),from:s.from}:s}textAfterPos(t,n=1){if(this.options.simulateDoubleBreak&&t==this.options.simulateBreak)return"";let{text:s,from:r}=this.lineAt(t,n);return s.slice(t-r,Math.min(s.length,t+100-r))}column(t,n=1){let{text:s,from:r}=this.lineAt(t,n),i=this.countColumn(s,t-r),o=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return o>-1&&(i+=o-this.countColumn(s,s.search(/\S|$/))),i}countColumn(t,n=t.length){return ng(t,this.state.tabSize,n)}lineIndent(t,n=1){let{text:s,from:r}=this.lineAt(t,n),i=this.options.overrideIndentation;if(i){let o=i(r);if(o>-1)return o}return this.countColumn(s,s.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const J5e=new _s;function Z5e(e,t,n){let s=t.resolveStack(n),r=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(r!=s.node){let i=[];for(let o=r;o&&!(o.from<s.node.from||o.to>s.node.to||o.from==s.node.from&&o.type==s.node.type);o=o.parent)i.push(o);for(let o=i.length-1;o>=0;o--)s={node:i[o],next:s}}return TY(s,e,n)}function TY(e,t,n){for(let s=e;s;s=s.next){let r=tCe(s.node);if(r)return r(c9.create(t,n,s))}return 0}function eCe(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function tCe(e){let t=e.type.prop(J5e);if(t)return t;let n=e.firstChild,s;if(n&&(s=n.type.prop(_s.closedBy))){let r=e.lastChild,i=r&&s.indexOf(r.name)>-1;return o=>iCe(o,!0,1,void 0,i&&!eCe(o)?r.from:void 0)}return e.parent==null?nCe:null}function nCe(){return 0}class c9 extends K_{constructor(t,n,s){super(t.state,t.options),this.base=t,this.pos=n,this.context=s}get node(){return this.context.node}static create(t,n,s){return new c9(t,n,s)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let n=this.state.doc.lineAt(t.from);for(;;){let s=t.resolve(n.from);for(;s.parent&&s.parent.from==s.from;)s=s.parent;if(sCe(s,t))break;n=this.state.doc.lineAt(s.from)}return this.lineIndent(n.from)}continue(){return TY(this.context.next,this.base,this.pos)}}function sCe(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function rCe(e){let t=e.node,n=t.childAfter(t.from),s=t.lastChild;if(!n)return null;let r=e.options.simulateBreak,i=e.state.doc.lineAt(n.from),o=r==null||r<=i.from?i.to:Math.min(i.to,r);for(let a=n.to;;){let l=t.childAfter(a);if(!l||l==s)return null;if(!l.type.isSkipped){if(l.from>=o)return null;let c=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+c}}a=l.to}}function iCe(e,t,n,s,r){let i=e.textAfter,o=i.match(/^\s*/)[0].length,a=s&&i.slice(o,o+s.length)==s||r==e.pos+o,l=rCe(e);return l?a?e.column(l.from):e.column(l.to):e.baseIndent+(a?0:e.unit*n)}const oCe=200;function aCe(){return ws.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:s}=e.newSelection.main,r=n.lineAt(s);if(s>r.from+oCe)return e;let i=n.sliceString(r.from,s);if(!t.some(c=>c.test(i)))return e;let{state:o}=e,a=-1,l=[];for(let{head:c}of o.selection.ranges){let d=o.doc.lineAt(c);if(d.from==a)continue;a=d.from;let h=l9(o,d.from);if(h==null)continue;let f=/^\s*/.exec(d.text)[0],p=By(o,h);f!=p&&l.push({from:d.from,to:d.from+f.length,insert:p})}return l.length?[e,{changes:l,sequential:!0}]:e})}const lCe=Ut.define(),cCe=new _s;function uCe(e,t,n){let s=bo(e);if(s.length<n)return null;let r=s.resolveStack(n,1),i=null;for(let o=r;o;o=o.next){let a=o.node;if(a.to<=n||a.from>n)continue;if(i&&a.from<t)break;let l=a.type.prop(cCe);if(l&&(a.to<s.length-50||s.length==e.doc.length||!dCe(a))){let c=l(a,e);c&&c.from<=n&&c.from>=t&&c.to>n&&(i=c)}}return i}function dCe(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function d2(e,t,n){for(let s of e.facet(lCe)){let r=s(e,t,n);if(r)return r}return uCe(e,t,n)}function EY(e,t){let n=t.mapPos(e.from,1),s=t.mapPos(e.to,-1);return n>=s?void 0:{from:n,to:s}}const Y_=Pn.define({map:EY}),Nb=Pn.define({map:EY});function AY(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some(s=>s.from<=n&&s.to>=n)||t.push(e.lineBlockAt(n));return t}const em=ao.define({create(){return sn.none},update(e,t){t.isUserEvent("delete")&&t.changes.iterChangedRanges((n,s)=>e=sP(e,n,s)),e=e.map(t.changes);for(let n of t.effects)if(n.is(Y_)&&!hCe(e,n.value.from,n.value.to)){let{preparePlaceholder:s}=t.state.facet(IY),r=s?sn.replace({widget:new vCe(s(t.state,n.value))}):rP;e=e.update({add:[r.range(n.value.from,n.value.to)]})}else n.is(Nb)&&(e=e.update({filter:(s,r)=>n.value.from!=s||n.value.to!=r,filterFrom:n.value.from,filterTo:n.value.to}));return t.selection&&(e=sP(e,t.selection.main.head)),e},provide:e=>yt.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,(s,r)=>{n.push(s,r)}),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let n=0;n<e.length;){let s=e[n++],r=e[n++];if(typeof s!="number"||typeof r!="number")throw new RangeError("Invalid JSON for fold state");t.push(rP.range(s,r))}return sn.set(t,!0)}});function sP(e,t,n=t){let s=!1;return e.between(t,n,(r,i)=>{r<n&&i>t&&(s=!0)}),s?e.update({filterFrom:t,filterTo:n,filter:(r,i)=>r>=n||i<=t}):e}function h2(e,t,n){var s;let r=null;return(s=e.field(em,!1))===null||s===void 0||s.between(t,n,(i,o)=>{(!r||r.from>i)&&(r={from:i,to:o})}),r}function hCe(e,t,n){let s=!1;return e.between(t,t,(r,i)=>{r==t&&i==n&&(s=!0)}),s}function MY(e,t){return e.field(em,!1)?t:t.concat(Pn.appendConfig.of(RY()))}const fCe=e=>{for(let t of AY(e)){let n=d2(e.state,t.from,t.to);if(n)return e.dispatch({effects:MY(e.state,[Y_.of(n),NY(e,n)])}),!0}return!1},mCe=e=>{if(!e.state.field(em,!1))return!1;let t=[];for(let n of AY(e)){let s=h2(e.state,n.from,n.to);s&&t.push(Nb.of(s),NY(e,s,!1))}return t.length&&e.dispatch({effects:t}),t.length>0};function NY(e,t,n=!0){let s=e.state.doc.lineAt(t.from).number,r=e.state.doc.lineAt(t.to).number;return yt.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${s} ${e.state.phrase("to")} ${r}.`)}const pCe=e=>{let{state:t}=e,n=[];for(let s=0;s<t.doc.length;){let r=e.lineBlockAt(s),i=d2(t,r.from,r.to);i&&n.push(Y_.of(i)),s=(i?e.lineBlockAt(i.to):r).to+1}return n.length&&e.dispatch({effects:MY(e.state,n)}),!!n.length},gCe=e=>{let t=e.state.field(em,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(s,r)=>{n.push(Nb.of({from:s,to:r}))}),e.dispatch({effects:n}),!0},yCe=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:fCe},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:mCe},{key:"Ctrl-Alt-[",run:pCe},{key:"Ctrl-Alt-]",run:gCe}],bCe={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},IY=Ut.define({combine(e){return Vc(e,bCe)}});function RY(e){return[em,kCe]}function jY(e,t){let{state:n}=e,s=n.facet(IY),r=o=>{let a=e.lineBlockAt(e.posAtDOM(o.target)),l=h2(e.state,a.from,a.to);l&&e.dispatch({effects:Nb.of(l)}),o.preventDefault()};if(s.placeholderDOM)return s.placeholderDOM(e,r,t);let i=document.createElement("span");return i.textContent=s.placeholderText,i.setAttribute("aria-label",n.phrase("folded code")),i.title=n.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=r,i}const rP=sn.replace({widget:new class extends Fa{toDOM(e){return jY(e,null)}}});class vCe extends Fa{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return jY(t,this.value)}}const wCe={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class R5 extends Uu{constructor(t,n){super(),this.config=t,this.open=n}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=t.state.phrase(this.open?"Fold line":"Unfold line"),n}}function xCe(e={}){let t={...wCe,...e},n=new R5(t,!0),s=new R5(t,!1),r=Ir.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Th)!=o.state.facet(Th)||o.startState.field(em,!1)!=o.state.field(em,!1)||bo(o.startState)!=bo(o.state)||t.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new Rc;for(let l of o.viewportLineBlocks){let c=h2(o.state,l.from,l.to)?s:d2(o.state,l.from,l.to)?n:null;c&&a.add(l.from,l.from,c)}return a.finish()}}),{domEventHandlers:i}=t;return[r,v5e({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(r))===null||a===void 0?void 0:a.markers)||ms.empty},initialSpacer(){return new R5(t,!1)},domEventHandlers:{...i,click:(o,a,l)=>{if(i.click&&i.click(o,a,l))return!0;let c=h2(o.state,a.from,a.to);if(c)return o.dispatch({effects:Nb.of(c)}),!0;let d=d2(o.state,a.from,a.to);return d?(o.dispatch({effects:Y_.of(d)}),!0):!1}}}),RY()]}const kCe=yt.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class X_{constructor(t,n){this.specs=t;let s;function r(a){let l=xh.newName();return(s||(s=Object.create(null)))["."+l]=a,l}const i=typeof n.all=="string"?n.all:n.all?r(n.all):void 0,o=n.scope;this.scope=o instanceof Sc?a=>a.prop(m1)==o.data:o?a=>a==o:void 0,this.style=SY(t.map(a=>({tag:a.tag,class:a.class||r(Object.assign({},a,{tag:null}))})),{all:i}).style,this.module=s?new xh(s):null,this.themeType=n.themeType}static define(t,n){return new X_(t,n||{})}}const A8=Ut.define(),LY=Ut.define({combine(e){return e.length?[e[0]]:null}});function Ix(e){let t=e.facet(A8);return t.length?t:e.facet(LY)}function DY(e,t){let n=[SCe],s;return e instanceof X_&&(e.module&&n.push(yt.styleModule.of(e.module)),s=e.themeType),t!=null&&t.fallback?n.push(LY.of(e)):s?n.push(A8.computeN([yt.darkTheme],r=>r.facet(yt.darkTheme)==(s=="dark")?[e]:[])):n.push(A8.of(e)),n}function K0t(e,t,n){let s=Ix(e),r=null;if(s){for(let i of s)if(!i.scope||n){let o=i.style(t);o&&(r=r?r+" "+o:o)}}return r}class _Ce{constructor(t){this.markCache=Object.create(null),this.tree=bo(t.state),this.decorations=this.buildDeco(t,Ix(t.state)),this.decoratedTo=t.viewport.to}update(t){let n=bo(t.state),s=Ix(t.state),r=s!=Ix(t.startState),{viewport:i}=t.view,o=t.changes.mapPos(this.decoratedTo,1);n.length<i.to&&!r&&n.type==this.tree.type&&o>=i.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=o):(n!=this.tree||t.viewportChanged||r)&&(this.tree=n,this.decorations=this.buildDeco(t.view,s),this.decoratedTo=i.to)}buildDeco(t,n){if(!n||!this.tree.length)return sn.none;let s=new Rc;for(let{from:r,to:i}of t.visibleRanges)V5e(this.tree,n,(o,a,l)=>{s.add(o,a,this.markCache[l]||(this.markCache[l]=sn.mark({class:l})))},r,i);return s.finish()}}const SCe=Bh.high(Ir.fromClass(_Ce,{decorations:e=>e.decorations})),OY=X_.define([{tag:Pt.meta,color:"#404740"},{tag:Pt.link,textDecoration:"underline"},{tag:Pt.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Pt.emphasis,fontStyle:"italic"},{tag:Pt.strong,fontWeight:"bold"},{tag:Pt.strikethrough,textDecoration:"line-through"},{tag:Pt.keyword,color:"#708"},{tag:[Pt.atom,Pt.bool,Pt.url,Pt.contentSeparator,Pt.labelName],color:"#219"},{tag:[Pt.literal,Pt.inserted],color:"#164"},{tag:[Pt.string,Pt.deleted],color:"#a11"},{tag:[Pt.regexp,Pt.escape,Pt.special(Pt.string)],color:"#e40"},{tag:Pt.definition(Pt.variableName),color:"#00f"},{tag:Pt.local(Pt.variableName),color:"#30a"},{tag:[Pt.typeName,Pt.namespace],color:"#085"},{tag:Pt.className,color:"#167"},{tag:[Pt.special(Pt.variableName),Pt.macroName],color:"#256"},{tag:Pt.definition(Pt.propertyName),color:"#00c"},{tag:Pt.comment,color:"#940"},{tag:Pt.invalid,color:"#f00"}]),CCe=yt.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),PY=1e4,BY="()[]{}",$Y=Ut.define({combine(e){return Vc(e,{afterCursor:!0,brackets:BY,maxScanDistance:PY,renderMatch:ACe})}}),TCe=sn.mark({class:"cm-matchingBracket"}),ECe=sn.mark({class:"cm-nonmatchingBracket"});function ACe(e){let t=[],n=e.matched?TCe:ECe;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}function iP(e){let t=[],n=e.facet($Y);for(let s of e.selection.ranges){if(!s.empty)continue;let r=Cc(e,s.head,-1,n)||s.head>0&&Cc(e,s.head-1,1,n)||n.afterCursor&&(Cc(e,s.head,1,n)||s.head<e.doc.length&&Cc(e,s.head+1,-1,n));r&&(t=t.concat(n.renderMatch(r,e)))}return sn.set(t,!0)}const MCe=Ir.fromClass(class{constructor(e){this.paused=!1,this.decorations=iP(e.state)}update(e){(e.docChanged||e.selectionSet||this.paused)&&(e.view.composing?(this.decorations=this.decorations.map(e.changes),this.paused=!0):(this.decorations=iP(e.state),this.paused=!1))}},{decorations:e=>e.decorations}),NCe=[MCe,CCe];function ICe(e={}){return[$Y.of(e),NCe]}const RCe=new _s;function M8(e,t,n){let s=e.prop(t<0?_s.openedBy:_s.closedBy);if(s)return s;if(e.name.length==1){let r=n.indexOf(e.name);if(r>-1&&r%2==(t<0?1:0))return[n[r+t]]}return null}function N8(e){let t=e.type.prop(RCe);return t?t(e.node):e}function Cc(e,t,n,s={}){let r=s.maxScanDistance||PY,i=s.brackets||BY,o=bo(e),a=o.resolveInner(t,n);for(let l=a;l;l=l.parent){let c=M8(l.type,n,i);if(c&&l.from<l.to){let d=N8(l);if(d&&(n>0?t>=d.from&&t<d.to:t>d.from&&t<=d.to))return jCe(e,t,n,l,d,c,i)}}return LCe(e,t,n,o,a.type,r,i)}function jCe(e,t,n,s,r,i,o){let a=s.parent,l={from:r.from,to:r.to},c=0,d=a==null?void 0:a.cursor();if(d&&(n<0?d.childBefore(s.from):d.childAfter(s.to)))do if(n<0?d.to<=s.from:d.from>=s.to){if(c==0&&i.indexOf(d.type.name)>-1&&d.from<d.to){let h=N8(d);return{start:l,end:h?{from:h.from,to:h.to}:void 0,matched:!0}}else if(M8(d.type,n,o))c++;else if(M8(d.type,-n,o)){if(c==0){let h=N8(d);return{start:l,end:h&&h.from<h.to?{from:h.from,to:h.to}:void 0,matched:!1}}c--}}while(n<0?d.prevSibling():d.nextSibling());return{start:l,matched:!1}}function LCe(e,t,n,s,r,i,o){if(n<0?!t:t==e.doc.length)return null;let a=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),l=o.indexOf(a);if(l<0||l%2==0!=n>0)return null;let c={from:n<0?t-1:t,to:n>0?t+1:t},d=e.doc.iterRange(t,n>0?e.doc.length:0),h=0;for(let f=0;!d.next().done&&f<=i;){let p=d.value;n<0&&(f+=p.length);let g=t+f*n;for(let y=n>0?0:p.length-1,w=n>0?p.length:-1;y!=w;y+=n){let v=o.indexOf(p[y]);if(!(v<0||s.resolveInner(g+y,1).type!=r))if(v%2==0==n>0)h++;else{if(h==1)return{start:c,end:{from:g+y,to:g+y+1},matched:v>>1==l>>1};h--}}n>0&&(f+=p.length)}return d.done?{start:c,matched:!1}:null}const DCe=Object.create(null),oP=[kl.none],aP=[],lP=Object.create(null),OCe=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])OCe[e]=PCe(DCe,t);function j5(e,t){aP.indexOf(e)>-1||(aP.push(e),console.warn(t))}function PCe(e,t){let n=[];for(let a of t.split(" ")){let l=[];for(let c of a.split(".")){let d=e[c]||Pt[c];d?typeof d=="function"?l.length?l=l.map(d):j5(c,`Modifier ${c} used at start of tag`):l.length?j5(c,`Tag ${c} used as modifier`):l=Array.isArray(d)?d:[d]:j5(c,`Unknown highlighting tag ${c}`)}for(let c of l)n.push(c)}if(!n.length)return 0;let s=t.replace(/ /g,"_"),r=s+" "+n.map(a=>a.id),i=lP[r];if(i)return i.id;let o=lP[r]=kl.define({id:oP.length,name:s,props:[H5e({[s]:n})]});return oP.push(o),o.id}cr.RTL,cr.LTR;const BCe=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),s=d9(e.state,n.from);return s.line?$Ce(e):s.block?FCe(e):!1};function u9(e,t){return({state:n,dispatch:s})=>{if(n.readOnly)return!1;let r=e(t,n);return r?(s(n.update(r)),!0):!1}}const $Ce=u9(UCe,0),zCe=u9(zY,0),FCe=u9((e,t)=>zY(e,t,HCe(t)),0);function d9(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const Wg=50;function qCe(e,{open:t,close:n},s,r){let i=e.sliceDoc(s-Wg,s),o=e.sliceDoc(r,r+Wg),a=/\s*$/.exec(i)[0].length,l=/^\s*/.exec(o)[0].length,c=i.length-a;if(i.slice(c-t.length,c)==t&&o.slice(l,l+n.length)==n)return{open:{pos:s-a,margin:a&&1},close:{pos:r+l,margin:l&&1}};let d,h;r-s<=2*Wg?d=h=e.sliceDoc(s,r):(d=e.sliceDoc(s,s+Wg),h=e.sliceDoc(r-Wg,r));let f=/^\s*/.exec(d)[0].length,p=/\s*$/.exec(h)[0].length,g=h.length-p-n.length;return d.slice(f,f+t.length)==t&&h.slice(g,g+n.length)==n?{open:{pos:s+f+t.length,margin:/\s/.test(d.charAt(f+t.length))?1:0},close:{pos:r-p-n.length,margin:/\s/.test(h.charAt(g-1))?1:0}}:null}function HCe(e){let t=[];for(let n of e.selection.ranges){let s=e.doc.lineAt(n.from),r=n.to<=s.to?s:e.doc.lineAt(n.to);r.from>s.from&&r.from==n.to&&(r=n.to==s.to+1?s:e.doc.lineAt(n.to-1));let i=t.length-1;i>=0&&t[i].to>s.from?t[i].to=r.to:t.push({from:s.from+/^\s*/.exec(s.text)[0].length,to:r.to})}return t}function zY(e,t,n=t.selection.ranges){let s=n.map(i=>d9(t,i.from).block);if(!s.every(i=>i))return null;let r=n.map((i,o)=>qCe(t,s[o],i.from,i.to));if(e!=2&&!r.every(i=>i))return{changes:t.changes(n.map((i,o)=>r[o]?[]:[{from:i.from,insert:s[o].open+" "},{from:i.to,insert:" "+s[o].close}]))};if(e!=1&&r.some(i=>i)){let i=[];for(let o=0,a;o<r.length;o++)if(a=r[o]){let l=s[o],{open:c,close:d}=a;i.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:d.pos-d.margin,to:d.pos+l.close.length})}return{changes:i}}return null}function UCe(e,t,n=t.selection.ranges){let s=[],r=-1;e:for(let{from:i,to:o}of n){let a=s.length,l=1e9,c;for(let d=i;d<=o;){let h=t.doc.lineAt(d);if(c==null&&(c=d9(t,h.from).line,!c))continue e;if(h.from>r&&(i==o||o>h.from)){r=h.from;let f=/^\s*/.exec(h.text)[0].length,p=f==h.length,g=h.text.slice(f,f+c.length)==c?f:-1;f<h.text.length&&f<l&&(l=f),s.push({line:h,comment:g,token:c,indent:f,empty:p,single:!1})}d=h.to+1}if(l<1e9)for(let d=a;d<s.length;d++)s[d].indent<s[d].line.text.length&&(s[d].indent=l);s.length==a+1&&(s[a].single=!0)}if(e!=2&&s.some(i=>i.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:a,token:l,indent:c,empty:d,single:h}of s)(h||!d)&&i.push({from:a.from+c,insert:l+" "});let o=t.changes(i);return{changes:o,selection:t.selection.map(o,1)}}else if(e!=1&&s.some(i=>i.comment>=0)){let i=[];for(let{line:o,comment:a,token:l}of s)if(a>=0){let c=o.from+a,d=c+l.length;o.text[d-o.from]==" "&&d++,i.push({from:c,to:d})}return{changes:i}}return null}const I8=td.define(),VCe=td.define(),WCe=Ut.define(),FY=Ut.define({combine(e){return Vc(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(s,r)=>t(s,r)||n(s,r)})}}),qY=ao.define({create(){return Tc.empty},update(e,t){let n=t.state.facet(FY),s=t.annotation(I8);if(s){let l=na.fromTransaction(t,s.selection),c=s.side,d=c==0?e.undone:e.done;return l?d=f2(d,d.length,n.minDepth,l):d=VY(d,t.startState.selection),new Tc(c==0?s.rest:d,c==0?d:s.rest)}let r=t.annotation(VCe);if((r=="full"||r=="before")&&(e=e.isolate()),t.annotation(Ci.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let i=na.fromTransaction(t),o=t.annotation(Ci.time),a=t.annotation(Ci.userEvent);return i?e=e.addChanges(i,o,a,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,a,n.newGroupDelay)),(r=="full"||r=="after")&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(t=>t.toJSON()),undone:e.undone.map(t=>t.toJSON())}},fromJSON(e){return new Tc(e.done.map(na.fromJSON),e.undone.map(na.fromJSON))}});function h9(e={}){return[qY,FY.of(e),yt.domEventHandlers({beforeinput(t,n){let s=t.inputType=="historyUndo"?HY:t.inputType=="historyRedo"?R8:null;return s?(t.preventDefault(),s(n)):!1}})]}function Q_(e,t){return function({state:n,dispatch:s}){if(!t&&n.readOnly)return!1;let r=n.field(qY,!1);if(!r)return!1;let i=r.pop(e,n,t);return i?(s(i),!0):!1}}const HY=Q_(0,!1),R8=Q_(1,!1),GCe=Q_(0,!0),KCe=Q_(1,!0);class na{constructor(t,n,s,r,i){this.changes=t,this.effects=n,this.mapped=s,this.startSelection=r,this.selectionsAfter=i}setSelAfter(t){return new na(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,n,s;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(s=this.startSelection)===null||s===void 0?void 0:s.toJSON(),selectionsAfter:this.selectionsAfter.map(r=>r.toJSON())}}static fromJSON(t){return new na(t.changes&&_i.fromJSON(t.changes),[],t.mapped&&Nc.fromJSON(t.mapped),t.startSelection&&Be.fromJSON(t.startSelection),t.selectionsAfter.map(Be.fromJSON))}static fromTransaction(t,n){let s=ml;for(let r of t.startState.facet(WCe)){let i=r(t);i.length&&(s=s.concat(i))}return!s.length&&t.changes.empty?null:new na(t.changes.invert(t.startState.doc),s,void 0,n||t.startState.selection,ml)}static selection(t){return new na(void 0,ml,void 0,void 0,t)}}function f2(e,t,n,s){let r=t+1>n+20?t-n-1:0,i=e.slice(r,t);return i.push(s),i}function YCe(e,t){let n=[],s=!1;return e.iterChangedRanges((r,i)=>n.push(r,i)),t.iterChangedRanges((r,i,o,a)=>{for(let l=0;l<n.length;){let c=n[l++],d=n[l++];a>=c&&o<=d&&(s=!0)}}),s}function XCe(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,s)=>n.empty!=t.ranges[s].empty).length===0}function UY(e,t){return e.length?t.length?e.concat(t):e:t}const ml=[],QCe=200;function VY(e,t){if(e.length){let n=e[e.length-1],s=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-QCe));return s.length&&s[s.length-1].eq(t)?e:(s.push(t),f2(e,e.length-1,1e9,n.setSelAfter(s)))}else return[na.selection([t])]}function JCe(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function L5(e,t){if(!e.length)return e;let n=e.length,s=ml;for(;n;){let r=ZCe(e[n-1],t,s);if(r.changes&&!r.changes.empty||r.effects.length){let i=e.slice(0,n);return i[n-1]=r,i}else t=r.mapped,n--,s=r.selectionsAfter}return s.length?[na.selection(s)]:ml}function ZCe(e,t,n){let s=UY(e.selectionsAfter.length?e.selectionsAfter.map(a=>a.map(t)):ml,n);if(!e.changes)return na.selection(s);let r=e.changes.map(t),i=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(i):i;return new na(r,Pn.mapEffects(e.effects,t),o,e.startSelection.map(i),s)}const e6e=/^(input\.type|delete)($|\.)/;class Tc{constructor(t,n,s=0,r=void 0){this.done=t,this.undone=n,this.prevTime=s,this.prevUserEvent=r}isolate(){return this.prevTime?new Tc(this.done,this.undone):this}addChanges(t,n,s,r,i){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&t.changes&&(!s||e6e.test(s))&&(!a.selectionsAfter.length&&n-this.prevTime<r.newGroupDelay&&r.joinToEvent(i,YCe(a.changes,t.changes))||s=="input.type.compose")?o=f2(o,o.length-1,r.minDepth,new na(t.changes.compose(a.changes),UY(Pn.mapEffects(t.effects,a.changes),a.effects),a.mapped,a.startSelection,ml)):o=f2(o,o.length,r.minDepth,t),new Tc(o,ml,n,s)}addSelection(t,n,s,r){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:ml;return i.length>0&&n-this.prevTime<r&&s==this.prevUserEvent&&s&&/^select($|\.)/.test(s)&&XCe(i[i.length-1],t)?this:new Tc(VY(this.done,t),this.undone,n,s)}addMapping(t){return new Tc(L5(this.done,t),L5(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,n,s){let r=t==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],o=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):n.selection);if(s&&i.selectionsAfter.length)return n.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:I8.of({side:t,rest:JCe(r),selection:o}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let a=r.length==1?ml:r.slice(0,r.length-1);return i.mapped&&(a=L5(a,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:I8.of({side:t,rest:a,selection:o}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}Tc.empty=new Tc(ml,ml);const f9=[{key:"Mod-z",run:HY,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:R8,preventDefault:!0},{linux:"Ctrl-Shift-z",run:R8,preventDefault:!0},{key:"Mod-u",run:GCe,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:KCe,preventDefault:!0}];function sg(e,t){return Be.create(e.ranges.map(t),e.mainIndex)}function $l(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function zl({state:e,dispatch:t},n){let s=sg(e.selection,n);return s.eq(e.selection,!0)?!1:(t($l(e,s)),!0)}function J_(e,t){return Be.cursor(t?e.to:e.from)}function WY(e,t){return zl(e,n=>n.empty?e.moveByChar(n,t):J_(n,t))}function wo(e){return e.textDirectionAt(e.state.selection.main.head)==cr.LTR}const GY=e=>WY(e,!wo(e)),KY=e=>WY(e,wo(e));function YY(e,t){return zl(e,n=>n.empty?e.moveByGroup(n,t):J_(n,t))}const t6e=e=>YY(e,!wo(e)),n6e=e=>YY(e,wo(e));function s6e(e,t,n){if(t.type.prop(n))return!0;let s=t.to-t.from;return s&&(s>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function Z_(e,t,n){let s=bo(e).resolveInner(t.head),r=n?_s.closedBy:_s.openedBy;for(let l=t.head;;){let c=n?s.childAfter(l):s.childBefore(l);if(!c)break;s6e(e,c,r)?s=c:l=n?c.to:c.from}let i=s.type.prop(r),o,a;return i&&(o=n?Cc(e,s.from,1):Cc(e,s.to,-1))&&o.matched?a=n?o.end.to:o.end.from:a=n?s.to:s.from,Be.cursor(a,n?-1:1)}const r6e=e=>zl(e,t=>Z_(e.state,t,!wo(e))),i6e=e=>zl(e,t=>Z_(e.state,t,wo(e)));function XY(e,t){return zl(e,n=>{if(!n.empty)return J_(n,t);let s=e.moveVertically(n,t);return s.head!=n.head?s:e.moveToLineBoundary(n,t)})}const QY=e=>XY(e,!1),JY=e=>XY(e,!0);function ZY(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,s=0,r;if(t){for(let i of e.state.facet(yt.scrollMargins)){let o=i(e);o!=null&&o.top&&(n=Math.max(o==null?void 0:o.top,n)),o!=null&&o.bottom&&(s=Math.max(o==null?void 0:o.bottom,s))}r=e.scrollDOM.clientHeight-n-s}else r=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:s,selfScroll:t,height:Math.max(e.defaultLineHeight,r-5)}}function eX(e,t){let n=ZY(e),{state:s}=e,r=sg(s.selection,o=>o.empty?e.moveVertically(o,t,n.height):J_(o,t));if(r.eq(s.selection))return!1;let i;if(n.selfScroll){let o=e.coordsAtPos(s.selection.main.head),a=e.scrollDOM.getBoundingClientRect(),l=a.top+n.marginTop,c=a.bottom-n.marginBottom;o&&o.top>l&&o.bottom<c&&(i=yt.scrollIntoView(r.main.head,{y:"start",yMargin:o.top-l}))}return e.dispatch($l(s,r),{effects:i}),!0}const cP=e=>eX(e,!1),j8=e=>eX(e,!0);function $h(e,t,n){let s=e.lineBlockAt(t.head),r=e.moveToLineBoundary(t,n);if(r.head==t.head&&r.head!=(n?s.to:s.from)&&(r=e.moveToLineBoundary(t,n,!1)),!n&&r.head==s.from&&s.length){let i=/^\s*/.exec(e.state.sliceDoc(s.from,Math.min(s.from+100,s.to)))[0].length;i&&t.head!=s.from+i&&(r=Be.cursor(s.from+i))}return r}const o6e=e=>zl(e,t=>$h(e,t,!0)),a6e=e=>zl(e,t=>$h(e,t,!1)),l6e=e=>zl(e,t=>$h(e,t,!wo(e))),c6e=e=>zl(e,t=>$h(e,t,wo(e))),u6e=e=>zl(e,t=>Be.cursor(e.lineBlockAt(t.head).from,1)),d6e=e=>zl(e,t=>Be.cursor(e.lineBlockAt(t.head).to,-1));function h6e(e,t,n){let s=!1,r=sg(e.selection,i=>{let o=Cc(e,i.head,-1)||Cc(e,i.head,1)||i.head>0&&Cc(e,i.head-1,1)||i.head<e.doc.length&&Cc(e,i.head+1,-1);if(!o||!o.end)return i;s=!0;let a=o.start.from==i.head?o.end.to:o.end.from;return Be.cursor(a)});return s?(t($l(e,r)),!0):!1}const f6e=({state:e,dispatch:t})=>h6e(e,t);function Sl(e,t){let n=sg(e.state.selection,s=>{let r=t(s);return Be.range(s.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return n.eq(e.state.selection)?!1:(e.dispatch($l(e.state,n)),!0)}function tX(e,t){return Sl(e,n=>e.moveByChar(n,t))}const nX=e=>tX(e,!wo(e)),sX=e=>tX(e,wo(e));function rX(e,t){return Sl(e,n=>e.moveByGroup(n,t))}const m6e=e=>rX(e,!wo(e)),p6e=e=>rX(e,wo(e)),g6e=e=>Sl(e,t=>Z_(e.state,t,!wo(e))),y6e=e=>Sl(e,t=>Z_(e.state,t,wo(e)));function iX(e,t){return Sl(e,n=>e.moveVertically(n,t))}const oX=e=>iX(e,!1),aX=e=>iX(e,!0);function lX(e,t){return Sl(e,n=>e.moveVertically(n,t,ZY(e).height))}const uP=e=>lX(e,!1),dP=e=>lX(e,!0),b6e=e=>Sl(e,t=>$h(e,t,!0)),v6e=e=>Sl(e,t=>$h(e,t,!1)),w6e=e=>Sl(e,t=>$h(e,t,!wo(e))),x6e=e=>Sl(e,t=>$h(e,t,wo(e))),k6e=e=>Sl(e,t=>Be.cursor(e.lineBlockAt(t.head).from)),_6e=e=>Sl(e,t=>Be.cursor(e.lineBlockAt(t.head).to)),hP=({state:e,dispatch:t})=>(t($l(e,{anchor:0})),!0),fP=({state:e,dispatch:t})=>(t($l(e,{anchor:e.doc.length})),!0),mP=({state:e,dispatch:t})=>(t($l(e,{anchor:e.selection.main.anchor,head:0})),!0),pP=({state:e,dispatch:t})=>(t($l(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),S6e=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),C6e=({state:e,dispatch:t})=>{let n=e4(e).map(({from:s,to:r})=>Be.range(s,Math.min(r+1,e.doc.length)));return t(e.update({selection:Be.create(n),userEvent:"select"})),!0},T6e=({state:e,dispatch:t})=>{let n=sg(e.selection,s=>{let r=bo(e),i=r.resolveStack(s.from,1);if(s.empty){let o=r.resolveStack(s.from,-1);o.node.from>=i.node.from&&o.node.to<=i.node.to&&(i=o)}for(let o=i;o;o=o.next){let{node:a}=o;if((a.from<s.from&&a.to>=s.to||a.to>s.to&&a.from<=s.from)&&o.next)return Be.range(a.to,a.from)}return s});return n.eq(e.selection)?!1:(t($l(e,n)),!0)};function cX(e,t){let{state:n}=e,s=n.selection,r=n.selection.ranges.slice();for(let i of n.selection.ranges){let o=n.doc.lineAt(i.head);if(t?o.to<e.state.doc.length:o.from>0)for(let a=i;;){let l=e.moveVertically(a,t);if(l.head<o.from||l.head>o.to){r.some(c=>c.head==l.head)||r.push(l);break}else{if(l.head==a.head)break;a=l}}}return r.length==s.ranges.length?!1:(e.dispatch($l(n,Be.create(r,r.length-1))),!0)}const E6e=e=>cX(e,!1),A6e=e=>cX(e,!0),M6e=({state:e,dispatch:t})=>{let n=e.selection,s=null;return n.ranges.length>1?s=Be.create([n.main]):n.main.empty||(s=Be.create([Be.cursor(n.main.head)])),s?(t($l(e,s)),!0):!1};function Ib(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:s}=e,r=s.changeByRange(i=>{let{from:o,to:a}=i;if(o==a){let l=t(i);l<o?(n="delete.backward",l=ww(e,l,!1)):l>o&&(n="delete.forward",l=ww(e,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=ww(e,o,!1),a=ww(e,a,!0);return o==a?{range:i}:{changes:{from:o,to:a},range:Be.cursor(o,o<i.head?-1:1)}});return r.changes.empty?!1:(e.dispatch(s.update(r,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?yt.announce.of(s.phrase("Selection deleted")):void 0})),!0)}function ww(e,t,n){if(e instanceof yt)for(let s of e.state.facet(yt.atomicRanges).map(r=>r(e)))s.between(t,t,(r,i)=>{r<t&&i>t&&(t=n?i:r)});return t}const uX=(e,t,n)=>Ib(e,s=>{let r=s.from,{state:i}=e,o=i.doc.lineAt(r),a,l;if(n&&!t&&r>o.from&&r<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,r-o.from))){if(a[a.length-1]=="	")return r-1;let c=ng(a,i.tabSize),d=c%u2(i)||u2(i);for(let h=0;h<d&&a[a.length-1-h]==" ";h++)r--;l=r}else l=Fi(o.text,r-o.from,t,t)+o.from,l==r&&o.number!=(t?i.doc.lines:1)?l+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(l-o.from,r-o.from))&&(l=Fi(o.text,l-o.from,!1,!1)+o.from);return l}),L8=e=>uX(e,!1,!0),dX=e=>uX(e,!0,!1),hX=(e,t)=>Ib(e,n=>{let s=n.head,{state:r}=e,i=r.doc.lineAt(s),o=r.charCategorizer(s);for(let a=null;;){if(s==(t?i.to:i.from)){s==n.head&&i.number!=(t?r.doc.lines:1)&&(s+=t?1:-1);break}let l=Fi(i.text,s-i.from,t)+i.from,c=i.text.slice(Math.min(s,l)-i.from,Math.max(s,l)-i.from),d=o(c);if(a!=null&&d!=a)break;(c!=" "||s!=n.head)&&(a=d),s=l}return s}),fX=e=>hX(e,!1),N6e=e=>hX(e,!0),I6e=e=>Ib(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),R6e=e=>Ib(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),j6e=e=>Ib(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),L6e=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(s=>({changes:{from:s.from,to:s.to,insert:Is.of(["",""])},range:Be.cursor(s.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},D6e=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(s=>{if(!s.empty||s.from==0||s.from==e.doc.length)return{range:s};let r=s.from,i=e.doc.lineAt(r),o=r==i.from?r-1:Fi(i.text,r-i.from,!1)+i.from,a=r==i.to?r+1:Fi(i.text,r-i.from,!0)+i.from;return{changes:{from:o,to:a,insert:e.doc.slice(r,a).append(e.doc.slice(o,r))},range:Be.cursor(a)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function e4(e){let t=[],n=-1;for(let s of e.selection.ranges){let r=e.doc.lineAt(s.from),i=e.doc.lineAt(s.to);if(!s.empty&&s.to==i.from&&(i=e.doc.lineAt(s.to-1)),n>=r.number){let o=t[t.length-1];o.to=i.to,o.ranges.push(s)}else t.push({from:r.from,to:i.to,ranges:[s]});n=i.number+1}return t}function mX(e,t,n){if(e.readOnly)return!1;let s=[],r=[];for(let i of e4(e)){if(n?i.to==e.doc.length:i.from==0)continue;let o=e.doc.lineAt(n?i.to+1:i.from-1),a=o.length+1;if(n){s.push({from:i.to,to:o.to},{from:i.from,insert:o.text+e.lineBreak});for(let l of i.ranges)r.push(Be.range(Math.min(e.doc.length,l.anchor+a),Math.min(e.doc.length,l.head+a)))}else{s.push({from:o.from,to:i.from},{from:i.to,insert:e.lineBreak+o.text});for(let l of i.ranges)r.push(Be.range(l.anchor-a,l.head-a))}}return s.length?(t(e.update({changes:s,scrollIntoView:!0,selection:Be.create(r,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const O6e=({state:e,dispatch:t})=>mX(e,t,!1),P6e=({state:e,dispatch:t})=>mX(e,t,!0);function pX(e,t,n){if(e.readOnly)return!1;let s=[];for(let i of e4(e))n?s.push({from:i.from,insert:e.doc.slice(i.from,i.to)+e.lineBreak}):s.push({from:i.to,insert:e.lineBreak+e.doc.slice(i.from,i.to)});let r=e.changes(s);return t(e.update({changes:r,selection:e.selection.map(r,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const B6e=({state:e,dispatch:t})=>pX(e,t,!1),$6e=({state:e,dispatch:t})=>pX(e,t,!0),z6e=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(e4(t).map(({from:r,to:i})=>(r>0?r--:i<t.doc.length&&i++,{from:r,to:i}))),s=sg(t.selection,r=>{let i;if(e.lineWrapping){let o=e.lineBlockAt(r.head),a=e.coordsAtPos(r.head,r.assoc||1);a&&(i=o.bottom+e.documentTop-a.bottom+e.defaultLineHeight/2)}return e.moveVertically(r,!0,i)}).map(n);return e.dispatch({changes:n,selection:s,scrollIntoView:!0,userEvent:"delete.line"}),!0};function F6e(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=bo(e).resolveInner(t),s=n.childBefore(t),r=n.childAfter(t),i;return s&&r&&s.to<=t&&r.from>=t&&(i=s.type.prop(_s.closedBy))&&i.indexOf(r.name)>-1&&e.doc.lineAt(s.to).from==e.doc.lineAt(r.from).from&&!/\S/.test(e.sliceDoc(s.to,r.from))?{from:s.to,to:r.from}:null}const gP=gX(!1),q6e=gX(!0);function gX(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let s=t.changeByRange(r=>{let{from:i,to:o}=r,a=t.doc.lineAt(i),l=!e&&i==o&&F6e(t,i);e&&(i=o=(o<=a.to?a:t.doc.lineAt(o)).to);let c=new K_(t,{simulateBreak:i,simulateDoubleBreak:!!l}),d=l9(c,i);for(d==null&&(d=ng(/^\s*/.exec(t.doc.lineAt(i).text)[0],t.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;l?{from:i,to:o}=l:i>a.from&&i<a.from+100&&!/\S/.test(a.text.slice(0,i))&&(i=a.from);let h=["",By(t,d)];return l&&h.push(By(t,c.lineIndent(a.from,-1))),{changes:{from:i,to:o,insert:Is.of(h)},range:Be.cursor(i+1+h[1].length)}});return n(t.update(s,{scrollIntoView:!0,userEvent:"input"})),!0}}function m9(e,t){let n=-1;return e.changeByRange(s=>{let r=[];for(let o=s.from;o<=s.to;){let a=e.doc.lineAt(o);a.number>n&&(s.empty||s.to>a.from)&&(t(a,r,s),n=a.number),o=a.to+1}let i=e.changes(r);return{changes:r,range:Be.range(i.mapPos(s.anchor,1),i.mapPos(s.head,1))}})}const H6e=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),s=new K_(e,{overrideIndentation:i=>{let o=n[i];return o??-1}}),r=m9(e,(i,o,a)=>{let l=l9(s,i.from);if(l==null)return;/\S/.test(i.text)||(l=0);let c=/^\s*/.exec(i.text)[0],d=By(e,l);(c!=d||a.from<i.from+c.length)&&(n[i.from]=l,o.push({from:i.from,to:i.from+c.length,insert:d}))});return r.changes.empty||t(e.update(r,{userEvent:"indent"})),!0},U6e=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(m9(e,(n,s)=>{s.push({from:n.from,insert:e.facet(a9)})}),{userEvent:"input.indent"})),!0),V6e=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(m9(e,(n,s)=>{let r=/^\s*/.exec(n.text)[0];if(!r)return;let i=ng(r,e.tabSize),o=0,a=By(e,Math.max(0,i-u2(e)));for(;o<r.length&&o<a.length&&r.charCodeAt(o)==a.charCodeAt(o);)o++;s.push({from:n.from+o,to:n.from+r.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),W6e=e=>(e.setTabFocusMode(),!0),G6e=[{key:"Ctrl-b",run:GY,shift:nX,preventDefault:!0},{key:"Ctrl-f",run:KY,shift:sX},{key:"Ctrl-p",run:QY,shift:oX},{key:"Ctrl-n",run:JY,shift:aX},{key:"Ctrl-a",run:u6e,shift:k6e},{key:"Ctrl-e",run:d6e,shift:_6e},{key:"Ctrl-d",run:dX},{key:"Ctrl-h",run:L8},{key:"Ctrl-k",run:I6e},{key:"Ctrl-Alt-h",run:fX},{key:"Ctrl-o",run:L6e},{key:"Ctrl-t",run:D6e},{key:"Ctrl-v",run:j8}],K6e=[{key:"ArrowLeft",run:GY,shift:nX,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t6e,shift:m6e,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:l6e,shift:w6e,preventDefault:!0},{key:"ArrowRight",run:KY,shift:sX,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:n6e,shift:p6e,preventDefault:!0},{mac:"Cmd-ArrowRight",run:c6e,shift:x6e,preventDefault:!0},{key:"ArrowUp",run:QY,shift:oX,preventDefault:!0},{mac:"Cmd-ArrowUp",run:hP,shift:mP},{mac:"Ctrl-ArrowUp",run:cP,shift:uP},{key:"ArrowDown",run:JY,shift:aX,preventDefault:!0},{mac:"Cmd-ArrowDown",run:fP,shift:pP},{mac:"Ctrl-ArrowDown",run:j8,shift:dP},{key:"PageUp",run:cP,shift:uP},{key:"PageDown",run:j8,shift:dP},{key:"Home",run:a6e,shift:v6e,preventDefault:!0},{key:"Mod-Home",run:hP,shift:mP},{key:"End",run:o6e,shift:b6e,preventDefault:!0},{key:"Mod-End",run:fP,shift:pP},{key:"Enter",run:gP,shift:gP},{key:"Mod-a",run:S6e},{key:"Backspace",run:L8,shift:L8,preventDefault:!0},{key:"Delete",run:dX,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:fX,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:N6e,preventDefault:!0},{mac:"Mod-Backspace",run:R6e,preventDefault:!0},{mac:"Mod-Delete",run:j6e,preventDefault:!0}].concat(G6e.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),p9=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:r6e,shift:g6e},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:i6e,shift:y6e},{key:"Alt-ArrowUp",run:O6e},{key:"Shift-Alt-ArrowUp",run:B6e},{key:"Alt-ArrowDown",run:P6e},{key:"Shift-Alt-ArrowDown",run:$6e},{key:"Mod-Alt-ArrowUp",run:E6e},{key:"Mod-Alt-ArrowDown",run:A6e},{key:"Escape",run:M6e},{key:"Mod-Enter",run:q6e},{key:"Alt-l",mac:"Ctrl-l",run:C6e},{key:"Mod-i",run:T6e,preventDefault:!0},{key:"Mod-[",run:V6e},{key:"Mod-]",run:U6e},{key:"Mod-Alt-\\",run:H6e},{key:"Shift-Mod-k",run:z6e},{key:"Shift-Mod-\\",run:f6e},{key:"Mod-/",run:BCe},{key:"Alt-A",run:zCe},{key:"Ctrl-m",mac:"Shift-Alt-m",run:W6e}].concat(K6e);class yX{constructor(t,n,s,r){this.state=t,this.pos=n,this.explicit=s,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(t){let n=bo(this.state).resolveInner(this.pos,-1);for(;n&&t.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(t){let n=this.state.doc.lineAt(this.pos),s=Math.max(n.from,this.pos-250),r=n.text.slice(s-n.from,this.pos-n.from),i=r.search(bX(t,!1));return i<0?null:{from:s+i,to:this.pos,text:r.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(t,n,s){t=="abort"&&this.abortListeners&&(this.abortListeners.push(n),s&&s.onDocChange&&(this.abortOnDocChange=!0))}}function yP(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function Y6e(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let i=1;i<r.length;i++)n[r[i]]=!0}let s=yP(t)+yP(n)+"*$";return[new RegExp("^"+s),new RegExp(s)]}function X6e(e){let t=e.map(r=>typeof r=="string"?{label:r}:r),[n,s]=t.every(r=>/^\w+$/.test(r.label))?[/\w*$/,/\w+$/]:Y6e(t);return r=>{let i=r.matchBefore(s);return i||r.explicit?{from:i?i.from:r.pos,options:t,validFor:n}:null}}class bP{constructor(t,n,s,r){this.completion=t,this.source=n,this.match=s,this.score=r}}function Uf(e){return e.selection.main.from}function bX(e,t){var n;let{source:s}=e,r=t&&s[0]!="^",i=s[s.length-1]!="$";return!r&&!i?e:new RegExp(`${r?"^":""}(?:${s})${i?"$":""}`,(n=e.flags)!==null&&n!==void 0?n:e.ignoreCase?"i":"")}const vX=td.define();function Q6e(e,t,n,s){let{main:r}=e.selection,i=n-r.from,o=s-r.from;return{...e.changeByRange(a=>{if(a!=r&&n!=s&&e.sliceDoc(a.from+i,a.from+o)!=e.sliceDoc(n,s))return{range:a};let l=e.toText(t);return{changes:{from:a.from+i,to:s==r.from?a.to:a.from+o,insert:l},range:Be.cursor(a.from+i+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const vP=new WeakMap;function J6e(e){if(!Array.isArray(e))return e;let t=vP.get(e);return t||vP.set(e,t=X6e(e)),t}const m2=Pn.define(),$y=Pn.define();class Z6e{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n<t.length;){let s=Zo(t,n),r=pc(s);this.chars.push(s);let i=t.slice(n,n+r),o=i.toUpperCase();this.folded.push(Zo(o==i?i.toLowerCase():o,0)),n+=r}this.astral=t.length!=this.chars.length}ret(t,n){return this.score=t,this.matched=n,this}match(t){if(this.pattern.length==0)return this.ret(-100,[]);if(t.length<this.pattern.length)return null;let{chars:n,folded:s,any:r,precise:i,byWord:o}=this;if(n.length==1){let b=Zo(t,0),x=pc(b),k=x==t.length?0:-100;if(b!=n[0])if(b==s[0])k+=-200;else return null;return this.ret(k,[0,x])}let a=t.indexOf(this.pattern);if(a==0)return this.ret(t.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=n.length,c=0;if(a<0){for(let b=0,x=Math.min(t.length,200);b<x&&c<l;){let k=Zo(t,b);(k==n[c]||k==s[c])&&(r[c++]=b),b+=pc(k)}if(c<l)return null}let d=0,h=0,f=!1,p=0,g=-1,y=-1,w=/[a-z]/.test(t),v=!0;for(let b=0,x=Math.min(t.length,200),k=0;b<x&&h<l;){let T=Zo(t,b);a<0&&(d<l&&T==n[d]&&(i[d++]=b),p<l&&(T==n[p]||T==s[p]?(p==0&&(g=b),y=b+1,p++):p=0));let C,S=T<255?T>=48&&T<=57||T>=97&&T<=122?2:T>=65&&T<=90?1:0:(C=$A(T))!=C.toLowerCase()?1:C!=C.toUpperCase()?2:0;(!b||S==1&&w||k==0&&S!=0)&&(n[h]==T||s[h]==T&&(f=!0)?o[h++]=b:o.length&&(v=!1)),k=S,b+=pc(T)}return h==l&&o[0]==0&&v?this.result(-100+(f?-200:0),o,t):p==l&&g==0?this.ret(-200-t.length+(y==t.length?0:-100),[0,y]):a>-1?this.ret(-700-t.length,[a,a+this.pattern.length]):p==l?this.ret(-900-t.length,[g,y]):h==l?this.result(-100+(f?-200:0)+-700+(v?0:-1100),o,t):n.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,t)}result(t,n,s){let r=[],i=0;for(let o of n){let a=o+(this.astral?pc(Zo(s,o)):1);i&&r[i-1]==o?r[i-1]=a:(r[i++]=o,r[i++]=a)}return this.ret(t-s.length,r)}}class eTe{constructor(t){this.pattern=t,this.matched=[],this.score=0,this.folded=t.toLowerCase()}match(t){if(t.length<this.pattern.length)return null;let n=t.slice(0,this.pattern.length),s=n==this.pattern?0:n.toLowerCase()==this.folded?-200:null;return s==null?null:(this.matched=[0,n.length],this.score=s+(t.length==this.pattern.length?0:-100),this)}}const zi=Ut.define({combine(e){return Vc(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:tTe,filterStrict:!1,compareCompletions:(t,n)=>(t.sortText||t.label).localeCompare(n.sortText||n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(t,n)=>t&&n,closeOnBlur:(t,n)=>t&&n,icons:(t,n)=>t&&n,tooltipClass:(t,n)=>s=>wP(t(s),n(s)),optionClass:(t,n)=>s=>wP(t(s),n(s)),addToOptions:(t,n)=>t.concat(n),filterStrict:(t,n)=>t||n})}});function wP(e,t){return e?t?e+" "+t:e:t}function tTe(e,t,n,s,r,i){let o=e.textDirection==cr.RTL,a=o,l=!1,c="top",d,h,f=t.left-r.left,p=r.right-t.right,g=s.right-s.left,y=s.bottom-s.top;if(a&&f<Math.min(g,p)?a=!1:!a&&p<Math.min(g,f)&&(a=!0),g<=(a?f:p))d=Math.max(r.top,Math.min(n.top,r.bottom-y))-t.top,h=Math.min(400,a?f:p);else{l=!0,h=Math.min(400,(o?t.right:r.right-t.left)-30);let b=r.bottom-t.bottom;b>=y||b>t.top?d=n.bottom-t.top:(c="bottom",d=t.bottom-n.top)}let w=(t.bottom-t.top)/i.offsetHeight,v=(t.right-t.left)/i.offsetWidth;return{style:`${c}: ${d/w}px; max-width: ${h/v}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}const g9=Pn.define();function nTe(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(n){let s=document.createElement("div");return s.classList.add("cm-completionIcon"),n.type&&s.classList.add(...n.type.split(/\s+/g).map(r=>"cm-completionIcon-"+r)),s.setAttribute("aria-hidden","true"),s},position:20}),t.push({render(n,s,r,i){let o=document.createElement("span");o.className="cm-completionLabel";let a=n.displayLabel||n.label,l=0;for(let c=0;c<i.length;){let d=i[c++],h=i[c++];d>l&&o.appendChild(document.createTextNode(a.slice(l,d)));let f=o.appendChild(document.createElement("span"));f.appendChild(document.createTextNode(a.slice(d,h))),f.className="cm-completionMatchedText",l=h}return l<a.length&&o.appendChild(document.createTextNode(a.slice(l))),o},position:50},{render(n){if(!n.detail)return null;let s=document.createElement("span");return s.className="cm-completionDetail",s.textContent=n.detail,s},position:80}),t.sort((n,s)=>n.position-s.position).map(n=>n.render)}function D5(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let r=Math.floor(t/n);return{from:r*n,to:(r+1)*n}}let s=Math.ceil((e-t)/n);return{from:e-s*n,to:e-(s-1)*n}}class sTe{constructor(t,n,s){this.view=t,this.stateField=n,this.applyCompletion=s,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let r=t.state.field(n),{options:i,selected:o}=r.open,a=t.state.facet(zi);this.optionContent=nTe(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=D5(i.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",l=>{let{options:c}=t.state.field(n).open;for(let d=l.target,h;d&&d!=this.dom;d=d.parentNode)if(d.nodeName=="LI"&&(h=/-(\d+)$/.exec(d.id))&&+h[1]<c.length){this.applyCompletion(t,c[+h[1]]),l.preventDefault();return}if(l.target==this.list){let d=this.list.classList.contains("cm-completionListIncompleteTop")&&l.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&l.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;d!=null&&(t.dispatch({effects:g9.of(d)}),l.preventDefault())}}),this.dom.addEventListener("focusout",l=>{let c=t.state.field(this.stateField,!1);c&&c.tooltip&&t.state.facet(zi).closeOnBlur&&l.relatedTarget!=t.contentDOM&&t.dispatch({effects:$y.of(null)})}),this.showOptions(i,r.id)}mount(){this.updateSel()}showOptions(t,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(t){var n;let s=t.state.field(this.stateField),r=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),s!=r){let{options:i,selected:o,disabled:a}=s.open;(!r.open||r.open.options!=i)&&(this.range=D5(i.length,o,t.state.facet(zi).maxRenderedOptions),this.showOptions(i,s.id)),this.updateSel(),a!=((n=r.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(t){let n=this.tooltipClass(t);if(n!=this.currentClass){for(let s of this.currentClass.split(" "))s&&this.dom.classList.remove(s);for(let s of n.split(" "))s&&this.dom.classList.add(s);this.currentClass=n}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),n=t.open;(n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=D5(n.options.length,n.selected,this.view.state.facet(zi).maxRenderedOptions),this.showOptions(n.options,t.id));let s=this.updateSelectedOption(n.selected);if(s){this.destroyInfo();let{completion:r}=n.options[n.selected],{info:i}=r;if(!i)return;let o=typeof i=="string"?document.createTextNode(i):i(r);if(!o)return;"then"in o?o.then(a=>{a&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(a,r)}).catch(a=>ta(this.view.state,a,"completion info")):(this.addInfoPane(o,r),s.setAttribute("aria-describedby",this.info.id))}}addInfoPane(t,n){this.destroyInfo();let s=this.info=document.createElement("div");if(s.className="cm-tooltip cm-completionInfo",s.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),t.nodeType!=null)s.appendChild(t),this.infoDestroy=null;else{let{dom:r,destroy:i}=t;s.appendChild(r),this.infoDestroy=i||null}this.dom.appendChild(s),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let n=null;for(let s=this.list.firstChild,r=this.range.from;s;s=s.nextSibling,r++)s.nodeName!="LI"||!s.id?r--:r==t?s.hasAttribute("aria-selected")||(s.setAttribute("aria-selected","true"),n=s):s.hasAttribute("aria-selected")&&(s.removeAttribute("aria-selected"),s.removeAttribute("aria-describedby"));return n&&iTe(this.list,n),n}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let n=this.dom.getBoundingClientRect(),s=this.info.getBoundingClientRect(),r=t.getBoundingClientRect(),i=this.space;if(!i){let o=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return r.top>Math.min(i.bottom,n.bottom)-10||r.bottom<Math.max(i.top,n.top)+10?null:this.view.state.facet(zi).positionInfo(this.view,n,r,s,i,this.dom)}placeInfo(t){this.info&&(t?(t.style&&(this.info.style.cssText=t.style),this.info.className="cm-tooltip cm-completionInfo "+(t.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(t,n,s){const r=document.createElement("ul");r.id=n,r.setAttribute("role","listbox"),r.setAttribute("aria-expanded","true"),r.setAttribute("aria-label",this.view.state.phrase("Completions")),r.addEventListener("mousedown",o=>{o.target==r&&o.preventDefault()});let i=null;for(let o=s.from;o<s.to;o++){let{completion:a,match:l}=t[o],{section:c}=a;if(c){let f=typeof c=="string"?c:c.name;if(f!=i&&(o>s.from||s.from==0))if(i=f,typeof c!="string"&&c.header)r.appendChild(c.header(c));else{let p=r.appendChild(document.createElement("completion-section"));p.textContent=f}}const d=r.appendChild(document.createElement("li"));d.id=n+"-"+o,d.setAttribute("role","option");let h=this.optionClass(a);h&&(d.className=h);for(let f of this.optionContent){let p=f(a,this.view.state,this.view,l);p&&d.appendChild(p)}}return s.from&&r.classList.add("cm-completionListIncompleteTop"),s.to<t.length&&r.classList.add("cm-completionListIncompleteBottom"),r}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function rTe(e,t){return n=>new sTe(n,e,t)}function iTe(e,t){let n=e.getBoundingClientRect(),s=t.getBoundingClientRect(),r=n.height/e.offsetHeight;s.top<n.top?e.scrollTop-=(n.top-s.top)/r:s.bottom>n.bottom&&(e.scrollTop+=(s.bottom-n.bottom)/r)}function xP(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function oTe(e,t){let n=[],s=null,r=null,i=d=>{n.push(d);let{section:h}=d.completion;if(h){s||(s=[]);let f=typeof h=="string"?h:h.name;s.some(p=>p.name==f)||s.push(typeof h=="string"?{name:f}:h)}},o=t.facet(zi);for(let d of e)if(d.hasResult()){let h=d.result.getMatch;if(d.result.filter===!1)for(let f of d.result.options)i(new bP(f,d.source,h?h(f):[],1e9-n.length));else{let f=t.sliceDoc(d.from,d.to),p,g=o.filterStrict?new eTe(f):new Z6e(f);for(let y of d.result.options)if(p=g.match(y.label)){let w=y.displayLabel?h?h(y,p.matched):[]:p.matched,v=p.score+(y.boost||0);if(i(new bP(y,d.source,w,v)),typeof y.section=="object"&&y.section.rank==="dynamic"){let{name:b}=y.section;r||(r=Object.create(null)),r[b]=Math.max(v,r[b]||-1e9)}}}}if(s){let d=Object.create(null),h=0,f=(p,g)=>(p.rank==="dynamic"&&g.rank==="dynamic"?r[g.name]-r[p.name]:0)||(typeof p.rank=="number"?p.rank:1e9)-(typeof g.rank=="number"?g.rank:1e9)||(p.name<g.name?-1:1);for(let p of s.sort(f))h-=1e5,d[p.name]=h;for(let p of n){let{section:g}=p.completion;g&&(p.score+=d[typeof g=="string"?g:g.name])}}let a=[],l=null,c=o.compareCompletions;for(let d of n.sort((h,f)=>f.score-h.score||c(h.completion,f.completion))){let h=d.completion;!l||l.label!=h.label||l.detail!=h.detail||l.type!=null&&h.type!=null&&l.type!=h.type||l.apply!=h.apply||l.boost!=h.boost?a.push(d):xP(d.completion)>xP(l)&&(a[a.length-1]=d),l=d.completion}return a}class jp{constructor(t,n,s,r,i,o){this.options=t,this.attrs=n,this.tooltip=s,this.timestamp=r,this.selected=i,this.disabled=o}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new jp(this.options,kP(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,s,r,i,o){if(r&&!o&&t.some(c=>c.isPending))return r.setDisabled();let a=oTe(t,n);if(!a.length)return r&&t.some(c=>c.isPending)?r.setDisabled():null;let l=n.facet(zi).selectOnOpen?0:-1;if(r&&r.selected!=l&&r.selected!=-1){let c=r.options[r.selected].completion;for(let d=0;d<a.length;d++)if(a[d].completion==c){l=d;break}}return new jp(a,kP(s,l),{pos:t.reduce((c,d)=>d.hasResult()?Math.min(c,d.from):c,1e8),create:hTe,above:i.aboveCursor},r?r.timestamp:Date.now(),l,!1)}map(t){return new jp(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new jp(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class p2{constructor(t,n,s){this.active=t,this.id=n,this.open=s}static start(){return new p2(uTe,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,s=n.facet(zi),i=(s.override||n.languageDataAt("autocomplete",Uf(n)).map(J6e)).map(l=>(this.active.find(d=>d.source==l)||new pl(l,this.active.some(d=>d.state!=0)?1:0)).update(t,s));i.length==this.active.length&&i.every((l,c)=>l==this.active[c])&&(i=this.active);let o=this.open,a=t.effects.some(l=>l.is(y9));o&&t.docChanged&&(o=o.map(t.changes)),t.selection||i.some(l=>l.hasResult()&&t.changes.touchesRange(l.from,l.to))||!aTe(i,this.active)||a?o=jp.build(i,n,this.id,o,s,a):o&&o.disabled&&!i.some(l=>l.isPending)&&(o=null),!o&&i.every(l=>!l.isPending)&&i.some(l=>l.hasResult())&&(i=i.map(l=>l.hasResult()?new pl(l.source,0):l));for(let l of t.effects)l.is(g9)&&(o=o&&o.setSelected(l.value,this.id));return i==this.active&&o==this.open?this:new p2(i,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?lTe:cTe}}function aTe(e,t){if(e==t)return!0;for(let n=0,s=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;s<t.length&&!t[s].hasResult();)s++;let r=n==e.length,i=s==t.length;if(r||i)return r==i;if(e[n++].result!=t[s++].result)return!1}}const lTe={"aria-autocomplete":"list"},cTe={};function kP(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const uTe=[];function wX(e,t){if(e.isUserEvent("input.complete")){let s=e.annotation(vX);if(s&&t.activateOnCompletion(s))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class pl{constructor(t,n,s=!1){this.source=t,this.state=n,this.explicit=s}hasResult(){return!1}get isPending(){return this.state==1}update(t,n){let s=wX(t,n),r=this;(s&8||s&16&&this.touches(t))&&(r=new pl(r.source,0)),s&4&&r.state==0&&(r=new pl(this.source,1)),r=r.updateFor(t,s);for(let i of t.effects)if(i.is(m2))r=new pl(r.source,1,i.value);else if(i.is($y))r=new pl(r.source,0);else if(i.is(y9))for(let o of i.value)o.source==r.source&&(r=o);return r}updateFor(t,n){return this.map(t.changes)}map(t){return this}touches(t){return t.changes.touchesRange(Uf(t.state))}}class Zp extends pl{constructor(t,n,s,r,i,o){super(t,3,n),this.limit=s,this.result=r,this.from=i,this.to=o}hasResult(){return!0}updateFor(t,n){var s;if(!(n&3))return this.map(t.changes);let r=this.result;r.map&&!t.changes.empty&&(r=r.map(r,t.changes));let i=t.changes.mapPos(this.from),o=t.changes.mapPos(this.to,1),a=Uf(t.state);if(a>o||!r||n&2&&(Uf(t.startState)==this.from||a<this.limit))return new pl(this.source,n&4?1:0);let l=t.changes.mapPos(this.limit);return dTe(r.validFor,t.state,i,o)?new Zp(this.source,this.explicit,l,r,i,o):r.update&&(r=r.update(r,i,o,new yX(t.state,a,!1)))?new Zp(this.source,this.explicit,l,r,r.from,(s=r.to)!==null&&s!==void 0?s:Uf(t.state)):new pl(this.source,1,this.explicit)}map(t){if(t.empty)return this;let n=this.result.map?this.result.map(this.result,t):this.result;return n?new Zp(this.source,this.explicit,t.mapPos(this.limit),n,t.mapPos(this.from),t.mapPos(this.to,1)):new pl(this.source,0)}touches(t){return t.changes.touchesRange(this.from,this.to)}}function dTe(e,t,n,s){if(!e)return!1;let r=t.sliceDoc(n,s);return typeof e=="function"?e(r,n,s,t):bX(e,!0).test(r)}const y9=Pn.define({map(e,t){return e.map(n=>n.map(t))}}),Ro=ao.define({create(){return p2.start()},update(e,t){return e.update(t)},provide:e=>[n9.from(e,t=>t.tooltip),yt.contentAttributes.from(e,t=>t.attrs)]});function b9(e,t){const n=t.completion.apply||t.completion.label;let s=e.state.field(Ro).active.find(r=>r.source==t.source);return s instanceof Zp?(typeof n=="string"?e.dispatch({...Q6e(e.state,n,s.from,s.to),annotations:vX.of(t.completion)}):n(e,t.completion,s.from,s.to),!0):!1}const hTe=rTe(Ro,b9);function Yd(e,t="option"){return n=>{let s=n.state.field(Ro,!1);if(!s||!s.open||s.open.disabled||Date.now()-s.open.timestamp<n.state.facet(zi).interactionDelay)return!1;let r=1,i;t=="page"&&(i=mY(n,s.open.tooltip))&&(r=Math.max(2,Math.floor(i.dom.offsetHeight/i.dom.querySelector("li").offsetHeight)-1));let{length:o}=s.open.options,a=s.open.selected>-1?s.open.selected+r*(e?1:-1):e?0:o-1;return a<0?a=t=="page"?0:o-1:a>=o&&(a=t=="page"?o-1:0),n.dispatch({effects:g9.of(a)}),!0}}const xX=e=>{let t=e.state.field(Ro,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(zi).interactionDelay?!1:b9(e,t.open.options[t.open.selected])},Rx=e=>e.state.field(Ro,!1)?(e.dispatch({effects:m2.of(!0)}),!0):!1,jx=e=>{let t=e.state.field(Ro,!1);return!t||!t.active.some(n=>n.state!=0)?!1:(e.dispatch({effects:$y.of(null)}),!0)};class fTe{constructor(t,n){this.active=t,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const mTe=50,pTe=1e3,gTe=Ir.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(Ro).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(Ro),n=e.state.facet(zi);if(!e.selectionSet&&!e.docChanged&&e.startState.field(Ro)==t)return;let s=e.transactions.some(i=>{let o=wX(i,n);return o&8||(i.selection||i.docChanged)&&!(o&3)});for(let i=0;i<this.running.length;i++){let o=this.running[i];if(s||o.context.abortOnDocChange&&e.docChanged||o.updates.length+e.transactions.length>mTe&&Date.now()-o.time>pTe){for(let a of o.context.abortListeners)try{a()}catch(l){ta(this.view.state,l)}o.context.abortListeners=null,this.running.splice(i--,1)}else o.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(i=>i.effects.some(o=>o.is(m2)))&&(this.pendingStart=!0);let r=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(i=>i.isPending&&!this.running.some(o=>o.active.source==i.source))?setTimeout(()=>this.startUpdate(),r):-1,this.composing!=0)for(let i of e.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(Ro);for(let n of t.active)n.isPending&&!this.running.some(s=>s.active.source==n.source)&&this.startQuery(n);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(zi).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=Uf(t),s=new yX(t,n,e.explicit,this.view),r=new fTe(e,s);this.running.push(r),Promise.resolve(e.source(s)).then(i=>{r.context.aborted||(r.done=i||null,this.scheduleAccept())},i=>{this.view.dispatch({effects:$y.of(null)}),ta(this.view.state,i)})}scheduleAccept(){this.running.every(e=>e.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(zi).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(zi),s=this.view.state.field(Ro);for(let r=0;r<this.running.length;r++){let i=this.running[r];if(i.done===void 0)continue;if(this.running.splice(r--,1),i.done){let a=Uf(i.updates.length?i.updates[0].startState:this.view.state),l=Math.min(a,i.done.from+(i.active.explicit?0:1)),c=new Zp(i.active.source,i.active.explicit,l,i.done,i.done.from,(e=i.done.to)!==null&&e!==void 0?e:a);for(let d of i.updates)c=c.update(d,n);if(c.hasResult()){t.push(c);continue}}let o=s.active.find(a=>a.source==i.active.source);if(o&&o.isPending)if(i.done==null){let a=new pl(i.active.source,0);for(let l of i.updates)a=a.update(l,n);a.isPending||t.push(a)}else this.startQuery(o)}(t.length||s.open&&s.open.disabled)&&this.view.dispatch({effects:y9.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(Ro,!1);if(t&&t.tooltip&&this.view.state.facet(zi).closeOnBlur){let n=t.open&&mY(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:$y.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:m2.of(!1)}),20),this.composing=0}}}),yTe=typeof navigator=="object"&&/Win/.test(navigator.platform),bTe=Bh.highest(yt.domEventHandlers({keydown(e,t){let n=t.state.field(Ro,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(yTe&&e.altKey)||e.metaKey)return!1;let s=n.open.options[n.open.selected],r=n.active.find(o=>o.source==s.source),i=s.completion.commitCharacters||r.result.commitCharacters;return i&&i.indexOf(e.key)>-1&&b9(t,s),!1}})),vTe=yt.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"}}}),zy={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Rf=Pn.define({map(e,t){let n=t.mapPos(e,-1,Lo.TrackAfter);return n??void 0}}),v9=new class extends wh{};v9.startSide=1;v9.endSide=-1;const kX=ao.define({create(){return ms.empty},update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:s=>s>=n.from&&s<=n.to})}for(let n of t.effects)n.is(Rf)&&(e=e.update({add:[v9.range(n.value,n.value+1)]}));return e}});function wTe(){return[kTe,kX]}const O5="()[]{}<>«»»«［］｛｝";function _X(e){for(let t=0;t<O5.length;t+=2)if(O5.charCodeAt(t)==e)return O5.charAt(t+1);return $A(e<128?e:e+1)}function SX(e,t){return e.languageDataAt("closeBrackets",t)[0]||zy}const xTe=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),kTe=yt.inputHandler.of((e,t,n,s)=>{if((xTe?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let r=e.state.selection.main;if(s.length>2||s.length==2&&pc(Zo(s,0))==1||t!=r.from||n!=r.to)return!1;let i=CTe(e.state,s);return i?(e.dispatch(i),!0):!1}),_Te=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let s=SX(e,e.selection.main.head).brackets||zy.brackets,r=null,i=e.changeByRange(o=>{if(o.empty){let a=TTe(e.doc,o.head);for(let l of s)if(l==a&&t4(e.doc,o.head)==_X(Zo(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:Be.cursor(o.head-l.length)}}return{range:r=o}});return r||t(e.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!r},STe=[{key:"Backspace",run:_Te}];function CTe(e,t){let n=SX(e,e.selection.main.head),s=n.brackets||zy.brackets;for(let r of s){let i=_X(Zo(r,0));if(t==r)return i==r?MTe(e,r,s.indexOf(r+r+r)>-1,n):ETe(e,r,i,n.before||zy.before);if(t==i&&CX(e,e.selection.main.from))return ATe(e,r,i)}return null}function CX(e,t){let n=!1;return e.field(kX).between(0,e.doc.length,s=>{s==t&&(n=!0)}),n}function t4(e,t){let n=e.sliceString(t,t+2);return n.slice(0,pc(Zo(n,0)))}function TTe(e,t){let n=e.sliceString(t-2,t);return pc(Zo(n,0))==n.length?n:n.slice(1)}function ETe(e,t,n,s){let r=null,i=e.changeByRange(o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:n,from:o.to}],effects:Rf.of(o.to+t.length),range:Be.range(o.anchor+t.length,o.head+t.length)};let a=t4(e.doc,o.head);return!a||/\s/.test(a)||s.indexOf(a)>-1?{changes:{insert:t+n,from:o.head},effects:Rf.of(o.head+t.length),range:Be.cursor(o.head+t.length)}:{range:r=o}});return r?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function ATe(e,t,n){let s=null,r=e.changeByRange(i=>i.empty&&t4(e.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:Be.cursor(i.head+n.length)}:s={range:i});return s?null:e.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function MTe(e,t,n,s){let r=s.stringPrefixes||zy.stringPrefixes,i=null,o=e.changeByRange(a=>{if(!a.empty)return{changes:[{insert:t,from:a.from},{insert:t,from:a.to}],effects:Rf.of(a.to+t.length),range:Be.range(a.anchor+t.length,a.head+t.length)};let l=a.head,c=t4(e.doc,l),d;if(c==t){if(_P(e,l))return{changes:{insert:t+t,from:l},effects:Rf.of(l+t.length),range:Be.cursor(l+t.length)};if(CX(e,l)){let f=n&&e.sliceDoc(l,l+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:l,to:l+f.length,insert:f},range:Be.cursor(l+f.length)}}}else{if(n&&e.sliceDoc(l-2*t.length,l)==t+t&&(d=SP(e,l-2*t.length,r))>-1&&_P(e,d))return{changes:{insert:t+t+t+t,from:l},effects:Rf.of(l+t.length),range:Be.cursor(l+t.length)};if(e.charCategorizer(l)(c)!=Mr.Word&&SP(e,l,r)>-1&&!NTe(e,l,t,r))return{changes:{insert:t+t,from:l},effects:Rf.of(l+t.length),range:Be.cursor(l+t.length)}}return{range:i=a}});return i?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function _P(e,t){let n=bo(e).resolveInner(t+1);return n.parent&&n.from==t}function NTe(e,t,n,s){let r=bo(e).resolveInner(t,-1),i=s.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=e.sliceDoc(r.from,Math.min(r.to,r.from+n.length+i)),l=a.indexOf(n);if(!l||l>-1&&s.indexOf(a.slice(0,l))>-1){let d=r.firstChild;for(;d&&d.from==r.from&&d.to-d.from>n.length+l;){if(e.sliceDoc(d.to-n.length,d.to)==n)return!1;d=d.firstChild}return!0}let c=r.to==t&&r.parent;if(!c)break;r=c}return!1}function SP(e,t,n){let s=e.charCategorizer(t);if(s(e.sliceDoc(t-1,t))!=Mr.Word)return t;for(let r of n){let i=t-r.length;if(e.sliceDoc(i,t)==r&&s(e.sliceDoc(i-1,i))!=Mr.Word)return i}return-1}function TX(e={}){return[bTe,Ro,zi.of(e),gTe,ITe,vTe]}const EX=[{key:"Ctrl-Space",run:Rx},{mac:"Alt-`",run:Rx},{mac:"Alt-i",run:Rx},{key:"Escape",run:jx},{key:"ArrowDown",run:Yd(!0)},{key:"ArrowUp",run:Yd(!1)},{key:"PageDown",run:Yd(!0,"page")},{key:"PageUp",run:Yd(!1,"page")},{key:"Enter",run:xX}],ITe=Bh.highest(E0.computeN([zi],e=>e.facet(zi).defaultKeymap?[EX]:[]));function ma(e){let t=e.field(Ro,!1);return t&&t.active.some(n=>n.isPending)?"pending":t&&t.active.some(n=>n.state!=0)?"active":null}const CP=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class N0{constructor(t,n,s=0,r=t.length,i,o){this.test=o,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(s,r),this.bufferStart=s,this.normalize=i?a=>i(CP(a)):CP,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Zo(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let n=$A(t),s=this.bufferStart+this.bufferPos;this.bufferPos+=pc(t);let r=this.normalize(n);if(r.length)for(let i=0,o=s,a=!0;;i++){let l=r.charCodeAt(i),c=this.match(l,o,a,this.bufferPos+this.bufferStart,i==r.length-1);if(c)return this.value=c,this;if(i==r.length-1)break;a&&i<n.length&&n.charCodeAt(i)==l?o++:a=!1}}}match(t,n,s,r,i){let o=null;for(let a=0;a<this.matches.length;){let l=this.matches[a],c=!1;this.query.charCodeAt(l.index)==t&&(l.index==this.query.length-1?o={from:l.from,to:r,precise:i&&l.precise}:(l.index++,c=!0)),c?a++:this.matches.splice(a,1)}return this.query.charCodeAt(0)==t&&(this.query.length==1?o={from:n,to:r,precise:s&&i}:this.matches.push({from:n,index:1,precise:s})),o&&this.test&&!this.test(o.from,o.to,this.buffer,this.bufferStart)&&(o=null),o}}typeof Symbol<"u"&&(N0.prototype[Symbol.iterator]=function(){return this});const AX={from:-1,to:-1,match:/.*/.exec(""),precise:!0},w9="gm"+(/x/.unicode==null?"":"u");class MX{constructor(t,n,s,r=0,i=t.length){if(this.text=t,this.to=i,this.curLine="",this.done=!1,this.value=AX,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new NX(t,n,s,r,i);this.re=new RegExp(n,w9+(s!=null&&s.ignoreCase?"i":"")),this.test=s==null?void 0:s.test,this.iter=t.iter();let o=t.lineAt(r);this.curLineStart=o.from,this.matchPos=g2(t,r),this.getLine(this.curLineStart)}getLine(t){this.iter.next(t),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let s=this.curLineStart+n.index,r=s+n[0].length;if(this.matchPos=g2(this.text,r+(s==r?1:0)),s==this.curLineStart+this.curLine.length&&this.nextLine(),(s<r||s>this.value.to)&&(!this.test||this.test(s,r,n)))return this.value={from:s,to:r,precise:!0,match:n},this;t=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),t=0;else return this.done=!0,this}}}const P5=new WeakMap;class e0{constructor(t,n){this.from=t,this.text=n}get to(){return this.from+this.text.length}static get(t,n,s){let r=P5.get(t);if(!r||r.from>=s||r.to<=n){let a=new e0(n,t.sliceString(n,s));return P5.set(t,a),a}if(r.from==n&&r.to==s)return r;let{text:i,from:o}=r;return o>n&&(i=t.sliceString(n,o)+i,o=n),r.to<s&&(i+=t.sliceString(r.to,s)),P5.set(t,new e0(o,i)),new e0(n,i.slice(n-o,s-o))}}class NX{constructor(t,n,s,r,i){this.text=t,this.to=i,this.done=!1,this.value=AX,this.matchPos=g2(t,r),this.re=new RegExp(n,w9+(s!=null&&s.ignoreCase?"i":"")),this.test=s==null?void 0:s.test,this.flat=e0.get(t,r,this.chunkEnd(r+5e3))}chunkEnd(t){return t>=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==t&&(this.re.lastIndex=t+1,n=this.re.exec(this.flat.text)),n){let s=this.flat.from+n.index,r=s+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(s,r,n)))return this.value={from:s,to:r,precise:!0,match:n},this.matchPos=g2(this.text,r+(s==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=e0.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(MX.prototype[Symbol.iterator]=NX.prototype[Symbol.iterator]=function(){return this});function RTe(e){try{return new RegExp(e,w9),!0}catch{return!1}}function g2(e,t){if(t>=e.length)return t;let n=e.lineAt(t),s;for(;t<n.to&&(s=n.text.charCodeAt(t-n.from))>=56320&&s<57344;)t++;return t}const jTe=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:s,result:r}=p5e(e,{label:t.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:t.phrase("go")});return r.then(i=>{let o=i&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(i.elements.line.value);if(!o){e.dispatch({effects:s});return}let a=t.doc.lineAt(t.selection.main.head),[,l,c,d,h]=o,f=d?+d.slice(1):0,p=c?+c:a.number;if(c&&h){let w=p/100;l&&(w=w*(l=="-"?-1:1)+a.number/t.doc.lines),p=Math.round(t.doc.lines*w)}else c&&l&&(p=p*(l=="-"?-1:1)+a.number);let g=t.doc.line(Math.max(1,Math.min(t.doc.lines,p))),y=Be.cursor(g.from+Math.max(0,Math.min(f,g.length)));e.dispatch({effects:[s,yt.scrollIntoView(y.from,{y:"center"})],selection:y})}),!0},LTe={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},DTe=Ut.define({combine(e){return Vc(e,LTe,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function OTe(e){return[FTe,zTe]}const PTe=sn.mark({class:"cm-selectionMatch"}),BTe=sn.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function TP(e,t,n,s){return(n==0||e(t.sliceDoc(n-1,n))!=Mr.Word)&&(s==t.doc.length||e(t.sliceDoc(s,s+1))!=Mr.Word)}function $Te(e,t,n,s){return e(t.sliceDoc(n,n+1))==Mr.Word&&e(t.sliceDoc(s-1,s))==Mr.Word}const zTe=Ir.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(DTe),{state:n}=e,s=n.selection;if(s.ranges.length>1)return sn.none;let r=s.main,i,o=null;if(r.empty){if(!t.highlightWordAroundCursor)return sn.none;let l=n.wordAt(r.head);if(!l)return sn.none;o=n.charCategorizer(r.head),i=n.sliceDoc(l.from,l.to)}else{let l=r.to-r.from;if(l<t.minSelectionLength||l>200)return sn.none;if(t.wholeWords){if(i=n.sliceDoc(r.from,r.to),o=n.charCategorizer(r.head),!(TP(o,n,r.from,r.to)&&$Te(o,n,r.from,r.to)))return sn.none}else if(i=n.sliceDoc(r.from,r.to),!i)return sn.none}let a=[];for(let l of e.visibleRanges){let c=new N0(n.doc,i,l.from,l.to);for(;!c.next().done;){let{from:d,to:h}=c.value;if((!o||TP(o,n,d,h))&&(r.empty&&d<=r.from&&h>=r.to?a.push(BTe.range(d,h)):(d>=r.to||h<=r.from)&&a.push(PTe.range(d,h)),a.length>t.maxMatches))return sn.none}}return sn.set(a)}},{decorations:e=>e.decorations}),FTe=yt.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),qTe=({state:e,dispatch:t})=>{let{selection:n}=e,s=Be.create(n.ranges.map(r=>e.wordAt(r.head)||Be.cursor(r.head)),n.mainIndex);return s.eq(n)?!1:(t(e.update({selection:s})),!0)};function HTe(e,t){let{main:n,ranges:s}=e.selection,r=e.wordAt(n.head),i=r&&r.from==n.from&&r.to==n.to;for(let o=!1,a=new N0(e.doc,t,s[s.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new N0(e.doc,t,0,Math.max(0,s[s.length-1].from-1)),o=!0}else{if(o&&s.some(l=>l.from==a.value.from))continue;if(i){let l=e.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const UTe=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(i=>i.from===i.to))return qTe({state:e,dispatch:t});let s=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(i=>e.sliceDoc(i.from,i.to)!=s))return!1;let r=HTe(e,s);return r?(t(e.update({selection:e.selection.addRange(Be.range(r.from,r.to),!1),effects:yt.scrollIntoView(r.to)})),!0):!1},rg=Ut.define({combine(e){return Vc(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new r8e(t),scrollToMatch:t=>yt.scrollIntoView(t)})}});class IX{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||RTe(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord,this.test=t.test}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,(n,s)=>s=="n"?`
`:s=="r"?"\r":s=="t"?"	":"\\")}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord&&this.test==t.test}create(){return this.regexp?new XTe(this):new GTe(this)}getCursor(t,n=0,s){let r=t.doc?t:ws.create({doc:t});return s==null&&(s=r.doc.length),this.regexp?yp(this,r,n,s):gp(this,r,n,s)}}class RX{constructor(t){this.spec=t}}function VTe(e,t,n){return(s,r,i,o)=>{if(n&&!n(s,r,i,o))return!1;let a=s>=o&&r<=o+i.length?i.slice(s-o,r-o):t.doc.sliceString(s,r);return e(a,t,s,r)}}function gp(e,t,n,s){let r;return e.wholeWord&&(r=WTe(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(r=VTe(e.test,t,r)),new N0(t.doc,e.unquoted,n,s,e.caseSensitive?void 0:i=>i.toLowerCase(),r)}function WTe(e,t){return(n,s,r,i)=>((i>n||i+r.length<s)&&(i=Math.max(0,n-2),r=e.sliceString(i,Math.min(e.length,s+2))),(t(y2(r,n-i))!=Mr.Word||t(b2(r,n-i))!=Mr.Word)&&(t(b2(r,s-i))!=Mr.Word||t(y2(r,s-i))!=Mr.Word))}class GTe extends RX{constructor(t){super(t)}nextMatch(t,n,s){let r=gp(this.spec,t,s,t.doc.length).nextOverlapping();if(r.done){let i=Math.min(t.doc.length,n+this.spec.unquoted.length);r=gp(this.spec,t,0,i).nextOverlapping()}return r.done||r.value.from==n&&r.value.to==s?null:r.value}prevMatchInRange(t,n,s){for(let r=s;;){let i=Math.max(n,r-1e4-this.spec.unquoted.length),o=gp(this.spec,t,i,r),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(i==n)return null;r-=1e4}}prevMatch(t,n,s){let r=this.prevMatchInRange(t,0,n);return r||(r=this.prevMatchInRange(t,Math.max(0,s-this.spec.unquoted.length),t.doc.length)),r&&(r.from!=n||r.to!=s)?r:null}getReplacement(t){return this.spec.unquote(this.spec.replace)}matchAll(t,n){let s=gp(this.spec,t,0,t.doc.length),r=[];for(;!s.next().done;){if(r.length>=n)return null;r.push(s.value)}return r}highlight(t,n,s,r){let i=gp(this.spec,t,Math.max(0,n-this.spec.unquoted.length),Math.min(s+this.spec.unquoted.length,t.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}function KTe(e,t,n){return(s,r,i)=>(!n||n(s,r,i))&&e(i[0],t,s,r)}function yp(e,t,n,s){let r;return e.wholeWord&&(r=YTe(t.charCategorizer(t.selection.main.head))),e.test&&(r=KTe(e.test,t,r)),new MX(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:r},n,s)}function y2(e,t){return e.slice(Fi(e,t,!1),t)}function b2(e,t){return e.slice(t,Fi(e,t))}function YTe(e){return(t,n,s)=>!s[0].length||(e(y2(s.input,s.index))!=Mr.Word||e(b2(s.input,s.index))!=Mr.Word)&&(e(b2(s.input,s.index+s[0].length))!=Mr.Word||e(y2(s.input,s.index+s[0].length))!=Mr.Word)}class XTe extends RX{nextMatch(t,n,s){let r=yp(this.spec,t,s,t.doc.length).next();return r.done&&(r=yp(this.spec,t,0,n).next()),r.done?null:r.value}prevMatchInRange(t,n,s){for(let r=1;;r++){let i=Math.max(n,s-r*1e4),o=yp(this.spec,t,i,s),a=null;for(;!o.next().done;)a=o.value;if(a&&(i==n||a.from>i+10))return a;if(i==n)return null}}prevMatch(t,n,s){return this.prevMatchInRange(t,0,n)||this.prevMatchInRange(t,s,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,s)=>{if(s=="&")return t.match[0];if(s=="$")return"$";for(let r=s.length;r>0;r--){let i=+s.slice(0,r);if(i>0&&i<t.match.length)return t.match[i]+s.slice(r)}return n})}matchAll(t,n){let s=yp(this.spec,t,0,t.doc.length),r=[];for(;!s.next().done;){if(r.length>=n)return null;r.push(s.value)}return r}highlight(t,n,s,r){let i=yp(this.spec,t,Math.max(0,n-250),Math.min(s+250,t.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}const Fy=Pn.define(),x9=Pn.define(),ch=ao.define({create(e){return new B5(D8(e).create(),null)},update(e,t){for(let n of t.effects)n.is(Fy)?e=new B5(n.value.create(),e.panel):n.is(x9)&&(e=new B5(e.query,n.value?k9:null));return e},provide:e=>Dy.from(e,t=>t.panel)});class B5{constructor(t,n){this.query=t,this.panel=n}}const QTe=sn.mark({class:"cm-searchMatch"}),JTe=sn.mark({class:"cm-searchMatch cm-searchMatch-selected"}),ZTe=Ir.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(ch))}update(e){let t=e.state.field(ch);(t!=e.startState.field(ch)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return sn.none;let{view:n}=this,s=new Rc;for(let r=0,i=n.visibleRanges,o=i.length;r<o;r++){let{from:a,to:l}=i[r];for(;r<o-1&&l>i[r+1].from-2*250;)l=i[++r].to;e.highlight(n.state,a,l,(c,d)=>{let h=n.state.selection.ranges.some(f=>f.from==c&&f.to==d);s.add(c,d,h?JTe:QTe)})}return s.finish()}},{decorations:e=>e.decorations});function Rb(e){return t=>{let n=t.state.field(ch,!1);return n&&n.query.spec.valid?e(t,n):DX(t)}}const v2=Rb((e,{query:t})=>{let{to:n}=e.state.selection.main,s=t.nextMatch(e.state,n,n);if(!s)return!1;let r=Be.single(s.from,s.to),i=e.state.facet(rg);return e.dispatch({selection:r,effects:[_9(e,s),i.scrollToMatch(r.main,e)],userEvent:"select.search"}),LX(e),!0}),w2=Rb((e,{query:t})=>{let{state:n}=e,{from:s}=n.selection.main,r=t.prevMatch(n,s,s);if(!r)return!1;let i=Be.single(r.from,r.to),o=e.state.facet(rg);return e.dispatch({selection:i,effects:[_9(e,r),o.scrollToMatch(i.main,e)],userEvent:"select.search"}),LX(e),!0}),e8e=Rb((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:Be.create(n.map(s=>Be.range(s.from,s.to))),userEvent:"select.search.matches"}),!0)}),t8e=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:s,to:r}=n.main,i=[],o=0;for(let a=new N0(e.doc,e.sliceDoc(s,r));!a.next().done;){if(i.length>1e3)return!1;a.value.from==s&&(o=i.length),i.push(Be.range(a.value.from,a.value.to))}return t(e.update({selection:Be.create(i,o),userEvent:"select.search.matches"})),!0},EP=Rb((e,{query:t})=>{let{state:n}=e,{from:s,to:r}=n.selection.main;if(n.readOnly)return!1;let i=t.nextMatch(n,s,s);if(!i)return!1;let o=i,a=[],l,c,d=[];o.precise?o.from==s&&o.to==r&&(c=n.toText(t.getReplacement(o)),a.push({from:o.from,to:o.to,insert:c}),d.push(yt.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(s).number)+"."))):o=t.nextMatch(n,o.from,o.to);let h=e.state.changes(a);return o&&(l=Be.single(o.from,o.to).map(h),d.push(_9(e,o)),d.push(n.facet(rg).scrollToMatch(l.main,e))),e.dispatch({changes:h,selection:l,effects:d,userEvent:"input.replace"}),!0}),n8e=Rb((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let r of t.matchAll(e.state,1e9)){let{from:i,to:o,precise:a}=r;a&&n.push({from:i,to:o,insert:t.getReplacement(r)})}if(!n.length)return!1;let s=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:yt.announce.of(s),userEvent:"input.replace.all"}),!0});function k9(e){return e.state.facet(rg).createPanel(e)}function D8(e,t){var n,s,r,i,o;let a=e.selection.main,l=a.empty||a.to>a.from+100?"":e.sliceDoc(a.from,a.to);if(t&&!l)return t;let c=e.facet(rg);return new IX({search:((n=t==null?void 0:t.literal)!==null&&n!==void 0?n:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(s=t==null?void 0:t.caseSensitive)!==null&&s!==void 0?s:c.caseSensitive,literal:(r=t==null?void 0:t.literal)!==null&&r!==void 0?r:c.literal,regexp:(i=t==null?void 0:t.regexp)!==null&&i!==void 0?i:c.regexp,wholeWord:(o=t==null?void 0:t.wholeWord)!==null&&o!==void 0?o:c.wholeWord})}function jX(e){let t=s9(e,k9);return t&&t.dom.querySelector("[main-field]")}function LX(e){let t=jX(e);t&&t==e.root.activeElement&&t.select()}const DX=e=>{let t=e.state.field(ch,!1);if(t&&t.panel){let n=jX(e);if(n&&n!=e.root.activeElement){let s=D8(e.state,t.query.spec);s.valid&&e.dispatch({effects:Fy.of(s)}),n.focus(),n.select()}}else e.dispatch({effects:[x9.of(!0),t?Fy.of(D8(e.state,t.query.spec)):Pn.appendConfig.of(o8e)]});return!0},OX=e=>{let t=e.state.field(ch,!1);if(!t||!t.panel)return!1;let n=s9(e,k9);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:x9.of(!1)}),!0},s8e=[{key:"Mod-f",run:DX,scope:"editor search-panel"},{key:"F3",run:v2,shift:w2,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:v2,shift:w2,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:OX,scope:"editor search-panel"},{key:"Mod-Shift-l",run:t8e},{key:"Mod-Alt-g",run:jTe},{key:"Mod-d",run:UTe,preventDefault:!0}];class r8e{constructor(t){this.view=t;let n=this.query=t.state.field(ch).query.spec;this.commit=this.commit.bind(this),this.searchField=tr("input",{value:n.search,placeholder:pa(t,"Find"),"aria-label":pa(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=tr("input",{value:n.replace,placeholder:pa(t,"Replace"),"aria-label":pa(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=tr("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=tr("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=tr("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function s(r,i,o){return tr("button",{class:"cm-button",name:r,onclick:i,type:"button"},o)}this.dom=tr("div",{onkeydown:r=>this.keydown(r),class:"cm-search"},[this.searchField,s("next",()=>v2(t),[pa(t,"next")]),s("prev",()=>w2(t),[pa(t,"previous")]),s("select",()=>e8e(t),[pa(t,"all")]),tr("label",null,[this.caseField,pa(t,"match case")]),tr("label",null,[this.reField,pa(t,"regexp")]),tr("label",null,[this.wordField,pa(t,"by word")]),...t.state.readOnly?[]:[tr("br"),this.replaceField,s("replace",()=>EP(t),[pa(t,"replace")]),s("replaceAll",()=>n8e(t),[pa(t,"replace all")])],tr("button",{name:"close",onclick:()=>OX(t),"aria-label":pa(t,"close"),type:"button"},["×"])])}commit(){let t=new IX({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:Fy.of(t)}))}keydown(t){T3e(this.view,t,"search-panel")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?w2:v2)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),EP(this.view))}update(t){for(let n of t.transactions)for(let s of n.effects)s.is(Fy)&&!s.value.eq(this.query)&&this.setQuery(s.value)}setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(rg).top}}function pa(e,t){return e.state.phrase(t)}const xw=30,kw=/[\s\.,:;?!]/;function _9(e,{from:t,to:n}){let s=e.state.doc.lineAt(t),r=e.state.doc.lineAt(n).to,i=Math.max(s.from,t-xw),o=Math.min(r,n+xw),a=e.state.sliceDoc(i,o);if(i!=s.from){for(let l=0;l<xw;l++)if(!kw.test(a[l+1])&&kw.test(a[l])){a=a.slice(l);break}}if(o!=r){for(let l=a.length-1;l>a.length-xw;l--)if(!kw.test(a[l-1])&&kw.test(a[l])){a=a.slice(0,l);break}}return yt.announce.of(`${e.state.phrase("current match")}. ${a} ${e.state.phrase("on line")} ${s.number}.`)}const i8e=yt.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),o8e=[ch,Bh.low(ZTe),i8e];class AP{constructor(t,n,s){this.from=t,this.to=n,this.diagnostic=s}}class _f{constructor(t,n,s){this.diagnostics=t,this.panel=n,this.selected=s}static init(t,n,s){let r=s.facet(qy).markerFilter;r&&(t=r(t,s));let i=t.slice().sort((p,g)=>p.from-g.from||p.to-g.to),o=new Rc,a=[],l=0,c=s.doc.iter(),d=0,h=s.doc.length;for(let p=0;;){let g=p==i.length?null:i[p];if(!g&&!a.length)break;let y,w;if(a.length)y=l,w=a.reduce((x,k)=>Math.min(x,k.to),g&&g.from>y?g.from:1e8);else{if(y=g.from,y>h)break;w=g.to,a.push(g),p++}for(;p<i.length;){let x=i[p];if(x.from==y&&(x.to>x.from||x.to==y))a.push(x),p++,w=Math.min(x.to,w);else{w=Math.min(x.from,w);break}}w=Math.min(w,h);let v=!1;if(a.some(x=>x.from==y&&(x.to==w||w==h))&&(v=y==w,!v&&w-y<10)){let x=y-(d+c.value.length);x>0&&(c.next(x),d=y);for(let k=y;;){if(k>=w){v=!0;break}if(!c.lineBreak&&d+c.value.length>k)break;k=d+c.value.length,d+=c.value.length,c.next()}}let b=v8e(a);if(v)o.add(y,y,sn.widget({widget:new p8e(b),diagnostics:a.slice()}));else{let x=a.reduce((k,T)=>T.markClass?k+" "+T.markClass:k,"");o.add(y,w,sn.mark({class:"cm-lintRange cm-lintRange-"+b+x,diagnostics:a.slice(),inclusiveEnd:a.some(k=>k.to>w)}))}if(l=w,l==h)break;for(let x=0;x<a.length;x++)a[x].to<=l&&a.splice(x--,1)}let f=o.finish();return new _f(f,n,Eh(f))}}function Eh(e,t=null,n=0){let s=null;return e.between(n,1e9,(r,i,{spec:o})=>{if(!(t&&o.diagnostics.indexOf(t)<0))if(!s)s=new AP(r,i,t||o.diagnostics[0]);else{if(o.diagnostics.indexOf(s.diagnostic)<0)return!1;s=new AP(s.from,i,s.diagnostic)}}),s}function a8e(e,t){let n=t.pos,s=t.end||n,r=e.state.facet(qy).hideOn(e,n,s);if(r!=null)return r;let i=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(o=>o.is(PX))||e.changes.touchesRange(i.from,Math.max(i.to,s)))}function l8e(e,t){return e.field(Ca,!1)?t:t.concat(Pn.appendConfig.of(w8e))}const PX=Pn.define(),S9=Pn.define(),BX=Pn.define(),Ca=ao.define({create(){return new _f(sn.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),s=null,r=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);s=Eh(n,e.selected.diagnostic,i)||Eh(n,null,i)}!n.size&&r&&t.state.facet(qy).autoPanel&&(r=null),e=new _f(n,r,s)}for(let n of t.effects)if(n.is(PX)){let s=t.state.facet(qy).autoPanel?n.value.length?Hy.open:null:e.panel;e=_f.init(n.value,s,t.state)}else n.is(S9)?e=new _f(e.diagnostics,n.value?Hy.open:null,e.selected):n.is(BX)&&(e=new _f(e.diagnostics,e.panel,n.value));return e},provide:e=>[Dy.from(e,t=>t.panel),yt.decorations.from(e,t=>t.diagnostics)]}),c8e=sn.mark({class:"cm-lintRange cm-lintRange-active"});function u8e(e,t,n){let{diagnostics:s}=e.state.field(Ca),r,i=-1,o=-1;s.between(t-(n<0?1:0),t+(n>0?1:0),(l,c,{spec:d})=>{if(t>=l&&t<=c&&(l==c||(t>l||n>0)&&(t<c||n<0)))return r=d.diagnostics,i=l,o=c,!1});let a=e.state.facet(qy).tooltipFilter;return r&&a&&(r=a(r,e.state)),r?{pos:i,end:o,above:!0,create(){return{dom:d8e(e,r)}}}:null}function d8e(e,t){return tr("ul",{class:"cm-tooltip-lint"},t.map(n=>zX(e,n,!1)))}const h8e=e=>{let t=e.state.field(Ca,!1);(!t||!t.panel)&&e.dispatch({effects:l8e(e.state,[S9.of(!0)])});let n=s9(e,Hy.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},MP=e=>{let t=e.state.field(Ca,!1);return!t||!t.panel?!1:(e.dispatch({effects:S9.of(!1)}),!0)},f8e=e=>{let t=e.state.field(Ca,!1);if(!t)return!1;let n=e.state.selection.main,s=Eh(t.diagnostics,null,n.to+1);return!s&&(s=Eh(t.diagnostics,null,0),!s||s.from==n.from&&s.to==n.to)?!1:(e.dispatch({selection:{anchor:s.from,head:s.to},scrollIntoView:!0}),f5e(e,s.from,1,{tooltip:FX,until:r=>r.docChanged||r.newSelection.main.head<s.from||r.newSelection.main.head>s.to}),!0)},m8e=[{key:"Mod-Shift-m",run:h8e,preventDefault:!0},{key:"F8",run:f8e}],qy=Ut.define({combine(e){return{sources:e.map(t=>t.source).filter(t=>t!=null),...Vc(e.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:NP,tooltipFilter:NP,needsRefresh:(t,n)=>t?n?s=>t(s)||n(s):t:n,hideOn:(t,n)=>t?n?(s,r,i)=>t(s,r,i)||n(s,r,i):t:n,autoPanel:(t,n)=>t||n})}}});function NP(e,t){return e?t?(n,s)=>t(e(n,s),s):e:t}function $X(e){let t=[];if(e)e:for(let{name:n}of e){for(let s=0;s<n.length;s++){let r=n[s];if(/[a-zA-Z]/.test(r)&&!t.some(i=>i.toLowerCase()==r.toLowerCase())){t.push(r);continue e}}t.push("")}return t}function zX(e,t,n){var s;let r=n?$X(t.actions):[];return tr("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},tr("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),(s=t.actions)===null||s===void 0?void 0:s.map((i,o)=>{let a=!1,l=p=>{if(p.preventDefault(),a)return;a=!0;let g=Eh(e.state.field(Ca).diagnostics,t);g&&i.apply(e,g.from,g.to)},{name:c}=i,d=r[o]?c.indexOf(r[o]):-1,h=d<0?c:[c.slice(0,d),tr("u",c.slice(d,d+1)),c.slice(d+1)],f=i.markClass?" "+i.markClass:"";return tr("button",{type:"button",class:"cm-diagnosticAction"+f,onclick:l,onmousedown:l,"aria-label":` Action: ${c}${d<0?"":` (access key "${r[o]})"`}.`},h)}),t.source&&tr("div",{class:"cm-diagnosticSource"},t.source))}class p8e extends Fa{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return tr("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class IP{constructor(t,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=zX(t,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Hy{constructor(t){this.view=t,this.items=[];let n=r=>{if(!(r.ctrlKey||r.altKey||r.metaKey)){if(r.keyCode==27)MP(this.view),this.view.focus();else if(r.keyCode==38||r.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(r.keyCode==40||r.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(r.keyCode==36)this.moveSelection(0);else if(r.keyCode==35)this.moveSelection(this.items.length-1);else if(r.keyCode==13)this.view.focus();else if(r.keyCode>=65&&r.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:i}=this.items[this.selectedIndex],o=$X(i.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==r.keyCode){let l=Eh(this.view.state.field(Ca).diagnostics,i);l&&i.actions[a].apply(t,l.from,l.to)}}else return;r.preventDefault()}},s=r=>{for(let i=0;i<this.items.length;i++)this.items[i].dom.contains(r.target)&&this.moveSelection(i)};this.list=tr("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:s}),this.dom=tr("div",{class:"cm-panel-lint"},this.list,tr("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>MP(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(Ca).selected;if(!t)return-1;for(let n=0;n<this.items.length;n++)if(this.items[n].diagnostic==t.diagnostic)return n;return-1}update(){let{diagnostics:t,selected:n}=this.view.state.field(Ca),s=0,r=!1,i=null,o=new Set;for(t.between(0,this.view.state.doc.length,(a,l,{spec:c})=>{for(let d of c.diagnostics){if(o.has(d))continue;o.add(d);let h=-1,f;for(let p=s;p<this.items.length;p++)if(this.items[p].diagnostic==d){h=p;break}h<0?(f=new IP(this.view,d),this.items.splice(s,0,f),r=!0):(f=this.items[h],h>s&&(this.items.splice(s,h-s),r=!0)),n&&f.diagnostic==n.diagnostic?f.dom.hasAttribute("aria-selected")||(f.dom.setAttribute("aria-selected","true"),i=f):f.dom.hasAttribute("aria-selected")&&f.dom.removeAttribute("aria-selected"),s++}});s<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new IP(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),r=!0),i?(this.list.setAttribute("aria-activedescendant",i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:a,panel:l})=>{let c=l.height/this.list.offsetHeight;a.top<l.top?this.list.scrollTop-=(l.top-a.top)/c:a.bottom>l.bottom&&(this.list.scrollTop+=(a.bottom-l.bottom)/c)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let t=this.list.firstChild;function n(){let s=t;t=s.nextSibling,s.remove()}for(let s of this.items)if(s.dom.parentNode==this.list){for(;t!=s.dom;)n();t=s.dom.nextSibling}else this.list.insertBefore(s.dom,t);for(;t;)n()}moveSelection(t){if(this.selectedIndex<0)return;let n=this.view.state.field(Ca),s=Eh(n.diagnostics,this.items[t].diagnostic);s&&this.view.dispatch({selection:{anchor:s.from,head:s.to},scrollIntoView:!0,effects:BX.of(s)})}static open(t){return new Hy(t)}}function g8e(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function _w(e){return g8e(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const y8e=yt.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:_w("#f11")},".cm-lintRange-warning":{backgroundImage:_w("orange")},".cm-lintRange-info":{backgroundImage:_w("#999")},".cm-lintRange-hint":{backgroundImage:_w("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function b8e(e){return e=="error"?4:e=="warning"?3:e=="info"?2:1}function v8e(e){let t="hint",n=1;for(let s of e){let r=b8e(s.severity);r>n&&(n=r,t=s.severity)}return t}const FX=h5e(u8e,{hideOn:a8e}),w8e=[Ca,yt.decorations.compute([Ca],e=>{let{selected:t,panel:n}=e.field(Ca);return!t||!n||t.from==t.to?sn.none:sn.set([c8e.range(t.from,t.to)])}),FX,y8e],qX=[T5e(),M5e(),dY(),h9(),xCe(),lY(),O3e(),ws.allowMultipleSelections.of(!0),aCe(),DY(OY,{fallback:!0}),ICe(),wTe(),TX(),e5e(),s5e(),G3e(),OTe(),E0.of([...STe,...p9,...s8e,...f9,...yCe,...EX,...m8e])],x8e=[dY(),h9(),lY(),DY(OY,{fallback:!0}),E0.of([...p9,...f9])];/** @license
 * fzf v0.5.2
 * Copyright (c) 2021 Ajit
 * Licensed under BSD 3-Clause
 */const C9={216:"O",223:"s",248:"o",273:"d",295:"h",305:"i",320:"l",322:"l",359:"t",383:"s",384:"b",385:"B",387:"b",390:"O",392:"c",393:"D",394:"D",396:"d",398:"E",400:"E",402:"f",403:"G",407:"I",409:"k",410:"l",412:"M",413:"N",414:"n",415:"O",421:"p",427:"t",429:"t",430:"T",434:"V",436:"y",438:"z",477:"e",485:"g",544:"N",545:"d",549:"z",564:"l",565:"n",566:"t",567:"j",570:"A",571:"C",572:"c",573:"L",574:"T",575:"s",576:"z",579:"B",580:"U",581:"V",582:"E",583:"e",584:"J",585:"j",586:"Q",587:"q",588:"R",589:"r",590:"Y",591:"y",592:"a",593:"a",595:"b",596:"o",597:"c",598:"d",599:"d",600:"e",603:"e",604:"e",605:"e",606:"e",607:"j",608:"g",609:"g",610:"G",613:"h",614:"h",616:"i",618:"I",619:"l",620:"l",621:"l",623:"m",624:"m",625:"m",626:"n",627:"n",628:"N",629:"o",633:"r",634:"r",635:"r",636:"r",637:"r",638:"r",639:"r",640:"R",641:"R",642:"s",647:"t",648:"t",649:"u",651:"v",652:"v",653:"w",654:"y",655:"Y",656:"z",657:"z",663:"c",665:"B",666:"e",667:"G",668:"H",669:"j",670:"k",671:"L",672:"q",686:"h",867:"a",868:"e",869:"i",870:"o",871:"u",872:"c",873:"d",874:"h",875:"m",876:"r",877:"t",878:"v",879:"x",7424:"A",7427:"B",7428:"C",7429:"D",7431:"E",7432:"e",7433:"i",7434:"J",7435:"K",7436:"L",7437:"M",7438:"N",7439:"O",7440:"O",7441:"o",7442:"o",7443:"o",7446:"o",7447:"o",7448:"P",7449:"R",7450:"R",7451:"T",7452:"U",7453:"u",7454:"u",7455:"m",7456:"V",7457:"W",7458:"Z",7522:"i",7523:"r",7524:"u",7525:"v",7834:"a",7835:"s",8305:"i",8341:"h",8342:"k",8343:"l",8344:"m",8345:"n",8346:"p",8347:"s",8348:"t",8580:"c"};for(let e="̀".codePointAt(0);e<="ͯ".codePointAt(0);++e){const t=String.fromCodePoint(e);for(const n of"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"){const r=(n+t).normalize().codePointAt(0);r>126&&(C9[r]=n)}}const $5={a:[7844,7863],e:[7870,7879],o:[7888,7907],u:[7912,7921]};for(const e of Object.keys($5)){const t=e.toUpperCase();for(let n=$5[e][0];n<=$5[e][1];++n)C9[n]=n%2===0?t:e}function jb(e){if(e<192||e>8580)return e;const t=C9[e];return t!==void 0?t.codePointAt(0):e}function Rd(e,t){return e>t?e:t}const HX=e=>e.split("").map(t=>t.codePointAt(0)),k8e=new Set(` \f
\r	\v  \u2028\u2029  　\uFEFF`.split("").map(e=>e.codePointAt(0)));for(let e=" ".codePointAt(0);e<=" ".codePointAt(0);e++)k8e.add(e);const I0="".codePointAt(0),Uy="A".codePointAt(0),Vy="Z".codePointAt(0),UX="a".codePointAt(0),VX="z".codePointAt(0),_8e="0".codePointAt(0),S8e="9".codePointAt(0);function Lp(e,t,n){return n?e:t-e-1}const Wy=16,O8=-3,x2=-1,tm=Wy/2,C8e=Wy/2,T8e=tm+x2,WX=4,GX=2;function P8(e){return e?new Set:null}function Gg(e,t,n){if(t!==null&&t.i16.length>e+n){const s=t.i16.subarray(e,e+n);return[e+n,s]}return[e,new Int16Array(n)]}function RP(e,t,n){if(t!==null&&t.i32.length>e+n){const s=t.i32.subarray(e,e+n);return[e+n,s]}return[e,new Int32Array(n)]}function KX(e){return e>=UX&&e<=VX?1:e>=Uy&&e<=Vy?2:e>=_8e&&e<=S8e?4:0}function YX(e){const t=String.fromCodePoint(e);return t!==t.toUpperCase()?1:t!==t.toLowerCase()?2:t.match(new RegExp("\\p{Number}","gu"))!==null?4:t.match(new RegExp("\\p{Letter}","gu"))!==null?3:0}function k2(e){return e<=I0?KX(e):YX(e)}function T9(e,t){return e===0&&t!==0?tm:e===1&&t===2||e!==4&&t===4?T8e:t===0?C8e:0}function E8e(e,t){return t===0?tm:T9(k2(e[t-1]),k2(e[t]))}function A8e(e,t,n,s){let r=e.slice(s),i=r.indexOf(n);if(i===0)return s;if(!t&&n>=UX&&n<=VX){i>0&&(r=r.slice(0,i));const o=r.indexOf(n-32);o>=0&&(i=o)}return i<0?-1:s+i}function jP(e){for(const t of e)if(t>=128)return!1;return!0}function E9(e,t,n){if(!jP(e))return 0;if(!jP(t))return-1;let s=0,r=0;for(let i=0;i<t.length;i++){if(r=A8e(e,n,t[i],r),r<0)return-1;i===0&&r>0&&(s=r-1),r++}return s}const M8e=(e,t,n,s,r,i,o)=>{const a=r.length;if(a===0)return[{start:0,end:0,score:0},P8(i)];const l=s.length;if(o!==null&&l*a>o.i16.length)return QX(e,t,n,s,r,i);const c=E9(s,r,e);if(c<0)return[{start:-1,end:-1,score:0},null];let d=0,h=0,f=null,p=null,g=null,y=null;[d,f]=Gg(d,o,l),[d,p]=Gg(d,o,l),[d,g]=Gg(d,o,l),[h,y]=RP(h,o,a);const[,w]=RP(h,o,l);for(let q=0;q<w.length;q++)w[q]=s[q];let v=0,b=0,x=0,k=0;const T=r[0];let C=r[0],S=0,_=0,L=!1,M=w.subarray(c),I=f.subarray(c).subarray(0,M.length),A=p.subarray(c).subarray(0,M.length),P=g.subarray(c).subarray(0,M.length);for(let[q,N]of M.entries()){let ee=null;N<=I0?(ee=KX(N),!e&&ee===2&&(N+=32)):(ee=YX(N),!e&&ee===2&&(N=String.fromCodePoint(N).toLowerCase().codePointAt(0)),t&&(N=jb(N))),M[q]=N;const re=T9(_,ee);if(P[q]=re,_=ee,N===C&&(x<a&&(y[x]=c+q,x++,C=r[Math.min(x,a-1)]),k=c+q),N===T){const Q=Wy+re*GX;if(I[q]=Q,A[q]=1,a===1&&(n&&Q>v||!n&&Q>=v)&&(v=Q,b=c+q,n&&re===tm))break;L=!1}else L?I[q]=Rd(S+x2,0):I[q]=Rd(S+O8,0),A[q]=0,L=!0;S=I[q]}if(x!==a)return[{start:-1,end:-1,score:0},null];if(a===1){const q={start:b,end:b+1,score:v};if(!i)return[q,null];const N=new Set;return N.add(b),[q,N]}const B=y[0],F=k-B+1;let O=null;[d,O]=Gg(d,o,F*a);{const q=f.subarray(B,k+1);for(const[N,ee]of q.entries())O[N]=ee}let[,X]=Gg(d,o,F*a);{const q=p.subarray(B,k+1);for(const[N,ee]of q.entries())X[N]=ee}const z=y.subarray(1),U=r.slice(1).slice(0,z.length);for(const[q,N]of z.entries()){let ee=!1;const re=U[q],Q=q+1,K=Q*F,se=w.subarray(N,k+1),te=g.subarray(N).subarray(0,se.length),ce=X.subarray(K+N-B).subarray(0,se.length),oe=X.subarray(K+N-B-1-F).subarray(0,se.length),de=O.subarray(K+N-B).subarray(0,se.length),Te=O.subarray(K+N-B-1-F).subarray(0,se.length),qe=O.subarray(K+N-B-1).subarray(0,se.length);qe[0]=0;for(const[Ne,ge]of se.entries()){const Ee=Ne+N;let _t=0,Ct=0,Je=0;if(ee?Ct=qe[Ne]+x2:Ct=qe[Ne]+O8,re===ge){_t=Te[Ne]+Wy;let Oe=te[Ne];Je=oe[Ne]+1,Oe===tm?Je=1:Je>1&&(Oe=Rd(Oe,Rd(WX,g[Ee-Je+1]))),_t+Oe<Ct?(_t+=te[Ne],Je=0):_t+=Oe}ce[Ne]=Je,ee=_t<Ct;const at=Rd(Rd(_t,Ct),0);Q===a-1&&(n&&at>v||!n&&at>=v)&&(v=at,b=Ee),de[Ne]=at}}const D=P8(i);let G=B;if(i&&D!==null){let q=a-1;G=b;let N=!0;for(;;){const ee=q*F,re=G-B,Q=O[ee+re];let K=0,se=0;if(q>0&&G>=y[q]&&(K=O[ee-F+re-1]),G>y[q]&&(se=O[ee+re-1]),Q>K&&(Q>se||Q===se&&N)){if(D.add(G),q===0)break;q--}N=X[ee+re]>1||ee+F+re+1<X.length&&X[ee+F+re+1]>0,G--}}return[{start:G,end:b+1,score:v},D]};function XX(e,t,n,s,r,i,o){let a=0,l=0,c=!1,d=0,h=0;const f=P8(o);let p=0;r>0&&(p=k2(n[r-1]));for(let g=r;g<i;g++){let y=n[g];const w=k2(y);if(e||(y>=Uy&&y<=Vy?y+=32:y>I0&&(y=String.fromCodePoint(y).toLowerCase().codePointAt(0))),t&&(y=jb(y)),y===s[a]){o&&f!==null&&f.add(g),l+=Wy;let v=T9(p,w);d===0?h=v:(v===tm&&(h=v),v=Rd(Rd(v,h),WX)),a===0?l+=v*GX:l+=v,c=!1,d++,a++}else c?l+=x2:l+=O8,c=!0,d=0,h=0;p=w}return[l,f]}const QX=(e,t,n,s,r,i,o)=>{if(r.length===0)return[{start:0,end:0,score:0},null];if(E9(s,r,e)<0)return[{start:-1,end:-1,score:0},null];let a=0,l=-1,c=-1;const d=s.length,h=r.length;for(let f=0;f<d;f++){let p=s[Lp(f,d,n)];e||(p>=Uy&&p<=Vy?p+=32:p>I0&&(p=String.fromCodePoint(p).toLowerCase().codePointAt(0))),t&&(p=jb(p));const g=r[Lp(a,h,n)];if(p===g&&(l<0&&(l=f),a++,a===h)){c=f+1;break}}if(l>=0&&c>=0){a--;for(let g=c-1;g>=l;g--){const y=Lp(g,d,n);let w=s[y];e||(w>=Uy&&w<=Vy?w+=32:w>I0&&(w=String.fromCodePoint(w).toLowerCase().codePointAt(0)));const v=Lp(a,h,n),b=r[v];if(w===b&&(a--,a<0)){l=g;break}}if(!n){const g=l;l=d-c,c=d-g}const[f,p]=XX(e,t,s,r,l,c,i);return[{start:l,end:c,score:f},p]}return[{start:-1,end:-1,score:0},null]},N8e=(e,t,n,s,r,i,o)=>{if(r.length===0)return[{start:0,end:0,score:0},null];const a=s.length,l=r.length;if(a<l)return[{start:-1,end:-1,score:0},null];if(E9(s,r,e)<0)return[{start:-1,end:-1,score:0},null];let c=0,d=-1,h=0,f=-1;for(let p=0;p<a;p++){const g=Lp(p,a,n);let y=s[g];e||(y>=Uy&&y<=Vy?y+=32:y>I0&&(y=String.fromCodePoint(y).toLowerCase().codePointAt(0))),t&&(y=jb(y));const w=Lp(c,l,n);if(r[w]===y){if(w===0&&(h=E8e(s,g)),c++,c===l){if(h>f&&(d=p,f=h),h===tm)break;p-=c-1,c=0,h=0}}else p-=c,c=0,h=0}if(d>=0){let p=0,g=0;n?(p=d-l+1,g=d+1):(p=a-(d+1),g=a-(d-l+1));const[y]=XX(e,t,s,r,p,g,!1);return[{start:p,end:g,score:y},null]}return[{start:-1,end:-1,score:0},null]},I8e=100*1024,R8e=2048;function j8e(e,t){return{i16:new Int16Array(e),i32:new Int32Array(t)}}const L8e=j8e(I8e,R8e),D8e=(e,t,n)=>{let s=!1;switch(t){case"smart-case":e.toLowerCase()!==e&&(s=!0);break;case"case-sensitive":s=!0;break;case"case-insensitive":e=e.toLowerCase(),s=!1;break}let r=HX(e);return n&&(r=r.map(jb)),{queryRunes:r,caseSensitive:s}};function O8e(e,t){const n=Object.keys(e).map(r=>parseInt(r,10)).sort((r,i)=>i-r);let s=[];for(const r of n)if(s=s.concat(e[r]),s.length>=t)break;return s}function P8e(e,t,n){return s=>{const r=this.runesList[s];if(t.length>r.length)return;let[i,o]=this.algoFn(n,this.opts.normalize,this.opts.forward,r,t,!0,L8e);if(i.start===-1)return;if(this.opts.fuzzy===!1){o=new Set;for(let l=i.start;l<i.end;++l)o.add(l)}const a=this.opts.sort?i.score:0;e[a]===void 0&&(e[a]=[]),e[a].push({item:this.items[s],...i,positions:o??new Set})}}function B8e(e){const{queryRunes:t,caseSensitive:n}=D8e(e,this.opts.casing,this.opts.normalize),s={},r=P8e.bind(this)(s,t,n);for(let i=0,o=this.runesList.length;i<o;++i)r(i);return O8e(s,this.opts.limit)}const JX={limit:1/0,selector:e=>e,casing:"smart-case",normalize:!0,fuzzy:"v2",tiebreakers:[],sort:!0,forward:!0};class $8e{constructor(t,...n){switch(this.opts={...JX,...n[0]},this.items=t,this.runesList=t.map(s=>HX(this.opts.selector(s).normalize())),this.algoFn=N8e,this.opts.fuzzy){case"v2":this.algoFn=M8e;break;case"v1":this.algoFn=QX;break}}}const z8e={...JX,match:B8e};class F8e extends $8e{constructor(t,...n){super(t,...n),this.opts={...z8e,...n[0]}}find(t){if(t.length===0||this.items.length===0)return this.items.slice(0,this.opts.limit).map(q8e);t=t.normalize();let n=this.opts.match.bind(this)(t);return H8e(n,this.opts)}}const q8e=e=>({item:e,start:-1,end:-1,score:0,positions:new Set});function H8e(e,t){if(t.sort){const{selector:n}=t;e.sort((s,r)=>{if(s.score===r.score)for(const i of t.tiebreakers){const o=i(s,r,n);if(o!==0)return o}return 0})}return Number.isFinite(t.limit)&&e.splice(t.limit),e}class U8e{constructor(t,...n){this.finder=new F8e(t,...n),this.find=this.finder.find.bind(this.finder)}}const Gy=["custom","skill","system"];function B8(e){return e.displayCategory?e.displayCategory:e.source==="builtin-command"?"system":e.source==="bundled-skill"||e.source==="skill"?"skill":"custom"}function V8e(e,t,n=Gy){return LP(B8(e),n)-LP(B8(t),n)}function LP(e,t=Gy){const n=t.indexOf(e);return n>=0?n:t.length+Gy.indexOf(e)}const A9=String.raw`([^\s/]+)`,n4={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:"安装扩展"}]},s4={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"}]},r4={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 文件列表"}]},i4={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 W8e(e,t,n,s,r){if(e==="skills"&&t.length===0)return!n||n.length===0?null:n.map(a=>({name:a.name,description:a.description}));let o=(s==="zh-CN"?n4:s4)[e];if(o||(o=(s==="zh-CN"?r4:i4)[e]),!o&&t.length===0&&(r!=null&&r.length)&&(o=r.map(a=>({name:a,description:""}))),!o)return null;for(const a of t){const l=o.find(c=>c.name===a);if(!(l!=null&&l.children))return null;o=l.children}return o}function G8e(e,t,n){const s=e.toLowerCase(),r=t.toLowerCase(),i=s.startsWith(n),o=r.startsWith(n);return i!==o?i?-1:1:e.localeCompare(t)}function K8e(e,t,n,s){const r=V8e(e,t,s);return r!==0?r:0}const Y8e={custom:"slash.category.custom",skill:"slash.category.skill",system:"slash.category.system"};function X8e(e,t){if(!e||e.includes(" ")||/^[/@!?]/.test(e))return null;const n=e.toLowerCase(),s=t.find(r=>r.name.toLowerCase().startsWith(n));return s?`/${s.name} `:null}function Q8e(e,t,n){var c;const s=e.match(new RegExp(`^/${A9}\\s+$`));if(!s)return null;const r=s[1],i=t.find(d=>d.name===r),o=n==="zh-CN"?n4:s4;if((c=i==null?void 0:i.subcommands)!=null&&c.length||o[r]||r==="skills")return null;const l=(n==="zh-CN"?r4:i4)[r];return!l||l.length===0?null:`/${r} ${l[0].name} `}function J8e(e,t,n){var d,h;const s=e.match(new RegExp(`^/${A9}(\\s*)$`));if(!s)return null;const r=s[1],i=t.find(f=>f.name===r);if(!i)return null;const o=(d=i.argumentHint)==null?void 0:d.trim();if(o)return o;const a=n==="zh-CN"?n4:s4;if((h=i.subcommands)!=null&&h.length||a[r]||r==="skills")return null;const c=(n==="zh-CN"?r4:i4)[r];return!c||c.length===0?null:`[${c.map(f=>f.name).join("|")}]`}function Z8e(e,t){const n=Math.max(0,Math.min(t,e.length)),s=e.lastIndexOf(`
`,Math.max(0,n-1))+1,r=e.indexOf(`
`,n),i=r===-1?e.length:r;return{lineStart:s,lineEnd:i,lineText:e.slice(s,i),textBefore:e.slice(s,n),cursor:n}}const DP=new WeakMap;function e7e(e){let t=DP.get(e);if(!t){const n=[],s=new Map;for(const r of e)s.has(r.name)||(n.push(r.name),s.set(r.name,r));t={fzf:new U8e(n,{fuzzy:"v2",casing:"case-insensitive"}),byName:s},DP.set(e,t)}return t}function t7e(e,t){try{const{fzf:n,byName:s}=e7e(e),r=[];for(const i of n.find(t)){const o=s.get(i.item);o&&r.push(o)}return r}catch(n){console.warn("[web-shell] slash fuzzy search failed, falling back to substring match:",n);const s=t.toLowerCase();return e.filter(r=>r.name.toLowerCase().includes(s))}}function n7e(e,t,n,s=[],r="en",i=a=>a,o=Gy){var b,x;const{lineStart:a,lineEnd:l,lineText:c,textBefore:d,cursor:h}=Z8e(e,t),f=d.match(new RegExp(`^/${A9}\\s+(.*)$`));if(f){const[,k,T]=f,C=n.find(D=>D.name===k),S=r==="zh-CN"?n4:s4,_=r==="zh-CN"?r4:i4,L=!!S[k]||k==="skills",M=!!_[k];if(!((b=C==null?void 0:C.subcommands)!=null&&b.length)&&!L&&!M)return null;const I=T.split(/\s+/),A=I.pop()||"",P=I;if(!((x=C==null?void 0:C.subcommands)!=null&&x.length)&&!L&&M&&!A)return null;const B=W8e(k,P,s,r,C==null?void 0:C.subcommands);if(!B)return null;const F=A.toLowerCase(),O=`/${k} ${P.length>0?P.join(" ")+" ":""}`,X=B.filter(D=>!A||D.name.toLowerCase().includes(F)).sort((D,G)=>A?G8e(D.name,G.name,F):0),z=k==="skills"&&P.length===0,U=X.map(D=>{const G=`${O}${D.name}`;return{id:G,label:D.name,detail:D.description||void 0,apply:`${G} `,...z?{type:"skill"}:{}}});return U.length===0?null:{kind:"subcommand",from:a,to:h,query:A,items:U}}const p=c.match(/^\/([^\s/]*)$/);if(!p)return null;const g=p[1],y=g.length===0,v=(y?[...n].sort((k,T)=>K8e(k,T,"",o)):t7e(n,g)).map(k=>{const T=`/${k.name} `,C=B8(k),S=C==="custom"||C==="skill";return{id:k.name,label:`/${k.name}`,detail:k.description||void 0,apply:T,category:C,...y?{section:i(Y8e[C])}:{},...S&&k.description?{type:"command-info"}:{}}});return v.length===0?null:{kind:"command",from:a,to:l,query:g,items:v}}const s7e="qwen-web-shell-history",ZX=100;function r7e(e){try{const t=localStorage.getItem(e);if(!t)return[];const n=JSON.parse(t);return Array.isArray(n)?n.filter(s=>typeof s=="string"):[]}catch{return[]}}function i7e(e,t){try{localStorage.setItem(e,JSON.stringify(t.slice(-ZX)))}catch{}}function OP(e=s7e){const t=m.useRef(e);t.current=e;const n=m.useRef(r7e(e)),s=m.useRef(-1),r=m.useRef(""),i=m.useRef(-1),[o,a]=m.useState(()=>({canUp:n.current.length>0,canDown:!1})),l=m.useCallback(()=>{const b=n.current,x=s.current;a({canUp:b.length>0&&(x===-1||x>0),canDown:x!==-1})},[]),c=m.useCallback(b=>{const x=n.current;x[x.length-1]!==b&&(x.push(b),x.length>ZX&&x.shift(),i7e(t.current,x),s.current=-1,l())},[l]),d=m.useCallback(b=>{const x=n.current;if(x.length===0)return null;if(s.current===-1)r.current=b,s.current=x.length-1;else if(s.current>0)s.current--;else return null;return l(),x[s.current]},[l]),h=m.useCallback(()=>{const b=n.current;return s.current===-1?null:s.current<b.length-1?(s.current++,l(),b[s.current]):(s.current=-1,l(),r.current)},[l]),f=m.useCallback(()=>s.current!==-1,[]),p=m.useCallback(()=>{s.current=-1,i.current=-1,l()},[l]),g=m.useCallback(b=>{const x=n.current;if(x.length===0||!b)return null;const k=i.current===-1?x.length-1:i.current-1;if(k<0)return i.current=-1,null;const T=b.toLowerCase();for(let C=k;C>=0;C--)if(x[C].toLowerCase().includes(T))return i.current=C,x[C];return i.current=-1,null},[]),y=m.useCallback(b=>{const x=b.trim().toLowerCase();return n.current.slice().reverse().filter(k=>!x||k.toLowerCase().includes(x))},[]),w=m.useCallback(b=>{const x=n.current;if(!b)return x.length>0?x[x.length-1]:null;for(let k=x.length-1;k>=0;k--)if(b(x[k]))return x[k];return null},[]),v=m.useCallback(()=>{i.current=-1},[]);return{push:c,navigateUp:d,navigateDown:h,isNavigating:f,reset:p,searchReverse:g,getReverseMatches:y,getLastEntry:w,resetSearch:v,nav:o}}function Sw(){return{directories:new Map,globResults:new Map,mcpResources:new Map}}function $8(e,t,n){let s=e.get(t);return s||(s=n().catch(r=>{throw e.delete(t),r}),e.set(t,s)),s}const o7e=/@((?:[\p{L}\p{N}_./:-]|\\.)*)$/u,a7e=[],PP=150,nm=50,eQ=nm+1,Yi="files",ig="extensions",Ji="mcp-resources",tQ=[Yi,ig,Ji],l7e="\x1B",nQ=new RegExp(`${l7e}(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])`,"g"),sQ=/[\u200B\u200E\u200F\u061C\u2066-\u2069\u202A-\u202E]/g,Ky="[invalid]",c7e=/[^\p{L}\p{N}_./-]/gu;function Lx(e){return tQ.includes(e)}function u7e(e,t){var s;if(t===void 0||t===!0)return!0;if(t===!1)return!1;if(Array.isArray(t))return t.includes(e);const n=t;return!(n.enabled===!1||n.include&&!n.include.includes(e)||(s=n.exclude)!=null&&s.includes(e))}function d7e(e){const t=new Set(tQ),n=[];for(const s of e){if(t.has(s.id)){console.error(`[@mention] duplicate provider id="${s.id}" ignored`);continue}t.add(s.id),n.push(s)}return n}function BP(e){return(e.textValue===void 0?void 0:ar(e.textValue))??(typeof e.label=="string"?ar(e.label)??void 0:void 0)??Vu(e.id)??Ky}function rQ(e,t){return e==="."||e===""?t:`${e.replace(/\/+$/,"")}/${t}`}function Iu(e){const t=[];for(const n of e.split("/"))if(!(!n||n===".")){if(n===".."){t.pop();continue}t.push(n)}return t.length>0?t.join("/"):"."}function iQ(e){return e.replace(/[\\*?[{\]}]/g,"\\$&")}function _2(e,...t){const n=e.toLowerCase();return t.some(s=>s==null?void 0:s.toLowerCase().includes(n))}function $P(e){const t=Iu(e),n=jc(t);return t==="."?"@./ ":`@${sm(n)}/ `}function h7e(e,t){return`${e}:${t}`}function sm(e){return e.replace(c7e,"\\$&")}function M9(e){return e.replace(/\\(.)/g,"$1")}function oQ(e){const t=e.charCodeAt(0);return t>31&&t!==127&&(t<128||t>159)}function f7e(e,t){return`@${sm(h7e(jc(e),jc(t)))} `}function m7e(e,t,n){const s=M9(e);return t===Ji&&n&&s.startsWith(`${n}:`)?{providerId:Ji,serverName:n,itemQuery:s.slice(n.length+1),validateServer:!0}:e.startsWith("ext:")?{providerId:ig,itemQuery:e.slice(4)}:e.startsWith("mcp:")?{providerId:Ji,itemQuery:e.slice(4)}:null}function p7e(e,t,n){if(e===ig&&t.startsWith("ext:")||e===Ji&&t.startsWith("mcp:"))return t.slice(4);const s=M9(t);return e===Ji&&n&&s.startsWith(`${n}:`)?s.slice(n.length+1):!Lx(e)&&t.startsWith(`${e}:`)?t.slice(e.length+1):t}async function g7e(e,t,n,s){if(n!=null&&n.aborted)return!1;const r=s??(e==null?void 0:e.loadMcpStatus);if(!r)return!1;try{const i=await r();return n!=null&&n.aborted?!1:i.servers.some(o=>o.name===t&&!o.disabled)}catch(i){return console.warn(`Failed to verify @ MCP server "${t}" status`,i),!1}}function y7e(e){const t=Iu(e);if(t===".")return".";const n=t.lastIndexOf("/");return n<0?".":t.slice(0,n)}function aQ(e,t){const n=M9(e).replace(/^\.\/+/,"").replace(/\/+/g,"/"),s=n.lastIndexOf("/");if(s<0)return{dirPath:Iu(t),entryQuery:n};const r=n.slice(0,s),i=Iu(t),o=i==="."?r:rQ(i,r);return{dirPath:Iu(o),entryQuery:n.slice(s+1)}}function b7e(e){if(!e)return null;const t=e.state.selection.main;if(!t.empty)return null;const n=e.state.doc.lineAt(t.head),r=n.text.slice(0,t.head-n.from).match(o7e);if(!r)return null;const i=t.head-r[0].length;if(i>n.from){const o=e.state.doc.sliceString(i-1,i);if(!/[\s([{'"]/.test(o))return null}return{from:i,to:t.head,query:r[1]??""}}function ar(e){const t=e.replace(nQ,"").replace(sQ,"").split("").filter(oQ).join("").replace(/\s+/g," ").trim();return t.length>0?t:void 0}function jc(e){const t=e.replace(nQ,"").replace(sQ,"").split("").filter(oQ).join("");return t.length>0?t:Ky}function Vu(e){return e===void 0?Ky:ar(e)??Ky}function v7e(e){if(e!==void 0)return jc(e).trim()}function w7e(e){if(!e)return;const t=e.kind===void 0?void 0:ar(e.kind);return{id:ar(e.id)??Ky,label:e.label===void 0?void 0:ar(e.label),value:e.value===void 0?void 0:ar(e.value),removable:e.removable,kind:t,icon:e.icon,metadata:e.metadata,serialized:v7e(e.serialized)}}function x7e(e,t){const n={...e,label:ar(e.label)??Vu(e.id),description:e.description===void 0?void 0:ar(e.description),subtitle:e.subtitle===void 0?void 0:ar(e.subtitle),detail:e.detail===void 0?void 0:ar(e.detail),icon:e.icon,iconTooltip:e.iconTooltip===void 0?void 0:ar(e.iconTooltip),insertText:e.insertText===void 0?void 0:jc(e.insertText),composerTag:w7e(e.composerTag)};if(!(t!=null&&t.customProvider))return n;const s={...n};return delete s.targetPath,delete s.serverName,{...s,kind:"insert"}}function k7e(e,t,n){var r;const s=n.trim();return s?t.composerTag?{...t.composerTag,serialized:((r=t.composerTag.serialized)==null?void 0:r.trim())||s}:e===ig?{id:`extension:${s}`,kind:"extension",value:t.label,serialized:s}:e===Ji?{id:`mcp:${s}`,kind:"mcp",value:t.label,serialized:s}:e===Yi?{id:`file:${s}`,kind:"file",value:t.description??t.label,serialized:s}:null:null}function _7e(e,t,n,s,r){return{id:Yi,label:s,description:r,order:1,async search({query:i,signal:o}){const a=e(),l=Iu(t()),c=a==null?void 0:a.listDirectory;if(c)try{const{dirPath:h,entryQuery:f}=aQ(i,l),p=f.toLowerCase(),g=await $8(n().directories,h,()=>c(h,{signal:o}));if(o.aborted)return[];const y=g.entries.filter(v=>!v.ignored).filter(v=>v.name.toLowerCase().includes(p)).sort((v,b)=>v.kind==="directory"&&b.kind!=="directory"?-1:v.kind!=="directory"&&b.kind==="directory"?1:v.name.localeCompare(b.name)),w={id:`current:${h}`,label:$P(h).trim(),description:ar(h),insertText:$P(h),kind:"insert"};return[...f?[]:[w],...y.map(v=>{const b=rQ(h,v.name),x=Vu(v.name),k=ar(b),T=jc(b);return v.kind==="directory"?{id:`dir:${b}`,label:`${x}/`,description:k,kind:"directory",targetPath:b}:{id:`file:${b}`,label:x,description:k,insertText:`@${sm(T)} `,kind:"insert"}})].slice(0,f?nm:eQ)}catch(h){return o.aborted||console.warn("Failed to load @ file suggestions",h),[]}const d=a==null?void 0:a.globWorkspace;if(!d)return console.warn("[@mention] file provider unavailable: workspace actions are not configured"),[];try{const h=i?`${iQ(i)}*`:"**/*",f=await $8(n().globResults,h,()=>d(h,{maxResults:nm,signal:o}));return o.aborted?[]:f.matches.filter(p=>p!==".").map(p=>({id:p,label:Vu(p),insertText:`@${sm(jc(p))} `,kind:"insert"}))}catch(h){return o.aborted||console.warn("Failed to load @ file suggestions",h),[]}}}}function S7e(e,t,n,s){return{id:ig,label:n,description:s,order:2,async search({query:r,signal:i}){var a;const o=(a=e())==null?void 0:a.loadExtensionsStatus;if(!o)return[];try{const l=t();l.extensionsStatus??(l.extensionsStatus=o().catch(h=>{throw l.extensionsStatus=void 0,h}));const c=await l.extensionsStatus;if(i.aborted)return[];const d=r.toLowerCase();return c.extensions.filter(h=>h.isActive).map(h=>{const f=Vu(h.name),p=sm(jc(h.name)),g=ar(h.displayName??""),y=ar(h.description??"");return{id:h.name,label:f,description:g&&g!==f?g:y,detail:g&&y?`${g} - ${y}`:g??y,insertText:`@ext:${p} `}}).filter(h=>_2(d,h.label,h.description)).sort((h,f)=>{const p=h.label.toLowerCase(),g=f.label.toLowerCase(),y=p.startsWith(d)?0:1,w=g.startsWith(d)?0:1;return y!==w?y-w:p.localeCompare(g)}).slice(0,nm)}catch(l){return i.aborted||console.warn("Failed to load @ extension suggestions",l),[]}}}}function C7e(e,t,n,s,r){return{id:Ji,label:n,description:s,order:3,async search({query:i,signal:o}){var l;const a=(l=e())==null?void 0:l.loadMcpStatus;if(!a)return[];try{const c=t();c.mcpStatus??(c.mcpStatus=a().catch(f=>{throw c.mcpStatus=void 0,f}));const d=await c.mcpStatus;if(o.aborted)return[];const h=i.toLowerCase();return d.servers.filter(f=>!f.disabled).map(f=>{const p=jc(f.name),g=f.resourceCount===void 0?void 0:r(f.resourceCount);return f.resourceCount===0?{id:`mcp-server-ref:${f.name}`,label:Vu(f.name),description:ar(f.description??""),detail:ar(f.description??""),insertText:`@mcp:${sm(p)} `,kind:"insert"}:{id:`mcp-server:${f.name}`,label:Vu(f.name),description:g===void 0?ar(f.description??""):g,detail:ar(f.description??""),kind:"mcp-server",serverName:f.name}}).filter(f=>_2(h,f.label,f.description)).sort((f,p)=>f.label.localeCompare(p.label)).slice(0,nm)}catch(c){return o.aborted||console.warn("Failed to load @ MCP resource suggestions",c),[]}}}}function T7e(e,t,n){return t<=0?null:n==="up"?e<=0?null:e-1:e>=t-1?null:e+1}function E7e({viewRef:e,disabledRef:t,shellModeRef:n,workspaceActionsRef:s,workspaceKey:r,builtinProviders:i,providers:o=a7e,createInlineTagEffect:a}){const{t:l}=ot(),[c,d]=m.useState(null),h=m.useRef(null),f=m.useRef(0),p=m.useRef(null),g=m.useRef(null),y=m.useRef("."),w=m.useRef(Sw()),v=m.useRef(null),b=m.useRef(null),x=m.useRef(!1),k=m.useMemo(()=>[...[_7e(()=>s.current,()=>y.current,()=>w.current,l("at.category.files"),l("at.category.files.description")),S7e(()=>s.current,()=>w.current,l("at.category.extensions"),l("at.category.extensions.description")),C7e(()=>s.current,()=>w.current,l("at.category.mcpResources"),l("at.category.mcpResources.description"),K=>l("mcp.resourceCount",{count:K}))].filter(K=>u7e(K.id,i)),...d7e(o)].sort((K,se)=>(K.order??0)-(se.order??0)),[i,o,l,s]),T=m.useRef(k);T.current=k;const C=m.useMemo(()=>k.map(Q=>({id:Q.id,provider:Q,textValue:BP(Q),label:typeof Q.label=="string"?BP(Q):Q.label,description:Q.description===void 0?void 0:ar(Q.description),tabs:Q.tabs,renderItem:Q.renderItem})),[k]),S=m.useRef(C);S.current=C;const _=m.useCallback(Q=>{const K=typeof Q=="function"?Q(h.current):Q;h.current=K,d(K)},[]);m.useEffect(()=>{var Q;(Q=p.current)==null||Q.abort(),p.current=null,g.current&&(clearTimeout(g.current),g.current=null),y.current=".",w.current=Sw(),h.current=null,d(null)},[r]);const L=m.useCallback(()=>{var Q;(Q=p.current)==null||Q.abort(),p.current=null,g.current&&(clearTimeout(g.current),g.current=null)},[]),M=m.useCallback((Q={})=>{L(),w.current=Sw();const K=Q.preserveProviderSelection||x.current;x.current=!1,K||(v.current=null,b.current=null),_(null)},[L,_]),I=m.useCallback(()=>{const Q=h.current;return Q?Q.level==="items"?(L(),_({...Q,level:"categories",selectedProviderId:void 0,selectedIndex:0,query:"",items:[],loading:!1,itemMode:void 0,mcpServerName:void 0,fileDirectory:void 0,inputMode:void 0,tabs:void 0,selectedTabId:void 0}),"categories"):(M(),"closed"):!1},[L,M,_]);m.useEffect(()=>()=>{var Q;g.current&&clearTimeout(g.current),(Q=p.current)==null||Q.abort(),p.current=null,y.current=".",w.current=Sw()},[]);const A=m.useCallback((Q,K,se)=>{const te=h.current;return(te==null?void 0:te.level)!=="items"||te.selectedProviderId!==Q||te.selectedTabId!==se.selectedTabId||te.itemMode!==se.itemMode||te.mcpServerName!==se.mcpServerName||te.fileDirectory!==se.fileDirectory?[]:te.query!==K&&!Lx(Q)?[]:Q===Yi&&K===""&&y.current==="."?[]:te.items},[]),P=m.useCallback((Q,K)=>{const se=s.current,te=w.current;if(Q===Yi){if(se!=null&&se.listDirectory){const{dirPath:oe}=aQ(K,Iu(y.current));return te.directories.has(oe)}const ce=K?`${iQ(K)}*`:"**/*";return!!(se!=null&&se.globWorkspace)&&te.globResults.has(ce)}return Q===ig?te.extensionsStatus!==void 0:Q===Ji?te.mcpStatus!==void 0:!1},[s]),B=m.useCallback((Q,K,se,te={})=>{var qe;const ce=T.current.find(Ne=>Ne.id===Q);if(!ce){console.warn(`[@mention] provider="${Q}" not found (may have been removed)`),_(null);return}(qe=p.current)==null||qe.abort();const oe=new AbortController;p.current=oe;const de=f.current+1;f.current=de;const Te=A(Q,K,se);te.loadingAlreadySet||_({...se,items:Te,loading:!0}),Promise.resolve().then(()=>ce.search({query:K,signal:oe.signal,tabId:se.selectedTabId})).then(Ne=>{oe.signal.aborted||f.current!==de||_(ge=>{if(!ge||ge.level!=="items")return ge;const Ee=Q===Yi&&K.length===0?eQ:nm;return{...ge,items:Ne.slice(0,Ee).map(_t=>x7e(_t,{customProvider:!Lx(Q)})),selectedIndex:0,loading:!1}})}).catch(Ne=>{oe.signal.aborted||f.current!==de||(console.warn(`[@mention] provider="${Q}" query=<redacted> failed`,Ne),_(ge=>!ge||ge.level!=="items"?ge:{...ge,items:[],selectedIndex:0,loading:!1}))})},[A,_]),F=m.useCallback((Q,K,se)=>{var ce;g.current&&clearTimeout(g.current),(ce=p.current)==null||ce.abort(),p.current=null;const te=A(Q,K,se);if(_({...se,items:te,loading:!0}),P(Q,K)){B(Q,K,se,{loadingAlreadySet:!0});return}g.current=setTimeout(()=>{g.current=null,B(Q,K,se,{loadingAlreadySet:!0})},PP)},[A,P,B,_]),O=m.useCallback((Q,K,se,te={})=>{var Ee,_t;const ce=s.current,oe=ce==null?void 0:ce.loadMcpResources;if(!oe){console.warn(`[@mention] loadMcpResources not available for server="${Q}"`),_({...se,items:[],loading:!1});return}(Ee=p.current)==null||Ee.abort();const de=new AbortController;p.current=de;const Te=f.current+1;f.current=Te;const qe=((_t=h.current)==null?void 0:_t.level)==="items"&&h.current.itemMode==="mcpResources"&&h.current.mcpServerName===Q?h.current.items:[];te.loadingAlreadySet||_({...se,items:qe,loading:!0});const Ne=ce==null?void 0:ce.loadMcpStatus;(te.validateServer?g7e(ce,Q,de.signal,Ne?()=>{const Ct=w.current;return Ct.mcpStatus??(Ct.mcpStatus=Ne().catch(Je=>{throw Ct.mcpStatus=void 0,Je})),Ct.mcpStatus}:void 0):Promise.resolve(!0)).then(Ct=>de.signal.aborted?{resources:[]}:Ct?$8(w.current.mcpResources,Q,()=>oe(Q,{signal:de.signal})):(console.warn("[@mention] MCP server disabled or not found",{serverName:Q}),{resources:[]})).then(Ct=>{if(de.signal.aborted||f.current!==Te)return;const Je=Ct.resources.map(at=>{const Oe=ar(at.title??"")??ar(at.name??"")??Vu(at.uri);return{id:`mcp-resource:${Q}:${at.uri}`,label:Oe,description:ar(at.description??"")??ar(at.mimeType??""),detail:Vu(at.uri),insertText:f7e(Q,at.uri),kind:"insert"}}).filter(at=>_2(K,at.label,at.description,at.detail)).sort((at,Oe)=>at.label.localeCompare(Oe.label)).slice(0,nm);_(at=>!at||at.level!=="items"?at:{...at,items:Je,selectedIndex:0,loading:!1})}).catch(Ct=>{de.signal.aborted||f.current!==Te||(console.warn("Failed to load @ MCP resources",Ct),_(Je=>!Je||Je.level!=="items"?Je:{...Je,items:[],selectedIndex:0,loading:!1}))})},[_,s]),X=m.useCallback((Q,K,se,te={})=>{var oe,de;g.current&&clearTimeout(g.current),(oe=p.current)==null||oe.abort(),p.current=null;const ce=((de=h.current)==null?void 0:de.level)==="items"&&h.current.itemMode==="mcpResources"&&h.current.mcpServerName===Q&&se.itemMode==="mcpResources"?h.current.items:[];if(_({...se,items:ce,loading:!0}),w.current.mcpResources.has(Q)){O(Q,K,se,{...te,loadingAlreadySet:!0});return}g.current=setTimeout(()=>{g.current=null,O(Q,K,se,{...te,loadingAlreadySet:!0})},PP)},[O,_]),z=m.useCallback(Q=>{if(t.current||n.current)return M(),!1;const K=b7e(Q);if(!K)return M(),!1;const se=h.current;if((se==null?void 0:se.level)==="items"&&se.from===K.from&&(se.to===K.to||se.inputMode==="search"&&K.to>=se.to||se.inputMode==="context"&&K.to>=se.to)&&se.selectedProviderId!==void 0&&S.current.some(oe=>oe.id===se.selectedProviderId)){if(!se.selectedProviderId)return!0;const oe=se.selectedProviderId,de=se.inputMode==="context"?p7e(oe,K.query,se.mcpServerName):se.query;if(de!==se.query){const Te={...se,from:K.from,to:K.to,query:de,selectedIndex:0,providers:S.current};return oe===Ji&&se.itemMode==="mcpResources"&&se.mcpServerName?(X(se.mcpServerName,de,Te,{validateServer:se.validateMcpServer}),!0):(F(oe,de,Te),!0)}return _({...se,from:K.from,to:K.to,query:de,providers:S.current}),!0}const ce=S.current.filter(oe=>_2(K.query,oe.textValue,oe.description));if(ce.length===0&&K.query){const oe=m7e(K.query,v.current,b.current);if(oe&&S.current.some(Te=>Te.id===oe.providerId))return oe.providerId===Ji&&oe.serverName?(b.current=oe.serverName,X(oe.serverName,oe.itemQuery,{from:K.from,to:K.to,query:oe.itemQuery,level:"items",selectedProviderId:Ji,selectedIndex:0,providers:S.current,itemMode:"mcpResources",mcpServerName:oe.serverName,fileDirectory:void 0,inputMode:"context",validateMcpServer:oe.validateServer},{validateServer:oe.validateServer}),!0):(F(oe.providerId,oe.itemQuery,{from:K.from,to:K.to,query:oe.itemQuery,level:"items",selectedProviderId:oe.providerId,selectedIndex:0,providers:S.current,itemMode:"default",mcpServerName:void 0,fileDirectory:oe.providerId===Yi?y.current:void 0,inputMode:"context"}),!0);const de=S.current.find(Te=>!Lx(Te.id)&&K.query.startsWith(`${Te.id}:`));if(de){const Te=K.query.slice(de.id.length+1);return F(de.id,Te,{from:K.from,to:K.to,query:Te,level:"items",selectedProviderId:de.id,selectedIndex:0,providers:S.current,itemMode:"default",mcpServerName:void 0,fileDirectory:void 0,inputMode:"context"}),!0}if(S.current.some(Te=>Te.id===Yi))return y.current=".",F(Yi,K.query,{from:K.from,to:K.to,query:K.query,level:"items",selectedProviderId:Yi,selectedIndex:0,providers:S.current,itemMode:"default",mcpServerName:void 0,fileDirectory:y.current,inputMode:"context"}),!0}return _({from:K.from,to:K.to,query:K.query,level:"categories",selectedIndex:0,providers:ce,items:[],loading:!1,inputMode:void 0}),!0},[M,t,F,X,_,n]),U=m.useCallback(Q=>{const K=h.current;if(!K)return!1;const se=K.level==="categories"?K.providers.length:K.items.length;if(se<=0)return!0;const te=T7e(K.selectedIndex,se,Q);return te===null||_({...K,selectedIndex:te}),!0},[_]),D=m.useCallback(Q=>{const K=h.current;if(!K)return!1;const se=K.level==="categories"?K.providers.length:K.items.length;return Q<0||Q>=se?!1:(_({...K,selectedIndex:Q}),!0)},[_]),G=m.useCallback(Q=>{var ce,oe;const K=h.current;if(!K||K.level!=="categories")return!1;const se=K.providers[Q??K.selectedIndex];if(!se)return!1;v.current=se.id,se.id===Yi&&(y.current=".");const te=(oe=(ce=se.tabs)==null?void 0:ce.find(de=>!de.disabled))==null?void 0:oe.id;return F(se.id,K.query,{...K,level:"items",selectedProviderId:se.id,selectedIndex:0,tabs:se.tabs,selectedTabId:te,itemMode:se.id===Ji?"mcpServers":"default",mcpServerName:void 0,fileDirectory:se.id===Yi?y.current:void 0,inputMode:"search"}),!0},[F]),q=m.useCallback(Q=>{const K=h.current;if(!K||K.level!=="items"||!K.selectedProviderId)return!1;const se={...K,query:Q,selectedIndex:0,inputMode:"search"};return K.selectedProviderId===Ji&&K.itemMode==="mcpResources"&&K.mcpServerName?(X(K.mcpServerName,Q,se,{validateServer:K.validateMcpServer}),!0):(F(K.selectedProviderId,Q,se),!0)},[F,X]),N=m.useCallback(Q=>{var te;const K=h.current;if(!K||K.level!=="items"||!K.selectedProviderId||!((te=K.tabs)!=null&&te.some(ce=>ce.id===Q&&!ce.disabled)))return!1;if(K.selectedTabId===Q)return!0;const se={...K,selectedTabId:Q,selectedIndex:0,inputMode:"search"};return F(K.selectedProviderId,K.query,se),!0},[F]),ee=m.useCallback(()=>{const Q=h.current;if(!Q||Q.level!=="items")return!1;if(Q.selectedProviderId===Ji&&Q.itemMode==="mcpResources")return F(Ji,"",{...Q,query:"",selectedIndex:0,itemMode:"mcpServers",mcpServerName:void 0,fileDirectory:void 0,inputMode:"search",validateMcpServer:void 0}),"items";if(Q.selectedProviderId===Yi){const K=Iu(Q.fileDirectory??y.current);if(K!==".")return y.current=y7e(K),F(Yi,"",{...Q,query:"",selectedIndex:0,fileDirectory:y.current,inputMode:"search"}),"items"}return _({...Q,level:"categories",selectedProviderId:void 0,selectedIndex:0,query:"",items:[],loading:!1,itemMode:void 0,mcpServerName:void 0,fileDirectory:void 0,inputMode:void 0,tabs:void 0,selectedTabId:void 0}),L(),"categories"},[L,F,_]),re=m.useCallback(Q=>{const K=h.current;if(!K)return!1;if(K.level==="categories")return G(Q);const se=e.current;if(!se)return!1;if(K.loading)return!0;const te=K.items[Q??K.selectedIndex];if(!te)return!1;if(K.selectedProviderId&&(v.current=K.selectedProviderId),K.selectedProviderId===Yi&&te.kind==="directory"&&te.targetPath)return y.current=Iu(te.targetPath),F(Yi,"",{...K,query:"",selectedIndex:0,fileDirectory:y.current,inputMode:"search"}),!0;if(K.selectedProviderId===Ji&&te.kind==="mcp-server"&&te.serverName)return b.current=te.serverName,X(te.serverName,"",{...K,query:"",selectedIndex:0,itemMode:"mcpResources",mcpServerName:te.serverName,fileDirectory:void 0,inputMode:"search",validateMcpServer:void 0}),!0;const ce=te.insertText??`@${sm(jc(te.label))} `,oe=te.composerTag&&!/\s$/.test(ce)?`${ce} `:ce,de=se.state.doc.length;if(K.from<0||K.to<K.from||K.to>de)return console.warn("[@mention] stale insertion range",{from:K.from,to:K.to,docLength:de}),M(),!0;if(!se.state.doc.sliceString(K.from,K.to).startsWith("@"))return console.warn("[@mention] stale insertion text",{from:K.from,to:K.to}),M(),!0;x.current=!0;const qe=k7e(K.selectedProviderId,te,oe),Ne=oe.trimEnd(),ge=qe&&a?[a({from:K.from,to:K.from+Ne.length,tag:qe})]:void 0;return se.dispatch({changes:{from:K.from,to:K.to,insert:oe},...ge?{effects:ge}:{},selection:{anchor:K.from+oe.length},scrollIntoView:!0}),se.focus(),M({preserveProviderSelection:!0}),!0},[M,G,a,F,X,e]);return{state:c,close:M,closeIfOpen:I,refreshForView:z,moveSelection:U,select:D,accept:re,enterCategory:G,selectTab:N,backToCategories:ee,updateSearch:q}}const A7e=sn.mark({class:"cm-input-slash"}),M7e=sn.mark({class:"cm-input-at"}),N7e=sn.mark({class:"cm-input-code"});class I7e extends Fa{constructor(t){super(),this.text=t}eq(t){return t.text===this.text}toDOM(){const t=document.createElement("span");return t.className="cm-input-slash-argument-hint",t.textContent=this.text,t}ignoreEvent(){return!0}}function zP(e,t,n){const s=new Rc,r=e.state.doc,i=[];for(let o=1;o<=r.lines;o++){const a=r.line(o),l=a.text,c=a.from;if(l.startsWith("/")){const g=l.indexOf(" "),y=g===-1?l.length:g;i.push({from:c,to:c+y,deco:A7e})}const d=J8e(l,t(),n());if(d){const g=l.endsWith(" ")?"":" ";i.push({from:c+l.length,to:c+l.length,deco:sn.widget({widget:new I7e(`${g}${d}`),side:1})})}const h=/@[^\s]+/g;let f;for(;(f=h.exec(l))!==null;)i.push({from:c+f.index,to:c+f.index+f[0].length,deco:M7e});const p=/`[^`]+`/g;for(;(f=p.exec(l))!==null;)i.push({from:c+f.index,to:c+f.index+f[0].length,deco:N7e})}i.sort((o,a)=>o.from-a.from||o.to-a.to);for(const{from:o,to:a,deco:l}of i)s.add(o,a,l);return s.finish()}function R7e(e=()=>[],t=()=>"en"){return Ir.fromClass(class{constructor(n){Me(this,"decorations");this.decorations=zP(n,e,t)}update(n){(n.docChanged||n.viewportChanged)&&(this.decorations=zP(n.view,e,t))}},{decorations:n=>n.decorations})}const j7e=yt.baseTheme({".cm-input-slash":{color:"var(--agent-blue-500, #4a9eff)",fontWeight:"bold"},".cm-input-at":{color:"var(--success-color, #48bb78)"},".cm-input-code":{background:"rgba(255, 255, 255, 0.06)",borderRadius:"3px",color:"var(--muted-foreground, #a0aec0)"},".cm-input-slash-argument-hint":{color:"color-mix(in srgb, var(--muted-foreground) 70%, transparent)",pointerEvents:"none"}});function Yy(e){return e instanceof HTMLElement?e.isContentEditable?!0:!!e.closest('input, textarea, select, [contenteditable="true"], .cm-editor, [data-keyboard-scope]'):!1}function o4(e){return`url("${e.replace(/["\\\n\r\f]/g,n=>{switch(n){case'"':case"\\":return`\\${n}`;case`
`:return"\\A ";case"\r":return"\\D ";case"\f":return"\\C ";default:return""}})}")`}function Xd(e,t){return{[e]:o4(t)}}const L7e=1e3,D7e=10,FP="web-shell-tooltip-styles",O7e=`
[data-web-shell-tooltip-portal] {
  pointer-events: none;
}

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

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

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

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

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

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

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

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete .cm-at-ref-completion-icon {
  display: block;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  margin-right: 10px;
  background: currentColor;
  mask: var(--composer-tag-icon-url) center / contain no-repeat;
  -webkit-mask: var(--composer-tag-icon-url) center / contain no-repeat;
}

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

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

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

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete completion-section {
  display: block !important;
  height: auto;
  margin: 6px 10px 4px;
  padding: 2px 0 4px !important;
  line-height: 1.2;
  color: var(--muted-foreground, #a1a1aa) !important;
  border-bottom: 1px solid var(--border) !important;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete completion-section:first-of-type {
  margin-top: 6px;
}

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

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete ul li.cm-at-ref-completion-extension .cm-completionLabel,
[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete ul li.cm-at-ref-completion-mcp .cm-completionLabel,
[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete ul li.cm-at-ref-completion-file .cm-completionLabel {
  width: calc(var(--web-shell-completion-label-width) - 20px);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

[data-web-shell-tooltip-portal] .cm-completionInfo.cm-completionInfo-left-narrow {
  right: var(--web-shell-completion-detail-start);
}
`;function P7e(){if(document.getElementById(FP))return;const e=document.createElement("style");e.id=FP,e.textContent=O7e,document.head.appendChild(e)}function B7e(e,t,n){return t<=0?null:((e+(n==="up"?-1:1))%t+t)%t}function $7e(e){return typeof e.apply=="string"&&e.apply.trim().startsWith("/")}function N9(e){return $7e(e)}function z7e(e){var t;return typeof e.apply=="string"?e.apply.trim():((t=e.displayLabel)==null?void 0:t.trim())||e.label}function F7e(e){e.querySelectorAll(".cm-completionInfo-hover").forEach(t=>{t.remove()})}function q7e(e,t,n){if(!t.detail||!N9(t))return;const s=e.closest("[data-web-shell-tooltip-portal]");if(!s)return;let r=s.querySelector(".cm-completionInfo-hover");r||(r=document.createElement("div"),r.className="cm-tooltip cm-completionInfo cm-completionInfo-hover cm-completionInfo-right-narrow",s.appendChild(r)),r.textContent=`${z7e(t)}

${t.detail}`;const i=r.dataset.hideTimerId;i&&(window.clearTimeout(Number(i)),delete r.dataset.hideTimerId);const o=r.getBoundingClientRect(),a=18,l=12,c=12,d=window.innerWidth,h=window.innerHeight,f=n.clientX+a,p=f+o.width+c>d?Math.max(c,n.clientX-o.width-a):f,g=Math.min(Math.max(c,n.clientY+l),Math.max(c,h-o.height-c));r.style.position="fixed",r.style.left=`${p}px`,r.style.top=`${g}px`,r.style.right="auto",r.style.bottom="auto"}function H7e(e){const t=e.querySelector(".cm-completionInfo-hover");if(!t)return;const n=window.setTimeout(()=>{t.remove()},180);t.dataset.hideTimerId=String(n),t.addEventListener("mouseenter",()=>{window.clearTimeout(n),delete t.dataset.hideTimerId},{once:!0}),t.addEventListener("mouseleave",()=>{t.remove()},{once:!0})}function U7e(e){if(!e.detail||!N9(e))return null;const t=document.createElement("span");return t.className="cm-command-hover-info-anchor",t.setAttribute("aria-hidden","true"),queueMicrotask(()=>{const n=t.closest("li");!n||n.hasAttribute("data-web-shell-hover-info")||(n.setAttribute("data-web-shell-hover-info","true"),n.addEventListener("mouseenter",s=>{q7e(t,e,s)}),n.addEventListener("mouseleave",()=>{const s=t.closest("[data-web-shell-tooltip-portal]");s&&H7e(s)}))}),t}function V7e(e){return e.replace(/\r\n/g,`
`).replace(/\r/g,`
`)}function W7e(e){return[...e].length>L7e||e.split(`
`).length>D7e}function G7e(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function K7e(e,t,n){const r=`[Pasted Content ${[...n].length} chars]`,i=t===1?r:`${r} #${t}`;return e.set(i,n),{placeholderText:i,nextPasteId:t+1}}function Y7e(e,t){for(const n of e.keys())t.includes(n)||e.delete(n);return e.size===0?1:null}function X7e(e,t){if(e.size===0)return t;const n=[...e.keys()].sort((r,i)=>i.length-r.length),s=new RegExp(n.map(G7e).join("|"),"g");return t.replace(s,r=>e.get(r)??r)}function ny(e){return RU(e)}function Q7e(e){return e.map(ny).join(`
`)}function a4(e){var t;return((t=e.label)==null?void 0:t.trim())??""}function l4(e){var t;return((t=e.value)==null?void 0:t.trim())??""}function I9(e){return l4(e)||a4(e)||e.id}function J7e(e,t){const n=Q7e(t);return n?e?`${n}

${e}`:n:e}function Z7e(e,t){const n=t.filter(i=>i.start>=0&&i.end>i.start&&i.end<=e.length).slice().sort((i,o)=>i.start-o.start);if(n.length===0)return e;let s=0;const r=[];for(const i of n)i.start<s||(r.push(e.slice(s,i.start)),r.push(ny(i.tag)),s=i.end);return r.push(e.slice(s)),r.join("")}function c4(e){const t={...e};return delete t.iconUrl,delete t.renderContent,delete t.tooltip,delete t.tooltipText,delete t.onClick,t}const p1=Pn.define({map:e=>e}),R9=Pn.define(),uu=Pn.define();let eEe=0;class tEe extends Fa{constructor(n){super();Me(this,"contentRoot",null);Me(this,"tooltipRoot",null);this.tag=n}eq(n){return this.tag.id===n.tag.id&&this.tag.label===n.tag.label&&this.tag.value===n.tag.value&&this.tag.kind===n.tag.kind&&this.tag.icon===n.tag.icon&&this.tag.serialized===n.tag.serialized&&this.tag.removable===n.tag.removable&&this.tag.iconUrl===n.tag.iconUrl&&this.tag.renderContent===n.tag.renderContent&&this.tag.tooltip===n.tag.tooltip&&this.tag.tooltipText===n.tag.tooltipText&&this.tag.onClick===n.tag.onClick}toDOM(n){var f,p,g;const s=document.createElement("span"),r=c4(this.tag);s.style.cssText="position:relative;display:inline-flex;align-items:center;max-width:min(44ch,100%);min-height:20px;margin:0 0.25ch;border:1px solid var(--border);border-radius:4px;background:var(--secondary);color:var(--foreground);font-family:var(--font-mono,monospace);font-size:12px;line-height:1.2;vertical-align:baseline;",this.tag.onClick&&(s.setAttribute("role","button"),s.tabIndex=0,s.style.cursor="pointer",s.addEventListener("pointerdown",y=>{y.preventDefault(),y.stopPropagation()}),s.addEventListener("mousedown",y=>{y.preventDefault(),y.stopPropagation()}),s.addEventListener("click",y=>{var w,v;y.stopPropagation(),(v=(w=this.tag).onClick)==null||v.call(w,{tag:r,placement:"composer",readonly:!1,anchorRect:s.getBoundingClientRect()})}),s.addEventListener("keydown",y=>{var w,v;y.key!=="Enter"&&y.key!==" "||(y.preventDefault(),(v=(w=this.tag).onClick)==null||v.call(w,{tag:r,placement:"composer",readonly:!1,anchorRect:s.getBoundingClientRect()}))}));const i=a4(this.tag),o=l4(this.tag),a=this.tag.kind?"":i,l=this.tag.iconUrl??vm(this.tag.kind),c=l&&eg(l)?l:void 0;let d;try{d=(p=(f=this.tag).renderContent)==null?void 0:p.call(f,{tag:r,placement:"composer",readonly:!1})}catch(y){console.warn("[WebShell] inline tag renderContent failed",y)}let h=!1;if(d!=null){const y=document.createElement("span");y.style.cssText="display:inline-flex;align-items:center;min-width:0;max-width:100%;";try{this.contentRoot=P6.createRoot(y),this.contentRoot.render(d),s.appendChild(y),h=!0}catch(w){(g=this.contentRoot)==null||g.unmount(),this.contentRoot=null,console.warn("[WebShell] inline tag renderContent failed",w)}}if(!h&&c){const y=document.createElement("span");y.style.cssText="display:block;width:12px;height:12px;flex:0 0 auto;margin-left:7px;background:currentColor;mask:var(--composer-tag-icon-url) center / contain no-repeat;-webkit-mask:var(--composer-tag-icon-url) center / contain no-repeat;",y.style.setProperty("--composer-tag-icon-url",o4(c)),s.appendChild(y)}return h||this.appendDefaultContent(s,a,o),this.tag.tooltip!==void 0&&this.tag.tooltip!==null&&this.appendTooltip(s,this.tag.tooltip),this.tag.removable!==!1&&this.appendRemoveButton(s,n),s}appendDefaultContent(n,s,r){if(s){const i=document.createElement("span");i.style.cssText="min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:3px 0 3px 7px;color:var(--agent-blue-500);",i.textContent=s,n.appendChild(i)}if(r){const i=document.createElement("span");i.style.cssText="max-width:32ch;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:3px 0 3px 0.5ch;color:var(--foreground, #e4e4e4);",i.textContent=r,n.appendChild(i)}else if(!s){const i=document.createElement("span");i.style.cssText="min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:3px 0 3px 7px;color:var(--agent-blue-500);",i.textContent=this.tag.id,n.appendChild(i)}}appendTooltip(n,s){var a;const r=document.createElement("span");r.setAttribute("role","tooltip"),r.style.cssText="position:absolute;z-index:calc(var(--web-shell-tooltip-z-index,1000) + 1);top:calc(100% + 6px);left:0;display:none;min-width:160px;max-width:min(320px,80vw);padding:8px 10px;border:1px solid var(--border);border-radius:6px;background:var(--background);box-shadow:0 8px 24px rgba(0,0,0,0.18);color:var(--foreground);font-family:var(--font-sans,system-ui,sans-serif);font-size:12px;line-height:1.5;white-space:normal;";try{this.tooltipRoot=P6.createRoot(r),this.tooltipRoot.render(s),n.appendChild(r),r.id=`composer-tag-tooltip-${++eEe}`,n.setAttribute("aria-describedby",r.id)}catch(l){(a=this.tooltipRoot)==null||a.unmount(),this.tooltipRoot=null,this.tag.tooltipText&&(n.title=this.tag.tooltipText),console.warn("[WebShell] inline tag tooltip render failed",l);return}const i=()=>{r.style.display="block"},o=()=>{r.style.display="none"};n.addEventListener("mouseenter",i),n.addEventListener("mouseleave",o),n.addEventListener("focusin",i),n.addEventListener("focusout",o)}appendRemoveButton(n,s){const r=document.createElement("button");r.type="button",r.setAttribute("aria-label",`Remove ${I9(this.tag)}`),r.style.cssText="flex:0 0 auto;width:22px;height:22px;padding:0;border:0;background:transparent;color:var(--muted-foreground);font:inherit;line-height:22px;cursor:pointer;",r.textContent="×",r.addEventListener("mousedown",i=>i.preventDefault()),r.addEventListener("keydown",i=>{if(i.key==="Enter"||i.key===" "){i.stopPropagation();return}i.key!=="Backspace"&&i.key!=="Delete"||(i.preventDefault(),i.stopPropagation(),r.click())}),r.addEventListener("click",i=>{i.stopPropagation();const o=[];s.state.field(Bd).between(0,s.state.doc.length,(a,l,c)=>{const d=c.spec.tag;(d==null?void 0:d.id)===this.tag.id&&d.removable!==!1&&o.push({from:a,to:l,insert:""})}),o.length!==0&&(s.dispatch({changes:o,effects:R9.of({predicate:a=>a.id===this.tag.id}),scrollIntoView:!0}),s.focus())}),r.addEventListener("mouseenter",()=>{r.style.color="var(--error-color)"}),r.addEventListener("mouseleave",()=>{r.style.color="var(--muted-foreground)"}),n.appendChild(r)}destroy(){var n,s;(n=this.contentRoot)==null||n.unmount(),(s=this.tooltipRoot)==null||s.unmount(),this.contentRoot=null,this.tooltipRoot=null}ignoreEvent(){return!1}}function nEe(e){const t={widget:new tEe(e.tag),inclusive:!1,tag:e.tag};return sn.replace(t).range(e.from,e.to)}const Bd=ao.define({create(){return sn.none},update(e,t){let n=e.map(t.changes);for(const s of t.effects)s.is(p1)?n=n.update({add:[nEe(s.value)]}):s.is(R9)?n=n.update({filter:(r,i,o)=>{const a=o.spec.tag;return a&&s.value.predicate?!s.value.predicate(a):!0}}):s.is(uu)&&(n=sn.none);return n},provide:e=>[yt.decorations.from(e),yt.atomicRanges.of(t=>t.state.field(e))]});function qP(e){const t=[],n=e.state.field(Bd,!1);return n==null||n.between(0,e.state.doc.length,(s,r,i)=>{const o=i.spec.tag;o&&t.push(c4(o))}),t}function sEe(e){const t=[];return e.state.field(Bd).between(0,e.state.doc.length,(n,s,r)=>{const i=r.spec.tag;i&&t.push({start:n,end:s,tag:c4(i)})}),t}const HP=new _m,UP=new _m,VP=new _m;function vf(e,t){return t&&(e.length===0||t.startsWith(e))?t:null}function rEe(e,t){const n=vf(e,t);if(!n||e.length===0)return null;const s=n.slice(e.length);return s.length>0?s:null}class iEe extends Fa{constructor(t){super(),this.text=t}eq(t){return this.text===t.text}toDOM(){const t=document.createElement("span");return t.className="cm-followup-ghost",t.textContent=this.text,t}ignoreEvent(){return!0}}function WP(e){return Ir.fromClass(class{constructor(t){Me(this,"decorations");this.decorations=this.buildDecorations(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.buildDecorations(t.view))}buildDecorations(t){if(!e)return sn.none;const n=t.state.selection.main,s=t.state.doc.toString(),r=rEe(s,e);return!r||!n.empty||n.head!==s.length?sn.none:sn.set([sn.widget({widget:new iEe(r),side:1}).range(s.length)])}},{decorations:t=>t.decorations})}function GP(e,t){const n=e.state.doc;if(n.lines<=1)return"history";const s=e.state.selection.main;if(!s.empty)return"editor";const r=s.head,i=n.lineAt(r);return t==="up"?i.number>1?"editor":r>i.from?(e.dispatch({selection:{anchor:i.from},scrollIntoView:!0}),"handled"):"history":i.number<n.lines?"editor":r<i.to?(e.dispatch({selection:{anchor:i.to},scrollIntoView:!0}),"handled"):"history"}function oEe(e){const{onSubmit:t,onCycleMode:n,onToggleShortcuts:s,disabled:r=!1,placeholderText:i="Type a message...",commands:o,skills:a=[],slashCommandCategoryOrder:l,queuedMessages:c=[],onPopQueuedMessages:d,currentMode:h="default",onFocusFooter:f,dialogOpen:p=!1,followupState:g,onAcceptFollowup:y,onDismissFollowup:w,sessionName:v,composerInput:b,composerInputVersion:x,builtinAtProviders:k,atProviders:T,atWorkspaceCwd:C,composerTagIcons:S,renderComposerTag:_,renderComposerTagTooltip:L,onComposerTagClick:M,editorTheme:I}=e,A=tU(),{language:P,t:B}=ot(),F=m.useRef(null),O=m.useRef(null),X=m.useRef(t);X.current=t;const z=m.useRef(n);z.current=n;const U=m.useRef(s);U.current=s;const D=m.useRef(r);D.current=r;const G=m.useRef(o);G.current=o;const q=m.useRef(a);q.current=a;const N=m.useRef(l);N.current=l;const ee=m.useRef(B);ee.current=B;const re=m.useRef(c);re.current=c;const Q=m.useRef(d);Q.current=d;const K=m.useRef(g);K.current=g;const se=m.useRef(y);se.current=y;const te=m.useRef(w);te.current=w;const ce=m.useRef(f);ce.current=f;const oe=m.useRef(P);oe.current=P;const de=m.useRef(void 0);if(A&&C){const ie=A.client.workspaceByCwd(C);de.current={...A.actions,async globWorkspace(ve,Le){var en,Sn;if((en=Le==null?void 0:Le.signal)!=null&&en.aborted)return{matches:[]};const tt=await ie.glob(ve);if((Sn=Le==null?void 0:Le.signal)!=null&&Sn.aborted)return{matches:[]};const cn=Array.isArray(tt.matches)?tt.matches.filter(Gs=>typeof Gs=="string"):[];return{matches:(Le==null?void 0:Le.maxResults)===void 0?cn:cn.slice(0,Le.maxResults)}},async listDirectory(ve,Le){var cn,en;if((cn=Le==null?void 0:Le.signal)!=null&&cn.aborted)return{kind:"list",path:ve,entries:[],truncated:!1};const tt=await ie.dirList(ve);return(en=Le==null?void 0:Le.signal)!=null&&en.aborted?{kind:"list",path:ve,entries:[],truncated:!1}:tt}}}else de.current=A==null?void 0:A.actions;const Te=m.useRef(S);Te.current=S;const qe=m.useRef(_);qe.current=_;const Ne=m.useRef(L);Ne.current=L;const ge=m.useRef(M);ge.current=M;const Ee=m.useCallback(ie=>{var en;const ve=ie.icon??vm(ie.kind,Te.current),Le={tag:ie,placement:"composer",readonly:!1};let tt;try{tt=(en=Ne.current)==null?void 0:en.call(Ne,Le)}catch(Sn){console.warn("[WebShell] inline tag tooltip render failed",Sn)}const cn=typeof tt=="string"||typeof tt=="number"?String(tt):void 0;return{...ie,...ve?{iconUrl:ve}:{},...qe.current?{renderContent:qe.current}:{},...tt!=null?{tooltip:tt}:{},...cn?{tooltipText:cn}:{},...ge.current?{onClick:ge.current}:{}}},[]),[_t,Ct]=m.useState(!1),Je=m.useRef(_t);Je.current=_t;const at=E7e({viewRef:O,disabledRef:D,shellModeRef:Je,workspaceActionsRef:de,workspaceKey:C,builtinProviders:k,providers:T,createInlineTagEffect:ie=>p1.of({...ie,tag:Ee(ie.tag)})}),Oe=at.close,Fe=at.refreshForView;m.useEffect(()=>{const ie=O.current;if(!ie)return;const ve=[uu.of()];ie.state.field(Bd).between(0,ie.state.doc.length,(Le,tt,cn)=>{const en=cn.spec.tag;en&&ve.push(p1.of({from:Le,to:tt,tag:Ee(c4(en))}))}),ve.length!==1&&ie.dispatch({effects:ve})},[S,M,_,L,Ee]);const ue=m.useCallback(()=>{var ie,ve,Le;(ie=K.current)!=null&&ie.isVisible&&((ve=te.current)==null||ve.call(te)),Ct(tt=>!tt),(Le=O.current)==null||Le.focus()},[]),[vt,ye]=m.useState(!1),[je,Ye]=m.useState(""),[Nt,Rt]=m.useState([]),[rn,on]=m.useState(0),Bn=m.useRef(null),bs=m.useRef(null),Ss=m.useRef(""),[Ie,lt]=m.useState([]),ne=m.useRef([]),he=m.useRef(new Map),Ve=m.useRef(1),[we,Bt]=m.useState([]),Et=m.useRef([]);Et.current=we;const Tt=m.useRef(b);Tt.current=b;const an=m.useRef(()=>!0),wt=m.useRef(null),[It,Vn]=m.useState(null),kn=m.useRef(null),ln=m.useRef(!1),Wn=m.useCallback(ie=>{kn.current=ie,Vn(ie)},[]),Jn=m.useCallback(()=>{const ie=wt.current,ve=O.current;if(!ie||!ve)return;const Le=ve.state.doc,tt=ie.from+ie.text.length;Le.length===tt&&Le.sliceString(ie.from,tt)===ie.text&&ve.dispatch({changes:{from:ie.from,to:tt,insert:""}}),wt.current=null},[]),Cs=m.useCallback(()=>{Jn(),Oe()},[Jn,Oe]),fr=at.closeIfOpen,Xs=m.useCallback(()=>{const ie=fr();return ie?(ie==="closed"&&Jn(),!0):!1},[Jn,fr]),Vs=m.useCallback((ie,ve)=>{var Sn;if(!ie||D.current||Je.current){Wn(null);return}if(ln.current){Wn(null);return}const Le=ie.state.selection.main;if(!Le.empty){Wn(null);return}const tt=n7e(ie.state.doc.toString(),Le.head,G.current,q.current,oe.current,Gs=>ee.current(Gs),N.current??Gy);if(!tt){Wn(null);return}Cs();const cn=ve??((Sn=kn.current)==null?void 0:Sn.selectedIndex)??0,en=Math.max(0,Math.min(cn,tt.items.length-1));Wn({...tt,selectedIndex:en})},[Cs,Wn]),_n=m.useCallback(()=>{Wn(null)},[Wn]),fn=m.useCallback(ie=>{const ve=kn.current;return!ve||ie<0||ie>=ve.items.length?!1:(ve.selectedIndex===ie||Wn({...ve,selectedIndex:ie}),!0)},[Wn]),qn=m.useCallback(ie=>{const ve=kn.current;if(!ve)return!1;const Le=B7e(ve.selectedIndex,ve.items.length,ie);return Le===null?!1:(Wn({...ve,selectedIndex:Le}),!0)},[Wn]),Zn=m.useCallback(ie=>{const ve=O.current,Le=kn.current;if(!ve||!Le)return!1;const tt=Le.items[ie??Le.selectedIndex];return tt?(ve.dispatch({changes:{from:Le.from,to:Le.to,insert:tt.apply},selection:{anchor:Le.from+tt.apply.length},scrollIntoView:!0}),ve.focus(),!0):!1},[]),[$n,es]=m.useState(!1);m.useEffect(()=>{const ie=O.current,ve=(ie==null?void 0:ie.state.doc.toString())??"",Le=vf(ve,g!=null&&g.isVisible?g.suggestion:null);es(ve.trim().length>0||!!Le||we.length>0||Ie.length>0)},[we,Ie,g==null?void 0:g.isVisible,g==null?void 0:g.suggestion]);const ss=OP(),Ps=OP("qwen-web-shell-command-history"),{push:jr,navigateUp:Ui,navigateDown:Bs,isNavigating:zr,reset:sr,getReverseMatches:Qs,getLastEntry:gs,resetSearch:ts}=ss,mn=m.useRef({push:jr,navigateUp:Ui,navigateDown:Bs,isNavigating:zr,reset:sr,getReverseMatches:Qs,getLastEntry:gs,resetSearch:ts});mn.current={push:jr,navigateUp:Ui,navigateDown:Bs,isNavigating:zr,reset:sr,getReverseMatches:Qs,getLastEntry:gs,resetSearch:ts};const Rn=m.useRef(Ps);Rn.current=Ps,ne.current=Ie;const br=m.useCallback(ie=>{const ve=Je.current,tt=(ve?Rn.current:mn.current).getReverseMatches(ie);return ve?tt:tt.filter(cn=>!cn.trimStart().startsWith("/"))},[]),Se=m.useCallback(()=>{if(D.current)return;const ie=O.current;if(!ie)return;_n(),Cs();const ve=ie.state.doc.toString();Ss.current=ve,ye(!0),Ye("");const Le=Je.current?Rn.current:mn.current;Rt(br("")),on(0),Le.resetSearch(),setTimeout(()=>{var tt;return(tt=Bn.current)==null?void 0:tt.focus()},0)},[Cs,_n,br]),xe=m.useRef(Se);xe.current=Se;const kt=m.useCallback(()=>{if(D.current)return;const ie=O.current;if(!ie)return;if(ma(ie.state)==="active"){Yd(!1)(ie),ie.focus();return}if(ie.state.doc.lines>1){ie.focus();return}const ve=Je.current?Rn.current:mn.current,Le=ie.state.doc.toString(),tt=ve.navigateUp(Le);tt!==null&&ie.dispatch({changes:{from:0,to:ie.state.doc.length,insert:tt},selection:{anchor:tt.length}}),ie.focus()},[]),Ot=m.useCallback(()=>{if(D.current)return;const ie=O.current;if(!ie)return;if(ma(ie.state)==="active"){Yd(!0)(ie),ie.focus();return}if(ie.state.doc.lines>1){ie.focus();return}const Le=(Je.current?Rn.current:mn.current).navigateDown();Le!==null&&ie.dispatch({changes:{from:0,to:ie.state.doc.length,insert:Le},selection:{anchor:Le.length}}),ie.focus()},[]);m.useEffect(()=>{var Fr,qa;if(!F.current)return;P7e();const ie=document.createElement("div");ie.setAttribute("data-web-shell-tooltip-portal",""),ie.style.position="fixed",ie.style.inset="0",ie.style.zIndex="var(--web-shell-tooltip-z-index)",ie.style.pointerEvents="none";const ve=/\b\S*theme(?:Dark|Light)\S*/gi,Le=()=>{var pt,gn;let Pe=F.current,ct=null;if(F.current){const pn=getComputedStyle(F.current);for(let Ln=0;Ln<pn.length;Ln+=1){const is=pn[Ln];is.startsWith("--")&&ie.style.setProperty(is,pn.getPropertyValue(is))}pn.getPropertyValue("--web-shell-tooltip-z-index").trim()||ie.style.setProperty("--web-shell-tooltip-z-index","1000")}for(;Pe;){const pn=(gn=(pt=Pe.className)==null?void 0:pt.match)==null?void 0:gn.call(pt,ve);if(pn){ct=pn[0];break}Pe=Pe.parentElement}ct&&(ie.className=ct)};Le(),document.body.appendChild(ie);const tt=new MutationObserver(Le);let cn=F.current;for(;cn&&(tt.observe(cn,{attributes:!0,attributeFilter:["class","style"]}),!((qa=(Fr=cn.className)==null?void 0:Fr.match)!=null&&qa.call(Fr,ve)));)cn=cn.parentElement;const en=(Pe,ct,pt)=>{const gn=pt===void 0?sEe(Pe):[],pn=Pe.state.doc.toString(),Ln=K.current,is=ct===void 0&&gn.length===0&&(Ln!=null&&Ln.isVisible)?vf(pn,Ln.suggestion):null,Sr=ct??is??pn,si=Sr.length-Sr.trimStart().length,ri=Sr.trim(),Ha=ct===void 0&&is===null?gn.map(ii=>({...ii,start:ii.start-si,end:ii.end-si})).filter(ii=>ii.end>0).map(ii=>({...ii,start:Math.max(0,ii.start)})):[],Fo=pt??Et.current;if(!ri&&Fo.length===0&&gn.length===0)return!0;const Ua=pt===void 0?Z7e(ri,Ha):ri,lo=X7e(he.current,Ua),ca=J7e(lo,Fo),Va=ne.current,Wa=Je.current,Yc=Wa?`!${ca}`:ca,ua=ohe(Yc,[...Fo,...Ha.map(ii=>ii.tag)]);let rd=!1;const id=()=>{var ii,Xc;rd||(rd=!0,Wn(null),is&&((ii=se.current)==null||ii.call(se,"enter",{skipOnAccept:!0})),(Xc=te.current)==null||Xc.call(te),he.current.clear(),Ve.current=1,Wa?(Rn.current.push(lo),Rn.current.reset()):(mn.current.push(lo),mn.current.reset()),ln.current=!1,Bt([]),lt([]),Pe.dispatch({changes:{from:0,to:Pe.state.doc.length,insert:""},effects:uu.of()}))};return X.current(Yc,Va.length>0?[...Va]:void 0,id,ua.length>0?{inputAnnotations:ua}:void 0)===!1||id(),!0};an.current=en;const Sn=Pe=>(Pe.dispatch(Pe.state.replaceSelection(`
`)),!0),Gs=(Pe,ct)=>{var Ln;const pt=K.current,gn=pt==null?void 0:pt.suggestion,pn=vf(Pe.state.doc.toString(),gn);return!(pt!=null&&pt.isVisible)||!pn?!1:(Pe.dispatch({changes:{from:0,to:Pe.state.doc.length,insert:pn},selection:{anchor:pn.length},scrollIntoView:!0}),Pe.focus(),(Ln=se.current)==null||Ln.call(se,ct,{skipOnAccept:!0}),!0)},Xe=E0.of([{key:"Backspace",run:Pe=>{var pn;const ct=Pe.state.selection.main;if(!ct.empty||ct.from!==0)return!1;let pt=!1;if(Pe.state.field(Bd).between(0,1,Ln=>{Ln===0&&(pt=!0)}),pt)return!1;let gn=-1;for(let Ln=Et.current.length-1;Ln>=0;Ln-=1)if(((pn=Et.current[Ln])==null?void 0:pn.removable)!==!1){gn=Ln;break}return gn<0?!1:(Bt(Ln=>Ln.filter((is,Sr)=>Sr!==gn)),!0)}},{key:"Delete",run:Pe=>{const ct=Pe.state.selection.main;if(!ct.empty||ct.from!==0)return!1;let pt=!1;if(Pe.state.field(Bd).between(0,1,pn=>{pn===0&&(pt=!0)}),pt)return!1;const gn=Et.current.findIndex(pn=>pn.removable!==!1);return gn<0?!1:(Bt(pn=>pn.filter((Ln,is)=>is!==gn)),!0)}},{key:"Enter",run:Pe=>{var pn;if(at.accept())return!0;if(kn.current)return Zn();if(ma(Pe.state)==="active")return!1;const ct=K.current,gn=qP(Pe).length>0?null:vf(Pe.state.doc.toString(),ct==null?void 0:ct.suggestion);return ct!=null&&ct.isVisible&&gn?((pn=se.current)==null||pn.call(se,"enter",{skipOnAccept:!0}),en(Pe,gn)):en(Pe)}},{key:"Shift-Enter",run:Sn},{key:"Ctrl-j",run:Sn},{key:"Mod-Enter",run:Sn},{key:"Alt-Enter",run:Sn},{key:"Escape",run:()=>Xs()?!0:kn.current?(_n(),!0):Je.current?(Ct(!1),!0):!1},{key:"Ctrl-o",run:()=>!0},{key:"Ctrl-l",run:()=>!0},{key:"Ctrl-y",run:()=>!0},{key:"ArrowUp",run:Pe=>{var is;const ct=Je.current?Rn.current:mn.current;if(ln.current)jx(Pe),_n(),Cs();else{if(at.moveSelection("up")||qn("up"))return!0;if(ma(Pe.state)==="active")return Yd(!1)(Pe)}const gn=GP(Pe,"up");if(gn==="handled")return!0;if(gn==="editor")return!1;if(Je.current){const Sr=Pe.state.doc.toString(),si=ct.navigateUp(Sr);return si===null||(ln.current=!0,Pe.dispatch({changes:{from:0,to:Pe.state.doc.length,insert:si},selection:{anchor:si.length}})),!0}if(re.current.length>0&&(is=Q.current)!=null&&is.call(Q))return!0;const pn=Pe.state.doc.toString(),Ln=ct.navigateUp(pn);return Ln===null?!1:(ln.current=!0,Pe.dispatch({changes:{from:0,to:Pe.state.doc.length,insert:Ln},selection:{anchor:Ln.length}}),!0)}},{key:"ArrowDown",run:Pe=>{var Ln;const ct=Je.current?Rn.current:mn.current;if(ln.current)jx(Pe),_n(),Cs();else{if(at.moveSelection("down")||qn("down"))return!0;if(ma(Pe.state)==="active")return Yd(!0)(Pe)}const gn=GP(Pe,"down");if(gn==="handled")return!0;if(gn==="editor")return!1;if(Je.current){const is=ct.navigateDown();return is===null||(ln.current=ct.isNavigating(),Pe.dispatch({changes:{from:0,to:Pe.state.doc.length,insert:is},selection:{anchor:is.length}})),!0}const pn=ct.navigateDown();return pn===null?((Ln=ce.current)==null?void 0:Ln.call(ce))??!1:(ln.current=ct.isNavigating(),Pe.dispatch({changes:{from:0,to:Pe.state.doc.length,insert:pn},selection:{anchor:pn.length}}),!0)}},{key:"Ctrl-r",run:()=>(xe.current(),!0)},{key:"Tab",run:Pe=>{if(at.accept()||Gs(Pe,"tab"))return!0;if(kn.current)return Zn();if(ma(Pe.state)==="active")return xX(Pe);const ct=Pe.state.doc.toString(),pt=Q8e(ct,G.current,oe.current);if(pt)return Pe.dispatch({changes:{from:0,to:Pe.state.doc.length,insert:pt},selection:{anchor:pt.length}}),!0;const gn=X8e(ct,G.current);return gn&&Pe.dispatch({changes:{from:0,to:Pe.state.doc.length,insert:gn},selection:{anchor:gn.length}}),!0}},{key:"ArrowRight",run:Pe=>!!(ma(Pe.state)!=="active"&&Gs(Pe,"right"))},{key:"Shift-Tab",run:()=>{var Pe;return(Pe=z.current)==null||Pe.call(z),!0}}]),Ft=yt.updateListener.of(Pe=>{if(Pe.docChanged&&he.current.size>0){const pt=Y7e(he.current,Pe.state.doc.toString());pt!==null&&(Ve.current=pt)}Pe.transactions.some(pt=>pt.isUserEvent("input")||pt.isUserEvent("delete"))&&(ln.current=!1),(Pe.docChanged||Pe.selectionSet)&&(Vs(Pe.view),ln.current?Cs():Fe(Pe.view)&&_n())});let zn=!1;const gi=yt.updateListener.of(Pe=>{const ct=wt.current,pt=ma(Pe.state)==="active";if(ct){const gn=Pe.state.doc;if(!(gn.length===ct.from+ct.text.length&&gn.sliceString(ct.from)===ct.text))wt.current=null;else if(zn&&!pt){wt.current=null;const{view:Ln}=Pe,{from:is}=ct;window.setTimeout(()=>{if(O.current!==Ln)return;const Sr=Ln.state.doc;Sr.length===is+ct.text.length&&Sr.sliceString(is)===ct.text&&Ln.dispatch({changes:{from:is,to:is+ct.text.length,insert:""}})},0)}}zn=pt,pt||F7e(ie)}),Us=ws.create({doc:"",extensions:[Bh.highest(Xe),x8e,h9(),E0.of([...p9,...f9]),TX({override:[],activateOnTyping:!0,icons:!1,optionClass:Pe=>{const ct=[];return Pe.type==="file"&&ct.push("cm-file-completion"),N9(Pe)&&ct.push("cm-command-info-completion"),ct.join(" ")},addToOptions:[{render:U7e,position:90}],maxRenderedOptions:300,aboveCursor:!0,positionInfo:(Pe,ct,pt,gn,pn)=>{const Ln=gn.bottom-gn.top,is=pn.bottom-ct.bottom,Sr=is>=Ln||is>ct.top,si=Sr?"top":"bottom",ri=Sr?pt.bottom-ct.top:ct.bottom-pt.top;return{style:`${si}: ${ri}px`,class:"cm-completionInfo-right-narrow"}},activateOnCompletion:Pe=>typeof Pe.apply=="string"&&Pe.apply.endsWith(" ")}),r5e({parent:ie}),UP.of(zO("")),VP.of(WP(null)),yt.lineWrapping,HP.of(yt.editable.of(!0)),R7e(()=>G.current,()=>oe.current),j7e,Bd,Ft,gi,yt.updateListener.of(Pe=>{if(Pe.docChanged){const ct=Pe.state.doc.toString(),pt=K.current,gn=vf(ct,pt!=null&&pt.isVisible?pt.suggestion:null);es(ct.trim().length>0||!!gn||Et.current.length>0||ne.current.length>0)}}),yt.inputHandler.of((Pe,ct,pt,gn)=>{var pn;return gn==="!"&&Pe.state.doc.toString()===""&&ma(Pe.state)!=="active"?(ue(),!0):gn==="?"&&Pe.state.doc.toString()===""&&ma(Pe.state)!=="active"?((pn=U.current)==null||pn.call(U),!0):!1}),yt.domEventHandlers({blur(Pe){return _n(),Pe.relatedTarget instanceof Element&&Pe.relatedTarget.closest('[data-at-mention-panel="true"]')||window.setTimeout(()=>{const ct=O.current;ct!=null&&ct.hasFocus||document.activeElement instanceof Element&&document.activeElement.closest('[data-at-mention-panel="true"]')||Cs()},0),!1},paste(Pe){var Sr,si,ri,Ha;const ct=(Sr=Pe.clipboardData)==null?void 0:Sr.items;if(!ct)return!1;let pt=!1;for(const Fo of ct)if(Fo.type.startsWith("image/")&&/^image\/(png|jpeg|gif|webp)$/i.test(Fo.type)){pt=!0;const Ua=Fo.getAsFile();if(!Ua)continue;const lo=Fo.type,ca=new FileReader;ca.onload=()=>{const Va=ca.result.split(",")[1];lt(Wa=>[...Wa,{data:Va,media_type:lo}])},ca.readAsDataURL(Ua)}if(pt)return Pe.preventDefault(),!0;const gn=V7e(((si=Pe.clipboardData)==null?void 0:si.getData("text/plain"))??"");if(!gn||!W7e(gn))return!1;Pe.preventDefault(),ni.state.doc.toString()===""&&((ri=K.current)!=null&&ri.isVisible)&&((Ha=te.current)==null||Ha.call(te));const{placeholderText:pn,nextPasteId:Ln}=K7e(he.current,Ve.current,gn);Ve.current=Ln;const is=ni.state.selection.main;return ni.dispatch({changes:{from:is.from,to:is.to,insert:pn},selection:{anchor:is.from+pn.length},scrollIntoView:!0}),!0}}),yt.theme(I)]}),ni=new yt({state:Us,parent:F.current});O.current=ni,ni.focus();const rs=ni.state.doc.toString().trim();return es(rs.length>0||Et.current.length>0||ne.current.length>0),()=>{ni.dispatch({effects:uu.of()}),ni.destroy(),O.current=null,tt.disconnect(),ie.remove()}},[]),m.useEffect(()=>{const ie=O.current;ie&&(ie.dispatch({effects:HP.reconfigure(yt.editable.of(!r))}),r||ie.focus())},[r]),m.useEffect(()=>{const ie=O.current;if(!ie)return;const ve=!r&&(g!=null&&g.isVisible)&&g.suggestion?g.suggestion:null,Le=ve??(_t?B("editor.shellPlaceholder"):i);ie.dispatch({effects:[UP.reconfigure(zO(Le)),VP.reconfigure(WP(ve))]})},[r,i,_t,B,g==null?void 0:g.isVisible,g==null?void 0:g.suggestion]),m.useEffect(()=>{const ie=O.current;!ie||ma(ie.state)!=="active"||(jx(ie),window.setTimeout(()=>{O.current===ie&&Rx(ie)},0))},[P]);const xt=[o.map(ie=>{var ve;return[ie.name,ie.description??"",ie.source??"",ie.displayCategory??"",ie.argumentHint??"",((ve=ie.subcommands)==null?void 0:ve.join(","))??""].join("\0")}).join(""),a.map(ie=>[ie.name,ie.description].join("\0")).join(""),(l==null?void 0:l.join("|"))??""].join("");m.useEffect(()=>{kn.current&&Vs(O.current)},[xt,P,Vs]),m.useEffect(()=>{const ie=O.current;ie&&(p?(_n(),Cs(),ie.contentDOM.blur()):ie.focus())},[Cs,p,_n]),m.useEffect(()=>{const ie=ve=>{var Ft,zn,gi;if(D.current||vt||p||ve.defaultPrevented)return;const Le=ve.target,tt=(Ft=F.current)==null?void 0:Ft.contains(Le),cn=document.activeElement===document.body;if(!tt&&!cn)return;const en=O.current,Sn=K.current,Gs=vf((en==null?void 0:en.state.doc.toString())??"",Sn==null?void 0:Sn.suggestion);if(en&&!en.hasFocus&&(Sn!=null&&Sn.isVisible)&&Gs&&!Yy(ve.target)){if(ve.key==="Tab"&&!ve.shiftKey&&!ve.metaKey&&!ve.ctrlKey&&!ve.altKey&&ma(en.state)!=="active"){ve.preventDefault(),en.dispatch({changes:{from:0,to:en.state.doc.length,insert:Gs},selection:{anchor:Gs.length},scrollIntoView:!0}),en.focus(),(zn=se.current)==null||zn.call(se,"tab",{skipOnAccept:!0});return}if(ve.key==="ArrowRight"&&!ve.shiftKey&&!ve.metaKey&&!ve.ctrlKey&&!ve.altKey&&ma(en.state)!=="active"){ve.preventDefault(),en.dispatch({changes:{from:0,to:en.state.doc.length,insert:Gs},selection:{anchor:Gs.length},scrollIntoView:!0}),en.focus(),(gi=se.current)==null||gi.call(se,"right",{skipOnAccept:!0});return}}if(ve.metaKey||ve.ctrlKey||ve.altKey||ve.key.length!==1||Yy(ve.target)||!en||en.hasFocus)return;if(ve.preventDefault(),ve.key==="!"&&en.state.doc.toString()===""){ue();return}const Xe=en.state.selection.main;en.dispatch({changes:{from:Xe.from,to:Xe.to,insert:ve.key},selection:{anchor:Xe.from+ve.key.length},scrollIntoView:!0}),en.focus(),ve.key==="/"?window.setTimeout(()=>{Vs(O.current)},0):ve.key==="@"&&window.setTimeout(()=>{const Us=O.current;Us&&Us.hasFocus&&(_n(),Fe(Us))},0)};return window.addEventListener("keydown",ie),()=>window.removeEventListener("keydown",ie)},[Fe,_n,vt,p,Vs,ue]);const An=m.useCallback(()=>{var ie;(ie=O.current)==null||ie.focus()},[]),Gn=m.useCallback((ie,ve)=>{const Le=O.current;if(!Le||!ie){Le==null||Le.focus();return}if((ve==null?void 0:ve.mode)==="replace"){Le.dispatch({changes:{from:0,to:Le.state.doc.length,insert:ie},effects:uu.of(),selection:{anchor:ie.length},scrollIntoView:!0}),Le.focus();return}const tt=Le.state.selection.main;let cn=ie,en=!1,Sn=null;const Gs=ie==="@";let Xe=ie==="/";if(ie==="/")Le.state.doc.lineAt(tt.head).text.startsWith("/")?en=!0:Le.state.doc.length>0&&(en=!0,Xe=!1);else if(ie==="@"){const Ft=tt.from>0?Le.state.doc.sliceString(tt.from-1,tt.from):"";Le.state.doc.sliceString(tt.from,tt.from+1)==="@"?(en=!0,Sn=tt.from+1):Ft==="@"?en=!0:Ft&&!/\s/.test(Ft)&&(cn=" @")}en?Sn!==null&&Le.dispatch({selection:{anchor:Sn},scrollIntoView:!0}):(Le.dispatch({changes:{from:tt.from,to:tt.to,insert:cn},selection:{anchor:tt.from+cn.length},scrollIntoView:!0}),Gs&&(wt.current={text:cn,from:tt.from})),Le.focus(),Xe?window.setTimeout(()=>{Vs(O.current)},0):Gs&&window.setTimeout(()=>{const Ft=O.current;Ft&&Ft.hasFocus&&(_n(),Fe(Ft))},0)},[_n,Fe,Vs]),Js=m.useCallback(()=>{var ie;return((ie=O.current)==null?void 0:ie.state.doc.toString())??""},[]),jn=m.useCallback(ie=>{const ve=O.current;ve&&(ve.dispatch({changes:{from:0,to:ve.state.doc.length,insert:ie},effects:uu.of(),selection:{anchor:ie.length},scrollIntoView:!0}),ve.focus())},[]),yn=m.useCallback(ie=>{const ve=O.current;if(!ve)return;const Le=[];ve.state.field(Bd).between(0,ve.state.doc.length,(tt,cn,en)=>{const Sn=en.spec.tag;Sn&&(!ie||ie(Sn))&&Le.push({from:tt,to:cn,insert:""})}),ve.dispatch({...Le.length>0?{changes:Le}:{},effects:R9.of({predicate:ie}),scrollIntoView:!0})},[]),Mn=m.useCallback(ie=>{const ve=(ie==null?void 0:ie.text)??!0,Le=(ie==null?void 0:ie.tags)??!0,tt=O.current;ve&&tt&&tt.state.doc.length>0&&tt.dispatch({changes:{from:0,to:tt.state.doc.length,insert:""},effects:uu.of()}),ve&&(lt([]),he.current.clear(),Ve.current=1),Le&&(Bt([]),ve||yn())},[yn]),Lr=m.useCallback(()=>{Mn({text:!0,tags:!1})},[Mn]),ti=m.useCallback((ie,ve)=>{if(ie.length!==0){if((ve==null?void 0:ve.placement)==="inline"){const Le=O.current;if(!Le)return;const tt=Le.state.selection.main;let cn=tt.from;const en=[],Sn=ie.map(Xe=>{const Ft=ny(Xe);return en.push({from:cn,to:cn+Ft.length,tag:Xe}),cn+=Ft.length+1,Ft}).join(" "),Gs=Sn?`${Sn} `:"";Le.dispatch({changes:{from:tt.from,to:tt.to,insert:Gs},effects:en.length>0?en.map(Xe=>p1.of({...Xe,tag:Ee(Xe.tag)})):void 0,selection:{anchor:tt.from+Gs.length},scrollIntoView:!0}),Le.focus();return}Bt(Le=>{const tt=[...Le];for(const cn of ie){const en=tt.findIndex(Sn=>Sn.id===cn.id);en>=0?tt[en]=cn:tt.push(cn)}return tt})}},[Ee]),_r=m.useCallback(ie=>{Bt(ve=>ve.filter(Le=>Le.id!==ie||Le.removable===!1)),yn(ve=>ve.id===ie&&ve.removable!==!1)},[yn]),W=m.useCallback(()=>{var ie;return(((ie=O.current)==null?void 0:ie.state.doc.toString().trim().length)??0)>0||Et.current.length>0||ne.current.length>0},[]),fe=m.useCallback(ie=>{const ve=O.current;if(!ve)return;const Le=qP(ve);if((ie==null?void 0:ie.tagPlacement)==="inline"){an.current(ve,ie.text??"",ie.tags??Le);return}if((ie==null?void 0:ie.text)!==void 0&&ie.tags===void 0&&Le.length>0){an.current(ve,ie.text,Le);return}an.current(ve,ie==null?void 0:ie.text,ie?ie.tags??[]:void 0)},[]),Ae=m.useCallback(()=>{const ie=mn.current.getLastEntry(Le=>!Le.startsWith("/")&&!Le.startsWith("!"));!ie||X.current(ie)===!1||lt([])},[]),He=m.useCallback(ie=>{const ve=O.current;ve&&ve.dispatch({changes:{from:0,to:ve.state.doc.length,insert:ie},selection:{anchor:ie.length},scrollIntoView:!0})},[]);m.useEffect(()=>{const ie=Tt.current;if(!ie)return;const ve=O.current;if(!ve)return;const Le=ie.tagPlacement??"top";if(ie.tags!==void 0&&Le==="top"&&Bt([...ie.tags]),ie.text!==void 0||Le==="inline"){const cn=Le==="inline"?[...ie.tags??[]]:[],en=cn.map(ny).join(" "),Sn=Le==="inline"?en&&ie.text?`${en} ${ie.text}`:en||(ie.text??""):ie.text??"",Gs=[uu.of()];if(cn.length>0){let Xe=0;for(const Ft of cn){const zn=ny(Ft);Gs.push(p1.of({from:Xe,to:Xe+zn.length,tag:Ee(Ft)})),Xe+=zn.length+1}}ve.dispatch({changes:{from:0,to:ve.state.doc.length,insert:Sn},effects:Gs,selection:{anchor:Sn.length},scrollIntoView:!0})}else ve.dispatch({effects:uu.of()});(ie.text!==void 0||ie.submit)&&ve.focus();let tt=null;return ie.submit&&(tt=window.setTimeout(()=>{O.current&&fe(ie)},0)),()=>{tt!==null&&window.clearTimeout(tt)}},[x,Ee,fe]);const Ge=m.useCallback((ie,ve=!0)=>{var tt;ie&&He(Ss.current),ye(!1),Ye(""),Rt([]),on(0),(Je.current?Rn.current:mn.current).resetSearch(),ve&&((tt=O.current)==null||tt.focus())},[He]);m.useEffect(()=>{if(!vt)return;const ie=ve=>{if(ve instanceof MouseEvent&&ve.button!==0||ve.defaultPrevented)return;const Le=bs.current,tt=ve.target;Le&&tt instanceof Node&&!Le.contains(tt)&&Ge(!0,!1)};return window.addEventListener("mousedown",ie),window.addEventListener("touchstart",ie),()=>{window.removeEventListener("mousedown",ie),window.removeEventListener("touchstart",ie)}},[vt,Ge]);const zt=m.useCallback(ie=>{var Sn;if(!O.current)return;Ge(!1);const Le=ie.trim();if(!Le)return;const tt=ne.current,cn=Je.current;if(X.current(cn?`!${Le}`:Le,tt.length>0?[...tt]:void 0)===!1){He(ie);return}(Sn=te.current)==null||Sn.call(te),cn?(Rn.current.push(Le),Rn.current.reset()):(mn.current.push(Le),mn.current.reset()),lt([]),He("")},[Ge,He]),dn=ie=>{if(!ie.nativeEvent.isComposing)if(ie.key==="Escape")ie.preventDefault(),Ge(!0);else if(ie.key==="Tab"){ie.preventDefault();const ve=Nt[rn];ve&&He(ve),Ge(!1)}else if(ie.key==="Enter"){ie.preventDefault();const ve=Nt[rn];ve?zt(ve):Ge(!1)}else ie.key==="r"&&ie.ctrlKey&&(ie.preventDefault(),Nt.length>0&&on(ve=>(ve+1)%Nt.length))},hn=ie=>{const ve=Je.current?Rn.current:mn.current;Rt(br(ie)),on(0),ve.resetSearch()},ds=ie=>{const ve=ie.target.value;Ye(ve),!ie.nativeEvent.isComposing&&hn(ve)},Ws=ie=>{const ve=ie.currentTarget.value;Ye(ve),hn(ve)},Ms=m.useCallback(ie=>{lt(ve=>ve.filter((Le,tt)=>tt!==ie))},[]),Ts=!_t&&!vt&&!(g!=null&&g.isVisible)&&!r&&!p,Gr={clearText:Lr,clear:Mn,focus:An,getText:Js,hasInput:W,setText:jn,addTags:ti,removeTag:_r,insertText:Gn,retryLast:Ae,restoreImages:ie=>{lt(ve=>[...ve,...ie])},submit:fe};return{containerRef:F,viewRef:O,focus:An,submitText:m.useCallback(()=>{const ie=O.current;ie&&an.current(ie)},[]),clearText:Lr,getText:Js,hasInput:W,hasContent:$n,handle:Gr,pastedImages:Ie,removeImage:Ms,composerTags:we,removeTopTag:_r,addTags:ti,removeInlineTags:yn,insertText:Gn,setText:jn,submit:fe,clear:Mn,retryLast:Ae,replaceEditorText:He,shellMode:_t,setShellMode:Ct,toggleShellMode:ue,currentMode:h,sessionName:v,searchState:{searchMode:vt,searchQuery:je,searchMatches:Nt,searchActiveIndex:rn,searchInputRef:Bn,searchUiRef:bs,openHistorySearch:Se,closeSearch:Ge,submitSearchMatch:zt,handleSearchKeyDown:dn,handleSearchInput:ds,handleSearchCompositionEnd:Ws},navigatePrevHistory:kt,navigateNextHistory:Ot,showShortcutHints:Ts,followupState:g,disabled:r,onAcceptFollowup:y,onDismissFollowup:w,slashMenu:It,closeSlashMenu:_n,selectSlashCompletion:fn,acceptSlashCompletion:Zn,atMenu:at.state,closeAtMenu:Cs,selectAtCompletion:at.select,acceptAtCompletion:at.accept,enterAtCategory:at.enterCategory,backAtCategories:at.backToCategories,updateAtSearch:at.updateSearch,selectAtTab:at.selectTab}}const aEe="_flash_96ig5_1",Ah={flash:aEe},lEe="_chatMessageRow_17pz3_41",cEe="_chatBubble_17pz3_48",uEe="_chatContent_17pz3_61",dEe="_messageTag_17pz3_66",hEe="_messageTagTooltip_17pz3_83",fEe="_messageTagClickable_17pz3_117",mEe="_messageTagIcon_17pz3_127",pEe="_messageTagLabel_17pz3_138",gEe="_messageTagValue_17pz3_139",yEe="_chatContentCollapsed_17pz3_162",bEe="_toggleButton_17pz3_167",vEe="_toggleIcon_17pz3_188",wEe="_toggleIconExpanded_17pz3_195",xEe="_chatImages_17pz3_199",kEe="_chatImageThumb_17pz3_206",fo={chatMessageRow:lEe,chatBubble:cEe,chatContent:uEe,messageTag:dEe,messageTagTooltip:hEe,messageTagClickable:fEe,messageTagIcon:mEe,messageTagLabel:pEe,messageTagValue:gEe,chatContentCollapsed:yEe,toggleButton:bEe,toggleIcon:vEe,toggleIconExpanded:wEe,chatImages:xEe,chatImageThumb:kEe};function _Ee({composerTagIcons:e,content:t,inputAnnotations:n,onComposerTagClick:s,renderComposerTag:r,renderComposerTagTooltip:i}){const o=m.useMemo(()=>ahe(t,n),[t,n]);return u.jsx(u.Fragment,{children:o.map((a,l)=>a.type==="text"?u.jsx(m.Fragment,{children:a.text},l):u.jsx(lQ,{composerTagIcons:e,onComposerTagClick:s,renderComposerTag:r,renderComposerTagTooltip:i,tag:a.tag,title:a.tag.serialized,preserveCustomKindLabel:!0},`${a.tag.id}:${l}`))})}const SEe=m.memo(function({content:t,images:n,inputAnnotations:s,isLocateFlashing:r=!1}){const{t:i}=ot(),{parseUserMessageContent:o,renderUserMessageContent:a,composerTagIcons:l,renderComposerTag:c,renderComposerTagTooltip:d,onComposerTagClick:h}=zc(),f=m.useRef(null),[p,g]=m.useState(!1),[y,w]=m.useState(!1),v=m.useMemo(()=>{const x=a==null?void 0:a({content:t,images:n,inputAnnotations:s});if(x!=null)return x;if(s&&s.length>0)return u.jsx(_Ee,{composerTagIcons:l,content:t,inputAnnotations:s,onComposerTagClick:h,renderComposerTag:c,renderComposerTagTooltip:d});let k;try{k=o==null?void 0:o(t)}catch(T){return console.warn("[WebShell] failed to parse user message content",T),t}return!k||k.length===0?t:k.map((T,C)=>T.type==="text"?T.text:u.jsx(lQ,{tag:T.tag,composerTagIcons:l,renderComposerTag:c,renderComposerTagTooltip:d,onComposerTagClick:h},`${T.tag.id}-${C}`))},[t,n,s,h,o,l,c,d,a]),b=m.useCallback(()=>{const x=f.current;x&&w(x.scrollHeight>400)},[]);return m.useLayoutEffect(()=>{g(!1),b()},[t,n==null?void 0:n.length,b]),m.useEffect(()=>{const x=f.current;if(!x||typeof ResizeObserver>"u")return;const k=new ResizeObserver(b);return k.observe(x),()=>k.disconnect()},[b]),u.jsx("div",{className:fo.chatMessageRow,children:u.jsxs("div",{className:`${fo.chatBubble}${r?` ${Ah.flash}`:""}`,children:[u.jsxs("div",{ref:f,className:`${fo.chatContent} ${y&&!p?fo.chatContentCollapsed:""}`,children:[n&&n.length>0&&u.jsx("div",{className:fo.chatImages,children:n.map((x,k)=>{const T=x.data.startsWith("data:")?x.data:`data:${x.mimeType};base64,${x.data}`;return eg(T)?u.jsx("img",{src:T,alt:i("user.uploadedImage",{index:k+1}),className:fo.chatImageThumb,onLoad:b},k):null})}),v]}),y&&u.jsxs("button",{type:"button",className:fo.toggleButton,onClick:()=>g(x=>!x),children:[u.jsx("span",{children:i(p?"userMessage.showLess":"userMessage.showMore")}),u.jsx("svg",{className:`${fo.toggleIcon} ${p?fo.toggleIconExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"m4 6 4 4 4-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})]})]})})});function CEe(e){return I9(e)}function lQ({tag:e,composerTagIcons:t,renderComposerTag:n,renderComposerTagTooltip:s,onComposerTagClick:r,title:i,preserveCustomKindLabel:o=!1}){const a={tag:e,placement:"user-message",readonly:!0};let l,c;try{l=n==null?void 0:n(a)}catch(b){console.warn("[WebShell] user message tag render failed",b)}try{c=s==null?void 0:s(a)}catch(b){console.warn("[WebShell] user message tag tooltip render failed",b)}const d=!!r,h=o?lhe(e,t):null,f=a4(e),p=(h==null?void 0:h.tagValue)??l4(e),g=(h==null?void 0:h.tagLabel)??(e.kind?"":f),y=(h==null?void 0:h.fallback)??e.id,w=e.icon??(h==null?void 0:h.iconUrl)??vm(e.kind,t),v=w&&eg(w)?w:void 0;return u.jsxs("span",{className:`${fo.messageTag}${d?` ${fo.messageTagClickable}`:""}`,role:d?"button":void 0,tabIndex:d?0:void 0,title:i??CEe(e),onClick:b=>{d&&(b.stopPropagation(),r==null||r({...a,anchorRect:b.currentTarget.getBoundingClientRect()}))},onKeyDown:b=>{d&&(b.key!=="Enter"&&b.key!==" "||(b.preventDefault(),r==null||r({...a,anchorRect:b.currentTarget.getBoundingClientRect()})))},children:[l??u.jsxs(u.Fragment,{children:[v&&u.jsx("span",{className:fo.messageTagIcon,style:Xd("--user-message-tag-icon-url",v),"aria-hidden":"true"}),g&&u.jsx("span",{className:fo.messageTagLabel,children:g}),p?u.jsx("span",{className:fo.messageTagValue,children:p}):g?null:u.jsx("span",{className:fo.messageTagLabel,children:y})]}),c!=null&&u.jsx("span",{className:fo.messageTagTooltip,role:"tooltip",children:c})]})}const TEe="_message_yozed_1",EEe="_customFooter_yozed_7",AEe="_messageFooter_yozed_11",MEe="_copyButton_yozed_27",NEe="_footerTime_yozed_53",IEe="_thinking_yozed_65",REe="_thinkingBody_yozed_77",jEe="_thinkingSummary_yozed_108",LEe="_thinkingSummaryTextActive_yozed_130",DEe="_thinkingSummaryIcon_yozed_136",OEe="_thinkingSummaryText_yozed_130",PEe="_thinkingChevronRight_yozed_193",BEe="_thinkingChevronDown_yozed_194",$Ee="_thinkingExpandedWrap_yozed_255",zEe="_thinkingExpandedClip_yozed_259",FEe="_thinkingExpandedCollapsed_yozed_267",qEe="_thinkingExpandedInner_yozed_271",HEe="_content_yozed_319",UEe="_contentBody_yozed_324",Or={message:TEe,customFooter:EEe,messageFooter:AEe,copyButton:MEe,footerTime:NEe,thinking:IEe,thinkingBody:REe,thinkingSummary:jEe,thinkingSummaryTextActive:LEe,thinkingSummaryIcon:DEe,thinkingSummaryText:OEe,thinkingChevronRight:PEe,thinkingChevronDown:BEe,thinkingExpandedWrap:$Ee,thinkingExpandedClip:zEe,thinkingExpandedCollapsed:FEe,thinkingExpandedInner:qEe,content:HEe,contentBody:UEe},VEe=m.memo(function({content:t,isStreaming:n,timestamp:s,onBranchSession:r,showFooterActions:i=!1,showBranchAction:o=!1,isLocateFlashing:a=!1,customFooterInfo:l}){const{t:c}=ot(),{renderAssistantTurnFooter:d}=zc(),[h,f]=m.useState(!1),p=!!t&&!n&&i,g=m.useMemo(()=>l?d==null?void 0:d(l):void 0,[l,d]),y=m.useCallback(()=>{var v;const w=(v=navigator.clipboard)==null?void 0:v.writeText(t);w&&w.then(()=>{f(!0),window.setTimeout(()=>f(!1),2e3)}).catch(()=>{})},[t]);return u.jsxs("div",{className:Or.message,children:[t&&u.jsx("div",{className:`${Or.content}${a?` ${Ah.flash}`:""}`,children:u.jsx("div",{className:Or.contentBody,children:u.jsx(tg,{content:t,source:"assistant",isStreaming:n})})}),g&&u.jsx("div",{className:Or.customFooter,children:g}),p&&u.jsxs("div",{className:Or.messageFooter,children:[u.jsx("button",{type:"button",className:Or.copyButton,title:c("assistant.copy"),"aria-label":c("assistant.copy"),onClick:y,children:h?u.jsx(GEe,{}):u.jsx(WEe,{})}),o&&r&&u.jsx("button",{type:"button",className:Or.copyButton,title:c("assistant.branch"),"aria-label":c("assistant.branch"),onClick:r,children:u.jsx(KEe,{})}),s!==void 0&&u.jsx("span",{className:Or.footerTime,"aria-hidden":"true",children:y0(s)})]})]})});function WEe(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("path",{d:"M5.2 4.4V3.2c0-.7.5-1.2 1.2-1.2h5.4c.7 0 1.2.5 1.2 1.2v5.4c0 .7-.5 1.2-1.2 1.2h-1.2",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.3"}),u.jsx("rect",{x:"3",y:"5.2",width:"7.8",height:"7.8",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]})}function GEe(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"m3.5 8.3 3 3L12.8 5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function KEe(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("path",{d:"M5 3.5v5.2c0 2.1 1.7 3.8 3.8 3.8H11",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.35"}),u.jsx("path",{d:"M5 8.2h3.2c1.5 0 2.8-1.2 2.8-2.8V4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.35"}),u.jsx("circle",{cx:"5",cy:"3.5",r:"1.5",fill:"currentColor"}),u.jsx("circle",{cx:"11",cy:"4",r:"1.5",fill:"currentColor"}),u.jsx("circle",{cx:"11",cy:"12.5",r:"1.5",fill:"currentColor"})]})}const YEe=m.memo(function({content:t,isStreaming:n,timestamp:s,isLocateFlashing:r=!1}){const{t:i}=ot(),o=m.useContext(dm),[a,l]=m.useState(!1),c=n===!0,d=m.useRef(s??Date.now()),h=m.useRef(c),[f,p]=m.useState(()=>Date.now()),[g,y]=m.useState(null);m.useEffect(()=>{if(!t||!c)return;p(Date.now());const k=setInterval(()=>p(Date.now()),1e3);return()=>clearInterval(k)},[t,c]),m.useEffect(()=>{if(t){if(c){h.current=!0,y(null);return}h.current&&g===null&&y(Date.now())}},[t,g,c]);const w=c||g!==null?(c?f:g)-d.current:void 0,v=XEe({isStreaming:n,durationMs:w}),b=w!==void 0?QEe(w):"",x=m.useCallback(()=>{l(k=>!k)},[]);return u.jsx("div",{className:`${Or.message}${r?` ${Ah.flash}`:""}`,children:t&&!o&&u.jsx("div",{className:Or.thinking,children:u.jsxs("div",{className:Or.thinkingBody,children:[u.jsxs("button",{type:"button",className:Or.thinkingSummary,onClick:x,"aria-expanded":a,title:i(a?"thinking.collapse":"thinking.expand"),children:[u.jsx("span",{className:Or.thinkingSummaryIcon,"aria-hidden":"true",children:u.jsx(JEe,{})}),u.jsx("span",{className:c?`${Or.thinkingSummaryText} ${Or.thinkingSummaryTextActive}`:Or.thinkingSummaryText,children:i(v,b?{duration:b}:{})}),u.jsx("span",{className:a?Or.thinkingChevronDown:Or.thinkingChevronRight,"aria-hidden":"true"})]}),u.jsx("div",{className:a?Or.thinkingExpandedClip:`${Or.thinkingExpandedClip} ${Or.thinkingExpandedCollapsed}`,children:u.jsx("div",{className:Or.thinkingExpandedInner,children:u.jsx("div",{className:Or.thinkingExpandedWrap,children:u.jsx(tg,{content:t,source:"thinking",isStreaming:n})})})})]})})})});function XEe({isStreaming:e,durationMs:t}){return e?"thinking.running":t!==void 0&&t<1e3?"thinking.doneBriefly":"thinking.done"}function QEe(e){const t=Math.max(1,Math.round(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60),s=t%60;return s>0?`${n}m ${s}s`:`${n}m`}function JEe(){return u.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[u.jsx("path",{d:"M7.2 15.2h4",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"}),u.jsx("path",{d:"M6.5 13.1h5.4",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"}),u.jsx("path",{d:"M9.1 2.8c-3 0-5.1 2.3-5.1 5 0 1.7.8 3.1 2.1 4 .5.4.8.8.8 1.4h4.5c0-.6.3-1 .8-1.4 1.3-.9 2.1-2.3 2.1-4 0-.8-.2-1.6-.6-2.3",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M13.2 1.8 14 3.6l1.8.8-1.8.8-.8 1.8-.8-1.8-1.8-.8 1.8-.8.8-1.8Z",fill:"currentColor"})]})}const ZEe="_panel_8ng9u_1",eAe="_title_8ng9u_16",tAe="_metaLine_8ng9u_22",nAe="_progress_8ng9u_32",sAe="_spacer_8ng9u_38",rAe="_row_8ng9u_42",iAe="_detailRow_8ng9u_43",oAe="_subDetailRow_8ng9u_44",aAe="_symbol_8ng9u_65",lAe="_label_8ng9u_69",cAe="_value_8ng9u_73",uAe="_detailName_8ng9u_80",dAe="_sectionTitle_8ng9u_88",hAe="_detailSection_8ng9u_94",fAe="_skillBlock_8ng9u_100",mAe="_hint_8ng9u_105",pAe="_detailCommand_8ng9u_111",gAe="_bodyLoaded_8ng9u_132",yAe="_accent_8ng9u_137",bAe="_secondary_8ng9u_141",vAe="_warning_8ng9u_145",wAe="_error_8ng9u_149",xAe="_success_8ng9u_153",xn={panel:ZEe,title:eAe,metaLine:tAe,progress:nAe,spacer:sAe,row:rAe,detailRow:iAe,subDetailRow:oAe,symbol:aAe,label:lAe,value:cAe,detailName:uAe,sectionTitle:dAe,detailSection:hAe,skillBlock:fAe,hint:mAe,detailCommand:pAe,bodyLoaded:gAe,accent:yAe,secondary:bAe,warning:vAe,error:wAe,success:xAe},z8="web-shell:context-usage:v1:",Sd="█",cQ="▒",uQ="░",dQ=30;function kAe(e){return`${z8}${JSON.stringify(e)}`}function _Ae(e){if(!e.startsWith(z8))return null;try{const t=JSON.parse(e.slice(z8.length));return!(t!=null&&t.usage)||typeof t.usage.totalTokens!="number"?null:t}catch{return null}}function hQ(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function R0(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function SAe(e,t){if(t<=0)return"0.0";const n=e/t*100;return n>100?">100":n.toFixed(1)}function CAe(e){return[...e].sort((t,n)=>n.tokens-t.tokens)}function TAe({usedPercentage:e,bufferPercentage:t}){const s=Math.round(Math.min(e,100)/100*56),r=Math.round(Math.min(t,Math.max(0,100-e))/100*56),i=Math.max(0,56-s-r),o=e>80?xn.error:e>60?xn.warning:xn.accent;return u.jsxs("div",{className:xn.progress,"aria-hidden":"true",children:[u.jsx("span",{className:o,children:Sd.repeat(Math.max(0,s))}),u.jsx("span",{className:xn.secondary,children:uQ.repeat(Math.max(0,i))}),u.jsx("span",{className:xn.warning,children:cQ.repeat(Math.max(0,r))})]})}function ou({symbol:e,label:t,tokens:n,tokenLabel:s,contextWindowSize:r,symbolClassName:i=xn.secondary,isOverLimit:o}){return u.jsxs("div",{className:xn.row,children:[u.jsx("span",{className:`${xn.symbol} ${i}`,children:e}),u.jsx("span",{className:xn.label,children:t}),u.jsxs("span",{className:o?xn.error:xn.value,children:[R0(n)," ",s," (",SAe(n,r),"%)"]})]})}const z5="/context detail";function EAe({hint:e,onShowDetail:t}){const n=t?e.indexOf(z5):-1;return n<0?u.jsx("div",{className:xn.hint,children:e}):u.jsxs("div",{className:xn.hint,children:[e.slice(0,n),u.jsx("button",{type:"button",className:xn.detailCommand,onClick:t,children:z5}),e.slice(n+z5.length)]})}function AAe({name:e,tokens:t,tokenLabel:n}){return u.jsxs("div",{className:xn.detailRow,children:[u.jsxs("span",{className:xn.secondary,children:["└"," "]}),u.jsx("span",{className:xn.detailName,title:e,children:hQ(e,dQ)}),u.jsxs("span",{className:xn.value,children:[R0(t)," ",n]})]})}function F5({title:e,items:t,getName:n,tokenLabel:s}){const r=CAe(t);return r.length===0?null:u.jsxs("section",{className:xn.detailSection,children:[u.jsx("div",{className:xn.sectionTitle,children:e}),r.map(i=>u.jsx(AAe,{name:n(i),tokens:i.tokens,tokenLabel:s},n(i)))]})}function MAe({skills:e,labels:t}){const n=[...e].sort((s,r)=>s.loaded!==r.loaded?s.loaded?-1:1:r.tokens+(r.bodyTokens??0)-(s.tokens+(s.bodyTokens??0)));return n.length===0?null:u.jsxs("section",{className:xn.detailSection,children:[u.jsx("div",{className:xn.sectionTitle,children:t.skills}),n.map(s=>u.jsxs("div",{className:xn.skillBlock,children:[u.jsxs("div",{className:xn.detailRow,children:[u.jsxs("span",{className:xn.secondary,children:["└"," "]}),u.jsxs("span",{className:xn.detailName,title:s.name,children:[hQ(s.name,dQ),s.loaded&&u.jsxs("span",{className:xn.success,children:[" ",t.active]})]}),u.jsxs("span",{className:xn.value,children:[R0(s.tokens)," ",t.tokens]})]}),s.loaded&&s.bodyTokens!=null&&s.bodyTokens>0&&u.jsxs("div",{className:xn.subDetailRow,children:[u.jsxs("span",{className:xn.secondary,children:["  └"," "]}),u.jsx("span",{className:xn.bodyLoaded,children:t.bodyLoaded}),u.jsxs("span",{className:xn.success,children:["+",R0(s.bodyTokens)," ",t.tokens]})]})]},s.name))]})}function NAe({status:e,onShowDetail:t}){const{t:n}=ot(),{usage:s}=e,{breakdown:r,contextWindowSize:i}=s,o=i>0?s.totalTokens/i*100:0,a=o>100,l=i>0?r.autocompactBuffer/i*100:0;return u.jsxs("div",{className:xn.panel,children:[u.jsx("div",{className:xn.title,children:n("contextUsage.title")}),s.isEstimated?u.jsx(u.Fragment,{children:u.jsxs("div",{className:xn.metaLine,children:[u.jsxs("span",{children:[n("contextUsage.model"),": ",s.modelName]}),u.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",R0(i)," ",n("contextUsage.tokens")]})]})}):u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:xn.metaLine,children:[u.jsxs("span",{children:[n("contextUsage.model"),": ",s.modelName]}),u.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",R0(i)," ",n("contextUsage.tokens")]})]}),a&&u.jsx("div",{className:xn.error,children:n("contextUsage.overLimit")})]}),u.jsx(TAe,{usedPercentage:Math.min(o,100),bufferPercentage:l}),u.jsx("div",{className:xn.spacer}),u.jsx(ou,{symbol:Sd,label:n("contextUsage.used"),tokens:s.totalTokens,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:a?xn.error:xn.accent,isOverLimit:a}),u.jsx(ou,{symbol:uQ,label:n("contextUsage.free"),tokens:r.freeSpace,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i}),u.jsx(ou,{symbol:cQ,label:n("contextUsage.autocompactBuffer"),tokens:r.autocompactBuffer,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:xn.warning}),u.jsx("div",{className:xn.spacer}),u.jsx("div",{className:xn.sectionTitle,children:n("contextUsage.usageByCategory")}),u.jsx(ou,{symbol:Sd,label:n("contextUsage.systemPrompt"),tokens:r.systemPrompt,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:xn.accent}),u.jsx(ou,{symbol:Sd,label:n("contextUsage.builtinTools"),tokens:r.builtinTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:xn.accent}),r.mcpTools>0&&u.jsx(ou,{symbol:Sd,label:n("contextUsage.mcpTools"),tokens:r.mcpTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:xn.accent}),u.jsx(ou,{symbol:Sd,label:n("contextUsage.memoryFiles"),tokens:r.memoryFiles,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:xn.accent}),u.jsx(ou,{symbol:Sd,label:n("contextUsage.skills"),tokens:r.skills,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:xn.accent}),!s.isEstimated&&u.jsx(ou,{symbol:Sd,label:n("contextUsage.messages"),tokens:r.messages,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:xn.accent}),s.showDetails?u.jsxs(u.Fragment,{children:[u.jsx(F5,{title:n("contextUsage.builtinTools"),items:s.builtinTools,getName:c=>"name"in c?c.name:c.path,tokenLabel:n("contextUsage.tokens")}),u.jsx(F5,{title:n("contextUsage.mcpTools"),items:s.mcpTools,getName:c=>"name"in c?c.name:c.path,tokenLabel:n("contextUsage.tokens")}),u.jsx(F5,{title:n("contextUsage.memoryFiles"),items:s.memoryFiles,getName:c=>"path"in c?c.path:c.name,tokenLabel:n("contextUsage.tokens")}),u.jsx(MAe,{skills:s.skills,labels:{active:n("contextUsage.active"),bodyLoaded:n("contextUsage.bodyLoaded"),skills:n("contextUsage.skills"),tokens:n("contextUsage.tokens")}})]}):u.jsx(EAe,{hint:n("contextUsage.detailHint"),onShowDetail:t})]})}const IAe={edit:"Edit",write_file:"WriteFile",read_file:"ReadFile",grep:"Grep",grep_search:"Grep",glob:"Glob",run_shell_command:"Shell",todo_write:"TodoList",save_memory:"SaveMemory",agent:"Agent",skill:"Skill",exit_plan_mode:"ExitPlanMode",web_fetch:"WebFetch",webfetch:"WebFetch",fetch:"WebFetch",list_directory:"ListFiles",lsp:"Lsp",ask_user_question:"AskUserQuestion",cron_create:"CronCreate",cron_list:"CronList",cron_delete:"CronDelete",loop_wakeup:"LoopWakeup",create_sub_session:"CreateSubSession",task_stop:"TaskStop",send_message:"SendMessage",structured_output:"StructuredOutput",monitor:"Monitor",notebook_edit:"NotebookEdit",tool_search:"ToolSearch",read_mcp_resource:"ReadMcpResource",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",team_plan_approval:"TeamPlanApproval",workflow:"Workflow",artifact:"Artifact",record_artifact:"RecordArtifact",web_search:"WebSearch",bash:"Shell",shell:"Shell Command",read:"ReadFile",write:"WriteFile",search:"Grep"},RAe=/[\x00-\x08\x0b-\x1f\x7f-\x9f]/g;function jAe(e){return e.replace(RAe,t=>{switch(t){case"\b":return"\\b";case"\f":return"\\f";case"\r":return"\\r";default:return`\\u${t.charCodeAt(0).toString(16).padStart(4,"0")}`}})}function fQ(e){if(!e.trim())return"Tool";const t=IAe[e];if(t)return t;const n=e.toLowerCase();return n==="web_fetch"||n==="webfetch"||n==="fetch"?"WebFetch":e}function Wc(e,t){const n=fQ(e),s=[`toolName.${e}`,`toolName.${e.toLowerCase()}`,`toolName.${n.toLowerCase()}`];for(const r of s){const i=t(r);if(i!==r)return i}return n}function Gc(e){const t=e.toLowerCase();return t==="ask_user_question"||t==="askuserquestion"}function Ti(e,t){return e.length<=t?e:e.slice(0,t)+"..."}const t0=2e3;function j9(e,t){if(d4(e.toolName)){const r=u4(e.args,"skill");if(r)return Ti(r,t0)}const n=OAe(e,t);if(n)return Ti(n,t0);const s=pQ(e,t);return s?Ti(s,t0):""}function mQ(e,t){if(!Ta(e.toolName))return j9(e,t);const n=u4(e.args,"description");if(n)return Ti(n,t0);const s=pQ(e,t,{includeTimeout:!1});return s?Ti(s,t0):""}function LAe(e){return Ta(e.toolName)?u4(e.args,"description"):""}function Ic(e){var t;if(!e.content)return q8(e.rawOutput);for(const n of e.content)if(n.type==="content"&&((t=n.content)!=null&&t.text))return n.content.text;return q8(e.rawOutput)}function DAe(e){if(e.status!=="completed"&&e.status!=="failed")return"";const t=e.toolName.toLowerCase();if(t==="grep_search"||t==="grep"||t==="search"){const o=KP((q8(e.rawOutput)??"").trim());if(o)return o}const n=Ic(e);if(!n)return"";const s=n.split(`
`),r=s.length;if(t==="read"||t==="read_file"||t==="readfile")return`${r} line(s)`;if(t==="glob")return`Found ${s.filter(a=>a.trim()).length} matching file(s)`;if(t==="list_directory"||t==="listfiles")return`${s.filter(a=>a.trim()).length} item(s)`;if(Ta(t)){if(r>3)return`${r} lines of output`;const o=s[0]||"";return Ti(o,80)}if(t==="grep_search"||t==="grep"||t==="search"){const o=KP(n.trim());return o||`${s.filter(l=>l.trim()).length} result(s)`}if(t==="edit"||t==="write"||t==="write_file"||t==="editfile")return"";if(t==="webfetch"||t==="web_fetch"||t==="fetch"){const o=s[0]||"";return Ti(o,80)}if(t==="websearch"||t==="web_search"){const o=s.filter(a=>a.trim()).length;return o>1?`${o} result(s)`:s[0]||""}if(Gc(t))return"";const i=s[0]||"";return Ti(i,80)}function OAe(e,t){if(!e.title)return null;const n=fQ(e.toolName),s=e.title.trim();if(s===e.toolName||s===n)return null;const r=[n,e.toolName];for(const i of r)if(s.startsWith(i)){const o=s.slice(i.length);if(/^(:\s*|\s+)/.test(o))return YP(o.replace(/^:\s*|\s+/,""),t)}return YP(s,t)}function KP(e){return e==="No matches found"||/^Found \d+ match(?:es)?(?: \(truncated\))?$/.test(e)?e:null}function pQ(e,t,n={}){const s=e.args||{},r=e.toolName.toLowerCase(),i=n.includeTimeout??!0;if(s.command){let o=String(s.command);s.directory&&r!=="shell"&&(o+=` [in ${Dp(String(s.directory),t)}]`),s.is_background?o+=" [background]":i&&s.timeout&&(o+=` [timeout: ${String(s.timeout)}ms]`);const a=u4(s,"description");return a&&(o+=` (${a})`),Ti(o,t0)}if(r==="grep_search"||r==="grep"||r==="search"){const o=s.pattern??s.query;if(o){let a=`'${String(o)}'`;return s.path?a+=` in path '${String(s.path)}'`:(r==="grep_search"||r==="grep")&&(a+=" in path './'"),s.glob&&(a+=` (filter: '${String(s.glob)}')`),a}}if(r==="glob"&&s.pattern){let o=`'${String(s.pattern)}'`;return s.path&&(o+=` in path '${String(s.path)}'`),o}if(s.file_path)return s.description?String(s.description):Dp(String(s.file_path),t);if(s.url){const o=String(s.url),a=typeof s.prompt=="string"?s.prompt:void 0,l=a?`${o} — "${Ti(a,40)}"`:o;return Ti(l,80)}if(s.path)return Dp(String(s.path),t);if(s.query)return Ti(String(s.query),60);if(r==="list_directory"||r==="listfiles"){const o=s.path||s.directory||"";return Dp(String(o),t)}return s.description?String(s.description):""}function u4(e,t){const n=e==null?void 0:e[t];return typeof n=="string"?n.trim().replace(/\n/g," "):""}function Ta(e){const t=e.toLowerCase();return t==="run_shell_command"||t==="bash"||t==="shell"||t==="execute_command"}function d4(e){return e.toLowerCase()==="skill"}function Pl(e,t){var n;return e.callId===t?!0:((n=e.subTools)==null?void 0:n.some(s=>Pl(s,t)))??!1}function YP(e,t){const n=e.trim();return gQ(F8(n))?Dp(n,t):n.replace(/(?:[A-Za-z]:)?\/[^\s'")]+/g,s=>Dp(s,t))}function Dp(e,t){const n=F8(e),s=t?F8(t).replace(/\/+$/,""):"";return s&&(n===s||n.startsWith(`${s}/`))?n.slice(s.length+1)||".":gQ(n)?PAe(n):n}function F8(e){return e.replace(/\\/g,"/")}function gQ(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function PAe(e){return e.replace(/\/+$/,"").split("/").pop()||e}function Lb(e){if(!e||typeof e!="object")return;const t=e;return t.type==="task_execution"?t:void 0}function L9(e){if(!e.rawOutput||typeof e.rawOutput!="object")return"";const t=e.rawOutput,n=typeof t.terminateReason=="string"?t.terminateReason:"";return typeof t.reason=="string"&&t.reason||n&&n!=="GOAL"&&n||typeof t.error=="string"&&t.error||""}function Xy(e){if(e.status==="failed")return"failed";if(!e.rawOutput||typeof e.rawOutput!="object")return e.status;const t=e.rawOutput,n=typeof t.status=="string"?t.status.toLowerCase():"",s=L9(e);return n==="cancelled"||n==="canceled"||s.toLowerCase().includes("cancel")?"failed":e.status}function D9(e){return e>=1e6?`${(e/1e6).toFixed(1)}M tokens`:e>=1e3?(e/1e3).toFixed(1).replace(/\.0$/,"")+"k tokens":`${e} tokens`}const BAe="general-purpose";function O9(e){var s;const t=Lb(e.rawOutput);if(t){const r=t.subagentName;if(typeof r=="string"&&r)return r}const n=(s=e.args)==null?void 0:s.subagent_type;return typeof n=="string"&&n?n:e.toolName==="task"?"task":BAe}function P9(e){var i,o;if(e.title){const a=e.title.indexOf(": ");if(a>0)return e.title.slice(a+2)}const t=(i=e.args)==null?void 0:i.description;if(typeof t=="string"&&t.trim())return t.trim();const n=Lb(e.rawOutput),s=n==null?void 0:n.taskDescription;if(typeof s=="string"&&s.trim())return s.trim();const r=(o=e.args)==null?void 0:o.prompt;return typeof r=="string"&&r.trim()?r.trim().split(`
`)[0]??"":""}function $Ae(e,t){var i,o;if(e.status!=="in_progress")return"";const n=e.subTools;if(!n||n.length===0)return"";const s=n[n.length-1];if(s.status!=="in_progress"&&s.status!=="pending")return"";let r=Wc(s.toolName??"",t);if(s.title){const a=s.title.indexOf(": ");r+=" "+(a>0?s.title.slice(a+2):s.title)}else(i=s.args)!=null&&i.command?r+=" "+String(s.args.command):(o=s.args)!=null&&o.file_path&&(r+=" "+String(s.args.file_path));return Ti(r,50)}function q8(e){if(!e)return null;if(typeof e=="string")return e;if(typeof e!="object")return null;const t=e;return typeof t.output=="string"?t.output:typeof t.stdout=="string"?t.stdout:typeof t.content=="string"?t.content:typeof t.reason=="string"?t.reason:typeof t.terminateReason=="string"?t.terminateReason:typeof t.error=="string"?t.error:typeof t.text=="string"?t.text:null}const zAe="_panel_qchwm_1",FAe="_title_qchwm_17",qAe="_sectionTitle_qchwm_23",HAe="_spacer_qchwm_29",UAe="_pivotRow_qchwm_35",VAe="_metricCell_qchwm_41",WAe="_metricCellSection_qchwm_48",GAe="_metricCellSub_qchwm_56",KAe="_modelCell_qchwm_64",YAe="_modelCellHeader_qchwm_71",XAe="_divider_qchwm_79",QAe="_kvRow_qchwm_87",JAe="_kvSubRow_qchwm_94",ZAe="_kvLabel_qchwm_102",e9e="_kvValue_qchwm_106",t9e="_tableRow_qchwm_115",n9e="_modelUsageRow_qchwm_121",s9e="_tableNameCol_qchwm_129",r9e="_tableToolCol_qchwm_137",i9e="_tableNumCol_qchwm_145",o9e="_tableValueCol_qchwm_153",a9e="_success_qchwm_162",l9e="_error_qchwm_166",c9e="_secondary_qchwm_170",u9e="_warning_qchwm_174",gt={panel:zAe,title:FAe,sectionTitle:qAe,spacer:HAe,pivotRow:UAe,metricCell:VAe,metricCellSection:WAe,metricCellSub:GAe,modelCell:KAe,modelCellHeader:YAe,divider:XAe,kvRow:QAe,kvSubRow:JAe,kvLabel:ZAe,kvValue:e9e,tableRow:t9e,modelUsageRow:n9e,tableNameCol:s9e,tableToolCol:r9e,tableNumCol:i9e,tableValueCol:o9e,success:a9e,error:l9e,secondary:c9e,warning:u9e},H8="web-shell:session-stats:v1:";function d9e(e,t="overview"){return`${H8}${JSON.stringify({_view:t,...e})}`}function h9e(e){if(!e.startsWith(H8))return null;try{const t=JSON.parse(e.slice(H8.length));if(!t||typeof t.durationMs!="number")return null;const n=t._view??"overview";return delete t._view,{view:n,status:t}}catch{return null}}function uh(e){if(e<=0)return"0s";if(e<1e3)return`${Math.round(e)}ms`;const t=e/1e3;if(t<60)return`${t.toFixed(1)}s`;const n=Math.floor(t/3600),s=Math.floor(t%3600/60),r=Math.floor(t%60),i=[];return n>0&&i.push(`${n}h`),s>0&&i.push(`${s}m`),r>0&&i.push(`${r}s`),i.join(" ")||"0s"}function Sf({label:e,children:t}){return u.jsxs("div",{className:gt.kvRow,children:[u.jsx("span",{className:gt.kvLabel,children:e}),u.jsx("span",{className:gt.kvValue,children:t})]})}function sy({label:e,children:t}){return u.jsxs("div",{className:gt.kvSubRow,children:[u.jsxs("span",{className:gt.secondary,children:["»"," ",e]}),u.jsx("span",{className:gt.kvValue,children:t})]})}function yQ(e){return Object.entries(e).filter(([,t])=>t.api.totalRequests>0).map(([t,n])=>{const s=t.split("::"),r=s[0],i=s[1],o=i?`${r} (${i})`:r;return{key:t,label:o,metrics:n}})}function f9e(e){return e.api.totalRequests===0?0:e.api.totalErrors/e.api.totalRequests*100}function m9e(e){return e.api.totalRequests===0?0:e.api.totalLatencyMs/e.api.totalRequests}function p9e(e){return e.tokens.prompt===0?0:e.tokens.cached/e.tokens.prompt*100}function tc({metric:e,values:t,variant:n="normal"}){const s=n==="section"?gt.metricCellSection:n==="sub"?gt.metricCellSub:gt.metricCell;return u.jsxs("div",{className:gt.pivotRow,children:[u.jsx("span",{className:s,children:n==="sub"?`↳ ${e}`:e}),t.map((r,i)=>u.jsx("span",{className:gt.modelCell,children:r},i))]})}function g9e({status:e}){const{t}=ot(),{models:n,tools:s,files:r}=e,i=Object.values(n).reduce((y,w)=>y+w.api.totalLatencyMs,0),o=s.totalDurationMs,a=i+o,l=a>0?i/a*100:0,c=a>0?o/a*100:0,d=s.totalCalls>0?s.totalSuccess/s.totalCalls*100:0,h=yQ(n),f=h.reduce((y,w)=>y+w.metrics.tokens.cached,0),p=h.reduce((y,w)=>y+w.metrics.tokens.prompt,0),g=p>0?f/p*100:0;return u.jsxs("div",{className:gt.panel,children:[u.jsx("div",{className:gt.title,children:t("stats.title")}),u.jsx("div",{className:gt.sectionTitle,children:t("stats.overview")}),u.jsx(Sf,{label:t("stats.duration"),children:uh(e.durationMs)}),u.jsx(Sf,{label:t("stats.prompts"),children:e.promptCount}),u.jsx(Sf,{label:t("stats.toolCalls"),children:u.jsxs("span",{children:[s.totalCalls," ",u.jsx("span",{className:gt.secondary,children:"("}),u.jsxs("span",{className:gt.success,children:["✓",s.totalSuccess]})," ",u.jsxs("span",{className:gt.error,children:["✗",s.totalFail]}),u.jsx("span",{className:gt.secondary,children:")"})]})}),u.jsx(Sf,{label:t("stats.successRate"),children:u.jsxs("span",{className:d>=90?gt.success:d>=70?gt.warning:gt.error,children:[d.toFixed(1),"%"]})}),(r.totalLinesAdded>0||r.totalLinesRemoved>0)&&u.jsx(Sf,{label:t("stats.codeChanges"),children:u.jsxs("span",{children:[u.jsxs("span",{className:gt.success,children:["+",r.totalLinesAdded]})," ",u.jsxs("span",{className:gt.error,children:["-",r.totalLinesRemoved]})]})}),u.jsx("div",{className:gt.spacer}),u.jsx("div",{className:gt.sectionTitle,children:t("stats.performance")}),u.jsxs(sy,{label:t("stats.apiTime"),children:[uh(i)," ",u.jsxs("span",{className:gt.secondary,children:["(",l.toFixed(1),"%)"]})]}),u.jsxs(sy,{label:t("stats.toolTime"),children:[uh(o)," ",u.jsxs("span",{className:gt.secondary,children:["(",c.toFixed(1),"%)"]})]}),h.length>0&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:gt.spacer}),u.jsx("div",{className:gt.sectionTitle,children:t("stats.modelUsage")}),u.jsx("div",{className:gt.spacer}),u.jsxs("div",{className:`${gt.tableRow} ${gt.modelUsageRow}`,children:[u.jsx("span",{className:gt.tableNameCol,children:t("stats.modelUsage")}),u.jsx("span",{className:gt.tableValueCol,children:t("stats.reqs")}),u.jsx("span",{className:gt.tableValueCol,children:t("stats.inputTokens")}),u.jsx("span",{className:gt.tableValueCol,children:t("stats.outputTokens")})]}),u.jsx("div",{className:gt.divider}),h.map(y=>u.jsxs("div",{className:`${gt.tableRow} ${gt.modelUsageRow}`,children:[u.jsx("span",{className:gt.tableNameCol,children:y.label}),u.jsx("span",{className:gt.tableValueCol,children:y.metrics.api.totalRequests}),u.jsx("span",{className:`${gt.tableValueCol} ${gt.warning}`,children:y.metrics.tokens.prompt.toLocaleString()}),u.jsx("span",{className:`${gt.tableValueCol} ${gt.warning}`,children:y.metrics.tokens.candidates.toLocaleString()})]},y.key)),g>0&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:gt.spacer}),u.jsxs("div",{children:[u.jsx("span",{className:gt.success,children:t("stats.savingsHighlight")})," ",f.toLocaleString()," (",g.toFixed(1),"%)"," ",t("stats.cacheDesc")]}),u.jsxs("div",{className:gt.secondary,children:["»"," ",t("stats.modelTip")]})]})]})]})}function y9e({status:e}){const{t}=ot(),n=yQ(e.models);if(n.length===0)return u.jsxs("div",{className:gt.panel,children:[u.jsx("div",{className:gt.title,children:t("stats.modelStats")}),u.jsx("div",{children:t("stats.noApiCalls")})]});const s=n.some(o=>o.metrics.tokens.cached>0),r=n.some(o=>o.metrics.tokens.thoughts>0),i=o=>n.map(a=>o(a.metrics));return u.jsxs("div",{className:gt.panel,children:[u.jsx("div",{className:gt.title,children:t("stats.modelStats")}),u.jsx("div",{className:gt.spacer}),u.jsxs("div",{className:gt.pivotRow,children:[u.jsx("span",{className:gt.metricCellSection,children:t("stats.metric")}),n.map(o=>u.jsx("span",{className:gt.modelCellHeader,children:o.label},o.key))]}),u.jsx("div",{className:gt.divider}),u.jsx(tc,{metric:t("stats.api"),values:[],variant:"section"}),u.jsx(tc,{metric:t("stats.requests"),values:i(o=>o.api.totalRequests.toLocaleString())}),u.jsx(tc,{metric:t("stats.errors"),values:i(o=>{const a=f9e(o);return u.jsxs("span",{className:o.api.totalErrors>0?gt.error:void 0,children:[o.api.totalErrors.toLocaleString()," (",a.toFixed(1),"%)"]})})}),u.jsx(tc,{metric:t("stats.avgLatency"),values:i(o=>uh(m9e(o)))}),u.jsx("div",{className:gt.spacer}),u.jsx(tc,{metric:t("stats.tokens"),values:[],variant:"section"}),u.jsx(tc,{metric:t("stats.total"),values:i(o=>u.jsx("span",{className:gt.warning,children:o.tokens.total.toLocaleString()}))}),u.jsx(tc,{metric:t("stats.inputTokens"),values:i(o=>o.tokens.prompt.toLocaleString()),variant:"sub"}),s&&u.jsx(tc,{metric:t("stats.cached"),values:i(o=>u.jsxs("span",{className:gt.success,children:[o.tokens.cached.toLocaleString()," (",p9e(o).toFixed(1),"%)"]})),variant:"sub"}),u.jsx(tc,{metric:t("stats.outputTokens"),values:i(o=>o.tokens.candidates.toLocaleString()),variant:"sub"}),r&&u.jsx(tc,{metric:t("stats.thoughts"),values:i(o=>o.tokens.thoughts.toLocaleString()),variant:"sub"})]})}function b9e(e){return Object.entries(e).filter(([,t])=>t.count>0).sort((t,n)=>n[1].count-t[1].count).map(([t,n])=>({name:t,stats:n}))}function v9e({status:e}){const{t}=ot(),n=b9e(e.tools.byName);if(n.length===0)return u.jsxs("div",{className:gt.panel,children:[u.jsx("div",{className:gt.title,children:t("stats.toolStats")}),u.jsx("div",{children:t("stats.noToolCalls")})]});const s=Object.values(e.tools.byName).reduce((o,a)=>{var l,c,d;return o.accept+=((l=a.decisions)==null?void 0:l.accept)??0,o.reject+=((c=a.decisions)==null?void 0:c.reject)??0,o.modify+=((d=a.decisions)==null?void 0:d.modify)??0,o},{accept:0,reject:0,modify:0}),r=s.accept+s.reject+s.modify,i=r>0?s.accept/r*100:0;return u.jsxs("div",{className:gt.panel,children:[u.jsx("div",{className:gt.title,children:t("stats.toolStats")}),u.jsx("div",{className:gt.spacer}),u.jsxs("div",{className:gt.tableRow,children:[u.jsx("span",{className:gt.tableToolCol,children:t("stats.toolName")}),u.jsx("span",{className:gt.tableNumCol,children:t("stats.calls")}),u.jsx("span",{className:gt.tableNumCol,children:t("stats.successRate")}),u.jsx("span",{className:gt.tableNumCol,children:t("stats.avgDuration")})]}),u.jsx("div",{className:gt.divider}),n.map(o=>{const a=o.stats.count>0?o.stats.success/o.stats.count*100:0,l=o.stats.count>0?o.stats.durationMs/o.stats.count:0;return u.jsxs("div",{className:gt.tableRow,children:[u.jsx("span",{className:`${gt.tableToolCol} ${gt.metricCell}`,children:Wc(o.name,t)}),u.jsx("span",{className:gt.tableNumCol,children:o.stats.count}),u.jsxs("span",{className:`${gt.tableNumCol} ${a>=90?gt.success:a>=70?gt.warning:gt.error}`,children:[a.toFixed(1),"%"]}),u.jsx("span",{className:gt.tableNumCol,children:uh(l)})]},o.name)}),u.jsx("div",{className:gt.spacer}),u.jsx("div",{className:gt.sectionTitle,children:t("stats.decisionSummary")}),u.jsx(Sf,{label:t("stats.totalReviewed"),children:r}),u.jsx(sy,{label:t("stats.accepted"),children:u.jsx("span",{className:gt.success,children:s.accept})}),u.jsx(sy,{label:t("stats.rejected"),children:u.jsx("span",{className:gt.error,children:s.reject})}),u.jsx(sy,{label:t("stats.modified"),children:u.jsx("span",{className:gt.warning,children:s.modify})}),u.jsx("div",{className:gt.divider}),u.jsx(Sf,{label:t("stats.agreementRate"),children:u.jsx("span",{className:r>0?i>=90?gt.success:i>=70?gt.warning:gt.error:void 0,children:r>0?`${i.toFixed(1)}%`:"--"})})]})}function w9e({view:e,status:t}){switch(e){case"model":return u.jsx(y9e,{status:t});case"tools":return u.jsx(v9e,{status:t});default:return u.jsx(g9e,{status:t})}}function h4(e){return{serialize(t){return`${e}${JSON.stringify(t)}`},parse(t){if(!t.startsWith(e))return null;try{const n=JSON.parse(t.slice(e.length));return!n||typeof n!="object"?null:n}catch{return null}}}}const x9e="_panel_13hcg_1",k9e="_title_13hcg_17",_9e="_row_13hcg_23",S9e="_rowGap_13hcg_31",C9e="_label_13hcg_35",T9e="_value_13hcg_41",E9e="_accent_13hcg_46",jf={panel:x9e,title:k9e,row:_9e,rowGap:S9e,label:C9e,value:T9e,accent:E9e},{serialize:A9e,parse:M9e}=h4("web-shell:status:v1:");function Al({label:e,children:t,gap:n}){return u.jsxs("div",{className:`${jf.row}${n?` ${jf.rowGap}`:""}`,children:[u.jsx("span",{className:jf.label,children:e}),u.jsx("span",{className:jf.value,children:t})]})}function N9e({info:e}){const{t}=ot();return u.jsxs("div",{className:jf.panel,children:[u.jsx("div",{className:jf.title,children:t("about.title")}),e.cliVersion&&u.jsx(Al,{label:t("about.qwenCode"),children:u.jsx("span",{className:jf.accent,children:e.cliVersion})}),e.runtime&&u.jsx(Al,{label:t("about.runtime"),children:e.runtime}),e.platform&&u.jsx(Al,{label:t("about.platform"),children:e.platform}),e.auth&&u.jsx(Al,{label:t("about.auth"),gap:!0,children:e.auth}),e.baseUrl&&u.jsx(Al,{label:t("about.baseUrl"),children:e.baseUrl}),e.model&&u.jsx(Al,{label:t("about.model"),children:e.model}),e.fastModel&&e.fastModel!==e.model&&u.jsx(Al,{label:t("about.fastModel"),children:e.fastModel}),e.sessionId&&u.jsx(Al,{label:t("about.sessionId"),children:e.sessionId}),u.jsx(Al,{label:t("about.sandbox"),children:e.sandbox||t("about.noSandbox")}),u.jsx(Al,{label:t("about.proxy"),children:e.proxy||t("about.noProxy")}),e.memoryUsage&&u.jsx(Al,{label:t("about.memoryUsage"),children:e.memoryUsage})]})}function I9e(e){return e instanceof HTMLElement?!!e.closest("[data-keyboard-scope]"):!1}function bQ(e,t,n=50){const s=m.useRef(e);m.useEffect(()=>{s.current=e},[e]),m.useEffect(()=>{const r=o=>{o.defaultPrevented||Yy(o.target)&&!I9e(o.target)||s.current(o)},i=setTimeout(()=>{window.addEventListener("keydown",r)},n);return()=>{clearTimeout(i),window.removeEventListener("keydown",r)}},t)}const R9e="_panel_1jx2a_1",j9e="_title_1jx2a_13",L9e="_header_1jx2a_18",D9e="_startup_1jx2a_24",O9e="_note_1jx2a_28",P9e="_secondary_1jx2a_29",B9e="_row_1jx2a_39",$9e="_selected_1jx2a_48",z9e="_disabled_1jx2a_52",F9e="_pointer_1jx2a_56",q9e="_nameCell_1jx2a_62",H9e="_truncate_1jx2a_69",U9e="_separator_1jx2a_75",V9e="_sectionTitle_1jx2a_79",W9e="_groupTitle_1jx2a_80",G9e="_success_1jx2a_84",K9e="_warning_1jx2a_88",Y9e="_error_1jx2a_92",X9e="_group_1jx2a_80",Q9e="_list_1jx2a_102",J9e="_description_1jx2a_108",Z9e="_schema_1jx2a_113",eMe="_shortcuts_1jx2a_131",tMe="_detail_1jx2a_137",nMe="_serverFields_1jx2a_143",sMe="_serverField_1jx2a_143",rMe="_serverFieldLabel_1jx2a_156",iMe="_detailBlock_1jx2a_160",oMe="_parameters_1jx2a_161",aMe="_invalidBlock_1jx2a_162",lMe="_parameterRow_1jx2a_172",cMe="_actionMessage_1jx2a_177",uMe="_oauthPage_1jx2a_183",dMe="_scrollHint_1jx2a_189",qt={panel:R9e,title:j9e,header:L9e,startup:D9e,note:O9e,secondary:P9e,row:B9e,selected:$9e,disabled:z9e,pointer:F9e,nameCell:q9e,truncate:H9e,separator:U9e,sectionTitle:V9e,groupTitle:W9e,success:G9e,warning:K9e,error:Y9e,group:X9e,list:Q9e,description:J9e,schema:Z9e,shortcuts:eMe,detail:tMe,serverFields:nMe,serverField:sMe,serverFieldLabel:rMe,detailBlock:iMe,parameters:oMe,invalidBlock:aMe,parameterRow:lMe,actionMessage:cMe,oauthPage:uMe,scrollHint:dMe},U8="web-shell:mcp-panel-active",lf=10,{parse:hMe}=h4("web-shell:mcp-status:v1:");function fMe(e){const t=hMe(e);return!t||!t.status?null:t}function Cw(e,t){if(e.disabled)return{icon:"✗",text:t("mcp.status.disabled"),className:qt.error};switch(e.mcpStatus){case"connected":return{icon:"✓",text:t("mcp.status.connected"),className:qt.success};case"connecting":return{icon:"🔄",text:t("mcp.status.starting"),className:qt.warning};case"disconnected":default:return{icon:"🔴",text:t("mcp.status.disconnectedTitle"),className:qt.error}}}function vQ(e){const t=e.schema,n=(t==null?void 0:t.parametersJsonSchema)??(t==null?void 0:t.parameters)??t;return n&&typeof n=="object"?n:null}function mMe(e){const t=vQ(e);return t?JSON.stringify(t,null,2):""}function pMe(e,t){return e.extensionName?t("mcp.extensionMcp"):t("mcp.userMcp")}function gMe(e,t){return e.source==="project"?t("mcp.source.project"):e.source==="extension"||e.extensionName?t("mcp.source.extension"):t("mcp.source.user")}function yMe(e,t){var s;const n=e.config;if(n!=null&&n.httpUrl)return`${n.httpUrl} (http)`;if(n!=null&&n.url)return`${n.url} (sse)`;if(n!=null&&n.command){const r=((s=n.args)==null?void 0:s.join(" "))??"";return`${n.command} ${r} (stdio)`.trim()}return e.transport?`(${e.transport})`:t("mcp.status.unknown")}function q5(e,t){const n=e.annotations??{},s=[];return n.destructiveHint&&s.push(t("mcp.annotation.destructive")),n.readOnlyHint&&s.push(t("mcp.annotation.readOnly")),n.openWorldHint&&s.push(t("mcp.annotation.openWorld")),n.idempotentHint&&s.push(t("mcp.annotation.idempotent")),s.join(", ")}function XP(e,t){window.dispatchEvent(new CustomEvent(U8,{detail:{id:e,active:t}}))}function QP(e){if(e&&typeof e=="object"){const t=e.body;if(t&&typeof t=="object"){const n=t.data;if(n&&typeof n=="object"){const r=n.details;if(typeof r=="string"&&r)return r}const s=t.error;if(typeof s=="string"&&s)return s}if(e instanceof Error&&e.message)return e.message}return String(e)}function Tw(e,t,n){return[`${t("mcp.oauth.server")}: ${e}`,"",t("mcp.oauth.starting",{name:e}),...n?["",n]:[]].join(`
`)}function bMe(e,t){return e?t("mcp.required"):""}function vMe(e,t){const n=vQ(e),s=n==null?void 0:n.properties,r=Array.isArray(n==null?void 0:n.required)?new Set(n.required.filter(o=>typeof o=="string")):new Set;if(!s||typeof s!="object"){const o=mMe(e);return o?u.jsx("pre",{className:qt.schema,children:o}):null}const i=Object.entries(s);return i.length===0?null:u.jsxs("div",{className:qt.parameters,children:[u.jsx("div",{className:qt.sectionTitle,children:t("mcp.parameters")}),i.map(([o,a])=>{const l=a&&typeof a=="object"?a:{},c=typeof l.type=="string"?l.type:"any",d=typeof l.description=="string"?l.description:"";return u.jsx("div",{className:qt.parameterRow,children:`• ${o}${bMe(r.has(o),t)}: ${c}${d?` - ${d}`:""}`},o)})]})}function wMe({message:e}){var G;const{t}=ot(),n=gU({autoLoad:!1}),[s,r]=m.useState(e.status),[i,o]=m.useState(e.toolsByServer),[a,l]=m.useState(null),[c,d]=m.useState(!1),h=m.useRef(`mcp-${Math.random().toString(36).slice(2)}`),[f,p]=m.useState(!0),[g,y]=m.useState("servers"),[w,v]=m.useState(0),[b,x]=m.useState(0),[k,T]=m.useState(0),C=m.useMemo(()=>s.servers??[],[s.servers]),S=C[w]??null,_=m.useMemo(()=>{var q;return S?((q=i[S.name])==null?void 0:q.tools)??[]:[]},[S,i]),L=_[k]??null,M=m.useMemo(()=>_.length<=lf||k<lf-1?0:Math.min(k-lf+1,_.length-lf),[k,_.length]),I=m.useMemo(()=>_.slice(M,M+lf),[_,M]),A=C.filter(q=>!q.disabled&&q.mcpStatus==="connecting").length,P=m.useMemo(()=>{const q=[];for(const N of C){const ee=pMe(N,t),re=q.find(Q=>Q.label===ee);re?re.servers.push(N):q.push({label:ee,servers:[N]})}return q},[C,t]),B=m.useMemo(()=>C.length===0?20:Math.min(Math.max(...C.map(q=>q.name.length))+2,35),[C]),F=m.useMemo(()=>_.length===0?30:Math.min(Math.max(..._.map(q=>q.name.length))+2,50),[_]),O=m.useMemo(()=>{if(!S)return[];const q=[];return!S.disabled&&_.length>0&&q.push({id:"view-tools",label:t("mcp.action.tools")}),!S.disabled&&S.mcpStatus==="disconnected"&&q.push({id:"reconnect",label:t("mcp.action.reconnect")}),q.push({id:S.disabled?"enable":"disable",label:S.disabled?t("mcp.action.enable"):t("mcp.action.disable")}),S.disabled||(q.push({id:"authenticate",label:S.hasOAuthTokens?t("mcp.action.reauth"):t("mcp.action.auth")}),S.hasOAuthTokens&&q.push({id:"clear-auth",label:t("mcp.action.clearAuth")})),q},[S,_.length,t]),X=m.useCallback(async()=>{var N;const q=await n.reload();if(q){r(q);const ee=((N=q.servers)==null?void 0:N.find(re=>re.name===(S==null?void 0:S.name)))??null;if(ee){const re=await n.loadTools(ee.name);o(Q=>({...Q,[ee.name]:re}))}}},[n,S==null?void 0:S.name]),z=m.useCallback(async q=>{if(!(!S||q.disabled||c)){if(q.id==="view-tools"){y("tools"),T(0),l(null);return}d(!0),q.id==="authenticate"&&y("oauth"),l(q.id==="authenticate"?Tw(S.name,t):t("mcp.action.running",{action:q.label}));try{let N=null;if(q.id==="reconnect")await n.restartServer(S.name);else{const ee=await n.manageServer(S.name,q.id),re=[...ee.messages??[],...ee.authUrl?[ee.authUrl]:[]].join(`
`);re&&(N=q.id==="authenticate"?Tw(S.name,t,re):re)}await X(),l(N??t("mcp.action.done",{action:q.label}))}catch(N){l(q.id==="authenticate"?Tw(S.name,t,QP(N)):t("mcp.action.failed",{error:QP(N)}))}finally{d(!1)}}},[c,n,X,S,t]);if(m.useEffect(()=>{const q=h.current;return XP(q,f),()=>XP(q,!1)},[f]),m.useEffect(()=>{const q=N=>{const ee=N.detail;ee!=null&&ee.active&&ee.id&&ee.id!==h.current&&p(!1)};return window.addEventListener(U8,q),()=>window.removeEventListener(U8,q)},[]),bQ(q=>{if(f){if(q.key==="Escape"){q.preventDefault(),q.stopPropagation(),g==="servers"?p(!1):g==="server"?(y("servers"),x(0),l(null)):g==="oauth"?(y("server"),l(null)):g==="tools"?(y("server"),T(0)):y("tools");return}if(q.key==="ArrowUp"||q.key==="ArrowDown"){q.preventDefault(),q.stopPropagation();const N=q.key==="ArrowUp"?-1:1;g==="servers"?(v(ee=>Math.min(Math.max(ee+N,0),C.length-1)),x(0)):g==="server"?x(ee=>Math.min(Math.max(ee+N,0),O.length-1)):g==="tools"&&T(ee=>Math.min(Math.max(ee+N,0),_.length-1));return}if(q.key==="Enter")if(q.preventDefault(),q.stopPropagation(),g==="servers"&&C.length>0)y("server"),x(0);else if(g==="server"&&O.length>0){const N=O[b];N&&z(N)}else g==="tools"&&_.length>0&&y("tool")}},[f,b,_.length,O,z,C.length,g]),!f)return null;if(C.length===0)return u.jsxs("div",{className:qt.panel,"data-keyboard-scope":!0,children:[u.jsxs("div",{className:qt.header,children:[u.jsx("div",{className:qt.title,children:t("mcp.manageServers")}),u.jsx("div",{className:qt.secondary,children:t("mcp.servers",{count:0})})]}),u.jsx("div",{className:qt.secondary,children:t("mcp.empty")}),u.jsx("div",{className:qt.shortcuts,children:t("mcp.shortcut.close")})]});const U=g==="servers"?t("mcp.manageServers"):g==="server"?(S==null?void 0:S.name)??t("mcp.manageServers"):g==="oauth"?t("mcp.oauth.title"):g==="tools"?t("mcp.toolsForServer",{name:(S==null?void 0:S.name)??t("common.server")}):(L==null?void 0:L.name)??t("mcp.toolDetail"),D=g==="servers"?t("mcp.servers",{count:C.length}):g==="server"||g==="oauth"?"":g==="tools"?t(_.length===1?"mcp.toolCount":"mcp.toolsCount",{count:_.length}):(L==null?void 0:L.serverToolName)??(S==null?void 0:S.name)??"";return u.jsxs("div",{className:qt.panel,"data-keyboard-scope":!0,children:[A>0&&u.jsxs("div",{children:[u.jsx("div",{className:qt.startup,children:t("mcp.starting",{count:A})}),u.jsx("div",{className:qt.note,children:t("mcp.startingNote")})]}),u.jsxs("div",{className:qt.header,children:[u.jsx("div",{className:qt.title,children:U}),D&&u.jsx("div",{className:qt.secondary,children:D})]}),g==="servers"&&u.jsx("div",{className:qt.list,children:P.map(q=>{let N=0;for(const ee of P){if(ee===q)break;N+=ee.servers.length}return u.jsxs("div",{className:qt.group,children:[u.jsx("div",{className:qt.groupTitle,children:q.label}),q.servers.map((ee,re)=>{const Q=N+re,K=Q===w,se=Cw(ee,t);return u.jsxs("div",{className:K?`${qt.row} ${qt.selected}`:qt.row,onClick:()=>{v(Q),y("server"),x(0)},onMouseEnter:()=>v(Q),children:[u.jsx("span",{className:qt.pointer,children:K?"❯":""}),u.jsx("span",{className:qt.nameCell,style:{width:`${B}ch`},children:ee.name}),u.jsx("span",{className:qt.separator,children:"·"}),u.jsxs("span",{className:se.className,children:[se.icon," ",se.text]})]},ee.name)})]},q.label)})}),g==="server"&&S&&u.jsxs("div",{className:qt.detail,children:[u.jsxs("div",{className:qt.serverFields,children:[u.jsxs("div",{className:qt.serverField,children:[u.jsxs("span",{className:qt.serverFieldLabel,children:[t("mcp.status"),":"]}),u.jsxs("span",{className:Cw(S,t).className,children:[Cw(S,t).icon," ",Cw(S,t).text]})]}),u.jsxs("div",{className:qt.serverField,children:[u.jsxs("span",{className:qt.serverFieldLabel,children:[t("mcp.source"),":"]}),u.jsx("span",{children:gMe(S,t)})]}),u.jsxs("div",{className:qt.serverField,children:[u.jsxs("span",{className:qt.serverFieldLabel,children:[t("mcp.command"),":"]}),u.jsx("span",{className:qt.truncate,children:yMe(S,t)})]}),((G=S.config)==null?void 0:G.cwd)&&u.jsxs("div",{className:qt.serverField,children:[u.jsxs("span",{className:qt.serverFieldLabel,children:[t("mcp.workingDirectory"),":"]}),u.jsx("span",{className:qt.truncate,children:S.config.cwd})]}),!S.disabled&&u.jsxs("div",{className:qt.serverField,children:[u.jsxs("span",{className:qt.serverFieldLabel,children:[t("mcp.tools"),":"]}),u.jsx("span",{children:t(_.length===1?"mcp.toolCount":"mcp.toolsCount",{count:_.length})})]})]}),u.jsx("div",{className:qt.list,children:O.map((q,N)=>{const ee=N===b,re=[qt.row,ee?qt.selected:"",q.disabled?qt.disabled:""].filter(Boolean).join(" ");return u.jsxs("div",{className:re,onClick:()=>{x(N),z(q)},children:[u.jsx("span",{className:qt.pointer,children:ee?"❯":""}),u.jsx("span",{children:q.label})]},q.id)})}),a&&u.jsx("pre",{className:qt.actionMessage,children:a})]}),g==="oauth"&&u.jsx("div",{className:qt.oauthPage,children:u.jsx("pre",{className:qt.actionMessage,children:a??(S?Tw(S.name,t):t("mcp.status.unknown"))})}),g==="tools"&&u.jsx("div",{className:qt.list,children:_.length===0?u.jsx("div",{className:qt.secondary,children:t("mcp.emptyTools")}):I.map((q,N)=>{const ee=M+N,re=ee===k,Q=q5(q,t);return u.jsxs("div",{className:re?`${qt.row} ${qt.selected}`:qt.row,onClick:()=>{T(ee),y("tool")},onMouseEnter:()=>T(ee),children:[u.jsx("span",{className:qt.pointer,children:re?"❯":""}),u.jsx("span",{className:qt.nameCell,style:{width:`${F}ch`},children:q.name}),q.isValid?Q?u.jsx("span",{className:qt.secondary,children:Q}):null:u.jsx("span",{className:qt.warning,children:t("mcp.invalidReason",{reason:q.invalidReason||t("mcp.status.unknown")})})]},q.name)})}),g==="tools"&&_.length>lf&&u.jsxs("div",{className:qt.scrollHint,children:[M>0?"↑ ":"  ",t("mcp.scrollPosition",{current:k+1,total:_.length}),M+lf<_.length?" ↓":""]}),g==="tool"&&L&&u.jsxs("div",{className:qt.detail,children:[!L.isValid&&u.jsxs("div",{className:qt.invalidBlock,children:[u.jsx("div",{className:qt.sectionTitle,children:t("mcp.invalidToolWarning")}),u.jsxs("div",{children:[t("mcp.invalidReasonLabel")," ",L.invalidReason||t("mcp.status.unknown")]}),u.jsx("div",{className:qt.secondary,children:t("mcp.invalidToolHelp")})]}),L.description&&u.jsxs("div",{className:qt.detailBlock,children:[u.jsx("div",{className:qt.sectionTitle,children:t("mcp.description")}),u.jsx("div",{className:qt.description,children:L.description.trim()})]}),q5(L,t)&&u.jsxs("div",{className:qt.detailBlock,children:[u.jsx("span",{className:qt.sectionTitle,children:t("mcp.annotations")})," ",u.jsx("span",{children:q5(L,t)})]}),vMe(L,t)]}),u.jsx("div",{className:qt.shortcuts,children:t(g==="servers"?"mcp.shortcut.selectClose":g==="server"||g==="tools"?"mcp.shortcut.selectBack":"mcp.shortcut.back")})]})}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const xMe=3;function S2(e){return e.kind==="agent"&&typeof e.id=="string"}function kMe(e){const t=e.filter(S2),n=new Map;for(const c of t)n.set(c.id,c);const s=new Map,r=[];for(const c of t){const d=c.parentAgentId;if(d!=null&&d!==c.id&&n.has(d)){const h=s.get(d);h?h.push(c):s.set(d,[c])}else r.push(c)}if(s.size===0)return[...e];const i=[],o=new Set,a=c=>{if(!o.has(c.id)){o.add(c.id),i.push(c);for(const d of s.get(c.id)??[])a(d)}};for(const c of r)a(c);for(const c of t)o.has(c.id)||(o.add(c.id),i.push(c));let l=0;return e.map(c=>S2(c)?i[l++]:c)}function wQ(e,t){const n=[],s=new Set(e.id!=null?[e.id]:[]);let r=e.parentAgentId;for(;;){if(r==null)return{chain:n,terminatedBy:"root"};if(s.has(r))return{chain:n,terminatedBy:"cycle"};const i=t(r);if(!i)return{chain:n,terminatedBy:"missing"};s.add(r),n.push(i),r=i.parentAgentId}}function _Me(e){const t=new Map;for(const s of e)S2(s)&&t.set(s.id,s);const n=new Map;for(const s of t.values()){const{chain:r,terminatedBy:i}=wQ(s,o=>t.get(o));n.set(s.id,{visibleDepth:i==="cycle"?0:r.length,orphaned:r.length===0&&i==="missing"})}return n}function SMe(e){const t=new Map;for(const s of e)S2(s)&&t.set(s.id,s);const n=new Set;for(const s of t.values()){if(s.isBackgrounded!==!1)continue;const{chain:r,terminatedBy:i}=wQ(s,o=>t.get(o));i==="root"&&r.every(o=>o.isBackgrounded===!1)&&n.add(s.id)}return n}function V8(e){const t=Math.max(0,Math.floor(e/1e3)),n=t%60,s=Math.floor(t/60);if(s===0)return`${n}s`;const r=s%60,i=Math.floor(s/60);return i===0?`${r}m ${n}s`:`${i}h ${r}m`}const CMe="_panel_1c0ra_1",TMe="_embeddedPanel_1c0ra_12",EMe="_title_1c0ra_19",AMe="_sectionTitle_1c0ra_24",MMe="_overflowHint_1c0ra_28",NMe="_header_1c0ra_33",IMe="_secondary_1c0ra_39",RMe="_row_1c0ra_43",jMe="_selected_1c0ra_51",LMe="_pointer_1c0ra_55",DMe="_nameCell_1c0ra_61",OMe="_treeMarker_1c0ra_70",PMe="_orphanNote_1c0ra_74",BMe="_status_1c0ra_78",$Me="_chevronCell_1c0ra_84",zMe="_chevron_1c0ra_84",FMe="_chevronExpanded_1c0ra_101",qMe="_separator_1c0ra_111",HMe="_list_1c0ra_115",UMe="_task_1c0ra_121",VMe="_taskExpanded_1c0ra_127",WMe="_success_1c0ra_132",GMe="_warning_1c0ra_136",KMe="_error_1c0ra_140",YMe="_detail_1c0ra_144",XMe="_detailTop_1c0ra_153",QMe="_detailTopMain_1c0ra_160",JMe="_inlineDetail_1c0ra_200",ZMe="_taskIcon_1c0ra_222",eNe="_detailField_1c0ra_251",tNe="_detailFieldLabel_1c0ra_258",nNe="_detailContent_1c0ra_264",sNe="_compactSummary_1c0ra_271",rNe="_actionBar_1c0ra_280",iNe="_actionHint_1c0ra_289",oNe="_actionButton_1c0ra_294",aNe="_dangerButton_1c0ra_314",lNe="_shortcuts_1c0ra_318",cNe="_confirmHint_1c0ra_324",uNe="_statusBadge_1c0ra_328",dNe="_activityCurrent_1c0ra_334",hNe="_activityPast_1c0ra_341",fNe="_promptContent_1c0ra_348",St={panel:CMe,embeddedPanel:TMe,title:EMe,sectionTitle:AMe,overflowHint:MMe,header:NMe,secondary:IMe,row:RMe,selected:jMe,pointer:LMe,nameCell:DMe,treeMarker:OMe,orphanNote:PMe,status:BMe,chevronCell:$Me,chevron:zMe,chevronExpanded:FMe,separator:qMe,list:HMe,task:UMe,taskExpanded:VMe,success:WMe,warning:GMe,error:KMe,detail:YMe,detailTop:XMe,detailTopMain:QMe,inlineDetail:JMe,taskIcon:ZMe,detailField:eNe,detailFieldLabel:tNe,detailContent:nNe,compactSummary:sNe,actionBar:rNe,actionHint:iNe,actionButton:oNe,dangerButton:aNe,shortcuts:lNe,confirmHint:cNe,statusBadge:uNe,activityCurrent:dNe,activityPast:hNe,promptContent:fNe},Qy="web-shell:tasks-panel-active",mNe=3e3,JP=8,{parse:pNe}=h4("web-shell:tasks-status:v1:");function gNe(e){const t=pNe(e);return!t||!t.snapshot?null:t}function ZP(e,t){window.dispatchEvent(new CustomEvent(Qy,{detail:{id:e,active:t}}))}function eB(e){return e.status==="running"||e.status==="paused"}function yNe(e){return[...e].sort((t,n)=>{const s=eB(t),r=eB(n);return s!==r?s?-1:1:s?n.startTime-t.startTime:(n.endTime??n.startTime)-(t.endTime??t.startTime)})}function H5(e){return kMe(yNe(e))}function tB(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function xQ(e){switch(e){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 bNe(e,t){switch(e){case"running":return t("tasks.running");case"completed":return t("tasks.completed");case"failed":return t("tasks.failed");case"cancelled":return t("tasks.cancelled");case"paused":return t("tasks.paused");default:return e}}function vNe(e){switch(e){case"paused":return"⏸";case"completed":return"✓";case"failed":case"cancelled":return"✗";case"running":return null;default:return null}}function wNe({expanded:e}){return u.jsx("svg",{className:`${St.chevron} ${e?St.chevronExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})}function xNe(e,t){switch(e.kind){case"agent":return t?`[blocking] ${e.label}`:e.label;case"shell":return`[shell] ${e.command}`;case"monitor":return`[monitor] ${e.description}`}}function kNe(e,t){if(e.length<=JP)return{visible:e,windowStart:0,hiddenAbove:0,hiddenBelow:0};const n=Math.max(1,JP-2),s=Math.max(0,Math.min(t-Math.floor(n/2),e.length-n)),r=Math.min(e.length,s+n);return{visible:e.slice(s,r),windowStart:s,hiddenAbove:s,hiddenBelow:e.length-r}}function _Ne(e,t,n){const s=Wc(e,n),r=t?t.replace(/\s*\n\s*/g," ").trim():"",i=r?`${s}(${r})`:s;return jAe(i)}function kQ({message:e,embedded:t=!1,manageActiveEvent:n=!0,onClose:s}){const{t:r}=ot(),i=H0(),[o,a]=m.useState(()=>H5(e.snapshot.tasks)),[l,c]=m.useState(!0),[d,h]=m.useState("list"),[f,p]=m.useState(0),[g,y]=m.useState(null),[w,v]=m.useState(!1),[b,x]=m.useState(!1),[k,T]=m.useState(null),C=m.useRef(`tasks-${Math.random().toString(36).slice(2)}`),S=m.useRef(!1),_=m.useRef(null),L=o.length===0?0:Math.min(f,o.length-1),M=o[L]??null,I=m.useMemo(()=>_Me(o),[o]),A=m.useMemo(()=>SMe(o),[o]);m.useEffect(()=>{if(!l)return;const ee=setInterval(()=>{S.current||(S.current=!0,i.getTasks().then(re=>{a(H5(re.tasks)),x(!1)}).catch(re=>{console.warn("[web-shell] failed to refresh tasks:",re),x(!0)}).finally(()=>{S.current=!1}))},mNe);return()=>clearInterval(ee)},[l,i]),m.useEffect(()=>{o.length===0&&f!==0&&p(0),f>=o.length&&o.length>0&&p(o.length-1)},[o.length,f]),m.useEffect(()=>{if(!l||d!=="detail"){_.current=null;return}if(!M){_.current=null,h("list");return}const N=_.current;if(!N||N.taskId!==M.id){_.current={taskId:M.id,status:M.status};return}N.status==="running"&&M.status!=="running"&&(y(null),h("list"))},[l,d,M]),m.useEffect(()=>{if(!n)return;const N=C.current;return ZP(N,l),()=>ZP(N,!1)},[l,n]),m.useEffect(()=>{if(!n)return;const N=ee=>{const re=ee.detail;re!=null&&re.active&&re.id&&re.id!==C.current&&c(!1)};return window.addEventListener(Qy,N),()=>window.removeEventListener(Qy,N)},[n]),m.useEffect(()=>{l||s==null||s()},[l,s]);const P=m.useCallback(async N=>{if(w)return;const ee=N.status==="running",re=N.kind==="agent"&&N.status==="paused";if(!ee&&!re)return;if(N.kind==="agent"&&A.has(N.id)&&g!==N.id){y(N.id);return}y(null),v(!0);try{if(!(await i.cancelTask(N.id,N.kind)).cancelled){T(r("tasks.alreadyStopped"));return}const se=await i.getTasks();a(H5(se.tasks)),T(null)}catch(K){console.warn("[web-shell] failed to cancel task:",K),T(r("tasks.cancelFailed"))}finally{v(!1)}},[i,w,A,g,r]);if(bQ(N=>{if(l){if(N.key==="Escape"){if(N.preventDefault(),N.stopPropagation(),g){y(null);return}d==="detail"?h("list"):c(!1);return}if(N.key==="ArrowLeft"){N.preventDefault(),N.stopPropagation(),d==="detail"?(y(null),h("list")):c(!1);return}if((N.key==="ArrowUp"||N.key==="ArrowDown")&&d==="list"){if(N.preventDefault(),N.stopPropagation(),o.length===0)return;const ee=N.key==="ArrowUp"?-1:1;p(re=>Math.min(Math.max(re+ee,0),o.length-1)),y(null);return}if(N.key==="Enter"){N.preventDefault(),N.stopPropagation(),d==="list"&&M?h("detail"):d==="detail"&&c(!1);return}if(N.key===" "&&d==="detail"){N.preventDefault(),N.stopPropagation(),c(!1);return}if(N.key==="x"&&!N.ctrlKey&&!N.metaKey){N.preventDefault(),N.stopPropagation(),M&&P(M);return}}},[l,d,o.length,M,P,g]),!l)return null;const B=g!==null&&M!==null&&g===M.id,F=[];B?(F.push(r("tasks.confirmStop")),F.push(r("tasks.shortcut.cancelConfirm"))):(F.push(r("tasks.shortcut.select")),F.push(r("tasks.shortcut.view")),(M==null?void 0:M.status)==="running"?F.push(r("tasks.shortcut.stop")):(M==null?void 0:M.kind)==="agent"&&(M==null?void 0:M.status)==="paused"&&F.push(r("tasks.shortcut.abandon")),F.push(r("tasks.shortcut.listClose")));const O=[];if(B?(O.push(r("tasks.confirmStop")),O.push(r("tasks.shortcut.cancelConfirm"))):(O.push(r("tasks.shortcut.detailBack")),O.push(r("tasks.shortcut.detailClose")),(M==null?void 0:M.status)==="running"?O.push(r("tasks.shortcut.stop")):(M==null?void 0:M.kind)==="agent"&&(M==null?void 0:M.status)==="paused"&&O.push(r("tasks.shortcut.abandon"))),o.length===0)return u.jsxs("div",{className:t?`${St.panel} ${St.embeddedPanel}`:St.panel,"data-keyboard-scope":!0,children:[(b||k||!t)&&u.jsxs("div",{className:St.header,children:[!t&&u.jsx("div",{className:St.title,children:r("tasks.title")}),b&&u.jsx("div",{className:St.warning,children:r("tasks.refreshStale")}),k&&u.jsx("div",{className:St.error,children:k})]}),u.jsx("div",{children:u.jsx("div",{className:St.secondary,children:r("tasks.empty")})}),!t&&u.jsx("div",{className:St.shortcuts,children:r("tasks.shortcut.close")})]});const{visible:X,windowStart:z,hiddenAbove:U,hiddenBelow:D}=kNe(o,L),G=t?o:X,q=t?0:z;return u.jsxs("div",{className:t?`${St.panel} ${St.embeddedPanel}`:St.panel,"data-keyboard-scope":!0,children:[(t||d==="list")&&(b||k||!t)&&u.jsxs("div",{className:St.header,children:[!t&&u.jsx("div",{className:St.title,children:r("tasks.title")}),b&&u.jsx("div",{className:St.warning,children:r("tasks.refreshStale")}),k&&u.jsx("div",{className:St.error,children:k})]}),(t||d==="list")&&u.jsxs("div",{className:St.list,children:[!t&&u.jsxs("div",{className:St.sectionTitle,children:[r("tasks.title")," ",u.jsxs("span",{className:St.secondary,children:["(",o.length,")"]})]}),!t&&U>0&&u.jsx("div",{className:St.overflowHint,children:r("tasks.moreAbove",{count:U})}),G.map((N,ee)=>{const re=q+ee,Q=re===L,K=xQ(N.status),se=bNe(N.status,r),te=t&&Q&&d==="detail",ce=t?te:Q,oe=N.kind==="agent"?I.get(N.id):void 0,de=Math.min((oe==null?void 0:oe.visibleDepth)??0,xMe),Te=N.kind==="agent"&&N.parentAgentId!=null,qe=oe!=null&&oe.orphaned?N.kind==="agent"&&N.parentName?r("tasks.row.from",{parent:N.parentName}):r("tasks.row.nested"):null;return u.jsxs("div",{className:`${St.task} ${te?St.taskExpanded:""}`,children:[u.jsxs("div",{className:ce?`${St.row} ${St.selected}`:St.row,onClick:()=>{p(re),h(t&&te?"list":"detail")},onMouseEnter:()=>{t||p(re)},children:[u.jsx("span",{className:St.pointer,children:ce?"❯":""}),t&&u.jsx("span",{className:St.taskIcon,"aria-hidden":"true"}),u.jsxs("span",{className:St.nameCell,style:de>0?{paddingLeft:`${de*16}px`}:void 0,children:[Te&&u.jsx("span",{className:St.treeMarker,"aria-hidden":"true",children:"↳ "}),xNe(N,A.has(N.id)),qe&&u.jsxs("span",{className:St.orphanNote,children:[" · ",qe]})]}),u.jsx("span",{className:`${St.status} ${K}`,children:se}),u.jsx("span",{className:St.chevronCell,children:u.jsx(wNe,{expanded:te})})]}),te&&u.jsx("div",{className:St.inlineDetail,children:u.jsx(nB,{task:N,t:r,hideHeader:!0,busy:w,showCancelConfirm:g===N.id,onCancel:()=>void P(N),onCancelConfirmDismiss:()=>y(null)})})]},N.id)}),!t&&D>0&&u.jsx("div",{className:St.overflowHint,children:r("tasks.moreBelow",{count:D})})]}),!t&&d==="detail"&&M&&u.jsxs(u.Fragment,{children:[k&&u.jsx("div",{className:St.error,children:k}),u.jsx(nB,{task:M,t:r,busy:w,showCancelConfirm:g===M.id,onCancel:()=>void P(M),onCancelConfirmDismiss:()=>y(null)})]}),!t&&u.jsx("div",{className:B?`${St.shortcuts} ${St.confirmHint}`:St.shortcuts,children:(d==="list"?F:O).join(" · ")})]})}function SNe(e,t){switch(e.kind){case"agent":return`${e.subagentType??t("common.agent")} › ${e.label}`;case"shell":return`${t("tasks.kind.shell")} › ${e.command}`;case"monitor":return`${t("tasks.kind.monitor")} › ${e.description}`}}function nB({task:e,t,hideHeader:n=!1,busy:s=!1,showCancelConfirm:r=!1,onCancel:i,onCancelConfirmDismiss:o}){var x,k,T;const a=vNe(e.status),l=xQ(e.status),c=e.kind==="agent"&&e.status==="paused",d=e.status==="running"||c,h=t(c?"tasks.action.abandon":"tasks.action.stop"),f=t(c?"tasks.action.confirmAbandon":"tasks.action.confirmStop"),p=[V8(e.runtimeMs)],g=[{label:t("tasks.detail.runtime"),value:V8(e.runtimeMs)}],y=e.kind==="agent"?((x=e.stats)==null?void 0:x.outputTokens)??((k=e.stats)==null?void 0:k.totalTokens):void 0;y&&(p.push(t("tasks.detail.tokens",{count:tB(y)})),g.push({label:t("tasks.detail.tokenCount"),value:tB(y)})),e.kind==="agent"&&((T=e.stats)==null?void 0:T.toolUses)!==void 0&&(p.push(t("tasks.detail.toolCalls",{count:e.stats.toolUses})),g.push({label:t("tasks.detail.toolCallCount"),value:String(e.stats.toolUses)})),e.kind!=="agent"&&e.pid!==void 0&&p.push(`pid ${e.pid}`),e.kind==="shell"&&e.exitCode!==void 0&&p.push(t("tasks.detail.exit",{exitCode:e.exitCode})),e.kind==="monitor"&&(p.push(t("tasks.detail.events",{count:e.eventCount})),e.droppedLines>0&&p.push(t("tasks.detail.dropped",{count:e.droppedLines})),e.exitCode!==void 0&&p.push(t("tasks.detail.exit",{exitCode:e.exitCode})));const w=e.kind==="agent"&&e.prompt?e.prompt.split(`
`):[],v=d&&i?u.jsx("div",{className:St.actionBar,children:r?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:St.actionHint,children:t("tasks.action.confirmHint")}),u.jsx("button",{type:"button",className:`${St.actionButton} ${St.dangerButton}`,disabled:s,onClick:i,children:f}),u.jsx("button",{type:"button",className:St.actionButton,onClick:o,children:t("common.cancel")})]}):u.jsx("button",{type:"button",className:`${St.actionButton} ${St.dangerButton}`,disabled:s,onClick:i,children:h})}):null,b=n?g.length>0?u.jsx("div",{className:St.compactSummary,children:g.map(C=>`${C.label} ${C.value}`).join(" · ")}):null:u.jsxs(u.Fragment,{children:[u.jsx("div",{className:St.title,children:SNe(e,t)}),u.jsxs("div",{className:St.statusBadge,children:[a&&u.jsxs(u.Fragment,{children:[u.jsxs("span",{className:l,children:[a," ",t(`tasks.${e.status}`)]}),u.jsx("span",{className:St.separator,children:"·"})]}),u.jsx("span",{className:St.secondary,children:p.join(" · ")})]})]});return u.jsxs("div",{className:St.detail,children:[(b||v)&&u.jsxs("div",{className:St.detailTop,children:[b&&u.jsx("div",{className:St.detailTopMain,children:b}),v]}),e.kind==="shell"&&u.jsxs(u.Fragment,{children:[u.jsx(Km,{label:t("tasks.detail.workingDir"),value:e.cwd}),e.outputFile&&u.jsx(Km,{label:t("tasks.detail.outputFile"),value:e.outputFile})]}),e.kind==="monitor"&&u.jsx(Km,{label:t("tasks.detail.command"),value:e.command}),e.kind==="agent"&&e.subagentType&&u.jsx(Km,{label:t("tasks.detail.type"),value:e.subagentType}),e.kind==="agent"&&(e.depth??0)>0&&u.jsx(Km,{label:t("tasks.detail.nesting"),value:e.parentName?t("tasks.detail.nestingValue",{level:(e.depth??0)+1,parent:e.parentName}):t("tasks.detail.nestingLevel",{level:(e.depth??0)+1})}),e.kind==="agent"&&e.recentActivities&&e.recentActivities.length>0&&u.jsxs("div",{className:St.detailField,children:[u.jsx("div",{className:St.detailFieldLabel,children:t("tasks.detail.progress")}),u.jsx("div",{className:St.detailContent,children:e.recentActivities.slice(-5).map((C,S,_)=>{const L=S===_.length-1,M=_Ne(C.name,C.description,t);return u.jsxs("div",{className:L?St.activityCurrent:St.activityPast,children:[L?"> ":"  ",M]},`${C.at}-${S}`)})})]}),e.kind==="agent"&&e.prompt&&u.jsxs("div",{className:St.detailField,children:[u.jsx("div",{className:St.detailFieldLabel,children:t("tasks.detail.prompt")}),u.jsx("div",{className:St.promptContent,children:w.slice(0,5).map((C,S,_)=>u.jsx("div",{children:S===_.length-1&&w.length>5?`${C}…`:C||" "},S))})]}),e.kind==="agent"&&e.outputFile&&u.jsx(Km,{label:t("tasks.detail.outputFile"),value:e.outputFile}),e.kind==="agent"&&e.status==="paused"&&e.resumeBlockedReason&&u.jsxs("div",{className:St.detailField,children:[u.jsx("div",{className:`${St.detailFieldLabel} ${St.error}`,children:t("tasks.detail.resumeBlocked")}),u.jsx("div",{className:St.error,children:e.resumeBlockedReason})]}),e.error&&u.jsxs("div",{className:St.detailField,children:[u.jsx("div",{className:`${St.detailFieldLabel} ${e.kind==="monitor"&&e.status!=="failed"?St.warning:St.error}`,children:e.kind==="monitor"&&e.status!=="failed"?t("tasks.detail.stoppedBecause"):t("tasks.detail.error")}),u.jsx("div",{className:e.kind==="monitor"&&e.status!=="failed"?St.warning:St.error,children:e.error})]})]})}function Km({label:e,value:t}){return u.jsxs("div",{className:St.detailField,children:[u.jsx("div",{className:St.detailFieldLabel,children:e}),u.jsx("div",{className:St.detailContent,children:t})]})}const CNe="_message_fm8gc_1",TNe="_body_fm8gc_15",ENe="_title_fm8gc_20",ANe="_muted_fm8gc_24",MNe="_accent_fm8gc_28",NNe="_success_fm8gc_32",INe="_error_fm8gc_36",RNe="_warning_fm8gc_40",jNe="_row_fm8gc_44",LNe="_label_fm8gc_50",DNe="_value_fm8gc_55",Qo={message:CNe,body:TNe,title:ENe,muted:ANe,accent:MNe,success:NNe,error:INe,warning:RNe,row:jNe,label:LNe,value:DNe},W8="web-shell-goal-status-active",{serialize:sB,parse:ONe}=h4(Dle),PNe=new Set(["set","achieved","cleared","failed","aborted","checking"]);function C2(e){const t=typeof e=="string"?ONe(e):e;return BNe(t)}function BNe(e){if(!e||typeof e!="object")return null;const t=e,n=t.kind,s=t.condition;if(typeof n!="string"||!PNe.has(n)||typeof s!="string")return null;const r=U5(t.iterations),i=U5(t.durationMs),o=U5(t.setAt),a=typeof t.lastReason=="string"?t.lastReason:void 0;return{kind:n,condition:s,...r!==void 0?{iterations:r}:{},...i!==void 0?{durationMs:i}:{},...o!==void 0?{setAt:o}:{},...a!==void 0?{lastReason:a}:{}}}function U5(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function $Ne(e,t){return t(e===1?"goal.turn":"goal.turns",{count:e})}function zNe(e,t){switch(e.kind){case"checking":return{title:`${t("goal.check")}${e.iterations&&e.iterations>0?` · ${t("goal.turnLabel",{count:e.iterations})}`:""} · ${t("goal.notYetMet")}`,colorClass:Qo.muted};case"set":return{title:t("goal.set"),colorClass:Qo.accent};case"achieved":return{title:t("goal.achieved"),colorClass:Qo.success};case"cleared":return{title:t("goal.cleared"),colorClass:Qo.muted};case"failed":return{title:t("goal.failed"),colorClass:Qo.error};case"aborted":return{title:t("goal.aborted"),colorClass:Qo.warning}}}function FNe({status:e,activateFooter:t=!1}){var l;const{t:n}=ot();m.useEffect(()=>{if(!t)return;const c=e.kind==="set"||e.kind==="checking";window.dispatchEvent(new CustomEvent(W8,{detail:{active:c,condition:e.condition,setAt:e.setAt}}))},[t,e.condition,e.kind,e.setAt]);const s=zNe(e,n),r=[];e.kind!=="checking"&&(e.iterations&&e.iterations>0&&r.push($Ne(e.iterations,n)),typeof e.durationMs=="number"&&r.push(V8(e.durationMs)));const i=r.length>0?` · ${r.join(" · ")}`:"",o=(e.kind==="checking"||e.kind==="achieved"||e.kind==="failed"||e.kind==="aborted")&&((l=e.lastReason)==null?void 0:l.trim()),a=e.kind==="checking"?n("goal.judge"):n("goal.lastCheck");return u.jsx("div",{className:Qo.message,children:u.jsxs("div",{className:Qo.body,children:[u.jsxs("div",{className:`${Qo.title} ${s.colorClass}`,children:[s.title,i&&u.jsx("span",{className:Qo.muted,children:i})]}),u.jsxs("div",{className:Qo.row,children:[u.jsxs("span",{className:Qo.label,children:[n("goal.label"),":"]}),u.jsx("span",{className:Qo.value,children:e.condition})]}),o&&u.jsxs("div",{className:Qo.muted,children:[a,": ",o]})]})})}const qNe="_message_u8kmd_1",HNe="_flushMessage_u8kmd_12",UNe="_noMarker_u8kmd_26",VNe="_content_u8kmd_30",WNe="_info_u8kmd_49",GNe="_recap_u8kmd_54",KNe="_modelSwitch_u8kmd_67",YNe="_error_u8kmd_71",XNe="_warning_u8kmd_77",QNe="_retryHint_u8kmd_83",JNe="_retryButton_u8kmd_90",ZNe="_cancelled_u8kmd_108",Wo={message:qNe,flushMessage:HNe,noMarker:UNe,content:VNe,info:WNe,recap:GNe,modelSwitch:KNe,error:YNe,warning:XNe,retryHint:QNe,retryButton:JNe,cancelled:ZNe},eIe=m.memo(function({content:t,variant:n,source:s,data:r,onShowContextDetail:i,isLatest:o=!1,showRetryHint:a=!1,onRetryClick:l}){const{t:c}=ot();if(s==="prompt_cancelled")return u.jsx("div",{className:Wo.cancelled,role:"status",children:u.jsx("span",{children:c("turn.stopped")})});const d=n==="info"?_Ae(t):null;if(d)return u.jsx("div",{className:Wo.flushMessage,children:u.jsx(NAe,{status:d,onShowDetail:i})});const h=n==="info"?h9e(t):null;if(h)return u.jsx("div",{className:Wo.flushMessage,children:u.jsx(w9e,{view:h.view,status:h.status})});const f=n==="info"?M9e(t):null;if(f)return u.jsx("div",{className:Wo.flushMessage,children:u.jsx(N9e,{info:f})});const p=n==="info"?fMe(t):null;if(p)return u.jsx("div",{className:Wo.flushMessage,children:u.jsx(wMe,{message:p})});const g=n==="info"?gNe(t):null;if(g)return u.jsx("div",{className:Wo.flushMessage,children:u.jsx(kQ,{message:g})});const y=n==="info"?C2(s==="goal"?r:t):null;if(y)return u.jsx("div",{className:Wo.flushMessage,children:u.jsx(FNe,{status:y,activateFooter:o})});const w=n==="info"&&s==="model_switch_summary",v=n==="info"&&s==="recap";return u.jsx("div",{className:`${Wo.message} ${Wo[n]} ${w?Wo.modelSwitch:""} ${v?Wo.recap:""}`,children:u.jsxs("div",{className:Wo.content,children:[w?u.jsx("pre",{children:t}):n==="info"?u.jsx(tg,{content:t}):u.jsx("pre",{children:t}),a&&l&&u.jsx("div",{className:Wo.retryHint,children:u.jsx("button",{type:"button",className:Wo.retryButton,onClick:l,children:c("retry.hint")})})]})})}),tIe="_group_emvwk_1",nIe="_chatSummaryGroup_emvwk_14",sIe="_line_emvwk_22",rIe="_chatSummary_emvwk_14",iIe="_chatSummaryTextActive_emvwk_49",oIe="_chatSummaryIcon_emvwk_55",aIe="_chatSummaryToolIcon_emvwk_69",lIe="_chatSummaryText_emvwk_49",cIe="_chatSummaryInline_emvwk_85",uIe="_chatChevronRight_emvwk_122",dIe="_chatChevronDown_emvwk_123",hIe="_chatSummaryContentClip_emvwk_184",fIe="_chatSummaryContentCollapsed_emvwk_192",mIe="_chatSummaryContentInner_emvwk_196",pIe="_lineMain_emvwk_201",gIe="_icon_emvwk_211",yIe="_iconError_emvwk_216",bIe="_lineName_emvwk_220",vIe="_lineArg_emvwk_224",wIe="_lineElapsed_emvwk_232",xIe="_lineExpandable_emvwk_238",kIe="_lineChevronRight_emvwk_258",_Ie="_lineChevronDown_emvwk_259",SIe="_lineOutput_emvwk_296",CIe="_expandedCard_emvwk_305",TIe="_expandedCardHeader_emvwk_315",EIe="_expandedCardTitle_emvwk_324",AIe="_expandedCardDetail_emvwk_331",MIe="_expandedCardBody_emvwk_341",NIe="_expandedAgentCard_emvwk_346",IIe="_expandedLineOutput_emvwk_356",RIe="_lineDetail_emvwk_360",jIe="_markdownLineDetail_emvwk_366",LIe="_expandedBash_emvwk_374",DIe="_expandedRead_emvwk_375",OIe="_expandedOutput_emvwk_379",PIe="_expandedEdit_emvwk_393",BIe="_todoProgress_emvwk_407",$Ie="_todoBody_emvwk_414",zIe="_compactGroup_emvwk_422",FIe="_compactHeader_emvwk_429",qIe="_compactCount_emvwk_439",HIe="_compactHint_emvwk_445",Dt={group:tIe,chatSummaryGroup:nIe,line:sIe,chatSummary:rIe,chatSummaryTextActive:iIe,chatSummaryIcon:oIe,chatSummaryToolIcon:aIe,chatSummaryText:lIe,chatSummaryInline:cIe,chatChevronRight:uIe,chatChevronDown:dIe,chatSummaryContentClip:hIe,chatSummaryContentCollapsed:fIe,chatSummaryContentInner:mIe,lineMain:pIe,icon:gIe,iconError:yIe,lineName:bIe,lineArg:vIe,lineElapsed:wIe,lineExpandable:xIe,lineChevronRight:kIe,lineChevronDown:_Ie,lineOutput:SIe,expandedCard:CIe,expandedCardHeader:TIe,expandedCardTitle:EIe,expandedCardDetail:AIe,expandedCardBody:MIe,expandedAgentCard:NIe,expandedLineOutput:IIe,lineDetail:RIe,markdownLineDetail:jIe,expandedBash:LIe,expandedRead:DIe,expandedOutput:OIe,expandedEdit:PIe,todoProgress:BIe,todoBody:$Ie,compactGroup:zIe,compactHeader:FIe,compactCount:qIe,compactHint:HIe};function rm({status:e}){const{t}=ot();switch(e){case"completed":case"success":return null;case"failed":case"error":case"cancelled":case"canceled":return u.jsx("span",{className:`${Dt.icon} ${Dt.iconError}`,children:t("tool.status.failed")});case"in_progress":case"running":return null;default:return null}}function Db(e,t){if(!e)return"";const n=Math.round(((t||Date.now())-e)/1e3);if(n<3)return"";if(n<60)return`${n}s`;const s=Math.floor(n/60),r=n%60;return`${s}m ${r}s`}function _Q(e){if(!e)return"";const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60),s=t%60;return`${n}m ${s}s`}function SQ(e){const t=Math.max(1,Math.ceil(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60),s=t%60;return s>0?`${n}m ${s}s`:`${n}m`}const UIe="_panel_rcjxd_1",VIe="_header_rcjxd_11",WIe="_desc_rcjxd_23",GIe="_toggle_rcjxd_32",KIe="_meta_rcjxd_38",YIe="_body_rcjxd_44",XIe="_content_rcjxd_55",QIe="_stream_rcjxd_70",JIe="_streamCollapsed_rcjxd_80",ZIe="_scrollWindow_rcjxd_88",eRe="_expandToggle_rcjxd_93",tRe="_sectionCap_rcjxd_110",nRe="_tools_rcjxd_128",sRe="_step_rcjxd_142",rRe="_toolTimeRow_rcjxd_188",iRe="_toolTimeTip_rcjxd_192",Pr={panel:UIe,header:VIe,desc:WIe,toggle:GIe,meta:KIe,body:YIe,content:XIe,stream:QIe,streamCollapsed:JIe,scrollWindow:ZIe,expandToggle:eRe,sectionCap:tRe,tools:nRe,step:sRe,toolTimeRow:rRe,toolTimeTip:iRe};function CQ(e){return!!e&&typeof e=="object"&&e.type==="task_execution"}function oRe({timestamp:e,children:t}){return e===void 0?u.jsx(u.Fragment,{children:t}):u.jsxs("div",{className:Pr.toolTimeRow,children:[t,u.jsx("span",{className:Pr.toolTimeTip,"aria-hidden":"true",children:y0(e)})]})}const aRe=m.memo(function({tool:t}){const n=t.subTools||t.subContent?u.jsx(B9,{tool:t}):u.jsx(Y8,{tool:t,forceExpandable:!0,hideCollapsedOutput:!0});return u.jsx(oRe,{timestamp:t.startTime,children:n})});function lRe({tc:e}){const{t}=ot();return u.jsx("div",{className:Dt.line,children:u.jsxs("div",{className:Dt.lineMain,children:[u.jsx(rm,{status:e.status}),u.jsx("span",{className:Dt.lineName,children:Wc(e.name,t)})]})})}function cRe(e){var t;if(e.rawOutput&&CQ(e.rawOutput)&&e.rawOutput.result)return e.rawOutput.result;if(e.content){for(const n of e.content)if(n.type==="content"&&((t=n.content)!=null&&t.text))return n.content.text}if(e.rawOutput){if(typeof e.rawOutput=="string")return e.rawOutput;const n=e.rawOutput;if(typeof n.output=="string")return n.output;if(typeof n.result=="string")return n.result;if(typeof n.content=="string")return n.content;if(typeof n.reason=="string")return n.reason;if(typeof n.terminateReason=="string"&&n.terminateReason!=="GOAL")return n.terminateReason;if(typeof n.error=="string")return n.error;if(typeof n.text=="string")return n.text}return""}function uRe({text:e}){const{compactThinking:t}=zc(),{t:n}=ot(),[s,r]=m.useState(!1),[i,o]=m.useState(!1),a=m.useRef(null),l=t&&!s;return m.useEffect(()=>{const c=a.current;!c||!l||(o(c.scrollHeight>c.clientHeight),c.scrollTop=c.scrollHeight)},[l,e]),m.useEffect(()=>{const c=a.current;if(!c||!l)return;const d=()=>o(c.scrollHeight>c.clientHeight),h=new ResizeObserver(d);return h.observe(c),()=>h.disconnect()},[l]),u.jsxs("div",{children:[u.jsx("pre",{ref:a,className:l?`${Pr.stream} ${Pr.streamCollapsed}`:Pr.stream,children:e}),t&&(i||s)&&u.jsx("button",{className:Pr.expandToggle,onClick:()=>r(c=>!c),"aria-expanded":s,"aria-label":n("subagent.toggleStream"),children:s?"▲":"▼"})]})}function dRe({content:e}){const{compactThinking:t}=zc();return u.jsx("div",{className:t?Pr.scrollWindow:void 0,children:u.jsx(tg,{content:e,source:"assistant"})})}function rB({pinTail:e,itemCount:t,children:n}){const s=m.useRef(null);return m.useEffect(()=>{const r=s.current;r&&(r.scrollTop=e?r.scrollHeight:0)},[e,t]),u.jsx("div",{ref:s,className:`${Pr.tools} ${Pr.scrollWindow}`,children:n})}function B9({tool:e,defaultExpanded:t,hideHeader:n,inline:s}){var T,C,S,_;const{t:r}=ot(),i=e.status==="completed"||e.status==="failed",o=Xy(e),[a,l]=m.useState(t??!1),c=CQ(e.rawOutput)?e.rawOutput:null,d=((T=e.subTools)==null?void 0:T.length)||((C=c==null?void 0:c.toolCalls)==null?void 0:C.length)||0,h=P9(e),f=O9(e),p=Db(e.startTime,e.endTime)||_Q((S=c==null?void 0:c.executionSummary)==null?void 0:S.totalDurationMs),g=c!=null&&c.tokenCount&&c.tokenCount>0?c.tokenCount:(_=c==null?void 0:c.executionSummary)==null?void 0:_.outputTokens,y=g?D9(g):"",w=i?cRe(e):"",v=m.useMemo(()=>e.subTools&&e.subTools.length>0?null:(c==null?void 0:c.toolCalls)||null,[e.subTools,c]),b=!!(e.subContent||w),x=!!(e.subTools&&e.subTools.length>0||v&&v.length>0),k=i&&b&&x;return u.jsxs("div",{className:s?void 0:Pr.panel,children:[!n&&u.jsxs("div",{className:Pr.header,onClick:()=>l(!a),children:[u.jsx(rm,{status:o}),u.jsxs("span",{className:Dt.lineName,children:[f,":"]}),h&&u.jsx("span",{className:Pr.desc,children:Ti(h,50)}),i&&d>0&&u.jsxs("span",{className:Pr.meta,children:["· ",r("subagent.toolsCount",{count:d})]}),p&&u.jsxs("span",{className:Pr.meta,children:["· ",p]}),y&&u.jsxs("span",{className:Pr.meta,children:["· ",y]}),!i&&u.jsx("span",{className:Pr.toggle,children:a?"▼":"▶"})]}),(a||n)&&u.jsxs("div",{className:Pr.body,children:[i&&b&&u.jsxs("div",{className:Pr.content,children:[k&&u.jsx("div",{className:Pr.sectionCap,children:r("subagent.result")}),u.jsx(dRe,{content:e.subContent||w})]}),k&&u.jsx("div",{className:Pr.sectionCap,children:r("subagent.tools",{count:d})}),e.subTools&&e.subTools.length>0&&u.jsx(rB,{pinTail:!i,itemCount:e.subTools.length,children:e.subTools.map(L=>u.jsx("div",{className:Pr.step,"data-status":L.status,children:u.jsx(aRe,{tool:L})},L.callId))}),v&&v.length>0&&u.jsx(rB,{pinTail:!i,itemCount:v.length,children:v.map(L=>u.jsx("div",{className:Pr.step,"data-status":L.status,children:u.jsx(lRe,{tc:L})},L.callId))}),!i&&e.subContent&&u.jsx("div",{className:Pr.content,children:u.jsx(uRe,{text:e.subContent})})]})]})}const hRe="_view_1ycry_1",fRe="_stats_1ycry_7",mRe="_statAdd_1ycry_16",pRe="_statDel_1ycry_20",gRe="_lines_1ycry_24",yRe="_line_1ycry_24",bRe="_lineAdd_1ycry_36",vRe="_lineDel_1ycry_40",wRe="_lineHeader_1ycry_44",xRe="_lineContext_1ycry_50",kRe="_lineNo_1ycry_54",_Re="_marker_1ycry_64",SRe="_content_1ycry_79",nc={view:hRe,stats:fRe,statAdd:mRe,statDel:pRe,lines:gRe,line:yRe,lineAdd:bRe,lineDel:vRe,lineHeader:wRe,lineContext:xRe,lineNo:kRe,marker:_Re,content:SRe};function CRe(e){let t=0,n=0;const s=[];let r=0,i=0;for(const o of e.split(`
`))if(o.startsWith("@@")){const a=o.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);a&&(r=parseInt(a[1],10),i=parseInt(a[2],10)),s.push({type:"header",content:o})}else o.startsWith("+")&&!o.startsWith("+++ ")?(t++,s.push({type:"add",content:o.slice(1),newLine:i}),i++):o.startsWith("-")&&!o.startsWith("--- ")?(n++,s.push({type:"del",content:o.slice(1),oldLine:r}),r++):(s.push({type:"context",content:o.startsWith(" ")?o.slice(1):o,oldLine:r,newLine:i}),r++,i++);return{lines:s,additions:t,deletions:n}}const TRe=m.memo(function({diff:t}){if(!t)return null;const{lines:n,additions:s,deletions:r}=CRe(t);return u.jsxs("div",{className:nc.view,children:[u.jsxs("div",{className:nc.stats,children:[s>0&&u.jsxs("span",{className:nc.statAdd,children:["+",s]}),r>0&&u.jsxs("span",{className:nc.statDel,children:["-",r]})]}),u.jsx("div",{className:nc.lines,children:n.map((i,o)=>u.jsxs("div",{className:`${nc.line} ${nc[`line${i.type[0].toUpperCase()}${i.type.slice(1)}`]}`,children:[u.jsx("span",{className:nc.lineNo,children:i.type==="header"?"":i.oldLine??i.newLine}),u.jsx("span",{className:nc.marker,children:i.type==="add"?"+":i.type==="del"?"-":i.type==="header"?"":" "}),u.jsx("span",{className:nc.content,children:i.content})]},o))})]})}),iB={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 ERe(e){const t=[];let n,s=!1,r=!1,i=0;const o=new RegExp(String.raw`\x1b\[([0-9;]*)m`,"g");let a;for(;(a=o.exec(e))!==null;){a.index>i&&t.push({text:e.slice(i,a.index),color:n,bold:s,dim:r}),i=a.index+a[0].length;const l=a[1].split(";").map(Number);for(const c of l)c===0?(n=void 0,s=!1,r=!1):c===1?s=!0:c===2?r=!0:c===22?(s=!1,r=!1):c>=30&&c<=37||c>=90&&c<=97?n=iB[c]:c===39&&(n=void 0)}return i<e.length&&t.push({text:e.slice(i),color:n,bold:s,dim:r}),t}function ARe(e){return new RegExp(String.raw`\x1b\[`).test(e)}function nd(e){const t=e.toLowerCase();return t==="todo_write"||t==="todowrite"}function V5(e){const t=e.flatMap((n,s)=>{const r=E2(n),i=Ew(r,"content");return i?[{id:Ew(r,"id")??`plan-${s}`,content:i,status:zRe(Ew(r,"status")),priority:FRe(Ew(r,"priority"))}]:[]});return t.length>0?t:void 0}function $9(e){if(!nd(e.toolName)&&e.kind!=="other")return;const t=aB(e.args);if(t)return V5(t);const n=E2(e.rawOutput),s=aB(n);if(s)return V5(s);const r=Array.isArray(n==null?void 0:n.entries)?n.entries:void 0;return r?V5(r):void 0}function MRe(e){return e.some(t=>t.status==="pending"||t.status==="in_progress")}function T2(e){switch(e){case"completed":return"●";case"in_progress":return"◐";case"pending":return"○"}}const oB={todos:[],allCompleted:!1,sourceMessageId:null,sourceCallId:null};function NRe(e){let t=[],n=null,s=null,r=!1;for(const o of e){if(o.role==="user"||o.role==="user_shell"){r=!0;continue}if(o.role==="plan"){t=o.todos,n=o.id,s=null,r=!1;continue}if(o.role==="tool_group")for(const a of o.tools){const l=$9(a);l&&(t=l,n=o.id,s=a.callId,r=!1)}}if(t.length===0)return oB;const i=!MRe(t);return r?oB:{todos:t,allCompleted:i,sourceMessageId:n,sourceCallId:s}}function z9(e){return JSON.stringify([e.id,e.content])}function f4(e){if(e.role==="plan")return[{key:e.id,todos:e.todos}];if(e.role==="tool_group"){const t=[];for(const n of e.tools){const s=$9(n);s&&t.push({key:n.callId,todos:s,stats:LRe(n)})}return t}return[]}function IRe(e){const t=new Map,n=new Map;for(const s of e)for(const{key:r,todos:i}of f4(s)){const o=[];for(const a of i){const l=z9(a),c=n.get(l);a.status==="in_progress"&&c!=="in_progress"?o.push({kind:"started",id:a.id,content:a.content}):a.status==="completed"&&c!=="completed"&&c!==void 0&&o.push({kind:"completed",id:a.id,content:a.content}),n.set(l,a.status)}t.set(r,{events:o})}return t}function RRe(e){const t=[];for(const n of e)for(const{key:s,todos:r}of f4(n))t.push(JSON.stringify([s,r.map(i=>[i.id,i.status,i.content])]));return t.join(`
`)}function jRe(e){const t=[];for(const n of e){if(n.role==="tool_group")for(const s of n.tools)!nd(s.toolName)&&(s.startTime!==void 0||s.endTime!==void 0)&&t.push(JSON.stringify(["span",s.callId,s.startTime,s.endTime]));for(const{key:s,todos:r,stats:i}of f4(n))t.push(JSON.stringify([s,n.timestamp,r.map(o=>[o.id,o.status,o.content]),i]))}return t.join(`
`)}function LRe(e){var o;const t=E2((o=E2(e.rawOutput))==null?void 0:o.stats);if(!t)return;const n=a=>{const l=t[a];return typeof l=="number"&&Number.isFinite(l)?l:void 0},s=n("promptTokens"),r=n("cachedTokens"),i=n("candidateTokens");if(!(s===void 0||r===void 0||i===void 0))return{promptTokens:s,cachedTokens:r,candidateTokens:i,apiTimeMs:n("apiTimeMs")??0}}function DRe(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const s of n.tools){if(nd(s.toolName))continue;const{startTime:r,endTime:i}=s;typeof r=="number"&&typeof i=="number"&&i>=r&&t.push({start:r,end:i})}return t.sort((n,s)=>n.start-s.start),t}function ORe(e,t,n){let s=0,r=e.length;for(;s<r;){const o=s+r>>>1;e[o].start<t?s=o+1:r=o}let i=0;for(let o=s;o<e.length&&e[o].start<=n;o++)i+=e[o].end-e[o].start;return i}function PRe(e,t){const n=(s,r)=>Math.max(0,r-s);return{inputTokens:n(e.promptTokens,t.promptTokens),cachedTokens:n(e.cachedTokens,t.cachedTokens),outputTokens:n(e.candidateTokens,t.candidateTokens),apiTimeMs:n(e.apiTimeMs,t.apiTimeMs)}}function BRe(e,t){const n={};return e&&(e.inputTokens>0||e.outputTokens>0||e.cachedTokens>0||e.apiTimeMs>0)&&(n.inputTokens=e.inputTokens,n.cachedTokens=e.cachedTokens,n.outputTokens=e.outputTokens,e.apiTimeMs>0&&(n.apiTimeMs=e.apiTimeMs)),t!==void 0&&t>0&&(n.toolTimeMs=t),Object.keys(n).length>0?n:void 0}function $Re(e){var a;const t=new Map,n=new Map,s=new Map,r=new Set,i=DRe(e),o=l=>{let c=t.get(l);return c||(c={},t.set(l,c)),c};for(const l of e){const c=l.timestamp;for(const{todos:d,stats:h}of f4(l))for(const f of d){const p=z9(f),g=n.get(p);if(f.status==="in_progress"&&g!=="in_progress")r.has(p)&&(r.delete(p),s.delete(p),t.delete(p)),s.get(p)===void 0&&(s.set(p,h),c!==void 0&&(o(p).startTs=c));else if(f.status==="completed"&&g!=="completed"&&g!==void 0){const y=s.get(p),w=y&&h?PRe(y,h):void 0,v=(a=t.get(p))==null?void 0:a.startTs,b=v!==void 0&&c!==void 0?ORe(i,v,c):void 0,x=BRe(w,b);if(c!==void 0||x){const k=o(p);c!==void 0&&(k.endTs=c),x&&(k.resources=x)}}f.status==="completed"&&r.add(p),n.set(p,f.status)}}return t}function aB(e){const t=e==null?void 0:e.todos;return Array.isArray(t)?t:void 0}function zRe(e){return e==="completed"||e==="in_progress"||e==="pending"?e:"pending"}function FRe(e){return e==="high"||e==="medium"||e==="low"?e:void 0}function E2(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function Ew(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}const Dx=new Set;let Kg=null,TQ=Date.now();function qRe(){TQ=Date.now();for(const e of Dx)e()}function HRe(e){return Dx.add(e),Kg||(Kg=setInterval(qRe,1e3)),()=>{Dx.delete(e),Dx.size===0&&Kg&&(clearInterval(Kg),Kg=null)}}function F9(e){const[t,n]=m.useState(()=>Date.now());return m.useEffect(()=>{if(e)return n(Date.now()),HRe(()=>n(TQ))},[e]),t}const URe="_list_1bo8s_1",VRe="_summary_1bo8s_2",WRe="_row_1bo8s_8",GRe="_num_1bo8s_16",KRe="_icon_1bo8s_23",YRe="_text_1bo8s_29",XRe="_inProgress_1bo8s_43",QRe="_completed_1bo8s_48",JRe="_item_1bo8s_62",ZRe="_rowButton_1bo8s_69",eje="_detailChevron_1bo8s_82",tje="_detail_1bo8s_82",nje="_detailSection_1bo8s_100",sje="_detailSectionTitle_1bo8s_106",rje="_detailRows_1bo8s_114",ije="_detailLabel_1bo8s_122",oje="_detailValue_1bo8s_126",aje="_detailDuration_1bo8s_132",lje="_detailHint_1bo8s_136",As={list:URe,summary:VRe,row:WRe,num:GRe,icon:KRe,text:YRe,inProgress:XRe,completed:QRe,item:JRe,rowButton:ZRe,detailChevron:eje,detail:tje,detailSection:nje,detailSectionTitle:sje,detailRows:rje,detailLabel:ije,detailValue:oje,detailDuration:aje,detailHint:lje};function G8(e){switch(e){case"completed":return As.completed;case"in_progress":return As.inProgress;case"pending":return""}}function EQ({todos:e,events:t}){const{t:n}=ot();if(t.length===0){if(e.length>0&&e.every(i=>i.status==="completed"))return u.jsx("div",{className:As.summary,children:u.jsxs("div",{className:`${As.row} ${As.completed}`,children:[u.jsx("span",{className:As.icon,"aria-hidden":"true",children:"✓"}),u.jsx("span",{className:As.text,children:n("todo.allDone")})]})});const r=e.find(i=>i.status==="in_progress")??e.find(i=>i.status==="pending");return r?u.jsx("div",{className:As.summary,children:u.jsxs("div",{className:`${As.row} ${G8(r.status)}`,children:[u.jsx("span",{className:As.icon,"aria-hidden":"true",children:T2(r.status)}),u.jsx("span",{className:As.text,children:r.content})]})}):null}return u.jsx("div",{className:As.summary,children:t.map(s=>u.jsxs("div",{className:`${As.row} ${s.kind==="completed"?As.completed:As.inProgress}`,children:[u.jsx("span",{className:As.icon,"aria-hidden":"true",children:T2(s.kind==="completed"?"completed":"in_progress")}),u.jsx("span",{className:As.text,children:s.content})]},`${s.kind}-${s.id}`))})}function cf({label:e,value:t,suffix:n}){return u.jsxs(u.Fragment,{children:[u.jsx("span",{className:As.detailLabel,children:e}),u.jsxs("span",{className:As.detailValue,children:[t,n]})]})}function W5({title:e,children:t}){return u.jsxs("div",{className:As.detailSection,children:[u.jsx("div",{className:As.detailSectionTitle,children:e}),u.jsx("div",{className:As.detailRows,children:t})]})}function cje({detail:e}){const{t}=ot(),{startTs:n,endTs:s,resources:r}=e,i=n!==void 0||s!==void 0,o=(r==null?void 0:r.inputTokens)!==void 0,a=(r==null?void 0:r.apiTimeMs)!==void 0||(r==null?void 0:r.toolTimeMs)!==void 0;return u.jsxs("div",{className:As.detail,children:[i&&u.jsxs(W5,{title:t("todo.detail.sectionTime"),children:[n!==void 0&&u.jsx(cf,{label:t("todo.detail.start"),value:y0(n)}),s!==void 0&&u.jsx(cf,{label:t("todo.detail.end"),value:y0(s),suffix:n!==void 0?u.jsxs("span",{className:As.detailDuration,children:[" ","(",uh(s-n),")"]}):void 0})]}),o&&u.jsxs(W5,{title:t("todo.detail.sectionTokens"),children:[u.jsx(cf,{label:t("todo.detail.input"),value:((r==null?void 0:r.inputTokens)??0).toLocaleString()}),u.jsx(cf,{label:t("todo.detail.output"),value:((r==null?void 0:r.outputTokens)??0).toLocaleString()}),u.jsx(cf,{label:t("todo.detail.cached"),value:((r==null?void 0:r.cachedTokens)??0).toLocaleString()})]}),a&&u.jsxs(W5,{title:t("todo.detail.sectionSpent"),children:[(r==null?void 0:r.apiTimeMs)!==void 0&&u.jsx(cf,{label:t("todo.detail.api"),value:uh(r.apiTimeMs)}),(r==null?void 0:r.toolTimeMs)!==void 0&&u.jsx(cf,{label:t("todo.detail.tool"),value:uh(r.toolTimeMs)})]}),!r&&u.jsx("div",{className:As.detailHint,children:t("todo.detail.noResources")})]})}function uje(e){return!!e&&(e.endTs!==void 0||e.resources!==void 0)}function AQ({todos:e,numbered:t=!1}){const{t:n}=ot(),s=m.useContext(Cne),[r,i]=m.useState(()=>new Set),o=`${String(e.length).length+1}ch`,a=l=>i(c=>{const d=new Set(c);return d.has(l)?d.delete(l):d.add(l),d});return u.jsx("div",{className:As.list,children:e.map((l,c)=>{const d=l.id||String(c),h=s.get(z9(l)),f=uje(h),p=f&&r.has(d),g=u.jsxs(u.Fragment,{children:[t&&u.jsxs("span",{className:As.num,style:{minWidth:o},children:[c+1,"."]}),u.jsx("span",{className:As.icon,"aria-hidden":"true",children:T2(l.status)}),u.jsx("span",{className:As.text,children:l.content}),f&&u.jsx("span",{className:As.detailChevron,"aria-hidden":"true",children:p?"▾":"▸"})]});return u.jsxs("div",{className:As.item,children:[f?u.jsx("button",{type:"button",className:`${As.row} ${As.rowButton} ${G8(l.status)}`,onClick:y=>{y.stopPropagation(),a(d)},"aria-expanded":p,title:n(p?"todo.detail.hide":"todo.detail.show"),children:g}):u.jsx("div",{className:`${As.row} ${G8(l.status)}`,children:g}),p&&h&&u.jsx(cje,{detail:h})]},d)})})}function dje(e){const t=e.toolName.toLowerCase();if(Gc(e.toolName))return!!Ic(e);if(t==="write_file"||t==="writefile")return!!Aje(e)||lB(e);if(e.status!=="completed"&&e.status!=="failed")return!1;if(Ta(t)){const n=Ic(e);return!!n&&n.trim().length>0&&n.split(`
`).length>1}if(d4(t))return!!NQ(e);if(t==="edit"||t==="write"||t==="editfile")return lB(e);if(t==="read"||t==="read_file"||t==="readfile"){const n=Ic(e);return!!n&&n.split(`
`).length>3}return!1}function hje(e){const t=e.toolName.toLowerCase();return Ta(t)||t==="write_file"||t==="writefile"||t==="edit"||t==="write"||t==="editfile"||t==="read"||t==="read_file"||t==="readfile"||d4(t)||Gc(e.toolName)}function fje(e){var t;return(t=e.content)!=null&&t.some(n=>n.type==="diff")?!0:!!MQ(e)}function lB(e){return fje(e)||!!Ic(e)}function mje(e){const t=MQ(e);if(t)return t;if(e.content){const n=e.content.find(s=>s.type==="diff");if(n&&n.type==="diff")return yje(n.oldText||"",n.newText||"")}return""}function MQ(e){if(e.rawOutput&&typeof e.rawOutput=="object"){const t=e.rawOutput;if(pje(t))return"";if(typeof t.fileDiff=="string")return t.fileDiff}return""}function pje(e){return e.truncatedForSession===!0&&"fileName"in e&&"newContent"in e}const gje=25e4;function yje(e,t){const n=e.split(`
`),s=t.split(`
`),r=n.length,i=s.length;if(r*i>gje){const d=n.map(f=>f?`-${f}`:"-"),h=s.map(f=>f?`+${f}`:"+");return[...d,...h].join(`
`)}const o=Array.from({length:r+1},()=>Array(i+1).fill(0));for(let d=1;d<=r;d++)for(let h=1;h<=i;h++)o[d][h]=n[d-1]===s[h-1]?o[d-1][h-1]+1:Math.max(o[d-1][h],o[d][h-1]);const a=[];let l=r,c=i;for(;l>0||c>0;)l>0&&c>0&&n[l-1]===s[c-1]?(a.push(` ${n[l-1]}`),l--,c--):c>0&&(l===0||o[l][c-1]>=o[l-1][c])?(a.push(`+${s[c-1]}`),c--):(a.push(`-${n[l-1]}`),l--);return a.reverse().join(`
`)}const bje=60,vje=2e5,wje=1e3,xje={cjs:"javascript",cts:"typescript",h:"c",hpp:"cpp",js:"javascript",jsx:"jsx",mjs:"javascript",mts:"typescript",py:"python",rb:"ruby",sh:"bash",ts:"typescript",tsx:"tsx",yml:"yaml"};function kje({tool:e}){const t=m.useMemo(()=>Ic(e)||"",[e]),n=m.useMemo(()=>ARe(t)?ERe(t):null,[t]);return u.jsx("div",{className:Dt.expandedBash,children:u.jsx("pre",{className:Dt.expandedOutput,children:n?n.map((s,r)=>u.jsx("span",{style:{color:s.color,fontWeight:s.bold?"bold":void 0,opacity:s.dim?.6:void 0},children:s.text},r)):t})})}function _je({tool:e}){const t=m.useMemo(()=>Ic(e)||"",[e]),n=Tje(Sje(e)),s=n==="text"||t.length>vje||Cje(t,wje);return u.jsx("div",{className:Dt.expandedRead,children:s?u.jsx("pre",{className:Dt.expandedOutput,children:t}):u.jsx(tg,{content:Eje(n,t)})})}function Sje(e){var n,s;const t=((n=e.args)==null?void 0:n.file_path)??((s=e.args)==null?void 0:s.path);return typeof t=="string"?t:""}function Cje(e,t){let n=1;for(let s=0;s<e.length;s++)if(e.charCodeAt(s)===10&&++n>t)return!0;return!1}function Tje(e){var s,r;const t=(r=(s=e.split(/[?#]/,1)[0])==null?void 0:s.split(".").pop())==null?void 0:r.toLowerCase();if(!t||t===e.toLowerCase()||t==="mermaid"||t==="mmd")return"text";const n=xje[t]??t;return/^[\w+.#-]+$/.test(n)?n:"text"}function Eje(e,t){var r;const n=((r=t.match(/~{3,}/g))==null?void 0:r.reduce((i,o)=>Math.max(i,o.length),0))??0,s="~".repeat(Math.max(3,n+1));return`${s}${e}
${t}
${s}`}function cB({tool:e}){const t=m.useMemo(()=>mje(e),[e]),n=m.useMemo(()=>Ic(e)||"",[e]);return!t&&!n?null:u.jsx("div",{className:Dt.expandedEdit,children:t?u.jsx(TRe,{diff:t}):u.jsx("pre",{className:Dt.expandedOutput,children:n})})}function K8({title:e,detail:t,children:n}){return u.jsxs("div",{className:Dt.expandedCard,children:[u.jsxs("div",{className:Dt.expandedCardHeader,children:[u.jsx("span",{className:Dt.expandedCardTitle,children:e}),t&&u.jsx("span",{className:Dt.expandedCardDetail,children:t})]}),n&&u.jsx("div",{className:Dt.expandedCardBody,children:n})]})}function Aje(e){var n,s;if((n=e.args)!=null&&n.content)return e.args.content;if((s=e.args)!=null&&s.new_string)return e.args.new_string;const t=Ic(e);if(t)return t;if(e.rawOutput&&typeof e.rawOutput=="object"){const r=e.rawOutput;if(typeof r.content=="string")return r.content;if(typeof r.newContent=="string")return r.newContent}return""}function Mje({tool:e,todos:t,expanded:n,title:s}){var o;const i=((o=m.useContext(qM).get(e.callId))==null?void 0:o.events)??[];return n?u.jsx(K8,{title:s,children:u.jsx("div",{className:Dt.todoBody,children:u.jsx(AQ,{todos:t})})}):u.jsx("div",{className:Dt.todoBody,children:u.jsx(EQ,{todos:t,events:i})})}function Nje(e,t){var p,g;const n=Lb(e.rawOutput),s=L9(e),r=Xy(e),i=O9(e),o=Ije(e),a=P9(e),l=((p=e.subTools)==null?void 0:p.length)||((g=n==null?void 0:n.toolCalls)==null?void 0:g.length)||0,c=n==null?void 0:n.executionSummary,d=c&&typeof c.totalDurationMs=="number"?_Q(c.totalDurationMs):Db(e.startTime,e.endTime??(e.status==="in_progress"&&t?t:void 0)),h=n&&typeof n.tokenCount=="number"&&n.tokenCount>0?n.tokenCount:c&&typeof c.outputTokens=="number"&&c.outputTokens>0?c.outputTokens:0,f=h>0?D9(h):"";return{agentType:i,explicitAgentType:o,description:a,subToolCount:l,elapsed:d,tokens:f,status:r,reason:s}}function Ije(e){var r;const t=Lb(e.rawOutput),n=t==null?void 0:t.subagentName;if(typeof n=="string"&&n.trim())return n.trim();const s=(r=e.args)==null?void 0:r.subagent_type;return typeof s=="string"&&s.trim()?s.trim():""}function uB(e){if(e.status==="completed")return!1;const t=e.toolName.toLowerCase();return!!(Gc(e.toolName)||t==="write_file"||t==="writefile"||t==="edit"||t==="editfile"||Ta(t))}function Rje({tool:e}){const t=Ic(e)||"";return u.jsx("pre",{className:Dt.expandedOutput,children:t})}function jje({tool:e}){var n;const t=NQ(e)||(typeof((n=e.args)==null?void 0:n.args)=="string"&&e.args.args.trim()?e.args.args.trim():e.title??"");return u.jsx("pre",{className:Dt.expandedOutput,children:t})}function NQ(e){var n,s;const t=(n=e.content)==null?void 0:n[0];return(t==null?void 0:t.type)!=="content"?"":typeof((s=t.content)==null?void 0:s.text)=="string"?t.content.text:""}function m4(e){const t=e.toolName.toLowerCase();return v_(e)?"agent":Gc(e.toolName)?"ask":Ta(t)?"shell":U9(t)?"fetch":nd(t)?"todo":t==="read"||t==="read_file"||t==="readfile"?"read":t==="edit"||t==="editfile"?"edit":t==="write"||t==="write_file"||t==="writefile"?"write":"other"}function Lje({description:e,elapsed:t}){return u.jsxs(u.Fragment,{children:[e&&u.jsx("span",{className:Dt.lineArg,children:e}),t&&u.jsx("span",{className:Dt.lineElapsed,children:t})]})}function A2({info:e}){const{renderToolHeaderExtra:t}=zc(),n=t==null?void 0:t(e);return n?u.jsx(u.Fragment,{children:n}):u.jsx(Lje,{description:e.description,elapsed:e.elapsed})}function Dje(e){return e.length>bje||e.includes(`
`)}function q9(e){return e==="in_progress"||e==="pending"||e==="running"}function H9(e){return e.find(t=>q9(t.status))??e[e.length-1]}function Oje(e,t,n){if(RQ(e)){const r=H9(e);return t("toolGroup.running",{name:Wc(r.toolName,t),count:e.length,duration:n??""})}const s=$je(e,t);return s||t("toolGroup.summary",{count:e.length})}function Pje(e,t,n){if(nd(e.toolName))return t("toolGroup.summary.updatedTodos",{count:1});if(Gc(e.toolName))return t("toolGroup.summary.askedUser",{count:1});const{displayName:s,description:r,hideDisplayName:i}=IQ(e,t,n);return[i?"":s,r].filter(Boolean).join(" ")}function IQ(e,t,n){const s=Wc(e.toolName,t),r=Ti(mQ(e,n),120);return{kind:m4(e),tool:e,displayName:s,description:r,elapsed:"",workspaceCwd:n,hideDisplayName:!!LAe(e)}}function Bje({tool:e,runningDuration:t,workspaceCwd:n}){const{t:s}=ot(),r=q9(e.status)&&s("toolGroup.runningPrefix").trim();if(nd(e.toolName)||Gc(e.toolName))return u.jsxs(u.Fragment,{children:[r&&u.jsxs("span",{children:[r," "]}),Pje(e,s,n),t&&u.jsxs("span",{children:[" ",t]})]});const i=IQ(e,s,n);return u.jsxs(u.Fragment,{children:[r&&u.jsxs("span",{children:[r," "]}),u.jsxs("span",{className:Dt.chatSummaryInline,children:[!i.hideDisplayName&&u.jsx("span",{className:Dt.lineName,children:i.displayName}),u.jsx(A2,{info:i})]}),t&&u.jsxs("span",{children:[" ",t]})]})}function $je(e,t){let n=0,s=0,r=0,i=0,o=0,a=0,l=0;for(const d of e){const h=d.toolName.toLowerCase();Ta(h)?s++:h==="edit"||h==="editfile"||h==="write"||h==="write_file"||h==="writefile"?n++:h==="read"||h==="read_file"||h==="readfile"?r++:h==="grep"||h==="grep_search"||h==="search"||h==="glob"||h==="web_search"||h==="websearch"?i++:nd(h)?o++:Gc(h)?a++:l++}return[n?t("toolGroup.summary.editedFiles",{count:n}):"",s?t("toolGroup.summary.ranCommands",{count:s}):"",r?t("toolGroup.summary.readFiles",{count:r}):"",i?t("toolGroup.summary.searched",{count:i}):"",o?t("toolGroup.summary.updatedTodos",{count:o}):"",a?t("toolGroup.summary.askedUser"):"",l?t("toolGroup.summary.otherTools",{count:l}):""].filter(Boolean).join(" ")}function RQ(e){return e.some(t=>q9(t.status))}function zje(){return u.jsxs("svg",{className:Dt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[u.jsx("path",{d:"M12 20h9"}),u.jsx("path",{d:"M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"})]})}function jQ(){return u.jsxs("svg",{className:Dt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","data-testid":"chat-summary-tool-icon","aria-hidden":"true",children:[u.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2.4",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("path",{d:"M4.6 5.2 6 6.6 4.6 8",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M7.3 8.1h2.1",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round"})]})}function Fje(){return u.jsxs("svg",{className:Dt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[u.jsx("circle",{cx:"7",cy:"7",r:"5.5",stroke:"currentColor",strokeWidth:"1.25"}),u.jsx("path",{d:"M1.8 7h10.4M7 1.5c1.3 1.5 2 3.3 2 5.5s-.7 4-2 5.5M7 1.5C5.7 3 5 4.8 5 7s.7 4 2 5.5",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round"})]})}function qje(){return u.jsxs("svg",{className:Dt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[u.jsx("rect",{x:"2",y:"1.6",width:"10",height:"10.8",rx:"2.2",stroke:"currentColor",strokeWidth:"1.25"}),u.jsx("path",{d:"M4.5 5.2h5M4.5 7h5M4.5 8.8h5",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round"})]})}function Hje(){return u.jsx("svg",{className:Dt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M3 4.2 4.2 5.4 6.1 3.3M7.5 4.5h3.6M3 9.1l1.2 1.2 1.9-2.1M7.5 9.4h3.6",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})})}function Uje(){return u.jsx("svg",{className:Dt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M3.4 3.2h7.2c.7 0 1.25.55 1.25 1.25v3.4c0 .7-.55 1.25-1.25 1.25H7.5L4.5 11V9.1H3.4c-.7 0-1.25-.55-1.25-1.25v-3.4c0-.7.55-1.25 1.25-1.25Z",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Vje(){return u.jsx("svg",{className:Dt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 1024 1024",fill:"currentColor","aria-hidden":"true",children:u.jsx("path",{d:"M770.08 96.32c1.728.64 3.072 1.984 3.712 3.712l38.848 107.584c.64 1.728 1.984 3.104 3.712 3.712l107.584 38.848a6.144 6.144 0 0 1 0 11.584l-107.584 38.848a6.144 6.144 0 0 0-3.712 3.712l-38.848 107.584a6.144 6.144 0 0 1-11.584 0L723.36 304.32a6.144 6.144 0 0 0-3.712-3.712L612.064 261.76a6.144 6.144 0 0 1 0-11.584l107.584-38.848a6.144 6.144 0 0 0 3.712-3.712l38.848-107.584c1.184-3.2 4.704-4.8 7.872-3.68zM576 160H384q-119.296 0-203.648 84.352Q96 328.704 96 448v192q0 119.296 84.352 203.648Q264.704 928 384 928h256q119.296 0 203.648-84.352Q928 759.296 928 640V512h-64v128q0 92.8-65.6 158.4Q732.8 864 640 864H384q-92.8 0-158.4-65.6Q160 732.8 160 640V448q0-92.8 65.6-158.4Q291.2 224 384 224h192v-64zm96 248.224L568.224 512 672 615.776l45.248-45.28L658.752 512l58.496-58.496L672 408.224zM320 608V448h64v160h-64z",stroke:"currentColor",strokeWidth:"28",strokeLinejoin:"round"})})}function Wje({tool:e}){const t=m4(e);return t==="agent"?u.jsx(Vje,{}):t==="ask"?u.jsx(Uje,{}):t==="edit"||t==="write"?u.jsx(zje,{}):t==="fetch"?u.jsx(Fje,{}):t==="read"?u.jsx(qje,{}):t==="todo"?u.jsx(Hje,{}):u.jsx(jQ,{})}function U9(e){const t=e.toLowerCase();return t==="web_fetch"||t==="webfetch"||t==="fetch"}const Gje=Xy;function Kje({tools:e,workspaceCwd:t,isLocateFlashing:n=!1}){const{t:s}=ot(),r=H9(e),i=Wc(r.toolName,s),o=Gje(r),a=j9(r,t),l=Ta(r.toolName)||U9(r.toolName)?"":Db(r.startTime,r.endTime);return u.jsxs("div",{className:`${Dt.compactGroup}${n?` ${Ah.flash}`:""}`,children:[u.jsxs("div",{className:Dt.compactHeader,children:[u.jsx(rm,{status:o}),u.jsx("span",{className:Dt.lineName,children:i}),e.length>1&&u.jsxs("span",{className:Dt.compactCount,children:["× ",e.length]}),u.jsx(A2,{info:{kind:m4(r),tool:r,displayName:i,description:a,elapsed:l,workspaceCwd:t}})]}),u.jsx("div",{className:Dt.compactHint,children:s("compact.hint")})]})}function Yje(e,t){var r,i;if(((r=e.approval)==null?void 0:r.id)!==((i=t.approval)==null?void 0:i.id)||e.workspaceCwd!==t.workspaceCwd||e.summaryOnly!==t.summaryOnly||e.forceExpanded!==t.forceExpanded||e.forceExpandable!==t.forceExpandable||e.hideHeader!==t.hideHeader||e.hideCollapsedOutput!==t.hideCollapsedOutput)return!1;const n=e.tool,s=t.tool;return n.callId===s.callId&&n.toolName===s.toolName&&n.status===s.status&&n.startTime===s.startTime&&n.endTime===s.endTime&&n.subContent===s.subContent&&n.rawOutput===s.rawOutput&&n.args===s.args&&n.content===s.content&&n.title===s.title&&Xje(n.subTools,s.subTools)}function Xje(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const s=e[n],r=t[n];if(s.callId!==r.callId||s.toolName!==r.toolName||s.status!==r.status||s.endTime!==r.endTime||s.rawOutput!==r.rawOutput||s.args!==r.args||s.subContent!==r.subContent||s.title!==r.title)return!1}return!0}const dB=/\[([^\]]+)\]\(qwen-session:\/\/([^)]+)\)/g;function G5(e){if(!e||!e.includes("qwen-session://"))return e;const t=[];let n=0,s;for(dB.lastIndex=0;(s=dB.exec(e))!==null;){s.index>n&&t.push(e.slice(n,s.index));const r=s[2];t.push(u.jsx("a",{href:"#",role:"button",style:{textDecoration:"underline",cursor:"pointer"},onClick:i=>{i.preventDefault(),i.stopPropagation(),window.dispatchEvent(new CustomEvent("qwen:open-session",{detail:r}))},children:s[1]},s.index)),n=s.index+s[0].length}return n<e.length&&t.push(e.slice(n)),t.length===1?t[0]:u.jsx(u.Fragment,{children:t})}const Y8=m.memo(function({tool:t,approval:n,workspaceCwd:s,summaryOnly:r=!1,forceExpanded:i=!1,forceExpandable:o=!1,hideHeader:a=!1,hideCollapsedOutput:l=!1}){const{t:c}=ot(),d=m.useContext(dm),[h,f]=m.useState(()=>i||!d&&uB(t)),p=m.useRef(!1);m.useEffect(()=>{f(i||(d?!1:uB(t))),p.current=!1},[d,i,t.callId,t.toolName]);const g=v_(t),y=n&&n.toolCallId===t.callId,w=!y&&(n==null?void 0:n.toolCallId)&&g&&Pl(t,n.toolCallId),v=g&&t.status==="in_progress",b=F9(v);if(m.useEffect(()=>{!i&&!g&&t.status==="completed"&&!p.current&&f(!1)},[i,g,t.status]),g){const re=Nje(t,b),Q=re.explicitAgentType?`${c("agent.label")} (${re.explicitAgentType})`:c("agent.label"),K=t.status==="completed"||t.status==="failed",te=[t.status==="pending"?c("subagent.pending"):c("subagent.running"),re.elapsed].filter(Boolean).join(" · "),ce=[re.subToolCount>0?c("subagent.toolsCount",{count:re.subToolCount}):"",re.elapsed,re.tokens,re.reason?Ti(re.reason,80):""].filter(Boolean).join(" · "),oe=i||h||!!y||!!w,de=u.jsx(B9,{tool:t,hideHeader:!0,defaultExpanded:!0,inline:!0});return u.jsxs("div",{className:Dt.line,children:[!a&&u.jsxs("div",{className:`${Dt.lineMain} ${Dt.lineExpandable}`,onClick:()=>f(!h),children:[u.jsx(rm,{status:K?re.status:t.status}),u.jsx("span",{className:Dt.lineName,children:Q}),u.jsx(A2,{info:{kind:"agent",tool:t,displayName:Q,description:re.description?Ti(re.description,60):"",elapsed:K?ce:te,workspaceCwd:s}}),u.jsx("span",{className:h?Dt.lineChevronDown:Dt.lineChevronRight,"aria-hidden":"true"})]}),oe&&u.jsx("div",{className:Dt.lineDetail,children:a?u.jsx("div",{className:Dt.expandedAgentCard,children:de}):de})]})}const x=j9(t,s),k=DAe(t),C=r&&Ta(t.toolName)?mQ(t,s):x,S=Wc(t.toolName,c),_=Ta(t.toolName)||U9(t.toolName)?"":Db(t.startTime,t.endTime),L=t.toolName.toLowerCase(),M=nd(L),I=M?$9(t):void 0,A=!!I&&I.length>0,P=I?I.filter(re=>re.status==="completed").length:0,B=Ta(L),F=L==="grep"||L==="grep_search"||L==="search"||L==="glob",O=L==="read"||L==="read_file"||L==="readfile",X=!M&&Dje(C),z=!i&&(o||(M?A:dje(t)||X)),U=hje(t),D=h&&X,G=O,q=D&&!B&&!F&&!O,N=x,ee=!M&&h&&!U&&(D||k);return u.jsxs("div",{className:Dt.line,children:[!a&&u.jsxs("div",{className:`${Dt.lineMain} ${z?Dt.lineExpandable:""}`,title:z?c(h?"tool.collapseHint":"tool.expand"):void 0,"aria-expanded":z?h:void 0,role:z?"button":void 0,tabIndex:z?0:void 0,onClick:z?()=>{p.current=!0,f(re=>!re)}:void 0,onKeyDown:z?re=>{re.key!=="Enter"&&re.key!==" "||(re.preventDefault(),p.current=!0,f(Q=>!Q))}:void 0,children:[u.jsx(rm,{status:t.status}),u.jsx("span",{className:Dt.lineName,children:S}),M&&A&&u.jsxs("span",{className:Dt.todoProgress,children:[P,"/",I.length]}),u.jsx(A2,{info:{kind:m4(t),tool:t,displayName:S,description:M||q?"":C,elapsed:M?"":_,workspaceCwd:s}}),z&&u.jsx("span",{className:h?Dt.lineChevronDown:Dt.lineChevronRight,"aria-hidden":"true"})]}),(!r||h)&&M&&A&&u.jsx(Mje,{tool:t,todos:I,expanded:h,title:S}),(!r||h)&&M&&!A&&k&&u.jsx("div",{className:Dt.lineOutput,children:G5(k)}),ee&&u.jsx(K8,{title:S,detail:N,children:k&&u.jsx("div",{className:`${Dt.lineOutput} ${Dt.expandedLineOutput}`,children:G5(k)})}),!M&&!l&&k&&!ee&&(!h||!U)&&(!r||h)&&u.jsx("div",{className:h?`${Dt.lineOutput} ${Dt.expandedLineOutput}`:Dt.lineOutput,children:G5(k)}),!M&&h&&U&&u.jsx("div",{className:G?`${Dt.lineDetail} ${Dt.markdownLineDetail}`:Dt.lineDetail,children:O?u.jsx(_je,{tool:t}):u.jsxs(K8,{title:S,detail:N,children:[Ta(L)&&u.jsx(kje,{tool:t}),(L==="write_file"||L==="writefile")&&u.jsx(cB,{tool:t}),(L==="edit"||L==="write"||L==="editfile")&&u.jsx(cB,{tool:t}),Gc(t.toolName)&&u.jsx(Rje,{tool:t}),d4(L)&&u.jsx(jje,{tool:t})]})})]})},Yje),Qje=m.memo(function({tools:t,pendingApproval:n,workspaceCwd:s,isLocateFlashing:r=!1}){const{t:i}=ot(),o=m.useContext(dm),[a,l]=m.useState(!1),c=RQ(t),d=t.length>0?H9(t):void 0,h=t.length===1?t[0]:void 0,f=t[0]??d,p=m.useRef(Date.now()),g=F9(c),y=(n==null?void 0:n.toolCallId)&&t.some(b=>Pl(b,n.toolCallId)),w=o&&!y,v=c?SQ(g-p.current):void 0;return m.useEffect(()=>{c&&(p.current=Date.now())},[c,d==null?void 0:d.callId]),w?u.jsx(Kje,{tools:t,workspaceCwd:s,isLocateFlashing:r}):y?u.jsx("div",{className:`${Dt.group}${r?` ${Ah.flash}`:""}`,children:t.map(b=>u.jsx(Y8,{tool:b,approval:n,workspaceCwd:s},b.callId))}):u.jsxs("div",{className:r?Ah.flash:void 0,children:[u.jsxs("button",{type:"button",className:Dt.chatSummary,onClick:()=>l(b=>!b),"aria-expanded":a,title:i(a?"tool.collapseHint":"tool.expand"),children:[u.jsx("span",{className:Dt.chatSummaryIcon,"aria-hidden":"true",children:f?u.jsx(Wje,{tool:f}):u.jsx(jQ,{})}),u.jsx("span",{className:c?`${Dt.chatSummaryText} ${Dt.chatSummaryTextActive}`:Dt.chatSummaryText,children:h?u.jsx(Bje,{tool:h,runningDuration:c?v:void 0,workspaceCwd:s}):Oje(t,i,v)}),u.jsx("span",{className:a?Dt.chatChevronDown:Dt.chatChevronRight,"aria-hidden":"true"})]}),u.jsx("div",{className:a?Dt.chatSummaryContentClip:`${Dt.chatSummaryContentClip} ${Dt.chatSummaryContentCollapsed}`,children:u.jsx("div",{className:Dt.chatSummaryContentInner,children:u.jsx("div",{className:`${Dt.group} ${Dt.chatSummaryGroup}`,children:t.map(b=>u.jsx(Y8,{tool:b,approval:n,workspaceCwd:s,summaryOnly:!h,forceExpanded:!!h,hideHeader:!!h},b.callId))})})})]})}),Jje="_message_kwepu_1",Zje="_header_kwepu_6",eLe="_chevron_kwepu_20",tLe="_title_kwepu_26",nLe="_progress_kwepu_35",Yg={message:Jje,header:Zje,chevron:eLe,title:tLe,progress:nLe};function sLe({id:e,todos:t}){var r;const s=((r=m.useContext(qM).get(e))==null?void 0:r.events)??[];return u.jsx(EQ,{todos:t,events:s})}const rLe=m.memo(function({id:t,todos:n,isLocateFlashing:s=!1}){const{t:r}=ot(),[i,o]=m.useState(!1);if(n.length===0)return null;const a=n.length,l=n.filter(c=>c.status==="completed").length;return u.jsxs("div",{className:`${Yg.message}${s?` ${Ah.flash}`:""}`,children:[u.jsxs("button",{type:"button",className:Yg.header,onClick:()=>o(c=>!c),"aria-expanded":i,title:r(i?"todo.collapse":"todo.expand"),children:[u.jsx("span",{className:Yg.chevron,"aria-hidden":"true",children:i?"▾":"▸"}),u.jsx("span",{className:Yg.title,children:r("plan.title")}),u.jsxs("span",{className:Yg.progress,children:[l,"/",a]})]}),i?u.jsx(AQ,{todos:n,numbered:!0}):u.jsx(sLe,{id:t,todos:n})]})}),iLe="_message_1abcu_1",oLe="_content_1abcu_11",aLe="_question_1abcu_17",lLe="_prefix_1abcu_24",cLe="_answer_1abcu_28",uLe="_pending_1abcu_32",dLe="_shortcuts_1abcu_36",uf={message:iLe,content:oLe,question:aLe,prefix:lLe,answer:cLe,pending:uLe,shortcuts:dLe},LQ=m.memo(function({question:t,answer:n,isPending:s}){const{t:r}=ot();return u.jsxs("div",{className:uf.message,children:[u.jsxs("div",{className:uf.content,children:[u.jsxs("div",{className:uf.question,children:[u.jsx("span",{className:uf.prefix,children:"/btw "}),u.jsx("span",{children:t})]}),u.jsx("div",{className:uf.answer,children:s?u.jsx("span",{className:uf.pending,children:r("btw.answering")}):u.jsx(tg,{content:n})})]}),u.jsx("div",{className:uf.shortcuts,children:r(s?"btw.shortcuts.pending":"btw.shortcuts.done")})]})}),hLe="_message_1q4dw_1",fLe="_compact_1q4dw_16",mLe="_header_1q4dw_21",pLe="_status_1q4dw_30",gLe="_name_1q4dw_35",yLe="_command_1q4dw_42",bLe="_output_1q4dw_51",vLe="_compactHint_1q4dw_62",au={message:hLe,compact:fLe,header:mLe,status:pLe,name:gLe,command:yLe,output:bLe,compactHint:vLe},wLe=m.memo(function({command:t,output:n}){const s=m.useContext(dm),{t:r}=ot();return u.jsxs("div",{className:s?`${au.message} ${au.compact}`:au.message,children:[u.jsxs("div",{className:au.header,children:[u.jsx("span",{className:au.status,children:"✓"}),u.jsx("span",{className:au.name,children:r("shell.command")}),t&&u.jsx("span",{className:au.command,children:t})]}),s?u.jsx("div",{className:au.compactHint,children:r("compact.hint")}):n&&u.jsx("pre",{className:au.output,children:n})]})}),xLe="_progress_1j3ys_1",kLe="_spinner_1j3ys_12",_Le="_bar_1j3ys_19",SLe="_stage_1j3ys_25",CLe="_icon_1j3ys_29",TLe="_done_1j3ys_35",ELe="_error_1j3ys_43",ALe="_detail_1j3ys_51",MLe="_path_1j3ys_56",Oi={progress:xLe,spinner:kLe,bar:_Le,stage:SLe,icon:CLe,done:TLe,error:ELe,detail:ALe,path:MLe},hB=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧"];function NLe({progress:e}){const{stage:t,progress:n,detail:s,isComplete:r,error:i}=e,[o,a]=m.useState(0),l=30,c=Math.round(n/100*l),d=l-c,h="█".repeat(Math.max(0,c))+"░".repeat(Math.max(0,d));return m.useEffect(()=>{if(r||i)return;const f=setInterval(()=>{a(p=>(p+1)%hB.length)},120);return()=>clearInterval(f)},[r,i]),i?u.jsxs("div",{className:`${Oi.progress} ${Oi.error}`,children:[u.jsx("span",{className:Oi.icon,children:"✕"}),u.jsx("span",{className:Oi.stage,children:t}),u.jsx("div",{className:Oi.detail,children:i})]}):r?u.jsxs("div",{className:`${Oi.progress} ${Oi.done}`,children:[u.jsx("span",{className:Oi.icon,children:"✓"}),u.jsx("span",{className:Oi.stage,children:t})]}):u.jsxs("div",{className:Oi.progress,children:[u.jsx("span",{className:Oi.spinner,children:hB[o]}),u.jsx("span",{className:Oi.bar,children:h}),u.jsxs("span",{className:Oi.stage,children:[t,s?` (${s})`:""]})]})}function ILe({path:e}){const{t}=ot();return u.jsxs("div",{className:`${Oi.progress} ${Oi.done}`,children:[u.jsx("span",{className:Oi.icon,children:"✓"}),u.jsx("span",{className:Oi.stage,children:t("insight.ready")}),u.jsx("span",{className:Oi.path,children:e})]})}const RLe=m.memo(function({message:t,pendingApproval:n,onShowContextDetail:s,workspaceCwd:r,isLatest:i=!1,showRetryHint:o=!1,onRetryClick:a,onBranchSession:l,showAssistantActions:c=!1,showAssistantBranch:d=!1,isLocateFlashing:h=!1,assistantTurnFooterInfo:f}){const{t:p}=ot(),g=(()=>{switch(t.role){case"user":return u.jsx(SEe,{content:t.content,images:t.images,inputAnnotations:t.inputAnnotations,isLocateFlashing:h});case"assistant":return u.jsx(VEe,{content:t.content,isStreaming:t.isStreaming,timestamp:t.timestamp,onBranchSession:l,showFooterActions:c,showBranchAction:d,isLocateFlashing:h,customFooterInfo:f});case"thinking":return u.jsx(YEe,{content:t.content,isStreaming:t.isStreaming,timestamp:t.timestamp,isLocateFlashing:h});case"tool_group":return u.jsx(Qje,{tools:t.tools,pendingApproval:n,workspaceCwd:r,isLocateFlashing:h});case"plan":return u.jsx(rLe,{id:t.id,todos:t.todos,isLocateFlashing:h});case"system":return u.jsx(eIe,{content:t.content,variant:t.variant,source:t.source,data:t.data,onShowContextDetail:s,isLatest:i,showRetryHint:o&&t.retryable===!0,onRetryClick:a});case"user_shell":return u.jsx(wLe,{command:t.command,output:t.output});case"btw":return u.jsx(LQ,{question:t.question,answer:t.answer,isPending:t.isPending});case"insight_progress":return u.jsx(NLe,{progress:{stage:t.stage,progress:t.progress,detail:t.detail}});case"insight_ready":return u.jsx(ILe,{path:t.path});case"insight_error":return u.jsx("div",{style:{color:"var(--error-color, #e06c75)"},children:t.error});default:return null}})();if(g===null)return null;const y=u.jsx(Fu,{label:`message:${t.role}`,resetKeys:[t],fallback:u.jsx(jLe,{align:t.role==="user"?"end":"start"}),children:g}),w=u.jsx("div",{"data-user-selectable":"true",style:{display:"contents"},children:y});return t.role==="assistant"?c?w:u.jsx(J6,{timestamp:t.timestamp,children:w}):t.role==="system"&&t.source==="prompt_cancelled"?w:u.jsx(J6,{timestamp:t.timestamp,chatMode:t.role==="user",copyText:t.role==="user"?t.content:void 0,copyTitle:p("common.copy"),children:w})},LLe);function jLe({align:e}){const{t}=ot();return u.jsx("div",{role:"alert",style:{display:"flex",justifyContent:e==="end"?"flex-end":"flex-start"},children:u.jsx("span",{style:{color:"var(--error-color, #e06c75)",fontSize:"0.85em",opacity:.85},children:t("message.renderError")})})}function LLe(e,t){var n,s;return((n=e.pendingApproval)==null?void 0:n.id)!==((s=t.pendingApproval)==null?void 0:s.id)||e.onShowContextDetail!==t.onShowContextDetail||e.workspaceCwd!==t.workspaceCwd||e.isLatest!==t.isLatest||e.showRetryHint!==t.showRetryHint||e.onRetryClick!==t.onRetryClick||e.onBranchSession!==t.onBranchSession||e.showAssistantActions!==t.showAssistantActions||e.showAssistantBranch!==t.showAssistantBranch||e.isLocateFlashing!==t.isLocateFlashing||!DLe(e.assistantTurnFooterInfo,t.assistantTurnFooterInfo)?!1:OLe(e.message,t.message)}function DLe(e,t){return e===t?!0:!e||!t?!1:e.turnId===t.turnId&&e.message.id===t.message.id&&e.message.content===t.message.content&&e.message.isStreaming===t.message.isStreaming&&e.message.timestamp===t.message.timestamp}function OLe(e,t){if(e===t)return!0;if(e.id!==t.id||e.role!==t.role||e.timestamp!==t.timestamp)return!1;switch(e.role){case"user":return t.role==="user"&&e.content===t.content&&$Le(e.images,t.images);case"assistant":return t.role==="assistant"&&e.content===t.content&&e.isStreaming===t.isStreaming;case"thinking":return t.role==="thinking"&&e.content===t.content&&e.isStreaming===t.isStreaming;case"system":return t.role==="system"&&e.content===t.content&&e.variant===t.variant&&e.retryable===t.retryable&&e.source===t.source&&e.data===t.data;case"user_shell":return t.role==="user_shell"&&e.command===t.command&&e.output===t.output&&e.cwd===t.cwd;case"btw":return t.role==="btw"&&e.question===t.question&&e.answer===t.answer&&e.isPending===t.isPending;case"insight_progress":return t.role==="insight_progress"&&e.stage===t.stage&&e.progress===t.progress&&e.detail===t.detail;case"insight_ready":return t.role==="insight_ready"&&e.path===t.path;case"insight_error":return t.role==="insight_error"&&e.error===t.error;case"plan":return t.role==="plan"&&PLe(e.todos,t.todos);case"tool_group":return t.role==="tool_group"&&e.tools.length===t.tools.length&&e.tools.every((n,s)=>DQ(n,t.tools[s]));default:return!1}}function PLe(e,t){return e.length===t.length&&e.every((n,s)=>{const r=t[s];return r&&n.id===r.id&&n.content===r.content&&n.status===r.status&&n.priority===r.priority})}function DQ(e,t){return t?e.callId===t.callId&&e.toolName===t.toolName&&e.status===t.status&&e.title===t.title&&e.kind===t.kind&&e.startTime===t.startTime&&e.endTime===t.endTime&&e.subContent===t.subContent&&wd(e.args)===wd(t.args)&&wd(e.rawOutput)===wd(t.rawOutput)&&wd(e.locations)===wd(t.locations)&&wd(e.content)===wd(t.content)&&BLe(e.subTools,t.subTools):!1}function BLe(e,t){return!e&&!t?!0:!e||!t||e.length!==t.length?!1:e.every((n,s)=>DQ(n,t[s]))}const fB=new WeakMap;function $Le(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((n,s)=>n.data===t[s].data&&n.mimeType===t[s].mimeType)}function wd(e){if(e===void 0)return"";if(e!==null&&typeof e=="object"){let t=fB.get(e);if(t!==void 0)return t;try{t=JSON.stringify(e)}catch{t=String(e)}return fB.set(e,t),t}try{return JSON.stringify(e)}catch{return String(e)}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function zLe(e){const t=/^(\d{1,2}):(\d{2})$/.exec(e.trim());if(!t)return null;const n=Number(t[1]),s=Number(t[2]);return n<0||n>23||s<0||s>59?null:{hh:n,mm:s}}function M2(e){if(e.frequency==="custom"){const n=e.customCron.trim();return n.length>0?n:null}if(e.frequency==="minutes"){const n=Math.floor(e.minuteInterval);return!Number.isFinite(n)||n<1||n>30||60%n!==0?null:`*/${n} * * * *`}const t=zLe(e.time);if(!t)return null;switch(e.frequency){case"daily":return`${t.mm} ${t.hh} * * *`;case"weekdays":return`${t.mm} ${t.hh} * * 1-5`;case"weekly":return`${t.mm} ${t.hh} * * ${e.weekday}`;case"hourly":return`${t.mm} * * * *`;default:return null}}function Jy(e,t){const n=e.trim().split(/\s+/);if(n.length!==5)return e;const[s,r,i,o,a]=n,l=d=>/^\d+$/.test(d),c=d=>d.padStart(2,"0");if(/^\*\/\d+$/.test(s)&&r==="*"&&i==="*"&&o==="*"&&a==="*"){const d=Number(s.slice(2));return Number.isInteger(d)&&d>=1&&d<=30&&60%d===0?t("scheduledTasks.human.everyMinutes",{n:d}):e}if(l(s)&&r==="*"&&i==="*"&&o==="*"&&a==="*")return t("scheduledTasks.human.hourly",{min:c(s)});if(l(s)&&l(r)&&i==="*"&&o==="*"&&a==="*")return t("scheduledTasks.human.daily",{time:`${c(r)}:${c(s)}`});if(l(s)&&l(r)&&i==="*"&&o==="*"&&a==="1-5")return t("scheduledTasks.human.weekdays",{time:`${c(r)}:${c(s)}`});if(l(s)&&l(r)&&i==="*"&&o==="*"&&l(a)&&Number(a)>=0&&Number(a)<=7){const d=t("scheduledTasks.weekdayNames").split(","),h=Number(a)===7?0:Number(a),f=d[h]??a;return t("scheduledTasks.human.weekly",{day:f,time:`${c(r)}:${c(s)}`})}return e}const hc={frequency:"daily",time:"09:00",weekday:1,minuteInterval:30,customCron:"0 9 * * *"};function Cd(e){const t=e.trim(),n={...hc,frequency:"custom",customCron:t.length>0?t:hc.customCron},s=t.split(/\s+/);if(s.length!==5)return n;const[r,i,o,a,l]=s,c=y=>/^\d+$/.test(y),d=y=>String(y).padStart(2,"0"),h=o==="*"&&a==="*";if(/^\*\/\d+$/.test(r)&&i==="*"&&h&&l==="*"){const y=Number(r.slice(2));return Number.isInteger(y)&&y>=1&&y<=30&&60%y===0?{...hc,frequency:"minutes",minuteInterval:y}:n}if(!c(r))return n;const f=Number(r);if(f>59)return n;if(i==="*"&&h&&l==="*")return{...hc,frequency:"hourly",time:`00:${d(f)}`};if(!c(i))return n;const p=Number(i);if(p>23)return n;const g=`${d(p)}:${d(f)}`;if(h&&l==="*")return{...hc,frequency:"daily",time:g};if(h&&l==="1-5")return{...hc,frequency:"weekdays",time:g};if(h&&c(l)){const y=Number(l);if(y>=0&&y<=7)return{...hc,frequency:"weekly",time:g,weekday:y===7?0:y}}return n}function FLe(e,t){if(e<=0)return t("scheduledTasks.dueNow");const n=Math.floor(e/1e3),s=Math.floor(n/86400),r=Math.floor(n%86400/3600),i=Math.floor(n%3600/60),o=n%60,a=(c,d)=>`${d}${t(`scheduledTasks.dur.${c}`)}`;let l;return s>0?l=r>0?[a("d",s),a("h",r)]:[a("d",s)]:r>0?l=i>0?[a("h",r),a("m",i)]:[a("h",r)]:i>0?l=o>0?[a("m",i),a("s",o)]:[a("m",i)]:l=[a("s",o)],l.join(" ")}function qLe(e,t){const n=e.createdAt-e.createdAt%6e4;if(e.lastFiredAt===null||e.lastFiredAt<=n)return t("scheduledTasks.never");let s;try{s=new Date(e.lastFiredAt).toLocaleString()}catch{return t("scheduledTasks.never")}return t("scheduledTasks.lastFired",{when:s})}function OQ(e){switch(e){case"html":return"HTML";case"pdf":return"PDF";case"notebook":return"Notebook";default:return e||"artifact"}}function PQ(e){return e===void 0?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function HLe(e){return e.workspacePath??e.url??e.managedId??""}function im(e){const t=(e??"").replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,""),n=t.startsWith("/"),s=[];for(const i of t.split("/"))if(!(!i||i===".")){if(i===".."){s.length>0&&s.at(-1)!==".."?s.pop():n||s.push(i);continue}s.push(i)}const r=s.join("/");return n?`/${r}`:r}function X8(e,t){const n=im(e),s=im(t);if(!s)return n;if(n===s)return n.split("/").pop()??n;const r=`${s}/`;return n.startsWith(r)?n.slice(r.length):n}function BQ(e,t,n){const s=X8(e??"",n),r=X8(t??"",n);return!!s&&s===r}const mB="default-src 'none'; base-uri 'none'; style-src 'unsafe-inline'; img-src data: blob:;";function ULe(e){if(typeof DOMParser>"u")return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${mB}"></head><body>${VLe(e)}</body></html>`;const t=new DOMParser().parseFromString(e,"text/html");t.querySelectorAll('noscript, meta[http-equiv="refresh" i], meta[http-equiv="Content-Security-Policy" i]').forEach(s=>s.remove());const n=t.createElement("meta");return n.httpEquiv="Content-Security-Policy",n.content=mB,t.head.prepend(n),`<!doctype html>${t.documentElement.outerHTML}`}function VLe(e){return e.replace(/<noscript\b[^>]*>[\s\S]*?<\/noscript>/gi,"").replace(/<meta\b(?=[^>]*\bhttp-equiv\s*=\s*["']?refresh["']?)[^>]*>/gi,"").replace(/<meta\b(?=[^>]*\bhttp-equiv\s*=\s*["']?Content-Security-Policy["']?)[^>]*>/gi,"")}function N2({additions:e,deletions:t,className:n,additionsClassName:s,deletionsClassName:r}){return e===void 0||t===void 0?null:u.jsxs("span",{className:n,children:[u.jsxs("span",{className:s,children:["+",e]}),u.jsxs("span",{className:r,children:["-",t]})]})}function $Q(e){if(!e.some(t=>t.additions===void 0||t.deletions===void 0))return e.reduce((t,n)=>({additions:t.additions+(n.additions??0),deletions:t.deletions+(n.deletions??0)}),{additions:0,deletions:0})}const WLe="_root_aths8_1",GLe="_card_aths8_7",KLe="_summary_aths8_14",YLe="_icon_aths8_22",XLe="_iconSvg_aths8_33",QLe="_title_aths8_39",JLe="_linkButton_aths8_46",ZLe="_reviewButton_aths8_47",eDe="_showMoreButton_aths8_48",tDe="_actions_aths8_79",nDe="_list_aths8_97",sDe="_fileRow_aths8_104",rDe="_path_aths8_124",iDe="_lineStats_aths8_133",oDe="_additions_aths8_142",aDe="_deletions_aths8_146",lDe="_chevronIcon_aths8_160",cDe="_chevronIconOpen_aths8_168",uDe="_artifactInfo_aths8_172",dDe="_artifactMeta_aths8_178",as={root:WLe,card:GLe,summary:KLe,icon:YLe,iconSvg:XLe,title:QLe,linkButton:JLe,reviewButton:ZLe,showMoreButton:eDe,actions:tDe,list:nDe,fileRow:sDe,path:rDe,lineStats:iDe,additions:oDe,deletions:aDe,chevronIcon:lDe,chevronIconOpen:cDe,artifactInfo:uDe,artifactMeta:dDe},zQ=["file","artifact","scheduled_task"];function hDe({turnId:e,changes:t,artifacts:n,scheduledTasks:s,workspaceCwd:r,onOpenRequest:i,onReviewChanges:o,onOpenArtifact:a,onOpenScheduledTask:l}){const{t:c}=ot(),[d,h]=m.useState(!1);if(t.length===0&&n.length===0&&s.length===0)return null;const f=d?t:t.slice(0,3),p=t.length-3,g=$Q(t),y=b=>{if(i){i({id:"review",kind:"review",title:c("turnOutputs.review"),turnId:e,changes:t,...b?{selectedPath:b}:{}});return}o(t,b)},w=b=>{const x=vDe(b,t,r);if(i){i({id:`artifact:${b.id}`,kind:"artifact",title:b.title??"Artifact",turnId:e,artifactId:b.id,artifact:b,...x!==void 0?{previewContent:x}:{}});return}a(b.id,x)},v=b=>{if(i){i({id:`scheduled-task:${b.toolCallId}`,kind:"scheduled_task",title:c("scheduledTasks.title"),turnId:e,task:b});return}l(b)};return u.jsxs("div",{className:as.root,children:[t.length>0&&u.jsxs("div",{className:as.card,children:[u.jsxs("div",{className:as.summary,children:[u.jsx("span",{className:as.icon,"aria-hidden":"true",children:u.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",focusable:"false",className:as.iconSvg,children:[u.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"1.6"}),u.jsx("path",{d:"M9 9.5h6M12 6.5v6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),u.jsx("path",{d:"M9 16h6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),u.jsxs("div",{children:[u.jsx("div",{className:as.title,children:c("turnOutputs.filesEdited",{count:t.length})}),u.jsx(N2,{additions:g==null?void 0:g.additions,deletions:g==null?void 0:g.deletions,className:as.lineStats,additionsClassName:as.additions,deletionsClassName:as.deletions}),u.jsxs("button",{type:"button",className:as.linkButton,onClick:()=>y(),children:[c("turnOutputs.viewChanges")," ↗"]})]}),u.jsx("div",{className:as.actions,children:u.jsx("button",{type:"button",className:as.reviewButton,onClick:()=>y(),children:c("turnOutputs.review")})})]}),u.jsxs("div",{className:as.list,children:[f.map(b=>u.jsxs("button",{type:"button",className:as.fileRow,onClick:()=>y(b.path),title:b.path,children:[u.jsx("span",{className:as.path,children:V9(b.path,r)}),u.jsx(N2,{additions:b.additions,deletions:b.deletions,className:as.lineStats,additionsClassName:as.additions,deletionsClassName:as.deletions})]},`${b.toolCallId}:${b.path}`)),p>0&&u.jsxs("button",{type:"button",className:as.showMoreButton,onClick:()=>h(b=>!b),children:[u.jsx("span",{children:d?c("turnOutputs.collapseFiles"):c("turnOutputs.showMoreFiles",{count:p})}),u.jsx(yDe,{open:d})]})]})]}),n.map(b=>u.jsx(fDe,{artifact:b,onOpen:()=>w(b)},b.id)),s.map(b=>u.jsx(mDe,{task:b,scheduleLabel:Jy(b.cron,c),onOpen:()=>v(b)},b.toolCallId))]})}function fDe({artifact:e,onOpen:t}){const{t:n}=ot(),s=PQ(e.sizeBytes);return u.jsx("div",{className:as.card,children:u.jsxs("div",{className:as.summary,children:[u.jsx("span",{className:as.icon,"aria-hidden":"true",children:u.jsx(pDe,{})}),u.jsxs("div",{className:as.artifactInfo,children:[u.jsx("div",{className:as.title,children:e.title}),u.jsx("div",{className:as.artifactMeta,children:[OQ(e.kind),s].filter(Boolean).join(" · ")})]}),u.jsx("div",{className:as.actions,children:u.jsx("button",{type:"button",className:as.reviewButton,onClick:t,title:e.title,children:n("common.open")})})]})})}function mDe({task:e,scheduleLabel:t,onOpen:n}){const{t:s}=ot();return u.jsx("div",{className:as.card,children:u.jsxs("div",{className:as.summary,children:[u.jsx("span",{className:as.icon,"aria-hidden":"true",children:u.jsx(gDe,{})}),u.jsxs("div",{className:as.artifactInfo,children:[u.jsx("div",{className:as.title,children:e.title}),u.jsx("div",{className:as.artifactMeta,children:[t,e.recurring?s("scheduledTasks.repeats"):s("scheduledTasks.runsOnce")].filter(Boolean).join(" · ")})]}),u.jsx("div",{className:as.actions,children:u.jsx("button",{type:"button",className:as.reviewButton,onClick:n,title:e.title,children:s("common.open")})})]})})}function pDe(){return u.jsxs("svg",{className:as.iconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[u.jsx("rect",{x:"6",y:"4",width:"12",height:"16",rx:"2",stroke:"currentColor",strokeWidth:"1.8"}),u.jsx("path",{d:"M9 10h6M9 14h4",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})]})}function gDe(){return u.jsxs("svg",{className:as.iconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[u.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3",stroke:"currentColor",strokeWidth:"1.8"}),u.jsx("path",{d:"M12 8v4l3 2",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function yDe({open:e}){return u.jsx("svg",{className:[as.chevronIcon,e?as.chevronIconOpen:""].filter(Boolean).join(" "),viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:u.jsx("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}const bDe=m.memo(hDe);function vDe(e,t,n){if(e.kind!=="html"||!e.workspacePath)return;const s=t.find(r=>BQ(r.path,e.workspacePath,n));if(s)for(let r=s.diffs.length-1;r>=0;r--){const i=s.diffs[r];if(i!=null&&i.fullContent)return i.newText}}function V9(e,t){return X8(e,t)}const wDe="_wrap_bymxa_1",xDe="_summary_bymxa_5",kDe="_summaryTextActive_bymxa_27",_De="_summaryIcon_bymxa_33",SDe="_summaryStatus_bymxa_47",CDe="_summaryToolIcon_bymxa_54",TDe="_summaryText_bymxa_27",EDe="_summaryDot_bymxa_96",ADe="_chevronRight_bymxa_100",MDe="_chevronDown_bymxa_101",NDe="_group_bymxa_161",IDe="_list_bymxa_193",RDe="_row_bymxa_199",jDe="_rowStats_bymxa_213",LDe="_rowDesc_bymxa_221",DDe="_rowTool_bymxa_231",ODe="_detail_bymxa_235",PDe="_track_bymxa_241",BDe="_bar_bymxa_249",$De="_barRunning_bymxa_257",zDe="_ruler_bymxa_296",FDe="_tick_bymxa_303",Tr={wrap:wDe,summary:xDe,summaryTextActive:kDe,summaryIcon:_De,summaryStatus:SDe,summaryToolIcon:CDe,summaryText:TDe,summaryDot:EDe,chevronRight:ADe,chevronDown:MDe,group:NDe,list:IDe,row:RDe,rowStats:jDe,rowDesc:LDe,rowTool:DDe,detail:ODe,track:PDe,bar:BDe,barRunning:$De,ruler:zDe,tick:FDe};function FQ(e){const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60),s=t%60;return s>0?`${n}m ${s}s`:`${n}m`}function qDe(e,t){if(e.length<2)return null;const n=[];for(const h of e){if(typeof h.startTime!="number")return null;n.push(h.startTime)}const s=e.map((h,f)=>h.status==="in_progress"?Math.max(t,n[f]):Math.max(h.endTime??n[f],n[f])),r=Math.min(...n),i=Math.max(...s)-r;if(i<1e3)return null;const o=new Map;e.forEach((h,f)=>{const p=Math.max((s[f]-n[f])/i,.02),g=Math.min((n[f]-r)/i,1-p);o.set(h.callId,{leftPct:g*100,widthPct:p*100,running:h.status==="in_progress"})});const a=Math.max(i/1e3/2.2,1),l=Math.pow(10,Math.floor(Math.log10(a))),c=[5,2,1].map(h=>h*l).find(h=>h<=a)??l,d=[];for(let h=0;d.length<4;h++){const f=h*c*1e3;if(f>i*.92)break;d.push({leftPct:f/i*100,label:FQ(f)})}return{rows:o,ticks:d}}function HDe(e,t){const n=[],s=Lb(e.rawOutput),r=s==null?void 0:s.executionSummary,i=r&&typeof r.totalDurationMs=="number"?FQ(r.totalDurationMs):Db(e.startTime,e.endTime??(e.status==="in_progress"?t:void 0));i&&n.push(i);const o=s&&typeof s.tokenCount=="number"&&s.tokenCount>0?s.tokenCount:r&&typeof r.outputTokens=="number"&&r.outputTokens>0?r.outputTokens:0;o>0&&n.push(D9(o));const a=L9(e);return a&&n.push(Ti(a,80)),n.join(" · ")}function UDe(){return u.jsx("svg",{className:Tr.summaryToolIcon,width:"14",height:"14",viewBox:"0 0 1024 1024",fill:"currentColor","aria-hidden":"true",children:u.jsx("path",{d:"M770.08 96.32c1.728.64 3.072 1.984 3.712 3.712l38.848 107.584c.64 1.728 1.984 3.104 3.712 3.712l107.584 38.848a6.144 6.144 0 0 1 0 11.584l-107.584 38.848a6.144 6.144 0 0 0-3.712 3.712l-38.848 107.584a6.144 6.144 0 0 1-11.584 0L723.36 304.32a6.144 6.144 0 0 0-3.712-3.712L612.064 261.76a6.144 6.144 0 0 1 0-11.584l107.584-38.848a6.144 6.144 0 0 0 3.712-3.712l38.848-107.584c1.184-3.2 4.704-4.8 7.872-3.68zM576 160H384q-119.296 0-203.648 84.352Q96 328.704 96 448v192q0 119.296 84.352 203.648Q264.704 928 384 928h256q119.296 0 203.648-84.352Q928 759.296 928 640V512h-64v128q0 92.8-65.6 158.4Q732.8 864 640 864H384q-92.8 0-158.4-65.6Q160 732.8 160 640V448q0-92.8 65.6-158.4Q291.2 224 384 224h192v-64zm96 248.224L568.224 512 672 615.776l45.248-45.28L658.752 512l58.496-58.496L672 408.224zM320 608V448h64v160h-64z",stroke:"currentColor",strokeWidth:"28",strokeLinejoin:"round"})})}function VDe({agents:e,pendingApproval:t}){const{t:n}=ot(),[s,r]=m.useState(!1),[i,o]=m.useState(null),[a,l]=m.useState(()=>Date.now()),c=m.useRef(Date.now()),d=e.some(b=>b.status==="in_progress");m.useEffect(()=>{d&&(c.current=Date.now(),l(Date.now()))},[d]),m.useEffect(()=>{if(!d)return;const b=setInterval(()=>l(Date.now()),1e3);return()=>clearInterval(b)},[d]);const h=d?SQ(a-c.current):"",f=e.filter(b=>b.status==="completed"||b.status==="failed").length,p=e.length,g=t!=null&&t.toolCallId?e.find(b=>Pl(b,t.toolCallId)):void 0,y=s||!!g,w=y?qDe(e,a):null,v=e.some(b=>Xy(b)==="failed")?"failed":d?"in_progress":"completed";return u.jsxs("div",{className:Tr.wrap,children:[u.jsxs("button",{type:"button",className:Tr.summary,onClick:()=>r(b=>!b),"aria-expanded":y,title:n(y?"tool.collapseHint":"tool.expand"),children:[v==="failed"?u.jsx("span",{className:Tr.summaryStatus,children:u.jsx(rm,{status:v})}):u.jsx("span",{className:Tr.summaryIcon,"aria-hidden":"true",children:u.jsx(UDe,{})}),u.jsxs("span",{className:d?`${Tr.summaryText} ${Tr.summaryTextActive}`:Tr.summaryText,children:[n("parallelAgents.title"),h&&u.jsxs(u.Fragment,{children:[" ",h]}),u.jsx("span",{className:Tr.summaryDot,children:"·"}),n("parallelAgents.done",{done:f,total:p})]}),u.jsx("span",{className:y?Tr.chevronDown:Tr.chevronRight,"aria-hidden":"true"})]}),y&&u.jsxs("div",{className:Tr.group,children:[u.jsx("div",{className:Tr.list,children:e.map(b=>{const x=O9(b),k=P9(b),T=$Ae(b,n),C=HDe(b,a),S=Xy(b),_=i===b.callId,L=w==null?void 0:w.rows.get(b.callId);return u.jsxs("div",{children:[u.jsxs("div",{className:Tr.row,onClick:()=>o(_?null:b.callId),children:[u.jsx(rm,{status:S}),u.jsxs("span",{className:Tr.rowDesc,children:[Ti(k||x,50),T&&u.jsx("span",{className:Tr.rowTool,children:` (${T})`})]}),C&&u.jsx("span",{className:Tr.rowStats,children:C})]}),L&&u.jsx("div",{className:Tr.track,"aria-hidden":"true",children:u.jsx("span",{className:L.running?`${Tr.bar} ${Tr.barRunning}`:Tr.bar,style:{left:`${L.leftPct}%`,width:`${L.widthPct}%`}})}),_&&u.jsx("div",{className:Tr.detail,children:u.jsx(B9,{tool:b,hideHeader:!0})})]},b.callId)})}),w&&w.ticks.length>=2&&u.jsx("div",{className:Tr.ruler,"aria-hidden":"true",children:w.ticks.map(b=>u.jsx("span",{className:Tr.tick,style:{left:`${b.leftPct}%`},children:b.label},b.label))})]})]})}const WDe="_collapseRow_d7f01_1",GDe="_collapseRowClickable_d7f01_14",KDe="_collapseLabel_d7f01_19",YDe="_processedLabel_d7f01_36",XDe="_processedMeta_d7f01_43",QDe="_hiddenMetrics_d7f01_47",JDe="_summaryMetrics_d7f01_51",ZDe="_collapseIcon_d7f01_59",eOe="_chevronRight_d7f01_72",tOe="_chevronDown_d7f01_73",Ml={collapseRow:WDe,collapseRowClickable:GDe,collapseLabel:KDe,processedLabel:YDe,processedMeta:XDe,hiddenMetrics:QDe,summaryMetrics:JDe,collapseIcon:ZDe,chevronRight:eOe,chevronDown:tOe},nOe="_list_15syv_1",sOe="_listWithWelcomeHeader_15syv_12",rOe="_virtualSizer_15syv_42",iOe="_virtualRow_15syv_51",oOe="_loadingSkeleton_15syv_61",aOe="_srOnly_15syv_69",lOe="_loadingSkeletonUserRow_15syv_81",cOe="_loadingSkeletonAssistantRow_15syv_87",uOe="_loadingSkeletonUserBubble_15syv_93",dOe="_loadingSkeletonUserBubbleCompact_15syv_94",hOe="_loadingSkeletonAssistantBlock_15syv_108",fOe="_loadingSkeletonLineWide_15syv_116",mOe="_loadingSkeletonLineMedium_15syv_117",pOe="_loadingSkeletonLineShort_15syv_118",gOe="_loadingSkeletonLineNarrow_15syv_119",yOe="_turnStatusRow_15syv_159",bOe="_turnAnswerRow_15syv_160",vOe="_turnContentRow_15syv_171",wOe="_turnContentClip_15syv_175",xOe="_turnContentCollapsed_15syv_183",kOe="_turnContentInner_15syv_187",_Oe="_sessionTimelineLayer_15syv_192",SOe="_sessionTimelinePanel_15syv_205",COe="_sessionTimelineViewport_15syv_216",TOe="_sessionTimelineList_15syv_257",EOe="_sessionTimelineItem_15syv_267",AOe="_sessionTimelineButton_15syv_272",MOe="_sessionTimelineTick_15syv_291",NOe="_sessionTimelineButtonInRange_15syv_378",IOe="_sessionTimelineButtonCurrent_15syv_382",ROe="_sessionTimelineDetails_15syv_393",jOe="_sessionTimelineDetailsTitle_15syv_427",LOe="_sessionTimelineDetailsIcon_15syv_434",DOe="_sessionTimelineDetailsTitleText_15syv_446",OOe="_sessionTimelineDetailsDetail_15syv_456",Hn={list:nOe,listWithWelcomeHeader:sOe,virtualSizer:rOe,virtualRow:iOe,loadingSkeleton:oOe,srOnly:aOe,loadingSkeletonUserRow:lOe,loadingSkeletonAssistantRow:cOe,loadingSkeletonUserBubble:uOe,loadingSkeletonUserBubbleCompact:dOe,loadingSkeletonAssistantBlock:hOe,loadingSkeletonLineWide:fOe,loadingSkeletonLineMedium:mOe,loadingSkeletonLineShort:pOe,loadingSkeletonLineNarrow:gOe,turnStatusRow:yOe,turnAnswerRow:bOe,turnContentRow:vOe,turnContentClip:wOe,turnContentCollapsed:xOe,turnContentInner:kOe,sessionTimelineLayer:_Oe,sessionTimelinePanel:SOe,sessionTimelineViewport:COe,sessionTimelineList:TOe,sessionTimelineItem:EOe,sessionTimelineButton:AOe,sessionTimelineTick:MOe,sessionTimelineButtonInRange:NOe,sessionTimelineButtonCurrent:IOe,sessionTimelineDetails:ROe,sessionTimelineDetailsTitle:jOe,sessionTimelineDetailsIcon:LOe,sessionTimelineDetailsTitleText:DOe,sessionTimelineDetailsDetail:OOe},K5=()=>{};function POe(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if((n==null?void 0:n.role)==="user")return n.id}return null}function BOe(e){return e[e.length-1]}function $Oe(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&Sm(n))return n.id}return null}function pB(e){return e.role==="tool_group"&&e.tools.length===1&&v_(e.tools[0])}function Y5(e){return e.role==="tool_group"&&e.tools.length===1&&EU(e.tools[0])}function gB(e){return e.role==="thinking"}function yB(e,t){return e.role!=="tool_group"?!1:!!(t!=null&&t.toolCallId&&e.tools.some(n=>Pl(n,t.toolCallId)))}function bB(e){return e.role==="thinking"}function zOe(e,t){const n=[];let s=0;for(;s<e.length;){const r=e[s];if(r.role!=="tool_group"||yB(r,t)){bB(r)||n.push(r),s++;continue}const i=[r];let o=s,a=s+1;for(;a<e.length;){const c=e[a];if(bB(c)){a++;continue}if(c.role==="tool_group"&&!yB(c,t)){i.push(c),o=a,a++;continue}break}if(i.length===1){n.push(r),s++;continue}const l=i.flatMap(c=>c.role==="tool_group"?c.tools:[]);n.push({id:i[0].id,role:"tool_group",tools:l}),s=o+1}return n}function qQ(e){const t=[];let n=0;for(;n<e.length;){if(Y5(e[n])){const s=[];let r=n;for(;r<e.length;){const i=e[r];if(Y5(i)){s.push(i),r++;continue}if(gB(i)){let o=r+1;for(;o<e.length&&gB(e[o]);)o++;if(o<e.length&&Y5(e[o])){r=o;continue}}break}if(s.length>=2){t.push({type:"parallel_agents",key:`par-${s[0].id}`,turnId:s[0].id,agents:s.map(i=>i.tools[0]),timestamp:s[0].timestamp}),n=r;continue}}if(pB(e[n])){const s=n;for(;n<e.length&&pB(e[n]);)n++;if(n-s>=2){const r=e.slice(s,n);t.push({type:"parallel_agents",key:`par-${r[0].id}`,turnId:r[0].id,agents:r.map(i=>i.tools[0]),timestamp:r[0].timestamp})}else t.push({type:"message",key:e[s].id,message:e[s]})}else t.push({type:"message",key:e[n].id,message:e[n]}),n++}return t}function vB(e){if(e.type==="parallel_agents")return`group:${e.key}`;if(e.type==="turn_outputs")return`outputs:${e.key}`;if(e.type==="turn_collapse"){const t=e.turnCollapse.liveStartedAt;return t===void 0?`tc:${e.key}`:`tc:${e.key}:${t}`}return e.type==="turn_content"?`turn-content:${e.key}`:`msg:${e.key}`}function FOe(e,t,n,s,r){if((!n||n.size===0)&&(!s||s.size===0)&&(!r||r.size===0))return e;const i=[];let o=null;const a=(l,c)=>{if(c&&t||!l)return;const d=(n==null?void 0:n.get(l))??[],h=(s==null?void 0:s.get(l))??[],f=(r==null?void 0:r.get(l))??[];d.length===0&&h.length===0&&f.length===0||i.push({type:"turn_outputs",key:l,turnId:l,changes:d,artifacts:h,scheduledTasks:f})};for(const l of e)l.type==="message"&&Sm(l.message)?(a(o,!1),o=l.message.id):!o&&l.type==="message"?o=l.message.id:!o&&l.type==="parallel_agents"&&(o=l.turnId),i.push(l);return a(o,!0),i}function qOe(e){return e.type==="message"&&e.message.role==="assistant"&&!!e.message.content&&e.message.content.trim().length>0}function W9(e,t,n){let s=t;for(let r=n;r>t;r--)if(HQ(e[r])){s=r;break}for(let r=n;r>s;r--)if(qOe(e[r]))return r;return-1}function HOe(e,t){const n=[];for(let r=0;r<e.length;r++){const i=e[r];i.type==="message"&&Sm(i.message)&&n.push(r)}const s=new Map;for(let r=0;r<n.length;r++){if(r===n.length-1&&t)continue;const i=n[r],o=(r+1<n.length?n[r+1]:e.length)-1,a=e[i],l=W9(e,i,o);if(l<0)continue;const c=e[l];(a==null?void 0:a.type)==="message"&&c.type==="message"&&c.message.role==="assistant"&&s.set(c.message.id,a.message.id)}return s}function Q8(e,t){if(e.type==="parallel_agents")return!0;if(e.type==="turn_outputs"||e.type==="turn_collapse")return!1;if(e.type==="turn_content")return e.items.some(n=>Q8(n,t));switch(e.message.role){case"tool_group":case"plan":return!0;case"assistant":return!t;case"thinking":return!0;case"system":return G9(e.message);case"user":case"user_shell":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return!1;default:return e.message,!1}}function G9(e){var t;return e.source==="mid_turn_message_injected"||((t=e.content)==null?void 0:t.startsWith("mid_turn_message_injected (unrecognized daemon event):"))===!0}function UOe(e,t){if(e.type==="parallel_agents")return{kind:"agents",timestamp:e.timestamp,label:t?t("timeline.parallelAgents"):"Parallel agents"};if(e.type==="turn_outputs")return{kind:"none"};if(e.type!=="message")return{kind:"none"};const{message:n}=e;switch(n.role){case"thinking":return{kind:"thought",timestamp:n.timestamp,label:t?t("timeline.thinking"):"Thinking"};case"assistant":return e.turnCollapse?{kind:"none",timestamp:n.timestamp}:om(n.content,1)?{kind:"commentary",timestamp:n.timestamp,label:t?t("timeline.assistantUpdate"):"Assistant update"}:{kind:"none",timestamp:n.timestamp};case"tool_group":{const s=n.tools.length;return{kind:"tool",timestamp:n.timestamp,label:t?t("timeline.toolCalls",{count:s}):`${s} tool call${s===1?"":"s"}`}}case"plan":return{kind:"plan",timestamp:n.timestamp,label:t?t("timeline.planUpdate"):"Plan update"};case"system":return G9(n)?{kind:"status",timestamp:n.timestamp,label:t?t("timeline.statusUpdate"):"Status update"}:{kind:"none",timestamp:n.timestamp};case"user":case"user_shell":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return{kind:"none",timestamp:n.timestamp};default:return{kind:"none"}}}function om(e,t,n={}){const r=(n.stripMarkdown===!0?VOe(e):e??"").replace(/\s+/g," ").trim();if(t<=0||!r)return"";const i=Array.from(r);return i.length>t?`${i.slice(0,t-1).join("")}…`:r}function VOe(e){if(!e)return"";const t=[],n=r=>{const i=`\0${t.length}\0`;return t.push(r),i};let s=e.replace(/```[^\n`]*\n?([\s\S]*?)```/g,(r,i)=>n(i)).replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/`([^`\n]+)`/g,(r,i)=>n(i)).replace(/^\s{0,3}#{1,6}\s+/gm,"").replace(/^\s{0,3}>\s?/gm,"").replace(/^\s*[-*+]\s+/gm,"");s=X5(s,"~~"),s=X5(s,"**"),s=X5(s,"__"),s=s.replace(/\*([^*\s][^*]*?\S)\*/g,"$1").replace(/(^|[^\p{L}\p{N}_])_([^_\s][^_]*?\S)_(?=$|[^\p{L}\p{N}_])/gu,"$1$2");for(const[r,i]of t.entries())s=s.split(`\0${r}\0`).join(i);return s}function X5(e,t){let n="",s=0;for(;s<e.length;){const r=e.indexOf(t,s);if(r===-1)return n+e.slice(s);const i=r+t.length,o=e.indexOf(t,i);if(o===-1)return n+e.slice(s);const a=e.slice(i,o);n+=a.trim().length===0?e.slice(s,o+t.length):e.slice(s,r)+a,s=o+t.length}return n}function WOe(e,t){const n=e.role==="user"?e.content:e.role==="user_shell"?e.command:"",s=om(n,32);return s||(t?t("timeline.userTurn"):"User turn")}function GOe(e){return e.role==="user"&&(e.source==="cron"||e.source==="loop")}function Sm(e){return e.role==="user"||e.role==="user_shell"}function KOe(e,t){switch(e.role){case"thinking":return t?t("timeline.kind.thought"):"thinking";case"assistant":return om(e.content,120,{stripMarkdown:!0});case"tool_group":{const n=e.tools.length;return t?t("timeline.toolCalls",{count:n}):`${n} tool call${n===1?"":"s"}`}case"plan":return t?t("timeline.planDetail"):"plan update";case"system":return G9(e)?om(e.content,120,{stripMarkdown:!0}):"";case"user":case"user_shell":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return"";default:return""}}function YOe(e,t){if(e.type==="parallel_agents"){const n=e.agents.length;return t?t("timeline.parallelAgentsDetail",{count:n}):`${n} parallel agent${n===1?"":"s"}`}return e.type==="turn_outputs"||e.type!=="message"?"":KOe(e.message,t)}function XOe(e,t){return t?t(`timeline.kind.${e}`):xPe[e]}function QOe(e,t,n,s){if(t!==null)for(const o of e){if(o.type!=="message")continue;const{message:a}=o;if(a.id!==t||a.role!=="assistant")continue;const l=om(a.content,180,{stripMarkdown:!0});if(l)return l}const r=[];for(let o=0;o<e.length;o+=1){const a=e[o];if(a.type==="message"&&t!==null&&a.message.id===t)continue;const l=YOe(a,s);l&&r.push(l)}const i=om(r.join(" · "),180);return i||(n.length>0?n.map(o=>XOe(o,s)).join(" · "):s?s("timeline.noActivity"):"No activity")}function JOe(e,t){const n=[];let s=null,r=[];const i=()=>{if(!s)return;const o=qQ(r),a=W9(o,-1,o.length-1),l=a>=0?o[a]:null,c=(l==null?void 0:l.type)==="message"&&l.message.role==="assistant"&&!l.message.isStreaming&&om(l.message.content,1,{stripMarkdown:!0}).length>0?l.message.id:null,d=[];for(const h of o){if(h.type==="message"&&c!==null&&h.message.id===c)continue;const f=UOe(h,t);f.kind!=="none"&&!d.includes(f.kind)&&d.push(f.kind)}n.push({id:s.id,label:WOe(s,t),detail:QOe(o,c,d,t),timestamp:s.timestamp,nodeKinds:d,...GOe(s)?{isScheduledTask:!0}:{}})};for(const o of e){if(Sm(o)){i(),s=o,r=[];continue}s&&r.push(o)}return i(),n}function ZOe(){return u.jsxs("svg",{className:Hn.sessionTimelineDetailsIcon,viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[u.jsx("circle",{cx:"8",cy:"8",r:"6.25"}),u.jsx("path",{d:"M8 4.5v4l-2.5 2"})]})}function ePe(e){var n,s,r;const t=e.rawOutput&&typeof e.rawOutput=="object"?e.rawOutput:void 0;return[e.callId,e.toolName,e.kind??"",e.status,e.parentToolCallId??"",e.subContent?"sub-content":"",((n=e.subTools)==null?void 0:n.length)??0,String(((s=e.args)==null?void 0:s.subagent_type)??""),((r=e.args)==null?void 0:r.run_in_background)===!0?"background":"",String((t==null?void 0:t.type)??""),String((t==null?void 0:t.status)??"")].join(":")}function tPe(e){return e.map(t=>{const n=`${t.id}:${t.role}:${t.timestamp??""}`;switch(t.role){case"assistant":case"thinking":return`${n}:${t.isStreaming?"streaming":t.content}`;case"tool_group":return`${n}:${t.tools.map(ePe).join(",")}`;case"system":return`${n}:${t.variant}:${t.source??""}:${t.content}`;case"user":return`${n}:${t.content}`;case"user_shell":return`${n}:${t.command}`;case"plan":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return n;default:return n}}).join("|")}function HQ(e){return e.type==="parallel_agents"?!0:e.type==="turn_outputs"||e.type==="turn_collapse"?!1:e.type==="turn_content"?e.items.some(HQ):e.message.role==="tool_group"||e.message.role==="plan"}function wB(e){return e==="pending"||e==="running"||e==="in_progress"}function UQ(e){if(e.type==="turn_content"){for(let n=e.items.length-1;n>=0;n--){const s=UQ(e.items[n]);if(s)return s}return null}if(e.type==="turn_outputs")return null;if(e.type==="turn_collapse")return e.turnCollapse.liveStartedAt===void 0||e.turnCollapse.toolCallCount===void 0||e.turnCollapse.toolCallCount<=0?null:`turn:${e.turnCollapse.turnId}:${e.turnCollapse.toolCallCount}`;if(e.type==="parallel_agents"){const n=e.agents.filter(s=>wB(s.status));return n.length===0?null:`agents:${e.key}:${n.map(s=>s.callId).join(",")}`}if(e.message.role!=="tool_group")return null;const t=e.message.tools.filter(n=>wB(n.status));return t.length===0?null:`tools:${e.message.id}:${t.map(n=>n.callId).join(",")}`}function nPe(e){for(let t=e.length-1;t>=0;t--){const n=UQ(e[t]);if(n)return n}return null}function sPe(e){if(!(e.type!=="message"||e.message.role!=="system"))return e.message.source==="prompt_cancelled"||e.message.source==="turn_error"?e.message.timestamp:void 0}function rPe(e){return e.type==="message"&&e.message.role==="system"&&e.message.source==="turn_error"}function iPe(e){var t;if(!(e.type!=="message"||e.message.role!=="assistant"))return(t=e.message.content)!=null&&t.trim()?e.message.timestamp:void 0}function oPe(e){return e.type==="message"&&e.message.role==="assistant"?e.message.usage:void 0}function VQ(e){return e.type==="parallel_agents"?e.agents.length:e.type==="turn_outputs"||e.type==="turn_collapse"?0:e.type==="turn_content"?e.items.reduce((t,n)=>t+VQ(n),0):e.message.role==="tool_group"?e.message.tools.length:0}function WQ(e,t){for(let n=Math.min(t,e.length-1);n>=0;n--){const s=e[n];if(s.type==="message"&&Sm(s.message))return s.message.id}return null}function GQ(e){const t=[];let n=null;for(const s of e)s.type==="message"&&Sm(s.message)&&(n=s.message.id),t.push(n);return t}function xB(e,t,n,s){const r=s===void 0?WQ(e,t):s[t]??null;return r?n.get(r)??null:null}function aPe(e,t,n,s,r=GQ(e)){let i=Number.POSITIVE_INFINITY,o=-1;for(const l of t){if(l<0||l>=e.length)continue;const c=xB(e,l,n,r);c!==null&&(i=Math.min(i,c),o=Math.max(o,c))}if(o<0)return null;const a=s==null?null:xB(e,s,n,r);return{startIndex:i,endIndex:o,currentIndex:a!==null&&a>=i&&a<=o?a:o}}function lPe(e,t,n,s){if(!s)return!1;for(let r=t;r<=n;r++){const i=e[r];if(i.type==="parallel_agents"){if(i.agents.some(o=>Pl(o,s)))return!0}else if(i.type==="message"&&i.message.role==="tool_group"&&i.message.tools.some(o=>Pl(o,s)))return!0}return!1}function cPe(e,{overrides:t,isResponding:n,activeTurnStartedAt:s,pendingApprovalCallId:r,enabled:i}){if(!i||e.length===0)return e;const o=[];for(let l=0;l<e.length;l++){const c=e[l];c.type==="message"&&Sm(c.message)&&o.push(l)}if(o.length===0)return e;const a=[];for(let l=0;l<o[0];l++)a.push(e[l]);for(let l=0;l<o.length;l++){const c=o[l],d=(l+1<o.length?o[l+1]:e.length)-1,h=e[c],f=h.message.id,p=h.message.timestamp,g=l===o.length-1&&n,y=lPe(e,c,d,r),w=W9(e,c,d);let v=0,b,x,k=0,T=0,C=0,S=0,_=0,L=!1,M=!1;for(let N=c+1;N<=d;N++){const ee=e[N];Q8(ee,N===w)&&v++,rPe(ee)&&(M=!0),S+=VQ(ee),ee.type==="message"&&ee.message.role==="thinking"&&_++;const Q=sPe(ee);Q!==void 0&&(b=b===void 0?Q:Math.max(b,Q));const K=iPe(ee);K!==void 0&&(x=x===void 0?K:Math.max(x,K));const se=oPe(ee);se&&(k+=se.inputTokens,T+=se.outputTokens,C+=se.cachedTokens??0,L=!0)}const I=g?s??p??Date.now():void 0,A=b??x,P=p!==void 0&&A!==void 0&&A>=p?A-p:void 0;if(y||v===0&&!(L||P!==void 0||I!==void 0)){for(let N=c;N<=d;N++)a.push(e[N]);continue}const F=g||M||w<0,X=!(v===0?!0:t.has(f)?t.get(f):F);let z=0;const U=N=>{N.length!==0&&a.push({type:"turn_content",key:`${f}-content-${z++}`,turnId:f,collapsed:X,items:N})};a.push({type:"message",key:h.key,message:h.message});const D={turnId:f,collapsed:X,hiddenCount:v,...P!==void 0?{elapsedMs:P}:{},...L?{inputTokens:k,outputTokens:T}:{},...C>0?{cachedTokens:C}:{},...S>0?{toolCallCount:S}:{},..._>0?{thinkingCount:_}:{},...I!==void 0?{liveStartedAt:I}:{}};if(a.push({type:"turn_collapse",key:`tc-${f}`,turnCollapse:D}),!X){let N=[];for(let ee=c+1;ee<=d;ee++){const re=e[ee];ee===w&&re.type==="message"&&re.message.role==="assistant"?(U(N),N=[],a.push({...re,turnCollapse:D})):N.push(re)}U(N);continue}const G=[],q=[];for(let N=c+1;N<=d;N++){const ee=e[N];if(!(N===w&&g)){if(N===w&&ee.type==="message"&&ee.message.role==="assistant"){q.push({...ee,turnCollapse:D});continue}if(Q8(ee,N===w)){G.push(ee);continue}q.push(ee)}}U(G),a.push(...q)}return a}function Ox(e,t,n){for(let s=0;s<e.length;s++){const r=e[s];if(r.type==="message"){if(r.message.id===t||n&&r.message.role==="tool_group"&&r.message.tools.some(i=>Pl(i,n)))return s}else{if(r.type==="parallel_agents"&&n&&r.agents.some(i=>Pl(i,n)))return s;if(r.type==="turn_content"&&Ox(r.items,t,n)>=0)return s;if(r.type==="turn_outputs")continue}}return-1}function J8(e,t){if(!t)return!1;const n=t.callId;return e.type==="message"?e.message.id===t.messageId?!0:!!n&&e.message.role==="tool_group"&&e.message.tools.some(s=>Pl(s,n)):e.type==="parallel_agents"?!!n&&e.agents.some(s=>Pl(s,n)):e.type==="turn_content"?e.items.some(s=>J8(s,t)):(e.type==="turn_outputs",!1)}const Q5=0,uPe=120,J5=80,dPe=32,hPe=240,Z5=30,KQ=200,fPe=4;function mPe(e,t=KQ){return e>t}function pPe(e){const t=Math.max(0,Math.ceil(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60),s=t-n*60;return`${n}m ${s}s`}function eC(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function gPe(e){return e!==void 0?pPe(e):""}function yPe(e,t){if(e.inputTokens===void 0||e.outputTokens===void 0)return"";const n=e.cachedTokens??0,s=n>0&&e.inputTokens>0?` (${eC(n)} ${t("turn.cached")}, ${Math.round(n/e.inputTokens*100)}%)`:"";return`↑${eC(e.inputTokens)}${s} ↓${eC(e.outputTokens)}`}function kB(e,t){const n=[],s=yPe(e,t);return s&&n.push(s),e.toolCallCount!==void 0&&e.toolCallCount>0&&n.push(t("turn.toolCalls",{count:e.toolCallCount})),e.thinkingCount!==void 0&&e.thinkingCount>0&&n.push(t("turn.thinkingCount",{count:e.thinkingCount})),n.join(" · ")}function bPe(e){return e.inputTokens!==void 0&&e.outputTokens!==void 0||e.toolCallCount!==void 0&&e.toolCallCount>0}const vPe=m.memo(function({turnCollapse:t,onToggleCollapse:n}){const{t:s}=ot(),r=t.hiddenCount>0,i=t.liveStartedAt,o=r||i!==void 0||bPe(t),a=F9(i!==void 0&&o),l=m.useRef(0),c=m.useRef(i);c.current!==i&&(c.current=i,l.current=0);let d;i!==void 0&&o?(l.current=Math.max(l.current,Math.max(0,a-i)),d=l.current):o&&t.elapsedMs!==void 0?(l.current=0,d=t.elapsedMs):(l.current=0,d=void 0);const h=gPe(d),f=kB(t,s),p=kB(t,s),g=s(i!==void 0?"turn.processing":"turn.processed"),y=!!h&&o,w=!!f&&o,v=!!p&&o;if(!o)return null;const b=()=>{if(!r)return;const x=t.collapsed;n(t.turnId,x)};return u.jsxs("div",{className:r?`${Ml.collapseRow} ${Ml.collapseRowClickable}`:Ml.collapseRow,role:r?"button":void 0,tabIndex:r?0:void 0,"aria-expanded":r?!t.collapsed:void 0,"aria-label":r?t.collapsed?s("turn.expand"):s("turn.collapse"):void 0,title:r?t.collapsed?s("turn.expand"):s("turn.collapse"):void 0,onClick:r?b:void 0,onKeyDown:r?x=>{x.key!=="Enter"&&x.key!==" "||(x.preventDefault(),b())}:void 0,children:[u.jsxs("span",{className:Ml.collapseLabel,children:[u.jsxs("span",{className:Ml.processedLabel,children:[g,y&&u.jsxs("span",{className:Ml.processedMeta,children:[" ",h]})]}),v&&u.jsx("span",{className:Ml.summaryMetrics,children:p}),w&&u.jsx("span",{className:Ml.hiddenMetrics,children:f})]}),r&&u.jsx("span",{"data-testid":`toggle-${t.turnId}`,className:Ml.collapseIcon,onClick:x=>{x.stopPropagation(),b()},children:u.jsx("span",{className:t.collapsed?Ml.chevronRight:Ml.chevronDown,"aria-hidden":"true"})})]})});function _B(e){if(e.type==="turn_collapse")return Hn.turnStatusRow;if(e.type==="turn_outputs"||e.type==="turn_content")return Hn.turnContentRow;if(e.type==="message"&&e.turnCollapse)return Hn.turnAnswerRow}const wPe=m.memo(function({collapsed:t,children:n}){const s=I2(Hn.turnContentClip,t?Hn.turnContentCollapsed:void 0);return u.jsx("div",{className:s,"data-collapsed":t?"true":"false",children:u.jsx("div",{className:Hn.turnContentInner,children:n})})}),xPe={thought:"thinking",commentary:"assistant update",tool:"tool calls",agents:"parallel agents",plan:"plan update",status:"status update",none:"turn"},kPe=["--background","--foreground","--muted-foreground","--border","--font-sans"],SB="session-timeline-detail-tooltip",_Pe=m.memo(function({entries:t,currentTurnId:n,currentRange:s,hidden:r,onSelect:i}){const o=bm(),{t:a}=ot(),l=m.useRef(null),c=m.useRef(null),d=m.useRef(null),h=m.useRef(!1),f=m.useRef(!1),p=m.useRef(null),g=m.useRef(null),[y,w]=m.useState(null),v=s!==null?s.currentIndex:t.findIndex(M=>M.id===n),b=m.useCallback(()=>w(null),[]),x=m.useCallback(()=>{h.current||f.current||b()},[b]),k=m.useCallback((M,I)=>{const A=l.current;if(!A)return null;const P=getComputedStyle(A),B=I.getBoundingClientRect();return{entry:M,top:B.top+B.height/2,left:B.right+8,clamped:!1,themeVars:Object.fromEntries(kPe.map(F=>[F,P.getPropertyValue(F)]))}},[]),T=m.useCallback(M=>{const I=c.current;if(!I)return null;const A=Array.from(I.querySelectorAll('[data-testid="session-timeline-entry"]')).find(P=>P.getAttribute("data-turn-id")===M.id);return(A==null?void 0:A.querySelector("button"))??null},[]),C=m.useCallback(M=>{const I=c.current;if(!I)return!1;const A=I.getBoundingClientRect(),P=M.getBoundingClientRect();return P.bottom>=A.top&&P.top<=A.bottom},[]),S=m.useCallback(()=>{w(M=>{if(!M)return null;const I=T(M.entry);return!I||!C(I)?null:k(M.entry,I)})},[k,T,C]),_=m.useCallback((M,I)=>{w(k(M,I))},[k]),L=m.useCallback(()=>{typeof window>"u"||(p.current!==null&&window.cancelAnimationFrame(p.current),g.current!==null&&window.clearTimeout(g.current),f.current=!0,p.current=window.requestAnimationFrame(()=>{p.current=null,f.current=!1,S()}),g.current=window.setTimeout(()=>{g.current=null,f.current=!1},100))},[S]);return m.useLayoutEffect(()=>{if(r)return;const M=c.current;if(!M||v<0)return;const I=M.querySelector(`[data-timeline-index="${v}"]`);if(!I)return;const A=I.offsetTop+I.offsetHeight/2,P=M.scrollHeight-M.clientHeight,B=Math.max(0,Math.min(A-M.clientHeight/2,P));if(M.scrollTop===B)return;h.current=!0,M.scrollTop=B;const F=window.requestAnimationFrame(()=>{h.current=!1,S()}),O=window.setTimeout(()=>{h.current=!1},100);return()=>{window.cancelAnimationFrame(F),window.clearTimeout(O),h.current=!1}},[v,r,S]),m.useLayoutEffect(()=>{if(!(!y||typeof window>"u"))return window.addEventListener("resize",S),()=>{window.removeEventListener("resize",S)}},[S,y]),m.useLayoutEffect(()=>()=>{p.current!==null&&window.cancelAnimationFrame(p.current),g.current!==null&&window.clearTimeout(g.current),f.current=!1},[]),m.useLayoutEffect(()=>{if(!y||y.clamped)return;const M=l.current,I=d.current;if(!M||!I||typeof window>"u")return;const A=I.getBoundingClientRect(),P=12;let B=y.top;A.top<P?B+=P-A.top:A.bottom>window.innerHeight-P&&(B-=A.bottom-(window.innerHeight-P)),B!==y.top&&w(F=>(F==null?void 0:F.entry.id)===y.entry.id?{...F,top:B,clamped:!0}:F)},[y]),r||t.length===0?null:u.jsx("div",{className:Hn.sessionTimelineLayer,"aria-hidden":"false",children:u.jsxs("nav",{ref:l,className:Hn.sessionTimelinePanel,"aria-label":a("timeline.sessionTimeline"),"data-testid":"session-timeline",onMouseLeave:b,children:[u.jsx("div",{ref:c,className:Hn.sessionTimelineViewport,"data-testid":"session-timeline-viewport",onScroll:x,children:u.jsx("ol",{className:Hn.sessionTimelineList,children:t.map((M,I)=>{const A=s!==null&&I>=s.startIndex&&I<=s.endIndex,P=s!==null?I===s.currentIndex:M.id===n,B=M.nodeKinds.join(","),F=[`${a("timeline.turnPrefix",{index:I+1})}: ${M.label}`,P?a("timeline.currentTurn"):null].filter(Boolean).join(". "),O=U=>_(M,U.currentTarget),X=U=>{L(),_(M,U.currentTarget)},z=(y==null?void 0:y.entry.id)===M.id;return u.jsx("li",{className:Hn.sessionTimelineItem,"data-testid":"session-timeline-entry","data-turn-id":M.id,"data-timeline-index":I,"data-node-kinds":B,"data-in-current-range":A?"true":void 0,children:u.jsx("button",{type:"button",className:I2(Hn.sessionTimelineButton,A?Hn.sessionTimelineButtonInRange:void 0,P?Hn.sessionTimelineButtonCurrent:void 0),"aria-current":P?"step":void 0,"aria-describedby":z?SB:void 0,"aria-label":F,onClick:()=>i(M.id),onFocus:X,onBlur:b,onMouseEnter:O,onMouseLeave:b,children:u.jsx("span",{className:Hn.sessionTimelineTick})})},M.id)})})}),y&&typeof document<"u"&&_l.createPortal(u.jsxs("div",{ref:d,className:Hn.sessionTimelineDetails,id:SB,"data-testid":"session-timeline-detail","data-title":y.entry.label,"data-detail":y.entry.detail,"data-scheduled-task":y.entry.isScheduledTask?"true":void 0,role:"tooltip",style:{...y.themeVars,top:y.top,left:y.left},children:[u.jsxs("span",{className:Hn.sessionTimelineDetailsTitle,children:[y.entry.isScheduledTask&&u.jsx(ZOe,{}),u.jsx("span",{className:Hn.sessionTimelineDetailsTitleText,children:y.entry.label})]}),u.jsx("span",{className:Hn.sessionTimelineDetailsDetail,children:y.entry.detail})]}),o??document.body)]})})});function I2(...e){return e.filter(Boolean).join(" ")||void 0}const SPe=[];function CPe({label:e}){return u.jsxs(u.Fragment,{children:[u.jsx("div",{role:"status","aria-live":"polite",className:Hn.srOnly,children:e}),u.jsxs("div",{className:Hn.loadingSkeleton,"data-testid":"message-list-loading-skeleton","aria-hidden":"true",children:[u.jsx("div",{className:Hn.loadingSkeletonUserRow,children:u.jsxs("div",{className:Hn.loadingSkeletonUserBubble,children:[u.jsx("span",{className:Hn.loadingSkeletonLineWide}),u.jsx("span",{className:Hn.loadingSkeletonLineShort})]})}),u.jsx("div",{className:Hn.loadingSkeletonAssistantRow,children:u.jsxs("div",{className:Hn.loadingSkeletonAssistantBlock,children:[u.jsx("span",{className:Hn.loadingSkeletonLineMedium}),u.jsx("span",{className:Hn.loadingSkeletonLineWide}),u.jsx("span",{className:Hn.loadingSkeletonLineNarrow})]})}),u.jsx("div",{className:Hn.loadingSkeletonUserRow,children:u.jsx("div",{className:Hn.loadingSkeletonUserBubbleCompact,children:u.jsx("span",{className:Hn.loadingSkeletonLineMedium})})}),u.jsx("div",{className:Hn.loadingSkeletonAssistantRow,children:u.jsxs("div",{className:Hn.loadingSkeletonAssistantBlock,children:[u.jsx("span",{className:Hn.loadingSkeletonLineWide}),u.jsx("span",{className:Hn.loadingSkeletonLineMedium})]})})]})]})}const YQ=m.memo(m.forwardRef(function({messages:t,pendingApproval:n,onShowContextDetail:s,loadingTranscript:r,catchingUp:i,isResponding:o=!1,activeTurnStartedAt:a,welcomeHeader:l,centerWelcomeHeader:c=!1,workspaceCwd:d,tailContent:h,tailKey:f="tail",virtualScrollThreshold:p=KQ,autoScrollTailIntoView:g=!1,bottomOverlayInset:y=0,hideSessionTimeline:w=!1,showRetryHint:v=!1,onRetryClick:b,onBranchSession:x,onCanScrollToBottomChange:k,turnFileChanges:T,turnArtifacts:C,turnScheduledTasks:S,onReviewChanges:_,onOpenArtifact:L,onOpenScheduledTask:M,onTurnOutputOpen:I},A){var br;const{t:P}=ot(),B=m.useContext(dm),F=m.useMemo(()=>B?zOe(t,n):t,[B,t,n]),O=m.useMemo(()=>FOe(qQ(F),o,T,C,S),[F,o,T,C,S]),[X,z]=m.useState(!1),U=m.useRef(null),D=m.useMemo(()=>{var xe,kt;if(!X)return SPe;const Se=tPe(F);return(((xe=U.current)==null?void 0:xe.signature)!==Se||((kt=U.current)==null?void 0:kt.t)!==P)&&(U.current={signature:Se,t:P,entries:JOe(F,P)}),U.current.entries},[X,F,P]),G=m.useMemo(()=>new Map(D.map((Se,xe)=>[Se.id,xe])),[D]),q=m.useMemo(()=>$Oe(F),[F]),[N,ee]=m.useState(null),re=N!==null?((br=D[N.currentIndex])==null?void 0:br.id)??q:q,Q=m.useMemo(()=>{var Se;if(o)return null;for(let xe=F.length-1;xe>=0;xe-=1){const kt=F[xe];if(kt&&(kt.role==="tool_group"||kt.role==="plan"))return null;if((kt==null?void 0:kt.role)==="assistant"&&!kt.isStreaming&&((Se=kt.content)!=null&&Se.trim()))return kt.id}return null},[o,F]),K=m.useMemo(()=>HOe(O,o),[O,o]),{collapseCompletedTurns:se}=zc(),te=se??!0,[ce,oe]=m.useState(()=>new Map),de=m.useRef(!0),Te=m.useRef(!1),qe=m.useRef(0),Ne=m.useRef(0),ge=m.useRef(!1),Ee=m.useRef(0),_t=m.useRef(null),Ct=m.useRef(null),Je=m.useRef(!1),at=m.useRef(null),Oe=m.useRef(!1),Fe=m.useRef(r),ue=m.useRef(!!r),vt=m.useRef(void 0),ye=m.useRef(void 0),je=m.useRef(y),Ye=m.useRef(null),Nt=m.useRef(i),Rt=m.useRef(i),rn=m.useRef(!1),on=m.useRef(!1),Bn=m.useRef(void 0),bs=m.useRef(void 0),Ss=m.useRef(void 0);Rt.current=i;const Ie=m.useRef(null),lt=m.useCallback(()=>{const Se=Ie.current,xe=Se?Se.scrollHeight-Se.scrollTop-Se.clientHeight:0,kt=!de.current&&xe>1;Ct.current!==kt&&(Ct.current=kt,k==null||k(kt))},[k]),ne=m.useCallback(()=>{Ss.current!==void 0&&window.cancelAnimationFrame(Ss.current),Ss.current=window.requestAnimationFrame(lt)},[lt]),he=m.useCallback(Se=>{de.current!==Se&&(de.current=Se,ne())},[ne]),Ve=m.useMemo(()=>cPe(O,{overrides:ce,isResponding:o,activeTurnStartedAt:a,pendingApprovalCallId:(n==null?void 0:n.toolCallId)??null,enabled:te}),[O,ce,o,a,n==null?void 0:n.toolCallId,te]),we=m.useMemo(()=>GQ(Ve),[Ve]),Bt=D.length>=fPe;m.useLayoutEffect(()=>{if(w){z(Ot=>Ot&&!1);return}const Se=Ie.current;if(!Se)return;const xe=()=>{const xt=Se.getBoundingClientRect().width>=1160;z(An=>An===xt?An:xt)};if(xe(),typeof ResizeObserver>"u")return;const kt=new ResizeObserver(xe);return kt.observe(Se),()=>kt.disconnect()},[w]);const Et=h!=null,Tt=!!r,an=!!l,wt=an?1:0,It=wt+Ve.length,Vn=It+(Et?1:0),kn=mPe(Vn,p),ln=m.useCallback(()=>Ie.current,[]),Wn=m.useCallback(()=>{const Se=Ie.current;if(!Se)return;const kt=Se.scrollHeight-Se.scrollTop-Se.clientHeight<Z5;Te.current=!kt,he(kt),ne()},[ne,he]),Jn=m.useCallback(()=>{qe.current=Date.now()+1e3},[]),Cs=m.useCallback(()=>{on.current=!0,Bn.current!==void 0&&window.cancelAnimationFrame(Bn.current),bs.current!==void 0&&window.clearTimeout(bs.current),Bn.current=window.requestAnimationFrame(Wn),bs.current=window.setTimeout(()=>{on.current=!1,Bn.current=void 0,bs.current=void 0,Wn()},220)},[Wn]);m.useEffect(()=>()=>{Bn.current!==void 0&&window.cancelAnimationFrame(Bn.current),bs.current!==void 0&&window.clearTimeout(bs.current),Ss.current!==void 0&&window.cancelAnimationFrame(Ss.current),vt.current!==void 0&&window.cancelAnimationFrame(vt.current),ye.current!==void 0&&window.cancelAnimationFrame(ye.current)},[]);const fr=m.useCallback((Se,xe)=>{const kt=Ie.current;(!kt||kt.scrollHeight>kt.clientHeight+1)&&(Te.current=!0,he(!1)),Cs(),oe(Ot=>{const xt=new Map(Ot);return xt.set(Se,xe),xt})},[Cs,he]),Xs=m.useCallback(Se=>{const xe=Se.target;xe instanceof HTMLElement&&xe.closest("[aria-expanded]")&&(Te.current=!0,he(!1),Cs())},[Cs,he]),Vs=m.useCallback(Se=>{if(an&&Se===Q5)return"slot:header";if(Et&&Se===It)return`slot:tail:${f}`;const xe=Ve[Se-wt];return xe?vB(xe):`slot:row:${Se}`},[an,Et,It,f,Ve,wt]),_n=m.useCallback((Se="auto")=>{const xe=ln();if(!xe||xe.scrollHeight<=xe.clientHeight)return;Ee.current+=1;const kt=Ee.current;ge.current=!0,Se==="smooth"?xe.scrollTo({top:xe.scrollHeight,behavior:Se}):xe.scrollTop=xe.scrollHeight,ne(),Ne.current=Math.max(0,xe.scrollHeight-xe.clientHeight),lt();const Ot=()=>{Ee.current===kt&&(ge.current=!1)};Se==="smooth"?setTimeout(Ot,350):requestAnimationFrame(Ot)},[ln,lt,ne]),fn=m.useCallback((Se="smooth")=>{Te.current=!1,he(!0),_n(Se)},[_n,he]),qn=Fde({count:Vn,enabled:kn,getScrollElement:ln,getItemKey:Vs,estimateSize:Se=>{if(an&&Se===Q5)return uPe;if(Et&&Se===It)return hPe;const xe=Ve[Se-wt];return(xe==null?void 0:xe.type)==="turn_collapse"?dPe:(xe==null?void 0:xe.type)==="turn_content"?Math.max(J5,xe.items.length*J5):J5},overscan:20,useFlushSync:!1,useAnimationFrameWithResizeObserver:!0}),Zn=qn.getVirtualItems(),$n=qn.getTotalSize(),es=m.useRef({entryIndexById:new Map,headerOffset:0,isVisible:!1,turnIdByDisplayIndex:[],visibleItems:[]});es.current={entryIndexById:G,headerOffset:wt,isVisible:X,turnIdByDisplayIndex:we,visibleItems:Ve};const ss=m.useCallback(()=>{const Se=ln(),xe=es.current;if(!Se||!xe.isVisible||xe.entryIndexById.size===0){ee(Mn=>Mn===null?Mn:null);return}const kt=Se.getBoundingClientRect(),Ot=kt.top,xt=kt.bottom,An=Ot+(xt-Ot)/2,Gn=[];let Js=null,jn=Number.POSITIVE_INFINITY;Se.querySelectorAll("[data-index]").forEach(Mn=>{const Lr=Mn.dataset.index;if(Lr===void 0)return;const ti=Number(Lr);if(!Number.isFinite(ti))return;const _r=ti-xe.headerOffset;if(_r<0||_r>=xe.visibleItems.length)return;const W=Mn.getBoundingClientRect();if(W.bottom<Ot||W.top>xt)return;Gn.push(_r);const fe=W.top+(W.bottom-W.top)/2,Ae=Math.abs(fe-An);Ae<jn&&(jn=Ae,Js=_r)});const yn=aPe(xe.visibleItems,Gn,xe.entryIndexById,Js,xe.turnIdByDisplayIndex);ee(Mn=>(Mn==null?void 0:Mn.startIndex)===(yn==null?void 0:yn.startIndex)&&(Mn==null?void 0:Mn.endIndex)===(yn==null?void 0:yn.endIndex)&&(Mn==null?void 0:Mn.currentIndex)===(yn==null?void 0:yn.currentIndex)?Mn:yn)},[ln]),Ps=m.useCallback(()=>{_t.current!==null&&cancelAnimationFrame(_t.current),_t.current=requestAnimationFrame(()=>{_t.current=null,ss()})},[ss]);m.useEffect(()=>()=>{_t.current!==null&&(cancelAnimationFrame(_t.current),_t.current=null)},[]),m.useEffect(()=>{Ps()},[Ps,Vn,$n,kn,Zn.length,X]);const[jr,Ui]=m.useState(null);m.useEffect(()=>{if(!jr)return;const Se=setTimeout(()=>Ui(null),1600);return()=>clearTimeout(Se)},[jr]);const Bs=m.useCallback((Se,xe)=>{var Ot,xt;Te.current=!0,he(!1),Ee.current+=1;const kt=Ee.current;ge.current=!0,kn?qn.scrollToIndex(Se,{align:"center"}):(xt=(Ot=Ie.current)==null?void 0:Ot.querySelector(`[data-index="${Se}"]`))==null||xt.scrollIntoView({block:"center"}),setTimeout(()=>{Ee.current===kt&&(ge.current=!1,Ps(),ne())},150),Ui(null),requestAnimationFrame(()=>Ui(xe))},[kn,qn,he,Ps,ne]),zr=m.useRef({visibleItems:[],displayItems:[],headerOffset:0,performScrollToRow:()=>{}});zr.current={visibleItems:Ve,displayItems:O,headerOffset:wt,performScrollToRow:Bs};const sr=m.useRef(null),Qs=m.useCallback((Se,xe)=>{const{visibleItems:kt,displayItems:Ot,headerOffset:xt,performScrollToRow:An}=zr.current,Gn=Ox(kt,Se,xe);if(Gn>=0){const yn=kt[Gn];return(yn==null?void 0:yn.type)==="turn_content"&&yn.collapsed?(sr.current={messageId:Se,callId:xe},oe(Mn=>{if(Mn.get(yn.turnId)===!0)return Mn;const Lr=new Map(Mn);return Lr.set(yn.turnId,!0),Lr}),!0):(sr.current=null,An(Gn+xt,{messageId:Se,callId:xe}),!0)}const Js=Ox(Ot,Se,xe);if(Js<0)return!1;const jn=WQ(Ot,Js);return jn?(sr.current={messageId:Se,callId:xe},oe(yn=>{if(yn.get(jn)===!0)return yn;const Mn=new Map(yn);return Mn.set(jn,!0),Mn}),!0):!1},[]);m.useImperativeHandle(A,()=>({scrollToMessage:Qs,scrollToBottom:fn}),[Qs,fn]),m.useEffect(()=>{const Se=sr.current;if(!Se)return;const xe=Ox(Ve,Se.messageId,Se.callId);xe<0||(sr.current=null,Bs(xe+wt,Se))},[Ve,wt,Bs]);const gs=m.useCallback(()=>{const Se=ln();if(!Se)return;if(ge.current){Ne.current=Se.scrollTop;return}Ps();const xe=Ne.current,kt=Se.scrollTop;Ne.current=kt;const Ot=Se.scrollHeight-kt-Se.clientHeight;if(ne(),kt<xe-1){const xt=Ot<Z5,An=Date.now()<=qe.current;xt?(Te.current=!1,he(!0)):An?(Te.current=!0,he(!1)):Te.current||he(!1);return}Ot<Z5&&(Te.current=!1,he(!0))},[ln,ne,Ps,he]);m.useEffect(()=>{const Se=ln();if(Se)return Se.addEventListener("scroll",gs,{passive:!0}),()=>Se.removeEventListener("scroll",gs)},[ln,gs]),m.useEffect(()=>{const Se=ln();if(!Se)return;const xe=Ot=>{const xt=Se.getBoundingClientRect(),An=20;(Ot.clientX>=xt.right-An||Ot.clientY>=xt.bottom-An)&&Jn()},kt=Ot=>{(Ot.key==="ArrowUp"||Ot.key==="ArrowDown"||Ot.key==="PageUp"||Ot.key==="PageDown"||Ot.key==="Home"||Ot.key==="End"||Ot.key===" ")&&Jn()};return Se.addEventListener("wheel",Jn,{passive:!0}),Se.addEventListener("touchstart",Jn,{passive:!0}),Se.addEventListener("pointerdown",xe,{passive:!0}),Se.addEventListener("keydown",kt,{passive:!0}),()=>{Se.removeEventListener("wheel",Jn),Se.removeEventListener("touchstart",Jn),Se.removeEventListener("pointerdown",xe),Se.removeEventListener("keydown",kt)}},[ln,Jn]),m.useEffect(()=>{const Se=ln();if(!Se||typeof ResizeObserver>"u")return;const xe=new ResizeObserver(ne);xe.observe(Se);for(const Ot of Array.from(Se.children))xe.observe(Ot);const kt=new MutationObserver(Ot=>{for(const xt of Ot){for(const An of Array.from(xt.addedNodes))An instanceof HTMLElement&&xe.observe(An);for(const An of Array.from(xt.removedNodes))An instanceof HTMLElement&&xe.unobserve(An)}ne()});return kt.observe(Se,{childList:!0}),ne(),()=>{xe.disconnect(),kt.disconnect()}},[ln,ne]),m.useEffect(()=>{t.length===0&&(Te.current=!1,he(!0),sr.current=null,oe(Se=>Se.size?new Map:Se))},[t.length,he]),m.useEffect(()=>{const Se=Ie.current;if(!Se)return;const xe=new ResizeObserver(()=>{Ps(),!Rt.current&&(Te.current||(he(!0),requestAnimationFrame(()=>{!Rt.current&&!Te.current&&_n()})))});return xe.observe(Se),()=>xe.disconnect()},[_n,Ps,he]),m.useLayoutEffect(()=>{const Se=POe(t);if(i||r||Fe.current){at.current=Se,Je.current=!0,Oe.current=!1,Fe.current=r;return}if(Fe.current=r,!Je.current){at.current=Se,Je.current=!0,Oe.current=!1;return}const xe=BOe(t);Se&&(xe==null?void 0:xe.role)==="user"&&Se!==at.current?(Te.current=!1,he(!0),sr.current=null,Oe.current=!0):Oe.current=!1,at.current=Se},[t,i,r,he]),m.useLayoutEffect(()=>{Nt.current&&!i&&(Te.current=!1,he(!0),_n("auto")),Nt.current=i},[i,_n,he]),m.useLayoutEffect(()=>{if(r){ue.current=!0;return}if(!ue.current||i||t.length===0)return;ue.current=!1,Te.current=!1,he(!0),sr.current=null,vt.current!==void 0&&window.cancelAnimationFrame(vt.current),ye.current!==void 0&&window.cancelAnimationFrame(ye.current);const Se=()=>{Rt.current||Te.current||(he(!0),_n("auto"))};vt.current=window.requestAnimationFrame(()=>{vt.current=void 0,Se(),ye.current=window.requestAnimationFrame(()=>{ye.current=void 0,Se()})})},[i,r,t.length,_n,he]),m.useLayoutEffect(()=>{const Se=je.current!==y;je.current=y,Se&&(i||Te.current||(he(!0),requestAnimationFrame(()=>{!Rt.current&&!Te.current&&_n("auto")})))},[y,i,_n,he]);const ts=m.useMemo(()=>nPe(Ve),[Ve]);m.useLayoutEffect(()=>{if(!i){if(!ts){Ye.current=null;return}ts!==Ye.current&&(Ye.current=ts,(de.current||!Te.current)&&requestAnimationFrame(()=>{Te.current||(he(!0),_n())}))}},[i,ts,_n,he]),m.useEffect(()=>{g&&Et&&!rn.current&&(Te.current=!1,he(!0),requestAnimationFrame(()=>{Te.current||_n()})),rn.current=Et},[g,Et,_n,he]);const mn=m.useCallback(Se=>{const xe=(xt,An)=>{if(xt.type==="parallel_agents")return u.jsx(J6,{timestamp:xt.timestamp,children:u.jsx("div",{className:J8(xt,jr)?Ah.flash:void 0,children:u.jsx(VDe,{agents:xt.agents,pendingApproval:n})})});if(xt.type==="turn_outputs")return u.jsx(bDe,{changes:xt.changes,turnId:xt.turnId,artifacts:xt.artifacts,scheduledTasks:xt.scheduledTasks,workspaceCwd:d,onOpenRequest:I,onReviewChanges:_??K5,onOpenArtifact:L??K5,onOpenScheduledTask:M??K5});if(xt.type==="turn_collapse")return u.jsx(vPe,{turnCollapse:xt.turnCollapse,onToggleCollapse:fr});if(xt.type==="turn_content")return u.jsx(wPe,{collapsed:xt.collapsed,children:xt.items.map(jn=>u.jsx("div",{className:_B(jn),children:xe(jn,!1)},vB(jn)))});const Gn=xt.message.role==="assistant"?K.get(xt.message.id):void 0;let Js;return xt.message.role==="assistant"&&Gn&&(Js={turnId:Gn,message:{id:xt.message.id,content:xt.message.content,isStreaming:xt.message.isStreaming,timestamp:xt.message.timestamp}}),u.jsx(RLe,{message:xt.message,pendingApproval:n,onShowContextDetail:s,workspaceCwd:d,isLatest:An,showRetryHint:v,onRetryClick:b,onBranchSession:x,showAssistantActions:xt.message.role==="assistant"&&K.has(xt.message.id),showAssistantBranch:xt.message.role==="assistant"&&xt.message.id===Q,isLocateFlashing:J8(xt,jr),assistantTurnFooterInfo:Js})};if(an&&Se===Q5)return l;if(Et&&Se===It)return h;const kt=Se-wt,Ot=Ve[kt];return Ot?xe(Ot,kt===Ve.length-1):null},[an,l,Et,h,It,n,s,wt,Ve,jr,K,Q,d,v,b,x,fr,L,M,_,I]),Rn=m.useCallback(Se=>Se?_B(Se):void 0,[]);return m.useLayoutEffect(()=>{if(i)return;const Se=Oe.current;ge.current&&!Se||on.current&&!Se||(de.current||Se||!Te.current)&&(Te.current||he(!0),_n(Se?"smooth":"auto"),Oe.current=!1)},[$n,t,Vn,i,_n,he]),m.useLayoutEffect(()=>{ne()},[t,ne,Vn,$n]),u.jsxs("div",{ref:Ie,className:I2(Hn.list,an&&c?Hn.listWithWelcomeHeader:void 0),"data-web-shell-message-list":!0,onClickCapture:Xs,children:[Tt&&u.jsx(CPe,{label:P("editor.sessionLoading")}),u.jsx(_Pe,{entries:D,currentTurnId:re,currentRange:N,hidden:!X||!Bt,onSelect:Qs}),kn?u.jsx("div",{className:Hn.virtualSizer,style:{height:$n},children:Zn.map(Se=>u.jsx("div",{"data-index":Se.index,ref:qn.measureElement,className:I2(Hn.virtualRow,Rn(Ve[Se.index-wt])),"data-web-shell-message-row":!0,style:{position:"absolute",top:0,left:0,right:0,transform:`translateY(${Se.start}px)`},children:mn(Se.index)},Se.key))}):Array.from({length:Vn},(Se,xe)=>{const kt=Vs(xe),Ot=Ve[xe-wt];return u.jsx("div",{"data-index":xe,className:Rn(Ot),"data-web-shell-message-row":!0,children:mn(xe)},kt)})]})}));/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */function TPe(e){const t=e.toLowerCase();return/^qwen3-asr-flash-realtime(?:-|$)/.test(t)||/^qwen3-asr-flash(?:-\d{4}-\d{2}-\d{2})?$/.test(t)||/^(fun-asr|paraformer).*realtime(?:-|$)/.test(t)}function CB(e){const t=new Set,n=[];for(const s of(e==null?void 0:e.providers)??[])for(const r of s.models??[]){const i=r.baseModelId;!i||r.isRuntime||!TPe(i)||t.has(i)||(t.add(i),n.push({id:i,...r.name?{label:r.name}:{},...s.authType?{authType:s.authType}:{},...r.baseUrl?{baseUrl:r.baseUrl}:{},...typeof r.contextLimit=="number"?{contextWindow:r.contextLimit}:{},modalities:{audio:!0}}))}return n}const EPe="_editorShell_k650k_1",APe="_editorShellDropdownOpen_k650k_7",MPe="_container_k650k_11",NPe="_content_k650k_26",IPe="_dacAura_k650k_39",RPe="_dacHalo_k650k_40",jPe="_slashPortalLayer_k650k_181",LPe="_atPortalLayer_k650k_185",DPe="_slashPanel_k650k_189",OPe="_slashPanelBody_k650k_224",PPe="_slashList_k650k_230",BPe="_slashEntry_k650k_259",$Pe="_slashSection_k650k_265",zPe="_slashSectionHeader_k650k_271",FPe="_slashSectionCount_k650k_284",qPe="_slashItem_k650k_292",HPe="_slashItemActive_k650k_313",UPe="_slashCommand_k650k_317",VPe="_slashDetail_k650k_322",WPe="_slashDetailCommand_k650k_341",GPe="_slashDetailText_k650k_351",KPe="_slashDescription_k650k_371",YPe="_atPanel_k650k_382",XPe="_atPanelHeaderWrap_k650k_406",QPe="_atPanelHeader_k650k_406",JPe="_atBackButton_k650k_421",ZPe="_atPanelTitle_k650k_443",eBe="_atTabsWrap_k650k_452",tBe="_atTabs_k650k_452",nBe="_atTab_k650k_452",sBe="_atTabScrollButton_k650k_476",rBe="_atTabActive_k650k_508",iBe="_atSearchInput_k650k_519",oBe="_atList_k650k_538",aBe="_atItem_k650k_566",lBe="_atItemActive_k650k_588",cBe="_atItemSingleLine_k650k_592",uBe="_atItemMain_k650k_598",dBe="_atItemLeading_k650k_609",hBe="_atItemIcon_k650k_619",fBe="_atItemImageIcon_k650k_630",mBe="_atItemIconSpin_k650k_638",pBe="_atItemLabel_k650k_642",gBe="_atItemSubtitle_k650k_643",yBe="_atItemDescription_k650k_670",bBe="_atItemTrailing_k650k_681",vBe="_atEmpty_k650k_688",wBe="_tags_k650k_712",xBe="_tag_k650k_712",kBe="_tagTooltip_k650k_734",_Be="_tagLabel_k650k_759",SBe="_tagValue_k650k_760",CBe="_tagIcon_k650k_764",TBe="_tagRemove_k650k_799",EBe="_editorArea_k650k_819",ABe="_shellPrefix_k650k_834",MBe="_toolbar_k650k_871",NBe="_toolbarLeading_k650k_880",IBe="_toolbarStart_k650k_881",RBe="_toolbarEnd_k650k_882",jBe="_toolbarLeft_k650k_883",LBe="_toolbarRight_k650k_884",DBe="_gitBranchChip_k650k_908",OBe="_gitBranchIcon_k650k_923",PBe="_gitBranchText_k650k_935",BBe="_workspaceChip_k650k_944",$Be="_workspaceChipIcon_k650k_959",zBe="_workspaceChipText_k650k_971",FBe="_toolbarRightCustom_k650k_983",qBe="_toolbarMeasurements_k650k_989",HBe="_dropdownWrapper_k650k_1006",UBe="_modeToolBtn_k650k_1021",VBe="_toolBtnText_k650k_1021",WBe="_modelToolBtn_k650k_1022",GBe="_toolBtnArrow_k650k_1023",KBe="_workspaceSelectTooltipTrigger_k650k_1029",YBe="_workspaceSelectTrigger_k650k_1030",XBe="_dropdown_k650k_1006",QBe="_dropdownRich_k650k_1069",JBe="_dropdownCheck_k650k_1074",ZBe="_dropdownSearch_k650k_1079",e$e="_dropdownList_k650k_1097",t$e="_dropdownEmpty_k650k_1107",n$e="_dropdownItem_k650k_1114",s$e="_dropdownItemActive_k650k_1152",r$e="_dropdownItemIcon_k650k_1157",i$e="_dropdownItemCheck_k650k_1158",o$e="_dropdownItemContent_k650k_1175",a$e="_dropdownItemLabel_k650k_1182",l$e="_dropdownItemDesc_k650k_1192",c$e="_toolBtn_k650k_1021",u$e="_toolBtnIcon_k650k_1290",d$e="_widthModeBtn_k650k_1306",h$e="_quickActionsBtn_k650k_1315",f$e="_toolBtnModeIcon_k650k_1324",m$e="_toolBtnModelIcon_k650k_1325",p$e="_chevronDown_k650k_1369",g$e="_quickActionsPanel_k650k_1378",y$e="_quickActionsHeader_k650k_1391",b$e="_quickActionsLayout_k650k_1398",v$e="_quickActionsGrid_k650k_1405",w$e="_quickAction_k650k_1315",x$e="_quickActionLabel_k650k_1436",k$e="_quickKeysGrid_k650k_1451",_$e="_quickKey_k650k_1451",S$e="_quickKeyLabel_k650k_1480",C$e="_sendBtn_k650k_1493",T$e="_sendBtnRunning_k650k_1531",E$e="_sendIcon_k650k_1544",A$e="_stopIcon_k650k_1550",M$e="_loadingIcon_k650k_1557",N$e="_sendBtnArmed_k650k_1569",I$e="_escLabel_k650k_1637",R$e="_srOnly_k650k_1645",j$e="_images_k650k_1667",L$e="_imageThumb_k650k_1674",D$e="_imageRemove_k650k_1689",O$e="_searchPanel_k650k_1710",P$e="_searchBar_k650k_1727",B$e="_searchLabel_k650k_1735",$$e="_searchInput_k650k_1740",z$e="_searchResults_k650k_1754",F$e="_searchResult_k650k_1754",q$e="_searchResultActive_k650k_1787",H$e="_searchResultMarker_k650k_1792",U$e="_searchResultText_k650k_1797",V$e="_searchEmpty_k650k_1804",_e={editorShell:EPe,editorShellDropdownOpen:APe,container:MPe,content:NPe,dacAura:IPe,dacHalo:RPe,slashPortalLayer:jPe,atPortalLayer:LPe,slashPanel:DPe,slashPanelBody:OPe,slashList:PPe,slashEntry:BPe,slashSection:$Pe,slashSectionHeader:zPe,slashSectionCount:FPe,slashItem:qPe,slashItemActive:HPe,slashCommand:UPe,slashDetail:VPe,slashDetailCommand:WPe,slashDetailText:GPe,slashDescription:KPe,atPanel:YPe,atPanelHeaderWrap:XPe,atPanelHeader:QPe,atBackButton:JPe,atPanelTitle:ZPe,atTabsWrap:eBe,atTabs:tBe,atTab:nBe,atTabScrollButton:sBe,atTabActive:rBe,atSearchInput:iBe,atList:oBe,atItem:aBe,atItemActive:lBe,atItemSingleLine:cBe,atItemMain:uBe,atItemLeading:dBe,atItemIcon:hBe,atItemImageIcon:fBe,atItemIconSpin:mBe,atItemLabel:pBe,atItemSubtitle:gBe,atItemDescription:yBe,atItemTrailing:bBe,atEmpty:vBe,tags:wBe,tag:xBe,tagTooltip:kBe,tagLabel:_Be,tagValue:SBe,tagIcon:CBe,tagRemove:TBe,editorArea:EBe,shellPrefix:ABe,toolbar:MBe,toolbarLeading:NBe,toolbarStart:IBe,toolbarEnd:RBe,toolbarLeft:jBe,toolbarRight:LBe,gitBranchChip:DBe,gitBranchIcon:OBe,gitBranchText:PBe,workspaceChip:BBe,workspaceChipIcon:$Be,workspaceChipText:zBe,toolbarRightCustom:FBe,toolbarMeasurements:qBe,dropdownWrapper:HBe,modeToolBtn:UBe,toolBtnText:VBe,modelToolBtn:WBe,toolBtnArrow:GBe,workspaceSelectTooltipTrigger:KBe,workspaceSelectTrigger:YBe,dropdown:XBe,dropdownRich:QBe,dropdownCheck:JBe,dropdownSearch:ZBe,dropdownList:e$e,dropdownEmpty:t$e,dropdownItem:n$e,dropdownItemActive:s$e,dropdownItemIcon:r$e,dropdownItemCheck:i$e,dropdownItemContent:o$e,dropdownItemLabel:a$e,dropdownItemDesc:l$e,toolBtn:c$e,toolBtnIcon:u$e,widthModeBtn:d$e,quickActionsBtn:h$e,toolBtnModeIcon:f$e,toolBtnModelIcon:m$e,chevronDown:p$e,quickActionsPanel:g$e,quickActionsHeader:y$e,quickActionsLayout:b$e,quickActionsGrid:v$e,quickAction:w$e,quickActionLabel:x$e,quickKeysGrid:k$e,quickKey:_$e,quickKeyLabel:S$e,sendBtn:C$e,sendBtnRunning:T$e,sendIcon:E$e,stopIcon:A$e,loadingIcon:M$e,sendBtnArmed:N$e,escLabel:I$e,srOnly:R$e,images:j$e,imageThumb:L$e,imageRemove:D$e,searchPanel:O$e,searchBar:P$e,searchLabel:B$e,searchInput:$$e,searchResults:z$e,searchResult:F$e,searchResultActive:q$e,searchResultMarker:H$e,searchResultText:U$e,searchEmpty:V$e},W$e=["--chat-editor-accent-color","--chat-editor-text-primary","--accent","--background","--foreground","--muted-foreground","--chat-editor-border-color","--font-sans"];function G$e({menu:e,anchorRef:t,panelRef:n,onSelect:s,onAccept:r,onBack:i,onSearch:o,onSelectTab:a}){const l=bm(),{t:c}=ot(),d=m.useRef([]),h=m.useRef(null),f=m.useRef(null),[p,g]=m.useState(null),[y,w]=m.useState({});m.useEffect(()=>{var _;(_=d.current[e.selectedIndex])==null||_.scrollIntoView({block:"nearest"})},[e.level,e.selectedIndex]),m.useEffect(()=>{if(e.level!=="items"||e.inputMode!=="search"||document.activeElement===h.current)return;const _=()=>{var I;return(I=h.current)==null?void 0:I.focus()},L=window.requestAnimationFrame(_),M=window.setTimeout(_,0);return()=>{window.cancelAnimationFrame(L),window.clearTimeout(M)}},[e.inputMode,e.level,e.selectedProviderId]),m.useLayoutEffect(()=>{const _=t.current;if(!_)return;const L=getComputedStyle(_);w(Object.fromEntries(W$e.map(M=>[M,L.getPropertyValue(M)])))},[t]),m.useLayoutEffect(()=>{const _=t.current;if(!_)return;let L=null;const M=()=>{var U;const P=_.getBoundingClientRect(),B=((U=n.current)==null?void 0:U.offsetWidth)??360,F=getComputedStyle(_),O=Number.parseFloat(F.getPropertyValue("--web-shell-popover-safe-top"))||48,X=Math.max(96,Math.min(300,P.top-O-8)),z={left:Math.max(12,Math.min(P.left+16,window.innerWidth-B-12)),bottom:window.innerHeight-P.top+8,width:P.width,maxHeight:X};g(D=>D&&D.left===z.left&&D.bottom===z.bottom&&D.width===z.width&&D.maxHeight===z.maxHeight?D:z)},I=()=>{L===null&&(L=window.requestAnimationFrame(()=>{L=null,M()}))};M();const A=new ResizeObserver(I);return A.observe(_),window.addEventListener("resize",I),window.addEventListener("scroll",I,!0),()=>{L!==null&&window.cancelAnimationFrame(L),A.disconnect(),window.removeEventListener("resize",I),window.removeEventListener("scroll",I,!0)}},[t,n]);const v=e.level==="categories"?e.providers.map(_=>({id:_.id,label:_.label,labelTitle:_.textValue,description:_.description,trailing:"›",provider:_})):e.items.map(_=>({id:_.id,label:_.label,labelTitle:_.label,subtitle:_.subtitle,description:e.selectedProviderId===Yi?void 0:_.description??_.detail,icon:_.icon,iconMode:_.iconMode,iconColor:_.iconColor,iconSpin:_.iconSpin,iconTooltip:_.iconTooltip,trailing:_.kind==="directory"||_.kind==="mcp-server"?"›":"",item:_}));if(m.useEffect(()=>{d.current.length=v.length},[v.length]),!p)return null;const b=e.providers.find(_=>_.id===e.selectedProviderId),x=e.itemMode==="mcpResources"&&e.mcpServerName?ar(e.mcpServerName)??"[invalid]":(b==null?void 0:b.label)??"",k=e.itemMode==="mcpResources"&&e.mcpServerName?ar(e.mcpServerName)??"[invalid]":(b==null?void 0:b.textValue)??"",T=e.level==="items"?(b==null?void 0:b.textValue)??c("at.menu"):c("at.menu"),C="at-mention-listbox",S=e.selectedIndex>=0&&e.selectedIndex<v.length?`at-mention-option-${e.selectedIndex}`:void 0;return _l.createPortal(u.jsx("div",{className:_e.atPortalLayer,style:y,children:u.jsxs("div",{ref:n,className:_e.atPanel,"data-at-mention-panel":"true",style:{...y,left:p.left,bottom:p.bottom,"--at-anchor-width":`${p.width}px`,"--at-panel-max-height":`${p.maxHeight}px`},role:"region","aria-label":T,onMouseDown:_=>{_.target instanceof HTMLInputElement||_.preventDefault()},children:[e.level==="items"&&u.jsxs("div",{className:_e.atPanelHeaderWrap,children:[u.jsxs("div",{className:_e.atPanelHeader,children:[u.jsx("button",{type:"button",className:_e.atBackButton,"aria-label":c("common.back"),onMouseDown:_=>{_.preventDefault(),_.stopPropagation()},onClick:_=>{_.preventDefault(),_.stopPropagation(),i()},children:"‹"}),u.jsx("span",{className:_e.atPanelTitle,title:k,children:x})]}),u.jsx("input",{ref:h,className:_e.atSearchInput,value:e.query,placeholder:c("common.search"),"aria-label":c("common.search"),"aria-controls":C,"aria-activedescendant":S,onMouseDown:_=>_.stopPropagation(),onClick:_=>_.stopPropagation(),onChange:_=>o(_.currentTarget.value),onKeyDown:_=>{if(!(_.nativeEvent.isComposing||_.nativeEvent.keyCode===229)){if(_.key==="Escape")_.preventDefault(),_.stopPropagation(),i();else if(_.key==="Enter")_.preventDefault(),_.stopPropagation(),r();else if(_.key==="Tab"&&!_.shiftKey&&!_.altKey&&!_.ctrlKey&&!_.metaKey)_.preventDefault(),_.stopPropagation(),r();else if(_.key==="ArrowUp"){if(_.preventDefault(),_.stopPropagation(),v.length===0)return;s(Math.max(0,e.selectedIndex-1))}else if(_.key==="ArrowDown"){if(_.preventDefault(),_.stopPropagation(),v.length===0)return;s(Math.min(v.length-1,e.selectedIndex+1))}}}}),e.tabs&&e.tabs.length>0&&u.jsxs("div",{className:_e.atTabsWrap,children:[u.jsx("button",{type:"button",className:_e.atTabScrollButton,"aria-label":"Previous tab",onClick:_=>{_.preventDefault(),_.stopPropagation(),TB(f.current,"previous")},children:"‹"}),u.jsx("div",{ref:f,className:_e.atTabs,role:"tablist",children:e.tabs.map(_=>{const L=_.id===e.selectedTabId,M=_.textValue??(typeof _.label=="string"?_.label:_.id);return u.jsx("button",{type:"button",role:"tab","aria-selected":L,disabled:_.disabled,className:`${_e.atTab} ${L?_e.atTabActive:""}`,title:M,onClick:I=>{I.preventDefault(),I.stopPropagation(),a(_.id)},children:_.label},_.id)})}),u.jsx("button",{type:"button",className:_e.atTabScrollButton,"aria-label":"Next tab",onClick:_=>{_.preventDefault(),_.stopPropagation(),TB(f.current,"next")},children:"›"})]})]}),u.jsx("div",{id:C,className:_e.atList,role:v.length>0?"listbox":void 0,"aria-label":v.length>0?T:void 0,children:e.loading&&v.length===0?u.jsx("div",{className:_e.atEmpty,role:"status","aria-live":"polite",children:c("common.loading")}):v.length===0?u.jsx("div",{className:_e.atEmpty,role:"status","aria-live":"polite",children:c("common.noResults")}):v.map((_,L)=>{const M=L===e.selectedIndex,I="item"in _?b==null?void 0:b.provider:_.provider.provider;let A;if("item"in _&&(I!=null&&I.renderItem))try{A=I.renderItem({item:_.item,provider:I,selected:M})}catch(B){console.warn("[WebShell] at mention item render failed",B)}const P="icon"in _&&_.icon&&eg(_.icon)?_.icon:void 0;return u.jsxs("button",{ref:B=>{d.current[L]=B},type:"button",id:`at-mention-option-${L}`,role:"option","aria-selected":M,className:`${_e.atItem} ${M?_e.atItemActive:""} ${_.description?"":_e.atItemSingleLine}`,style:{"--at-item-main-template":K$e(Y$e(_.label,_.labelTitle),"subtitle"in _?_.subtitle:void 0)},onMouseEnter:()=>s(L),onMouseDown:B=>{B.preventDefault(),B.stopPropagation()},onClick:B=>{B.preventDefault(),B.stopPropagation(),r(L)},children:[A??u.jsxs(u.Fragment,{children:[u.jsxs("span",{className:_e.atItemMain,children:[u.jsxs("span",{className:_e.atItemLeading,children:["icon"in _&&P&&(_.iconMode==="image"?u.jsx("img",{className:_e.atItemImageIcon,src:P,title:_.iconTooltip,alt:"","aria-hidden":"true"}):u.jsx("span",{className:`${_e.atItemIcon} ${_.iconSpin?_e.atItemIconSpin:""}`,style:{...Xd("--at-item-icon-url",P),color:_.iconColor},title:_.iconTooltip,"aria-hidden":"true"})),u.jsx("span",{className:_e.atItemLabel,title:_.labelTitle,children:_.label})]}),"subtitle"in _&&_.subtitle&&u.jsx("span",{className:_e.atItemSubtitle,title:_.subtitle,children:_.subtitle})]}),_.description&&u.jsx("span",{className:_e.atItemDescription,title:_.description,children:_.description})]}),_.trailing&&u.jsx("span",{className:_e.atItemTrailing,"aria-hidden":"true",children:_.trailing})]},_.id)})})]})}),l??document.body)}function TB(e,t){if(!e)return;const n=Math.max(96,e.clientWidth*.75);e.scrollBy({left:t==="previous"?-n:n,behavior:"smooth"})}function K$e(e,t){if(!t)return"minmax(0, 1fr)";const n=EB(e);return EB(t)<=12?"minmax(0, 1fr) max-content":n<=18?"max-content minmax(0, 1fr)":"minmax(0, 3fr) minmax(0, 2fr)"}function Y$e(e,t){return typeof e=="string"?e:typeof e=="number"?String(e):t||""}function EB(e){return Array.from(e).reduce((t,n)=>t+(n.charCodeAt(0)>255?2:1),0)}const X$e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cdefs%3e%3cclipPath%20id='master_svg0_46_02846'%3e%3crect%20x='-1.2000000476837158'%20y='-1.2000000476837158'%20width='18.40000009536743'%20height='18.40000009536743'%20rx='0'/%3e%3c/clipPath%3e%3cclipPath%20id='master_svg1_46_02850'%3e%3crect%20x='3.299999952316284'%20y='3.299999952316284'%20width='9.400000095367432'%20height='9.400000095367432'%20rx='0'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23master_svg0_46_02846)'%3e%3cpath%20d='M2.40314639,2.758413L2.40292972,3.1950147L2.40178722,5.4973922L2.4000000999999997,8.3332543Q2.39999998,10.5420713,3.90192288,12.266657Q5.402200000000001,13.989353,8.1462374,14.904664L8.3362594,14.968048L8.526247999999999,14.904564Q11.2532721,13.993322,12.7668409,12.240547Q14.266665,10.5036879,14.266665,8.333632L14.266147,5.4975739L14.262505,2.7582424000000003L13.847304,2.6242929Q9.977867100000001,1.37595743,8.6663413,0.50089496L8.3334417,0.27878135000000004L8.0004754,0.5007948Q6.6891963,1.37512314,2.81864448,2.624314L2.40314639,2.758413ZM3.60271364,3.6308396L3.60178709,5.4979882L3.5999999000000003,8.3340111Q3.60000002,10.0927849,4.8068562,11.47856Q6.0415909,12.896347,8.3358369,13.701283Q10.6119351,12.899953,11.8586035,11.45626Q13.066666,10.0572739,13.066666,8.333632L13.066147,5.4977932L13.063664,3.6310089Q9.7833066,2.5506459,8.3332324,1.70592678Q6.8834386,2.5499707000000003,3.60271364,3.6308396Z'%20fill-rule='evenodd'%20fill='%230A0A0A'%20fill-opacity='1'/%3e%3cg%20clip-path='url(%23master_svg1_46_02850)'%3e%3cg%20transform='matrix(0,-0.9999712705612183,0.9999712705612183,0,-4.155969887971878,15.343589294701815)'%3e%3cpath%20d='M4.74521804,9.75L5.16948596,10.1742641L7.3436494,12.3484278L9.5178127,10.1742641L9.9420805,9.75L9.0935488,8.90146804L8.669284600000001,9.32573596L7.3436494,10.65137106L6.0180141,9.3257359L5.59375,8.90146804L4.74521804,9.75Z'%20fill-rule='evenodd'%20fill='%230A0A0B'%20fill-opacity='1'/%3e%3c/g%3e%3cline%20x1='8.299999952316284'%20y1='9.587499976158142'%20x2='11.362499952316284'%20y2='9.587499976158142'%20fill-opacity='0'%20stroke-opacity='1'%20stroke='%230A0A0B'%20fill='none'%20stroke-width='1.2000000476837158'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Q$e="/assets/default-aEtf0G7-.svg",XQ="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='13.101718187332153'%20height='12.118681192398071'%20viewBox='0%200%2013.101718187332153%2012.118681192398071'%3e%3cpath%20d='M3.728619923841858,11.142287023841858L11.844652023841858,3.025579823841858L12.268880023841858,2.6013156238418578L9.419035523841858,-0.24852800615814208L0.8780930338418579,8.292414323841857L-0.27773314615814204,12.298048023841858L3.728619923841858,11.142287023841858ZM10.571859023841858,2.6013509238418577L3.098784523841858,10.075047123841857L1.4777333738418579,10.542690823841857L1.945311323841858,8.922252323841859L9.419035523841858,1.448528053841858L10.571859023841858,2.6013509238418577ZM5.901715423841858,12.118684023841858L6.501718123841858,12.118682023841858L12.501718023841859,12.118682023841858L13.101720023841859,12.118684023841858L13.101720023841859,10.918678023841858L12.501718023841859,10.918681023841858L6.501718123841858,10.918682023841859L5.901715423841858,10.918678023841858L5.901715423841858,12.118684023841858Z'%20fill-rule='evenodd'%20fill='%230A0A0B'%20fill-opacity='1'/%3e%3c/svg%3e",J$e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cdefs%3e%3cclipPath%20id='master_svg0_26_21323'%3e%3crect%20x='-0.6000000238418579'%20y='-0.6000000238418579'%20width='17.200000047683716'%20height='17.200000047683716'%20rx='0'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23master_svg0_26_21323)'%3e%3cpath%20d='M6,2.484801532279053L5.5757358,2.9090694522790526L3.3333334,5.151471992279053L2.42426407,4.242402732279053L2,3.818134902279053L1.1514680400000001,4.666666892279053L1.57573596,5.090930892279053L3.3333334,6.848528392279053L6.424264,3.7575975622790527L6.8485317,3.3333334922790527L6,2.484801532279053ZM8.0666642,4.600002992279053L8.666667,4.600000192279053L14,4.600000292279053L14.600002,4.600002992279053L14.600002,3.3999974132790527L14,3.4000001552790526L8.666667499999999,3.4000001922790526L8.0666642,3.3999974132790527L8.0666642,4.600002992279053ZM8.0666642,8.600003292279052L8.666667,8.600000392279053L14,8.600000892279052L14.600002,8.600003292279052L14.600002,7.399997692279053L14,7.400000592279053L8.666667499999999,7.400000592279053L8.0666642,7.399997692279053L8.0666642,8.600003292279052ZM6,9.151468792279053L5.5757358,9.575736492279052L3.3333335,11.818139592279053L2.42426419,10.909069992279052L2,10.484801292279052L1.15146798,11.333333492279053L1.57573584,11.757597492279054L3.3333334,13.515196492279053L6.424264,10.424265392279054L6.8485317,10.000000492279053L6,9.151468792279053ZM8.0666642,12.600003692279053L8.666667,12.600000892279052L14,12.600000892279052L14.600002,12.600003692279053L14.600002,11.399997192279052L14,11.400000092279052L8.666667499999999,11.400001092279053L8.0666642,11.399997192279052L8.0666642,12.600003692279053Z'%20fill-rule='evenodd'%20fill='%230A0A0B'%20fill-opacity='1'/%3e%3c/g%3e%3c/svg%3e",Z$e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='11.86667275428772'%20height='14.535494089126587'%20viewBox='0%200%2011.86667275428772%2014.535494089126587'%3e%3cpath%20d='M5.933441723841858,-0.12121862615814205L5.600475423841858,0.1007948238418579Q4.289196323841858,0.9751231638418579,0.4186445038418579,2.224314023841858L0.0031464138418578758,2.358413023841858L0.0017872438418579106,5.097392223841858L1.2384185787972513e-7,7.933254323841858Q3.8418579428878274e-9,10.142071323841858,1.5019229038418578,11.866657023841858Q3.002200023841858,13.589353023841857,5.746237423841858,14.504664023841858L5.936259423841858,14.568048023841857L6.126248023841858,14.504564023841858Q8.853272123841858,13.593322023841857,10.366840923841858,11.840547023841857Q11.866665023841858,10.103687923841857,11.866665023841858,7.933632023841858L11.866147023841858,5.097573923841858L11.862505023841859,2.3582424238418582L11.447304023841857,2.224292923841858Q7.577867123841858,0.9759574538418578,6.266341323841858,0.10089498384185791L5.933441723841858,-0.12121862615814205ZM5.933233823841858,1.3059267438418578Q4.483438623841858,2.149970723841858,1.202713663841858,3.2308396238418577L1.2017871138418579,5.097988223841858L1.199999923841858,7.934011123841858Q1.2000000438418579,9.692784923841858,2.406856223841858,11.078560023841858Q3.641590923841858,12.496347023841858,5.935836923841858,13.301283023841858Q8.211935123841858,12.499953023841858,9.458603523841857,11.056260023841858Q10.666666023841858,9.657273923841858,10.666666023841858,7.933632023841858L10.666147023841859,5.097793223841858L10.663664023841857,3.231008923841858Q7.383306623841858,2.150645923841858,5.933233823841858,1.3059267438418578ZM5.333330723841858,4.000322923841858L5.333333623841858,4.600325723841858L5.333333623841858,7.266992223841858L5.333330723841858,7.866995023841858L6.533336323841858,7.866995023841858L6.533333423841858,7.266992223841858L6.533333923841858,4.600325723841858L6.533336323841858,4.000322923841858L5.333330723841858,4.000322923841858ZM5.333330723841858,10.533662423841857L5.933333523841858,10.533659623841858L5.940000223841858,10.533659623841858L6.5400029238418576,10.533662423841857L6.5400029238418576,9.333655923841858L5.940000223841858,9.333658823841859L5.933333523841858,9.333659723841858L5.333330723841858,9.333655923841858L5.333330723841858,10.533662423841857Z'%20fill-rule='evenodd'%20fill='%230A0A0A'%20fill-opacity='1'/%3e%3c/svg%3e",eze="_icon_i7y0u_1",tze={icon:eze},nze={auto:X$e,"auto-edit":XQ,default:Q$e,plan:J$e,yolo:Z$e};function g1({mode:e}){const t=nze[e];return t?u.jsx("span",{className:tze.icon,style:Xd("--mode-icon-url",t),"aria-hidden":"true"}):u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"M6 18c.7-2.7 2.2-4 4.5-4H12M7 6h10M7 10h7M17.5 14.5l2 2-2 2",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function sze(e,t){const n=new Map;if(t==="command")for(const r of e)r.section&&n.set(r.section,(n.get(r.section)??0)+1);let s;return e.map((r,i)=>{const o=r.section,a=t==="command"&&o!==void 0&&o!==s,l=a&&i>0;return s=o??s,{showHeader:a,showDivider:l,count:a&&o?n.get(o)??0:0}})}function Lf(e){return e.replace(/\([^()]+\)$/,"")}/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */const tC=16e3,rze=4096,AB=6e4;function ize(e){const t=new URL(e),n=t.pathname.replace(/\/?$/,"/"),s=new URL("voice/stream",`${t.origin}${n}`);return s.protocol=s.protocol==="https:"?"wss:":"ws:",s.toString()}const oze="qwen-bearer.",aze="qwen-ws";function lze(e){const t=new TextEncoder().encode(e);let n="";for(let r=0;r<t.length;r++)n+=String.fromCharCode(t[r]);const s=btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return`${oze}${s}`}function cze(e){switch(e==null?void 0:e.name){case"NotAllowedError":case"SecurityError":return"Microphone blocked. Click the camera/lock icon in the address bar to allow the mic for this site, and enable your browser under System Settings → Privacy → Microphone, then retry.";case"NotFoundError":case"DevicesNotFoundError":case"OverconstrainedError":return"No microphone found. Connect one and retry.";case"NotReadableError":case"TrackStartError":return"Microphone is in use by another app. Close it and retry.";default:return e instanceof Error?e.message:String(e)}}function uze(e){const t=new Int16Array(e.length);let n=0;for(let s=0;s<e.length;s++){let r=e[s];r>1?r=1:r<-1&&(r=-1),t[s]=r<0?r*32768:r*32767,n+=r*r}return{pcm:t.buffer,level:e.length?Math.sqrt(n/e.length):0}}function dze(e){const{baseUrl:t,token:n,onFinal:s,onError:r}=e,[i,o]=m.useState("idle"),[a,l]=m.useState(""),[c,d]=m.useState(0),[h,f]=m.useState(void 0),p=m.useRef({}),g=m.useRef(!0),y=m.useRef(0),w=m.useRef("idle"),v=m.useRef(s);v.current=s;const b=m.useRef(r);b.current=r;const x=m.useCallback(A=>{w.current=A,o(A)},[]),k=m.useCallback(()=>{const A=p.current;A.transcribeTimeout&&(clearTimeout(A.transcribeTimeout),A.transcribeTimeout=void 0)},[]),T=m.useCallback(()=>{var P;const A=p.current;A.processor&&(A.processor.onaudioprocess=null);for(const B of[A.processor,A.source,A.sink])try{B==null||B.disconnect()}catch{}(P=A.stream)==null||P.getTracks().forEach(B=>B.stop()),A.context&&A.context.state!=="closed"&&A.context.close().catch(()=>{}),A.processor=void 0,A.sink=void 0,A.source=void 0,A.stream=void 0,A.context=void 0},[]),C=m.useCallback(()=>{y.current++,T();const A=p.current;if(k(),A.ws){try{A.ws.onmessage=null,A.ws.onerror=null,A.ws.onclose=null,A.ws.close()}catch{}A.ws=void 0}},[T,k]),S=m.useCallback((A,P)=>{var B;!g.current||P!==void 0&&y.current!==P||(C(),x("error"),l(""),d(0),f(A),(B=b.current)==null||B.call(b,A))},[C,x]),_=m.useCallback((A,P)=>{P!==void 0&&y.current!==P||(C(),g.current&&(x("idle"),l(""),d(0),v.current(A)))},[C,x]),L=m.useCallback(()=>{if(w.current!=="idle"&&w.current!=="error")return;f(void 0),l(""),x("connecting");const A=++y.current,P=()=>!g.current||y.current!==A;(async()=>{var B;try{if(!((B=navigator.mediaDevices)!=null&&B.getUserMedia))throw new Error(window.isSecureContext?"Microphone capture is not supported in this browser.":"Microphone needs a secure context — open the Web Shell via localhost/127.0.0.1 or https.");let F;try{F=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0}})}catch(G){throw new Error(cze(G))}if(P()){F.getTracks().forEach(G=>G.stop());return}p.current.stream=F;const O=new AudioContext({sampleRate:tC});if(O.sampleRate!==tC)throw F.getTracks().forEach(G=>G.stop()),O.close().catch(()=>{}),new Error(`Browser audio rate ${O.sampleRate} Hz is not the required ${tC} Hz.`);if(p.current.context=O,O.state==="suspended"&&await O.resume(),P()){F.getTracks().forEach(G=>G.stop()),O.close().catch(()=>{});return}const X=O.createMediaStreamSource(F),z=O.createScriptProcessor(rze,1,1),U=O.createGain();U.gain.value=0,p.current.source=X,p.current.processor=z,p.current.sink=U;const D=new WebSocket(ize(t),n?[aze,lze(n)]:void 0);D.binaryType="arraybuffer",p.current.ws=D,z.onaudioprocess=G=>{const{pcm:q,level:N}=uze(G.inputBuffer.getChannelData(0));g.current&&d(N),D.readyState===WebSocket.OPEN&&D.send(q)},D.onopen=()=>{if(P()){z.onaudioprocess=null;for(const q of[z,X,U])try{q.disconnect()}catch{}F.getTracks().forEach(q=>q.stop()),O.state!=="closed"&&O.close().catch(()=>{});const G=p.current;G.ws===D&&(G.ws=void 0),G.processor===z&&(G.processor=void 0),G.source===X&&(G.source=void 0),G.sink===U&&(G.sink=void 0),G.stream===F&&(G.stream=void 0),G.context===O&&(G.context=void 0);try{D.close()}catch{}return}D.send(JSON.stringify({type:"start"})),X.connect(z),z.connect(U),U.connect(O.destination),k(),p.current.transcribeTimeout=setTimeout(()=>{w.current==="recording"&&S("No response from server. Check that the voice model is running.",A)},AB),g.current&&x("recording")},D.onmessage=G=>{(w.current==="connecting"||w.current==="recording")&&k();let q;try{q=JSON.parse(String(G.data))}catch{return}q.type==="interim"?g.current&&l(q.text??""):q.type==="final"?_(q.text??"",A):q.type==="error"&&S(q.message??q.text??"Voice transcription failed.",A)},D.onerror=()=>{},D.onclose=G=>{if(g.current&&(w.current==="recording"||w.current==="connecting"||w.current==="transcribing")){const q=G.code||1006,N=G.reason||"none";S(`Voice connection closed (code=${q}, reason=${N}).`,A)}}}catch(F){S(F instanceof Error?F.message:String(F),A)}})()},[t,n,S,_,x,k]),M=m.useCallback(()=>{const A=p.current.ws;if(!A||A.readyState!==WebSocket.OPEN){C(),x("idle");return}T(),d(0),x("transcribing");const P=y.current;try{A.send(JSON.stringify({type:"stop"})),k(),p.current.transcribeTimeout=setTimeout(()=>{w.current==="transcribing"&&S("Transcription timed out.",P)},AB)}catch{S("Failed to finalize voice transcription.",P)}},[C,T,S,x,k]),I=m.useCallback(()=>{const A=p.current.ws;if(A&&A.readyState===WebSocket.OPEN)try{A.send(JSON.stringify({type:"abort"}))}catch{}C(),x("idle"),l(""),d(0)},[C,x]);return m.useEffect(()=>(g.current=!0,()=>{g.current=!1,C()}),[C]),{status:i,interimText:a,audioLevel:c,errorMessage:h,start:L,stop:M,abort:I}}const hze="_root_9hwm9_7",fze="_iconBtn_9hwm9_14",mze="_error_9hwm9_47",pze="_connecting_9hwm9_51",gze="_pill_9hwm9_56",yze="_transcribing_9hwm9_75",bze="_recDot_9hwm9_79",vze="_wave_9hwm9_88",wze="_bar_9hwm9_95",xze="_time_9hwm9_103",kze="_stop_9hwm9_111",_ze="_spinner_9hwm9_118",Sze="_interim_9hwm9_128",uo={root:hze,iconBtn:fze,error:mze,connecting:pze,pill:gze,transcribing:yze,recDot:bze,wave:vze,bar:wze,time:xze,stop:kze,spinner:_ze,interim:Sze},Cze="voice_transcribe",MB=16,Tze=()=>u.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24","aria-hidden":"true",fill:"currentColor",children:[u.jsx("path",{d:"M12 14a3 3 0 0 0 3-3V6a3 3 0 0 0-6 0v5a3 3 0 0 0 3 3Z"}),u.jsx("path",{d:"M17 11a5 5 0 0 1-10 0H5a7 7 0 0 0 6 6.92V21h2v-3.08A7 7 0 0 0 19 11h-2Z"})]}),Eze=()=>u.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24","aria-hidden":"true",fill:"currentColor",children:u.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})});function Aze(e){const t=Math.floor(e/1e3),n=Math.floor(t/60),s=String(t%60).padStart(2,"0");return`${n}:${s}`}function Mze({onInsert:e,disabled:t}){var I;const n=Dh(),{t:s}=ot(),r=((I=n.capabilities)==null?void 0:I.features)??[],[i,o]=m.useState(void 0),{status:a,interimText:l,audioLevel:c,errorMessage:d,start:h,stop:f,abort:p}=dze({baseUrl:n.baseUrl,token:n.token,onFinal:A=>{const P=A.trim();P?(o(void 0),e(P)):o(s("voice.noSpeech"))}}),g=a==="recording",[y,w]=m.useState(()=>new Array(MB).fill(0));m.useEffect(()=>{if(!g){w(new Array(MB).fill(0));return}w(A=>[...A.slice(1),Math.min(1,c*8)])},[c,g]);const[v,b]=m.useState(0);if(m.useEffect(()=>{if(!g){b(0);return}const A=performance.now(),P=setInterval(()=>b(performance.now()-A),200);return()=>clearInterval(P)},[g]),!r.includes(Cze))return null;const x=a==="connecting",k=a==="transcribing",T=a==="error",C=!!i&&!T,S=g||x,_=g?s("voice.stopDictation"):k?s("voice.transcribing"):x?s("voice.starting"):T?s("voice.errorRetry",{message:d??""}):s(C?"voice.noSpeechRetry":"voice.startDictation");let L;if(g)L=u.jsxs("button",{type:"button",className:uo.pill,onClick:()=>f(),"aria-label":_,title:_,children:[u.jsx("span",{className:uo.recDot,"aria-hidden":"true"}),u.jsx("span",{className:uo.wave,"aria-hidden":"true",children:y.map((A,P)=>u.jsx("span",{className:uo.bar,style:{height:`${2+Math.round(A*14)}px`}},P))}),u.jsx("span",{className:uo.time,children:Aze(v)}),u.jsx("span",{className:uo.stop,"aria-hidden":"true",children:u.jsx(Eze,{})})]});else if(k)L=u.jsxs("span",{className:`${uo.pill} ${uo.transcribing}`,role:"status","aria-label":_,children:[u.jsx("span",{className:uo.spinner,"aria-hidden":"true"}),u.jsx("span",{className:uo.time,children:"…"})]});else{const A=[uo.iconBtn,T?uo.error:"",x?uo.connecting:""].filter(Boolean).join(" ");L=u.jsx("button",{type:"button",className:A,onClick:()=>{if(x)p();else{if(t)return;o(void 0),h()}},disabled:!!t&&!S,"aria-label":_,title:d??i??_,children:u.jsx(Tze,{})})}const M=g&&l||T||C;return u.jsxs("span",{className:uo.root,children:[L,M&&u.jsx("span",{role:"status","aria-live":"polite",className:`${uo.interim}${T?` ${uo.error}`:""}`,children:T?d||s("voice.error"):C?i:l})]})}function NB(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Nze(...e){return t=>{let n=!1;const s=e.map(r=>{const i=NB(r,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let r=0;r<s.length;r++){const i=s[r];typeof i=="function"?i():NB(e[r],null)}}}}function Rs(...e){return m.useCallback(Nze(...e),e)}function am(e){const t=m.forwardRef((n,s)=>{let{children:r,...i}=n,o=null,a=!1;const l=[];IB(r)&&typeof Aw=="function"&&(r=Aw(r._payload)),m.Children.forEach(r,f=>{var p;if(Dze(f)){a=!0;const g=f;let y="child"in g.props?g.props.child:g.props.children;IB(y)&&typeof Aw=="function"&&(y=Aw(y._payload)),o=Rze(g,y),l.push((p=o==null?void 0:o.props)==null?void 0:p.children)}else l.push(f)}),o?o=m.cloneElement(o,void 0,l):!a&&m.Children.count(r)===1&&m.isValidElement(r)&&(o=r);const c=o?Lze(o):void 0,d=Rs(s,c);if(!o){if(r||r===0)throw new Error(a?$ze(e):Bze(e));return r}const h=jze(i,o.props??{});return o.type!==m.Fragment&&(h.ref=s?d:c),m.cloneElement(o,h)});return t.displayName=`${e}.Slot`,t}var QQ=am("Slot"),JQ=Symbol.for("radix.slottable");function Ize(e){const t=n=>"child"in n?n.children(n.child):n.children;return t.displayName=`${e}.Slottable`,t.__radixId=JQ,t}var Rze=(e,t)=>{if("child"in e.props){const n=e.props.child;return m.isValidElement(n)?m.cloneElement(n,void 0,e.props.children(n.props.children)):null}return m.isValidElement(t)?t:null};function jze(e,t){const n={...t};for(const s in t){const r=e[s],i=t[s];/^on[A-Z]/.test(s)?r&&i?n[s]=(...a)=>{const l=i(...a);return r(...a),l}:r&&(n[s]=r):s==="style"?n[s]={...r,...i}:s==="className"&&(n[s]=[r,i].filter(Boolean).join(" "))}return{...e,...n}}function Lze(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Dze(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===JQ}var Oze=Symbol.for("react.lazy");function IB(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Oze&&"_payload"in e&&Pze(e._payload)}function Pze(e){return typeof e=="object"&&e!==null&&"then"in e}var Bze=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,$ze=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,Aw=K2[" use ".trim().toString()],zze=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Fn=zze.reduce((e,t)=>{const n=am(`Primitive.${t}`),s=m.forwardRef((r,i)=>{const{asChild:o,...a}=r,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(l,{...a,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function ZQ(e,t){e&&_l.flushSync(()=>e.dispatchEvent(t))}var eJ=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Fze="VisuallyHidden",tJ=m.forwardRef((e,t)=>u.jsx(Fn.span,{...e,ref:t,style:{...eJ,...e.style}}));tJ.displayName=Fze;var qze=tJ;function Kc(e,t=[]){let n=[];function s(i,o){const a=m.createContext(o);a.displayName=i+"Context";const l=n.length;n=[...n,o];const c=h=>{var v;const{scope:f,children:p,...g}=h,y=((v=f==null?void 0:f[e])==null?void 0:v[l])||a,w=m.useMemo(()=>g,Object.values(g));return u.jsx(y.Provider,{value:w,children:p})};c.displayName=i+"Provider";function d(h,f,p={}){var v;const{optional:g=!1}=p,y=((v=f==null?void 0:f[e])==null?void 0:v[l])||a,w=m.useContext(y);if(w)return w;if(o!==void 0)return o;if(!g)throw new Error(`\`${h}\` must be used within \`${i}\``)}return[c,d]}const r=()=>{const i=n.map(o=>m.createContext(o));return function(a){const l=(a==null?void 0:a[e])||i;return m.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return r.scopeName=e,[s,Hze(r,...t)]}function Hze(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(i){const o=s.reduce((a,{useScope:l,scopeName:c})=>{const h=l(i)[`__scope${c}`];return{...a,...h}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}function K9(e){const t=e+"CollectionProvider",[n,s]=Kc(t),[r,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=y=>{const{scope:w,children:v}=y,b=m.useRef(null),x=m.useRef(new Map).current;return u.jsx(r,{scope:w,itemMap:x,collectionRef:b,children:v})};o.displayName=t;const a=e+"CollectionSlot",l=am(a),c=m.forwardRef((y,w)=>{const{scope:v,children:b}=y,x=i(a,v),k=Rs(w,x.collectionRef);return u.jsx(l,{ref:k,children:b})});c.displayName=a;const d=e+"CollectionItemSlot",h="data-radix-collection-item",f=am(d),p=m.forwardRef((y,w)=>{const{scope:v,children:b,...x}=y,k=m.useRef(null),T=Rs(w,k),C=i(d,v);return m.useEffect(()=>(C.itemMap.set(k,{ref:k,...x}),()=>void C.itemMap.delete(k))),u.jsx(f,{[h]:"",ref:T,children:b})});p.displayName=d;function g(y){const w=i(e+"CollectionConsumer",y);return m.useCallback(()=>{const b=w.collectionRef.current;if(!b)return[];const x=Array.from(b.querySelectorAll(`[${h}]`));return Array.from(w.itemMap.values()).sort((C,S)=>x.indexOf(C.ref.current)-x.indexOf(S.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:o,Slot:c,ItemSlot:p},g,s]}function Zt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e==null||e(r),n===!1||!r||!r.defaultPrevented)return t==null?void 0:t(r)}}var Hi=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},Uze=K2[" useInsertionEffect ".trim().toString()]||Hi;function Wu({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[r,i,o]=Vze({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:r;{const d=m.useRef(e!==void 0);m.useEffect(()=>{const h=d.current;h!==a&&console.warn(`${s} is changing from ${h?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=a},[a,s])}const c=m.useCallback(d=>{var h;if(a){const f=Wze(d)?d(e):d;f!==e&&((h=o.current)==null||h.call(o,f))}else i(d)},[a,e,i,o]);return[l,c]}function Vze({defaultProp:e,onChange:t}){const[n,s]=m.useState(e),r=m.useRef(n),i=m.useRef(t);return Uze(()=>{i.current=t},[t]),m.useEffect(()=>{var o;r.current!==n&&((o=i.current)==null||o.call(i,n),r.current=n)},[n,r]),[n,s,i]}function Wze(e){return typeof e=="function"}function Gze(e,t){return m.useReducer((n,s)=>t[n][s]??n,e)}var Cl=e=>{const{present:t,children:n}=e,s=Kze(t),r=typeof n=="function"?n({present:s.isPresent}):m.Children.only(n),i=Yze(s.ref,Xze(r));return typeof n=="function"||s.isPresent?m.cloneElement(r,{ref:i}):null};Cl.displayName="Presence";function Kze(e){const[t,n]=m.useState(),s=m.useRef(null),r=m.useRef(e),i=m.useRef("none"),o=m.useRef(void 0),a=e?"mounted":"unmounted",[l,c]=Gze(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{l==="mounted"?(i.current=o.current??Xg(s.current),o.current=void 0):i.current="none"},[l]),Hi(()=>{const d=s.current,h=r.current;if(h!==e){const p=i.current,g=Xg(d);e?(o.current=g,c("MOUNT")):g==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(h&&p!==g?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,c]),Hi(()=>{if(t){let d;const h=t.ownerDocument.defaultView??window,f=g=>{const w=Xg(s.current).includes(CSS.escape(g.animationName));if(g.target===t&&w&&(c("ANIMATION_END"),!r.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",d=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},p=g=>{g.target===t&&(i.current=Xg(s.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{h.clearTimeout(d),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:m.useCallback(d=>{if(d){const h=getComputedStyle(d);s.current=h,o.current=Xg(h)}else s.current=null;n(d)},[])}}function RB(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Yze(...e){const t=m.useRef(e);return t.current=e,m.useCallback(n=>{const s=t.current;let r=!1;const i=s.map(o=>{const a=RB(o,n);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let o=0;o<i.length;o++){const a=i[o];typeof a=="function"?a():RB(s[o],null)}}},[])}function Xg(e){return(e==null?void 0:e.animationName)||"none"}function Xze(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Qze=K2[" useId ".trim().toString()]||(()=>{}),Jze=0;function ja(e){const[t,n]=m.useState(Qze());return Hi(()=>{n(s=>s??String(Jze++))},[e]),t?`radix-${t}`:""}var Zze=m.createContext(void 0);function p4(e){const t=m.useContext(Zze);return e||t||"ltr"}function Pa(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}var eFe="DismissableLayer",Z8="dismissableLayer.update",tFe="dismissableLayer.pointerDownOutside",nFe="dismissableLayer.focusOutside",jB,Y9=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Ob=m.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:s=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...c}=e,d=m.useContext(Y9),[h,f]=m.useState(null),p=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=m.useState({}),y=Rs(t,f),w=Array.from(d.layers),[v]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=v?w.indexOf(v):-1,x=h?w.indexOf(h):-1,k=d.layersWithOutsidePointerEventsDisabled.size>0,T=x>=b,C=m.useRef(!1),S=aFe(I=>{i==null||i(I),a==null||a(I),I.defaultPrevented||l==null||l()},{ownerDocument:p,deferPointerDownOutside:s,isDeferredPointerDownOutsideRef:C,dismissableSurfaces:d.dismissableSurfaces,shouldHandlePointerDownOutside:m.useCallback(I=>{if(!(I instanceof Node))return!1;const A=[...d.branches].some(P=>P.contains(I));return T&&!A},[d.branches,T])}),_=lFe(I=>{if(s&&C.current)return;const A=I.target;[...d.branches].some(B=>B.contains(A))||(o==null||o(I),a==null||a(I),I.defaultPrevented||l==null||l())},p),L=h?x===w.length-1:!1,M=Pa(I=>{I.key==="Escape"&&(r==null||r(I),!I.defaultPrevented&&l&&(I.preventDefault(),l()))});return m.useEffect(()=>{if(L)return p.addEventListener("keydown",M,{capture:!0}),()=>p.removeEventListener("keydown",M,{capture:!0})},[p,L,M]),m.useEffect(()=>{if(h)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(jB=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(h)),d.layers.add(h),LB(),()=>{n&&(d.layersWithOutsidePointerEventsDisabled.delete(h),d.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=jB))}},[h,p,n,d]),m.useEffect(()=>()=>{h&&(d.layers.delete(h),d.layersWithOutsidePointerEventsDisabled.delete(h),LB())},[h,d]),m.useEffect(()=>{const I=()=>g({});return document.addEventListener(Z8,I),()=>document.removeEventListener(Z8,I)},[]),u.jsx(Fn.div,{...c,ref:y,style:{pointerEvents:k?T?"auto":"none":void 0,...e.style},onFocusCapture:Zt(e.onFocusCapture,_.onFocusCapture),onBlurCapture:Zt(e.onBlurCapture,_.onBlurCapture),onPointerDownCapture:Zt(e.onPointerDownCapture,S.onPointerDownCapture)})});Ob.displayName=eFe;var sFe="DismissableLayerBranch",rFe=m.forwardRef((e,t)=>{const n=m.useContext(Y9),s=m.useRef(null),r=Rs(t,s);return m.useEffect(()=>{const i=s.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),u.jsx(Fn.div,{...e,ref:r})});rFe.displayName=sFe;function iFe(){const e=m.useContext(Y9),[t,n]=m.useState(null);return m.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}var oFe=()=>!0;function aFe(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:s=!1,isDeferredPointerDownOutsideRef:r,dismissableSurfaces:i,shouldHandlePointerDownOutside:o=oFe}=t,a=Pa(e),l=m.useRef(!1),c=m.useRef(!1),d=m.useRef(new Map),h=m.useRef(()=>{});return m.useEffect(()=>{function f(){c.current=!1,r.current=!1,d.current.clear()}function p(){return Array.from(d.current.values()).some(Boolean)}function g(x){if(!c.current)return;const k=x.target;k instanceof Node&&[...i].some(C=>C.contains(k))||d.current.set(x.type,!0),x.type==="click"&&window.setTimeout(()=>{c.current&&h.current()},0)}function y(x){c.current&&d.current.set(x.type,!1)}const w=x=>{if(x.target&&!l.current){let k=function(){n.removeEventListener("click",h.current);const C=p();f(),C||nJ(tFe,a,T,{discrete:!0})};if(!o(x.target)){n.removeEventListener("click",h.current),f(),l.current=!1;return}const T={originalEvent:x};c.current=!0,r.current=s&&x.button===0,d.current.clear(),!s||x.button!==0?k():(n.removeEventListener("click",h.current),h.current=k,n.addEventListener("click",h.current,{once:!0}))}else n.removeEventListener("click",h.current),f();l.current=!1},v=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const x of v)n.addEventListener(x,g,!0),n.addEventListener(x,y);const b=window.setTimeout(()=>{n.addEventListener("pointerdown",w)},0);return()=>{window.clearTimeout(b),n.removeEventListener("pointerdown",w),n.removeEventListener("click",h.current);for(const x of v)n.removeEventListener(x,g,!0),n.removeEventListener(x,y)}},[n,a,s,r,i,o]),{onPointerDownCapture:()=>l.current=!0}}function lFe(e,t=globalThis==null?void 0:globalThis.document){const n=Pa(e),s=m.useRef(!1);return m.useEffect(()=>{const r=i=>{i.target&&!s.current&&nJ(nFe,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function LB(){const e=new CustomEvent(Z8);document.dispatchEvent(e)}function nJ(e,t,n,{discrete:s}){const r=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),s?ZQ(r,i):r.dispatchEvent(i)}var nC="focusScope.autoFocusOnMount",sC="focusScope.autoFocusOnUnmount",DB={bubbles:!1,cancelable:!0},cFe="FocusScope",g4=m.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:r,onUnmountAutoFocus:i,...o}=e,[a,l]=m.useState(null),c=Pa(r),d=Pa(i),h=m.useRef(null),f=Rs(t,l),p=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(s){let y=function(x){if(p.paused||!a)return;const k=x.target;a.contains(k)?h.current=k:Td(h.current,{select:!0})},w=function(x){if(p.paused||!a)return;const k=x.relatedTarget;k!==null&&(a.contains(k)||Td(h.current,{select:!0}))},v=function(x){if(document.activeElement===document.body)for(const T of x)T.removedNodes.length>0&&Td(a)};document.addEventListener("focusin",y),document.addEventListener("focusout",w);const b=new MutationObserver(v);return a&&b.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",w),b.disconnect()}}},[s,a,p.paused]),m.useEffect(()=>{if(a){PB.add(p);const y=document.activeElement;if(!a.contains(y)){const v=new CustomEvent(nC,DB);a.addEventListener(nC,c),a.dispatchEvent(v),v.defaultPrevented||(uFe(pFe(sJ(a)),{select:!0}),document.activeElement===y&&Td(a))}return()=>{a.removeEventListener(nC,c),setTimeout(()=>{const v=new CustomEvent(sC,DB);a.addEventListener(sC,d),a.dispatchEvent(v),v.defaultPrevented||Td(y??document.body,{select:!0}),a.removeEventListener(sC,d),PB.remove(p)},0)}}},[a,c,d,p]);const g=m.useCallback(y=>{if(!n&&!s||p.paused)return;const w=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,v=document.activeElement;if(w&&v){const b=y.currentTarget,[x,k]=dFe(b);x&&k?!y.shiftKey&&v===k?(y.preventDefault(),n&&Td(x,{select:!0})):y.shiftKey&&v===x&&(y.preventDefault(),n&&Td(k,{select:!0})):v===b&&y.preventDefault()}},[n,s,p.paused]);return u.jsx(Fn.div,{tabIndex:-1,...o,ref:f,onKeyDown:g})});g4.displayName=cFe;function uFe(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(Td(s,{select:t}),document.activeElement!==n)return}function dFe(e){const t=sJ(e),n=OB(t,e),s=OB(t.reverse(),e);return[n,s]}function sJ(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const r=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||r?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function OB(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const s of e)if(!(n?!s.checkVisibility({checkVisibilityCSS:!0}):hFe(s,{upTo:t})))return s}function hFe(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function fFe(e){return e instanceof HTMLInputElement&&"select"in e}function Td(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&fFe(e)&&t&&e.select()}}var PB=mFe();function mFe(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=BB(e,t),e.unshift(t)},remove(t){var n;e=BB(e,t),(n=e[0])==null||n.resume()}}}function BB(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function pFe(e){return e.filter(t=>t.tagName!=="A")}var gFe="Portal",Pb=m.forwardRef((e,t)=>{var a;const{container:n,...s}=e,[r,i]=m.useState(!1);Hi(()=>i(!0),[]);const o=n||r&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?_l.createPortal(u.jsx(Fn.div,{...s,ref:t}),o):null});Pb.displayName=gFe;var Mw=0,sc=null;function X9(){m.useEffect(()=>{sc||(sc={start:$B(),end:$B()});const{start:e,end:t}=sc;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Mw++,()=>{Mw===1&&(sc==null||sc.start.remove(),sc==null||sc.end.remove(),sc=null),Mw=Math.max(0,Mw-1)}},[])}function $B(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var yc=function(){return yc=Object.assign||function(t){for(var n,s=1,r=arguments.length;s<r;s++){n=arguments[s];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},yc.apply(this,arguments)};function rJ(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,s=Object.getOwnPropertySymbols(e);r<s.length;r++)t.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(e,s[r])&&(n[s[r]]=e[s[r]]);return n}function yFe(e,t,n){if(n||arguments.length===2)for(var s=0,r=t.length,i;s<r;s++)(i||!(s in t))&&(i||(i=Array.prototype.slice.call(t,0,s)),i[s]=t[s]);return e.concat(i||Array.prototype.slice.call(t))}var Px="right-scroll-bar-position",Bx="width-before-scroll-bar",bFe="with-scroll-bars-hidden",vFe="--removed-body-scroll-bar-size";function rC(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function wFe(e,t){var n=m.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var r=n.value;r!==s&&(n.value=s,n.callback(s,r))}}}})[0];return n.callback=t,n.facade}var xFe=typeof window<"u"?m.useLayoutEffect:m.useEffect,zB=new WeakMap;function kFe(e,t){var n=wFe(null,function(s){return e.forEach(function(r){return rC(r,s)})});return xFe(function(){var s=zB.get(n);if(s){var r=new Set(s),i=new Set(e),o=n.current;r.forEach(function(a){i.has(a)||rC(a,null)}),i.forEach(function(a){r.has(a)||rC(a,o)})}zB.set(n,e)},[e]),n}function _Fe(e){return e}function SFe(e,t){t===void 0&&(t=_Fe);var n=[],s=!1,r={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var o=t(i,s);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(i){for(s=!0;n.length;){var o=n;n=[],o.forEach(i)}n={push:function(a){return i(a)},filter:function(){return n}}},assignMedium:function(i){s=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(i),o=n}var l=function(){var d=o;o=[],d.forEach(i)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(d){o.push(d),c()},filter:function(d){return o=o.filter(d),n}}}};return r}function CFe(e){e===void 0&&(e={});var t=SFe(null);return t.options=yc({async:!0,ssr:!1},e),t}var iJ=function(e){var t=e.sideCar,n=rJ(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return m.createElement(s,yc({},n))};iJ.isSideCarExport=!0;function TFe(e,t){return e.useMedium(t),iJ}var oJ=CFe(),iC=function(){},y4=m.forwardRef(function(e,t){var n=m.useRef(null),s=m.useState({onScrollCapture:iC,onWheelCapture:iC,onTouchMoveCapture:iC}),r=s[0],i=s[1],o=e.forwardProps,a=e.children,l=e.className,c=e.removeScrollBar,d=e.enabled,h=e.shards,f=e.sideCar,p=e.noRelative,g=e.noIsolation,y=e.inert,w=e.allowPinchZoom,v=e.as,b=v===void 0?"div":v,x=e.gapMode,k=rJ(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),T=f,C=kFe([n,t]),S=yc(yc({},k),r);return m.createElement(m.Fragment,null,d&&m.createElement(T,{sideCar:oJ,removeScrollBar:c,shards:h,noRelative:p,noIsolation:g,inert:y,setCallbacks:i,allowPinchZoom:!!w,lockRef:n,gapMode:x}),o?m.cloneElement(m.Children.only(a),yc(yc({},S),{ref:C})):m.createElement(b,yc({},S,{className:l,ref:C}),a))});y4.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};y4.classNames={fullWidth:Bx,zeroRight:Px};var EFe=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function AFe(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=EFe();return t&&e.setAttribute("nonce",t),e}function MFe(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function NFe(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var IFe=function(){var e=0,t=null;return{add:function(n){e==0&&(t=AFe())&&(MFe(t,n),NFe(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},RFe=function(){var e=IFe();return function(t,n){m.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},aJ=function(){var e=RFe(),t=function(n){var s=n.styles,r=n.dynamic;return e(s,r),null};return t},jFe={left:0,top:0,right:0,gap:0},oC=function(e){return parseInt(e||"",10)||0},LFe=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],r=t[e==="padding"?"paddingRight":"marginRight"];return[oC(n),oC(s),oC(r)]},DFe=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return jFe;var t=LFe(e),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-n+t[2]-t[0])}},OFe=aJ(),n0="data-scroll-locked",PFe=function(e,t,n,s){var r=e.left,i=e.top,o=e.right,a=e.gap;return n===void 0&&(n="margin"),`
  .`.concat(bFe,` {
   overflow: hidden `).concat(s,`;
   padding-right: `).concat(a,"px ").concat(s,`;
  }
  body[`).concat(n0,`] {
    overflow: hidden `).concat(s,`;
    overscroll-behavior: contain;
    `).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&`
    padding-left: `.concat(r,`px;
    padding-top: `).concat(i,`px;
    padding-right: `).concat(o,`px;
    margin-left:0;
    margin-top:0;
    margin-right: `).concat(a,"px ").concat(s,`;
    `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(s,";")].filter(Boolean).join(""),`
  }
  
  .`).concat(Px,` {
    right: `).concat(a,"px ").concat(s,`;
  }
  
  .`).concat(Bx,` {
    margin-right: `).concat(a,"px ").concat(s,`;
  }
  
  .`).concat(Px," .").concat(Px,` {
    right: 0 `).concat(s,`;
  }
  
  .`).concat(Bx," .").concat(Bx,` {
    margin-right: 0 `).concat(s,`;
  }
  
  body[`).concat(n0,`] {
    `).concat(vFe,": ").concat(a,`px;
  }
`)},FB=function(){var e=parseInt(document.body.getAttribute(n0)||"0",10);return isFinite(e)?e:0},BFe=function(){m.useEffect(function(){return document.body.setAttribute(n0,(FB()+1).toString()),function(){var e=FB()-1;e<=0?document.body.removeAttribute(n0):document.body.setAttribute(n0,e.toString())}},[])},$Fe=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,r=s===void 0?"margin":s;BFe();var i=m.useMemo(function(){return DFe(r)},[r]);return m.createElement(OFe,{styles:PFe(i,!t,r,n?"":"!important")})},e7=!1;if(typeof window<"u")try{var Nw=Object.defineProperty({},"passive",{get:function(){return e7=!0,!0}});window.addEventListener("test",Nw,Nw),window.removeEventListener("test",Nw,Nw)}catch{e7=!1}var Ym=e7?{passive:!1}:!1,zFe=function(e){return e.tagName==="TEXTAREA"},lJ=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!zFe(e)&&n[t]==="visible")},FFe=function(e){return lJ(e,"overflowY")},qFe=function(e){return lJ(e,"overflowX")},qB=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var r=cJ(e,s);if(r){var i=uJ(e,s),o=i[1],a=i[2];if(o>a)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},HFe=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},UFe=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},cJ=function(e,t){return e==="v"?FFe(t):qFe(t)},uJ=function(e,t){return e==="v"?HFe(t):UFe(t)},VFe=function(e,t){return e==="h"&&t==="rtl"?-1:1},WFe=function(e,t,n,s,r){var i=VFe(e,window.getComputedStyle(t).direction),o=i*s,a=n.target,l=t.contains(a),c=!1,d=o>0,h=0,f=0;do{if(!a)break;var p=uJ(e,a),g=p[0],y=p[1],w=p[2],v=y-w-i*g;(g||v)&&cJ(e,a)&&(h+=v,f+=g);var b=a.parentNode;a=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(d&&Math.abs(h)<1||!d&&Math.abs(f)<1)&&(c=!0),c},Iw=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},HB=function(e){return[e.deltaX,e.deltaY]},UB=function(e){return e&&"current"in e?e.current:e},GFe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},KFe=function(e){return`
  .block-interactivity-`.concat(e,` {pointer-events: none;}
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
`)},YFe=0,Xm=[];function XFe(e){var t=m.useRef([]),n=m.useRef([0,0]),s=m.useRef(),r=m.useState(YFe++)[0],i=m.useState(aJ)[0],o=m.useRef(e);m.useEffect(function(){o.current=e},[e]),m.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var y=yFe([e.lockRef.current],(e.shards||[]).map(UB),!0).filter(Boolean);return y.forEach(function(w){return w.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),y.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var a=m.useCallback(function(y,w){if("touches"in y&&y.touches.length===2||y.type==="wheel"&&y.ctrlKey)return!o.current.allowPinchZoom;var v=Iw(y),b=n.current,x="deltaX"in y?y.deltaX:b[0]-v[0],k="deltaY"in y?y.deltaY:b[1]-v[1],T,C=y.target,S=Math.abs(x)>Math.abs(k)?"h":"v";if("touches"in y&&S==="h"&&C.type==="range")return!1;var _=window.getSelection(),L=_&&_.anchorNode,M=L?L===C||L.contains(C):!1;if(M)return!1;var I=qB(S,C);if(!I)return!0;if(I?T=S:(T=S==="v"?"h":"v",I=qB(S,C)),!I)return!1;if(!s.current&&"changedTouches"in y&&(x||k)&&(s.current=T),!T)return!0;var A=s.current||T;return WFe(A,w,y,A==="h"?x:k)},[]),l=m.useCallback(function(y){var w=y;if(!(!Xm.length||Xm[Xm.length-1]!==i)){var v="deltaY"in w?HB(w):Iw(w),b=t.current.filter(function(T){return T.name===w.type&&(T.target===w.target||w.target===T.shadowParent)&&GFe(T.delta,v)})[0];if(b&&b.should){w.cancelable&&w.preventDefault();return}if(!b){var x=(o.current.shards||[]).map(UB).filter(Boolean).filter(function(T){return T.contains(w.target)}),k=x.length>0?a(w,x[0]):!o.current.noIsolation;k&&w.cancelable&&w.preventDefault()}}},[]),c=m.useCallback(function(y,w,v,b){var x={name:y,delta:w,target:v,should:b,shadowParent:QFe(v)};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(k){return k!==x})},1)},[]),d=m.useCallback(function(y){n.current=Iw(y),s.current=void 0},[]),h=m.useCallback(function(y){c(y.type,HB(y),y.target,a(y,e.lockRef.current))},[]),f=m.useCallback(function(y){c(y.type,Iw(y),y.target,a(y,e.lockRef.current))},[]);m.useEffect(function(){return Xm.push(i),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:f}),document.addEventListener("wheel",l,Ym),document.addEventListener("touchmove",l,Ym),document.addEventListener("touchstart",d,Ym),function(){Xm=Xm.filter(function(y){return y!==i}),document.removeEventListener("wheel",l,Ym),document.removeEventListener("touchmove",l,Ym),document.removeEventListener("touchstart",d,Ym)}},[]);var p=e.removeScrollBar,g=e.inert;return m.createElement(m.Fragment,null,g?m.createElement(i,{styles:KFe(r)}):null,p?m.createElement($Fe,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function QFe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const JFe=TFe(oJ,XFe);var b4=m.forwardRef(function(e,t){return m.createElement(y4,yc({},e,{ref:t,sideCar:JFe}))});b4.classNames=y4.classNames;var ZFe=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Qm=new WeakMap,Rw=new WeakMap,jw={},aC=0,dJ=function(e){return e&&(e.host||dJ(e.parentNode))},eqe=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=dJ(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},tqe=function(e,t,n,s){var r=eqe(t,Array.isArray(e)?e:[e]);jw[n]||(jw[n]=new WeakMap);var i=jw[n],o=[],a=new Set,l=new Set(r),c=function(h){!h||a.has(h)||(a.add(h),c(h.parentNode))};r.forEach(c);var d=function(h){!h||l.has(h)||Array.prototype.forEach.call(h.children,function(f){if(a.has(f))d(f);else try{var p=f.getAttribute(s),g=p!==null&&p!=="false",y=(Qm.get(f)||0)+1,w=(i.get(f)||0)+1;Qm.set(f,y),i.set(f,w),o.push(f),y===1&&g&&Rw.set(f,!0),w===1&&f.setAttribute(n,"true"),g||f.setAttribute(s,"true")}catch(v){console.error("aria-hidden: cannot operate on ",f,v)}})};return d(t),a.clear(),aC++,function(){o.forEach(function(h){var f=Qm.get(h)-1,p=i.get(h)-1;Qm.set(h,f),i.set(h,p),f||(Rw.has(h)||h.removeAttribute(s),Rw.delete(h)),p||h.removeAttribute(n)}),aC--,aC||(Qm=new WeakMap,Qm=new WeakMap,Rw=new WeakMap,jw={})}},Q9=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),r=ZFe(e);return r?(s.push.apply(s,Array.from(r.querySelectorAll("[aria-live], script"))),tqe(s,r,n,"aria-hidden")):function(){return null}},v4="Dialog",[hJ,Y0t]=Kc(v4),[nqe,Fl]=hJ(v4),fJ=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:r,onOpenChange:i,modal:o=!0}=e,a=m.useRef(null),l=m.useRef(null),[c,d]=Wu({prop:s,defaultProp:r??!1,onChange:i,caller:v4});return u.jsx(nqe,{scope:t,triggerRef:a,contentRef:l,contentId:ja(),titleId:ja(),descriptionId:ja(),open:c,onOpenChange:d,onOpenToggle:m.useCallback(()=>d(h=>!h),[d]),modal:o,children:n})};fJ.displayName=v4;var mJ="DialogTrigger",sqe=m.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Fl(mJ,n),i=Rs(t,r.triggerRef);return u.jsx(Fn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.open?r.contentId:void 0,"data-state":eM(r.open),...s,ref:i,onClick:Zt(e.onClick,r.onOpenToggle)})});sqe.displayName=mJ;var J9="DialogPortal",[rqe,pJ]=hJ(J9,{forceMount:void 0}),gJ=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:r}=e,i=Fl(J9,t);return u.jsx(rqe,{scope:t,forceMount:n,children:m.Children.map(s,o=>u.jsx(Cl,{present:n||i.open,children:u.jsx(Pb,{asChild:!0,container:r,children:o})}))})};gJ.displayName=J9;var R2="DialogOverlay",yJ=m.forwardRef((e,t)=>{const n=pJ(R2,e.__scopeDialog),{forceMount:s=n.forceMount,...r}=e,i=Fl(R2,e.__scopeDialog);return i.modal?u.jsx(Cl,{present:s||i.open,children:u.jsx(oqe,{...r,ref:t})}):null});yJ.displayName=R2;var iqe=am("DialogOverlay.RemoveScroll"),oqe=m.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Fl(R2,n),i=iFe(),o=Rs(t,i);return u.jsx(b4,{as:iqe,allowPinchZoom:!0,shards:[r.contentRef],children:u.jsx(Fn.div,{"data-state":eM(r.open),...s,ref:o,style:{pointerEvents:"auto",...s.style}})})}),j0="DialogContent",bJ=m.forwardRef((e,t)=>{const n=pJ(j0,e.__scopeDialog),{forceMount:s=n.forceMount,...r}=e,i=Fl(j0,e.__scopeDialog);return u.jsx(Cl,{present:s||i.open,children:i.modal?u.jsx(aqe,{...r,ref:t}):u.jsx(lqe,{...r,ref:t})})});bJ.displayName=j0;var aqe=m.forwardRef((e,t)=>{const n=Fl(j0,e.__scopeDialog),s=m.useRef(null),r=Rs(t,n.contentRef,s);return m.useEffect(()=>{const i=s.current;if(i)return Q9(i)},[]),u.jsx(vJ,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Zt(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Zt(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&i.preventDefault()}),onFocusOutside:Zt(e.onFocusOutside,i=>i.preventDefault())})}),lqe=m.forwardRef((e,t)=>{const n=Fl(j0,e.__scopeDialog),s=m.useRef(!1),r=m.useRef(!1);return u.jsx(vJ,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,a;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(s.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),s.current=!1,r.current=!1},onInteractOutside:i=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(s.current=!0,i.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const o=i.target;((c=n.triggerRef.current)==null?void 0:c.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&r.current&&i.preventDefault()}})}),vJ=m.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:r,onCloseAutoFocus:i,...o}=e,a=Fl(j0,n);return X9(),u.jsx(u.Fragment,{children:u.jsx(g4,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:r,onUnmountAutoFocus:i,children:u.jsx(Ob,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":eM(a.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>a.onOpenChange(!1)})})})}),wJ="DialogTitle",xJ=m.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Fl(wJ,n);return u.jsx(Fn.h2,{id:r.titleId,...s,ref:t})});xJ.displayName=wJ;var kJ="DialogDescription",_J=m.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Fl(kJ,n);return u.jsx(Fn.p,{id:r.descriptionId,...s,ref:t})});_J.displayName=kJ;var SJ="DialogClose",Z9=m.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Fl(SJ,n);return u.jsx(Fn.button,{type:"button",...s,ref:t,onClick:Zt(e.onClick,()=>r.onOpenChange(!1))})});Z9.displayName=SJ;function eM(e){return e?"open":"closed"}function CJ(e){const t=m.useRef({value:e,previous:e});return m.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function TJ(e){const[t,n]=m.useState(void 0);return Hi(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const i=r[0];let o,a;if("borderBoxSize"in i){const l=i.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=e.offsetWidth,a=e.offsetHeight;n({width:o,height:a})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}const cqe=["top","right","bottom","left"],Mh=Math.min,Ru=Math.max,j2=Math.round,Lw=Math.floor,ju=e=>({x:e,y:e}),uqe={left:"right",right:"left",bottom:"top",top:"bottom"};function EJ(e,t,n){return Ru(e,Mh(t,n))}function Gu(e,t){return typeof e=="function"?e(t):e}function Nh(e){return e.split("-")[0]}function og(e){return e.split("-")[1]}function tM(e){return e==="x"?"y":"x"}function nM(e){return e==="y"?"height":"width"}function Ec(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function sM(e){return tM(Ec(e))}function dqe(e,t,n){n===void 0&&(n=!1);const s=og(e),r=sM(e),i=nM(r);let o=r==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=L2(o)),[o,L2(o)]}function hqe(e){const t=L2(e);return[t7(e),t,t7(t)]}function t7(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const VB=["left","right"],WB=["right","left"],fqe=["top","bottom"],mqe=["bottom","top"];function pqe(e,t,n){switch(e){case"top":case"bottom":return n?t?WB:VB:t?VB:WB;case"left":case"right":return t?fqe:mqe;default:return[]}}function gqe(e,t,n,s){const r=og(e);let i=pqe(Nh(e),n==="start",s);return r&&(i=i.map(o=>o+"-"+r),t&&(i=i.concat(i.map(t7)))),i}function L2(e){const t=Nh(e);return uqe[t]+e.slice(t.length)}function yqe(e){var t,n,s,r;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(s=e.bottom)!=null?s:0,left:(r=e.left)!=null?r:0}}function AJ(e){return typeof e!="number"?yqe(e):{top:e,right:e,bottom:e,left:e}}function D2(e){const{x:t,y:n,width:s,height:r}=e;return{width:s,height:r,top:n,left:t,right:t+s,bottom:n+r,x:t,y:n}}function GB(e,t,n){let{reference:s,floating:r}=e;const i=Ec(t),o=sM(t),a=nM(o),l=Nh(t),c=i==="y",d=s.x+s.width/2-r.width/2,h=s.y+s.height/2-r.height/2,f=s[a]/2-r[a]/2;let p;switch(l){case"top":p={x:d,y:s.y-r.height};break;case"bottom":p={x:d,y:s.y+s.height};break;case"right":p={x:s.x+s.width,y:h};break;case"left":p={x:s.x-r.width,y:h};break;default:p={x:s.x,y:s.y}}const g=og(t);return g&&(p[o]+=f*(g==="end"?1:-1)*(n&&c?-1:1)),p}async function bqe(e,t){var n;t===void 0&&(t={});const{x:s,y:r,platform:i,rects:o,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:f=!1,padding:p=0}=Gu(t,e),g=AJ(p),w=a[f?h==="floating"?"reference":"floating":h],v=D2(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(w)))==null||n?w:w.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:l})),b=h==="floating"?{x:s,y:r,width:o.floating.width,height:o.floating.height}:o.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),k=await(i.isElement==null?void 0:i.isElement(x))&&await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1},T=D2(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:x,strategy:l}):b);return{top:(v.top-T.top+g.top)/k.y,bottom:(T.bottom-v.bottom+g.bottom)/k.y,left:(v.left-T.left+g.left)/k.x,right:(T.right-v.right+g.right)/k.x}}const vqe=50,wqe=async(e,t,n)=>{const{placement:s="bottom",strategy:r="absolute",middleware:i=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:bqe},l=await(o.isRTL==null?void 0:o.isRTL(t));let c=await o.getElementRects({reference:e,floating:t,strategy:r}),{x:d,y:h}=GB(c,s,l),f=s,p=0;const g={};for(let y=0;y<i.length;y++){const w=i[y];if(!w)continue;const{name:v,fn:b}=w,{x,y:k,data:T,reset:C}=await b({x:d,y:h,initialPlacement:s,placement:f,strategy:r,middlewareData:g,rects:c,platform:a,elements:{reference:e,floating:t}});d=x??d,h=k??h,g[v]={...g[v],...T},C&&p<vqe&&(p++,typeof C=="object"&&(C.placement&&(f=C.placement),C.rects&&(c=C.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:r}):C.rects),{x:d,y:h}=GB(c,f,l)),y=-1)}return{x:d,y:h,placement:f,strategy:r,middlewareData:g}},xqe=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:r,rects:i,platform:o,elements:a,middlewareData:l}=t,{element:c,padding:d=0}=Gu(e,t)||{};if(c==null)return{};const h=AJ(d),f={x:n,y:s},p=sM(r),g=nM(p),y=await o.getDimensions(c),w=p==="y",v=w?"top":"left",b=w?"bottom":"right",x=w?"clientHeight":"clientWidth",k=i.reference[g]+i.reference[p]-f[p]-i.floating[g],T=f[p]-i.reference[p],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let S=C?C[x]:0;(!S||!await(o.isElement==null?void 0:o.isElement(C)))&&(S=a.floating[x]||i.floating[g]);const _=k/2-T/2,L=S/2-y[g]/2-1,M=Mh(h[v],L),I=Mh(h[b],L),A=S-y[g]-I,P=S/2-y[g]/2+_,B=EJ(M,P,A),F=!l.arrow&&og(r)!=null&&P!==B&&i.reference[g]/2-(P<M?M:I)-y[g]/2<0,O=F?P<M?P-M:P-A:0;return{[p]:f[p]+O,data:{[p]:B,centerOffset:P-B-O,...F&&{alignmentOffset:O}},reset:F}}}),kqe=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:r,middlewareData:i,rects:o,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:y=!0,...w}=Gu(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const v=Nh(r),b=Ec(a),x=Nh(a)===a,k=await(l.isRTL==null?void 0:l.isRTL(c.floating)),T=f||(x||!y?[L2(a)]:hqe(a)),C=g!=="none";!f&&C&&T.push(...gqe(a,y,g,k));const S=[a,...T],_=await l.detectOverflow(t,w),L=[];let M=((s=i.flip)==null?void 0:s.overflows)||[];if(d&&L.push(_[v]),h){const B=dqe(r,o,k);L.push(_[B[0]],_[B[1]])}if(M=[...M,{placement:r,overflows:L}],!L.every(B=>B<=0)){var I,A;const B=(((I=i.flip)==null?void 0:I.index)||0)+1,F=S[B];if(F&&(!(h==="alignment"?b!==Ec(F):!1)||M.every(z=>Ec(z.placement)===b?z.overflows[0]>0:!0)))return{data:{index:B,overflows:M},reset:{placement:F}};let O=(A=M.filter(X=>X.overflows[0]<=0).sort((X,z)=>X.overflows[1]-z.overflows[1])[0])==null?void 0:A.placement;if(!O)switch(p){case"bestFit":{var P;const X=(P=M.filter(z=>{if(C){const U=Ec(z.placement);return U===b||U==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(U=>U>0).reduce((U,D)=>U+D,0)]).sort((z,U)=>z[1]-U[1])[0])==null?void 0:P[0];X&&(O=X);break}case"initialPlacement":O=a;break}if(r!==O)return{reset:{placement:O}}}return{}}}};function KB(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function YB(e){return cqe.some(t=>e[t]>=0)}const _qe=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:r="referenceHidden",...i}=Gu(e,t);switch(r){case"referenceHidden":{const o=await s.detectOverflow(t,{...i,elementContext:"reference"}),a=KB(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:YB(a)}}}case"escaped":{const o=await s.detectOverflow(t,{...i,altBoundary:!0}),a=KB(o,n.floating);return{data:{escapedOffsets:a,escaped:YB(a)}}}default:return{}}}}},MJ=new Set(["left","top"]);async function Sqe(e,t){const{placement:n,platform:s,elements:r}=e,i=await(s.isRTL==null?void 0:s.isRTL(r.floating)),o=Nh(n),a=og(n),l=Ec(n)==="y",c=MJ.has(o)?-1:1,d=i&&l?-1:1,h=Gu(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:g}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof g=="number"&&(p=a==="end"?g*-1:g),l?{x:p*d,y:f*c}:{x:f*c,y:p*d}}const Cqe=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:r,y:i,placement:o,middlewareData:a}=t,l=await Sqe(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:r+l.x,y:i+l.y,data:{...l,placement:o}}}}},Tqe=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:r,platform:i}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:b=>{let{x,y:k}=b;return{x,y:k}}},...c}=Gu(e,t),d={x:n,y:s},h=await i.detectOverflow(t,c),f=Ec(r),p=tM(f);let g=d[p],y=d[f];const w=(b,x)=>EJ(x+h[b==="y"?"top":"left"],x,x-h[b==="y"?"bottom":"right"]);o&&(g=w(p,g)),a&&(y=w(f,y));const v=l.fn({...t,[p]:g,[f]:y});return{...v,data:{x:v.x-n,y:v.y-s,enabled:{[p]:o,[f]:a}}}}}},Eqe=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,s;const{x:r,y:i,placement:o,rects:a,middlewareData:l}=t,{offset:c=0,mainAxis:d=!0,crossAxis:h=!0}=Gu(e,t),f={x:r,y:i},p=Ec(o),g=tM(p);let y=f[g],w=f[p];const v=Gu(c,t),b=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:(n=v.mainAxis)!=null?n:0,crossAxis:(s=v.crossAxis)!=null?s:0};if(d){const T=g==="y"?"height":"width",C=a.reference[g]-a.floating[T]+b.mainAxis,S=a.reference[g]+a.reference[T]-b.mainAxis;y<C?y=C:y>S&&(y=S)}if(h){var x,k;const T=g==="y"?"width":"height",C=MJ.has(Nh(o)),S=a.reference[p]-a.floating[T]+(C&&((x=l.offset)==null?void 0:x[p])||0)+(C?0:b.crossAxis),_=a.reference[p]+a.reference[T]+(C?0:((k=l.offset)==null?void 0:k[p])||0)-(C?b.crossAxis:0);w<S?w=S:w>_&&(w=_)}return{[g]:y,[p]:w}}}},Aqe=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:s,platform:r,elements:i}=t,{apply:o=()=>{},...a}=Gu(e,t),l=await r.detectOverflow(t,a),c=Nh(n),d=og(n),h=Ec(n)==="y",{width:f,height:p}=s.floating;let g,y;c==="top"||c==="bottom"?(g=c,y=d===(await(r.isRTL==null?void 0:r.isRTL(i.floating))?"start":"end")?"left":"right"):(y=c,g=d==="end"?"top":"bottom");const w=p-l.top-l.bottom,v=f-l.left-l.right,b=Mh(p-l[g],w),x=Mh(f-l[y],v),k=t.middlewareData.shift,T=!k;let C=b,S=x;k!=null&&k.enabled.x&&(S=v),k!=null&&k.enabled.y&&(C=w),T&&!d&&(h?S=f-2*Ru(l.left,l.right):C=p-2*Ru(l.top,l.bottom)),await o({...t,availableWidth:S,availableHeight:C});const _=await r.getDimensions(i.floating);return f!==_.width||p!==_.height?{reset:{rects:!0}}:{}}}};function w4(){return typeof window<"u"}function ag(e){return NJ(e)?(e.nodeName||"").toLowerCase():"#document"}function ra(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function sd(e){var t;return(t=(NJ(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function NJ(e){return w4()?e instanceof Node||e instanceof ra(e).Node:!1}function Lc(e){return w4()?e instanceof Element||e instanceof ra(e).Element:!1}function zh(e){return w4()?e instanceof HTMLElement||e instanceof ra(e).HTMLElement:!1}function XB(e){return!w4()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ra(e).ShadowRoot}function x4(e){const{overflow:t,overflowX:n,overflowY:s,display:r}=Dc(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&r!=="inline"&&r!=="contents"}function Mqe(e){return/^(table|td|th)$/.test(ag(e))}function k4(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Nqe=/transform|translate|scale|rotate|perspective|filter/,Iqe=/paint|layout|strict|content/,df=e=>!!e&&e!=="none";let lC;function rM(e){const t=Lc(e)?Dc(e):e;return df(t.transform)||df(t.translate)||df(t.scale)||df(t.rotate)||df(t.perspective)||!iM()&&(df(t.backdropFilter)||df(t.filter))||Nqe.test(t.willChange||"")||Iqe.test(t.contain||"")}function Rqe(e){let t=lm(e);for(;zh(t)&&!Zy(t);){if(rM(t))return t;if(k4(t))return null;t=lm(t)}return null}function iM(){return lC==null&&(lC=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),lC}function Zy(e){return/^(html|body|#document)$/.test(ag(e))}function Dc(e){return ra(e).getComputedStyle(e)}function _4(e){return Lc(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function lm(e){if(ag(e)==="html")return e;const t=e.assignedSlot||e.parentNode||XB(e)&&e.host||sd(e);return XB(t)?t.host:t}function IJ(e){const t=lm(e);return Zy(t)?(e.ownerDocument||e).body:zh(t)&&x4(t)?t:IJ(t)}function eb(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=IJ(e),i=r===((s=e.ownerDocument)==null?void 0:s.body),o=ra(r);if(i){const a=n7(o);return t.concat(o,o.visualViewport||[],x4(r)?r:[],a&&n?eb(a):[])}else return t.concat(r,eb(r,[],n))}function n7(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function RJ(e){const t=Dc(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const r=zh(e),i=r?e.offsetWidth:n,o=r?e.offsetHeight:s,a=j2(n)!==i||j2(s)!==o;return a&&(n=i,s=o),{width:n,height:s,$:a}}function oM(e){return Lc(e)?e:e.contextElement}function s0(e){const t=oM(e);if(!zh(t))return ju(1);const n=t.getBoundingClientRect(),{width:s,height:r,$:i}=RJ(t);let o=(i?j2(n.width):n.width)/s,a=(i?j2(n.height):n.height)/r;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const jqe=ju(0);function jJ(e){const t=ra(e);return!iM()||!t.visualViewport?jqe:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Lqe(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===ra(e)}function cm(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),i=oM(e);let o=ju(1);t&&(s?Lc(s)&&(o=s0(s)):o=s0(e));const a=Lqe(i,n,s)?jJ(i):ju(0);let l=(r.left+a.x)/o.x,c=(r.top+a.y)/o.y,d=r.width/o.x,h=r.height/o.y;if(i&&s){const f=ra(i),p=Lc(s)?ra(s):s;let g=f,y=n7(g);for(;y&&p!==g;){const w=s0(y),v=y.getBoundingClientRect(),b=Dc(y),x=v.left+(y.clientLeft+parseFloat(b.paddingLeft))*w.x,k=v.top+(y.clientTop+parseFloat(b.paddingTop))*w.y;l*=w.x,c*=w.y,d*=w.x,h*=w.y,l+=x,c+=k,g=ra(y),y=n7(g)}}return D2({width:d,height:h,x:l,y:c})}function S4(e,t){const n=_4(e).scrollLeft;return t?t.left+n:cm(sd(e)).left+n}function LJ(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-S4(e,n),r=n.top+t.scrollTop;return{x:s,y:r}}function Dqe(e){let{elements:t,rect:n,offsetParent:s,strategy:r}=e;const i=r==="fixed",o=sd(s),a=t?k4(t.floating):!1;if(s===o||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=ju(1);const d=ju(0),h=zh(s);if((h||!i)&&((ag(s)!=="body"||x4(o))&&(l=_4(s)),h)){const p=cm(s);c=s0(s),d.x=p.x+s.clientLeft,d.y=p.y+s.clientTop}const f=o&&!h&&!i?LJ(o,l):ju(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+d.x+f.x,y:n.y*c.y-l.scrollTop*c.y+d.y+f.y}}function Oqe(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Pqe(e){const t=_4(e),n=e.ownerDocument.body,s=Ru(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=Ru(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-t.scrollLeft+S4(e);const o=-t.scrollTop;return Dc(n).direction==="rtl"&&(i+=Ru(e.clientWidth,n.clientWidth)-s),{width:s,height:r,x:i,y:o}}const Bqe=25;function $qe(e,t,n){n===void 0&&(n="viewport");const s=n==="layoutViewport",r=ra(e),i=sd(e),o=r.visualViewport;let a=i.clientWidth,l=i.clientHeight,c=0,d=0;if(o){const f=!iM()||t==="fixed";s?f||(c=-o.offsetLeft,d=-o.offsetTop):(a=o.width,l=o.height,f&&(c=o.offsetLeft,d=o.offsetTop))}if(S4(i)<=0){const f=i.ownerDocument,p=f.body,g=getComputedStyle(p),y=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,w=Math.abs(i.clientWidth-p.clientWidth-y),v=getComputedStyle(i).scrollbarGutter==="stable both-edges"?w/2:w;v<=Bqe&&(a-=v)}return{width:a,height:l,x:c,y:d}}function zqe(e,t){const n=cm(e,!0,t==="fixed"),s=n.top+e.clientTop,r=n.left+e.clientLeft,i=s0(e),o=e.clientWidth*i.x,a=e.clientHeight*i.y,l=r*i.x,c=s*i.y;return{width:o,height:a,x:l,y:c}}function QB(e,t,n){let s;if(t==="viewport"||t==="layoutViewport")s=$qe(e,n,t);else if(t==="document")s=Pqe(sd(e));else if(Lc(t))s=zqe(t,n);else{const r=jJ(e);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return D2(s)}function Fqe(e,t){const n=t.get(e);if(n)return n;let s=eb(e,[],!1).filter(a=>Lc(a)&&ag(a)!=="body"),r=null;const i=Dc(e).position==="fixed";let o=i?lm(e):e;for(;Lc(o)&&!Zy(o);){const a=Dc(o),l=rM(o),c=r?r.position:i?"fixed":"";!l&&(c==="fixed"||c==="absolute"&&a.position==="static")?s=s.filter(h=>h!==o):r=a,o=lm(o)}return t.set(e,s),s}function qqe(e){let{element:t,boundary:n,rootBoundary:s,strategy:r}=e;const o=[...n==="clippingAncestors"?k4(t)?[]:Fqe(t,this._c):[].concat(n),s],a=QB(t,o[0],r);let l=a.top,c=a.right,d=a.bottom,h=a.left;for(let f=1;f<o.length;f++){const p=QB(t,o[f],r);l=Ru(p.top,l),c=Mh(p.right,c),d=Mh(p.bottom,d),h=Ru(p.left,h)}return{width:c-h,height:d-l,x:h,y:l}}function Hqe(e){const{width:t,height:n}=RJ(e);return{width:t,height:n}}function Uqe(e,t,n){const s=zh(t),r=sd(t),i=n==="fixed",o=cm(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=ju(0);if((s||!i)&&((ag(t)!=="body"||x4(r))&&(a=_4(t)),s)){const f=cm(t,!0,i,t);l.x=f.x+t.clientLeft,l.y=f.y+t.clientTop}!s&&r&&(l.x=S4(r));const c=r&&!s&&!i?LJ(r,a):ju(0),d=o.left+a.scrollLeft-l.x-c.x,h=o.top+a.scrollTop-l.y-c.y;return{x:d,y:h,width:o.width,height:o.height}}function cC(e){return Dc(e).position==="static"}function JB(e,t){if(!zh(e)||Dc(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return sd(e)===n&&(n=n.ownerDocument.body),n}function DJ(e,t){const n=ra(e);if(k4(e))return n;if(!zh(e)){let r=lm(e);for(;r&&!Zy(r);){if(Lc(r)&&!cC(r))return r;r=lm(r)}return n}let s=JB(e,t);for(;s&&Mqe(s)&&cC(s);)s=JB(s,t);return s&&Zy(s)&&cC(s)&&!rM(s)?n:s||Rqe(e)||n}const Vqe=async function(e){const t=this.getOffsetParent||DJ,n=this.getDimensions,s=await n(e.floating);return{reference:Uqe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function Wqe(e){return Dc(e).direction==="rtl"}const Gqe={convertOffsetParentRelativeRectToViewportRelativeRect:Dqe,getDocumentElement:sd,getClippingRect:qqe,getOffsetParent:DJ,getElementRects:Vqe,getClientRects:Oqe,getDimensions:Hqe,getScale:s0,isElement:Lc,isRTL:Wqe};function OJ(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Kqe(e,t,n){let s=null,r;const i=sd(e);function o(){var d;clearTimeout(r),(d=s)==null||d.disconnect(),s=null}function a(d,h){d===void 0&&(d=!1),h===void 0&&(h=1),o();const f=e.getBoundingClientRect(),{left:p,top:g,width:y,height:w}=f;if(d||t(),!y||!w)return;const v=Lw(g),b=Lw(i.clientWidth-(p+y)),x=Lw(i.clientHeight-(g+w)),k=Lw(p),C={rootMargin:-v+"px "+-b+"px "+-x+"px "+-k+"px",threshold:Ru(0,Mh(1,h))||1};let S=!0;function _(L){const M=L[0].intersectionRatio;if(!OJ(f,e.getBoundingClientRect()))return a();if(M!==h){if(!S)return a();M?a(!1,M):r=setTimeout(()=>{a(!1,1e-7)},1e3)}S=!1}try{s=new IntersectionObserver(_,{...C,root:i.ownerDocument})}catch{s=new IntersectionObserver(_,C)}s.observe(e)}const l=ra(e),c=()=>a(n);return l.addEventListener("resize",c),a(!0),()=>{l.removeEventListener("resize",c),o()}}function Yqe(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=s,c=oM(e),d=r||i?[...c?eb(c):[],...t?eb(t):[]]:[];d.forEach(v=>{r&&v.addEventListener("scroll",n),i&&v.addEventListener("resize",n)});const h=c&&a?Kqe(c,n,i):null;let f=-1,p=null;o&&(p=new ResizeObserver(v=>{let[b]=v;b&&b.target===c&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var x;(x=p)==null||x.observe(t)})),n()}),c&&!l&&p.observe(c),t&&p.observe(t));let g,y=l?cm(e):null;l&&w();function w(){const v=cm(e);y&&!OJ(y,v)&&n(),y=v,g=requestAnimationFrame(w)}return n(),()=>{var v;d.forEach(b=>{r&&b.removeEventListener("scroll",n),i&&b.removeEventListener("resize",n)}),h==null||h(),(v=p)==null||v.disconnect(),p=null,l&&cancelAnimationFrame(g)}}const Xqe=Cqe,Qqe=Tqe,Jqe=kqe,Zqe=Aqe,eHe=_qe,ZB=xqe,tHe=Eqe,nHe=(e,t,n)=>{const s=new Map,r=n??{},i={...Gqe,...r.platform,_c:s};return wqe(e,t,{...r,platform:i})};var sHe=typeof document<"u",rHe=function(){},$x=sHe?m.useLayoutEffect:rHe;function O2(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!O2(e[s],t[s]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,r[s]))return!1;for(s=n;s--!==0;){const i=r[s];if(!(i==="_owner"&&e.$$typeof)&&!O2(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function PJ(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function e$(e,t){const n=PJ(e);return Math.round(t*n)/n}function uC(e){const t=m.useRef(e);return $x(()=>{t.current=e}),t}function iHe(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:r,elements:{reference:i,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[d,h]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=m.useState(s);O2(f,s)||p(s);const[g,y]=m.useState(null),[w,v]=m.useState(null),b=m.useCallback(z=>{z!==C.current&&(C.current=z,y(z))},[]),x=m.useCallback(z=>{z!==S.current&&(S.current=z,v(z))},[]),k=i||g,T=o||w,C=m.useRef(null),S=m.useRef(null),_=m.useRef(d),L=l!=null,M=uC(l),I=uC(r),A=uC(c),P=m.useCallback(()=>{if(!C.current||!S.current)return;const z={placement:t,strategy:n,middleware:f};I.current&&(z.platform=I.current),nHe(C.current,S.current,z).then(U=>{const D={...U,isPositioned:A.current!==!1};B.current&&!O2(_.current,D)&&(_.current=D,_l.flushSync(()=>{h(D)}))})},[f,t,n,I,A]);$x(()=>{c===!1&&_.current.isPositioned&&(_.current.isPositioned=!1,h(z=>({...z,isPositioned:!1})))},[c]);const B=m.useRef(!1);$x(()=>(B.current=!0,()=>{B.current=!1}),[]),$x(()=>{if(k&&(C.current=k),T&&(S.current=T),k&&T){if(M.current)return M.current(k,T,P);P()}},[k,T,P,M,L]);const F=m.useMemo(()=>({reference:C,floating:S,setReference:b,setFloating:x}),[b,x]),O=m.useMemo(()=>({reference:k,floating:T}),[k,T]),X=m.useMemo(()=>{const z={position:n,left:0,top:0};if(!O.floating)return z;const U=e$(O.floating,d.x),D=e$(O.floating,d.y);return a?{...z,transform:"translate("+U+"px, "+D+"px)",...PJ(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:U,top:D}},[n,a,O.floating,d.x,d.y]);return m.useMemo(()=>({...d,update:P,refs:F,elements:O,floatingStyles:X}),[d,P,F,O,X])}const oHe=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:r}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?ZB({element:s.current,padding:r}).fn(n):{}:s?ZB({element:s,padding:r}).fn(n):{}}}},aHe=(e,t)=>{const n=Xqe(e);return{name:n.name,fn:n.fn,options:[e,t]}},lHe=(e,t)=>{const n=Qqe(e);return{name:n.name,fn:n.fn,options:[e,t]}},cHe=(e,t)=>({fn:tHe(e).fn,options:[e,t]}),uHe=(e,t)=>{const n=Jqe(e);return{name:n.name,fn:n.fn,options:[e,t]}},dHe=(e,t)=>{const n=Zqe(e);return{name:n.name,fn:n.fn,options:[e,t]}},hHe=(e,t)=>{const n=eHe(e);return{name:n.name,fn:n.fn,options:[e,t]}},fHe=(e,t)=>{const n=oHe(e);return{name:n.name,fn:n.fn,options:[e,t]}};var mHe="Arrow",BJ=m.forwardRef((e,t)=>{const{children:n,width:s=10,height:r=5,...i}=e;return u.jsx(Fn.svg,{...i,ref:t,width:s,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:u.jsx("polygon",{points:"0,0 30,0 15,10"})})});BJ.displayName=mHe;var pHe=BJ,aM="Popper",[$J,lg]=Kc(aM),[gHe,zJ]=$J(aM),FJ=e=>{const{__scopePopper:t,children:n}=e,[s,r]=m.useState(null),[i,o]=m.useState(void 0);return u.jsx(gHe,{scope:t,anchor:s,onAnchorChange:r,placementState:i,setPlacementState:o,children:n})};FJ.displayName=aM;var qJ="PopperAnchor",HJ=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...r}=e,i=zJ(qJ,n),o=m.useRef(null),a=i.onAnchorChange,l=m.useCallback(g=>{o.current=g,g&&a(g)},[a]),c=Rs(t,l),d=m.useRef(null);m.useEffect(()=>{if(!s)return;const g=d.current;d.current=s.current,g!==d.current&&a(d.current)});const h=i.placementState&&cM(i.placementState),f=h==null?void 0:h[0],p=h==null?void 0:h[1];return s?null:u.jsx(Fn.div,{"data-radix-popper-side":f,"data-radix-popper-align":p,...r,ref:c})});HJ.displayName=qJ;var lM="PopperContent",[yHe,bHe]=$J(lM),UJ=m.forwardRef((e,t)=>{var se,te,ce,oe,de,Te;const{__scopePopper:n,side:s="bottom",sideOffset:r=0,align:i="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:g,...y}=e,w=zJ(lM,n),[v,b]=m.useState(null),x=Rs(t,b),[k,T]=m.useState(null),C=TJ(k),S=(C==null?void 0:C.width)??0,_=(C==null?void 0:C.height)??0,L=s+(i!=="center"?"-"+i:""),M=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},I=Array.isArray(c)?c:[c],A=I.length>0,P={padding:M,boundary:I.filter(wHe),altBoundary:A},{refs:B,floatingStyles:F,placement:O,isPositioned:X,middlewareData:z}=iHe({strategy:"fixed",placement:L,whileElementsMounted:(...qe)=>Yqe(...qe,{animationFrame:p==="always"}),elements:{reference:w.anchor},middleware:[aHe({mainAxis:r+_,alignmentAxis:o}),l&&lHe({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?cHe():void 0,...P}),l&&uHe({...P}),dHe({...P,apply:({elements:qe,rects:Ne,availableWidth:ge,availableHeight:Ee})=>{const{width:_t,height:Ct}=Ne.reference,Je=qe.floating.style;Je.setProperty("--radix-popper-available-width",`${ge}px`),Je.setProperty("--radix-popper-available-height",`${Ee}px`),Je.setProperty("--radix-popper-anchor-width",`${_t}px`),Je.setProperty("--radix-popper-anchor-height",`${Ct}px`)}}),k&&fHe({element:k,padding:a}),xHe({arrowWidth:S,arrowHeight:_}),f&&hHe({strategy:"referenceHidden",...P,boundary:A?P.boundary:void 0})]}),U=w.setPlacementState;Hi(()=>(U(O),()=>{U(void 0)}),[O,U]);const[D,G]=cM(O),q=Pa(g);Hi(()=>{X&&(q==null||q())},[X,q]);const N=(se=z.arrow)==null?void 0:se.x,ee=(te=z.arrow)==null?void 0:te.y,re=((ce=z.arrow)==null?void 0:ce.centerOffset)!==0,[Q,K]=m.useState();return Hi(()=>{v&&K(window.getComputedStyle(v).zIndex)},[v]),u.jsx("div",{ref:B.setFloating,"data-radix-popper-content-wrapper":"",style:{...F,transform:X?F.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Q,"--radix-popper-transform-origin":[(oe=z.transformOrigin)==null?void 0:oe.x,(de=z.transformOrigin)==null?void 0:de.y].join(" "),...((Te=z.hide)==null?void 0:Te.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:u.jsx(yHe,{scope:n,placedSide:D,placedAlign:G,onArrowChange:T,arrowX:N,arrowY:ee,shouldHideArrow:re,children:u.jsx(Fn.div,{"data-side":D,"data-align":G,...y,ref:x,style:{...y.style,animation:X?void 0:"none"}})})})});UJ.displayName=lM;var VJ="PopperArrow",vHe={top:"bottom",right:"left",bottom:"top",left:"right"},WJ=m.forwardRef(function(t,n){const{__scopePopper:s,...r}=t,i=bHe(VJ,s),o=vHe[i.placedSide];return u.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:u.jsx(pHe,{...r,ref:n,style:{...r.style,display:"block"}})})});WJ.displayName=VJ;function wHe(e){return e!==null}var xHe=e=>({name:"transformOrigin",options:e,fn(t){var w,v,b;const{placement:n,rects:s,middlewareData:r}=t,o=((w=r.arrow)==null?void 0:w.centerOffset)!==0,a=o?0:e.arrowWidth,l=o?0:e.arrowHeight,[c,d]=cM(n),h={start:"0%",center:"50%",end:"100%"}[d],f=(((v=r.arrow)==null?void 0:v.x)??0)+a/2,p=(((b=r.arrow)==null?void 0:b.y)??0)+l/2;let g="",y="";return c==="bottom"?(g=o?h:`${f}px`,y=`${-l}px`):c==="top"?(g=o?h:`${f}px`,y=`${s.floating.height+l}px`):c==="right"?(g=`${-l}px`,y=o?h:`${p}px`):c==="left"&&(g=`${s.floating.width+l}px`,y=o?h:`${p}px`),{data:{x:g,y}}}});function cM(e){const[t,n="center"]=e.split("-");return[t,n]}var C4=FJ,uM=HJ,dM=UJ,hM=WJ,dC=!1;function kHe(){const[e,t]=m.useState(dC);return m.useEffect(()=>{dC||(dC=!0,t(!0))},[]),e}var GJ=K2[" useSyncExternalStore ".trim().toString()];function _He(){return()=>{}}function SHe(){return GJ(_He,()=>!0,()=>!1)}var CHe=typeof GJ=="function"?SHe:kHe,hC="rovingFocusGroup.onEntryFocus",THe={bubbles:!1,cancelable:!0},Bb="RovingFocusGroup",[s7,KJ,EHe]=K9(Bb),[AHe,T4]=Kc(Bb,[EHe]),[MHe,NHe]=AHe(Bb),YJ=m.forwardRef((e,t)=>u.jsx(s7.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx(s7.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(IHe,{...e,ref:t})})}));YJ.displayName=Bb;var IHe=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:r=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:d=!1,...h}=e,f=m.useRef(null),p=Rs(t,f),g=p4(i),[y,w]=Wu({prop:o,defaultProp:a??null,onChange:l,caller:Bb}),[v,b]=m.useState(!1),x=Pa(c),k=KJ(n),T=m.useRef(!1),[C,S]=m.useState(0);return m.useEffect(()=>{const _=f.current;if(_)return _.addEventListener(hC,x),()=>_.removeEventListener(hC,x)},[x]),u.jsx(MHe,{scope:n,orientation:s,dir:g,loop:r,currentTabStopId:y,onItemFocus:m.useCallback(_=>w(_),[w]),onItemShiftTab:m.useCallback(()=>b(!0),[]),onFocusableItemAdd:m.useCallback(()=>S(_=>_+1),[]),onFocusableItemRemove:m.useCallback(()=>S(_=>_-1),[]),children:u.jsx(Fn.div,{tabIndex:v||C===0?-1:0,"data-orientation":s,...h,ref:p,style:{outline:"none",...e.style},onMouseDown:Zt(e.onMouseDown,()=>{T.current=!0}),onFocus:Zt(e.onFocus,_=>{const L=!T.current;if(_.target===_.currentTarget&&L&&!v){const M=new CustomEvent(hC,THe);if(_.currentTarget.dispatchEvent(M),!M.defaultPrevented){const I=k().filter(O=>O.focusable),A=I.find(O=>O.active),P=I.find(O=>O.id===y),F=[A,P,...I].filter(Boolean).map(O=>O.ref.current);JJ(F,d)}}T.current=!1}),onBlur:Zt(e.onBlur,()=>b(!1))})})}),XJ="RovingFocusGroupItem",QJ=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:r=!1,tabStopId:i,children:o,...a}=e,l=ja(),c=i||l,d=NHe(XJ,n),h=d.currentTabStopId===c,f=KJ(n),{onFocusableItemAdd:p,onFocusableItemRemove:g,currentTabStopId:y}=d,w=CHe();return Hi(()=>{if(!(!w||!s))return p(),()=>g()},[w,s,p,g]),m.useEffect(()=>{if(!(w||!s))return p(),()=>g()},[w,s,p,g]),u.jsx(s7.ItemSlot,{scope:n,id:c,focusable:s,active:r,children:u.jsx(Fn.span,{tabIndex:h?0:-1,"data-orientation":d.orientation,...a,ref:t,onMouseDown:Zt(e.onMouseDown,v=>{s?d.onItemFocus(c):v.preventDefault()}),onFocus:Zt(e.onFocus,()=>d.onItemFocus(c)),onKeyDown:Zt(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){d.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const b=LHe(v,d.orientation,d.dir);if(b!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let k=f().filter(T=>T.focusable).map(T=>T.ref.current);if(b==="last")k.reverse();else if(b==="prev"||b==="next"){b==="prev"&&k.reverse();const T=k.indexOf(v.currentTarget);k=d.loop?DHe(k,T+1):k.slice(T+1)}setTimeout(()=>JJ(k))}}),children:typeof o=="function"?o({isCurrentTabStop:h,hasTabStop:y!=null}):o})})});QJ.displayName=XJ;var RHe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function jHe(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function LHe(e,t,n){const s=jHe(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return RHe[s]}function JJ(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function DHe(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var ZJ=YJ,eZ=QJ,r7=["Enter"," "],OHe=["ArrowDown","PageUp","Home"],tZ=["ArrowUp","PageDown","End"],PHe=[...OHe,...tZ],BHe={ltr:[...r7,"ArrowRight"],rtl:[...r7,"ArrowLeft"]},$He={ltr:["ArrowLeft"],rtl:["ArrowRight"]},$b="Menu",[tb,zHe,FHe]=K9($b),[Cm,nZ]=Kc($b,[FHe,lg,T4]),zb=lg(),sZ=T4(),[rZ,Fh]=Cm($b),[qHe,Fb]=Cm($b),iZ=e=>{const{__scopeMenu:t,open:n=!1,children:s,dir:r,onOpenChange:i,modal:o=!0}=e,a=zb(t),[l,c]=m.useState(null),d=m.useRef(!1),h=Pa(i),f=p4(r);return m.useEffect(()=>{const p=()=>{d.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>d.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),m.useEffect(()=>{if(!n)return;const p=()=>h(!1);return window.addEventListener("blur",p),()=>window.removeEventListener("blur",p)},[n,h]),u.jsx(C4,{...a,children:u.jsx(rZ,{scope:t,open:n,onOpenChange:h,content:l,onContentChange:c,children:u.jsx(qHe,{scope:t,onClose:m.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:d,dir:f,modal:o,children:s})})})};iZ.displayName=$b;var HHe="MenuAnchor",fM=m.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,r=zb(n);return u.jsx(uM,{...r,...s,ref:t})});fM.displayName=HHe;var mM="MenuPortal",[UHe,oZ]=Cm(mM,{forceMount:void 0}),aZ=e=>{const{__scopeMenu:t,forceMount:n,children:s,container:r}=e,i=Fh(mM,t);return u.jsx(UHe,{scope:t,forceMount:n,children:u.jsx(Cl,{present:n||i.open,children:u.jsx(Pb,{asChild:!0,container:r,children:s})})})};aZ.displayName=mM;var bl="MenuContent",[VHe,pM]=Cm(bl),lZ=m.forwardRef((e,t)=>{const n=oZ(bl,e.__scopeMenu),{forceMount:s=n.forceMount,...r}=e,i=Fh(bl,e.__scopeMenu),o=Fb(bl,e.__scopeMenu);return u.jsx(tb.Provider,{scope:e.__scopeMenu,children:u.jsx(Cl,{present:s||i.open,children:u.jsx(tb.Slot,{scope:e.__scopeMenu,children:o.modal?u.jsx(WHe,{...r,ref:t}):u.jsx(GHe,{...r,ref:t})})})})}),WHe=m.forwardRef((e,t)=>{const n=Fh(bl,e.__scopeMenu),s=m.useRef(null),r=Rs(t,s);return m.useEffect(()=>{const i=s.current;if(i)return Q9(i)},[]),u.jsx(gM,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Zt(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),GHe=m.forwardRef((e,t)=>{const n=Fh(bl,e.__scopeMenu);return u.jsx(gM,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),KHe=am("MenuContent.ScrollLock"),gM=m.forwardRef((e,t)=>{const{__scopeMenu:n,loop:s=!1,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:f,onDismiss:p,disableOutsideScroll:g,...y}=e,w=Fh(bl,n),v=Fb(bl,n),b=zb(n),x=sZ(n),k=zHe(n),[T,C]=m.useState(null),S=m.useRef(null),_=Rs(t,S,w.onContentChange),L=m.useRef(0),M=m.useRef(""),I=m.useRef(0),A=m.useRef(null),P=m.useRef("right"),B=m.useRef(0),F=g?b4:m.Fragment,O=g?{as:KHe,allowPinchZoom:!0}:void 0,X=U=>{var K,se;const D=M.current+U,G=k().filter(te=>!te.disabled),q=document.activeElement,N=(K=G.find(te=>te.ref.current===q))==null?void 0:K.textValue,ee=G.map(te=>te.textValue),re=oUe(ee,D,N),Q=(se=G.find(te=>te.textValue===re))==null?void 0:se.ref.current;(function te(ce){M.current=ce,window.clearTimeout(L.current),ce!==""&&(L.current=window.setTimeout(()=>te(""),1e3))})(D),Q&&setTimeout(()=>Q.focus())};m.useEffect(()=>()=>window.clearTimeout(L.current),[]),X9();const z=m.useCallback(U=>{var G,q;return P.current===((G=A.current)==null?void 0:G.side)&&lUe(U,(q=A.current)==null?void 0:q.area)},[]);return u.jsx(VHe,{scope:n,searchRef:M,onItemEnter:m.useCallback(U=>{z(U)&&U.preventDefault()},[z]),onItemLeave:m.useCallback(U=>{var D;z(U)||((D=S.current)==null||D.focus(),C(null))},[z]),onTriggerLeave:m.useCallback(U=>{z(U)&&U.preventDefault()},[z]),pointerGraceTimerRef:I,onPointerGraceIntentChange:m.useCallback(U=>{A.current=U},[]),children:u.jsx(F,{...O,children:u.jsx(g4,{asChild:!0,trapped:r,onMountAutoFocus:Zt(i,U=>{var D;U.preventDefault(),(D=S.current)==null||D.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:u.jsx(Ob,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:f,onDismiss:p,children:u.jsx(ZJ,{asChild:!0,...x,dir:v.dir,orientation:"vertical",loop:s,currentTabStopId:T,onCurrentTabStopIdChange:C,onEntryFocus:Zt(l,U=>{v.isUsingKeyboardRef.current||U.preventDefault()}),preventScrollOnEntryFocus:!0,children:u.jsx(dM,{role:"menu","aria-orientation":"vertical","data-state":CZ(w.open),"data-radix-menu-content":"",dir:v.dir,...b,...y,ref:_,style:{outline:"none",...y.style},onKeyDown:Zt(y.onKeyDown,U=>{const G=U.target.closest("[data-radix-menu-content]")===U.currentTarget,q=U.ctrlKey||U.altKey||U.metaKey,N=U.key.length===1;G&&(U.key==="Tab"&&U.preventDefault(),!q&&N&&X(U.key));const ee=S.current;if(U.target!==ee||!PHe.includes(U.key))return;U.preventDefault();const Q=k().filter(K=>!K.disabled).map(K=>K.ref.current);tZ.includes(U.key)&&Q.reverse(),rUe(Q)}),onBlur:Zt(e.onBlur,U=>{U.currentTarget.contains(U.target)||(window.clearTimeout(L.current),M.current="")}),onPointerMove:Zt(e.onPointerMove,nb(U=>{const D=U.target,G=B.current!==U.clientX;if(U.currentTarget.contains(D)&&G){const q=U.clientX>B.current?"right":"left";P.current=q,B.current=U.clientX}}))})})})})})})});lZ.displayName=bl;var YHe="MenuGroup",yM=m.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return u.jsx(Fn.div,{role:"group",...s,ref:t})});yM.displayName=YHe;var XHe="MenuLabel",cZ=m.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return u.jsx(Fn.div,{...s,ref:t})});cZ.displayName=XHe;var P2="MenuItem",t$="menu.itemSelect",E4=m.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:s,...r}=e,i=m.useRef(null),o=Fb(P2,e.__scopeMenu),a=pM(P2,e.__scopeMenu),l=Rs(t,i),c=m.useRef(!1),d=()=>{const h=i.current;if(!n&&h){const f=new CustomEvent(t$,{bubbles:!0,cancelable:!0});h.addEventListener(t$,p=>s==null?void 0:s(p),{once:!0}),ZQ(h,f),f.defaultPrevented?c.current=!1:o.onClose()}};return u.jsx(uZ,{...r,ref:l,disabled:n,onClick:Zt(e.onClick,d),onPointerDown:h=>{var f;(f=e.onPointerDown)==null||f.call(e,h),c.current=!0},onPointerUp:Zt(e.onPointerUp,h=>{var f;c.current||(f=h.currentTarget)==null||f.click()}),onKeyDown:Zt(e.onKeyDown,h=>{n||h.target!==h.currentTarget||a.searchRef.current!==""&&h.key===" "||r7.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});E4.displayName=P2;var uZ=m.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:s=!1,textValue:r,...i}=e,o=pM(P2,n),a=sZ(n),l=m.useRef(null),c=Rs(t,l),[d,h]=m.useState(!1),[f,p]=m.useState("");return m.useEffect(()=>{const g=l.current;g&&p((g.textContent??"").trim())},[i.children]),u.jsx(tb.ItemSlot,{scope:n,disabled:s,textValue:r??f,children:u.jsx(eZ,{asChild:!0,...a,focusable:!s,children:u.jsx(Fn.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...i,ref:c,onPointerMove:Zt(e.onPointerMove,nb(g=>{s?o.onItemLeave(g):(o.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Zt(e.onPointerLeave,nb(g=>o.onItemLeave(g))),onFocus:Zt(e.onFocus,()=>h(!0)),onBlur:Zt(e.onBlur,()=>h(!1))})})})}),QHe="MenuCheckboxItem",dZ=m.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:s,...r}=e;return u.jsx(gZ,{scope:e.__scopeMenu,checked:n,children:u.jsx(E4,{role:"menuitemcheckbox","aria-checked":B2(n)?"mixed":n,...r,ref:t,"data-state":wM(n),onSelect:Zt(r.onSelect,()=>s==null?void 0:s(B2(n)?!0:!n),{checkForDefaultPrevented:!1})})})});dZ.displayName=QHe;var hZ="MenuRadioGroup",[JHe,ZHe]=Cm(hZ,{value:void 0,onValueChange:()=>{}}),fZ=m.forwardRef((e,t)=>{const{value:n,onValueChange:s,...r}=e,i=Pa(s);return u.jsx(JHe,{scope:e.__scopeMenu,value:n,onValueChange:i,children:u.jsx(yM,{...r,ref:t})})});fZ.displayName=hZ;var mZ="MenuRadioItem",pZ=m.forwardRef((e,t)=>{const{value:n,...s}=e,r=ZHe(mZ,e.__scopeMenu),i=n===r.value;return u.jsx(gZ,{scope:e.__scopeMenu,checked:i,children:u.jsx(E4,{role:"menuitemradio","aria-checked":i,...s,ref:t,"data-state":wM(i),onSelect:Zt(s.onSelect,()=>{var o;return(o=r.onValueChange)==null?void 0:o.call(r,n)},{checkForDefaultPrevented:!1})})})});pZ.displayName=mZ;var bM="MenuItemIndicator",[gZ,eUe]=Cm(bM,{checked:!1}),yZ=m.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:s,...r}=e,i=eUe(bM,n);return u.jsx(Cl,{present:s||B2(i.checked)||i.checked===!0,children:u.jsx(Fn.span,{...r,ref:t,"data-state":wM(i.checked)})})});yZ.displayName=bM;var tUe="MenuSeparator",bZ=m.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return u.jsx(Fn.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});bZ.displayName=tUe;var nUe="MenuArrow",vZ=m.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,r=zb(n);return u.jsx(hM,{...r,...s,ref:t})});vZ.displayName=nUe;var vM="MenuSub",[sUe,wZ]=Cm(vM),xZ=e=>{const{__scopeMenu:t,children:n,open:s=!1,onOpenChange:r}=e,i=Fh(vM,t),o=zb(t),[a,l]=m.useState(null),[c,d]=m.useState(null),h=Pa(r);return m.useEffect(()=>(i.open===!1&&h(!1),()=>h(!1)),[i.open,h]),u.jsx(C4,{...o,children:u.jsx(rZ,{scope:t,open:s,onOpenChange:h,content:c,onContentChange:d,children:u.jsx(sUe,{scope:t,contentId:ja(),triggerId:ja(),trigger:a,onTriggerChange:l,children:n})})})};xZ.displayName=vM;var y1="MenuSubTrigger",kZ=m.forwardRef((e,t)=>{const n=Fh(y1,e.__scopeMenu),s=Fb(y1,e.__scopeMenu),r=wZ(y1,e.__scopeMenu),i=pM(y1,e.__scopeMenu),o=m.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=i,c={__scopeMenu:e.__scopeMenu},d=m.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);m.useEffect(()=>d,[d]),m.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),l(null)}},[a,l]);const h=Rs(t,r.onTriggerChange);return u.jsx(fM,{asChild:!0,...c,children:u.jsx(uZ,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":n.open?r.contentId:void 0,"data-state":CZ(n.open),...e,ref:h,onClick:f=>{var p;(p=e.onClick)==null||p.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Zt(e.onPointerMove,nb(f=>{i.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(i.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:Zt(e.onPointerLeave,nb(f=>{var g,y;d();const p=(g=n.content)==null?void 0:g.getBoundingClientRect();if(p){const w=(y=n.content)==null?void 0:y.dataset.side,v=w==="right",b=v?-5:5,x=p[v?"left":"right"],k=p[v?"right":"left"];i.onPointerGraceIntentChange({area:[{x:f.clientX+b,y:f.clientY},{x,y:p.top},{x:k,y:p.top},{x:k,y:p.bottom},{x,y:p.bottom}],side:w}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(f),f.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:Zt(e.onKeyDown,f=>{var g;e.disabled||f.target!==f.currentTarget||i.searchRef.current!==""&&f.key===" "||BHe[s.dir].includes(f.key)&&(n.onOpenChange(!0),(g=n.content)==null||g.focus(),f.preventDefault())})})})});kZ.displayName=y1;var _Z="MenuSubContent",SZ=m.forwardRef((e,t)=>{const n=oZ(bl,e.__scopeMenu),{forceMount:s=n.forceMount,align:r="start",...i}=e,o=Fh(bl,e.__scopeMenu),a=Fb(bl,e.__scopeMenu),l=wZ(_Z,e.__scopeMenu),c=m.useRef(null),d=Rs(t,c);return u.jsx(tb.Provider,{scope:e.__scopeMenu,children:u.jsx(Cl,{present:s||o.open,children:u.jsx(tb.Slot,{scope:e.__scopeMenu,children:u.jsx(gM,{id:l.contentId,"aria-labelledby":l.triggerId,...i,ref:d,align:r,side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:h=>{var f;a.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),h.preventDefault()},onCloseAutoFocus:h=>h.preventDefault(),onFocusOutside:Zt(e.onFocusOutside,h=>{h.target!==l.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:Zt(e.onEscapeKeyDown,h=>{a.onClose(),h.preventDefault()}),onKeyDown:Zt(e.onKeyDown,h=>{var g;const f=h.currentTarget.contains(h.target),p=$He[a.dir].includes(h.key);f&&p&&(o.onOpenChange(!1),(g=l.trigger)==null||g.focus(),h.preventDefault())})})})})})});SZ.displayName=_Z;function CZ(e){return e?"open":"closed"}function B2(e){return e==="indeterminate"}function wM(e){return B2(e)?"indeterminate":e?"checked":"unchecked"}function rUe(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function iUe(e,t){return e.map((n,s)=>e[(t+s)%e.length])}function oUe(e,t,n){const r=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=iUe(e,Math.max(i,0));r.length===1&&(o=o.filter(c=>c!==n));const l=o.find(c=>c.toLowerCase().startsWith(r.toLowerCase()));return l!==n?l:void 0}function aUe(e,t){const{x:n,y:s}=e;let r=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const a=t[i],l=t[o],c=a.x,d=a.y,h=l.x,f=l.y;d>s!=f>s&&n<(h-c)*(s-d)/(f-d)+c&&(r=!r)}return r}function lUe(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return aUe(n,t)}function nb(e){return t=>t.pointerType==="mouse"?e(t):void 0}var cUe=iZ,uUe=fM,dUe=aZ,hUe=lZ,fUe=yM,mUe=cZ,pUe=E4,gUe=dZ,yUe=fZ,bUe=pZ,vUe=yZ,wUe=bZ,xUe=vZ,kUe=xZ,_Ue=kZ,SUe=SZ,A4="DropdownMenu",[CUe,X0t]=Kc(A4,[nZ]),xo=nZ(),[TUe,TZ]=CUe(A4),EZ=e=>{const{__scopeDropdownMenu:t,children:n,dir:s,open:r,defaultOpen:i,onOpenChange:o,modal:a=!0}=e,l=xo(t),c=m.useRef(null),[d,h]=Wu({prop:r,defaultProp:i??!1,onChange:o,caller:A4});return u.jsx(TUe,{scope:t,triggerId:ja(),triggerRef:c,contentId:ja(),open:d,onOpenChange:h,onOpenToggle:m.useCallback(()=>h(f=>!f),[h]),modal:a,children:u.jsx(cUe,{...l,open:d,onOpenChange:h,dir:s,modal:a,children:n})})};EZ.displayName=A4;var AZ="DropdownMenuTrigger",MZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:s=!1,...r}=e,i=TZ(AZ,n),o=xo(n),a=Rs(t,i.triggerRef);return u.jsx(uUe,{asChild:!0,...o,children:u.jsx(Fn.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":s?"":void 0,disabled:s,...r,ref:a,onPointerDown:Zt(e.onPointerDown,l=>{!s&&l.button===0&&l.ctrlKey===!1&&(i.onOpenToggle(),i.open||l.preventDefault())}),onKeyDown:Zt(e.onKeyDown,l=>{s||(["Enter"," "].includes(l.key)&&i.onOpenToggle(),l.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});MZ.displayName=AZ;var EUe="DropdownMenuPortal",NZ=e=>{const{__scopeDropdownMenu:t,...n}=e,s=xo(t);return u.jsx(dUe,{...s,...n})};NZ.displayName=EUe;var IZ="DropdownMenuContent",RZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=TZ(IZ,n),i=xo(n),o=m.useRef(!1);return u.jsx(hUe,{id:r.contentId,"aria-labelledby":r.triggerId,...i,...s,ref:t,onCloseAutoFocus:Zt(e.onCloseAutoFocus,a=>{var l;o.current||(l=r.triggerRef.current)==null||l.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:Zt(e.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;(!r.modal||d)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});RZ.displayName=IZ;var AUe="DropdownMenuGroup",jZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=xo(n);return u.jsx(fUe,{...r,...s,ref:t})});jZ.displayName=AUe;var MUe="DropdownMenuLabel",NUe=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=xo(n);return u.jsx(mUe,{...r,...s,ref:t})});NUe.displayName=MUe;var IUe="DropdownMenuItem",LZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=xo(n);return u.jsx(pUe,{...r,...s,ref:t})});LZ.displayName=IUe;var RUe="DropdownMenuCheckboxItem",jUe=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=xo(n);return u.jsx(gUe,{...r,...s,ref:t})});jUe.displayName=RUe;var LUe="DropdownMenuRadioGroup",DUe=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=xo(n);return u.jsx(yUe,{...r,...s,ref:t})});DUe.displayName=LUe;var OUe="DropdownMenuRadioItem",PUe=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=xo(n);return u.jsx(bUe,{...r,...s,ref:t})});PUe.displayName=OUe;var BUe="DropdownMenuItemIndicator",$Ue=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=xo(n);return u.jsx(vUe,{...r,...s,ref:t})});$Ue.displayName=BUe;var zUe="DropdownMenuSeparator",FUe=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=xo(n);return u.jsx(wUe,{...r,...s,ref:t})});FUe.displayName=zUe;var qUe="DropdownMenuArrow",HUe=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=xo(n);return u.jsx(xUe,{...r,...s,ref:t})});HUe.displayName=qUe;var UUe=e=>{const{__scopeDropdownMenu:t,children:n,open:s,onOpenChange:r,defaultOpen:i}=e,o=xo(t),[a,l]=Wu({prop:s,defaultProp:i??!1,onChange:r,caller:"DropdownMenuSub"});return u.jsx(kUe,{...o,open:a,onOpenChange:l,children:n})},VUe="DropdownMenuSubTrigger",DZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=xo(n);return u.jsx(_Ue,{...r,...s,ref:t})});DZ.displayName=VUe;var WUe="DropdownMenuSubContent",OZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=xo(n);return u.jsx(SUe,{...r,...s,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});OZ.displayName=WUe;var GUe=EZ,KUe=MZ,YUe=NZ,XUe=RZ,QUe=jZ,JUe=LZ,ZUe=UUe,eVe=DZ,tVe=OZ,nVe="Label",PZ=m.forwardRef((e,t)=>u.jsx(Fn.label,{...e,ref:t,onMouseDown:n=>{var r;n.target.closest("button, input, select, textarea")||((r=e.onMouseDown)==null||r.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));PZ.displayName=nVe;var sVe=PZ;function n$(e,[t,n]){return Math.min(n,Math.max(t,e))}var rVe=[" ","Enter","ArrowUp","ArrowDown"],iVe=[" ","Enter"],um="Select",[M4,N4,oVe]=K9(um),[Tm,Q0t]=Kc(um,[oVe,lg]),I4=lg(),[aVe,qh]=Tm(um),[lVe,cVe]=Tm(um),uVe="SelectProvider";function BZ(e){const{__scopeSelect:t,children:n,open:s,defaultOpen:r,onOpenChange:i,value:o,defaultValue:a,onValueChange:l,dir:c,name:d,autoComplete:h,disabled:f,required:p,form:g,internal_do_not_use_render:y}=e,w=I4(t),[v,b]=m.useState(null),[x,k]=m.useState(null),[T,C]=m.useState(!1),S=p4(c),[_,L]=Wu({prop:s,defaultProp:r??!1,onChange:i,caller:um}),[M,I]=Wu({prop:o,defaultProp:a,onChange:l,caller:um}),A=m.useRef(null),P=m.useRef(M);m.useEffect(()=>{const q=g?v==null?void 0:v.ownerDocument.getElementById(g):v==null?void 0:v.form;if(q instanceof HTMLFormElement){const N=()=>I(P.current);return q.addEventListener("reset",N),()=>q.removeEventListener("reset",N)}},[g,v,I]);const B=v?!!g||!!v.closest("form"):!0,[F,O]=m.useState(new Set),X=ja(),z=Array.from(F).map(q=>q.props.value).join(";"),U=m.useCallback(q=>{O(N=>new Set(N).add(q))},[]),D=m.useCallback(q=>{O(N=>{const ee=new Set(N);return ee.delete(q),ee})},[]),G={required:p,trigger:v,onTriggerChange:b,valueNode:x,onValueNodeChange:k,valueNodeHasChildren:T,onValueNodeHasChildrenChange:C,contentId:X,value:M,onValueChange:I,open:_,onOpenChange:L,dir:S,triggerPointerDownPosRef:A,disabled:f,name:d,autoComplete:h,form:g,nativeOptions:F,nativeSelectKey:z,isFormControl:B};return u.jsx(C4,{...w,children:u.jsx(aVe,{scope:t,...G,children:u.jsx(M4.Provider,{scope:t,children:u.jsx(lVe,{scope:t,onNativeOptionAdd:U,onNativeOptionRemove:D,children:TVe(y)?y(G):n})})})})}BZ.displayName=uVe;var $Z=e=>{const{__scopeSelect:t,children:n,...s}=e;return u.jsx(BZ,{__scopeSelect:t,...s,internal_do_not_use_render:({isFormControl:r})=>u.jsxs(u.Fragment,{children:[n,r?u.jsx(hee,{__scopeSelect:t}):null]})})};$Z.displayName=um;var zZ="SelectTrigger",FZ=m.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:s=!1,...r}=e,i=I4(n),o=qh(zZ,n),a=o.disabled||s,l=Rs(t,o.onTriggerChange),c=N4(n),d=m.useRef("touch"),[h,f,p]=fee(y=>{const w=c().filter(x=>!x.disabled),v=w.find(x=>x.value===o.value),b=mee(w,y,v);b!==void 0&&o.onValueChange(b.value)}),g=y=>{a||(o.onOpenChange(!0),p()),y&&(o.triggerPointerDownPosRef.current={x:Math.round(y.pageX),y:Math.round(y.pageY)})};return u.jsx(uM,{asChild:!0,...i,children:u.jsx(Fn.button,{type:"button",role:"combobox","aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":R4(o.value)?"":void 0,...r,ref:l,onClick:Zt(r.onClick,y=>{y.currentTarget.focus(),d.current!=="mouse"&&g(y)}),onPointerDown:Zt(r.onPointerDown,y=>{d.current=y.pointerType;const w=y.target;w.hasPointerCapture(y.pointerId)&&w.releasePointerCapture(y.pointerId),y.button===0&&y.ctrlKey===!1&&y.pointerType==="mouse"&&(g(y),y.preventDefault())}),onKeyDown:Zt(r.onKeyDown,y=>{const w=h.current!=="";!(y.ctrlKey||y.altKey||y.metaKey)&&y.key.length===1&&f(y.key),!(w&&y.key===" ")&&rVe.includes(y.key)&&(g(),y.preventDefault())})})})});FZ.displayName=zZ;var qZ="SelectValue",HZ=m.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:r,children:i,placeholder:o="",...a}=e,l=qh(qZ,n),{onValueNodeHasChildrenChange:c}=l,d=i!==void 0,h=Rs(t,l.onValueNodeChange);Hi(()=>{c(d)},[c,d]);const f=R4(l.value);return u.jsx(Fn.span,{...a,asChild:f?!1:a.asChild,ref:h,style:{pointerEvents:"none"},children:u.jsx(m.Fragment,{children:f?o:i},f?"placeholder":"value")})});HZ.displayName=qZ;var dVe="SelectIcon",UZ=m.forwardRef((e,t)=>{const{__scopeSelect:n,children:s,...r}=e;return u.jsx(Fn.span,{"aria-hidden":!0,...r,ref:t,children:s||"▼"})});UZ.displayName=dVe;var VZ="SelectPortal",[hVe,fVe]=Tm(VZ,{forceMount:void 0}),WZ=e=>{const{__scopeSelect:t,forceMount:n,...s}=e;return u.jsx(hVe,{scope:e.__scopeSelect,forceMount:n,children:u.jsx(Pb,{asChild:!0,...s})})};WZ.displayName=VZ;var Ih="SelectContent",GZ=m.forwardRef((e,t)=>{const n=fVe(Ih,e.__scopeSelect),{forceMount:s=n.forceMount,...r}=e,i=qh(Ih,e.__scopeSelect),[o,a]=m.useState();return Hi(()=>{a(new DocumentFragment)},[]),u.jsx(Cl,{present:s||i.open,children:({present:l})=>l?u.jsx(XZ,{...r,ref:t}):u.jsx(KZ,{...r,fragment:o})})});GZ.displayName=Ih;var KZ=m.forwardRef((e,t)=>{const{__scopeSelect:n,children:s,fragment:r}=e;return r?_l.createPortal(u.jsx(YZ,{scope:n,children:u.jsx(M4.Slot,{scope:n,children:u.jsx("div",{ref:t,children:s})})}),r):null});KZ.displayName="SelectContentFragment";var Il=10,[YZ,Hh]=Tm(Ih),mVe="SelectContentImpl",pVe=am("SelectContent.RemoveScroll"),XZ=m.forwardRef((e,t)=>{const{__scopeSelect:n}=e,{position:s="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:i,onPointerDownOutside:o,side:a,sideOffset:l,align:c,alignOffset:d,arrowPadding:h,collisionBoundary:f,collisionPadding:p,sticky:g,hideWhenDetached:y,avoidCollisions:w,...v}=e,b=qh(Ih,n),[x,k]=m.useState(null),[T,C]=m.useState(null),S=Rs(t,k),[_,L]=m.useState(null),[M,I]=m.useState(null),A=N4(n),[P,B]=m.useState(!1),F=m.useRef(!1);m.useEffect(()=>{if(x)return Q9(x)},[x]),X9();const O=m.useCallback(K=>{const[se,...te]=A().map(de=>de.ref.current),[ce]=te.slice(-1),oe=document.activeElement;for(const de of K)if(de===oe||(de==null||de.scrollIntoView({block:"nearest"}),de===se&&T&&(T.scrollTop=0),de===ce&&T&&(T.scrollTop=T.scrollHeight),de==null||de.focus(),document.activeElement!==oe))return},[A,T]),X=m.useCallback(()=>O([_,x]),[O,_,x]);m.useEffect(()=>{P&&X()},[P,X]);const{onOpenChange:z,triggerPointerDownPosRef:U}=b;m.useEffect(()=>{if(x){let K={x:0,y:0};const se=ce=>{var oe,de;K={x:Math.abs(Math.round(ce.pageX)-(((oe=U.current)==null?void 0:oe.x)??0)),y:Math.abs(Math.round(ce.pageY)-(((de=U.current)==null?void 0:de.y)??0))}},te=ce=>{K.x<=10&&K.y<=10?ce.preventDefault():ce.composedPath().includes(x)||z(!1),document.removeEventListener("pointermove",se),U.current=null};return U.current!==null&&(document.addEventListener("pointermove",se),document.addEventListener("pointerup",te,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",se),document.removeEventListener("pointerup",te,{capture:!0})}}},[x,z,U]),m.useEffect(()=>{const K=()=>z(!1);return window.addEventListener("blur",K),window.addEventListener("resize",K),()=>{window.removeEventListener("blur",K),window.removeEventListener("resize",K)}},[z]);const[D,G]=fee(K=>{const se=A().filter(oe=>!oe.disabled),te=se.find(oe=>oe.ref.current===document.activeElement),ce=mee(se,K,te);ce&&setTimeout(()=>{var oe;return(oe=ce.ref.current)==null?void 0:oe.focus()})}),q=m.useCallback((K,se,te)=>{const ce=!F.current&&!te;(b.value!==void 0&&b.value===se||ce)&&(L(K),ce&&(F.current=!0))},[b.value]),N=m.useCallback(()=>x==null?void 0:x.focus(),[x]),ee=m.useCallback((K,se,te)=>{const ce=!F.current&&!te;(b.value!==void 0&&b.value===se||ce)&&I(K)},[b.value]),re=s==="popper"?i7:QZ,Q=re===i7?{side:a,sideOffset:l,align:c,alignOffset:d,arrowPadding:h,collisionBoundary:f,collisionPadding:p,sticky:g,hideWhenDetached:y,avoidCollisions:w}:{};return u.jsx(YZ,{scope:n,content:x,viewport:T,onViewportChange:C,itemRefCallback:q,selectedItem:_,onItemLeave:N,itemTextRefCallback:ee,focusSelectedItem:X,selectedItemText:M,position:s,isPositioned:P,searchRef:D,children:u.jsx(b4,{as:pVe,allowPinchZoom:!0,children:u.jsx(g4,{asChild:!0,trapped:b.open,onMountAutoFocus:K=>{K.preventDefault()},onUnmountAutoFocus:Zt(r,K=>{var se;(se=b.trigger)==null||se.focus({preventScroll:!0}),K.preventDefault()}),children:u.jsx(Ob,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:K=>K.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:u.jsx(re,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:K=>K.preventDefault(),...v,...Q,onPlaced:()=>B(!0),ref:S,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:Zt(v.onKeyDown,K=>{const se=K.ctrlKey||K.altKey||K.metaKey;if(K.key==="Tab"&&K.preventDefault(),!se&&K.key.length===1&&G(K.key),["ArrowUp","ArrowDown","Home","End"].includes(K.key)){let ce=A().filter(oe=>!oe.disabled).map(oe=>oe.ref.current);if(["ArrowUp","End"].includes(K.key)&&(ce=ce.slice().reverse()),["ArrowUp","ArrowDown"].includes(K.key)){const oe=K.target,de=ce.indexOf(oe);ce=ce.slice(de+1)}setTimeout(()=>O(ce)),K.preventDefault()}})})})})})})});XZ.displayName=mVe;var gVe="SelectItemAlignedPosition",QZ=m.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:s,...r}=e,i=qh(Ih,n),o=Hh(Ih,n),[a,l]=m.useState(null),[c,d]=m.useState(null),h=Rs(t,d),f=N4(n),p=m.useRef(!1),g=m.useRef(!0),{viewport:y,selectedItem:w,selectedItemText:v,focusSelectedItem:b}=o,x=m.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&c&&y&&w&&v){const S=i.trigger.getBoundingClientRect(),_=c.getBoundingClientRect(),L=i.valueNode.getBoundingClientRect(),M=v.getBoundingClientRect();if(i.dir!=="rtl"){const oe=M.left-_.left,de=L.left-oe,Te=S.left-de,qe=S.width+Te,Ne=Math.max(qe,_.width),ge=window.innerWidth-Il,Ee=n$(de,[Il,Math.max(Il,ge-Ne)]);a.style.minWidth=qe+"px",a.style.left=Ee+"px"}else{const oe=_.right-M.right,de=window.innerWidth-L.right-oe,Te=window.innerWidth-S.right-de,qe=S.width+Te,Ne=Math.max(qe,_.width),ge=window.innerWidth-Il,Ee=n$(de,[Il,Math.max(Il,ge-Ne)]);a.style.minWidth=qe+"px",a.style.right=Ee+"px"}const I=f(),A=window.innerHeight-Il*2,P=y.scrollHeight,B=window.getComputedStyle(c),F=parseInt(B.borderTopWidth,10),O=parseInt(B.paddingTop,10),X=parseInt(B.borderBottomWidth,10),z=parseInt(B.paddingBottom,10),U=F+O+P+z+X,D=Math.min(w.offsetHeight*5,U),G=window.getComputedStyle(y),q=parseInt(G.paddingTop,10),N=parseInt(G.paddingBottom,10),ee=S.top+S.height/2-Il,re=A-ee,Q=w.offsetHeight/2,K=w.offsetTop+Q,se=F+O+K,te=U-se;if(se<=ee){const oe=I.length>0&&w===I[I.length-1].ref.current;a.style.bottom="0px";const de=c.clientHeight-y.offsetTop-y.offsetHeight,Te=Math.max(re,Q+(oe?N:0)+de+X),qe=se+Te;a.style.height=qe+"px"}else{const oe=I.length>0&&w===I[0].ref.current;a.style.top="0px";const Te=Math.max(ee,F+y.offsetTop+(oe?q:0)+Q)+te;a.style.height=Te+"px",y.scrollTop=se-ee+y.offsetTop}a.style.margin=`${Il}px 0`,a.style.minHeight=D+"px",a.style.maxHeight=A+"px",s==null||s(),requestAnimationFrame(()=>p.current=!0)}},[f,i.trigger,i.valueNode,a,c,y,w,v,i.dir,s]);Hi(()=>x(),[x]);const[k,T]=m.useState();Hi(()=>{c&&T(window.getComputedStyle(c).zIndex)},[c]);const C=m.useCallback(S=>{S&&g.current===!0&&(x(),b==null||b(),g.current=!1)},[x,b]);return u.jsx(bVe,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:p,onScrollButtonChange:C,children:u.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:u.jsx(Fn.div,{...r,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});QZ.displayName=gVe;var yVe="SelectPopperPosition",i7=m.forwardRef((e,t)=>{const{__scopeSelect:n,align:s="start",collisionPadding:r=Il,...i}=e,o=I4(n);return u.jsx(dM,{...o,...i,ref:t,align:s,collisionPadding:r,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});i7.displayName=yVe;var[bVe,xM]=Tm(Ih,{}),o7="SelectViewport",JZ=m.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:s,...r}=e,i=Hh(o7,n),o=xM(o7,n),a=Rs(t,i.onViewportChange),l=m.useRef(0);return u.jsxs(u.Fragment,{children:[u.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),u.jsx(M4.Slot,{scope:n,children:u.jsx(Fn.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:Zt(r.onScroll,c=>{const d=c.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:f}=o;if(f!=null&&f.current&&h){const p=Math.abs(l.current-d.scrollTop);if(p>0){const g=window.innerHeight-Il*2,y=parseFloat(h.style.minHeight),w=parseFloat(h.style.height),v=Math.max(y,w);if(v<g){const b=v+p,x=Math.min(g,b),k=b-x;h.style.height=x+"px",h.style.bottom==="0px"&&(d.scrollTop=k>0?k:0,h.style.justifyContent="flex-end")}}}l.current=d.scrollTop})})})]})});JZ.displayName=o7;var ZZ="SelectGroup",[vVe,wVe]=Tm(ZZ),eee=m.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,r=ja();return u.jsx(vVe,{scope:n,id:r,children:u.jsx(Fn.div,{role:"group","aria-labelledby":r,...s,ref:t})})});eee.displayName=ZZ;var tee="SelectLabel",xVe=m.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,r=wVe(tee,n);return u.jsx(Fn.div,{id:r.id,...s,ref:t})});xVe.displayName=tee;var $2="SelectItem",[kVe,nee]=Tm($2),see=m.forwardRef((e,t)=>{const{__scopeSelect:n,value:s,disabled:r=!1,textValue:i,...o}=e,a=qh($2,n),l=Hh($2,n),c=a.value===s,[d,h]=m.useState(i??""),[f,p]=m.useState(!1),g=Pa(x=>{var k;return(k=l.itemRefCallback)==null?void 0:k.call(l,x,s,r)}),y=Rs(t,g),w=ja(),v=m.useRef("touch"),b=()=>{r||(a.onValueChange(s),a.onOpenChange(!1))};return u.jsx(kVe,{scope:n,value:s,disabled:r,textId:w,isSelected:c,onItemTextChange:m.useCallback(x=>{h(k=>k||((x==null?void 0:x.textContent)??"").trim())},[]),children:u.jsx(M4.ItemSlot,{scope:n,value:s,disabled:r,textValue:d,children:u.jsx(Fn.div,{role:"option","aria-labelledby":w,"data-highlighted":f?"":void 0,"aria-selected":c&&f,"data-state":c?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...o,ref:y,onFocus:Zt(o.onFocus,()=>p(!0)),onBlur:Zt(o.onBlur,()=>p(!1)),onClick:Zt(o.onClick,()=>{v.current!=="mouse"&&b()}),onPointerUp:Zt(o.onPointerUp,()=>{v.current==="mouse"&&b()}),onPointerDown:Zt(o.onPointerDown,x=>{v.current=x.pointerType}),onPointerMove:Zt(o.onPointerMove,x=>{var k;v.current=x.pointerType,r?(k=l.onItemLeave)==null||k.call(l):v.current==="mouse"&&x.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Zt(o.onPointerLeave,x=>{var k;x.currentTarget===document.activeElement&&((k=l.onItemLeave)==null||k.call(l))}),onKeyDown:Zt(o.onKeyDown,x=>{var T;r||x.target!==x.currentTarget||((T=l.searchRef)==null?void 0:T.current)!==""&&x.key===" "||(iVe.includes(x.key)&&b(),x.key===" "&&x.preventDefault())})})})})});see.displayName=$2;var b1="SelectItemText",ree=m.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:r,...i}=e,o=qh(b1,n),a=Hh(b1,n),l=nee(b1,n),c=cVe(b1,n),[d,h]=m.useState(null),f=Pa(b=>{var x;return(x=a.itemTextRefCallback)==null?void 0:x.call(a,b,l.value,l.disabled)}),p=Rs(t,h,l.onItemTextChange,f),g=d==null?void 0:d.textContent,y=m.useMemo(()=>u.jsx("option",{value:l.value,disabled:l.disabled,children:g},l.value),[l.disabled,l.value,g]),{onNativeOptionAdd:w,onNativeOptionRemove:v}=c;return Hi(()=>(w(y),()=>v(y)),[w,v,y]),u.jsxs(u.Fragment,{children:[u.jsx(Fn.span,{id:l.textId,...i,ref:p}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!R4(o.value)?_l.createPortal(i.children,o.valueNode):null]})});ree.displayName=b1;var iee="SelectItemIndicator",oee=m.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return nee(iee,n).isSelected?u.jsx(Fn.span,{"aria-hidden":!0,...s,ref:t}):null});oee.displayName=iee;var a7="SelectScrollUpButton",aee=m.forwardRef((e,t)=>{const n=Hh(a7,e.__scopeSelect),s=xM(a7,e.__scopeSelect),[r,i]=m.useState(!1),o=Rs(t,s.onScrollButtonChange);return Hi(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollTop>0;i(c)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),r?u.jsx(cee,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});aee.displayName=a7;var l7="SelectScrollDownButton",lee=m.forwardRef((e,t)=>{const n=Hh(l7,e.__scopeSelect),s=xM(l7,e.__scopeSelect),[r,i]=m.useState(!1),o=Rs(t,s.onScrollButtonChange);return Hi(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,d=Math.ceil(l.scrollTop)<c;i(d)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),r?u.jsx(cee,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});lee.displayName=l7;var cee=m.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:s,...r}=e,i=Hh("SelectScrollButton",n),o=m.useRef(null),a=N4(n),l=m.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return m.useEffect(()=>()=>l(),[l]),Hi(()=>{var d;const c=a().find(h=>h.ref.current===document.activeElement);(d=c==null?void 0:c.ref.current)==null||d.scrollIntoView({block:"nearest"})},[a]),u.jsx(Fn.div,{"aria-hidden":!0,...r,ref:t,style:{flexShrink:0,...r.style},onPointerDown:Zt(r.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(s,50))}),onPointerMove:Zt(r.onPointerMove,()=>{var c;(c=i.onItemLeave)==null||c.call(i),o.current===null&&(o.current=window.setInterval(s,50))}),onPointerLeave:Zt(r.onPointerLeave,()=>{l()})})}),_Ve="SelectSeparator",SVe=m.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return u.jsx(Fn.div,{"aria-hidden":!0,...s,ref:t})});SVe.displayName=_Ve;var uee="SelectArrow",CVe=m.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,r=I4(n);return Hh(uee,n).position==="popper"?u.jsx(hM,{...r,...s,ref:t}):null});CVe.displayName=uee;var dee="SelectBubbleInput",hee=m.forwardRef(({__scopeSelect:e,...t},n)=>{const s=qh(dee,e),{value:r,onValueChange:i,required:o,disabled:a,name:l,autoComplete:c,form:d}=s,{nativeOptions:h,nativeSelectKey:f}=s,p=m.useRef(null),g=Rs(n,p),y=r??"",w=CJ(y),v=Array.from(h).some(b=>(b.props.value??"")==="");return m.useEffect(()=>{const b=p.current;if(!b)return;const x=window.HTMLSelectElement.prototype,T=Object.getOwnPropertyDescriptor(x,"value").set;if(w!==y&&T){const C=new Event("change",{bubbles:!0});T.call(b,y),b.dispatchEvent(C)}},[w,y]),u.jsxs(Fn.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:l,autoComplete:c,disabled:a,form:d,onChange:b=>i(b.target.value),...t,style:{...eJ,...t.style},ref:g,defaultValue:y,children:[R4(r)&&!v?u.jsx("option",{value:""}):null,Array.from(h)]},f)});hee.displayName=dee;function TVe(e){return typeof e=="function"}function R4(e){return e===""||e===void 0}function fee(e){const t=Pa(e),n=m.useRef(""),s=m.useRef(0),r=m.useCallback(o=>{const a=n.current+o;t(a),function l(c){n.current=c,window.clearTimeout(s.current),c!==""&&(s.current=window.setTimeout(()=>l(""),1e3))}(a)},[t]),i=m.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return m.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,r,i]}function mee(e,t,n){const r=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=EVe(e,Math.max(i,0));r.length===1&&(o=o.filter(c=>c!==n));const l=o.find(c=>c.textValue.toLowerCase().startsWith(r.toLowerCase()));return l!==n?l:void 0}function EVe(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var AVe="Separator",s$="horizontal",MVe=["horizontal","vertical"],pee=m.forwardRef((e,t)=>{const{decorative:n,orientation:s=s$,...r}=e,i=NVe(s)?s:s$,a=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return u.jsx(Fn.div,{"data-orientation":i,...a,...r,ref:t})});pee.displayName=AVe;function NVe(e){return MVe.includes(e)}var IVe=pee,j4="Switch",[RVe,J0t]=Kc(j4),[jVe,kM]=RVe(j4);function LVe(e){const{__scopeSwitch:t,checked:n,children:s,defaultChecked:r,disabled:i,form:o,name:a,onCheckedChange:l,required:c,value:d="on",internal_do_not_use_render:h}=e,[f,p]=Wu({prop:n,defaultProp:r??!1,onChange:l,caller:j4}),[g,y]=m.useState(null),[w,v]=m.useState(null),b=m.useRef(!1),x=g?!!o||!!g.closest("form"):!0,k={checked:f,setChecked:p,disabled:i,control:g,setControl:y,name:a,form:o,value:d,hasConsumerStoppedPropagationRef:b,required:c,defaultChecked:r,isFormControl:x,bubbleInput:w,setBubbleInput:v};return u.jsx(jVe,{scope:t,...k,children:DVe(h)?h(k):s})}var gee="SwitchTrigger",yee=m.forwardRef(({__scopeSwitch:e,onClick:t,...n},s)=>{const{control:r,form:i,value:o,disabled:a,checked:l,required:c,setControl:d,setChecked:h,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:g}=kM(gee,e),y=Rs(s,d),w=m.useRef(l);return m.useEffect(()=>{const v=i?r==null?void 0:r.ownerDocument.getElementById(i):r==null?void 0:r.form;if(v instanceof HTMLFormElement){const b=()=>h(w.current);return v.addEventListener("reset",b),()=>v.removeEventListener("reset",b)}},[r,i,h]),u.jsx(Fn.button,{type:"button",role:"switch","aria-checked":l,"aria-required":c,"data-state":_ee(l),"data-disabled":a?"":void 0,disabled:a,value:o,...n,ref:y,onClick:Zt(t,v=>{h(b=>!b),g&&p&&(f.current=v.isPropagationStopped(),f.current||v.stopPropagation())})})});yee.displayName=gee;var bee=m.forwardRef((e,t)=>{const{__scopeSwitch:n,name:s,checked:r,defaultChecked:i,required:o,disabled:a,value:l,onCheckedChange:c,form:d,...h}=e;return u.jsx(LVe,{__scopeSwitch:n,checked:r,defaultChecked:i,disabled:a,required:o,onCheckedChange:c,name:s,form:d,value:l,internal_do_not_use_render:({isFormControl:f})=>u.jsxs(u.Fragment,{children:[u.jsx(yee,{...h,ref:t,__scopeSwitch:n}),f&&u.jsx(kee,{__scopeSwitch:n})]})})});bee.displayName=j4;var vee="SwitchThumb",wee=m.forwardRef((e,t)=>{const{__scopeSwitch:n,...s}=e,r=kM(vee,n);return u.jsx(Fn.span,{"data-state":_ee(r.checked),"data-disabled":r.disabled?"":void 0,...s,ref:t})});wee.displayName=vee;var xee="SwitchBubbleInput",kee=m.forwardRef(({__scopeSwitch:e,...t},n)=>{const{control:s,hasConsumerStoppedPropagationRef:r,checked:i,defaultChecked:o,required:a,disabled:l,name:c,value:d,form:h,bubbleInput:f,setBubbleInput:p}=kM(xee,e),g=Rs(n,p),y=CJ(i),w=TJ(s);m.useEffect(()=>{const b=f;if(!b)return;const x=window.HTMLInputElement.prototype,T=Object.getOwnPropertyDescriptor(x,"checked").set,C=!r.current;if(y!==i&&T){const S=new Event("click",{bubbles:C});T.call(b,i),b.dispatchEvent(S)}},[f,y,i,r]);const v=m.useRef(i);return u.jsx(Fn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??v.current,required:a,disabled:l,name:c,value:d,form:h,...t,tabIndex:-1,ref:g,style:{...t.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});kee.displayName=xee;function DVe(e){return typeof e=="function"}function _ee(e){return e?"checked":"unchecked"}var L4="Tabs",[OVe,Z0t]=Kc(L4,[T4]),See=T4(),[PVe,_M]=OVe(L4),Cee=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:r,defaultValue:i,orientation:o="horizontal",dir:a,activationMode:l="automatic",...c}=e,d=p4(a),[h,f]=Wu({prop:s,onChange:r,defaultProp:i??"",caller:L4});return u.jsx(PVe,{scope:n,baseId:ja(),value:h,onValueChange:f,orientation:o,dir:d,activationMode:l,children:u.jsx(Fn.div,{dir:d,"data-orientation":o,...c,ref:t})})});Cee.displayName=L4;var Tee="TabsList",Eee=m.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...r}=e,i=_M(Tee,n),o=See(n);return u.jsx(ZJ,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:s,children:u.jsx(Fn.div,{role:"tablist","aria-orientation":i.orientation,...r,ref:t})})});Eee.displayName=Tee;var Aee="TabsTrigger",Mee=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:r=!1,...i}=e,o=_M(Aee,n),a=See(n),l=Ree(o.baseId,s),c=jee(o.baseId,s),d=s===o.value;return u.jsx(eZ,{asChild:!0,...a,focusable:!r,active:d,children:u.jsx(Fn.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":c,"data-state":d?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:l,...i,ref:t,onMouseDown:Zt(e.onMouseDown,h=>{!r&&h.button===0&&h.ctrlKey===!1?o.onValueChange(s):h.preventDefault()}),onKeyDown:Zt(e.onKeyDown,h=>{r||h.target!==h.currentTarget||[" ","Enter"].includes(h.key)&&o.onValueChange(s)}),onFocus:Zt(e.onFocus,()=>{const h=o.activationMode!=="manual";!d&&!r&&h&&o.onValueChange(s)})})})});Mee.displayName=Aee;var Nee="TabsContent",Iee=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:r,children:i,...o}=e,a=_M(Nee,n),l=Ree(a.baseId,s),c=jee(a.baseId,s),d=s===a.value,h=m.useRef(d);return m.useEffect(()=>{const f=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(f)},[]),u.jsx(Cl,{present:r||d,children:({present:f})=>u.jsx(Fn.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!f,id:c,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:f&&i})})});Iee.displayName=Nee;function Ree(e,t){return`${e}-trigger-${t}`}function jee(e,t){return`${e}-content-${t}`}var BVe=Cee,$Ve=Eee,zVe=Mee,FVe=Iee,[D4,egt]=Kc("Tooltip",[lg]),O4=lg(),Lee="TooltipProvider",qVe=700,c7="tooltip.open",[HVe,SM]=D4(Lee),Dee=e=>{const{__scopeTooltip:t,delayDuration:n=qVe,skipDelayDuration:s=300,disableHoverableContent:r=!1,children:i}=e,o=m.useRef(!0),a=m.useRef(!1),l=m.useRef(0);return m.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),u.jsx(HVe,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:m.useCallback(()=>{s<=0||(window.clearTimeout(l.current),o.current=!1)},[s]),onClose:m.useCallback(()=>{s<=0||(window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.current=!0,s))},[s]),isPointerInTransitRef:a,onPointerInTransitChange:m.useCallback(c=>{a.current=c},[]),disableHoverableContent:r,children:i})};Dee.displayName=Lee;var sb="Tooltip",[UVe,qb]=D4(sb),Oee=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:r,onOpenChange:i,disableHoverableContent:o,delayDuration:a}=e,l=SM(sb,e.__scopeTooltip),c=O4(t),[d,h]=m.useState(null),f=ja(),p=m.useRef(0),g=o??l.disableHoverableContent,y=a??l.delayDuration,w=m.useRef(!1),[v,b]=Wu({prop:s,defaultProp:r??!1,onChange:S=>{S?(l.onOpen(),document.dispatchEvent(new CustomEvent(c7))):l.onClose(),i==null||i(S)},caller:sb}),x=m.useMemo(()=>v?w.current?"delayed-open":"instant-open":"closed",[v]),k=m.useCallback(()=>{window.clearTimeout(p.current),p.current=0,w.current=!1,b(!0)},[b]),T=m.useCallback(()=>{window.clearTimeout(p.current),p.current=0,b(!1)},[b]),C=m.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{w.current=!0,b(!0),p.current=0},y)},[y,b]);return m.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),u.jsx(C4,{...c,children:u.jsx(UVe,{scope:t,contentId:f,open:v,stateAttribute:x,trigger:d,onTriggerChange:h,onTriggerEnter:m.useCallback(()=>{l.isOpenDelayedRef.current?C():k()},[l.isOpenDelayedRef,C,k]),onTriggerLeave:m.useCallback(()=>{g?T():(window.clearTimeout(p.current),p.current=0)},[T,g]),onOpen:k,onClose:T,disableHoverableContent:g,children:n})})};Oee.displayName=sb;var u7="TooltipTrigger",Pee=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,r=qb(u7,n),i=SM(u7,n),o=O4(n),a=m.useRef(null),l=Rs(t,a,r.onTriggerChange),c=m.useRef(!1),d=m.useRef(!1),h=m.useCallback(()=>c.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),u.jsx(uM,{asChild:!0,...o,children:u.jsx(Fn.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...s,ref:l,onPointerMove:Zt(e.onPointerMove,f=>{f.pointerType!=="touch"&&!d.current&&!i.isPointerInTransitRef.current&&(r.onTriggerEnter(),d.current=!0)}),onPointerLeave:Zt(e.onPointerLeave,()=>{r.onTriggerLeave(),d.current=!1}),onPointerDown:Zt(e.onPointerDown,()=>{r.open&&r.onClose(),c.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Zt(e.onFocus,()=>{c.current||r.onOpen()}),onBlur:Zt(e.onBlur,r.onClose),onClick:Zt(e.onClick,r.onClose)})})});Pee.displayName=u7;var CM="TooltipPortal",[VVe,WVe]=D4(CM,{forceMount:void 0}),Bee=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:r}=e,i=qb(CM,t);return u.jsx(VVe,{scope:t,forceMount:n,children:u.jsx(Cl,{present:n||i.open,children:u.jsx(Pb,{asChild:!0,container:r,children:s})})})};Bee.displayName=CM;var L0="TooltipContent",$ee=m.forwardRef((e,t)=>{const n=WVe(L0,e.__scopeTooltip),{forceMount:s=n.forceMount,side:r="top",...i}=e,o=qb(L0,e.__scopeTooltip);return u.jsx(Cl,{present:s||o.open,children:o.disableHoverableContent?u.jsx(zee,{side:r,...i,ref:t}):u.jsx(GVe,{side:r,...i,ref:t})})}),GVe=m.forwardRef((e,t)=>{const n=qb(L0,e.__scopeTooltip),s=SM(L0,e.__scopeTooltip),r=m.useRef(null),i=Rs(t,r),[o,a]=m.useState(null),{trigger:l,onClose:c}=n,d=r.current,{onPointerInTransitChange:h}=s,f=m.useCallback(()=>{a(null),h(!1)},[h]),p=m.useCallback((g,y)=>{const w=g.currentTarget,v={x:g.clientX,y:g.clientY},b=QVe(v,w.getBoundingClientRect()),x=JVe(v,b),k=ZVe(y.getBoundingClientRect()),T=tWe([...x,...k]);a(T),h(!0)},[h]);return m.useEffect(()=>()=>f(),[f]),m.useEffect(()=>{if(l&&d){const g=w=>p(w,d),y=w=>p(w,l);return l.addEventListener("pointerleave",g),d.addEventListener("pointerleave",y),()=>{l.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",y)}}},[l,d,p,f]),m.useEffect(()=>{if(o){const g=y=>{const w=y.target,v={x:y.clientX,y:y.clientY},b=(l==null?void 0:l.contains(w))||(d==null?void 0:d.contains(w)),x=!eWe(v,o);b?f():x&&(f(),c())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[l,d,o,c,f]),u.jsx(zee,{...e,ref:i})}),[KVe,YVe]=D4(sb,{isInside:!1}),XVe=Ize("TooltipContent"),zee=m.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":r,onEscapeKeyDown:i,onPointerDownOutside:o,...a}=e,l=qb(L0,n),c=O4(n),{onClose:d}=l;return m.useEffect(()=>(document.addEventListener(c7,d),()=>document.removeEventListener(c7,d)),[d]),m.useEffect(()=>{if(l.trigger){const h=f=>{f.target instanceof Node&&f.target.contains(l.trigger)&&d()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[l.trigger,d]),u.jsx(Ob,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:d,children:u.jsxs(dM,{"data-state":l.stateAttribute,...c,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[u.jsx(XVe,{children:s}),u.jsx(KVe,{scope:n,isInside:!0,children:u.jsx(qze,{id:l.contentId,role:"tooltip",children:r||s})})]})})});$ee.displayName=L0;var Fee="TooltipArrow",qee=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,r=O4(n);return YVe(Fee,n).isInside?null:u.jsx(hM,{...r,...s,ref:t})});qee.displayName=Fee;function QVe(e,t){const n=Math.abs(t.top-e.y),s=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,s,r,i)){case i:return"left";case r:return"right";case n:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function JVe(e,t,n=5){const s=[];switch(t){case"top":s.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":s.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":s.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":s.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return s}function ZVe(e){const{top:t,right:n,bottom:s,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:s},{x:r,y:s}]}function eWe(e,t){const{x:n,y:s}=e;let r=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const a=t[i],l=t[o],c=a.x,d=a.y,h=l.x,f=l.y;d>s!=f>s&&n<(h-c)*(s-d)/(f-d)+c&&(r=!r)}return r}function tWe(e){const t=e.slice();return t.sort((n,s)=>n.x<s.x?-1:n.x>s.x?1:n.y<s.y?-1:n.y>s.y?1:0),nWe(t)}function nWe(e){if(e.length<=1)return e.slice();const t=[];for(let s=0;s<e.length;s++){const r=e[s];for(;t.length>=2;){const i=t[t.length-1],o=t[t.length-2];if((i.x-o.x)*(r.y-o.y)>=(i.y-o.y)*(r.x-o.x))t.pop();else break}t.push(r)}t.pop();const n=[];for(let s=e.length-1;s>=0;s--){const r=e[s];for(;n.length>=2;){const i=n[n.length-1],o=n[n.length-2];if((i.x-o.x)*(r.y-o.y)>=(i.y-o.y)*(r.x-o.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var sWe=Dee,rWe=Oee,iWe=Pee,oWe=Bee,aWe=$ee,lWe=qee;function Hee(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=Hee(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function Uee(){for(var e,t,n=0,s="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Hee(e))&&(s&&(s+=" "),s+=t);return s}const cWe=(e,t)=>{const n=new Array(e.length+t.length);for(let s=0;s<e.length;s++)n[s]=e[s];for(let s=0;s<t.length;s++)n[e.length+s]=t[s];return n},uWe=(e,t)=>({classGroupId:e,validator:t}),Vee=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),z2="-",r$=[],dWe="arbitrary..",hWe=e=>{const t=mWe(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return fWe(o);const a=o.split(z2),l=a[0]===""&&a.length>1?1:0;return Wee(a,l,t)},getConflictingClassGroupIds:(o,a)=>{if(a){const l=s[o],c=n[o];return l?c?cWe(c,l):l:c||r$}return n[o]||r$}}},Wee=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const r=e[t],i=n.nextPart.get(r);if(i){const c=Wee(e,t+1,i);if(c)return c}const o=n.validators;if(o===null)return;const a=t===0?e.join(z2):e.slice(t).join(z2),l=o.length;for(let c=0;c<l;c++){const d=o[c];if(d.validator(a))return d.classGroupId}},fWe=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),s=t.slice(0,n);return s?dWe+s:void 0})(),mWe=e=>{const{theme:t,classGroups:n}=e;return pWe(n,t)},pWe=(e,t)=>{const n=Vee();for(const s in e){const r=e[s];TM(r,n,s,t)}return n},TM=(e,t,n,s)=>{const r=e.length;for(let i=0;i<r;i++){const o=e[i];gWe(o,t,n,s)}},gWe=(e,t,n,s)=>{if(typeof e=="string"){yWe(e,t,n);return}if(typeof e=="function"){bWe(e,t,n,s);return}vWe(e,t,n,s)},yWe=(e,t,n)=>{const s=e===""?t:Gee(t,e);s.classGroupId=n},bWe=(e,t,n,s)=>{if(wWe(e)){TM(e(s),t,n,s);return}t.validators===null&&(t.validators=[]),t.validators.push(uWe(n,e))},vWe=(e,t,n,s)=>{const r=Object.entries(e),i=r.length;for(let o=0;o<i;o++){const[a,l]=r[o];TM(l,Gee(t,a),n,s)}},Gee=(e,t)=>{let n=e;const s=t.split(z2),r=s.length;for(let i=0;i<r;i++){const o=s[i];let a=n.nextPart.get(o);a||(a=Vee(),n.nextPart.set(o,a)),n=a}return n},wWe=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,xWe=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),s=Object.create(null);const r=(i,o)=>{n[i]=o,t++,t>e&&(t=0,s=n,n=Object.create(null))};return{get(i){let o=n[i];if(o!==void 0)return o;if((o=s[i])!==void 0)return r(i,o),o},set(i,o){i in n?n[i]=o:r(i,o)}}},d7="!",i$=":",kWe=[],o$=(e,t,n,s,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:s,isExternal:r}),_We=e=>{const{prefix:t,experimentalParseClassName:n}=e;let s=r=>{const i=[];let o=0,a=0,l=0,c;const d=r.length;for(let y=0;y<d;y++){const w=r[y];if(o===0&&a===0){if(w===i$){i.push(r.slice(l,y)),l=y+1;continue}if(w==="/"){c=y;continue}}w==="["?o++:w==="]"?o--:w==="("?a++:w===")"&&a--}const h=i.length===0?r:r.slice(l);let f=h,p=!1;h.endsWith(d7)?(f=h.slice(0,-1),p=!0):h.startsWith(d7)&&(f=h.slice(1),p=!0);const g=c&&c>l?c-l:void 0;return o$(i,p,f,g)};if(t){const r=t+i$,i=s;s=o=>o.startsWith(r)?i(o.slice(r.length)):o$(kWe,!1,o,void 0,!0)}if(n){const r=s;s=i=>n({className:i,parseClassName:r})}return s},SWe=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,s)=>{t.set(n,1e6+s)}),n=>{const s=[];let r=[];for(let i=0;i<n.length;i++){const o=n[i],a=o[0]==="[",l=t.has(o);a||l?(r.length>0&&(r.sort(),s.push(...r),r=[]),s.push(o)):r.push(o)}return r.length>0&&(r.sort(),s.push(...r)),s}},CWe=e=>({cache:xWe(e.cacheSize),parseClassName:_We(e),sortModifiers:SWe(e),postfixLookupClassGroupIds:TWe(e),...hWe(e)}),TWe=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let s=0;s<n.length;s++)t[n[s]]=!0;return t},EWe=/\s+/,AWe=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:r,sortModifiers:i,postfixLookupClassGroupIds:o}=t,a=[],l=e.trim().split(EWe);let c="";for(let d=l.length-1;d>=0;d-=1){const h=l[d],{isExternal:f,modifiers:p,hasImportantModifier:g,baseClassName:y,maybePostfixModifierPosition:w}=n(h);if(f){c=h+(c.length>0?" "+c:c);continue}let v=!!w,b;if(v){const S=y.substring(0,w);b=s(S);const _=b&&o[b]?s(y):void 0;_&&_!==b&&(b=_,v=!1)}else b=s(y);if(!b){if(!v){c=h+(c.length>0?" "+c:c);continue}if(b=s(y),!b){c=h+(c.length>0?" "+c:c);continue}v=!1}const x=p.length===0?"":p.length===1?p[0]:i(p).join(":"),k=g?x+d7:x,T=k+b;if(a.indexOf(T)>-1)continue;a.push(T);const C=r(b,v);for(let S=0;S<C.length;++S){const _=C[S];a.push(k+_)}c=h+(c.length>0?" "+c:c)}return c},MWe=(...e)=>{let t=0,n,s,r="";for(;t<e.length;)(n=e[t++])&&(s=Kee(n))&&(r&&(r+=" "),r+=s);return r},Kee=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=Kee(e[s]))&&(n&&(n+=" "),n+=t);return n},NWe=(e,...t)=>{let n,s,r,i;const o=l=>{const c=t.reduce((d,h)=>h(d),e());return n=CWe(c),s=n.cache.get,r=n.cache.set,i=a,a(l)},a=l=>{const c=s(l);if(c)return c;const d=AWe(l,n);return r(l,d),d};return i=o,(...l)=>i(MWe(...l))},IWe=[],bi=e=>{const t=n=>n[e]||IWe;return t.isThemeGetter=!0,t},Yee=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Xee=/^\((?:(\w[\w-]*):)?(.+)\)$/i,RWe=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,jWe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,LWe=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,DWe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,OWe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,PWe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,xd=e=>RWe.test(e),os=e=>!!e&&!Number.isNaN(Number(e)),rc=e=>!!e&&Number.isInteger(Number(e)),fC=e=>e.endsWith("%")&&os(e.slice(0,-1)),lu=e=>jWe.test(e),Qee=()=>!0,BWe=e=>LWe.test(e)&&!DWe.test(e),EM=()=>!1,$We=e=>OWe.test(e),zWe=e=>PWe.test(e),FWe=e=>!Yt(e)&&!Jt(e),qWe=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),HWe=e=>Uh(e,ete,EM),Yt=e=>Yee.test(e),hf=e=>Uh(e,tte,BWe),a$=e=>Uh(e,QWe,os),UWe=e=>Uh(e,ste,Qee),VWe=e=>Uh(e,nte,EM),l$=e=>Uh(e,Jee,EM),WWe=e=>Uh(e,Zee,zWe),Dw=e=>Uh(e,rte,$We),Jt=e=>Xee.test(e),Qg=e=>Em(e,tte),GWe=e=>Em(e,nte),c$=e=>Em(e,Jee),KWe=e=>Em(e,ete),YWe=e=>Em(e,Zee),Ow=e=>Em(e,rte,!0),XWe=e=>Em(e,ste,!0),Uh=(e,t,n)=>{const s=Yee.exec(e);return s?s[1]?t(s[1]):n(s[2]):!1},Em=(e,t,n=!1)=>{const s=Xee.exec(e);return s?s[1]?t(s[1]):n:!1},Jee=e=>e==="position"||e==="percentage",Zee=e=>e==="image"||e==="url",ete=e=>e==="length"||e==="size"||e==="bg-size",tte=e=>e==="length",QWe=e=>e==="number",nte=e=>e==="family-name",ste=e=>e==="number"||e==="weight",rte=e=>e==="shadow",JWe=()=>{const e=bi("color"),t=bi("font"),n=bi("text"),s=bi("font-weight"),r=bi("tracking"),i=bi("leading"),o=bi("breakpoint"),a=bi("container"),l=bi("spacing"),c=bi("radius"),d=bi("shadow"),h=bi("inset-shadow"),f=bi("text-shadow"),p=bi("drop-shadow"),g=bi("blur"),y=bi("perspective"),w=bi("aspect"),v=bi("ease"),b=bi("animate"),x=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],T=()=>[...k(),Jt,Yt],C=()=>["auto","hidden","clip","visible","scroll"],S=()=>["auto","contain","none"],_=()=>[Jt,Yt,l],L=()=>[xd,"full","auto",..._()],M=()=>[rc,"none","subgrid",Jt,Yt],I=()=>["auto",{span:["full",rc,Jt,Yt]},rc,Jt,Yt],A=()=>[rc,"auto",Jt,Yt],P=()=>["auto","min","max","fr",Jt,Yt],B=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],F=()=>["start","end","center","stretch","center-safe","end-safe"],O=()=>["auto",..._()],X=()=>[xd,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",..._()],z=()=>[xd,"screen","full","dvw","lvw","svw","min","max","fit",..._()],U=()=>[xd,"screen","full","lh","dvh","lvh","svh","min","max","fit",..._()],D=()=>[e,Jt,Yt],G=()=>[...k(),c$,l$,{position:[Jt,Yt]}],q=()=>["no-repeat",{repeat:["","x","y","space","round"]}],N=()=>["auto","cover","contain",KWe,HWe,{size:[Jt,Yt]}],ee=()=>[fC,Qg,hf],re=()=>["","none","full",c,Jt,Yt],Q=()=>["",os,Qg,hf],K=()=>["solid","dashed","dotted","double"],se=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],te=()=>[os,fC,c$,l$],ce=()=>["","none",g,Jt,Yt],oe=()=>["none",os,Jt,Yt],de=()=>["none",os,Jt,Yt],Te=()=>[os,Jt,Yt],qe=()=>[xd,"full",..._()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[lu],breakpoint:[lu],color:[Qee],container:[lu],"drop-shadow":[lu],ease:["in","out","in-out"],font:[FWe],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[lu],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[lu],shadow:[lu],spacing:["px",os],text:[lu],"text-shadow":[lu],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",xd,Yt,Jt,w]}],container:["container"],"container-type":[{"@container":["","normal","size",Jt,Yt]}],"container-named":[qWe],columns:[{columns:[os,Yt,Jt,a]}],"break-after":[{"break-after":x()}],"break-before":[{"break-before":x()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:T()}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{"inset-s":L(),start:L()}],end:[{"inset-e":L(),end:L()}],"inset-bs":[{"inset-bs":L()}],"inset-be":[{"inset-be":L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[rc,"auto",Jt,Yt]}],basis:[{basis:[xd,"full","auto",a,..._()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[os,xd,"auto","initial","none",Yt]}],grow:[{grow:["",os,Jt,Yt]}],shrink:[{shrink:["",os,Jt,Yt]}],order:[{order:[rc,"first","last","none",Jt,Yt]}],"grid-cols":[{"grid-cols":M()}],"col-start-end":[{col:I()}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":M()}],"row-start-end":[{row:I()}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":P()}],"auto-rows":[{"auto-rows":P()}],gap:[{gap:_()}],"gap-x":[{"gap-x":_()}],"gap-y":[{"gap-y":_()}],"justify-content":[{justify:[...B(),"normal"]}],"justify-items":[{"justify-items":[...F(),"normal"]}],"justify-self":[{"justify-self":["auto",...F()]}],"align-content":[{content:["normal",...B()]}],"align-items":[{items:[...F(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...F(),{baseline:["","last"]}]}],"place-content":[{"place-content":B()}],"place-items":[{"place-items":[...F(),"baseline"]}],"place-self":[{"place-self":["auto",...F()]}],p:[{p:_()}],px:[{px:_()}],py:[{py:_()}],ps:[{ps:_()}],pe:[{pe:_()}],pbs:[{pbs:_()}],pbe:[{pbe:_()}],pt:[{pt:_()}],pr:[{pr:_()}],pb:[{pb:_()}],pl:[{pl:_()}],m:[{m:O()}],mx:[{mx:O()}],my:[{my:O()}],ms:[{ms:O()}],me:[{me:O()}],mbs:[{mbs:O()}],mbe:[{mbe:O()}],mt:[{mt:O()}],mr:[{mr:O()}],mb:[{mb:O()}],ml:[{ml:O()}],"space-x":[{"space-x":_()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":_()}],"space-y-reverse":["space-y-reverse"],size:[{size:X()}],"inline-size":[{inline:["auto",...z()]}],"min-inline-size":[{"min-inline":["auto",...z()]}],"max-inline-size":[{"max-inline":["none",...z()]}],"block-size":[{block:["auto",...U()]}],"min-block-size":[{"min-block":["auto",...U()]}],"max-block-size":[{"max-block":["none",...U()]}],w:[{w:[a,"screen",...X()]}],"min-w":[{"min-w":[a,"screen","none",...X()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...X()]}],h:[{h:["screen","lh",...X()]}],"min-h":[{"min-h":["screen","lh","none",...X()]}],"max-h":[{"max-h":["screen","lh",...X()]}],"font-size":[{text:["base",n,Qg,hf]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,XWe,UWe]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",fC,Yt]}],"font-family":[{font:[GWe,VWe,t]}],"font-features":[{"font-features":[Yt]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,Jt,Yt]}],"line-clamp":[{"line-clamp":[os,"none",Jt,a$]}],leading:[{leading:[i,..._()]}],"list-image":[{"list-image":["none",Jt,Yt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Jt,Yt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:D()}],"text-color":[{text:D()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...K(),"wavy"]}],"text-decoration-thickness":[{decoration:[os,"from-font","auto",Jt,hf]}],"text-decoration-color":[{decoration:D()}],"underline-offset":[{"underline-offset":[os,"auto",Jt,Yt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"tab-size":[{tab:[rc,Jt,Yt]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Jt,Yt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Jt,Yt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:G()}],"bg-repeat":[{bg:q()}],"bg-size":[{bg:N()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},rc,Jt,Yt],radial:["",Jt,Yt],conic:[rc,Jt,Yt]},YWe,WWe]}],"bg-color":[{bg:D()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:D()}],"gradient-via":[{via:D()}],"gradient-to":[{to:D()}],rounded:[{rounded:re()}],"rounded-s":[{"rounded-s":re()}],"rounded-e":[{"rounded-e":re()}],"rounded-t":[{"rounded-t":re()}],"rounded-r":[{"rounded-r":re()}],"rounded-b":[{"rounded-b":re()}],"rounded-l":[{"rounded-l":re()}],"rounded-ss":[{"rounded-ss":re()}],"rounded-se":[{"rounded-se":re()}],"rounded-ee":[{"rounded-ee":re()}],"rounded-es":[{"rounded-es":re()}],"rounded-tl":[{"rounded-tl":re()}],"rounded-tr":[{"rounded-tr":re()}],"rounded-br":[{"rounded-br":re()}],"rounded-bl":[{"rounded-bl":re()}],"border-w":[{border:Q()}],"border-w-x":[{"border-x":Q()}],"border-w-y":[{"border-y":Q()}],"border-w-s":[{"border-s":Q()}],"border-w-e":[{"border-e":Q()}],"border-w-bs":[{"border-bs":Q()}],"border-w-be":[{"border-be":Q()}],"border-w-t":[{"border-t":Q()}],"border-w-r":[{"border-r":Q()}],"border-w-b":[{"border-b":Q()}],"border-w-l":[{"border-l":Q()}],"divide-x":[{"divide-x":Q()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Q()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...K(),"hidden","none"]}],"divide-style":[{divide:[...K(),"hidden","none"]}],"border-color":[{border:D()}],"border-color-x":[{"border-x":D()}],"border-color-y":[{"border-y":D()}],"border-color-s":[{"border-s":D()}],"border-color-e":[{"border-e":D()}],"border-color-bs":[{"border-bs":D()}],"border-color-be":[{"border-be":D()}],"border-color-t":[{"border-t":D()}],"border-color-r":[{"border-r":D()}],"border-color-b":[{"border-b":D()}],"border-color-l":[{"border-l":D()}],"divide-color":[{divide:D()}],"outline-style":[{outline:[...K(),"none","hidden"]}],"outline-offset":[{"outline-offset":[os,Jt,Yt]}],"outline-w":[{outline:["",os,Qg,hf]}],"outline-color":[{outline:D()}],shadow:[{shadow:["","none",d,Ow,Dw]}],"shadow-color":[{shadow:D()}],"inset-shadow":[{"inset-shadow":["none",h,Ow,Dw]}],"inset-shadow-color":[{"inset-shadow":D()}],"ring-w":[{ring:Q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:D()}],"ring-offset-w":[{"ring-offset":[os,hf]}],"ring-offset-color":[{"ring-offset":D()}],"inset-ring-w":[{"inset-ring":Q()}],"inset-ring-color":[{"inset-ring":D()}],"text-shadow":[{"text-shadow":["none",f,Ow,Dw]}],"text-shadow-color":[{"text-shadow":D()}],opacity:[{opacity:[os,Jt,Yt]}],"mix-blend":[{"mix-blend":[...se(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":se()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[os]}],"mask-image-linear-from-pos":[{"mask-linear-from":te()}],"mask-image-linear-to-pos":[{"mask-linear-to":te()}],"mask-image-linear-from-color":[{"mask-linear-from":D()}],"mask-image-linear-to-color":[{"mask-linear-to":D()}],"mask-image-t-from-pos":[{"mask-t-from":te()}],"mask-image-t-to-pos":[{"mask-t-to":te()}],"mask-image-t-from-color":[{"mask-t-from":D()}],"mask-image-t-to-color":[{"mask-t-to":D()}],"mask-image-r-from-pos":[{"mask-r-from":te()}],"mask-image-r-to-pos":[{"mask-r-to":te()}],"mask-image-r-from-color":[{"mask-r-from":D()}],"mask-image-r-to-color":[{"mask-r-to":D()}],"mask-image-b-from-pos":[{"mask-b-from":te()}],"mask-image-b-to-pos":[{"mask-b-to":te()}],"mask-image-b-from-color":[{"mask-b-from":D()}],"mask-image-b-to-color":[{"mask-b-to":D()}],"mask-image-l-from-pos":[{"mask-l-from":te()}],"mask-image-l-to-pos":[{"mask-l-to":te()}],"mask-image-l-from-color":[{"mask-l-from":D()}],"mask-image-l-to-color":[{"mask-l-to":D()}],"mask-image-x-from-pos":[{"mask-x-from":te()}],"mask-image-x-to-pos":[{"mask-x-to":te()}],"mask-image-x-from-color":[{"mask-x-from":D()}],"mask-image-x-to-color":[{"mask-x-to":D()}],"mask-image-y-from-pos":[{"mask-y-from":te()}],"mask-image-y-to-pos":[{"mask-y-to":te()}],"mask-image-y-from-color":[{"mask-y-from":D()}],"mask-image-y-to-color":[{"mask-y-to":D()}],"mask-image-radial":[{"mask-radial":[Jt,Yt]}],"mask-image-radial-from-pos":[{"mask-radial-from":te()}],"mask-image-radial-to-pos":[{"mask-radial-to":te()}],"mask-image-radial-from-color":[{"mask-radial-from":D()}],"mask-image-radial-to-color":[{"mask-radial-to":D()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":k()}],"mask-image-conic-pos":[{"mask-conic":[os]}],"mask-image-conic-from-pos":[{"mask-conic-from":te()}],"mask-image-conic-to-pos":[{"mask-conic-to":te()}],"mask-image-conic-from-color":[{"mask-conic-from":D()}],"mask-image-conic-to-color":[{"mask-conic-to":D()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:G()}],"mask-repeat":[{mask:q()}],"mask-size":[{mask:N()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Jt,Yt]}],filter:[{filter:["","none",Jt,Yt]}],blur:[{blur:ce()}],brightness:[{brightness:[os,Jt,Yt]}],contrast:[{contrast:[os,Jt,Yt]}],"drop-shadow":[{"drop-shadow":["","none",p,Ow,Dw]}],"drop-shadow-color":[{"drop-shadow":D()}],grayscale:[{grayscale:["",os,Jt,Yt]}],"hue-rotate":[{"hue-rotate":[os,Jt,Yt]}],invert:[{invert:["",os,Jt,Yt]}],saturate:[{saturate:[os,Jt,Yt]}],sepia:[{sepia:["",os,Jt,Yt]}],"backdrop-filter":[{"backdrop-filter":["","none",Jt,Yt]}],"backdrop-blur":[{"backdrop-blur":ce()}],"backdrop-brightness":[{"backdrop-brightness":[os,Jt,Yt]}],"backdrop-contrast":[{"backdrop-contrast":[os,Jt,Yt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",os,Jt,Yt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[os,Jt,Yt]}],"backdrop-invert":[{"backdrop-invert":["",os,Jt,Yt]}],"backdrop-opacity":[{"backdrop-opacity":[os,Jt,Yt]}],"backdrop-saturate":[{"backdrop-saturate":[os,Jt,Yt]}],"backdrop-sepia":[{"backdrop-sepia":["",os,Jt,Yt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":_()}],"border-spacing-x":[{"border-spacing-x":_()}],"border-spacing-y":[{"border-spacing-y":_()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Jt,Yt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[os,"initial",Jt,Yt]}],ease:[{ease:["linear","initial",v,Jt,Yt]}],delay:[{delay:[os,Jt,Yt]}],animate:[{animate:["none",b,Jt,Yt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[y,Jt,Yt]}],"perspective-origin":[{"perspective-origin":T()}],rotate:[{rotate:oe()}],"rotate-x":[{"rotate-x":oe()}],"rotate-y":[{"rotate-y":oe()}],"rotate-z":[{"rotate-z":oe()}],scale:[{scale:de()}],"scale-x":[{"scale-x":de()}],"scale-y":[{"scale-y":de()}],"scale-z":[{"scale-z":de()}],"scale-3d":["scale-3d"],skew:[{skew:Te()}],"skew-x":[{"skew-x":Te()}],"skew-y":[{"skew-y":Te()}],transform:[{transform:[Jt,Yt,"","none","gpu","cpu"]}],"transform-origin":[{origin:T()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:qe()}],"translate-x":[{"translate-x":qe()}],"translate-y":[{"translate-y":qe()}],"translate-z":[{"translate-z":qe()}],"translate-none":["translate-none"],zoom:[{zoom:[rc,Jt,Yt]}],accent:[{accent:D()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:D()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Jt,Yt]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":D()}],"scrollbar-track-color":[{"scrollbar-track":D()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mbs":[{"scroll-mbs":_()}],"scroll-mbe":[{"scroll-mbe":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pbs":[{"scroll-pbs":_()}],"scroll-pbe":[{"scroll-pbe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Jt,Yt]}],fill:[{fill:["none",...D()]}],"stroke-w":[{stroke:[os,Qg,hf,a$]}],stroke:[{stroke:["none",...D()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},ZWe=NWe(JWe);function In(...e){return ZWe(Uee(e))}function ite({delayDuration:e=0,...t}){return u.jsx(sWe,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function ote({...e}){return u.jsx(rWe,{"data-slot":"tooltip",...e})}function ate({...e}){return u.jsx(iWe,{"data-slot":"tooltip-trigger",...e})}function lte({className:e,sideOffset:t=0,children:n,...s}){const r=bm();return u.jsx(oWe,{container:r??void 0,children:u.jsxs(aWe,{"data-slot":"tooltip-content",sideOffset:t,className:In("z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...s,children:[n,u.jsx(lWe,{className:"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground"})]})})}function eGe(){return u.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[u.jsx("circle",{cx:"6",cy:"5",r:"2.5",stroke:"currentColor",strokeWidth:"1.8"}),u.jsx("circle",{cx:"18",cy:"6",r:"2.5",stroke:"currentColor",strokeWidth:"1.8"}),u.jsx("circle",{cx:"6",cy:"19",r:"2.5",stroke:"currentColor",strokeWidth:"1.8"}),u.jsx("path",{d:"M6 7.5v9M8.5 12h3.25A6.25 6.25 0 0 0 18 5.75",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})]})}function tGe({branch:e,ariaLabel:t}){return u.jsx(ite,{delayDuration:300,children:u.jsxs(ote,{children:[u.jsx(ate,{asChild:!0,children:u.jsxs("output",{className:_e.gitBranchChip,"aria-label":t,"data-web-shell-git-branch":!0,children:[u.jsx("span",{className:_e.gitBranchIcon,children:u.jsx(eGe,{})}),u.jsx("span",{className:_e.gitBranchText,children:e})]})}),u.jsx(lte,{side:"top",children:e})]})})}function nGe(){return u.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M3 6.5A1.5 1.5 0 0 1 4.5 5h4l2 2h7A1.5 1.5 0 0 1 19 8.5v8A1.5 1.5 0 0 1 17.5 18h-13A1.5 1.5 0 0 1 3 16.5Z",stroke:"currentColor",strokeWidth:"1.8",strokeLinejoin:"round"})})}function sGe({name:e,title:t,ariaLabel:n}){return u.jsxs("output",{className:_e.workspaceChip,title:t,"aria-label":n,"data-web-shell-workspace":!0,children:[u.jsx("span",{className:_e.workspaceChipIcon,children:u.jsx(nGe,{})}),u.jsx("span",{className:_e.workspaceChipText,children:e})]})}function AM({...e}){return u.jsx($Z,{"data-slot":"select",...e})}function MM({className:e,...t}){return u.jsx(eee,{"data-slot":"select-group",className:In("scroll-my-1 p-1",e),...t})}function NM({...e}){return u.jsx(HZ,{"data-slot":"select-value",...e})}const IM=m.forwardRef(function({className:t,size:n="default",children:s,...r},i){return u.jsxs(FZ,{ref:i,"data-slot":"select-trigger","data-size":n,className:In("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...r,children:[s,u.jsx(UZ,{asChild:!0,children:u.jsx(b_,{className:"pointer-events-none size-4 text-muted-foreground"})})]})});function RM({className:e,children:t,position:n="item-aligned",align:s="center",...r}){const i=bm();return u.jsx(WZ,{container:i??void 0,children:u.jsxs(GZ,{"data-slot":"select-content","data-align-trigger":n==="item-aligned",className:In("relative z-50 max-h-(--radix-select-content-available-height) min-w-36 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,align:s,...r,children:[u.jsx(rGe,{}),u.jsx(JZ,{"data-position":n,className:In("data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)",n==="popper"&&""),children:t}),u.jsx(iGe,{})]})})}function F2({className:e,children:t,...n}){return u.jsxs(see,{"data-slot":"select-item",className:In("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[u.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center",children:u.jsx(oee,{children:u.jsx(gue,{className:"pointer-events-none"})})}),u.jsx(ree,{children:t})]})}function rGe({className:e,...t}){return u.jsx(aee,{"data-slot":"select-scroll-up-button",className:In("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:u.jsx(wue,{})})}function iGe({className:e,...t}){return u.jsx(lee,{"data-slot":"select-scroll-down-button",className:In("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:u.jsx(b_,{})})}const Pw=4,Jm=8;function oGe(e,t,n){return Math.max(t,Math.min(e,n))}function aGe(e,t){const n=t.trim().toLocaleLowerCase();return n?e.filter(s=>`${s.label}
${s.searchText??""}`.toLocaleLowerCase().includes(n)):[...e]}function lGe({anchor:e,boundary:t,viewportWidth:n,viewportHeight:s,preferredWidth:r,maxHeight:i}){const o=Math.max(0,t.left),a=Math.min(n,t.right),l=Math.max(0,a-o-Jm*2),c=Math.min(r,l),d=oGe(e.left,o+Jm,Math.max(o+Jm,a-Jm-c)),h=Math.max(0,t.top),f=Math.min(s,t.bottom),p=Math.max(0,e.top-h-Pw-Jm),g=Math.max(0,f-e.bottom-Pw-Jm),y=p>=g?"above":"below",w=y==="above"?p:g;return{placement:y,left:d,...y==="above"?{bottom:s-e.top+Pw}:{top:e.bottom+Pw},width:c,maxHeight:i===void 0?w:Math.min(i,w)}}function cGe({availableWidth:e,modelLabelWidth:t,modeLabelWidth:n,modelLabelReady:s,modelActionVisible:r=!0,modeActionVisible:i=!0}){return r?!s||e<t?{showModelLabel:!1,showModeLabel:!1}:e<t+n?{showModelLabel:!0,showModeLabel:!1}:{showModelLabel:!0,showModeLabel:i}:{showModelLabel:!1,showModeLabel:i&&e>=n}}function uGe({currentModelLabel:e,lastConfirmedModelLabel:t}){const n=e||t;return{modelLabel:n,modelLabelReady:!!n,nextConfirmedModelLabel:n}}const dGe=["approvalMode","gitBranch","model","widthMode","voice","workspace"],hGe=new Set(dGe),fGe={"&":{fontSize:"14px",background:"transparent",border:"none"},"&.cm-focused":{outline:"none"},".cm-scroller":{maxHeight:"var(--chat-editor-input-max-height, 300px)",overflowX:"hidden",overflowY:"auto"},".cm-content":{padding:"0",fontFamily:"var(--font-sans, system-ui, sans-serif)",color:"var(--chat-editor-text-primary, #e0e0e0)",caretColor:"var(--chat-editor-accent-color, #4a9eff)",fontSize:"14px",lineHeight:"1.6"},".cm-line":{padding:"0"},".cm-placeholder":{color:"var(--chat-editor-text-dimmed, #666)"},".cm-followup-ghost":{color:"var(--chat-editor-text-dimmed, #666)",opacity:"0.72",pointerEvents:"none",userSelect:"none"},".cm-selectionBackground, &.cm-focused .cm-selectionBackground":{backgroundColor:"var(--chat-editor-selection-bg) !important"},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{backgroundColor:"var(--chat-editor-selection-bg) !important"},"&.cm-focused .cm-content ::selection":{backgroundColor:"var(--chat-editor-selection-bg)",color:"var(--chat-editor-selection-color)"},".cm-content ::selection":{backgroundColor:"var(--chat-editor-selection-bg)",color:"var(--chat-editor-selection-color)"},".cm-cursor":{borderLeftColor:"var(--chat-editor-accent-color, #4a9eff)",borderLeftWidth:"2px"}};function u$(){return typeof window>"u"?!1:typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window.matchMedia=="function"&&window.matchMedia("(hover: none), (pointer: coarse)").matches}const mGe=["--chat-editor-accent-color","--accent","--background","--chat-editor-bg-tertiary","--chat-editor-border-color","--foreground","--font-mono","--font-sans","--muted-foreground","--chat-editor-text-primary","--chat-editor-text-secondary"];function pGe(){return u.jsx("svg",{className:_e.sendIcon,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:u.jsx("path",{d:"M10 15.5v-11M5.5 9 10 4.5 14.5 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function gGe(){return u.jsx("span",{className:_e.stopIcon,"aria-hidden":"true"})}function yGe(){return u.jsx("span",{className:_e.loadingIcon,"aria-hidden":"true"})}function bGe(){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[7,12,17].flatMap(e=>[7,12,17].map(t=>u.jsx("circle",{cx:t,cy:e,r:"1.35",fill:"currentColor"},`${t}-${e}`)))})}function vGe(e,t){let n,s,r,i,o=0,a=0;const l=(y,w)=>{e.style.setProperty("--dac-glow-on",y.toFixed(4)),e.style.setProperty("--dac-glow-pulse",w.toFixed(4))},c=y=>{n!==void 0&&window.cancelAnimationFrame(n);const w=o,v=y-w;if(Math.abs(v)<.001){o=y,l(y,a);return}const b=performance.now(),x=k=>{const T=Math.min((k-b)/220,1);o=w+v*(1-(1-T)**2),l(o,a),n=T<1?window.requestAnimationFrame(x):void 0};n=window.requestAnimationFrame(x)},d=()=>{s!==void 0&&window.cancelAnimationFrame(s);const y=a,w=performance.now(),v=b=>{const x=Math.min((b-w)/300,1);a=y*(1-x),l(o,a),s=x<1?window.requestAnimationFrame(v):void 0};s=window.requestAnimationFrame(v)},h=y=>{y?e.setAttribute("data-dac-typing",""):e.removeAttribute("data-dac-typing")},f=()=>c(1),p=()=>{c(0),h(!1),i!==void 0&&window.clearTimeout(i)},g=()=>{s!==void 0&&window.cancelAnimationFrame(s),r!==void 0&&window.clearTimeout(r),a=1,l(o,1),r=window.setTimeout(d,100),h(!0),i!==void 0&&window.clearTimeout(i),i=window.setTimeout(()=>h(!1),650)};return t.addEventListener("focus",f),t.addEventListener("blur",p),t.addEventListener("keydown",g),document.activeElement===t&&c(1),()=>{n!==void 0&&window.cancelAnimationFrame(n),s!==void 0&&window.cancelAnimationFrame(s),r!==void 0&&window.clearTimeout(r),i!==void 0&&window.clearTimeout(i),t.removeEventListener("focus",f),t.removeEventListener("blur",p),t.removeEventListener("keydown",g),l(0,0),h(!1)}}function wGe({mode:e}){return e==="wide"?u.jsxs("svg",{viewBox:"0 0 1024 1024","aria-hidden":"true",children:[u.jsx("path",{d:"M550.012 486.537a8.16 8.16 0 0 1 8.17-8.17h305.36l-111.88-111.89c-3.19-3.19-3.19-8.4 0-11.59l25.08-25.08c3.19-3.19 8.4-3.19 11.59 0l168.61 168.6c3.19 3.19 3.19 8.4 0 11.59l-164.47 168.67c-3.19 3.19-8.4 3.19-11.59 0l-25.61-25.61c-3.19-3.19-3.19-8.4 0-11.59l106.58-110.78-303.62 0.11c-4.52 0-8.23-3.71-8.23-8.23v-36.03z",fill:"currentColor",transform:"translate(-483.41 0)"}),u.jsx("path",{d:"M473.532 524.327a8.16 8.16 0 0 1-8.17 8.17h-305.36l111.88 111.88c3.19 3.19 3.19 8.4 0 11.59l-25.09 25.09c-3.19 3.19-8.4 3.19-11.59 0l-168.6-168.61c-3.19-3.19-3.19-8.4 0-11.59l164.47-168.67c3.19-3.19 8.4-3.19 11.59 0l25.61 25.61c3.19 3.19 3.19 8.4 0 11.59l-106.59 110.78 303.62-0.11c4.52 0 8.23 3.71 8.23 8.23v36.04z",fill:"currentColor",transform:"translate(483.41 0)"})]}):u.jsx("svg",{viewBox:"0 0 1024 1024","aria-hidden":"true",children:u.jsx("path",{d:"M473.532 524.327a8.16 8.16 0 0 1-8.17 8.17h-305.36l111.88 111.88c3.19 3.19 3.19 8.4 0 11.59l-25.09 25.09c-3.19 3.19-8.4 3.19-11.59 0l-168.6-168.61c-3.19-3.19-3.19-8.4 0-11.59l164.47-168.67c3.19-3.19 8.4-3.19 11.59 0l25.61 25.61c3.19 3.19 3.19 8.4 0 11.59l-106.59 110.78 303.62-0.11c4.52 0 8.23 3.71 8.23 8.23v36.04zM550.012 486.537a8.16 8.16 0 0 1 8.17-8.17h305.36l-111.88-111.89c-3.19-3.19-3.19-8.4 0-11.59l25.08-25.08c3.19-3.19 8.4-3.19 11.59 0l168.61 168.6c3.19 3.19 3.19 8.4 0 11.59l-164.47 168.67c-3.19 3.19-8.4 3.19-11.59 0l-25.61-25.61c-3.19-3.19-3.19-8.4 0-11.59l106.58-110.78-303.62 0.11c-4.52 0-8.23-3.71-8.23-8.23v-36.03z",fill:"currentColor"})})}function Zm(){return u.jsx("span",{className:_e.chevronDown,"aria-hidden":"true"})}function mC(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("path",{d:"M12 3.5 19.4 7.8v8.4L12 20.5l-7.4-4.3V7.8L12 3.5Z",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinejoin:"round"}),u.jsx("path",{d:"m8.2 9.7 3.8 2.2 3.8-2.2M12 11.9v4.4",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function xGe(e){const n=(e.action.type==="run"?e.action.command:e.action.type==="insert"?e.action.text:"").trimStart().match(/^\/([^\s]+)/);return(n==null?void 0:n[1])??null}const kGe=[{id:"tab",label:"Tab",descriptionKey:"quickKeys.tab",event:{key:"Tab",code:"Tab"}},{id:"escape",label:"Esc",descriptionKey:"quickKeys.escape",event:{key:"Escape",code:"Escape"}},{id:"arrow-up",label:"↑",descriptionKey:"quickKeys.history",event:{key:"ArrowUp",code:"ArrowUp"}},{id:"arrow-down",label:"↓",descriptionKey:"quickKeys.history",event:{key:"ArrowDown",code:"ArrowDown"}},{id:"arrow-left",label:"←",descriptionKey:"quickKeys.cursor",event:{key:"ArrowLeft",code:"ArrowLeft"}},{id:"arrow-right",label:"→",descriptionKey:"quickKeys.cursor",event:{key:"ArrowRight",code:"ArrowRight"}}];function _Ge(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"m3 8.3 3.1 3.1L13 4.6",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}function cte(e,t){return{plan:t("mode.label.plan"),default:t("mode.label.default"),"auto-edit":t("mode.label.auto-edit"),auto:t("mode.label.auto"),yolo:t("mode.label.yolo")}[e]??e}function SGe(e,t){return{plan:t("mode.listLabel.plan"),default:t("mode.listLabel.default"),"auto-edit":t("mode.listLabel.auto-edit"),auto:t("mode.listLabel.auto"),yolo:t("mode.listLabel.yolo")}[e]??cte(e,t)}function d$({open:e,items:t,activeId:n,onClose:s,onSelect:r,anchorRef:i,boundaryRef:o,showCheck:a=!1,maxHeight:l,searchable:c=!1,searchLabel:d,noResultsLabel:h}){const f=m.useRef(null),p=m.useRef(null),[g,y]=m.useState(""),[w,v]=m.useState(null),b=t.some(S=>S.description||S.icon),x=b?360:a?300:160,k=c?aGe(t,g):t;if(m.useEffect(()=>{if(!e){y(""),v(null);return}if(!c)return;const S=window.requestAnimationFrame(()=>{var _;(_=p.current)==null||_.focus()});return()=>window.cancelAnimationFrame(S)},[e,c]),m.useLayoutEffect(()=>{if(!e)return;const S=i.current;if(!S)return;const _=S.closest("[data-web-shell-root]")??o.current;if(!_)return;const L=()=>{v(lGe({anchor:S.getBoundingClientRect(),boundary:_.getBoundingClientRect(),viewportWidth:window.innerWidth,viewportHeight:window.innerHeight,preferredWidth:x,maxHeight:l}))};L();const M=new ResizeObserver(L);return M.observe(S),M.observe(_),window.addEventListener("resize",L),window.addEventListener("scroll",L,!0),()=>{M.disconnect(),window.removeEventListener("resize",L),window.removeEventListener("scroll",L,!0)}},[i,o,l,e,x]),m.useEffect(()=>{if(!e)return;const S=_=>{if(_ instanceof MouseEvent&&_.button!==0||_.defaultPrevented)return;const L=f.current,M=i.current,I=_.target;L&&I instanceof Node&&!L.contains(I)&&M&&!M.contains(I)&&s()};return window.addEventListener("mousedown",S),()=>window.removeEventListener("mousedown",S)},[e,s,i]),m.useEffect(()=>{if(!e)return;const S=_=>{_.key==="Escape"&&(_.preventDefault(),_.stopPropagation(),s(),window.requestAnimationFrame(()=>{var L;return(L=i.current)==null?void 0:L.focus()}))};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[e,s,i]),!e)return null;const T=b||a,C=w?{left:w.left,width:w.width,maxHeight:w.maxHeight,...w.placement==="above"?{bottom:w.bottom}:{top:w.top}}:void 0;return u.jsxs("div",{ref:f,className:`${_e.dropdown} ${b?_e.dropdownRich:a?_e.dropdownCheck:""}`,"data-placement":w==null?void 0:w.placement,style:C,onClick:S=>S.stopPropagation(),children:[c&&u.jsx("input",{ref:p,type:"search",className:_e.dropdownSearch,value:g,"aria-label":d,placeholder:d,autoComplete:"off",onChange:S=>y(S.target.value)}),u.jsxs("div",{className:_e.dropdownList,children:[k.map(S=>u.jsx("button",{type:"button",className:`${_e.dropdownItem} ${S.id===n?_e.dropdownItemActive:""}`,onMouseDown:_=>{_.preventDefault(),r(S.id)},children:T?u.jsxs(u.Fragment,{children:[b&&u.jsx("span",{className:_e.dropdownItemIcon,children:S.icon}),u.jsxs("span",{className:_e.dropdownItemContent,children:[u.jsx("span",{className:_e.dropdownItemLabel,children:S.label}),S.description&&u.jsx("span",{className:_e.dropdownItemDesc,children:S.description})]}),u.jsx("span",{className:_e.dropdownItemCheck,children:S.id===n?u.jsx(_Ge,{}):null})]}):S.label},S.id)),k.length===0&&h&&u.jsx("div",{className:_e.dropdownEmpty,role:"status",children:h(g)})]})]})}function CGe({menu:e,anchorRef:t,panelRef:n,onSelect:s,onAccept:r}){const i=bm(),o=m.useRef([]),[a,l]=m.useState(null),[c,d]=m.useState({}),[h,f]=m.useState(null),p=m.useRef(null);m.useEffect(()=>{var T;(T=o.current[e.selectedIndex])==null||T.scrollIntoView({block:"nearest"})},[e.items,e.selectedIndex]),m.useLayoutEffect(()=>{const T=t.current;if(!T)return;const C=()=>{const _=T.getBoundingClientRect(),L=getComputedStyle(T),M=Object.fromEntries(mGe.map(I=>[I,L.getPropertyValue(I)]));l({left:Math.max(12,Math.min(_.left+16,window.innerWidth-252)),bottom:window.innerHeight-_.top+8,width:_.width}),d(M)};C();const S=new ResizeObserver(C);return S.observe(T),window.addEventListener("resize",C),window.addEventListener("scroll",C,!0),()=>{S.disconnect(),window.removeEventListener("resize",C),window.removeEventListener("scroll",C,!0)}},[t,e.items]),m.useEffect(()=>{f(null)},[e.items]);const g=T=>Array.from(T).length,y=Math.max(...e.items.map(T=>g(T.label)),0),w=Math.max(...e.items.map(T=>g(T.detail??"")),0),v=w>0,b={"--slash-command-col":`${Math.min(Math.max(y+1,10),24)}ch`,"--slash-desc-col":v?`${Math.min(Math.max(w+1,18),36)}ch`:"0px","--slash-column-gap":v?"2ch":"0px"};if(!a)return null;const x=sze(e.items,e.kind),k={...b,...c,left:a.left,bottom:a.bottom,"--slash-anchor-width":`${a.width}px`};return _l.createPortal(u.jsxs("div",{ref:n,className:_e.slashPortalLayer,style:c,"data-web-shell-slash-menu":!0,children:[u.jsx("div",{className:_e.slashPanel,style:k,role:"listbox",onMouseDown:T=>T.preventDefault(),onMouseLeave:T=>{var S;const C=T.relatedTarget;C instanceof Node&&((S=p.current)!=null&&S.contains(C))||f(null)},children:u.jsx("div",{className:_e.slashPanelBody,children:u.jsx("div",{className:_e.slashList,onScroll:()=>f(null),children:e.items.map((T,C)=>{const S=x[C];return u.jsxs("div",{className:_e.slashEntry,children:[S.showHeader&&u.jsxs(u.Fragment,{children:[S.showDivider&&u.jsx("div",{className:_e.slashSection}),u.jsxs("div",{className:_e.slashSectionHeader,children:[u.jsx("span",{children:T.section}),S.count>0?u.jsx("span",{className:_e.slashSectionCount,children:S.count}):null]})]}),u.jsxs("button",{ref:_=>{o.current[C]=_},type:"button",role:"option","aria-selected":C===e.selectedIndex,className:`${_e.slashItem} ${C===e.selectedIndex?_e.slashItemActive:""}`,onMouseEnter:_=>{if(s(C),!T.detail){f(null);return}const L=_.currentTarget,M=8,I=180,A=L.getBoundingClientRect(),B=Math.min(A.left+Math.min(220,A.width*.34),window.innerWidth-320-12),F=window.innerHeight-A.bottom-M-12,O=A.top-M-12,X=F>=96||F>=O,z=Math.max(72,Math.min(I,X?F:O));f({label:T.label,detail:T.detail,left:Math.max(12,B),...X?{top:A.bottom+M}:{bottom:window.innerHeight-A.top+M},maxHeight:z})},onMouseDown:_=>{_.preventDefault(),_.stopPropagation(),r(C)},children:[u.jsx("span",{className:_e.slashCommand,children:T.label}),T.detail&&u.jsx("span",{className:_e.slashDescription,children:T.detail})]})]},`${T.id}:${C}`)})})})}),h&&u.jsxs("div",{ref:p,className:_e.slashDetail,style:{...c,left:h.left,top:h.top,bottom:h.bottom,maxHeight:h.maxHeight},children:[u.jsx("div",{className:_e.slashDetailCommand,children:h.label}),u.jsx("div",{className:_e.slashDetailText,children:h.detail})]})]}),i??document.body)}function TGe({actions:e,onRun:t,onPressKey:n}){const{t:s}=ot();return u.jsxs("div",{className:_e.quickActionsPanel,onMouseDown:r=>r.stopPropagation(),onClick:r=>r.stopPropagation(),children:[u.jsx("div",{className:_e.quickActionsHeader,children:s("quickActions.title")}),u.jsxs("div",{className:_e.quickActionsLayout,children:[u.jsx("div",{className:_e.quickActionsGrid,children:e.map(r=>u.jsx("button",{type:"button",className:_e.quickAction,onClick:()=>t(r),children:u.jsx("span",{className:_e.quickActionLabel,children:r.label})},r.id))}),u.jsx("div",{className:_e.quickKeysGrid,children:kGe.map(r=>u.jsx("button",{type:"button",className:_e.quickKey,title:s(r.descriptionKey),onMouseDown:i=>i.preventDefault(),onClick:()=>n(r),children:u.jsx("span",{className:_e.quickKeyLabel,children:r.label})},r.id))})]})]})}const ute=m.memo(m.forwardRef(function(t,n){const{onSubmit:s,onCycleMode:r,onToggleShortcuts:i,onCancel:o,isRunning:a=!1,isPreparing:l=!1,cancelArmed:c=!1,disabled:d=!1,placeholderText:h="Type a message...",commands:f,skills:p=[],slashCommandCategoryOrder:g,queuedMessages:y=[],onPopQueuedMessages:w,currentMode:v="default",currentModel:b="",gitBranch:x,workspaceName:k,workspaceTitle:T,chatWidthMode:C="1000",showChatWidthToggle:S=!0,chatWidthToggleMin:_,visibleToolbarActions:L,availableModels:M=[],onSelectMode:I,onSelectModel:A,workspaces:P,selectedWorkspaceCwd:B,workspaceSelectionDisabled:F=!1,onSelectWorkspace:O,atWorkspaceCwd:X,onChatWidthModeChange:z,onFocusFooter:U,dialogOpen:D=!1,followupState:G,onAcceptFollowup:q,onDismissFollowup:N,sessionName:ee,composerInput:re,composerInputVersion:Q,builtinAtProviders:K,atProviders:se,composerTagIcons:te}=t,{renderComposerToolbarStart:ce,renderComposerToolbarEnd:oe,renderComposerToolbarRight:de,renderComposerTag:Te,renderComposerTagTooltip:qe,onComposerTagClick:Ne}=zc(),ge=oEe({onSubmit:s,onCycleMode:r,onToggleShortcuts:i,disabled:d,placeholderText:h,commands:f,skills:p,slashCommandCategoryOrder:g,queuedMessages:y,onPopQueuedMessages:w,currentMode:v,onFocusFooter:U,dialogOpen:D,followupState:G,onAcceptFollowup:q,onDismissFollowup:N,sessionName:ee,composerInput:re,composerInputVersion:Q,builtinAtProviders:K,atProviders:se,atWorkspaceCwd:X,composerTagIcons:te,renderComposerTag:Te,renderComposerTagTooltip:qe,onComposerTagClick:Ne,editorTheme:fGe}),{t:Ee}=ot();m.useImperativeHandle(n,()=>ge.handle,[ge.handle]);const[_t,Ct]=m.useState(!1),[Je,at]=m.useState(!1),[Oe,Fe]=m.useState(!1),[ue,vt]=m.useState(!1),[ye,je]=m.useState(u$),Ye=m.useRef(null),Nt=m.useRef(null),Rt=m.useRef(null),rn=m.useRef(null),on=m.useRef(null),Bn=m.useRef(null),bs=m.useRef(null),Ss=m.useRef(null),Ie=m.useRef(null),lt=m.useRef(null),ne=m.useRef(null),he=m.useRef(null),Ve=m.useRef(null),we=m.useRef(!1),Bt=m.useRef(!1),[Et,Tt]=m.useState(!1),[an,wt]=m.useState({showModelLabel:!1,showModeLabel:!1}),[It,Vn]=m.useState(""),kn=ge.slashMenu,ln=ge.closeSlashMenu,Wn=ge.atMenu,Jn=ge.closeAtMenu,Cs=!!kn,fr=!!Wn,Xs=ge.viewRef;m.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const W=window.matchMedia("(hover: none), (pointer: coarse)"),fe=()=>je(u$());return fe(),W.addEventListener("change",fe),()=>W.removeEventListener("change",fe)},[]),m.useEffect(()=>{ye||Fe(!1)},[ye]),m.useEffect(()=>{if(!Cs&&!fr)return;const W=fe=>{var Ge,zt;const Ae=fe.target,He=Ye.current;Ae instanceof Node&&He&&!He.contains(Ae)&&!((Ge=Nt.current)!=null&&Ge.contains(Ae))&&!((zt=Rt.current)!=null&&zt.contains(Ae))&&(ln(),Jn())};return window.addEventListener("mousedown",W),window.addEventListener("touchstart",W),()=>{window.removeEventListener("mousedown",W),window.removeEventListener("touchstart",W)}},[fr,Cs,Jn,ln]),m.useEffect(()=>{var Ae;const W=Ye.current,fe=(Ae=Xs.current)==null?void 0:Ae.contentDOM;if(!(!W||!fe))return vGe(W,fe)},[Xs]),m.useEffect(()=>{const W=Ye.current,fe=_;if(!W||fe===void 0){Tt(!1);return}const Ae=()=>{Tt(W.getBoundingClientRect().width>=fe-50)};Ae();const He=new ResizeObserver(Ae);return He.observe(W),()=>He.disconnect()},[_]);const Vs=m.useMemo(()=>f_.map(W=>({id:W,label:SGe(W,Ee),description:Ee(`mode.desc.${W}`),icon:u.jsx(g1,{mode:W})})),[Ee]),_n=m.useMemo(()=>{if(!L)return null;const W=L.filter(fe=>hGe.has(fe));return new Set(W)},[L]),fn=W=>_n?_n.has(W):!0,qn=fn("approvalMode"),Zn=fn("model"),$n=m.useMemo(()=>new Set(f.map(W=>W.name.replace(/^\/+/,""))),[f]),es=m.useCallback(W=>$n.has(W),[$n]),ss=m.useMemo(()=>[{id:"new",label:Ee("quickActions.new"),action:{type:"run",command:"/new"}},{id:"resume",label:Ee("quickActions.resume"),action:{type:"run",command:"/resume"}},{id:"delete",label:Ee("quickActions.delete"),action:{type:"run",command:"/delete"}},{id:"branch",label:Ee("quickActions.branch"),action:{type:"run",command:"/branch"}},{id:"rewind",label:Ee("quickActions.rewind"),action:{type:"run",command:"/rewind"}},{id:"history-search",label:Ee("quickActions.historyQuestion"),action:{type:"key",item:{id:"ctrl-r",label:"Ctrl+R",descriptionKey:"quickKeys.searchHistory",event:{key:"r",code:"KeyR",ctrlKey:!0}}}},{id:"recap",label:Ee("quickActions.recap"),action:{type:"run",command:"/recap"}},{id:"stats",label:Ee("quickActions.stats"),action:{type:"run",command:"/stats"}},{id:"context",label:Ee("quickActions.context"),action:{type:"run",command:"/context"}},{id:"status",label:Ee("quickActions.status"),action:{type:"run",command:"/status"}},{id:"skills",label:Ee("quickActions.skills"),action:{type:"run",command:"/skills detail"}},{id:"tools",label:Ee("quickActions.tools"),action:{type:"run",command:"/tools desc"}},{id:"agents",label:Ee("quickActions.agents"),action:{type:"run",command:"/agents"}},{id:"mcp",label:Ee("quickActions.mcp"),action:{type:"run",command:"/mcp"}},{id:"memory",label:Ee("quickActions.memory"),action:{type:"run",command:"/memory"}},{id:"theme",label:Ee("quickActions.theme"),action:{type:"run",command:"/theme"}},{id:"shell",label:ge.shellMode?Ee("quickActions.exitShellMode"):Ee("quickActions.shellMode"),action:{type:"shell"}},{id:"goal",label:Ee("quickActions.setGoal"),action:{type:"insert",text:"/goal "}}].filter(W=>{const fe=xGe(W);return!fe||es(fe)}),[ge.shellMode,es,Ee]),Ps=m.useMemo(()=>M.map(W=>({id:W.id,label:Lf(W.label||W.id),searchText:`${W.label??""}
${W.id}`})),[M]),jr=m.useCallback(W=>{I==null||I(W),Ct(!1),ge.focus()},[I,ge]),Ui=m.useCallback(W=>{A==null||A(W),at(!1),ge.focus()},[A,ge]),Bs=m.useCallback(W=>{const fe=ge.viewRef.current;fe&&(fe.focus(),fe.contentDOM.dispatchEvent(new KeyboardEvent("keydown",{...W,bubbles:!0,cancelable:!0})))},[ge]),zr=m.useCallback(W=>{if(Fe(!1),Ct(!1),at(!1),ge.closeSlashMenu(),ge.closeAtMenu(),W.action.type==="insert"){ge.insertText(W.action.text,{mode:"replace"});return}if(W.action.type==="shell"){ge.toggleShellMode();return}if(W.action.type==="key"){Bs(W.action.item.event);return}s(W.action.command)},[ge,Bs,s]),sr=m.useCallback(W=>{Bs(W.event),W.id==="ctrl-r"&&Fe(!1)},[Bs]),{searchMode:Qs,searchQuery:gs,searchMatches:ts,searchActiveIndex:mn,searchInputRef:Rn,searchUiRef:br,closeSearch:Se,handleSearchKeyDown:xe,handleSearchInput:kt,handleSearchCompositionEnd:Ot}=ge.searchState,xt=W=>{const fe=Te==null?void 0:Te({tag:W,placement:"composer",readonly:!1});if(fe!=null)return fe;const Ae=a4(W),He=l4(W),Ge=W.kind?"":Ae,zt=W.icon??vm(W.kind,te),dn=zt&&eg(zt)?zt:void 0;return!Ge&&!He?u.jsx("span",{className:_e.tagLabel,children:W.id}):u.jsxs(u.Fragment,{children:[dn&&u.jsx("span",{className:_e.tagIcon,style:Xd("--composer-tag-icon-url",dn),"aria-hidden":"true"}),Ge&&u.jsx("span",{className:_e.tagLabel,children:Ge}),He&&u.jsx("span",{className:_e.tagValue,children:He})]})},An=cte(v,Ee),Gn=b?Lf(b):"",{modelLabel:Js,modelLabelReady:jn}=uGe({currentModelLabel:Gn,lastConfirmedModelLabel:It}),yn=P==null?void 0:P.find(W=>B?W.cwd===B:W.primary),Mn=yn?`${yn.label}${yn.primary?` · ${Ee("sidebar.workspacePrimary")}`:""}`:"";m.useLayoutEffect(()=>{Gn&&Gn!==It&&Vn(Gn)},[Gn,It]);const{showModelLabel:Lr,showModeLabel:ti}=an,_r=a&&!ge.hasContent;return m.useLayoutEffect(()=>{const W=rn.current,fe=on.current,Ae=Bn.current,He=bs.current,Ge=Ss.current,zt=Ie.current,dn=lt.current;if(!W||!fe||!Ae||!He||!Ge||!zt||!dn)return;const hn=()=>{const Ws=Math.max(0,Ge.getBoundingClientRect().width-He.getBoundingClientRect().width),Ms=Math.max(0,dn.getBoundingClientRect().width-zt.getBoundingClientRect().width),Gr=fe.getBoundingClientRect().width-(Lr?Ms:0)-(ti?Ws:0),ie=Number.parseFloat(getComputedStyle(W).columnGap)||0,ve=Math.max(0,W.getBoundingClientRect().width-Ae.getBoundingClientRect().width-Gr-ie),Le=cGe({availableWidth:ve,modelLabelWidth:Ms,modeLabelWidth:Ws,modelLabelReady:jn,modelActionVisible:Zn,modeActionVisible:qn});wt(tt=>tt.showModelLabel===Le.showModelLabel&&tt.showModeLabel===Le.showModeLabel?tt:Le)};hn();const ds=new ResizeObserver(hn);return ds.observe(W),ds.observe(fe),ds.observe(Ae),ds.observe(He),ds.observe(Ge),ds.observe(zt),ds.observe(dn),()=>ds.disconnect()},[Js,jn,An,Zn,qn,Lr,ti]),u.jsxs("div",{className:`${_e.editorShell} ${_t||Je?_e.editorShellDropdownOpen:""}`,"data-composer":!0,"data-web-shell-composer":!0,children:[u.jsxs("div",{ref:Ye,className:_e.container,"data-web-shell-composer-surface":!0,"data-dac-glow":!0,onClick:()=>{Ct(!1),at(!1),Fe(!1),ge.focus()},children:[u.jsx("div",{className:_e.dacAura,"aria-hidden":"true"}),u.jsx("div",{className:_e.dacHalo,"aria-hidden":"true"}),Qs&&u.jsxs("div",{ref:br,className:_e.searchPanel,onMouseDown:W=>W.stopPropagation(),onClick:W=>W.stopPropagation(),children:[u.jsxs("div",{className:_e.searchBar,children:[u.jsx("span",{className:_e.searchLabel,children:Ee("editor.searchLabel")}),u.jsx("input",{ref:Rn,className:_e.searchInput,value:gs,onChange:kt,onCompositionEnd:Ot,onKeyDown:xe,placeholder:Ee("editor.searchPlaceholder")})]}),ts.length>0&&u.jsx("div",{className:_e.searchResults,children:ts.map((W,fe)=>u.jsxs("button",{type:"button",className:`${_e.searchResult} ${fe===mn?_e.searchResultActive:""}`,onMouseDown:Ae=>{Ae.preventDefault(),ge.replaceEditorText(W),Se(!1)},children:[u.jsx("span",{className:_e.searchResultMarker,children:fe===mn?"›":""}),u.jsx("span",{className:_e.searchResultText,children:W})]},`${W}-${fe}`))}),ts.length===0&&u.jsx("div",{className:_e.searchEmpty,children:Ee("editor.noHistory")})]}),u.jsxs("div",{className:_e.content,children:[ge.composerTags.length>0&&u.jsx("div",{className:_e.tags,children:ge.composerTags.map(W=>{const fe={tag:W,placement:"composer",readonly:!1},Ae=qe==null?void 0:qe(fe);return u.jsxs("span",{className:_e.tag,role:Ne?"button":void 0,tabIndex:Ne?0:void 0,onClick:He=>{Ne&&(He.stopPropagation(),Ne({...fe,anchorRect:He.currentTarget.getBoundingClientRect()}))},onKeyDown:He=>{Ne&&(He.key!=="Enter"&&He.key!==" "||(He.preventDefault(),Ne({...fe,anchorRect:He.currentTarget.getBoundingClientRect()})))},children:[xt(W),W.removable!==!1&&u.jsx("button",{type:"button",className:_e.tagRemove,"aria-label":`Remove ${I9(W)}`,onMouseDown:He=>He.preventDefault(),onClick:He=>{var Ge;He.stopPropagation(),ge.removeTopTag(W.id),(Ge=ge.viewRef.current)==null||Ge.focus()},onKeyDown:He=>{var Ge;if(He.key==="Enter"||He.key===" "){He.stopPropagation();return}He.key!=="Backspace"&&He.key!=="Delete"||(He.preventDefault(),He.stopPropagation(),ge.removeTopTag(W.id),(Ge=ge.viewRef.current)==null||Ge.focus())},children:"×"}),Ae!=null&&u.jsx("span",{className:_e.tagTooltip,role:"tooltip",children:Ae})]},W.id)})}),ge.pastedImages.length>0&&u.jsx("div",{className:_e.images,children:ge.pastedImages.map((W,fe)=>u.jsxs("div",{className:_e.imageThumb,children:[u.jsx("img",{src:`data:${W.media_type};base64,${W.data}`,alt:""}),u.jsx("button",{className:_e.imageRemove,onClick:Ae=>{Ae.stopPropagation(),ge.removeImage(fe)},children:"×"})]},fe))}),ge.slashMenu&&u.jsx(CGe,{menu:ge.slashMenu,anchorRef:Ye,panelRef:Nt,onSelect:ge.selectSlashCompletion,onAccept:ge.acceptSlashCompletion}),ge.atMenu&&u.jsx(G$e,{menu:ge.atMenu,anchorRef:Ye,panelRef:Rt,onSelect:ge.selectAtCompletion,onAccept:ge.acceptAtCompletion,onBack:()=>{const W=ge.backAtCategories();return W==="categories"&&window.setTimeout(()=>ge.focus(),0),!!W},onSearch:ge.updateAtSearch,onSelectTab:ge.selectAtTab}),u.jsxs("div",{className:_e.editorArea,children:[ge.shellMode&&u.jsx("span",{className:_e.shellPrefix,"aria-hidden":"true",children:"!"}),u.jsx("div",{ref:ge.containerRef,"data-web-shell-composer-editor":!0})]}),u.jsxs("div",{ref:rn,className:_e.toolbar,children:[u.jsxs("div",{ref:on,className:_e.toolbarLeading,children:[ce&&u.jsx("div",{className:_e.toolbarStart,children:u.jsx(ce,{disabled:d,isRunning:a,currentMode:v,currentModel:b,sessionName:ee})}),u.jsxs("div",{className:_e.toolbarLeft,children:[P&&P.length>1&&O&&u.jsxs(AM,{value:yn==null?void 0:yn.id,disabled:F,onValueChange:W=>{const fe=P.find(Ae=>Ae.id===W);fe&&(O(fe.primary?void 0:fe.cwd),we.current=!0,vt(!1),requestAnimationFrame(()=>{var Ae;(Ae=Ve.current)==null||Ae.blur()}))},children:[u.jsx(ite,{delayDuration:300,children:u.jsxs(ote,{open:ue,onOpenChange:W=>{W&&(we.current||!Bt.current)||vt(W)},children:[u.jsx(ate,{asChild:!0,children:u.jsx("span",{className:_e.workspaceSelectTooltipTrigger,onPointerEnter:()=>{Bt.current=!0},onPointerLeave:()=>{Bt.current=!1,we.current=!1},onBlur:()=>{Bt.current||(we.current=!1)},children:u.jsxs(IM,{ref:Ve,size:"sm",className:`${_e.toolBtn} ${_e.workspaceSelectTrigger}`,"aria-label":Ee("sidebar.workspaceSelectLabel"),children:[u.jsx(wU,{size:16,strokeWidth:1.2}),u.jsx(NM,{})]})})}),u.jsx(lte,{side:"top",children:Mn})]})}),u.jsx(RM,{position:"popper",align:"start",children:u.jsx(MM,{children:P.map(W=>u.jsxs(F2,{value:W.id,children:[W.label,W.primary?` · ${Ee("sidebar.workspacePrimary")}`:""]},W.id))})})]}),k&&fn("workspace")&&u.jsx(sGe,{name:k,title:T??k,ariaLabel:Ee("workspace.paneLabel",{name:k})}),x&&fn("gitBranch")&&u.jsx(tGe,{branch:x,ariaLabel:Ee("git.currentBranch",{branch:x})}),qn&&u.jsxs("div",{className:_e.dropdownWrapper,children:[u.jsx(d$,{open:_t,items:Vs,activeId:v,onClose:()=>Ct(!1),onSelect:jr,anchorRef:ne,boundaryRef:Ye}),u.jsxs("button",{ref:ne,className:`${_e.toolBtn} ${_e.modeToolBtn}`,"data-web-shell-mode-button":!0,onClick:W=>{W.stopPropagation(),ge.closeSlashMenu(),ge.closeAtMenu(),Fe(!1),Ct(fe=>!fe),at(!1)},"aria-label":Ee("status.mode"),children:[u.jsx("span",{className:_e.toolBtnModeIcon,children:u.jsx(g1,{mode:v})}),ti&&u.jsx("span",{className:_e.toolBtnText,children:An}),u.jsx("span",{className:_e.toolBtnArrow,children:u.jsx(Zm,{})})]})]}),Zn&&u.jsxs("div",{className:_e.dropdownWrapper,children:[u.jsx(d$,{open:Je,items:Ps,activeId:b,onClose:()=>at(!1),onSelect:Ui,anchorRef:he,boundaryRef:Ye,showCheck:!0,maxHeight:300,searchable:!0,searchLabel:Ee("common.search"),noResultsLabel:W=>Ee("model.noMatch",{query:W})}),u.jsxs("button",{ref:he,className:`${_e.toolBtn} ${_e.modelToolBtn}`,"data-web-shell-model-button":!0,onClick:W=>{W.stopPropagation(),ge.closeSlashMenu(),ge.closeAtMenu(),Fe(!1),at(fe=>!fe),Ct(!1)},"aria-label":Ee("model.select"),children:[u.jsx("span",{className:_e.toolBtnModelIcon,children:u.jsx(mC,{})}),Lr&&u.jsx("span",{className:_e.toolBtnText,children:Js}),u.jsx("span",{className:_e.toolBtnArrow,children:u.jsx(Zm,{})})]})]}),oe&&u.jsx("div",{className:_e.toolbarEnd,children:u.jsx(oe,{disabled:d,isRunning:a,currentMode:v,currentModel:b,sessionName:ee})})]})]}),u.jsxs("div",{ref:Bn,className:_e.toolbarRight,children:[ye&&ss.length>0&&u.jsx("button",{className:`${_e.toolBtn} ${_e.quickActionsBtn}`,onClick:W=>{W.stopPropagation(),ge.closeSlashMenu(),ge.closeAtMenu(),Ct(!1),at(!1),Fe(fe=>!fe)},"aria-expanded":Oe,"aria-label":Ee("quickActions.open"),title:Ee("quickActions.open"),"data-tooltip":Ee("quickActions.open"),children:u.jsx("span",{className:_e.toolBtnIcon,children:u.jsx(bGe,{})})}),de&&u.jsx("div",{className:_e.toolbarRightCustom,children:u.jsx(de,{disabled:d,isRunning:a,currentMode:v,currentModel:b,sessionName:ee})}),S&&Et&&fn("widthMode")&&u.jsx("button",{className:`${_e.toolBtn} ${_e.widthModeBtn}`,onClick:W=>{W.stopPropagation(),z==null||z(C==="wide"?"1000":"wide")},disabled:!z,"aria-label":Ee(C==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),title:Ee(C==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),"data-tooltip":Ee(C==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),children:u.jsx("span",{className:_e.toolBtnIcon,children:u.jsx(wGe,{mode:C})})}),fn("voice")&&u.jsx(Mze,{disabled:d,onInsert:W=>{const fe=ge.getText(),Ae=fe&&!/\s$/.test(fe)?" ":"";ge.insertText(`${Ae}${W} `),ge.focus()}}),u.jsx("button",{className:l||_r?`${_e.sendBtn} ${_e.sendBtnRunning}${c?` ${_e.sendBtnArmed}`:""}`:_e.sendBtn,disabled:l?!0:_r?!o:ge.disabled||!ge.hasContent,"data-web-shell-composer-submit":!0,onClick:W=>{if(W.stopPropagation(),!l){if(_r){o==null||o();return}ge.submitText()}},"aria-label":Ee(l?"common.loading":_r?c?"stream.cancelArmed":"stream.cancel":"editor.send"),title:a&&c?Ee("stream.cancelArmed"):void 0,children:l?u.jsx(yGe,{}):_r?c?u.jsx("span",{className:_e.escLabel,"aria-hidden":"true",children:"Esc"}):u.jsx(gGe,{}):u.jsx(pGe,{})}),u.jsx("span",{role:"status","aria-live":"polite",className:_e.srOnly,children:a&&c?Ee("stream.cancelArmed"):""})]})]}),u.jsxs("div",{className:_e.toolbarMeasurements,"aria-hidden":"true",children:[u.jsxs("span",{ref:bs,className:`${_e.toolBtn} ${_e.modeToolBtn}`,children:[u.jsx("span",{className:_e.toolBtnModeIcon,children:u.jsx(g1,{mode:v})}),u.jsx("span",{className:_e.toolBtnArrow,children:u.jsx(Zm,{})})]}),u.jsxs("span",{ref:Ss,className:`${_e.toolBtn} ${_e.modeToolBtn}`,children:[u.jsx("span",{className:_e.toolBtnModeIcon,children:u.jsx(g1,{mode:v})}),u.jsx("span",{className:_e.toolBtnText,children:An}),u.jsx("span",{className:_e.toolBtnArrow,children:u.jsx(Zm,{})})]}),u.jsxs("span",{ref:Ie,className:`${_e.toolBtn} ${_e.modelToolBtn}`,children:[u.jsx("span",{className:_e.toolBtnModelIcon,children:u.jsx(mC,{})}),u.jsx("span",{className:_e.toolBtnArrow,children:u.jsx(Zm,{})})]}),u.jsxs("span",{ref:lt,className:`${_e.toolBtn} ${_e.modelToolBtn}`,children:[u.jsx("span",{className:_e.toolBtnModelIcon,children:u.jsx(mC,{})}),u.jsx("span",{className:_e.toolBtnText,children:Js}),u.jsx("span",{className:_e.toolBtnArrow,children:u.jsx(Zm,{})})]})]})]})]}),ye&&Oe&&ss.length>0&&u.jsx(TGe,{actions:ss,onRun:zr,onPressKey:sr})]})})),EGe="_bar_agzxl_1",AGe="_left_agzxl_12",MGe="_right_agzxl_13",NGe="_settingsButton_agzxl_23",IGe="_modeButton_agzxl_49",RGe="_modeHint_agzxl_62",jGe="_modeLabel_agzxl_67",LGe="_modeDefault_agzxl_71",DGe="_modePlan_agzxl_75",OGe="_modeAutoEdit_agzxl_79",PGe="_modeAuto_agzxl_79",BGe="_modeYolo_agzxl_87",$Ge="_shortcutsButton_agzxl_96",zGe="_modelButton_agzxl_114",FGe="_model_agzxl_114",qGe="_contextButton_agzxl_138",HGe="_context_agzxl_138",UGe="_goal_agzxl_161",VGe="_separator_agzxl_167",WGe="_taskPill_agzxl_171",ai={bar:EGe,left:AGe,right:MGe,settingsButton:NGe,modeButton:IGe,modeHint:RGe,modeLabel:jGe,modeDefault:LGe,modePlan:DGe,modeAutoEdit:OGe,modeAuto:PGe,modeYolo:BGe,shortcutsButton:$Ge,modelButton:zGe,model:FGe,contextButton:qGe,context:HGe,goal:UGe,separator:VGe,taskPill:WGe},GGe=1e3;function KGe(e,t){switch(e){case"default":return{label:t("mode.default"),className:ai.modeDefault};case"plan":return{label:t("mode.plan"),className:ai.modePlan};case"auto-edit":return{label:t("mode.auto-edit"),className:ai.modeAutoEdit};case"auto":return{label:t("mode.auto"),className:ai.modeAuto};case"yolo":return{label:t("mode.yolo"),className:ai.modeYolo};default:return null}}function YGe(){return u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[u.jsx("circle",{cx:"12",cy:"12",r:"3"}),u.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}function pC(e,t,n,s){return s(e===1?t:n,{count:e})}function XGe(e,t){if(e.length===0)return"";const n=e.filter(r=>r.status==="running");if(n.length>0){const r={agent:0,shell:0,monitor:0};for(const o of n)r[o.kind]++;const i=[];return r.shell>0&&i.push(pC(r.shell,"tasks.pill.shell","tasks.pill.shells",t)),r.agent>0&&i.push(pC(r.agent,"tasks.pill.agent","tasks.pill.agents",t)),r.monitor>0&&i.push(pC(r.monitor,"tasks.pill.monitor","tasks.pill.monitors",t)),i.join(", ")}const s=e.filter(r=>r.kind==="agent"&&r.status==="paused");return s.length>0?t(s.length===1?"tasks.pill.agentPaused":"tasks.pill.agentsPaused",{count:s.length}):t(e.length===1?"tasks.pill.done":"tasks.pill.doneMany",{count:e.length})}function QGe(e){if(e<1e3)return"";const t=Math.floor(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60);return n<60?`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}const JGe=m.forwardRef(function({onSelectMode:t,onSelectModel:n,onShowContext:s,onOpenSettings:r,onOpenTasks:i,onReturnToInput:o,tasks:a,activeGoal:l,hideSettings:c,onToggleShortcuts:d,compact:h=!1},f){const p=Ba(),g=p.status==="connected",y=p.currentModel??"",w=p.currentMode??"",v=p.tokenCount??0,b=p.contextWindow??0,{t:x}=ot(),T=(b>0?v/b*100:0).toFixed(1),C=KGe(w,x),[,S]=m.useState(0),_=m.useRef(null);m.useEffect(()=>{if(!l)return;const O=setInterval(()=>S(X=>(X+1)%1e6),GGe);return()=>clearInterval(O)},[l]);const L=m.useMemo(()=>XGe(a,x),[a,x]),M=!h&&(g||!!C),I=l?QGe(Date.now()-l.setAt):"",A=l?`◎ ${x("goal.statusActive")}${I?` (${I})`:""}`:"",P=!!L||!h,B=!h&&!!y||!h&&b>0&&v>0||!!A;if(m.useImperativeHandle(f,()=>({focusTaskPill(){var O;return L?((O=_.current)==null||O.focus({preventScroll:!0}),!0):!1}}),[L]),!P&&!B)return null;const F=O=>{if(O.key==="Enter"||O.key==="ArrowDown"||O.key==="n"&&O.ctrlKey){O.preventDefault(),O.stopPropagation(),i==null||i();return}if(O.key==="ArrowUp"||O.key==="Escape"||O.key==="p"&&O.ctrlKey){O.preventDefault(),O.stopPropagation(),o==null||o();return}O.key.length===1&&!O.metaKey&&!O.ctrlKey&&!O.altKey&&(O.preventDefault(),O.stopPropagation(),o==null||o(O.key))};return u.jsxs("div",{className:ai.bar,children:[u.jsxs("div",{className:ai.left,children:[g&&!c&&!h&&u.jsx("button",{type:"button",className:ai.settingsButton,onClick:r,onMouseDown:O=>O.stopPropagation(),onTouchStart:O=>O.stopPropagation(),title:x("settings.title"),"aria-label":x("settings.title"),"aria-haspopup":"dialog",children:u.jsx(YGe,{})}),C&&!h&&u.jsxs("button",{type:"button",className:ai.modeButton,onClick:t,onMouseDown:O=>O.stopPropagation(),onTouchStart:O=>O.stopPropagation(),title:x("mode.select"),"aria-haspopup":"listbox",children:[u.jsx("span",{className:`${ai.modeLabel} ${C.className}`,children:C.label}),!h&&u.jsx("span",{className:ai.modeHint,children:x("status.modeHint")})]}),!h&&u.jsx(u.Fragment,{children:d?u.jsx("button",{type:"button",className:ai.shortcutsButton,onClick:d,onMouseDown:O=>O.stopPropagation(),onTouchStart:O=>O.stopPropagation(),"aria-haspopup":"dialog","aria-label":x("status.shortcuts"),children:x("status.shortcuts")}):u.jsx("span",{children:x("status.shortcuts")})}),L&&u.jsxs(u.Fragment,{children:[M&&u.jsx("span",{className:ai.separator,children:"·"}),u.jsx("button",{ref:_,type:"button",className:ai.taskPill,onClick:i,onKeyDown:F,disabled:!i,children:L})]})]}),u.jsxs("div",{className:ai.right,children:[!h&&y&&u.jsx("button",{type:"button",className:ai.modelButton,onClick:n,onMouseDown:O=>O.stopPropagation(),onTouchStart:O=>O.stopPropagation(),title:x("model.select"),"aria-haspopup":"listbox",children:u.jsx("span",{className:ai.model,children:y})}),!h&&b>0&&v>0&&u.jsx("button",{type:"button",className:ai.contextButton,onClick:s,title:x("contextUsage.title"),children:u.jsx("span",{className:ai.context,children:x("status.contextUsed",{pct:T})})}),A&&u.jsx("span",{className:ai.goal,title:l==null?void 0:l.condition,children:A})]})]})}),ZGe=15e3,eKe=["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."],tKe=["正在努力搬砖，请稍候...","老板在身后，快加载啊！","头发掉光前，一定能加载完...","服务器正在深呼吸，准备放大招...","正在向服务器投喂咖啡...","正在赋能全链路，寻找关键抓手...","正在降本增效，优化加载路径...","正在打破部门壁垒，沉淀方法论...","正在拥抱变化，迭代核心价值...","正在对齐颗粒度，打磨底层逻辑...","大力出奇迹，正在强行加载...","只要我不写代码，代码就没有 Bug...","正在把 Bug 转化为 Feature...","只要我不尴尬，Bug 就追不上我...","正在试图理解去年的自己写了什么...","正在猿力觉醒中，请耐心等待...","正在询问产品经理：这需求是真的吗？","正在给产品经理画饼，请稍等...","每一行代码，都在努力让世界变得更好一点点...","每一个伟大的想法，都值得这份耐心的等待...","别急，美好的事物总是需要一点时间去酝酿...","愿你的代码永无 Bug，愿你的梦想终将成真...","哪怕只有 0.1% 的进度，也是在向目标靠近...","加载的是字节，承载的是对技术的热爱..."];function h$(e){return(e??(typeof navigator<"u"?navigator.language.toLowerCase():"")).toLowerCase().startsWith("zh")?tKe:eKe}function nKe(){const e=y_(),t=bb(),n=e!=="idle",s=m.useRef(0),r=m.useRef(0),[i,o]=m.useState({estimatedOutputTokens:0,isReceivingContent:!1}),a=m.useMemo(()=>{let c=0,d=0,h=!1;const f=new Set;let p=-1;for(let g=t.length-1;g>=0;g--)if(t[g].kind==="user"){p=g;break}for(let g=p+1;g<t.length;g++){const y=t[g];if(y.kind==="assistant"&&!y.parentToolCallId&&(c+=y.text.length,y.streaming&&(h=!0)),y.kind==="tool"&&!y.parentToolCallId){if(y.rawInput!==void 0)try{c+=JSON.stringify(y.rawInput).length}catch{}const w=sKe(y.rawOutput);w!==void 0&&!f.has(y.toolCallId)&&(d+=w,f.add(y.toolCallId))}}return{chars:c,agentTokens:d,isReceiving:h}},[t]),l=m.useRef(a);return l.current=a,a.chars<r.current&&(s.current=a.chars),r.current=a.chars,m.useEffect(()=>{if(!n){s.current=0,o({estimatedOutputTokens:0,isReceivingContent:!1});return}const c=setInterval(()=>{const{chars:d,agentTokens:h,isReceiving:f}=l.current;if(d<s.current){s.current=d,o({estimatedOutputTokens:h+Math.round(d/4),isReceivingContent:f});return}const p=d-s.current;if(p<=0){o(w=>{const v={estimatedOutputTokens:h+Math.round(s.current/4),isReceivingContent:f};return w.estimatedOutputTokens===v.estimatedOutputTokens&&w.isReceivingContent===v.isReceivingContent?w:v});return}let g;p<70?g=3:p<=200?g=Math.max(3,Math.round(p*.2)):g=50;const y=Math.min(s.current+g,d);s.current=y,o({estimatedOutputTokens:h+Math.round(y/4),isReceivingContent:f})},100);return()=>clearInterval(c)},[n]),i}function sKe(e){if(typeof e!="object"||e===null||!("type"in e)||e.type!=="task_execution")return;const t=e,n=t.tokenCount;if(typeof n=="number"&&n>0)return n;const s=t.executionSummary;if(typeof s=="object"&&s!==null){const r=s.outputTokens;if(typeof r=="number"&&r>0)return r}}function rKe(e){return e<1e3?`${e}`:e<1e4?`${(e/1e3).toFixed(1)}k`:`${Math.floor(e/1e3)}k`}function Op(e){const t=Math.round(e);return Math.abs(t)<1e6?t.toLocaleString():`${(t/1e6).toFixed(1)}M`}const iKe="_status_zld2v_1",oKe="_spinner_zld2v_11",aKe="_label_zld2v_15",lKe="_meta_zld2v_19",Bw={status:iKe,spinner:oKe,label:aKe,meta:lKe},gC=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];function dte({startedAt:e,showPhrase:t=!0}){const n=y_(),{estimatedOutputTokens:s,isReceivingContent:r}=nKe(),{language:i,t:o}=ot(),{loadingPhrases:a}=zc(),l=m.useRef(a);l.current=a;const c=m.useCallback(C=>{var S;try{return((S=l.current)==null?void 0:S.call(l,C))??h$(C)}catch(_){return console.warn("[web-shell] loadingPhrases resolver threw; using defaults",_),h$(C)}},[]),[d,h]=m.useState(0),f=m.useRef(Date.now()),[p,g]=m.useState(0),[y,w]=m.useState(()=>c(i)[0]??""),v=n!=="idle";if(m.useEffect(()=>{if(!v){h(0);return}f.current=e??Date.now(),h(f$(f.current));const C=setInterval(()=>{h(f$(f.current))},1e3);return()=>clearInterval(C)},[v,e]),m.useEffect(()=>{if(!t)return;if(n==="idle"){w(c(i)[0]??"");return}const C=()=>{const _=c(i),L=Math.floor(Math.random()*_.length);w(_[L]??"")};C();const S=setInterval(C,ZGe);return()=>clearInterval(S)},[i,n,c,t]),m.useEffect(()=>{if(n==="idle")return;const C=setInterval(()=>{g(S=>(S+1)%gC.length)},250);return()=>clearInterval(C)},[n]),n==="idle")return null;const b=gC[p%gC.length],x=r?"↓":"↑",k=d<60?`${d}s`:cKe(d*1e3),T=s>0?` · ${x} ${o("stream.tokens",{count:rKe(s)})}`:"";return u.jsxs("div",{className:Bw.status,children:[u.jsx("span",{className:Bw.spinner,children:b}),t&&y&&u.jsx("span",{className:Bw.label,children:y}),u.jsxs("span",{className:Bw.meta,children:["(",k,T," · ",o("stream.cancel"),")"]})]})}function cKe(e){if(e<=0)return"0s";const t=Math.floor(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/3600),s=Math.floor(t%3600/60),r=t%60,i=[];return n>0&&i.push(`${n}h`),s>0&&i.push(`${s}m`),r>0&&i.push(`${r}s`),i.length>0?i.join(" "):"0s"}function f$(e){return Math.max(0,Math.ceil((Date.now()-e)/1e3))}const uKe="_host_1scjy_1",dKe="_toast_1scjy_13",hKe="_message_1scjy_31",fKe="_close_1scjy_39",mKe="_info_1scjy_58",pKe="_success_1scjy_62",gKe="_warning_1scjy_66",yKe="_error_1scjy_70",v1={host:uKe,toast:dKe,message:hKe,close:fKe,info:mKe,success:pKe,warning:gKe,error:yKe};function bKe({toasts:e,onDismiss:t,autoDismissMs:n=5e3}){return e.length===0?null:u.jsx("div",{className:v1.host,role:"status","aria-live":"polite","data-web-shell-toast-host":!0,children:e.map(s=>u.jsx(vKe,{toast:s,onDismiss:t,autoDismissMs:n},s.id))})}function vKe({toast:e,onDismiss:t,autoDismissMs:n}){const{t:s}=ot();return m.useEffect(()=>{const r=window.setTimeout(()=>t(e.id),n);return()=>window.clearTimeout(r)},[n,t,e.id]),u.jsxs("div",{className:`${v1.toast} ${v1[e.tone]}`,"data-web-shell-toast":!0,"data-tone":e.tone,children:[u.jsx("div",{className:v1.message,children:e.message}),u.jsx("button",{type:"button",className:v1.close,onClick:()=>t(e.id),"aria-label":s("toast.dismiss"),title:s("toast.dismissShort"),children:"x"})]})}const wKe="_panel_n876c_1",xKe="_summary_n876c_10",kKe="_progressRing_n876c_27",_Ke="_stepText_n876c_41",SKe="_statusSegmentWrap_n876c_48",CKe="_separator_n876c_55",TKe="_statusSegment_n876c_48",EKe="_statusSegmentButton_n876c_61",AKe="_fullText_n876c_83",MKe="_compactText_n876c_87",NKe="_detail_n876c_106",IKe="_item_n876c_138",RKe="_icon_n876c_148",jKe="_loadingIcon_n876c_156",LKe="_content_n876c_165",DKe="_completed_n876c_173",OKe="_inProgress_n876c_187",PKe="_pending_n876c_192",Di={panel:wKe,summary:xKe,progressRing:kKe,stepText:_Ke,statusSegmentWrap:SKe,separator:CKe,statusSegment:TKe,statusSegmentButton:EKe,fullText:AKe,compactText:MKe,detail:NKe,item:IKe,icon:RKe,loadingIcon:jKe,content:LKe,completed:DKe,inProgress:OKe,pending:PKe};function BKe(e){switch(e){case"completed":return Di.completed;case"in_progress":return Di.inProgress;case"pending":return Di.pending}}const $Ke=m.memo(function({todos:t,title:n,statusItems:s=[]}){const{t:r}=ot();if(t.length===0&&s.length===0)return null;const i=t.length,o=i>0,a=t.findIndex(p=>p.status==="in_progress"),l=a>=0?a:t.findIndex(p=>p.status==="pending"),c=o?l>=0?l+1:i:0,d=o?c/i:0,h=s.map(p=>p.ariaLabel??p.title??(typeof p.label=="string"?p.label:void 0)).filter(Boolean).join(", ")||void 0,f=o?r("todo.stepProgress",{current:c,total:i}):h;return u.jsxs("section",{className:Di.panel,"aria-label":n??(o?r("todo.title"):h),tabIndex:0,children:[u.jsxs("div",{className:Di.summary,"aria-label":f,children:[o&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:Di.progressRing,style:{"--todo-progress":String(d)},"aria-hidden":"true"}),u.jsxs("span",{className:Di.stepText,children:[u.jsx("span",{className:Di.fullText,children:r("todo.stepProgress",{current:c,total:i})}),u.jsx("span",{className:Di.compactText,children:r("todo.stepFraction",{current:c,total:i})})]})]}),s.map((p,g)=>u.jsxs("span",{className:Di.statusSegmentWrap,children:[(i>0||g>0)&&u.jsx("span",{className:Di.separator,"aria-hidden":"true",children:"·"}),p.onClick?u.jsx("button",{type:"button",className:Di.statusSegmentButton,title:p.title,"aria-label":p.ariaLabel,onClick:p.onClick,children:p.label}):u.jsx("span",{className:Di.statusSegment,title:p.title,children:p.label})]},p.id))]}),i>0&&u.jsx("div",{className:Di.detail,role:"tooltip",children:t.map((p,g)=>u.jsxs("div",{className:`${Di.item} ${BKe(p.status)}`,children:[u.jsx("span",{className:Di.icon,"aria-hidden":"true",children:p.status==="in_progress"?u.jsx("span",{className:Di.loadingIcon}):T2(p.status)}),u.jsx("span",{className:Di.content,title:p.content,children:p.content})]},`${p.id||g}:${p.content}`))})]})}),zKe="_header_leiy3_1",FKe="_titleRow_leiy3_11",qKe="_title_leiy3_11",HKe="_subtitle_leiy3_31",$w={header:zKe,titleRow:FKe,title:qKe,subtitle:HKe};function UKe(e){const{t}=ot();return u.jsxs("div",{className:$w.header,children:[u.jsxs("div",{className:$w.titleRow,children:[u.jsx("span",{children:t("welcome.titlePrefix")}),u.jsx("span",{className:$w.title,children:"Qwen Code"})]}),u.jsx("div",{className:$w.subtitle,children:t("welcome.prompt")})]})}const m$=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,p$=Uee,cg=(e,t)=>n=>{var s;if((t==null?void 0:t.variants)==null)return p$(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:r,defaultVariants:i}=t,o=Object.keys(r).map(c=>{const d=n==null?void 0:n[c],h=i==null?void 0:i[c];if(d===null)return null;const f=m$(d)||m$(h);return r[c][f]}),a=n&&Object.entries(n).reduce((c,d)=>{let[h,f]=d;return f===void 0||(c[h]=f),c},{}),l=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((c,d)=>{let{class:h,className:f,...p}=d;return Object.entries(p).every(g=>{let[y,w]=g;return Array.isArray(w)?w.includes({...i,...a}[y]):{...i,...a}[y]===w})?[...c,h,f]:c},[]);return p$(e,o,l,n==null?void 0:n.class,n==null?void 0:n.className)},VKe=cg("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}}),Oc=m.forwardRef(function({className:t,variant:n="default",size:s="default",asChild:r=!1,...i},o){const a=r?QQ:"button";return u.jsx(a,{ref:o,"data-slot":"button","data-variant":n,"data-size":s,className:In(VKe({variant:n,size:s,className:t})),...i})});function WKe({...e}){return u.jsx(fJ,{"data-slot":"dialog",...e})}function GKe({container:e,...t}){const n=bm();return u.jsx(gJ,{"data-slot":"dialog-portal",container:e??n??void 0,...t})}function KKe({...e}){return u.jsx(Z9,{"data-slot":"dialog-close",...e})}const YKe=m.forwardRef(function({className:t,...n},s){return u.jsx(yJ,{ref:s,"data-slot":"dialog-overlay",className:In("fixed inset-0 isolate z-[var(--web-shell-dialog-backdrop-z-index,50)] bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",t),...n})}),XKe=m.forwardRef(function({className:t,children:n,showCloseButton:s=!0,overlayProps:r,...i},o){return u.jsxs(GKe,{children:[u.jsx(YKe,{...r}),u.jsxs(bJ,{ref:o,"data-slot":"dialog-content",className:In("fixed top-1/2 left-1/2 z-[var(--web-shell-dialog-backdrop-z-index,50)] grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...i,children:[n,s&&u.jsx(Z9,{"data-slot":"dialog-close",asChild:!0,children:u.jsxs(Oc,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm",children:[u.jsx(_U,{}),u.jsx("span",{className:"sr-only",children:"Close"})]})})]})]})});function QKe({className:e,...t}){return u.jsx("div",{"data-slot":"dialog-header",className:In("flex flex-col gap-2",e),...t})}function JKe({className:e,...t}){return u.jsx(xJ,{"data-slot":"dialog-title",className:In("text-base leading-none font-medium",e),...t})}function ZKe({className:e,...t}){return u.jsx(_J,{"data-slot":"dialog-description",className:In("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}const eYe="_themeDark_1tp31_1",tYe="_themeLight_1tp31_25",g$={themeDark:eYe,themeLight:tYe},nYe={sm:"sm:max-w-[420px]",md:"sm:max-w-[560px]",lg:"sm:max-w-[720px]",xl:"sm:max-w-[900px]"},sYe=["a[href]:not([hidden])","button:not([disabled]):not([hidden])","input:not([disabled]):not([hidden])","select:not([disabled]):not([hidden])","textarea:not([disabled]):not([hidden])",'[tabindex]:not([tabindex="-1"]):not([hidden])'].join(",");function y$(e){return e?Array.from(e.querySelectorAll(sYe)):[]}const Pp=[],hte=m.createContext(null);function h7(e){return e===null?!0:Pp[Pp.length-1]===e}function Ar({title:e,subtitle:t,size:n="md",allowFullscreen:s=!1,onClose:r,children:i}){const{t:o}=ot(),a=V0(),[l,c]=m.useState(!1),d=m.useRef(null),h=m.useRef(r);h.current=r;const[f]=m.useState(()=>typeof document<"u"?document.activeElement:null),p=m.useRef(!1),g=m.useRef(!1),y=m.useRef(null);y.current===null&&(y.current={}),m.useEffect(()=>{const k=y.current;Pp.push(k);const T=C=>{C.key!=="Escape"||!C.isComposing&&C.keyCode!==229||!h7(k)||(Object.defineProperty(C,"key",{configurable:!0,value:"Process"}),document.addEventListener("keydown",S=>{S===C&&Reflect.deleteProperty(C,"key")},{capture:!0,once:!0}))};return window.addEventListener("keydown",T,{capture:!0}),()=>{var M,I;window.removeEventListener("keydown",T,{capture:!0});const C=Pp.indexOf(k);if(C>=0&&Pp.splice(C,1),Pp.length===0){(M=f==null?void 0:f.focus)==null||M.call(f);return}const S=Array.from(document.querySelectorAll("[data-keyboard-scope]")),_=S[S.length-1];(I=y$(_).find(A=>!A.hasAttribute("data-dialog-close"))??_)==null||I.focus()}},[f]);const w=k=>{p.current=k.target===k.currentTarget,g.current=!1},v=k=>{g.current=k.target===k.currentTarget},b=k=>{const T=p.current&&g.current&&k.target===k.currentTarget;p.current=!1,g.current=!1,T&&r()},x=a===gr.Light?g$.themeLight:g$.themeDark;return u.jsx(WKe,{open:!0,onOpenChange:k=>{k||r()},children:u.jsx(hte.Provider,{value:y.current,children:u.jsxs(XKe,{ref:d,showCloseButton:!1,overlayProps:{onMouseDown:w,onMouseUp:v,onClick:b},className:`${x} ${a===gr.Dark?"dark":""} flex max-h-[min(80vh,calc(100vh-48px))] flex-col gap-0 overflow-hidden p-0 font-mono text-sm ${l?"h-[calc(100vh-32px)] max-h-[calc(100vh-32px)] max-w-[calc(100vw-32px)] sm:max-w-[calc(100vw-32px)]":nYe[n]}`,"aria-label":e,"data-keyboard-scope":!0,"data-web-shell-dialog":!0,"data-web-shell-dialog-title":e,onPointerDownOutside:k=>k.preventDefault(),onEscapeKeyDown:k=>{k.defaultPrevented||k.isComposing||k.keyCode===229||h7(y.current)&&(k.preventDefault(),h.current())},onOpenAutoFocus:k=>{var C;k.preventDefault(),(C=y$(d.current).find(S=>!S.hasAttribute("data-dialog-close"))??d.current)==null||C.focus()},onCloseAutoFocus:k=>k.preventDefault(),children:[u.jsxs(QKe,{className:"flex-row items-center gap-2 border-b px-4 py-2.5 text-left",children:[u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsx(JKe,{children:e}),t&&u.jsx(ZKe,{className:"mt-0.5 text-xs",children:t})]}),s&&u.jsx(Oc,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>c(k=>!k),"aria-label":o(l?"common.exitFullscreen":"common.fullscreen"),"aria-pressed":l,title:o(l?"common.exitFullscreen":"common.fullscreen"),children:l?u.jsx(Vue,{}):u.jsx(Hue,{})}),u.jsx(KKe,{asChild:!0,children:u.jsx(Oc,{type:"button",variant:"ghost",size:"icon-sm","aria-label":o("common.close"),title:o("common.close"),"data-dialog-close":!0,children:u.jsx(_U,{})})})]}),u.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto p-4","data-dialog-fullscreen":l?"":void 0,children:i})]})})})}function zw(e,t){return t<=0||e<0?0:e>t-1?t-1:e}const rYe=new Set(["button","submit","reset"]),iYe=new Set(["checkbox","radio","button","submit","reset","range","color","file"]);function b$(){const e=typeof document<"u"?document.activeElement:null;if(!e)return!1;const t=e.tagName;if(t==="BUTTON"||t==="A"||t==="TEXTAREA")return!0;if(t==="INPUT")return rYe.has(e.type);const n=e.getAttribute("role");return n==="button"||n==="link"||n==="menuitem"}function yC(){const e=typeof document<"u"?document.activeElement:null;if(!e)return!1;const t=e.tagName;return t==="TEXTAREA"?!0:t==="INPUT"?!iYe.has(e.type):e.isContentEditable===!0}function Vh({itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:s,enabled:r=!0}){const i=m.useContext(hte),o=m.useRef({itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:s});o.current={itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:s};const[a,l]=m.useState(!1);return m.useEffect(()=>{if(!r)return;const c=()=>l(!0),d=()=>l(!1),h=f=>{if(!h7(i)||f.defaultPrevented||f.isComposing||f.keyCode===229||f.metaKey||f.ctrlKey||f.altKey||f.shiftKey)return;const{itemCount:p,activeIndex:g}=o.current;if(!(p<=0))switch(f.key){case"ArrowDown":f.preventDefault(),c(),o.current.onActiveIndexChange(zw(g+1,p));break;case"ArrowUp":f.preventDefault(),c(),o.current.onActiveIndexChange(zw(g-1,p));break;case"Home":if(yC())return;f.preventDefault(),c(),o.current.onActiveIndexChange(0);break;case"End":if(yC())return;f.preventDefault(),c(),o.current.onActiveIndexChange(p-1);break;case"Enter":{if(b$()||g<0)return;f.preventDefault(),o.current.onConfirm(zw(g,p));break}case" ":{if(b$()||yC()||g<0)return;f.preventDefault(),o.current.onConfirm(zw(g,p));break}}};return window.addEventListener("keydown",h),window.addEventListener("mousemove",d),()=>{window.removeEventListener("keydown",h),window.removeEventListener("mousemove",d)}},[i,r]),{keyboardMode:a}}const oYe="_picker_5cmbf_4",aYe="_selected_5cmbf_98",lYe="_disabled_5cmbf_114",cYe={picker:oYe,"picker-in-shell":"_picker-in-shell_5cmbf_15","picker-search":"_picker-search_5cmbf_22","picker-search-label":"_picker-search-label_5cmbf_31","picker-search-input":"_picker-search-input_5cmbf_35","picker-search-hint":"_picker-search-hint_5cmbf_45","picker-sep":"_picker-sep_5cmbf_49","picker-list":"_picker-list_5cmbf_54","picker-list-compact":"_picker-list-compact_5cmbf_67","picker-empty":"_picker-empty_5cmbf_71","picker-item":"_picker-item_5cmbf_77","picker-session-item":"_picker-session-item_5cmbf_93",selected:aYe,"picker-keyboard-only":"_picker-keyboard-only_5cmbf_106",disabled:lYe,"picker-item-row":"_picker-item-row_5cmbf_119","picker-item-title":"_picker-item-title_5cmbf_128","picker-item-checkbox":"_picker-item-checkbox_5cmbf_139","picker-item-checkbox-checked":"_picker-item-checkbox-checked_5cmbf_153","picker-item-meta":"_picker-item-meta_5cmbf_163","picker-item-detail":"_picker-item-detail_5cmbf_171","dialog-current":"_dialog-current_5cmbf_185","picker-item-confirmed":"_picker-item-confirmed_5cmbf_186","picker-item-badge":"_picker-item-badge_5cmbf_217","tools-status-badge":"_tools-status-badge_5cmbf_226","tools-status-badge-enabled":"_tools-status-badge-enabled_5cmbf_237","tools-status-badge-disabled":"_tools-status-badge-disabled_5cmbf_241","tools-status-badge-busy":"_tools-status-badge-busy_5cmbf_245","tools-picker-item":"_tools-picker-item_5cmbf_249","tools-picker-item-expanded":"_tools-picker-item-expanded_5cmbf_260","tools-item-icon":"_tools-item-icon_5cmbf_264","tools-item-chevron":"_tools-item-chevron_5cmbf_296","tools-item-chevron-expanded":"_tools-item-chevron-expanded_5cmbf_308","tools-item-detail":"_tools-item-detail_5cmbf_312","mcp-status":"_mcp-status_5cmbf_317","mcp-status-connected":"_mcp-status-connected_5cmbf_321","mcp-status-connecting":"_mcp-status-connecting_5cmbf_325","mcp-status-disconnected":"_mcp-status-disconnected_5cmbf_329","mcp-status-disabled":"_mcp-status-disabled_5cmbf_333","mcp-status-unknown":"_mcp-status-unknown_5cmbf_334","dialog-inline-button":"_dialog-inline-button_5cmbf_338","dialog-primary-button":"_dialog-primary-button_5cmbf_339","dialog-danger-button":"_dialog-danger-button_5cmbf_340","dialog-inline-actions":"_dialog-inline-actions_5cmbf_363","dialog-footer-actions":"_dialog-footer-actions_5cmbf_369","dialog-form":"_dialog-form_5cmbf_387","dialog-form-row":"_dialog-form-row_5cmbf_415","dialog-textarea":"_dialog-textarea_5cmbf_421","dialog-split":"_dialog-split_5cmbf_426","dialog-split-list":"_dialog-split-list_5cmbf_433","tools-desc-expanded":"_tools-desc-expanded_5cmbf_437","tools-desc-body":"_tools-desc-body_5cmbf_447","extensions-toolbar":"_extensions-toolbar_5cmbf_454","extensions-row-button":"_extensions-row-button_5cmbf_458","extensions-detail":"_extensions-detail_5cmbf_473","extensions-detail-actions":"_extensions-detail-actions_5cmbf_484","extensions-detail-grid":"_extensions-detail-grid_5cmbf_491","extensions-detail-field":"_extensions-detail-field_5cmbf_497","extensions-detail-label":"_extensions-detail-label_5cmbf_504","extensions-detail-value":"_extensions-detail-value_5cmbf_510","extensions-confirm":"_extensions-confirm_5cmbf_517","dialog-detail":"_dialog-detail_5cmbf_527","dialog-detail-title":"_dialog-detail-title_5cmbf_535","dialog-detail-shortcut":"_dialog-detail-shortcut_5cmbf_543","dialog-detail-meta":"_dialog-detail-meta_5cmbf_550","dialog-detail-body":"_dialog-detail-body_5cmbf_555"};function st(...e){return e.filter(t=>!!t).map(t=>cYe[t]).filter(Boolean).join(" ")}const uYe="_list_jbgdx_1",dYe="_row_jbgdx_16",hYe="_selected_jbgdx_32",fYe="_keyboardOnly_jbgdx_39",mYe="_modeName_jbgdx_47",pYe="_modeIcon_jbgdx_51",gYe="_modeText_jbgdx_67",yYe="_modeDesc_jbgdx_83",kd={list:uYe,row:dYe,selected:hYe,keyboardOnly:fYe,modeName:mYe,modeIcon:pYe,modeText:gYe,modeDesc:yYe};function bYe({currentMode:e,onSelect:t}){const{t:n}=ot(),s=m.useRef(null),r=f_.map(f=>({id:f,name:n(`mode.listLabel.${f}`),description:n(`mode.desc.${f}`)})),i=r.findIndex(f=>f.id===e),[o,a]=m.useState(i>=0?i:0),l=m.useRef(!1);m.useEffect(()=>{l.current||i<0||a(i)},[i]);const c=f=>{l.current=!0,a(f)},d=f=>{const p=r[f];p&&t(p.id)},{keyboardMode:h}=Vh({itemCount:r.length,activeIndex:o,onActiveIndexChange:c,onConfirm:d});return m.useEffect(()=>{var p;const f=(p=s.current)==null?void 0:p.children[o];f==null||f.scrollIntoView({block:"nearest"})},[o]),u.jsx("div",{className:`${kd.list} ${h?kd.keyboardOnly:""}`,ref:s,role:"listbox",tabIndex:0,"aria-activedescendant":r.length>0?`mode-opt-${o}`:void 0,"aria-label":n("mode.select"),"data-web-shell-approval-mode-dialog":!0,children:r.map((f,p)=>{const g=p===o,y=f.id===e;return u.jsxs("div",{id:`mode-opt-${p}`,role:"option","aria-selected":y,className:`${kd.row} ${g?kd.selected:""} ${y?st("dialog-current"):""}`,"data-web-shell-approval-mode-option":!0,"data-mode-id":f.id,onClick:()=>d(p),onMouseMove:()=>c(p),children:[u.jsx("span",{className:kd.modeIcon,children:u.jsx(g1,{mode:f.id})}),u.jsxs("span",{className:kd.modeText,children:[u.jsx("span",{className:kd.modeName,children:f.name}),u.jsx("span",{className:kd.modeDesc,children:f.description})]})]},f.id)})})}function P4(e){const[t,n]=m.useState(""),[s,r]=m.useState(""),i=m.useRef(!1),o=m.useRef(""),a=m.useRef(e);a.current=e;const l=m.useCallback(f=>{var p;f!==o.current&&(o.current=f,r(f),(p=a.current)==null||p.call(a,f))},[]),c=m.useCallback(f=>{const p=f.target.value;n(p),i.current||l(p)},[l]),d=m.useCallback(()=>{i.current=!0},[]),h=m.useCallback(f=>{i.current=!1;const p=f.currentTarget.value;n(p),l(p)},[l]);return{filterValue:s,inputProps:{value:t,onChange:c,onCompositionStart:d,onCompositionEnd:h}}}function q2(e,t){const n=Date.now()-new Date(e).getTime(),s=Math.floor(n/6e4);if(s<1)return t("time.justNow");if(s<60)return t("time.minutesAgo",{count:s});const r=Math.floor(s/60);if(r<24)return t("time.hoursAgo",{count:r});const i=Math.floor(r/24);return i<7?t("time.daysAgo",{count:i}):new Date(e).toLocaleDateString()}function jM({session:e,active:t,current:n,confirmed:s,disabled:r,currentLabel:i,optionId:o,ariaSelected:a,leading:l,trailing:c,resumeSelector:d,onClick:h,onActivate:f}){const{t:p}=ot(),g=e.updatedAt||e.createdAt;return u.jsxs("div",{id:o,role:"option","aria-selected":a??n,"aria-current":n?"true":void 0,"aria-disabled":r||void 0,className:st("picker-item","picker-session-item",t?"selected":void 0,n?"dialog-current":void 0,s?"picker-item-confirmed":void 0,r?"disabled":void 0),title:n?i:void 0,"data-web-shell-resume-session":d?"":void 0,"data-session-id":d?e.sessionId:void 0,onClick:h,onMouseMove:f,children:[u.jsxs("div",{className:st("picker-item-row"),children:[l,u.jsx("span",{className:st("picker-item-title"),children:e.displayName||e.sessionId.slice(0,8)}),c]}),u.jsxs("div",{className:st("picker-item-meta"),children:[u.jsx("span",{children:g&&q2(g,p)}),u.jsx("span",{className:st("picker-item-detail"),children:p("common.clients",{count:e.clientCount??0})}),e.hasActivePrompt&&u.jsx("span",{className:st("picker-item-detail"),children:p("resume.activePrompt")})]})]})}const f7="resume-session-list",v$=e=>`${f7}-opt-${e}`;function vYe({onSelect:e,onClose:t}){const{t:n}=ot(),s=Ba(),{sessions:r,loading:i,error:o}=ah({autoLoad:!0}),a=s.sessionId,[l,c]=m.useState(-1),{filterValue:d,inputProps:h}=P4(()=>c(-1)),f=m.useRef(null),p=m.useRef(null),g=d?r.filter(v=>{const b=d.toLowerCase();return(v.displayName||"").toLowerCase().includes(b)||v.sessionId.toLowerCase().includes(b)}):r;m.useEffect(()=>{l>=g.length&&g.length>0&&c(g.length-1)},[g.length,l]),m.useEffect(()=>{var b;const v=(b=f.current)==null?void 0:b.children[l];v==null||v.scrollIntoView({block:"nearest"})},[l]);const y=v=>{const b=g[v];b&&(e(b.sessionId),t())},{keyboardMode:w}=Vh({itemCount:g.length,activeIndex:l,onActiveIndexChange:c,onConfirm:y});return m.useEffect(()=>{var v;(v=p.current)==null||v.focus()},[]),u.jsxs("div",{className:st("picker","picker-in-shell"),"data-web-shell-resume-dialog":!0,children:[u.jsxs("div",{className:st("picker-search"),children:[u.jsxs("span",{className:st("picker-search-label"),children:[n("resume.search"),":"," "]}),u.jsx("input",{ref:p,className:st("picker-search-input"),"aria-label":n("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":f7,"aria-activedescendant":l>=0&&l<g.length?v$(l):void 0,...h,placeholder:""})]}),u.jsx("div",{className:st("picker-sep")}),u.jsxs("div",{id:f7,role:"listbox",className:st("picker-list",w?"picker-keyboard-only":void 0),ref:f,children:[i&&u.jsx("div",{className:st("picker-empty"),children:n("common.loading")}),!i&&o&&u.jsx("div",{className:st("picker-empty"),children:o.message||n("resume.failedToLoad")}),!i&&!o&&g.length===0&&u.jsx("div",{className:st("picker-empty"),children:d?n("resume.noMatch",{query:d}):n("resume.none")}),!i&&g.map((v,b)=>u.jsx(jM,{session:v,optionId:v$(b),active:b===l,current:v.sessionId===a,currentLabel:n("resume.current"),resumeSelector:!0,onClick:()=>y(b),onActivate:()=>c(b)},v.sessionId))]})]})}const wYe="_layout_1sigx_1",xYe="_list_1sigx_9",kYe="_row_1sigx_23",_Ye="_selected_1sigx_39",SYe="_keyboardOnly_1sigx_46",CYe="_label_1sigx_54",TYe="_divider_1sigx_58",EYe="_number_1sigx_65",AYe="_provider_1sigx_71",MYe="_badge_1sigx_86",NYe="_detail_1sigx_92",IYe="_detailRow_1sigx_104",RYe="_detailLabel_1sigx_111",jYe="_detailValue_1sigx_117",LYe="_empty_1sigx_122",To={layout:wYe,list:xYe,row:kYe,selected:_Ye,keyboardOnly:SYe,label:CYe,divider:TYe,number:EYe,provider:AYe,badge:MYe,detail:NYe,detailRow:IYe,detailLabel:RYe,detailValue:jYe,empty:LYe};function DYe(e,t){return e?`${e.toLocaleString()} ${t("contextUsage.tokens")}`:t("model.contextWindow.unknown")}function OYe(e,t){if(!e)return t("model.modality.textOnly");const n=[];return e.image&&n.push(t("model.modality.image")),e.pdf&&n.push(t("model.modality.pdf")),e.audio&&n.push(t("model.modality.audio")),e.video&&n.push(t("model.modality.video")),n.length===0?t("model.modality.textOnly"):`${t("model.modality.text")} · ${n.join(" · ")}`}function w$(e){if(e.authType)return e.authType;const t=e.id.match(/\(([^()]+)\)$/);return t==null?void 0:t[1]}function PYe(e){return e.label?e.label:e.baseModelId?e.baseModelId:e.id.replace(/\([^()]+\)$/,"")}function BYe(e){return[e.authType??"",e.id,e.baseUrl??"",e.envKey??""].join("\0")}function $Ye(e,t){return t?e.baseModelId??e.id.replace(/\([^()]+\)$/,""):e.id}function Fw({label:e,value:t}){return u.jsxs("div",{className:To.detailRow,children:[u.jsx("span",{className:To.detailLabel,children:e}),u.jsx("span",{className:To.detailValue,children:t})]})}function zYe({mode:e="main",onSelect:t,models:n,currentModelId:s}){const r=Ba(),i=s??r.currentModel??"",o=m.useMemo(()=>n??r.models??[],[n,r.models]),{t:a}=ot(),l=m.useRef(null),c=e==="fast",d=e==="voice",h=e==="vision",f=o.findIndex(k=>k.id===i),[p,g]=m.useState(f>=0?f:0),y=m.useRef(!1);m.useEffect(()=>{y.current||o.length===0||g(f>=0?f:0)},[o.length,f]);const w=k=>{y.current=!0,g(k)};m.useEffect(()=>{p>=o.length&&o.length>0&&g(o.length-1)},[o.length,p]);const v=o[p]??o[0],b=k=>{const T=o[k];T&&t($Ye(T,c))},{keyboardMode:x}=Vh({itemCount:o.length,activeIndex:p,onActiveIndexChange:w,onConfirm:b});return m.useEffect(()=>{var T;const k=(T=l.current)==null?void 0:T.children[p];k==null||k.scrollIntoView({block:"nearest"})},[p]),u.jsxs("div",{className:To.layout,children:[u.jsxs("div",{className:`${To.list} ${x?To.keyboardOnly:""}`,ref:l,role:"listbox",tabIndex:0,"aria-activedescendant":o.length>0?`model-opt-${p}`:void 0,"aria-label":a(c?"model.setFast":d?"model.setVoice":h?"model.setVision":"model.select"),"data-web-shell-model-dialog":!0,children:[o.length===0?u.jsx("div",{className:To.empty,children:a("model.none")}):null,o.map((k,T)=>{const C=T===p,S=T===f,_=w$(k);return u.jsxs("div",{id:`model-opt-${T}`,role:"option","aria-selected":S,className:`${To.row} ${C?To.selected:""} ${S?st("dialog-current"):""}`,"data-web-shell-model-option":!0,"data-model-id":k.id,onClick:()=>b(T),onMouseMove:()=>w(T),children:[u.jsxs("span",{className:To.number,children:[T+1,"."]}),_?u.jsxs("span",{className:To.provider,children:["[",_,"]"]}):null,u.jsx("span",{className:To.label,children:PYe(k)}),k.isRuntime?u.jsx("span",{className:To.badge,children:a("common.runtime")}):null]},BYe(k))})]}),v?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:To.divider}),u.jsxs("div",{className:To.detail,children:[u.jsx(Fw,{label:a("model.modality"),value:OYe(v.modalities,a)}),u.jsx(Fw,{label:a("model.contextWindow"),value:DYe(v.contextWindow,a)}),w$(v)!=="qwen-oauth"?u.jsxs(u.Fragment,{children:[u.jsx(Fw,{label:a("model.baseUrl"),value:v.baseUrl??a("model.default")}),u.jsx(Fw,{label:a("model.apiKey"),value:v.envKey??a("model.notSet")})]}):null]})]}):null]})}const FYe="_body_2kfet_1",qYe="_hint_2kfet_8",HYe="_list_2kfet_13",UYe="_empty_2kfet_21",VYe="_row_2kfet_27",WYe="_rowSelected_2kfet_51",GYe="_badge_2kfet_56",KYe="_label_2kfet_74",YYe="_footer_2kfet_78",XYe="_count_2kfet_86",QYe="_actions_2kfet_91",JYe="_cancel_2kfet_96",ZYe="_confirm_2kfet_97",ga={body:FYe,hint:qYe,list:HYe,empty:UYe,row:VYe,rowSelected:WYe,badge:GYe,label:KYe,footer:YYe,count:XYe,actions:QYe,cancel:JYe,confirm:ZYe};function eXe({models:e,current:t,max:n,onConfirm:s,onClose:r}){const{t:i}=ot(),[o,a]=m.useState(()=>{const d=new Set,h=[];for(const f of t){const p=f.trim();if(!(!p||d.has(p))&&(d.add(p),h.push(p),h.length>=n))break}return h}),l=m.useMemo(()=>{const d=new Set(e.map(f=>f.baseId)),h=o.filter(f=>!d.has(f)).map(f=>({baseId:f,label:f}));return[...e,...h]},[e,o]),c=d=>{a(h=>h.includes(d)?h.filter(f=>f!==d):h.length>=n?h:[...h,d])};return u.jsxs("div",{className:ga.body,children:[u.jsx("div",{className:ga.hint,children:i("settings.models.fallbacks.hint",{max:n})}),u.jsxs("div",{className:ga.list,role:"group","aria-label":i("settings.models.fallbacks.title"),children:[l.length===0&&u.jsx("div",{className:ga.empty,children:i("settings.models.fallbacks.empty")}),l.map(d=>{const h=o.indexOf(d.baseId),f=h>=0,p=o.length>=n&&!f;return u.jsxs("button",{type:"button","aria-pressed":f,className:`${ga.row} ${f?ga.rowSelected:""}`,"aria-disabled":p||void 0,title:p?i("settings.models.fallbacks.limitReached",{max:n}):void 0,onClick:()=>c(d.baseId),children:[u.jsx("span",{className:ga.badge,children:f?h+1:""}),u.jsx("span",{className:ga.label,children:d.label})]},d.baseId)})]}),u.jsxs("div",{className:ga.footer,children:[u.jsxs("span",{className:ga.count,children:[o.length,"/",n]}),u.jsxs("div",{className:ga.actions,children:[u.jsx("button",{type:"button",className:ga.cancel,onClick:r,children:i("settings.models.cancel")}),u.jsx("button",{type:"button",className:ga.confirm,onClick:()=>s(o),children:i("settings.models.fallbacks.confirm")})]})]})]})}function LM(e){return e.replace(/[：:\s]+$/u,"")}const tXe="_panel_irhhk_1",nXe="_embedded_irhhk_13",sXe="_footer_irhhk_21",rXe="_titleLine_irhhk_25",iXe="_icon_irhhk_32",oXe="_title_irhhk_25",aXe="_subtitle_irhhk_44",lXe="_text_irhhk_49",cXe="_options_irhhk_55",uXe="_option_irhhk_55",dXe="_optionActive_irhhk_77",hXe="_optionLabel_irhhk_81",fXe="_optionIcon_irhhk_86",mXe="_optionContent_irhhk_119",pXe="_optionDesc_irhhk_129",gXe="_badge_irhhk_135",yXe="_toolDetail_irhhk_170",bXe="_toolDetailTitle_irhhk_175",vXe="_toolDetailBody_irhhk_180",wXe="_toolList_irhhk_181",xXe="_textInput_irhhk_193",kXe="_textArea_irhhk_211",_Xe="_summary_irhhk_231",SXe="_summaryRow_irhhk_238",CXe="_summaryLabel_irhhk_244",TXe="_summaryValue_irhhk_250",EXe="_summaryBlockTitle_irhhk_255",AXe="_summaryBlock_irhhk_255",MXe="_manageList_irhhk_295",NXe="_manageItem_irhhk_301",IXe="_manageItemExpanded_irhhk_307",RXe="_manageRow_irhhk_312",jXe="_manageRowActive_irhhk_329",LXe="_manageIcon_irhhk_333",DXe="_manageName_irhhk_362",OXe="_levelTag_irhhk_370",PXe="_manageChevron_irhhk_380",BXe="_manageChevronExpanded_irhhk_398",$Xe="_manageDetail_irhhk_402",zXe="_manageDetailInner_irhhk_409",FXe="_manageDetailHeader_irhhk_419",qXe="_manageActions_irhhk_426",HXe="_manageButton_irhhk_433",UXe="_dangerButton_irhhk_453",VXe="_deleteText_irhhk_457",WXe="_viewerRow_irhhk_487",GXe="_viewerLabel_irhhk_500",KXe="_viewerField_irhhk_507",YXe="_viewerSectionTitle_irhhk_512",XXe="_viewerBlock_irhhk_518",QXe="_closed_irhhk_524",JXe="_closedText_irhhk_528",ZXe="_loading_irhhk_534",eQe="_error_irhhk_539",tQe="_createWizard_irhhk_545",nQe="_createSteps_irhhk_551",sQe="_createStepPill_irhhk_559",rQe="_createStepPillActive_irhhk_571",iQe="_createStepPillDone_irhhk_576",oQe="_createStepNumber_irhhk_580",aQe="_createStepLabel_irhhk_591",lQe="_createBody_irhhk_597",cQe="_createActions_irhhk_601",Qe={panel:tXe,embedded:nXe,footer:sXe,titleLine:rXe,icon:iXe,title:oXe,subtitle:aXe,text:lXe,options:cXe,option:uXe,optionActive:dXe,optionLabel:hXe,optionIcon:fXe,optionContent:mXe,optionDesc:pXe,badge:gXe,toolDetail:yXe,toolDetailTitle:bXe,toolDetailBody:vXe,toolList:wXe,textInput:xXe,textArea:kXe,summary:_Xe,summaryRow:SXe,summaryLabel:CXe,summaryValue:TXe,summaryBlockTitle:EXe,summaryBlock:AXe,manageList:MXe,manageItem:NXe,manageItemExpanded:IXe,manageRow:RXe,manageRowActive:jXe,manageIcon:LXe,manageName:DXe,levelTag:OXe,manageChevron:PXe,manageChevronExpanded:BXe,manageDetail:$Xe,manageDetailInner:zXe,manageDetailHeader:FXe,manageActions:qXe,manageButton:HXe,dangerButton:UXe,deleteText:VXe,viewerRow:WXe,viewerLabel:GXe,viewerField:KXe,viewerSectionTitle:YXe,viewerBlock:XXe,closed:QXe,closedText:JXe,loading:ZXe,error:eQe,createWizard:tQe,createSteps:nQe,createStepPill:sQe,createStepPillActive:rQe,createStepPillDone:iQe,createStepNumber:oQe,createStepLabel:aQe,createBody:lQe,createActions:cQe};function fte(e){if(e==="project")return"workspace";if(e==="user")return"global"}function mte(e){return fte(e.level)!==void 0&&!e.isBuiltin&&e.level!=="extension"}function uQe(e,t){return e==="project"?t("agent.level.project"):e==="user"?t("agent.level.user"):e==="builtin"?t("agent.level.builtin"):e==="extension"?t("agent.level.extension"):e}const bc=LM;function dQe(e){return e.displayName||e.name}function pte(e){const t=e.toLowerCase();return["read","grep","glob","ls","list","search","fetch","webfetch","web_fetch","websearch","web_search","think","todo","context"].some(n=>t.includes(n))}function gte(e){const t=e.toLowerCase();return["edit","write","delete","move","patch","replace","create"].some(n=>t.includes(n))}function yte(e){const t=e.toLowerCase();return["shell","exec","run","command","terminal","bash","spawn"].some(n=>t.includes(n))}function hQe(e,t){if(!t||t.length===0)return 0;const n=new Set(t),s=e.findIndex(r=>r.id==="all"||r.tools.length!==n.size?!1:r.tools.every(i=>n.has(i)));return s>=0?s:0}function fQe({mode:e,embedded:t=!1,onMessage:n,onClose:s}){const{t:r}=ot(),{agents:i,loading:o,reload:a,getAgent:l,createAgent:c,generateAgent:d,deleteAgent:h}=Bce({autoLoad:!0}),{tools:f}=yU({autoLoad:!0}),[p,g]=m.useState(!1),[y,w]=m.useState(()=>e==="manage"?"manage":e==="create"||e==="create-user"||e==="create-project"?"create":"menu"),[v,b]=m.useState(0),[x,k]=m.useState(0),[T,C]=m.useState(null),[S,_]=m.useState(null),[L,M]=m.useState(!1),[I,A]=m.useState(null),[P,B]=m.useState(1),[F,O]=m.useState(()=>e==="create-user"?"global":"workspace"),[X,z]=m.useState("manual"),[U,D]=m.useState(""),[G,q]=m.useState(""),[N,ee]=m.useState(""),[re,Q]=m.useState([]),[K,se]=m.useState(0),[te,ce]=m.useState(!1),[oe,de]=m.useState(!1),Te=m.useRef(0),qe=m.useCallback(()=>{g(!0),s()},[s]),Ne=m.useMemo(()=>{const Fe=i.filter(je=>je.level==="project"),ue=i.filter(je=>je.level==="user"),vt=i.filter(je=>je.level==="builtin"),ye=i.filter(je=>je.level==="extension");return{project:Fe,user:ue,builtin:vt,extension:ye}},[i]),ge=m.useMemo(()=>[...Ne.project,...Ne.user,...Ne.builtin,...Ne.extension],[Ne]),Ee=m.useMemo(()=>{const Fe=f.filter(je=>je.enabled).map(dQe).sort((je,Ye)=>je.localeCompare(Ye)),ue=Fe.filter(pte),vt=Fe.filter(gte),ye=Fe.filter(yte);return[{id:"all",label:r("agent.create.tools.all"),tools:[]},{id:"read",label:r("agent.create.tools.readOnly"),tools:ue},{id:"edit",label:r("agent.create.tools.readEdit"),tools:[...new Set([...ue,...vt])]},{id:"execute",label:r("agent.create.tools.readEditExecute"),tools:[...new Set([...ue,...vt,...ye])]}]},[r,f]);m.useEffect(()=>{if(y!=="manage")return;const Fe=S!==null?ge[S]:void 0;Fe&&l(Fe.name).then(C).catch(ue=>A(ue instanceof Error?ue.message:String(ue)))},[y,ge,S,l]),m.useEffect(()=>{x>=ge.length&&ge.length>0&&k(ge.length-1),S!==null&&S>=ge.length&&_(null)},[S,ge.length,x]);const _t=m.useCallback((Fe=x)=>{const ue=ge[Fe];if(!ue||!mte(ue))return;const vt=fte(ue.level);vt&&(M(!0),h(ue.name,vt).then(()=>{n(r("agent.deleted",{name:ue.name})),C(null),_(null),k(0),a()}).catch(ye=>A(ye instanceof Error?ye.message:String(ye))).finally(()=>M(!1)))},[ge,x,h,n,a,r]),Ct=m.useCallback(()=>{if(!U.trim()||!G.trim()||!N.trim()){A(r("agent.create.required"));return}M(!0),c({name:U.trim(),description:G.trim(),systemPrompt:N.trim(),scope:F,tools:re}).then(Fe=>{n(r("agent.created",{name:Fe.agent.name})),qe()}).catch(Fe=>A(Fe instanceof Error?Fe.message:String(Fe))).finally(()=>M(!1))},[U,G,N,F,re,c,n,qe,r]),Je=m.useCallback(async()=>{const Fe=G.trim();if(!Fe||te)return;const ue=Te.current+1;Te.current=ue,ce(!0),de(!1),A(null);try{const vt=await d(Fe);if(Te.current!==ue)return;D(vt.name),q(vt.description),ee(vt.systemPrompt),B(X==="manual"?6:4),se(0)}catch(vt){if(Te.current!==ue)return;A(r("agent.create.generateFailed",{error:vt instanceof Error?vt.message:String(vt)})),de(!0)}finally{Te.current===ue&&ce(!1)}},[G,te,X,d,r]),at=m.useCallback(Fe=>{if(Fe==="name"&&U.trim())B(4),de(!0);else if(Fe==="prompt"&&N.trim())B(5),de(!0);else if(Fe==="desc"&&G.trim()){if(X==="qwen"){Je();return}B(X==="manual"?6:4),se(0),de(!1)}},[U,G,N,X,Je]);if(p)return u.jsx("div",{className:`${Qe.panel} ${t?Qe.embedded:""} ${Qe.closed}`,children:u.jsx("div",{className:Qe.closedText,children:r("agents.closed")})});if(o&&i.length===0)return u.jsxs("div",{className:`${Qe.panel} ${t?Qe.embedded:""}`,children:[u.jsxs("div",{className:Qe.titleLine,children:[u.jsx("span",{className:Qe.icon,children:"?"}),u.jsx("span",{className:Qe.title,children:r("agents.title")})]}),u.jsx("div",{className:Qe.loading,children:r("common.loading")})]});const Oe=r("agents.title");return u.jsxs("div",{className:`${Qe.panel} ${t?Qe.embedded:""}`,children:[!t&&y!=="create"&&u.jsxs("div",{className:Qe.titleLine,children:[u.jsx("span",{className:Qe.icon,children:"?"}),u.jsx("span",{className:Qe.title,children:Oe}),u.jsx("span",{className:Qe.subtitle,children:r("agent.count",{count:i.length})})]}),I&&u.jsx("div",{className:Qe.error,children:I}),y==="menu"&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Qe.text,children:r("agent.selectAction")}),u.jsxs("div",{className:Qe.options,children:[u.jsx(Cf,{idx:0,active:v===0,label:r("agent.manage"),desc:r("agent.manage.desc"),onClick:()=>{b(0),w("manage")},onHover:()=>b(0)}),u.jsx(Cf,{idx:1,active:v===1,label:r("agent.create"),desc:r("agent.create.desc"),onClick:()=>{b(1),w("create")},onHover:()=>b(1)})]}),u.jsx("div",{className:Qe.footer,children:r("agent.footer.nav")})]}),y==="manage"&&u.jsx(mQe,{agents:ge,expandedAgentIdx:S,selectedAgent:T,busy:L,onToggleAgent:Fe=>{k(Fe),_(ue=>ue===Fe?null:Fe),C(null)},onDelete:Fe=>{L||_t(Fe)},t:r}),y==="create"&&u.jsx(pQe,{step:P,method:X,scope:F,name:U,desc:G,prompt:N,tools:re,toolCategories:Ee,selIdx:K,busy:L,generating:te,inputFocused:oe,onSetName:D,onSetDesc:q,onSetPrompt:ee,onInputNext:at,onInputFocus:()=>de(!0),onInputBlur:()=>de(!1),onSetStep:B,onSetSelectedIndex:se,onSelectLocation:Fe=>{se(Fe),O(Fe===0?"workspace":"global")},onSelectMethod:Fe=>{se(Fe),z(Fe===0?"qwen":"manual")},onSelectTools:Fe=>{var ue;se(Fe),Q(((ue=Ee[Fe])==null?void 0:ue.tools)??[])},onSave:()=>{L||Ct()},t:r})]})}function Cf({idx:e,active:t,label:n,desc:s,badge:r,numbered:i=!1,onClick:o,onHover:a}){return u.jsxs("div",{className:`${Qe.option} ${t?Qe.optionActive:""}`,onClick:o,onMouseEnter:a,children:[u.jsx("span",{className:Qe.optionIcon,"aria-hidden":"true"}),u.jsxs("span",{className:Qe.optionContent,children:[u.jsxs("span",{className:Qe.optionLabel,children:[i?`${e+1}. `:"",n,r&&u.jsx("span",{className:Qe.badge,children:r})]}),s&&u.jsx("span",{className:Qe.optionDesc,children:s})]})]})}function mQe({agents:e,expandedAgentIdx:t,selectedAgent:n,busy:s,onToggleAgent:r,onDelete:i,t:o}){const[a,l]=m.useState(null),c=m.useMemo(()=>new Set(e.filter(d=>d.level==="project").map(d=>d.name)),[e]);return e.length===0?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Qe.text,children:o("agent.empty")}),u.jsx("div",{className:Qe.text,children:o("agent.createFirstHint")})]}):u.jsx("div",{className:Qe.manageList,children:e.map((d,h)=>{const f=t===h,p=f&&(n==null?void 0:n.name)===d.name?n:null,g=mte(d),y=(p==null?void 0:p.tools)??[],w=y.length===0||y.includes("*")?o("agent.create.tools.all"):y.join(", ");return u.jsxs("div",{className:`${Qe.manageItem} ${f?Qe.manageItemExpanded:""}`,children:[u.jsxs("button",{type:"button",className:`${Qe.manageRow} ${f?Qe.manageRowActive:""}`,onClick:()=>{l(null),r(h)},children:[u.jsx("span",{className:Qe.manageIcon,"aria-hidden":"true"}),u.jsx("span",{className:Qe.manageName,children:d.name}),u.jsx("span",{className:Qe.levelTag,children:uQe(d.level,o)}),d.level==="user"&&c.has(d.name)?u.jsx("span",{className:Qe.levelTag,children:o("agent.overriddenBadge")}):null,u.jsx("span",{className:`${Qe.manageChevron} ${f?Qe.manageChevronExpanded:""}`})]}),f?u.jsx("div",{className:Qe.manageDetail,children:p?u.jsxs("div",{className:Qe.manageDetailInner,children:[u.jsx("div",{className:Qe.manageDetailHeader,children:g?u.jsx("div",{className:Qe.manageActions,children:a===h?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:Qe.deleteText,children:s?o("agent.delete.loading"):o("agent.delete.confirm",{name:d.name})}),u.jsx("button",{type:"button",className:Qe.manageButton,onClick:()=>l(null),disabled:s,children:o("common.cancel")}),u.jsx("button",{type:"button",className:`${Qe.manageButton} ${Qe.dangerButton}`,onClick:()=>i(h),disabled:s,children:o("agent.action.delete")})]}):u.jsx("button",{type:"button",className:`${Qe.manageButton} ${Qe.dangerButton}`,onClick:()=>l(h),disabled:s,children:o("agent.action.delete")})}):null}),u.jsxs("div",{className:Qe.viewerField,children:[u.jsx("div",{className:Qe.viewerSectionTitle,children:bc(o("agent.toolsLabel"))}),u.jsx("div",{className:Qe.viewerBlock,children:w})]}),u.jsxs("div",{className:Qe.viewerField,children:[u.jsx("div",{className:Qe.viewerSectionTitle,children:bc(o("agent.filePathLabel"))}),u.jsx("div",{className:Qe.viewerBlock,children:p.filePath||"—"})]}),p.model?u.jsxs("div",{className:Qe.viewerRow,children:[u.jsx("span",{className:Qe.viewerLabel,children:bc(o("agent.modelLabel"))}),u.jsx("span",{children:p.model})]}):null,u.jsxs("div",{className:Qe.viewerField,children:[u.jsx("div",{className:Qe.viewerSectionTitle,children:bc(o("agent.descriptionLabel"))}),u.jsx("div",{className:Qe.viewerBlock,children:p.description||"—"})]}),u.jsxs("div",{className:Qe.viewerField,children:[u.jsx("div",{className:Qe.viewerSectionTitle,children:bc(o("agent.systemPromptLabel"))}),u.jsx("div",{className:Qe.viewerBlock,children:p.systemPrompt||"—"})]})]}):u.jsx("div",{className:Qe.loading,children:o("common.loading")})}):null]},`${d.level}:${d.name}`)})})}function pQe({step:e,method:t,scope:n,name:s,desc:r,prompt:i,tools:o,toolCategories:a,selIdx:l,busy:c,generating:d,inputFocused:h,onSetName:f,onSetDesc:p,onSetPrompt:g,onInputNext:y,onInputFocus:w,onInputBlur:v,onSetStep:b,onSetSelectedIndex:x,onSelectLocation:k,onSelectMethod:T,onSelectTools:C,onSave:S,t:_}){const L=m.useRef(null),M=m.useRef(null),I=m.useRef(null);m.useEffect(()=>{var G,q,N,ee;h&&(t==="manual"?e===3?(G=L.current)==null||G.focus():e===4?(q=I.current)==null||q.focus():e===5&&((N=M.current)==null||N.focus()):e===3&&((ee=M.current)==null||ee.focus()))},[e,t,h]);const A=t==="manual"?6:4,P=A+1,B=t==="manual"?[_("agent.create.location"),_("agent.create.method"),_("agent.create.name"),_("agent.create.prompt"),_("agent.create.description"),_("agent.create.toolsSelection")]:[_("agent.create.location"),_("agent.create.method"),_("agent.create.describeAgent"),_("agent.create.toolsSelection")],F=G=>G===1?n==="workspace"?0:1:G===2?t==="qwen"?0:1:G===A?hQe(a,o):0,O=G=>{b(G),x(F(G)),t==="manual"&&(G===3||G===4||G===5)||t==="qwen"&&G===3?w():v()},X=()=>{e<=1||d||O(e-1)},z=()=>{if(!d){if(e===1){O(2);return}if(e===2){O(3);return}if(t==="manual"&&e===3){y("name");return}if(t==="manual"&&e===4){y("prompt");return}if(t==="manual"&&e===5||t==="qwen"&&e===3){y("desc");return}e===A&&(C(l),O(P))}},U=d||t==="manual"&&e===3&&!s.trim()||t==="manual"&&e===4&&!i.trim()||t==="manual"&&e===5&&!r.trim()||t==="qwen"&&e===3&&!r.trim();let D=null;if(e===1&&(D=u.jsx(u.Fragment,{children:u.jsxs("div",{className:Qe.options,children:[u.jsx(Cf,{idx:0,active:l===0,label:_("agent.create.project.cli"),numbered:!0,onClick:()=>k(0)}),u.jsx(Cf,{idx:1,active:l===1,label:_("agent.create.user.cli"),numbered:!0,onClick:()=>k(1)})]})})),e===2&&(D=u.jsx(u.Fragment,{children:u.jsxs("div",{className:Qe.options,children:[u.jsx(Cf,{idx:0,active:l===0,label:_("agent.create.method.qwen.recommended"),numbered:!0,onClick:()=>T(0)}),u.jsx(Cf,{idx:1,active:l===1,label:_("agent.create.method.manual"),numbered:!0,onClick:()=>T(1)})]})})),t==="manual"&&e===3&&(D=u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Qe.text,children:_("agent.create.nameHelp")}),u.jsx("input",{ref:L,className:Qe.textInput,value:s,onChange:G=>f(G.target.value),onFocus:w,onBlur:v,placeholder:_("agent.create.namePlaceholder"),autoFocus:!0})]})),t==="manual"&&e===4&&(D=u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Qe.text,children:_("agent.create.promptHelp")}),u.jsx("textarea",{ref:I,className:Qe.textArea,value:i,onChange:G=>g(G.target.value),onFocus:w,onBlur:v,placeholder:_("agent.create.promptPlaceholder.cli"),autoFocus:!0})]})),t==="manual"&&e===5&&(D=u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Qe.text,children:_("agent.create.manualDescHelp")}),u.jsx("textarea",{ref:M,className:Qe.textArea,value:r,onChange:G=>p(G.target.value),onFocus:w,onBlur:v,placeholder:_("agent.create.manualDescPlaceholder"),autoFocus:!0})]})),t==="qwen"&&e===3&&(D=u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Qe.text,children:_("agent.create.qwenHint")}),d?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Qe.text,children:_("agent.create.generatingConfig")}),u.jsx("div",{className:Qe.footer,children:_("agent.footer.generating")})]}):u.jsx(u.Fragment,{children:u.jsx("textarea",{ref:M,className:Qe.textArea,value:r,onChange:G=>p(G.target.value),onFocus:w,onBlur:v,placeholder:_("agent.create.qwenPlaceholder"),autoFocus:!0})})]})),e===A){const G=a[l]??a[0],q=(G==null?void 0:G.tools)??[],N=(G==null?void 0:G.id)==="all"?_("agent.create.tools.allInfo"):q.length>0?q.join(", "):_("agent.create.tools.none"),ee=q.filter(pte),re=q.filter(gte),Q=q.filter(yte);D=u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Qe.options,children:a.map((K,se)=>u.jsx(Cf,{idx:se,active:l===se,label:K.label,numbered:!0,onClick:()=>C(se)},K.id))}),u.jsx("div",{className:Qe.toolDetail,children:(G==null?void 0:G.id)==="all"?u.jsx("div",{className:Qe.toolDetailBody,children:N}):u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Qe.toolDetailTitle,children:_("agent.create.tools.selected")}),u.jsx("div",{className:Qe.toolList,children:q.length===0?N:u.jsxs(u.Fragment,{children:[ee.length>0&&u.jsxs("div",{children:[_("agent.create.tools.readOnlyLabel")," ",ee.join(", ")]}),re.length>0&&u.jsxs("div",{children:[_("agent.create.tools.editLabel")," ",re.join(", ")]}),Q.length>0&&u.jsxs("div",{children:[_("agent.create.tools.executionLabel")," ",Q.join(", ")]})]})})]})})]})}if(e===P){const G=o.length===0?"*":o.join(", ");D=u.jsx(u.Fragment,{children:u.jsxs("div",{className:Qe.summary,children:[u.jsxs("div",{className:Qe.summaryRow,children:[u.jsx("span",{className:Qe.summaryLabel,children:bc(_("agent.create.name"))}),u.jsx("span",{className:Qe.summaryValue,children:s||"—"})]}),u.jsxs("div",{className:Qe.summaryRow,children:[u.jsx("span",{className:Qe.summaryLabel,children:bc(_("agent.location"))}),u.jsx("span",{className:Qe.summaryValue,children:_(n==="workspace"?"agent.create.project.cli":"agent.create.user.cli")})]}),u.jsxs("div",{className:Qe.summaryRow,children:[u.jsx("span",{className:Qe.summaryLabel,children:bc(_("agent.toolsLabel"))}),u.jsx("span",{className:Qe.summaryValue,children:G})]}),u.jsx("div",{className:Qe.summaryBlockTitle,children:bc(_("agent.descriptionLabel"))}),u.jsx("div",{className:Qe.summaryBlock,children:r||"—"}),u.jsx("div",{className:Qe.summaryBlockTitle,children:bc(_("agent.systemPromptLabel"))}),u.jsx("div",{className:Qe.summaryBlock,children:i||"—"})]})})}return u.jsxs("div",{className:Qe.createWizard,children:[u.jsx("div",{className:Qe.createSteps,children:B.map((G,q)=>{const N=q+1;return u.jsxs("div",{className:`${Qe.createStepPill} ${N===Math.min(e,A)?Qe.createStepPillActive:""} ${N<Math.min(e,A)?Qe.createStepPillDone:""}`,children:[u.jsx("span",{className:Qe.createStepNumber,children:N}),u.jsx("span",{className:Qe.createStepLabel,children:G})]},`${N}:${G}`)})}),u.jsx("div",{className:Qe.createBody,children:D}),u.jsxs("div",{className:Qe.createActions,children:[u.jsx("button",{type:"button",className:Qe.manageButton,onClick:X,disabled:e<=1||d||c,children:_("common.previous")}),e===P?u.jsx("button",{type:"button",className:Qe.manageButton,onClick:S,disabled:c,children:_(c?"agent.create.loading":"agent.create.save")}):u.jsx("button",{type:"button",className:Qe.manageButton,onClick:z,disabled:U,children:_("common.next")})]})]})}const gQe="_page_1np31_1",yQe="_tabs_1np31_11",bQe="_memoryCard_1np31_19",vQe="_memoryCardActive_1np31_35",wQe="_memoryTitle_1np31_44",xQe="_detailPath_1np31_48",kQe="_status_1np31_49",_Qe="_actionButton_1np31_54",SQe="_primaryButton_1np31_55",CQe="_secondaryButton_1np31_56",TQe="_detail_1np31_48",EQe="_detailHeader_1np31_79",AQe="_detailTitleWrap_1np31_87",MQe="_actions_1np31_91",NQe="_content_1np31_105",IQe="_editor_1np31_106",RQe="_editorFooter_1np31_127",Ki={page:gQe,tabs:yQe,memoryCard:bQe,memoryCardActive:vQe,memoryTitle:wQe,detailPath:xQe,status:kQe,actionButton:_Qe,primaryButton:SQe,secondaryButton:CQe,detail:TQe,detailHeader:EQe,detailTitleWrap:AQe,actions:MQe,content:NQe,editor:IQe,editorFooter:RQe};function x$(e,t){return e.find(n=>n.scope===t)}function k$(e,t){return t(e==="global"?"memory.global":"memory.project")}function jQe({refreshSignal:e=0,addSignal:t=0,addScope:n="workspace",onMessage:s}){var D,G;const{t:r}=ot(),{files:i,loading:o,error:a,readFile:l,reload:c,writeMemory:d}=$ce({autoLoad:!0}),h=m.useRef(null),f=m.useRef(0),[p,g]=m.useState("workspace"),[y,w]=m.useState("view"),[v,b]=m.useState(""),[x,k]=m.useState(""),[T,C]=m.useState(!1),[S,_]=m.useState(!1),[L,M]=m.useState(null),I=m.useRef(0),A=m.useMemo(()=>{const q=x$(i,"global"),N=x$(i,"workspace");return[{scope:"workspace",title:r("memory.project"),description:r("memory.project.desc"),fallbackPath:"QWEN.md",file:N},{scope:"global",title:r("memory.global"),description:r("memory.global.desc"),fallbackPath:"~/.qwen/QWEN.md",file:q}]},[i,r]),P=A.find(q=>q.scope===p)??A[0],B=m.useCallback((q,N)=>{const ee=++f.current;if(w(N),M(null),b(""),k(""),!(q!=null&&q.file)){N==="edit"&&requestAnimationFrame(()=>{var re;return(re=h.current)==null?void 0:re.focus()});return}C(!0),l(q.file.path).then(re=>{ee===f.current&&(b(re.content),k(re.content),re.truncated&&M(r("memory.fileTruncated")),requestAnimationFrame(()=>{var Q;return(Q=h.current)==null?void 0:Q.focus()}))}).catch(re=>{if(ee!==f.current)return;const Q=re instanceof Error?re.message:String(re);M(Q),q.scope!=="global"&&(s==null||s(Q,"error"))}).finally(()=>{ee===f.current&&C(!1)})},[s,l,r]);m.useEffect(()=>{P&&B(P,y)},[(D=P==null?void 0:P.file)==null?void 0:D.path,P==null?void 0:P.scope]),m.useEffect(()=>{a&&M(a.message)},[a]),m.useEffect(()=>{e<=0||c().then(()=>M(r("memory.refreshed"))).catch(q=>{const N=q instanceof Error?q.message:String(q);M(N),s==null||s(N,"error")})},[s,e,c,r]),m.useEffect(()=>{if(t<=0||I.current===t)return;I.current=t;const q=n==="global"?"global":"workspace";g(q);const N=A.find(ee=>ee.scope===q);B(N,"edit")},[n,t,A,B]);const F=q=>{g(q.scope),B(q,"view")},O=()=>{P&&B(P,"edit")},X=()=>{if(P){if(!x.trim()){M(r("memory.contentEmpty"));return}_(!0),M(null),d({scope:P.scope,mode:"replace",content:x}).then(q=>{const N=r("memory.saved",{scope:k$(P.scope,r),bytes:q.bytesWritten,path:q.filePath});b(x),w("view"),M(N),s==null||s(N,"status"),c().catch(()=>{})}).catch(q=>{const N=q instanceof Error?q.message:String(q);M(N),s==null||s(N,"error")}).finally(()=>_(!1))}},z=((G=P==null?void 0:P.file)==null?void 0:G.path)??(P==null?void 0:P.fallbackPath)??"",U=L??(o?r("memory.loading"):null);return u.jsxs("div",{className:Ki.page,children:[u.jsx("nav",{className:Ki.tabs,"aria-label":r("memory.menu"),children:A.map(q=>{const N=q.scope===p;return u.jsx("button",{type:"button",className:`${Ki.memoryCard} ${N?Ki.memoryCardActive:""}`,onClick:()=>F(q),children:u.jsx("span",{className:Ki.memoryTitle,children:q.title})},q.scope)})}),u.jsxs("section",{className:Ki.detail,children:[u.jsxs("header",{className:Ki.detailHeader,children:[u.jsx("div",{className:Ki.detailTitleWrap,children:u.jsx("div",{className:Ki.detailPath,children:z})}),u.jsx("div",{className:Ki.actions,children:u.jsx("button",{type:"button",className:Ki.actionButton,onClick:O,children:r("settings.action.edit")})})]}),U&&u.jsx("div",{className:Ki.status,children:U}),y==="edit"?u.jsxs(u.Fragment,{children:[u.jsx("textarea",{ref:h,className:Ki.editor,value:x,disabled:S||T,onChange:q=>k(q.target.value),placeholder:r("memory.placeholder",{scope:P?k$(P.scope,r):""})}),u.jsxs("div",{className:Ki.editorFooter,children:[u.jsx("button",{type:"button",className:Ki.secondaryButton,disabled:S,onClick:()=>{k(v),w("view")},children:r("common.cancel")}),u.jsx("button",{type:"button",className:Ki.primaryButton,disabled:S||T,onClick:X,children:r(S?"memory.saving":"memory.save")})]})]}):u.jsx("pre",{className:Ki.content,children:T?r("memory.loadingFile"):v||r("memory.noFiles")})]})]})}const LQe="_panel_cxp6w_1",DQe="_steps_cxp6w_10",OQe="_stepPill_cxp6w_18",PQe="_stepPillActive_cxp6w_29",BQe="_stepPillDone_cxp6w_34",$Qe="_stepNumber_cxp6w_38",zQe="_stepLabel_cxp6w_49",FQe="_body_cxp6w_55",qQe="_text_cxp6w_59",HQe="_muted_cxp6w_64",UQe="_options_cxp6w_68",VQe="_option_cxp6w_68",WQe="_optionActive_cxp6w_90",GQe="_label_cxp6w_94",KQe="_optionText_cxp6w_98",YQe="_description_cxp6w_112",XQe="_input_cxp6w_119",QQe="_preview_cxp6w_135",JQe="_error_cxp6w_146",ZQe="_link_cxp6w_150",eJe="_terms_cxp6w_161",tJe="_actions_cxp6w_169",nJe="_actionButton_cxp6w_177",js={panel:LQe,steps:DQe,stepPill:OQe,stepPillActive:PQe,stepPillDone:BQe,stepNumber:$Qe,stepLabel:zQe,body:FQe,text:qQe,muted:HQe,options:UQe,option:VQe,optionActive:WQe,label:GQe,optionText:KQe,description:YQe,input:XQe,preview:QQe,error:JQe,link:ZQe,terms:eJe,actions:tJe,actionButton:nJe};function sJe(e){return[{value:"openai",label:e("auth.protocol.openai"),description:e("auth.protocol.openaiDesc")},{value:"anthropic",label:e("auth.protocol.anthropic"),description:e("auth.protocol.anthropicDesc")},{value:"gemini",label:e("auth.protocol.gemini"),description:e("auth.protocol.geminiDesc")}]}function Jg(e){return e==="anthropic"?"https://api.anthropic.com/v1":e==="gemini"?"https://generativelanguage.googleapis.com":"https://api.openai.com/v1"}function _$(e){var t;return((t=e==null?void 0:e.models)==null?void 0:t.map(n=>n.id).join(", "))??""}function rJe(e,t,n){var s;return e==="protocol"?n("auth.step.protocol"):e==="baseUrl"?((s=t.uiLabels)==null?void 0:s.baseUrlStepTitle)??n("auth.step.baseUrl"):n(e==="apiKey"?"auth.step.apiKey":e==="models"?"auth.step.models":"auth.step.advanced")}function iJe(e,t){const n=e.trim();return n?n.length<=6?"***":`${n.slice(0,3)}...${n.slice(-4)}`:t?t("auth.notSet"):"(not set)"}function bC(e){return[...new Set(e.split(",").map(t=>t.trim()).filter(t=>t.length>0))]}function oJe({onMessage:e,onClose:t}){const{t:n}=ot(),s=$o(),[r,i]=m.useState("groups"),[o,a]=m.useState(0),[l,c]=m.useState(0),[d,h]=m.useState("providers"),[f,p]=m.useState(0),[g,y]=m.useState(),[w,v]=m.useState("alibaba"),[b,x]=m.useState(null),[k,T]=m.useState("openai"),[C,S]=m.useState(""),[_,L]=m.useState(""),[M,I]=m.useState(""),[A,P]=m.useState(!1),[B,F]=m.useState(!1),[O,X]=m.useState(!0),[z,U]=m.useState(!0),[D,G]=m.useState(!1),[q,N]=m.useState(!1),[ee,re]=m.useState(""),[Q,K]=m.useState(!0),[se,te]=m.useState(!1),[ce,oe]=m.useState(null);m.useEffect(()=>{s.getAuthProviders().then(Ie=>{y(Ie),K(!1)}).catch(Ie=>{oe(Ie instanceof Error?Ie.message:String(Ie)),K(!1)})},[s]);const de=m.useMemo(()=>(g==null?void 0:g.groups)??[],[g]),Te=m.useMemo(()=>{var lt;return(((lt=de.find(ne=>ne.id===w))==null?void 0:lt.providerIds)??[]).map(ne=>g==null?void 0:g.providers.find(he=>he.id===ne)).filter(ne=>!!ne)},[g,w,de]),qe=m.useMemo(()=>(b==null?void 0:b.steps)??[],[b==null?void 0:b.steps]),Ne=qe[f],ge=(b==null?void 0:b.showAdvancedConfig)===!0,Ee=m.useMemo(()=>B?["thinking","modality","image","video","audio","pdf","context"]:["thinking","modality","context"],[B]),_t=Ee.indexOf("context"),Ct=Ne==="apiKey"||Ne==="models"||Ne==="baseUrl"&&!Array.isArray(b==null?void 0:b.baseUrl),[Je,at]=m.useState(0),Oe=m.useCallback((Ie,lt="providers")=>{var he,Ve;x(Ie),h(lt);const ne=((he=Ie.protocolOptions)==null?void 0:he[0])??Ie.protocol;T(ne),typeof Ie.baseUrl=="string"?S(Ie.baseUrl):Array.isArray(Ie.baseUrl)?S(((Ve=Ie.baseUrl[0])==null?void 0:Ve.url)??""):S(Jg(ne)),L(""),I(_$(Ie)),P(!1),F(!1),X(!0),U(!0),G(!1),N(!1),re(""),p(0),at(0),oe(null),i(Ie.steps.length>0?"step":"review")},[]),Fe=m.useCallback(()=>{if(oe(null),r==="groups"){t();return}if(r==="providers"){i("groups");return}if(r==="review"){if(qe.length===0){i(d);return}i("step"),p(Math.max(0,qe.length-1));return}if(f>0){p(Ie=>Ie-1),at(0);return}i(d)},[t,d,f,qe.length,r]),ue=m.useCallback(()=>{if(!b||se)return;te(!0),oe(null);const Ie=Number(ee);s.installAuthProvider({providerId:b.id,protocol:k,baseUrl:C,apiKey:_,modelIds:bC(M),advancedConfig:A||B||Number.isFinite(Ie)&&Ie>0?{...A?{enableThinking:!0}:{},...B?{multimodal:{...O?{image:!0}:{},...z?{video:!0}:{},...D?{audio:!0}:{},...q?{pdf:!0}:{}}}:{},...Number.isFinite(Ie)&&Ie>0?{contextWindowSize:Ie}:{}}:void 0}).then(lt=>{e(lt.message),t()}).catch(lt=>{const ne=lt instanceof Error?lt.message:String(lt);oe(ne),e(ne,"error")}).finally(()=>te(!1))},[_,C,ee,B,D,O,q,z,M,t,e,k,b,se,A,s]),vt=m.useCallback(()=>{if(b){if(Ne==="baseUrl"){const Ie=C.trim()||Jg(k);if(!Ie){oe(n("auth.baseUrlRequired"));return}if(!/^https?:\/\//i.test(Ie)){oe(n("auth.baseUrlInvalid"));return}C.trim()||S(Ie)}if(Ne==="apiKey"&&_.trim().length===0){oe(n("auth.apiKeyRequired"));return}if(Ne==="models"&&bC(M).length===0){oe(n("auth.modelsRequired"));return}oe(null),f>=qe.length-1?ge?i("review"):ue():(p(Ie=>Ie+1),at(0))}},[_,C,Ne,M,k,b,ue,ge,f,qe.length,n]),ye=m.useCallback(Ie=>{switch(Ie){case"thinking":P(lt=>!lt);return;case"modality":F(lt=>!lt);return;case"image":X(lt=>!lt);return;case"video":U(lt=>!lt);return;case"audio":G(lt=>!lt);return;case"pdf":N(lt=>!lt);return;case"context":vt();return;default:return}},[vt]),je=m.useCallback(()=>{if(r==="groups"){const Ie=de[o];if(!Ie)return;if(Ie.id==="custom"){const lt=Ie.providerIds.map(ne=>g==null?void 0:g.providers.find(he=>he.id===ne)).find(ne=>!!ne);lt&&Oe(lt,"groups");return}v(Ie.id),c(0),i("providers");return}if(r==="providers"){const Ie=Te[l];Ie&&Oe(Ie,"providers");return}if(r==="review"){ue();return}if(!(!b||!Ne)){if(Ne==="protocol"){const Ie=(b.protocolOptions??[b.protocol])[Je];Ie&&(T(Ie),b.baseUrl||S(Jg(Ie))),vt();return}if(Ne==="baseUrl"&&Array.isArray(b.baseUrl)){const Ie=b.baseUrl[Je];Ie&&S(Ie.url),vt();return}if(Ne==="advancedConfig"){ye(Ee[Je]);return}vt()}},[Ne,g,vt,o,de,Je,b,l,Te,ue,Oe,r,ye,Ee]),Ye=m.useCallback(Ie=>{if(r==="groups"){const lt=de[Ie];if(!lt)return;if(lt.id==="custom"){const ne=lt.providerIds.map(he=>g==null?void 0:g.providers.find(Ve=>Ve.id===he)).find(he=>!!he);ne&&Oe(ne,"groups");return}v(lt.id),c(0),i("providers");return}if(r==="providers"){const lt=Te[Ie];lt&&Oe(lt,"providers");return}if(!b||!Ne){r==="review"&&ue();return}if(Ne==="protocol"){const lt=(b.protocolOptions??[b.protocol])[Ie];lt&&(T(lt),b.baseUrl||S(Jg(lt))),vt();return}if(Ne==="baseUrl"&&Array.isArray(b.baseUrl)){const lt=b.baseUrl[Ie];lt&&S(lt.url),vt();return}Ne==="advancedConfig"&&ye(Ee[Ie])},[Ne,g,vt,de,ye,Ee,b,Te,ue,Oe,r]),Nt=(Ie,lt,ne)=>u.jsx("div",{className:js.options,children:Ie.map((he,Ve)=>u.jsx("button",{type:"button",className:`${js.option} ${lt===Ve?js.optionActive:""}`,onClick:()=>{ne(Ve),Ye(Ve)},children:u.jsxs("div",{className:js.optionText,children:[u.jsx("div",{className:js.label,children:he.label}),he.description&&u.jsx("div",{className:js.description,children:he.description})]})},he.value))}),Rt=()=>{if(!b||!Ne)return null;if(Ne==="protocol"){const ne=b.protocolOptions??[b.protocol];return Nt(sJe(n).filter(he=>ne.includes(he.value)),Je,at)}if(Ne==="baseUrl")return Array.isArray(b.baseUrl)?Nt(b.baseUrl.map(ne=>({value:ne.url,label:ne.label,description:ne.url})),Je,at):u.jsxs(u.Fragment,{children:[u.jsx("div",{className:js.text,children:n("auth.baseUrlPrompt")}),u.jsx("input",{className:js.input,value:C,placeholder:Jg(k),onChange:ne=>{S(ne.target.value),oe(null)},onKeyDown:ne=>{ne.key==="Enter"&&(ne.preventDefault(),ne.stopPropagation(),vt())},autoFocus:!0}),b.documentationUrl&&u.jsx("a",{className:js.link,href:b.documentationUrl,target:"_blank",rel:"noreferrer",children:n("auth.documentation")})]});if(Ne==="apiKey")return u.jsxs(u.Fragment,{children:[b.documentationUrl&&u.jsxs("a",{className:js.link,href:b.documentationUrl,target:"_blank",rel:"noreferrer",children:[n("auth.documentation"),": ",b.documentationUrl]}),u.jsx("input",{className:js.input,type:"password",value:_,placeholder:b.apiKeyPlaceholder??n("auth.apiKeyPlaceholder"),onChange:ne=>{L(ne.target.value),oe(null)},onKeyDown:ne=>{ne.key==="Enter"&&(ne.preventDefault(),ne.stopPropagation(),vt())},autoFocus:!0})]});if(Ne==="models"){const ne=_$(b);return u.jsxs(u.Fragment,{children:[ne&&u.jsx("div",{className:js.muted,children:n("auth.modelsPrompt",{modelIds:ne})}),u.jsx("input",{className:js.input,value:M,placeholder:ne||n("auth.modelsPlaceholder"),onChange:he=>{I(he.target.value),oe(null)},onKeyDown:he=>{he.key==="Enter"&&(he.preventDefault(),he.stopPropagation(),vt())},autoFocus:!0})]})}const Ie=ne=>ne?"◉":"○",lt=[{value:"thinking",label:`${Ie(A)} ${n("auth.advanced.thinking")}`,description:n("auth.advanced.thinkingDesc")},{value:"modality",label:`${Ie(B)} ${n("auth.advanced.modality")}`,description:n("auth.advanced.modalityDesc")}];return B&&lt.push({value:"image",label:`${Ie(O)} ${n("auth.advanced.modalityImage")}`},{value:"video",label:`${Ie(z)} ${n("auth.advanced.modalityVideo")}`},{value:"audio",label:`${Ie(D)} ${n("auth.advanced.modalityAudio")}`},{value:"pdf",label:`${Ie(q)} ${n("auth.advanced.modalityPdf")}`}),lt.push({value:"context",label:`${n("auth.advanced.contextWindow")}: ${ee||"auto"}`,description:n("auth.advanced.contextDesc")}),u.jsxs(u.Fragment,{children:[u.jsx("div",{className:js.text,children:n("auth.advanced.prompt")}),Nt(lt,Je,at),u.jsx("input",{className:js.input,value:ee,placeholder:n("common.auto"),onChange:ne=>re(ne.target.value.replace(/[^0-9]/g,"")),onFocus:()=>at(_t),onKeyDown:ne=>{ne.key==="Enter"&&(ne.preventDefault(),ne.stopPropagation(),vt())}})]})},rn=m.useMemo(()=>{if(!b)return"";const Ie=b.envKey??`${k.toUpperCase()}_API_KEY`,lt=bC(M),ne={};if(A&&(ne.extra_body={enable_thinking:!0}),B){const we={};O&&(we.image=!0),z&&(we.video=!0),D&&(we.audio=!0),q&&(we.pdf=!0),Object.keys(we).length>0&&(ne.modalities=we)}const he=Number(ee);Number.isFinite(he)&&he>0&&(ne.contextWindowSize=he);const Ve=Object.keys(ne).length>0;return JSON.stringify({env:{[Ie]:iJe(_,n)},modelProviders:{[k]:lt.map(we=>({id:we,name:we,baseUrl:C.trim(),envKey:Ie,...Ve?{generationConfig:ne}:{}}))},security:{auth:{selectedType:k}},model:{name:lt[0]}},null,2)},[_,C,ee,B,D,O,q,z,M,k,b,n,A]),on=m.useMemo(()=>{const Ie=[n("auth.step.group"),n("auth.step.provider")];return b&&(Ie.push(...qe.map(lt=>rJe(lt,b,n))),ge&&Ie.push(n("auth.review"))),Ie},[b,ge,qe,n]),Bn=m.useMemo(()=>r==="groups"?1:r==="providers"?2:r==="step"?Math.min(3+f,on.length):on.length,[f,on.length,r]),bs=Q?u.jsx("div",{className:js.muted,children:n("common.loading")}):r==="groups"?u.jsxs(u.Fragment,{children:[Nt(de.map(Ie=>({value:Ie.id,label:n(Ie.label),description:n(Ie.description)})),o,a),u.jsxs("div",{className:js.terms,children:[u.jsxs("div",{children:[n("auth.termsTitle"),":"]}),u.jsx("a",{className:js.link,href:"https://qwenlm.github.io/qwen-code-docs/en/users/support/tos-privacy/",target:"_blank",rel:"noreferrer",children:"https://qwenlm.github.io/qwen-code-docs/en/users/support/tos-privacy/"})]})]}):r==="providers"?Nt(Te.map(Ie=>({value:Ie.id,label:n(Ie.label),description:n(Ie.description)})),l,c):r==="step"?Rt():u.jsxs(u.Fragment,{children:[u.jsx("div",{className:js.text,children:n("auth.reviewText")}),u.jsx("div",{className:js.preview,children:rn})]}),Ss=()=>{if(r==="review"){ue();return}if(Ct||Ne==="advancedConfig"){vt();return}je()};return u.jsxs("div",{className:js.panel,children:[u.jsx("div",{className:js.steps,children:on.map((Ie,lt)=>{const ne=lt+1;return u.jsxs("div",{className:`${js.stepPill} ${ne===Bn?js.stepPillActive:""} ${ne<Bn?js.stepPillDone:""}`,children:[u.jsx("span",{className:js.stepNumber,children:ne}),u.jsx("span",{className:js.stepLabel,children:Ie})]},`${ne}:${Ie}`)})}),u.jsx("div",{className:js.body,children:bs}),ce&&u.jsx("div",{className:js.error,children:ce}),u.jsxs("div",{className:js.actions,children:[u.jsx("button",{type:"button",className:js.actionButton,onClick:Fe,disabled:r==="groups"||Q||se,children:n("common.previous")}),u.jsx("button",{type:"button",className:js.actionButton,onClick:Ss,disabled:Q||se,children:n(r==="review"?se?"auth.saving":"auth.save":"common.next")})]})]})}function aJe(e){return e.displayName||e.name}const bte="tools-list",S$=e=>`${bte}-opt-${e}`;function lJe(){const{t:e}=ot(),{status:t,tools:n,loading:s,error:r}=yU({autoLoad:!0}),[i,o]=m.useState(0),[a,l]=m.useState(null),[c,d]=m.useState(()=>new Set),h=m.useRef(null);m.useEffect(()=>{var y,w;r?l(r.message):(w=(y=t==null?void 0:t.errors)==null?void 0:y[0])!=null&&w.error?l(t.errors[0].error):t&&l(null)},[t,r]);const f=m.useCallback(y=>{d(w=>w.has(y.name)?new Set:new Set([y.name]))},[]);m.useEffect(()=>{i>=n.length&&n.length>0&&o(n.length-1)},[i,n.length]),m.useEffect(()=>{var w;const y=(w=h.current)==null?void 0:w.children[i];y==null||y.scrollIntoView({block:"nearest"})},[i]);const{keyboardMode:p}=Vh({itemCount:n.length,activeIndex:i,onActiveIndexChange:o,onConfirm:y=>{const w=n[y];w!=null&&w.description&&f(w)}}),g=m.useMemo(()=>{if(!t)return"";const y=n.filter(w=>w.enabled).length;return e("tools.summary",{enabled:y,total:n.length})},[t,n,e]);return u.jsxs("div",{className:st("picker","picker-in-shell"),children:[g&&u.jsx("div",{className:st("picker-search"),children:u.jsx("span",{className:st("picker-search-hint"),children:g})}),(a||s)&&u.jsx("div",{className:st("picker-search"),children:u.jsx("span",{className:st("picker-search-hint"),children:a||e("tools.loading")})}),u.jsx("div",{className:st("picker-sep")}),u.jsxs("div",{id:bte,role:"listbox","aria-label":e("tools.title"),tabIndex:0,"aria-activedescendant":n.length>0?S$(i):void 0,className:st("picker-list",p?"picker-keyboard-only":void 0),ref:h,children:[!s&&n.length===0&&u.jsx("div",{className:st("picker-empty"),children:e("tools.empty")}),n.map((y,w)=>{const v=c.has(y.name),b=y.description??"";return u.jsxs("div",{id:S$(w),role:"option","aria-selected":!1,"aria-expanded":b?v:void 0,className:st("picker-item","picker-session-item","tools-picker-item",w===i?"selected":void 0,v?"tools-picker-item-expanded":void 0),onClick:()=>{o(w),y.description&&f(y)},onMouseMove:()=>o(w),children:[u.jsxs("div",{className:st("picker-item-row"),children:[u.jsx("span",{className:st("tools-item-icon"),"aria-hidden":"true"}),u.jsx("span",{className:st("picker-item-title"),children:aJe(y)}),u.jsx("span",{className:st("tools-status-badge",y.enabled?"tools-status-badge-enabled":"tools-status-badge-disabled"),children:y.enabled?e("tools.status.enabled"):e("tools.status.disabled")}),b?u.jsx("svg",{className:st("tools-item-chevron",v?"tools-item-chevron-expanded":void 0),viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}):null]}),v&&b&&u.jsx("div",{className:st("tools-desc-expanded"),children:u.jsx("div",{className:st("tools-desc-body"),children:b})})]},y.name)})]})]})}const cJe="_chart_1xbk4_1",uJe="_plot_1xbk4_8",dJe="_svg_1xbk4_13",hJe="_cursor_1xbk4_30",fJe="_tooltip_1xbk4_40",mJe="_tooltipBelow_1xbk4_62",pJe="_tooltipTime_1xbk4_67",gJe="_tooltipRow_1xbk4_73",yJe="_tooltipLabel_1xbk4_79",bJe="_tooltipValue_1xbk4_83",vJe="_axis_1xbk4_91",wJe="_legend_1xbk4_96",xJe="_legendItem_1xbk4_105",kJe="_swatch_1xbk4_112",_Je="_legendLabel_1xbk4_118",SJe="_legendValue_1xbk4_123",CJe="_peak_1xbk4_131",ji={chart:cJe,plot:uJe,svg:dJe,cursor:hJe,tooltip:fJe,tooltipBelow:mJe,tooltipTime:pJe,tooltipRow:gJe,tooltipLabel:yJe,tooltipValue:bJe,axis:vJe,legend:wJe,legendItem:xJe,swatch:kJe,legendLabel:_Je,legendValue:SJe,peak:CJe},m7=320,w1=64,Ko=3,qw=m7-Ko*2,Hw=w1-Ko*2;function C$(e,t){return Number.isFinite(e)?e:t}const TJe=84;function EJe(e){let t=e.parentElement;for(;t;){const n=getComputedStyle(t).overflowY;if(n==="auto"||n==="scroll")return t;t=t.parentElement}return null}function AJe(e){return new Date(e).toLocaleTimeString()}function vte({series:e,timestamps:t,format:n=a=>String(Math.round(a)),formatTime:s=AJe,zeroBased:r=!0,ariaLabel:i,peakLabel:o="peak"}){const a=m.useRef(null),[l,c]=m.useState(null),[d,h]=m.useState(!1),f=m.useRef(void 0),{paths:p,maxV:g,maxLen:y,min:w,span:v}=m.useMemo(()=>{const M=e.reduce((X,z)=>Math.max(X,z.values.length),0);let I=0,A=r?0:Number.POSITIVE_INFINITY;for(const X of e)for(const z of X.values)Number.isFinite(z)&&(z>I&&(I=z),z<A&&(A=z));Number.isFinite(A)||(A=0);const P=I-A||1,B=X=>M<=1?Ko+qw/2:Ko+X/(M-1)*qw,F=X=>Ko+Hw-(C$(X,A)-A)/P*Hw;return{paths:e.map(X=>{const z=X.values.map((G,q)=>`${q===0?"M":"L"}${B(q).toFixed(1)},${F(G).toFixed(1)}`).join(" "),U=X.values.length-1,D=U>=0?{cx:B(U),cy:F(X.values[U]),color:X.color}:void 0;return{key:X.label,d:z,color:X.color,dot:D}}),maxV:I,maxLen:M,min:A,span:P}},[e,r]),b=y>0,x=M=>y<=1?Ko+qw/2:Ko+M/(y-1)*qw,k=M=>Ko+Hw-(C$(M,w)-w)/v*Hw,T=M=>{const I=a.current;if(!I||y===0)return;const A=I.getBoundingClientRect();if(A.width===0)return;const P=(M.clientX-A.left)/A.width,B=Math.max(0,Math.min(y-1,Math.round(P*(y-1))));c(B),f.current===void 0&&(f.current=EJe(I));const F=f.current,O=F?F.getBoundingClientRect().top:0;h(A.top-O<TJe)},C=()=>c(null),S=l!=null&&l>=0&&l<y?l:null,_=S!=null?x(S):0,L=S!=null&&y>1?S/(y-1)*100:50;return u.jsxs("div",{className:ji.chart,children:[u.jsxs("div",{className:ji.plot,children:[u.jsxs("svg",{ref:a,viewBox:`0 0 ${m7} ${w1}`,preserveAspectRatio:"none",role:"img","aria-label":i,className:ji.svg,onPointerMove:T,onPointerLeave:C,children:[u.jsx("line",{x1:Ko,y1:w1-Ko,x2:m7-Ko,y2:w1-Ko,className:ji.axis,vectorEffect:"non-scaling-stroke"}),p.map(M=>u.jsx("path",{d:M.d,fill:"none",stroke:M.color,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round",vectorEffect:"non-scaling-stroke"},M.key)),S!=null&&u.jsxs(u.Fragment,{children:[u.jsx("line",{x1:_,y1:Ko,x2:_,y2:w1-Ko,className:ji.cursor,vectorEffect:"non-scaling-stroke"}),e.map(M=>S<M.values.length?u.jsx("circle",{cx:_,cy:k(M.values[S]),r:2.5,fill:M.color,vectorEffect:"non-scaling-stroke"},`${M.label}-hover`):null)]}),S==null&&p.map(M=>M.dot?u.jsx("circle",{cx:M.dot.cx,cy:M.dot.cy,r:2,fill:M.dot.color,vectorEffect:"non-scaling-stroke"},`${M.key}-dot`):null)]}),S!=null&&u.jsxs("div",{className:`${ji.tooltip} ${d?ji.tooltipBelow:""}`,style:{left:`${L}%`},role:"tooltip",children:[t&&t[S]!=null&&u.jsx("div",{className:ji.tooltipTime,children:s(t[S])}),e.map(M=>S<M.values.length?u.jsxs("div",{className:ji.tooltipRow,children:[u.jsx("svg",{className:ji.swatch,viewBox:"0 0 8 8","aria-hidden":"true",children:u.jsx("rect",{width:"8",height:"8",rx:"1.5",fill:M.color})}),u.jsx("span",{className:ji.tooltipLabel,children:M.label}),u.jsx("span",{className:ji.tooltipValue,children:n(M.values[S])})]},M.label):null)]})]}),u.jsxs("div",{className:ji.legend,children:[e.map(M=>{const I=M.values.length?M.values[M.values.length-1]:void 0;return u.jsxs("span",{className:ji.legendItem,children:[u.jsx("svg",{className:ji.swatch,viewBox:"0 0 8 8","aria-hidden":"true",children:u.jsx("rect",{width:"8",height:"8",rx:"1.5",fill:M.color})}),u.jsx("span",{className:ji.legendLabel,children:M.label}),I!==void 0&&u.jsx("span",{className:ji.legendValue,children:n(I)})]},M.label)}),b&&u.jsx("span",{className:ji.peak,children:`${o} ${n(g)}`})]})]})}const MJe="_wrap_1icv6_1",NJe="_tooltip_1icv6_11",IJe="_legend_1icv6_27",RJe="_legendLabel_1icv6_35",jJe="_scroll_1icv6_39",LJe="_grid_1icv6_44",DJe="_month_1icv6_51",OJe="_weekday_1icv6_59",PJe="_cell_1icv6_69",BJe="_legendCell_1icv6_75",$Je="_lvl0_1icv6_82",zJe="_lvl1_1icv6_85",FJe="_lvl2_1icv6_88",qJe="_lvl3_1icv6_91",HJe="_lvl4_1icv6_94",UJe="_today_1icv6_98",Co={wrap:MJe,tooltip:NJe,legend:IJe,legendLabel:RJe,scroll:jJe,grid:LJe,month:DJe,weekday:OJe,cell:PJe,legendCell:BJe,lvl0:$Je,lvl1:zJe,lvl2:FJe,lvl3:qJe,lvl4:HJe,today:UJe},vC=864e5,VJe=4;function wC(e){const t=new Date(e);return t.setHours(0,0,0,0),t}function T$(e){const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),s=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${s}`}function WJe(e){const t=e.filter(s=>s>0).sort((s,r)=>s-r);if(t.length===0)return[0,0,0];const n=s=>t[Math.min(t.length-1,Math.floor(s*(t.length-1)))];return[n(.25),n(.5),n(.75)]}function GJe(e,[t,n,s]){return e<=0?0:e<=t?1:e<=n?2:e<=s?3:VJe}function KJe(e,t,n){const s=Math.max(1,Math.floor(t)),r=wC(Date.now()),i=wC(r.getTime()-(s-1)*vC),o=(i.getDay()+6)%7,a=wC(i.getTime()-o*vC),l=Math.round((r.getTime()-a.getTime())/vC)+1,c=[],d=[],h=T$(r),f=new Date(a.getTime());for(let x=0;x<l;x++){const k=T$(f),T=e[k],C=(T==null?void 0:T.tokens)??0;d.push(C),c.push({dateKey:k,tokens:C,cacheReadRate:(T==null?void 0:T.cacheReadRate)??0,isToday:k===h,weekday:x%7,week:Math.floor(x/7)}),f.setDate(f.getDate()+1)}const p=WJe(d),g=c.map(x=>({...x,level:GJe(x.tokens,p)})),y=Math.ceil(l/7),w=[];let v=-1;const b=new Date(a.getTime());for(let x=0;x<y;x++){const k=b.getMonth();k!==v&&(w.push({week:x,text:b.toLocaleDateString(n,{month:"short"})}),v=k),b.setDate(b.getDate()+7)}return{cells:g,months:w,weeks:y}}function YJe({heatmap:e,days:t}){const{t:n,language:s}=ot(),r=m.useMemo(()=>KJe(e,t,s),[e,t,s]),i=m.useRef(null),[o,a]=m.useState(null),l={0:n("daemon.usage.dowMon"),2:n("daemon.usage.dowWed"),4:n("daemon.usage.dowFri")},c=d=>{const h=d.target.closest("[data-date]"),f=i.current;if(!h||!f)return;const p=h.dataset.date??"",g=Number(h.dataset.tokens??"0"),y=Number(h.dataset.cache??"0"),w=h.getBoundingClientRect(),v=f.getBoundingClientRect();a({left:w.left-v.left+w.width/2,top:w.top-v.top,text:n("daemon.usage.cellTokens",{date:p,tokens:Op(g),cache:Math.round(y*100)})})};return u.jsxs("div",{className:Co.wrap,ref:i,children:[u.jsxs("div",{className:Co.legend,children:[u.jsx("span",{className:Co.legendLabel,children:n("daemon.usage.low")}),[0,1,2,3,4].map(d=>u.jsx("span",{className:`${Co.cell} ${Co.legendCell} ${Co[`lvl${d}`]}`},d)),u.jsx("span",{className:Co.legendLabel,children:n("daemon.usage.high")})]}),u.jsx("div",{className:Co.scroll,onMouseOver:c,onMouseLeave:()=>a(null),children:u.jsxs("div",{className:Co.grid,role:"img","aria-label":n("daemon.usage.heatmapTitle"),style:{gridTemplateColumns:`auto repeat(${r.weeks}, var(--hm-cell))`},children:[r.months.map(d=>u.jsx("div",{className:Co.month,style:{gridColumn:d.week+2,gridRow:1},children:d.text},`m-${d.week}`)),[0,2,4].map(d=>u.jsx("div",{className:Co.weekday,style:{gridColumn:1,gridRow:d+2},children:l[d]},`wd-${d}`)),r.cells.map(d=>u.jsx("div",{className:`${Co.cell} ${Co[`lvl${d.level}`]} ${d.isToday?Co.today:""}`,style:{gridColumn:d.week+2,gridRow:d.weekday+2},"data-date":d.dateKey,"data-tokens":d.tokens,"data-cache":d.cacheReadRate},d.dateKey))]})}),o&&u.jsx("div",{className:Co.tooltip,style:{left:o.left,top:o.top},role:"status",children:o.text})]})}const XJe="_usage_1kfmt_1",QJe="_toolbar_1kfmt_9",JJe="_segmented_1kfmt_14",ZJe="_segment_1kfmt_14",eZe="_segmentActive_1kfmt_41",tZe="_hero_1kfmt_48",nZe="_heroMain_1kfmt_59",sZe="_heroLabel_1kfmt_63",rZe="_heroNumber_1kfmt_71",iZe="_heroSub_1kfmt_82",oZe="_refresh_1kfmt_87",aZe="_stats_1kfmt_109",lZe="_stat_1kfmt_109",cZe="_statValue_1kfmt_121",uZe="_statLabel_1kfmt_130",dZe="_section_1kfmt_139",hZe="_sectionTitle_1kfmt_145",fZe="_sectionSub_1kfmt_154",mZe="_breakdown_1kfmt_161",pZe="_metric_1kfmt_167",gZe="_metricHead_1kfmt_173",yZe="_tick_1kfmt_179",bZe="_tick_input_1kfmt_186",vZe="_tick_output_1kfmt_190",wZe="_tick_cache_1kfmt_198",xZe="_metricLabel_1kfmt_202",kZe="_metricValue_1kfmt_209",_Ze="_metricHint_1kfmt_219",SZe="_state_1kfmt_225",CZe="_modelList_1kfmt_233",TZe="_modelRow_1kfmt_239",EZe="_modelHead_1kfmt_245",AZe="_modelRank_1kfmt_251",MZe="_modelMeta_1kfmt_262",NZe="_modelName_1kfmt_267",IZe="_modelSub_1kfmt_277",RZe="_modelShare_1kfmt_282",jZe="_modelTrack_1kfmt_289",LZe="_modelFill_1kfmt_296",DZe="_modelFillCache_1kfmt_303",OZe="_skillTable_1kfmt_310",PZe="_right_1kfmt_334",BZe="_bars_1kfmt_339",$Ze="_barsBody_1kfmt_345",zZe="_barCol_1kfmt_352",FZe="_bar_1kfmt_339",qZe="_barsCaption_1kfmt_371",tn={usage:XJe,toolbar:QJe,segmented:JJe,segment:ZJe,segmentActive:eZe,hero:tZe,heroMain:nZe,heroLabel:sZe,heroNumber:rZe,heroSub:iZe,refresh:oZe,stats:aZe,stat:lZe,statValue:cZe,statLabel:uZe,section:dZe,sectionTitle:hZe,sectionSub:fZe,breakdown:mZe,metric:pZe,metricHead:gZe,tick:yZe,tick_input:bZe,tick_output:vZe,tick_cache:wZe,metricLabel:xZe,metricValue:kZe,metricHint:_Ze,state:SZe,modelList:CZe,modelRow:TZe,modelHead:EZe,modelRank:AZe,modelMeta:MZe,modelName:NZe,modelSub:IZe,modelShare:RZe,modelTrack:jZe,modelFill:LZe,modelFillCache:DZe,skillTable:OZe,right:PZe,bars:BZe,barsBody:$Ze,barCol:zZe,bar:FZe,barsCaption:qZe},wte=12,HZe=Math.round(wte*30.44),UZe=["today","week","month"],VZe={today:"daemon.usage.today",week:"daemon.usage.period7d",month:"daemon.usage.period30d"},WZe={today:"daemon.usage.today",week:"daemon.usage.rangeWeek",month:"daemon.usage.rangeMonth"},GZe={today:"daemon.usage.rangeWordToday",week:"daemon.usage.rangeWordWeek",month:"daemon.usage.rangeWordMonth"},E$=["#3b82f6","#14b8a6","#f59e0b","#ef4444","#8b5cf6","#22c55e","#06b6d4","#ec4899"];function KZe(e){return new Date(`${e}T00:00:00`).getTime()}function xC(e,t){return new Date(`${e}T00:00:00`).toLocaleDateString(t,{month:"short",day:"numeric"})}function YZe(e,t){return new Date(e).toLocaleDateString(t,{month:"short",day:"numeric"})}function Uw({label:e,value:t}){return u.jsxs("div",{className:tn.stat,children:[u.jsx("div",{className:tn.statValue,children:t.toLocaleString()}),u.jsx("div",{className:tn.statLabel,children:e})]})}function kC({accent:e,value:t,label:n,hint:s}){return u.jsxs("div",{className:tn.metric,children:[u.jsxs("div",{className:tn.metricHead,children:[u.jsx("span",{className:`${tn.tick} ${tn[`tick_${e}`]}`}),u.jsx("span",{className:tn.metricLabel,children:n})]}),u.jsx("div",{className:tn.metricValue,children:t}),u.jsx("div",{className:tn.metricHint,children:s})]})}function XZe({rank:e,model:t,color:n}){const{t:s}=ot(),r=Math.max(0,Math.min(100,t.share*100)),i=Math.max(0,Math.min(100,t.cacheReadRate*100));return u.jsxs("div",{className:tn.modelRow,children:[u.jsxs("div",{className:tn.modelHead,children:[u.jsx("span",{className:tn.modelRank,style:{color:n},children:String(e).padStart(2,"0")}),u.jsxs("div",{className:tn.modelMeta,children:[u.jsx("div",{className:tn.modelName,children:t.model}),u.jsx("div",{className:tn.modelSub,children:s("daemon.usage.modelMeta",{tokens:Op(t.totalTokens),cache:Math.round(i)})})]}),u.jsxs("span",{className:tn.modelShare,style:{color:n},children:[Math.round(r),"%"]})]}),u.jsx("div",{className:tn.modelTrack,children:u.jsx("div",{className:tn.modelFill,style:{width:`${r}%`,background:n},children:u.jsx("div",{className:tn.modelFillCache,style:{width:`${i}%`}})})})]})}function QZe({points:e,format:t,locale:n}){const s=Math.max(1,...e.map(r=>r.value));return u.jsxs("div",{className:tn.bars,children:[u.jsx("div",{className:tn.barsBody,children:e.map((r,i)=>u.jsx("div",{className:tn.barCol,title:`${xC(r.label,n)} · ${t(r.value)}`,children:u.jsx("div",{className:tn.bar,style:{height:`${r.value/s*100}%`}})},`${r.label}-${i}`))}),e.length>1&&u.jsxs("div",{className:tn.barsCaption,children:[u.jsx("span",{children:xC(e[0].label,n)}),u.jsx("span",{children:xC(e[e.length-1].label,n)})]})]})}function JZe(){const{t:e,language:t}=ot(),[n,s]=m.useState("today"),{dashboard:r,loading:i,error:o,reload:a}=zce({range:n,heatmapDays:HZe,autoLoad:!0}),l=u.jsx("div",{className:tn.segmented,role:"group","aria-label":e("daemon.usage.rangeGroup"),children:UZe.map(b=>u.jsx("button",{type:"button",className:`${tn.segment} ${b===n?tn.segmentActive:""}`,"aria-pressed":b===n,onClick:()=>s(b),children:e(VZe[b])},b))});if(!r)return u.jsxs("div",{className:tn.usage,children:[u.jsx("div",{className:tn.toolbar,children:l}),i?u.jsx("div",{className:tn.state,children:e("daemon.usage.loading")}):o?u.jsxs("div",{className:tn.state,children:[e("daemon.usage.failed"),": ",o.message]}):u.jsx("div",{className:tn.state,children:e("daemon.usage.empty")})]});const{summary:c,models:d,skills:h,daily:f,heatmap:p,heatmapDays:g}=r,y=c.linesAdded+c.linesRemoved,w=c.totalTokens>0||Object.keys(p).length>0,v=e(GZe[r.range]);return u.jsxs("div",{className:tn.usage,"aria-busy":i,children:[u.jsx("div",{className:tn.toolbar,children:l}),u.jsxs("header",{className:tn.hero,children:[u.jsxs("div",{className:tn.heroMain,children:[u.jsx("div",{className:tn.heroLabel,children:e(WZe[r.range])}),u.jsx("div",{className:tn.heroNumber,children:Op(c.totalTokens)}),u.jsx("div",{className:tn.heroSub,children:e("daemon.usage.tokensConsumed")})]}),u.jsx("button",{type:"button",className:tn.refresh,onClick:()=>void a(),disabled:i,children:e("daemon.refresh")})]}),u.jsxs("div",{className:tn.stats,children:[u.jsx(Uw,{label:e("daemon.usage.sessions"),value:c.sessions}),u.jsx(Uw,{label:e("daemon.usage.requests"),value:c.requests}),u.jsx(Uw,{label:e("daemon.usage.tools"),value:c.toolCalls}),u.jsx(Uw,{label:e("daemon.usage.changes"),value:y})]}),u.jsxs("section",{className:tn.section,children:[u.jsx("h4",{className:tn.sectionTitle,children:e("daemon.usage.breakdownTitle")}),u.jsxs("div",{className:tn.breakdown,children:[u.jsx(kC,{accent:"input",value:Op(c.inputTokens),label:e("daemon.usage.inputTokens"),hint:e("daemon.usage.inputHint")}),u.jsx(kC,{accent:"output",value:Op(c.outputTokens+c.thoughtsTokens),label:e("daemon.usage.outputTokens"),hint:e("daemon.usage.outputHint")}),u.jsx(kC,{accent:"cache",value:`${Math.round(c.cacheReadRate*100)}%`,label:e("daemon.usage.cacheRead"),hint:e("daemon.usage.cacheHint")})]})]}),u.jsxs("section",{className:tn.section,children:[u.jsx("h4",{className:tn.sectionTitle,children:e("daemon.usage.heatmapTitle")}),u.jsx("div",{className:tn.sectionSub,children:e("daemon.usage.heatmapSub",{months:wte})}),w?u.jsx(YJe,{heatmap:p,days:g}):u.jsx("div",{className:tn.state,children:e("daemon.usage.empty")})]}),d.length>0&&u.jsxs("section",{className:tn.section,children:[u.jsxs("h4",{className:tn.sectionTitle,children:[v," ",e("daemon.usage.modelShareTitle")]}),u.jsx("div",{className:tn.sectionSub,children:e("daemon.usage.modelShareSub")}),u.jsx("div",{className:tn.modelList,children:d.map((b,x)=>u.jsx(XZe,{rank:x+1,model:b,color:E$[x%E$.length]},b.model))})]}),h.length>0&&u.jsxs("section",{className:tn.section,children:[u.jsxs("h4",{className:tn.sectionTitle,children:[v," ",e("daemon.usage.skillTitle")]}),u.jsx("div",{className:tn.sectionSub,children:e("daemon.usage.skillSub")}),u.jsxs("table",{className:tn.skillTable,children:[u.jsx("thead",{children:u.jsxs("tr",{children:[u.jsx("th",{children:e("daemon.usage.skillName")}),u.jsx("th",{className:tn.right,children:e("daemon.usage.skillCount")})]})}),u.jsx("tbody",{children:h.map(b=>u.jsxs("tr",{children:[u.jsx("td",{children:b.name}),u.jsx("td",{className:tn.right,children:b.count.toLocaleString()})]},b.name))})]})]}),f.length>1&&u.jsxs("section",{className:tn.section,children:[u.jsxs("h4",{className:tn.sectionTitle,children:[v," ",e("daemon.usage.dailyTokensTitle")]}),u.jsx("div",{className:tn.sectionSub,children:e("daemon.usage.dailyTokensSub")}),u.jsx(vte,{series:[{label:e("daemon.usage.tokensConsumed"),values:f.map(b=>b.tokens),color:"var(--agent-blue-400)"}],timestamps:f.map(b=>KZe(b.date)),format:Op,formatTime:b=>YZe(b,t),ariaLabel:e("daemon.usage.dailyTokensTitle"),peakLabel:e("daemon.charts.peak")})]}),f.length>1&&u.jsxs("section",{className:tn.section,children:[u.jsxs("h4",{className:tn.sectionTitle,children:[v," ",e("daemon.usage.dailySessionsTitle")]}),u.jsx("div",{className:tn.sectionSub,children:e("daemon.usage.dailySessionsSub")}),u.jsx(QZe,{points:f.map(b=>({label:b.date,value:b.sessions})),format:b=>b.toLocaleString(),locale:t})]})]})}const ZZe="_dialog_lw868_4",eet="_toolbar_lw868_12",tet="_toolbarActions_lw868_19",net="_updatedAt_lw868_26",set="_refreshError_lw868_31",ret="_refreshButton_lw868_36",iet="_badge_lw868_51",oet="_levelOk_lw868_61",aet="_levelWarning_lw868_66",cet="_levelError_lw868_71",uet="_levelUnavailable_lw868_76",det="_tabs_lw868_81",het="_tab_lw868_81",fet="_tabActive_lw868_106",met="_grid_lw868_114",pet="_chartsGrid_lw868_113",get="_card_lw868_128",yet="_cardTitle_lw868_135",bet="_cardHeader_lw868_147",vet="_infoHint_lw868_162",wet="_infoHintButton_lw868_168",xet="_infoHintTip_lw868_197",ket="_row_lw868_231",_et="_rowLabel_lw868_240",Cet="_rowValue_lw868_244",Tet="_pathRow_lw868_253",Eet="_pathValue_lw868_247",Aet="_empty_lw868_274",Met="_issueRow_lw868_279",Net="_issueMessage_lw868_286",Iet="_featureChips_lw868_290",Ret="_featureChip_lw868_290",jet="_summaryChip_lw868_311",Let="_sessionRow_lw868_320",Det="_sessionName_lw868_329",Oet="_sessionMeta_lw868_335",Pet="_activePrompt_lw868_344",Bet="_workspaceRow_lw868_348",$et="_workspaceRowHead_lw868_357",zet="_workspaceName_lw868_363",Fet="_workspaceDuration_lw868_367",qet="_workspaceError_lw868_374",Het="_workspaceSummary_lw868_381",Uet="_workspaceCell_lw868_388",Vet="_workspaceCellLabel_lw868_397",Wet="_workspaceCellMessage_lw868_402",Wt={dialog:ZZe,toolbar:eet,toolbarActions:tet,updatedAt:net,refreshError:set,refreshButton:ret,badge:iet,levelOk:oet,levelWarning:aet,levelError:cet,levelUnavailable:uet,tabs:det,tab:het,tabActive:fet,grid:met,chartsGrid:pet,card:get,cardTitle:yet,cardHeader:bet,infoHint:vet,infoHintButton:wet,infoHintTip:xet,row:ket,rowLabel:_et,rowValue:Cet,pathRow:Tet,pathValue:Eet,empty:Aet,issueRow:Met,issueMessage:Net,featureChips:Iet,featureChip:Ret,summaryChip:jet,sessionRow:Let,sessionName:Det,sessionMeta:Oet,activePrompt:Pet,workspaceRow:Bet,workspaceRowHead:$et,workspaceName:zet,workspaceDuration:Fet,workspaceError:qet,workspaceSummary:Het,workspaceCell:Uet,workspaceCellLabel:Vet,workspaceCellMessage:Wet},Get=5e3,ep=[{id:"overview",labelKey:"daemon.tab.overview"},{id:"usage",labelKey:"daemon.tab.usage"},{id:"metrics",labelKey:"daemon.tab.metrics"},{id:"diagnostics",labelKey:"daemon.tab.diagnostics"}];function xte(e){const t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/86400),s=Math.floor(t%86400/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}d ${s}h ${r}m`:s>0?`${s}h ${r}m ${i}s`:r>0?`${r}m ${i}s`:`${i}s`}function Qd(e){return e=Math.max(0,e),e>=6e4?xte(e):e>=1e3?`${(e/1e3).toFixed(e%1e3===0?0:1)}s`:`${e}ms`}function H2(e){const t=e/1024;if(t<1)return`${Math.round(e)} B`;const n=t/1024;return n<1?`${t.toFixed(t<10?1:0)} KB`:n>=1024?`${(n/1024).toFixed(2)} GB`:`${n.toFixed(1)} MB`}function Zg(e){const t=Math.round(e);return t>=1e4?`${(t/1e3).toFixed(t%1e3===0?0:1)}k`:t.toLocaleString()}function Ket(e){return`${e.toFixed(e>=100||e===0?0:1)}%`}function Yet(e){return e.exitCode!=null?`${e.state} (exit ${e.exitCode})`:e.signal?`${e.state} (${e.signal})`:e.state}function A$(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Xet=["cells","servers","errors","skills","tools","providers","hooks","extensions","budgets"];function Qet(e){if(!A$(e))return[];const t=[];for(const n of Xet){const s=e[n];if(Array.isArray(s))for(const r of s){if(!A$(r))continue;const i=r.status;if(i!=="warning"&&i!=="error")continue;const o=String(r.kind??r.name??r.serverName??n),a=typeof r.error=="string"?r.error:typeof r.hint=="string"?r.hint:void 0;t.push({label:o,status:i,message:a})}}return t}function p7(e){switch(e){case"ok":return Wt.levelOk;case"warning":return Wt.levelWarning;case"error":return Wt.levelError;default:return Wt.levelUnavailable}}function Ls({label:e,value:t}){return u.jsxs("div",{className:Wt.row,children:[u.jsx("span",{className:Wt.rowLabel,children:e}),u.jsx("span",{className:Wt.rowValue,children:t})]})}function Jet({text:e}){return u.jsxs("span",{className:Wt.infoHint,children:[u.jsx("button",{type:"button",className:Wt.infoHintButton,"aria-label":e,children:u.jsx("span",{"aria-hidden":"true",children:"ⓘ"})}),u.jsx("span",{"aria-hidden":"true",className:Wt.infoHintTip,children:e})]})}function nl({title:e,help:t,children:n}){return u.jsxs("section",{className:Wt.card,children:[t?u.jsxs("div",{className:Wt.cardHeader,children:[u.jsx("h3",{className:Wt.cardTitle,children:e}),u.jsx(Jet,{text:t})]}):u.jsx("h3",{className:Wt.cardTitle,children:e}),n]})}function Zet({name:e,section:t}){const{t:n}=ot(),s=Object.entries(t.summary??{}),r=Qet(t.data);return u.jsxs("div",{className:Wt.workspaceRow,children:[u.jsxs("div",{className:Wt.workspaceRowHead,children:[u.jsx("span",{className:`${Wt.badge} ${p7(t.status)}`,children:n(`daemon.level.${t.status}`)}),u.jsx("span",{className:Wt.workspaceName,children:e}),u.jsx("span",{className:Wt.workspaceDuration,children:Qd(t.durationMs)})]}),t.error&&u.jsx("div",{className:Wt.workspaceError,children:t.error.message}),r.map((i,o)=>u.jsxs("div",{className:Wt.workspaceCell,children:[u.jsx("span",{className:`${Wt.badge} ${p7(i.status)}`,children:n(`daemon.level.${i.status}`)}),u.jsx("span",{className:Wt.workspaceCellLabel,children:i.label}),i.message&&u.jsx("span",{className:Wt.workspaceCellMessage,children:i.message})]},`${i.label}-${o}`)),s.length>0&&u.jsx("div",{className:Wt.workspaceSummary,children:s.map(([i,o])=>u.jsxs("span",{className:Wt.summaryChip,children:[i,": ",o===null?n("common.na"):String(o)]},i))})]})}function ett({report:e}){const{t}=ot(),n=e.full;if(!n)return null;const s=Object.entries(n.workspace).sort(([r],[i])=>r.localeCompare(i));return u.jsxs(u.Fragment,{children:[u.jsx(nl,{title:t("daemon.full.sessions.title"),children:n.sessions.length===0?u.jsx("div",{className:Wt.empty,children:t("daemon.full.sessions.empty")}):n.sessions.map(r=>u.jsxs("div",{className:Wt.sessionRow,children:[u.jsx("div",{className:Wt.sessionName,children:r.displayName||r.sessionId}),u.jsxs("div",{className:Wt.sessionMeta,children:[u.jsx("span",{children:t("common.clients",{count:r.clientCount})}),u.jsx("span",{children:t("daemon.full.session.pendingPrompts",{count:r.pendingPromptCount})}),u.jsx("span",{children:t("daemon.full.session.pendingPermissions",{count:r.pendingPermissionCount})}),r.hasActivePrompt&&u.jsx("span",{className:Wt.activePrompt,children:t("daemon.full.session.prompting")})]})]},r.sessionId))}),u.jsx(nl,{title:t("daemon.full.workspace.title"),children:s.length===0?u.jsx("div",{className:Wt.empty,children:t("daemon.full.workspace.empty")}):s.map(([r,i])=>u.jsx(Zet,{name:r,section:i},r))}),u.jsxs(nl,{title:t("daemon.full.auth.title"),children:[u.jsx(Ls,{label:t("daemon.full.auth.providers"),value:n.auth.supportedDeviceFlowProviders.join(", ")||t("daemon.none")}),u.jsx(Ls,{label:t("daemon.full.auth.pending"),value:n.auth.pendingDeviceFlowCount}),u.jsx(Ls,{label:t("daemon.full.acp.title"),value:n.acpConnections.length})]})]})}function ttt({series:e}){const{t}=ot();if(e.length===0)return u.jsx(nl,{title:t("daemon.charts.title"),children:u.jsx("div",{className:Wt.empty,children:t("daemon.charts.empty")})});const n=i=>e.map(i),s=e.map(i=>i.t),r=(i,o,a,l)=>u.jsx(nl,{title:t(i),help:t(l),children:u.jsx(vte,{series:a,timestamps:s,format:o,ariaLabel:t(i),peakLabel:t("daemon.charts.peak")})});return u.jsxs("div",{className:`${Wt.grid} ${Wt.chartsGrid}`,children:[r("daemon.charts.concurrency",Zg,[{label:t("daemon.charts.activePrompts"),values:n(i=>i.activePrompts),color:"var(--primary)"},{label:t("daemon.charts.queuedPrompts"),values:n(i=>i.queuedPrompts),color:"var(--warning-color)"},{label:t("daemon.charts.activeSessions"),values:n(i=>i.activeSessions),color:"var(--muted-foreground)"}],"daemon.charts.concurrency.help"),r("daemon.charts.requests",Zg,[{label:t("daemon.charts.reqTotal"),values:n(i=>i.requests),color:"var(--success-color)"},{label:t("daemon.charts.reqErrors"),values:n(i=>i.errors),color:"var(--error-color)"},{label:t("daemon.charts.reqRejected"),values:n(i=>i.rateLimitRejected),color:"var(--warning-color)"}],"daemon.charts.requests.help"),r("daemon.charts.apiLatency",Qd,[{label:"p50",values:n(i=>i.latencyP50Ms),color:"var(--agent-blue-400)"},{label:"p95",values:n(i=>i.latencyP95Ms),color:"var(--warning-color)"}],"daemon.charts.apiLatency.help"),r("daemon.charts.llmLatency",Qd,[{label:"p50",values:n(i=>i.llmApiP50Ms),color:"var(--agent-blue-400)"},{label:"p95",values:n(i=>i.llmApiP95Ms),color:"var(--primary)"}],"daemon.charts.llmLatency.help"),r("daemon.charts.apiHealth",Zg,[{label:t("daemon.charts.apiErrors"),values:n(i=>i.llmApiErrors??0),color:"var(--error-color)"},{label:t("daemon.charts.apiRetries"),values:n(i=>i.llmApiRetries??0),color:"var(--warning-color)"}],"daemon.charts.apiHealth.help"),r("daemon.charts.promptLatency",Qd,[{label:t("daemon.charts.queueWait"),values:n(i=>i.promptQueueWaitP95Ms),color:"var(--warning-color)"},{label:t("daemon.charts.promptDuration"),values:n(i=>i.promptDurationP95Ms),color:"var(--primary)"}],"daemon.charts.promptLatency.help"),r("daemon.charts.eventLoop",Qd,[{label:t("daemon.charts.eventLoopLag"),values:n(i=>i.eventLoopLagP99Ms),color:"var(--error-color)"}],"daemon.charts.eventLoop.help"),r("daemon.charts.cpu",Ket,[{label:t("daemon.charts.cpuDaemon"),values:n(i=>i.cpuPercent),color:"var(--muted-foreground)"},{label:t("daemon.charts.cpuChild"),values:n(i=>i.childCpuPercent),color:"var(--primary)"}],"daemon.charts.cpu.help"),r("daemon.charts.memory",H2,[{label:t("daemon.charts.rssDaemon"),values:n(i=>i.rssBytes),color:"var(--muted-foreground)"},{label:t("daemon.charts.heap"),values:n(i=>i.heapUsedBytes),color:"var(--agent-blue-400)"},{label:t("daemon.charts.rssChild"),values:n(i=>i.childRssBytes),color:"var(--primary)"}],"daemon.charts.memory.help"),r("daemon.charts.pipe",H2,[{label:t("daemon.charts.pipeIn"),values:n(i=>i.pipeInBytes),color:"var(--agent-blue-400)"},{label:t("daemon.charts.pipeOut"),values:n(i=>i.pipeOutBytes),color:"var(--success-color)"}],"daemon.charts.pipe.help"),r("daemon.charts.connections",Zg,[{label:"SSE",values:n(i=>i.sseConnections),color:"var(--primary)"},{label:"WS",values:n(i=>i.wsConnections),color:"var(--agent-blue-400)"},{label:"ACP",values:n(i=>i.acpConnections),color:"var(--muted-foreground)"}],"daemon.charts.connections.help"),r("daemon.charts.tokens",Zg,[{label:t("daemon.charts.tokensIn"),values:n(i=>i.tokensIn),color:"var(--agent-blue-400)"},{label:t("daemon.charts.tokensOut"),values:n(i=>i.tokensOut),color:"var(--success-color)"}],"daemon.charts.tokens.help")]})}function ntt(){var _;const{t:e}=ot(),[t,n]=m.useState("overview"),s=m.useRef([]),r=(L,M)=>{var A;let I;if(L.key==="ArrowRight"||L.key==="ArrowDown")I=(M+1)%ep.length;else if(L.key==="ArrowLeft"||L.key==="ArrowUp")I=(M-1+ep.length)%ep.length;else if(L.key==="Home")I=0;else if(L.key==="End")I=ep.length-1;else return;L.preventDefault(),n(ep[I].id),(A=s.current[I])==null||A.focus()},i=Q6({autoLoad:!0,detail:"summary"}),o=Q6({autoLoad:!0,detail:"full"}),a=i.reload,l=o.reload,c=m.useRef(!1);m.useEffect(()=>{const L=window.setInterval(()=>{document.hidden||c.current||(c.current=!0,a().finally(()=>{c.current=!1}))},Get);return()=>window.clearInterval(L)},[a]);const d=m.useCallback(()=>{a(),l()},[a,l]),h=i.report??o.report,f=o.report,p=i.loading||o.loading,g=i.error??o.error;if(!h)return u.jsx("div",{className:Wt.dialog,children:u.jsx("div",{className:Wt.empty,children:g?`${e("daemon.loadFailed")}: ${g.message}`:e("daemon.loading")})});const y=f??h,{daemon:w,runtime:v,security:b,limits:x,capabilities:k}=h,T=v.transport.acp,C=Object.values(v.rateLimit.rejectedSinceStart).reduce((L,M)=>L+M,0),S=L=>L===null?e("daemon.limits.unlimited"):L;return u.jsxs("div",{className:Wt.dialog,children:[u.jsxs("div",{className:Wt.toolbar,children:[u.jsx("span",{role:"status","aria-label":`${e("daemon.title")}: ${e(`daemon.level.${y.status}`)}`,className:`${Wt.badge} ${p7(y.status)}`,children:e(`daemon.level.${y.status}`)}),u.jsx("span",{className:Wt.updatedAt,children:e("daemon.updatedAt",{time:new Date(h.generatedAt).toLocaleTimeString()})}),i.error&&i.report&&u.jsx("span",{className:Wt.refreshError,children:e("daemon.loadFailed")}),u.jsx("div",{className:Wt.toolbarActions,children:u.jsx("button",{type:"button",className:Wt.refreshButton,onClick:d,disabled:p,children:e("daemon.refresh")})})]}),y.issues.length>0&&u.jsx(nl,{title:e("daemon.issues.title"),children:y.issues.map((L,M)=>u.jsxs("div",{className:Wt.issueRow,children:[u.jsx("span",{className:`${Wt.badge} ${L.severity==="error"?Wt.levelError:Wt.levelWarning}`,children:L.severity==="error"?e("daemon.level.error"):e("daemon.level.warning")}),u.jsx("span",{className:Wt.issueMessage,children:L.message})]},`${L.code}-${M}`))}),u.jsx("div",{className:Wt.tabs,role:"tablist","aria-label":e("daemon.title"),children:ep.map((L,M)=>u.jsx("button",{ref:I=>{s.current[M]=I},type:"button",role:"tab",id:`daemon-tab-${L.id}`,"aria-selected":L.id===t,"aria-controls":`daemon-tabpanel-${L.id}`,tabIndex:L.id===t?0:-1,className:`${Wt.tab} ${L.id===t?Wt.tabActive:""}`,onClick:()=>n(L.id),onKeyDown:I=>r(I,M),children:e(L.labelKey)},L.id))}),t==="overview"&&u.jsxs("div",{role:"tabpanel",id:"daemon-tabpanel-overview","aria-labelledby":"daemon-tab-overview",tabIndex:0,className:Wt.grid,children:[u.jsxs(nl,{title:e("daemon.overview.title"),children:[w.qwenCodeVersion&&u.jsx(Ls,{label:e("daemon.overview.version"),value:w.qwenCodeVersion}),u.jsx(Ls,{label:e("daemon.overview.pid"),value:w.pid}),u.jsx(Ls,{label:e("daemon.overview.mode"),value:w.mode}),u.jsx(Ls,{label:e("daemon.overview.uptime"),value:xte(w.uptimeMs)}),u.jsxs("div",{className:Wt.pathRow,children:[u.jsx("span",{className:Wt.rowLabel,children:e("daemon.overview.workspace")}),u.jsx("span",{className:Wt.pathValue,title:w.workspaceCwd,children:u.jsx("bdi",{children:w.workspaceCwd})})]})]}),u.jsxs(nl,{title:e("daemon.runtime.title"),children:[v.error?u.jsxs("div",{className:Wt.workspaceError,children:[e("daemon.runtime.startFailed"),": ",v.error]}):v.loading?u.jsx("div",{className:Wt.empty,children:e("daemon.runtime.startingUp")}):null,u.jsx(Ls,{label:e("daemon.runtime.activeSessions"),value:v.sessions.active}),v.activity&&u.jsxs(u.Fragment,{children:[u.jsx(Ls,{label:e("daemon.runtime.activePrompts"),value:v.activity.activePrompts}),u.jsx(Ls,{label:e("daemon.runtime.idle"),value:v.activity.idleSinceMs===null?e("daemon.runtime.noActivity"):Qd(v.activity.idleSinceMs)})]}),u.jsx(Ls,{label:e("daemon.runtime.pendingPermissions"),value:v.permissions.pending}),u.jsx(Ls,{label:e("daemon.runtime.permissionPolicy"),value:v.permissions.policy}),u.jsx(Ls,{label:e("daemon.runtime.channel"),value:v.channel.live?e("daemon.runtime.channelLive"):e("daemon.runtime.channelDown")}),v.channelWorker.enabled&&u.jsxs(u.Fragment,{children:[u.jsx(Ls,{label:e("daemon.runtime.channelWorker"),value:Yet(v.channelWorker)}),v.channelWorker.error&&u.jsx("div",{className:Wt.workspaceError,children:v.channelWorker.error}),(v.channelWorker.restartCount??0)>0&&u.jsx(Ls,{label:e("daemon.runtime.channelWorkerRestarts"),value:v.channelWorker.restartCount})]}),u.jsx(Ls,{label:e("daemon.runtime.memory"),value:`${H2(v.process.rss)} / ${H2(v.process.heapUsed)}`})]}),u.jsxs(nl,{title:e("daemon.transport.title"),children:[u.jsx(Ls,{label:e("daemon.transport.restSse"),value:v.transport.restSseActive}),T.enabled?u.jsxs(u.Fragment,{children:[u.jsx(Ls,{label:e("daemon.transport.acpConnections"),value:T.connections}),u.jsx(Ls,{label:e("daemon.transport.acpStreams"),value:`${T.sessionStreams} / ${T.sseStreams} / ${T.wsStreams}`}),u.jsx(Ls,{label:e("daemon.transport.pendingRequests"),value:T.pendingClientRequests})]}):u.jsx("div",{className:Wt.empty,children:e("daemon.transport.acpDisabled")}),u.jsx(Ls,{label:e("daemon.transport.rateLimitRejected"),value:v.rateLimit.enabled?C:e("common.disabled")})]}),u.jsxs(nl,{title:e("daemon.security.title"),children:[u.jsx(Ls,{label:e("daemon.security.token"),value:b.tokenConfigured?e("daemon.security.configured"):e("daemon.security.notConfigured")}),u.jsx(Ls,{label:e("daemon.security.requireAuth"),value:b.requireAuth?e("common.enabled"):e("common.disabled")}),u.jsx(Ls,{label:e("daemon.security.loopback"),value:b.loopbackBind?e("common.enabled"):e("common.disabled")}),u.jsx(Ls,{label:e("daemon.security.allowOrigin"),value:b.allowOriginMode}),u.jsx(Ls,{label:e("daemon.security.shell"),value:b.sessionShellCommandEnabled?e("common.enabled"):e("common.disabled")})]}),u.jsxs(nl,{title:e("daemon.limits.title"),children:[u.jsx(Ls,{label:e("daemon.limits.maxSessions"),value:S(x.maxSessions)}),u.jsx(Ls,{label:e("daemon.limits.maxPendingPrompts"),value:S(x.maxPendingPromptsPerSession)}),u.jsx(Ls,{label:e("daemon.limits.maxConnections"),value:S(x.listenerMaxConnections)}),u.jsx(Ls,{label:e("daemon.limits.eventRing"),value:x.eventRingSize}),u.jsx(Ls,{label:e("daemon.limits.promptDeadline"),value:x.promptDeadlineMs===null?e("daemon.limits.unlimited"):Qd(x.promptDeadlineMs)}),u.jsx(Ls,{label:e("daemon.limits.sessionIdle"),value:Qd(x.sessionIdleTimeoutMs)})]}),u.jsx(nl,{title:k.features.length?e("daemon.capabilities.titleCount",{count:k.features.length}):e("daemon.capabilities.title"),children:k.features.length===0?u.jsx("span",{className:Wt.empty,children:e("daemon.none")}):u.jsx("div",{className:Wt.featureChips,children:[...k.features].sort().map(L=>u.jsx("span",{className:Wt.featureChip,children:L},L))})})]}),t==="usage"&&u.jsx("div",{role:"tabpanel",id:"daemon-tabpanel-usage","aria-labelledby":"daemon-tab-usage",tabIndex:0,children:u.jsx(Fu,{label:"daemon-usage",fallback:u.jsx("div",{className:Wt.empty,children:e("daemon.usage.failed")}),children:u.jsx(JZe,{})})}),t==="metrics"&&u.jsx("div",{role:"tabpanel",id:"daemon-tabpanel-metrics","aria-labelledby":"daemon-tab-metrics",tabIndex:0,children:u.jsx(ttt,{series:((_=h.runtime.metrics)==null?void 0:_.series)??[]})}),t==="diagnostics"&&u.jsx("div",{role:"tabpanel",id:"daemon-tabpanel-diagnostics","aria-labelledby":"daemon-tab-diagnostics",tabIndex:0,children:u.jsx(Fu,{label:"daemon-status-detail",fallback:u.jsx("div",{className:Wt.empty,children:e("daemon.details.failed")}),children:f!=null&&f.full?u.jsx(ett,{report:f}):o.loading?u.jsx("div",{className:Wt.empty,children:e("daemon.details.loading")}):o.error?u.jsxs("div",{className:Wt.empty,children:[e("daemon.details.failed"),": ",o.error.message]}):u.jsx("div",{className:Wt.empty,children:e("daemon.details.failed")})})})]})}function stt(){const{t:e}=ot();return u.jsx(Fu,{label:"daemon-status",fallback:t=>u.jsx("div",{className:Wt.dialog,children:u.jsxs("div",{className:Wt.empty,children:[e("daemon.loadFailed"),": ",t.message]})}),children:u.jsx(ntt,{})})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const kte="split",r0=6;function rtt(e,t,n){const s=new URL(t);return s.pathname="/",s.searchParams.set(kte,e.join(",")),n&&(s.hash=new URLSearchParams({token:n}).toString()),s.toString()}function itt(e){const t=new URLSearchParams(e).get(kte);return t?t.split(",").map(n=>n.trim()).filter(Boolean):[]}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function DM(e){return e.split(/[\\/]+/).filter(Boolean).at(-1)??e}function OM(e){var t;return(((t=e==null?void 0:e.workspaces)==null?void 0:t.length)??0)>1}function _te(e,t){return!!e&&!!t&&e!==t}function Ste(e,t){if(t.length===0)return e;const n=new Map;for(const s of e)n.set(s.sessionId,s);for(const s of t)n.has(s.sessionId)||n.set(s.sessionId,s);return[...n.values()]}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const pu=1e3,PM="session_organization";/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Vw=[];function Cte(){var a;const e=Dh(),t=e.client,n=(((a=e.capabilities)==null?void 0:a.workspaces)??[]).filter(l=>!l.primary&&l.trusted).map(l=>l.cwd).join(`
`),[s,r]=m.useState(Vw),i=m.useCallback(async()=>{const l=n?n.split(`
`):[];if(l.length===0)return Vw;const c=await Promise.allSettled(l.map(h=>t.listWorkspaceSessions(h,{pageSize:pu,archiveState:"active"}))),d=[];return c.forEach((h,f)=>{h.status==="fulfilled"?d.push(...h.value):console.warn(`[useOtherWorkspaceSessions] failed to list sessions for ${l[f]}:`,h.reason)}),d.length===0?Vw:d},[t,n]),o=m.useCallback(async()=>{n&&r(await i())},[n,i]);return m.useEffect(()=>{if(!n){r(c=>c.length===0?c:Vw);return}let l=!1;return i().then(c=>{l||r(c)}),()=>{l=!0}},[n,i]),{sessions:s,reload:o}}function ott(){if(typeof window>"u")return"";const e=new URLSearchParams(window.location.search).get("daemon")||"";return e?dtt(e):""}let x1;const att="qwen-daemon-auth",ltt=2500;function Tte(){return x1||(typeof window>"u"?void 0:(x1=new URLSearchParams(window.location.hash.replace(/^#/,"")).get("token")||new URLSearchParams(window.location.search).get("token")||void 0,x1))}function ctt(e=ltt){return typeof window>"u"||window.parent===window?Promise.resolve(void 0):new Promise(t=>{let n=!1;const s=o=>{n||(n=!0,window.removeEventListener("message",r),clearTimeout(i),x1=o,t(o))},r=o=>{if(o.source!==window.parent||!o.origin.startsWith("chrome-extension://")&&!o.origin.startsWith("moz-extension://"))return;const a=o.data;if((a==null?void 0:a.type)!==att)return;const l=typeof a.token=="string"?a.token:"";s(l.trim()||void 0)},i=setTimeout(()=>s(void 0),e);window.addEventListener("message",r)})}function utt(){if(typeof window>"u")return;const e=new URL(window.location.href);let t=!1;if(e.searchParams.has("token")&&(e.searchParams.delete("token"),t=!0),e.hash){const n=new URLSearchParams(e.hash.replace(/^#/,""));if(n.has("token")){n.delete("token");const s=n.toString();e.hash=s?`#${s}`:"",t=!0}}t&&window.history.replaceState(null,"",e)}function dtt(e){try{const t=new URL(e,window.location.origin);if(!(t.protocol==="http:"||t.protocol==="https:"))return"";if(t.origin===window.location.origin)return t.origin;if(!(t.hostname==="localhost"||t.hostname==="127.0.0.1"||t.hostname==="::1"||t.hostname==="[::1]"))return"";const r=window.location.port||(window.location.protocol==="https:"?"443":"80");return(t.port||(t.protocol==="https:"?"443":"80"))!==r?"":t.origin}catch{return""}}const htt="_panel_1kikd_1",ftt="_toolbar_1kikd_9",mtt="_count_1kikd_16",ptt="_selectAll_1kikd_21",gtt="_actionButton_1kikd_30",ytt="_refreshButton_1kikd_50",btt="_notice_1kikd_61",vtt="_grid_1kikd_71",wtt="_card_1kikd_80",xtt="_cardCurrent_1kikd_91",ktt="_cardTop_1kikd_96",_tt="_cardCheckbox_1kikd_103",Stt="_colorDot_1kikd_108",Ctt="_cardLabel_1kikd_115",Ttt="_currentBadge_1kikd_135",Ett="_cardMeta_1kikd_145",Att="_metaItem_1kikd_153",Mtt="_statusBadge_1kikd_162",Ntt="_statusApproval_1kikd_172",Itt="_statusRunning_1kikd_181",Rtt="_statusIdle_1kikd_190",jtt="_workspaceBadge_1kikd_202",Ltt="_workspaceBadgeOther_1kikd_218",Dtt="_empty_1kikd_223",Ott="_colorRed_1kikd_231",Ptt="_colorOrange_1kikd_234",Btt="_colorYellow_1kikd_237",$tt="_colorGreen_1kikd_240",ztt="_colorBlue_1kikd_243",Ftt="_colorPurple_1kikd_246",cs={panel:htt,toolbar:ftt,count:mtt,selectAll:ptt,actionButton:gtt,refreshButton:ytt,notice:btt,grid:vtt,card:wtt,cardCurrent:xtt,cardTop:ktt,cardCheckbox:_tt,colorDot:Stt,cardLabel:Ctt,currentBadge:Ttt,cardMeta:Ett,metaItem:Att,statusBadge:Mtt,statusApproval:Ntt,statusRunning:Itt,statusIdle:Rtt,workspaceBadge:jtt,workspaceBadgeOther:Ltt,empty:Dtt,colorRed:Ott,colorOrange:Ptt,colorYellow:Btt,colorGreen:$tt,colorBlue:ztt,colorPurple:Ftt},qtt=3e3,Htt=1e4,M$={needsApproval:0,running:1,idle:2};function Utt(e,t,n,s){const r=new Map(t.map(o=>[o.sessionId,o])),i=e.map(o=>{var d;const a=r.get(o.sessionId),l=o.hasActivePrompt??(a==null?void 0:a.hasActivePrompt)??!1,c=((a==null?void 0:a.pendingPermissionCount)??0)>0;return{sessionId:o.sessionId,label:((d=o.displayName)==null?void 0:d.trim())||o.sessionId.slice(0,8),status:c?"needsApproval":l?"running":"idle",clientCount:o.clientCount??(a==null?void 0:a.clientCount)??0,model:a==null?void 0:a.currentModelId,updatedAt:o.updatedAt||o.createdAt,color:o.color,isCurrent:o.sessionId===n,workspaceCwd:o.workspaceCwd,isNonPrimary:_te(o.workspaceCwd,s)}});return i.sort((o,a)=>{const l=M$[o.status]-M$[a.status];return l!==0?l:(a.updatedAt??"").localeCompare(o.updatedAt??"")}),i}function Ww(...e){return e.filter(Boolean).join(" ")}function Vtt(e){switch(e){case"red":return cs.colorRed;case"orange":return cs.colorOrange;case"yellow":return cs.colorYellow;case"green":return cs.colorGreen;case"blue":return cs.colorBlue;case"purple":return cs.colorPurple;default:return}}function N$(e){switch(e){case"needsApproval":return cs.statusApproval;case"running":return cs.statusRunning;default:return cs.statusIdle}}function Wtt({onOpenSession:e,onOpenSplit:t}){var z,U,D;const{t:n}=ot(),s=Ba(),r=s.sessionId,i=((U=(z=s.capabilities)==null?void 0:z.features)==null?void 0:U.includes(PM))??!1,{sessions:o,loading:a,error:l,reload:c}=ah({autoLoad:!0,pageSize:pu,archiveState:"active",...i?{view:"organized",group:"all"}:{}}),{sessions:d,reload:h}=Cte(),f=m.useMemo(()=>Ste(o,d),[o,d]),p=OM(s.capabilities),g=Q6({autoLoad:!0,detail:"full"}),y=g.reload,w=g.report,[v,b]=m.useState(()=>new Set),[x,k]=m.useState(!1),T=m.useRef(!1);m.useEffect(()=>{const G=window.setInterval(()=>{document.hidden||T.current||(T.current=!0,Promise.all([c(),h()]).finally(()=>{T.current=!1}))},qtt);return()=>window.clearInterval(G)},[c,h]);const C=m.useRef(!1);m.useEffect(()=>{const G=window.setInterval(()=>{document.hidden||C.current||(C.current=!0,y().finally(()=>{C.current=!1}))},Htt);return()=>window.clearInterval(G)},[y]);const S=(D=s.capabilities)==null?void 0:D.workspaceCwd,_=m.useMemo(()=>{var G;return Utt(f,((G=w==null?void 0:w.full)==null?void 0:G.sessions)??[],r,S)},[f,w,r,S]),L=m.useCallback(G=>{b(q=>{const N=new Set(q);return N.has(G)?N.delete(G):N.add(G),N})},[]),M=_.map(G=>G.sessionId).filter(G=>v.has(G)),I=M.length,A=_.length>0&&I===_.length,P=M.slice(0,r0),B=I>r0,F=m.useCallback(()=>{b(G=>{const q=_.map(ee=>ee.sessionId);return q.length>0&&q.every(ee=>G.has(ee))?new Set:new Set(q)})},[_]);m.useEffect(()=>{b(G=>{if(G.size===0)return G;const q=new Set(_.map(re=>re.sessionId));let N=!1;const ee=new Set;for(const re of G)q.has(re)?ee.add(re):N=!0;return N?ee:G})},[_]);const O=m.useCallback(()=>{if(P.length===0)return;const G=rtt(P,window.location.href,Tte()),q=window.open(G,"_blank");q&&(q.opener=null,q.focus()),k(!q)},[P]),X=m.useCallback(()=>{c(),h(),y()},[c,h,y]);return _.length===0?u.jsx("div",{className:cs.panel,children:u.jsx("div",{className:cs.empty,children:a?n("sessionsOverview.loading"):l?`${n("sessionsOverview.loadFailed")}: ${l.message}`:n("sessionsOverview.empty")})}):u.jsxs("div",{className:cs.panel,children:[u.jsxs("div",{className:cs.toolbar,children:[u.jsx("span",{className:cs.count,children:n("sessionsOverview.count",{count:_.length})}),u.jsxs("label",{className:cs.selectAll,children:[u.jsx("input",{type:"checkbox",checked:A,onChange:F}),n("sessionsOverview.selectAll")]}),u.jsx("button",{type:"button",className:cs.actionButton,disabled:I===0,onClick:O,title:n("sessionsOverview.openInTabHint"),children:n("sessionsOverview.openInTab")}),t&&u.jsx("button",{type:"button",className:cs.actionButton,disabled:I===0,onClick:()=>t(P),title:n("sessionsOverview.openInSplitHint"),children:n("sessionsOverview.openInSplit")}),u.jsx("button",{type:"button",className:cs.refreshButton,onClick:X,children:n("sessionsOverview.refresh")})]}),B&&u.jsx("div",{className:cs.notice,role:"status",children:n("sessionsOverview.splitCap",{max:r0})}),x&&u.jsx("div",{className:cs.notice,role:"alert",children:n("sessionsOverview.popupBlocked")}),l&&u.jsxs("div",{className:cs.notice,role:"alert",children:[n("sessionsOverview.loadFailed"),": ",l.message]}),u.jsx("ul",{className:cs.grid,children:_.map(G=>u.jsxs("li",{className:Ww(cs.card,N$(G.status),G.isCurrent&&cs.cardCurrent),children:[u.jsxs("div",{className:cs.cardTop,children:[u.jsx("input",{type:"checkbox",className:cs.cardCheckbox,checked:v.has(G.sessionId),onChange:()=>L(G.sessionId),"aria-label":n("sessionsOverview.selectSession",{name:G.label})}),G.color&&u.jsx("span",{className:Ww(cs.colorDot,Vtt(G.color)),"aria-hidden":"true"}),u.jsx("button",{type:"button",className:cs.cardLabel,onClick:()=>e(G.sessionId),title:G.label,children:G.label}),G.isCurrent&&u.jsx("span",{className:cs.currentBadge,children:n("sessionsOverview.current")})]}),u.jsxs("div",{className:cs.cardMeta,children:[u.jsx("span",{className:Ww(cs.statusBadge,N$(G.status)),children:n(`sessionsOverview.status.${G.status}`)}),p&&u.jsx("span",{className:Ww(cs.workspaceBadge,G.isNonPrimary&&cs.workspaceBadgeOther),title:G.workspaceCwd,children:G.isNonPrimary?DM(G.workspaceCwd):n("sidebar.workspacePrimary")}),G.model&&u.jsx("span",{className:cs.metaItem,title:G.model,children:G.model}),G.clientCount>0&&u.jsx("span",{className:cs.metaItem,title:n("sessionsOverview.openElsewhere"),children:n("common.clients",{count:G.clientCount})}),G.updatedAt&&u.jsx("span",{className:cs.metaItem,children:q2(G.updatedAt,n)})]})]},G.sessionId))})]})}function Gtt({onOpenSession:e,onOpenSplit:t}){const{t:n}=ot();return u.jsx(Fu,{label:"session-overview",fallback:s=>u.jsx("div",{className:cs.panel,children:u.jsxs("div",{className:cs.empty,children:[n("sessionsOverview.loadFailed"),": ",s.message]})}),children:u.jsx(Wtt,{onOpenSession:e,onOpenSplit:t})})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Ktt(e){return e.startsWith("language_changed (unrecognized daemon event):")||e.startsWith("Model switched: ")}function Ytt(e,t){return e.errorKind==="model_stream_interrupted"||e.source==="turn_error"&&e.text.trim().toLowerCase()==="terminated"?(t==null?void 0:t.modelStreamInterrupted)??e.text:e.text}function Xtt(e,t){return e===void 0?{}:t?{data:{...yo(e)??{value:e},errorKind:t}}:{data:e}}function Qtt(e){if(!e||typeof e!="object")return null;const t=e;return typeof t.displayName=="string"&&t.displayName?t.displayName:typeof t.newSessionId=="string"?t.newSessionId.slice(0,8):null}function Jtt(e){if(!e||typeof e!="object")return null;const t=e.messages;return Array.isArray(t)&&t.filter(s=>typeof s=="string").join(`
`).trim()||null}function Ztt(e){const n=e.meta;return(n==null?void 0:n.source)==="background_notification"&&n.qwenDiscreteMessage===!0&&n.backgroundTask!==void 0}function ent(e){return Ztt(e)||!e.text&&!e.usage?null:e}function I$(e){return e.text.length===0}function tnt(e){const t=e.flatMap((n,s)=>{const r=yo(n),i=No(r,"content");return i?[{id:No(r,"id")??`plan-${s}`,content:i,status:ant(No(r,"status")),...(()=>{const a=lnt(No(r,"priority"));return a?{priority:a}:{}})()}]:[]});return t.length>0?t:void 0}function R$(e,t){if(!e)return t;if(!t)return e;const n=(e.cachedTokens??0)+(t.cachedTokens??0);return{inputTokens:e.inputTokens+t.inputTokens,outputTokens:e.outputTokens+t.outputTokens,...n>0?{cachedTokens:n}:{}}}function nnt(e,t={}){var c,d,h;const n=[],s=((c=t.labels)==null?void 0:c.promptCancelled)??"Request cancelled.",r=new Map,i=new Map;let o=null,a=null,l=!1;for(let f=0;f<e.length;f++){const p=e[f],g=p.serverTimestamp??p.clientReceivedAt;switch(p.kind){case"user":{o=null,a=null,l=!1;const y=p,w=yo(y.meta),v=No(w,"source"),b=Array.isArray(w==null?void 0:w.inputAnnotations)?w.inputAnnotations:void 0,x={id:p.id,role:"user",content:y.text,timestamp:g,...v?{source:v}:{},...b?{inputAnnotations:b}:{}};y.images&&y.images.length>0&&(x.images=y.images.map(k=>({data:k.data,mimeType:k.mimeType||"image/*"}))),n.push(x);break}case"assistant":{const y=ent(p);if(!y)break;const w=y.parentToolCallId?r.get(y.parentToolCallId):void 0;if(w){j$(w,y.text);break}const v=xnt(y.text);if(v){let x=null,k=!1,T=0,C=0;for(const S of v)S.kind==="insight"?S.data.type==="insight_progress"?x=S.data:S.data.type==="insight_ready"?(k=!0,n.push({id:`${p.id}-ir-${T++}`,role:"insight_ready",path:S.data.path,timestamp:g})):S.data.type==="insight_error"&&(k=!0,n.push({id:`${p.id}-ie-${C++}`,role:"insight_error",error:S.data.error,timestamp:g})):(n.push({id:`${p.id}-t-${n.length}`,role:"assistant",content:S.text,timestamp:g}),o=n.length-1,a=null);x&&!k&&n.push({id:`${p.id}-ip`,role:"insight_progress",stage:x.stage,progress:x.progress,detail:x.detail,timestamp:g}),l=!0;break}const b=o!==null?n[o]:void 0;if(b&&b.role==="assistant"&&!l&&!I$(y)){const x=R$(b.usage,y.usage);n[o]={...b,content:b.content+y.text,isStreaming:y.streaming,...x?{usage:x}:{}},l=!1,a=null}else if(!I$(y))n.push({id:p.id,role:"assistant",content:y.text,isStreaming:y.streaming,timestamp:g,...y.usage?{usage:y.usage}:{}}),o=n.length-1,a=null,l=!1;else if(y.usage&&b&&b.role==="assistant"){const x=R$(b.usage,y.usage);n[o]={...b,...x?{usage:x}:{}}}break}case"thought":{const y=p,w=y.parentToolCallId?r.get(y.parentToolCallId):void 0;if(w){j$(w,y.text);break}const v=a!==null?n[a]:void 0;v&&v.role==="thinking"&&!l?(n[a]={...v,content:v.content+y.text,isStreaming:y.streaming},l=!1):(n.push({id:p.id,role:"thinking",content:y.text,isStreaming:y.streaming,timestamp:g}),a=n.length-1,l=!1),o=null;break}case"tool":{const w=cnt(p),v=i.get(w.callId);v!=null&&v.title&&(w.title=v.title),!w.args&&(v!=null&&v.args)&&(w.args=v.args);const b=w.parentToolCallId?r.get(w.parentToolCallId):void 0,x=r.get(w.callId);if(x){L$(x,w);break}if(b){snt(b,w),r.set(w.callId,w);break}_C(n,p.id,w,g),r.set(w.callId,w),o=null,a=null,l=!0;break}case"shell":{const y=p,w=n[n.length-1];if(w&&w.role==="tool_group"){const v=rnt(w.tools),b=w.tools[v];if(b){const x=typeof b.rawOutput=="string"?b.rawOutput:"",k={...b,rawOutput:x+y.text};n[n.length-1]={...w,tools:[...w.tools.slice(0,v),k,...w.tools.slice(v+1)]},r.get(b.callId)===b&&r.set(b.callId,k)}}else n.push({id:p.id,role:"tool_group",tools:[{callId:p.id,toolName:"shell",status:"completed",kind:"execute",rawOutput:y.text}],timestamp:g}),l=!0;break}case"user_shell":{const y=p;n.push({id:p.id,role:"user_shell",command:y.command,output:y.text,...y.cwd?{cwd:y.cwd}:{},timestamp:g}),l=!0;break}case"permission":{const y=p;dnt(y,i);const w=unt(y);if(!w)break;const v=Ete(w);if(!y.resolved)break;const b=r.get(w.callId);if(b){const x=b.status;w.toolName=b.toolName,y.resolved&&(SC(y.resolved)?w.status=v?w.status:"in_progress":(w.status="failed",w.endTime=y.updatedAt)),L$(b,w),y.resolved&&v&&SC(y.resolved)&&(b.status=x);break}if(y.resolved){SC(y.resolved)?(v||(w.status="in_progress"),_C(n,p.id,w,g),r.set(w.callId,w),l=!0):(w.status="failed",w.endTime=y.updatedAt,_C(n,p.id,w,g),r.set(w.callId,w),l=!0);break}break}case"status":case"debug":{const y=p,w=y.source==="session_branched"?Qtt(y.data):null,v=y.source==="mid_turn_message_injected"?Jtt(y.data):null,b=w&&((d=t.labels)!=null&&d.branchSuccess)?t.labels.branchSuccess(w):v&&((h=t.labels)!=null&&h.midTurnInserted)?t.labels.midTurnInserted(v):y.text;if(Ktt(b))break;const x=ont(b);if(x){n.push({id:p.id,role:"plan",todos:x,timestamp:g}),l=!0;break}n.push({id:p.id,role:"system",content:b,variant:"info",timestamp:g,...y.source?{source:y.source}:{},...y.data!==void 0?{data:y.data}:{}}),l=!0;break}case"error":{const y=p,w=y.errorKind;n.push({id:p.id,role:"system",content:Ytt(y,t.labels),variant:"error",retryable:y.source==="turn_error",timestamp:g,...y.source?{source:y.source}:{},...Xtt(y.data,w)}),l=!0;break}case"prompt_cancelled":n.push({id:p.id,role:"system",content:s,variant:"info",source:"prompt_cancelled",timestamp:g}),l=!0;break}}return n}function snt(e,t){e.subTools||(e.subTools=[]),e.subTools.push(t)}function j$(e,t){e.subContent=(e.subContent||"")+t}function _C(e,t,n,s){const r=o=>Ete(o)||nd(o.toolName),i=e[e.length-1];if(i&&i.role==="tool_group"&&i.id.startsWith("tg-")&&!r(n)&&!i.tools.some(r)){i.tools.push(n);return}e.push({id:`tg-${t}`,role:"tool_group",tools:[n],timestamp:s})}function rnt(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.kind==="execute"&&n.status==="in_progress")return t}for(let t=e.length-1;t>=0;t--)if(e[t].kind==="execute")return t;return e.length-1}function L$(e,t){e.status=t.status??e.status,e.title=t.title??e.title,e.toolName=t.toolName??e.toolName,e.kind=t.kind??e.kind,e.content=t.content??e.content,e.endTime=t.endTime??e.endTime,e.rawOutput=t.rawOutput??e.rawOutput,e.args=t.args??e.args,e.locations=t.locations??e.locations}function Ete(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||e.subTools||e.subContent||int(e.rawOutput)?!0:!!((n=e.args)!=null&&n.subagent_type)}function int(e){return!!e&&typeof e=="object"&&e.type==="task_execution"}function ont(e){const t=e.startsWith("plan: ")?e.slice(6):void 0;if(t)try{const n=JSON.parse(t),s=yo(n);return(s==null?void 0:s.sessionUpdate)!=="plan"||!Array.isArray(s.entries)?void 0:tnt(s.entries)}catch{return}}function yo(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function No(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function ant(e){return e==="completed"||e==="in_progress"||e==="pending"?e:"pending"}function lnt(e){return e==="high"||e==="medium"||e==="low"?e:void 0}function cnt(e){const t=fnt(e),n=hnt(e,t),s=mnt(e.content),r={running:"in_progress",pending:"pending",confirming:"pending",background:"pending",completed:"completed",failed:"failed",cancelled:"completed",canceled:"completed",in_progress:"in_progress"},i=e.status==="completed"||e.status==="failed"||e.status==="cancelled"||e.status==="canceled";return{callId:e.toolCallId,toolName:e.toolName||"unknown",title:e.title,status:(n?"pending":r[e.status])||e.status||"in_progress",kind:Mte(e.toolName,e.toolKind),rawOutput:t,args:e.rawInput,parentToolCallId:e.parentToolCallId,startTime:e.createdAt,endTime:i&&!n?e.updatedAt:void 0,...s?{content:s}:{}}}function unt(e){const t=yo(e.toolCall);if(!t)return;const n=Ate(t);if(Array.isArray(n==null?void 0:n.questions))return;const s=yo(t._meta),r=No(t,"kind"),i=No(s,"toolName")??No(t,"toolName")??No(t,"name")??(n!=null&&n.subagent_type?"agent":void 0)??(r==="fetch"?"web_fetch":r),o=No(t,"toolCallId")??No(t,"id");return!o||!i?void 0:{callId:o,toolName:i,title:No(t,"title")??e.title,status:"pending",kind:Mte(i,r),args:n,startTime:e.createdAt}}function dnt(e,t){const n=yo(e.toolCall),s=No(n,"toolCallId")??No(n,"id");if(!s)return;const r=No(n,"title")??e.title,i=n?Ate(n):void 0;Array.isArray(i==null?void 0:i.questions)&&t.set(s,{...r?{title:r}:{},...i?{args:i}:{}})}function SC(e){const[t="",n=""]=e.toLowerCase().split(":",2);return D$(t)?!0:t!=="selected"?!1:D$(n.trim())}function D$(e){return e==="allow"||e==="allowed"||e==="approve"||e==="approved"||e==="accept"||e==="accepted"||e==="confirm"||e==="confirmed"||e==="proceed"||e==="proceed_once"||e==="proceed_always_project"||e==="proceed_always_user"||e==="allow_once"||e==="allow_always"||e==="success"||e==="succeeded"}function Ate(e){return yo(e.rawInput)??yo(e.input)??yo(e.args)}function hnt(e,t){var r;const n=(r=e.toolName)==null?void 0:r.toLowerCase();if(n!=="agent"&&n!=="task")return!1;const s=yo(t);return(s==null?void 0:s.status)==="background"}function fnt(e){return pnt(e)&&e.status==="failed"?gnt(e)??e.details??e.rawOutput:!ynt(e.status)||!e.details?e.rawOutput??e.details:e.rawOutput&&typeof e.rawOutput=="object"&&!Array.isArray(e.rawOutput)?{...e.rawOutput,status:e.status,reason:e.details}:{status:e.status,reason:e.details,text:typeof e.rawOutput=="string"&&e.rawOutput?e.rawOutput:e.details}}function mnt(e){if(!Array.isArray(e))return;const t=e.flatMap(n=>{const s=yo(n);if(!s)return[];const r=s.type;if(r==="content"){const i=yo(s.content);return!i||typeof i.type!="string"?[]:[{type:"content",content:{...i,type:i.type}}]}if(r==="diff"){const i=s.newText;if(typeof i!="string")return[];const o=s.path,a=s.oldText;return[{type:"diff",...typeof o=="string"?{path:o}:{},...typeof a=="string"?{oldText:a}:{},newText:i}]}if(r==="terminal"){const i=s.terminalId;return[{type:"terminal",...typeof i=="string"?{terminalId:i}:{}}]}return[]});return t.length>0?t:void 0}function pnt(e){if(!e.toolName)return!1;const t=e.toolName.toLowerCase();return t==="ask_user_question"||t==="askuserquestion"}function gnt(e){if(!Array.isArray(e.content))return;const t=e.content.map(n=>{var s;return(s=n==null?void 0:n.content)==null?void 0:s.text}).filter(n=>!!n);if(!(!t||t.length===0))return t.join(`
`)}function ynt(e){return e==="cancelled"||e==="canceled"}const bnt=['"insight_progress":','"insight_ready":','"insight_error":'];function vnt(e){try{const t=JSON.parse(e),n=yo(t.insight_progress);if(n&&typeof n.stage=="string"&&typeof n.progress=="number")return{type:"insight_progress",stage:n.stage,progress:n.progress,detail:typeof n.detail=="string"?n.detail:void 0};const s=yo(t.insight_ready);if(s&&typeof s.path=="string")return{type:"insight_ready",path:s.path};const r=yo(t.insight_error);if(r&&typeof r.error=="string")return{type:"insight_error",error:r.error}}catch{}return null}function wnt(e,t){if(e[t]!=="{")return null;let n=0,s=!1,r=!1;for(let i=t;i<e.length;i++){const o=e[i];if(r){r=!1;continue}if(o==="\\"&&s){r=!0;continue}if(o==='"'){s=!s;continue}if(!s){if(o==="{")n++;else if(o==="}"&&(n--,n===0))return e.slice(t,i+1)}}return null}function xnt(e){const t=[];let n=0,s=0,r=!1;for(;s<e.length;){const o=e.indexOf("{",s);if(o===-1)break;const a=e.slice(o+1).trimStart();if(!bnt.some(f=>a.startsWith(f))){s=o+1;continue}const c=wnt(e,o);if(!c){s=o+1;continue}const d=vnt(c);if(!d){s=o+1;continue}r=!0;const h=e.slice(n,o).trim();h&&t.push({kind:"text",text:h}),t.push({kind:"insight",data:d}),n=o+c.length,s=n}if(!r)return null;const i=e.slice(n).trim();return i&&t.push({kind:"text",text:i}),t.length>0?t:null}function Mte(e,t){if(t)return t;if(!e)return;const n=e.toLowerCase();if(n==="bash"||n==="execute")return"execute";if(n==="read")return"read";if(n==="edit"||n==="write")return"edit";if(n.includes("search")||n==="grep"||n==="glob")return"search";if(n==="agent"||n==="task")return"other"}function Nte(e){const t=bb();return m.useMemo(()=>nnt(t,{labels:{promptCancelled:e("request.cancelled"),branchSuccess:n=>e("branch.success",{name:n}),midTurnInserted:n=>e("midTurn.inserted",{message:n}),modelStreamInterrupted:e("error.modelStreamInterrupted")}}),[t,e])}const knt="session_artifacts";function Ite(){var T,C;const e=H0(),t=Ba(),n=pU(),s=Yu(),r=s==null?void 0:s.artifactsVersion,i=t.status==="connected",o=((C=(T=t.capabilities)==null?void 0:T.features)==null?void 0:C.includes(knt))??!1,a=t.sessionId,[l,c]=m.useState([]),[d,h]=m.useState(!1),[f,p]=m.useState(null),g=m.useRef(0),y=m.useRef(void 0),w=m.useRef(n),v=m.useRef(r),b=m.useCallback(async()=>{const S=g.current+1;if(g.current=S,!a){y.current=void 0,c([]),p(null),h(!1);return}if(!i){y.current=void 0,c([]),p(null),h(!1);return}if(!o){y.current=void 0,c([]),p(null),h(!1);return}y.current!==void 0&&y.current!==a&&c([]),h(!0);try{const _=await e.loadArtifacts();if(g.current!==S)return;y.current=a,c(_.artifacts),p(null)}catch(_){if(g.current!==S)return;if(_nt(_)){p(null);return}p(_ instanceof Error?_.message:String(_))}finally{g.current===S&&h(!1)}},[e,i,a,o]),x=m.useRef(b);x.current=b,m.useEffect(()=>{b()},[b]),m.useEffect(()=>{const S=w.current;w.current=n,S!=="idle"&&n==="idle"&&x.current()},[n]),m.useEffect(()=>{const S=v.current;v.current=r,S!==void 0&&r!==void 0&&r!==S&&x.current()},[r]);const k=m.useMemo(()=>new Map(l.map(S=>[S.id,S])),[l]);return{artifacts:l,artifactById:k,loading:d,error:f,refresh:b}}function _nt(e){return(e instanceof Error?e.message:String(e)).includes("session is not connected")}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Snt(e,t,n,s){const r=[...e];let i=!1;for(const o of t)if(o.sessionId===n&&!(o.originatorClientId!==void 0&&o.originatorClientId!==s))for(const a of o.messages){const l=r.findIndex(c=>c.text===a&&(!c.images||c.images.length===0));l>=0&&(r.splice(l,1),i=!0)}return i?r:null}function Cnt(e,t,n,s){return e?!0:(s.append(t),!1)}function Rte(e){const t=e.trimStart();return t.startsWith("/")||t.startsWith("!")}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Tnt=100;function O$(e,t){return e.length!==t.length?!1:e.every((n,s)=>{var i,o,a,l;const r=t[s];return r!==void 0&&n.id===r.id&&n.sessionId===r.sessionId&&n.text===r.text&&n.serverPromptId===r.serverPromptId&&n.serverState===r.serverState&&n.isEditing===r.isEditing&&n.isRemoving===r.isRemoving&&(((i=n.images)==null?void 0:i.length)??0)===(((o=r.images)==null?void 0:o.length)??0)&&(((a=n.inputAnnotations)==null?void 0:a.length)??0)===(((l=r.inputAnnotations)==null?void 0:l.length)??0)})}function P$(e){if(!(!e||e.length===0))return e.map(t=>({data:t.data,mimeType:t.media_type||"image/*"}))}function jte({connected:e,sessionId:t,clientId:n,streamingState:s,sessionActions:r,store:i,editorRef:o,reportError:a,notifySuccess:l,t:c}){const[d,h]=m.useState([]),f=m.useRef([]),p=m.useRef(1),g=m.useRef(t),y=m.useRef(null),w=m.useRef(new Set),v=m.useRef(new Set),b=m.useRef(new Set),x=m.useRef(new Map),k=m.useRef(new Set),T=m.useRef([]),C=m.useRef(s),S=m.useRef(0);g.current=t,C.current=s;const _=m.useMemo(()=>d.map(te=>te.text),[d]);m.useEffect(()=>{f.current=d},[d]),m.useEffect(()=>{var te;f.current=[],h([]),x.current.clear(),k.current.clear(),T.current=[];for(const ce of w.current)ce.abort();w.current.clear(),v.current.clear(),b.current.clear(),F.current=void 0,(te=y.current)==null||te.abort(),y.current=null},[t]);const L=m.useCallback((te,ce)=>{const oe=f.current.filter(de=>de.serverPromptId?te.some(Te=>Te.promptId===de.serverPromptId):!0);for(const de of te){if(v.current.has(de.promptId))continue;const Te=oe.findIndex(ge=>ge.serverPromptId===de.promptId),qe=b.current.has(de.promptId);if(Te!==-1){if(qe){oe.splice(Te,1);continue}oe[Te]={...oe[Te],text:de.text,serverState:de.state};continue}const Ne=oe.filter(ge=>!ge.serverPromptId&&ge.serverState==="submitting"&&ge.text===de.text);if(Ne.length===1){const ge=oe.indexOf(Ne[0]);if(qe){oe.splice(ge,1);continue}oe[ge]={...Ne[0],serverPromptId:de.promptId,serverState:de.state};continue}de.state==="running"||qe||oe.push({id:p.current++,sessionId:ce,text:de.text,serverPromptId:de.promptId,serverState:de.state})}O$(f.current,oe)||(f.current=oe,h(oe))},[]),M=m.useCallback(async(te=t)=>{if(!e||!te||g.current!==te)return"skipped";const ce=++S.current;try{const oe=await r.getPendingPrompts({sessionId:te});return ce!==S.current?"superseded":g.current!==te?"skipped":(L(oe.pendingPrompts.filter(de=>de.state==="queued"||de.state==="running"),te),"refreshed")}catch(oe){return console.warn("Failed to refresh pending prompts",oe),"failed"}},[e,r,t,L]),I=m.useCallback(te=>{const ce=g.current,oe=te.filter(Ne=>Ne.sessionId===void 0||Ne.sessionId===ce);if(oe.length===0)return;const de=new Set(f.current.map(Ne=>Ne.id)),Te=oe.filter(Ne=>!de.has(Ne.id));if(Te.length===0)return;const qe=[...f.current,...Te].sort((Ne,ge)=>Ne.id-ge.id);f.current=qe,h(qe)},[]),A=m.useCallback((te,ce,oe)=>{var qe,Ne,ge,Ee;if(oe!==void 0&&g.current!==oe)return;const de=((qe=o.current)==null?void 0:qe.getText())??"",Te=de.trim()?`${te}
${de}`:te;(Ne=o.current)==null||Ne.setText(Te),ce&&ce.length>0&&((ge=o.current)==null||ge.restoreImages(ce)),(Ee=o.current)==null||Ee.focus()},[o]),P=m.useSyncExternalStore(pce,mce),B=m.useRef(P),F=m.useRef(void 0);m.useEffect(()=>{if(!e||!t)return;const te=B.current!==P;if(B.current=P,!te){if(f.current.length>0||s==="idle"||F.current===t)return;F.current=t}M()},[P,e,t,s,M]);const O=m.useSyncExternalStore(gce,lj,lj);m.useEffect(()=>{var ce;if(!t||O.length===0)return;const te=[];for(const oe of O){if(oe.data.sessionId!==t)continue;te.push(oe);const de=oe.data.promptId;if(de){if(oe.type==="pending_prompt_started"){if(v.current.has(de))continue;if((oe.originatorClientId===void 0||oe.originatorClientId===n)&&!b.current.has(de)){const qe=typeof oe.data.text=="string"?oe.data.text:"",Ne=f.current.find(Ee=>Ee.serverPromptId===de)??f.current.find(Ee=>!Ee.serverPromptId&&Ee.serverState==="submitting"&&Ee.text===qe),ge=(Ne==null?void 0:Ne.text)??"";ge&&(b.current.add(de),i.appendLocalUserMessage(ge,P$(Ne==null?void 0:Ne.images),(ce=Ne==null?void 0:Ne.inputAnnotations)!=null&&ce.length?{inputAnnotations:Ne.inputAnnotations}:void 0))}M()}else if(oe.type==="turn_complete"){b.current.delete(de);const Te=x.current.get(de);if(x.current.delete(de),Te)Te();else if(!k.current.has(de))for(k.current.add(de),T.current.push(de);T.current.length>Tnt;){const qe=T.current.shift();qe&&k.current.delete(qe)}}else if(oe.type==="turn_error"||oe.type==="pending_prompt_completed"&&oe.data.state==="removed"){b.current.delete(de);const Te=x.current.get(de);x.current.delete(de),Te==null||Te(),k.current.delete(de),T.current=T.current.filter(qe=>qe!==de)}}}bce(te)},[O,t,n,i,M]);const X=m.useCallback((te,ce)=>{if(k.current.delete(te)){T.current=T.current.filter(oe=>oe!==te),ce();return}x.current.set(te,ce)},[]),z=m.useCallback((te,ce,oe,de)=>{const Te=te.trim();if(!Te)return!0;const qe=p.current++,Ne=g.current,ge=new AbortController;w.current.add(ge);const Ee=ce?[...ce]:void 0,_t=de?[...de]:void 0,Ct={id:qe,sessionId:Ne,text:Te,images:Ee,inputAnnotations:_t,onComplete:oe,serverState:"submitting"};return f.current=[...f.current,Ct],h(f.current),r.submitPrompt(Te,{images:ce,inputAnnotations:_t,optimisticUserMessage:!1,sessionId:Ne,signal:ge.signal}).then(Je=>{if(w.current.delete(ge),g.current!==Ne){r.removePendingPrompt(Je.promptId,{sessionId:Ne}).catch(ue=>{console.warn("[useQueuedPrompts] cleanup removePendingPrompt failed after session change",{targetSessionId:Ne,promptId:Je.promptId,error:ue})});return}if(C.current==="idle"){b.current.has(Je.promptId)||(b.current.add(Je.promptId),i.appendLocalUserMessage(Te,P$(Ee),_t!=null&&_t.length?{inputAnnotations:_t}:void 0));const ue=f.current.filter(vt=>vt.id!==qe);f.current=ue,h(ue),oe&&X(Je.promptId,oe);return}const at=f.current,Oe=at.findIndex(ue=>ue.id===qe);if(Oe===-1){r.removePendingPrompt(Je.promptId,{sessionId:Ne}).then(ue=>{ue.removed||M(Ne)},()=>{M(Ne)});return}const Fe=[...at];Fe[Oe]={...Fe[Oe],serverPromptId:Je.promptId,serverState:"queued"},f.current=Fe,h(Fe),oe&&X(Je.promptId,oe)}).catch(Je=>{if(w.current.delete(ge),g.current!==Ne||!f.current.some(Oe=>Oe.id===qe))return;const at=f.current.filter(Oe=>Oe.id!==qe);f.current=at,h(at),A(Te,Ee,Ne),a(Je,c("queue.queueFailed"))}),!0},[M,a,A,r,X,i,c]);m.useEffect(()=>{if(s!=="idle")return;const te=y.current;te&&(te.abort(),y.current=null)},[s]);const U=m.useCallback(te=>{const ce=f.current;if(ce.length===0)return null;const oe=te===void 0?ce.length-1:ce.findIndex(qe=>qe.id===te);if(oe<0)return null;const de=ce[oe],Te=ce.filter((qe,Ne)=>Ne!==oe);return f.current=Te,h(Te),(de==null?void 0:de.text)??null},[]),D=m.useCallback((te,ce)=>{const oe=f.current.map(de=>de.id===te?{...de,...ce}:de);O$(oe,f.current)||(f.current=oe,h(oe))},[]),G=m.useCallback(async(te,ce,oe)=>{if(!te.serverPromptId)return!0;if(te.serverState!=="queued"||v.current.has(te.serverPromptId))return!1;const de=te.sessionId;v.current.add(te.serverPromptId),D(te.id,ce);try{const Te=await r.removePendingPrompt(te.serverPromptId,{sessionId:de});return v.current.delete(te.serverPromptId),Te.removed?(x.current.delete(te.serverPromptId),await M(de)==="failed"&&(D(te.id,{isEditing:!1,isRemoving:!1}),a(new Error("Queue changed but pending prompts could not refresh"),oe)),!0):(D(te.id,{isEditing:!1,isRemoving:!1}),await M(de),a(new Error("Prompt could not be removed from queue"),oe),!1)}catch(Te){return v.current.delete(te.serverPromptId),D(te.id,{isEditing:!1,isRemoving:!1}),await M(de)!=="refreshed"&&I([te]),a(Te,oe),!1}},[M,a,I,r,D]),q=m.useCallback(te=>{const ce=f.current.find(oe=>oe.id===te);if((ce==null?void 0:ce.serverState)!=="submitting"&&ce){if(!ce.serverPromptId){const oe=f.current.filter(de=>de.id!==te);f.current=oe,h(oe);return}G(ce,{isRemoving:!0},c("queue.deleteFailed"))}},[G,c]),N=m.useCallback(async te=>{var Ne;const ce=f.current.find(ge=>ge.id===te);if(!ce||(((Ne=ce.images)==null?void 0:Ne.length)??0)>0||ce.serverState==="submitting"||ce.isEditing||ce.isRemoving||Rte(ce.text))return;const oe=ce.serverPromptId?ce.onComplete??x.current.get(ce.serverPromptId):void 0,de=()=>{ce.serverPromptId&&x.current.delete(ce.serverPromptId),oe==null||oe()};if(ce.serverPromptId&&!await G(ce,{isRemoving:!0},c("queue.insertFailed")))return;let Te=y.current;Te||(Te=new AbortController,y.current=Te);let qe;try{qe=await r.enqueueMidTurnMessage(ce.text,{signal:Te.signal})}catch(ge){ce.serverPromptId&&(A(ce.text,ce.images,ce.sessionId),de()),a(ge,c("queue.insertFailed"));return}if(!qe.accepted){ce.serverPromptId&&(A(ce.text,ce.images,ce.sessionId),de()),a(new Error("Queued message was not accepted for insertion"),c("queue.insertFailed"));return}if(de(),!ce.serverPromptId){const ge=f.current.filter(Ee=>Ee.id!==te);f.current=ge,h(ge)}l(c("queue.inserted"))},[G,l,a,A,r,c]),ee=m.useCallback(async te=>{const ce=f.current.find(de=>de.id===te);if(!ce||ce.serverState==="submitting"||ce.isEditing||ce.isRemoving)return;if(ce.serverPromptId){if(!await G(ce,{isEditing:!0},c("queue.editFailed")))return;A(ce.text,ce.images,ce.sessionId);return}const oe=U(te);oe&&A(oe,ce.images,ce.sessionId)},[U,G,A,c]),re=m.useCallback(()=>{const te=f.current;if(te.length===0)return!1;const ce=te[te.length-1];if(!ce)return!1;if(ce.serverState==="submitting"||ce.isEditing||ce.isRemoving)return!0;if(!ce.serverPromptId){const oe=U(ce.id);return oe?(A(oe,ce.images,ce.sessionId),!0):!1}return ce.serverState!=="queued"?!1:((async()=>{await G(ce,{isEditing:!0},c("queue.editFailed"))&&A(ce.text,ce.images,ce.sessionId)})().catch(oe=>{a(oe,c("queue.editFailed"))}),!0)},[U,G,a,A,c]),Q=m.useCallback(()=>{if(f.current.length===0)return!1;const te=g.current,ce=f.current.filter(ge=>ge.serverState==="submitting"),oe=f.current.filter(ge=>ge.serverState!=="submitting");for(const ge of[...ce].reverse())A(ge.text,ge.images,ge.sessionId);for(const ge of w.current)ge.abort();const de=oe.filter(ge=>ge.serverPromptId);if(de.length===0)return f.current=[],h([]),i.dispatch([{type:"status",text:c("queue.cleared")}]),!0;const Te=new Set(f.current.map(ge=>ge.id)),qe=new Set(de.map(ge=>ge.serverPromptId).filter(ge=>!!ge));for(const ge of qe)v.current.add(ge);const Ne=f.current.filter(ge=>!Te.has(ge.id)).concat(de.map(ge=>({...ge,isRemoving:!0})));return f.current=Ne,h(Ne),(async()=>{var Ct;const ge=[];if(await Promise.all(de.map(async Je=>{const at=Je.serverPromptId;try{if((await r.removePendingPrompt(at,{sessionId:Je.sessionId})).removed){x.current.delete(at);return}ge.push(Je)}catch{ge.push(Je)}finally{v.current.delete(at)}})),g.current!==te)return;const Ee=ge.map(Je=>({...Je,isRemoving:!1})),_t=f.current.filter(Je=>Je.serverPromptId?!qe.has(Je.serverPromptId):!Te.has(Je.id)).concat(Ee);if(f.current=_t,h(_t),ge.length>0){a(new Error("Some prompts could not be removed from queue"),c("queue.deleteFailed")),M((Ct=ge[0])==null?void 0:Ct.sessionId);return}i.dispatch([{type:"status",text:c("queue.cleared")}])})(),!0},[M,a,A,i,c,r]),{batches:K,consume:se}=Wce();return m.useEffect(()=>{if(!t||K.length===0)return;const te=Snt(f.current,K,t,n);te&&(f.current=te,h(te)),se(K.filter(ce=>ce.sessionId===t))},[K,t,n,se]),{queuedPrompts:d,queuedTexts:_,enqueuePrompt:z,removeQueuedPrompt:q,insertQueuedPrompt:N,editQueuedPrompt:ee,editLastQueuedPrompt:re,clearQueuedPrompts:Q}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function g7(e){var t;return!((t=e==null?void 0:e.rawInput)!=null&&t.questions)||!Array.isArray(e.rawInput.questions)?!1:e.toolName?Gc(e.toolName):!0}const Ent=3e4;function U2(e){return f_.includes(e)}async function Ant({sessionActions:e,modelId:t,modeId:n,workspaceCwd:s,onSessionCreated:r,onSessionAllocated:i,getCurrentSessionId:o,warn:a=console.warn}){const l=n&&U2(n)?n:void 0,{sessionId:c}=await e.createSession({workspaceCwd:s,...l?{approvalMode:l}:{}});i==null||i(c);let d="prepare new session";try{if(r){d="run onSessionCreated";let p;try{await Promise.race([r(c),new Promise((g,y)=>{p=setTimeout(()=>y(new Error("onSessionCreated timed out")),Ent)})])}finally{clearTimeout(p)}}d="verify session identity";const h=o();if(h!==void 0&&h!==c)throw new Error(`Session changed before attach: expected ${c}, found ${h}`);d="attach new session",await e.attachSession(),d="verify attached session";const f=o();if(f!==void 0&&f!==c)throw new Error(`Session changed while attaching: expected ${c}, found ${f}`)}catch(h){a(`[WebShell] failed to ${d}:`,h),await e.releaseSession(c).catch(p=>{a("[WebShell] failed to release unattached session:",p)});const f=o();throw f===void 0||f===c?await e.clearSession().catch(p=>{a("[WebShell] failed to clear unattached session:",p)}):a(`[WebShell] skipping clearSession: expected ${c}, found ${f}`),h}t&&await e.setModel(t).catch(h=>{a("[WebShell] failed to set model for new session:",h)})}/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */const Mnt=new Set(["coder-model(qwen-oauth)"]);function k1(e){return!Mnt.has(e.id)}function Lte(e){return[{name:"help",description:e("local.help")},{name:"theme",description:e("local.theme"),argumentHint:"light|dark",subcommands:["light","dark"]},{name:"language",description:e("local.language"),argumentHint:"ui [en|zh-CN]",subcommands:["ui"]},{name:"plan",description:e("local.plan"),argumentHint:"<prompt>"},{name:"btw",description:e("local.btw"),argumentHint:"<your question>"},{name:"copy",description:e("local.copy"),argumentHint:"[code|<lang>|latex|inline-latex] [index]"},{name:"delete",description:e("local.delete")},{name:"release",description:e("local.release")},{name:"auth",description:e("local.auth")},{name:"approval-mode",description:e("local.approvalMode"),argumentHint:"<mode>"},{name:"model",description:e("local.model"),argumentHint:"[--fast|--voice|--vision] [<model>]"},{name:"mcp",description:e("local.mcp"),argumentHint:"desc|nodesc|schema"},{name:"skills",description:e("local.skills")},{name:"status",description:e("local.status")},{name:"stats",description:e("local.stats"),argumentHint:"[model|tools]",subcommands:["model","tools"]},{name:"tools",description:e("local.tools"),argumentHint:"[desc]"},{name:"memory",description:e("local.memory")},{name:"context",description:e("local.context"),argumentHint:"[detail]"},{name:"agents",description:e("local.agents"),argumentHint:"manage|create"},{name:"goal",description:e("local.goal"),argumentHint:"[<condition> | clear]"},{name:"tasks",description:e("local.tasks")},{name:"recap",description:e("local.recap")},{name:"rewind",description:e("local.rewind")},{name:"branch",description:e("local.branch"),argumentHint:"[<name>]"},{name:"fork",description:e("local.fork"),argumentHint:"<directive>"},{name:"clear",description:e("local.clear")},{name:"new",description:e("local.new")},{name:"reset",description:e("local.reset")},{name:"rename",description:e("local.rename"),argumentHint:"[--auto] [<name>]"},{name:"resume",description:e("local.resume"),argumentHint:"<session-id>"},{name:"settings",description:e("local.settings")},{name:"schedule",description:e("local.schedule")},{name:"extensions",description:e("local.extensions"),argumentHint:"manage|install <source>",subcommands:["manage","install"]}].map(n=>({...n,source:"builtin-command"}))}const Nnt={bug:"local.bug",compress:"local.compress","compress-fast":"local.compressFast",config:"local.config",diff:"local.diff",directory:"local.directory",docs:"local.docs",doctor:"local.doctor",dream:"local.dream",effort:"local.effort",export:"local.export",forget:"local.forget",hooks:"local.hooks","import-config":"local.importConfig",init:"local.init",insight:"local.insight",lsp:"local.lsp",remember:"local.remember",summary:"local.summary",workflows:"local.workflows"},Int={batch:"skilldesc.batch",dataviz:"skilldesc.dataviz","extension-creator":"skilldesc.extensionCreator",loop:"skilldesc.loop","new-app":"skilldesc.newApp","qc-helper":"skilldesc.qcHelper",review:"skilldesc.review",simplify:"skilldesc.simplify",stuck:"skilldesc.stuck","agent-reproduce-align":"skilldesc.agentReproduceAlign","agent-reproduce-feature":"skilldesc.agentReproduceFeature",autofix:"skilldesc.autofix",bugfix:"skilldesc.bugfix",codegraph:"skilldesc.codegraph","create-issue":"skilldesc.createIssue","desktop-pet":"skilldesc.desktopPet","docs-audit-and-refresh":"skilldesc.docsAuditAndRefresh","docs-update-from-diff":"skilldesc.docsUpdateFromDiff","e2e-testing":"skilldesc.e2eTesting","feat-dev":"skilldesc.featDev","memory-leak-debug":"skilldesc.memoryLeakDebug","openwork-desktop-sync":"skilldesc.openworkDesktopSync","prepare-pr":"skilldesc.preparePr","qwen-code-claw":"skilldesc.qwenCodeClaw","structured-debugging":"skilldesc.structuredDebugging","terminal-capture":"skilldesc.terminalCapture","tmux-real-user-testing":"skilldesc.tmuxRealUserTesting",triage:"skilldesc.triage"};function Dte(e){return Int[e]}function Ote(e,t){return e.map(n=>{const s=Nnt[n.name];return!s||n.source&&n.source!=="builtin-command"?n:{...n,description:t(s)}})}function Pte(...e){const t=new Map;for(const n of e)for(const s of n){const r=t.get(s.name);r?t.set(s.name,{...r,...s,description:s.description||r.description,argumentHint:s.argumentHint??r.argumentHint}):t.set(s.name,s)}return[...t.values()]}const Rnt="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='12.400195360183716'%20height='13.973437547683716'%20viewBox='0%200%2012.400195360183716%2013.973437547683716'%3e%3cpath%20d='M8.200192523841858,3.504687623841858L4.200002823841858,3.504687623841858L2.999997223841858,3.504690323841858L2.400195323841858,3.504687623841858L2.400195323841858,10.305688523841859L2.400198123841858,10.905691023841857L1.200192573841858,10.905691023841857L1.200195313841858,10.305688523841859L1.2001953738418578,3.504687623841858L0.6000000238418579,3.504687623841858L-0.0000027461581421084347,3.504690323841858L-0.0000027461581421084347,2.304684723841858L0.6000000238418579,2.304687523841858L2.999999923841858,2.304687523841858L2.999999923841858,3.8418579428878274e-9L9.400195723841858,3.8418579428878274e-9L9.400195723841858,2.304687523841858L11.800195023841859,2.304687523841858L12.400198023841858,2.304684723841858L12.400198023841858,3.504690323841858L11.800195023841859,3.5046874238418577L11.200000023841858,3.504687623841858L11.200000023841858,13.973437023841857L1.800195323841858,13.973437023841857L1.200192573841858,13.973440023841858L1.200192573841858,12.773435023841857L1.800195323841858,12.773437023841858L10.000000623841858,12.773437023841858L10.000000623841858,3.504687623841858L9.400197623841859,3.504687623841858L8.200192523841858,3.504690323841858L8.200192523841858,3.504687623841858ZM8.200195423841858,2.304687523841858L8.200195423841858,1.2000000438418579L4.199999923841858,1.2000000438418579L4.199999923841858,2.304687523841858L8.200195423841858,2.304687523841858ZM4.266598823841858,6.2031222238418575L4.266601723841858,6.803125023841858L4.266601723841858,9.482812523841858L4.266598823841858,10.082814823841858L5.466604323841858,10.082814823841858L5.466601523841858,9.482812523841858L5.466601523841858,6.803125023841858L5.466604323841858,6.2031222238418575L4.266598823841858,6.2031222238418575ZM6.933591023841858,6.2031222238418575L6.933593823841858,6.803125023841858L6.933593823841858,9.482812523841858L6.933591023841858,10.082814823841858L8.133596523841858,10.082814823841858L8.133593723841859,9.482812523841858L8.133593723841859,6.803125023841858L8.133596523841858,6.2031222238418575L6.933591023841858,6.2031222238418575Z'%20fill-rule='evenodd'%20fill='%23747476'%20fill-opacity='1'/%3e%3c/svg%3e",jnt="/assets/insert-DmRbh9Rv.svg",Lnt="/assets/queue-DWpnpFgW.svg",Dnt="_app_inyns_1",Ont="_appChat_inyns_36",Pnt="_appChatEmpty_inyns_42",Bnt="_appShell_inyns_47",$nt="_chatPane_inyns_55",znt="_artifactResizeHandle_inyns_64",Fnt="_chatPaneShowingPage_inyns_84",qnt="_fullPage_inyns_90",Hnt="_fullPageHeader_inyns_99",Unt="_splitApprovalNotice_inyns_109",Vnt="_fullPageBack_inyns_135",Wnt="_fullPageTitle_inyns_152",Gnt="_fullPageBody_inyns_157",Knt="_mobileDrawer_inyns_164",Ynt="_mobileBackdrop_inyns_168",Xnt="_hamburgerButton_inyns_172",Qnt="_mobileDrawerOpen_inyns_217",Jnt="_hamburgerButtonFloating_inyns_252",Znt="_appWithSidebar_inyns_260",est="_themeDark_inyns_296",tst="_themeLight_inyns_364",nst="_content_inyns_432",sst="_contentHasMessages_inyns_440",rst="_missingSessionState_inyns_449",ist="_missingSessionMessage_inyns_462",ost="_missingSessionButton_inyns_469",ast="_panelHost_inyns_504",lst="_panelHeader_inyns_512",cst="_panelBack_inyns_522",ust="_panelTitle_inyns_548",dst="_panelBody_inyns_557",hst="_chatViewWrap_inyns_567",fst="_chatViewHidden_inyns_575",mst="_chatSubtree_inyns_579",pst="_chatSubtreeHidden_inyns_583",gst="_footer_inyns_596",yst="_bottomPanels_inyns_606",bst="_approvalOverlay_inyns_621",vst="_scrollToBottomLayer_inyns_635",wst="_scrollToBottomLayerWithTodos_inyns_646",xst="_scrollToBottomButton_inyns_653",kst="_scrollToBottomIcon_inyns_682",_st="_btwPanel_inyns_688",Sst="_composer_inyns_695",Cst="_composerHeader_inyns_700",Tst="_customFooter_inyns_704",Est="_escClearStatus_inyns_710",Ast="_emptyWelcomeFooter_inyns_717",Mst="_mobileWelcomeFooterMiddle_inyns_721",Nst="_mobileWelcomeGroup_inyns_725",Ist="_chatPaneWithMobileComposerBottom_inyns_730",Rst="_chatViewWithMobileComposerBottom_inyns_735",jst="_chatViewWithWelcomeMiddle_inyns_748",Lst="_footerWithCustomFooter_inyns_748",Dst="_desktopWelcomeFooter_inyns_782",Ost="_queuedPrompts_inyns_791",Pst="_queuedPrompt_inyns_791",Bst="_queuedPromptIcon_inyns_821",$st="_queuedPromptMaskIcon_inyns_831",zst="_queuedPromptActionIcon_inyns_832",Fst="_queuedPromptText_inyns_845",qst="_queuedPromptState_inyns_853",Hst="_queuedPromptSpinner_inyns_861",Ust="_queuedPromptActions_inyns_876",Vst="_queuedPromptAction_inyns_832",Wst="_queuedHint_inyns_921",Lt={app:Dnt,appChat:Ont,appChatEmpty:Pnt,appShell:Bnt,chatPane:$nt,artifactResizeHandle:znt,chatPaneShowingPage:Fnt,fullPage:qnt,fullPageHeader:Hnt,splitApprovalNotice:Unt,fullPageBack:Vnt,fullPageTitle:Wnt,fullPageBody:Gnt,mobileDrawer:Knt,mobileBackdrop:Ynt,hamburgerButton:Xnt,mobileDrawerOpen:Qnt,hamburgerButtonFloating:Jnt,appWithSidebar:Znt,themeDark:est,themeLight:tst,content:nst,contentHasMessages:sst,missingSessionState:rst,missingSessionMessage:ist,missingSessionButton:ost,panelHost:ast,panelHeader:lst,panelBack:cst,panelTitle:ust,panelBody:dst,chatViewWrap:hst,chatViewHidden:fst,chatSubtree:mst,chatSubtreeHidden:pst,footer:gst,bottomPanels:yst,approvalOverlay:bst,scrollToBottomLayer:vst,scrollToBottomLayerWithTodos:wst,scrollToBottomButton:xst,scrollToBottomIcon:kst,btwPanel:_st,composer:Sst,composerHeader:Cst,customFooter:Tst,escClearStatus:Est,emptyWelcomeFooter:Ast,mobileWelcomeFooterMiddle:Mst,mobileWelcomeGroup:Nst,chatPaneWithMobileComposerBottom:Ist,chatViewWithMobileComposerBottom:Rst,chatViewWithWelcomeMiddle:jst,footerWithCustomFooter:Lst,desktopWelcomeFooter:Dst,queuedPrompts:Ost,queuedPrompt:Pst,queuedPromptIcon:Bst,queuedPromptMaskIcon:$st,queuedPromptActionIcon:zst,queuedPromptText:Fst,queuedPromptState:qst,queuedPromptSpinner:Hst,queuedPromptActions:Ust,queuedPromptAction:Vst,queuedHint:Wst},B$=240;function Bte({prompts:e,t,onDelete:n,onInsert:s,onEdit:r}){return e.length===0?null:u.jsxs("div",{className:Lt.queuedPrompts,children:[e.map(i=>{var v;const o=i.text.replace(/\s+/g," ").trim(),a=o.length>B$?`${o.slice(0,B$)}...`:o,l=((v=i.images)==null?void 0:v.length)??0,c=Rte(i.text),d=i.serverState==="submitting",h=i.serverState==="running",f=i.isRemoving===!0,p=d||h||i.isEditing===!0||f;let g=t("queue.insertTip");p?g=t("queue.submittingDisabled"):c&&(g=t("queue.insertCommandDisabled"));let y=t("queue.editTip");p&&(y=t("queue.submittingDisabled"));const w=t(p?"queue.submittingDisabled":"queue.deleteTip");return u.jsxs("div",{className:Lt.queuedPrompt,children:[u.jsx("span",{className:Lt.queuedPromptIcon,"aria-hidden":"true",children:u.jsx("span",{className:Lt.queuedPromptMaskIcon,style:Xd("--queued-icon-url",Lnt)})}),u.jsxs("span",{className:Lt.queuedPromptText,children:[a,l>0?` ${t("queue.imageCount",{count:l})}`:"",d||i.isEditing||f?u.jsxs("span",{className:Lt.queuedPromptState,children:[u.jsx("span",{className:Lt.queuedPromptSpinner}),f?t("queue.removing"):i.isEditing?t("queue.editing"):t("queue.submitting")]}):null]}),u.jsxs("span",{className:Lt.queuedPromptActions,children:[l===0&&u.jsxs("button",{type:"button",className:Lt.queuedPromptAction,onClick:()=>s(i.id),disabled:c||p,title:g,children:[u.jsx("span",{className:Lt.queuedPromptActionIcon,style:Xd("--queued-icon-url",jnt),"aria-hidden":"true"}),t("queue.insert")]}),u.jsx("button",{type:"button",className:Lt.queuedPromptAction,onClick:()=>n(i.id),disabled:p,"aria-label":t("queue.delete"),title:w,children:u.jsx("span",{className:Lt.queuedPromptActionIcon,style:Xd("--queued-icon-url",Rnt),"aria-hidden":"true"})}),u.jsx("button",{type:"button",className:Lt.queuedPromptAction,onClick:()=>r(i.id),disabled:p,"aria-label":t("queue.edit"),title:y,children:u.jsx("span",{className:Lt.queuedPromptActionIcon,style:Xd("--queued-icon-url",XQ),"aria-hidden":"true"})})]})]},i.id)}),u.jsx("div",{className:Lt.queuedHint,children:t("queue.footer")})]})}const Gst="_approval_j86la_1",Kst="_floating_j86la_18",Yst="_header_j86la_31",Xst="_icon_j86la_41",Qst="_name_j86la_56",Jst="_desc_j86la_67",Zst="_content_j86la_87",ert="_code_j86la_105",trt="_codeBlock_j86la_113",nrt="_question_j86la_133",srt="_options_j86la_139",rrt="_option_j86la_139",irt="_optionPlain_j86la_167",ort="_optionSecondary_j86la_177",art="_optionPrimary_j86la_184",lrt="_optionActive_j86la_195",crt="_pointer_j86la_199",urt="_num_j86la_203",drt="_label_j86la_207",Yr={approval:Gst,floating:Kst,header:Yst,icon:Xst,name:Qst,desc:Jst,content:Zst,code:ert,codeBlock:trt,question:nrt,options:srt,option:rrt,optionPlain:irt,optionSecondary:ort,optionPrimary:art,optionActive:lrt,pointer:crt,num:urt,label:drt};function hrt(e){if(!e)return{toolName:"",description:""};const t=e.indexOf(": ");if(t>0){const n=e.slice(0,t);return/^[A-Za-z][\w.-]{0,40}$/.test(n)?{toolName:n,description:e.slice(t+2)}:{toolName:e,description:""}}return{toolName:e,description:""}}function frt(e){const t=[];for(const n of e.content)n.type==="text"&&n.text&&t.push(n.text);return t.join(`
`)}function mrt(e){var n;const t=(n=e.toolName)==null?void 0:n.toLowerCase();return e.kind==="bash"||e.kind==="exec"||e.kind==="execute"||e.kind==="shell"||t==="run_shell_command"}function prt(e){if(!e.rawInput)return null;const t=e.rawInput;return typeof t.command=="string"?t.command:typeof t.input=="string"?t.input:null}function grt(e){var n;const t=(n=e.rawInput)==null?void 0:n.description;return typeof t=="string"&&t.trim()?t.trim():e.title}function $$(e){if(e.length>1&&(e[0].kind==="allow_always"||e[0].kind==="reject_always")){const t=e.findIndex(n=>n.kind==="allow_once"||n.kind==="reject_once");return t>=0?t:1}return 0}function z$(e){return e.kind==="reject_once"||e.kind==="reject_always"?0:e.kind==="allow_always"&&e.id==="proceed_always_user"?1:e.kind==="allow_always"&&e.id==="proceed_always_project"?2:e.kind==="allow_always"&&(e.id==="proceed_always_server"||e.id==="proceed_always_tool")||e.kind==="allow_always"?3:e.kind==="allow_once"?4:5}function Gw(e){return e.map((t,n)=>({option:t,index:n})).sort((t,n)=>{const s=z$(t.option)-z$(n.option);return s===0?t.index-n.index:s}).map(({option:t})=>t)}function yrt(e){if(e.kind==="allow_once")return"approval.option.allowOnce";if(e.kind==="reject_once")return"approval.option.rejectOnce";if(e.kind==="allow_always"){if(e.id==="proceed_always_project")return"approval.option.allowAlwaysProject";if(e.id==="proceed_always_user")return"approval.option.allowAlwaysUser";if(e.id==="proceed_always_server")return"approval.option.allowAlwaysServer";if(e.id==="proceed_always_tool")return"approval.option.allowAlwaysTool";if(e.id==="proceed_always")return"approval.option.allowAllEdits"}}function brt(e){return e.kind==="allow_once"?Yr.optionPrimary:e.kind==="allow_always"?Yr.optionSecondary:e.kind==="reject_once"||e.kind==="reject_always"?Yr.optionPlain:Yr.optionSecondary}function $te({request:e,onConfirm:t,variant:n="inline",keyboardActive:s=!0}){const{t:r}=ot(),i=m.useMemo(()=>Gw(e.options),[e.options]),[o,a]=m.useState(()=>$$(Gw(e.options))),l=m.useRef(e);l.current=e;const c=m.useRef(o),d=m.useRef(!1),h=m.useRef(!1);m.useEffect(()=>{const C=$$(Gw(l.current.options));d.current=!1,h.current=!1,c.current=C,a(C)},[e.id]);const f=hrt(e.title),p=e.toolName||f.toolName||e.kind||"Tool",g=Wc(p,r),y=grt(e),w=frt(e),v=m.useCallback(C=>{d.current||(d.current=!0,t(l.current.id,C))},[t]),b=m.useCallback(C=>{if(C.defaultPrevented||Yy(C.target))return;const S=l.current,_=Gw(S.options),L=_.length;if(C.key==="ArrowUp"||C.key==="k")C.preventDefault(),h.current=!0,a(M=>{const I=(M-1+L)%L;return c.current=I,I});else if(C.key==="ArrowDown"||C.key==="j")C.preventDefault(),h.current=!0,a(M=>{const I=(M+1)%L;return c.current=I,I});else if(C.key==="Enter"){if(C.preventDefault(),!h.current){h.current=!0;return}const M=_[c.current];M&&v(M.id)}else if(C.key==="Escape"){C.preventDefault();const M=S.options.find(I=>I.kind==="reject_once"||I.kind==="reject_always");M&&v(M.id)}else if(C.key>="1"&&C.key<="9"){const M=parseInt(C.key)-1;M<L&&(C.preventDefault(),h.current=!0,v(_[M].id))}},[v]);m.useEffect(()=>{if(!s)return;const C=setTimeout(()=>{window.addEventListener("keydown",b)},250);return()=>{clearTimeout(C),window.removeEventListener("keydown",b)}},[b,s]);const x=mrt(e),k=joe(e.toolName),T=prt(e);return u.jsxs("div",{className:n==="floating"?`${Yr.approval} ${Yr.floating}`:Yr.approval,"data-web-shell-permission-panel":!0,children:[u.jsxs("div",{className:Yr.header,children:[u.jsx("span",{className:Yr.icon,children:"?"}),u.jsx("span",{className:Yr.name,children:g})]}),y&&u.jsx("div",{className:Yr.desc,title:y,children:y}),x&&T?u.jsx("div",{className:Yr.code,children:u.jsx("pre",{className:Yr.codeBlock,title:T,children:T})}):w&&w!==e.title?u.jsx("pre",{className:Yr.content,title:w,children:w}):null,u.jsx("div",{className:Yr.question,children:k?r("approval.launchAgentQuestion"):x?r("approval.execQuestion",{tool:g}):r("approval.changeQuestion")}),u.jsx("div",{className:Yr.options,children:i.map((C,S)=>{const _=S===o,L=yrt(C),M=L?r(L):C.label;return u.jsxs("div",{className:`${Yr.option} ${brt(C)} ${_?Yr.optionActive:""}`,"data-web-shell-permission-option":!0,"data-option-id":C.id,onClick:()=>v(C.id),children:[u.jsx("span",{className:Yr.pointer,children:_?"›":" "}),u.jsxs("span",{className:Yr.num,children:[S+1,"."]}),u.jsx("span",{className:Yr.label,children:M})]},C.id)})})]})}const vrt="_question_14a07_1",wrt="_floating_14a07_18",xrt="_titleLine_14a07_30",krt="_icon_14a07_38",_rt="_toolName_14a07_42",Srt="_toolDesc_14a07_46",Crt="_tabs_14a07_53",Trt="_topRight_14a07_63",Ert="_collapseButton_14a07_70",Art="_collapseIcon_14a07_89",Mrt="_collapseIconCollapsed_14a07_95",Nrt="_collapsed_14a07_99",Irt="_tab_14a07_53",Rrt="_tabActive_14a07_118",jrt="_text_14a07_135",Lrt="_description_14a07_143",Drt="_multiHint_14a07_151",Ort="_options_14a07_157",Prt="_option_14a07_157",Brt="_optionActive_14a07_179",$rt="_optionSelected_14a07_180",zrt="_optionLabel_14a07_185",Frt="_pointer_14a07_190",qrt="_optionNum_14a07_194",Hrt="_editIcon_14a07_211",Urt="_optionContent_14a07_243",Vrt="_optionPlaceholder_14a07_259",Wrt="_optionDesc_14a07_264",Grt="_customInput_14a07_271",Krt="_actions_14a07_288",Yrt="_button_14a07_296",Xrt="_submitButton_14a07_322",Qrt="_ignoreButton_14a07_328",ns={question:vrt,floating:wrt,titleLine:xrt,icon:krt,toolName:_rt,toolDesc:Srt,tabs:Crt,topRight:Trt,collapseButton:Ert,collapseIcon:Art,collapseIconCollapsed:Mrt,collapsed:Nrt,tab:Irt,tabActive:Rrt,text:jrt,description:Lrt,multiHint:Drt,options:Ort,option:Prt,optionActive:Brt,optionSelected:$rt,optionLabel:zrt,pointer:Frt,optionNum:qrt,editIcon:Hrt,optionContent:Urt,optionPlaceholder:Vrt,optionDesc:Wrt,customInput:Grt,actions:Krt,button:Yrt,submitButton:Xrt,ignoreButton:Qrt};function zte({request:e,onConfirm:t,variant:n="inline"}){const{t:s}=ot(),r=m.useMemo(()=>{var z;return Array.isArray((z=e.rawInput)==null?void 0:z.questions)?e.rawInput.questions:[]},[e.rawInput]),[i,o]=m.useState(0),[a,l]=m.useState(null),[c,d]=m.useState({}),[h,f]=m.useState({}),[p,g]=m.useState({}),[y,w]=m.useState(!1),[v,b]=m.useState(!1),x=m.useRef(!1);m.useEffect(()=>{const z=r[0];x.current=!1,b(!1),o(0),l(z!=null&&z.options.length?0:null),d(z&&!z.multiSelect&&z.options[0]?{0:z.options[0].label}:{}),f({}),g(z!=null&&z.multiSelect&&z.options[0]?{0:[z.options[0].label]}:{}),w(!1)},[r,e.id]);const k=r[i],T=(k==null?void 0:k.multiSelect)??!1,C=m.useCallback(()=>{const z={};for(let U=0;U<r.length;U++){const D=r[U];if(D)if(D.multiSelect){const G=p[U]||[],q=h[U],N=q?[...G,q]:G;z[String(U)]=N.join(", ")}else z[String(U)]=c[U]||h[U]||""}return z},[r,p,h,c]),S=m.useCallback(()=>{if(x.current)return;const z=e.options.find(U=>U.kind==="allow_once");z&&(x.current=!0,t(e.id,z.id,C()))},[C,e,t]),_=m.useCallback(()=>{if(x.current)return;const z=e.options.find(U=>U.kind==="reject_once"||U.kind==="reject_always");z&&(x.current=!0,t(e.id,z.id,void 0))},[e,t]),L=m.useCallback(z=>{z!==void 0&&f(U=>({...U,[i]:z})),T||d(U=>{if(!(i in U))return U;const D={...U};return delete D[i],D}),w(!0)},[i,T]),M=m.useCallback(z=>{if(!k)return;if(z===k.options.length){L();return}const D=k.options[z].label;if(T){const G=p[i]||[],q=G.includes(D)?G.filter(N=>N!==D):[...G,D];g({...p,[i]:q})}else{const G={...c,[i]:D};d(G),f(q=>{if(!(i in q))return q;const N={...q};return delete N[i],N})}},[k,i,T,p,c,L]),I=m.useCallback(z=>{if(!k||!T)return;if(z===k.options.length){L();return}const U=k.options[z].label,D=p[i]||[],G=D.includes(U)?D.filter(q=>q!==U):[...D,U];g({...p,[i]:G})},[k,T,p,i,L]);if(r.length===0)return null;const A=z=>{const U=r[z];return U?U.multiSelect?(p[z]||[]).length>0||!!h[z]:!!c[z]||!!h[z]:!1},P=r.every((z,U)=>A(U)),B=Math.min(i,r.length-1),F=z=>{const U=r[z];if(o(z),w(!1),!(U!=null&&U.options.length)){l(null);return}if(l(0),U.multiSelect){g(D=>(D[z]||[]).length>0||h[z]?D:{...D,[z]:[U.options[0].label]});return}d(D=>D[z]||h[z]?D:{...D,[z]:U.options[0].label})},O=()=>{i<=0||F(i-1)},X=()=>{i>=r.length-1||F(i+1)};return u.jsxs("div",{className:`${ns.question} ${n==="floating"?ns.floating:""} ${v?ns.collapsed:""}`,children:[u.jsxs("div",{className:ns.titleLine,children:[u.jsx("span",{className:ns.icon,children:"?"}),u.jsx("span",{className:ns.toolName,children:Wc("ask_user_question",s)}),u.jsx("span",{className:ns.toolDesc,children:s("askUser.progress",{current:B+1,total:r.length})}),u.jsxs("div",{className:ns.topRight,children:[u.jsx("div",{className:ns.tabs,children:r.map((z,U)=>u.jsx("span",{className:`${ns.tab} ${U===i?ns.tabActive:""}`,"aria-hidden":"true"},U))}),u.jsx("button",{type:"button",className:ns.collapseButton,onClick:()=>b(z=>!z),"aria-expanded":!v,"aria-label":s(v?"common.expand":"common.collapse"),title:s(v?"common.expand":"common.collapse"),children:u.jsx("svg",{viewBox:"0 0 16 16",className:`${ns.collapseIcon} ${v?ns.collapseIconCollapsed:""}`,children:u.jsx("path",{d:"M4 6l4 4 4-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})})})]})]}),!v&&u.jsxs(u.Fragment,{children:[k?u.jsxs(u.Fragment,{children:[u.jsxs("p",{className:ns.text,children:[k.question,T&&u.jsxs("span",{className:ns.multiHint,children:[" ","(",s("askUser.multiHint"),")"]})]}),u.jsx("p",{className:ns.description,children:s("askUser.selectAnswer")}),u.jsxs("div",{className:ns.options,onMouseLeave:()=>l(null),children:[k.options.map((z,U)=>{const D=U===a,G=T?(p[i]||[]).includes(z.label):c[i]===z.label;return u.jsxs("div",{className:`${ns.option} ${D?ns.optionActive:""} ${G?ns.optionSelected:""}`,onClick:()=>{l(U),T?I(U):M(U)},onMouseEnter:()=>l(U),children:[u.jsx("span",{className:ns.pointer,children:D?"›":" "}),u.jsx("span",{className:ns.optionNum,children:U+1}),u.jsxs("span",{className:ns.optionContent,children:[u.jsx("span",{className:ns.optionLabel,children:z.label}),z.description&&u.jsx("span",{className:ns.optionDesc,children:z.description})]})]},z.label)}),(()=>{const z=a===k.options.length,U=!!h[i];return u.jsxs("div",{className:`${ns.option} ${z?ns.optionActive:""} ${U?ns.optionSelected:""}`,onClick:()=>{l(k.options.length),L()},onMouseEnter:()=>l(k.options.length),children:[u.jsx("span",{className:ns.pointer,children:z?"›":" "}),u.jsx("span",{className:ns.editIcon,"aria-hidden":"true",children:u.jsx("svg",{viewBox:"0 0 16 16",children:u.jsx("path",{d:"M3.2 10.9 4 7.8 10.8 1l3.2 3.2-6.8 6.8-3 .8zM10 1.8l3.2 3.2M3 14h10",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})}),y?u.jsx("input",{type:"text",className:ns.customInput,placeholder:s("askUser.typePlaceholder"),value:h[i]||"",onChange:D=>f({...h,[i]:D.target.value}),onBlur:()=>w(!1),autoFocus:!0}):u.jsx("span",{className:`${ns.optionLabel} ${h[i]?"":ns.optionPlaceholder}`,children:h[i]||s("askUser.typePlaceholder")})]})})()]})]}):null,u.jsxs("div",{className:ns.actions,children:[u.jsx("button",{type:"button",className:ns.ignoreButton,onClick:_,children:s("askUser.ignore")}),r.length>1&&u.jsxs(u.Fragment,{children:[u.jsx("button",{type:"button",className:ns.button,disabled:i<=0,onClick:O,children:s("common.previous")}),u.jsx("button",{type:"button",className:ns.button,disabled:i>=r.length-1,onClick:X,children:s("common.next")})]}),u.jsx("button",{type:"button",className:`${ns.button} ${ns.submitButton}`,disabled:!P,onClick:S,children:s("askUser.submit")})]})]})]})}const Jrt=1e6;function Fte(e){const t=new Set;e.callId&&t.add(e.callId),e.parentToolCallId&&t.add(e.parentToolCallId);for(const n of e.subTools??[])for(const s of Fte(n))t.add(s);return Array.from(t)}function qte(e,t,n){const s=new Map,r=[];let i=null;for(const a of e){if(a.role==="user"||a.role==="user_shell"){i=a.id;continue}if(i||(i=a.id),a.role==="tool_group")for(const l of a.tools){for(const c of Fte(l))s.set(c,i);Hte(l,i,r)}}const o=new Map;for(const a of t){const l=Zrt(r,a,n);if(l.size===0&&a.toolCallId){const c=s.get(a.toolCallId);c&&l.add(c)}for(const c of l){const d=o.get(c);d?d.some(h=>h.id===a.id)||d.push(a):o.set(c,[a])}}return o}function Hte(e,t,n){e.toolName.toLowerCase()==="record_artifact"&&n.push({turnId:t,workspacePath:ku(e.args,"workspacePath"),managedId:ku(e.args,"managedId"),url:ku(e.args,"url")});for(const s of e.subTools??[])Hte(s,t,n)}function Zrt(e,t,n){const s=new Set;for(const r of e){if(r.workspacePath&&t.workspacePath&&Qte(r.workspacePath,t.workspacePath,n)){s.add(r.turnId);continue}if(r.managedId&&r.managedId===t.managedId){s.add(r.turnId);continue}r.url&&r.url===t.url&&s.add(r.turnId)}return s}function Ute(e,t,n){const s=new Map;let r=null;for(const i of e){if(i.role==="user"||i.role==="user_shell"){r=i.id;continue}if(r||(r=i.id),i.role!=="tool_group")continue;const o=new Set((t.get(r)??[]).map(a=>im(a.workspacePath)).filter(a=>!!a));for(const a of i.tools)Gte(a,r,o,s,n)}return s}function Vte(e){const t=new Map;let n=null;for(const s of e){if(s.role==="user"||s.role==="user_shell"){n=s.id;continue}if(n||(n=s.id),s.role==="tool_group")for(const r of s.tools)Wte(r,n,t)}return t}function Wte(e,t,n){const s=eit(e);if(s){const r=n.get(t);r?r.push(s):n.set(t,[s])}for(const r of e.subTools??[])Wte(r,t,n)}function eit(e){if(e.status!=="completed"||e.toolName.toLowerCase()!=="cron_create")return null;const t=BM(e);if(t!=null&&t.error)return null;const n=ku(e.args,"cron"),s=ku(e.args,"prompt");if(!n||!s)return null;const r=ku(t,"returnDisplay")??ku(t,"llmContent")??(typeof e.rawOutput=="string"?e.rawOutput:void 0),i=r?Kte(r):void 0;return{id:r?oit(r)??e.callId:e.callId,toolCallId:e.callId,title:ait(s),cron:n,prompt:s,recurring:F$(e.args,"recurring")??!0,durable:F$(e.args,"durable")??!1,...i?{display:i}:{}}}function Gte(e,t,n,s,r){const i=tit(e,n,r);if(i){const o=s.get(t);o?lit(o,i):s.set(t,[i])}for(const o of e.subTools??[])Gte(o,t,n,s,r)}function tit(e,t,n){if(e.status!=="completed")return null;const s=e.toolName.toLowerCase();if(s!=="write_file"&&s!=="edit")return null;const r=nit(e);if(!r)return null;const i=im(r),o=sit(e),a=iit(e),l=rit(a);return{path:r,status:o,toolCallId:e.callId,isArtifact:Array.from(t).some(c=>Qte(i,c,n)),...l?{additions:l.additions,deletions:l.deletions}:{},diffs:a}}function nit(e){var n,s;const t=zx(e.args,"file_path","filePath","path");if(t!==void 0&&t.length>0)return t;for(const r of e.content??[])if(r.path)return r.path;return(s=(n=e.locations)==null?void 0:n[0])==null?void 0:s.file}function ku(e,...t){if(e)for(const n of t){const s=e[n];if(typeof s=="string"&&s.trim())return s}}function zx(e,...t){if(e)for(const n of t){const s=e[n];if(typeof s=="string")return s}}function sit(e){if(e.toolName.toLowerCase()==="write_file")return"created";const t=BM(e),n=(ku(t,"returnDisplay")??"").toLowerCase();return n.includes("created new file")||n.includes("successfully created")||n.includes("created and wrote")?"created":"modified"}function rit(e){const t=Yte(e);return t?Xte(t.oldText,t.newText):void 0}function iit(e){const t=BM(e),n=zx(t,"originalContent"),s=zx(t,"newContent");if(n!==void 0||s!==void 0)return[{oldText:n??"",newText:s??"",fileDiff:ku(t,"fileDiff"),fullContent:!0}];const r=[];for(const i of e.content??[])i.type==="diff"&&r.push({oldText:i.oldText??"",newText:i.newText??""});if(r.length>0)return r;if(e.toolName.toLowerCase()==="write_file"){const i=zx(e.args,"content");return i!==void 0?[{oldText:"",newText:i,fullContent:!0}]:[]}return[]}function BM(e){return e.rawOutput&&typeof e.rawOutput=="object"?e.rawOutput:void 0}function F$(e,t){const n=e==null?void 0:e[t];return typeof n=="boolean"?n:void 0}function Kte(e){return e.split(/\r\n|\r|\n/).map(t=>t.trim()).find(Boolean)}function oit(e){const t=e.match(/\bScheduled\s+(?:(?:recurring job|one-shot task)\s+([a-z0-9_-]+)\b|([a-z0-9_-]+)\s*\()/i);return(t==null?void 0:t[1])??(t==null?void 0:t[2])}function ait(e){const t=Kte(e)??e.trim();return t.length>36?`${t.slice(0,36)}...`:t}function lit(e,t){const n=im(t.path),s=e.findIndex(h=>im(h.path)===n);if(s<0){e.push(t);return}const r=e[s],{additions:i,deletions:o,...a}=r,l=cit(r.diffs,t.diffs),c=Yte(l),d=c?Xte(c.oldText,c.newText):void 0;e[s]={...a,status:r.status==="created"||t.status==="created"?"created":"modified",isArtifact:r.isArtifact||t.isArtifact,...d?{additions:d.additions,deletions:d.deletions}:{},diffs:l}}function cit(e,t){const n=[...e,...t];if(!n.every(i=>i.fullContent))return n;const s=n[0],r=n.at(-1);return!s||!r?n:[{oldText:s.oldText,newText:r.newText,fullContent:!0}]}function Yte(e){const t=e.at(-1);return t!=null&&t.fullContent?t:void 0}function Xte(e,t){const n=q$(e),s=q$(t);if(n.length*s.length>Jrt)return;const r=uit(n,s);return{additions:s.length-r,deletions:n.length-r}}function q$(e){return e?e.replace(/\r?\n$/,"").split(/\r\n|\r|\n/):[]}function uit(e,t){const n=new Array(t.length+1).fill(0),s=new Array(t.length+1).fill(0);for(const r of e){for(let i=0;i<t.length;i++)s[i+1]=r===t[i]?n[i]+1:Math.max(n[i+1],s[i]);for(let i=0;i<s.length;i++)n[i]=s[i];s.fill(0)}return n[t.length]??0}function Qte(e,t,n){return BQ(e,t,n)}const dit="_pane_1w7yf_1",hit="_header_1w7yf_13",fit="_connectionError_1w7yf_25",mit="_connectionErrorText_1w7yf_33",pit="_title_1w7yf_40",git="_closeButton_1w7yf_51",yit="_body_1w7yf_71",bit="_footer_1w7yf_79",vit="_approval_1w7yf_85",ic={pane:dit,header:hit,connectionError:fit,connectionErrorText:mit,title:pit,closeButton:git,body:yit,footer:bit,approval:vit},H$=["approvalMode","model","voice"];function wit({title:e,workspaceCwd:t,onClose:n,onError:s,onRightPanelOpen:r,onPaneArtifactsChange:i,messageTurnOutputs:o}){var at;const{t:a}=ot(),l=Ba(),c=H0(),d=$o(),h=Dh(),f=Nte(a),p=bb(),g=g_(),y=y_(),{artifacts:w}=Ite();m.useEffect(()=>{const Oe=l.sessionId;if(Oe)return i==null||i(Oe,w,d),()=>{i==null||i(Oe,[],d)}},[w,l.sessionId,i,d]);const v=m.useRef(y);v.current=y;const b=m.useRef(null),{followupState:x,onAcceptFollowup:k,onDismissFollowup:T,clear:C}=bU({onAccept:Oe=>{var Fe;(Fe=b.current)==null||Fe.insertText(Oe)}}),S=m.useCallback((Oe,Fe)=>{s?s(Oe,Fe):console.error(Fe,Oe)},[s]),_=m.useCallback(Oe=>g.dispatch([{type:"status",text:Oe}]),[g]),L=m.useMemo(()=>SU(p),[p]),M=g7(L),I=L&&!M?L:null,A=L&&M?L:null,P=m.useRef(I);P.current=I;const B=I!==null||A!==null,F=y!=="idle",O=m.useMemo(()=>qte(f,w,l.workspaceCwd||""),[f,w,l.workspaceCwd]),X=m.useMemo(()=>Ute(f,O,l.workspaceCwd||""),[f,O,l.workspaceCwd]),z=m.useMemo(()=>Vte(f),[f]),U=m.useMemo(()=>new Set(o??zQ),[o]),{queuedPrompts:D,queuedTexts:G,enqueuePrompt:q,removeQueuedPrompt:N,insertQueuedPrompt:ee,editQueuedPrompt:re,editLastQueuedPrompt:Q,clearQueuedPrompts:K}=jte({connected:l.status==="connected",sessionId:l.sessionId,clientId:l.clientId,streamingState:y,sessionActions:c,store:g,editorRef:b,reportError:S,notifySuccess:_,t:a}),se=m.useMemo(()=>{if(F)for(let Oe=f.length-1;Oe>=0;Oe--){const Fe=f[Oe];if((Fe==null?void 0:Fe.role)==="user")return Fe.timestamp}},[f,F]),te=m.useCallback((Oe,Fe,ue,vt)=>{const ye=Oe.trim();if(!ye||l.status!=="connected")return!1;const je=vt==null?void 0:vt.inputAnnotations;return v.current==="idle"?(c.sendPrompt(ye,{...Fe&&Fe.length?{images:Fe}:{},...je?{inputAnnotations:je}:{},onAdmitted:()=>{C(),ue==null||ue()}}).catch(Ye=>S(Ye,"Failed to send prompt")),!1):je?q(ye,Fe,void 0,je):q(ye,Fe)},[c,C,l.status,q,S]),ce=m.useCallback((Oe,Fe,ue)=>{c.submitPermission(Oe,Fe,ue).catch(vt=>S(vt,"Failed to submit permission choice"))},[c,S]),oe=m.useCallback(()=>{c.cancel().catch(Oe=>S(Oe,"Failed to cancel request"))},[c,S]),de=m.useCallback(Oe=>{if(r){if(Oe.kind==="artifact"||Oe.kind==="scheduled_task"){r({...Oe,workspaceActions:d});return}r(Oe)}},[r,d]),Te=m.useMemo(()=>Ote(Pte(l.commands??[],Lte(a)),a).map(Oe=>{const Fe=Dte(Oe.name);return Fe?{...Oe,displayCategory:"skill",description:a(Fe)}:Oe}),[l.commands,a]),qe=m.useMemo(()=>(l.models??[]).filter(k1).map(Oe=>({id:Oe.id,label:Lf(Oe.label||Oe.id)})),[l.models]),Ne=m.useCallback(Oe=>{if(!U2(Oe)){S(new Error(`Unsupported approval mode: ${Oe}`),"Failed to set approval mode");return}c.setApprovalMode(Oe).then(()=>{const Fe=P.current;if(!Fe||!(Oe==="yolo"||Oe==="auto-edit"&&Fe.toolKind==="edit"))return;const vt=Fe.options.find(ye=>ye.kind==="allow_once");vt&&c.submitPermission(Fe.id,vt.id).catch(ye=>S(ye,"Failed to auto-approve tool call"))}).catch(Fe=>S(Fe,"Failed to set approval mode"))},[c,S]),ge=m.useCallback(Oe=>{c.setModel(Oe).catch(Fe=>S(Fe,"Failed to switch model"))},[c,S]),Ee=e||l.displayName||((at=l.sessionId)==null?void 0:at.slice(0,8))||"",_t=t??l.workspaceCwd,Ct=OM(h.capabilities)&&!!_t,Je=m.useMemo(()=>Ct?[...H$,"workspace"]:H$,[Ct]);return u.jsxs("section",{className:ic.pane,"data-testid":"chat-pane","aria-label":Ee,children:[u.jsxs("header",{className:ic.header,children:[u.jsx("span",{className:ic.title,title:Ee,children:Ee}),n&&u.jsx("button",{type:"button",className:ic.closeButton,onClick:n,"aria-label":a("splitView.closePane"),title:a("splitView.closePane"),children:u.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:u.jsx("path",{d:"M6 6l12 12M18 6L6 18",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),l.error&&u.jsx("div",{className:ic.connectionError,role:"alert",children:u.jsxs("span",{className:ic.connectionErrorText,children:[a("splitView.paneConnectionError"),": ",l.error]})}),u.jsx("div",{className:ic.body,children:u.jsx(YQ,{messages:f,pendingApproval:I,loadingTranscript:l.loadingTranscript,catchingUp:l.catchingUp,isResponding:F,workspaceCwd:l.workspaceCwd||"",hideSessionTimeline:!0,turnFileChanges:U.has("file")?X:void 0,turnArtifacts:U.has("artifact")?O:void 0,turnScheduledTasks:U.has("scheduled_task")?z:void 0,onTurnOutputOpen:de})}),u.jsxs("div",{className:ic.footer,children:[I&&u.jsx("div",{className:ic.approval,"data-testid":"pane-approval",children:u.jsx($te,{request:I,onConfirm:ce,variant:"floating",keyboardActive:!1})}),A&&u.jsx("div",{className:ic.approval,"data-testid":"pane-approval",children:u.jsx(zte,{request:A,onConfirm:ce,variant:"floating"})}),u.jsx(dte,{startedAt:se,showPhrase:!1}),u.jsx(Bte,{prompts:D,t:a,onDelete:N,onInsert:ee,onEdit:re}),u.jsx(ute,{ref:b,onSubmit:te,onCancel:oe,isRunning:F,commands:Te,queuedMessages:G,onPopQueuedMessages:Q,onClearQueuedMessages:K,visibleToolbarActions:Je,workspaceName:Ct&&_t?DM(_t):void 0,workspaceTitle:_t,currentMode:l.currentMode??"default",currentModel:l.currentModel??"",availableModels:qe,onSelectMode:Ne,onSelectModel:ge,dialogOpen:B,followupState:x,onAcceptFollowup:k,onDismissFollowup:T,placeholderText:a("splitView.composerPlaceholder")})]})]})}const xit="_split_19ofi_1",kit="_toolbar_19ofi_9",_it="_backButton_19ofi_18",Sit="_title_19ofi_35",Cit="_count_19ofi_40",Tit="_addWrap_19ofi_45",Eit="_addButton_19ofi_50",Ait="_picker_19ofi_70",Mit="_pickerItem_19ofi_87",Nit="_pickerItemLabel_19ofi_102",Iit="_pickerItemWorkspace_19ofi_112",Rit="_panes_19ofi_131",jit="_paneSlot_19ofi_140",Lit="_empty_19ofi_147",Dit="_paneError_19ofi_156",Oit="_paneErrorTitle_19ofi_169",Pit="_paneErrorMessage_19ofi_174",Bit="_paneErrorClose_19ofi_179",Li={split:xit,toolbar:kit,backButton:_it,title:Sit,count:Cit,addWrap:Tit,addButton:Eit,picker:Ait,pickerItem:Mit,pickerItemLabel:Nit,pickerItemWorkspace:Iit,panes:Rit,paneSlot:jit,empty:Lit,paneError:Dit,paneErrorTitle:Oit,paneErrorMessage:Pit,paneErrorClose:Bit},CC=r0;function $it({sessionIds:e,onPanesChange:t,onExit:n,onError:s,onRightPanelOpen:r,onPaneArtifactsChange:i,messageTurnOutputs:o,sessionListReloadToken:a}){var D,G,q;const{t:l}=ot(),c=Ba(),d=c.sessionId,h=((G=(D=c.capabilities)==null?void 0:D.features)==null?void 0:G.includes(PM))??!1,{sessions:f,reload:p}=ah({autoLoad:!0,pageSize:pu,archiveState:"active",...h?{view:"organized",group:"all"}:{}}),{sessions:g,reload:y}=Cte(),w=m.useMemo(()=>Ste(f,g),[f,g]),v=OM(c.capabilities),b=(q=c.capabilities)==null?void 0:q.workspaceCwd,x=e!==void 0,k=m.useMemo(()=>Array.from(new Set((e??[]).filter(Boolean))).slice(0,CC),[e]),[T,C]=m.useState(()=>k.length>0?k:d?[d]:[]),[S,_]=m.useState(!1),L=m.useRef(null),[M]=m.useState(()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).slice(2));m.useEffect(()=>{x&&C(N=>N.length===k.length&&N.every((ee,re)=>ee===k[re])?N:k)},[k,x]);const I=m.useRef(T);I.current=T,m.useEffect(()=>{if(!S)return;const N=re=>{var Q;(Q=L.current)!=null&&Q.contains(re.target)||_(!1)},ee=re=>{re.key==="Escape"&&_(!1)};return document.addEventListener("mousedown",N),document.addEventListener("keydown",ee),()=>{document.removeEventListener("mousedown",N),document.removeEventListener("keydown",ee)}},[S]),m.useEffect(()=>{S&&(p(),y())},[S,p,y]);const A=m.useRef(a);m.useEffect(()=>{a!==void 0&&a!==A.current&&(A.current=a,p(),y())},[a,p,y]);const P=m.useMemo(()=>{var ee;const N=new Map;for(const re of w)N.set(re.sessionId,((ee=re.displayName)==null?void 0:ee.trim())||re.sessionId.slice(0,8));return N},[w]),B=m.useMemo(()=>{const N=new Map;for(const ee of w)N.set(ee.sessionId,ee.workspaceCwd);return d&&c.workspaceCwd&&!N.has(d)&&N.set(d,c.workspaceCwd),N},[w,d,c.workspaceCwd]),F=m.useCallback(N=>{const ee=I.current;if(ee.includes(N)||ee.length>=CC){_(!1);return}const re=[...ee,N];x?t==null||t(re):C(re),_(!1)},[t,x]),O=m.useRef(!1);m.useEffect(()=>{T.length>0?O.current=!0:O.current&&n()},[T,n]),m.useEffect(()=>{x||t==null||t(T)},[T,t,x]);const X=m.useCallback(N=>{const ee=I.current;if(!ee.includes(N))return;const re=ee.filter(Q=>Q!==N);x?t==null||t(re):C(re)},[t,x]),z=m.useMemo(()=>w.filter(N=>!T.includes(N.sessionId)),[w,T]),U=T.length<CC&&z.length>0;return u.jsxs("div",{className:Li.split,"data-testid":"split-view",children:[u.jsxs("header",{className:Li.toolbar,children:[u.jsx("button",{type:"button",className:Li.backButton,onClick:n,"aria-label":l("common.back"),title:l("common.back"),children:u.jsx("svg",{viewBox:"0 0 24 24",width:"18",height:"18","aria-hidden":"true",children:u.jsx("path",{d:"M15 18l-6-6 6-6",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),u.jsx("span",{className:Li.title,children:l("splitView.title")}),u.jsx("span",{className:Li.count,children:l("splitView.count",{count:T.length})}),u.jsxs("div",{className:Li.addWrap,ref:L,children:[u.jsxs("button",{type:"button",className:Li.addButton,disabled:!U,"aria-haspopup":"listbox","aria-expanded":S,onClick:()=>_(N=>!N),children:["+ ",l("splitView.addPane")]}),S&&z.length>0&&u.jsx("ul",{className:Li.picker,role:"listbox",children:z.map(N=>u.jsx("li",{role:"option","aria-selected":"false",children:u.jsxs("button",{type:"button",className:Li.pickerItem,onClick:()=>F(N.sessionId),children:[u.jsx("span",{className:Li.pickerItemLabel,children:P.get(N.sessionId)??N.sessionId.slice(0,8)}),v&&u.jsx("span",{className:Li.pickerItemWorkspace,title:N.workspaceCwd,children:_te(N.workspaceCwd,b)?DM(N.workspaceCwd):l("sidebar.workspacePrimary")})]})},N.sessionId))})]})]}),u.jsx("div",{className:Li.panes,children:T.length===0?u.jsx("div",{className:Li.empty,children:l("splitView.empty")}):T.map(N=>{const ee=B.get(N);return u.jsx("div",{className:Li.paneSlot,children:u.jsx(Fu,{label:`split-pane:${N}`,resetKeys:[N],fallback:re=>u.jsxs("div",{className:Li.paneError,role:"alert",children:[u.jsx("div",{className:Li.paneErrorTitle,children:P.get(N)??N.slice(0,8)}),u.jsxs("div",{className:Li.paneErrorMessage,children:[l("splitView.paneError"),": ",re.message]}),u.jsx("button",{type:"button",className:Li.paneErrorClose,onClick:()=>X(N),children:l("splitView.closePane")})]}),children:u.jsx(mU,{sessionId:N,workspaceCwd:v?ee:void 0,clientId:`split-pane:${M}:${N}`,suppressOwnUserEcho:!0,children:u.jsx(wit,{title:P.get(N),workspaceCwd:ee,onClose:()=>X(N),onError:s,onRightPanelOpen:r,onPaneArtifactsChange:i,messageTurnOutputs:o})})})},v?`${N}:${ee??""}`:N)})})]})}const zit="_root_12cvm_1",Fit="_intro_12cvm_8",qit="_toolbar_12cvm_14",Hit="_count_12cvm_22",Uit="_toolbarActions_12cvm_28",Vit="_primaryButton_12cvm_34",Wit="_secondaryButton_12cvm_35",Git="_formFields_12cvm_73",Kit="_field_12cvm_79",Yit="_fieldGrow_12cvm_86",Xit="_fieldLabel_12cvm_90",Qit="_required_12cvm_96",Jit="_input_12cvm_107",Zit="_textarea_12cvm_108",eot="_select_12cvm_109",tot="_promptEditorWrap_12cvm_127",not="_promptEditor_12cvm_127",sot="_promptPlaceholder_12cvm_159",rot="_promptTag_12cvm_173",iot="_promptTagIcon_12cvm_189",oot="_promptTagValue_12cvm_200",aot="_referencePopover_12cvm_210",lot="_referenceBar_12cvm_214",cot="_referenceButton_12cvm_221",uot="_referenceButtonActive_12cvm_238",dot="_referenceButtonIcon_12cvm_243",hot="_referencePicker_12cvm_253",fot="_referenceItem_12cvm_265",mot="_referenceItemLabel_12cvm_288",pot="_referenceItemDescription_12cvm_289",got="_referenceEmpty_12cvm_306",yot="_referenceError_12cvm_307",bot="_scheduleRow_12cvm_317",vot="_preview_12cvm_329",wot="_previewLabel_12cvm_337",xot="_previewCron_12cvm_342",kot="_previewInvalid_12cvm_352",_ot="_formError_12cvm_357",Sot="_loadError_12cvm_358",Cot="_formActions_12cvm_364",Tot="_empty_12cvm_372",Eot="_list_12cvm_379",Aot="_card_12cvm_387",Mot="_cardDisabled_12cvm_398",Not="_cardHeader_12cvm_402",Iot="_cardTitle_12cvm_408",Rot="_cardMenu_12cvm_419",jot="_iconAction_12cvm_426",Lot="_toggle_12cvm_452",Dot="_toggleOn_12cvm_471",Oot="_toggleKnob_12cvm_475",Pot="_cardPrompt_12cvm_490",Bot="_cardFooter_12cvm_503",$ot="_schedulePill_12cvm_512",zot="_clockIcon_12cvm_524",Fot="_recurringTag_12cvm_529",qot="_workspacePill_12cvm_537",Hot="_workspaceIcon_12cvm_554",Uot="_countdown_12cvm_559",Vot="_hourglassIcon_12cvm_570",Wot="_lastFired_12cvm_575",Got="_runsToggle_12cvm_583",Kot="_runsList_12cvm_600",Yot="_runsItem_12cvm_614",Re={root:zit,intro:Fit,toolbar:qit,count:Hit,toolbarActions:Uit,primaryButton:Vit,secondaryButton:Wit,formFields:Git,field:Kit,fieldGrow:Yit,fieldLabel:Xit,required:Qit,input:Jit,textarea:Zit,select:eot,promptEditorWrap:tot,promptEditor:not,promptPlaceholder:sot,promptTag:rot,promptTagIcon:iot,promptTagValue:oot,referencePopover:aot,referenceBar:lot,referenceButton:cot,referenceButtonActive:uot,referenceButtonIcon:dot,referencePicker:hot,referenceItem:fot,referenceItemLabel:mot,referenceItemDescription:pot,referenceEmpty:got,referenceError:yot,scheduleRow:bot,preview:vot,previewLabel:wot,previewCron:xot,previewInvalid:kot,formError:_ot,loadError:Sot,formActions:Cot,empty:Tot,list:Eot,card:Aot,cardDisabled:Mot,cardHeader:Not,cardTitle:Iot,cardMenu:Rot,iconAction:jot,toggle:Lot,toggleOn:Dot,toggleKnob:Oot,cardPrompt:Pot,cardFooter:Bot,schedulePill:$ot,clockIcon:zot,recurringTag:Fot,workspacePill:qot,workspaceIcon:Hot,countdown:Uot,hourglassIcon:Vot,lastFired:Wot,runsToggle:Got,runsList:Kot,runsItem:Yot},Xot="_panel_1ycr0_1",Qot="_header_1ycr0_11",Jot="_tabs_1ycr0_28",Zot="_tabItem_1ycr0_37",eat="_tab_1ycr0_28",tat="_tabIcon_1ycr0_67",nat="_tabIconSvg_1ycr0_77",sat="_tabActive_1ycr0_84",rat="_tabCloseButton_1ycr0_99",iat="_tabCloseIcon_1ycr0_119",oat="_iconButton_1ycr0_125",aat="_iconButtonActive_1ycr0_143",lat="_toolbarIcon_1ycr0_147",cat="_body_1ycr0_153",uat="_empty_1ycr0_160",dat="_meta_1ycr0_198",hat="_detail_1ycr0_203",fat="_section_1ycr0_208",mat="_sectionTitle_1ycr0_213",pat="_description_1ycr0_220",gat="_actionsRow_1ycr0_224",yat="_fieldGrid_1ycr0_231",bat="_fieldLabel_1ycr0_238",vat="_fieldValue_1ycr0_247",wat="_link_1ycr0_252",xat="_review_1ycr0_261",kat="_reviewToolbar_1ycr0_268",_at="_reviewToolbarTitle_1ycr0_277",Sat="_reviewToolbarActions_1ycr0_284",Cat="_reviewTotalsButton_1ycr0_290",Tat="_reviewContent_1ycr0_308",Eat="_reviewContentListOnly_1ycr0_318",Aat="_reviewContentStacked_1ycr0_322",Mat="_reviewList_1ycr0_327",Nat="_reviewListWithExpanded_1ycr0_335",Iat="_reviewSplitHandle_1ycr0_348",Rat="_reviewItem_1ycr0_363",jat="_reviewItemExpanded_1ycr0_368",Lat="_reviewRow_1ycr0_375",Dat="_fileIcon_1ycr0_396",Oat="_reviewPath_1ycr0_410",Pat="_treeName_1ycr0_411",Bat="_pathPrefix_1ycr0_427",$at="_pathFileName_1ycr0_433",zat="_lineStats_1ycr0_441",Fat="_additions_1ycr0_450",qat="_deletions_1ycr0_454",Hat="_chevron_1ycr0_458",Uat="_chevronOpen_1ycr0_464",Vat="_chevronIcon_1ycr0_468",Wat="_diffPreview_1ycr0_474",Gat="_codeMirrorDiff_1ycr0_484",Kat="_codeMirrorDiffWrap_1ycr0_492",Yat="_diffError_1ycr0_500",Xat="_codeMirrorFile_1ycr0_525",Qat="_diffEmpty_1ycr0_591",Jat="_tree_1ycr0_411",Zat="_treeNode_1ycr0_604",elt="_treeChildren_1ycr0_608",tlt="_treeRow_1ycr0_622",nlt="_treeFolder_1ycr0_655",slt="_treeFile_1ycr0_659",rlt="_treeTwisty_1ycr0_668",ilt="_treeChevronIcon_1ycr0_677",olt="_treeChevron_1ycr0_677",alt="_treeChevronClosed_1ycr0_688",llt="_treeContent_1ycr0_692",clt="_reviewBadge_1ycr0_715",ult="_htmlPreviewWrap_1ycr0_728",dlt="_htmlPreview_1ycr0_728",hlt="_previewError_1ycr0_744",flt="_filePreviewWrap_1ycr0_750",ze={panel:Xot,header:Qot,tabs:Jot,tabItem:Zot,tab:eat,tabIcon:tat,tabIconSvg:nat,tabActive:sat,tabCloseButton:rat,tabCloseIcon:iat,iconButton:oat,iconButtonActive:aat,toolbarIcon:lat,body:cat,empty:uat,meta:dat,detail:hat,section:fat,sectionTitle:mat,description:pat,actionsRow:gat,fieldGrid:yat,fieldLabel:bat,fieldValue:vat,link:wat,review:xat,reviewToolbar:kat,reviewToolbarTitle:_at,reviewToolbarActions:Sat,reviewTotalsButton:Cat,reviewContent:Tat,reviewContentListOnly:Eat,reviewContentStacked:Aat,reviewList:Mat,reviewListWithExpanded:Nat,reviewSplitHandle:Iat,reviewItem:Rat,reviewItemExpanded:jat,reviewRow:Lat,fileIcon:Dat,reviewPath:Oat,treeName:Pat,pathPrefix:Bat,pathFileName:$at,lineStats:zat,additions:Fat,deletions:qat,chevron:Hat,chevronOpen:Uat,chevronIcon:Vat,diffPreview:Wat,codeMirrorDiff:Gat,codeMirrorDiffWrap:Kat,diffError:Yat,codeMirrorFile:Xat,diffEmpty:Qat,tree:Jat,treeNode:Zat,treeChildren:elt,treeRow:tlt,treeFolder:nlt,treeFile:slt,treeTwisty:rlt,treeChevronIcon:ilt,treeChevron:olt,treeChevronClosed:alt,treeContent:llt,reviewBadge:clt,htmlPreviewWrap:ult,htmlPreview:dlt,previewError:hlt,filePreviewWrap:flt},mlt=740,plt=700,glt=["daily","weekdays","weekly","hourly","minutes","custom"],ylt=[1,2,3,4,5,6,10,12,15,20,30];function blt({artifacts:e,tabs:t,activeTabId:n,reviewChanges:s,selectedReviewPath:r,panelWidth:i,workspaceCwd:o,loading:a,error:l,onSelectTab:c,onCloseTab:d,onClose:h}){const f=t.find(y=>y.id===n)??t[0],p=$o(),g=(f==null?void 0:f.kind)==="artifact"||(f==null?void 0:f.kind)==="scheduled_task"?f.workspaceActions??p:p;return u.jsxs("aside",{className:ze.panel,style:i?{flexBasis:i,width:i}:void 0,"aria-label":"Right panel",children:[u.jsxs("div",{className:ze.header,children:[u.jsx("div",{className:ze.tabs,role:"tablist","aria-label":"Right panel",children:t.map(y=>u.jsxs("div",{className:[ze.tabItem,y.id===(f==null?void 0:f.id)?ze.tabActive:""].filter(Boolean).join(" "),children:[u.jsxs("button",{type:"button",role:"tab","aria-selected":y.id===(f==null?void 0:f.id),className:ze.tab,onClick:()=>c(y.id),title:y.title,children:[u.jsx("span",{className:ze.tabIcon,"aria-hidden":"true",children:y.kind==="review"?u.jsx(wlt,{}):y.kind==="artifact"?u.jsx(xlt,{}):u.jsx(klt,{})}),y.title]}),u.jsx("button",{type:"button",className:ze.tabCloseButton,onClick:()=>d(y.id),"aria-label":`Close ${y.title}`,title:"Close",children:u.jsx(vlt,{})})]},y.id))}),u.jsx("button",{type:"button",className:ze.iconButton,onClick:h,"aria-label":"Close artifacts panel",title:"Close",children:"×"})]}),u.jsx("div",{className:ze.body,children:f?f.kind==="review"?u.jsx(Clt,{changes:s,selectedPath:r,panelWidth:i,workspaceCwd:o}):f.kind==="artifact"?u.jsx(_lt,{artifacts:e,artifactId:f.artifactId,workspaceActions:g,previewContent:f.previewContent,loading:a,error:l}):u.jsx(Slt,{task:f.task,actions:g},f.id):u.jsx("div",{className:ze.empty,children:"No panel selected."})})]})}function vlt(){return u.jsx("svg",{className:ze.tabCloseIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:u.jsx("path",{d:"m4.5 4.5 7 7M11.5 4.5l-7 7",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function wlt(){return u.jsxs("svg",{className:ze.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false",children:[u.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"1.6"}),u.jsx("path",{d:"M9 9.5h6M12 6.5v6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),u.jsx("path",{d:"M9 16h6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}function xlt(){return u.jsxs("svg",{className:ze.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false",children:[u.jsx("rect",{x:"6",y:"4",width:"12",height:"16",rx:"2",stroke:"currentColor",strokeWidth:"1.8"}),u.jsx("path",{d:"M9 10h6M9 14h4",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})]})}function klt(){return u.jsxs("svg",{className:ze.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false",children:[u.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3",stroke:"currentColor",strokeWidth:"1.8"}),u.jsx("path",{d:"M12 8v4l3 2",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function _lt({artifacts:e,artifactId:t,workspaceActions:n,previewContent:s,loading:r,error:i}){const o=e.find(a=>a.id===t);return o?u.jsx(Plt,{artifact:o,workspaceActions:n,previewContent:s}):r?u.jsx("div",{className:ze.empty,children:"Loading artifact..."}):i?u.jsx("div",{className:ze.empty,children:i}):u.jsx("div",{className:ze.empty,children:"Artifact not found."})}function Slt({task:e,actions:t}){const{t:n}=ot(),[s,r]=m.useState(null),[i,o]=m.useState(!0),[a,l]=m.useState(null),[c,d]=m.useState(""),[h,f]=m.useState(e.prompt),[p,g]=m.useState(()=>Cd(e.cron)),[y,w]=m.useState(!1),[v,b]=m.useState(!1),[x,k]=m.useState(!1),[T,C]=m.useState(!1),[S,_]=m.useState(null),L=m.useCallback(async()=>{if(!e.durable){r(null),d(""),f(e.prompt),g(Cd(e.cron)),l(null),o(!1);return}o(!0),l(null);try{const Q=(await t.listScheduledTasks()).find(K=>K.id===e.id)??null;r(Q),Q?(d(Q.name??""),f(Q.prompt),g(Cd(Q.cron))):(d(""),f(e.prompt),g(Cd(e.cron)))}catch(re){l(re instanceof Error?re.message:String(re))}finally{o(!1)}},[t,e.cron,e.durable,e.id,e.prompt]);m.useEffect(()=>{L()},[L]);const M=!e.durable,I=e.durable&&!i&&!a&&!s,A=!!s,P=(s==null?void 0:s.name)||(s==null?void 0:s.prompt)||e.title,B=(s==null?void 0:s.prompt)??e.prompt,F=(s==null?void 0:s.cron)??e.cron,O=(s==null?void 0:s.recurring)??e.recurring,X=s==null?void 0:s.enabled,z=m.useCallback(()=>{s&&(d(s.name??""),f(s.prompt),g(Cd(s.cron)),_(null),w(!0))},[s]),U=m.useCallback(()=>{w(!1),_(null),s&&(d(s.name??""),f(s.prompt),g(Cd(s.cron)))},[s]),D=m.useCallback(async()=>{if(!s)return;const re=M2(p);if(!re){_(n("scheduledTasks.error.invalidSchedule"));return}if(h.trim().length===0){_(n("scheduledTasks.error.emptyPrompt"));return}C(!0),_(null);try{const Q=await t.updateScheduledTask(s.id,{cron:re,prompt:h.trim(),name:c.trim()||null});r(Q),d(Q.name??""),f(Q.prompt),g(Cd(Q.cron)),w(!1)}catch(Q){_(Q instanceof Error?Q.message:String(Q))}finally{C(!1)}},[t,p,s,c,h,n]),G=m.useCallback(async()=>{if(s){k(!0),_(null);try{const re=await t.updateScheduledTask(s.id,{enabled:!s.enabled});r(re)}catch(re){_(re instanceof Error?re.message:String(re))}finally{k(!1)}}},[t,s]),q=m.useCallback(async()=>{if(s){k(!0),_(null);try{await t.deleteScheduledTask(s.id),r(null),b(!1)}catch(re){_(re instanceof Error?re.message:String(re))}finally{k(!1)}}},[t,s]),N=M2(p),ee=N?Jy(N,n):null;return u.jsxs("div",{className:ze.detail,children:[i&&u.jsx("div",{className:ze.empty,children:n("scheduledTasks.loading")}),a&&u.jsx("div",{className:Re.loadError,children:a}),I&&u.jsx("div",{className:ze.empty,children:n("scheduledTasks.deletedSnapshot")}),M&&u.jsx("div",{className:ze.empty,children:n("scheduledTasks.sessionScopedSnapshot")}),!I&&u.jsx("div",{className:ze.section,children:u.jsxs("div",{className:ze.fieldGrid,children:[u.jsx("span",{className:ze.fieldLabel,children:n("scheduledTasks.name")}),u.jsx("span",{className:ze.fieldValue,children:P}),u.jsx("span",{className:ze.fieldLabel,children:n("scheduledTasks.taskId")}),u.jsx("span",{className:ze.fieldValue,children:e.id}),u.jsx("span",{className:ze.fieldLabel,children:n("scheduledTasks.schedule")}),u.jsx("span",{className:ze.fieldValue,children:Jy(F,n)}),u.jsx("span",{className:ze.fieldLabel,children:"Cron"}),u.jsx("span",{className:ze.fieldValue,children:F}),u.jsx("span",{className:ze.fieldLabel,children:n("scheduledTasks.type")}),u.jsx("span",{className:ze.fieldValue,children:n(O?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),X!==void 0&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:ze.fieldLabel,children:n("scheduledTasks.status")}),u.jsx("span",{className:ze.fieldValue,children:n(X?"scheduledTasks.enable":"scheduledTasks.disable")})]})]})}),!I&&u.jsxs("div",{className:ze.section,children:[u.jsx("div",{className:ze.sectionTitle,children:"Prompt"}),u.jsx("div",{className:ze.description,children:B})]}),S&&u.jsx("div",{className:Re.formError,children:S}),u.jsxs("div",{className:ze.actionsRow,children:[u.jsx("button",{type:"button",className:Re.primaryButton,disabled:!A||x,onClick:z,children:n("scheduledTasks.edit")}),u.jsx("button",{type:"button",className:Re.secondaryButton,disabled:!A||x,onClick:()=>void G(),children:s!=null&&s.enabled?n("scheduledTasks.disable"):n("scheduledTasks.enable")}),u.jsx("button",{type:"button",className:Re.secondaryButton,disabled:!A||x,onClick:()=>b(!0),children:n("scheduledTasks.delete")})]}),v&&s&&u.jsx(Ar,{title:n("scheduledTasks.deleteConfirmTitle"),size:"sm",onClose:()=>b(!1),children:u.jsxs("div",{className:Re.formFields,children:[u.jsx("div",{className:ze.description,children:n("scheduledTasks.deleteConfirm",{name:s.name||s.prompt})}),S&&u.jsx("div",{className:Re.formError,children:S}),u.jsxs("div",{className:Re.formActions,children:[u.jsx("button",{type:"button",className:Re.secondaryButton,onClick:()=>b(!1),disabled:x,children:n("scheduledTasks.cancel")}),u.jsx("button",{type:"button",className:Re.primaryButton,onClick:()=>void q(),disabled:x,children:n("scheduledTasks.delete")})]})]})}),y&&u.jsx(Ar,{title:n("scheduledTasks.editTitle"),size:"md",onClose:U,children:u.jsxs("div",{className:Re.formFields,children:[u.jsxs("label",{className:Re.field,children:[u.jsx("span",{className:Re.fieldLabel,children:n("scheduledTasks.name")}),u.jsx("input",{className:Re.input,type:"text",value:c,maxLength:200,placeholder:n("scheduledTasks.namePlaceholder"),onChange:re=>d(re.target.value)})]}),u.jsxs("label",{className:Re.field,children:[u.jsxs("span",{className:Re.fieldLabel,children:[n("scheduledTasks.prompt"),u.jsx("span",{className:Re.required,children:"*"})]}),u.jsx("textarea",{className:Re.textarea,value:h,rows:4,maxLength:1e5,placeholder:n("scheduledTasks.promptPlaceholder"),onChange:re=>f(re.target.value)})]}),u.jsxs("div",{className:Re.scheduleRow,children:[u.jsxs("label",{className:Re.field,children:[u.jsx("span",{className:Re.fieldLabel,children:n("scheduledTasks.frequency")}),u.jsx("select",{className:Re.select,value:p.frequency,onChange:re=>{const Q=re.target.value;g(K=>({...K,frequency:Q,...Q==="hourly"?{time:"00:00"}:{}}))},children:glt.map(re=>u.jsx("option",{value:re,children:n(`scheduledTasks.freq.${re}`)},re))})]}),(p.frequency==="daily"||p.frequency==="weekdays"||p.frequency==="weekly")&&u.jsxs("label",{className:Re.field,children:[u.jsx("span",{className:Re.fieldLabel,children:n("scheduledTasks.time")}),u.jsx("input",{className:Re.input,type:"time",value:p.time,onChange:re=>g(Q=>({...Q,time:re.target.value}))})]}),p.frequency==="weekly"&&u.jsxs("label",{className:Re.field,children:[u.jsx("span",{className:Re.fieldLabel,children:n("scheduledTasks.weekday")}),u.jsx("select",{className:Re.select,value:p.weekday,onChange:re=>g(Q=>({...Q,weekday:Number(re.target.value)})),children:n("scheduledTasks.weekdayNames").split(",").map((re,Q)=>u.jsx("option",{value:Q,children:re},Q))})]}),p.frequency==="minutes"&&u.jsxs("label",{className:Re.field,children:[u.jsx("span",{className:Re.fieldLabel,children:n("scheduledTasks.interval")}),u.jsx("select",{className:Re.select,value:p.minuteInterval,onChange:re=>g(Q=>({...Q,minuteInterval:Number(re.target.value)})),children:ylt.map(re=>u.jsx("option",{value:re,children:re},re))})]}),p.frequency==="custom"&&u.jsxs("label",{className:`${Re.field} ${Re.fieldGrow}`,children:[u.jsx("span",{className:Re.fieldLabel,children:n("scheduledTasks.cron")}),u.jsx("input",{className:Re.input,type:"text",value:p.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:re=>g(Q=>({...Q,customCron:re.target.value}))})]})]}),u.jsx("div",{className:Re.preview,children:ee?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:Re.previewLabel,children:ee}),u.jsx("code",{className:Re.previewCron,children:N})]}):u.jsx("span",{className:Re.previewInvalid,children:n("scheduledTasks.error.invalidSchedule")})}),S&&u.jsx("div",{className:Re.formError,children:S}),u.jsxs("div",{className:Re.formActions,children:[u.jsx("button",{type:"button",className:Re.secondaryButton,onClick:U,disabled:T,children:n("scheduledTasks.cancel")}),u.jsx("button",{type:"button",className:Re.primaryButton,onClick:()=>void D(),disabled:T,children:n(T?"scheduledTasks.saving":"scheduledTasks.save")})]})]})})]})}function Clt({changes:e,selectedPath:t,panelWidth:n,workspaceCwd:s}){const{t:r}=ot(),[i,o]=m.useState(()=>!n||n>=mlt),[a,l]=m.useState(!0),[c,d]=m.useState(!1),[h,f]=m.useState(520),p=m.useRef(h),g=m.useRef(null),y=m.useRef(null),[w,v]=m.useState(null),b=i,x=m.useMemo(()=>Dlt(e,s),[e,s]);m.useEffect(()=>{v(t)},[t]),m.useEffect(()=>{p.current=h},[h]),m.useEffect(()=>{const S=g.current;if(!S)return;const _=()=>{d(S.clientWidth<plt)};_();const L=new ResizeObserver(_);return L.observe(S),()=>L.disconnect()},[a]),m.useEffect(()=>()=>{var S;return(S=y.current)==null?void 0:S.call(y)},[]);const k=m.useCallback(S=>{const _=g.current;if(!_)return;S.preventDefault();const L=S.currentTarget;L.setPointerCapture(S.pointerId);const M=S.clientX,I=p.current,A=_.getBoundingClientRect().width,P=Math.max(180,A-180),B=document.body.style.cursor,F=document.body.style.userSelect;let O=I,X=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const z=()=>{X=null,f(O)},U=q=>{O=Math.min(P,Math.max(180,I+(q.clientX-M))),X===null&&(X=window.requestAnimationFrame(z))};let D=()=>{};const G=q=>{y.current=null,X!==null&&(window.cancelAnimationFrame(X),X=null),q&&f(O),L.hasPointerCapture(S.pointerId)&&L.releasePointerCapture(S.pointerId),document.body.style.cursor=B,document.body.style.userSelect=F,window.removeEventListener("pointermove",U),window.removeEventListener("pointerup",D),window.removeEventListener("pointercancel",D)};D=()=>G(!0),y.current=()=>G(!1),window.addEventListener("pointermove",U),window.addEventListener("pointerup",D),window.addEventListener("pointercancel",D)},[]);if(e.length===0)return u.jsx("div",{className:ze.empty,children:"No file changes to review."});const T=$Q(e),C=S=>{v(_=>_===S?null:S)};return u.jsxs("div",{className:ze.review,children:[u.jsxs("div",{className:ze.reviewToolbar,children:[u.jsxs("div",{className:ze.reviewToolbarTitle,children:[u.jsx("span",{children:r("turnOutputs.previousTurn")}),u.jsx(N2,{additions:T==null?void 0:T.additions,deletions:T==null?void 0:T.deletions,className:ze.lineStats,additionsClassName:ze.additions,deletionsClassName:ze.deletions})]}),u.jsxs("div",{className:ze.reviewToolbarActions,children:[u.jsxs("button",{type:"button",className:ze.reviewTotalsButton,onClick:()=>l(S=>!S),"aria-expanded":a,children:[u.jsx("span",{children:r("turnOutputs.fileCount",{count:e.length})}),u.jsx("span",{className:[ze.chevron,a?ze.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:u.jsx(V$,{})})]}),u.jsx("button",{type:"button",className:[ze.iconButton,i?ze.iconButtonActive:""].filter(Boolean).join(" "),onClick:()=>o(S=>!S),"aria-label":r(i?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),title:r(i?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),children:i?u.jsx(jlt,{}):u.jsx(Rlt,{})})]})]}),a&&u.jsxs("div",{ref:g,className:[ze.reviewContent,b?"":ze.reviewContentListOnly,b&&c?ze.reviewContentStacked:""].filter(Boolean).join(" "),style:{"--review-list-width":`${h}px`},children:[u.jsx("div",{className:[ze.reviewList,w?ze.reviewListWithExpanded:""].filter(Boolean).join(" "),children:e.map(S=>{const _=w===S.path;return u.jsxs("div",{className:[ze.reviewItem,_?ze.reviewItemExpanded:""].filter(Boolean).join(" "),children:[u.jsxs("button",{type:"button",className:ze.reviewRow,"data-selected":S.path===t||void 0,onClick:()=>C(S.path),children:[u.jsx("span",{className:ze.fileIcon,children:tne(S.path)}),u.jsx(Mlt,{path:V9(S.path,s),title:S.path}),u.jsx(N2,{additions:S.additions,deletions:S.deletions,className:ze.lineStats,additionsClassName:ze.additions,deletionsClassName:ze.deletions}),u.jsx("span",{className:[ze.chevron,_?ze.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:u.jsx(V$,{})})]}),_&&u.jsx(Tlt,{change:S})]},`${S.toolCallId}:${S.path}`)})}),b&&!c&&u.jsx("div",{className:ze.reviewSplitHandle,role:"separator","aria-orientation":"vertical",onPointerDown:k}),b&&u.jsx("div",{className:ze.tree,children:x.children.map(S=>u.jsx(Jte,{node:S,depth:0,selectedPath:t},S.path))})]})]})}function Tlt({change:e}){if(e.diffs.length===0)return u.jsx("div",{className:ze.diffEmpty,children:"No diff available."});const t=Elt(e.diffs);return u.jsx("div",{className:ze.diffPreview,children:t.map((n,s)=>u.jsx(Alt,{oldText:n.oldText,newText:n.newText},s))})}function Elt(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n!=null&&n.fullContent)return e.slice(t)}return e}function Alt({oldText:e,newText:t}){const n=m.useRef(null),[s,r]=m.useState(null),[i,o]=m.useState(null);return m.useEffect(()=>{const a=n.current;if(!a)return;const l=()=>r(a.clientWidth>=720);l();const c=new ResizeObserver(l);return c.observe(a),()=>c.disconnect()},[]),m.useEffect(()=>{const a=n.current;if(!a||s===null)return;a.replaceChildren(),o(null);let l=!1,c=null;const d=[qX,yt.editable.of(!1),ws.readOnly.of(!0),yt.lineWrapping],h={scanLimit:1e3,timeout:500},f={margin:3,minSize:8};return J(async()=>{const{MergeView:p,unifiedMergeView:g}=await import("./index-DzHwQkQq.js");return{MergeView:p,unifiedMergeView:g}},[]).then(({MergeView:p,unifiedMergeView:g})=>{if(!l)try{if(s){c=new p({a:{doc:e,extensions:d},b:{doc:t,extensions:d},parent:a,highlightChanges:!0,gutter:!0,revertControls:void 0,collapseUnchanged:f,diffConfig:h});return}c=new yt({doc:t,extensions:[...d,g({original:e,highlightChanges:!0,gutter:!0,mergeControls:!1,allowInlineDiffs:!0,collapseUnchanged:f,diffConfig:h})],parent:a})}catch(y){l||o(y instanceof Error?y.message:String(y))}}).catch(p=>{l||o(p instanceof Error?p.message:String(p))}),()=>{l=!0,c==null||c.destroy()}},[s,t,e]),u.jsxs("div",{className:ze.codeMirrorDiffWrap,children:[u.jsx("div",{ref:n,className:ze.codeMirrorDiff}),i&&u.jsxs("div",{className:ze.diffError,children:["Diff unavailable: ",i]})]})}function Jte({node:e,depth:t,selectedPath:n}){var d,h;const s=!!e.file,[r,i]=m.useState(!0),o=[ze.treeRow,s?ze.treeFile:ze.treeFolder].filter(Boolean).join(" "),a={paddingLeft:10+t*18,"--tree-row-line-left":`${19+Math.max(0,t-1)*18}px`},l={"--tree-children-line-left":`${19+t*18}px`},c=u.jsxs(u.Fragment,{children:[u.jsx("span",{className:ze.treeTwisty,children:!s&&u.jsx("span",{className:[ze.treeChevron,r?"":ze.treeChevronClosed].filter(Boolean).join(" "),children:u.jsx(Llt,{})})}),u.jsxs("span",{className:ze.treeContent,children:[s&&u.jsx("span",{className:ze.fileIcon,children:tne(e.path)}),u.jsx("span",{className:ze.treeName,children:e.name})]}),((d=e.file)==null?void 0:d.isArtifact)&&u.jsx("span",{className:ze.reviewBadge,children:"artifact"})]});return u.jsxs("div",{className:ze.treeNode,children:[s?u.jsx("div",{className:o,"data-selected":((h=e.file)==null?void 0:h.path)===n||void 0,"data-depth":t,style:a,title:e.path,children:c}):u.jsx("button",{type:"button",className:o,"data-depth":t,style:a,title:e.path,"aria-expanded":r,onClick:()=>i(f=>!f),children:c}),!s&&r&&e.children.length>0&&u.jsx("div",{className:ze.treeChildren,style:l,children:e.children.map(f=>u.jsx(Jte,{node:f,depth:t+1,selectedPath:n},f.path))})]})}function Mlt({path:e,title:t}){const n=m.useRef(null),[s,r]=m.useState(()=>Zte(e));return m.useLayoutEffect(()=>{const i=n.current;if(!i)return;const o=()=>r(Nlt(e,i));o();const a=new ResizeObserver(o);return a.observe(i),()=>a.disconnect()},[e]),u.jsxs("span",{ref:n,className:ze.reviewPath,title:t??e,children:[s.prefix&&u.jsx("span",{className:ze.pathPrefix,children:s.prefix}),u.jsx("span",{className:ze.pathFileName,children:s.leaf})]})}function Zte(e){const t=e.lastIndexOf("/");return t<0?{prefix:"",leaf:e}:{prefix:e.slice(0,t+1),leaf:e.slice(t+1)}}let U$=null;function Nlt(e,t){const n=Zte(e),s=t.clientWidth;if(s<=0)return n;const r=Ilt(t);if(r(e)<=s)return n;const i=e.split("/").filter(Boolean),o=i.at(-1)??e,a=r(o);if(i.length<=1||a+r(".../")>s)return{prefix:"",leaf:o};let l=".../";for(let c=1;c<i.length;c++){const h=`.../${i.slice(i.length-1-c,-1).join("/")}/`;if(r(h)+a>s)break;l=h}return{prefix:l,leaf:o}}function Ilt(e){U$??(U$=document.createElement("canvas"));const t=U$.getContext("2d"),n=window.getComputedStyle(e);return t&&(t.font=[n.fontStyle,n.fontVariant,n.fontWeight,n.fontSize,n.fontFamily].join(" ")),s=>(t==null?void 0:t.measureText(s).width)??s.length*8}function Rlt(){return u.jsxs("svg",{className:ze.toolbarIcon,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[u.jsx("path",{d:"M3.5 7.5h6l1.6 2h9.4v8.2a2 2 0 0 1-2 2h-13a2 2 0 0 1-2-2V7.5Z",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"}),u.jsx("path",{d:"M3.5 7.5V5.8a1.5 1.5 0 0 1 1.5-1.5h4l1.8 2.1h7.2a1.5 1.5 0 0 1 1.5 1.5v1.6",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"})]})}function jlt(){return u.jsxs("svg",{className:ze.toolbarIcon,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[u.jsx("path",{d:"M3.5 8.2V5.8A1.5 1.5 0 0 1 5 4.3h4l1.8 2.1h7.2a1.5 1.5 0 0 1 1.5 1.5v1.4",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"}),u.jsx("path",{d:"M4.8 19.7h12.9a2 2 0 0 0 1.9-1.4l2-7H6.4l-2.8 7.1a.9.9 0 0 0 1.2 1.3Z",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"})]})}function V$(){return u.jsx("svg",{className:ze.chevronIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:u.jsx("path",{d:"m6 4 4 4-4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function Llt(){return u.jsx("svg",{className:ze.treeChevronIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:u.jsx("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function Dlt(e,t){const n={name:"",path:"",children:[]};for(const s of e){const r=V9(s.path,t).split("/").filter(Boolean);let i=n;for(let o=0;o<r.length;o++){const a=r[o],l=r.slice(0,o+1).join("/");let c=i.children.find(d=>d.name===a);c||(c={name:a,path:l,children:[]},i.children.push(c)),o===r.length-1&&(c.file=s),i=c}}return ene(n),n}function ene(e){e.children.sort((t,n)=>!!t.file!=!!n.file?t.file?1:-1:t.name.localeCompare(n.name));for(const t of e.children)ene(t)}function Olt(e){return im(e).split("/").filter(Boolean).at(-1)??e}function tne(e){var r;const t=Olt(e),n=t.includes(".")?(r=t.split(".").pop())==null?void 0:r.toLowerCase():"";return n?{css:"CSS",html:"HTML",js:"JS",json:"JSON",jsx:"JSX",md:"MD",ts:"TS",tsx:"TSX"}[n]??n.slice(0,3).toUpperCase():"FILE"}function Plt({artifact:e,workspaceActions:t,previewContent:n}){var l;const s=HLe(e),r=qG(e.url)?e.url:void 0,i=((l=e.metadata)==null?void 0:l.artifactType)==="automation_snapshot",o=e.storage==="workspace"&&!!e.workspacePath;return o&&e.workspacePath&&Blt(e)&&e.workspacePath?u.jsx($lt,{workspacePath:e.workspacePath,artifactVersion:e.updatedAt,workspaceActions:t,previewContent:n}):o&&e.workspacePath?u.jsx(zlt,{workspacePath:e.workspacePath,artifactVersion:e.updatedAt,workspaceActions:t}):u.jsxs("div",{className:ze.detail,children:[u.jsxs("div",{className:ze.section,children:[u.jsx("div",{className:ze.sectionTitle,children:i?"Automation Snapshot":"Artifact"}),u.jsxs("div",{className:ze.fieldGrid,children:[u.jsx(cc,{label:"Type",value:OQ(e.kind)}),u.jsx(cc,{label:"Storage",value:e.storage}),u.jsx(cc,{label:"Status",value:e.status}),u.jsx(cc,{label:"Source",value:e.source}),u.jsx(cc,{label:"Size",value:PQ(e.sizeBytes)}),u.jsx(cc,{label:"Created",value:e.createdAt}),u.jsx(cc,{label:"Updated",value:e.updatedAt}),e.toolName&&u.jsx(cc,{label:"Tool",value:e.toolName}),e.toolCallId&&u.jsx(cc,{label:"Tool call",value:e.toolCallId})]})]}),e.description&&u.jsxs("div",{className:ze.section,children:[u.jsx("div",{className:ze.sectionTitle,children:"Description"}),u.jsx("div",{className:ze.description,children:e.description})]}),i&&e.metadata&&u.jsxs("div",{className:ze.section,children:[u.jsx("div",{className:ze.sectionTitle,children:"Details"}),u.jsxs("div",{className:ze.fieldGrid,children:[tp(e.metadata,"automationId","Automation ID"),tp(e.metadata,"schedule","Schedule"),tp(e.metadata,"timezone","Timezone"),tp(e.metadata,"status","Status"),tp(e.metadata,"nextRunAt","Next run"),tp(e.metadata,"prompt","Prompt")]})]}),(s||r)&&u.jsxs("div",{className:ze.section,children:[u.jsx("div",{className:ze.sectionTitle,children:"Location"}),r?u.jsx("a",{className:ze.link,href:r,target:"_blank",rel:"noreferrer",children:r}):u.jsx("div",{className:ze.meta,children:s})]})]})}function Blt(e){var n;const t=((n=e.workspacePath)==null?void 0:n.toLowerCase())??"";return e.kind==="html"||t.endsWith(".html")||t.endsWith(".htm")}function $lt({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s}){const[r,i]=m.useState(s??null),[o,a]=m.useState(null);return m.useEffect(()=>{let l=!1;return i(s??null),a(null),n.readWorkspaceFile(e).then(c=>{l||(i(c.content),c.truncated&&a("Preview is truncated because the file is too large."))}).catch(c=>{l||a(c instanceof Error?c.message:String(c))}),()=>{l=!0}},[t,s,n,e]),u.jsxs("div",{className:ze.htmlPreviewWrap,children:[r===null?u.jsx("div",{className:ze.empty,children:"Loading preview..."}):u.jsx("iframe",{className:ze.htmlPreview,referrerPolicy:"no-referrer",sandbox:"",srcDoc:ULe(r),title:`Preview ${e}`}),o&&u.jsx("div",{className:ze.previewError,children:o})]})}function zlt({workspacePath:e,artifactVersion:t,workspaceActions:n}){const s=m.useRef(null),[r,i]=m.useState(null),[o,a]=m.useState(null);return m.useEffect(()=>{let l=!1;return i(null),a(null),n.readWorkspaceFile(e).then(c=>{l||(i(c.content),c.truncated&&a("File is truncated because it is too large."))}).catch(c=>{l||a(c instanceof Error?c.message:String(c))}),()=>{l=!0}},[t,n,e]),m.useEffect(()=>{const l=s.current;if(!l||r===null)return;l.replaceChildren();let c;try{c=new yt({doc:r,extensions:[qX,yt.editable.of(!1),ws.readOnly.of(!0),yt.lineWrapping],parent:l})}catch(d){a(d instanceof Error?d.message:String(d));return}return()=>c.destroy()},[r]),u.jsxs("div",{className:ze.filePreviewWrap,children:[r===null?u.jsx("div",{className:ze.empty,children:"Loading file..."}):u.jsx("div",{ref:s,className:ze.codeMirrorFile}),o&&u.jsx("div",{className:ze.previewError,children:o})]})}function cc({label:e,value:t}){return t?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:ze.fieldLabel,children:e}),u.jsx("span",{className:ze.fieldValue,children:t})]}):null}function tp(e,t,n){const s=e[t];return s==null||s===""?null:u.jsx(cc,{label:n,value:String(s)},t)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Flt="(min-width: 1024px)";function W$(e=Flt){const[t,n]=m.useState(()=>qlt(e));return m.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const s=window.matchMedia(e);n(s.matches);const r=i=>n(i.matches);return s.addEventListener("change",r),()=>s.removeEventListener("change",r)},[e]),t}function qlt(e){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(e).matches}function nne(e){try{return new Date(e).toLocaleString()}catch{return String(e)}}function Hlt(e,t){const n=e.kind==="catch-up"?` · ${t("scheduledTasks.runKind.catchUp")}`:e.kind==="manual"?` · ${t("scheduledTasks.runKind.manual")}`:"",s=e.withheld?` · ${t("scheduledTasks.runKind.withheld")}`:"";return`${nne(e.at)}${n}${s}`}function G$(e,t,n){const s=e.split(/[\\/]/).filter(Boolean),r=s[s.length-1]||e;return t?`${r} ${n("scheduledTasks.workspacePrimaryTag")}`:r}function _d(e){return`${e.workspaceId??""}:${e.id}`}const Ult=["daily","weekdays","weekly","hourly","minutes","custom"],Vlt=[1,2,3,4,5,6,10,12,15,20,30],Wlt=2147483647,Glt=3,Klt=3e4,rb=1e5,Ylt=/[^\p{L}\p{N}_.-]/gu,K$=/(^|[\s])(@(?:ext|mcp):(?:\\.[^\s\\]*|[^\s\\])+|\/(?:\\.[^\s\\/]*|[^\s\\/])+)(?=$|\s)/gu,Xlt=["--background","--foreground","--muted","--muted-foreground","--border","--error-color","--font-mono"];function TC(e){return e.replace(Ylt,"\\$&")}function EC(e){return e.replace(/\\(.)/g,"$1")}function Qlt(e){if(e.startsWith("@ext:")){const t=EC(e.slice(5));return{id:`extension:${t}`,kind:"extension",label:t,insertText:e}}if(e.startsWith("@mcp:")){const t=EC(e.slice(5));return{id:`mcp:${t}`,kind:"mcp",label:t,insertText:e}}if(e.startsWith("/")){const t=EC(e.slice(1));return t?{id:`skill:${t}`,kind:"skill",label:t,insertText:e}:null}return null}function Jlt(e){return e.displayName&&e.displayName!==e.name?e.displayName:e.description}function Zlt(e){return e.description||e.argumentHint||e.level}function ect(e){return e.description||e.mcpStatus}function sne(e){if(e.nodeType===Node.TEXT_NODE)return e.textContent??"";if(!(e instanceof HTMLElement))return"";const t=e.dataset.promptTagSerialized;if(t)return t;if(e.tagName==="BR")return`
`;let n="";return e.childNodes.forEach(s=>{n+=sne(s)}),e.tagName==="DIV"||e.tagName==="P"?`${n}
`:n}function rne(e){let t="";return e.childNodes.forEach(n=>{t+=sne(n)}),t}function ine(e){return e.replace(/\u00a0/g," ").replace(/\n$/,"")}function B4(e){return ine(rne(e))}function tct(e){return ine(rne(e))}function $M(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function AC(e,t){t&&e.appendChild(document.createTextNode(t))}function one(e,t){if($M(e),!t)return;t.split(`
`).forEach((s,r)=>{r>0&&e.appendChild(document.createElement("br")),nct(e,s)})}function Y$(e){let t=B4(e);return t.length>rb?(t=t.slice(0,rb),one(e,t)):t.trim().length===0&&($M(e),t=""),t}function X$(e,t){const n=rb-B4(e).length;n<=0||document.execCommand("insertText",!1,t.slice(0,n))}function Q$(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return e.contains(n.commonAncestorContainer)?{selection:t,text:tct(n.cloneContents())}:null}function ane(e){const t=document.createElement("span");t.className=Re.promptTag,t.contentEditable="false",t.dataset.promptTagSerialized=e.insertText.trim();const n=vm(e.kind);if(n){const r=document.createElement("span");r.className=Re.promptTagIcon,r.style.setProperty("--composer-tag-icon-url",o4(n)),r.setAttribute("aria-hidden","true"),t.appendChild(r)}const s=document.createElement("span");return s.className=Re.promptTagValue,s.textContent=e.label,t.appendChild(s),t}function nct(e,t){let n=0;K$.lastIndex=0;for(const s of t.matchAll(K$)){const[r,i,o]=s,a=s.index??0,l=Qlt(o);l&&(AC(e,t.slice(n,a)),AC(e,i),e.appendChild(ane(l)),n=a+r.length)}AC(e,t.slice(n))}function sct(e,t){var a;const n=window.getSelection(),s=ane(t),r=document.createTextNode(" ");B4(e).trim().length===0&&$M(e);const i=((a=e.lastChild)==null?void 0:a.textContent)??"";e.childNodes.length>0&&!/\s$/.test(i)&&e.appendChild(document.createTextNode(" ")),e.appendChild(s),e.appendChild(r);const o=document.createRange();o.setStartAfter(r),o.collapse(!0),n==null||n.removeAllRanges(),n==null||n.addRange(o)}function rct({value:e,label:t,placeholder:n,onChange:s,insertItem:r,onInserted:i}){const o=m.useRef(null),a=m.useRef("");return m.useEffect(()=>{const l=o.current;l&&e!==a.current&&(one(l,e),a.current=e)},[e]),m.useEffect(()=>{const l=o.current;if(!l||!r)return;sct(l,r);const c=B4(l);a.current=c,s(c),l.focus(),i()},[r,s,i]),u.jsxs("div",{className:Re.promptEditorWrap,children:[u.jsx("div",{ref:o,className:Re.promptEditor,contentEditable:!0,role:"textbox","aria-label":t,"aria-multiline":"true","aria-placeholder":n,onInput:l=>{const c=Y$(l.currentTarget);a.current=c,s(c)},onPaste:l=>{l.preventDefault(),X$(l.currentTarget,l.clipboardData.getData("text/plain"))},onDrop:l=>{l.preventDefault(),X$(l.currentTarget,l.dataTransfer.getData("text/plain"))},onCopy:l=>{const c=Q$(l.currentTarget);c&&(l.preventDefault(),l.clipboardData.setData("text/plain",c.text))},onCut:l=>{const c=Q$(l.currentTarget);if(!c)return;l.preventDefault(),l.clipboardData.setData("text/plain",c.text),c.selection.deleteFromDocument();const d=Y$(l.currentTarget);a.current=d,s(d)}}),e.trim().length===0&&u.jsx("div",{className:Re.promptPlaceholder,children:n})]})}function ict({onRunPrompt:e,onCreateViaChat:t,onOpenSession:n,workspaces:s,onError:r}){const{t:i}=ot(),o=$o(),a=m.useMemo(()=>s??[],[s]),l=a.length>1,c=m.useMemo(()=>a.filter(ne=>ne.primary||ne.trusted),[a]),d=m.useCallback(ne=>ne.primary?void 0:ne.id,[]),[h,f]=m.useState(null),[p,g]=m.useState(null),[y,w]=m.useState(null),[v,b]=m.useState(null),[x,k]=m.useState(!1),[T,C]=m.useState(null),[S,_]=m.useState(void 0),[L,M]=m.useState(""),[I,A]=m.useState(""),[P,B]=m.useState(hc),[F,O]=m.useState(!1),[X,z]=m.useState(null),[U,D]=m.useState(null),[G,q]=m.useState([]),[N,ee]=m.useState(!1),[re,Q]=m.useState(null),[K,se]=m.useState(null),te=m.useRef(null),ce=m.useRef(null),[oe,de]=m.useState(null),[Te,qe]=m.useState({}),[Ne,ge]=m.useState(null),[Ee,_t]=m.useState(()=>Date.now()),Ct=m.useRef(!0),Je=m.useRef(0),at=m.useRef(0);m.useEffect(()=>(Ct.current=!0,()=>{Ct.current=!1}),[]);const Oe=m.useCallback(async()=>{const ne=++Je.current;try{let he,Ve=null;if(l?he=(await Promise.all(c.map(async Et=>{try{return(await o.listScheduledTasks(d(Et))).map(an=>({...an,workspaceId:d(Et),workspaceCwd:Et.cwd}))}catch(Tt){return Ve||(Ve=Tt instanceof Error?Tt.message:String(Tt)),[]}}))).flat():he=await o.listScheduledTasks(),!Ct.current||ne!==Je.current)return;const we=[...he].sort((Bt,Et)=>Et.createdAt-Bt.createdAt);f(we),g(Ve)}catch(he){if(!Ct.current||ne!==Je.current)return;g(he instanceof Error?he.message:String(he)),f(Ve=>Ve??[])}},[o,l,c,d]);m.useEffect(()=>{Oe()},[Oe]);const Fe=!!(h!=null&&h.some(ne=>ne.nextRunAt!=null));m.useEffect(()=>{if(!Fe)return;const ne=window.setInterval(()=>_t(Date.now()),1e3);return()=>window.clearInterval(ne)},[Fe]);const ue=m.useRef(0);m.useEffect(()=>{if(!h)return;let ne=1/0;for(const Bt of h)Bt.nextRunAt!=null&&Bt.nextRunAt<ne&&(ne=Bt.nextRunAt);if(!Number.isFinite(ne))return;const he=ne-Date.now();let Ve;he>0?(ue.current=0,Ve=Math.min(he+2e3,Wlt)):Ve=ue.current++<Glt?1e3:Klt;const we=window.setTimeout(()=>void Oe(),Ve);return()=>window.clearTimeout(we)},[h,Oe]);const vt=M2(P),ye=vt?Jy(vt,i):null,je=m.useCallback(()=>{const ne=te.current;if(!ne){de(null);return}const he=getComputedStyle(ne);qe(Object.fromEntries(Xlt.map(an=>[an,he.getPropertyValue(an)])));const Ve=ne.getBoundingClientRect(),we=Math.min(420,window.innerWidth-24),Bt=Math.max(12,Math.min(Ve.left,window.innerWidth-we-12)),Et=Ve.bottom+6,Tt=Math.max(140,Math.min(320,window.innerHeight-Et-12));de(an=>{const wt={left:Bt,top:Et,width:we,maxHeight:Tt};return an&&an.left===wt.left&&an.top===wt.top&&an.width===wt.width&&an.maxHeight===wt.maxHeight?an:wt})},[]),Ye=m.useCallback(()=>{at.current+=1,D(null),q([]),ee(!1),Q(null),se(null),de(null),qe({})},[]),Nt=m.useCallback(async ne=>{const he=++at.current;if(U===ne){Ye();return}je(),D(ne),ee(!0),Q(null),q([]);try{let Ve;if(ne==="extension"?Ve=((await o.loadExtensionsStatus()).extensions??[]).filter(Bt=>Bt.isActive).map(Bt=>({id:Bt.id||Bt.name,kind:ne,label:Bt.name,description:Jlt(Bt),insertText:`@ext:${TC(Bt.name)} `})):ne==="skill"?Ve=((await o.loadSkillsStatus()).skills??[]).filter(Bt=>Bt.modelInvocable).map(Bt=>({id:Bt.name,kind:ne,label:Bt.name,description:Zlt(Bt),insertText:`/${TC(Bt.name)} `})):Ve=((await o.loadMcpStatus()).servers??[]).filter(Bt=>!Bt.disabled).map(Bt=>({id:Bt.name,kind:ne,label:Bt.name,description:ect(Bt),insertText:`@mcp:${TC(Bt.name)} `})),!Ct.current||he!==at.current)return;q(Ve)}catch(Ve){if(!Ct.current||he!==at.current)return;Q(Ve instanceof Error?Ve.message:String(Ve))}finally{Ct.current&&he===at.current&&ee(!1)}},[o,U,Ye,je]);m.useEffect(()=>{if(!U)return;je();const ne=we=>{const Bt=te.current,Et=ce.current;Bt!=null&&Bt.contains(we.target)||Et!=null&&Et.contains(we.target)||Ye()},he=we=>{we.key==="Escape"&&(we.preventDefault(),we.stopPropagation(),Ye())},Ve=()=>je();return document.addEventListener("pointerdown",ne),document.addEventListener("keydown",he,!0),window.addEventListener("resize",Ve),window.addEventListener("scroll",Ve,!0),()=>{document.removeEventListener("pointerdown",ne),document.removeEventListener("keydown",he,!0),window.removeEventListener("resize",Ve),window.removeEventListener("scroll",Ve,!0)}},[U,Ye,je]);const Rt=m.useCallback(()=>{M(""),A(""),B(hc),z(null),k(!1),C(null),_(void 0),Ye()},[Ye]),rn=m.useCallback(()=>{C(null),_(void 0),M(""),A(""),B(hc),z(null),Ye(),k(!0)},[Ye]),on=m.useCallback(ne=>{C(ne.id),_(ne.workspaceId),M(ne.name??""),A(ne.prompt),B(Cd(ne.cron)),z(null),Ye(),k(!0)},[Ye]),Bn=m.useCallback(async()=>{const ne=M2(P);if(!ne){z(i("scheduledTasks.error.invalidSchedule"));return}if(I.trim().length===0){z(i("scheduledTasks.error.emptyPrompt"));return}if(I.length>rb){z(i("scheduledTasks.error.promptTooLong",{max:rb}));return}O(!0),z(null);try{if(T?await o.updateScheduledTask(T,{cron:ne,prompt:I.trim(),name:L.trim()||null},S):await o.createScheduledTask({cron:ne,prompt:I.trim(),name:L.trim()||null,recurring:!0,enabled:!0},S),!Ct.current)return;Rt(),await Oe()}catch(he){if(!Ct.current)return;z(he instanceof Error?he.message:String(he))}finally{Ct.current&&O(!1)}},[o,P,T,S,L,I,Oe,Rt,i]),bs=m.useCallback(async ne=>{w(_d(ne));try{await o.updateScheduledTask(ne.id,{enabled:!ne.enabled},ne.workspaceId),await Oe()}catch(he){r(he,i("scheduledTasks.error.toggleFailed"))}finally{Ct.current&&w(null)}},[o,r,Oe,i]),Ss=m.useCallback(async ne=>{if(!(!ne.enabled||v!==null)){b(ne.id);try{const he=(await o.listScheduledTasks(ne.workspaceId)).find(Ve=>Ve.id===ne.id);if(!he||!he.enabled){await Oe().catch(()=>{}),r(new Error("This task is no longer runnable."),i("scheduledTasks.error.runFailed"));return}if(he.recurring){await e(he.prompt,he.sessionId);try{await o.runScheduledTask(he.id,ne.workspaceId),await Oe()}catch(Ve){r(Ve,i("scheduledTasks.error.runFailed"))}}else{await o.runScheduledTask(he.id,ne.workspaceId),await Oe();try{await e(he.prompt,he.sessionId)}catch(Ve){r(Ve,i("scheduledTasks.error.oneShotConsumedButFailed"));return}}}catch(he){r(he,i("scheduledTasks.error.runFailed"))}finally{b(null)}}},[o,r,e,Oe,v,i]),Ie=m.useCallback(async ne=>{const he=ne.name||ne.prompt,Ve=he.length>60?`${he.slice(0,57)}…`:he;if(window.confirm(i("scheduledTasks.deleteConfirm",{name:Ve}))){w(_d(ne));try{await o.deleteScheduledTask(ne.id,ne.workspaceId),await Oe()}catch(we){r(we,i("scheduledTasks.error.deleteFailed"))}finally{Ct.current&&w(null)}}},[o,r,Oe,i]),lt=U&&oe?_l.createPortal(u.jsx("div",{ref:ce,className:Re.referencePicker,role:"listbox","aria-label":i("scheduledTasks.referencePicker"),style:{...Te,left:oe.left,top:oe.top,width:oe.width,maxHeight:oe.maxHeight},children:N?u.jsx("div",{className:Re.referenceEmpty,children:i("scheduledTasks.reference.loading")}):re?u.jsx("div",{className:Re.referenceError,children:re}):G.length===0?u.jsx("div",{className:Re.referenceEmpty,children:i("scheduledTasks.reference.empty")}):G.map(ne=>u.jsxs("button",{type:"button",className:Re.referenceItem,role:"option","aria-selected":"false",onMouseDown:he=>he.preventDefault(),onClick:()=>{se(ne),D(null)},children:[u.jsx("span",{className:Re.referenceItemLabel,children:ne.label}),ne.description&&u.jsx("span",{className:Re.referenceItemDescription,children:ne.description})]},`${ne.kind}:${ne.id}`))}),document.body):null;return u.jsxs("div",{className:Re.root,children:[u.jsx("div",{className:Re.intro,children:i("scheduledTasks.subtitle")}),u.jsxs("div",{className:Re.toolbar,children:[u.jsx("div",{className:Re.count,children:h===null?i("scheduledTasks.loading"):i("scheduledTasks.count",{count:h.length})}),u.jsxs("div",{className:Re.toolbarActions,children:[u.jsx("button",{type:"button",className:Re.secondaryButton,onClick:()=>void Oe(),children:i("scheduledTasks.refresh")}),u.jsx("button",{type:"button",className:Re.secondaryButton,onClick:t,children:i("scheduledTasks.createViaChat")}),u.jsx("button",{type:"button",className:Re.primaryButton,onClick:rn,children:i("scheduledTasks.new")})]})]}),x&&u.jsx(Ar,{title:i(T?"scheduledTasks.editTitle":"scheduledTasks.new"),size:"md",onClose:Rt,children:u.jsxs("div",{className:Re.formFields,children:[l&&u.jsxs("label",{className:Re.field,children:[u.jsx("span",{className:Re.fieldLabel,children:i("scheduledTasks.workspace")}),u.jsx("select",{className:Re.select,value:S??"",disabled:!!T||c.length<=1,onChange:ne=>_(ne.target.value||void 0),children:c.map(ne=>u.jsx("option",{value:d(ne)??"",children:G$(ne.cwd,ne.primary,i)},ne.id))})]}),u.jsxs("label",{className:Re.field,children:[u.jsx("span",{className:Re.fieldLabel,children:i("scheduledTasks.name")}),u.jsx("input",{className:Re.input,type:"text",value:L,maxLength:200,placeholder:i("scheduledTasks.namePlaceholder"),onChange:ne=>M(ne.target.value)})]}),u.jsxs("label",{className:Re.field,children:[u.jsxs("span",{className:Re.fieldLabel,children:[i("scheduledTasks.prompt"),u.jsx("span",{className:Re.required,children:"*"})]}),u.jsx(rct,{value:I,label:i("scheduledTasks.prompt"),placeholder:i("scheduledTasks.promptPlaceholder"),onChange:A,insertItem:K,onInserted:()=>se(null)})]}),u.jsx("div",{ref:te,className:Re.referencePopover,children:u.jsx("div",{className:Re.referenceBar,children:["extension","skill","mcp"].map(ne=>{const he=vm(ne);return u.jsxs("button",{type:"button",className:`${Re.referenceButton} ${U===ne?Re.referenceButtonActive:""}`,"aria-expanded":U===ne,onClick:()=>void Nt(ne),children:[he&&u.jsx("span",{className:Re.referenceButtonIcon,style:{"--composer-tag-icon-url":o4(he)},"aria-hidden":!0}),i(`scheduledTasks.reference.${ne}`)]},ne)})})}),u.jsxs("div",{className:Re.scheduleRow,children:[u.jsxs("label",{className:Re.field,children:[u.jsx("span",{className:Re.fieldLabel,children:i("scheduledTasks.frequency")}),u.jsx("select",{className:Re.select,value:P.frequency,onChange:ne=>{const he=ne.target.value;B(Ve=>({...Ve,frequency:he,...he==="hourly"?{time:"00:00"}:{}}))},children:Ult.map(ne=>u.jsx("option",{value:ne,children:i(`scheduledTasks.freq.${ne}`)},ne))})]}),(P.frequency==="daily"||P.frequency==="weekdays"||P.frequency==="weekly")&&u.jsxs("label",{className:Re.field,children:[u.jsx("span",{className:Re.fieldLabel,children:i("scheduledTasks.time")}),u.jsx("input",{className:Re.input,type:"time",value:P.time,onChange:ne=>B(he=>({...he,time:ne.target.value}))})]}),P.frequency==="weekly"&&u.jsxs("label",{className:Re.field,children:[u.jsx("span",{className:Re.fieldLabel,children:i("scheduledTasks.weekday")}),u.jsx("select",{className:Re.select,value:P.weekday,onChange:ne=>B(he=>({...he,weekday:Number(ne.target.value)})),children:i("scheduledTasks.weekdayNames").split(",").map((ne,he)=>u.jsx("option",{value:he,children:ne},he))})]}),P.frequency==="minutes"&&u.jsxs("label",{className:Re.field,children:[u.jsx("span",{className:Re.fieldLabel,children:i("scheduledTasks.interval")}),u.jsx("select",{className:Re.select,value:P.minuteInterval,onChange:ne=>B(he=>({...he,minuteInterval:Number(ne.target.value)})),children:Vlt.map(ne=>u.jsx("option",{value:ne,children:ne},ne))})]}),P.frequency==="custom"&&u.jsxs("label",{className:`${Re.field} ${Re.fieldGrow}`,children:[u.jsx("span",{className:Re.fieldLabel,children:i("scheduledTasks.cron")}),u.jsx("input",{className:Re.input,type:"text",value:P.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:ne=>B(he=>({...he,customCron:ne.target.value}))})]})]}),u.jsx("div",{className:Re.preview,children:ye?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:Re.previewLabel,children:ye}),u.jsx("code",{className:Re.previewCron,children:vt})]}):u.jsx("span",{className:Re.previewInvalid,children:i("scheduledTasks.error.invalidSchedule")})}),X&&u.jsx("div",{className:Re.formError,children:X}),u.jsxs("div",{className:Re.formActions,children:[u.jsx("button",{type:"button",className:Re.secondaryButton,onClick:Rt,disabled:F,children:i("scheduledTasks.cancel")}),u.jsx("button",{type:"button",className:Re.primaryButton,onClick:()=>void Bn(),disabled:F,children:i(F?T?"scheduledTasks.saving":"scheduledTasks.creating":T?"scheduledTasks.save":"scheduledTasks.create")})]})]})}),lt,p&&u.jsx("div",{className:Re.loadError,children:p}),h!==null&&h.length===0&&!p&&u.jsx("div",{className:Re.empty,children:i("scheduledTasks.empty")}),u.jsx("div",{className:Re.list,children:(h??[]).map(ne=>{const he=ne.name||ne.prompt,Ve=y===_d(ne);return u.jsxs("div",{className:`${Re.card} ${ne.enabled?"":Re.cardDisabled}`,children:[u.jsxs("div",{className:Re.cardHeader,children:[u.jsx("button",{type:"button",role:"switch","aria-checked":ne.enabled,"aria-label":ne.enabled?i("scheduledTasks.disable"):i("scheduledTasks.enable"),className:`${Re.toggle} ${ne.enabled?Re.toggleOn:""}`,onClick:()=>void bs(ne),disabled:Ve,children:u.jsx("span",{className:Re.toggleKnob})}),u.jsx("div",{className:Re.cardTitle,title:he,children:he}),u.jsxs("div",{className:Re.cardMenu,children:[u.jsx("button",{type:"button",className:Re.iconAction,onClick:()=>void Ss(ne),disabled:!ne.enabled||v!==null,title:i("scheduledTasks.runNow"),"aria-label":i("scheduledTasks.runNow"),children:"▶"}),u.jsx("button",{type:"button",className:Re.iconAction,onClick:()=>on(ne),disabled:Ve,title:i("scheduledTasks.edit"),"aria-label":i("scheduledTasks.edit"),children:"✎"}),u.jsx("button",{type:"button",className:Re.iconAction,onClick:()=>void Ie(ne),disabled:Ve,title:i("scheduledTasks.delete"),"aria-label":i("scheduledTasks.delete"),children:"✕"})]})]}),ne.name&&u.jsx("div",{className:Re.cardPrompt,title:ne.prompt,children:ne.prompt}),u.jsxs("div",{className:Re.cardFooter,children:[l&&ne.workspaceCwd&&u.jsxs("span",{className:Re.workspacePill,title:ne.workspaceCwd,children:[u.jsx("span",{className:Re.workspaceIcon,"aria-hidden":"true",children:"⌂"}),G$(ne.workspaceCwd,!ne.workspaceId,i)]}),u.jsxs("span",{className:Re.schedulePill,children:[u.jsx("span",{className:Re.clockIcon,"aria-hidden":"true",children:"◷"}),Jy(ne.cron,i)]}),u.jsx("span",{className:Re.recurringTag,children:i(ne.recurring?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),ne.nextRunAt!=null&&u.jsxs("span",{className:Re.countdown,"data-testid":"scheduled-task-next-run",title:i("scheduledTasks.nextRunTooltip",{when:nne(ne.nextRunAt)}),children:[u.jsx("span",{className:Re.hourglassIcon,"aria-hidden":"true",children:"⏳"}),FLe(ne.nextRunAt-Ee,i)]}),u.jsx("span",{className:Re.lastFired,children:qLe(ne,i)}),ne.sessionId&&n?u.jsx("button",{type:"button",className:Re.runsToggle,onClick:()=>n(ne.sessionId),title:i("scheduledTasks.viewHistoryHint"),children:ne.runs.length>0?i("scheduledTasks.viewHistory",{count:ne.runs.length}):i("scheduledTasks.viewHistoryEmpty")}):ne.runs.length>0&&u.jsx("button",{type:"button",className:Re.runsToggle,"aria-expanded":Ne===_d(ne),onClick:()=>ge(we=>we===_d(ne)?null:_d(ne)),children:i("scheduledTasks.runHistory",{count:ne.runs.length})})]}),Ne===_d(ne)&&ne.runs.length>0&&u.jsx("ul",{className:Re.runsList,children:[...ne.runs].reverse().map((we,Bt)=>u.jsx("li",{className:Re.runsItem,children:Hlt(we,i)},`${we.at}-${Bt}`))})]},_d(ne))})})]})}const lne="update available";function oct(e){return e.displayName||e.name}function cne(e,t){return e.isActive?t("extensions.manage.status.enabled"):t("extensions.manage.status.disabled")}function act(e,t){switch(e){case"update available":return t("extensions.manage.updateAvailable");case"up to date":return t("extensions.manage.upToDate");case"not updatable":return t("extensions.manage.notUpdatable");case"checking for updates":return t("extensions.manage.checkingUpdates");case"error":return t("extensions.manage.updateError");default:return t("extensions.manage.unknownUpdate")}}function np(e){return e&&e.length>0?e.join(", "):"-"}const lct=LM;function cct(){const{t:e}=ot(),t=Ba(),n=$o(),s=Yu(),[r,i]=m.useState([]),[o,a]=m.useState(null),[l,c]=m.useState(null),[d,h]=m.useState({}),[f,p]=m.useState(!1),[g,y]=m.useState(!1),[w,v]=m.useState(null),[b,x]=m.useState(null),k=m.useCallback(()=>(p(!0),n.loadExtensionsStatus().then(L=>{var I,A;const M=L.extensions??[];i(M),x(((A=(I=L.errors)==null?void 0:I[0])==null?void 0:A.error)??null),a(P=>P&&M.some(B=>B.name===P)?P:null)}).catch(L=>{x(L instanceof Error?L.message:String(L))}).finally(()=>p(!1))),[n]),T=m.useCallback(()=>{const L=t.clientId;return L?(y(!0),n.checkExtensionUpdates(L).then(M=>h(M.states)).catch(M=>{x(M instanceof Error?M.message:String(M))}).finally(()=>y(!1))):(x(e("extensions.install.waitForSession")),Promise.resolve())},[n,t.clientId,e]),C=m.useCallback(()=>{const L=t.clientId;if(!L){x(e("extensions.install.waitForSession"));return}y(!0),n.refreshExtensions(L).then(async M=>{x(e("extensions.manage.refreshed",{refreshed:M.refreshed,failed:M.failed})),await k(),await T()}).catch(M=>{x(M instanceof Error?M.message:String(M))}).finally(()=>y(!1))},[n,T,t.clientId,k,e]);m.useEffect(()=>{k()},[k]),m.useEffect(()=>{r.length>0&&T()},[T,r.length]),m.useEffect(()=>{((s==null?void 0:s.extensionsVersion)??0)>0&&(h({}),k())},[k,s==null?void 0:s.extensionsVersion]);const S=m.useCallback((L,M,I={})=>{const A=t.clientId;if(!A&&!I.allowWithoutClientId){x(e("extensions.install.waitForSession"));return}v(L),x(null),M(A).then(()=>x(e("extensions.manage.queued",{name:L}))).catch(P=>{x(P instanceof Error?P.message:String(P))}).finally(()=>{v(null),k()})},[t.clientId,k,e]),_=m.useMemo(()=>f?e("extensions.manage.loading"):g?e("extensions.manage.checkingUpdates"):e("extensions.manage.count",{count:r.length}),[g,r.length,f,e]);return u.jsxs("div",{className:st("picker","picker-in-shell"),children:[u.jsxs("div",{className:st("picker-search","extensions-toolbar"),children:[u.jsx("span",{className:st("picker-search-hint"),children:b||_}),u.jsx("button",{type:"button",className:st("dialog-inline-button"),disabled:f||g,onClick:C,children:e("common.refresh")})]}),u.jsx("div",{className:st("picker-sep")}),u.jsxs("div",{className:st("picker-list"),children:[!f&&r.length===0&&u.jsx("div",{className:st("picker-empty"),children:e("extensions.manage.empty")}),r.map(L=>{const M=d[L.name]??L.updateState,I=o===L.name,A=w===L.name;return u.jsxs("div",{className:st("picker-item","picker-session-item","tools-picker-item",I?"selected":void 0,I?"tools-picker-item-expanded":void 0),children:[u.jsxs("button",{type:"button",className:st("extensions-row-button"),onClick:()=>{a(I?null:L.name),c(null)},children:[u.jsx("span",{className:st("tools-item-icon"),"aria-hidden":"true"}),u.jsx("span",{className:st("picker-item-title"),children:oct(L)}),u.jsxs("span",{className:st("picker-item-badge"),children:["v",L.version]}),u.jsx("span",{className:st("tools-status-badge",L.isActive?"tools-status-badge-enabled":"tools-status-badge-disabled"),children:cne(L,e)}),u.jsx("span",{className:st("tools-status-badge",M===lne?"tools-status-badge-busy":void 0),children:act(M,e)}),u.jsx("svg",{className:st("tools-item-chevron",I?"tools-item-chevron-expanded":void 0),viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})]}),I&&u.jsx(uct,{extension:L,updateState:M,busy:A,confirmingUninstall:l===L.name,onUpdate:()=>S(L.name,P=>n.updateExtension(L.name,P)),onToggleScope:(P,B)=>S(L.name,F=>P==="enable"?n.enableExtension(L.name,{scope:B},F):n.disableExtension(L.name,{scope:B},F),{allowWithoutClientId:!0}),onRequestUninstall:()=>c(L.name),onCancelUninstall:()=>c(null),onConfirmUninstall:()=>{S(L.name,P=>n.uninstallExtension(L.name,P)),c(null),a(null)}})]},L.id||L.name)})]})]})}function uct({extension:e,updateState:t,busy:n,confirmingUninstall:s,onUpdate:r,onToggleScope:i,onRequestUninstall:o,onCancelUninstall:a,onConfirmUninstall:l}){const{t:c}=ot(),d=e.details,h=e.isActive?"disable":"enable";return u.jsxs("div",{className:st("extensions-detail"),children:[u.jsxs("div",{className:st("extensions-detail-actions"),children:[u.jsx("button",{type:"button",className:st("dialog-inline-button"),disabled:n||t!==lne,onClick:r,children:c("extensions.manage.update")}),u.jsxs("button",{type:"button",className:st("dialog-inline-button"),disabled:n,onClick:()=>i(h,"user"),children:[c(h==="enable"?"extensions.manage.enable":"extensions.manage.disable"),"· ",c("settings.scope.user")]}),u.jsxs("button",{type:"button",className:st("dialog-inline-button"),disabled:n,onClick:()=>i(h,"workspace"),children:[c(h==="enable"?"extensions.manage.enable":"extensions.manage.disable"),"· ",c("settings.scope.workspace")]}),u.jsx("button",{type:"button",className:st("dialog-danger-button"),disabled:n,onClick:o,children:c("extensions.manage.uninstallAction")})]}),s&&u.jsxs("div",{className:st("extensions-confirm"),children:[u.jsx("span",{children:c("extensions.manage.uninstallConfirm",{name:e.name})}),u.jsxs("div",{className:st("dialog-inline-actions"),children:[u.jsx("button",{type:"button",className:st("dialog-danger-button"),disabled:n,onClick:l,children:c("extensions.manage.uninstallAction")}),u.jsx("button",{type:"button",className:st("dialog-inline-button"),onClick:a,children:c("common.cancel")})]})]}),u.jsxs("div",{className:st("extensions-detail-grid"),children:[u.jsx(Nl,{label:c("extensions.manage.name"),value:e.name}),u.jsx(Nl,{label:c("extensions.manage.version"),value:e.version}),u.jsx(Nl,{label:c("extensions.manage.status"),value:cne(e,c)}),u.jsx(Nl,{label:c("extensions.manage.path"),value:e.path}),u.jsx(Nl,{label:c("extensions.manage.source"),value:e.source??"-"}),u.jsx(Nl,{label:c("extensions.manage.commands"),value:np(d==null?void 0:d.commands)}),u.jsx(Nl,{label:c("extensions.manage.skills"),value:np(d==null?void 0:d.skills)}),u.jsx(Nl,{label:c("extensions.manage.agents"),value:np(d==null?void 0:d.agents)}),u.jsx(Nl,{label:c("extensions.manage.mcpServers"),value:np(d==null?void 0:d.mcpServers)}),u.jsx(Nl,{label:c("extensions.manage.contextFiles"),value:np(d==null?void 0:d.contextFiles)}),u.jsx(Nl,{label:c("extensions.manage.settings"),value:np(d==null?void 0:d.settings)})]})]})}function Nl({label:e,value:t}){return u.jsxs("div",{className:st("extensions-detail-field"),children:[u.jsx("span",{className:st("extensions-detail-label"),children:lct(e)}),u.jsx("span",{className:st("extensions-detail-value"),children:t})]})}const dct="_section_1ghly_1",hct="_header_1ghly_12",fct="_title_1ghly_19",mct="_addButton_1ghly_24",pct="_hint_1ghly_38",gct="_empty_1ghly_39",yct="_provider_1ghly_45",bct="_providerName_1ghly_51",vct="_modelRow_1ghly_59",wct="_modelInfo_1ghly_70",xct="_modelName_1ghly_78",kct="_modelBaseUrl_1ghly_84",_ct="_currentBadge_1ghly_91",Sct="_runtimeBadge_1ghly_99",Cct="_modelActions_1ghly_107",Tct="_actionButton_1ghly_114",Ect="_deleteButton_1ghly_115",Act="_confirmButton_1ghly_116",oi={section:dct,header:hct,title:fct,addButton:mct,hint:pct,empty:gct,provider:yct,providerName:bct,modelRow:vct,modelInfo:wct,modelName:xct,modelBaseUrl:kct,currentBadge:_ct,runtimeBadge:Sct,modelActions:Cct,actionButton:Tct,deleteButton:Ect,confirmButton:Act};function Fx(e,t){return`${e.authType}:${t.modelId}:${t.baseUrl??""}`}function Mct(e,t){const n=e.flatMap(r=>r.models.map(i=>({provider:r,model:i})));if(t){const r=n.find(({model:o})=>o.modelId===t);if(r)return Fx(r.provider,r.model);const i=n.find(({model:o})=>o.baseModelId===t);return i?Fx(i.provider,i.model):void 0}const s=n.find(({model:r})=>r.isCurrent);return s?Fx(s.provider,s.model):void 0}function Nct({providers:e,currentModelId:t,loading:n,error:s,busy:r,onSelectModel:i,onDeleteModel:o,onAddModel:a}){const{t:l}=ot(),[c,d]=m.useState(null);m.useEffect(()=>{if(c===null)return;const p=g=>{g.key==="Escape"&&d(null)};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[c]);const h=e.some(p=>p.models.length>0),f=Mct(e,t);return u.jsxs("div",{className:oi.section,"data-testid":"model-management",children:[u.jsxs("div",{className:oi.header,children:[u.jsx("span",{className:oi.title,children:l("settings.models.title")}),u.jsx("button",{type:"button",className:oi.addButton,disabled:r,onClick:a,children:l("settings.models.add")})]}),s&&u.jsx("div",{className:oi.hint,children:s.message}),n&&!h&&u.jsx("div",{className:oi.hint,children:l("settings.models.loading")}),!n&&!h&&!s&&u.jsx("div",{className:oi.empty,children:l("settings.models.empty")}),e.map((p,g)=>p.models.length===0?null:u.jsxs("div",{className:oi.provider,children:[u.jsx("div",{className:oi.providerName,children:p.authType}),p.models.map(y=>{const w=Fx(p,y),v=w===f,b=c===w,x=y.name||y.baseModelId;return u.jsxs("div",{className:oi.modelRow,children:[u.jsxs("div",{className:oi.modelInfo,children:[u.jsx("span",{className:oi.modelName,children:y.name||y.baseModelId}),v&&u.jsx("span",{className:oi.currentBadge,children:l("settings.models.current")}),y.isRuntime&&u.jsx("span",{className:oi.runtimeBadge,children:l("settings.models.runtime")}),y.baseUrl&&u.jsx("span",{className:oi.modelBaseUrl,children:y.baseUrl})]}),u.jsxs("div",{className:oi.modelActions,children:[!v&&u.jsx("button",{type:"button",className:oi.actionButton,disabled:r,"aria-label":`${l("settings.models.setCurrent")} ${x}`,onClick:()=>i(y.modelId),children:l("settings.models.setCurrent")}),!y.isRuntime&&(b?u.jsxs(u.Fragment,{children:[u.jsx("button",{type:"button",className:oi.confirmButton,disabled:r,"aria-label":`${l("settings.models.confirmDelete")} ${x}`,onClick:()=>{d(null),o({authType:p.authType,modelId:y.baseModelId,...y.baseUrl?{baseUrl:y.baseUrl}:{}})},children:l("settings.models.confirmDelete")}),u.jsx("button",{type:"button",className:oi.actionButton,disabled:r,"aria-label":`${l("settings.models.cancel")} ${x}`,onClick:()=>d(null),children:l("settings.models.cancel")})]}):u.jsx("button",{type:"button",className:oi.deleteButton,disabled:r,"aria-label":`${l("settings.models.delete")} ${x}`,onClick:()=>d(w),children:l("settings.models.delete")}))]})]},w)})]},`${p.authType}:${g}`))]})}const Ict=cg("group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current"}},defaultVariants:{variant:"default"}});function Rct({className:e,variant:t,...n}){return u.jsx("div",{"data-slot":"alert",role:"alert",className:In(Ict({variant:t}),e),...n})}function jct({className:e,...t}){return u.jsx("div",{"data-slot":"alert-description",className:In("text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",e),...t})}const Lct=cg("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function J$({className:e,variant:t="default",asChild:n=!1,...s}){const r=n?QQ:"span";return u.jsx(r,{"data-slot":"badge","data-variant":t,className:In(Lct({variant:t}),e),...s})}function Dct({className:e,size:t="default",...n}){return u.jsx("div",{"data-slot":"card","data-size":t,className:In("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",e),...n})}function Oct({className:e,...t}){return u.jsx("div",{"data-slot":"card-header",className:In("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)",e),...t})}function Pct({className:e,...t}){return u.jsx("div",{"data-slot":"card-title",className:In("text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",e),...t})}function Bct({className:e,...t}){return u.jsx("div",{"data-slot":"card-content",className:In("px-(--card-spacing)",e),...t})}function une({className:e,...t}){return u.jsx("div",{"data-slot":"empty",className:In("flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance",e),...t})}function dne({className:e,...t}){return u.jsx("div",{"data-slot":"empty-header",className:In("flex max-w-sm flex-col items-center gap-2",e),...t})}const $ct=cg("mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",icon:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4"}},defaultVariants:{variant:"default"}});function hne({className:e,variant:t="default",...n}){return u.jsx("div",{"data-slot":"empty-icon","data-variant":t,className:In($ct({variant:t,className:e})),...n})}function fne({className:e,...t}){return u.jsx("div",{"data-slot":"empty-title",className:In("text-sm font-medium tracking-tight",e),...t})}function mne({className:e,...t}){return u.jsx("div",{"data-slot":"empty-description",className:In("text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...t})}function zct({className:e,...t}){return u.jsx("div",{"data-slot":"empty-content",className:In("flex w-full max-w-sm min-w-0 flex-col items-center gap-2.5 text-sm text-balance",e),...t})}function Fct({className:e,...t}){return u.jsx(sVe,{"data-slot":"label",className:In("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}function qct({className:e,orientation:t="horizontal",decorative:n=!0,...s}){return u.jsx(IVe,{"data-slot":"separator",decorative:n,orientation:t,className:In("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",e),...s})}function zM({className:e,...t}){return u.jsx("div",{"data-slot":"field-group",className:In("group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4",e),...t})}const Hct=cg("group/field flex w-full gap-2 data-[invalid=true]:text-destructive",{variants:{orientation:{vertical:"flex-col *:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});function i0({className:e,orientation:t="vertical",...n}){return u.jsx("div",{role:"group","data-slot":"field","data-orientation":t,className:In(Hct({orientation:t}),e),...n})}function pne({className:e,...t}){return u.jsx("div",{"data-slot":"field-content",className:In("group/field-content flex flex-1 flex-col gap-0.5 leading-snug",e),...t})}function ry({className:e,...t}){return u.jsx(Fct,{"data-slot":"field-label",className:In("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",e),...t})}function Uct({className:e,...t}){return u.jsx("div",{"data-slot":"field-label",className:In("flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50",e),...t})}function y7({className:e,...t}){return u.jsx("p",{"data-slot":"field-description",className:In("text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5","last:mt-0 nth-last-2:-mt-1","[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...t})}function Vct({className:e,children:t,errors:n,...s}){const r=m.useMemo(()=>{var o;if(t)return t;if(!(n!=null&&n.length))return null;const i=[...new Map(n.map(a=>[a==null?void 0:a.message,a])).values()];return(i==null?void 0:i.length)==1?(o=i[0])==null?void 0:o.message:u.jsx("ul",{className:"ml-4 flex list-disc flex-col gap-1",children:i.map((a,l)=>(a==null?void 0:a.message)&&u.jsx("li",{children:a.message},l))})},[t,n]);return r?u.jsx("div",{role:"alert","data-slot":"field-error",className:In("text-sm font-normal text-destructive",e),...s,children:r}):null}const Bp=m.forwardRef(function({className:t,type:n,...s},r){return u.jsx("input",{ref:r,type:n,"data-slot":"input",className:In("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",t),...s})});function b7({className:e,...t}){return u.jsx(Fue,{"data-slot":"spinner",role:"status","aria-label":"Loading",className:In("size-4 animate-spin",e),...t})}function gne({className:e,size:t="default",...n}){return u.jsx(bee,{"data-slot":"switch","data-size":t,className:In("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",e),...n,children:u.jsx(wee,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}function Wct({className:e,orientation:t="horizontal",...n}){return u.jsx(BVe,{orientation:t,"data-slot":"tabs","data-orientation":t,className:In("group/tabs flex gap-2 data-horizontal:flex-col",e),...n})}const Gct=cg("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function Kct({className:e,variant:t="default",...n}){return u.jsx($Ve,{"data-slot":"tabs-list","data-variant":t,className:In(Gct({variant:t}),e),...n})}function Z$({className:e,...t}){return u.jsx(zVe,{"data-slot":"tabs-trigger",className:In("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent","data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground","after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",e),...t})}function Yct({className:e,...t}){return u.jsx(FVe,{"data-slot":"tabs-content",className:In("flex-1 text-sm outline-none",e),...t})}const Xct=new Set(["fastModel","visionModel","voiceModel","modelFallbacks"]),Qct=new Set(["ui.hideTips","ui.enableUserFeedback","ui.compactMode","ui.compactInline"]);function $4(e,t,n){const s=e(t);return s===t?n:s}function Jct(e,t){return $4(t,`settings.category.${e}`,e)}function sp(e,t){return $4(t,`settings.label.${e.key}`,e.label)}function Zct(e,t){if(e.description)return $4(t,`settings.description.${e.key}`,e.description)}function yne(e,t,n,s){return $4(s,`settings.option.${e.key}.${String(t)}`,n)}function eut(e,t,n){const s=vne(e,t);if(s==null)return"";if(e.key===Tf){const i=WE(s,gr.Dark);return n(`theme.${i}`)}if(e.key===Ek){const i=HE(s);return i?UE(i):String(s)}if(e.type==="boolean")return n(s===!0?"settings.value.on":"settings.value.off");if(e.type==="enum"&&e.options){const i=e.options.find(o=>o.value===s);return i?yne(e,i.value,i.label,n):String(s)}const r=String(s);return r.length>24?`${r.slice(0,21)}…`:r}function bne(e,t){return(t==="user"?e.values.user:e.values.workspace)!==void 0}function tut(e,t){if(t==="workspace"?e.values.user!==void 0:e.values.workspace!==void 0)return bne(e,t)?"settings.alsoModifiedIn":"settings.modifiedIn"}function vne(e,t){const n=t==="user"?e.values.user:e.values.workspace;return n!==void 0?n:e.values.effective}function nut(e){const t=new Map;for(const n of e){let s=t.get(n.category);s||(s=[],t.set(n.category,s)),s.push(n)}return Array.from(t.entries()).map(([n,s])=>({category:n,items:s}))}function ez({category:e}){const t=e.toLowerCase(),n=t.includes("ui")?Yue:t.includes("tool")?xde:t.includes("context")?Sue:t.includes("privacy")?dde:t.includes("model")?hue:t.includes("daemon")?ode:t.includes("advanced")?fde:t.includes("experimental")?Mue:kU;return u.jsx(n,{"data-icon":"inline-start","aria-hidden":"true"})}function tz({title:e,description:t,metadata:n,control:s}){return u.jsxs(i0,{orientation:"responsive",className:"min-h-20 gap-6 px-5 py-4 max-md:px-4",children:[u.jsxs(pne,{className:"min-w-0",children:[u.jsxs(Uct,{children:[e,n]}),t&&u.jsx(y7,{className:"max-w-3xl",children:t})]}),u.jsx("div",{className:"flex min-w-0 justify-end max-md:justify-start",children:s})]})}function sut({name:e,label:t,type:n,value:s,disabled:r,onCommit:i,onInvalid:o}){const a=String(s??""),[l,c]=m.useState(a);m.useEffect(()=>c(a),[a]);const d=()=>{if(n==="number"){const h=l.trim(),f=Number(h);if(!h||!Number.isFinite(f)){c(a),o();return}f!==s&&i(f);return}l!==a&&i(l)};return u.jsx(Bp,{type:n,name:e,autoComplete:"off","aria-label":t,value:l,disabled:r,className:"w-[min(80px,50vw)] max-md:w-full",onChange:h=>c(h.target.value),onBlur:d,onKeyDown:h=>{h.key==="Enter"&&h.currentTarget.blur(),h.key==="Escape"&&(c(a),h.currentTarget.blur())}})}function rut({settingsState:e,onLanguageChange:t,onSubDialog:n,onThemeChange:s,chatWidthMode:r,onChatWidthModeChange:i,modelManagement:o,embedded:a=!1}){const{language:l,t:c}=ot(),d=V0(),{status:h,settings:f,loading:p,error:g,reload:y,setValue:w}=e,[v,b]=m.useState("workspace"),[x,k]=m.useState(""),[T,C]=m.useState(null),[S,_]=m.useState(null),[L,M]=m.useState(!1),I=p&&!h,A=m.useMemo(()=>{const z=f.filter(q=>!Qct.has(q.key)),U=nut(z).map(q=>({id:q.category,label:Jct(q.category,c),items:q.items.map(N=>({type:"setting",setting:N}))})),D={type:"local",localKey:"chatWidth"},G=U.find(q=>q.items.some(N=>N.type==="setting"&&N.setting.key===Tf));if(G){const q=G.items.findIndex(N=>N.type==="setting"&&N.setting.key===Tf);G.items.splice(q+1,0,D)}else U.push({id:c("settings.category.UI"),label:c("settings.category.UI"),items:[D]});return U},[f,c]);m.useEffect(()=>{A.length!==0&&(A.some(z=>z.id===x)||k(A[0].id))},[x,A]),m.useEffect(()=>{var z;g?_(g.message):(z=h==null?void 0:h.warnings)!=null&&z.length?_(h.warnings.map(U=>c("settings.corrupted",{recovered:U.recovered?"true":"false"})).join("; ")):f.length>0&&_(null)},[g,f,h,c]);const P=m.useCallback((z,U)=>{L||_(null),C(z),w(v,z,U).then(async D=>{try{await y()}catch{}D!=null&&D.requiresRestart&&z!==Ek&&M(!0)}).catch(D=>{_(D instanceof Error?D.message:String(D))}).finally(()=>C(null))},[y,L,v,w]),B=A.find(z=>z.id===x)??A[0],F=B==null?void 0:B.items.some(z=>z.type==="setting"&&z.setting.category==="Model"),O=(z,U,D,G,q=!1)=>u.jsxs(AM,{value:z,disabled:q,onValueChange:U,children:[u.jsx(IM,{size:"sm","aria-label":G,className:"w-[min(160px,50vw)] bg-background max-md:w-full",children:u.jsx(NM,{})}),u.jsx(RM,{position:"popper",align:"end",children:u.jsx(MM,{children:D.map(N=>u.jsx(F2,{value:N.value,children:N.label},N.value))})})]}),X=z=>{var q;const U=vne(z,v),G=T===z.key;if(z.key===Tf)return O(WE(U)??d,N=>{const ee=N;s(ee),P(Tf,DU(ee))},jU.map(N=>({value:N,label:c(`theme.${N}`)})),sp(z,c),G);if(z.key===Ek)return O(HE(U)??l,N=>t(N,v),Hde.map(N=>({value:N,label:UE(N)})),sp(z,c),G);if(Xct.has(z.key))return u.jsx(Oc,{type:"button",variant:"outline",size:"sm",disabled:G,className:"max-w-[260px] truncate",onClick:()=>n(z.key,v),children:eut(z,v,c)||c("settings.action.select")});if(z.type==="boolean"){const N=U===!0;return u.jsx(gne,{checked:N,disabled:G,onCheckedChange:ee=>P(z.key,ee),"aria-label":sp(z,c)})}if(z.type==="enum"&&((q=z.options)!=null&&q.length)){const N=z.options.findIndex(ee=>ee.value===U);return O(N>=0?String(N):"",ee=>{var Q;const re=(Q=z.options)==null?void 0:Q[Number(ee)];re&&P(z.key,re.value)},z.options.map((ee,re)=>({value:String(re),label:yne(z,ee.value,ee.label,c)})),sp(z,c),G)}return u.jsx(sut,{name:z.key,label:sp(z,c),type:z.type==="number"?"number":"text",value:U,disabled:G,onCommit:N=>P(z.key,N),onInvalid:()=>_(c("settings.invalidNumber"))})};return u.jsxs("div",{className:a?"flex min-h-0 flex-1 flex-col text-sm text-foreground":"flex max-w-[min(var(--chat-regular-content-width,1000px),calc(100vw-64px))] flex-col overflow-hidden rounded-xl border border-border bg-background text-sm text-foreground","data-keyboard-scope":!0,children:[!a&&u.jsx("div",{className:"flex items-center justify-between border-b border-border px-5 py-4",children:u.jsxs("div",{children:[u.jsx("h2",{className:"text-base font-semibold text-balance",children:c("settings.title")}),u.jsx("div",{className:"mt-0.5 text-xs text-muted-foreground",children:c("settings.scope.workspace")})]})}),(S||I)&&u.jsxs(Rct,{className:"mx-4 mt-3 w-auto",children:[I&&u.jsx(b7,{}),u.jsx(jct,{children:S||c("settings.loading")})]}),u.jsxs(Wct,{value:v,className:"flex min-h-0 flex-1 flex-col gap-0",onValueChange:z=>{b(z)},children:[u.jsxs("div",{className:"flex items-center justify-between gap-4 border-b border-border px-3 py-2",children:[u.jsxs(Kct,{className:"p-0",children:[u.jsx(Z$,{value:"workspace",children:c("settings.scope.workspace")}),u.jsx(Z$,{value:"user",children:c("settings.scope.user")})]}),L&&u.jsx(J$,{variant:"secondary",children:c("settings.requiresRestart")})]}),u.jsxs(Yct,{value:v,forceMount:!0,className:"grid min-h-0 flex-1 grid-cols-[190px_minmax(0,1fr)] outline-none max-md:grid-cols-1",children:[u.jsx("nav",{className:"flex min-h-0 flex-col gap-1 overflow-y-auto border-r border-border bg-muted/20 p-3 max-md:flex-row max-md:overflow-x-auto max-md:border-r-0 max-md:border-b","aria-label":c("settings.title"),children:A.map(z=>u.jsxs(Oc,{type:"button",variant:z.id===x?"secondary":"ghost",size:"sm","aria-current":z.id===x?"page":void 0,className:"w-full justify-start gap-2 px-2.5 max-md:w-auto max-md:shrink-0",onClick:()=>k(z.id),children:[u.jsx(ez,{category:z.id}),u.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:z.label}),u.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:z.items.length})]},z.id))}),u.jsxs("section",{className:"min-h-0 min-w-0 overflow-y-auto bg-background p-5 max-md:p-3",children:[!p&&!B&&u.jsx(une,{className:"min-h-60",children:u.jsxs(dne,{children:[u.jsx(hne,{variant:"icon",children:u.jsx(kU,{})}),u.jsx(fne,{children:c("settings.empty")}),u.jsx(mne,{children:c("settings.empty")})]})}),B&&u.jsxs("div",{className:"mx-auto w-full max-w-5xl",children:[u.jsxs(Dct,{children:[u.jsx(Oct,{children:u.jsxs(Pct,{className:"flex items-center gap-2",children:[u.jsx(ez,{category:B.id}),B.label]})}),u.jsx(Bct,{className:"-mb-(--card-spacing) p-0",children:u.jsx(zM,{className:"gap-0",children:B.items.map((z,U)=>{const D=U>0&&u.jsx(qct,{className:"mx-5 w-auto max-md:mx-4"});if(z.type==="local")return u.jsxs("div",{children:[D,u.jsx(tz,{title:c("settings.label.ui.chatWidth"),description:c("settings.description.ui.chatWidth"),control:O(r,Q=>i(Q),[{value:"1000",label:c("settings.option.ui.chatWidth.1000")},{value:"wide",label:c("settings.option.ui.chatWidth.wide")}],c("settings.label.ui.chatWidth"),!1)})]},z.localKey);const G=z.setting,q=Zct(G,c),N=tut(G,v),ee=bne(G,v),re=N?c(N,{scope:c(v==="workspace"?"settings.scope.user":"settings.scope.workspace")}):void 0;return u.jsxs("div",{children:[D,u.jsx(tz,{title:sp(G,c),description:[q,re].filter(Boolean).join(" · ")||void 0,metadata:ee?u.jsx(J$,{variant:"secondary",children:c(v==="workspace"?"settings.scope.workspace":"settings.scope.user")}):void 0,control:T===G.key?u.jsx(b7,{}):X(G)})]},G.key)})})})]}),F&&o&&u.jsx("div",{className:"mt-4",children:u.jsx(Nct,{...o})})]})]})]})]}),!a&&u.jsx("div",{className:"border-t border-border px-5 py-3 text-xs text-muted-foreground",children:c("settings.footer")})]})}const iut="_dialog_1ymqd_1",out="_toolbar_1ymqd_12",aut="_tabs_1ymqd_21",lut="_tab_1ymqd_21",cut="_tabActive_1ymqd_39",uut="_search_1ymqd_48",dut="_general_1ymqd_60",hut="_shortcuts_1ymqd_67",fut="_shortcut_1ymqd_67",mut="_shortcutKey_1ymqd_87",put="_shortcutDesc_1ymqd_95",gut="_commandList_1ymqd_101",yut="_commandCard_1ymqd_108",but="_commandCardExpanded_1ymqd_115",vut="_commandRow_1ymqd_119",wut="_commandName_1ymqd_135",xut="_commandTag_1ymqd_142",kut="_chevron_1ymqd_152",_ut="_chevronExpanded_1ymqd_160",Sut="_commandDetail_1ymqd_164",Cut="_commandDescription_1ymqd_174",Tut="_commandSubcommands_1ymqd_175",Eut="_empty_1ymqd_182",Br={dialog:iut,toolbar:out,tabs:aut,tab:lut,tabActive:cut,search:uut,general:dut,shortcuts:hut,shortcut:fut,shortcutKey:mut,shortcutDesc:put,commandList:gut,commandCard:yut,commandCardExpanded:but,commandRow:vut,commandName:wut,commandTag:xut,chevron:kut,chevronExpanded:_ut,commandDetail:Sut,commandDescription:Cut,commandSubcommands:Tut,empty:Eut},Aut=[{id:"general",labelKey:"help.tab.general"},{id:"commands",labelKey:"help.tab.commands"},{id:"custom-commands",labelKey:"help.tab.custom"}],Mut=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"]),Nut=[["@","help.shortcut.addContext"],["!","help.shortcut.shell"],["/","help.shortcut.commandMenu"],["Tab","help.shortcut.completion"],["Esc","help.shortcut.cancel"],["Ctrl+J","help.shortcut.newline"],["Ctrl+L","help.shortcut.clear"],["Ctrl+Y","help.shortcut.retry"],["Shift+Tab","help.shortcut.approvals"],["Alt+Left/Right","help.shortcut.altWords"],["Up/Down","help.shortcut.history"]];function Iut(e){return[`/${e.name}`,e.argumentHint].filter(Boolean).join(" ")}function v7(e){return!Mut.has(e.name)}function Rut(e,t){return v7(e)?t("help.commandMeta.custom"):t("help.commandMeta.builtIn")}function jut(e,t,n){const s=n.trim().toLowerCase();return e.filter(r=>r.name&&r.description!==void 0).filter(r=>t==="commands"?!v7(r):t==="custom-commands"?v7(r):!0).filter(r=>s?r.name.toLowerCase().includes(s)||(r.description??"").toLowerCase().includes(s)||(r.argumentHint??"").toLowerCase().includes(s):!0).sort((r,i)=>r.name.localeCompare(i.name))}function Lut(){const{t:e}=ot();return u.jsx("div",{className:Br.general,children:u.jsx("div",{className:Br.shortcuts,children:Nut.map(([t,n])=>u.jsxs("div",{className:Br.shortcut,children:[u.jsx("span",{className:Br.shortcutDesc,children:e(n)}),u.jsx("span",{className:Br.shortcutKey,children:t})]},t))})})}function Dut({commands:e,tab:t,query:n}){const{t:s}=ot(),[r,i]=m.useState(null),o=m.useMemo(()=>jut(e,t,n),[e,n,t]);return o.length===0?u.jsx("div",{className:Br.empty,children:s(t==="custom-commands"?"help.emptyCustom":"help.empty")}):u.jsx("div",{className:Br.commandList,children:o.map(a=>{var c;const l=r===a.name;return u.jsxs("article",{className:`${Br.commandCard} ${l?Br.commandCardExpanded:""}`,children:[u.jsxs("button",{type:"button",className:Br.commandRow,onClick:()=>i(l?null:a.name),"aria-expanded":l,children:[u.jsx("span",{className:Br.commandName,children:Iut(a)}),u.jsx("span",{className:Br.commandTag,children:Rut(a,s)}),u.jsx("svg",{className:`${Br.chevron} ${l?Br.chevronExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})]}),l&&u.jsxs("div",{className:Br.commandDetail,children:[a.description&&u.jsx("div",{className:Br.commandDescription,children:a.description}),!!((c=a.subcommands)!=null&&c.length)&&u.jsxs("div",{className:Br.commandSubcommands,children:[s("help.subcommands"),": ",a.subcommands.join(", ")]})]})]},a.name)})})}function Out({commands:e}){const{t}=ot(),[n,s]=m.useState("general"),{filterValue:r,inputProps:i}=P4(),o=n!=="general";return u.jsxs("div",{className:Br.dialog,children:[u.jsxs("div",{className:Br.toolbar,children:[u.jsx("div",{className:Br.tabs,children:Aut.map(a=>u.jsx("button",{type:"button",className:`${Br.tab} ${a.id===n?Br.tabActive:""}`,onClick:()=>s(a.id),children:t(a.labelKey)},a.id))}),o&&u.jsx("input",{className:Br.search,...i,placeholder:t("help.search")})]}),n==="general"?u.jsx(Lut,{}):u.jsx(Dut,{commands:e,tab:n,query:r})]})}function Put({currentTheme:e,onSelect:t,onClose:n}){const{t:s}=ot(),r=jU.map(d=>({id:d,label:s(`theme.${d}`),description:s(`theme.${d}.desc`)})),[i,o]=m.useState(()=>{const d=r.findIndex(h=>h.id===e);return d>=0?d:0}),a=m.useRef(null),l=d=>{const h=r[d];h&&(t(h.id),n())},{keyboardMode:c}=Vh({itemCount:r.length,activeIndex:i,onActiveIndexChange:o,onConfirm:l});return m.useEffect(()=>{var h;const d=(h=a.current)==null?void 0:h.children[i];d==null||d.scrollIntoView({block:"nearest"})},[i]),u.jsx("div",{className:st("picker-list","picker-list-compact",c?"picker-keyboard-only":void 0),ref:a,role:"listbox","aria-label":s("theme.title"),tabIndex:0,"aria-activedescendant":r.length>0?`theme-opt-${i}`:void 0,"data-web-shell-theme-dialog":!0,children:r.map((d,h)=>{const f=d.id===e;return u.jsxs("div",{id:`theme-opt-${h}`,role:"option","aria-selected":f,className:st("picker-item","picker-session-item",h===i?"selected":void 0,f?"dialog-current":void 0),"data-web-shell-theme-option":!0,"data-theme-id":d.id,onClick:()=>l(h),onMouseMove:()=>o(h),children:[u.jsx("div",{className:st("picker-item-row"),children:u.jsx("span",{className:st("picker-item-title"),children:d.label})}),u.jsx("div",{className:st("picker-item-meta"),children:d.description})]},d.id)})})}const w7="delete-session-list",nz=e=>`${w7}-opt-${e}`;function But({onDeleted:e,onError:t,onClose:n}){const{t:s}=ot(),r=Ba(),{sessions:i,loading:o,error:a,deleteSession:l,deleteSessions:c}=ah({autoLoad:!0}),d=r.sessionId,[h,f]=m.useState(!1),[p,g]=m.useState(-1),[y,w]=m.useState(new Set),{filterValue:v,inputProps:b}=P4(()=>{g(-1),w(new Set)}),[x,k]=m.useState(null),T=m.useRef(null),C=m.useRef(null);m.useEffect(()=>{a&&k(a.message)},[a]);const S=m.useMemo(()=>v?i.filter(P=>{const B=v.toLowerCase();return(P.displayName||"").toLowerCase().includes(B)||P.sessionId.toLowerCase().includes(B)}):i,[i,v]),_=m.useCallback(P=>{P!==d&&w(B=>{const F=new Set(B);return F.has(P)?F.delete(P):F.add(P),F})},[d]);m.useEffect(()=>{if(y.size===0)return;const P=new Set(S.map(B=>B.sessionId));w(B=>{const F=new Set([...B].filter(O=>P.has(O)));return F.size===B.size?B:F})},[S,y.size]),m.useEffect(()=>{p>=S.length&&S.length>0&&g(S.length-1)},[S.length,p]),m.useEffect(()=>{var B;const P=(B=T.current)==null?void 0:B.children[p];P==null||P.scrollIntoView({block:"nearest"})},[p]),m.useEffect(()=>{var P;(P=C.current)==null||P.focus()},[]);const{keyboardMode:L}=Vh({itemCount:S.length,activeIndex:p,onActiveIndexChange:g,onConfirm:P=>{const B=S[P];B&&_(B.sessionId)}}),M=m.useCallback(()=>{if(h)return;if(y.size>0){const B=new Set(S.map(O=>O.sessionId)),F=Array.from(y).filter(O=>B.has(O));if(F.length===0)return;f(!0),c(F).then(O=>{const X=O.removed.length+O.notFound.length,z=O.errors.length;if(z>0&&X>0){t(new Error(s("delete.partialFail",{removed:X,failed:z,detail:O.errors[0].error}))),n();return}if(z>0){k(s("delete.allFailed",{count:z,reason:O.errors[0].error})),f(!1),w(new Set);return}if(X===0){k(s("delete.nonRemoved")),f(!1),w(new Set);return}e([...O.removed,...O.notFound]),n()}).catch(O=>{t(O),f(!1)});return}const P=S[p];if(P){if(P.sessionId===d){k(s("delete.cannotCurrent"));return}f(!0),l(P.sessionId).then(B=>{if(!B){k(s("delete.notFound")),f(!1);return}e([P.sessionId]),n()}).catch(B=>{t(B),f(!1)})}},[d,l,c,h,S,n,e,t,p,y,s]),I=y.size>0,A=!h&&!o&&I;return u.jsxs("div",{className:st("picker","picker-in-shell"),children:[u.jsxs("div",{className:st("picker-search"),children:[u.jsxs("span",{className:st("picker-search-label"),children:[s("resume.search"),":"," "]}),u.jsx("input",{ref:C,className:st("picker-search-input"),"aria-label":s("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":w7,"aria-activedescendant":p>=0&&p<S.length?nz(p):void 0,...b,placeholder:""}),u.jsx("span",{className:st("picker-search-hint"),children:x||(h?s("delete.deleting"):o?s("common.loading"):I?s("delete.selected",{count:y.size}):v?s("delete.matches",{count:S.length}):"")})]}),u.jsx("div",{className:st("picker-sep")}),u.jsxs("div",{id:w7,role:"listbox","aria-multiselectable":"true",className:st("picker-list",L?"picker-keyboard-only":void 0),ref:T,children:[o&&u.jsx("div",{className:st("picker-empty"),children:s("common.loading")}),!o&&a&&u.jsx("div",{className:st("picker-empty"),children:a.message}),!o&&!a&&S.length===0&&u.jsx("div",{className:st("picker-empty"),children:v?s("delete.noMatch",{query:v}):s("delete.none")}),!o&&S.map((P,B)=>{const F=P.sessionId===d,O=y.has(P.sessionId);return u.jsx(jM,{session:P,optionId:nz(B),active:B===p,ariaSelected:O,current:!1,disabled:F,leading:u.jsx("span",{className:st("picker-item-checkbox",O?"picker-item-checkbox-checked":void 0),children:O?"[x] ":"[ ] "}),trailing:F?u.jsx("span",{className:st("picker-item-badge"),children:s("resume.current")}):void 0,onClick:()=>{g(B),F||_(P.sessionId)},onActivate:()=>g(B)},P.sessionId)})]}),u.jsx("div",{className:st("picker-sep")}),u.jsxs("div",{className:st("dialog-footer-actions"),children:[u.jsx("button",{type:"button",className:st("dialog-inline-button"),onClick:n,disabled:h,children:s("common.cancel")}),u.jsx("button",{type:"button",className:st("dialog-danger-button"),onClick:M,disabled:!A,children:s(h?"delete.deleting":"delete.action")})]})]})}const x7="release-session-list",sz=e=>`${x7}-opt-${e}`;function $ut({onReleased:e,onError:t,onClose:n}){const{t:s}=ot(),r=Ba(),{sessions:i,loading:o,error:a,releaseSession:l}=ah({autoLoad:!0}),c=r.sessionId,[d,h]=m.useState(!1),[f,p]=m.useState(-1),[g,y]=m.useState(null),{filterValue:w,inputProps:v}=P4(()=>{p(-1),y(null)}),[b,x]=m.useState(null),k=m.useRef(null),T=m.useRef(null);m.useEffect(()=>{a&&x(a.message)},[a]);const C=w?i.filter(P=>{const B=w.toLowerCase();return(P.displayName||"").toLowerCase().includes(B)||P.sessionId.toLowerCase().includes(B)}):i,S=P=>{const B=C[P];if(!B)return;const F=B.sessionId===c,O=(B.clientCount??0)>0||B.hasActivePrompt===!0;F||!O||(p(P),y(B.sessionId))};m.useEffect(()=>{f>=C.length&&C.length>0&&p(C.length-1)},[C.length,f]),m.useEffect(()=>{var B;const P=(B=k.current)==null?void 0:B.children[f];P==null||P.scrollIntoView({block:"nearest"})},[f]),m.useEffect(()=>{var P;(P=T.current)==null||P.focus()},[]);const{keyboardMode:_}=Vh({itemCount:C.length,activeIndex:f,onActiveIndexChange:p,onConfirm:S}),L=m.useCallback(P=>{const B=P??C.find(O=>O.sessionId===g)??void 0;if(!B||d)return;if(!((B.clientCount??0)>0||B.hasActivePrompt===!0)){x(s("release.inactive"));return}if(B.sessionId===c){x(s("release.cannotCurrent"));return}l&&(h(!0),l(B.sessionId).then(()=>{e(B.sessionId),n()}).catch(O=>{t(O),h(!1)}))},[c,d,C,n,t,e,l,g,s]),M=C.find(P=>P.sessionId===g)??void 0,I=M&&((M.clientCount??0)>0||M.hasActivePrompt===!0),A=!d&&!o&&!!M&&M.sessionId!==c&&!!I;return u.jsxs("div",{className:st("picker","picker-in-shell"),children:[u.jsxs("div",{className:st("picker-search"),children:[u.jsxs("span",{className:st("picker-search-label"),children:[s("resume.search"),":"," "]}),u.jsx("input",{ref:T,className:st("picker-search-input"),"aria-label":s("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":x7,"aria-activedescendant":f>=0&&f<C.length?sz(f):void 0,...v,placeholder:""}),u.jsx("span",{className:st("picker-search-hint"),children:b||(d?s("release.releasing"):o?s("common.loading"):w?s("release.matches",{count:C.length}):"")})]}),u.jsx("div",{className:st("picker-sep")}),u.jsxs("div",{id:x7,role:"listbox",className:st("picker-list",_?"picker-keyboard-only":void 0),ref:k,children:[o&&u.jsx("div",{className:st("picker-empty"),children:s("common.loading")}),!o&&C.length===0&&u.jsx("div",{className:st("picker-empty"),children:w?s("release.noMatch",{query:w}):s("release.none")}),!o&&C.map((P,B)=>{const F=P.sessionId===c,O=(P.clientCount??0)>0||P.hasActivePrompt===!0,X=F||!O;return u.jsx(jM,{session:P,optionId:sz(B),active:B===f,confirmed:P.sessionId===g,ariaSelected:P.sessionId===g,current:!1,disabled:X,trailing:F?u.jsx("span",{className:st("picker-item-badge"),children:s("resume.current")}):O?void 0:u.jsx("span",{className:st("picker-item-badge"),children:s("release.inactiveBadge")}),onClick:()=>S(B),onActivate:()=>p(B)},P.sessionId)})]}),u.jsx("div",{className:st("picker-sep")}),u.jsxs("div",{className:st("dialog-footer-actions"),children:[u.jsx("button",{type:"button",className:st("dialog-inline-button"),onClick:n,disabled:d,children:s("common.cancel")}),u.jsx("button",{type:"button",className:st("dialog-danger-button"),onClick:()=>L(),disabled:!A,children:s(d?"release.releasing":"release.action")})]})]})}const zut="_root_ieg2d_1",Fut="_list_ieg2d_8",qut="_item_ieg2d_21",Hut="_itemCursor_ieg2d_42",Uut="_itemSelected_ieg2d_49",Vut="_prompt_ieg2d_61",Wut="_keyboardOnly_ieg2d_68",Gut="_itemDisabled_ieg2d_77",Kut="_turn_ieg2d_91",Yut="_time_ieg2d_96",Xut="_footer_ieg2d_102",Qut="_footerMessage_ieg2d_112",Jut="_dangerButton_ieg2d_118",ya={root:zut,list:Fut,item:qut,itemCursor:Hut,itemSelected:Uut,prompt:Vut,keyboardOnly:Wut,itemDisabled:Gut,turn:Kut,time:Yut,footer:Xut,footerMessage:Qut,dangerButton:Jut},Zut="rewind-snapshot-list",rz=e=>`${Zut}-opt-${e}`;function edt(e,t){let n=0;for(const s of e)if(s.kind==="user"){if(n===t)return s.text.trim();n+=1}return""}function tdt(e){const t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString():e}function ndt({blocks:e,loadSnapshots:t,rewind:n,onError:s,onClose:r}){const{t:i}=ot(),[o,a]=m.useState([]),[l,c]=m.useState(!0),[d,h]=m.useState(null),[f,p]=m.useState(0),[g,y]=m.useState(null),[w,v]=m.useState(null);m.useEffect(()=>{let _=!0;return c(!0),t().then(L=>{_&&a(L.snapshots)}).catch(L=>{_&&s(L)}).finally(()=>{_&&c(!1)}),()=>{_=!1}},[t,s]);const b=m.useMemo(()=>o.map(_=>({snapshot:_,promptText:edt(e,_.turnIndex)})).sort((_,L)=>_.snapshot.turnIndex-L.snapshot.turnIndex),[e,o]);m.useEffect(()=>{f>=b.length&&b.length>0&&p(b.length-1)},[b.length,f]);const x=m.useRef(null),k=d!==null,T=_=>{!_||d||(h(_),v(null),n(_).then(()=>{r()}).catch(L=>{s(L),v(i("rewind.failed",{reason:L instanceof Error?L.message:String(L)})),h(null)}))},C=_=>{const L=b[_];L&&(p(_),y(L.snapshot.promptId))},{keyboardMode:S}=Vh({itemCount:b.length,activeIndex:f,onActiveIndexChange:p,onConfirm:C,enabled:!k});return m.useEffect(()=>{var L;const _=(L=x.current)==null?void 0:L.children[f];_==null||_.scrollIntoView({block:"nearest"})},[f]),m.useEffect(()=>{var L;if(l||b.length===0)return;const _=document.activeElement;(_==null?void 0:_.getAttribute("role"))==="dialog"&&((L=x.current)==null||L.focus())},[l,b.length]),l?u.jsx("div",{className:st("picker-empty"),children:i("rewind.loading")}):b.length===0?u.jsx("div",{className:st("picker-empty"),children:i("rewind.empty")}):u.jsxs("div",{className:ya.root,children:[u.jsx("div",{className:`${ya.list} ${S?ya.keyboardOnly:""}`,ref:x,role:"listbox","aria-label":i("rewind.title"),tabIndex:0,"aria-activedescendant":b.length>0?rz(f):void 0,children:b.map(({snapshot:_,promptText:L},M)=>{const I=M===f,A=g===_.promptId,P=L||i("rewind.promptFallback",{id:_.promptId.slice(-8)});return u.jsxs("div",{id:rz(M),role:"option","aria-selected":A,"aria-disabled":k||void 0,className:`${ya.item} ${I?ya.itemCursor:""} ${A?ya.itemSelected:""} ${k?ya.itemDisabled:""}`,onClick:()=>{k||C(M)},onMouseMove:()=>p(M),children:[u.jsxs("div",{className:ya.prompt,title:P,children:[u.jsxs("span",{className:ya.turn,children:["#",_.turnIndex+1]})," ",P]}),u.jsx("div",{className:ya.time,children:tdt(_.timestamp)})]},_.promptId)})}),u.jsxs("div",{className:ya.footer,children:[w&&u.jsx("span",{className:ya.footerMessage,role:"alert",children:w}),u.jsx("button",{type:"button",className:st("dialog-inline-button"),onClick:r,disabled:d!==null,children:i("common.cancel")}),u.jsx("button",{type:"button",className:`${st("dialog-danger-button")} ${ya.dangerButton}`,onClick:()=>T(g),disabled:!g||d!==null,children:i(d?"rewind.rewinding":"rewind.confirm")})]})]})}function MC({...e}){return u.jsx(GUe,{"data-slot":"dropdown-menu",...e})}function sdt({container:e,...t}){const n=bm();return u.jsx(YUe,{"data-slot":"dropdown-menu-portal",container:e??n??void 0,...t})}function NC({...e}){return u.jsx(KUe,{"data-slot":"dropdown-menu-trigger",...e})}function IC({className:e,align:t="start",sideOffset:n=4,...s}){return u.jsx(sdt,{children:u.jsx(XUe,{"data-slot":"dropdown-menu-content",sideOffset:n,align:t,className:In("z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...s})})}function iz({...e}){return u.jsx(QUe,{"data-slot":"dropdown-menu-group",...e})}function ff({className:e,inset:t,variant:n="default",...s}){return u.jsx(JUe,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:In("group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",e),...s})}function oz({...e}){return u.jsx(ZUe,{"data-slot":"dropdown-menu-sub",...e})}function az({className:e,inset:t,children:n,...s}){return u.jsxs(eVe,{"data-slot":"dropdown-menu-sub-trigger","data-inset":t,className:In("flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...s,children:[n,u.jsx(FE,{className:"ml-auto"})]})}function lz({className:e,...t}){return u.jsx(tVe,{"data-slot":"dropdown-menu-sub-content",className:In("z-50 min-w-[96px] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...t})}const RC="add-workspace-hint",cz="add-workspace-error";function rdt({onClose:e,onAdd:t}){const{t:n}=ot(),[s,r]=m.useState(""),[i,o]=m.useState(null),[a,l]=m.useState(!1),[c,d]=m.useState(!0),h=m.useRef(null);m.useEffect(()=>{var p;(p=h.current)==null||p.focus()},[]);const f=m.useCallback(async p=>{p.preventDefault();const g=s.trim();if(g){if(!g.startsWith("/")&&!/^[A-Za-z]:[\\//]/.test(g)){o(n("sidebar.addWorkspaceAbsError"));return}o(null),l(!0);try{await t(g,c),e()}catch(y){o(y instanceof Error?y.message:n("sidebar.addWorkspaceError"))}finally{l(!1)}}},[s,c,t,e,n]);return u.jsx(Ar,{title:n("sidebar.addWorkspaceTitle"),size:"md",onClose:e,children:u.jsxs("form",{className:"flex flex-col gap-6",onSubmit:f,children:[u.jsxs(zM,{children:[u.jsxs(i0,{"data-invalid":i?!0:void 0,children:[u.jsx(ry,{htmlFor:"add-workspace-path",children:n("sidebar.addWorkspacePath")}),u.jsx(Bp,{ref:h,id:"add-workspace-path",type:"text",placeholder:"/absolute/path/to/project",value:s,onChange:p=>{r(p.target.value),i&&o(null)},disabled:a,autoCapitalize:"off",autoCorrect:"off",autoComplete:"off",spellCheck:!1,"aria-describedby":i?`${cz} ${RC}`:RC,"aria-invalid":i?!0:void 0}),u.jsx(y7,{id:RC,children:n("sidebar.addWorkspaceHint")}),i&&u.jsx(Vct,{id:cz,children:i})]}),u.jsxs(i0,{orientation:"horizontal",children:[u.jsxs(pne,{children:[u.jsx(ry,{htmlFor:"add-workspace-persist",children:n("sidebar.addWorkspacePersist")}),u.jsx(y7,{children:n("sidebar.addWorkspacePersistHint")})]}),u.jsx(gne,{id:"add-workspace-persist",checked:c,onCheckedChange:d,disabled:a})]})]}),u.jsxs("div",{className:"flex justify-end gap-2",children:[u.jsx(Oc,{type:"button",variant:"outline",onClick:e,disabled:a,children:n("sidebar.addWorkspaceCancel")}),u.jsx(Oc,{type:"submit",disabled:a||!s.trim(),children:n(a?"sidebar.addWorkspaceAdding":"sidebar.addWorkspaceRegister")})]})]})})}const idt="_sidebar_1kwqg_1",odt="_resizing_1kwqg_20",adt="_collapsed_1kwqg_24",ldt="_newChatButton_1kwqg_30",cdt="_pluginButton_1kwqg_31",udt="_footerButton_1kwqg_32",ddt="_collapseButton_1kwqg_33",hdt="_projectRow_1kwqg_34",fdt="_sessionRow_1kwqg_35",mdt="_sessionGroupHeader_1kwqg_36",pdt="_sessionGroupActionButton_1kwqg_37",gdt="_retry_1kwqg_38",ydt="_iconButton_1kwqg_39",bdt="_projectIconButton_1kwqg_40",vdt="_sessionActionButton_1kwqg_41",wdt="_groupMenuItem_1kwqg_42",xdt="_secondaryButton_1kwqg_43",kdt="_dangerButton_1kwqg_44",_dt="_primaryNav_1kwqg_80",Sdt="_navIcon_1kwqg_129",Cdt="_topRow_1kwqg_155",Tdt="_brandLogo_1kwqg_170",Edt="_brandName_1kwqg_186",Adt="_workspacePicker_1kwqg_206",Mdt="_workspacePickerLabel_1kwqg_213",Ndt="_workspacePickerHeader_1kwqg_220",Idt="_workspaceAddIconButton_1kwqg_227",Rdt="_workspaceList_1kwqg_247",jdt="_workspaceSessionBody_1kwqg_253",Ldt="_projectsHeader_1kwqg_257",Ddt="_pinnedSessionList_1kwqg_267",Odt="_projectsHeaderToggle_1kwqg_275",Pdt="_projectsHeaderAction_1kwqg_276",Bdt="_projectsHeaderActions_1kwqg_284",$dt="_projectSearch_1kwqg_335",zdt="_addWorkspaceButton_1kwqg_357",Fdt="_body_1kwqg_377",qdt="_sectionTitle_1kwqg_387",Hdt="_projectRowExpanded_1kwqg_402",Udt="_workspaceHeaderActions_1kwqg_428",Vdt="_workspaceHeaderAction_1kwqg_428",Wdt="_projectName_1kwqg_471",Gdt="_sessionText_1kwqg_472",Kdt="_projectHoverAction_1kwqg_487",Ydt="_sessionList_1kwqg_496",Xdt="_sessionGroupSection_1kwqg_511",Qdt="_sessionGroupHeaderRow_1kwqg_517",Jdt="_sessionGroupDot_1kwqg_553",Zdt="_sessionGroupDotMuted_1kwqg_560",eht="_sessionGroupTitle_1kwqg_564",tht="_sessionGroupCount_1kwqg_571",nht="_sessionGroupChevron_1kwqg_576",sht="_sessionGroupHeaderActions_1kwqg_597",rht="_sessionGroupList_1kwqg_627",iht="_groupedSessionRow_1kwqg_645",oht="_currentSession_1kwqg_652",aht="_busySession_1kwqg_662",lht="_floatingTooltip_1kwqg_667",cht="_tooltipContent_1kwqg_697",uht="_tooltipTitle_1kwqg_703",dht="_tooltipTags_1kwqg_710",hht="_tooltipTag_1kwqg_710",fht="_tooltipTagRunning_1kwqg_730",mht="_tooltipTagNew_1kwqg_735",pht="_tooltipMeta_1kwqg_740",ght="_sessionStatusSlot_1kwqg_755",yht="_sessionStatusDot_1kwqg_767",bht="_sidebarPulse_1kwqg_1",vht="_sessionTitlePin_1kwqg_777",wht="_sessionMetaSlot_1kwqg_809",xht="_sessionTime_1kwqg_824",kht="_sessionLoading_1kwqg_832",_ht="_sidebarSpin_1kwqg_1",Sht="_runningSession_1kwqg_843",Cht="_sessionActions_1kwqg_854",Tht="_activeSessionActionButton_1kwqg_920",Eht="_searchInput_1kwqg_939",Aht="_renameInput_1kwqg_953",Mht="_dialogSelect_1kwqg_959",Nht="_dialogInput_1kwqg_969",Iht="_groupMenu_1kwqg_42",Rht="_groupMenuItemActive_1kwqg_1011",jht="_groupMenuName_1kwqg_1017",Lht="_groupMenuDot_1kwqg_1025",Dht="_groupMenuEmptyDot_1kwqg_1026",Oht="_groupMenuIcon_1kwqg_1027",Pht="_groupMenuCheck_1kwqg_1055",Bht="_groupMenuSeparator_1kwqg_1062",$ht="_groupColorRed_1kwqg_1068",zht="_groupColorOrange_1kwqg_1072",Fht="_groupColorYellow_1kwqg_1076",qht="_groupColorGreen_1kwqg_1080",Hht="_groupColorBlue_1kwqg_1084",Uht="_groupColorPurple_1kwqg_1088",Vht="_groupColorCustom_1kwqg_1092",Wht="_renameForm_1kwqg_1102",Ght="_notice_1kwqg_1118",Kht="_confirmContent_1kwqg_1133",Yht="_confirmDescription_1kwqg_1139",Xht="_workspaceRemovalActivityList_1kwqg_1146",Qht="_confirmActions_1kwqg_1154",Jht="_groupForm_1kwqg_1160",Zht="_fieldStack_1kwqg_1167",eft="_groupCustomColorRow_1kwqg_1195",tft="_groupColorPicker_1kwqg_1202",nft="_groupHexField_1kwqg_1212",sft="_groupColorError_1kwqg_1222",rft="_footer_1kwqg_32",ift="_footerPrimary_1kwqg_1277",oft="_footerActions_1kwqg_1278",aft="_footerButtonLabel_1kwqg_1294",lft="_footerCompact_1kwqg_1301",cft="_footerTight_1kwqg_1302",uft="_version_1kwqg_1337",dft="_resizeHandle_1kwqg_1380",hft="_sessionActionButtonActive_1kwqg_1408",fft="_menuActive_1kwqg_1414",mft="_actionMenu_1kwqg_1418",pft="_actionMenuItem_1kwqg_1435",gft="_actionMenuItemDanger_1kwqg_1466",yft="_actionMenuIcon_1kwqg_1476",bft="_actionMenuLabel_1kwqg_1495",vft="_archivedSection_1kwqg_1503",wft="_archivedHeader_1kwqg_1510",xft="_archivedChevron_1kwqg_1536",kft="_archivedTitle_1kwqg_1555",_ft="_archivedCount_1kwqg_1564",Sft="_archivedList_1kwqg_1579",Cft="_archivedRow_1kwqg_1586",Tft="_mobileOpen_1kwqg_1595",ke={sidebar:idt,resizing:odt,collapsed:adt,newChatButton:ldt,pluginButton:cdt,footerButton:udt,collapseButton:ddt,projectRow:hdt,sessionRow:fdt,sessionGroupHeader:mdt,sessionGroupActionButton:pdt,retry:gdt,iconButton:ydt,projectIconButton:bdt,sessionActionButton:vdt,groupMenuItem:wdt,secondaryButton:xdt,dangerButton:kdt,primaryNav:_dt,navIcon:Sdt,topRow:Cdt,brandLogo:Tdt,brandName:Edt,workspacePicker:Adt,workspacePickerLabel:Mdt,workspacePickerHeader:Ndt,workspaceAddIconButton:Idt,workspaceList:Rdt,workspaceSessionBody:jdt,projectsHeader:Ldt,pinnedSessionList:Ddt,projectsHeaderToggle:Odt,projectsHeaderAction:Pdt,projectsHeaderActions:Bdt,projectSearch:$dt,addWorkspaceButton:zdt,body:Fdt,sectionTitle:qdt,projectRowExpanded:Hdt,workspaceHeaderActions:Udt,workspaceHeaderAction:Vdt,projectName:Wdt,sessionText:Gdt,projectHoverAction:Kdt,sessionList:Ydt,sessionGroupSection:Xdt,sessionGroupHeaderRow:Qdt,sessionGroupDot:Jdt,sessionGroupDotMuted:Zdt,sessionGroupTitle:eht,sessionGroupCount:tht,sessionGroupChevron:nht,sessionGroupHeaderActions:sht,sessionGroupList:rht,groupedSessionRow:iht,currentSession:oht,busySession:aht,floatingTooltip:lht,tooltipContent:cht,tooltipTitle:uht,tooltipTags:dht,tooltipTag:hht,tooltipTagRunning:fht,tooltipTagNew:mht,tooltipMeta:pht,sessionStatusSlot:ght,sessionStatusDot:yht,sidebarPulse:bht,sessionTitlePin:vht,sessionMetaSlot:wht,sessionTime:xht,sessionLoading:kht,sidebarSpin:_ht,runningSession:Sht,sessionActions:Cht,activeSessionActionButton:Tht,searchInput:Eht,renameInput:Aht,dialogSelect:Mht,dialogInput:Nht,groupMenu:Iht,groupMenuItemActive:Rht,groupMenuName:jht,groupMenuDot:Lht,groupMenuEmptyDot:Dht,groupMenuIcon:Oht,groupMenuCheck:Pht,groupMenuSeparator:Bht,groupColorRed:$ht,groupColorOrange:zht,groupColorYellow:Fht,groupColorGreen:qht,groupColorBlue:Hht,groupColorPurple:Uht,groupColorCustom:Vht,renameForm:Wht,notice:Ght,confirmContent:Kht,confirmDescription:Yht,workspaceRemovalActivityList:Xht,confirmActions:Qht,groupForm:Jht,fieldStack:Zht,groupCustomColorRow:eft,groupColorPicker:tft,groupHexField:nft,groupColorError:sft,footer:rft,footerPrimary:ift,footerActions:oft,footerButtonLabel:aft,footerCompact:lft,footerTight:cft,version:uft,resizeHandle:dft,sessionActionButtonActive:hft,menuActive:fft,actionMenu:mft,actionMenuItem:pft,actionMenuItemDanger:gft,actionMenuIcon:yft,actionMenuLabel:bft,archivedSection:vft,archivedHeader:wft,archivedChevron:xft,archivedTitle:kft,archivedCount:_ft,archivedList:Sft,archivedRow:Cft,mobileOpen:Tft};function k7({label:e,count:t,expanded:n,color:s,children:r,onToggle:i,onRename:o,onDelete:a,renameLabel:l,deleteLabel:c,actionsDisabled:d}){const h=s!=null&&s.startsWith("#")?ke.groupColorCustom:s?ke[`groupColor${s[0].toUpperCase()}${s.slice(1)}`]:ke.sessionGroupDotMuted,f=s!=null&&s.startsWith("#")?{"--session-group-custom-color":s}:void 0;return u.jsxs("section",{className:ke.sessionGroupSection,"aria-label":e,children:[u.jsxs("div",{className:ke.sessionGroupHeaderRow,children:[u.jsxs("button",{type:"button",className:ke.sessionGroupHeader,"aria-expanded":n,onClick:i,children:[u.jsx("span",{className:`${ke.sessionGroupDot} ${h}`,style:f,"aria-hidden":"true"}),u.jsx("span",{className:ke.sessionGroupTitle,children:e}),u.jsxs("span",{className:ke.sessionGroupCount,children:["· ",t]}),u.jsx("span",{className:ke.sessionGroupChevron,"aria-hidden":"true",children:n?u.jsx(b_,{}):u.jsx(FE,{})})]}),(o||a)&&u.jsxs("div",{className:ke.sessionGroupHeaderActions,children:[o&&u.jsx("button",{className:ke.sessionGroupActionButton,type:"button",title:l,"aria-label":l,disabled:d,onClick:o,children:u.jsx(xU,{})}),a&&u.jsx("button",{className:ke.sessionGroupActionButton,type:"button",title:c,"aria-label":c,disabled:d,onClick:a,children:u.jsx(px,{})})]})]}),n&&u.jsx("div",{className:ke.sessionGroupList,children:r})]})}const Eft="_section_mnnkt_1",Aft="_headerRow_mnnkt_6",Mft="_header_mnnkt_6",Nft="_headerActive_mnnkt_34",Ift="_headerDisabled_mnnkt_39",Rft="_headerContent_mnnkt_47",jft="_chevron_mnnkt_55",Lft="_folderIcon_mnnkt_60",Dft="_chevronOpen_mnnkt_64",Oft="_name_mnnkt_68",Pft="_badge_mnnkt_76",Bft="_sessions_mnnkt_86",$ft="_empty_mnnkt_93",zft="_error_mnnkt_99",Fft="_sessionItemReadOnly_mnnkt_105",qft="_sessionName_mnnkt_116",Hft="_sessionTime_mnnkt_123",vi={section:Eft,headerRow:Aft,header:Mft,headerActive:Nft,headerDisabled:Ift,headerContent:Rft,chevron:jft,folderIcon:Lft,chevronOpen:Dft,name:Oft,badge:Pft,sessions:Bft,empty:$ft,error:zft,sessionItemReadOnly:Fft,sessionName:qft,sessionTime:Hft};function uz(...e){return e.filter(Boolean).join(" ")}function Uft(e){return e.split(/[\\/]+/).filter(Boolean).at(-1)??e}function Vft(e){var n;return((n=e.displayName)==null?void 0:n.trim())||e.sessionId.slice(0,8)}function Wft({open:e}){const t=e?Lue:wU;return u.jsx(t,{className:vi.folderIcon,size:16,strokeWidth:1.2,"aria-hidden":"true"})}function Gft({workspace:e,client:t,isActive:n,reloadToken:s,primaryLabel:r,untrustedLabel:i,readOnlyLabel:o,trustToOpenLabel:a,noSessionsLabel:l,loadErrorLabel:c,organizationEnabled:d,ungroupedLabel:h,formatTime:f,searchQuery:p="",expanded:g,autoExpandKey:y,onExpandedChange:w,renderSessions:v=!0,renderSession:b,headerActions:x,onRenameGroup:k,onDeleteGroup:T,renameGroupLabel:C,deleteGroupLabel:S,groupActionsDisabled:_,excludePinned:L=!1}){const[M,I]=m.useState([]),[A,P]=m.useState([]),[B,F]=m.useState(!1),[O,X]=m.useState(!1),[z,U]=m.useState(()=>new Set),[D,G]=m.useState(!1),q=g??O,N=!e.primary&&!e.trusted,ee=e.primary&&!e.trusted;m.useEffect(()=>{g===void 0&&X(!1)},[g,e.id]),m.useEffect(()=>{g===void 0&&y&&X(!0)},[y,g]);const re=m.useCallback(async()=>{if(!ee)try{const se=await t.workspaceByCwd(e.cwd).listWorkspaceSessions({pageSize:pu,archiveState:"active",...d?{view:"organized",group:"all"}:{}});I(se),F(!1)}catch(se){console.warn("[WorkspaceSection] session poll failed:",se),F(!0)}},[t,ee,d,e.cwd]);m.useEffect(()=>{if(!v||ee||!d){P([]);return}let se=!1;return t.workspaceByCwd(e.cwd).listSessionGroups().then(te=>{se||P(te.groups)}).catch(te=>{console.warn("[WorkspaceSection] group catalog load failed:",te)}),()=>{se=!0}},[t,ee,d,s,v,e.cwd]),m.useEffect(()=>{if(!v||!q&&!p.trim()||(re(),N))return;const se=setInterval(()=>void re(),1e4);return()=>clearInterval(se)},[q,re,N,s,v,p]);const Q=m.useMemo(()=>{const se=p.trim().toLowerCase();return M.filter(te=>L&&te.isPinned?!1:se?(te.displayName||"").toLowerCase().includes(se)||te.sessionId.toLowerCase().includes(se):!0)},[L,p,M]),K=m.useMemo(()=>{if(!d||A.length===0)return null;const se=new Set;return{sections:A.map(ce=>{const oe=Q.filter(de=>de.groupId===ce.id);return oe.forEach(de=>se.add(de.sessionId)),{group:ce,sessions:oe}}),ungrouped:Q.filter(ce=>!se.has(ce.sessionId))}},[A,d,Q]);return u.jsxs("div",{className:vi.section,children:[u.jsxs("div",{className:uz(vi.headerRow,n&&vi.headerActive,ee&&vi.headerDisabled),onMouseEnter:()=>G(!0),onMouseLeave:()=>G(!1),onFocus:()=>G(!0),onBlur:se=>{se.currentTarget.contains(se.relatedTarget)||G(!1)},children:[u.jsxs("button",{className:vi.header,type:"button",disabled:ee,"aria-expanded":q,onClick:()=>{const se=!q;X(se),w==null||w(se)},children:[u.jsx("span",{className:uz(vi.chevron,q&&vi.chevronOpen),children:u.jsx(Wft,{open:q})}),u.jsxs("span",{className:vi.headerContent,children:[u.jsx("span",{className:vi.name,children:Uft(e.cwd)}),e.primary&&r&&u.jsx("span",{className:vi.badge,children:r})]}),!e.trusted&&u.jsx("span",{className:vi.badge,children:i}),N&&u.jsx("span",{className:vi.badge,children:o})]}),x==null?void 0:x(D)]}),v&&(q||!!p.trim())&&!ee&&u.jsx("div",{className:vi.sessions,children:B?u.jsx("div",{className:vi.error,role:"status",children:c}):Q.length===0?u.jsx("div",{className:vi.empty,children:l}):K?u.jsxs(u.Fragment,{children:[K.sections.map(({group:se,sessions:te})=>u.jsx(k7,{id:`group:${se.id}`,label:se.name,count:te.length,color:se.color,expanded:!z.has(se.id),onToggle:()=>{U(ce=>{const oe=new Set(ce);return oe.has(se.id)?oe.delete(se.id):oe.add(se.id),oe})},onRename:k?()=>k(se,e.cwd):void 0,onDelete:T?()=>T(se,e.cwd):void 0,renameLabel:C,deleteLabel:S,actionsDisabled:_,children:te.map(ce=>b(ce,{grouped:!0}))},se.id)),K.ungrouped.length>0&&u.jsx(k7,{id:"ungrouped",label:h,count:K.ungrouped.length,expanded:!z.has("ungrouped"),onToggle:()=>{U(se=>{const te=new Set(se);return te.has("ungrouped")?te.delete("ungrouped"):te.add("ungrouped"),te})},children:K.ungrouped.map(se=>b(se,{grouped:!0}))})]}):Q.map(se=>{if(!N)return b(se);const te=Vft(se),ce=se.createdAt?f(se.createdAt):"";return u.jsxs("div",{className:vi.sessionItemReadOnly,role:"note","aria-label":`${te}${ce?`, ${ce}`:""}. ${a}`,children:[u.jsx("span",{className:vi.sessionName,children:te}),ce&&u.jsx("span",{className:vi.sessionTime,children:ce})]},se.sessionId)})})]})}const wne="qwen-code-web-shell-sidebar-width",Kw=260,Kft=220,xne=420,Yft=344,Xft=250,kne=200,Qft=56,dz=kne-Qft,Jft=2e3,Zft=3e4,hz=96,emt="recent",jC=240,rp=8,LC="__custom__",ip="#416ef5",tmt=["settings","version","theme","scheduledTasks","sessionsOverview","splitView","daemonStatus","collapse"],op=["red","orange","yellow","green","blue","purple"];function Za(...e){return e.filter(Boolean).join(" ")}function fz(e){return e instanceof DOMException&&e.name==="AbortError"}function nmt(e){return e?e.split(/[\\/]+/).filter(Boolean).at(-1)??e:""}function qx(e){var n;return((n=e.displayName)==null?void 0:n.trim())||e.sessionId.slice(0,8)}function smt(e){const t=qx(e).replace(/\s+/g," ").trim();return t.length<=hz?t:`${t.slice(0,hz-3).trimEnd()}...`}function rmt(e){if(!e.createdAt)return 0;const t=Date.parse(e.createdAt);return Number.isFinite(t)?t:0}function Yw(e){return e[0]??"blue"}function _7(e){const t=e.trim();if(/^#[0-9a-f]{6}$/i.test(t))return t.toLowerCase()}function mz(e,t){const n=e.trim();return t.includes(n)?n:_7(n)}function pz(e){if(e.startsWith("#"))return ke.groupColorCustom;switch(e){case"red":return ke.groupColorRed;case"orange":return ke.groupColorOrange;case"yellow":return ke.groupColorYellow;case"green":return ke.groupColorGreen;case"blue":return ke.groupColorBlue;case"purple":return ke.groupColorPurple}}function imt(e){return e.startsWith("#")?{backgroundColor:e}:void 0}function V2(e){return Math.min(xne,Math.max(Kft,e))}function omt(e){return Math.min(xne,Math.max(kne,e))}function amt(){if(typeof window>"u")return Kw;try{const e=window.localStorage.getItem(wne),t=e?Number(e):Kw;return Number.isFinite(t)?V2(t):Kw}catch{return Kw}}function gz(e){try{window.localStorage.setItem(wne,String(V2(e)))}catch{}}function lmt(){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"M12 5v14M5 12h14"})})}function cmt(){return u.jsx("svg",{viewBox:"0 0 141.38 140","aria-hidden":"true",children:u.jsx("path",{fill:"#6D44E8",d:"m140.93 85-16.35-28.33-1.93-3.34 8.66-15a3.323 3.323 0 0 0 0-3.34l-9.62-16.67c-.3-.51-.72-.93-1.22-1.22s-1.07-.45-1.67-.45H82.23l-8.66-15a3.33 3.33 0 0 0-2.89-1.67H51.43c-.59 0-1.17.16-1.66.45-.5.29-.92.71-1.22 1.22L32.19 29.98l-1.92 3.33H12.96c-.59 0-1.17.16-1.66.45-.5.29-.93.71-1.22 1.22L.45 51.66a3.323 3.323 0 0 0 0 3.34l18.28 31.67-8.66 15a3.32 3.32 0 0 0 0 3.34l9.62 16.67c.3.51.72.93 1.22 1.22s1.07.45 1.67.45h36.56l8.66 15a3.35 3.35 0 0 0 2.89 1.67h19.25a3.34 3.34 0 0 0 2.89-1.67l18.28-31.67h17.32c.6 0 1.17-.16 1.67-.45s.92-.71 1.22-1.22l9.62-16.67a3.323 3.323 0 0 0 0-3.34ZM51.44 3.33 61.07 20l-9.63 16.66h76.98l-9.62 16.66H45.67l-11.54-20zM57.21 120H22.58l9.63-16.67h19.25l-38.5-66.67h19.25l9.62 16.67L68.78 100l-11.55 20Zm61.59-33.34-9.62-16.67-38.49 66.67-9.63-16.67 9.63-16.66 26.94-46.67h23.1l17.32 30z"})})}function yz({expanded:e}){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:e?u.jsx("path",{d:"m6 9 6 6 6-6"}):u.jsx("path",{d:"m9 6 6 6-6 6"})})}function umt({collapsed:e,onCollapsedChange:t,onOpenSettings:n,onOpenDaemonStatus:s,onOpenScheduledTasks:r,onOpenSessions:i,canOpenSessionsOverview:o,onOpenSplitView:a,canOpenSplitView:l,onNewSession:c,onLoadSession:d,onError:h,theme:f,onThemeChange:p,mobileOpen:g,sessionListReloadToken:y,selectedWorkspaceCwd:w,onSelectWorkspace:v,branding:b,footer:x}){var Qc,Yb,hg,Im,fg,Xb,Qb,Jb;const{t:k}=ot(),T=Ba(),C=H0(),S=$o(),_=Dh(),L=m.useMemo(()=>new Set(x===!1?[]:(x==null?void 0:x.items)??tmt),[x]),M=b!==!1&&!(g&&((b==null?void 0:b.hideWhenCompact)??!0)),I=!!((Yb=(Qc=T.capabilities)==null?void 0:Qc.features)!=null&&Yb.includes(PM)),A=m.useMemo(()=>{var Y;return((Y=_.capabilities)==null?void 0:Y.workspaces)??[]},[(hg=_.capabilities)==null?void 0:hg.workspaces]),{sessions:P,loading:B,error:F,reload:O,deleteSession:X,exportSession:z,archiveSession:U}=ah({autoLoad:!0,pageSize:pu,archiveState:"active",...I?{view:"organized",group:"all"}:{}}),{sessions:D,reload:G}=ah({autoLoad:I,enabled:I,pageSize:pu,archiveState:"active",view:"organized",group:"pinned"}),[q,N]=m.useState(!1),[ee,re]=m.useState(!0),[Q,K]=m.useState([]),{sessions:se,loading:te,error:ce,reload:oe,deleteSession:de,unarchiveSession:Te}=ah({autoLoad:!0,enabled:q,pageSize:pu,archiveState:"archived",...I?{view:"organized",group:"all"}:{}}),[qe,Ne]=m.useState([]),[ge,Ee]=m.useState(!1),[_t,Ct]=m.useState(!1),[Je,at]=m.useState(0),[Oe,Fe]=m.useState([]),[ue,vt]=m.useState([]),[ye,je]=m.useState([]),[Ye,Nt]=m.useState(!1),[Rt,rn]=m.useState(null),[on,Bn]=m.useState(""),[bs,Ss]=m.useState(()=>new Set),Ie=m.useRef(new Set),[lt,ne]=m.useState(()=>new Set),he=m.useRef(new Set),[Ve,we]=m.useState(!1),Bt=m.useRef(!1),[Et,Tt]=m.useState(null),[an,wt]=m.useState(null),[It,Vn]=m.useState(null),[kn,ln]=m.useState(""),[Wn,Jn]=m.useState("blue"),[Cs,fr]=m.useState(ip),[Xs,Vs]=m.useState(null),[_n,fn]=m.useState(()=>new Set),qn=m.useRef(new Set),[Zn,$n]=m.useState(amt),[es,ss]=m.useState(!1),[Ps,jr]=m.useState(!0),[Ui,Bs]=m.useState(!1),[zr,sr]=m.useState(!1),[Qs,gs]=m.useState(null),[ts,mn]=m.useState(null),[Rn,br]=m.useState(!1),Se=m.useRef(!1),xe=m.useRef(!1),[kt,Ot]=m.useState(!1),[xt,An]=m.useState(0),[Gn,Js]=m.useState(null),jn=m.useCallback(()=>{An(Y=>Y+1)},[]);m.useEffect(()=>(Se.current=!0,()=>{Se.current=!1,xe.current=!0}),[]);const[yn,Mn]=m.useState(""),[Lr,ti]=m.useState(!1),[_r,W]=m.useState(()=>new Set),fe=m.useRef(null),Ae=m.useRef(!1),He=m.useRef(null),Ge=m.useRef(null),zt=m.useRef(!1),dn=m.useRef(null),hn=T.sessionId,ds=!!((fg=(Im=T.capabilities)==null?void 0:Im.features)!=null&&fg.includes("workspace_runtime_removal")),Ws=((Qb=(Xb=T.capabilities)==null?void 0:Xb.features)==null?void 0:Qb.includes("session_export"))??!1,Ms=nmt(T.workspaceCwd)||k("sidebar.projectFallback"),Ts=m.useMemo(()=>A.length>0?A:[{id:"primary",cwd:T.workspaceCwd||Ms,primary:!0,trusted:!0}],[T.workspaceCwd,Ms,A]),Gr=m.useMemo(()=>{const Y=new Map;for(const be of[...D,...Q])Y.set(be.sessionId,be);return[...Y.values()]},[D,Q]),ie=m.useCallback(Y=>{const be=Ts.find(Ce=>Ce.cwd===Y.workspaceCwd);return!be||be.primary?S:_.client.workspaceByCwd(be.cwd)},[Ts,_.client,S]),ve=m.useCallback(Y=>{var be;return!Y||((be=Ts.find(Ce=>Ce.cwd===Y))==null?void 0:be.primary)!==!1},[Ts]);m.useEffect(()=>{if(!I){K([]);return}const Y=Ts.filter(Ce=>!Ce.primary&&Ce.trusted);let be=!1;return Promise.allSettled(Y.map(async Ce=>(await _.client.workspaceByCwd(Ce.cwd).listWorkspaceSessions({pageSize:pu,archiveState:"active",view:"organized",group:"pinned"})).map(nn=>({...nn,workspaceCwd:Ce.cwd})))).then(Ce=>{be||K(Ce.flatMap(nt=>nt.status==="fulfilled"?nt.value:[]))}),()=>{be=!0}},[Ts,I,_.client,xt]);const Le=m.useMemo(()=>[...se,...qe],[se,qe]);m.useEffect(()=>{if(!q)return;const Y=Ts.filter(Ce=>!Ce.primary&&Ce.trusted);if(Y.length===0){Ne([]),Ct(!1);return}let be=!1;return Ee(!0),Promise.allSettled(Y.map(async Ce=>(await _.client.workspaceByCwd(Ce.cwd).listWorkspaceSessions({pageSize:pu,archiveState:"archived",...I?{view:"organized",group:"all"}:{}})).map(nn=>({...nn,workspaceCwd:Ce.cwd})))).then(Ce=>{if(be)return;const nt=Ce.filter(nn=>nn.status==="rejected");Ne(Ce.flatMap(nn=>nn.status==="fulfilled"?nn.value:[])),Ct(nt.length>0);for(const nn of nt)console.warn("[WebShellSidebar] archived session load failed:",nn.reason)}).finally(()=>{be||Ee(!1)}),()=>{be=!0}},[q,Ts,I,Je,_.client,xt]);const tt=((Jb=T.capabilities)==null?void 0:Jb.qwenCodeVersion)||"",cn=tt?/^\d/.test(tt)?`v${tt}`:tt:"",en=!e&&Zn<Yft,Sn=!e&&Zn<Xft,Gs={"--web-shell-sidebar-width":`${Zn}px`},Xe=Ve;m.useEffect(()=>{var Ce;if(!hn)return;const Y=Ts.find(nt=>nt.cwd===T.workspaceCwd)??(Ts.length===1&&((Ce=Ts[0])!=null&&Ce.primary)?Ts[0]:void 0);if(!Y)return;const be=`session:${hn}:${Y.id}`;Ge.current!==be&&(Ge.current=be,jr(!0),Y.primary?ss(!0):Js({id:Y.id,key:be}))},[T.workspaceCwd,hn,Ts]),m.useEffect(()=>{if(hn||w!==void 0||!_.capabilities)return;const Y=A.find(Ce=>Ce.cwd===T.workspaceCwd),be=`new:${(Y==null?void 0:Y.id)??"primary"}`;if(Ge.current!==be){if(Ge.current=be,jr(!0),Y&&!Y.primary){ss(!1),Js({id:Y.id,key:be}),v==null||v(Y.cwd);return}ss(!0)}},[T.workspaceCwd,hn,v,w,_.capabilities,A]);const Ft=m.useCallback((Y,be)=>{const Ce=new Set(Ie.current);be?Ce.add(Y):Ce.delete(Y),Ie.current=Ce,Ss(Ce)},[]),zn=m.useCallback(async()=>{if(!I){Fe([]),je([]);return}try{const Y=await S.listSessionGroups();Fe(Y.groups),vt(Y.groups),je(Y.colorOptions)}catch(Y){h(Y,k("sidebar.groupsLoadFailed"))}},[h,I,k,S]);m.useEffect(()=>{if(!I){Fe([]),je([]);return}zn()},[I,zn]),m.useEffect(()=>{if(!an)return;const Y=Ce=>{var nt;(nt=fe.current)!=null&&nt.contains(Ce.target)||wt(null)},be=Ce=>{Ce.key==="Escape"&&wt(null)};return document.addEventListener("mousedown",Y),document.addEventListener("keydown",be),()=>{document.removeEventListener("mousedown",Y),document.removeEventListener("keydown",be)}},[an]),m.useEffect(()=>{if(!an)return;const Y=window.requestAnimationFrame(()=>{var nt;const be=Array.from(((nt=fe.current)==null?void 0:nt.querySelectorAll("button:not(:disabled)"))??[]),Ce=be.find(nn=>nn.getAttribute("aria-checked")==="true")??be[0];Ce==null||Ce.focus()});return()=>window.cancelAnimationFrame(Y)},[an]);const gi=m.useCallback(Y=>{var Kn,vn;const be=Array.from(((Kn=fe.current)==null?void 0:Kn.querySelectorAll("button:not(:disabled)"))??[]);if(be.length===0)return;const Ce=be.indexOf(document.activeElement),nt=Ce>=0?Ce:-1;let nn;if(Y.key==="ArrowDown")nn=(nt+1)%be.length;else if(Y.key==="ArrowUp")nn=(nt-1+be.length)%be.length;else if(Y.key==="Home")nn=0;else if(Y.key==="End")nn=be.length-1;else if(Y.key==="Escape"){Y.preventDefault(),wt(null);return}nn!==void 0&&(Y.preventDefault(),(vn=be[nn])==null||vn.focus())},[]);m.useEffect(()=>()=>{var Y;(Y=dn.current)==null||Y.call(dn,!1)},[]),m.useEffect(()=>{e&&(ss(!1),Bs(!1),Mn(""))},[e]);const Us=m.useMemo(()=>P.some(Y=>Y.hasActivePrompt),[P]);m.useEffect(()=>{if(!es&&!Us)return;const Y=Us&&!F?Jft:Zft,be=window.setInterval(()=>{document.hidden||zt.current||(zt.current=!0,O().finally(()=>{zt.current=!1}))},Y);return()=>window.clearInterval(be)},[F,Us,es,O]);const ni=m.useRef(y);m.useEffect(()=>{y!==void 0&&y!==ni.current&&!document.hidden&&!zt.current&&(ni.current=y,zt.current=!0,O().finally(()=>{zt.current=!1}))},[y,O]),m.useEffect(()=>{const Y=new Map(P.map(Ce=>[Ce.sessionId,!!Ce.hasActivePrompt])),be=He.current;He.current=Y,be!==null&&W(Ce=>{const nt=new Set(Ce);let nn=!1;for(const[Kn,vn]of be){const vs=Y.get(Kn);vn&&vs===!1&&Kn!==hn&&!nt.has(Kn)&&(nt.add(Kn),nn=!0)}for(const Kn of nt)(Kn===hn||!Y.has(Kn)||Y.get(Kn))&&(nt.delete(Kn),nn=!0);return nn?nt:Ce})},[hn,P]);const rs=m.useCallback(async(Y,be)=>{var nt;const Ce=await S.addWorkspace(Y,{persist:be});if(be&&Ce.persisted!==!0)throw new Error(k("sidebar.addWorkspacePersistenceError"));try{await((nt=_.refreshCapabilities)==null?void 0:nt.call(_))}catch{}},[k,S,_]),Fr=m.useCallback(async Y=>{var be;if(Se.current){w===Y.cwd&&(v==null||v(void 0)),An(Ce=>Ce+1);try{await((be=_.refreshCapabilities)==null?void 0:be.call(_))}catch{}Se.current&&(gs(null),mn(null),Ot(!1),O().catch(()=>{}),oe().catch(()=>{}))}},[v,O,oe,w,_]),qa=m.useCallback(Y=>{Rn||(xe.current=!1,mn(null),Ot(!1),gs(Y))},[Rn]),Pe=m.useCallback(async()=>{const Y=Qs;if(!Y||Rn)return;const be=ts!==null;if(!(be&&T.sessionId&&T.workspaceCwd===Y.cwd)){br(!0);try{await S.removeWorkspace(Y.id,{force:be}),await Fr(Y)}catch(Ce){if(!Se.current)return;if(Ce instanceof $u){const nt=Ce.body;if(Ce.status===409&&(nt==null?void 0:nt.code)==="workspace_busy"&&nt.activity){mn(nt.activity);return}if(Ce.status===400&&(nt==null?void 0:nt.code)==="workspace_mismatch"){await Fr(Y);return}if(Ce.status===409&&((nt==null?void 0:nt.code)==="workspace_removal_in_progress"||(nt==null?void 0:nt.code)==="workspace_registration_in_progress")){Ot(!0);let nn=Ce,Kn=!0;for(let vn=0;vn<20;vn++){if(!Se.current||xe.current||(await new Promise(vs=>window.setTimeout(vs,250)),!Se.current||xe.current))return;try{await S.removeWorkspace(Y.id,{force:be}),await Fr(Y);return}catch(vs){if(!Se.current)return;if(nn=vs,vs instanceof $u){const Ns=vs.body;if(vs.status===400&&(Ns==null?void 0:Ns.code)==="workspace_mismatch"){await Fr(Y);return}if(vs.status===409&&(Ns==null?void 0:Ns.code)==="workspace_busy"&&Ns.activity){Ot(!1),mn(Ns.activity);return}if(vs.status===409&&((Ns==null?void 0:Ns.code)==="workspace_removal_in_progress"||(Ns==null?void 0:Ns.code)==="workspace_registration_in_progress"))continue}Kn=!1;break}}if(!Se.current||xe.current)return;Ot(!1),h(Kn?new Error("Workspace removal remained in progress after retries."):nn,k("sidebar.removeWorkspaceError"));return}}h(Ce,k("sidebar.removeWorkspaceError"))}finally{Se.current&&br(!1)}}},[T.sessionId,T.workspaceCwd,h,Fr,k,S,ts,Qs,Rn]),ct=m.useCallback(Y=>{Bt.current||(Bt.current=!0,we(!0),(async()=>{try{await c(Y)&&(O().catch(()=>{}),jn())}catch(be){fz(be)||h(be,k("sidebar.newSessionFailed"))}finally{Bt.current=!1,we(!1)}})())},[jn,h,c,O,k]),pt=m.useCallback((Y,be)=>{Y===hn||Ie.current.has(Y)||(W(Ce=>{if(!Ce.has(Y))return Ce;const nt=new Set(Ce);return nt.delete(Y),nt}),Ft(Y,!0),(async()=>{try{await d(Y,be)}catch(Ce){fz(Ce)||h(Ce,k("sidebar.switchFailed"))}finally{Ft(Y,!1)}})())},[hn,h,d,Ft,k]),gn=m.useCallback(Y=>{rn(Y.sessionId),Bn(qx(Y))},[]),pn=m.useCallback(()=>{rn(null),Bn("")},[]),Ln=m.useCallback(()=>{const Y=on.trim();if(!Y||Rt!==hn){pn();return}const be=Rt;Ie.current.has(be)||(Ft(be,!0),C.renameSession(Y).then(()=>{pn(),O(),jn()}).catch(Ce=>{h(Ce,k("sidebar.renameFailed")),pn()}).finally(()=>{Ft(be,!1)}))},[C,jn,pn,hn,on,Rt,h,O,Ft,k]),is=m.useCallback(Y=>{Y.sessionId!==hn&&Tt(Y)},[hn]),Sr=m.useCallback((Y,be)=>{const Ce=new Set(he.current);be?Ce.add(Y):Ce.delete(Y),he.current=Ce,ne(Ce)},[]),si=m.useCallback(Y=>{const be=Y.sessionId;!Ws||he.current.has(be)||(Sr(be,!0),(async()=>{try{const Ce=await z(be,"html"),nt=new Blob([Ce.content],{type:Ce.mimeType||"text/html"}),nn=URL.createObjectURL(nt);try{const Kn=document.createElement("a");Kn.href=nn,Kn.download=Ce.filename,document.body.appendChild(Kn),Kn.click(),Kn.remove()}finally{URL.revokeObjectURL(nn)}}catch(Ce){h(Ce,k("sidebar.exportFailed"))}finally{Sr(be,!1)}})())},[Ws,z,h,Sr,k]),ri=m.useCallback(()=>{if(!Et)return;const Y=Et.sessionId;if(Y===hn){Tt(null);return}const be=!!Et.isArchived;if(Tt(null),Ie.current.has(Y))return;Ft(Y,!0),(ve(Et.workspaceCwd)?be?de:X:nt=>_.client.workspaceByCwd(Et.workspaceCwd).deleteSessionsData([nt]))(Y).then(()=>{O(),oe(),jn()}).catch(nt=>h(nt,k("sidebar.deleteFailed"))).finally(()=>{Ft(Y,!1)})},[jn,hn,de,Et,X,ve,h,O,oe,Ft,k,_.client]),Ha=m.useCallback(Y=>{Y.sessionId===hn&&gn(Y)},[hn,gn]),Fo=m.useCallback(()=>{wt(null),ln(""),Jn(Yw(ye)),fr(ip),Vn({mode:"create"})},[ye]),Ua=m.useCallback(Y=>{(async()=>{try{const be=await _.client.workspaceByCwd(Y).listSessionGroups();wt(null),ln(""),Jn(Yw(be.colorOptions)),fr(ip),Vn({mode:"create",workspaceCwd:Y})}catch(be){h(be,k("sidebar.groupsLoadFailed"))}})()},[h,k,_.client]),lo=m.useCallback(Y=>{wt(null),ln(""),Jn(Yw(ye)),fr(ip),Vn({mode:"create",targetSession:Y,workspaceCwd:Y.workspaceCwd})},[ye]),ca=m.useCallback((Y,be)=>{ln(Y.name),Jn(Y.color),fr(_7(Y.color)??ip),Vn({mode:"edit",group:Y,workspaceCwd:be})},[]),Va=m.useCallback(()=>{Ye||(Vn(null),ln(""),Jn(Yw(ye)),fr(ip))},[ye,Ye]),Wa=m.useCallback(()=>{if(!It)return;const Y=kn.trim(),be=mz(Wn,ye.length>0?ye:op);!Y||!be||(async()=>{Nt(!0);try{const Ce=ve(It.workspaceCwd)?S:_.client.workspaceByCwd(It.workspaceCwd),nt=It.mode==="create"?await Ce.createSessionGroup({name:Y,color:be}):await Ce.updateSessionGroup(It.group.id,{name:Y,color:be});if(It.mode==="create"&&It.targetSession)try{await Ce.updateSessionOrganization(It.targetSession.sessionId,{groupId:nt.id,color:null}),It.workspaceCwd||O().catch(()=>{}),jn()}catch(nn){Vn(null),ln(""),It.workspaceCwd||zn().catch(()=>{}),h(nn,k("sidebar.groupAssignFailedAfterCreate"));return}Vn(null),ln(""),It.workspaceCwd?jn():zn().catch(()=>{})}catch(Ce){h(Ce,It.mode==="create"?k("sidebar.groupCreateFailed"):k("sidebar.groupUpdateFailed"))}finally{Nt(!1)}})()},[jn,ye,Wn,It,kn,ve,h,O,zn,k,S,_.client]),Yc=m.useCallback((Y,be)=>{Vs({group:Y,workspaceCwd:be})},[]),ua=m.useCallback(()=>{if(!Xs)return;Nt(!0),(ve(Xs.workspaceCwd)?S:_.client.workspaceByCwd(Xs.workspaceCwd)).deleteSessionGroup(Xs.group.id).then(()=>{Vs(null),Xs.workspaceCwd?jn():O().catch(()=>{})}).catch(be=>h(be,k("sidebar.groupDeleteFailed"))).then(()=>Xs.workspaceCwd?void 0:zn().catch(()=>{})).finally(()=>Nt(!1))},[Xs,ve,h,O,zn,k,jn,_.client,S]),rd=m.useCallback(Y=>{const be=Y.sessionId;if(!I||Ie.current.has(be))return;Ft(be,!0),ie(Y).updateSessionOrganization(be,{isPinned:!Y.isPinned}).then(()=>{O().catch(()=>{}),G().catch(()=>{}),jn()}).catch(nt=>h(nt,k("sidebar.organizationFailed"))).finally(()=>{Ft(be,!1)})},[jn,ie,h,I,O,G,Ft,k]),id=m.useCallback(Y=>{const be=Y.sessionId;if(be===hn||Ie.current.has(be))return;Ft(be,!0),(ve(Y.workspaceCwd)?U(be):_.client.workspaceByCwd(Y.workspaceCwd).archiveSessionsData([be])).then(()=>{oe(),jn()}).catch(nt=>h(nt,k("sidebar.archiveFailed"))).finally(()=>{Ft(be,!1)})},[U,jn,hn,ve,h,oe,Ft,k,_.client]),Am=m.useCallback(Y=>{const be=Y.sessionId;if(Ie.current.has(be))return;Ft(be,!0),(ve(Y.workspaceCwd)?Te(be):_.client.workspaceByCwd(Y.workspaceCwd).unarchiveSessionsData([be])).then(()=>{O(),jn()}).catch(nt=>h(nt,k("sidebar.unarchiveFailed"))).finally(()=>{Ft(be,!1)})},[jn,ve,h,O,Ft,k,Te,_.client]),ii=m.useCallback(async(Y,be)=>{let Ce=0;try{const Vi=await ie(be).listSessionGroups();vt(Vi.groups),je(Vi.colorOptions),Ce=Vi.groups.length}catch(Vi){h(Vi,k("sidebar.groupsLoadFailed"));return}if(!Y.isConnected)return;const nt=Y.getBoundingClientRect(),nn=typeof window>"u"?nt.right+jC:window.innerWidth,Kn=typeof window>"u"?nt.top+320:window.innerHeight,vn=Math.min(320,34*(Ce+op.length+2)+25),vs=nt.right+rp+jC<=nn?nt.right+rp:Math.max(rp,nt.left-jC-rp),Ns=Math.max(rp,Math.min(nt.top,Kn-vn-rp));wt({session:be,top:Ns,left:vs})},[ie,h,k]),Xc=m.useCallback((Y,be)=>{const Ce=Y.sessionId;if(!I||Ie.current.has(Ce))return;wt(null),Ft(Ce,!0),ie(Y).updateSessionOrganization(Ce,{groupId:be,color:null}).then(()=>{O().catch(()=>{}),jn()}).catch(nn=>h(nn,k("sidebar.organizationFailed"))).finally(()=>{Ft(Ce,!1)})},[jn,ie,h,I,O,Ft,k]),Hb=m.useCallback((Y,be)=>{const Ce=Y.sessionId;if(!I||Ie.current.has(Ce))return;wt(null),Ft(Ce,!0),ie(Y).updateSessionOrganization(Ce,{color:be,groupId:null}).then(()=>{O().catch(()=>{}),jn()}).catch(nn=>h(nn,k("sidebar.organizationFailed"))).finally(()=>{Ft(Ce,!1)})},[jn,ie,h,I,O,Ft,k]),ql=m.useMemo(()=>{const Y=yn.trim().toLowerCase(),be=P.filter(nn=>!nn.isPinned),Ce=Y?be.filter(nn=>qx(nn).toLowerCase().includes(Y)||nn.sessionId.toLowerCase().includes(Y)):be.slice();if(I)return Ce;const nt=new Map(Ce.map(nn=>[nn.sessionId,rmt(nn)]));return Ce.sort((nn,Kn)=>(nt.get(Kn.sessionId)??0)-(nt.get(nn.sessionId)??0))},[I,yn,P]),Hl=m.useMemo(()=>{if(!I)return[];const Y=yn.trim().length>0,be=new Set(Oe.map(vn=>vn.id)),Ce=new Map,nt=new Map;for(const vn of Oe)nt.set(vn.id,[]);const nn=[];for(const vn of ql){if(vn.color&&op.includes(vn.color)){const Ns=Ce.get(vn.color)??[];Ns.push(vn),Ce.set(vn.color,Ns);continue}const vs=vn.groupId&&be.has(vn.groupId)?nt.get(vn.groupId):void 0;vs?vs.push(vn):nn.push(vn)}const Kn=[];for(const vn of op){const vs=Ce.get(vn);!vs||vs.length===0||Kn.push({id:`color:${vn}`,kind:"color",label:k(`sidebar.groupColor.${vn}`),countLabel:String(vs.length),color:vn,sessions:vs})}for(const vn of Oe){const vs=nt.get(vn.id)??[];Y&&vs.length===0||Kn.push({id:`group:${vn.id}`,kind:"group",label:vn.name,countLabel:String(vs.length),color:vn.color,group:vn,sessions:vs})}return nn.length>0&&Kn.length>0&&Kn.push({id:emt,kind:"recent",label:k("sidebar.groupUngrouped"),countLabel:String(nn.length),sessions:nn}),Kn},[ql,Oe,I,yn,k]);m.useEffect(()=>{const Y=Hl.map(be=>be.id).filter(be=>!qn.current.has(be));if(Y.length!==0){for(const be of Y)qn.current.add(be);fn(be=>{const Ce=new Set(be);for(const nt of Y)Ce.add(nt);return Ce})}},[Hl]);const Ub=m.useCallback(Y=>{fn(be=>{const Ce=new Set(be);return Ce.has(Y)?Ce.delete(Y):Ce.add(Y),Ce})},[]),z4=m.useCallback(Y=>{var qo;if(e)return;Y.preventDefault(),(qo=dn.current)==null||qo.call(dn,!0),ti(!0);const be=Y.clientX,Ce=Zn,nt=document.body.style.cursor,nn=document.body.style.userSelect;let Kn=!1,vn=()=>{};document.body.style.cursor="col-resize",document.body.style.userSelect="none";try{Y.currentTarget.setPointerCapture(Y.pointerId)}catch{}function vs(ls){return Ce+ls-be}function Ns(){const ls=V2(Ce);$n(ls),gz(ls)}function Vi(){Kn||(Kn=!0,Ns(),vn(!0),t(!0))}function Jc(ls){const Ul=vs(ls.clientX);if(Ul<=dz){Vi();return}$n(omt(Ul))}vn=function(Ul){document.body.style.cursor=nt,document.body.style.userSelect=nn,window.removeEventListener("pointermove",Jc),window.removeEventListener("pointerup",Wi),window.removeEventListener("pointercancel",od),dn.current=null,Ul&&ti(!1)};function Wi(ls){const Ul=vs(ls.clientX);if(Ul<=dz){Vi();return}const Kr=V2(Ul);$n(Kr),gz(Kr),vn(!0)}function od(){vn(!0)}dn.current=vn,window.addEventListener("pointermove",Jc),window.addEventListener("pointerup",Wi,{once:!0}),window.addEventListener("pointercancel",od,{once:!0})},[e,t,Zn]),F4=Et?smt(Et):"",Wh=an!=null&&an.session.color&&op.includes(an.session.color)?an.session.color:null,ug=!Wh&&(an!=null&&an.session.groupId)&&ue.some(Y=>Y.id===an.session.groupId)?an.session.groupId:null,Vb=ye.length>0?ye:op,Gh=ug===null&&Wh===null,Ni=(Xs==null?void 0:Xs.group.name)??"",Mm=ye.length>0?ye:["blue"],dg=mz(Wn,Mm),Wb=!Mm.includes(Wn),Gb=kn.trim().length>0&&dg!==void 0&&!Ye,Kb=(It==null?void 0:It.mode)==="create"?k("sidebar.groupCreate"):k("sidebar.groupRename"),yi=m.useCallback((Y,be={})=>{const{isArchived:Ce=!1,grouped:nt=!1,readOnly:nn=!1}=be,Kn=qx(Y),vn=Y.updatedAt||Y.createdAt,vs=vn?q2(vn,k):"",Ns=bs.has(Y.sessionId),Vi=Y.sessionId!==hn&&_r.has(Y.sessionId),Jc=u.jsxs("div",{className:ke.tooltipContent,children:[u.jsx("div",{className:ke.tooltipTitle,children:Kn}),u.jsxs("div",{className:ke.tooltipTags,children:[Y.hasActivePrompt&&u.jsx("span",{className:Za(ke.tooltipTag,ke.tooltipTagRunning),children:k("sidebar.running")}),Vi&&u.jsx("span",{className:Za(ke.tooltipTag,ke.tooltipTagNew),children:k("sidebar.completedUnread")}),u.jsx("span",{className:ke.tooltipTag,children:k("sidebar.clients",{count:Y.clientCount??0})})]}),u.jsx("div",{className:ke.tooltipMeta,children:Y.sessionId})]});if(Ce)return u.jsxs("div",{className:Za(ke.sessionRow,ke.archivedRow,Ns&&ke.busySession),children:[u.jsx("span",{className:ke.sessionText,children:Kn}),u.jsxs("div",{className:ke.sessionMetaSlot,children:[u.jsx("span",{className:ke.sessionTime,children:vs}),u.jsx("div",{className:ke.sessionActions,onClick:ls=>ls.stopPropagation(),onKeyDown:ls=>ls.stopPropagation(),children:u.jsxs(MC,{children:[u.jsx(NC,{asChild:!0,children:u.jsx("button",{className:ke.sessionActionButton,type:"button","aria-label":k("sidebar.moreActions"),title:k("sidebar.moreActions"),children:u.jsx(v3,{})})}),u.jsx(IC,{align:"end",className:"w-auto min-w-40",onPointerDownOutside:()=>{Ae.current=!0},onCloseAutoFocus:ls=>{Ae.current&&(Ae.current=!1,ls.preventDefault())},children:u.jsxs(iz,{children:[u.jsxs(oz,{children:[u.jsxs(az,{children:[u.jsx(yj,{}),k("sidebar.details")]}),u.jsx(lz,{className:"min-w-64 p-3",children:Jc})]}),u.jsxs(ff,{onSelect:()=>Am(Y),children:[u.jsx(lue,{}),k("sidebar.unarchive")]}),u.jsxs(ff,{variant:"destructive",onSelect:()=>is(Y),children:[u.jsx(px,{}),k("sidebar.delete")]})]})})]})})]})]},Y.sessionId);const Wi=Y.sessionId===hn,od=Rt===Y.sessionId,qo=lt.has(Y.sessionId);return u.jsx("div",{className:Za(ke.sessionRow,nt&&ke.groupedSessionRow,Wi&&ke.currentSession,Y.isPinned&&ke.pinnedSession,Y.hasActivePrompt&&ke.runningSession,Ns&&ke.busySession),role:"button",tabIndex:0,"aria-current":Wi?"page":void 0,onClick:()=>pt(Y.sessionId,Y.workspaceCwd),onDoubleClick:()=>{!nn&&Wi&&!e&&gn(Y)},onKeyDown:ls=>{ls.key==="Enter"&&pt(Y.sessionId,Y.workspaceCwd)},children:!e&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:ke.sessionStatusSlot,children:Vi?u.jsx("span",{className:ke.sessionStatusDot,"aria-hidden":"true"}):null}),od&&!nn?u.jsx("form",{className:ke.renameForm,onClick:ls=>ls.stopPropagation(),onSubmit:ls=>{ls.preventDefault(),Ln()},children:u.jsx("input",{autoFocus:!0,className:ke.renameInput,value:on,onChange:ls=>Bn(ls.target.value),onBlur:pn,onKeyDown:ls=>{ls.key==="Escape"&&(ls.preventDefault(),pn())}})}):u.jsxs(u.Fragment,{children:[u.jsx("span",{className:ke.sessionText,children:Kn}),u.jsxs("div",{className:ke.sessionMetaSlot,children:[Y.hasActivePrompt?u.jsx("span",{className:ke.sessionLoading,"aria-label":k("sidebar.running")}):u.jsx("span",{className:ke.sessionTime,children:vs}),!nn&&u.jsxs("div",{className:ke.sessionActions,onClick:ls=>ls.stopPropagation(),onKeyDown:ls=>ls.stopPropagation(),children:[I&&u.jsx("button",{className:Za(ke.sessionActionButton,Y.isPinned&&ke.activeSessionActionButton),type:"button",disabled:Ns,"aria-label":Y.isPinned?k("sidebar.unpin"):k("sidebar.pin"),title:Y.isPinned?k("sidebar.unpin"):k("sidebar.pin"),onClick:()=>rd(Y),children:u.jsx(nde,{})}),u.jsx("button",{className:ke.sessionActionButton,type:"button",disabled:Ns||Wi,"aria-label":k("sidebar.archive"),title:k(Wi?"sidebar.archiveCurrentDisabled":"sidebar.archive"),onClick:()=>id(Y),children:u.jsx(uue,{})}),u.jsxs(MC,{children:[u.jsx(NC,{asChild:!0,children:u.jsx("button",{className:ke.sessionActionButton,type:"button","aria-label":k("sidebar.moreActions"),title:k("sidebar.moreActions"),children:u.jsx(v3,{})})}),u.jsx(IC,{align:"end",className:"w-auto min-w-40",onPointerDownOutside:()=>{Ae.current=!0},onCloseAutoFocus:ls=>{Ae.current&&(Ae.current=!1,ls.preventDefault())},children:u.jsxs(iz,{children:[u.jsxs(oz,{children:[u.jsxs(az,{children:[u.jsx(yj,{}),k("sidebar.details")]}),u.jsx(lz,{className:"min-w-64 p-3",children:Jc})]}),u.jsxs(ff,{disabled:!Wi,title:Wi?void 0:k("sidebar.renameCurrentOnly"),onSelect:()=>Ha(Y),children:[u.jsx(xU,{}),k("sidebar.rename")]}),I&&u.jsxs(ff,{disabled:Ns,onSelect:ls=>ii(ls.currentTarget,Y),children:[u.jsx(Rue,{}),k("sidebar.sessionGroup")]}),Ws&&u.jsxs(ff,{disabled:qo,onSelect:()=>si(Y),children:[u.jsx(Tue,{}),k("sidebar.export")]}),u.jsxs(ff,{variant:"destructive",disabled:Wi,title:Wi?k("sidebar.currentDeleteDisabled"):void 0,onSelect:()=>is(Y),children:[u.jsx(px,{}),k("sidebar.delete")]})]})})]})]})]})]})]})},Y.sessionId)},[bs,Ws,pn,e,_r,hn,on,Rt,lt,id,is,si,pt,Ha,rd,Am,ii,I,Ln,gn,k]),q4=m.useMemo(()=>B&&P.length===0?u.jsx("div",{className:ke.notice,children:k("sidebar.loadingSessions")}):F&&P.length===0?u.jsx("button",{className:ke.retry,type:"button",onClick:O,children:k("sidebar.loadFailed")}):ql.length===0&&(yn.trim()||!I||Hl.length===0)?u.jsx("div",{className:ke.notice,children:k("sidebar.searchEmpty")}):I?Hl.length===0?ql.map(Y=>yi(Y)):Hl.map(Y=>{const be=!_n.has(Y.id),Ce=Y.group;return u.jsx(k7,{id:Y.id,label:Y.label,count:Y.sessions.length,color:Y.color,expanded:be,onToggle:()=>Ub(Y.id),onRename:Y.kind==="group"&&Ce?()=>ca(Ce):void 0,onDelete:Y.kind==="group"&&Ce?()=>Yc(Ce):void 0,renameLabel:k("sidebar.groupRename"),deleteLabel:k("sidebar.groupDelete"),actionsDisabled:Ye,children:Y.sessions.map(nt=>yi(nt,{grouped:!0}))},Y.id)}):ql.map(Y=>yi(Y)),[_n,F,ql,Ye,Yc,ca,B,I,O,yi,yn,Hl,P.length,k,Ub]),Nm=m.useMemo(()=>{if(e||yn.trim())return null;const Y=u.jsxs("button",{type:"button",className:ke.archivedHeader,"aria-expanded":q,onClick:()=>N(nt=>!nt),children:[u.jsx("span",{className:ke.archivedTitle,style:{flex:"0 1 auto"},children:k("sidebar.archivedTitle")}),u.jsx("span",{className:ke.archivedChevron,"aria-hidden":"true",children:q?u.jsx(b_,{}):u.jsx(FE,{})}),q&&Le.length>0&&u.jsx("span",{className:ke.archivedCount,children:Le.length})]});if(!q)return u.jsx("div",{className:ke.archivedSection,children:Y});const be=u.jsx("button",{className:ke.retry,type:"button",onClick:()=>{oe(),at(nt=>nt+1)},children:k("sidebar.loadFailed")});let Ce;return(te||ge)&&Le.length===0?Ce=u.jsx("div",{className:ke.notice,children:k("sidebar.loadingSessions")}):(ce||_t)&&Le.length===0?Ce=be:Le.length===0?Ce=u.jsx("div",{className:ke.notice,children:k("sidebar.archivedEmpty")}):Ce=u.jsxs(u.Fragment,{children:[Le.map(nt=>yi(nt,{isArchived:!0})),(ce||_t)&&be]}),u.jsxs("div",{className:ke.archivedSection,children:[Y,u.jsx("div",{className:ke.archivedList,children:Ce})]})},[ce,q,te,Le,e,oe,yi,yn,at,_t,ge,k]);return u.jsxs(u.Fragment,{children:[u.jsxs("aside",{className:Za(ke.sidebar,e&&ke.collapsed,Lr&&ke.resizing,g&&ke.mobileOpen),"aria-label":k("sidebar.label"),style:Gs,children:[an&&u.jsxs("div",{ref:fe,className:ke.groupMenu,role:"menu","aria-label":k("sidebar.sessionGroup"),style:{top:an.top,left:an.left},onClick:Y=>Y.stopPropagation(),onKeyDown:gi,onMouseDown:Y=>Y.stopPropagation(),children:[u.jsxs("button",{className:Za(ke.groupMenuItem,Gh&&ke.groupMenuItemActive),type:"button",role:"menuitemradio","aria-checked":Gh,onClick:()=>Xc(an.session,null),children:[u.jsx("span",{className:ke.groupMenuEmptyDot}),u.jsx("span",{className:ke.groupMenuName,children:k("sidebar.groupUngrouped")}),Gh&&u.jsx("span",{className:ke.groupMenuCheck,children:"✓"})]}),Vb.map(Y=>{const be=Wh===Y;return u.jsxs("button",{className:Za(ke.groupMenuItem,be&&ke.groupMenuItemActive),type:"button",role:"menuitemradio","aria-checked":be,onClick:()=>Hb(an.session,Y),children:[u.jsx("span",{className:Za(ke.groupMenuDot,pz(Y))}),u.jsx("span",{className:ke.groupMenuName,children:k(`sidebar.groupColor.${Y}`)}),be&&u.jsx("span",{className:ke.groupMenuCheck,children:"✓"})]},`color:${Y}`)}),ue.map(Y=>{const be=ug===Y.id;return u.jsxs("button",{className:Za(ke.groupMenuItem,be&&ke.groupMenuItemActive),type:"button",role:"menuitemradio","aria-checked":be,onClick:()=>Xc(an.session,Y.id),children:[u.jsx("span",{className:Za(ke.groupMenuDot,pz(Y.color)),style:imt(Y.color)}),u.jsx("span",{className:ke.groupMenuName,children:Y.name}),be&&u.jsx("span",{className:ke.groupMenuCheck,children:"✓"})]},Y.id)}),u.jsx("div",{className:ke.groupMenuSeparator}),u.jsxs("button",{className:ke.groupMenuItem,type:"button",role:"menuitem",onClick:()=>lo(an.session),children:[u.jsx("span",{className:ke.groupMenuIcon,children:u.jsx(lmt,{})}),u.jsx("span",{className:ke.groupMenuName,children:k("sidebar.groupCreate")})]})]}),Et&&u.jsx(Ar,{title:k("delete.title"),size:"sm",onClose:()=>Tt(null),children:u.jsxs("div",{className:ke.confirmContent,children:[u.jsx("p",{className:ke.confirmDescription,children:k("sidebar.deleteConfirmDescription",{name:F4})}),u.jsxs("div",{className:ke.confirmActions,children:[u.jsx("button",{className:ke.secondaryButton,type:"button",onClick:()=>Tt(null),children:k("common.cancel")}),u.jsx("button",{className:ke.dangerButton,type:"button",onClick:ri,children:k("sidebar.delete")})]})]})}),Qs&&u.jsx(Ar,{title:k("sidebar.removeWorkspaceTitle"),size:"sm",onClose:()=>{(!Rn||kt)&&(xe.current=!0,gs(null),mn(null),Ot(!1))},children:u.jsxs("div",{className:ke.confirmContent,children:[u.jsx("p",{className:ke.confirmDescription,children:ts?k("sidebar.removeWorkspaceBusy",{name:Qs.cwd}):k("sidebar.removeWorkspaceConfirm",{name:Qs.cwd})}),ts&&u.jsxs("ul",{className:ke.workspaceRemovalActivityList,children:[u.jsx("li",{children:k("sidebar.removeWorkspaceSessions",{count:ts.sessions})}),u.jsx("li",{children:k("sidebar.removeWorkspacePrompts",{count:ts.activePrompts})}),u.jsx("li",{children:k("sidebar.removeWorkspaceStarts",{count:ts.pendingSessionStarts})}),u.jsx("li",{children:k("sidebar.removeWorkspaceConnections",{count:ts.acpConnections})}),u.jsx("li",{children:k("sidebar.removeWorkspaceMemoryTasks",{count:ts.memoryTasks})}),u.jsx("li",{children:k("sidebar.removeWorkspaceWorkers",{count:ts.channelWorkers})}),u.jsx("li",{children:k("sidebar.removeWorkspaceVoiceSessions",{count:ts.voiceSessions??0})})]}),ts&&T.sessionId&&T.workspaceCwd===Qs.cwd&&u.jsx("p",{className:ke.confirmDescription,children:k("sidebar.removeWorkspaceCurrentSession")}),kt&&u.jsx("p",{className:ke.confirmDescription,children:k("sidebar.removeWorkspaceInProgress")}),u.jsxs("div",{className:ke.confirmActions,children:[u.jsx("button",{className:ke.secondaryButton,type:"button",disabled:Rn&&!kt,onClick:()=>{xe.current=!0,gs(null),mn(null),Ot(!1)},children:k("common.cancel")}),u.jsx("button",{className:ke.dangerButton,type:"button",disabled:Rn||kt||ts!==null&&!!T.sessionId&&T.workspaceCwd===Qs.cwd,onClick:()=>void Pe(),children:k(ts?"sidebar.forceRemoveWorkspace":"sidebar.removeWorkspace")})]})]})}),It&&u.jsx(Ar,{title:Kb,size:"sm",onClose:Va,children:u.jsxs("form",{className:"flex flex-col gap-6",onSubmit:Y=>{Y.preventDefault(),Wa()},children:[u.jsxs(zM,{children:[u.jsxs(i0,{children:[u.jsx(ry,{htmlFor:"session-group-name",children:k("sidebar.groupNamePrompt")}),u.jsx(Bp,{id:"session-group-name",value:kn,autoFocus:!0,maxLength:64,onChange:Y=>ln(Y.target.value)})]}),u.jsxs(i0,{children:[u.jsx(ry,{htmlFor:"session-group-color",children:k("sidebar.groupColor")}),u.jsxs(AM,{value:Wb?LC:Wn,onValueChange:Y=>{Jn(Y===LC?Cs:Y)},children:[u.jsx(IM,{id:"session-group-color",className:"w-full",children:u.jsx(NM,{})}),u.jsx(RM,{children:u.jsxs(MM,{children:[Mm.map(Y=>u.jsx(F2,{value:Y,children:k(`sidebar.groupColor.${Y}`)},Y)),u.jsx(F2,{value:LC,children:k("sidebar.groupColor.custom")})]})})]})]}),Wb&&u.jsxs(i0,{children:[u.jsx(ry,{htmlFor:"session-group-hex-color",children:k("sidebar.groupColor.hex")}),u.jsxs("div",{className:ke.groupCustomColorRow,children:[u.jsx(Bp,{className:ke.groupColorPicker,type:"color",value:Cs,"aria-label":k("sidebar.groupColor.picker"),onChange:Y=>{const be=Y.target.value.toLowerCase();fr(be),Jn(be)}}),u.jsx(Bp,{id:"session-group-hex-color",value:Wn,maxLength:7,spellCheck:!1,"aria-invalid":dg===void 0,onChange:Y=>{const be=Y.target.value,Ce=be.trim(),nt=Ce&&!Ce.startsWith("#")?`#${Ce}`:be;Jn(nt);const nn=_7(nt);nn&&fr(nn)}})]}),dg===void 0&&u.jsx("span",{className:ke.groupColorError,role:"alert",children:k("sidebar.groupColor.invalid")})]})]}),u.jsxs("div",{className:"flex justify-end gap-2",children:[u.jsx(Oc,{type:"button",variant:"outline",disabled:Ye,onClick:Va,children:k("common.cancel")}),u.jsx(Oc,{type:"submit",disabled:!Gb,children:k("common.save")})]})]})}),Xs&&u.jsx(Ar,{title:k("sidebar.groupDelete"),size:"sm",onClose:()=>{Ye||Vs(null)},children:u.jsxs("div",{className:ke.confirmContent,children:[u.jsx("p",{className:ke.confirmDescription,children:k("sidebar.groupDeleteConfirm",{name:Ni})}),u.jsxs("div",{className:ke.confirmActions,children:[u.jsx("button",{className:ke.secondaryButton,type:"button",disabled:Ye,onClick:()=>Vs(null),children:k("common.cancel")}),u.jsx("button",{className:ke.dangerButton,type:"button",disabled:Ye,onClick:ua,children:k("sidebar.groupDelete")})]})]})}),M&&u.jsx("div",{className:ke.topRow,children:b!=null&&b.render?b.render():u.jsxs(u.Fragment,{children:[u.jsx("span",{className:ke.brandLogo,"aria-hidden":"true",children:u.jsx(cmt,{})}),!e&&u.jsx("span",{className:ke.brandName,children:"Qwen Code"})]})}),u.jsxs("div",{className:ke.primaryNav,children:[u.jsxs("button",{className:ke.newChatButton,type:"button",title:k("sidebar.newTask"),"aria-label":k("sidebar.newTask"),disabled:Xe,onClick:()=>ct(),children:[u.jsx("span",{className:ke.navIcon,children:u.jsx(wj,{size:16,strokeWidth:1.2})}),!e&&u.jsx("span",{children:k("sidebar.newTask")})]}),L.has("scheduledTasks")&&u.jsxs("button",{className:ke.pluginButton,type:"button",title:k("sidebar.scheduledTasks"),"aria-label":k("sidebar.scheduledTasks"),onClick:r,children:[u.jsx("span",{className:ke.navIcon,children:u.jsx(mue,{size:16,strokeWidth:1.2})}),!e&&u.jsx("span",{children:k("sidebar.scheduledTasks")})]})]}),u.jsx("div",{className:ke.body,children:u.jsxs("div",{className:ke.sessionList,children:[!e&&Gr.length>0&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:ke.projectsHeader,children:u.jsxs("button",{className:ke.projectsHeaderToggle,type:"button","aria-expanded":ee,onClick:()=>re(Y=>!Y),children:[u.jsx("span",{children:k("sidebar.pinnedSessions")}),u.jsx(yz,{expanded:ee})]})}),ee&&u.jsx("div",{className:ke.pinnedSessionList,children:Gr.map(Y=>yi(Y))})]}),!e&&u.jsxs("div",{className:ke.projectsHeader,children:[u.jsxs("button",{className:ke.projectsHeaderToggle,type:"button","aria-expanded":Ps,onClick:()=>jr(Y=>!Y),children:[u.jsx("span",{children:k("sidebar.project")}),u.jsx(yz,{expanded:Ps})]}),u.jsxs("div",{className:ke.projectsHeaderActions,children:[u.jsx("button",{className:ke.projectsHeaderAction,type:"button",title:k("sidebar.search"),"aria-label":k("sidebar.search"),onClick:()=>{Bs(Y=>(Y&&Mn(""),!Y)),jr(!0)},children:u.jsx(vj,{})}),u.jsx("button",{className:ke.projectsHeaderAction,type:"button",title:k("sidebar.addWorkspace"),"aria-label":k("sidebar.addWorkspace"),onClick:()=>{sr(!0)},children:u.jsx(bj,{})})]})]}),Ui&&!e&&u.jsxs("div",{className:ke.projectSearch,children:[u.jsx(vj,{"aria-hidden":"true"}),u.jsx(Bp,{value:yn,placeholder:k("sidebar.searchPlaceholder"),"aria-label":k("sidebar.search"),autoFocus:!0,onChange:Y=>Mn(Y.target.value),onKeyDown:Y=>{Y.key==="Escape"&&(Mn(""),Bs(!1))}})]}),(e||Ps)&&u.jsx(u.Fragment,{children:!e&&u.jsx("div",{className:ke.workspacePicker,children:u.jsx("div",{className:ke.workspaceList,children:Ts.map(Y=>u.jsxs(m.Fragment,{children:[u.jsx(Gft,{workspace:Y,client:_.client,isActive:hn?T.workspaceCwd===Y.cwd:Y.primary?w===void 0:w===Y.cwd,reloadToken:xt,primaryLabel:Ts.length>1?k("sidebar.workspacePrimary"):"",untrustedLabel:k("sidebar.workspaceUntrusted"),readOnlyLabel:k("sidebar.workspaceReadOnly"),trustToOpenLabel:k("sidebar.workspaceTrustToOpen"),noSessionsLabel:k("sidebar.noSessions"),loadErrorLabel:k("sidebar.loadFailed"),organizationEnabled:I,ungroupedLabel:k("sidebar.groupUngrouped"),onRenameGroup:ca,onDeleteGroup:Yc,renameGroupLabel:k("sidebar.groupRename"),deleteGroupLabel:k("sidebar.groupDelete"),groupActionsDisabled:Ye,excludePinned:!0,formatTime:be=>q2(be,k),searchQuery:yn,expanded:Y.primary?es:void 0,autoExpandKey:(Gn==null?void 0:Gn.id)===Y.id?Gn==null?void 0:Gn.key:void 0,onExpandedChange:Y.primary?ss:void 0,renderSessions:!Y.primary,renderSession:(be,Ce)=>yi({...be,workspaceCwd:Y.cwd},Ce),headerActions:be=>{const Ce=ds&&!Y.primary&&Y.removable===!0;return!Y.trusted&&!Ce?null:u.jsxs("div",{className:ke.workspaceHeaderActions,style:{visibility:be?"visible":"hidden"},children:[Y.trusted&&u.jsxs(u.Fragment,{children:[u.jsx("button",{className:ke.workspaceHeaderAction,type:"button","aria-label":k("sidebar.groupCreate"),onClick:nt=>{nt.preventDefault(),nt.stopPropagation(),Y.primary?Fo():Ua(Y.cwd)},children:u.jsx(bj,{size:16,strokeWidth:1.2})}),u.jsx("button",{className:ke.workspaceHeaderAction,type:"button",title:k("sidebar.newTask"),"aria-label":k("sidebar.newTask"),onClick:nt=>{nt.preventDefault(),nt.stopPropagation(),ct(Y.primary?void 0:Y.cwd)},children:u.jsx(wj,{size:16,strokeWidth:1.2})})]}),Ce&&u.jsxs(MC,{children:[u.jsx(NC,{asChild:!0,children:u.jsx("button",{className:ke.workspaceHeaderAction,type:"button","aria-label":k("sidebar.workspaceActions"),disabled:Rn&&(Qs==null?void 0:Qs.id)===Y.id,children:u.jsx(v3,{size:16,strokeWidth:1.2})})}),u.jsx(IC,{align:"end",children:u.jsxs(ff,{variant:"destructive","aria-label":`${k("sidebar.removeWorkspace")}: ${Y.cwd}`,onSelect:()=>qa(Y),children:[u.jsx(px,{}),k("sidebar.removeWorkspace")]})})]})]})}}),Y.primary&&(es||yn.trim())?u.jsx("div",{className:ke.workspaceSessionBody,children:q4}):null]},Y.id))})})}),Nm]})}),x!==!1&&u.jsxs("div",{className:Za(ke.footer,en&&ke.footerCompact,Sn&&ke.footerTight),children:[u.jsxs("div",{className:ke.footerPrimary,children:[L.has("settings")&&u.jsxs("button",{className:ke.footerButton,type:"button",title:k("sidebar.settings"),"aria-label":k("sidebar.settings"),onClick:n,children:[u.jsx("span",{className:`${ke.navIcon} ${ke.settingsIcon}`,children:u.jsx(cde,{size:16,strokeWidth:1.2})}),!e&&!en&&u.jsx("span",{className:ke.footerButtonLabel,children:k("sidebar.settings")})]}),!e&&!Sn&&cn&&L.has("version")&&u.jsx("span",{className:ke.version,title:`Qwen Code ${cn}`,children:cn})]}),u.jsxs("div",{className:ke.footerActions,children:[L.has("theme")&&u.jsx("button",{className:ke.collapseButton,type:"button",title:f===gr.Dark?k("sidebar.themeLight"):k("sidebar.themeDark"),"aria-label":f===gr.Dark?k("sidebar.themeLight"):k("sidebar.themeDark"),onClick:()=>p(f===gr.Dark?gr.Light:gr.Dark),children:f===gr.Dark?u.jsx(gde,{size:16,strokeWidth:1.2}):u.jsx(Gue,{size:16,strokeWidth:1.2})}),o&&L.has("sessionsOverview")&&u.jsx("button",{className:ke.collapseButton,type:"button",title:k("sidebar.sessionsOverview"),"aria-label":k("sidebar.sessionsOverview"),onClick:i,children:u.jsx($ue,{size:16,strokeWidth:1.2})}),l&&L.has("splitView")&&u.jsx("button",{className:ke.collapseButton,type:"button",title:k("sidebar.splitView"),"aria-label":k("sidebar.splitView"),onClick:a,children:u.jsx(kue,{size:16,strokeWidth:1.2})}),L.has("daemonStatus")&&u.jsx("button",{className:ke.collapseButton,type:"button",title:k("sidebar.daemonStatus"),"aria-label":k("sidebar.daemonStatus"),onClick:s,children:u.jsx(oue,{size:16,strokeWidth:1.2})}),!g&&L.has("collapse")&&u.jsx("button",{className:ke.collapseButton,type:"button",title:k(e?"sidebar.expand":"sidebar.collapse"),"aria-label":k(e?"sidebar.expand":"sidebar.collapse"),onClick:()=>t(!e),children:e?u.jsx(Zue,{size:16,strokeWidth:1.2}):u.jsx(Que,{size:16,strokeWidth:1.2})})]})]}),u.jsx("div",{className:ke.resizeHandle,role:"separator","aria-orientation":"vertical",onPointerDown:z4})]}),zr&&u.jsx(rdt,{onClose:()=>sr(!1),onAdd:rs})]})}function dmt(e){const[t,n]=m.useState(e);return m.useEffect(()=>{const s=window.requestAnimationFrame(()=>{n(e)});return()=>window.cancelAnimationFrame(s)},[e]),t}const hmt=3e3,fmt=2;function bz(e){return e.some(t=>t.status==="running"||t.status==="paused")}function mmt(e,t,n=0){const s=H0(),[r,i]=m.useState([]),[o,a]=m.useState(!1),[l,c]=m.useState(!1),d=m.useRef(0),h=m.useRef(!1);m.useEffect(()=>{if(!t){i([]),a(!1),d.current=0;return}},[t]),m.useEffect(()=>{!t||!e||(d.current=0,a(!0))},[t,e]),m.useEffect(()=>{!t||n===0||(d.current=0,a(!0))},[t,n]),m.useEffect(()=>{if(l||!t||!o)return;let p=!1;const g=()=>{h.current||(h.current=!0,s.getTasks().then(w=>{if(!p){if(i(w.tasks),w.tasks.length===0){d.current+=1,d.current>=fmt&&a(!1);return}d.current=0,bz(w.tasks)||a(!1)}}).catch(w=>{p||console.warn("[web-shell] failed to refresh tasks:",w)}).finally(()=>{h.current=!1}))};g();const y=setInterval(g,hmt);return()=>{p=!0,clearInterval(y)}},[s,t,o,l]);const f=m.useRef(r);return f.current=r,m.useEffect(()=>{const p=g=>{const y=g.detail,w=(y==null?void 0:y.active)===!0;c(w),!w&&bz(f.current)&&a(!0)};return window.addEventListener(Qy,p),()=>window.removeEventListener(Qy,p)},[]),r}function pmt(e,t){if(e===t)return!0;if(e==null||t==null||typeof e!="object"||typeof t!="object")return!1;if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:e.every((i,o)=>i===t[o]);const n=Object.keys(e),s=t,r=e;return n.length!==Object.keys(s).length?!1:n.every(i=>{const o=r[i],a=s[i];return o===a?!0:Array.isArray(o)&&Array.isArray(a)?o.length===a.length&&o.every((l,c)=>l===a[c]):!1})}function gmt(e){const t=m.useRef(e);return pmt(t.current,e)||(t.current=e),t.current}function ymt(e,t){const n=m.useRef(e);return e.length!==n.current.length?(n.current=e,e):(e.some((r,i)=>t(r)!==t(n.current[i]))&&(n.current=e),n.current)}const xi={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"},vz=1024,bmt=new RegExp(String.raw`(?<![\w$])\$(?![\s\d$])(?=[^$\n]{1,${vz}}\S\$)([^$\n]{1,${vz}})\$(?![\w$])`,"g");function vmt(e){var c,d,h;const t=[],n=e.split(/\r?\n/),s=/^ *(`{3,}|~{3,}) *([^`]*)$/,r=new Map;let i=null,o=null,a=null,l=[];for(const f of n){const p=f.match(s);if(!i){if(p){if(i=p[1]??null,o=((d=(c=p[2])==null?void 0:c.trim().split(/\s+/)[0])==null?void 0:d.toLowerCase())||null,o){const g=(r.get(o)??0)+1;r.set(o,g),a=g}else a=null;l=[]}continue}if(p&&((h=p[1])!=null&&h.startsWith(i[0]??""))&&p[1].length>=i.length){t.push({lang:o,content:l.join(`
`),index:t.length+1,langIndex:a}),i=null,o=null,a=null,l=[];continue}l.push(f)}return t}function wmt(e){var l;const t=[],n=e.split(/\r?\n/),s=/^ *(`{3,}|~{3,}) *([^`]*)$/,r=/^ *\$\$ *$/;let i=null,o=!1,a=[];for(const c of n){const d=c.match(s);if(i){d&&((l=d[1])!=null&&l.startsWith(i[0]??""))&&d[1].length>=i.length&&(i=null);continue}if(!o){if(d){i=d[1]??null;continue}r.test(c)&&(o=!0,a=[]);continue}if(r.test(c)){t.push({content:a.join(`
`),index:t.length+1}),o=!1,a=[];continue}a.push(c)}return t}function xmt(e){var a;const t=[],n=e.split(/\r?\n/),s=/^ *(`{3,}|~{3,}) *([^`]*)$/,r=/^ *\$\$ *$/;let i=null,o=!1;for(const l of n){const c=l.match(s);if(i){c&&((a=c[1])!=null&&a.startsWith(i[0]??""))&&c[1].length>=i.length&&(i=null);continue}if(o){r.test(l)&&(o=!1);continue}if(c){i=c[1]??null;continue}if(r.test(l)){o=!0;continue}for(const d of l.matchAll(bmt)){const h=d[1];h&&t.push({content:h,index:t.length+1})}}return t}function wz(e,t){return t&&e.langIndex!==null?`${t} code block ${e.langIndex}`:`Code block ${e.index}`}function kmt(e,t){var d;const n=t.trim().split(/\s+/).filter(Boolean),s=(d=n[0])==null?void 0:d.toLowerCase();if(!s)return;const r=vmt(e);if(r.length===0)return null;let i=null,o=null;const a=s==="code"?n.slice(1):n.map(h=>h);s!=="code"&&(i=s);for(const h of a)/^\d+$/.test(h)?o=Number(h):h.toLowerCase()!=="code"&&(i=h.toLowerCase());const l=i?r.filter(h=>h.lang===i):r;if(l.length===0)return null;if(o!==null){const h=i?l.find(f=>f.langIndex===o):r.find(f=>f.index===o);return h?{content:h.content,label:wz(h,i)}:null}const c=l[l.length-1];return c?{content:c.content,label:wz(c,i)}:null}function xz(e,t){const n=xmt(e);if(n.length===0)return null;let s=null;for(const i of t)/^\d+$/.test(i)&&(s=Number(i));const r=s!==null?n.find(i=>i.index===s):n[n.length-1];return r?{content:r.content,label:`Inline LaTeX expression ${r.index}`}:null}function _mt(e,t){var c;const n=t.trim().split(/\s+/).filter(Boolean),s=(c=n[0])==null?void 0:c.toLowerCase();if(s!=="latex"&&s!=="math"&&s!=="inline-latex")return;if(s==="inline-latex")return xz(e,n.slice(1));const r=n.slice(1),i=r.findIndex(d=>d.toLowerCase()==="inline");if(i!==-1)return xz(e,r.filter((d,h)=>h!==i));const o=wmt(e);if(o.length===0)return null;let a=null;for(const d of r)/^\d+$/.test(d)&&(a=Number(d));const l=a!==null?o.find(d=>d.index===a):o[o.length-1];return l?{content:l.content,label:`LaTeX block ${l.index}`}:null}function Smt(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.role==="assistant"&&n.content)return n.content}return null}function Cmt(e){var t;return typeof navigator>"u"||!((t=navigator.clipboard)!=null&&t.writeText)?Promise.reject(new Error("Clipboard API is not available")):navigator.clipboard.writeText(e)}async function Tmt(e,t,n=Cmt){const s=Smt(e);if(s===null)return{status:"info",message:xi.NO_OUTPUT};if(!s)return{status:"info",message:xi.NO_TEXT};try{const r=_mt(s,t);if(r===null)return{status:"info",message:t.trim().split(/\s+/).some(l=>l==="inline")||t.trim().toLowerCase().startsWith("inline-latex")?xi.INLINE_LATEX_MISSING:xi.LATEX_MISSING};if(r!==void 0)return await n(r.content),{status:"info",message:`${r.label}${xi.COPIED_SUFFIX}`};const i=kmt(s,t);if(i===null)return{status:"info",message:xi.CODE_MISSING};const o=(i==null?void 0:i.content)??s;return await n(o),{status:"info",message:i?`${i.label}${xi.COPIED_SUFFIX}`:xi.OUTPUT_COPIED}}catch(r){const i=r instanceof Error?r.message:String(r);return{status:"error",message:`${xi.CLIPBOARD_PREFIX}${i}`}}}function Emt(e){return typeof e=="object"&&e!==null}function _ne(e){const t="Model switched: ";return e.startsWith(t)?e.slice(t.length).trim().replace(/\([^()]+\)$/,""):null}function FM(e){return e.role==="system"&&e.variant==="info"&&e.source==="model_switch_summary"}function Amt(e){if(!FM(e)||!Emt(e.data))return null;const t=e.data.modelId;return typeof t=="string"&&t?t:null}function Mmt(e){const t=new Set;for(const n of e){if(!FM(n))continue;const s=Amt(n);s&&t.add(s)}return t.size===0?[...e]:e.filter(n=>{if(n.role!=="system"||n.variant!=="info")return!0;const s=_ne(n.content);return!s||!t.has(s)})}function Nmt(e){return e.role!=="system"||e.variant!=="info"?!1:_ne(e.content)!==null||FM(e)}function Imt(e){const t=e.findIndex(n=>!Nmt(n));return t<0?[]:e.slice(t)}function kz(e){return Imt(Mmt(e))}function Rmt(e){return e.blocked?{kind:"ignore"}:e.streaming?e.armed==="cancel"?{kind:"cancel"}:{kind:"arm",action:"cancel"}:e.hasInput?e.armed==="clear"?{kind:"clear"}:{kind:"arm",action:"clear"}:{kind:"ignore"}}function _z(e,t){const n={nodeVersion:"",npmVersion:"",authSource:"",platform:"",arch:"",sandbox:"",proxy:"",memoryUsage:""};if(e)for(const s of e.cells){const r=s.detail;s.kind==="node_version"&&(r!=null&&r.version)?n.nodeVersion=r.version:s.kind==="npm"&&(r!=null&&r.version)?n.npmVersion=String(r.version).replace(/^npm\s*/i,""):s.kind==="auth"&&(r!=null&&r.source)&&(n.authSource=r.source)}if(t)for(const s of t.cells)s.kind==="platform"?(n.platform=s.name,s.value&&(n.arch=s.value)):s.kind==="sandbox"&&s.name==="SANDBOX"?n.sandbox=s.value||"":s.kind==="proxy"&&s.present&&s.value?n.proxy=`${s.name}: ${s.value}`:s.kind==="memory"&&s.value&&(n.memoryUsage=s.value);return n}function jmt(e){const t=e.match(/^(.+)\(([^()]+)\)$/);return t?`${t[2]}:${t[1]}`:e}function Sz(e){const t=e.match(/^(.+)\(([^()]+)\)$/);return t?t[1]:e}function Lmt(e){const t=e.indexOf("\0"),n=t>=0?e.slice(0,t):e,s=n.indexOf(":");return s>0?`${n.slice(s+1)}(${n.slice(0,s)})`:n}const Dmt="_layout_ghraz_1",Omt="_muted_ghraz_8",Pmt="_notice_ghraz_13",Bmt="_list_ghraz_20",$mt="_group_ghraz_26",zmt="_groupTitle_ghraz_33",Fmt="_server_ghraz_39",qmt="_serverCard_ghraz_44",Hmt="_serverCardExpanded_ghraz_50",Umt="_row_ghraz_55",Vmt="_expandedRow_ghraz_72",Wmt="_serverRow_ghraz_76",Gmt="_rowMain_ghraz_81",Kmt="_rowIcon_ghraz_96",Ymt="_chevronCell_ghraz_125",Xmt="_toolRow_ghraz_135",Qmt="_chevron_ghraz_125",Jmt="_chevronExpanded_ghraz_150",Zmt="_disabled_ghraz_154",ept="_name_ghraz_158",tpt="_serverName_ghraz_166",npt="_status_ghraz_170",spt="_badge_ghraz_171",rpt="_toolCount_ghraz_185",ipt="_resourceCount_ghraz_190",opt="_promptCount_ghraz_191",apt="_success_ghraz_196",lpt="_warning_ghraz_200",cpt="_error_ghraz_204",upt="_serverDetail_ghraz_208",dpt="_serverDetailHeader_ghraz_218",hpt="_serverActions_ghraz_223",fpt="_field_ghraz_230",mpt="_label_ghraz_238",ppt="_value_ghraz_244",gpt="_button_ghraz_249",ypt="_message_ghraz_269",bpt="_schema_ghraz_270",vpt="_tools_ghraz_281",wpt="_tool_ghraz_135",xpt="_resources_ghraz_292",kpt="_sectionTitle_ghraz_301",_pt="_resourceUri_ghraz_306",Spt="_resourceLabel_ghraz_314",Cpt="_toolDetail_ghraz_324",Tpt="_section_ghraz_301",Ept="_description_ghraz_347",Apt="_parameter_ghraz_353",Mpt="_empty_ghraz_359",Npt="_emptyTools_ghraz_360",Mt={layout:Dmt,muted:Omt,notice:Pmt,list:Bmt,group:$mt,groupTitle:zmt,server:Fmt,serverCard:qmt,serverCardExpanded:Hmt,row:Umt,expandedRow:Vmt,serverRow:Wmt,rowMain:Gmt,rowIcon:Kmt,chevronCell:Ymt,toolRow:Xmt,chevron:Qmt,chevronExpanded:Jmt,disabled:Zmt,name:ept,serverName:tpt,status:npt,badge:spt,toolCount:rpt,resourceCount:ipt,promptCount:opt,success:apt,warning:lpt,error:cpt,serverDetail:upt,serverDetailHeader:dpt,serverActions:hpt,field:fpt,label:mpt,value:ppt,button:gpt,message:ypt,schema:bpt,tools:vpt,tool:wpt,resources:xpt,sectionTitle:kpt,resourceUri:_pt,resourceLabel:Spt,toolDetail:Cpt,section:Tpt,description:Ept,parameter:Apt,empty:Mpt,emptyTools:Npt};function Cz(e){if(e&&typeof e=="object"){const t=e.body;if(t&&typeof t=="object"){const n=t.data;if(n&&typeof n=="object"){const r=n.details;if(typeof r=="string"&&r)return r}const s=t.error;if(typeof s=="string"&&s)return s}if(e instanceof Error&&e.message)return e.message}return String(e)}function Ipt(e,t){if(e.disabled)return{text:t("mcp.status.disabled"),className:Mt.error};switch(e.mcpStatus){case"connected":return{text:t("mcp.status.connected"),className:Mt.success};case"connecting":return{text:t("mcp.status.starting"),className:Mt.warning};case"disconnected":default:return{text:t("mcp.status.disconnectedTitle"),className:Mt.error}}}function Rpt(e,t){return e.extensionName?t("mcp.extensionMcp"):t("mcp.userMcp")}function DC(e,t,n){return[`${t("mcp.oauth.server")}: ${e}`,"",t("mcp.oauth.starting",{name:e}),...n?["",n]:[]].join(`
`)}function jpt(e){const t=e.schema,n=(t==null?void 0:t.parametersJsonSchema)??(t==null?void 0:t.parameters)??t;return n&&typeof n=="object"?n:null}function Lpt(e,t){const n=e.annotations??{},s=[];return n.destructiveHint&&s.push(t("mcp.annotation.destructive")),n.readOnlyHint&&s.push(t("mcp.annotation.readOnly")),n.openWorldHint&&s.push(t("mcp.annotation.openWorld")),n.idempotentHint&&s.push(t("mcp.annotation.idempotent")),s.join(", ")}function Tz(e,t){return`${e}:${t}`}function Ez(e,t){return`${e}\0${t}`}const $d=LM;function OC({expanded:e}){return u.jsx("svg",{className:`${Mt.chevron} ${e?Mt.chevronExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})}function Dpt(e,t){const n=[];return!e.disabled&&e.mcpStatus==="disconnected"&&n.push({id:"reconnect",label:t("mcp.action.reconnect")}),n.push({id:e.disabled?"enable":"disable",label:e.disabled?t("mcp.action.enable"):t("mcp.action.disable")}),e.disabled||(n.push({id:"authenticate",label:e.hasOAuthTokens?t("mcp.action.reauth"):t("mcp.action.auth")}),e.hasOAuthTokens&&n.push({id:"clear-auth",label:t("mcp.action.clearAuth")})),n}function Opt({tool:e,t}){const n=jpt(e);if(!n)return u.jsx("div",{className:Mt.muted,children:t("mcp.noSchema")});const s=n.properties,r=Array.isArray(n.required)?new Set(n.required.filter(o=>typeof o=="string")):new Set;if(!s||typeof s!="object")return u.jsx("pre",{className:Mt.schema,children:JSON.stringify(n,null,2)});const i=Object.entries(s);return i.length===0?null:u.jsxs("div",{className:Mt.section,children:[u.jsx("div",{className:Mt.sectionTitle,children:t("mcp.parameters")}),i.map(([o,a])=>{const l=a&&typeof a=="object"?a:{},c=typeof l.type=="string"?l.type:"any",d=typeof l.description=="string"?l.description:"";return u.jsx("div",{className:Mt.parameter,children:`- ${o}${r.has(o)?t("mcp.required"):""}: ${c}${d?` - ${d}`:""}`},o)})]})}function _1({label:e,value:t}){return u.jsxs("div",{className:Mt.field,children:[u.jsx("span",{className:Mt.label,children:e}),u.jsx("span",{className:Mt.value,children:t})]})}function Ppt({tool:e,t}){const n=Lpt(e,t);return u.jsxs("div",{className:Mt.toolDetail,children:[e.isValid?null:u.jsxs("div",{className:Mt.section,children:[u.jsx("div",{className:`${Mt.sectionTitle} ${Mt.error}`,children:t("mcp.invalidToolWarning")}),u.jsxs("div",{className:Mt.muted,children:[$d(t("mcp.invalidReasonLabel"))," ",e.invalidReason||t("mcp.status.unknown")]}),u.jsx("div",{className:Mt.muted,children:t("mcp.invalidToolHelp")})]}),e.description?u.jsxs("div",{className:Mt.section,children:[u.jsx("div",{className:Mt.sectionTitle,children:$d(t("mcp.description"))}),u.jsx("div",{className:Mt.description,children:e.description.trim()})]}):u.jsx("div",{className:Mt.muted,children:t("mcp.noDescription")}),n?u.jsx(_1,{label:$d(t("mcp.annotations")),value:n}):null,u.jsx(Opt,{tool:e,t})]})}function Bpt({resource:e,t}){const n=e.title||e.name||"",s=n!==""&&n!==e.uri;return u.jsxs("div",{className:Mt.toolDetail,children:[u.jsx(_1,{label:$d(t("mcp.resource.uriLabel")),value:e.uri}),s?u.jsx(_1,{label:$d(t("mcp.resource.nameLabel")),value:n}):null,e.mimeType?u.jsx(_1,{label:$d(t("mcp.resource.mimeTypeLabel")),value:e.mimeType}):null,typeof e.size=="number"?u.jsx(_1,{label:$d(t("mcp.resource.sizeLabel")),value:t("mcp.resource.bytes",{count:e.size})}):null,e.description?u.jsxs("div",{className:Mt.section,children:[u.jsx("div",{className:Mt.sectionTitle,children:$d(t("mcp.description"))}),u.jsx("div",{className:Mt.description,children:e.description.trim()})]}):null]})}function $pt({message:e}){const{t}=ot(),n=gU({autoLoad:!1}),[s,r]=m.useState(e.status),[i,o]=m.useState(e.toolsByServer),[a,l]=m.useState(e.resourcesByServer??{}),c=m.useMemo(()=>s.servers??[],[s.servers]),[d,h]=m.useState(new Set),[f,p]=m.useState(new Set),[g,y]=m.useState(new Set),[w,v]=m.useState(null),[b,x]=m.useState(null);m.useEffect(()=>{h(I=>{const A=new Set(c.map(P=>P.name));return new Set([...I].filter(P=>A.has(P)))})},[c]);const k=c.filter(I=>!I.disabled&&I.mcpStatus==="connecting").length,T=m.useMemo(()=>{var A,P;const I=[];for(const B of c){const F=Rpt(B,t),O={server:B,tools:((A=i[B.name])==null?void 0:A.tools)??[],resources:((P=a[B.name])==null?void 0:P.resources)??[]},X=I.find(z=>z.label===F);X?X.items.push(O):I.push({label:F,items:[O]})}return I},[c,t,i,a]),C=m.useCallback(async I=>{var F;const A=await n.reload();if(!A)return;r(A);const P=(F=A.servers)==null?void 0:F.find(O=>O.name===I);if(!P)return;const B=await n.loadTools(P.name);if(o(O=>({...O,[P.name]:B})),P.resourceCount)try{const O=await n.loadResources(P.name);l(X=>({...X,[P.name]:O}))}catch{}else l(O=>{if(!(P.name in O))return O;const X={...O};return delete X[P.name],X})},[n]),S=m.useCallback(async(I,A)=>{if(!b){h(new Set([I.name])),x(I.name),v({serverName:I.name,text:A.id==="authenticate"?DC(I.name,t):t("mcp.action.running",{action:A.label})});try{let P=null;if(A.id==="reconnect")await n.restartServer(I.name);else{const B=await n.manageServer(I.name,A.id),F=[...B.messages??[],...B.authUrl?[B.authUrl]:[]].join(`
`);F&&(P=A.id==="authenticate"?DC(I.name,t,F):F)}await C(I.name),v({serverName:I.name,text:P??t("mcp.action.done",{action:A.label})})}catch(P){v({serverName:I.name,text:A.id==="authenticate"?DC(I.name,t,Cz(P)):t("mcp.action.failed",{error:Cz(P)})})}finally{x(null)}}},[b,n,C,t]),_=m.useCallback(I=>{h(A=>A.has(I)?new Set:new Set([I])),p(new Set),y(new Set)},[]),L=m.useCallback((I,A)=>{const P=Tz(I,A);p(B=>B.has(P)?new Set:new Set([P]))},[]),M=m.useCallback((I,A)=>{const P=Ez(I,A);y(B=>B.has(P)?new Set:new Set([P]))},[]);return u.jsxs("div",{className:Mt.layout,"data-keyboard-scope":!0,children:[k>0?u.jsxs("div",{className:Mt.notice,children:[t("mcp.starting",{count:k}),u.jsx("div",{className:Mt.muted,children:t("mcp.startingNote")})]}):null,c.length===0?u.jsx("div",{className:Mt.empty,children:t("mcp.empty")}):u.jsx("div",{className:Mt.list,children:T.map(I=>u.jsxs("div",{className:Mt.group,children:[I.label!==t("mcp.extensionMcp")?u.jsx("div",{className:Mt.groupTitle,children:I.label}):null,I.items.map(({server:A,tools:P,resources:B})=>{var G;const F=Ipt(A,t),O=d.has(A.name),X=Dpt(A,t),z=((G=i[A.name])==null?void 0:G.tools.length)??0,U=A.resourceCount??0,D=A.promptCount??0;return u.jsx("div",{className:Mt.server,children:u.jsxs("div",{className:`${Mt.serverCard} ${O?Mt.serverCardExpanded:""}`,children:[u.jsxs("button",{type:"button",className:`${Mt.row} ${Mt.serverRow} ${O?Mt.expandedRow:""}`,onClick:()=>_(A.name),"aria-label":t(O?"mcp.collapse":"mcp.expand"),children:[u.jsxs("span",{className:Mt.rowMain,children:[u.jsx("span",{className:Mt.rowIcon,"aria-hidden":"true"}),u.jsx("span",{className:`${Mt.name} ${Mt.serverName}`,children:A.name})]}),u.jsx("span",{className:`${Mt.status} ${F.className}`,children:F.text}),u.jsx("span",{className:`${Mt.badge} ${Mt.toolCount}`,children:t(z===1?"mcp.toolCount":"mcp.toolsCount",{count:z})}),U>0?u.jsx("span",{className:`${Mt.badge} ${Mt.resourceCount}`,children:t("mcp.resourceCount",{count:U})}):null,D>0?u.jsx("span",{className:`${Mt.badge} ${Mt.promptCount}`,children:t("mcp.promptCount",{count:D})}):null,u.jsx("span",{className:Mt.chevronCell,"aria-hidden":"true",children:u.jsx(OC,{expanded:O})})]}),O?u.jsxs("div",{className:Mt.serverDetail,children:[X.length>0?u.jsx("div",{className:Mt.serverDetailHeader,children:u.jsx("div",{className:Mt.serverActions,children:X.map(q=>u.jsx("button",{type:"button",className:Mt.button,onClick:()=>void S(A,q),disabled:b!==null,children:q.label},q.id))})}):null,(w==null?void 0:w.serverName)===A.name?u.jsx("pre",{className:Mt.message,children:w.text}):null,P.length===0?u.jsx("div",{className:Mt.emptyTools,children:t("mcp.emptyTools")}):u.jsx("div",{className:Mt.tools,children:P.map(q=>{const N=Tz(A.name,q.name),ee=f.has(N);return u.jsxs("div",{className:Mt.tool,children:[u.jsxs("button",{type:"button",className:`${Mt.row} ${Mt.toolRow} ${ee?Mt.expandedRow:""} ${q.isValid?"":Mt.disabled}`,onClick:()=>L(A.name,q.name),children:[u.jsx("span",{className:Mt.rowIcon,"aria-hidden":"true"}),u.jsx("span",{className:Mt.name,children:q.name}),u.jsx(OC,{expanded:ee})]}),ee?u.jsx(Ppt,{tool:q,t}):null]},q.name)})}),U>0?u.jsxs("div",{className:Mt.resources,children:[u.jsx("div",{className:Mt.sectionTitle,children:t("mcp.resources")}),B.length===0?u.jsx("div",{className:Mt.emptyTools,children:t("mcp.resourcesUnavailable")}):null,B.map(q=>{const N=Ez(A.name,q.uri),ee=g.has(N),re=q.title||q.name||"";return u.jsxs("div",{className:Mt.tool,children:[u.jsxs("button",{type:"button",className:`${Mt.row} ${Mt.toolRow} ${ee?Mt.expandedRow:""}`,onClick:()=>M(A.name,q.uri),children:[u.jsx("span",{className:Mt.rowIcon,"aria-hidden":"true"}),u.jsx("span",{className:`${Mt.name} ${Mt.resourceUri}`,children:q.uri}),re&&re!==q.uri?u.jsx("span",{className:Mt.resourceLabel,children:re}):null,u.jsx(OC,{expanded:ee})]}),ee?u.jsx(Bpt,{resource:q,t}):null]},q.uri)})]}):null]}):null]})},A.name)})]},I.label))})]})}function zpt({catchingUp:e,pendingApproval:t,isPreparingPrompt:n}){return!!(e||t||n)}function Sne({catchingUp:e,isPreparingPrompt:t,isStreaming:n}){return e?"loading":t||n?"processing":"idle"}function Fpt(e){switch(Sne(e)){case"loading":return"common.loading";case"processing":return"editor.processing";case"idle":return"editor.placeholder"}}function qpt({connectionStatus:e}){return e==="disconnected"||e==="error"}const dm=m.createContext(!1),qM=m.createContext(new Map),Cne=m.createContext(new Map);function Hpt({timeline:e,details:t,children:n}){return u.jsx(qM.Provider,{value:e,children:u.jsx(Cne.Provider,{value:t,children:n})})}const e1=f_,PC=760,ap=320,Xw=500,Upt=20,Vpt=3e4;function Az(e){return(e.skills??[]).filter(t=>t.status==="ok").map(t=>({name:t.name,description:t.description??""})).sort((t,n)=>t.name.localeCompare(n.name))}const Wpt="ui.compactMode",Gpt="ui.hideTips",Kpt={main:"model.select",fast:"model.setFast",voice:"model.setVoice",vision:"model.setVision"};function BC(e){return e.trim().replace(/^\/+/,"").toLowerCase()}const Tne=new Set(["clear","stop","off","reset","none","cancel"]);function Ypt(e){const t=e.replace(/^\/goal\b/i,"").trim().toLowerCase();return Tne.has(t)}function Xpt(e){const t=e;return t.source!=="goal"?null:C2(t.data)??C2(t.text)}function Qpt(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.kind!=="status")continue;const s=Xpt(n);if(s)return s.kind==="set"||s.kind==="checking"?{condition:s.condition,setAt:s.setAt??n.serverTimestamp??n.createdAt}:null}return null}const Mz={insertText:()=>{},setText:()=>{},addTags:()=>{},removeTag:()=>{},clear:()=>{},submit:()=>{}},Jpt=[],Ene=1e3,Nz=6,Iz=40,Ane="qwen-code-web-shell-chat-width",Zpt=40,Mne="qwen-code-web-shell-sidebar-collapsed";function e0t(e){return e===!0?{enabled:!0,defaultCollapsed:!1,showCompactToggle:!0}:e?{enabled:e.enabled??!0,defaultCollapsed:e.defaultCollapsed??!1,showCompactToggle:e.showCompactToggle??!0,branding:e.branding,footer:e.footer}:{enabled:!1,defaultCollapsed:!1,showCompactToggle:!0}}function t0t(e){if(typeof window>"u")return e;try{const t=window.localStorage.getItem(Mne);if(t==="true")return!0;if(t==="false")return!1}catch{}return e}function n0t(e){try{window.localStorage.setItem(Mne,String(e))}catch{}}function Hx(){return`${Ene}`}function s0t(){if(typeof window>"u")return Hx();try{return window.localStorage.getItem(Ane)==="wide"?"wide":Hx()}catch{return Hx()}}function r0t(e){try{window.localStorage.setItem(Ane,e)}catch{}}function Nne(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:Ene}function i0t(e,t){const n=`${Nne(t)}px`,s=`calc(${n} + ${Zpt}px)`;return{"--chat-regular-content-width":n,"--chat-regular-shell-width":s,"--chat-content-width":e==="wide"?"100%":n,"--chat-shell-width":e==="wide"?"100%":s}}function Rz(e,t){if(e){if(typeof e=="function"){e(t);return}e.current=t}}function jz(e,t){if(e){if(typeof e=="function"){e(t);return}e.current=t}}function o0t(e,t){return e.length===t.length&&e.every((n,s)=>n===t[s])}function a0t(){if(typeof window>"u")return"en";const e=new URLSearchParams(window.location.search);return Tu(e.get("language")??e.get("lang")??navigator.language)}function l0t(e,t){return e instanceof Error?e.message:t}function $C(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function lp(e){return typeof e=="object"&&e!==null&&e._alreadyDispatched===!0}function c0t(e){return e.category==="validation"||e.category==="user_action"||e.category==="system"}function u0t(e){return e.severity==="warning"?"warning":e.severity==="info"?"info":"error"}function zC(e){return typeof e=="object"&&e!==null}function d0t(e){if(!zC(e))return null;const t=e._meta;if(!zC(t))return null;const n=t.qwenModelSwitch;if(!zC(n))return null;const s=n.authType,r=n.modelId,i=n.baseUrl,o=n.apiKey;return typeof s!="string"||typeof r!="string"||typeof i!="string"||typeof o!="string"?null:{authType:s,modelId:r,baseUrl:i,apiKey:o,...typeof n.isRuntime=="boolean"?{isRuntime:n.isRuntime}:{}}}function h0t(e,t){return t("model.usingModel",{isRuntime:e.isRuntime?1:0,modelId:e.modelId})}function f0t(e){return e.toolKind==="edit"}function m0t(e){const t=e.trim().replace(/[\r\n]+/g," ");return t?t==="--"?{type:"manual",displayName:""}:t.startsWith("-- ")?{type:"manual",displayName:t.slice(3).trim()}:t.toLowerCase()==="--auto"?{type:"auto"}:t.startsWith("--")?{type:"delegate"}:{type:"manual",displayName:t}:{type:"auto"}}function p0t(e){var n;if(((n=e.args)==null?void 0:n.is_background)!==!0)return!1;const t=e.toolName.toLowerCase();return t==="shell"||t==="bash"||t==="run_shell_command"||t==="exec"}function g0t(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const s of n.tools)(EU(s)||p0t(s))&&t.push(`${s.callId}:${s.status}`);return t.join("|")}function y0t(e){const t={id:e.id,label:e.label,description:e.description,runtimeMs:e.runtimeMs,startTime:e.startTime,endTime:e.endTime,error:e.error};switch(e.kind){case"agent":return{...t,kind:"agent",status:e.status,subagentType:e.subagentType,isBackgrounded:e.isBackgrounded,prompt:e.prompt};case"shell":return{...t,kind:"shell",status:e.status,command:e.command,cwd:e.cwd,pid:e.pid,exitCode:e.exitCode};case"monitor":return{...t,kind:"monitor",status:e.status,command:e.command,pid:e.pid,exitCode:e.exitCode};default:return e}}function b0t(e,t){return e===xi.NO_OUTPUT?t("copy.noOutput"):e===xi.NO_TEXT?t("copy.noText"):e===xi.CODE_MISSING?t("copy.codeMissing"):e===xi.LATEX_MISSING?t("copy.latexMissing"):e===xi.INLINE_LATEX_MISSING?t("copy.inlineLatexMissing"):e===xi.OUTPUT_COPIED?t("copy.outputCopied"):e.startsWith(xi.CLIPBOARD_PREFIX)?`${t("copy.failedFallback")}. ${e.slice(xi.CLIPBOARD_PREFIX.length)}`:e.endsWith(xi.COPIED_SUFFIX)?t("copy.toClipboard",{label:e.slice(0,-xi.COPIED_SUFFIX.length)}):e}function Qw(e,t,n){const s=e.find(r=>r.key===n);if(s)return t==="user"?s.values.user:s.values.workspace}function v0t({onSessionIdChange:e,onSessionCreated:t,theme:n,onThemeChange:s,language:r,onLanguageChange:i,className:o,style:a,onConnectionChange:l,onStreamingStateChange:c,onError:d,onBugReport:h,hiddenSlashCommands:f,slashCommandCategoryOrder:p,builtinAtProviders:g,atProviders:y,composerTagIcons:w,renderToolHeaderExtra:v,renderWelcomeHeader:b,renderWelcomeFooter:x,mobileWelcomeFooterMiddle:k=!1,parseUserMessageContent:T,renderUserMessageContent:C,renderComposerTag:S,renderComposerTagTooltip:_,onComposerTagClick:L,renderAssistantTurnFooter:M,renderComposerToolbarStart:I,renderComposerToolbarEnd:A,renderComposerToolbarRight:P,renderComposerHeader:B,renderFooter:F,bottomStatusItems:O,chatMaxWidth:X,sidebar:z,splitSessionIds:U,onSplitSessionIdsChange:D,onRightPanelOpen:G,messageTurnOutputs:q,shellRef:N,composerToolbarActions:ee,composerPlaceholders:re,compactThinking:Q=!1,collapseCompletedTurns:K=!0,markdownTableMode:se="basic",virtualScrollThreshold:te,markdown:ce,loadingPhrases:oe,onTranscriptChange:de,onToast:Te,composerRef:qe,onComposerReady:Ne,composerInput:ge,composerInputVersion:Ee,onSessionChange:_t,onSubmitBefore:Ct}={}){var YN,XN,QN,JN,ZN;const[Je,at]=m.useState(s0t),[Oe,Fe]=m.useState(()=>r===void 0?a0t():Tu(r)),ue=m.useMemo(()=>VE(Oe),[Oe]),vt=m.useMemo(()=>e0t(z),[z]),[ye,je]=m.useState(()=>t0t(vt.defaultCollapsed)),[Ye,Nt]=m.useState(null),[Rt,rn]=m.useState(!1),on=m.useCallback(()=>{rn(!1)},[]),Bn=W$(),bs=W$("(min-width: 1200px)");m.useEffect(()=>{const R=window.matchMedia("(max-width: 760px)"),H=Z=>{Z.matches||rn(!1)};return R.addEventListener("change",H),()=>R.removeEventListener("change",H)},[]),m.useEffect(()=>{if(!Rt)return;const R=pe=>{if(pe.key!=="Escape"||ct.current)return;const De=pe.target;Yy(De)&&!(De!=null&&De.closest("[data-sidebar-shell]"))||(pe.stopPropagation(),pe.preventDefault(),on())},H=document.body.style.overflow;document.body.style.overflow="hidden";const Z=pe=>{const De=pe.target;De!=null&&De.closest("[data-sidebar-shell]")&&!De.closest(`.${Lt.mobileBackdrop}`)||pe.preventDefault()};return document.addEventListener("touchmove",Z,{passive:!1}),window.addEventListener("keydown",R,!0),()=>{document.body.style.overflow=H,document.removeEventListener("touchmove",Z),window.removeEventListener("keydown",R,!0)}},[Rt,on]);const Ss=m.useCallback(R=>{je(R),n0t(R)},[]),Ie=m.useMemo(()=>({composerTagIcons:w,renderToolHeaderExtra:v,renderWelcomeHeader:b,renderWelcomeFooter:x,parseUserMessageContent:T,renderUserMessageContent:C,renderComposerTag:S,renderComposerTagTooltip:_,onComposerTagClick:L,renderAssistantTurnFooter:M,renderComposerToolbarStart:I,renderComposerToolbarEnd:A,renderComposerToolbarRight:P,renderComposerHeader:B,renderFooter:F,compactThinking:Q,collapseCompletedTurns:K,markdownTableMode:se,markdown:ce,loadingPhrases:oe}),[w,v,b,x,T,C,S,_,L,M,I,A,P,B,F,Q,K,se,ce,oe]),lt=F,ne=B,he=g_(),Ve=bb(),we=Ba(),Bt=Dh(),Et=m.useMemo(()=>{var R;return((R=Bt.capabilities)==null?void 0:R.workspaces)??[]},[(YN=Bt.capabilities)==null?void 0:YN.workspaces]),Tt=H0(),{notices:an,dismissNotice:wt}=Rce(),It=$o(),[Vn,kn]=m.useState(void 0),ln=m.useRef(Vn);ln.current=Vn;const[Wn,Jn]=m.useState(void 0);m.useEffect(()=>{var pe;if(we.sessionId){Jn(void 0);return}const R=(pe=Et.find(De=>De.primary))==null?void 0:pe.cwd,H=Vn??R;if(!H){Jn(void 0);return}let Z=!1;return Jn(void 0),Bt.client.workspaceByCwd(H).workspaceGit().then(De=>{Z||Jn(De.branch??void 0)}).catch(()=>{Z||Jn(void 0)}),()=>{Z=!0}},[we.sessionId,Vn,Et,Bt.client]);const Cs=m.useRef(Te);Cs.current=Te;const fr=m.useRef(0),[Xs,Vs]=m.useState([]),_n=m.useCallback(R=>{Vs(H=>H.filter(Z=>Z.id!==R))},[]),fn=m.useCallback((R,H)=>{if(Cs.current){Cs.current(R,H);return}const Z={id:`web-shell-toast-${Date.now()}-${++fr.current}`,tone:R,message:H};Vs(pe=>[...pe.filter(mt=>mt.tone!==R||mt.message!==H),Z].slice(-4))},[]),qn=Nte(ue),Zn=m.useRef(qn);Zn.current=qn;const[$n,es]=m.useState(null),[ss,Ps]=m.useState(null),jr=m.useRef(1),Ui=m.useRef(1),Bs=m.useRef(null),zr=m.useRef(null),sr=m.useRef(we.sessionId),Qs=m.useRef(void 0),gs=m.useRef(void 0),ts=m.useRef(we.sessionId),mn=m.useMemo(()=>{const R=[$n].filter(Z=>Z!==null);if(R.length===0)return kz(qn);const H=[...qn];for(const Z of R.sort((pe,De)=>pe.anchorIndex-De.anchorIndex)){const pe=Z.anchorAfterId?H.findIndex(mt=>mt.id===Z.anchorAfterId):-1,De=pe>=0?pe+1:Math.min(Z.anchorIndex,H.length);H.splice(De,0,Z.message)}return kz(H)},[qn,$n]),{artifacts:Rn,loading:br,error:Se}=Ite(),[xe,kt]=m.useState([]),[Ot,xt]=m.useState(()=>new Map),[An,Gn]=m.useState([]);m.useEffect(()=>{if(xe.length===0||Rn.length===0)return;const R=new Set(Rn.map(Z=>Z.id)),H=new Set(An.filter(Z=>Z.kind==="artifact"&&Z.workspaceActions).map(Z=>Z.kind==="artifact"?Z.artifactId:""));kt(Z=>{const pe=Z.filter(De=>!R.has(De.id)||H.has(De.id));return pe.length===Z.length?Z:pe})},[Rn,xe.length,An]);const Js=m.useMemo(()=>Array.from(Ot.values()).flatMap(R=>[...R.artifacts]),[Ot]),jn=m.useMemo(()=>{if(xe.length===0&&Js.length===0)return Rn;const R=[...Rn];for(const H of[...xe,...Js])R.findIndex(pe=>pe.id===H.id)<0&&R.push(H);return R},[Rn,xe,Js]),yn=m.useCallback((R,H,Z)=>{xt(De=>{const mt=De.get(R);if((mt==null?void 0:mt.workspaceActions)===Z&&mt.artifacts.length===H.length&&mt.artifacts.every((jt,Ze)=>{const Ke=H[Ze];return(Ke==null?void 0:Ke.id)===jt.id&&Ke.updatedAt===jt.updatedAt&&Ke.sizeBytes===jt.sizeBytes}))return De;const Vt=new Map(De);return H.length===0?Vt.delete(R):Vt.set(R,{artifacts:[...H],workspaceActions:Z}),Vt});const pe=new Set(H.map(De=>De.id));Gn(De=>{let mt=!1;const wn=De.map(Vt=>{if(Vt.kind!=="artifact"||!pe.has(Vt.artifactId))return Vt;const jt={id:Vt.id,kind:"artifact",title:Vt.title,artifactId:Vt.artifactId,workspaceActions:Vt.workspaceActions??Z};return Vt.previewContent!==void 0&&(mt=!0),Vt.workspaceActions||(mt=!0),jt});return mt?wn:De})},[]),Mn=m.useMemo(()=>qte(mn,Rn,we.workspaceCwd||""),[mn,Rn,we.workspaceCwd]),Lr=m.useMemo(()=>Ute(mn,Mn,we.workspaceCwd||""),[mn,Mn,we.workspaceCwd]),ti=m.useMemo(()=>Vte(mn),[mn]),_r=m.useMemo(()=>new Set(q??zQ),[q]),[W,fe]=m.useState(!1),Ae=m.useRef(W);Ae.current=W;const[He,Ge]=m.useState(null),zt=m.useRef(He);zt.current=He;const[dn,hn]=m.useState([]),[ds,Ws]=m.useState(null),[Ms,Ts]=m.useState(PC),Gr=m.useRef(null),ie=m.useRef(null),ve=m.useRef(new Map),Le=m.useRef(we.sessionId);ie.current={open:W,tabs:An,activeTabId:He,reviewChanges:dn,selectedReviewPath:ds,extraArtifacts:xe,width:Ms},m.useEffect(()=>{const R=Le.current;if(R){const pe=ie.current;if(pe&&(ve.current.set(R,pe),ve.current.size>Upt)){const De=ve.current.keys().next().value;De&&ve.current.delete(De)}}const H=we.sessionId;Le.current=H;const Z=H?ve.current.get(H):void 0;if(!Z){fe(!1),Gn([]),Ge(null),hn([]),Ws(null),kt([]),xt(new Map),Ts(PC);return}fe(Z.open),Gn(Z.tabs),Ge(Z.activeTabId),hn(Z.reviewChanges),Ws(Z.selectedReviewPath),kt(Z.extraArtifacts),xt(new Map),Ts(Z.width)},[we.sessionId]);const tt=m.useCallback(()=>{var H;const R=(H=zr.current)==null?void 0:H.getBoundingClientRect().width;return R?Math.max(ap,Ms+R-Xw):Math.max(ap,window.innerWidth-Xw)},[Ms]),cn=m.useCallback(()=>{var Z;const R=((Z=zr.current)==null?void 0:Z.getBoundingClientRect().width)??window.innerWidth,H=Math.max(ap,R-Xw);return Math.min(H,Math.max(PC,Math.round(R*.56)))},[]),en=m.useCallback((R,H)=>{if(!R)return;const Z=jn.find(De=>De.id===R),pe={id:`artifact:${R}`,kind:"artifact",artifactId:R,title:(Z==null?void 0:Z.title)??"Artifact",...H!==void 0?{previewContent:H}:{}};Gn(De=>De.some(mt=>mt.id===pe.id)?De.map(mt=>mt.id===pe.id?{...mt,...pe}:mt):[...De,pe]),Ge(pe.id),Ts(De=>Ae.current?De:cn()),fe(!0)},[jn,cn]),Sn=m.useCallback((R,H)=>{const Z={id:"review",kind:"review",title:ue("turnOutputs.review")};Gn(pe=>pe.some(De=>De.id===Z.id)?pe:[Z,...pe]),Ge(Z.id),hn(R),Ws(H??null),Ts(pe=>Ae.current?pe:cn()),fe(!0)},[cn,ue]),Gs=m.useCallback((R,H)=>{const Z={id:`scheduled-task:${R.toolCallId}`,kind:"scheduled_task",title:ue("scheduledTasks.title"),task:R,...H?{workspaceActions:H}:{}};Gn(pe=>pe.some(De=>De.id===Z.id)?pe.map(De=>De.id===Z.id?Z:De):[...pe,Z]),Ge(Z.id),Ts(pe=>Ae.current?pe:cn()),fe(!0)},[cn,ue]),Xe=m.useCallback(R=>{if(G){G(R);return}if(R.kind==="review"){Sn(R.changes,R.selectedPath);return}if(R.kind==="scheduled_task"){Gs(R.task,R.workspaceActions);return}R.workspaceActions||kt(Z=>{const pe=Z.findIndex(mt=>mt.id===R.artifact.id);if(pe<0)return[...Z,R.artifact];const De=[...Z];return De[pe]=R.artifact,De});const H={id:R.id,kind:"artifact",title:R.title,artifactId:R.artifactId,...R.workspaceActions?{workspaceActions:R.workspaceActions}:{},...R.previewContent!==void 0?{previewContent:R.previewContent}:{}};Gn(Z=>Z.some(pe=>pe.id===H.id)?Z.map(pe=>pe.id===H.id?{...pe,...H}:pe):[...Z,H]),Ge(H.id),Ts(Z=>Ae.current?Z:cn()),fe(!0)},[cn,G,Sn,Gs]),Ft=m.useCallback(()=>{fe(!1),Gn([]),Ge(null),hn([]),Ws(null),kt([]),xt(new Map)},[]);m.useLayoutEffect(()=>{if(!W)return;const R=()=>{Ts(pe=>{var wn;const De=((wn=zr.current)==null?void 0:wn.getBoundingClientRect().width)??window.innerWidth-pe,mt=Math.max(ap,pe+De-Xw);return Math.min(pe,mt)})};R(),window.addEventListener("resize",R);const H=zr.current,Z=new ResizeObserver(R);return H&&Z.observe(H),()=>{window.removeEventListener("resize",R),Z.disconnect()}},[W]);const zn=m.useCallback(R=>{Gn(H=>{const Z=H.filter(pe=>pe.id!==R);if(Z.length===0)return fe(!1),Ge(null),hn([]),Ws(null),kt([]),xt(new Map),Z;if(zt.current===R){const pe=H.findIndex(mt=>mt.id===R),De=Z[Math.min(pe,Z.length-1)]??Z[0];Ge(De.id)}return Z})},[]),gi=m.useCallback(R=>{R.preventDefault();const H=R.currentTarget;H.setPointerCapture(R.pointerId);const Z=R.clientX,pe=Ms,De=tt(),mt=document.body.style.cursor,wn=document.body.style.userSelect;let Vt=pe,jt=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const Ze=()=>{jt=null,Ts(Vt)},Ke=Es=>{Vt=Math.min(De,Math.max(ap,pe-(Es.clientX-Z))),jt===null&&(jt=window.requestAnimationFrame(Ze))};let Cn=()=>{};const Nn=Es=>{Gr.current=null,jt!==null&&(window.cancelAnimationFrame(jt),jt=null),Es&&Ts(Vt),H.hasPointerCapture(R.pointerId)&&H.releasePointerCapture(R.pointerId),document.body.style.cursor=mt,document.body.style.userSelect=wn,window.removeEventListener("pointermove",Ke),window.removeEventListener("pointerup",Cn),window.removeEventListener("pointercancel",Cn)};Cn=()=>Nn(!0),Gr.current=()=>Nn(!1),window.addEventListener("pointermove",Ke),window.addEventListener("pointerup",Cn),window.addEventListener("pointercancel",Cn)},[Ms,tt]);m.useEffect(()=>()=>{var R;return(R=Gr.current)==null?void 0:R.call(Gr)},[]);const Us=dmt(Ve),ni=m.useMemo(()=>SU(Us),[Us]),rs=gmt(ni),Fr=!(we.catchingUp&&Ye!==null),qa=g7(rs)&&Fr?rs:null,Pe=rs&&!g7(rs)&&Fr?rs:null,ct=m.useRef(rs);ct.current=Fr?rs:null;const pt=Pe!==null||qa!==null,gn=m.useMemo(()=>NRe(qn),[qn]),pn=m.useRef(null),Ln=m.useMemo(()=>{const R=RRe(qn),H=pn.current;if(H&&H.signature===R)return H.timeline;const Z=IRe(qn);return pn.current={signature:R,timeline:Z},Z},[qn]),is=m.useRef(null),Sr=m.useMemo(()=>{const R=jRe(qn),H=is.current;if(H&&H.signature===R)return H.details;const Z=$Re(qn);return is.current={signature:R,details:Z},Z},[qn]),si=ymt(gn.todos,R=>`${R.id}:${R.status}:${R.content}`),ri=gn.allCompleted,[Ha,Fo]=m.useState("hidden"),Ua=we.catchingUp||si.length===0||ri?"hidden":"active";Ua!==Ha&&Fo(Ua);const lo=Ua!=="hidden",ca=O??Jpt,Va=lo||ca.length>0,Wa=m.useRef(null),Yc=m.useRef(null),[ua,rd]=m.useState(null),id=m.useRef(new Set),Am=m.useRef(null),[ii,Xc]=m.useState(0),[Hb,ql]=m.useState(0);m.useLayoutEffect(()=>{if(!Va){Xc(0),ql(0);return}const R=Am.current;if(!R){Xc(Iz),ql(0);return}const H=()=>{const pe=Wa.current,De=R.getBoundingClientRect(),mt=pe==null?void 0:pe.getBoundingClientRect(),wn=Math.ceil(De.height),Vt=mt?Math.max(0,mt.top-De.top):wn+Nz;ql(wn),Xc(Math.max(Iz,Math.ceil(Vt)))};if(H(),typeof ResizeObserver>"u")return;const Z=new ResizeObserver(H);return Z.observe(R),Wa.current&&Z.observe(Wa.current),()=>Z.disconnect()},[Va]);const Hl=m.useMemo(()=>({"--web-shell-bottom-panel-inset":`${ii}px`,"--web-shell-bottom-panel-height":`${Hb}px`,"--web-shell-bottom-panel-gap":`${Nz}px`}),[Hb,ii]),Ub=m.useMemo(()=>g0t(qn),[qn]),[z4,F4]=m.useState(0),Wh=mmt(Ub,we.status==="connected",z4),ug=m.useMemo(()=>F?Wh.map(y0t):[],[Wh,F]),Vb=m.useRef(null),Gh=m.useRef(null),Ni=m.useRef(null),Mm=m.useRef(null),[dg,Wb]=m.useState(!1),Gb=m.useRef(null),Kb=m.useRef(!1),yi=m.useCallback((R="smooth")=>{requestAnimationFrame(()=>{var H;(H=Gh.current)==null||H.scrollToBottom(R),requestAnimationFrame(()=>{var Z;(Z=Gh.current)==null||Z.scrollToBottom(R)})})},[]),q4=m.useCallback(R=>{Ni.current=R,Rz(qe,R??Mz),R&&Mm.current!==R&&(Mm.current=R,Ne==null||Ne(R))},[qe,Ne]);m.useEffect(()=>{Rz(qe,Ni.current??Mz)},[qe]);const[Nm,Qc]=m.useState(null),[Yb,hg]=m.useState(!1),Im=m.useRef(!1),fg=m.useRef(null);fg.current=Nm;const{followupState:Xb,onAcceptFollowup:Qb,onDismissFollowup:Jb,clear:Y}=bU({onAccept:R=>{var H;(H=Ni.current)==null||H.insertText(R)}}),be=y_(),Ce=m.useRef(be),nt=m.useRef(Date.now()),nn=m.useRef(be);nn.current==="idle"&&be!=="idle"&&(nt.current=Date.now()),nn.current=be;const Kn=m.useMemo(()=>{if(be!=="idle"){for(let R=mn.length-1;R>=0;R--){const H=mn[R];if((H==null?void 0:H.role)==="user")return H.timestamp??nt.current}return nt.current}},[mn,be]),vn=m.useRef(""),vs=m.useRef(void 0),Ns=m.useRef(null),Vi=m.useRef(null),[Jc,Wi]=m.useState(!1),od=m.useRef(Jc);od.current=Jc;const qo=we.status==="connected",[ls,Ul]=m.useState([]);m.useEffect(()=>{qo&&It.loadSkillsStatus().then(R=>{Ul(Az(R))}).catch(()=>{})},[qo,It]);const[Kr,Tl]=m.useState(null),HM=m.useRef(Kr),[da,mg]=m.useState("workspace"),[Rm,Zb]=m.useState(!1),UM=m.useRef(Rm),[Lne,VM]=m.useState([]),[pg,jm]=m.useState(!1),[WM,H4]=m.useState(!1),[GM,U4]=m.useState(!1),[KM,V4]=m.useState(!1),[YM,W4]=m.useState(!1),[XM,G4]=m.useState(!1),[QM,K4]=m.useState(!1),[JM,ZM]=m.useState(!1),[Ii,Gi]=m.useState("chat"),[Lm,Y4]=m.useState([]),eN=m.useRef(Lm);eN.current=Lm;const[tN,nN]=m.useState(!1),[X4,Q4]=m.useState(null),[mr,Kh]=m.useState(null),Ga=m.useCallback(()=>Kh(null),[]),Vl=m.useCallback(R=>{Gi("chat"),Kh(R)},[]),J4=m.useCallback(()=>{Kh(null),Gi("scheduledTasks")},[]),Dm=m.useCallback(R=>{Kh(null),Y4(H=>{const Z=Array.from(new Set((R??[]).filter(Boolean))).slice(0,r0);return Z.length>0?Z:H.length>0?H:we.sessionId?[we.sessionId]:[]}),Gi("split")},[we.sessionId]),Z4=m.useMemo(()=>Array.from(new Set((U??[]).filter(Boolean))).slice(0,r0).join("\0"),[U]),ha=U!==void 0,Wl=m.useRef(D);Wl.current=D;const sN=m.useCallback(()=>{var H;if(!ha){Dm();return}const R=Lm.length>0?Lm:we.sessionId?[we.sessionId]:[];(H=Wl.current)==null||H.call(Wl,R)},[we.sessionId,ha,Dm,Lm]),rN=m.useMemo(()=>({openSplitView:()=>sN(),openSessionOverview:()=>Vl("sessions")}),[Vl,sN]);m.useEffect(()=>{jz(N,rN)},[rN,N]),m.useEffect(()=>()=>{jz(N,null)},[N]),m.useEffect(()=>{if(!ha)return;const R=Z4?Z4.split("\0"):[];Y4(H=>o0t(H,R)?H:R),R.length>0?(Kh(H=>H===null?H:null),Gi(H=>H==="split"?H:"split")):Gi(H=>H==="split"?"chat":H)},[ha,Z4]);const Dne=m.useCallback(R=>{var H;ha||Y4(R),(H=Wl.current)==null||H.call(Wl,R)},[ha]),ev=m.useCallback(()=>{var R;ha&&((R=Wl.current)==null||R.call(Wl,[]))},[ha]),One=m.useCallback(()=>{ev(),Vl("sessions")},[ev,Vl]);m.useEffect(()=>{const R=itt(window.location.search);if(R.length===0)return;const H=new URL(window.location.href);H.searchParams.delete("split"),window.history.replaceState(null,"",H),ha||Dm(R)},[ha,Dm]);const eS=m.useRef(!1),tS=m.useRef(!1);m.useEffect(()=>{if(Bn){tS.current&&(tS.current=!1,!ha&&eN.current.length>0&&Gi(R=>R==="chat"?"split":R));return}mr==="sessions"&&Kh(null),Ii==="split"&&(ev(),Gi("chat"),eS.current=!0,ha||(tS.current=!0))},[Bn,mr,Ii,ev,ha]),m.useEffect(()=>{var R;Ii!=="chat"||!eS.current||(eS.current=!1,!mr&&!pt&&((R=Ni.current)==null||R.focus()))},[Ii,mr,pt]);const iN=m.useRef(null),oN=m.useRef(mr),aN=m.useRef(pt);m.useEffect(()=>{var Z,pe,De;const R=oN.current,H=aN.current;oN.current=mr,aN.current=pt,mr?(Z=iN.current)==null||Z.focus():R?pt||(pe=Ni.current)==null||pe.focus():H&&!pt&&((De=Ni.current)==null||De.focus())},[mr,pt]),m.useEffect(()=>{pt&&(mr&&Kh(null),Kr&&Tl(null),pg&&jm(!1),Ii==="scheduledTasks"&&Gi("chat"))},[pt,mr,Kr,pg,Ii]);const nS=m.useRef(null),tv=Pe!==null&&!mr&&Kr===null&&!pg&&Ii==="chat",lN=m.useRef(tv);m.useEffect(()=>{var H;const R=lN.current;lN.current=tv,tv&&!R&&((H=nS.current)==null||H.focus())},[tv]);const[cN,uN]=m.useState(!1),[Yh,sS]=m.useState(!1),dN=m.useRef(Yh),[Pne,Bne]=m.useState(0),[$ne,zne]=m.useState(0),[Fne,hN]=m.useState(0),qne=m.useCallback(()=>{let R=!1;return hN(H=>H+1),()=>{R||(R=!0,hN(H=>Math.max(0,H-1)))}},[]),ko=Yu(),fN=m.useRef((ko==null?void 0:ko.extensionsVersion)??0);m.useEffect(()=>{const R=(ko==null?void 0:ko.extensionsVersion)??0;if(R!==fN.current){fN.current=R;const H=ko==null?void 0:ko.lastExtensionChange;if((H==null?void 0:H.status)==="failed"){he.dispatch([{type:"error",text:ue("extensions.action.failed",{name:H.name??"",source:H.source??"",error:H.error??ue("error.unknown")})}]);return}if((H==null?void 0:H.status)==="installed"){const Z=H.name??H.source??ue("extensions.label");he.dispatch([{type:"status",text:H.version?ue("extensions.install.installedWithVersion",{name:Z,version:H.version}):ue("extensions.install.installed",{name:Z})}])}else if(H!=null&&H.status){const Z=H.name??H.source??ue("extensions.label"),pe=H.status==="updated"&&H.version?"extensions.manage.updatedWithVersion":`extensions.manage.${H.status}`;he.dispatch([{type:"status",text:ue(pe,{name:Z,version:H.version??""})}])}Tt.refreshCommands().catch(()=>{he.dispatch([{type:"error",text:ue("extensions.commands.refreshFailed")}])})}},[ko==null?void 0:ko.extensionsVersion,ko==null?void 0:ko.lastExtensionChange,Tt,he,ue]);const[Hne,Une]=m.useState("workspace"),[gg,rS]=m.useState(null),[Vne,mN]=m.useState(!1),[Wne,pN]=m.useState(!1),nv=m.useRef(null),Om=m.useRef(null),[iS,sv]=m.useState(null),[Xh,oS]=m.useState(n??gr.Dark),[ad,gN]=m.useState(""),rv=m.useRef(ad);rv.current=ad;const Pm=m.useCallback(R=>{rv.current=R,gN(R)},[]),Zs=m.useRef(we);Zs.current=we;const Ri=m.useCallback(()=>Zs.current.sessionId?!0:(fn("info",ue("localCommand.noSession")),!1),[fn,ue]),yN=we.displayName,[Ka,aS]=m.useState("default"),lS=m.useRef(Ka);lS.current=Ka;const yg=m.useCallback(R=>{lS.current=R,aS(R)},[]),[cS,Qh]=m.useState(!1),bg=m.useRef(null),uS=m.useRef(null),bN=m.useRef(t);bN.current=t;const vN=m.useCallback(()=>{const R=Zs.current.sessionId;if(bg.current)return!R||R===uS.current?bg.current:Promise.resolve();if(R)return Promise.resolve();const H=(async()=>{var wn;const pe=rv.current||Zs.current.currentModel,De=lS.current||Zs.current.currentMode,mt=(wn=Et.find(Vt=>Vt.primary))==null?void 0:wn.cwd;await Ant({sessionActions:Tt,modelId:pe,modeId:De,workspaceCwd:ln.current??mt,onSessionCreated:bN.current,onSessionAllocated:Vt=>{uS.current=Vt},getCurrentSessionId:()=>Zs.current.sessionId}),kn(void 0)})();bg.current=H;const Z=()=>{bg.current===H&&(bg.current=null,uS.current=null)};return H.then(Z,Z),H},[Tt,Et]),Zc=m.useRef(Ct);Zc.current=Ct;const[wN,xN]=m.useState(0),vg=m.useRef(null);m.useEffect(()=>()=>{vg.current!==null&&clearTimeout(vg.current)},[]);const kN=m.useCallback(R=>{_t==null||_t(R),xN(H=>H+1)},[_t]),co=m.useRef(kN);co.current=kN;const Ho=m.useCallback(async(R,H,Z)=>{var Nn,Es;const pe=!R.trimStart().startsWith("/"),De=vn.current,mt=vs.current,wn=Vi.current,Vt=od.current;!(Z!=null&&Z.retry)&&pe&&(vn.current=R,vs.current=H,Vi.current=null),Wi(!1);const jt=!Zs.current.sessionId;if(Zc.current){Qh(!0);try{await Zc.current({sessionId:Zs.current.sessionId,prompt:R})}catch(Cr){console.warn("[web-shell] onSubmitBefore rejected, prompt cancelled",Cr),Qh(!1),vn.current=De,vs.current=mt,Vi.current=wn,Wi(Vt);return}jt||Qh(!1)}!Zc.current&&jt&&Qh(!0),Y();try{await vN()}finally{jt&&Qh(!1)}const Ze={images:H,inputAnnotations:Z==null?void 0:Z.inputAnnotations,optimisticUserMessage:Z==null?void 0:Z.optimisticUserMessage,retry:Z==null?void 0:Z.retry,...Z!=null&&Z.onAdmitted?{onAdmitted:Z.onAdmitted}:{}};Z!=null&&Z.commitComposerAccepted?Z.commitComposerAccepted():Z!=null&&Z.clearComposerOnPromptStart&&((Nn=Ni.current)==null||Nn.clear());const Ke=Zs.current.sessionId;return Ke&&R.trim()&&((Es=co.current)==null||Es.call(co,{type:"submit",sessionId:Ke,prompt:R,queued:!1}),vg.current!==null&&clearTimeout(vg.current),vg.current=setTimeout(()=>{xN(Cr=>Cr+1)},2e3)),await Tt.sendPrompt(R,Ze)},[Y,vN,Tt]),Gne=m.useMemo(()=>(we.models??[]).filter(k1).map(R=>({id:R.id,label:Lf(R.label||R.id)})),[we.models]),eu=WM||GM||KM||YM||XM||QM||JM||tN||Kr!==null||pg||iS!==null||X4!==null||gg!==null||cN||Yh||Fne>0||mr!==null||Ii!=="chat",Xt=m.useCallback((R,H)=>{if($C(R)||$H(R)||lp(R))return;const Z=l0t(R,H);console.error("[web-shell]",Z,R),fn("error",Z)},[fn]),Kne=m.useCallback(R=>fn("success",R),[fn]),{queuedPrompts:Yne,queuedTexts:Xne,enqueuePrompt:dS,removeQueuedPrompt:Qne,insertQueuedPrompt:Jne,editQueuedPrompt:Zne,editLastQueuedPrompt:ese,clearQueuedPrompts:tse}=jte({connected:qo,sessionId:we.sessionId,clientId:we.clientId,streamingState:be,sessionActions:Tt,store:he,editorRef:Ni,reportError:Xt,notifySuccess:Kne,t:ue}),Jh=m.useCallback((R,H,Z,pe,De)=>{var Vt;if(Zc.current)return Zc.current({sessionId:Zs.current.sessionId,prompt:R}).then(()=>{var Ke,Cn;dS(R,H,Z,De)!==!1&&(pe?pe():(Ke=Ni.current)==null||Ke.clear());const Ze=Zs.current.sessionId;Ze&&R.trim()&&((Cn=co.current)==null||Cn.call(co,{type:"submit",sessionId:Ze,prompt:R,queued:!0}))}).catch(jt=>{console.warn("[web-shell] onSubmitBefore rejected queued prompt, cancelled",jt)}),!1;const mt=dS(R,H,Z,De),wn=Zs.current.sessionId;return wn&&R.trim()&&((Vt=co.current)==null||Vt.call(co,{type:"submit",sessionId:wn,prompt:R,queued:!0})),mt},[dS]);m.useEffect(()=>{for(const R of an)c0t(R)?fn(u0t(R),R.message):R.category!=="lifecycle"&&console.warn("[web-shell] daemon notice",R),wt(R.id)},[wt,an,fn]);const hS=m.useRef(h);hS.current=h,m.useEffect(()=>{var R;sr.current=we.sessionId,(R=Bs.current)==null||R.abort(),Bs.current=null,es(null),Ps(null),sv(null),uv.current=0},[we.sessionId]);const _N=m.useCallback(()=>{var De;if(!Ri())return;const R=`local-recap-${jr.current++}`,H=qn.length,Z=(De=qn.at(-1))==null?void 0:De.id,pe=we.sessionId;es({anchorAfterId:Z,anchorIndex:H,message:{id:R,role:"system",content:`※ ${ue("recap.label")}: ${ue("recap.loading")}`,variant:"info",source:"recap"}}),Tt.recapSession().then(mt=>{sr.current===pe&&es({anchorAfterId:Z,anchorIndex:H,message:{id:R,role:"system",content:mt.recap?`※ ${ue("recap.label")}: ${mt.recap}`:ue("recap.empty"),variant:"info",source:"recap"}})},mt=>{sr.current===pe&&(es(null),!$C(mt)&&!lp(mt)&&console.warn("[web-shell] unhandled recap failure",mt))})},[we.sessionId,qn,Ri,Tt,ue]),SN=m.useCallback(R=>{var mt;const H=R.trim();if(!H){fn("error",ue("btw.empty"));return}if(!Ri())return;const Z=`local-btw-${Ui.current++}`,pe=we.sessionId;(mt=Bs.current)==null||mt.abort();const De=new AbortController;Bs.current=De,Ps({id:Z,role:"btw",question:H,answer:"",isPending:!0}),Tt.btwSession(H,{signal:De.signal}).then(wn=>{sr.current===pe&&Bs.current===De&&(Bs.current=null,Ps({id:Z,role:"btw",question:H,answer:wn.answer||ue("btw.emptyAnswer"),isPending:!1}))},wn=>{sr.current===pe&&Bs.current===De&&(Bs.current=null,Ps(null),!$C(wn)&&!lp(wn)&&console.warn("[web-shell] unhandled btw failure",wn))})},[we.sessionId,fn,Ri,Tt,ue]),CN=m.useCallback(()=>{var R;(R=Bs.current)==null||R.abort(),Bs.current=null,Ps(null)},[]);m.useEffect(()=>{const R=H=>{var wn;if(eu||rs)return;const Z=ss;if(!Z||Z.role!=="btw")return;const pe=H.key.toLowerCase(),De=H.key==="Escape"&&!H.ctrlKey&&!H.metaKey&&!H.altKey&&!H.shiftKey,mt=H.ctrlKey&&!H.metaKey&&!H.altKey&&!H.shiftKey&&(pe==="c"||pe==="d");if(Z.isPending){if(!De&&!mt)return}else{const Vt=((wn=Ni.current)==null?void 0:wn.hasInput())??!1;if(!(!H.ctrlKey&&!H.metaKey&&!H.altKey&&!H.shiftKey&&(H.key==="Escape"||!Vt&&(H.key==="Enter"||H.key===" "))))return}H.preventDefault(),H.stopPropagation(),CN()};return window.addEventListener("keydown",R,!0),()=>window.removeEventListener("keydown",R,!0)},[eu,ss,CN,rs]);const Gl=m.useCallback((R,H)=>Cnt(Ce.current!=="idle",R,H,{append:Z=>he.appendLocalUserMessage(Z)}),[he]),Kl=m.useCallback(()=>(fn("error",ue("queue.commandBlocked")),!1),[fn,ue]),wg=m.useCallback(R=>{oS(R),s==null||s(R)},[s]),Bm=m.useCallback(R=>{Fe(R),i==null||i(R)},[i]),TN=m.useCallback(()=>{G4(!0)},[]),EN=Fce({autoLoad:!0}),iv=qce({autoLoad:!0}),ov=iv.reload,[nse,av]=m.useState(!1),{settings:ld,setValue:Ya,reload:cd}=EN,$m=ld.find(R=>R.key===Tf),zm=ld.find(R=>R.key===Gpt),Fm=ld.find(R=>R.key===Ek),sse=(()=>{const R=Qw(ld,da,"voiceModel");return typeof R=="string"&&R.trim()?R.trim():void 0})(),rse=(()=>{const R=Qw(ld,da,"visionModel");if(!(typeof R!="string"||!R.trim()))return Lmt(R.trim())})(),ise=(()=>{const R=Qw(ld,da,"fastModel");return typeof R=="string"&&R.trim()?R.trim():void 0})(),ose=m.useMemo(()=>{const R=Qw(ld,da,"modelFallbacks");return typeof R=="string"?R.split(",").map(H=>H.trim()).filter(Boolean):[]},[ld,da]),ase=m.useMemo(()=>{const R=new Set,H=[];for(const Z of(we.models??[]).filter(k1).filter(pe=>!pe.isRuntime)){const pe=Z.baseModelId??Sz(Z.id);R.has(pe)||(R.add(pe),H.push({baseId:pe,label:Lf(Z.label||Z.baseModelId||Z.id)}))}return H},[we.models]),[lv,AN]=m.useState(!1),fS=m.useRef(lv);fS.current=lv,m.useEffect(()=>{if(n){oS(n);return}const R=WE($m==null?void 0:$m.values.effective);R&&oS(R)},[n,$m==null?void 0:$m.values.effective]),m.useEffect(()=>{if(r!==void 0){Fe(Tu(r));return}const R=HE(Fm==null?void 0:Fm.values.effective);R&&Fe(R)},[r,Fm==null?void 0:Fm.values.effective]);const lse=m.useCallback((R,H="user")=>{const Z=Oe,De=`/language ui ${R}${H==="workspace"?" --project":" --global"}`;Bm(R);const mt=()=>Promise.all([Tt.refreshCommands(),cd()]);if(Ce.current!=="idle"){Bm(Z),Kl();return}Ho(De,void 0).then(mt).catch(wn=>{Bm(Z),Xt(wn,"Failed to sync /language command")})},[Kl,Bm,cd,Xt,Ho,Oe,Tt]),MN=m.useCallback(()=>{if(Ce.current!=="idle"){he.dispatch([{type:"status",text:ue("clear.blocked")}]);return}he.reset()},[he,ue]),NN=m.useCallback(()=>{const R=fS.current,H=!fS.current;AN(H),Ya("workspace",Wpt,H).catch(Z=>{AN(R),Xt(Z,ue("compact.saveFailed"))})},[Xt,Ya,ue]),ud=m.useCallback(R=>{if(!U2(R)){Xt(new Error(`Unsupported approval mode: ${R}`),ue("local.approvalMode"));return}if(!Zs.current.sessionId){yg(R);return}Tt.setApprovalMode(R).then(H=>{const Z=H.mode||R;aS(Z);const pe=ct.current;if(!pe)return;if(R==="yolo"||R==="auto-edit"&&f0t(pe)){const mt=pe.options.find(wn=>wn.kind==="allow_once");if(mt){const wn=pe.title||"";he.dispatch([{type:"status",text:ue("mode.autoApproved",{tool:wn})}]),Tt.submitPermission(pe.id,mt.id).catch(Vt=>{Xt(Vt,"Failed to auto-approve tool call")})}}}).catch(H=>{Xt(H,ue("local.approvalMode"))})},[Tt,Xt,he,ue,yg]);m.useEffect(()=>{Ce.current=be},[be]),m.useEffect(()=>{HM.current=Kr,UM.current=Rm,dN.current=Yh},[Kr,Rm,Yh]),m.useEffect(()=>{let R=null;for(let Z=Ve.length-1;Z>=0;Z--){const pe=Ve[Z];if((pe==null?void 0:pe.kind)==="user")break;if((pe==null?void 0:pe.kind)==="error"&&pe.source==="turn_error"){R=pe.id;break}if((pe==null?void 0:pe.kind)!=="debug")break}const H=qo&&R!==null&&R!==Vi.current&&vn.current.length>0;Ns.current=H?R:null,Wi(H)},[Ve,qo]),m.useEffect(()=>{c==null||c(be)},[be,c]);const IN=m.useRef(be),RN=m.useRef(void 0);m.useEffect(()=>{var H;const R=IN.current;if(IN.current=be,be!=="idle"&&(RN.current=Zs.current.sessionId),R!=="idle"&&be==="idle"){const Z=Zs.current.sessionId;if(!Z||Z!==RN.current)return;const pe=Ns.current!=null?new Error(`Turn error (block ${Ns.current})`):void 0;(H=co.current)==null||H.call(co,{type:"turn_complete",sessionId:Z,error:pe})}},[be]),m.useEffect(()=>{l==null||l(we.status)},[we.status,l]),m.useEffect(()=>{de==null||de(Ve)},[Ve,de]),m.useEffect(()=>{if(we.error){const R=new Error(we.error);d==null||d(R)}},[we.error,d]),m.useEffect(()=>{gN(we.currentModel??"")},[we.currentModel,we.sessionId]),m.useEffect(()=>{aS(we.currentMode??"default")},[we.currentMode,we.sessionId]),m.useEffect(()=>{const R=ts.current;if(we.sessionId&&we.sessionId!==R&&Qc(null),ts.current=we.sessionId,!we.sessionId&&we.missingSession){Qs.current=we.sessionId,gs.current=void 0;return}const H=Et.find(pe=>pe.cwd===we.workspaceCwd);if(we.sessionId&&!Bt.capabilities)return;const Z=H&&!H.primary?H.id:void 0;Qs.current===we.sessionId&&gs.current===Z||(Qs.current=we.sessionId,gs.current=Z,e==null||e(we.sessionId,Z))},[we.missingSession,we.sessionId,we.workspaceCwd,e,Bt.capabilities,Et]);const jN=m.useRef(void 0),mS=m.useRef(void 0);m.useEffect(()=>{var Z;const R=we.sessionId,H=we.displayName;if(!(!R||!H)){if(R!==jN.current){jN.current=R,mS.current=H;return}H!==mS.current&&(mS.current=H,(Z=co.current)==null||Z.call(co,{type:"rename",sessionId:R,newName:H}))}},[we.sessionId,we.displayName]),m.useEffect(()=>{const R=Qpt(Ve);Qc(H=>R?(H==null?void 0:H.condition)===R.condition&&H.setAt===R.setAt?H:R:H&&null)},[Ve]),m.useEffect(()=>{const R=H=>{const Z=H.detail;if(!(Z!=null&&Z.active)){Qc(null);return}Z.condition&&Qc({condition:Z.condition,setAt:Z.setAt??Date.now()})};return window.addEventListener(W8,R),()=>window.removeEventListener(W8,R)},[]);const cv=m.useRef(null),uv=m.useRef(0);m.useEffect(()=>{uv.current=0},[we.sessionId]),m.useEffect(()=>{function Z(){if(document.hidden){cv.current===null&&(cv.current=Date.now());return}const pe=cv.current;if(cv.current=null,pe===null||Date.now()-pe<18e4||Ce.current!=="idle"||!we.sessionId)return;const De=he.getSnapshot().blocks.length;De-uv.current<4||(uv.current=De,Tt.recapSession().then(mt=>{mt.recap&&he.dispatch([{type:"status",text:`※ ${ue("recap.label")}: ${mt.recap}`,source:"recap"}])},mt=>{console.error("[auto-recap] failed:",mt)}))}return document.addEventListener("visibilitychange",Z),()=>document.removeEventListener("visibilitychange",Z)},[we.sessionId,Tt,he,ue]);const pS=m.useCallback(()=>{const R=U2(Ka)?e1.indexOf(Ka):-1,H=e1[(R+1)%e1.length];ud(H)},[Ka,ud]),xg=m.useCallback((R,H)=>{Ri()&&(Gl(R)||Tt.getContextUsage({detail:H}).then(Z=>{he.dispatch([{type:"status",text:kAe(Z)}]),yi("smooth")}).catch(Z=>{Xt(Z,"Failed to load context usage")}))},[Gl,he,Ri,Tt,Xt,yi]),cse=m.useCallback(()=>{xg("/context detail",!0)},[xg]),dv=m.useCallback(R=>{Ri()&&Tt.branchSession(R||void 0).then(H=>{he.dispatch([{type:"status",text:ue("branch.success",{name:H.displayName})}])}).catch(H=>{Xt(H,ue("branch.failed"))})},[Xt,Ri,Tt,he,ue]),use=m.useCallback(()=>{dv()},[dv]),Zh=m.useCallback(async R=>{ln.current=R,kn(R),on(),Ga();try{return await Tt.clearSession(),!0}catch(H){return Xt(H,"Failed to start a new chat"),!1}},[on,Ga,Xt,Tt]),dse=m.useCallback(async()=>{if(!Im.current){Im.current=!0,hg(!0),Gi("chat");try{await Zh()&&(e==null||e(void 0))}finally{Im.current=!1,hg(!1)}}},[Zh,e]),qm=m.useCallback(async(R,H)=>{Nt(R),on(),Ga();try{await Tt.loadSession(R,{workspaceCwd:H})}catch(Z){throw Nt(pe=>pe===R?null:pe),Z}},[on,Ga,Tt]),gS=m.useCallback(R=>{Gi("chat"),qm(R).catch(H=>{Xt(H,"Failed to open session")})},[qm,Xt]);m.useEffect(()=>{const R=H=>{const Z=H.detail;typeof Z=="string"&&Z&&gS(Z)};return window.addEventListener("qwen:open-session",R),()=>window.removeEventListener("qwen:open-session",R)},[gS]),m.useEffect(()=>{Ye!==null&&we.sessionId===Ye&&!we.loadingTranscript&&!we.catchingUp&&Nt(null)},[we.catchingUp,we.loadingTranscript,we.sessionId,Ye]);const ef=m.useRef(null),yS=m.useCallback(R=>{const H=ef.current;H&&H.sessionId===R&&(clearTimeout(H.timer),ef.current=null)},[]),hv=m.useCallback(R=>new Promise((H,Z)=>{let pe=!1;Ho(R,void 0,{onAdmitted:()=>{pe||(pe=!0,H())}}).then(()=>{pe||Z(new Error("Run was cancelled before it started"))},mt=>{pe||Z(mt)})}),[Ho]),fv=m.useCallback(()=>{const R=ef.current,H=Zs.current;!R||H.sessionId!==R.sessionId||H.loadingTranscript||H.catchingUp||(clearTimeout(R.timer),ef.current=null,hv(R.prompt).then(()=>R.resolve(),Z=>R.reject(Z)))},[hv]),hse=m.useCallback((R,H)=>{if(Gi("chat"),!H)return hv(R);const Z=ef.current;return Z&&(clearTimeout(Z.timer),ef.current=null,Z.reject(new Error("superseded by another run"))),new Promise((pe,De)=>{const mt=setTimeout(()=>{yS(H),De(new Error("Timed out switching to the task session"))},Vpt);ef.current={sessionId:H,prompt:R,resolve:pe,reject:De,timer:mt},qm(H).then(()=>fv()).catch(wn=>{yS(H),De(wn)})})},[hv,qm,yS,fv]);m.useEffect(()=>{fv()},[we.sessionId,we.loadingTranscript,we.catchingUp,fv]);const bS=m.useCallback(()=>{Ri()&&Tt.getTasks().then(R=>{sv({snapshot:R})}).catch(R=>{Xt(R,"Failed to load tasks")})},[Xt,Ri,Tt]),LN=m.useCallback((R,H)=>{Qc({condition:R,setAt:H}),he.dispatch([{type:"status",text:sB({kind:"set",condition:R,setAt:H})}])},[he]),DN=m.useCallback(R=>{R&&(he.dispatch([{type:"status",text:sB({kind:"cleared",condition:R.condition,durationMs:Date.now()-R.setAt})}]),Qc(null))},[he]),mv=m.useCallback(R=>Ri()?(he.appendLocalUserMessage(R),Tt.clearGoal().catch(H=>{Xt(H,"Failed to clear /goal")}),!0):!1,[Xt,Ri,Tt,he]),fse=m.useCallback(()=>Tt.getRewindSnapshots(),[Tt]),mse=m.useCallback(R=>Tt.rewindSession(R,{rewindFiles:!1}).then(()=>{}),[Tt]),pse=m.useCallback(R=>{if(lp(R))return;const H=R instanceof Error?R.message:String(R);fn("error",ue("rewind.failed",{reason:H}))},[fn,ue]),ON=m.useCallback((R,H,Z)=>{const pe=R.replace(/^\/goal\b/i,"").trim(),De=pe.toLowerCase(),mt=(Z==null?void 0:Z.sendToDaemon)??!0,wn=()=>{const Vt=!!Zc.current,jt=!Zs.current.sessionId||Vt;return Ho(R,H,{clearComposerOnPromptStart:jt,commitComposerAccepted:Vt?Z==null?void 0:Z.commitComposerAccepted:void 0}).catch(Ze=>{Xt(Ze,"Failed to send /goal command")}),!jt};return pe&&Tne.has(De)?mt?mv(R):(he.appendLocalUserMessage(R),DN(fg.current),!0):pe?mt?wn():(he.appendLocalUserMessage(R),LN(pe,Date.now()),!0):mt?wn():(he.appendLocalUserMessage(R),!0)},[DN,LN,mv,Xt,Ho,he,Zs]),kg=m.useMemo(()=>new Set((f??[]).map(BC).filter(Boolean)),[f]),gse=kg.has("settings"),PN=m.useCallback((R,H,Z,pe)=>{var wn;if(Zs.current.loadingTranscript)return fn("warning",ue("editor.sessionLoading")),!1;if(qpt({connectionStatus:Zs.current.status}))return fn("warning",ue("editor.connectionDisconnected")),!1;const De=Ce.current!=="idle",mt=(Vt,jt,Ze,Ke)=>{const Cn=!!Zc.current,Nn=!Zs.current.sessionId||Cn;return Ho(Vt,jt,{...Ke,clearComposerOnPromptStart:Nn,commitComposerAccepted:Cn?Z:void 0}).catch(Es=>Xt(Es,Ze)),!Nn};if(R.startsWith("/")){const Vt=R.match(/^\/([\w-]+)/);if(Vt){const jt=Vt[1];if(kg.has(BC(jt)))return De?Jh(R,H,void 0,Z,pe==null?void 0:pe.inputAnnotations):mt(R,H,"Failed to send hidden slash command",{inputAnnotations:pe==null?void 0:pe.inputAnnotations});if(jt==="help")return G4(!0),!0;if(jt==="tasks")return bS(),!0;if(jt==="goal")return De?Ypt(R)?mv(R):Kl():ON(R,H,{commitComposerAccepted:Z});if(jt==="theme"){const Ze=R.slice(Vt[0].length).trim().toLowerCase();return Ze==="dark"||Ze==="light"?wg(Ze):Ze?fn("error",ue("error.unsupportedTheme")):K4(!0),!0}if(jt==="language"){const Ze=R.slice(Vt[0].length).trim(),[Ke,Cn]=Ze.split(/\s+/);if(!Ze)return he.dispatch([{type:"status",text:[ue("language.current",{language:UE(Oe)}),ue("language.usage"),ue("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;if((Ke==null?void 0:Ke.toLowerCase())==="ui"){if(!Cn)return he.dispatch([{type:"status",text:[ue("language.set"),"",ue("language.usage"),"",ue("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;const Nn=Cn.toLowerCase();if(!["en","zh","zh-cn","zh_cn"].includes(Nn))return fn("error",ue("language.invalid")),!0;const Cr=Tu(Cn);if(Bm(Cr),!De){const fa=!!Zc.current,Yl=!Zs.current.sessionId||fa;return Ho(`/language ui ${Cr}`,void 0,{clearComposerOnPromptStart:Yl,commitComposerAccepted:fa?Z:void 0}).then(()=>Tt.refreshCommands()).catch(Qa=>{Xt(Qa,"Failed to sync /language command")}),!Yl}return!0}}if(jt==="copy"){const Ze=R.slice(Vt[0].length).trim();return Tmt(Zn.current,Ze).then(Ke=>{he.dispatch([{type:Ke.status==="error"?"error":"status",text:b0t(Ke.message,ue)}])}).catch(Ke=>{Xt(Ke,ue("copy.failedFallback"))}),!0}if(jt==="delete")return U4(!0),!0;if(jt==="release")return V4(!0),!0;if(jt==="rewind")return Ri()?(W4(!0),!0):!1;if(jt==="branch"){if(De)return Kl();const Ze=R.slice(Vt[0].length).trim();return dv(Ze||void 0),!0}if(jt==="fork"){if(De)return Kl();if(!Ri())return!1;const Ze=R.slice(Vt[0].length).trim();return Ze?(Tt.forkSession(Ze).then(Ke=>{if(!Ke.launched){fn("warning",ue("fork.notStarted"));return}F4(Cn=>Cn+1),fn("success",ue("fork.started",{name:Ke.description}))}).catch(Ke=>{const Cn=Ke instanceof Error?Ke.message:String(Ke);Xt(Ke,ue("fork.failed",{reason:Cn}))}),!0):(fn("error",ue("fork.empty")),!0)}if(jt==="auth")return sS(!0),!0;if(jt==="model"){const Ze=R.slice(Vt[0].length).trim();if(Ze==="--fast")return Tl("fast"),!0;if(Ze.startsWith("--fast "))return De?Jh(R,H,void 0,Z,pe==null?void 0:pe.inputAnnotations):mt(R,H,"Failed to send /model --fast",{inputAnnotations:pe==null?void 0:pe.inputAnnotations});if(Ze==="--voice")return Gl(R,H)||It.loadProviders().then(Ke=>{VM(CB(Ke)),Tl("voice")}).catch(Ke=>Xt(Ke,ue("model.setVoice"))),!0;if(Ze.startsWith("--voice ")){const Ke=Ze.replace(/^--voice\s+/,"");return Ya("workspace","voiceModel",Ke).catch(Cn=>Xt(Cn,ue("model.setVoice"))),!0}if(Ze==="--vision")return Tl("vision"),!0;if(Ze.startsWith("--vision ")){const Ke=Ze.replace(/^--vision\s+/,"");return Ya("workspace","visionModel",Ke).catch(Cn=>Xt(Cn,ue("model.setVision"))),!0}if(Ze){if(!Zs.current.sessionId)return Pm(Ze),!0;Tt.setModel(Ze).then(()=>{Pm(Ze)}).catch(Ke=>{Xt(Ke,ue("model.switch"))})}else Tl("main");return!0}if(jt==="plan"){if(De)return Kl();const Ze=R.slice(Vt[0].length).trim();return Zs.current.sessionId?(Ze&&Qh(!0),Tt.setApprovalMode("plan").then(()=>{if(yg("plan"),Ze)return Ho(Ze,H,{clearComposerOnPromptStart:!0,inputAnnotations:pe==null?void 0:pe.inputAnnotations}).catch(Ke=>Xt(Ke,"Failed to send plan prompt"))}).catch(Ke=>{Xt(Ke,ue("mode.plan"))}).finally(()=>{Ze&&Qh(!1)}),!Ze):(yg("plan"),Ze?mt(Ze,H,"Failed to send plan prompt",{inputAnnotations:pe==null?void 0:pe.inputAnnotations}):!0)}if(jt==="approval-mode"){const Ze=R.slice(Vt[0].length).trim();return Ze?ud(Ze):jm(!0),!0}if(jt==="mcp"){const Ze=R.slice(Vt[0].length).trim().toLowerCase();return It.loadMcpStatus().then(async Ke=>{const Cn={},Nn={};await Promise.all(((Ke==null?void 0:Ke.servers)??[]).map(async Es=>{await Promise.all([(async()=>{try{Cn[Es.name]=await It.loadMcpTools(Es.name)}catch{}})(),(async()=>{if(Es.resourceCount)try{Nn[Es.name]=await It.loadMcpResources(Es.name)}catch{}})()])})),Q4({status:Ke,toolsByServer:Cn,resourcesByServer:Nn,showDescriptions:Ze==="desc",showSchema:Ze==="schema",showTips:!Ze})}).catch(Ke=>{Xt(Ke,"Failed to load MCP status")}),!0}if(jt==="skills")return R.slice(Vt[0].length).trim()?De?Jh(R,H,void 0,Z,pe==null?void 0:pe.inputAnnotations):mt(R,H,"Failed to send /skills command",{inputAnnotations:pe==null?void 0:pe.inputAnnotations}):(Gl(R,H)||It.loadSkillsStatus().then(Ke=>{const Cn=Az(Ke);if(Ul(Cn),Cn.length===0)he.dispatch([{type:"status",text:ue("skills.none")}]);else{const Nn=Cn.map(Es=>`- ${Es.name}`).join(`
`);he.dispatch([{type:"status",text:`${ue("skills.available")}

${Nn}`}])}yi("smooth")}).catch(Ke=>{Xt(Ke,"Failed to load skills")}),!0);if(jt==="tools"){const Ze=R.slice(Vt[0].length).trim().toLowerCase();if(Ze==="desc"||Ze==="descriptions")ZM(!0);else{if(Gl(R,H))return!0;It.loadToolsStatus().then(Ke=>{const Cn=(Ke==null?void 0:Ke.tools)??[];if(Cn.length===0)he.dispatch([{type:"status",text:ue("tools.none")}]);else{const Nn=Cn.map(Es=>`- ${Es.displayName||Es.name}`).join(`
`);he.dispatch([{type:"status",text:`${ue("tools.available")}

${Nn}`}])}yi("smooth")}).catch(Ke=>{Xt(Ke,"Failed to load tools")})}return!0}if(jt==="settings")return Vl("settings"),!0;if(jt==="schedule")return J4(),!0;if(jt==="context"){const Ze=R.slice(Vt[0].length).trim().toLowerCase();if(Ze===""||Ze==="detail"||Ze==="-d")return xg(R,Ze==="detail"||Ze==="-d"),!0}if(jt==="memory"){const Ze=R.slice(Vt[0].length).trim().toLowerCase();if(Ze==="refresh")Bne(Ke=>Ke+1);else if(Ze==="add"||Ze.startsWith("add ")){const Ke=Ze.slice(3).trim();Une(Ke==="user"||Ke==="global"?"global":"workspace"),zne(Cn=>Cn+1)}return uN(!0),!0}if(jt==="agents"){const Ze=R.slice(Vt[0].length).trim().toLowerCase();let Ke="menu";return Ze==="create"?Ke="create":Ze==="create user"||Ze==="create global"?Ke="create-user":Ze==="create project"||Ze==="create workspace"?Ke="create-project":Ze==="manage"&&(Ke="manage"),rS(Ke),!0}if(jt==="extensions"){const Ze=R.slice(Vt[0].length).trim(),Ke=(wn=Ze.split(/\s+/)[0])==null?void 0:wn.toLowerCase();if(!Ke||Ke==="manage")return nN(!0),!0;if(Ke==="install"){if(De)return Kl();const Cn=Ze.slice(7).trim().split(/\s+/);let Nn="",Es,Cr,fa,Yl,Qa=null;for(let Ja=0;Ja<Cn.length;Ja++){const _o=Cn[Ja];if(_o)if(_o==="--auto-update")fa=!0;else if(_o==="--pre-release"||_o==="--allow-pre-release")Yl=!0;else if(_o==="--ref"||_o==="--registry"){const tf=Cn[Ja+1];if(!tf||tf.startsWith("--")){Qa=ue("extensions.install.missingOptionValue",{option:_o});break}_o==="--ref"?Es=tf:Cr=tf,Ja+=1}else if(_o.startsWith("--")){Qa=ue("extensions.install.unknownOption",{option:_o});break}else if(!Nn)Nn=_o;else{Qa=ue("extensions.install.usage");break}}if(Qa)return he.appendLocalUserMessage(R),he.dispatch([{type:"error",text:Qa}]),!0;if(!Nn)return he.appendLocalUserMessage(R),he.dispatch([{type:"error",text:ue("extensions.install.usage")}]),!0;const Xl=Zs.current.clientId;return Xl?(he.appendLocalUserMessage(R),he.dispatch([{type:"status",text:ue("extensions.install.started",{source:Nn})}]),It.installExtension({source:Nn,...Es?{ref:Es}:{},...Cr?{registry:Cr}:{},...fa!==void 0?{autoUpdate:fa}:{},...Yl!==void 0?{allowPreRelease:Yl}:{},consent:!0},Xl).then(()=>{}).catch(Ja=>{Xt(Ja,ue("extensions.install.requestFailed"))}),!0):(fn("warning",ue("extensions.install.waitForSession")),!0)}return Gl(R,H)||he.dispatch([{type:"error",text:ue("extensions.install.usage")}]),!0}if(jt==="clear"||jt==="new"||jt==="reset")return Zh(),!0;if(jt==="rename"){const Ze=m0t(R.slice(Vt[0].length));if(Ze.type==="auto"||Ze.type==="delegate")return De?Jh(R,H,void 0,Z,pe==null?void 0:pe.inputAnnotations):mt(R,H,"Failed to send /rename command",{inputAnnotations:pe==null?void 0:pe.inputAnnotations});const Ke=Ze.displayName;return Ke?Ri()?(Tt.renameSession(Ke).then(()=>{he.dispatch([{type:"status",text:ue("rename.success",{name:Ke})}])}).catch(Cn=>{Xt(Cn,"Failed to rename session")}),!0):!1:(fn("error",ue("rename.empty")),!0)}if(jt==="resume"){const Ze=R.slice(Vt[0].length).trim();return Ze?(on(),Ga(),Tt.loadSession(Ze).catch(Ke=>{Xt(Ke,"Failed to load session")})):(on(),H4(!0)),!0}if(jt==="recap")return _N(),!0;if(jt==="btw")return SN(R.slice(Vt[0].length)),!0;if(jt==="stats"){const Ze=R.slice(Vt[0].length).trim().toLowerCase();let Ke="overview";return Ze==="model"?Ke="model":Ze==="tools"&&(Ke="tools"),Ri()?(Gl(R,H)||Tt.getStats().then(Cn=>{he.dispatch([{type:"status",text:d9e(Cn,Ke)}]),yi("smooth")}).catch(()=>{}),!0):!1}if(jt==="status"||jt==="about")return Gl(R,H)||Promise.all([It.loadPreflight().catch(()=>null),It.loadProviders().catch(()=>null),It.loadEnv().catch(()=>null)]).then(([Ze,Ke,Cn])=>{var tf,eI,tI,nI,sI,rI;const Nn=_z(Ze,Cn);let Es=Nn.authSource;!Es&&((tf=Ke==null?void 0:Ke.current)!=null&&tf.authType)&&(Es=Ke.current.authType);const Cr=[];Nn.nodeVersion&&Cr.push(`Node.js v${Nn.nodeVersion}`),Nn.npmVersion&&Cr.push(`npm ${Nn.npmVersion}`);let fa="";Es&&(Es.startsWith("oauth")||Es==="qwen-oauth"?fa="Qwen OAuth":fa=`API Key - ${Es}`);const Yl=`${Nn.platform} ${Nn.arch}`.trim(),Qa=rv.current,Xl=Zs.current,_o={cliVersion:((eI=Xl.capabilities)==null?void 0:eI.qwenCodeVersion)||"",runtime:Cr.join(" / "),platform:Yl,auth:fa,baseUrl:((tI=Ke==null?void 0:Ke.current)==null?void 0:tI.baseUrl)||"",model:Qa||Xl.currentModel||((nI=Ke==null?void 0:Ke.current)==null?void 0:nI.modelId)||"",fastModel:((sI=Ke==null?void 0:Ke.current)==null?void 0:sI.fastModelId)||Qa||Xl.currentModel||((rI=Ke==null?void 0:Ke.current)==null?void 0:rI.modelId)||"",sessionId:Xl.sessionId||"",sandbox:Nn.sandbox,proxy:Nn.proxy,memoryUsage:Nn.memoryUsage};he.dispatch([{type:"status",text:A9e(_o)}]),yi("smooth")}),!0;if(jt==="bug"){const Ze=R.slice(Vt[0].length).trim();return Gl(R,H)||Promise.all([It.loadPreflight().catch(()=>null),It.loadEnv().catch(()=>null)]).then(([Ke,Cn])=>{var fa;const Nn=_z(Ke,Cn),Es=((fa=Zs.current.capabilities)==null?void 0:fa.qwenCodeVersion)||"",Cr={};if(Es&&(Cr.cliVersion=Es),Nn.nodeVersion&&(Cr.nodeVersion=Nn.nodeVersion),Nn.npmVersion&&(Cr.npmVersion=Nn.npmVersion),Nn.platform&&(Cr.platform=Nn.platform),Nn.arch&&(Cr.arch=Nn.arch),Nn.sandbox&&(Cr.sandbox=Nn.sandbox),Nn.memoryUsage&&(Cr.memoryUsage=Nn.memoryUsage),hS.current)hS.current({title:Ze,systemInfo:Cr}),he.dispatch([{type:"status",text:ue("bug.submitted")}]);else{const Yl=Object.entries(Cr).filter(([,Ja])=>Ja).map(([Ja,_o])=>`${Ja}: ${_o}`).join(`
`),Qa=`https://github.com/QwenLM/qwen-code/issues/new?template=bug_report.yml&title=${encodeURIComponent(Ze)}&info=${encodeURIComponent(`
`+Yl+`
`)}`,Xl=window.open(Qa,"_blank");Xl?(Xl.opener=null,he.dispatch([{type:"status",text:ue("bug.submitted")}])):fn("error",ue("bug.popupBlocked"))}}).catch(Ke=>{Xt(Ke,ue("bug.failed"))}),!0}}return De?Jh(R,H,void 0,Z,pe==null?void 0:pe.inputAnnotations):mt(R,H,"Failed to send command",{inputAnnotations:pe==null?void 0:pe.inputAnnotations})}else if(R.startsWith("!")){if(De)return fn("error",ue("queue.shellBlocked")),!1;const Vt=R.slice(1).trim();return!Vt||!Ri()?!1:(Tt.sendShellCommand(Vt).catch(jt=>{Xt(jt,"Failed to execute shell command")}),!0)}else return De?Jh(R,H,void 0,Z,pe==null?void 0:pe.inputAnnotations):mt(R,H,"Failed to send message",{inputAnnotations:pe==null?void 0:pe.inputAnnotations})},[Ho,Tt,he,Jh,Gl,dv,on,Ga,Vl,J4,Zh,mv,ON,wg,ud,Bm,Kl,bS,kg,fn,Xt,_N,SN,Ri,yi,Oe,Pm,yg,Ya,xg,ue,It]),yse=m.useCallback((R,H,Z,pe)=>{const De=PN(R,H,Z,pe);return De!==!1&&yi("smooth"),De},[PN,yi]),BN=m.useCallback((R,H,Z)=>{Tt.submitPermission(R,H,Z).catch(pe=>{Xt(pe,"Failed to submit permission choice")})},[Tt,Xt]),vS=m.useCallback(()=>{Tt.cancel().catch(R=>{Xt(R,"Failed to cancel request")})},[Tt,Xt]),bse=m.useCallback(()=>{var R;return eu?!1:((R=Vb.current)==null?void 0:R.focusTaskPill())??!1},[eu]),vse=m.useCallback(R=>{var H,Z;if(R){(H=Ni.current)==null||H.insertText(R);return}(Z=Ni.current)==null||Z.focus()},[]),wse=m.useCallback(R=>{Wb(R)},[]),wS=m.useCallback(()=>{od.current&&qo&&Ce.current==="idle"&&Ns.current&&vn.current?(Vi.current=Ns.current,Wi(!1),Ho(vn.current,vs.current,{optimisticUserMessage:!1,retry:!0}).catch(R=>Xt(R,"Failed to retry prompt"))):he.dispatch([{type:"status",text:ue("retry.none")}])},[qo,Ho,Xt,he,ue]);m.useEffect(()=>{const R=H=>{if(!eu&&H.ctrlKey&&!H.metaKey&&!H.altKey&&!H.shiftKey){if(H.key==="l"){H.preventDefault(),MN();return}if(H.key==="o"){H.preventDefault(),NN();return}if(H.key==="y"){H.preventDefault(),wS();return}}};return window.addEventListener("keydown",R,!0),()=>window.removeEventListener("keydown",R,!0)},[eu,MN,NN,wS,he,ue]);const dd=m.useCallback(()=>{nv.current=null,mN(!1),pN(!1),Om.current&&(clearTimeout(Om.current),Om.current=null)},[]),$N=m.useRef({streamingState:be,pendingApproval:rs,interactionBlocked:eu,activePanel:mr,closePanel:Ga,handleCancel:vS,handleCycleMode:pS});$N.current={streamingState:be,pendingApproval:rs,interactionBlocked:eu,activePanel:mr,closePanel:Ga,handleCancel:vS,handleCycleMode:pS};const xse=be!=="idle";m.useEffect(()=>{dd()},[xse,dd]),m.useEffect(()=>{const Z=(De,mt)=>{nv.current=De,De==="cancel"?pN(!0):mN(!0),Om.current&&clearTimeout(Om.current),Om.current=setTimeout(dd,mt)},pe=De=>{var Vt,jt;if(De.defaultPrevented||De.isComposing)return;const mt=$N.current;if(De.key==="Escape"&&mt.activePanel){const Ze=De.target;Ze!=null&&Ze.closest("[data-sidebar-shell]")||(De.preventDefault(),mt.closePanel());return}if(De.key!=="Escape"){nv.current!==null&&dd(),De.key==="Tab"&&De.shiftKey&&!mt.interactionBlocked&&(De.preventDefault(),mt.handleCycleMode());return}const wn=Rmt({blocked:!!mt.pendingApproval||mt.interactionBlocked,streaming:mt.streamingState!=="idle",hasInput:!!((Vt=Ni.current)!=null&&Vt.hasInput()),armed:nv.current});if(wn.kind!=="ignore")switch(De.preventDefault(),wn.kind){case"cancel":mt.handleCancel(),dd();break;case"clear":(jt=Ni.current)==null||jt.clear(),dd();break;case"arm":Z(wn.action,wn.action==="cancel"?2e3:500);break}};return window.addEventListener("keydown",pe),()=>{window.removeEventListener("keydown",pe),dd()}},[dd]);const zN=zpt({catchingUp:!!we.catchingUp,pendingApproval:rs!==null,isPreparingPrompt:cS}),FN={catchingUp:!!we.catchingUp,isPreparingPrompt:cS,isStreaming:be!=="idle"},kse=Sne(FN),pv=re==null?void 0:re[kse],_se=pv!=null&&pv.trim()?pv:ue(Fpt(FN)),_g=m.useCallback(R=>{if(!Zs.current.sessionId){Pm(R);return}av(!0),Tt.setModel(R).then(H=>{const Z=d0t(H);Pm((Z==null?void 0:Z.modelId)??R),Z&&he.dispatch({type:"debug",text:h0t(Z,ue),source:"model_switch_summary",data:Z})}).catch(H=>{Xt(H,ue("model.switch"))}).finally(()=>av(!1))},[Tt,he,Xt,ue,Pm]),Sse=m.useCallback(R=>{av(!0),It.deleteModel(R).then(H=>{H!=null&&H.requiresRestart&&he.dispatch([{type:"status",text:ue("settings.requiresRestart")}]),ov().catch(Z=>{console.warn("[web-shell] failed to reload providers after delete",Z)}),cd().catch(Z=>{console.warn("[web-shell] failed to reload settings after delete",Z)})}).catch(H=>{Xt(H,ue("settings.models.deleteFailed"))}).finally(()=>av(!1))},[It,ov,cd,Xt,he,ue]),qN=m.useCallback(()=>{sS(!1),ov().catch(R=>{console.warn("[web-shell] failed to reload providers after auth dialog close",R)})},[ov]),Cse=m.useCallback(R=>{Zb(!1),Ya(da,"modelFallbacks",R.join(",")).then(H=>{H!=null&&H.requiresRestart&&he.dispatch([{type:"status",text:ue("settings.requiresRestart")}]),cd().catch(Z=>{console.warn("[web-shell] failed to reload settings after fallbacks save",Z)})}).catch(H=>Xt(H,ue("settings.models.fallbacks.saveFailed")))},[da,Ya,cd,Xt,he,ue]),Tse=m.useCallback(R=>{if(be!=="idle"){Kl();return}Ga(),Ho(`/model --fast ${R}${da==="user"?" --global":" --project"}`).then(()=>{cd().catch(Z=>{console.warn("[web-shell] failed to reload workspace settings after fast-model switch",Z)})}).catch(Z=>{Xt(Z,"Failed to switch fast model")})},[Kl,Ga,Ho,be,Xt,cd,da]),Ese=m.useCallback(R=>{const H=Sz(R);Ya(da,"voiceModel",H).catch(Z=>Xt(Z,ue("model.setVoice")))},[da,Xt,Ya,ue]),Ase=m.useCallback(R=>{const H=jmt(R);Ya(da,"visionModel",H).catch(Z=>Xt(Z,ue("model.setVision")))},[da,Xt,Ya,ue]),Mse={main:_g,fast:Tse,voice:Ese,vision:Ase};m.useEffect(()=>{!Kr&&!Rm&&!Yh&&mg("workspace")},[Kr,Rm,Yh]);const HN=m.useMemo(()=>Ote(Pte(we.commands??[],Lte(ue)),ue).filter(R=>!kg.has(BC(R.name))).map(R=>{const H=Dte(R.name);return H?{...R,displayCategory:"skill",description:ue(H)}:R}),[we.commands,kg,ue]),Sg=m.useMemo(()=>{var R;return{version:((R=we.capabilities)==null?void 0:R.qwenCodeVersion)||"",cwd:we.workspaceCwd||"",currentModel:ad,currentMode:Ka,hideTips:(zm==null?void 0:zm.values.effective)===!0}},[(XN=we.capabilities)==null?void 0:XN.qwenCodeVersion,we.workspaceCwd,ad,Ka,zm==null?void 0:zm.values.effective]),Nse=m.useMemo(()=>b?b(Sg):u.jsx(UKe,{...Sg}),[b,Sg]),gv=m.useMemo(()=>x==null?void 0:x(Sg),[x,Sg]),Xa=!we.sessionId&&mn.length===0&&!lo&&!rs&&!ss,UN=Xa&&k,Cg=UN&&!!gv,Ise=Xa&&Cg,xS=Xa&&UN,VN=we.status!=="connecting"&&!we.sessionId&&we.missingSession===!0&&!mr&&Ii==="chat",kS=Xa?Hx():Je,Rse=Nne(X),WN=[Lt.app,Lt.appChat,Xa?Lt.appChatEmpty:void 0,vt.enabled?Lt.appWithSidebar:void 0,Xh===gr.Light?Lt.themeLight:Lt.themeDark,Xh===gr.Dark?"dark":void 0,o].filter(Boolean).join(" "),GN=m.useMemo(()=>({...a,...i0t(kS,X)}),[X,kS,a]),KN=m.useCallback(R=>{at(R),r0t(R)},[]);return m.useLayoutEffect(()=>{const R=Wa.current;if(!R)return;const H=Gb.current,Z=Kb.current,pe=R.getBoundingClientRect();if(Z&&!Xa&&H){const De=H.top-pe.top;Math.abs(De)>1&&(R.style.transition="width 320ms ease",R.style.transform=`translateY(${De}px)`,requestAnimationFrame(()=>{R.style.transition="width 320ms ease, transform 280ms ease",R.style.transform=""}),window.setTimeout(()=>{R.style.transition=""},320))}Gb.current=pe,Kb.current=Xa},[Xa]),m.useLayoutEffect(()=>{const R=document.createElement("div");return R.dataset.webShellPortalRoot="",R.dataset.webShellShadcn="",document.body.appendChild(R),rd(R),()=>{R.remove(),rd(null)}},[]),m.useLayoutEffect(()=>{const R=Yc.current;if(!R||!ua)return;let H=null;const Z=()=>{H=null;const wn=getComputedStyle(R),Vt=new Set;ua.dataset.webShellShadcn="",ua.classList.toggle("dark",Xh===gr.Dark),ua.lang=Oe;for(let jt=0;jt<wn.length;jt+=1){const Ze=wn[jt];Ze.startsWith("--")&&(Vt.add(Ze),ua.style.setProperty(Ze,wn.getPropertyValue(Ze)))}for(const jt of id.current)Vt.has(jt)||ua.style.removeProperty(jt);id.current=Vt},pe=()=>{H===null&&(H=requestAnimationFrame(Z))};Z();const De=new MutationObserver(pe);let mt=R;for(;mt;)De.observe(mt,{attributes:!0,attributeFilter:["class","style","data-theme","lang"]}),mt=mt.parentElement;return window.addEventListener("resize",pe),()=>{De.disconnect(),window.removeEventListener("resize",pe),H!==null&&cancelAnimationFrame(H)}},[WN,GN,ua,Oe,Xh]),u.jsx(dhe,{value:Xh,children:u.jsx(Gde,{language:Oe,children:u.jsx(NU.Provider,{value:ua,children:u.jsxs("div",{ref:Yc,className:WN,style:GN,"data-web-shell-root":!0,"data-web-shell-shadcn":!0,lang:Oe,children:[!Te&&u.jsx(bKe,{toasts:Xs,onDismiss:_n}),WM&&u.jsx(Ar,{title:ue("resume.title"),size:"lg",onClose:()=>H4(!1),children:u.jsx(vYe,{onSelect:R=>{on(),Ga(),Tt.loadSession(R).catch(H=>{Xt(H,"Failed to load session")})},onClose:()=>H4(!1)})}),Kr&&u.jsx(Ar,{title:ue(Kpt[Kr]),size:"lg",onClose:()=>Tl(null),children:u.jsx(zYe,{mode:Kr,models:Kr==="voice"?Lne:void 0,currentModelId:Kr==="voice"?sse:Kr==="vision"?rse:Kr==="fast"?ise:void 0,onSelect:R=>{Kr&&Mse[Kr](R),Tl(null)}})}),pg&&u.jsx(Ar,{title:ue("mode.select"),size:"sm",onClose:()=>jm(!1),children:u.jsx(bYe,{currentMode:Ka,onSelect:R=>{ud(R),jm(!1)}})}),JM&&u.jsx(Ar,{title:ue("tools.title"),size:"lg",onClose:()=>ZM(!1),children:u.jsx(lJe,{})}),tN&&u.jsx(Ar,{title:ue("extensions.manage.title"),size:"lg",onClose:()=>nN(!1),children:u.jsx(cct,{})}),X4&&u.jsx(Ar,{title:ue("mcp.manageServers"),size:"lg",onClose:()=>Q4(null),children:u.jsx($pt,{message:X4,onClose:()=>Q4(null)})}),iS&&u.jsx(Ar,{title:ue("tasks.title"),size:"lg",onClose:()=>sv(null),children:u.jsx(kQ,{message:iS,embedded:!0,manageActiveEvent:!1,onClose:()=>sv(null)})}),gg&&u.jsx(Ar,{title:ue(gg==="manage"?"agent.manage":gg==="menu"?"agents.title":"agent.create"),size:"lg",onClose:()=>rS(null),children:u.jsx(fQe,{mode:gg,embedded:!0,onMessage:R=>he.dispatch([{type:"status",text:R}]),onClose:()=>rS(null)})}),cN&&u.jsx(Ar,{title:ue("memory.menu"),size:"lg",onClose:()=>uN(!1),children:u.jsx(jQe,{refreshSignal:Pne,addSignal:$ne,addScope:Hne,onMessage:(R,H="status")=>{he.dispatch([{type:H,text:R}])}})}),XM&&u.jsx(Ar,{title:ue("help.title"),size:"md",onClose:()=>G4(!1),children:u.jsx(Out,{commands:HN})}),QM&&u.jsx(Ar,{title:ue("theme.title"),size:"sm",onClose:()=>K4(!1),children:u.jsx(Put,{currentTheme:Xh,onSelect:wg,onClose:()=>K4(!1)})}),Yh&&u.jsx(Ar,{title:ue("auth.title"),size:"lg",onClose:qN,children:u.jsx(oJe,{onMessage:(R,H="status")=>{he.dispatch([H==="error"?{type:"error",text:R}:{type:"status",text:R}])},onClose:qN})}),Rm&&u.jsx(Ar,{title:ue("settings.models.fallbacks.title"),size:"md",onClose:()=>Zb(!1),children:u.jsx(eXe,{models:ase,current:ose,max:3,onConfirm:Cse,onClose:()=>Zb(!1)})}),GM&&u.jsx(Ar,{title:ue("delete.title"),size:"lg",onClose:()=>U4(!1),children:u.jsx(But,{onDeleted:R=>{he.dispatch([{type:"status",text:R.length===1?`${ue("delete.deleted")} (${R[0].slice(0,8)})`:ue("delete.deletedCount",{count:R.length})}])},onError:R=>{if(lp(R))return;const H=R instanceof Error?R.message:String(R);fn("error",ue("delete.failed",{reason:H}))},onClose:()=>U4(!1)})}),KM&&u.jsx(Ar,{title:ue("release.title"),size:"lg",onClose:()=>V4(!1),children:u.jsx($ut,{onReleased:R=>{he.dispatch([{type:"status",text:`${ue("release.released")} (${R.slice(0,8)})`}])},onError:R=>{if(lp(R))return;const H=R instanceof Error?R.message:String(R);fn("error",ue("release.failed",{reason:H}))},onClose:()=>V4(!1)})}),YM&&u.jsx(Ar,{title:ue("rewind.title"),subtitle:ue("rewind.subtitle"),size:"lg",onClose:()=>W4(!1),children:u.jsx(ndt,{blocks:Ve,loadSnapshots:fse,rewind:mse,onError:pse,onClose:()=>W4(!1)})}),u.jsxs("div",{className:Lt.appShell,children:[vt.enabled&&u.jsxs("div",{"data-sidebar-shell":"",...Rt?{role:"dialog","aria-modal":"true"}:{},"aria-label":ue("sidebar.label"),className:[Lt.mobileDrawer,Rt?Lt.mobileDrawerOpen:void 0].filter(Boolean).join(" "),children:[u.jsx("div",{className:Lt.mobileBackdrop,onClick:on,"aria-hidden":"true"}),u.jsx(umt,{collapsed:(ye||Ii==="split"&&!bs)&&!Rt,onCollapsedChange:Ss,onOpenSettings:()=>{on(),Vl("settings")},onOpenDaemonStatus:()=>{on(),Vl("status")},onOpenScheduledTasks:()=>{on(),J4()},onOpenSessions:()=>{on(),Vl("sessions")},canOpenSessionsOverview:Bn,onOpenSplitView:()=>{on(),Dm()},canOpenSplitView:Bn,theme:Xh,onThemeChange:R=>{wg(R),Ya("workspace",Tf,DU(R))},onNewSession:R=>(Gi("chat"),Zh(R)),onLoadSession:(R,H)=>(Gi("chat"),qm(R,H)),onError:Xt,mobileOpen:Rt,sessionListReloadToken:wN,selectedWorkspaceCwd:Vn,onSelectWorkspace:kn,branding:vt.branding,footer:vt.footer})]}),u.jsxs("div",{ref:zr,className:[Lt.chatPane,Ii!=="chat"?Lt.chatPaneShowingPage:void 0,xS?Lt.chatPaneWithMobileComposerBottom:void 0].filter(Boolean).join(" "),children:[vt.enabled&&vt.showCompactToggle&&!mr&&Ii==="chat"&&u.jsx("button",{type:"button",className:[Lt.hamburgerButton,Xa?Lt.hamburgerButtonFloating:void 0].filter(Boolean).join(" "),onClick:()=>{rn(R=>!R)},"aria-label":ue("sidebar.toggleMenu"),"aria-expanded":Rt,children:u.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[u.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),u.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),u.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),mr&&u.jsxs("section",{className:Lt.panelHost,role:"region","data-testid":"inline-panel","aria-label":ue(mr==="settings"?"settings.title":mr==="status"?"daemon.title":"sessionsOverview.title"),children:[u.jsxs("div",{className:Lt.panelHeader,children:[u.jsx("button",{ref:iN,type:"button",className:Lt.panelBack,"data-testid":"panel-back",onClick:Ga,"aria-label":ue("common.back"),title:ue("common.back"),children:u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"M15 5l-7 7 7 7",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),u.jsx("div",{className:Lt.panelTitle,children:ue(mr==="settings"?"settings.title":mr==="status"?"daemon.title":"sessionsOverview.title")})]}),u.jsx("div",{className:Lt.panelBody,children:mr==="settings"?u.jsx(rut,{settingsState:EN,embedded:!0,onLanguageChange:lse,onThemeChange:wg,chatWidthMode:Je,onChatWidthModeChange:KN,modelManagement:{providers:iv.providers,currentModelId:we.currentModel??void 0,loading:iv.loading,error:iv.error,busy:nse,onSelectModel:_g,onDeleteModel:Sse,onAddModel:()=>sS(!0)},onSubDialog:(R,H)=>{R==="fastModel"?(mg(H),Tl("fast")):R==="visionModel"?(mg(H),Tl("vision")):R==="voiceModel"?It.loadProviders().then(Z=>{VM(CB(Z)),HM.current===null&&!UM.current&&!dN.current&&(mg(H),Tl("voice"))}).catch(Z=>Xt(Z,ue("model.setVoice"))):R==="modelFallbacks"?(mg(H),Zb(!0)):R==="tools.approvalMode"&&jm(!0)}}):mr==="status"?u.jsx(stt,{}):u.jsx(Gtt,{onOpenSession:gS,onOpenSplit:Dm})},mr)]}),Ii==="scheduledTasks"&&u.jsxs("div",{className:Lt.fullPage,"data-testid":"scheduled-tasks-page",children:[u.jsxs("div",{className:Lt.fullPageHeader,children:[u.jsx("button",{type:"button",className:Lt.fullPageBack,onClick:()=>Gi("chat"),"aria-label":ue("common.back"),title:ue("common.back"),children:u.jsx("svg",{viewBox:"0 0 24 24",width:"18",height:"18",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:u.jsx("path",{d:"M15 18l-6-6 6-6"})})}),u.jsx("div",{className:Lt.fullPageTitle,children:ue("scheduledTasks.title")})]}),u.jsx("div",{className:Lt.fullPageBody,children:u.jsx(ict,{onRunPrompt:hse,workspaces:(QN=we.capabilities)==null?void 0:QN.workspaces,onCreateViaChat:()=>{Gi("chat"),Zh().then(R=>{R&&(e==null||e(void 0),window.setTimeout(()=>{var H,Z;(H=Ni.current)==null||H.insertText(ue("scheduledTasks.chatStarter"),{mode:"replace"}),(Z=Ni.current)==null||Z.focus()},0))})},onOpenSession:R=>{Gi("chat"),qm(R).catch(H=>{Xt(H,"Failed to open session")})},onError:Xt})})]}),Ii==="split"&&u.jsxs("div",{className:Lt.fullPage,"data-testid":"split-view-page",children:[pt&&u.jsxs("div",{className:Lt.splitApprovalNotice,role:"status","data-testid":"split-approval-notice",children:[u.jsx("span",{children:ue("splitView.outerApprovalPending")}),u.jsx("button",{type:"button",onClick:()=>Gi("chat"),children:ue("splitView.goToApproval")})]}),u.jsx(_j,{value:Ie,children:u.jsx(dm.Provider,{value:lv,children:u.jsx($it,{sessionIds:Lm,onPanesChange:Dne,sessionListReloadToken:wN,onExit:One,onError:Xt,onRightPanelOpen:Xe,onPaneArtifactsChange:yn,messageTurnOutputs:q})})})]}),u.jsxs("div",{className:[Lt.chatViewWrap,xS?Lt.chatViewWithMobileComposerBottom:void 0,Ise?Lt.chatViewWithWelcomeMiddle:void 0,mr||Ii!=="chat"?Lt.chatViewHidden:void 0].filter(Boolean).join(" "),"aria-hidden":mr||Ii!=="chat"?!0:void 0,children:[VN&&u.jsxs("div",{className:Lt.missingSessionState,children:[u.jsx("div",{className:Lt.missingSessionMessage,children:ue("session.missing")}),u.jsx("button",{type:"button",className:Lt.missingSessionButton,disabled:Yb,onClick:dse,children:ue("session.new")})]}),u.jsx("div",{className:VN?Lt.chatSubtreeHidden:Lt.chatSubtree,children:u.jsxs(_j,{value:Ie,children:[u.jsx(dm.Provider,{value:lv,children:u.jsx(Hpt,{timeline:Ln,details:Sr,children:u.jsx(LG.Provider,{value:qne,children:(()=>{const R=[Lt.content,lo||mn.length>0||rs?Lt.contentHasMessages:void 0].filter(Boolean).join(" "),H=u.jsx(YQ,{ref:Gh,messages:mn,pendingApproval:Pe,onShowContextDetail:cse,loadingTranscript:we.loadingTranscript,catchingUp:we.catchingUp,isResponding:be!=="idle",activeTurnStartedAt:Kn,workspaceCwd:we.workspaceCwd||"",hideSessionTimeline:kS==="wide",showRetryHint:Jc,onRetryClick:wS,onBranchSession:use,bottomOverlayInset:ii,welcomeHeader:Xa?Nse:void 0,centerWelcomeHeader:Cg||void 0,tailContent:void 0,tailKey:void 0,onCanScrollToBottomChange:wse,virtualScrollThreshold:te,turnFileChanges:_r.has("file")?Lr:void 0,turnArtifacts:_r.has("artifact")?Mn:void 0,turnScheduledTasks:_r.has("scheduled_task")?ti:void 0,onTurnOutputOpen:Xe,onReviewChanges:Sn,onOpenArtifact:en,onOpenScheduledTask:Gs}),Z=!Cg&&(ss==null?void 0:ss.role)==="btw"?u.jsx("div",{className:Lt.btwPanel,children:u.jsx(LQ,{question:ss.question,answer:ss.answer,isPending:ss.isPending})}):null;return Cg?u.jsxs("div",{className:Lt.mobileWelcomeGroup,children:[u.jsxs("div",{style:Hl,className:R,children:[H,Z]}),u.jsx("div",{className:Lt.mobileWelcomeFooterMiddle,children:gv})]}):u.jsxs("div",{style:Hl,className:R,children:[H,Z]})})()})})}),u.jsxs("div",{ref:Wa,style:Hl,className:lt?`${Lt.footer} ${Lt.footerWithCustomFooter}`:Lt.footer,children:[dg&&u.jsx("div",{className:Va?`${Lt.scrollToBottomLayer} ${Lt.scrollToBottomLayerWithTodos}`:Lt.scrollToBottomLayer,children:u.jsx("button",{type:"button",className:Lt.scrollToBottomButton,"aria-label":ue("chat.scrollToBottom"),onClick:()=>yi("smooth"),children:u.jsx("svg",{className:Lt.scrollToBottomIcon,viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"M12 5v13M6.5 12.5 12 18l5.5-5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})})}),Va&&u.jsx("div",{ref:Am,className:Lt.bottomPanels,children:u.jsx($Ke,{todos:lo?si:[],statusItems:ca})}),Pe&&Ii==="chat"&&u.jsx("div",{ref:nS,tabIndex:-1,"data-testid":"approval-overlay",className:Lt.approvalOverlay,children:u.jsx($te,{request:Pe,onConfirm:BN,variant:"floating"})}),qa&&Ii==="chat"&&u.jsx("div",{ref:nS,tabIndex:-1,"data-testid":"approval-overlay",className:Lt.approvalOverlay,children:u.jsx(zte,{request:qa,onConfirm:BN,variant:"floating"})}),u.jsxs("div",{className:Lt.composer,children:[u.jsx(dte,{startedAt:Kn}),Vne&&be==="idle"&&u.jsx("div",{className:Lt.escClearStatus,role:"status",children:ue("editor.escClearHint")}),u.jsx(Bte,{prompts:Yne,t:ue,onDelete:Qne,onInsert:Jne,onEdit:Zne}),ne&&u.jsx("div",{className:Lt.composerHeader,children:u.jsx(ne,{disabled:zN,isRunning:be!=="idle",currentMode:Ka,currentModel:ad,sessionName:yN})}),u.jsx(ute,{ref:q4,onSubmit:yse,onCycleMode:pS,onToggleShortcuts:TN,onCancel:vS,isRunning:be!=="idle",isPreparing:cS,cancelArmed:Wne,disabled:zN,commands:HN,skills:ls,slashCommandCategoryOrder:p,builtinAtProviders:g,atProviders:y,composerTagIcons:w,queuedMessages:Xne,onFocusFooter:bse,onPopQueuedMessages:ese,onClearQueuedMessages:tse,currentMode:Ka,currentModel:ad,gitBranch:we.sessionId?we.gitBranch:Wn,chatWidthMode:Je,showChatWidthToggle:!Xa,chatWidthToggleMin:Rse,visibleToolbarActions:ee,availableModels:Gne,onSelectMode:ud,onSelectModel:_g,workspaces:Et.length>1?Et.map(R=>({id:R.id,cwd:R.cwd,label:R.cwd.split(/[\\/]+/).filter(Boolean).at(-1)??R.cwd,primary:R.primary})):void 0,selectedWorkspaceCwd:we.sessionId?(JN=Et.find(R=>R.cwd===we.workspaceCwd))!=null&&JN.primary?void 0:we.workspaceCwd:Vn,workspaceSelectionDisabled:!!we.sessionId,atWorkspaceCwd:we.sessionId?we.workspaceCwd:Vn??((ZN=Et.find(R=>R.primary))==null?void 0:ZN.cwd),onSelectWorkspace:R=>{ln.current=R,kn(R)},onChatWidthModeChange:KN,sessionName:yN,dialogOpen:eu||pt,followupState:Xb,onAcceptFollowup:Qb,onDismissFollowup:Jb,composerInput:ge,composerInputVersion:Ee,placeholderText:_se})]}),lt?xS?u.jsx("div",{className:Lt.customFooter,children:u.jsx(lt,{connected:qo,mode:Ka,model:ad,streamingState:be,contextUsageRatio:(we.contextWindow??0)>0?(we.tokenCount??0)/(we.contextWindow??0):0,activeGoal:Nm,tasks:ug,availableModes:e1,availableModels:(we.models??[]).filter(k1).map(R=>({id:R.id,label:Lf(R.label||R.id),contextWindow:R.contextWindow})),skills:ls,onSelectMode:ud,onSelectModel:_g})}):u.jsx(lt,{connected:qo,mode:Ka,model:ad,streamingState:be,contextUsageRatio:(we.contextWindow??0)>0?(we.tokenCount??0)/(we.contextWindow??0):0,activeGoal:Nm,tasks:ug,availableModes:e1,availableModels:(we.models??[]).filter(k1).map(R=>({id:R.id,label:Lf(R.label||R.id),contextWindow:R.contextWindow})),skills:ls,onSelectMode:ud,onSelectModel:_g}):u.jsx(JGe,{onSelectMode:()=>jm(R=>!R),onSelectModel:()=>Tl(R=>R?null:"main"),onShowContext:()=>xg("/context",!1),onOpenSettings:()=>Vl("settings"),ref:Vb,onOpenTasks:()=>bS(),onReturnToInput:vse,tasks:Wh,activeGoal:Nm,hideSettings:gse,onToggleShortcuts:TN,compact:!0}),Xa&&gv&&u.jsx("div",{className:[Lt.emptyWelcomeFooter,Cg?Lt.desktopWelcomeFooter:void 0].filter(Boolean).join(" "),children:gv})]})]})})]})]}),W&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Lt.artifactResizeHandle,role:"separator","aria-orientation":"vertical","aria-valuemin":ap,"aria-valuemax":tt(),"aria-valuenow":Ms,onPointerDown:gi}),u.jsx(blt,{artifacts:jn,tabs:An,activeTabId:He,reviewChanges:dn,selectedReviewPath:ds,panelWidth:Ms,workspaceCwd:we.workspaceCwd||"",loading:br,error:Se,onSelectTab:Ge,onCloseTab:zn,onClose:Ft})]})]})]})})})})}function Lz({title:e,description:t,actionLabel:n,onAction:s,theme:r,icon:i}){return u.jsx("div",{"data-web-shell-root":!0,"data-web-shell-shadcn":!0,className:`flex min-h-48 w-full items-center justify-center p-4 ${r==="dark"?"dark":""}`,children:u.jsxs(une,{className:"border",children:[u.jsxs(dne,{children:[u.jsx(hne,{variant:"icon",children:i??u.jsx(Oue,{})}),u.jsx(fne,{children:e}),u.jsx(mne,{children:t})]}),u.jsx(zct,{children:u.jsx(Oc,{onClick:s,children:n})})]})})}function w0t({sessionId:e,workspaceId:t,clientId:n,webShellProps:s}){var h,f;const r=Dh(),[i,o]=m.useState(!1);m.useEffect(()=>o(!1),[e,t]);const a=i?void 0:e,l=i?void 0:t,c=(f=(h=r.capabilities)==null?void 0:h.workspaces)==null?void 0:f.find(p=>p.id===l),d=m.useMemo(()=>VE(Tu(s.language)),[s.language]);return l&&r.status==="error"?u.jsx(Lz,{title:d("workspace.loadFailed"),description:d("workspace.loadFailedDescription"),actionLabel:d("common.retry"),theme:s.theme,icon:u.jsx(vde,{}),onAction:()=>{var p;(p=r.refreshCapabilities)==null||p.call(r).catch(()=>{})}}):l&&!r.capabilities?u.jsxs("div",{"data-web-shell-root":!0,"data-web-shell-shadcn":!0,className:`flex min-h-32 w-full items-center justify-center gap-2 text-sm text-muted-foreground ${s.theme==="dark"?"dark":""}`,role:"status","aria-live":"polite",children:[u.jsx(b7,{}),u.jsx("span",{children:d("common.loading")})]}):l&&!c?u.jsx(Lz,{title:d("workspace.notFound"),description:d("workspace.notFoundDescription"),actionLabel:d("session.new"),theme:s.theme,onAction:()=>{var p;o(!0),(p=s.onSessionIdChange)==null||p.call(s,void 0,void 0)}}):u.jsx(mU,{sessionId:a,workspaceCwd:c==null?void 0:c.cwd,clientId:n,suppressOwnUserEcho:!0,children:u.jsx(v0t,{...s})},`${l??"primary"}:${a??"new"}`)}const x0t=ott(),Ine="qwen-code-web-shell-language",Rne="qwen-code-web-shell-theme";function jne(e){if(e===gr.Dark||e===gr.Light)return e}function k0t(){const e=new URLSearchParams(window.location.search).get("theme");return jne(e)}function _0t(){try{return jne(window.localStorage.getItem(Rne))}catch{return}}function S0t(e){try{window.localStorage.setItem(Rne,e)}catch{}}function C0t(){return k0t()??_0t()??gr.Dark}function T0t(){try{const e=window.localStorage.getItem(Ine);return e?Tu(e):void 0}catch{return}}function E0t(e){try{window.localStorage.setItem(Ine,e)}catch{}}function A0t(){const e=new URLSearchParams(window.location.search),t=e.get("language")??e.get("lang");return Tu(t||(T0t()??navigator.language))}function M0t(){const e=window.location.pathname.match(/\/session\/([^/]+)/);if(e)try{return decodeURIComponent(e[1])}catch{return}}function N0t(){return new URLSearchParams(window.location.search).get("workspace")||void 0}function I0t(e,t){const n=new URL(window.location.href);n.pathname=e?`/session/${encodeURIComponent(e)}`:"/",e&&t?n.searchParams.set("workspace",t):n.searchParams.delete("workspace"),n.searchParams.delete("theme"),n.searchParams.delete("language"),n.searchParams.delete("lang"),n.searchParams.delete("token"),n.searchParams.delete("daemon"),window.history.replaceState(null,"",n)}function R0t({daemonToken:e}){const[t,n]=m.useState(()=>C0t()),[s,r]=m.useState(()=>A0t()),[i]=m.useState(()=>M0t()),[o]=m.useState(()=>N0t()),a=x0t||window.location.origin;m.useEffect(()=>{const h=document.documentElement;h.classList.remove("theme-dark","theme-light","dark"),h.classList.add(`theme-${t}`),h.classList.toggle("dark",t===gr.Dark);const f=document.querySelector('meta[name="theme-color"]');f&&f.setAttribute("content",t==="light"?"#ffffff":"#0d0d0d")},[t]);const l=m.useCallback(h=>{n(h),S0t(h)},[]),c=m.useCallback(h=>{r(h),E0t(h)},[]),d=m.useCallback((h,f)=>{I0t(h,f)},[]);return u.jsx(Fu,{label:"web-shell-root",fallback:(h,f)=>u.jsx(Jce,{error:h,onRetry:f,language:s}),children:u.jsx(rce,{baseUrl:a,token:e,children:u.jsx(w0t,{sessionId:i,workspaceId:o,webShellProps:{theme:t,onThemeChange:l,language:s,onLanguageChange:c,onSessionIdChange:d,sidebar:!0,compactThinking:!0,markdownTableMode:"advanced"}})})})}async function j0t(){const e=Tte()??await ctt();utt(),Ioe.createRoot(document.getElementById("root")).render(u.jsx(Uz.StrictMode,{children:u.jsx(R0t,{daemonToken:e})}))}j0t();export{_m as C,sn as D,yt as E,Ut as F,Uu as G,Bh as P,ms as R,ao as S,Is as T,Ir as V,Fa as W,J as _,Pn as a,ws as b,_i as c,xh as d,Rc as e,K0t as f,v5e as g,V5e as h,Ux as i,W2 as j,F0t as k,Th as l};
