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 Xae=Object.defineProperty;var Qae=(e,t,n)=>t in e?Xae(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Re=(e,t,n)=>Qae(e,typeof t!="symbol"?t+"":t,n);function Jae(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 s_=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function l4(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $H={exports:{}},c4={};/**
 * @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 Zae=Symbol.for("react.transitional.element"),ele=Symbol.for("react.fragment");function zH(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:Zae,type:e,key:s,ref:t!==void 0?t:null,props:n}}c4.Fragment=ele;c4.jsx=zH;c4.jsxs=zH;$H.exports=c4;var l=$H.exports,FH={exports:{}},ds={};/**
 * @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 f9=Symbol.for("react.transitional.element"),tle=Symbol.for("react.portal"),nle=Symbol.for("react.fragment"),sle=Symbol.for("react.strict_mode"),rle=Symbol.for("react.profiler"),ile=Symbol.for("react.consumer"),ole=Symbol.for("react.context"),ale=Symbol.for("react.forward_ref"),lle=Symbol.for("react.suspense"),cle=Symbol.for("react.memo"),qH=Symbol.for("react.lazy"),ule=Symbol.for("react.activity"),eD=Symbol.iterator;function dle(e){return e===null||typeof e!="object"?null:(e=eD&&e[eD]||e["@@iterator"],typeof e=="function"?e:null)}var HH={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},UH=Object.assign,VH={};function d1(e,t,n){this.props=e,this.context=t,this.refs=VH,this.updater=n||HH}d1.prototype.isReactComponent={};d1.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")};d1.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function WH(){}WH.prototype=d1.prototype;function m9(e,t,n){this.props=e,this.context=t,this.refs=VH,this.updater=n||HH}var p9=m9.prototype=new WH;p9.constructor=m9;UH(p9,d1.prototype);p9.isPureReactComponent=!0;var tD=Array.isArray;function m8(){}var Vr={H:null,A:null,T:null,S:null},GH=Object.prototype.hasOwnProperty;function g9(e,t,n){var s=n.ref;return{$$typeof:f9,type:e,key:t,ref:s!==void 0?s:null,props:n}}function hle(e,t){return g9(e.type,t,e.props)}function b9(e){return typeof e=="object"&&e!==null&&e.$$typeof===f9}function fle(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var nD=/\/+/g;function YC(e,t){return typeof e=="object"&&e!==null&&e.key!=null?fle(""+e.key):t.toString(36)}function mle(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(m8,m8):(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 T0(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 f9:case tle:o=!0;break;case qH:return o=e._init,T0(o(e._payload),t,n,s,r)}}if(o)return r=r(e),o=s===""?"."+YC(e,0):s,tD(r)?(n="",o!=null&&(n=o.replace(nD,"$&/")+"/"),T0(r,t,n,"",function(u){return u})):r!=null&&(b9(r)&&(r=hle(r,n+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(nD,"$&/")+"/")+o)),t.push(r)),1;o=0;var a=s===""?".":s+":";if(tD(e))for(var c=0;c<e.length;c++)s=e[c],i=a+YC(s,c),o+=T0(s,t,n,i,r);else if(c=dle(e),typeof c=="function")for(e=c.call(e),c=0;!(s=e.next()).done;)s=s.value,i=a+YC(s,c++),o+=T0(s,t,n,i,r);else if(i==="object"){if(typeof e.then=="function")return T0(mle(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 _w(e,t,n){if(e==null)return e;var s=[],r=0;return T0(e,s,"","",function(i){return t.call(n,i,r++)}),s}function ple(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 sD=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)},gle={map:_w,forEach:function(e,t,n){_w(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return _w(e,function(){t++}),t},toArray:function(e){return _w(e,function(t){return t})||[]},only:function(e){if(!b9(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ds.Activity=ule;ds.Children=gle;ds.Component=d1;ds.Fragment=nle;ds.Profiler=rle;ds.PureComponent=m9;ds.StrictMode=sle;ds.Suspense=lle;ds.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Vr;ds.__COMPILER_RUNTIME={__proto__:null,c:function(e){return Vr.H.useMemoCache(e)}};ds.cache=function(e){return function(){return e.apply(null,arguments)}};ds.cacheSignal=function(){return null};ds.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var s=UH({},e.props),r=e.key;if(t!=null)for(i in t.key!==void 0&&(r=""+t.key),t)!GH.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 g9(e.type,r,s)};ds.createContext=function(e){return e={$$typeof:ole,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:ile,_context:e},e};ds.createElement=function(e,t,n){var s,r={},i=null;if(t!=null)for(s in t.key!==void 0&&(i=""+t.key),t)GH.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),c=0;c<o;c++)a[c]=arguments[c+2];r.children=a}if(e&&e.defaultProps)for(s in o=e.defaultProps,o)r[s]===void 0&&(r[s]=o[s]);return g9(e,i,r)};ds.createRef=function(){return{current:null}};ds.forwardRef=function(e){return{$$typeof:ale,render:e}};ds.isValidElement=b9;ds.lazy=function(e){return{$$typeof:qH,_payload:{_status:-1,_result:e},_init:ple}};ds.memo=function(e,t){return{$$typeof:cle,type:e,compare:t===void 0?null:t}};ds.startTransition=function(e){var t=Vr.T,n={};Vr.T=n;try{var s=e(),r=Vr.S;r!==null&&r(n,s),typeof s=="object"&&s!==null&&typeof s.then=="function"&&s.then(m8,sD)}catch(i){sD(i)}finally{t!==null&&n.types!==null&&(t.types=n.types),Vr.T=t}};ds.unstable_useCacheRefresh=function(){return Vr.H.useCacheRefresh()};ds.use=function(e){return Vr.H.use(e)};ds.useActionState=function(e,t,n){return Vr.H.useActionState(e,t,n)};ds.useCallback=function(e,t){return Vr.H.useCallback(e,t)};ds.useContext=function(e){return Vr.H.useContext(e)};ds.useDebugValue=function(){};ds.useDeferredValue=function(e,t){return Vr.H.useDeferredValue(e,t)};ds.useEffect=function(e,t){return Vr.H.useEffect(e,t)};ds.useEffectEvent=function(e){return Vr.H.useEffectEvent(e)};ds.useId=function(){return Vr.H.useId()};ds.useImperativeHandle=function(e,t,n){return Vr.H.useImperativeHandle(e,t,n)};ds.useInsertionEffect=function(e,t){return Vr.H.useInsertionEffect(e,t)};ds.useLayoutEffect=function(e,t){return Vr.H.useLayoutEffect(e,t)};ds.useMemo=function(e,t){return Vr.H.useMemo(e,t)};ds.useOptimistic=function(e,t){return Vr.H.useOptimistic(e,t)};ds.useReducer=function(e,t,n){return Vr.H.useReducer(e,t,n)};ds.useRef=function(e){return Vr.H.useRef(e)};ds.useState=function(e){return Vr.H.useState(e)};ds.useSyncExternalStore=function(e,t,n){return Vr.H.useSyncExternalStore(e,t,n)};ds.useTransition=function(){return Vr.H.useTransition()};ds.version="19.2.4";FH.exports=ds;var f=FH.exports;const KH=l4(f),u4=Jae({__proto__:null,default:KH},[f]);var YH={exports:{}},d4={},XH={exports:{}},QH={};/**
 * @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($,z){var F=$.length;$.push(z);e:for(;0<F;){var G=F-1>>>1,I=$[G];if(0<r(I,z))$[G]=z,$[F]=I,F=G;else break e}}function n($){return $.length===0?null:$[0]}function s($){if($.length===0)return null;var z=$[0],F=$.pop();if(F!==z){$[0]=F;e:for(var G=0,I=$.length,Q=I>>>1;G<Q;){var V=2*(G+1)-1,M=$[V],re=V+1,se=$[re];if(0>r(M,F))re<I&&0>r(se,M)?($[G]=se,$[re]=F,G=re):($[G]=M,$[V]=F,G=V);else if(re<I&&0>r(se,F))$[G]=se,$[re]=F,G=re;else break e}}return z}function r($,z){var F=$.sortIndex-z.sortIndex;return F!==0?F:$.id-z.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var c=[],u=[],d=1,h=null,m=3,p=!1,g=!1,b=!1,v=!1,x=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;function k($){for(var z=n(u);z!==null;){if(z.callback===null)s(u);else if(z.startTime<=$)s(u),z.sortIndex=z.expirationTime,t(c,z);else break;z=n(u)}}function T($){if(b=!1,k($),!g)if(n(c)!==null)g=!0,S||(S=!0,j());else{var z=n(u);z!==null&&O(T,z.startTime-$)}}var S=!1,C=-1,_=5,B=-1;function A(){return v?!0:!(e.unstable_now()-B<_)}function N(){if(v=!1,S){var $=e.unstable_now();B=$;var z=!0;try{e:{g=!1,b&&(b=!1,y(C),C=-1),p=!0;var F=m;try{t:{for(k($),h=n(c);h!==null&&!(h.expirationTime>$&&A());){var G=h.callback;if(typeof G=="function"){h.callback=null,m=h.priorityLevel;var I=G(h.expirationTime<=$);if($=e.unstable_now(),typeof I=="function"){h.callback=I,k($),z=!0;break t}h===n(c)&&s(c),k($)}else s(c);h=n(c)}if(h!==null)z=!0;else{var Q=n(u);Q!==null&&O(T,Q.startTime-$),z=!1}}break e}finally{h=null,m=F,p=!1}z=void 0}}finally{z?j():S=!1}}}var j;if(typeof w=="function")j=function(){w(N)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,L=P.port2;P.port1.onmessage=N,j=function(){L.postMessage(null)}}else j=function(){x(N,0)};function O($,z){C=x(function(){$(e.unstable_now())},z)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function($){$.callback=null},e.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):_=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_next=function($){switch(m){case 1:case 2:case 3:var z=3;break;default:z=m}var F=m;m=z;try{return $()}finally{m=F}},e.unstable_requestPaint=function(){v=!0},e.unstable_runWithPriority=function($,z){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var F=m;m=$;try{return z()}finally{m=F}},e.unstable_scheduleCallback=function($,z,F){var G=e.unstable_now();switch(typeof F=="object"&&F!==null?(F=F.delay,F=typeof F=="number"&&0<F?G+F:G):F=G,$){case 1:var I=-1;break;case 2:I=250;break;case 5:I=1073741823;break;case 4:I=1e4;break;default:I=5e3}return I=F+I,$={id:d++,callback:z,priorityLevel:$,startTime:F,expirationTime:I,sortIndex:-1},F>G?($.sortIndex=F,t(u,$),n(c)===null&&$===n(u)&&(b?(y(C),C=-1):b=!0,O(T,F-G))):($.sortIndex=I,t(c,$),g||p||(g=!0,S||(S=!0,j()))),$},e.unstable_shouldYield=A,e.unstable_wrapCallback=function($){var z=m;return function(){var F=m;m=z;try{return $.apply(this,arguments)}finally{m=F}}}})(QH);XH.exports=QH;var ble=XH.exports,JH={exports:{}},ba={};/**
 * @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 yle=f;function ZH(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 mh(){}var fa={d:{f:mh,r:function(){throw Error(ZH(522))},D:mh,C:mh,L:mh,m:mh,X:mh,S:mh,M:mh},p:0,findDOMNode:null},xle=Symbol.for("react.portal");function vle(e,t,n){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:xle,key:s==null?null:""+s,children:e,containerInfo:t,implementation:n}}var fy=yle.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h4(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}ba.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=fa;ba.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(ZH(299));return vle(e,t,null,n)};ba.flushSync=function(e){var t=fy.T,n=fa.p;try{if(fy.T=null,fa.p=2,e)return e()}finally{fy.T=t,fa.p=n,fa.d.f()}};ba.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,fa.d.C(e,t))};ba.prefetchDNS=function(e){typeof e=="string"&&fa.d.D(e)};ba.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,s=h4(n,t.crossOrigin),r=typeof t.integrity=="string"?t.integrity:void 0,i=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?fa.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:s,integrity:r,fetchPriority:i}):n==="script"&&fa.d.X(e,{crossOrigin:s,integrity:r,fetchPriority:i,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};ba.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=h4(t.as,t.crossOrigin);fa.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&&fa.d.M(e)};ba.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,s=h4(n,t.crossOrigin);fa.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})}};ba.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=h4(t.as,t.crossOrigin);fa.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 fa.d.m(e)};ba.requestFormReset=function(e){fa.d.r(e)};ba.unstable_batchedUpdates=function(e,t){return e(t)};ba.useFormState=function(e,t,n){return fy.H.useFormState(e,t,n)};ba.useFormStatus=function(){return fy.H.useHostTransitionStatus()};ba.version="19.2.4";function eU(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(eU)}catch(e){console.error(e)}}eU(),JH.exports=ba;var ju=JH.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 Ki=ble,tU=f,wle=ju;function nt(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 nU(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function tv(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 sU(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 rU(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 rD(e){if(tv(e)!==e)throw Error(nt(188))}function kle(e){var t=e.alternate;if(!t){if(t=tv(e),t===null)throw Error(nt(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 rD(r),e;if(i===s)return rD(r),t;i=i.sibling}throw Error(nt(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(nt(189))}}if(n.alternate!==s)throw Error(nt(190))}if(n.tag!==3)throw Error(nt(188));return n.stateNode.current===n?e:t}function iU(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=iU(e),t!==null)return t;e=e.sibling}return null}var Wr=Object.assign,_le=Symbol.for("react.element"),Sw=Symbol.for("react.transitional.element"),Vb=Symbol.for("react.portal"),L0=Symbol.for("react.fragment"),oU=Symbol.for("react.strict_mode"),p8=Symbol.for("react.profiler"),aU=Symbol.for("react.consumer"),dd=Symbol.for("react.context"),y9=Symbol.for("react.forward_ref"),g8=Symbol.for("react.suspense"),b8=Symbol.for("react.suspense_list"),x9=Symbol.for("react.memo"),Th=Symbol.for("react.lazy"),y8=Symbol.for("react.activity"),Sle=Symbol.for("react.memo_cache_sentinel"),iD=Symbol.iterator;function pb(e){return e===null||typeof e!="object"?null:(e=iD&&e[iD]||e["@@iterator"],typeof e=="function"?e:null)}var Cle=Symbol.for("react.client.reference");function x8(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Cle?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case L0:return"Fragment";case p8:return"Profiler";case oU:return"StrictMode";case g8:return"Suspense";case b8:return"SuspenseList";case y8:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case Vb:return"Portal";case dd:return e.displayName||"Context";case aU:return(e._context.displayName||"Context")+".Consumer";case y9:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case x9:return t=e.displayName||null,t!==null?t:x8(e.type)||"Memo";case Th:t=e._payload,e=e._init;try{return x8(e(t))}catch{}}return null}var Wb=Array.isArray,Yn=tU.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,dr=wle.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Xm={pending:!1,data:null,method:null,action:null},v8=[],P0=-1;function Mu(e){return{current:e}}function uo(e){0>P0||(e.current=v8[P0],v8[P0]=null,P0--)}function zr(e,t){P0++,v8[P0]=e.current,e.current=t}var _u=Mu(null),Xy=Mu(null),ef=Mu(null),r_=Mu(null);function i_(e,t){switch(zr(ef,t),zr(Xy,e),zr(_u,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?dL(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=dL(t),e=EW(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}uo(_u),zr(_u,e)}function Tg(){uo(_u),uo(Xy),uo(ef)}function w8(e){e.memoizedState!==null&&zr(r_,e);var t=_u.current,n=EW(t,e.type);t!==n&&(zr(Xy,e),zr(_u,n))}function o_(e){Xy.current===e&&(uo(_u),uo(Xy)),r_.current===e&&(uo(r_),ax._currentValue=Xm)}var XC,oD;function Em(e){if(XC===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);XC=t&&t[1]||"",oD=-1<n.stack.indexOf(`
    at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
`+XC+e+oD}var QC=!1;function JC(e,t){if(!e||QC)return"";QC=!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 m=p}Reflect.construct(e,[],h)}else{try{h.call()}catch(p){m=p}e.call(h.prototype)}}else{try{throw Error()}catch(p){m=p}(h=e())&&typeof h.catch=="function"&&h.catch(function(){})}}catch(p){if(p&&m&&typeof p.stack=="string")return[p.stack,m.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 c=o.split(`
`),u=a.split(`
`);for(r=s=0;s<c.length&&!c[s].includes("DetermineComponentFrameRoot");)s++;for(;r<u.length&&!u[r].includes("DetermineComponentFrameRoot");)r++;if(s===c.length||r===u.length)for(s=c.length-1,r=u.length-1;1<=s&&0<=r&&c[s]!==u[r];)r--;for(;1<=s&&0<=r;s--,r--)if(c[s]!==u[r]){if(s!==1||r!==1)do if(s--,r--,0>r||c[s]!==u[r]){var d=`
`+c[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{QC=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Em(n):""}function Tle(e,t){switch(e.tag){case 26:case 27:case 5:return Em(e.type);case 16:return Em("Lazy");case 13:return e.child!==t&&t!==null?Em("Suspense Fallback"):Em("Suspense");case 19:return Em("SuspenseList");case 0:case 15:return JC(e.type,!1);case 11:return JC(e.type.render,!1);case 1:return JC(e.type,!0);case 31:return Em("Activity");default:return""}}function aD(e){try{var t="",n=null;do t+=Tle(e,n),n=e,e=e.return;while(e);return t}catch(s){return`
Error generating stack: `+s.message+`
`+s.stack}}var k8=Object.prototype.hasOwnProperty,v9=Ki.unstable_scheduleCallback,ZC=Ki.unstable_cancelCallback,Ele=Ki.unstable_shouldYield,Ale=Ki.unstable_requestPaint,ml=Ki.unstable_now,Nle=Ki.unstable_getCurrentPriorityLevel,lU=Ki.unstable_ImmediatePriority,cU=Ki.unstable_UserBlockingPriority,a_=Ki.unstable_NormalPriority,jle=Ki.unstable_LowPriority,uU=Ki.unstable_IdlePriority,Mle=Ki.log,Ile=Ki.unstable_setDisableYieldValue,nv=null,pl=null;function Bh(e){if(typeof Mle=="function"&&Ile(e),pl&&typeof pl.setStrictMode=="function")try{pl.setStrictMode(nv,e)}catch{}}var gl=Math.clz32?Math.clz32:Lle,Rle=Math.log,Dle=Math.LN2;function Lle(e){return e>>>=0,e===0?32:31-(Rle(e)/Dle|0)|0}var Cw=256,Tw=262144,Ew=4194304;function Am(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 f4(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=Am(s):(o&=a,o!==0?r=Am(o):n||(n=a&~e,n!==0&&(r=Am(n))))):(a=s&~i,a!==0?r=Am(a):o!==0?r=Am(o):n||(n=s&~e,n!==0&&(r=Am(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 sv(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ple(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 dU(){var e=Ew;return Ew<<=1,!(Ew&62914560)&&(Ew=4194304),e}function e5(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function rv(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ole(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,c=e.expirationTimes,u=e.hiddenUpdates;for(n=o&~n;0<n;){var d=31-gl(n),h=1<<d;a[d]=0,c[d]=-1;var m=u[d];if(m!==null)for(u[d]=null,d=0;d<m.length;d++){var p=m[d];p!==null&&(p.lane&=-536870913)}n&=~h}s!==0&&hU(e,s,0),i!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=i&~(o&~t))}function hU(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-gl(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|n&261930}function fU(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-gl(n),r=1<<s;r&t|e[s]&t&&(e[s]|=t),n&=~r}}function mU(e,t){var n=t&-t;return n=n&42?1:w9(n),n&(e.suspendedLanes|t)?0:n}function w9(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 k9(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function pU(){var e=dr.p;return e!==0?e:(e=window.event,e===void 0?32:BW(e.type))}function lD(e,t){var n=dr.p;try{return dr.p=e,t()}finally{dr.p=n}}var qf=Math.random().toString(36).slice(2),Co="__reactFiber$"+qf,Ua="__reactProps$"+qf,h1="__reactContainer$"+qf,_8="__reactEvents$"+qf,Ble="__reactListeners$"+qf,$le="__reactHandles$"+qf,cD="__reactResources$"+qf,iv="__reactMarker$"+qf;function _9(e){delete e[Co],delete e[Ua],delete e[_8],delete e[Ble],delete e[$le]}function O0(e){var t=e[Co];if(t)return t;for(var n=e.parentNode;n;){if(t=n[h1]||n[Co]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=gL(e);e!==null;){if(n=e[Co])return n;e=gL(e)}return t}e=n,n=e.parentNode}return null}function f1(e){if(e=e[Co]||e[h1]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Gb(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(nt(33))}function tg(e){var t=e[cD];return t||(t=e[cD]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function ao(e){e[iv]=!0}var gU=new Set,bU={};function Ap(e,t){Eg(e,t),Eg(e+"Capture",t)}function Eg(e,t){for(bU[e]=t,e=0;e<t.length;e++)gU.add(t[e])}var zle=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]*$"),uD={},dD={};function Fle(e){return k8.call(dD,e)?!0:k8.call(uD,e)?!1:zle.test(e)?dD[e]=!0:(uD[e]=!0,!1)}function a2(e,t,n){if(Fle(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 Aw(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 Ku(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 ql(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function yU(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function qle(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 S8(e){if(!e._valueTracker){var t=yU(e)?"checked":"value";e._valueTracker=qle(e,t,""+e[t])}}function xU(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=yU(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function l_(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 Hle=/[\n"\\]/g;function Xl(e){return e.replace(Hle,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function C8(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=""+ql(t)):e.value!==""+ql(t)&&(e.value=""+ql(t)):o!=="submit"&&o!=="reset"||e.removeAttribute("value"),t!=null?T8(e,o,ql(t)):n!=null?T8(e,o,ql(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=""+ql(a):e.removeAttribute("name")}function vU(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)){S8(e);return}n=n!=null?""+ql(n):"",t=t!=null?""+ql(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),S8(e)}function T8(e,t,n){t==="number"&&l_(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function ng(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=""+ql(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 wU(e,t,n){if(t!=null&&(t=""+ql(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+ql(n):""}function kU(e,t,n,s){if(t==null){if(s!=null){if(n!=null)throw Error(nt(92));if(Wb(s)){if(1<s.length)throw Error(nt(93));s=s[0]}n=s}n==null&&(n=""),t=n}n=ql(t),e.defaultValue=n,s=e.textContent,s===n&&s!==""&&s!==null&&(e.value=s),S8(e)}function Ag(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ule=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 hD(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||Ule.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function _U(e,t,n){if(t!=null&&typeof t!="object")throw Error(nt(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&&hD(e,r,s)}else for(var i in t)t.hasOwnProperty(i)&&hD(e,i,t[i])}function S9(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 Vle=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"]]),Wle=/^[\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 l2(e){return Wle.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function hd(){}var E8=null;function C9(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var B0=null,sg=null;function fD(e){var t=f1(e);if(t&&(e=t.stateNode)){var n=e[Ua]||null;e:switch(e=t.stateNode,t.type){case"input":if(C8(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="'+Xl(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var r=s[Ua]||null;if(!r)throw Error(nt(90));C8(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&&xU(s)}break e;case"textarea":wU(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&ng(e,!!n.multiple,t,!1)}}}var t5=!1;function SU(e,t,n){if(t5)return e(t,n);t5=!0;try{var s=e(t);return s}finally{if(t5=!1,(B0!==null||sg!==null)&&(C4(),B0&&(t=B0,e=sg,sg=B0=null,fD(t),e)))for(t=0;t<e.length;t++)fD(e[t])}}function Qy(e,t){var n=e.stateNode;if(n===null)return null;var s=n[Ua]||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(nt(231,t,typeof n));return n}var Dd=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),A8=!1;if(Dd)try{var gb={};Object.defineProperty(gb,"passive",{get:function(){A8=!0}}),window.addEventListener("test",gb,gb),window.removeEventListener("test",gb,gb)}catch{A8=!1}var $h=null,T9=null,c2=null;function CU(){if(c2)return c2;var e,t=T9,n=t.length,s,r="value"in $h?$h.value:$h.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 c2=r.slice(e,1<s?1-s:void 0)}function u2(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 Nw(){return!0}function mD(){return!1}function Wa(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)?Nw:mD,this.isPropagationStopped=mD,this}return Wr(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=Nw)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Nw)},persist:function(){},isPersistent:Nw}),t}var Np={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},m4=Wa(Np),ov=Wr({},Np,{view:0,detail:0}),Gle=Wa(ov),n5,s5,bb,p4=Wr({},ov,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:E9,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!==bb&&(bb&&e.type==="mousemove"?(n5=e.screenX-bb.screenX,s5=e.screenY-bb.screenY):s5=n5=0,bb=e),n5)},movementY:function(e){return"movementY"in e?e.movementY:s5}}),pD=Wa(p4),Kle=Wr({},p4,{dataTransfer:0}),Yle=Wa(Kle),Xle=Wr({},ov,{relatedTarget:0}),r5=Wa(Xle),Qle=Wr({},Np,{animationName:0,elapsedTime:0,pseudoElement:0}),Jle=Wa(Qle),Zle=Wr({},Np,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),ece=Wa(Zle),tce=Wr({},Np,{data:0}),gD=Wa(tce),nce={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},sce={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"},rce={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ice(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=rce[e])?!!t[e]:!1}function E9(){return ice}var oce=Wr({},ov,{key:function(e){if(e.key){var t=nce[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=u2(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?sce[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:E9,charCode:function(e){return e.type==="keypress"?u2(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?u2(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),ace=Wa(oce),lce=Wr({},p4,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),bD=Wa(lce),cce=Wr({},ov,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:E9}),uce=Wa(cce),dce=Wr({},Np,{propertyName:0,elapsedTime:0,pseudoElement:0}),hce=Wa(dce),fce=Wr({},p4,{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}),mce=Wa(fce),pce=Wr({},Np,{newState:0,oldState:0}),gce=Wa(pce),bce=[9,13,27,32],A9=Dd&&"CompositionEvent"in window,my=null;Dd&&"documentMode"in document&&(my=document.documentMode);var yce=Dd&&"TextEvent"in window&&!my,TU=Dd&&(!A9||my&&8<my&&11>=my),yD=" ",xD=!1;function EU(e,t){switch(e){case"keyup":return bce.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function AU(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var $0=!1;function xce(e,t){switch(e){case"compositionend":return AU(t);case"keypress":return t.which!==32?null:(xD=!0,yD);case"textInput":return e=t.data,e===yD&&xD?null:e;default:return null}}function vce(e,t){if($0)return e==="compositionend"||!A9&&EU(e,t)?(e=CU(),c2=T9=$h=null,$0=!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 TU&&t.locale!=="ko"?null:t.data;default:return null}}var wce={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 vD(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!wce[e.type]:t==="textarea"}function NU(e,t,n,s){B0?sg?sg.push(s):sg=[s]:B0=s,t=T_(t,"onChange"),0<t.length&&(n=new m4("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var py=null,Jy=null;function kce(e){SW(e,0)}function g4(e){var t=Gb(e);if(xU(t))return e}function wD(e,t){if(e==="change")return t}var jU=!1;if(Dd){var i5;if(Dd){var o5="oninput"in document;if(!o5){var kD=document.createElement("div");kD.setAttribute("oninput","return;"),o5=typeof kD.oninput=="function"}i5=o5}else i5=!1;jU=i5&&(!document.documentMode||9<document.documentMode)}function _D(){py&&(py.detachEvent("onpropertychange",MU),Jy=py=null)}function MU(e){if(e.propertyName==="value"&&g4(Jy)){var t=[];NU(t,Jy,e,C9(e)),SU(kce,t)}}function _ce(e,t,n){e==="focusin"?(_D(),py=t,Jy=n,py.attachEvent("onpropertychange",MU)):e==="focusout"&&_D()}function Sce(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return g4(Jy)}function Cce(e,t){if(e==="click")return g4(t)}function Tce(e,t){if(e==="input"||e==="change")return g4(t)}function Ece(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var wl=typeof Object.is=="function"?Object.is:Ece;function Zy(e,t){if(wl(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(!k8.call(t,r)||!wl(e[r],t[r]))return!1}return!0}function SD(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function CD(e,t){var n=SD(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=SD(n)}}function IU(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?IU(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function RU(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=l_(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=l_(e.document)}return t}function N9(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 Ace=Dd&&"documentMode"in document&&11>=document.documentMode,z0=null,N8=null,gy=null,j8=!1;function TD(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;j8||z0==null||z0!==l_(s)||(s=z0,"selectionStart"in s&&N9(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}),gy&&Zy(gy,s)||(gy=s,s=T_(N8,"onSelect"),0<s.length&&(t=new m4("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=z0)))}function gm(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var F0={animationend:gm("Animation","AnimationEnd"),animationiteration:gm("Animation","AnimationIteration"),animationstart:gm("Animation","AnimationStart"),transitionrun:gm("Transition","TransitionRun"),transitionstart:gm("Transition","TransitionStart"),transitioncancel:gm("Transition","TransitionCancel"),transitionend:gm("Transition","TransitionEnd")},a5={},DU={};Dd&&(DU=document.createElement("div").style,"AnimationEvent"in window||(delete F0.animationend.animation,delete F0.animationiteration.animation,delete F0.animationstart.animation),"TransitionEvent"in window||delete F0.transitionend.transition);function jp(e){if(a5[e])return a5[e];if(!F0[e])return e;var t=F0[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in DU)return a5[e]=t[n];return e}var LU=jp("animationend"),PU=jp("animationiteration"),OU=jp("animationstart"),Nce=jp("transitionrun"),jce=jp("transitionstart"),Mce=jp("transitioncancel"),BU=jp("transitionend"),$U=new Map,M8="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(" ");M8.push("scrollEnd");function Nc(e,t){$U.set(e,t),Ap(t,[e])}var c_=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)},$l=[],q0=0,j9=0;function b4(){for(var e=q0,t=j9=q0=0;t<e;){var n=$l[t];$l[t++]=null;var s=$l[t];$l[t++]=null;var r=$l[t];$l[t++]=null;var i=$l[t];if($l[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&&zU(n,r,i)}}function y4(e,t,n,s){$l[q0++]=e,$l[q0++]=t,$l[q0++]=n,$l[q0++]=s,j9|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function M9(e,t,n,s){return y4(e,t,n,s),u_(e)}function Mp(e,t){return y4(e,null,null,t),u_(e)}function zU(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-gl(n),e=i.hiddenUpdates,s=e[r],s===null?e[r]=[t]:s.push(t),t.lane=n|536870912),i):null}function u_(e){if(50<Cy)throw Cy=0,J8=null,Error(nt(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var H0={};function Ice(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 ul(e,t,n,s){return new Ice(e,t,n,s)}function I9(e){return e=e.prototype,!(!e||!e.isReactComponent)}function xd(e,t){var n=e.alternate;return n===null?(n=ul(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 FU(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 d2(e,t,n,s,r,i){var o=0;if(s=e,typeof e=="function")I9(e)&&(o=1);else if(typeof e=="string")o=Oue(e,n,_u.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case y8:return e=ul(31,n,t,r),e.elementType=y8,e.lanes=i,e;case L0:return Qm(n.children,r,i,t);case oU:o=8,r|=24;break;case p8:return e=ul(12,n,t,r|2),e.elementType=p8,e.lanes=i,e;case g8:return e=ul(13,n,t,r),e.elementType=g8,e.lanes=i,e;case b8:return e=ul(19,n,t,r),e.elementType=b8,e.lanes=i,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case dd:o=10;break e;case aU:o=9;break e;case y9:o=11;break e;case x9:o=14;break e;case Th:o=16,s=null;break e}o=29,n=Error(nt(130,e===null?"null":typeof e,"")),s=null}return t=ul(o,n,t,r),t.elementType=e,t.type=s,t.lanes=i,t}function Qm(e,t,n,s){return e=ul(7,e,s,t),e.lanes=n,e}function l5(e,t,n){return e=ul(6,e,null,t),e.lanes=n,e}function qU(e){var t=ul(18,null,null,0);return t.stateNode=e,t}function c5(e,t,n){return t=ul(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var ED=new WeakMap;function Ql(e,t){if(typeof e=="object"&&e!==null){var n=ED.get(e);return n!==void 0?n:(t={value:e,source:t,stack:aD(t)},ED.set(e,t),t)}return{value:e,source:t,stack:aD(t)}}var U0=[],V0=0,d_=null,ex=0,Hl=[],Ul=0,pf=null,mu=1,pu="";function id(e,t){U0[V0++]=ex,U0[V0++]=d_,d_=e,ex=t}function HU(e,t,n){Hl[Ul++]=mu,Hl[Ul++]=pu,Hl[Ul++]=pf,pf=e;var s=mu;e=pu;var r=32-gl(s)-1;s&=~(1<<r),n+=1;var i=32-gl(t)+r;if(30<i){var o=r-r%5;i=(s&(1<<o)-1).toString(32),s>>=o,r-=o,mu=1<<32-gl(t)+r|n<<r|s,pu=i+e}else mu=1<<i|n<<r|s,pu=e}function R9(e){e.return!==null&&(id(e,1),HU(e,1,0))}function D9(e){for(;e===d_;)d_=U0[--V0],U0[V0]=null,ex=U0[--V0],U0[V0]=null;for(;e===pf;)pf=Hl[--Ul],Hl[Ul]=null,pu=Hl[--Ul],Hl[Ul]=null,mu=Hl[--Ul],Hl[Ul]=null}function UU(e,t){Hl[Ul++]=mu,Hl[Ul++]=pu,Hl[Ul++]=pf,mu=t.id,pu=t.overflow,pf=e}var To=null,Ur=null,Hs=!1,tf=null,Jl=!1,I8=Error(nt(519));function gf(e){var t=Error(nt(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw tx(Ql(t,e)),I8}function AD(e){var t=e.stateNode,n=e.type,s=e.memoizedProps;switch(t[Co]=e,t[Ua]=s,n){case"dialog":Ns("cancel",t),Ns("close",t);break;case"iframe":case"object":case"embed":Ns("load",t);break;case"video":case"audio":for(n=0;n<ix.length;n++)Ns(ix[n],t);break;case"source":Ns("error",t);break;case"img":case"image":case"link":Ns("error",t),Ns("load",t);break;case"details":Ns("toggle",t);break;case"input":Ns("invalid",t),vU(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":Ns("invalid",t);break;case"textarea":Ns("invalid",t),kU(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||TW(t.textContent,n)?(s.popover!=null&&(Ns("beforetoggle",t),Ns("toggle",t)),s.onScroll!=null&&Ns("scroll",t),s.onScrollEnd!=null&&Ns("scrollend",t),s.onClick!=null&&(t.onclick=hd),t=!0):t=!1,t||gf(e,!0)}function ND(e){for(To=e.return;To;)switch(To.tag){case 5:case 31:case 13:Jl=!1;return;case 27:case 3:Jl=!0;return;default:To=To.return}}function o0(e){if(e!==To)return!1;if(!Hs)return ND(e),Hs=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||s7(e.type,e.memoizedProps)),n=!n),n&&Ur&&gf(e),ND(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(nt(317));Ur=pL(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(nt(317));Ur=pL(e)}else t===27?(t=Ur,Hf(e.type)?(e=a7,a7=null,Ur=e):Ur=t):Ur=To?rc(e.stateNode.nextSibling):null;return!0}function ap(){Ur=To=null,Hs=!1}function u5(){var e=tf;return e!==null&&(Ma===null?Ma=e:Ma.push.apply(Ma,e),tf=null),e}function tx(e){tf===null?tf=[e]:tf.push(e)}var R8=Mu(null),Ip=null,fd=null;function Ih(e,t,n){zr(R8,t._currentValue),t._currentValue=n}function vd(e){e._currentValue=R8.current,uo(R8)}function D8(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 L8(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 c=0;c<t.length;c++)if(a.context===t[c]){i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),D8(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(nt(341));o.lanes|=n,i=o.alternate,i!==null&&(i.lanes|=n),D8(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 m1(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(nt(387));if(o=o.memoizedProps,o!==null){var a=r.type;wl(r.pendingProps.value,o.value)||(e!==null?e.push(a):e=[a])}}else if(r===r_.current){if(o=r.alternate,o===null)throw Error(nt(387));o.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(ax):e=[ax])}r=r.return}e!==null&&L8(t,e,n,s),t.flags|=262144}function h_(e){for(e=e.firstContext;e!==null;){if(!wl(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function lp(e){Ip=e,fd=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Eo(e){return VU(Ip,e)}function jw(e,t){return Ip===null&&lp(e),VU(e,t)}function VU(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},fd===null){if(e===null)throw Error(nt(308));fd=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else fd=fd.next=t;return n}var Rce=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()})}},Dce=Ki.unstable_scheduleCallback,Lce=Ki.unstable_NormalPriority,Mi={$$typeof:dd,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function L9(){return{controller:new Rce,data:new Map,refCount:0}}function av(e){e.refCount--,e.refCount===0&&Dce(Lce,function(){e.controller.abort()})}var by=null,P8=0,Ng=0,rg=null;function Pce(e,t){if(by===null){var n=by=[];P8=0,Ng=oN(),rg={status:"pending",value:void 0,then:function(s){n.push(s)}}}return P8++,t.then(jD,jD),t}function jD(){if(--P8===0&&by!==null){rg!==null&&(rg.status="fulfilled");var e=by;by=null,Ng=0,rg=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Oce(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 MD=Yn.S;Yn.S=function(e,t){iW=ml(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Pce(e,t),MD!==null&&MD(e,t)};var Jm=Mu(null);function P9(){var e=Jm.current;return e!==null?e:Ir.pooledCache}function h2(e,t){t===null?zr(Jm,Jm.current):zr(Jm,t.pool)}function WU(){var e=P9();return e===null?null:{parent:Mi._currentValue,pool:e}}var p1=Error(nt(460)),O9=Error(nt(474)),x4=Error(nt(542)),f_={then:function(){}};function ID(e){return e=e.status,e==="fulfilled"||e==="rejected"}function GU(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(hd,hd),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,DD(e),e;default:if(typeof t.status=="string")t.then(hd,hd);else{if(e=Ir,e!==null&&100<e.shellSuspendCounter)throw Error(nt(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,DD(e),e}throw Zm=t,p1}}function Nm(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Zm=n,p1):n}}var Zm=null;function RD(){if(Zm===null)throw Error(nt(459));var e=Zm;return Zm=null,e}function DD(e){if(e===p1||e===x4)throw Error(nt(483))}var ig=null,nx=0;function Mw(e){var t=nx;return nx+=1,ig===null&&(ig=[]),GU(ig,e,t)}function yb(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Iw(e,t){throw t.$$typeof===_le?Error(nt(525)):(e=Object.prototype.toString.call(t),Error(nt(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function KU(e){function t(x,y){if(e){var w=x.deletions;w===null?(x.deletions=[y],x.flags|=16):w.push(y)}}function n(x,y){if(!e)return null;for(;y!==null;)t(x,y),y=y.sibling;return null}function s(x){for(var y=new Map;x!==null;)x.key!==null?y.set(x.key,x):y.set(x.index,x),x=x.sibling;return y}function r(x,y){return x=xd(x,y),x.index=0,x.sibling=null,x}function i(x,y,w){return x.index=w,e?(w=x.alternate,w!==null?(w=w.index,w<y?(x.flags|=67108866,y):w):(x.flags|=67108866,y)):(x.flags|=1048576,y)}function o(x){return e&&x.alternate===null&&(x.flags|=67108866),x}function a(x,y,w,k){return y===null||y.tag!==6?(y=l5(w,x.mode,k),y.return=x,y):(y=r(y,w),y.return=x,y)}function c(x,y,w,k){var T=w.type;return T===L0?d(x,y,w.props.children,k,w.key):y!==null&&(y.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Th&&Nm(T)===y.type)?(y=r(y,w.props),yb(y,w),y.return=x,y):(y=d2(w.type,w.key,w.props,null,x.mode,k),yb(y,w),y.return=x,y)}function u(x,y,w,k){return y===null||y.tag!==4||y.stateNode.containerInfo!==w.containerInfo||y.stateNode.implementation!==w.implementation?(y=c5(w,x.mode,k),y.return=x,y):(y=r(y,w.children||[]),y.return=x,y)}function d(x,y,w,k,T){return y===null||y.tag!==7?(y=Qm(w,x.mode,k,T),y.return=x,y):(y=r(y,w),y.return=x,y)}function h(x,y,w){if(typeof y=="string"&&y!==""||typeof y=="number"||typeof y=="bigint")return y=l5(""+y,x.mode,w),y.return=x,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Sw:return w=d2(y.type,y.key,y.props,null,x.mode,w),yb(w,y),w.return=x,w;case Vb:return y=c5(y,x.mode,w),y.return=x,y;case Th:return y=Nm(y),h(x,y,w)}if(Wb(y)||pb(y))return y=Qm(y,x.mode,w,null),y.return=x,y;if(typeof y.then=="function")return h(x,Mw(y),w);if(y.$$typeof===dd)return h(x,jw(x,y),w);Iw(x,y)}return null}function m(x,y,w,k){var T=y!==null?y.key:null;if(typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint")return T!==null?null:a(x,y,""+w,k);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Sw:return w.key===T?c(x,y,w,k):null;case Vb:return w.key===T?u(x,y,w,k):null;case Th:return w=Nm(w),m(x,y,w,k)}if(Wb(w)||pb(w))return T!==null?null:d(x,y,w,k,null);if(typeof w.then=="function")return m(x,y,Mw(w),k);if(w.$$typeof===dd)return m(x,y,jw(x,w),k);Iw(x,w)}return null}function p(x,y,w,k,T){if(typeof k=="string"&&k!==""||typeof k=="number"||typeof k=="bigint")return x=x.get(w)||null,a(y,x,""+k,T);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case Sw:return x=x.get(k.key===null?w:k.key)||null,c(y,x,k,T);case Vb:return x=x.get(k.key===null?w:k.key)||null,u(y,x,k,T);case Th:return k=Nm(k),p(x,y,w,k,T)}if(Wb(k)||pb(k))return x=x.get(w)||null,d(y,x,k,T,null);if(typeof k.then=="function")return p(x,y,w,Mw(k),T);if(k.$$typeof===dd)return p(x,y,w,jw(y,k),T);Iw(y,k)}return null}function g(x,y,w,k){for(var T=null,S=null,C=y,_=y=0,B=null;C!==null&&_<w.length;_++){C.index>_?(B=C,C=null):B=C.sibling;var A=m(x,C,w[_],k);if(A===null){C===null&&(C=B);break}e&&C&&A.alternate===null&&t(x,C),y=i(A,y,_),S===null?T=A:S.sibling=A,S=A,C=B}if(_===w.length)return n(x,C),Hs&&id(x,_),T;if(C===null){for(;_<w.length;_++)C=h(x,w[_],k),C!==null&&(y=i(C,y,_),S===null?T=C:S.sibling=C,S=C);return Hs&&id(x,_),T}for(C=s(C);_<w.length;_++)B=p(C,x,_,w[_],k),B!==null&&(e&&B.alternate!==null&&C.delete(B.key===null?_:B.key),y=i(B,y,_),S===null?T=B:S.sibling=B,S=B);return e&&C.forEach(function(N){return t(x,N)}),Hs&&id(x,_),T}function b(x,y,w,k){if(w==null)throw Error(nt(151));for(var T=null,S=null,C=y,_=y=0,B=null,A=w.next();C!==null&&!A.done;_++,A=w.next()){C.index>_?(B=C,C=null):B=C.sibling;var N=m(x,C,A.value,k);if(N===null){C===null&&(C=B);break}e&&C&&N.alternate===null&&t(x,C),y=i(N,y,_),S===null?T=N:S.sibling=N,S=N,C=B}if(A.done)return n(x,C),Hs&&id(x,_),T;if(C===null){for(;!A.done;_++,A=w.next())A=h(x,A.value,k),A!==null&&(y=i(A,y,_),S===null?T=A:S.sibling=A,S=A);return Hs&&id(x,_),T}for(C=s(C);!A.done;_++,A=w.next())A=p(C,x,_,A.value,k),A!==null&&(e&&A.alternate!==null&&C.delete(A.key===null?_:A.key),y=i(A,y,_),S===null?T=A:S.sibling=A,S=A);return e&&C.forEach(function(j){return t(x,j)}),Hs&&id(x,_),T}function v(x,y,w,k){if(typeof w=="object"&&w!==null&&w.type===L0&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Sw:e:{for(var T=w.key;y!==null;){if(y.key===T){if(T=w.type,T===L0){if(y.tag===7){n(x,y.sibling),k=r(y,w.props.children),k.return=x,x=k;break e}}else if(y.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Th&&Nm(T)===y.type){n(x,y.sibling),k=r(y,w.props),yb(k,w),k.return=x,x=k;break e}n(x,y);break}else t(x,y);y=y.sibling}w.type===L0?(k=Qm(w.props.children,x.mode,k,w.key),k.return=x,x=k):(k=d2(w.type,w.key,w.props,null,x.mode,k),yb(k,w),k.return=x,x=k)}return o(x);case Vb:e:{for(T=w.key;y!==null;){if(y.key===T)if(y.tag===4&&y.stateNode.containerInfo===w.containerInfo&&y.stateNode.implementation===w.implementation){n(x,y.sibling),k=r(y,w.children||[]),k.return=x,x=k;break e}else{n(x,y);break}else t(x,y);y=y.sibling}k=c5(w,x.mode,k),k.return=x,x=k}return o(x);case Th:return w=Nm(w),v(x,y,w,k)}if(Wb(w))return g(x,y,w,k);if(pb(w)){if(T=pb(w),typeof T!="function")throw Error(nt(150));return w=T.call(w),b(x,y,w,k)}if(typeof w.then=="function")return v(x,y,Mw(w),k);if(w.$$typeof===dd)return v(x,y,jw(x,w),k);Iw(x,w)}return typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint"?(w=""+w,y!==null&&y.tag===6?(n(x,y.sibling),k=r(y,w),k.return=x,x=k):(n(x,y),k=l5(w,x.mode,k),k.return=x,x=k),o(x)):n(x,y)}return function(x,y,w,k){try{nx=0;var T=v(x,y,w,k);return ig=null,T}catch(C){if(C===p1||C===x4)throw C;var S=ul(29,C,null,x.mode);return S.lanes=k,S.return=x,S}finally{}}}var cp=KU(!0),YU=KU(!1),Eh=!1;function B9(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function O8(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 nf(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function sf(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,cr&2){var r=s.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),s.pending=t,t=u_(e),zU(e,null,n),t}return y4(e,s,t,n),u_(e)}function yy(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,fU(e,n)}}function d5(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 B8=!1;function xy(){if(B8){var e=rg;if(e!==null)throw e}}function vy(e,t,n,s){B8=!1;var r=e.updateQueue;Eh=!1;var i=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(a!==null){r.shared.pending=null;var c=a,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==o&&(a===null?d.firstBaseUpdate=u:a.next=u,d.lastBaseUpdate=c))}if(i!==null){var h=r.baseState;o=0,d=u=c=null,a=i;do{var m=a.lane&-536870913,p=m!==a.lane;if(p?(Ps&m)===m:(s&m)===m){m!==0&&m===Ng&&(B8=!0),d!==null&&(d=d.next={lane:0,tag:a.tag,payload:a.payload,callback:null,next:null});e:{var g=e,b=a;m=t;var v=n;switch(b.tag){case 1:if(g=b.payload,typeof g=="function"){h=g.call(v,h,m);break e}h=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=b.payload,m=typeof g=="function"?g.call(v,h,m):g,m==null)break e;h=Wr({},h,m);break e;case 2:Eh=!0}}m=a.callback,m!==null&&(e.flags|=64,p&&(e.flags|=8192),p=r.callbacks,p===null?r.callbacks=[m]:p.push(m))}else p={lane:m,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(u=d=p,c=h):d=d.next=p,o|=m;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&&(c=h),r.baseState=c,r.firstBaseUpdate=u,r.lastBaseUpdate=d,i===null&&(r.shared.lanes=0),yf|=o,e.lanes=o,e.memoizedState=h}}function XU(e,t){if(typeof e!="function")throw Error(nt(191,e));e.call(t)}function QU(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)XU(n[e],t)}var jg=Mu(null),m_=Mu(0);function LD(e,t){e=Bd,zr(m_,e),zr(jg,t),Bd=e|t.baseLanes}function $8(){zr(m_,Bd),zr(jg,jg.current)}function $9(){Bd=m_.current,uo(jg),uo(m_)}var kl=Mu(null),sc=null;function Rh(e){var t=e.alternate;zr(_i,_i.current&1),zr(kl,e),sc===null&&(t===null||jg.current!==null||t.memoizedState!==null)&&(sc=e)}function z8(e){zr(_i,_i.current),zr(kl,e),sc===null&&(sc=e)}function JU(e){e.tag===22?(zr(_i,_i.current),zr(kl,e),sc===null&&(sc=e)):Dh()}function Dh(){zr(_i,_i.current),zr(kl,kl.current)}function ll(e){uo(kl),sc===e&&(sc=null),uo(_i)}var _i=Mu(0);function p_(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||i7(n)||o7(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 Ld=0,ps=null,Sr=null,Ni=null,g_=!1,og=!1,up=!1,b_=0,sx=0,ag=null,Bce=0;function fi(){throw Error(nt(321))}function z9(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!wl(e[n],t[n]))return!1;return!0}function F9(e,t,n,s,r,i){return Ld=i,ps=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Yn.H=e===null||e.memoizedState===null?NV:J9,up=!1,i=n(s,r),up=!1,og&&(i=eV(t,n,s,r)),ZU(e),i}function ZU(e){Yn.H=rx;var t=Sr!==null&&Sr.next!==null;if(Ld=0,Ni=Sr=ps=null,g_=!1,sx=0,ag=null,t)throw Error(nt(300));e===null||Ri||(e=e.dependencies,e!==null&&h_(e)&&(Ri=!0))}function eV(e,t,n,s){ps=e;var r=0;do{if(og&&(ag=null),sx=0,og=!1,25<=r)throw Error(nt(301));if(r+=1,Ni=Sr=null,e.updateQueue!=null){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}Yn.H=jV,i=t(n,s)}while(og);return i}function $ce(){var e=Yn.H,t=e.useState()[0];return t=typeof t.then=="function"?lv(t):t,e=e.useState()[0],(Sr!==null?Sr.memoizedState:null)!==e&&(ps.flags|=1024),t}function q9(){var e=b_!==0;return b_=0,e}function H9(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function U9(e){if(g_){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}g_=!1}Ld=0,Ni=Sr=ps=null,og=!1,sx=b_=0,ag=null}function ia(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ni===null?ps.memoizedState=Ni=e:Ni=Ni.next=e,Ni}function Si(){if(Sr===null){var e=ps.alternate;e=e!==null?e.memoizedState:null}else e=Sr.next;var t=Ni===null?ps.memoizedState:Ni.next;if(t!==null)Ni=t,Sr=e;else{if(e===null)throw ps.alternate===null?Error(nt(467)):Error(nt(310));Sr=e,e={memoizedState:Sr.memoizedState,baseState:Sr.baseState,baseQueue:Sr.baseQueue,queue:Sr.queue,next:null},Ni===null?ps.memoizedState=Ni=e:Ni=Ni.next=e}return Ni}function v4(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function lv(e){var t=sx;return sx+=1,ag===null&&(ag=[]),e=GU(ag,e,t),t=ps,(Ni===null?t.memoizedState:Ni.next)===null&&(t=t.alternate,Yn.H=t===null||t.memoizedState===null?NV:J9),e}function w4(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return lv(e);if(e.$$typeof===dd)return Eo(e)}throw Error(nt(438,String(e)))}function V9(e){var t=null,n=ps.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var s=ps.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=v4(),ps.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]=Sle;return t.index++,n}function Pd(e,t){return typeof t=="function"?t(e):t}function f2(e){var t=Si();return W9(t,Sr,e)}function W9(e,t,n){var s=e.queue;if(s===null)throw Error(nt(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,c=null,u=t,d=!1;do{var h=u.lane&-536870913;if(h!==u.lane?(Ps&h)===h:(Ld&h)===h){var m=u.revertLane;if(m===0)c!==null&&(c=c.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),h===Ng&&(d=!0);else if((Ld&m)===m){u=u.next,m===Ng&&(d=!0);continue}else h={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},c===null?(a=c=h,o=i):c=c.next=h,ps.lanes|=m,yf|=m;h=u.action,up&&n(i,h),i=u.hasEagerState?u.eagerState:n(i,h)}else m={lane:h,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},c===null?(a=c=m,o=i):c=c.next=m,ps.lanes|=h,yf|=h;u=u.next}while(u!==null&&u!==t);if(c===null?o=i:c.next=a,!wl(i,e.memoizedState)&&(Ri=!0,d&&(n=rg,n!==null)))throw n;e.memoizedState=i,e.baseState=o,e.baseQueue=c,s.lastRenderedState=i}return r===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function h5(e){var t=Si(),n=t.queue;if(n===null)throw Error(nt(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);wl(i,t.memoizedState)||(Ri=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,s]}function tV(e,t,n){var s=ps,r=Si(),i=Hs;if(i){if(n===void 0)throw Error(nt(407));n=n()}else n=t();var o=!wl((Sr||r).memoizedState,n);if(o&&(r.memoizedState=n,Ri=!0),r=r.queue,G9(rV.bind(null,s,r,e),[e]),r.getSnapshot!==t||o||Ni!==null&&Ni.memoizedState.tag&1){if(s.flags|=2048,Mg(9,{destroy:void 0},sV.bind(null,s,r,n,t),null),Ir===null)throw Error(nt(349));i||Ld&127||nV(s,t,n)}return n}function nV(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=ps.updateQueue,t===null?(t=v4(),ps.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function sV(e,t,n,s){t.value=n,t.getSnapshot=s,iV(t)&&oV(e)}function rV(e,t,n){return n(function(){iV(t)&&oV(e)})}function iV(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!wl(e,n)}catch{return!0}}function oV(e){var t=Mp(e,2);t!==null&&Fa(t,e,2)}function F8(e){var t=ia();if(typeof e=="function"){var n=e;if(e=n(),up){Bh(!0);try{n()}finally{Bh(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pd,lastRenderedState:e},t}function aV(e,t,n,s){return e.baseState=n,W9(e,Sr,typeof s=="function"?s:Pd)}function zce(e,t,n,s,r){if(_4(e))throw Error(nt(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)}};Yn.T!==null?n(!0):i.isTransition=!1,s(i),n=t.pending,n===null?(i.next=t.pending=i,lV(t,i)):(i.next=n.next,t.pending=n.next=i)}}function lV(e,t){var n=t.action,s=t.payload,r=e.state;if(t.isTransition){var i=Yn.T,o={};Yn.T=o;try{var a=n(r,s),c=Yn.S;c!==null&&c(o,a),PD(e,t,a)}catch(u){q8(e,t,u)}finally{i!==null&&o.types!==null&&(i.types=o.types),Yn.T=i}}else try{i=n(r,s),PD(e,t,i)}catch(u){q8(e,t,u)}}function PD(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(s){OD(e,t,s)},function(s){return q8(e,t,s)}):OD(e,t,n)}function OD(e,t,n){t.status="fulfilled",t.value=n,cV(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,lV(e,n)))}function q8(e,t,n){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=n,cV(t),t=t.next;while(t!==s)}e.action=null}function cV(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function uV(e,t){return t}function BD(e,t){if(Hs){var n=Ir.formState;if(n!==null){e:{var s=ps;if(Hs){if(Ur){t:{for(var r=Ur,i=Jl;r.nodeType!==8;){if(!i){r=null;break t}if(r=rc(r.nextSibling),r===null){r=null;break t}}i=r.data,r=i==="F!"||i==="F"?r:null}if(r){Ur=rc(r.nextSibling),s=r.data==="F!";break e}}gf(s)}s=!1}s&&(t=n[0])}}return n=ia(),n.memoizedState=n.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:uV,lastRenderedState:t},n.queue=s,n=TV.bind(null,ps,s),s.dispatch=n,s=F8(!1),i=Q9.bind(null,ps,!1,s.queue),s=ia(),r={state:t,dispatch:null,action:e,pending:null},s.queue=r,n=zce.bind(null,ps,r,i,n),r.dispatch=n,s.memoizedState=e,[t,n,!1]}function $D(e){var t=Si();return dV(t,Sr,e)}function dV(e,t,n){if(t=W9(e,t,uV)[0],e=f2(Pd)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=lv(t)}catch(o){throw o===p1?x4:o}else s=t;t=Si();var r=t.queue,i=r.dispatch;return n!==t.memoizedState&&(ps.flags|=2048,Mg(9,{destroy:void 0},Fce.bind(null,r,n),null)),[s,i,e]}function Fce(e,t){e.action=t}function zD(e){var t=Si(),n=Sr;if(n!==null)return dV(t,n,e);Si(),t=t.memoizedState,n=Si();var s=n.queue.dispatch;return n.memoizedState=e,[t,s,!1]}function Mg(e,t,n,s){return e={tag:e,create:n,deps:s,inst:t,next:null},t=ps.updateQueue,t===null&&(t=v4(),ps.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 hV(){return Si().memoizedState}function m2(e,t,n,s){var r=ia();ps.flags|=e,r.memoizedState=Mg(1|t,{destroy:void 0},n,s===void 0?null:s)}function k4(e,t,n,s){var r=Si();s=s===void 0?null:s;var i=r.memoizedState.inst;Sr!==null&&s!==null&&z9(s,Sr.memoizedState.deps)?r.memoizedState=Mg(t,i,n,s):(ps.flags|=e,r.memoizedState=Mg(1|t,i,n,s))}function FD(e,t){m2(8390656,8,e,t)}function G9(e,t){k4(2048,8,e,t)}function qce(e){ps.flags|=4;var t=ps.updateQueue;if(t===null)t=v4(),ps.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function fV(e){var t=Si().memoizedState;return qce({ref:t,nextImpl:e}),function(){if(cr&2)throw Error(nt(440));return t.impl.apply(void 0,arguments)}}function mV(e,t){return k4(4,2,e,t)}function pV(e,t){return k4(4,4,e,t)}function gV(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 bV(e,t,n){n=n!=null?n.concat([e]):null,k4(4,4,gV.bind(null,t,e),n)}function K9(){}function yV(e,t){var n=Si();t=t===void 0?null:t;var s=n.memoizedState;return t!==null&&z9(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function xV(e,t){var n=Si();t=t===void 0?null:t;var s=n.memoizedState;if(t!==null&&z9(t,s[1]))return s[0];if(s=e(),up){Bh(!0);try{e()}finally{Bh(!1)}}return n.memoizedState=[s,t],s}function Y9(e,t,n){return n===void 0||Ld&1073741824&&!(Ps&261930)?e.memoizedState=t:(e.memoizedState=n,e=aW(),ps.lanes|=e,yf|=e,n)}function vV(e,t,n,s){return wl(n,t)?n:jg.current!==null?(e=Y9(e,n,s),wl(e,t)||(Ri=!0),e):!(Ld&42)||Ld&1073741824&&!(Ps&261930)?(Ri=!0,e.memoizedState=n):(e=aW(),ps.lanes|=e,yf|=e,t)}function wV(e,t,n,s,r){var i=dr.p;dr.p=i!==0&&8>i?i:8;var o=Yn.T,a={};Yn.T=a,Q9(e,!1,t,n);try{var c=r(),u=Yn.S;if(u!==null&&u(a,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=Oce(c,s);wy(e,t,d,bl(e))}else wy(e,t,s,bl(e))}catch(h){wy(e,t,{then:function(){},status:"rejected",reason:h},bl())}finally{dr.p=i,o!==null&&a.types!==null&&(o.types=a.types),Yn.T=o}}function Hce(){}function H8(e,t,n,s){if(e.tag!==5)throw Error(nt(476));var r=kV(e).queue;wV(e,r,t,Xm,n===null?Hce:function(){return _V(e),n(s)})}function kV(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Xm,baseState:Xm,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pd,lastRenderedState:Xm},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pd,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function _V(e){var t=kV(e);t.next===null&&(t=e.alternate.memoizedState),wy(e,t.next.queue,{},bl())}function X9(){return Eo(ax)}function SV(){return Si().memoizedState}function CV(){return Si().memoizedState}function Uce(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=bl();e=nf(n);var s=sf(t,e,n);s!==null&&(Fa(s,t,n),yy(s,t,n)),t={cache:L9()},e.payload=t;return}t=t.return}}function Vce(e,t,n){var s=bl();n={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},_4(e)?EV(t,n):(n=M9(e,t,n,s),n!==null&&(Fa(n,e,s),AV(n,t,s)))}function TV(e,t,n){var s=bl();wy(e,t,n,s)}function wy(e,t,n,s){var r={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(_4(e))EV(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,wl(a,o))return y4(e,t,r,0),Ir===null&&b4(),!1}catch{}finally{}if(n=M9(e,t,r,s),n!==null)return Fa(n,e,s),AV(n,t,s),!0}return!1}function Q9(e,t,n,s){if(s={lane:2,revertLane:oN(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},_4(e)){if(t)throw Error(nt(479))}else t=M9(e,n,s,2),t!==null&&Fa(t,e,2)}function _4(e){var t=e.alternate;return e===ps||t!==null&&t===ps}function EV(e,t){og=g_=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function AV(e,t,n){if(n&4194048){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,fU(e,n)}}var rx={readContext:Eo,use:w4,useCallback:fi,useContext:fi,useEffect:fi,useImperativeHandle:fi,useLayoutEffect:fi,useInsertionEffect:fi,useMemo:fi,useReducer:fi,useRef:fi,useState:fi,useDebugValue:fi,useDeferredValue:fi,useTransition:fi,useSyncExternalStore:fi,useId:fi,useHostTransitionStatus:fi,useFormState:fi,useActionState:fi,useOptimistic:fi,useMemoCache:fi,useCacheRefresh:fi};rx.useEffectEvent=fi;var NV={readContext:Eo,use:w4,useCallback:function(e,t){return ia().memoizedState=[e,t===void 0?null:t],e},useContext:Eo,useEffect:FD,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,m2(4194308,4,gV.bind(null,t,e),n)},useLayoutEffect:function(e,t){return m2(4194308,4,e,t)},useInsertionEffect:function(e,t){m2(4,2,e,t)},useMemo:function(e,t){var n=ia();t=t===void 0?null:t;var s=e();if(up){Bh(!0);try{e()}finally{Bh(!1)}}return n.memoizedState=[s,t],s},useReducer:function(e,t,n){var s=ia();if(n!==void 0){var r=n(t);if(up){Bh(!0);try{n(t)}finally{Bh(!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=Vce.bind(null,ps,e),[s.memoizedState,e]},useRef:function(e){var t=ia();return e={current:e},t.memoizedState=e},useState:function(e){e=F8(e);var t=e.queue,n=TV.bind(null,ps,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:K9,useDeferredValue:function(e,t){var n=ia();return Y9(n,e,t)},useTransition:function(){var e=F8(!1);return e=wV.bind(null,ps,e.queue,!0,!1),ia().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var s=ps,r=ia();if(Hs){if(n===void 0)throw Error(nt(407));n=n()}else{if(n=t(),Ir===null)throw Error(nt(349));Ps&127||nV(s,t,n)}r.memoizedState=n;var i={value:n,getSnapshot:t};return r.queue=i,FD(rV.bind(null,s,i,e),[e]),s.flags|=2048,Mg(9,{destroy:void 0},sV.bind(null,s,i,n,t),null),n},useId:function(){var e=ia(),t=Ir.identifierPrefix;if(Hs){var n=pu,s=mu;n=(s&~(1<<32-gl(s)-1)).toString(32)+n,t="_"+t+"R_"+n,n=b_++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=Bce++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:X9,useFormState:BD,useActionState:BD,useOptimistic:function(e){var t=ia();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Q9.bind(null,ps,!0,n),n.dispatch=t,[e,t]},useMemoCache:V9,useCacheRefresh:function(){return ia().memoizedState=Uce.bind(null,ps)},useEffectEvent:function(e){var t=ia(),n={impl:e};return t.memoizedState=n,function(){if(cr&2)throw Error(nt(440));return n.impl.apply(void 0,arguments)}}},J9={readContext:Eo,use:w4,useCallback:yV,useContext:Eo,useEffect:G9,useImperativeHandle:bV,useInsertionEffect:mV,useLayoutEffect:pV,useMemo:xV,useReducer:f2,useRef:hV,useState:function(){return f2(Pd)},useDebugValue:K9,useDeferredValue:function(e,t){var n=Si();return vV(n,Sr.memoizedState,e,t)},useTransition:function(){var e=f2(Pd)[0],t=Si().memoizedState;return[typeof e=="boolean"?e:lv(e),t]},useSyncExternalStore:tV,useId:SV,useHostTransitionStatus:X9,useFormState:$D,useActionState:$D,useOptimistic:function(e,t){var n=Si();return aV(n,Sr,e,t)},useMemoCache:V9,useCacheRefresh:CV};J9.useEffectEvent=fV;var jV={readContext:Eo,use:w4,useCallback:yV,useContext:Eo,useEffect:G9,useImperativeHandle:bV,useInsertionEffect:mV,useLayoutEffect:pV,useMemo:xV,useReducer:h5,useRef:hV,useState:function(){return h5(Pd)},useDebugValue:K9,useDeferredValue:function(e,t){var n=Si();return Sr===null?Y9(n,e,t):vV(n,Sr.memoizedState,e,t)},useTransition:function(){var e=h5(Pd)[0],t=Si().memoizedState;return[typeof e=="boolean"?e:lv(e),t]},useSyncExternalStore:tV,useId:SV,useHostTransitionStatus:X9,useFormState:zD,useActionState:zD,useOptimistic:function(e,t){var n=Si();return Sr!==null?aV(n,Sr,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:V9,useCacheRefresh:CV};jV.useEffectEvent=fV;function f5(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:Wr({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var U8={enqueueSetState:function(e,t,n){e=e._reactInternals;var s=bl(),r=nf(s);r.payload=t,n!=null&&(r.callback=n),t=sf(e,r,s),t!==null&&(Fa(t,e,s),yy(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=bl(),r=nf(s);r.tag=1,r.payload=t,n!=null&&(r.callback=n),t=sf(e,r,s),t!==null&&(Fa(t,e,s),yy(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=bl(),s=nf(n);s.tag=2,t!=null&&(s.callback=t),t=sf(e,s,n),t!==null&&(Fa(t,e,n),yy(t,e,n))}};function qD(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?!Zy(n,s)||!Zy(r,i):!0}function HD(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&&U8.enqueueReplaceState(t,t.state,null)}function dp(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=Wr({},n));for(var r in e)n[r]===void 0&&(n[r]=e[r])}return n}function MV(e){c_(e)}function IV(e){console.error(e)}function RV(e){c_(e)}function y_(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function UD(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 V8(e,t,n){return n=nf(n),n.tag=3,n.payload={element:null},n.callback=function(){y_(e,t)},n}function DV(e){return e=nf(e),e.tag=3,e}function LV(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(){UD(t,n,s)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch=="function"&&(e.callback=function(){UD(t,n,s),typeof r!="function"&&(rf===null?rf=new Set([this]):rf.add(this));var a=s.stack;this.componentDidCatch(s.value,{componentStack:a!==null?a:""})})}function Wce(e,t,n,s,r){if(n.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=n.alternate,t!==null&&m1(t,n,r,!0),n=kl.current,n!==null){switch(n.tag){case 31:case 13:return sc===null?__():n.alternate===null&&gi===0&&(gi=3),n.flags&=-257,n.flags|=65536,n.lanes=r,s===f_?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([s]):t.add(s),S5(e,s,r)),!1;case 22:return n.flags|=65536,s===f_?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)),S5(e,s,r)),!1}throw Error(nt(435,n.tag))}return S5(e,s,r),__(),!1}if(Hs)return t=kl.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=r,s!==I8&&(e=Error(nt(422),{cause:s}),tx(Ql(e,n)))):(s!==I8&&(t=Error(nt(423),{cause:s}),tx(Ql(t,n))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,s=Ql(s,n),r=V8(e.stateNode,s,r),d5(e,r),gi!==4&&(gi=2)),!1;var i=Error(nt(520),{cause:s});if(i=Ql(i,n),Sy===null?Sy=[i]:Sy.push(i),gi!==4&&(gi=2),t===null)return!0;s=Ql(s,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=r&-r,n.lanes|=e,e=V8(n.stateNode,s,e),d5(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"&&(rf===null||!rf.has(i))))return n.flags|=65536,r&=-r,n.lanes|=r,r=DV(r),LV(r,e,n,s),d5(n,r),!1}n=n.return}while(n!==null);return!1}var Z9=Error(nt(461)),Ri=!1;function xo(e,t,n,s){t.child=e===null?YU(t,null,n,s):cp(t,e.child,n,s)}function VD(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 lp(t),s=F9(e,t,n,o,i,r),a=q9(),e!==null&&!Ri?(H9(e,t,r),Od(e,t,r)):(Hs&&a&&R9(t),t.flags|=1,xo(e,t,s,r),t.child)}function WD(e,t,n,s,r){if(e===null){var i=n.type;return typeof i=="function"&&!I9(i)&&i.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=i,PV(e,t,i,s,r)):(e=d2(n.type,null,s,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!eN(e,r)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:Zy,n(o,s)&&e.ref===t.ref)return Od(e,t,r)}return t.flags|=1,e=xd(i,s),e.ref=t.ref,e.return=t,t.child=e}function PV(e,t,n,s,r){if(e!==null){var i=e.memoizedProps;if(Zy(i,s)&&e.ref===t.ref)if(Ri=!1,t.pendingProps=s=i,eN(e,r))e.flags&131072&&(Ri=!0);else return t.lanes=e.lanes,Od(e,t,r)}return W8(e,t,n,s,r)}function OV(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 GD(e,t,i,n,s)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&h2(t,i!==null?i.cachePool:null),i!==null?LD(t,i):$8(),JU(t);else return s=t.lanes=536870912,GD(e,t,i!==null?i.baseLanes|n:n,n,s)}else i!==null?(h2(t,i.cachePool),LD(t,i),Dh(),t.memoizedState=null):(e!==null&&h2(t,null),$8(),Dh());return xo(e,t,r,n),t.child}function Kb(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function GD(e,t,n,s,r){var i=P9();return i=i===null?null:{parent:Mi._currentValue,pool:i},t.memoizedState={baseLanes:n,cachePool:i},e!==null&&h2(t,null),$8(),JU(t),e!==null&&m1(e,t,s,!0),t.childLanes=r,null}function p2(e,t){return t=x_({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function KD(e,t,n){return cp(t,e.child,null,n),e=p2(t,t.pendingProps),e.flags|=2,ll(t),t.memoizedState=null,e}function Gce(e,t,n){var s=t.pendingProps,r=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Hs){if(s.mode==="hidden")return e=p2(t,s),t.lanes=536870912,Kb(null,e);if(z8(t),(e=Ur)?(e=NW(e,Jl),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:pf!==null?{id:mu,overflow:pu}:null,retryLane:536870912,hydrationErrors:null},n=qU(e),n.return=t,t.child=n,To=t,Ur=null)):e=null,e===null)throw gf(t);return t.lanes=536870912,null}return p2(t,s)}var i=e.memoizedState;if(i!==null){var o=i.dehydrated;if(z8(t),r)if(t.flags&256)t.flags&=-257,t=KD(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(nt(558));else if(Ri||m1(e,t,n,!1),r=(n&e.childLanes)!==0,Ri||r){if(s=Ir,s!==null&&(o=mU(s,n),o!==0&&o!==i.retryLane))throw i.retryLane=o,Mp(e,o),Fa(s,e,o),Z9;__(),t=KD(e,t,n)}else e=i.treeContext,Ur=rc(o.nextSibling),To=t,Hs=!0,tf=null,Jl=!1,e!==null&&UU(t,e),t=p2(t,s),t.flags|=4096;return t}return e=xd(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function g2(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(nt(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function W8(e,t,n,s,r){return lp(t),n=F9(e,t,n,s,void 0,r),s=q9(),e!==null&&!Ri?(H9(e,t,r),Od(e,t,r)):(Hs&&s&&R9(t),t.flags|=1,xo(e,t,n,r),t.child)}function YD(e,t,n,s,r,i){return lp(t),t.updateQueue=null,n=eV(t,s,n,r),ZU(e),s=q9(),e!==null&&!Ri?(H9(e,t,i),Od(e,t,i)):(Hs&&s&&R9(t),t.flags|=1,xo(e,t,n,i),t.child)}function XD(e,t,n,s,r){if(lp(t),t.stateNode===null){var i=H0,o=n.contextType;typeof o=="object"&&o!==null&&(i=Eo(o)),i=new n(s,i),t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=U8,t.stateNode=i,i._reactInternals=t,i=t.stateNode,i.props=s,i.state=t.memoizedState,i.refs={},B9(t),o=n.contextType,i.context=typeof o=="object"&&o!==null?Eo(o):H0,i.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o=="function"&&(f5(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&&U8.enqueueReplaceState(i,i.state,null),vy(t,s,i,r),xy(),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){i=t.stateNode;var a=t.memoizedProps,c=dp(n,a);i.props=c;var u=i.context,d=n.contextType;o=H0,typeof d=="object"&&d!==null&&(o=Eo(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||u!==o)&&HD(t,i,s,o),Eh=!1;var m=t.memoizedState;i.state=m,vy(t,s,i,r),xy(),u=t.memoizedState,a||m!==u||Eh?(typeof h=="function"&&(f5(t,n,h,s),u=t.memoizedState),(c=Eh||qD(t,n,c,s,m,u,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=u),i.props=s,i.state=u,i.context=o,s=c):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{i=t.stateNode,O8(e,t),o=t.memoizedProps,d=dp(n,o),i.props=d,h=t.pendingProps,m=i.context,u=n.contextType,c=H0,typeof u=="object"&&u!==null&&(c=Eo(u)),a=n.getDerivedStateFromProps,(u=typeof a=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(o!==h||m!==c)&&HD(t,i,s,c),Eh=!1,m=t.memoizedState,i.state=m,vy(t,s,i,r),xy();var p=t.memoizedState;o!==h||m!==p||Eh||e!==null&&e.dependencies!==null&&h_(e.dependencies)?(typeof a=="function"&&(f5(t,n,a,s),p=t.memoizedState),(d=Eh||qD(t,n,d,s,m,p,c)||e!==null&&e.dependencies!==null&&h_(e.dependencies))?(u||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(s,p,c),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(s,p,c)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=p),i.props=s,i.state=p,i.context=c,s=d):(typeof i.componentDidUpdate!="function"||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),s=!1)}return i=s,g2(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=cp(t,e.child,null,r),t.child=cp(t,null,n,r)):xo(e,t,n,r),t.memoizedState=i.state,e=t.child):e=Od(e,t,r),e}function QD(e,t,n,s){return ap(),t.flags|=256,xo(e,t,n,s),t.child}var m5={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function p5(e){return{baseLanes:e,cachePool:WU()}}function g5(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=dl),e}function BV(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:(_i.current&2)!==0),o&&(r=!0,t.flags&=-129),o=(t.flags&32)!==0,t.flags&=-33,e===null){if(Hs){if(r?Rh(t):Dh(),(e=Ur)?(e=NW(e,Jl),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:pf!==null?{id:mu,overflow:pu}:null,retryLane:536870912,hydrationErrors:null},n=qU(e),n.return=t,t.child=n,To=t,Ur=null)):e=null,e===null)throw gf(t);return o7(e)?t.lanes=32:t.lanes=536870912,null}var a=s.children;return s=s.fallback,r?(Dh(),r=t.mode,a=x_({mode:"hidden",children:a},r),s=Qm(s,r,n,null),a.return=t,s.return=t,a.sibling=s,t.child=a,s=t.child,s.memoizedState=p5(n),s.childLanes=g5(e,o,n),t.memoizedState=m5,Kb(null,s)):(Rh(t),G8(t,a))}var c=e.memoizedState;if(c!==null&&(a=c.dehydrated,a!==null)){if(i)t.flags&256?(Rh(t),t.flags&=-257,t=b5(e,t,n)):t.memoizedState!==null?(Dh(),t.child=e.child,t.flags|=128,t=null):(Dh(),a=s.fallback,r=t.mode,s=x_({mode:"visible",children:s.children},r),a=Qm(a,r,n,null),a.flags|=2,s.return=t,a.return=t,s.sibling=a,t.child=s,cp(t,e.child,null,n),s=t.child,s.memoizedState=p5(n),s.childLanes=g5(e,o,n),t.memoizedState=m5,t=Kb(null,s));else if(Rh(t),o7(a)){if(o=a.nextSibling&&a.nextSibling.dataset,o)var u=o.dgst;o=u,s=Error(nt(419)),s.stack="",s.digest=o,tx({value:s,source:null,stack:null}),t=b5(e,t,n)}else if(Ri||m1(e,t,n,!1),o=(n&e.childLanes)!==0,Ri||o){if(o=Ir,o!==null&&(s=mU(o,n),s!==0&&s!==c.retryLane))throw c.retryLane=s,Mp(e,s),Fa(o,e,s),Z9;i7(a)||__(),t=b5(e,t,n)}else i7(a)?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,Ur=rc(a.nextSibling),To=t,Hs=!0,tf=null,Jl=!1,e!==null&&UU(t,e),t=G8(t,s.children),t.flags|=4096);return t}return r?(Dh(),a=s.fallback,r=t.mode,c=e.child,u=c.sibling,s=xd(c,{mode:"hidden",children:s.children}),s.subtreeFlags=c.subtreeFlags&65011712,u!==null?a=xd(u,a):(a=Qm(a,r,n,null),a.flags|=2),a.return=t,s.return=t,s.sibling=a,t.child=s,Kb(null,s),s=t.child,a=e.child.memoizedState,a===null?a=p5(n):(r=a.cachePool,r!==null?(c=Mi._currentValue,r=r.parent!==c?{parent:c,pool:c}:r):r=WU(),a={baseLanes:a.baseLanes|n,cachePool:r}),s.memoizedState=a,s.childLanes=g5(e,o,n),t.memoizedState=m5,Kb(e.child,s)):(Rh(t),n=e.child,e=n.sibling,n=xd(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 G8(e,t){return t=x_({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function x_(e,t){return e=ul(22,e,null,t),e.lanes=0,e}function b5(e,t,n){return cp(t,e.child,null,n),e=G8(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function JD(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),D8(e.return,t,n)}function y5(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 $V(e,t,n){var s=t.pendingProps,r=s.revealOrder,i=s.tail;s=s.children;var o=_i.current,a=(o&2)!==0;if(a?(o=o&1|2,t.flags|=128):o&=1,zr(_i,o),xo(e,t,s,n),s=Hs?ex:0,!a&&e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&JD(e,n,t);else if(e.tag===19)JD(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&&p_(e)===null&&(r=n),n=n.sibling;n=r,n===null?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null),y5(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&&p_(e)===null){t.child=r;break}e=r.sibling,r.sibling=n,n=r,r=e}y5(t,!0,n,null,i,s);break;case"together":y5(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function Od(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),yf|=t.lanes,!(n&t.childLanes))if(e!==null){if(m1(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(nt(153));if(t.child!==null){for(e=t.child,n=xd(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=xd(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function eN(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&h_(e)))}function Kce(e,t,n){switch(t.tag){case 3:i_(t,t.stateNode.containerInfo),Ih(t,Mi,e.memoizedState.cache),ap();break;case 27:case 5:w8(t);break;case 4:i_(t,t.stateNode.containerInfo);break;case 10:Ih(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,z8(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(Rh(t),t.flags|=128,null):n&t.child.childLanes?BV(e,t,n):(Rh(t),e=Od(e,t,n),e!==null?e.sibling:null);Rh(t);break;case 19:var r=(e.flags&128)!==0;if(s=(n&t.childLanes)!==0,s||(m1(e,t,n,!1),s=(n&t.childLanes)!==0),r){if(s)return $V(e,t,n);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),zr(_i,_i.current),s)break;return null;case 22:return t.lanes=0,OV(e,t,n,t.pendingProps);case 24:Ih(t,Mi,e.memoizedState.cache)}return Od(e,t,n)}function zV(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Ri=!0;else{if(!eN(e,n)&&!(t.flags&128))return Ri=!1,Kce(e,t,n);Ri=!!(e.flags&131072)}else Ri=!1,Hs&&t.flags&1048576&&HU(t,ex,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=Nm(t.elementType),t.type=e,typeof e=="function")I9(e)?(s=dp(e,s),t.tag=1,t=XD(null,t,e,s,n)):(t.tag=0,t=W8(null,t,e,s,n));else{if(e!=null){var r=e.$$typeof;if(r===y9){t.tag=11,t=VD(null,t,e,s,n);break e}else if(r===x9){t.tag=14,t=WD(null,t,e,s,n);break e}}throw t=x8(e)||e,Error(nt(306,t,""))}}return t;case 0:return W8(e,t,t.type,t.pendingProps,n);case 1:return s=t.type,r=dp(s,t.pendingProps),XD(e,t,s,r,n);case 3:e:{if(i_(t,t.stateNode.containerInfo),e===null)throw Error(nt(387));s=t.pendingProps;var i=t.memoizedState;r=i.element,O8(e,t),vy(t,s,null,n);var o=t.memoizedState;if(s=o.cache,Ih(t,Mi,s),s!==i.cache&&L8(t,[Mi],n,!0),xy(),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=QD(e,t,s,n);break e}else if(s!==r){r=Ql(Error(nt(424)),t),tx(r),t=QD(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(Ur=rc(e.firstChild),To=t,Hs=!0,tf=null,Jl=!0,n=YU(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(ap(),s===r){t=Od(e,t,n);break e}xo(e,t,s,n)}t=t.child}return t;case 26:return g2(e,t),e===null?(n=yL(t.type,null,t.pendingProps,null))?t.memoizedState=n:Hs||(n=t.type,e=t.pendingProps,s=E_(ef.current).createElement(n),s[Co]=t,s[Ua]=e,jo(s,n,e),ao(s),t.stateNode=s):t.memoizedState=yL(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return w8(t),e===null&&Hs&&(s=t.stateNode=jW(t.type,t.pendingProps,ef.current),To=t,Jl=!0,r=Ur,Hf(t.type)?(a7=r,Ur=rc(s.firstChild)):Ur=r),xo(e,t,t.pendingProps.children,n),g2(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Hs&&((r=s=Ur)&&(s=Sue(s,t.type,t.pendingProps,Jl),s!==null?(t.stateNode=s,To=t,Ur=rc(s.firstChild),Jl=!1,r=!0):r=!1),r||gf(t)),w8(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,s=i.children,s7(r,i)?s=null:o!==null&&s7(r,o)&&(t.flags|=32),t.memoizedState!==null&&(r=F9(e,t,$ce,null,null,n),ax._currentValue=r),g2(e,t),xo(e,t,s,n),t.child;case 6:return e===null&&Hs&&((e=n=Ur)&&(n=Cue(n,t.pendingProps,Jl),n!==null?(t.stateNode=n,To=t,Ur=null,e=!0):e=!1),e||gf(t)),null;case 13:return BV(e,t,n);case 4:return i_(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=cp(t,null,s,n):xo(e,t,s,n),t.child;case 11:return VD(e,t,t.type,t.pendingProps,n);case 7:return xo(e,t,t.pendingProps,n),t.child;case 8:return xo(e,t,t.pendingProps.children,n),t.child;case 12:return xo(e,t,t.pendingProps.children,n),t.child;case 10:return s=t.pendingProps,Ih(t,t.type,s.value),xo(e,t,s.children,n),t.child;case 9:return r=t.type._context,s=t.pendingProps.children,lp(t),r=Eo(r),s=s(r),t.flags|=1,xo(e,t,s,n),t.child;case 14:return WD(e,t,t.type,t.pendingProps,n);case 15:return PV(e,t,t.type,t.pendingProps,n);case 19:return $V(e,t,n);case 31:return Gce(e,t,n);case 22:return OV(e,t,n,t.pendingProps);case 24:return lp(t),s=Eo(Mi),e===null?(r=P9(),r===null&&(r=Ir,i=L9(),r.pooledCache=i,i.refCount++,i!==null&&(r.pooledCacheLanes|=n),r=i),t.memoizedState={parent:s,cache:r},B9(t),Ih(t,Mi,r)):(e.lanes&n&&(O8(e,t),vy(t,null,null,n),xy()),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),Ih(t,Mi,s)):(s=i.cache,Ih(t,Mi,s),s!==r.cache&&L8(t,[Mi],n,!0))),xo(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(nt(156,t.tag))}function Yu(e){e.flags|=4}function x5(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(uW())e.flags|=8192;else throw Zm=f_,O9}else e.flags&=-16777217}function ZD(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!RW(t))if(uW())e.flags|=8192;else throw Zm=f_,O9}function Rw(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?dU():536870912,e.lanes|=t,Ig|=t)}function xb(e,t){if(!Hs)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 Hr(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 Yce(e,t,n){var s=t.pendingProps;switch(D9(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Hr(t),null;case 1:return Hr(t),null;case 3:return n=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),vd(Mi),Tg(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(o0(t)?Yu(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,u5())),Hr(t),null;case 26:var r=t.type,i=t.memoizedState;return e===null?(Yu(t),i!==null?(Hr(t),ZD(t,i)):(Hr(t),x5(t,r,null,s,n))):i?i!==e.memoizedState?(Yu(t),Hr(t),ZD(t,i)):(Hr(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&Yu(t),Hr(t),x5(t,r,e,s,n)),null;case 27:if(o_(t),n=ef.current,r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&Yu(t);else{if(!s){if(t.stateNode===null)throw Error(nt(166));return Hr(t),null}e=_u.current,o0(t)?AD(t):(e=jW(r,s,n),t.stateNode=e,Yu(t))}return Hr(t),null;case 5:if(o_(t),r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&Yu(t);else{if(!s){if(t.stateNode===null)throw Error(nt(166));return Hr(t),null}if(i=_u.current,o0(t))AD(t);else{var o=E_(ef.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[Co]=t,i[Ua]=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(jo(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&&Yu(t)}}return Hr(t),x5(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&Yu(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(nt(166));if(e=ef.current,o0(t)){if(e=t.stateNode,n=t.memoizedProps,s=null,r=To,r!==null)switch(r.tag){case 27:case 5:s=r.memoizedProps}e[Co]=t,e=!!(e.nodeValue===n||s!==null&&s.suppressHydrationWarning===!0||TW(e.nodeValue,n)),e||gf(t,!0)}else e=E_(e).createTextNode(s),e[Co]=t,t.stateNode=e}return Hr(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(s=o0(t),n!==null){if(e===null){if(!s)throw Error(nt(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(nt(557));e[Co]=t}else ap(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Hr(t),e=!1}else n=u5(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(ll(t),t):(ll(t),null);if(t.flags&128)throw Error(nt(558))}return Hr(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=o0(t),s!==null&&s.dehydrated!==null){if(e===null){if(!r)throw Error(nt(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(nt(317));r[Co]=t}else ap(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Hr(t),r=!1}else r=u5(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(ll(t),t):(ll(t),null)}return ll(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),Rw(t,t.updateQueue),Hr(t),null);case 4:return Tg(),e===null&&aN(t.stateNode.containerInfo),Hr(t),null;case 10:return vd(t.type),Hr(t),null;case 19:if(uo(_i),s=t.memoizedState,s===null)return Hr(t),null;if(r=(t.flags&128)!==0,i=s.rendering,i===null)if(r)xb(s,!1);else{if(gi!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=p_(e),i!==null){for(t.flags|=128,xb(s,!1),e=i.updateQueue,t.updateQueue=e,Rw(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)FU(n,e),n=n.sibling;return zr(_i,_i.current&1|2),Hs&&id(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&ml()>w_&&(t.flags|=128,r=!0,xb(s,!1),t.lanes=4194304)}else{if(!r)if(e=p_(i),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,Rw(t,e),xb(s,!0),s.tail===null&&s.tailMode==="hidden"&&!i.alternate&&!Hs)return Hr(t),null}else 2*ml()-s.renderingStartTime>w_&&n!==536870912&&(t.flags|=128,r=!0,xb(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=ml(),e.sibling=null,n=_i.current,zr(_i,r?n&1|2:n&1),Hs&&id(t,s.treeForkCount),e):(Hr(t),null);case 22:case 23:return ll(t),$9(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?n&536870912&&!(t.flags&128)&&(Hr(t),t.subtreeFlags&6&&(t.flags|=8192)):Hr(t),n=t.updateQueue,n!==null&&Rw(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&&uo(Jm),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),vd(Mi),Hr(t),null;case 25:return null;case 30:return null}throw Error(nt(156,t.tag))}function Xce(e,t){switch(D9(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return vd(Mi),Tg(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return o_(t),null;case 31:if(t.memoizedState!==null){if(ll(t),t.alternate===null)throw Error(nt(340));ap()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ll(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(nt(340));ap()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return uo(_i),null;case 4:return Tg(),null;case 10:return vd(t.type),null;case 22:case 23:return ll(t),$9(),e!==null&&uo(Jm),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return vd(Mi),null;case 25:return null;default:return null}}function FV(e,t){switch(D9(t),t.tag){case 3:vd(Mi),Tg();break;case 26:case 27:case 5:o_(t);break;case 4:Tg();break;case 31:t.memoizedState!==null&&ll(t);break;case 13:ll(t);break;case 19:uo(_i);break;case 10:vd(t.type);break;case 22:case 23:ll(t),$9(),e!==null&&uo(Jm);break;case 24:vd(Mi)}}function cv(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){yr(t,t.return,a)}}function bf(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 c=n,u=a;try{u()}catch(d){yr(r,c,d)}}}s=s.next}while(s!==i)}}catch(d){yr(t,t.return,d)}}function qV(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{QU(t,n)}catch(s){yr(e,e.return,s)}}}function HV(e,t,n){n.props=dp(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(s){yr(e,t,s)}}function ky(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){yr(e,t,r)}}function gu(e,t){var n=e.ref,s=e.refCleanup;if(n!==null)if(typeof s=="function")try{s()}catch(r){yr(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){yr(e,t,r)}else n.current=null}function UV(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){yr(e,e.return,r)}}function v5(e,t,n){try{var s=e.stateNode;yue(s,e.type,n,t),s[Ua]=t}catch(r){yr(e,e.return,r)}}function VV(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Hf(e.type)||e.tag===4}function w5(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||VV(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&&Hf(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 K8(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=hd));else if(s!==4&&(s===27&&Hf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(K8(e,t,n),e=e.sibling;e!==null;)K8(e,t,n),e=e.sibling}function v_(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&&Hf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(v_(e,t,n),e=e.sibling;e!==null;)v_(e,t,n),e=e.sibling}function WV(e){var t=e.stateNode,n=e.memoizedProps;try{for(var s=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);jo(t,s,n),t[Co]=e,t[Ua]=n}catch(i){yr(e,e.return,i)}}var ad=!1,ji=!1,k5=!1,eL=typeof WeakSet=="function"?WeakSet:Set,io=null;function Qce(e,t){if(e=e.containerInfo,t7=M_,e=RU(e),N9(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,c=-1,u=0,d=0,h=e,m=null;t:for(;;){for(var p;h!==n||r!==0&&h.nodeType!==3||(a=o+r),h!==i||s!==0&&h.nodeType!==3||(c=o+s),h.nodeType===3&&(o+=h.nodeValue.length),(p=h.firstChild)!==null;)m=h,h=p;for(;;){if(h===e)break t;if(m===n&&++u===r&&(a=o),m===i&&++d===s&&(c=o),(p=h.nextSibling)!==null)break;h=m,m=h.parentNode}h=p}n=a===-1||c===-1?null:{start:a,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(n7={focusedElem:e,selectionRange:n},M_=!1,io=t;io!==null;)if(t=io,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,io=e;else for(;io!==null;){switch(t=io,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=dp(n.type,r);e=s.getSnapshotBeforeUpdate(g,i),s.__reactInternalSnapshotBeforeUpdate=e}catch(b){yr(n,n.return,b)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)r7(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":r7(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(nt(163))}if(e=t.sibling,e!==null){e.return=t.return,io=e;break}io=t.return}}function GV(e,t,n){var s=n.flags;switch(n.tag){case 0:case 11:case 15:Qu(e,n),s&4&&cv(5,n);break;case 1:if(Qu(e,n),s&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(o){yr(n,n.return,o)}else{var r=dp(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(o){yr(n,n.return,o)}}s&64&&qV(n),s&512&&ky(n,n.return);break;case 3:if(Qu(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{QU(e,t)}catch(o){yr(n,n.return,o)}}break;case 27:t===null&&s&4&&WV(n);case 26:case 5:Qu(e,n),t===null&&s&4&&UV(n),s&512&&ky(n,n.return);break;case 12:Qu(e,n);break;case 31:Qu(e,n),s&4&&XV(e,n);break;case 13:Qu(e,n),s&4&&QV(e,n),s&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=oue.bind(null,n),Tue(e,n))));break;case 22:if(s=n.memoizedState!==null||ad,!s){t=t!==null&&t.memoizedState!==null||ji,r=ad;var i=ji;ad=s,(ji=t)&&!i?sd(e,n,(n.subtreeFlags&8772)!==0):Qu(e,n),ad=r,ji=i}break;case 30:break;default:Qu(e,n)}}function KV(e){var t=e.alternate;t!==null&&(e.alternate=null,KV(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&_9(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 Xr=null,ja=!1;function Xu(e,t,n){for(n=n.child;n!==null;)YV(e,t,n),n=n.sibling}function YV(e,t,n){if(pl&&typeof pl.onCommitFiberUnmount=="function")try{pl.onCommitFiberUnmount(nv,n)}catch{}switch(n.tag){case 26:ji||gu(n,t),Xu(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:ji||gu(n,t);var s=Xr,r=ja;Hf(n.type)&&(Xr=n.stateNode,ja=!1),Xu(e,t,n),Ty(n.stateNode),Xr=s,ja=r;break;case 5:ji||gu(n,t);case 6:if(s=Xr,r=ja,Xr=null,Xu(e,t,n),Xr=s,ja=r,Xr!==null)if(ja)try{(Xr.nodeType===9?Xr.body:Xr.nodeName==="HTML"?Xr.ownerDocument.body:Xr).removeChild(n.stateNode)}catch(i){yr(n,t,i)}else try{Xr.removeChild(n.stateNode)}catch(i){yr(n,t,i)}break;case 18:Xr!==null&&(ja?(e=Xr,fL(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Pg(e)):fL(Xr,n.stateNode));break;case 4:s=Xr,r=ja,Xr=n.stateNode.containerInfo,ja=!0,Xu(e,t,n),Xr=s,ja=r;break;case 0:case 11:case 14:case 15:bf(2,n,t),ji||bf(4,n,t),Xu(e,t,n);break;case 1:ji||(gu(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"&&HV(n,t,s)),Xu(e,t,n);break;case 21:Xu(e,t,n);break;case 22:ji=(s=ji)||n.memoizedState!==null,Xu(e,t,n),ji=s;break;default:Xu(e,t,n)}}function XV(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Pg(e)}catch(n){yr(t,t.return,n)}}}function QV(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Pg(e)}catch(n){yr(t,t.return,n)}}function Jce(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new eL),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new eL),t;default:throw Error(nt(435,e.tag))}}function Dw(e,t){var n=Jce(e);t.forEach(function(s){if(!n.has(s)){n.add(s);var r=aue.bind(null,e,s);s.then(r,r)}})}function Sa(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(Hf(a.type)){Xr=a.stateNode,ja=!1;break e}break;case 5:Xr=a.stateNode,ja=!1;break e;case 3:case 4:Xr=a.stateNode.containerInfo,ja=!0;break e}a=a.return}if(Xr===null)throw Error(nt(160));YV(i,o,r),Xr=null,ja=!1,i=r.alternate,i!==null&&(i.return=null),r.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)JV(t,e),t=t.sibling}var wc=null;function JV(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Sa(t,e),Ca(e),s&4&&(bf(3,e,e.return),cv(3,e),bf(5,e,e.return));break;case 1:Sa(t,e),Ca(e),s&512&&(ji||n===null||gu(n,n.return)),s&64&&ad&&(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=wc;if(Sa(t,e),Ca(e),s&512&&(ji||n===null||gu(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[iv]||i[Co]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=r.createElement(s),r.head.insertBefore(i,r.querySelector("head > title"))),jo(i,s,n),i[Co]=e,ao(i),s=i;break e;case"link":var o=vL("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),jo(i,s,n),r.head.appendChild(i);break;case"meta":if(o=vL("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),jo(i,s,n),r.head.appendChild(i);break;default:throw Error(nt(468,s))}i[Co]=e,ao(i),s=i}e.stateNode=s}else wL(r,e.type,e.stateNode);else e.stateNode=xL(r,s,e.memoizedProps);else i!==s?(i===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):i.count--,s===null?wL(r,e.type,e.stateNode):xL(r,s,e.memoizedProps)):s===null&&e.stateNode!==null&&v5(e,e.memoizedProps,n.memoizedProps)}break;case 27:Sa(t,e),Ca(e),s&512&&(ji||n===null||gu(n,n.return)),n!==null&&s&4&&v5(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Sa(t,e),Ca(e),s&512&&(ji||n===null||gu(n,n.return)),e.flags&32){r=e.stateNode;try{Ag(r,"")}catch(g){yr(e,e.return,g)}}s&4&&e.stateNode!=null&&(r=e.memoizedProps,v5(e,r,n!==null?n.memoizedProps:r)),s&1024&&(k5=!0);break;case 6:if(Sa(t,e),Ca(e),s&4){if(e.stateNode===null)throw Error(nt(162));s=e.memoizedProps,n=e.stateNode;try{n.nodeValue=s}catch(g){yr(e,e.return,g)}}break;case 3:if(x2=null,r=wc,wc=A_(t.containerInfo),Sa(t,e),wc=r,Ca(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{Pg(t.containerInfo)}catch(g){yr(e,e.return,g)}k5&&(k5=!1,ZV(e));break;case 4:s=wc,wc=A_(e.stateNode.containerInfo),Sa(t,e),Ca(e),wc=s;break;case 12:Sa(t,e),Ca(e);break;case 31:Sa(t,e),Ca(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Dw(e,s)));break;case 13:Sa(t,e),Ca(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(S4=ml()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Dw(e,s)));break;case 22:r=e.memoizedState!==null;var c=n!==null&&n.memoizedState!==null,u=ad,d=ji;if(ad=u||r,ji=d||c,Sa(t,e),ji=d,ad=u,Ca(e),s&8192)e:for(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,r&&(n===null||c||ad||ji||jm(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){c=n=t;try{if(i=c.stateNode,r)o=i.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none";else{a=c.stateNode;var h=c.memoizedProps.style,m=h!=null&&h.hasOwnProperty("display")?h.display:null;a.style.display=m==null||typeof m=="boolean"?"":(""+m).trim()}}catch(g){yr(c,c.return,g)}}}else if(t.tag===6){if(n===null){c=t;try{c.stateNode.nodeValue=r?"":c.memoizedProps}catch(g){yr(c,c.return,g)}}}else if(t.tag===18){if(n===null){c=t;try{var p=c.stateNode;r?mL(p,!0):mL(c.stateNode,!1)}catch(g){yr(c,c.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,Dw(e,n))));break;case 19:Sa(t,e),Ca(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Dw(e,s)));break;case 30:break;case 21:break;default:Sa(t,e),Ca(e)}}function Ca(e){var t=e.flags;if(t&2){try{for(var n,s=e.return;s!==null;){if(VV(s)){n=s;break}s=s.return}if(n==null)throw Error(nt(160));switch(n.tag){case 27:var r=n.stateNode,i=w5(e);v_(e,i,r);break;case 5:var o=n.stateNode;n.flags&32&&(Ag(o,""),n.flags&=-33);var a=w5(e);v_(e,a,o);break;case 3:case 4:var c=n.stateNode.containerInfo,u=w5(e);K8(e,u,c);break;default:throw Error(nt(161))}}catch(d){yr(e,e.return,d)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ZV(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;ZV(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Qu(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)GV(e,t.alternate,t),t=t.sibling}function jm(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:bf(4,t,t.return),jm(t);break;case 1:gu(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&HV(t,t.return,n),jm(t);break;case 27:Ty(t.stateNode);case 26:case 5:gu(t,t.return),jm(t);break;case 22:t.memoizedState===null&&jm(t);break;case 30:jm(t);break;default:jm(t)}e=e.sibling}}function sd(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:sd(r,i,n),cv(4,i);break;case 1:if(sd(r,i,n),s=i,r=s.stateNode,typeof r.componentDidMount=="function")try{r.componentDidMount()}catch(u){yr(s,s.return,u)}if(s=i,r=s.updateQueue,r!==null){var a=s.stateNode;try{var c=r.shared.hiddenCallbacks;if(c!==null)for(r.shared.hiddenCallbacks=null,r=0;r<c.length;r++)XU(c[r],a)}catch(u){yr(s,s.return,u)}}n&&o&64&&qV(i),ky(i,i.return);break;case 27:WV(i);case 26:case 5:sd(r,i,n),n&&s===null&&o&4&&UV(i),ky(i,i.return);break;case 12:sd(r,i,n);break;case 31:sd(r,i,n),n&&o&4&&XV(r,i);break;case 13:sd(r,i,n),n&&o&4&&QV(r,i);break;case 22:i.memoizedState===null&&sd(r,i,n),ky(i,i.return);break;case 30:break;default:sd(r,i,n)}t=t.sibling}}function tN(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&&av(n))}function nN(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&av(e))}function bc(e,t,n,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)eW(e,t,n,s),t=t.sibling}function eW(e,t,n,s){var r=t.flags;switch(t.tag){case 0:case 11:case 15:bc(e,t,n,s),r&2048&&cv(9,t);break;case 1:bc(e,t,n,s);break;case 3:bc(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&&av(e)));break;case 12:if(r&2048){bc(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(c){yr(t,t.return,c)}}else bc(e,t,n,s);break;case 31:bc(e,t,n,s);break;case 13:bc(e,t,n,s);break;case 23:break;case 22:i=t.stateNode,o=t.alternate,t.memoizedState!==null?i._visibility&2?bc(e,t,n,s):_y(e,t):i._visibility&2?bc(e,t,n,s):(i._visibility|=2,E0(e,t,n,s,(t.subtreeFlags&10256)!==0||!1)),r&2048&&tN(o,t);break;case 24:bc(e,t,n,s),r&2048&&nN(t.alternate,t);break;default:bc(e,t,n,s)}}function E0(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,c=s,u=o.flags;switch(o.tag){case 0:case 11:case 15:E0(i,o,a,c,r),cv(8,o);break;case 23:break;case 22:var d=o.stateNode;o.memoizedState!==null?d._visibility&2?E0(i,o,a,c,r):_y(i,o):(d._visibility|=2,E0(i,o,a,c,r)),r&&u&2048&&tN(o.alternate,o);break;case 24:E0(i,o,a,c,r),r&&u&2048&&nN(o.alternate,o);break;default:E0(i,o,a,c,r)}t=t.sibling}}function _y(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:_y(n,s),r&2048&&tN(s.alternate,s);break;case 24:_y(n,s),r&2048&&nN(s.alternate,s);break;default:_y(n,s)}t=t.sibling}}var Yb=8192;function a0(e,t,n){if(e.subtreeFlags&Yb)for(e=e.child;e!==null;)tW(e,t,n),e=e.sibling}function tW(e,t,n){switch(e.tag){case 26:a0(e,t,n),e.flags&Yb&&e.memoizedState!==null&&Bue(n,wc,e.memoizedState,e.memoizedProps);break;case 5:a0(e,t,n);break;case 3:case 4:var s=wc;wc=A_(e.stateNode.containerInfo),a0(e,t,n),wc=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Yb,Yb=16777216,a0(e,t,n),Yb=s):a0(e,t,n));break;default:a0(e,t,n)}}function nW(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 vb(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var s=t[n];io=s,rW(s,e)}nW(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)sW(e),e=e.sibling}function sW(e){switch(e.tag){case 0:case 11:case 15:vb(e),e.flags&2048&&bf(9,e,e.return);break;case 3:vb(e);break;case 12:vb(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,b2(e)):vb(e);break;default:vb(e)}}function b2(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var s=t[n];io=s,rW(s,e)}nW(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:bf(8,t,t.return),b2(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,b2(t));break;default:b2(t)}e=e.sibling}}function rW(e,t){for(;io!==null;){var n=io;switch(n.tag){case 0:case 11:case 15:bf(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:av(n.memoizedState.cache)}if(s=n.child,s!==null)s.return=n,io=s;else e:for(n=e;io!==null;){s=io;var r=s.sibling,i=s.return;if(KV(s),s===n){io=null;break e}if(r!==null){r.return=i,io=r;break e}io=i}}}var Zce={getCacheForType:function(e){var t=Eo(Mi),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Eo(Mi).controller.signal}},eue=typeof WeakMap=="function"?WeakMap:Map,cr=0,Ir=null,js=null,Ps=0,br=0,ol=null,zh=!1,g1=!1,sN=!1,Bd=0,gi=0,yf=0,ep=0,rN=0,dl=0,Ig=0,Sy=null,Ma=null,Y8=!1,S4=0,iW=0,w_=1/0,k_=null,rf=null,Vi=0,of=null,Rg=null,wd=0,X8=0,Q8=null,oW=null,Cy=0,J8=null;function bl(){return cr&2&&Ps!==0?Ps&-Ps:Yn.T!==null?oN():pU()}function aW(){if(dl===0)if(!(Ps&536870912)||Hs){var e=Tw;Tw<<=1,!(Tw&3932160)&&(Tw=262144),dl=e}else dl=536870912;return e=kl.current,e!==null&&(e.flags|=32),dl}function Fa(e,t,n){(e===Ir&&(br===2||br===9)||e.cancelPendingCommit!==null)&&(Dg(e,0),Fh(e,Ps,dl,!1)),rv(e,n),(!(cr&2)||e!==Ir)&&(e===Ir&&(!(cr&2)&&(ep|=n),gi===4&&Fh(e,Ps,dl,!1)),Iu(e))}function lW(e,t,n){if(cr&6)throw Error(nt(327));var s=!n&&(t&127)===0&&(t&e.expiredLanes)===0||sv(e,t),r=s?sue(e,t):_5(e,t,!0),i=s;do{if(r===0){g1&&!s&&Fh(e,t,0,!1);break}else{if(n=e.current.alternate,i&&!tue(n)){r=_5(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=Sy;var c=a.current.memoizedState.isDehydrated;if(c&&(Dg(a,o).flags|=256),o=_5(a,o,!1),o!==2){if(sN&&!c){a.errorRecoveryDisabledLanes|=i,ep|=i,r=4;break e}i=Ma,Ma=r,i!==null&&(Ma===null?Ma=i:Ma.push.apply(Ma,i))}r=o}if(i=!1,r!==2)continue}}if(r===1){Dg(e,0),Fh(e,t,0,!0);break}e:{switch(s=e,i=r,i){case 0:case 1:throw Error(nt(345));case 4:if((t&4194048)!==t)break;case 6:Fh(s,t,dl,!zh);break e;case 2:Ma=null;break;case 3:case 5:break;default:throw Error(nt(329))}if((t&62914560)===t&&(r=S4+300-ml(),10<r)){if(Fh(s,t,dl,!zh),f4(s,0,!0)!==0)break e;wd=t,s.timeoutHandle=AW(tL.bind(null,s,n,Ma,k_,Y8,t,dl,ep,Ig,zh,i,"Throttled",-0,0),r);break e}tL(s,n,Ma,k_,Y8,t,dl,ep,Ig,zh,i,null,-0,0)}}break}while(!0);Iu(e)}function tL(e,t,n,s,r,i,o,a,c,u,d,h,m,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:hd},tW(t,i,h);var g=(i&62914560)===i?S4-ml():(i&4194048)===i?iW-ml():0;if(g=$ue(h,g),g!==null){wd=i,e.cancelPendingCommit=g(sL.bind(null,e,t,i,n,s,r,o,a,c,d,h,null,m,p)),Fh(e,i,o,!u);return}}sL(e,t,i,n,s,r,o,a,c)}function tue(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(!wl(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 Fh(e,t,n,s){t&=~rN,t&=~ep,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var r=t;0<r;){var i=31-gl(r),o=1<<i;s[i]=-1,r&=~o}n!==0&&hU(e,n,t)}function C4(){return cr&6?!0:(uv(0),!1)}function iN(){if(js!==null){if(br===0)var e=js.return;else e=js,fd=Ip=null,U9(e),ig=null,nx=0,e=js;for(;e!==null;)FV(e.alternate,e),e=e.return;js=null}}function Dg(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,wue(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),wd=0,iN(),Ir=e,js=n=xd(e.current,null),Ps=t,br=0,ol=null,zh=!1,g1=sv(e,t),sN=!1,Ig=dl=rN=ep=yf=gi=0,Ma=Sy=null,Y8=!1,t&8&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var r=31-gl(s),i=1<<r;t|=e[r],s&=~i}return Bd=t,b4(),n}function cW(e,t){ps=null,Yn.H=rx,t===p1||t===x4?(t=RD(),br=3):t===O9?(t=RD(),br=4):br=t===Z9?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,ol=t,js===null&&(gi=1,y_(e,Ql(t,e.current)))}function uW(){var e=kl.current;return e===null?!0:(Ps&4194048)===Ps?sc===null:(Ps&62914560)===Ps||Ps&536870912?e===sc:!1}function dW(){var e=Yn.H;return Yn.H=rx,e===null?rx:e}function hW(){var e=Yn.A;return Yn.A=Zce,e}function __(){gi=4,zh||(Ps&4194048)!==Ps&&kl.current!==null||(g1=!0),!(yf&134217727)&&!(ep&134217727)||Ir===null||Fh(Ir,Ps,dl,!1)}function _5(e,t,n){var s=cr;cr|=2;var r=dW(),i=hW();(Ir!==e||Ps!==t)&&(k_=null,Dg(e,t)),t=!1;var o=gi;e:do try{if(br!==0&&js!==null){var a=js,c=ol;switch(br){case 8:iN(),o=6;break e;case 3:case 2:case 9:case 6:kl.current===null&&(t=!0);var u=br;if(br=0,ol=null,W0(e,a,c,u),n&&g1){o=0;break e}break;default:u=br,br=0,ol=null,W0(e,a,c,u)}}nue(),o=gi;break}catch(d){cW(e,d)}while(!0);return t&&e.shellSuspendCounter++,fd=Ip=null,cr=s,Yn.H=r,Yn.A=i,js===null&&(Ir=null,Ps=0,b4()),o}function nue(){for(;js!==null;)fW(js)}function sue(e,t){var n=cr;cr|=2;var s=dW(),r=hW();Ir!==e||Ps!==t?(k_=null,w_=ml()+500,Dg(e,t)):g1=sv(e,t);e:do try{if(br!==0&&js!==null){t=js;var i=ol;t:switch(br){case 1:br=0,ol=null,W0(e,t,i,1);break;case 2:case 9:if(ID(i)){br=0,ol=null,nL(t);break}t=function(){br!==2&&br!==9||Ir!==e||(br=7),Iu(e)},i.then(t,t);break e;case 3:br=7;break e;case 4:br=5;break e;case 7:ID(i)?(br=0,ol=null,nL(t)):(br=0,ol=null,W0(e,t,i,7));break;case 5:var o=null;switch(js.tag){case 26:o=js.memoizedState;case 5:case 27:var a=js;if(o?RW(o):a.stateNode.complete){br=0,ol=null;var c=a.sibling;if(c!==null)js=c;else{var u=a.return;u!==null?(js=u,T4(u)):js=null}break t}}br=0,ol=null,W0(e,t,i,5);break;case 6:br=0,ol=null,W0(e,t,i,6);break;case 8:iN(),gi=6;break e;default:throw Error(nt(462))}}rue();break}catch(d){cW(e,d)}while(!0);return fd=Ip=null,Yn.H=s,Yn.A=r,cr=n,js!==null?0:(Ir=null,Ps=0,b4(),gi)}function rue(){for(;js!==null&&!Ele();)fW(js)}function fW(e){var t=zV(e.alternate,e,Bd);e.memoizedProps=e.pendingProps,t===null?T4(e):js=t}function nL(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=YD(n,t,t.pendingProps,t.type,void 0,Ps);break;case 11:t=YD(n,t,t.pendingProps,t.type.render,t.ref,Ps);break;case 5:U9(t);default:FV(n,t),t=js=FU(t,Bd),t=zV(n,t,Bd)}e.memoizedProps=e.pendingProps,t===null?T4(e):js=t}function W0(e,t,n,s){fd=Ip=null,U9(t),ig=null,nx=0;var r=t.return;try{if(Wce(e,r,t,n,Ps)){gi=1,y_(e,Ql(n,e.current)),js=null;return}}catch(i){if(r!==null)throw js=r,i;gi=1,y_(e,Ql(n,e.current)),js=null;return}t.flags&32768?(Hs||s===1?e=!0:g1||Ps&536870912?e=!1:(zh=e=!0,(s===2||s===9||s===3||s===6)&&(s=kl.current,s!==null&&s.tag===13&&(s.flags|=16384))),mW(t,e)):T4(t)}function T4(e){var t=e;do{if(t.flags&32768){mW(t,zh);return}e=t.return;var n=Yce(t.alternate,t,Bd);if(n!==null){js=n;return}if(t=t.sibling,t!==null){js=t;return}js=t=e}while(t!==null);gi===0&&(gi=5)}function mW(e,t){do{var n=Xce(e.alternate,e);if(n!==null){n.flags&=32767,js=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){js=e;return}js=e=n}while(e!==null);gi=6,js=null}function sL(e,t,n,s,r,i,o,a,c){e.cancelPendingCommit=null;do E4();while(Vi!==0);if(cr&6)throw Error(nt(327));if(t!==null){if(t===e.current)throw Error(nt(177));if(i=t.lanes|t.childLanes,i|=j9,Ole(e,n,i,o,a,c),e===Ir&&(js=Ir=null,Ps=0),Rg=t,of=e,wd=n,X8=i,Q8=r,oW=s,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,lue(a_,function(){return xW(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,t.subtreeFlags&13878||s){s=Yn.T,Yn.T=null,r=dr.p,dr.p=2,o=cr,cr|=4;try{Qce(e,t,n)}finally{cr=o,dr.p=r,Yn.T=s}}Vi=1,pW(),gW(),bW()}}function pW(){if(Vi===1){Vi=0;var e=of,t=Rg,n=(t.flags&13878)!==0;if(t.subtreeFlags&13878||n){n=Yn.T,Yn.T=null;var s=dr.p;dr.p=2;var r=cr;cr|=4;try{JV(t,e);var i=n7,o=RU(e.containerInfo),a=i.focusedElem,c=i.selectionRange;if(o!==a&&a&&a.ownerDocument&&IU(a.ownerDocument.documentElement,a)){if(c!==null&&N9(a)){var u=c.start,d=c.end;if(d===void 0&&(d=u),"selectionStart"in a)a.selectionStart=u,a.selectionEnd=Math.min(d,a.value.length);else{var h=a.ownerDocument||document,m=h&&h.defaultView||window;if(m.getSelection){var p=m.getSelection(),g=a.textContent.length,b=Math.min(c.start,g),v=c.end===void 0?b:Math.min(c.end,g);!p.extend&&b>v&&(o=v,v=b,b=o);var x=CD(a,b),y=CD(a,v);if(x&&y&&(p.rangeCount!==1||p.anchorNode!==x.node||p.anchorOffset!==x.offset||p.focusNode!==y.node||p.focusOffset!==y.offset)){var w=h.createRange();w.setStart(x.node,x.offset),p.removeAllRanges(),b>v?(p.addRange(w),p.extend(y.node,y.offset)):(w.setEnd(y.node,y.offset),p.addRange(w))}}}}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}}M_=!!t7,n7=t7=null}finally{cr=r,dr.p=s,Yn.T=n}}e.current=t,Vi=2}}function gW(){if(Vi===2){Vi=0;var e=of,t=Rg,n=(t.flags&8772)!==0;if(t.subtreeFlags&8772||n){n=Yn.T,Yn.T=null;var s=dr.p;dr.p=2;var r=cr;cr|=4;try{GV(e,t.alternate,t)}finally{cr=r,dr.p=s,Yn.T=n}}Vi=3}}function bW(){if(Vi===4||Vi===3){Vi=0,Ale();var e=of,t=Rg,n=wd,s=oW;t.subtreeFlags&10256||t.flags&10256?Vi=5:(Vi=0,Rg=of=null,yW(e,e.pendingLanes));var r=e.pendingLanes;if(r===0&&(rf=null),k9(n),t=t.stateNode,pl&&typeof pl.onCommitFiberRoot=="function")try{pl.onCommitFiberRoot(nv,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=Yn.T,r=dr.p,dr.p=2,Yn.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{Yn.T=t,dr.p=r}}wd&3&&E4(),Iu(e),r=e.pendingLanes,n&261930&&r&42?e===J8?Cy++:(Cy=0,J8=e):Cy=0,uv(0)}}function yW(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,av(t)))}function E4(){return pW(),gW(),bW(),xW()}function xW(){if(Vi!==5)return!1;var e=of,t=X8;X8=0;var n=k9(wd),s=Yn.T,r=dr.p;try{dr.p=32>n?32:n,Yn.T=null,n=Q8,Q8=null;var i=of,o=wd;if(Vi=0,Rg=of=null,wd=0,cr&6)throw Error(nt(331));var a=cr;if(cr|=4,sW(i.current),eW(i,i.current,o,n),cr=a,uv(0,!1),pl&&typeof pl.onPostCommitFiberRoot=="function")try{pl.onPostCommitFiberRoot(nv,i)}catch{}return!0}finally{dr.p=r,Yn.T=s,yW(e,t)}}function rL(e,t,n){t=Ql(n,t),t=V8(e.stateNode,t,2),e=sf(e,t,2),e!==null&&(rv(e,2),Iu(e))}function yr(e,t,n){if(e.tag===3)rL(e,e,n);else for(;t!==null;){if(t.tag===3){rL(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(rf===null||!rf.has(s))){e=Ql(n,e),n=DV(2),s=sf(t,n,2),s!==null&&(LV(n,s,t,e),rv(s,2),Iu(s));break}}t=t.return}}function S5(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new eue;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)||(sN=!0,r.add(n),e=iue.bind(null,e,t,n),t.then(e,e))}function iue(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ir===e&&(Ps&n)===n&&(gi===4||gi===3&&(Ps&62914560)===Ps&&300>ml()-S4?!(cr&2)&&Dg(e,0):rN|=n,Ig===Ps&&(Ig=0)),Iu(e)}function vW(e,t){t===0&&(t=dU()),e=Mp(e,t),e!==null&&(rv(e,t),Iu(e))}function oue(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),vW(e,n)}function aue(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(nt(314))}s!==null&&s.delete(t),vW(e,n)}function lue(e,t){return v9(e,t)}var S_=null,A0=null,Z8=!1,C_=!1,C5=!1,qh=0;function Iu(e){e!==A0&&e.next===null&&(A0===null?S_=A0=e:A0=A0.next=e),C_=!0,Z8||(Z8=!0,uue())}function uv(e,t){if(!C5&&C_){C5=!0;do for(var n=!1,s=S_;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-gl(42|e)+1)-1,i&=r&~(o&~a),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(n=!0,iL(s,i))}else i=Ps,i=f4(s,s===Ir?i:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),!(i&3)||sv(s,i)||(n=!0,iL(s,i));s=s.next}while(n);C5=!1}}function cue(){wW()}function wW(){C_=Z8=!1;var e=0;qh!==0&&vue()&&(e=qh);for(var t=ml(),n=null,s=S_;s!==null;){var r=s.next,i=kW(s,t);i===0?(s.next=null,n===null?S_=r:n.next=r,r===null&&(A0=n)):(n=s,(e!==0||i&3)&&(C_=!0)),s=r}Vi!==0&&Vi!==5||uv(e),qh!==0&&(qh=0)}function kW(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,r=e.expirationTimes,i=e.pendingLanes&-62914561;0<i;){var o=31-gl(i),a=1<<o,c=r[o];c===-1?(!(a&n)||a&s)&&(r[o]=Ple(a,t)):c<=t&&(e.expiredLanes|=a),i&=~a}if(t=Ir,n=Ps,n=f4(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,n===0||e===t&&(br===2||br===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&ZC(s),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||sv(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(s!==null&&ZC(s),k9(n)){case 2:case 8:n=cU;break;case 32:n=a_;break;case 268435456:n=uU;break;default:n=a_}return s=_W.bind(null,e),n=v9(n,s),e.callbackPriority=t,e.callbackNode=n,t}return s!==null&&s!==null&&ZC(s),e.callbackPriority=2,e.callbackNode=null,2}function _W(e,t){if(Vi!==0&&Vi!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(E4()&&e.callbackNode!==n)return null;var s=Ps;return s=f4(e,e===Ir?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(lW(e,s,t),kW(e,ml()),e.callbackNode!=null&&e.callbackNode===n?_W.bind(null,e):null)}function iL(e,t){if(E4())return null;lW(e,t,!0)}function uue(){kue(function(){cr&6?v9(lU,cue):wW()})}function oN(){if(qh===0){var e=Ng;e===0&&(e=Cw,Cw<<=1,!(Cw&261888)&&(Cw=256)),qh=e}return qh}function oL(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:l2(""+e)}function aL(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 due(e,t,n,s,r){if(t==="submit"&&n&&n.stateNode===r){var i=oL((r[Ua]||null).action),o=s.submitter;o&&(t=(t=o[Ua]||null)?oL(t.formAction):o.getAttribute("formAction"),t!==null&&(i=t,o=null));var a=new m4("action","action",null,s,r);e.push({event:a,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(qh!==0){var c=o?aL(r,o):new FormData(r);H8(n,{pending:!0,data:c,method:r.method,action:i},null,c)}}else typeof i=="function"&&(a.preventDefault(),c=o?aL(r,o):new FormData(r),H8(n,{pending:!0,data:c,method:r.method,action:i},i,c))},currentTarget:r}]})}}for(var T5=0;T5<M8.length;T5++){var E5=M8[T5],hue=E5.toLowerCase(),fue=E5[0].toUpperCase()+E5.slice(1);Nc(hue,"on"+fue)}Nc(LU,"onAnimationEnd");Nc(PU,"onAnimationIteration");Nc(OU,"onAnimationStart");Nc("dblclick","onDoubleClick");Nc("focusin","onFocus");Nc("focusout","onBlur");Nc(Nce,"onTransitionRun");Nc(jce,"onTransitionStart");Nc(Mce,"onTransitionCancel");Nc(BU,"onTransitionEnd");Eg("onMouseEnter",["mouseout","mouseover"]);Eg("onMouseLeave",["mouseout","mouseover"]);Eg("onPointerEnter",["pointerout","pointerover"]);Eg("onPointerLeave",["pointerout","pointerover"]);Ap("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Ap("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Ap("onBeforeInput",["compositionend","keypress","textInput","paste"]);Ap("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Ap("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Ap("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ix="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(" "),mue=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ix));function SW(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],c=a.instance,u=a.currentTarget;if(a=a.listener,c!==i&&r.isPropagationStopped())break e;i=a,r.currentTarget=u;try{i(r)}catch(d){c_(d)}r.currentTarget=null,i=c}else for(o=0;o<s.length;o++){if(a=s[o],c=a.instance,u=a.currentTarget,a=a.listener,c!==i&&r.isPropagationStopped())break e;i=a,r.currentTarget=u;try{i(r)}catch(d){c_(d)}r.currentTarget=null,i=c}}}}function Ns(e,t){var n=t[_8];n===void 0&&(n=t[_8]=new Set);var s=e+"__bubble";n.has(s)||(CW(t,e,2,!1),n.add(s))}function A5(e,t,n){var s=0;t&&(s|=4),CW(n,e,s,t)}var Lw="_reactListening"+Math.random().toString(36).slice(2);function aN(e){if(!e[Lw]){e[Lw]=!0,gU.forEach(function(n){n!=="selectionchange"&&(mue.has(n)||A5(n,!1,e),A5(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Lw]||(t[Lw]=!0,A5("selectionchange",!1,t))}}function CW(e,t,n,s){switch(BW(t)){case 2:var r=que;break;case 8:r=Hue;break;default:r=dN}n=r.bind(null,t,n,e),r=void 0,!A8||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 N5(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 c=o.tag;if((c===3||c===4)&&o.stateNode.containerInfo===r)return;o=o.return}for(;a!==null;){if(o=O0(a),o===null)return;if(c=o.tag,c===5||c===6||c===26||c===27){s=i=o;continue e}a=a.parentNode}}s=s.return}SU(function(){var u=i,d=C9(n),h=[];e:{var m=$U.get(e);if(m!==void 0){var p=m4,g=e;switch(e){case"keypress":if(u2(n)===0)break e;case"keydown":case"keyup":p=ace;break;case"focusin":g="focus",p=r5;break;case"focusout":g="blur",p=r5;break;case"beforeblur":case"afterblur":p=r5;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=pD;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=Yle;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=uce;break;case LU:case PU:case OU:p=Jle;break;case BU:p=hce;break;case"scroll":case"scrollend":p=Gle;break;case"wheel":p=mce;break;case"copy":case"cut":case"paste":p=ece;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=bD;break;case"toggle":case"beforetoggle":p=gce}var b=(t&4)!==0,v=!b&&(e==="scroll"||e==="scrollend"),x=b?m!==null?m+"Capture":null:m;b=[];for(var y=u,w;y!==null;){var k=y;if(w=k.stateNode,k=k.tag,k!==5&&k!==26&&k!==27||w===null||x===null||(k=Qy(y,x),k!=null&&b.push(ox(y,k,w))),v)break;y=y.return}0<b.length&&(m=new p(m,g,null,n,d),h.push({event:m,listeners:b}))}}if(!(t&7)){e:{if(m=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",m&&n!==E8&&(g=n.relatedTarget||n.fromElement)&&(O0(g)||g[h1]))break e;if((p||m)&&(m=d.window===d?d:(m=d.ownerDocument)?m.defaultView||m.parentWindow:window,p?(g=n.relatedTarget||n.toElement,p=u,g=g?O0(g):null,g!==null&&(v=tv(g),b=g.tag,g!==v||b!==5&&b!==27&&b!==6)&&(g=null)):(p=null,g=u),p!==g)){if(b=pD,k="onMouseLeave",x="onMouseEnter",y="mouse",(e==="pointerout"||e==="pointerover")&&(b=bD,k="onPointerLeave",x="onPointerEnter",y="pointer"),v=p==null?m:Gb(p),w=g==null?m:Gb(g),m=new b(k,y+"leave",p,n,d),m.target=v,m.relatedTarget=w,k=null,O0(d)===u&&(b=new b(x,y+"enter",g,n,d),b.target=w,b.relatedTarget=v,k=b),v=k,p&&g)t:{for(b=pue,x=p,y=g,w=0,k=x;k;k=b(k))w++;k=0;for(var T=y;T;T=b(T))k++;for(;0<w-k;)x=b(x),w--;for(;0<k-w;)y=b(y),k--;for(;w--;){if(x===y||y!==null&&x===y.alternate){b=x;break t}x=b(x),y=b(y)}b=null}else b=null;p!==null&&lL(h,m,p,b,!1),g!==null&&v!==null&&lL(h,v,g,b,!0)}}e:{if(m=u?Gb(u):window,p=m.nodeName&&m.nodeName.toLowerCase(),p==="select"||p==="input"&&m.type==="file")var S=wD;else if(vD(m))if(jU)S=Tce;else{S=Sce;var C=_ce}else p=m.nodeName,!p||p.toLowerCase()!=="input"||m.type!=="checkbox"&&m.type!=="radio"?u&&S9(u.elementType)&&(S=wD):S=Cce;if(S&&(S=S(e,u))){NU(h,S,n,d);break e}C&&C(e,m,u),e==="focusout"&&u&&m.type==="number"&&u.memoizedProps.value!=null&&T8(m,"number",m.value)}switch(C=u?Gb(u):window,e){case"focusin":(vD(C)||C.contentEditable==="true")&&(z0=C,N8=u,gy=null);break;case"focusout":gy=N8=z0=null;break;case"mousedown":j8=!0;break;case"contextmenu":case"mouseup":case"dragend":j8=!1,TD(h,n,d);break;case"selectionchange":if(Ace)break;case"keydown":case"keyup":TD(h,n,d)}var _;if(A9)e:{switch(e){case"compositionstart":var B="onCompositionStart";break e;case"compositionend":B="onCompositionEnd";break e;case"compositionupdate":B="onCompositionUpdate";break e}B=void 0}else $0?EU(e,n)&&(B="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(B="onCompositionStart");B&&(TU&&n.locale!=="ko"&&($0||B!=="onCompositionStart"?B==="onCompositionEnd"&&$0&&(_=CU()):($h=d,T9="value"in $h?$h.value:$h.textContent,$0=!0)),C=T_(u,B),0<C.length&&(B=new gD(B,e,null,n,d),h.push({event:B,listeners:C}),_?B.data=_:(_=AU(n),_!==null&&(B.data=_)))),(_=yce?xce(e,n):vce(e,n))&&(B=T_(u,"onBeforeInput"),0<B.length&&(C=new gD("onBeforeInput","beforeinput",null,n,d),h.push({event:C,listeners:B}),C.data=_)),due(h,e,u,n,d)}SW(h,t)})}function ox(e,t,n){return{instance:e,listener:t,currentTarget:n}}function T_(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=Qy(e,n),r!=null&&s.unshift(ox(e,r,i)),r=Qy(e,t),r!=null&&s.push(ox(e,r,i))),e.tag===3)return s;e=e.return}return[]}function pue(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function lL(e,t,n,s,r){for(var i=t._reactName,o=[];n!==null&&n!==s;){var a=n,c=a.alternate,u=a.stateNode;if(a=a.tag,c!==null&&c===s)break;a!==5&&a!==26&&a!==27||u===null||(c=u,r?(u=Qy(n,i),u!=null&&o.unshift(ox(n,u,c))):r||(u=Qy(n,i),u!=null&&o.push(ox(n,u,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var gue=/\r\n?/g,bue=/\u0000|\uFFFD/g;function cL(e){return(typeof e=="string"?e:""+e).replace(gue,`
`).replace(bue,"")}function TW(e,t){return t=cL(t),cL(e)===t}function kr(e,t,n,s,r,i){switch(n){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||Ag(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&Ag(e,""+s);break;case"className":Aw(e,"class",s);break;case"tabIndex":Aw(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":Aw(e,n,s);break;case"style":_U(e,s,i);break;case"data":if(t!=="object"){Aw(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=l2(""+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"&&kr(e,t,"name",r.name,r,null),kr(e,t,"formEncType",r.formEncType,r,null),kr(e,t,"formMethod",r.formMethod,r,null),kr(e,t,"formTarget",r.formTarget,r,null)):(kr(e,t,"encType",r.encType,r,null),kr(e,t,"method",r.method,r,null),kr(e,t,"target",r.target,r,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(n);break}s=l2(""+s),e.setAttribute(n,s);break;case"onClick":s!=null&&(e.onclick=hd);break;case"onScroll":s!=null&&Ns("scroll",e);break;case"onScrollEnd":s!=null&&Ns("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(nt(61));if(n=s.__html,n!=null){if(r.children!=null)throw Error(nt(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=l2(""+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":Ns("beforetoggle",e),Ns("toggle",e),a2(e,"popover",s);break;case"xlinkActuate":Ku(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":Ku(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":Ku(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":Ku(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":Ku(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":Ku(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":Ku(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":Ku(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":Ku(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":a2(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=Vle.get(n)||n,a2(e,n,s))}}function e7(e,t,n,s,r,i){switch(n){case"style":_U(e,s,i);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(nt(61));if(n=s.__html,n!=null){if(r.children!=null)throw Error(nt(60));e.innerHTML=n}}break;case"children":typeof s=="string"?Ag(e,s):(typeof s=="number"||typeof s=="bigint")&&Ag(e,""+s);break;case"onScroll":s!=null&&Ns("scroll",e);break;case"onScrollEnd":s!=null&&Ns("scrollend",e);break;case"onClick":s!=null&&(e.onclick=hd);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!bU.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[Ua]||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,""):a2(e,n,s)}}}function jo(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ns("error",e),Ns("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(nt(137,t));default:kr(e,t,i,o,n,null)}}r&&kr(e,t,"srcSet",n.srcSet,n,null),s&&kr(e,t,"src",n.src,n,null);return;case"input":Ns("invalid",e);var a=i=o=r=null,c=null,u=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":c=d;break;case"defaultChecked":u=d;break;case"value":i=d;break;case"defaultValue":a=d;break;case"children":case"dangerouslySetInnerHTML":if(d!=null)throw Error(nt(137,t));break;default:kr(e,t,s,d,n,null)}}vU(e,i,a,c,u,o,r,!1);return;case"select":Ns("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:kr(e,t,r,a,n,null)}t=i,n=o,e.multiple=!!s,t!=null?ng(e,!!s,t,!1):n!=null&&ng(e,!!s,n,!0);return;case"textarea":Ns("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(nt(91));break;default:kr(e,t,o,a,n,null)}kU(e,s,r,i);return;case"option":for(c in n)if(n.hasOwnProperty(c)&&(s=n[c],s!=null))switch(c){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:kr(e,t,c,s,n,null)}return;case"dialog":Ns("beforetoggle",e),Ns("toggle",e),Ns("cancel",e),Ns("close",e);break;case"iframe":case"object":Ns("load",e);break;case"video":case"audio":for(s=0;s<ix.length;s++)Ns(ix[s],e);break;case"image":Ns("error",e),Ns("load",e);break;case"details":Ns("toggle",e);break;case"embed":case"source":case"link":Ns("error",e),Ns("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(u in n)if(n.hasOwnProperty(u)&&(s=n[u],s!=null))switch(u){case"children":case"dangerouslySetInnerHTML":throw Error(nt(137,t));default:kr(e,t,u,s,n,null)}return;default:if(S9(t)){for(d in n)n.hasOwnProperty(d)&&(s=n[d],s!==void 0&&e7(e,t,d,s,n,void 0));return}}for(a in n)n.hasOwnProperty(a)&&(s=n[a],s!=null&&kr(e,t,a,s,n,null))}function yue(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,c=null,u=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":c=h;default:s.hasOwnProperty(p)||kr(e,t,p,null,s,h)}}for(var m in s){var p=s[m];if(h=n[m],s.hasOwnProperty(m)&&(p!=null||h!=null))switch(m){case"type":i=p;break;case"name":r=p;break;case"checked":u=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(nt(137,t));break;default:p!==h&&kr(e,t,m,p,s,h)}}C8(e,o,a,c,u,d,i,r);return;case"select":p=o=a=m=null;for(i in n)if(c=n[i],n.hasOwnProperty(i)&&c!=null)switch(i){case"value":break;case"multiple":p=c;default:s.hasOwnProperty(i)||kr(e,t,i,null,s,c)}for(r in s)if(i=s[r],c=n[r],s.hasOwnProperty(r)&&(i!=null||c!=null))switch(r){case"value":m=i;break;case"defaultValue":a=i;break;case"multiple":o=i;default:i!==c&&kr(e,t,r,i,s,c)}t=a,n=o,s=p,m!=null?ng(e,!!n,m,!1):!!s!=!!n&&(t!=null?ng(e,!!n,t,!0):ng(e,!!n,n?[]:"",!1));return;case"textarea":p=m=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:kr(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":m=r;break;case"defaultValue":p=r;break;case"children":break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(nt(91));break;default:r!==i&&kr(e,t,o,r,s,i)}wU(e,m,p);return;case"option":for(var g in n)if(m=n[g],n.hasOwnProperty(g)&&m!=null&&!s.hasOwnProperty(g))switch(g){case"selected":e.selected=!1;break;default:kr(e,t,g,null,s,m)}for(c in s)if(m=s[c],p=n[c],s.hasOwnProperty(c)&&m!==p&&(m!=null||p!=null))switch(c){case"selected":e.selected=m&&typeof m!="function"&&typeof m!="symbol";break;default:kr(e,t,c,m,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 b in n)m=n[b],n.hasOwnProperty(b)&&m!=null&&!s.hasOwnProperty(b)&&kr(e,t,b,null,s,m);for(u in s)if(m=s[u],p=n[u],s.hasOwnProperty(u)&&m!==p&&(m!=null||p!=null))switch(u){case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(nt(137,t));break;default:kr(e,t,u,m,s,p)}return;default:if(S9(t)){for(var v in n)m=n[v],n.hasOwnProperty(v)&&m!==void 0&&!s.hasOwnProperty(v)&&e7(e,t,v,void 0,s,m);for(d in s)m=s[d],p=n[d],!s.hasOwnProperty(d)||m===p||m===void 0&&p===void 0||e7(e,t,d,m,s,p);return}}for(var x in n)m=n[x],n.hasOwnProperty(x)&&m!=null&&!s.hasOwnProperty(x)&&kr(e,t,x,null,s,m);for(h in s)m=s[h],p=n[h],!s.hasOwnProperty(h)||m===p||m==null&&p==null||kr(e,t,h,m,s,p)}function uL(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function xue(){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&&uL(o)){for(o=0,a=r.responseEnd,s+=1;s<n.length;s++){var c=n[s],u=c.startTime;if(u>a)break;var d=c.transferSize,h=c.initiatorType;d&&uL(h)&&(c=c.responseEnd,o+=d*(c<a?1:(a-u)/(c-u)))}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 t7=null,n7=null;function E_(e){return e.nodeType===9?e:e.ownerDocument}function dL(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 EW(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 s7(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 j5=null;function vue(){var e=window.event;return e&&e.type==="popstate"?e===j5?!1:(j5=e,!0):(j5=null,!1)}var AW=typeof setTimeout=="function"?setTimeout:void 0,wue=typeof clearTimeout=="function"?clearTimeout:void 0,hL=typeof Promise=="function"?Promise:void 0,kue=typeof queueMicrotask=="function"?queueMicrotask:typeof hL<"u"?function(e){return hL.resolve(null).then(e).catch(_ue)}:AW;function _ue(e){setTimeout(function(){throw e})}function Hf(e){return e==="head"}function fL(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),Pg(t);return}s--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")s++;else if(n==="html")Ty(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,Ty(n);for(var i=n.firstChild;i;){var o=i.nextSibling,a=i.nodeName;i[iv]||a==="SCRIPT"||a==="STYLE"||a==="LINK"&&i.rel.toLowerCase()==="stylesheet"||n.removeChild(i),i=o}}else n==="body"&&Ty(e.ownerDocument.body);n=r}while(n);Pg(t)}function mL(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 r7(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":r7(n),_9(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function Sue(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[iv])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=rc(e.nextSibling),e===null)break}return null}function Cue(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=rc(e.nextSibling),e===null))return null;return e}function NW(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=rc(e.nextSibling),e===null))return null;return e}function i7(e){return e.data==="$?"||e.data==="$~"}function o7(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Tue(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 rc(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 a7=null;function pL(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return rc(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function gL(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 jW(e,t,n){switch(t=E_(n),e){case"html":if(e=t.documentElement,!e)throw Error(nt(452));return e;case"head":if(e=t.head,!e)throw Error(nt(453));return e;case"body":if(e=t.body,!e)throw Error(nt(454));return e;default:throw Error(nt(451))}}function Ty(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);_9(e)}var oc=new Map,bL=new Set;function A_(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Gd=dr.d;dr.d={f:Eue,r:Aue,D:Nue,C:jue,L:Mue,m:Iue,X:Due,S:Rue,M:Lue};function Eue(){var e=Gd.f(),t=C4();return e||t}function Aue(e){var t=f1(e);t!==null&&t.tag===5&&t.type==="form"?_V(t):Gd.r(e)}var b1=typeof document>"u"?null:document;function MW(e,t,n){var s=b1;if(s&&typeof t=="string"&&t){var r=Xl(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof n=="string"&&(r+='[crossorigin="'+n+'"]'),bL.has(r)||(bL.add(r),e={rel:e,crossOrigin:n,href:t},s.querySelector(r)===null&&(t=s.createElement("link"),jo(t,"link",e),ao(t),s.head.appendChild(t)))}}function Nue(e){Gd.D(e),MW("dns-prefetch",e,null)}function jue(e,t){Gd.C(e,t),MW("preconnect",e,t)}function Mue(e,t,n){Gd.L(e,t,n);var s=b1;if(s&&e&&t){var r='link[rel="preload"][as="'+Xl(t)+'"]';t==="image"&&n&&n.imageSrcSet?(r+='[imagesrcset="'+Xl(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(r+='[imagesizes="'+Xl(n.imageSizes)+'"]')):r+='[href="'+Xl(e)+'"]';var i=r;switch(t){case"style":i=Lg(e);break;case"script":i=y1(e)}oc.has(i)||(e=Wr({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),oc.set(i,e),s.querySelector(r)!==null||t==="style"&&s.querySelector(dv(i))||t==="script"&&s.querySelector(hv(i))||(t=s.createElement("link"),jo(t,"link",e),ao(t),s.head.appendChild(t)))}}function Iue(e,t){Gd.m(e,t);var n=b1;if(n&&e){var s=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+Xl(s)+'"][href="'+Xl(e)+'"]',i=r;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=y1(e)}if(!oc.has(i)&&(e=Wr({rel:"modulepreload",href:e},t),oc.set(i,e),n.querySelector(r)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(hv(i)))return}s=n.createElement("link"),jo(s,"link",e),ao(s),n.head.appendChild(s)}}}function Rue(e,t,n){Gd.S(e,t,n);var s=b1;if(s&&e){var r=tg(s).hoistableStyles,i=Lg(e);t=t||"default";var o=r.get(i);if(!o){var a={loading:0,preload:null};if(o=s.querySelector(dv(i)))a.loading=5;else{e=Wr({rel:"stylesheet",href:e,"data-precedence":t},n),(n=oc.get(i))&&lN(e,n);var c=o=s.createElement("link");ao(c),jo(c,"link",e),c._p=new Promise(function(u,d){c.onload=u,c.onerror=d}),c.addEventListener("load",function(){a.loading|=1}),c.addEventListener("error",function(){a.loading|=2}),a.loading|=4,y2(o,t,s)}o={type:"stylesheet",instance:o,count:1,state:a},r.set(i,o)}}}function Due(e,t){Gd.X(e,t);var n=b1;if(n&&e){var s=tg(n).hoistableScripts,r=y1(e),i=s.get(r);i||(i=n.querySelector(hv(r)),i||(e=Wr({src:e,async:!0},t),(t=oc.get(r))&&cN(e,t),i=n.createElement("script"),ao(i),jo(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},s.set(r,i))}}function Lue(e,t){Gd.M(e,t);var n=b1;if(n&&e){var s=tg(n).hoistableScripts,r=y1(e),i=s.get(r);i||(i=n.querySelector(hv(r)),i||(e=Wr({src:e,async:!0,type:"module"},t),(t=oc.get(r))&&cN(e,t),i=n.createElement("script"),ao(i),jo(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},s.set(r,i))}}function yL(e,t,n,s){var r=(r=ef.current)?A_(r):null;if(!r)throw Error(nt(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Lg(n.href),n=tg(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=Lg(n.href);var i=tg(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(dv(e)))&&!i._p&&(o.instance=i,o.state.loading=5),oc.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},oc.set(e,n),i||Pue(r,e,n,o.state))),t&&s===null)throw Error(nt(528,""));return o}if(t&&s!==null)throw Error(nt(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=y1(n),n=tg(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(nt(444,e))}}function Lg(e){return'href="'+Xl(e)+'"'}function dv(e){return'link[rel="stylesheet"]['+e+"]"}function IW(e){return Wr({},e,{"data-precedence":e.precedence,precedence:null})}function Pue(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}),jo(t,"link",n),ao(t),e.head.appendChild(t))}function y1(e){return'[src="'+Xl(e)+'"]'}function hv(e){return"script[async]"+e}function xL(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Xl(n.href)+'"]');if(s)return t.instance=s,ao(s),s;var r=Wr({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),ao(s),jo(s,"style",r),y2(s,n.precedence,e),t.instance=s;case"stylesheet":r=Lg(n.href);var i=e.querySelector(dv(r));if(i)return t.state.loading|=4,t.instance=i,ao(i),i;s=IW(n),(r=oc.get(r))&&lN(s,r),i=(e.ownerDocument||e).createElement("link"),ao(i);var o=i;return o._p=new Promise(function(a,c){o.onload=a,o.onerror=c}),jo(i,"link",s),t.state.loading|=4,y2(i,n.precedence,e),t.instance=i;case"script":return i=y1(n.src),(r=e.querySelector(hv(i)))?(t.instance=r,ao(r),r):(s=n,(r=oc.get(i))&&(s=Wr({},n),cN(s,r)),e=e.ownerDocument||e,r=e.createElement("script"),ao(r),jo(r,"link",s),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(nt(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(s=t.instance,t.state.loading|=4,y2(s,n.precedence,e));return t.instance}function y2(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 lN(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function cN(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var x2=null;function vL(e,t,n){if(x2===null){var s=new Map,r=x2=new Map;r.set(n,s)}else r=x2,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[iv]||i[Co]||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 wL(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function Oue(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 RW(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function Bue(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=Lg(s.href),i=t.querySelector(dv(r));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=N_.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=i,ao(i);return}i=t.ownerDocument||t,s=IW(s),(r=oc.get(r))&&lN(s,r),i=i.createElement("link"),ao(i);var o=i;o._p=new Promise(function(a,c){o.onload=a,o.onerror=c}),jo(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=N_.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var M5=0;function $ue(e,t){return e.stylesheets&&e.count===0&&v2(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var s=setTimeout(function(){if(e.stylesheets&&v2(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&M5===0&&(M5=62500*xue());var r=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&v2(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>M5?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(r)}}:null}function N_(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)v2(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var j_=null;function v2(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,j_=new Map,t.forEach(zue,e),j_=null,N_.call(e))}function zue(e,t){if(!(t.state.loading&4)){var n=j_.get(e);if(n)var s=n.get(null);else{n=new Map,j_.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=N_.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 ax={$$typeof:dd,Provider:null,Consumer:null,_currentValue:Xm,_currentValue2:Xm,_threadCount:0};function Fue(e,t,n,s,r,i,o,a,c){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=e5(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=e5(0),this.hiddenUpdates=e5(null),this.identifierPrefix=s,this.onUncaughtError=r,this.onCaughtError=i,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function DW(e,t,n,s,r,i,o,a,c,u,d,h){return e=new Fue(e,t,n,o,c,u,d,h,a),t=1,i===!0&&(t|=24),i=ul(3,null,null,t),e.current=i,i.stateNode=e,t=L9(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:s,isDehydrated:n,cache:t},B9(i),e}function LW(e){return e?(e=H0,e):H0}function PW(e,t,n,s,r,i){r=LW(r),s.context===null?s.context=r:s.pendingContext=r,s=nf(t),s.payload={element:n},i=i===void 0?null:i,i!==null&&(s.callback=i),n=sf(e,s,t),n!==null&&(Fa(n,e,t),yy(n,e,t))}function kL(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function uN(e,t){kL(e,t),(e=e.alternate)&&kL(e,t)}function OW(e){if(e.tag===13||e.tag===31){var t=Mp(e,67108864);t!==null&&Fa(t,e,67108864),uN(e,67108864)}}function _L(e){if(e.tag===13||e.tag===31){var t=bl();t=w9(t);var n=Mp(e,t);n!==null&&Fa(n,e,t),uN(e,t)}}var M_=!0;function que(e,t,n,s){var r=Yn.T;Yn.T=null;var i=dr.p;try{dr.p=2,dN(e,t,n,s)}finally{dr.p=i,Yn.T=r}}function Hue(e,t,n,s){var r=Yn.T;Yn.T=null;var i=dr.p;try{dr.p=8,dN(e,t,n,s)}finally{dr.p=i,Yn.T=r}}function dN(e,t,n,s){if(M_){var r=l7(s);if(r===null)N5(e,t,s,I_,n),SL(e,s);else if(Vue(r,e,t,n,s))s.stopPropagation();else if(SL(e,s),t&4&&-1<Uue.indexOf(e)){for(;r!==null;){var i=f1(r);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var o=Am(i.pendingLanes);if(o!==0){var a=i;for(a.pendingLanes|=2,a.entangledLanes|=2;o;){var c=1<<31-gl(o);a.entanglements[1]|=c,o&=~c}Iu(i),!(cr&6)&&(w_=ml()+500,uv(0))}}break;case 31:case 13:a=Mp(i,2),a!==null&&Fa(a,i,2),C4(),uN(i,2)}if(i=l7(s),i===null&&N5(e,t,s,I_,n),i===r)break;r=i}r!==null&&s.stopPropagation()}else N5(e,t,s,null,n)}}function l7(e){return e=C9(e),hN(e)}var I_=null;function hN(e){if(I_=null,e=O0(e),e!==null){var t=tv(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=sU(t),e!==null)return e;e=null}else if(n===31){if(e=rU(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 I_=e,null}function BW(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(Nle()){case lU:return 2;case cU:return 8;case a_:case jle:return 32;case uU:return 268435456;default:return 32}default:return 32}}var c7=!1,af=null,lf=null,cf=null,lx=new Map,cx=new Map,Lh=[],Uue="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 SL(e,t){switch(e){case"focusin":case"focusout":af=null;break;case"dragenter":case"dragleave":lf=null;break;case"mouseover":case"mouseout":cf=null;break;case"pointerover":case"pointerout":lx.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":cx.delete(t.pointerId)}}function wb(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=f1(t),t!==null&&OW(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function Vue(e,t,n,s,r){switch(t){case"focusin":return af=wb(af,e,t,n,s,r),!0;case"dragenter":return lf=wb(lf,e,t,n,s,r),!0;case"mouseover":return cf=wb(cf,e,t,n,s,r),!0;case"pointerover":var i=r.pointerId;return lx.set(i,wb(lx.get(i)||null,e,t,n,s,r)),!0;case"gotpointercapture":return i=r.pointerId,cx.set(i,wb(cx.get(i)||null,e,t,n,s,r)),!0}return!1}function $W(e){var t=O0(e.target);if(t!==null){var n=tv(t);if(n!==null){if(t=n.tag,t===13){if(t=sU(n),t!==null){e.blockedOn=t,lD(e.priority,function(){_L(n)});return}}else if(t===31){if(t=rU(n),t!==null){e.blockedOn=t,lD(e.priority,function(){_L(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 w2(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=l7(e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);E8=s,n.target.dispatchEvent(s),E8=null}else return t=f1(n),t!==null&&OW(t),e.blockedOn=n,!1;t.shift()}return!0}function CL(e,t,n){w2(e)&&n.delete(t)}function Wue(){c7=!1,af!==null&&w2(af)&&(af=null),lf!==null&&w2(lf)&&(lf=null),cf!==null&&w2(cf)&&(cf=null),lx.forEach(CL),cx.forEach(CL)}function Pw(e,t){e.blockedOn===t&&(e.blockedOn=null,c7||(c7=!0,Ki.unstable_scheduleCallback(Ki.unstable_NormalPriority,Wue)))}var Ow=null;function TL(e){Ow!==e&&(Ow=e,Ki.unstable_scheduleCallback(Ki.unstable_NormalPriority,function(){Ow===e&&(Ow=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(hN(s||n)===null)continue;break}var i=f1(n);i!==null&&(e.splice(t,3),t-=3,H8(i,{pending:!0,data:r,method:n.method,action:s},s,r))}}))}function Pg(e){function t(c){return Pw(c,e)}af!==null&&Pw(af,e),lf!==null&&Pw(lf,e),cf!==null&&Pw(cf,e),lx.forEach(t),cx.forEach(t);for(var n=0;n<Lh.length;n++){var s=Lh[n];s.blockedOn===e&&(s.blockedOn=null)}for(;0<Lh.length&&(n=Lh[0],n.blockedOn===null);)$W(n),n.blockedOn===null&&Lh.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[Ua]||null;if(typeof i=="function")o||TL(n);else if(o){var a=null;if(i&&i.hasAttribute("formAction")){if(r=i,o=i[Ua]||null)a=o.formAction;else if(hN(r)!==null)continue}else a=o.action;typeof a=="function"?n[s+1]=a:(n.splice(s,3),s-=3),TL(n)}}}function zW(){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 fN(e){this._internalRoot=e}A4.prototype.render=fN.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(nt(409));var n=t.current,s=bl();PW(n,s,e,t,null,null)};A4.prototype.unmount=fN.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;PW(e.current,2,null,e,null,null),C4(),t[h1]=null}};function A4(e){this._internalRoot=e}A4.prototype.unstable_scheduleHydration=function(e){if(e){var t=pU();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Lh.length&&t!==0&&t<Lh[n].priority;n++);Lh.splice(n,0,e),n===0&&$W(e)}};var EL=tU.version;if(EL!=="19.2.4")throw Error(nt(527,EL,"19.2.4"));dr.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(nt(188)):(e=Object.keys(e).join(","),Error(nt(268,e)));return e=kle(t),e=e!==null?iU(e):null,e=e===null?null:e.stateNode,e};var Gue={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Yn,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Bw=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Bw.isDisabled&&Bw.supportsFiber)try{nv=Bw.inject(Gue),pl=Bw}catch{}}d4.createRoot=function(e,t){if(!nU(e))throw Error(nt(299));var n=!1,s="",r=MV,i=IV,o=RV;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=DW(e,1,!1,null,null,n,s,null,r,i,o,zW),e[h1]=t.current,aN(e),new fN(t)};d4.hydrateRoot=function(e,t,n){if(!nU(e))throw Error(nt(299));var s=!1,r="",i=MV,o=IV,a=RV,c=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&&(c=n.formState)),t=DW(e,1,!0,t,n??null,s,r,c,i,o,a,zW),t.context=LW(null),n=t.current,s=bl(),s=w9(s),r=nf(s),r.callback=null,sf(n,r,s),n=s,t.current.lanes=n,rv(t,n),Iu(t),e[h1]=t.current,aN(e),new A4(t)};d4.version="19.2.4";function FW(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(FW)}catch(e){console.error(e)}}FW(),YH.exports=d4;var u7=YH.exports;const Kue=l4(u7);/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Yue="agent";function Xue(e){return e===Yue}var Que=3e4,Jue=new Set(["authorized","expired","error","cancelled"]),Zue=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 ede(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 ede(e,t,n,s){return await tde(e,t,n,s)}async function AL(e,t,n,s){try{return await e.getDeviceFlow(t.deviceFlowId,{clientId:n,signal:s})}catch(r){if(r instanceof ac&&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 NL(e,t={}){if(e!==void 0&&Number.isFinite(e)&&!(t.allowZero?e<0:e<=0))return e}async function tde(e,t,n,s){var d;let r=s.signal,i=NL(s.timeoutMs,{allowZero:!0}),o=NL(s.pollOverrideMs),a=i!==void 0?Date.now()+i:t.expiresAt+Que,c=Math.max(1e3,o??t.intervalMs??5e3),u=c;for(;;){if(r!=null&&r.aborted)throw d7(r);if(Date.now()>=a)return await AL(e,t,n,r);let h=await AL(e,t,n,r);if(h.intervalMs&&h.intervalMs!==u&&(u=h.intervalMs,c=h.intervalMs,(d=s.onThrottled)==null||d.call(s,h.intervalMs)),Jue.has(h.status))return h;await nde(c,r)}}async function nde(e,t){if(t!=null&&t.aborted)throw d7(t);await new Promise((n,s)=>{let r=setTimeout(()=>{o(),n()},e),i=()=>{o(),s(d7(t))};function o(){clearTimeout(r),t==null||t.removeEventListener("abort",i)}t&&t.addEventListener("abort",i,{once:!0})})}function d7(e){let t=e==null?void 0:e.reason;return t instanceof Error?t:typeof t=="string"?new Error(t):new Error("aborted")}var ac=class extends Error{constructor(t,n,s){super(s);Re(this,"status");Re(this,"body");this.name="DaemonHttpError",this.status=t,this.body=n}},jL=class extends Error{constructor(e){super(e??"Transport connection closed"),this.name="DaemonTransportClosedError"}},sde=class extends Error{constructor(e){super(e),this.name="SseFramingError"}},ML=16*1024*1024;async function*qW(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(u){if(t!=null&&t.aborted)return;throw u}if(a){if(r+=s.decode(),r.length>0){let u=IL(r);for(let d of u.frames){let h=I5(d);h&&(yield h)}if(u.tail.length>0){let d=I5(u.tail);d&&(yield d)}}return}if(r+=s.decode(o,{stream:!0}),r.length>ML)throw new sde(`parseSseStream: unread buffer exceeded ${ML} UTF-16 code units without a frame separator — upstream likely not SSE`);let c=IL(r);if(c.frames.length>0)for(let u of c.frames){let d=I5(u);d&&(yield d)}r=c.tail}}finally{t&&i&&t.removeEventListener("abort",i);try{await n.cancel()}catch{}}}function IL(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 I5(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 rde=class{constructor(e,t,n){Re(this,"baseUrl");Re(this,"token");Re(this,"_fetch");Re(this,"_disposed",!1);Re(this,"type","rest");Re(this,"supportsReplay",!0);Re(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 jL;return this._fetch(e,t)}async*subscribeEvents(e,t={}){var d;if(this._disposed)throw new jL;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?ide([t.signal,s.signal]):s.signal,a=`${this.baseUrl}/session/${encodeURIComponent(e)}/events`;t.maxQueued!==void 0&&(a+=`?maxQueued=${encodeURIComponent(String(t.maxQueued))}`);let c;try{c=await this._fetch(a,{headers:n,signal:o})}finally{r!==void 0&&clearTimeout(r)}if(!c.ok){let h;try{let p=await c.text();try{h=JSON.parse(p)}catch{h=p}}catch{}let m=h&&typeof h=="object"&&"error"in h?String(h.error):`HTTP ${c.status}`;throw new ac(c.status,h,`GET /session/:id/events: ${m}`)}let u=c.headers.get("content-type")??"";if(!u.toLowerCase().includes("text/event-stream")){try{await((d=c.body)==null?void 0:d.cancel())}catch{}throw new ac(c.status,u,`GET /session/:id/events: expected content-type text/event-stream, got "${u}"`)}if(!c.body)throw new Error("No SSE body");yield*qW(c.body,t.signal)}dispose(){this._disposed=!0}};function ide(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 ode=class extends Error{constructor(t,n){super(`DaemonCapabilities.${t} is missing — ${n}. The daemon you are connected to likely predates the feature that added this field; upgrade the daemon or fall back to a different code path that doesn't require it.`);Re(this,"capability");this.name="DaemonCapabilityMissingError",this.capability=t}},ade=["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"],N4=["plan","default","auto-edit","auto","yolo"],$w="/workspace/memory/remember",zw="/workspace/memory/forget",Fw="/workspace/memory/dream";function lde(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e;if(t.v!==1||typeof t.type!="string")return;let n=t.requestId,s=t.modelSource,r=typeof n=="string"&&n.length>0,i=s==="fast"||s==="main",o=a=>a===void 0||typeof a=="number"&&Number.isSafeInteger(a)&&a>=0;if(t.type==="started"){if(!r||typeof t.model!="string"||!i)return}else if(t.type==="thinking"){if(!r)return}else if(t.type==="delta"){if(!r||!Number.isSafeInteger(t.seq)||t.seq<0||typeof t.text!="string"||t.text.length===0)return}else if(t.type==="done"){if(!r||typeof t.model!="string"||!i||!o(t.inputTokens)||!o(t.outputTokens))return}else if(t.type==="error"){if(typeof t.code!="string"||typeof t.message!="string")return}else return;return t}var R_=20,cde=3e4,ude=65e3,dde=9e4,RL=2147483647,hde=5,N0=33e4,fde="X-Qwen-Client-Id",at=encodeURIComponent;function HW(e){let t=new URLSearchParams;e.cursor!==void 0&&t.set("cursor",e.cursor),e.beforeRecordId!==void 0&&t.set("beforeRecordId",e.beforeRecordId),e.limit!==void 0&&t.set("limit",String(e.limit));let n=t.toString();return n?`?${n}`:""}function DL(e){let t=e.trim();if(!t)throw new Error("rule must be a non-empty string");return t}function UW(e){if(e===void 0)return hde;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 mde(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===47;)t--;return t===e.length?e:e.slice(0,t)}function pde(){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 LL=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 VW(e){return typeof e=="object"&&e!==null&&e._daemonTurnError===!0}var h7=class{constructor(e){Re(this,"baseUrl");Re(this,"token");Re(this,"_fetch");Re(this,"fetchTimeoutMs");Re(this,"promptLimit");Re(this,"promptCounts",Object.create(null));Re(this,"transport");Re(this,"_authFlow");var n;this.baseUrl=mde(e.baseUrl),this.token=e.token??pde(),this._fetch=e.fetch??((n=e.transport)==null?void 0:n.restFetch)??globalThis.fetch.bind(globalThis);let t=e.fetchTimeoutMs??cde;this.fetchTimeoutMs=Number.isFinite(t)&&t>0?t:0,this.promptLimit=UW(e.maxPendingPromptsPerSession),this.transport=e.transport??new rde(this.baseUrl,this.token,this._fetch)}get auth(){return this._authFlow||(this._authFlow=new Zue(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 LL(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 c=t.signal??void 0,u=c?R5([c,o.signal]):o.signal;try{let d=r==="rest"?await this._fetch(e,{...t,signal:u}):await this.transport.fetch(e,{...t,signal:u});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[fde]=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 LL(typeof i.sessionId=="string"?i.sessionId:n,typeof i.limit=="number"?i.limit:0,typeof i.pendingCount=="number"?i.pendingCount:0)}return new ac(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=${at(n.format)}`:"";return await this.fetchWithTimeout(`${this.baseUrl}${e}${r}`,{headers:this.headers({},n.clientId)},async i=>{var u;if(!i.ok)throw await this.failOnError(i,t);let o=await i.text(),a=i.headers.get("content-type")??"",c=((u=/filename="([^"]+)"/i.exec(i.headers.get("content-disposition")??""))==null?void 0:u[1])??`export.${s}`;return{content:o,filename:c,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 PL(this,at(e))}workspaceByCwd(e){return new PL(this,at(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 requireCapability(e){if(!(await this.capabilities()).features.includes(e))throw new ode(e,`daemon does not advertise the ${e} feature`)}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 initializeWorkspaceMcp(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/initialize`,{method:"POST",headers:this.headers({"Content-Type":"application/json"}),body:"{}"},async e=>{if(!e.ok)throw await this.failOnError(e,"POST /workspace/mcp/initialize");return await e.json()})}async reloadWorkspaceMcp(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/reload`,{method:"POST",headers:this.headers({"Content-Type":"application/json"}),body:"{}"},async e=>{if(!e.ok)throw await this.failOnError(e,"POST /workspace/mcp/reload");return await e.json()})}async workspaceGit(){return await this.jsonRequest("/workspace/git","GET /workspace/git",{mode:"rest"})}async workspaceGitDiff(){return await this.jsonRequest("/workspace/git/diff","GET /workspace/git/diff",{mode:"rest"})}async workspaceGitDiffFile(e,t){let n=`/workspace/git/diff/file?path=${at(e)}`+(t!=null?`&oldPath=${at(t)}`:"");return await this.jsonRequest(n,"GET /workspace/git/diff/file",{mode:"rest"})}async workspaceMcpTools(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${at(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/${at(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/${at(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/${at(e)}`,"GET /workspace/extensions/operations/:operationId",{mode:"rest"})}async activeExtensionOperations(){return await this.jsonRequest("/workspace/extensions/operations","GET /workspace/extensions/operations",{mode:"rest"})}async respondToExtensionInteraction(e,t,n,s){return await this.jsonRequest(`/workspace/extensions/operations/${at(e)}/interactions/${at(t)}`,"POST /workspace/extensions/operations/:operationId/interactions/:interactionId",{method:"POST",body:n,clientId:s,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/${at(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/${at(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/${at(e)}/update`,"POST /workspace/extensions/:name/update",{method:"POST",body:{},clientId:t,mode:"rest"})}async uninstallExtension(e,t){return await this.jsonRequest(`/workspace/extensions/${at(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/${at(e)}/update`,"POST /extensions/:extensionId/update",{method:"POST",body:{},clientId:t,mode:"rest"})}async uninstallUserExtension(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/extensions/${at(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/${at(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/${at(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 c=i-Date.now();if(c<=0||Number.isNaN(c))throw o();let u;if(!r)u=await this.extensionOperation(e.operationId,t.signal);else{let h=new AbortController,m=t.signal?R5([t.signal,h.signal]):h.signal,p,g=new Promise((b,v)=>{let x=()=>{let w=o();v(w),h.abort(w)},y=()=>{let w=i-Date.now();if(w<=0){x();return}p=setTimeout(()=>{Date.now()>=i?x():y()},Math.min(w,RL))};y()});try{u=await Promise.race([this.extensionOperation(e.operationId,m),g])}finally{p!==void 0&&clearTimeout(p),h.abort()}}if(u.status!=="queued"&&u.status!=="running")return u;let d=i-Date.now();if(d<=0)throw o();await new Promise((h,m)=>{var b,v;let p=setTimeout(()=>{var x;(x=t.signal)==null||x.removeEventListener("abort",g),h()},Math.min(n,d,RL)),g=()=>{var x,y;clearTimeout(p),(x=t.signal)==null||x.removeEventListener("abort",g),m(((y=t.signal)==null?void 0:y.reason)??new DOMException("Aborted","AbortError"))};(b=t.signal)==null||b.addEventListener("abort",g,{once:!0}),(v=t.signal)!=null&&v.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 workspacePathSuggestions(e){let t=new URL(`${this.baseUrl}/workspace-path-suggestions`);return t.searchParams.set("prefix",e),await this.fetchWithTimeout(t.toString(),{headers:this.headers()},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /workspace-path-suggestions");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($w,`POST ${$w}`,{method:"POST",body:{content:e,contextMode:t.contextMode??"workspace"},clientId:t.clientId})}async getWorkspaceMemoryRememberTask(e,t){return await this.jsonRequest(`${$w}/${at(e)}`,`GET ${$w}/:taskId`,{clientId:t==null?void 0:t.clientId})}async forgetWorkspaceMemory(e,t={}){return await this.jsonRequest(zw,`POST ${zw}`,{method:"POST",body:{query:e},clientId:t.clientId})}async getWorkspaceMemoryForgetTask(e,t){return await this.jsonRequest(`${zw}/${at(e)}`,`GET ${zw}/:taskId`,{clientId:t==null?void 0:t.clientId})}async dreamWorkspaceMemory(e={}){return await this.jsonRequest(Fw,`POST ${Fw}`,{method:"POST",body:{},clientId:e.clientId})}async getWorkspaceMemoryDreamTask(e,t){return await this.jsonRequest(`${Fw}/${at(e)}`,`GET ${Fw}/: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()},N0)}async getWorkspaceAgent(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/agents/${at(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/${at(e)}?scope=${at(n.scope)}`:`${this.baseUrl}/workspace/agents/${at(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/${at(e)}?scope=${at(t.scope)}`:`${this.baseUrl}/workspace/agents/${at(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(e.sourceType!==void 0||e.sourceId!==void 0)&&await this.requireCapability("session_source_metadata"),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}:{},...e.sourceType!==void 0?{sourceType:e.sourceType}:{},...e.sourceId!==void 0?{sourceId:e.sourceId}:{}})},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){((t==null?void 0:t.sourceType)!==void 0||(t==null?void 0:t.sourceId)!==void 0)&&await this.requireCapability("session_source_metadata");let n=(t==null?void 0:t.pageSize)??R_,s=Math.max(1,Math.min(1e3,Math.round(Number.isFinite(n)?n:R_))),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),(t==null?void 0:t.sourceType)!==void 0&&r.set("sourceType",t.sourceType),(t==null?void 0:t.sourceId)!==void 0&&r.set("sourceId",t.sourceId),await this.jsonRequest(`/workspace/${at(e)}/sessions?${r.toString()}`,"GET /workspace/sessions")}async listSessionGroups(e){return await this.jsonRequest(`/workspace/${at(e)}/session-groups`,"GET /workspace/session-groups")}async createSessionGroup(e,t){return(await this.jsonRequest(`/workspace/${at(e)}/session-groups`,"POST /workspace/session-groups",{method:"POST",body:t})).group}async updateSessionGroup(e,t,n){return(await this.jsonRequest(`/workspace/${at(e)}/session-groups/${at(t)}`,"PATCH /workspace/session-groups/:groupId",{method:"PATCH",body:n})).group}async deleteSessionGroup(e,t){return await this.jsonRequest(`/workspace/${at(e)}/session-groups/${at(t)}`,"DELETE /workspace/session-groups/:groupId",{method:"DELETE"})}async updateSessionOrganization(e,t,n){return await this.jsonRequest(`/session/${at(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/${at(e)}/export`,"GET /session/:id/export",t)}async getSessionTranscriptPage(e,t={}){return await this.jsonRequest(`/session/${at(e)}/transcript${HW(t)}`,"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/${at(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/${at(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/${at(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/${at(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/${at(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/${at(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/${at(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/${at(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/${at(e)}/tasks/${at(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/${at(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/${at(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/${at(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}:{},...e==="load"&&n.historyPageSize!==void 0?{historyPageSize:n.historyPageSize}:{}})},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/${at(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/${at(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/${at(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/${at(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*generateSessionContent(e,t,n){let s=await this.transport.fetch(`${this.baseUrl}/session/${at(e)}/generate`,{method:"POST",headers:this.headers({"Content-Type":"application/json",Accept:"text/event-stream"},n==null?void 0:n.clientId),body:JSON.stringify({prompt:t}),signal:n==null?void 0:n.signal});if(!s.ok)throw await this.failOnError(s,"POST /session/:id/generate");if(!s.body)throw new Error("Generation response body is missing");for await(let r of qW(s.body,n==null?void 0:n.signal)){let i=lde(r);i&&(yield i)}}async btwSession(e,t,n){let s=await this.transport.fetch(`${this.baseUrl}/session/${at(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/${at(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/${at(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/${at(e)}/pending-prompts/${at(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/${at(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/${at(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/${at(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()})}installWorkspaceSkill(e){return this.jsonRequest("/workspace/skills/install","Skill",{method:"POST",body:e})}deleteWorkspaceSkill(e,t){return this.jsonRequest(`/workspace/skills/${at(e)}?scope=${t}`,"Skill",{method:"DELETE"})}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,...s!=null&&s.mcpServerMutation?{mcpServerMutation:s.mcpServerMutation}:{}})},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??ude,"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=DL(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=DL(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=${at(String(t.entryIndex))}`;return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${at(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)??N0)}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/${at(e)}/${at(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)??N0)}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)??N0)}async removeRuntimeMcpServer(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/servers/${at(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)??N0)}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:dde})}async setSessionModel(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${at(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/${at(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/${at(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/${at(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?R5([s,i.signal]):i.signal;try{let a=this.subscribeEvents(e,{lastEventId:n,signal:o});for await(let c of a){let u=mN(c,t);if(u!==void 0)return u}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/${at(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/${at(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/${at(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/${at(e)}/permission/${at(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/${at(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/${at(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/${at(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/${at(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/${at(e)}/artifacts`,"GET /session/:id/artifacts",{clientId:t})}async addSessionArtifact(e,t,n){return await this.jsonRequest(`/session/${at(e)}/artifacts`,"POST /session/:id/artifacts",{method:"POST",body:t,clientId:n})}async removeSessionArtifact(e,t,n){return await this.jsonRequest(`/session/${at(e)}/artifacts/${at(t)}`,"DELETE /session/:id/artifacts/:artifactId",{method:"DELETE",clientId:n})}async updateSessionMetadata(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${at(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")})}},PL=class{constructor(e,t){this.client=e,this.workspaceSelector=t}workspaceMcp(){return this.get("/mcp","GET /workspaces/:workspace/mcp")}initializeWorkspaceMcp(){return this.post("/mcp/initialize","POST /workspaces/:workspace/mcp/initialize",{})}reloadWorkspaceMcp(){return this.post("/mcp/reload","POST /workspaces/:workspace/mcp/reload",{})}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"})}workspaceGitDiff(){return this.client.workspaceJsonRequest(this.workspaceSelector,"/git/diff","GET /workspaces/:workspace/git/diff",{mode:"rest"})}workspaceGitDiffFile(e,t){let n=`/git/diff/file?path=${at(e)}`+(t!=null?`&oldPath=${at(t)}`:"");return this.client.workspaceJsonRequest(this.workspaceSelector,n,"GET /workspaces/:workspace/git/diff/file",{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/${at(e)}`,"GET /workspaces/:workspace/agents/:agentType")}updateWorkspaceAgent(e,t,n={}){let s=n.scope?`?scope=${at(n.scope)}`:"";return this.post(`/agents/${at(e)}${s}`,"POST /workspaces/:workspace/agents/:agentType",t,n.clientId)}async deleteWorkspaceAgent(e,t={}){let n=t.scope?`?scope=${at(t.scope)}`:"";return await this.client.workspaceNoContentRequest(this.workspaceSelector,`/agents/${at(e)}${n}`,"DELETE /workspaces/:workspace/agents/:agentType",{method:"DELETE",clientId:t.clientId,okNotFoundCode:"agent_not_found"})}async listWorkspaceSessionsPage(e){((e==null?void 0:e.sourceType)!==void 0||(e==null?void 0:e.sourceId)!==void 0)&&await this.client.requireCapability("session_source_metadata");let t=(e==null?void 0:e.pageSize)??R_,n=Math.max(1,Math.min(1e3,Math.round(Number.isFinite(t)?t:R_))),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),(e==null?void 0:e.sourceType)!==void 0&&s.set("sourceType",e.sourceType),(e==null?void 0:e.sourceId)!==void 0&&s.set("sourceId",e.sourceId),await this.get(`/sessions?${s.toString()}`,"GET /workspaces/:workspace/sessions")}async listWorkspaceSessions(e){return(await this.listWorkspaceSessionsPage(e)).sessions}getWorkspaceSessionInfo(){return this.get("/session-info","GET /workspaces/:workspace/session-info")}getSessionTranscriptPage(e,t={}){return this.client.workspaceJsonRequest(this.workspaceSelector,`/session/${at(e)}/transcript${HW(t)}`,"GET /workspaces/:workspace/session/:id/transcript",{clientId:t.clientId,mode:"rest"})}exportSession(e,t={}){return this.client.sessionExportRequest(`/workspaces/${this.workspaceSelector}/session/${at(e)}/export`,"GET /workspaces/:workspace/session/:id/export",t)}exportArchivedSession(e,t={}){return this.client.sessionExportRequest(`/workspaces/${this.workspaceSelector}/session/${at(e)}/archive/export`,"GET /workspaces/:workspace/session/:id/archive/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/${at(e)}`,"PATCH /workspaces/:workspace/session-groups/:groupId",{method:"PATCH",body:t})).group}deleteSessionGroup(e){return this.client.workspaceJsonRequest(this.workspaceSelector,`/session-groups/${at(e)}`,"DELETE /workspaces/:workspace/session-groups/:groupId",{method:"DELETE"})}updateSessionOrganization(e,t,n){return this.client.workspaceJsonRequest(this.workspaceSelector,`/session/${at(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,t={}){let n=new URLSearchParams({pattern:e});return t.maxResults!==void 0&&n.set("maxResults",String(t.maxResults)),this.client.workspaceJsonRequest(this.workspaceSelector,`/glob?${n.toString()}`,"GET /workspaces/:workspace/glob",{signal:t.signal})}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&&s.mcpServerMutation?{mcpServerMutation:s.mcpServerMutation}:{}},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/${at(e)}/enable`,"POST /workspaces/:workspace/tools/:name/enable",{enabled:t},n==null?void 0:n.clientId)}setWorkspaceSkillEnabled(e,t,n){return this.post(`/skills/${at(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=${at(String(t.entryIndex))}`;return this.post(`/mcp/${at(e)}/restart${n}`,"POST /workspaces/:workspace/mcp/:server/restart",{},t==null?void 0:t.clientId,(t==null?void 0:t.timeoutMs)??N0)}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/${at(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/${at(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 R5(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 mN(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 ac(500,n.code??"turn_error",n.message??"Prompt failed"),{_daemonTurnError:!0})}}function OL(e){return"promptId"in e&&"lastEventId"in e}var kb=class k2{constructor(t){Re(this,"client");Re(this,"session");Re(this,"state");Re(this,"replaySnapshot");Re(this,"hasActivePrompt");Re(this,"historyHasMore");Re(this,"lastSeenEventId");Re(this,"subscriptionActive",!1);Re(this,"reattaching");Re(this,"promptLimit");Re(this,"_pendingPrompts",new Map);this.client=t.client,this.session={...t.session},this.state={...t.state??{}},this.hasActivePrompt=t.hasActivePrompt??!1,this.historyHasMore=t.historyHasMore??!1,this.replaySnapshot=t.replaySnapshot??{compactedReplay:[],liveJournal:[]},this.lastSeenEventId=qw(t.lastEventId),this.promptLimit=t.maxPendingPromptsPerSession===void 0?t.client.maxPendingPromptsPerSession:UW(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 k2({client:t,session:r,hasActivePrompt:r.hasActivePrompt,lastEventId:i})}static async load(t,n,s={},r){let{state:i,hasActivePrompt:o,compactedReplay:a,liveJournal:c,historyHasMore:u,lastEventId:d,...h}=await t.loadSession(n,s,r);return new k2({client:t,session:h,hasActivePrompt:o,state:i,lastEventId:d??0,replaySnapshot:{compactedReplay:a??[],liveJournal:c??[]},historyHasMore:u})}static async resume(t,n,s={},r){let{state:i,hasActivePrompt:o,lastEventId:a,...c}=await t.resumeSession(n,s,r);return new k2({client:t,session:c,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=qw(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)),!OL(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 u=this._pendingPrompts.get(r.promptId);u&&this._pendingPrompts.delete(r.promptId)&&(this.client.cancel(this.sessionId,this.clientId).catch(()=>{}),u.reject(n.reason??new DOMException("Aborted","AbortError")))},c=()=>n==null?void 0:n.removeEventListener("abort",a);this._pendingPrompts.set(r.promptId,{resolve:u=>{c(),s(),i(u)},reject:u=>{c(),s(),o(u)}}),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(!OL(s))throw new Error("Expected non-blocking prompt acceptance");return s}async withClientIdSelfHeal(t){try{return await t()}catch(n){if(!gde(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}:{}})}generateContent(t,n){return this.client.generateSessionContent(this.sessionId,t,{...n!=null&&n.signal?{signal:n.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=qw(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 c=>(r||o(),await a.next(c)),return:async()=>{try{return await a.return(void 0)}finally{i()}},throw:async c=>{try{return await a.throw(c)}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,qw(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=mN(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 qw(e){if(e!==void 0){if(!Number.isInteger(e)||e<0)throw new TypeError("invalid lastEventId");return e}}function gde(e){return e instanceof ac&&e.status===400&&typeof e.body=="object"&&e.body!==null&&e.body.code==="invalid_client_id"}var WW="mid_turn_message_injected",pN="pending_prompt_added",gN="pending_prompt_started",bN="pending_prompt_completed",bde=["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",WW,pN,gN,bN,"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","mcp_server_changed","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(bde);var f7="daemon-plan";function tn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ze(e,t){if(!tn(e))return;let n=e[t];return typeof n=="string"?n:void 0}function or(e,t){if(tn(e))for(let n of t){let s=e[n];if(typeof s=="string"&&s.trim().length>0)return s}}function xf(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 $d(e){return xf(md(e))}function md(e,t=0){return t>16?"[truncated]":Array.isArray(e)?e.map(n=>md(n,t+1)):tn(e)?Object.fromEntries(Object.entries(e).map(([n,s])=>[n,GW(n)?"[redacted]":md(s,t+1)])):e}function GW(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 D5(e){if(typeof e=="string")return e;if(!tn(e))return"";let t=e.text;return typeof t=="string"?t:""}function yde(e){if(typeof e=="string")return{kind:"text",text:e};if(!tn(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=tn(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=tn(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 xde=64;function D_(e,t=0){if(t>xde)return"[output truncated]";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(s=>D_(s,t+1)).filter(Boolean).join(`
`);if(!tn(e))return e===void 0?"":xf(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=D_(n,t+1);if(s)return s}return xf(e)}var vde=new Set(ade),KW=new Set(["qwen","qwen-oauth"]),wde=new Set(["in_flight","disabled","budget_would_exceed","authentication_required"]),BL="malformed memory_changed payload",$L=4096,zL="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 kde(e,t={}){let n=jde(e,t);switch(e.type){case"session_update":return Mde(e,n,t);case"shell_output":{let s=D_(e.data),r=p7(e.data),i=g7(e.data);return s?[{...n,type:i==="user-shell"?"user.shell.output":"shell.output",text:s,...r?{stream:r}:{}}]:[]}case"permission_request":return $de(e,n);case"permission_resolved":case"permission_already_resolved":return zde(e,n);case"model_switched":return[{...n,type:"model.changed",modelId:Ze(e.data,"modelId")??"unknown"}];case"model_switch_failed":return[{...n,type:"error",recoverable:!0,text:Ze(e.data,"error")??"Model switch failed (no details available)"}];case"session_died":{let s=L5(Ze(e.data,"errorKind"));return[{...n,type:"error",recoverable:!1,...s?{errorKind:s}:{},text:Ze(e.data,"reason")??"Session died (no details available)"}]}case"session_closed":return[{...n,type:"status",text:`Session closed: ${Ze(e.data,"reason")??"closed"}`}];case"session_recording_degraded":return!Ze(e.data,"sessionId")||Ze(e.data,"reason")!=="write_failed"?Os(e,n,"malformed recording state"):[{...n,type:"error",recoverable:!0,code:"session_recording_degraded",text:zL}];case"session_snapshot":{if(!tn(e.data)||!Ze(e.data,"sessionId"))return Os(e,n,"malformed recording snapshot");let s=e.data.recordingDegraded;return s!==void 0&&typeof s!="boolean"?Os(e,n,"malformed recording snapshot"):s===!0?[{...n,type:"error",recoverable:!0,code:"session_recording_degraded",text:zL}]:[]}case"client_evicted":return[{...n,type:"error",recoverable:!0,text:Ze(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=L5(Ze(e.data,"errorKind"));return[{...n,type:"error",recoverable:!0,...s?{errorKind:s}:{},text:Ze(e.data,"error")??"SSE stream error (no details available)"}]}case"turn_error":{let s=Ze(e.data,"code"),r=L5(Ze(e.data,"errorKind")),i=Ze(e.data,"promptId");return[{...n,type:"error",source:"turn_error",recoverable:!0,...s?{code:s}:{},...r?{errorKind:r}:{},...i?{promptId:i}:{},text:Ze(e.data,"message")??"Prompt failed (no details available)"}]}case"state_resync_required":return Sde(e,n);case"history_truncated":return Cde(e,n);case"session_rewound":return Tde(e,n);case"session_branched":return Ede(e,n);case"prompt_cancelled":{let s=hhe(e.data,"reason");return[{...n,type:"prompt.cancelled",...s?{reason:s}:{}}]}case"followup_suggestion":return Ade(e,n);case"mid_turn_message_injected":return Nde(e,n);case"pending_prompt_added":case"pending_prompt_started":case"pending_prompt_completed":return[];case"user_shell_command":{let s=Ze(e.data,"command"),r=Ze(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=jr(e.data,"exitCode"),r=tn(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=jr(e.data,"replayedCount")??0,r=jr(e.data,"lastReplayedEventId")??jr(e.data,"lastEventId");return[{...n,type:"session.replay_complete",replayedCount:s,...r!==void 0?{lastReplayedEventId:r}:{}}]}case"session_metadata_updated":return Ude(e,n);case"approval_mode_changed":return Wde(e,n);case"git_branch_changed":return[];case"memory_changed":return Gde(e,n);case"agent_changed":return Kde(e,n);case"tool_toggled":return Yde(e,n);case"settings_changed":return Xde(e,n);case"settings_reloaded":return Qde(e,n);case"trust_change_requested":return Zde(e,n);case"workspace_initialized":return Jde(e,n);case"github_setup_completed":return ehe(e,n);case"mcp_budget_warning":return the(e,n);case"mcp_child_refused_batch":return nhe(e,n);case"mcp_server_restarted":return she(e,n);case"mcp_server_restart_refused":return rhe(e,n);case"mcp_server_added":return P5(e,n,"added");case"mcp_server_removed":return P5(e,n,"removed");case"mcp_server_changed":return P5(e,n);case"extensions_changed":return ihe(e,n);case"artifact_changed":return Vde(e,n);case"auth_device_flow_started":return ohe(e,n);case"auth_device_flow_throttled":return ahe(e,n);case"auth_device_flow_authorized":return lhe(e,n);case"auth_device_flow_failed":return che(e,n);case"auth_device_flow_cancelled":return dhe(e,n);default:return _de(e,n)}}function _de(e,t){return[{...t,type:"debug",text:`${e.type} (unrecognized daemon event): ${$d(e.data)}`}]}function Sde(e,t){let n=Ze(e.data,"reason"),s=jr(e.data,"lastDeliveredId"),r=jr(e.data,"earliestAvailableId");return!n||s===void 0||r===void 0?Os(e,t,"malformed state_resync_required payload"):[{...t,type:"session.state_resync_required",reason:n,lastDeliveredId:s,earliestAvailableId:r}]}function Cde(e,t){let n=Ze(e.data,"reason"),s=jr(e.data,"truncatedEvents"),r=jr(e.data,"retainedEvents"),i=jr(e.data,"maxBytes");return n!=="replay_window_exceeded"||s===void 0||r===void 0||i===void 0||!tn(e.data)||typeof e.data.fullTranscriptAvailable!="boolean"?Os(e,t,"malformed history_truncated payload"):[{...t,type:"status",text:`History truncated: retained ${r}, dropped ${s} (window ${i} bytes).`,source:"history_truncated"}]}function Tde(e,t){let n=Ze(e.data,"promptId"),s=jr(e.data,"targetTurnIndex");if(!n||s===void 0)return Os(e,t,"malformed session_rewound payload");let r=Ze(e.data,"sessionId");return[{...t,type:"session.rewound",promptId:n,targetTurnIndex:s,...r?{sessionId:r}:{}}]}function Ede(e,t){let n=Ze(e.data,"sourceSessionId"),s=Ze(e.data,"newSessionId"),r=Ze(e.data,"displayName");return!n||!s||!r?Os(e,t,"malformed session_branched payload"):[{...t,type:"session.branched",sourceSessionId:n,newSessionId:s,displayName:r}]}function Ade(e,t){let n=Ze(e.data,"sessionId"),s=Ze(e.data,"suggestion"),r=Ze(e.data,"promptId");return!n||!s||!r?Os(e,t,"malformed followup_suggestion payload"):[{...t,type:"followup.suggestion",sessionId:n,suggestion:s,promptId:r}]}function Nde(e,t){if(!tn(e.data))return Os(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?Os(e,t,"malformed mid_turn_message_injected"):[{...t,type:"status",text:`Inserted message: ${n.join(`
`)}`,source:"mid_turn_message_injected",data:e.data}]}function jde(e,t){let n=YW(e),s=Ide(e);return{...e.id!==void 0?{eventId:e.id}:{},...n!==void 0?{serverTimestamp:n}:{},...s?{sourceRecordIds:s}:{},...e.originatorClientId?{originatorClientId:e.originatorClientId}:{},...t.includeRawEvent?{rawEvent:{...e,data:md(e.data)}}:{}}}function YW(e){let t=e.serverTimestamp;if(typeof t=="number"&&Number.isFinite(t))return t;let n=e._meta;if(tn(n)){let s=n.serverTimestamp;if(typeof s=="number"&&Number.isFinite(s))return s}if(tn(e.data)){let s=e.data._meta;if(tn(s)){let i=s.serverTimestamp;if(typeof i=="number"&&Number.isFinite(i))return i}let r=e.data.update;if(tn(r)){let i=r._meta;if(tn(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 Mde(e,t,n){let s=XW(e.data);if(!s)return[{...t,type:"debug",text:`session_update: ${$d(e.data)}`}];let r=Ze(s,"sessionUpdate");switch(r){case"user_message_chunk":{if(n.suppressOwnUserEcho&&n.clientId&&e.originatorClientId===n.clientId)return[];let i=qL(s),o=s.content,a=yde(o);if(a){if(a.kind==="image"){let u=a.source.data,d=a.mediaType||"image/*";if(d==="image/*"&&u){let h=(u.startsWith("data:")?u.split(",")[1]??"":u).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 u?[{...t,type:"user.image.delta",data:u,mimeType:d}]:[]}return a.kind==="text"?a.text?[{...t,type:"user.text.delta",text:a.text,...i?{meta:i}:{}}]:[]:[]}let c=D5(o);return c?[{...t,type:"user.text.delta",text:c,...i?{meta:i}:{}}]:[]}case"agent_message_chunk":{let i=D5(s.content),o=FL(s),a=qL(s),c=[];i&&c.push({...t,type:"assistant.text.delta",text:i,...o?{parentToolCallId:o}:{},...a?{meta:a}:{}});let u=Rde(s);return u&&c.push({...t,type:"assistant.usage",usage:u,...o?{parentToolCallId:o}:{}}),c}case"agent_thought_chunk":{let i=D5(s.content);if(!i)return[];let o=FL(s);return[{...t,type:"thought.text.delta",text:i,...o?{parentToolCallId:o}:{}}]}case"tool_call":case"tool_call_update":{let i=tn(s._meta)?s._meta:void 0;return Ze(s,"status")==="in_progress"&&Ze(s,"kind")===void 0&&(i==null?void 0:i.shellProgress)!==void 0?[]:[Dde(s,t)]}case"shell_output":case"tool_output":{let i=D_(s),o=p7(s)??p7(e.data),a=g7(s)??g7(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(tn);return[{...t,type:"session.available_commands",count:i.length,commands:i}]}case"plan":return[Lde(s,t)];case"current_mode_update":return[];default:return[{...t,type:"debug",text:`${r??"session_update"}: ${$d(s)}`}]}}function FL(e){let t=tn(e._meta)?e._meta:void 0;return t?Ze(t,"parentToolCallId"):void 0}function qL(e){let t=tn(e._meta)?e._meta:void 0;if(!t)return;let{qwenTranscript:n,...s}=t;return Object.keys(s).length>0?s:void 0}function Ide(e){var i;if(!tn(e.data))return;let t=XW(e.data),n=t&&tn(t._meta)?t._meta:void 0,s=(i=n&&tn(n.qwenTranscript)?n.qwenTranscript:void 0)==null?void 0:i.sourceRecordIds;if(!Array.isArray(s))return;let r=[...new Set(s.filter(o=>typeof o=="string"))];return r.length>0?r:void 0}function Rde(e){let t=tn(e._meta)?e._meta:void 0,n=t&&tn(t.usage)?t.usage:void 0;if(!n)return;let s=jr(n,"inputTokens"),r=jr(n,"outputTokens");if(s===void 0&&r===void 0)return;let i=jr(n,"cachedReadTokens");return{inputTokens:s??0,outputTokens:r??0,...i!==void 0?{cachedTokens:i}:{}}}function Dde(e,t){let n=tn(e._meta)?e._meta:void 0,s=Ze(e,"toolName")??Ze(e,"name")??(n?Ze(n,"toolName"):void 0)??(n?Ze(n,"name"):void 0),r=Ze(e,"kind"),i=Ze(e,"title")??s??r,o=e.rawInput??e.input??e.args,a=e.rawOutput??e.output??e.result,c=o!==void 0?md(o):void 0,u=a!==void 0?md(a):void 0,d=e.content!==void 0?md(e.content):void 0,h=e.locations!==void 0?md(e.locations):void 0,m=Ze(e,"toolCallId"),p=Ze(e,"status");if(!m)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:b}=Bde(e,s),v=Ze(e,"parentToolCallId")??(n?Ze(n,"parentToolCallId"):void 0),x=v&&v!==m?v:void 0,y=Ze(e,"subagentType")??(n?Ze(n,"subagentType"):void 0);return{...t,type:"tool.update",toolCallId:m,...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}:{},...b?{serverId:b}:{},...x?{parentToolCallId:x}:{},...y?{subagentType:y}:{},...c!==void 0?{rawInput:c}:{},...u!==void 0?{rawOutput:u}:{},...c!==void 0?{details:m7($d(c))}:u!==void 0?{details:m7($d(u))}:{}}}function Lde(e,t){let n=Array.isArray(e.entries)?e.entries:[],s=m7(Pde(n)),r=tn(e._meta)?e._meta:void 0,i=r&&tn(r.qwenTranscript)?r.qwenTranscript:void 0,o=Ze(i,"planToolCallId")??(t.eventId!==void 0?`${f7}-${t.eventId}`:f7),a=r&&tn(r.stats)?r.stats:void 0;return{...t,type:"tool.update",toolCallId:o,title:"Updated Plan",status:"completed",toolName:"todo_write",toolKind:"updated_plan",content:[{type:"content",content:{type:"text",text:s}}],rawOutput:a?{entries:n,stats:a}:{entries:n}}}function Pde(e){return e.flatMap(t=>{if(!tn(t))return[];let n=Ze(t,"content");return n?[`- [${Ode(Ze(t,"status"))}] ${n}`]:[]}).join(`
`)}function Ode(e){switch(e){case"completed":return"x";case"in_progress":return"-";default:return" "}}function Bde(e,t){let n=Ze(e,"provenance"),s=Ze(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 L5(e){if(e)return vde.has(e)?e:void 0}function m7(e){return e.length<=$L?e:`${e.slice(0,$L)}... [truncated]`}function $de(e,t){if(!tn(e.data))return[{...t,type:"debug",text:`permission_request: ${$d(e.data)}`}];let n=Ze(e.data,"requestId");if(!n)return[{...t,type:"debug",text:`permission_request: ${$d(e.data)}`}];let s=e.data.toolCall!==void 0?md(e.data.toolCall):void 0;return[{...t,type:"permission.request",requestId:n,sessionId:Ze(e.data,"sessionId"),title:Hde(s),options:Fde(e.data.options),toolCall:s}]}function zde(e,t){let n=Ze(e.data,"requestId");if(!n)return[{...t,type:"debug",text:`${e.type}: ${$d(e.data)}`}];let s=Ze(e.data,"voterClientId")??t.originatorClientId;return[{...t,type:"permission.resolved",requestId:n,outcome:qde(e.data),...s?{voterClientId:s}:{}}]}function XW(e){if(!tn(e))return;let t=e.update;return tn(t)?t:e}function Fde(e){return Array.isArray(e)?e.flatMap(t=>{if(!tn(t))return[];let n=Ze(t,"optionId");return n?[{optionId:n,label:Ze(t,"label")??Ze(t,"title")??Ze(t,"name")??n,...Ze(t,"description")?{description:Ze(t,"description")}:{},raw:t}]:[]}):[]}function qde(e){if(!tn(e))return xf(e);let t=e.outcome;if(typeof t=="string")return t;if(tn(t)){let n=Ze(t,"outcome")??"selected",s=Ze(t,"optionId");return s?`${n}:${s}`:n}return or(e,["status","reason"])??xf(e)}function Hde(e){return tn(e)?Ze(e,"title")??Ze(e,"name")??Ze(e,"kind")??Ze(e,"toolName")??"Tool permission":"Tool permission"}function p7(e){let t=Ze(e,"stream");return t==="stdout"||t==="stderr"?t:void 0}function g7(e){if(!tn(e))return;let t=Ze(e,"source");if(t)return t;let n=e._meta;return tn(n)?Ze(n,"source"):void 0}function Os(e,t,n){return[{...t,type:"debug",text:`${e.type}: ${n}`}]}function Ude(e,t){let n=Ze(e.data,"sessionId");if(!n)return Os(e,t,"missing sessionId");let s=Ze(e.data,"displayName");return[{...t,type:"session.metadata.changed",sessionId:n,...s!==void 0?{displayName:s}:{}}]}function Vde(e,t){let n=Ze(e.data,"sessionId"),s=tn(e.data)?e.data.change:void 0;if(!n||!tn(s))return Os(e,t,"malformed artifact_changed payload");let r=Ze(s,"action"),i=Ze(s,"artifactId");return!r||!i?Os(e,t,"missing action or artifactId"):[{...t,type:"session.artifact.changed",sessionId:n,change:s}]}function Wde(e,t){let n=Ze(e.data,"sessionId"),s=Ze(e.data,"previous"),r=Ze(e.data,"next");if(!n||!s||!r)return Os(e,t,"missing sessionId / previous / next");let i=tn(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 Gde(e,t){var o;let n=Ze(e.data,"scope");if(n==="managed"){let a=Ze(e.data,"source"),c=Ze(e.data,"taskId"),u=(o=e.data)==null?void 0:o.touchedScopes;return!(a&&c&&Array.isArray(u))||u.some(d=>d!=="user"&&d!=="project")?Os(e,t,BL):[{...t,type:"workspace.memory.changed",scope:n,source:a,taskId:c,touchedScopes:u}]}let s=Ze(e.data,"filePath"),r=Ze(e.data,"mode"),i=jr(tn(e.data)?e.data:void 0,"bytesWritten");return n!=="workspace"&&n!=="global"||!s||r!=="append"&&r!=="replace"||i===void 0?Os(e,t,BL):[{...t,type:"workspace.memory.changed",scope:n,filePath:s,mode:r,bytesWritten:i}]}function Kde(e,t){let n=Ze(e.data,"change"),s=Ze(e.data,"name"),r=Ze(e.data,"level");return n!=="created"&&n!=="updated"&&n!=="deleted"||!s||r!=="project"&&r!=="user"?Os(e,t,"malformed agent_changed payload"):[{...t,type:"workspace.agent.changed",change:n,name:s,level:r}]}function Yde(e,t){let n=Ze(e.data,"toolName"),s=tn(e.data)&&typeof e.data.enabled=="boolean"?e.data.enabled:void 0;return!n||s===void 0?Os(e,t,"malformed tool_toggled payload"):[{...t,type:"workspace.tool.toggled",toolName:n,enabled:s}]}function Xde(e,t){let n=Ze(e.data,"key"),s=Ze(e.data,"scope");return n?[{...t,type:"workspace.settings.changed",key:n,scope:s??"workspace",value:tn(e.data)?e.data.value:void 0}]:Os(e,t,"malformed settings_changed payload")}function Qde(e,t){return tn(e.data)?[{...t,type:"workspace.settings.changed",key:"settings_reloaded",scope:"workspace",value:e.data}]:Os(e,t,"malformed settings_reloaded payload")}function Jde(e,t){let n=Ze(e.data,"path"),s=Ze(e.data,"action");return!n||s!=="created"&&s!=="overwrote"&&s!=="noop"?Os(e,t,"malformed workspace_initialized payload"):[{...t,type:"workspace.initialized",path:n,action:s}]}function Zde(e,t){let n=Ze(e.data,"workspaceCwd"),s=Ze(e.data,"desiredState"),r=Ze(e.data,"reason");return!n||s!=="trusted"&&s!=="untrusted"?Os(e,t,"bad trust_change_requested payload"):[{...t,type:"workspace.trust.change.requested",workspaceCwd:n,desiredState:s,...r!==void 0?{reason:r}:{}}]}function ehe(e,t){let n=Ze(e.data,"releaseTag"),s=Ze(e.data,"readmeUrl");if(!n||!s||!tn(e.data))return Os(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 the(e,t){if(!tn(e.data))return Os(e,t,"non-object payload");let n=jr(e.data,"liveCount"),s=jr(e.data,"reservedCount"),r=jr(e.data,"budget"),i=jr(e.data,"thresholdRatio"),o=Ze(e.data,"mode");return n===void 0||s===void 0||r===void 0||i===void 0||o!=="warn"&&o!=="enforce"?Os(e,t,"malformed mcp_budget_warning payload"):[{...t,type:"workspace.mcp.budget_warning",liveCount:n,reservedCount:s,budget:r,thresholdRatio:i,mode:o}]}function nhe(e,t){if(!tn(e.data))return Os(e,t,"non-object payload");let n=Array.isArray(e.data.refusedServers)?e.data.refusedServers.filter(tn).map(o=>{let a=Ze(o,"name"),c=Ze(o,"transport"),u=Ze(o,"reason");return!a||!c||u!=="budget_exhausted"?null:{name:a,transport:c,reason:"budget_exhausted"}}).filter(o=>o!==null):[],s=jr(e.data,"budget"),r=jr(e.data,"liveCount"),i=jr(e.data,"reservedCount");return n.length===0||s===void 0||r===void 0||i===void 0?Os(e,t,"malformed mcp_child_refused_batch payload"):[{...t,type:"workspace.mcp.child_refused",refusedServers:n,budget:s,liveCount:r,reservedCount:i}]}function she(e,t){let n=Ze(e.data,"serverName"),s=jr(e.data,"durationMs");return!n||s===void 0?Os(e,t,"malformed mcp_server_restarted payload"):[{...t,type:"workspace.mcp.server_restarted",serverName:n,durationMs:s}]}function rhe(e,t){let n=Ze(e.data,"serverName"),s=Ze(e.data,"reason");return!n||!s||!wde.has(s)?Os(e,t,"malformed mcp_server_restart_refused payload"):[{...t,type:"workspace.mcp.server_restart_refused",serverName:n,reason:s}]}function P5(e,t,n){let s=Ze(e.data,n?"name":"serverName"),r=n??Ze(e.data,"action");return!s||!r||!["added","removed","approve","enable","disable","authenticate","clear-auth"].includes(r)?Os(e,t,`malformed ${e.type} payload`):[{...t,type:"workspace.mcp.server_changed",serverName:s,action:r}]}function ihe(e,t){let n=jr(e.data,"refreshed"),s=jr(e.data,"failed"),r=Ze(e.data,"status"),i=Ze(e.data,"source"),o=Ze(e.data,"name"),a=Ze(e.data,"version"),c=Ze(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"?Os(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}:{},...c?{error:c}:{}}]}function ohe(e,t){let n=Ze(e.data,"deviceFlowId"),s=Ze(e.data,"providerId"),r=jr(e.data,"expiresAt");return!n||!s||!KW.has(s)||r===void 0?Os(e,t,"malformed auth_device_flow_started payload"):[{...t,type:"auth.device_flow.started",deviceFlowId:n,providerId:s,expiresAt:r}]}function ahe(e,t){let n=Ze(e.data,"deviceFlowId"),s=jr(e.data,"intervalMs");return!n||s===void 0?Os(e,t,"malformed auth_device_flow_throttled payload"):[{...t,type:"auth.device_flow.throttled",deviceFlowId:n,intervalMs:s}]}function lhe(e,t){let n=Ze(e.data,"deviceFlowId"),s=Ze(e.data,"providerId");if(!n||!s||!KW.has(s))return Os(e,t,"malformed auth_device_flow_authorized payload");let r=jr(e.data,"expiresAt"),i=Ze(e.data,"accountAlias");return[{...t,type:"auth.device_flow.authorized",deviceFlowId:n,providerId:s,...r!==void 0?{expiresAt:r}:{},...i?{accountAlias:i}:{}}]}function che(e,t){let n=Ze(e.data,"deviceFlowId"),s=Ze(e.data,"errorKind");if(!n||!uhe(s))return Os(e,t,"malformed auth_device_flow_failed payload");let r=Ze(e.data,"hint");return[{...t,type:"auth.device_flow.failed",deviceFlowId:n,errorKind:s,...r?{hint:r}:{}}]}function uhe(e){return typeof e=="string"&&e.trim().length>0}function dhe(e,t){let n=Ze(e.data,"deviceFlowId");return n?[{...t,type:"auth.device_flow.cancelled",deviceFlowId:n}]:Os(e,t,"malformed auth_device_flow_cancelled payload")}function jr(e,t){if(!tn(e))return;let n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function hhe(e,t){if(!tn(e))return;let n=e[t];return typeof n=="string"&&n.length>0?n:void 0}var fhe=8;function L_(e,t={},n=0){if(n>fhe){let g=t.title??t.toolName??t.toolKind;return{kind:"generic",...g?{summary:g}:{}}}if(tn(e)){let g=e.rawInput??e.input??e.args;if(g!==void 0&&g!==e){let b=L_(g,{title:t.title??or(e,["title"]),toolName:t.toolName??or(e,["toolName","name"]),toolKind:t.toolKind??or(e,["kind"])},n+1);if(b.kind!=="generic"||!b.summary)return b}}let s=yhe(e);if(s.length>0)return{kind:"ask_user_question",questions:s};let r=bhe(e,t);if(r)return r;let i=khe(e,t);if(i)return i;let o=_he(e,t);if(o)return o;let a=She(e,t);if(a)return a;let c=mhe(e,t);if(c)return c;let u=phe(e,t);if(u)return u;let d=ghe(e);if(d)return d;let h=Che(e,t);if(h)return h;let m=The(e);if(m)return m;if(tn(e)){let g=or(e,["command","cmd"]);if(g){let v=or(e,["cwd","directory","workingDirectory"]);return{kind:"command",command:g,...v?{cwd:v}:{}}}let b=vhe(e);if(b.length>0)return{kind:"key_value",rows:b}}let p=t.title??t.toolName??t.toolKind;return{kind:"generic",...p?{summary:p}:{}}}function mhe(e,t={}){if(!tn(e))return;let n=or(e,["path","filePath","file_path","absolutePath"]);if(!n)return;let s=or(e,["oldText","old_text","old_str","oldString"]),r=or(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?or(e,["content"]):void 0,c=r??a,u=or(e,["patch","diff","unified_diff"]);if(!(!s&&!c&&!u))return{kind:"file_diff",path:n,...s?{oldText:s}:{},...c?{newText:c}:{},...u?{patch:u}:{}}}function phe(e,t){if(!tn(e))return;let n=or(e,["path","filePath","file_path","absolutePath"]);if(!n)return;let s=t.toolName??or(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,c=e.limit;typeof a=="number"&&typeof c=="number"&&c>0&&(o=[a+1,a+c])}if(!(!r&&!o))return{kind:"file_read",path:n,...o?{range:o}:{}}}function ghe(e){if(!tn(e))return;let t=or(e,["url","uri","href"]);if(!t||!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(t))return;let n=or(e,["method","httpMethod"]);return{kind:"web_fetch",url:t,...n?{method:n}:{}}}function bhe(e,t){let n=t.toolName??(tn(e)?or(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(tn(e)){let c=e.arguments??e.args??e;if(tn(c)){let u=Object.entries(c).filter(([d])=>d!=="name"&&d!=="toolName").slice(0,1).map(([d,h])=>{let m=typeof h=="string"?h:JSON.stringify(h),p=m.length>60?`${m.slice(0,60)}…`:m;return`${d}=${p}`})[0];u&&(a=u)}}return{kind:"mcp_invocation",serverId:i,toolName:o,...a?{argsSummary:a}:{}}}function yhe(e){return!tn(e)||!Array.isArray(e.questions)?[]:e.questions.filter(tn).map(t=>{let n=or(t,["header","title","label"]),s=or(t,["question","prompt","text"])??"Question",r=Array.isArray(t.options)?t.options.filter(tn).map(xhe):[];return{...n?{header:n}:{},question:s,options:r,raw:t}})}function xhe(e){let t=or(e,["label","title","value"])??"Option",n=or(e,["description","detail","text"]);return{label:t,...n?{description:n}:{},raw:e}}function vhe(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=or(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)||tn(r)||t.push({label:s,value:GW(s)?"[redacted]":$d(r)});return t}var HL=50,whe=5;function khe(e,t){let n=t.toolName??"";if(!(/^task$/i.test(n)||/(?:^|_)(?:delegate|subagent|spawn[_-]?task)$/i.test(n)||/agent/i.test(t.toolKind??""))||!tn(e))return;let s=or(e,["subagent_type","agent","agentName","agent_name","subagent"]),r=or(e,["prompt","task","description","instruction","query"]);if(!s&&!r)return;let i=or(e,["parentDelegationId","parent_delegation_id","parent_id"]);return{kind:"subagent_delegation",agentName:s??"subagent",task:r??"(no task description)",...i?{parentDelegationId:i}:{}}}function _he(e,t){if(!tn(e))return;let n=or(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,whe).map(a=>typeof a=="string"?a:tn(a)?or(a,["path","file","name","title","text"])??xf(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 She(e,t){let n=t.toolName??"";if(!/(image[_-]?gen|generate[_-]?image|diffusion|dalle|imagen|flux|stable[_-]?diffusion|midjourney|sora)/i.test(n)||!tn(e))return;let s=or(e,["prompt","description","query"]);if(!s)return;let r=or(e,["thumbnailUrl","thumbnail","url","imageUrl","preview"]),i=or(e,["model","modelId","model_name"]);return{kind:"image_generation",prompt:s,...r?{thumbnailUrl:r}:{},...i?{model:i}:{}}}function Che(e,t){if(!tn(e))return;let n=or(e,["code","snippet","source"]);if(!n)return;let s=or(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=or(e,["origin","source_location","path"]);return{kind:"code_block",code:n,...s?{language:s}:{},...o?{origin:o}:{}}}function The(e){if(!tn(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,HL).map(o=>Array.isArray(o)?o.map(a=>typeof a=="string"?a:xf(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&&tn(s[0])){let r=Object.keys(s[0]).slice(0,30);if(r.length===0)return;let i=s.slice(0,HL).map(o=>{let a=o;return r.map(c=>{let u=a[c];return typeof u=="string"?u:xf(u).slice(0,80)})});return{kind:"tabular",columns:r,rows:i,...s.length>i.length?{totalRows:s.length}:{}}}}var Ehe=1e3,tp="__trimmed_tool_block__",j4="__trimmed_permission_block__",b7=1e5,UL=`
[truncated]
`,Ahe=16,ux=new WeakMap;function Nhe(e={}){let t={blocks:[],blockIndexById:Ii(),toolBlockByCallId:Ii(),trimmedToolNotificationByCallId:Ii(),permissionBlockByRequestId:Ii(),activeAssistantBlockByParent:Ii(),activeThoughtBlockByParent:Ii(),toolProgress:Ii(),awaitingResync:!1,resyncRequiredCount:0,nextOrdinal:1,now:e.now??Date.now(),maxBlocks:e.maxBlocks??Ehe};return e.onTruncation&&ux.set(t,e.onTruncation),t}var yN=new Set(["pending","confirming","running","in_progress"]),jhe=new Set(["completed","success","failed","error","canceled","cancelled"]),Mhe=new Set(["session.state_resync_required","assistant.done","status","debug","error"]);function Ihe(e,t,n={}){let s=eG(e,n);kN(s);let r=_N(s,"user",t,void 0,void 0,n.meta);return n.images&&n.images.length>0&&(r.images=[...n.images]),Ru(s,r),s.activeUserBlockId=r.id,tG(s)}function Rhe(e,t,n={}){if(t.length===0)return e;let s=eG(e,n);for(let i of t)Dhe(s,i);return tG(s)}function xN(e){let t=Ii();return e.forEach((n,s)=>{t[n.id]=s}),t}function Dhe(e,t){var n;if(t.eventId!==void 0&&(e.lastEventId=Math.max(e.lastEventId??0,t.eventId)),e.awaitingResync&&!Mhe.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),O5(e,"user","activeUserBlockId",t.text,t);break;case"user.image.delta":{let s=e.activeUserBlockId?e.blockIndexById[e.activeUserBlockId]:void 0,r=s!==void 0?e.blocks[s]:void 0;if((r==null?void 0:r.kind)!=="user"||!sG(r.sourceRecordIds,t.sourceRecordIds)){let i=_N(e,"user","",t.eventId,t.serverTimestamp,void 0,t.sourceRecordIds);i.images=[{data:t.data,mimeType:t.mimeType}],Ru(e,i),e.activeUserBlockId=i.id}else{let i=lc(e,e.activeUserBlockId);i&&i.kind==="user"&&(i.images=[...i.images??[],{data:t.data,mimeType:t.mimeType}])}break}case"assistant.text.delta":O5(e,"assistant","activeAssistantBlockId",t.text,t);break;case"assistant.done":kN(e,t),(t.reason==="cancelled"||t.reason==="error")&&y7(e);break;case"assistant.usage":Ohe(e,t);break;case"thought.text.delta":O5(e,"thought","activeThoughtBlockId",t.text,t);break;case"tool.update":ZW(e,t);break;case"shell.output":zhe(e,t);break;case"user.shell.output":Fhe(e,t);break;case"permission.request":qhe(e,t);break;case"permission.resolved":Hhe(e,t);break;case"model.changed":Ey(e,"status",`Model switched: ${t.modelId}`,t);break;case"status":case"debug":case"error":Ey(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":Lhe(e,t);break;case"prompt.cancelled":y7(e),t.reason!=="forward_failed"&&Uhe(e,t);break;case"followup.suggestion":e.lastFollowupSuggestion={suggestion:t.suggestion,promptId:t.promptId};break;case"session.replay_complete":break;case"session.rewound":Whe(e,t.targetTurnIndex);break;case"session.branched":Ey(e,"status",`Branched conversation "${t.displayName}". You are now in the branch.`,t);break}}function Lhe(e,t){e.awaitingResync=!0,e.resyncRequiredCount+=1,e.lastResyncRequired={reason:t.reason,lastDeliveredId:t.lastDeliveredId,earliestAvailableId:t.earliestAvailableId},y7(e),Ey(e,"error",`State resync required: ${Phe(t.lastDeliveredId,t.earliestAvailableId)}.`,t)}function Phe(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 M4(e,t,n){let s=lc(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 QW(e,t){M4(e,e.activeAssistantBlockId,t),e.activeAssistantBlockId=void 0}function Ohe(e,t){let n=lc(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 JW(e,t){M4(e,e.activeThoughtBlockId,t),e.activeThoughtBlockId=void 0}function vN(e,t,n){M4(e,e.activeAssistantBlockByParent[t],n),delete e.activeAssistantBlockByParent[t]}function wN(e,t,n){M4(e,e.activeThoughtBlockByParent[t],n),delete e.activeThoughtBlockByParent[t]}function O5(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],c=lc(e,a);if(c&&c.kind===t&&Bhe(c,r)){c.text=CN(e,c,s),c.updatedAt=e.now,r.eventId!==void 0&&(c.eventId=r.eventId),r.serverTimestamp!==void 0&&(c.serverTimestamp=r.serverTimestamp),"meta"in r&&r.meta&&(c.meta={...c.meta,...r.meta}),t!=="user"&&(c.streaming=!0);return}(c==null?void 0:c.kind)===t&&t!=="user"&&(c.streaming=!1,c.updatedAt=e.now);let u=_N(e,t,s,r.eventId,r.serverTimestamp,"meta"in r?r.meta:void 0,r.sourceRecordIds);t!=="user"&&(u.streaming=!0),t==="thought"&&(u.collapsed=!0),i!=null&&(u.parentToolCallId=i),Ru(e,u),o&&i!=null?o[i]=u.id:e[n]=u.id,i!=null?(t==="assistant"&&wN(e,i),t==="thought"&&vN(e,i)):(t!=="user"&&(e.activeUserBlockId=void 0),t!=="assistant"&&QW(e),t!=="thought"&&JW(e))}function Bhe(e,t){var n,s;return e.kind!=="user"&&e.kind!=="assistant"&&e.kind!=="thought"||((n=e.meta)==null?void 0:n.qwenDiscreteMessage)===!0||!sG(e.sourceRecordIds,t.sourceRecordIds)?!1:!("meta"in t)||((s=t.meta)==null?void 0:s.qwenDiscreteMessage)!==!0}function kN(e,t){QW(e,t);for(let n of Object.keys(e.activeAssistantBlockByParent))vN(e,n,t);for(let n of Object.keys(e.activeThoughtBlockByParent))wN(e,n,t);JW(e,t)}function ZW(e,t){let n=e.toolBlockByCallId[t.toolCallId];if(n===tp){if(Vhe(t))return delete e.toolBlockByCallId[t.toolCallId],delete e.trimmedToolNotificationByCallId[t.toolCallId],ZW(e,t);e.trimmedToolNotificationByCallId[t.toolCallId]||(e.trimmedToolNotificationByCallId[t.toolCallId]=!0,Ey(e,"error",`Tool ${t.toolCallId} output trimmed (max blocks reached)`,t,{clearActiveText:!1}));return}let s=lc(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=L_(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),s.sourceRecordIds=Yhe(s.sourceRecordIds,t.sourceRecordIds),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!==tp&&(s.parentBlockId=o)}t.subagentType&&!s.subagentType&&(s.subagentType=t.subagentType),VL(e,t.toolCallId,t.status);return}let r=t.parentToolCallId&&e.toolBlockByCallId[t.parentToolCallId]!==tp?e.toolBlockByCallId[t.parentToolCallId]:void 0,i={id:Uf(e,"tool"),kind:"tool",toolCallId:t.toolCallId,title:t.title??t.toolName??t.toolKind??"Tool",status:t.status??"pending",preview:L_(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.sourceRecordIds?{sourceRecordIds:[...t.sourceRecordIds]}:{},...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}:{}};Ru(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=lc(e,o.id);(a==null?void 0:a.kind)==="tool"&&(a.parentBlockId=i.id)}VL(e,t.toolCallId,t.status??"pending"),Rp(e,t.parentToolCallId)}function VL(e,t,n){if(n!==void 0){if(yN.has(n)){e.currentToolCallId=t;return}if(jhe.has(n)){e.currentToolCallId===t&&(e.currentToolCallId=$he(e));return}}}function $he(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"&&yN.has(n.status))return n.toolCallId}}function y7(e){for(let t of Object.values(e.toolBlockByCallId)){if(t===tp)continue;let n=lc(e,t);!n||n.kind!=="tool"||yN.has(n.status)&&(n.status="cancelled",n.updatedAt=e.now)}e.currentToolCallId=void 0}function zhe(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 i=lc(e,n.id);(i==null?void 0:i.kind)==="shell"&&(i.text=CN(e,i,t.text),i.updatedAt=e.now,t.eventId!==void 0&&(i.eventId=t.eventId));return}let s=Uf(e,"shell"),r={id:s,kind:"shell",text:fv(e,s,void 0,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}:{}};Ru(e,r),Rp(e)}function Fhe(e,t){if(!t.text)return;let n=e.blocks[e.blocks.length-1];if((n==null?void 0:n.kind)==="user_shell"&&n.stream===t.stream&&!e.pendingUserShellCommand){let a=lc(e,n.id);(a==null?void 0:a.kind)==="user_shell"&&(a.text=CN(e,a,t.text),a.updatedAt=e.now,t.eventId!==void 0&&(a.eventId=t.eventId));return}let s=e.pendingUserShellCommand,r=(n==null?void 0:n.kind)==="user_shell"?n:void 0,i=Uf(e,"user-shell"),o={id:i,kind:"user_shell",text:fv(e,i,void 0,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,Ru(e,o),Rp(e)}function qhe(e,t){let n=e.permissionBlockByRequestId[t.requestId];if(n===j4)return;let s=lc(e,n),r=L_(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:Uf(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}:{}};Ru(e,i),e.permissionBlockByRequestId[t.requestId]=i.id,Rp(e)}function Hhe(e,t){let n=e.permissionBlockByRequestId[t.requestId];if(n===void 0||n===j4)return;let s=lc(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:Uf(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}:{}};Ru(e,r),e.permissionBlockByRequestId[t.requestId]=r.id,Rp(e)}function Ey(e,t,n,s,r={}){let i=Uf(e,t),o={id:i,kind:t,text:fv(e,i,void 0,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}}:{}};Ru(e,o),r.clearActiveText!==!1&&Rp(e)}function Uhe(e,t){let n={id:Uf(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}:{}};Ru(e,n),Rp(e)}function _N(e,t,n,s,r,i,o){let a=Uf(e,t);return{id:a,kind:t,text:fv(e,a,o,n),clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...s!==void 0?{eventId:s}:{},...r!==void 0?{serverTimestamp:r}:{},...o?{sourceRecordIds:[...o]}:{},...i?{meta:{...i}}:{}}}function eG(e,t){let n={...e,now:t.now??Date.now(),maxBlocks:t.maxBlocks??e.maxBlocks,blocks:e.blocks,blockIndexById:e.blockIndexById,toolBlockByCallId:Ii(e.toolBlockByCallId),activeAssistantBlockByParent:Ii(e.activeAssistantBlockByParent),activeThoughtBlockByParent:Ii(e.activeThoughtBlockByParent),trimmedToolNotificationByCallId:Ii(e.trimmedToolNotificationByCallId),permissionBlockByRequestId:Ii(e.permissionBlockByRequestId),toolProgress:Ii(Object.fromEntries(Object.entries(e.toolProgress).map(([r,i])=>[r,{...i}]))),lastResyncRequired:e.lastResyncRequired!==void 0?{...e.lastResyncRequired}:void 0,lastFollowupSuggestion:e.lastFollowupSuggestion},s=t.onTruncation??ux.get(e);return s&&ux.set(n,s),n}function tG(e){var s;if(e.blocks.length<=e.maxBlocks)return e;(s=ux.get(e))==null||s({kind:"blocks"});let t=e.blocks.slice(-e.maxBlocks),n=new Set(t.map(r=>r.id));e.blocks=t,e.blockIndexById=xN(t),P_.set(e,e.blocks);for(let[r,i]of Object.entries(e.toolBlockByCallId))n.has(i)||(e.toolBlockByCallId[r]=tp);Xhe(e);for(let[r]of Object.entries(e.trimmedToolNotificationByCallId))e.toolBlockByCallId[r]!==tp&&delete e.trimmedToolNotificationByCallId[r];for(let[r,i]of Object.entries(e.permissionBlockByRequestId))n.has(i)||(e.permissionBlockByRequestId[r]=j4);Qhe(e);for(let r of e.blocks)if(r.kind==="tool"&&r.parentBlockId&&!n.has(r.parentBlockId)){let i=lc(e,r.id);(i==null?void 0:i.kind)==="tool"&&(i.parentBlockId=void 0)}n.has(e.activeUserBlockId??"")||(e.activeUserBlockId=void 0),n.has(e.activeAssistantBlockId??"")||(e.activeAssistantBlockId=void 0),n.has(e.activeThoughtBlockId??"")||(e.activeThoughtBlockId=void 0);for(let[r,i]of Object.entries(e.activeAssistantBlockByParent))n.has(i)||delete e.activeAssistantBlockByParent[r];for(let[r,i]of Object.entries(e.activeThoughtBlockByParent))n.has(i)||delete e.activeThoughtBlockByParent[r];return e}function Vhe(e){return e.toolCallId===f7||e.toolKind==="updated_plan"}var P_=new WeakMap;function SN(e){P_.get(e)!==e.blocks&&(e.blocks=[...e.blocks],e.blockIndexById=Ii(e.blockIndexById),P_.set(e,e.blocks))}function Whe(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){WL(e,i);return}n+=1}s>=0&&t>=n&&WL(e,s)}function WL(e,t){SN(e),e.blocks=e.blocks.slice(0,t),P_.set(e,e.blocks),Ghe(e)}function Ghe(e){e.blockIndexById=xN(e.blocks),e.toolBlockByCallId=Ii(),e.permissionBlockByRequestId=Ii(),e.trimmedToolNotificationByCallId=Ii(),e.activeUserBlockId=void 0,e.activeAssistantBlockId=void 0,e.activeThoughtBlockId=void 0,e.activeAssistantBlockByParent=Ii(),e.activeThoughtBlockByParent=Ii(),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 Ru(e,t){SN(e),e.blockIndexById[t.id]=e.blocks.length,e.blocks.push(t)}function lc(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=Khe(s);return SN(e),e.blocks[n]=r,r}function Khe(e){return e.kind==="permission"?{...e,options:e.options.map(t=>iu(t)),toolCall:iu(e.toolCall),preview:iu(e.preview)}:e.kind==="tool"?{...e,preview:iu(e.preview),content:iu(e.content),locations:iu(e.locations),rawInput:iu(e.rawInput),rawOutput:iu(e.rawOutput)}:{...e}}function Uf(e,t){let n=`${t}-${e.nextOrdinal}`;return e.nextOrdinal+=1,n}function Rp(e,t){t?(vN(e,t),wN(e,t)):(kN(e),e.activeUserBlockId=void 0)}function CN(e,t,n){let s="text"in t?t.text:"";return s.length>=b7?(n&&nG(e,t.id,t.sourceRecordIds),s):fv(e,t.id,t.sourceRecordIds,s+n)}function fv(e,t,n,s){if(s.length<=b7)return s;nG(e,t,n);let r=Math.max(0,b7-UL.length);return`${s.slice(0,r)}${UL}`}function nG(e,t,n){var s;(s=ux.get(e))==null||s({kind:"text",blockId:t,sourceRecordIds:n})}function Ii(e){return Object.assign(Object.create(null),e)}function sG(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((n,s)=>n===t[s])}function Yhe(e,t){if(!(!e&&!t))return[...new Set([...e??[],...t??[]])]}function Xhe(e){let t=Math.max(0,e.maxBlocks),n=Object.entries(e.toolBlockByCallId).filter(([,r])=>r===tp).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 Qhe(e){let t=Math.max(0,e.maxBlocks),n=Object.entries(e.permissionBlockByRequestId).filter(([,r])=>r===j4).map(([r])=>r),s=n.length-t;if(!(s<=0))for(let r of n.slice(0,s))delete e.permissionBlockByRequestId[r]}function iu(e,t=0){return t>Ahe?e:Array.isArray(e)?e.map(n=>iu(n,t+1)):tn(e)?Object.fromEntries(Object.entries(e).map(([n,s])=>[n,iu(s,t+1)])):e}function x7(e={}){let t=GL(e),n=new Set,s=!1,r=()=>{for(let o of n)try{o()}catch(a){Jhe(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=Rhe(t,a),i())},appendLocalUserMessage(o,a,c){t=Ihe(t,o,{images:a,meta:c}),i()},reset(o={}){t=GL({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 Jhe(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 GL(e){let t=e.blocks?[...e.blocks]:[];return{...Nhe({maxBlocks:e.maxBlocks,now:e.now}),...e,blocks:t,blockIndexById:xN(t),toolBlockByCallId:l0(e.toolBlockByCallId),trimmedToolNotificationByCallId:l0(e.trimmedToolNotificationByCallId),permissionBlockByRequestId:l0(e.permissionBlockByRequestId),toolProgress:l0(e.toolProgress),activeAssistantBlockByParent:l0(e.activeAssistantBlockByParent),activeThoughtBlockByParent:l0(e.activeThoughtBlockByParent),lastResyncRequired:e.lastResyncRequired!==void 0?{...e.lastResyncRequired}:void 0,lastFollowupSuggestion:e.lastFollowupSuggestion!==void 0?{...e.lastFollowupSuggestion}:void 0}}function l0(e){return Object.assign(Object.create(null),e)}var Zhe="web-shell:goal-status:v1:";/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function KL(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 c of e.providers)for(const u of c.models){!i&&u.isCurrent&&(i=u.modelId),a===void 0&&(i?u.modelId===i:u.isCurrent)&&(a=u.contextLimit);const d=[c.authType,u.modelId,u.baseUrl??"",u.envKey??""].join("\0");s.has(d)||(s.add(d),r.push({id:u.modelId,baseModelId:u.baseModelId,label:u.name||u.modelId,authType:c.authType,...u.contextLimit!==void 0?{contextWindow:u.contextLimit}:{},...u.modalities!==void 0?{modalities:u.modalities}:{},...u.baseUrl!==void 0?{baseUrl:u.baseUrl}:{},...u.envKey!==void 0?{envKey:u.envKey}:{},...u.isRuntime?{isRuntime:!0}:{}}))}return{models:r,currentModel:i,currentMode:o,contextWindow:a}}function efe(e){var t;const n=ko((t=e==null?void 0:e.state)==null?void 0:t.models);if(!n)return;const s=pi(n,"currentModelId")??pi(n,"currentModel"),r=n.availableModels,i=[];let o;if(Array.isArray(r))for(const a of r){const c=ko(a),u=pi(c,"modelId")??pi(c,"id")??pi(c,"value");if(!u)continue;const d=ko(c==null?void 0:c._meta),h=Xb(d,"contextLimit")??Xb(d,"contextWindow")??Xb(c,"contextLimit")??Xb(c,"contextWindow");o===void 0&&s!==void 0&&u===s&&(o=h),i.push({id:u,baseModelId:pi(c,"baseModelId")??ife(u),label:pi(c,"name")??pi(c,"label")??u,...h!==void 0?{contextWindow:h}:{}})}if(!(!s&&i.length===0))return{models:i,currentModel:s,contextWindow:o}}function rG(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}:{},...aG(s._meta),raw:s}}),n=e.availableSkills.map(s=>({name:s,description:"",raw:{name:s,description:"",input:null,_meta:{source:"skill"}}}));return{commands:iG(t,n),skills:e.availableSkills}}function YL(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 iG(...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 tfe(e,t){var n;if(e.type==="session_update"){const s=ko((n=ko(e.data))==null?void 0:n.update),r=oG(s);if(r&&t(i=>({...i,tokenUsage:r,tokenCount:TN(r)})),pi(s,"sessionUpdate")==="available_commands_update"){const{commands:i,skills:o}=rfe(s);t(a=>({...a,commands:i,skills:o}))}return}switch(e.type){case"git_branch_changed":{const s=ko(e.data),r=pi(s,"workspaceCwd"),i=pi(s,"branch");t(o=>r&&r!==o.workspaceCwd?o:{...o,gitBranch:i});break}case"session_metadata_updated":{const s=ko(e.data);Object.prototype.hasOwnProperty.call(s??{},"displayName")&&t(r=>({...r,displayName:pi(s,"displayName")}));break}case"model_switched":{const s=pi(ko(e.data),"modelId");s&&t(r=>({...r,currentModel:s}));break}case"approval_mode_changed":{const s=ko(e.data),r=pi(s,"next")??pi(s,"mode");r&&t(i=>({...i,currentMode:r}));break}}}function XL(e){const t=pi(e,"displayName");return t!=null&&t.trim()?t:void 0}function nfe(e){var t;const n=ko((t=e==null?void 0:e.state)==null?void 0:t.modes);return pi(n,"currentModeId")??pi(n,"currentMode")}function TN(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 sfe(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=ko((t=ko(s.data))==null?void 0:t.update),i=oG(r);if(i)return i}catch{}}function oG(e){const t=ko(e==null?void 0:e._meta);if((t==null?void 0:t.parentToolCallId)!==void 0)return;const n=ko(t==null?void 0:t.usage),s={..._b(n,"inputTokens"),..._b(n,"outputTokens"),..._b(n,"totalTokens"),..._b(n,"thoughtTokens"),..._b(n,"cachedReadTokens")};return TN(s)!==void 0?s:void 0}function _b(e,t){const n=Xb(e,t);return n!==void 0&&n>=0?{[t]:n}:{}}function rfe(e){if(!e)return{commands:[],skills:[]};const n=(Array.isArray(e.availableCommands)?e.availableCommands:[]).flatMap(i=>{var o;const a=ko(i),c=pi(a,"name");if(!c)return[];const u=ko(a==null?void 0:a.input),d={name:c,description:pi(a,"description")??"",input:u?{hint:pi(u,"hint")??""}:null,_meta:ko(a==null?void 0:a._meta)??null};return[{name:c,description:d.description??"",...(o=d.input)!=null&&o.hint?{argumentHint:d.input.hint}:{},...aG(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:iG(n,r),skills:s}}function aG(e){const n=pi(e??void 0,"source");return{...n?{source:n}:{}}}function ko(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function pi(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function Xb(e,t){const n=e==null?void 0:e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function ife(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 QL(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 ofe=3e4;function afe(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 ct(e,t,n=ofe){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 lfe(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 vi(e){e.current!==void 0&&(clearTimeout(e.current),e.current=void 0)}function cfe(e,t,n="replay",s=80,r){vi(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 ufe="qwen-code-webui-client-id:session:";function B5(e,t){if(e)return e;if(typeof window>"u")return $5();try{if(t){const n=window.sessionStorage.getItem(lG(t));if(n)return n}return $5()}catch{return $5()}}function _2(e,t){if(!(!e||!t||typeof window>"u"))try{window.sessionStorage.setItem(lG(t),e)}catch{}}async function JL(e){if(!e.clientId)return;const t={"X-Qwen-Client-Id":e.clientId};e.token&&(t.Authorization=`Bearer ${e.token}`);const n=`${dfe(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 $5(){return`webui_${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}function lG(e){return`${ufe}${encodeURIComponent(e)}`}function dfe(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 hfe(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 ffe({store:e,sessionRef:t,activePromptsRef:n,settledPromptsRef:s,pendingSessionLoadRef:r,pendingSessionLoadIdRef:i,heartbeatSupportedRef:o,manualSessionClearRef:a,skipNextCleanupDetachSessionIdRef:c,passiveAssistantDoneTimerRef:u,getCreateSessionRequest:d,createDetachedSession:h,getConnection:m,hasSessionActivePrompt:p,resetCurrentSessionActivePrompt:g,restartEventStream:b,addNotice:v,setConnection:x,setPromptStatus:y,setRestoreSessionId:w,setRestoreWorkspaceCwd:k,setRestoreMode:T,setRestoreSessionNonce:S,setAttachSessionNonce:C,setNewSessionNonce:_}){function B(){for(const[,j]of n.current)j.controller.abort();n.current.clear(),s.current.clear(),y("idle"),vi(u),r.current&&(c.current===r.current.sessionId&&(c.current=void 0),clearTimeout(r.current.timeout),r.current.reject(new DOMException("Session cleared","AbortError")),r.current=void 0),e.reset(),w(void 0),k(void 0)}function A(j,P){const L=i.current+1;return i.current=L,r.current&&(clearTimeout(r.current.timeout),r.current.reject(new DOMException(`Session ${P} superseded by a newer request`,"AbortError"))),new Promise(($,z)=>{const F=setTimeout(()=>{var G;((G=r.current)==null?void 0:G.id)===L&&(r.current=void 0,z(lr(v,`${yfe(P)} session failed`,new Error(`Session ${P} timed out`),xfe(P))))},3e4);r.current={id:L,sessionId:j,mode:P,timeout:F,resolve:$,reject:z}})}function N(j,P,L){var O;a.current=!1;const $=A(j,P),z=t.current,F=z==null?void 0:z.sessionId,G=F?n.current.get(F):void 0;return(O=G==null?void 0:G.reject)==null||O.call(G,new DOMException("Session switch interrupted prompt wait","AbortError")),F&&n.current.delete(F),g(),z&&z.detach().catch(I=>{console.warn("[DaemonSessionActions] detach before session switch failed:",I)}),t.current=void 0,x(I=>({...I,status:"connecting",sessionId:j,clientId:void 0,displayName:void 0,error:void 0,errorStatus:void 0,missingSession:!1,loadingTranscript:!0,catchingUp:void 0})),y("idle"),s.current.clear(),vi(u),e.reset(),T(P),w(j),k(L??m().workspaceCwd),S(I=>I+1),$.catch(I=>{throw Qb(I)||x(Q=>({...Q,loadingTranscript:void 0,catchingUp:void 0})),I})}return{async sendPrompt(j,P){var L,O,$,z,F;const G=wr(v,t.current,"Prompt failed","send_prompt"),I=G.sessionId;if(n.current.has(I))throw lr(v,"Prompt failed","A prompt is already in progress","send_prompt");vi(u),y("waiting");const Q=new AbortController;n.current.set(I,{controller:Q});try{const V=((P==null?void 0:P.images)??[]).map(X=>({data:X.data,mimeType:X.mimeType||X.mediaType||X.media_type||"image/*"})),M=P!=null&&P.inputAnnotations&&P.inputAnnotations.length>0?P.inputAnnotations:void 0;(P==null?void 0:P.optimisticUserMessage)!==!1&&e.appendLocalUserMessage(j,V,M?{inputAnnotations:M}:void 0);const re={prompt:QL(j,V)};M&&(re._meta={inputAnnotations:M}),P!=null&&P.retry&&(re.retry=!0);const se=await G.submitPrompt(re,Q.signal);return((L=n.current.get(I))==null?void 0:L.controller)===Q&&b(I),(O=P==null?void 0:P.onAdmitted)==null||O.call(P),await mfe(n.current,s.current,I,Q,se.promptId)}catch(V){if(Qb(V))return(($=t.current)==null?void 0:$.sessionId)===I&&e.dispatch({type:"assistant.done",reason:"cancelled"}),{stopReason:"cancelled"};throw VW(V)?V:(((z=t.current)==null?void 0:z.sessionId)===I&&e.dispatch({type:"assistant.done",reason:"error"}),lr(v,"Prompt failed",V,"send_prompt"))}finally{const V=n.current.get(I);(V==null?void 0:V.controller)===Q&&n.current.delete(I),((F=t.current)==null?void 0:F.sessionId)===I&&!p()&&y("idle")}},async submitPrompt(j,P){var L;const O=wr(v,t.current,"Prompt failed","send_prompt");if(P!=null&&P.sessionId&&O.sessionId!==P.sessionId)throw new Error("Session changed before prompt submission");const $=((P==null?void 0:P.images)??[]).map(I=>({data:I.data,mimeType:I.mimeType||I.mediaType||I.media_type||"image/*"})),z=P!=null&&P.inputAnnotations&&P.inputAnnotations.length>0?P.inputAnnotations:void 0;(P==null?void 0:P.optimisticUserMessage)!==!1&&e.appendLocalUserMessage(j,$,z?{inputAnnotations:z}:void 0);const F={prompt:QL(j,$)};z&&(F._meta={inputAnnotations:z}),P!=null&&P.retry&&(F.retry=!0);const G=await O.submitPrompt(F);if((L=P==null?void 0:P.signal)!=null&&L.aborted)throw await O.removePendingPrompt(G.promptId).catch(I=>{console.warn("[submitPrompt] removePendingPrompt failed after abort",I),v({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:I instanceof Error?I.message:String(I),recoverable:!0})}),P.signal.reason??new DOMException("Aborted","AbortError");return{promptId:G.promptId}},async cancel(){var j,P;const L=wr(v,t.current,"Cancel failed","cancel_prompt"),O=n.current.get(L.sessionId);O==null||O.controller.abort(),vi(u);const $=O?new AbortController:void 0;$&&n.current.set(L.sessionId,{controller:$});try{await ct(L.cancel(),"Cancel timed out")}catch(z){throw lr(v,"Cancel failed",z,"cancel_prompt")}finally{$&&((j=n.current.get(L.sessionId))==null?void 0:j.controller)===$&&n.current.delete(L.sessionId),((P=t.current)==null?void 0:P.sessionId)===L.sessionId&&!p()&&y("idle")}},async setModel(j){const P=wr(v,t.current,"Set model failed","switch_model");try{const L=await ct(P.setModel(j),"Set model timed out");return x(O=>({...O,currentModel:j})),L}catch(L){throw lr(v,"Set model failed",L,"switch_model")}},async setApprovalMode(j,P){const L=wr(v,t.current,"Set approval mode failed","set_approval_mode");try{const O=await ct(L.client.setSessionApprovalMode(L.sessionId,j,{persist:P==null?void 0:P.persist,clientId:L.clientId}),"Set approval mode timed out");return x($=>({...$,currentMode:O.mode||j})),O}catch(O){throw lr(v,"Set approval mode failed",O,"set_approval_mode")}},async respondToPermission(j,P){const L=wr(v,t.current,"Permission response failed","submit_permission");try{return await ct(L.respondToSessionPermission(j,P),"Permission response timed out")}catch(O){throw lr(v,"Permission response failed",O,"submit_permission")}},async submitPermission(j,P,L){const O=wr(v,t.current,"Permission response failed","submit_permission"),$=P!==void 0&&P.length>0?{outcome:{outcome:"selected",optionId:P},...L?{answers:L}:{}}:{outcome:{outcome:"cancelled"},...L?{answers:L}:{}};try{return await ct(O.respondToSessionPermission(j,$),"Permission response timed out")}catch(z){throw lr(v,"Permission response failed",z,"submit_permission")}},async heartbeat(){const j=t.current;if(!(!j||!o.current))return ct(j.heartbeat(),"Heartbeat timed out")},async listSessions(j){const P=t.current;if(!P)return[];try{return await ct(P.client.listWorkspaceSessions(P.workspaceCwd,j),"List sessions timed out")}catch(L){throw lr(v,"List sessions failed",L,"list_sessions")}},async loadSession(j,P){return N(j,"load",P==null?void 0:P.workspaceCwd)},async resumeSession(j,P){return N(j,"resume",P==null?void 0:P.workspaceCwd)},async createSession(j){try{a.current=!1;const P={...(j==null?void 0:j.approvalMode)!==void 0?{approvalMode:j.approvalMode}:{},...(j==null?void 0:j.sourceType)!==void 0?{sourceType:j.sourceType}:{}},L=t.current,O=L&&m().sessionId===L.sessionId?L:void 0;if(O){const z=await ct(O.client.createOrAttachSession({...d(),...(j==null?void 0:j.workspaceCwd)!==void 0?{workspaceCwd:j.workspaceCwd}:{},...P}),"Create session timed out");return _2(z.clientId,z.sessionId),z}const $=await ct(h(j==null?void 0:j.workspaceCwd,P),"Create session timed out");if(a.current){try{await ct($.detach(),"Detach cleared session timed out")}catch(z){console.warn("[DaemonSessionActions] detach after interrupted create failed:",z)}throw new DOMException("Session creation interrupted","AbortError")}return _2($.clientId,$.sessionId),t.current=$,c.current=$.sessionId,x(z=>({...z,status:"connected",sessionId:$.sessionId,...$.clientId?{clientId:$.clientId}:{},workspaceCwd:$.workspaceCwd,error:void 0,errorStatus:void 0,missingSession:!1})),$}catch(P){throw lr(v,`Create session failed${j!=null&&j.workspaceCwd?` (workspace: ${j.workspaceCwd})`:""}`,P,"create_session")}},async attachSession(){const j=wr(v,t.current,"Attach session failed","attach_session"),P=A(j.sessionId,"attach");return C(L=>L+1),P},async clearSession(){const j=t.current;if(a.current=!0,B(),t.current=void 0,x(P=>hfe(P,j==null?void 0:j.sessionId)),j)try{await ct(j.detach(),"Clear session timed out")}catch(P){console.warn("[DaemonSessionActions] detach on clear failed:",P)}},async newSession(){a.current=!1,B(),x(j=>({...j,missingSession:!1,error:void 0,errorStatus:void 0})),_(j=>j+1)},async releaseSession(j){try{const P=wr(v,t.current,"Release session failed","release_session");await ct(P.client.closeSession(j),"Release session timed out")}catch(P){throw lr(v,"Release session failed",P,"release_session")}},async closeSession(){const j=wr(v,t.current,"Close session failed","close_session");try{await ct(j.close(),"Close session timed out")}catch(P){throw lr(v,"Close session failed",P,"close_session")}},async refreshCommands(){const j=wr(v,t.current,"Refresh commands failed","refresh_commands");try{const P=await ct(j.supportedCommands(),"Refresh commands timed out"),{commands:L,skills:O}=rG(P);x($=>({...$,commands:L,skills:O,supportedCommands:P}))}catch(P){throw lr(v,"Refresh commands failed",P,"refresh_commands")}},async getContext(){const j=wr(v,t.current,"Load context failed","load_context");try{const P=await ct(j.context(),"Load context timed out");return x(L=>({...L,context:P,currentMode:pfe(P)??L.currentMode,currentModel:gfe(P)??L.currentModel})),P}catch(P){throw lr(v,"Load context failed",P,"load_context")}},async getContextUsage(j){const P=wr(v,t.current,"Load context usage failed","load_context_usage");try{return await ct(P.contextUsage(j),"Load context usage timed out")}catch(L){throw lr(v,"Load context usage failed",L,"load_context_usage")}},async renameSession(j){const P=wr(v,t.current,"Rename session failed","rename_session");try{return await ct(P.updateMetadata({displayName:j}),"Rename session timed out")}catch(L){throw lr(v,"Rename session failed",L,"rename_session")}},async recapSession(){const j=wr(v,t.current,"Recap session failed","recap_session");try{return await ct(j.recap(),"Recap session timed out")}catch(P){throw lr(v,"Recap session failed",P,"recap_session")}},async*generateSessionContent(j,P){yield*wr(v,t.current,"Generate content failed","generate_session_content").generateContent(j,P)},async getRewindSnapshots(){const j=wr(v,t.current,"Load rewind snapshots failed","rewind_snapshots");try{return await ct(j.getRewindSnapshots(),"Load rewind snapshots timed out")}catch(P){throw lr(v,"Load rewind snapshots failed",P,"rewind_snapshots")}},async rewindSession(j,P){const L=wr(v,t.current,"Rewind session failed","rewind_session");try{return await ct(L.rewind(j,P),"Rewind session timed out")}catch(O){throw lr(v,"Rewind session failed",O,"rewind_session")}},async btwSession(j,P){var L;const O=wr(v,t.current,"Side question failed","btw_session");try{return await ct(O.btw(j,P),"Side question timed out")}catch($){throw(L=P==null?void 0:P.signal)!=null&&L.aborted||Qb($)?$:lr(v,"Side question failed",$,"btw_session")}},async enqueueMidTurnMessage(j,P){const L=t.current;if(!L)return{accepted:!1};try{return await L.enqueueMidTurnMessage(j,P)}catch(O){return O instanceof DOMException&&O.name==="AbortError"||console.debug("[enqueueMidTurnMessage] push failed; kept for next turn",O),{accepted:!1}}},async getPendingPrompts(j){const P=t.current;if(!P)return{pendingPrompts:[]};if(j!=null&&j.sessionId&&P.sessionId!==j.sessionId)throw new Error("Session changed before pending prompts refresh");return await P.getPendingPrompts()},async removePendingPrompt(j,P){const L=t.current;return L?P!=null&&P.sessionId&&L.sessionId!==P.sessionId?await L.client.removePendingPrompt(P.sessionId,j):await L.removePendingPrompt(j):{removed:!1}},async sendShellCommand(j){var P,L;const O=wr(v,t.current,"Shell command failed","send_shell_command"),$=`${O.sessionId}:shell`;y("waiting");const z=new AbortController;n.current.set($,{controller:z});try{return await O.shellCommand(j,z.signal)}catch(F){throw lr(v,"Shell command failed",F,"send_shell_command")}finally{((P=n.current.get($))==null?void 0:P.controller)===z&&n.current.delete($),((L=t.current)==null?void 0:L.sessionId)===O.sessionId&&!p()&&y("idle")}},async getTasks(){const j=wr(v,t.current,"Get tasks failed","load_tasks");try{return await ct(j.tasks(),"Get tasks timed out")}catch(P){throw lr(v,"Get tasks failed",P,"load_tasks")}},async cancelTask(j,P){const L=wr(v,t.current,"Cancel task failed","cancel_task");try{return await ct(L.cancelTask(j,P),"Cancel task timed out")}catch(O){throw lr(v,"Cancel task failed",O,"cancel_task")}},async clearGoal(){const j=wr(v,t.current,"Clear goal failed","clear_goal");try{return await ct(j.clearGoal(),"Clear goal timed out")}catch(P){throw lr(v,"Clear goal failed",P,"clear_goal")}},async getStats(){const j=wr(v,t.current,"Load stats failed","load_stats");try{return await ct(j.stats(),"Load stats timed out")}catch(P){throw lr(v,"Load stats failed",P,"load_stats")}},async loadArtifacts(){const j=wr(v,t.current,"Load artifacts failed","load_artifacts");try{return await ct(j.artifacts(),"Load artifacts timed out")}catch(P){throw lr(v,"Load artifacts failed",P,"load_artifacts")}},async respondToGlobalPermission(j,P){const L=wr(v,t.current,"Global permission response failed","submit_permission");try{return await ct(L.client.respondToPermission(j,P),"Global permission response timed out")}catch(O){throw lr(v,"Global permission response failed",O,"submit_permission")}},async branchSession(j){const P=wr(v,t.current,"Branch session failed","branch_session");try{const L=await ct(P.client.branchSession(P.sessionId,{name:j},P.clientId),"Branch session timed out");return _2(L.clientId,L.sessionId),N(L.sessionId,"load").catch(O=>{Qb(O)||lr(v,"Branch session failed",O,"branch_session")}),{sessionId:L.sessionId,displayName:L.displayName}}catch(L){throw lr(v,"Branch session failed",L,"branch_session")}},async forkSession(j){const P=wr(v,t.current,"Fork session failed","fork_session");try{return await ct(P.fork(j),"Fork session timed out")}catch(L){throw lr(v,"Fork session failed",L,"fork_session")}}}}function mfe(e,t,n,s,r){return new Promise((i,o)=>{const a=v7(n,r),c=t.get(a);if(c){t.delete(a),c.status==="resolved"?i(c.result):o(c.error);return}const u=e.get(n);if((u==null?void 0:u.controller)!==s){o(new DOMException("Aborted","AbortError"));return}if(u.promptId!==void 0&&u.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 m=e.get(n);(m==null?void 0:m.controller)===s&&e.delete(n),d(),o(s.signal.reason??new DOMException("Aborted","AbortError"))};e.set(n,{...u,promptId:r,resolve:m=>{d(),i(m)},reject:m=>{d(),o(m)}}),s.signal.addEventListener("abort",h,{once:!0})})}function v7(e,t){return JSON.stringify([e,t])}function pfe(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 gfe(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 wr(e,t,n,s){if(!t)throw lr(e,n,"Daemon session is not connected",s);return t}function lr(e,t,n,s){if(Qb(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}),bfe(n instanceof Error?n:new Error(r))}function Qb(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function bfe(e){return Object.assign(e,{_alreadyDispatched:!0})}function yfe(e){return e.charAt(0).toUpperCase()+e.slice(1)}function xfe(e){return e==="resume"?"resume_session":e==="attach"?"attach_session":"load_session"}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const vfe=33e4;function wfe({getClient:e,getWorkspaceCwd:t,baseUrl:n,token:s}){return{async listSessions(r){const i=zt(e,"List sessions failed"),o=t();return o?ct(i.listWorkspaceSessionsPage(o,r).then(a=>a.sessions),"List sessions timed out"):[]},async listSessionsPage(r){const i=zt(e,"List sessions failed"),o=t();return o?ct(i.listWorkspaceSessionsPage(o,r),"List sessions timed out"):{sessions:[]}},async listSessionGroups(){const r=zt(e,"List session groups failed"),i=t();return i?ct(r.listSessionGroups(i),"List session groups timed out"):{groups:[],colorOptions:[]}},async createSessionGroup(r){const i=zt(e,"Create session group failed"),o=z5(t);return ct(i.createSessionGroup(o,r),"Create session group timed out")},async updateSessionGroup(r,i){const o=zt(e,"Update session group failed"),a=z5(t);return ct(o.updateSessionGroup(a,r,i),"Update session group timed out")},async deleteSessionGroup(r){const i=zt(e,"Delete session group failed"),o=z5(t);return ct(i.deleteSessionGroup(o,r),"Delete session group timed out")},async updateSessionOrganization(r,i){const o=zt(e,"Update session organization failed");return ct(o.updateSessionOrganization(r,i),"Update session organization timed out")},async deleteSession(r){const i=zt(e,"Delete session failed"),o=await ct(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=zt(e,"Delete sessions failed");return ct(i.deleteSessionsData(r),"Delete sessions timed out")},async exportSession(r,i="html"){const o=zt(e,"Export session failed");return ct(o.exportSession(r,{format:i}),"Export session timed out")},async archiveSession(r){const i=zt(e,"Archive session failed"),o=await ct(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=zt(e,"Unarchive session failed"),o=await ct(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=zt(e,"Load MCP status failed");return ct(r.workspaceMcp(),"Load MCP status timed out")},async initializeMcp(){const r=zt(e,"Initialize MCP failed");return ct(r.initializeWorkspaceMcp(),"Initialize MCP timed out")},async reloadMcp(){const r=zt(e,"Reload MCP failed");return ct(r.reloadWorkspaceMcp(),"Reload MCP timed out")},async loadMcpTools(r){const i=zt(e,"Load MCP tools failed");try{return await ct(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=zt(e,"Load MCP resources failed");try{return await ct(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=zt(e,"Restart MCP server failed");return ct(i.restartMcpServer(r),"Restart MCP server timed out",5*6e4)},async manageMcpServer(r,i){const o=zt(e,"Manage MCP server failed"),a=i==="authenticate"?10*6e4:5*6e4;return ct(o.manageMcpServer(r,i),"Manage MCP server timed out",a)},async addRuntimeMcpServer(r){const i=zt(e,"Add MCP server failed");return ct(i.addRuntimeMcpServer(r),"Add MCP server timed out",5*6e4)},async removeRuntimeMcpServer(r){const i=zt(e,"Remove MCP server failed");return ct(i.removeRuntimeMcpServer(r),"Remove MCP server timed out",5*6e4)},async loadDaemonStatus(r){const i=zt(e,"Load daemon status failed");return ct(i.daemonStatus(r),"Load daemon status timed out")},async loadUsageDashboard(r){const i=zt(e,"Load usage dashboard failed");return ct(i.usageDashboard(r),"Load usage dashboard timed out")},async loadSkillsStatus(){const r=zt(e,"Load skills failed");return ct(r.workspaceSkills(),"Load skills timed out")},async setWorkspaceSkillEnabled(r,i){const o=zt(e,"Set skill enabled failed");return ct(o.setWorkspaceSkillEnabled(r,i),"Set skill enabled timed out")},async installWorkspaceSkill(r){const i=zt(e,"Install skill failed");return ct(i.installWorkspaceSkill(r),"Install skill timed out")},async deleteWorkspaceSkill(r,i){const o=zt(e,"Delete skill failed");return ct(o.deleteWorkspaceSkill(r,i),"Delete skill timed out")},async loadExtensionsStatus(){const r=zt(e,"Load extensions failed");return ct(r.workspaceExtensions(),"Load extensions timed out")},async loadToolsStatus(){const r=zt(e,"Load tools failed");return ct(r.workspaceTools(),"Load tools timed out")},async setWorkspaceToolEnabled(r,i){const o=zt(e,"Set tool enabled failed");return ct(o.setWorkspaceToolEnabled(r,i),"Set tool enabled timed out")},async loadSettingsStatus(){const r=zt(e,"Load settings failed");return ct(r.workspaceSettings(),"Load settings timed out")},async setWorkspaceSetting(r,i,o,a){const c=zt(e,"Set setting failed");return ct(c.setWorkspaceSetting(r,i,o,a),"Set setting timed out")},async loadMemoryStatus(){const r=zt(e,"Load memory failed");return ct(r.workspaceMemory(),"Load memory timed out")},async readWorkspaceFile(r){const i=zt(e,"Read workspace file failed");return ct(i.readWorkspaceFile(r),"Read workspace file timed out")},async writeMemory(r){const i=zt(e,"Write memory failed");return ct(i.writeWorkspaceMemory(r),"Write memory timed out")},async listAgents(){const r=zt(e,"List agents failed");return ct(r.listWorkspaceAgents(),"List agents timed out")},async getAgent(r){const i=zt(e,"Get agent failed");return ct(i.getWorkspaceAgent(r),"Get agent timed out")},async createAgent(r){const i=zt(e,"Create agent failed");return ct(i.createWorkspaceAgent(r),"Create agent timed out")},async generateAgent(r){const i=zt(e,"Generate agent failed");return ct(i.generateWorkspaceAgent(r),"Generate agent timed out",vfe)},async deleteAgent(r,i){const o=zt(e,"Delete agent failed");return ct(o.deleteWorkspaceAgent(r,i?{scope:i}:{}),"Delete agent timed out")},async globWorkspace(r,i){zt(e,"Glob workspace failed");const o=Uc(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 ct(fetch(Vc(o,n),{headers:c0(s)}),"Glob workspace timed out");if(!a.ok)throw new Error(await Wc(a,"GET /glob"));const c=await a.json();return{matches:Array.isArray(c.matches)?c.matches.filter(u=>typeof u=="string"):[]}},async loadProviders(){const r=zt(e,"Load providers failed");return ct(r.workspaceProviders(),"Load providers timed out")},async readFileBytes(r,i){const o=zt(e,"Read file bytes failed");return ct(o.readWorkspaceFileBytes(r,i??{}),"Read file bytes timed out")},async writeFile(r){const i=zt(e,"Write file failed");return ct(i.writeWorkspaceFile(r),"Write file timed out")},async editFile(r){const i=zt(e,"Edit file failed");return ct(i.editWorkspaceFile(r),"Edit file timed out")},async stat(r){zt(e,"Stat file failed");const i=Uc(n,"/stat");i.searchParams.set("path",r);const o=await ct(fetch(Vc(i,n),{headers:c0(s)}),"Stat file timed out");if(!o.ok)throw new Error(await Wc(o,"GET /stat"));return await o.json()},async listDirectory(r){zt(e,"List directory failed");const i=Uc(n,"/list");i.searchParams.set("path",r);const o=await ct(fetch(Vc(i,n),{headers:c0(s)}),"List directory timed out");if(!o.ok)throw new Error(await Wc(o,"GET /list"));return await o.json()},async listScheduledTasks(r){zt(e,"List scheduled tasks failed");const i=Sb(r),o=Uc(n,i),a=await ct(fetch(Vc(o,n),{headers:c0(s)}),"List scheduled tasks timed out");if(!a.ok)throw new Error(await Wc(a,`GET ${i}`));const c=await a.json();return Array.isArray(c.tasks)?c.tasks:[]},async createScheduledTask(r,i){zt(e,"Create scheduled task failed");const o=Sb(i),a=Uc(n,o),c=await ct(fetch(Vc(a,n),{method:"POST",headers:Hw(s),body:JSON.stringify(r)}),"Create scheduled task timed out");if(!c.ok)throw new Error(await Wc(c,`POST ${o}`));return await c.json()},async updateScheduledTask(r,i,o){zt(e,"Update scheduled task failed");const a=Sb(o,`/${encodeURIComponent(r)}`),c=Uc(n,a),u=await ct(fetch(Vc(c,n),{method:"PATCH",headers:Hw(s),body:JSON.stringify(i)}),"Update scheduled task timed out");if(!u.ok)throw new Error(await Wc(u,`PATCH ${a}`));return await u.json()},async runScheduledTask(r,i){zt(e,"Run scheduled task failed");const o=Sb(i,`/${encodeURIComponent(r)}/run`),a=Uc(n,o),c=await ct(fetch(Vc(a,n),{method:"POST",headers:Hw(s)}),"Run scheduled task timed out");if(!c.ok)throw new Error(await Wc(c,`POST ${o}`));return await c.json()},async deleteScheduledTask(r,i){zt(e,"Delete scheduled task failed");const o=Sb(i,`/${encodeURIComponent(r)}`),a=Uc(n,o),c=await ct(fetch(Vc(a,n),{method:"DELETE",headers:c0(s)}),"Delete scheduled task timed out");if(!c.ok)throw new Error(await Wc(c,`DELETE ${o}`))},async listGoals(){zt(e,"List goals failed");const r=Uc(n,"/goals"),i=await ct(fetch(Vc(r,n),{headers:c0(s)}),"List goals timed out");if(!i.ok)throw new Error(await Wc(i,"GET /goals"));const o=await i.json();return{goals:Array.isArray(o.goals)?o.goals:[],droppedCount:typeof o.droppedCount=="number"&&o.droppedCount>0?o.droppedCount:0}},async clearGoal(r){zt(e,"Clear goal failed");const i=Uc(n,`/session/${encodeURIComponent(r)}/goal/clear`),o=await ct(fetch(Vc(i,n),{method:"POST",headers:Hw(s),body:"{}"}),"Clear goal timed out");if(!o.ok)throw new Error(await Wc(o,`POST /session/${r}/goal/clear`));return await o.json()},async loadEnv(){const r=zt(e,"Load env failed");return ct(r.workspaceEnv(),"Load env timed out")},async loadPreflight(){const r=zt(e,"Load preflight failed");return ct(r.workspacePreflight(),"Load preflight timed out")},async initWorkspace(r){const i=zt(e,"Init workspace failed");return ct(i.initWorkspace(r),"Init workspace timed out")},async updateAgent(r,i,o){const a=zt(e,"Update agent failed");return ct(a.updateWorkspaceAgent(r,i,o?{scope:o}:{}),"Update agent timed out")},async installExtension(r,i){const o=zt(e,"Install extension failed");return ct(o.installExtension(r,i),"Install extension timed out")},async extensionOperationStatus(r){const i=zt(e,"Load extension operation failed");return ct(i.extensionOperationStatus(r),"Load extension operation timed out")},async activeExtensionOperations(){const r=zt(e,"Load active extension operations failed");return ct(r.activeExtensionOperations(),"Load active extension operations timed out")},async respondToExtensionInteraction(r,i,o,a){const c=zt(e,"Respond to extension interaction failed");return ct(c.respondToExtensionInteraction(r,i,o,a),"Respond to extension interaction timed out")},async checkExtensionUpdates(r){const i=zt(e,"Check extension updates failed");return ct(i.checkExtensionUpdates(r),"Check extension updates timed out")},async refreshExtensions(r){const i=zt(e,"Refresh extensions failed");return ct(i.refreshExtensions(r),"Refresh extensions timed out")},async enableExtension(r,i,o){const a=zt(e,"Enable extension failed");return ct(a.enableExtension(r,i,o),"Enable extension timed out")},async disableExtension(r,i,o){const a=zt(e,"Disable extension failed");return ct(a.disableExtension(r,i,o),"Disable extension timed out")},async updateExtension(r,i){const o=zt(e,"Update extension failed");return ct(o.updateExtension(r,i),"Update extension timed out")},async uninstallExtension(r,i){const o=zt(e,"Uninstall extension failed");return ct(o.uninstallExtension(r,i),"Uninstall extension timed out")},async startDeviceFlow(r){const i=zt(e,"Start device flow failed");return ct(i.startDeviceFlow({providerId:r}),"Start device flow timed out")},async getDeviceFlow(r,i){const o=zt(e,"Get device flow failed");return ct(o.getDeviceFlow(r,i),"Get device flow timed out")},async cancelDeviceFlow(r){const i=zt(e,"Cancel device flow failed");return ct(i.cancelDeviceFlow(r),"Cancel device flow timed out")},async getAuthStatus(){const r=zt(e,"Get auth status failed");return ct(r.getAuthStatus(),"Get auth status timed out")},async getAuthProviders(){const r=zt(e,"Get auth providers failed");return ct(r.getAuthProviders(),"Get auth providers timed out")},async installAuthProvider(r){const i=zt(e,"Install auth provider failed");return ct(i.installAuthProvider(r),"Install auth provider timed out")},async deleteModel(r){const i=zt(e,"Delete model failed");return ct(i.deleteModel(r),"Delete model timed out")},async addWorkspace(r,i){const o=zt(e,"Add workspace failed");return ct(o.addWorkspace(r,i),"Add workspace timed out")},async suggestWorkspacePaths(r){const i=zt(e,"Suggest workspace paths failed");return await ct(i.workspacePathSuggestions(r),"Suggest workspace paths timed out")},async removeWorkspace(r,i){const a=zt(e,"Remove workspace failed").workspaceById(r).remove(i);return(i==null?void 0:i.timeoutMs)===0?a:ct(a,"Remove workspace timed out",i==null?void 0:i.timeoutMs)}}}function zt(e,t){const n=e();if(!n)throw new Error(`${t}: DaemonClient is not connected`);return n}function z5(e){const t=e();if(!t)throw new Error("Daemon workspace is not connected");return t}function Sb(e,t=""){return e?`/workspaces/${encodeURIComponent(e)}/scheduled-tasks${t}`:`/scheduled-tasks${t}`}function c0(e){const t={};return e&&(t.Authorization=`Bearer ${e}`),t}function Hw(e){const t={"Content-Type":"application/json"};return e&&(t.Authorization=`Bearer ${e}`),t}function Uc(e,t){const n=cG(e),s=typeof window>"u"?"http://localhost":window.location.origin;return new URL(`${n}${t}`,s)}function Vc(e,t){return cG(t)?e.toString():`${e.pathname}${e.search}`}function cG(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 Wc(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 EN=f.createContext(void 0);let Cb;function kfe({baseUrl:e,token:t,workspaceCwd:n,autoConnect:s=!0,transport:r,children:i}){const o=f.useMemo(()=>s?new h7({baseUrl:e,token:t,transport:r}):void 0,[s,e,t,r]),a=f.useRef(o);a.current=o;const c=f.useRef(void 0),u=f.useRef(void 0),d=f.useRef(n),[h,m]=f.useState(void 0),[p,g]=f.useState(s?"connecting":"idle"),[b,v]=f.useState(void 0),x=f.useCallback(()=>{if(!o)return Promise.reject(new Error("Daemon workspace client unavailable"));if(c.current!==o&&(c.current=o,u.current=void 0),!u.current){const T=o.capabilities().catch(S=>{throw u.current===T&&(u.current=void 0),S});u.current=T}return u.current},[o]),y=f.useCallback(()=>{if(!o)return Promise.reject(new Error("Daemon workspace client unavailable"));c.current=o;const T=o.capabilities().catch(S=>{throw u.current===T&&(u.current=void 0,v(S instanceof Error?S:new Error(String(S))),g("error")),S});return u.current=T,T.then(S=>(c.current===o&&u.current===T&&(m(S),g("connected"),v(void 0)),S))},[o]);f.useEffect(()=>{if(!o)return;g("connecting"),v(void 0),m(void 0),Cb===o&&(Cb=void 0);let T=!1;return x().then(S=>{T||(m(S),g("connected"))}).catch(S=>{T||(v(S instanceof Error?S:new Error(String(S))),g("error"))}),()=>{T=!0,Cb=o,queueMicrotask(()=>{Cb===o&&(Cb=void 0,o.dispose())})}},[o,x]),d.current=(h==null?void 0:h.workspaceCwd)??n;const w=f.useMemo(()=>wfe({getClient:()=>a.current,getWorkspaceCwd:()=>d.current,baseUrl:e,token:t}),[e,t]),k=f.useMemo(()=>{if(o)return{client:o,token:t,baseUrl:e,workspaceCwd:(h==null?void 0:h.workspaceCwd)??n,status:p,error:b,capabilities:h,getCapabilities:x,refreshCapabilities:y,actions:w}},[o,t,e,n,p,b,h,x,y,w]);return l.jsx(EN.Provider,{value:k,children:i})}function dc(){const e=f.useContext(EN);if(!e)throw new Error("useDaemonWorkspace must be used within DaemonWorkspaceProvider");return e}function fo(){return dc().actions}function uG(){return f.useContext(EN)}function _fe(e){if(e.length===0)return"idle";const t=e[e.length-1];if((t==null?void 0:t.kind)==="thought"&&ZL(t))return"thinking";if((t==null?void 0:t.kind)==="assistant"&&ZL(t)||(t==null?void 0:t.kind)==="tool"&&eP(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"&&eP(s))return"responding"}return"idle"}function Sfe(e,t){const n=_fe(e);return t==="idle"?"idle":n!=="idle"||t===void 0?n:t==="waiting"?"waiting":"responding"}function ZL(e){return e.streaming===!0}function eP(e){return e.status==="running"||e.status==="in_progress"}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const w7=new Set;let O_;function tP(){return O_}function Cfe(e){return w7.add(e),()=>{w7.delete(e)}}function Tfe(e){O_={...e},dG()}function Uw(){O_!==void 0&&(O_=void 0,dG())}function dG(){for(const e of w7)e()}function Efe(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 k7=new Set,hG=Object.freeze([]),F5=64;let Hh=hG;function nP(){return Hh}function Afe(e){return k7.add(e),()=>{k7.delete(e)}}function Nfe(e){const t=[...Hh,{sessionId:e.sessionId,messages:[...e.messages],...e.originatorClientId?{originatorClientId:e.originatorClientId}:{}}];if(t.length>F5){const n=t.length-F5;console.debug(`[mid-turn] sidechannel buffer over ${F5}; evicting ${n} oldest batch(es)`),Hh=t.slice(n)}else Hh=t;fG()}function jfe(e){if(e.length===0||Hh.length===0)return;const t=new Set(e),n=Hh.filter(s=>!t.has(s));n.length!==Hh.length&&(Hh=n.length===0?hG:n,fG())}function fG(){for(const e of k7)e()}function Mfe(e){if(!e||typeof e!="object")return;const t=e;if(t.type!==WW)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(c=>typeof c=="string"&&c.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 _7=new Set,S7=new Set;let mG=0,lg=[];function Ife(){return mG}function sP(){return lg}function Rfe(e){return _7.add(e),()=>{_7.delete(e)}}function Dfe(e){return S7.add(e),()=>{S7.delete(e)}}function Lfe(){mG++;for(const e of _7)try{e()}catch(t){console.error("[pendingPromptVersion] listener error",t)}}function pG(){for(const e of S7)try{e()}catch(t){console.error("[pendingPromptEvents] listener error",t)}}function Pfe(e){if(e.length===0)return;const t=new Set(e),n=lg.filter(s=>!t.has(s));n.length!==lg.length&&(lg=n,pG())}function Ofe(e){const t=gG(e);return t?(lg=[...lg,t].slice(-200),pG(),(t.type===pN||t.type===gN||t.type===bN)&&Lfe(),!0):!1}function Bfe(e){return gG(e)!==void 0}function gG(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===pN||n===gN||n===bN)&&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 bG=[404,410],$fe=new Set(bG);function Ay(e){return e!==void 0&&$fe.has(e)}function Gc(e,t){return Ay(t)&&!Ay(e)?t:e}const rP="session_transcript_pagination";function Ah(e,t){const n=YW(e);return{type:"assistant.done",reason:t,eventId:e.id,...n!==void 0?{serverTimestamp:n}:{}}}function zfe(e){if(e.type==="session_update")try{if(!Fo(e.data))return;const t=e.data.update,n=Fo(t)?t._meta:e.data._meta;return Fo(n)?Sc(n,"qwen.session.recordId"):void 0}catch{return}}function Ffe(e,t,n){const s=e.getSnapshot(),r=x7({maxBlocks:Number.MAX_SAFE_INTEGER,nextOrdinal:s.nextOrdinal});r.dispatch(t);const i=r.getSnapshot();return i.blocks.length+s.blocks.length>n?!1:(e.reset({...s,blocks:[...i.blocks,...s.blocks],nextOrdinal:i.nextOrdinal,toolBlockByCallId:{...i.toolBlockByCallId,...s.toolBlockByCallId},permissionBlockByRequestId:{...i.permissionBlockByRequestId,...s.permissionBlockByRequestId}}),!0)}const yG=f.createContext(void 0),xG=f.createContext(void 0),AN=f.createContext(void 0),vG=f.createContext(void 0),wG=f.createContext(void 0),kG=f.createContext(void 0),_G=f.createContext(void 0),NN=new Set([401,403]),qfe=new Set([...NN,...bG]),Hfe=2e5,Ufe={memoryVersion:0,agentsVersion:0,toolsVersion:0,settingsVersion:0,mcpVersion:0,extensionsVersion:0,artifactsVersion:0,initVersion:0,authVersion:0},Vfe=Symbol("unhandled session");function SG(e){const{baseUrl:t,token:n,workspaceCwd:s,sessionId:r,clientId:i,createSessionRequest:o,maxQueued:a=1024,maxBlocks:c=Hfe,historyPageSize:u,suppressOwnUserEcho:d=!0,includeRawEvent:h=!1,autoConnect:m=!0,autoReconnect:p=!0,restartEventStreamOnPrompt:g=!1,reconnectDelayMs:b=1e3,maxReconnectDelayMs:v=1e4,heartbeatIntervalMs:x=3e4,heartbeatFailureThreshold:y=3,loadWarnings:w,children:k}=e,T=uG(),S=t??(T==null?void 0:T.baseUrl),C=n??(T==null?void 0:T.token),_=s??(T==null?void 0:T.workspaceCwd),B=f.useRef(T==null?void 0:T.client);B.current=T==null?void 0:T.client;const A=f.useRef(T==null?void 0:T.capabilities);A.current=T==null?void 0:T.capabilities;const N=f.useRef(T==null?void 0:T.getCapabilities);N.current=T==null?void 0:T.getCapabilities;const j=f.useRef(!1),L=f.useRef(r).current,O=L===void 0,$=f.useRef(_);$.current=_;const z=f.useRef(_);_&&(z.current=_);const F=f.useMemo(()=>x7({maxBlocks:c}),[c]),G=f.useRef(void 0),I=f.useRef({hasMore:!1,loading:!1,capacityReached:!1}),[Q,V]=f.useState({hasMore:!1,loading:!1,capacityReached:!1}),M=f.useRef(void 0),re=f.useRef(void 0),se=f.useRef(new Map),X=f.useRef(new Map),J=f.useRef(void 0),de=f.useRef(0),W=f.useRef(void 0),te=f.useRef(!1),U=f.useRef({consecutiveFailures:0}),ee=f.useRef(!1),oe=f.useRef(void 0),Ce=f.useRef(new WeakSet),he=f.useRef({suppressOwnUserEcho:d,includeRawEvent:h}),ye=f.useRef({reconnectDelayMs:b,maxReconnectDelayMs:v}),Ve=f.useRef(w),it=f.useRef(u),At=f.useRef(void 0);(!At.current||i)&&(At.current=B5(i)),he.current={suppressOwnUserEcho:d,includeRawEvent:h},ye.current={reconnectDelayMs:b,maxReconnectDelayMs:v},Ve.current=w,it.current=u;const Ee=o==null?void 0:o.modelServiceId,me=o==null?void 0:o.sessionScope,bt=f.useRef(o);bt.current=o;const[et,qe]=f.useState("idle"),[Ke,ke]=f.useState(L),[ne,gt]=f.useState(void 0),[We,tt]=f.useState("load"),[jt,jn]=f.useState(0),[kn,Be]=f.useState(0),[ht,ve]=f.useState(0),[Me,_e]=f.useState({status:m?"connecting":"idle",...L?{sessionId:L}:{}}),Xe=f.useRef(Me);Xe.current=Me,f.useEffect(()=>{T!=null&&T.capabilities&&_e(st=>st.capabilities===T.capabilities?st:{...st,capabilities:T.capabilities})},[T==null?void 0:T.capabilities]);const ue=f.useRef(0),[Fe,kt]=f.useState([]),bn=f.useCallback(st=>{const St={...st,id:st.id??`daemon-notice-${Date.now()}-${++ue.current}`,createdAt:st.createdAt??Date.now()};return kt(Ht=>Ht.some(Ot=>Ot.id===St.id)?Ht:[...Ht.slice(-49),St]),St},[]),Pe=f.useCallback(st=>{kt(St=>St.filter(Ht=>Ht.id!==st))},[]),yn=f.useCallback(()=>{kt([])},[]),je=f.useMemo(()=>({notices:Fe,dismissNotice:Pe,clearNotices:yn}),[yn,Pe,Fe]),[Ne,ot]=f.useState(Ufe),pt=f.useRef(()=>!1),dn=f.useRef(!1);f.useEffect(()=>(dn.current=!0,()=>{dn.current=!1}),[]),f.useEffect(()=>{if(!m)return;if(!B.current&&!S){_e({status:"error",error:"DaemonSessionProvider requires a baseUrl prop or an ancestor DaemonWorkspaceProvider."});return}const st=new AbortController;let St=!1,Ht=[],Ot;const Yt=()=>{if(Ot=void 0,Ht.length===0)return;const rs=Ht;Ht=[];try{F.dispatch(rs)}catch(Vt){console.error("[DaemonSessionProvider] batched transcript dispatch failed",{eventCount:rs.length,error:Vt})}},Pn=()=>{Ot!==void 0&&(clearTimeout(Ot),Ot=void 0)},Hn=rs=>{if(rs.length!==0){for(const Vt of rs)Ht.push(Vt);Ot===void 0&&(Ot=setTimeout(Yt,0))}},as=()=>{Pn(),Yt()},Bs=rs=>{as(),F.dispatch(rs)},fr=()=>{Pn(),Ht=[]};return(async()=>{var rs,Vt,Qn,Rs,pr,hs,xr,ci,_s,Vs,ls;const Ws=B.current??new h7({baseUrl:S,token:C});let Ss,Xs,Cr=Ke,Lr=!Ke&&ht>0,pe=0,Ie=!1,Ge=()=>!1,Xt=!1;for(;!St&&!st.signal.aborted;){const Cn=Ie;Ie=!1;let Un=!1,xe,$e;const Lt=()=>{$e==null||$e(),$e=void 0,M.current===xe&&(M.current=void 0)};try{let An=!1,Xn=!1,Mn=!1,Gn=!1,Zn,Vn;if(!Ss){const xt=G.current;xt&&!Ke&&!Cr&&!Lr&&(Ss=xt,Cr=xt.sessionId,re.current=xt.sessionId,Gn=!0)}if(!Ss){_e(As=>({...As,status:"connecting",error:void 0,errorStatus:Gc(void 0,As.errorStatus)}));const xt=N.current,En=A.current??(xt?await xt():await Ws.capabilities());if(St||st.signal.aborted)return;Xs=En;const si=Array.isArray(En.features)&&En.features.includes(rP);te.current=Array.isArray(En.features)&&En.features.includes("client_heartbeat");const ar=ne??$.current??En.workspaceCwd;if(z.current=ar,(O||ee.current)&&!Ke&&!Cr&&!Lr){const[As,Ls,fc,Dc]=await Promise.allSettled([Ws.workspaceProviders(),Ws.workspaceSkills(),Ws.workspaceAcpStatus(),ar?Ws.workspaceByCwd(ar).workspaceGit():Ws.workspaceGit()]);As.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceProviders failed in deferred connect:",As.reason),Ls.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceSkills failed in deferred connect:",Ls.reason),fc.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceAcpStatus failed in deferred connect:",fc.reason);const Xa=As.status==="fulfilled"?As.value:void 0,mc=KL(Xa),{commands:Lc,skills:rh}=YL(Ls.status==="fulfilled"?Ls.value:void 0),Pc=Ls.status==="rejected"||ee.current&&Lc.length===0;_e(Qa=>({...Qa,status:"connected",workspaceCwd:ar,gitBranch:Dc.status==="fulfilled"?Dc.value.branch??void 0:void 0,models:mc.models,currentModel:mc.currentModel,currentMode:mc.currentMode,contextWindow:mc.contextWindow,providers:Xa,capabilities:En,commands:Pc?Qa.commands:Lc,skills:Pc?Qa.skills:rh})),fc.status==="fulfilled"&&!fc.value.channelLive&&!j.current&&(j.current=!0,(async()=>{try{const Qa=await Ws.workspaceAcpPreheat(5e3);if(St||st.signal.aborted||!Qa.ready||Xe.current.sessionId)return;const Up=await Ws.workspaceSkills();if(St||st.signal.aborted||Xe.current.sessionId)return;const{commands:V1,skills:W1}=YL(Up);_e(Fu=>Fu.sessionId?Fu:{...Fu,commands:V1,skills:W1})}catch(Qa){console.warn("[DaemonSessionProvider] ACP preheat for workspace skills failed:",Qa)}finally{j.current=!1}})());return}const nr=Ke&&We==="resume"?kb.resume:kb.load,Ti=Ke??Cr,Qo=i?At.current:B5(void 0,Ti);Un=!!Ke,Ti&&_e(As=>({...As,sessionId:Ti,error:void 0,errorStatus:void 0,missingSession:!1,loadingTranscript:!0}));const Ds=Ke?await nr(Ws,Ke,{workspaceCwd:ar,...si&&We==="load"&&it.current!==void 0?{historyPageSize:it.current}:{}},Qo):Cr?await kb.load(Ws,Cr,{workspaceCwd:ar,...si&&it.current!==void 0?{historyPageSize:it.current}:{}},Qo):await kb.createOrAttach(Ws,{...Ee!==void 0?{modelServiceId:Ee}:{},...Lr?{sessionScope:"thread"}:me!==void 0?{sessionScope:me}:{},workspaceCwd:ar},Qo);if(Un=!1,!i&&Ds.clientId&&(At.current=Ds.clientId,_2(Ds.clientId,Ds.sessionId)),St||st.signal.aborted){JL({baseUrl:S,token:C,sessionId:Ds.sessionId,clientId:Ds.clientId}).catch(As=>console.warn("[DaemonSessionProvider] detach failed:",As));return}const ui=re.current;ui!==Ds.sessionId&&yn(),ui!==void 0&&Ds.sessionId!==ui?(qe("idle"),vi(W),Mn=!0):ui!==void 0&&(Ds.replaySnapshot.compactedReplay.length+Ds.replaySnapshot.liveJournal.length>0?(qe("idle"),vi(W),Mn=!0):(F.dispatch({type:"assistant.done",reason:"reconnected"}),F.getSnapshot().awaitingResync&&F.clearAwaitingResync())),An=ui!==void 0&&ui===Ds.sessionId,Xn=Ds.replaySnapshot.compactedReplay.length>0||Ds.replaySnapshot.liveJournal.length>0;const va=[...Ds.replaySnapshot.compactedReplay,...Ds.replaySnapshot.liveJournal];Zn=sfe(va),Vn=TN(Zn),Ss=Ds,Cr=Ss.sessionId,Lr=!1,re.current=Ss.sessionId,G.current=Ss}const hn=Ss,Le=Ce.current.has(hn);let Nt=hn.hasActivePrompt===!0&&!Le;const Tn=()=>{Ce.current.add(hn),Nt=!1},_n=()=>Nt||se.current.has(hn.sessionId);Ge=_n,pt.current=_n,qe(_n()?"streaming":"idle");const cs=J.current,gr=(cs==null?void 0:cs.sessionId)===hn.sessionId?cs:void 0,{compactedReplay:le,liveJournal:Se}=hn.replaySnapshot,He=[...le,...Se],Qe=He.map(zfe).find(xt=>xt!==void 0),xn=Array.isArray(Xs==null?void 0:Xs.features)&&Xs.features.includes(rP)&&hn.historyHasMore&&Qe!==void 0;I.current={sessionId:hn.sessionId,...Qe!==void 0?{beforeRecordId:Qe}:{},hasMore:xn,loading:!1,capacityReached:!1},V({hasMore:xn,loading:!1,capacityReached:!1});const Bt=Xn&&He.length>0;if(Mn&&!Bt&&F.reset(),Bt){const xt={...he.current,suppressOwnUserEcho:!1},En=[];for(const ar of He)try{const nr=q5(ar,hn.clientId,xt,_e,{updateConnection:!1});if(En.push(...H5(ar,nr,bn,Pe)),ar.type==="turn_complete"){const Ti=((rs=ar.data)==null?void 0:rs.stopReason)??"end_turn";En.push(Ah(ar,Ti))}else ar.type==="turn_error"&&En.push(Ah(ar,"error"))}catch(nr){const Ti=nr instanceof Error?nr.message:String(nr);bn({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.replay_event_malformed",message:"Skipped malformed replay event",debugMessage:Ti,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed replay event:",nr)}let si=!1;if(Mn||F.getSnapshot().blocks.length===0){const ar=x7({maxBlocks:Number.MAX_SAFE_INTEGER});ar.dispatch(En);const nr=ar.getSnapshot();si=nr.blocks.length>c,F.reset({...nr,maxBlocks:Math.max(c,nr.blocks.length)})}else En.length>0&&F.dispatch(En);En.length>0&&aP(En,ot),si&&xn&&(I.current.hasMore=!1,I.current.capacityReached=!0,V({hasMore:!1,loading:!1,capacityReached:!0}));for(const ar of He)iP(se.current,X.current,hn.sessionId,ar,F,qe,W,{requireBoundPromptId:!0});_e(ar=>({...ar,catchingUp:void 0}))}_e(xt=>({...xt,status:"connected",sessionId:hn.sessionId,...hn.clientId?{clientId:hn.clientId}:{},workspaceCwd:hn.workspaceCwd,displayName:XL(hn.state)??(xt.sessionId===hn.sessionId?xt.displayName:void 0),tokenUsage:Zn!==void 0?Zn:xt.sessionId===hn.sessionId?xt.tokenUsage:void 0,tokenCount:Vn!==void 0?Vn:xt.sessionId===hn.sessionId?xt.tokenCount??0:0,loadingTranscript:void 0,catchingUp:Bt?xt.catchingUp:An||hn.lastEventId!=null||void 0})),gr&&(J.current=void 0,clearTimeout(gr.timeout),oe.current===hn.sessionId&&(oe.current=void 0),gr.resolve());const $n=Cn||Gn&&Xe.current.commands!==void 0&&Xe.current.skills!==void 0&&Xe.current.supportedCommands!==void 0&&Xe.current.context!==void 0,Qs=Cn?Promise.resolve({branch:Xe.current.gitBranch}):hn.workspaceCwd?Ws.workspaceByCwd(hn.workspaceCwd).workspaceGit():Ws.workspaceGit(),[vs,is,Js,vr]=await Promise.allSettled([$n?Promise.resolve(void 0):Ws.workspaceProviders(),$n?Promise.resolve(void 0):hn.supportedCommands(),$n?Promise.resolve(void 0):hn.context(),Qs]),ni=(vs==null?void 0:vs.status)==="fulfilled"?vs.value:void 0,Tr=(is==null?void 0:is.status)==="fulfilled"?is.value:void 0,mo=(Js==null?void 0:Js.status)==="fulfilled"?Js.value:void 0,Nl=(vr==null?void 0:vr.status)==="fulfilled"?vr.value.branch??void 0:void 0,Pr=[(vs==null?void 0:vs.status)==="rejected"?(Vt=Ve.current)==null?void 0:Vt.models:void 0,(is==null?void 0:is.status)==="rejected"?(Qn=Ve.current)==null?void 0:Qn.commands:void 0,(Js==null?void 0:Js.status)==="rejected"?(Rs=Ve.current)==null?void 0:Rs.context:void 0].filter(xt=>!!xt),rt=KL(ni),Dt=efe(mo),pn=Dt&&Dt.models.length>0?Dt.models:rt.models,Ut=(Dt==null?void 0:Dt.currentModel)??rt.currentModel,rn=Ut===rt.currentModel?rt.contextWindow:(pr=rt.models.find(xt=>xt.id===Ut))==null?void 0:pr.contextWindow,zn=(Dt==null?void 0:Dt.contextWindow)??((hs=pn.find(xt=>xt.id===Ut))==null?void 0:hs.contextWindow)??rn,{commands:fs,skills:tr}=rG(Tr),Ci=nfe(mo)??rt.currentMode;_e(xt=>xt.sessionId!==hn.sessionId?xt:{...xt,status:"connected",sessionId:hn.sessionId,...hn.clientId?{clientId:hn.clientId}:{},workspaceCwd:hn.workspaceCwd,commands:Tr!==void 0?fs:xt.commands,skills:Tr!==void 0?tr:xt.skills,models:pn.length>0?pn:xt.models,currentModel:Ut??xt.currentModel,currentMode:Ci??xt.currentMode,displayName:XL(hn.state)??xt.displayName,contextWindow:zn??xt.contextWindow,providers:ni??xt.providers,supportedCommands:Tr??xt.supportedCommands,context:mo??xt.context,gitBranch:vr.status==="fulfilled"?Nl:xt.gitBranch,capabilities:Xs??xt.capabilities,loadingTranscript:void 0,catchingUp:Bt?xt.catchingUp:An||hn.lastEventId!=null||void 0}),Pr.length>0&&F.dispatch(Pr.map(xt=>({type:"status",text:xt})));let mr=!1,po=!1;const go=()=>{const xt=se.current.get(hn.sessionId);xt==null||xt.controller.abort(),se.current.delete(hn.sessionId),Nt&&Tn(),vi(W),qe("idle"),fr(),F.reset(),hn.setLastEventId(0),Cr=hn.sessionId,po=!0,Ss=void 0,G.current=void 0,pt.current=()=>!1,_e(En=>({...En,status:"connecting",error:void 0,errorStatus:Gc(void 0,En.errorStatus)}))},xa=new AbortController;xe={sessionId:hn.sessionId,controller:xa,restartRequested:!1},M.current=xe;const Ka=()=>xa.abort(st.signal.reason);st.signal.addEventListener("abort",Ka,{once:!0}),$e=()=>st.signal.removeEventListener("abort",Ka);for await(const xt of hn.events({signal:xa.signal,maxQueued:a})){if(((xr=G.current)==null?void 0:xr.sessionId)!==hn.sessionId)break;mr||(mr=!0,pe=0);try{const En=Efe(xt);if(En){Tfe(En);continue}const si=Mfe(xt);si&&Nfe(si),Bfe(xt)&&(Ofe(xt),xt.type==="pending_prompt_started"&&(vi(W),qe("waiting")));const ar=q5(xt,hn.clientId,he.current,_e),nr=H5(xt,ar,bn,Pe);if(xt.type==="state_resync_required"&&(typeof xt.data=="object"&&xt.data!==null?xt.data.reason:void 0)==="epoch_reset"){go();break}if(aP(nr,ot),nr.length>0){const As=U5(nr);qe(Ls=>Ls==="waiting"||Ls==="idle"&&As?"streaming":Ls)}(xt.type==="turn_complete"||xt.type==="turn_error")&&as();const Ti=iP(se.current,X.current,hn.sessionId,xt,F,qe,W);let Qo=!1;if(!Ti&&Nt&&(xt.type==="turn_complete"||xt.type==="turn_error")){Tn(),Qo=!0,vi(W);const As=xt.type==="turn_complete"?((ci=xt.data)==null?void 0:ci.stopReason)??"end_turn":"error";Bs(Ah(xt,As)),_n()||qe("idle")}!_n()&&nr.some(As=>As.type==="debug")&&as();const ui=!_n()&&F.getSnapshot().activeAssistantBlockId!=null?nr.filter(As=>As.type!=="debug"):nr;Hn(ui);for(const As of nr)if(As.type==="prompt.cancelled"&&(Nt||As.originatorClientId!==hn.clientId)){Bs(Ah(xt,"cancelled"));const Ls=Nt;Tn(),Qo=!0,vi(W),Ls||se.current.delete(hn.sessionId),_n()||qe("idle")}else As.type==="session.replay_complete"&&(as(),_e(Ls=>({...Ls,catchingUp:void 0})),F.getSnapshot().awaitingResync&&F.clearAwaitingResync(),_n()||(vi(W),Bs({type:"assistant.done",reason:"replay_complete"}),qe("idle")));const va=!Ti&&!Qo&&!_n();if(va&&(nr.some(Ls=>Ls.type==="user.text.delta")?qe("waiting"):U5(nr)&&qe(Ls=>Ls==="idle"?"streaming":Ls)),va&&xt.type==="turn_complete"){vi(W);const As=((_s=xt.data)==null?void 0:_s.stopReason)??"end_turn";Bs(Ah(xt,As)),qe("idle")}else va&&xt.type==="turn_error"?(vi(W),Bs(Ah(xt,"error")),qe("idle")):va&&U5(nr)&&cfe(F,W,"passive_observer",3e3,()=>qe("idle"));if(xt.type==="state_resync_required"&&(typeof xt.data=="object"&&xt.data!==null?xt.data.reason:void 0)!=="epoch_reset"){_n()||(qe("idle"),vi(W)),fr(),F.reset(),console.warn("[DaemonSessionProvider] ring eviction detected, reloading session (sessionId=%s)",hn.sessionId),po=!0,Ss=void 0,G.current=void 0,pt.current=()=>!1,_e(Ls=>({...Ls,status:"connecting",error:void 0,errorStatus:Gc(void 0,Ls.errorStatus)}));break}if(xt.type==="session_closed"&&((Vs=xt.data)==null?void 0:Vs.reason)==="client_close"){Xt=!0;const As=hn.sessionId,Ls=se.current.get(As);Ls==null||Ls.controller.abort(),se.current.delete(As),Ss=void 0,G.current=void 0;break}}catch(En){const si=En instanceof Error?En.message:String(En);bn({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.event_malformed",message:"Skipped malformed daemon event",debugMessage:si,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed daemon event:",En)}}as();const Ya=xe.restartRequested;if(Lt(),Ya){pe=0,Ie=!0;continue}if(Xt){Bs({type:"assistant.done",reason:"cancelled"}),qe("idle"),vi(W),_e(xt=>({...xt,status:"disconnected",sessionId:void 0,error:void 0,errorStatus:void 0,missingSession:!1}));return}if(ee.current){Ss=void 0,G.current=void 0,pt.current=()=>!1;return}!St&&!st.signal.aborted&&!po&&(((ls=G.current)==null?void 0:ls.sessionId)===hn.sessionId&&(console.debug("[DaemonSessionProvider] SSE stream ended"),_n()||(vi(W),qe("idle"),Bs({type:"assistant.done",reason:"stream_ended"}))),_e(xt=>({...xt,status:xt.status==="error"?"error":"disconnected",error:xt.status==="error"?xt.error:void 0,errorStatus:Gc(void 0,xt.errorStatus)})))}catch(An){const Xn=(xe==null?void 0:xe.restartRequested)===!0;if(Lt(),Xn&&!St&&!st.signal.aborted){as(),pe=0,Ie=!0;continue}if(St||st.signal.aborted)return;as();const Mn=An instanceof Error?An.message:String(An),Gn=B_(An),Zn=Ss==null?void 0:Ss.sessionId,Vn=sme(An),hn=nme(An);if(Zn&&(Vn||hn)){const Nt=se.current.get(Zn);Nt==null||Nt.controller.abort(),se.current.delete(Zn)}(Vn||hn||!Ge())&&(vi(W),qe("idle"));const Le=J.current;if(Le&&(Le.sessionId===Ke||Le.sessionId===Cr)&&(oe.current===Le.sessionId&&(oe.current=void 0),J.current=void 0,clearTimeout(Le.timeout),Le.reject(An)),Vn||hn){if(Ss=void 0,G.current=void 0,Vn){_e(Tn=>({...Tn,status:"error",sessionId:void 0,error:Mn,errorStatus:Gc(Gn,Tn.errorStatus),missingSession:!1,capabilities:Xs??Tn.capabilities,loadingTranscript:void 0,catchingUp:void 0}));return}const Nt=Un&&Ay(Gn);console.warn("[DaemonSessionProvider] terminal session error (sessionId=%s, status=%d, message=%s)",Zn,Gn,Mn),_e(Tn=>({...Tn,status:"disconnected",sessionId:void 0,error:Mn,errorStatus:Gc(Gn,Tn.errorStatus),missingSession:Nt||Tn.missingSession===!0,capabilities:Xs??Tn.capabilities,loadingTranscript:void 0,catchingUp:void 0}));return}else console.debug("[DaemonSessionProvider] retriable SSE error, preserving session for delta resume (sessionId=%s)",Ss==null?void 0:Ss.sessionId);if(!p){Ss=void 0,G.current=void 0,_e(Nt=>({...Nt,status:"error",error:Mn,errorStatus:Gc(Gn,Nt.errorStatus),missingSession:!1}));return}_e(Nt=>({...Nt,status:"disconnected",error:Mn,errorStatus:Gc(Gn,Nt.errorStatus),missingSession:!1,loadingTranscript:void 0}))}if(!p){G.current=void 0,_e(An=>({...An,status:"disconnected",loadingTranscript:void 0,catchingUp:void 0}));return}pe+=1;const ln=ye.current,Pt=afe(pe,ln.reconnectDelayMs,ln.maxReconnectDelayMs);_e(An=>({...An,status:"disconnected",error:`Reconnecting in ${Pt}ms`})),await lfe(Pt,st.signal)}})(),()=>{const rs=G.current;St=!0,st.abort(),as(),pt.current=()=>!1,qe("idle"),vi(W);const Vt=(rs==null?void 0:rs.sessionId)===oe.current,Qn=!dn.current;J.current&&(!Vt||Qn)&&(clearTimeout(J.current.timeout),J.current.reject(new DOMException("Session load interrupted by cleanup","AbortError")),J.current=void 0),(!Vt||Qn)&&(rs!=null&&rs.clientId)&&JL({baseUrl:S,token:C,sessionId:rs.sessionId,clientId:rs.clientId}).catch(Rs=>console.warn("[DaemonSessionProvider] detach failed:",Rs)),(!Vt||Qn)&&(G.current=void 0)}},[m,p,S,C,s,Ee,me,a,c,F,Ke,ne,We,jt,kn,ht,i,O,yn,bn,Pe]),f.useEffect(()=>{if(!te.current||Me.status!=="connected"||x<=0||y<=0||!Me.sessionId)return;U.current.sessionId!==Me.sessionId&&(U.current={sessionId:Me.sessionId,consecutiveFailures:0});const st=U.current;let St=!1;const Ht=setInterval(()=>{const Ot=G.current;Ot&&Ot.heartbeat().then(()=>{St||(st.consecutiveFailures>=y&&_e(Yt=>Yt.sessionId===Ot.sessionId?{...Yt,status:"connected",error:void 0,errorStatus:void 0}:Yt),st.consecutiveFailures=0,st.lastHttpError=void 0)}).catch(Yt=>{var Pn,Hn,as,Bs,fr;if(St)return;st.consecutiveFailures+=1;const Gr=Yt instanceof Error?Yt.message:"Session heartbeat failed",rs=B_(Yt);if(rs!==void 0){const hs=(Pn=st.lastHttpError)==null?void 0:Pn.status;st.lastHttpError={status:Gc(rs,hs)??rs,message:Ay(hs)?((Hn=st.lastHttpError)==null?void 0:Hn.message)??Gr:Gr}}if(st.consecutiveFailures<y)return;const Vt=(as=st.lastHttpError)==null?void 0:as.status,Qn=((Bs=st.lastHttpError)==null?void 0:Bs.message)??Gr,Rs=Vt!==void 0&&NN.has(Vt),pr=Ay(Vt);if(Rs||pr){const hs=Ot.sessionId;console.warn(pr?"[DaemonSessionProvider] heartbeat detected missing session (sessionId=%s, status=%d)":"[DaemonSessionProvider] heartbeat auth failure (sessionId=%s, status=%d)",hs,Vt);const xr=se.current.get(hs);xr==null||xr.controller.abort(),se.current.delete(hs),vi(W),qe("idle"),((fr=G.current)==null?void 0:fr.sessionId)===hs&&(pr&&(ee.current=!0),G.current=void 0)}_e(hs=>hs.sessionId===Ot.sessionId?{...hs,status:Rs?"error":"disconnected",error:Qn,errorStatus:Gc(Vt,hs.errorStatus),missingSession:pr,...Rs||pr?{sessionId:void 0,loadingTranscript:void 0,catchingUp:void 0}:{}}:hs)})},x);return()=>{St=!0,clearInterval(Ht)}},[Me.sessionId,Me.status,y,x]);const De=f.useMemo(()=>ffe({store:F,sessionRef:G,activePromptsRef:se,settledPromptsRef:X,pendingSessionLoadRef:J,pendingSessionLoadIdRef:de,heartbeatSupportedRef:te,manualSessionClearRef:ee,skipNextCleanupDetachSessionIdRef:oe,passiveAssistantDoneTimerRef:W,hasSessionActivePrompt:()=>pt.current(),resetCurrentSessionActivePrompt:()=>{pt.current=()=>!1},restartEventStream:st=>{if(!g)return;const St=M.current;(St==null?void 0:St.sessionId)===st&&(St.restartRequested=!0,St.controller.abort())},getCreateSessionRequest:()=>{var st;return{...bt.current,sessionScope:"thread",workspaceCwd:z.current??((st=G.current)==null?void 0:st.workspaceCwd)}},createDetachedSession:(st,St)=>{var Ht;const Ot=B.current??new h7({baseUrl:S,token:C}),Yt={...bt.current,sessionScope:"thread",workspaceCwd:st??z.current??((Ht=G.current)==null?void 0:Ht.workspaceCwd),...(St==null?void 0:St.approvalMode)!==void 0?{approvalMode:St.approvalMode}:{},...(St==null?void 0:St.sourceType)!==void 0?{sourceType:St.sourceType}:{}},Pn=i?At.current:B5(void 0);return kb.createOrAttach(Ot,Yt,Pn)},getConnection:()=>Xe.current,addNotice:bn,setConnection:_e,setPromptStatus:qe,setRestoreSessionId:ke,setRestoreWorkspaceCwd:gt,setRestoreMode:tt,setRestoreSessionNonce:jn,setAttachSessionNonce:Be,setNewSessionNonce:ve}),[bn,i,S,C,g,F]),sn=f.useCallback(async()=>{const st=I.current,St=G.current;if(!st.hasMore||st.loading||!St||St.sessionId!==st.sessionId)return;st.loading=!0,V({hasMore:!0,loading:!0,capacityReached:!1});let Ht=!1;try{const Ot=await St.client.getSessionTranscriptPage(St.sessionId,{...st.cursor!==void 0?{cursor:st.cursor}:st.beforeRecordId!==void 0?{beforeRecordId:st.beforeRecordId}:{},limit:it.current??100,clientId:St.clientId});if(G.current!==St||I.current!==st)return;if(Ot.partial||Ot.replayError)throw Ht=!0,new Error(Ot.replayError??"Earlier session history was only partially read");const Yt={...he.current,suppressOwnUserEcho:!1},Pn=[];for(const as of Ot.events)try{Pn.push(...H5(as,q5(as,St.clientId,Yt,_e,{updateConnection:!1}),bn,Pe))}catch(Bs){const fr=Bs instanceof Error?Bs.message:String(Bs);bn({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.replay_event_malformed",message:"Skipped malformed history event",debugMessage:fr,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed history event:",Bs)}if(Pn.length>0&&!Ffe(F,Pn,c)){st.hasMore=!1,st.loading=!1,st.capacityReached=!0,V({hasMore:!1,loading:!1,capacityReached:!0});return}const Hn=F.getSnapshot().blocks.length<c;st.capacityReached=Ot.hasMore&&!Hn,st.cursor=Ot.nextCursor,st.beforeRecordId=void 0,st.hasMore=Ot.hasMore&&Hn,st.loading=!1,V({hasMore:st.hasMore,loading:!1,capacityReached:st.capacityReached})}catch(Ot){if(G.current!==St||I.current!==st)return;const Yt=!Ht&&(!(Ot instanceof ac)||Ot.status>=500||Ot.status===408||Ot.status===429);throw st.hasMore=Yt,st.loading=!1,st.capacityReached=!1,V({hasMore:Yt,loading:!1,capacityReached:!1}),bn({severity:"warning",category:"user_action",operation:"load_session",code:"daemon.transcript_history.failed",message:"Failed to load earlier session history",debugMessage:Ot instanceof Error?Ot.message:String(Ot),recoverable:Yt}),Ot}},[bn,Pe,c,F]),Dn=f.useMemo(()=>{var st;const St=Me.sessionId===I.current.sessionId&&((st=G.current)==null?void 0:st.sessionId)===I.current.sessionId;return{hasMore:St&&Q.hasMore,loading:St&&Q.loading,capacityReached:St&&Q.capacityReached,loadMore:sn}},[Me.sessionId,sn,Q]),os=f.useRef(Vfe);return f.useEffect(()=>{if(os.current===r)return;os.current=r;const st=Xe.current.sessionId;if(r===st)return;const St=r?De.loadSession(r):st?De.clearSession():void 0;St&&St.catch(Ht=>{console.warn("[DaemonSessionProvider] controlled session transition failed:",Ht)})},[De,r]),l.jsx(yG.Provider,{value:F,children:l.jsx(xG.Provider,{value:Me,children:l.jsx(wG.Provider,{value:et,children:l.jsx(kG.Provider,{value:je,children:l.jsx(_G.Provider,{value:Ne,children:l.jsx(AN.Provider,{value:De,children:l.jsx(vG.Provider,{value:Dn,children:k})})})})})})})}function iP(e,t,n,s,r,i,o,a={}){var c;if(s.type!=="turn_complete"&&s.type!=="turn_error")return!1;const u=(c=s.data)==null?void 0:c.promptId;if(!u)return!1;const d=e.get(n);if(!d||a.requireBoundPromptId&&d.promptId===void 0||d.promptId!==void 0&&d.promptId!==u)return!1;vi(o);try{const h=mN(s,u);if(!h)return!1;r.dispatch(Ah(s,h.stopReason)),i("idle"),d.resolve?(e.delete(n),d.resolve(h)):(e.delete(n),t.set(v7(n,u),{status:"resolved",result:h}))}catch(h){r.dispatch(Ah(s,"error")),i("idle"),d.reject?(e.delete(n),d.reject(h)):(e.delete(n),t.set(v7(n,u),{status:"rejected",error:h}))}return!0}function Wfe(e){return e.type==="turn_complete"}function q5(e,t,n,s,r={}){Gfe(e),r.updateConnection!==!1&&tfe(e,s);const i=kde(e,{clientId:t,suppressOwnUserEcho:n.suppressOwnUserEcho,includeRawEvent:n.includeRawEvent}),o=Zfe(e);return Wfe(e)?o?[o]:[]:o?[...i,o]:i}function Gfe(e){e.type==="settings_reloaded"&&console.debug("[DaemonSessionProvider] settings reloaded:",Kfe(e))}function Kfe(e){const t={};if(e.id!==void 0&&(t.eventId=e.id),!Fo(e.data))return t.payload="non-object",t;const n=Yfe(e.data.env),s=Ny(e.data.changedKeys),r=Ny(e.data.sessionsRefreshed),i=Ny(e.data.sessionsSkipped),o=e.data.childReloaded,a=Sc(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 Yfe(e){if(Fo(e))return{updatedKeys:Ny(e.updatedKeys)??[],removedKeys:Ny(e.removedKeys)??[]}}function Ny(e){if(Array.isArray(e))return e.filter(t=>typeof t=="string")}function H5(e,t,n,s){if(e.type==="session_snapshot"&&Fo(e.data)&&e.data.recordingDegraded===!1){const i=Sc(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(Xfe(e,i));(o.category==="protocol"||o.category==="connection")&&console.warn("[DaemonSessionProvider] daemon notice:",o)}return r}function Xfe(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=Fo(e.data)?Sc(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 I4(){const e=f.useContext(yG);if(!e)throw new Error("useDaemonTranscriptStore must be used within DaemonSessionProvider");return e}function CG(){const e=f.useContext(vG);if(!e)throw new Error("useDaemonTranscriptHistory must be used within DaemonSessionProvider");return e}function mv(){const e=I4(),t=f.useCallback(()=>e.getSnapshot().blocks,[e]);return f.useSyncExternalStore(e.subscribe,t,t)}function R4(){const e=mv(),t=TG();return f.useMemo(()=>Sfe(e,t),[e,t])}function x1(){const e=f.useContext(AN);if(!e)throw new Error("useDaemonActions must be used within DaemonSessionProvider");return e}function Qfe(){return f.useContext(AN)}function Kd(){return f.useContext(_G)}function TG(){const e=f.useContext(wG);if(!e)throw new Error("useDaemonPromptStatus must be used within DaemonSessionProvider");return e}function Cl(){const e=f.useContext(xG);if(!e)throw new Error("useDaemonConnection must be used within DaemonSessionProvider");return e}function Jfe(){const e=f.useContext(kG);if(!e)throw new Error("useDaemonSessionNotices must be used within DaemonSessionProvider");return e}function U5(e){return e.some(t=>t.type==="assistant.text.delta"||t.type==="thought.text.delta"||t.type==="tool.update")}function Zfe(e){if(e.type!=="session_update")return null;const t=Fo(e.data)?e.data:void 0,n=Fo(t==null?void 0:t.update)?t.update:Fo(e.data)?e.data:void 0;if(!n||n.sessionUpdate!=="agent_message_chunk")return null;const s=n._meta;if(!Fo(s))return null;const r=eme(s.goalStatus);if(r)return oP(e,r);const i=tme(s.goalTerminal);if(i)return oP(e,i);const o=s.stopHookLoop;if(!Fo(o))return null;const a=o.goal;return!Fo(a)||!Sc(a,"condition"),null}function oP(e,t){return{type:"status",...e.id!==void 0?{eventId:e.id}:{},...e.originatorClientId?{originatorClientId:e.originatorClientId}:{},text:"",source:"goal",data:t}}function eme(e){if(!Fo(e))return null;const t=Sc(e,"kind");if(t!=="set"&&t!=="cleared"&&t!=="achieved"&&t!=="failed"&&t!=="aborted")return null;const n=Sc(e,"condition");if(!n)return null;const s=jy(e,"iterations"),r=jy(e,"durationMs"),i=jy(e,"setAt"),o=Sc(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 tme(e){if(!Fo(e))return null;const t=Sc(e,"kind");if(t!=="achieved"&&t!=="failed"&&t!=="aborted")return null;const n=Sc(e,"condition");if(!n)return null;const s=jy(e,"iterations"),r=jy(e,"durationMs"),i=Sc(e,"lastReason");return{kind:t,condition:n,...s!==void 0?{iterations:s}:{},...r!==void 0?{durationMs:r}:{},...i?{lastReason:i}:{}}}function Sc(e,t){const n=e[t];return typeof n=="string"?n:void 0}function jy(e,t){const n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function aP(e,t){let n=0,s=0,r=0,i=0,o=0,a=0,c=0,u,d=0,h=0;for(const m of e)switch(m.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":case"workspace.mcp.server_changed":o+=1;break;case"workspace.extensions.changed":a+=1,u={...m.status?{status:m.status}:{},...m.source?{source:m.source}:{},...m.name?{name:m.name}:{},...m.version?{version:m.version}:{},...m.error?{error:m.error}:{},refreshed:m.refreshed,failed:m.failed};break;case"session.artifact.changed":c+=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+c+d+h!==0&&t(m=>({memoryVersion:m.memoryVersion+n,agentsVersion:m.agentsVersion+s,toolsVersion:m.toolsVersion+r,settingsVersion:m.settingsVersion+i,mcpVersion:m.mcpVersion+o,extensionsVersion:m.extensionsVersion+a,artifactsVersion:m.artifactsVersion+c,...u?{lastExtensionChange:u}:{},initVersion:m.initVersion+d,authVersion:m.authVersion+h}))}function nme(e){const t=B_(e);return t!==void 0&&qfe.has(t)}function sme(e){const t=B_(e);return t!==void 0&&NN.has(t)}function B_(e){if(e instanceof ac||Fo(e)&&typeof e.status=="number")return e.status}function Fo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Du(e,t){const{autoLoad:n=!1,enabled:s=!0}=t,[r,i]=f.useState({data:void 0,loading:!1,error:void 0}),o=f.useRef(0),a=f.useCallback(async()=>{if(!s)return;const c=++o.current;i(u=>({...u,loading:!0,error:void 0}));try{const u=await e();return c!==o.current?void 0:(i({data:u,loading:!1,error:void 0}),u)}catch(u){if(c!==o.current)return;const d=u instanceof Error?u:new Error(String(u));i(h=>({...h,loading:!1,error:d}));return}},[s,e]);return f.useEffect(()=>{!n||!s||a()},[n,s,a]),{...r,reload:a}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function v1(e,t,n){const s=f.useRef(!1);f.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 rme(e={}){var t;const n=fo(),s=f.useCallback(()=>n.listAgents(),[n]),r=Du(s,e),i=Kd();return v1(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 EG(e={}){const t=fo(),n=f.useCallback(()=>t.loadMcpStatus(),[t]),s=Du(n,e),r=Kd();return v1(r==null?void 0:r.mcpVersion,s.reload,e.autoLoad===!0||s.data!==void 0),{...s,status:s.data,initialize:t.initializeMcp,reloadConfig:t.reloadMcp,loadTools:t.loadMcpTools,loadResources:t.loadMcpResources,restartServer:t.restartMcpServer,manageServer:t.manageMcpServer,addServer:t.addRuntimeMcpServer,removeServer:t.removeRuntimeMcpServer}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function ime(e={}){var t;const n=fo(),s=f.useCallback(()=>n.loadMemoryStatus(),[n]),r=Du(s,e),i=Kd();return v1(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 S2(e={}){const{pageSize:t,cursor:n,archiveState:s,view:r,group:i,sourceType:o,...a}=e,c=dc(),u=Qfe(),d=f.useCallback(()=>{const S={...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}:{},...o!==void 0?{sourceType:o}:{}};return c.actions.listSessionsPage(S)},[s,n,i,t,o,r,c.actions]),h=!!c.workspaceCwd,m=Du(d,{...a,enabled:(a.enabled??!0)&&h}),p=m.reload,g=f.useCallback(async()=>{const S=await p();return S==null?void 0:S.sessions},[p]),b=m.data,v=(b==null?void 0:b.sessions)??[],x=f.useCallback(async S=>{const C=await c.actions.deleteSession(S);return C&&g(),C},[c.actions,g]),y=f.useCallback(async S=>{const C=await c.actions.deleteSessions(S);return(C.removed.length>0||C.notFound.length>0)&&g(),C},[c.actions,g]),w=f.useCallback((S,C="html")=>c.actions.exportSession(S,C),[c.actions]),k=f.useCallback(async S=>{const C=await c.actions.archiveSession(S);return C&&g(),C},[c.actions,g]),T=f.useCallback(async S=>{const C=await c.actions.unarchiveSession(S);return C&&g(),C},[c.actions,g]);return{...m,data:b!==void 0?v:void 0,reload:g,sessions:v,nextCursor:b==null?void 0:b.nextCursor,liveMergeFailed:(b==null?void 0:b.liveMergeFailed)===!0,truncated:(b==null?void 0:b.truncated)===!0,loadSession:u==null?void 0:u.loadSession,resumeSession:u==null?void 0:u.resumeSession,newSession:u==null?void 0:u.newSession,releaseSession:u==null?void 0:u.releaseSession,deleteSession:x,deleteSessions:y,exportSession:w,archiveSession:k,unarchiveSession:T}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function ome(e={}){var t;const n=fo(),s=f.useCallback(()=>n.loadSkillsStatus(),[n]),r=Du(s,e);return{...r,status:r.data,skills:((t=r.data)==null?void 0:t.skills)??[],setEnabled:n.setWorkspaceSkillEnabled,install:n.installWorkspaceSkill,remove:n.deleteWorkspaceSkill}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function C7(e={}){const{detail:t="summary",...n}=e,s=fo(),r=f.useCallback(()=>s.loadDaemonStatus(t),[s,t]),i=Du(r,n);return{...i,report:i.data}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function ame(e={}){const{range:t,heatmapDays:n,...s}=e,r=fo(),i=f.useCallback(()=>r.loadUsageDashboard({range:t,heatmapDays:n}),[r,t,n]),o=Du(i,s);return{...o,dashboard:o.data}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function AG(e={}){var t;const n=fo(),s=f.useCallback(()=>n.loadToolsStatus(),[n]),r=Du(s,e),i=Kd();return v1(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 NG(e={}){var t;const n=fo(),s=f.useCallback(()=>n.loadSettingsStatus(),[n]),r=Du(s,e),i=Kd();return v1(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 lme(e={}){var t,n;const s=fo(),r=f.useCallback(()=>s.loadProviders(),[s]),i=Du(r,e),o=Kd();return v1(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 cme=300,ume=100,j0=Object.freeze({suggestion:null,isVisible:!1,shownAt:0});function V5(e){var t;const n=e;(t=n.clearFollowupSuggestion)==null||t.call(n)}function dme(e){const{enabled:t=!0,onStateChange:n,getOnAccept:s,getOnOutcome:r}=e;let i=j0,o=null,a=!1,c=null;function u(v){i=v,n(v)}function d(){o&&(clearTimeout(o),o=null),c&&(clearTimeout(c),c=null)}return{setSuggestion:v=>{if(o&&(clearTimeout(o),o=null),!v){u(j0);return}t&&(o=setTimeout(()=>{u({suggestion:v,isVisible:!0,shownAt:Date.now()})},cme))},accept:(v,x)=>{var y;if(a)return;o&&(clearTimeout(o),o=null),a=!0;const w=i.suggestion,{shownAt:k}=i;if(!w){a=!1;return}try{(y=r())==null||y({outcome:"accepted",accept_method:v,time_ms:k>0?Date.now()-k:0,suggestion_length:w.length})}catch(T){console.error("[followup] onOutcome callback threw:",T)}u(j0),queueMicrotask(()=>{var T;try{x!=null&&x.skipOnAccept||(T=s())==null||T(w)}catch(S){console.error("[followup] onAccept callback threw:",S)}finally{c&&clearTimeout(c),c=setTimeout(()=>{a=!1},ume)}})},dismiss:()=>{var v;if(o&&(clearTimeout(o),o=null),!(!i.isVisible&&!i.suggestion)){if(i.isVisible&&i.suggestion)try{(v=r())==null||v({outcome:"ignored",time_ms:i.shownAt>0?Date.now()-i.shownAt:0,suggestion_length:i.suggestion.length})}catch(x){console.error("[followup] onOutcome callback threw:",x)}u(j0)}},clear:()=>{d(),a=!1,u(j0)},cleanup:()=>{d(),a=!1}}}function jG(e={}){const{enabled:t=!0,onAccept:n,onOutcome:s}=e,r=I4(),i=Cl().sessionId,[o,a]=f.useState(j0),c=f.useRef(n);c.current=n;const u=f.useRef(s);u.current=s;const d=f.useSyncExternalStore(r.subscribe,()=>r.getSnapshot().lastFollowupSuggestion,()=>r.getSnapshot().lastFollowupSuggestion),h=f.useSyncExternalStore(Cfe,tP,tP),m=(h==null?void 0:h.sessionId)===i?h:d,p=f.useMemo(()=>dme({enabled:t,onStateChange:a,getOnAccept:()=>c.current,getOnOutcome:()=>u.current}),[t]),{setSuggestion:g}=p;f.useEffect(()=>(t||p.clear(),()=>p.cleanup()),[p,t]);const b=f.useRef(void 0),v=f.useRef(i);f.useEffect(()=>{const k=v.current;v.current=i,k!==void 0&&i!==void 0&&k!==i&&(p.clear(),Uw(),b.current=void 0)},[p,i]),f.useEffect(()=>{const k=m==null?void 0:m.promptId;k!==b.current&&(b.current=k,g((m==null?void 0:m.suggestion)??null))},[m,g]);const x=f.useCallback(()=>{p.clear(),V5(r),Uw(),b.current=void 0},[p,r]),y=f.useCallback((k,T)=>{p.accept(k,T),V5(r),Uw(),b.current=void 0},[p,r]),w=f.useCallback(()=>{p.dismiss(),V5(r),Uw(),b.current=void 0},[p,r]);return f.useMemo(()=>({followupState:o,onAcceptFollowup:y,onDismissFollowup:w,clear:x}),[o,y,w,x])}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function hme(){const e=f.useSyncExternalStore(Afe,nP,nP),t=f.useCallback(n=>jfe(n),[]);return{batches:e,consume:t}}const lP=[];function fme(e,t){return e===t?!1:e.length!==t.length?!0:e.some((n,s)=>!Object.is(n,t[s]))}class zd extends f.Component{constructor(){super(...arguments);Re(this,"state",{error:null,resetKeys:this.props.resetKeys??lP});Re(this,"reset",()=>{this.setState({error:null})})}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,s){const r=n.resetKeys??lP;return fme(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 cP={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:"重试"}},mme={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0.75rem",padding:"2rem",minHeight:"8rem",height:"100%",textAlign:"center",color:"inherit"},pme={margin:0,fontSize:"1rem",fontWeight:600},gme={margin:0,fontSize:"0.85rem",opacity:.7,maxWidth:"32rem"},bme={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 yme({error:e,onRetry:t,language:n="en"}){const s=cP[n]??cP.en;return l.jsxs("div",{role:"alert",style:mme,"data-web-shell-error":!0,children:[l.jsx("p",{style:pme,children:s.title}),l.jsx("p",{style:gme,children:s.body}),!1,l.jsx("button",{type:"button",style:bme,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 MG=(...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 xme=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 vme=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 uP=e=>{const t=vme(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 W5={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 wme=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},kme=f.createContext({}),_me=()=>f.useContext(kme),Sme=f.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:s,className:r="",children:i,iconNode:o,...a},c)=>{const{size:u=24,strokeWidth:d=2,absoluteStrokeWidth:h=!1,color:m="currentColor",className:p=""}=_me()??{},g=s??h?Number(n??d)*24/Number(t??u):n??d;return f.createElement("svg",{ref:c,...W5,width:t??u??W5.width,height:t??u??W5.height,stroke:e??m,strokeWidth:g,className:MG("lucide",p,r),...!i&&!wme(a)&&{"aria-hidden":"true"},...a},[...o.map(([b,v])=>f.createElement(b,v)),...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 Rn=(e,t)=>{const n=f.forwardRef(({className:s,...r},i)=>f.createElement(Sme,{ref:i,iconNode:t,className:MG(`lucide-${xme(uP(e))}`,`lucide-${e}`,s),...r}));return n.displayName=uP(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 Cme=[["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"}]],Tme=Rn("activity",Cme);/**
 * @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 Eme=[["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"}]],Ame=Rn("archive-restore",Eme);/**
 * @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 Nme=[["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"}]],dP=Rn("archive",Nme);/**
 * @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 jme=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],jN=Rn("arrow-left",jme);/**
 * @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 Mme=[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]],Ime=Rn("blocks",Mme);/**
 * @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 Rme=[["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"}]],IG=Rn("bot",Rme);/**
 * @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 Dme=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],Lme=Rn("box",Dme);/**
 * @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 Pme=[["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"}]],Ome=Rn("calendar-clock",Pme);/**
 * @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 Bme=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],RG=Rn("check",Bme);/**
 * @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 $me=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],zl=Rn("chevron-down",$me);/**
 * @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 zme=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],D4=Rn("chevron-right",zme);/**
 * @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 Fme=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],qme=Rn("chevron-up",Fme);/**
 * @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 Hme=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Ra=Rn("circle-alert",Hme);/**
 * @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 Ume=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],Vme=Rn("circle-dot",Ume);/**
 * @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 Wme=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Gme=Rn("columns-2",Wme);/**
 * @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 Kme=[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]],Yme=Rn("command",Kme);/**
 * @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 Xme=[["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"}]],T7=Rn("database",Xme);/**
 * @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 Qme=[["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"}]],hP=Rn("download",Qme);/**
 * @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 Jme=[["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"}]],cg=Rn("ellipsis-vertical",Jme);/**
 * @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 Zme=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],epe=Rn("file-text",Zme);/**
 * @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 tpe=[["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"}]],npe=Rn("flask-conical",tpe);/**
 * @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 spe=[["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"}]],C2=Rn("folder-closed",spe);/**
 * @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 rpe=[["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"}]],ipe=Rn("folder-input",rpe);/**
 * @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 ope=[["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"}]],ape=Rn("folder-open",ope);/**
 * @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 lpe=[["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"}]],cpe=Rn("folder-x",lpe);/**
 * @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 upe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],dx=Rn("info",upe);/**
 * @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 dpe=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],hpe=Rn("layers",dpe);/**
 * @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 fpe=[["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"}]],mpe=Rn("layout-grid",fpe);/**
 * @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 ppe=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],gpe=Rn("loader-circle",ppe);/**
 * @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 bpe=[["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"}]],DG=Rn("maximize-2",bpe);/**
 * @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 ype=[["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"}]],LG=Rn("minimize-2",ype);/**
 * @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 xpe=[["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"}]],vpe=Rn("moon",xpe);/**
 * @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 wpe=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],fP=Rn("package",wpe);/**
 * @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 kpe=[["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"}]],_pe=Rn("palette",kpe);/**
 * @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 Spe=[["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"}]],Cpe=Rn("panel-left-close",Spe);/**
 * @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 Tpe=[["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"}]],Epe=Rn("panel-left-open",Tpe);/**
 * @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 Ape=[["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"}]],PG=Rn("pencil",Ape);/**
 * @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 Npe=[["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"}]],jpe=Rn("pin",Npe);/**
 * @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 Mpe=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Ipe=Rn("play",Mpe);/**
 * @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 Rpe=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],hx=Rn("plus",Rpe);/**
 * @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 Dpe=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],My=Rn("refresh-cw",Dpe);/**
 * @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 Lpe=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Fd=Rn("search",Lpe);/**
 * @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 Ppe=[["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"}]],ug=Rn("server",Ppe);/**
 * @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 Ope=[["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"}]],OG=Rn("settings-2",Ope);/**
 * @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 Bpe=[["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"}]],$pe=Rn("settings",Bpe);/**
 * @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 zpe=[["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"}]],Fpe=Rn("shield",zpe);/**
 * @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 qpe=[["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"}]],Hpe=Rn("sliders-horizontal",qpe);/**
 * @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 Upe=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],T2=Rn("sparkles",Upe);/**
 * @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 Vpe=[["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"}]],mP=Rn("square-pen",Vpe);/**
 * @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 Wpe=[["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"}]],Gpe=Rn("sun",Wpe);/**
 * @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 Kpe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],Ype=Rn("target",Kpe);/**
 * @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 Xpe=[["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"}]],Iy=Rn("trash-2",Xpe);/**
 * @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 Qpe=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Jpe=Rn("triangle-alert",Qpe);/**
 * @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 Zpe=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],e0e=Rn("upload",Zpe);/**
 * @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 t0e=[["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"}]],pP=Rn("wifi-off",t0e);/**
 * @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 n0e=[["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"}]],E7=Rn("wrench",n0e);/**
 * @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 s0e=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],MN=Rn("x",s0e);function A7(e){for(const t of e){if(!r0e(t))continue;const n=t;if(n.resolved)continue;const s=G0(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=G0(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(c=>({id:c.optionId,label:c.label,kind:o0e(c.raw)})),rawInput:i0e(n.toolCall)}}return null}function r0e(e){return e.kind==="permission"}function i0e(e){const t=G0(e);return t?G0(t.rawInput)??G0(t.input)??G0(t.args)??t:void 0}function G0(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function o0e(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 a0e(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 c=+i;if(Number.isInteger(c)&&c>=0&&c<e){let u=r[c];if(!u){const d=t[c*2];u=r[c]={index:c,key:n(c),start:d,size:t[c*2+1],end:d+t[c*2+1],lane:0}}return u}}if(i==="length")return e}return Reflect.get(r,i,o)}})}function u0(e,t,n){let s=n.initialDeps??[],r,i=!0;function o(){const a=e();return(a.length!==s.length||a.some((u,d)=>s[d]!==u))&&(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 gP(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const l0e=(e,t)=>Math.abs(e-t)<1.01,c0e=(e,t,n)=>{let s;return function(...r){e.clearTimeout(s),s=e.setTimeout(()=>t.apply(this,r),n)}};let Tb;const G5=()=>{if(Tb!==void 0)return Tb;if(typeof navigator>"u")return Tb=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Tb=!0;const e=navigator.maxTouchPoints;return Tb=navigator.platform==="MacIntel"&&e!==void 0&&e>0},bP=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},u0e=e=>e,d0e=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},h0e=(e,t)=>{const n=e.scrollElement;if(!n)return;const s=e.targetWindow;if(!s)return;const r=o=>{const{width:a,height:c}=o;t({width:Math.round(a),height:Math.round(c)})};if(r(bP(n)),!s.ResizeObserver)return()=>{};const i=new s.ResizeObserver(o=>{const a=()=>{const c=o[0];if(c!=null&&c.borderBoxSize){const u=c.borderBoxSize[0];if(u){r({width:u.inlineSize,height:u.blockSize});return}}r(bP(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},$_={passive:!0},f0e=typeof window>"u"?!0:"onscrollend"in window,m0e=(e,t,n)=>{const s=e.scrollElement;if(!s)return;const r=e.targetWindow;if(!r)return;const i=e.options.useScrollendEvent&&f0e;let o=0;const a=i?null:c0e(r,()=>t(o,!1),e.options.isScrollingResetDelay),c=h=>()=>{o=n(s),a==null||a(),t(o,h)},u=c(!0),d=c(!1);return s.addEventListener("scroll",u,$_),i&&s.addEventListener("scrollend",d,$_),()=>{s.removeEventListener("scroll",u),i&&s.removeEventListener("scrollend",d)}},p0e=(e,t)=>m0e(e,t,n=>{const{horizontal:s,isRtl:r}=e.options;return s?n.scrollLeft*(r&&-1||1):n.scrollTop}),g0e=(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"]},b0e=(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})},y0e=b0e;class x0e{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,c=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);for(const[u,d]of this.elementsCache)if(d===a){this.elementsCache.delete(u);break}return}this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,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:u0e,rangeExtractor:d0e,onChange:()=>{},measureElement:g0e,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 m in n){const p=n[m];p!==void 0&&(i[m]=p)}const o=this.options;let a=null,c=null,u=!1;if(o!==void 0&&o.enabled&&i.enabled&&i.anchorTo==="end"&&this.scrollElement!==null){const m=o.count,p=i.count,g=this.getMeasurements(),b=m>0?((s=g[0])==null?void 0:s.key)??o.getItemKey(0):null,v=m>0?((r=g[m-1])==null?void 0:r.key)??o.getItemKey(m-1):null;if(p!==m||m>0&&p>0&&(i.getItemKey(0)!==b||i.getItemKey(p-1)!==v)){u=!0;const w=m>0?this.getVirtualItemForOffset(this.getScrollOffset())??g[0]:null;w&&(a=[w.key,this.getScrollOffset()-w.start]);const k=i.followOnAppend===!0?"auto":i.followOnAppend||null;k&&p>m&&this.isAtEnd(o.scrollEndThreshold)&&(m===0||i.getItemKey(p-1)!==v)&&(c=k)}}this.options=i,u&&(this.pendingMin=0,this.itemSizeCacheVersion++);let d=!1,h=0;if(a&&this.scrollOffset!==null){const[m,p]=a,g=this.getMeasurements(),{count:b,getItemKey:v}=this.options;let x=0;for(;x<b&&v(x)!==m;)x++;if(x<b){const y=g[x];if(y){const w=y.start+p;w!==this.scrollOffset&&(h=w-this.scrollOffset,this.scrollOffset=w,d=!0)}}}(d||c)&&(this.pendingScrollAnchor=[d?a[0]:null,d?a[1]:0,c,h])},this.notify=n=>{var s,r;(r=(s=this.options).onChange)==null||r.call(s,this,n)},this.maybeNotify=u0(()=>(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,!(!G5()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",o,$_),i.addEventListener("touchend",a,$_),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,c]=r;i!==null&&!a&&(G5()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?c!==0&&(this._iosDeferredAdjustment+=c):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 c=i.get(a.lane);if(c==null||a.end>c.end?i.set(a.lane,a):a.end<c.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=u0(()=>[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,c)=>(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:c}),{key:!1}),this.getMeasurements=u0(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:s,scrollMargin:r,getItemKey:i,enabled:o,lanes:a,laneAssignmentMode:c},u)=>{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,b=n*2;let v=this._flatMeasurements;if(!v||v.length<b){const w=new Float64Array(b);v&&h>0&&w.set(v.subarray(0,h*2)),v=w,this._flatMeasurements=v}let x;if(h===0)x=s+r;else{const w=h-1;x=v[w*2]+v[w*2+1]+g}for(let w=h;w<n;w++){const k=i(w),T=d.get(k),S=typeof T=="number"?T:this.options.estimateSize(w);v[w*2]=x,v[w*2+1]=S,x+=S+g}const y=a0e(n,v,i);return this.measurementsCache=y,y}const m=this.measurementsCache.slice(0,h),p=new Array(a).fill(void 0);for(let g=0;g<h;g++){const b=m[g];b&&(p[b.lane]=g)}for(let g=h;g<n;g++){const b=i(g),v=this.laneAssignments.get(g);let x,y;const w=c==="estimate"||d.has(b);if(v!==void 0&&this.options.lanes>1){x=v;const C=p[x],_=C!==void 0?m[C]:void 0;y=_?_.end+this.options.gap:s+r}else{const C=this.options.lanes===1?m[g-1]:this.getFurthestMeasurement(m,g);y=C?C.end+this.options.gap:s+r,x=C?C.lane:g%this.options.lanes,this.options.lanes>1&&w&&this.laneAssignments.set(g,x)}const k=d.get(b),T=typeof k=="number"?k:this.options.estimateSize(g),S=y+T;m[g]={index:g,start:y,size:T,end:S,key:b,lane:x},p[x]=g}return this.measurementsCache=m,m},{key:!1,debug:()=>this.options.debug}),this.calculateRange=u0(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,s,r,i)=>this.range=n.length>0&&s>0?v0e({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=u0(()=>{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,c;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)c=this.options.getItemKey(n),a=u[n*2],o=u[n*2+1];else{const m=this.measurementsCache[n];if(!m)return;c=m.key,a=m.start,o=m.size}const d=this.itemSizeCache.get(c)??o,h=s-d;if(h!==0){const m=this.options.anchorTo==="end"&&((r=this.scrollState)==null?void 0:r.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,p=m?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:c,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(c,s),this.itemSizeCacheVersion++,m?this.applyScrollAdjustment(this.getTotalSize()-p):g&&this.applyScrollAdjustment(h),this.notify(!1)}},this.getVirtualItems=u0(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,s)=>{const r=[];for(let i=0,o=n.length;i<o;i++){const a=n[i],c=s[a];r.push(c)}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=BG(0,s.length-1,i?a=>r[a*2]:a=>gP(s[a]).start,n);return gP(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,c=this.now();this.scrollState={index:n,align:a,behavior:r,startedAt:c,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&&(G5()&&(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&&l0e(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,c=Math.abs(r-this.getScrollOffset()),u=this.scrollState.behavior==="smooth"&&c>a;this.scrollState.lastTargetOffset=r,u||(this.scrollState.behavior="auto"),this._scrollToOffset(r,{adjustments:void 0,behavior:u?"smooth":"auto"})}this.scheduleScrollReconcile()}}const BG=(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 v0e({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 c=BG(0,i,o,n),u=c;if(s===1)for(;u<i&&a(u)<n+t;)u++;else if(s>1){const d=Array(s).fill(0);for(;u<i&&d.some(m=>m<n+t);){const m=e[u];d[m.lane]=m.end,u++}const h=Array(s).fill(n+t);for(;c>=0&&h.some(m=>m>=n);){const m=e[c];h[m.lane]=m.start,c--}c=Math.max(0,c-c%s),u=Math.min(i,u+(s-1-u%s))}return{startIndex:c,endIndex:u}}const K5=typeof document<"u"?f.useLayoutEffect:f.useEffect;function w0e({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n="transform",...s}){const r=f.useReducer(u=>u+1,0)[1],i=f.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});i.current.enabled=t,i.current.mode=n;const o=u=>{const d=i.current;if(!d.enabled)return;const h=u.getTotalSize();if(d.container&&h!==d.lastSize){d.lastSize=h;const x=u.options.horizontal?"width":"height";d.container.style[x]=`${h}px`}const m=!!u.options.horizontal,p=d.mode==="transform",g=m?"left":"top",b=u.options.scrollMargin,v=u.getVirtualItems();for(const x of v){const y=x.start-b,w=u.elementsCache.get(x.key);w&&d.lastPositions.get(w)!==y&&(d.lastPositions.set(w,y),p?w.style.transform=m?`translate3d(${y}px, 0, 0)`:`translate3d(0, ${y}px, 0)`:w.style[g]=`${y}px`)}},a={...s,onChange:(u,d)=>{var h;const m=i.current;let p=!0;if(m.enabled){o(u);const g=u.range,b=m.prevRange;p=!b||b.isScrolling!==u.isScrolling||b.startIndex!==(g==null?void 0:g.startIndex)||b.endIndex!==(g==null?void 0:g.endIndex),p&&(m.prevRange=g?{startIndex:g.startIndex,endIndex:g.endIndex,isScrolling:u.isScrolling}:null)}p&&(e&&d?ju.flushSync(r):r()),(h=s.onChange)==null||h.call(s,u,d)}},[c]=f.useState(()=>{const u=new x0e(a);return Object.assign(u,{containerRef:d=>{const h=i.current;if(h.container=d,h.lastSize=null,d&&h.enabled){const m=u.getTotalSize();h.lastSize=m;const p=u.options.horizontal?"width":"height";d.style[p]=`${m}px`}}})});return c.setOptions(a),K5(()=>c._didMount(),[]),K5(()=>c._willUpdate()),K5(()=>{o(c)}),c}function k0e(e){return w0e({observeElementRect:h0e,observeElementOffset:p0e,scrollToFn:y0e,...e})}function $G(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function _0e(e){var t;return((t=$G(e))==null?void 0:t.type)==="task_execution"}function L4(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||e.subTools||e.subContent||_0e(e.rawOutput)?!0:!!((n=e.args)!=null&&n.subagent_type)}function zG(e){if(!L4(e))return!1;const t=$G(e.rawOutput),n=e.toolName.toLowerCase(),s=e.args,r=n==="agent"&&e.parentToolCallId===void 0,i=r&&(s==null?void 0:s.run_in_background)===void 0&&(s==null?void 0:s.working_dir)===void 0&&(s==null?void 0:s.name)===void 0&&(typeof(s==null?void 0:s.subagent_type)!="string"||s.subagent_type.toLowerCase()!=="fork"),o=(s==null?void 0:s.run_in_background)===!0&&(n!=="agent"||r);return(t==null?void 0:t.status)==="background"||o||i}const FG=f.createContext({}),yP=FG.Provider;function Lu(){return f.useContext(FG)}const S0e=["en","zh-CN"],IN={"git.currentBranch":e=>`Current Git branch: ${(e==null?void 0:e.branch)??""}`,"git.detached":"Detached HEAD","git.clean":"Working tree clean","git.operation.merge":"Merging","git.operation.rebase":"Rebasing","git.operation.cherry-pick":"Cherry-picking","git.operation.revert":"Reverting","git.operation.bisect":"Bisecting","git.conflicted":e=>`${(e==null?void 0:e.count)??0} conflicted`,"git.staged":e=>`${(e==null?void 0:e.count)??0} staged`,"git.unstaged":e=>`${(e==null?void 0:e.count)??0} modified`,"git.untracked":e=>`${(e==null?void 0:e.count)??0} untracked`,"git.ahead":e=>`${(e==null?void 0:e.count)??0} ahead`,"git.behind":e=>`${(e==null?void 0:e.count)??0} behind`,"git.stash":e=>`${(e==null?void 0:e.count)??0} stashed`,"gitDiff.title":"Changes","gitDiff.summary":e=>`${(e==null?void 0:e.count)??0} files · +${(e==null?void 0:e.added)??0} −${(e==null?void 0:e.removed)??0}`,"gitDiff.loading":"Loading changes…","gitDiff.empty":"No changes in the working tree","gitDiff.unavailable":"Git is not available for this workspace","gitDiff.error":"Failed to load changes","gitDiff.binary":"Binary","gitDiff.untracked":"Untracked","gitDiff.deleted":"Deleted","gitDiff.noDiff":"No changes to display","gitDiff.fileError":"Failed to load this diff","gitDiff.truncated":"Diff truncated — the file is too large to show in full","gitDiff.hidden":e=>`${(e==null?void 0:e.count)??0} more file(s) not shown`,"gitDiff.expand":e=>`Show changes for ${(e==null?void 0:e.path)??"file"}`,"gitDiff.collapse":e=>`Hide changes for ${(e==null?void 0:e.path)??"file"}`,"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":"⊞","mermaid.zoomIn":"+","mermaid.zoomOut":"−","mermaid.zoomReset":"↺","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","history.loadingEarlier":"Loading earlier messages…","history.capacityReached":"History display limit reached. Earlier messages remain saved.","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...","editor.newSessionSuggestionTitle":"This looks like a new topic","editor.newSessionSuggestionStart":"Send in new session","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.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.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.addWorkspaceSuggestions":"Directory suggestions","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.goals":"Goals","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.waitingForApproval":"Waiting for approval","sidebar.userInputNeeded":"User input needed","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.","localCommand.diffNoWorkspace":"No workspace is available yet to show changes for.","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.add":"Add Extension","extensions.manage.checkingUpdates":"Checking for updates...","extensions.manage.checkUpdates":"Check 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.disable":"Disable Extension","extensions.manage.disabled":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" disabled.`,"extensions.manage.disabling":e=>`Disabling extension "${(e==null?void 0:e.name)??"extension"}"…`,"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.enabling":e=>`Enabling extension "${(e==null?void 0:e.name)??"extension"}"…`,"extensions.manage.install":"Install","extensions.manage.installDescription":"Enter a GitHub, Git, or npm extension source.","extensions.manage.installSelectPluginDescription":e=>`Choose a plugin from "${(e==null?void 0:e.marketplace)??"this marketplace"}".`,"extensions.manage.installType":"Install type:","extensions.manage.mcpServers":"MCP servers:","extensions.manage.marketplaceRoot":"Marketplace root","extensions.manage.name":"Name:","extensions.manage.notUpdatable":"not updatable","extensions.manage.operationFailed":"Extension operation failed.","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.refreshFailed":e=>`Extension action succeeded, but session refresh failed${e!=null&&e.error?`: ${e.error}`:"."}`,"extensions.manage.restartRequired":"updated; restart required","extensions.manage.search":"Search extensions…","extensions.manage.selectExtension":"Choose an extension","extensions.manage.settings":"Settings:","extensions.manage.skills":"Skills:","extensions.manage.source":"Source:","extensions.manage.sourcePlaceholder":"https://github.com/owner/repository","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.uninstalling":e=>`Uninstalling extension "${(e==null?void 0:e.name)??"extension"}"…`,"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.updatedWithWarnings":"updated with warnings","extensions.manage.updateStatus":"Update status:","extensions.manage.updating":"updating…","extensions.manage.updatingExtension":e=>`Updating extension "${(e==null?void 0:e.name)??"extension"}"…`,"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.action.approve":"Approve","mcp.actions":"Server actions","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.oauth.timeout":"Authentication timed out. Refresh to check the status.","mcp.oauth.authenticationFailed":"Authentication failed.","mcp.oauth.statusFailed":"Failed to check the authentication status.","mcp.oauth.serverRemoved":"The MCP server was removed during 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.descriptionTitle":"Description","mcp.basicInfo":"Basic Information","mcp.action.reconnect":"Reconnect","mcp.action.edit":"Edit","mcp.reconnect.skipped":e=>`Reconnect was not completed: ${(e==null?void 0:e.reason)??"unknown reason"}.`,"mcp.reconnect.authenticationRequired":"Authentication is required before reconnecting.","mcp.action.restart":"Restart","mcp.action.tools":"View tools","mcp.action.toolsHint":"Enter to inspect","mcp.empty":"No MCP servers configured.","mcp.emptyDescription":"Add an MCP server to manage it here.","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.add.button":"Add MCP Server","mcp.add.adding":"Adding MCP Server…","mcp.add.title":"Add MCP Server","mcp.add.description":"Save an MCP server to this workspace with a name and configuration.","mcp.add.name":"Name","mcp.add.serverDescription":"Description","mcp.add.serverDescriptionPlaceholder":"Describe this MCP server","mcp.add.scope":"Location","mcp.add.scope.global":"Global","mcp.add.nameRequired":"Enter an MCP server name.","mcp.add.config":"Configuration (JSON)","mcp.add.configInvalid":"Configuration must be a JSON object.","mcp.add.done":e=>`Added ${(e==null?void 0:e.name)??"MCP server"}.`,"mcp.edit.title":"Edit MCP Server","mcp.edit.description":"Update the description or configuration. Name and location cannot be changed.","mcp.edit.save":"Save Changes","mcp.edit.saving":"Saving Changes…","mcp.edit.done":e=>`Updated ${(e==null?void 0:e.name)??"MCP server"}.`,"mcp.edit.notFound":"The MCP server is no longer present in settings.","mcp.runtime.notUpdated":"Configuration was saved, but the current session was not updated.","mcp.runtime.removeNotUpdated":"Configuration was deleted, but the current session was not updated.","mcp.discovery.empty":"No MCP servers are configured.","mcp.discovery.initializing":"Initializing MCP servers…","mcp.discovery.timeout":"MCP discovery is taking longer than expected. Refresh to check again.","mcp.add.settingsUnavailable":"Workspace settings are unavailable.","mcp.action.remove":"Delete","mcp.remove.title":"Delete MCP Server","mcp.remove.description":e=>`Remove MCP server “${(e==null?void 0:e.name)??""}” from this workspace?`,"mcp.remove.description.global":e=>`Remove MCP server “${(e==null?void 0:e.name)??""}” from global settings?`,"mcp.remove.done":e=>`Deleted ${(e==null?void 0:e.name)??"MCP server"}.`,"mcp.remove.notWorkspace":"This MCP server is not defined in workspace settings.","mcp.source.all":"All","mcp.noSchema":"No input schema.","mcp.oauth.open":"Open authentication page","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.noResources":"No resources.","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":"Project MCP (.mcp.json)","mcp.source.workspace":"Workspace Settings","mcp.source.user":"Global Settings","mcp.status":"Status","mcp.status.blocked":"Blocked","mcp.status.authenticating":"Authenticating","mcp.status.needsApproval":"Needs approval","mcp.status.rejected":"Rejected","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 Protocol","mcp.use":"Use","mcp.userMcp":"Global 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`,"goals.title":"Goals","goals.subtitle":"A goal keeps its session working until the condition is met. Only sessions that are currently loaded appear here — a goal advances only while its session is running.","goals.loading":"Loading goals…","goals.count":e=>`${(e==null?void 0:e.count)??0} active ${Number(e==null?void 0:e.count)===1?"goal":"goals"}`,"goals.empty":"No active goals. Set one with /goal <condition>.","goals.refresh":"Refresh","goals.new":"New goal","goals.newHint":"The goal starts in a new session and runs until its condition holds.","goals.condition":"Condition","goals.conditionPlaceholder":"e.g. all tests pass and the lint is clean","goals.cancel":"Cancel","goals.create":"Set goal","goals.creating":"Starting…","goals.clear":"Clear goal","goals.clearConfirm":e=>`Clear the goal "${(e==null?void 0:e.condition)??""}"?`,"goals.running":"Working","goals.idle":"Waiting","goals.dropped":e=>`${(e==null?void 0:e.count)??0} session${Number(e==null?void 0:e.count)===1?"":"s"} could not be reached — any goals they are running are missing from this list.`,"goals.notYetEvaluated":"not yet evaluated","goals.openSessionHint":"Open this goal's session","goals.error.emptyCondition":"Enter a condition for the goal.","goals.error.clearKeyword":e=>`"${(e==null?void 0:e.word)??""}" clears a goal rather than setting one. Describe the condition to work toward.`,"goals.error.createFailed":"Failed to start the goal","goals.error.clearFailed":"Failed to clear the goal","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.actions":"Skill actions","skills.disable":"Disable","skills.disabled":"Skill disabled.","skills.enable":"Enable","skills.enabled":"Skill enabled.","skills.install.action":"Upload skill","skills.install.description":"Install a skill from GitHub, a local folder, or a ZIP archive.","skills.install.error.authentication":"Authentication is required to upload skills.","skills.install.error.folderRequired":"Enter a folder path.","skills.install.error.githubRequired":"Enter a GitHub SKILL.md URL.","skills.install.error.invalidName":"The skill name is missing or contains unsupported characters.","skills.install.error.manifestMissing":"The package must contain a SKILL.md file at its root.","skills.install.error.invalidPackage":"The skill package is invalid. Check its structure and SKILL.md content.","skills.install.error.zipTooLarge":"The ZIP file must not exceed 6 MB.","skills.install.error.invalidFolder":"Enter a valid local skill folder.","skills.install.error.githubFailed":"Could not download the skill from GitHub. Check the URL or authentication and try again.","skills.install.error.invalidScope":"Choose either the workspace or global install location.","skills.install.error.invalidSource":"The daemon does not recognize this upload source. Restart the updated daemon and try again.","skills.install.error.notFound":"The requested skill was not found.","skills.install.error.nameRequired":"Enter the skill name.","skills.install.error.untrusted":"Trust this workspace before uploading skills.","skills.install.failed":"Failed to upload skill.","skills.install.folder":"Local folder","skills.install.folderPath":"Folder path","skills.install.githubUrl":"SKILL.md URL","skills.install.name":"Skill name","skills.install.scope":"Install to","skills.install.scope.global":"Global","skills.install.scope.workspace":"Workspace","skills.install.selectZip":"Select a ZIP archive.","skills.install.title":"Upload skill","skills.install.succeeded":e=>`Skill “${(e==null?void 0:e.name)??""}” uploaded successfully.`,"skills.install.zipSelected":e=>`Selected: ${(e==null?void 0:e.name)??""}`,"skills.delete.action":"Delete skill","skills.delete.description":e=>`Delete “${(e==null?void 0:e.name)??""}” from disk? This cannot be undone.`,"skills.delete.failed":"Failed to delete skill.","skills.delete.succeeded":e=>`Skill “${(e==null?void 0:e.name)??""}” deleted successfully.`,"skills.delete.title":"Delete skill?","skills.empty":"No skills available.","skills.count":e=>[`${(e==null?void 0:e.count)??0} skills`,...e!=null&&e.enabled?[`${e.enabled} enabled`]:[],...e!=null&&e.disabled?[`${e.disabled} disabled`]:[]].join(", "),"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.status.all":"All","skills.filter.status.disabled":"Disabled","skills.filter.status.enabled":"Enabled","skills.filter.status.label":"Filter skills by status","skills.filter.user":"Global 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":"Global","skills.loading":"Loading skills...","skills.manualReference":"Manual reference","skills.manualReferenceHint":"The model cannot discover this skill automatically. Reference it manually.","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.notToggleable":"This skill cannot be enabled or disabled.","skills.run":"Reference skill","skills.search":"Search skills…","skills.status":"Status","skills.status.disabled":"disabled","skills.status.enabled":"enabled","skills.toggleFailed":"Failed to update skill.","skills.error.inactiveExtension":"This skill belongs to an inactive extension. Enable the extension first.","skills.toggleUnsupported":"The connected daemon does not support skill enable or disable actions.","skills.title":"Skills","plugins.extensions":"Extensions","plugins.agents":"Agents","plugins.mcp":"MCP","plugins.mcpLoadFailed":"Failed to load MCP status","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.provideInformation":"Provide information","toolGroup.summary.askedQuestions":e=>`Asked ${(e==null?void 0:e.count)??0} question${(e==null?void 0:e.count)===1?"":"s"}`,"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","thinking.translate":"Translate","thinking.translation":"Translated thinking","thinking.translating":"Translating...","thinking.translationThinking":"Thinking...","thinking.translationFailed":"Translation failed","thinking.retranslate":"Translate again","thinking.cancelTranslation":"Cancel","thinking.closeTranslation":"Close","thinking.inputTokens":e=>`Input tokens: ${(e==null?void 0:e.count)??"--"}`,"thinking.outputTokens":e=>`Output tokens: ${(e==null?void 0:e.count)??"--"}`,"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.maximizePane":"Maximize pane","splitView.restorePane":"Restore 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:"},C0e={...IN,"git.currentBranch":e=>`当前 Git 分支：${(e==null?void 0:e.branch)??""}`,"git.detached":"游离 HEAD","git.clean":"工作区干净","git.operation.merge":"合并中","git.operation.rebase":"变基中","git.operation.cherry-pick":"拣选中","git.operation.revert":"回退中","git.operation.bisect":"二分中","git.conflicted":e=>`${(e==null?void 0:e.count)??0} 个冲突`,"git.staged":e=>`${(e==null?void 0:e.count)??0} 已暂存`,"git.unstaged":e=>`${(e==null?void 0:e.count)??0} 已修改`,"git.untracked":e=>`${(e==null?void 0:e.count)??0} 未跟踪`,"git.ahead":e=>`领先 ${(e==null?void 0:e.count)??0}`,"git.behind":e=>`落后 ${(e==null?void 0:e.count)??0}`,"git.stash":e=>`${(e==null?void 0:e.count)??0} 个 stash`,"gitDiff.title":"变更","gitDiff.summary":e=>`${(e==null?void 0:e.count)??0} 个文件 · +${(e==null?void 0:e.added)??0} −${(e==null?void 0:e.removed)??0}`,"gitDiff.loading":"加载变更中…","gitDiff.empty":"工作区无变更","gitDiff.unavailable":"此工作区无 Git","gitDiff.error":"加载变更失败","gitDiff.binary":"二进制","gitDiff.untracked":"未跟踪","gitDiff.deleted":"已删除","gitDiff.noDiff":"无差异可显示","gitDiff.fileError":"加载此差异失败","gitDiff.truncated":"差异已截断——文件过大，未完整显示","gitDiff.hidden":e=>`还有 ${(e==null?void 0:e.count)??0} 个文件未显示`,"gitDiff.expand":e=>`显示 ${(e==null?void 0:e.path)??"文件"} 的变更`,"gitDiff.collapse":e=>`隐藏 ${(e==null?void 0:e.path)??"文件"} 的变更`,"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":"⊞","mermaid.zoomIn":"+","mermaid.zoomOut":"−","mermaid.zoomReset":"↺","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":"输入消息或 @ 文件路径","history.loadingEarlier":"正在加载更早消息…","history.capacityReached":"已达到历史显示上限，更早消息仍保存在会话中。","editor.shellPlaceholder":"请输入终端命令","editor.send":"发送消息","editor.connectionDisconnected":"连接已中断，请在恢复后重试。","editor.sessionLoading":"会话正在加载，请稍后再发送。","editor.processing":"处理中。新消息会进入队列。","editor.searchHint":"ctrl+r 下一条 · tab 采纳 · enter 发送 · esc 取消","editor.searchLabel":"历史搜索：","editor.searchPlaceholder":"输入以搜索…","editor.newSessionSuggestionTitle":"这条消息看起来像新话题","editor.newSessionSuggestionStart":"在新会话发送","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.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.workspaceUntrusted":"未信任","sidebar.workspaceReadOnly":"只读","sidebar.workspaceTrustToOpen":"信任此工作区后才能打开会话。","sidebar.addWorkspace":"添加工作区","sidebar.addWorkspaceTitle":"添加工作区","sidebar.addWorkspacePath":"目录路径","sidebar.addWorkspaceRegister":"注册","sidebar.addWorkspaceCancel":"取消","sidebar.addWorkspaceError":"添加工作区失败","sidebar.addWorkspacePersistenceError":"守护进程未确认工作区已持久化注册","sidebar.addWorkspaceAbsError":"路径必须是绝对路径","sidebar.addWorkspaceHint":"请输入项目目录的绝对路径。","sidebar.addWorkspaceSuggestions":"目录建议","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.goals":"目标","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.waitingForApproval":"等待批准","sidebar.userInputNeeded":"需要用户输入","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":"当前还没有会话。请先发送第一条消息，再使用这个命令。","localCommand.diffNoWorkspace":"当前还没有可用于查看变更的工作区。","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.add":"添加扩展","extensions.manage.checkingUpdates":"正在检查更新...","extensions.manage.checkUpdates":"检查更新","extensions.manage.commands":"命令：","extensions.manage.contextFiles":"上下文文件：","extensions.manage.count":e=>`已安装 ${(e==null?void 0:e.count)??0} 个扩展`,"extensions.manage.disable":"禁用扩展","extensions.manage.disabled":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已禁用。`,"extensions.manage.disabling":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.enabling":e=>`正在启用扩展 "${(e==null?void 0:e.name)??"扩展"}"…`,"extensions.manage.install":"安装","extensions.manage.installDescription":"输入 GitHub、Git 或 npm 扩展来源。","extensions.manage.installSelectPluginDescription":e=>`从「${(e==null?void 0:e.marketplace)??"此市场"}」中选择插件。`,"extensions.manage.installType":"安装类型：","extensions.manage.mcpServers":"MCP servers：","extensions.manage.marketplaceRoot":"此市场根目录","extensions.manage.name":"名称：","extensions.manage.notUpdatable":"不可更新","extensions.manage.operationFailed":"扩展操作失败。","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.refreshFailed":e=>`扩展操作已成功，但 session 刷新失败${e!=null&&e.error?`：${e.error}`:"。"}`,"extensions.manage.restartRequired":"已更新，需要重启","extensions.manage.search":"搜索扩展…","extensions.manage.selectExtension":"请选择扩展","extensions.manage.settings":"设置：","extensions.manage.skills":"Skills：","extensions.manage.source":"来源：","extensions.manage.sourcePlaceholder":"https://github.com/owner/repository","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.uninstalling":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.updatedWithWarnings":"已更新，但有警告","extensions.manage.updateStatus":"更新状态：","extensions.manage.updating":"正在更新…","extensions.manage.updatingExtension":e=>`正在更新扩展 "${(e==null?void 0:e.name)??"扩展"}"…`,"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.action.approve":"审批","mcp.actions":"服务器操作","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.oauth.timeout":"认证等待超时，请刷新后查看状态。","mcp.oauth.authenticationFailed":"认证失败。","mcp.oauth.statusFailed":"检查认证状态失败。","mcp.oauth.serverRemoved":"MCP 服务器已在认证期间被移除。","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.descriptionTitle":"描述","mcp.basicInfo":"基本信息","mcp.action.reconnect":"重新连接","mcp.action.edit":"编辑","mcp.reconnect.skipped":e=>`重新连接未完成：${(e==null?void 0:e.reason)??"未知原因"}。`,"mcp.reconnect.authenticationRequired":"请先完成认证，再重新连接。","mcp.action.restart":"重启","mcp.action.tools":"查看工具","mcp.action.toolsHint":"Enter 查看","mcp.empty":"未配置 MCP 服务器。","mcp.emptyDescription":"添加 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.add.button":"添加 MCP 服务器","mcp.add.adding":"正在添加 MCP 服务器…","mcp.add.title":"添加 MCP 服务器","mcp.add.description":"输入服务器名称和配置，并保存到当前工作区。","mcp.add.name":"名称","mcp.add.serverDescription":"描述","mcp.add.serverDescriptionPlaceholder":"描述这个 MCP 服务器","mcp.add.scope":"保存位置","mcp.add.scope.global":"全局","mcp.add.nameRequired":"请输入 MCP 服务器名称。","mcp.add.config":"配置（JSON）","mcp.add.configInvalid":"配置必须是 JSON 对象。","mcp.add.done":e=>`已添加 ${(e==null?void 0:e.name)??"MCP 服务器"}。`,"mcp.edit.title":"编辑 MCP 服务器","mcp.edit.description":"修改描述或配置。名称和保存位置不可修改。","mcp.edit.save":"保存修改","mcp.edit.saving":"正在保存修改…","mcp.edit.done":e=>`已更新 ${(e==null?void 0:e.name)??"MCP 服务器"}。`,"mcp.edit.notFound":"设置中已不存在该 MCP 服务器。","mcp.runtime.notUpdated":"配置已保存，但未同步当前会话。","mcp.runtime.removeNotUpdated":"配置已删除，但未同步当前会话。","mcp.discovery.empty":"尚未配置 MCP 服务器。","mcp.discovery.initializing":"正在初始化 MCP 服务器…","mcp.discovery.timeout":"MCP 发现耗时较长，请刷新后查看状态。","mcp.add.settingsUnavailable":"无法读取工作区设置。","mcp.action.remove":"删除","mcp.remove.title":"删除 MCP 服务器","mcp.remove.description":e=>`确定从当前工作区移除 MCP 服务器“${(e==null?void 0:e.name)??""}”吗？`,"mcp.remove.description.global":e=>`确定从全局设置中移除 MCP 服务器“${(e==null?void 0:e.name)??""}”吗？`,"mcp.remove.done":e=>`已删除 ${(e==null?void 0:e.name)??"MCP 服务器"}。`,"mcp.remove.notWorkspace":"此 MCP 服务器不在工作区设置中。","mcp.source.all":"全部","mcp.noSchema":"没有输入 schema。","mcp.oauth.open":"打开认证页面","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.noResources":"没有资源。","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（.mcp.json）","mcp.source.workspace":"工作区设置","mcp.source.user":"全局设置","mcp.status":"状态","mcp.status.blocked":"已阻止","mcp.status.authenticating":"认证中","mcp.status.needsApproval":"待审批","mcp.status.rejected":"已拒绝","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} 轮`,"goals.title":"目标","goals.subtitle":"目标会让所在会话持续工作，直到条件满足。这里只列出当前已加载的会话——目标只在会话运行时才会推进。","goals.loading":"正在加载目标…","goals.count":e=>`${(e==null?void 0:e.count)??0} 个进行中的目标`,"goals.empty":"没有进行中的目标。用 /goal <条件> 设置一个。","goals.refresh":"刷新","goals.new":"新建目标","goals.newHint":"目标会在一个新会话中启动，并持续运行直到条件满足。","goals.condition":"条件","goals.conditionPlaceholder":"例如：所有测试通过且 lint 无告警","goals.cancel":"取消","goals.create":"设置目标","goals.creating":"正在启动…","goals.clear":"清除目标","goals.clearConfirm":e=>`确定清除目标“${(e==null?void 0:e.condition)??""}”？`,"goals.running":"工作中","goals.idle":"等待中","goals.dropped":e=>`有 ${(e==null?void 0:e.count)??0} 个会话无法访问——它们正在运行的目标未显示在此列表中。`,"goals.notYetEvaluated":"尚未判定","goals.openSessionHint":"打开该目标所在的会话","goals.error.emptyCondition":"请输入目标条件。","goals.error.clearKeyword":e=>`“${(e==null?void 0:e.word)??""}”是清除目标的指令，不是一个条件。请描述要达成的条件。`,"goals.error.createFailed":"启动目标失败","goals.error.clearFailed":"清除目标失败","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.actions":"Skill 操作","skills.disable":"禁用","skills.disabled":"Skill 已禁用。","skills.enable":"启用","skills.enabled":"Skill 已启用。","skills.install.action":"上传技能","skills.install.description":"从 GitHub、本地文件夹或 ZIP 压缩包安装技能。","skills.install.error.authentication":"上传技能需要身份认证。","skills.install.error.folderRequired":"请输入文件夹路径。","skills.install.error.githubRequired":"请输入 GitHub SKILL.md 地址。","skills.install.error.invalidName":"技能名称缺失或包含不支持的字符。","skills.install.error.manifestMissing":"技能包根目录中必须包含 SKILL.md 文件。","skills.install.error.invalidPackage":"技能包无效，请检查目录结构和 SKILL.md 内容。","skills.install.error.zipTooLarge":"ZIP 文件不能超过 6 MB。","skills.install.error.invalidFolder":"请输入有效的本地技能文件夹路径。","skills.install.error.githubFailed":"无法从 GitHub 下载技能，请检查地址或认证信息后重试。","skills.install.error.invalidScope":"请选择工作区或全局安装位置。","skills.install.error.invalidSource":"当前 daemon 无法识别这种上传来源，请重启已更新的 daemon 后重试。","skills.install.error.notFound":"未找到指定的技能。","skills.install.error.nameRequired":"请输入技能名称。","skills.install.error.untrusted":"请先信任当前工作区，再上传技能。","skills.install.failed":"上传技能失败。","skills.install.folder":"本地文件夹","skills.install.folderPath":"文件夹路径","skills.install.githubUrl":"SKILL.md 地址","skills.install.name":"技能名称","skills.install.scope":"安装位置","skills.install.scope.global":"全局","skills.install.scope.workspace":"工作区","skills.install.selectZip":"请选择 ZIP 压缩包。","skills.install.title":"上传技能","skills.install.succeeded":e=>`技能“${(e==null?void 0:e.name)??""}”上传成功。`,"skills.install.zipSelected":e=>`已选择：${(e==null?void 0:e.name)??""}`,"skills.delete.action":"删除技能","skills.delete.description":e=>`确定从磁盘删除“${(e==null?void 0:e.name)??""}”吗？此操作无法撤销。`,"skills.delete.failed":"删除技能失败。","skills.delete.succeeded":e=>`技能“${(e==null?void 0:e.name)??""}”删除成功。`,"skills.delete.title":"删除技能？","skills.empty":"没有可用 skill。","skills.count":e=>[`${(e==null?void 0:e.count)??0} 个技能`,...e!=null&&e.enabled?[`已启用 ${e.enabled} 个`]:[],...e!=null&&e.disabled?[`已禁用 ${e.disabled} 个`]:[]].join("，"),"skills.details":"Skill 详情","skills.extension":"所属扩展","skills.filter.all":"全部","skills.filter.bundled":"内置","skills.filter.extension":"扩展","skills.filter.label":"按来源筛选 Skills","skills.filter.project":"工作区设置","skills.filter.status.all":"全部","skills.filter.status.disabled":"已禁用","skills.filter.status.enabled":"已启用","skills.filter.status.label":"按状态筛选技能","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.manualReference":"手动引用","skills.manualReferenceHint":"模型无法自动识别，需手动引用 skill","skills.model":"模型","skills.modelAccess":"模型调用","skills.modelAccess.disabled":"不可由模型调用","skills.modelAccess.enabled":"可由模型调用","skills.modelInvocable":"模型可用","skills.noDescription":"暂无描述","skills.noMatches":"没有匹配的 Skill。","skills.notToggleable":"此 Skill 不支持启用或禁用。","skills.run":"引用 skill","skills.search":"搜索 Skills…","skills.status":"状态","skills.status.disabled":"已禁用","skills.status.enabled":"已启用","skills.toggleFailed":"更新 Skill 失败。","skills.error.inactiveExtension":"该技能所属扩展当前未启用，请先启用对应扩展。","skills.toggleUnsupported":"当前连接的 daemon 不支持启用或禁用 Skill。","skills.title":"Skills","plugins.extensions":"扩展","plugins.agents":"智能体","plugins.mcp":"MCP","plugins.mcpLoadFailed":"MCP 状态加载失败","plugins.sections":"插件分类","plugins.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.provideInformation":"补充信息","toolGroup.summary.askedQuestions":e=>`已询问 ${(e==null?void 0:e.count)??0} 个问题`,"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}`:"思考完成","thinking.translate":"翻译","thinking.translation":"思考翻译","thinking.translating":"正在翻译…","thinking.translationThinking":"思考中…","thinking.translationFailed":"翻译失败","thinking.retranslate":"重新翻译","thinking.cancelTranslation":"取消","thinking.closeTranslation":"关闭","thinking.inputTokens":e=>`发送 Token：${(e==null?void 0:e.count)??"--"}`,"thinking.outputTokens":e=>`生成 Token：${(e==null?void 0:e.count)??"--"}`,"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.maximizePane":"最大化窗格","splitView.restorePane":"还原窗格","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":"提示："},T0e={en:IN,"zh-CN":C0e},E0e={en:"English [en]","zh-CN":"中文 [zh-CN]"},qG=f.createContext({language:"en",t:e=>e});function kd(e){const t=e==null?void 0:e.trim().toLowerCase();return t&&(t==="zh"||t==="zh-cn"||t==="zh_cn")?"zh-CN":"en"}function RN(e){if(typeof e!="string")return;const t=e.trim().toLowerCase().replace(/_/g,"-");if(t){if(t==="auto")return kd(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 DN(e){return E0e[e]}function LN(e){const t=T0e[e];return(n,s)=>{const r=t[n]??IN[n]??n;return typeof r=="function"?r(s):r}}function A0e({language:e,children:t}){const n=f.useMemo(()=>({language:e,t:LN(e)}),[e]);return l.jsx(qG.Provider,{value:n,children:t})}function ut(){return f.useContext(qG)}const HG=f.createContext(null);function Yd(){return f.useContext(HG)}const N0e="_row_19m4s_1",j0e="_tip_19m4s_13",M0e="_chatRow_19m4s_35",I0e="_chatTip_19m4s_43",R0e="_chatActions_19m4s_56",D0e="_copyButton_19m4s_71",ph={row:N0e,tip:j0e,chatRow:M0e,chatTip:I0e,chatActions:R0e,copyButton:D0e};function N7({timestamp:e,children:t,chatMode:n=!1,copyText:s,copyTitle:r="Copy"}){const[i,o]=f.useState(!1),a=f.useCallback(()=>{var u;s&&((u=navigator.clipboard)==null||u.writeText(s).then(()=>{o(!0),window.setTimeout(()=>o(!1),2e3)}).catch(()=>{}))},[s]);if(e===void 0&&!s)return l.jsx(l.Fragment,{children:t});const c=s?l.jsx("button",{type:"button",className:ph.copyButton,title:r,"aria-label":r,onClick:a,children:i?l.jsx(P0e,{}):l.jsx(L0e,{})}):null;return e===void 0?l.jsxs("div",{className:n?ph.chatRow:ph.row,children:[t,c]}):l.jsxs("div",{className:n?ph.chatRow:ph.row,children:[t,n?l.jsxs("span",{className:ph.chatActions,children:[l.jsx("span",{className:ph.chatTip,"aria-hidden":"true",children:Og(e)}),c]}):l.jsx("span",{className:ph.tip,"aria-hidden":"true",children:Og(e)})]})}function L0e(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.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"}),l.jsx("rect",{x:"3",y:"5.2",width:"7.8",height:"7.8",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]})}function P0e(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"m3.5 8.3 3 3L12.8 5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function Og(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 O0e="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",B0e="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",$0e="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",z0e="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",PN={extension:O0e,file:B0e,mcp:$0e,skill:z0e},F0e=new Set(Object.values(PN));function j7(e,t){if(!e||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return typeof n=="string"?n:void 0}function UG(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 Dp(e,t){if(e)return j7(t,e)??j7(PN,e)}function ON(e){return e!==void 0&&F0e.has(e)}function q0e(e,t){const n=[];let s=0;for(const r of t){const i=UG(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 H0e(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,c=r.reference;!c||typeof c.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:c.id,...c.kind?{kind:c.kind}:{},...c.label?{label:c.label}:{},...c.value?{value:c.value}:{},serialized:c.serialized??a,...c.removable!==void 0?{removable:c.removable}:{}}}),s=o)}return s<e.length&&n.push({type:"text",text:e.slice(s)}),n.length>0?n:[{type:"text",text:e}]}function U0e(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?j7(PN,e.kind):void 0)?"":n,tagValue:s,fallback:e.id,iconUrl:Dp(e.kind,t)}}const V0e="modulepreload",W0e=function(e){return"/"+e},xP={},ie=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(c=>{if(c=W0e(c),c in xP)return;xP[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":V0e,u||(h.as="script"),h.crossOrigin="",h.href=c,a&&h.setAttribute("nonce",a),document.head.appendChild(h),u)return new Promise((m,p)=>{h.addEventListener("load",m),h.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}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)})},$r={Dark:"dark",Light:"light"},VG=[$r.Dark,$r.Light],WG=f.createContext($r.Dark),G0e=WG.Provider;function w1(){return f.useContext(WG)}const qm="ui.theme",z_="general.language";function BN(e,t){return e===$r.Light||e==="Qwen Light"?$r.Light:e===$r.Dark||e==="Qwen Dark"?$r.Dark:t}function GG(e){return e===$r.Light?"Qwen Light":"Qwen Dark"}const KG=f.createContext("interactive");KG.Provider;function $N(){return f.useContext(KG)}function vP(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 YG(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const K0e=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Y0e=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,X0e={};function wP(e,t){return(X0e.jsx?Y0e:K0e).test(e)}const Q0e=/[ \t\n\f\r]/g;function P4(e){return typeof e=="object"?e.type==="text"?kP(e.value):!1:kP(e)}function kP(e){return e.replace(Q0e,"")===""}class pv{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}pv.prototype.normal={};pv.prototype.property={};pv.prototype.space=void 0;function XG(e,t){const n={},s={};for(const r of e)Object.assign(n,r.property),Object.assign(s,r.normal);return new pv(n,s,t)}function fx(e){return e.toLowerCase()}class Ga{constructor(t,n){this.attribute=n,this.property=t}}Ga.prototype.attribute="";Ga.prototype.booleanish=!1;Ga.prototype.boolean=!1;Ga.prototype.commaOrSpaceSeparated=!1;Ga.prototype.commaSeparated=!1;Ga.prototype.defined=!1;Ga.prototype.mustUseProperty=!1;Ga.prototype.number=!1;Ga.prototype.overloadedBoolean=!1;Ga.prototype.property="";Ga.prototype.spaceSeparated=!1;Ga.prototype.space=void 0;let J0e=0;const es=Lp(),Ai=Lp(),M7=Lp(),Ct=Lp(),Er=Lp(),np=Lp(),il=Lp();function Lp(){return 2**++J0e}const I7=Object.freeze(Object.defineProperty({__proto__:null,boolean:es,booleanish:Ai,commaOrSpaceSeparated:il,commaSeparated:np,number:Ct,overloadedBoolean:M7,spaceSeparated:Er},Symbol.toStringTag,{value:"Module"})),Y5=Object.keys(I7);class zN extends Ga{constructor(t,n,s,r){let i=-1;if(super(t,n),_P(this,"space",r),typeof s=="number")for(;++i<Y5.length;){const o=Y5[i];_P(this,Y5[i],(s&I7[o])===I7[o])}}}zN.prototype.defined=!0;function _P(e,t,n){n&&(e[t]=n)}function k1(e){const t={},n={};for(const[s,r]of Object.entries(e.properties)){const i=new zN(s,e.transform(e.attributes||{},s),r,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(i.mustUseProperty=!0),t[s]=i,n[fx(s)]=s,n[fx(i.attribute)]=s}return new pv(t,n,e.space)}const QG=k1({properties:{ariaActiveDescendant:null,ariaAtomic:Ai,ariaAutoComplete:null,ariaBusy:Ai,ariaChecked:Ai,ariaColCount:Ct,ariaColIndex:Ct,ariaColSpan:Ct,ariaControls:Er,ariaCurrent:null,ariaDescribedBy:Er,ariaDetails:null,ariaDisabled:Ai,ariaDropEffect:Er,ariaErrorMessage:null,ariaExpanded:Ai,ariaFlowTo:Er,ariaGrabbed:Ai,ariaHasPopup:null,ariaHidden:Ai,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Er,ariaLevel:Ct,ariaLive:null,ariaModal:Ai,ariaMultiLine:Ai,ariaMultiSelectable:Ai,ariaOrientation:null,ariaOwns:Er,ariaPlaceholder:null,ariaPosInSet:Ct,ariaPressed:Ai,ariaReadOnly:Ai,ariaRelevant:null,ariaRequired:Ai,ariaRoleDescription:Er,ariaRowCount:Ct,ariaRowIndex:Ct,ariaRowSpan:Ct,ariaSelected:Ai,ariaSetSize:Ct,ariaSort:null,ariaValueMax:Ct,ariaValueMin:Ct,ariaValueNow:Ct,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function JG(e,t){return t in e?e[t]:t}function ZG(e,t){return JG(e,t.toLowerCase())}const Z0e=k1({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:np,acceptCharset:Er,accessKey:Er,action:null,allow:null,allowFullScreen:es,allowPaymentRequest:es,allowUserMedia:es,alpha:es,alt:null,as:null,async:es,autoCapitalize:null,autoComplete:Er,autoFocus:es,autoPlay:es,blocking:Er,capture:null,charSet:null,checked:es,cite:null,className:Er,closedBy:null,colorSpace:null,cols:Ct,colSpan:Ct,command:null,commandFor:null,content:null,contentEditable:Ai,controls:es,controlsList:Er,coords:Ct|np,crossOrigin:null,data:null,dateTime:null,decoding:null,default:es,defer:es,dir:null,dirName:null,disabled:es,download:M7,draggable:Ai,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:es,formTarget:null,headers:Er,height:Ct,hidden:M7,high:Ct,href:null,hrefLang:null,htmlFor:Er,httpEquiv:Er,id:null,imageSizes:null,imageSrcSet:null,inert:es,inputMode:null,integrity:null,is:null,isMap:es,itemId:null,itemProp:Er,itemRef:Er,itemScope:es,itemType:Er,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:es,low:Ct,manifest:null,max:null,maxLength:Ct,media:null,method:null,min:null,minLength:Ct,multiple:es,muted:es,name:null,nonce:null,noModule:es,noValidate:es,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:es,optimum:Ct,pattern:null,ping:Er,placeholder:null,playsInline:es,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:es,referrerPolicy:null,rel:Er,required:es,reversed:es,rows:Ct,rowSpan:Ct,sandbox:Er,scope:null,scoped:es,seamless:es,selected:es,shadowRootClonable:es,shadowRootCustomElementRegistry:es,shadowRootDelegatesFocus:es,shadowRootMode:null,shadowRootSerializable:es,shape:null,size:Ct,sizes:null,slot:null,span:Ct,spellCheck:Ai,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ct,step:null,style:null,tabIndex:Ct,target:null,title:null,translate:null,type:null,typeMustMatch:es,useMap:null,value:Ai,width:Ct,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Er,axis:null,background:null,bgColor:null,border:Ct,borderColor:null,bottomMargin:Ct,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:es,declare:es,event:null,face:null,frame:null,frameBorder:null,hSpace:Ct,leftMargin:Ct,link:null,longDesc:null,lowSrc:null,marginHeight:Ct,marginWidth:Ct,noResize:es,noHref:es,noShade:es,noWrap:es,object:null,profile:null,prompt:null,rev:null,rightMargin:Ct,rules:null,scheme:null,scrolling:Ai,standby:null,summary:null,text:null,topMargin:Ct,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ct,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:es,disablePictureInPicture:es,disableRemotePlayback:es,exportParts:np,part:Er,prefix:null,property:null,results:Ct,security:null,unselectable:null},space:"html",transform:ZG}),ege=k1({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:il,accentHeight:Ct,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ct,amplitude:Ct,arabicForm:null,ascent:Ct,attributeName:null,attributeType:null,azimuth:Ct,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ct,by:null,calcMode:null,capHeight:Ct,className:Er,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:Ct,diffuseConstant:Ct,direction:null,display:null,dur:null,divisor:Ct,dominantBaseline:null,download:es,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ct,enableBackground:null,end:null,event:null,exponent:Ct,externalResourcesRequired:null,fill:null,fillOpacity:Ct,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:np,g2:np,glyphName:np,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ct,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ct,horizOriginX:Ct,horizOriginY:Ct,id:null,ideographic:Ct,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ct,k:Ct,k1:Ct,k2:Ct,k3:Ct,k4:Ct,kernelMatrix:il,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ct,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:Ct,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:Ct,overlineThickness:Ct,paintOrder:null,panose1:null,path:null,pathLength:Ct,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Er,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ct,pointsAtY:Ct,pointsAtZ:Ct,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:il,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:il,rev:il,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:il,requiredFeatures:il,requiredFonts:il,requiredFormats:il,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:Ct,specularExponent:Ct,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ct,strikethroughThickness:Ct,string:null,stroke:null,strokeDashArray:il,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ct,strokeOpacity:Ct,strokeWidth:null,style:null,surfaceScale:Ct,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:il,tabIndex:Ct,tableValues:null,target:null,targetX:Ct,targetY:Ct,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:il,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ct,underlineThickness:Ct,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ct,values:null,vAlphabetic:Ct,vMathematical:Ct,vectorEffect:null,vHanging:Ct,vIdeographic:Ct,version:null,vertAdvY:Ct,vertOriginX:Ct,vertOriginY:Ct,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ct,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:JG}),eK=k1({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()}}),tK=k1({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:ZG}),nK=k1({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),tge={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"},nge=/[A-Z]/g,SP=/-[a-z]/g,sge=/^data[-\w.:]+$/i;function FN(e,t){const n=fx(t);let s=t,r=Ga;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&sge.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(SP,ige);s="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!SP.test(i)){let o=i.replace(nge,rge);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}r=zN}return new r(s,t)}function rge(e){return"-"+e.toLowerCase()}function ige(e){return e.charAt(1).toUpperCase()}const qN=XG([QG,Z0e,eK,tK,nK],"html"),_1=XG([QG,ege,eK,tK,nK],"svg");function CP(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function sK(e){return e.join(" ").trim()}var HN={},TP=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,oge=/\n/g,age=/^\s*/,lge=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,cge=/^:\s*/,uge=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,dge=/^[;\s]*/,hge=/^\s+|\s+$/g,fge=`
`,EP="/",AP="*",Rm="",mge="comment",pge="declaration";function gge(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 b=g.match(oge);b&&(n+=b.length);var v=g.lastIndexOf(fge);s=~v?g.length-v:s+g.length}function i(){var g={line:n,column:s};return function(b){return b.position=new o(g),u(),b}}function o(g){this.start=g,this.end={line:n,column:s},this.source=t.source}o.prototype.content=e;function a(g){var b=new Error(t.source+":"+n+":"+s+": "+g);if(b.reason=g,b.filename=t.source,b.line=n,b.column=s,b.source=e,!t.silent)throw b}function c(g){var b=g.exec(e);if(b){var v=b[0];return r(v),e=e.slice(v.length),b}}function u(){c(age)}function d(g){var b;for(g=g||[];b=h();)b!==!1&&g.push(b);return g}function h(){var g=i();if(!(EP!=e.charAt(0)||AP!=e.charAt(1))){for(var b=2;Rm!=e.charAt(b)&&(AP!=e.charAt(b)||EP!=e.charAt(b+1));)++b;if(b+=2,Rm===e.charAt(b-1))return a("End of comment missing");var v=e.slice(2,b-2);return s+=2,r(v),e=e.slice(b),s+=2,g({type:mge,comment:v})}}function m(){var g=i(),b=c(lge);if(b){if(h(),!c(cge))return a("property missing ':'");var v=c(uge),x=g({type:pge,property:NP(b[0].replace(TP,Rm)),value:v?NP(v[0].replace(TP,Rm)):Rm});return c(dge),x}}function p(){var g=[];d(g);for(var b;b=m();)b!==!1&&(g.push(b),d(g));return g}return u(),p()}function NP(e){return e?e.replace(hge,Rm):Rm}var bge=gge,yge=s_&&s_.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(HN,"__esModule",{value:!0});HN.default=vge;const xge=yge(bge);function vge(e,t){let n=null;if(!e||typeof e!="string")return n;const s=(0,xge.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 O4={};Object.defineProperty(O4,"__esModule",{value:!0});O4.camelCase=void 0;var wge=/^--[a-zA-Z0-9_-]+$/,kge=/-([a-z])/g,_ge=/^[^-]+$/,Sge=/^-(webkit|moz|ms|o|khtml)-/,Cge=/^-(ms)-/,Tge=function(e){return!e||_ge.test(e)||wge.test(e)},Ege=function(e,t){return t.toUpperCase()},jP=function(e,t){return"".concat(t,"-")},Age=function(e,t){return t===void 0&&(t={}),Tge(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(Cge,jP):e=e.replace(Sge,jP),e.replace(kge,Ege))};O4.camelCase=Age;var Nge=s_&&s_.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},jge=Nge(HN),Mge=O4;function R7(e,t){var n={};return!e||typeof e!="string"||(0,jge.default)(e,function(s,r){s&&r&&(n[(0,Mge.camelCase)(s,t)]=r)}),n}R7.default=R7;var Ige=R7;const Rge=l4(Ige),rK=iK("end"),UN=iK("start");function iK(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 Dge(e){const t=UN(e),n=rK(e);if(t&&n)return{start:t,end:n}}function Ry(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?MP(e.position):"start"in e||"end"in e?MP(e):"line"in e||"column"in e?D7(e):""}function D7(e){return IP(e&&e.line)+":"+IP(e&&e.column)}function MP(e){return D7(e&&e.start)+"-"+D7(e&&e.end)}function IP(e){return e&&typeof e=="number"?e:1}class Wo 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 c=s.indexOf(":");c===-1?i.ruleId=s:(i.source=s.slice(0,c),i.ruleId=s.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.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=Ry(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}}Wo.prototype.file="";Wo.prototype.name="";Wo.prototype.reason="";Wo.prototype.message="";Wo.prototype.stack="";Wo.prototype.column=void 0;Wo.prototype.line=void 0;Wo.prototype.ancestors=void 0;Wo.prototype.cause=void 0;Wo.prototype.fatal=void 0;Wo.prototype.place=void 0;Wo.prototype.ruleId=void 0;Wo.prototype.source=void 0;const VN={}.hasOwnProperty,Lge=new Map,Pge=/[A-Z]/g,Oge=new Set(["table","tbody","thead","tfoot","tr"]),Bge=new Set(["td","th"]),oK="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function $ge(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=Gge(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=Wge(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"?_1:qN,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=aK(r,e,void 0);return i&&typeof i!="string"?i:r.create(e,r.Fragment,{children:i||void 0},void 0)}function aK(e,t,n){if(t.type==="element")return zge(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Fge(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Hge(e,t,n);if(t.type==="mdxjsEsm")return qge(e,t);if(t.type==="root")return Uge(e,t,n);if(t.type==="text")return Vge(e,t)}function zge(e,t,n){const s=e.schema;let r=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(r=_1,e.schema=r),e.ancestors.push(t);const i=cK(e,t.tagName,!1),o=Kge(e,t);let a=GN(e,t);return Oge.has(t.tagName)&&(a=a.filter(function(c){return typeof c=="string"?!P4(c):!0})),lK(e,o,i,t),WN(o,a),e.ancestors.pop(),e.schema=s,e.create(t,i,o,n)}function Fge(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)}mx(e,t.position)}function qge(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);mx(e,t.position)}function Hge(e,t,n){const s=e.schema;let r=s;t.name==="svg"&&s.space==="html"&&(r=_1,e.schema=r),e.ancestors.push(t);const i=t.name===null?e.Fragment:cK(e,t.name,!0),o=Yge(e,t),a=GN(e,t);return lK(e,o,i,t),WN(o,a),e.ancestors.pop(),e.schema=s,e.create(t,i,o,n)}function Uge(e,t,n){const s={};return WN(s,GN(e,t)),e.create(t,e.Fragment,s,n)}function Vge(e,t){return t.value}function lK(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function WN(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Wge(e,t,n){return s;function s(r,i,o,a){const u=Array.isArray(o.children)?n:t;return a?u(i,o,a):u(i,o)}}function Gge(e,t){return n;function n(s,r,i,o){const a=Array.isArray(i.children),c=UN(s);return t(r,i,o,a,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function Kge(e,t){const n={};let s,r;for(r in t.properties)if(r!=="children"&&VN.call(t.properties,r)){const i=Xge(e,r,t.properties[r]);if(i){const[o,a]=i;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&Bge.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 Yge(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 mx(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 mx(e,t.position);else i=s.value===null?!0:s.value;n[r]=i}return n}function GN(e,t){const n=[];let s=-1;const r=e.passKeys?new Map:Lge;for(;++s<t.children.length;){const i=t.children[s];let o;if(e.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const u=r.get(c)||0;o=c+"-"+u,r.set(c,u+1)}}const a=aK(e,i,o);a!==void 0&&n.push(a)}return n}function Xge(e,t,n){const s=FN(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?YG(n):sK(n)),s.property==="style"){let r=typeof n=="object"?n:Qge(e,String(n));return e.stylePropertyNameCase==="css"&&(r=Jge(r)),["style",r]}return[e.elementAttributeNameCase==="react"&&s.space?tge[s.property]||s.property:s.attribute,n]}}function Qge(e,t){try{return Rge(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,r=new Wo("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=oK+"#cannot-parse-style-attribute",r}}function cK(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=wP(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=wP(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const r=s.value;return VN.call(e.components,r)?e.components[r]:r}if(e.evaluater)return e.evaluater.evaluateExpression(s);mx(e)}function mx(e,t){const n=new Wo("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=oK+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Jge(e){const t={};let n;for(n in e)VN.call(e,n)&&(t[Zge(n)]=e[n]);return t}function Zge(e){let t=e.replace(Pge,e1e);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function e1e(e){return"-"+e.toLowerCase()}const X5={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"]},t1e={};function KN(e,t){const n=t1e,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,r=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return uK(e,s,r)}function uK(e,t,n){if(n1e(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 RP(e.children,t,n)}return Array.isArray(e)?RP(e,t,n):""}function RP(e,t,n){const s=[];let r=-1;for(;++r<e.length;)s[r]=uK(e[r],t,n);return s.join("")}function n1e(e){return!!(e&&typeof e=="object")}const DP=document.createElement("i");function YN(e){const t="&"+e+";";DP.innerHTML=t;const n=DP.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function yl(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 Vl(e,t){return e.length>0?(yl(e,e.length,0,t),e):t}const LP={}.hasOwnProperty;function dK(e){const t={};let n=-1;for(;++n<e.length;)s1e(t,e[n]);return t}function s1e(e,t){let n;for(n in t){const r=(LP.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){LP.call(r,o)||(r[o]=[]);const a=i[o];r1e(r[o],Array.isArray(a)?a:a?[a]:[])}}}function r1e(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);yl(e,0,0,s)}function hK(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 Cc(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const da=Vf(/[A-Za-z]/),qo=Vf(/[\dA-Za-z]/),i1e=Vf(/[#-'*+\--9=?A-Z^-~]/);function F_(e){return e!==null&&(e<32||e===127)}const L7=Vf(/\d/),o1e=Vf(/[\dA-Fa-f]/),a1e=Vf(/[!-/:-@[-`{-~]/);function Nn(e){return e!==null&&e<-2}function Rr(e){return e!==null&&(e<0||e===32)}function Is(e){return e===-2||e===-1||e===32}const B4=Vf(new RegExp("\\p{P}|\\p{S}","u")),hp=Vf(/\s/);function Vf(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function S1(e){const t=[];let n=-1,s=0,r=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&qo(e.charCodeAt(n+1))&&qo(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 Es(e,t,n,s){const r=s?s-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(c){return Is(c)?(e.enter(n),a(c)):t(c)}function a(c){return Is(c)&&i++<r?(e.consume(c),a):(e.exit(n),t(c))}}const l1e={tokenize:c1e};function c1e(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"),Es(e,t,"linePrefix")}function r(a){return e.enter("paragraph"),i(a)}function i(a){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,o(a)}function o(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return Nn(a)?(e.consume(a),e.exit("chunkText"),i):(e.consume(a),o)}}const u1e={tokenize:d1e},PP={tokenize:h1e};function d1e(e){const t=this,n=[];let s=0,r,i,o;return a;function a(w){if(s<n.length){const k=n[s];return t.containerState=k[1],e.attempt(k[0].continuation,c,u)(w)}return u(w)}function c(w){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,r&&y();const k=t.events.length;let T=k,S;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){S=t.events[T][1].end;break}x(s);let C=k;for(;C<t.events.length;)t.events[C][1].end={...S},C++;return yl(t.events,T+1,0,t.events.slice(k)),t.events.length=C,u(w)}return a(w)}function u(w){if(s===n.length){if(!r)return m(w);if(r.currentConstruct&&r.currentConstruct.concrete)return g(w);t.interrupt=!!(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(PP,d,h)(w)}function d(w){return r&&y(),x(s),m(w)}function h(w){return t.parser.lazy[t.now().line]=s!==n.length,o=t.now().offset,g(w)}function m(w){return t.containerState={},e.attempt(PP,p,g)(w)}function p(w){return s++,n.push([t.currentConstruct,t.containerState]),m(w)}function g(w){if(w===null){r&&y(),x(0),e.consume(w);return}return r=r||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:r,contentType:"flow",previous:i}),b(w)}function b(w){if(w===null){v(e.exit("chunkFlow"),!0),x(0),e.consume(w);return}return Nn(w)?(e.consume(w),v(e.exit("chunkFlow")),s=0,t.interrupt=void 0,a):(e.consume(w),b)}function v(w,k){const T=t.sliceStream(w);if(k&&T.push(null),w.previous=i,i&&(i.next=w),i=w,r.defineSkip(w.start),r.write(T),t.parser.lazy[w.start.line]){let S=r.events.length;for(;S--;)if(r.events[S][1].start.offset<o&&(!r.events[S][1].end||r.events[S][1].end.offset>o))return;const C=t.events.length;let _=C,B,A;for(;_--;)if(t.events[_][0]==="exit"&&t.events[_][1].type==="chunkFlow"){if(B){A=t.events[_][1].end;break}B=!0}for(x(s),S=C;S<t.events.length;)t.events[S][1].end={...A},S++;yl(t.events,_+1,0,t.events.slice(C)),t.events.length=S}}function x(w){let k=n.length;for(;k-- >w;){const T=n[k];t.containerState=T[1],T[0].exit.call(t,e)}n.length=w}function y(){r.write([null]),i=void 0,r=void 0,t.containerState._closeFlow=void 0}}function h1e(e,t,n){return Es(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Bg(e){if(e===null||Rr(e)||hp(e))return 1;if(B4(e))return 2}function $4(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 P7={name:"attention",resolveAll:f1e,tokenize:m1e};function f1e(e,t){let n=-1,s,r,i,o,a,c,u,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;c=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},m={...e[n][1].start};OP(h,-c),OP(m,c),o={type:c>1?"strongSequence":"emphasisSequence",start:h,end:{...e[s][1].end}},a={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:m},i={type:c>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},r={type:c>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[s][1].end={...o.start},e[n][1].start={...a.end},u=[],e[s][1].end.offset-e[s][1].start.offset&&(u=Vl(u,[["enter",e[s][1],t],["exit",e[s][1],t]])),u=Vl(u,[["enter",r,t],["enter",o,t],["exit",o,t],["enter",i,t]]),u=Vl(u,$4(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),u=Vl(u,[["exit",i,t],["enter",a,t],["exit",a,t],["exit",r,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=Vl(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,yl(e,s-1,n-s+3,u),n=s+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function m1e(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,r=Bg(s);let i;return o;function o(c){return i=c,e.enter("attentionSequence"),a(c)}function a(c){if(c===i)return e.consume(c),a;const u=e.exit("attentionSequence"),d=Bg(c),h=!d||d===2&&r||n.includes(c),m=!r||r===2&&d||n.includes(s);return u._open=!!(i===42?h:h&&(r||!m)),u._close=!!(i===42?m:m&&(d||!h)),t(c)}}function OP(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const p1e={name:"autolink",tokenize:g1e};function g1e(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 da(p)?(e.consume(p),o):p===64?n(p):u(p)}function o(p){return p===43||p===45||p===46||qo(p)?(s=1,a(p)):u(p)}function a(p){return p===58?(e.consume(p),s=0,c):(p===43||p===45||p===46||qo(p))&&s++<32?(e.consume(p),a):(s=0,u(p))}function c(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||F_(p)?n(p):(e.consume(p),c)}function u(p){return p===64?(e.consume(p),d):i1e(p)?(e.consume(p),u):n(p)}function d(p){return qo(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):m(p)}function m(p){if((p===45||qo(p))&&s++<63){const g=p===45?m:h;return e.consume(p),g}return n(p)}}const gv={partial:!0,tokenize:b1e};function b1e(e,t,n){return s;function s(i){return Is(i)?Es(e,r,"linePrefix")(i):r(i)}function r(i){return i===null||Nn(i)?t(i):n(i)}}const fK={continuation:{tokenize:x1e},exit:v1e,name:"blockQuote",tokenize:y1e};function y1e(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 Is(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function x1e(e,t,n){const s=this;return r;function r(o){return Is(o)?Es(e,i,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(fK,t,n)(o)}}function v1e(e){e.exit("blockQuote")}const mK={name:"characterEscape",tokenize:w1e};function w1e(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 a1e(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const pK={name:"characterReference",tokenize:k1e};function k1e(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"),c}function c(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,o=qo,d(h))}function u(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=o1e,d):(e.enter("characterReferenceValue"),i=7,o=L7,d(h))}function d(h){if(h===59&&r){const m=e.exit("characterReferenceValue");return o===qo&&!YN(s.sliceSerialize(m))?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 BP={partial:!0,tokenize:S1e},$P={concrete:!0,name:"codeFenced",tokenize:_1e};function _1e(e,t,n){const s=this,r={partial:!0,tokenize:T};let i=0,o=0,a;return c;function c(S){return u(S)}function u(S){const C=s.events[s.events.length-1];return i=C&&C[1].type==="linePrefix"?C[2].sliceSerialize(C[1],!0).length:0,a=S,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(S)}function d(S){return S===a?(o++,e.consume(S),d):o<3?n(S):(e.exit("codeFencedFenceSequence"),Is(S)?Es(e,h,"whitespace")(S):h(S))}function h(S){return S===null||Nn(S)?(e.exit("codeFencedFence"),s.interrupt?t(S):e.check(BP,b,k)(S)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(S))}function m(S){return S===null||Nn(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(S)):Is(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Es(e,p,"whitespace")(S)):S===96&&S===a?n(S):(e.consume(S),m)}function p(S){return S===null||Nn(S)?h(S):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(S))}function g(S){return S===null||Nn(S)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(S)):S===96&&S===a?n(S):(e.consume(S),g)}function b(S){return e.attempt(r,k,v)(S)}function v(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),x}function x(S){return i>0&&Is(S)?Es(e,y,"linePrefix",i+1)(S):y(S)}function y(S){return S===null||Nn(S)?e.check(BP,b,k)(S):(e.enter("codeFlowValue"),w(S))}function w(S){return S===null||Nn(S)?(e.exit("codeFlowValue"),y(S)):(e.consume(S),w)}function k(S){return e.exit("codeFenced"),t(S)}function T(S,C,_){let B=0;return A;function A(O){return S.enter("lineEnding"),S.consume(O),S.exit("lineEnding"),N}function N(O){return S.enter("codeFencedFence"),Is(O)?Es(S,j,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):j(O)}function j(O){return O===a?(S.enter("codeFencedFenceSequence"),P(O)):_(O)}function P(O){return O===a?(B++,S.consume(O),P):B>=o?(S.exit("codeFencedFenceSequence"),Is(O)?Es(S,L,"whitespace")(O):L(O)):_(O)}function L(O){return O===null||Nn(O)?(S.exit("codeFencedFence"),C(O)):_(O)}}}function S1e(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 Q5={name:"codeIndented",tokenize:T1e},C1e={partial:!0,tokenize:E1e};function T1e(e,t,n){const s=this;return r;function r(u){return e.enter("codeIndented"),Es(e,i,"linePrefix",5)(u)}function i(u){const d=s.events[s.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?c(u):Nn(u)?e.attempt(C1e,o,c)(u):(e.enter("codeFlowValue"),a(u))}function a(u){return u===null||Nn(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),a)}function c(u){return e.exit("codeIndented"),t(u)}}function E1e(e,t,n){const s=this;return r;function r(o){return s.parser.lazy[s.now().line]?n(o):Nn(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),r):Es(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):Nn(o)?r(o):n(o)}}const A1e={name:"codeText",previous:j1e,resolve:N1e,tokenize:M1e};function N1e(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 j1e(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function M1e(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"),c(h))}function c(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),c):h===96?(i=e.enter("codeTextSequence"),r=0,d(h)):Nn(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(h))}function u(h){return h===null||h===32||h===96||Nn(h)?(e.exit("codeTextData"),c(h)):(e.consume(h),u)}function d(h){return h===96?(e.consume(h),r++,d):r===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(i.type="codeTextData",u(h))}}class I1e{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&&Eb(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),Eb(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Eb(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);Eb(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Eb(this.left,n.reverse())}}}function Eb(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 gK(e){const t={};let n=-1,s,r,i,o,a,c,u;const d=new I1e(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"&&(c=s[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,R1e(d,n)),n=t[n],u=!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 yl(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function R1e(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,c=[],u={};let d,h,m=-1,p=n,g=0,b=0;const v=[b];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;++m<a.length;)a[m][0]==="exit"&&a[m-1][0]==="enter"&&a[m][1].type===a[m-1][1].type&&a[m][1].start.line!==a[m][1].end.line&&(b=m+1,v.push(b),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):v.pop(),m=v.length;m--;){const x=a.slice(v[m],v[m+1]),y=i.pop();c.push([y,y+x.length-1]),e.splice(y,2,x)}for(c.reverse(),m=-1;++m<c.length;)u[g+c[m][0]]=g+c[m][1],g+=c[m][1]-c[m][0]-1;return u}const D1e={resolve:P1e,tokenize:O1e},L1e={partial:!0,tokenize:B1e};function P1e(e){return gK(e),e}function O1e(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):Nn(a)?e.check(L1e,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 B1e(e,t,n){const s=this;return r;function r(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Es(e,i,"linePrefix")}function i(o){if(o===null||Nn(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 bK(e,t,n,s,r,i,o,a,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return h;function h(x){return x===60?(e.enter(s),e.enter(r),e.enter(i),e.consume(x),e.exit(i),m):x===null||x===32||x===41||F_(x)?n(x):(e.enter(s),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),b(x))}function m(x){return x===62?(e.enter(i),e.consume(x),e.exit(i),e.exit(r),e.exit(s),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(x))}function p(x){return x===62?(e.exit("chunkString"),e.exit(a),m(x)):x===null||x===60||Nn(x)?n(x):(e.consume(x),x===92?g:p)}function g(x){return x===60||x===62||x===92?(e.consume(x),p):p(x)}function b(x){return!d&&(x===null||x===41||Rr(x))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(s),t(x)):d<u&&x===40?(e.consume(x),d++,b):x===41?(e.consume(x),d--,b):x===null||x===32||x===40||F_(x)?n(x):(e.consume(x),x===92?v:b)}function v(x){return x===40||x===41||x===92?(e.consume(x),b):b(x)}}function yK(e,t,n,s,r,i){const o=this;let a=0,c;return u;function u(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&&!c||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):Nn(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||Nn(p)||a++>999?(e.exit("chunkString"),d(p)):(e.consume(p),c||(c=!Is(p)),p===92?m:h)}function m(p){return p===91||p===92||p===93?(e.consume(p),a++,h):h(p)}}function xK(e,t,n,s,r,i){let o;return a;function a(m){return m===34||m===39||m===40?(e.enter(s),e.enter(r),e.consume(m),e.exit(r),o=m===40?41:m,c):n(m)}function c(m){return m===o?(e.enter(r),e.consume(m),e.exit(r),e.exit(s),t):(e.enter(i),u(m))}function u(m){return m===o?(e.exit(i),c(o)):m===null?n(m):Nn(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),Es(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===o||m===null||Nn(m)?(e.exit("chunkString"),u(m)):(e.consume(m),m===92?h:d)}function h(m){return m===o||m===92?(e.consume(m),d):d(m)}}function Dy(e,t){let n;return s;function s(r){return Nn(r)?(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),n=!0,s):Is(r)?Es(e,s,n?"linePrefix":"lineSuffix")(r):t(r)}}const $1e={name:"definition",tokenize:F1e},z1e={partial:!0,tokenize:q1e};function F1e(e,t,n){const s=this;let r;return i;function i(p){return e.enter("definition"),o(p)}function o(p){return yK.call(s,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return r=Cc(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),c):n(p)}function c(p){return Rr(p)?Dy(e,u)(p):u(p)}function u(p){return bK(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(z1e,h,h)(p)}function h(p){return Is(p)?Es(e,m,"whitespace")(p):m(p)}function m(p){return p===null||Nn(p)?(e.exit("definition"),s.parser.defined.push(r),t(p)):n(p)}}function q1e(e,t,n){return s;function s(a){return Rr(a)?Dy(e,r)(a):n(a)}function r(a){return xK(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return Is(a)?Es(e,o,"whitespace")(a):o(a)}function o(a){return a===null||Nn(a)?t(a):n(a)}}const H1e={name:"hardBreakEscape",tokenize:U1e};function U1e(e,t,n){return s;function s(i){return e.enter("hardBreakEscape"),e.consume(i),r}function r(i){return Nn(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const V1e={name:"headingAtx",resolve:W1e,tokenize:G1e};function W1e(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"},yl(e,s,n-s+1,[["enter",r,t],["enter",i,t],["exit",i,t],["exit",r,t]])),e}function G1e(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||Rr(d)?(e.exit("atxHeadingSequence"),a(d)):n(d)}function a(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||Nn(d)?(e.exit("atxHeading"),t(d)):Is(d)?Es(e,a,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),a(d))}function u(d){return d===null||d===35||Rr(d)?(e.exit("atxHeadingText"),a(d)):(e.consume(d),u)}}const K1e=["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"],zP=["pre","script","style","textarea"],Y1e={concrete:!0,name:"htmlFlow",resolveTo:J1e,tokenize:Z1e},X1e={partial:!0,tokenize:tbe},Q1e={partial:!0,tokenize:ebe};function J1e(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 Z1e(e,t,n){const s=this;let r,i,o,a,c;return u;function u(M){return d(M)}function d(M){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(M),h}function h(M){return M===33?(e.consume(M),m):M===47?(e.consume(M),i=!0,b):M===63?(e.consume(M),r=3,s.interrupt?t:I):da(M)?(e.consume(M),o=String.fromCharCode(M),v):n(M)}function m(M){return M===45?(e.consume(M),r=2,p):M===91?(e.consume(M),r=5,a=0,g):da(M)?(e.consume(M),r=4,s.interrupt?t:I):n(M)}function p(M){return M===45?(e.consume(M),s.interrupt?t:I):n(M)}function g(M){const re="CDATA[";return M===re.charCodeAt(a++)?(e.consume(M),a===re.length?s.interrupt?t:j:g):n(M)}function b(M){return da(M)?(e.consume(M),o=String.fromCharCode(M),v):n(M)}function v(M){if(M===null||M===47||M===62||Rr(M)){const re=M===47,se=o.toLowerCase();return!re&&!i&&zP.includes(se)?(r=1,s.interrupt?t(M):j(M)):K1e.includes(o.toLowerCase())?(r=6,re?(e.consume(M),x):s.interrupt?t(M):j(M)):(r=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(M):i?y(M):w(M))}return M===45||qo(M)?(e.consume(M),o+=String.fromCharCode(M),v):n(M)}function x(M){return M===62?(e.consume(M),s.interrupt?t:j):n(M)}function y(M){return Is(M)?(e.consume(M),y):A(M)}function w(M){return M===47?(e.consume(M),A):M===58||M===95||da(M)?(e.consume(M),k):Is(M)?(e.consume(M),w):A(M)}function k(M){return M===45||M===46||M===58||M===95||qo(M)?(e.consume(M),k):T(M)}function T(M){return M===61?(e.consume(M),S):Is(M)?(e.consume(M),T):w(M)}function S(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),c=M,C):Is(M)?(e.consume(M),S):_(M)}function C(M){return M===c?(e.consume(M),c=null,B):M===null||Nn(M)?n(M):(e.consume(M),C)}function _(M){return M===null||M===34||M===39||M===47||M===60||M===61||M===62||M===96||Rr(M)?T(M):(e.consume(M),_)}function B(M){return M===47||M===62||Is(M)?w(M):n(M)}function A(M){return M===62?(e.consume(M),N):n(M)}function N(M){return M===null||Nn(M)?j(M):Is(M)?(e.consume(M),N):n(M)}function j(M){return M===45&&r===2?(e.consume(M),$):M===60&&r===1?(e.consume(M),z):M===62&&r===4?(e.consume(M),Q):M===63&&r===3?(e.consume(M),I):M===93&&r===5?(e.consume(M),G):Nn(M)&&(r===6||r===7)?(e.exit("htmlFlowData"),e.check(X1e,V,P)(M)):M===null||Nn(M)?(e.exit("htmlFlowData"),P(M)):(e.consume(M),j)}function P(M){return e.check(Q1e,L,V)(M)}function L(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),O}function O(M){return M===null||Nn(M)?P(M):(e.enter("htmlFlowData"),j(M))}function $(M){return M===45?(e.consume(M),I):j(M)}function z(M){return M===47?(e.consume(M),o="",F):j(M)}function F(M){if(M===62){const re=o.toLowerCase();return zP.includes(re)?(e.consume(M),Q):j(M)}return da(M)&&o.length<8?(e.consume(M),o+=String.fromCharCode(M),F):j(M)}function G(M){return M===93?(e.consume(M),I):j(M)}function I(M){return M===62?(e.consume(M),Q):M===45&&r===2?(e.consume(M),I):j(M)}function Q(M){return M===null||Nn(M)?(e.exit("htmlFlowData"),V(M)):(e.consume(M),Q)}function V(M){return e.exit("htmlFlow"),t(M)}}function ebe(e,t,n){const s=this;return r;function r(o){return Nn(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 tbe(e,t,n){return s;function s(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(gv,t,n)}}const nbe={name:"htmlText",tokenize:sbe};function sbe(e,t,n){const s=this;let r,i,o;return a;function a(I){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(I),c}function c(I){return I===33?(e.consume(I),u):I===47?(e.consume(I),T):I===63?(e.consume(I),w):da(I)?(e.consume(I),_):n(I)}function u(I){return I===45?(e.consume(I),d):I===91?(e.consume(I),i=0,g):da(I)?(e.consume(I),y):n(I)}function d(I){return I===45?(e.consume(I),p):n(I)}function h(I){return I===null?n(I):I===45?(e.consume(I),m):Nn(I)?(o=h,z(I)):(e.consume(I),h)}function m(I){return I===45?(e.consume(I),p):h(I)}function p(I){return I===62?$(I):I===45?m(I):h(I)}function g(I){const Q="CDATA[";return I===Q.charCodeAt(i++)?(e.consume(I),i===Q.length?b:g):n(I)}function b(I){return I===null?n(I):I===93?(e.consume(I),v):Nn(I)?(o=b,z(I)):(e.consume(I),b)}function v(I){return I===93?(e.consume(I),x):b(I)}function x(I){return I===62?$(I):I===93?(e.consume(I),x):b(I)}function y(I){return I===null||I===62?$(I):Nn(I)?(o=y,z(I)):(e.consume(I),y)}function w(I){return I===null?n(I):I===63?(e.consume(I),k):Nn(I)?(o=w,z(I)):(e.consume(I),w)}function k(I){return I===62?$(I):w(I)}function T(I){return da(I)?(e.consume(I),S):n(I)}function S(I){return I===45||qo(I)?(e.consume(I),S):C(I)}function C(I){return Nn(I)?(o=C,z(I)):Is(I)?(e.consume(I),C):$(I)}function _(I){return I===45||qo(I)?(e.consume(I),_):I===47||I===62||Rr(I)?B(I):n(I)}function B(I){return I===47?(e.consume(I),$):I===58||I===95||da(I)?(e.consume(I),A):Nn(I)?(o=B,z(I)):Is(I)?(e.consume(I),B):$(I)}function A(I){return I===45||I===46||I===58||I===95||qo(I)?(e.consume(I),A):N(I)}function N(I){return I===61?(e.consume(I),j):Nn(I)?(o=N,z(I)):Is(I)?(e.consume(I),N):B(I)}function j(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),r=I,P):Nn(I)?(o=j,z(I)):Is(I)?(e.consume(I),j):(e.consume(I),L)}function P(I){return I===r?(e.consume(I),r=void 0,O):I===null?n(I):Nn(I)?(o=P,z(I)):(e.consume(I),P)}function L(I){return I===null||I===34||I===39||I===60||I===61||I===96?n(I):I===47||I===62||Rr(I)?B(I):(e.consume(I),L)}function O(I){return I===47||I===62||Rr(I)?B(I):n(I)}function $(I){return I===62?(e.consume(I),e.exit("htmlTextData"),e.exit("htmlText"),t):n(I)}function z(I){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),F}function F(I){return Is(I)?Es(e,G,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):G(I)}function G(I){return e.enter("htmlTextData"),o(I)}}const XN={name:"labelEnd",resolveAll:abe,resolveTo:lbe,tokenize:cbe},rbe={tokenize:ube},ibe={tokenize:dbe},obe={tokenize:hbe};function abe(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&&yl(e,0,e.length,n),e}function lbe(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 c={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},u={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",c,t],["enter",u,t]],a=Vl(a,e.slice(i+1,i+s+3)),a=Vl(a,[["enter",d,t]]),a=Vl(a,$4(t.parser.constructs.insideSpan.null,e.slice(i+s+4,o-3),t)),a=Vl(a,[["exit",d,t],e[o-2],e[o-1],["exit",u,t]]),a=Vl(a,e.slice(o+1)),a=Vl(a,[["exit",c,t]]),yl(e,i,e.length,a),e}function cbe(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(m){return i?i._inactive?h(m):(o=s.parser.defined.includes(Cc(s.sliceSerialize({start:i.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),c):n(m)}function c(m){return m===40?e.attempt(rbe,d,o?d:h)(m):m===91?e.attempt(ibe,d,o?u:h)(m):o?d(m):h(m)}function u(m){return e.attempt(obe,d,h)(m)}function d(m){return t(m)}function h(m){return i._balanced=!0,n(m)}}function ube(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 Rr(h)?Dy(e,i)(h):i(h)}function i(h){return h===41?d(h):bK(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function o(h){return Rr(h)?Dy(e,c)(h):d(h)}function a(h){return n(h)}function c(h){return h===34||h===39||h===40?xK(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function u(h){return Rr(h)?Dy(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 dbe(e,t,n){const s=this;return r;function r(a){return yK.call(s,e,i,o,"reference","referenceMarker","referenceString")(a)}function i(a){return s.parser.defined.includes(Cc(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function hbe(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 fbe={name:"labelStartImage",resolveAll:XN.resolveAll,tokenize:mbe};function mbe(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 pbe={name:"labelStartLink",resolveAll:XN.resolveAll,tokenize:gbe};function gbe(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 J5={name:"lineEnding",tokenize:bbe};function bbe(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Es(e,t,"linePrefix")}}const E2={name:"thematicBreak",tokenize:ybe};function ybe(e,t,n){let s=0,r;return i;function i(u){return e.enter("thematicBreak"),o(u)}function o(u){return r=u,a(u)}function a(u){return u===r?(e.enter("thematicBreakSequence"),c(u)):s>=3&&(u===null||Nn(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===r?(e.consume(u),s++,c):(e.exit("thematicBreakSequence"),Is(u)?Es(e,a,"whitespace")(u):a(u))}}const Aa={continuation:{tokenize:kbe},exit:Sbe,name:"list",tokenize:wbe},xbe={partial:!0,tokenize:Cbe},vbe={partial:!0,tokenize:_be};function wbe(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:L7(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(E2,n,u)(p):u(p);if(!s.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return n(p)}function c(p){return L7(p)&&++o<10?(e.consume(p),c):(!s.interrupt||o<2)&&(s.containerState.marker?p===s.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||p,e.check(gv,s.interrupt?n:d,e.attempt(xbe,m,h))}function d(p){return s.containerState.initialBlankLine=!0,i++,m(p)}function h(p){return Is(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),m):n(p)}function m(p){return s.containerState.size=i+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function kbe(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(gv,r,i);function r(a){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,Es(e,t,"listItemIndent",s.containerState.size+1)(a)}function i(a){return s.containerState.furtherBlankLines||!Is(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(vbe,t,o)(a))}function o(a){return s.containerState._closeFlow=!0,s.interrupt=void 0,Es(e,e.attempt(Aa,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function _be(e,t,n){const s=this;return Es(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 Sbe(e){e.exit(this.containerState.type)}function Cbe(e,t,n){const s=this;return Es(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!Is(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const FP={name:"setextUnderline",resolveTo:Tbe,tokenize:Ebe};function Tbe(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 Ebe(e,t,n){const s=this;let r;return i;function i(u){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=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===r?(e.consume(u),a):(e.exit("setextHeadingLineSequence"),Is(u)?Es(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||Nn(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const Abe={tokenize:Nbe};function Nbe(e){const t=this,n=e.attempt(gv,s,e.attempt(this.parser.constructs.flowInitial,r,Es(e,e.attempt(this.parser.constructs.flow,r,e.attempt(D1e,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 jbe={resolveAll:wK()},Mbe=vK("string"),Ibe=vK("text");function vK(e){return{resolveAll:wK(e==="text"?Rbe: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 u(d)?i(d):a(d)}function a(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const h=r[d];let m=-1;if(h)for(;++m<h.length;){const p=h[m];if(!p.previous||p.previous.call(s,s.previous))return!0}return!1}}}function wK(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 Rbe(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,c;for(;i--;){const u=r[i];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(u===-2)c=!0,a++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const u={type:n===e.length||c||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={...u.start},s.start.offset===s.end.offset?Object.assign(s,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const Dbe={42:Aa,43:Aa,45:Aa,48:Aa,49:Aa,50:Aa,51:Aa,52:Aa,53:Aa,54:Aa,55:Aa,56:Aa,57:Aa,62:fK},Lbe={91:$1e},Pbe={[-2]:Q5,[-1]:Q5,32:Q5},Obe={35:V1e,42:E2,45:[FP,E2],60:Y1e,61:FP,95:E2,96:$P,126:$P},Bbe={38:pK,92:mK},$be={[-5]:J5,[-4]:J5,[-3]:J5,33:fbe,38:pK,42:P7,60:[p1e,nbe],91:pbe,92:[H1e,mK],93:XN,95:P7,96:A1e},zbe={null:[P7,jbe]},Fbe={null:[42,95]},qbe={null:[]},Hbe=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Fbe,contentInitial:Lbe,disable:qbe,document:Dbe,flow:Obe,flowInitial:Pbe,insideSpan:zbe,string:Bbe,text:$be},Symbol.toStringTag,{value:"Module"}));function Ube(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 c={attempt:C(T),check:C(S),consume:y,enter:w,exit:k,interrupt:C(S,{interrupt:!0})},u={code:null,containerState:{},defineSkip:b,events:[],now:g,parser:e,previous:null,sliceSerialize:m,sliceStream:p,write:h};let d=t.tokenize.call(u,c);return t.resolveAll&&i.push(t),u;function h(N){return o=Vl(o,N),v(),o[o.length-1]!==null?[]:(_(t,0),u.events=$4(i,u.events,u),u.events)}function m(N,j){return Wbe(p(N),j)}function p(N){return Vbe(o,N)}function g(){const{_bufferIndex:N,_index:j,line:P,column:L,offset:O}=s;return{_bufferIndex:N,_index:j,line:P,column:L,offset:O}}function b(N){r[N.line]=N.column,A()}function v(){let N;for(;s._index<o.length;){const j=o[s._index];if(typeof j=="string")for(N=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===N&&s._bufferIndex<j.length;)x(j.charCodeAt(s._bufferIndex));else x(j)}}function x(N){d=d(N)}function y(N){Nn(N)?(s.line++,s.column=1,s.offset+=N===-3?2:1,A()):N!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===o[s._index].length&&(s._bufferIndex=-1,s._index++)),u.previous=N}function w(N,j){const P=j||{};return P.type=N,P.start=g(),u.events.push(["enter",P,u]),a.push(P),P}function k(N){const j=a.pop();return j.end=g(),u.events.push(["exit",j,u]),j}function T(N,j){_(N,j.from)}function S(N,j){j.restore()}function C(N,j){return P;function P(L,O,$){let z,F,G,I;return Array.isArray(L)?V(L):"tokenize"in L?V([L]):Q(L);function Q(X){return J;function J(de){const W=de!==null&&X[de],te=de!==null&&X.null,U=[...Array.isArray(W)?W:W?[W]:[],...Array.isArray(te)?te:te?[te]:[]];return V(U)(de)}}function V(X){return z=X,F=0,X.length===0?$:M(X[F])}function M(X){return J;function J(de){return I=B(),G=X,X.partial||(u.currentConstruct=X),X.name&&u.parser.constructs.disable.null.includes(X.name)?se():X.tokenize.call(j?Object.assign(Object.create(u),j):u,c,re,se)(de)}}function re(X){return N(G,I),O}function se(X){return I.restore(),++F<z.length?M(z[F]):$}}}function _(N,j){N.resolveAll&&!i.includes(N)&&i.push(N),N.resolve&&yl(u.events,j,u.events.length-j,N.resolve(u.events.slice(j),u)),N.resolveTo&&(u.events=N.resolveTo(u.events,u))}function B(){const N=g(),j=u.previous,P=u.currentConstruct,L=u.events.length,O=Array.from(a);return{from:L,restore:$};function $(){s=N,u.previous=j,u.currentConstruct=P,u.events.length=L,a=O,A()}}function A(){s.line in r&&s.column<2&&(s.column=r[s.line],s.offset+=r[s.line]-1)}}function Vbe(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 Wbe(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 Gbe(e){const s={constructs:dK([Hbe,...(e||{}).extensions||[]]),content:r(l1e),defined:[],document:r(u1e),flow:r(Abe),lazy:{},string:r(Mbe),text:r(Ibe)};return s;function r(i){return o;function o(a){return Ube(s,i,a)}}}function Kbe(e){for(;!gK(e););return e}const qP=/[\0\t\n\r]/g;function Ybe(){let e=1,t="",n=!0,s;return r;function r(i,o,a){const c=[];let u,d,h,m,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(qP.lastIndex=h,u=qP.exec(i),m=u&&u.index!==void 0?u.index:i.length,p=i.charCodeAt(m),!u){t=i.slice(h);break}if(p===10&&h===m&&s)c.push(-3),s=void 0;else switch(s&&(c.push(-5),s=void 0),h<m&&(c.push(i.slice(h,m)),e+=m-h),p){case 0:{c.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,c.push(-2);e++<d;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:s=!0,e=1}h=m+1}return a&&(s&&c.push(-5),t&&c.push(t),c.push(null)),c}}const Xbe=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Qbe(e){return e.replace(Xbe,Jbe)}function Jbe(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const r=n.charCodeAt(1),i=r===120||r===88;return hK(n.slice(i?2:1),i?16:10)}return YN(n)||e}const kK={}.hasOwnProperty;function Zbe(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),eye(n)(Kbe(Gbe(n).document().write(Ybe()(e,t,!0))))}function eye(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(At),autolinkProtocol:B,autolinkEmail:B,atxHeading:i(he),blockQuote:i(te),characterEscape:B,characterReference:B,codeFenced:i(U),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(U,o),codeText:i(ee,o),codeTextData:B,data:B,codeFlowValue:B,definition:i(oe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(Ce),hardBreakEscape:i(ye),hardBreakTrailing:i(ye),htmlFlow:i(Ve,o),htmlFlowData:B,htmlText:i(Ve,o),htmlTextData:B,image:i(it),label:o,link:i(At),listItem:i(me),listItemValue:m,listOrdered:i(Ee,h),listUnordered:i(Ee),paragraph:i(bt),reference:M,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(he),strong:i(et),thematicBreak:i(Ke)},exit:{atxHeading:c(),atxHeadingSequence:T,autolink:c(),autolinkEmail:W,autolinkProtocol:de,blockQuote:c(),characterEscapeValue:A,characterReferenceMarkerHexadecimal:se,characterReferenceMarkerNumeric:se,characterReferenceValue:X,characterReference:J,codeFenced:c(v),codeFencedFence:b,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:A,codeIndented:c(x),codeText:c(O),codeTextData:A,data:A,definition:c(),definitionDestinationString:k,definitionLabelString:y,definitionTitleString:w,emphasis:c(),hardBreakEscape:c(j),hardBreakTrailing:c(j),htmlFlow:c(P),htmlFlowData:A,htmlText:c(L),htmlTextData:A,image:c(z),label:G,labelText:F,lineEnding:N,link:c($),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:re,resourceDestinationString:I,resourceTitleString:Q,resource:V,setextHeading:c(_),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};_K(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(ke){let ne={type:"root",children:[]};const gt={stack:[ne],tokenStack:[],config:t,enter:a,exit:u,buffer:o,resume:d,data:n},We=[];let tt=-1;for(;++tt<ke.length;)if(ke[tt][1].type==="listOrdered"||ke[tt][1].type==="listUnordered")if(ke[tt][0]==="enter")We.push(tt);else{const jt=We.pop();tt=r(ke,jt,tt)}for(tt=-1;++tt<ke.length;){const jt=t[ke[tt][0]];kK.call(jt,ke[tt][1].type)&&jt[ke[tt][1].type].call(Object.assign({sliceSerialize:ke[tt][2].sliceSerialize},gt),ke[tt][1])}if(gt.tokenStack.length>0){const jt=gt.tokenStack[gt.tokenStack.length-1];(jt[1]||HP).call(gt,void 0,jt[0])}for(ne.position={start:gh(ke.length>0?ke[0][1].start:{line:1,column:1,offset:0}),end:gh(ke.length>0?ke[ke.length-2][1].end:{line:1,column:1,offset:0})},tt=-1;++tt<t.transforms.length;)ne=t.transforms[tt](ne)||ne;return ne}function r(ke,ne,gt){let We=ne-1,tt=-1,jt=!1,jn,kn,Be,ht;for(;++We<=gt;){const ve=ke[We];switch(ve[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ve[0]==="enter"?tt++:tt--,ht=void 0;break}case"lineEndingBlank":{ve[0]==="enter"&&(jn&&!ht&&!tt&&!Be&&(Be=We),ht=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ht=void 0}if(!tt&&ve[0]==="enter"&&ve[1].type==="listItemPrefix"||tt===-1&&ve[0]==="exit"&&(ve[1].type==="listUnordered"||ve[1].type==="listOrdered")){if(jn){let Me=We;for(kn=void 0;Me--;){const _e=ke[Me];if(_e[1].type==="lineEnding"||_e[1].type==="lineEndingBlank"){if(_e[0]==="exit")continue;kn&&(ke[kn][1].type="lineEndingBlank",jt=!0),_e[1].type="lineEnding",kn=Me}else if(!(_e[1].type==="linePrefix"||_e[1].type==="blockQuotePrefix"||_e[1].type==="blockQuotePrefixWhitespace"||_e[1].type==="blockQuoteMarker"||_e[1].type==="listItemIndent"))break}Be&&(!kn||Be<kn)&&(jn._spread=!0),jn.end=Object.assign({},kn?ke[kn][1].start:ve[1].end),ke.splice(kn||We,0,["exit",jn,ve[2]]),We++,gt++}if(ve[1].type==="listItemPrefix"){const Me={type:"listItem",_spread:!1,start:Object.assign({},ve[1].start),end:void 0};jn=Me,ke.splice(We,0,["enter",Me,ve[2]]),We++,gt++,Be=void 0,ht=!0}}}return ke[ne][1]._spread=jt,gt}function i(ke,ne){return gt;function gt(We){a.call(this,ke(We),We),ne&&ne.call(this,We)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(ke,ne,gt){this.stack[this.stack.length-1].children.push(ke),this.stack.push(ke),this.tokenStack.push([ne,gt||void 0]),ke.position={start:gh(ne.start),end:void 0}}function c(ke){return ne;function ne(gt){ke&&ke.call(this,gt),u.call(this,gt)}}function u(ke,ne){const gt=this.stack.pop(),We=this.tokenStack.pop();if(We)We[0].type!==ke.type&&(ne?ne.call(this,ke,We[0]):(We[1]||HP).call(this,ke,We[0]));else throw new Error("Cannot close `"+ke.type+"` ("+Ry({start:ke.start,end:ke.end})+"): it’s not open");gt.position.end=gh(ke.end)}function d(){return KN(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function m(ke){if(this.data.expectingFirstListItemValue){const ne=this.stack[this.stack.length-2];ne.start=Number.parseInt(this.sliceSerialize(ke),10),this.data.expectingFirstListItemValue=void 0}}function p(){const ke=this.resume(),ne=this.stack[this.stack.length-1];ne.lang=ke}function g(){const ke=this.resume(),ne=this.stack[this.stack.length-1];ne.meta=ke}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const ke=this.resume(),ne=this.stack[this.stack.length-1];ne.value=ke.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const ke=this.resume(),ne=this.stack[this.stack.length-1];ne.value=ke.replace(/(\r?\n|\r)$/g,"")}function y(ke){const ne=this.resume(),gt=this.stack[this.stack.length-1];gt.label=ne,gt.identifier=Cc(this.sliceSerialize(ke)).toLowerCase()}function w(){const ke=this.resume(),ne=this.stack[this.stack.length-1];ne.title=ke}function k(){const ke=this.resume(),ne=this.stack[this.stack.length-1];ne.url=ke}function T(ke){const ne=this.stack[this.stack.length-1];if(!ne.depth){const gt=this.sliceSerialize(ke).length;ne.depth=gt}}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(ke){const ne=this.stack[this.stack.length-1];ne.depth=this.sliceSerialize(ke).codePointAt(0)===61?1:2}function _(){this.data.setextHeadingSlurpLineEnding=void 0}function B(ke){const gt=this.stack[this.stack.length-1].children;let We=gt[gt.length-1];(!We||We.type!=="text")&&(We=qe(),We.position={start:gh(ke.start),end:void 0},gt.push(We)),this.stack.push(We)}function A(ke){const ne=this.stack.pop();ne.value+=this.sliceSerialize(ke),ne.position.end=gh(ke.end)}function N(ke){const ne=this.stack[this.stack.length-1];if(this.data.atHardBreak){const gt=ne.children[ne.children.length-1];gt.position.end=gh(ke.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ne.type)&&(B.call(this,ke),A.call(this,ke))}function j(){this.data.atHardBreak=!0}function P(){const ke=this.resume(),ne=this.stack[this.stack.length-1];ne.value=ke}function L(){const ke=this.resume(),ne=this.stack[this.stack.length-1];ne.value=ke}function O(){const ke=this.resume(),ne=this.stack[this.stack.length-1];ne.value=ke}function $(){const ke=this.stack[this.stack.length-1];if(this.data.inReference){const ne=this.data.referenceType||"shortcut";ke.type+="Reference",ke.referenceType=ne,delete ke.url,delete ke.title}else delete ke.identifier,delete ke.label;this.data.referenceType=void 0}function z(){const ke=this.stack[this.stack.length-1];if(this.data.inReference){const ne=this.data.referenceType||"shortcut";ke.type+="Reference",ke.referenceType=ne,delete ke.url,delete ke.title}else delete ke.identifier,delete ke.label;this.data.referenceType=void 0}function F(ke){const ne=this.sliceSerialize(ke),gt=this.stack[this.stack.length-2];gt.label=Qbe(ne),gt.identifier=Cc(ne).toLowerCase()}function G(){const ke=this.stack[this.stack.length-1],ne=this.resume(),gt=this.stack[this.stack.length-1];if(this.data.inReference=!0,gt.type==="link"){const We=ke.children;gt.children=We}else gt.alt=ne}function I(){const ke=this.resume(),ne=this.stack[this.stack.length-1];ne.url=ke}function Q(){const ke=this.resume(),ne=this.stack[this.stack.length-1];ne.title=ke}function V(){this.data.inReference=void 0}function M(){this.data.referenceType="collapsed"}function re(ke){const ne=this.resume(),gt=this.stack[this.stack.length-1];gt.label=ne,gt.identifier=Cc(this.sliceSerialize(ke)).toLowerCase(),this.data.referenceType="full"}function se(ke){this.data.characterReferenceType=ke.type}function X(ke){const ne=this.sliceSerialize(ke),gt=this.data.characterReferenceType;let We;gt?(We=hK(ne,gt==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):We=YN(ne);const tt=this.stack[this.stack.length-1];tt.value+=We}function J(ke){const ne=this.stack.pop();ne.position.end=gh(ke.end)}function de(ke){A.call(this,ke);const ne=this.stack[this.stack.length-1];ne.url=this.sliceSerialize(ke)}function W(ke){A.call(this,ke);const ne=this.stack[this.stack.length-1];ne.url="mailto:"+this.sliceSerialize(ke)}function te(){return{type:"blockquote",children:[]}}function U(){return{type:"code",lang:null,meta:null,value:""}}function ee(){return{type:"inlineCode",value:""}}function oe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ce(){return{type:"emphasis",children:[]}}function he(){return{type:"heading",depth:0,children:[]}}function ye(){return{type:"break"}}function Ve(){return{type:"html",value:""}}function it(){return{type:"image",title:null,url:"",alt:null}}function At(){return{type:"link",title:null,url:"",children:[]}}function Ee(ke){return{type:"list",ordered:ke.type==="listOrdered",start:null,spread:ke._spread,children:[]}}function me(ke){return{type:"listItem",spread:ke._spread,checked:null,children:[]}}function bt(){return{type:"paragraph",children:[]}}function et(){return{type:"strong",children:[]}}function qe(){return{type:"text",value:""}}function Ke(){return{type:"thematicBreak"}}}function gh(e){return{line:e.line,column:e.column,offset:e.offset}}function _K(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?_K(e,s):tye(e,s)}}function tye(e,t){let n;for(n in t)if(kK.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 HP(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ry({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ry({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ry({start:t.start,end:t.end})+") is still open")}function nye(e){const t=this;t.parser=n;function n(s){return Zbe(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function sye(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 rye(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
`}]}function iye(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 oye(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function aye(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function lye(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),r=S1(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 c={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,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function cye(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 uye(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function SK(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 dye(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return SK(e,t);const r={src:S1(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 hye(e,t){const n={src:S1(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 fye(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 mye(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return SK(e,t);const r={href:S1(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 pye(e,t){const n={href:S1(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 gye(e,t,n){const s=e.all(t),r=n?bye(n):CK(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 c=s[s.length-1];c&&(r||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
`});const u={type:"element",tagName:"li",properties:i,children:o};return e.patch(t,u),e.applyData(t,u)}function bye(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=CK(n[s])}return t}function CK(e){const t=e.spread;return t??e.children.length>1}function yye(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 xye(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function vye(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function wye(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function kye(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=UN(t.children[1]),c=rK(t.children[t.children.length-1]);a&&c&&(o.position={start:a,end:c}),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 _ye(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 c=-1;const u=[];for(;++c<a;){const h=t.children[c],m={},p=o?o[c]:void 0;p&&(m.align=p);let g={type:"element",tagName:i,properties:m,children:[]};h&&(g.children=e.all(h),e.patch(h,g),g=e.applyData(h,g)),u.push(g)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function Sye(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const UP=9,VP=32;function Cye(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),r=0;const i=[];for(;s;)i.push(WP(t.slice(r,s.index),r>0,!0),s[0]),r=s.index+s[0].length,s=n.exec(t);return i.push(WP(t.slice(r),r>0,!1)),i.join("")}function WP(e,t,n){let s=0,r=e.length;if(t){let i=e.codePointAt(s);for(;i===UP||i===VP;)s++,i=e.codePointAt(s)}if(n){let i=e.codePointAt(r-1);for(;i===UP||i===VP;)r--,i=e.codePointAt(r-1)}return r>s?e.slice(s,r):""}function Tye(e,t){const n={type:"text",value:Cye(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Eye(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const Aye={blockquote:sye,break:rye,code:iye,delete:oye,emphasis:aye,footnoteReference:lye,heading:cye,html:uye,imageReference:dye,image:hye,inlineCode:fye,linkReference:mye,link:pye,listItem:gye,list:yye,paragraph:xye,root:vye,strong:wye,table:kye,tableCell:Sye,tableRow:_ye,text:Tye,thematicBreak:Eye,toml:Vw,yaml:Vw,definition:Vw,footnoteDefinition:Vw};function Vw(){}const TK=-1,z4=0,Ly=1,q_=2,QN=3,JN=4,ZN=5,ej=6,EK=7,AK=8,GP=typeof self=="object"?self:globalThis,Nye=(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 z4:case TK:return n(o,r);case Ly:{const a=n([],r);for(const c of o)a.push(s(c));return a}case q_:{const a=n({},r);for(const[c,u]of o)a[s(c)]=s(u);return a}case QN:return n(new Date(o),r);case JN:{const{source:a,flags:c}=o;return n(new RegExp(a,c),r)}case ZN:{const a=n(new Map,r);for(const[c,u]of o)a.set(s(c),s(u));return a}case ej:{const a=n(new Set,r);for(const c of o)a.add(s(c));return a}case EK:{const{name:a,message:c}=o;return n(new GP[a](c),r)}case AK: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 GP[i](o),r)};return s},KP=e=>Nye(new Map,e)(0),d0="",{toString:jye}={},{keys:Mye}=Object,Ab=e=>{const t=typeof e;if(t!=="object"||!e)return[z4,t];const n=jye.call(e).slice(8,-1);switch(n){case"Array":return[Ly,d0];case"Object":return[q_,d0];case"Date":return[QN,d0];case"RegExp":return[JN,d0];case"Map":return[ZN,d0];case"Set":return[ej,d0];case"DataView":return[Ly,n]}return n.includes("Array")?[Ly,n]:n.includes("Error")?[EK,n]:[q_,n]},Ww=([e,t])=>e===z4&&(t==="function"||t==="symbol"),Iye=(e,t,n,s)=>{const r=(o,a)=>{const c=s.push(o)-1;return n.set(a,c),c},i=o=>{if(n.has(o))return n.get(o);let[a,c]=Ab(o);switch(a){case z4:{let d=o;switch(c){case"bigint":a=AK,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return r([TK],o)}return r([a,d],o)}case Ly:{if(c){let m=o;return c==="DataView"?m=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(m=new Uint8Array(o)),r([c,[...m]],o)}const d=[],h=r([a,d],o);for(const m of o)d.push(i(m));return h}case q_:{if(c)switch(c){case"BigInt":return r([c,o.toString()],o);case"Boolean":case"Number":case"String":return r([c,o.valueOf()],o)}if(t&&"toJSON"in o)return i(o.toJSON());const d=[],h=r([a,d],o);for(const m of Mye(o))(e||!Ww(Ab(o[m])))&&d.push([i(m),i(o[m])]);return h}case QN:return r([a,o.toISOString()],o);case JN:{const{source:d,flags:h}=o;return r([a,{source:d,flags:h}],o)}case ZN:{const d=[],h=r([a,d],o);for(const[m,p]of o)(e||!(Ww(Ab(m))||Ww(Ab(p))))&&d.push([i(m),i(p)]);return h}case ej:{const d=[],h=r([a,d],o);for(const m of o)(e||!Ww(Ab(m)))&&d.push(i(m));return h}}const{message:u}=o;return r([a,{name:c,message:u}],o)};return i},YP=(e,{json:t,lossy:n}={})=>{const s=[];return Iye(!(t||n),!!t,new Map,s)(e),s},H_=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?KP(YP(e,t)):structuredClone(e):(e,t)=>KP(YP(e,t));function Rye(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 Dye(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Lye(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Rye,s=e.options.footnoteBackLabel||Dye,r=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const d=e.all(u),h=String(u.identifier).toUpperCase(),m=S1(h.toLowerCase());let p=0;const g=[],b=e.footnoteCounts.get(h);for(;b!==void 0&&++p<=b;){g.length>0&&g.push({type:"text",value:" "});let y=typeof n=="string"?n:n(c,p);typeof y=="string"&&(y={type:"text",value:y}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+m+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(c,p),className:["data-footnote-backref"]},children:Array.isArray(y)?y:[y]})}const v=d[d.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const y=v.children[v.children.length-1];y&&y.type==="text"?y.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...g)}else d.push(...g);const x={type:"element",tagName:"li",properties:{id:t+"fn-"+m},children:e.wrap(d,!0)};e.patch(u,x),a.push(x)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...H_(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 bv=function(e){if(e==null)return $ye;if(typeof e=="function")return F4(e);if(typeof e=="object")return Array.isArray(e)?Pye(e):Oye(e);if(typeof e=="string")return Bye(e);throw new Error("Expected function, string, or object as test")};function Pye(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=bv(e[n]);return F4(s);function s(...r){let i=-1;for(;++i<t.length;)if(t[i].apply(this,r))return!0;return!1}}function Oye(e){const t=e;return F4(n);function n(s){const r=s;let i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function Bye(e){return F4(t);function t(n){return n&&n.type===e}}function F4(e){return t;function t(n,s,r){return!!(zye(n)&&e.call(this,n,typeof s=="number"?s:void 0,r||void 0))}}function $ye(){return!0}function zye(e){return e!==null&&typeof e=="object"&&"type"in e}const NK=[],Fye=!0,O7=!1,jK="skip";function tj(e,t,n,s){let r;typeof t=="function"&&typeof n!="function"?(s=n,n=t):r=t;const i=bv(r),o=s?-1:1;a(e,void 0,[])();function a(c,u,d){const h=c&&typeof c=="object"?c:{};if(typeof h.type=="string"){const p=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(c.type+(p?"<"+p+">":""))+")"})}return m;function m(){let p=NK,g,b,v;if((!t||i(c,u,d[d.length-1]||void 0))&&(p=qye(n(c,d)),p[0]===O7))return p;if("children"in c&&c.children){const x=c;if(x.children&&p[0]!==jK)for(b=(s?x.children.length:-1)+o,v=d.concat(x);b>-1&&b<x.children.length;){const y=x.children[b];if(g=a(y,b,v)(),g[0]===O7)return g;b=typeof g[1]=="number"?g[1]:b+o}}return p}}}function qye(e){return Array.isArray(e)?e:typeof e=="number"?[Fye,e]:e==null?NK:[e]}function nj(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),tj(e,i,a,r);function a(c,u){const d=u[u.length-1],h=d?d.children.indexOf(c):void 0;return o(c,h,d)}}const B7={}.hasOwnProperty,Hye={};function Uye(e,t){const n=t||Hye,s=new Map,r=new Map,i=new Map,o={...Aye,...n.handlers},a={all:u,applyData:Wye,definitionById:s,footnoteById:r,footnoteCounts:i,footnoteOrder:[],handlers:o,one:c,options:n,patch:Vye,wrap:Kye};return nj(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const h=d.type==="definition"?s:r,m=String(d.identifier).toUpperCase();h.has(m)||h.set(m,d)}}),a;function c(d,h){const m=d.type,p=a.handlers[m];if(B7.call(a.handlers,m)&&p)return p(a,d,h);if(a.options.passThrough&&a.options.passThrough.includes(m)){if("children"in d){const{children:b,...v}=d,x=H_(v);return x.children=a.all(d),x}return H_(d)}return(a.options.unknownHandler||Gye)(a,d,h)}function u(d){const h=[];if("children"in d){const m=d.children;let p=-1;for(;++p<m.length;){const g=a.one(m[p],d);if(g){if(p&&m[p-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=XP(g.value)),!Array.isArray(g)&&g.type==="element")){const b=g.children[0];b&&b.type==="text"&&(b.value=XP(b.value))}Array.isArray(g)?h.push(...g):h.push(g)}}}return h}}function Vye(e,t){e.position&&(t.position=Dge(e))}function Wye(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,H_(i)),"children"in n&&n.children&&r!==null&&r!==void 0&&(n.children=r)}return n}function Gye(e,t){const n=t.data||{},s="value"in t&&!(B7.call(n,"hProperties")||B7.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 Kye(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 XP(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function QP(e,t){const n=Uye(e,t),s=n.one(e,void 0),r=Lye(n),i=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return r&&i.children.push({type:"text",value:`
`},r),i}function Yye(e,t){return e&&"run"in e?async function(n,s){const r=QP(n,{file:s,...t});await e.run(r,s)}:function(n,s){return QP(n,{file:s,...e||t})}}function JP(e){if(e)throw e}var A2=Object.prototype.hasOwnProperty,MK=Object.prototype.toString,ZP=Object.defineProperty,eO=Object.getOwnPropertyDescriptor,tO=function(t){return typeof Array.isArray=="function"?Array.isArray(t):MK.call(t)==="[object Array]"},nO=function(t){if(!t||MK.call(t)!=="[object Object]")return!1;var n=A2.call(t,"constructor"),s=t.constructor&&t.constructor.prototype&&A2.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!s)return!1;var r;for(r in t);return typeof r>"u"||A2.call(t,r)},sO=function(t,n){ZP&&n.name==="__proto__"?ZP(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},rO=function(t,n){if(n==="__proto__")if(A2.call(t,n)){if(eO)return eO(t,n).value}else return;return t[n]},Xye=function e(){var t,n,s,r,i,o,a=arguments[0],c=1,u=arguments.length,d=!1;for(typeof a=="boolean"&&(d=a,a=arguments[1]||{},c=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});c<u;++c)if(t=arguments[c],t!=null)for(n in t)s=rO(a,n),r=rO(t,n),a!==r&&(d&&r&&(nO(r)||(i=tO(r)))?(i?(i=!1,o=s&&tO(s)?s:[]):o=s&&nO(s)?s:{},sO(a,{name:n,newValue:e(d,o,r)})):typeof r<"u"&&sO(a,{name:n,newValue:r}));return a};const Z5=l4(Xye);function $7(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 Qye(){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(c,...u){const d=e[++i];let h=-1;if(c){o(c);return}for(;++h<r.length;)(u[h]===null||u[h]===void 0)&&(u[h]=r[h]);r=u,d?Jye(d,a)(...u):o(null,...u)}}function s(r){if(typeof r!="function")throw new TypeError("Expected `middelware` to be a function, not "+r);return e.push(r),t}}function Jye(e,t){let n;return s;function s(...o){const a=e.length>o.length;let c;a&&o.push(r);try{c=e.apply(this,o)}catch(u){const d=u;if(a&&n)throw d;return r(d)}a||(c&&c.then&&typeof c.then=="function"?c.then(i,r):c instanceof Error?r(c):i(c))}function r(o,...a){n||(n=!0,t(o,...a))}function i(o){r(null,o)}}const ou={basename:Zye,dirname:exe,extname:txe,join:nxe,sep:"/"};function Zye(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');yv(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 exe(e){if(yv(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 txe(e){yv(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 nxe(...e){let t=-1,n;for(;++t<e.length;)yv(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":sxe(n)}function sxe(e){yv(e);const t=e.codePointAt(0)===47;let n=rxe(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function rxe(e,t){let n="",s=0,r=-1,i=0,o=-1,a,c;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(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",s=0):(n=n.slice(0,c),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 yv(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const ixe={cwd:oxe};function oxe(){return"/"}function z7(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function axe(e){if(typeof e=="string")e=new URL(e);else if(!z7(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 lxe(e)}function lxe(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 eT=["history","path","basename","stem","extname","dirname"];class IK{constructor(t){let n;t?z7(t)?n={path:t}:typeof t=="string"||cxe(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":ixe.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<eT.length;){const i=eT[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)eT.includes(r)||(this[r]=n[r])}get basename(){return typeof this.path=="string"?ou.basename(this.path):void 0}set basename(t){nT(t,"basename"),tT(t,"basename"),this.path=ou.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ou.dirname(this.path):void 0}set dirname(t){iO(this.basename,"dirname"),this.path=ou.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ou.extname(this.path):void 0}set extname(t){if(tT(t,"extname"),iO(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=ou.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){z7(t)&&(t=axe(t)),nT(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ou.basename(this.path,this.extname):void 0}set stem(t){nT(t,"stem"),tT(t,"stem"),this.path=ou.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 Wo(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 tT(e,t){if(e&&e.includes(ou.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ou.sep+"`")}function nT(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function iO(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function cxe(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const uxe=function(e){const s=this.constructor.prototype,r=s[e],i=function(){return r.apply(i,arguments)};return Object.setPrototypeOf(i,s),i},dxe={}.hasOwnProperty;class sj extends uxe{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=Qye()}copy(){const t=new sj;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(Z5(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(iT("data",this.frozen),this.namespace[t]=n,this):dxe.call(this.namespace,t)&&this.namespace[t]||void 0:t?(iT("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=Gw(t),s=this.parser||this.Parser;return sT("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),sT("process",this.parser||this.Parser),rT("process",this.compiler||this.Compiler),n?r(void 0,n):new Promise(r);function r(i,o){const a=Gw(t),c=s.parse(a);s.run(c,a,function(d,h,m){if(d||!h||!m)return u(d);const p=h,g=s.stringify(p,m);mxe(g)?m.value=g:m.result=g,u(d,m)});function u(d,h){d||!h?o(d):i?i(h):n(void 0,h)}}}processSync(t){let n=!1,s;return this.freeze(),sT("processSync",this.parser||this.Parser),rT("processSync",this.compiler||this.Compiler),this.process(t,r),aO("processSync","process",n),s;function r(i,o){n=!0,JP(i),s=o}}run(t,n,s){oO(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 c=Gw(n);r.run(t,c,u);function u(d,h,m){const p=h||t;d?a(d):o?o(p):s(void 0,p,m)}}}runSync(t,n){let s=!1,r;return this.run(t,n,i),aO("runSync","run",s),r;function i(o,a){JP(o),r=a,s=!0}}stringify(t,n){this.freeze();const s=Gw(n),r=this.compiler||this.Compiler;return rT("stringify",r),oO(t),r(t,s)}use(t,...n){const s=this.attachers,r=this.namespace;if(iT("use",this.frozen),t!=null)if(typeof t=="function")c(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(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...h]=u;c(d,h)}else o(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function o(u){if(!("plugins"in u)&&!("settings"in u))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(u.plugins),u.settings&&(r.settings=Z5(!0,r.settings,u.settings))}function a(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const h=u[d];i(h)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,d){let h=-1,m=-1;for(;++h<s.length;)if(s[h][0]===u){m=h;break}if(m===-1)s.push([u,...d]);else if(d.length>0){let[p,...g]=d;const b=s[m][1];$7(b)&&$7(p)&&(p=Z5(!0,b,p)),s[m]=[u,p,...g]}}}}const hxe=new sj().freeze();function sT(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function rT(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function iT(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 oO(e){if(!$7(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function aO(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Gw(e){return fxe(e)?e:new IK(e)}function fxe(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function mxe(e){return typeof e=="string"||pxe(e)}function pxe(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const gxe="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",lO=[],cO={allowDangerousHtml:!0},bxe=/^(https?|ircs?|mailto|xmpp)$/i,yxe=[{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 xxe(e){const t=vxe(e),n=wxe(e);return kxe(t.runSync(t.parse(n),n),e)}function vxe(e){const t=e.rehypePlugins||lO,n=e.remarkPlugins||lO,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...cO}:cO;return hxe().use(nye).use(n).use(Yye,s).use(t)}function wxe(e){const t=e.children||"",n=new IK;return typeof t=="string"&&(n.value=t),n}function kxe(e,t){const n=t.allowedElements,s=t.allowElement,r=t.components,i=t.disallowedElements,o=t.skipHtml,a=t.unwrapDisallowed,c=t.urlTransform||RK;for(const d of yxe)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+gxe+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),nj(e,u),$ge(e,{Fragment:l.Fragment,components:r,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function u(d,h,m){if(d.type==="raw"&&m&&typeof h=="number")return o?m.children.splice(h,1):m.children[h]={type:"text",value:d.value},h;if(d.type==="element"){let p;for(p in X5)if(Object.hasOwn(X5,p)&&Object.hasOwn(d.properties,p)){const g=d.properties[p],b=X5[p];(b===null||b.includes(d.tagName))&&(d.properties[p]=c(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,m)),p&&m&&typeof h=="number")return a&&d.children?m.children.splice(h,1,...d.children):m.children.splice(h,1),h}}}function RK(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||bxe.test(e.slice(0,t))?e:""}function U_(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 _xe(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Sxe(e,t,n){const r=bv((n||{}).ignore||[]),i=Cxe(t);let o=-1;for(;++o<i.length;)tj(e,"text",a);function a(u,d){let h=-1,m;for(;++h<d.length;){const p=d[h],g=m?m.children:void 0;if(r(p,g?g.indexOf(p):void 0,m))return;m=p}if(m)return c(u,d)}function c(u,d){const h=d[d.length-1],m=i[o][0],p=i[o][1];let g=0;const v=h.children.indexOf(u);let x=!1,y=[];m.lastIndex=0;let w=m.exec(u.value);for(;w;){const k=w.index,T={index:w.index,input:w.input,stack:[...d,u]};let S=p(...w,T);if(typeof S=="string"&&(S=S.length>0?{type:"text",value:S}:void 0),S===!1?m.lastIndex=k+1:(g!==k&&y.push({type:"text",value:u.value.slice(g,k)}),Array.isArray(S)?y.push(...S):S&&y.push(S),g=k+w[0].length,x=!0),!m.global)break;w=m.exec(u.value)}return x?(g<u.value.length&&y.push({type:"text",value:u.value.slice(g)}),h.children.splice(v,1,...y)):y=[u],v+y.length}}function Cxe(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([Txe(r[0]),Exe(r[1])])}return t}function Txe(e){return typeof e=="string"?new RegExp(_xe(e),"g"):e}function Exe(e){return typeof e=="function"?e:function(){return e}}const oT="phrasing",aT=["autolink","link","image","label"];function Axe(){return{transforms:[Lxe],enter:{literalAutolink:jxe,literalAutolinkEmail:lT,literalAutolinkHttp:lT,literalAutolinkWww:lT},exit:{literalAutolink:Dxe,literalAutolinkEmail:Rxe,literalAutolinkHttp:Mxe,literalAutolinkWww:Ixe}}}function Nxe(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:oT,notInConstruct:aT},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:oT,notInConstruct:aT},{character:":",before:"[ps]",after:"\\/",inConstruct:oT,notInConstruct:aT}]}}function jxe(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function lT(e){this.config.enter.autolinkProtocol.call(this,e)}function Mxe(e){this.config.exit.autolinkProtocol.call(this,e)}function Ixe(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 Rxe(e){this.config.exit.autolinkEmail.call(this,e)}function Dxe(e){this.exit(e)}function Lxe(e){Sxe(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Pxe],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Oxe]],{ignore:["link","linkReference"]})}function Pxe(e,t,n,s,r){let i="";if(!DK(r)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!Bxe(n)))return!1;const o=$xe(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 Oxe(e,t,n,s){return!DK(s,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function Bxe(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 $xe(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=U_(e,"(");let i=U_(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 DK(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||hp(n)||B4(n))&&(!t||n!==47)}LK.peek=Kxe;function zxe(){this.buffer()}function Fxe(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function qxe(){this.buffer()}function Hxe(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Uxe(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Cc(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Vxe(e){this.exit(e)}function Wxe(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Cc(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Gxe(e){this.exit(e)}function Kxe(){return"["}function LK(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 Yxe(){return{enter:{gfmFootnoteCallString:zxe,gfmFootnoteCall:Fxe,gfmFootnoteDefinitionLabelString:qxe,gfmFootnoteDefinition:Hxe},exit:{gfmFootnoteCallString:Uxe,gfmFootnoteCall:Vxe,gfmFootnoteDefinitionLabelString:Wxe,gfmFootnoteDefinition:Gxe}}}function Xxe(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:LK},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(s,r,i,o){const a=i.createTracker(o);let c=a.move("[^");const u=i.enter("footnoteDefinition"),d=i.enter("label");return c+=a.move(i.safe(i.associationId(s),{before:c,after:"]"})),d(),c+=a.move("]:"),s.children&&s.children.length>0&&(a.shift(4),c+=a.move((t?`
`:" ")+i.indentLines(i.containerFlow(s,a.current()),t?PK:Qxe))),u(),c}}function Qxe(e,t,n){return t===0?e:PK(e,t,n)}function PK(e,t,n){return(n?"":"    ")+e}const Jxe=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];OK.peek=sve;function Zxe(){return{canContainEols:["delete"],enter:{strikethrough:tve},exit:{strikethrough:nve}}}function eve(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Jxe}],handlers:{delete:OK}}}function tve(e){this.enter({type:"delete",children:[]},e)}function nve(e){this.exit(e)}function OK(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 sve(){return"~"}function rve(e){return e.length}function ive(e,t){const n=t||{},s=(n.align||[]).concat(),r=n.stringLength||rve,i=[],o=[],a=[],c=[];let u=0,d=-1;for(;++d<e.length;){const b=[],v=[];let x=-1;for(e[d].length>u&&(u=e[d].length);++x<e[d].length;){const y=ove(e[d][x]);if(n.alignDelimiters!==!1){const w=r(y);v[x]=w,(c[x]===void 0||w>c[x])&&(c[x]=w)}b.push(y)}o[d]=b,a[d]=v}let h=-1;if(typeof s=="object"&&"length"in s)for(;++h<u;)i[h]=uO(s[h]);else{const b=uO(s);for(;++h<u;)i[h]=b}h=-1;const m=[],p=[];for(;++h<u;){const b=i[h];let v="",x="";b===99?(v=":",x=":"):b===108?v=":":b===114&&(x=":");let y=n.alignDelimiters===!1?1:Math.max(1,c[h]-v.length-x.length);const w=v+"-".repeat(y)+x;n.alignDelimiters!==!1&&(y=v.length+y+x.length,y>c[h]&&(c[h]=y),p[h]=y),m[h]=w}o.splice(1,0,m),a.splice(1,0,p),d=-1;const g=[];for(;++d<o.length;){const b=o[d],v=a[d];h=-1;const x=[];for(;++h<u;){const y=b[h]||"";let w="",k="";if(n.alignDelimiters!==!1){const T=c[h]-(v[h]||0),S=i[h];S===114?w=" ".repeat(T):S===99?T%2?(w=" ".repeat(T/2+.5),k=" ".repeat(T/2-.5)):(w=" ".repeat(T/2),k=w):k=" ".repeat(T)}n.delimiterStart!==!1&&!h&&x.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&y==="")&&(n.delimiterStart!==!1||h)&&x.push(" "),n.alignDelimiters!==!1&&x.push(w),x.push(y),n.alignDelimiters!==!1&&x.push(k),n.padding!==!1&&x.push(" "),(n.delimiterEnd!==!1||h!==u-1)&&x.push("|")}g.push(n.delimiterEnd===!1?x.join("").replace(/ +$/,""):x.join(""))}return g.join(`
`)}function ove(e){return e==null?"":String(e)}function uO(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 dO={}.hasOwnProperty;function ave(e,t){const n=t||{};function s(r,...i){let o=s.invalid;const a=s.handlers;if(r&&dO.call(r,e)){const c=String(r[e]);o=dO.call(a,c)?a[c]: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 lve(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()),cve);return r(),o}function cve(e,t,n){return">"+(n?"":" ")+e}function uve(e,t){return hO(e,t.inConstruct,!0)&&!hO(e,t.notInConstruct,!1)}function hO(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 fO(e,t,n,s){let r=-1;for(;++r<n.unsafe.length;)if(n.unsafe[r].character===`
`&&uve(n.stack,n.unsafe[r]))return/[ \t]/.test(s.before)?"":" ";return`\\
`}function BK(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 dve(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 hve(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 fve(e,t,n,s){const r=hve(n),i=e.value||"",o=r==="`"?"GraveAccent":"Tilde";if(dve(e,n)){const h=n.enter("codeIndented"),m=n.indentLines(i,mve);return h(),m}const a=n.createTracker(s),c=r.repeat(Math.max(BK(i,r)+1,3)),u=n.enter("codeFenced");let d=a.move(c);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(c),u(),d}function mve(e,t,n){return(n?"":"    ")+e}function rj(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 pve(e,t,n,s){const r=rj(n),i=r==='"'?"Quote":"Apostrophe",o=n.enter("definition");let a=n.enter("label");const c=n.createTracker(s);let u=c.move("[");return u+=c.move(n.safe(n.associationId(e),{before:u,after:"]",...c.current()})),u+=c.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(a=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":`
`,...c.current()}))),a(),e.title&&(a=n.enter(`title${i}`),u+=c.move(" "+r),u+=c.move(n.safe(e.title,{before:u,after:r,...c.current()})),u+=c.move(r),a()),o(),u}function gve(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 px(e){return"&#x"+e.toString(16).toUpperCase()+";"}function V_(e,t,n){const s=Bg(e),r=Bg(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}}$K.peek=bve;function $K(e,t,n,s){const r=gve(n),i=n.enter("emphasis"),o=n.createTracker(s),a=o.move(r);let c=o.move(n.containerPhrasing(e,{after:r,before:a,...o.current()}));const u=c.charCodeAt(0),d=V_(s.before.charCodeAt(s.before.length-1),u,r);d.inside&&(c=px(u)+c.slice(1));const h=c.charCodeAt(c.length-1),m=V_(s.after.charCodeAt(0),h,r);m.inside&&(c=c.slice(0,-1)+px(h));const p=o.move(r);return i(),n.attentionEncodeSurroundingInfo={after:m.outside,before:d.outside},a+c+p}function bve(e,t,n){return n.options.emphasis||"*"}function yve(e,t){let n=!1;return nj(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,O7}),!!((!e.depth||e.depth<3)&&KN(e)&&(t.options.setext||n))}function xve(e,t,n,s){const r=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(s);if(yve(e,n)){const d=n.enter("headingSetext"),h=n.enter("phrasing"),m=n.containerPhrasing(e,{...i.current(),before:`
`,after:`
`});return h(),d(),m+`
`+(r===1?"=":"-").repeat(m.length-(Math.max(m.lastIndexOf("\r"),m.lastIndexOf(`
`))+1))}const o="#".repeat(r),a=n.enter("headingAtx"),c=n.enter("phrasing");i.move(o+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
`,...i.current()});return/^[\t ]/.test(u)&&(u=px(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),c(),a(),u}zK.peek=vve;function zK(e){return e.value||""}function vve(){return"<"}FK.peek=wve;function FK(e,t,n,s){const r=rj(n),i=r==='"'?"Quote":"Apostrophe",o=n.enter("image");let a=n.enter("label");const c=n.createTracker(s);let u=c.move("![");return u+=c.move(n.safe(e.alt,{before:u,after:"]",...c.current()})),u+=c.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(a=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),a(),e.title&&(a=n.enter(`title${i}`),u+=c.move(" "+r),u+=c.move(n.safe(e.title,{before:u,after:r,...c.current()})),u+=c.move(r),a()),u+=c.move(")"),o(),u}function wve(){return"!"}qK.peek=kve;function qK(e,t,n,s){const r=e.referenceType,i=n.enter("imageReference");let o=n.enter("label");const a=n.createTracker(s);let c=a.move("![");const u=n.safe(e.alt,{before:c,after:"]",...a.current()});c+=a.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const h=n.safe(n.associationId(e),{before:c,after:"]",...a.current()});return o(),n.stack=d,i(),r==="full"||!u||u!==h?c+=a.move(h+"]"):r==="shortcut"?c=c.slice(0,-1):c+=a.move("]"),c}function kve(){return"!"}HK.peek=_ve;function HK(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 c;if(o.atBreak)for(;c=a.exec(s);){let u=c.index;s.charCodeAt(u)===10&&s.charCodeAt(u-1)===13&&u--,s=s.slice(0,u)+" "+s.slice(c.index+1)}}return r+s+r}function _ve(){return"`"}function UK(e,t){const n=KN(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))}VK.peek=Sve;function VK(e,t,n,s){const r=rj(n),i=r==='"'?"Quote":"Apostrophe",o=n.createTracker(s);let a,c;if(UK(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"),c=n.enter("label");let u=o.move("[");return u+=o.move(n.containerPhrasing(e,{before:u,after:"](",...o.current()})),u+=o.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(n.safe(e.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(c=n.enter("destinationRaw"),u+=o.move(n.safe(e.url,{before:u,after:e.title?" ":")",...o.current()}))),c(),e.title&&(c=n.enter(`title${i}`),u+=o.move(" "+r),u+=o.move(n.safe(e.title,{before:u,after:r,...o.current()})),u+=o.move(r),c()),u+=o.move(")"),a(),u}function Sve(e,t,n){return UK(e,n)?"<":"["}WK.peek=Cve;function WK(e,t,n,s){const r=e.referenceType,i=n.enter("linkReference");let o=n.enter("label");const a=n.createTracker(s);let c=a.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...a.current()});c+=a.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const h=n.safe(n.associationId(e),{before:c,after:"]",...a.current()});return o(),n.stack=d,i(),r==="full"||!u||u!==h?c+=a.move(h+"]"):r==="shortcut"?c=c.slice(0,-1):c+=a.move("]"),c}function Cve(){return"["}function ij(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 Tve(e){const t=ij(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 Eve(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 GK(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 Ave(e,t,n,s){const r=n.enter("list"),i=n.bulletCurrent;let o=e.ordered?Eve(n):ij(n);const a=e.ordered?o==="."?")":".":Tve(n);let c=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&&(c=!0),GK(n)===o&&d){let h=-1;for(;++h<e.children.length;){const m=e.children[h];if(m&&m.type==="listItem"&&m.children&&m.children[0]&&m.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(o=a),n.bulletCurrent=o;const u=n.containerFlow(e,s);return n.bulletLastUsed=o,n.bulletCurrent=i,r(),u}function Nve(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 jve(e,t,n,s){const r=Nve(n);let i=n.bulletCurrent||ij(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 c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,a.current()),d);return c(),u;function d(h,m,p){return m?(p?"":" ".repeat(o))+h:(p?i:i+" ".repeat(o-i.length))+h}}function Mve(e,t,n,s){const r=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(e,s);return i(),r(),o}const Ive=bv(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Rve(e,t,n,s){return(e.children.some(function(o){return Ive(o)})?n.containerPhrasing:n.containerFlow).call(n,e,s)}function Dve(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}KK.peek=Lve;function KK(e,t,n,s){const r=Dve(n),i=n.enter("strong"),o=n.createTracker(s),a=o.move(r+r);let c=o.move(n.containerPhrasing(e,{after:r,before:a,...o.current()}));const u=c.charCodeAt(0),d=V_(s.before.charCodeAt(s.before.length-1),u,r);d.inside&&(c=px(u)+c.slice(1));const h=c.charCodeAt(c.length-1),m=V_(s.after.charCodeAt(0),h,r);m.inside&&(c=c.slice(0,-1)+px(h));const p=o.move(r+r);return i(),n.attentionEncodeSurroundingInfo={after:m.outside,before:d.outside},a+c+p}function Lve(e,t,n){return n.options.strong||"*"}function Pve(e,t,n,s){return n.safe(e.value,s)}function Ove(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 Bve(e,t,n){const s=(GK(n)+(n.options.ruleSpaces?" ":"")).repeat(Ove(n));return n.options.ruleSpaces?s.slice(0,-1):s}const YK={blockquote:lve,break:fO,code:fve,definition:pve,emphasis:$K,hardBreak:fO,heading:xve,html:zK,image:FK,imageReference:qK,inlineCode:HK,link:VK,linkReference:WK,list:Ave,listItem:jve,paragraph:Mve,root:Rve,strong:KK,text:Pve,thematicBreak:Bve};function $ve(){return{enter:{table:zve,tableData:mO,tableHeader:mO,tableRow:qve},exit:{codeText:Hve,table:Fve,tableData:cT,tableHeader:cT,tableRow:cT}}}function zve(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 Fve(e){this.exit(e),this.data.inTable=void 0}function qve(e){this.enter({type:"tableRow",children:[]},e)}function cT(e){this.exit(e)}function mO(e){this.enter({type:"tableCell",children:[]},e)}function Hve(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Uve));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Uve(e,t){return t==="|"?t:e}function Vve(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:m,table:o,tableCell:c,tableRow:a}};function o(p,g,b,v){return u(d(p,b,v),p.align)}function a(p,g,b,v){const x=h(p,b,v),y=u([x]);return y.slice(0,y.indexOf(`
`))}function c(p,g,b,v){const x=b.enter("tableCell"),y=b.enter("phrasing"),w=b.containerPhrasing(p,{...v,before:i,after:i});return y(),x(),w}function u(p,g){return ive(p,{align:g,alignDelimiters:s,padding:n,stringLength:r})}function d(p,g,b){const v=p.children;let x=-1;const y=[],w=g.enter("table");for(;++x<v.length;)y[x]=h(v[x],g,b);return w(),y}function h(p,g,b){const v=p.children;let x=-1;const y=[],w=g.enter("tableRow");for(;++x<v.length;)y[x]=c(v[x],p,g,b);return w(),y}function m(p,g,b){let v=YK.inlineCode(p,g,b);return b.stack.includes("tableCell")&&(v=v.replace(/\|/g,"\\$&")),v}}function Wve(){return{exit:{taskListCheckValueChecked:pO,taskListCheckValueUnchecked:pO,paragraph:Kve}}}function Gve(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Yve}}}function pO(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Kve(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 Yve(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 c=YK.listItem(e,t,n,{...s,...a.current()});return i&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),c;function u(d){return d+o}}function Xve(){return[Axe(),Yxe(),Zxe(),$ve(),Wve()]}function Qve(e){return{extensions:[Nxe(),Xxe(e),eve(),Vve(e),Gve()]}}const Jve={tokenize:rwe,partial:!0},XK={tokenize:iwe,partial:!0},QK={tokenize:owe,partial:!0},JK={tokenize:awe,partial:!0},Zve={tokenize:lwe,partial:!0},ZK={name:"wwwAutolink",tokenize:nwe,previous:tY},eY={name:"protocolAutolink",tokenize:swe,previous:nY},Xd={name:"emailAutolink",tokenize:twe,previous:sY},Pu={};function ewe(){return{text:Pu}}let bm=48;for(;bm<123;)Pu[bm]=Xd,bm++,bm===58?bm=65:bm===91&&(bm=97);Pu[43]=Xd;Pu[45]=Xd;Pu[46]=Xd;Pu[95]=Xd;Pu[72]=[Xd,eY];Pu[104]=[Xd,eY];Pu[87]=[Xd,ZK];Pu[119]=[Xd,ZK];function twe(e,t,n){const s=this;let r,i;return o;function o(h){return!F7(h)||!sY.call(s,s.previous)||oj(s.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(h))}function a(h){return F7(h)?(e.consume(h),a):h===64?(e.consume(h),c):n(h)}function c(h){return h===46?e.check(Zve,d,u)(h):h===45||h===95||qo(h)?(i=!0,e.consume(h),c):d(h)}function u(h){return e.consume(h),r=!0,c}function d(h){return i&&r&&da(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function nwe(e,t,n){const s=this;return r;function r(o){return o!==87&&o!==119||!tY.call(s,s.previous)||oj(s.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Jve,e.attempt(XK,e.attempt(QK,i),n),n)(o))}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function swe(e,t,n){const s=this;let r="",i=!1;return o;function o(h){return(h===72||h===104)&&nY.call(s,s.previous)&&!oj(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),r+=String.fromCodePoint(h),e.consume(h),a):n(h)}function a(h){if(da(h)&&r.length<5)return r+=String.fromCodePoint(h),e.consume(h),a;if(h===58){const m=r.toLowerCase();if(m==="http"||m==="https")return e.consume(h),c}return n(h)}function c(h){return h===47?(e.consume(h),i?u:(i=!0,c)):n(h)}function u(h){return h===null||F_(h)||Rr(h)||hp(h)||B4(h)?n(h):e.attempt(XK,e.attempt(QK,d),n)(h)}function d(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function rwe(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 iwe(e,t,n){let s,r,i;return o;function o(u){return u===46||u===95?e.check(JK,c,a)(u):u===null||Rr(u)||hp(u)||u!==45&&B4(u)?c(u):(i=!0,e.consume(u),o)}function a(u){return u===95?s=!0:(r=s,s=void 0),e.consume(u),o}function c(u){return r||s||!i?n(u):t(u)}}function owe(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(JK,t,i)(o):o===null||Rr(o)||hp(o)?t(o):(e.consume(o),r)}function i(o){return o===41&&s++,e.consume(o),r}}function awe(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||Rr(a)||hp(a)?t(a):n(a)}function r(a){return a===null||a===40||a===91||Rr(a)||hp(a)?t(a):s(a)}function i(a){return da(a)?o(a):n(a)}function o(a){return a===59?(e.consume(a),s):da(a)?(e.consume(a),o):n(a)}}function lwe(e,t,n){return s;function s(i){return e.consume(i),r}function r(i){return qo(i)?n(i):t(i)}}function tY(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Rr(e)}function nY(e){return!da(e)}function sY(e){return!(e===47||F7(e))}function F7(e){return e===43||e===45||e===46||e===95||qo(e)}function oj(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 cwe={tokenize:bwe,partial:!0};function uwe(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:mwe,continuation:{tokenize:pwe},exit:gwe}},text:{91:{name:"gfmFootnoteCall",tokenize:fwe},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:dwe,resolveTo:hwe}}}}function dwe(e,t,n){const s=this;let r=s.events.length;const i=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o;for(;r--;){const c=s.events[r][1];if(c.type==="labelImage"){o=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return a;function a(c){if(!o||!o._balanced)return n(c);const u=Cc(s.sliceSerialize({start:o.end,end:s.now()}));return u.codePointAt(0)!==94||!i.includes(u.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function hwe(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 fwe(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"),c}function c(h){return h!==94?n(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(h){if(i>999||h===93&&!o||h===null||h===91||Rr(h))return n(h);if(h===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return r.includes(Cc(s.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(h)}return Rr(h)||(o=!0),i++,e.consume(h),h===92?d:u}function d(h){return h===91||h===92||h===93?(e.consume(h),i++,u):u(h)}}function mwe(e,t,n){const s=this,r=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let i,o=0,a;return c;function c(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(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||Rr(g))return n(g);if(g===93){e.exit("chunkString");const b=e.exit("gfmFootnoteDefinitionLabelString");return i=Cc(s.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return Rr(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 m(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),r.includes(i)||r.push(i),Es(e,p,"gfmFootnoteDefinitionWhitespace")):n(g)}function p(g){return t(g)}}function pwe(e,t,n){return e.check(gv,t,e.attempt(cwe,t,n))}function gwe(e){e.exit("gfmFootnoteDefinition")}function bwe(e,t,n){const s=this;return Es(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 ywe(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 c=-1;for(;++c<o.length;)if(o[c][0]==="enter"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._close){let u=c;for(;u--;)if(o[u][0]==="exit"&&o[u][1].type==="strikethroughSequenceTemporary"&&o[u][1]._open&&o[c][1].end.offset-o[c][1].start.offset===o[u][1].end.offset-o[u][1].start.offset){o[c][1].type="strikethroughSequence",o[u][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},o[u][1].start),end:Object.assign({},o[c][1].end)},h={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[c][1].start)},m=[["enter",d,a],["enter",o[u][1],a],["exit",o[u][1],a],["enter",h,a]],p=a.parser.constructs.insideSpan.null;p&&yl(m,m.length,0,$4(p,o.slice(u+1,c),a)),yl(m,m.length,0,[["exit",h,a],["enter",o[c][1],a],["exit",o[c][1],a],["exit",d,a]]),yl(o,u-1,c-u+3,m),c=u+m.length-2;break}}for(c=-1;++c<o.length;)o[c][1].type==="strikethroughSequenceTemporary"&&(o[c][1].type="data");return o}function i(o,a,c){const u=this.previous,d=this.events;let h=0;return m;function m(g){return u===126&&d[d.length-1][1].type!=="characterEscape"?c(g):(o.enter("strikethroughSequenceTemporary"),p(g))}function p(g){const b=Bg(u);if(g===126)return h>1?c(g):(o.consume(g),h++,p);if(h<2&&!n)return c(g);const v=o.exit("strikethroughSequenceTemporary"),x=Bg(g);return v._open=!x||x===2&&!!b,v._close=!b||b===2&&!!x,a(g)}}}class xwe{constructor(){this.map=[]}add(t,n,s){vwe(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 vwe(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 wwe(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 kwe(){return{flow:{null:{name:"table",tokenize:_we,resolveAll:Swe}}}}function _we(e,t,n){const s=this;let r=0,i=0,o;return a;function a(A){let N=s.events.length-1;for(;N>-1;){const L=s.events[N][1].type;if(L==="lineEnding"||L==="linePrefix")N--;else break}const j=N>-1?s.events[N][1].type:null,P=j==="tableHead"||j==="tableRow"?S:c;return P===S&&s.parser.lazy[s.now().line]?n(A):P(A)}function c(A){return e.enter("tableHead"),e.enter("tableRow"),u(A)}function u(A){return A===124||(o=!0,i+=1),d(A)}function d(A){return A===null?n(A):Nn(A)?i>1?(i=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),p):n(A):Is(A)?Es(e,d,"whitespace")(A):(i+=1,o&&(o=!1,r+=1),A===124?(e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),o=!0,d):(e.enter("data"),h(A)))}function h(A){return A===null||A===124||Rr(A)?(e.exit("data"),d(A)):(e.consume(A),A===92?m:h)}function m(A){return A===92||A===124?(e.consume(A),h):h(A)}function p(A){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(A):(e.enter("tableDelimiterRow"),o=!1,Is(A)?Es(e,g,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):g(A))}function g(A){return A===45||A===58?v(A):A===124?(o=!0,e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),b):T(A)}function b(A){return Is(A)?Es(e,v,"whitespace")(A):v(A)}function v(A){return A===58?(i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(A),e.exit("tableDelimiterMarker"),x):A===45?(i+=1,x(A)):A===null||Nn(A)?k(A):T(A)}function x(A){return A===45?(e.enter("tableDelimiterFiller"),y(A)):T(A)}function y(A){return A===45?(e.consume(A),y):A===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(A),e.exit("tableDelimiterMarker"),w):(e.exit("tableDelimiterFiller"),w(A))}function w(A){return Is(A)?Es(e,k,"whitespace")(A):k(A)}function k(A){return A===124?g(A):A===null||Nn(A)?!o||r!==i?T(A):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(A)):T(A)}function T(A){return n(A)}function S(A){return e.enter("tableRow"),C(A)}function C(A){return A===124?(e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),C):A===null||Nn(A)?(e.exit("tableRow"),t(A)):Is(A)?Es(e,C,"whitespace")(A):(e.enter("data"),_(A))}function _(A){return A===null||A===124||Rr(A)?(e.exit("data"),C(A)):(e.consume(A),A===92?B:_)}function B(A){return A===92||A===124?(e.consume(A),_):_(A)}}function Swe(e,t){let n=-1,s=!0,r=0,i=[0,0,0,0],o=[0,0,0,0],a=!1,c=0,u,d,h;const m=new xwe;for(;++n<e.length;){const p=e[n],g=p[1];p[0]==="enter"?g.type==="tableHead"?(a=!1,c!==0&&(gO(m,t,c,u,d),d=void 0,c=0),u={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},m.add(n,0,[["enter",u,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)},m.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=Kw(m,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=Kw(m,t,i,r,void 0,h)),i=o,o=[i[1],n,0,0])):g.type==="tableHead"?(a=!0,c=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(c=n,i[1]!==0?(o[0]=o[1],h=Kw(m,t,i,r,n,h)):o[1]!==0&&(h=Kw(m,t,o,r,n,h)),r=0):r&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(o[3]=n)}for(c!==0&&gO(m,t,c,u,d),m.consume(t.events),n=-1;++n<t.events.length;){const p=t.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=wwe(t.events,n))}return e}function Kw(e,t,n,s,r,i){const o=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(i.end=Object.assign({},M0(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const c=M0(t.events,n[1]);if(i={type:o,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const u=M0(t.events,n[2]),d=M0(t.events,n[3]),h={type:a,start:Object.assign({},u),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",h,t]]),s!==2){const m=t.events[n[2]],p=t.events[n[3]];if(m[1].end=Object.assign({},p[1].end),m[1].type="chunkText",m[1].contentType="text",n[3]>n[2]+1){const g=n[2]+1,b=n[3]-n[2]-1;e.add(g,b,[])}}e.add(n[3]+1,0,[["exit",h,t]])}return r!==void 0&&(i.end=Object.assign({},M0(t.events,r)),e.add(r,0,[["exit",i,t]]),i=void 0),i}function gO(e,t,n,s,r){const i=[],o=M0(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 M0(e,t){const n=e[t],s=n[0]==="enter"?"start":"end";return n[1][s]}const Cwe={name:"tasklistCheck",tokenize:Ewe};function Twe(){return{text:{91:Cwe}}}function Ewe(e,t,n){const s=this;return r;function r(c){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),i)}function i(c){return Rr(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),o):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),o):n(c)}function o(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):n(c)}function a(c){return Nn(c)?t(c):Is(c)?e.check({tokenize:Awe},t,n)(c):n(c)}}function Awe(e,t,n){return Es(e,s,"whitespace");function s(r){return r===null?n(r):t(r)}}function Nwe(e){return dK([ewe(),uwe(),ywe(e),kwe(),Twe()])}const jwe={};function bO(e){const t=this,n=e||jwe,s=t.data(),r=s.micromarkExtensions||(s.micromarkExtensions=[]),i=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),o=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);r.push(Nwe(n)),i.push(Xve()),o.push(Qve(n))}function Mwe(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:i},exit:{mathFlow:r,mathFlowFence:s,mathFlowFenceMeta:n,mathFlowValue:a,mathText:o,mathTextData:a}};function e(c){const u={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[u]}},c)}function t(){this.buffer()}function n(){const c=this.resume(),u=this.stack[this.stack.length-1];u.type,u.meta=c}function s(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function r(c){const u=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),d=this.stack[this.stack.length-1];d.type,this.exit(c),d.value=u;const h=d.data.hChildren[0];h.type,h.tagName,h.children.push({type:"text",value:u}),this.data.mathFlowInside=void 0}function i(c){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},c),this.buffer()}function o(c){const u=this.resume(),d=this.stack[this.stack.length-1];d.type,this.exit(c),d.value=u,d.data.hChildren.push({type:"text",value:u})}function a(c){this.config.enter.data.call(this,c),this.config.exit.data.call(this,c)}}function Iwe(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,c){const u=i.value||"",d=a.createTracker(c),h="$".repeat(Math.max(BK(u,"$")+1,2)),m=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(`
`),u&&(p+=d.move(u+`
`)),p+=d.move(h),m(),p}function s(i,o,a){let c=i.value||"",u=1;for(t||u++;new RegExp("(^|[^$])"+"\\$".repeat(u)+"([^$]|$)").test(c);)u++;const d="$".repeat(u);/[^ \r\n]/.test(c)&&(/^[ \r\n]/.test(c)&&/[ \r\n]$/.test(c)||/^\$|\$$/.test(c))&&(c=" "+c+" ");let h=-1;for(;++h<a.unsafe.length;){const m=a.unsafe[h];if(!m.atBreak)continue;const p=a.compilePattern(m);let g;for(;g=p.exec(c);){let b=g.index;c.codePointAt(b)===10&&c.codePointAt(b-1)===13&&b--,c=c.slice(0,b)+" "+c.slice(g.index+1)}}return d+c+d}function r(){return"$"}}const Rwe={tokenize:Dwe,concrete:!0,name:"mathFlow"},yO={tokenize:Lwe,partial:!0};function Dwe(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(y){return e.enter("mathFlow"),e.enter("mathFlowFence"),e.enter("mathFlowFenceSequence"),c(y)}function c(y){return y===36?(e.consume(y),o++,c):o<2?n(y):(e.exit("mathFlowFenceSequence"),Es(e,u,"whitespace")(y))}function u(y){return y===null||Nn(y)?h(y):(e.enter("mathFlowFenceMeta"),e.enter("chunkString",{contentType:"string"}),d(y))}function d(y){return y===null||Nn(y)?(e.exit("chunkString"),e.exit("mathFlowFenceMeta"),h(y)):y===36?n(y):(e.consume(y),d)}function h(y){return e.exit("mathFlowFence"),s.interrupt?t(y):e.attempt(yO,m,v)(y)}function m(y){return e.attempt({tokenize:x,partial:!0},v,p)(y)}function p(y){return(i?Es(e,g,"linePrefix",i+1):g)(y)}function g(y){return y===null?v(y):Nn(y)?e.attempt(yO,m,v)(y):(e.enter("mathFlowValue"),b(y))}function b(y){return y===null||Nn(y)?(e.exit("mathFlowValue"),g(y)):(e.consume(y),b)}function v(y){return e.exit("mathFlow"),t(y)}function x(y,w,k){let T=0;return Es(y,S,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function S(B){return y.enter("mathFlowFence"),y.enter("mathFlowFenceSequence"),C(B)}function C(B){return B===36?(T++,y.consume(B),C):T<o?k(B):(y.exit("mathFlowFenceSequence"),Es(y,_,"whitespace")(B))}function _(B){return B===null||Nn(B)?(y.exit("mathFlowFence"),w(B)):k(B)}}}function Lwe(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 Pwe(e){let n=(e||{}).singleDollarTextMath;return n==null&&(n=!0),{tokenize:s,resolve:Owe,previous:Bwe,name:"mathText"};function s(r,i,o){let a=0,c,u;return d;function d(b){return r.enter("mathText"),r.enter("mathTextSequence"),h(b)}function h(b){return b===36?(r.consume(b),a++,h):a<2&&!n?o(b):(r.exit("mathTextSequence"),m(b))}function m(b){return b===null?o(b):b===36?(u=r.enter("mathTextSequence"),c=0,g(b)):b===32?(r.enter("space"),r.consume(b),r.exit("space"),m):Nn(b)?(r.enter("lineEnding"),r.consume(b),r.exit("lineEnding"),m):(r.enter("mathTextData"),p(b))}function p(b){return b===null||b===32||b===36||Nn(b)?(r.exit("mathTextData"),m(b)):(r.consume(b),p)}function g(b){return b===36?(r.consume(b),c++,g):c===a?(r.exit("mathTextSequence"),r.exit("mathText"),i(b)):(u.type="mathTextData",p(b))}}}function Owe(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 Bwe(e){return e!==36||this.events[this.events.length-1][1].type==="characterEscape"}function $we(e){return{flow:{36:Rwe},text:{36:Pwe(e)}}}class _t 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 c=a.slice(r,i).replace(/[^]/g,"$&̲"),u;r>15?u="…"+a.slice(r-15,r):u=a.slice(0,r);var d;i+15<a.length?d=a.slice(i,i+15)+"…":d=a.slice(i),s+=u+c+d}super(s),this.name="ParseError",this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,_t.prototype),this.position=r,r!=null&&i!=null&&(this.length=i-r),this.rawMessage=t}}var zwe=/([A-Z])/g,Fwe=e=>e.replace(zwe,"-$1").toLowerCase(),qwe={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},Hwe=/[&><"']/g,Ho=e=>String(e).replace(Hwe,t=>qwe[t]),N2=e=>e.type==="ordgroup"||e.type==="color"?e.body.length===1?N2(e.body[0]):e:e.type==="font"?N2(e.body):e,Uwe=new Set(["mathord","textord","atom"]),Qd=e=>Uwe.has(N2(e).type),Vwe=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"},W_={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 Wwe(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 Gwe(e){if(e.default!==void 0)return e.default;var t=Array.isArray(e.type)?e.type[0]:e.type;return Wwe(t)}function Kwe(e,t,n,s){var r=n[t];e[t]=r!==void 0?s.processor?s.processor(r):r:Gwe(s)}class aj{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(W_)){var s=W_[n];s&&Kwe(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 _t("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=Vwe(t.url);if(n==null)return!1;t.protocol=n}var s=typeof this.trust=="function"?this.trust(t):this.trust;return!!s}}let bh=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 lu[Ywe[this.id]]}sub(){return lu[Xwe[this.id]]}fracNum(){return lu[Qwe[this.id]]}fracDen(){return lu[Jwe[this.id]]}cramp(){return lu[Zwe[this.id]]}text(){return lu[eke[this.id]]}isTight(){return this.size>=2}};var lj=0,G_=1,dg=2,_d=3,gx=4,Zl=5,$g=6,ma=7,lu=[new bh(lj,0,!1),new bh(G_,0,!0),new bh(dg,1,!1),new bh(_d,1,!0),new bh(gx,2,!1),new bh(Zl,2,!0),new bh($g,3,!1),new bh(ma,3,!0)],Ywe=[gx,Zl,gx,Zl,$g,ma,$g,ma],Xwe=[Zl,Zl,Zl,Zl,ma,ma,ma,ma],Qwe=[dg,_d,gx,Zl,$g,ma,$g,ma],Jwe=[_d,_d,Zl,Zl,ma,ma,ma,ma],Zwe=[G_,G_,_d,_d,Zl,Zl,ma,ma],eke=[lj,G_,dg,_d,dg,_d,dg,_d],ns={DISPLAY:lu[lj],TEXT:lu[dg],SCRIPT:lu[gx],SCRIPTSCRIPT:lu[$g]},q7=[{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 tke(e){for(var t=0;t<q7.length;t++)for(var n=q7[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 j2=[];q7.forEach(e=>e.blocks.forEach(t=>j2.push(...t)));function rY(e){for(var t=0;t<j2.length;t+=2)if(e>=j2[t]&&e<=j2[t+1])return!0;return!1}var $i=e=>e+" "+e,h0=80,nke=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"},ske=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"},rke=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"},ike=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"},oke=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"},ake=function(t){var n=t/2;return"M400000 "+t+" H0 L"+n+" 0 l65 45 L145 "+(t-80)+" H400000z"},lke=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"},cke=function(t,n,s){n=1e3*n;var r="";switch(t){case"sqrtMain":r=nke(n,h0);break;case"sqrtSize1":r=ske(n,h0);break;case"sqrtSize2":r=rke(n,h0);break;case"sqrtSize3":r=ike(n,h0);break;case"sqrtSize4":r=oke(n,h0);break;case"sqrtTall":r=lke(n,h0,s)}return r},uke=function(t,n){switch(t){case"⎜":return $i("M291 0 H417 V"+n+" H291z");case"∣":return $i("M145 0 H188 V"+n+" H145z");case"∥":return $i("M145 0 H188 V"+n+" H145z")+$i("M367 0 H410 V"+n+" H367z");case"⎟":return $i("M457 0 H583 V"+n+" H457z");case"⎢":return $i("M319 0 H403 V"+n+" H319z");case"⎥":return $i("M263 0 H347 V"+n+" H263z");case"⎪":return $i("M384 0 H504 V"+n+" H384z");case"⏐":return $i("M312 0 H355 V"+n+" H312z");case"‖":return $i("M257 0 H300 V"+n+" H257z")+$i("M478 0 H521 V"+n+" H478z");default:return""}},xO={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:$i("M40 281 V428 H0 V94 H40 V241 H400000 v40z"),leftbracketunder:$i("M0 0 h120 V290 H399995 v120 H0z"),leftbracketover:$i("M0 440 h120 V150 H399995 v-120 H0z"),leftmapsto:$i("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:$i("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:$i("M399960 241 V94 h40 V428 h-40 V281 H0 v-40z"),rightbracketunder:$i("M399995 0 h-120 V290 H0 v120 H400000z"),rightbracketover:$i("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`},dke=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 hke(e){return"toText"in e}let C1=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(hke(t))return t.toText();throw new Error("Expected MathDomNode with toText, got "+t.constructor.name)}).join("")}};var H7={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},fke={ex:!0,em:!0,mu:!0},iY=function(t){return typeof t!="string"&&(t=t.unit),t in H7||t in fke||t==="ex"},ai=function(t,n){var s;if(t.unit in H7)s=H7[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 _t("Invalid unit: '"+t.unit+"'");r!==n&&(s*=r.sizeMultiplier/n.sizeMultiplier)}return Math.min(t.number*s,n.maxSize)},Rt=function(t){return+t.toFixed(4)+"em"},vf=function(t){return t.filter(n=>n).join(" ")},cj=function(t){var n="";for(var s of Object.keys(t)){var r=t[s];r!==void 0&&(n+=Fwe(s)+":"+r+";")}return n},oY=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)}},aY=function(t){var n=document.createElement(t);n.className=vf(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},mke=/[\s"'>/=\x00-\x1f]/,lY=function(t){var n="<"+t;this.classes.length&&(n+=' class="'+Ho(vf(this.classes))+'"');var s=cj(this.style);s&&(n+=' style="'+Ho(s)+'"');for(var r of Object.keys(this.attributes)){if(mke.test(r))throw new _t("Invalid attribute name '"+r+"'");n+=" "+r+'="'+Ho(this.attributes[r])+'"'}n+=">";for(var i=0;i<this.children.length;i++)n+=this.children[i].toMarkup();return n+="</"+t+">",n};class T1{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,oY.call(this,t,s,r),this.children=n||[]}setAttribute(t,n){this.attributes[t]=n}hasClass(t){return this.classes.includes(t)}toNode(){return aY.call(this,"span")}toMarkup(){return lY.call(this,"span")}}let q4=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,oY.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 aY.call(this,"a")}toMarkup(){return lY.call(this,"a")}};class pke{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="'+Ho(this.src)+'"'+(' alt="'+Ho(this.alt)+'"'),n=cj(this.style);return n&&(t+=' style="'+Ho(n)+'"'),t+="'/>",t}}var gke={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class _l{constructor(t,n,s,r,i,o,a,c){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=c||{},this.maxFontSize=0;var u=tke(this.text.charCodeAt(0));u&&this.classes.push(u+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=gke[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=Rt(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=vf(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+=Ho(vf(this.classes)),n+='"');var s="";this.italic>0&&(s+="margin-right:"+Rt(this.italic)+";"),s+=cj(this.style),s&&(t=!0,n+=' style="'+Ho(s)+'"');var r=Ho(this.text);return t?(n+=">",n+=r,n+="</span>",n):r}}class qd{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+'="'+Ho(this.attributes[n])+'"';t+=">";for(var s=0;s<this.children.length;s++)t+=this.children[s].toMarkup();return t+="</svg>",t}}class wf{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",xO[this.pathName]),n}toMarkup(){return this.alternate?'<path d="'+Ho(this.alternate)+'"/>':'<path d="'+Ho(xO[this.pathName])+'"/>'}}class U7{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+'="'+Ho(this.attributes[n])+'"';return t+="/>",t}}function bke(e){if(e instanceof _l)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}function yke(e){if(e instanceof T1)return e;throw new Error("Expected span<HtmlDomNode> but got "+String(e)+".")}var xke=e=>e instanceof T1||e instanceof q4||e instanceof C1,bu={"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]}},Yw={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]},vO={Å:"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 cY(e,t){bu[e]=t}function uj(e,t,n){if(!bu[t])throw new Error("Font metrics not found for font: "+t+".");var s=e.charCodeAt(0),r=bu[t][s];if(!r&&e[0]in vO&&(s=vO[e[0]].charCodeAt(0),r=bu[t][s]),!r&&n==="text"&&rY(s)&&(r=bu[t][77]),r)return{depth:r[0],height:r[1],italic:r[2],skew:r[3],width:r[4]}}var uT={};function vke(e){var t;if(e>=5?t=0:e>=3?t=1:t=2,!uT[t]){var n=uT[t]={cssEmPerMu:Yw.quad[t]/18};for(var s in Yw)Yw.hasOwnProperty(s)&&(n[s]=Yw[s][t])}return uT[t]}var Zr={math:{},text:{}};function E(e,t,n,s,r,i){Zr[e][r]={font:t,group:n,replace:s},i&&s&&(Zr[e][s]=Zr[e][r])}var D="math",ft="text",H="main",ae="ams",ti="accent-token",fn="bin",ya="close",E1="inner",Fn="mathord",Pi="op-token",Tl="open",xv="punct",ce="rel",Jd="spacing",be="textord";E(D,H,ce,"≡","\\equiv",!0);E(D,H,ce,"≺","\\prec",!0);E(D,H,ce,"≻","\\succ",!0);E(D,H,ce,"∼","\\sim",!0);E(D,H,ce,"⊥","\\perp");E(D,H,ce,"⪯","\\preceq",!0);E(D,H,ce,"⪰","\\succeq",!0);E(D,H,ce,"≃","\\simeq",!0);E(D,H,ce,"∣","\\mid",!0);E(D,H,ce,"≪","\\ll",!0);E(D,H,ce,"≫","\\gg",!0);E(D,H,ce,"≍","\\asymp",!0);E(D,H,ce,"∥","\\parallel");E(D,H,ce,"⋈","\\bowtie",!0);E(D,H,ce,"⌣","\\smile",!0);E(D,H,ce,"⊑","\\sqsubseteq",!0);E(D,H,ce,"⊒","\\sqsupseteq",!0);E(D,H,ce,"≐","\\doteq",!0);E(D,H,ce,"⌢","\\frown",!0);E(D,H,ce,"∋","\\ni",!0);E(D,H,ce,"∝","\\propto",!0);E(D,H,ce,"⊢","\\vdash",!0);E(D,H,ce,"⊣","\\dashv",!0);E(D,H,ce,"∋","\\owns");E(D,H,xv,".","\\ldotp");E(D,H,xv,"⋅","\\cdotp");E(D,H,xv,"⋅","·");E(ft,H,be,"⋅","·");E(D,H,be,"#","\\#");E(ft,H,be,"#","\\#");E(D,H,be,"&","\\&");E(ft,H,be,"&","\\&");E(D,H,be,"ℵ","\\aleph",!0);E(D,H,be,"∀","\\forall",!0);E(D,H,be,"ℏ","\\hbar",!0);E(D,H,be,"∃","\\exists",!0);E(D,H,be,"∇","\\nabla",!0);E(D,H,be,"♭","\\flat",!0);E(D,H,be,"ℓ","\\ell",!0);E(D,H,be,"♮","\\natural",!0);E(D,H,be,"♣","\\clubsuit",!0);E(D,H,be,"℘","\\wp",!0);E(D,H,be,"♯","\\sharp",!0);E(D,H,be,"♢","\\diamondsuit",!0);E(D,H,be,"ℜ","\\Re",!0);E(D,H,be,"♡","\\heartsuit",!0);E(D,H,be,"ℑ","\\Im",!0);E(D,H,be,"♠","\\spadesuit",!0);E(D,H,be,"§","\\S",!0);E(ft,H,be,"§","\\S");E(D,H,be,"¶","\\P",!0);E(ft,H,be,"¶","\\P");E(D,H,be,"†","\\dag");E(ft,H,be,"†","\\dag");E(ft,H,be,"†","\\textdagger");E(D,H,be,"‡","\\ddag");E(ft,H,be,"‡","\\ddag");E(ft,H,be,"‡","\\textdaggerdbl");E(D,H,ya,"⎱","\\rmoustache",!0);E(D,H,Tl,"⎰","\\lmoustache",!0);E(D,H,ya,"⟯","\\rgroup",!0);E(D,H,Tl,"⟮","\\lgroup",!0);E(D,H,fn,"∓","\\mp",!0);E(D,H,fn,"⊖","\\ominus",!0);E(D,H,fn,"⊎","\\uplus",!0);E(D,H,fn,"⊓","\\sqcap",!0);E(D,H,fn,"∗","\\ast");E(D,H,fn,"⊔","\\sqcup",!0);E(D,H,fn,"◯","\\bigcirc",!0);E(D,H,fn,"∙","\\bullet",!0);E(D,H,fn,"‡","\\ddagger");E(D,H,fn,"≀","\\wr",!0);E(D,H,fn,"⨿","\\amalg");E(D,H,fn,"&","\\And");E(D,H,ce,"⟵","\\longleftarrow",!0);E(D,H,ce,"⇐","\\Leftarrow",!0);E(D,H,ce,"⟸","\\Longleftarrow",!0);E(D,H,ce,"⟶","\\longrightarrow",!0);E(D,H,ce,"⇒","\\Rightarrow",!0);E(D,H,ce,"⟹","\\Longrightarrow",!0);E(D,H,ce,"↔","\\leftrightarrow",!0);E(D,H,ce,"⟷","\\longleftrightarrow",!0);E(D,H,ce,"⇔","\\Leftrightarrow",!0);E(D,H,ce,"⟺","\\Longleftrightarrow",!0);E(D,H,ce,"↦","\\mapsto",!0);E(D,H,ce,"⟼","\\longmapsto",!0);E(D,H,ce,"↗","\\nearrow",!0);E(D,H,ce,"↩","\\hookleftarrow",!0);E(D,H,ce,"↪","\\hookrightarrow",!0);E(D,H,ce,"↘","\\searrow",!0);E(D,H,ce,"↼","\\leftharpoonup",!0);E(D,H,ce,"⇀","\\rightharpoonup",!0);E(D,H,ce,"↙","\\swarrow",!0);E(D,H,ce,"↽","\\leftharpoondown",!0);E(D,H,ce,"⇁","\\rightharpoondown",!0);E(D,H,ce,"↖","\\nwarrow",!0);E(D,H,ce,"⇌","\\rightleftharpoons",!0);E(D,ae,ce,"≮","\\nless",!0);E(D,ae,ce,"","\\@nleqslant");E(D,ae,ce,"","\\@nleqq");E(D,ae,ce,"⪇","\\lneq",!0);E(D,ae,ce,"≨","\\lneqq",!0);E(D,ae,ce,"","\\@lvertneqq");E(D,ae,ce,"⋦","\\lnsim",!0);E(D,ae,ce,"⪉","\\lnapprox",!0);E(D,ae,ce,"⊀","\\nprec",!0);E(D,ae,ce,"⋠","\\npreceq",!0);E(D,ae,ce,"⋨","\\precnsim",!0);E(D,ae,ce,"⪹","\\precnapprox",!0);E(D,ae,ce,"≁","\\nsim",!0);E(D,ae,ce,"","\\@nshortmid");E(D,ae,ce,"∤","\\nmid",!0);E(D,ae,ce,"⊬","\\nvdash",!0);E(D,ae,ce,"⊭","\\nvDash",!0);E(D,ae,ce,"⋪","\\ntriangleleft");E(D,ae,ce,"⋬","\\ntrianglelefteq",!0);E(D,ae,ce,"⊊","\\subsetneq",!0);E(D,ae,ce,"","\\@varsubsetneq");E(D,ae,ce,"⫋","\\subsetneqq",!0);E(D,ae,ce,"","\\@varsubsetneqq");E(D,ae,ce,"≯","\\ngtr",!0);E(D,ae,ce,"","\\@ngeqslant");E(D,ae,ce,"","\\@ngeqq");E(D,ae,ce,"⪈","\\gneq",!0);E(D,ae,ce,"≩","\\gneqq",!0);E(D,ae,ce,"","\\@gvertneqq");E(D,ae,ce,"⋧","\\gnsim",!0);E(D,ae,ce,"⪊","\\gnapprox",!0);E(D,ae,ce,"⊁","\\nsucc",!0);E(D,ae,ce,"⋡","\\nsucceq",!0);E(D,ae,ce,"⋩","\\succnsim",!0);E(D,ae,ce,"⪺","\\succnapprox",!0);E(D,ae,ce,"≆","\\ncong",!0);E(D,ae,ce,"","\\@nshortparallel");E(D,ae,ce,"∦","\\nparallel",!0);E(D,ae,ce,"⊯","\\nVDash",!0);E(D,ae,ce,"⋫","\\ntriangleright");E(D,ae,ce,"⋭","\\ntrianglerighteq",!0);E(D,ae,ce,"","\\@nsupseteqq");E(D,ae,ce,"⊋","\\supsetneq",!0);E(D,ae,ce,"","\\@varsupsetneq");E(D,ae,ce,"⫌","\\supsetneqq",!0);E(D,ae,ce,"","\\@varsupsetneqq");E(D,ae,ce,"⊮","\\nVdash",!0);E(D,ae,ce,"⪵","\\precneqq",!0);E(D,ae,ce,"⪶","\\succneqq",!0);E(D,ae,ce,"","\\@nsubseteqq");E(D,ae,fn,"⊴","\\unlhd");E(D,ae,fn,"⊵","\\unrhd");E(D,ae,ce,"↚","\\nleftarrow",!0);E(D,ae,ce,"↛","\\nrightarrow",!0);E(D,ae,ce,"⇍","\\nLeftarrow",!0);E(D,ae,ce,"⇏","\\nRightarrow",!0);E(D,ae,ce,"↮","\\nleftrightarrow",!0);E(D,ae,ce,"⇎","\\nLeftrightarrow",!0);E(D,ae,ce,"△","\\vartriangle");E(D,ae,be,"ℏ","\\hslash");E(D,ae,be,"▽","\\triangledown");E(D,ae,be,"◊","\\lozenge");E(D,ae,be,"Ⓢ","\\circledS");E(D,ae,be,"®","\\circledR");E(ft,ae,be,"®","\\circledR");E(D,ae,be,"∡","\\measuredangle",!0);E(D,ae,be,"∄","\\nexists");E(D,ae,be,"℧","\\mho");E(D,ae,be,"Ⅎ","\\Finv",!0);E(D,ae,be,"⅁","\\Game",!0);E(D,ae,be,"‵","\\backprime");E(D,ae,be,"▲","\\blacktriangle");E(D,ae,be,"▼","\\blacktriangledown");E(D,ae,be,"■","\\blacksquare");E(D,ae,be,"⧫","\\blacklozenge");E(D,ae,be,"★","\\bigstar");E(D,ae,be,"∢","\\sphericalangle",!0);E(D,ae,be,"∁","\\complement",!0);E(D,ae,be,"ð","\\eth",!0);E(ft,H,be,"ð","ð");E(D,ae,be,"╱","\\diagup");E(D,ae,be,"╲","\\diagdown");E(D,ae,be,"□","\\square");E(D,ae,be,"□","\\Box");E(D,ae,be,"◊","\\Diamond");E(D,ae,be,"¥","\\yen",!0);E(ft,ae,be,"¥","\\yen",!0);E(D,ae,be,"✓","\\checkmark",!0);E(ft,ae,be,"✓","\\checkmark");E(D,ae,be,"ℶ","\\beth",!0);E(D,ae,be,"ℸ","\\daleth",!0);E(D,ae,be,"ℷ","\\gimel",!0);E(D,ae,be,"ϝ","\\digamma",!0);E(D,ae,be,"ϰ","\\varkappa");E(D,ae,Tl,"┌","\\@ulcorner",!0);E(D,ae,ya,"┐","\\@urcorner",!0);E(D,ae,Tl,"└","\\@llcorner",!0);E(D,ae,ya,"┘","\\@lrcorner",!0);E(D,ae,ce,"≦","\\leqq",!0);E(D,ae,ce,"⩽","\\leqslant",!0);E(D,ae,ce,"⪕","\\eqslantless",!0);E(D,ae,ce,"≲","\\lesssim",!0);E(D,ae,ce,"⪅","\\lessapprox",!0);E(D,ae,ce,"≊","\\approxeq",!0);E(D,ae,fn,"⋖","\\lessdot");E(D,ae,ce,"⋘","\\lll",!0);E(D,ae,ce,"≶","\\lessgtr",!0);E(D,ae,ce,"⋚","\\lesseqgtr",!0);E(D,ae,ce,"⪋","\\lesseqqgtr",!0);E(D,ae,ce,"≑","\\doteqdot");E(D,ae,ce,"≓","\\risingdotseq",!0);E(D,ae,ce,"≒","\\fallingdotseq",!0);E(D,ae,ce,"∽","\\backsim",!0);E(D,ae,ce,"⋍","\\backsimeq",!0);E(D,ae,ce,"⫅","\\subseteqq",!0);E(D,ae,ce,"⋐","\\Subset",!0);E(D,ae,ce,"⊏","\\sqsubset",!0);E(D,ae,ce,"≼","\\preccurlyeq",!0);E(D,ae,ce,"⋞","\\curlyeqprec",!0);E(D,ae,ce,"≾","\\precsim",!0);E(D,ae,ce,"⪷","\\precapprox",!0);E(D,ae,ce,"⊲","\\vartriangleleft");E(D,ae,ce,"⊴","\\trianglelefteq");E(D,ae,ce,"⊨","\\vDash",!0);E(D,ae,ce,"⊪","\\Vvdash",!0);E(D,ae,ce,"⌣","\\smallsmile");E(D,ae,ce,"⌢","\\smallfrown");E(D,ae,ce,"≏","\\bumpeq",!0);E(D,ae,ce,"≎","\\Bumpeq",!0);E(D,ae,ce,"≧","\\geqq",!0);E(D,ae,ce,"⩾","\\geqslant",!0);E(D,ae,ce,"⪖","\\eqslantgtr",!0);E(D,ae,ce,"≳","\\gtrsim",!0);E(D,ae,ce,"⪆","\\gtrapprox",!0);E(D,ae,fn,"⋗","\\gtrdot");E(D,ae,ce,"⋙","\\ggg",!0);E(D,ae,ce,"≷","\\gtrless",!0);E(D,ae,ce,"⋛","\\gtreqless",!0);E(D,ae,ce,"⪌","\\gtreqqless",!0);E(D,ae,ce,"≖","\\eqcirc",!0);E(D,ae,ce,"≗","\\circeq",!0);E(D,ae,ce,"≜","\\triangleq",!0);E(D,ae,ce,"∼","\\thicksim");E(D,ae,ce,"≈","\\thickapprox");E(D,ae,ce,"⫆","\\supseteqq",!0);E(D,ae,ce,"⋑","\\Supset",!0);E(D,ae,ce,"⊐","\\sqsupset",!0);E(D,ae,ce,"≽","\\succcurlyeq",!0);E(D,ae,ce,"⋟","\\curlyeqsucc",!0);E(D,ae,ce,"≿","\\succsim",!0);E(D,ae,ce,"⪸","\\succapprox",!0);E(D,ae,ce,"⊳","\\vartriangleright");E(D,ae,ce,"⊵","\\trianglerighteq");E(D,ae,ce,"⊩","\\Vdash",!0);E(D,ae,ce,"∣","\\shortmid");E(D,ae,ce,"∥","\\shortparallel");E(D,ae,ce,"≬","\\between",!0);E(D,ae,ce,"⋔","\\pitchfork",!0);E(D,ae,ce,"∝","\\varpropto");E(D,ae,ce,"◀","\\blacktriangleleft");E(D,ae,ce,"∴","\\therefore",!0);E(D,ae,ce,"∍","\\backepsilon");E(D,ae,ce,"▶","\\blacktriangleright");E(D,ae,ce,"∵","\\because",!0);E(D,ae,ce,"⋘","\\llless");E(D,ae,ce,"⋙","\\gggtr");E(D,ae,fn,"⊲","\\lhd");E(D,ae,fn,"⊳","\\rhd");E(D,ae,ce,"≂","\\eqsim",!0);E(D,H,ce,"⋈","\\Join");E(D,ae,ce,"≑","\\Doteq",!0);E(D,ae,fn,"∔","\\dotplus",!0);E(D,ae,fn,"∖","\\smallsetminus");E(D,ae,fn,"⋒","\\Cap",!0);E(D,ae,fn,"⋓","\\Cup",!0);E(D,ae,fn,"⩞","\\doublebarwedge",!0);E(D,ae,fn,"⊟","\\boxminus",!0);E(D,ae,fn,"⊞","\\boxplus",!0);E(D,ae,fn,"⋇","\\divideontimes",!0);E(D,ae,fn,"⋉","\\ltimes",!0);E(D,ae,fn,"⋊","\\rtimes",!0);E(D,ae,fn,"⋋","\\leftthreetimes",!0);E(D,ae,fn,"⋌","\\rightthreetimes",!0);E(D,ae,fn,"⋏","\\curlywedge",!0);E(D,ae,fn,"⋎","\\curlyvee",!0);E(D,ae,fn,"⊝","\\circleddash",!0);E(D,ae,fn,"⊛","\\circledast",!0);E(D,ae,fn,"⋅","\\centerdot");E(D,ae,fn,"⊺","\\intercal",!0);E(D,ae,fn,"⋒","\\doublecap");E(D,ae,fn,"⋓","\\doublecup");E(D,ae,fn,"⊠","\\boxtimes",!0);E(D,ae,ce,"⇢","\\dashrightarrow",!0);E(D,ae,ce,"⇠","\\dashleftarrow",!0);E(D,ae,ce,"⇇","\\leftleftarrows",!0);E(D,ae,ce,"⇆","\\leftrightarrows",!0);E(D,ae,ce,"⇚","\\Lleftarrow",!0);E(D,ae,ce,"↞","\\twoheadleftarrow",!0);E(D,ae,ce,"↢","\\leftarrowtail",!0);E(D,ae,ce,"↫","\\looparrowleft",!0);E(D,ae,ce,"⇋","\\leftrightharpoons",!0);E(D,ae,ce,"↶","\\curvearrowleft",!0);E(D,ae,ce,"↺","\\circlearrowleft",!0);E(D,ae,ce,"↰","\\Lsh",!0);E(D,ae,ce,"⇈","\\upuparrows",!0);E(D,ae,ce,"↿","\\upharpoonleft",!0);E(D,ae,ce,"⇃","\\downharpoonleft",!0);E(D,H,ce,"⊶","\\origof",!0);E(D,H,ce,"⊷","\\imageof",!0);E(D,ae,ce,"⊸","\\multimap",!0);E(D,ae,ce,"↭","\\leftrightsquigarrow",!0);E(D,ae,ce,"⇉","\\rightrightarrows",!0);E(D,ae,ce,"⇄","\\rightleftarrows",!0);E(D,ae,ce,"↠","\\twoheadrightarrow",!0);E(D,ae,ce,"↣","\\rightarrowtail",!0);E(D,ae,ce,"↬","\\looparrowright",!0);E(D,ae,ce,"↷","\\curvearrowright",!0);E(D,ae,ce,"↻","\\circlearrowright",!0);E(D,ae,ce,"↱","\\Rsh",!0);E(D,ae,ce,"⇊","\\downdownarrows",!0);E(D,ae,ce,"↾","\\upharpoonright",!0);E(D,ae,ce,"⇂","\\downharpoonright",!0);E(D,ae,ce,"⇝","\\rightsquigarrow",!0);E(D,ae,ce,"⇝","\\leadsto");E(D,ae,ce,"⇛","\\Rrightarrow",!0);E(D,ae,ce,"↾","\\restriction");E(D,H,be,"‘","`");E(D,H,be,"$","\\$");E(ft,H,be,"$","\\$");E(ft,H,be,"$","\\textdollar");E(D,H,be,"%","\\%");E(ft,H,be,"%","\\%");E(D,H,be,"_","\\_");E(ft,H,be,"_","\\_");E(ft,H,be,"_","\\textunderscore");E(D,H,be,"∠","\\angle",!0);E(D,H,be,"∞","\\infty",!0);E(D,H,be,"′","\\prime");E(D,H,be,"△","\\triangle");E(D,H,be,"Γ","\\Gamma",!0);E(D,H,be,"Δ","\\Delta",!0);E(D,H,be,"Θ","\\Theta",!0);E(D,H,be,"Λ","\\Lambda",!0);E(D,H,be,"Ξ","\\Xi",!0);E(D,H,be,"Π","\\Pi",!0);E(D,H,be,"Σ","\\Sigma",!0);E(D,H,be,"Υ","\\Upsilon",!0);E(D,H,be,"Φ","\\Phi",!0);E(D,H,be,"Ψ","\\Psi",!0);E(D,H,be,"Ω","\\Omega",!0);E(D,H,be,"A","Α");E(D,H,be,"B","Β");E(D,H,be,"E","Ε");E(D,H,be,"Z","Ζ");E(D,H,be,"H","Η");E(D,H,be,"I","Ι");E(D,H,be,"K","Κ");E(D,H,be,"M","Μ");E(D,H,be,"N","Ν");E(D,H,be,"O","Ο");E(D,H,be,"P","Ρ");E(D,H,be,"T","Τ");E(D,H,be,"X","Χ");E(D,H,be,"¬","\\neg",!0);E(D,H,be,"¬","\\lnot");E(D,H,be,"⊤","\\top");E(D,H,be,"⊥","\\bot");E(D,H,be,"∅","\\emptyset");E(D,ae,be,"∅","\\varnothing");E(D,H,Fn,"α","\\alpha",!0);E(D,H,Fn,"β","\\beta",!0);E(D,H,Fn,"γ","\\gamma",!0);E(D,H,Fn,"δ","\\delta",!0);E(D,H,Fn,"ϵ","\\epsilon",!0);E(D,H,Fn,"ζ","\\zeta",!0);E(D,H,Fn,"η","\\eta",!0);E(D,H,Fn,"θ","\\theta",!0);E(D,H,Fn,"ι","\\iota",!0);E(D,H,Fn,"κ","\\kappa",!0);E(D,H,Fn,"λ","\\lambda",!0);E(D,H,Fn,"μ","\\mu",!0);E(D,H,Fn,"ν","\\nu",!0);E(D,H,Fn,"ξ","\\xi",!0);E(D,H,Fn,"ο","\\omicron",!0);E(D,H,Fn,"π","\\pi",!0);E(D,H,Fn,"ρ","\\rho",!0);E(D,H,Fn,"σ","\\sigma",!0);E(D,H,Fn,"τ","\\tau",!0);E(D,H,Fn,"υ","\\upsilon",!0);E(D,H,Fn,"ϕ","\\phi",!0);E(D,H,Fn,"χ","\\chi",!0);E(D,H,Fn,"ψ","\\psi",!0);E(D,H,Fn,"ω","\\omega",!0);E(D,H,Fn,"ε","\\varepsilon",!0);E(D,H,Fn,"ϑ","\\vartheta",!0);E(D,H,Fn,"ϖ","\\varpi",!0);E(D,H,Fn,"ϱ","\\varrho",!0);E(D,H,Fn,"ς","\\varsigma",!0);E(D,H,Fn,"φ","\\varphi",!0);E(D,H,fn,"∗","*",!0);E(D,H,fn,"+","+");E(D,H,fn,"−","-",!0);E(D,H,fn,"⋅","\\cdot",!0);E(D,H,fn,"∘","\\circ",!0);E(D,H,fn,"÷","\\div",!0);E(D,H,fn,"±","\\pm",!0);E(D,H,fn,"×","\\times",!0);E(D,H,fn,"∩","\\cap",!0);E(D,H,fn,"∪","\\cup",!0);E(D,H,fn,"∖","\\setminus",!0);E(D,H,fn,"∧","\\land");E(D,H,fn,"∨","\\lor");E(D,H,fn,"∧","\\wedge",!0);E(D,H,fn,"∨","\\vee",!0);E(D,H,be,"√","\\surd");E(D,H,Tl,"⟨","\\langle",!0);E(D,H,Tl,"∣","\\lvert");E(D,H,Tl,"∥","\\lVert");E(D,H,ya,"?","?");E(D,H,ya,"!","!");E(D,H,ya,"⟩","\\rangle",!0);E(D,H,ya,"∣","\\rvert");E(D,H,ya,"∥","\\rVert");E(D,H,ce,"=","=");E(D,H,ce,":",":");E(D,H,ce,"≈","\\approx",!0);E(D,H,ce,"≅","\\cong",!0);E(D,H,ce,"≥","\\ge");E(D,H,ce,"≥","\\geq",!0);E(D,H,ce,"←","\\gets");E(D,H,ce,">","\\gt",!0);E(D,H,ce,"∈","\\in",!0);E(D,H,ce,"","\\@not");E(D,H,ce,"⊂","\\subset",!0);E(D,H,ce,"⊃","\\supset",!0);E(D,H,ce,"⊆","\\subseteq",!0);E(D,H,ce,"⊇","\\supseteq",!0);E(D,ae,ce,"⊈","\\nsubseteq",!0);E(D,ae,ce,"⊉","\\nsupseteq",!0);E(D,H,ce,"⊨","\\models");E(D,H,ce,"←","\\leftarrow",!0);E(D,H,ce,"≤","\\le");E(D,H,ce,"≤","\\leq",!0);E(D,H,ce,"<","\\lt",!0);E(D,H,ce,"→","\\rightarrow",!0);E(D,H,ce,"→","\\to");E(D,ae,ce,"≱","\\ngeq",!0);E(D,ae,ce,"≰","\\nleq",!0);E(D,H,Jd," ","\\ ");E(D,H,Jd," ","\\space");E(D,H,Jd," ","\\nobreakspace");E(ft,H,Jd," ","\\ ");E(ft,H,Jd," "," ");E(ft,H,Jd," ","\\space");E(ft,H,Jd," ","\\nobreakspace");E(D,H,Jd,"","\\nobreak");E(D,H,Jd,"","\\allowbreak");E(D,H,xv,",",",");E(D,H,xv,";",";");E(D,ae,fn,"⊼","\\barwedge",!0);E(D,ae,fn,"⊻","\\veebar",!0);E(D,H,fn,"⊙","\\odot",!0);E(D,H,fn,"⊕","\\oplus",!0);E(D,H,fn,"⊗","\\otimes",!0);E(D,H,be,"∂","\\partial",!0);E(D,H,fn,"⊘","\\oslash",!0);E(D,ae,fn,"⊚","\\circledcirc",!0);E(D,ae,fn,"⊡","\\boxdot",!0);E(D,H,fn,"△","\\bigtriangleup");E(D,H,fn,"▽","\\bigtriangledown");E(D,H,fn,"†","\\dagger");E(D,H,fn,"⋄","\\diamond");E(D,H,fn,"⋆","\\star");E(D,H,fn,"◃","\\triangleleft");E(D,H,fn,"▹","\\triangleright");E(D,H,Tl,"{","\\{");E(ft,H,be,"{","\\{");E(ft,H,be,"{","\\textbraceleft");E(D,H,ya,"}","\\}");E(ft,H,be,"}","\\}");E(ft,H,be,"}","\\textbraceright");E(D,H,Tl,"{","\\lbrace");E(D,H,ya,"}","\\rbrace");E(D,H,Tl,"[","\\lbrack",!0);E(ft,H,be,"[","\\lbrack",!0);E(D,H,ya,"]","\\rbrack",!0);E(ft,H,be,"]","\\rbrack",!0);E(D,H,Tl,"(","\\lparen",!0);E(D,H,ya,")","\\rparen",!0);E(ft,H,be,"<","\\textless",!0);E(ft,H,be,">","\\textgreater",!0);E(D,H,Tl,"⌊","\\lfloor",!0);E(D,H,ya,"⌋","\\rfloor",!0);E(D,H,Tl,"⌈","\\lceil",!0);E(D,H,ya,"⌉","\\rceil",!0);E(D,H,be,"\\","\\backslash");E(D,H,be,"∣","|");E(D,H,be,"∣","\\vert");E(ft,H,be,"|","\\textbar",!0);E(D,H,be,"∥","\\|");E(D,H,be,"∥","\\Vert");E(ft,H,be,"∥","\\textbardbl");E(ft,H,be,"~","\\textasciitilde");E(ft,H,be,"\\","\\textbackslash");E(ft,H,be,"^","\\textasciicircum");E(D,H,ce,"↑","\\uparrow",!0);E(D,H,ce,"⇑","\\Uparrow",!0);E(D,H,ce,"↓","\\downarrow",!0);E(D,H,ce,"⇓","\\Downarrow",!0);E(D,H,ce,"↕","\\updownarrow",!0);E(D,H,ce,"⇕","\\Updownarrow",!0);E(D,H,Pi,"∐","\\coprod");E(D,H,Pi,"⋁","\\bigvee");E(D,H,Pi,"⋀","\\bigwedge");E(D,H,Pi,"⨄","\\biguplus");E(D,H,Pi,"⋂","\\bigcap");E(D,H,Pi,"⋃","\\bigcup");E(D,H,Pi,"∫","\\int");E(D,H,Pi,"∫","\\intop");E(D,H,Pi,"∬","\\iint");E(D,H,Pi,"∭","\\iiint");E(D,H,Pi,"∏","\\prod");E(D,H,Pi,"∑","\\sum");E(D,H,Pi,"⨂","\\bigotimes");E(D,H,Pi,"⨁","\\bigoplus");E(D,H,Pi,"⨀","\\bigodot");E(D,H,Pi,"∮","\\oint");E(D,H,Pi,"∯","\\oiint");E(D,H,Pi,"∰","\\oiiint");E(D,H,Pi,"⨆","\\bigsqcup");E(D,H,Pi,"∫","\\smallint");E(ft,H,E1,"…","\\textellipsis");E(D,H,E1,"…","\\mathellipsis");E(ft,H,E1,"…","\\ldots",!0);E(D,H,E1,"…","\\ldots",!0);E(D,H,E1,"⋯","\\@cdots",!0);E(D,H,E1,"⋱","\\ddots",!0);E(D,H,be,"⋮","\\varvdots");E(ft,H,be,"⋮","\\varvdots");E(D,H,ti,"ˊ","\\acute");E(D,H,ti,"ˋ","\\grave");E(D,H,ti,"¨","\\ddot");E(D,H,ti,"~","\\tilde");E(D,H,ti,"ˉ","\\bar");E(D,H,ti,"˘","\\breve");E(D,H,ti,"ˇ","\\check");E(D,H,ti,"^","\\hat");E(D,H,ti,"⃗","\\vec");E(D,H,ti,"˙","\\dot");E(D,H,ti,"˚","\\mathring");E(D,H,Fn,"","\\@imath");E(D,H,Fn,"","\\@jmath");E(D,H,be,"ı","ı");E(D,H,be,"ȷ","ȷ");E(ft,H,be,"ı","\\i",!0);E(ft,H,be,"ȷ","\\j",!0);E(ft,H,be,"ß","\\ss",!0);E(ft,H,be,"æ","\\ae",!0);E(ft,H,be,"œ","\\oe",!0);E(ft,H,be,"ø","\\o",!0);E(ft,H,be,"Æ","\\AE",!0);E(ft,H,be,"Œ","\\OE",!0);E(ft,H,be,"Ø","\\O",!0);E(ft,H,ti,"ˊ","\\'");E(ft,H,ti,"ˋ","\\`");E(ft,H,ti,"ˆ","\\^");E(ft,H,ti,"˜","\\~");E(ft,H,ti,"ˉ","\\=");E(ft,H,ti,"˘","\\u");E(ft,H,ti,"˙","\\.");E(ft,H,ti,"¸","\\c");E(ft,H,ti,"˚","\\r");E(ft,H,ti,"ˇ","\\v");E(ft,H,ti,"¨",'\\"');E(ft,H,ti,"˝","\\H");E(ft,H,ti,"◯","\\textcircled");var uY={"--":!0,"---":!0,"``":!0,"''":!0};E(ft,H,be,"–","--",!0);E(ft,H,be,"–","\\textendash");E(ft,H,be,"—","---",!0);E(ft,H,be,"—","\\textemdash");E(ft,H,be,"‘","`",!0);E(ft,H,be,"‘","\\textquoteleft");E(ft,H,be,"’","'",!0);E(ft,H,be,"’","\\textquoteright");E(ft,H,be,"“","``",!0);E(ft,H,be,"“","\\textquotedblleft");E(ft,H,be,"”","''",!0);E(ft,H,be,"”","\\textquotedblright");E(D,H,be,"°","\\degree",!0);E(ft,H,be,"°","\\degree");E(ft,H,be,"°","\\textdegree",!0);E(D,H,be,"£","\\pounds");E(D,H,be,"£","\\mathsterling",!0);E(ft,H,be,"£","\\pounds");E(ft,H,be,"£","\\textsterling",!0);E(D,ae,be,"✠","\\maltese");E(ft,ae,be,"✠","\\maltese");var wO='0123456789/@."';for(var dT=0;dT<wO.length;dT++){var kO=wO.charAt(dT);E(D,H,be,kO,kO)}var _O='0123456789!@*()-=+";:?/.,';for(var hT=0;hT<_O.length;hT++){var SO=_O.charAt(hT);E(ft,H,be,SO,SO)}var K_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var fT=0;fT<K_.length;fT++){var Xw=K_.charAt(fT);E(D,H,Fn,Xw,Xw),E(ft,H,be,Xw,Xw)}E(D,ae,be,"C","ℂ");E(ft,ae,be,"C","ℂ");E(D,ae,be,"H","ℍ");E(ft,ae,be,"H","ℍ");E(D,ae,be,"N","ℕ");E(ft,ae,be,"N","ℕ");E(D,ae,be,"P","ℙ");E(ft,ae,be,"P","ℙ");E(D,ae,be,"Q","ℚ");E(ft,ae,be,"Q","ℚ");E(D,ae,be,"R","ℝ");E(ft,ae,be,"R","ℝ");E(D,ae,be,"Z","ℤ");E(ft,ae,be,"Z","ℤ");E(D,H,Fn,"h","ℎ");E(ft,H,Fn,"h","ℎ");var Kn;for(var ta=0;ta<K_.length;ta++){var hi=K_.charAt(ta);Kn=String.fromCharCode(55349,56320+ta),E(D,H,Fn,hi,Kn),E(ft,H,be,hi,Kn),Kn=String.fromCharCode(55349,56372+ta),E(D,H,Fn,hi,Kn),E(ft,H,be,hi,Kn),Kn=String.fromCharCode(55349,56424+ta),E(D,H,Fn,hi,Kn),E(ft,H,be,hi,Kn),Kn=String.fromCharCode(55349,56580+ta),E(D,H,Fn,hi,Kn),E(ft,H,be,hi,Kn),Kn=String.fromCharCode(55349,56684+ta),E(D,H,Fn,hi,Kn),E(ft,H,be,hi,Kn),Kn=String.fromCharCode(55349,56736+ta),E(D,H,Fn,hi,Kn),E(ft,H,be,hi,Kn),Kn=String.fromCharCode(55349,56788+ta),E(D,H,Fn,hi,Kn),E(ft,H,be,hi,Kn),Kn=String.fromCharCode(55349,56840+ta),E(D,H,Fn,hi,Kn),E(ft,H,be,hi,Kn),Kn=String.fromCharCode(55349,56944+ta),E(D,H,Fn,hi,Kn),E(ft,H,be,hi,Kn),ta<26&&(Kn=String.fromCharCode(55349,56632+ta),E(D,H,Fn,hi,Kn),E(ft,H,be,hi,Kn),Kn=String.fromCharCode(55349,56476+ta),E(D,H,Fn,hi,Kn),E(ft,H,be,hi,Kn))}Kn="𝕜";E(D,H,Fn,"k",Kn);E(ft,H,be,"k",Kn);for(var ym=0;ym<10;ym++){var yh=ym.toString();Kn=String.fromCharCode(55349,57294+ym),E(D,H,Fn,yh,Kn),E(ft,H,be,yh,Kn),Kn=String.fromCharCode(55349,57314+ym),E(D,H,Fn,yh,Kn),E(ft,H,be,yh,Kn),Kn=String.fromCharCode(55349,57324+ym),E(D,H,Fn,yh,Kn),E(ft,H,be,yh,Kn),Kn=String.fromCharCode(55349,57334+ym),E(D,H,Fn,yh,Kn),E(ft,H,be,yh,Kn)}var V7="ÐÞþ";for(var mT=0;mT<V7.length;mT++){var Qw=V7.charAt(mT);E(D,H,Fn,Qw,Qw),E(ft,H,be,Qw,Qw)}var W7={mathClass:"mathbf",textClass:"textbf",font:"Main-Bold"},CO={mathClass:"mathnormal",textClass:"textit",font:"Math-Italic"},TO={mathClass:"boldsymbol",textClass:"boldsymbol",font:"Main-BoldItalic"},wke={mathClass:"mathscr",textClass:"textscr",font:"Script-Regular"},Dm={mathClass:"",textClass:"",font:""},EO={mathClass:"mathfrak",textClass:"textfrak",font:"Fraktur-Regular"},AO={mathClass:"mathbb",textClass:"textbb",font:"AMS-Regular"},NO={mathClass:"mathboldfrak",textClass:"textboldfrak",font:"Fraktur-Regular"},G7={mathClass:"mathsf",textClass:"textsf",font:"SansSerif-Regular"},K7={mathClass:"mathboldsf",textClass:"textboldsf",font:"SansSerif-Bold"},jO={mathClass:"mathitsf",textClass:"textitsf",font:"SansSerif-Italic"},Y7={mathClass:"mathtt",textClass:"texttt",font:"Typewriter-Regular"},MO=[W7,W7,CO,CO,TO,TO,wke,Dm,Dm,Dm,EO,EO,AO,AO,NO,NO,G7,G7,K7,K7,jO,jO,Dm,Dm,Y7,Y7],kke=[W7,Dm,G7,K7,Y7],_ke=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 MO[r]}else if(120782<=s&&s<=120831){var i=Math.floor((s-120782)/10);return kke[i]}else{if(s===120485||s===120486)return MO[0];if(120486<s&&s<120782)return Dm;throw new _t("Unsupported character: "+e)}},H4=function(t,n,s){if(Zr[s][t]){var r=Zr[s][t].replace;r&&(t=r)}return{value:t,metrics:uj(t,n,s)}},oa=function(t,n,s,r,i){var o=H4(t,n,s),a=o.metrics;t=o.value;var c;if(a){var u=a.italic;(s==="text"||r&&r.font==="mathit")&&(u=0),c=new _l(t,a.height,a.depth,u,a.skew,a.width,i)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+t+"' in style '"+n+"' and mode '"+s+"'")),c=new _l(t,0,0,0,0,0,i);if(r){c.maxFontSize=r.sizeMultiplier,r.style.isTight()&&c.classes.push("mtight");var d=r.getColor();d&&(c.style.color=d)}return c},dj=function(t,n,s,r){return r===void 0&&(r=[]),s.font==="boldsymbol"&&H4(t,"Main-Bold",n).metrics?oa(t,"Main-Bold",n,s,r.concat(["mathbf"])):t==="\\"||Zr[n][t].font==="main"?oa(t,"Main-Regular",n,s,r):oa(t,"AMS-Regular",n,s,r.concat(["amsrm"]))},Ske=function(t,n,s){return s!=="textord"&&H4(t,"Math-BoldItalic",n).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},U4=function(t,n,s){var r=t.mode,i=t.text,o=["mord"],{font:a,fontFamily:c,fontWeight:u,fontShape:d}=n,h=r==="math"||r==="text"&&!!a,m=h?a:c,p="",g="";if(i.charCodeAt(0)===55349){var b=_ke(i);p=b.font,g=b[r+"Class"]}if(p)return oa(i,p,r,n,o.concat(g));if(m){var v,x;if(m==="boldsymbol"){var y=Ske(i,r,s);v=y.fontName,x=[y.fontClass]}else h?(v=X7[a].fontName,x=[a]):(v=Jw(c,u,d),x=[c,u,d]);if(H4(i,v,r).metrics)return oa(i,v,r,n,o.concat(x));if(uY.hasOwnProperty(i)&&v.slice(0,10)==="Typewriter"){for(var w=[],k=0;k<i.length;k++)w.push(oa(i[k],v,r,n,o.concat(x)));return Zd(w)}}if(s==="mathord")return oa(i,"Math-Italic",r,n,o.concat(["mathnormal"]));if(s==="textord"){var T=Zr[r][i]&&Zr[r][i].font;if(T==="ams"){var S=Jw("amsrm",u,d);return oa(i,S,r,n,o.concat("amsrm",u,d))}else if(T==="main"||!T){var C=Jw("textrm",u,d);return oa(i,C,r,n,o.concat(u,d))}else{var _=Jw(T,u,d);return oa(i,_,r,n,o.concat(_,u,d))}}else throw new Error("unexpected type: "+s+" in makeOrd")},Cke=(e,t)=>{if(vf(e.classes)!==vf(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},dY=e=>{for(var t=0;t<e.length-1;t++){var n=e[t],s=e[t+1];n instanceof _l&&s instanceof _l&&Cke(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},hj=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},yt=function(t,n,s,r){var i=new T1(t,n,s,r);return hj(i),i},kf=(e,t,n,s)=>new T1(e,t,n,s),zg=function(t,n,s){var r=yt([t],[],n);return r.height=Math.max(s||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),r.style.borderBottomWidth=Rt(r.height),r.maxFontSize=1,r},Tke=function(t,n,s,r){var i=new q4(t,n,s,r);return hj(i),i},Zd=function(t){var n=new C1(t);return hj(n),n},Fg=function(t,n){return t instanceof C1?yt([],[t],n):t},Eke=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,c=a-(n[o-1].elem.height+n[o-1].elem.depth);i=i+a,s.push({type:"kern",size:c}),s.push(n[o])}return{children:s,depth:r}}var u;if(t.positionType==="top"){for(var d=t.positionData,h=0;h<t.children.length;h++){var m=t.children[h];d-=m.type==="kern"?m.size:m.elem.height+m.elem.depth}u=d}else if(t.positionType==="bottom")u=-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")u=-p.elem.depth-t.positionData;else if(t.positionType==="firstBaseline")u=-p.elem.depth;else throw new Error("Invalid positionType "+t.positionType+".")}return{children:t.children,depth:u}},ur=function(t,n){for(var{children:s,depth:r}=Eke(t),i=0,o=0;o<s.length;o++){var a=s[o];if(a.type==="elem"){var c=a.elem;i=Math.max(i,c.maxFontSize,c.height)}}i+=2;var u=yt(["pstrut"],[]);u.style.height=Rt(i);for(var d=[],h=r,m=r,p=r,g=0;g<s.length;g++){var b=s[g];if(b.type==="kern")p+=b.size;else{var v=b.elem,x=b.wrapperClasses||[],y=b.wrapperStyle||{},w=yt(x,[u,v],void 0,y);w.style.top=Rt(-i-p-v.depth),b.marginLeft&&(w.style.marginLeft=b.marginLeft),b.marginRight&&(w.style.marginRight=b.marginRight),d.push(w),p+=v.height+v.depth}h=Math.min(h,p),m=Math.max(m,p)}var k=yt(["vlist"],d);k.style.height=Rt(m);var T;if(h<0){var S=yt([],[]),C=yt(["vlist"],[S]);C.style.height=Rt(-h);var _=yt(["vlist-s"],[new _l("​")]);T=[yt(["vlist-r"],[k,_]),yt(["vlist-r"],[C])]}else T=[yt(["vlist-r"],[k])];var B=yt(["vlist-t"],T);return T.length===2&&B.classes.push("vlist-t2"),B.height=m,B.depth=-h,B},hY=(e,t)=>{var n=yt(["mspace"],[],t),s=ai(e,t);return n.style.marginRight=Rt(s),n},Jw=(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},X7={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"}},fY={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},mY=function(t,n){var[s,r,i]=fY[t],o=new wf(s),a=new qd([o],{width:Rt(r),height:Rt(i),style:"width:"+Rt(r),viewBox:"0 0 "+1e3*r+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),c=kf(["overlay"],[a],n);return c.height=i,c.style.height=Rt(i),c.style.width=Rt(r),c},ri={number:3,unit:"mu"},xm={number:4,unit:"mu"},Ju={number:5,unit:"mu"},Ake={mord:{mop:ri,mbin:xm,mrel:Ju,minner:ri},mop:{mord:ri,mop:ri,mrel:Ju,minner:ri},mbin:{mord:xm,mop:xm,mopen:xm,minner:xm},mrel:{mord:Ju,mop:Ju,mopen:Ju,minner:Ju},mopen:{},mclose:{mop:ri,mbin:xm,mrel:Ju,minner:ri},mpunct:{mord:ri,mop:ri,mrel:Ju,mopen:ri,mclose:ri,mpunct:ri,minner:ri},minner:{mord:ri,mop:ri,mbin:xm,mrel:Ju,mopen:ri,mpunct:ri,minner:ri}},Nke={mord:{mop:ri},mop:{mord:ri,mop:ri},mbin:{},mrel:{},mopen:{},mclose:{mop:ri},mpunct:{},minner:{mop:ri}},pY={},Y_={},X_={};function nn(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},c=0;c<n.length;++c)pY[n[c]]=a;t&&(i&&(Y_[t]=i),o&&(X_[t]=o))}function Pp(e){var{type:t,htmlBuilder:n,mathmlBuilder:s}=e;nn({type:t,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:s})}var Q_=function(t){return t.type==="ordgroup"&&t.body.length===1?t.body[0]:t},Di=function(t){return t.type==="ordgroup"?t.body:[t]},jke=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),Mke=new Set(["rightmost","mrel","mclose","mpunct"]),Ike={display:ns.DISPLAY,text:ns.TEXT,script:ns.SCRIPT,scriptscript:ns.SCRIPTSCRIPT},Rke={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},Yi=function(t,n,s,r){r===void 0&&(r=[null,null]);for(var i=[],o=0;o<t.length;o++){var a=hr(t[o],n);if(a instanceof C1){var c=a.children;i.push(...c)}else i.push(a)}if(dY(i),!s)return i;var u=n;if(t.length===1){var d=t[0];d.type==="sizing"?u=n.havingSize(d.size):d.type==="styling"&&(u=n.havingStyle(Ike[d.style]))}var h=yt([r[0]||"leftmost"],[],n),m=yt([r[1]||"rightmost"],[],n),p=s==="root";return Q7(i,(g,b)=>{var v=b.classes[0],x=g.classes[0];v==="mbin"&&Mke.has(x)?b.classes[0]="mord":x==="mbin"&&jke.has(v)&&(g.classes[0]="mord")},{node:h},m,p),Q7(i,(g,b)=>{var v,x,y=Z7(b),w=Z7(g),k=y&&w?g.hasClass("mtight")?(v=Nke[y])==null?void 0:v[w]:(x=Ake[y])==null?void 0:x[w]:null;if(k)return hY(k,u)},{node:h},m,p),i},Q7=function(t,n,s,r,i){r&&t.push(r);for(var o=0;o<t.length;o++){var a=t[o],c=gY(a);if(c){Q7(c.children,n,s,null,i);continue}var u=!a.hasClass("mspace");if(u){var d=n(a,s.node);d&&(s.insertAfter?s.insertAfter(d):(t.unshift(d),o++))}u?s.node=a:i&&a.hasClass("newline")&&(s.node=yt(["leftmost"])),s.insertAfter=(h=>m=>{t.splice(h+1,0,m),o++})(o)}r&&t.pop()},gY=function(t){return t instanceof C1||t instanceof q4||t instanceof T1&&t.hasClass("enclosing")?t:null},J7=function(t,n){var s=gY(t);if(s){var r=s.children;if(r.length){if(n==="right")return J7(r[r.length-1],"right");if(n==="left")return J7(r[0],"left")}}return t},Z7=function(t,n){if(!t)return null;n&&(t=J7(t,n));var s=t.classes[0];return Rke[s]||null},bx=function(t,n){var s=["nulldelimiter"].concat(t.baseSizingClasses());return yt(n.concat(s))},hr=function(t,n,s){if(!t)return yt();if(Y_[t.type]){var r=Y_[t.type](t,n);if(s&&n.size!==s.size){r=yt(n.sizingClasses(s),[r],n);var i=n.sizeMultiplier/s.sizeMultiplier;r.height*=i,r.depth*=i}return r}else throw new _t("Got group of unknown type: '"+t.type+"'")};function Zw(e,t){var n=yt(["base"],e,t),s=yt(["strut"]);return s.style.height=Rt(n.height+n.depth),n.depth&&(s.style.verticalAlign=Rt(-n.depth)),n.children.unshift(s),n}function eE(e,t){var n=null;e.length===1&&e[0].type==="tag"&&(n=e[0].tag,e=e[0].body);var s=Yi(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 c=!1;a<s.length-1&&s[a+1].hasClass("mspace")&&!s[a+1].hasClass("newline");)a++,o.push(s[a]),s[a].hasClass("nobreak")&&(c=!0);c||(i.push(Zw(o,t)),o=[])}else s[a].hasClass("newline")&&(o.pop(),o.length>0&&(i.push(Zw(o,t)),o=[]),i.push(s[a]));o.length>0&&i.push(Zw(o,t));var u;n?(u=Zw(Yi(n,t,!0),t),u.classes=["tag"],i.push(u)):r&&i.push(r);var d=yt(["katex-html"],i);if(d.setAttribute("aria-hidden","true"),u){var h=u.children[0];h.style.height=Rt(d.height+d.depth),d.depth&&(h.style.verticalAlign=Rt(-d.depth))}return d}function bY(e){return new C1(e)}class Tt{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=vf(this.classes));for(var s=0;s<this.children.length;s++)if(this.children[s]instanceof Li&&this.children[s+1]instanceof Li){for(var r=this.children[s].toText()+this.children[++s].toText();this.children[s+1]instanceof Li;)r+=this.children[++s].toText();t.appendChild(new Li(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+=Ho(this.attributes[n]),t+='"');this.classes.length>0&&(t+=' class ="'+Ho(vf(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 Li=class{constructor(t){this.text=void 0,this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return Ho(this.toText())}toText(){return this.text}};class yY{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",Rt(this.width)),t}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+Rt(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var Dke=new Set(["\\imath","\\jmath"]),Lke=new Set(["mrow","mtable"]),cc=function(t,n,s){return Zr[n][t]&&Zr[n][t].replace&&t.charCodeAt(0)!==55349&&!(uY.hasOwnProperty(t)&&s&&(s.fontFamily&&s.fontFamily.slice(4,6)==="tt"||s.font&&s.font.slice(4,6)==="tt"))&&(t=Zr[n][t].replace),new Li(t)},fj=function(t){return t.length===1?t[0]:new Tt("mrow",t)},Pke={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"},mj=(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=Pke[n];if(r)return typeof r=="function"?r(e):r;var i=e.text;if(Dke.has(i))return null;if(Zr[s][i]){var o=Zr[s][i].replace;o&&(i=o)}var a=X7[n].fontName;return uj(i,a,s)?X7[n].variant:null};function pT(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){var t=e.children[0];return t instanceof Li&&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 Li&&n.text===","}else return!1}var El=function(t,n,s){if(t.length===1){var r=Dr(t[0],n);return s&&r instanceof Tt&&r.type==="mo"&&(r.setAttribute("lspace","0em"),r.setAttribute("rspace","0em")),[r]}for(var i=[],o,a=0;a<t.length;a++){var c=Dr(t[a],n);if(c instanceof Tt&&o instanceof Tt){if(c.type==="mtext"&&o.type==="mtext"&&c.getAttribute("mathvariant")===o.getAttribute("mathvariant")){o.children.push(...c.children);continue}else if(c.type==="mn"&&o.type==="mn"){o.children.push(...c.children);continue}else if(pT(c)&&o.type==="mn"){o.children.push(...c.children);continue}else if(c.type==="mn"&&pT(o))c.children=[...o.children,...c.children],i.pop();else if((c.type==="msup"||c.type==="msub")&&c.children.length>=1&&(o.type==="mn"||pT(o))){var u=c.children[0];u instanceof Tt&&u.type==="mn"&&(u.children=[...o.children,...u.children],i.pop())}else if(o.type==="mi"&&o.children.length===1){var d=o.children[0];if(d instanceof Li&&d.text==="̸"&&(c.type==="mo"||c.type==="mi"||c.type==="mn")){var h=c.children[0];h instanceof Li&&h.text.length>0&&(h.text=h.text.slice(0,1)+"̸"+h.text.slice(1),i.pop())}}}i.push(c),o=c}return i},_f=function(t,n,s){return fj(El(t,n,s))},Dr=function(t,n){if(!t)return new Tt("mrow");if(X_[t.type])return X_[t.type](t,n);throw new _t("Got group of unknown type: '"+t.type+"'")};function IO(e,t,n,s,r){var i=El(e,n),o;i.length===1&&i[0]instanceof Tt&&Lke.has(i[0].type)?o=i[0]:o=new Tt("mrow",i);var a=new Tt("annotation",[new Li(t)]);a.setAttribute("encoding","application/x-tex");var c=new Tt("semantics",[o,a]),u=new Tt("math",[c]);u.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),s&&u.setAttribute("display","block");var d=r?"katex":"katex-mathml";return yt([d],[u])}var Oke=[[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]],RO=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],DO=function(t,n){return n.size<2?t:Oke[t-1][n.size-1]};class od{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||od.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=RO[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 od(n)}havingStyle(t){return this.style===t?this:this.extend({style:t,size:DO(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:RO[t-1]})}havingBaseStyle(t){t=t||this.style.text();var n=DO(od.BASESIZE,t);return this.size===n&&this.textSize===od.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!==od.BASESIZE?["sizing","reset-size"+this.size,"size"+od.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=vke(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}od.BASESIZE=6;var xY=function(t){return new od({style:t.displayMode?ns.DISPLAY:ns.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},vY=function(t,n){if(n.displayMode){var s=["katex-display"];n.leqno&&s.push("leqno"),n.fleqn&&s.push("fleqn"),t=yt(s,[t])}return t},Bke=function(t,n,s){var r=xY(s),i;if(s.output==="mathml")return IO(t,n,r,s.displayMode,!0);if(s.output==="html"){var o=eE(t,r);i=yt(["katex"],[o])}else{var a=IO(t,n,r,s.displayMode,!1),c=eE(t,r);i=yt(["katex"],[a,c])}return vY(i,s)},$ke=function(t,n,s){var r=xY(s),i=eE(t,r),o=yt(["katex"],[i]);return vY(o,s)},zke={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":"="},V4=function(t){var n=new Tt("mo",[new Li(zke[t.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},Fke={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]},qke=new Set(["widehat","widecheck","widetilde","utilde"]),W4=function(t,n){function s(){var a=4e5,c=t.label.slice(1);if(qke.has(c)&&"base"in t){var u=t.base.type==="ordgroup"?t.base.body.length:1,d,h,m;if(u>5)c==="widehat"||c==="widecheck"?(d=420,a=2364,m=.42,h=c+"4"):(d=312,a=2340,m=.34,h="tilde4");else{var p=[1,1,2,2,3,3][u];c==="widehat"||c==="widecheck"?(a=[0,1062,2364,2364,2364][p],d=[0,239,300,360,420][p],m=[0,.24,.3,.3,.36,.42][p],h=c+p):(a=[0,600,1033,2339,2340][p],d=[0,260,286,306,312][p],m=[0,.26,.286,.3,.306,.34][p],h="tilde"+p)}var g=new wf(h),b=new qd([g],{width:"100%",height:Rt(m),viewBox:"0 0 "+a+" "+d,preserveAspectRatio:"none"});return{span:kf([],[b],n),minWidth:0,height:m}}else{var v=[],x=Fke[c];if(!x)throw new Error('No SVG data for "'+c+'".');var[y,w,k]=x,T=k/1e3,S=y.length,C,_;if(S===1){if(x.length!==4)throw new Error('Expected 4-tuple for single-path SVG data "'+c+'".');C=["hide-tail"],_=[x[3]]}else if(S===2)C=["halfarrow-left","halfarrow-right"],_=["xMinYMin","xMaxYMin"];else if(S===3)C=["brace-left","brace-center","brace-right"],_=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
                    `+S+" children.");for(var B=0;B<S;B++){var A=new wf(y[B]),N=new qd([A],{width:"400em",height:Rt(T),viewBox:"0 0 "+a+" "+k,preserveAspectRatio:_[B]+" slice"}),j=kf([C[B]],[N],n);if(S===1)return{span:j,minWidth:w,height:T};j.style.height=Rt(T),v.push(j)}return{span:yt(["stretchy"],v,n),minWidth:w,height:T}}}var{span:r,minWidth:i,height:o}=s();return r.height=o,r.style.height=Rt(o),i>0&&(r.style.minWidth=Rt(i)),r},Hke=function(t,n,s,r,i){var o,a=t.height+t.depth+s+r;if(/fbox|color|angl/.test(n)){if(o=yt(["stretchy",n],[],i),n==="fbox"){var c=i.color&&i.getColor();c&&(o.style.borderColor=c)}}else{var u=[];/^[bx]cancel$/.test(n)&&u.push(new U7({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&u.push(new U7({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var d=new qd(u,{width:"100%",height:Rt(a)});o=kf([],[d],i)}return o.height=a,o.style.height=Rt(a),o},Uke={bin:1,close:1,inner:1,open:1,punct:1,rel:1},Vke={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1};function Wke(e){return e in Uke}function ys(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 G4(e){var t=K4(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 K4(e){return e&&(e.type==="atom"||Vke.hasOwnProperty(e.type))?e:null}var wY=e=>{if(e instanceof _l)return e;if(xke(e)&&e.children.length===1)return wY(e.children[0])},pj=(e,t)=>{var n,s,r;e&&e.type==="supsub"?(s=ys(e.base,"accent"),n=s.base,e.base=n,r=yke(hr(e,t)),e.base=s):(s=ys(e,"accent"),n=s.base);var i=hr(n,t.havingCrampedStyle()),o=s.isShifty&&Qd(n),a=0;if(o){var c,u;a=(c=(u=wY(i))==null?void 0:u.skew)!=null?c:0}var d=s.label==="\\c",h=d?i.height+i.depth:Math.min(i.height,t.fontMetrics().xHeight),m;if(s.isStretchy)m=W4(s,t),m=ur({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:m,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+Rt(2*a)+")",marginLeft:Rt(2*a)}:void 0}]});else{var p,g;s.label==="\\vec"?(p=mY("vec",t),g=fY.vec[1]):(p=U4({mode:s.mode,text:s.label},t,"textord"),p=bke(p),p.italic=0,g=p.width,d&&(h+=p.depth)),m=yt(["accent-body"],[p]);var b=s.label==="\\textcircled";b&&(m.classes.push("accent-full"),h=i.height);var v=a;b||(v-=g/2),m.style.left=Rt(v),s.label==="\\textcircled"&&(m.style.top=".2em"),m=ur({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-h},{type:"elem",elem:m}]})}var x=yt(["mord","accent"],[m],t);return r?(r.children[0]=x,r.height=Math.max(x.height,r.height),r.classes[0]="mord",r):x},kY=(e,t)=>{var n=e.isStretchy?V4(e.label):new Tt("mo",[cc(e.label,e.mode)]),s=new Tt("mover",[Dr(e.base,t),n]);return s.setAttribute("accent","true"),s},Gke=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));nn({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=Q_(t[0]),s=!Gke.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:pj,mathmlBuilder:kY});nn({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:pj,mathmlBuilder:kY});nn({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=hr(e.base,t),s=W4(e,t),r=e.label==="\\utilde"?.12:0,i=ur({positionType:"top",positionData:n.height,children:[{type:"elem",elem:s,wrapperClasses:["svg-align"]},{type:"kern",size:r},{type:"elem",elem:n}]});return yt(["mord","accentunder"],[i],t)},mathmlBuilder:(e,t)=>{var n=V4(e.label),s=new Tt("munder",[Dr(e.base,t),n]);return s.setAttribute("accentunder","true"),s}});var ek=e=>{var t=new Tt("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};nn({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=Fg(hr(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=Fg(hr(e.below,s,t),t),o.classes.push(i+"-arrow-pad"));var a=W4(e,t),c=-t.fontMetrics().axisHeight+.5*a.height,u=-t.fontMetrics().axisHeight-.5*a.height-.111;(r.depth>.25||e.label==="\\xleftequilibrium")&&(u-=r.depth);var d;if(o){var h=-t.fontMetrics().axisHeight+o.height+.5*a.height+.111;d=ur({positionType:"individualShift",children:[{type:"elem",elem:r,shift:u},{type:"elem",elem:a,shift:c,wrapperClasses:["svg-align"]},{type:"elem",elem:o,shift:h}]})}else d=ur({positionType:"individualShift",children:[{type:"elem",elem:r,shift:u},{type:"elem",elem:a,shift:c,wrapperClasses:["svg-align"]}]});return yt(["mrel","x-arrow"],[d],t)},mathmlBuilder(e,t){var n=V4(e.label);n.setAttribute("minsize",e.label.charAt(0)==="x"?"1.75em":"3.0em");var s;if(e.body){var r=ek(Dr(e.body,t));if(e.below){var i=ek(Dr(e.below,t));s=new Tt("munderover",[n,i,r])}else s=new Tt("mover",[n,r])}else if(e.below){var o=ek(Dr(e.below,t));s=new Tt("munder",[n,o])}else s=ek(),s=new Tt("mover",[n,s]);return s}});function _Y(e,t){var n=Yi(e.body,t,!0);return yt([e.mclass],n,t)}function SY(e,t){var n,s=El(e.body,t);return e.mclass==="minner"?n=new Tt("mpadded",s):e.mclass==="mord"?e.isCharacterBox?(n=s[0],n.type="mi"):n=new Tt("mi",s):(e.isCharacterBox?(n=s[0],n.type="mo"):n=new Tt("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}nn({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:Di(r),isCharacterBox:Qd(r)}},htmlBuilder:_Y,mathmlBuilder:SY});var Y4=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"};nn({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:n}=e;return{type:"mclass",mode:n.mode,mclass:Y4(t[0]),body:Di(t[1]),isCharacterBox:Qd(t[1])}}});nn({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=Y4(r):o="mrel";var a={type:"op",mode:r.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:s!=="\\stackrel",body:Di(r)},c={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:[c],isCharacterBox:Qd(c)}},htmlBuilder:_Y,mathmlBuilder:SY});nn({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"pmb",mode:n.mode,mclass:Y4(t[0]),body:Di(t[0])}},htmlBuilder(e,t){var n=Yi(e.body,t,!0),s=yt([e.mclass],n,t);return s.style.textShadow="0.02em 0.01em 0.04px",s},mathmlBuilder(e,t){var n=El(e.body,t),s=new Tt("mstyle",n);return s.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),s}});var Kke={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},LO=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),PO=e=>e.type==="textord"&&e.text==="@",Yke=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;function Xke(e,t,n){var s=Kke[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]],[]),c={type:"ordgroup",mode:"math",body:[r,o,a]};return n.callFunction("\\\\cdparent",[c],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var u={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[u],[])}default:return{type:"textord",text:" ",mode:"math"}}}function Qke(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 _t("Expected \\\\ or \\cr or \\end",e.nextToken)}for(var s=[],r=[s],i=0;i<t.length;i++){for(var o=t[i],a=LO(),c=0;c<o.length;c++)if(!PO(o[c]))a.body.push(o[c]);else{s.push(a),c+=1;var u=G4(o[c]).text,d=new Array(2);if(d[0]={type:"ordgroup",mode:"math",body:[]},d[1]={type:"ordgroup",mode:"math",body:[]},!"=|.".includes(u))if("<>AV".includes(u))for(var h=0;h<2;h++){for(var m=!0,p=c+1;p<o.length;p++){if(Yke(o[p],u)){m=!1,c=p;break}if(PO(o[p]))throw new _t("Missing a "+u+" character to complete a CD arrow.",o[p]);d[h].body.push(o[p])}if(m)throw new _t("Missing a "+u+" character to complete a CD arrow.",o[c])}else throw new _t('Expected one of "<>AV=|." after @',o[c]);var g=Xke(u,d,e),b={type:"styling",body:[g],mode:"math",style:"display",resetFont:!0};s.push(b),a=LO()}i%2===0?s.push(a):s.shift(),s=[],r.push(s)}e.gullet.endGroup(),e.gullet.endGroup();var v=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:v,colSeparationType:"CD",hLinesBeforeRow:new Array(r.length+1).fill([])}}nn({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=Fg(hr(e.label,n,t),t);return s.classes.push("cd-label-"+e.side),s.style.bottom=Rt(.8-s.depth),s.height=0,s.depth=0,s},mathmlBuilder(e,t){var n=new Tt("mrow",[Dr(e.label,t)]);return n=new Tt("mpadded",[n]),n.setAttribute("width","0"),e.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new Tt("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});nn({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=Fg(hr(e.fragment,t),t);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(e,t){return new Tt("mrow",[Dr(e.fragment,t)])}});nn({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:n}=e,s=ys(t[0],"ordgroup"),r=s.body,i="",o=0;o<r.length;o++){var a=ys(r[o],"textord");i+=a.text}var c=parseInt(i),u;if(isNaN(c))throw new _t("\\@char has non-numeric argument "+i);if(c<0||c>=1114111)throw new _t("\\@char with invalid code point "+i);return c<=65535?u=String.fromCharCode(c):(c-=65536,u=String.fromCharCode((c>>10)+55296,(c&1023)+56320)),{type:"textord",mode:n.mode,text:u}}});var CY=(e,t)=>{var n=Yi(e.body,t.withColor(e.color),!1);return Zd(n)},TY=(e,t)=>{var n=El(e.body,t.withColor(e.color)),s=new Tt("mstyle",n);return s.setAttribute("mathcolor",e.color),s};nn({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:n}=e,s=ys(t[0],"color-token").color,r=t[1];return{type:"color",mode:n.mode,color:s,body:Di(r)}},htmlBuilder:CY,mathmlBuilder:TY});nn({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,t){var{parser:n,breakOnTokenText:s}=e,r=ys(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:CY,mathmlBuilder:TY});nn({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&&ys(r,"size").value}},htmlBuilder(e,t){var n=yt(["mspace"],[],t);return e.newLine&&(n.classes.push("newline"),e.size&&(n.style.marginTop=Rt(ai(e.size,t)))),n},mathmlBuilder(e,t){var n=new Tt("mspace");return e.newLine&&(n.setAttribute("linebreak","newline"),e.size&&n.setAttribute("height",Rt(ai(e.size,t)))),n}});var tE={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},EY=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new _t("Expected a control sequence",e);return t},Jke=e=>{var t=e.gullet.popToken();return t.text==="="&&(t=e.gullet.popToken(),t.text===" "&&(t=e.gullet.popToken())),t},AY=(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)};nn({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(tE[s.text])return(n==="\\global"||n==="\\\\globallong")&&(s.text=tE[s.text]),ys(t.parseFunction(),"internal");throw new _t("Invalid token after macro prefix",s)}});nn({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 _t("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 _t('Invalid argument number "'+s.text+'"');if(parseInt(s.text)!==i+1)throw new _t('Argument number "'+s.text+'" out of order');i++,a.push([])}else{if(s.text==="EOF")throw new _t("Expected a macro definition");a[i].push(s.text)}var{tokens:c}=t.gullet.consumeArg();return o&&c.unshift(o),(n==="\\edef"||n==="\\xdef")&&(c=t.gullet.expandTokens(c),c.reverse()),t.gullet.macros.set(r,{tokens:c,numArgs:i,delimiters:a},n===tE[n]),{type:"internal",mode:t.mode}}});nn({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,s=EY(t.gullet.popToken());t.gullet.consumeSpaces();var r=Jke(t);return AY(t,s,r,n==="\\\\globallet"),{type:"internal",mode:t.mode}}});nn({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,s=EY(t.gullet.popToken()),r=t.gullet.popToken(),i=t.gullet.popToken();return AY(t,s,i,n==="\\\\globalfuture"),t.gullet.pushToken(i),t.gullet.pushToken(r),{type:"internal",mode:t.mode}}});var Jb=function(t,n,s){var r=Zr.math[t]&&Zr.math[t].replace,i=uj(r||t,n,s);if(!i)throw new Error("Unsupported symbol "+t+" and font size "+n+".");return i},gj=function(t,n,s,r){var i=s.havingBaseStyle(n),o=yt(r.concat(i.sizingClasses(s)),[t],s),a=i.sizeMultiplier/s.sizeMultiplier;return o.height*=a,o.depth*=a,o.maxFontSize=i.sizeMultiplier,o},NY=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=Rt(i),t.height-=i,t.depth+=i},Zke=function(t,n,s,r,i,o){var a=oa(t,"Main-Regular",i,r),c=gj(a,n,r,o);return NY(c,r,n),c},e2e=function(t,n,s,r){return oa(t,"Size"+n+"-Regular",s,r)},jY=function(t,n,s,r,i,o){var a=e2e(t,n,i,r),c=gj(yt(["delimsizing","size"+n],[a],r),ns.TEXT,r,o);return s&&NY(c,r,ns.TEXT),c},gT=function(t,n,s){var r;n==="Size1-Regular"?r="delim-size1":r="delim-size4";var i=yt(["delimsizinginner",r],[yt([],[oa(t,n,s)])]);return{type:"elem",elem:i}},bT=function(t,n,s){var r=bu["Size4-Regular"][t.charCodeAt(0)]?bu["Size4-Regular"][t.charCodeAt(0)][4]:bu["Size1-Regular"][t.charCodeAt(0)][4],i=new wf("inner",uke(t,Math.round(1e3*n))),o=new qd([i],{width:Rt(r),height:Rt(n),style:"width:"+Rt(r),viewBox:"0 0 "+1e3*r+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),a=kf([],[o],s);return a.height=n,a.style.height=Rt(n),a.style.width=Rt(r),{type:"elem",elem:a}},nE=.008,tk={type:"kern",size:-1*nE},t2e=new Set(["|","\\lvert","\\rvert","\\vert"]),n2e=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),MY=function(t,n,s,r,i,o){var a,c,u,d,h="",m=0;a=u=d=t,c=null;var p="Size1-Regular";t==="\\uparrow"?u=d="⏐":t==="\\Uparrow"?u=d="‖":t==="\\downarrow"?a=u="⏐":t==="\\Downarrow"?a=u="‖":t==="\\updownarrow"?(a="\\uparrow",u="⏐",d="\\downarrow"):t==="\\Updownarrow"?(a="\\Uparrow",u="‖",d="\\Downarrow"):t2e.has(t)?(u="∣",h="vert",m=333):n2e.has(t)?(u="∥",h="doublevert",m=556):t==="["||t==="\\lbrack"?(a="⎡",u="⎢",d="⎣",p="Size4-Regular",h="lbrack",m=667):t==="]"||t==="\\rbrack"?(a="⎤",u="⎥",d="⎦",p="Size4-Regular",h="rbrack",m=667):t==="\\lfloor"||t==="⌊"?(u=a="⎢",d="⎣",p="Size4-Regular",h="lfloor",m=667):t==="\\lceil"||t==="⌈"?(a="⎡",u=d="⎢",p="Size4-Regular",h="lceil",m=667):t==="\\rfloor"||t==="⌋"?(u=a="⎥",d="⎦",p="Size4-Regular",h="rfloor",m=667):t==="\\rceil"||t==="⌉"?(a="⎤",u=d="⎥",p="Size4-Regular",h="rceil",m=667):t==="("||t==="\\lparen"?(a="⎛",u="⎜",d="⎝",p="Size4-Regular",h="lparen",m=875):t===")"||t==="\\rparen"?(a="⎞",u="⎟",d="⎠",p="Size4-Regular",h="rparen",m=875):t==="\\{"||t==="\\lbrace"?(a="⎧",c="⎨",d="⎩",u="⎪",p="Size4-Regular"):t==="\\}"||t==="\\rbrace"?(a="⎫",c="⎬",d="⎭",u="⎪",p="Size4-Regular"):t==="\\lgroup"||t==="⟮"?(a="⎧",d="⎩",u="⎪",p="Size4-Regular"):t==="\\rgroup"||t==="⟯"?(a="⎫",d="⎭",u="⎪",p="Size4-Regular"):t==="\\lmoustache"||t==="⎰"?(a="⎧",d="⎭",u="⎪",p="Size4-Regular"):(t==="\\rmoustache"||t==="⎱")&&(a="⎫",d="⎩",u="⎪",p="Size4-Regular");var g=Jb(a,p,i),b=g.height+g.depth,v=Jb(u,p,i),x=v.height+v.depth,y=Jb(d,p,i),w=y.height+y.depth,k=0,T=1;if(c!==null){var S=Jb(c,p,i);k=S.height+S.depth,T=2}var C=b+w+k,_=Math.max(0,Math.ceil((n-C)/(T*x))),B=C+_*T*x,A=r.fontMetrics().axisHeight;s&&(A*=r.sizeMultiplier);var N=B/2-A,j=[];if(h.length>0){var P=B-b-w,L=Math.round(B*1e3),O=dke(h,Math.round(P*1e3)),$=new wf(h,O),z=Rt(m/1e3),F=Rt(L/1e3),G=new qd([$],{width:z,height:F,viewBox:"0 0 "+m+" "+L}),I=kf([],[G],r);I.height=L/1e3,I.style.width=z,I.style.height=F,j.push({type:"elem",elem:I})}else{if(j.push(gT(d,p,i)),j.push(tk),c===null){var Q=B-b-w+2*nE;j.push(bT(u,Q,r))}else{var V=(B-b-w-k)/2+2*nE;j.push(bT(u,V,r)),j.push(tk),j.push(gT(c,p,i)),j.push(tk),j.push(bT(u,V,r))}j.push(tk),j.push(gT(a,p,i))}var M=r.havingBaseStyle(ns.TEXT),re=ur({positionType:"bottom",positionData:N,children:j});return gj(yt(["delimsizing","mult"],[re],M),ns.TEXT,r,o)},yT=80,xT=.08,vT=function(t,n,s,r,i){var o=cke(t,r,s),a=new wf(t,o),c=new qd([a],{width:"400em",height:Rt(n),viewBox:"0 0 400000 "+s,preserveAspectRatio:"xMinYMin slice"});return kf(["hide-tail"],[c],i)},s2e=function(t,n){var s=n.havingBaseSizing(),r=PY("\\surd",t*s.sizeMultiplier,LY,s),i=s.sizeMultiplier,o=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),a,c,u,d,h;return r.type==="small"?(d=1e3+1e3*o+yT,t<1?i=1:t<1.4&&(i=.7),c=(1+o+xT)/i,u=(1+o)/i,a=vT("sqrtMain",c,d,o,n),a.style.minWidth="0.853em",h=.833/i):r.type==="large"?(d=(1e3+yT)*Py[r.size],u=(Py[r.size]+o)/i,c=(Py[r.size]+o+xT)/i,a=vT("sqrtSize"+r.size,c,d,o,n),a.style.minWidth="1.02em",h=1/i):(c=t+o+xT,u=t+o,d=Math.floor(1e3*t+o)+yT,a=vT("sqrtTall",c,d,o,n),a.style.minWidth="0.742em",h=1.056),a.height=u,a.style.height=Rt(c),{span:a,advanceWidth:h,ruleWidth:(n.fontMetrics().sqrtRuleThickness+o)*i}},IY=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),r2e=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),RY=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),Py=[0,1.2,1.8,2.4,3],DY=function(t,n,s,r,i){if(t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle"),IY.has(t)||RY.has(t))return jY(t,n,!1,s,r,i);if(r2e.has(t))return MY(t,Py[n],!1,s,r,i);throw new _t("Illegal delimiter: '"+t+"'")},i2e=[{type:"small",style:ns.SCRIPTSCRIPT},{type:"small",style:ns.SCRIPT},{type:"small",style:ns.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],o2e=[{type:"small",style:ns.SCRIPTSCRIPT},{type:"small",style:ns.SCRIPT},{type:"small",style:ns.TEXT},{type:"stack"}],LY=[{type:"small",style:ns.SCRIPTSCRIPT},{type:"small",style:ns.SCRIPT},{type:"small",style:ns.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],a2e=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.")},PY=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 c=Jb(t,a2e(a),"math"),u=c.height+c.depth;if(a.type==="small"){var d=r.havingBaseStyle(a.style);u*=d.sizeMultiplier}if(u>n)return a}return s[s.length-1]},sE=function(t,n,s,r,i,o){t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle");var a;RY.has(t)?a=i2e:IY.has(t)?a=LY:a=o2e;var c=PY(t,n,a,r);return c.type==="small"?Zke(t,c.style,s,r,i,o):c.type==="large"?jY(t,c.size,s,r,i,o):MY(t,n,s,r,i,o)},wT=function(t,n,s,r,i,o){var a=r.fontMetrics().axisHeight*r.sizeMultiplier,c=901,u=5/r.fontMetrics().ptPerEm,d=Math.max(n-a,s+a),h=Math.max(d/500*c,2*d-u);return sE(t,h,!0,r,i,o)},OO={"\\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}},l2e=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 BO(e){return"isMiddle"in e}function X4(e,t){var n=K4(e);if(n&&l2e.has(n.text))return n;throw n?new _t("Invalid delimiter '"+n.text+"' after '"+t.funcName+"'",e):new _t("Invalid delimiter type '"+e.type+"'",e)}nn({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=X4(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:OO[e.funcName].size,mclass:OO[e.funcName].mclass,delim:n.text}},htmlBuilder:(e,t)=>e.delim==="."?yt([e.mclass]):DY(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];e.delim!=="."&&t.push(cc(e.delim,e.mode));var n=new Tt("mo",t);e.mclass==="mopen"||e.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var s=Rt(Py[e.size]);return n.setAttribute("minsize",s),n.setAttribute("maxsize",s),n}});function $O(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}nn({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 _t("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:X4(t[0],e).text,color:n}}});nn({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=X4(t[0],e),s=e.parser;++s.leftrightDepth;var r=s.parseExpression(!1);--s.leftrightDepth,s.expect("\\right",!1);var i=ys(s.parseFunction(),"leftright-right");return{type:"leftright",mode:s.mode,body:r,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(e,t)=>{$O(e);for(var n=Yi(e.body,t,!0,["mopen","mclose"]),s=0,r=0,i=!1,o=0;o<n.length;o++){var a=n[o];BO(a)?i=!0:(s=Math.max(n[o].height,s),r=Math.max(n[o].depth,r))}s*=t.sizeMultiplier,r*=t.sizeMultiplier;var c;if(e.left==="."?c=bx(t,["mopen"]):c=wT(e.left,s,r,t,e.mode,["mopen"]),n.unshift(c),i)for(var u=1;u<n.length;u++){var d=n[u];if(BO(d)){var h=d.isMiddle;n[u]=wT(h.delim,s,r,h.options,e.mode,[])}}var m;if(e.right===".")m=bx(t,["mclose"]);else{var p=e.rightColor?t.withColor(e.rightColor):t;m=wT(e.right,s,r,p,e.mode,["mclose"])}return n.push(m),yt(["minner"],n,t)},mathmlBuilder:(e,t)=>{$O(e);var n=El(e.body,t);if(e.left!=="."){var s=new Tt("mo",[cc(e.left,e.mode)]);s.setAttribute("fence","true"),n.unshift(s)}if(e.right!=="."){var r=new Tt("mo",[cc(e.right,e.mode)]);r.setAttribute("fence","true"),e.rightColor&&r.setAttribute("mathcolor",e.rightColor),n.push(r)}return fj(n)}});nn({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=X4(t[0],e);if(!e.parser.leftrightDepth)throw new _t("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},htmlBuilder:(e,t)=>{var n;return e.delim==="."?n=bx(t,[]):(n=DY(e.delim,1,t,e.mode,[]),n.isMiddle={delim:e.delim,options:t}),n},mathmlBuilder:(e,t)=>{var n=e.delim==="\\vert"||e.delim==="|"?cc("|","text"):cc(e.delim,e.mode),s=new Tt("mo",[n]);return s.setAttribute("fence","true"),s.setAttribute("lspace","0.05em"),s.setAttribute("rspace","0.05em"),s}});var Q4=(e,t)=>{var n=Fg(hr(e.body,t),t),s=e.label.slice(1),r=t.sizeMultiplier,i,o,a=Qd(e.body);if(s==="sout")i=yt(["stretchy","sout"]),i.height=t.fontMetrics().defaultRuleThickness/r,o=-.5*t.fontMetrics().xHeight;else if(s==="phase"){var c=ai({number:.6,unit:"pt"},t),u=ai({number:.35,unit:"ex"},t),d=t.havingBaseSizing();r=r/d.sizeMultiplier;var h=n.height+n.depth+c+u;n.style.paddingLeft=Rt(h/2+c);var m=Math.floor(1e3*h*r),p=ake(m),g=new qd([new wf("phase",p)],{width:"400em",height:Rt(m/1e3),viewBox:"0 0 400000 "+m,preserveAspectRatio:"xMinYMin slice"});i=kf(["hide-tail"],[g],t),i.style.height=Rt(h),o=n.depth+c+u}else{/cancel/.test(s)?a||n.classes.push("cancel-pad"):s==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var b,v,x=0;/box/.test(s)?(x=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),b=t.fontMetrics().fboxsep+(s==="colorbox"?0:x),v=b):s==="angl"?(x=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness),b=4*x,v=Math.max(0,.25-n.depth)):(b=a?.2:0,v=b),i=Hke(n,s,b,v,t),/fbox|boxed|fcolorbox/.test(s)?(i.style.borderStyle="solid",i.style.borderWidth=Rt(x)):s==="angl"&&x!==.049&&(i.style.borderTopWidth=Rt(x),i.style.borderRightWidth=Rt(x)),o=n.depth+v,e.backgroundColor&&(i.style.backgroundColor=e.backgroundColor,e.borderColor&&(i.style.borderColor=e.borderColor))}var y;if(e.backgroundColor)y=ur({positionType:"individualShift",children:[{type:"elem",elem:i,shift:o},{type:"elem",elem:n,shift:0}]});else{var w=/cancel|phase/.test(s)?["svg-align"]:[];y=ur({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:o,wrapperClasses:w}]})}return/cancel/.test(s)&&(y.height=n.height,y.depth=n.depth),/cancel/.test(s)&&!a?yt(["mord","cancel-lap"],[y],t):yt(["mord"],[y],t)},J4=(e,t)=>{var n,s=new Tt(e.label.includes("colorbox")?"mpadded":"menclose",[Dr(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: "+Rt(r)+" solid "+e.borderColor)}break;case"\\xcancel":s.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return e.backgroundColor&&s.setAttribute("mathbackground",e.backgroundColor),s};nn({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","hbox"]},handler(e,t,n){var{parser:s,funcName:r}=e,i=ys(t[0],"color-token").color,o=t[1];return{type:"enclose",mode:s.mode,label:r,backgroundColor:i,body:o}},htmlBuilder:Q4,mathmlBuilder:J4});nn({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"]},handler(e,t,n){var{parser:s,funcName:r}=e,i=ys(t[0],"color-token").color,o=ys(t[1],"color-token").color,a=t[2];return{type:"enclose",mode:s.mode,label:r,backgroundColor:o,borderColor:i,body:a}},htmlBuilder:Q4,mathmlBuilder:J4});nn({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]}}});nn({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:Q4,mathmlBuilder:J4});nn({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:Q4,mathmlBuilder:J4});nn({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 OY={};function Ou(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},c=0;c<n.length;++c)OY[n[c]]=a;i&&(Y_[t]=i),o&&(X_[t]=o)}var BY={};function Y(e,t){BY[e]=t}class Da{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 Da(t.loc.lexer,t.loc.start,n.loc.end):t&&t.loc}}class xl{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 xl(n,Da.range(this,t))}}function zO(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 Z4=e=>{var t=e.parser.settings;if(!t.displayMode)throw new _t("{"+e.envName+"} can be used only in display mode.")},c2e=new Set(["gather","gather*"]);function bj(e){if(!e.includes("ed"))return!e.includes("*")}function Wf(e,t,n){var{hskipBeforeAndAfter:s,addJot:r,cols:i,arraystretch:o,colSeparationType:a,autoTag:c,singleRow:u,emptySingleRow:d,maxNumCols:h,leqno:m}=t;if(e.gullet.beginGroup(),u||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 _t("Invalid \\arraystretch: "+p)}e.gullet.beginGroup();var g=[],b=[g],v=[],x=[],y=c!=null?[]:void 0;function w(){c&&e.gullet.macros.set("\\@eqnsw","1",!0)}function k(){y&&(e.gullet.macros.get("\\df@tag")?(y.push(e.subparse([new xl("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):y.push(!!c&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(w(),x.push(zO(e));;){var T=e.parseExpression(!1,u?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup();var S={type:"ordgroup",mode:e.mode,body:T};n&&(S={type:"styling",mode:e.mode,style:n,resetFont:!0,body:[S]}),g.push(S);var C=e.fetch().text;if(C==="&"){if(h&&g.length===h){if(u||a)throw new _t("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else if(C==="\\end"){k(),g.length===1&&S.type==="styling"&&S.body.length===1&&S.body[0].type==="ordgroup"&&S.body[0].body.length===0&&(b.length>1||!d)&&b.pop(),x.length<b.length+1&&x.push([]);break}else if(C==="\\\\"){e.consume();var _=void 0;e.gullet.future().text!==" "&&(_=e.parseSizeGroup(!0)),v.push(_?_.value:null),k(),x.push(zO(e)),g=[],b.push(g),w()}else throw new _t("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:b,cols:i,rowGaps:v,hskipBeforeAndAfter:s,hLinesBeforeRow:x,colSeparationType:a,tags:y,leqno:m}}function yj(e){return e.slice(0,1)==="d"?"display":"text"}var Bu=function(t,n){var s,r,i=t.body.length,o=t.hLinesBeforeRow,a=0,c=new Array(i),u=[],d=Math.max(n.fontMetrics().arrayRuleWidth,n.minRuleThickness),h=1/n.fontMetrics().ptPerEm,m=5*h;if(t.colSeparationType&&t.colSeparationType==="small"){var p=n.havingStyle(ns.SCRIPT).sizeMultiplier;m=.2778*(p/n.sizeMultiplier)}var g=t.colSeparationType==="CD"?ai({number:3,unit:"ex"},n):12*h,b=3*h,v=t.arraystretch*g,x=.7*v,y=.3*v,w=0;function k(gt){for(var We=0;We<gt.length;++We)We>0&&(w+=.25),u.push({pos:w,isDashed:gt[We]})}for(k(o[0]),s=0;s<t.body.length;++s){var T=t.body[s],S=x,C=y;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 B=hr(T[r],n);C<B.depth&&(C=B.depth),S<B.height&&(S=B.height),_.cells[r]=B}var A=t.rowGaps[s],N=0;A&&(N=ai(A,n),N>0&&(N+=y,C<N&&(C=N),N=0)),t.addJot&&s<t.body.length-1&&(C+=b),_.height=S,_.depth=C,w+=S,_.pos=w,w+=C+N,c[s]=_,k(o[s+1])}var j=w/2+n.fontMetrics().axisHeight,P=t.cols||[],L=[],O,$,z=[];if(t.tags&&t.tags.some(gt=>gt))for(s=0;s<i;++s){var F=c[s],G=F.pos-j,I=t.tags[s],Q=void 0;I===!0?Q=yt(["eqn-num"],[],n):I===!1?Q=yt([],[],n):Q=yt([],Yi(I,n,!0),n),Q.depth=F.depth,Q.height=F.height,z.push({type:"elem",elem:Q,shift:G})}for(r=0,$=0;r<a||$<P.length;++r,++$){for(var V,M=P[$],re=!0;((se=M)==null?void 0:se.type)==="separator";){var se;if(re||(O=yt(["arraycolsep"],[]),O.style.width=Rt(n.fontMetrics().doubleRuleSep),L.push(O)),M.separator==="|"||M.separator===":"){var X=M.separator==="|"?"solid":"dashed",J=yt(["vertical-separator"],[],n);J.style.height=Rt(w),J.style.borderRightWidth=Rt(d),J.style.borderRightStyle=X,J.style.margin="0 "+Rt(-d/2);var de=w-j;de&&(J.style.verticalAlign=Rt(-de)),L.push(J)}else throw new _t("Invalid separator type: "+M.separator);$++,M=P[$],re=!1}if(!(r>=a)){var W=void 0;if(r>0||t.hskipBeforeAndAfter){var te,U;W=(te=(U=M)==null?void 0:U.pregap)!=null?te:m,W!==0&&(O=yt(["arraycolsep"],[]),O.style.width=Rt(W),L.push(O))}var ee=[];for(s=0;s<i;++s){var oe=c[s],Ce=oe.cells[r];if(Ce){var he=oe.pos-j;Ce.depth=oe.depth,Ce.height=oe.height,ee.push({type:"elem",elem:Ce,shift:he})}}var ye=ur({positionType:"individualShift",children:ee}),Ve=yt(["col-align-"+(((V=M)==null?void 0:V.align)||"c")],[ye]);if(L.push(Ve),r<a-1||t.hskipBeforeAndAfter){var it,At;W=(it=(At=M)==null?void 0:At.postgap)!=null?it:m,W!==0&&(O=yt(["arraycolsep"],[]),O.style.width=Rt(W),L.push(O))}}}var Ee=yt(["mtable"],L);if(u.length>0){for(var me=zg("hline",n,d),bt=zg("hdashline",n,d),et=[{type:"elem",elem:Ee,shift:0}];u.length>0;){var qe=u.pop(),Ke=qe.pos-j;qe.isDashed?et.push({type:"elem",elem:bt,shift:Ke}):et.push({type:"elem",elem:me,shift:Ke})}Ee=ur({positionType:"individualShift",children:et})}if(z.length===0)return yt(["mord"],[Ee],n);var ke=ur({positionType:"individualShift",children:z}),ne=yt(["tag"],[ke],n);return Zd([Ee,ne])},u2e={c:"center ",l:"left ",r:"right "},$u=function(t,n){for(var s=[],r=new Tt("mtd",[],["mtr-glue"]),i=new Tt("mtd",[],["mml-eqn-num"]),o=0;o<t.body.length;o++){for(var a=t.body[o],c=[],u=0;u<a.length;u++)c.push(new Tt("mtd",[Dr(a[u],n)]));t.tags&&t.tags[o]&&(c.unshift(r),c.push(r),t.leqno?c.unshift(i):c.push(i)),s.push(new Tt("mtr",c))}var d=new Tt("mtable",s),h=t.arraystretch===.5?.1:.16+t.arraystretch-1+(t.addJot?.09:0);d.setAttribute("rowspacing",Rt(h));var m="",p="";if(t.cols&&t.cols.length>0){var g=t.cols,b="",v=!1,x=0,y=g.length;g[0].type==="separator"&&(m+="top ",x=1),g[g.length-1].type==="separator"&&(m+="bottom ",y-=1);for(var w=x;w<y;w++){var k=g[w];k.type==="align"?(p+=u2e[k.align],v&&(b+="none "),v=!0):k.type==="separator"&&v&&(b+=k.separator==="|"?"solid ":"dashed ",v=!1)}d.setAttribute("columnalign",p.trim()),/[sd]/.test(b)&&d.setAttribute("columnlines",b.trim())}if(t.colSeparationType==="align"){for(var T=t.cols||[],S="",C=1;C<T.length;C++)S+=C%2?"0em ":"1em ";d.setAttribute("columnspacing",S.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 _="",B=t.hLinesBeforeRow;m+=B[0].length>0?"left ":"",m+=B[B.length-1].length>0?"right ":"";for(var A=1;A<B.length-1;A++)_+=B[A].length===0?"none ":B[A][0]?"dashed ":"solid ";return/[sd]/.test(_)&&d.setAttribute("rowlines",_.trim()),m!==""&&(d=new Tt("menclose",[d]),d.setAttribute("notation",m.trim())),t.arraystretch&&t.arraystretch<1&&(d=new Tt("mstyle",[d]),d.setAttribute("scriptlevel","1")),d},$Y=function(t,n){t.envName.includes("ed")||Z4(t);var s=[],r=t.envName.includes("at")?"alignat":"align",i=t.envName==="split",o=Wf(t.parser,{cols:s,addJot:!0,autoTag:i?void 0:bj(t.envName),emptySingleRow:!0,colSeparationType:r,maxNumCols:i?2:void 0,leqno:t.parser.settings.leqno},"display"),a=0,c=0,u={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 m=ys(n[0].body[h],"textord");d+=m.text}a=Number(d),c=a*2}var p=!c;o.body.forEach(function(x){for(var y=1;y<x.length;y+=2){var w=ys(x[y],"styling"),k=ys(w.body[0],"ordgroup");k.body.unshift(u)}if(p)c<x.length&&(c=x.length);else{var T=x.length/2;if(a<T)throw new _t("Too many math in a row: "+("expected "+a+", but got "+T),x[0])}});for(var g=0;g<c;++g){var b="r",v=0;g%2===1?b="l":g>0&&p&&(v=1),s[g]={type:"align",align:b,pregap:v,postgap:0}}return o.colSeparationType=p?"align":"alignat",o};Ou({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var n=K4(t[0]),s=n?[t[0]]:ys(t[0],"ordgroup").body,r=s.map(function(o){var a=G4(o),c=a.text;if("lcr".includes(c))return{type:"align",align:c};if(c==="|")return{type:"separator",separator:"|"};if(c===":")return{type:"separator",separator:":"};throw new _t("Unknown column alignment: "+c,o)}),i={cols:r,hskipBeforeAndAfter:!0,maxNumCols:r.length};return Wf(e.parser,i,yj(e.envName))},htmlBuilder:Bu,mathmlBuilder:$u});Ou({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 _t("Expected l or c or r",r.nextToken);r.consume(),r.consumeSpaces(),r.expect("]"),r.consume(),s.cols=[{type:"align",align:n}]}}var i=Wf(e.parser,s,yj(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:Bu,mathmlBuilder:$u});Ou({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t={arraystretch:.5},n=Wf(e.parser,t,"script");return n.colSeparationType="small",n},htmlBuilder:Bu,mathmlBuilder:$u});Ou({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var n=K4(t[0]),s=n?[t[0]]:ys(t[0],"ordgroup").body,r=s.map(function(a){var c=G4(a),u=c.text;if("lc".includes(u))return{type:"align",align:u};throw new _t("Unknown column alignment: "+u,a)});if(r.length>1)throw new _t("{subarray} can contain only one column");var i={cols:r,hskipBeforeAndAfter:!1,arraystretch:.5},o=Wf(e.parser,i,"script");if(o.body.length>0&&o.body[0].length>1)throw new _t("{subarray} can contain only one column");return o},htmlBuilder:Bu,mathmlBuilder:$u});Ou({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=Wf(e.parser,t,yj(e.envName));return{type:"leftright",mode:e.mode,body:[n],left:e.envName.includes("r")?".":"\\{",right:e.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:Bu,mathmlBuilder:$u});Ou({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:$Y,htmlBuilder:Bu,mathmlBuilder:$u});Ou({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){c2e.has(e.envName)&&Z4(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:bj(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return Wf(e.parser,t,"display")},htmlBuilder:Bu,mathmlBuilder:$u});Ou({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:$Y,htmlBuilder:Bu,mathmlBuilder:$u});Ou({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){Z4(e);var t={autoTag:bj(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return Wf(e.parser,t,"display")},htmlBuilder:Bu,mathmlBuilder:$u});Ou({type:"array",names:["CD"],props:{numArgs:0},handler(e){return Z4(e),Qke(e.parser)},htmlBuilder:Bu,mathmlBuilder:$u});Y("\\nonumber","\\gdef\\@eqnsw{0}");Y("\\notag","\\nonumber");nn({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new _t(e.funcName+" valid only within array environment")}});var FO=OY;nn({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 _t("Invalid environment name",r);for(var i="",o=0;o<r.body.length;++o)i+=ys(r.body[o],"textord").text;if(s==="\\begin"){if(!FO.hasOwnProperty(i))throw new _t("No such environment: "+i,r);var a=FO[i],{args:c,optArgs:u}=n.parseArguments("\\begin{"+i+"}",a),d={mode:n.mode,envName:i,parser:n},h=a.handler(d,c,u);n.expect("\\end",!1);var m=n.nextToken,p=ys(n.parseFunction(),"environment");if(p.name!==i)throw new _t("Mismatch: \\begin{"+i+"} matched by \\end{"+p.name+"}",m);return h}return{type:"environment",mode:n.mode,name:i,nameGroup:r}}});var zY=(e,t)=>{var n=e.font,s=t.withFont(n);return hr(e.body,s)},FY=(e,t)=>{var n=e.font,s=t.withFont(n);return Dr(e.body,s)},qO={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};nn({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=Q_(t[0]),i=s;return i in qO&&(i=qO[i]),{type:"font",mode:n.mode,font:i.slice(1),body:r}},htmlBuilder:zY,mathmlBuilder:FY});nn({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:Y4(s),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:s}],isCharacterBox:Qd(s)}}});nn({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:zY,mathmlBuilder:FY});var d2e=(e,t)=>{var n=t.style,s=n.fracNum(),r=n.fracDen(),i;i=t.havingStyle(s);var o=hr(e.numer,i,t);if(e.continued){var a=8.5/t.fontMetrics().ptPerEm,c=3.5/t.fontMetrics().ptPerEm;o.height=o.height<a?a:o.height,o.depth=o.depth<c?c:o.depth}i=t.havingStyle(r);var u=hr(e.denom,i,t),d,h,m;e.hasBarLine?(e.barSize?(h=ai(e.barSize,t),d=zg("frac-line",t,h)):d=zg("frac-line",t),h=d.height,m=d.height):(d=null,h=0,m=t.fontMetrics().defaultRuleThickness);var p,g,b;n.size===ns.DISPLAY.size?(p=t.fontMetrics().num1,h>0?g=3*m:g=7*m,b=t.fontMetrics().denom1):(h>0?(p=t.fontMetrics().num2,g=m):(p=t.fontMetrics().num3,g=3*m),b=t.fontMetrics().denom2);var v;if(d){var y=t.fontMetrics().axisHeight;p-o.depth-(y+.5*h)<g&&(p+=g-(p-o.depth-(y+.5*h))),y-.5*h-(u.height-b)<g&&(b+=g-(y-.5*h-(u.height-b)));var w=-(y-.5*h);v=ur({positionType:"individualShift",children:[{type:"elem",elem:u,shift:b},{type:"elem",elem:d,shift:w},{type:"elem",elem:o,shift:-p}]})}else{var x=p-o.depth-(u.height-b);x<g&&(p+=.5*(g-x),b+=.5*(g-x)),v=ur({positionType:"individualShift",children:[{type:"elem",elem:u,shift:b},{type:"elem",elem:o,shift:-p}]})}i=t.havingStyle(n),v.height*=i.sizeMultiplier/t.sizeMultiplier,v.depth*=i.sizeMultiplier/t.sizeMultiplier;var k;n.size===ns.DISPLAY.size?k=t.fontMetrics().delim1:n.size===ns.SCRIPTSCRIPT.size?k=t.havingStyle(ns.SCRIPT).fontMetrics().delim2:k=t.fontMetrics().delim2;var T,S;return e.leftDelim==null?T=bx(t,["mopen"]):T=sE(e.leftDelim,k,!0,t.havingStyle(n),e.mode,["mopen"]),e.continued?S=yt([]):e.rightDelim==null?S=bx(t,["mclose"]):S=sE(e.rightDelim,k,!0,t.havingStyle(n),e.mode,["mclose"]),yt(["mord"].concat(i.sizingClasses(t)),[T,yt(["mfrac"],[v]),S],t)},h2e=(e,t)=>{var n=new Tt("mfrac",[Dr(e.numer,t),Dr(e.denom,t)]);if(!e.hasBarLine)n.setAttribute("linethickness","0px");else if(e.barSize){var s=ai(e.barSize,t);n.setAttribute("linethickness",Rt(s))}if(e.leftDelim!=null||e.rightDelim!=null){var r=[];if(e.leftDelim!=null){var i=new Tt("mo",[new Li(e.leftDelim.replace("\\",""))]);i.setAttribute("fence","true"),r.push(i)}if(r.push(n),e.rightDelim!=null){var o=new Tt("mo",[new Li(e.rightDelim.replace("\\",""))]);o.setAttribute("fence","true"),r.push(o)}return fj(r)}return n},qY=(e,t)=>{if(!t)return e;var n={type:"styling",mode:e.mode,style:t,body:[e]};return n};nn({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,c=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="(",c=")";break;case"\\\\bracefrac":o=!1,a="\\{",c="\\}";break;case"\\\\brackfrac":o=!1,a="[",c="]";break;default:throw new Error("Unrecognized genfrac command")}var u=s==="\\cfrac",d=null;return u||s.startsWith("\\d")?d="display":s.startsWith("\\t")&&(d="text"),qY({type:"genfrac",mode:n.mode,numer:r,denom:i,continued:u,hasBarLine:o,leftDelim:a,rightDelim:c,barSize:null},d)},htmlBuilder:d2e,mathmlBuilder:h2e});nn({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 HO=["display","text","script","scriptscript"],UO=function(t){var n=null;return t.length>0&&(n=t,n=n==="."?null:n),n};nn({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=Q_(t[0]),o=i.type==="atom"&&i.family==="open"?UO(i.text):null,a=Q_(t[1]),c=a.type==="atom"&&a.family==="close"?UO(a.text):null,u=ys(t[2],"size"),d,h=null;u.isBlank?d=!0:(h=u.value,d=h.number>0);var m=null,p=t[3];if(p.type==="ordgroup"){if(p.body.length>0){var g=ys(p.body[0],"textord");m=HO[Number(g.text)]}}else p=ys(p,"textord"),m=HO[Number(p.text)];return qY({type:"genfrac",mode:n.mode,numer:s,denom:r,continued:!1,hasBarLine:d,barSize:h,leftDelim:o,rightDelim:c},m)}});nn({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:ys(t[0],"size").value,token:r}}});nn({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{var{parser:n,funcName:s}=e,r=t[0],i=ys(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 HY=(e,t)=>{var n=t.style,s,r;e.type==="supsub"?(s=e.sup?hr(e.sup,t.havingStyle(n.sup()),t):hr(e.sub,t.havingStyle(n.sub()),t),r=ys(e.base,"horizBrace")):r=ys(e,"horizBrace");var i=hr(r.base,t.havingBaseStyle(ns.DISPLAY)),o=W4(r,t),a;if(r.isOver?a=ur({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:o,wrapperClasses:["svg-align"]}]}):a=ur({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 c=yt(["minner",r.isOver?"mover":"munder"],[a],t);r.isOver?a=ur({positionType:"firstBaseline",children:[{type:"elem",elem:c},{type:"kern",size:.2},{type:"elem",elem:s}]}):a=ur({positionType:"bottom",positionData:c.depth+.2+s.height+s.depth,children:[{type:"elem",elem:s},{type:"kern",size:.2},{type:"elem",elem:c}]})}return yt(["minner",r.isOver?"mover":"munder"],[a],t)},f2e=(e,t)=>{var n=V4(e.label);return new Tt(e.isOver?"mover":"munder",[Dr(e.base,t),n])};nn({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:HY,mathmlBuilder:f2e});nn({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,s=t[1],r=ys(t[0],"url").url;return n.settings.isTrusted({command:"\\href",url:r})?{type:"href",mode:n.mode,href:r,body:Di(s)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var n=Yi(e.body,t,!1);return Tke(e.href,[],n,t)},mathmlBuilder:(e,t)=>{var n=_f(e.body,t);return n instanceof Tt||(n=new Tt("mrow",[n])),n.setAttribute("href",e.href),n}});nn({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,s=ys(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:Di(a)}}});nn({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:Di(t[0])}},htmlBuilder(e,t){var n=Yi(e.body,t.withFont(""),!1);return Zd(n)},mathmlBuilder(e,t){return new Tt("mrow",El(e.body,t.withFont("")))}});nn({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=ys(t[0],"raw").string,o=t[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var a,c={};switch(s){case"\\htmlClass":c.class=i,a={command:"\\htmlClass",class:i};break;case"\\htmlId":c.id=i,a={command:"\\htmlId",id:i};break;case"\\htmlStyle":c.style=i,a={command:"\\htmlStyle",style:i};break;case"\\htmlData":{for(var u=i.split(","),d=0;d<u.length;d++){var h=u[d],m=h.indexOf("=");if(m<0)throw new _t("\\htmlData key/value '"+h+"' missing equals sign");var p=h.slice(0,m),g=h.slice(m+1);c["data-"+p.trim()]=g}a={command:"\\htmlData",attributes:c};break}default:throw new Error("Unrecognized html command")}return n.settings.isTrusted(a)?{type:"html",mode:n.mode,attributes:c,body:Di(o)}:n.formatUnsupportedCmd(s)},htmlBuilder:(e,t)=>{var n=Yi(e.body,t,!1),s=["enclosing"];e.attributes.class&&s.push(...e.attributes.class.trim().split(/\s+/));var r=yt(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)=>_f(e.body,t)});nn({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:Di(t[0]),mathml:Di(t[1])}},htmlBuilder:(e,t)=>{var n=Yi(e.html,t,!1);return Zd(n)},mathmlBuilder:(e,t)=>_f(e.mathml,t)});var kT=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 _t("Invalid size: '"+t+"' in \\includegraphics");var s={number:+(n[1]+n[2]),unit:n[3]};if(!iY(s))throw new _t("Invalid unit: '"+s.unit+"' in \\includegraphics.");return s};nn({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 c=ys(n[0],"raw").string,u=c.split(","),d=0;d<u.length;d++){var h=u[d].split("=");if(h.length===2){var m=h[1].trim();switch(h[0].trim()){case"alt":a=m;break;case"width":r=kT(m);break;case"height":i=kT(m);break;case"totalheight":o=kT(m);break;default:throw new _t("Invalid key: '"+h[0]+"' in \\includegraphics.")}}}var p=ys(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=ai(e.height,t),s=0;e.totalheight.number>0&&(s=ai(e.totalheight,t)-n);var r=0;e.width.number>0&&(r=ai(e.width,t));var i={height:Rt(n+s)};r>0&&(i.width=Rt(r)),s>0&&(i.verticalAlign=Rt(-s));var o=new pke(e.src,e.alt,i);return o.height=n,o.depth=s,o},mathmlBuilder:(e,t)=>{var n=new Tt("mglyph",[]);n.setAttribute("alt",e.alt);var s=ai(e.height,t),r=0;if(e.totalheight.number>0&&(r=ai(e.totalheight,t)-s,n.setAttribute("valign",Rt(-r))),n.setAttribute("height",Rt(s+r)),e.width.number>0){var i=ai(e.width,t);n.setAttribute("width",Rt(i))}return n.setAttribute("src",e.src),n}});nn({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=ys(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 hY(e.dimension,t)},mathmlBuilder(e,t){var n=ai(e.dimension,t);return new yY(n)}});nn({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=yt([],[hr(e.body,t)]),n=yt(["inner"],[n],t)):n=yt(["inner"],[hr(e.body,t)]);var s=yt(["fix"],[]),r=yt([e.alignment],[n,s],t),i=yt(["strut"]);return i.style.height=Rt(r.height+r.depth),r.depth&&(i.style.verticalAlign=Rt(-r.depth)),r.children.unshift(i),r=yt(["thinbox"],[r],t),yt(["mord","vbox"],[r],t)},mathmlBuilder:(e,t)=>{var n=new Tt("mpadded",[Dr(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}});nn({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}}});nn({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new _t("Mismatched "+e.funcName)}});var VO=(e,t)=>{switch(t.style.size){case ns.DISPLAY.size:return e.display;case ns.TEXT.size:return e.text;case ns.SCRIPT.size:return e.script;case ns.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};nn({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"mathchoice",mode:n.mode,display:Di(t[0]),text:Di(t[1]),script:Di(t[2]),scriptscript:Di(t[3])}},htmlBuilder:(e,t)=>{var n=VO(e,t),s=Yi(n,t,!1);return Zd(s)},mathmlBuilder:(e,t)=>{var n=VO(e,t);return _f(n,t)}});var UY=(e,t,n,s,r,i,o)=>{e=yt([],[e]);var a=n&&Qd(n),c,u;if(t){var d=hr(t,s.havingStyle(r.sup()),s);u={elem:d,kern:Math.max(s.fontMetrics().bigOpSpacing1,s.fontMetrics().bigOpSpacing3-d.depth)}}if(n){var h=hr(n,s.havingStyle(r.sub()),s);c={elem:h,kern:Math.max(s.fontMetrics().bigOpSpacing2,s.fontMetrics().bigOpSpacing4-h.height)}}var m;if(u&&c){var p=s.fontMetrics().bigOpSpacing5+c.elem.height+c.elem.depth+c.kern+e.depth+o;m=ur({positionType:"bottom",positionData:p,children:[{type:"kern",size:s.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:Rt(-i)},{type:"kern",size:c.kern},{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:Rt(i)},{type:"kern",size:s.fontMetrics().bigOpSpacing5}]})}else if(c){var g=e.height-o;m=ur({positionType:"top",positionData:g,children:[{type:"kern",size:s.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:Rt(-i)},{type:"kern",size:c.kern},{type:"elem",elem:e}]})}else if(u){var b=e.depth+o;m=ur({positionType:"bottom",positionData:b,children:[{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:Rt(i)},{type:"kern",size:s.fontMetrics().bigOpSpacing5}]})}else return e;var v=[m];if(c&&i!==0&&!a){var x=yt(["mspace"],[],s);x.style.marginRight=Rt(i),v.unshift(x)}return yt(["mop","op-limits"],v,s)},VY=new Set(["\\smallint"]),A1=(e,t)=>{var n,s,r=!1,i;e.type==="supsub"?(n=e.sup,s=e.sub,i=ys(e.base,"op"),r=!0):i=ys(e,"op");var o=t.style,a=!1;o.size===ns.DISPLAY.size&&i.symbol&&!VY.has(i.name)&&(a=!0);var c,u;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"),c=oa(i.name,d,"math",t,["mop","op-symbol",a?"large-op":"small-op"]),u=c.italic,h.length>0){var m=mY(h+"Size"+(a?"2":"1"),t);c=ur({positionType:"individualShift",children:[{type:"elem",elem:c,shift:0},{type:"elem",elem:m,shift:a?.08:0}]}),i.name="\\"+h,c.classes.unshift("mop"),c.italic=u}}else if(i.body){var p=Yi(i.body,t,!0);p.length===1&&p[0]instanceof _l?(c=p[0],c.classes[0]="mop"):c=yt(["mop"],p,t)}else{for(var g=[],b=1;b<i.name.length;b++)g.push(dj(i.name[b],i.mode,t));c=yt(["mop"],g,t)}var v=0,x=0;if((c instanceof _l||i.name==="\\oiint"||i.name==="\\oiiint")&&!i.suppressBaseShift){var y;v=(c.height-c.depth)/2-t.fontMetrics().axisHeight,x=(y=c.italic)!=null?y:0}return r?UY(c,n,s,t,o,x,v):(v&&(c.style.position="relative",c.style.top=Rt(v)),c)},vv=(e,t)=>{var n;if(e.symbol)n=new Tt("mo",[cc(e.name,e.mode)]),VY.has(e.name)&&n.setAttribute("largeop","false");else if(e.body)n=new Tt("mo",El(e.body,t));else{n=new Tt("mi",[new Li(e.name.slice(1))]);var s=new Tt("mo",[cc("⁡","text")]);e.parentIsSupSub?n=new Tt("mrow",[n,s]):n=bY([n,s])}return n},m2e={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};nn({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=m2e[r]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:A1,mathmlBuilder:vv});nn({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:Di(s)}},htmlBuilder:A1,mathmlBuilder:vv});var p2e={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};nn({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:A1,mathmlBuilder:vv});nn({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:A1,mathmlBuilder:vv});nn({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=p2e[s]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:A1,mathmlBuilder:vv});var WY=(e,t)=>{var n,s,r=!1,i;e.type==="supsub"?(n=e.sup,s=e.sub,i=ys(e.base,"operatorname"),r=!0):i=ys(e,"operatorname");var o;if(i.body.length>0){for(var a=i.body.map(h=>{var m="text"in h?h.text:void 0;return typeof m=="string"?{type:"textord",mode:h.mode,text:m}:h}),c=Yi(a,t.withFont("mathrm"),!0),u=0;u<c.length;u++){var d=c[u];d instanceof _l&&(d.text=d.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=yt(["mop"],c,t)}else o=yt(["mop"],[],t);return r?UY(o,n,s,t,t.style,0,0):o},g2e=(e,t)=>{for(var n=El(e.body,t.withFont("mathrm")),s=!0,r=0;r<n.length;r++){var i=n[r];if(!(i instanceof yY))if(i instanceof Tt)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 Li?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 Li(a)]}var c=new Tt("mi",n);c.setAttribute("mathvariant","normal");var u=new Tt("mo",[cc("⁡","text")]);return e.parentIsSupSub?new Tt("mrow",[c,u]):bY([c,u])};nn({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:Di(r),alwaysHandleSupSub:s==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:WY,mathmlBuilder:g2e});Y("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Pp({type:"ordgroup",htmlBuilder(e,t){return e.semisimple?Zd(Yi(e.body,t,!1)):yt(["mord"],Yi(e.body,t,!0),t)},mathmlBuilder(e,t){return _f(e.body,t,!0)}});nn({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=hr(e.body,t.havingCrampedStyle()),s=zg("overline-line",t),r=t.fontMetrics().defaultRuleThickness,i=ur({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*r},{type:"elem",elem:s},{type:"kern",size:r}]});return yt(["mord","overline"],[i],t)},mathmlBuilder(e,t){var n=new Tt("mo",[new Li("‾")]);n.setAttribute("stretchy","true");var s=new Tt("mover",[Dr(e.body,t),n]);return s.setAttribute("accent","true"),s}});nn({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:Di(s)}},htmlBuilder:(e,t)=>{var n=Yi(e.body,t.withPhantom(),!1);return Zd(n)},mathmlBuilder:(e,t)=>{var n=El(e.body,t);return new Tt("mphantom",n)}});Y("\\hphantom","\\smash{\\phantom{#1}}");nn({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=yt(["inner"],[hr(e.body,t.withPhantom())]),s=yt(["fix"],[]);return yt(["mord","rlap"],[n,s],t)},mathmlBuilder:(e,t)=>{var n=El(Di(e.body),t),s=new Tt("mphantom",n),r=new Tt("mpadded",[s]);return r.setAttribute("width","0px"),r}});nn({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e,s=ys(t[0],"size").value,r=t[1];return{type:"raisebox",mode:n.mode,dy:s,body:r}},htmlBuilder(e,t){var n=hr(e.body,t),s=ai(e.dy,t);return ur({positionType:"shift",positionData:-s,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new Tt("mpadded",[Dr(e.body,t)]),s=e.dy.number+e.dy.unit;return n.setAttribute("voffset",s),n}});nn({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}});nn({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=ys(t[0],"size"),o=ys(t[1],"size");return{type:"rule",mode:s.mode,shift:r&&ys(r,"size").value,width:i.value,height:o.value}},htmlBuilder(e,t){var n=yt(["mord","rule"],[],t),s=ai(e.width,t),r=ai(e.height,t),i=e.shift?ai(e.shift,t):0;return n.style.borderRightWidth=Rt(s),n.style.borderTopWidth=Rt(r),n.style.bottom=Rt(i),n.width=s,n.height=r+i,n.depth=-i,n.maxFontSize=r*1.125*t.sizeMultiplier,n},mathmlBuilder(e,t){var n=ai(e.width,t),s=ai(e.height,t),r=e.shift?ai(e.shift,t):0,i=t.color&&t.getColor()||"black",o=new Tt("mspace");o.setAttribute("mathbackground",i),o.setAttribute("width",Rt(n)),o.setAttribute("height",Rt(s));var a=new Tt("mpadded",[o]);return r>=0?a.setAttribute("height",Rt(r)):(a.setAttribute("height",Rt(r)),a.setAttribute("depth",Rt(-r))),a.setAttribute("voffset",Rt(r)),a}});function GY(e,t,n){for(var s=Yi(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 Zd(s)}var WO=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],b2e=(e,t)=>{var n=t.havingSize(e.size);return GY(e.body,n,t)};nn({type:"sizing",names:WO,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:WO.indexOf(s)+1,body:i}},htmlBuilder:b2e,mathmlBuilder:(e,t)=>{var n=t.havingSize(e.size),s=El(e.body,n),r=new Tt("mstyle",s);return r.setAttribute("mathsize",Rt(n.sizeMultiplier)),r}});nn({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]&&ys(n[0],"ordgroup");if(o)for(var a,c=0;c<o.body.length;++c){var u=o.body[c];if(a=G4(u).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=yt([],[hr(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 yt(["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=ur({positionType:"firstBaseline",children:[{type:"elem",elem:n}]});return yt(["mord"],[r],t)},mathmlBuilder:(e,t)=>{var n=new Tt("mpadded",[Dr(e.body,t)]);return e.smashHeight&&n.setAttribute("height","0px"),e.smashDepth&&n.setAttribute("depth","0px"),n}});nn({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=hr(e.body,t.havingCrampedStyle());n.height===0&&(n.height=t.fontMetrics().xHeight),n=Fg(n,t);var s=t.fontMetrics(),r=s.defaultRuleThickness,i=r;t.style.id<ns.TEXT.id&&(i=t.fontMetrics().xHeight);var o=r+i/4,a=n.height+n.depth+o+r,{span:c,ruleWidth:u,advanceWidth:d}=s2e(a,t),h=c.height-u;h>n.height+n.depth+o&&(o=(o+h-n.height-n.depth)/2);var m=c.height-n.height-o-u;n.style.paddingLeft=Rt(d);var p=ur({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+m)},{type:"elem",elem:c},{type:"kern",size:u}]});if(e.index){var g=t.havingStyle(ns.SCRIPTSCRIPT),b=hr(e.index,g,t),v=.6*(p.height-p.depth),x=ur({positionType:"shift",positionData:-v,children:[{type:"elem",elem:b}]}),y=yt(["root"],[x]);return yt(["mord","sqrt"],[y,p],t)}else return yt(["mord","sqrt"],[p],t)},mathmlBuilder(e,t){var{body:n,index:s}=e;return s?new Tt("mroot",[Dr(n,t),Dr(s,t)]):new Tt("msqrt",[Dr(n,t)])}});var rE={display:ns.DISPLAY,text:ns.TEXT,script:ns.SCRIPT,scriptscript:ns.SCRIPTSCRIPT};function y2e(e){return e in rE}nn({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(!y2e(o))throw new Error("Unknown style: "+o);return{type:"styling",mode:r.mode,style:o,body:i}},htmlBuilder(e,t){var n=rE[e.style],s=t.havingStyle(n);return e.resetFont&&(s=s.withFont("")),GY(e.body,s,t)},mathmlBuilder(e,t){var n=rE[e.style],s=t.havingStyle(n);e.resetFont&&(s=s.withFont(""));var r=El(e.body,s),i=new Tt("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 x2e=function(t,n){var s=t.base;if(s)if(s.type==="op"){var r=s.limits&&(n.style.size===ns.DISPLAY.size||s.alwaysHandleSupSub);return r?A1:null}else if(s.type==="operatorname"){var i=s.alwaysHandleSupSub&&(n.style.size===ns.DISPLAY.size||s.limits);return i?WY:null}else{if(s.type==="accent")return Qd(s.base)?pj:null;if(s.type==="horizBrace"){var o=!t.sub;return o===s.isOver?HY:null}else return null}else return null};Pp({type:"supsub",htmlBuilder(e,t){var n=x2e(e,t);if(n)return n(e,t);var{base:s,sup:r,sub:i}=e,o=hr(s,t),a,c,u=t.fontMetrics(),d=0,h=0,m=s&&Qd(s);if(r){var p=t.havingStyle(t.style.sup());a=hr(r,p,t),m||(d=o.height-p.fontMetrics().supDrop*p.sizeMultiplier/t.sizeMultiplier)}if(i){var g=t.havingStyle(t.style.sub());c=hr(i,g,t),m||(h=o.depth+g.fontMetrics().subDrop*g.sizeMultiplier/t.sizeMultiplier)}var b;t.style===ns.DISPLAY?b=u.sup1:t.style.cramped?b=u.sup3:b=u.sup2;var v=t.sizeMultiplier,x=Rt(.5/u.ptPerEm/v),y=null;if(c){var w=e.base&&e.base.type==="op"&&e.base.name&&(e.base.name==="\\oiint"||e.base.name==="\\oiiint");if(o instanceof _l||w){var k;y=Rt(-((k=o.italic)!=null?k:0))}}var T;if(a&&c){d=Math.max(d,b,a.depth+.25*u.xHeight),h=Math.max(h,u.sub2);var S=u.defaultRuleThickness,C=4*S;if(d-a.depth-(c.height-h)<C){h=C-(d-a.depth)+c.height;var _=.8*u.xHeight-(d-a.depth);_>0&&(d+=_,h-=_)}var B=[{type:"elem",elem:c,shift:h,marginRight:x,marginLeft:y},{type:"elem",elem:a,shift:-d,marginRight:x}];T=ur({positionType:"individualShift",children:B})}else if(c){h=Math.max(h,u.sub1,c.height-.8*u.xHeight);var A=[{type:"elem",elem:c,marginLeft:y,marginRight:x}];T=ur({positionType:"shift",positionData:h,children:A})}else if(a)d=Math.max(d,b,a.depth+.25*u.xHeight),T=ur({positionType:"shift",positionData:-d,children:[{type:"elem",elem:a,marginRight:x}]});else throw new Error("supsub must have either sup or sub.");var N=Z7(o,"right")||"mord";return yt([N],[o,yt(["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=[Dr(e.base,t)];e.sub&&i.push(Dr(e.sub,t)),e.sup&&i.push(Dr(e.sup,t));var o;if(n)o=s?"mover":"munder";else if(e.sub)if(e.sup){var u=e.base;u&&u.type==="op"&&u.limits&&t.style===ns.DISPLAY||u&&u.type==="operatorname"&&u.alwaysHandleSupSub&&(t.style===ns.DISPLAY||u.limits)?o="munderover":o="msubsup"}else{var c=e.base;c&&c.type==="op"&&c.limits&&(t.style===ns.DISPLAY||c.alwaysHandleSupSub)||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(c.limits||t.style===ns.DISPLAY)?o="munder":o="msub"}else{var a=e.base;a&&a.type==="op"&&a.limits&&(t.style===ns.DISPLAY||a.alwaysHandleSupSub)||a&&a.type==="operatorname"&&a.alwaysHandleSupSub&&(a.limits||t.style===ns.DISPLAY)?o="mover":o="msup"}return new Tt(o,i)}});Pp({type:"atom",htmlBuilder(e,t){return dj(e.text,e.mode,t,["m"+e.family])},mathmlBuilder(e,t){var n=new Tt("mo",[cc(e.text,e.mode)]);if(e.family==="bin"){var s=mj(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 KY={mi:"italic",mn:"normal",mtext:"normal"};Pp({type:"mathord",htmlBuilder(e,t){return U4(e,t,"mathord")},mathmlBuilder(e,t){var n=new Tt("mi",[cc(e.text,e.mode,t)]),s=mj(e,t)||"italic";return s!==KY[n.type]&&n.setAttribute("mathvariant",s),n}});Pp({type:"textord",htmlBuilder(e,t){return U4(e,t,"textord")},mathmlBuilder(e,t){var n=cc(e.text,e.mode,t),s=mj(e,t)||"normal",r;return e.mode==="text"?r=new Tt("mtext",[n]):/[0-9]/.test(e.text)?r=new Tt("mn",[n]):e.text==="\\prime"?r=new Tt("mo",[n]):r=new Tt("mi",[n]),s!==KY[r.type]&&r.setAttribute("mathvariant",s),r}});var _T={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},ST={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Pp({type:"spacing",htmlBuilder(e,t){if(ST.hasOwnProperty(e.text)){var n=ST[e.text].className||"";if(e.mode==="text"){var s=U4(e,t,"textord");return s.classes.push(n),s}else return yt(["mspace",n],[dj(e.text,e.mode,t)],t)}else{if(_T.hasOwnProperty(e.text))return yt(["mspace",_T[e.text]],[],t);throw new _t('Unknown type of space "'+e.text+'"')}},mathmlBuilder(e,t){var n;if(ST.hasOwnProperty(e.text))n=new Tt("mtext",[new Li(" ")]);else{if(_T.hasOwnProperty(e.text))return new Tt("mspace");throw new _t('Unknown type of space "'+e.text+'"')}return n}});var GO=()=>{var e=new Tt("mtd",[]);return e.setAttribute("width","50%"),e};Pp({type:"tag",mathmlBuilder(e,t){var n=new Tt("mtable",[new Tt("mtr",[GO(),new Tt("mtd",[_f(e.body,t)]),GO(),new Tt("mtd",[_f(e.tag,t)])])]);return n.setAttribute("width","100%"),n}});var KO={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},YO={"\\textbf":"textbf","\\textmd":"textmd"},v2e={"\\textit":"textit","\\textup":"textup"},XO=(e,t)=>{var n=e.font;if(n){if(KO[n])return t.withTextFontFamily(KO[n]);if(YO[n])return t.withTextFontWeight(YO[n]);if(n==="\\emph")return t.fontShape==="textit"?t.withTextFontShape("textup"):t.withTextFontShape("textit")}else return t;return t.withTextFontShape(v2e[n])};nn({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:Di(r),font:s}},htmlBuilder(e,t){var n=XO(e,t),s=Yi(e.body,n,!0);return yt(["mord","text"],s,n)},mathmlBuilder(e,t){var n=XO(e,t);return _f(e.body,n)}});nn({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=hr(e.body,t),s=zg("underline-line",t),r=t.fontMetrics().defaultRuleThickness,i=ur({positionType:"top",positionData:n.height,children:[{type:"kern",size:r},{type:"elem",elem:s},{type:"kern",size:3*r},{type:"elem",elem:n}]});return yt(["mord","underline"],[i],t)},mathmlBuilder(e,t){var n=new Tt("mo",[new Li("‾")]);n.setAttribute("stretchy","true");var s=new Tt("munder",[Dr(e.body,t),n]);return s.setAttribute("accentunder","true"),s}});nn({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=hr(e.body,t),s=t.fontMetrics().axisHeight,r=.5*(n.height-s-(n.depth+s));return ur({positionType:"shift",positionData:r,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new Tt("mpadded",[Dr(e.body,t)],["vcenter"]);return new Tt("mrow",[n])}});nn({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,n){throw new _t("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var n=QO(e),s=[],r=t.havingStyle(t.style.text()),i=0;i<n.length;i++){var o=n[i];o==="~"&&(o="\\textasciitilde"),s.push(oa(o,"Typewriter-Regular",e.mode,r,["mord","texttt"]))}return yt(["mord","text"].concat(r.sizingClasses(t)),dY(s),r)},mathmlBuilder(e,t){var n=new Li(QO(e)),s=new Tt("mtext",[n]);return s.setAttribute("mathvariant","monospace"),s}});var QO=e=>e.body.replace(/ /g,e.star?"␣":" "),Uh=pY,YY=`[ \r
	]`,w2e="\\\\[a-zA-Z@]+",k2e="\\\\[^\uD800-\uDFFF]",_2e="("+w2e+")"+YY+"*",S2e=`\\\\(
|[ \r	]+
?)[ \r	]*`,iE="[̀-ͯ]",C2e=new RegExp(iE+"+$"),T2e="("+YY+"+)|"+(S2e+"|")+"([!-\\[\\]-‧‪-퟿豈-]"+(iE+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(iE+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+_2e)+("|"+k2e+")");class JO{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(T2e,"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 xl("EOF",new Da(this,n,n));var s=this.tokenRegex.exec(t);if(s===null||s.index!==n)throw new _t("Unexpected character: '"+t[n]+"'",new xl(t[n],new Da(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 xl(r,new Da(this,n,this.tokenRegex.lastIndex))}}class E2e{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 _t("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 A2e=BY;Y("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});Y("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});Y("\\@firstoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[0],numArgs:0}});Y("\\@secondoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[1],numArgs:0}});Y("\\@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}});Y("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");Y("\\TextOrMath",function(e){var t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var ZO={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};Y("\\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 _t("\\char` missing argument");s=t.text.charCodeAt(0)}else n=10;if(n){if(s=ZO[t.text],s==null||s>=n)throw new _t("Invalid base-"+n+" digit "+t.text);for(var r;(r=ZO[e.future().text])!=null&&r<n;)s*=n,s+=r,e.popToken()}return"\\@char{"+s+"}"});var xj=(e,t,n,s)=>{var r=e.consumeArg().tokens;if(r.length!==1)throw new _t("\\newcommand's first argument must be a macro name");var i=r[0].text,o=e.isDefined(i);if(o&&!t)throw new _t("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!o&&!n)throw new _t("\\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 c="",u=e.expandNextToken();u.text!=="]"&&u.text!=="EOF";)c+=u.text,u=e.expandNextToken();if(!c.match(/^\s*[0-9]+\s*$/))throw new _t("Invalid number of arguments: "+c);a=parseInt(c),r=e.consumeArg().tokens}return o&&s||e.macros.set(i,{tokens:r,numArgs:a}),""};Y("\\newcommand",e=>xj(e,!1,!0,!1));Y("\\renewcommand",e=>xj(e,!0,!1,!1));Y("\\providecommand",e=>xj(e,!0,!0,!0));Y("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(n=>n.text).join("")),""});Y("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(n=>n.text).join("")),""});Y("\\show",e=>{var t=e.popToken(),n=t.text;return console.log(t,e.macros.get(n),Uh[n],Zr.math[n],Zr.text[n]),""});Y("\\bgroup","{");Y("\\egroup","}");Y("~","\\nobreakspace");Y("\\lq","`");Y("\\rq","'");Y("\\aa","\\r a");Y("\\AA","\\r A");Y("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");Y("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");Y("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");Y("ℬ","\\mathscr{B}");Y("ℰ","\\mathscr{E}");Y("ℱ","\\mathscr{F}");Y("ℋ","\\mathscr{H}");Y("ℐ","\\mathscr{I}");Y("ℒ","\\mathscr{L}");Y("ℳ","\\mathscr{M}");Y("ℛ","\\mathscr{R}");Y("ℭ","\\mathfrak{C}");Y("ℌ","\\mathfrak{H}");Y("ℨ","\\mathfrak{Z}");Y("\\Bbbk","\\Bbb{k}");Y("\\llap","\\mathllap{\\textrm{#1}}");Y("\\rlap","\\mathrlap{\\textrm{#1}}");Y("\\clap","\\mathclap{\\textrm{#1}}");Y("\\mathstrut","\\vphantom{(}");Y("\\underbar","\\underline{\\text{#1}}");Y("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');Y("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");Y("\\ne","\\neq");Y("≠","\\neq");Y("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");Y("∉","\\notin");Y("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");Y("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");Y("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");Y("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");Y("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");Y("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");Y("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");Y("⟂","\\perp");Y("‼","\\mathclose{!\\mkern-0.8mu!}");Y("∌","\\notni");Y("⌜","\\ulcorner");Y("⌝","\\urcorner");Y("⌞","\\llcorner");Y("⌟","\\lrcorner");Y("©","\\copyright");Y("®","\\textregistered");Y("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');Y("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');Y("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');Y("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');Y("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");Y("⋮","\\vdots");Y("\\varGamma","\\mathit{\\Gamma}");Y("\\varDelta","\\mathit{\\Delta}");Y("\\varTheta","\\mathit{\\Theta}");Y("\\varLambda","\\mathit{\\Lambda}");Y("\\varXi","\\mathit{\\Xi}");Y("\\varPi","\\mathit{\\Pi}");Y("\\varSigma","\\mathit{\\Sigma}");Y("\\varUpsilon","\\mathit{\\Upsilon}");Y("\\varPhi","\\mathit{\\Phi}");Y("\\varPsi","\\mathit{\\Psi}");Y("\\varOmega","\\mathit{\\Omega}");Y("\\substack","\\begin{subarray}{c}#1\\end{subarray}");Y("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");Y("\\boxed","\\fbox{$\\displaystyle{#1}$}");Y("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");Y("\\implies","\\DOTSB\\;\\Longrightarrow\\;");Y("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");Y("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");Y("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var eB={",":"\\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"},N2e=new Set(["bin","rel"]);Y("\\dots",function(e){var t="\\dotso",n=e.expandAfterFuture().text;return n in eB?t=eB[n]:(n.slice(0,4)==="\\not"||n in Zr.math&&N2e.has(Zr.math[n].group))&&(t="\\dotsb"),t});var vj={")":!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};Y("\\dotso",function(e){var t=e.future().text;return t in vj?"\\ldots\\,":"\\ldots"});Y("\\dotsc",function(e){var t=e.future().text;return t in vj&&t!==","?"\\ldots\\,":"\\ldots"});Y("\\cdots",function(e){var t=e.future().text;return t in vj?"\\@cdots\\,":"\\@cdots"});Y("\\dotsb","\\cdots");Y("\\dotsm","\\cdots");Y("\\dotsi","\\!\\cdots");Y("\\dotsx","\\ldots\\,");Y("\\DOTSI","\\relax");Y("\\DOTSB","\\relax");Y("\\DOTSX","\\relax");Y("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");Y("\\,","\\tmspace+{3mu}{.1667em}");Y("\\thinspace","\\,");Y("\\>","\\mskip{4mu}");Y("\\:","\\tmspace+{4mu}{.2222em}");Y("\\medspace","\\:");Y("\\;","\\tmspace+{5mu}{.2777em}");Y("\\thickspace","\\;");Y("\\!","\\tmspace-{3mu}{.1667em}");Y("\\negthinspace","\\!");Y("\\negmedspace","\\tmspace-{4mu}{.2222em}");Y("\\negthickspace","\\tmspace-{5mu}{.277em}");Y("\\enspace","\\kern.5em ");Y("\\enskip","\\hskip.5em\\relax");Y("\\quad","\\hskip1em\\relax");Y("\\qquad","\\hskip2em\\relax");Y("\\tag","\\@ifstar\\tag@literal\\tag@paren");Y("\\tag@paren","\\tag@literal{({#1})}");Y("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new _t("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});Y("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");Y("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");Y("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");Y("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");Y("\\newline","\\\\\\relax");Y("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var XY=Rt(bu["Main-Regular"][84][1]-.7*bu["Main-Regular"][65][1]);Y("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+XY+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");Y("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+XY+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");Y("\\hspace","\\@ifstar\\@hspacer\\@hspace");Y("\\@hspace","\\hskip #1\\relax");Y("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");Y("\\ordinarycolon",":");Y("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");Y("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');Y("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');Y("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');Y("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');Y("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');Y("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');Y("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');Y("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');Y("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');Y("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');Y("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');Y("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');Y("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');Y("∷","\\dblcolon");Y("∹","\\eqcolon");Y("≔","\\coloneqq");Y("≕","\\eqqcolon");Y("⩴","\\Coloneqq");Y("\\ratio","\\vcentcolon");Y("\\coloncolon","\\dblcolon");Y("\\colonequals","\\coloneqq");Y("\\coloncolonequals","\\Coloneqq");Y("\\equalscolon","\\eqqcolon");Y("\\equalscoloncolon","\\Eqqcolon");Y("\\colonminus","\\coloneq");Y("\\coloncolonminus","\\Coloneq");Y("\\minuscolon","\\eqcolon");Y("\\minuscoloncolon","\\Eqcolon");Y("\\coloncolonapprox","\\Colonapprox");Y("\\coloncolonsim","\\Colonsim");Y("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Y("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");Y("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Y("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");Y("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");Y("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");Y("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");Y("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");Y("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");Y("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");Y("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");Y("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");Y("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");Y("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");Y("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");Y("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");Y("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");Y("\\nleqq","\\html@mathml{\\@nleqq}{≰}");Y("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");Y("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");Y("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");Y("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");Y("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");Y("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");Y("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");Y("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");Y("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");Y("\\imath","\\html@mathml{\\@imath}{ı}");Y("\\jmath","\\html@mathml{\\@jmath}{ȷ}");Y("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");Y("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");Y("⟦","\\llbracket");Y("⟧","\\rrbracket");Y("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");Y("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");Y("⦃","\\lBrace");Y("⦄","\\rBrace");Y("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");Y("⦵","\\minuso");Y("\\darr","\\downarrow");Y("\\dArr","\\Downarrow");Y("\\Darr","\\Downarrow");Y("\\lang","\\langle");Y("\\rang","\\rangle");Y("\\uarr","\\uparrow");Y("\\uArr","\\Uparrow");Y("\\Uarr","\\Uparrow");Y("\\N","\\mathbb{N}");Y("\\R","\\mathbb{R}");Y("\\Z","\\mathbb{Z}");Y("\\alef","\\aleph");Y("\\alefsym","\\aleph");Y("\\Alpha","\\mathrm{A}");Y("\\Beta","\\mathrm{B}");Y("\\bull","\\bullet");Y("\\Chi","\\mathrm{X}");Y("\\clubs","\\clubsuit");Y("\\cnums","\\mathbb{C}");Y("\\Complex","\\mathbb{C}");Y("\\Dagger","\\ddagger");Y("\\diamonds","\\diamondsuit");Y("\\empty","\\emptyset");Y("\\Epsilon","\\mathrm{E}");Y("\\Eta","\\mathrm{H}");Y("\\exist","\\exists");Y("\\harr","\\leftrightarrow");Y("\\hArr","\\Leftrightarrow");Y("\\Harr","\\Leftrightarrow");Y("\\hearts","\\heartsuit");Y("\\image","\\Im");Y("\\infin","\\infty");Y("\\Iota","\\mathrm{I}");Y("\\isin","\\in");Y("\\Kappa","\\mathrm{K}");Y("\\larr","\\leftarrow");Y("\\lArr","\\Leftarrow");Y("\\Larr","\\Leftarrow");Y("\\lrarr","\\leftrightarrow");Y("\\lrArr","\\Leftrightarrow");Y("\\Lrarr","\\Leftrightarrow");Y("\\Mu","\\mathrm{M}");Y("\\natnums","\\mathbb{N}");Y("\\Nu","\\mathrm{N}");Y("\\Omicron","\\mathrm{O}");Y("\\plusmn","\\pm");Y("\\rarr","\\rightarrow");Y("\\rArr","\\Rightarrow");Y("\\Rarr","\\Rightarrow");Y("\\real","\\Re");Y("\\reals","\\mathbb{R}");Y("\\Reals","\\mathbb{R}");Y("\\Rho","\\mathrm{P}");Y("\\sdot","\\cdot");Y("\\sect","\\S");Y("\\spades","\\spadesuit");Y("\\sub","\\subset");Y("\\sube","\\subseteq");Y("\\supe","\\supseteq");Y("\\Tau","\\mathrm{T}");Y("\\thetasym","\\vartheta");Y("\\weierp","\\wp");Y("\\Zeta","\\mathrm{Z}");Y("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");Y("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");Y("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");Y("\\bra","\\mathinner{\\langle{#1}|}");Y("\\ket","\\mathinner{|{#1}\\rangle}");Y("\\braket","\\mathinner{\\langle{#1}\\rangle}");Y("\\Bra","\\left\\langle#1\\right|");Y("\\Ket","\\left|#1\\right\\rangle");var QY=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 c=h=>m=>{e&&(m.macros.set("|",o),r.length&&m.macros.set("\\|",a));var p=h;if(!h&&r.length){var g=m.future();g.text==="|"&&(m.popToken(),p=!0)}return{tokens:p?r:s,numArgs:0}};t.macros.set("|",c(!1)),r.length&&t.macros.set("\\|",c(!0));var u=t.consumeArg().tokens,d=t.expandTokens([...i,...u,...n]);return t.macros.endGroup(),{tokens:d.reverse(),numArgs:0}};Y("\\bra@ket",QY(!1));Y("\\bra@set",QY(!0));Y("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");Y("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");Y("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");Y("\\angln","{\\angl n}");Y("\\blue","\\textcolor{##6495ed}{#1}");Y("\\orange","\\textcolor{##ffa500}{#1}");Y("\\pink","\\textcolor{##ff00af}{#1}");Y("\\red","\\textcolor{##df0030}{#1}");Y("\\green","\\textcolor{##28ae7b}{#1}");Y("\\gray","\\textcolor{gray}{#1}");Y("\\purple","\\textcolor{##9d38bd}{#1}");Y("\\blueA","\\textcolor{##ccfaff}{#1}");Y("\\blueB","\\textcolor{##80f6ff}{#1}");Y("\\blueC","\\textcolor{##63d9ea}{#1}");Y("\\blueD","\\textcolor{##11accd}{#1}");Y("\\blueE","\\textcolor{##0c7f99}{#1}");Y("\\tealA","\\textcolor{##94fff5}{#1}");Y("\\tealB","\\textcolor{##26edd5}{#1}");Y("\\tealC","\\textcolor{##01d1c1}{#1}");Y("\\tealD","\\textcolor{##01a995}{#1}");Y("\\tealE","\\textcolor{##208170}{#1}");Y("\\greenA","\\textcolor{##b6ffb0}{#1}");Y("\\greenB","\\textcolor{##8af281}{#1}");Y("\\greenC","\\textcolor{##74cf70}{#1}");Y("\\greenD","\\textcolor{##1fab54}{#1}");Y("\\greenE","\\textcolor{##0d923f}{#1}");Y("\\goldA","\\textcolor{##ffd0a9}{#1}");Y("\\goldB","\\textcolor{##ffbb71}{#1}");Y("\\goldC","\\textcolor{##ff9c39}{#1}");Y("\\goldD","\\textcolor{##e07d10}{#1}");Y("\\goldE","\\textcolor{##a75a05}{#1}");Y("\\redA","\\textcolor{##fca9a9}{#1}");Y("\\redB","\\textcolor{##ff8482}{#1}");Y("\\redC","\\textcolor{##f9685d}{#1}");Y("\\redD","\\textcolor{##e84d39}{#1}");Y("\\redE","\\textcolor{##bc2612}{#1}");Y("\\maroonA","\\textcolor{##ffbde0}{#1}");Y("\\maroonB","\\textcolor{##ff92c6}{#1}");Y("\\maroonC","\\textcolor{##ed5fa6}{#1}");Y("\\maroonD","\\textcolor{##ca337c}{#1}");Y("\\maroonE","\\textcolor{##9e034e}{#1}");Y("\\purpleA","\\textcolor{##ddd7ff}{#1}");Y("\\purpleB","\\textcolor{##c6b9fc}{#1}");Y("\\purpleC","\\textcolor{##aa87ff}{#1}");Y("\\purpleD","\\textcolor{##7854ab}{#1}");Y("\\purpleE","\\textcolor{##543b78}{#1}");Y("\\mintA","\\textcolor{##f5f9e8}{#1}");Y("\\mintB","\\textcolor{##edf2df}{#1}");Y("\\mintC","\\textcolor{##e0e5cc}{#1}");Y("\\grayA","\\textcolor{##f6f7f7}{#1}");Y("\\grayB","\\textcolor{##f0f1f2}{#1}");Y("\\grayC","\\textcolor{##e3e5e6}{#1}");Y("\\grayD","\\textcolor{##d6d8da}{#1}");Y("\\grayE","\\textcolor{##babec2}{#1}");Y("\\grayF","\\textcolor{##888d93}{#1}");Y("\\grayG","\\textcolor{##626569}{#1}");Y("\\grayH","\\textcolor{##3b3e40}{#1}");Y("\\grayI","\\textcolor{##21242c}{#1}");Y("\\kaBlue","\\textcolor{##314453}{#1}");Y("\\kaGreen","\\textcolor{##71B307}{#1}");var JY={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class j2e{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 E2e(A2e,n.macros),this.mode=s,this.stack=[]}feed(t){this.lexer=new JO(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 xl("EOF",s.loc)),this.pushTokens(r),new xl("",Da.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 _t("Extra }",i)}else if(i.text==="EOF")throw new _t("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 _t("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 _t("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 _t("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 _t("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 c=i[a];if(c.text==="#"){if(a===0)throw new _t("Incomplete placeholder at end of macro body",c);if(c=i[--a],c.text==="#")i.splice(a+1,1);else if(/^[1-9]$/.test(c.text))i.splice(a,2,...o[+c.text-1]);else throw new _t("Not a valid argument number",c)}}}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 xl(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 JO(r,this.settings),c=[],u=a.lex();u.text!=="EOF";)c.push(u),u=a.lex();c.reverse();var d={tokens:c,numArgs:i};return d}return r}isDefined(t){return this.macros.has(t)||Uh.hasOwnProperty(t)||Zr.math.hasOwnProperty(t)||Zr.text.hasOwnProperty(t)||JY.hasOwnProperty(t)}isExpandable(t){var n=this.macros.get(t);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:Uh.hasOwnProperty(t)&&!Uh[t].primitive}}var tB=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,nk=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","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),CT={"́":{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"}},nB={á:"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 ZY=class eX{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 j2e(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 _t("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 xl("}")),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(eX.endOfExpression.has(r.text)||n&&r.text===n||t&&Uh[r.text]&&Uh[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 _t("only one infix operator per group",i.token);n=r,s=i.replaceWith}}if(n!==-1&&s){var o,a,c=t.slice(0,n),u=t.slice(n+1);c.length===1&&c[0].type==="ordgroup"?o=c[0]:o={type:"ordgroup",mode:this.mode,body:c},u.length===1&&u[0].type==="ordgroup"?a=u[0]:a={type:"ordgroup",mode:this.mode,body:u};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 _t("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 _t("Limit controls must follow a math operator",i);this.consume()}else if(i.text==="^"){if(s)throw new _t("Double superscript",i);s=this.handleSupSubscript("superscript")}else if(i.text==="_"){if(r)throw new _t("Double subscript",i);r=this.handleSupSubscript("subscript")}else if(i.text==="'"){if(s)throw new _t("Double superscript",i);var a={type:"textord",mode:this.mode,text:"\\prime"},c=[a];for(this.consume();this.fetch().text==="'";)c.push(a),this.consume();this.fetch().text==="^"&&c.push(this.handleSupSubscript("superscript")),s={type:"ordgroup",mode:this.mode,body:c}}else if(nk[i.text]){var u=tB.test(i.text),d=[];for(d.push(new xl(nk[i.text])),this.consume();;){var h=this.fetch().text;if(!nk[h]||tB.test(h)!==u)break;d.unshift(new xl(nk[h])),this.consume()}var m=this.subparse(d);u?r={type:"ordgroup",mode:"math",body:m}:s={type:"ordgroup",mode:"math",body:m}}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=Uh[r];if(!i)return null;if(this.consume(),n&&n!=="atom"&&!i.allowedInArgument)throw new _t("Got function '"+r+"' with no arguments"+(n?" as "+n:""),s);if(this.mode==="text"&&!i.allowedInText)throw new _t("Can't use function '"+r+"' in text mode",s);if(this.mode==="math"&&i.allowedInMath===!1)throw new _t("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=Uh[t];if(a&&a.handler)return a.handler(o,n,s);throw new _t("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],c=o<n.numOptionalArgs;("primitive"in n&&n.primitive&&a==null||n.type==="sqrt"&&o===1&&i[0]==null)&&(a="primitive");var u=this.parseGroupOfType("argument to '"+t+"'",a,c);if(c)i.push(u);else if(u!=null)r.push(u);else throw new _t("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 _t("A primitive argument cannot be optional");var o=this.parseGroup(t);if(o==null)throw new _t("Expected group as "+t,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(s);default:throw new _t("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 _t("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 _t("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 _t("Invalid size: '"+n.text+"'",n);var i={number:+(r[1]+r[2]),unit:r[3]};if(!iY(i))throw new _t("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),c=this.fetch();this.expect(o),this.gullet.endGroup(),i={type:"ordgroup",mode:this.mode,loc:Da.range(s,c),body:a,semisimple:r==="\\begingroup"||void 0}}else if(i=this.parseFunction(n,t)||this.parseSymbol(),i==null&&r[0]==="\\"&&!JY.hasOwnProperty(r)){if(this.settings.throwOnError)throw new _t("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:Da.range(r,a),text:"---"}),n-=2):(t.splice(s,2,{type:"textord",mode:"text",loc:Da.range(r,o),text:"--"}),n-=1)}(i==="'"||i==="`")&&o.text===i&&(t.splice(s,2,{type:"textord",mode:"text",loc:Da.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 _t(`\\verb assertion failed --
                    please report what input caused this bug`);return s=s.slice(1,-1),{type:"verb",mode:"text",body:s,star:r}}nB.hasOwnProperty(n[0])&&!Zr[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=nB[n[0]]+n.slice(1));var i=C2e.exec(n);i&&(n=n.substring(0,i.index),n==="i"?n="ı":n==="j"&&(n="ȷ"));var o;if(Zr[this.mode][n]){this.settings.strict&&this.mode==="math"&&V7.includes(n)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',t);var a=Zr[this.mode][n].group,c=Da.range(t),u;Wke(a)?u={type:"atom",mode:this.mode,family:a,loc:c,text:n}:u={type:a,mode:this.mode,loc:c,text:n},o=u}else if(n.charCodeAt(0)>=128)this.settings.strict&&(rY(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:Da.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(!CT[h])throw new _t("Unknown accent ' "+h+"'",t);var m=CT[h][this.mode]||CT[h].text;if(!m)throw new _t("Accent "+h+" unsupported in "+this.mode+" mode",t);o={type:"accent",mode:this.mode,loc:Da.range(t),label:m,isStretchy:!1,isShifty:!0,base:o}}return o}};ZY.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var wj=function(t,n){if(!(typeof t=="string"||t instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var s=new ZY(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 _t("\\tag works only in display equations");r=[{type:"tag",mode:"text",body:r,tag:s.subparse([new xl("\\df@tag")])}]}return r},kj=function(t,n,s){n.textContent="";var r=e3(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."),kj=function(){throw new _t("KaTeX doesn't work in quirks mode.")});var tX=function(t,n){var s=e3(t,n).toMarkup();return s},nX=function(t,n){var s=new aj(n);return wj(t,s)},sX=function(t,n,s){if(s.throwOnError||!(t instanceof _t))throw t;var r=yt(["katex-error"],[new _l(n)]);return r.setAttribute("title",t.toString()),r.setAttribute("style","color:"+s.errorColor),r},e3=function(t,n){var s=new aj(n);try{var r=wj(t,s);return Bke(r,t,s)}catch(i){return sX(i,t,s)}},rX=function(t,n){var s=new aj(n);try{var r=wj(t,s);return $ke(r,t,s)}catch(i){return sX(i,t,s)}},iX="0.16.47",oX={Span:T1,Anchor:q4,SymbolNode:_l,SvgNode:qd,PathNode:wf,LineNode:U7},oE={version:iX,render:kj,renderToString:tX,ParseError:_t,SETTINGS_SCHEMA:W_,__parse:nX,__renderToDomTree:e3,__renderToHTMLTree:rX,__setFontMetrics:cY,__defineSymbol:E,__defineFunction:nn,__defineMacro:Y,__domTree:oX};const Nwt=Object.freeze(Object.defineProperty({__proto__:null,ParseError:_t,SETTINGS_SCHEMA:W_,__defineFunction:nn,__defineMacro:Y,__defineSymbol:E,__domTree:oX,__parse:nX,__renderToDomTree:e3,__renderToHTMLTree:rX,__setFontMetrics:cY,default:oE,get render(){return kj},renderToString:tX,version:iX},Symbol.toStringTag,{value:"Module"})),M2e={};function sB(e){const t=this,n=e||M2e,s=t.data(),r=s.micromarkExtensions||(s.micromarkExtensions=[]),i=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),o=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);r.push($we(n)),i.push(Mwe()),o.push(Iwe(n))}const rB=/[#.]/g;function I2e(e,t){const n=e||"",s={};let r=0,i,o;for(;r<n.length;){rB.lastIndex=r;const a=rB.exec(n),c=n.slice(r,a?a.index:n.length);c&&(i?i==="#"?s.id=c:Array.isArray(s.className)?s.className.push(c):s.className=[c]:o=c,r+=c.length),a&&(i=a[0],r++)}return{type:"element",tagName:o||t||"div",properties:s,children:[]}}function aX(e,t,n){const s=n?P2e(n):void 0;function r(i,o,...a){let c;if(i==null){c={type:"root",children:[]};const u=o;a.unshift(u)}else{c=I2e(i,t);const u=c.tagName.toLowerCase(),d=s?s.get(u):void 0;if(c.tagName=d||u,R2e(o))a.unshift(o);else for(const[h,m]of Object.entries(o))D2e(e,c.properties,h,m)}for(const u of a)aE(c.children,u);return c.type==="element"&&c.tagName==="template"&&(c.content={type:"root",children:c.children},c.children=[]),c}return r}function R2e(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 D2e(e,t,n,s){const r=FN(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=CP(s):r.commaSeparated?i=vP(s):r.commaOrSpaceSeparated?i=CP(vP(s).join(" ")):i=iB(r,r.property,s):Array.isArray(s)?i=[...s]:i=r.property==="style"?L2e(s):String(s);if(Array.isArray(i)){const o=[];for(const a of i)o.push(iB(r,r.property,a));i=o}r.property==="className"&&Array.isArray(t.className)&&(i=t.className.concat(i)),t[r.property]=i}}function aE(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)aE(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?aE(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function iB(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||fx(n)===fx(t)))return!0}return n}function L2e(e){const t=[];for(const[n,s]of Object.entries(e))t.push([n,s].join(": "));return t.join("; ")}function P2e(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const O2e=["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"],B2e=aX(qN,"div"),$2e=aX(_1,"g",O2e),TT={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function z2e(e,t){return lX(e,{})||{type:"root",children:[]}}function lX(e,t){const n=F2e(e,t);return n&&t.afterTransform&&t.afterTransform(e,n),n}function F2e(e,t){switch(e.nodeType){case 1:return V2e(e,t);case 3:return H2e(e);case 8:return U2e(e);case 9:return oB(e,t);case 10:return q2e();case 11:return oB(e,t);default:return}}function oB(e,t){return{type:"root",children:cX(e,t)}}function q2e(){return{type:"doctype"}}function H2e(e){return{type:"text",value:e.nodeValue||""}}function U2e(e){return{type:"comment",value:e.nodeValue||""}}function V2e(e,t){const n=e.namespaceURI,s=n===TT.svg?$2e:B2e,r=n===TT.html?e.tagName.toLowerCase():e.tagName,i=n===TT.html&&r==="template"?e.content:e,o=e.getAttributeNames(),a={};let c=-1;for(;++c<o.length;)a[o[c]]=e.getAttribute(o[c])||"";return s(r,a,cX(i,t))}function cX(e,t){const n=e.childNodes,s=[];let r=-1;for(;++r<n.length;){const i=lX(n[r],t);i!==void 0&&s.push(i)}return s}new DOMParser;function W2e(e,t){const n=G2e(e);return z2e(n)}function G2e(e){const t=document.createElement("template");return t.innerHTML=e,t.content}const aB=function(e,t,n){const s=bv(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]},Op=function(e){if(e==null)return X2e;if(typeof e=="string")return Y2e(e);if(typeof e=="object")return K2e(e);if(typeof e=="function")return _j(e);throw new Error("Expected function, string, or array as `test`")};function K2e(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Op(e[n]);return _j(s);function s(...r){let i=-1;for(;++i<t.length;)if(t[i].apply(this,r))return!0;return!1}}function Y2e(e){return _j(t);function t(n){return n.tagName===e}}function _j(e){return t;function t(n,s,r){return!!(Q2e(n)&&e.call(this,n,typeof s=="number"?s:void 0,r||void 0))}}function X2e(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function Q2e(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const lB=/\n/g,cB=/[\t ]+/g,lE=Op("br"),uB=Op(i_e),J2e=Op("p"),dB=Op("tr"),Z2e=Op(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",r_e,o_e]),uX=Op(["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 e_e(e,t){const n=t||{},s="children"in e?e.children:[],r=uX(e),i=fX(e,{whitespace:n.whitespace||"normal"}),o=[];(e.type==="text"||e.type==="comment")&&o.push(...hX(e,{breakBefore:!0,breakAfter:!0}));let a=-1;for(;++a<s.length;)o.push(...dX(s[a],e,{whitespace:i,breakBefore:a?void 0:r,breakAfter:a<s.length-1?lE(s[a+1]):r}));const c=[];let u;for(a=-1;++a<o.length;){const d=o[a];typeof d=="number"?u!==void 0&&d>u&&(u=d):d&&(u!==void 0&&u>-1&&c.push(`
`.repeat(u)||" "),u=-1,c.push(d))}return c.join("")}function dX(e,t,n){return e.type==="element"?t_e(e,t,n):e.type==="text"?n.whitespace==="normal"?hX(e,n):n_e(e):[]}function t_e(e,t,n){const s=fX(e,n),r=e.children||[];let i=-1,o=[];if(Z2e(e))return o;let a,c;for(lE(e)||dB(e)&&aB(t,e,dB)?c=`
`:J2e(e)?(a=2,c=2):uX(e)&&(a=1,c=1);++i<r.length;)o=o.concat(dX(r[i],e,{whitespace:s,breakBefore:i?void 0:a,breakAfter:i<r.length-1?lE(r[i+1]):c}));return uB(e)&&aB(t,e,uB)&&o.push("	"),a&&o.unshift(a),c&&o.push(c),o}function hX(e,t){const n=String(e.value),s=[],r=[];let i=0;for(;i<=n.length;){lB.lastIndex=i;const c=lB.exec(n),u=c&&"index"in c?c.index:n.length;s.push(s_e(n.slice(i,u).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),i===0?t.breakBefore:!0,u===n.length?t.breakAfter:!0)),i=u+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 n_e(e){return[String(e.value)]}function s_e(e,t,n){const s=[];let r=0,i;for(;r<e.length;){cB.lastIndex=r;const o=cB.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 fX(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 r_e(e){return!!(e.properties||{}).hidden}function i_e(e){return e.tagName==="td"||e.tagName==="th"}function o_e(e){return e.tagName==="dialog"&&!(e.properties||{}).open}const a_e={},l_e=[];function hB(e){const t=e||a_e;return function(n,s){tj(n,"element",function(r,i){const o=Array.isArray(r.properties.className)?r.properties.className:l_e,a=o.includes("language-math"),c=o.includes("math-display"),u=o.includes("math-inline");let d=c;if(!a&&!c&&!u)return;let h=i[i.length-1],m=r;if(r.tagName==="code"&&a&&h&&h.type==="element"&&h.tagName==="pre"&&(m=h,h=i[i.length-2],d=!0),!h)return;const p=e_e(m,{whitespace:"pre"});let g;try{g=oE.renderToString(p,{...t,displayMode:d,throwOnError:!0})}catch(v){const x=v,y=x.name.toLowerCase();s.message("Could not render math with KaTeX",{ancestors:[...i,r],cause:x,place:r.position,ruleId:y,source:"rehype-katex"});try{g=oE.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(v)},children:[{type:"text",value:p}]}]}}typeof g=="string"&&(g=W2e(g).children);const b=h.children.indexOf(m);return h.children.splice(b,1,...g),jK})}}const mX=[{id:"abap",name:"ABAP",import:()=>ie(()=>import("./abap-DsBKuouk.js"),[])},{id:"actionscript-3",name:"ActionScript",import:()=>ie(()=>import("./actionscript-3-D_z4Izcz.js"),[])},{id:"ada",name:"Ada",import:()=>ie(()=>import("./ada-727ZlQH0.js"),[])},{id:"angular-html",name:"Angular HTML",import:()=>ie(()=>import("./angular-html-LfdN0zeE.js").then(e=>e.f),__vite__mapDeps([0,1,2,3]))},{id:"angular-ts",name:"Angular TypeScript",import:()=>ie(()=>import("./angular-ts-CKsD7JZE.js"),__vite__mapDeps([4,0,1,2,3,5]))},{id:"apache",name:"Apache Conf",import:()=>ie(()=>import("./apache-Dn00JSTd.js"),[])},{id:"apex",name:"Apex",import:()=>ie(()=>import("./apex-COJ4H7py.js"),[])},{id:"apl",name:"APL",import:()=>ie(()=>import("./apl-BBq3IX1j.js"),__vite__mapDeps([6,1,2,3,7,8,9]))},{id:"applescript",name:"AppleScript",import:()=>ie(()=>import("./applescript-Bu5BbsvL.js"),[])},{id:"ara",name:"Ara",import:()=>ie(()=>import("./ara-7O62HKoU.js"),[])},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>ie(()=>import("./asciidoc-BPT9niGB.js"),[])},{id:"asm",name:"Assembly",import:()=>ie(()=>import("./asm-Dhn9LcZ4.js"),[])},{id:"astro",name:"Astro",import:()=>ie(()=>import("./astro-CqkE3fuf.js"),__vite__mapDeps([10,9,2,11,3,12]))},{id:"awk",name:"AWK",import:()=>ie(()=>import("./awk-eg146-Ew.js"),[])},{id:"ballerina",name:"Ballerina",import:()=>ie(()=>import("./ballerina-Du268qiB.js"),[])},{id:"bat",name:"Batch File",aliases:["batch"],import:()=>ie(()=>import("./bat-fje9CFhw.js"),[])},{id:"beancount",name:"Beancount",import:()=>ie(()=>import("./beancount-BwXTMy5W.js"),[])},{id:"berry",name:"Berry",aliases:["be"],import:()=>ie(()=>import("./berry-3xVqZejG.js"),[])},{id:"bibtex",name:"BibTeX",import:()=>ie(()=>import("./bibtex-xW4inM5L.js"),[])},{id:"bicep",name:"Bicep",import:()=>ie(()=>import("./bicep-DHo0CJ0O.js"),[])},{id:"blade",name:"Blade",import:()=>ie(()=>import("./blade-a8OxSdnT.js"),__vite__mapDeps([13,1,2,3,7,8,14,9]))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>ie(()=>import("./bsl-Dgyn0ogV.js"),__vite__mapDeps([15,16]))},{id:"c",name:"C",import:()=>ie(()=>import("./c-C3t2pwGQ.js"),[])},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>ie(()=>import("./cadence-DNquZEk8.js"),[])},{id:"cairo",name:"Cairo",import:()=>ie(()=>import("./cairo--RitsXJZ.js"),__vite__mapDeps([17,18]))},{id:"clarity",name:"Clarity",import:()=>ie(()=>import("./clarity-BHOwM8T6.js"),[])},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>ie(()=>import("./clojure-DxSadP1t.js"),[])},{id:"cmake",name:"CMake",import:()=>ie(()=>import("./cmake-DbXoA79R.js"),[])},{id:"cobol",name:"COBOL",import:()=>ie(()=>import("./cobol-PTqiYgYu.js"),__vite__mapDeps([19,1,2,3,8]))},{id:"codeowners",name:"CODEOWNERS",import:()=>ie(()=>import("./codeowners-Bp6g37R7.js"),[])},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>ie(()=>import("./codeql-sacFqUAJ.js"),[])},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>ie(()=>import("./coffee-dyiR41kL.js"),__vite__mapDeps([20,2]))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>ie(()=>import("./common-lisp-C7gG9l05.js"),[])},{id:"coq",name:"Coq",import:()=>ie(()=>import("./coq-Dsg_Bt_b.js"),[])},{id:"cpp",name:"C++",aliases:["c++"],import:()=>ie(()=>import("./cpp-BksuvNSY.js"),__vite__mapDeps([21,22,23,24,14]))},{id:"crystal",name:"Crystal",import:()=>ie(()=>import("./crystal-DtDmRg-F.js"),__vite__mapDeps([25,1,2,3,14,24,26]))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>ie(()=>import("./csharp-D9R-vmeu.js"),[])},{id:"css",name:"CSS",import:()=>ie(()=>import("./css-BPhBrDlE.js"),[])},{id:"csv",name:"CSV",import:()=>ie(()=>import("./csv-B0qRVHPH.js"),[])},{id:"cue",name:"CUE",import:()=>ie(()=>import("./cue-DtFQj3wx.js"),[])},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>ie(()=>import("./cypher-m2LEI-9-.js"),[])},{id:"d",name:"D",import:()=>ie(()=>import("./d-BoXegm-a.js"),[])},{id:"dart",name:"Dart",import:()=>ie(()=>import("./dart-B9wLZaAG.js"),[])},{id:"dax",name:"DAX",import:()=>ie(()=>import("./dax-ClGRhx96.js"),[])},{id:"desktop",name:"Desktop",import:()=>ie(()=>import("./desktop-DEIpsLCJ.js"),[])},{id:"diff",name:"Diff",import:()=>ie(()=>import("./diff-BgYniUM_.js"),[])},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>ie(()=>import("./docker-COcR7UxN.js"),[])},{id:"dotenv",name:"dotEnv",import:()=>ie(()=>import("./dotenv-BjQB5zDj.js"),[])},{id:"dream-maker",name:"Dream Maker",import:()=>ie(()=>import("./dream-maker-C-nORZOA.js"),[])},{id:"edge",name:"Edge",import:()=>ie(()=>import("./edge-D5gP-w-T.js"),__vite__mapDeps([27,11,1,2,3,28]))},{id:"elixir",name:"Elixir",import:()=>ie(()=>import("./elixir-CLiX3zqd.js"),__vite__mapDeps([29,1,2,3]))},{id:"elm",name:"Elm",import:()=>ie(()=>import("./elm-CmHSxxaM.js"),__vite__mapDeps([30,23,24]))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>ie(()=>import("./emacs-lisp-BX77sIaO.js"),[])},{id:"erb",name:"ERB",import:()=>ie(()=>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:()=>ie(()=>import("./erlang-B-DoSBHF.js"),[])},{id:"fennel",name:"Fennel",import:()=>ie(()=>import("./fennel-bCA53EVm.js"),[])},{id:"fish",name:"Fish",import:()=>ie(()=>import("./fish-w-ucz2PV.js"),[])},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>ie(()=>import("./fluent-Dayu4EKP.js"),[])},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>ie(()=>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:()=>ie(()=>import("./fortran-free-form-DKXYxT9g.js"),[])},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>ie(()=>import("./fsharp-XplgxFYe.js"),__vite__mapDeps([41,42]))},{id:"gdresource",name:"GDResource",import:()=>ie(()=>import("./gdresource-BHYsBjWJ.js"),__vite__mapDeps([43,44,45]))},{id:"gdscript",name:"GDScript",import:()=>ie(()=>import("./gdscript-DfxzS6Rs.js"),[])},{id:"gdshader",name:"GDShader",import:()=>ie(()=>import("./gdshader-SKMF96pI.js"),[])},{id:"genie",name:"Genie",import:()=>ie(()=>import("./genie-ajMbGru0.js"),[])},{id:"gherkin",name:"Gherkin",import:()=>ie(()=>import("./gherkin--30QC5Em.js"),[])},{id:"git-commit",name:"Git Commit Message",import:()=>ie(()=>import("./git-commit-i4q6IMui.js"),__vite__mapDeps([46,47]))},{id:"git-rebase",name:"Git Rebase Message",import:()=>ie(()=>import("./git-rebase-B-v9cOL2.js"),__vite__mapDeps([48,26]))},{id:"gleam",name:"Gleam",import:()=>ie(()=>import("./gleam-B430Bg39.js"),[])},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>ie(()=>import("./glimmer-js-D-cwc0-E.js"),__vite__mapDeps([49,2,11,3,1]))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>ie(()=>import("./glimmer-ts-pgjy16dm.js"),__vite__mapDeps([50,11,3,2,1]))},{id:"glsl",name:"GLSL",import:()=>ie(()=>import("./glsl-DBO2IWDn.js"),__vite__mapDeps([23,24]))},{id:"gnuplot",name:"Gnuplot",import:()=>ie(()=>import("./gnuplot-CM8KxXT1.js"),[])},{id:"go",name:"Go",import:()=>ie(()=>import("./go-B1SYOhNW.js"),[])},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>ie(()=>import("./graphql-cDcHW_If.js"),__vite__mapDeps([34,2,11,35,36]))},{id:"groovy",name:"Groovy",import:()=>ie(()=>import("./groovy-DkBy-JyN.js"),[])},{id:"hack",name:"Hack",import:()=>ie(()=>import("./hack-D1yCygmZ.js"),__vite__mapDeps([51,1,2,3,14]))},{id:"haml",name:"Ruby Haml",import:()=>ie(()=>import("./haml-B2EZWmdv.js"),__vite__mapDeps([33,2,3]))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>ie(()=>import("./handlebars-BQGss363.js"),__vite__mapDeps([52,1,2,3,38]))},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>ie(()=>import("./haskell-BILxekzW.js"),[])},{id:"haxe",name:"Haxe",import:()=>ie(()=>import("./haxe-C5wWYbrZ.js"),[])},{id:"hcl",name:"HashiCorp HCL",import:()=>ie(()=>import("./hcl-HzYwdGDm.js"),[])},{id:"hjson",name:"Hjson",import:()=>ie(()=>import("./hjson-T-Tgc4AT.js"),[])},{id:"hlsl",name:"HLSL",import:()=>ie(()=>import("./hlsl-ifBTmRxC.js"),[])},{id:"html",name:"HTML",import:()=>ie(()=>import("./html-C2L_23MC.js"),__vite__mapDeps([1,2,3]))},{id:"html-derivative",name:"HTML (Derivative)",import:()=>ie(()=>import("./html-derivative-CSfWNPLT.js"),__vite__mapDeps([28,1,2,3]))},{id:"http",name:"HTTP",import:()=>ie(()=>import("./http-FRrOvY1W.js"),__vite__mapDeps([53,26,9,7,8,34,2,11,35,36]))},{id:"hxml",name:"HXML",import:()=>ie(()=>import("./hxml-TIA70rKU.js"),__vite__mapDeps([54,55]))},{id:"hy",name:"Hy",import:()=>ie(()=>import("./hy-BMj5Y0dO.js"),[])},{id:"imba",name:"Imba",import:()=>ie(()=>import("./imba-bv_oIlVt.js"),__vite__mapDeps([56,11]))},{id:"ini",name:"INI",aliases:["properties"],import:()=>ie(()=>import("./ini-BjABl1g7.js"),[])},{id:"java",name:"Java",import:()=>ie(()=>import("./java-xI-RfyKK.js"),[])},{id:"javascript",name:"JavaScript",aliases:["js"],import:()=>ie(()=>import("./javascript-ySlJ1b_l.js"),[])},{id:"jinja",name:"Jinja",import:()=>ie(()=>import("./jinja-DGy0s7-h.js"),__vite__mapDeps([57,1,2,3]))},{id:"jison",name:"Jison",import:()=>ie(()=>import("./jison-BqZprYcd.js"),__vite__mapDeps([58,2]))},{id:"json",name:"JSON",import:()=>ie(()=>import("./json-BQoSv7ci.js"),[])},{id:"json5",name:"JSON5",import:()=>ie(()=>import("./json5-w8dY5SsB.js"),[])},{id:"jsonc",name:"JSON with Comments",import:()=>ie(()=>import("./jsonc-TU54ms6u.js"),[])},{id:"jsonl",name:"JSON Lines",import:()=>ie(()=>import("./jsonl-DREVFZK8.js"),[])},{id:"jsonnet",name:"Jsonnet",import:()=>ie(()=>import("./jsonnet-BfivnA6A.js"),[])},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>ie(()=>import("./jssm-P4WzXJd0.js"),[])},{id:"jsx",name:"JSX",import:()=>ie(()=>import("./jsx-BAng5TT0.js"),[])},{id:"julia",name:"Julia",aliases:["jl"],import:()=>ie(()=>import("./julia-BBuGR-5E.js"),__vite__mapDeps([59,21,22,23,24,14,18,2,60]))},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>ie(()=>import("./kotlin-B5lbUyaz.js"),[])},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>ie(()=>import("./kusto-mebxcVVE.js"),[])},{id:"latex",name:"LaTeX",import:()=>ie(()=>import("./latex-C-cWTeAZ.js"),__vite__mapDeps([61,62,60]))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>ie(()=>import("./lean-XBlWyCtg.js"),[])},{id:"less",name:"Less",import:()=>ie(()=>import("./less-BfCpw3nA.js"),[])},{id:"liquid",name:"Liquid",import:()=>ie(()=>import("./liquid-D3W5UaiH.js"),__vite__mapDeps([63,1,2,3,9]))},{id:"log",name:"Log file",import:()=>ie(()=>import("./log-Cc5clBb7.js"),[])},{id:"logo",name:"Logo",import:()=>ie(()=>import("./logo-IuBKFhSY.js"),[])},{id:"lua",name:"Lua",import:()=>ie(()=>import("./lua-CvWAzNxB.js"),__vite__mapDeps([37,24]))},{id:"luau",name:"Luau",import:()=>ie(()=>import("./luau-Du5NY7AG.js"),[])},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>ie(()=>import("./make-Bvotw-X0.js"),[])},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>ie(()=>import("./markdown-UIAJJxZW.js"),[])},{id:"marko",name:"Marko",import:()=>ie(()=>import("./marko-z0MBrx5-.js"),__vite__mapDeps([64,3,65,5,2]))},{id:"matlab",name:"MATLAB",import:()=>ie(()=>import("./matlab-D9-PGadD.js"),[])},{id:"mdc",name:"MDC",import:()=>ie(()=>import("./mdc-DB_EDNY_.js"),__vite__mapDeps([66,42,38,28,1,2,3]))},{id:"mdx",name:"MDX",import:()=>ie(()=>import("./mdx-sdHcTMYB.js"),[])},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>ie(()=>import("./mermaid-Ci6OQyBP.js"),[])},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>ie(()=>import("./mipsasm-BC5c_5Pe.js"),[])},{id:"mojo",name:"Mojo",import:()=>ie(()=>import("./mojo-Tz6hzZYG.js"),[])},{id:"move",name:"Move",import:()=>ie(()=>import("./move-DB_GagMm.js"),[])},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>ie(()=>import("./narrat-DLbgOhZU.js"),[])},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>ie(()=>import("./nextflow-B0XVJmRM.js"),[])},{id:"nginx",name:"Nginx",import:()=>ie(()=>import("./nginx-D_VnBJ67.js"),__vite__mapDeps([67,37,24]))},{id:"nim",name:"Nim",import:()=>ie(()=>import("./nim-ZlGxZxc3.js"),__vite__mapDeps([68,24,1,2,3,7,8,23,42]))},{id:"nix",name:"Nix",import:()=>ie(()=>import("./nix-shcSOmrb.js"),[])},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>ie(()=>import("./nushell-D4Tzg5kh.js"),[])},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>ie(()=>import("./objective-c-Deuh7S70.js"),[])},{id:"objective-cpp",name:"Objective-C++",import:()=>ie(()=>import("./objective-cpp-BUEGK8hf.js"),[])},{id:"ocaml",name:"OCaml",import:()=>ie(()=>import("./ocaml-BNioltXt.js"),[])},{id:"pascal",name:"Pascal",import:()=>ie(()=>import("./pascal-JqZropPD.js"),[])},{id:"perl",name:"Perl",import:()=>ie(()=>import("./perl-CHQXSrWU.js"),__vite__mapDeps([69,1,2,3,7,8,14]))},{id:"php",name:"PHP",import:()=>ie(()=>import("./php-B5ebYQev.js"),__vite__mapDeps([70,1,2,3,7,8,14,9]))},{id:"plsql",name:"PL/SQL",import:()=>ie(()=>import("./plsql-LKU2TuZ1.js"),[])},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>ie(()=>import("./po-BFLt1xDp.js"),[])},{id:"polar",name:"Polar",import:()=>ie(()=>import("./polar-DKykz6zU.js"),[])},{id:"postcss",name:"PostCSS",import:()=>ie(()=>import("./postcss-B3ZDOciz.js"),[])},{id:"powerquery",name:"PowerQuery",import:()=>ie(()=>import("./powerquery-CSHBycmS.js"),[])},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:()=>ie(()=>import("./powershell-BIEUsx6d.js"),[])},{id:"prisma",name:"Prisma",import:()=>ie(()=>import("./prisma-B48N-Iqd.js"),[])},{id:"prolog",name:"Prolog",import:()=>ie(()=>import("./prolog-BY-TUvya.js"),[])},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>ie(()=>import("./proto-zocC4JxJ.js"),[])},{id:"pug",name:"Pug",aliases:["jade"],import:()=>ie(()=>import("./pug-CM9l7STV.js"),__vite__mapDeps([71,2,3,1]))},{id:"puppet",name:"Puppet",import:()=>ie(()=>import("./puppet-Cza_XSSt.js"),[])},{id:"purescript",name:"PureScript",import:()=>ie(()=>import("./purescript-Bg-kzb6g.js"),[])},{id:"python",name:"Python",aliases:["py"],import:()=>ie(()=>import("./python-DhUJRlN_.js"),[])},{id:"qml",name:"QML",import:()=>ie(()=>import("./qml-D8XfuvdV.js"),__vite__mapDeps([72,2]))},{id:"qmldir",name:"QML Directory",import:()=>ie(()=>import("./qmldir-C8lEn-DE.js"),[])},{id:"qss",name:"Qt Style Sheets",import:()=>ie(()=>import("./qss-DhMKtDLN.js"),[])},{id:"r",name:"R",import:()=>ie(()=>import("./r-CwjWoCRV.js"),[])},{id:"racket",name:"Racket",import:()=>ie(()=>import("./racket-CzouJOBO.js"),[])},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>ie(()=>import("./raku-B1bQXN8T.js"),[])},{id:"razor",name:"ASP.NET Razor",import:()=>ie(()=>import("./razor-CNLDkMZG.js"),__vite__mapDeps([73,1,2,3,74]))},{id:"reg",name:"Windows Registry Script",import:()=>ie(()=>import("./reg-5LuOXUq_.js"),[])},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>ie(()=>import("./regexp-DWJ3fJO_.js"),[])},{id:"rel",name:"Rel",import:()=>ie(()=>import("./rel-DJlmqQ1C.js"),[])},{id:"riscv",name:"RISC-V",import:()=>ie(()=>import("./riscv-QhoSD0DR.js"),[])},{id:"rst",name:"reStructuredText",import:()=>ie(()=>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:()=>ie(()=>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:()=>ie(()=>import("./rust-Be6lgOlo.js"),[])},{id:"sas",name:"SAS",import:()=>ie(()=>import("./sas-BmTFh92c.js"),__vite__mapDeps([77,14]))},{id:"sass",name:"Sass",import:()=>ie(()=>import("./sass-BJ4Li9vH.js"),[])},{id:"scala",name:"Scala",import:()=>ie(()=>import("./scala-DQVVAn-B.js"),[])},{id:"scheme",name:"Scheme",import:()=>ie(()=>import("./scheme-BJGe-b2p.js"),[])},{id:"scss",name:"SCSS",import:()=>ie(()=>import("./scss-C31hgJw-.js"),__vite__mapDeps([5,3]))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>ie(()=>import("./sdbl-BLhTXw86.js"),[])},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>ie(()=>import("./shaderlab-B7qAK45m.js"),__vite__mapDeps([78,79]))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>ie(()=>import("./shellscript-atvbtKCR.js"),[])},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>ie(()=>import("./shellsession-C_rIy8kc.js"),__vite__mapDeps([80,26]))},{id:"smalltalk",name:"Smalltalk",import:()=>ie(()=>import("./smalltalk-DkLiglaE.js"),[])},{id:"solidity",name:"Solidity",import:()=>ie(()=>import("./solidity-C1w2a3ep.js"),[])},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>ie(()=>import("./soy-C-lX7w71.js"),__vite__mapDeps([81,1,2,3]))},{id:"sparql",name:"SPARQL",import:()=>ie(()=>import("./sparql-bYkjHRlG.js"),__vite__mapDeps([82,83]))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>ie(()=>import("./splunk-Cf8iN4DR.js"),[])},{id:"sql",name:"SQL",import:()=>ie(()=>import("./sql-COK4E0Yg.js"),[])},{id:"ssh-config",name:"SSH Config",import:()=>ie(()=>import("./ssh-config-BknIz3MU.js"),[])},{id:"stata",name:"Stata",import:()=>ie(()=>import("./stata-DorPZHa4.js"),__vite__mapDeps([84,14]))},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>ie(()=>import("./stylus-BeQkCIfX.js"),[])},{id:"svelte",name:"Svelte",import:()=>ie(()=>import("./svelte-MSaWC3Je.js"),__vite__mapDeps([85,2,11,3,12]))},{id:"swift",name:"Swift",import:()=>ie(()=>import("./swift-BSxZ-RaX.js"),[])},{id:"system-verilog",name:"SystemVerilog",import:()=>ie(()=>import("./system-verilog-C7L56vO4.js"),[])},{id:"systemd",name:"Systemd Units",import:()=>ie(()=>import("./systemd-CUnW07Te.js"),[])},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>ie(()=>import("./talonscript-C1XDQQGZ.js"),[])},{id:"tasl",name:"Tasl",import:()=>ie(()=>import("./tasl-CQjiPCtT.js"),[])},{id:"tcl",name:"Tcl",import:()=>ie(()=>import("./tcl-DQ1-QYvQ.js"),[])},{id:"templ",name:"Templ",import:()=>ie(()=>import("./templ-dwX3ZSMB.js"),__vite__mapDeps([86,87,2,3]))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>ie(()=>import("./terraform-BbSNqyBO.js"),[])},{id:"tex",name:"TeX",import:()=>ie(()=>import("./tex-rYs2v40G.js"),__vite__mapDeps([62,60]))},{id:"toml",name:"TOML",import:()=>ie(()=>import("./toml-CB2ApiWb.js"),[])},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>ie(()=>import("./ts-tags-CipyTH0X.js"),__vite__mapDeps([88,11,3,2,23,24,1,14,7,8]))},{id:"tsv",name:"TSV",import:()=>ie(()=>import("./tsv-B_m7g4N7.js"),[])},{id:"tsx",name:"TSX",import:()=>ie(()=>import("./tsx-B6W0miNI.js"),[])},{id:"turtle",name:"Turtle",import:()=>ie(()=>import("./turtle-BMR_PYu6.js"),[])},{id:"twig",name:"Twig",import:()=>ie(()=>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:()=>ie(()=>import("./typescript-Dj6nwHGl.js"),[])},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>ie(()=>import("./typespec-BpWG_bgh.js"),[])},{id:"typst",name:"Typst",aliases:["typ"],import:()=>ie(()=>import("./typst-BVUVsWT6.js"),[])},{id:"v",name:"V",import:()=>ie(()=>import("./v-CAQ2eGtk.js"),[])},{id:"vala",name:"Vala",import:()=>ie(()=>import("./vala-BFOHcciG.js"),[])},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:()=>ie(()=>import("./vb-CdO5JTpU.js"),[])},{id:"verilog",name:"Verilog",import:()=>ie(()=>import("./verilog-CJaU5se_.js"),[])},{id:"vhdl",name:"VHDL",import:()=>ie(()=>import("./vhdl-DYoNaHQp.js"),[])},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>ie(()=>import("./viml-m4uW47V2.js"),[])},{id:"vue",name:"Vue",import:()=>ie(()=>import("./vue-BuYVFjOK.js"),__vite__mapDeps([90,1,2,3,11,9,28]))},{id:"vue-html",name:"Vue HTML",import:()=>ie(()=>import("./vue-html-xdeiXROB.js"),__vite__mapDeps([91,90,1,2,3,11,9,28]))},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>ie(()=>import("./vyper-nyqBNV6O.js"),[])},{id:"wasm",name:"WebAssembly",import:()=>ie(()=>import("./wasm-C6j12Q_x.js"),[])},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:()=>ie(()=>import("./wenyan-7A4Fjokl.js"),[])},{id:"wgsl",name:"WGSL",import:()=>ie(()=>import("./wgsl-CB0Krxn9.js"),[])},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>ie(()=>import("./wikitext-DCE3LsBG.js"),[])},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>ie(()=>import("./wolfram-C3FkfJm5.js"),[])},{id:"xml",name:"XML",import:()=>ie(()=>import("./xml-e3z08dGr.js"),__vite__mapDeps([7,8]))},{id:"xsl",name:"XSL",import:()=>ie(()=>import("./xsl-Dd0NUgwM.js"),__vite__mapDeps([92,7,8]))},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>ie(()=>import("./yaml-CVw76BM1.js"),[])},{id:"zenscript",name:"ZenScript",import:()=>ie(()=>import("./zenscript-HnGAYVZD.js"),[])},{id:"zig",name:"Zig",import:()=>ie(()=>import("./zig-BVz_zdnA.js"),[])}],c_e=Object.fromEntries(mX.map(e=>[e.id,e.import])),u_e=Object.fromEntries(mX.flatMap(e=>{var t;return((t=e.aliases)==null?void 0:t.map(n=>[n,e.import]))||[]})),d_e={...c_e,...u_e},h_e=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>ie(()=>import("./andromeeda-C3khCPGq.js"),[])},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>ie(()=>import("./aurora-x-D-2ljcwZ.js"),[])},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>ie(()=>import("./ayu-dark-Cv9koXgw.js"),[])},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>ie(()=>import("./catppuccin-frappe-CD_QflpE.js"),[])},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>ie(()=>import("./catppuccin-latte-DRW-0cLl.js"),[])},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>ie(()=>import("./catppuccin-macchiato-C-_shW-Y.js"),[])},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>ie(()=>import("./catppuccin-mocha-LGGdnPYs.js"),[])},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>ie(()=>import("./dark-plus-C3mMm8J8.js"),[])},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>ie(()=>import("./dracula-BzJJZx-M.js"),[])},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>ie(()=>import("./dracula-soft-BXkSAIEj.js"),[])},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>ie(()=>import("./everforest-dark-BgDCqdQA.js"),[])},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>ie(()=>import("./everforest-light-C8M2exoo.js"),[])},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>ie(()=>import("./github-dark-DHJKELXO.js"),[])},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>ie(()=>import("./github-dark-default-Cuk6v7N8.js"),[])},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>ie(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[])},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>ie(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[])},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>ie(()=>import("./github-light-DAi9KRSo.js"),[])},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>ie(()=>import("./github-light-default-D7oLnXFd.js"),[])},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>ie(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[])},{id:"houston",displayName:"Houston",type:"dark",import:()=>ie(()=>import("./houston-DnULxvSX.js"),[])},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>ie(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[])},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>ie(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[])},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>ie(()=>import("./kanagawa-wave-DWedfzmr.js"),[])},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>ie(()=>import("./laserwave-DUszq2jm.js"),[])},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>ie(()=>import("./light-plus-B7mTdjB0.js"),[])},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>ie(()=>import("./material-theme-D5KoaKCx.js"),[])},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>ie(()=>import("./material-theme-darker-BfHTSMKl.js"),[])},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>ie(()=>import("./material-theme-lighter-B0m2ddpp.js"),[])},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>ie(()=>import("./material-theme-ocean-CyktbL80.js"),[])},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>ie(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[])},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>ie(()=>import("./min-dark-CafNBF8u.js"),[])},{id:"min-light",displayName:"Min Light",type:"light",import:()=>ie(()=>import("./min-light-CTRr51gU.js"),[])},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>ie(()=>import("./monokai-D4h5O-jR.js"),[])},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>ie(()=>import("./night-owl-C39BiMTA.js"),[])},{id:"nord",displayName:"Nord",type:"dark",import:()=>ie(()=>import("./nord-Ddv68eIx.js"),[])},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>ie(()=>import("./one-dark-pro-GBQ2dnAY.js"),[])},{id:"one-light",displayName:"One Light",type:"light",import:()=>ie(()=>import("./one-light-PoHY5YXO.js"),[])},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>ie(()=>import("./plastic-3e1v2bzS.js"),[])},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>ie(()=>import("./poimandres-CS3Unz2-.js"),[])},{id:"red",displayName:"Red",type:"dark",import:()=>ie(()=>import("./red-bN70gL4F.js"),[])},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>ie(()=>import("./rose-pine-CmCqftbK.js"),[])},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>ie(()=>import("./rose-pine-dawn-Ds-gbosJ.js"),[])},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>ie(()=>import("./rose-pine-moon-CjDtw9vr.js"),[])},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>ie(()=>import("./slack-dark-BthQWCQV.js"),[])},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>ie(()=>import("./slack-ochin-DqwNpetd.js"),[])},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>ie(()=>import("./snazzy-light-Bw305WKR.js"),[])},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>ie(()=>import("./solarized-dark-DXbdFlpD.js"),[])},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>ie(()=>import("./solarized-light-L9t79GZl.js"),[])},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>ie(()=>import("./synthwave-84-CbfX1IO0.js"),[])},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>ie(()=>import("./tokyo-night-DBQeEorK.js"),[])},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>ie(()=>import("./vesper-BEBZ7ncR.js"),[])},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>ie(()=>import("./vitesse-black-Bkuqu6BP.js"),[])},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>ie(()=>import("./vitesse-dark-D0r3Knsf.js"),[])},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>ie(()=>import("./vitesse-light-CVO1_9PV.js"),[])}],f_e=Object.fromEntries(h_e.map(e=>[e.id,e.import]));let Sd=class extends Error{constructor(t){super(t),this.name="ShikiError"}},Sj=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function m_e(){return 2147483648}function p_e(){return typeof performance<"u"?performance.now():Date.now()}const g_e=(e,t)=>e+(t-e%t)%t;async function b_e(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,b){s.HEAPU8.copyWithin(p,g,g+b)}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 b=m_e();if(p>b)return!1;for(let v=1;v<=4;v*=2){let x=g*(1+.2/v);x=Math.min(x,p+100663296);const y=Math.min(b,g_e(Math.max(p,x),65536));if(o(y))return!0}return!1}const c=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function u(p,g,b=1024){const v=g+b;let x=g;for(;p[x]&&!(x>=v);)++x;if(x-g>16&&p.buffer&&c)return c.decode(p.subarray(g,x));let y="";for(;g<x;){let w=p[g++];if(!(w&128)){y+=String.fromCharCode(w);continue}const k=p[g++]&63;if((w&224)===192){y+=String.fromCharCode((w&31)<<6|k);continue}const T=p[g++]&63;if((w&240)===224?w=(w&15)<<12|k<<6|T:w=(w&7)<<18|k<<12|T<<6|p[g++]&63,w<65536)y+=String.fromCharCode(w);else{const S=w-65536;y+=String.fromCharCode(55296|S>>10,56320|S&1023)}}return y}function d(p,g){return p?u(s.HEAPU8,p,g):""}const h={emscripten_get_now:p_e,emscripten_memcpy_big:i,emscripten_resize_heap:a,fd_write:()=>0};async function m(){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 m(),s}var y_e=Object.defineProperty,x_e=(e,t,n)=>t in e?y_e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hi=(e,t,n)=>(x_e(e,typeof t!="symbol"?t+"":t,n),n);let ro=null;function v_e(e){throw new Sj(e.UTF8ToString(e.getLastOnigError()))}class t3{constructor(t){Hi(this,"utf16Length"),Hi(this,"utf8Length"),Hi(this,"utf16Value"),Hi(this,"utf8Value"),Hi(this,"utf16OffsetToUtf8"),Hi(this,"utf8OffsetToUtf16");const n=t.length,s=t3._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 c=0;for(let u=0;u<n;u++){const d=t.charCodeAt(u);let h=d,m=!1;if(d>=55296&&d<=56319&&u+1<n){const p=t.charCodeAt(u+1);p>=56320&&p<=57343&&(h=(d-55296<<10)+65536|p-56320,m=!0)}r&&(i[u]=c,m&&(i[u+1]=c),h<=127?o[c+0]=u:h<=2047?(o[c+0]=u,o[c+1]=u):h<=65535?(o[c+0]=u,o[c+1]=u,o[c+2]=u):(o[c+0]=u,o[c+1]=u,o[c+2]=u,o[c+3]=u)),h<=127?a[c++]=h:h<=2047?(a[c++]=192|(h&1984)>>>6,a[c++]=128|(h&63)>>>0):h<=65535?(a[c++]=224|(h&61440)>>>12,a[c++]=128|(h&4032)>>>6,a[c++]=128|(h&63)>>>0):(a[c++]=240|(h&1835008)>>>18,a[c++]=128|(h&258048)>>>12,a[c++]=128|(h&4032)>>>6,a[c++]=128|(h&63)>>>0),m&&u++}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 c=t.charCodeAt(s+1);c>=56320&&c<=57343&&(o=(i-55296<<10)+65536|c-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 tu=class{constructor(e){if(Hi(this,"id",++tu.LAST_ID),Hi(this,"_onigBinding"),Hi(this,"content"),Hi(this,"utf16Length"),Hi(this,"utf8Length"),Hi(this,"utf16OffsetToUtf8"),Hi(this,"utf8OffsetToUtf16"),Hi(this,"ptr"),!ro)throw new Sj("Must invoke loadWasm first.");this._onigBinding=ro,this.content=e;const t=new t3(e);this.utf16Length=t.utf16Length,this.utf8Length=t.utf8Length,this.utf16OffsetToUtf8=t.utf16OffsetToUtf8,this.utf8OffsetToUtf16=t.utf8OffsetToUtf16,this.utf8Length<1e4&&!tu._sharedPtrInUse?(tu._sharedPtr||(tu._sharedPtr=ro.omalloc(1e4)),tu._sharedPtrInUse=!0,ro.HEAPU8.set(t.utf8Value,tu._sharedPtr),this.ptr=tu._sharedPtr):this.ptr=t.createString(ro)}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===tu._sharedPtr?tu._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};let wv=tu;Hi(wv,"LAST_ID",0);Hi(wv,"_sharedPtr",0);Hi(wv,"_sharedPtrInUse",!1);class w_e{constructor(t){if(Hi(this,"_onigBinding"),Hi(this,"_ptr"),!ro)throw new Sj("Must invoke loadWasm first.");const n=[],s=[];for(let a=0,c=t.length;a<c;a++){const u=new t3(t[a]);n[a]=u.createString(ro),s[a]=u.utf8Length}const r=ro.omalloc(4*t.length);ro.HEAPU32.set(n,r/4);const i=ro.omalloc(4*t.length);ro.HEAPU32.set(s,i/4);const o=ro.createOnigScanner(r,i,t.length);for(let a=0,c=t.length;a<c;a++)ro.ofree(n[a]);ro.ofree(i),ro.ofree(r),o===0&&v_e(ro),this._onigBinding=ro,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 wv(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 c=o/4;const u=a[c++],d=a[c++],h=[];for(let m=0;m<d;m++){const p=t.convertUtf8OffsetToUtf16(a[c++]),g=t.convertUtf8OffsetToUtf16(a[c++]);h[m]={start:p,end:g,length:g-p}}return{index:u,captureIndices:h}}}function k_e(e){return typeof e.instantiator=="function"}function __e(e){return typeof e.default=="function"}function S_e(e){return typeof e.data<"u"}function C_e(e){return typeof Response<"u"&&e instanceof Response}function T_e(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 sk;function E_e(e){if(sk)return sk;async function t(){ro=await b_e(async n=>{let s=e;return s=await s,typeof s=="function"&&(s=await s(n)),typeof s=="function"&&(s=await s(n)),k_e(s)?s=await s.instantiator(n):__e(s)?s=await s.default(n):(S_e(s)&&(s=s.data),C_e(s)?typeof WebAssembly.instantiateStreaming=="function"?s=await A_e(s)(n):s=await N_e(s)(n):T_e(s)?s=await ET(s)(n):s instanceof WebAssembly.Module?s=await ET(s)(n):"default"in s&&s.default instanceof WebAssembly.Module&&(s=await ET(s.default)(n))),"instance"in s&&(s=s.instance),"exports"in s&&(s=s.exports),s})}return sk=t(),sk}function ET(e){return t=>WebAssembly.instantiate(e,t)}function A_e(e){return t=>WebAssembly.instantiateStreaming(e,t)}function N_e(e){return async t=>{const n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}let j_e;function M_e(){return j_e}async function pX(e){return e&&await E_e(e),{createScanner(t){return new w_e(t.map(n=>typeof n=="string"?n:n.source))},createString(t){return new wv(t)}}}function I_e(e){return Cj(e)}function Cj(e){return Array.isArray(e)?R_e(e):e instanceof RegExp?e:typeof e=="object"?D_e(e):e}function R_e(e){let t=[];for(let n=0,s=e.length;n<s;n++)t[n]=Cj(e[n]);return t}function D_e(e){let t={};for(let n in e)t[n]=Cj(e[n]);return t}function gX(e,...t){return t.forEach(n=>{for(let s in n)e[s]=n[s]}),e}function bX(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?bX(e.substring(0,e.length-1)):e.substr(~t+1)}var AT=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,rk=class{static hasCaptures(e){return e===null?!1:(AT.lastIndex=0,AT.test(e))}static replaceCaptures(e,t,n){return e.replace(AT,(s,r,i,o)=>{let a=n[parseInt(r||i,10)];if(a){let c=t.substring(a.start,a.end);for(;c[0]===".";)c=c.substring(1);switch(o){case"downcase":return c.toLowerCase();case"upcase":return c.toUpperCase();default:return c}}else return s})}};function yX(e,t){return e<t?-1:e>t?1:0}function xX(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=yX(e[r],t[r]);if(i!==0)return i}return 0}return n-s}function fB(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 vX(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var wX=class{constructor(e){Re(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}},J_=class{constructor(e,t,n){Re(this,"_cachedMatchRoot",new wX(e=>this._root.match(e)));this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(O_e(e),t)}static createFromParsedTheme(e,t){return $_e(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=>L_e(e.parent,r.parentScopes));return s?new kX(s.fontStyle,s.foreground,s.background):null}},NT=class M2{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const s of n)t=new M2(t,s);return t}static from(...t){let n=null;for(let s=0;s<t.length;s++)n=new M2(n,t[s]);return n}push(t){return new M2(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 L_e(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&&!P_e(e.scopeName,s);){if(r)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function P_e(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var kX=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function O_e(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 c=-1;if(typeof o.settings.fontStyle=="string"){c=0;let h=o.settings.fontStyle.split(" ");for(let m=0,p=h.length;m<p;m++)switch(h[m]){case"italic":c=c|1;break;case"bold":c=c|2;break;case"underline":c=c|4;break;case"strikethrough":c=c|8;break}}let u=null;typeof o.settings.foreground=="string"&&fB(o.settings.foreground)&&(u=o.settings.foreground);let d=null;typeof o.settings.background=="string"&&fB(o.settings.background)&&(d=o.settings.background);for(let h=0,m=a.length;h<m;h++){let g=a[h].trim().split(" "),b=g[g.length-1],v=null;g.length>1&&(v=g.slice(0,g.length-1),v.reverse()),n[s++]=new B_e(b,v,r,c,u,d)}}return n}var B_e=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}},pd=(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))(pd||{});function $_e(e,t){e.sort((c,u)=>{let d=yX(c.scope,u.scope);return d!==0||(d=xX(c.parentScopes,u.parentScopes),d!==0)?d:c.index-u.index});let n=0,s="#000000",r="#ffffff";for(;e.length>=1&&e[0].scope==="";){let c=e.shift();c.fontStyle!==-1&&(n=c.fontStyle),c.foreground!==null&&(s=c.foreground),c.background!==null&&(r=c.background)}let i=new z_e(t),o=new kX(n,i.getId(s),i.getId(r)),a=new q_e(new cE(0,null,-1,0,0),[]);for(let c=0,u=e.length;c<u;c++){let d=e[c];a.insert(0,d.scope,d.parentScopes,d.fontStyle,i.getId(d.foreground),i.getId(d.background))}return new J_(i,o,a)}var z_e=class{constructor(e){Re(this,"_isFrozen");Re(this,"_lastColorId");Re(this,"_id2color");Re(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)}},F_e=Object.freeze([]),cE=class _X{constructor(t,n,s,r,i){Re(this,"scopeDepth");Re(this,"parentScopes");Re(this,"fontStyle");Re(this,"foreground");Re(this,"background");this.scopeDepth=t,this.parentScopes=n||F_e,this.fontStyle=s,this.foreground=r,this.background=i}clone(){return new _X(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)}},q_e=class uE{constructor(t,n=[],s={}){Re(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(uE._cmpBySpecificity),n}insert(t,n,s,r,i,o){if(n===""){this._doInsertHere(t,s,r,i,o);return}let a=n.indexOf("."),c,u;a===-1?(c=n,u=""):(c=n.substring(0,a),u=n.substring(a+1));let d;this._children.hasOwnProperty(c)?d=this._children[c]:(d=new uE(this._mainRule.clone(),cE.cloneArr(this._rulesWithParentScopes)),this._children[c]=d),d.insert(t+1,u,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 c=this._rulesWithParentScopes[o];if(xX(c.parentScopes,n)===0){c.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 cE(t,n,s,r,i))}},qg=class Bl{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=Bl.getLanguageId(t),s=Bl.getTokenType(t),r=Bl.getFontStyle(t),i=Bl.getForeground(t),o=Bl.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 c=Bl.getLanguageId(t),u=Bl.getTokenType(t),d=Bl.containsBalancedBrackets(t)?1:0,h=Bl.getFontStyle(t),m=Bl.getForeground(t),p=Bl.getBackground(t);return n!==0&&(c=n),s!==8&&(u=s),r!==null&&(d=r?1:0),i!==-1&&(h=i),o!==0&&(m=o),a!==0&&(p=a),(c<<0|u<<8|d<<10|h<<11|m<<15|p<<24)>>>0}};function Z_(e,t){const n=[],s=H_e(e);let r=s.next();for(;r!==null;){let c=0;if(r.length===2&&r.charAt(1)===":"){switch(r.charAt(0)){case"R":c=1;break;case"L":c=-1;break;default:console.log(`Unknown priority ${r} in scope selector`)}r=s.next()}let u=o();if(n.push({matcher:u,priority:c}),r!==",")break;r=s.next()}return n;function i(){if(r==="-"){r=s.next();const c=i();return u=>!!c&&!c(u)}if(r==="("){r=s.next();const c=a();return r===")"&&(r=s.next()),c}if(mB(r)){const c=[];do c.push(r),r=s.next();while(mB(r));return u=>t(c,u)}return null}function o(){const c=[];let u=i();for(;u;)c.push(u),u=i();return d=>c.every(h=>h(d))}function a(){const c=[];let u=o();for(;u&&(c.push(u),r==="|"||r===",");){do r=s.next();while(r==="|"||r===",");u=o()}return d=>c.some(h=>h(d))}}function mB(e){return!!e&&!!e.match(/[\w\.:]+/)}function H_e(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 SX(e){typeof e.dispose=="function"&&e.dispose()}var yx=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},U_e=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},V_e=class{constructor(){Re(this,"_references",[]);Re(this,"_seenReferenceKeys",new Set);Re(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))}},W_e=class{constructor(e,t){Re(this,"seenFullScopeRequests",new Set);Re(this,"seenPartialScopeRequests",new Set);Re(this,"Q");this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new yx(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new V_e;for(const n of e)G_e(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof yx){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 G_e(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 yx?I2({baseGrammar:i,selfGrammar:r},s):dE(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 yx(a))}function dE(e,t,n){if(t.repository&&t.repository[e]){const s=t.repository[e];eS([s],t,n)}}function I2(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&eS(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&eS(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function eS(e,t,n){for(const s of e){if(n.visitedRule.has(s))continue;n.visitedRule.add(s);const r=s.repository?gX({},t.repository,s.repository):t.repository;Array.isArray(s.patterns)&&eS(s.patterns,{...t,repository:r},n);const i=s.include;if(!i)continue;const o=CX(i);switch(o.kind){case 0:I2({...t,selfGrammar:t.baseGrammar},n);break;case 1:I2(t,n);break;case 2:dE(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 c={baseGrammar:t.baseGrammar,selfGrammar:a,repository:r};o.kind===4?dE(o.ruleName,c,n):I2(c,n)}else o.kind===4?n.add(new U_e(o.scopeName,o.ruleName)):n.add(new yx(o.scopeName));break}}}var K_e=class{constructor(){Re(this,"kind",0)}},Y_e=class{constructor(){Re(this,"kind",1)}},X_e=class{constructor(e){Re(this,"kind",2);this.ruleName=e}},Q_e=class{constructor(e){Re(this,"kind",3);this.scopeName=e}},J_e=class{constructor(e,t){Re(this,"kind",4);this.scopeName=e,this.ruleName=t}};function CX(e){if(e==="$base")return new K_e;if(e==="$self")return new Y_e;const t=e.indexOf("#");if(t===-1)return new Q_e(e);if(t===0)return new X_e(e.substring(1));{const n=e.substring(0,t),s=e.substring(t+1);return new J_e(n,s)}}var Z_e=/\\(\d+)/,pB=/\\(\d+)/g,eSe=-1,TX=-2;var kv=class{constructor(t,n,s,r){Re(this,"$location");Re(this,"id");Re(this,"_nameIsCapturing");Re(this,"_name");Re(this,"_contentNameIsCapturing");Re(this,"_contentName");this.$location=t,this.id=n,this._name=s||null,this._nameIsCapturing=rk.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=rk.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${bX(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:rk.replaceCaptures(this._name,t,n)}getContentName(t,n){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:rk.replaceCaptures(this._contentName,t,n)}},tSe=class extends kv{constructor(t,n,s,r,i){super(t,n,s,r);Re(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!")}},nSe=class extends kv{constructor(t,n,s,r,i){super(t,n,s,null);Re(this,"_match");Re(this,"captures");Re(this,"_cachedCompiledPatterns");this._match=new xx(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 vx,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},gB=class extends kv{constructor(t,n,s,r,i){super(t,n,s,r);Re(this,"hasMissingPatterns");Re(this,"patterns");Re(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 vx,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},hE=class extends kv{constructor(t,n,s,r,i,o,a,c,u,d){super(t,n,s,r);Re(this,"_begin");Re(this,"beginCaptures");Re(this,"_end");Re(this,"endHasBackReferences");Re(this,"endCaptures");Re(this,"applyEndPatternLast");Re(this,"hasMissingPatterns");Re(this,"patterns");Re(this,"_cachedCompiledPatterns");this._begin=new xx(i,this.id),this.beginCaptures=o,this._end=new xx(a||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=c,this.applyEndPatternLast=u||!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 vx;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}},tS=class extends kv{constructor(t,n,s,r,i,o,a,c,u){super(t,n,s,r);Re(this,"_begin");Re(this,"beginCaptures");Re(this,"whileCaptures");Re(this,"_while");Re(this,"whileHasBackReferences");Re(this,"hasMissingPatterns");Re(this,"patterns");Re(this,"_cachedCompiledPatterns");Re(this,"_cachedCompiledWhilePatterns");this._begin=new xx(i,this.id),this.beginCaptures=o,this.whileCaptures=c,this._while=new xx(a,TX),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=u.patterns,this.hasMissingPatterns=u.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 vx;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 vx,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,n||""),this._cachedCompiledWhilePatterns}},EX=class Oo{static createCaptureRule(t,n,s,r,i){return t.registerRule(o=>new tSe(n,o,s,r,i))}static getCompiledRuleId(t,n,s){return t.id||n.registerRule(r=>{if(t.id=r,t.match)return new nSe(t.$vscodeTextmateLocation,t.id,t.name,t.match,Oo._compileCaptures(t.captures,n,s));if(typeof t.begin>"u"){t.repository&&(s=gX({},s,t.repository));let i=t.patterns;return typeof i>"u"&&t.include&&(i=[{include:t.include}]),new gB(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,Oo._compilePatterns(i,n,s))}return t.while?new tS(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Oo._compileCaptures(t.beginCaptures||t.captures,n,s),t.while,Oo._compileCaptures(t.whileCaptures||t.captures,n,s),Oo._compilePatterns(t.patterns,n,s)):new hE(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Oo._compileCaptures(t.beginCaptures||t.captures,n,s),t.end,Oo._compileCaptures(t.endCaptures||t.captures,n,s),t.applyEndPatternLast,Oo._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 c=0;t[o].patterns&&(c=Oo.getCompiledRuleId(t[o],n,s)),r[a]=Oo.createCaptureRule(n,t[o].$vscodeTextmateLocation,t[o].name,t[o].contentName,c)}}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 c=-1;if(a.include){const u=CX(a.include);switch(u.kind){case 0:case 1:c=Oo.getCompiledRuleId(s[a.include],n,s);break;case 2:let d=s[u.ruleName];d&&(c=Oo.getCompiledRuleId(d,n,s));break;case 3:case 4:const h=u.scopeName,m=u.kind===4?u.ruleName:null,p=n.getExternalGrammar(h,s);if(p)if(m){let g=p.repository[m];g&&(c=Oo.getCompiledRuleId(g,n,p.repository))}else c=Oo.getCompiledRuleId(p.repository.$self,n,p.repository);break}}else c=Oo.getCompiledRuleId(a,n,s);if(c!==-1){const u=n.getRule(c);let d=!1;if((u instanceof gB||u instanceof hE||u instanceof tS)&&u.hasMissingPatterns&&u.patterns.length===0&&(d=!0),d)continue;r.push(c)}}return{patterns:r,hasMissingPatterns:(t?t.length:0)!==r.length}}},xx=class AX{constructor(t,n){Re(this,"source");Re(this,"ruleId");Re(this,"hasAnchor");Re(this,"hasBackReferences");Re(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 u=t.charAt(a+1);u==="z"?(i.push(t.substring(r,a)),i.push("$(?!\\n)(?<!\\n)"),r=a+2):(u==="A"||u==="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=Z_e.test(this.source):this.hasBackReferences=!1}clone(){return new AX(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 pB.lastIndex=0,this.source.replace(pB,(r,i)=>vX(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,c;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&&(c=this.source.charAt(i+1),c==="A"?(t[i+1]="",n[i+1]="",s[i+1]="A",r[i+1]="A"):c==="G"?(t[i+1]="",n[i+1]="G",s[i+1]="",r[i+1]="G"):(t[i+1]=c,n[i+1]=c,s[i+1]=c,r[i+1]=c),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}},vx=class{constructor(){Re(this,"_items");Re(this,"_hasAnchors");Re(this,"_cached");Re(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 bB(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 bB(e,s,this._items.map(r=>r.ruleId))}},bB=class{constructor(e,t,n){Re(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}},jT=class{constructor(e,t){this.languageId=e,this.tokenType=t}},ud,sSe=(ud=class{constructor(t,n){Re(this,"_defaultAttributes");Re(this,"_embeddedLanguagesMatcher");Re(this,"_getBasicScopeAttributes",new wX(t=>{const n=this._scopeToLanguage(t),s=this._toStandardTokenType(t);return new jT(n,s)}));this._defaultAttributes=new jT(t,8),this._embeddedLanguagesMatcher=new rSe(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?ud._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const n=t.match(ud.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!")}},Re(ud,"_NULL_SCOPE_METADATA",new jT(0,0)),Re(ud,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),ud),rSe=class{constructor(e){Re(this,"values");Re(this,"scopesRegExp");if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([n,s])=>vX(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])}},yB=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function NX(e,t,n,s,r,i,o,a){const c=t.content.length;let u=!1,d=-1;if(o){const p=iSe(e,t,n,s,r,i);r=p.stack,s=p.linePos,n=p.isFirstLine,d=p.anchorPosition}const h=Date.now();for(;!u;){if(a!==0&&Date.now()-h>a)return new yB(r,!0);m()}return new yB(r,!1);function m(){const p=oSe(e,t,n,s,r,d);if(!p){i.produce(r,c),u=!0;return}const g=p.captureIndices,b=p.matchedRuleId,v=g&&g.length>0?g[0].end>s:!1;if(b===eSe){const x=r.getRule(e);i.produce(r,g[0].start),r=r.withContentNameScopesList(r.nameScopesList),Zb(e,t,n,r,i,x.endCaptures,g),i.produce(r,g[0].end);const y=r;if(r=r.parent,d=y.getAnchorPos(),!v&&y.getEnterPos()===s){r=y,i.produce(r,c),u=!0;return}}else{const x=e.getRule(b);i.produce(r,g[0].start);const y=r,w=x.getName(t.content,g),k=r.contentNameScopesList.pushAttributed(w,e);if(r=r.push(b,s,d,g[0].end===c,null,k,k),x instanceof hE){const T=x;Zb(e,t,n,r,i,T.beginCaptures,g),i.produce(r,g[0].end),d=g[0].end;const S=T.getContentName(t.content,g),C=k.pushAttributed(S,e);if(r=r.withContentNameScopesList(C),T.endHasBackReferences&&(r=r.withEndRule(T.getEndWithResolvedBackReferences(t.content,g))),!v&&y.hasSameRuleAs(r)){r=r.pop(),i.produce(r,c),u=!0;return}}else if(x instanceof tS){const T=x;Zb(e,t,n,r,i,T.beginCaptures,g),i.produce(r,g[0].end),d=g[0].end;const S=T.getContentName(t.content,g),C=k.pushAttributed(S,e);if(r=r.withContentNameScopesList(C),T.whileHasBackReferences&&(r=r.withEndRule(T.getWhileWithResolvedBackReferences(t.content,g))),!v&&y.hasSameRuleAs(r)){r=r.pop(),i.produce(r,c),u=!0;return}}else if(Zb(e,t,n,r,i,x.captures,g),i.produce(r,g[0].end),r=r.pop(),!v){r=r.safePop(),i.produce(r,c),u=!0;return}}g[0].end>s&&(s=g[0].end,n=!1)}}function iSe(e,t,n,s,r,i){let o=r.beginRuleCapturedEOL?0:-1;const a=[];for(let c=r;c;c=c.pop()){const u=c.getRule(e);u instanceof tS&&a.push({rule:u,stack:c})}for(let c=a.pop();c;c=a.pop()){const{ruleScanner:u,findOptions:d}=cSe(c.rule,e,c.stack.endRule,n,s===o),h=u.findNextMatchSync(t,s,d);if(h){if(h.ruleId!==TX){r=c.stack.pop();break}h.captureIndices&&h.captureIndices.length&&(i.produce(c.stack,h.captureIndices[0].start),Zb(e,t,n,c.stack,i,c.rule.whileCaptures,h.captureIndices),i.produce(c.stack,h.captureIndices[0].end),o=h.captureIndices[0].end,h.captureIndices[0].end>s&&(s=h.captureIndices[0].end,n=!1))}else{r=c.stack.pop();break}}return{stack:r,linePos:s,anchorPosition:o,isFirstLine:n}}function oSe(e,t,n,s,r,i){const o=aSe(e,t,n,s,r,i),a=e.getInjections();if(a.length===0)return o;const c=lSe(a,e,t,n,s,r,i);if(!c)return o;if(!o)return c;const u=o.captureIndices[0].start,d=c.captureIndices[0].start;return d<u||c.priorityMatch&&d===u?c:o}function aSe(e,t,n,s,r,i){const o=r.getRule(e),{ruleScanner:a,findOptions:c}=jX(o,e,r.endRule,n,s===i),u=a.findNextMatchSync(t,s,c);return u?{captureIndices:u.captureIndices,matchedRuleId:u.ruleId}:null}function lSe(e,t,n,s,r,i,o){let a=Number.MAX_VALUE,c=null,u,d=0;const h=i.contentNameScopesList.getScopeNames();for(let m=0,p=e.length;m<p;m++){const g=e[m];if(!g.matcher(h))continue;const b=t.getRule(g.ruleId),{ruleScanner:v,findOptions:x}=jX(b,t,null,s,r===o),y=v.findNextMatchSync(n,r,x);if(!y)continue;const w=y.captureIndices[0].start;if(!(w>=a)&&(a=w,c=y.captureIndices,u=y.ruleId,d=g.priority,a===r))break}return c?{priorityMatch:d===-1,captureIndices:c,matchedRuleId:u}:null}function jX(e,t,n,s,r){return{ruleScanner:e.compileAG(t,n,s,r),findOptions:0}}function cSe(e,t,n,s,r){return{ruleScanner:e.compileWhileAG(t,n,s,r),findOptions:0}}function Zb(e,t,n,s,r,i,o){if(i.length===0)return;const a=t.content,c=Math.min(i.length,o.length),u=[],d=o[0].end;for(let h=0;h<c;h++){const m=i[h];if(m===null)continue;const p=o[h];if(p.length===0)continue;if(p.start>d)break;for(;u.length>0&&u[u.length-1].endPos<=p.start;)r.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop();if(u.length>0?r.produceFromScopes(u[u.length-1].scopes,p.start):r.produce(s,p.start),m.retokenizeCapturedWithRuleId){const b=m.getName(a,o),v=s.contentNameScopesList.pushAttributed(b,e),x=m.getContentName(a,o),y=v.pushAttributed(x,e),w=s.push(m.retokenizeCapturedWithRuleId,p.start,-1,!1,null,v,y),k=e.createOnigString(a.substring(0,p.end));NX(e,k,n&&p.start===0,p.start,w,r,!1,0),SX(k);continue}const g=m.getName(a,o);if(g!==null){const v=(u.length>0?u[u.length-1].scopes:s.contentNameScopesList).pushAttributed(g,e);u.push(new uSe(v,p.end))}}for(;u.length>0;)r.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop()}var uSe=class{constructor(e,t){Re(this,"scopes");Re(this,"endPos");this.scopes=e,this.endPos=t}};function dSe(e,t,n,s,r,i,o,a){return new fSe(e,t,n,s,r,i,o,a)}function xB(e,t,n,s,r){const i=Z_(t,nS),o=EX.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 nS(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(hSe(t[r],s))return n=r+1,!0;return!1})}function hSe(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 fSe=class{constructor(e,t,n,s,r,i,o,a){Re(this,"_rootId");Re(this,"_lastRuleId");Re(this,"_ruleId2desc");Re(this,"_includedGrammars");Re(this,"_grammarRepository");Re(this,"_grammar");Re(this,"_injections");Re(this,"_basicScopeAttributesProvider");Re(this,"_tokenTypeMatchers");if(this._rootScopeName=e,this.balancedBracketSelectors=i,this._onigLib=a,this._basicScopeAttributesProvider=new sSe(n,s),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=vB(t,null),this._injections=null,this._tokenTypeMatchers=[],r)for(const c of Object.keys(r)){const u=Z_(c,nS);for(const d of u)this._tokenTypeMatchers.push({matcher:d.matcher,type:r[c]})}}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)xB(t,o,r[o],this,s);const i=this._grammarRepository.injections(n);i&&i.forEach(o=>{const a=this.getExternalGrammar(o);if(a){const c=a.injectionSelector;c&&xB(t,c,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]=vB(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=EX.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let r;if(!t||t===fE.NULL){r=!0;const u=this._basicScopeAttributesProvider.getDefaultAttributes(),d=this.themeProvider.getDefaults(),h=qg.set(0,u.languageId,u.tokenType,null,d.fontStyle,d.foregroundId,d.backgroundId),m=this.getRule(this._rootId).getName(null,null);let p;m?p=Oy.createRootAndLookUpScopeName(m,h,this):p=Oy.createRoot("unknown",h),t=new fE(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 pSe(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=NX(this,i,r,0,t,a,!0,s);return SX(i),{lineLength:o,lineTokens:a,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function vB(e,t){return e=I_e(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 Oy=class nu{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=NT.push(r,i.scopeNames),s=new nu(s,r,i.encodedTokenAttributes);return s}static createRoot(t,n){return new nu(null,new NT(null,t),n)}static createRootAndLookUpScopeName(t,n,s){const r=s.getMetadataForScope(t),i=new NT(null,t),o=s.themeProvider.themeMatch(i),a=nu.mergeAttributes(n,r,o);return new nu(null,i,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return nu.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),qg.set(t,n.languageId,n.tokenType,null,r,i,o)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return nu._pushAttributed(this,t,n);const s=t.split(/ /g);let r=this;for(const i of s)r=nu._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=nu.mergeAttributes(t.tokenAttributes,r,o);return new nu(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}},Yl,fE=(Yl=class{constructor(t,n,s,r,i,o,a,c){Re(this,"_stackElementBrand");Re(this,"_enterPos");Re(this,"_anchorPos");Re(this,"depth");this.parent=t,this.ruleId=n,this.beginRuleCapturedEOL=i,this.endRule=o,this.nameScopesList=a,this.contentNameScopesList=c,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=s,this._anchorPos=r}equals(t){return t===null?!1:Yl._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?Oy.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(){Yl._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,s,r,i,o,a){return new Yl(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 Yl(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=Oy.fromExtension((t==null?void 0:t.nameScopesList)??null,n.nameScopesList);return new Yl(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,s,Oy.fromExtension(s,n.contentNameScopesList))}},Re(Yl,"NULL",new Yl(null,0,0,0,!1,null,null,null)),Yl),mSe=class{constructor(e,t){Re(this,"balancedBracketScopes");Re(this,"unbalancedBracketScopes");Re(this,"allowAny",!1);this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):Z_(n,nS).map(s=>s.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>Z_(n,nS).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}},pSe=class{constructor(e,t,n,s){Re(this,"_emitBinaryTokens");Re(this,"_lineText");Re(this,"_tokens");Re(this,"_binaryTokens");Re(this,"_lastTokenEndIndex");Re(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=qg.set(r,0,a.type,null,-1,0,0));this.balancedBracketSelectors&&(i=this.balancedBracketSelectors.match(o))}if(i&&(r=qg.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}},gSe=class{constructor(e,t){Re(this,"_grammars",new Map);Re(this,"_rawGrammars",new Map);Re(this,"_injectionGrammars",new Map);Re(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,dSe(e,i,t,n,s,r,this,this._onigLib))}return this._grammars.get(e)}},bSe=class{constructor(t){Re(this,"_options");Re(this,"_syncRegistry");Re(this,"_ensureGrammarCache");this._options=t,this._syncRegistry=new gSe(J_.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme(J_.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 mSe(s.balancedBracketSelectors||[],s.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,s,r,i){const o=new W_e(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)}},mE=fE.NULL;const ySe=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],xSe=/["&'<>`]/g,vSe=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,wSe=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,kSe=/[|\\{}()[\]^$+*?.]/g,wB=new WeakMap;function _Se(e,t){if(e=e.replace(t.subset?SSe(t.subset):xSe,s),t.subset||t.escapeOnly)return e;return e.replace(vSe,n).replace(wSe,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 SSe(e){let t=wB.get(e);return t||(t=CSe(e),wB.set(e,t)),t}function CSe(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(kSe,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const TSe=/[\dA-Fa-f]/;function ESe(e,t,n){const s="&#x"+e.toString(16).toUpperCase();return n&&t&&!TSe.test(String.fromCharCode(t))?s:s+";"}const ASe=/\d/;function NSe(e,t,n){const s="&#"+String(e);return n&&t&&!ASe.test(String.fromCharCode(t))?s:s+";"}const jSe=["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"],MT={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:"€"},MSe=["cent","copy","divide","gt","lt","not","para","times"],MX={}.hasOwnProperty,pE={};let ik;for(ik in MT)MX.call(MT,ik)&&(pE[MT[ik]]=ik);const ISe=/[^\dA-Za-z]/;function RSe(e,t,n,s){const r=String.fromCharCode(e);if(MX.call(pE,r)){const i=pE[r],o="&"+i;return n&&jSe.includes(i)&&!MSe.includes(i)&&(!s||t&&t!==61&&ISe.test(String.fromCharCode(t)))?o:o+";"}return""}function DSe(e,t,n){let s=ESe(e,t,n.omitOptionalSemicolons),r;if((n.useNamedReferences||n.useShortestReferences)&&(r=RSe(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!r)&&n.useShortestReferences){const i=NSe(e,t,n.omitOptionalSemicolons);i.length<s.length&&(s=i)}return r&&(!n.useShortestReferences||r.length<s.length)?r:s}function hg(e,t){return _Se(e,Object.assign({format:DSe},t))}const LSe=/^>|^->|<!--|-->|--!>|<!-$/g,PSe=[">"],OSe=["<",">"];function BSe(e,t,n,s){return s.settings.bogusComments?"<?"+hg(e.value,Object.assign({},s.settings.characterReferences,{subset:PSe}))+">":"<!--"+e.value.replace(LSe,r)+"-->";function r(i){return hg(i,Object.assign({},s.settings.characterReferences,{subset:OSe}))}}function $Se(e,t,n,s){return"<!"+(s.settings.upperDoctype?"DOCTYPE":"doctype")+(s.settings.tightDoctype?"":" ")+"html>"}const Xi=RX(1),IX=RX(-1),zSe=[];function RX(e){return t;function t(n,s,r){const i=n?n.children:zSe;let o=(s||0)+e,a=i[o];if(!r)for(;a&&P4(a);)o+=e,a=i[o];return a}}const FSe={}.hasOwnProperty;function DX(e){return t;function t(n,s,r){return FSe.call(e,n.tagName)&&e[n.tagName](n,s,r)}}const Tj=DX({body:HSe,caption:IT,colgroup:IT,dd:GSe,dt:WSe,head:IT,html:qSe,li:VSe,optgroup:KSe,option:YSe,p:USe,rp:kB,rt:kB,tbody:QSe,td:_B,tfoot:JSe,th:_B,thead:XSe,tr:ZSe});function IT(e,t,n){const s=Xi(n,t,!0);return!s||s.type!=="comment"&&!(s.type==="text"&&P4(s.value.charAt(0)))}function qSe(e,t,n){const s=Xi(n,t);return!s||s.type!=="comment"}function HSe(e,t,n){const s=Xi(n,t);return!s||s.type!=="comment"}function USe(e,t,n){const s=Xi(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 VSe(e,t,n){const s=Xi(n,t);return!s||s.type==="element"&&s.tagName==="li"}function WSe(e,t,n){const s=Xi(n,t);return!!(s&&s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd"))}function GSe(e,t,n){const s=Xi(n,t);return!s||s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd")}function kB(e,t,n){const s=Xi(n,t);return!s||s.type==="element"&&(s.tagName==="rp"||s.tagName==="rt")}function KSe(e,t,n){const s=Xi(n,t);return!s||s.type==="element"&&s.tagName==="optgroup"}function YSe(e,t,n){const s=Xi(n,t);return!s||s.type==="element"&&(s.tagName==="option"||s.tagName==="optgroup")}function XSe(e,t,n){const s=Xi(n,t);return!!(s&&s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot"))}function QSe(e,t,n){const s=Xi(n,t);return!s||s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot")}function JSe(e,t,n){return!Xi(n,t)}function ZSe(e,t,n){const s=Xi(n,t);return!s||s.type==="element"&&s.tagName==="tr"}function _B(e,t,n){const s=Xi(n,t);return!s||s.type==="element"&&(s.tagName==="td"||s.tagName==="th")}const e4e=DX({body:s4e,colgroup:r4e,head:n4e,html:t4e,tbody:i4e});function t4e(e){const t=Xi(e,-1);return!t||t.type!=="comment"}function n4e(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 s4e(e){const t=Xi(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&P4(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function r4e(e,t,n){const s=IX(n,t),r=Xi(e,-1,!0);return n&&s&&s.type==="element"&&s.tagName==="colgroup"&&Tj(s,n.children.indexOf(s),n)?!1:!!(r&&r.type==="element"&&r.tagName==="col")}function i4e(e,t,n){const s=IX(n,t),r=Xi(e,-1);return n&&s&&s.type==="element"&&(s.tagName==="thead"||s.tagName==="tbody")&&Tj(s,n.children.indexOf(s),n)?!1:!!(r&&r.type==="element"&&r.tagName==="tr")}const ok={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 o4e(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 c;r.space==="html"&&e.tagName==="svg"&&(s.schema=_1);const u=a4e(s,e.properties),d=s.all(r.space==="html"&&e.tagName==="template"?e.content:e);return s.schema=r,d&&(o=!1),(u||!i||!e4e(e,t,n))&&(a.push("<",e.tagName,u?" "+u:""),o&&(r.space==="svg"||s.settings.closeSelfClosing)&&(c=u.charAt(u.length-1),(!s.settings.tightSelfClosing||c==="/"||c&&c!=='"'&&c!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(d),!o&&(!i||!Tj(e,t,n))&&a.push("</"+e.tagName+">"),a.join("")}function a4e(e,t){const n=[];let s=-1,r;if(t){for(r in t)if(t[r]!==null&&t[r]!==void 0){const i=l4e(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 l4e(e,t,n){const s=FN(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 c=hg(s.attribute,Object.assign({},e.settings.characterReferences,{subset:ok.name[r][i]}));return n===!0||(n=Array.isArray(n)?(s.commaSeparated?YG:sK)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(a=hg(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:ok.unquoted[r][i]}))),a!==n&&(e.settings.quoteSmart&&U_(n,o)>U_(n,e.alternative)&&(o=e.alternative),a=o+hg(n,Object.assign({},e.settings.characterReferences,{subset:(o==="'"?ok.single:ok.double)[r][i],attribute:!0}))+o),c+(a&&"="+a))}const c4e=["<","&"];function LX(e,t,n,s){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:hg(e.value,Object.assign({},s.settings.characterReferences,{subset:c4e}))}function u4e(e,t,n,s){return s.settings.allowDangerousHtml?e.value:LX(e,t,n,s)}function d4e(e,t,n,s){return s.all(e)}const h4e=ave("type",{invalid:f4e,unknown:m4e,handlers:{comment:BSe,doctype:$Se,element:o4e,raw:u4e,root:d4e,text:LX}});function f4e(e){throw new Error("Expected node, not `"+e+"`")}function m4e(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const p4e={},g4e={},b4e=[];function y4e(e,t){const n=p4e,s=n.quote||'"',r=s==='"'?"'":'"';if(s!=='"'&&s!=="'")throw new Error("Invalid quote `"+s+"`, expected `'` or `\"`");return{one:x4e,all:v4e,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||ySe,characterReferences:n.characterReferences||g4e,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?_1:qN,quote:s,alternative:r}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function x4e(e,t,n){return h4e(e,t,n,this)}function v4e(e){const t=[],n=e&&e.children||b4e;let s=-1;for(;++s<n.length;)t[s]=this.one(n[s],s,e);return t.join("")}function w4e(e){return Array.isArray(e)?e:[e]}function n3(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 Ej(e){return!e||["plaintext","txt","text","plain"].includes(e)}function PX(e){return e==="ansi"||Ej(e)}function Aj(e){return e==="none"}function OX(e){return Aj(e)}function BX(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 k4e(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 _4e(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?k4e(r,i):r})):e}async function $X(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function sS(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 Hm(e,t){return e&&((t==null?void 0:t[e==null?void 0:e.toLowerCase()])||e)}function zX(e){const t={};return e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle&&(e.fontStyle&pd.Italic&&(t["font-style"]="italic"),e.fontStyle&pd.Bold&&(t["font-weight"]="bold"),e.fontStyle&pd.Underline&&(t["text-decoration"]="underline")),t}function S4e(e){return typeof e=="string"?e:Object.entries(e).map(([t,n])=>`${t}:${n}`).join(";")}function C4e(e){const t=n3(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 ca extends Error{constructor(t){super(t),this.name="ShikiError"}}const FX=new WeakMap;function s3(e,t){FX.set(e,t)}function wx(e){return FX.get(e)}class N1{constructor(...t){Re(this,"_stacks",{});Re(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 N1(Object.fromEntries(w4e(n).map(s=>[s,mE])),t)}getInternalStack(t=this.theme){return this._stacks[t]}get scopes(){return SB(this._stacks[this.theme])}getScopes(t=this.theme){return SB(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.scopes}}}function SB(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 T4e(e,t){if(!(e instanceof N1))throw new ca("Invalid grammar state");return e.getInternalStack(t)}function E4e(){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 ca(`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 ca(`Invalid decoration position ${JSON.stringify(o)}. Lines length: ${r.lines.length}`);if(o.character<0||o.character>a.length)throw new ca(`Invalid decoration position ${JSON.stringify(o)}. Line ${o.line} length: ${a.length}`);return{...o,offset:r.posToIndex(o.line,o.character)}}};const r=C4e(n.source),i=(n.options.decorations||[]).map(o=>({...o,start:s(o.start),end:s(o.end)}));A4e(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 _4e(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 ca(`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,m,p,g){const b=r[h];let v="",x=-1,y=-1;if(m===0&&(x=0),p===0&&(y=0),p===Number.POSITIVE_INFINITY&&(y=b.children.length),x===-1||y===-1)for(let k=0;k<b.children.length;k++)v+=qX(b.children[k]),x===-1&&v.length===m&&(x=k+1),y===-1&&v.length===p&&(y=k+1);if(x===-1)throw new ca(`Failed to find start index for decoration ${JSON.stringify(g.start)}`);if(y===-1)throw new ca(`Failed to find end index for decoration ${JSON.stringify(g.end)}`);const w=b.children.slice(x,y);if(!g.alwaysWrap&&w.length===b.children.length)a(b,g,"line");else if(!g.alwaysWrap&&w.length===1&&w[0].type==="element")a(w[0],g,"token");else{const k={type:"element",tagName:"span",properties:{},children:w};a(k,g,"wrapper"),b.children.splice(x,w.length,k)}}function o(h,m){r[h]=a(r[h],m,"line")}function a(h,m,p){var v;const g=m.properties||{},b=m.transform||(x=>x);return h.tagName=m.tagName||"span",h.properties={...h.properties,...g,class:h.properties.class},(v=m.properties)!=null&&v.class&&BX(h,m.properties.class),h=b(h,p)||h,h}const c=[],u=s.decorations.sort((h,m)=>m.start.offset-h.start.offset);for(const h of u){const{start:m,end:p}=h;if(m.line===p.line)i(m.line,m.character,p.character,h);else if(m.line<p.line){i(m.line,m.character,Number.POSITIVE_INFINITY,h);for(let g=m.line+1;g<p.line;g++)c.unshift(()=>o(g,h));i(p.line,0,p.character,h)}}c.forEach(h=>h())}}}function A4e(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new ca(`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,c=r.start.offset<n.end.offset&&n.end.offset<r.end.offset;if(i||o||a||c){if(o&&o||a&&c)continue;throw new ca(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(r.start)} intersect.`)}}}}function qX(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(qX).join(""):""}const N4e=[E4e()];function rS(e){return[...e.transformers||[],...N4e]}var Um=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],RT={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",9:"strikethrough"};function j4e(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 CB(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 M4e(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)RT[r]&&t.push({type:"setDecoration",value:RT[r]});else if(r<=29){const i=RT[r-20];i&&t.push({type:"resetDecoration",value:i})}else if(r<=37)t.push({type:"setForegroundColor",value:{type:"named",name:Um[r-30]}});else if(r===38){const[i,o]=CB(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:Um[r-40]}});else if(r===48){const[i,o]=CB(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:Um[r-90+8]}}):r>=100&&r<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:Um[r-100+8]}})}return t}function I4e(){let e=null,t=null,n=new Set;return{parse(s){const r=[];let i=0;do{const o=j4e(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 c=M4e(o.sequence);for(const u of c)u.type==="resetAll"?(e=null,t=null,n.clear()):u.type==="resetForegroundColor"?e=null:u.type==="resetBackgroundColor"?t=null:u.type==="resetDecoration"&&n.delete(u.value);for(const u of c)u.type==="setForegroundColor"?e=u.value:u.type==="setBackgroundColor"?t=u.value:u.type==="setDecoration"&&n.add(u.value)}i=o.position}while(i<s.length);return r}}}var R4e={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 D4e(e=R4e){function t(a){return e[a]}function n(a){return`#${a.map(c=>Math.max(0,Math.min(c,255)).toString(16).padStart(2,"0")).join("")}`}let s;function r(){if(s)return s;s=[];for(let u=0;u<Um.length;u++)s.push(t(Um[u]));let a=[0,95,135,175,215,255];for(let u=0;u<6;u++)for(let d=0;d<6;d++)for(let h=0;h<6;h++)s.push(n([a[u],a[d],a[h]]));let c=8;for(let u=0;u<24;u++,c+=10)s.push(n([c,c,c]));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 L4e(e,t,n){const s=sS(e,n),r=n3(t),i=D4e(Object.fromEntries(Um.map(a=>{var c;return[a,(c=e.colors)==null?void 0:c[`terminal.ansi${a[0].toUpperCase()}${a.substring(1)}`]]}))),o=I4e();return r.map(a=>o.parse(a[0]).map(c=>{let u,d;c.decorations.has("reverse")?(u=c.background?i.value(c.background):e.bg,d=c.foreground?i.value(c.foreground):e.fg):(u=c.foreground?i.value(c.foreground):e.fg,d=c.background?i.value(c.background):void 0),u=Hm(u,s),d=Hm(d,s),c.decorations.has("dim")&&(u=P4e(u));let h=pd.None;return c.decorations.has("bold")&&(h|=pd.Bold),c.decorations.has("italic")&&(h|=pd.Italic),c.decorations.has("underline")&&(h|=pd.Underline),{content:c.value,offset:a[1],color:u,bgColor:d,fontStyle:h}}))}function P4e(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 Nj(e,t,n={}){const{lang:s="text",theme:r=e.getLoadedThemes()[0]}=n;if(Ej(s)||Aj(r))return n3(t).map(c=>[{content:c[0],offset:c[1]}]);const{theme:i,colorMap:o}=e.setTheme(r);if(s==="ansi")return L4e(i,t,n);const a=e.getLanguage(s);if(n.grammarState){if(n.grammarState.lang!==a.name)throw new Sd(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${a.name}"`);if(!n.grammarState.themes.includes(i.name))throw new Sd(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return B4e(t,a,i,o,n)}function O4e(...e){if(e.length===2)return wx(e[1]);const[t,n,s={}]=e,{lang:r="text",theme:i=t.getLoadedThemes()[0]}=s;if(Ej(r)||Aj(i))throw new Sd("Plain language does not have grammar state");if(r==="ansi")throw new Sd("ANSI language does not have grammar state");const{theme:o,colorMap:a}=t.setTheme(i),c=t.getLanguage(r);return new N1(iS(n,c,o,a,s).stateStack,c.name,o.name)}function B4e(e,t,n,s,r){const i=iS(e,t,n,s,r),o=new N1(iS(e,t,n,s,r).stateStack,t.name,n.name);return s3(i.tokens,o),i.tokens}function iS(e,t,n,s,r){const i=sS(n,r),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:a=500}=r,c=n3(e);let u=r.grammarState?T4e(r.grammarState,n.name)??mE:r.grammarContextCode!=null?iS(r.grammarContextCode,t,n,s,{...r,grammarState:void 0,grammarContextCode:void 0}).stateStack:mE,d=[];const h=[];for(let m=0,p=c.length;m<p;m++){const[g,b]=c[m];if(g===""){d=[],h.push([]);continue}if(o>0&&g.length>=o){d=[],h.push([{content:g,offset:b,color:"",fontStyle:0}]);continue}let v,x,y;r.includeExplanation&&(v=t.tokenizeLine(g,u),x=v.tokens,y=0);const w=t.tokenizeLine2(g,u,a),k=w.tokens.length/2;for(let T=0;T<k;T++){const S=w.tokens[2*T],C=T+1<k?w.tokens[2*T+2]:g.length;if(S===C)continue;const _=w.tokens[2*T+1],B=Hm(s[qg.getForeground(_)],i),A=qg.getFontStyle(_),N={content:g.substring(S,C),offset:b+S,color:B,fontStyle:A};if(r.includeExplanation){const j=[];if(r.includeExplanation!=="scopeName")for(const L of n.settings){let O;switch(typeof L.scope){case"string":O=L.scope.split(/,/).map($=>$.trim());break;case"object":O=L.scope;break;default:continue}j.push({settings:L,selectors:O.map($=>$.split(/ /))})}N.explanation=[];let P=0;for(;S+P<C;){const L=x[y],O=g.substring(L.startIndex,L.endIndex);P+=O.length,N.explanation.push({content:O,scopes:r.includeExplanation==="scopeName"?$4e(L.scopes):z4e(j,L.scopes)}),y+=1}}d.push(N)}h.push(d),d=[],u=w.ruleStack}return{tokens:h,stateStack:u}}function $4e(e){return e.map(t=>({scopeName:t}))}function z4e(e,t){const n=[];for(let s=0,r=t.length;s<r;s++){const i=t[s];n[s]={scopeName:i,themeMatches:q4e(e,i,t.slice(0,s))}}return n}function TB(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function F4e(e,t,n){if(!TB(e[e.length-1],t))return!1;let s=e.length-2,r=n.length-1;for(;s>=0&&r>=0;)TB(e[s],n[r])&&(s-=1),r-=1;return s===-1}function q4e(e,t,n){const s=[];for(const{selectors:r,settings:i}of e)for(const o of r)if(F4e(o,t,n)){s.push(i);break}return s}function HX(e,t,n){const s=Object.entries(n.themes).filter(c=>c[1]).map(c=>({color:c[0],theme:c[1]})),r=s.map(c=>{const u=Nj(e,t,{...n,theme:c.theme}),d=wx(u),h=typeof c.theme=="string"?c.theme:c.theme.name;return{tokens:u,state:d,theme:h}}),i=H4e(...r.map(c=>c.tokens)),o=i[0].map((c,u)=>c.map((d,h)=>{const m={content:d.content,variants:{},offset:d.offset};return"includeExplanation"in n&&n.includeExplanation&&(m.explanation=d.explanation),i.forEach((p,g)=>{const{content:b,explanation:v,offset:x,...y}=p[u][h];m.variants[s[g].color]=y}),m})),a=r[0].state?new N1(Object.fromEntries(r.map(c=>{var u;return[c.theme,(u=c.state)==null?void 0:u.getInternalStack(c.theme)]})),r[0].state.lang):void 0;return a&&s3(o,a),o}function H4e(...e){const t=e.map(()=>[]),n=e.length;for(let s=0;s<e[0].length;s++){const r=e.map(c=>c[s]),i=t.map(()=>[]);t.forEach((c,u)=>c.push(i[u]));const o=r.map(()=>0),a=r.map(c=>c[0]);for(;a.every(c=>c);){const c=Math.min(...a.map(u=>u.content.length));for(let u=0;u<n;u++){const d=a[u];d.content.length===c?(i[u].push(d),o[u]+=1,a[u]=r[u][o[u]]):(i[u].push({...d,content:d.content.slice(0,c)}),a[u]={...d,content:d.content.slice(c),offset:d.offset+c})}}}return t}function oS(e,t,n){let s,r,i,o,a,c;if("themes"in n){const{defaultColor:u="light",cssVariablePrefix:d="--shiki-"}=n,h=Object.entries(n.themes).filter(v=>v[1]).map(v=>({color:v[0],theme:v[1]})).sort((v,x)=>v.color===u?-1:x.color===u?1:0);if(h.length===0)throw new Sd("`themes` option must not be empty");const m=HX(e,t,n);if(c=wx(m),u&&!h.find(v=>v.color===u))throw new Sd(`\`themes\` option must contain the defaultColor key \`${u}\``);const p=h.map(v=>e.getTheme(v.theme)),g=h.map(v=>v.color);i=m.map(v=>v.map(x=>U4e(x,g,d,u))),c&&s3(i,c);const b=h.map(v=>sS(v.theme,n));r=h.map((v,x)=>(x===0&&u?"":`${d+v.color}:`)+(Hm(p[x].fg,b[x])||"inherit")).join(";"),s=h.map((v,x)=>(x===0&&u?"":`${d+v.color}-bg:`)+(Hm(p[x].bg,b[x])||"inherit")).join(";"),o=`shiki-themes ${p.map(v=>v.name).join(" ")}`,a=u?void 0:[r,s].join(";")}else if("theme"in n){const u=sS(n.theme,n);i=Nj(e,t,n);const d=e.getTheme(n.theme);s=Hm(d.bg,u),r=Hm(d.fg,u),o=d.name,c=wx(i)}else throw new Sd("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:r,bg:s,themeName:o,rootStyle:a,grammarState:c}}function U4e(e,t,n,s){const r={content:e.content,explanation:e.explanation,offset:e.offset},i=t.map(c=>zX(e.variants[c])),o=new Set(i.flatMap(c=>Object.keys(c))),a={};return i.forEach((c,u)=>{for(const d of o){const h=c[d]||"inherit";if(u===0&&s)a[d]=h;else{const m=d==="color"?"":d==="background-color"?"-bg":`-${d}`,p=n+t[u]+(d==="color"?"":m);a[p]=h}}}),r.htmlStyle=a,r}function aS(e,t,n,s={meta:{},options:n,codeToHast:(r,i)=>aS(e,r,i),codeToTokens:(r,i)=>oS(e,r,i)}){var p,g;let r=t;for(const b of rS(n))r=((p=b.preprocess)==null?void 0:p.call(s,r,n))||r;let{tokens:i,fg:o,bg:a,themeName:c,rootStyle:u,grammarState:d}=oS(e,r,n);const{mergeWhitespaces:h=!0}=n;h===!0?i=W4e(i):h==="never"&&(i=G4e(i));const m={...s,get source(){return r}};for(const b of rS(n))i=((g=b.tokens)==null?void 0:g.call(m,i))||i;return V4e(i,{...n,fg:o,bg:a,themeName:c,rootStyle:u},m,d)}function V4e(e,t,n,s=wx(e)){var g,b,v;const r=rS(t),i=[],o={type:"root",children:[]},{structure:a="classic",tabindex:c="0"}=t;let u={type:"element",tagName:"pre",properties:{class:`shiki ${t.themeName||""}`,style:t.rootStyle||`background-color:${t.bg};color:${t.fg}`,...c!==!1&&c!=null?{tabindex:c.toString()}:{},...Object.fromEntries(Array.from(Object.entries(t.meta||{})).filter(([x])=>!x.startsWith("_")))},children:[]},d={type:"element",tagName:"code",properties:{},children:i};const h=[],m={...n,structure:a,addClassToHast:BX,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return u},get code(){return d},get lines(){return h}};if(e.forEach((x,y)=>{var T,S;y&&(a==="inline"?o.children.push({type:"element",tagName:"br",properties:{},children:[]}):a==="classic"&&i.push({type:"text",value:`
`}));let w={type:"element",tagName:"span",properties:{class:"line"},children:[]},k=0;for(const C of x){let _={type:"element",tagName:"span",properties:{...C.htmlAttrs},children:[{type:"text",value:C.content}]};C.htmlStyle;const B=S4e(C.htmlStyle||zX(C));B&&(_.properties.style=B);for(const A of r)_=((T=A==null?void 0:A.span)==null?void 0:T.call(m,_,y+1,k,w,C))||_;a==="inline"?o.children.push(_):a==="classic"&&w.children.push(_),k+=C.content.length}if(a==="classic"){for(const C of r)w=((S=C==null?void 0:C.line)==null?void 0:S.call(m,w,y+1))||w;h.push(w),i.push(w)}}),a==="classic"){for(const x of r)d=((g=x==null?void 0:x.code)==null?void 0:g.call(m,d))||d;u.children.push(d);for(const x of r)u=((b=x==null?void 0:x.pre)==null?void 0:b.call(m,u))||u;o.children.push(u)}let p=o;for(const x of r)p=((v=x==null?void 0:x.root)==null?void 0:v.call(m,p))||p;return s&&s3(p,s),p}function W4e(e){return e.map(t=>{const n=[];let s="",r=0;return t.forEach((i,o)=>{const c=!(i.fontStyle&&i.fontStyle&pd.Underline);c&&i.content.match(/^\s+$/)&&t[o+1]?(r||(r=i.offset),s+=i.content):s?(c?n.push({...i,offset:r,content:s+i.content}):n.push({content:s,offset:r},i),r=0,s=""):n.push(i)}),n})}function G4e(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 K4e(e,t,n){var i;const s={meta:{},options:n,codeToHast:(o,a)=>aS(e,o,a),codeToTokens:(o,a)=>oS(e,o,a)};let r=y4e(aS(e,t,n,s));for(const o of rS(n))r=((i=o.postprocess)==null?void 0:i.call(s,r,n))||r;return r}const EB={light:"#333333",dark:"#bbbbbb"},AB={light:"#fffffe",dark:"#1e1e1e"},NB="__shiki_resolved";function jj(e){var a,c,u,d,h;if(e!=null&&e[NB])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 m=t.settings?t.settings.find(p=>!p.name&&!p.scope):void 0;(a=m==null?void 0:m.settings)!=null&&a.foreground&&(s=m.settings.foreground),(c=m==null?void 0:m.settings)!=null&&c.background&&(n=m.settings.background),!s&&((u=t==null?void 0:t.colors)!=null&&u["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"?EB.light:EB.dark),n||(n=t.type==="light"?AB.light:AB.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(m){var g;if(i.has(m))return i.get(m);r+=1;const p=`#${r.toString(16).padStart(8,"0").toLowerCase()}`;return(g=t.colorReplacements)!=null&&g[`#${p}`]?o(m):(i.set(m,p),p)}t.settings=t.settings.map(m=>{var v,x;const p=((v=m.settings)==null?void 0:v.foreground)&&!m.settings.foreground.startsWith("#"),g=((x=m.settings)==null?void 0:x.background)&&!m.settings.background.startsWith("#");if(!p&&!g)return m;const b={...m,settings:{...m.settings}};if(p){const y=o(m.settings.foreground);t.colorReplacements[y]=m.settings.foreground,b.settings.foreground=y}if(g){const y=o(m.settings.background);t.colorReplacements[y]=m.settings.background,b.settings.background=y}return b});for(const m of Object.keys(t.colors||{}))if((m==="editor.foreground"||m==="editor.background"||m.startsWith("terminal.ansi"))&&!((h=t.colors[m])!=null&&h.startsWith("#"))){const p=o(t.colors[m]);t.colorReplacements[p]=t.colors[m],t.colors[m]=p}return Object.defineProperty(t,NB,{enumerable:!1,writable:!1,value:!0}),t}async function UX(e){return Array.from(new Set((await Promise.all(e.filter(t=>!PX(t)).map(async t=>await $X(t).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function VX(e){return(await Promise.all(e.map(async n=>OX(n)?null:jj(await $X(n))))).filter(n=>!!n)}class Y4e extends bSe{constructor(n,s,r,i={}){super(n);Re(this,"_resolvedThemes",new Map);Re(this,"_resolvedGrammars",new Map);Re(this,"_langMap",new Map);Re(this,"_langGraph",new Map);Re(this,"_textmateThemeCache",new WeakMap);Re(this,"_loadedThemesCache",null);Re(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=jj(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=J_.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 ca(`Circular alias \`${Array.from(s).join(" -> ")} -> ${n}\``);s.add(n)}}return this._resolvedGrammars.get(n)}loadLanguage(n){var o,a,c,u;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),(u=(c=this._syncRegistry)==null?void 0:c._grammars)==null||u.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 c;return a&&((c=a.embeddedLangs)==null?void 0:c.some(u=>r.map(([d])=>d).includes(u)))}).filter(o=>!r.includes(o));throw new ca(`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 X4e{constructor(t,n){Re(this,"_langs",new Map);Re(this,"_scopeToLang",new Map);Re(this,"_injections",new Map);Re(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 Nb=0;function Q4e(e){Nb+=1,e.warnings!==!1&&Nb>=10&&Nb%10===0&&console.warn(`[Shiki] ${Nb} 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 ca("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),s=(e.themes||[]).flat(1).map(jj),r=new X4e(e.engine,n),i=new Y4e(r,s,n,e.langAlias);let o;function a(y){v();const w=i.getGrammar(typeof y=="string"?y:y.name);if(!w)throw new ca(`Language \`${y}\` not found, you may need to load it first`);return w}function c(y){if(y==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};v();const w=i.getTheme(y);if(!w)throw new ca(`Theme \`${y}\` not found, you may need to load it first`);return w}function u(y){v();const w=c(y);o!==y&&(i.setTheme(w),o=y);const k=i.getColorMap();return{theme:w,colorMap:k}}function d(){return v(),i.getLoadedThemes()}function h(){return v(),i.getLoadedLanguages()}function m(...y){v(),i.loadLanguages(y.flat(1))}async function p(...y){return m(await UX(y))}function g(...y){v();for(const w of y.flat(1))i.loadTheme(w)}async function b(...y){return v(),g(await VX(y))}function v(){if(t)throw new ca("Shiki instance has been disposed")}function x(){t||(t=!0,i.dispose(),Nb-=1)}return{setTheme:u,getTheme:c,getLanguage:a,getLoadedThemes:d,getLoadedLanguages:h,loadLanguage:p,loadLanguageSync:m,loadTheme:b,loadThemeSync:g,dispose:x,[Symbol.dispose]:x}}async function J4e(e={}){e.loadWasm;const[t,n,s]=await Promise.all([VX(e.themes||[]),UX(e.langs||[]),e.engine||pX(e.loadWasm||M_e())]);return Q4e({...e,themes:t,langs:n,engine:s})}async function Z4e(e={}){const t=await J4e(e);return{getLastGrammarState:(...n)=>O4e(t,...n),codeToTokensBase:(n,s)=>Nj(t,n,s),codeToTokensWithThemes:(n,s)=>HX(t,n,s),codeToTokens:(n,s)=>oS(t,n,s),codeToHast:(n,s)=>aS(t,n,s),codeToHtml:(n,s)=>K4e(t,n,s),...t,getInternalContext:()=>t}}function e3e(e,t,n){let s,r,i;{const a=e;s=a.langs,r=a.themes,i=a.engine}async function o(a){function c(p){if(typeof p=="string"){if(PX(p))return[];const g=s[p];if(!g)throw new Sd(`Language \`${p}\` is not included in this bundle. You may want to load it from external source.`);return g}return p}function u(p){if(OX(p))return"none";if(typeof p=="string"){const g=r[p];if(!g)throw new Sd(`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=>u(p)),h=(a.langs??[]).map(p=>c(p)),m=await Z4e({engine:a.engine??i(),...a,themes:d,langs:h});return{...m,loadLanguage(...p){return m.loadLanguage(...p.map(c))},loadTheme(...p){return m.loadTheme(...p.map(u))}}}return o}const t3e=e3e({langs:d_e,themes:f_e,engine:()=>pX(ie(()=>import("./wasm-CG6Dc4jp.js"),[]))});/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const n3e=["github-light-default","github-dark-default"];let ak=null,gE=null;const bE=new Set,DT=new Map,jB=new Set,s3e=128,ey=new Map;function WX(e,t,n){return`${t}\0${n}\0${e}`}function r3e(e,t){if(ey.size>=s3e){const n=ey.keys().next().value;n!==void 0&&ey.delete(n)}ey.set(e,t)}function i3e(e,t,n){return ey.get(WX(e,t,n))??null}function o3e(){return ak||(ak=t3e({langs:[],themes:n3e}).then(e=>(gE=e,e)).catch(e=>{throw ak=null,e})),ak}async function GX(e){const t=await o3e();if(bE.has(e))return t;if(jB.has(e))throw new Error(`shiki: language "${e}" previously failed to load`);let n=DT.get(e);return n||(n=t.loadLanguage(e).then(()=>{bE.add(e)}).catch(s=>{throw jB.add(e),s}).finally(()=>{DT.delete(e)}),DT.set(e,n)),await n,t}const a3e=1e5,l3e=2e4;function yE(e){if(e.length>a3e)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>l3e)return!0;t=s+1}return!1}function MB(e,t,n,s=!0){if(gE&&bE.has(t))try{const r=gE.codeToHtml(e,{lang:t,theme:n});return s&&r3e(WX(e,t,n),r),r}catch(r){return console.warn("[web-shell] sync highlight failed for lang=%s",t,r),null}return null}const c3e=()=>{},u3e=()=>c3e,KX=f.createContext(u3e);function d3e(){return f.useContext(KX)}function YX(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=YX(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function XX(){for(var e,t,n=0,s="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=YX(e))&&(s&&(s+=" "),s+=t);return s}const IB=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,RB=XX,Bp=(e,t)=>n=>{var s;if((t==null?void 0:t.variants)==null)return RB(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:r,defaultVariants:i}=t,o=Object.keys(r).map(u=>{const d=n==null?void 0:n[u],h=i==null?void 0:i[u];if(d===null)return null;const m=IB(d)||IB(h);return r[u][m]}),a=n&&Object.entries(n).reduce((u,d)=>{let[h,m]=d;return m===void 0||(u[h]=m),u},{}),c=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((u,d)=>{let{class:h,className:m,...p}=d;return Object.entries(p).every(g=>{let[b,v]=g;return Array.isArray(v)?v.includes({...i,...a}[b]):{...i,...a}[b]===v})?[...u,h,m]:u},[]);return RB(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)};function DB(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function h3e(...e){return t=>{let n=!1;const s=e.map(r=>{const i=DB(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():DB(e[r],null)}}}}function us(...e){return f.useCallback(h3e(...e),e)}function Sf(e){const t=f.forwardRef((n,s)=>{let{children:r,...i}=n,o=null,a=!1;const c=[];LB(r)&&typeof lk=="function"&&(r=lk(r._payload)),f.Children.forEach(r,m=>{var p;if(b3e(m)){a=!0;const g=m;let b="child"in g.props?g.props.child:g.props.children;LB(b)&&typeof lk=="function"&&(b=lk(b._payload)),o=m3e(g,b),c.push((p=o==null?void 0:o.props)==null?void 0:p.children)}else c.push(m)}),o?o=f.cloneElement(o,void 0,c):!a&&f.Children.count(r)===1&&f.isValidElement(r)&&(o=r);const u=o?g3e(o):void 0,d=us(s,u);if(!o){if(r||r===0)throw new Error(a?w3e(e):v3e(e));return r}const h=p3e(i,o.props??{});return o.type!==f.Fragment&&(h.ref=s?d:u),f.cloneElement(o,h)});return t.displayName=`${e}.Slot`,t}var Mj=Sf("Slot"),QX=Symbol.for("radix.slottable");function f3e(e){const t=n=>"child"in n?n.children(n.child):n.children;return t.displayName=`${e}.Slottable`,t.__radixId=QX,t}var m3e=(e,t)=>{if("child"in e.props){const n=e.props.child;return f.isValidElement(n)?f.cloneElement(n,void 0,e.props.children(n.props.children)):null}return f.isValidElement(t)?t:null};function p3e(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 c=i(...a);return r(...a),c}:r&&(n[s]=r):s==="style"?n[s]={...r,...i}:s==="className"&&(n[s]=[r,i].filter(Boolean).join(" "))}return{...e,...n}}function g3e(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 b3e(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===QX}var y3e=Symbol.for("react.lazy");function LB(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===y3e&&"_payload"in e&&x3e(e._payload)}function x3e(e){return typeof e=="object"&&e!==null&&"then"in e}var v3e=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,w3e=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,lk=u4[" use ".trim().toString()],k3e=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ln=k3e.reduce((e,t)=>{const n=Sf(`Primitive.${t}`),s=f.forwardRef((r,i)=>{const{asChild:o,...a}=r,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function JX(e,t){e&&ju.flushSync(()=>e.dispatchEvent(t))}var ZX=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"}),_3e="VisuallyHidden",eQ=f.forwardRef((e,t)=>l.jsx(Ln.span,{...e,ref:t,style:{...ZX,...e.style}}));eQ.displayName=_3e;var S3e=eQ;function Go(e,t=[]){let n=[];function s(i,o){const a=f.createContext(o);a.displayName=i+"Context";const c=n.length;n=[...n,o];const u=h=>{var x;const{scope:m,children:p,...g}=h,b=((x=m==null?void 0:m[e])==null?void 0:x[c])||a,v=f.useMemo(()=>g,Object.values(g));return l.jsx(b.Provider,{value:v,children:p})};u.displayName=i+"Provider";function d(h,m,p={}){var x;const{optional:g=!1}=p,b=((x=m==null?void 0:m[e])==null?void 0:x[c])||a,v=f.useContext(b);if(v)return v;if(o!==void 0)return o;if(!g)throw new Error(`\`${h}\` must be used within \`${i}\``)}return[u,d]}const r=()=>{const i=n.map(o=>f.createContext(o));return function(a){const c=(a==null?void 0:a[e])||i;return f.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return r.scopeName=e,[s,C3e(r,...t)]}function C3e(...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:c,scopeName:u})=>{const h=c(i)[`__scope${u}`];return{...a,...h}},{});return f.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}function Ij(e){const t=e+"CollectionProvider",[n,s]=Go(t),[r,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=b=>{const{scope:v,children:x}=b,y=f.useRef(null),w=f.useRef(new Map).current;return l.jsx(r,{scope:v,itemMap:w,collectionRef:y,children:x})};o.displayName=t;const a=e+"CollectionSlot",c=Sf(a),u=f.forwardRef((b,v)=>{const{scope:x,children:y}=b,w=i(a,x),k=us(v,w.collectionRef);return l.jsx(c,{ref:k,children:y})});u.displayName=a;const d=e+"CollectionItemSlot",h="data-radix-collection-item",m=Sf(d),p=f.forwardRef((b,v)=>{const{scope:x,children:y,...w}=b,k=f.useRef(null),T=us(v,k),S=i(d,x);return f.useEffect(()=>(S.itemMap.set(k,{ref:k,...w}),()=>void S.itemMap.delete(k))),l.jsx(m,{[h]:"",ref:T,children:y})});p.displayName=d;function g(b){const v=i(e+"CollectionConsumer",b);return f.useCallback(()=>{const y=v.collectionRef.current;if(!y)return[];const w=Array.from(y.querySelectorAll(`[${h}]`));return Array.from(v.itemMap.values()).sort((S,C)=>w.indexOf(S.ref.current)-w.indexOf(C.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:o,Slot:u,ItemSlot:p},g,s]}function qt(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 ho=globalThis!=null&&globalThis.document?f.useLayoutEffect:()=>{},T3e=u4[" useInsertionEffect ".trim().toString()]||ho;function ga({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[r,i,o]=E3e({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:r;{const d=f.useRef(e!==void 0);f.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 u=f.useCallback(d=>{var h;if(a){const m=A3e(d)?d(e):d;m!==e&&((h=o.current)==null||h.call(o,m))}else i(d)},[a,e,i,o]);return[c,u]}function E3e({defaultProp:e,onChange:t}){const[n,s]=f.useState(e),r=f.useRef(n),i=f.useRef(t);return T3e(()=>{i.current=t},[t]),f.useEffect(()=>{var o;r.current!==n&&((o=i.current)==null||o.call(i,n),r.current=n)},[n,r]),[n,s,i]}function A3e(e){return typeof e=="function"}function N3e(e,t){return f.useReducer((n,s)=>t[n][s]??n,e)}var Ko=e=>{const{present:t,children:n}=e,s=j3e(t),r=typeof n=="function"?n({present:s.isPresent}):f.Children.only(n),i=M3e(s.ref,I3e(r));return typeof n=="function"||s.isPresent?f.cloneElement(r,{ref:i}):null};Ko.displayName="Presence";function j3e(e){const[t,n]=f.useState(),s=f.useRef(null),r=f.useRef(e),i=f.useRef("none"),o=f.useRef(void 0),a=e?"mounted":"unmounted",[c,u]=N3e(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return f.useEffect(()=>{c==="mounted"?(i.current=o.current??jb(s.current),o.current=void 0):i.current="none"},[c]),ho(()=>{const d=s.current,h=r.current;if(h!==e){const p=i.current,g=jb(d);e?(o.current=g,u("MOUNT")):g==="none"||(d==null?void 0:d.display)==="none"?u("UNMOUNT"):u(h&&p!==g?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,u]),ho(()=>{if(t){let d;const h=t.ownerDocument.defaultView??window,m=g=>{const v=jb(s.current).includes(CSS.escape(g.animationName));if(g.target===t&&v&&(u("ANIMATION_END"),!r.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",d=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},p=g=>{g.target===t&&(i.current=jb(s.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{h.clearTimeout(d),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:f.useCallback(d=>{if(d){const h=getComputedStyle(d);s.current=h,o.current=jb(h)}else s.current=null;n(d)},[])}}function PB(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function M3e(...e){const t=f.useRef(e);return t.current=e,f.useCallback(n=>{const s=t.current;let r=!1;const i=s.map(o=>{const a=PB(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():PB(s[o],null)}}},[])}function jb(e){return(e==null?void 0:e.animationName)||"none"}function I3e(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 R3e=u4[" useId ".trim().toString()]||(()=>{}),D3e=0;function qa(e){const[t,n]=f.useState(R3e());return ho(()=>{n(s=>s??String(D3e++))},[e]),e||(t?`radix-${t}`:"")}var L3e=f.createContext(void 0);function j1(e){const t=f.useContext(L3e);return e||t||"ltr"}function Sl(e){const t=f.useRef(e);return f.useEffect(()=>{t.current=e}),f.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}var P3e="DismissableLayer",xE="dismissableLayer.update",O3e="dismissableLayer.pointerDownOutside",B3e="dismissableLayer.focusOutside",OB,Rj=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),M1=f.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:s=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:a,onDismiss:c,...u}=e,d=f.useContext(Rj),[h,m]=f.useState(null),p=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=f.useState({}),b=us(t,m),v=Array.from(d.layers),[x]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),y=x?v.indexOf(x):-1,w=h?v.indexOf(h):-1,k=d.layersWithOutsidePointerEventsDisabled.size>0,T=w>=y,S=f.useRef(!1),C=H3e(N=>{i==null||i(N),a==null||a(N),N.defaultPrevented||c==null||c()},{ownerDocument:p,deferPointerDownOutside:s,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:d.dismissableSurfaces,shouldHandlePointerDownOutside:f.useCallback(N=>{if(!(N instanceof Node))return!1;const j=[...d.branches].some(P=>P.contains(N));return T&&!j},[d.branches,T])}),_=U3e(N=>{if(s&&S.current)return;const j=N.target;[...d.branches].some(L=>L.contains(j))||(o==null||o(N),a==null||a(N),N.defaultPrevented||c==null||c())},p),B=h?w===v.length-1:!1,A=Sl(N=>{N.key==="Escape"&&(r==null||r(N),!N.defaultPrevented&&c&&(N.preventDefault(),c()))});return f.useEffect(()=>{if(B)return p.addEventListener("keydown",A,{capture:!0}),()=>p.removeEventListener("keydown",A,{capture:!0})},[p,B,A]),f.useEffect(()=>{if(h)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(OB=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(h)),d.layers.add(h),BB(),()=>{n&&(d.layersWithOutsidePointerEventsDisabled.delete(h),d.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=OB))}},[h,p,n,d]),f.useEffect(()=>()=>{h&&(d.layers.delete(h),d.layersWithOutsidePointerEventsDisabled.delete(h),BB())},[h,d]),f.useEffect(()=>{const N=()=>g({});return document.addEventListener(xE,N),()=>document.removeEventListener(xE,N)},[]),l.jsx(Ln.div,{...u,ref:b,style:{pointerEvents:k?T?"auto":"none":void 0,...e.style},onFocusCapture:qt(e.onFocusCapture,_.onFocusCapture),onBlurCapture:qt(e.onBlurCapture,_.onBlurCapture),onPointerDownCapture:qt(e.onPointerDownCapture,C.onPointerDownCapture)})});M1.displayName=P3e;var $3e="DismissableLayerBranch",z3e=f.forwardRef((e,t)=>{const n=f.useContext(Rj),s=f.useRef(null),r=us(t,s);return f.useEffect(()=>{const i=s.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),l.jsx(Ln.div,{...e,ref:r})});z3e.displayName=$3e;function F3e(){const e=f.useContext(Rj),[t,n]=f.useState(null);return f.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}var q3e=()=>!0;function H3e(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:s=!1,isDeferredPointerDownOutsideRef:r,dismissableSurfaces:i,shouldHandlePointerDownOutside:o=q3e}=t,a=Sl(e),c=f.useRef(!1),u=f.useRef(!1),d=f.useRef(new Map),h=f.useRef(()=>{});return f.useEffect(()=>{function m(){u.current=!1,r.current=!1,d.current.clear()}function p(){return Array.from(d.current.values()).some(Boolean)}function g(w){if(!u.current)return;const k=w.target;k instanceof Node&&[...i].some(S=>S.contains(k))||d.current.set(w.type,!0),w.type==="click"&&window.setTimeout(()=>{u.current&&h.current()},0)}function b(w){u.current&&d.current.set(w.type,!1)}const v=w=>{if(w.target&&!c.current){let k=function(){n.removeEventListener("click",h.current);const S=p();m(),S||tQ(O3e,a,T,{discrete:!0})};if(!o(w.target)){n.removeEventListener("click",h.current),m(),c.current=!1;return}const T={originalEvent:w};u.current=!0,r.current=s&&w.button===0,d.current.clear(),!s||w.button!==0?k():(n.removeEventListener("click",h.current),h.current=k,n.addEventListener("click",h.current,{once:!0}))}else n.removeEventListener("click",h.current),m();c.current=!1},x=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const w of x)n.addEventListener(w,g,!0),n.addEventListener(w,b);const y=window.setTimeout(()=>{n.addEventListener("pointerdown",v)},0);return()=>{window.clearTimeout(y),n.removeEventListener("pointerdown",v),n.removeEventListener("click",h.current);for(const w of x)n.removeEventListener(w,g,!0),n.removeEventListener(w,b)}},[n,a,s,r,i,o]),{onPointerDownCapture:()=>c.current=!0}}function U3e(e,t=globalThis==null?void 0:globalThis.document){const n=Sl(e),s=f.useRef(!1);return f.useEffect(()=>{const r=i=>{i.target&&!s.current&&tQ(B3e,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 BB(){const e=new CustomEvent(xE);document.dispatchEvent(e)}function tQ(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?JX(r,i):r.dispatchEvent(i)}var LT="focusScope.autoFocusOnMount",PT="focusScope.autoFocusOnUnmount",$B={bubbles:!1,cancelable:!0},V3e="FocusScope",_v=f.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:r,onUnmountAutoFocus:i,...o}=e,[a,c]=f.useState(null),u=Sl(r),d=Sl(i),h=f.useRef(null),m=us(t,c),p=f.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;f.useEffect(()=>{if(s){let b=function(w){if(p.paused||!a)return;const k=w.target;a.contains(k)?h.current=k:_h(h.current,{select:!0})},v=function(w){if(p.paused||!a)return;const k=w.relatedTarget;k!==null&&(a.contains(k)||_h(h.current,{select:!0}))},x=function(w){if(document.activeElement===document.body)for(const T of w)T.removedNodes.length>0&&_h(a)};document.addEventListener("focusin",b),document.addEventListener("focusout",v);const y=new MutationObserver(x);return a&&y.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",v),y.disconnect()}}},[s,a,p.paused]),f.useEffect(()=>{if(a){FB.add(p);const b=document.activeElement;if(!a.contains(b)){const x=new CustomEvent(LT,$B);a.addEventListener(LT,u),a.dispatchEvent(x),x.defaultPrevented||(W3e(Q3e(nQ(a)),{select:!0}),document.activeElement===b&&_h(a))}return()=>{a.removeEventListener(LT,u),setTimeout(()=>{const x=new CustomEvent(PT,$B);a.addEventListener(PT,d),a.dispatchEvent(x),x.defaultPrevented||_h(b??document.body,{select:!0}),a.removeEventListener(PT,d),FB.remove(p)},0)}}},[a,u,d,p]);const g=f.useCallback(b=>{if(!n&&!s||p.paused)return;const v=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,x=document.activeElement;if(v&&x){const y=b.currentTarget,[w,k]=G3e(y);w&&k?!b.shiftKey&&x===k?(b.preventDefault(),n&&_h(w,{select:!0})):b.shiftKey&&x===w&&(b.preventDefault(),n&&_h(k,{select:!0})):x===y&&b.preventDefault()}},[n,s,p.paused]);return l.jsx(Ln.div,{tabIndex:-1,...o,ref:m,onKeyDown:g})});_v.displayName=V3e;function W3e(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(_h(s,{select:t}),document.activeElement!==n)return}function G3e(e){const t=nQ(e),n=zB(t,e),s=zB(t.reverse(),e);return[n,s]}function nQ(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 zB(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const s of e)if(!(n?!s.checkVisibility({checkVisibilityCSS:!0}):K3e(s,{upTo:t})))return s}function K3e(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 Y3e(e){return e instanceof HTMLInputElement&&"select"in e}function _h(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Y3e(e)&&t&&e.select()}}var FB=X3e();function X3e(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=qB(e,t),e.unshift(t)},remove(t){var n;e=qB(e,t),(n=e[0])==null||n.resume()}}}function qB(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function Q3e(e){return e.filter(t=>t.tagName!=="A")}var J3e="Portal",I1=f.forwardRef((e,t)=>{var a;const{container:n,...s}=e,[r,i]=f.useState(!1);ho(()=>i(!0),[]);const o=n||r&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?ju.createPortal(l.jsx(Ln.div,{...s,ref:t}),o):null});I1.displayName=J3e;var ck=0,Kc=null;function r3(){f.useEffect(()=>{Kc||(Kc={start:HB(),end:HB()});const{start:e,end:t}=Kc;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),ck++,()=>{ck===1&&(Kc==null||Kc.start.remove(),Kc==null||Kc.end.remove(),Kc=null),ck=Math.max(0,ck-1)}},[])}function HB(){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 cu=function(){return cu=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},cu.apply(this,arguments)};function sQ(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 Z3e(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 R2="right-scroll-bar-position",D2="width-before-scroll-bar",eCe="with-scroll-bars-hidden",tCe="--removed-body-scroll-bar-size";function OT(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function nCe(e,t){var n=f.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 sCe=typeof window<"u"?f.useLayoutEffect:f.useEffect,UB=new WeakMap;function rCe(e,t){var n=nCe(null,function(s){return e.forEach(function(r){return OT(r,s)})});return sCe(function(){var s=UB.get(n);if(s){var r=new Set(s),i=new Set(e),o=n.current;r.forEach(function(a){i.has(a)||OT(a,null)}),i.forEach(function(a){r.has(a)||OT(a,o)})}UB.set(n,e)},[e]),n}function iCe(e){return e}function oCe(e,t){t===void 0&&(t=iCe);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 c=function(){var d=o;o=[],d.forEach(i)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(d){o.push(d),u()},filter:function(d){return o=o.filter(d),n}}}};return r}function aCe(e){e===void 0&&(e={});var t=oCe(null);return t.options=cu({async:!0,ssr:!1},e),t}var rQ=function(e){var t=e.sideCar,n=sQ(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 f.createElement(s,cu({},n))};rQ.isSideCarExport=!0;function lCe(e,t){return e.useMedium(t),rQ}var iQ=aCe(),BT=function(){},i3=f.forwardRef(function(e,t){var n=f.useRef(null),s=f.useState({onScrollCapture:BT,onWheelCapture:BT,onTouchMoveCapture:BT}),r=s[0],i=s[1],o=e.forwardProps,a=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,h=e.shards,m=e.sideCar,p=e.noRelative,g=e.noIsolation,b=e.inert,v=e.allowPinchZoom,x=e.as,y=x===void 0?"div":x,w=e.gapMode,k=sQ(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),T=m,S=rCe([n,t]),C=cu(cu({},k),r);return f.createElement(f.Fragment,null,d&&f.createElement(T,{sideCar:iQ,removeScrollBar:u,shards:h,noRelative:p,noIsolation:g,inert:b,setCallbacks:i,allowPinchZoom:!!v,lockRef:n,gapMode:w}),o?f.cloneElement(f.Children.only(a),cu(cu({},C),{ref:S})):f.createElement(y,cu({},C,{className:c,ref:S}),a))});i3.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};i3.classNames={fullWidth:D2,zeroRight:R2};var cCe=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function uCe(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=cCe();return t&&e.setAttribute("nonce",t),e}function dCe(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function hCe(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var fCe=function(){var e=0,t=null;return{add:function(n){e==0&&(t=uCe())&&(dCe(t,n),hCe(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},mCe=function(){var e=fCe();return function(t,n){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},oQ=function(){var e=mCe(),t=function(n){var s=n.styles,r=n.dynamic;return e(s,r),null};return t},pCe={left:0,top:0,right:0,gap:0},$T=function(e){return parseInt(e||"",10)||0},gCe=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[$T(n),$T(s),$T(r)]},bCe=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return pCe;var t=gCe(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])}},yCe=oQ(),fg="data-scroll-locked",xCe=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(eCe,` {
   overflow: hidden `).concat(s,`;
   padding-right: `).concat(a,"px ").concat(s,`;
  }
  body[`).concat(fg,`] {
    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(R2,` {
    right: `).concat(a,"px ").concat(s,`;
  }
  
  .`).concat(D2,` {
    margin-right: `).concat(a,"px ").concat(s,`;
  }
  
  .`).concat(R2," .").concat(R2,` {
    right: 0 `).concat(s,`;
  }
  
  .`).concat(D2," .").concat(D2,` {
    margin-right: 0 `).concat(s,`;
  }
  
  body[`).concat(fg,`] {
    `).concat(tCe,": ").concat(a,`px;
  }
`)},VB=function(){var e=parseInt(document.body.getAttribute(fg)||"0",10);return isFinite(e)?e:0},vCe=function(){f.useEffect(function(){return document.body.setAttribute(fg,(VB()+1).toString()),function(){var e=VB()-1;e<=0?document.body.removeAttribute(fg):document.body.setAttribute(fg,e.toString())}},[])},wCe=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,r=s===void 0?"margin":s;vCe();var i=f.useMemo(function(){return bCe(r)},[r]);return f.createElement(yCe,{styles:xCe(i,!t,r,n?"":"!important")})},vE=!1;if(typeof window<"u")try{var uk=Object.defineProperty({},"passive",{get:function(){return vE=!0,!0}});window.addEventListener("test",uk,uk),window.removeEventListener("test",uk,uk)}catch{vE=!1}var f0=vE?{passive:!1}:!1,kCe=function(e){return e.tagName==="TEXTAREA"},aQ=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!kCe(e)&&n[t]==="visible")},_Ce=function(e){return aQ(e,"overflowY")},SCe=function(e){return aQ(e,"overflowX")},WB=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var r=lQ(e,s);if(r){var i=cQ(e,s),o=i[1],a=i[2];if(o>a)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},CCe=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},TCe=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},lQ=function(e,t){return e==="v"?_Ce(t):SCe(t)},cQ=function(e,t){return e==="v"?CCe(t):TCe(t)},ECe=function(e,t){return e==="h"&&t==="rtl"?-1:1},ACe=function(e,t,n,s,r){var i=ECe(e,window.getComputedStyle(t).direction),o=i*s,a=n.target,c=t.contains(a),u=!1,d=o>0,h=0,m=0;do{if(!a)break;var p=cQ(e,a),g=p[0],b=p[1],v=p[2],x=b-v-i*g;(g||x)&&lQ(e,a)&&(h+=x,m+=g);var y=a.parentNode;a=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(d&&Math.abs(h)<1||!d&&Math.abs(m)<1)&&(u=!0),u},dk=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},GB=function(e){return[e.deltaX,e.deltaY]},KB=function(e){return e&&"current"in e?e.current:e},NCe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},jCe=function(e){return`
  .block-interactivity-`.concat(e,` {pointer-events: none;}
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
`)},MCe=0,m0=[];function ICe(e){var t=f.useRef([]),n=f.useRef([0,0]),s=f.useRef(),r=f.useState(MCe++)[0],i=f.useState(oQ)[0],o=f.useRef(e);f.useEffect(function(){o.current=e},[e]),f.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var b=Z3e([e.lockRef.current],(e.shards||[]).map(KB),!0).filter(Boolean);return b.forEach(function(v){return v.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),b.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var a=f.useCallback(function(b,v){if("touches"in b&&b.touches.length===2||b.type==="wheel"&&b.ctrlKey)return!o.current.allowPinchZoom;var x=dk(b),y=n.current,w="deltaX"in b?b.deltaX:y[0]-x[0],k="deltaY"in b?b.deltaY:y[1]-x[1],T,S=b.target,C=Math.abs(w)>Math.abs(k)?"h":"v";if("touches"in b&&C==="h"&&S.type==="range")return!1;var _=window.getSelection(),B=_&&_.anchorNode,A=B?B===S||B.contains(S):!1;if(A)return!1;var N=WB(C,S);if(!N)return!0;if(N?T=C:(T=C==="v"?"h":"v",N=WB(C,S)),!N)return!1;if(!s.current&&"changedTouches"in b&&(w||k)&&(s.current=T),!T)return!0;var j=s.current||T;return ACe(j,v,b,j==="h"?w:k)},[]),c=f.useCallback(function(b){var v=b;if(!(!m0.length||m0[m0.length-1]!==i)){var x="deltaY"in v?GB(v):dk(v),y=t.current.filter(function(T){return T.name===v.type&&(T.target===v.target||v.target===T.shadowParent)&&NCe(T.delta,x)})[0];if(y&&y.should){v.cancelable&&v.preventDefault();return}if(!y){var w=(o.current.shards||[]).map(KB).filter(Boolean).filter(function(T){return T.contains(v.target)}),k=w.length>0?a(v,w[0]):!o.current.noIsolation;k&&v.cancelable&&v.preventDefault()}}},[]),u=f.useCallback(function(b,v,x,y){var w={name:b,delta:v,target:x,should:y,shadowParent:RCe(x)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(k){return k!==w})},1)},[]),d=f.useCallback(function(b){n.current=dk(b),s.current=void 0},[]),h=f.useCallback(function(b){u(b.type,GB(b),b.target,a(b,e.lockRef.current))},[]),m=f.useCallback(function(b){u(b.type,dk(b),b.target,a(b,e.lockRef.current))},[]);f.useEffect(function(){return m0.push(i),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:m}),document.addEventListener("wheel",c,f0),document.addEventListener("touchmove",c,f0),document.addEventListener("touchstart",d,f0),function(){m0=m0.filter(function(b){return b!==i}),document.removeEventListener("wheel",c,f0),document.removeEventListener("touchmove",c,f0),document.removeEventListener("touchstart",d,f0)}},[]);var p=e.removeScrollBar,g=e.inert;return f.createElement(f.Fragment,null,g?f.createElement(i,{styles:jCe(r)}):null,p?f.createElement(wCe,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function RCe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const DCe=lCe(iQ,ICe);var Sv=f.forwardRef(function(e,t){return f.createElement(i3,cu({},e,{ref:t,sideCar:DCe}))});Sv.classNames=i3.classNames;var LCe=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},p0=new WeakMap,hk=new WeakMap,fk={},zT=0,uQ=function(e){return e&&(e.host||uQ(e.parentNode))},PCe=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=uQ(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})},OCe=function(e,t,n,s){var r=PCe(t,Array.isArray(e)?e:[e]);fk[n]||(fk[n]=new WeakMap);var i=fk[n],o=[],a=new Set,c=new Set(r),u=function(h){!h||a.has(h)||(a.add(h),u(h.parentNode))};r.forEach(u);var d=function(h){!h||c.has(h)||Array.prototype.forEach.call(h.children,function(m){if(a.has(m))d(m);else try{var p=m.getAttribute(s),g=p!==null&&p!=="false",b=(p0.get(m)||0)+1,v=(i.get(m)||0)+1;p0.set(m,b),i.set(m,v),o.push(m),b===1&&g&&hk.set(m,!0),v===1&&m.setAttribute(n,"true"),g||m.setAttribute(s,"true")}catch(x){console.error("aria-hidden: cannot operate on ",m,x)}})};return d(t),a.clear(),zT++,function(){o.forEach(function(h){var m=p0.get(h)-1,p=i.get(h)-1;p0.set(h,m),i.set(h,p),m||(hk.has(h)||h.removeAttribute(s),hk.delete(h)),p||h.removeAttribute(n)}),zT--,zT||(p0=new WeakMap,p0=new WeakMap,hk=new WeakMap,fk={})}},o3=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),r=LCe(e);return r?(s.push.apply(s,Array.from(r.querySelectorAll("[aria-live], script"))),OCe(s,r,n,"aria-hidden")):function(){return null}},a3="Dialog",[dQ,hQ]=Go(a3),[BCe,jc]=dQ(a3),Dj=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:r,onOpenChange:i,modal:o=!0}=e,a=f.useRef(null),c=f.useRef(null),[u,d]=ga({prop:s,defaultProp:r??!1,onChange:i,caller:a3});return l.jsx(BCe,{scope:t,triggerRef:a,contentRef:c,contentId:qa(),titleId:qa(),descriptionId:qa(),open:u,onOpenChange:d,onOpenToggle:f.useCallback(()=>d(h=>!h),[d]),modal:o,children:n})};Dj.displayName=a3;var fQ="DialogTrigger",mQ=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=jc(fQ,n),i=us(t,r.triggerRef);return l.jsx(Ln.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.open?r.contentId:void 0,"data-state":Fj(r.open),...s,ref:i,onClick:qt(e.onClick,r.onOpenToggle)})});mQ.displayName=fQ;var Lj="DialogPortal",[$Ce,pQ]=dQ(Lj,{forceMount:void 0}),Pj=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:r}=e,i=jc(Lj,t);return l.jsx($Ce,{scope:t,forceMount:n,children:f.Children.map(s,o=>l.jsx(Ko,{present:n||i.open,children:l.jsx(I1,{asChild:!0,container:r,children:o})}))})};Pj.displayName=Lj;var lS="DialogOverlay",Oj=f.forwardRef((e,t)=>{const n=pQ(lS,e.__scopeDialog),{forceMount:s=n.forceMount,...r}=e,i=jc(lS,e.__scopeDialog);return i.modal?l.jsx(Ko,{present:s||i.open,children:l.jsx(FCe,{...r,ref:t})}):null});Oj.displayName=lS;var zCe=Sf("DialogOverlay.RemoveScroll"),FCe=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=jc(lS,n),i=F3e(),o=us(t,i);return l.jsx(Sv,{as:zCe,allowPinchZoom:!0,shards:[r.contentRef],children:l.jsx(Ln.div,{"data-state":Fj(r.open),...s,ref:o,style:{pointerEvents:"auto",...s.style}})})}),Hg="DialogContent",Bj=f.forwardRef((e,t)=>{const n=pQ(Hg,e.__scopeDialog),{forceMount:s=n.forceMount,...r}=e,i=jc(Hg,e.__scopeDialog);return l.jsx(Ko,{present:s||i.open,children:i.modal?l.jsx(qCe,{...r,ref:t}):l.jsx(HCe,{...r,ref:t})})});Bj.displayName=Hg;var qCe=f.forwardRef((e,t)=>{const n=jc(Hg,e.__scopeDialog),s=f.useRef(null),r=us(t,n.contentRef,s);return f.useEffect(()=>{const i=s.current;if(i)return o3(i)},[]),l.jsx(gQ,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:qt(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:qt(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&i.preventDefault()}),onFocusOutside:qt(e.onFocusOutside,i=>i.preventDefault())})}),HCe=f.forwardRef((e,t)=>{const n=jc(Hg,e.__scopeDialog),s=f.useRef(!1),r=f.useRef(!1);return l.jsx(gQ,{...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 c,u;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(s.current=!0,i.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const o=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&r.current&&i.preventDefault()}})}),gQ=f.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:r,onCloseAutoFocus:i,...o}=e,a=jc(Hg,n);return r3(),l.jsx(l.Fragment,{children:l.jsx(_v,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:r,onUnmountAutoFocus:i,children:l.jsx(M1,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":Fj(a.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>a.onOpenChange(!1)})})})}),bQ="DialogTitle",$j=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=jc(bQ,n);return l.jsx(Ln.h2,{id:r.titleId,...s,ref:t})});$j.displayName=bQ;var yQ="DialogDescription",zj=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=jc(yQ,n);return l.jsx(Ln.p,{id:r.descriptionId,...s,ref:t})});zj.displayName=yQ;var xQ="DialogClose",R1=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=jc(xQ,n);return l.jsx(Ln.button,{type:"button",...s,ref:t,onClick:qt(e.onClick,()=>r.onOpenChange(!1))})});R1.displayName=xQ;function Fj(e){return e?"open":"closed"}var vQ="AlertDialog",[UCe,Dwt]=Go(vQ,[hQ]),eh=hQ(),wQ=e=>{const{__scopeAlertDialog:t,...n}=e,s=eh(t);return l.jsx(Dj,{...s,...n,modal:!0})};wQ.displayName=vQ;var VCe="AlertDialogTrigger",WCe=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,r=eh(n);return l.jsx(mQ,{...r,...s,ref:t})});WCe.displayName=VCe;var GCe="AlertDialogPortal",kQ=e=>{const{__scopeAlertDialog:t,...n}=e,s=eh(t);return l.jsx(Pj,{...s,...n})};kQ.displayName=GCe;var KCe="AlertDialogOverlay",_Q=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,r=eh(n);return l.jsx(Oj,{...r,...s,ref:t})});_Q.displayName=KCe;var SQ="AlertDialogContent",[YCe,XCe]=UCe(SQ),CQ=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:s,...r}=e,i=eh(n),o=f.useRef(null),a=us(t,o),c=f.useRef(null);return l.jsx(YCe,{scope:n,cancelRef:c,children:l.jsx(Bj,{role:"alertdialog",...i,...r,ref:a,onOpenAutoFocus:qt(r.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=c.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:s})})});CQ.displayName=SQ;var QCe="AlertDialogTitle",TQ=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,r=eh(n);return l.jsx($j,{...r,...s,ref:t})});TQ.displayName=QCe;var JCe="AlertDialogDescription",EQ=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,r=eh(n);return l.jsx(zj,{...r,...s,ref:t})});EQ.displayName=JCe;var ZCe="AlertDialogAction",AQ=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,r=eh(n);return l.jsx(R1,{...r,...s,ref:t})});AQ.displayName=ZCe;var NQ="AlertDialogCancel",jQ=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,{cancelRef:r}=XCe(NQ,n),i=eh(n),o=us(t,r);return l.jsx(R1,{...i,...s,ref:o})});jQ.displayName=NQ;var e5e=wQ,t5e=kQ,n5e=_Q,s5e=CQ,r5e=AQ,i5e=jQ,o5e=TQ,a5e=EQ;function l3(e){const t=f.useRef({value:e,previous:e});return f.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function c3(e){const[t,n]=f.useState(void 0);return ho(()=>{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 c=i.borderBoxSize,u=Array.isArray(c)?c[0]:c;o=u.inlineSize,a=u.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}var u3="Checkbox",[l5e,Lwt]=Go(u3),[c5e,qj]=l5e(u3);function u5e(e){const{__scopeCheckbox:t,checked:n,children:s,defaultChecked:r,disabled:i,form:o,name:a,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:h}=e,[m,p]=ga({prop:n,defaultProp:r??!1,onChange:c,caller:u3}),[g,b]=f.useState(null),[v,x]=f.useState(null),y=f.useRef(!1),w=g?!!o||!!g.closest("form"):!0,k={checked:m,disabled:i,setChecked:p,control:g,setControl:b,name:a,form:o,value:d,hasConsumerStoppedPropagationRef:y,required:u,defaultChecked:uf(r)?!1:r,isFormControl:w,bubbleInput:v,setBubbleInput:x};return l.jsx(c5e,{scope:t,...k,children:d5e(h)?h(k):s})}var MQ="CheckboxTrigger",IQ=f.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...s},r)=>{const{control:i,value:o,disabled:a,checked:c,required:u,setControl:d,setChecked:h,hasConsumerStoppedPropagationRef:m,isFormControl:p,bubbleInput:g}=qj(MQ,e),b=us(r,d),v=f.useRef(c);return f.useEffect(()=>{const x=i==null?void 0:i.form;if(x){const y=()=>h(v.current);return x.addEventListener("reset",y),()=>x.removeEventListener("reset",y)}},[i,h]),l.jsx(Ln.button,{type:"button",role:"checkbox","aria-checked":uf(c)?"mixed":c,"aria-required":u,"data-state":BQ(c),"data-disabled":a?"":void 0,disabled:a,value:o,...s,ref:b,onKeyDown:qt(t,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:qt(n,x=>{h(y=>uf(y)?!0:!y),g&&p&&(m.current=x.isPropagationStopped(),m.current||x.stopPropagation())})})});IQ.displayName=MQ;var RQ=f.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:s,checked:r,defaultChecked:i,required:o,disabled:a,value:c,onCheckedChange:u,form:d,...h}=e;return l.jsx(u5e,{__scopeCheckbox:n,checked:r,defaultChecked:i,disabled:a,required:o,onCheckedChange:u,name:s,form:d,value:c,internal_do_not_use_render:({isFormControl:m})=>l.jsxs(l.Fragment,{children:[l.jsx(IQ,{...h,ref:t,__scopeCheckbox:n}),m&&l.jsx(OQ,{__scopeCheckbox:n})]})})});RQ.displayName=u3;var DQ="CheckboxIndicator",LQ=f.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:s,...r}=e,i=qj(DQ,n);return l.jsx(Ko,{present:s||uf(i.checked)||i.checked===!0,children:l.jsx(Ln.span,{"data-state":BQ(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:t,style:{pointerEvents:"none",...e.style}})})});LQ.displayName=DQ;var PQ="CheckboxBubbleInput",OQ=f.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:s,hasConsumerStoppedPropagationRef:r,checked:i,defaultChecked:o,required:a,disabled:c,name:u,value:d,form:h,bubbleInput:m,setBubbleInput:p}=qj(PQ,e),g=us(n,p),b=l3(i),v=c3(s);f.useEffect(()=>{const y=m;if(!y)return;const w=window.HTMLInputElement.prototype,T=Object.getOwnPropertyDescriptor(w,"checked").set,S=!r.current;if(b!==i&&T){const C=new Event("click",{bubbles:S});y.indeterminate=uf(i),T.call(y,uf(i)?!1:i),y.dispatchEvent(C)}},[m,b,i,r]);const x=f.useRef(uf(i)?!1:i);return l.jsx(Ln.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??x.current,required:a,disabled:c,name:u,value:d,form:h,...t,tabIndex:-1,ref:g,style:{...t.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});OQ.displayName=PQ;function d5e(e){return typeof e=="function"}function uf(e){return e==="indeterminate"}function BQ(e){return uf(e)?"indeterminate":e?"checked":"unchecked"}const h5e=["top","right","bottom","left"],Cf=Math.min,Cd=Math.max,cS=Math.round,mk=Math.floor,Td=e=>({x:e,y:e}),f5e={left:"right",right:"left",bottom:"top",top:"bottom"};function $Q(e,t,n){return Cd(e,Cf(t,n))}function Hd(e,t){return typeof e=="function"?e(t):e}function Tf(e){return e.split("-")[0]}function D1(e){return e.split("-")[1]}function Hj(e){return e==="x"?"y":"x"}function Uj(e){return e==="y"?"height":"width"}function yu(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Vj(e){return Hj(yu(e))}function m5e(e,t,n){n===void 0&&(n=!1);const s=D1(e),r=Vj(e),i=Uj(r);let o=r==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=uS(o)),[o,uS(o)]}function p5e(e){const t=uS(e);return[wE(e),t,wE(t)]}function wE(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const YB=["left","right"],XB=["right","left"],g5e=["top","bottom"],b5e=["bottom","top"];function y5e(e,t,n){switch(e){case"top":case"bottom":return n?t?XB:YB:t?YB:XB;case"left":case"right":return t?g5e:b5e;default:return[]}}function x5e(e,t,n,s){const r=D1(e);let i=y5e(Tf(e),n==="start",s);return r&&(i=i.map(o=>o+"-"+r),t&&(i=i.concat(i.map(wE)))),i}function uS(e){const t=Tf(e);return f5e[t]+e.slice(t.length)}function v5e(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 zQ(e){return typeof e!="number"?v5e(e):{top:e,right:e,bottom:e,left:e}}function dS(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 QB(e,t,n){let{reference:s,floating:r}=e;const i=yu(t),o=Vj(t),a=Uj(o),c=Tf(t),u=i==="y",d=s.x+s.width/2-r.width/2,h=s.y+s.height/2-r.height/2,m=s[a]/2-r[a]/2;let p;switch(c){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=D1(t);return g&&(p[o]+=m*(g==="end"?1:-1)*(n&&u?-1:1)),p}async function w5e(e,t){var n;t===void 0&&(t={});const{x:s,y:r,platform:i,rects:o,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:m=!1,padding:p=0}=Hd(t,e),g=zQ(p),v=a[m?h==="floating"?"reference":"floating":h],x=dS(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:u,rootBoundary:d,strategy:c})),y=h==="floating"?{x:s,y:r,width:o.floating.width,height:o.floating.height}:o.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),k=await(i.isElement==null?void 0:i.isElement(w))&&await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1},T=dS(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:w,strategy:c}):y);return{top:(x.top-T.top+g.top)/k.y,bottom:(T.bottom-x.bottom+g.bottom)/k.y,left:(x.left-T.left+g.left)/k.x,right:(T.right-x.right+g.right)/k.x}}const k5e=50,_5e=async(e,t,n)=>{const{placement:s="bottom",strategy:r="absolute",middleware:i=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:w5e},c=await(o.isRTL==null?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:r}),{x:d,y:h}=QB(u,s,c),m=s,p=0;const g={};for(let b=0;b<i.length;b++){const v=i[b];if(!v)continue;const{name:x,fn:y}=v,{x:w,y:k,data:T,reset:S}=await y({x:d,y:h,initialPlacement:s,placement:m,strategy:r,middlewareData:g,rects:u,platform:a,elements:{reference:e,floating:t}});d=w??d,h=k??h,g[x]={...g[x],...T},S&&p<k5e&&(p++,typeof S=="object"&&(S.placement&&(m=S.placement),S.rects&&(u=S.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:r}):S.rects),{x:d,y:h}=QB(u,m,c)),b=-1)}return{x:d,y:h,placement:m,strategy:r,middlewareData:g}},S5e=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:r,rects:i,platform:o,elements:a,middlewareData:c}=t,{element:u,padding:d=0}=Hd(e,t)||{};if(u==null)return{};const h=zQ(d),m={x:n,y:s},p=Vj(r),g=Uj(p),b=await o.getDimensions(u),v=p==="y",x=v?"top":"left",y=v?"bottom":"right",w=v?"clientHeight":"clientWidth",k=i.reference[g]+i.reference[p]-m[p]-i.floating[g],T=m[p]-i.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let C=S?S[w]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=a.floating[w]||i.floating[g]);const _=k/2-T/2,B=C/2-b[g]/2-1,A=Cf(h[x],B),N=Cf(h[y],B),j=C-b[g]-N,P=C/2-b[g]/2+_,L=$Q(A,P,j),O=!c.arrow&&D1(r)!=null&&P!==L&&i.reference[g]/2-(P<A?A:N)-b[g]/2<0,$=O?P<A?P-A:P-j:0;return{[p]:m[p]+$,data:{[p]:L,centerOffset:P-L-$,...O&&{alignmentOffset:$}},reset:O}}}),C5e=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:c,elements:u}=t,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...v}=Hd(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const x=Tf(r),y=yu(a),w=Tf(a)===a,k=await(c.isRTL==null?void 0:c.isRTL(u.floating)),T=m||(w||!b?[uS(a)]:p5e(a)),S=g!=="none";!m&&S&&T.push(...x5e(a,b,g,k));const C=[a,...T],_=await c.detectOverflow(t,v),B=[];let A=((s=i.flip)==null?void 0:s.overflows)||[];if(d&&B.push(_[x]),h){const L=m5e(r,o,k);B.push(_[L[0]],_[L[1]])}if(A=[...A,{placement:r,overflows:B}],!B.every(L=>L<=0)){var N,j;const L=(((N=i.flip)==null?void 0:N.index)||0)+1,O=C[L];if(O&&(!(h==="alignment"?y!==yu(O):!1)||A.every(F=>yu(F.placement)===y?F.overflows[0]>0:!0)))return{data:{index:L,overflows:A},reset:{placement:O}};let $=(j=A.filter(z=>z.overflows[0]<=0).sort((z,F)=>z.overflows[1]-F.overflows[1])[0])==null?void 0:j.placement;if(!$)switch(p){case"bestFit":{var P;const z=(P=A.filter(F=>{if(S){const G=yu(F.placement);return G===y||G==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(G=>G>0).reduce((G,I)=>G+I,0)]).sort((F,G)=>F[1]-G[1])[0])==null?void 0:P[0];z&&($=z);break}case"initialPlacement":$=a;break}if(r!==$)return{reset:{placement:$}}}return{}}}};function JB(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ZB(e){return h5e.some(t=>e[t]>=0)}const T5e=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:r="referenceHidden",...i}=Hd(e,t);switch(r){case"referenceHidden":{const o=await s.detectOverflow(t,{...i,elementContext:"reference"}),a=JB(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:ZB(a)}}}case"escaped":{const o=await s.detectOverflow(t,{...i,altBoundary:!0}),a=JB(o,n.floating);return{data:{escapedOffsets:a,escaped:ZB(a)}}}default:return{}}}}},FQ=new Set(["left","top"]);async function E5e(e,t){const{placement:n,platform:s,elements:r}=e,i=await(s.isRTL==null?void 0:s.isRTL(r.floating)),o=Tf(n),a=D1(n),c=yu(n)==="y",u=FQ.has(o)?-1:1,d=i&&c?-1:1,h=Hd(t,e);let{mainAxis:m,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),c?{x:p*d,y:m*u}:{x:m*u,y:p*d}}const A5e=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,c=await E5e(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:r+c.x,y:i+c.y,data:{...c,placement:o}}}}},N5e=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:c={fn:y=>{let{x:w,y:k}=y;return{x:w,y:k}}},...u}=Hd(e,t),d={x:n,y:s},h=await i.detectOverflow(t,u),m=yu(r),p=Hj(m);let g=d[p],b=d[m];const v=(y,w)=>$Q(w+h[y==="y"?"top":"left"],w,w-h[y==="y"?"bottom":"right"]);o&&(g=v(p,g)),a&&(b=v(m,b));const x=c.fn({...t,[p]:g,[m]:b});return{...x,data:{x:x.x-n,y:x.y-s,enabled:{[p]:o,[m]:a}}}}}},j5e=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,s;const{x:r,y:i,placement:o,rects:a,middlewareData:c}=t,{offset:u=0,mainAxis:d=!0,crossAxis:h=!0}=Hd(e,t),m={x:r,y:i},p=yu(o),g=Hj(p);let b=m[g],v=m[p];const x=Hd(u,t),y=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:(n=x.mainAxis)!=null?n:0,crossAxis:(s=x.crossAxis)!=null?s:0};if(d){const T=g==="y"?"height":"width",S=a.reference[g]-a.floating[T]+y.mainAxis,C=a.reference[g]+a.reference[T]-y.mainAxis;b<S?b=S:b>C&&(b=C)}if(h){var w,k;const T=g==="y"?"width":"height",S=FQ.has(Tf(o)),C=a.reference[p]-a.floating[T]+(S&&((w=c.offset)==null?void 0:w[p])||0)+(S?0:y.crossAxis),_=a.reference[p]+a.reference[T]+(S?0:((k=c.offset)==null?void 0:k[p])||0)-(S?y.crossAxis:0);v<C?v=C:v>_&&(v=_)}return{[g]:b,[p]:v}}}},M5e=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}=Hd(e,t),c=await r.detectOverflow(t,a),u=Tf(n),d=D1(n),h=yu(n)==="y",{width:m,height:p}=s.floating;let g,b;u==="top"||u==="bottom"?(g=u,b=d===(await(r.isRTL==null?void 0:r.isRTL(i.floating))?"start":"end")?"left":"right"):(b=u,g=d==="end"?"top":"bottom");const v=p-c.top-c.bottom,x=m-c.left-c.right,y=Cf(p-c[g],v),w=Cf(m-c[b],x),k=t.middlewareData.shift,T=!k;let S=y,C=w;k!=null&&k.enabled.x&&(C=x),k!=null&&k.enabled.y&&(S=v),T&&!d&&(h?C=m-2*Cd(c.left,c.right):S=p-2*Cd(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});const _=await r.getDimensions(i.floating);return m!==_.width||p!==_.height?{reset:{rects:!0}}:{}}}};function d3(){return typeof window<"u"}function L1(e){return qQ(e)?(e.nodeName||"").toLowerCase():"#document"}function Ha(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function th(e){var t;return(t=(qQ(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function qQ(e){return d3()?e instanceof Node||e instanceof Ha(e).Node:!1}function Tu(e){return d3()?e instanceof Element||e instanceof Ha(e).Element:!1}function Gf(e){return d3()?e instanceof HTMLElement||e instanceof Ha(e).HTMLElement:!1}function e$(e){return!d3()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ha(e).ShadowRoot}function h3(e){const{overflow:t,overflowX:n,overflowY:s,display:r}=Eu(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&r!=="inline"&&r!=="contents"}function I5e(e){return/^(table|td|th)$/.test(L1(e))}function f3(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const R5e=/transform|translate|scale|rotate|perspective|filter/,D5e=/paint|layout|strict|content/,vm=e=>!!e&&e!=="none";let FT;function Wj(e){const t=Tu(e)?Eu(e):e;return vm(t.transform)||vm(t.translate)||vm(t.scale)||vm(t.rotate)||vm(t.perspective)||!Gj()&&(vm(t.backdropFilter)||vm(t.filter))||R5e.test(t.willChange||"")||D5e.test(t.contain||"")}function L5e(e){let t=fp(e);for(;Gf(t)&&!kx(t);){if(Wj(t))return t;if(f3(t))return null;t=fp(t)}return null}function Gj(){return FT==null&&(FT=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),FT}function kx(e){return/^(html|body|#document)$/.test(L1(e))}function Eu(e){return Ha(e).getComputedStyle(e)}function m3(e){return Tu(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function fp(e){if(L1(e)==="html")return e;const t=e.assignedSlot||e.parentNode||e$(e)&&e.host||th(e);return e$(t)?t.host:t}function HQ(e){const t=fp(e);return kx(t)?(e.ownerDocument||e).body:Gf(t)&&h3(t)?t:HQ(t)}function _x(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=HQ(e),i=r===((s=e.ownerDocument)==null?void 0:s.body),o=Ha(r);if(i){const a=kE(o);return t.concat(o,o.visualViewport||[],h3(r)?r:[],a&&n?_x(a):[])}else return t.concat(r,_x(r,[],n))}function kE(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function UQ(e){const t=Eu(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const r=Gf(e),i=r?e.offsetWidth:n,o=r?e.offsetHeight:s,a=cS(n)!==i||cS(s)!==o;return a&&(n=i,s=o),{width:n,height:s,$:a}}function Kj(e){return Tu(e)?e:e.contextElement}function mg(e){const t=Kj(e);if(!Gf(t))return Td(1);const n=t.getBoundingClientRect(),{width:s,height:r,$:i}=UQ(t);let o=(i?cS(n.width):n.width)/s,a=(i?cS(n.height):n.height)/r;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const P5e=Td(0);function VQ(e){const t=Ha(e);return!Gj()||!t.visualViewport?P5e:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function O5e(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Ha(e)}function mp(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),i=Kj(e);let o=Td(1);t&&(s?Tu(s)&&(o=mg(s)):o=mg(e));const a=O5e(i,n,s)?VQ(i):Td(0);let c=(r.left+a.x)/o.x,u=(r.top+a.y)/o.y,d=r.width/o.x,h=r.height/o.y;if(i&&s){const m=Ha(i),p=Tu(s)?Ha(s):s;let g=m,b=kE(g);for(;b&&p!==g;){const v=mg(b),x=b.getBoundingClientRect(),y=Eu(b),w=x.left+(b.clientLeft+parseFloat(y.paddingLeft))*v.x,k=x.top+(b.clientTop+parseFloat(y.paddingTop))*v.y;c*=v.x,u*=v.y,d*=v.x,h*=v.y,c+=w,u+=k,g=Ha(b),b=kE(g)}}return dS({width:d,height:h,x:c,y:u})}function p3(e,t){const n=m3(e).scrollLeft;return t?t.left+n:mp(th(e)).left+n}function WQ(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-p3(e,n),r=n.top+t.scrollTop;return{x:s,y:r}}function B5e(e){let{elements:t,rect:n,offsetParent:s,strategy:r}=e;const i=r==="fixed",o=th(s),a=t?f3(t.floating):!1;if(s===o||a&&i)return n;let c={scrollLeft:0,scrollTop:0},u=Td(1);const d=Td(0),h=Gf(s);if((h||!i)&&((L1(s)!=="body"||h3(o))&&(c=m3(s)),h)){const p=mp(s);u=mg(s),d.x=p.x+s.clientLeft,d.y=p.y+s.clientTop}const m=o&&!h&&!i?WQ(o,c):Td(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x+m.x,y:n.y*u.y-c.scrollTop*u.y+d.y+m.y}}function $5e(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function z5e(e){const t=m3(e),n=e.ownerDocument.body,s=Cd(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=Cd(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-t.scrollLeft+p3(e);const o=-t.scrollTop;return Eu(n).direction==="rtl"&&(i+=Cd(e.clientWidth,n.clientWidth)-s),{width:s,height:r,x:i,y:o}}const F5e=25;function q5e(e,t,n){n===void 0&&(n="viewport");const s=n==="layoutViewport",r=Ha(e),i=th(e),o=r.visualViewport;let a=i.clientWidth,c=i.clientHeight,u=0,d=0;if(o){const m=!Gj()||t==="fixed";s?m||(u=-o.offsetLeft,d=-o.offsetTop):(a=o.width,c=o.height,m&&(u=o.offsetLeft,d=o.offsetTop))}if(p3(i)<=0){const m=i.ownerDocument,p=m.body,g=getComputedStyle(p),b=m.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,v=Math.abs(i.clientWidth-p.clientWidth-b),x=getComputedStyle(i).scrollbarGutter==="stable both-edges"?v/2:v;x<=F5e&&(a-=x)}return{width:a,height:c,x:u,y:d}}function H5e(e,t){const n=mp(e,!0,t==="fixed"),s=n.top+e.clientTop,r=n.left+e.clientLeft,i=mg(e),o=e.clientWidth*i.x,a=e.clientHeight*i.y,c=r*i.x,u=s*i.y;return{width:o,height:a,x:c,y:u}}function t$(e,t,n){let s;if(t==="viewport"||t==="layoutViewport")s=q5e(e,n,t);else if(t==="document")s=z5e(th(e));else if(Tu(t))s=H5e(t,n);else{const r=VQ(e);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return dS(s)}function U5e(e,t){const n=t.get(e);if(n)return n;let s=_x(e,[],!1).filter(a=>Tu(a)&&L1(a)!=="body"),r=null;const i=Eu(e).position==="fixed";let o=i?fp(e):e;for(;Tu(o)&&!kx(o);){const a=Eu(o),c=Wj(o),u=r?r.position:i?"fixed":"";!c&&(u==="fixed"||u==="absolute"&&a.position==="static")?s=s.filter(h=>h!==o):r=a,o=fp(o)}return t.set(e,s),s}function V5e(e){let{element:t,boundary:n,rootBoundary:s,strategy:r}=e;const o=[...n==="clippingAncestors"?f3(t)?[]:U5e(t,this._c):[].concat(n),s],a=t$(t,o[0],r);let c=a.top,u=a.right,d=a.bottom,h=a.left;for(let m=1;m<o.length;m++){const p=t$(t,o[m],r);c=Cd(p.top,c),u=Cf(p.right,u),d=Cf(p.bottom,d),h=Cd(p.left,h)}return{width:u-h,height:d-c,x:h,y:c}}function W5e(e){const{width:t,height:n}=UQ(e);return{width:t,height:n}}function G5e(e,t,n){const s=Gf(t),r=th(t),i=n==="fixed",o=mp(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=Td(0);if((s||!i)&&((L1(t)!=="body"||h3(r))&&(a=m3(t)),s)){const m=mp(t,!0,i,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}!s&&r&&(c.x=p3(r));const u=r&&!s&&!i?WQ(r,a):Td(0),d=o.left+a.scrollLeft-c.x-u.x,h=o.top+a.scrollTop-c.y-u.y;return{x:d,y:h,width:o.width,height:o.height}}function qT(e){return Eu(e).position==="static"}function n$(e,t){if(!Gf(e)||Eu(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return th(e)===n&&(n=n.ownerDocument.body),n}function GQ(e,t){const n=Ha(e);if(f3(e))return n;if(!Gf(e)){let r=fp(e);for(;r&&!kx(r);){if(Tu(r)&&!qT(r))return r;r=fp(r)}return n}let s=n$(e,t);for(;s&&I5e(s)&&qT(s);)s=n$(s,t);return s&&kx(s)&&qT(s)&&!Wj(s)?n:s||L5e(e)||n}const K5e=async function(e){const t=this.getOffsetParent||GQ,n=this.getDimensions,s=await n(e.floating);return{reference:G5e(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function Y5e(e){return Eu(e).direction==="rtl"}const X5e={convertOffsetParentRelativeRectToViewportRelativeRect:B5e,getDocumentElement:th,getClippingRect:V5e,getOffsetParent:GQ,getElementRects:K5e,getClientRects:$5e,getDimensions:W5e,getScale:mg,isElement:Tu,isRTL:Y5e};function KQ(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Q5e(e,t,n){let s=null,r;const i=th(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 m=e.getBoundingClientRect(),{left:p,top:g,width:b,height:v}=m;if(d||t(),!b||!v)return;const x=mk(g),y=mk(i.clientWidth-(p+b)),w=mk(i.clientHeight-(g+v)),k=mk(p),S={rootMargin:-x+"px "+-y+"px "+-w+"px "+-k+"px",threshold:Cd(0,Cf(1,h))||1};let C=!0;function _(B){const A=B[0].intersectionRatio;if(!KQ(m,e.getBoundingClientRect()))return a();if(A!==h){if(!C)return a();A?a(!1,A):r=setTimeout(()=>{a(!1,1e-7)},1e3)}C=!1}try{s=new IntersectionObserver(_,{...S,root:i.ownerDocument})}catch{s=new IntersectionObserver(_,S)}s.observe(e)}const c=Ha(e),u=()=>a(n);return c.addEventListener("resize",u),a(!0),()=>{c.removeEventListener("resize",u),o()}}function J5e(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:c=!1}=s,u=Kj(e),d=r||i?[...u?_x(u):[],...t?_x(t):[]]:[];d.forEach(x=>{r&&x.addEventListener("scroll",n),i&&x.addEventListener("resize",n)});const h=u&&a?Q5e(u,n,i):null;let m=-1,p=null;o&&(p=new ResizeObserver(x=>{let[y]=x;y&&y.target===u&&p&&t&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(t)})),n()}),u&&!c&&p.observe(u),t&&p.observe(t));let g,b=c?mp(e):null;c&&v();function v(){const x=mp(e);b&&!KQ(b,x)&&n(),b=x,g=requestAnimationFrame(v)}return n(),()=>{var x;d.forEach(y=>{r&&y.removeEventListener("scroll",n),i&&y.removeEventListener("resize",n)}),h==null||h(),(x=p)==null||x.disconnect(),p=null,c&&cancelAnimationFrame(g)}}const Z5e=A5e,eTe=N5e,tTe=C5e,nTe=M5e,sTe=T5e,s$=S5e,rTe=j5e,iTe=(e,t,n)=>{const s=new Map,r=n??{},i={...X5e,...r.platform,_c:s};return _5e(e,t,{...r,platform:i})};var oTe=typeof document<"u",aTe=function(){},L2=oTe?f.useLayoutEffect:aTe;function hS(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(!hS(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)&&!hS(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function YQ(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function r$(e,t){const n=YQ(e);return Math.round(t*n)/n}function HT(e){const t=f.useRef(e);return L2(()=>{t.current=e}),t}function lTe(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:c,open:u}=e,[d,h]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,p]=f.useState(s);hS(m,s)||p(s);const[g,b]=f.useState(null),[v,x]=f.useState(null),y=f.useCallback(F=>{F!==S.current&&(S.current=F,b(F))},[]),w=f.useCallback(F=>{F!==C.current&&(C.current=F,x(F))},[]),k=i||g,T=o||v,S=f.useRef(null),C=f.useRef(null),_=f.useRef(d),B=c!=null,A=HT(c),N=HT(r),j=HT(u),P=f.useCallback(()=>{if(!S.current||!C.current)return;const F={placement:t,strategy:n,middleware:m};N.current&&(F.platform=N.current),iTe(S.current,C.current,F).then(G=>{const I={...G,isPositioned:j.current!==!1};L.current&&!hS(_.current,I)&&(_.current=I,ju.flushSync(()=>{h(I)}))})},[m,t,n,N,j]);L2(()=>{u===!1&&_.current.isPositioned&&(_.current.isPositioned=!1,h(F=>({...F,isPositioned:!1})))},[u]);const L=f.useRef(!1);L2(()=>(L.current=!0,()=>{L.current=!1}),[]),L2(()=>{if(k&&(S.current=k),T&&(C.current=T),k&&T){if(A.current)return A.current(k,T,P);P()}},[k,T,P,A,B]);const O=f.useMemo(()=>({reference:S,floating:C,setReference:y,setFloating:w}),[y,w]),$=f.useMemo(()=>({reference:k,floating:T}),[k,T]),z=f.useMemo(()=>{const F={position:n,left:0,top:0};if(!$.floating)return F;const G=r$($.floating,d.x),I=r$($.floating,d.y);return a?{...F,transform:"translate("+G+"px, "+I+"px)",...YQ($.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:G,top:I}},[n,a,$.floating,d.x,d.y]);return f.useMemo(()=>({...d,update:P,refs:O,elements:$,floatingStyles:z}),[d,P,O,$,z])}const cTe=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?s$({element:s.current,padding:r}).fn(n):{}:s?s$({element:s,padding:r}).fn(n):{}}}},uTe=(e,t)=>{const n=Z5e(e);return{name:n.name,fn:n.fn,options:[e,t]}},dTe=(e,t)=>{const n=eTe(e);return{name:n.name,fn:n.fn,options:[e,t]}},hTe=(e,t)=>({fn:rTe(e).fn,options:[e,t]}),fTe=(e,t)=>{const n=tTe(e);return{name:n.name,fn:n.fn,options:[e,t]}},mTe=(e,t)=>{const n=nTe(e);return{name:n.name,fn:n.fn,options:[e,t]}},pTe=(e,t)=>{const n=sTe(e);return{name:n.name,fn:n.fn,options:[e,t]}},gTe=(e,t)=>{const n=cTe(e);return{name:n.name,fn:n.fn,options:[e,t]}};var bTe="Arrow",XQ=f.forwardRef((e,t)=>{const{children:n,width:s=10,height:r=5,...i}=e;return l.jsx(Ln.svg,{...i,ref:t,width:s,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});XQ.displayName=bTe;var yTe=XQ,Yj="Popper",[QQ,Kf]=Go(Yj),[xTe,JQ]=QQ(Yj),ZQ=e=>{const{__scopePopper:t,children:n}=e,[s,r]=f.useState(null),[i,o]=f.useState(void 0);return l.jsx(xTe,{scope:t,anchor:s,onAnchorChange:r,placementState:i,setPlacementState:o,children:n})};ZQ.displayName=Yj;var eJ="PopperAnchor",tJ=f.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...r}=e,i=JQ(eJ,n),o=f.useRef(null),a=i.onAnchorChange,c=f.useCallback(g=>{o.current=g,g&&a(g)},[a]),u=us(t,c),d=f.useRef(null);f.useEffect(()=>{if(!s)return;const g=d.current;d.current=s.current,g!==d.current&&a(d.current)});const h=i.placementState&&Qj(i.placementState),m=h==null?void 0:h[0],p=h==null?void 0:h[1];return s?null:l.jsx(Ln.div,{"data-radix-popper-side":m,"data-radix-popper-align":p,...r,ref:u})});tJ.displayName=eJ;var Xj="PopperContent",[vTe,wTe]=QQ(Xj),nJ=f.forwardRef((e,t)=>{var de,W,te,U,ee,oe;const{__scopePopper:n,side:s="bottom",sideOffset:r=0,align:i="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:m=!1,updatePositionStrategy:p="optimized",onPlaced:g,...b}=e,v=JQ(Xj,n),[x,y]=f.useState(null),w=us(t,y),[k,T]=f.useState(null),S=c3(k),C=(S==null?void 0:S.width)??0,_=(S==null?void 0:S.height)??0,B=s+(i!=="center"?"-"+i:""),A=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},N=Array.isArray(u)?u:[u],j=N.length>0,P={padding:A,boundary:N.filter(_Te),altBoundary:j},{refs:L,floatingStyles:O,placement:$,isPositioned:z,middlewareData:F}=lTe({strategy:"fixed",placement:B,whileElementsMounted:(...Ce)=>J5e(...Ce,{animationFrame:p==="always"}),elements:{reference:v.anchor},middleware:[uTe({mainAxis:r+_,alignmentAxis:o}),c&&dTe({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?hTe():void 0,...P}),c&&fTe({...P}),mTe({...P,apply:({elements:Ce,rects:he,availableWidth:ye,availableHeight:Ve})=>{const{width:it,height:At}=he.reference,Ee=Ce.floating.style;Ee.setProperty("--radix-popper-available-width",`${ye}px`),Ee.setProperty("--radix-popper-available-height",`${Ve}px`),Ee.setProperty("--radix-popper-anchor-width",`${it}px`),Ee.setProperty("--radix-popper-anchor-height",`${At}px`)}}),k&&gTe({element:k,padding:a}),STe({arrowWidth:C,arrowHeight:_}),m&&pTe({strategy:"referenceHidden",...P,boundary:j?P.boundary:void 0})]}),G=v.setPlacementState;ho(()=>(G($),()=>{G(void 0)}),[$,G]);const[I,Q]=Qj($),V=Sl(g);ho(()=>{z&&(V==null||V())},[z,V]);const M=(de=F.arrow)==null?void 0:de.x,re=(W=F.arrow)==null?void 0:W.y,se=((te=F.arrow)==null?void 0:te.centerOffset)!==0,[X,J]=f.useState();return ho(()=>{x&&J(window.getComputedStyle(x).zIndex)},[x]),l.jsx("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...O,transform:z?O.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:X,"--radix-popper-transform-origin":[(U=F.transformOrigin)==null?void 0:U.x,(ee=F.transformOrigin)==null?void 0:ee.y].join(" "),...((oe=F.hide)==null?void 0:oe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(vTe,{scope:n,placedSide:I,placedAlign:Q,onArrowChange:T,arrowX:M,arrowY:re,shouldHideArrow:se,children:l.jsx(Ln.div,{"data-side":I,"data-align":Q,...b,ref:w,style:{...b.style,animation:z?void 0:"none"}})})})});nJ.displayName=Xj;var sJ="PopperArrow",kTe={top:"bottom",right:"left",bottom:"top",left:"right"},rJ=f.forwardRef(function(t,n){const{__scopePopper:s,...r}=t,i=wTe(sJ,s),o=kTe[i.placedSide];return l.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:l.jsx(yTe,{...r,ref:n,style:{...r.style,display:"block"}})})});rJ.displayName=sJ;function _Te(e){return e!==null}var STe=e=>({name:"transformOrigin",options:e,fn(t){var v,x,y;const{placement:n,rects:s,middlewareData:r}=t,o=((v=r.arrow)==null?void 0:v.centerOffset)!==0,a=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[u,d]=Qj(n),h={start:"0%",center:"50%",end:"100%"}[d],m=(((x=r.arrow)==null?void 0:x.x)??0)+a/2,p=(((y=r.arrow)==null?void 0:y.y)??0)+c/2;let g="",b="";return u==="bottom"?(g=o?h:`${m}px`,b=`${-c}px`):u==="top"?(g=o?h:`${m}px`,b=`${s.floating.height+c}px`):u==="right"?(g=`${-c}px`,b=o?h:`${p}px`):u==="left"&&(g=`${s.floating.width+c}px`,b=o?h:`${p}px`),{data:{x:g,y:b}}}});function Qj(e){const[t,n="center"]=e.split("-");return[t,n]}var Cv=ZQ,Tv=tJ,g3=nJ,b3=rJ,UT=!1;function CTe(){const[e,t]=f.useState(UT);return f.useEffect(()=>{UT||(UT=!0,t(!0))},[]),e}var iJ=u4[" useSyncExternalStore ".trim().toString()];function TTe(){return()=>{}}function ETe(){return iJ(TTe,()=>!0,()=>!1)}var ATe=typeof iJ=="function"?ETe:CTe,VT="rovingFocusGroup.onEntryFocus",NTe={bubbles:!1,cancelable:!0},Ev="RovingFocusGroup",[_E,oJ,jTe]=Ij(Ev),[MTe,Yf]=Go(Ev,[jTe]),[ITe,RTe]=MTe(Ev),aJ=f.forwardRef((e,t)=>l.jsx(_E.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(_E.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(DTe,{...e,ref:t})})}));aJ.displayName=Ev;var DTe=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:r=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...h}=e,m=f.useRef(null),p=us(t,m),g=j1(i),[b,v]=ga({prop:o,defaultProp:a??null,onChange:c,caller:Ev}),[x,y]=f.useState(!1),w=Sl(u),k=oJ(n),T=f.useRef(!1),[S,C]=f.useState(0);return f.useEffect(()=>{const _=m.current;if(_)return _.addEventListener(VT,w),()=>_.removeEventListener(VT,w)},[w]),l.jsx(ITe,{scope:n,orientation:s,dir:g,loop:r,currentTabStopId:b,onItemFocus:f.useCallback(_=>v(_),[v]),onItemShiftTab:f.useCallback(()=>y(!0),[]),onFocusableItemAdd:f.useCallback(()=>C(_=>_+1),[]),onFocusableItemRemove:f.useCallback(()=>C(_=>_-1),[]),children:l.jsx(Ln.div,{tabIndex:x||S===0?-1:0,"data-orientation":s,...h,ref:p,style:{outline:"none",...e.style},onMouseDown:qt(e.onMouseDown,()=>{T.current=!0}),onFocus:qt(e.onFocus,_=>{const B=!T.current;if(_.target===_.currentTarget&&B&&!x){const A=new CustomEvent(VT,NTe);if(_.currentTarget.dispatchEvent(A),!A.defaultPrevented){const N=k().filter($=>$.focusable),j=N.find($=>$.active),P=N.find($=>$.id===b),O=[j,P,...N].filter(Boolean).map($=>$.ref.current);uJ(O,d)}}T.current=!1}),onBlur:qt(e.onBlur,()=>y(!1))})})}),lJ="RovingFocusGroupItem",cJ=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:r=!1,tabStopId:i,children:o,...a}=e,c=qa(),u=i||c,d=RTe(lJ,n),h=d.currentTabStopId===u,m=oJ(n),{onFocusableItemAdd:p,onFocusableItemRemove:g,currentTabStopId:b}=d,v=ATe();return ho(()=>{if(!(!v||!s))return p(),()=>g()},[v,s,p,g]),f.useEffect(()=>{if(!(v||!s))return p(),()=>g()},[v,s,p,g]),l.jsx(_E.ItemSlot,{scope:n,id:u,focusable:s,active:r,children:l.jsx(Ln.span,{tabIndex:h?0:-1,"data-orientation":d.orientation,...a,ref:t,onMouseDown:qt(e.onMouseDown,x=>{s?d.onItemFocus(u):x.preventDefault()}),onFocus:qt(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:qt(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){d.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const y=OTe(x,d.orientation,d.dir);if(y!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let k=m().filter(T=>T.focusable).map(T=>T.ref.current);if(y==="last")k.reverse();else if(y==="prev"||y==="next"){y==="prev"&&k.reverse();const T=k.indexOf(x.currentTarget);k=d.loop?BTe(k,T+1):k.slice(T+1)}setTimeout(()=>uJ(k))}}),children:typeof o=="function"?o({isCurrentTabStop:h,hasTabStop:b!=null}):o})})});cJ.displayName=lJ;var LTe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function PTe(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function OTe(e,t,n){const s=PTe(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return LTe[s]}function uJ(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function BTe(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var y3=aJ,x3=cJ,SE=["Enter"," "],$Te=["ArrowDown","PageUp","Home"],dJ=["ArrowUp","PageDown","End"],zTe=[...$Te,...dJ],FTe={ltr:[...SE,"ArrowRight"],rtl:[...SE,"ArrowLeft"]},qTe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Av="Menu",[Sx,HTe,UTe]=Ij(Av),[$p,hJ]=Go(Av,[UTe,Kf,Yf]),Nv=Kf(),fJ=Yf(),[mJ,Xf]=$p(Av),[VTe,jv]=$p(Av),pJ=e=>{const{__scopeMenu:t,open:n=!1,children:s,dir:r,onOpenChange:i,modal:o=!0}=e,a=Nv(t),[c,u]=f.useState(null),d=f.useRef(!1),h=Sl(i),m=j1(r);return f.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})}},[]),f.useEffect(()=>{if(!n)return;const p=()=>h(!1);return window.addEventListener("blur",p),()=>window.removeEventListener("blur",p)},[n,h]),l.jsx(Cv,{...a,children:l.jsx(mJ,{scope:t,open:n,onOpenChange:h,content:c,onContentChange:u,children:l.jsx(VTe,{scope:t,onClose:f.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:d,dir:m,modal:o,children:s})})})};pJ.displayName=Av;var WTe="MenuAnchor",Jj=f.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,r=Nv(n);return l.jsx(Tv,{...r,...s,ref:t})});Jj.displayName=WTe;var Zj="MenuPortal",[GTe,gJ]=$p(Zj,{forceMount:void 0}),bJ=e=>{const{__scopeMenu:t,forceMount:n,children:s,container:r}=e,i=Xf(Zj,t);return l.jsx(GTe,{scope:t,forceMount:n,children:l.jsx(Ko,{present:n||i.open,children:l.jsx(I1,{asChild:!0,container:r,children:s})})})};bJ.displayName=Zj;var ic="MenuContent",[KTe,eM]=$p(ic),yJ=f.forwardRef((e,t)=>{const n=gJ(ic,e.__scopeMenu),{forceMount:s=n.forceMount,...r}=e,i=Xf(ic,e.__scopeMenu),o=jv(ic,e.__scopeMenu);return l.jsx(Sx.Provider,{scope:e.__scopeMenu,children:l.jsx(Ko,{present:s||i.open,children:l.jsx(Sx.Slot,{scope:e.__scopeMenu,children:o.modal?l.jsx(YTe,{...r,ref:t}):l.jsx(XTe,{...r,ref:t})})})})}),YTe=f.forwardRef((e,t)=>{const n=Xf(ic,e.__scopeMenu),s=f.useRef(null),r=us(t,s);return f.useEffect(()=>{const i=s.current;if(i)return o3(i)},[]),l.jsx(tM,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:qt(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),XTe=f.forwardRef((e,t)=>{const n=Xf(ic,e.__scopeMenu);return l.jsx(tM,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),QTe=Sf("MenuContent.ScrollLock"),tM=f.forwardRef((e,t)=>{const{__scopeMenu:n,loop:s=!1,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:m,onDismiss:p,disableOutsideScroll:g,...b}=e,v=Xf(ic,n),x=jv(ic,n),y=Nv(n),w=fJ(n),k=HTe(n),[T,S]=f.useState(null),C=f.useRef(null),_=us(t,C,v.onContentChange),B=f.useRef(0),A=f.useRef(""),N=f.useRef(0),j=f.useRef(null),P=f.useRef("right"),L=f.useRef(0),O=g?Sv:f.Fragment,$=g?{as:QTe,allowPinchZoom:!0}:void 0,z=G=>{var J,de;const I=A.current+G,Q=k().filter(W=>!W.disabled),V=document.activeElement,M=(J=Q.find(W=>W.ref.current===V))==null?void 0:J.textValue,re=Q.map(W=>W.textValue),se=c6e(re,I,M),X=(de=Q.find(W=>W.textValue===se))==null?void 0:de.ref.current;(function W(te){A.current=te,window.clearTimeout(B.current),te!==""&&(B.current=window.setTimeout(()=>W(""),1e3))})(I),X&&setTimeout(()=>X.focus())};f.useEffect(()=>()=>window.clearTimeout(B.current),[]),r3();const F=f.useCallback(G=>{var Q,V;return P.current===((Q=j.current)==null?void 0:Q.side)&&d6e(G,(V=j.current)==null?void 0:V.area)},[]);return l.jsx(KTe,{scope:n,searchRef:A,onItemEnter:f.useCallback(G=>{F(G)&&G.preventDefault()},[F]),onItemLeave:f.useCallback(G=>{var I;F(G)||((I=C.current)==null||I.focus(),S(null))},[F]),onTriggerLeave:f.useCallback(G=>{F(G)&&G.preventDefault()},[F]),pointerGraceTimerRef:N,onPointerGraceIntentChange:f.useCallback(G=>{j.current=G},[]),children:l.jsx(O,{...$,children:l.jsx(_v,{asChild:!0,trapped:r,onMountAutoFocus:qt(i,G=>{var I;G.preventDefault(),(I=C.current)==null||I.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:l.jsx(M1,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:m,onDismiss:p,children:l.jsx(y3,{asChild:!0,...w,dir:x.dir,orientation:"vertical",loop:s,currentTabStopId:T,onCurrentTabStopIdChange:S,onEntryFocus:qt(c,G=>{x.isUsingKeyboardRef.current||G.preventDefault()}),preventScrollOnEntryFocus:!0,children:l.jsx(g3,{role:"menu","aria-orientation":"vertical","data-state":LJ(v.open),"data-radix-menu-content":"",dir:x.dir,...y,...b,ref:_,style:{outline:"none",...b.style},onKeyDown:qt(b.onKeyDown,G=>{const Q=G.target.closest("[data-radix-menu-content]")===G.currentTarget,V=G.ctrlKey||G.altKey||G.metaKey,M=G.key.length===1;Q&&(G.key==="Tab"&&G.preventDefault(),!V&&M&&z(G.key));const re=C.current;if(G.target!==re||!zTe.includes(G.key))return;G.preventDefault();const X=k().filter(J=>!J.disabled).map(J=>J.ref.current);dJ.includes(G.key)&&X.reverse(),a6e(X)}),onBlur:qt(e.onBlur,G=>{G.currentTarget.contains(G.target)||(window.clearTimeout(B.current),A.current="")}),onPointerMove:qt(e.onPointerMove,Cx(G=>{const I=G.target,Q=L.current!==G.clientX;if(G.currentTarget.contains(I)&&Q){const V=G.clientX>L.current?"right":"left";P.current=V,L.current=G.clientX}}))})})})})})})});yJ.displayName=ic;var JTe="MenuGroup",nM=f.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return l.jsx(Ln.div,{role:"group",...s,ref:t})});nM.displayName=JTe;var ZTe="MenuLabel",xJ=f.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return l.jsx(Ln.div,{...s,ref:t})});xJ.displayName=ZTe;var fS="MenuItem",i$="menu.itemSelect",v3=f.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:s,...r}=e,i=f.useRef(null),o=jv(fS,e.__scopeMenu),a=eM(fS,e.__scopeMenu),c=us(t,i),u=f.useRef(!1),d=()=>{const h=i.current;if(!n&&h){const m=new CustomEvent(i$,{bubbles:!0,cancelable:!0});h.addEventListener(i$,p=>s==null?void 0:s(p),{once:!0}),JX(h,m),m.defaultPrevented?u.current=!1:o.onClose()}};return l.jsx(vJ,{...r,ref:c,disabled:n,onClick:qt(e.onClick,d),onPointerDown:h=>{var m;(m=e.onPointerDown)==null||m.call(e,h),u.current=!0},onPointerUp:qt(e.onPointerUp,h=>{var m;u.current||(m=h.currentTarget)==null||m.click()}),onKeyDown:qt(e.onKeyDown,h=>{n||h.target!==h.currentTarget||a.searchRef.current!==""&&h.key===" "||SE.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});v3.displayName=fS;var vJ=f.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:s=!1,textValue:r,...i}=e,o=eM(fS,n),a=fJ(n),c=f.useRef(null),u=us(t,c),[d,h]=f.useState(!1),[m,p]=f.useState("");return f.useEffect(()=>{const g=c.current;g&&p((g.textContent??"").trim())},[i.children]),l.jsx(Sx.ItemSlot,{scope:n,disabled:s,textValue:r??m,children:l.jsx(x3,{asChild:!0,...a,focusable:!s,children:l.jsx(Ln.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...i,ref:u,onPointerMove:qt(e.onPointerMove,Cx(g=>{s?o.onItemLeave(g):(o.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:qt(e.onPointerLeave,Cx(g=>o.onItemLeave(g))),onFocus:qt(e.onFocus,()=>h(!0)),onBlur:qt(e.onBlur,()=>h(!1))})})})}),e6e="MenuCheckboxItem",wJ=f.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:s,...r}=e;return l.jsx(TJ,{scope:e.__scopeMenu,checked:n,children:l.jsx(v3,{role:"menuitemcheckbox","aria-checked":mS(n)?"mixed":n,...r,ref:t,"data-state":iM(n),onSelect:qt(r.onSelect,()=>s==null?void 0:s(mS(n)?!0:!n),{checkForDefaultPrevented:!1})})})});wJ.displayName=e6e;var kJ="MenuRadioGroup",[t6e,n6e]=$p(kJ,{value:void 0,onValueChange:()=>{}}),_J=f.forwardRef((e,t)=>{const{value:n,onValueChange:s,...r}=e,i=Sl(s);return l.jsx(t6e,{scope:e.__scopeMenu,value:n,onValueChange:i,children:l.jsx(nM,{...r,ref:t})})});_J.displayName=kJ;var SJ="MenuRadioItem",CJ=f.forwardRef((e,t)=>{const{value:n,...s}=e,r=n6e(SJ,e.__scopeMenu),i=n===r.value;return l.jsx(TJ,{scope:e.__scopeMenu,checked:i,children:l.jsx(v3,{role:"menuitemradio","aria-checked":i,...s,ref:t,"data-state":iM(i),onSelect:qt(s.onSelect,()=>{var o;return(o=r.onValueChange)==null?void 0:o.call(r,n)},{checkForDefaultPrevented:!1})})})});CJ.displayName=SJ;var sM="MenuItemIndicator",[TJ,s6e]=$p(sM,{checked:!1}),EJ=f.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:s,...r}=e,i=s6e(sM,n);return l.jsx(Ko,{present:s||mS(i.checked)||i.checked===!0,children:l.jsx(Ln.span,{...r,ref:t,"data-state":iM(i.checked)})})});EJ.displayName=sM;var r6e="MenuSeparator",AJ=f.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return l.jsx(Ln.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});AJ.displayName=r6e;var i6e="MenuArrow",NJ=f.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,r=Nv(n);return l.jsx(b3,{...r,...s,ref:t})});NJ.displayName=i6e;var rM="MenuSub",[o6e,jJ]=$p(rM),MJ=e=>{const{__scopeMenu:t,children:n,open:s=!1,onOpenChange:r}=e,i=Xf(rM,t),o=Nv(t),[a,c]=f.useState(null),[u,d]=f.useState(null),h=Sl(r);return f.useEffect(()=>(i.open===!1&&h(!1),()=>h(!1)),[i.open,h]),l.jsx(Cv,{...o,children:l.jsx(mJ,{scope:t,open:s,onOpenChange:h,content:u,onContentChange:d,children:l.jsx(o6e,{scope:t,contentId:qa(),triggerId:qa(),trigger:a,onTriggerChange:c,children:n})})})};MJ.displayName=rM;var ty="MenuSubTrigger",IJ=f.forwardRef((e,t)=>{const n=Xf(ty,e.__scopeMenu),s=jv(ty,e.__scopeMenu),r=jJ(ty,e.__scopeMenu),i=eM(ty,e.__scopeMenu),o=f.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=i,u={__scopeMenu:e.__scopeMenu},d=f.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);f.useEffect(()=>d,[d]),f.useEffect(()=>{const m=a.current;return()=>{window.clearTimeout(m),c(null)}},[a,c]);const h=us(t,r.onTriggerChange);return l.jsx(Jj,{asChild:!0,...u,children:l.jsx(vJ,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":n.open?r.contentId:void 0,"data-state":LJ(n.open),...e,ref:h,onClick:m=>{var p;(p=e.onClick)==null||p.call(e,m),!(e.disabled||m.defaultPrevented)&&(m.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:qt(e.onPointerMove,Cx(m=>{i.onItemEnter(m),!m.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(i.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:qt(e.onPointerLeave,Cx(m=>{var g,b;d();const p=(g=n.content)==null?void 0:g.getBoundingClientRect();if(p){const v=(b=n.content)==null?void 0:b.dataset.side,x=v==="right",y=x?-5:5,w=p[x?"left":"right"],k=p[x?"right":"left"];i.onPointerGraceIntentChange({area:[{x:m.clientX+y,y:m.clientY},{x:w,y:p.top},{x:k,y:p.top},{x:k,y:p.bottom},{x:w,y:p.bottom}],side:v}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(m),m.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:qt(e.onKeyDown,m=>{var g;e.disabled||m.target!==m.currentTarget||i.searchRef.current!==""&&m.key===" "||FTe[s.dir].includes(m.key)&&(n.onOpenChange(!0),(g=n.content)==null||g.focus(),m.preventDefault())})})})});IJ.displayName=ty;var RJ="MenuSubContent",DJ=f.forwardRef((e,t)=>{const n=gJ(ic,e.__scopeMenu),{forceMount:s=n.forceMount,align:r="start",...i}=e,o=Xf(ic,e.__scopeMenu),a=jv(ic,e.__scopeMenu),c=jJ(RJ,e.__scopeMenu),u=f.useRef(null),d=us(t,u);return l.jsx(Sx.Provider,{scope:e.__scopeMenu,children:l.jsx(Ko,{present:s||o.open,children:l.jsx(Sx.Slot,{scope:e.__scopeMenu,children:l.jsx(tM,{id:c.contentId,"aria-labelledby":c.triggerId,...i,ref:d,align:r,side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:h=>{var m;a.isUsingKeyboardRef.current&&((m=u.current)==null||m.focus()),h.preventDefault()},onCloseAutoFocus:h=>h.preventDefault(),onFocusOutside:qt(e.onFocusOutside,h=>{h.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:qt(e.onEscapeKeyDown,h=>{a.onClose(),h.preventDefault()}),onKeyDown:qt(e.onKeyDown,h=>{var g;const m=h.currentTarget.contains(h.target),p=qTe[a.dir].includes(h.key);m&&p&&(o.onOpenChange(!1),(g=c.trigger)==null||g.focus(),h.preventDefault())})})})})})});DJ.displayName=RJ;function LJ(e){return e?"open":"closed"}function mS(e){return e==="indeterminate"}function iM(e){return mS(e)?"indeterminate":e?"checked":"unchecked"}function a6e(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function l6e(e,t){return e.map((n,s)=>e[(t+s)%e.length])}function c6e(e,t,n){const r=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=l6e(e,Math.max(i,0));r.length===1&&(o=o.filter(u=>u!==n));const c=o.find(u=>u.toLowerCase().startsWith(r.toLowerCase()));return c!==n?c:void 0}function u6e(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],c=t[o],u=a.x,d=a.y,h=c.x,m=c.y;d>s!=m>s&&n<(h-u)*(s-d)/(m-d)+u&&(r=!r)}return r}function d6e(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return u6e(n,t)}function Cx(e){return t=>t.pointerType==="mouse"?e(t):void 0}var h6e=pJ,f6e=Jj,m6e=bJ,p6e=yJ,g6e=nM,b6e=xJ,y6e=v3,x6e=wJ,v6e=_J,w6e=CJ,k6e=EJ,_6e=AJ,S6e=NJ,C6e=MJ,T6e=IJ,E6e=DJ,w3="DropdownMenu",[A6e,Pwt]=Go(w3,[hJ]),Yo=hJ(),[N6e,PJ]=A6e(w3),OJ=e=>{const{__scopeDropdownMenu:t,children:n,dir:s,open:r,defaultOpen:i,onOpenChange:o,modal:a=!0}=e,c=Yo(t),u=f.useRef(null),[d,h]=ga({prop:r,defaultProp:i??!1,onChange:o,caller:w3});return l.jsx(N6e,{scope:t,triggerId:qa(),triggerRef:u,contentId:qa(),open:d,onOpenChange:h,onOpenToggle:f.useCallback(()=>h(m=>!m),[h]),modal:a,children:l.jsx(h6e,{...c,open:d,onOpenChange:h,dir:s,modal:a,children:n})})};OJ.displayName=w3;var BJ="DropdownMenuTrigger",$J=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:s=!1,...r}=e,i=PJ(BJ,n),o=Yo(n),a=us(t,i.triggerRef);return l.jsx(f6e,{asChild:!0,...o,children:l.jsx(Ln.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:qt(e.onPointerDown,c=>{!s&&c.button===0&&c.ctrlKey===!1&&(i.onOpenToggle(),i.open||c.preventDefault())}),onKeyDown:qt(e.onKeyDown,c=>{s||(["Enter"," "].includes(c.key)&&i.onOpenToggle(),c.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});$J.displayName=BJ;var j6e="DropdownMenuPortal",zJ=e=>{const{__scopeDropdownMenu:t,...n}=e,s=Yo(t);return l.jsx(m6e,{...s,...n})};zJ.displayName=j6e;var FJ="DropdownMenuContent",qJ=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=PJ(FJ,n),i=Yo(n),o=f.useRef(!1);return l.jsx(p6e,{id:r.contentId,"aria-labelledby":r.triggerId,...i,...s,ref:t,onCloseAutoFocus:qt(e.onCloseAutoFocus,a=>{var c;o.current||(c=r.triggerRef.current)==null||c.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:qt(e.onInteractOutside,a=>{const c=a.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!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)"}})});qJ.displayName=FJ;var M6e="DropdownMenuGroup",HJ=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Yo(n);return l.jsx(g6e,{...r,...s,ref:t})});HJ.displayName=M6e;var I6e="DropdownMenuLabel",R6e=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Yo(n);return l.jsx(b6e,{...r,...s,ref:t})});R6e.displayName=I6e;var D6e="DropdownMenuItem",UJ=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Yo(n);return l.jsx(y6e,{...r,...s,ref:t})});UJ.displayName=D6e;var L6e="DropdownMenuCheckboxItem",P6e=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Yo(n);return l.jsx(x6e,{...r,...s,ref:t})});P6e.displayName=L6e;var O6e="DropdownMenuRadioGroup",B6e=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Yo(n);return l.jsx(v6e,{...r,...s,ref:t})});B6e.displayName=O6e;var $6e="DropdownMenuRadioItem",z6e=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Yo(n);return l.jsx(w6e,{...r,...s,ref:t})});z6e.displayName=$6e;var F6e="DropdownMenuItemIndicator",q6e=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Yo(n);return l.jsx(k6e,{...r,...s,ref:t})});q6e.displayName=F6e;var H6e="DropdownMenuSeparator",VJ=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Yo(n);return l.jsx(_6e,{...r,...s,ref:t})});VJ.displayName=H6e;var U6e="DropdownMenuArrow",V6e=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Yo(n);return l.jsx(S6e,{...r,...s,ref:t})});V6e.displayName=U6e;var W6e=e=>{const{__scopeDropdownMenu:t,children:n,open:s,onOpenChange:r,defaultOpen:i}=e,o=Yo(t),[a,c]=ga({prop:s,defaultProp:i??!1,onChange:r,caller:"DropdownMenuSub"});return l.jsx(C6e,{...o,open:a,onOpenChange:c,children:n})},G6e="DropdownMenuSubTrigger",WJ=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Yo(n);return l.jsx(T6e,{...r,...s,ref:t})});WJ.displayName=G6e;var K6e="DropdownMenuSubContent",GJ=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Yo(n);return l.jsx(E6e,{...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)"}})});GJ.displayName=K6e;var Y6e=OJ,X6e=$J,Q6e=zJ,J6e=qJ,Z6e=HJ,e8e=UJ,t8e=VJ,n8e=W6e,s8e=WJ,r8e=GJ,i8e="Label",KJ=f.forwardRef((e,t)=>l.jsx(Ln.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())}}));KJ.displayName=i8e;var o8e=KJ;function o$(e,[t,n]){return Math.min(n,Math.max(t,e))}var k3="Popover",[YJ,Owt]=Go(k3,[Kf]),Mv=Kf(),[a8e,Qf]=YJ(k3),XJ=e=>{const{__scopePopover:t,children:n,open:s,defaultOpen:r,onOpenChange:i,modal:o=!1}=e,a=Mv(t),c=f.useRef(null),[u,d]=f.useState(!1),[h,m]=ga({prop:s,defaultProp:r??!1,onChange:i,caller:k3});return l.jsx(Cv,{...a,children:l.jsx(a8e,{scope:t,contentId:qa(),triggerRef:c,open:h,onOpenChange:m,onOpenToggle:f.useCallback(()=>m(p=>!p),[m]),hasCustomAnchor:u,onCustomAnchorAdd:f.useCallback(()=>d(!0),[]),onCustomAnchorRemove:f.useCallback(()=>d(!1),[]),modal:o,children:n})})};XJ.displayName=k3;var QJ="PopoverAnchor",JJ=f.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,r=Qf(QJ,n),i=Mv(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=r;return f.useEffect(()=>(o(),()=>a()),[o,a]),l.jsx(Tv,{...i,...s,ref:t})});JJ.displayName=QJ;var ZJ="PopoverTrigger",eZ=f.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,r=Qf(ZJ,n),i=Mv(n),o=us(t,r.triggerRef),a=l.jsx(Ln.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.open?r.contentId:void 0,"data-state":iZ(r.open),...s,ref:o,onClick:qt(e.onClick,r.onOpenToggle)});return r.hasCustomAnchor?a:l.jsx(Tv,{asChild:!0,...i,children:a})});eZ.displayName=ZJ;var oM="PopoverPortal",[l8e,c8e]=YJ(oM,{forceMount:void 0}),tZ=e=>{const{__scopePopover:t,forceMount:n,children:s,container:r}=e,i=Qf(oM,t);return l.jsx(l8e,{scope:t,forceMount:n,children:l.jsx(Ko,{present:n||i.open,children:l.jsx(I1,{asChild:!0,container:r,children:s})})})};tZ.displayName=oM;var Ug="PopoverContent",nZ=f.forwardRef((e,t)=>{const n=c8e(Ug,e.__scopePopover),{forceMount:s=n.forceMount,...r}=e,i=Qf(Ug,e.__scopePopover);return l.jsx(Ko,{present:s||i.open,children:i.modal?l.jsx(d8e,{...r,ref:t}):l.jsx(h8e,{...r,ref:t})})});nZ.displayName=Ug;var u8e=Sf("PopoverContent.RemoveScroll"),d8e=f.forwardRef((e,t)=>{const n=Qf(Ug,e.__scopePopover),s=f.useRef(null),r=us(t,s),i=f.useRef(!1);return f.useEffect(()=>{const o=s.current;if(o)return o3(o)},[]),l.jsx(Sv,{as:u8e,allowPinchZoom:!0,children:l.jsx(sZ,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:qt(e.onCloseAutoFocus,o=>{var a;o.preventDefault(),i.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:qt(e.onPointerDownOutside,o=>{const a=o.detail.originalEvent,c=a.button===0&&a.ctrlKey===!0,u=a.button===2||c;i.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:qt(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),h8e=f.forwardRef((e,t)=>{const n=Qf(Ug,e.__scopePopover),s=f.useRef(!1),r=f.useRef(!1);return l.jsx(sZ,{...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 c,u;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(s.current=!0,i.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const o=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&r.current&&i.preventDefault()}})}),sZ=f.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:s,onOpenAutoFocus:r,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:d,...h}=e,m=Qf(Ug,n),p=Mv(n);return r3(),l.jsx(_v,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:r,onUnmountAutoFocus:i,children:l.jsx(M1,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:a,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>m.onOpenChange(!1),deferPointerDownOutside:!0,children:l.jsx(g3,{"data-state":iZ(m.open),role:"dialog",id:m.contentId,...p,...h,ref:t,style:{...h.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),rZ="PopoverClose",f8e=f.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,r=Qf(rZ,n);return l.jsx(Ln.button,{type:"button",...s,ref:t,onClick:qt(e.onClick,()=>r.onOpenChange(!1))})});f8e.displayName=rZ;var m8e="PopoverArrow",p8e=f.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,r=Mv(n);return l.jsx(b3,{...r,...s,ref:t})});p8e.displayName=m8e;function iZ(e){return e?"open":"closed"}var g8e=XJ,b8e=JJ,y8e=eZ,x8e=tZ,v8e=nZ,aM="Radio",[w8e,oZ]=Go(aM),[k8e,_3]=w8e(aM);function aZ(e){const{__scopeRadio:t,checked:n=!1,children:s,disabled:r,form:i,name:o,onCheck:a,required:c,value:u="on",internal_do_not_use_render:d}=e,[h,m]=f.useState(null),[p,g]=f.useState(null),b=f.useRef(!1),v=h?!!i||!!h.closest("form"):!0,x={checked:n,disabled:r,required:c,name:o,form:i,value:u,control:h,setControl:m,hasConsumerStoppedPropagationRef:b,isFormControl:v,bubbleInput:p,setBubbleInput:g,onCheck:()=>a==null?void 0:a()};return l.jsx(k8e,{scope:t,...x,children:S8e(d)?d(x):s})}var lZ="RadioTrigger",lM=f.forwardRef(({__scopeRadio:e,onClick:t,...n},s)=>{const{checked:r,disabled:i,value:o,setControl:a,onCheck:c,hasConsumerStoppedPropagationRef:u,isFormControl:d,bubbleInput:h}=_3(lZ,e),m=us(s,a);return l.jsx(Ln.button,{type:"button",role:"radio","aria-checked":r,"data-state":hZ(r),"data-disabled":i?"":void 0,disabled:i,value:o,...n,ref:m,onClick:qt(t,p=>{r||c(),h&&d&&(u.current=p.isPropagationStopped(),u.current||p.stopPropagation())})})});lM.displayName=lZ;var _8e=f.forwardRef((e,t)=>{const{__scopeRadio:n,name:s,checked:r,required:i,disabled:o,value:a,onCheck:c,form:u,...d}=e;return l.jsx(aZ,{__scopeRadio:n,checked:r,disabled:o,required:i,onCheck:c,name:s,form:u,value:a,internal_do_not_use_render:({isFormControl:h})=>l.jsxs(l.Fragment,{children:[l.jsx(lM,{...d,ref:t,__scopeRadio:n}),h&&l.jsx(cM,{__scopeRadio:n})]})})});_8e.displayName=aM;var cZ="RadioIndicator",uZ=f.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:s,...r}=e,i=_3(cZ,n);return l.jsx(Ko,{present:s||i.checked,children:l.jsx(Ln.span,{"data-state":hZ(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:t})})});uZ.displayName=cZ;var dZ="RadioBubbleInput",cM=f.forwardRef(({__scopeRadio:e,...t},n)=>{const{control:s,checked:r,required:i,disabled:o,name:a,value:c,form:u,bubbleInput:d,setBubbleInput:h,hasConsumerStoppedPropagationRef:m}=_3(dZ,e),p=us(n,h),g=l3(r),b=c3(s);f.useEffect(()=>{const x=d;if(!x)return;const y=window.HTMLInputElement.prototype,k=Object.getOwnPropertyDescriptor(y,"checked").set,T=!m.current;if(g!==r&&k){const S=new Event("click",{bubbles:T});k.call(x,r),x.dispatchEvent(S)}},[d,g,r,m]);const v=f.useRef(r);return l.jsx(Ln.input,{type:"radio","aria-hidden":!0,defaultChecked:v.current,required:i,disabled:o,name:a,value:c,form:u,...t,tabIndex:-1,ref:p,style:{...t.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});cM.displayName=dZ;function S8e(e){return typeof e=="function"}function hZ(e){return e?"checked":"unchecked"}var C8e=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],S3="RadioGroup",[T8e,Bwt]=Go(S3,[Yf,oZ]),fZ=Yf(),C3=oZ(),[E8e,A8e]=T8e(S3),mZ=f.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:s,form:r,defaultValue:i,value:o,required:a=!1,disabled:c=!1,orientation:u,dir:d,loop:h=!0,onValueChange:m,...p}=e,g=fZ(n),b=j1(d),[v,x]=ga({prop:o,defaultProp:i??null,onChange:m,caller:S3}),[y,w]=f.useState(null),k=us(t,w),T=f.useRef(v);return f.useEffect(()=>{const S=r?y==null?void 0:y.ownerDocument.getElementById(r):y==null?void 0:y.closest("form");if(S instanceof HTMLFormElement){const C=()=>x(T.current);return S.addEventListener("reset",C),()=>S.removeEventListener("reset",C)}},[y,r,x]),l.jsx(E8e,{scope:n,name:s,form:r,required:a,disabled:c,value:v,onValueChange:x,children:l.jsx(y3,{asChild:!0,...g,orientation:u,dir:b,loop:h,children:l.jsx(Ln.div,{role:"radiogroup","aria-required":a,"aria-orientation":u,"data-disabled":c?"":void 0,dir:b,...p,ref:k})})})});mZ.displayName=S3;var N8e="RadioGroupItem",j8e="RadioGroupItemProvider",pZ="RadioGroupItemTrigger",M8e="RadioGroupItemBubbleInput";function I8e(e){const{__scopeRadioGroup:t,value:n,disabled:s,children:r,internal_do_not_use_render:i}=e,o=A8e(j8e,t),a=C3(t),c=o.disabled||s;return l.jsx(aZ,{...a,checked:o.value===n,disabled:c,required:o.required,name:o.name,form:o.form,value:n,onCheck:()=>o.onValueChange(n),internal_do_not_use_render:i,children:r})}var gZ=f.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...s}=e,r=fZ(n),i=C3(n),{checked:o,disabled:a}=_3(pZ,i.__scopeRadio),c=f.useRef(null),u=us(t,c),d=f.useRef(!1);return f.useEffect(()=>{const h=p=>{C8e.includes(p.key)&&(d.current=!0)},m=()=>d.current=!1;return document.addEventListener("keydown",h),document.addEventListener("keyup",m),()=>{document.removeEventListener("keydown",h),document.removeEventListener("keyup",m)}},[]),l.jsx(x3,{asChild:!0,...r,focusable:!a,active:o,children:l.jsx(lM,{...i,...s,ref:u,onKeyDown:qt(s.onKeyDown,h=>{h.key==="Enter"&&h.preventDefault()}),onFocus:qt(s.onFocus,()=>{var h;d.current&&((h=c.current)==null||h.click())})})})});gZ.displayName=pZ;var bZ=f.forwardRef((e,t)=>{const{__scopeRadioGroup:n,value:s,disabled:r,...i}=e;return l.jsx(I8e,{__scopeRadioGroup:n,value:s,disabled:r,internal_do_not_use_render:({isFormControl:o})=>l.jsxs(l.Fragment,{children:[l.jsx(gZ,{...i,ref:t,__scopeRadioGroup:n}),o&&l.jsx(yZ,{__scopeRadioGroup:n})]})})});bZ.displayName=N8e;var yZ=f.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...s}=e,r=C3(n);return l.jsx(cM,{...r,...s,ref:t})});yZ.displayName=M8e;var R8e="RadioGroupIndicator",xZ=f.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...s}=e,r=C3(n);return l.jsx(uZ,{...r,...s,ref:t})});xZ.displayName=R8e;var D8e=[" ","Enter","ArrowUp","ArrowDown"],L8e=[" ","Enter"],pp="Select",[T3,E3,P8e]=Ij(pp),[zp,$wt]=Go(pp,[P8e,Kf]),A3=Kf(),[O8e,Jf]=zp(pp),[B8e,$8e]=zp(pp),z8e="SelectProvider";function vZ(e){const{__scopeSelect:t,children:n,open:s,defaultOpen:r,onOpenChange:i,value:o,defaultValue:a,onValueChange:c,dir:u,name:d,autoComplete:h,disabled:m,required:p,form:g,internal_do_not_use_render:b}=e,v=A3(t),[x,y]=f.useState(null),[w,k]=f.useState(null),[T,S]=f.useState(!1),C=j1(u),[_,B]=ga({prop:s,defaultProp:r??!1,onChange:i,caller:pp}),[A,N]=ga({prop:o,defaultProp:a,onChange:c,caller:pp}),j=f.useRef(null),P=f.useRef(A);f.useEffect(()=>{const V=g?x==null?void 0:x.ownerDocument.getElementById(g):x==null?void 0:x.form;if(V instanceof HTMLFormElement){const M=()=>N(P.current);return V.addEventListener("reset",M),()=>V.removeEventListener("reset",M)}},[g,x,N]);const L=x?!!g||!!x.closest("form"):!0,[O,$]=f.useState(new Set),z=qa(),F=Array.from(O).map(V=>V.props.value).join(";"),G=f.useCallback(V=>{$(M=>new Set(M).add(V))},[]),I=f.useCallback(V=>{$(M=>{const re=new Set(M);return re.delete(V),re})},[]),Q={required:p,trigger:x,onTriggerChange:y,valueNode:w,onValueNodeChange:k,valueNodeHasChildren:T,onValueNodeHasChildrenChange:S,contentId:z,value:A,onValueChange:N,open:_,onOpenChange:B,dir:C,triggerPointerDownPosRef:j,disabled:m,name:d,autoComplete:h,form:g,nativeOptions:O,nativeSelectKey:F,isFormControl:L};return l.jsx(Cv,{...v,children:l.jsx(O8e,{scope:t,...Q,children:l.jsx(T3.Provider,{scope:t,children:l.jsx(B8e,{scope:t,onNativeOptionAdd:G,onNativeOptionRemove:I,children:n7e(b)?b(Q):n})})})})}vZ.displayName=z8e;var wZ=e=>{const{__scopeSelect:t,children:n,...s}=e;return l.jsx(vZ,{__scopeSelect:t,...s,internal_do_not_use_render:({isFormControl:r})=>l.jsxs(l.Fragment,{children:[n,r?l.jsx(KZ,{__scopeSelect:t}):null]})})};wZ.displayName=pp;var kZ="SelectTrigger",_Z=f.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:s=!1,...r}=e,i=A3(n),o=Jf(kZ,n),a=o.disabled||s,c=us(t,o.onTriggerChange),u=E3(n),d=f.useRef("touch"),[h,m,p]=YZ(b=>{const v=u().filter(w=>!w.disabled),x=v.find(w=>w.value===o.value),y=XZ(v,b,x);y!==void 0&&o.onValueChange(y.value)}),g=b=>{a||(o.onOpenChange(!0),p()),b&&(o.triggerPointerDownPosRef.current={x:Math.round(b.pageX),y:Math.round(b.pageY)})};return l.jsx(Tv,{asChild:!0,...i,children:l.jsx(Ln.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":N3(o.value)?"":void 0,...r,ref:c,onClick:qt(r.onClick,b=>{b.currentTarget.focus(),d.current!=="mouse"&&g(b)}),onPointerDown:qt(r.onPointerDown,b=>{d.current=b.pointerType;const v=b.target;v.hasPointerCapture(b.pointerId)&&v.releasePointerCapture(b.pointerId),b.button===0&&b.ctrlKey===!1&&b.pointerType==="mouse"&&(g(b),b.preventDefault())}),onKeyDown:qt(r.onKeyDown,b=>{const v=h.current!=="";!(b.ctrlKey||b.altKey||b.metaKey)&&b.key.length===1&&m(b.key),!(v&&b.key===" ")&&D8e.includes(b.key)&&(g(),b.preventDefault())})})})});_Z.displayName=kZ;var SZ="SelectValue",CZ=f.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:r,children:i,placeholder:o="",...a}=e,c=Jf(SZ,n),{onValueNodeHasChildrenChange:u}=c,d=i!==void 0,h=us(t,c.onValueNodeChange);ho(()=>{u(d)},[u,d]);const m=N3(c.value);return l.jsx(Ln.span,{...a,asChild:m?!1:a.asChild,ref:h,style:{pointerEvents:"none"},children:l.jsx(f.Fragment,{children:m?o:i},m?"placeholder":"value")})});CZ.displayName=SZ;var F8e="SelectIcon",TZ=f.forwardRef((e,t)=>{const{__scopeSelect:n,children:s,...r}=e;return l.jsx(Ln.span,{"aria-hidden":!0,...r,ref:t,children:s||"▼"})});TZ.displayName=F8e;var EZ="SelectPortal",[q8e,H8e]=zp(EZ,{forceMount:void 0}),AZ=e=>{const{__scopeSelect:t,forceMount:n,...s}=e;return l.jsx(q8e,{scope:e.__scopeSelect,forceMount:n,children:l.jsx(I1,{asChild:!0,...s})})};AZ.displayName=EZ;var Ef="SelectContent",NZ=f.forwardRef((e,t)=>{const n=H8e(Ef,e.__scopeSelect),{forceMount:s=n.forceMount,...r}=e,i=Jf(Ef,e.__scopeSelect),[o,a]=f.useState();return ho(()=>{a(new DocumentFragment)},[]),l.jsx(Ko,{present:s||i.open,children:({present:c})=>c?l.jsx(IZ,{...r,ref:t}):l.jsx(jZ,{...r,fragment:o})})});NZ.displayName=Ef;var jZ=f.forwardRef((e,t)=>{const{__scopeSelect:n,children:s,fragment:r}=e;return r?ju.createPortal(l.jsx(MZ,{scope:n,children:l.jsx(T3.Slot,{scope:n,children:l.jsx("div",{ref:t,children:s})})}),r):null});jZ.displayName="SelectContentFragment";var vc=10,[MZ,Zf]=zp(Ef),U8e="SelectContentImpl",V8e=Sf("SelectContent.RemoveScroll"),IZ=f.forwardRef((e,t)=>{const{__scopeSelect:n}=e,{position:s="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:i,onPointerDownOutside:o,side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:m,collisionPadding:p,sticky:g,hideWhenDetached:b,avoidCollisions:v,...x}=e,y=Jf(Ef,n),[w,k]=f.useState(null),[T,S]=f.useState(null),C=us(t,k),[_,B]=f.useState(null),[A,N]=f.useState(null),j=E3(n),[P,L]=f.useState(!1),O=f.useRef(!1);f.useEffect(()=>{if(w)return o3(w)},[w]),r3();const $=f.useCallback(J=>{const[de,...W]=j().map(ee=>ee.ref.current),[te]=W.slice(-1),U=document.activeElement;for(const ee of J)if(ee===U||(ee==null||ee.scrollIntoView({block:"nearest"}),ee===de&&T&&(T.scrollTop=0),ee===te&&T&&(T.scrollTop=T.scrollHeight),ee==null||ee.focus(),document.activeElement!==U))return},[j,T]),z=f.useCallback(()=>$([_,w]),[$,_,w]);f.useEffect(()=>{P&&z()},[P,z]);const{onOpenChange:F,triggerPointerDownPosRef:G}=y;f.useEffect(()=>{if(w){let J={x:0,y:0};const de=te=>{var U,ee;J={x:Math.abs(Math.round(te.pageX)-(((U=G.current)==null?void 0:U.x)??0)),y:Math.abs(Math.round(te.pageY)-(((ee=G.current)==null?void 0:ee.y)??0))}},W=te=>{J.x<=10&&J.y<=10?te.preventDefault():te.composedPath().includes(w)||F(!1),document.removeEventListener("pointermove",de),G.current=null};return G.current!==null&&(document.addEventListener("pointermove",de),document.addEventListener("pointerup",W,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",de),document.removeEventListener("pointerup",W,{capture:!0})}}},[w,F,G]),f.useEffect(()=>{const J=()=>F(!1);return window.addEventListener("blur",J),window.addEventListener("resize",J),()=>{window.removeEventListener("blur",J),window.removeEventListener("resize",J)}},[F]);const[I,Q]=YZ(J=>{const de=j().filter(U=>!U.disabled),W=de.find(U=>U.ref.current===document.activeElement),te=XZ(de,J,W);te&&setTimeout(()=>{var U;return(U=te.ref.current)==null?void 0:U.focus()})}),V=f.useCallback((J,de,W)=>{const te=!O.current&&!W;(y.value!==void 0&&y.value===de||te)&&(B(J),te&&(O.current=!0))},[y.value]),M=f.useCallback(()=>w==null?void 0:w.focus(),[w]),re=f.useCallback((J,de,W)=>{const te=!O.current&&!W;(y.value!==void 0&&y.value===de||te)&&N(J)},[y.value]),se=s==="popper"?CE:RZ,X=se===CE?{side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:m,collisionPadding:p,sticky:g,hideWhenDetached:b,avoidCollisions:v}:{};return l.jsx(MZ,{scope:n,content:w,viewport:T,onViewportChange:S,itemRefCallback:V,selectedItem:_,onItemLeave:M,itemTextRefCallback:re,focusSelectedItem:z,selectedItemText:A,position:s,isPositioned:P,searchRef:I,children:l.jsx(Sv,{as:V8e,allowPinchZoom:!0,children:l.jsx(_v,{asChild:!0,trapped:y.open,onMountAutoFocus:J=>{J.preventDefault()},onUnmountAutoFocus:qt(r,J=>{var de;(de=y.trigger)==null||de.focus({preventScroll:!0}),J.preventDefault()}),children:l.jsx(M1,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:J=>J.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:l.jsx(se,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:J=>J.preventDefault(),...x,...X,onPlaced:()=>L(!0),ref:C,style:{display:"flex",flexDirection:"column",outline:"none",...x.style},onKeyDown:qt(x.onKeyDown,J=>{const de=J.ctrlKey||J.altKey||J.metaKey;if(J.key==="Tab"&&J.preventDefault(),!de&&J.key.length===1&&Q(J.key),["ArrowUp","ArrowDown","Home","End"].includes(J.key)){let te=j().filter(U=>!U.disabled).map(U=>U.ref.current);if(["ArrowUp","End"].includes(J.key)&&(te=te.slice().reverse()),["ArrowUp","ArrowDown"].includes(J.key)){const U=J.target,ee=te.indexOf(U);te=te.slice(ee+1)}setTimeout(()=>$(te)),J.preventDefault()}})})})})})})});IZ.displayName=U8e;var W8e="SelectItemAlignedPosition",RZ=f.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:s,...r}=e,i=Jf(Ef,n),o=Zf(Ef,n),[a,c]=f.useState(null),[u,d]=f.useState(null),h=us(t,d),m=E3(n),p=f.useRef(!1),g=f.useRef(!0),{viewport:b,selectedItem:v,selectedItemText:x,focusSelectedItem:y}=o,w=f.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&u&&b&&v&&x){const C=i.trigger.getBoundingClientRect(),_=u.getBoundingClientRect(),B=i.valueNode.getBoundingClientRect(),A=x.getBoundingClientRect();if(i.dir!=="rtl"){const U=A.left-_.left,ee=B.left-U,oe=C.left-ee,Ce=C.width+oe,he=Math.max(Ce,_.width),ye=window.innerWidth-vc,Ve=o$(ee,[vc,Math.max(vc,ye-he)]);a.style.minWidth=Ce+"px",a.style.left=Ve+"px"}else{const U=_.right-A.right,ee=window.innerWidth-B.right-U,oe=window.innerWidth-C.right-ee,Ce=C.width+oe,he=Math.max(Ce,_.width),ye=window.innerWidth-vc,Ve=o$(ee,[vc,Math.max(vc,ye-he)]);a.style.minWidth=Ce+"px",a.style.right=Ve+"px"}const N=m(),j=window.innerHeight-vc*2,P=b.scrollHeight,L=window.getComputedStyle(u),O=parseInt(L.borderTopWidth,10),$=parseInt(L.paddingTop,10),z=parseInt(L.borderBottomWidth,10),F=parseInt(L.paddingBottom,10),G=O+$+P+F+z,I=Math.min(v.offsetHeight*5,G),Q=window.getComputedStyle(b),V=parseInt(Q.paddingTop,10),M=parseInt(Q.paddingBottom,10),re=C.top+C.height/2-vc,se=j-re,X=v.offsetHeight/2,J=v.offsetTop+X,de=O+$+J,W=G-de;if(de<=re){const U=N.length>0&&v===N[N.length-1].ref.current;a.style.bottom="0px";const ee=u.clientHeight-b.offsetTop-b.offsetHeight,oe=Math.max(se,X+(U?M:0)+ee+z),Ce=de+oe;a.style.height=Ce+"px"}else{const U=N.length>0&&v===N[0].ref.current;a.style.top="0px";const oe=Math.max(re,O+b.offsetTop+(U?V:0)+X)+W;a.style.height=oe+"px",b.scrollTop=de-re+b.offsetTop}a.style.margin=`${vc}px 0`,a.style.minHeight=I+"px",a.style.maxHeight=j+"px",s==null||s(),requestAnimationFrame(()=>p.current=!0)}},[m,i.trigger,i.valueNode,a,u,b,v,x,i.dir,s]);ho(()=>w(),[w]);const[k,T]=f.useState();ho(()=>{u&&T(window.getComputedStyle(u).zIndex)},[u]);const S=f.useCallback(C=>{C&&g.current===!0&&(w(),y==null||y(),g.current=!1)},[w,y]);return l.jsx(K8e,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:p,onScrollButtonChange:S,children:l.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:l.jsx(Ln.div,{...r,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});RZ.displayName=W8e;var G8e="SelectPopperPosition",CE=f.forwardRef((e,t)=>{const{__scopeSelect:n,align:s="start",collisionPadding:r=vc,...i}=e,o=A3(n);return l.jsx(g3,{...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)"}})});CE.displayName=G8e;var[K8e,uM]=zp(Ef,{}),TE="SelectViewport",DZ=f.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:s,...r}=e,i=Zf(TE,n),o=uM(TE,n),a=us(t,i.onViewportChange),c=f.useRef(0);return l.jsxs(l.Fragment,{children:[l.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}),l.jsx(T3.Slot,{scope:n,children:l.jsx(Ln.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:qt(r.onScroll,u=>{const d=u.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:m}=o;if(m!=null&&m.current&&h){const p=Math.abs(c.current-d.scrollTop);if(p>0){const g=window.innerHeight-vc*2,b=parseFloat(h.style.minHeight),v=parseFloat(h.style.height),x=Math.max(b,v);if(x<g){const y=x+p,w=Math.min(g,y),k=y-w;h.style.height=w+"px",h.style.bottom==="0px"&&(d.scrollTop=k>0?k:0,h.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});DZ.displayName=TE;var LZ="SelectGroup",[Y8e,X8e]=zp(LZ),PZ=f.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,r=qa();return l.jsx(Y8e,{scope:n,id:r,children:l.jsx(Ln.div,{role:"group","aria-labelledby":r,...s,ref:t})})});PZ.displayName=LZ;var OZ="SelectLabel",Q8e=f.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,r=X8e(OZ,n);return l.jsx(Ln.div,{id:r.id,...s,ref:t})});Q8e.displayName=OZ;var pS="SelectItem",[J8e,BZ]=zp(pS),$Z=f.forwardRef((e,t)=>{const{__scopeSelect:n,value:s,disabled:r=!1,textValue:i,...o}=e,a=Jf(pS,n),c=Zf(pS,n),u=a.value===s,[d,h]=f.useState(i??""),[m,p]=f.useState(!1),g=Sl(w=>{var k;return(k=c.itemRefCallback)==null?void 0:k.call(c,w,s,r)}),b=us(t,g),v=qa(),x=f.useRef("touch"),y=()=>{r||(a.onValueChange(s),a.onOpenChange(!1))};return l.jsx(J8e,{scope:n,value:s,disabled:r,textId:v,isSelected:u,onItemTextChange:f.useCallback(w=>{h(k=>k||((w==null?void 0:w.textContent)??"").trim())},[]),children:l.jsx(T3.ItemSlot,{scope:n,value:s,disabled:r,textValue:d,children:l.jsx(Ln.div,{role:"option","aria-labelledby":v,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...o,ref:b,onFocus:qt(o.onFocus,()=>p(!0)),onBlur:qt(o.onBlur,()=>p(!1)),onClick:qt(o.onClick,()=>{x.current!=="mouse"&&y()}),onPointerUp:qt(o.onPointerUp,()=>{x.current==="mouse"&&y()}),onPointerDown:qt(o.onPointerDown,w=>{x.current=w.pointerType}),onPointerMove:qt(o.onPointerMove,w=>{var k;x.current=w.pointerType,r?(k=c.onItemLeave)==null||k.call(c):x.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:qt(o.onPointerLeave,w=>{var k;w.currentTarget===document.activeElement&&((k=c.onItemLeave)==null||k.call(c))}),onKeyDown:qt(o.onKeyDown,w=>{var T;r||w.target!==w.currentTarget||((T=c.searchRef)==null?void 0:T.current)!==""&&w.key===" "||(L8e.includes(w.key)&&y(),w.key===" "&&w.preventDefault())})})})})});$Z.displayName=pS;var ny="SelectItemText",zZ=f.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:r,...i}=e,o=Jf(ny,n),a=Zf(ny,n),c=BZ(ny,n),u=$8e(ny,n),[d,h]=f.useState(null),m=Sl(y=>{var w;return(w=a.itemTextRefCallback)==null?void 0:w.call(a,y,c.value,c.disabled)}),p=us(t,h,c.onItemTextChange,m),g=d==null?void 0:d.textContent,b=f.useMemo(()=>l.jsx("option",{value:c.value,disabled:c.disabled,children:g},c.value),[c.disabled,c.value,g]),{onNativeOptionAdd:v,onNativeOptionRemove:x}=u;return ho(()=>(v(b),()=>x(b)),[v,x,b]),l.jsxs(l.Fragment,{children:[l.jsx(Ln.span,{id:c.textId,...i,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!N3(o.value)?ju.createPortal(i.children,o.valueNode):null]})});zZ.displayName=ny;var FZ="SelectItemIndicator",qZ=f.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return BZ(FZ,n).isSelected?l.jsx(Ln.span,{"aria-hidden":!0,...s,ref:t}):null});qZ.displayName=FZ;var EE="SelectScrollUpButton",HZ=f.forwardRef((e,t)=>{const n=Zf(EE,e.__scopeSelect),s=uM(EE,e.__scopeSelect),[r,i]=f.useState(!1),o=us(t,s.onScrollButtonChange);return ho(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=c.scrollTop>0;i(u)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),r?l.jsx(VZ,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});HZ.displayName=EE;var AE="SelectScrollDownButton",UZ=f.forwardRef((e,t)=>{const n=Zf(AE,e.__scopeSelect),s=uM(AE,e.__scopeSelect),[r,i]=f.useState(!1),o=us(t,s.onScrollButtonChange);return ho(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;i(d)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),r?l.jsx(VZ,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});UZ.displayName=AE;var VZ=f.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:s,...r}=e,i=Zf("SelectScrollButton",n),o=f.useRef(null),a=E3(n),c=f.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return f.useEffect(()=>()=>c(),[c]),ho(()=>{var d;const u=a().find(h=>h.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[a]),l.jsx(Ln.div,{"aria-hidden":!0,...r,ref:t,style:{flexShrink:0,...r.style},onPointerDown:qt(r.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(s,50))}),onPointerMove:qt(r.onPointerMove,()=>{var u;(u=i.onItemLeave)==null||u.call(i),o.current===null&&(o.current=window.setInterval(s,50))}),onPointerLeave:qt(r.onPointerLeave,()=>{c()})})}),Z8e="SelectSeparator",e7e=f.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return l.jsx(Ln.div,{"aria-hidden":!0,...s,ref:t})});e7e.displayName=Z8e;var WZ="SelectArrow",t7e=f.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,r=A3(n);return Zf(WZ,n).position==="popper"?l.jsx(b3,{...r,...s,ref:t}):null});t7e.displayName=WZ;var GZ="SelectBubbleInput",KZ=f.forwardRef(({__scopeSelect:e,...t},n)=>{const s=Jf(GZ,e),{value:r,onValueChange:i,required:o,disabled:a,name:c,autoComplete:u,form:d}=s,{nativeOptions:h,nativeSelectKey:m}=s,p=f.useRef(null),g=us(n,p),b=r??"",v=l3(b),x=Array.from(h).some(y=>(y.props.value??"")==="");return f.useEffect(()=>{const y=p.current;if(!y)return;const w=window.HTMLSelectElement.prototype,T=Object.getOwnPropertyDescriptor(w,"value").set;if(v!==b&&T){const S=new Event("change",{bubbles:!0});T.call(y,b),y.dispatchEvent(S)}},[v,b]),l.jsxs(Ln.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:u,disabled:a,form:d,onChange:y=>i(y.target.value),...t,style:{...ZX,...t.style},ref:g,defaultValue:b,children:[N3(r)&&!x?l.jsx("option",{value:""}):null,Array.from(h)]},m)});KZ.displayName=GZ;function n7e(e){return typeof e=="function"}function N3(e){return e===""||e===void 0}function YZ(e){const t=Sl(e),n=f.useRef(""),s=f.useRef(0),r=f.useCallback(o=>{const a=n.current+o;t(a),function c(u){n.current=u,window.clearTimeout(s.current),u!==""&&(s.current=window.setTimeout(()=>c(""),1e3))}(a)},[t]),i=f.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return f.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,r,i]}function XZ(e,t,n){const r=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=s7e(e,Math.max(i,0));r.length===1&&(o=o.filter(u=>u!==n));const c=o.find(u=>u.textValue.toLowerCase().startsWith(r.toLowerCase()));return c!==n?c:void 0}function s7e(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var r7e="Separator",a$="horizontal",i7e=["horizontal","vertical"],QZ=f.forwardRef((e,t)=>{const{decorative:n,orientation:s=a$,...r}=e,i=o7e(s)?s:a$,a=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return l.jsx(Ln.div,{"data-orientation":i,...a,...r,ref:t})});QZ.displayName=r7e;function o7e(e){return i7e.includes(e)}var a7e=QZ,j3="Switch",[l7e,zwt]=Go(j3),[c7e,dM]=l7e(j3);function u7e(e){const{__scopeSwitch:t,checked:n,children:s,defaultChecked:r,disabled:i,form:o,name:a,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:h}=e,[m,p]=ga({prop:n,defaultProp:r??!1,onChange:c,caller:j3}),[g,b]=f.useState(null),[v,x]=f.useState(null),y=f.useRef(!1),w=g?!!o||!!g.closest("form"):!0,k={checked:m,setChecked:p,disabled:i,control:g,setControl:b,name:a,form:o,value:d,hasConsumerStoppedPropagationRef:y,required:u,defaultChecked:r,isFormControl:w,bubbleInput:v,setBubbleInput:x};return l.jsx(c7e,{scope:t,...k,children:d7e(h)?h(k):s})}var JZ="SwitchTrigger",ZZ=f.forwardRef(({__scopeSwitch:e,onClick:t,...n},s)=>{const{control:r,form:i,value:o,disabled:a,checked:c,required:u,setControl:d,setChecked:h,hasConsumerStoppedPropagationRef:m,isFormControl:p,bubbleInput:g}=dM(JZ,e),b=us(s,d),v=f.useRef(c);return f.useEffect(()=>{const x=i?r==null?void 0:r.ownerDocument.getElementById(i):r==null?void 0:r.form;if(x instanceof HTMLFormElement){const y=()=>h(v.current);return x.addEventListener("reset",y),()=>x.removeEventListener("reset",y)}},[r,i,h]),l.jsx(Ln.button,{type:"button",role:"switch","aria-checked":c,"aria-required":u,"data-state":iee(c),"data-disabled":a?"":void 0,disabled:a,value:o,...n,ref:b,onClick:qt(t,x=>{h(y=>!y),g&&p&&(m.current=x.isPropagationStopped(),m.current||x.stopPropagation())})})});ZZ.displayName=JZ;var eee=f.forwardRef((e,t)=>{const{__scopeSwitch:n,name:s,checked:r,defaultChecked:i,required:o,disabled:a,value:c,onCheckedChange:u,form:d,...h}=e;return l.jsx(u7e,{__scopeSwitch:n,checked:r,defaultChecked:i,disabled:a,required:o,onCheckedChange:u,name:s,form:d,value:c,internal_do_not_use_render:({isFormControl:m})=>l.jsxs(l.Fragment,{children:[l.jsx(ZZ,{...h,ref:t,__scopeSwitch:n}),m&&l.jsx(ree,{__scopeSwitch:n})]})})});eee.displayName=j3;var tee="SwitchThumb",nee=f.forwardRef((e,t)=>{const{__scopeSwitch:n,...s}=e,r=dM(tee,n);return l.jsx(Ln.span,{"data-state":iee(r.checked),"data-disabled":r.disabled?"":void 0,...s,ref:t})});nee.displayName=tee;var see="SwitchBubbleInput",ree=f.forwardRef(({__scopeSwitch:e,...t},n)=>{const{control:s,hasConsumerStoppedPropagationRef:r,checked:i,defaultChecked:o,required:a,disabled:c,name:u,value:d,form:h,bubbleInput:m,setBubbleInput:p}=dM(see,e),g=us(n,p),b=l3(i),v=c3(s);f.useEffect(()=>{const y=m;if(!y)return;const w=window.HTMLInputElement.prototype,T=Object.getOwnPropertyDescriptor(w,"checked").set,S=!r.current;if(b!==i&&T){const C=new Event("click",{bubbles:S});T.call(y,i),y.dispatchEvent(C)}},[m,b,i,r]);const x=f.useRef(i);return l.jsx(Ln.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??x.current,required:a,disabled:c,name:u,value:d,form:h,...t,tabIndex:-1,ref:g,style:{...t.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});ree.displayName=see;function d7e(e){return typeof e=="function"}function iee(e){return e?"checked":"unchecked"}var M3="Tabs",[h7e,Fwt]=Go(M3,[Yf]),oee=Yf(),[f7e,hM]=h7e(M3),aee=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:r,defaultValue:i,orientation:o="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=j1(a),[h,m]=ga({prop:s,onChange:r,defaultProp:i??"",caller:M3});return l.jsx(f7e,{scope:n,baseId:qa(),value:h,onValueChange:m,orientation:o,dir:d,activationMode:c,children:l.jsx(Ln.div,{dir:d,"data-orientation":o,...u,ref:t})})});aee.displayName=M3;var lee="TabsList",cee=f.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...r}=e,i=hM(lee,n),o=oee(n);return l.jsx(y3,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:s,children:l.jsx(Ln.div,{role:"tablist","aria-orientation":i.orientation,...r,ref:t})})});cee.displayName=lee;var uee="TabsTrigger",dee=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:r=!1,...i}=e,o=hM(uee,n),a=oee(n),c=mee(o.baseId,s),u=pee(o.baseId,s),d=s===o.value;return l.jsx(x3,{asChild:!0,...a,focusable:!r,active:d,children:l.jsx(Ln.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:c,...i,ref:t,onMouseDown:qt(e.onMouseDown,h=>{!r&&h.button===0&&h.ctrlKey===!1?o.onValueChange(s):h.preventDefault()}),onKeyDown:qt(e.onKeyDown,h=>{r||h.target!==h.currentTarget||[" ","Enter"].includes(h.key)&&o.onValueChange(s)}),onFocus:qt(e.onFocus,()=>{const h=o.activationMode!=="manual";!d&&!r&&h&&o.onValueChange(s)})})})});dee.displayName=uee;var hee="TabsContent",fee=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:r,children:i,...o}=e,a=hM(hee,n),c=mee(a.baseId,s),u=pee(a.baseId,s),d=s===a.value,h=f.useRef(d);return f.useEffect(()=>{const m=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(m)},[]),l.jsx(Ko,{present:r||d,children:({present:m})=>l.jsx(Ln.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:u,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:m&&i})})});fee.displayName=hee;function mee(e,t){return`${e}-trigger-${t}`}function pee(e,t){return`${e}-content-${t}`}var m7e=aee,p7e=cee,g7e=dee,b7e=fee,gee="Toggle",bee=f.forwardRef((e,t)=>{const{pressed:n,defaultPressed:s,onPressedChange:r,...i}=e,[o,a]=ga({prop:n,onChange:r,defaultProp:s??!1,caller:gee});return l.jsx(Ln.button,{type:"button","aria-pressed":o,"data-state":o?"on":"off","data-disabled":e.disabled?"":void 0,...i,ref:t,onClick:qt(e.onClick,()=>{e.disabled||a(!o)})})});bee.displayName=gee;var em="ToggleGroup",[yee,qwt]=Go(em,[Yf]),xee=Yf(),fM=f.forwardRef((e,t)=>{const{type:n,...s}=e;if(n==="single"){const r=s;return l.jsx(y7e,{role:"radiogroup",...r,ref:t})}if(n==="multiple"){const r=s;return l.jsx(x7e,{role:"toolbar",...r,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${em}\``)});fM.displayName=em;var[vee,wee]=yee(em),y7e=f.forwardRef((e,t)=>{const{value:n,defaultValue:s,onValueChange:r=()=>{},...i}=e,[o,a]=ga({prop:n,defaultProp:s??"",onChange:r,caller:em});return l.jsx(vee,{scope:e.__scopeToggleGroup,type:"single",value:f.useMemo(()=>o?[o]:[],[o]),onItemActivate:a,onItemDeactivate:f.useCallback(()=>a(""),[a]),children:l.jsx(kee,{...i,ref:t})})}),x7e=f.forwardRef((e,t)=>{const{value:n,defaultValue:s,onValueChange:r=()=>{},...i}=e,[o,a]=ga({prop:n,defaultProp:s??[],onChange:r,caller:em}),c=f.useCallback(d=>a((h=[])=>[...h,d]),[a]),u=f.useCallback(d=>a((h=[])=>h.filter(m=>m!==d)),[a]);return l.jsx(vee,{scope:e.__scopeToggleGroup,type:"multiple",value:o,onItemActivate:c,onItemDeactivate:u,children:l.jsx(kee,{...i,ref:t})})});fM.displayName=em;var[v7e,w7e]=yee(em),kee=f.forwardRef((e,t)=>{const{__scopeToggleGroup:n,disabled:s=!1,rovingFocus:r=!0,orientation:i,dir:o,loop:a=!0,...c}=e,u=xee(n),d=j1(o),h={dir:d,...c};return l.jsx(v7e,{scope:n,rovingFocus:r,disabled:s,children:r?l.jsx(y3,{asChild:!0,...u,orientation:i,dir:d,loop:a,children:l.jsx(Ln.div,{...h,ref:t})}):l.jsx(Ln.div,{...h,ref:t})})}),gS="ToggleGroupItem",_ee=f.forwardRef((e,t)=>{const n=wee(gS,e.__scopeToggleGroup),s=w7e(gS,e.__scopeToggleGroup),r=xee(e.__scopeToggleGroup),i=n.value.includes(e.value),o=s.disabled||e.disabled,a={...e,pressed:i,disabled:o},c=f.useRef(null);return s.rovingFocus?l.jsx(x3,{asChild:!0,...r,focusable:!o,active:i,ref:c,children:l.jsx(l$,{...a,ref:t})}):l.jsx(l$,{...a,ref:t})});_ee.displayName=gS;var l$=f.forwardRef((e,t)=>{const{__scopeToggleGroup:n,value:s,...r}=e,i=wee(gS,n),o={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},a=i.type==="single"?o:void 0;return l.jsx(bee,{...a,...r,ref:t,onPressedChange:c=>{c?i.onItemActivate(s):i.onItemDeactivate(s)}})}),[I3,Hwt]=Go("Tooltip",[Kf]),R3=Kf(),See="TooltipProvider",k7e=700,NE="tooltip.open",[_7e,mM]=I3(See),Cee=e=>{const{__scopeTooltip:t,delayDuration:n=k7e,skipDelayDuration:s=300,disableHoverableContent:r=!1,children:i}=e,o=f.useRef(!0),a=f.useRef(!1),c=f.useRef(0);return f.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),l.jsx(_7e,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:f.useCallback(()=>{s<=0||(window.clearTimeout(c.current),o.current=!1)},[s]),onClose:f.useCallback(()=>{s<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,s))},[s]),isPointerInTransitRef:a,onPointerInTransitChange:f.useCallback(u=>{a.current=u},[]),disableHoverableContent:r,children:i})};Cee.displayName=See;var Tx="Tooltip",[S7e,Iv]=I3(Tx),Tee=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:r,onOpenChange:i,disableHoverableContent:o,delayDuration:a}=e,c=mM(Tx,e.__scopeTooltip),u=R3(t),[d,h]=f.useState(null),m=qa(),p=f.useRef(0),g=o??c.disableHoverableContent,b=a??c.delayDuration,v=f.useRef(!1),[x,y]=ga({prop:s,defaultProp:r??!1,onChange:C=>{C?(c.onOpen(),document.dispatchEvent(new CustomEvent(NE))):c.onClose(),i==null||i(C)},caller:Tx}),w=f.useMemo(()=>x?v.current?"delayed-open":"instant-open":"closed",[x]),k=f.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v.current=!1,y(!0)},[y]),T=f.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y(!1)},[y]),S=f.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{v.current=!0,y(!0),p.current=0},b)},[b,y]);return f.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),l.jsx(Cv,{...u,children:l.jsx(S7e,{scope:t,contentId:m,open:x,stateAttribute:w,trigger:d,onTriggerChange:h,onTriggerEnter:f.useCallback(()=>{c.isOpenDelayedRef.current?S():k()},[c.isOpenDelayedRef,S,k]),onTriggerLeave:f.useCallback(()=>{g?T():(window.clearTimeout(p.current),p.current=0)},[T,g]),onOpen:k,onClose:T,disableHoverableContent:g,children:n})})};Tee.displayName=Tx;var jE="TooltipTrigger",Eee=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,r=Iv(jE,n),i=mM(jE,n),o=R3(n),a=f.useRef(null),c=us(t,a,r.onTriggerChange),u=f.useRef(!1),d=f.useRef(!1),h=f.useCallback(()=>u.current=!1,[]);return f.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),l.jsx(Tv,{asChild:!0,...o,children:l.jsx(Ln.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...s,ref:c,onPointerMove:qt(e.onPointerMove,m=>{m.pointerType!=="touch"&&!d.current&&!i.isPointerInTransitRef.current&&(r.onTriggerEnter(),d.current=!0)}),onPointerLeave:qt(e.onPointerLeave,()=>{r.onTriggerLeave(),d.current=!1}),onPointerDown:qt(e.onPointerDown,()=>{r.open&&r.onClose(),u.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:qt(e.onFocus,()=>{u.current||r.onOpen()}),onBlur:qt(e.onBlur,r.onClose),onClick:qt(e.onClick,r.onClose)})})});Eee.displayName=jE;var pM="TooltipPortal",[C7e,T7e]=I3(pM,{forceMount:void 0}),Aee=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:r}=e,i=Iv(pM,t);return l.jsx(C7e,{scope:t,forceMount:n,children:l.jsx(Ko,{present:n||i.open,children:l.jsx(I1,{asChild:!0,container:r,children:s})})})};Aee.displayName=pM;var Vg="TooltipContent",Nee=f.forwardRef((e,t)=>{const n=T7e(Vg,e.__scopeTooltip),{forceMount:s=n.forceMount,side:r="top",...i}=e,o=Iv(Vg,e.__scopeTooltip);return l.jsx(Ko,{present:s||o.open,children:o.disableHoverableContent?l.jsx(jee,{side:r,...i,ref:t}):l.jsx(E7e,{side:r,...i,ref:t})})}),E7e=f.forwardRef((e,t)=>{const n=Iv(Vg,e.__scopeTooltip),s=mM(Vg,e.__scopeTooltip),r=f.useRef(null),i=us(t,r),[o,a]=f.useState(null),{trigger:c,onClose:u}=n,d=r.current,{onPointerInTransitChange:h}=s,m=f.useCallback(()=>{a(null),h(!1)},[h]),p=f.useCallback((g,b)=>{const v=g.currentTarget,x={x:g.clientX,y:g.clientY},y=M7e(x,v.getBoundingClientRect()),w=I7e(x,y),k=R7e(b.getBoundingClientRect()),T=L7e([...w,...k]);a(T),h(!0)},[h]);return f.useEffect(()=>()=>m(),[m]),f.useEffect(()=>{if(c&&d){const g=v=>p(v,d),b=v=>p(v,c);return c.addEventListener("pointerleave",g),d.addEventListener("pointerleave",b),()=>{c.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",b)}}},[c,d,p,m]),f.useEffect(()=>{if(o){const g=b=>{const v=b.target,x={x:b.clientX,y:b.clientY},y=(c==null?void 0:c.contains(v))||(d==null?void 0:d.contains(v)),w=!D7e(x,o);y?m():w&&(m(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,d,o,u,m]),l.jsx(jee,{...e,ref:i})}),[A7e,N7e]=I3(Tx,{isInside:!1}),j7e=f3e("TooltipContent"),jee=f.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":r,onEscapeKeyDown:i,onPointerDownOutside:o,...a}=e,c=Iv(Vg,n),u=R3(n),{onClose:d}=c;return f.useEffect(()=>(document.addEventListener(NE,d),()=>document.removeEventListener(NE,d)),[d]),f.useEffect(()=>{if(c.trigger){const h=m=>{m.target instanceof Node&&m.target.contains(c.trigger)&&d()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,d]),l.jsx(M1,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:d,children:l.jsxs(g3,{"data-state":c.stateAttribute,...u,...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:[l.jsx(j7e,{children:s}),l.jsx(A7e,{scope:n,isInside:!0,children:l.jsx(S3e,{id:c.contentId,role:"tooltip",children:r||s})})]})})});Nee.displayName=Vg;var Mee="TooltipArrow",Iee=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,r=R3(n);return N7e(Mee,n).isInside?null:l.jsx(b3,{...r,...s,ref:t})});Iee.displayName=Mee;function M7e(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 I7e(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 R7e(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 D7e(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],c=t[o],u=a.x,d=a.y,h=c.x,m=c.y;d>s!=m>s&&n<(h-u)*(s-d)/(m-d)+u&&(r=!r)}return r}function L7e(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),P7e(t)}function P7e(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 Ree=Cee,Dee=Tee,Lee=Eee,Pee=Aee,Oee=Nee,O7e=Iee;const B7e=(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},$7e=(e,t)=>({classGroupId:e,validator:t}),Bee=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),bS="-",c$=[],z7e="arbitrary..",F7e=e=>{const t=H7e(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return q7e(o);const a=o.split(bS),c=a[0]===""&&a.length>1?1:0;return $ee(a,c,t)},getConflictingClassGroupIds:(o,a)=>{if(a){const c=s[o],u=n[o];return c?u?B7e(u,c):c:u||c$}return n[o]||c$}}},$ee=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const r=e[t],i=n.nextPart.get(r);if(i){const u=$ee(e,t+1,i);if(u)return u}const o=n.validators;if(o===null)return;const a=t===0?e.join(bS):e.slice(t).join(bS),c=o.length;for(let u=0;u<c;u++){const d=o[u];if(d.validator(a))return d.classGroupId}},q7e=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?z7e+s:void 0})(),H7e=e=>{const{theme:t,classGroups:n}=e;return U7e(n,t)},U7e=(e,t)=>{const n=Bee();for(const s in e){const r=e[s];gM(r,n,s,t)}return n},gM=(e,t,n,s)=>{const r=e.length;for(let i=0;i<r;i++){const o=e[i];V7e(o,t,n,s)}},V7e=(e,t,n,s)=>{if(typeof e=="string"){W7e(e,t,n);return}if(typeof e=="function"){G7e(e,t,n,s);return}K7e(e,t,n,s)},W7e=(e,t,n)=>{const s=e===""?t:zee(t,e);s.classGroupId=n},G7e=(e,t,n,s)=>{if(Y7e(e)){gM(e(s),t,n,s);return}t.validators===null&&(t.validators=[]),t.validators.push($7e(n,e))},K7e=(e,t,n,s)=>{const r=Object.entries(e),i=r.length;for(let o=0;o<i;o++){const[a,c]=r[o];gM(c,zee(t,a),n,s)}},zee=(e,t)=>{let n=e;const s=t.split(bS),r=s.length;for(let i=0;i<r;i++){const o=s[i];let a=n.nextPart.get(o);a||(a=Bee(),n.nextPart.set(o,a)),n=a}return n},Y7e=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,X7e=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)}}},ME="!",u$=":",Q7e=[],d$=(e,t,n,s,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:s,isExternal:r}),J7e=e=>{const{prefix:t,experimentalParseClassName:n}=e;let s=r=>{const i=[];let o=0,a=0,c=0,u;const d=r.length;for(let b=0;b<d;b++){const v=r[b];if(o===0&&a===0){if(v===u$){i.push(r.slice(c,b)),c=b+1;continue}if(v==="/"){u=b;continue}}v==="["?o++:v==="]"?o--:v==="("?a++:v===")"&&a--}const h=i.length===0?r:r.slice(c);let m=h,p=!1;h.endsWith(ME)?(m=h.slice(0,-1),p=!0):h.startsWith(ME)&&(m=h.slice(1),p=!0);const g=u&&u>c?u-c:void 0;return d$(i,p,m,g)};if(t){const r=t+u$,i=s;s=o=>o.startsWith(r)?i(o.slice(r.length)):d$(Q7e,!1,o,void 0,!0)}if(n){const r=s;s=i=>n({className:i,parseClassName:r})}return s},Z7e=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]==="[",c=t.has(o);a||c?(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}},eEe=e=>({cache:X7e(e.cacheSize),parseClassName:J7e(e),sortModifiers:Z7e(e),postfixLookupClassGroupIds:tEe(e),...F7e(e)}),tEe=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},nEe=/\s+/,sEe=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:r,sortModifiers:i,postfixLookupClassGroupIds:o}=t,a=[],c=e.trim().split(nEe);let u="";for(let d=c.length-1;d>=0;d-=1){const h=c[d],{isExternal:m,modifiers:p,hasImportantModifier:g,baseClassName:b,maybePostfixModifierPosition:v}=n(h);if(m){u=h+(u.length>0?" "+u:u);continue}let x=!!v,y;if(x){const C=b.substring(0,v);y=s(C);const _=y&&o[y]?s(b):void 0;_&&_!==y&&(y=_,x=!1)}else y=s(b);if(!y){if(!x){u=h+(u.length>0?" "+u:u);continue}if(y=s(b),!y){u=h+(u.length>0?" "+u:u);continue}x=!1}const w=p.length===0?"":p.length===1?p[0]:i(p).join(":"),k=g?w+ME:w,T=k+y;if(a.indexOf(T)>-1)continue;a.push(T);const S=r(y,x);for(let C=0;C<S.length;++C){const _=S[C];a.push(k+_)}u=h+(u.length>0?" "+u:u)}return u},rEe=(...e)=>{let t=0,n,s,r="";for(;t<e.length;)(n=e[t++])&&(s=Fee(n))&&(r&&(r+=" "),r+=s);return r},Fee=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=Fee(e[s]))&&(n&&(n+=" "),n+=t);return n},iEe=(e,...t)=>{let n,s,r,i;const o=c=>{const u=t.reduce((d,h)=>h(d),e());return n=eEe(u),s=n.cache.get,r=n.cache.set,i=a,a(c)},a=c=>{const u=s(c);if(u)return u;const d=sEe(c,n);return r(c,d),d};return i=o,(...c)=>i(rEe(...c))},oEe=[],Bi=e=>{const t=n=>n[e]||oEe;return t.isThemeGetter=!0,t},qee=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Hee=/^\((?:(\w[\w-]*):)?(.+)\)$/i,aEe=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,lEe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,cEe=/\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$/,uEe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,dEe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,hEe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,xh=e=>aEe.test(e),ws=e=>!!e&&!Number.isNaN(Number(e)),Yc=e=>!!e&&Number.isInteger(Number(e)),WT=e=>e.endsWith("%")&&ws(e.slice(0,-1)),Zu=e=>lEe.test(e),Uee=()=>!0,fEe=e=>cEe.test(e)&&!uEe.test(e),bM=()=>!1,mEe=e=>dEe.test(e),pEe=e=>hEe.test(e),gEe=e=>!gn(e)&&!vn(e),bEe=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)),yEe=e=>tm(e,Gee,bM),gn=e=>qee.test(e),wm=e=>tm(e,Kee,fEe),h$=e=>tm(e,TEe,ws),xEe=e=>tm(e,Xee,Uee),vEe=e=>tm(e,Yee,bM),f$=e=>tm(e,Vee,bM),wEe=e=>tm(e,Wee,pEe),pk=e=>tm(e,Qee,mEe),vn=e=>Hee.test(e),Mb=e=>Fp(e,Kee),kEe=e=>Fp(e,Yee),m$=e=>Fp(e,Vee),_Ee=e=>Fp(e,Gee),SEe=e=>Fp(e,Wee),gk=e=>Fp(e,Qee,!0),CEe=e=>Fp(e,Xee,!0),tm=(e,t,n)=>{const s=qee.exec(e);return s?s[1]?t(s[1]):n(s[2]):!1},Fp=(e,t,n=!1)=>{const s=Hee.exec(e);return s?s[1]?t(s[1]):n:!1},Vee=e=>e==="position"||e==="percentage",Wee=e=>e==="image"||e==="url",Gee=e=>e==="length"||e==="size"||e==="bg-size",Kee=e=>e==="length",TEe=e=>e==="number",Yee=e=>e==="family-name",Xee=e=>e==="number"||e==="weight",Qee=e=>e==="shadow",EEe=()=>{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"),c=Bi("spacing"),u=Bi("radius"),d=Bi("shadow"),h=Bi("inset-shadow"),m=Bi("text-shadow"),p=Bi("drop-shadow"),g=Bi("blur"),b=Bi("perspective"),v=Bi("aspect"),x=Bi("ease"),y=Bi("animate"),w=()=>["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(),vn,gn],S=()=>["auto","hidden","clip","visible","scroll"],C=()=>["auto","contain","none"],_=()=>[vn,gn,c],B=()=>[xh,"full","auto",..._()],A=()=>[Yc,"none","subgrid",vn,gn],N=()=>["auto",{span:["full",Yc,vn,gn]},Yc,vn,gn],j=()=>[Yc,"auto",vn,gn],P=()=>["auto","min","max","fr",vn,gn],L=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],O=()=>["start","end","center","stretch","center-safe","end-safe"],$=()=>["auto",..._()],z=()=>[xh,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",..._()],F=()=>[xh,"screen","full","dvw","lvw","svw","min","max","fit",..._()],G=()=>[xh,"screen","full","lh","dvh","lvh","svh","min","max","fit",..._()],I=()=>[e,vn,gn],Q=()=>[...k(),m$,f$,{position:[vn,gn]}],V=()=>["no-repeat",{repeat:["","x","y","space","round"]}],M=()=>["auto","cover","contain",_Ee,yEe,{size:[vn,gn]}],re=()=>[WT,Mb,wm],se=()=>["","none","full",u,vn,gn],X=()=>["",ws,Mb,wm],J=()=>["solid","dashed","dotted","double"],de=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],W=()=>[ws,WT,m$,f$],te=()=>["","none",g,vn,gn],U=()=>["none",ws,vn,gn],ee=()=>["none",ws,vn,gn],oe=()=>[ws,vn,gn],Ce=()=>[xh,"full",..._()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Zu],breakpoint:[Zu],color:[Uee],container:[Zu],"drop-shadow":[Zu],ease:["in","out","in-out"],font:[gEe],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Zu],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Zu],shadow:[Zu],spacing:["px",ws],text:[Zu],"text-shadow":[Zu],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",xh,gn,vn,v]}],container:["container"],"container-type":[{"@container":["","normal","size",vn,gn]}],"container-named":[bEe],columns:[{columns:[ws,gn,vn,a]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"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:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:B()}],"inset-x":[{"inset-x":B()}],"inset-y":[{"inset-y":B()}],start:[{"inset-s":B(),start:B()}],end:[{"inset-e":B(),end:B()}],"inset-bs":[{"inset-bs":B()}],"inset-be":[{"inset-be":B()}],top:[{top:B()}],right:[{right:B()}],bottom:[{bottom:B()}],left:[{left:B()}],visibility:["visible","invisible","collapse"],z:[{z:[Yc,"auto",vn,gn]}],basis:[{basis:[xh,"full","auto",a,..._()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ws,xh,"auto","initial","none",gn]}],grow:[{grow:["",ws,vn,gn]}],shrink:[{shrink:["",ws,vn,gn]}],order:[{order:[Yc,"first","last","none",vn,gn]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:N()}],"col-start":[{"col-start":j()}],"col-end":[{"col-end":j()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:N()}],"row-start":[{"row-start":j()}],"row-end":[{"row-end":j()}],"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:[...L(),"normal"]}],"justify-items":[{"justify-items":[...O(),"normal"]}],"justify-self":[{"justify-self":["auto",...O()]}],"align-content":[{content:["normal",...L()]}],"align-items":[{items:[...O(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...O(),{baseline:["","last"]}]}],"place-content":[{"place-content":L()}],"place-items":[{"place-items":[...O(),"baseline"]}],"place-self":[{"place-self":["auto",...O()]}],p:[{p:_()}],px:[{px:_()}],py:[{py:_()}],ps:[{ps:_()}],pe:[{pe:_()}],pbs:[{pbs:_()}],pbe:[{pbe:_()}],pt:[{pt:_()}],pr:[{pr:_()}],pb:[{pb:_()}],pl:[{pl:_()}],m:[{m:$()}],mx:[{mx:$()}],my:[{my:$()}],ms:[{ms:$()}],me:[{me:$()}],mbs:[{mbs:$()}],mbe:[{mbe:$()}],mt:[{mt:$()}],mr:[{mr:$()}],mb:[{mb:$()}],ml:[{ml:$()}],"space-x":[{"space-x":_()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":_()}],"space-y-reverse":["space-y-reverse"],size:[{size:z()}],"inline-size":[{inline:["auto",...F()]}],"min-inline-size":[{"min-inline":["auto",...F()]}],"max-inline-size":[{"max-inline":["none",...F()]}],"block-size":[{block:["auto",...G()]}],"min-block-size":[{"min-block":["auto",...G()]}],"max-block-size":[{"max-block":["none",...G()]}],w:[{w:[a,"screen",...z()]}],"min-w":[{"min-w":[a,"screen","none",...z()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...z()]}],h:[{h:["screen","lh",...z()]}],"min-h":[{"min-h":["screen","lh","none",...z()]}],"max-h":[{"max-h":["screen","lh",...z()]}],"font-size":[{text:["base",n,Mb,wm]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,CEe,xEe]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",WT,gn]}],"font-family":[{font:[kEe,vEe,t]}],"font-features":[{"font-features":[gn]}],"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,vn,gn]}],"line-clamp":[{"line-clamp":[ws,"none",vn,h$]}],leading:[{leading:[i,..._()]}],"list-image":[{"list-image":["none",vn,gn]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",vn,gn]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...J(),"wavy"]}],"text-decoration-thickness":[{decoration:[ws,"from-font","auto",vn,wm]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[ws,"auto",vn,gn]}],"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:[Yc,vn,gn]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",vn,gn]}],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",vn,gn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Q()}],"bg-repeat":[{bg:V()}],"bg-size":[{bg:M()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Yc,vn,gn],radial:["",vn,gn],conic:[Yc,vn,gn]},SEe,wEe]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:se()}],"rounded-s":[{"rounded-s":se()}],"rounded-e":[{"rounded-e":se()}],"rounded-t":[{"rounded-t":se()}],"rounded-r":[{"rounded-r":se()}],"rounded-b":[{"rounded-b":se()}],"rounded-l":[{"rounded-l":se()}],"rounded-ss":[{"rounded-ss":se()}],"rounded-se":[{"rounded-se":se()}],"rounded-ee":[{"rounded-ee":se()}],"rounded-es":[{"rounded-es":se()}],"rounded-tl":[{"rounded-tl":se()}],"rounded-tr":[{"rounded-tr":se()}],"rounded-br":[{"rounded-br":se()}],"rounded-bl":[{"rounded-bl":se()}],"border-w":[{border:X()}],"border-w-x":[{"border-x":X()}],"border-w-y":[{"border-y":X()}],"border-w-s":[{"border-s":X()}],"border-w-e":[{"border-e":X()}],"border-w-bs":[{"border-bs":X()}],"border-w-be":[{"border-be":X()}],"border-w-t":[{"border-t":X()}],"border-w-r":[{"border-r":X()}],"border-w-b":[{"border-b":X()}],"border-w-l":[{"border-l":X()}],"divide-x":[{"divide-x":X()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":X()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...J(),"hidden","none"]}],"divide-style":[{divide:[...J(),"hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...J(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ws,vn,gn]}],"outline-w":[{outline:["",ws,Mb,wm]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",d,gk,pk]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",h,gk,pk]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:X()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[ws,wm]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":X()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",m,gk,pk]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[ws,vn,gn]}],"mix-blend":[{"mix-blend":[...de(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":de()}],"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":[ws]}],"mask-image-linear-from-pos":[{"mask-linear-from":W()}],"mask-image-linear-to-pos":[{"mask-linear-to":W()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":W()}],"mask-image-t-to-pos":[{"mask-t-to":W()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":W()}],"mask-image-r-to-pos":[{"mask-r-to":W()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":W()}],"mask-image-b-to-pos":[{"mask-b-to":W()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":W()}],"mask-image-l-to-pos":[{"mask-l-to":W()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":W()}],"mask-image-x-to-pos":[{"mask-x-to":W()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":W()}],"mask-image-y-to-pos":[{"mask-y-to":W()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[vn,gn]}],"mask-image-radial-from-pos":[{"mask-radial-from":W()}],"mask-image-radial-to-pos":[{"mask-radial-to":W()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"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":[ws]}],"mask-image-conic-from-pos":[{"mask-conic-from":W()}],"mask-image-conic-to-pos":[{"mask-conic-to":W()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Q()}],"mask-repeat":[{mask:V()}],"mask-size":[{mask:M()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",vn,gn]}],filter:[{filter:["","none",vn,gn]}],blur:[{blur:te()}],brightness:[{brightness:[ws,vn,gn]}],contrast:[{contrast:[ws,vn,gn]}],"drop-shadow":[{"drop-shadow":["","none",p,gk,pk]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",ws,vn,gn]}],"hue-rotate":[{"hue-rotate":[ws,vn,gn]}],invert:[{invert:["",ws,vn,gn]}],saturate:[{saturate:[ws,vn,gn]}],sepia:[{sepia:["",ws,vn,gn]}],"backdrop-filter":[{"backdrop-filter":["","none",vn,gn]}],"backdrop-blur":[{"backdrop-blur":te()}],"backdrop-brightness":[{"backdrop-brightness":[ws,vn,gn]}],"backdrop-contrast":[{"backdrop-contrast":[ws,vn,gn]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ws,vn,gn]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ws,vn,gn]}],"backdrop-invert":[{"backdrop-invert":["",ws,vn,gn]}],"backdrop-opacity":[{"backdrop-opacity":[ws,vn,gn]}],"backdrop-saturate":[{"backdrop-saturate":[ws,vn,gn]}],"backdrop-sepia":[{"backdrop-sepia":["",ws,vn,gn]}],"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",vn,gn]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ws,"initial",vn,gn]}],ease:[{ease:["linear","initial",x,vn,gn]}],delay:[{delay:[ws,vn,gn]}],animate:[{animate:["none",y,vn,gn]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,vn,gn]}],"perspective-origin":[{"perspective-origin":T()}],rotate:[{rotate:U()}],"rotate-x":[{"rotate-x":U()}],"rotate-y":[{"rotate-y":U()}],"rotate-z":[{"rotate-z":U()}],scale:[{scale:ee()}],"scale-x":[{"scale-x":ee()}],"scale-y":[{"scale-y":ee()}],"scale-z":[{"scale-z":ee()}],"scale-3d":["scale-3d"],skew:[{skew:oe()}],"skew-x":[{"skew-x":oe()}],"skew-y":[{"skew-y":oe()}],transform:[{transform:[vn,gn,"","none","gpu","cpu"]}],"transform-origin":[{origin:T()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ce()}],"translate-x":[{"translate-x":Ce()}],"translate-y":[{"translate-y":Ce()}],"translate-z":[{"translate-z":Ce()}],"translate-none":["translate-none"],zoom:[{zoom:[Yc,vn,gn]}],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"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",vn,gn]}],"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":I()}],"scrollbar-track-color":[{"scrollbar-track":I()}],"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",vn,gn]}],fill:[{fill:["none",...I()]}],"stroke-w":[{stroke:[ws,Mb,wm,h$]}],stroke:[{stroke:["none",...I()]}],"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"]}},AEe=iEe(EEe);function Kt(...e){return AEe(XX(e))}const NEe=Bp("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"}}),qn=f.forwardRef(function({className:t,variant:n="default",size:s="default",asChild:r=!1,...i},o){const a=r?Mj:"button";return l.jsx(a,{ref:o,"data-slot":"button","data-variant":n,"data-size":s,className:Kt(NEe({variant:n,size:s,className:t})),...i})}),p$=f.forwardRef(function({className:t,...n},s){return l.jsx(RQ,{ref:s,"data-slot":"checkbox",className:Kt("peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 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 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",t),...n,children:l.jsx(LQ,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:l.jsx(RG,{})})})});function Wg({...e}){return l.jsx(Dj,{"data-slot":"dialog",...e})}function jEe({container:e,...t}){const n=Yd();return l.jsx(Pj,{"data-slot":"dialog-portal",container:e??n??void 0,...t})}function IE({...e}){return l.jsx(R1,{"data-slot":"dialog-close",...e})}const MEe=f.forwardRef(function({className:t,...n},s){return l.jsx(Oj,{ref:s,"data-slot":"dialog-overlay",className:Kt("fixed inset-0 isolate z-[var(--web-shell-dialog-backdrop-z-index,50)] bg-black/10 duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",t),...n})}),Gg=f.forwardRef(function({className:t,children:n,showCloseButton:s=!0,overlayProps:r,...i},o){return l.jsxs(jEe,{children:[l.jsx(MEe,{...r}),l.jsxs(Bj,{ref:o,"data-slot":"dialog-content",className:Kt("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&&l.jsx(R1,{"data-slot":"dialog-close",asChild:!0,children:l.jsxs(qn,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm",children:[l.jsx(MN,{}),l.jsx("span",{className:"sr-only",children:"Close"})]})})]})]})});function Kg({className:e,...t}){return l.jsx("div",{"data-slot":"dialog-header",className:Kt("flex flex-col gap-2",e),...t})}function Yg({className:e,showCloseButton:t=!1,children:n,...s}){return l.jsxs("div",{"data-slot":"dialog-footer",className:Kt("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",e),...s,children:[n,t&&l.jsx(R1,{asChild:!0,children:l.jsx(qn,{variant:"outline",children:"Close"})})]})}function Xg({className:e,...t}){return l.jsx($j,{"data-slot":"dialog-title",className:Kt("text-base leading-none font-medium",e),...t})}function Ex({className:e,...t}){return l.jsx(zj,{"data-slot":"dialog-description",className:Kt("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}const li=f.forwardRef(function({className:t,type:n,...s},r){return l.jsx("input",{ref:r,type:n,"data-slot":"input",className:Kt("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 RE({className:e,...t}){return l.jsx(o8e,{"data-slot":"label",className:Kt("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 Ax({...e}){return l.jsx(g8e,{"data-slot":"popover",...e})}const yS=f.forwardRef(function(t,n){return l.jsx(y8e,{ref:n,"data-slot":"popover-trigger",...t})}),Nx=f.forwardRef(function({className:t,align:n="center",sideOffset:s=4,...r},i){const o=Yd();return l.jsx(x8e,{container:o??void 0,children:l.jsx(v8e,{ref:i,"data-slot":"popover-content",align:n,sideOffset:s,className:Kt("z-[var(--web-shell-popover-z-index,1000)] flex w-72 origin-(--radix-popover-content-transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden 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",t),...r})})}),g$=f.forwardRef(function(t,n){return l.jsx(b8e,{ref:n,"data-slot":"popover-anchor",...t})});function IEe({className:e,...t}){return l.jsx("div",{"data-slot":"popover-header",className:Kt("flex flex-col gap-0.5 text-sm",e),...t})}function REe({className:e,...t}){return l.jsx("div",{"data-slot":"popover-title",className:Kt("font-medium",e),...t})}function Af({...e}){return l.jsx(wZ,{"data-slot":"select",...e})}function yM({className:e,...t}){return l.jsx(PZ,{"data-slot":"select-group",className:Kt("scroll-my-1 p-1",e),...t})}function Nf({...e}){return l.jsx(CZ,{"data-slot":"select-value",...e})}const jf=f.forwardRef(function({className:t,size:n="default",children:s,...r},i){return l.jsxs(_Z,{ref:i,"data-slot":"select-trigger","data-size":n,className:Kt("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,l.jsx(TZ,{asChild:!0,children:l.jsx(zl,{className:"pointer-events-none size-4 text-muted-foreground"})})]})});function Mf({className:e,children:t,position:n="item-aligned",align:s="center",...r}){const i=Yd();return l.jsx(AZ,{container:i??void 0,children:l.jsxs(NZ,{"data-slot":"select-content","data-align-trigger":n==="item-aligned",className:Kt("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:[l.jsx(DEe,{}),l.jsx(DZ,{"data-position":n,className:Kt("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}),l.jsx(LEe,{})]})})}function vl({className:e,children:t,...n}){return l.jsxs($Z,{"data-slot":"select-item",className:Kt("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:[l.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center",children:l.jsx(qZ,{children:l.jsx(RG,{className:"pointer-events-none"})})}),l.jsx(zZ,{children:t})]})}function DEe({className:e,...t}){return l.jsx(HZ,{"data-slot":"select-scroll-up-button",className:Kt("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:l.jsx(qme,{})})}function LEe({className:e,...t}){return l.jsx(UZ,{"data-slot":"select-scroll-down-button",className:Kt("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:l.jsx(zl,{})})}const PEe="_tableShell_ysf4j_1",OEe="_densityCompact_ysf4j_11",BEe="_densityStandard_ysf4j_21",$Ee="_densityComfortable_ysf4j_29",zEe="_toolbar_ysf4j_37",FEe="_summary_ysf4j_48",qEe="_hint_ysf4j_53",HEe="_selection_ysf4j_57",UEe="_selectionStats_ysf4j_62",VEe="_selectionMetric_ysf4j_70",WEe="_selectionMetricValue_ysf4j_74",GEe="_copyButton_ysf4j_80",KEe="_copyCheck_ysf4j_90",YEe="_scroller_ysf4j_98",XEe="_table_ysf4j_1",QEe="_headerCell_ysf4j_120",JEe="_cell_ysf4j_121",ZEe="_frozenHeaderCell_ysf4j_144",eAe="_headerControls_ysf4j_149",tAe="_headerButton_ysf4j_155",nAe="_filterTrigger_ysf4j_172",sAe="_headerText_ysf4j_176",rAe="_sortIcon_ysf4j_183",iAe="_activeHeaderCell_ysf4j_199",oAe="_reorderHandle_ysf4j_203",aAe="_reorderHandleVisible_ysf4j_226",lAe="_resizeHandle_ysf4j_246",cAe="_filterTriggerActive_ysf4j_265",uAe="_columnContextMenu_ysf4j_270",dAe="_columnContextMenuAction_ysf4j_283",hAe="_cellContent_ysf4j_315",fAe="_detailValueContent_ysf4j_316",mAe="_cellText_ysf4j_322",pAe="_detailValueText_ysf4j_323",gAe="_cellContentCollapsed_ysf4j_329",bAe="_detailValueCollapsed_ysf4j_330",yAe="_dragging_ysf4j_337",xAe="_evenRow_ysf4j_341",vAe="_selectedCell_ysf4j_349",wAe="_actionHeaderCell_ysf4j_356",kAe="_actionCell_ysf4j_357",_Ae="_stickyActionHeaderCell_ysf4j_365",SAe="_stickyActionCell_ysf4j_366",CAe="_frozenCell_ysf4j_382",TAe="_hasFrozenColumn_ysf4j_388",EAe="_rowDetailButton_ysf4j_435",AAe="_detailRow_ysf4j_450",NAe="_detailCell_ysf4j_454",jAe="_detailPanel_ysf4j_461",MAe="_detailTitle_ysf4j_467",IAe="_detailItem_ysf4j_472",RAe="_detailLabel_ysf4j_479",DAe="_detailValue_ysf4j_316",LAe="_emptyValue_ysf4j_494",PAe="_emptyState_ysf4j_499",Qt={tableShell:PEe,densityCompact:OEe,densityStandard:BEe,densityComfortable:$Ee,toolbar:zEe,summary:FEe,hint:qEe,selection:HEe,selectionStats:UEe,selectionMetric:VEe,selectionMetricValue:WEe,copyButton:GEe,copyCheck:KEe,scroller:YEe,table:XEe,headerCell:QEe,cell:JEe,frozenHeaderCell:ZEe,headerControls:eAe,headerButton:tAe,filterTrigger:nAe,headerText:sAe,sortIcon:rAe,activeHeaderCell:iAe,reorderHandle:oAe,reorderHandleVisible:aAe,resizeHandle:lAe,filterTriggerActive:cAe,columnContextMenu:uAe,columnContextMenuAction:dAe,cellContent:hAe,detailValueContent:fAe,cellText:mAe,detailValueText:pAe,cellContentCollapsed:gAe,detailValueCollapsed:bAe,dragging:yAe,evenRow:xAe,selectedCell:vAe,actionHeaderCell:wAe,actionCell:kAe,stickyActionHeaderCell:_Ae,stickyActionCell:SAe,frozenCell:CAe,hasFrozenColumn:TAe,rowDetailButton:EAe,detailRow:AAe,detailCell:NAe,detailPanel:jAe,detailTitle:MAe,detailItem:IAe,detailLabel:RAe,detailValue:DAe,emptyValue:LAe,emptyState:PAe},OAe={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"},BAe={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"},$Ae=500,zAe=50,df=160,Jee=80,Zee=640,b$=16,ete="application/x-qwen-web-shell-table-column",FAe=60,qAe=3,GT=["standard","compact","comfortable"],HAe={width:df,minWidth:df,maxWidth:df},UAe={width:"auto"};function y$(e){return Math.min(Zee,Math.max(Jee,e))}function KT(e){return e instanceof Element&&!!e.closest('a, button, input, textarea, select, [contenteditable="true"]')}function VAe(){const e=document.getSelection();return!!(e&&!e.isCollapsed)}function Vm(e,t){return f.isValidElement(e)&&e.type===t}function WAe(e){return e.replace(/\s+/g," ").trim()}function YT(e){return e.length>FAe||e.split(/\r\n|\r|\n/).length>qAe}function GAe(e){const t=GT.indexOf(e);return GT[(t+1)%GT.length]??"standard"}function KAe(e){switch(e){case"compact":return Qt.densityCompact;case"comfortable":return Qt.densityComfortable;case"standard":default:return Qt.densityStandard}}function DE(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(DE).join(""):f.isValidElement(e)?e.type==="img"?e.props.alt??"":DE(e.props.children):""}function YAe(e,t){return{key:`${e}-empty-${t}`,content:"",text:"",rawText:"",isHeader:!1}}function tte(e,t){const n=f.Children.toArray(e.props.children).filter(s=>Vm(s,"td")||Vm(s,"th"));return{key:t,cells:n.map((s,r)=>{var o;const i=DE(s.props.children);return{key:`${t}-${r}`,content:s.props.children,text:WAe(i),rawText:i,isHeader:s.type==="th",textAlign:(o=s.props.style)==null?void 0:o.textAlign}})}}function XT(e,t){return f.Children.toArray(e.props.children).filter(n=>Vm(n,"tr")).map((n,s)=>tte(n,`${t}-${s}`))}function XAe(e,t){return{...e,cells:Array.from({length:t},(n,s)=>e.cells[s]??YAe(e.key,s))}}function QAe(e,t){const n=f.Children.toArray(e),s=[],r=[],i=[];if(n.forEach((d,h)=>{Vm(d,"thead")?s.push(...XT(d,`head-${h}`)):Vm(d,"tbody")?r.push(...XT(d,`body-${h}`)):Vm(d,"tfoot")?r.push(...XT(d,`foot-${h}`)):Vm(d,"tr")&&i.push(tte(d,`row-${h}`))}),i.length>0){const[d,...h]=i;d!=null&&d.cells.some(m=>m.isHeader)?(s.push(d),r.push(...h)):r.push(...i)}const o=[...s,...r],a=Math.max(0,...o.map(d=>d.cells.length)),c=s[0];return{headers:Array.from({length:a},(d,h)=>{const m=c==null?void 0:c.cells[h];if(m)return m;const p=t(h);return{key:`header-${h}`,content:p,text:p,rawText:p,isHeader:!0}}),rows:r.map(d=>XAe(d,a)),columnCount:a}}function Ed(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 nte(e,t){const n=Ed(e),s=Ed(t);return n!==null&&s!==null&&n!==s?n-s:e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}function xS(e){return{minRow:Math.min(e.anchorRow,e.focusRow),maxRow:Math.max(e.anchorRow,e.focusRow)}}function xM(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 vS(e){const t=e.replace(/[\u200B-\u200D\u2060\u00AD\uFEFF]/g,"").trimStart();return/^[=+\-@]/.test(t)?`'${e}`:e}function LE(e){return((e==null?void 0:e.rawText)??(e==null?void 0:e.text)??"").replace(/[\r\n\t]+/g," ")}function QT(e){return e.rawText||e.text}function x$(e,t,n){if((e[t]??df)===n)return e;if(n===df){const r={...e};return delete r[t],r}return{...e,[t]:n}}function v$(e,t,n){if(!e)return"";const{minRow:s,maxRow:r}=xS(e),i=xM(e,n);if(i.length===0)return"";const o=[];for(let a=s;a<=r;a++){const c=t[a];c&&o.push(i.map(u=>vS(LE(c.cells[u]))).join("	"))}return o.join(`
`)}function JAe(e,t,n){return n.length===0?"":[n.map(r=>vS(LE(e[r]))).join("	"),...t.map(r=>n.map(i=>vS(LE(r.cells[i]))).join("	"))].join(`
`)}function ZAe(e,t,n){if(!e)return null;const{minRow:s,maxRow:r}=xS(e),i=xM(e,n);if(i.length===0)return null;let o=0,a=0,c=0,u=0,d=1/0,h=-1/0,m=!0,p=!0,g;for(let v=s;v<=r;v++){const x=t[v];x&&i.forEach(y=>{const w=x.cells[y];if(!w)return;o+=1;const k=w.text.trim();if(!k)return;a+=1;const T=Ed(k);if(T===null)return;c+=1,u+=T,d=Math.min(d,T),h=Math.max(h,T),m=m&&k.endsWith("%");const S=k.match(/[$€£¥₹]/g),C=(S==null?void 0:S.length)===1?S[0]:void 0;C?g===void 0?g=C:g!==C&&(p=!1):p=!1})}if(o===0)return null;const b=c>0&&m?"percent":c>0&&p&&g?"currency":"number";return{selectedCount:o,nonEmptyCount:a,numericCount:c,sum:u,average:c>0?u/c:0,min:c>0?d:0,max:c>0?h:0,format:b,currencySymbol:g}}function bk(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 w$(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 e9e(e,t,n,s){if(s.size===0)return w$(e,t,n);const r=e.filter(a=>!s.has(a)),i=w$(r,t,n);if(i===r)return e;let o=0;return e.map(a=>{if(s.has(a))return a;const c=i[o];return o+=1,c??a})}function k$(e){return Array.from({length:e},(t,n)=>n)}function _$(e){return Array.from(e.types).includes(ete)}function By(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 t9e(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 n9e(e,t){if(!(t!=null&&t.value.trim()))return!0;const n=Ed(e),s=Ed(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=Ed(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 s9e(e,t){return t.selectedValues!==void 0&&!t.selectedValues.includes(e)?!1:t9e(e,t.textFilter)&&n9e(e,t.numberFilter)}function S$(e,t,n){const s=Object.entries(t).map(([r,i])=>[Number(r),i]).filter(([r,i])=>r!==n&&By(i));return s.length===0?e:e.filter(r=>s.every(([i,o])=>{var a;return s9e(((a=r.cells[i])==null?void 0:a.text)??"",o)}))}function r9e(e,t){return t?e.map((n,s)=>({row:n,index:s})).sort((n,s)=>{var o,a;const r=nte(((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 i9e(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)=>nte(r.value,i.value))}function o9e(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,Ed(i)!==null&&(s+=1))}),n>0&&s/n>=.7}function a9e(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(s=>n.has(s))}function l9e(e,t){var s,r,i;const n={};if(e.selectedValues!==void 0&&!a9e(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();Ed(o)!==null&&(e.numberFilter.operator!=="between"||Ed(a??"")!==null)&&(n.numberFilter={operator:e.numberFilter.operator,value:o,valueTo:a})}return By(n)?n:void 0}function c9e({columnIndex:e,sortedThisColumn:t,onSort:n}){const{t:s}=ut();return l.jsxs("div",{className:"flex flex-col gap-1.5 border-b px-2.5 py-2",children:[l.jsx(qn,{variant:"ghost",size:"sm",className:`w-full justify-start text-xs ${(t==null?void 0:t.direction)==="asc"?"bg-muted text-primary":""}`,type:"button",onClick:()=>n(e,"asc"),children:s("markdownTable.sort.asc")}),l.jsx(qn,{variant:"ghost",size:"sm",className:`w-full justify-start text-xs ${(t==null?void 0:t.direction)==="desc"?"bg-muted text-primary":""}`,type:"button",onClick:()=>n(e,"desc"),children:s("markdownTable.sort.desc")}),l.jsx(qn,{variant:"ghost",size:"sm",className:"w-full justify-start text-xs",type:"button",onClick:()=>n(e,null),children:s("markdownTable.sort.clear")})]})}function u9e({onHideColumn:e}){const{t}=ut();return l.jsx("div",{className:"flex flex-col gap-1.5 border-b px-2.5 py-2",children:l.jsx(qn,{variant:"ghost",size:"sm",className:"w-full justify-start text-xs",type:"button",onClick:e,children:t("markdownTable.hideColumn")})})}function d9e({columnIndex:e,columnName:t,search:n,searchInputRef:s,filteredOptions:r,visibleOptions:i,selectedValues:o,allFilteredSelected:a,onSearchChange:c,onFilteredSelectionChange:u,onToggleValue:d}){const{t:h}=ut();return l.jsxs("div",{className:"flex flex-col gap-1.5 border-b px-2.5 py-2",children:[l.jsx(li,{ref:s,className:"h-7 text-xs",value:n,onChange:m=>c(m.currentTarget.value),placeholder:h("markdownTable.filter.searchPlaceholder"),name:`markdown-table-option-search-${e}`,"aria-label":h("markdownTable.filter.searchAria",{column:t})}),l.jsxs(RE,{htmlFor:`markdown-table-filter-all-${e}`,className:"min-h-7 cursor-pointer gap-2 px-1.5 py-1 text-xs font-normal hover:bg-muted",children:[l.jsx(p$,{id:`markdown-table-filter-all-${e}`,name:`markdown-table-filter-all-${e}`,"data-name":`markdown-table-filter-all-${e}`,checked:a,onCheckedChange:m=>u(m===!0)}),l.jsx("span",{children:h("markdownTable.filter.selectVisible")}),l.jsx("span",{className:"ml-auto text-muted-foreground tabular-nums",children:r.length})]}),l.jsxs("div",{className:"max-h-[170px] overflow-auto rounded-md border bg-muted/50",children:[i.map((m,p)=>l.jsxs(RE,{htmlFor:`markdown-table-filter-option-${e}-${p}`,className:"min-h-7 cursor-pointer gap-2 px-1.5 py-1 text-xs font-normal hover:bg-muted",children:[l.jsx(p$,{id:`markdown-table-filter-option-${e}-${p}`,name:`markdown-table-filter-option-${e}-${p}`,"data-name":`markdown-table-filter-option-${e}-${p}`,checked:o.has(m.value),onCheckedChange:()=>d(m.value)}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:m.label}),l.jsx("span",{className:"ml-auto text-muted-foreground tabular-nums",children:m.count})]},m.value)),r.length>i.length&&l.jsx("div",{className:"p-2 text-center text-muted-foreground",children:h("markdownTable.filter.optionLimit",{count:i.length})}),r.length===0&&l.jsx("div",{className:"p-2 text-center text-muted-foreground",children:h("markdownTable.filter.noOptions")})]})]})}function h9e({overlayId:e,columnIndex:t,columnName:n,isNumeric:s,textOperator:r,textValue:i,numberOperator:o,numberValue:a,numberValueTo:c,onTextOperatorChange:u,onTextValueChange:d,onNumberOperatorChange:h,onNumberValueChange:m,onNumberValueToChange:p}){const{t:g}=ut();return l.jsxs("div",{className:"flex flex-col gap-1.5 border-b px-2.5 py-2",children:[l.jsx("div",{className:"font-semibold text-muted-foreground",children:g("markdownTable.filter.custom")}),s?l.jsxs(l.Fragment,{children:[l.jsxs(Af,{value:o,name:`markdown-table-number-operator-${t}`,onValueChange:b=>h(b),children:[l.jsx(jf,{size:"sm",className:"w-full text-xs","data-name":`markdown-table-number-operator-${t}`,"aria-label":g("markdownTable.filter.numberAria",{column:n}),children:l.jsx(Nf,{})}),l.jsx(Mf,{"data-markdown-table-filter-owner":e,className:"z-[calc(var(--web-shell-popover-z-index,1000)+1)]",children:Object.entries(BAe).map(([b,v])=>l.jsx(vl,{value:b,"data-value":b,className:"text-xs",children:g(v)},b))})]}),l.jsxs("div",{className:"flex gap-1.5",children:[l.jsx(li,{className:"h-7 text-xs",value:a,onChange:b=>m(b.currentTarget.value),placeholder:g("markdownTable.filter.numberPlaceholder"),name:`markdown-table-number-filter-${t}`}),o==="between"&&l.jsx(li,{className:"h-7 text-xs",value:c,onChange:b=>p(b.currentTarget.value),placeholder:g("markdownTable.filter.toPlaceholder"),name:`markdown-table-number-filter-to-${t}`})]})]}):l.jsxs(l.Fragment,{children:[l.jsxs(Af,{value:r,name:`markdown-table-text-operator-${t}`,onValueChange:b=>u(b),children:[l.jsx(jf,{size:"sm",className:"w-full text-xs","data-name":`markdown-table-text-operator-${t}`,"aria-label":g("markdownTable.filter.textAria",{column:n}),children:l.jsx(Nf,{})}),l.jsx(Mf,{"data-markdown-table-filter-owner":e,className:"z-[calc(var(--web-shell-popover-z-index,1000)+1)]",children:Object.entries(OAe).map(([b,v])=>l.jsx(vl,{value:b,"data-value":b,className:"text-xs",children:g(v)},b))})]}),l.jsx(li,{className:"h-7 text-xs",value:i,onChange:b=>d(b.currentTarget.value),placeholder:g("markdownTable.filter.textPlaceholder"),name:`markdown-table-text-filter-${t}`})]})]})}function f9e({onClear:e,onClose:t,onApply:n}){const{t:s}=ut();return l.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-2",children:[l.jsx(qn,{variant:"outline",size:"sm",type:"button",onClick:e,children:s("markdownTable.filter.reset")}),l.jsx("span",{className:"flex-1"}),l.jsx(qn,{variant:"outline",size:"sm",type:"button",onClick:t,children:s("markdownTable.filter.cancel")}),l.jsx(qn,{size:"sm",type:"button",onClick:n,children:s("markdownTable.filter.confirm")})]})}function m9e({id:e,columnName:t,columnIndex:n,filter:s,isNumeric:r,options:i,sort:o,canHideColumn:a,onApply:c,onClose:u,onHideColumn:d,onSort:h}){var I,Q,V,M,re;const m=f.useMemo(()=>i.map(se=>se.value),[i]),[p,g]=f.useState(""),[b,v]=f.useState(()=>new Set((s==null?void 0:s.selectedValues)??m)),[x,y]=f.useState(((I=s==null?void 0:s.textFilter)==null?void 0:I.operator)??"contains"),[w,k]=f.useState(((Q=s==null?void 0:s.textFilter)==null?void 0:Q.value)??""),[T,S]=f.useState(((V=s==null?void 0:s.numberFilter)==null?void 0:V.operator)??"gt"),[C,_]=f.useState(((M=s==null?void 0:s.numberFilter)==null?void 0:M.value)??""),[B,A]=f.useState(((re=s==null?void 0:s.numberFilter)==null?void 0:re.valueTo)??""),N=f.useRef(null);f.useEffect(()=>{var se;(se=N.current)==null||se.focus()},[]);const j=f.useMemo(()=>{const se=p.trim().toLowerCase();return se?i.filter(X=>X.label.toLowerCase().includes(se)):i},[i,p]),P=j.slice(0,500),L=j.length>0&&j.every(se=>b.has(se.value)),O=se=>{v(X=>{const J=new Set(X);return j.forEach(de=>{se?J.add(de.value):J.delete(de.value)}),J})},$=se=>{v(X=>{const J=new Set(X);return J.has(se)?J.delete(se):J.add(se),J})},z=()=>{c(n,l9e({selectedValues:Array.from(b),textFilter:{operator:x,value:w},numberFilter:{operator:T,value:C,valueTo:B}},m))},F=()=>{c(n,void 0)},G=(o==null?void 0:o.columnIndex)===n?o:null;return l.jsxs(Nx,{id:e,"data-markdown-table-filter-owner":e,align:"end",sideOffset:2,collisionPadding:6,onCloseAutoFocus:se=>{document.activeElement&&document.activeElement!==document.body&&se.preventDefault()},className:"max-h-[min(430px,calc(100vh-16px))] w-[300px] max-w-[80vw] gap-0 overflow-auto p-0 text-xs",role:"dialog","aria-labelledby":`${e}-title`,children:[l.jsx(IEe,{className:"border-b px-2.5 py-2",children:l.jsx(REe,{id:`${e}-title`,className:"truncate text-xs font-bold",children:t})}),l.jsx(c9e,{columnIndex:n,sortedThisColumn:G,onSort:h}),a&&l.jsx(u9e,{onHideColumn:()=>d(n)}),l.jsx(d9e,{columnIndex:n,columnName:t,search:p,searchInputRef:N,filteredOptions:j,visibleOptions:P,selectedValues:b,allFilteredSelected:L,onSearchChange:g,onFilteredSelectionChange:O,onToggleValue:$}),l.jsx(h9e,{overlayId:e,columnIndex:n,columnName:t,isNumeric:r,textOperator:x,textValue:w,numberOperator:T,numberValue:C,numberValueTo:B,onTextOperatorChange:y,onTextValueChange:k,onNumberOperatorChange:S,onNumberValueChange:_,onNumberValueToChange:A}),l.jsx(f9e,{onClear:F,onClose:u,onApply:z})]})}function p9e({children:e,fallback:t,toolbarExtra:n}){const{t:s}=ut(),r=f.useMemo(()=>QAe(e,i=>s("markdownTable.column",{index:i+1})),[e,s]);return r.columnCount===0?l.jsx(l.Fragment,{children:t??l.jsx("table",{children:e})}):r.rows.length>$Ae||r.columnCount>zAe?l.jsx(l.Fragment,{children:t??l.jsx("table",{children:e})}):l.jsx(g9e,{table:r,toolbarExtra:n})}function g9e({table:e,toolbarExtra:t}){const{language:n,t:s}=ut(),r=d3e(),i=f.useId(),[o,a]=f.useState(null),[c,u]=f.useState({}),[d,h]=f.useState(null),[m,p]=f.useState(null),[g,b]=f.useState(null),[v,x]=f.useState(()=>new Set),[y,w]=f.useState({}),[k,T]=f.useState(()=>k$(e.columnCount)),[S,C]=f.useState(null),[_,B]=f.useState(!1),[A,N]=f.useState(null),[j,P]=f.useState(null),[L,O]=f.useState(null),[$,z]=f.useState(!1),[F,G]=f.useState("standard"),[I,Q]=f.useState(!1),[V,M]=f.useState(!1),[re,se]=f.useState(!1),[X,J]=f.useState(!1),de=f.useRef(!1),W=f.useRef(null),te=f.useRef(null),U=f.useRef(null),ee=f.useRef(0),oe=f.useRef(0),Ce=f.useRef(0),he=f.useRef(!0),ye=f.useRef(null),Ve=f.useRef(null),it=f.useRef(null),At=f.useRef(null),Ee=f.useRef(null),me=f.useRef(null),bt=f.useRef(0),et=f.useRef(0),qe=f.useRef(null),Ke=f.useRef(null),ke=f.useMemo(()=>`${e.columnCount}\0${e.headers.map(pe=>pe.text).join("\0")}`,[e.columnCount,e.headers]),ne=f.useRef(ke),gt=f.useCallback(()=>{p(null)},[]),We=f.useCallback(()=>{ee.current+=1,W.current&&(clearTimeout(W.current),W.current=null),M(!1)},[]),tt=f.useCallback(()=>{oe.current+=1,te.current&&(clearTimeout(te.current),te.current=null),se(!1)},[]),jt=f.useCallback(()=>{Ce.current+=1,U.current&&(clearTimeout(U.current),U.current=null),J(!1)},[]),jn=f.useCallback(()=>{bt.current&&(cancelAnimationFrame(bt.current),bt.current=0);const pe=me.current;me.current=null,pe&&h(Ie=>Ie&&{...Ie,focusRow:pe.rowIndex,focusCol:pe.columnIndex})},[]),kn=f.useCallback(()=>{jn(),de.current=!1,Q(!1)},[jn]);f.useEffect(()=>{const pe=()=>{document.hidden&&kn()};return window.addEventListener("mouseup",kn),window.addEventListener("blur",kn),document.addEventListener("visibilitychange",pe),()=>{window.removeEventListener("mouseup",kn),window.removeEventListener("blur",kn),document.removeEventListener("visibilitychange",pe),bt.current&&cancelAnimationFrame(bt.current)}},[kn]),f.useEffect(()=>{ne.current!==ke&&(ne.current=ke,a(null),u({}),h(null),p(null),b(null),x(new Set),w({}),T(k$(e.columnCount)),C(null),B(!1),N(null),P(null),O(null),z(!1),G("standard"),We(),tt(),jt(),de.current=!1,Ke.current=null,Q(!1))},[tt,jt,We,e.columnCount,ke]),f.useEffect(()=>{tt()},[tt,d]),f.useEffect(()=>(he.current=!0,()=>{he.current=!1,W.current&&(clearTimeout(W.current),W.current=null),te.current&&(clearTimeout(te.current),te.current=null),U.current&&(clearTimeout(U.current),U.current=null)}),[]),f.useEffect(()=>{if(!m)return;const pe=`${i}-filter-${m.columnIndex}`,Ie=Xt=>{if(Xt.target instanceof Element){const Cn=Xt.target.closest("[data-markdown-table-filter-owner]");if((Cn==null?void 0:Cn.getAttribute("data-markdown-table-filter-owner"))===pe)return}p(null)},Ge=()=>p(null);return document.addEventListener("scroll",Ie,!0),window.addEventListener("resize",Ge),()=>{document.removeEventListener("scroll",Ie,!0),window.removeEventListener("resize",Ge)}},[m,i]),f.useEffect(()=>{if(!g)return;const pe=Xt=>{var Un;const Cn=Xt.target;(Un=it.current)!=null&&Un.contains(Cn)||b(null)},Ie=Xt=>{Xt.key==="Escape"&&(Xt.preventDefault(),b(null))},Ge=()=>b(null);return document.addEventListener("mousedown",pe),document.addEventListener("keydown",Ie),document.addEventListener("scroll",Ge,!0),window.addEventListener("resize",Ge),()=>{document.removeEventListener("mousedown",pe),document.removeEventListener("keydown",Ie),document.removeEventListener("scroll",Ge,!0),window.removeEventListener("resize",Ge)}},[g]),f.useEffect(()=>{const pe=Ge=>{var Cn,Un;const Xt=Ge.target;Xt instanceof Node&&!((Cn=ye.current)!=null&&Cn.contains(Xt))&&!((Un=it.current)!=null&&Un.contains(Xt))&&C(null)},Ie=Ge=>{Ge.defaultPrevented||m||L||g||Ge.key==="Escape"&&C(null)};return document.addEventListener("mousedown",pe),document.addEventListener("keydown",Ie),()=>{document.removeEventListener("mousedown",pe),document.removeEventListener("keydown",Ie)}},[L,g,m]);const Be=f.useMemo(()=>S$(e.rows,c),[c,e.rows]),ht=f.useMemo(()=>r9e(Be,o),[Be,o]);f.useEffect(()=>{h(pe=>pe&&(xS(pe).maxRow<ht.length?pe:null))},[ht.length]);const ve=f.useMemo(()=>{if(!m)return[];const pe=m.columnIndex;return i9e(S$(e.rows,c,pe),pe,s("markdownTable.blank"))},[c,m,s,e.rows]),Me=f.useMemo(()=>e.headers.map((pe,Ie)=>o9e(e.rows,Ie)),[e.headers,e.rows]),_e=f.useMemo(()=>k.filter(pe=>pe>=0&&pe<e.columnCount).filter(pe=>!v.has(pe)),[k,v,e.columnCount]),Xe=_?_e[0]:void 0,ue=f.useMemo(()=>{if(!L)return null;const pe=ht.find(Ie=>Ie.key===L.rowKey);return(pe==null?void 0:pe.cells[L.columnIndex])??null},[L,ht]),Fe=ue==null?void 0:ue.text;f.useEffect(()=>{We()},[We,_e,ht]),f.useEffect(()=>{if(!A)return;const pe=()=>{const Cn=qe.current;qe.current=null,et.current&&(cancelAnimationFrame(et.current),et.current=0),Cn!==null&&w(Un=>x$(Un,A.columnIndex,Cn))},Ie=Cn=>{qe.current=y$(A.startWidth+Cn.clientX-A.startX),!et.current&&(et.current=requestAnimationFrame(pe))},Ge=()=>{pe(),N(null)},Xt=()=>{document.hidden&&Ge()};return window.addEventListener("mousemove",Ie),window.addEventListener("mouseup",Ge),window.addEventListener("blur",Ge),document.addEventListener("visibilitychange",Xt),()=>{window.removeEventListener("mousemove",Ie),window.removeEventListener("mouseup",Ge),window.removeEventListener("blur",Ge),document.removeEventListener("visibilitychange",Xt),et.current&&(cancelAnimationFrame(et.current),et.current=0),qe.current=null}},[A]),f.useEffect(()=>{j&&!ht.some(pe=>pe.key===j)&&P(null),L&&!ht.some(pe=>pe.key===L.rowKey&&pe.cells[L.columnIndex])&&O(null)},[L,j,ht]),f.useEffect(()=>{if(L)return r()},[L,r]),f.useEffect(()=>{L&&jt()},[L,Fe,jt]),f.useEffect(()=>{if(L)return()=>{const pe=Ee.current;Ee.current=null,pe!=null&&pe.isConnected&&pe.focus()}},[L]);const kt=(pe,Ie)=>{h(null),u(Ge=>{const Xt={...Ge};return Ie&&By(Ie)?Xt[pe]=Ie:delete Xt[pe],Xt}),gt()},bn=(pe,Ie)=>{h(null),C(pe),a(Ie?{columnIndex:pe,direction:Ie}:null)},Pe=pe=>{h(null),C(pe),a(Ie=>(Ie==null?void 0:Ie.columnIndex)!==pe?{columnIndex:pe,direction:"asc"}:Ie.direction==="asc"?{columnIndex:pe,direction:"desc"}:null)},yn=(pe,Ie)=>{if(!Ie){p(Ge=>(Ge==null?void 0:Ge.columnIndex)===pe?null:Ge);return}h(null),C(pe),b(null),p({columnIndex:pe})},je=pe=>{_e.length<=1||(h(null),C(Ie=>Ie===pe?null:Ie),gt(),u(Ie=>{const Ge={...Ie};return delete Ge[pe],Ge}),a(Ie=>(Ie==null?void 0:Ie.columnIndex)===pe?null:Ie),x(Ie=>{const Ge=new Set(Ie);return Ge.add(pe),Ge}))},Ne=()=>{h(null),x(new Set)},ot=()=>{B(pe=>!pe),b(null)},pt=(pe,Ie)=>{if(Ie!==_e[0])return;pe.preventDefault(),h(null),C(Ie),p(null),b({left:Math.max(6,Math.min(pe.clientX,window.innerWidth-220-6)),top:Math.max(6,Math.min(pe.clientY,window.innerHeight-72-6))})},dn=()=>{G(pe=>GAe(pe))},De=pe=>{h(null),O(null),jt(),P(Ie=>Ie===pe?null:pe)},sn=(pe,Ie)=>{Ee.current=document.activeElement instanceof HTMLElement?document.activeElement:null,h(null),p(null),P(null),jt(),O({rowKey:pe,columnIndex:Ie})},Dn=()=>{O(null),jt()},os=()=>{if(Fe==null||!navigator.clipboard)return;const pe=Ce.current;navigator.clipboard.writeText(vS(Fe)).then(()=>{he.current&&Ce.current===pe&&(U.current&&clearTimeout(U.current),J(!0),U.current=setTimeout(()=>J(!1),2e3))}).catch(Ie=>console.warn("[web-shell] clipboard write failed:",Ie))},st=f.useMemo(()=>d?xS(d):null,[d]),St=f.useMemo(()=>new Set(xM(d,_e)),[d,_e]),Ht=(pe,Ie)=>{if(!st)return!1;const{minRow:Ge,maxRow:Xt}=st;return pe>=Ge&&pe<=Xt&&St.has(Ie)},Ot=(pe,Ie)=>{const Ge=y[pe];if(Ge===void 0){const Xt=F==="compact"?UAe:HAe;return Ie?{...Xt,...Ie}:Xt}return{width:Ge,minWidth:Ge,maxWidth:Ge,...Ie}},Yt=(pe,Ie)=>{pe.preventDefault(),pe.stopPropagation();const Ge=pe.currentTarget.closest("th"),Xt=Ge==null?void 0:Ge.getBoundingClientRect().width;N({columnIndex:Ie,startX:pe.clientX,startWidth:y[Ie]??(Xt?Math.round(Xt):df)})},Pn=(pe,Ie)=>{if(pe.ctrlKey||pe.metaKey||pe.altKey||pe.shiftKey)return;let Ge=0;if(pe.key==="ArrowRight"?Ge=b$:pe.key==="ArrowLeft"&&(Ge=-b$),Ge===0)return;pe.preventDefault(),pe.stopPropagation();const Xt=pe.currentTarget.closest("th"),Cn=Xt==null?void 0:Xt.getBoundingClientRect().width;w(Un=>{const xe=Un[Ie]??(Cn?Math.round(Cn):df),$e=y$(xe+Ge);return x$(Un,Ie,$e)})},Hn=(pe,Ie)=>{pe.stopPropagation(),C(Ie),Ke.current=Ie,pe.dataTransfer.effectAllowed="move",pe.dataTransfer.setData(ete,String(Ie))},as=()=>{Ke.current=null},Bs=pe=>{Ke.current===null||!_$(pe.dataTransfer)||(pe.preventDefault(),pe.dataTransfer.dropEffect="move")},fr=(pe,Ie)=>{const Ge=Ke.current;as(),!(Ge===null||!_$(pe.dataTransfer))&&(pe.preventDefault(),pe.stopPropagation(),h(null),C(Ge),T(Xt=>e9e(Xt,Ge,Ie,v)))},Gr=(pe,Ie)=>{m!==null&&p(null),C(null),de.current=!0,h({anchorRow:pe,anchorCol:Ie,focusRow:pe,focusCol:Ie})},rs=(pe,Ie,Ge)=>{var Xt;pe.button!==0||KT(pe.target)||(pe.preventDefault(),(Xt=Ve.current)==null||Xt.focus({preventScroll:!0}),Gr(Ie,Ge))},Vt=(pe,Ie)=>{de.current&&(Q(!0),me.current={rowIndex:pe,columnIndex:Ie},!bt.current&&(bt.current=requestAnimationFrame(()=>{bt.current=0;const Ge=me.current;me.current=null,Ge&&h(Xt=>Xt&&{...Xt,focusRow:Ge.rowIndex,focusCol:Ge.columnIndex})})))},Qn=pe=>{var Un;const Ie=document.elementFromPoint(pe.clientX,pe.clientY),Ge=Ie==null?void 0:Ie.closest("[data-row-index][data-column-index]");if(!Ge||!((Un=ye.current)!=null&&Un.contains(Ge)))return null;const Xt=Number(Ge.dataset.rowIndex),Cn=Number(Ge.dataset.columnIndex);return!Number.isInteger(Xt)||!Number.isInteger(Cn)?null:{rowIndex:Xt,columnIndex:Cn}},Rs=(pe,Ie,Ge)=>{pe.touches.length!==1||KT(pe.target)||Gr(Ie,Ge)},pr=pe=>{if(!de.current||pe.touches.length!==1)return;const Ie=pe.touches[0];if(!Ie)return;const Ge=Qn(Ie);Ge&&(pe.preventDefault(),Vt(Ge.rowIndex,Ge.columnIndex))},hs=()=>{const pe=v$(d,ht,_e);if(!pe||!navigator.clipboard)return;const Ie=oe.current;navigator.clipboard.writeText(pe).then(()=>{he.current&&oe.current===Ie&&(te.current&&clearTimeout(te.current),se(!0),te.current=setTimeout(()=>se(!1),2e3))}).catch(Ge=>console.warn("[web-shell] clipboard write failed:",Ge))},xr=()=>{const pe=JAe(e.headers,ht,_e);if(!pe||!navigator.clipboard)return;const Ie=ee.current;navigator.clipboard.writeText(pe).then(()=>{he.current&&ee.current===Ie&&(W.current&&clearTimeout(W.current),M(!0),W.current=setTimeout(()=>M(!1),2e3))}).catch(Ge=>console.warn("[web-shell] clipboard write failed:",Ge))},ci=pe=>{if(VAe())return;const Ie=v$(d,ht,_e);Ie&&(pe.preventDefault(),pe.clipboardData.setData("text/plain",Ie))},_s=f.useMemo(()=>ZAe(d,ht,_e),[_e,d,ht]),Vs=(_s==null?void 0:_s.selectedCount)??0,ls=Object.values(c).filter(By).length,Ws=s(`markdownTable.density.${F}`),Ss=f.useMemo(()=>ht.some(pe=>_e.some(Ie=>{const Ge=pe.cells[Ie];return Ge?YT(QT(Ge)):!1})),[_e,ht]),Xs=ht.length===e.rows.length?s("markdownTable.rows",{count:e.rows.length}):s("markdownTable.rowsFiltered",{visible:ht.length,total:e.rows.length}),Cr=(pe,Ie)=>{const Ge=QT(pe),Xt=YT(Ge);return l.jsx("div",{className:`${Qt.cellContent} ${Xt&&!Ie?Qt.cellContentCollapsed:""}`,title:Xt&&!Ie?Ge:void 0,children:l.jsx("div",{className:Qt.cellText,children:pe.content})})},Lr=(pe,Ie)=>{const Ge=pe.text.length===0,Xt=QT(pe),Cn=YT(Xt);return l.jsx("div",{className:`${Qt.detailValueContent} ${Cn&&!Ie?Qt.detailValueCollapsed:""} ${Ge?Qt.emptyValue:""}`,title:Cn&&!Ie?Xt:void 0,children:l.jsx("div",{className:Qt.detailValueText,children:Ge?s("markdownTable.emptyValue"):pe.content})})};return l.jsxs("div",{ref:ye,className:`${Qt.tableShell} ${KAe(F)} ${_?Qt.hasFrozenColumn:""} ${I?Qt.dragging:""}`,children:[l.jsxs("div",{className:Qt.toolbar,children:[l.jsx("span",{className:Qt.summary,children:Xs}),l.jsx("span",{className:Qt.hint,children:s("markdownTable.hint")}),l.jsx("button",{className:Qt.copyButton,type:"button",onClick:xr,children:V?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Qt.copyCheck,children:"✓"}),s("code.copied")]}):s("markdownTable.copyVisible")}),v.size>0&&l.jsx("button",{className:Qt.copyButton,type:"button",onClick:Ne,children:s("markdownTable.showHiddenColumns",{count:v.size})}),l.jsx("button",{className:Qt.copyButton,type:"button",onClick:dn,children:s("markdownTable.density",{density:Ws})}),Ss&&l.jsx("button",{className:Qt.copyButton,type:"button",onClick:()=>z(pe=>!pe),children:s($?"markdownTable.collapseLongText":"markdownTable.expandLongText")}),ls>0&&l.jsx("span",{className:Qt.selection,children:s("markdownTable.filtersActive",{count:ls})}),Vs>0&&l.jsxs(l.Fragment,{children:[_s&&l.jsxs("div",{className:Qt.selectionStats,children:[l.jsxs("span",{className:Qt.selectionMetric,children:[s("markdownTable.selection.selected")," ",l.jsx("strong",{className:Qt.selectionMetricValue,children:_s.selectedCount})]}),l.jsxs("span",{className:Qt.selectionMetric,children:[s("markdownTable.selection.nonEmpty")," ",l.jsx("strong",{className:Qt.selectionMetricValue,children:_s.nonEmptyCount})]}),l.jsxs("span",{className:Qt.selectionMetric,children:[s("markdownTable.selection.numeric")," ",l.jsx("strong",{className:Qt.selectionMetricValue,children:_s.numericCount})]}),_s.numericCount>0&&l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:Qt.selectionMetric,children:[s("markdownTable.selection.sum")," ",l.jsx("strong",{className:Qt.selectionMetricValue,children:bk(_s.sum,_s,n)})]}),l.jsxs("span",{className:Qt.selectionMetric,children:[s("markdownTable.selection.average")," ",l.jsx("strong",{className:Qt.selectionMetricValue,children:bk(_s.average,_s,n)})]}),l.jsxs("span",{className:Qt.selectionMetric,children:[s("markdownTable.selection.min")," ",l.jsx("strong",{className:Qt.selectionMetricValue,children:bk(_s.min,_s,n)})]}),l.jsxs("span",{className:Qt.selectionMetric,children:[s("markdownTable.selection.max")," ",l.jsx("strong",{className:Qt.selectionMetricValue,children:bk(_s.max,_s,n)})]})]})]}),l.jsx("button",{className:Qt.copyButton,type:"button",onClick:hs,children:re?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Qt.copyCheck,children:"✓"}),s("code.copied")]}):s("markdownTable.copyTsv")})]}),t]}),l.jsxs("div",{ref:Ve,className:Qt.scroller,tabIndex:0,onCopy:ci,children:[l.jsxs("table",{className:Qt.table,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{className:`${Qt.headerCell} ${Qt.actionHeaderCell} ${_?Qt.stickyActionHeaderCell:""}`,children:s("markdownTable.actions")}),_e.map(pe=>{const Ie=e.headers[pe];if(!Ie)return null;const Ge=(o==null?void 0:o.columnIndex)===pe,Xt=By(c[pe]),Cn=(m==null?void 0:m.columnIndex)===pe,Un=Ge?o.direction==="asc"?"↑":"↓":"↕",xe=Ie.text||s("markdownTable.column",{index:pe+1}),$e=Ge?s(o.direction==="asc"?"markdownTable.sortByColumnAsc":"markdownTable.sortByColumnDesc",{column:xe}):s("markdownTable.sortByColumn",{column:xe}),Lt=Ge?o.direction==="asc"?"ascending":"descending":"none",ln=`${i}-filter-${pe}`,Pt=Ie.textAlign?{textAlign:Ie.textAlign}:void 0,An=Xe===pe,Xn=S===pe;return l.jsxs("th",{className:`${Qt.headerCell} ${An?Qt.frozenHeaderCell:""} ${Xn?Qt.activeHeaderCell:""}`,"aria-sort":Lt,onContextMenu:Mn=>pt(Mn,pe),onDragOver:Bs,onDrop:Mn=>fr(Mn,pe),style:Ot(pe,Pt),title:xe,children:[l.jsxs("div",{className:Qt.headerControls,children:[l.jsxs("button",{className:Qt.headerButton,type:"button",onClick:()=>Pe(pe),"aria-label":$e,style:Pt,children:[l.jsx("span",{className:Qt.headerText,style:Pt,children:Ie.content}),l.jsx("span",{className:Qt.sortIcon,"aria-hidden":"true",children:Un})]}),l.jsx("button",{className:`${Qt.reorderHandle} ${Xn?Qt.reorderHandleVisible:""}`,type:"button",draggable:!0,tabIndex:Xn?0:-1,onDragStart:Mn=>Hn(Mn,pe),onDragEnd:as,"aria-label":s("markdownTable.moveColumn",{column:xe}),children:"⋮⋮"}),l.jsxs(Ax,{open:Cn,onOpenChange:Mn=>yn(pe,Mn),children:[l.jsx(yS,{asChild:!0,children:l.jsx("button",{className:`${Qt.filterTrigger} ${Xt?Qt.filterTriggerActive:""}`,type:"button","aria-label":s("markdownTable.filterColumn",{column:xe}),"aria-controls":Cn?ln:void 0,children:"▾"})}),Cn&&l.jsx(m9e,{id:ln,columnName:xe,columnIndex:pe,filter:c[pe],isNumeric:Me[pe]??!1,options:ve,sort:o,canHideColumn:_e.length>1,onApply:kt,onClose:gt,onHideColumn:je,onSort:bn},pe)]})]}),l.jsx("button",{className:Qt.resizeHandle,type:"button",onMouseDown:Mn=>Yt(Mn,pe),onKeyDown:Mn=>Pn(Mn,pe),role:"separator","aria-label":s("markdownTable.resizeColumn",{column:xe}),"aria-orientation":"vertical","aria-valuemin":Jee,"aria-valuemax":Zee,"aria-valuenow":y[pe]??df})]},Ie.key)})]})}),l.jsx("tbody",{children:ht.map((pe,Ie)=>{const Ge=j===pe.key,Xt=`${i}-detail-${pe.key}`;return l.jsxs(f.Fragment,{children:[l.jsxs("tr",{className:Ie%2===1?Qt.evenRow:void 0,children:[l.jsx("td",{className:`${Qt.cell} ${Qt.actionCell} ${_?Qt.stickyActionCell:""}`,children:l.jsx("button",{className:Qt.rowDetailButton,type:"button",onClick:()=>De(pe.key),"aria-expanded":Ge,"aria-controls":Xt,"aria-label":s(Ge?"markdownTable.closeRowDetailsAria":"markdownTable.rowDetailsAria",{index:Ie+1}),children:s("markdownTable.rowDetails")})}),_e.map(Cn=>{const Un=pe.cells[Cn];if(!Un)return null;const xe=Un.textAlign?{textAlign:Un.textAlign}:void 0,$e=Xe===Cn;return l.jsx("td",{className:`${Qt.cell} ${Ht(Ie,Cn)?Qt.selectedCell:""} ${$e?Qt.frozenCell:""}`,style:Ot(Cn,xe),"data-row-index":Ie,"data-column-index":Cn,onMouseDown:Lt=>rs(Lt,Ie,Cn),onMouseEnter:()=>Vt(Ie,Cn),onTouchStart:Lt=>Rs(Lt,Ie,Cn),onTouchMove:pr,onTouchEnd:kn,onTouchCancel:kn,onDoubleClick:Lt=>{KT(Lt.target)||sn(pe.key,Cn)},children:Cr(Un,$)},Un.key)})]}),Ge&&l.jsx("tr",{id:Xt,className:Qt.detailRow,children:l.jsx("td",{className:Qt.detailCell,colSpan:_e.length+1,children:l.jsxs("div",{className:Qt.detailPanel,children:[l.jsx("div",{className:Qt.detailTitle,children:s("markdownTable.detailsHeader")}),_e.map(Cn=>{const Un=e.headers[Cn],xe=pe.cells[Cn];return!Un||!xe?null:l.jsxs("div",{className:Qt.detailItem,children:[l.jsx("div",{className:Qt.detailLabel,title:Un.text,children:Un.content}),l.jsx("div",{className:Qt.detailValue,children:Lr(xe,$)})]},`${pe.key}-detail-${Cn}`)})]})})})]},pe.key)})})]}),ht.length===0&&l.jsx("div",{className:Qt.emptyState,children:e.rows.length===0?s("markdownTable.empty"):s("markdownTable.emptyFiltered")})]}),g&&_e.length>0&&l.jsx("div",{ref:it,className:Qt.columnContextMenu,style:{left:g.left,top:g.top},role:"menu",children:l.jsx("button",{className:Qt.columnContextMenuAction,type:"button",role:"menuitem",onClick:ot,children:s(_?"markdownTable.unfreezeFirstColumn":"markdownTable.freezeFirstColumn")})}),l.jsx(Wg,{open:L!==null&&ue!==null,onOpenChange:pe=>{pe||Dn()},children:ue&&l.jsxs(Gg,{ref:At,className:"sm:max-w-lg",showCloseButton:!1,overlayProps:{onMouseDown:Dn},onOpenAutoFocus:pe=>{var Ie;pe.preventDefault(),(Ie=At.current)==null||Ie.focus()},tabIndex:-1,children:[l.jsx(IE,{asChild:!0,children:l.jsxs(qn,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm","aria-label":s("markdownTable.close"),children:[l.jsx(MN,{}),l.jsx("span",{className:"sr-only",children:s("markdownTable.close")})]})}),l.jsx(Kg,{children:l.jsx(Xg,{children:s("markdownTable.cellDialogTitle")})}),l.jsx("div",{className:"max-h-[200px] min-h-[100px] cursor-text overflow-auto rounded-lg border bg-background/70 p-3 leading-relaxed font-semibold whitespace-pre-wrap break-words select-text",children:ue.content}),l.jsxs(Yg,{children:[l.jsx(qn,{variant:"outline",onClick:os,children:s(X?"code.copied":"markdownTable.copyCell")}),l.jsx(IE,{asChild:!0,children:l.jsx(qn,{children:s("markdownTable.close")})})]})]})})]})}const b9e="_content_1n6wo_1",y9e="_inlineCode_1n6wo_127",x9e="_link_1n6wo_139",v9e="_tableWrapper_1n6wo_149",w9e="_table_1n6wo_149",k9e="_image_1n6wo_179",_9e="_codeBlock_1n6wo_187",S9e="_codeBlockHeader_1n6wo_196",C9e="_codeBlockLang_1n6wo_205",T9e="_codeBlockCopy_1n6wo_213",E9e="_codeBlockContent_1n6wo_236",A9e="_codeBlockPlain_1n6wo_256",N9e="_mermaidBlock_1n6wo_274",j9e="_mermaidInline_1n6wo_286",M9e="_mermaidLoading_1n6wo_305",I9e="_mermaidActions_1n6wo_312",R9e="_mermaidZoomWrapper_1n6wo_317",D9e="_mermaidDragging_1n6wo_325",Ts={content:b9e,inlineCode:y9e,link:x9e,tableWrapper:v9e,table:w9e,image:k9e,codeBlock:_9e,codeBlockHeader:S9e,codeBlockLang:C9e,codeBlockCopy:T9e,codeBlockContent:E9e,codeBlockPlain:A9e,mermaidBlock:N9e,mermaidInline:j9e,mermaidLoading:M9e,mermaidActions:I9e,mermaidZoomWrapper:R9e,mermaidDragging:D9e},L9e=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"]),C$={"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 vM(e){const t=(e||"").toLowerCase(),n=Object.hasOwn(C$,t)?C$[t]:t,s=L9e.has(n)?n:"text";return{label:(e||"").trim()||"text",lang:n,resolvedLang:s}}const ste=/^(https?:|mailto:)/i,P9e=/^data:image\/(png|jpeg|gif|webp);base64,/i;function rte(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:ste.test(t):!1}function P1(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")||P9e.test(t)?!0:ste.test(t):!1}let T$,O9e=0;function B9e({code:e}){const{t}=ut(),n=w1(),[s,r]=f.useState(null),[i,o]=f.useState(null),[a,c]=f.useState("diagram"),[u,d]=f.useState(!1),[h,m]=f.useState(1),[p,g]=f.useState({x:0,y:0}),[b,v]=f.useState(!1),x=f.useRef(null),y=n==="light"?"default":"dark",w=.5,k=3,T=.25,S=()=>{m(N=>Math.min(k,Math.round((N+T)*100)/100))},C=()=>{m(N=>Math.max(w,Math.round((N-T)*100)/100))},_=f.useCallback(()=>{x.current=null,v(!1),m(1),g({x:0,y:0})},[]),B=f.useCallback(N=>{N.preventDefault(),v(!0),x.current={startX:N.clientX,startY:N.clientY,origX:p.x,origY:p.y}},[p]);f.useEffect(()=>{if(!b)return;const N=P=>{if(!x.current)return;const L=P.clientX-x.current.startX,O=P.clientY-x.current.startY,$=1500;g({x:x.current.origX+L,y:Math.max(-$,Math.min($,x.current.origY+O))})},j=()=>{x.current=null,v(!1)};return window.addEventListener("mousemove",N),window.addEventListener("mouseup",j),window.addEventListener("blur",j),()=>{window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",j),window.removeEventListener("blur",j)}},[b]),f.useEffect(()=>{m(1),g({x:0,y:0})},[e]),f.useEffect(()=>{let N=!1;r(null),o(null);const j=setTimeout(()=>{ie(()=>import("./mermaid.core-DJ05ZZIK.js").then(P=>P.bm),[]).then(async P=>{if(N)return;const L=P.default;T$!==y&&(L.initialize({startOnLoad:!1,theme:y,securityLevel:"strict",suppressErrorRendering:!0,flowchart:{wrappingWidth:300,useMaxWidth:!1}}),T$=y);try{const O=`mermaid-${++O9e}`,{svg:$}=await L.render(O,e.trim());N||r($)}catch(O){N||o(O instanceof Error?O.message:"Mermaid render failed")}})},150);return()=>{N=!0,clearTimeout(j)}},[e,y]);const A=()=>{navigator.clipboard.writeText(e).then(()=>{d(!0),setTimeout(()=>d(!1),2e3)},()=>{})};return i?l.jsxs("div",{className:Ts.codeBlock,children:[l.jsx("div",{className:Ts.codeBlockHeader,children:l.jsx("span",{className:Ts.codeBlockLang,children:t("mermaid.errorLabel")})}),l.jsx("pre",{className:`${Ts.codeBlockContent} ${Ts.codeBlockPlain}`,children:l.jsx("code",{children:e})})]}):l.jsxs("div",{className:Ts.codeBlock,children:[l.jsxs("div",{className:Ts.codeBlockHeader,children:[l.jsx("span",{className:Ts.codeBlockLang,children:t("mermaid.label")}),l.jsxs("span",{className:Ts.mermaidActions,children:[a==="diagram"&&l.jsxs(l.Fragment,{children:[l.jsx("button",{className:Ts.codeBlockCopy,onClick:C,title:t("mermaid.zoomOut"),disabled:h<=w,children:t("mermaid.zoomOut")}),l.jsx("button",{className:Ts.codeBlockCopy,onClick:_,title:t("mermaid.zoomReset"),disabled:h===1&&p.x===0&&p.y===0,children:t("mermaid.zoomReset")}),l.jsx("button",{className:Ts.codeBlockCopy,onClick:S,title:t("mermaid.zoomIn"),disabled:h>=k,children:t("mermaid.zoomIn")})]}),l.jsx("button",{className:Ts.codeBlockCopy,onClick:()=>c(a==="diagram"?"code":"diagram"),children:t(a==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),l.jsx("button",{className:Ts.codeBlockCopy,onClick:A,children:t(u?"code.copied":"code.copy")})]})]}),a==="code"?l.jsx("pre",{className:`${Ts.codeBlockContent} ${Ts.codeBlockPlain}`,children:l.jsx("code",{children:e})}):s?l.jsx("div",{className:`${Ts.mermaidZoomWrapper} ${b?Ts.mermaidDragging:""}`,onMouseDown:B,onDoubleClick:_,children:l.jsx("div",{className:`${Ts.mermaidBlock} ${Ts.mermaidInline}`,style:{transform:`translate(${p.x}px, ${p.y}px) scale(${h})`,transformOrigin:"top center"},dangerouslySetInnerHTML:{__html:s}})}):l.jsx("div",{className:`${Ts.mermaidBlock} ${Ts.mermaidLoading} ${Ts.mermaidInline}`,children:l.jsx("span",{children:t("mermaid.rendering")})})]})}function $9e({className:e,children:t,isStreaming:n}){const{t:s}=ut(),r=w1(),[i,o]=f.useState(null),[a,c]=f.useState(!1),{label:u,lang:d,resolvedLang:h}=vM(ite(e)),m=String(t).replace(/\n$/,""),p=r==="light"?"github-light-default":"github-dark-default";f.useEffect(()=>{if(d==="mermaid"||h==="text"||yE(m)){o(null);return}const b=i3e(m,h,p);if(b!==null){o(b);return}const v=!n,x=MB(m,h,p,v);if(x!==null){o(x);return}o(null);let y=!1;return GX(h).then(()=>{if(y)return;const w=MB(m,h,p,v);w!==null&&o(w)}).catch(w=>{y||(console.warn("[web-shell] highlight failed for lang=%s",h,w),o(null))}),()=>{y=!0}},[m,d,h,p,n]);const g=()=>{navigator.clipboard.writeText(m).then(()=>{c(!0),setTimeout(()=>c(!1),2e3)},()=>{})};return d==="mermaid"&&!n?l.jsx(B9e,{code:m}):l.jsxs("div",{className:Ts.codeBlock,children:[l.jsxs("div",{className:Ts.codeBlockHeader,children:[l.jsx("span",{className:Ts.codeBlockLang,children:u}),l.jsx("button",{className:Ts.codeBlockCopy,onClick:g,children:s(a?"code.copied":"code.copy")})]}),i!==null?l.jsx("div",{className:Ts.codeBlockContent,dangerouslySetInnerHTML:{__html:i}}):l.jsx("pre",{className:`${Ts.codeBlockContent} ${Ts.codeBlockPlain}`,children:l.jsx("code",{children:m})})]})}function ite(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 z9e({children:e}){return l.jsx("code",{className:Ts.inlineCode,children:e})}function E$({children:e}){return l.jsx("div",{className:Ts.tableWrapper,children:l.jsx("table",{className:Ts.table,children:e})})}const ote=f.createContext(!1),ate=f.createContext(void 0);function F9e({className:e,children:t}){const n=f.useContext(ote);return(e==null?void 0:e.startsWith("language-"))||typeof t=="string"&&t.includes(`
`)?l.jsx(q9e,{className:e,isStreaming:n,children:t}):l.jsx(z9e,{children:t})}function q9e({className:e,children:t,isStreaming:n}){var m;const s=f.useContext(ate),r=w1(),{markdown:i}=Lu(),o=String(t),a=o.replace(/\n$/,""),c=l.jsx($9e,{className:e,isStreaming:n,children:o}),u=ite(e),{resolvedLang:d}=vM(u);if(!!s&&!!e&&!!u)try{const p=(m=i==null?void 0:i.renderCodeBlock)==null?void 0:m.call(i,{language:u,resolvedLanguage:d,className:e,code:a,isStreaming:!!n,source:s,theme:r});if(p!=null&&typeof p!="boolean")return l.jsx(zd,{fallback:c,label:`custom code block component render (lang=${u})`,resetKeys:[u,s,r,n?"streaming":"settled",a],children:p})}catch(p){console.error("[web-shell] custom code block renderer call failed (lang=%s):",u,p)}return c}function H9e({children:e}){return l.jsx(l.Fragment,{children:e})}const PE=/^qwen-session:\/\//i;function U9e(e){return PE.test(e.trim())?e:RK(e)}function V9e({href:e,children:t}){const n=$N();if(e&&PE.test(e.trim())){if(n==="readonly")return l.jsx("span",{className:Ts.link,children:t});const r=e.trim().replace(PE,"");return l.jsx("a",{href:"#",role:"button",className:Ts.link,onClick:i=>{i.preventDefault(),i.stopPropagation(),window.dispatchEvent(new CustomEvent("qwen:open-session",{detail:r}))},children:t})}const s=rte(e)?e:void 0;return l.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:Ts.link,children:t})}function W9e({src:e,alt:t}){const n=P1(e)?e:void 0;return l.jsx("img",{src:n,alt:t||"",className:Ts.image})}function lte(e="basic",t=""){return{code:F9e,pre:H9e,a:V9e,img:W9e,table({children:n}){if(e==="advanced"){const s=l.jsx(E$,{children:n});return l.jsx(zd,{fallback:s,label:"enhanced markdown table",resetKeys:[t],children:l.jsx(p9e,{fallback:s,children:n})})}return l.jsx(E$,{children:n})}}}const G9e=lte(),gp=f.memo(function({content:t,source:n,isStreaming:s,tableMode:r}){const{markdown:i,markdownTableMode:o}=Lu(),a=n?i:void 0,c=t&&n&&(a!=null&&a.transformMarkdown)?a.transformMarkdown(t,{source:n}):t,u=s?"basic":r??o??"basic",d=f.useMemo(()=>u==="advanced"?lte("advanced",c):G9e,[u,c]),h=a==null?void 0:a.components,m=f.useMemo(()=>h?{...d,...h,...u==="advanced"?{table:d.table}:{}}:d,[d,u,h]);if(!t)return null;const p=a!=null&&a.remarkPlugins?[bO,sB,...a.remarkPlugins]:[bO,sB],g=a!=null&&a.rehypePlugins?[hB,...a.rehypePlugins]:[hB];return l.jsx("div",{className:n!=="thinking"?Ts.content:void 0,"data-markdown-source":n,children:l.jsx(ote.Provider,{value:!!s,children:l.jsx(ate.Provider,{value:n,children:l.jsx(xxe,{remarkPlugins:p,rehypePlugins:g,components:m,urlTransform:U9e,children:c})})})})});let OE=[],cte=[];(()=>{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?cte:OE).push(n=n+e[t])})();function K9e(e){if(e<768)return!1;for(let t=0,n=OE.length;;){let s=t+n>>1;if(e<OE[s])n=s;else if(e>=cte[s])t=s+1;else return!0;if(t==n)return!1}}function A$(e){return e>=127462&&e<=127487}const N$=8205;function Y9e(e,t,n=!0,s=!0){return(n?ute:X9e)(e,t,s)}function ute(e,t,n){if(t==e.length)return t;t&&dte(e.charCodeAt(t))&&hte(e.charCodeAt(t-1))&&t--;let s=JT(e,t);for(t+=j$(s);t<e.length;){let r=JT(e,t);if(s==N$||r==N$||n&&K9e(r))t+=j$(r),s=r;else if(A$(r)){let i=0,o=t-2;for(;o>=0&&A$(JT(e,o));)i++,o-=2;if(i%2==0)break;t+=2}else break}return t}function X9e(e,t,n){for(;t>0;){let s=ute(e,t-2,n);if(s<t)return s;t--}return 0}function JT(e,t){let n=e.charCodeAt(t);if(!hte(n)||t+1==e.length)return n;let s=e.charCodeAt(t+1);return dte(s)?(n-55296<<10)+(s-56320)+65536:n}function dte(e){return e>=56320&&e<57344}function hte(e){return e>=55296&&e<56320}function j$(e){return e<65536?1:2}class er{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]=Qg(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),uu.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]=Qg(this,t,n);let s=[];return this.decompose(t,n,s,0),uu.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 $y(this),i=new $y(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 $y(this,t)}iterRange(t,n=this.length){return new fte(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 mte(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]?er.empty:t.length<=32?new wi(t):uu.from(wi.split(t,[]))}}class wi extends er{constructor(t,n=Q9e(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 J9e(r,a,s,o);r=a+1,s++}}decompose(t,n,s,r){let i=t<=0&&n>=this.length?this:new wi(M$(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(r&1){let o=s.pop(),a=P2(i.text,o.text.slice(),0,i.length);if(a.length<=32)s.push(new wi(a,o.length+i.length));else{let c=a.length>>1;s.push(new wi(a.slice(0,c)),new wi(a.slice(c)))}}else s.push(i)}replace(t,n,s){if(!(s instanceof wi))return super.replace(t,n,s);[t,n]=Qg(this,t,n);let r=P2(this.text,P2(s.text,M$(this.text,0,t)),n),i=this.length+s.length-(n-t);return r.length<=32?new wi(r,i):uu.from(wi.split(r,[]),i)}sliceString(t,n=this.length,s=`
`){[t,n]=Qg(this,t,n);let r="";for(let i=0,o=0;i<=n&&o<this.text.length;o++){let a=this.text[o],c=i+a.length;i>t&&o&&(r+=s),t<c&&n>i&&(r+=a.slice(Math.max(0,t-i),n-i)),i=c+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 wi(s,r)),s=[],r=-1);return r>-1&&n.push(new wi(s,r)),n}}class uu extends er{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,c=s+o.lines-1;if((n?c:a)>=t)return o.lineInner(t,n,s,r);r=a+1,s=c+1}}decompose(t,n,s,r){for(let i=0,o=0;o<=n&&i<this.children.length;i++){let a=this.children[i],c=o+a.length;if(t<=c&&n>=o){let u=r&((o<=t?1:0)|(c>=n?2:0));o>=t&&c<=n&&!u?s.push(a):a.decompose(t-o,n-o,s,u)}o=c+1}}replace(t,n,s){if([t,n]=Qg(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 c=o.replace(t-i,n-i,s),u=this.lines-o.lines+c.lines;if(c.lines<u>>4&&c.lines>u>>6){let d=this.children.slice();return d[r]=c,new uu(d,this.length-(n-t)+s.length)}return super.replace(i,a,c)}i=a+1}return super.replace(t,n,s)}sliceString(t,n=this.length,s=`
`){[t,n]=Qg(this,t,n);let r="";for(let i=0,o=0;i<this.children.length&&o<=n;i++){let a=this.children[i],c=o+a.length;o>t&&i&&(r+=s),t<c&&n>o&&(r+=a.sliceString(t-o,n-o,s)),o=c+1}return r}flatten(t){for(let n of this.children)n.flatten(t)}scanIdentical(t,n){if(!(t instanceof uu))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 c=this.children[r],u=t.children[i];if(c!=u)return s+c.scanIdentical(u,n);s+=c.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 wi(p,n)}let r=Math.max(32,s>>5),i=r<<1,o=r>>1,a=[],c=0,u=-1,d=[];function h(p){let g;if(p.lines>i&&p instanceof uu)for(let b of p.children)h(b);else p.lines>o&&(c>o||!c)?(m(),a.push(p)):p instanceof wi&&c&&(g=d[d.length-1])instanceof wi&&p.lines+g.lines<=32?(c+=p.lines,u+=p.length+1,d[d.length-1]=new wi(g.text.concat(p.text),g.length+1+p.length)):(c+p.lines>r&&m(),c+=p.lines,u+=p.length+1,d.push(p))}function m(){c!=0&&(a.push(d.length==1?d[0]:uu.from(d,u)),u=-1,c=d.length=0)}for(let p of t)h(p);return m(),a.length==1?a[0]:new uu(a,n)}}er.empty=new wi([""],0);function Q9e(e){let t=-1;for(let n of e)t+=n.length+1;return t}function P2(e,t,n=0,s=1e9){for(let r=0,i=0,o=!0;i<e.length&&r<=s;i++){let a=e[i],c=r+a.length;c>=n&&(c>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=c+1}return t}function M$(e,t,n){return P2(e,[""],t,n)}class $y{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 wi?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 wi?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 wi){let c=r.text[o+(n<0?-1:0)];if(this.offsets[s]+=n,c.length>Math.max(0,t))return this.value=t==0?c:n>0?c.slice(t):c.slice(0,c.length-t),this;t-=c.length}else{let c=r.children[o+(n<0?-1:0)];t>c.length?(t-=c.length,this.offsets[s]+=n):(n<0&&this.offsets[s]--,this.nodes.push(c),this.offsets.push(n>0?1:(c instanceof wi?c.text.length:c.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class fte{constructor(t,n,s){this.value="",this.done=!1,this.cursor=new $y(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 mte{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"&&(er.prototype[Symbol.iterator]=function(){return this.iter()},$y.prototype[Symbol.iterator]=fte.prototype[Symbol.iterator]=mte.prototype[Symbol.iterator]=function(){return this});class J9e{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 Qg(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function co(e,t,n=!0,s=!0){return Y9e(e,t,n,s)}function Z9e(e){return e>=56320&&e<57344}function eNe(e){return e>=55296&&e<56320}function La(e,t){let n=e.charCodeAt(t);if(!eNe(n)||t+1==e.length)return n;let s=e.charCodeAt(t+1);return Z9e(s)?(n-55296<<10)+(s-56320)+65536:n}function wM(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function du(e){return e<65536?1:2}const BE=/\r\n?|\n/;var ha=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(ha||(ha={}));class Su{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){$E(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 Su(t)}composeDesc(t){return this.empty?t:t.empty?this:pte(this,t)}mapDesc(t,n=!1){return t.empty?this:zE(this,t,n)}mapPos(t,n=-1,s=ha.Simple){let r=0,i=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],c=this.sections[o++],u=r+a;if(c<0){if(u>t)return i+(t-r);i+=a}else{if(s!=ha.Simple&&u>=t&&(s==ha.TrackDel&&r<t&&u>t||s==ha.TrackBefore&&r<t||s==ha.TrackAfter&&u>t))return null;if(u>t||u==t&&n<0&&!a)return t==r||n<0?i:i+c;i+=c}r=u}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 Su(t)}static create(t){return new Su(t)}}class Ui extends Su{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 $E(this,(n,s,r,i,o)=>t=t.replace(r,r+(s-n),o),!1),t}mapDesc(t,n=!1){return zE(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 c=r>>1;for(;s.length<c;)s.push(er.empty);s.push(o?t.slice(i,i+o):er.empty)}i+=o}return new Ui(n,s)}compose(t){return this.empty?t:t.empty?this:pte(this,t,!0)}map(t,n=!1){return t.empty?this:zE(this,t,n,!0)}iterChanges(t,n=!1){$E(this,t,n)}get desc(){return Su.create(this.sections)}filter(t){let n=[],s=[],r=[],i=new jx(this);e:for(let o=0,a=0;;){let c=o==t.length?1e9:t[o++];for(;a<c||a==c&&i.len==0;){if(i.done)break e;let d=Math.min(i.len,c-a);zo(r,d,-1);let h=i.ins==-1?-1:i.off==0?i.ins:0;zo(n,d,h),h>0&&Vh(s,n,i.text),i.forward(d),a+=d}let u=t[o++];for(;a<u;){if(i.done)break e;let d=Math.min(i.len,u-a);zo(n,d,-1),zo(r,d,i.ins==-1?-1:i.off==0?i.ins:0),i.forward(d),a+=d}}return{changes:new Ui(n,s),filtered:Su.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 c(d=!1){if(!d&&!r.length)return;o<n&&zo(r,n-o,-1);let h=new Ui(r,i);a=a?a.compose(h.map(a)):h,r=[],i=[],o=0}function u(d){if(Array.isArray(d))for(let h of d)u(h);else if(d instanceof Ui){if(d.length!=n)throw new RangeError(`Mismatched change set length (got ${d.length}, expected ${n})`);c(),a=a?a.compose(d.map(a)):d}else{let{from:h,to:m=h,insert:p}=d;if(h>m||h<0||m>n)throw new RangeError(`Invalid change range ${h} to ${m} (in doc of length ${n})`);let g=p?typeof p=="string"?er.of(p.split(s||BE)):p:er.empty,b=g.length;if(h==m&&b==0)return;h<o&&c(),h>o&&zo(r,h-o,-1),zo(r,m-h,b),Vh(i,r,g),o=m}}return u(t),c(!a),a}static empty(t){return new Ui(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(er.empty);s[r]=er.of(i.slice(1)),n.push(i[0],s[r].length)}}}return new Ui(n,s)}static createSet(t,n){return new Ui(t,n)}}function zo(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 Vh(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(er.empty);e.push(n)}}function $E(e,t,n){let s=e.inserted;for(let r=0,i=0,o=0;o<e.sections.length;){let a=e.sections[o++],c=e.sections[o++];if(c<0)r+=a,i+=a;else{let u=r,d=i,h=er.empty;for(;u+=a,d+=c,c&&s&&(h=h.append(s[o-2>>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)a=e.sections[o++],c=e.sections[o++];t(r,u,i,d,h),r=u,i=d}}}function zE(e,t,n,s=!1){let r=[],i=s?[]:null,o=new jx(e),a=new jx(t);for(let c=-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 u=Math.min(o.len,a.len);zo(r,u,-1),o.forward(u),a.forward(u)}else if(a.ins>=0&&(o.ins<0||c==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!n))){let u=a.len;for(zo(r,a.ins,-1);u;){let d=Math.min(o.len,u);o.ins>=0&&c<o.i&&o.len<=d&&(zo(r,0,o.ins),i&&Vh(i,r,o.text),c=o.i),o.forward(d),u-=d}a.next()}else if(o.ins>=0){let u=0,d=o.len;for(;d;)if(a.ins==-1){let h=Math.min(d,a.len);u+=h,d-=h,a.forward(h)}else if(a.ins==0&&a.len<d)d-=a.len,a.next();else break;zo(r,u,c<o.i?o.ins:0),i&&c<o.i&&Vh(i,r,o.text),c=o.i,o.forward(o.len-d)}else{if(o.done&&a.done)return i?Ui.createSet(r,i):Su.create(r);throw new Error("Mismatched change set lengths")}}}function pte(e,t,n=!1){let s=[],r=n?[]:null,i=new jx(e),o=new jx(t);for(let a=!1;;){if(i.done&&o.done)return r?Ui.createSet(s,r):Su.create(s);if(i.ins==0)zo(s,i.len,0,a),i.next();else if(o.len==0&&!o.done)zo(s,0,o.ins,a),r&&Vh(r,s,o.text),o.next();else{if(i.done||o.done)throw new Error("Mismatched change set lengths");{let c=Math.min(i.len2,o.len),u=s.length;if(i.ins==-1){let d=o.ins==-1?-1:o.off?0:o.ins;zo(s,c,d,a),r&&d&&Vh(r,s,o.text)}else o.ins==-1?(zo(s,i.off?0:i.len,c,a),r&&Vh(r,s,i.textBit(c))):(zo(s,i.off?0:i.len,o.off?0:o.ins,a),r&&!o.off&&Vh(r,s,o.text));a=(i.ins>c||o.ins>=0&&o.len>c)&&(a||s.length>u),i.forward2(c),o.forward(c)}}}}class jx{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?er.empty:t[n]}textBit(t){let{inserted:n}=this.set,s=this.i-2>>1;return s>=n.length&&!t?er.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 Wm{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 Wm(s,r,this.flags)}extend(t,n=t,s=0){if(t<=this.anchor&&n>=this.anchor)return Ye.range(t,n,void 0,void 0,s);let r=Math.abs(t-this.anchor)>Math.abs(n-this.anchor)?t:n;return Ye.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 Ye.range(t.anchor,t.head)}static create(t,n,s){return new Wm(t,n,s)}}class Ye{constructor(t,n){this.ranges=t,this.mainIndex=n}map(t,n=-1){return t.empty?this:Ye.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 Ye([this.main],0)}addRange(t,n=!0){return Ye.create([t].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(t,n=this.mainIndex){let s=this.ranges.slice();return s[n]=t,Ye.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 Ye(t.ranges.map(n=>Wm.fromJSON(n)),t.main)}static single(t,n=t){return new Ye([Ye.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 Ye.normalized(t.slice(),n);s=i.to}return new Ye(t,n)}static cursor(t,n=0,s,r){return Wm.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?Wm.create(n,t,48|o):Wm.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,c=Math.max(i.to,o.to);r<=n&&n--,t.splice(--r,2,i.anchor>i.head?Ye.range(c,a):Ye.range(a,c))}}return new Ye(t,n)}}function gte(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let kM=0;class an{constructor(t,n,s,r,i){this.combine=t,this.compareInput=n,this.compare=s,this.isStatic=r,this.id=kM++,this.default=t([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(t={}){return new an(t.combine||(n=>n),t.compareInput||((n,s)=>n===s),t.compare||(t.combine?(n,s)=>n===s:_M),!!t.static,t.enables)}of(t){return new O2([],this,0,t)}compute(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new O2(t,this,1,n)}computeN(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new O2(t,this,2,n)}from(t,n){return n||(n=s=>s),this.compute([t],s=>n(s.field(t)))}}function _M(e,t){return e==t||e.length==t.length&&e.every((n,s)=>n===t[s])}class O2{constructor(t,n,s,r){this.dependencies=t,this.facet=n,this.type=s,this.value=r,this.id=kM++}dynamicSlot(t){var n;let s=this.value,r=this.facet.compareInput,i=this.id,o=t[i]>>1,a=this.type==2,c=!1,u=!1,d=[];for(let h of this.dependencies)h=="doc"?c=!0:h=="selection"?u=!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,m){if(c&&m.docChanged||u&&(m.docChanged||m.selection)||FE(h,d)){let p=s(h);if(a?!I$(p,h.values[o],r):!r(p,h.values[o]))return h.values[o]=p,1}return 0},reconfigure:(h,m)=>{let p,g=m.config.address[i];if(g!=null){let b=kS(m,g);if(this.dependencies.every(v=>v instanceof an?m.facet(v)===h.facet(v):v instanceof Io?m.field(v,!1)==h.field(v,!1):!0)||(a?I$(p=s(h),b,r):r(p=s(h),b)))return h.values[o]=b,0}else p=s(h);return h.values[o]=p,1}}}}function I$(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 FE(e,t){let n=!1;for(let s of t)zy(e,s)&1&&(n=!0);return n}function tNe(e,t,n){let s=n.map(c=>e[c.id]),r=n.map(c=>c.type),i=s.filter(c=>!(c&1)),o=e[t.id]>>1;function a(c){let u=[];for(let d=0;d<s.length;d++){let h=kS(c,s[d]);if(r[d]==2)for(let m of h)u.push(m);else u.push(h)}return t.combine(u)}return{create(c){for(let u of s)zy(c,u);return c.values[o]=a(c),1},update(c,u){if(!FE(c,i))return 0;let d=a(c);return t.compare(d,c.values[o])?0:(c.values[o]=d,1)},reconfigure(c,u){let d=FE(c,s),h=u.config.facets[t.id],m=u.facet(t);if(h&&!d&&_M(n,h))return c.values[o]=m,0;let p=a(c);return t.compare(p,m)?(c.values[o]=m,0):(c.values[o]=p,1)}}}const yk=an.define({static:!0});class Io{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 Io(kM++,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(yk).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(yk),o=r.facet(yk),a;return(a=i.find(c=>c.field==this))&&a!=o.find(c=>c.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,yk.of({field:this,create:t})]}get extension(){return this}}const Lm={lowest:4,low:3,default:2,high:1,highest:0};function Ib(e){return t=>new bte(t,e)}const nm={highest:Ib(Lm.highest),high:Ib(Lm.high),default:Ib(Lm.default),low:Ib(Lm.low),lowest:Ib(Lm.lowest)};class bte{constructor(t,n){this.inner=t,this.prec=n}}class qp{of(t){return new qE(this,t)}reconfigure(t){return qp.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class qE{constructor(t,n){this.compartment=t,this.inner=n}}class wS{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 m of nNe(t,n,o))m instanceof Io?r.push(m):(i[m.facet.id]||(i[m.facet.id]=[])).push(m);let a=Object.create(null),c=[],u=[];for(let m of r)a[m.id]=u.length<<1,u.push(p=>m.slot(p));let d=s==null?void 0:s.config.facets;for(let m in i){let p=i[m],g=p[0].facet,b=d&&d[m]||[];if(p.every(v=>v.type==0))if(a[g.id]=c.length<<1|1,_M(b,p))c.push(s.facet(g));else{let v=g.combine(p.map(x=>x.value));c.push(s&&g.compare(v,s.facet(g))?s.facet(g):v)}else{for(let v of p)v.type==0?(a[v.id]=c.length<<1|1,c.push(v.value)):(a[v.id]=u.length<<1,u.push(x=>v.dynamicSlot(x)));a[g.id]=u.length<<1,u.push(v=>tNe(v,g,p))}}let h=u.map(m=>m(a));return new wS(t,o,h,a,c,i)}}function nNe(e,t,n){let s=[[],[],[],[],[]],r=new Map;function i(o,a){let c=r.get(o);if(c!=null){if(c<=a)return;let u=s[c].indexOf(o);u>-1&&s[c].splice(u,1),o instanceof qE&&n.delete(o.compartment)}if(r.set(o,a),Array.isArray(o))for(let u of o)i(u,a);else if(o instanceof qE){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let u=t.get(o.compartment)||o.inner;n.set(o.compartment,u),i(u,a)}else if(o instanceof bte)i(o.inner,o.prec);else if(o instanceof Io)s[a].push(o),o.provides&&i(o.provides,a);else if(o instanceof O2)s[a].push(o),o.facet.extensions&&i(o.facet.extensions,Lm.default);else{let u=o.extension;if(!u)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(u,a)}}return i(e,Lm.default),s.reduce((o,a)=>o.concat(a))}function zy(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 kS(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}const yte=an.define(),HE=an.define({combine:e=>e.some(t=>t),static:!0}),xte=an.define({combine:e=>e.length?e[0]:void 0,static:!0}),vte=an.define(),wte=an.define(),kte=an.define(),_te=an.define({combine:e=>e.length?e[0]:!1});class nh{constructor(t,n){this.type=t,this.value=n}static define(){return new sNe}}class sNe{of(t){return new nh(this,t)}}class rNe{constructor(t){this.map=t}of(t){return new ss(this,t)}}class ss{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 ss(this.type,n)}is(t){return this.type==t}static define(t={}){return new rNe(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}}ss.reconfigure=ss.define();ss.appendConfig=ss.define();class Wi{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&&gte(s,n.newLength),i.some(a=>a.type==Wi.time)||(this.annotations=i.concat(Wi.time.of(Date.now())))}static create(t,n,s,r,i,o){return new Wi(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(Wi.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]=="."))}}Wi.time=nh.define();Wi.userEvent=nh.define();Wi.addToHistory=nh.define();Wi.remote=nh.define();function iNe(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 Ste(e,t,n){var s;let r,i,o;return n?(r=t.changes,i=Ui.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:ss.mapEffects(e.effects,r).concat(ss.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function UE(e,t,n){let s=t.selection,r=pg(t.annotations);return t.userEvent&&(r=r.concat(Wi.userEvent.of(t.userEvent))),{changes:t.changes instanceof Ui?t.changes:Ui.of(t.changes||[],n,e.facet(xte)),selection:s&&(s instanceof Ye?s:Ye.single(s.anchor,s.head)),effects:pg(t.effects),annotations:r,scrollIntoView:!!t.scrollIntoView}}function Cte(e,t,n){let s=UE(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=Ste(s,UE(e,t[i],o?s.changes.newLength:e.doc.length),o)}let r=Wi.create(e,s.changes,s.selection,s.effects,s.annotations,s.scrollIntoView);return aNe(n?oNe(r):r)}function oNe(e){let t=e.startState,n=!0;for(let r of t.facet(vte)){let i=r(e);if(i===!1){n=!1;break}Array.isArray(i)&&(n=n===!0?i:iNe(n,i))}if(n!==!0){let r,i;if(n===!1)i=e.changes.invertedDesc,r=Ui.empty(t.doc.length);else{let o=e.changes.filter(n);r=o.changes,i=o.filtered.mapDesc(o.changes).invertedDesc}e=Wi.create(t,r,e.selection&&e.selection.map(i),ss.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let s=t.facet(wte);for(let r=s.length-1;r>=0;r--){let i=s[r](e);i instanceof Wi?e=i:Array.isArray(i)&&i.length==1&&i[0]instanceof Wi?e=i[0]:e=Cte(t,pg(i),!1)}return e}function aNe(e){let t=e.startState,n=t.facet(kte),s=e;for(let r=n.length-1;r>=0;r--){let i=n[r](e);i&&Object.keys(i).length&&(s=Ste(s,UE(t,i,e.changes.newLength),!0))}return s==e?e:Wi.create(t,e.changes,e.selection,s.effects,s.annotations,s.scrollIntoView)}const lNe=[];function pg(e){return e==null?lNe:Array.isArray(e)?e:[e]}var Jr=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(Jr||(Jr={}));const cNe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let VE;try{VE=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function uNe(e){if(VE)return VE.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||cNe.test(n)))return!0}return!1}function dNe(e){return t=>{if(!/\S/.test(t))return Jr.Space;if(uNe(t))return Jr.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return Jr.Word;return Jr.Other}}class qs{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++)zy(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 zy(this,s),kS(this,s)}update(...t){return Cte(this,t,!0)}applyTransaction(t){let n=this.config,{base:s,compartments:r}=n;for(let a of t.effects)a.is(qp.reconfigure)?(n&&(r=new Map,n.compartments.forEach((c,u)=>r.set(u,c)),n=null),r.set(a.value.compartment,a.value.extension)):a.is(ss.reconfigure)?(n=null,s=a.value):a.is(ss.appendConfig)&&(n=null,s=pg(s).concat(a.value));let i;n?i=t.startState.values.slice():(n=wS.resolve(s,r,this),i=new qs(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(c,u)=>u.reconfigure(c,this),null).values);let o=t.startState.facet(HE)?t.newSelection:t.newSelection.asSingle();new qs(n,t.newDoc,o,i,(a,c)=>c.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:Ye.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=pg(s.effects);for(let a=1;a<n.ranges.length;a++){let c=t(n.ranges[a]),u=this.changes(c.changes),d=u.map(r);for(let m=0;m<a;m++)i[m]=i[m].map(d);let h=r.mapDesc(u,!0);i.push(c.range.map(h)),r=r.compose(d),o=ss.mapEffects(o,d).concat(ss.mapEffects(pg(c.effects),h))}return{changes:r,selection:Ye.create(i,n.mainIndex),effects:o}}changes(t=[]){return t instanceof Ui?t:Ui.of(t,this.doc.length,this.facet(qs.lineSeparator))}toText(t){return er.of(t.split(this.facet(qs.lineSeparator)||BE))}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:(zy(this,n),kS(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 Io&&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(c=>o.spec.fromJSON(a,c)))}}return qs.create({doc:t.doc,selection:Ye.fromJSON(t.selection),extensions:n.extensions?r.concat([n.extensions]):r})}static create(t={}){let n=wS.resolve(t.extensions||[],new Map),s=t.doc instanceof er?t.doc:er.of((t.doc||"").split(n.staticFacet(qs.lineSeparator)||BE)),r=t.selection?t.selection instanceof Ye?t.selection:Ye.single(t.selection.anchor,t.selection.head):Ye.single(0);return gte(r,s.length),n.staticFacet(HE)||(r=r.asSingle()),new qs(n,s,r,n.dynamicSlots.map(()=>null),(i,o)=>o.create(i),null)}get tabSize(){return this.facet(qs.tabSize)}get lineBreak(){return this.facet(qs.lineSeparator)||`
`}get readOnly(){return this.facet(_te)}phrase(t,...n){for(let s of this.facet(qs.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(yte))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 dNe(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 c=co(n,o,!1);if(i(n.slice(c,o))!=Jr.Word)break;o=c}for(;a<r;){let c=co(n,a);if(i(n.slice(a,c))!=Jr.Word)break;a=c}return o==a?null:Ye.range(o+s,a+s)}}qs.allowMultipleSelections=HE;qs.tabSize=an.define({combine:e=>e.length?e[0]:4});qs.lineSeparator=xte;qs.readOnly=_te;qs.phrases=an.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])}});qs.languageData=yte;qs.changeFilter=vte;qs.transactionFilter=wte;qs.transactionExtender=kte;qp.reconfigure=ss.define();function zu(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 If{eq(t){return this==t}range(t,n=t){return WE.create(t,n,this)}}If.prototype.startSide=If.prototype.endSide=0;If.prototype.point=!1;If.prototype.mapMode=ha.TrackDel;function SM(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}let WE=class Tte{constructor(t,n,s){this.from=t,this.to=n,this.value=s}static create(t,n,s){return new Tte(t,n,s)}};function GE(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class CM{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 c=o+a>>1,u=i[c]-t||(s?this.value[c].endSide:this.value[c].startSide)-n;if(c==o)return u>=0?o:a;u>=0?a=c:o=c+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 c=0;c<this.value.length;c++){let u=this.value[c],d=this.from[c]+t,h=this.to[c]+t,m,p;if(d==h){let g=n.mapPos(d,u.startSide,u.mapMode);if(g==null||(m=p=g,u.startSide!=u.endSide&&(p=n.mapPos(d,u.endSide),p<m)))continue}else if(m=n.mapPos(d,u.startSide),p=n.mapPos(h,u.endSide),m>p||m==p&&u.startSide>0&&u.endSide<=0)continue;(p-m||u.endSide-u.startSide)<0||(o<0&&(o=m),u.point&&(a=Math.max(a,p-m)),s.push(u),r.push(m-o),i.push(p-o))}return{mapped:s.length?new CM(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(GE)),this.isEmpty)return n.length?Ms.of(n):this;let a=new Ete(this,null,-1).goto(0),c=0,u=[],d=new Au;for(;a.value||c<n.length;)if(c<n.length&&(a.from-n[c].from||a.startSide-n[c].value.startSide)>=0){let h=n[c++];d.addInner(h.from,h.to,h.value)||u.push(h)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(c==n.length||this.chunkEnd(a.chunkIndex)<n[c].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)||u.push(WE.create(a.from,a.to,a.value))),a.next());return d.finishInner(this.nextLayer.isEmpty&&!u.length?Ms.empty:this.nextLayer.update({add:u,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],c=this.chunk[o],u=t.touchesRange(a,a+c.length);if(u===!1)r=Math.max(r,c.maxPoint),n.push(c),s.push(t.mapPos(a));else if(u===!0){let{mapped:d,pos:h}=c.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 Mx.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,n=0){return Mx.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),c=R$(o,a,s),u=new Rb(o,c,i),d=new Rb(a,c,i);s.iterGaps((h,m,p)=>D$(u,h,d,m,p,r)),s.empty&&s.length==0&&D$(u,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=R$(i,o),c=new Rb(i,a,0).goto(s),u=new Rb(o,a,0).goto(s);for(;;){if(c.to!=u.to||!KE(c.active,u.active)||c.point&&(!u.point||!SM(c.point,u.point)))return!1;if(c.to>r)return!0;c.next(),u.next()}}static spans(t,n,s,r,i=-1){let o=new Rb(t,null,i).goto(n),a=n,c=o.openStart;for(;;){let u=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,c);r.point(a,u,o.point,d,h,o.pointRank),c=Math.min(o.openEnd(u),d.length)}else u>a&&(r.span(a,u,o.active,c),c=o.openEnd(u));if(o.to>s)return c+(o.point&&o.to>s?1:0);a=o.to,o.next()}}static of(t,n=!1){let s=new Au;for(let r of t instanceof WE?[t]:n?hNe(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 hNe(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let s=e[n];if(GE(t,s)>0)return e.slice().sort(GE);t=s}return e}Ms.empty.nextLayer=Ms.empty;class Au{finishChunk(t){this.chunks.push(new CM(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 Au)).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 R$(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 Ete{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 Mx{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 Ete(o,n,s,i));return r.length==1?r[0]:new Mx(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--)ZT(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--)ZT(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(),ZT(this.heap,0)}}}function ZT(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 Rb{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=Mx.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){xk(this.active,t),xk(this.activeTo,t),xk(this.activeRank,t),this.minActive=L$(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++;vk(this.active,n,s),vk(this.activeTo,n,r),vk(this.activeRank,n,i),t&&vk(t,n,this.cursor.from),this.minActive=L$(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&&xk(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 D$(e,t,n,s,r,i){e.goto(t),n.goto(s);let o=s+r,a=s,c=s-t,u=!!i.boundChange;for(let d=!1;;){let h=e.to+c-n.to,m=h||e.endSide-n.endSide,p=m<0?e.to+c:n.to,g=Math.min(p,o);if(e.point||n.point?(e.point&&n.point&&SM(e.point,n.point)&&KE(e.activeForPoint(e.to),n.activeForPoint(n.to))||i.comparePoint(a,g,e.point,n.point),d=!1):(d&&i.boundChange(a),g>a&&!KE(e.active,n.active)&&i.compareRange(a,g,e.active,n.active),u&&g<o&&(h||e.openEnd(p)!=n.openEnd(p))&&(d=!0)),p>o)break;a=p,m<=0&&e.next(),m>=0&&n.next()}}function KE(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!SM(e[n],t[n]))return!1;return!0}function xk(e,t){for(let n=t,s=e.length-1;n<s;n++)e[n]=e[n+1];e.pop()}function vk(e,t,n){for(let s=e.length-1;s>=t;s--)e[s+1]=e[s];e[t]=n}function L$(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 O1(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=co(e,r));return s}function YE(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=co(e,r)}return s===!0?-1:e.length}const XE="ͼ",P$=typeof Symbol>"u"?"__"+XE:Symbol.for(XE),QE=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),O$=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Rf{constructor(t,n){this.rules=[];let{finish:s}=n||{};function r(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function i(o,a,c,u){let d=[],h=/^@(\w+)\b/.exec(o[0]),m=h&&h[1]=="keyframes";if(h&&a==null)return c.push(o[0]+";");for(let p in a){let g=a[p];if(/&/.test(p))i(p.split(/,\s*/).map(b=>o.map(v=>b.replace(/&/,v))).reduce((b,v)=>b.concat(v)),g,c);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,m)}else g!=null&&d.push(p.replace(/_.*/,"").replace(/[A-Z]/g,b=>"-"+b.toLowerCase())+": "+g+";")}(d.length||m)&&c.push((s&&!h&&!u?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=O$[P$]||1;return O$[P$]=t+1,XE+t.toString(36)}static mount(t,n,s){let r=t[QE],i=s&&s.nonce;r?i&&r.setNonce(i):r=new fNe(t,i),r.mount(Array.isArray(n)?n:[n],t)}}let B$=new Map;class fNe{constructor(t,n){let s=t.ownerDocument||t,r=s.defaultView;if(!t.head&&t.adoptedStyleSheets&&r.CSSStyleSheet){let i=B$.get(s);if(i)return t[QE]=i;this.sheet=new r.CSSStyleSheet,B$.set(s,this)}else this.styleTag=s.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],t[QE]=this}mount(t,n){let s=this.sheet,r=0,i=0;for(let o=0;o<t.length;o++){let a=t[o],c=this.modules.indexOf(a);if(c<i&&c>-1&&(this.modules.splice(c,1),i--,c=-1),c==-1){if(this.modules.splice(i++,0,a),s)for(let u=0;u<a.rules.length;u++)s.insertRule(a.rules[u],r++)}else{for(;i<c;)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 c=0;c<this.modules.length;c++)o+=this.modules[c].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 Df={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:"'"},Ix={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},mNe=typeof navigator<"u"&&/Mac/.test(navigator.platform),pNe=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var _o=0;_o<10;_o++)Df[48+_o]=Df[96+_o]=String(_o);for(var _o=1;_o<=24;_o++)Df[_o+111]="F"+_o;for(var _o=65;_o<=90;_o++)Df[_o]=String.fromCharCode(_o+32),Ix[_o]=String.fromCharCode(_o);for(var e6 in Df)Ix.hasOwnProperty(e6)||(Ix[e6]=Df[e6]);function gNe(e){var t=mNe&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||pNe&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?Ix:Df)[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 _r(){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++)Ate(e,arguments[t]);return e}function Ate(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++)Ate(e,t[n]);else throw new RangeError("Unsupported child node: "+t)}let aa=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},JE=typeof document<"u"?document:{documentElement:{style:{}}};const ZE=/Edge\/(\d+)/.exec(aa.userAgent),Nte=/MSIE \d/.test(aa.userAgent),eA=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(aa.userAgent),D3=!!(Nte||eA||ZE),$$=!D3&&/gecko\/(\d+)/i.test(aa.userAgent),t6=!D3&&/Chrome\/(\d+)/.exec(aa.userAgent),z$="webkitFontSmoothing"in JE.documentElement.style,tA=!D3&&/Apple Computer/.test(aa.vendor),F$=tA&&(/Mobile\/\w+/.test(aa.userAgent)||aa.maxTouchPoints>2);var on={mac:F$||/Mac/.test(aa.platform),windows:/Win/.test(aa.platform),linux:/Linux|X11/.test(aa.platform),ie:D3,ie_version:Nte?JE.documentMode||6:eA?+eA[1]:ZE?+ZE[1]:0,gecko:$$,gecko_version:$$?+(/Firefox\/(\d+)/.exec(aa.userAgent)||[0,0])[1]:0,chrome:!!t6,chrome_version:t6?+t6[1]:0,ios:F$,android:/Android\b/.test(aa.userAgent),webkit:z$,webkit_version:z$?+(/\bAppleWebKit\/(\d+)/.exec(aa.userAgent)||[0,0])[1]:0,safari:tA,safari_version:tA?+(/\bVersion\/(\d+(\.\d+)?)/.exec(aa.userAgent)||[0,0])[1]:0,tabSize:JE.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function TM(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 _S=Object.create(null);function EM(e,t,n){if(e==t)return!0;e||(e=_S),t||(t=_S);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 bNe(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 q$(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 yNe(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 Al{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 Mo=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(Mo||(Mo={}));class Sn extends If{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 Rv(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 bp(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}=jte(t,n);s=(i?n?-3e8:-1:5e8)-1,r=(o?n?2e8:1:-6e8)+1}return new bp(t,s,r,n,t.widget||null,!0)}static line(t){return new Dv(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 Rv extends Sn{constructor(t){let{start:n,end:s}=jte(t);super(n?-1:5e8,s?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?TM(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||_S}eq(t){return this==t||t instanceof Rv&&this.tagName==t.tagName&&EM(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)}}Rv.prototype.point=!1;class Dv extends Sn{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof Dv&&this.spec.class==t.spec.class&&EM(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)}}Dv.prototype.mapMode=ha.TrackBefore;Dv.prototype.point=!0;class bp 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?ha.TrackBefore:ha.TrackAfter:ha.TrackDel}get type(){return this.startSide!=this.endSide?Mo.WidgetRange:this.startSide<=0?Mo.WidgetBefore:Mo.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof bp&&xNe(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)}}bp.prototype.point=!0;function jte(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 xNe(e,t){return e==t||!!(e&&t&&e.compare(t))}function gg(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 Rx extends If{constructor(t,n,s){super(),this.tagName=t,this.attributes=n,this.rank=s}eq(t){return t==this||t instanceof Rx&&this.tagName==t.tagName&&EM(this.attributes,t.attributes)}static create(t){return new Rx(t.tagName,t.attributes||_S,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(t,n=!1){return Ms.of(t,n)}}Rx.prototype.startSide=Rx.prototype.endSide=-1;function Dx(e){let t;return e.nodeType==11?t=e.getSelection?e:e.ownerDocument:t=e,t.getSelection()}function nA(e,t){return t?e==t||e.contains(t.nodeType!=1?t.parentNode:t):!1}function Fy(e,t){if(!t.anchorNode)return!1;try{return nA(e,t.anchorNode)}catch{return!1}}function qy(e){return e.nodeType==3?Px(e,0,e.nodeValue.length).getClientRects():e.nodeType==1?e.getClientRects():[]}function Hy(e,t,n,s){return n?H$(e,t,n,s,-1)||H$(e,t,n,s,1):!1}function Lf(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function SS(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function H$(e,t,n,s,r){for(;;){if(e==n&&t==s)return!0;if(t==(r<0?0:Ud(e))){if(e.nodeName=="DIV")return!1;let i=e.parentNode;if(!i||i.nodeType!=1)return!1;t=Lf(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?Ud(e):0}else return!1}}function Ud(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Lx(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function vNe(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 Mte(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 wNe(e,t,n,s,r,i,o,a){let c=e.ownerDocument,u=c.defaultView||window;for(let d=e,h=!1;d&&!h;)if(d.nodeType==1){let m,p=d==c.body,g=1,b=1;if(p)m=vNe(u);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 y=d.getBoundingClientRect();({scaleX:g,scaleY:b}=Mte(d,y)),m={left:y.left,right:y.left+d.clientWidth*g,top:y.top,bottom:y.top+d.clientHeight*b}}let v=0,x=0;if(r=="nearest")t.top<m.top+o?(x=t.top-(m.top+o),n>0&&t.bottom>m.bottom+x&&(x=t.bottom-m.bottom+o)):t.bottom>m.bottom-o&&(x=t.bottom-m.bottom+o,n<0&&t.top-x<m.top&&(x=t.top-(m.top+o)));else{let y=t.bottom-t.top,w=m.bottom-m.top;x=(r=="center"&&y<=w?t.top+y/2-w/2:r=="start"||r=="center"&&n<0?t.top-o:t.bottom-w+o)-m.top}if(s=="nearest"?t.left<m.left+i?(v=t.left-(m.left+i),n>0&&t.right>m.right+v&&(v=t.right-m.right+i)):t.right>m.right-i&&(v=t.right-m.right+i,n<0&&t.left<m.left+v&&(v=t.left-(m.left+i))):v=(s=="center"?t.left+(t.right-t.left)/2-(m.right-m.left)/2:s=="start"==a?t.left-i:t.right-(m.right-m.left)+i)-m.left,v||x)if(p)u.scrollBy(v,x);else{let y=0,w=0;if(x){let k=d.scrollTop;d.scrollTop+=x/b,w=(d.scrollTop-k)*b}if(v){let k=d.scrollLeft;d.scrollLeft+=v/g,y=(d.scrollLeft-k)*g}t={left:t.left-y,top:t.top-w,right:t.right-y,bottom:t.bottom-w},y&&Math.abs(y-v)<1&&(s="nearest"),w&&Math.abs(w-x)<1&&(r="nearest")}if(p)break;(t.top<m.top||t.bottom>m.bottom||t.left<m.left||t.right>m.right)&&(t={left:Math.max(t.left,m.left),right:Math.min(t.right,m.right),top:Math.max(t.top,m.top),bottom:Math.min(t.bottom,m.bottom)}),d=d.assignedSlot||d.parentNode}else if(d.nodeType==11)d=d.host;else break}function Ite(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 kNe{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?Ud(n):0),s,Math.min(t.focusOffset,s?Ud(s):0))}set(t,n,s,r){this.anchorNode=t,this.anchorOffset=n,this.focusNode=s,this.focusOffset=r}}let Mm=null;on.safari&&on.safari_version>=26&&(Mm=!1);function Rte(e){if(e.setActive)return e.setActive();if(Mm)return e.focus(Mm);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(Mm==null?{get preventScroll(){return Mm={preventScroll:!0},!0}}:void 0),!Mm){Mm=!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 U$;function Px(e,t,n=t){let s=U$||(U$=document.createRange());return s.setEnd(e,n),s.setStart(e,t),s}function bg(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 _Ne(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function SNe(e,t){let n=t.focusNode,s=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=s)return!1;for(s=Math.min(s,Ud(n));;)if(s){if(n.nodeType!=1)return!1;let r=n.childNodes[s-1];r.contentEditable=="false"?s--:(n=r,s=Ud(n))}else{if(n==e)return!0;s=Lf(n),n=n.parentNode}}function Dte(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 Lte(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=Ud(n)}else if(n.parentNode&&!SS(n))s=Lf(n),n=n.parentNode;else return null}}function Pte(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&&!SS(n))s=Lf(n)+1,n=n.parentNode;else return null}}class _c{constructor(t,n,s=!0){this.node=t,this.offset=n,this.precise=s}static before(t,n){return new _c(t.parentNode,Lf(t),n)}static after(t,n){return new _c(t.parentNode,Lf(t)+1,n)}}var Mr=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(Mr||(Mr={}));const yp=Mr.LTR,AM=Mr.RTL;function Ote(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}const CNe=Ote("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),TNe=Ote("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),sA=Object.create(null),Xc=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);sA[t]=n,sA[n]=-t}function Bte(e){return e<=247?CNe[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?TNe[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}const ENe=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class xu{get dir(){return this.level%2?AM:yp}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 $te(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||!$te(s.inner,r.inner))return!1}return!0}const Ar=[];function ANe(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,c=i?256:r;for(let u=o,d=c,h=c;u<a;u++){let m=Bte(e.charCodeAt(u));m==512?m=d:m==8&&h==4&&(m=16),Ar[u]=m==4?2:m,m&7&&(h=m),d=m}for(let u=o,d=c,h=c;u<a;u++){let m=Ar[u];if(m==128)u<a-1&&d==Ar[u+1]&&d&24?m=Ar[u]=d:Ar[u]=256;else if(m==64){let p=u+1;for(;p<a&&Ar[p]==64;)p++;let g=u&&d==8||p<n&&Ar[p]==8?h==1?1:8:256;for(let b=u;b<p;b++)Ar[b]=g;u=p-1}else m==8&&h==1&&(Ar[u]=1);d=m,m&7&&(h=m)}}}function NNe(e,t,n,s,r){let i=r==1?2:1;for(let o=0,a=0,c=0;o<=s.length;o++){let u=o?s[o-1].to:t,d=o<s.length?s[o].from:n;for(let h=u,m,p,g;h<d;h++)if(p=sA[m=e.charCodeAt(h)])if(p<0){for(let b=a-3;b>=0;b-=3)if(Xc[b+1]==-p){let v=Xc[b+2],x=v&2?r:v&4?v&1?i:r:0;x&&(Ar[h]=Ar[Xc[b]]=x),a=b;break}}else{if(Xc.length==189)break;Xc[a++]=h,Xc[a++]=m,Xc[a++]=c}else if((g=Ar[h])==2||g==1){let b=g==r;c=b?0:1;for(let v=a-3;v>=0;v-=3){let x=Xc[v+2];if(x&2)break;if(b)Xc[v+2]|=2;else{if(x&4)break;Xc[v+2]|=4}}}}}function jNe(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 c=o;c<a;){let u=Ar[c];if(u==256){let d=c+1;for(;;)if(d==a){if(r==n.length)break;d=n[r++].to,a=r<n.length?n[r].from:t}else if(Ar[d]==256)d++;else break;let h=i==1,m=(d<t?Ar[d]:s)==1,p=h==m?h?1:2:s;for(let g=d,b=r,v=b?n[b-1].to:e;g>c;)g==v&&(g=n[--b].from,v=b?n[b-1].to:e),Ar[--g]=p;c=d}else i=u,c++}}}function rA(e,t,n,s,r,i,o){let a=s%2?2:1;if(s%2==r%2)for(let c=t,u=0;c<n;){let d=!0,h=!1;if(u==i.length||c<i[u].from){let b=Ar[c];b!=a&&(d=!1,h=b==16)}let m=!d&&a==1?[]:null,p=d?s:s+1,g=c;e:for(;;)if(u<i.length&&g==i[u].from){if(h)break e;let b=i[u];if(!d)for(let v=b.to,x=u+1;;){if(v==n)break e;if(x<i.length&&i[x].from==v)v=i[x++].to;else{if(Ar[v]==a)break e;break}}if(u++,m)m.push(b);else{b.from>c&&o.push(new xu(c,b.from,p));let v=b.direction==yp!=!(p%2);iA(e,v?s+1:s,r,b.inner,b.from,b.to,o),c=b.to}g=b.to}else{if(g==n||(d?Ar[g]!=a:Ar[g]==a))break;g++}m?rA(e,c,g,s+1,r,m,o):c<g&&o.push(new xu(c,g,p)),c=g}else for(let c=n,u=i.length;c>t;){let d=!0,h=!1;if(!u||c>i[u-1].to){let b=Ar[c-1];b!=a&&(d=!1,h=b==16)}let m=!d&&a==1?[]:null,p=d?s:s+1,g=c;e:for(;;)if(u&&g==i[u-1].to){if(h)break e;let b=i[--u];if(!d)for(let v=b.from,x=u;;){if(v==t)break e;if(x&&i[x-1].to==v)v=i[--x].from;else{if(Ar[v-1]==a)break e;break}}if(m)m.push(b);else{b.to<c&&o.push(new xu(b.to,c,p));let v=b.direction==yp!=!(p%2);iA(e,v?s+1:s,r,b.inner,b.from,b.to,o),c=b.from}g=b.from}else{if(g==t||(d?Ar[g-1]!=a:Ar[g-1]==a))break;g--}m?rA(e,g,c,s+1,r,m,o):g<c&&o.push(new xu(g,c,p)),c=g}}function iA(e,t,n,s,r,i,o){let a=t%2?2:1;ANe(e,r,i,s,a),NNe(e,r,i,s,a),jNe(r,i,s,a),rA(e,r,i,t,n,s,o)}function MNe(e,t,n){if(!e)return[new xu(0,0,t==AM?1:0)];if(t==yp&&!n.length&&!ENe.test(e))return zte(e.length);if(n.length)for(;e.length>Ar.length;)Ar[Ar.length]=256;let s=[],r=t==yp?0:1;return iA(e,r,r,n,0,e.length,s),s}function zte(e){return[new xu(0,e,0)]}let Fte="";function INe(e,t,n,s,r){var i;let o=s.head-e.from,a=xu.find(t,o,(i=s.bidiLevel)!==null&&i!==void 0?i:-1,s.assoc),c=t[a],u=c.side(r,n);if(o==u){let m=a+=r?1:-1;if(m<0||m>=t.length)return null;c=t[a=m],o=c.side(!r,n),u=c.side(r,n)}let d=co(e.text,o,c.forward(r,n));(d<c.from||d>c.to)&&(d=u),Fte=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==u&&h.level+(r?0:1)<c.level?Ye.cursor(h.side(!r,n)+e.from,h.forward(r,n)?1:-1,h.level):Ye.cursor(d+e.from,c.forward(r,n)?-1:1,c.level)}function RNe(e,t,n){for(let s=t;s<n;s++){let r=Bte(e.charCodeAt(s));if(r==1)return yp;if(r==2||r==4)return AM}return yp}const qte=an.define(),Hte=an.define(),Ute=an.define(),Vte=an.define(),oA=an.define(),Wte=an.define(),Gte=an.define(),NM=an.define(),jM=an.define(),Kte=an.define({combine:e=>e.some(t=>t)}),Yte=an.define({combine:e=>e.some(t=>t)}),Xte=an.define();class yg{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 yg(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 yg(Ye.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const wk=ss.define({map:(e,t)=>e.map(t)}),Qte=ss.define();function Ba(e,t,n){let s=e.facet(Vte);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 ld=an.define({combine:e=>e.length?e[0]:!0});let DNe=0;const K0=an.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 ei{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(K0.of({plugin:this,arg:void 0}))}of(t){return this.baseExtensions.concat(K0.of({plugin:this,arg:t}))}static define(t,n){const{eventHandlers:s,eventObservers:r,provide:i,decorations:o}=n||{};return new ei(DNe++,t,s,r,a=>{let c=[];return o&&c.push(L3.of(u=>{let d=u.plugin(a);return d?o(d):Sn.none})),i&&c.push(i(a)),c})}static fromClass(t,n){return ei.define((s,r)=>new t(s,r),n)}}class n6{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(Ba(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){Ba(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){Ba(t.state,s,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Jte=an.define(),MM=an.define(),L3=an.define(),Zte=an.define(),IM=an.define(),Lv=an.define(),ene=an.define();function V$(e,t){let n=e.state.facet(ene);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,c){let u=i-t.from,d=o-t.from,h=r;for(let m=a.length-1;m>=0;m--,c--){let p=a[m].spec.bidiIsolate,g;if(p==null&&(p=RNe(t.text,u,d)),c>0&&h.length&&(g=h[h.length-1]).to==u&&g.direction==p)g.to=d,h=g.inner;else{let b={from:u,to:d,direction:p,inner:[]};h.push(b),h=b.inner}}}}),r}const tne=an.define();function RM(e){let t=0,n=0,s=0,r=0;for(let i of e.state.facet(tne)){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 sy=an.define();class ec{constructor(t,n,s,r){this.fromA=t,this.toA=n,this.fromB=s,this.toB=r}join(t){return new ec(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,c=i<n.length?n[i]:1e9,u=Math.min(a,c);if(u==1e9)break;let d=u+o,h=u,m=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;m=Math.max(m,p+o)}else if(r<t.length&&t[r].fromB<=h){let p=t[r++];h=Math.max(h,p.toB),m=Math.max(m,p.toA),o=p.toA-p.toB}else break;s.push(new ec(d,m,u,h))}return s}}class CS{constructor(t,n,s){this.view=t,this.state=n,this.transactions=s,this.flags=0,this.startState=t.state,this.changes=Ui.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,c)=>r.push(new ec(i,o,a,c))),this.changedRanges=r}static create(t,n,s){return new CS(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 LNe=[];class bi{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 LNe}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&&bNe(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=Lf(this.dom),r=this.length?t>0:n>0;return new _c(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 O3)return t;return null}static get(t){return t.cmTile}}class P3 extends bi{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=W$(r);else n.insertBefore(a.dom,r);s=a.dom}for(r=s?s.nextSibling:n.firstChild,i&&r&&(i.written=!0);r;)r=W$(r);this.length=o}}function W$(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class O3 extends P3{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=bi.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 Ad)n.push(r),s=o,r=0;else{let a=i+o.length,c=t(o,i);if(c!==void 0)return c;i=a+o.breakAfter}}}resolveBlock(t,n){let s,r=-1,i,o=-1;if(this.blockTiles((a,c)=>{let u=c+a.length;if(t>=c&&t<=u){if(a.isWidget()&&n>=-1&&n<=1){if(a.flags&32)return!0;a.flags&16&&(s=void 0)}(c<t||t==u&&(n<-1?a.length:a.covers(1)))&&(!s||!a.isWidget()&&s.isWidget())&&(s=a,r=t-c),(u>t||t==c&&(n>1?a.length:a.covers(-1)))&&(!i||!a.isWidget()&&i.isWidget())&&(i=a,o=t-c)}}),!s&&!i)throw new Error("No tile at position "+t);return s&&n<0||!i?{tile:s,offset:r}:{tile:i,offset:o}}}class Ad extends P3{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 Ad(n||document.createElement(t.tagName),t);return n||(s.flags|=4),s}}class Jg extends P3{constructor(t,n){super(t),this.attrs=n}isLine(){return!0}static start(t,n,s){let r=new Jg(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 c(d,h){for(let m=0,p=0;m<d.children.length&&p<=h;m++){let g=d.children[m],b=p+g.length;b>=h&&(g.isComposite()?c(g,h-p):(!o||o.isHidden&&(n>0||s&&ONe(o,g)))&&(b>h||g.flags&32)?(o=g,a=h-p):(p<h||g.flags&16&&!g.isHidden)&&(r=g,i=h-p)),p=b}}c(this,t);let u=(n<0?r:o)||r||o;return u?{tile:u,offset:u==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):PNe(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 _c(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 c of o.children){if(a)return new _c(c.dom,0);c==s.tile&&(a=!0)}}return new _c(this.dom,0)}}function PNe(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=qy(t);return n[n.length-1]||null}function ONe(e,t){let n=e.coordsIn(0,1),s=t.coordsIn(0,1);return n&&s&&s.top<n.bottom}class Oa extends P3{constructor(t,n){super(t),this.mark=n}get domAttrs(){return this.mark.attrs}static of(t,n){let s=new Oa(n||document.createElement(t.tagName),t);return n||(s.flags|=4),s}}class Gm extends bi{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?on.chrome||on.gecko||(t?(r--,o=1):i<s&&(i++,o=-1)):n<0?r--:i<s&&i++;let a=Px(this.dom,r,i).getClientRects();if(!a.length)return null;let c=a[(o?o<0:n>=0)?0:a.length-1];return on.safari&&!o&&c.width==0&&(c=Array.prototype.find.call(a,u=>u.width)||c),o?Lx(c,o<0):c||null}static of(t,n){let s=new Gm(n||document.createTextNode(t),t);return n||(s.flags|=2),s}}class xp extends bi{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 Lx(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 c=a?i.length-1:0;o=i[c],!(t>0?c==0:c==i.length-1||o.top<o.bottom);c+=a?-1:1);return Lx(o,!a)}}get overrideDOMText(){if(!this.length)return er.empty;let{root:t}=this;if(!t)return er.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 xp(i,s,t,r)}}class TS extends bi{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 er.empty}coordsIn(t){return this.dom.getBoundingClientRect()}}class BNe{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 c=r.children[i],u=c.breakAfter;(n>0?c.length<=t:c.length<t)&&(!s||s.skip(c,0,c.length)!==!1||!c.isComposite)?(o=!!u,i++,t-=c.length):(a.push({tile:r,index:i}),r=c,i=0,s&&c.isComposite()&&s.enter(c))}else if(i==r.length)o=!!r.breakAfter,{tile:r,index:i}=a.pop(),i++;else if(t){let c=Math.min(t,r.length-i);s&&s.skip(r,i,i+c),t-=c,i+=c}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 $Ne{constructor(t,n,s,r){this.from=t,this.to=n,this.wrapper=s,this.rank=r}}class zNe{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 c=o.children[o.children.length-1]=new Gm(a.dom,a.text+t);c.parent=o}else o.append(r||Gm.of(t,(i=this.cache.find(Gm))===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)?s6(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 c=n.marks[a],u=r.lastChild;if(u instanceof Oa&&u.mark.eq(c.mark))u.dom!=c.dom&&u.setDOM(s6(c.dom)),r=u;else{if(this.cache.reused.get(c)){let h=bi.get(c.dom);h&&h.setDOM(s6(c.dom))}let d=Oa.of(c.mark,c.dom);r.append(d),r=d}this.cache.reused.set(c,2)}let i=bi.get(t.text);i&&this.cache.reused.set(i,2);let o=new Gm(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=nne);let r=Jg.start(t,n||((s=this.cache.find(Jg))===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 Oa&&a.mark.eq(o))r=a,n--;else{let c=Oa.of(o,(s=this.cache.find(Oa,u=>u.mark.eq(o)))===null||s===void 0?void 0:s.dom);r.append(c),r=c,n=0}}return r}endLine(){if(this.curLine){this.flushBuffer();let t=this.curLine.lastChild;(!t||!G$(this.curLine,!1)||t.dom.nodeName!="BR"&&t.isWidget()&&!(on.ios&&G$(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(r6,0,32)||new xp(r6.toDOM(),0,r6,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 $Ne(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 Ad&&r.wrapper.eq(s.wrapper))n=r;else{let i=Ad.of(s.wrapper,(t=this.cache.find(Ad,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(TS,void 0,1);return s&&(s.flags=n),s||new TS(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class FNe{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 ES=[xp,Jg,Gm,Oa,TS,Ad,O3];for(let e=0;e<ES.length;e++)ES[e].bucket=e;class qNe{constructor(t){this.view=t,this.buckets=ES.map(()=>[]),this.index=ES.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 c=(a+o)%i.length,u=i[c];if((!n||n(u))&&!this.reused.has(u))return i.splice(c,1),c<o&&this.index[r]--,this.reused.set(u,s),u}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 xp(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 HNe{constructor(t,n,s,r,i){this.view=t,this.decorations=r,this.disallowBlockEffectsFor=i,this.openWidget=!1,this.openMarks=0,this.cache=new qNe(t),this.text=new FNe(t.state.doc),this.builder=new zNe(this.cache,new O3(t,t.contentDOM),Ms.iter(s)),this.cache.reused.set(n,2),this.old=new BNe(n),this.reuseWalker={skip:(o,a,c)=>{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,c=a?a.fromA:this.old.root.length;if(c>r){let u=c-r;this.preserve(u,!o,!a),r=c,i+=u}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=WNe(this.old),i=this.openMarks;this.old.advance(t,s?1:-1,{skip:(o,a,c)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(c-a);else{let u=c>0||a<o.length?xp.of(o.widget,this.view,c-a,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);u.flags&256?(u.flags&=-2,this.builder.addBlockWidget(u)):(this.builder.ensureLine(null),this.builder.addInlineWidget(u,r,i),i=r.length)}else if(o.isText())this.builder.ensureLine(null),!a&&c==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,c),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 TS)this.cache.add(o);else if(o instanceof Oa)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 Oa&&r.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?r.length&&(r.length=i=0):o instanceof Oa&&(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,c,u,d,h,m)=>{if(u instanceof bp){if(this.disallowBlockEffectsFor[m]){if(u.block)throw new RangeError("Block decorations may not be specified via plugins");if(c>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(c-a);else{let p=u.widget||(u.block?Zg.block:Zg.inline),g=UNe(u),b=this.cache.findWidget(p,c-a,g)||xp.of(p,this.view,c-a,g);u.block?(u.startSide>0&&r.addLineStartIfNotCovered(s),r.addBlockWidget(b)):(r.ensureLine(s),r.addInlineWidget(b,d,h))}s=null}else s=VNe(s,u);c>a&&this.text.skip(c-a)},span:(a,c,u,d)=>{for(let h=a;h<c;){let m=this.text.next(Math.min(512,c-h));m==null?(r.addLineStartIfNotCovered(s),r.addBreak(),h++):(r.ensureLine(s),r.addText(m,u,h==a?d:u.length),h+=m.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=bi.get(r);if(r==this.view.contentDOM)break;i instanceof Oa?n.push(i):i!=null&&i.isLine()?s=i:i instanceof Ad||(r.nodeName=="DIV"&&!s&&r!=this.view.contentDOM?s=new Jg(r,nne):s||n.push(Oa.of(new Rv({tagName:r.nodeName.toLowerCase(),attributes:yNe(r)}),r)))}return{line:s,marks:n}}}function G$(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 UNe(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 nne={class:"cm-line"};function VNe(e,t){let n=t.spec.attributes,s=t.spec.class;return!n&&!s||(e||(e={class:"cm-line"}),n&&TM(n,e),s&&(e.class+=" "+s)),e}function WNe(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 Oa&&t.push(s.mark)}return t}function s6(e){let t=bi.get(e);return t&&t.setDOM(e.cloneNode()),e}class Zg extends Al{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}}Zg.inline=new Zg("span");Zg.block=new Zg("div");const r6=new class extends Al{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class K${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 O3(t,t.contentDOM),this.updateInner([new ec(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:!tje(t.changes,this.hasComposition)&&!t.selectionSet&&(r=t.state.selection.main.head));let i=r>-1?KNe(this.view,t.changes,r):null;if(this.domChanged=null,this.hasComposition){let{from:d,to:h}=this.hasComposition;s=new ec(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,(on.ie||on.chrome)&&!i&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.blockWrappers;this.updateDeco();let c=QNe(o,this.decorations,t.changes);c.length&&(s=ec.extendWithRanges(s,c));let u=ZNe(a,this.blockWrappers,t.changes);return u.length&&(s=ec.extendWithRanges(s,u)),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 HNe(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&bi.get(n.text)&&a.cache.reused.set(bi.get(n.text),2),this.tile=a.run(t,n),aA(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=on.chrome||on.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 i6&&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(Qte)&&(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(ld)||s.tabIndex>-1)&&Fy(s,this.view.observer.selectionRange)&&!(r&&s.contains(r));if(!(i||n||o))return;let a=this.forceSelection;this.forceSelection=!1;let c=this.view.state.selection.main,u,d;if(c.empty?d=u=this.inlineDOMNearPos(c.anchor,c.assoc||1):(d=this.inlineDOMNearPos(c.head,c.head==c.from?1:-1),u=this.inlineDOMNearPos(c.anchor,c.anchor==c.from?1:-1)),on.gecko&&c.empty&&!this.hasComposition&&GNe(u)){let m=document.createTextNode("");this.view.observer.ignore(()=>u.node.insertBefore(m,u.node.childNodes[u.offset]||null)),u=d=new _c(m,0),a=!0}let h=this.view.observer.selectionRange;(a||!h.focusNode||(!Hy(u.node,u.offset,h.anchorNode,h.anchorOffset)||!Hy(d.node,d.offset,h.focusNode,h.focusOffset))&&!this.suppressWidgetCursorChange(h,c))&&(this.view.observer.ignore(()=>{on.android&&on.chrome&&s.contains(h.focusNode)&&eje(h.focusNode,s)&&(s.blur(),s.focus({preventScroll:!0}));let m=Dx(this.view.root);if(m)if(c.empty){if(on.gecko){let p=YNe(u.node,u.offset);if(p&&p!=3){let g=(p==1?Lte:Pte)(u.node,u.offset);g&&(u=new _c(g.node,g.offset))}}m.collapse(u.node,u.offset),c.bidiLevel!=null&&m.caretBidiLevel!==void 0&&(m.caretBidiLevel=c.bidiLevel)}else if(m.extend){m.collapse(u.node,u.offset);try{m.extend(d.node,d.offset)}catch{}}else{let p=document.createRange();c.anchor>c.head&&([u,d]=[d,u]),p.setEnd(d.node,d.offset),p.setStart(u.node,u.offset),m.removeAllRanges(),m.addRange(p)}o&&this.view.root.activeElement==s&&(s.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(u,d)),this.impreciseAnchor=u.precise?null:new _c(h.anchorNode,h.anchorOffset),this.impreciseHead=d.precise?null:new _c(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(t,n){return this.hasComposition&&n.empty&&Hy(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=Dx(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 c=this.coordsAt(n.head,-1),u=this.coordsAt(n.head,1);if(!c||!u||c.bottom>u.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=Ud(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&&!bi.get(i);)i=i.nextSibling;if(!i)return r+s.length;for(let o=0,a=r;;o++){let c=s.children[o];if(c.dom==i)return a;a+=c.length+c.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,c=!1;return this.tile.blockTiles((u,d)=>{if(u.isWidget()){if(u.flags&32&&d>=t)return!0;u.flags&16&&(i=!0)}else{let h=d+u.length;if(d<=t&&(s=u,r=t-d,i=h<t),h>=t&&!o&&(o=u,a=t-d,c=d>t),d>t&&o)return!0}}),!s&&!o?this.domAtPos(t,n):(i&&o?s=null:c&&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 i6?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 c=r(a,o);if(c)return c}if(o-=a.length,o<0)break}else if(i.isText()&&o<i.length){let a=co(i.text,o);if(a==o)return null;let c=Px(i.dom,o,a).getClientRects();for(let u=0;u<c.length;u++){let d=c[u];if(u==c.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,c=this.view.textDirection==Mr.LTR,u=0,d=(h,m,p)=>{for(let g=0;g<h.children.length&&!(m>r);g++){let b=h.children[g],v=m+b.length,x=b.dom.getBoundingClientRect(),{height:y}=x;if(p&&!g&&(u+=x.top-p.top),b instanceof Ad)v>s&&d(b,m,x);else if(m>=s&&(u>0&&n.push(-u),n.push(y+u),u=0,o)){let w=b.dom.lastChild,k=w?qy(w):[];if(k.length){let T=k[k.length-1],S=c?T.right-x.left:x.right-T.left;S>a&&(a=S,this.minWidth=i,this.minWidthFrom=m,this.minWidthTo=v)}}p&&g==h.children.length-1&&(u+=p.bottom-x.bottom),m=v+b.breakAfter}};return d(this.tile,0,null),n}textDirectionAt(t){let{tile:n}=this.tile.resolveBlock(t,1);return getComputedStyle(n.dom).direction=="rtl"?Mr.RTL:Mr.LTR}measureTextSize(){let t=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let a=0,c;for(let u of o.children){if(!u.isText()||/[^ -~]/.test(u.text))return;let d=qy(u.dom);if(d.length!=1)return;a+=d[0].width,c=d[0].height}if(a)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:a/o.length,textHeight:c}}});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=qy(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 i6(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(L3).map(i=>(this.dynamicDecorationMap[t++]=typeof i=="function")?i(this.view):i),s=!1,r=this.view.state.facet(IM).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(Zte).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(Xte))try{if(d(this.view,t.range,t))return!0}catch(h){Ba(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=RM(this.view),a={left:r.left-o.left,top:r.top-o.top,right:r.right+o.right,bottom:r.bottom+o.bottom},{offsetWidth:c,offsetHeight:u}=this.view.scrollDOM;if(wNe(this.view.scrollDOM,a,s.head<s.anchor?-1:1,t.x,t.y,Math.max(Math.min(t.xMargin,c),-c),Math.max(Math.min(t.yMargin,u),-u),this.view.textDirection==Mr.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(){aA(this.tile)}}function aA(e,t){let n=t==null?void 0:t.get(e);if(n!=1){n==null&&e.destroy();for(let s of e.children)aA(s,t)}}function GNe(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 sne(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let s=Lte(n.focusNode,n.focusOffset),r=Pte(n.focusNode,n.focusOffset),i=s||r;if(r&&s&&r.node!=s.node){let a=bi.get(r.node);if(!a||a.isText()&&a.text!=r.node.nodeValue)i=r;else if(e.docView.lastCompositionAfterCursor){let c=bi.get(s.node);!c||c.isText()&&c.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 KNe(e,t,n){let s=sne(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 c=t.invertedDesc;return{range:new ec(c.mapPos(i),c.mapPos(o),i,o),text:r}}function YNe(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 XNe=class{constructor(){this.changes=[]}compareRange(t,n){gg(t,n,this.changes)}comparePoint(t,n){gg(t,n,this.changes)}boundChange(t){gg(t,t,this.changes)}};function QNe(e,t,n){let s=new XNe;return Ms.compare(e,t,n,s),s.changes}class JNe{constructor(){this.changes=[]}compareRange(t,n){gg(t,n,this.changes)}comparePoint(){}boundChange(t){gg(t,t,this.changes)}}function ZNe(e,t,n){let s=new JNe;return Ms.compare(e,t,n,s),s.changes}function eje(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 tje(e,t){let n=!1;return t&&e.iterChangedRanges((s,r)=>{s<t.to&&r>t.from&&(n=!0)}),n}class i6 extends Al{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 nje(e,t,n=1){let s=e.charCategorizer(t),r=e.doc.lineAt(t),i=t-r.from;if(r.length==0)return Ye.cursor(t);i==0?n=1:i==r.length&&(n=-1);let o=i,a=i;n<0?o=co(r.text,i,!1):a=co(r.text,i);let c=s(r.text.slice(o,a));for(;o>0;){let u=co(r.text,o,!1);if(s(r.text.slice(u,o))!=c)break;o=u}for(;a<r.length;){let u=co(r.text,a);if(s(r.text.slice(a,u))!=c)break;a=u}return Ye.range(o+r.from,a+r.from)}function sje(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,c=Math.floor((r-n.top-(e.defaultLineHeight-a)*.5)/a);i+=c*e.viewState.heightOracle.lineLength}let o=e.state.sliceDoc(n.from,n.to);return n.from+YE(o,i,e.state.tabSize)}function lA(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==Mo.Text&&(r.type!=i.type||(n<0?i.from<t:i.to>t)))&&(r=i)}}return r||s}return s}function rje(e,t,n,s){let r=lA(e,t.head,t.assoc||-1),i=!s||r.type!=Mo.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),c=e.posAtCoords({x:n==(a==Mr.LTR)?o.right-1:o.left+1,y:(i.top+i.bottom)/2});if(c!=null)return Ye.cursor(c,n?-1:1)}return Ye.cursor(n?r.to:r.from,n?-1:1)}function Y$(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,c=null;;){let u=INe(r,i,o,a,n),d=Fte;if(!u){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),u=e.visualLineSide(r,!n)}if(c){if(!c(d))return a}else{if(!s)return u;c=s(d)}a=u}}function ije(e,t,n){let s=e.state.charCategorizer(t),r=s(n);return i=>{let o=s(i);return r==Jr.Space&&(r=o),r==o}}function oje(e,t,n,s){let r=t.head,i=n?1:-1;if(r==(n?e.state.doc.length:0))return Ye.cursor(r,t.assoc);let o=t.goalColumn,a,c=e.contentDOM.getBoundingClientRect(),u=e.coordsAtPos(r,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),d=e.documentTop;if(u)o==null&&(o=u.left-c.left),a=i<0?u.top:u.bottom;else{let g=e.viewState.lineBlockAt(r);o==null&&(o=Math.min(c.right-c.left,e.defaultCharacterWidth*(r-g.from))),a=(i<0?g.top:g.bottom)+d}let h=c.left+o,m=e.viewState.heightOracle.textHeight>>1,p=s??m;for(let g=0;;g+=m){let b=a+(p+g)*i,v=cA(e,{x:h,y:b},!1,i);if(n?b>c.bottom:b<c.top)return Ye.cursor(v.pos,v.assoc);let x=e.coordsAtPos(v.pos,v.assoc),y=x?(x.top+x.bottom)/2:0;if(!x||(n?y>a:y<a))return Ye.cursor(v.pos,v.assoc,void 0,o)}}function Uy(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 c=s||n||(t-i<o-t?-1:1);t=c<0?i:o,s=c}});if(!s)return t}}function rne(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=Uy(e,r.from,0);o!=r.from&&(i=Ye.cursor(o,-1))}else{let o=Uy(e,r.from,-1),a=Uy(e,r.to,1);(o!=r.from||a!=r.to)&&(i=Ye.range(r.from==r.anchor?o:a,r.from==r.head?o:a))}i&&(n||(n=t.ranges.slice()),n[s]=i)}return n?Ye.create(n,t.mainIndex):t}function o6(e,t,n){let s=Uy(e.state.facet(Lv).map(r=>r(e)),n.from,t.head>n.from?-1:1);return s==n.from?n:Ye.cursor(s,s<n.from?1:-1)}class hu{constructor(t,n){this.pos=t,this.assoc=n}}function cA(e,t,n,s){let r=e.contentDOM.getBoundingClientRect(),i=r.top+e.viewState.paddingTop,{x:o,y:a}=t,c=a-i,u;for(;;){if(c<0)return new hu(0,1);if(c>e.viewState.docHeight)return new hu(e.state.doc.length,-1);if(u=e.elementAtHeight(c),s==null)break;if(u.type==Mo.Text){if(s<0?u.to<e.viewport.from:u.from>e.viewport.to)break;let m=e.docView.coordsAt(s<0?u.from:u.to,s>0?-1:1);if(m&&(s<0?m.top<=c+i:m.bottom>=c+i))break}let h=e.viewState.heightOracle.textHeight/2;c=s>0?u.bottom+h:u.top-h}if(e.viewport.from>=u.to||e.viewport.to<=u.from){if(n)return null;if(u.type==Mo.Text){let h=sje(e,r,u,o,a);return new hu(h,h==u.from?1:-1)}}if(u.type!=Mo.Text)return c<(u.top+u.bottom)/2?new hu(u.from,1):new hu(u.to,-1);let d=e.docView.lineAt(u.from,2);return(!d||d.length!=u.length)&&(d=e.docView.lineAt(u.from,-2)),new aje(e,o,a,e.textDirectionAt(u.from)).scanTile(d,u.from)}class aje{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[xu.find(r,t-s.from,-1,n)].level==this.baseDir}dirAt(t,n){let{line:s,spans:r}=this.bidiSpansAt(t);return r[xu.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]),c,u,d=-1,h=1e9,m;e:for(;r<i;){let g=i-r,b=r+i>>1;t:if(o.has(b)){let x=r+Math.floor(Math.random()*g);for(let y=0;y<g;y++){if(!o.has(x)){b=x;break t}x++,x==i&&(x=r)}break e}o.add(b);let v=n(b);if(v)for(let x=0;x<v.length;x++){let y=v[x],w=0;if(!(y.width==0&&v.length>1)){if(y.bottom<this.y)(!c||c.bottom<y.bottom)&&(c=y),w=1;else if(y.top>this.y)(!u||u.top>y.top)&&(u=y),w=-1;else{let k=y.left>this.x?this.x-y.left:y.right<this.x?this.x-y.right:0,T=Math.abs(k);T<h&&(d=b,h=T,m=y),k&&(w=k<0==(this.baseDir==Mr.LTR)?-1:1)}w==-1&&(!a||this.baseDirAt(t[b],1))?i=b:w==1&&(!a||this.baseDirAt(t[b+1],-1))&&(r=b+1)}}}if(!m){if(!u&&!c)return{i:t[0],after:!1};let g=c&&(!u||this.y-c.bottom<u.top-this.y)?c:u;return this.y=(g.top+g.bottom)/2,this.scan(t,n,!0)}if(h&&!s){let{top:g,bottom:b}=m;if(c&&c.bottom>(g+g+b)/3)return this.y=c.bottom-1,this.scan(t,n,!0);if(u&&u.top<(g+b+b)/3)return this.y=u.top+1,this.scan(t,n,!0)}let p=(a?this.dirAt(t[d],1):this.baseDir)==Mr.LTR;return{i:d,after:this.x>(m.left+m.right)/2==p}}scanText(t,n){let s=[];for(let i=0;i<t.length;i=co(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 Px(t.dom,o,a).getClientRects()});return r.after?new hu(s[r.i+1],-1):new hu(s[r.i],1)}scanTile(t,n){if(!t.length)return new hu(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,c=n;a<t.children.length;a++)s.push(c+=t.children[a].length);let r=this.scan(s,a=>{let c=t.children[a];return c.flags&48?null:(c.dom.nodeType==1?c.dom:Px(c.dom,0,c.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 hu(s[r.i+1],-1):new hu(o,1)}}const I0="";class lje{constructor(t,n){this.points=t,this.view=n,this.text="",this.lineSeparator=n.state.facet(qs.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=I0}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=bi.get(r),a=r.nextSibling;if(a==n){o!=null&&o.breakAfter&&!a&&s!=this.view.contentDOM&&this.lineBreak();break}let c=bi.get(a);(o&&c?o.breakAfter:(o?o.breakAfter:SS(r))||SS(a)&&(r.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>i)&&!uje(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 c of this.points)c.node==t&&c.pos>this.text.length&&(c.pos-=o-1);s=i+o}}readNode(t){let n=bi.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+(cje(t,s.node,s.offset)?n:0))}}function cje(e,t,n){for(;;){if(!t||n<Ud(t))return!1;if(t==e)return!0;n=Lf(t)+1,t=t.parentNode}}function uje(e,t){let n;for(;!(e==t||!e);e=e.nextSibling){let s=bi.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 X${constructor(t,n){this.node=t,this.offset=n,this.pos=-1}}class dje{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=ine(t.docView.tile,n,s,0))){let c=i||o?[]:fje(t),u=new lje(c,t);u.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=u.text,this.newSel=mje(c,this.bounds.from)}else{let c=t.observer.selectionRange,u=i&&i.node==c.focusNode&&i.offset==c.focusOffset||!nA(t.contentDOM,c.focusNode)?a.main.head:t.docView.posFromDOM(c.focusNode,c.focusOffset),d=o&&o.node==c.anchorNode&&o.offset==c.anchorOffset||!nA(t.contentDOM,c.anchorNode)?a.main.anchor:t.docView.posFromDOM(c.anchorNode,c.anchorOffset),h=t.viewport;if((on.ios||on.chrome)&&a.main.empty&&u!=d&&(h.from>0||h.to<t.state.doc.length)){let m=Math.min(u,d),p=Math.max(u,d),g=h.from-m,b=h.to-p;(g==0||g==1||m==0)&&(b==0||b==-1||p==t.state.doc.length)&&(u=0,d=t.state.doc.length)}if(t.inputState.composing>-1&&a.ranges.length>1)this.newSel=a.replaceRange(Ye.range(d,u));else if(t.lineWrapping&&d==u&&!(a.main.empty&&a.main.head==u)&&t.inputState.lastTouchTime>Date.now()-100){let m=t.coordsAtPos(u,-1),p=0;m&&(p=t.inputState.lastTouchY<=m.bottom?-1:1),this.newSel=Ye.create([Ye.cursor(u,p)])}else this.newSel=Ye.single(d,u)}}}function ine(e,t,n,s){if(e.isComposite()){let r=-1,i=-1,o=-1,a=-1;for(let c=0,u=s,d=s;c<e.children.length;c++){let h=e.children[c],m=u+h.length;if(u<t&&m>n)return ine(h,t,n,u);if(m>=t&&r==-1&&(r=c,i=u),u>n&&h.dom.parentNode==e.dom){o=c,a=d;break}d=m,u=m+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 one(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:c}=t.bounds,u=i.from,d=null;(o===8||on.android&&t.text.length<c-a)&&(u=i.to,d="end");let h=r.doc.sliceString(a,c,I0),m,p;!i.empty&&i.from>=a&&i.to<=c&&(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(m=t.text.length-(h.length-(i.to-a)))?n={from:i.from,to:i.to,insert:er.of(t.text.slice(i.from-a,m).split(I0))}:(p=ane(h,t.text,u-a,d))&&(on.chrome&&o==13&&p.toB==p.from+2&&t.text.slice(p.from,p.toB)==I0+I0&&p.toB--,n={from:a+p.from,to:a+p.toA,insert:er.of(t.text.slice(p.from,p.toB).split(I0))})}else s&&(!e.hasFocus&&r.facet(ld)||AS(s,i))&&(s=null);if(!n&&!s)return!1;if((on.mac||on.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=Ye.single(s.main.anchor-1,s.main.head-1)),n={from:n.from,to:n.to,insert:er.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)}:on.chrome&&n&&n.from==n.to&&n.from==i.head&&n.insert.toString()==`
 `&&e.lineWrapping&&(s&&(s=Ye.single(s.main.anchor-1,s.main.head-1)),n={from:i.from,to:i.to,insert:er.of([" "])}),n)return DM(e,n,s,o);if(s&&!AS(s,i)){let a=!1,c="select";return e.inputState.lastSelectionTime>Date.now()-50&&(e.inputState.lastSelectionOrigin=="select"&&(a=!0),c=e.inputState.lastSelectionOrigin,c=="select.pointer"&&(s=rne(r.facet(Lv).map(u=>u(e)),s))),e.dispatch({selection:s,scrollIntoView:a,userEvent:c}),!0}else return!1}function DM(e,t,n,s=-1){if(on.ios&&e.inputState.flushIOSKey(t))return!0;let r=e.state.selection.main;if(on.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&&bg(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)&&bg(e.contentDOM,"Backspace",8)||t.from==r.from&&t.to==r.to+1&&t.insert.length==0&&bg(e.contentDOM,"Delete",46)))return!0;let i=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,a=()=>o||(o=hje(e,t,n));return e.state.facet(Wte).some(c=>c(e,t.from,t.to,i,a))||e.dispatch(a()),!0}function hje(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 c=t.from<i.from?-1:1,u=c<0?i.from:i.to,d=Uy(r.facet(Lv).map(h=>h(e)),u,c);t.from==d&&(o=d)}if(o>-1)s={changes:t,selection:Ye.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 c=i.from<t.from?r.sliceDoc(i.from,t.from):"",u=i.to>t.to?r.sliceDoc(t.to,i.to):"";s=r.replaceSelection(e.state.toText(c+t.insert.sliceString(0,void 0,e.state.lineBreak)+u))}else{let c=r.changes(t),u=n&&n.main.to<=c.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,m=n&&sne(e,n.main.head);if(m){let g=t.insert.length-(t.to-t.from);h={from:m.from,to:m.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:c,range:u||g.map(c)};let b=g.to-p,v=b-d.length;if(e.state.sliceDoc(v,b)!=d||b>=h.from&&v<=h.to)return{range:g};let x=r.changes({from:v,to:b,insert:t.insert}),y=g.to-i.to;return{changes:x,range:u?Ye.range(Math.max(0,u.anchor+y),Math.max(0,u.head+y)):g.map(x)}})}else s={changes:c,selection:u&&r.selection.replaceRange(u)}}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 ane(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 c=Math.max(0,i-Math.min(o,a));n-=o+c-i}if(o<i&&e.length<t.length){let c=n<=i&&n>=o?i-n:0;i-=c,a=i+(a-o),o=i}else if(a<i){let c=n<=i&&n>=a?i-n:0;i-=c,o=i+(o-a),a=i}return{from:i,toA:o,toB:a}}function fje(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 X$(n,s)),(r!=n||i!=s)&&t.push(new X$(r,i))),t}function mje(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?Ye.single(n+t,s+t):null}function AS(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class pje{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,on.safari&&t.contentDOM.addEventListener("input",()=>null),on.gecko&&jje(t.contentDOM.ownerDocument)}handleEvent(t){!_je(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=gje(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&&cne.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),on.android&&on.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let n;return on.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&!t.shiftKey&&((n=lne.find(s=>s.keyCode==t.keyCode))&&!t.ctrlKey||bje.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,bg(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:on.safari&&!on.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 Q$(e,t){return(n,s)=>{try{return t.call(e,s,n)}catch(r){Ba(n.state,r)}}}function gje(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 c=i[a];c&&n(a).handlers.push(Q$(s.value,c))}if(o)for(let a in o){let c=o[a];c&&n(a).observers.push(Q$(s.value,c))}}for(let s in Tc)n(s).handlers.push(Tc[s]);for(let s in Va)n(s).observers.push(Va[s]);return t}const lne=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],bje="dthko",cne=[16,17,18,20,91,92,224,225],kk=6;function _k(e){return Math.max(0,e)*.7+8}function yje(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}class xje{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=Ite(t.contentDOM),this.atoms=t.state.facet(Lv).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(qs.allowMultipleSelections)&&vje(t,n),this.dragging=kje(t,n)&&hne(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&&yje(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 c=RM(this.view);t.clientX-c.left<=r+kk?n=-_k(r-t.clientX):t.clientX+c.right>=o-kk&&(n=_k(t.clientX-o)),t.clientY-c.top<=i+kk?s=-_k(i-t.clientY):t.clientY+c.bottom>=a-kk&&(s=_k(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=rne(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 vje(e,t){let n=e.state.facet(qte);return n.length?n[0](t):on.mac?t.metaKey:t.ctrlKey}function wje(e,t){let n=e.state.facet(Hte);return n.length?n[0](t):on.mac?!t.altKey:!t.ctrlKey}function kje(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let s=Dx(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 _je(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=bi.get(n))&&s.isWidget()&&!s.isHidden&&s.widget.ignoreEvent(t))return!1;return!0}const Tc=Object.create(null),Va=Object.create(null),une=on.ie&&on.ie_version<15||on.ios&&on.webkit_version<604;function Sje(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(),dne(e,n.value)},50)}function B3(e,t,n){for(let s of e.facet(t))n=s(n,e);return n}function dne(e,t){t=B3(e.state,NM,t);let{state:n}=e,s,r=1,i=n.toText(t),o=i.lines==n.selection.ranges.length;if(uA!=null&&n.selection.ranges.every(c=>c.empty)&&uA==i.toString()){let c=-1;s=n.changeByRange(u=>{let d=n.doc.lineAt(u.from);if(d.from==c)return{range:u};c=d.from;let h=n.toText((o?i.line(r++).text:t)+n.lineBreak);return{changes:{from:d.from,insert:h},range:Ye.cursor(u.from+h.length)}})}else o?s=n.changeByRange(c=>{let u=i.line(r++);return{changes:{from:c.from,to:c.to,insert:u.text},range:Ye.cursor(c.from+u.length)}}):s=n.replaceSelection(i);e.dispatch(s,{userEvent:"input.paste",scrollIntoView:!0})}Va.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft};Va.wheel=Va.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()};Tc.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1);Va.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")};Va.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")};Tc.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(Ute))if(n=s(e,t),n)break;if(!n&&t.button==0&&(n=Tje(e,t)),n){let s=!e.hasFocus;e.inputState.startMouseSelection(new xje(e,t,n,s)),s&&e.observer.ignore(()=>{Rte(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 J$(e,t,n,s){if(s==1)return Ye.cursor(t,n);if(s==2)return nje(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++,Ye.range(o,a)}}const Cje=on.ie&&on.ie_version<=11;let Z$=null,ez=0,tz=0;function hne(e){if(!Cje)return e.detail;let t=Z$,n=tz;return Z$=e,tz=Date.now(),ez=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(ez+1)%3:1}function Tje(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),s=hne(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 c=e.posAndSideAtCoords({x:i.clientX,y:i.clientY},!1),u,d=J$(e,c.pos,c.assoc,s);if(n.pos!=c.pos&&!o){let h=J$(e,n.pos,n.assoc,s),m=Math.min(h.from,d.from),p=Math.max(h.to,d.to);d=m<d.from?Ye.range(m,p,d.assoc):Ye.range(p,m,d.assoc)}return o?r.replaceRange(r.main.extend(d.from,d.to,d.assoc)):a&&s==1&&r.ranges.length>1&&(u=Eje(r,c.pos))?u:a?r.addRange(d):Ye.create([d])}}}function Eje(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 Ye.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}Tc.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=Ye.range(i,o))}}let{inputState:s}=e;return s.mouseSelection&&(s.mouseSelection.dragging=!0),s.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",B3(e.state,jM,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1};Tc.dragend=e=>(e.inputState.draggedContent=null,!1);function nz(e,t,n,s){if(n=B3(e.state,NM,n),!n)return;let r=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:i}=e.inputState,o=s&&i&&wje(e,t)?{from:i.from,to:i.to}:null,a={from:r,insert:n},c=e.state.changes(o?[o,a]:a);e.focus(),e.dispatch({changes:c,selection:{anchor:c.mapPos(r,-1),head:c.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"}),e.inputState.draggedContent=null}Tc.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&&nz(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 nz(e,t,s,!0),!0}return!1};Tc.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=une?null:t.clipboardData;return n?(dne(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(Sje(e),!1)};function Aje(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 Nje(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:B3(e,jM,t.join(e.lineBreak)),ranges:n,linewise:s}}let uA=null;Tc.copy=Tc.cut=(e,t)=>{if(!Fy(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:s,linewise:r}=Nje(e.state);if(!n&&!r)return!1;uA=r?n:null,t.type=="cut"&&!e.state.readOnly&&e.dispatch({changes:s,scrollIntoView:!0,userEvent:"delete.cut"});let i=une?null:t.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(Aje(e,n),!1)};const fne=nh.define();function mne(e,t){let n=[];for(let s of e.facet(Gte)){let r=s(e,t);r&&n.push(r)}return n.length?e.update({effects:n,annotations:fne.of(!0)}):null}function pne(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=mne(e.state,t);n?e.dispatch(n):e.update([])}},10)}Va.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),pne(e)};Va.blur=e=>{e.observer.clearSelectionRange(),pne(e)};Va.compositionstart=Va.compositionupdate=e=>{e.observer.editContext||(e.inputState.compositionFirstChange==null&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))};Va.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,on.chrome&&on.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))};Va.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()};Tc.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],c=e.posAtDOM(a.startContainer,a.startOffset),u=e.posAtDOM(a.endContainer,a.endOffset);return DM(e,{from:c,to:u,insert:e.state.toText(i)},null),!0}}let r;if(on.chrome&&on.android&&(r=lne.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 on.ios&&t.inputType=="deleteContentForward"&&e.observer.flushSoon(),on.safari&&t.inputType=="insertText"&&e.inputState.composing>=0&&setTimeout(()=>Va.compositionend(e,t),20),!1};const sz=new Set;function jje(e){sz.has(e)||(sz.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}const rz=["pre-wrap","normal","pre-line","break-spaces"];let e1=!1;function iz(){e1=!1}class Mje{constructor(t){this.lineWrapping=t,this.doc=er.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 rz.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=rz.indexOf(t)>-1,c=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,c){this.heightSamples={};for(let u=0;u<o.length;u++){let d=o[u];d<0?u++:this.heightSamples[Math.floor(d*10)]=!0}}return c}}class Ije{constructor(t,n){this.from=t,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class kc{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"?Mo.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 bp?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 kc(this.from,this.length+t.length,this.top,this.height+t.height,n)}}var Br=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}(Br||(Br={}));const B2=.001;class pa{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)>B2&&(e1=!0),this.height=t)}replace(t,n,s){return pa.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:c,toA:u,fromB:d,toB:h}=r[a],m=i.lineAt(c,Br.ByPosNoHeight,s.setDoc(n),0,0),p=m.to>=u?m:i.lineAt(u,Br.ByPosNoHeight,s,0,0);for(h+=p.to-u,u=p.to;a>0&&m.from<=r[a-1].toA;)c=r[a-1].fromA,d=r[a-1].fromB,a--,c<m.from&&(m=i.lineAt(c,Br.ByPosNoHeight,s,0,0));d+=m.from-c,c=m.from;let g=LM.build(s.setDoc(o),t,d,h);i=NS(i,i.replace(c,u,g))}return i.updateHeight(s,0)}static empty(){return new al(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 Dje(pa.of(t.slice(0,n)),o,pa.of(t.slice(s)))}}function NS(e,t){return e==t?e:(e.constructor!=t.constructor&&(e1=!0),t)}pa.prototype.size=1;const Rje=Sn.replace({});class gne extends pa{constructor(t,n,s){super(t,n),this.deco=s,this.spaceAbove=0}mainBlock(t,n){return new kc(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 kc(r,0,s,this.spaceAbove,Rje):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,Br.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 al extends gne{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 kc(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 al||r instanceof vo&&r.flags&4)&&Math.abs(this.length-r.length)<10?(r instanceof vo?r=new al(r.length,this.height,this.spaceAbove):r.height=this.height,this.outdated||(r.outdated=!1),r):pa.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 vo extends pa{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 c=Math.min(this.height,t.lineHeight*i);o=c/i,this.length>i+1&&(a=(this.height-c)/(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:c}=this.heightMetrics(n,r);if(n.lineWrapping){let u=r+(t<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(t-s)/this.height))*this.length)),d=n.doc.lineAt(u),h=a+d.length*c,m=Math.max(s,t-h/2);return new kc(d.from,d.length,m,h,0)}else{let u=Math.max(0,Math.min(o-i,Math.floor((t-s)/a))),{from:d,length:h}=n.doc.line(i+u);return new kc(d,h,s+a*u,a,0)}}lineAt(t,n,s,r,i){if(n==Br.ByHeight)return this.blockAt(t,s,r,i);if(n==Br.ByPosNoHeight){let{from:p,to:g}=s.doc.lineAt(t);return new kc(p,g-p,0,0,0)}let{firstLine:o,perLine:a,perChar:c}=this.heightMetrics(s,i),u=s.doc.lineAt(t),d=a+u.length*c,h=u.number-o,m=r+a*h+c*(u.from-i-h);return new kc(u.from,u.length,Math.max(r,Math.min(m,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:c,perChar:u}=this.heightMetrics(s,i);for(let d=t,h=r;d<=n;){let m=s.doc.lineAt(d);if(d==t){let g=m.number-a;h+=c*g+u*(t-i-g)}let p=c+u*m.length;o(new kc(m.from,m.length,h,p,0)),h+=p,d=m.to+1}}replace(t,n,s){let r=this.length-n;if(r>0){let i=s[s.length-1];i instanceof vo?s[s.length-1]=new vo(i.length+r):s.push(null,new vo(r-1))}if(t>0){let i=s[0];i instanceof vo?s[0]=new vo(t+i.length):s.unshift(new vo(t-1),null)}return pa.of(s)}decomposeLeft(t,n){n.push(new vo(t-1),null)}decomposeRight(t,n){n.push(null,new vo(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),c=-1;for(r.from>n&&o.push(new vo(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++],m=0;h<0&&(m=-h,h=r.heights[r.index++]),c==-1?c=h:Math.abs(h-c)>=B2&&(c=-2);let p=new al(d,h,m);p.outdated=!1,o.push(p),a+=d+1}a<=i&&o.push(null,new vo(i-a).updateHeight(t,a));let u=pa.of(o);return(c<0||Math.abs(u.height-this.height)>=B2||Math.abs(c-this.heightMetrics(t,n).perLine)>=B2)&&(e1=!0),NS(this,u)}else(s||this.outdated)&&(this.setHeight(t.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Dje extends pa{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,c=n==Br.ByHeight?t<o:t<a,u=c?this.left.lineAt(t,n,s,r,i):this.right.lineAt(t,n,s,o,a);if(this.break||(c?u.to<a:u.from>a))return u;let d=n==Br.ByPosNoHeight?Br.ByPosNoHeight:Br.ByPos;return c?u.join(this.right.lineAt(a,d,s,o,a)):this.left.lineAt(a,d,s,r,i).join(u)}forEachLine(t,n,s,r,i,o){let a=r+this.left.height,c=i+this.left.length+this.break;if(this.break)t<c&&this.left.forEachLine(t,n,s,r,i,o),n>=c&&this.right.forEachLine(t,n,s,a,c,o);else{let u=this.lineAt(c,Br.ByPos,s,r,i);t<u.from&&this.left.forEachLine(t,u.from-1,s,r,i,o),u.to>=t&&u.from<=n&&o(u),n>u.to&&this.right.forEachLine(u.to+1,n,s,a,c,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&&oz(i,o-1),n<this.length){let a=i.length;this.decomposeRight(n,i),oz(i,a)}return pa.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?pa.of(this.break?[t,null,n]:[t,n]):(this.left=NS(this.left,t),this.right=NS(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,c=null;return r&&r.from<=n+i.length&&r.more?c=i=i.updateHeight(t,n,s,r):i.updateHeight(t,n,s),r&&r.from<=a+o.length&&r.more?c=o=o.updateHeight(t,a,s,r):o.updateHeight(t,a,s),c?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 oz(e,t){let n,s;e[t]==null&&(n=e[t-1])instanceof vo&&(s=e[t+1])instanceof vo&&e.splice(t-1,3,new vo(n.length+1+s.length))}const Lje=5;class LM{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 al?r.length+=s-this.pos:(s>this.pos||!this.isCovered)&&this.nodes.push(new al(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 gne(o,r,s)):(o||i||r>=Lje)&&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 al(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,n){let s=new vo(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 al)return t;let n=new al(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 al)&&!this.isCovered?this.nodes.push(new al(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 al&&r.updateHeight(this.oracle,s),s+=r?r.length:1;return this.nodes}static build(t,n,s,r){let i=new LM(s,t);return Ms.spans(n,s,r,i,0),i.finish(s)}}function Pje(e,t,n){let s=new Oje;return Ms.compare(e,t,n,s,0),s.changes}class Oje{constructor(){this.changes=[]}compareRange(){}comparePoint(t,n,s,r){(t<n||s&&s.heightRelevant||r&&r.heightRelevant)&&gg(t,n,this.changes,5)}}function Bje(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),c=Math.min(r.innerHeight,n.bottom);for(let u=e.parentNode;u&&u!=s.body;)if(u.nodeType==1){let d=u,h=window.getComputedStyle(d);if((d.scrollHeight>d.clientHeight||d.scrollWidth>d.clientWidth)&&h.overflow!="visible"){let m=d.getBoundingClientRect();i=Math.max(i,m.left),o=Math.min(o,m.right),a=Math.max(a,m.top),c=Math.min(u==e.parentNode?r.innerHeight:c,m.bottom)}u=h.position=="absolute"||h.position=="fixed"?d.offsetParent:d.parentNode}else if(u.nodeType==11)u=u.host;else break;return{left:i-n.left,right:Math.max(i,o)-n.left,top:a-(n.top+t),bottom:Math.max(a,c)-(n.top+t)}}function $je(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 zje(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class a6{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 Fje(this.displaySize*(n?t.scaleY:t.scaleX),n)}).range(this.from,this.to)}}class Fje extends Al{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 az{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=lz,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Mr.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let s=n.facet(MM).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new Mje(s),this.stateDeco=cz(n),this.heightMap=pa.empty().applyChanges(this.stateDeco,er.empty,this.heightOracle.setDoc(n.doc),[new ec(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 Sk(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?lz:new PM(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(ry(t,this.scaler))})}update(t,n=null){this.state=t.state;let s=this.stateDeco;this.stateDeco=cz(this.state);let r=t.changedRanges,i=ec.extendWithRanges(r,Pje(s,this.stateDeco,t?t.changes:Ui.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);iz(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=o||e1)&&(t.flags|=2),a?(this.scrollAnchorPos=t.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let c=i.length?this.mapViewport(this.viewport,t.changes):this.viewport;(n&&(n.range.head<c.from||n.range.head>c.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,n));let u=c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,t.flags|=this.updateForViewport(),(u||!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(Yte)&&(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"?Mr.RTL:Mr.LTR;let o=this.heightOracle.mustRefreshForWrapping(i)||this.mustMeasureContent==="refresh",a=n.getBoundingClientRect(),c=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let u=0,d=0;if(a.width&&a.height){let{scaleX:T,scaleY:S}=Mte(n,a);(T>.005&&Math.abs(this.scaleX-T)>.005||S>.005&&Math.abs(this.scaleY-S)>.005)&&(this.scaleX=T,this.scaleY=S,u|=16,o=c=!0)}let h=(parseInt(s.paddingTop)||0)*this.scaleY,m=(parseInt(s.paddingBottom)||0)*this.scaleY;(this.paddingTop!=h||this.paddingBottom!=m)&&(this.paddingTop=h,this.paddingBottom=m,u|=18),this.editorWidth!=t.scrollDOM.clientWidth&&(r.lineWrapping&&(c=!0),this.editorWidth=t.scrollDOM.clientWidth,u|=16);let p=Ite(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=Dte(this.scrollParent||t.win);let b=(this.printing?zje:Bje)(n,this.paddingTop),v=b.top-this.pixelViewport.top,x=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let y=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(y!=this.inView&&(this.inView=y,y&&(c=!0)),!this.inView&&!this.scrollTarget&&!$je(t.dom))return 0;let w=a.width;if((this.contentDOMWidth!=w||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=t.scrollDOM.clientHeight,u|=16),c){let T=t.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(T)&&(o=!0),o||r.lineWrapping&&Math.abs(w-this.contentDOMWidth)>r.charWidth){let{lineHeight:S,charWidth:C,textHeight:_}=t.docView.measureTextSize();o=S>0&&r.refresh(i,S,C,_,Math.max(5,w/C),T),o&&(t.docView.minWidth=0,u|=16)}v>0&&x>0?d=Math.max(v,x):v<0&&x<0&&(d=Math.min(v,x)),iz();for(let S of this.viewports){let C=S.from==this.viewport.from?T:t.docView.measureVisibleLineHeights(S);this.heightMap=(o?pa.empty().applyChanges(this.stateDeco,er.empty,this.heightOracle,[new ec(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new Ije(S.from,C))}e1&&(u|=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&&(u&2&&(u|=this.updateScaler()),this.viewport=this.getViewport(d,this.scrollTarget),u|=this.updateForViewport()),(u&2||k)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,t)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),u}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,c=new Sk(r.lineAt(o-s*1e3,Br.ByHeight,i,0,0).from,r.lineAt(a+(1-s)*1e3,Br.ByHeight,i,0,0).to);if(n){let{head:u}=n.range;if(u<c.from||u>c.to){let d=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),h=r.lineAt(u,Br.ByPos,i,0,0),m;n.y=="center"?m=(h.top+h.bottom)/2-d/2:n.y=="start"||n.y=="nearest"&&u<c.from?m=h.top:m=h.bottom-d,c=new Sk(r.lineAt(m-1e3/2,Br.ByHeight,i,0,0).from,r.lineAt(m+d+1e3/2,Br.ByHeight,i,0,0).to)}}return c}mapViewport(t,n){let s=n.mapPos(t.from,-1),r=n.mapPos(t.to,1);return new Sk(this.heightMap.lineAt(s,Br.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,Br.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,Br.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(n,Br.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 a6(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!=Mr.LTR&&!s)return[];let a=[],c=(d,h,m,p)=>{if(h-d<i)return;let g=this.state.selection.main,b=[g.from];g.empty||b.push(g.to);for(let x of b)if(x>d&&x<h){c(d,x-10,m,p),c(x+10,h,m,p);return}let v=Hje(t,x=>x.from>=m.from&&x.to<=m.to&&Math.abs(x.from-d)<i&&Math.abs(x.to-h)<i&&!b.some(y=>x.from<y&&x.to>y));if(!v){if(h<m.to&&n&&s&&n.visibleRanges.some(w=>w.from<=h&&w.to>=h)){let w=n.moveToLineBoundary(Ye.cursor(h),!1,!0).head;w>d&&(h=w)}let x=this.gapSize(m,d,h,p),y=s||x<2e6?x:2e6;v=new a6(d,h,x,y)}a.push(v)},u=d=>{if(d.length<o||d.type!=Mo.Text)return;let h=qje(d.from,d.to,this.stateDeco);if(h.total<o)return;let m=this.scrollTarget?this.scrollTarget.range.head:null,p,g;if(s){let b=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,v,x;if(m!=null){let y=Tk(h,m),w=((this.visibleBottom-this.visibleTop)/2+b)/d.height;v=y-w,x=y+w}else v=(this.visibleTop-d.top-b)/d.height,x=(this.visibleBottom-d.top+b)/d.height;p=Ck(h,v),g=Ck(h,x)}else{let b=h.total*this.heightOracle.charWidth,v=r*this.heightOracle.charWidth,x=0;if(b>2e6)for(let S of t)S.from>=d.from&&S.from<d.to&&S.size!=S.displaySize&&S.from*this.heightOracle.charWidth+x<this.pixelViewport.left&&(x=S.size-S.displaySize);let y=this.pixelViewport.left+x,w=this.pixelViewport.right+x,k,T;if(m!=null){let S=Tk(h,m),C=((w-y)/2+v)/b;k=S-C,T=S+C}else k=(y-v)/b,T=(w+v)/b;p=Ck(h,k),g=Ck(h,T)}p>d.from&&c(d.from,p,d,h),g<d.to&&c(g,d.to,d,h)};for(let d of this.viewportLines)Array.isArray(d.type)?d.type.forEach(u):u(d);return a}gapSize(t,n,s,r){let i=Tk(r,s)-Tk(r,n);return this.heightOracle.lineWrapping?t.height*i:r.total*this.heightOracle.charWidth*i}updateLineGaps(t){a6.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)||ry(this.heightMap.lineAt(t,Br.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)||ry(this.heightMap.lineAt(this.scaler.fromDOM(t),Br.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 ry(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 Sk{constructor(t,n){this.from=t,this.to=n}}function qje(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 Ck({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 Tk(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 Hje(e,t){for(let n of e)if(t(n))return n}const lz={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function cz(e){let t=e.facet(L3).filter(s=>typeof s!="function"),n=e.facet(IM).filter(s=>typeof s!="function");return n.length&&t.push(Ms.join(n)),t}class PM{constructor(t,n,s){let r=0,i=0,o=0;this.viewports=s.map(({from:a,to:c})=>{let u=n.lineAt(a,Br.ByPos,t,0,0).top,d=n.lineAt(c,Br.ByPos,t,0,0).bottom;return r+=d-u,{from:a,to:c,top:u,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 PM?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 ry(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),s=t.toDOM(e.bottom);return new kc(e.from,e.length,n,s-n,Array.isArray(e._content)?e._content.map(r=>ry(r,t)):e._content)}const Ek=an.define({combine:e=>e.join(" ")}),dA=an.define({combine:e=>e.indexOf(!0)>-1}),hA=Rf.newName(),bne=Rf.newName(),yne=Rf.newName(),xne={"&light":"."+bne,"&dark":"."+yne};function fA(e,t,n){return new Rf(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 Uje=fA("."+hA,{"&":{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"}},xne),Vje={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},l6=on.ie&&on.ie_version<=11;class Wje{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new kNe,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);(on.ie&&on.ie_version<=11||on.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&&on.android&&t.constructor.EDIT_CONTEXT!==!1&&!(on.chrome&&on.chrome_version<126)&&(this.editContext=new Kje(t),t.state.facet(ld)&&(t.contentDOM.editContext=this.editContext.editContext)),l6&&(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(ld)?s.root.activeElement!=this.dom:!Fy(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}(on.ie&&on.ie_version<=11||on.android&&on.chrome)&&!s.state.selection.main.empty&&r.focusNode&&Hy(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,n=Dx(t.root);if(!n)return!1;let s=on.safari&&t.root.nodeType==11&&t.root.activeElement==this.dom&&Gje(this.view,n)||n;if(!s||this.selectionRange.eq(s))return!1;let r=Fy(this.dom,s);return r&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&SNe(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,Vje),l6&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),l6&&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&&bg(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&&Fy(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 dje(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=one(this.view,n);return this.view.state==s&&(n.domChanged||n.newSel&&!AS(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=uz(n,t.previousSibling||t.target.previousSibling,-1),r=uz(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(ld)!=t.state.facet(ld)&&(t.view.contentDOM.editContext=t.state.facet(ld)?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 uz(e,t,n){for(;t;){let s=bi.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 dz(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 Hy(o.node,o.offset,r,i)&&([n,s,r,i]=[r,i,n,s]),{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:i}}function Gje(e,t){if(t.getComposedRanges){let r=t.getComposedRanges(e.root)[0];if(r)return dz(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?dz(e,n):null}class Kje{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),c=this.toEditorPos(s.updateRangeEnd);t.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:s.updateRangeStart,editorBase:a,drifted:!1});let u=c-a>s.text.length;a==this.from&&i<this.from?a=i:c==this.to&&i>this.to&&(c=i);let d=ane(t.state.sliceDoc(a,c),s.text,(u?r.from:r.to)-a,u?"end":null);if(!d){let m=Ye.single(this.toEditorPos(s.selectionStart),this.toEditorPos(s.selectionEnd));AS(m,r)||t.dispatch({selection:m,userEvent:"select"});return}let h={from:d.from+a,to:d.toA+a,insert:er.of(s.text.slice(d.from,d.toB).split(`
`))};if((on.mac||on.android)&&h.from==o-1&&/^\. ?$/.test(s.text)&&t.contentDOM.getAttribute("autocorrect")=="off"&&(h={from:a,to:c,insert:er.of([s.text.replace("."," ")])}),this.pendingContextChange=h,!t.state.readOnly){let m=this.to-this.from+(h.to-h.from+h.insert.length);DM(t,h,Ye.single(this.toEditorPos(s.selectionStart,m),this.toEditorPos(s.selectionEnd,m)))}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 c=t.coordsForChar(o);i=c&&new DOMRect(c.left,c.top,c.right-c.left,c.bottom-c.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 c=this.toEditorPos(i.rangeStart),u=this.toEditorPos(i.rangeEnd);if(c<u){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(c,u))}}}t.dispatch({effects:Qte.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=Dx(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,c,u)=>{if(s)return;let d=u.length-(o-i);if(r&&o>=r.to)if(r.from==i&&r.to==o&&r.insert.eq(u)){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+u.length>3e4){s=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(o),u.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 It{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||_Ne(t.parent)||document,this.viewState=new az(this,t.state||qs.create(t)),t.scrollTo&&t.scrollTo.is(wk)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(K0).map(r=>new n6(r));for(let r of this.plugins)r.update(this);this.observer=new Wje(this),this.inputState=new pje(this),this.inputState.ensureHandlers(this.plugins),this.docView=new K$(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 Wi?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 m of t){if(m.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=m.state}if(this.destroyed){this.viewState.state=i;return}let o=this.hasFocus,a=0,c=null;t.some(m=>m.annotation(fne))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,c=mne(i,o),c||(a=1));let u=this.observer.delayedAndroidKey,d=null;if(u?(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(qs.phrases)!=this.state.facet(qs.phrases))return this.setState(i);r=CS.create(this,i,t),r.flags|=a;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let m of t){if(h&&(h=h.map(m.changes)),m.scrollIntoView){let{main:p}=m.state.selection,{x:g,y:b}=this.state.facet(It.cursorScrollMargin);h=new yg(p.empty?p:Ye.cursor(p.head,p.head>p.anchor?-1:1),"nearest","nearest",b,g)}for(let p of m.effects)p.is(wk)&&(h=p.value.clip(this.state))}this.viewState.update(r,h),this.bidiCache=jS.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),n=this.docView.update(r),this.state.facet(sy)!=this.styleModules&&this.mountStyles(),s=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(n,t.some(m=>m.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet(Ek)!=r.state.facet(Ek)&&(this.viewState.mustMeasureContent=!0),(n||s||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!r.empty)for(let m of this.state.facet(oA))try{m(r)}catch(p){Ba(this.state,p,"update listener")}(c||d)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),d&&!one(this,d)&&u.force&&bg(this.contentDOM,u.key,u.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 az(this,t),this.plugins=t.facet(K0).map(s=>new n6(s)),this.pluginMap.clear();for(let s of this.plugins)s.update(this);this.docView.destroy(),this.docView=new K$(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(K0),s=t.state.facet(K0);if(n!=s){let r=[];for(let i of s){let o=n.indexOf(i);if(o<0)r.push(new n6(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){Ba(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(Dte(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 c=this.viewState.measure();if(!c&&!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 u=[];c&4||([this.measureRequests,u]=[u,this.measureRequests]);let d=u.map(p=>{try{return p.read(this)}catch(g){return Ba(this.state,g),hz}}),h=CS.create(this,this.state,[]),m=!1;h.flags|=c,n?n.flags|=c:n=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),m=this.docView.update(h),m&&this.docViewUpdate());for(let p=0;p<u.length;p++)if(d[p]!=hz)try{let g=u[p];g.write&&g.write(d[p],this)}catch(g){Ba(this.state,g)}if(m&&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(oA))a(n)}get themeClasses(){return hA+" "+(this.state.facet(dA)?yne:bne)+" "+this.state.facet(Ek)}updateAttrs(){let t=fz(this,Jte,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(ld)?"true":"false",class:"cm-content",style:`${on.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),fz(this,MM,n);let s=this.observer.ignore(()=>{let r=q$(this.contentDOM,this.contentAttrs,n),i=q$(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(It.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(sy);let t=this.state.facet(It.cspNonce);Rf.mount(this.root,this.styleModules.concat(Uje).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 o6(this,t,Y$(this,t,n,s))}moveByGroup(t,n){return o6(this,t,Y$(this,t,n,s=>ije(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 Ye.cursor(i.side(n,r)+t.from,i.forward(!n,r)?1:-1)}moveToLineBoundary(t,n,s=!0){return rje(this,t,n,s)}moveVertically(t,n,s){return o6(this,t,oje(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=cA(this,t,n);return s&&s.pos}posAndSideAtCoords(t,n=!0){return this.readMeasured(),cA(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[xu.find(i,t-r.from,-1,n)];return Lx(s,o.dir==Mr.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(Kte)||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>Yje)return zte(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||$te(i.isolates,s=V$(this,t))))return i.order;s||(s=V$(this,t));let r=MNe(t.text,n,s);return this.bidiCache.push(new jS(t.from,t.to,n,s,!0,r)),r}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||on.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Rte(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 wk.of(new yg(typeof t=="number"?Ye.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 wk.of(new yg(Ye.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 ei.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return ei.define(()=>({}),{eventObservers:t})}static theme(t,n){let s=Rf.newName(),r=[Ek.of(s),sy.of(fA(`.${s}`,t))];return n&&n.dark&&r.push(dA.of(!0)),r}static baseTheme(t){return nm.lowest(sy.of(fA("."+hA,t,xne)))}static findFromDOM(t){var n;let s=t.querySelector(".cm-content"),r=s&&bi.get(s)||bi.get(t);return((n=r==null?void 0:r.root)===null||n===void 0?void 0:n.view)||null}}It.styleModule=sy;It.inputHandler=Wte;It.clipboardInputFilter=NM;It.clipboardOutputFilter=jM;It.scrollHandler=Xte;It.focusChangeEffect=Gte;It.perLineTextDirection=Kte;It.exceptionSink=Vte;It.updateListener=oA;It.editable=ld;It.mouseSelectionStyle=Ute;It.dragMovesSelection=Hte;It.clickAddsSelectionRange=qte;It.decorations=L3;It.blockWrappers=Zte;It.outerDecorations=IM;It.atomicRanges=Lv;It.bidiIsolatedRanges=ene;It.cursorScrollMargin=an.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}}});It.scrollMargins=tne;It.darkTheme=dA;It.cspNonce=an.define({combine:e=>e.length?e[0]:""});It.contentAttributes=MM;It.editorAttributes=Jte;It.lineWrapping=It.contentAttributes.of({class:"cm-lineWrapping"});It.announce=ss.define();const Yje=4096,hz={};class jS{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:Mr.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 jS(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return s}}function fz(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&&TM(o,n)}return n}const Xje=on.mac?"mac":on.windows?"win":on.linux?"linux":"key";function Qje(e,t){const n=e.split(/-(?!$)/);let s=n[n.length-1];s=="Space"&&(s=" ");let r,i,o,a;for(let c=0;c<n.length-1;++c){const u=n[c];if(/^(cmd|meta|m)$/i.test(u))a=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))i=!0;else if(/^s(hift)?$/i.test(u))o=!0;else if(/^mod$/i.test(u))t=="mac"?a=!0:i=!0;else throw new Error("Unrecognized modifier name: "+u)}return r&&(s="Alt-"+s),i&&(s="Ctrl-"+s),a&&(s="Meta-"+s),o&&(s="Shift-"+s),s}function Ak(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 Jje=nm.default(It.domEventHandlers({keydown(e,t){return wne(vne(t.state),e,t,"editor")}})),t1=an.define({enables:Jje}),mz=new WeakMap;function vne(e){let t=e.facet(t1),n=mz.get(t);return n||mz.set(t,n=tMe(t.reduce((s,r)=>s.concat(r),[]))),n}function Zje(e,t,n){return wne(vne(e.state),t,e,n)}let Ph=null;const eMe=4e3;function tMe(e,t=Xje){let n=Object.create(null),s=Object.create(null),r=(o,a)=>{let c=s[o];if(c==null)s[o]=a;else if(c!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},i=(o,a,c,u,d)=>{var h,m;let p=n[o]||(n[o]=Object.create(null)),g=a.split(/ (?!$)/).map(x=>Qje(x,t));for(let x=1;x<g.length;x++){let y=g.slice(0,x).join(" ");r(y,!0),p[y]||(p[y]={preventDefault:!0,stopPropagation:!1,run:[w=>{let k=Ph={view:w,prefix:y,scope:o};return setTimeout(()=>{Ph==k&&(Ph=null)},eMe),!0}]})}let b=g.join(" ");r(b,!1);let v=p[b]||(p[b]={preventDefault:!1,stopPropagation:!1,run:((m=(h=p._any)===null||h===void 0?void 0:h.run)===null||m===void 0?void 0:m.slice())||[]});c&&v.run.push(c),u&&(v.preventDefault=!0),d&&(v.stopPropagation=!0)};for(let o of e){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let u of a){let d=n[u]||(n[u]=Object.create(null));d._any||(d._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:h}=o;for(let m in d)d[m].run.push(p=>h(p,mA))}let c=o[t]||o.key;if(c)for(let u of a)i(u,c,o.run,o.preventDefault,o.stopPropagation),o.shift&&i(u,"Shift-"+c,o.shift,o.preventDefault,o.stopPropagation)}return n}let mA=null;function wne(e,t,n,s){mA=t;let r=gNe(t),i=La(r,0),o=du(i)==r.length&&r!=" ",a="",c=!1,u=!1,d=!1;Ph&&Ph.view==n&&Ph.scope==s&&(a=Ph.prefix+" ",cne.indexOf(t.keyCode)<0&&(u=!0,Ph=null));let h=new Set,m=v=>{if(v){for(let x of v.run)if(!h.has(x)&&(h.add(x),x(n)))return v.stopPropagation&&(d=!0),!0;v.preventDefault&&(v.stopPropagation&&(d=!0),u=!0)}return!1},p=e[s],g,b;return p&&(m(p[a+Ak(r,t,!o)])?c=!0:o&&(t.altKey||t.metaKey||t.ctrlKey)&&!(on.windows&&t.ctrlKey&&t.altKey)&&!(on.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(g=Df[t.keyCode])&&g!=r?(m(p[a+Ak(g,t,!0)])||t.shiftKey&&(b=Ix[t.keyCode])!=r&&b!=g&&m(p[a+Ak(b,t,!1)]))&&(c=!0):o&&t.shiftKey&&m(p[a+Ak(r,t,!0)])&&(c=!0),!c&&m(p._any)&&(c=!0)),u&&(c=!0),c&&d&&t.stopPropagation(),mA=null,c}class sp{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=kne(t);return[new sp(n,r.left-i.left,r.top-i.top,null,r.bottom-r.top)]}else return nMe(t,n,s)}}function kne(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==Mr.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function pz(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}),c=e.posAtCoords({x:i.right-1,y:o});return a==null||c==null?s:{from:Math.max(s.from,Math.min(a,c)),to:Math.min(s.to,Math.max(a,c))}}function nMe(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==Mr.LTR,o=e.contentDOM,a=o.getBoundingClientRect(),c=kne(e),u=o.querySelector(".cm-line"),d=u&&window.getComputedStyle(u),h=a.left+(d?parseInt(d.paddingLeft)+Math.min(0,parseInt(d.textIndent)):0),m=a.right-(d?parseInt(d.paddingRight):0),p=lA(e,s,1),g=lA(e,r,-1),b=p.type==Mo.Text?p:null,v=g.type==Mo.Text?g:null;if(b&&(e.lineWrapping||p.widgetLineBreaks)&&(b=pz(e,s,1,b)),v&&(e.lineWrapping||g.widgetLineBreaks)&&(v=pz(e,r,-1,v)),b&&v&&b.from==v.from&&b.to==v.to)return y(w(n.from,n.to,b));{let T=b?w(n.from,null,b):k(p,!1),S=v?w(null,n.to,v):k(g,!0),C=[];return(b||p).to<(v||g).from-(b&&v?1:0)||p.widgetLineBreaks>1&&T.bottom+e.defaultLineHeight/2<S.top?C.push(x(h,T.bottom,m,S.top)):T.bottom<S.top&&e.elementAtHeight((T.bottom+S.top)/2).type==Mo.Text&&(T.bottom=S.top=(T.bottom+S.top)/2),y(T).concat(C).concat(y(S))}function x(T,S,C,_){return new sp(t,T-c.left,S-c.top,Math.max(0,C-T),_-S)}function y({top:T,bottom:S,horizontal:C}){let _=[];for(let B=0;B<C.length;B+=2)_.push(x(C[B],T,C[B+1],S));return _}function w(T,S,C){let _=1e9,B=-1e9,A=[];function N(L,O,$,z,F){let G=e.coordsAtPos(L,L==C.to?-2:2),I=e.coordsAtPos($,$==C.from?2:-2);!G||!I||(_=Math.min(G.top,I.top,_),B=Math.max(G.bottom,I.bottom,B),F==Mr.LTR?A.push(i&&O?h:G.left,i&&z?m:I.right):A.push(!i&&z?h:I.left,!i&&O?m:G.right))}let j=T??C.from,P=S??C.to;for(let L of e.visibleRanges)if(L.to>j&&L.from<P)for(let O=Math.max(L.from,j),$=Math.min(L.to,P);;){let z=e.state.doc.lineAt(O);for(let F of e.bidiSpans(z)){let G=F.from+z.from,I=F.to+z.from;if(G>=$)break;I>O&&N(Math.max(G,O),T==null&&G<=j,Math.min(I,$),S==null&&I>=P,F.dir)}if(O=z.to+1,O>=$)break}return A.length==0&&N(j,T==null,P,S==null,e.textDirection),{top:_,bottom:B,horizontal:A}}function k(T,S){let C=a.top+(S?T.top:T.bottom);return{top:C,bottom:C,horizontal:[]}}}function sMe(e,t){return e.constructor==t.constructor&&e.eq(t)}class rMe{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($2)!=t.state.facet($2)&&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($2);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)=>!sMe(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,on.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const $2=an.define();function _ne(e){return[ei.define(t=>new rMe(t,e)),$2.of(e)]}const n1=an.define({combine(e){return zu(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(t,n)=>Math.min(t,n),drawRangeCursor:(t,n)=>t||n})}});function Sne(e={}){return[n1.of(e),iMe,oMe,aMe,Yte.of(!0)]}function Cne(e){return e.startState.facet(n1)!=e.state.facet(n1)}const iMe=_ne({above:!0,markers(e){let{state:t}=e,n=t.facet(n1),s=[];for(let r of t.selection.ranges){let i=r==t.selection.main;if(r.empty||n.drawRangeCursor&&!(i&&on.ios&&n.iosSelectionHandles)){let o=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=r.empty?r:Ye.cursor(r.head,r.assoc);for(let c of sp.forRange(e,o,a))s.push(c)}}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=Cne(e);return n&&gz(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){gz(t.state,e)},class:"cm-cursorLayer"});function gz(e,t){t.style.animationDuration=e.facet(n1).cursorBlinkRate+"ms"}const oMe=_ne({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 sp.forRange(e,"cm-selectionBackground",r))t.push(i);if(on.ios&&!n.empty&&e.state.facet(n1).iosSelectionHandles){for(let r of sp.forRange(e,"cm-selectionHandle cm-selectionHandle-start",Ye.cursor(n.from,1)))t.push(r);for(let r of sp.forRange(e,"cm-selectionHandle cm-selectionHandle-end",Ye.cursor(n.to,1)))t.push(r)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||Cne(e)},class:"cm-selectionLayer"}),aMe=nm.highest(It.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"}}}})),Tne=ss.define({map(e,t){return e==null?null:t.mapPos(e)}}),iy=Io.define({create(){return null},update(e,t){return e!=null&&(e=t.changes.mapPos(e)),t.effects.reduce((n,s)=>s.is(Tne)?s.value:n,e)}}),lMe=ei.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(iy);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(iy)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(iy),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(iy)!=e&&this.view.dispatch({effects:Tne.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 cMe(){return[iy,lMe]}function bz(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 uMe(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 dMe{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,c,u,d)=>r(d,u,u+a[0].length,a,c);else if(typeof s=="function")this.addMatch=(a,c,u,d)=>{let h=s(a,c,u);h&&d(u,u+a[0].length,h)};else if(s)this.addMatch=(a,c,u,d)=>d(u,u+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 Au,s=n.add.bind(n);for(let{from:r,to:i}of uMe(t,this.maxLength))bz(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,c)=>{c>=t.view.viewport.from&&a<=t.view.viewport.to&&(s=Math.min(a,s),r=Math.max(c,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 c=t.state.doc.lineAt(o),u=c.to<a?t.state.doc.lineAt(a):c,d=Math.max(i.from,c.from),h=Math.min(i.to,u.to);if(this.boundary){for(;o>c.from;o--)if(this.boundary.test(c.text[o-1-c.from])){d=o;break}for(;a<u.to;a++)if(this.boundary.test(u.text[a-u.from])){h=a;break}}let m=[],p,g=(b,v,x)=>m.push(x.range(b,v));if(c==u)for(this.regexp.lastIndex=d-c.from;(p=this.regexp.exec(c.text))&&p.index<h-c.from;)this.addMatch(p,t,p.index+c.from,g);else bz(t.state.doc,this.regexp,d,h,(b,v)=>this.addMatch(v,t,b,g));n=n.update({filterFrom:d,filterTo:h,filter:(b,v)=>b<d||v>h,add:m})}}return n}}const pA=/x/.unicode!=null?"gu":"g",hMe=new RegExp(`[\0-\b
--­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF￹-￼]`,pA),fMe={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 c6=null;function mMe(){var e;if(c6==null&&typeof document<"u"&&document.body){let t=document.body.style;c6=((e=t.tabSize)!==null&&e!==void 0?e:t.MozTabSize)!=null}return c6||!1}const z2=an.define({combine(e){let t=zu(e,{render:null,specialChars:hMe,addSpecialChars:null});return(t.replaceTabs=!mMe())&&(t.specialChars=new RegExp("	|"+t.specialChars.source,pA)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,pA)),t}});function Ene(e={}){return[z2.of(e),pMe()]}let yz=null;function pMe(){return yz||(yz=ei.fromClass(class{constructor(e){this.view=e,this.decorations=Sn.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(z2)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new dMe({regexp:e.specialChars,decoration:(t,n,s)=>{let{doc:r}=n.state,i=La(t[0],0);if(i==9){let o=r.lineAt(s),a=n.state.tabSize,c=O1(o.text,a,s-o.from);return Sn.replace({widget:new xMe((a-c%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=Sn.replace({widget:new yMe(e,i)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(z2);e.startState.facet(z2)!=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 gMe="•";function bMe(e){return e>=32?gMe:e==10?"␤":String.fromCharCode(9216+e)}class yMe extends Al{constructor(t,n){super(),this.options=t,this.code=n}eq(t){return t.code==this.code}toDOM(t){let n=bMe(this.code),s=t.state.phrase("Control character")+" "+(fMe[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 xMe extends Al{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 vMe(){return kMe}const wMe=Sn.line({class:"cm-activeLine"}),kMe=ei.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(wMe.range(r.from)),t=r.from)}return Sn.set(n)}},{decorations:e=>e.decorations});class _Me extends Al{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?qy(t.firstChild):[];if(!n.length)return null;let s=window.getComputedStyle(t.parentNode),r=Lx(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 xz(e){let t=ei.fromClass(class{constructor(n){this.view=n,this.placeholder=e?Sn.set([Sn.widget({widget:new _Me(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,It.contentAttributes.of({"aria-placeholder":e})]:t}const gA=2e3;function SMe(e,t,n){let s=Math.min(t.line,n.line),r=Math.max(t.line,n.line),i=[];if(t.off>gA||n.off>gA||t.col<0||n.col<0){let o=Math.min(t.off,n.off),a=Math.max(t.off,n.off);for(let c=s;c<=r;c++){let u=e.doc.line(c);u.length<=a&&i.push(Ye.range(u.from+o,u.to+a))}}else{let o=Math.min(t.col,n.col),a=Math.max(t.col,n.col);for(let c=s;c<=r;c++){let u=e.doc.line(c),d=YE(u.text,o,e.tabSize,!0);if(d<0)i.push(Ye.cursor(u.to));else{let h=YE(u.text,a,e.tabSize);i.push(Ye.range(u.from+d,u.from+h))}}}return i}function CMe(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}function vz(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>gA?-1:r==s.length?CMe(e,t.clientX):O1(s.text,e.state.tabSize,n-s.from);return{line:s.number,col:i,off:r}}function TMe(e,t){let n=vz(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=vz(e,r);if(!a)return s;let c=SMe(e.state,n,a);return c.length?o?Ye.create(c.concat(s.ranges)):Ye.create(c):s}}:null}function EMe(e){let t=n=>n.altKey&&n.button==0;return It.mouseSelectionStyle.of((n,s)=>t(s)?TMe(n,s):null)}const AMe={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},NMe={style:"cursor: crosshair"};function jMe(e={}){let[t,n]=AMe[e.key||"Alt"],s=ei.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,It.contentAttributes.of(r=>{var i;return!((i=r.plugin(s))===null||i===void 0)&&i.isDown?NMe:null})]}const Nk="-10000px";class Ane{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(c=>c);if(r===this.input){for(let c of this.tooltipViews)c.update&&c.update(t);return!1}let o=[],a=n?[]:null;for(let c=0;c<i.length;c++){let u=i[c],d=-1;if(u){for(let h=0;h<this.tooltips.length;h++){let m=this.tooltips[h];m&&m.create==u.create&&(d=h)}if(d<0)o[c]=this.createTooltipView(u,c?o[c-1]:null),a&&(a[c]=!!u.above);else{let h=o[c]=this.tooltipViews[d];a&&(a[c]=n[d]),h.update&&h.update(t)}}}for(let c of this.tooltipViews)o.indexOf(c)<0&&(this.removeTooltipView(c),(s=c.destroy)===null||s===void 0||s.call(c));return n&&(a.forEach((c,u)=>n[u]=c),n.length=a.length),this.input=r,this.tooltips=i,this.tooltipViews=o,!0}}function MMe(e={}){return F2.of(e)}function IMe(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const F2=an.define({combine:e=>{var t,n,s;return{position:on.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)||IMe}}}),wz=new WeakMap,OM=ei.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(F2);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 Ane(e,BM,(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(F2);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=Nk,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(on.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=RM(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(F2).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 c=this.manager.tooltips[a],u=this.manager.tooltipViews[a],{dom:d}=u,h=e.pos[a],m=e.size[a];if(!h||c.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=Nk;continue}let p=c.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,g=p?7:0,b=m.right-m.left,v=(t=wz.get(u))!==null&&t!==void 0?t:m.bottom-m.top,x=u.offset||DMe,y=this.view.textDirection==Mr.LTR,w=m.width>s.right-s.left?y?s.left:s.right-m.width:y?Math.max(s.left,Math.min(h.left-(p?14:0)+x.x,s.right-b)):Math.min(Math.max(s.left,h.left-b+(p?14:0)-x.x),s.right-b),k=this.above[a];!c.strictSide&&(k?h.top-v-g-x.y<s.top:h.bottom+v+g+x.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<v&&u.resize!==!1){if(T<this.view.defaultLineHeight){d.style.top=Nk;continue}wz.set(u,v),d.style.height=(v=T)/i+"px"}else d.style.height&&(d.style.height="");let S=k?h.top-v-g-x.y:h.bottom+g+x.y,C=w+b;if(u.overlap!==!0)for(let _ of o)_.left<C&&_.right>w&&_.top<S+v&&_.bottom>S&&(S=k?_.top-v-2-g:_.bottom+g+2);if(this.position=="absolute"?(d.style.top=(S-e.parent.top)/i+"px",kz(d,(w-e.parent.left)/r)):(d.style.top=S/i+"px",kz(d,w/r)),p){let _=h.left+(y?x.x:-x.x)-(w+14-7);p.style.left=_/r+"px"}u.overlap!==!0&&o.push({left:w,top:S,right:C,bottom:S+v}),d.classList.toggle("cm-tooltip-above",k),d.classList.toggle("cm-tooltip-below",!k),u.positioned&&u.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=Nk}},{eventObservers:{scroll(){this.maybeMeasure()}}});function kz(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const RMe=It.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"}}}),DMe={x:0,y:0},BM=an.define({enables:[OM,RMe]}),MS=an.define({combine:e=>e.reduce((t,n)=>t.concat(n),[])});class $3{static create(t){return new $3(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Ane(t,MS,(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 LMe=BM.compute([MS],e=>{let t=e.facet(MS);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:$3.create,above:t[0].above,arrow:t.some(n=>n.arrow)}}),Nne=an.define();class PMe{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(u=>u.from<=r&&u.to>=r),c=a&&a.dir==Mr.RTL?-1:1;i=n.x<o.left?-c:c}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 c=Array.isArray(a)?a:[a];r&&this.locked.set(c,r),t.dispatch({effects:this.setHover.of(c)})}};if(i&&"then"in i){let a=this.pending={pos:n};i.then(c=>{this.pending==a&&(this.pending=null,o(c))},c=>Ba(t.state,c,"hover tooltip"))}else o(i)}get tooltip(){let t=this.view.plugin(OM),n=t?t.manager.tooltips.findIndex(s=>s.create==$3.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&&!OMe(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:!BMe(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 jk=4;function OMe(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-jk&&t.clientX<=s+jk&&t.clientY>=r-jk&&t.clientY<=i+jk}function BMe(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 c=e.posAtCoords({x:s,y:r},!1);return c>=t&&c<=n}function $Me(e,t={}){let n=ss.define(),s=new WeakMap,r=Io.define({create(){return[]},update(o,a){let c=s.get(o);if(o.length&&(t.hideOnChange&&(a.docChanged||a.selection)?o=[]:c&&c(a)?o=[]:t.hideOn&&(o=o.filter(u=>!t.hideOn(a,u)))),a.docChanged&&o.length){let u=[];for(let d of o){let h=a.changes.mapPos(d.pos,-1,ha.TrackDel);if(h!=null){let m=Object.assign(Object.create(null),d);m.pos=h,m.end!=null&&(m.end=a.changes.mapPos(m.end)),u.push(m)}}o=u}for(let u of a.effects)u.is(n)&&(o=u.value,c=void 0),(u.is(FMe)&&!u.value||u.value==r)&&(o=[]);return o.length&&c&&s.set(o,c),o},provide:o=>MS.from(o)});const i=ei.define(o=>new PMe(o,e,r,s,n,t.hoverTime||300));return{active:r,extension:[r,i,Nne.of(i),LMe]}}function zMe(e,t,n,s={}){var r;let i=e.state.facet(Nne).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 jne(e,t){let n=e.plugin(OM);if(!n)return null;let s=n.manager.tooltips.indexOf(t);return s<0?null:n.manager.tooltipViews[s]}const FMe=ss.define(),_z=an.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 $M(e,t){let n=e.plugin(Mne),s=n?n.specs.indexOf(t):-1;return s>-1?n.panels[s]:null}const Mne=ei.fromClass(class{constructor(e){this.input=e.state.facet(Ox),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(e));let t=e.state.facet(_z);this.top=new Mk(e,!0,t.topContainer),this.bottom=new Mk(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(_z);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new Mk(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new Mk(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(Ox);if(n!=this.input){let s=n.filter(c=>c),r=[],i=[],o=[],a=[];for(let c of s){let u=this.specs.indexOf(c),d;u<0?(d=c(e.view),a.push(d)):(d=this.panels[u],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 c of a)c.dom.classList.add("cm-panel"),c.mount&&c.mount()}else for(let s of this.panels)s.update&&s.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>It.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class Mk{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=Sz(t);t=t.nextSibling}else this.dom.insertBefore(n.dom,t);for(;t;)t=Sz(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 Sz(e){let t=e.nextSibling;return e.remove(),t}const Ox=an.define({enables:Mne});function qMe(e,t){let n,s=new Promise(o=>n=o),r=o=>HMe(o,t,n);e.state.field(u6,!1)?e.dispatch({effects:Ine.of(r)}):e.dispatch({effects:ss.appendConfig.of(u6.init(()=>[r]))});let i=Rne.of(r);return{close:i,result:s.then(o=>((e.win.queueMicrotask||(c=>e.win.setTimeout(c,10)))(()=>{e.state.field(u6).indexOf(r)>-1&&e.dispatch({effects:i})}),o))}}const u6=Io.define({create(){return[]},update(e,t){for(let n of t.effects)n.is(Ine)?e=[n.value].concat(e):n.is(Rne)&&(e=e.filter(s=>s!=n.value));return e},provide:e=>Ox.computeN([e],t=>t.field(e))}),Ine=ss.define(),Rne=ss.define();function HMe(e,t,n){let s=t.content?t.content(e,()=>o(null)):null;if(!s){if(s=_r("form"),t.input){let a=_r("input",t.input);/^(text|password|number|email|tel|url)$/.test(a.type)&&a.classList.add("cm-textfield"),a.name||(a.name="input"),s.appendChild(_r("label",(t.label||"")+": ",a))}else s.appendChild(document.createTextNode(t.label||""));s.appendChild(document.createTextNode(" ")),s.appendChild(_r("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 c=r[a];c.addEventListener("keydown",u=>{u.keyCode==27?(u.preventDefault(),o(null)):u.keyCode==13&&(u.preventDefault(),o(c))}),c.addEventListener("submit",u=>{u.preventDefault(),o(c)})}let i=_r("div",s,_r("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 Vd extends If{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Vd.prototype.elementClass="";Vd.prototype.toDOM=void 0;Vd.prototype.mapMode=ha.TrackBefore;Vd.prototype.startSide=Vd.prototype.endSide=-1;Vd.prototype.point=!0;const q2=an.define(),UMe=an.define(),VMe={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Ms.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Vy=an.define();function WMe(e){return[Dne(),Vy.of({...VMe,...e})]}const Cz=an.define({combine:e=>e.some(t=>t)});function Dne(e){return[GMe]}const GMe=ei.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(Vy).map(t=>new Ez(e,t)),this.fixed=!e.state.facet(Cz);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(Cz)!=!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(q2),this.view.viewport.from),s=[],r=this.gutters.map(i=>new KMe(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==Mo.Text&&o){bA(n,s,a.from);for(let c of r)c.line(this.view,a,s);o=!1}else if(a.widget)for(let c of r)c.widget(this.view,a)}else if(i.type==Mo.Text){bA(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(Vy),n=e.state.facet(Vy),s=e.docChanged||e.heightChanged||e.viewportChanged||!Ms.eq(e.startState.facet(q2),e.state.facet(q2),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 Ez(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=>It.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==Mr.LTR?{left:s,right:r}:{right:s,left:r}})});function Tz(e){return Array.isArray(e)?e:[e]}function bA(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class KMe{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 Lne(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=[];bA(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(UMe)){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 Ez{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 c=i.getBoundingClientRect();o=(c.top+c.bottom)/2}else o=r.clientY;let a=t.lineBlockAtHeight(o-t.documentTop);n.domEventHandlers[s](t,a,r)&&r.preventDefault()});this.markers=Tz(n.markers(t)),n.initialSpacer&&(this.spacer=new Lne(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=Tz(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 Lne{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":""),YMe(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,c=i<n.length?n[i++]:null,u=!1;if(c){let d=c.elementClass;d&&(s+=" "+d);for(let h=o;h<this.markers.length;h++)if(this.markers[h].compare(c)){a=h,u=!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(!c)break;c.toDOM&&(u?r=r.nextSibling:this.dom.insertBefore(c.toDOM(t),r)),u&&o++}this.dom.className=s,this.markers=n}destroy(){this.setMarkers(null,[])}}function YMe(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 XMe=an.define(),QMe=an.define(),Y0=an.define({combine(e){return zu(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,c,u)=>i(a,c,u)||o(a,c,u):o}return s}})}});class d6 extends Vd{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function h6(e,t){return e.state.facet(Y0).formatNumber(t,e.state)}const JMe=Vy.compute([Y0],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(t){return t.state.facet(XMe)},lineMarker(t,n,s){return s.some(r=>r.toDOM)?null:new d6(h6(t,t.state.doc.lineAt(n.from).number))},widgetMarker:(t,n,s)=>{for(let r of t.state.facet(QMe)){let i=r(t,n,s);if(i)return i}return null},lineMarkerChange:t=>t.startState.facet(Y0)!=t.state.facet(Y0),initialSpacer(t){return new d6(h6(t,Az(t.state.doc.lines)))},updateSpacer(t,n){let s=h6(n.view,Az(n.view.state.doc.lines));return s==t.number?t:new d6(s)},domEventHandlers:e.facet(Y0).domEventHandlers,side:"before"}));function ZMe(e={}){return[Y0.of(e),Dne(),JMe]}function Az(e){let t=9;for(;t<e;)t=t*10+9;return t}const eIe=new class extends Vd{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},tIe=q2.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(eIe.range(r)))}return Ms.of(t)});function nIe(){return tIe}const sIe=1024;let rIe=0;class f6{constructor(t,n){this.from=t,this.to=n}}class Us{constructor(t={}){this.id=rIe++,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=uc.match(t)),n=>{let s=t(n);return s===void 0?null:[this,s]}}}Us.closedBy=new Us({deserialize:e=>e.split(" ")});Us.openedBy=new Us({deserialize:e=>e.split(" ")});Us.group=new Us({deserialize:e=>e.split(" ")});Us.isolate=new Us({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});Us.contextHash=new Us({perNode:!0});Us.lookAhead=new Us({perNode:!0});Us.mounted=new Us({perNode:!0});class Wy{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[Us.mounted.id]}}const iIe=Object.create(null);class uc{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):iIe,s=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),r=new uc(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(Us.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(Us.group),i=-1;i<(r?r.length:0);i++){let o=n[i<0?s.name:r[i]];if(o)return o}}}}uc.none=new uc("",Object.create(null),0,8);const Ik=new WeakMap,Nz=new WeakMap;var ki;(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"})(ki||(ki={}));class Ao{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=Wy.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 xA(this.topNode,t)}cursorAt(t,n=0,s=0){let r=Ik.get(this)||this.topNode,i=new xA(r);return i.moveTo(t,n),Ik.set(this,i._tree),i}get topNode(){return new Of(this,0,0,null)}resolve(t,n=0){let s=Bx(Ik.get(this)||this.topNode,t,n,!1);return Ik.set(this,s),s}resolveInner(t,n=0){let s=Bx(Nz.get(this)||this.topNode,t,n,!0);return Nz.set(this,s),s}resolveStack(t,n=0){return lIe(this,t,n)}iterate(t){let{enter:n,leave:s,from:r=0,to:i=this.length}=t,o=t.mode||0,a=(o&ki.IncludeAnonymous)>0;for(let c=this.cursor(o|ki.IncludeAnonymous);;){let u=!1;if(c.from<=i&&c.to>=r&&(!a&&c.type.isAnonymous||n(c)!==!1)){if(c.firstChild())continue;u=!0}for(;u&&s&&(a||!c.type.isAnonymous)&&s(c),!c.nextSibling();){if(!c.parent())return;u=!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:qM(uc.none,this.children,this.positions,0,this.children.length,0,this.length,(n,s,r)=>new Ao(this.type,n,s,r,this.propValues),t.makeTree||((n,s,r)=>new Ao(uc.none,n,s,r)))}static build(t){return cIe(t)}}Ao.empty=new Ao(uc.none,[],[],0);class zM{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 zM(this.buffer,this.index)}}class Pf{constructor(t,n,s){this.buffer=t,this.length=n,this.set=s}get type(){return uc.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 c=t;c!=n&&!(Pne(i,r,o[c+1],o[c+2])&&(a=c,s>0));c=o[c+3]);return a}slice(t,n,s){let r=this.buffer,i=new Uint16Array(n-t),o=0;for(let a=t,c=0;a<n;){i[c++]=r[a++],i[c++]=r[a++]-s;let u=i[c++]=r[a++]-s;i[c++]=r[a++]-t,o=Math.max(o,u)}return new Pf(i,o,this.set)}}function Pne(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 Bx(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 Of&&e.index<0?null:e.parent;if(!o)return e;e=o}let i=s?0:ki.IgnoreOverlays;if(s)for(let o=e,a=o.parent;a;o=a,a=o.parent)o instanceof Of&&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 One{cursor(t=0){return new xA(this,t)}getChild(t,n=null,s=null){let r=jz(this,t,n,s);return r.length?r[0]:null}getChildren(t,n=null,s=null){return jz(this,t,n,s)}resolve(t,n=0){return Bx(this,t,n,!1)}resolveInner(t,n=0){return Bx(this,t,n,!0)}matchContext(t){return yA(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 Of=class H2 extends One{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:c}=o._tree,u=n>0?a.length:-1;t!=u;t+=n){let d=a[t],h=c[t]+o.from,m;if(!(!(i&ki.EnterBracketed&&d instanceof Ao&&(m=Wy.get(d))&&!m.overlay&&m.bracketed&&s>=h&&s<=h+d.length)&&!Pne(r,s,h,h+d.length))){if(d instanceof Pf){if(i&ki.ExcludeBuffers)continue;let p=d.findChild(0,d.buffer.length,n,s-h,r);if(p>-1)return new Wh(new oIe(o,d,t,h),null,p)}else if(i&ki.IncludeAnonymous||!d.type.isAnonymous||FM(d)){let p;if(!(i&ki.IgnoreMounts)&&(p=Wy.get(d))&&!p.overlay)return new H2(p.tree,h,t,o);let g=new H2(d,h,t,o);return i&ki.IncludeAnonymous||!g.type.isAnonymous?g:g.nextChild(n<0?d.children.length-1:0,n,s,r,i)}}}if(i&ki.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&ki.IgnoreOverlays)&&(r=Wy.get(this._tree))&&r.overlay){let i=t-this.from,o=s&ki.EnterBracketed&&r.bracketed;for(let{from:a,to:c}of r.overlay)if((n>0||o?a<=i:a<i)&&(n<0||o?c>=i:c>i))return new H2(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 jz(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 yA(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 oIe{constructor(t,n,s,r){this.parent=t,this.buffer=n,this.index=s,this.start=r}}class Wh extends One{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 Wh(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&ki.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 Wh(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 Wh(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 Wh(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 Ao(this.type,t,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Bne(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 Of&&n.index<0?null:n.parent,r=e.slice();return s?r[t]=s:r.splice(t,1),new aIe(r,n)}class aIe{constructor(t,n){this.heads=t,this.node=n}get next(){return Bne(this.heads)}}function lIe(e,t,n){let s=e.resolveInner(t,n),r=null;for(let i=s instanceof Of?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=Wy.get(i.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let a=new Of(o.tree,o.overlay[0].from+i.from,-1,i);(r||(r=[s])).push(Bx(a,t,n,!1))}}return r?Bne(r):s}class xA{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&~ki.EnterBracketed,t instanceof Of)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 Of?(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&ki.ExcludeBuffers?!1:this.enterChild(1,t,n):this.yield(this._tree.enter(t,n,s))}parent(){if(!this.buffer)return this.yieldNode(this.mode&ki.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&ki.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&ki.IncludeAnonymous||a instanceof Pf||!a.type.isAnonymous||FM(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 Wh(this.buffer,n,this.stack[r]);return this.bufferNode=new Wh(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 yA(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 yA(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 FM(e){return e.children.some(t=>t instanceof Pf||!t.type.isAnonymous||FM(t))}function cIe(e){var t;let{buffer:n,nodeSet:s,maxBufferLength:r=sIe,reused:i=[],minRepeatType:o=s.types.length}=e,a=Array.isArray(n)?new zM(n,n.length):n,c=s.types,u=0,d=0;function h(T,S,C,_,B,A){let{id:N,start:j,end:P,size:L}=a,O=d,$=u;if(L<0)if(a.next(),L==-1){let Q=i[N];C.push(Q),_.push(j-T);return}else if(L==-3){u=N;return}else if(L==-4){d=N;return}else throw new RangeError(`Unrecognized record size: ${L}`);let z=c[N],F,G,I=j-T;if(P-j<=r&&(G=v(a.pos-S,B))){let Q=new Uint16Array(G.size-G.skip),V=a.pos-G.size,M=Q.length;for(;a.pos>V;)M=x(G.start,Q,M);F=new Pf(Q,P-G.start,s),I=G.start-T}else{let Q=a.pos-L;a.next();let V=[],M=[],re=N>=o?N:-1,se=0,X=P;for(;a.pos>Q;)re>=0&&a.id==re&&a.size>=0?(a.end<=X-r&&(g(V,M,j,se,a.end,X,re,O,$),se=V.length,X=a.end),a.next()):A>2500?m(j,Q,V,M):h(j,Q,V,M,re,A+1);if(re>=0&&se>0&&se<V.length&&g(V,M,j,se,j,X,re,O,$),V.reverse(),M.reverse(),re>-1&&se>0){let J=p(z,$);F=qM(z,V,M,0,V.length,0,P-j,J,J)}else F=b(z,V,M,P-j,O-P,$)}C.push(F),_.push(I)}function m(T,S,C,_){let B=[],A=0,N=-1;for(;a.pos>S;){let{id:j,start:P,end:L,size:O}=a;if(O>4)a.next();else{if(N>-1&&P<N)break;N<0&&(N=L-r),B.push(j,P,L),A++,a.next()}}if(A){let j=new Uint16Array(A*4),P=B[B.length-2];for(let L=B.length-3,O=0;L>=0;L-=3)j[O++]=B[L],j[O++]=B[L+1]-P,j[O++]=B[L+2]-P,j[O++]=O;C.push(new Pf(j,B[2]-P,s)),_.push(P-T)}}function p(T,S){return(C,_,B)=>{let A=0,N=C.length-1,j,P;if(N>=0&&(j=C[N])instanceof Ao){if(!N&&j.type==T&&j.length==B)return j;(P=j.prop(Us.lookAhead))&&(A=_[N]+j.length+P)}return b(T,C,_,B,A,S)}}function g(T,S,C,_,B,A,N,j,P){let L=[],O=[];for(;T.length>_;)L.push(T.pop()),O.push(S.pop()+C-B);T.push(b(s.types[N],L,O,A-B,j-A,P)),S.push(B-C)}function b(T,S,C,_,B,A,N){if(A){let j=[Us.contextHash,A];N=N?[j].concat(N):[j]}if(B>25){let j=[Us.lookAhead,B];N=N?[j].concat(N):[j]}return new Ao(T,S,C,_,N)}function v(T,S){let C=a.fork(),_=0,B=0,A=0,N=C.end-r,j={size:0,start:0,skip:0};e:for(let P=C.pos-T;C.pos>P;){let L=C.size;if(C.id==S&&L>=0){j.size=_,j.start=B,j.skip=A,A+=4,_+=4,C.next();continue}let O=C.pos-L;if(L<0||O<P||C.start<N)break;let $=C.id>=o?4:0,z=C.start;for(C.next();C.pos>O;){if(C.size<0)if(C.size==-3||C.size==-4)$+=4;else break e;else C.id>=o&&($+=4);C.next()}B=z,_+=L,A+=$}return(S<0||_==T)&&(j.size=_,j.start=B,j.skip=A),j.size>4?j:void 0}function x(T,S,C){let{id:_,start:B,end:A,size:N}=a;if(a.next(),N>=0&&_<o){let j=C;if(N>4){let P=a.pos-(N-4);for(;a.pos>P;)C=x(T,S,C)}S[--C]=j,S[--C]=A-T,S[--C]=B-T,S[--C]=_}else N==-3?u=_:N==-4&&(d=_);return C}let y=[],w=[];for(;a.pos>0;)h(e.start||0,e.bufferStart||0,y,w,-1,0);let k=(t=e.length)!==null&&t!==void 0?t:y.length?w[0]+y[0].length:0;return new Ao(c[e.topID],y.reverse(),w.reverse(),k)}const Mz=new WeakMap;function U2(e,t){if(!e.isAnonymous||t instanceof Pf||t.type!=e)return 1;let n=Mz.get(t);if(n==null){n=1;for(let s of t.children){if(s.type!=e||!(s instanceof Ao)){n=1;break}n+=U2(e,s)}Mz.set(t,n)}return n}function qM(e,t,n,s,r,i,o,a,c){let u=0;for(let g=s;g<r;g++)u+=U2(e,t[g]);let d=Math.ceil(u*1.5/8),h=[],m=[];function p(g,b,v,x,y){for(let w=v;w<x;){let k=w,T=b[w],S=U2(e,g[w]);for(w++;w<x;w++){let C=U2(e,g[w]);if(S+C>=d)break;S+=C}if(w==k+1){if(S>d){let C=g[k];p(C.children,C.positions,0,C.children.length,b[k]+y);continue}h.push(g[k])}else{let C=b[w-1]+g[w-1].length-T;h.push(qM(e,g,b,k,w,T,C,null,c))}m.push(T+y-i)}}return p(t,n,s,r,0),(a||c)(h,m,o)}class rp{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 rp(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,c=0,u=0;;a++){let d=a<n.length?n[a]:null,h=d?d.fromA:1e9;if(h-c>=s)for(;o&&o.from<h;){let m=o;if(c>=m.from||h<=m.to||u){let p=Math.max(m.from,c)-u,g=Math.min(m.to,h)-u;m=p>=g?null:new rp(p,g,m.tree,m.offset+u,a>0,!!d)}if(m&&r.push(m),o.to>h)break;o=i<t.length?t[i++]:null}if(!d)break;c=d.toA,u=d.toA-d.toB}return r}}class uIe{startParse(t,n,s){return typeof t=="string"&&(t=new dIe(t)),s=s?s.length?s.map(r=>new f6(r.from,r.to)):[new f6(0,0)]:[new f6(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 dIe{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 Us({perNode:!0});let hIe=0;class Wl{constructor(t,n,s,r){this.name=t,this.set=n,this.base=s,this.modified=r,this.id=hIe++}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 Wl&&(n=t),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let r=new Wl(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 IS(t);return s=>s.modified.indexOf(n)>-1?s:IS.get(s.base||s,s.modified.concat(n).sort((r,i)=>r.id-i.id))}}let fIe=0;class IS{constructor(t){this.name=t,this.instances=[],this.id=fIe++}static get(t,n){if(!n.length)return t;let s=n[0].instances.find(a=>a.base==t&&mIe(n,a.modified));if(s)return s;let r=[],i=new Wl(t.name,r,t,n);for(let a of n)a.instances.push(i);let o=pIe(n);for(let a of t.set)if(!a.modified.length)for(let c of o)r.push(IS.get(a,c));return i}}function mIe(e,t){return e.length==t.length&&e.every((n,s)=>n==t[s])}function pIe(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 gIe(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 m=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!m)throw new RangeError("Invalid path: "+r);if(i.push(m[0]=="*"?"":m[0][0]=='"'?JSON.parse(m[0]):m[0]),h+=m[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 c=i.length-1,u=i[c];if(!u)throw new RangeError("Invalid path: "+r);let d=new $x(s,o,c>0?i.slice(0,c):null);t[u]=d.sort(t[u])}}return $ne.add(t)}const $ne=new Us({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 $x(r.tags,r.mode,r.context);n?n.next=i:s=i,n=i}return s}});class $x{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}}$x.empty=new $x([],2,null);function zne(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 c of a.set){let u=n[c.id];if(u){o=o?o+" "+u:u;break}}return o},scope:s}}function bIe(e,t){let n=null;for(let s of e){let r=s.style(t);r&&(n=n?n+" "+r:r)}return n}function yIe(e,t,n,s=0,r=e.length){let i=new xIe(s,Array.isArray(t)?t:[t],n);i.highlightRange(e.cursor(),s,r,"",i.highlighters),i.flush(r)}class xIe{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:c}=t;if(a>=s||c<=n)return;o.isTop&&(i=this.highlighters.filter(p=>!p.scope||p.scope(o)));let u=r,d=vIe(t)||$x.empty,h=bIe(i,d.tags);if(h&&(u&&(u+=" "),u+=h,d.mode==1&&(r+=(r?" ":"")+h)),this.startSpan(Math.max(n,a),u),d.opaque)return;let m=t.tree&&t.tree.prop(Us.mounted);if(m&&m.overlay){let p=t.node.enter(m.overlay[0].from+a,1),g=this.highlighters.filter(v=>!v.scope||v.scope(m.tree.type)),b=t.firstChild();for(let v=0,x=a;;v++){let y=v<m.overlay.length?m.overlay[v]:null,w=y?y.from+a:c,k=Math.max(n,x),T=Math.min(s,w);if(k<T&&b)for(;t.from<T&&(this.highlightRange(t,k,T,r,i),this.startSpan(Math.min(T,t.to),u),!(t.to>=w||!t.nextSibling())););if(!y||w>s)break;x=y.to+a,x>n&&(this.highlightRange(p.cursor(),Math.max(n,y.from+a),Math.min(s,x),"",g),this.startSpan(Math.min(s,x),u))}b&&t.parent()}else if(t.firstChild()){m&&(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),u)}while(t.nextSibling());t.parent()}}}function vIe(e){let t=e.type.prop($ne);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}const Ft=Wl.define,Rk=Ft(),Nh=Ft(),Iz=Ft(Nh),Rz=Ft(Nh),jh=Ft(),Dk=Ft(jh),m6=Ft(jh),su=Ft(),km=Ft(su),Qc=Ft(),Jc=Ft(),vA=Ft(),Db=Ft(vA),Lk=Ft(),Jt={comment:Rk,lineComment:Ft(Rk),blockComment:Ft(Rk),docComment:Ft(Rk),name:Nh,variableName:Ft(Nh),typeName:Iz,tagName:Ft(Iz),propertyName:Rz,attributeName:Ft(Rz),className:Ft(Nh),labelName:Ft(Nh),namespace:Ft(Nh),macroName:Ft(Nh),literal:jh,string:Dk,docString:Ft(Dk),character:Ft(Dk),attributeValue:Ft(Dk),number:m6,integer:Ft(m6),float:Ft(m6),bool:Ft(jh),regexp:Ft(jh),escape:Ft(jh),color:Ft(jh),url:Ft(jh),keyword:Qc,self:Ft(Qc),null:Ft(Qc),atom:Ft(Qc),unit:Ft(Qc),modifier:Ft(Qc),operatorKeyword:Ft(Qc),controlKeyword:Ft(Qc),definitionKeyword:Ft(Qc),moduleKeyword:Ft(Qc),operator:Jc,derefOperator:Ft(Jc),arithmeticOperator:Ft(Jc),logicOperator:Ft(Jc),bitwiseOperator:Ft(Jc),compareOperator:Ft(Jc),updateOperator:Ft(Jc),definitionOperator:Ft(Jc),typeOperator:Ft(Jc),controlOperator:Ft(Jc),punctuation:vA,separator:Ft(vA),bracket:Db,angleBracket:Ft(Db),squareBracket:Ft(Db),paren:Ft(Db),brace:Ft(Db),content:su,heading:km,heading1:Ft(km),heading2:Ft(km),heading3:Ft(km),heading4:Ft(km),heading5:Ft(km),heading6:Ft(km),contentSeparator:Ft(su),list:Ft(su),quote:Ft(su),emphasis:Ft(su),strong:Ft(su),link:Ft(su),monospace:Ft(su),strikethrough:Ft(su),inserted:Ft(),deleted:Ft(),changed:Ft(),invalid:Ft(),meta:Lk,documentMeta:Ft(Lk),annotation:Ft(Lk),processingInstruction:Ft(Lk),definition:Wl.defineModifier("definition"),constant:Wl.defineModifier("constant"),function:Wl.defineModifier("function"),standard:Wl.defineModifier("standard"),local:Wl.defineModifier("local"),special:Wl.defineModifier("special")};for(let e in Jt){let t=Jt[e];t instanceof Wl&&(t.name=e)}zne([{tag:Jt.link,class:"tok-link"},{tag:Jt.heading,class:"tok-heading"},{tag:Jt.emphasis,class:"tok-emphasis"},{tag:Jt.strong,class:"tok-strong"},{tag:Jt.keyword,class:"tok-keyword"},{tag:Jt.atom,class:"tok-atom"},{tag:Jt.bool,class:"tok-bool"},{tag:Jt.url,class:"tok-url"},{tag:Jt.labelName,class:"tok-labelName"},{tag:Jt.inserted,class:"tok-inserted"},{tag:Jt.deleted,class:"tok-deleted"},{tag:Jt.literal,class:"tok-literal"},{tag:Jt.string,class:"tok-string"},{tag:Jt.number,class:"tok-number"},{tag:[Jt.regexp,Jt.escape,Jt.special(Jt.string)],class:"tok-string2"},{tag:Jt.variableName,class:"tok-variableName"},{tag:Jt.local(Jt.variableName),class:"tok-variableName tok-local"},{tag:Jt.definition(Jt.variableName),class:"tok-variableName tok-definition"},{tag:Jt.special(Jt.variableName),class:"tok-variableName2"},{tag:Jt.definition(Jt.propertyName),class:"tok-propertyName tok-definition"},{tag:Jt.typeName,class:"tok-typeName"},{tag:Jt.namespace,class:"tok-namespace"},{tag:Jt.className,class:"tok-className"},{tag:Jt.macroName,class:"tok-macroName"},{tag:Jt.propertyName,class:"tok-propertyName"},{tag:Jt.operator,class:"tok-operator"},{tag:Jt.comment,class:"tok-comment"},{tag:Jt.meta,class:"tok-meta"},{tag:Jt.invalid,class:"tok-invalid"},{tag:Jt.punctuation,class:"tok-punctuation"}]);var p6;const oy=new Us,wIe=new Us;class vu{constructor(t,n,s=[],r=""){this.data=t,this.name=r,qs.prototype.hasOwnProperty("tree")||Object.defineProperty(qs.prototype,"tree",{get(){return Vo(this)}}),this.parser=n,this.extension=[Bf.of(this),qs.languageData.of((i,o,a)=>{let c=Dz(i,o,a),u=c.type.prop(oy);if(!u)return[];let d=i.facet(u),h=c.type.prop(wIe);if(h){let m=c.resolve(o-c.from,a);for(let p of h)if(p.test(m,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 Dz(t,n,s).type.prop(oy)==this.data}findRegions(t){let n=t.facet(Bf);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(oy)==this.data){s.push({from:o,to:o+i.length});return}let a=i.prop(Us.mounted);if(a){if(a.tree.prop(oy)==this.data){if(a.overlay)for(let c of a.overlay)s.push({from:c.from+o,to:c.to+o});else s.push({from:o,to:o+i.length});return}else if(a.overlay){let c=s.length;if(r(a.tree,a.overlay[0].from+o),s.length>c)return}}for(let c=0;c<i.children.length;c++){let u=i.children[c];u instanceof Ao&&r(u,i.positions[c]+o)}};return r(Vo(t),0),s}get allowsNesting(){return!0}}vu.setState=ss.define();function Dz(e,t,n){let s=e.facet(Bf),r=Vo(e).topNode;if(!s||s.allowsNesting)for(let i=r;i;i=i.enter(t,n,ki.ExcludeBuffers|ki.EnterBracketed))i.type.isTop&&(r=i);return r}function Vo(e){let t=e.field(vu.state,!1);return t?t.tree:Ao.empty}class kIe{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 Lb=null;class RS{constructor(t,n,s=[],r,i,o,a,c){this.parser=t,this.state=n,this.fragments=s,this.tree=r,this.treeLen=i,this.viewport=o,this.skipped=a,this.scheduleOn=c,this.parse=null,this.tempSkipped=[]}static create(t,n,s){return new RS(t,n,[],Ao.empty,0,s,[],null)}startParse(){return this.parser.startParse(new kIe(this.state.doc),this.fragments)}work(t,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Ao.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(rp.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(rp.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let n=Lb;Lb=this;try{return t()}finally{Lb=n}}withoutTempSkipped(t){for(let n;n=this.tempSkipped.pop();)t=Lz(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 c=[];if(t.iterChangedRanges((u,d,h,m)=>c.push({fromA:u,toA:d,fromB:h,toB:m})),s=rp.applyChanges(s,c),r=Ao.empty,i=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){a=[];for(let u of this.skipped){let d=t.mapPos(u.from,1),h=t.mapPos(u.to,-1);d<h&&a.push({from:d,to:h})}}}return new RS(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=Lz(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 uIe{createParse(n,s,r){let i=r[0].from,o=r[r.length-1].to;return{parsedPos:i,advance(){let c=Lb;if(c){for(let u of r)c.tempSkipped.push(u);t&&(c.scheduleOn=c.scheduleOn?Promise.all([c.scheduleOn,t]):t)}return this.parsedPos=o,new Ao(uc.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 Lb}}function Lz(e,t,n){return rp.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class s1{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 s1(n)}static init(t){let n=Math.min(3e3,t.doc.length),s=RS.create(t.facet(Bf).parser,t,{from:0,to:n});return s.work(20,n)||s.takeTree(),new s1(s)}}vu.state=Io.define({create:s1.init,update(e,t){for(let n of t.effects)if(n.is(vu.setState))return n.value;return t.startState.facet(Bf)!=t.state.facet(Bf)?s1.init(t.state):e.apply(t)}});let Fne=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(Fne=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const g6=typeof navigator<"u"&&(!((p6=navigator.scheduling)===null||p6===void 0)&&p6.isInputPending)?()=>navigator.scheduling.isInputPending():null,_Ie=ei.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(vu.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(vu.state);(n.tree!=n.context.tree||!n.context.isDone(t.doc.length))&&(this.working=Fne(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(vu.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,t&&!g6?Math.max(25,t.timeRemaining()-5):1e9),a=i.context.treeLen<r&&s.doc.length>r+1e3,c=i.context.work(()=>g6&&g6()||Date.now()>o,r+(a?0:1e5));this.chunkBudget-=Date.now()-n,(c||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:vu.setState.of(new s1(i.context))})),this.chunkBudget>0&&!(c&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(n=>Ba(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()}}}),Bf=an.define({combine(e){return e.length?e[0]:null},enables:e=>[vu.state,_Ie,It.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),SIe=an.define(),HM=an.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 DS(e){let t=e.facet(HM);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function zx(e,t){let n="",s=e.tabSize,r=e.facet(HM)[0];if(r=="	"){for(;t>=s;)n+="	",t-=s;r=" "}for(let i=0;i<t;i++)n+=r;return n}function UM(e,t){e instanceof qs&&(e=new z3(e));for(let s of e.state.facet(SIe)){let r=s(e,t);if(r!==void 0)return r}let n=Vo(e.state);return n.length>=t?TIe(e,n,t):null}class z3{constructor(t,n={}){this.state=t,this.options=n,this.unit=DS(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 O1(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 CIe=new Us;function TIe(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 qne(s,e,n)}function qne(e,t,n){for(let s=e;s;s=s.next){let r=AIe(s.node);if(r)return r(VM.create(t,n,s))}return 0}function EIe(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function AIe(e){let t=e.type.prop(CIe);if(t)return t;let n=e.firstChild,s;if(n&&(s=n.type.prop(Us.closedBy))){let r=e.lastChild,i=r&&s.indexOf(r.name)>-1;return o=>IIe(o,!0,1,void 0,i&&!EIe(o)?r.from:void 0)}return e.parent==null?NIe:null}function NIe(){return 0}class VM extends z3{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 VM(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(jIe(s,t))break;n=this.state.doc.lineAt(s.from)}return this.lineIndent(n.from)}continue(){return qne(this.context.next,this.base,this.pos)}}function jIe(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function MIe(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 c=t.childAfter(a);if(!c||c==s)return null;if(!c.type.isSkipped){if(c.from>=o)return null;let u=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+u}}a=c.to}}function IIe(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,c=MIe(e);return c?a?e.column(c.from):e.column(c.to):e.baseIndent+(a?0:e.unit*n)}const RIe=200;function DIe(){return qs.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+RIe)return e;let i=n.sliceString(r.from,s);if(!t.some(u=>u.test(i)))return e;let{state:o}=e,a=-1,c=[];for(let{head:u}of o.selection.ranges){let d=o.doc.lineAt(u);if(d.from==a)continue;a=d.from;let h=UM(o,d.from);if(h==null)continue;let m=/^\s*/.exec(d.text)[0],p=zx(o,h);m!=p&&c.push({from:d.from,to:d.from+m.length,insert:p})}return c.length?[e,{changes:c,sequential:!0}]:e})}const LIe=an.define(),PIe=new Us;function OIe(e,t,n){let s=Vo(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 c=a.type.prop(PIe);if(c&&(a.to<s.length-50||s.length==e.doc.length||!BIe(a))){let u=c(a,e);u&&u.from<=n&&u.from>=t&&u.to>n&&(i=u)}}return i}function BIe(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function LS(e,t,n){for(let s of e.facet(LIe)){let r=s(e,t,n);if(r)return r}return OIe(e,t,n)}function Hne(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 F3=ss.define({map:Hne}),Pv=ss.define({map:Hne});function Une(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 vp=Io.define({create(){return Sn.none},update(e,t){t.isUserEvent("delete")&&t.changes.iterChangedRanges((n,s)=>e=Pz(e,n,s)),e=e.map(t.changes);for(let n of t.effects)if(n.is(F3)&&!$Ie(e,n.value.from,n.value.to)){let{preparePlaceholder:s}=t.state.facet(Gne),r=s?Sn.replace({widget:new WIe(s(t.state,n.value))}):Oz;e=e.update({add:[r.range(n.value.from,n.value.to)]})}else n.is(Pv)&&(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=Pz(e,t.selection.main.head)),e},provide:e=>It.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(Oz.range(s,r))}return Sn.set(t,!0)}});function Pz(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 PS(e,t,n){var s;let r=null;return(s=e.field(vp,!1))===null||s===void 0||s.between(t,n,(i,o)=>{(!r||r.from>i)&&(r={from:i,to:o})}),r}function $Ie(e,t,n){let s=!1;return e.between(t,t,(r,i)=>{r==t&&i==n&&(s=!0)}),s}function Vne(e,t){return e.field(vp,!1)?t:t.concat(ss.appendConfig.of(Kne()))}const zIe=e=>{for(let t of Une(e)){let n=LS(e.state,t.from,t.to);if(n)return e.dispatch({effects:Vne(e.state,[F3.of(n),Wne(e,n)])}),!0}return!1},FIe=e=>{if(!e.state.field(vp,!1))return!1;let t=[];for(let n of Une(e)){let s=PS(e.state,n.from,n.to);s&&t.push(Pv.of(s),Wne(e,s,!1))}return t.length&&e.dispatch({effects:t}),t.length>0};function Wne(e,t,n=!0){let s=e.state.doc.lineAt(t.from).number,r=e.state.doc.lineAt(t.to).number;return It.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${s} ${e.state.phrase("to")} ${r}.`)}const qIe=e=>{let{state:t}=e,n=[];for(let s=0;s<t.doc.length;){let r=e.lineBlockAt(s),i=LS(t,r.from,r.to);i&&n.push(F3.of(i)),s=(i?e.lineBlockAt(i.to):r).to+1}return n.length&&e.dispatch({effects:Vne(e.state,n)}),!!n.length},HIe=e=>{let t=e.state.field(vp,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(s,r)=>{n.push(Pv.of({from:s,to:r}))}),e.dispatch({effects:n}),!0},UIe=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:zIe},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:FIe},{key:"Ctrl-Alt-[",run:qIe},{key:"Ctrl-Alt-]",run:HIe}],VIe={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},Gne=an.define({combine(e){return zu(e,VIe)}});function Kne(e){return[vp,YIe]}function Yne(e,t){let{state:n}=e,s=n.facet(Gne),r=o=>{let a=e.lineBlockAt(e.posAtDOM(o.target)),c=PS(e.state,a.from,a.to);c&&e.dispatch({effects:Pv.of(c)}),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 Oz=Sn.replace({widget:new class extends Al{toDOM(e){return Yne(e,null)}}});class WIe extends Al{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return Yne(t,this.value)}}const GIe={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class b6 extends Vd{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 KIe(e={}){let t={...GIe,...e},n=new b6(t,!0),s=new b6(t,!1),r=ei.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Bf)!=o.state.facet(Bf)||o.startState.field(vp,!1)!=o.state.field(vp,!1)||Vo(o.startState)!=Vo(o.state)||t.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new Au;for(let c of o.viewportLineBlocks){let u=PS(o.state,c.from,c.to)?s:LS(o.state,c.from,c.to)?n:null;u&&a.add(c.from,c.from,u)}return a.finish()}}),{domEventHandlers:i}=t;return[r,WMe({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 b6(t,!1)},domEventHandlers:{...i,click:(o,a,c)=>{if(i.click&&i.click(o,a,c))return!0;let u=PS(o.state,a.from,a.to);if(u)return o.dispatch({effects:Pv.of(u)}),!0;let d=LS(o.state,a.from,a.to);return d?(o.dispatch({effects:F3.of(d)}),!0):!1}}}),Kne()]}const YIe=It.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 q3{constructor(t,n){this.specs=t;let s;function r(a){let c=Rf.newName();return(s||(s=Object.create(null)))["."+c]=a,c}const i=typeof n.all=="string"?n.all:n.all?r(n.all):void 0,o=n.scope;this.scope=o instanceof vu?a=>a.prop(oy)==o.data:o?a=>a==o:void 0,this.style=zne(t.map(a=>({tag:a.tag,class:a.class||r(Object.assign({},a,{tag:null}))})),{all:i}).style,this.module=s?new Rf(s):null,this.themeType=n.themeType}static define(t,n){return new q3(t,n||{})}}const wA=an.define(),Xne=an.define({combine(e){return e.length?[e[0]]:null}});function V2(e){let t=e.facet(wA);return t.length?t:e.facet(Xne)}function Qne(e,t){let n=[QIe],s;return e instanceof q3&&(e.module&&n.push(It.styleModule.of(e.module)),s=e.themeType),t!=null&&t.fallback?n.push(Xne.of(e)):s?n.push(wA.computeN([It.darkTheme],r=>r.facet(It.darkTheme)==(s=="dark")?[e]:[])):n.push(wA.of(e)),n}function Wwt(e,t,n){let s=V2(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 XIe{constructor(t){this.markCache=Object.create(null),this.tree=Vo(t.state),this.decorations=this.buildDeco(t,V2(t.state)),this.decoratedTo=t.viewport.to}update(t){let n=Vo(t.state),s=V2(t.state),r=s!=V2(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 Au;for(let{from:r,to:i}of t.visibleRanges)yIe(this.tree,n,(o,a,c)=>{s.add(o,a,this.markCache[c]||(this.markCache[c]=Sn.mark({class:c})))},r,i);return s.finish()}}const QIe=nm.high(ei.fromClass(XIe,{decorations:e=>e.decorations})),Jne=q3.define([{tag:Jt.meta,color:"#404740"},{tag:Jt.link,textDecoration:"underline"},{tag:Jt.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Jt.emphasis,fontStyle:"italic"},{tag:Jt.strong,fontWeight:"bold"},{tag:Jt.strikethrough,textDecoration:"line-through"},{tag:Jt.keyword,color:"#708"},{tag:[Jt.atom,Jt.bool,Jt.url,Jt.contentSeparator,Jt.labelName],color:"#219"},{tag:[Jt.literal,Jt.inserted],color:"#164"},{tag:[Jt.string,Jt.deleted],color:"#a11"},{tag:[Jt.regexp,Jt.escape,Jt.special(Jt.string)],color:"#e40"},{tag:Jt.definition(Jt.variableName),color:"#00f"},{tag:Jt.local(Jt.variableName),color:"#30a"},{tag:[Jt.typeName,Jt.namespace],color:"#085"},{tag:Jt.className,color:"#167"},{tag:[Jt.special(Jt.variableName),Jt.macroName],color:"#256"},{tag:Jt.definition(Jt.propertyName),color:"#00c"},{tag:Jt.comment,color:"#940"},{tag:Jt.invalid,color:"#f00"}]),JIe=It.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Zne=1e4,ese="()[]{}",tse=an.define({combine(e){return zu(e,{afterCursor:!0,brackets:ese,maxScanDistance:Zne,renderMatch:tRe})}}),ZIe=Sn.mark({class:"cm-matchingBracket"}),eRe=Sn.mark({class:"cm-nonmatchingBracket"});function tRe(e){let t=[],n=e.matched?ZIe:eRe;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 Bz(e){let t=[],n=e.facet(tse);for(let s of e.selection.ranges){if(!s.empty)continue;let r=wu(e,s.head,-1,n)||s.head>0&&wu(e,s.head-1,1,n)||n.afterCursor&&(wu(e,s.head,1,n)||s.head<e.doc.length&&wu(e,s.head+1,-1,n));r&&(t=t.concat(n.renderMatch(r,e)))}return Sn.set(t,!0)}const nRe=ei.fromClass(class{constructor(e){this.paused=!1,this.decorations=Bz(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=Bz(e.state),this.paused=!1))}},{decorations:e=>e.decorations}),sRe=[nRe,JIe];function rRe(e={}){return[tse.of(e),sRe]}const iRe=new Us;function kA(e,t,n){let s=e.prop(t<0?Us.openedBy:Us.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 _A(e){let t=e.type.prop(iRe);return t?t(e.node):e}function wu(e,t,n,s={}){let r=s.maxScanDistance||Zne,i=s.brackets||ese,o=Vo(e),a=o.resolveInner(t,n);for(let c=a;c;c=c.parent){let u=kA(c.type,n,i);if(u&&c.from<c.to){let d=_A(c);if(d&&(n>0?t>=d.from&&t<d.to:t>d.from&&t<=d.to))return oRe(e,t,n,c,d,u,i)}}return aRe(e,t,n,o,a.type,r,i)}function oRe(e,t,n,s,r,i,o){let a=s.parent,c={from:r.from,to:r.to},u=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(u==0&&i.indexOf(d.type.name)>-1&&d.from<d.to){let h=_A(d);return{start:c,end:h?{from:h.from,to:h.to}:void 0,matched:!0}}else if(kA(d.type,n,o))u++;else if(kA(d.type,-n,o)){if(u==0){let h=_A(d);return{start:c,end:h&&h.from<h.to?{from:h.from,to:h.to}:void 0,matched:!1}}u--}}while(n<0?d.prevSibling():d.nextSibling());return{start:c,matched:!1}}function aRe(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),c=o.indexOf(a);if(c<0||c%2==0!=n>0)return null;let u={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 m=0;!d.next().done&&m<=i;){let p=d.value;n<0&&(m+=p.length);let g=t+m*n;for(let b=n>0?0:p.length-1,v=n>0?p.length:-1;b!=v;b+=n){let x=o.indexOf(p[b]);if(!(x<0||s.resolveInner(g+b,1).type!=r))if(x%2==0==n>0)h++;else{if(h==1)return{start:u,end:{from:g+b,to:g+b+1},matched:x>>1==c>>1};h--}}n>0&&(m+=p.length)}return d.done?{start:u,matched:!1}:null}const lRe=Object.create(null),$z=[uc.none],zz=[],Fz=Object.create(null),cRe=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"]])cRe[e]=uRe(lRe,t);function y6(e,t){zz.indexOf(e)>-1||(zz.push(e),console.warn(t))}function uRe(e,t){let n=[];for(let a of t.split(" ")){let c=[];for(let u of a.split(".")){let d=e[u]||Jt[u];d?typeof d=="function"?c.length?c=c.map(d):y6(u,`Modifier ${u} used at start of tag`):c.length?y6(u,`Tag ${u} used as modifier`):c=Array.isArray(d)?d:[d]:y6(u,`Unknown highlighting tag ${u}`)}for(let u of c)n.push(u)}if(!n.length)return 0;let s=t.replace(/ /g,"_"),r=s+" "+n.map(a=>a.id),i=Fz[r];if(i)return i.id;let o=Fz[r]=uc.define({id:$z.length,name:s,props:[gIe({[s]:n})]});return $z.push(o),o.id}Mr.RTL,Mr.LTR;const dRe=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),s=GM(e.state,n.from);return s.line?hRe(e):s.block?mRe(e):!1};function WM(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 hRe=WM(bRe,0),fRe=WM(nse,0),mRe=WM((e,t)=>nse(e,t,gRe(t)),0);function GM(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const Pb=50;function pRe(e,{open:t,close:n},s,r){let i=e.sliceDoc(s-Pb,s),o=e.sliceDoc(r,r+Pb),a=/\s*$/.exec(i)[0].length,c=/^\s*/.exec(o)[0].length,u=i.length-a;if(i.slice(u-t.length,u)==t&&o.slice(c,c+n.length)==n)return{open:{pos:s-a,margin:a&&1},close:{pos:r+c,margin:c&&1}};let d,h;r-s<=2*Pb?d=h=e.sliceDoc(s,r):(d=e.sliceDoc(s,s+Pb),h=e.sliceDoc(r-Pb,r));let m=/^\s*/.exec(d)[0].length,p=/\s*$/.exec(h)[0].length,g=h.length-p-n.length;return d.slice(m,m+t.length)==t&&h.slice(g,g+n.length)==n?{open:{pos:s+m+t.length,margin:/\s/.test(d.charAt(m+t.length))?1:0},close:{pos:r-p-n.length,margin:/\s/.test(h.charAt(g-1))?1:0}}:null}function gRe(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 nse(e,t,n=t.selection.ranges){let s=n.map(i=>GM(t,i.from).block);if(!s.every(i=>i))return null;let r=n.map((i,o)=>pRe(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 c=s[o],{open:u,close:d}=a;i.push({from:u.pos-c.open.length,to:u.pos+u.margin},{from:d.pos-d.margin,to:d.pos+c.close.length})}return{changes:i}}return null}function bRe(e,t,n=t.selection.ranges){let s=[],r=-1;e:for(let{from:i,to:o}of n){let a=s.length,c=1e9,u;for(let d=i;d<=o;){let h=t.doc.lineAt(d);if(u==null&&(u=GM(t,h.from).line,!u))continue e;if(h.from>r&&(i==o||o>h.from)){r=h.from;let m=/^\s*/.exec(h.text)[0].length,p=m==h.length,g=h.text.slice(m,m+u.length)==u?m:-1;m<h.text.length&&m<c&&(c=m),s.push({line:h,comment:g,token:u,indent:m,empty:p,single:!1})}d=h.to+1}if(c<1e9)for(let d=a;d<s.length;d++)s[d].indent<s[d].line.text.length&&(s[d].indent=c);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:c,indent:u,empty:d,single:h}of s)(h||!d)&&i.push({from:a.from+u,insert:c+" "});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:c}of s)if(a>=0){let u=o.from+a,d=u+c.length;o.text[d-o.from]==" "&&d++,i.push({from:u,to:d})}return{changes:i}}return null}const SA=nh.define(),yRe=nh.define(),xRe=an.define(),sse=an.define({combine(e){return zu(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)})}}),rse=Io.define({create(){return ku.empty},update(e,t){let n=t.state.facet(sse),s=t.annotation(SA);if(s){let c=$a.fromTransaction(t,s.selection),u=s.side,d=u==0?e.undone:e.done;return c?d=OS(d,d.length,n.minDepth,c):d=ase(d,t.startState.selection),new ku(u==0?s.rest:d,u==0?d:s.rest)}let r=t.annotation(yRe);if((r=="full"||r=="before")&&(e=e.isolate()),t.annotation(Wi.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let i=$a.fromTransaction(t),o=t.annotation(Wi.time),a=t.annotation(Wi.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 ku(e.done.map($a.fromJSON),e.undone.map($a.fromJSON))}});function KM(e={}){return[rse,sse.of(e),It.domEventHandlers({beforeinput(t,n){let s=t.inputType=="historyUndo"?ise:t.inputType=="historyRedo"?CA:null;return s?(t.preventDefault(),s(n)):!1}})]}function H3(e,t){return function({state:n,dispatch:s}){if(!t&&n.readOnly)return!1;let r=n.field(rse,!1);if(!r)return!1;let i=r.pop(e,n,t);return i?(s(i),!0):!1}}const ise=H3(0,!1),CA=H3(1,!1),vRe=H3(0,!0),wRe=H3(1,!0);class $a{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 $a(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 $a(t.changes&&Ui.fromJSON(t.changes),[],t.mapped&&Su.fromJSON(t.mapped),t.startSelection&&Ye.fromJSON(t.startSelection),t.selectionsAfter.map(Ye.fromJSON))}static fromTransaction(t,n){let s=tc;for(let r of t.startState.facet(xRe)){let i=r(t);i.length&&(s=s.concat(i))}return!s.length&&t.changes.empty?null:new $a(t.changes.invert(t.startState.doc),s,void 0,n||t.startState.selection,tc)}static selection(t){return new $a(void 0,tc,void 0,void 0,t)}}function OS(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 kRe(e,t){let n=[],s=!1;return e.iterChangedRanges((r,i)=>n.push(r,i)),t.iterChangedRanges((r,i,o,a)=>{for(let c=0;c<n.length;){let u=n[c++],d=n[c++];a>=u&&o<=d&&(s=!0)}}),s}function _Re(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,s)=>n.empty!=t.ranges[s].empty).length===0}function ose(e,t){return e.length?t.length?e.concat(t):e:t}const tc=[],SRe=200;function ase(e,t){if(e.length){let n=e[e.length-1],s=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-SRe));return s.length&&s[s.length-1].eq(t)?e:(s.push(t),OS(e,e.length-1,1e9,n.setSelAfter(s)))}else return[$a.selection([t])]}function CRe(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 x6(e,t){if(!e.length)return e;let n=e.length,s=tc;for(;n;){let r=TRe(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?[$a.selection(s)]:tc}function TRe(e,t,n){let s=ose(e.selectionsAfter.length?e.selectionsAfter.map(a=>a.map(t)):tc,n);if(!e.changes)return $a.selection(s);let r=e.changes.map(t),i=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(i):i;return new $a(r,ss.mapEffects(e.effects,t),o,e.startSelection.map(i),s)}const ERe=/^(input\.type|delete)($|\.)/;class ku{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 ku(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||ERe.test(s))&&(!a.selectionsAfter.length&&n-this.prevTime<r.newGroupDelay&&r.joinToEvent(i,kRe(a.changes,t.changes))||s=="input.type.compose")?o=OS(o,o.length-1,r.minDepth,new $a(t.changes.compose(a.changes),ose(ss.mapEffects(t.effects,a.changes),a.effects),a.mapped,a.startSelection,tc)):o=OS(o,o.length,r.minDepth,t),new ku(o,tc,n,s)}addSelection(t,n,s,r){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:tc;return i.length>0&&n-this.prevTime<r&&s==this.prevUserEvent&&s&&/^select($|\.)/.test(s)&&_Re(i[i.length-1],t)?this:new ku(ase(this.done,t),this.undone,n,s)}addMapping(t){return new ku(x6(this.done,t),x6(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:SA.of({side:t,rest:CRe(r),selection:o}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let a=r.length==1?tc:r.slice(0,r.length-1);return i.mapped&&(a=x6(a,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:SA.of({side:t,rest:a,selection:o}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}ku.empty=new ku(tc,tc);const YM=[{key:"Mod-z",run:ise,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:CA,preventDefault:!0},{linux:"Ctrl-Shift-z",run:CA,preventDefault:!0},{key:"Mod-u",run:vRe,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:wRe,preventDefault:!0}];function B1(e,t){return Ye.create(e.ranges.map(t),e.mainIndex)}function Mc(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function Ic({state:e,dispatch:t},n){let s=B1(e.selection,n);return s.eq(e.selection,!0)?!1:(t(Mc(e,s)),!0)}function U3(e,t){return Ye.cursor(t?e.to:e.from)}function lse(e,t){return Ic(e,n=>n.empty?e.moveByChar(n,t):U3(n,t))}function Xo(e){return e.textDirectionAt(e.state.selection.main.head)==Mr.LTR}const cse=e=>lse(e,!Xo(e)),use=e=>lse(e,Xo(e));function dse(e,t){return Ic(e,n=>n.empty?e.moveByGroup(n,t):U3(n,t))}const ARe=e=>dse(e,!Xo(e)),NRe=e=>dse(e,Xo(e));function jRe(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 V3(e,t,n){let s=Vo(e).resolveInner(t.head),r=n?Us.closedBy:Us.openedBy;for(let c=t.head;;){let u=n?s.childAfter(c):s.childBefore(c);if(!u)break;jRe(e,u,r)?s=u:c=n?u.to:u.from}let i=s.type.prop(r),o,a;return i&&(o=n?wu(e,s.from,1):wu(e,s.to,-1))&&o.matched?a=n?o.end.to:o.end.from:a=n?s.to:s.from,Ye.cursor(a,n?-1:1)}const MRe=e=>Ic(e,t=>V3(e.state,t,!Xo(e))),IRe=e=>Ic(e,t=>V3(e.state,t,Xo(e)));function hse(e,t){return Ic(e,n=>{if(!n.empty)return U3(n,t);let s=e.moveVertically(n,t);return s.head!=n.head?s:e.moveToLineBoundary(n,t)})}const fse=e=>hse(e,!1),mse=e=>hse(e,!0);function pse(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,s=0,r;if(t){for(let i of e.state.facet(It.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 gse(e,t){let n=pse(e),{state:s}=e,r=B1(s.selection,o=>o.empty?e.moveVertically(o,t,n.height):U3(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(),c=a.top+n.marginTop,u=a.bottom-n.marginBottom;o&&o.top>c&&o.bottom<u&&(i=It.scrollIntoView(r.main.head,{y:"start",yMargin:o.top-c}))}return e.dispatch(Mc(s,r),{effects:i}),!0}const qz=e=>gse(e,!1),TA=e=>gse(e,!0);function sm(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=Ye.cursor(s.from+i))}return r}const RRe=e=>Ic(e,t=>sm(e,t,!0)),DRe=e=>Ic(e,t=>sm(e,t,!1)),LRe=e=>Ic(e,t=>sm(e,t,!Xo(e))),PRe=e=>Ic(e,t=>sm(e,t,Xo(e))),ORe=e=>Ic(e,t=>Ye.cursor(e.lineBlockAt(t.head).from,1)),BRe=e=>Ic(e,t=>Ye.cursor(e.lineBlockAt(t.head).to,-1));function $Re(e,t,n){let s=!1,r=B1(e.selection,i=>{let o=wu(e,i.head,-1)||wu(e,i.head,1)||i.head>0&&wu(e,i.head-1,1)||i.head<e.doc.length&&wu(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 Ye.cursor(a)});return s?(t(Mc(e,r)),!0):!1}const zRe=({state:e,dispatch:t})=>$Re(e,t);function hc(e,t){let n=B1(e.state.selection,s=>{let r=t(s);return Ye.range(s.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return n.eq(e.state.selection)?!1:(e.dispatch(Mc(e.state,n)),!0)}function bse(e,t){return hc(e,n=>e.moveByChar(n,t))}const yse=e=>bse(e,!Xo(e)),xse=e=>bse(e,Xo(e));function vse(e,t){return hc(e,n=>e.moveByGroup(n,t))}const FRe=e=>vse(e,!Xo(e)),qRe=e=>vse(e,Xo(e)),HRe=e=>hc(e,t=>V3(e.state,t,!Xo(e))),URe=e=>hc(e,t=>V3(e.state,t,Xo(e)));function wse(e,t){return hc(e,n=>e.moveVertically(n,t))}const kse=e=>wse(e,!1),_se=e=>wse(e,!0);function Sse(e,t){return hc(e,n=>e.moveVertically(n,t,pse(e).height))}const Hz=e=>Sse(e,!1),Uz=e=>Sse(e,!0),VRe=e=>hc(e,t=>sm(e,t,!0)),WRe=e=>hc(e,t=>sm(e,t,!1)),GRe=e=>hc(e,t=>sm(e,t,!Xo(e))),KRe=e=>hc(e,t=>sm(e,t,Xo(e))),YRe=e=>hc(e,t=>Ye.cursor(e.lineBlockAt(t.head).from)),XRe=e=>hc(e,t=>Ye.cursor(e.lineBlockAt(t.head).to)),Vz=({state:e,dispatch:t})=>(t(Mc(e,{anchor:0})),!0),Wz=({state:e,dispatch:t})=>(t(Mc(e,{anchor:e.doc.length})),!0),Gz=({state:e,dispatch:t})=>(t(Mc(e,{anchor:e.selection.main.anchor,head:0})),!0),Kz=({state:e,dispatch:t})=>(t(Mc(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),QRe=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),JRe=({state:e,dispatch:t})=>{let n=W3(e).map(({from:s,to:r})=>Ye.range(s,Math.min(r+1,e.doc.length)));return t(e.update({selection:Ye.create(n),userEvent:"select"})),!0},ZRe=({state:e,dispatch:t})=>{let n=B1(e.selection,s=>{let r=Vo(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 Ye.range(a.to,a.from)}return s});return n.eq(e.selection)?!1:(t(Mc(e,n)),!0)};function Cse(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 c=e.moveVertically(a,t);if(c.head<o.from||c.head>o.to){r.some(u=>u.head==c.head)||r.push(c);break}else{if(c.head==a.head)break;a=c}}}return r.length==s.ranges.length?!1:(e.dispatch(Mc(n,Ye.create(r,r.length-1))),!0)}const eDe=e=>Cse(e,!1),tDe=e=>Cse(e,!0),nDe=({state:e,dispatch:t})=>{let n=e.selection,s=null;return n.ranges.length>1?s=Ye.create([n.main]):n.main.empty||(s=Ye.create([Ye.cursor(n.main.head)])),s?(t(Mc(e,s)),!0):!1};function Ov(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 c=t(i);c<o?(n="delete.backward",c=Pk(e,c,!1)):c>o&&(n="delete.forward",c=Pk(e,c,!0)),o=Math.min(o,c),a=Math.max(a,c)}else o=Pk(e,o,!1),a=Pk(e,a,!0);return o==a?{range:i}:{changes:{from:o,to:a},range:Ye.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"?It.announce.of(s.phrase("Selection deleted")):void 0})),!0)}function Pk(e,t,n){if(e instanceof It)for(let s of e.state.facet(It.atomicRanges).map(r=>r(e)))s.between(t,t,(r,i)=>{r<t&&i>t&&(t=n?i:r)});return t}const Tse=(e,t,n)=>Ov(e,s=>{let r=s.from,{state:i}=e,o=i.doc.lineAt(r),a,c;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 u=O1(a,i.tabSize),d=u%DS(i)||DS(i);for(let h=0;h<d&&a[a.length-1-h]==" ";h++)r--;c=r}else c=co(o.text,r-o.from,t,t)+o.from,c==r&&o.number!=(t?i.doc.lines:1)?c+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(c-o.from,r-o.from))&&(c=co(o.text,c-o.from,!1,!1)+o.from);return c}),EA=e=>Tse(e,!1,!0),Ese=e=>Tse(e,!0,!1),Ase=(e,t)=>Ov(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 c=co(i.text,s-i.from,t)+i.from,u=i.text.slice(Math.min(s,c)-i.from,Math.max(s,c)-i.from),d=o(u);if(a!=null&&d!=a)break;(u!=" "||s!=n.head)&&(a=d),s=c}return s}),Nse=e=>Ase(e,!1),sDe=e=>Ase(e,!0),rDe=e=>Ov(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),iDe=e=>Ov(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),oDe=e=>Ov(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),aDe=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(s=>({changes:{from:s.from,to:s.to,insert:er.of(["",""])},range:Ye.cursor(s.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},lDe=({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:co(i.text,r-i.from,!1)+i.from,a=r==i.to?r+1:co(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:Ye.cursor(a)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function W3(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 jse(e,t,n){if(e.readOnly)return!1;let s=[],r=[];for(let i of W3(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 c of i.ranges)r.push(Ye.range(Math.min(e.doc.length,c.anchor+a),Math.min(e.doc.length,c.head+a)))}else{s.push({from:o.from,to:i.from},{from:i.to,insert:e.lineBreak+o.text});for(let c of i.ranges)r.push(Ye.range(c.anchor-a,c.head-a))}}return s.length?(t(e.update({changes:s,scrollIntoView:!0,selection:Ye.create(r,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const cDe=({state:e,dispatch:t})=>jse(e,t,!1),uDe=({state:e,dispatch:t})=>jse(e,t,!0);function Mse(e,t,n){if(e.readOnly)return!1;let s=[];for(let i of W3(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 dDe=({state:e,dispatch:t})=>Mse(e,t,!1),hDe=({state:e,dispatch:t})=>Mse(e,t,!0),fDe=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(W3(t).map(({from:r,to:i})=>(r>0?r--:i<t.doc.length&&i++,{from:r,to:i}))),s=B1(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 mDe(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=Vo(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(Us.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 Yz=Ise(!1),pDe=Ise(!0);function Ise(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),c=!e&&i==o&&mDe(t,i);e&&(i=o=(o<=a.to?a:t.doc.lineAt(o)).to);let u=new z3(t,{simulateBreak:i,simulateDoubleBreak:!!c}),d=UM(u,i);for(d==null&&(d=O1(/^\s*/.exec(t.doc.lineAt(i).text)[0],t.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;c?{from:i,to:o}=c:i>a.from&&i<a.from+100&&!/\S/.test(a.text.slice(0,i))&&(i=a.from);let h=["",zx(t,d)];return c&&h.push(zx(t,u.lineIndent(a.from,-1))),{changes:{from:i,to:o,insert:er.of(h)},range:Ye.cursor(i+1+h[1].length)}});return n(t.update(s,{scrollIntoView:!0,userEvent:"input"})),!0}}function XM(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:Ye.range(i.mapPos(s.anchor,1),i.mapPos(s.head,1))}})}const gDe=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),s=new z3(e,{overrideIndentation:i=>{let o=n[i];return o??-1}}),r=XM(e,(i,o,a)=>{let c=UM(s,i.from);if(c==null)return;/\S/.test(i.text)||(c=0);let u=/^\s*/.exec(i.text)[0],d=zx(e,c);(u!=d||a.from<i.from+u.length)&&(n[i.from]=c,o.push({from:i.from,to:i.from+u.length,insert:d}))});return r.changes.empty||t(e.update(r,{userEvent:"indent"})),!0},bDe=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(XM(e,(n,s)=>{s.push({from:n.from,insert:e.facet(HM)})}),{userEvent:"input.indent"})),!0),yDe=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(XM(e,(n,s)=>{let r=/^\s*/.exec(n.text)[0];if(!r)return;let i=O1(r,e.tabSize),o=0,a=zx(e,Math.max(0,i-DS(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),xDe=e=>(e.setTabFocusMode(),!0),vDe=[{key:"Ctrl-b",run:cse,shift:yse,preventDefault:!0},{key:"Ctrl-f",run:use,shift:xse},{key:"Ctrl-p",run:fse,shift:kse},{key:"Ctrl-n",run:mse,shift:_se},{key:"Ctrl-a",run:ORe,shift:YRe},{key:"Ctrl-e",run:BRe,shift:XRe},{key:"Ctrl-d",run:Ese},{key:"Ctrl-h",run:EA},{key:"Ctrl-k",run:rDe},{key:"Ctrl-Alt-h",run:Nse},{key:"Ctrl-o",run:aDe},{key:"Ctrl-t",run:lDe},{key:"Ctrl-v",run:TA}],wDe=[{key:"ArrowLeft",run:cse,shift:yse,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:ARe,shift:FRe,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:LRe,shift:GRe,preventDefault:!0},{key:"ArrowRight",run:use,shift:xse,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:NRe,shift:qRe,preventDefault:!0},{mac:"Cmd-ArrowRight",run:PRe,shift:KRe,preventDefault:!0},{key:"ArrowUp",run:fse,shift:kse,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Vz,shift:Gz},{mac:"Ctrl-ArrowUp",run:qz,shift:Hz},{key:"ArrowDown",run:mse,shift:_se,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Wz,shift:Kz},{mac:"Ctrl-ArrowDown",run:TA,shift:Uz},{key:"PageUp",run:qz,shift:Hz},{key:"PageDown",run:TA,shift:Uz},{key:"Home",run:DRe,shift:WRe,preventDefault:!0},{key:"Mod-Home",run:Vz,shift:Gz},{key:"End",run:RRe,shift:VRe,preventDefault:!0},{key:"Mod-End",run:Wz,shift:Kz},{key:"Enter",run:Yz,shift:Yz},{key:"Mod-a",run:QRe},{key:"Backspace",run:EA,shift:EA,preventDefault:!0},{key:"Delete",run:Ese,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Nse,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:sDe,preventDefault:!0},{mac:"Mod-Backspace",run:iDe,preventDefault:!0},{mac:"Mod-Delete",run:oDe,preventDefault:!0}].concat(vDe.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),QM=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:MRe,shift:HRe},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:IRe,shift:URe},{key:"Alt-ArrowUp",run:cDe},{key:"Shift-Alt-ArrowUp",run:dDe},{key:"Alt-ArrowDown",run:uDe},{key:"Shift-Alt-ArrowDown",run:hDe},{key:"Mod-Alt-ArrowUp",run:eDe},{key:"Mod-Alt-ArrowDown",run:tDe},{key:"Escape",run:nDe},{key:"Mod-Enter",run:pDe},{key:"Alt-l",mac:"Ctrl-l",run:JRe},{key:"Mod-i",run:ZRe,preventDefault:!0},{key:"Mod-[",run:yDe},{key:"Mod-]",run:bDe},{key:"Mod-Alt-\\",run:gDe},{key:"Shift-Mod-k",run:fDe},{key:"Shift-Mod-\\",run:zRe},{key:"Mod-/",run:dRe},{key:"Alt-A",run:fRe},{key:"Ctrl-m",mac:"Shift-Alt-m",run:xDe}].concat(wDe);class Rse{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=Vo(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(Dse(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 Xz(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 kDe(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=Xz(t)+Xz(n)+"*$";return[new RegExp("^"+s),new RegExp(s)]}function _De(e){let t=e.map(r=>typeof r=="string"?{label:r}:r),[n,s]=t.every(r=>/^\w+$/.test(r.label))?[/\w*$/,/\w+$/]:kDe(t);return r=>{let i=r.matchBefore(s);return i||r.explicit?{from:i?i.from:r.pos,options:t,validFor:n}:null}}class Qz{constructor(t,n,s,r){this.completion=t,this.source=n,this.match=s,this.score=r}}function ip(e){return e.selection.main.from}function Dse(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 Lse=nh.define();function SDe(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 c=e.toText(t);return{changes:{from:a.from+i,to:s==r.from?a.to:a.from+o,insert:c},range:Ye.cursor(a.from+i+c.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const Jz=new WeakMap;function CDe(e){if(!Array.isArray(e))return e;let t=Jz.get(e);return t||Jz.set(e,t=_De(e)),t}const BS=ss.define(),Fx=ss.define();class TDe{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=La(t,n),r=du(s);this.chars.push(s);let i=t.slice(n,n+r),o=i.toUpperCase();this.folded.push(La(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 y=La(t,0),w=du(y),k=w==t.length?0:-100;if(y!=n[0])if(y==s[0])k+=-200;else return null;return this.ret(k,[0,w])}let a=t.indexOf(this.pattern);if(a==0)return this.ret(t.length==this.pattern.length?0:-100,[0,this.pattern.length]);let c=n.length,u=0;if(a<0){for(let y=0,w=Math.min(t.length,200);y<w&&u<c;){let k=La(t,y);(k==n[u]||k==s[u])&&(r[u++]=y),y+=du(k)}if(u<c)return null}let d=0,h=0,m=!1,p=0,g=-1,b=-1,v=/[a-z]/.test(t),x=!0;for(let y=0,w=Math.min(t.length,200),k=0;y<w&&h<c;){let T=La(t,y);a<0&&(d<c&&T==n[d]&&(i[d++]=y),p<c&&(T==n[p]||T==s[p]?(p==0&&(g=y),b=y+1,p++):p=0));let S,C=T<255?T>=48&&T<=57||T>=97&&T<=122?2:T>=65&&T<=90?1:0:(S=wM(T))!=S.toLowerCase()?1:S!=S.toUpperCase()?2:0;(!y||C==1&&v||k==0&&C!=0)&&(n[h]==T||s[h]==T&&(m=!0)?o[h++]=y:o.length&&(x=!1)),k=C,y+=du(T)}return h==c&&o[0]==0&&x?this.result(-100+(m?-200:0),o,t):p==c&&g==0?this.ret(-200-t.length+(b==t.length?0:-100),[0,b]):a>-1?this.ret(-700-t.length,[a,a+this.pattern.length]):p==c?this.ret(-900-t.length,[g,b]):h==c?this.result(-100+(m?-200:0)+-700+(x?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?du(La(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 EDe{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 lo=an.define({combine(e){return zu(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:ADe,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=>Zz(t(s),n(s)),optionClass:(t,n)=>s=>Zz(t(s),n(s)),addToOptions:(t,n)=>t.concat(n),filterStrict:(t,n)=>t||n})}});function Zz(e,t){return e?t?e+" "+t:e:t}function ADe(e,t,n,s,r,i){let o=e.textDirection==Mr.RTL,a=o,c=!1,u="top",d,h,m=t.left-r.left,p=r.right-t.right,g=s.right-s.left,b=s.bottom-s.top;if(a&&m<Math.min(g,p)?a=!1:!a&&p<Math.min(g,m)&&(a=!0),g<=(a?m:p))d=Math.max(r.top,Math.min(n.top,r.bottom-b))-t.top,h=Math.min(400,a?m:p);else{c=!0,h=Math.min(400,(o?t.right:r.right-t.left)-30);let y=r.bottom-t.bottom;y>=b||y>t.top?d=n.bottom-t.top:(u="bottom",d=t.bottom-n.top)}let v=(t.bottom-t.top)/i.offsetHeight,x=(t.right-t.left)/i.offsetWidth;return{style:`${u}: ${d/v}px; max-width: ${h/x}px`,class:"cm-completionInfo-"+(c?o?"left-narrow":"right-narrow":a?"left":"right")}}const JM=ss.define();function NDe(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,c=0;for(let u=0;u<i.length;){let d=i[u++],h=i[u++];d>c&&o.appendChild(document.createTextNode(a.slice(c,d)));let m=o.appendChild(document.createElement("span"));m.appendChild(document.createTextNode(a.slice(d,h))),m.className="cm-completionMatchedText",c=h}return c<a.length&&o.appendChild(document.createTextNode(a.slice(c))),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 v6(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 jDe{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:c=>this.placeInfo(c),key:this},this.space=null,this.currentClass="";let r=t.state.field(n),{options:i,selected:o}=r.open,a=t.state.facet(lo);this.optionContent=NDe(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=v6(i.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",c=>{let{options:u}=t.state.field(n).open;for(let d=c.target,h;d&&d!=this.dom;d=d.parentNode)if(d.nodeName=="LI"&&(h=/-(\d+)$/.exec(d.id))&&+h[1]<u.length){this.applyCompletion(t,u[+h[1]]),c.preventDefault();return}if(c.target==this.list){let d=this.list.classList.contains("cm-completionListIncompleteTop")&&c.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&c.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;d!=null&&(t.dispatch({effects:JM.of(d)}),c.preventDefault())}}),this.dom.addEventListener("focusout",c=>{let u=t.state.field(this.stateField,!1);u&&u.tooltip&&t.state.facet(lo).closeOnBlur&&c.relatedTarget!=t.contentDOM&&t.dispatch({effects:Fx.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=v6(i.length,o,t.state.facet(lo).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=v6(n.options.length,n.selected,this.view.state.facet(lo).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=>Ba(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&&IDe(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(lo).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:c}=t[o],{section:u}=a;if(u){let m=typeof u=="string"?u:u.name;if(m!=i&&(o>s.from||s.from==0))if(i=m,typeof u!="string"&&u.header)r.appendChild(u.header(u));else{let p=r.appendChild(document.createElement("completion-section"));p.textContent=m}}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 m of this.optionContent){let p=m(a,this.view.state,this.view,c);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 MDe(e,t){return n=>new jDe(n,e,t)}function IDe(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 eF(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function RDe(e,t){let n=[],s=null,r=null,i=d=>{n.push(d);let{section:h}=d.completion;if(h){s||(s=[]);let m=typeof h=="string"?h:h.name;s.some(p=>p.name==m)||s.push(typeof h=="string"?{name:m}:h)}},o=t.facet(lo);for(let d of e)if(d.hasResult()){let h=d.result.getMatch;if(d.result.filter===!1)for(let m of d.result.options)i(new Qz(m,d.source,h?h(m):[],1e9-n.length));else{let m=t.sliceDoc(d.from,d.to),p,g=o.filterStrict?new EDe(m):new TDe(m);for(let b of d.result.options)if(p=g.match(b.label)){let v=b.displayLabel?h?h(b,p.matched):[]:p.matched,x=p.score+(b.boost||0);if(i(new Qz(b,d.source,v,x)),typeof b.section=="object"&&b.section.rank==="dynamic"){let{name:y}=b.section;r||(r=Object.create(null)),r[y]=Math.max(x,r[y]||-1e9)}}}}if(s){let d=Object.create(null),h=0,m=(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(m))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=[],c=null,u=o.compareCompletions;for(let d of n.sort((h,m)=>m.score-h.score||u(h.completion,m.completion))){let h=d.completion;!c||c.label!=h.label||c.detail!=h.detail||c.type!=null&&h.type!=null&&c.type!=h.type||c.apply!=h.apply||c.boost!=h.boost?a.push(d):eF(d.completion)>eF(c)&&(a[a.length-1]=d),c=d.completion}return a}class X0{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 X0(this.options,tF(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,s,r,i,o){if(r&&!o&&t.some(u=>u.isPending))return r.setDisabled();let a=RDe(t,n);if(!a.length)return r&&t.some(u=>u.isPending)?r.setDisabled():null;let c=n.facet(lo).selectOnOpen?0:-1;if(r&&r.selected!=c&&r.selected!=-1){let u=r.options[r.selected].completion;for(let d=0;d<a.length;d++)if(a[d].completion==u){c=d;break}}return new X0(a,tF(s,c),{pos:t.reduce((u,d)=>d.hasResult()?Math.min(u,d.from):u,1e8),create:$De,above:i.aboveCursor},r?r.timestamp:Date.now(),c,!1)}map(t){return new X0(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new X0(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class $S{constructor(t,n,s){this.active=t,this.id=n,this.open=s}static start(){return new $S(ODe,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,s=n.facet(lo),i=(s.override||n.languageDataAt("autocomplete",ip(n)).map(CDe)).map(c=>(this.active.find(d=>d.source==c)||new nc(c,this.active.some(d=>d.state!=0)?1:0)).update(t,s));i.length==this.active.length&&i.every((c,u)=>c==this.active[u])&&(i=this.active);let o=this.open,a=t.effects.some(c=>c.is(ZM));o&&t.docChanged&&(o=o.map(t.changes)),t.selection||i.some(c=>c.hasResult()&&t.changes.touchesRange(c.from,c.to))||!DDe(i,this.active)||a?o=X0.build(i,n,this.id,o,s,a):o&&o.disabled&&!i.some(c=>c.isPending)&&(o=null),!o&&i.every(c=>!c.isPending)&&i.some(c=>c.hasResult())&&(i=i.map(c=>c.hasResult()?new nc(c.source,0):c));for(let c of t.effects)c.is(JM)&&(o=o&&o.setSelected(c.value,this.id));return i==this.active&&o==this.open?this:new $S(i,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?LDe:PDe}}function DDe(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 LDe={"aria-autocomplete":"list"},PDe={};function tF(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const ODe=[];function Pse(e,t){if(e.isUserEvent("input.complete")){let s=e.annotation(Lse);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 nc{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=Pse(t,n),r=this;(s&8||s&16&&this.touches(t))&&(r=new nc(r.source,0)),s&4&&r.state==0&&(r=new nc(this.source,1)),r=r.updateFor(t,s);for(let i of t.effects)if(i.is(BS))r=new nc(r.source,1,i.value);else if(i.is(Fx))r=new nc(r.source,0);else if(i.is(ZM))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(ip(t.state))}}class xg extends nc{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=ip(t.state);if(a>o||!r||n&2&&(ip(t.startState)==this.from||a<this.limit))return new nc(this.source,n&4?1:0);let c=t.changes.mapPos(this.limit);return BDe(r.validFor,t.state,i,o)?new xg(this.source,this.explicit,c,r,i,o):r.update&&(r=r.update(r,i,o,new Rse(t.state,a,!1)))?new xg(this.source,this.explicit,c,r,r.from,(s=r.to)!==null&&s!==void 0?s:ip(t.state)):new nc(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 xg(this.source,this.explicit,t.mapPos(this.limit),n,t.mapPos(this.from),t.mapPos(this.to,1)):new nc(this.source,0)}touches(t){return t.changes.touchesRange(this.from,this.to)}}function BDe(e,t,n,s){if(!e)return!1;let r=t.sliceDoc(n,s);return typeof e=="function"?e(r,n,s,t):Dse(e,!0).test(r)}const ZM=ss.define({map(e,t){return e.map(n=>n.map(t))}}),ua=Io.define({create(){return $S.start()},update(e,t){return e.update(t)},provide:e=>[BM.from(e,t=>t.tooltip),It.contentAttributes.from(e,t=>t.attrs)]});function eI(e,t){const n=t.completion.apply||t.completion.label;let s=e.state.field(ua).active.find(r=>r.source==t.source);return s instanceof xg?(typeof n=="string"?e.dispatch({...SDe(e.state,n,s.from,s.to),annotations:Lse.of(t.completion)}):n(e,t.completion,s.from,s.to),!0):!1}const $De=MDe(ua,eI);function Gh(e,t="option"){return n=>{let s=n.state.field(ua,!1);if(!s||!s.open||s.open.disabled||Date.now()-s.open.timestamp<n.state.facet(lo).interactionDelay)return!1;let r=1,i;t=="page"&&(i=jne(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:JM.of(a)}),!0}}const Ose=e=>{let t=e.state.field(ua,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(lo).interactionDelay?!1:eI(e,t.open.options[t.open.selected])},W2=e=>e.state.field(ua,!1)?(e.dispatch({effects:BS.of(!0)}),!0):!1,G2=e=>{let t=e.state.field(ua,!1);return!t||!t.active.some(n=>n.state!=0)?!1:(e.dispatch({effects:Fx.of(null)}),!0)};class zDe{constructor(t,n){this.active=t,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const FDe=50,qDe=1e3,HDe=ei.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(ua).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(ua),n=e.state.facet(lo);if(!e.selectionSet&&!e.docChanged&&e.startState.field(ua)==t)return;let s=e.transactions.some(i=>{let o=Pse(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>FDe&&Date.now()-o.time>qDe){for(let a of o.context.abortListeners)try{a()}catch(c){Ba(this.view.state,c)}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(BS)))&&(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(ua);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(lo).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=ip(t),s=new Rse(t,n,e.explicit,this.view),r=new zDe(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:Fx.of(null)}),Ba(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(lo).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(lo),s=this.view.state.field(ua);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=ip(i.updates.length?i.updates[0].startState:this.view.state),c=Math.min(a,i.done.from+(i.active.explicit?0:1)),u=new xg(i.active.source,i.active.explicit,c,i.done,i.done.from,(e=i.done.to)!==null&&e!==void 0?e:a);for(let d of i.updates)u=u.update(d,n);if(u.hasResult()){t.push(u);continue}}let o=s.active.find(a=>a.source==i.active.source);if(o&&o.isPending)if(i.done==null){let a=new nc(i.active.source,0);for(let c of i.updates)a=a.update(c,n);a.isPending||t.push(a)}else this.startQuery(o)}(t.length||s.open&&s.open.disabled)&&this.view.dispatch({effects:ZM.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(ua,!1);if(t&&t.tooltip&&this.view.state.facet(lo).closeOnBlur){let n=t.open&&jne(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Fx.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:BS.of(!1)}),20),this.composing=0}}}),UDe=typeof navigator=="object"&&/Win/.test(navigator.platform),VDe=nm.highest(It.domEventHandlers({keydown(e,t){let n=t.state.field(ua,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(UDe&&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&&eI(t,s),!1}})),WDe=It.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"}}}),qx={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Km=ss.define({map(e,t){let n=t.mapPos(e,-1,ha.TrackAfter);return n??void 0}}),tI=new class extends If{};tI.startSide=1;tI.endSide=-1;const Bse=Io.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(Km)&&(e=e.update({add:[tI.range(n.value,n.value+1)]}));return e}});function GDe(){return[YDe,Bse]}const w6="()[]{}<>«»»«［］｛｝";function $se(e){for(let t=0;t<w6.length;t+=2)if(w6.charCodeAt(t)==e)return w6.charAt(t+1);return wM(e<128?e:e+1)}function zse(e,t){return e.languageDataAt("closeBrackets",t)[0]||qx}const KDe=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),YDe=It.inputHandler.of((e,t,n,s)=>{if((KDe?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let r=e.state.selection.main;if(s.length>2||s.length==2&&du(La(s,0))==1||t!=r.from||n!=r.to)return!1;let i=JDe(e.state,s);return i?(e.dispatch(i),!0):!1}),XDe=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let s=zse(e,e.selection.main.head).brackets||qx.brackets,r=null,i=e.changeByRange(o=>{if(o.empty){let a=ZDe(e.doc,o.head);for(let c of s)if(c==a&&G3(e.doc,o.head)==$se(La(c,0)))return{changes:{from:o.head-c.length,to:o.head+c.length},range:Ye.cursor(o.head-c.length)}}return{range:r=o}});return r||t(e.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!r},QDe=[{key:"Backspace",run:XDe}];function JDe(e,t){let n=zse(e,e.selection.main.head),s=n.brackets||qx.brackets;for(let r of s){let i=$se(La(r,0));if(t==r)return i==r?nLe(e,r,s.indexOf(r+r+r)>-1,n):eLe(e,r,i,n.before||qx.before);if(t==i&&Fse(e,e.selection.main.from))return tLe(e,r,i)}return null}function Fse(e,t){let n=!1;return e.field(Bse).between(0,e.doc.length,s=>{s==t&&(n=!0)}),n}function G3(e,t){let n=e.sliceString(t,t+2);return n.slice(0,du(La(n,0)))}function ZDe(e,t){let n=e.sliceString(t-2,t);return du(La(n,0))==n.length?n:n.slice(1)}function eLe(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:Km.of(o.to+t.length),range:Ye.range(o.anchor+t.length,o.head+t.length)};let a=G3(e.doc,o.head);return!a||/\s/.test(a)||s.indexOf(a)>-1?{changes:{insert:t+n,from:o.head},effects:Km.of(o.head+t.length),range:Ye.cursor(o.head+t.length)}:{range:r=o}});return r?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function tLe(e,t,n){let s=null,r=e.changeByRange(i=>i.empty&&G3(e.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:Ye.cursor(i.head+n.length)}:s={range:i});return s?null:e.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function nLe(e,t,n,s){let r=s.stringPrefixes||qx.stringPrefixes,i=null,o=e.changeByRange(a=>{if(!a.empty)return{changes:[{insert:t,from:a.from},{insert:t,from:a.to}],effects:Km.of(a.to+t.length),range:Ye.range(a.anchor+t.length,a.head+t.length)};let c=a.head,u=G3(e.doc,c),d;if(u==t){if(nF(e,c))return{changes:{insert:t+t,from:c},effects:Km.of(c+t.length),range:Ye.cursor(c+t.length)};if(Fse(e,c)){let m=n&&e.sliceDoc(c,c+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:c,to:c+m.length,insert:m},range:Ye.cursor(c+m.length)}}}else{if(n&&e.sliceDoc(c-2*t.length,c)==t+t&&(d=sF(e,c-2*t.length,r))>-1&&nF(e,d))return{changes:{insert:t+t+t+t,from:c},effects:Km.of(c+t.length),range:Ye.cursor(c+t.length)};if(e.charCategorizer(c)(u)!=Jr.Word&&sF(e,c,r)>-1&&!sLe(e,c,t,r))return{changes:{insert:t+t,from:c},effects:Km.of(c+t.length),range:Ye.cursor(c+t.length)}}return{range:i=a}});return i?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function nF(e,t){let n=Vo(e).resolveInner(t+1);return n.parent&&n.from==t}function sLe(e,t,n,s){let r=Vo(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)),c=a.indexOf(n);if(!c||c>-1&&s.indexOf(a.slice(0,c))>-1){let d=r.firstChild;for(;d&&d.from==r.from&&d.to-d.from>n.length+c;){if(e.sliceDoc(d.to-n.length,d.to)==n)return!1;d=d.firstChild}return!0}let u=r.to==t&&r.parent;if(!u)break;r=u}return!1}function sF(e,t,n){let s=e.charCategorizer(t);if(s(e.sliceDoc(t-1,t))!=Jr.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))!=Jr.Word)return i}return-1}function qse(e={}){return[VDe,ua,lo.of(e),HDe,rLe,WDe]}const Hse=[{key:"Ctrl-Space",run:W2},{mac:"Alt-`",run:W2},{mac:"Alt-i",run:W2},{key:"Escape",run:G2},{key:"ArrowDown",run:Gh(!0)},{key:"ArrowUp",run:Gh(!1)},{key:"PageDown",run:Gh(!0,"page")},{key:"PageUp",run:Gh(!1,"page")},{key:"Enter",run:Ose}],rLe=nm.highest(t1.computeN([lo],e=>e.facet(lo).defaultKeymap?[Hse]:[]));function el(e){let t=e.field(ua,!1);return t&&t.active.some(n=>n.isPending)?"pending":t&&t.active.some(n=>n.state!=0)?"active":null}const rF=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class r1{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(rF(a)):rF,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 La(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=wM(t),s=this.bufferStart+this.bufferPos;this.bufferPos+=du(t);let r=this.normalize(n);if(r.length)for(let i=0,o=s,a=!0;;i++){let c=r.charCodeAt(i),u=this.match(c,o,a,this.bufferPos+this.bufferStart,i==r.length-1);if(u)return this.value=u,this;if(i==r.length-1)break;a&&i<n.length&&n.charCodeAt(i)==c?o++:a=!1}}}match(t,n,s,r,i){let o=null;for(let a=0;a<this.matches.length;){let c=this.matches[a],u=!1;this.query.charCodeAt(c.index)==t&&(c.index==this.query.length-1?o={from:c.from,to:r,precise:i&&c.precise}:(c.index++,u=!0)),u?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"&&(r1.prototype[Symbol.iterator]=function(){return this});const Use={from:-1,to:-1,match:/.*/.exec(""),precise:!0},nI="gm"+(/x/.unicode==null?"":"u");class Vse{constructor(t,n,s,r=0,i=t.length){if(this.text=t,this.to=i,this.curLine="",this.done=!1,this.value=Use,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new Wse(t,n,s,r,i);this.re=new RegExp(n,nI+(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=zS(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=zS(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 k6=new WeakMap;class vg{constructor(t,n){this.from=t,this.text=n}get to(){return this.from+this.text.length}static get(t,n,s){let r=k6.get(t);if(!r||r.from>=s||r.to<=n){let a=new vg(n,t.sliceString(n,s));return k6.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)),k6.set(t,new vg(o,i)),new vg(n,i.slice(n-o,s-o))}}class Wse{constructor(t,n,s,r,i){this.text=t,this.to=i,this.done=!1,this.value=Use,this.matchPos=zS(t,r),this.re=new RegExp(n,nI+(s!=null&&s.ignoreCase?"i":"")),this.test=s==null?void 0:s.test,this.flat=vg.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=zS(this.text,r+(s==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=vg.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Vse.prototype[Symbol.iterator]=Wse.prototype[Symbol.iterator]=function(){return this});function iLe(e){try{return new RegExp(e,nI),!0}catch{return!1}}function zS(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 oLe=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:s,result:r}=qMe(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),[,c,u,d,h]=o,m=d?+d.slice(1):0,p=u?+u:a.number;if(u&&h){let v=p/100;c&&(v=v*(c=="-"?-1:1)+a.number/t.doc.lines),p=Math.round(t.doc.lines*v)}else u&&c&&(p=p*(c=="-"?-1:1)+a.number);let g=t.doc.line(Math.max(1,Math.min(t.doc.lines,p))),b=Ye.cursor(g.from+Math.max(0,Math.min(m,g.length)));e.dispatch({effects:[s,It.scrollIntoView(b.from,{y:"center"})],selection:b})}),!0},aLe={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},lLe=an.define({combine(e){return zu(e,aLe,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function cLe(e){return[mLe,fLe]}const uLe=Sn.mark({class:"cm-selectionMatch"}),dLe=Sn.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function iF(e,t,n,s){return(n==0||e(t.sliceDoc(n-1,n))!=Jr.Word)&&(s==t.doc.length||e(t.sliceDoc(s,s+1))!=Jr.Word)}function hLe(e,t,n,s){return e(t.sliceDoc(n,n+1))==Jr.Word&&e(t.sliceDoc(s-1,s))==Jr.Word}const fLe=ei.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(lLe),{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 c=n.wordAt(r.head);if(!c)return Sn.none;o=n.charCategorizer(r.head),i=n.sliceDoc(c.from,c.to)}else{let c=r.to-r.from;if(c<t.minSelectionLength||c>200)return Sn.none;if(t.wholeWords){if(i=n.sliceDoc(r.from,r.to),o=n.charCategorizer(r.head),!(iF(o,n,r.from,r.to)&&hLe(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 c of e.visibleRanges){let u=new r1(n.doc,i,c.from,c.to);for(;!u.next().done;){let{from:d,to:h}=u.value;if((!o||iF(o,n,d,h))&&(r.empty&&d<=r.from&&h>=r.to?a.push(dLe.range(d,h)):(d>=r.to||h<=r.from)&&a.push(uLe.range(d,h)),a.length>t.maxMatches))return Sn.none}}return Sn.set(a)}},{decorations:e=>e.decorations}),mLe=It.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),pLe=({state:e,dispatch:t})=>{let{selection:n}=e,s=Ye.create(n.ranges.map(r=>e.wordAt(r.head)||Ye.cursor(r.head)),n.mainIndex);return s.eq(n)?!1:(t(e.update({selection:s})),!0)};function gLe(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 r1(e.doc,t,s[s.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new r1(e.doc,t,0,Math.max(0,s[s.length-1].from-1)),o=!0}else{if(o&&s.some(c=>c.from==a.value.from))continue;if(i){let c=e.wordAt(a.value.from);if(!c||c.from!=a.value.from||c.to!=a.value.to)continue}return a.value}}const bLe=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(i=>i.from===i.to))return pLe({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=gLe(e,s);return r?(t(e.update({selection:e.selection.addRange(Ye.range(r.from,r.to),!1),effects:It.scrollIntoView(r.to)})),!0):!1},$1=an.define({combine(e){return zu(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new MLe(t),scrollToMatch:t=>It.scrollIntoView(t)})}});class Gse{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||iLe(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 _Le(this):new vLe(this)}getCursor(t,n=0,s){let r=t.doc?t:qs.create({doc:t});return s==null&&(s=r.doc.length),this.regexp?D0(this,r,n,s):R0(this,r,n,s)}}class Kse{constructor(t){this.spec=t}}function yLe(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 R0(e,t,n,s){let r;return e.wholeWord&&(r=xLe(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(r=yLe(e.test,t,r)),new r1(t.doc,e.unquoted,n,s,e.caseSensitive?void 0:i=>i.toLowerCase(),r)}function xLe(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(FS(r,n-i))!=Jr.Word||t(qS(r,n-i))!=Jr.Word)&&(t(qS(r,s-i))!=Jr.Word||t(FS(r,s-i))!=Jr.Word))}class vLe extends Kse{constructor(t){super(t)}nextMatch(t,n,s){let r=R0(this.spec,t,s,t.doc.length).nextOverlapping();if(r.done){let i=Math.min(t.doc.length,n+this.spec.unquoted.length);r=R0(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=R0(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=R0(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=R0(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 wLe(e,t,n){return(s,r,i)=>(!n||n(s,r,i))&&e(i[0],t,s,r)}function D0(e,t,n,s){let r;return e.wholeWord&&(r=kLe(t.charCategorizer(t.selection.main.head))),e.test&&(r=wLe(e.test,t,r)),new Vse(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:r},n,s)}function FS(e,t){return e.slice(co(e,t,!1),t)}function qS(e,t){return e.slice(t,co(e,t))}function kLe(e){return(t,n,s)=>!s[0].length||(e(FS(s.input,s.index))!=Jr.Word||e(qS(s.input,s.index))!=Jr.Word)&&(e(qS(s.input,s.index+s[0].length))!=Jr.Word||e(FS(s.input,s.index+s[0].length))!=Jr.Word)}class _Le extends Kse{nextMatch(t,n,s){let r=D0(this.spec,t,s,t.doc.length).next();return r.done&&(r=D0(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=D0(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=D0(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=D0(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 Hx=ss.define(),sI=ss.define(),hf=Io.define({create(e){return new _6(AA(e).create(),null)},update(e,t){for(let n of t.effects)n.is(Hx)?e=new _6(n.value.create(),e.panel):n.is(sI)&&(e=new _6(e.query,n.value?rI:null));return e},provide:e=>Ox.from(e,t=>t.panel)});class _6{constructor(t,n){this.query=t,this.panel=n}}const SLe=Sn.mark({class:"cm-searchMatch"}),CLe=Sn.mark({class:"cm-searchMatch cm-searchMatch-selected"}),TLe=ei.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(hf))}update(e){let t=e.state.field(hf);(t!=e.startState.field(hf)||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 Au;for(let r=0,i=n.visibleRanges,o=i.length;r<o;r++){let{from:a,to:c}=i[r];for(;r<o-1&&c>i[r+1].from-2*250;)c=i[++r].to;e.highlight(n.state,a,c,(u,d)=>{let h=n.state.selection.ranges.some(m=>m.from==u&&m.to==d);s.add(u,d,h?CLe:SLe)})}return s.finish()}},{decorations:e=>e.decorations});function Bv(e){return t=>{let n=t.state.field(hf,!1);return n&&n.query.spec.valid?e(t,n):Qse(t)}}const HS=Bv((e,{query:t})=>{let{to:n}=e.state.selection.main,s=t.nextMatch(e.state,n,n);if(!s)return!1;let r=Ye.single(s.from,s.to),i=e.state.facet($1);return e.dispatch({selection:r,effects:[iI(e,s),i.scrollToMatch(r.main,e)],userEvent:"select.search"}),Xse(e),!0}),US=Bv((e,{query:t})=>{let{state:n}=e,{from:s}=n.selection.main,r=t.prevMatch(n,s,s);if(!r)return!1;let i=Ye.single(r.from,r.to),o=e.state.facet($1);return e.dispatch({selection:i,effects:[iI(e,r),o.scrollToMatch(i.main,e)],userEvent:"select.search"}),Xse(e),!0}),ELe=Bv((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:Ye.create(n.map(s=>Ye.range(s.from,s.to))),userEvent:"select.search.matches"}),!0)}),ALe=({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 r1(e.doc,e.sliceDoc(s,r));!a.next().done;){if(i.length>1e3)return!1;a.value.from==s&&(o=i.length),i.push(Ye.range(a.value.from,a.value.to))}return t(e.update({selection:Ye.create(i,o),userEvent:"select.search.matches"})),!0},oF=Bv((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=[],c,u,d=[];o.precise?o.from==s&&o.to==r&&(u=n.toText(t.getReplacement(o)),a.push({from:o.from,to:o.to,insert:u}),d.push(It.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&&(c=Ye.single(o.from,o.to).map(h),d.push(iI(e,o)),d.push(n.facet($1).scrollToMatch(c.main,e))),e.dispatch({changes:h,selection:c,effects:d,userEvent:"input.replace"}),!0}),NLe=Bv((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:It.announce.of(s),userEvent:"input.replace.all"}),!0});function rI(e){return e.state.facet($1).createPanel(e)}function AA(e,t){var n,s,r,i,o;let a=e.selection.main,c=a.empty||a.to>a.from+100?"":e.sliceDoc(a.from,a.to);if(t&&!c)return t;let u=e.facet($1);return new Gse({search:((n=t==null?void 0:t.literal)!==null&&n!==void 0?n:u.literal)?c:c.replace(/\n/g,"\\n"),caseSensitive:(s=t==null?void 0:t.caseSensitive)!==null&&s!==void 0?s:u.caseSensitive,literal:(r=t==null?void 0:t.literal)!==null&&r!==void 0?r:u.literal,regexp:(i=t==null?void 0:t.regexp)!==null&&i!==void 0?i:u.regexp,wholeWord:(o=t==null?void 0:t.wholeWord)!==null&&o!==void 0?o:u.wholeWord})}function Yse(e){let t=$M(e,rI);return t&&t.dom.querySelector("[main-field]")}function Xse(e){let t=Yse(e);t&&t==e.root.activeElement&&t.select()}const Qse=e=>{let t=e.state.field(hf,!1);if(t&&t.panel){let n=Yse(e);if(n&&n!=e.root.activeElement){let s=AA(e.state,t.query.spec);s.valid&&e.dispatch({effects:Hx.of(s)}),n.focus(),n.select()}}else e.dispatch({effects:[sI.of(!0),t?Hx.of(AA(e.state,t.query.spec)):ss.appendConfig.of(RLe)]});return!0},Jse=e=>{let t=e.state.field(hf,!1);if(!t||!t.panel)return!1;let n=$M(e,rI);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:sI.of(!1)}),!0},jLe=[{key:"Mod-f",run:Qse,scope:"editor search-panel"},{key:"F3",run:HS,shift:US,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:HS,shift:US,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Jse,scope:"editor search-panel"},{key:"Mod-Shift-l",run:ALe},{key:"Mod-Alt-g",run:oLe},{key:"Mod-d",run:bLe,preventDefault:!0}];class MLe{constructor(t){this.view=t;let n=this.query=t.state.field(hf).query.spec;this.commit=this.commit.bind(this),this.searchField=_r("input",{value:n.search,placeholder:tl(t,"Find"),"aria-label":tl(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=_r("input",{value:n.replace,placeholder:tl(t,"Replace"),"aria-label":tl(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=_r("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=_r("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=_r("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function s(r,i,o){return _r("button",{class:"cm-button",name:r,onclick:i,type:"button"},o)}this.dom=_r("div",{onkeydown:r=>this.keydown(r),class:"cm-search"},[this.searchField,s("next",()=>HS(t),[tl(t,"next")]),s("prev",()=>US(t),[tl(t,"previous")]),s("select",()=>ELe(t),[tl(t,"all")]),_r("label",null,[this.caseField,tl(t,"match case")]),_r("label",null,[this.reField,tl(t,"regexp")]),_r("label",null,[this.wordField,tl(t,"by word")]),...t.state.readOnly?[]:[_r("br"),this.replaceField,s("replace",()=>oF(t),[tl(t,"replace")]),s("replaceAll",()=>NLe(t),[tl(t,"replace all")])],_r("button",{name:"close",onclick:()=>Jse(t),"aria-label":tl(t,"close"),type:"button"},["×"])])}commit(){let t=new Gse({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:Hx.of(t)}))}keydown(t){Zje(this.view,t,"search-panel")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?US:HS)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),oF(this.view))}update(t){for(let n of t.transactions)for(let s of n.effects)s.is(Hx)&&!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($1).top}}function tl(e,t){return e.state.phrase(t)}const Ok=30,Bk=/[\s\.,:;?!]/;function iI(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-Ok),o=Math.min(r,n+Ok),a=e.state.sliceDoc(i,o);if(i!=s.from){for(let c=0;c<Ok;c++)if(!Bk.test(a[c+1])&&Bk.test(a[c])){a=a.slice(c);break}}if(o!=r){for(let c=a.length-1;c>a.length-Ok;c--)if(!Bk.test(a[c-1])&&Bk.test(a[c])){a=a.slice(0,c);break}}return It.announce.of(`${e.state.phrase("current match")}. ${a} ${e.state.phrase("on line")} ${s.number}.`)}const ILe=It.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"}}),RLe=[hf,nm.low(TLe),ILe];class aF{constructor(t,n,s){this.from=t,this.to=n,this.diagnostic=s}}class Pm{constructor(t,n,s){this.diagnostics=t,this.panel=n,this.selected=s}static init(t,n,s){let r=s.facet(Ux).markerFilter;r&&(t=r(t,s));let i=t.slice().sort((p,g)=>p.from-g.from||p.to-g.to),o=new Au,a=[],c=0,u=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 b,v;if(a.length)b=c,v=a.reduce((w,k)=>Math.min(w,k.to),g&&g.from>b?g.from:1e8);else{if(b=g.from,b>h)break;v=g.to,a.push(g),p++}for(;p<i.length;){let w=i[p];if(w.from==b&&(w.to>w.from||w.to==b))a.push(w),p++,v=Math.min(w.to,v);else{v=Math.min(w.from,v);break}}v=Math.min(v,h);let x=!1;if(a.some(w=>w.from==b&&(w.to==v||v==h))&&(x=b==v,!x&&v-b<10)){let w=b-(d+u.value.length);w>0&&(u.next(w),d=b);for(let k=b;;){if(k>=v){x=!0;break}if(!u.lineBreak&&d+u.value.length>k)break;k=d+u.value.length,d+=u.value.length,u.next()}}let y=WLe(a);if(x)o.add(b,b,Sn.widget({widget:new qLe(y),diagnostics:a.slice()}));else{let w=a.reduce((k,T)=>T.markClass?k+" "+T.markClass:k,"");o.add(b,v,Sn.mark({class:"cm-lintRange cm-lintRange-"+y+w,diagnostics:a.slice(),inclusiveEnd:a.some(k=>k.to>v)}))}if(c=v,c==h)break;for(let w=0;w<a.length;w++)a[w].to<=c&&a.splice(w--,1)}let m=o.finish();return new Pm(m,n,$f(m))}}function $f(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 aF(r,i,t||o.diagnostics[0]);else{if(o.diagnostics.indexOf(s.diagnostic)<0)return!1;s=new aF(s.from,i,s.diagnostic)}}),s}function DLe(e,t){let n=t.pos,s=t.end||n,r=e.state.facet(Ux).hideOn(e,n,s);if(r!=null)return r;let i=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(o=>o.is(Zse))||e.changes.touchesRange(i.from,Math.max(i.to,s)))}function LLe(e,t){return e.field(hl,!1)?t:t.concat(ss.appendConfig.of(GLe))}const Zse=ss.define(),oI=ss.define(),ere=ss.define(),hl=Io.define({create(){return new Pm(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=$f(n,e.selected.diagnostic,i)||$f(n,null,i)}!n.size&&r&&t.state.facet(Ux).autoPanel&&(r=null),e=new Pm(n,r,s)}for(let n of t.effects)if(n.is(Zse)){let s=t.state.facet(Ux).autoPanel?n.value.length?Vx.open:null:e.panel;e=Pm.init(n.value,s,t.state)}else n.is(oI)?e=new Pm(e.diagnostics,n.value?Vx.open:null,e.selected):n.is(ere)&&(e=new Pm(e.diagnostics,e.panel,n.value));return e},provide:e=>[Ox.from(e,t=>t.panel),It.decorations.from(e,t=>t.diagnostics)]}),PLe=Sn.mark({class:"cm-lintRange cm-lintRange-active"});function OLe(e,t,n){let{diagnostics:s}=e.state.field(hl),r,i=-1,o=-1;s.between(t-(n<0?1:0),t+(n>0?1:0),(c,u,{spec:d})=>{if(t>=c&&t<=u&&(c==u||(t>c||n>0)&&(t<u||n<0)))return r=d.diagnostics,i=c,o=u,!1});let a=e.state.facet(Ux).tooltipFilter;return r&&a&&(r=a(r,e.state)),r?{pos:i,end:o,above:!0,create(){return{dom:BLe(e,r)}}}:null}function BLe(e,t){return _r("ul",{class:"cm-tooltip-lint"},t.map(n=>nre(e,n,!1)))}const $Le=e=>{let t=e.state.field(hl,!1);(!t||!t.panel)&&e.dispatch({effects:LLe(e.state,[oI.of(!0)])});let n=$M(e,Vx.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},lF=e=>{let t=e.state.field(hl,!1);return!t||!t.panel?!1:(e.dispatch({effects:oI.of(!1)}),!0)},zLe=e=>{let t=e.state.field(hl,!1);if(!t)return!1;let n=e.state.selection.main,s=$f(t.diagnostics,null,n.to+1);return!s&&(s=$f(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}),zMe(e,s.from,1,{tooltip:sre,until:r=>r.docChanged||r.newSelection.main.head<s.from||r.newSelection.main.head>s.to}),!0)},FLe=[{key:"Mod-Shift-m",run:$Le,preventDefault:!0},{key:"F8",run:zLe}],Ux=an.define({combine(e){return{sources:e.map(t=>t.source).filter(t=>t!=null),...zu(e.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:cF,tooltipFilter:cF,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 cF(e,t){return e?t?(n,s)=>t(e(n,s),s):e:t}function tre(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 nre(e,t,n){var s;let r=n?tre(t.actions):[];return _r("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},_r("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,c=p=>{if(p.preventDefault(),a)return;a=!0;let g=$f(e.state.field(hl).diagnostics,t);g&&i.apply(e,g.from,g.to)},{name:u}=i,d=r[o]?u.indexOf(r[o]):-1,h=d<0?u:[u.slice(0,d),_r("u",u.slice(d,d+1)),u.slice(d+1)],m=i.markClass?" "+i.markClass:"";return _r("button",{type:"button",class:"cm-diagnosticAction"+m,onclick:c,onmousedown:c,"aria-label":` Action: ${u}${d<0?"":` (access key "${r[o]})"`}.`},h)}),t.source&&_r("div",{class:"cm-diagnosticSource"},t.source))}class qLe extends Al{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return _r("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class uF{constructor(t,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=nre(t,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Vx{constructor(t){this.view=t,this.items=[];let n=r=>{if(!(r.ctrlKey||r.altKey||r.metaKey)){if(r.keyCode==27)lF(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=tre(i.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==r.keyCode){let c=$f(this.view.state.field(hl).diagnostics,i);c&&i.actions[a].apply(t,c.from,c.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=_r("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:s}),this.dom=_r("div",{class:"cm-panel-lint"},this.list,_r("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>lF(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(hl).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(hl),s=0,r=!1,i=null,o=new Set;for(t.between(0,this.view.state.doc.length,(a,c,{spec:u})=>{for(let d of u.diagnostics){if(o.has(d))continue;o.add(d);let h=-1,m;for(let p=s;p<this.items.length;p++)if(this.items[p].diagnostic==d){h=p;break}h<0?(m=new uF(this.view,d),this.items.splice(s,0,m),r=!0):(m=this.items[h],h>s&&(this.items.splice(s,h-s),r=!0)),n&&m.diagnostic==n.diagnostic?m.dom.hasAttribute("aria-selected")||(m.dom.setAttribute("aria-selected","true"),i=m):m.dom.hasAttribute("aria-selected")&&m.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 uF(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:c})=>{let u=c.height/this.list.offsetHeight;a.top<c.top?this.list.scrollTop-=(c.top-a.top)/u:a.bottom>c.bottom&&(this.list.scrollTop+=(a.bottom-c.bottom)/u)}})):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(hl),s=$f(n.diagnostics,this.items[t].diagnostic);s&&this.view.dispatch({selection:{anchor:s.from,head:s.to},scrollIntoView:!0,effects:ere.of(s)})}static open(t){return new Vx(t)}}function HLe(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 $k(e){return HLe(`<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 ULe=It.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:$k("#f11")},".cm-lintRange-warning":{backgroundImage:$k("orange")},".cm-lintRange-info":{backgroundImage:$k("#999")},".cm-lintRange-hint":{backgroundImage:$k("#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 VLe(e){return e=="error"?4:e=="warning"?3:e=="info"?2:1}function WLe(e){let t="hint",n=1;for(let s of e){let r=VLe(s.severity);r>n&&(n=r,t=s.severity)}return t}const sre=$Me(OLe,{hideOn:DLe}),GLe=[hl,It.decorations.compute([hl],e=>{let{selected:t,panel:n}=e.field(hl);return!t||!n||t.from==t.to?Sn.none:Sn.set([PLe.range(t.from,t.to)])}),sre,ULe],rre=[ZMe(),nIe(),Ene(),KM(),KIe(),Sne(),cMe(),qs.allowMultipleSelections.of(!0),DIe(),Qne(Jne,{fallback:!0}),rRe(),GDe(),qse(),EMe(),jMe(),vMe(),cLe(),t1.of([...QDe,...QM,...jLe,...YM,...UIe,...Hse,...FLe])],KLe=[Ene(),KM(),Sne(),Qne(Jne,{fallback:!0}),t1.of([...QM,...YM])];/** @license
 * fzf v0.5.2
 * Copyright (c) 2021 Ajit
 * Licensed under BSD 3-Clause
 */const aI={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&&(aI[r]=n)}}const S6={a:[7844,7863],e:[7870,7879],o:[7888,7907],u:[7912,7921]};for(const e of Object.keys(S6)){const t=e.toUpperCase();for(let n=S6[e][0];n<=S6[e][1];++n)aI[n]=n%2===0?t:e}function $v(e){if(e<192||e>8580)return e;const t=aI[e];return t!==void 0?t.codePointAt(0):e}function Mh(e,t){return e>t?e:t}const ire=e=>e.split("").map(t=>t.codePointAt(0)),YLe=new Set(` \f
\r	\v  \u2028\u2029  　\uFEFF`.split("").map(e=>e.codePointAt(0)));for(let e=" ".codePointAt(0);e<=" ".codePointAt(0);e++)YLe.add(e);const i1="".codePointAt(0),Wx="A".codePointAt(0),Gx="Z".codePointAt(0),ore="a".codePointAt(0),are="z".codePointAt(0),XLe="0".codePointAt(0),QLe="9".codePointAt(0);function Q0(e,t,n){return n?e:t-e-1}const Kx=16,NA=-3,VS=-1,wp=Kx/2,JLe=Kx/2,ZLe=wp+VS,lre=4,cre=2;function jA(e){return e?new Set:null}function Ob(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 dF(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 ure(e){return e>=ore&&e<=are?1:e>=Wx&&e<=Gx?2:e>=XLe&&e<=QLe?4:0}function dre(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 WS(e){return e<=i1?ure(e):dre(e)}function lI(e,t){return e===0&&t!==0?wp:e===1&&t===2||e!==4&&t===4?ZLe:t===0?JLe:0}function ePe(e,t){return t===0?wp:lI(WS(e[t-1]),WS(e[t]))}function tPe(e,t,n,s){let r=e.slice(s),i=r.indexOf(n);if(i===0)return s;if(!t&&n>=ore&&n<=are){i>0&&(r=r.slice(0,i));const o=r.indexOf(n-32);o>=0&&(i=o)}return i<0?-1:s+i}function hF(e){for(const t of e)if(t>=128)return!1;return!0}function cI(e,t,n){if(!hF(e))return 0;if(!hF(t))return-1;let s=0,r=0;for(let i=0;i<t.length;i++){if(r=tPe(e,n,t[i],r),r<0)return-1;i===0&&r>0&&(s=r-1),r++}return s}const nPe=(e,t,n,s,r,i,o)=>{const a=r.length;if(a===0)return[{start:0,end:0,score:0},jA(i)];const c=s.length;if(o!==null&&c*a>o.i16.length)return fre(e,t,n,s,r,i);const u=cI(s,r,e);if(u<0)return[{start:-1,end:-1,score:0},null];let d=0,h=0,m=null,p=null,g=null,b=null;[d,m]=Ob(d,o,c),[d,p]=Ob(d,o,c),[d,g]=Ob(d,o,c),[h,b]=dF(h,o,a);const[,v]=dF(h,o,c);for(let V=0;V<v.length;V++)v[V]=s[V];let x=0,y=0,w=0,k=0;const T=r[0];let S=r[0],C=0,_=0,B=!1,A=v.subarray(u),N=m.subarray(u).subarray(0,A.length),j=p.subarray(u).subarray(0,A.length),P=g.subarray(u).subarray(0,A.length);for(let[V,M]of A.entries()){let re=null;M<=i1?(re=ure(M),!e&&re===2&&(M+=32)):(re=dre(M),!e&&re===2&&(M=String.fromCodePoint(M).toLowerCase().codePointAt(0)),t&&(M=$v(M))),A[V]=M;const se=lI(_,re);if(P[V]=se,_=re,M===S&&(w<a&&(b[w]=u+V,w++,S=r[Math.min(w,a-1)]),k=u+V),M===T){const X=Kx+se*cre;if(N[V]=X,j[V]=1,a===1&&(n&&X>x||!n&&X>=x)&&(x=X,y=u+V,n&&se===wp))break;B=!1}else B?N[V]=Mh(C+VS,0):N[V]=Mh(C+NA,0),j[V]=0,B=!0;C=N[V]}if(w!==a)return[{start:-1,end:-1,score:0},null];if(a===1){const V={start:y,end:y+1,score:x};if(!i)return[V,null];const M=new Set;return M.add(y),[V,M]}const L=b[0],O=k-L+1;let $=null;[d,$]=Ob(d,o,O*a);{const V=m.subarray(L,k+1);for(const[M,re]of V.entries())$[M]=re}let[,z]=Ob(d,o,O*a);{const V=p.subarray(L,k+1);for(const[M,re]of V.entries())z[M]=re}const F=b.subarray(1),G=r.slice(1).slice(0,F.length);for(const[V,M]of F.entries()){let re=!1;const se=G[V],X=V+1,J=X*O,de=v.subarray(M,k+1),W=g.subarray(M).subarray(0,de.length),te=z.subarray(J+M-L).subarray(0,de.length),U=z.subarray(J+M-L-1-O).subarray(0,de.length),ee=$.subarray(J+M-L).subarray(0,de.length),oe=$.subarray(J+M-L-1-O).subarray(0,de.length),Ce=$.subarray(J+M-L-1).subarray(0,de.length);Ce[0]=0;for(const[he,ye]of de.entries()){const Ve=he+M;let it=0,At=0,Ee=0;if(re?At=Ce[he]+VS:At=Ce[he]+NA,se===ye){it=oe[he]+Kx;let bt=W[he];Ee=U[he]+1,bt===wp?Ee=1:Ee>1&&(bt=Mh(bt,Mh(lre,g[Ve-Ee+1]))),it+bt<At?(it+=W[he],Ee=0):it+=bt}te[he]=Ee,re=it<At;const me=Mh(Mh(it,At),0);X===a-1&&(n&&me>x||!n&&me>=x)&&(x=me,y=Ve),ee[he]=me}}const I=jA(i);let Q=L;if(i&&I!==null){let V=a-1;Q=y;let M=!0;for(;;){const re=V*O,se=Q-L,X=$[re+se];let J=0,de=0;if(V>0&&Q>=b[V]&&(J=$[re-O+se-1]),Q>b[V]&&(de=$[re+se-1]),X>J&&(X>de||X===de&&M)){if(I.add(Q),V===0)break;V--}M=z[re+se]>1||re+O+se+1<z.length&&z[re+O+se+1]>0,Q--}}return[{start:Q,end:y+1,score:x},I]};function hre(e,t,n,s,r,i,o){let a=0,c=0,u=!1,d=0,h=0;const m=jA(o);let p=0;r>0&&(p=WS(n[r-1]));for(let g=r;g<i;g++){let b=n[g];const v=WS(b);if(e||(b>=Wx&&b<=Gx?b+=32:b>i1&&(b=String.fromCodePoint(b).toLowerCase().codePointAt(0))),t&&(b=$v(b)),b===s[a]){o&&m!==null&&m.add(g),c+=Kx;let x=lI(p,v);d===0?h=x:(x===wp&&(h=x),x=Mh(Mh(x,h),lre)),a===0?c+=x*cre:c+=x,u=!1,d++,a++}else u?c+=VS:c+=NA,u=!0,d=0,h=0;p=v}return[c,m]}const fre=(e,t,n,s,r,i,o)=>{if(r.length===0)return[{start:0,end:0,score:0},null];if(cI(s,r,e)<0)return[{start:-1,end:-1,score:0},null];let a=0,c=-1,u=-1;const d=s.length,h=r.length;for(let m=0;m<d;m++){let p=s[Q0(m,d,n)];e||(p>=Wx&&p<=Gx?p+=32:p>i1&&(p=String.fromCodePoint(p).toLowerCase().codePointAt(0))),t&&(p=$v(p));const g=r[Q0(a,h,n)];if(p===g&&(c<0&&(c=m),a++,a===h)){u=m+1;break}}if(c>=0&&u>=0){a--;for(let g=u-1;g>=c;g--){const b=Q0(g,d,n);let v=s[b];e||(v>=Wx&&v<=Gx?v+=32:v>i1&&(v=String.fromCodePoint(v).toLowerCase().codePointAt(0)));const x=Q0(a,h,n),y=r[x];if(v===y&&(a--,a<0)){c=g;break}}if(!n){const g=c;c=d-u,u=d-g}const[m,p]=hre(e,t,s,r,c,u,i);return[{start:c,end:u,score:m},p]}return[{start:-1,end:-1,score:0},null]},sPe=(e,t,n,s,r,i,o)=>{if(r.length===0)return[{start:0,end:0,score:0},null];const a=s.length,c=r.length;if(a<c)return[{start:-1,end:-1,score:0},null];if(cI(s,r,e)<0)return[{start:-1,end:-1,score:0},null];let u=0,d=-1,h=0,m=-1;for(let p=0;p<a;p++){const g=Q0(p,a,n);let b=s[g];e||(b>=Wx&&b<=Gx?b+=32:b>i1&&(b=String.fromCodePoint(b).toLowerCase().codePointAt(0))),t&&(b=$v(b));const v=Q0(u,c,n);if(r[v]===b){if(v===0&&(h=ePe(s,g)),u++,u===c){if(h>m&&(d=p,m=h),h===wp)break;p-=u-1,u=0,h=0}}else p-=u,u=0,h=0}if(d>=0){let p=0,g=0;n?(p=d-c+1,g=d+1):(p=a-(d+1),g=a-(d-c+1));const[b]=hre(e,t,s,r,p,g,!1);return[{start:p,end:g,score:b},null]}return[{start:-1,end:-1,score:0},null]},rPe=100*1024,iPe=2048;function oPe(e,t){return{i16:new Int16Array(e),i32:new Int32Array(t)}}const aPe=oPe(rPe,iPe),lPe=(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=ire(e);return n&&(r=r.map($v)),{queryRunes:r,caseSensitive:s}};function cPe(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 uPe(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,aPe);if(i.start===-1)return;if(this.opts.fuzzy===!1){o=new Set;for(let c=i.start;c<i.end;++c)o.add(c)}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 dPe(e){const{queryRunes:t,caseSensitive:n}=lPe(e,this.opts.casing,this.opts.normalize),s={},r=uPe.bind(this)(s,t,n);for(let i=0,o=this.runesList.length;i<o;++i)r(i);return cPe(s,this.opts.limit)}const mre={limit:1/0,selector:e=>e,casing:"smart-case",normalize:!0,fuzzy:"v2",tiebreakers:[],sort:!0,forward:!0};class hPe{constructor(t,...n){switch(this.opts={...mre,...n[0]},this.items=t,this.runesList=t.map(s=>ire(this.opts.selector(s).normalize())),this.algoFn=sPe,this.opts.fuzzy){case"v2":this.algoFn=nPe;break;case"v1":this.algoFn=fre;break}}}const fPe={...mre,match:dPe};class mPe extends hPe{constructor(t,...n){super(t,...n),this.opts={...fPe,...n[0]}}find(t){if(t.length===0||this.items.length===0)return this.items.slice(0,this.opts.limit).map(pPe);t=t.normalize();let n=this.opts.match.bind(this)(t);return gPe(n,this.opts)}}const pPe=e=>({item:e,start:-1,end:-1,score:0,positions:new Set});function gPe(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 bPe{constructor(t,...n){this.finder=new mPe(t,...n),this.find=this.finder.find.bind(this.finder)}}const Yx=["custom","skill","system"];function MA(e){return e.displayCategory?e.displayCategory:e.source==="builtin-command"?"system":e.source==="bundled-skill"||e.source==="skill"?"skill":"custom"}function yPe(e,t,n=Yx){return fF(MA(e),n)-fF(MA(t),n)}function fF(e,t=Yx){const n=t.indexOf(e);return n>=0?n:t.length+Yx.indexOf(e)}const uI=String.raw`([^\s/]+)`,K3={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:"安装扩展"}]},Y3={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"}]},X3={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 文件列表"}]},Q3={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 xPe(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"?K3:Y3)[e];if(o||(o=(s==="zh-CN"?X3:Q3)[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 c=o.find(u=>u.name===a);if(!(c!=null&&c.children))return null;o=c.children}return o}function vPe(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 wPe(e,t,n,s){const r=yPe(e,t,s);return r!==0?r:0}const kPe={custom:"slash.category.custom",skill:"slash.category.skill",system:"slash.category.system"};function _Pe(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 SPe(e,t,n){var u;const s=e.match(new RegExp(`^/${uI}\\s+$`));if(!s)return null;const r=s[1],i=t.find(d=>d.name===r),o=n==="zh-CN"?K3:Y3;if((u=i==null?void 0:i.subcommands)!=null&&u.length||o[r]||r==="skills")return null;const c=(n==="zh-CN"?X3:Q3)[r];return!c||c.length===0?null:`/${r} ${c[0].name} `}function CPe(e,t,n){var d,h;const s=e.match(new RegExp(`^/${uI}(\\s*)$`));if(!s)return null;const r=s[1],i=t.find(m=>m.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"?K3:Y3;if((h=i.subcommands)!=null&&h.length||a[r]||r==="skills")return null;const u=(n==="zh-CN"?X3:Q3)[r];return!u||u.length===0?null:`[${u.map(m=>m.name).join("|")}]`}function TPe(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 mF=new WeakMap;function EPe(e){let t=mF.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 bPe(n,{fuzzy:"v2",casing:"case-insensitive"}),byName:s},mF.set(e,t)}return t}function APe(e,t){try{const{fzf:n,byName:s}=EPe(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 NPe(e,t,n,s=[],r="en",i=a=>a,o=Yx){var y,w;const{lineStart:a,lineEnd:c,lineText:u,textBefore:d,cursor:h}=TPe(e,t),m=d.match(new RegExp(`^/${uI}\\s+(.*)$`));if(m){const[,k,T]=m,S=n.find(I=>I.name===k),C=r==="zh-CN"?K3:Y3,_=r==="zh-CN"?X3:Q3,B=!!C[k]||k==="skills",A=!!_[k];if(!((y=S==null?void 0:S.subcommands)!=null&&y.length)&&!B&&!A)return null;const N=T.split(/\s+/),j=N.pop()||"",P=N;if(!((w=S==null?void 0:S.subcommands)!=null&&w.length)&&!B&&A&&!j)return null;const L=xPe(k,P,s,r,S==null?void 0:S.subcommands);if(!L)return null;const O=j.toLowerCase(),$=`/${k} ${P.length>0?P.join(" ")+" ":""}`,z=L.filter(I=>!j||I.name.toLowerCase().includes(O)).sort((I,Q)=>j?vPe(I.name,Q.name,O):0),F=k==="skills"&&P.length===0,G=z.map(I=>{const Q=`${$}${I.name}`;return{id:Q,label:I.name,detail:I.description||void 0,apply:`${Q} `,...F?{type:"skill"}:{}}});return G.length===0?null:{kind:"subcommand",from:a,to:h,query:j,items:G}}const p=u.match(/^\/([^\s/]*)$/);if(!p)return null;const g=p[1],b=g.length===0,x=(b?[...n].sort((k,T)=>wPe(k,T,"",o)):APe(n,g)).map(k=>{const T=`/${k.name} `,S=MA(k),C=S==="custom"||S==="skill";return{id:k.name,label:`/${k.name}`,detail:k.description||void 0,apply:T,category:S,...b?{section:i(kPe[S])}:{},...C&&k.description?{type:"command-info"}:{}}});return x.length===0?null:{kind:"command",from:a,to:c,query:g,items:x}}const jPe="qwen-web-shell-history",pre=100;function MPe(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 IPe(e,t){try{localStorage.setItem(e,JSON.stringify(t.slice(-pre)))}catch{}}function pF(e=jPe){const t=f.useRef(e);t.current=e;const n=f.useRef(MPe(e)),s=f.useRef(-1),r=f.useRef(""),i=f.useRef(-1),[o,a]=f.useState(()=>({canUp:n.current.length>0,canDown:!1})),c=f.useCallback(()=>{const y=n.current,w=s.current;a({canUp:y.length>0&&(w===-1||w>0),canDown:w!==-1})},[]),u=f.useCallback(y=>{const w=n.current;w[w.length-1]!==y&&(w.push(y),w.length>pre&&w.shift(),IPe(t.current,w),s.current=-1,c())},[c]),d=f.useCallback(y=>{const w=n.current;if(w.length===0)return null;if(s.current===-1)r.current=y,s.current=w.length-1;else if(s.current>0)s.current--;else return null;return c(),w[s.current]},[c]),h=f.useCallback(()=>{const y=n.current;return s.current===-1?null:s.current<y.length-1?(s.current++,c(),y[s.current]):(s.current=-1,c(),r.current)},[c]),m=f.useCallback(()=>s.current!==-1,[]),p=f.useCallback(()=>{s.current=-1,i.current=-1,c()},[c]),g=f.useCallback(y=>{const w=n.current;if(w.length===0||!y)return null;const k=i.current===-1?w.length-1:i.current-1;if(k<0)return i.current=-1,null;const T=y.toLowerCase();for(let S=k;S>=0;S--)if(w[S].toLowerCase().includes(T))return i.current=S,w[S];return i.current=-1,null},[]),b=f.useCallback(y=>{const w=y.trim().toLowerCase();return n.current.slice().reverse().filter(k=>!w||k.toLowerCase().includes(w))},[]),v=f.useCallback(y=>{const w=n.current;if(!y)return w.length>0?w[w.length-1]:null;for(let k=w.length-1;k>=0;k--)if(y(w[k]))return w[k];return null},[]),x=f.useCallback(()=>{i.current=-1},[]);return{push:u,navigateUp:d,navigateDown:h,isNavigating:m,reset:p,searchReverse:g,getReverseMatches:b,getLastEntry:v,resetSearch:x,nav:o}}function zk(){return{directories:new Map,globResults:new Map,mcpResources:new Map}}function IA(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 RPe=/@((?:[\p{L}\p{N}_./:-]|\\.)*)$/u,DPe=[],gF=150,kp=50,gre=kp+1,yo="files",z1="extensions",wo="mcp-resources",bre=[yo,z1,wo],LPe="\x1B",yre=new RegExp(`${LPe}(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])`,"g"),xre=/[\u200B\u200E\u200F\u061C\u2066-\u2069\u202A-\u202E]/g,Xx="[invalid]",PPe=/[^\p{L}\p{N}_./-]/gu;function K2(e){return bre.includes(e)}function OPe(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 BPe(e){const t=new Set(bre),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 bF(e){return(e.textValue===void 0?void 0:Nr(e.textValue))??(typeof e.label=="string"?Nr(e.label)??void 0:void 0)??Wd(e.id)??Xx}function vre(e,t){return e==="."||e===""?t:`${e.replace(/\/+$/,"")}/${t}`}function Nd(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 $Pe(e){return Array.from(e,t=>/[a-z]/i.test(t)?`[${t.toLowerCase()}${t.toUpperCase()}]`:/[\\*?[{\]}()!@+|]/.test(t)?`\\${t}`:t).join("")}function RA(e){const t=J3(e).replace(/^\.\//,"");return t?`**/*${$Pe(t)}*`:"**/*"}function GS(e,...t){const n=e.toLowerCase();return t.some(s=>s==null?void 0:s.toLowerCase().includes(n))}function yF(e){const t=Nd(e),n=Nu(t);return t==="."?"@./ ":`@${_p(n)}/ `}function zPe(e,t){return`${e}:${t}`}function _p(e){return e.replace(PPe,"\\$&")}function J3(e){return e.replace(/\\(.)/g,"$1")}function wre(e){const t=e.charCodeAt(0);return t>31&&t!==127&&(t<128||t>159)}function FPe(e,t){return`@${_p(zPe(Nu(e),Nu(t)))} `}function qPe(e,t,n){const s=J3(e);return t===wo&&n&&s.startsWith(`${n}:`)?{providerId:wo,serverName:n,itemQuery:s.slice(n.length+1),validateServer:!0}:e.startsWith("ext:")?{providerId:z1,itemQuery:e.slice(4)}:e.startsWith("mcp:")?{providerId:wo,itemQuery:e.slice(4)}:null}function HPe(e,t,n){if(e===z1&&t.startsWith("ext:")||e===wo&&t.startsWith("mcp:"))return t.slice(4);const s=J3(t);return e===wo&&n&&s.startsWith(`${n}:`)?s.slice(n.length+1):!K2(e)&&t.startsWith(`${e}:`)?t.slice(e.length+1):t}async function UPe(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 VPe(e){const t=Nd(e);if(t===".")return".";const n=t.lastIndexOf("/");return n<0?".":t.slice(0,n)}function kre(e,t){const n=J3(e).replace(/^\.\/+/,"").replace(/\/+/g,"/"),s=n.lastIndexOf("/");if(s<0)return{dirPath:Nd(t),entryQuery:n};const r=n.slice(0,s),i=Nd(t),o=i==="."?r:vre(i,r);return{dirPath:Nd(o),entryQuery:n.slice(s+1)}}function WPe(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(RPe);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 Nr(e){const t=e.replace(yre,"").replace(xre,"").split("").filter(wre).join("").replace(/\s+/g," ").trim();return t.length>0?t:void 0}function Nu(e){const t=e.replace(yre,"").replace(xre,"").split("").filter(wre).join("");return t.length>0?t:Xx}function Wd(e){return e===void 0?Xx:Nr(e)??Xx}function GPe(e){if(e!==void 0)return Nu(e).trim()}function KPe(e){if(!e)return;const t=e.kind===void 0?void 0:Nr(e.kind);return{id:Nr(e.id)??Xx,label:e.label===void 0?void 0:Nr(e.label),value:e.value===void 0?void 0:Nr(e.value),removable:e.removable,kind:t,icon:e.icon,metadata:e.metadata,serialized:GPe(e.serialized)}}function YPe(e,t){const n={...e,label:Nr(e.label)??Wd(e.id),description:e.description===void 0?void 0:Nr(e.description),subtitle:e.subtitle===void 0?void 0:Nr(e.subtitle),detail:e.detail===void 0?void 0:Nr(e.detail),icon:e.icon,iconTooltip:e.iconTooltip===void 0?void 0:Nr(e.iconTooltip),insertText:e.insertText===void 0?void 0:Nu(e.insertText),composerTag:KPe(e.composerTag)};if(!(t!=null&&t.customProvider))return n;const s={...n};return delete s.targetPath,delete s.serverName,{...s,kind:"insert"}}function XPe(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===z1?{id:`extension:${s}`,kind:"extension",value:t.label,serialized:s}:e===wo?{id:`mcp:${s}`,kind:"mcp",value:t.label,serialized:s}:e===yo?{id:`file:${s}`,kind:"file",value:t.description??t.label,serialized:s}:null:null}function QPe(e,t,n,s,r){return{id:yo,label:s,description:r,order:1,async search({query:i,signal:o}){const a=e(),c=Nd(t()),u=a==null?void 0:a.listDirectory;if(u&&(!i||!(a!=null&&a.globWorkspace)))try{const{dirPath:h,entryQuery:m}=kre(i,c),p=m.toLowerCase(),g=await IA(n().directories,h,()=>u(h,{signal:o}));if(o.aborted)return[];const b=g.entries.filter(x=>!x.ignored).filter(x=>x.name.toLowerCase().includes(p)).sort((x,y)=>x.kind==="directory"&&y.kind!=="directory"?-1:x.kind!=="directory"&&y.kind==="directory"?1:x.name.localeCompare(y.name)),v={id:`current:${h}`,label:yF(h).trim(),description:Nr(h),insertText:yF(h),kind:"insert"};return[...m?[]:[v],...b.map(x=>{const y=vre(h,x.name),w=Wd(x.name),k=Nr(y),T=Nu(y);return x.kind==="directory"?{id:`dir:${y}`,label:`${w}/`,description:k,kind:"directory",targetPath:y}:{id:`file:${y}`,label:w,description:k,insertText:`@${_p(T)} `,kind:"insert"}})].slice(0,m?kp:gre)}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=RA(i),m=await IA(n().globResults,h,()=>d(h,{maxResults:kp,signal:o}));return o.aborted?[]:m.matches.filter(p=>p!==".").map(p=>({id:p,label:Wd(p),insertText:`@${_p(Nu(p))} `,kind:"insert"}))}catch(h){return o.aborted||console.warn("Failed to load @ file suggestions",h),[]}}}}function JPe(e,t,n,s){return{id:z1,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 c=t();c.extensionsStatus??(c.extensionsStatus=o().catch(h=>{throw c.extensionsStatus=void 0,h}));const u=await c.extensionsStatus;if(i.aborted)return[];const d=r.toLowerCase();return u.extensions.filter(h=>h.isActive).map(h=>{const m=Wd(h.name),p=_p(Nu(h.name)),g=Nr(h.displayName??""),b=Nr(h.description??"");return{id:h.name,label:m,description:g&&g!==m?g:b,detail:g&&b?`${g} - ${b}`:g??b,insertText:`@ext:${p} `}}).filter(h=>GS(d,h.label,h.description)).sort((h,m)=>{const p=h.label.toLowerCase(),g=m.label.toLowerCase(),b=p.startsWith(d)?0:1,v=g.startsWith(d)?0:1;return b!==v?b-v:p.localeCompare(g)}).slice(0,kp)}catch(c){return i.aborted||console.warn("Failed to load @ extension suggestions",c),[]}}}}function ZPe(e,t,n,s,r){return{id:wo,label:n,description:s,order:3,async search({query:i,signal:o}){var c;const a=(c=e())==null?void 0:c.loadMcpStatus;if(!a)return[];try{const u=t();u.mcpStatus??(u.mcpStatus=a().catch(m=>{throw u.mcpStatus=void 0,m}));const d=await u.mcpStatus;if(o.aborted)return[];const h=i.toLowerCase();return d.servers.filter(m=>!m.disabled).map(m=>{const p=Nu(m.name),g=m.resourceCount===void 0?void 0:r(m.resourceCount);return m.resourceCount===0?{id:`mcp-server-ref:${m.name}`,label:Wd(m.name),description:Nr(m.description??""),detail:Nr(m.description??""),insertText:`@mcp:${_p(p)} `,kind:"insert"}:{id:`mcp-server:${m.name}`,label:Wd(m.name),description:g===void 0?Nr(m.description??""):g,detail:Nr(m.description??""),kind:"mcp-server",serverName:m.name}}).filter(m=>GS(h,m.label,m.description)).sort((m,p)=>m.label.localeCompare(p.label)).slice(0,kp)}catch(u){return o.aborted||console.warn("Failed to load @ MCP resource suggestions",u),[]}}}}function eOe(e,t,n){return t<=0?null:n==="up"?e<=0?null:e-1:e>=t-1?null:e+1}function tOe({viewRef:e,disabledRef:t,shellModeRef:n,workspaceActionsRef:s,workspaceKey:r,builtinProviders:i,providers:o=DPe,createInlineTagEffect:a}){const{t:c}=ut(),[u,d]=f.useState(null),h=f.useRef(null),m=f.useRef(0),p=f.useRef(null),g=f.useRef(null),b=f.useRef("."),v=f.useRef(zk()),x=f.useRef(null),y=f.useRef(null),w=f.useRef(!1),k=f.useMemo(()=>[...[QPe(()=>s.current,()=>b.current,()=>v.current,c("at.category.files"),c("at.category.files.description")),JPe(()=>s.current,()=>v.current,c("at.category.extensions"),c("at.category.extensions.description")),ZPe(()=>s.current,()=>v.current,c("at.category.mcpResources"),c("at.category.mcpResources.description"),J=>c("mcp.resourceCount",{count:J}))].filter(J=>OPe(J.id,i)),...BPe(o)].sort((J,de)=>(J.order??0)-(de.order??0)),[i,o,c,s]),T=f.useRef(k);T.current=k;const S=f.useMemo(()=>k.map(X=>({id:X.id,provider:X,textValue:bF(X),label:typeof X.label=="string"?bF(X):X.label,description:X.description===void 0?void 0:Nr(X.description),tabs:X.tabs,renderItem:X.renderItem})),[k]),C=f.useRef(S);C.current=S;const _=f.useCallback(X=>{const J=typeof X=="function"?X(h.current):X;h.current=J,d(J)},[]);f.useEffect(()=>{var X;(X=p.current)==null||X.abort(),p.current=null,g.current&&(clearTimeout(g.current),g.current=null),b.current=".",v.current=zk(),h.current=null,d(null)},[r]);const B=f.useCallback(()=>{var X;(X=p.current)==null||X.abort(),p.current=null,g.current&&(clearTimeout(g.current),g.current=null)},[]),A=f.useCallback((X={})=>{B(),v.current=zk();const J=X.preserveProviderSelection||w.current;w.current=!1,J||(x.current=null,y.current=null),_(null)},[B,_]),N=f.useCallback(()=>{const X=h.current;return X?X.level==="items"?(B(),_({...X,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"):(A(),"closed"):!1},[B,A,_]);f.useEffect(()=>()=>{var X;g.current&&clearTimeout(g.current),(X=p.current)==null||X.abort(),p.current=null,b.current=".",v.current=zk()},[]);const j=f.useCallback((X,J,de)=>{const W=h.current;return(W==null?void 0:W.level)!=="items"||W.selectedProviderId!==X||W.selectedTabId!==de.selectedTabId||W.itemMode!==de.itemMode||W.mcpServerName!==de.mcpServerName||W.fileDirectory!==de.fileDirectory?[]:W.query!==J&&!K2(X)?[]:X===yo&&J===""&&b.current==="."?[]:W.items},[]),P=f.useCallback((X,J)=>{const de=s.current,W=v.current;if(X===yo){if(J&&(de!=null&&de.globWorkspace))return W.globResults.has(RA(J));if(de!=null&&de.listDirectory){const{dirPath:U}=kre(J,Nd(b.current));return W.directories.has(U)}const te=RA(J);return!!(de!=null&&de.globWorkspace)&&W.globResults.has(te)}return X===z1?W.extensionsStatus!==void 0:X===wo?W.mcpStatus!==void 0:!1},[s]),L=f.useCallback((X,J,de,W={})=>{var Ce;const te=T.current.find(he=>he.id===X);if(!te){console.warn(`[@mention] provider="${X}" not found (may have been removed)`),_(null);return}(Ce=p.current)==null||Ce.abort();const U=new AbortController;p.current=U;const ee=m.current+1;m.current=ee;const oe=j(X,J,de);W.loadingAlreadySet||_({...de,items:oe,loading:!0}),Promise.resolve().then(()=>te.search({query:J,signal:U.signal,tabId:de.selectedTabId})).then(he=>{U.signal.aborted||m.current!==ee||_(ye=>{if(!ye||ye.level!=="items")return ye;const Ve=X===yo&&J.length===0?gre:kp;return{...ye,items:he.slice(0,Ve).map(it=>YPe(it,{customProvider:!K2(X)})),selectedIndex:0,loading:!1}})}).catch(he=>{U.signal.aborted||m.current!==ee||(console.warn(`[@mention] provider="${X}" query=<redacted> failed`,he),_(ye=>!ye||ye.level!=="items"?ye:{...ye,items:[],selectedIndex:0,loading:!1}))})},[j,_]),O=f.useCallback((X,J,de)=>{var te;g.current&&clearTimeout(g.current),(te=p.current)==null||te.abort(),p.current=null;const W=j(X,J,de);if(_({...de,items:W,loading:!0}),P(X,J)){L(X,J,de,{loadingAlreadySet:!0});return}g.current=setTimeout(()=>{g.current=null,L(X,J,de,{loadingAlreadySet:!0})},gF)},[j,P,L,_]),$=f.useCallback((X,J,de,W={})=>{var Ve,it;const te=s.current,U=te==null?void 0:te.loadMcpResources;if(!U){console.warn(`[@mention] loadMcpResources not available for server="${X}"`),_({...de,items:[],loading:!1});return}(Ve=p.current)==null||Ve.abort();const ee=new AbortController;p.current=ee;const oe=m.current+1;m.current=oe;const Ce=((it=h.current)==null?void 0:it.level)==="items"&&h.current.itemMode==="mcpResources"&&h.current.mcpServerName===X?h.current.items:[];W.loadingAlreadySet||_({...de,items:Ce,loading:!0});const he=te==null?void 0:te.loadMcpStatus;(W.validateServer?UPe(te,X,ee.signal,he?()=>{const At=v.current;return At.mcpStatus??(At.mcpStatus=he().catch(Ee=>{throw At.mcpStatus=void 0,Ee})),At.mcpStatus}:void 0):Promise.resolve(!0)).then(At=>ee.signal.aborted?{resources:[]}:At?IA(v.current.mcpResources,X,()=>U(X,{signal:ee.signal})):(console.warn("[@mention] MCP server disabled or not found",{serverName:X}),{resources:[]})).then(At=>{if(ee.signal.aborted||m.current!==oe)return;const Ee=At.resources.map(me=>{const bt=Nr(me.title??"")??Nr(me.name??"")??Wd(me.uri);return{id:`mcp-resource:${X}:${me.uri}`,label:bt,description:Nr(me.description??"")??Nr(me.mimeType??""),detail:Wd(me.uri),insertText:FPe(X,me.uri),kind:"insert"}}).filter(me=>GS(J,me.label,me.description,me.detail)).sort((me,bt)=>me.label.localeCompare(bt.label)).slice(0,kp);_(me=>!me||me.level!=="items"?me:{...me,items:Ee,selectedIndex:0,loading:!1})}).catch(At=>{ee.signal.aborted||m.current!==oe||(console.warn("Failed to load @ MCP resources",At),_(Ee=>!Ee||Ee.level!=="items"?Ee:{...Ee,items:[],selectedIndex:0,loading:!1}))})},[_,s]),z=f.useCallback((X,J,de,W={})=>{var U,ee;g.current&&clearTimeout(g.current),(U=p.current)==null||U.abort(),p.current=null;const te=((ee=h.current)==null?void 0:ee.level)==="items"&&h.current.itemMode==="mcpResources"&&h.current.mcpServerName===X&&de.itemMode==="mcpResources"?h.current.items:[];if(_({...de,items:te,loading:!0}),v.current.mcpResources.has(X)){$(X,J,de,{...W,loadingAlreadySet:!0});return}g.current=setTimeout(()=>{g.current=null,$(X,J,de,{...W,loadingAlreadySet:!0})},gF)},[$,_]),F=f.useCallback(X=>{if(t.current||n.current)return A(),!1;const J=WPe(X);if(!J)return A(),!1;const de=h.current;if((de==null?void 0:de.level)==="items"&&de.from===J.from&&(de.to===J.to||de.inputMode==="search"&&J.to>=de.to||de.inputMode==="context"&&J.to>=de.to)&&de.selectedProviderId!==void 0&&C.current.some(U=>U.id===de.selectedProviderId)){if(!de.selectedProviderId)return!0;const U=de.selectedProviderId,ee=de.inputMode==="context"?HPe(U,J.query,de.mcpServerName):de.query;if(ee!==de.query){const oe={...de,from:J.from,to:J.to,query:ee,selectedIndex:0,providers:C.current};return U===wo&&de.itemMode==="mcpResources"&&de.mcpServerName?(z(de.mcpServerName,ee,oe,{validateServer:de.validateMcpServer}),!0):(O(U,ee,oe),!0)}return _({...de,from:J.from,to:J.to,query:ee,providers:C.current}),!0}const te=C.current.filter(U=>GS(J.query,U.textValue,U.description));if(te.length===0&&J.query){const U=qPe(J.query,x.current,y.current);if(U&&C.current.some(oe=>oe.id===U.providerId))return U.providerId===wo&&U.serverName?(y.current=U.serverName,z(U.serverName,U.itemQuery,{from:J.from,to:J.to,query:U.itemQuery,level:"items",selectedProviderId:wo,selectedIndex:0,providers:C.current,itemMode:"mcpResources",mcpServerName:U.serverName,fileDirectory:void 0,inputMode:"context",validateMcpServer:U.validateServer},{validateServer:U.validateServer}),!0):(O(U.providerId,U.itemQuery,{from:J.from,to:J.to,query:U.itemQuery,level:"items",selectedProviderId:U.providerId,selectedIndex:0,providers:C.current,itemMode:"default",mcpServerName:void 0,fileDirectory:U.providerId===yo?b.current:void 0,inputMode:"context"}),!0);const ee=C.current.find(oe=>!K2(oe.id)&&J.query.startsWith(`${oe.id}:`));if(ee){const oe=J.query.slice(ee.id.length+1);return O(ee.id,oe,{from:J.from,to:J.to,query:oe,level:"items",selectedProviderId:ee.id,selectedIndex:0,providers:C.current,itemMode:"default",mcpServerName:void 0,fileDirectory:void 0,inputMode:"context"}),!0}if(C.current.some(oe=>oe.id===yo))return b.current=".",O(yo,J.query,{from:J.from,to:J.to,query:J.query,level:"items",selectedProviderId:yo,selectedIndex:0,providers:C.current,itemMode:"default",mcpServerName:void 0,fileDirectory:b.current,inputMode:"context"}),!0}return _({from:J.from,to:J.to,query:J.query,level:"categories",selectedIndex:0,providers:te,items:[],loading:!1,inputMode:void 0}),!0},[A,t,O,z,_,n]),G=f.useCallback(X=>{const J=h.current;if(!J)return!1;const de=J.level==="categories"?J.providers.length:J.items.length;if(de<=0)return!0;const W=eOe(J.selectedIndex,de,X);return W===null||_({...J,selectedIndex:W}),!0},[_]),I=f.useCallback(X=>{const J=h.current;if(!J)return!1;const de=J.level==="categories"?J.providers.length:J.items.length;return X<0||X>=de?!1:(_({...J,selectedIndex:X}),!0)},[_]),Q=f.useCallback(X=>{var te,U;const J=h.current;if(!J||J.level!=="categories")return!1;const de=J.providers[X??J.selectedIndex];if(!de)return!1;x.current=de.id,de.id===yo&&(b.current=".");const W=(U=(te=de.tabs)==null?void 0:te.find(ee=>!ee.disabled))==null?void 0:U.id;return O(de.id,J.query,{...J,level:"items",selectedProviderId:de.id,selectedIndex:0,tabs:de.tabs,selectedTabId:W,itemMode:de.id===wo?"mcpServers":"default",mcpServerName:void 0,fileDirectory:de.id===yo?b.current:void 0,inputMode:"search"}),!0},[O]),V=f.useCallback(X=>{const J=h.current;if(!J||J.level!=="items"||!J.selectedProviderId)return!1;const de={...J,query:X,selectedIndex:0,inputMode:"search"};return J.selectedProviderId===wo&&J.itemMode==="mcpResources"&&J.mcpServerName?(z(J.mcpServerName,X,de,{validateServer:J.validateMcpServer}),!0):(O(J.selectedProviderId,X,de),!0)},[O,z]),M=f.useCallback(X=>{var W;const J=h.current;if(!J||J.level!=="items"||!J.selectedProviderId||!((W=J.tabs)!=null&&W.some(te=>te.id===X&&!te.disabled)))return!1;if(J.selectedTabId===X)return!0;const de={...J,selectedTabId:X,selectedIndex:0,inputMode:"search"};return O(J.selectedProviderId,J.query,de),!0},[O]),re=f.useCallback(()=>{const X=h.current;if(!X||X.level!=="items")return!1;if(X.selectedProviderId===wo&&X.itemMode==="mcpResources")return O(wo,"",{...X,query:"",selectedIndex:0,itemMode:"mcpServers",mcpServerName:void 0,fileDirectory:void 0,inputMode:"search",validateMcpServer:void 0}),"items";if(X.selectedProviderId===yo){const J=Nd(X.fileDirectory??b.current);if(J!==".")return b.current=VPe(J),O(yo,"",{...X,query:"",selectedIndex:0,fileDirectory:b.current,inputMode:"search"}),"items"}return _({...X,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}),B(),"categories"},[B,O,_]),se=f.useCallback(X=>{const J=h.current;if(!J)return!1;if(J.level==="categories")return Q(X);const de=e.current;if(!de)return!1;if(J.loading)return!0;const W=J.items[X??J.selectedIndex];if(!W)return!1;if(J.selectedProviderId&&(x.current=J.selectedProviderId),J.selectedProviderId===yo&&W.kind==="directory"&&W.targetPath)return b.current=Nd(W.targetPath),O(yo,"",{...J,query:"",selectedIndex:0,fileDirectory:b.current,inputMode:"search"}),!0;if(J.selectedProviderId===wo&&W.kind==="mcp-server"&&W.serverName)return y.current=W.serverName,z(W.serverName,"",{...J,query:"",selectedIndex:0,itemMode:"mcpResources",mcpServerName:W.serverName,fileDirectory:void 0,inputMode:"search",validateMcpServer:void 0}),!0;const te=W.insertText??`@${_p(Nu(W.label))} `,U=W.composerTag&&!/\s$/.test(te)?`${te} `:te,ee=de.state.doc.length;if(J.from<0||J.to<J.from||J.to>ee)return console.warn("[@mention] stale insertion range",{from:J.from,to:J.to,docLength:ee}),A(),!0;if(!de.state.doc.sliceString(J.from,J.to).startsWith("@"))return console.warn("[@mention] stale insertion text",{from:J.from,to:J.to}),A(),!0;w.current=!0;const Ce=XPe(J.selectedProviderId,W,U),he=U.trimEnd(),ye=Ce&&a?[a({from:J.from,to:J.from+he.length,tag:Ce})]:void 0;return de.dispatch({changes:{from:J.from,to:J.to,insert:U},...ye?{effects:ye}:{},selection:{anchor:J.from+U.length},scrollIntoView:!0}),de.focus(),A({preserveProviderSelection:!0}),!0},[A,Q,a,O,z,e]);return{state:u,close:A,closeIfOpen:N,refreshForView:F,moveSelection:G,select:I,accept:se,enterCategory:Q,selectTab:M,backToCategories:re,updateSearch:V}}const nOe=Sn.mark({class:"cm-input-slash"}),sOe=Sn.mark({class:"cm-input-at"}),rOe=Sn.mark({class:"cm-input-code"});class iOe extends Al{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 xF(e,t,n){const s=new Au,r=e.state.doc,i=[];for(let o=1;o<=r.lines;o++){const a=r.line(o),c=a.text,u=a.from;if(c.startsWith("/")){const g=c.indexOf(" "),b=g===-1?c.length:g;i.push({from:u,to:u+b,deco:nOe})}const d=CPe(c,t(),n());if(d){const g=c.endsWith(" ")?"":" ";i.push({from:u+c.length,to:u+c.length,deco:Sn.widget({widget:new iOe(`${g}${d}`),side:1})})}const h=/@[^\s]+/g;let m;for(;(m=h.exec(c))!==null;)i.push({from:u+m.index,to:u+m.index+m[0].length,deco:sOe});const p=/`[^`]+`/g;for(;(m=p.exec(c))!==null;)i.push({from:u+m.index,to:u+m.index+m[0].length,deco:rOe})}i.sort((o,a)=>o.from-a.from||o.to-a.to);for(const{from:o,to:a,deco:c}of i)s.add(o,a,c);return s.finish()}function oOe(e=()=>[],t=()=>"en"){return ei.fromClass(class{constructor(n){Re(this,"decorations");this.decorations=xF(n,e,t)}update(n){(n.docChanged||n.viewportChanged)&&(this.decorations=xF(n.view,e,t))}},{decorations:n=>n.decorations})}const aOe=It.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 Sp(e){return e instanceof HTMLElement?e.isContentEditable?!0:!!e.closest('input, textarea, select, [contenteditable="true"], .cm-editor, [data-keyboard-scope]'):!1}function Z3(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 Kh(e,t){return{[e]:Z3(t)}}const lOe=1e3,cOe=10,vF="web-shell-tooltip-styles",uOe=`
[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 dOe(){if(document.getElementById(vF))return;const e=document.createElement("style");e.id=vF,e.textContent=uOe,document.head.appendChild(e)}function hOe(e,t,n){return t<=0?null:((e+(n==="up"?-1:1))%t+t)%t}function fOe(e){return typeof e.apply=="string"&&e.apply.trim().startsWith("/")}function dI(e){return fOe(e)}function mOe(e){var t;return typeof e.apply=="string"?e.apply.trim():((t=e.displayLabel)==null?void 0:t.trim())||e.label}function pOe(e){e.querySelectorAll(".cm-completionInfo-hover").forEach(t=>{t.remove()})}function gOe(e,t,n){if(!t.detail||!dI(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=`${mOe(t)}

${t.detail}`;const i=r.dataset.hideTimerId;i&&(window.clearTimeout(Number(i)),delete r.dataset.hideTimerId);const o=r.getBoundingClientRect(),a=18,c=12,u=12,d=window.innerWidth,h=window.innerHeight,m=n.clientX+a,p=m+o.width+u>d?Math.max(u,n.clientX-o.width-a):m,g=Math.min(Math.max(u,n.clientY+c),Math.max(u,h-o.height-u));r.style.position="fixed",r.style.left=`${p}px`,r.style.top=`${g}px`,r.style.right="auto",r.style.bottom="auto"}function bOe(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 yOe(e){if(!e.detail||!dI(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=>{gOe(t,e,s)}),n.addEventListener("mouseleave",()=>{const s=t.closest("[data-web-shell-tooltip-portal]");s&&bOe(s)}))}),t}function xOe(e){return e.replace(/\r\n/g,`
`).replace(/\r/g,`
`)}function vOe(e){return[...e].length>lOe||e.split(`
`).length>cOe}function wOe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function kOe(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 _Oe(e,t){for(const n of e.keys())t.includes(n)||e.delete(n);return e.size===0?1:null}function SOe(e,t){if(e.size===0)return t;const n=[...e.keys()].sort((r,i)=>i.length-r.length),s=new RegExp(n.map(wOe).join("|"),"g");return t.replace(s,r=>e.get(r)??r)}function Gy(e){return UG(e)}function COe(e){return e.map(Gy).join(`
`)}function eC(e){var t;return((t=e.label)==null?void 0:t.trim())??""}function tC(e){var t;return((t=e.value)==null?void 0:t.trim())??""}function hI(e){return tC(e)||eC(e)||e.id}function TOe(e,t){const n=COe(t);return n?e?`${n}

${e}`:n:e}function EOe(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(Gy(i.tag)),s=i.end);return r.push(e.slice(s)),r.join("")}function nC(e){const t={...e};return delete t.iconUrl,delete t.renderContent,delete t.tooltip,delete t.tooltipText,delete t.onClick,t}const ay=ss.define({map:e=>e}),fI=ss.define(),rd=ss.define();let AOe=0;class NOe extends Al{constructor(n){super();Re(this,"contentRoot",null);Re(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 m,p,g;const s=document.createElement("span"),r=nC(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",b=>{b.preventDefault(),b.stopPropagation()}),s.addEventListener("mousedown",b=>{b.preventDefault(),b.stopPropagation()}),s.addEventListener("click",b=>{var v,x;b.stopPropagation(),(x=(v=this.tag).onClick)==null||x.call(v,{tag:r,placement:"composer",readonly:!1,anchorRect:s.getBoundingClientRect()})}),s.addEventListener("keydown",b=>{var v,x;b.key!=="Enter"&&b.key!==" "||(b.preventDefault(),(x=(v=this.tag).onClick)==null||x.call(v,{tag:r,placement:"composer",readonly:!1,anchorRect:s.getBoundingClientRect()}))}));const i=eC(this.tag),o=tC(this.tag),a=this.tag.kind?"":i,c=this.tag.iconUrl??Dp(this.tag.kind),u=c&&(ON(c)||P1(c))?c:void 0;let d;try{d=(p=(m=this.tag).renderContent)==null?void 0:p.call(m,{tag:r,placement:"composer",readonly:!1})}catch(b){console.warn("[WebShell] inline tag renderContent failed",b)}let h=!1;if(d!=null){const b=document.createElement("span");b.style.cssText="display:inline-flex;align-items:center;min-width:0;max-width:100%;";try{this.contentRoot=u7.createRoot(b),this.contentRoot.render(d),s.appendChild(b),h=!0}catch(v){(g=this.contentRoot)==null||g.unmount(),this.contentRoot=null,console.warn("[WebShell] inline tag renderContent failed",v)}}if(!h&&u){const b=document.createElement("span");b.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;",b.style.setProperty("--composer-tag-icon-url",Z3(u)),s.appendChild(b)}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=u7.createRoot(r),this.tooltipRoot.render(s),n.appendChild(r),r.id=`composer-tag-tooltip-${++AOe}`,n.setAttribute("aria-describedby",r.id)}catch(c){(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",c);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 ${hI(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(Oh).between(0,s.state.doc.length,(a,c,u)=>{const d=u.spec.tag;(d==null?void 0:d.id)===this.tag.id&&d.removable!==!1&&o.push({from:a,to:c,insert:""})}),o.length!==0&&(s.dispatch({changes:o,effects:fI.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 jOe(e){const t={widget:new NOe(e.tag),inclusive:!1,tag:e.tag};return Sn.replace(t).range(e.from,e.to)}const Oh=Io.define({create(){return Sn.none},update(e,t){let n=e.map(t.changes);for(const s of t.effects)s.is(ay)?n=n.update({add:[jOe(s.value)]}):s.is(fI)?n=n.update({filter:(r,i,o)=>{const a=o.spec.tag;return a&&s.value.predicate?!s.value.predicate(a):!0}}):s.is(rd)&&(n=Sn.none);return n},provide:e=>[It.decorations.from(e),It.atomicRanges.of(t=>t.state.field(e))]});function wF(e){const t=[],n=e.state.field(Oh,!1);return n==null||n.between(0,e.state.doc.length,(s,r,i)=>{const o=i.spec.tag;o&&t.push(nC(o))}),t}function MOe(e){const t=[];return e.state.field(Oh).between(0,e.state.doc.length,(n,s,r)=>{const i=r.spec.tag;i&&t.push({start:n,end:s,tag:nC(i)})}),t}const kF=new qp,_F=new qp,SF=new qp;function Im(e,t){return t&&(e.length===0||t.startsWith(e))?t:null}function IOe(e,t){const n=Im(e,t);if(!n||e.length===0)return null;const s=n.slice(e.length);return s.length>0?s:null}class ROe extends Al{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 CF(e){return ei.fromClass(class{constructor(t){Re(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=IOe(s,e);return!r||!n.empty||n.head!==s.length?Sn.none:Sn.set([Sn.widget({widget:new ROe(r),side:1}).range(s.length)])}},{decorations:t=>t.decorations})}function TF(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 DOe(e){const{onSubmit:t,onInputTextChange:n,onCycleMode:s,onToggleShortcuts:r,disabled:i=!1,placeholderText:o="Type a message...",commands:a,skills:c=[],slashCommandCategoryOrder:u,queuedMessages:d=[],onPopQueuedMessages:h,currentMode:m="default",onFocusFooter:p,dialogOpen:g=!1,followupState:b,onAcceptFollowup:v,onDismissFollowup:x,sessionName:y,composerInput:w,composerInputVersion:k,builtinAtProviders:T,atProviders:S,atWorkspaceCwd:C,composerTagIcons:_,renderComposerTag:B,renderComposerTagTooltip:A,onComposerTagClick:N,editorTheme:j}=e,P=uG(),{language:L,t:O}=ut(),$=f.useRef(null),z=f.useRef(null),F=f.useRef(t);F.current=t;const G=f.useRef(n);G.current=n;const I=f.useRef(s);I.current=s;const Q=f.useRef(r);Q.current=r;const V=f.useRef(i);V.current=i;const M=f.useRef(a);M.current=a;const re=f.useRef(c);re.current=c;const se=f.useRef(u);se.current=u;const X=f.useRef(O);X.current=O;const J=f.useRef(d);J.current=d;const de=f.useRef(h);de.current=h;const W=f.useRef(b);W.current=b;const te=f.useRef(v);te.current=v;const U=f.useRef(x);U.current=x;const ee=f.useRef(p);ee.current=p;const oe=f.useRef(L);oe.current=L;const Ce=f.useRef(void 0);if(P&&C){const le=P.client.workspaceByCwd(C);Ce.current={...P.actions,async globWorkspace(Se,He){var Bt,$n;(Bt=He==null?void 0:He.signal)==null||Bt.throwIfAborted();const Qe=await le.glob(Se,{maxResults:He==null?void 0:He.maxResults,signal:He==null?void 0:He.signal});return($n=He==null?void 0:He.signal)==null||$n.throwIfAborted(),{matches:Array.isArray(Qe.matches)?Qe.matches.filter(Qs=>typeof Qs=="string"):[]}},async listDirectory(Se,He){var xn,Bt;if((xn=He==null?void 0:He.signal)!=null&&xn.aborted)return{kind:"list",path:Se,entries:[],truncated:!1};const Qe=await le.dirList(Se);return(Bt=He==null?void 0:He.signal)!=null&&Bt.aborted?{kind:"list",path:Se,entries:[],truncated:!1}:Qe}}}else Ce.current=P==null?void 0:P.actions;const he=f.useRef(_);he.current=_;const ye=f.useRef(B);ye.current=B;const Ve=f.useRef(A);Ve.current=A;const it=f.useRef(N);it.current=N;const At=f.useCallback(le=>{var Bt;const Se=le.icon??Dp(le.kind,he.current),He={tag:le,placement:"composer",readonly:!1};let Qe;try{Qe=(Bt=Ve.current)==null?void 0:Bt.call(Ve,He)}catch($n){console.warn("[WebShell] inline tag tooltip render failed",$n)}const xn=typeof Qe=="string"||typeof Qe=="number"?String(Qe):void 0;return{...le,...Se?{iconUrl:Se}:{},...ye.current?{renderContent:ye.current}:{},...Qe!=null?{tooltip:Qe}:{},...xn?{tooltipText:xn}:{},...it.current?{onClick:it.current}:{}}},[]),[Ee,me]=f.useState(!1),bt=f.useRef(Ee);bt.current=Ee;const et=tOe({viewRef:z,disabledRef:V,shellModeRef:bt,workspaceActionsRef:Ce,workspaceKey:C,builtinProviders:T,providers:S,createInlineTagEffect:le=>ay.of({...le,tag:At(le.tag)})}),qe=et.close,Ke=et.refreshForView;f.useEffect(()=>{const le=z.current;if(!le)return;const Se=[rd.of()];le.state.field(Oh).between(0,le.state.doc.length,(He,Qe,xn)=>{const Bt=xn.spec.tag;Bt&&Se.push(ay.of({from:He,to:Qe,tag:At(nC(Bt))}))}),Se.length!==1&&le.dispatch({effects:Se})},[_,N,B,A,At]);const ke=f.useCallback(()=>{var le,Se,He;(le=W.current)!=null&&le.isVisible&&((Se=U.current)==null||Se.call(U)),me(Qe=>!Qe),(He=z.current)==null||He.focus()},[]),[ne,gt]=f.useState(!1),[We,tt]=f.useState(""),[jt,jn]=f.useState([]),[kn,Be]=f.useState(0),ht=f.useRef(null),ve=f.useRef(null),Me=f.useRef(""),[_e,Xe]=f.useState([]),ue=f.useRef([]),Fe=f.useRef(new Map),kt=f.useRef(1),[bn,Pe]=f.useState([]),yn=f.useRef([]);yn.current=bn;const je=f.useRef(w);je.current=w;const Ne=f.useRef(()=>!0),ot=f.useRef(null),[pt,dn]=f.useState(null),De=f.useRef(null),sn=f.useRef(!1),Dn=f.useCallback(le=>{De.current=le,dn(le)},[]),os=f.useCallback(()=>{const le=ot.current,Se=z.current;if(!le||!Se)return;const He=Se.state.doc,Qe=le.from+le.text.length;He.length===Qe&&He.sliceString(le.from,Qe)===le.text&&Se.dispatch({changes:{from:le.from,to:Qe,insert:""}}),ot.current=null},[]),st=f.useCallback(()=>{os(),qe()},[os,qe]),St=et.closeIfOpen,Ht=f.useCallback(()=>{const le=St();return le?(le==="closed"&&os(),!0):!1},[os,St]),Ot=f.useCallback((le,Se)=>{var $n;if(!le||V.current||bt.current){Dn(null);return}if(sn.current){Dn(null);return}const He=le.state.selection.main;if(!He.empty){Dn(null);return}const Qe=NPe(le.state.doc.toString(),He.head,M.current,re.current,oe.current,Qs=>X.current(Qs),se.current??Yx);if(!Qe){Dn(null);return}st();const xn=Se??(($n=De.current)==null?void 0:$n.selectedIndex)??0,Bt=Math.max(0,Math.min(xn,Qe.items.length-1));Dn({...Qe,selectedIndex:Bt})},[st,Dn]),Yt=f.useCallback(()=>{Dn(null)},[Dn]),Pn=f.useCallback(le=>{const Se=De.current;return!Se||le<0||le>=Se.items.length?!1:(Se.selectedIndex===le||Dn({...Se,selectedIndex:le}),!0)},[Dn]),Hn=f.useCallback(le=>{const Se=De.current;if(!Se)return!1;const He=hOe(Se.selectedIndex,Se.items.length,le);return He===null?!1:(Dn({...Se,selectedIndex:He}),!0)},[Dn]),as=f.useCallback(le=>{const Se=z.current,He=De.current;if(!Se||!He)return!1;const Qe=He.items[le??He.selectedIndex];return Qe?(Se.dispatch({changes:{from:He.from,to:He.to,insert:Qe.apply},selection:{anchor:He.from+Qe.apply.length},scrollIntoView:!0}),Se.focus(),!0):!1},[]),[Bs,fr]=f.useState(!1);f.useEffect(()=>{const le=z.current,Se=(le==null?void 0:le.state.doc.toString())??"",He=Im(Se,b!=null&&b.isVisible?b.suggestion:null);fr(Se.trim().length>0||!!He||bn.length>0||_e.length>0)},[bn,_e,b==null?void 0:b.isVisible,b==null?void 0:b.suggestion]);const Gr=pF(),rs=pF("qwen-web-shell-command-history"),{push:Vt,navigateUp:Qn,navigateDown:Rs,isNavigating:pr,reset:hs,getReverseMatches:xr,getLastEntry:ci,resetSearch:_s}=Gr,Vs=f.useRef({push:Vt,navigateUp:Qn,navigateDown:Rs,isNavigating:pr,reset:hs,getReverseMatches:xr,getLastEntry:ci,resetSearch:_s});Vs.current={push:Vt,navigateUp:Qn,navigateDown:Rs,isNavigating:pr,reset:hs,getReverseMatches:xr,getLastEntry:ci,resetSearch:_s};const ls=f.useRef(rs);ls.current=rs,ue.current=_e;const Ws=f.useCallback(le=>{const Se=bt.current,Qe=(Se?ls.current:Vs.current).getReverseMatches(le);return Se?Qe:Qe.filter(xn=>!xn.trimStart().startsWith("/"))},[]),Ss=f.useCallback(()=>{if(V.current)return;const le=z.current;if(!le)return;Yt(),st();const Se=le.state.doc.toString();Me.current=Se,gt(!0),tt("");const He=bt.current?ls.current:Vs.current;jn(Ws("")),Be(0),He.resetSearch(),setTimeout(()=>{var Qe;return(Qe=ht.current)==null?void 0:Qe.focus()},0)},[st,Yt,Ws]),Xs=f.useRef(Ss);Xs.current=Ss;const Cr=f.useCallback(()=>{if(V.current)return;const le=z.current;if(!le)return;if(el(le.state)==="active"){Gh(!1)(le),le.focus();return}if(le.state.doc.lines>1){le.focus();return}const Se=bt.current?ls.current:Vs.current,He=le.state.doc.toString(),Qe=Se.navigateUp(He);Qe!==null&&le.dispatch({changes:{from:0,to:le.state.doc.length,insert:Qe},selection:{anchor:Qe.length}}),le.focus()},[]),Lr=f.useCallback(()=>{if(V.current)return;const le=z.current;if(!le)return;if(el(le.state)==="active"){Gh(!0)(le),le.focus();return}if(le.state.doc.lines>1){le.focus();return}const He=(bt.current?ls.current:Vs.current).navigateDown();He!==null&&le.dispatch({changes:{from:0,to:le.state.doc.length,insert:He},selection:{anchor:He.length}}),le.focus()},[]);f.useEffect(()=>{var Nl,Pr;if(!$.current)return;dOe();const le=document.createElement("div");le.setAttribute("data-web-shell-tooltip-portal",""),le.style.position="fixed",le.style.inset="0",le.style.zIndex="var(--web-shell-tooltip-z-index)",le.style.pointerEvents="none";const Se=/\b\S*theme(?:Dark|Light)\S*/gi,He=()=>{var pn,Ut;let rt=$.current,Dt=null;if($.current){const rn=getComputedStyle($.current);for(let zn=0;zn<rn.length;zn+=1){const fs=rn[zn];fs.startsWith("--")&&le.style.setProperty(fs,rn.getPropertyValue(fs))}rn.getPropertyValue("--web-shell-tooltip-z-index").trim()||le.style.setProperty("--web-shell-tooltip-z-index","1000")}for(;rt;){const rn=(Ut=(pn=rt.className)==null?void 0:pn.match)==null?void 0:Ut.call(pn,Se);if(rn){Dt=rn[0];break}rt=rt.parentElement}Dt&&(le.className=Dt)};He(),document.body.appendChild(le);const Qe=new MutationObserver(He);let xn=$.current;for(;xn&&(Qe.observe(xn,{attributes:!0,attributeFilter:["class","style"]}),!((Pr=(Nl=xn.className)==null?void 0:Nl.match)!=null&&Pr.call(Nl,Se)));)xn=xn.parentElement;const Bt=(rt,Dt,pn)=>{const Ut=pn===void 0?MOe(rt):[],rn=rt.state.doc.toString(),zn=W.current,fs=Dt===void 0&&Ut.length===0&&(zn!=null&&zn.isVisible)?Im(rn,zn.suggestion):null,tr=Dt??fs??rn,Ci=tr.length-tr.trimStart().length,mr=tr.trim(),po=Dt===void 0&&fs===null?Ut.map(Ds=>({...Ds,start:Ds.start-Ci,end:Ds.end-Ci})).filter(Ds=>Ds.end>0).map(Ds=>({...Ds,start:Math.max(0,Ds.start)})):[],go=pn??yn.current;if(!mr&&go.length===0&&Ut.length===0)return!0;const xa=pn===void 0?EOe(mr,po):mr,Ka=SOe(Fe.current,xa),Ya=TOe(Ka,go),xt=ue.current,En=bt.current,si=En?`!${Ya}`:Ya,ar=q0e(si,[...go,...po.map(Ds=>Ds.tag)]);let nr=!1;const Ti=()=>{var Ds,ui;nr||(nr=!0,Dn(null),fs&&((Ds=te.current)==null||Ds.call(te,"enter",{skipOnAccept:!0})),(ui=U.current)==null||ui.call(U),Fe.current.clear(),kt.current=1,En?(ls.current.push(Ka),ls.current.reset()):(Vs.current.push(Ka),Vs.current.reset()),sn.current=!1,Pe([]),Xe([]),rt.dispatch({changes:{from:0,to:rt.state.doc.length,insert:""},effects:rd.of()}))};return F.current(si,xt.length>0?[...xt]:void 0,Ti,ar.length>0?{inputAnnotations:ar}:void 0)===!1||Ti(),!0};Ne.current=Bt;const $n=rt=>(rt.dispatch(rt.state.replaceSelection(`
`)),!0),Qs=(rt,Dt)=>{var zn;const pn=W.current,Ut=pn==null?void 0:pn.suggestion,rn=Im(rt.state.doc.toString(),Ut);return!(pn!=null&&pn.isVisible)||!rn?!1:(rt.dispatch({changes:{from:0,to:rt.state.doc.length,insert:rn},selection:{anchor:rn.length},scrollIntoView:!0}),rt.focus(),(zn=te.current)==null||zn.call(te,Dt,{skipOnAccept:!0}),!0)},vs=t1.of([{key:"Backspace",run:rt=>{var rn;const Dt=rt.state.selection.main;if(!Dt.empty||Dt.from!==0)return!1;let pn=!1;if(rt.state.field(Oh).between(0,1,zn=>{zn===0&&(pn=!0)}),pn)return!1;let Ut=-1;for(let zn=yn.current.length-1;zn>=0;zn-=1)if(((rn=yn.current[zn])==null?void 0:rn.removable)!==!1){Ut=zn;break}return Ut<0?!1:(Pe(zn=>zn.filter((fs,tr)=>tr!==Ut)),!0)}},{key:"Delete",run:rt=>{const Dt=rt.state.selection.main;if(!Dt.empty||Dt.from!==0)return!1;let pn=!1;if(rt.state.field(Oh).between(0,1,rn=>{rn===0&&(pn=!0)}),pn)return!1;const Ut=yn.current.findIndex(rn=>rn.removable!==!1);return Ut<0?!1:(Pe(rn=>rn.filter((zn,fs)=>fs!==Ut)),!0)}},{key:"Enter",run:rt=>{var rn;if(et.accept())return!0;if(De.current)return as();if(el(rt.state)==="active")return!1;const Dt=W.current,Ut=wF(rt).length>0?null:Im(rt.state.doc.toString(),Dt==null?void 0:Dt.suggestion);return Dt!=null&&Dt.isVisible&&Ut?((rn=te.current)==null||rn.call(te,"enter",{skipOnAccept:!0}),Bt(rt,Ut)):Bt(rt)}},{key:"Shift-Enter",run:$n},{key:"Ctrl-j",run:$n},{key:"Mod-Enter",run:$n},{key:"Alt-Enter",run:$n},{key:"Escape",run:()=>Ht()?!0:De.current?(Yt(),!0):bt.current?(me(!1),!0):!1},{key:"Ctrl-o",run:()=>!0},{key:"Ctrl-l",run:()=>!0},{key:"Ctrl-y",run:()=>!0},{key:"ArrowUp",run:rt=>{var fs;const Dt=bt.current?ls.current:Vs.current;if(sn.current)G2(rt),Yt(),st();else{if(et.moveSelection("up")||Hn("up"))return!0;if(el(rt.state)==="active")return Gh(!1)(rt)}const Ut=TF(rt,"up");if(Ut==="handled")return!0;if(Ut==="editor")return!1;if(bt.current){const tr=rt.state.doc.toString(),Ci=Dt.navigateUp(tr);return Ci===null||(sn.current=!0,rt.dispatch({changes:{from:0,to:rt.state.doc.length,insert:Ci},selection:{anchor:Ci.length}})),!0}if(J.current.length>0&&(fs=de.current)!=null&&fs.call(de))return!0;const rn=rt.state.doc.toString(),zn=Dt.navigateUp(rn);return zn===null?!1:(sn.current=!0,rt.dispatch({changes:{from:0,to:rt.state.doc.length,insert:zn},selection:{anchor:zn.length}}),!0)}},{key:"ArrowDown",run:rt=>{var zn;const Dt=bt.current?ls.current:Vs.current;if(sn.current)G2(rt),Yt(),st();else{if(et.moveSelection("down")||Hn("down"))return!0;if(el(rt.state)==="active")return Gh(!0)(rt)}const Ut=TF(rt,"down");if(Ut==="handled")return!0;if(Ut==="editor")return!1;if(bt.current){const fs=Dt.navigateDown();return fs===null||(sn.current=Dt.isNavigating(),rt.dispatch({changes:{from:0,to:rt.state.doc.length,insert:fs},selection:{anchor:fs.length}})),!0}const rn=Dt.navigateDown();return rn===null?((zn=ee.current)==null?void 0:zn.call(ee))??!1:(sn.current=Dt.isNavigating(),rt.dispatch({changes:{from:0,to:rt.state.doc.length,insert:rn},selection:{anchor:rn.length}}),!0)}},{key:"Ctrl-r",run:()=>(Xs.current(),!0)},{key:"Tab",run:rt=>{if(et.accept()||Qs(rt,"tab"))return!0;if(De.current)return as();if(el(rt.state)==="active")return Ose(rt);const Dt=rt.state.doc.toString(),pn=SPe(Dt,M.current,oe.current);if(pn)return rt.dispatch({changes:{from:0,to:rt.state.doc.length,insert:pn},selection:{anchor:pn.length}}),!0;const Ut=_Pe(Dt,M.current);return Ut&&rt.dispatch({changes:{from:0,to:rt.state.doc.length,insert:Ut},selection:{anchor:Ut.length}}),!0}},{key:"ArrowRight",run:rt=>!!(el(rt.state)!=="active"&&Qs(rt,"right"))},{key:"Shift-Tab",run:()=>{var rt;return(rt=I.current)==null||rt.call(I),!0}}]),is=It.updateListener.of(rt=>{if(rt.docChanged&&Fe.current.size>0){const pn=_Oe(Fe.current,rt.state.doc.toString());pn!==null&&(kt.current=pn)}rt.transactions.some(pn=>pn.isUserEvent("input")||pn.isUserEvent("delete"))&&(sn.current=!1),(rt.docChanged||rt.selectionSet)&&(Ot(rt.view),sn.current?st():Ke(rt.view)&&Yt())});let Js=!1;const vr=It.updateListener.of(rt=>{const Dt=ot.current,pn=el(rt.state)==="active";if(Dt){const Ut=rt.state.doc;if(!(Ut.length===Dt.from+Dt.text.length&&Ut.sliceString(Dt.from)===Dt.text))ot.current=null;else if(Js&&!pn){ot.current=null;const{view:zn}=rt,{from:fs}=Dt;window.setTimeout(()=>{if(z.current!==zn)return;const tr=zn.state.doc;tr.length===fs+Dt.text.length&&tr.sliceString(fs)===Dt.text&&zn.dispatch({changes:{from:fs,to:fs+Dt.text.length,insert:""}})},0)}}Js=pn,pn||pOe(le)}),ni=qs.create({doc:"",extensions:[nm.highest(vs),KLe,KM(),t1.of([...QM,...YM]),qse({override:[],activateOnTyping:!0,icons:!1,optionClass:rt=>{const Dt=[];return rt.type==="file"&&Dt.push("cm-file-completion"),dI(rt)&&Dt.push("cm-command-info-completion"),Dt.join(" ")},addToOptions:[{render:yOe,position:90}],maxRenderedOptions:300,aboveCursor:!0,positionInfo:(rt,Dt,pn,Ut,rn)=>{const zn=Ut.bottom-Ut.top,fs=rn.bottom-Dt.bottom,tr=fs>=zn||fs>Dt.top,Ci=tr?"top":"bottom",mr=tr?pn.bottom-Dt.top:Dt.bottom-pn.top;return{style:`${Ci}: ${mr}px`,class:"cm-completionInfo-right-narrow"}},activateOnCompletion:rt=>typeof rt.apply=="string"&&rt.apply.endsWith(" ")}),MMe({parent:le}),_F.of(xz("")),SF.of(CF(null)),It.lineWrapping,kF.of(It.editable.of(!0)),oOe(()=>M.current,()=>oe.current),aOe,Oh,is,vr,It.updateListener.of(rt=>{var Dt;if(rt.docChanged){const pn=rt.state.doc.toString();(Dt=G.current)==null||Dt.call(G,pn);const Ut=W.current,rn=Im(pn,Ut!=null&&Ut.isVisible?Ut.suggestion:null);fr(pn.trim().length>0||!!rn||yn.current.length>0||ue.current.length>0)}}),It.inputHandler.of((rt,Dt,pn,Ut)=>{var rn;return Ut==="!"&&rt.state.doc.toString()===""&&el(rt.state)!=="active"?(ke(),!0):Ut==="?"&&rt.state.doc.toString()===""&&el(rt.state)!=="active"?((rn=Q.current)==null||rn.call(Q),!0):!1}),It.domEventHandlers({blur(rt){return Yt(),rt.relatedTarget instanceof Element&&rt.relatedTarget.closest('[data-at-mention-panel="true"]')||window.setTimeout(()=>{const Dt=z.current;Dt!=null&&Dt.hasFocus||document.activeElement instanceof Element&&document.activeElement.closest('[data-at-mention-panel="true"]')||st()},0),!1},paste(rt){var tr,Ci,mr,po;const Dt=(tr=rt.clipboardData)==null?void 0:tr.items;if(!Dt)return!1;let pn=!1;for(const go of Dt)if(go.type.startsWith("image/")&&/^image\/(png|jpeg|gif|webp)$/i.test(go.type)){pn=!0;const xa=go.getAsFile();if(!xa)continue;const Ka=go.type,Ya=new FileReader;Ya.onload=()=>{const xt=Ya.result.split(",")[1];Xe(En=>[...En,{data:xt,media_type:Ka}])},Ya.readAsDataURL(xa)}if(pn)return rt.preventDefault(),!0;const Ut=xOe(((Ci=rt.clipboardData)==null?void 0:Ci.getData("text/plain"))??"");if(!Ut||!vOe(Ut))return!1;rt.preventDefault(),Tr.state.doc.toString()===""&&((mr=W.current)!=null&&mr.isVisible)&&((po=U.current)==null||po.call(U));const{placeholderText:rn,nextPasteId:zn}=kOe(Fe.current,kt.current,Ut);kt.current=zn;const fs=Tr.state.selection.main;return Tr.dispatch({changes:{from:fs.from,to:fs.to,insert:rn},selection:{anchor:fs.from+rn.length},scrollIntoView:!0}),!0}}),It.theme(j)]}),Tr=new It({state:ni,parent:$.current});z.current=Tr,Tr.focus();const mo=Tr.state.doc.toString().trim();return fr(mo.length>0||yn.current.length>0||ue.current.length>0),()=>{Tr.dispatch({effects:rd.of()}),Tr.destroy(),z.current=null,Qe.disconnect(),le.remove()}},[]),f.useEffect(()=>{const le=z.current;le&&(le.dispatch({effects:kF.reconfigure(It.editable.of(!i))}),i||le.focus())},[i]),f.useEffect(()=>{const le=z.current;if(!le)return;const Se=!i&&(b!=null&&b.isVisible)&&b.suggestion?b.suggestion:null,He=Se??(Ee?O("editor.shellPlaceholder"):o);le.dispatch({effects:[_F.reconfigure(xz(He)),SF.reconfigure(CF(Se))]})},[i,o,Ee,O,b==null?void 0:b.isVisible,b==null?void 0:b.suggestion]),f.useEffect(()=>{const le=z.current;!le||el(le.state)!=="active"||(G2(le),window.setTimeout(()=>{z.current===le&&W2(le)},0))},[L]);const pe=[a.map(le=>{var Se;return[le.name,le.description??"",le.source??"",le.displayCategory??"",le.argumentHint??"",((Se=le.subcommands)==null?void 0:Se.join(","))??""].join("\0")}).join(""),c.map(le=>[le.name,le.description].join("\0")).join(""),(u==null?void 0:u.join("|"))??""].join("");f.useEffect(()=>{De.current&&Ot(z.current)},[pe,L,Ot]),f.useEffect(()=>{const le=z.current;le&&(g?(Yt(),st(),le.contentDOM.blur()):le.focus())},[st,g,Yt]),f.useEffect(()=>{const le=Se=>{var is,Js,vr;if(V.current||ne||g||Se.defaultPrevented)return;const He=Se.target,Qe=(is=$.current)==null?void 0:is.contains(He),xn=document.activeElement===document.body;if(!Qe&&!xn)return;const Bt=z.current,$n=W.current,Qs=Im((Bt==null?void 0:Bt.state.doc.toString())??"",$n==null?void 0:$n.suggestion);if(Bt&&!Bt.hasFocus&&($n!=null&&$n.isVisible)&&Qs&&!Sp(Se.target)){if(Se.key==="Tab"&&!Se.shiftKey&&!Se.metaKey&&!Se.ctrlKey&&!Se.altKey&&el(Bt.state)!=="active"){Se.preventDefault(),Bt.dispatch({changes:{from:0,to:Bt.state.doc.length,insert:Qs},selection:{anchor:Qs.length},scrollIntoView:!0}),Bt.focus(),(Js=te.current)==null||Js.call(te,"tab",{skipOnAccept:!0});return}if(Se.key==="ArrowRight"&&!Se.shiftKey&&!Se.metaKey&&!Se.ctrlKey&&!Se.altKey&&el(Bt.state)!=="active"){Se.preventDefault(),Bt.dispatch({changes:{from:0,to:Bt.state.doc.length,insert:Qs},selection:{anchor:Qs.length},scrollIntoView:!0}),Bt.focus(),(vr=te.current)==null||vr.call(te,"right",{skipOnAccept:!0});return}}if(Se.metaKey||Se.ctrlKey||Se.altKey||Se.key.length!==1||Sp(Se.target)||!Bt||Bt.hasFocus)return;if(Se.preventDefault(),Se.key==="!"&&Bt.state.doc.toString()===""){ke();return}const vs=Bt.state.selection.main;Bt.dispatch({changes:{from:vs.from,to:vs.to,insert:Se.key},selection:{anchor:vs.from+Se.key.length},scrollIntoView:!0}),Bt.focus(),Se.key==="/"?window.setTimeout(()=>{Ot(z.current)},0):Se.key==="@"&&window.setTimeout(()=>{const ni=z.current;ni&&ni.hasFocus&&(Yt(),Ke(ni))},0)};return window.addEventListener("keydown",le),()=>window.removeEventListener("keydown",le)},[Ke,Yt,ne,g,Ot,ke]);const Ie=f.useCallback(()=>{var le;(le=z.current)==null||le.focus()},[]),Ge=f.useCallback((le,Se)=>{const He=z.current;if(!He||!le){He==null||He.focus();return}if((Se==null?void 0:Se.mode)==="replace"){He.dispatch({changes:{from:0,to:He.state.doc.length,insert:le},effects:rd.of(),selection:{anchor:le.length},scrollIntoView:!0}),He.focus();return}const Qe=He.state.selection.main;let xn=le,Bt=!1,$n=null;const Qs=le==="@";let vs=le==="/";if(le==="/")He.state.doc.lineAt(Qe.head).text.startsWith("/")?Bt=!0:He.state.doc.length>0&&(Bt=!0,vs=!1);else if(le==="@"){const is=Qe.from>0?He.state.doc.sliceString(Qe.from-1,Qe.from):"";He.state.doc.sliceString(Qe.from,Qe.from+1)==="@"?(Bt=!0,$n=Qe.from+1):is==="@"?Bt=!0:is&&!/\s/.test(is)&&(xn=" @")}Bt?$n!==null&&He.dispatch({selection:{anchor:$n},scrollIntoView:!0}):(He.dispatch({changes:{from:Qe.from,to:Qe.to,insert:xn},selection:{anchor:Qe.from+xn.length},scrollIntoView:!0}),Qs&&(ot.current={text:xn,from:Qe.from})),He.focus(),vs?window.setTimeout(()=>{Ot(z.current)},0):Qs&&window.setTimeout(()=>{const is=z.current;is&&is.hasFocus&&(Yt(),Ke(is))},0)},[Yt,Ke,Ot]),Xt=f.useCallback(()=>{var le;return((le=z.current)==null?void 0:le.state.doc.toString())??""},[]),Cn=f.useCallback(le=>{const Se=z.current;Se&&(Se.dispatch({changes:{from:0,to:Se.state.doc.length,insert:le},effects:rd.of(),selection:{anchor:le.length},scrollIntoView:!0}),Se.focus())},[]),Un=f.useCallback(le=>{const Se=z.current;if(!Se)return;const He=[];Se.state.field(Oh).between(0,Se.state.doc.length,(Qe,xn,Bt)=>{const $n=Bt.spec.tag;$n&&(!le||le($n))&&He.push({from:Qe,to:xn,insert:""})}),He.length!==0&&Se.dispatch({changes:He,effects:fI.of({predicate:le}),scrollIntoView:!0})},[]),xe=f.useCallback(le=>{const Se=(le==null?void 0:le.text)??!0,He=(le==null?void 0:le.tags)??!0,Qe=z.current;Se&&Qe&&Qe.state.doc.length>0&&Qe.dispatch({changes:{from:0,to:Qe.state.doc.length,insert:""},effects:rd.of()}),Se&&(Xe([]),Fe.current.clear(),kt.current=1),He&&(Pe([]),Se||Un())},[Un]),$e=f.useCallback(()=>{xe({text:!0,tags:!1})},[xe]),Lt=f.useCallback((le,Se)=>{if(le.length!==0){if((Se==null?void 0:Se.placement)==="inline"){const He=z.current;if(!He)return;const Qe=He.state.selection.main;let xn=Qe.from;const Bt=[],$n=le.map(vs=>{const is=Gy(vs);return Bt.push({from:xn,to:xn+is.length,tag:vs}),xn+=is.length+1,is}).join(" "),Qs=$n?`${$n} `:"";He.dispatch({changes:{from:Qe.from,to:Qe.to,insert:Qs},effects:Bt.length>0?Bt.map(vs=>ay.of({...vs,tag:At(vs.tag)})):void 0,selection:{anchor:Qe.from+Qs.length},scrollIntoView:!0}),He.focus();return}Pe(He=>{const Qe=[...He];for(const xn of le){const Bt=Qe.findIndex($n=>$n.id===xn.id);Bt>=0?Qe[Bt]=xn:Qe.push(xn)}return Qe})}},[At]),ln=f.useCallback(le=>{Pe(Se=>{const He=Se.filter(Qe=>Qe.id!==le||Qe.removable===!1);return He.length===Se.length?Se:He}),Un(Se=>Se.id===le&&Se.removable!==!1)},[Un]),Pt=f.useCallback(()=>{var le;return(((le=z.current)==null?void 0:le.state.doc.toString().trim().length)??0)>0||yn.current.length>0||ue.current.length>0},[]),An=f.useCallback(le=>{const Se=z.current;if(!Se)return;const He=wF(Se);if((le==null?void 0:le.tagPlacement)==="inline"){Ne.current(Se,le.text??"",le.tags??He);return}if((le==null?void 0:le.text)!==void 0&&le.tags===void 0&&He.length>0){Ne.current(Se,le.text,He);return}Ne.current(Se,le==null?void 0:le.text,le?le.tags??[]:void 0)},[]),Xn=f.useCallback(()=>{const le=Vs.current.getLastEntry(He=>!He.startsWith("/")&&!He.startsWith("!"));!le||F.current(le)===!1||Xe([])},[]),Mn=f.useCallback(le=>{const Se=z.current;Se&&Se.dispatch({changes:{from:0,to:Se.state.doc.length,insert:le},selection:{anchor:le.length},scrollIntoView:!0})},[]);f.useEffect(()=>{const le=je.current;if(!le)return;const Se=z.current;if(!Se)return;const He=le.tagPlacement??"top";if(le.tags!==void 0&&He==="top"&&Pe([...le.tags]),le.text!==void 0||He==="inline"){const xn=He==="inline"?[...le.tags??[]]:[],Bt=xn.map(Gy).join(" "),$n=He==="inline"?Bt&&le.text?`${Bt} ${le.text}`:Bt||(le.text??""):le.text??"",Qs=[rd.of()];if(xn.length>0){let vs=0;for(const is of xn){const Js=Gy(is);Qs.push(ay.of({from:vs,to:vs+Js.length,tag:At(is)})),vs+=Js.length+1}}Se.dispatch({changes:{from:0,to:Se.state.doc.length,insert:$n},effects:Qs,selection:{anchor:$n.length},scrollIntoView:!0})}else Se.dispatch({effects:rd.of()});(le.text!==void 0||le.submit)&&Se.focus();let Qe=null;return le.submit&&(Qe=window.setTimeout(()=>{z.current&&An(le)},0)),()=>{Qe!==null&&window.clearTimeout(Qe)}},[k,At,An]);const Gn=f.useCallback((le,Se=!0)=>{var Qe;le&&Mn(Me.current),gt(!1),tt(""),jn([]),Be(0),(bt.current?ls.current:Vs.current).resetSearch(),Se&&((Qe=z.current)==null||Qe.focus())},[Mn]);f.useEffect(()=>{if(!ne)return;const le=Se=>{if(Se instanceof MouseEvent&&Se.button!==0||Se.defaultPrevented)return;const He=ve.current,Qe=Se.target;He&&Qe instanceof Node&&!He.contains(Qe)&&Gn(!0,!1)};return window.addEventListener("mousedown",le),window.addEventListener("touchstart",le),()=>{window.removeEventListener("mousedown",le),window.removeEventListener("touchstart",le)}},[ne,Gn]);const Zn=f.useCallback(le=>{var $n;if(!z.current)return;Gn(!1);const He=le.trim();if(!He)return;const Qe=ue.current,xn=bt.current;if(F.current(xn?`!${He}`:He,Qe.length>0?[...Qe]:void 0)===!1){Mn(le);return}($n=U.current)==null||$n.call(U),xn?(ls.current.push(He),ls.current.reset()):(Vs.current.push(He),Vs.current.reset()),Xe([]),Mn("")},[Gn,Mn]),Vn=le=>{if(!le.nativeEvent.isComposing)if(le.key==="Escape")le.preventDefault(),Gn(!0);else if(le.key==="Tab"){le.preventDefault();const Se=jt[kn];Se&&Mn(Se),Gn(!1)}else if(le.key==="Enter"){le.preventDefault();const Se=jt[kn];Se?Zn(Se):Gn(!1)}else le.key==="r"&&le.ctrlKey&&(le.preventDefault(),jt.length>0&&Be(Se=>(Se+1)%jt.length))},hn=le=>{const Se=bt.current?ls.current:Vs.current;jn(Ws(le)),Be(0),Se.resetSearch()},Le=le=>{const Se=le.target.value;tt(Se),!le.nativeEvent.isComposing&&hn(Se)},Nt=le=>{const Se=le.currentTarget.value;tt(Se),hn(Se)},Tn=f.useCallback(le=>{Xe(Se=>Se.filter((He,Qe)=>Qe!==le))},[]),_n=!Ee&&!ne&&!(b!=null&&b.isVisible)&&!i&&!g,cs=f.useCallback(le=>{Xe(Se=>[...Se,...le])},[]),gr=f.useMemo(()=>({clearText:$e,clear:xe,focus:Ie,getText:Xt,hasInput:Pt,setText:Cn,addTags:Lt,removeTag:ln,insertText:Ge,retryLast:Xn,restoreImages:cs,submit:An}),[Lt,xe,$e,Ie,Xt,Pt,Ge,ln,cs,Xn,Cn,An]);return{containerRef:$,viewRef:z,focus:Ie,submitText:f.useCallback(()=>{const le=z.current;le&&Ne.current(le)},[]),clearText:$e,getText:Xt,hasInput:Pt,hasContent:Bs,handle:gr,pastedImages:_e,removeImage:Tn,composerTags:bn,removeTopTag:ln,addTags:Lt,removeInlineTags:Un,insertText:Ge,setText:Cn,submit:An,clear:xe,retryLast:Xn,replaceEditorText:Mn,shellMode:Ee,setShellMode:me,toggleShellMode:ke,currentMode:m,sessionName:y,searchState:{searchMode:ne,searchQuery:We,searchMatches:jt,searchActiveIndex:kn,searchInputRef:ht,searchUiRef:ve,openHistorySearch:Ss,closeSearch:Gn,submitSearchMatch:Zn,handleSearchKeyDown:Vn,handleSearchInput:Le,handleSearchCompositionEnd:Nt},navigatePrevHistory:Cr,navigateNextHistory:Lr,showShortcutHints:_n,followupState:b,disabled:i,onAcceptFollowup:v,onDismissFollowup:x,slashMenu:pt,closeSlashMenu:Yt,selectSlashCompletion:Pn,acceptSlashCompletion:as,atMenu:et.state,closeAtMenu:st,selectAtCompletion:et.select,acceptAtCompletion:et.accept,enterAtCategory:et.enterCategory,backAtCategories:et.backToCategories,updateAtSearch:et.updateSearch,selectAtTab:et.selectTab}}const LOe="_flash_96ig5_1",zf={flash:LOe},POe="_chatMessageRow_17pz3_41",OOe="_chatBubble_17pz3_48",BOe="_chatContent_17pz3_61",$Oe="_messageTag_17pz3_66",zOe="_messageTagTooltip_17pz3_83",FOe="_messageTagClickable_17pz3_117",qOe="_messageTagIcon_17pz3_127",HOe="_messageTagLabel_17pz3_138",UOe="_messageTagValue_17pz3_139",VOe="_chatContentCollapsed_17pz3_162",WOe="_toggleButton_17pz3_167",GOe="_toggleIcon_17pz3_188",KOe="_toggleIconExpanded_17pz3_195",YOe="_chatImages_17pz3_199",XOe="_chatImageThumb_17pz3_206",Bo={chatMessageRow:POe,chatBubble:OOe,chatContent:BOe,messageTag:$Oe,messageTagTooltip:zOe,messageTagClickable:FOe,messageTagIcon:qOe,messageTagLabel:HOe,messageTagValue:UOe,chatContentCollapsed:VOe,toggleButton:WOe,toggleIcon:GOe,toggleIconExpanded:KOe,chatImages:YOe,chatImageThumb:XOe};function QOe({composerTagIcons:e,content:t,inputAnnotations:n,onComposerTagClick:s,renderComposerTag:r,renderComposerTagTooltip:i}){const o=f.useMemo(()=>H0e(t,n),[t,n]);return l.jsx(l.Fragment,{children:o.map((a,c)=>a.type==="text"?l.jsx(f.Fragment,{children:a.text},c):l.jsx(_re,{composerTagIcons:e,onComposerTagClick:s,renderComposerTag:r,renderComposerTagTooltip:i,tag:a.tag,title:a.tag.serialized,preserveCustomKindLabel:!0},`${a.tag.id}:${c}`))})}const JOe=f.memo(function({content:t,images:n,inputAnnotations:s,isLocateFlashing:r=!1}){const{t:i}=ut(),{parseUserMessageContent:o,renderUserMessageContent:a,composerTagIcons:c,renderComposerTag:u,renderComposerTagTooltip:d,onComposerTagClick:h}=Lu(),m=f.useRef(null),[p,g]=f.useState(!1),[b,v]=f.useState(!1),x=f.useMemo(()=>{const w=a==null?void 0:a({content:t,images:n,inputAnnotations:s});if(w!=null)return w;if(s&&s.length>0)return l.jsx(QOe,{composerTagIcons:c,content:t,inputAnnotations:s,onComposerTagClick:h,renderComposerTag:u,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,S)=>T.type==="text"?T.text:l.jsx(_re,{tag:T.tag,composerTagIcons:c,renderComposerTag:u,renderComposerTagTooltip:d,onComposerTagClick:h},`${T.tag.id}-${S}`))},[t,n,s,h,o,c,u,d,a]),y=f.useCallback(()=>{const w=m.current;w&&v(w.scrollHeight>400)},[]);return f.useLayoutEffect(()=>{g(!1),y()},[t,n==null?void 0:n.length,y]),f.useEffect(()=>{const w=m.current;if(!w||typeof ResizeObserver>"u")return;const k=new ResizeObserver(y);return k.observe(w),()=>k.disconnect()},[y]),l.jsx("div",{className:Bo.chatMessageRow,children:l.jsxs("div",{className:`${Bo.chatBubble}${r?` ${zf.flash}`:""}`,children:[l.jsxs("div",{ref:m,className:`${Bo.chatContent} ${b&&!p?Bo.chatContentCollapsed:""}`,children:[n&&n.length>0&&l.jsx("div",{className:Bo.chatImages,children:n.map((w,k)=>{const T=w.data.startsWith("data:")?w.data:`data:${w.mimeType};base64,${w.data}`;return P1(T)?l.jsx("img",{src:T,alt:i("user.uploadedImage",{index:k+1}),className:Bo.chatImageThumb,onLoad:y},k):null})}),x]}),b&&l.jsxs("button",{type:"button",className:Bo.toggleButton,onClick:()=>g(w=>!w),children:[l.jsx("span",{children:i(p?"userMessage.showLess":"userMessage.showMore")}),l.jsx("svg",{className:`${Bo.toggleIcon} ${p?Bo.toggleIconExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"m4 6 4 4 4-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})]})]})})});function ZOe(e){return hI(e)}function _re({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 c,u;try{c=n==null?void 0:n(a)}catch(y){console.warn("[WebShell] user message tag render failed",y)}try{u=s==null?void 0:s(a)}catch(y){console.warn("[WebShell] user message tag tooltip render failed",y)}const d=!!r,h=o?U0e(e,t):null,m=eC(e),p=(h==null?void 0:h.tagValue)??tC(e),g=(h==null?void 0:h.tagLabel)??(e.kind?"":m),b=(h==null?void 0:h.fallback)??e.id,v=e.icon??(h==null?void 0:h.iconUrl)??Dp(e.kind,t),x=v&&(ON(v)||P1(v))?v:void 0;return l.jsxs("span",{className:`${Bo.messageTag}${d?` ${Bo.messageTagClickable}`:""}`,role:d?"button":void 0,tabIndex:d?0:void 0,title:i??ZOe(e),onClick:y=>{d&&(y.stopPropagation(),r==null||r({...a,anchorRect:y.currentTarget.getBoundingClientRect()}))},onKeyDown:y=>{d&&(y.key!=="Enter"&&y.key!==" "||(y.preventDefault(),r==null||r({...a,anchorRect:y.currentTarget.getBoundingClientRect()})))},children:[c??l.jsxs(l.Fragment,{children:[x&&l.jsx("span",{className:Bo.messageTagIcon,style:Kh("--user-message-tag-icon-url",x),"aria-hidden":"true"}),g&&l.jsx("span",{className:Bo.messageTagLabel,children:g}),p?l.jsx("span",{className:Bo.messageTagValue,children:p}):g?null:l.jsx("span",{className:Bo.messageTagLabel,children:b})]}),u!=null&&l.jsx("span",{className:Bo.messageTagTooltip,role:"tooltip",children:u})]})}const eBe="_message_1nmy0_1",tBe="_customFooter_1nmy0_7",nBe="_messageFooter_1nmy0_11",sBe="_copyButton_1nmy0_27",rBe="_footerTime_1nmy0_53",iBe="_thinking_1nmy0_65",oBe="_thinkingBody_1nmy0_77",aBe="_thinkingHeader_1nmy0_108",lBe="_thinkingSummary_1nmy0_120",cBe="_translateButton_1nmy0_136",uBe="_thinkingHeaderExpanded_1nmy0_147",dBe="_translationPopover_1nmy0_154",hBe="_translationTitle_1nmy0_159",fBe="_translationContent_1nmy0_164",mBe="_translationPending_1nmy0_171",pBe="_translationError_1nmy0_175",gBe="_translationFooter_1nmy0_179",bBe="_translationUsage_1nmy0_189",yBe="_translationActions_1nmy0_196",xBe="_thinkingSummaryTextActive_1nmy0_211",vBe="_thinkingSummaryIcon_1nmy0_218",wBe="_thinkingSummaryText_1nmy0_211",kBe="_thinkingChevronRight_1nmy0_275",_Be="_thinkingChevronDown_1nmy0_276",SBe="_thinkingExpandedWrap_1nmy0_339",CBe="_thinkingExpandedClip_1nmy0_343",TBe="_thinkingExpandedCollapsed_1nmy0_351",EBe="_thinkingExpandedInner_1nmy0_355",ABe="_content_1nmy0_403",NBe="_contentBody_1nmy0_408",Fs={message:eBe,customFooter:tBe,messageFooter:nBe,copyButton:sBe,footerTime:rBe,thinking:iBe,thinkingBody:oBe,thinkingHeader:aBe,thinkingSummary:lBe,translateButton:cBe,thinkingHeaderExpanded:uBe,translationPopover:dBe,translationTitle:hBe,translationContent:fBe,translationPending:mBe,translationError:pBe,translationFooter:gBe,translationUsage:bBe,translationActions:yBe,thinkingSummaryTextActive:xBe,thinkingSummaryIcon:vBe,thinkingSummaryText:wBe,thinkingChevronRight:kBe,thinkingChevronDown:_Be,thinkingExpandedWrap:SBe,thinkingExpandedClip:CBe,thinkingExpandedCollapsed:TBe,thinkingExpandedInner:EBe,content:ABe,contentBody:NBe},jBe=f.memo(function({content:t,isStreaming:n,timestamp:s,onBranchSession:r,showFooterActions:i=!1,showBranchAction:o=!1,isLocateFlashing:a=!1,customFooterInfo:c}){const{t:u}=ut(),{renderAssistantTurnFooter:d}=Lu(),[h,m]=f.useState(!1),p=!!t&&!n&&i,g=f.useMemo(()=>c?d==null?void 0:d(c):void 0,[c,d]),b=f.useCallback(()=>{var x;const v=(x=navigator.clipboard)==null?void 0:x.writeText(t);v&&v.then(()=>{m(!0),window.setTimeout(()=>m(!1),2e3)}).catch(()=>{})},[t]);return l.jsxs("div",{className:Fs.message,children:[t&&l.jsx("div",{className:`${Fs.content}${a?` ${zf.flash}`:""}`,children:l.jsx("div",{className:Fs.contentBody,children:l.jsx(gp,{content:t,source:"assistant",isStreaming:n})})}),g&&l.jsx("div",{className:Fs.customFooter,children:g}),p&&l.jsxs("div",{className:Fs.messageFooter,children:[l.jsx("button",{type:"button",className:Fs.copyButton,title:u("assistant.copy"),"aria-label":u("assistant.copy"),onClick:b,children:h?l.jsx(IBe,{}):l.jsx(MBe,{})}),o&&r&&l.jsx("button",{type:"button",className:Fs.copyButton,title:u("assistant.branch"),"aria-label":u("assistant.branch"),onClick:r,children:l.jsx(RBe,{})}),s!==void 0&&l.jsx("span",{className:Fs.footerTime,"aria-hidden":"true",children:Og(s)})]})]})});function MBe(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.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"}),l.jsx("rect",{x:"3",y:"5.2",width:"7.8",height:"7.8",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]})}function IBe(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"m3.5 8.3 3 3L12.8 5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function RBe(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.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"}),l.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"}),l.jsx("circle",{cx:"5",cy:"3.5",r:"1.5",fill:"currentColor"}),l.jsx("circle",{cx:"11",cy:"4",r:"1.5",fill:"currentColor"}),l.jsx("circle",{cx:"11",cy:"12.5",r:"1.5",fill:"currentColor"})]})}const Om=new Map,DBe=200;function EF(e,t){if(Om.delete(e),Om.set(e,t),Om.size<=DBe)return;const n=Om.keys().next().value;n!==void 0&&Om.delete(n)}const LBe=f.memo(function({messageId:t,content:n,isStreaming:s,timestamp:r,isLocateFlashing:i=!1,generateContent:o}){const{language:a,t:c}=ut(),u=f.useContext(Ep),[d,h]=f.useState(!1),m=s===!0,p=f.useRef(r??Date.now()),g=f.useRef(m),[b,v]=f.useState(()=>Date.now()),[x,y]=f.useState(null),[w,k]=f.useState(!1),[T,S]=f.useState(),[C,_]=f.useState(!1),[B,A]=f.useState(!1),[N,j]=f.useState(!1),P=f.useRef(void 0);f.useEffect(()=>{if(!n||!m)return;v(Date.now());const Q=setInterval(()=>v(Date.now()),1e3);return()=>clearInterval(Q)},[n,m]),f.useEffect(()=>{if(n){if(m){g.current=!0,y(null);return}g.current&&x===null&&y(Date.now())}},[n,x,m]);const L=m||x!==null?(m?b:x)-p.current:void 0,O=PBe({isStreaming:s,durationMs:L}),$=L!==void 0?OBe(L):"",z=f.useCallback(()=>{h(Q=>!Q)},[]);f.useEffect(()=>()=>{var Q;(Q=P.current)==null||Q.abort()},[]);const F=f.useCallback(async(Q=!1)=>{var J;if(s||!o||C&&!Q)return;const V=`${a}:${t}:${n}`,M=Om.get(V);if(M&&!Q){EF(V,M),S(M);return}Q&&Om.delete(V),(J=P.current)==null||J.abort();const re=new AbortController;P.current=re,S({text:""}),A(!1),j(!1),_(!0);let se="",X=!1;try{const W=`Translate the following model reasoning into ${a==="zh-CN"?"Simplified Chinese":"English"}. Preserve its meaning and Markdown formatting. Output only the translation.

${n}`;for await(const te of o(W,{signal:re.signal})){if(P.current!==re)return;if(te.type==="thinking")A(!0);else if(te.type==="delta")A(!1),se+=te.text,S({text:se});else if(te.type==="done"){if(!se.trim())throw new Error("Translation was empty");X=!0;const U={text:se,inputTokens:te.inputTokens,outputTokens:te.outputTokens};EF(V,U),S(U)}else if(te.type==="error")throw new Error(te.message)}if(!X)throw new Error("Translation stream ended early")}catch{re.signal.aborted||j(!0)}finally{P.current===re&&(P.current=void 0,A(!1),_(!1))}},[n,o,s,a,t,C]),G=f.useCallback(Q=>{k(Q),Q&&F()},[F]),I=f.useCallback(()=>{const Q=P.current;P.current=void 0,Q==null||Q.abort(),A(!1),_(!1),k(!1)},[]);return l.jsx("div",{className:`${Fs.message}${i?` ${zf.flash}`:""}`,children:n&&!u&&l.jsx("div",{className:Fs.thinking,children:l.jsxs("div",{className:Fs.thinkingBody,children:[l.jsxs("div",{className:`${Fs.thinkingHeader}${d?` ${Fs.thinkingHeaderExpanded}`:""}`,onClick:Q=>{Q.currentTarget.contains(Q.target)&&z()},children:[l.jsxs("button",{type:"button",className:Fs.thinkingSummary,"aria-expanded":d,title:c(d?"thinking.collapse":"thinking.expand"),children:[l.jsx("span",{className:Fs.thinkingSummaryIcon,"aria-hidden":"true",children:l.jsx(BBe,{})}),l.jsx("span",{className:m?`${Fs.thinkingSummaryText} ${Fs.thinkingSummaryTextActive}`:Fs.thinkingSummaryText,children:c(O,$?{duration:$}:{})})]}),a==="zh-CN"&&!m&&o&&l.jsxs(Ax,{open:w,onOpenChange:G,children:[l.jsx(yS,{asChild:!0,children:l.jsx(qn,{type:"button",variant:"secondary",size:"xs",className:Fs.translateButton,title:c("thinking.translate"),onClick:Q=>Q.stopPropagation(),children:c("thinking.translate")})}),l.jsxs(Nx,{align:"start",className:Fs.translationPopover,children:[l.jsx("div",{className:Fs.translationTitle,children:c("thinking.translation")}),N?l.jsx("div",{className:Fs.translationError,children:c("thinking.translationFailed")}):T!=null&&T.text?l.jsx("div",{className:`${Fs.thinkingExpandedWrap} ${Fs.translationContent}`,children:l.jsx(gp,{content:T.text,source:"thinking",isStreaming:C})}):l.jsx("div",{className:Fs.translationPending,children:c(B?"thinking.translationThinking":"thinking.translating")}),l.jsxs("div",{className:Fs.translationFooter,children:[l.jsx("div",{className:Fs.translationUsage,children:!C&&(T==null?void 0:T.text)&&l.jsxs(l.Fragment,{children:[l.jsx("span",{children:c("thinking.inputTokens",{count:T.inputTokens??"--"})}),l.jsx("span",{children:c("thinking.outputTokens",{count:T.outputTokens??"--"})})]})}),l.jsxs("div",{className:Fs.translationActions,children:[l.jsx(qn,{type:"button",variant:"outline",size:"xs",onClick:()=>void F(!0),children:c("thinking.retranslate")}),l.jsx(qn,{type:"button",variant:"outline",size:"xs",disabled:!C&&!(T!=null&&T.text)&&!N,onClick:I,children:c(C?"thinking.cancelTranslation":"thinking.closeTranslation")})]})]})]})]}),l.jsx("span",{className:d?Fs.thinkingChevronDown:Fs.thinkingChevronRight,"aria-hidden":"true"})]}),l.jsx("div",{className:d?Fs.thinkingExpandedClip:`${Fs.thinkingExpandedClip} ${Fs.thinkingExpandedCollapsed}`,children:l.jsx("div",{className:Fs.thinkingExpandedInner,children:l.jsx("div",{className:Fs.thinkingExpandedWrap,children:l.jsx(gp,{content:n,source:"thinking",isStreaming:s})})})})]})})})});function PBe({isStreaming:e,durationMs:t}){return e?"thinking.running":t!==void 0&&t<1e3?"thinking.doneBriefly":"thinking.done"}function OBe(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 BBe(){return l.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[l.jsx("path",{d:"M7.2 15.2h4",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"}),l.jsx("path",{d:"M6.5 13.1h5.4",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"}),l.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"}),l.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 $Be="_panel_8ng9u_1",zBe="_title_8ng9u_16",FBe="_metaLine_8ng9u_22",qBe="_progress_8ng9u_32",HBe="_spacer_8ng9u_38",UBe="_row_8ng9u_42",VBe="_detailRow_8ng9u_43",WBe="_subDetailRow_8ng9u_44",GBe="_symbol_8ng9u_65",KBe="_label_8ng9u_69",YBe="_value_8ng9u_73",XBe="_detailName_8ng9u_80",QBe="_sectionTitle_8ng9u_88",JBe="_detailSection_8ng9u_94",ZBe="_skillBlock_8ng9u_100",e$e="_hint_8ng9u_105",t$e="_detailCommand_8ng9u_111",n$e="_bodyLoaded_8ng9u_132",s$e="_accent_8ng9u_137",r$e="_secondary_8ng9u_141",i$e="_warning_8ng9u_145",o$e="_error_8ng9u_149",a$e="_success_8ng9u_153",Wn={panel:$Be,title:zBe,metaLine:FBe,progress:qBe,spacer:HBe,row:UBe,detailRow:VBe,subDetailRow:WBe,symbol:GBe,label:KBe,value:YBe,detailName:XBe,sectionTitle:QBe,detailSection:JBe,skillBlock:ZBe,hint:e$e,detailCommand:t$e,bodyLoaded:n$e,accent:s$e,secondary:r$e,warning:i$e,error:o$e,success:a$e},DA="web-shell:context-usage:v1:",Sh="█",Sre="▒",Cre="░",Tre=30;function l$e(e){return`${DA}${JSON.stringify(e)}`}function c$e(e){if(!e.startsWith(DA))return null;try{const t=JSON.parse(e.slice(DA.length));return!(t!=null&&t.usage)||typeof t.usage.totalTokens!="number"?null:t}catch{return null}}function Ere(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function o1(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function u$e(e,t){if(t<=0)return"0.0";const n=e/t*100;return n>100?">100":n.toFixed(1)}function d$e(e){return[...e].sort((t,n)=>n.tokens-t.tokens)}function h$e({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?Wn.error:e>60?Wn.warning:Wn.accent;return l.jsxs("div",{className:Wn.progress,"aria-hidden":"true",children:[l.jsx("span",{className:o,children:Sh.repeat(Math.max(0,s))}),l.jsx("span",{className:Wn.secondary,children:Cre.repeat(Math.max(0,i))}),l.jsx("span",{className:Wn.warning,children:Sre.repeat(Math.max(0,r))})]})}function ed({symbol:e,label:t,tokens:n,tokenLabel:s,contextWindowSize:r,symbolClassName:i=Wn.secondary,isOverLimit:o}){return l.jsxs("div",{className:Wn.row,children:[l.jsx("span",{className:`${Wn.symbol} ${i}`,children:e}),l.jsx("span",{className:Wn.label,children:t}),l.jsxs("span",{className:o?Wn.error:Wn.value,children:[o1(n)," ",s," (",u$e(n,r),"%)"]})]})}const C6="/context detail";function f$e({hint:e,onShowDetail:t}){const n=t?e.indexOf(C6):-1;return n<0?l.jsx("div",{className:Wn.hint,children:e}):l.jsxs("div",{className:Wn.hint,children:[e.slice(0,n),l.jsx("button",{type:"button",className:Wn.detailCommand,onClick:t,children:C6}),e.slice(n+C6.length)]})}function m$e({name:e,tokens:t,tokenLabel:n}){return l.jsxs("div",{className:Wn.detailRow,children:[l.jsxs("span",{className:Wn.secondary,children:["└"," "]}),l.jsx("span",{className:Wn.detailName,title:e,children:Ere(e,Tre)}),l.jsxs("span",{className:Wn.value,children:[o1(t)," ",n]})]})}function T6({title:e,items:t,getName:n,tokenLabel:s}){const r=d$e(t);return r.length===0?null:l.jsxs("section",{className:Wn.detailSection,children:[l.jsx("div",{className:Wn.sectionTitle,children:e}),r.map(i=>l.jsx(m$e,{name:n(i),tokens:i.tokens,tokenLabel:s},n(i)))]})}function p$e({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:l.jsxs("section",{className:Wn.detailSection,children:[l.jsx("div",{className:Wn.sectionTitle,children:t.skills}),n.map(s=>l.jsxs("div",{className:Wn.skillBlock,children:[l.jsxs("div",{className:Wn.detailRow,children:[l.jsxs("span",{className:Wn.secondary,children:["└"," "]}),l.jsxs("span",{className:Wn.detailName,title:s.name,children:[Ere(s.name,Tre),s.loaded&&l.jsxs("span",{className:Wn.success,children:[" ",t.active]})]}),l.jsxs("span",{className:Wn.value,children:[o1(s.tokens)," ",t.tokens]})]}),s.loaded&&s.bodyTokens!=null&&s.bodyTokens>0&&l.jsxs("div",{className:Wn.subDetailRow,children:[l.jsxs("span",{className:Wn.secondary,children:["  └"," "]}),l.jsx("span",{className:Wn.bodyLoaded,children:t.bodyLoaded}),l.jsxs("span",{className:Wn.success,children:["+",o1(s.bodyTokens)," ",t.tokens]})]})]},s.name))]})}function g$e({status:e,onShowDetail:t}){const{t:n}=ut(),{usage:s}=e,{breakdown:r,contextWindowSize:i}=s,o=i>0?s.totalTokens/i*100:0,a=o>100,c=i>0?r.autocompactBuffer/i*100:0;return l.jsxs("div",{className:Wn.panel,children:[l.jsx("div",{className:Wn.title,children:n("contextUsage.title")}),s.isEstimated?l.jsx(l.Fragment,{children:l.jsxs("div",{className:Wn.metaLine,children:[l.jsxs("span",{children:[n("contextUsage.model"),": ",s.modelName]}),l.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",o1(i)," ",n("contextUsage.tokens")]})]})}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:Wn.metaLine,children:[l.jsxs("span",{children:[n("contextUsage.model"),": ",s.modelName]}),l.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",o1(i)," ",n("contextUsage.tokens")]})]}),a&&l.jsx("div",{className:Wn.error,children:n("contextUsage.overLimit")})]}),l.jsx(h$e,{usedPercentage:Math.min(o,100),bufferPercentage:c}),l.jsx("div",{className:Wn.spacer}),l.jsx(ed,{symbol:Sh,label:n("contextUsage.used"),tokens:s.totalTokens,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:a?Wn.error:Wn.accent,isOverLimit:a}),l.jsx(ed,{symbol:Cre,label:n("contextUsage.free"),tokens:r.freeSpace,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i}),l.jsx(ed,{symbol:Sre,label:n("contextUsage.autocompactBuffer"),tokens:r.autocompactBuffer,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Wn.warning}),l.jsx("div",{className:Wn.spacer}),l.jsx("div",{className:Wn.sectionTitle,children:n("contextUsage.usageByCategory")}),l.jsx(ed,{symbol:Sh,label:n("contextUsage.systemPrompt"),tokens:r.systemPrompt,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Wn.accent}),l.jsx(ed,{symbol:Sh,label:n("contextUsage.builtinTools"),tokens:r.builtinTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Wn.accent}),r.mcpTools>0&&l.jsx(ed,{symbol:Sh,label:n("contextUsage.mcpTools"),tokens:r.mcpTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Wn.accent}),l.jsx(ed,{symbol:Sh,label:n("contextUsage.memoryFiles"),tokens:r.memoryFiles,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Wn.accent}),l.jsx(ed,{symbol:Sh,label:n("contextUsage.skills"),tokens:r.skills,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Wn.accent}),!s.isEstimated&&l.jsx(ed,{symbol:Sh,label:n("contextUsage.messages"),tokens:r.messages,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Wn.accent}),s.showDetails?l.jsxs(l.Fragment,{children:[l.jsx(T6,{title:n("contextUsage.builtinTools"),items:s.builtinTools,getName:u=>"name"in u?u.name:u.path,tokenLabel:n("contextUsage.tokens")}),l.jsx(T6,{title:n("contextUsage.mcpTools"),items:s.mcpTools,getName:u=>"name"in u?u.name:u.path,tokenLabel:n("contextUsage.tokens")}),l.jsx(T6,{title:n("contextUsage.memoryFiles"),items:s.memoryFiles,getName:u=>"path"in u?u.path:u.name,tokenLabel:n("contextUsage.tokens")}),l.jsx(p$e,{skills:s.skills,labels:{active:n("contextUsage.active"),bodyLoaded:n("contextUsage.bodyLoaded"),skills:n("contextUsage.skills"),tokens:n("contextUsage.tokens")}})]}):l.jsx(f$e,{hint:n("contextUsage.detailHint"),onShowDetail:t})]})}const b$e={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"},y$e=/[\x00-\x08\x0b-\x1f\x7f-\x9f\u202a-\u202e\u2066-\u2069]/g;function Y2(e){return e.replace(y$e,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 Are(e){if(!e.trim())return"Tool";const t=b$e[e];if(t)return t;const n=e.toLowerCase();return n==="web_fetch"||n==="webfetch"||n==="fetch"?"WebFetch":e}function Ec(e,t){const n=Are(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 Rc(e){const t=e.toLowerCase();return t==="ask_user_question"||t==="askuserquestion"}function Gi(e,t){return e.length<=t?e:e.slice(0,t)+"..."}const wg=2e3;function mI(e,t){if(rC(e.toolName)){const r=sC(e.args,"skill");if(r)return Gi(r,wg)}const n=w$e(e,t);if(n)return Gi(n,wg);const s=jre(e,t);return s?Gi(s,wg):""}function Nre(e,t){if(!fl(e.toolName))return mI(e,t);const n=sC(e.args,"description");if(n)return Gi(n,wg);const s=jre(e,t,{includeTimeout:!1});return s?Gi(s,wg):""}function x$e(e){return fl(e.toolName)?sC(e.args,"description"):""}function Cu(e){var t;if(!e.content)return PA(e.rawOutput);for(const n of e.content)if(n.type==="content"&&((t=n.content)!=null&&t.text))return n.content.text;return PA(e.rawOutput)}function v$e(e){if(e.status!=="completed"&&e.status!=="failed")return"";const t=e.toolName.toLowerCase();if(t==="grep_search"||t==="grep"||t==="search"){const o=AF((PA(e.rawOutput)??"").trim());if(o)return o}const n=Cu(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(fl(t)){if(r>3)return`${r} lines of output`;const o=s[0]||"";return Gi(o,80)}if(t==="grep_search"||t==="grep"||t==="search"){const o=AF(n.trim());return o||`${s.filter(c=>c.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 Gi(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(Rc(t))return"";const i=s[0]||"";return Gi(i,80)}function w$e(e,t){if(!e.title)return null;const n=Are(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 NF(o.replace(/^:\s*|\s+/,""),t)}return NF(s,t)}function AF(e){return e==="No matches found"||/^Found \d+ match(?:es)?(?: \(truncated\))?$/.test(e)?e:null}function jre(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 ${J0(String(s.directory),t)}]`),s.is_background?o+=" [background]":i&&s.timeout&&(o+=` [timeout: ${String(s.timeout)}ms]`);const a=sC(s,"description");return a&&(o+=` (${a})`),Gi(o,wg)}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):J0(String(s.file_path),t);if(s.url){const o=String(s.url),a=typeof s.prompt=="string"?s.prompt:void 0,c=a?`${o} — "${Gi(a,40)}"`:o;return Gi(c,80)}if(s.path)return J0(String(s.path),t);if(s.query)return Gi(String(s.query),60);if(r==="list_directory"||r==="listfiles"){const o=s.path||s.directory||"";return J0(String(o),t)}return s.description?String(s.description):""}function sC(e,t){const n=e==null?void 0:e[t];return typeof n=="string"?n.trim().replace(/\n/g," "):""}function fl(e){const t=e.toLowerCase();return t==="run_shell_command"||t==="bash"||t==="shell"||t==="execute_command"}function rC(e){return e.toLowerCase()==="skill"}function Ac(e,t){var n;return e.callId===t?!0:((n=e.subTools)==null?void 0:n.some(s=>Ac(s,t)))??!1}function NF(e,t){const n=e.trim();return Mre(LA(n))?J0(n,t):n.replace(/(?:[A-Za-z]:)?\/[^\s'")]+/g,s=>J0(s,t))}function J0(e,t){const n=LA(e),s=t?LA(t).replace(/\/+$/,""):"";return s&&(n===s||n.startsWith(`${s}/`))?n.slice(s.length+1)||".":Mre(n)?k$e(n):n}function LA(e){return e.replace(/\\/g,"/")}function Mre(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function k$e(e){return e.replace(/\/+$/,"").split("/").pop()||e}function zv(e){if(!e||typeof e!="object")return;const t=e;return t.type==="task_execution"?t:void 0}function pI(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 Qx(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=pI(e);return n==="cancelled"||n==="canceled"||s.toLowerCase().includes("cancel")?"failed":e.status}function gI(e){return e>=1e6?`${(e/1e6).toFixed(1)}M tokens`:e>=1e3?(e/1e3).toFixed(1).replace(/\.0$/,"")+"k tokens":`${e} tokens`}const _$e="general-purpose";function bI(e){var s;const t=zv(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":_$e}function yI(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=zv(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 S$e(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=Ec(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 Gi(r,50)}function PA(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 C$e="_panel_qchwm_1",T$e="_title_qchwm_17",E$e="_sectionTitle_qchwm_23",A$e="_spacer_qchwm_29",N$e="_pivotRow_qchwm_35",j$e="_metricCell_qchwm_41",M$e="_metricCellSection_qchwm_48",I$e="_metricCellSub_qchwm_56",R$e="_modelCell_qchwm_64",D$e="_modelCellHeader_qchwm_71",L$e="_divider_qchwm_79",P$e="_kvRow_qchwm_87",O$e="_kvSubRow_qchwm_94",B$e="_kvLabel_qchwm_102",$$e="_kvValue_qchwm_106",z$e="_tableRow_qchwm_115",F$e="_modelUsageRow_qchwm_121",q$e="_tableNameCol_qchwm_129",H$e="_tableToolCol_qchwm_137",U$e="_tableNumCol_qchwm_145",V$e="_tableValueCol_qchwm_153",W$e="_success_qchwm_162",G$e="_error_qchwm_166",K$e="_secondary_qchwm_170",Y$e="_warning_qchwm_174",Et={panel:C$e,title:T$e,sectionTitle:E$e,spacer:A$e,pivotRow:N$e,metricCell:j$e,metricCellSection:M$e,metricCellSub:I$e,modelCell:R$e,modelCellHeader:D$e,divider:L$e,kvRow:P$e,kvSubRow:O$e,kvLabel:B$e,kvValue:$$e,tableRow:z$e,modelUsageRow:F$e,tableNameCol:q$e,tableToolCol:H$e,tableNumCol:U$e,tableValueCol:V$e,success:W$e,error:G$e,secondary:K$e,warning:Y$e},OA="web-shell:session-stats:v1:";function X$e(e,t="overview"){return`${OA}${JSON.stringify({_view:t,...e})}`}function Q$e(e){if(!e.startsWith(OA))return null;try{const t=JSON.parse(e.slice(OA.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 ff(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 Bm({label:e,children:t}){return l.jsxs("div",{className:Et.kvRow,children:[l.jsx("span",{className:Et.kvLabel,children:e}),l.jsx("span",{className:Et.kvValue,children:t})]})}function Ky({label:e,children:t}){return l.jsxs("div",{className:Et.kvSubRow,children:[l.jsxs("span",{className:Et.secondary,children:["»"," ",e]}),l.jsx("span",{className:Et.kvValue,children:t})]})}function Ire(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 J$e(e){return e.api.totalRequests===0?0:e.api.totalErrors/e.api.totalRequests*100}function Z$e(e){return e.api.totalRequests===0?0:e.api.totalLatencyMs/e.api.totalRequests}function eze(e){return e.tokens.prompt===0?0:e.tokens.cached/e.tokens.prompt*100}function Zc({metric:e,values:t,variant:n="normal"}){const s=n==="section"?Et.metricCellSection:n==="sub"?Et.metricCellSub:Et.metricCell;return l.jsxs("div",{className:Et.pivotRow,children:[l.jsx("span",{className:s,children:n==="sub"?`↳ ${e}`:e}),t.map((r,i)=>l.jsx("span",{className:Et.modelCell,children:r},i))]})}function tze({status:e}){const{t}=ut(),{models:n,tools:s,files:r}=e,i=Object.values(n).reduce((b,v)=>b+v.api.totalLatencyMs,0),o=s.totalDurationMs,a=i+o,c=a>0?i/a*100:0,u=a>0?o/a*100:0,d=s.totalCalls>0?s.totalSuccess/s.totalCalls*100:0,h=Ire(n),m=h.reduce((b,v)=>b+v.metrics.tokens.cached,0),p=h.reduce((b,v)=>b+v.metrics.tokens.prompt,0),g=p>0?m/p*100:0;return l.jsxs("div",{className:Et.panel,children:[l.jsx("div",{className:Et.title,children:t("stats.title")}),l.jsx("div",{className:Et.sectionTitle,children:t("stats.overview")}),l.jsx(Bm,{label:t("stats.duration"),children:ff(e.durationMs)}),l.jsx(Bm,{label:t("stats.prompts"),children:e.promptCount}),l.jsx(Bm,{label:t("stats.toolCalls"),children:l.jsxs("span",{children:[s.totalCalls," ",l.jsx("span",{className:Et.secondary,children:"("}),l.jsxs("span",{className:Et.success,children:["✓",s.totalSuccess]})," ",l.jsxs("span",{className:Et.error,children:["✗",s.totalFail]}),l.jsx("span",{className:Et.secondary,children:")"})]})}),l.jsx(Bm,{label:t("stats.successRate"),children:l.jsxs("span",{className:d>=90?Et.success:d>=70?Et.warning:Et.error,children:[d.toFixed(1),"%"]})}),(r.totalLinesAdded>0||r.totalLinesRemoved>0)&&l.jsx(Bm,{label:t("stats.codeChanges"),children:l.jsxs("span",{children:[l.jsxs("span",{className:Et.success,children:["+",r.totalLinesAdded]})," ",l.jsxs("span",{className:Et.error,children:["-",r.totalLinesRemoved]})]})}),l.jsx("div",{className:Et.spacer}),l.jsx("div",{className:Et.sectionTitle,children:t("stats.performance")}),l.jsxs(Ky,{label:t("stats.apiTime"),children:[ff(i)," ",l.jsxs("span",{className:Et.secondary,children:["(",c.toFixed(1),"%)"]})]}),l.jsxs(Ky,{label:t("stats.toolTime"),children:[ff(o)," ",l.jsxs("span",{className:Et.secondary,children:["(",u.toFixed(1),"%)"]})]}),h.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:Et.spacer}),l.jsx("div",{className:Et.sectionTitle,children:t("stats.modelUsage")}),l.jsx("div",{className:Et.spacer}),l.jsxs("div",{className:`${Et.tableRow} ${Et.modelUsageRow}`,children:[l.jsx("span",{className:Et.tableNameCol,children:t("stats.modelUsage")}),l.jsx("span",{className:Et.tableValueCol,children:t("stats.reqs")}),l.jsx("span",{className:Et.tableValueCol,children:t("stats.inputTokens")}),l.jsx("span",{className:Et.tableValueCol,children:t("stats.outputTokens")})]}),l.jsx("div",{className:Et.divider}),h.map(b=>l.jsxs("div",{className:`${Et.tableRow} ${Et.modelUsageRow}`,children:[l.jsx("span",{className:Et.tableNameCol,children:b.label}),l.jsx("span",{className:Et.tableValueCol,children:b.metrics.api.totalRequests}),l.jsx("span",{className:`${Et.tableValueCol} ${Et.warning}`,children:b.metrics.tokens.prompt.toLocaleString()}),l.jsx("span",{className:`${Et.tableValueCol} ${Et.warning}`,children:b.metrics.tokens.candidates.toLocaleString()})]},b.key)),g>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:Et.spacer}),l.jsxs("div",{children:[l.jsx("span",{className:Et.success,children:t("stats.savingsHighlight")})," ",m.toLocaleString()," (",g.toFixed(1),"%)"," ",t("stats.cacheDesc")]}),l.jsxs("div",{className:Et.secondary,children:["»"," ",t("stats.modelTip")]})]})]})]})}function nze({status:e}){const{t}=ut(),n=Ire(e.models);if(n.length===0)return l.jsxs("div",{className:Et.panel,children:[l.jsx("div",{className:Et.title,children:t("stats.modelStats")}),l.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 l.jsxs("div",{className:Et.panel,children:[l.jsx("div",{className:Et.title,children:t("stats.modelStats")}),l.jsx("div",{className:Et.spacer}),l.jsxs("div",{className:Et.pivotRow,children:[l.jsx("span",{className:Et.metricCellSection,children:t("stats.metric")}),n.map(o=>l.jsx("span",{className:Et.modelCellHeader,children:o.label},o.key))]}),l.jsx("div",{className:Et.divider}),l.jsx(Zc,{metric:t("stats.api"),values:[],variant:"section"}),l.jsx(Zc,{metric:t("stats.requests"),values:i(o=>o.api.totalRequests.toLocaleString())}),l.jsx(Zc,{metric:t("stats.errors"),values:i(o=>{const a=J$e(o);return l.jsxs("span",{className:o.api.totalErrors>0?Et.error:void 0,children:[o.api.totalErrors.toLocaleString()," (",a.toFixed(1),"%)"]})})}),l.jsx(Zc,{metric:t("stats.avgLatency"),values:i(o=>ff(Z$e(o)))}),l.jsx("div",{className:Et.spacer}),l.jsx(Zc,{metric:t("stats.tokens"),values:[],variant:"section"}),l.jsx(Zc,{metric:t("stats.total"),values:i(o=>l.jsx("span",{className:Et.warning,children:o.tokens.total.toLocaleString()}))}),l.jsx(Zc,{metric:t("stats.inputTokens"),values:i(o=>o.tokens.prompt.toLocaleString()),variant:"sub"}),s&&l.jsx(Zc,{metric:t("stats.cached"),values:i(o=>l.jsxs("span",{className:Et.success,children:[o.tokens.cached.toLocaleString()," (",eze(o).toFixed(1),"%)"]})),variant:"sub"}),l.jsx(Zc,{metric:t("stats.outputTokens"),values:i(o=>o.tokens.candidates.toLocaleString()),variant:"sub"}),r&&l.jsx(Zc,{metric:t("stats.thoughts"),values:i(o=>o.tokens.thoughts.toLocaleString()),variant:"sub"})]})}function sze(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 rze({status:e}){const{t}=ut(),n=sze(e.tools.byName);if(n.length===0)return l.jsxs("div",{className:Et.panel,children:[l.jsx("div",{className:Et.title,children:t("stats.toolStats")}),l.jsx("div",{children:t("stats.noToolCalls")})]});const s=Object.values(e.tools.byName).reduce((o,a)=>{var c,u,d;return o.accept+=((c=a.decisions)==null?void 0:c.accept)??0,o.reject+=((u=a.decisions)==null?void 0:u.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 l.jsxs("div",{className:Et.panel,children:[l.jsx("div",{className:Et.title,children:t("stats.toolStats")}),l.jsx("div",{className:Et.spacer}),l.jsxs("div",{className:Et.tableRow,children:[l.jsx("span",{className:Et.tableToolCol,children:t("stats.toolName")}),l.jsx("span",{className:Et.tableNumCol,children:t("stats.calls")}),l.jsx("span",{className:Et.tableNumCol,children:t("stats.successRate")}),l.jsx("span",{className:Et.tableNumCol,children:t("stats.avgDuration")})]}),l.jsx("div",{className:Et.divider}),n.map(o=>{const a=o.stats.count>0?o.stats.success/o.stats.count*100:0,c=o.stats.count>0?o.stats.durationMs/o.stats.count:0;return l.jsxs("div",{className:Et.tableRow,children:[l.jsx("span",{className:`${Et.tableToolCol} ${Et.metricCell}`,children:Ec(o.name,t)}),l.jsx("span",{className:Et.tableNumCol,children:o.stats.count}),l.jsxs("span",{className:`${Et.tableNumCol} ${a>=90?Et.success:a>=70?Et.warning:Et.error}`,children:[a.toFixed(1),"%"]}),l.jsx("span",{className:Et.tableNumCol,children:ff(c)})]},o.name)}),l.jsx("div",{className:Et.spacer}),l.jsx("div",{className:Et.sectionTitle,children:t("stats.decisionSummary")}),l.jsx(Bm,{label:t("stats.totalReviewed"),children:r}),l.jsx(Ky,{label:t("stats.accepted"),children:l.jsx("span",{className:Et.success,children:s.accept})}),l.jsx(Ky,{label:t("stats.rejected"),children:l.jsx("span",{className:Et.error,children:s.reject})}),l.jsx(Ky,{label:t("stats.modified"),children:l.jsx("span",{className:Et.warning,children:s.modify})}),l.jsx("div",{className:Et.divider}),l.jsx(Bm,{label:t("stats.agreementRate"),children:l.jsx("span",{className:r>0?i>=90?Et.success:i>=70?Et.warning:Et.error:void 0,children:r>0?`${i.toFixed(1)}%`:"--"})})]})}function ize({view:e,status:t}){switch(e){case"model":return l.jsx(nze,{status:t});case"tools":return l.jsx(rze,{status:t});default:return l.jsx(tze,{status:t})}}function iC(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 oze="_panel_13hcg_1",aze="_title_13hcg_17",lze="_row_13hcg_23",cze="_rowGap_13hcg_31",uze="_label_13hcg_35",dze="_value_13hcg_41",hze="_accent_13hcg_46",Ym={panel:oze,title:aze,row:lze,rowGap:cze,label:uze,value:dze,accent:hze},{serialize:fze,parse:mze}=iC("web-shell:status:v1:");function yc({label:e,children:t,gap:n}){return l.jsxs("div",{className:`${Ym.row}${n?` ${Ym.rowGap}`:""}`,children:[l.jsx("span",{className:Ym.label,children:e}),l.jsx("span",{className:Ym.value,children:t})]})}function pze({info:e}){const{t}=ut();return l.jsxs("div",{className:Ym.panel,children:[l.jsx("div",{className:Ym.title,children:t("about.title")}),e.cliVersion&&l.jsx(yc,{label:t("about.qwenCode"),children:l.jsx("span",{className:Ym.accent,children:e.cliVersion})}),e.runtime&&l.jsx(yc,{label:t("about.runtime"),children:e.runtime}),e.platform&&l.jsx(yc,{label:t("about.platform"),children:e.platform}),e.auth&&l.jsx(yc,{label:t("about.auth"),gap:!0,children:e.auth}),e.baseUrl&&l.jsx(yc,{label:t("about.baseUrl"),children:e.baseUrl}),e.model&&l.jsx(yc,{label:t("about.model"),children:e.model}),e.fastModel&&e.fastModel!==e.model&&l.jsx(yc,{label:t("about.fastModel"),children:e.fastModel}),e.sessionId&&l.jsx(yc,{label:t("about.sessionId"),children:e.sessionId}),l.jsx(yc,{label:t("about.sandbox"),children:e.sandbox||t("about.noSandbox")}),l.jsx(yc,{label:t("about.proxy"),children:e.proxy||t("about.noProxy")}),e.memoryUsage&&l.jsx(yc,{label:t("about.memoryUsage"),children:e.memoryUsage})]})}function gze(e){return e instanceof HTMLElement?!!e.closest("[data-keyboard-scope]"):!1}function Rre(e,t,n=50){const s=f.useRef(e);f.useEffect(()=>{s.current=e},[e]),f.useEffect(()=>{const r=o=>{o.defaultPrevented||Sp(o.target)&&!gze(o.target)||s.current(o)},i=setTimeout(()=>{window.addEventListener("keydown",r)},n);return()=>{clearTimeout(i),window.removeEventListener("keydown",r)}},t)}function sa(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)}const bze="_panel_1jx2a_1",yze="_title_1jx2a_13",xze="_header_1jx2a_18",vze="_startup_1jx2a_24",wze="_note_1jx2a_28",kze="_secondary_1jx2a_29",_ze="_row_1jx2a_39",Sze="_selected_1jx2a_48",Cze="_disabled_1jx2a_52",Tze="_pointer_1jx2a_56",Eze="_nameCell_1jx2a_62",Aze="_truncate_1jx2a_69",Nze="_separator_1jx2a_75",jze="_sectionTitle_1jx2a_79",Mze="_groupTitle_1jx2a_80",Ize="_success_1jx2a_84",Rze="_warning_1jx2a_88",Dze="_error_1jx2a_92",Lze="_group_1jx2a_80",Pze="_list_1jx2a_102",Oze="_description_1jx2a_108",Bze="_schema_1jx2a_113",$ze="_shortcuts_1jx2a_131",zze="_detail_1jx2a_137",Fze="_serverFields_1jx2a_143",qze="_serverField_1jx2a_143",Hze="_serverFieldLabel_1jx2a_156",Uze="_detailBlock_1jx2a_160",Vze="_parameters_1jx2a_161",Wze="_invalidBlock_1jx2a_162",Gze="_parameterRow_1jx2a_172",Kze="_actionMessage_1jx2a_177",Yze="_oauthPage_1jx2a_183",Xze="_scrollHint_1jx2a_189",Zt={panel:bze,title:yze,header:xze,startup:vze,note:wze,secondary:kze,row:_ze,selected:Sze,disabled:Cze,pointer:Tze,nameCell:Eze,truncate:Aze,separator:Nze,sectionTitle:jze,groupTitle:Mze,success:Ize,warning:Rze,error:Dze,group:Lze,list:Pze,description:Oze,schema:Bze,shortcuts:$ze,detail:zze,serverFields:Fze,serverField:qze,serverFieldLabel:Hze,detailBlock:Uze,parameters:Vze,invalidBlock:Wze,parameterRow:Gze,actionMessage:Kze,oauthPage:Yze,scrollHint:Xze},BA="web-shell:mcp-panel-active",_m=10,{parse:Qze}=iC("web-shell:mcp-status:v1:");function Jze(e){const t=Qze(e);return!t||!t.status?null:t}function Fk(e,t){if(e.disabled)return{icon:"✗",text:t("mcp.status.disabled"),className:Zt.error};if(e.approvalState==="pending")return{icon:"!",text:t("mcp.status.needsApproval"),className:Zt.warning};if(e.approvalState==="rejected")return{icon:"✗",text:t("mcp.status.rejected"),className:Zt.warning};switch(e.mcpStatus){case"connected":return{icon:"✓",text:t("mcp.status.connected"),className:Zt.success};case"connecting":return{icon:"🔄",text:t("mcp.status.starting"),className:Zt.warning};case"disconnected":default:return{icon:"🔴",text:t("mcp.status.disconnectedTitle"),className:Zt.error}}}function Dre(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 Zze(e){const t=Dre(e);return t?JSON.stringify(t,null,2):""}function eFe(e,t){return e.extensionName?t("mcp.extensionMcp"):t("mcp.userMcp")}function tFe(e,t){const n=e.source;return e.configOrigin==="project_mcp_json"||n==="project"&&e.removable===!1?t("mcp.source.project"):e.configOrigin==="workspace_settings"||n==="workspace"||n==="project"?t("mcp.source.workspace"):e.configOrigin==="extension"||e.extensionName?t("mcp.source.extension"):t("mcp.source.user")}function nFe(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 E6(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 jF(e,t){window.dispatchEvent(new CustomEvent(BA,{detail:{id:e,active:t}}))}function qk(e,t,n){return[`${t("mcp.oauth.server")}: ${e}`,"",t("mcp.oauth.starting",{name:e}),...n?["",n]:[]].join(`
`)}function sFe(e,t){return e?t("mcp.required"):""}function rFe(e,t){const n=Dre(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=Zze(e);return o?l.jsx("pre",{className:Zt.schema,children:o}):null}const i=Object.entries(s);return i.length===0?null:l.jsxs("div",{className:Zt.parameters,children:[l.jsx("div",{className:Zt.sectionTitle,children:t("mcp.parameters")}),i.map(([o,a])=>{const c=a&&typeof a=="object"?a:{},u=typeof c.type=="string"?c.type:"any",d=typeof c.description=="string"?c.description:"";return l.jsx("div",{className:Zt.parameterRow,children:`• ${o}${sFe(r.has(o),t)}: ${u}${d?` - ${d}`:""}`},o)})]})}function iFe({message:e}){var Q;const{t}=ut(),n=EG({autoLoad:!1}),[s,r]=f.useState(e.status),[i,o]=f.useState(e.toolsByServer),[a,c]=f.useState(null),[u,d]=f.useState(!1),h=f.useRef(`mcp-${Math.random().toString(36).slice(2)}`),[m,p]=f.useState(!0),[g,b]=f.useState("servers"),[v,x]=f.useState(0),[y,w]=f.useState(0),[k,T]=f.useState(0),S=f.useMemo(()=>s.servers??[],[s.servers]),C=S[v]??null,_=f.useMemo(()=>{var V;return C?((V=i[C.name])==null?void 0:V.tools)??[]:[]},[C,i]),B=_[k]??null,A=f.useMemo(()=>_.length<=_m||k<_m-1?0:Math.min(k-_m+1,_.length-_m),[k,_.length]),N=f.useMemo(()=>_.slice(A,A+_m),[_,A]),j=S.filter(V=>!V.disabled&&V.mcpStatus==="connecting").length,P=f.useMemo(()=>{const V=[];for(const M of S){const re=eFe(M,t),se=V.find(X=>X.label===re);se?se.servers.push(M):V.push({label:re,servers:[M]})}return V},[S,t]),L=f.useMemo(()=>S.length===0?20:Math.min(Math.max(...S.map(V=>V.name.length))+2,35),[S]),O=f.useMemo(()=>_.length===0?30:Math.min(Math.max(..._.map(V=>V.name.length))+2,50),[_]),$=f.useMemo(()=>{if(!C)return[];const V=[],M=!!C.approvalState;return!C.disabled&&!M&&_.length>0&&V.push({id:"view-tools",label:t("mcp.action.tools")}),!C.disabled&&!M&&C.mcpStatus==="disconnected"&&V.push({id:"reconnect",label:t("mcp.action.reconnect")}),!C.disabled&&M&&V.push({id:"approve",label:t("mcp.action.approve")}),(!(C.configOrigin==="extension"||C.source==="extension"||!!C.extensionName)||C.disabled)&&V.push({id:C.disabled?"enable":"disable",label:C.disabled?t("mcp.action.enable"):t("mcp.action.disable")}),!C.disabled&&!M&&(V.push({id:"authenticate",label:C.hasOAuthTokens?t("mcp.action.reauth"):t("mcp.action.auth")}),C.hasOAuthTokens&&V.push({id:"clear-auth",label:t("mcp.action.clearAuth")})),V},[C,_.length,t]),z=f.useCallback(async()=>{var M;const V=await n.reload();if(V){r(V);const re=((M=V.servers)==null?void 0:M.find(se=>se.name===(C==null?void 0:C.name)))??null;if(re){if(re.approvalState)return;const se=await n.loadTools(re.name);o(X=>({...X,[re.name]:se}))}}},[n,C==null?void 0:C.name]),F=f.useCallback(async V=>{if(!(!C||V.disabled||u)){if(V.id==="view-tools"){b("tools"),T(0),c(null);return}d(!0),V.id==="authenticate"&&b("oauth"),c(V.id==="authenticate"?qk(C.name,t):t("mcp.action.running",{action:V.label}));try{let M=null;if(V.id==="reconnect"){const re=await n.restartServer(C.name);if("restarted"in re&&!re.restarted)throw new Error(t("mcp.reconnect.skipped",{reason:re.reason}));if("entries"in re&&(re.entries.length===0||re.entries.every(se=>!se.restarted)))throw new Error(t("mcp.reconnect.skipped",{reason:re.entries.map(se=>se.reason).filter(Boolean).join(", ")||"not connected"}))}else{const re=await n.manageServer(C.name,V.id),se=[...re.messages??[],...re.authUrl?[re.authUrl]:[]].join(`
`);se&&(M=V.id==="authenticate"?qk(C.name,t,se):se)}await z(),c(M??t("mcp.action.done",{action:V.label}))}catch(M){c(V.id==="authenticate"?qk(C.name,t,sa(M)):t("mcp.action.failed",{error:sa(M)}))}finally{d(!1)}}},[u,n,z,C,t]);if(f.useEffect(()=>{const V=h.current;return jF(V,m),()=>jF(V,!1)},[m]),f.useEffect(()=>{const V=M=>{const re=M.detail;re!=null&&re.active&&re.id&&re.id!==h.current&&p(!1)};return window.addEventListener(BA,V),()=>window.removeEventListener(BA,V)},[]),Rre(V=>{if(m){if(V.key==="Escape"){V.preventDefault(),V.stopPropagation(),g==="servers"?p(!1):g==="server"?(b("servers"),w(0),c(null)):g==="oauth"?(b("server"),c(null)):g==="tools"?(b("server"),T(0)):b("tools");return}if(V.key==="ArrowUp"||V.key==="ArrowDown"){V.preventDefault(),V.stopPropagation();const M=V.key==="ArrowUp"?-1:1;g==="servers"?(x(re=>Math.min(Math.max(re+M,0),S.length-1)),w(0)):g==="server"?w(re=>Math.min(Math.max(re+M,0),$.length-1)):g==="tools"&&T(re=>Math.min(Math.max(re+M,0),_.length-1));return}if(V.key==="Enter")if(V.preventDefault(),V.stopPropagation(),g==="servers"&&S.length>0)b("server"),w(0);else if(g==="server"&&$.length>0){const M=$[y];M&&F(M)}else g==="tools"&&_.length>0&&b("tool")}},[m,y,_.length,$,F,S.length,g]),!m)return null;if(S.length===0)return l.jsxs("div",{className:Zt.panel,"data-keyboard-scope":!0,children:[l.jsxs("div",{className:Zt.header,children:[l.jsx("div",{className:Zt.title,children:t("mcp.manageServers")}),l.jsx("div",{className:Zt.secondary,children:t("mcp.servers",{count:0})})]}),l.jsx("div",{className:Zt.secondary,children:t("mcp.empty")}),l.jsx("div",{className:Zt.shortcuts,children:t("mcp.shortcut.close")})]});const G=g==="servers"?t("mcp.manageServers"):g==="server"?(C==null?void 0:C.name)??t("mcp.manageServers"):g==="oauth"?t("mcp.oauth.title"):g==="tools"?t("mcp.toolsForServer",{name:(C==null?void 0:C.name)??t("common.server")}):(B==null?void 0:B.name)??t("mcp.toolDetail"),I=g==="servers"?t("mcp.servers",{count:S.length}):g==="server"||g==="oauth"?"":g==="tools"?t(_.length===1?"mcp.toolCount":"mcp.toolsCount",{count:_.length}):(B==null?void 0:B.serverToolName)??(C==null?void 0:C.name)??"";return l.jsxs("div",{className:Zt.panel,"data-keyboard-scope":!0,children:[j>0&&l.jsxs("div",{children:[l.jsx("div",{className:Zt.startup,children:t("mcp.starting",{count:j})}),l.jsx("div",{className:Zt.note,children:t("mcp.startingNote")})]}),l.jsxs("div",{className:Zt.header,children:[l.jsx("div",{className:Zt.title,children:G}),I&&l.jsx("div",{className:Zt.secondary,children:I})]}),g==="servers"&&l.jsx("div",{className:Zt.list,children:P.map(V=>{let M=0;for(const re of P){if(re===V)break;M+=re.servers.length}return l.jsxs("div",{className:Zt.group,children:[l.jsx("div",{className:Zt.groupTitle,children:V.label}),V.servers.map((re,se)=>{const X=M+se,J=X===v,de=Fk(re,t);return l.jsxs("div",{className:J?`${Zt.row} ${Zt.selected}`:Zt.row,onClick:()=>{x(X),b("server"),w(0)},onMouseEnter:()=>x(X),children:[l.jsx("span",{className:Zt.pointer,children:J?"❯":""}),l.jsx("span",{className:Zt.nameCell,style:{width:`${L}ch`},children:re.name}),l.jsx("span",{className:Zt.separator,children:"·"}),l.jsxs("span",{className:de.className,children:[de.icon," ",de.text]})]},re.name)})]},V.label)})}),g==="server"&&C&&l.jsxs("div",{className:Zt.detail,children:[l.jsxs("div",{className:Zt.serverFields,children:[l.jsxs("div",{className:Zt.serverField,children:[l.jsxs("span",{className:Zt.serverFieldLabel,children:[t("mcp.status"),":"]}),l.jsxs("span",{className:Fk(C,t).className,children:[Fk(C,t).icon," ",Fk(C,t).text]})]}),l.jsxs("div",{className:Zt.serverField,children:[l.jsxs("span",{className:Zt.serverFieldLabel,children:[t("mcp.source"),":"]}),l.jsx("span",{children:tFe(C,t)})]}),l.jsxs("div",{className:Zt.serverField,children:[l.jsxs("span",{className:Zt.serverFieldLabel,children:[t("mcp.command"),":"]}),l.jsx("span",{className:Zt.truncate,children:nFe(C,t)})]}),((Q=C.config)==null?void 0:Q.cwd)&&l.jsxs("div",{className:Zt.serverField,children:[l.jsxs("span",{className:Zt.serverFieldLabel,children:[t("mcp.workingDirectory"),":"]}),l.jsx("span",{className:Zt.truncate,children:C.config.cwd})]}),!C.disabled&&l.jsxs("div",{className:Zt.serverField,children:[l.jsxs("span",{className:Zt.serverFieldLabel,children:[t("mcp.tools"),":"]}),l.jsx("span",{children:t(_.length===1?"mcp.toolCount":"mcp.toolsCount",{count:_.length})})]})]}),l.jsx("div",{className:Zt.list,children:$.map((V,M)=>{const re=M===y,se=[Zt.row,re?Zt.selected:"",V.disabled?Zt.disabled:""].filter(Boolean).join(" ");return l.jsxs("div",{className:se,onClick:()=>{w(M),F(V)},children:[l.jsx("span",{className:Zt.pointer,children:re?"❯":""}),l.jsx("span",{children:V.label})]},V.id)})}),a&&l.jsx("pre",{className:Zt.actionMessage,children:a})]}),g==="oauth"&&l.jsx("div",{className:Zt.oauthPage,children:l.jsx("pre",{className:Zt.actionMessage,children:a??(C?qk(C.name,t):t("mcp.status.unknown"))})}),g==="tools"&&l.jsx("div",{className:Zt.list,children:_.length===0?l.jsx("div",{className:Zt.secondary,children:t("mcp.emptyTools")}):N.map((V,M)=>{const re=A+M,se=re===k,X=E6(V,t);return l.jsxs("div",{className:se?`${Zt.row} ${Zt.selected}`:Zt.row,onClick:()=>{T(re),b("tool")},onMouseEnter:()=>T(re),children:[l.jsx("span",{className:Zt.pointer,children:se?"❯":""}),l.jsx("span",{className:Zt.nameCell,style:{width:`${O}ch`},children:V.name}),V.isValid?X?l.jsx("span",{className:Zt.secondary,children:X}):null:l.jsx("span",{className:Zt.warning,children:t("mcp.invalidReason",{reason:V.invalidReason||t("mcp.status.unknown")})})]},V.name)})}),g==="tools"&&_.length>_m&&l.jsxs("div",{className:Zt.scrollHint,children:[A>0?"↑ ":"  ",t("mcp.scrollPosition",{current:k+1,total:_.length}),A+_m<_.length?" ↓":""]}),g==="tool"&&B&&l.jsxs("div",{className:Zt.detail,children:[!B.isValid&&l.jsxs("div",{className:Zt.invalidBlock,children:[l.jsx("div",{className:Zt.sectionTitle,children:t("mcp.invalidToolWarning")}),l.jsxs("div",{children:[t("mcp.invalidReasonLabel")," ",B.invalidReason||t("mcp.status.unknown")]}),l.jsx("div",{className:Zt.secondary,children:t("mcp.invalidToolHelp")})]}),B.description&&l.jsxs("div",{className:Zt.detailBlock,children:[l.jsx("div",{className:Zt.sectionTitle,children:t("mcp.description")}),l.jsx("div",{className:Zt.description,children:B.description.trim()})]}),E6(B,t)&&l.jsxs("div",{className:Zt.detailBlock,children:[l.jsx("span",{className:Zt.sectionTitle,children:t("mcp.annotations")})," ",l.jsx("span",{children:E6(B,t)})]}),rFe(B,t)]}),l.jsx("div",{className:Zt.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 oFe=3;function KS(e){return e.kind==="agent"&&typeof e.id=="string"}function aFe(e){const t=e.filter(KS),n=new Map;for(const u of t)n.set(u.id,u);const s=new Map,r=[];for(const u of t){const d=u.parentAgentId;if(d!=null&&d!==u.id&&n.has(d)){const h=s.get(d);h?h.push(u):s.set(d,[u])}else r.push(u)}if(s.size===0)return[...e];const i=[],o=new Set,a=u=>{if(!o.has(u.id)){o.add(u.id),i.push(u);for(const d of s.get(u.id)??[])a(d)}};for(const u of r)a(u);for(const u of t)o.has(u.id)||(o.add(u.id),i.push(u));let c=0;return e.map(u=>KS(u)?i[c++]:u)}function Lre(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 lFe(e){const t=new Map;for(const s of e)KS(s)&&t.set(s.id,s);const n=new Map;for(const s of t.values()){const{chain:r,terminatedBy:i}=Lre(s,o=>t.get(o));n.set(s.id,{visibleDepth:i==="cycle"?0:r.length,orphaned:r.length===0&&i==="missing"})}return n}function cFe(e){const t=new Map;for(const s of e)KS(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}=Lre(s,o=>t.get(o));i==="root"&&r.every(o=>o.isBackgrounded===!1)&&n.add(s.id)}return n}function YS(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 uFe="_panel_1c0ra_1",dFe="_embeddedPanel_1c0ra_12",hFe="_title_1c0ra_19",fFe="_sectionTitle_1c0ra_24",mFe="_overflowHint_1c0ra_28",pFe="_header_1c0ra_33",gFe="_secondary_1c0ra_39",bFe="_row_1c0ra_43",yFe="_selected_1c0ra_51",xFe="_pointer_1c0ra_55",vFe="_nameCell_1c0ra_61",wFe="_treeMarker_1c0ra_70",kFe="_orphanNote_1c0ra_74",_Fe="_status_1c0ra_78",SFe="_chevronCell_1c0ra_84",CFe="_chevron_1c0ra_84",TFe="_chevronExpanded_1c0ra_101",EFe="_separator_1c0ra_111",AFe="_list_1c0ra_115",NFe="_task_1c0ra_121",jFe="_taskExpanded_1c0ra_127",MFe="_success_1c0ra_132",IFe="_warning_1c0ra_136",RFe="_error_1c0ra_140",DFe="_detail_1c0ra_144",LFe="_detailTop_1c0ra_153",PFe="_detailTopMain_1c0ra_160",OFe="_inlineDetail_1c0ra_200",BFe="_taskIcon_1c0ra_222",$Fe="_detailField_1c0ra_251",zFe="_detailFieldLabel_1c0ra_258",FFe="_detailContent_1c0ra_264",qFe="_compactSummary_1c0ra_271",HFe="_actionBar_1c0ra_280",UFe="_actionHint_1c0ra_289",VFe="_actionButton_1c0ra_294",WFe="_dangerButton_1c0ra_314",GFe="_shortcuts_1c0ra_318",KFe="_confirmHint_1c0ra_324",YFe="_statusBadge_1c0ra_328",XFe="_activityCurrent_1c0ra_334",QFe="_activityPast_1c0ra_341",JFe="_promptContent_1c0ra_348",$t={panel:uFe,embeddedPanel:dFe,title:hFe,sectionTitle:fFe,overflowHint:mFe,header:pFe,secondary:gFe,row:bFe,selected:yFe,pointer:xFe,nameCell:vFe,treeMarker:wFe,orphanNote:kFe,status:_Fe,chevronCell:SFe,chevron:CFe,chevronExpanded:TFe,separator:EFe,list:AFe,task:NFe,taskExpanded:jFe,success:MFe,warning:IFe,error:RFe,detail:DFe,detailTop:LFe,detailTopMain:PFe,inlineDetail:OFe,taskIcon:BFe,detailField:$Fe,detailFieldLabel:zFe,detailContent:FFe,compactSummary:qFe,actionBar:HFe,actionHint:UFe,actionButton:VFe,dangerButton:WFe,shortcuts:GFe,confirmHint:KFe,statusBadge:YFe,activityCurrent:XFe,activityPast:QFe,promptContent:JFe},Jx="web-shell:tasks-panel-active",ZFe=3e3,MF=8,{parse:eqe}=iC("web-shell:tasks-status:v1:");function tqe(e){const t=eqe(e);return!t||!t.snapshot?null:t}function IF(e,t){window.dispatchEvent(new CustomEvent(Jx,{detail:{id:e,active:t}}))}function RF(e){return e.status==="running"||e.status==="paused"}function nqe(e){return[...e].sort((t,n)=>{const s=RF(t),r=RF(n);return s!==r?s?-1:1:s?n.startTime-t.startTime:(n.endTime??n.startTime)-(t.endTime??t.startTime)})}function A6(e){return aFe(nqe(e))}function DF(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Pre(e){switch(e){case"running":return $t.success;case"paused":return $t.warning;case"completed":return $t.success;case"failed":return $t.error;case"cancelled":return $t.warning;default:return""}}function sqe(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 rqe(e){switch(e){case"paused":return"⏸";case"completed":return"✓";case"failed":case"cancelled":return"✗";case"running":return null;default:return null}}function iqe({expanded:e}){return l.jsx("svg",{className:`${$t.chevron} ${e?$t.chevronExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})}function oqe(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 aqe(e,t){if(e.length<=MF)return{visible:e,windowStart:0,hiddenAbove:0,hiddenBelow:0};const n=Math.max(1,MF-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 lqe(e,t,n){const s=Ec(e,n),r=t?t.replace(/\s*\n\s*/g," ").trim():"",i=r?`${s}(${r})`:s;return Y2(i)}function Ore({message:e,embedded:t=!1,manageActiveEvent:n=!0,onClose:s}){const{t:r}=ut(),i=x1(),[o,a]=f.useState(()=>A6(e.snapshot.tasks)),[c,u]=f.useState(!0),[d,h]=f.useState("list"),[m,p]=f.useState(0),[g,b]=f.useState(null),[v,x]=f.useState(!1),[y,w]=f.useState(!1),[k,T]=f.useState(null),S=f.useRef(`tasks-${Math.random().toString(36).slice(2)}`),C=f.useRef(!1),_=f.useRef(null),B=o.length===0?0:Math.min(m,o.length-1),A=o[B]??null,N=f.useMemo(()=>lFe(o),[o]),j=f.useMemo(()=>cFe(o),[o]);f.useEffect(()=>{if(!c)return;const re=setInterval(()=>{C.current||(C.current=!0,i.getTasks().then(se=>{a(A6(se.tasks)),w(!1)}).catch(se=>{console.warn("[web-shell] failed to refresh tasks:",se),w(!0)}).finally(()=>{C.current=!1}))},ZFe);return()=>clearInterval(re)},[c,i]),f.useEffect(()=>{o.length===0&&m!==0&&p(0),m>=o.length&&o.length>0&&p(o.length-1)},[o.length,m]),f.useEffect(()=>{if(!c||d!=="detail"){_.current=null;return}if(!A){_.current=null,h("list");return}const M=_.current;if(!M||M.taskId!==A.id){_.current={taskId:A.id,status:A.status};return}M.status==="running"&&A.status!=="running"&&(b(null),h("list"))},[c,d,A]),f.useEffect(()=>{if(!n)return;const M=S.current;return IF(M,c),()=>IF(M,!1)},[c,n]),f.useEffect(()=>{if(!n)return;const M=re=>{const se=re.detail;se!=null&&se.active&&se.id&&se.id!==S.current&&u(!1)};return window.addEventListener(Jx,M),()=>window.removeEventListener(Jx,M)},[n]),f.useEffect(()=>{c||s==null||s()},[c,s]);const P=f.useCallback(async M=>{if(v)return;const re=M.status==="running",se=M.kind==="agent"&&M.status==="paused";if(!re&&!se)return;if(M.kind==="agent"&&j.has(M.id)&&g!==M.id){b(M.id);return}b(null),x(!0);try{if(!(await i.cancelTask(M.id,M.kind)).cancelled){T(r("tasks.alreadyStopped"));return}const de=await i.getTasks();a(A6(de.tasks)),T(null)}catch(J){console.warn("[web-shell] failed to cancel task:",J),T(r("tasks.cancelFailed"))}finally{x(!1)}},[i,v,j,g,r]);if(Rre(M=>{if(c){if(M.key==="Escape"){if(M.preventDefault(),M.stopPropagation(),g){b(null);return}d==="detail"?h("list"):u(!1);return}if(M.key==="ArrowLeft"){M.preventDefault(),M.stopPropagation(),d==="detail"?(b(null),h("list")):u(!1);return}if((M.key==="ArrowUp"||M.key==="ArrowDown")&&d==="list"){if(M.preventDefault(),M.stopPropagation(),o.length===0)return;const re=M.key==="ArrowUp"?-1:1;p(se=>Math.min(Math.max(se+re,0),o.length-1)),b(null);return}if(M.key==="Enter"){M.preventDefault(),M.stopPropagation(),d==="list"&&A?h("detail"):d==="detail"&&u(!1);return}if(M.key===" "&&d==="detail"){M.preventDefault(),M.stopPropagation(),u(!1);return}if(M.key==="x"&&!M.ctrlKey&&!M.metaKey){M.preventDefault(),M.stopPropagation(),A&&P(A);return}}},[c,d,o.length,A,P,g]),!c)return null;const L=g!==null&&A!==null&&g===A.id,O=[];L?(O.push(r("tasks.confirmStop")),O.push(r("tasks.shortcut.cancelConfirm"))):(O.push(r("tasks.shortcut.select")),O.push(r("tasks.shortcut.view")),(A==null?void 0:A.status)==="running"?O.push(r("tasks.shortcut.stop")):(A==null?void 0:A.kind)==="agent"&&(A==null?void 0:A.status)==="paused"&&O.push(r("tasks.shortcut.abandon")),O.push(r("tasks.shortcut.listClose")));const $=[];if(L?($.push(r("tasks.confirmStop")),$.push(r("tasks.shortcut.cancelConfirm"))):($.push(r("tasks.shortcut.detailBack")),$.push(r("tasks.shortcut.detailClose")),(A==null?void 0:A.status)==="running"?$.push(r("tasks.shortcut.stop")):(A==null?void 0:A.kind)==="agent"&&(A==null?void 0:A.status)==="paused"&&$.push(r("tasks.shortcut.abandon"))),o.length===0)return l.jsxs("div",{className:t?`${$t.panel} ${$t.embeddedPanel}`:$t.panel,"data-keyboard-scope":!0,children:[(y||k||!t)&&l.jsxs("div",{className:$t.header,children:[!t&&l.jsx("div",{className:$t.title,children:r("tasks.title")}),y&&l.jsx("div",{className:$t.warning,children:r("tasks.refreshStale")}),k&&l.jsx("div",{className:$t.error,children:k})]}),l.jsx("div",{children:l.jsx("div",{className:$t.secondary,children:r("tasks.empty")})}),!t&&l.jsx("div",{className:$t.shortcuts,children:r("tasks.shortcut.close")})]});const{visible:z,windowStart:F,hiddenAbove:G,hiddenBelow:I}=aqe(o,B),Q=t?o:z,V=t?0:F;return l.jsxs("div",{className:t?`${$t.panel} ${$t.embeddedPanel}`:$t.panel,"data-keyboard-scope":!0,children:[(t||d==="list")&&(y||k||!t)&&l.jsxs("div",{className:$t.header,children:[!t&&l.jsx("div",{className:$t.title,children:r("tasks.title")}),y&&l.jsx("div",{className:$t.warning,children:r("tasks.refreshStale")}),k&&l.jsx("div",{className:$t.error,children:k})]}),(t||d==="list")&&l.jsxs("div",{className:$t.list,children:[!t&&l.jsxs("div",{className:$t.sectionTitle,children:[r("tasks.title")," ",l.jsxs("span",{className:$t.secondary,children:["(",o.length,")"]})]}),!t&&G>0&&l.jsx("div",{className:$t.overflowHint,children:r("tasks.moreAbove",{count:G})}),Q.map((M,re)=>{const se=V+re,X=se===B,J=Pre(M.status),de=sqe(M.status,r),W=t&&X&&d==="detail",te=t?W:X,U=M.kind==="agent"?N.get(M.id):void 0,ee=Math.min((U==null?void 0:U.visibleDepth)??0,oFe),oe=M.kind==="agent"&&M.parentAgentId!=null,Ce=U!=null&&U.orphaned?M.kind==="agent"&&M.parentName?r("tasks.row.from",{parent:M.parentName}):r("tasks.row.nested"):null;return l.jsxs("div",{className:`${$t.task} ${W?$t.taskExpanded:""}`,children:[l.jsxs("div",{className:te?`${$t.row} ${$t.selected}`:$t.row,onClick:()=>{p(se),h(t&&W?"list":"detail")},onMouseEnter:()=>{t||p(se)},children:[l.jsx("span",{className:$t.pointer,children:te?"❯":""}),t&&l.jsx("span",{className:$t.taskIcon,"aria-hidden":"true"}),l.jsxs("span",{className:$t.nameCell,style:ee>0?{paddingLeft:`${ee*16}px`}:void 0,children:[oe&&l.jsx("span",{className:$t.treeMarker,"aria-hidden":"true",children:"↳ "}),oqe(M,j.has(M.id)),Ce&&l.jsxs("span",{className:$t.orphanNote,children:[" · ",Ce]})]}),l.jsx("span",{className:`${$t.status} ${J}`,children:de}),l.jsx("span",{className:$t.chevronCell,children:l.jsx(iqe,{expanded:W})})]}),W&&l.jsx("div",{className:$t.inlineDetail,children:l.jsx(LF,{task:M,t:r,hideHeader:!0,busy:v,showCancelConfirm:g===M.id,onCancel:()=>void P(M),onCancelConfirmDismiss:()=>b(null)})})]},M.id)}),!t&&I>0&&l.jsx("div",{className:$t.overflowHint,children:r("tasks.moreBelow",{count:I})})]}),!t&&d==="detail"&&A&&l.jsxs(l.Fragment,{children:[k&&l.jsx("div",{className:$t.error,children:k}),l.jsx(LF,{task:A,t:r,busy:v,showCancelConfirm:g===A.id,onCancel:()=>void P(A),onCancelConfirmDismiss:()=>b(null)})]}),!t&&l.jsx("div",{className:L?`${$t.shortcuts} ${$t.confirmHint}`:$t.shortcuts,children:(d==="list"?O:$).join(" · ")})]})}function cqe(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 LF({task:e,t,hideHeader:n=!1,busy:s=!1,showCancelConfirm:r=!1,onCancel:i,onCancelConfirmDismiss:o}){var w,k,T;const a=rqe(e.status),c=Pre(e.status),u=e.kind==="agent"&&e.status==="paused",d=e.status==="running"||u,h=t(u?"tasks.action.abandon":"tasks.action.stop"),m=t(u?"tasks.action.confirmAbandon":"tasks.action.confirmStop"),p=[YS(e.runtimeMs)],g=[{label:t("tasks.detail.runtime"),value:YS(e.runtimeMs)}],b=e.kind==="agent"?((w=e.stats)==null?void 0:w.outputTokens)??((k=e.stats)==null?void 0:k.totalTokens):void 0;b&&(p.push(t("tasks.detail.tokens",{count:DF(b)})),g.push({label:t("tasks.detail.tokenCount"),value:DF(b)})),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 v=e.kind==="agent"&&e.prompt?e.prompt.split(`
`):[],x=d&&i?l.jsx("div",{className:$t.actionBar,children:r?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:$t.actionHint,children:t("tasks.action.confirmHint")}),l.jsx("button",{type:"button",className:`${$t.actionButton} ${$t.dangerButton}`,disabled:s,onClick:i,children:m}),l.jsx("button",{type:"button",className:$t.actionButton,onClick:o,children:t("common.cancel")})]}):l.jsx("button",{type:"button",className:`${$t.actionButton} ${$t.dangerButton}`,disabled:s,onClick:i,children:h})}):null,y=n?g.length>0?l.jsx("div",{className:$t.compactSummary,children:g.map(S=>`${S.label} ${S.value}`).join(" · ")}):null:l.jsxs(l.Fragment,{children:[l.jsx("div",{className:$t.title,children:cqe(e,t)}),l.jsxs("div",{className:$t.statusBadge,children:[a&&l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:c,children:[a," ",t(`tasks.${e.status}`)]}),l.jsx("span",{className:$t.separator,children:"·"})]}),l.jsx("span",{className:$t.secondary,children:p.join(" · ")})]})]});return l.jsxs("div",{className:$t.detail,children:[(y||x)&&l.jsxs("div",{className:$t.detailTop,children:[y&&l.jsx("div",{className:$t.detailTopMain,children:y}),x]}),e.kind==="shell"&&l.jsxs(l.Fragment,{children:[l.jsx(g0,{label:t("tasks.detail.workingDir"),value:e.cwd}),e.outputFile&&l.jsx(g0,{label:t("tasks.detail.outputFile"),value:e.outputFile})]}),e.kind==="monitor"&&l.jsx(g0,{label:t("tasks.detail.command"),value:e.command}),e.kind==="agent"&&e.subagentType&&l.jsx(g0,{label:t("tasks.detail.type"),value:e.subagentType}),e.kind==="agent"&&(e.depth??0)>0&&l.jsx(g0,{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&&l.jsxs("div",{className:$t.detailField,children:[l.jsx("div",{className:$t.detailFieldLabel,children:t("tasks.detail.progress")}),l.jsx("div",{className:$t.detailContent,children:e.recentActivities.slice(-5).map((S,C,_)=>{const B=C===_.length-1,A=lqe(S.name,S.description,t);return l.jsxs("div",{className:B?$t.activityCurrent:$t.activityPast,children:[B?"> ":"  ",A]},`${S.at}-${C}`)})})]}),e.kind==="agent"&&e.prompt&&l.jsxs("div",{className:$t.detailField,children:[l.jsx("div",{className:$t.detailFieldLabel,children:t("tasks.detail.prompt")}),l.jsx("div",{className:$t.promptContent,children:v.slice(0,5).map((S,C,_)=>l.jsx("div",{children:C===_.length-1&&v.length>5?`${S}…`:S||" "},C))})]}),e.kind==="agent"&&e.outputFile&&l.jsx(g0,{label:t("tasks.detail.outputFile"),value:e.outputFile}),e.kind==="agent"&&e.status==="paused"&&e.resumeBlockedReason&&l.jsxs("div",{className:$t.detailField,children:[l.jsx("div",{className:`${$t.detailFieldLabel} ${$t.error}`,children:t("tasks.detail.resumeBlocked")}),l.jsx("div",{className:$t.error,children:e.resumeBlockedReason})]}),e.error&&l.jsxs("div",{className:$t.detailField,children:[l.jsx("div",{className:`${$t.detailFieldLabel} ${e.kind==="monitor"&&e.status!=="failed"?$t.warning:$t.error}`,children:e.kind==="monitor"&&e.status!=="failed"?t("tasks.detail.stoppedBecause"):t("tasks.detail.error")}),l.jsx("div",{className:e.kind==="monitor"&&e.status!=="failed"?$t.warning:$t.error,children:e.error})]})]})}function g0({label:e,value:t}){return l.jsxs("div",{className:$t.detailField,children:[l.jsx("div",{className:$t.detailFieldLabel,children:e}),l.jsx("div",{className:$t.detailContent,children:t})]})}const uqe="_message_fm8gc_1",dqe="_body_fm8gc_15",hqe="_title_fm8gc_20",fqe="_muted_fm8gc_24",mqe="_accent_fm8gc_28",pqe="_success_fm8gc_32",gqe="_error_fm8gc_36",bqe="_warning_fm8gc_40",yqe="_row_fm8gc_44",xqe="_label_fm8gc_50",vqe="_value_fm8gc_55",Ia={message:uqe,body:dqe,title:hqe,muted:fqe,accent:mqe,success:pqe,error:gqe,warning:bqe,row:yqe,label:xqe,value:vqe},$A="web-shell-goal-status-active",{serialize:PF,parse:wqe}=iC(Zhe),kqe=new Set(["set","achieved","cleared","failed","aborted","checking"]);function XS(e){const t=typeof e=="string"?wqe(e):e;return _qe(t)}function _qe(e){if(!e||typeof e!="object")return null;const t=e,n=t.kind,s=t.condition;if(typeof n!="string"||!kqe.has(n)||typeof s!="string")return null;const r=N6(t.iterations),i=N6(t.durationMs),o=N6(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 N6(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function Sqe(e,t){return t(e===1?"goal.turn":"goal.turns",{count:e})}function Cqe(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:Ia.muted};case"set":return{title:t("goal.set"),colorClass:Ia.accent};case"achieved":return{title:t("goal.achieved"),colorClass:Ia.success};case"cleared":return{title:t("goal.cleared"),colorClass:Ia.muted};case"failed":return{title:t("goal.failed"),colorClass:Ia.error};case"aborted":return{title:t("goal.aborted"),colorClass:Ia.warning}}}function Tqe({status:e,activateFooter:t=!1}){var u;const{t:n}=ut(),s=$N();f.useEffect(()=>{if(!t||s==="readonly")return;const d=e.kind==="set"||e.kind==="checking";window.dispatchEvent(new CustomEvent($A,{detail:{active:d,condition:e.condition,setAt:e.setAt}}))},[t,s,e.condition,e.kind,e.setAt]);const r=Cqe(e,n),i=[];e.kind!=="checking"&&(e.iterations&&e.iterations>0&&i.push(Sqe(e.iterations,n)),typeof e.durationMs=="number"&&i.push(YS(e.durationMs)));const o=i.length>0?` · ${i.join(" · ")}`:"",a=(e.kind==="checking"||e.kind==="achieved"||e.kind==="failed"||e.kind==="aborted")&&((u=e.lastReason)==null?void 0:u.trim()),c=e.kind==="checking"?n("goal.judge"):n("goal.lastCheck");return l.jsx("div",{className:Ia.message,children:l.jsxs("div",{className:Ia.body,children:[l.jsxs("div",{className:`${Ia.title} ${r.colorClass}`,children:[r.title,o&&l.jsx("span",{className:Ia.muted,children:o})]}),l.jsxs("div",{className:Ia.row,children:[l.jsxs("span",{className:Ia.label,children:[n("goal.label"),":"]}),l.jsx("span",{className:Ia.value,children:e.condition})]}),a&&l.jsxs("div",{className:Ia.muted,children:[c,": ",a]})]})})}const Eqe="_message_u8kmd_1",Aqe="_flushMessage_u8kmd_12",Nqe="_noMarker_u8kmd_26",jqe="_content_u8kmd_30",Mqe="_info_u8kmd_49",Iqe="_recap_u8kmd_54",Rqe="_modelSwitch_u8kmd_67",Dqe="_error_u8kmd_71",Lqe="_warning_u8kmd_77",Pqe="_retryHint_u8kmd_83",Oqe="_retryButton_u8kmd_90",Bqe="_cancelled_u8kmd_108",Ta={message:Eqe,flushMessage:Aqe,noMarker:Nqe,content:jqe,info:Mqe,recap:Iqe,modelSwitch:Rqe,error:Dqe,warning:Lqe,retryHint:Pqe,retryButton:Oqe,cancelled:Bqe},$qe=f.memo(function({content:t,variant:n,source:s,data:r,onShowContextDetail:i,isLatest:o=!1,showRetryHint:a=!1,onRetryClick:c}){const{t:u}=ut();if(s==="prompt_cancelled")return l.jsx("div",{className:Ta.cancelled,role:"status",children:l.jsx("span",{children:u("turn.stopped")})});const d=n==="info"?c$e(t):null;if(d)return l.jsx("div",{className:Ta.flushMessage,children:l.jsx(g$e,{status:d,onShowDetail:i})});const h=n==="info"?Q$e(t):null;if(h)return l.jsx("div",{className:Ta.flushMessage,children:l.jsx(ize,{view:h.view,status:h.status})});const m=n==="info"?mze(t):null;if(m)return l.jsx("div",{className:Ta.flushMessage,children:l.jsx(pze,{info:m})});const p=n==="info"?Jze(t):null;if(p)return l.jsx("div",{className:Ta.flushMessage,children:l.jsx(iFe,{message:p})});const g=n==="info"?tqe(t):null;if(g)return l.jsx("div",{className:Ta.flushMessage,children:l.jsx(Ore,{message:g})});const b=n==="info"?XS(s==="goal"?r:t):null;if(b)return l.jsx("div",{className:Ta.flushMessage,children:l.jsx(Tqe,{status:b,activateFooter:o})});const v=n==="info"&&s==="model_switch_summary",x=n==="info"&&s==="recap";return l.jsx("div",{className:`${Ta.message} ${Ta[n]} ${v?Ta.modelSwitch:""} ${x?Ta.recap:""}`,children:l.jsxs("div",{className:Ta.content,children:[v?l.jsx("pre",{children:t}):n==="info"?l.jsx(gp,{content:t}):l.jsx("pre",{children:t}),a&&c&&l.jsx("div",{className:Ta.retryHint,children:l.jsx("button",{type:"button",className:Ta.retryButton,onClick:c,children:u("retry.hint")})})]})})}),zqe="_group_1lo6j_1",Fqe="_chatSummaryGroup_1lo6j_14",qqe="_line_1lo6j_22",Hqe="_chatSummary_1lo6j_14",Uqe="_chatSummaryTextActive_1lo6j_49",Vqe="_chatSummaryIcon_1lo6j_55",Wqe="_chatSummaryToolIcon_1lo6j_69",Gqe="_chatSummaryText_1lo6j_49",Kqe="_chatSummaryInline_1lo6j_85",Yqe="_chatChevronRight_1lo6j_122",Xqe="_chatChevronDown_1lo6j_123",Qqe="_chatSummaryContentClip_1lo6j_184",Jqe="_chatSummaryContentCollapsed_1lo6j_192",Zqe="_chatSummaryContentInner_1lo6j_196",eHe="_lineMain_1lo6j_201",tHe="_icon_1lo6j_211",nHe="_iconError_1lo6j_216",sHe="_lineName_1lo6j_221",rHe="_lineArg_1lo6j_225",iHe="_lineElapsed_1lo6j_233",oHe="_lineExpandable_1lo6j_239",aHe="_lineChevronRight_1lo6j_259",lHe="_lineChevronDown_1lo6j_260",cHe="_lineOutput_1lo6j_297",uHe="_expandedCard_1lo6j_306",dHe="_expandedCardHeader_1lo6j_316",hHe="_expandedCardTitle_1lo6j_325",fHe="_expandedCardDetail_1lo6j_332",mHe="_expandedCardBody_1lo6j_342",pHe="_expandedAgentCard_1lo6j_347",gHe="_expandedLineOutput_1lo6j_357",bHe="_lineDetail_1lo6j_361",yHe="_markdownLineDetail_1lo6j_367",xHe="_expandedBash_1lo6j_375",vHe="_expandedRead_1lo6j_376",wHe="_expandedOutput_1lo6j_380",kHe="_expandedEdit_1lo6j_394",_He="_todoProgress_1lo6j_408",SHe="_todoBody_1lo6j_415",CHe="_compactGroup_1lo6j_423",THe="_compactHeader_1lo6j_430",EHe="_compactCount_1lo6j_440",AHe="_compactHint_1lo6j_446",Gt={group:zqe,chatSummaryGroup:Fqe,line:qqe,chatSummary:Hqe,chatSummaryTextActive:Uqe,chatSummaryIcon:Vqe,chatSummaryToolIcon:Wqe,chatSummaryText:Gqe,chatSummaryInline:Kqe,chatChevronRight:Yqe,chatChevronDown:Xqe,chatSummaryContentClip:Qqe,chatSummaryContentCollapsed:Jqe,chatSummaryContentInner:Zqe,lineMain:eHe,icon:tHe,iconError:nHe,lineName:sHe,lineArg:rHe,lineElapsed:iHe,lineExpandable:oHe,lineChevronRight:aHe,lineChevronDown:lHe,lineOutput:cHe,expandedCard:uHe,expandedCardHeader:dHe,expandedCardTitle:hHe,expandedCardDetail:fHe,expandedCardBody:mHe,expandedAgentCard:pHe,expandedLineOutput:gHe,lineDetail:bHe,markdownLineDetail:yHe,expandedBash:xHe,expandedRead:vHe,expandedOutput:wHe,expandedEdit:kHe,todoProgress:_He,todoBody:SHe,compactGroup:CHe,compactHeader:THe,compactCount:EHe,compactHint:AHe};function Ff({status:e}){const{t}=ut();switch(e){case"completed":case"success":return null;case"failed":case"error":case"cancelled":case"canceled":return l.jsx("span",{className:`${Gt.icon} ${Gt.iconError}`,children:t("tool.status.failed")});case"in_progress":case"running":return null;default:return null}}function Fv(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 Bre(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 $re(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 NHe="_panel_rcjxd_1",jHe="_header_rcjxd_11",MHe="_desc_rcjxd_23",IHe="_toggle_rcjxd_32",RHe="_meta_rcjxd_38",DHe="_body_rcjxd_44",LHe="_content_rcjxd_55",PHe="_stream_rcjxd_70",OHe="_streamCollapsed_rcjxd_80",BHe="_scrollWindow_rcjxd_88",$He="_expandToggle_rcjxd_93",zHe="_sectionCap_rcjxd_110",FHe="_tools_rcjxd_128",qHe="_step_rcjxd_142",HHe="_toolTimeRow_rcjxd_188",UHe="_toolTimeTip_rcjxd_192",ii={panel:NHe,header:jHe,desc:MHe,toggle:IHe,meta:RHe,body:DHe,content:LHe,stream:PHe,streamCollapsed:OHe,scrollWindow:BHe,expandToggle:$He,sectionCap:zHe,tools:FHe,step:qHe,toolTimeRow:HHe,toolTimeTip:UHe};function zre(e){return!!e&&typeof e=="object"&&e.type==="task_execution"}function VHe({timestamp:e,children:t}){return e===void 0?l.jsx(l.Fragment,{children:t}):l.jsxs("div",{className:ii.toolTimeRow,children:[t,l.jsx("span",{className:ii.toolTimeTip,"aria-hidden":"true",children:Og(e)})]})}const WHe=f.memo(function({tool:t}){const n=t.subTools||t.subContent?l.jsx(xI,{tool:t}):l.jsx(qA,{tool:t,forceExpandable:!0,hideCollapsedOutput:!0});return l.jsx(VHe,{timestamp:t.startTime,children:n})});function GHe({tc:e}){const{t}=ut();return l.jsx("div",{className:Gt.line,children:l.jsxs("div",{className:Gt.lineMain,children:[l.jsx(Ff,{status:e.status}),l.jsx("span",{className:Gt.lineName,children:Ec(e.name,t)})]})})}function KHe(e){var t;if(e.rawOutput&&zre(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 YHe({text:e}){const{compactThinking:t}=Lu(),{t:n}=ut(),[s,r]=f.useState(!1),[i,o]=f.useState(!1),a=f.useRef(null),c=t&&!s;return f.useEffect(()=>{const u=a.current;!u||!c||(o(u.scrollHeight>u.clientHeight),u.scrollTop=u.scrollHeight)},[c,e]),f.useEffect(()=>{const u=a.current;if(!u||!c)return;const d=()=>o(u.scrollHeight>u.clientHeight),h=new ResizeObserver(d);return h.observe(u),()=>h.disconnect()},[c]),l.jsxs("div",{children:[l.jsx("pre",{ref:a,className:c?`${ii.stream} ${ii.streamCollapsed}`:ii.stream,children:e}),t&&(i||s)&&l.jsx("button",{className:ii.expandToggle,onClick:()=>r(u=>!u),"aria-expanded":s,"aria-label":n("subagent.toggleStream"),children:s?"▲":"▼"})]})}function XHe({content:e}){const{compactThinking:t}=Lu();return l.jsx("div",{className:t?ii.scrollWindow:void 0,children:l.jsx(gp,{content:e,source:"assistant"})})}function OF({pinTail:e,itemCount:t,children:n}){const s=f.useRef(null);return f.useEffect(()=>{const r=s.current;r&&(r.scrollTop=e?r.scrollHeight:0)},[e,t]),l.jsx("div",{ref:s,className:`${ii.tools} ${ii.scrollWindow}`,children:n})}function xI({tool:e,defaultExpanded:t,hideHeader:n,inline:s}){var T,S,C,_;const{t:r}=ut(),i=e.status==="completed"||e.status==="failed",o=Qx(e),[a,c]=f.useState(t??!1),u=zre(e.rawOutput)?e.rawOutput:null,d=((T=e.subTools)==null?void 0:T.length)||((S=u==null?void 0:u.toolCalls)==null?void 0:S.length)||0,h=yI(e),m=bI(e),p=Fv(e.startTime,e.endTime)||Bre((C=u==null?void 0:u.executionSummary)==null?void 0:C.totalDurationMs),g=u!=null&&u.tokenCount&&u.tokenCount>0?u.tokenCount:(_=u==null?void 0:u.executionSummary)==null?void 0:_.outputTokens,b=g?gI(g):"",v=i?KHe(e):"",x=f.useMemo(()=>e.subTools&&e.subTools.length>0?null:(u==null?void 0:u.toolCalls)||null,[e.subTools,u]),y=!!(e.subContent||v),w=!!(e.subTools&&e.subTools.length>0||x&&x.length>0),k=i&&y&&w;return l.jsxs("div",{className:s?void 0:ii.panel,children:[!n&&l.jsxs("div",{className:ii.header,onClick:()=>c(!a),children:[l.jsx(Ff,{status:o}),l.jsxs("span",{className:Gt.lineName,children:[m,":"]}),h&&l.jsx("span",{className:ii.desc,children:Gi(h,50)}),i&&d>0&&l.jsxs("span",{className:ii.meta,children:["· ",r("subagent.toolsCount",{count:d})]}),p&&l.jsxs("span",{className:ii.meta,children:["· ",p]}),b&&l.jsxs("span",{className:ii.meta,children:["· ",b]}),!i&&l.jsx("span",{className:ii.toggle,children:a?"▼":"▶"})]}),(a||n)&&l.jsxs("div",{className:ii.body,children:[i&&y&&l.jsxs("div",{className:ii.content,children:[k&&l.jsx("div",{className:ii.sectionCap,children:r("subagent.result")}),l.jsx(XHe,{content:e.subContent||v})]}),k&&l.jsx("div",{className:ii.sectionCap,children:r("subagent.tools",{count:d})}),e.subTools&&e.subTools.length>0&&l.jsx(OF,{pinTail:!i,itemCount:e.subTools.length,children:e.subTools.map(B=>l.jsx("div",{className:ii.step,"data-status":B.status,children:l.jsx(WHe,{tool:B})},B.callId))}),x&&x.length>0&&l.jsx(OF,{pinTail:!i,itemCount:x.length,children:x.map(B=>l.jsx("div",{className:ii.step,"data-status":B.status,children:l.jsx(GHe,{tc:B})},B.callId))}),!i&&e.subContent&&l.jsx("div",{className:ii.content,children:l.jsx(YHe,{text:e.subContent})})]})]})}const QHe="_view_1ycry_1",JHe="_stats_1ycry_7",ZHe="_statAdd_1ycry_16",eUe="_statDel_1ycry_20",tUe="_lines_1ycry_24",nUe="_line_1ycry_24",sUe="_lineAdd_1ycry_36",rUe="_lineDel_1ycry_40",iUe="_lineHeader_1ycry_44",oUe="_lineContext_1ycry_50",aUe="_lineNo_1ycry_54",lUe="_marker_1ycry_64",cUe="_content_1ycry_79",eu={view:QHe,stats:JHe,statAdd:ZHe,statDel:eUe,lines:tUe,line:nUe,lineAdd:sUe,lineDel:rUe,lineHeader:iUe,lineContext:oUe,lineNo:aUe,marker:lUe,content:cUe};function uUe(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 dUe=f.memo(function({diff:t}){if(!t)return null;const{lines:n,additions:s,deletions:r}=uUe(t);return l.jsxs("div",{className:eu.view,children:[l.jsxs("div",{className:eu.stats,children:[s>0&&l.jsxs("span",{className:eu.statAdd,children:["+",s]}),r>0&&l.jsxs("span",{className:eu.statDel,children:["-",r]})]}),l.jsx("div",{className:eu.lines,children:n.map((i,o)=>l.jsxs("div",{className:`${eu.line} ${eu[`line${i.type[0].toUpperCase()}${i.type.slice(1)}`]}`,children:[l.jsx("span",{className:eu.lineNo,children:i.type==="header"?"":i.oldLine??i.newLine}),l.jsx("span",{className:eu.marker,children:i.type==="add"?"+":i.type==="del"?"-":i.type==="header"?"":" "}),l.jsx("span",{className:eu.content,children:i.content})]},o))})]})}),BF={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 hUe(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 c=a[1].split(";").map(Number);for(const u of c)u===0?(n=void 0,s=!1,r=!1):u===1?s=!0:u===2?r=!0:u===22?(s=!1,r=!1):u>=30&&u<=37||u>=90&&u<=97?n=BF[u]:u===39&&(n=void 0)}return i<e.length&&t.push({text:e.slice(i),color:n,bold:s,dim:r}),t}function fUe(e){return new RegExp(String.raw`\x1b\[`).test(e)}function sh(e){const t=e.toLowerCase();return t==="todo_write"||t==="todowrite"}function j6(e){const t=e.flatMap((n,s)=>{const r=JS(n),i=Hk(r,"content");return i?[{id:Hk(r,"id")??`plan-${s}`,content:i,status:CUe(Hk(r,"status")),priority:TUe(Hk(r,"priority"))}]:[]});return t.length>0?t:void 0}function vI(e){if(!sh(e.toolName)&&e.kind!=="other")return;const t=zF(e.args);if(t)return j6(t);const n=JS(e.rawOutput),s=zF(n);if(s)return j6(s);const r=Array.isArray(n==null?void 0:n.entries)?n.entries:void 0;return r?j6(r):void 0}function mUe(e){return e.some(t=>t.status==="pending"||t.status==="in_progress")}function QS(e){switch(e){case"completed":return"●";case"in_progress":return"◐";case"pending":return"○"}}const $F={todos:[],allCompleted:!1,sourceMessageId:null,sourceCallId:null};function pUe(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 c=vI(a);c&&(t=c,n=o.id,s=a.callId,r=!1)}}if(t.length===0)return $F;const i=!mUe(t);return r?$F:{todos:t,allCompleted:i,sourceMessageId:n,sourceCallId:s}}function wI(e){return JSON.stringify([e.id,e.content])}function oC(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=vI(n);s&&t.push({key:n.callId,todos:s,stats:xUe(n)})}return t}return[]}function gUe(e){const t=new Map,n=new Map;for(const s of e)for(const{key:r,todos:i}of oC(s)){const o=[];for(const a of i){const c=wI(a),u=n.get(c);a.status==="in_progress"&&u!=="in_progress"?o.push({kind:"started",id:a.id,content:a.content}):a.status==="completed"&&u!=="completed"&&u!==void 0&&o.push({kind:"completed",id:a.id,content:a.content}),n.set(c,a.status)}t.set(r,{events:o})}return t}function bUe(e){const t=[];for(const n of e)for(const{key:s,todos:r}of oC(n))t.push(JSON.stringify([s,r.map(i=>[i.id,i.status,i.content])]));return t.join(`
`)}function yUe(e){const t=[];for(const n of e){if(n.role==="tool_group")for(const s of n.tools)!sh(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 oC(n))t.push(JSON.stringify([s,n.timestamp,r.map(o=>[o.id,o.status,o.content]),i]))}return t.join(`
`)}function xUe(e){var o;const t=JS((o=JS(e.rawOutput))==null?void 0:o.stats);if(!t)return;const n=a=>{const c=t[a];return typeof c=="number"&&Number.isFinite(c)?c: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 vUe(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const s of n.tools){if(sh(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 wUe(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 kUe(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 _Ue(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 SUe(e){var a;const t=new Map,n=new Map,s=new Map,r=new Set,i=vUe(e),o=c=>{let u=t.get(c);return u||(u={},t.set(c,u)),u};for(const c of e){const u=c.timestamp;for(const{todos:d,stats:h}of oC(c))for(const m of d){const p=wI(m),g=n.get(p);if(m.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),u!==void 0&&(o(p).startTs=u));else if(m.status==="completed"&&g!=="completed"&&g!==void 0){const b=s.get(p),v=b&&h?kUe(b,h):void 0,x=(a=t.get(p))==null?void 0:a.startTs,y=x!==void 0&&u!==void 0?wUe(i,x,u):void 0,w=_Ue(v,y);if(u!==void 0||w){const k=o(p);u!==void 0&&(k.endTs=u),w&&(k.resources=w)}}m.status==="completed"&&r.add(p),n.set(p,m.status)}}return t}function zF(e){const t=e==null?void 0:e.todos;return Array.isArray(t)?t:void 0}function CUe(e){return e==="completed"||e==="in_progress"||e==="pending"?e:"pending"}function TUe(e){return e==="high"||e==="medium"||e==="low"?e:void 0}function JS(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function Hk(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}const X2=new Set;let Bb=null,Fre=Date.now();function EUe(){Fre=Date.now();for(const e of X2)e()}function AUe(e){return X2.add(e),Bb||(Bb=setInterval(EUe,1e3)),()=>{X2.delete(e),X2.size===0&&Bb&&(clearInterval(Bb),Bb=null)}}function kI(e){const[t,n]=f.useState(()=>Date.now());return f.useEffect(()=>{if(e)return n(Date.now()),AUe(()=>n(Fre))},[e]),t}const NUe="_list_1bo8s_1",jUe="_summary_1bo8s_2",MUe="_row_1bo8s_8",IUe="_num_1bo8s_16",RUe="_icon_1bo8s_23",DUe="_text_1bo8s_29",LUe="_inProgress_1bo8s_43",PUe="_completed_1bo8s_48",OUe="_item_1bo8s_62",BUe="_rowButton_1bo8s_69",$Ue="_detailChevron_1bo8s_82",zUe="_detail_1bo8s_82",FUe="_detailSection_1bo8s_100",qUe="_detailSectionTitle_1bo8s_106",HUe="_detailRows_1bo8s_114",UUe="_detailLabel_1bo8s_122",VUe="_detailValue_1bo8s_126",WUe="_detailDuration_1bo8s_132",GUe="_detailHint_1bo8s_136",Ys={list:NUe,summary:jUe,row:MUe,num:IUe,icon:RUe,text:DUe,inProgress:LUe,completed:PUe,item:OUe,rowButton:BUe,detailChevron:$Ue,detail:zUe,detailSection:FUe,detailSectionTitle:qUe,detailRows:HUe,detailLabel:UUe,detailValue:VUe,detailDuration:WUe,detailHint:GUe};function zA(e){switch(e){case"completed":return Ys.completed;case"in_progress":return Ys.inProgress;case"pending":return""}}function qre({todos:e,events:t}){const{t:n}=ut();if(t.length===0){if(e.length>0&&e.every(i=>i.status==="completed"))return l.jsx("div",{className:Ys.summary,children:l.jsxs("div",{className:`${Ys.row} ${Ys.completed}`,children:[l.jsx("span",{className:Ys.icon,"aria-hidden":"true",children:"✓"}),l.jsx("span",{className:Ys.text,children:n("todo.allDone")})]})});const r=e.find(i=>i.status==="in_progress")??e.find(i=>i.status==="pending");return r?l.jsx("div",{className:Ys.summary,children:l.jsxs("div",{className:`${Ys.row} ${zA(r.status)}`,children:[l.jsx("span",{className:Ys.icon,"aria-hidden":"true",children:QS(r.status)}),l.jsx("span",{className:Ys.text,children:r.content})]})}):null}return l.jsx("div",{className:Ys.summary,children:t.map(s=>l.jsxs("div",{className:`${Ys.row} ${s.kind==="completed"?Ys.completed:Ys.inProgress}`,children:[l.jsx("span",{className:Ys.icon,"aria-hidden":"true",children:QS(s.kind==="completed"?"completed":"in_progress")}),l.jsx("span",{className:Ys.text,children:s.content})]},`${s.kind}-${s.id}`))})}function Sm({label:e,value:t,suffix:n}){return l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Ys.detailLabel,children:e}),l.jsxs("span",{className:Ys.detailValue,children:[t,n]})]})}function M6({title:e,children:t}){return l.jsxs("div",{className:Ys.detailSection,children:[l.jsx("div",{className:Ys.detailSectionTitle,children:e}),l.jsx("div",{className:Ys.detailRows,children:t})]})}function KUe({detail:e}){const{t}=ut(),{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 l.jsxs("div",{className:Ys.detail,children:[i&&l.jsxs(M6,{title:t("todo.detail.sectionTime"),children:[n!==void 0&&l.jsx(Sm,{label:t("todo.detail.start"),value:Og(n)}),s!==void 0&&l.jsx(Sm,{label:t("todo.detail.end"),value:Og(s),suffix:n!==void 0?l.jsxs("span",{className:Ys.detailDuration,children:[" ","(",ff(s-n),")"]}):void 0})]}),o&&l.jsxs(M6,{title:t("todo.detail.sectionTokens"),children:[l.jsx(Sm,{label:t("todo.detail.input"),value:((r==null?void 0:r.inputTokens)??0).toLocaleString()}),l.jsx(Sm,{label:t("todo.detail.output"),value:((r==null?void 0:r.outputTokens)??0).toLocaleString()}),l.jsx(Sm,{label:t("todo.detail.cached"),value:((r==null?void 0:r.cachedTokens)??0).toLocaleString()})]}),a&&l.jsxs(M6,{title:t("todo.detail.sectionSpent"),children:[(r==null?void 0:r.apiTimeMs)!==void 0&&l.jsx(Sm,{label:t("todo.detail.api"),value:ff(r.apiTimeMs)}),(r==null?void 0:r.toolTimeMs)!==void 0&&l.jsx(Sm,{label:t("todo.detail.tool"),value:ff(r.toolTimeMs)})]}),!r&&l.jsx("div",{className:Ys.detailHint,children:t("todo.detail.noResources")})]})}function YUe(e){return!!e&&(e.endTs!==void 0||e.resources!==void 0)}function Hre({todos:e,numbered:t=!1}){const{t:n}=ut(),s=f.useContext($oe),[r,i]=f.useState(()=>new Set),o=`${String(e.length).length+1}ch`,a=c=>i(u=>{const d=new Set(u);return d.has(c)?d.delete(c):d.add(c),d});return l.jsx("div",{className:Ys.list,children:e.map((c,u)=>{const d=c.id||String(u),h=s.get(wI(c)),m=YUe(h),p=m&&r.has(d),g=l.jsxs(l.Fragment,{children:[t&&l.jsxs("span",{className:Ys.num,style:{minWidth:o},children:[u+1,"."]}),l.jsx("span",{className:Ys.icon,"aria-hidden":"true",children:QS(c.status)}),l.jsx("span",{className:Ys.text,children:c.content}),m&&l.jsx("span",{className:Ys.detailChevron,"aria-hidden":"true",children:p?"▾":"▸"})]});return l.jsxs("div",{className:Ys.item,children:[m?l.jsx("button",{type:"button",className:`${Ys.row} ${Ys.rowButton} ${zA(c.status)}`,onClick:b=>{b.stopPropagation(),a(d)},"aria-expanded":p,title:n(p?"todo.detail.hide":"todo.detail.show"),children:g}):l.jsx("div",{className:`${Ys.row} ${zA(c.status)}`,children:g}),p&&h&&l.jsx(KUe,{detail:h})]},d)})})}function XUe(e){const t=e.toolName.toLowerCase();if(Rc(e.toolName))return!!Cu(e);if(t==="write_file"||t==="writefile")return!!hVe(e)||FF(e);if(e.status!=="completed"&&e.status!=="failed")return!1;if(fl(t)){const n=Cu(e);return!!n&&n.trim().length>0&&n.split(`
`).length>1}if(rC(t))return!!Wre(e);if(t==="edit"||t==="write"||t==="editfile")return FF(e);if(t==="read"||t==="read_file"||t==="readfile"){const n=Cu(e);return!!n&&n.split(`
`).length>3}return!1}function QUe(e){const t=e.toolName.toLowerCase();return fl(t)||t==="write_file"||t==="writefile"||t==="edit"||t==="write"||t==="editfile"||t==="read"||t==="read_file"||t==="readfile"||rC(t)||Rc(e.toolName)}function JUe(e){var t;return(t=e.content)!=null&&t.some(n=>n.type==="diff")?!0:!!Ure(e)}function FF(e){return JUe(e)||!!Cu(e)}function ZUe(e){const t=Ure(e);if(t)return t;if(e.content){const n=e.content.find(s=>s.type==="diff");if(n&&n.type==="diff")return nVe(n.oldText||"",n.newText||"")}return""}function Ure(e){if(e.rawOutput&&typeof e.rawOutput=="object"){const t=e.rawOutput;if(eVe(t))return"";if(typeof t.fileDiff=="string")return t.fileDiff}return""}function eVe(e){return e.truncatedForSession===!0&&"fileName"in e&&"newContent"in e}const tVe=25e4;function nVe(e,t){const n=e.split(`
`),s=t.split(`
`),r=n.length,i=s.length;if(r*i>tVe){const d=n.map(m=>m?`-${m}`:"-"),h=s.map(m=>m?`+${m}`:"+");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 c=r,u=i;for(;c>0||u>0;)c>0&&u>0&&n[c-1]===s[u-1]?(a.push(` ${n[c-1]}`),c--,u--):u>0&&(c===0||o[c][u-1]>=o[c-1][u])?(a.push(`+${s[u-1]}`),u--):(a.push(`-${n[c-1]}`),c--);return a.reverse().join(`
`)}const sVe=60,rVe=2e5,iVe=1e3,oVe={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 aVe({tool:e}){const t=f.useMemo(()=>Cu(e)||"",[e]),n=f.useMemo(()=>fUe(t)?hUe(t):null,[t]);return l.jsx("div",{className:Gt.expandedBash,children:l.jsx("pre",{className:Gt.expandedOutput,children:n?n.map((s,r)=>l.jsx("span",{style:{color:s.color,fontWeight:s.bold?"bold":void 0,opacity:s.dim?.6:void 0},children:s.text},r)):t})})}function lVe({tool:e}){const t=f.useMemo(()=>Cu(e)||"",[e]),n=Vre(cVe(e)),s=n==="text"||t.length>rVe||uVe(t,iVe);return l.jsx("div",{className:Gt.expandedRead,children:s?l.jsx("pre",{className:Gt.expandedOutput,children:t}):l.jsx(gp,{content:dVe(n,t)})})}function cVe(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 uVe(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 Vre(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=oVe[t]??t;return/^[\w+.#-]+$/.test(n)?n:"text"}function dVe(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 qF({tool:e}){const t=f.useMemo(()=>ZUe(e),[e]),n=f.useMemo(()=>Cu(e)||"",[e]);return!t&&!n?null:l.jsx("div",{className:Gt.expandedEdit,children:t?l.jsx(dUe,{diff:t}):l.jsx("pre",{className:Gt.expandedOutput,children:n})})}function FA({title:e,detail:t,children:n}){return l.jsxs("div",{className:Gt.expandedCard,children:[l.jsxs("div",{className:Gt.expandedCardHeader,children:[l.jsx("span",{className:Gt.expandedCardTitle,children:e}),t&&l.jsx("span",{className:Gt.expandedCardDetail,children:t})]}),n&&l.jsx("div",{className:Gt.expandedCardBody,children:n})]})}function hVe(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=Cu(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 fVe({tool:e,todos:t,expanded:n,title:s}){var o;const i=((o=f.useContext($I).get(e.callId))==null?void 0:o.events)??[];return n?l.jsx(FA,{title:s,children:l.jsx("div",{className:Gt.todoBody,children:l.jsx(Hre,{todos:t})})}):l.jsx("div",{className:Gt.todoBody,children:l.jsx(qre,{todos:t,events:i})})}function mVe(e,t){var p,g;const n=zv(e.rawOutput),s=pI(e),r=Qx(e),i=bI(e),o=pVe(e),a=yI(e),c=((p=e.subTools)==null?void 0:p.length)||((g=n==null?void 0:n.toolCalls)==null?void 0:g.length)||0,u=n==null?void 0:n.executionSummary,d=u&&typeof u.totalDurationMs=="number"?Bre(u.totalDurationMs):Fv(e.startTime,e.endTime??(e.status==="in_progress"&&t?t:void 0)),h=n&&typeof n.tokenCount=="number"&&n.tokenCount>0?n.tokenCount:u&&typeof u.outputTokens=="number"&&u.outputTokens>0?u.outputTokens:0,m=h>0?gI(h):"";return{agentType:i,explicitAgentType:o,description:a,subToolCount:c,elapsed:d,tokens:m,status:r,reason:s}}function pVe(e){var r;const t=zv(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 HF(e){if(e.status==="completed")return!1;const t=e.toolName.toLowerCase();return!!(Rc(e.toolName)||t==="write_file"||t==="writefile"||t==="edit"||t==="editfile"||fl(t))}function gVe({tool:e}){const t=Cu(e)||"";return l.jsx("pre",{className:Gt.expandedOutput,children:t})}function bVe({tool:e}){var n;const t=Wre(e)||(typeof((n=e.args)==null?void 0:n.args)=="string"&&e.args.args.trim()?e.args.args.trim():e.title??"");return l.jsx("pre",{className:Gt.expandedOutput,children:t})}function Wre(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 aC(e){const t=e.toolName.toLowerCase();return L4(e)?"agent":Rc(e.toolName)?"ask":fl(t)?"shell":SI(t)?"fetch":sh(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 yVe({description:e,elapsed:t}){return l.jsxs(l.Fragment,{children:[e&&l.jsx("span",{className:Gt.lineArg,children:e}),t&&l.jsx("span",{className:Gt.lineElapsed,children:t})]})}function ZS({info:e}){const{renderToolHeaderExtra:t}=Lu(),n=t==null?void 0:t(e);return n?l.jsx(l.Fragment,{children:n}):l.jsx(yVe,{description:e.description,elapsed:e.elapsed})}function xVe(e){return e.length>sVe||e.includes(`
`)}function lC(e){return e==="in_progress"||e==="pending"||e==="running"}function _I(e){return e.find(t=>lC(t.status))??e[e.length-1]}function vVe(e,t,n){if(Yre(e)){const r=_I(e);return Rc(r.toolName)?t("toolGroup.summary.provideInformation"):t("toolGroup.running",{name:Ec(r.toolName,t),count:e.length,duration:n??""})}const s=_Ve(e,t);return s||t("toolGroup.summary",{count:e.length})}function wVe(e,t,n){if(sh(e.toolName))return t("toolGroup.summary.updatedTodos",{count:1});if(Rc(e.toolName))return lC(e.status)?t("toolGroup.summary.provideInformation"):t("toolGroup.summary.askedQuestions",{count:Kre(e)});const{displayName:s,description:r,hideDisplayName:i}=Gre(e,t,n);return[i?"":s,r].filter(Boolean).join(" ")}function Gre(e,t,n){const s=Ec(e.toolName,t),r=Gi(Nre(e,n),120);return{kind:aC(e),tool:e,displayName:s,description:r,elapsed:"",workspaceCwd:n,hideDisplayName:!!x$e(e)}}function kVe({tool:e,runningDuration:t,workspaceCwd:n}){const{t:s}=ut(),r=Rc(e.toolName),i=!r&&lC(e.status)&&s("toolGroup.runningPrefix").trim();if(sh(e.toolName)||r)return l.jsxs(l.Fragment,{children:[i&&l.jsxs("span",{children:[i," "]}),wVe(e,s,n),t&&l.jsxs("span",{children:[" ",t]})]});const o=Gre(e,s,n);return l.jsxs(l.Fragment,{children:[i&&l.jsxs("span",{children:[i," "]}),l.jsxs("span",{className:Gt.chatSummaryInline,children:[!o.hideDisplayName&&l.jsx("span",{className:Gt.lineName,children:o.displayName}),l.jsx(ZS,{info:o})]}),t&&l.jsxs("span",{children:[" ",t]})]})}function _Ve(e,t){let n=0,s=0,r=0,i=0,o=0,a=0,c=0;for(const d of e){const h=d.toolName.toLowerCase();fl(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++:sh(h)?o++:Rc(h)?a+=Kre(d):c++}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.askedQuestions",{count:a}):"",c?t("toolGroup.summary.otherTools",{count:c}):""].filter(Boolean).join(" ")}function Kre(e){var n;const t=(n=e.args)==null?void 0:n.questions;return Array.isArray(t)&&t.length>0?t.length:1}function Yre(e){return e.some(t=>lC(t.status))}function SVe(){return l.jsxs("svg",{className:Gt.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:[l.jsx("path",{d:"M12 20h9"}),l.jsx("path",{d:"M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"})]})}function Xre(){return l.jsxs("svg",{className:Gt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","data-testid":"chat-summary-tool-icon","aria-hidden":"true",children:[l.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2.4",stroke:"currentColor",strokeWidth:"1.2"}),l.jsx("path",{d:"M4.6 5.2 6 6.6 4.6 8",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M7.3 8.1h2.1",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round"})]})}function CVe(){return l.jsxs("svg",{className:Gt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[l.jsx("circle",{cx:"7",cy:"7",r:"5.5",stroke:"currentColor",strokeWidth:"1.25"}),l.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 TVe(){return l.jsxs("svg",{className:Gt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[l.jsx("rect",{x:"2",y:"1.6",width:"10",height:"10.8",rx:"2.2",stroke:"currentColor",strokeWidth:"1.25"}),l.jsx("path",{d:"M4.5 5.2h5M4.5 7h5M4.5 8.8h5",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round"})]})}function EVe(){return l.jsx("svg",{className:Gt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:l.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 AVe(){return l.jsx("svg",{className:Gt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:l.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 NVe(){return l.jsx("svg",{className:Gt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 1024 1024",fill:"currentColor","aria-hidden":"true",children:l.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 jVe({tool:e}){const t=aC(e);return t==="agent"?l.jsx(NVe,{}):t==="ask"?l.jsx(AVe,{}):t==="edit"||t==="write"?l.jsx(SVe,{}):t==="fetch"?l.jsx(CVe,{}):t==="read"?l.jsx(TVe,{}):t==="todo"?l.jsx(EVe,{}):l.jsx(Xre,{})}function SI(e){const t=e.toLowerCase();return t==="web_fetch"||t==="webfetch"||t==="fetch"}const MVe=Qx;function IVe({tools:e,workspaceCwd:t,isLocateFlashing:n=!1}){const{t:s}=ut(),r=_I(e),i=Ec(r.toolName,s),o=MVe(r),a=mI(r,t),c=fl(r.toolName)||SI(r.toolName)?"":Fv(r.startTime,r.endTime);return l.jsxs("div",{className:`${Gt.compactGroup}${n?` ${zf.flash}`:""}`,children:[l.jsxs("div",{className:Gt.compactHeader,children:[l.jsx(Ff,{status:o}),l.jsx("span",{className:Gt.lineName,children:i}),e.length>1&&l.jsxs("span",{className:Gt.compactCount,children:["× ",e.length]}),l.jsx(ZS,{info:{kind:aC(r),tool:r,displayName:i,description:a,elapsed:c,workspaceCwd:t}})]}),l.jsx("div",{className:Gt.compactHint,children:s("compact.hint")})]})}function RVe(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&&DVe(n.subTools,s.subTools)}function DVe(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 UF=/\[([^\]]+)\]\(qwen-session:\/\/([^)]+)\)/g;function I6(e,t){if(!e||!e.includes("qwen-session://"))return e;const n=[];let s=0,r;for(UF.lastIndex=0;(r=UF.exec(e))!==null;){r.index>s&&n.push(e.slice(s,r.index));const i=r[2];n.push(t==="readonly"?l.jsx("span",{style:{textDecoration:"underline"},children:r[1]},r.index):l.jsx("a",{href:"#",role:"button",style:{textDecoration:"underline",cursor:"pointer"},onClick:o=>{o.preventDefault(),o.stopPropagation(),window.dispatchEvent(new CustomEvent("qwen:open-session",{detail:i}))},children:r[1]},r.index)),s=r.index+r[0].length}return s<e.length&&n.push(e.slice(s)),n.length===1?n[0]:l.jsx(l.Fragment,{children:n})}const qA=f.memo(function({tool:t,approval:n,workspaceCwd:s,summaryOnly:r=!1,forceExpanded:i=!1,forceExpandable:o=!1,hideHeader:a=!1,hideCollapsedOutput:c=!1}){const{t:u}=ut(),d=$N(),h=f.useContext(Ep),[m,p]=f.useState(()=>i||!h&&HF(t)),g=f.useRef(!1);f.useEffect(()=>{p(i||(h?!1:HF(t))),g.current=!1},[h,i,t.callId,t.toolName]);const b=L4(t),v=n&&n.toolCallId===t.callId,x=!v&&(n==null?void 0:n.toolCallId)&&b&&Ac(t,n.toolCallId),y=b&&t.status==="in_progress",w=kI(y);if(f.useEffect(()=>{!i&&!b&&t.status==="completed"&&!g.current&&p(!1)},[i,b,t.status]),b){const X=mVe(t,w),J=X.explicitAgentType?`${u("agent.label")} (${X.explicitAgentType})`:u("agent.label"),de=t.status==="completed"||t.status==="failed",te=[t.status==="pending"?u("subagent.pending"):u("subagent.running"),X.elapsed].filter(Boolean).join(" · "),U=[X.subToolCount>0?u("subagent.toolsCount",{count:X.subToolCount}):"",X.elapsed,X.tokens,X.reason?Gi(X.reason,80):""].filter(Boolean).join(" · "),ee=i||m||!!v||!!x,oe=l.jsx(xI,{tool:t,hideHeader:!0,defaultExpanded:!0,inline:!0});return l.jsxs("div",{className:Gt.line,children:[!a&&l.jsxs("div",{className:`${Gt.lineMain} ${Gt.lineExpandable}`,onClick:()=>p(!m),children:[l.jsx(Ff,{status:de?X.status:t.status}),l.jsx("span",{className:Gt.lineName,children:J}),l.jsx(ZS,{info:{kind:"agent",tool:t,displayName:J,description:X.description?Gi(X.description,60):"",elapsed:de?U:te,workspaceCwd:s}}),l.jsx("span",{className:m?Gt.lineChevronDown:Gt.lineChevronRight,"aria-hidden":"true"})]}),ee&&l.jsx("div",{className:Gt.lineDetail,children:a?l.jsx("div",{className:Gt.expandedAgentCard,children:oe}):oe})]})}const k=mI(t,s),T=v$e(t),C=r&&fl(t.toolName)?Nre(t,s):k,_=Ec(t.toolName,u),B=fl(t.toolName)||SI(t.toolName)?"":Fv(t.startTime,t.endTime),A=t.toolName.toLowerCase(),N=sh(A),j=N?vI(t):void 0,P=!!j&&j.length>0,L=j?j.filter(X=>X.status==="completed").length:0,O=fl(A),$=A==="grep"||A==="grep_search"||A==="search"||A==="glob",z=A==="read"||A==="read_file"||A==="readfile",F=!N&&xVe(C),G=!i&&(o||(N?P:XUe(t)||F)),I=QUe(t),Q=m&&F,V=z,M=Q&&!O&&!$&&!z,re=k,se=!N&&m&&!I&&(Q||T);return l.jsxs("div",{className:Gt.line,children:[!a&&l.jsxs("div",{className:`${Gt.lineMain} ${G?Gt.lineExpandable:""}`,title:G?u(m?"tool.collapseHint":"tool.expand"):void 0,"aria-expanded":G?m:void 0,role:G?"button":void 0,tabIndex:G?0:void 0,onClick:G?()=>{g.current=!0,p(X=>!X)}:void 0,onKeyDown:G?X=>{X.key!=="Enter"&&X.key!==" "||(X.preventDefault(),g.current=!0,p(J=>!J))}:void 0,children:[l.jsx(Ff,{status:t.status}),l.jsx("span",{className:Gt.lineName,children:_}),N&&P&&l.jsxs("span",{className:Gt.todoProgress,children:[L,"/",j.length]}),l.jsx(ZS,{info:{kind:aC(t),tool:t,displayName:_,description:N||M?"":C,elapsed:N?"":B,workspaceCwd:s}}),G&&l.jsx("span",{className:m?Gt.lineChevronDown:Gt.lineChevronRight,"aria-hidden":"true"})]}),(!r||m)&&N&&P&&l.jsx(fVe,{tool:t,todos:j,expanded:m,title:_}),(!r||m)&&N&&!P&&T&&l.jsx("div",{className:Gt.lineOutput,children:I6(T,d)}),se&&l.jsx(FA,{title:_,detail:re,children:T&&l.jsx("div",{className:`${Gt.lineOutput} ${Gt.expandedLineOutput}`,children:I6(T,d)})}),!N&&!c&&T&&!se&&(!m||!I)&&(!r||m)&&l.jsx("div",{className:m?`${Gt.lineOutput} ${Gt.expandedLineOutput}`:Gt.lineOutput,children:I6(T,d)}),!N&&m&&I&&l.jsx("div",{className:V?`${Gt.lineDetail} ${Gt.markdownLineDetail}`:Gt.lineDetail,children:z?l.jsx(lVe,{tool:t}):l.jsxs(FA,{title:_,detail:re,children:[fl(A)&&l.jsx(aVe,{tool:t}),(A==="write_file"||A==="writefile")&&l.jsx(qF,{tool:t}),(A==="edit"||A==="write"||A==="editfile")&&l.jsx(qF,{tool:t}),Rc(t.toolName)&&l.jsx(gVe,{tool:t}),rC(A)&&l.jsx(bVe,{tool:t})]})})]})},RVe),LVe=f.memo(function({tools:t,pendingApproval:n,workspaceCwd:s,isLocateFlashing:r=!1}){const{t:i}=ut(),o=f.useContext(Ep),[a,c]=f.useState(!1),u=Yre(t),d=t.some(w=>w.status==="failed"),h=t.length>0?_I(t):void 0,m=t.length===1?t[0]:void 0,p=t[0]??h,g=f.useRef(Date.now()),b=kI(u),v=(n==null?void 0:n.toolCallId)&&t.some(w=>Ac(w,n.toolCallId)),x=o&&!v,y=u?$re(b-g.current):void 0;return f.useEffect(()=>{u&&(g.current=Date.now())},[u,h==null?void 0:h.callId]),x?l.jsx(IVe,{tools:t,workspaceCwd:s,isLocateFlashing:r}):v?l.jsx("div",{className:`${Gt.group}${r?` ${zf.flash}`:""}`,children:t.map(w=>l.jsx(qA,{tool:w,approval:n,workspaceCwd:s},w.callId))}):l.jsxs("div",{className:r?zf.flash:void 0,children:[l.jsxs("button",{type:"button",className:Gt.chatSummary,onClick:()=>c(w=>!w),"aria-expanded":a,title:i(a?"tool.collapseHint":"tool.expand"),children:[l.jsx("span",{className:Gt.chatSummaryIcon,"aria-hidden":"true",children:p?l.jsx(jVe,{tool:p}):l.jsx(Xre,{})}),d&&l.jsx(Ff,{status:"failed"}),l.jsx("span",{className:u?`${Gt.chatSummaryText} ${Gt.chatSummaryTextActive}`:Gt.chatSummaryText,children:m?l.jsx(kVe,{tool:m,runningDuration:u?y:void 0,workspaceCwd:s}):vVe(t,i,y)}),l.jsx("span",{className:a?Gt.chatChevronDown:Gt.chatChevronRight,"aria-hidden":"true"})]}),l.jsx("div",{className:a?Gt.chatSummaryContentClip:`${Gt.chatSummaryContentClip} ${Gt.chatSummaryContentCollapsed}`,children:l.jsx("div",{className:Gt.chatSummaryContentInner,children:l.jsx("div",{className:`${Gt.group} ${Gt.chatSummaryGroup}`,children:t.map(w=>l.jsx(qA,{tool:w,approval:n,workspaceCwd:s,summaryOnly:!m,forceExpanded:!!m,hideHeader:!!m},w.callId))})})})]})}),PVe="_message_kwepu_1",OVe="_header_kwepu_6",BVe="_chevron_kwepu_20",$Ve="_title_kwepu_26",zVe="_progress_kwepu_35",$b={message:PVe,header:OVe,chevron:BVe,title:$Ve,progress:zVe};function FVe({id:e,todos:t}){var r;const s=((r=f.useContext($I).get(e))==null?void 0:r.events)??[];return l.jsx(qre,{todos:t,events:s})}const qVe=f.memo(function({id:t,todos:n,isLocateFlashing:s=!1}){const{t:r}=ut(),[i,o]=f.useState(!1);if(n.length===0)return null;const a=n.length,c=n.filter(u=>u.status==="completed").length;return l.jsxs("div",{className:`${$b.message}${s?` ${zf.flash}`:""}`,children:[l.jsxs("button",{type:"button",className:$b.header,onClick:()=>o(u=>!u),"aria-expanded":i,title:r(i?"todo.collapse":"todo.expand"),children:[l.jsx("span",{className:$b.chevron,"aria-hidden":"true",children:i?"▾":"▸"}),l.jsx("span",{className:$b.title,children:r("plan.title")}),l.jsxs("span",{className:$b.progress,children:[c,"/",a]})]}),i?l.jsx(Hre,{todos:n,numbered:!0}):l.jsx(FVe,{id:t,todos:n})]})}),HVe="_message_1abcu_1",UVe="_content_1abcu_11",VVe="_question_1abcu_17",WVe="_prefix_1abcu_24",GVe="_answer_1abcu_28",KVe="_pending_1abcu_32",YVe="_shortcuts_1abcu_36",Cm={message:HVe,content:UVe,question:VVe,prefix:WVe,answer:GVe,pending:KVe,shortcuts:YVe},Qre=f.memo(function({question:t,answer:n,isPending:s}){const{t:r}=ut();return l.jsxs("div",{className:Cm.message,children:[l.jsxs("div",{className:Cm.content,children:[l.jsxs("div",{className:Cm.question,children:[l.jsx("span",{className:Cm.prefix,children:"/btw "}),l.jsx("span",{children:t})]}),l.jsx("div",{className:Cm.answer,children:s?l.jsx("span",{className:Cm.pending,children:r("btw.answering")}):l.jsx(gp,{content:n})})]}),l.jsx("div",{className:Cm.shortcuts,children:r(s?"btw.shortcuts.pending":"btw.shortcuts.done")})]})}),XVe="_message_1q4dw_1",QVe="_compact_1q4dw_16",JVe="_header_1q4dw_21",ZVe="_status_1q4dw_30",eWe="_name_1q4dw_35",tWe="_command_1q4dw_42",nWe="_output_1q4dw_51",sWe="_compactHint_1q4dw_62",td={message:XVe,compact:QVe,header:JVe,status:ZVe,name:eWe,command:tWe,output:nWe,compactHint:sWe},rWe=f.memo(function({command:t,output:n}){const s=f.useContext(Ep),{t:r}=ut();return l.jsxs("div",{className:s?`${td.message} ${td.compact}`:td.message,children:[l.jsxs("div",{className:td.header,children:[l.jsx("span",{className:td.status,children:"✓"}),l.jsx("span",{className:td.name,children:r("shell.command")}),t&&l.jsx("span",{className:td.command,children:t})]}),s?l.jsx("div",{className:td.compactHint,children:r("compact.hint")}):n&&l.jsx("pre",{className:td.output,children:n})]})}),iWe="_progress_1j3ys_1",oWe="_spinner_1j3ys_12",aWe="_bar_1j3ys_19",lWe="_stage_1j3ys_25",cWe="_icon_1j3ys_29",uWe="_done_1j3ys_35",dWe="_error_1j3ys_43",hWe="_detail_1j3ys_51",fWe="_path_1j3ys_56",so={progress:iWe,spinner:oWe,bar:aWe,stage:lWe,icon:cWe,done:uWe,error:dWe,detail:hWe,path:fWe},VF=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧"];function mWe({progress:e}){const{stage:t,progress:n,detail:s,isComplete:r,error:i}=e,[o,a]=f.useState(0),c=30,u=Math.round(n/100*c),d=c-u,h="█".repeat(Math.max(0,u))+"░".repeat(Math.max(0,d));return f.useEffect(()=>{if(r||i)return;const m=setInterval(()=>{a(p=>(p+1)%VF.length)},120);return()=>clearInterval(m)},[r,i]),i?l.jsxs("div",{className:`${so.progress} ${so.error}`,children:[l.jsx("span",{className:so.icon,children:"✕"}),l.jsx("span",{className:so.stage,children:t}),l.jsx("div",{className:so.detail,children:i})]}):r?l.jsxs("div",{className:`${so.progress} ${so.done}`,children:[l.jsx("span",{className:so.icon,children:"✓"}),l.jsx("span",{className:so.stage,children:t})]}):l.jsxs("div",{className:so.progress,children:[l.jsx("span",{className:so.spinner,children:VF[o]}),l.jsx("span",{className:so.bar,children:h}),l.jsxs("span",{className:so.stage,children:[t,s?` (${s})`:""]})]})}function pWe({path:e}){const{t}=ut();return l.jsxs("div",{className:`${so.progress} ${so.done}`,children:[l.jsx("span",{className:so.icon,children:"✓"}),l.jsx("span",{className:so.stage,children:t("insight.ready")}),l.jsx("span",{className:so.path,children:e})]})}const gWe=f.memo(function({message:t,pendingApproval:n,onShowContextDetail:s,workspaceCwd:r,isLatest:i=!1,showRetryHint:o=!1,onRetryClick:a,onBranchSession:c,showAssistantActions:u=!1,showAssistantBranch:d=!1,isLocateFlashing:h=!1,assistantTurnFooterInfo:m,generateContent:p}){const{t:g}=ut(),b=(()=>{switch(t.role){case"user":return l.jsx(JOe,{content:t.content,images:t.images,inputAnnotations:t.inputAnnotations,isLocateFlashing:h});case"assistant":return l.jsx(jBe,{content:t.content,isStreaming:t.isStreaming,timestamp:t.timestamp,onBranchSession:c,showFooterActions:u,showBranchAction:d,isLocateFlashing:h,customFooterInfo:m});case"thinking":return l.jsx(LBe,{messageId:t.id,content:t.content,isStreaming:t.isStreaming,timestamp:t.timestamp,isLocateFlashing:h,generateContent:p});case"tool_group":return l.jsx(LVe,{tools:t.tools,pendingApproval:n,workspaceCwd:r,isLocateFlashing:h});case"plan":return l.jsx(qVe,{id:t.id,todos:t.todos,isLocateFlashing:h});case"system":return l.jsx($qe,{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 l.jsx(rWe,{command:t.command,output:t.output});case"btw":return l.jsx(Qre,{question:t.question,answer:t.answer,isPending:t.isPending});case"insight_progress":return l.jsx(mWe,{progress:{stage:t.stage,progress:t.progress,detail:t.detail}});case"insight_ready":return l.jsx(pWe,{path:t.path});case"insight_error":return l.jsx("div",{style:{color:"var(--error-color, #e06c75)"},children:t.error});default:return null}})();if(b===null)return null;const v=l.jsx(zd,{label:`message:${t.role}`,resetKeys:[t],fallback:l.jsx(bWe,{align:t.role==="user"?"end":"start"}),children:b}),x=l.jsx("div",{"data-user-selectable":"true",style:{display:"contents"},children:v});return t.role==="assistant"?u?x:l.jsx(N7,{timestamp:t.timestamp,children:x}):t.role==="system"&&t.source==="prompt_cancelled"?x:l.jsx(N7,{timestamp:t.timestamp,chatMode:t.role==="user",copyText:t.role==="user"?t.content:void 0,copyTitle:g("common.copy"),children:x})},yWe);function bWe({align:e}){const{t}=ut();return l.jsx("div",{role:"alert",style:{display:"flex",justifyContent:e==="end"?"flex-end":"flex-start"},children:l.jsx("span",{style:{color:"var(--error-color, #e06c75)",fontSize:"0.85em",opacity:.85},children:t("message.renderError")})})}function yWe(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||e.generateContent!==t.generateContent||!xWe(e.assistantTurnFooterInfo,t.assistantTurnFooterInfo)?!1:vWe(e.message,t.message)}function xWe(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 vWe(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&&_We(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"&&wWe(e.todos,t.todos);case"tool_group":return t.role==="tool_group"&&e.tools.length===t.tools.length&&e.tools.every((n,s)=>Jre(n,t.tools[s]));default:return!1}}function wWe(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 Jre(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&&vh(e.args)===vh(t.args)&&vh(e.rawOutput)===vh(t.rawOutput)&&vh(e.locations)===vh(t.locations)&&vh(e.content)===vh(t.content)&&kWe(e.subTools,t.subTools):!1}function kWe(e,t){return!e&&!t?!0:!e||!t||e.length!==t.length?!1:e.every((n,s)=>Jre(n,t[s]))}const WF=new WeakMap;function _We(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 vh(e){if(e===void 0)return"";if(e!==null&&typeof e=="object"){let t=WF.get(e);if(t!==void 0)return t;try{t=JSON.stringify(e)}catch{t=String(e)}return WF.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 SWe(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 e4(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=SWe(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 Zx(e,t){const n=e.trim().split(/\s+/);if(n.length!==5)return e;const[s,r,i,o,a]=n,c=d=>/^\d+$/.test(d),u=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(c(s)&&r==="*"&&i==="*"&&o==="*"&&a==="*")return t("scheduledTasks.human.hourly",{min:u(s)});if(c(s)&&c(r)&&i==="*"&&o==="*"&&a==="*")return t("scheduledTasks.human.daily",{time:`${u(r)}:${u(s)}`});if(c(s)&&c(r)&&i==="*"&&o==="*"&&a==="1-5")return t("scheduledTasks.human.weekdays",{time:`${u(r)}:${u(s)}`});if(c(s)&&c(r)&&i==="*"&&o==="*"&&c(a)&&Number(a)>=0&&Number(a)<=7){const d=t("scheduledTasks.weekdayNames").split(","),h=Number(a)===7?0:Number(a),m=d[h]??a;return t("scheduledTasks.human.weekly",{day:m,time:`${u(r)}:${u(s)}`})}return e}const au={frequency:"daily",time:"09:00",weekday:1,minuteInterval:30,customCron:"0 9 * * *"};function Ch(e){const t=e.trim(),n={...au,frequency:"custom",customCron:t.length>0?t:au.customCron},s=t.split(/\s+/);if(s.length!==5)return n;const[r,i,o,a,c]=s,u=b=>/^\d+$/.test(b),d=b=>String(b).padStart(2,"0"),h=o==="*"&&a==="*";if(/^\*\/\d+$/.test(r)&&i==="*"&&h&&c==="*"){const b=Number(r.slice(2));return Number.isInteger(b)&&b>=1&&b<=30&&60%b===0?{...au,frequency:"minutes",minuteInterval:b}:n}if(!u(r))return n;const m=Number(r);if(m>59)return n;if(i==="*"&&h&&c==="*")return{...au,frequency:"hourly",time:`00:${d(m)}`};if(!u(i))return n;const p=Number(i);if(p>23)return n;const g=`${d(p)}:${d(m)}`;if(h&&c==="*")return{...au,frequency:"daily",time:g};if(h&&c==="1-5")return{...au,frequency:"weekdays",time:g};if(h&&u(c)){const b=Number(c);if(b>=0&&b<=7)return{...au,frequency:"weekly",time:g,weekday:b===7?0:b}}return n}function CWe(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=(u,d)=>`${d}${t(`scheduledTasks.dur.${u}`)}`;let c;return s>0?c=r>0?[a("d",s),a("h",r)]:[a("d",s)]:r>0?c=i>0?[a("h",r),a("m",i)]:[a("h",r)]:i>0?c=o>0?[a("m",i),a("s",o)]:[a("m",i)]:c=[a("s",o)],c.join(" ")}function TWe(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 Zre(e){switch(e){case"html":return"HTML";case"pdf":return"PDF";case"notebook":return"Notebook";default:return e||"artifact"}}function eie(e){return e===void 0?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function EWe(e){return e.workspacePath??e.url??e.managedId??""}function Cp(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 HA(e,t){const n=Cp(e),s=Cp(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 tie(e,t,n){const s=HA(e??"",n),r=HA(t??"",n);return!!s&&s===r}const GF="default-src 'none'; base-uri 'none'; style-src 'unsafe-inline'; img-src data: blob:;";function AWe(e){if(typeof DOMParser>"u")return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${GF}"></head><body>${NWe(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=GF,t.head.prepend(n),`<!doctype html>${t.documentElement.outerHTML}`}function NWe(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 t4({additions:e,deletions:t,className:n,additionsClassName:s,deletionsClassName:r}){return e===void 0||t===void 0?null:l.jsxs("span",{className:n,children:[l.jsxs("span",{className:s,children:["+",e]}),l.jsxs("span",{className:r,children:["-",t]})]})}function nie(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 jWe="_root_aths8_1",MWe="_card_aths8_7",IWe="_summary_aths8_14",RWe="_icon_aths8_22",DWe="_iconSvg_aths8_33",LWe="_title_aths8_39",PWe="_linkButton_aths8_46",OWe="_reviewButton_aths8_47",BWe="_showMoreButton_aths8_48",$We="_actions_aths8_79",zWe="_list_aths8_97",FWe="_fileRow_aths8_104",qWe="_path_aths8_124",HWe="_lineStats_aths8_133",UWe="_additions_aths8_142",VWe="_deletions_aths8_146",WWe="_chevronIcon_aths8_160",GWe="_chevronIconOpen_aths8_168",KWe="_artifactInfo_aths8_172",YWe="_artifactMeta_aths8_178",ks={root:jWe,card:MWe,summary:IWe,icon:RWe,iconSvg:DWe,title:LWe,linkButton:PWe,reviewButton:OWe,showMoreButton:BWe,actions:$We,list:zWe,fileRow:FWe,path:qWe,lineStats:HWe,additions:UWe,deletions:VWe,chevronIcon:WWe,chevronIconOpen:GWe,artifactInfo:KWe,artifactMeta:YWe},sie=["file","artifact","scheduled_task"];function XWe({turnId:e,changes:t,artifacts:n,scheduledTasks:s,workspaceCwd:r,onOpenRequest:i,onReviewChanges:o,onOpenArtifact:a,onOpenScheduledTask:c}){const{t:u}=ut(),[d,h]=f.useState(!1);if(t.length===0&&n.length===0&&s.length===0)return null;const m=d?t:t.slice(0,3),p=t.length-3,g=nie(t),b=y=>{if(i){i({id:"review",kind:"review",title:u("turnOutputs.review"),turnId:e,changes:t,...y?{selectedPath:y}:{}});return}o(t,y)},v=y=>{const w=sGe(y,t,r);if(i){i({id:`artifact:${y.id}`,kind:"artifact",title:y.title??"Artifact",turnId:e,artifactId:y.id,artifact:y,...w!==void 0?{previewContent:w}:{}});return}a(y.id,w)},x=y=>{if(i){i({id:`scheduled-task:${y.toolCallId}`,kind:"scheduled_task",title:u("scheduledTasks.title"),turnId:e,task:y});return}c(y)};return l.jsxs("div",{className:ks.root,children:[t.length>0&&l.jsxs("div",{className:ks.card,children:[l.jsxs("div",{className:ks.summary,children:[l.jsx("span",{className:ks.icon,"aria-hidden":"true",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",focusable:"false",className:ks.iconSvg,children:[l.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"1.6"}),l.jsx("path",{d:"M9 9.5h6M12 6.5v6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),l.jsx("path",{d:"M9 16h6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),l.jsxs("div",{children:[l.jsx("div",{className:ks.title,children:u("turnOutputs.filesEdited",{count:t.length})}),l.jsx(t4,{additions:g==null?void 0:g.additions,deletions:g==null?void 0:g.deletions,className:ks.lineStats,additionsClassName:ks.additions,deletionsClassName:ks.deletions}),l.jsxs("button",{type:"button",className:ks.linkButton,onClick:()=>b(),children:[u("turnOutputs.viewChanges")," ↗"]})]}),l.jsx("div",{className:ks.actions,children:l.jsx("button",{type:"button",className:ks.reviewButton,onClick:()=>b(),children:u("turnOutputs.review")})})]}),l.jsxs("div",{className:ks.list,children:[m.map(y=>l.jsxs("button",{type:"button",className:ks.fileRow,onClick:()=>b(y.path),title:y.path,children:[l.jsx("span",{className:ks.path,children:CI(y.path,r)}),l.jsx(t4,{additions:y.additions,deletions:y.deletions,className:ks.lineStats,additionsClassName:ks.additions,deletionsClassName:ks.deletions})]},`${y.toolCallId}:${y.path}`)),p>0&&l.jsxs("button",{type:"button",className:ks.showMoreButton,onClick:()=>h(y=>!y),children:[l.jsx("span",{children:d?u("turnOutputs.collapseFiles"):u("turnOutputs.showMoreFiles",{count:p})}),l.jsx(tGe,{open:d})]})]})]}),n.map(y=>l.jsx(QWe,{artifact:y,onOpen:()=>v(y)},y.id)),s.map(y=>l.jsx(JWe,{task:y,scheduleLabel:Zx(y.cron,u),onOpen:()=>x(y)},y.toolCallId))]})}function QWe({artifact:e,onOpen:t}){const{t:n}=ut(),s=eie(e.sizeBytes);return l.jsx("div",{className:ks.card,children:l.jsxs("div",{className:ks.summary,children:[l.jsx("span",{className:ks.icon,"aria-hidden":"true",children:l.jsx(ZWe,{})}),l.jsxs("div",{className:ks.artifactInfo,children:[l.jsx("div",{className:ks.title,children:e.title}),l.jsx("div",{className:ks.artifactMeta,children:[Zre(e.kind),s].filter(Boolean).join(" · ")})]}),l.jsx("div",{className:ks.actions,children:l.jsx("button",{type:"button",className:ks.reviewButton,onClick:t,title:e.title,children:n("common.open")})})]})})}function JWe({task:e,scheduleLabel:t,onOpen:n}){const{t:s}=ut();return l.jsx("div",{className:ks.card,children:l.jsxs("div",{className:ks.summary,children:[l.jsx("span",{className:ks.icon,"aria-hidden":"true",children:l.jsx(eGe,{})}),l.jsxs("div",{className:ks.artifactInfo,children:[l.jsx("div",{className:ks.title,children:e.title}),l.jsx("div",{className:ks.artifactMeta,children:[t,e.recurring?s("scheduledTasks.repeats"):s("scheduledTasks.runsOnce")].filter(Boolean).join(" · ")})]}),l.jsx("div",{className:ks.actions,children:l.jsx("button",{type:"button",className:ks.reviewButton,onClick:n,title:e.title,children:s("common.open")})})]})})}function ZWe(){return l.jsxs("svg",{className:ks.iconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[l.jsx("rect",{x:"6",y:"4",width:"12",height:"16",rx:"2",stroke:"currentColor",strokeWidth:"1.8"}),l.jsx("path",{d:"M9 10h6M9 14h4",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})]})}function eGe(){return l.jsxs("svg",{className:ks.iconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[l.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3",stroke:"currentColor",strokeWidth:"1.8"}),l.jsx("path",{d:"M12 8v4l3 2",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function tGe({open:e}){return l.jsx("svg",{className:[ks.chevronIcon,e?ks.chevronIconOpen:""].filter(Boolean).join(" "),viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:l.jsx("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}const nGe=f.memo(XWe);function sGe(e,t,n){if(e.kind!=="html"||!e.workspacePath)return;const s=t.find(r=>tie(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 CI(e,t){return HA(e,t)}const rGe="_wrap_bymxa_1",iGe="_summary_bymxa_5",oGe="_summaryTextActive_bymxa_27",aGe="_summaryIcon_bymxa_33",lGe="_summaryStatus_bymxa_47",cGe="_summaryToolIcon_bymxa_54",uGe="_summaryText_bymxa_27",dGe="_summaryDot_bymxa_96",hGe="_chevronRight_bymxa_100",fGe="_chevronDown_bymxa_101",mGe="_group_bymxa_161",pGe="_list_bymxa_193",gGe="_row_bymxa_199",bGe="_rowStats_bymxa_213",yGe="_rowDesc_bymxa_221",xGe="_rowTool_bymxa_231",vGe="_detail_bymxa_235",wGe="_track_bymxa_241",kGe="_bar_bymxa_249",_Ge="_barRunning_bymxa_257",SGe="_ruler_bymxa_296",CGe="_tick_bymxa_303",Yr={wrap:rGe,summary:iGe,summaryTextActive:oGe,summaryIcon:aGe,summaryStatus:lGe,summaryToolIcon:cGe,summaryText:uGe,summaryDot:dGe,chevronRight:hGe,chevronDown:fGe,group:mGe,list:pGe,row:gGe,rowStats:bGe,rowDesc:yGe,rowTool:xGe,detail:vGe,track:wGe,bar:kGe,barRunning:_Ge,ruler:SGe,tick:CGe};function rie(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 TGe(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,m)=>h.status==="in_progress"?Math.max(t,n[m]):Math.max(h.endTime??n[m],n[m])),r=Math.min(...n),i=Math.max(...s)-r;if(i<1e3)return null;const o=new Map;e.forEach((h,m)=>{const p=Math.max((s[m]-n[m])/i,.02),g=Math.min((n[m]-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),c=Math.pow(10,Math.floor(Math.log10(a))),u=[5,2,1].map(h=>h*c).find(h=>h<=a)??c,d=[];for(let h=0;d.length<4;h++){const m=h*u*1e3;if(m>i*.92)break;d.push({leftPct:m/i*100,label:rie(m)})}return{rows:o,ticks:d}}function EGe(e,t){const n=[],s=zv(e.rawOutput),r=s==null?void 0:s.executionSummary,i=r&&typeof r.totalDurationMs=="number"?rie(r.totalDurationMs):Fv(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(gI(o));const a=pI(e);return a&&n.push(Gi(a,80)),n.join(" · ")}function AGe(){return l.jsx("svg",{className:Yr.summaryToolIcon,width:"14",height:"14",viewBox:"0 0 1024 1024",fill:"currentColor","aria-hidden":"true",children:l.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 NGe({agents:e,pendingApproval:t}){const{t:n}=ut(),[s,r]=f.useState(!1),[i,o]=f.useState(null),[a,c]=f.useState(()=>Date.now()),u=f.useRef(Date.now()),d=e.some(y=>y.status==="in_progress");f.useEffect(()=>{d&&(u.current=Date.now(),c(Date.now()))},[d]),f.useEffect(()=>{if(!d)return;const y=setInterval(()=>c(Date.now()),1e3);return()=>clearInterval(y)},[d]);const h=d?$re(a-u.current):"",m=e.filter(y=>y.status==="completed"||y.status==="failed").length,p=e.length,g=t!=null&&t.toolCallId?e.find(y=>Ac(y,t.toolCallId)):void 0,b=s||!!g,v=b?TGe(e,a):null,x=e.some(y=>Qx(y)==="failed")?"failed":d?"in_progress":"completed";return l.jsxs("div",{className:Yr.wrap,children:[l.jsxs("button",{type:"button",className:Yr.summary,onClick:()=>r(y=>!y),"aria-expanded":b,title:n(b?"tool.collapseHint":"tool.expand"),children:[x==="failed"?l.jsx("span",{className:Yr.summaryStatus,children:l.jsx(Ff,{status:x})}):l.jsx("span",{className:Yr.summaryIcon,"aria-hidden":"true",children:l.jsx(AGe,{})}),l.jsxs("span",{className:d?`${Yr.summaryText} ${Yr.summaryTextActive}`:Yr.summaryText,children:[n("parallelAgents.title"),h&&l.jsxs(l.Fragment,{children:[" ",h]}),l.jsx("span",{className:Yr.summaryDot,children:"·"}),n("parallelAgents.done",{done:m,total:p})]}),l.jsx("span",{className:b?Yr.chevronDown:Yr.chevronRight,"aria-hidden":"true"})]}),b&&l.jsxs("div",{className:Yr.group,children:[l.jsx("div",{className:Yr.list,children:e.map(y=>{const w=bI(y),k=yI(y),T=S$e(y,n),S=EGe(y,a),C=Qx(y),_=i===y.callId,B=v==null?void 0:v.rows.get(y.callId);return l.jsxs("div",{children:[l.jsxs("div",{className:Yr.row,onClick:()=>o(_?null:y.callId),children:[l.jsx(Ff,{status:C}),l.jsxs("span",{className:Yr.rowDesc,children:[Gi(k||w,50),T&&l.jsx("span",{className:Yr.rowTool,children:` (${T})`})]}),S&&l.jsx("span",{className:Yr.rowStats,children:S})]}),B&&l.jsx("div",{className:Yr.track,"aria-hidden":"true",children:l.jsx("span",{className:B.running?`${Yr.bar} ${Yr.barRunning}`:Yr.bar,style:{left:`${B.leftPct}%`,width:`${B.widthPct}%`}})}),_&&l.jsx("div",{className:Yr.detail,children:l.jsx(xI,{tool:y,hideHeader:!0})})]},y.callId)})}),v&&v.ticks.length>=2&&l.jsx("div",{className:Yr.ruler,"aria-hidden":"true",children:v.ticks.map(y=>l.jsx("span",{className:Yr.tick,style:{left:`${y.leftPct}%`},children:y.label},y.label))})]})]})}const jGe="_collapseRow_d7f01_1",MGe="_collapseRowClickable_d7f01_14",IGe="_collapseLabel_d7f01_19",RGe="_processedLabel_d7f01_36",DGe="_processedMeta_d7f01_43",LGe="_hiddenMetrics_d7f01_47",PGe="_summaryMetrics_d7f01_51",OGe="_collapseIcon_d7f01_59",BGe="_chevronRight_d7f01_72",$Ge="_chevronDown_d7f01_73",xc={collapseRow:jGe,collapseRowClickable:MGe,collapseLabel:IGe,processedLabel:RGe,processedMeta:DGe,hiddenMetrics:LGe,summaryMetrics:PGe,collapseIcon:OGe,chevronRight:BGe,chevronDown:$Ge},zGe="_list_1sazw_1",FGe="_listWithWelcomeHeader_1sazw_12",qGe="_historyStatus_1sazw_32",HGe="_virtualSizer_1sazw_48",UGe="_virtualRow_1sazw_57",VGe="_loadingSkeleton_1sazw_67",WGe="_srOnly_1sazw_75",GGe="_loadingSkeletonUserRow_1sazw_87",KGe="_loadingSkeletonAssistantRow_1sazw_93",YGe="_loadingSkeletonUserBubble_1sazw_99",XGe="_loadingSkeletonUserBubbleCompact_1sazw_100",QGe="_loadingSkeletonAssistantBlock_1sazw_114",JGe="_loadingSkeletonLineWide_1sazw_122",ZGe="_loadingSkeletonLineMedium_1sazw_123",eKe="_loadingSkeletonLineShort_1sazw_124",tKe="_loadingSkeletonLineNarrow_1sazw_125",nKe="_turnStatusRow_1sazw_165",sKe="_turnAnswerRow_1sazw_166",rKe="_turnContentRow_1sazw_177",iKe="_turnContentClip_1sazw_181",oKe="_turnContentCollapsed_1sazw_189",aKe="_turnContentInner_1sazw_193",lKe="_sessionTimelineLayer_1sazw_198",cKe="_sessionTimelinePanel_1sazw_211",uKe="_sessionTimelineViewport_1sazw_222",dKe="_sessionTimelineList_1sazw_263",hKe="_sessionTimelineItem_1sazw_273",fKe="_sessionTimelineButton_1sazw_278",mKe="_sessionTimelineTick_1sazw_297",pKe="_sessionTimelineButtonInRange_1sazw_384",gKe="_sessionTimelineButtonCurrent_1sazw_388",bKe="_sessionTimelineDetails_1sazw_399",yKe="_sessionTimelineDetailsTitle_1sazw_433",xKe="_sessionTimelineDetailsIcon_1sazw_440",vKe="_sessionTimelineDetailsTitleText_1sazw_452",wKe="_sessionTimelineDetailsDetail_1sazw_462",ts={list:zGe,listWithWelcomeHeader:FGe,historyStatus:qGe,virtualSizer:HGe,virtualRow:UGe,loadingSkeleton:VGe,srOnly:WGe,loadingSkeletonUserRow:GGe,loadingSkeletonAssistantRow:KGe,loadingSkeletonUserBubble:YGe,loadingSkeletonUserBubbleCompact:XGe,loadingSkeletonAssistantBlock:QGe,loadingSkeletonLineWide:JGe,loadingSkeletonLineMedium:ZGe,loadingSkeletonLineShort:eKe,loadingSkeletonLineNarrow:tKe,turnStatusRow:nKe,turnAnswerRow:sKe,turnContentRow:rKe,turnContentClip:iKe,turnContentCollapsed:oKe,turnContentInner:aKe,sessionTimelineLayer:lKe,sessionTimelinePanel:cKe,sessionTimelineViewport:uKe,sessionTimelineList:dKe,sessionTimelineItem:hKe,sessionTimelineButton:fKe,sessionTimelineTick:mKe,sessionTimelineButtonInRange:pKe,sessionTimelineButtonCurrent:gKe,sessionTimelineDetails:bKe,sessionTimelineDetailsTitle:yKe,sessionTimelineDetailsIcon:xKe,sessionTimelineDetailsTitleText:vKe,sessionTimelineDetailsDetail:wKe},R6=()=>{};function kKe(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 _Ke(e){return e[e.length-1]}function SKe(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&Hp(n))return n.id}return null}function KF(e){return e.role==="tool_group"&&e.tools.length===1&&L4(e.tools[0])}function D6(e){return e.role==="tool_group"&&e.tools.length===1&&zG(e.tools[0])}function YF(e){return e.role==="thinking"}function XF(e,t){return e.role!=="tool_group"?!1:!!(t!=null&&t.toolCallId&&e.tools.some(n=>Ac(n,t.toolCallId)))}function QF(e){return e.role==="thinking"}function CKe(e,t){const n=[];let s=0;for(;s<e.length;){const r=e[s];if(r.role!=="tool_group"||XF(r,t)){QF(r)||n.push(r),s++;continue}const i=[r];let o=s,a=s+1;for(;a<e.length;){const u=e[a];if(QF(u)){a++;continue}if(u.role==="tool_group"&&!XF(u,t)){i.push(u),o=a,a++;continue}break}if(i.length===1){n.push(r),s++;continue}const c=i.flatMap(u=>u.role==="tool_group"?u.tools:[]);n.push({id:i[0].id,role:"tool_group",tools:c}),s=o+1}return n}function iie(e){const t=[];let n=0;for(;n<e.length;){if(D6(e[n])){const s=[];let r=n;for(;r<e.length;){const i=e[r];if(D6(i)){s.push(i),r++;continue}if(YF(i)){let o=r+1;for(;o<e.length&&YF(e[o]);)o++;if(o<e.length&&D6(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(KF(e[n])){const s=n;for(;n<e.length&&KF(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 JF(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 TKe(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=(c,u)=>{if(u&&t||!c)return;const d=(n==null?void 0:n.get(c))??[],h=(s==null?void 0:s.get(c))??[],m=(r==null?void 0:r.get(c))??[];d.length===0&&h.length===0&&m.length===0||i.push({type:"turn_outputs",key:c,turnId:c,changes:d,artifacts:h,scheduledTasks:m})};for(const c of e)c.type==="message"&&Hp(c.message)?(a(o,!1),o=c.message.id):!o&&c.type==="message"?o=c.message.id:!o&&c.type==="parallel_agents"&&(o=c.turnId),i.push(c);return a(o,!0),i}function EKe(e){return e.type==="message"&&e.message.role==="assistant"&&!!e.message.content&&e.message.content.trim().length>0}function TI(e,t,n){let s=t;for(let r=n;r>t;r--)if(oie(e[r])){s=r;break}for(let r=n;r>s;r--)if(EKe(e[r]))return r;return-1}function AKe(e,t){const n=[];for(let r=0;r<e.length;r++){const i=e[r];i.type==="message"&&Hp(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],c=TI(e,i,o);if(c<0)continue;const u=e[c];(a==null?void 0:a.type)==="message"&&u.type==="message"&&u.message.role==="assistant"&&s.set(u.message.id,a.message.id)}return s}function UA(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=>UA(n,t));switch(e.message.role){case"tool_group":case"plan":return!0;case"assistant":return!t;case"thinking":return!0;case"system":return EI(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 EI(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 NKe(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}:Tp(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 EI(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 Tp(e,t,n={}){const r=(n.stripMarkdown===!0?jKe(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 jKe(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=L6(s,"~~"),s=L6(s,"**"),s=L6(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 L6(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 MKe(e,t){const n=e.role==="user"?e.content:e.role==="user_shell"?e.command:"",s=Tp(n,32);return s||(t?t("timeline.userTurn"):"User turn")}function IKe(e){return e.role==="user"&&(e.source==="cron"||e.source==="loop")}function Hp(e){return e.role==="user"||e.role==="user_shell"}function RKe(e,t){switch(e.role){case"thinking":return t?t("timeline.kind.thought"):"thinking";case"assistant":return Tp(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 EI(e)?Tp(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 DKe(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"?"":RKe(e.message,t)}function LKe(e,t){return t?t(`timeline.kind.${e}`):oYe[e]}function PKe(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 c=Tp(a.content,180,{stripMarkdown:!0});if(c)return c}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 c=DKe(a,s);c&&r.push(c)}const i=Tp(r.join(" · "),180);return i||(n.length>0?n.map(o=>LKe(o,s)).join(" · "):s?s("timeline.noActivity"):"No activity")}function OKe(e,t){const n=[];let s=null,r=[];const i=()=>{if(!s)return;const o=iie(r),a=TI(o,-1,o.length-1),c=a>=0?o[a]:null,u=(c==null?void 0:c.type)==="message"&&c.message.role==="assistant"&&!c.message.isStreaming&&Tp(c.message.content,1,{stripMarkdown:!0}).length>0?c.message.id:null,d=[];for(const h of o){if(h.type==="message"&&u!==null&&h.message.id===u)continue;const m=NKe(h,t);m.kind!=="none"&&!d.includes(m.kind)&&d.push(m.kind)}n.push({id:s.id,label:MKe(s,t),detail:PKe(o,u,d,t),timestamp:s.timestamp,nodeKinds:d,...IKe(s)?{isScheduledTask:!0}:{}})};for(const o of e){if(Hp(o)){i(),s=o,r=[];continue}s&&r.push(o)}return i(),n}function BKe(){return l.jsxs("svg",{className:ts.sessionTimelineDetailsIcon,viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6.25"}),l.jsx("path",{d:"M8 4.5v4l-2.5 2"})]})}function $Ke(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 zKe(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($Ke).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 oie(e){return e.type==="parallel_agents"?!0:e.type==="turn_outputs"||e.type==="turn_collapse"?!1:e.type==="turn_content"?e.items.some(oie):e.message.role==="tool_group"||e.message.role==="plan"}function ZF(e){return e==="pending"||e==="running"||e==="in_progress"}function aie(e){if(e.type==="turn_content"){for(let n=e.items.length-1;n>=0;n--){const s=aie(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=>ZF(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=>ZF(n.status));return t.length===0?null:`tools:${e.message.id}:${t.map(n=>n.callId).join(",")}`}function FKe(e){for(let t=e.length-1;t>=0;t--){const n=aie(e[t]);if(n)return n}return null}function qKe(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 HKe(e){return e.type==="message"&&e.message.role==="system"&&e.message.source==="turn_error"}function UKe(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 VKe(e){return e.type==="message"&&e.message.role==="assistant"?e.message.usage:void 0}function lie(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+lie(n),0):e.message.role==="tool_group"?e.message.tools.length:0}function cie(e,t){for(let n=Math.min(t,e.length-1);n>=0;n--){const s=e[n];if(s.type==="message"&&Hp(s.message))return s.message.id}return null}function uie(e){const t=[];let n=null;for(const s of e)s.type==="message"&&Hp(s.message)&&(n=s.message.id),t.push(n);return t}function eq(e,t,n,s){const r=s===void 0?cie(e,t):s[t]??null;return r?n.get(r)??null:null}function WKe(e,t,n,s,r=uie(e)){let i=Number.POSITIVE_INFINITY,o=-1;for(const c of t){if(c<0||c>=e.length)continue;const u=eq(e,c,n,r);u!==null&&(i=Math.min(i,u),o=Math.max(o,u))}if(o<0)return null;const a=s==null?null:eq(e,s,n,r);return{startIndex:i,endIndex:o,currentIndex:a!==null&&a>=i&&a<=o?a:o}}function GKe(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=>Ac(o,s)))return!0}else if(i.type==="message"&&i.message.role==="tool_group"&&i.message.tools.some(o=>Ac(o,s)))return!0}return!1}function KKe(e,{overrides:t,isResponding:n,activeTurnStartedAt:s,pendingApprovalCallId:r,enabled:i}){if(!i||e.length===0)return e;const o=[];for(let c=0;c<e.length;c++){const u=e[c];u.type==="message"&&Hp(u.message)&&o.push(c)}if(o.length===0)return e;const a=[];for(let c=0;c<o[0];c++)a.push(e[c]);for(let c=0;c<o.length;c++){const u=o[c],d=(c+1<o.length?o[c+1]:e.length)-1,h=e[u],m=h.message.id,p=h.message.timestamp,g=c===o.length-1&&n,b=GKe(e,u,d,r),v=TI(e,u,d);let x=0,y,w,k=0,T=0,S=0,C=0,_=0,B=!1,A=!1;for(let M=u+1;M<=d;M++){const re=e[M];UA(re,M===v)&&x++,HKe(re)&&(A=!0),C+=lie(re),re.type==="message"&&re.message.role==="thinking"&&_++;const X=qKe(re);X!==void 0&&(y=y===void 0?X:Math.max(y,X));const J=UKe(re);J!==void 0&&(w=w===void 0?J:Math.max(w,J));const de=VKe(re);de&&(k+=de.inputTokens,T+=de.outputTokens,S+=de.cachedTokens??0,B=!0)}const N=g?s??p??Date.now():void 0,j=y??w,P=p!==void 0&&j!==void 0&&j>=p?j-p:void 0;if(b||x===0&&!(B||P!==void 0||N!==void 0)){for(let M=u;M<=d;M++)a.push(e[M]);continue}const O=g||A||v<0,z=!(x===0?!0:t.has(m)?t.get(m):O);let F=0;const G=M=>{M.length!==0&&a.push({type:"turn_content",key:`${m}-content-${F++}`,turnId:m,collapsed:z,items:M})};a.push({type:"message",key:h.key,message:h.message});const I={turnId:m,collapsed:z,hiddenCount:x,...P!==void 0?{elapsedMs:P}:{},...B?{inputTokens:k,outputTokens:T}:{},...S>0?{cachedTokens:S}:{},...C>0?{toolCallCount:C}:{},..._>0?{thinkingCount:_}:{},...N!==void 0?{liveStartedAt:N}:{}};if(a.push({type:"turn_collapse",key:`tc-${m}`,turnCollapse:I}),!z){let M=[];for(let re=u+1;re<=d;re++){const se=e[re];re===v&&se.type==="message"&&se.message.role==="assistant"?(G(M),M=[],a.push({...se,turnCollapse:I})):M.push(se)}G(M);continue}const Q=[],V=[];for(let M=u+1;M<=d;M++){const re=e[M];if(!(M===v&&g)){if(M===v&&re.type==="message"&&re.message.role==="assistant"){V.push({...re,turnCollapse:I});continue}if(UA(re,M===v)){Q.push(re);continue}V.push(re)}}G(Q),a.push(...V)}return a}function Q2(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=>Ac(i,n)))return s}else{if(r.type==="parallel_agents"&&n&&r.agents.some(i=>Ac(i,n)))return s;if(r.type==="turn_content"&&Q2(r.items,t,n)>=0)return s;if(r.type==="turn_outputs")continue}}return-1}function VA(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=>Ac(s,n)):e.type==="parallel_agents"?!!n&&e.agents.some(s=>Ac(s,n)):e.type==="turn_content"?e.items.some(s=>VA(s,t)):(e.type==="turn_outputs",!1)}const P6=0,YKe=120,O6=80,XKe=32,QKe=240,B6=30,tq=48,die=200,JKe=4;function ZKe(e,t=die){return e>t}function eYe(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 $6(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function tYe(e){return e!==void 0?eYe(e):""}function nYe(e,t){if(e.inputTokens===void 0||e.outputTokens===void 0)return"";const n=e.cachedTokens??0,s=n>0&&e.inputTokens>0?` (${$6(n)} ${t("turn.cached")}, ${Math.round(n/e.inputTokens*100)}%)`:"";return`↑${$6(e.inputTokens)}${s} ↓${$6(e.outputTokens)}`}function nq(e,t){const n=[],s=nYe(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 sYe(e){return e.inputTokens!==void 0&&e.outputTokens!==void 0||e.toolCallCount!==void 0&&e.toolCallCount>0}const rYe=f.memo(function({turnCollapse:t,onToggleCollapse:n}){const{t:s}=ut(),r=t.hiddenCount>0,i=t.liveStartedAt,o=r||i!==void 0||sYe(t),a=kI(i!==void 0&&o),c=f.useRef(0),u=f.useRef(i);u.current!==i&&(u.current=i,c.current=0);let d;i!==void 0&&o?(c.current=Math.max(c.current,Math.max(0,a-i)),d=c.current):o&&t.elapsedMs!==void 0?(c.current=0,d=t.elapsedMs):(c.current=0,d=void 0);const h=tYe(d),m=nq(t,s),p=nq(t,s),g=s(i!==void 0?"turn.processing":"turn.processed"),b=!!h&&o,v=!!m&&o,x=!!p&&o;if(!o)return null;const y=()=>{if(!r)return;const w=t.collapsed;n(t.turnId,w)};return l.jsxs("div",{className:r?`${xc.collapseRow} ${xc.collapseRowClickable}`:xc.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?y:void 0,onKeyDown:r?w=>{w.key!=="Enter"&&w.key!==" "||(w.preventDefault(),y())}:void 0,children:[l.jsxs("span",{className:xc.collapseLabel,children:[l.jsxs("span",{className:xc.processedLabel,children:[g,b&&l.jsxs("span",{className:xc.processedMeta,children:[" ",h]})]}),x&&l.jsx("span",{className:xc.summaryMetrics,children:p}),v&&l.jsx("span",{className:xc.hiddenMetrics,children:m})]}),r&&l.jsx("span",{"data-testid":`toggle-${t.turnId}`,className:xc.collapseIcon,onClick:w=>{w.stopPropagation(),y()},children:l.jsx("span",{className:t.collapsed?xc.chevronRight:xc.chevronDown,"aria-hidden":"true"})})]})});function sq(e){if(e.type==="turn_collapse")return ts.turnStatusRow;if(e.type==="turn_outputs"||e.type==="turn_content")return ts.turnContentRow;if(e.type==="message"&&e.turnCollapse)return ts.turnAnswerRow}const iYe=f.memo(function({collapsed:t,children:n}){const s=n4(ts.turnContentClip,t?ts.turnContentCollapsed:void 0);return l.jsx("div",{className:s,"data-collapsed":t?"true":"false",children:l.jsx("div",{className:ts.turnContentInner,children:n})})}),oYe={thought:"thinking",commentary:"assistant update",tool:"tool calls",agents:"parallel agents",plan:"plan update",status:"status update",none:"turn"},aYe=["--background","--foreground","--muted-foreground","--border","--font-sans"],rq="session-timeline-detail-tooltip",lYe=f.memo(function({entries:t,currentTurnId:n,currentRange:s,hidden:r,onSelect:i}){const o=Yd(),{t:a}=ut(),c=f.useRef(null),u=f.useRef(null),d=f.useRef(null),h=f.useRef(!1),m=f.useRef(!1),p=f.useRef(null),g=f.useRef(null),[b,v]=f.useState(null),x=s!==null?s.currentIndex:t.findIndex(A=>A.id===n),y=f.useCallback(()=>v(null),[]),w=f.useCallback(()=>{h.current||m.current||y()},[y]),k=f.useCallback((A,N)=>{const j=c.current;if(!j)return null;const P=getComputedStyle(j),L=N.getBoundingClientRect();return{entry:A,top:L.top+L.height/2,left:L.right+8,clamped:!1,themeVars:Object.fromEntries(aYe.map(O=>[O,P.getPropertyValue(O)]))}},[]),T=f.useCallback(A=>{const N=u.current;if(!N)return null;const j=Array.from(N.querySelectorAll('[data-testid="session-timeline-entry"]')).find(P=>P.getAttribute("data-turn-id")===A.id);return(j==null?void 0:j.querySelector("button"))??null},[]),S=f.useCallback(A=>{const N=u.current;if(!N)return!1;const j=N.getBoundingClientRect(),P=A.getBoundingClientRect();return P.bottom>=j.top&&P.top<=j.bottom},[]),C=f.useCallback(()=>{v(A=>{if(!A)return null;const N=T(A.entry);return!N||!S(N)?null:k(A.entry,N)})},[k,T,S]),_=f.useCallback((A,N)=>{v(k(A,N))},[k]),B=f.useCallback(()=>{typeof window>"u"||(p.current!==null&&window.cancelAnimationFrame(p.current),g.current!==null&&window.clearTimeout(g.current),m.current=!0,p.current=window.requestAnimationFrame(()=>{p.current=null,m.current=!1,C()}),g.current=window.setTimeout(()=>{g.current=null,m.current=!1},100))},[C]);return f.useLayoutEffect(()=>{if(r)return;const A=u.current;if(!A||x<0)return;const N=A.querySelector(`[data-timeline-index="${x}"]`);if(!N)return;const j=N.offsetTop+N.offsetHeight/2,P=A.scrollHeight-A.clientHeight,L=Math.max(0,Math.min(j-A.clientHeight/2,P));if(A.scrollTop===L)return;h.current=!0,A.scrollTop=L;const O=window.requestAnimationFrame(()=>{h.current=!1,C()}),$=window.setTimeout(()=>{h.current=!1},100);return()=>{window.cancelAnimationFrame(O),window.clearTimeout($),h.current=!1}},[x,r,C]),f.useLayoutEffect(()=>{if(!(!b||typeof window>"u"))return window.addEventListener("resize",C),()=>{window.removeEventListener("resize",C)}},[C,b]),f.useLayoutEffect(()=>()=>{p.current!==null&&window.cancelAnimationFrame(p.current),g.current!==null&&window.clearTimeout(g.current),m.current=!1},[]),f.useLayoutEffect(()=>{if(!b||b.clamped)return;const A=c.current,N=d.current;if(!A||!N||typeof window>"u")return;const j=N.getBoundingClientRect(),P=12;let L=b.top;j.top<P?L+=P-j.top:j.bottom>window.innerHeight-P&&(L-=j.bottom-(window.innerHeight-P)),L!==b.top&&v(O=>(O==null?void 0:O.entry.id)===b.entry.id?{...O,top:L,clamped:!0}:O)},[b]),r||t.length===0?null:l.jsx("div",{className:ts.sessionTimelineLayer,"aria-hidden":"false",children:l.jsxs("nav",{ref:c,className:ts.sessionTimelinePanel,"aria-label":a("timeline.sessionTimeline"),"data-testid":"session-timeline",onMouseLeave:y,children:[l.jsx("div",{ref:u,className:ts.sessionTimelineViewport,"data-testid":"session-timeline-viewport",onScroll:w,children:l.jsx("ol",{className:ts.sessionTimelineList,children:t.map((A,N)=>{const j=s!==null&&N>=s.startIndex&&N<=s.endIndex,P=s!==null?N===s.currentIndex:A.id===n,L=A.nodeKinds.join(","),O=[`${a("timeline.turnPrefix",{index:N+1})}: ${A.label}`,P?a("timeline.currentTurn"):null].filter(Boolean).join(". "),$=G=>_(A,G.currentTarget),z=G=>{B(),_(A,G.currentTarget)},F=(b==null?void 0:b.entry.id)===A.id;return l.jsx("li",{className:ts.sessionTimelineItem,"data-testid":"session-timeline-entry","data-turn-id":A.id,"data-timeline-index":N,"data-node-kinds":L,"data-in-current-range":j?"true":void 0,children:l.jsx("button",{type:"button",className:n4(ts.sessionTimelineButton,j?ts.sessionTimelineButtonInRange:void 0,P?ts.sessionTimelineButtonCurrent:void 0),"aria-current":P?"step":void 0,"aria-describedby":F?rq:void 0,"aria-label":O,onClick:()=>i(A.id),onFocus:z,onBlur:y,onMouseEnter:$,onMouseLeave:y,children:l.jsx("span",{className:ts.sessionTimelineTick})})},A.id)})})}),b&&typeof document<"u"&&ju.createPortal(l.jsxs("div",{ref:d,className:ts.sessionTimelineDetails,id:rq,"data-testid":"session-timeline-detail","data-title":b.entry.label,"data-detail":b.entry.detail,"data-scheduled-task":b.entry.isScheduledTask?"true":void 0,role:"tooltip",style:{...b.themeVars,top:b.top,left:b.left},children:[l.jsxs("span",{className:ts.sessionTimelineDetailsTitle,children:[b.entry.isScheduledTask&&l.jsx(BKe,{}),l.jsx("span",{className:ts.sessionTimelineDetailsTitleText,children:b.entry.label})]}),l.jsx("span",{className:ts.sessionTimelineDetailsDetail,children:b.entry.detail})]}),o??document.body)]})})});function n4(...e){return e.filter(Boolean).join(" ")||void 0}const cYe=[];function uYe({label:e}){return l.jsxs(l.Fragment,{children:[l.jsx("div",{role:"status","aria-live":"polite",className:ts.srOnly,children:e}),l.jsxs("div",{className:ts.loadingSkeleton,"data-testid":"message-list-loading-skeleton","aria-hidden":"true",children:[l.jsx("div",{className:ts.loadingSkeletonUserRow,children:l.jsxs("div",{className:ts.loadingSkeletonUserBubble,children:[l.jsx("span",{className:ts.loadingSkeletonLineWide}),l.jsx("span",{className:ts.loadingSkeletonLineShort})]})}),l.jsx("div",{className:ts.loadingSkeletonAssistantRow,children:l.jsxs("div",{className:ts.loadingSkeletonAssistantBlock,children:[l.jsx("span",{className:ts.loadingSkeletonLineMedium}),l.jsx("span",{className:ts.loadingSkeletonLineWide}),l.jsx("span",{className:ts.loadingSkeletonLineNarrow})]})}),l.jsx("div",{className:ts.loadingSkeletonUserRow,children:l.jsx("div",{className:ts.loadingSkeletonUserBubbleCompact,children:l.jsx("span",{className:ts.loadingSkeletonLineMedium})})}),l.jsx("div",{className:ts.loadingSkeletonAssistantRow,children:l.jsxs("div",{className:ts.loadingSkeletonAssistantBlock,children:[l.jsx("span",{className:ts.loadingSkeletonLineWide}),l.jsx("span",{className:ts.loadingSkeletonLineMedium})]})})]})]})}const hie=f.memo(f.forwardRef(function({messages:t,pendingApproval:n,onShowContextDetail:s,loadingTranscript:r,catchingUp:i,hasOlderHistory:o=!1,loadingOlderHistory:a=!1,historyCapacityReached:c=!1,onLoadOlderHistory:u,isResponding:d=!1,activeTurnStartedAt:h,welcomeHeader:m,centerWelcomeHeader:p=!1,workspaceCwd:g,tailContent:b,tailKey:v="tail",virtualScrollThreshold:x=die,autoScrollTailIntoView:y=!1,bottomOverlayInset:w=0,hideSessionTimeline:k=!1,showRetryHint:T=!1,onRetryClick:S,onBranchSession:C,onCanScrollToBottomChange:_,turnFileChanges:B,turnArtifacts:A,turnScheduledTasks:N,onReviewChanges:j,onOpenArtifact:P,onOpenScheduledTask:L,onTurnOutputOpen:O,generateContent:$},z){var Un;const{t:F}=ut(),G=f.useContext(Ep),I=f.useMemo(()=>G?CKe(t,n):t,[G,t,n]),Q=f.useMemo(()=>TKe(iie(I),d,B,A,N),[I,d,B,A,N]),[V,M]=f.useState(!1),re=f.useRef(null),se=f.useMemo(()=>{var $e,Lt;if(!V)return cYe;const xe=zKe(I);return((($e=re.current)==null?void 0:$e.signature)!==xe||((Lt=re.current)==null?void 0:Lt.t)!==F)&&(re.current={signature:xe,t:F,entries:OKe(I,F)}),re.current.entries},[V,I,F]),X=f.useMemo(()=>new Map(se.map((xe,$e)=>[xe.id,$e])),[se]),J=f.useMemo(()=>SKe(I),[I]),[de,W]=f.useState(null),te=de!==null?((Un=se[de.currentIndex])==null?void 0:Un.id)??J:J,U=f.useMemo(()=>{var xe;if(d)return null;for(let $e=I.length-1;$e>=0;$e-=1){const Lt=I[$e];if(Lt&&(Lt.role==="tool_group"||Lt.role==="plan"))return null;if((Lt==null?void 0:Lt.role)==="assistant"&&!Lt.isStreaming&&((xe=Lt.content)!=null&&xe.trim()))return Lt.id}return null},[d,I]),ee=f.useMemo(()=>AKe(Q,d),[Q,d]),{collapseCompletedTurns:oe}=Lu(),Ce=oe??!0,[he,ye]=f.useState(()=>new Map),Ve=f.useRef(!0),it=f.useRef(!1),At=f.useRef(0),Ee=f.useRef(0),me=f.useRef(!1),bt=f.useRef(!1),et=f.useRef(0),qe=f.useRef(null),Ke=f.useRef(null),ke=f.useRef(!1),ne=f.useRef(null),gt=f.useRef(!1),We=f.useRef(r),tt=f.useRef(!!r),jt=f.useRef(void 0),jn=f.useRef(void 0),kn=f.useRef(w),Be=f.useRef(null),ht=f.useRef(i),ve=f.useRef(i),Me=f.useRef(!1),_e=f.useRef(!1),Xe=f.useRef(void 0),ue=f.useRef(void 0),Fe=f.useRef(void 0);ve.current=i;const kt=f.useRef(null),bn=f.useRef(!1),Pe=f.useRef(null),[yn,je]=f.useState(null);f.useLayoutEffect(()=>{if(!yn)return;const xe=kt.current;xe&&(xe.scrollTop=yn.scrollTop+Math.max(0,xe.scrollHeight-yn.scrollHeight)),me.current=!1,je(null)},[yn]),f.useEffect(()=>{o||(bn.current=!1,Pe.current=null)},[o]);const Ne=f.useCallback(()=>{const xe=kt.current,$e=xe?xe.scrollHeight-xe.scrollTop-xe.clientHeight:0,Lt=!Ve.current&&$e>1;Ke.current!==Lt&&(Ke.current=Lt,_==null||_(Lt))},[_]),ot=f.useCallback(()=>{Fe.current!==void 0&&window.cancelAnimationFrame(Fe.current),Fe.current=window.requestAnimationFrame(Ne)},[Ne]),pt=f.useCallback(xe=>{Ve.current!==xe&&(Ve.current=xe,ot())},[ot]),dn=f.useMemo(()=>KKe(Q,{overrides:he,isResponding:d,activeTurnStartedAt:h,pendingApprovalCallId:(n==null?void 0:n.toolCallId)??null,enabled:Ce}),[Q,he,d,h,n==null?void 0:n.toolCallId,Ce]),De=f.useMemo(()=>uie(dn),[dn]),sn=se.length>=JKe;f.useLayoutEffect(()=>{if(k){M(ln=>ln&&!1);return}const xe=kt.current;if(!xe)return;const $e=()=>{const Pt=xe.getBoundingClientRect().width>=1160;M(An=>An===Pt?An:Pt)};if($e(),typeof ResizeObserver>"u")return;const Lt=new ResizeObserver($e);return Lt.observe(xe),()=>Lt.disconnect()},[k]);const Dn=b!=null,os=!!r,st=!!m,St=st?1:0,Ht=St+dn.length,Ot=Ht+(Dn?1:0),Yt=ZKe(Ot,x),Pn=f.useCallback(()=>kt.current,[]),Hn=f.useCallback(()=>{const xe=kt.current;if(!xe)return;const Lt=xe.scrollHeight-xe.scrollTop-xe.clientHeight<B6;it.current=!Lt,pt(Lt),ot()},[ot,pt]),as=f.useCallback(()=>{At.current=Date.now()+1e3},[]),Bs=f.useCallback(()=>{_e.current=!0,Xe.current!==void 0&&window.cancelAnimationFrame(Xe.current),ue.current!==void 0&&window.clearTimeout(ue.current),Xe.current=window.requestAnimationFrame(Hn),ue.current=window.setTimeout(()=>{_e.current=!1,Xe.current=void 0,ue.current=void 0,Hn()},220)},[Hn]);f.useEffect(()=>()=>{Xe.current!==void 0&&window.cancelAnimationFrame(Xe.current),ue.current!==void 0&&window.clearTimeout(ue.current),Fe.current!==void 0&&window.cancelAnimationFrame(Fe.current),jt.current!==void 0&&window.cancelAnimationFrame(jt.current),jn.current!==void 0&&window.cancelAnimationFrame(jn.current)},[]);const fr=f.useCallback((xe,$e)=>{const Lt=kt.current;(!Lt||Lt.scrollHeight>Lt.clientHeight+1)&&(it.current=!0,pt(!1)),Bs(),ye(ln=>{const Pt=new Map(ln);return Pt.set(xe,$e),Pt})},[Bs,pt]),Gr=f.useCallback(xe=>{const $e=xe.target;$e instanceof HTMLElement&&$e.closest("[aria-expanded]")&&(it.current=!0,pt(!1),Bs())},[Bs,pt]),rs=f.useCallback(xe=>{if(st&&xe===P6)return"slot:header";if(Dn&&xe===Ht)return`slot:tail:${v}`;const $e=dn[xe-St];return $e?JF($e):`slot:row:${xe}`},[st,Dn,Ht,v,dn,St]),Vt=f.useCallback((xe="auto")=>{const $e=Pn();if(!$e||$e.scrollHeight<=$e.clientHeight)return;et.current+=1;const Lt=et.current;bt.current=!0,xe==="smooth"?$e.scrollTo({top:$e.scrollHeight,behavior:xe}):$e.scrollTop=$e.scrollHeight,ot(),Ee.current=Math.max(0,$e.scrollHeight-$e.clientHeight),Ne();const ln=()=>{et.current===Lt&&(bt.current=!1)};xe==="smooth"?setTimeout(ln,350):requestAnimationFrame(ln)},[Pn,Ne,ot]),Qn=f.useCallback((xe="smooth")=>{it.current=!1,pt(!0),Vt(xe)},[Vt,pt]),Rs=k0e({count:Ot,enabled:Yt,getScrollElement:Pn,getItemKey:rs,estimateSize:xe=>{if(st&&xe===P6)return YKe;if(Dn&&xe===Ht)return QKe;const $e=dn[xe-St];return($e==null?void 0:$e.type)==="turn_collapse"?XKe:($e==null?void 0:$e.type)==="turn_content"?Math.max(O6,$e.items.length*O6):O6},overscan:20,useFlushSync:!1,useAnimationFrameWithResizeObserver:!0}),pr=Rs.getVirtualItems(),hs=Rs.getTotalSize(),xr=f.useRef({entryIndexById:new Map,headerOffset:0,isVisible:!1,turnIdByDisplayIndex:[],visibleItems:[]});xr.current={entryIndexById:X,headerOffset:St,isVisible:V,turnIdByDisplayIndex:De,visibleItems:dn};const ci=f.useCallback(()=>{const xe=Pn(),$e=xr.current;if(!xe||!$e.isVisible||$e.entryIndexById.size===0){W(Vn=>Vn===null?Vn:null);return}const Lt=xe.getBoundingClientRect(),ln=Lt.top,Pt=Lt.bottom,An=ln+(Pt-ln)/2,Xn=[];let Mn=null,Gn=Number.POSITIVE_INFINITY;xe.querySelectorAll("[data-index]").forEach(Vn=>{const hn=Vn.dataset.index;if(hn===void 0)return;const Le=Number(hn);if(!Number.isFinite(Le))return;const Nt=Le-$e.headerOffset;if(Nt<0||Nt>=$e.visibleItems.length)return;const Tn=Vn.getBoundingClientRect();if(Tn.bottom<ln||Tn.top>Pt)return;Xn.push(Nt);const _n=Tn.top+(Tn.bottom-Tn.top)/2,cs=Math.abs(_n-An);cs<Gn&&(Gn=cs,Mn=Nt)});const Zn=WKe($e.visibleItems,Xn,$e.entryIndexById,Mn,$e.turnIdByDisplayIndex);W(Vn=>(Vn==null?void 0:Vn.startIndex)===(Zn==null?void 0:Zn.startIndex)&&(Vn==null?void 0:Vn.endIndex)===(Zn==null?void 0:Zn.endIndex)&&(Vn==null?void 0:Vn.currentIndex)===(Zn==null?void 0:Zn.currentIndex)?Vn:Zn)},[Pn]),_s=f.useCallback(()=>{qe.current!==null&&cancelAnimationFrame(qe.current),qe.current=requestAnimationFrame(()=>{qe.current=null,ci()})},[ci]);f.useEffect(()=>()=>{qe.current!==null&&(cancelAnimationFrame(qe.current),qe.current=null)},[]),f.useEffect(()=>{_s()},[_s,Ot,hs,Yt,pr.length,V]);const[Vs,ls]=f.useState(null);f.useEffect(()=>{if(!Vs)return;const xe=setTimeout(()=>ls(null),1600);return()=>clearTimeout(xe)},[Vs]);const Ws=f.useCallback((xe,$e)=>{var ln,Pt;it.current=!0,pt(!1),et.current+=1;const Lt=et.current;bt.current=!0,Yt?Rs.scrollToIndex(xe,{align:"center"}):(Pt=(ln=kt.current)==null?void 0:ln.querySelector(`[data-index="${xe}"]`))==null||Pt.scrollIntoView({block:"center"}),setTimeout(()=>{et.current===Lt&&(bt.current=!1,_s(),ot())},150),ls(null),requestAnimationFrame(()=>ls($e))},[Yt,Rs,pt,_s,ot]),Ss=f.useRef({visibleItems:[],displayItems:[],headerOffset:0,performScrollToRow:()=>{}});Ss.current={visibleItems:dn,displayItems:Q,headerOffset:St,performScrollToRow:Ws};const Xs=f.useRef(null),Cr=f.useCallback((xe,$e)=>{const{visibleItems:Lt,displayItems:ln,headerOffset:Pt,performScrollToRow:An}=Ss.current,Xn=Q2(Lt,xe,$e);if(Xn>=0){const Zn=Lt[Xn];return(Zn==null?void 0:Zn.type)==="turn_content"&&Zn.collapsed?(Xs.current={messageId:xe,callId:$e},ye(Vn=>{if(Vn.get(Zn.turnId)===!0)return Vn;const hn=new Map(Vn);return hn.set(Zn.turnId,!0),hn}),!0):(Xs.current=null,An(Xn+Pt,{messageId:xe,callId:$e}),!0)}const Mn=Q2(ln,xe,$e);if(Mn<0)return!1;const Gn=cie(ln,Mn);return Gn?(Xs.current={messageId:xe,callId:$e},ye(Zn=>{if(Zn.get(Gn)===!0)return Zn;const Vn=new Map(Zn);return Vn.set(Gn,!0),Vn}),!0):!1},[]);f.useImperativeHandle(z,()=>({scrollToMessage:Cr,scrollToBottom:Qn}),[Cr,Qn]),f.useEffect(()=>{const xe=Xs.current;if(!xe)return;const $e=Q2(dn,xe.messageId,xe.callId);$e<0||(Xs.current=null,Ws($e+St,xe))},[dn,St,Ws]);const Lr=f.useCallback(async(xe=!1)=>{const $e=kt.current;if(!$e||!u||a||me.current||bn.current&&!xe)return;bn.current=!1,me.current=!0;const Lt=$e.scrollHeight,ln=$e.scrollTop;it.current=!0;try{await u(),je({scrollHeight:Lt,scrollTop:ln})}catch{bn.current=!0,me.current=!1}},[a,u]),pe=f.useCallback(()=>{const xe=Pn();if(!xe)return;const $e=xe.scrollTop;if(o&&$e<=tq&&Lr(!0),bt.current){Ee.current=$e;return}_s();const Lt=Ee.current;Ee.current=$e;const ln=xe.scrollHeight-$e-xe.clientHeight;if(ot(),$e<Lt-1){const Pt=ln<B6,An=Date.now()<=At.current;Pt?(it.current=!1,pt(!0)):An?(it.current=!0,pt(!1)):it.current||pt(!1);return}ln<B6&&(it.current=!1,pt(!0))},[Pn,o,Lr,ot,_s,pt]);f.useEffect(()=>{const xe=Pn();if(xe)return xe.addEventListener("scroll",pe,{passive:!0}),()=>xe.removeEventListener("scroll",pe)},[Pn,pe]);const Ie=f.useCallback(()=>{if(!o||a||i||os)return;const xe=Pn();if(!xe||xe.scrollHeight>xe.clientHeight+1)return;const $e=Pe.current;if($e!==null&&$e.loader===u&&$e.totalVirtualSize===hs){bn.current=!0;return}Pe.current={loader:u,totalVirtualSize:hs},Lr()},[i,Pn,o,Lr,a,u,os,hs]);f.useEffect(()=>{Ie()},[Ie,hs]),f.useEffect(()=>{const xe=Pn();if(!xe)return;const $e=()=>{bn.current&&xe.scrollTop<=tq&&Lr(!0)},Lt=Xn=>{as(),Xn.deltaY<0&&$e()},ln=()=>{as(),$e()},Pt=Xn=>{const Mn=xe.getBoundingClientRect(),Gn=20;(Xn.clientX>=Mn.right-Gn||Xn.clientY>=Mn.bottom-Gn)&&as()},An=Xn=>{(Xn.key==="ArrowUp"||Xn.key==="ArrowDown"||Xn.key==="PageUp"||Xn.key==="PageDown"||Xn.key==="Home"||Xn.key==="End"||Xn.key===" ")&&(as(),(Xn.key==="ArrowUp"||Xn.key==="PageUp"||Xn.key==="Home")&&$e())};return xe.addEventListener("wheel",Lt,{passive:!0}),xe.addEventListener("touchstart",ln,{passive:!0}),xe.addEventListener("pointerdown",Pt,{passive:!0}),xe.addEventListener("keydown",An,{passive:!0}),()=>{xe.removeEventListener("wheel",Lt),xe.removeEventListener("touchstart",ln),xe.removeEventListener("pointerdown",Pt),xe.removeEventListener("keydown",An)}},[Pn,Lr,as]),f.useEffect(()=>{const xe=Pn();if(!xe||typeof ResizeObserver>"u")return;const $e=new ResizeObserver(()=>{ot(),Ie()});$e.observe(xe);for(const ln of Array.from(xe.children))$e.observe(ln);const Lt=new MutationObserver(ln=>{for(const Pt of ln){for(const An of Array.from(Pt.addedNodes))An instanceof HTMLElement&&$e.observe(An);for(const An of Array.from(Pt.removedNodes))An instanceof HTMLElement&&$e.unobserve(An)}ot()});return Lt.observe(xe,{childList:!0}),ot(),()=>{$e.disconnect(),Lt.disconnect()}},[Pn,Ie,ot]),f.useEffect(()=>{t.length===0&&(it.current=!1,pt(!0),Xs.current=null,ye(xe=>xe.size?new Map:xe))},[t.length,pt]),f.useEffect(()=>{const xe=kt.current;if(!xe)return;const $e=new ResizeObserver(()=>{_s(),!ve.current&&(it.current||(pt(!0),requestAnimationFrame(()=>{!ve.current&&!it.current&&Vt()})))});return $e.observe(xe),()=>$e.disconnect()},[Vt,_s,pt]),f.useLayoutEffect(()=>{const xe=kKe(t);if(i||r||We.current){ne.current=xe,ke.current=!0,gt.current=!1,We.current=r;return}if(We.current=r,!ke.current){ne.current=xe,ke.current=!0,gt.current=!1;return}const $e=_Ke(t);xe&&($e==null?void 0:$e.role)==="user"&&xe!==ne.current?(it.current=!1,pt(!0),Xs.current=null,gt.current=!0):gt.current=!1,ne.current=xe},[t,i,r,pt]),f.useLayoutEffect(()=>{ht.current&&!i&&(it.current=!1,pt(!0),Vt("auto")),ht.current=i},[i,Vt,pt]),f.useLayoutEffect(()=>{if(r){tt.current=!0;return}if(!tt.current||i||t.length===0)return;tt.current=!1,it.current=!1,pt(!0),Xs.current=null,jt.current!==void 0&&window.cancelAnimationFrame(jt.current),jn.current!==void 0&&window.cancelAnimationFrame(jn.current);const xe=()=>{ve.current||it.current||(pt(!0),Vt("auto"))};jt.current=window.requestAnimationFrame(()=>{jt.current=void 0,xe(),jn.current=window.requestAnimationFrame(()=>{jn.current=void 0,xe()})})},[i,r,t.length,Vt,pt]),f.useLayoutEffect(()=>{const xe=kn.current!==w;kn.current=w,xe&&(i||it.current||(pt(!0),requestAnimationFrame(()=>{!ve.current&&!it.current&&Vt("auto")})))},[w,i,Vt,pt]);const Ge=f.useMemo(()=>FKe(dn),[dn]);f.useLayoutEffect(()=>{if(!i){if(!Ge){Be.current=null;return}Ge!==Be.current&&(Be.current=Ge,(Ve.current||!it.current)&&requestAnimationFrame(()=>{it.current||(pt(!0),Vt())}))}},[i,Ge,Vt,pt]),f.useEffect(()=>{y&&Dn&&!Me.current&&(it.current=!1,pt(!0),requestAnimationFrame(()=>{it.current||Vt()})),Me.current=Dn},[y,Dn,Vt,pt]);const Xt=f.useCallback(xe=>{const $e=(Pt,An)=>{if(Pt.type==="parallel_agents")return l.jsx(N7,{timestamp:Pt.timestamp,children:l.jsx("div",{className:VA(Pt,Vs)?zf.flash:void 0,children:l.jsx(NGe,{agents:Pt.agents,pendingApproval:n})})});if(Pt.type==="turn_outputs")return l.jsx(nGe,{changes:Pt.changes,turnId:Pt.turnId,artifacts:Pt.artifacts,scheduledTasks:Pt.scheduledTasks,workspaceCwd:g,onOpenRequest:O,onReviewChanges:j??R6,onOpenArtifact:P??R6,onOpenScheduledTask:L??R6});if(Pt.type==="turn_collapse")return l.jsx(rYe,{turnCollapse:Pt.turnCollapse,onToggleCollapse:fr});if(Pt.type==="turn_content")return l.jsx(iYe,{collapsed:Pt.collapsed,children:Pt.items.map(Gn=>l.jsx("div",{className:sq(Gn),children:$e(Gn,!1)},JF(Gn)))});const Xn=Pt.message.role==="assistant"?ee.get(Pt.message.id):void 0;let Mn;return Pt.message.role==="assistant"&&Xn&&(Mn={turnId:Xn,message:{id:Pt.message.id,content:Pt.message.content,isStreaming:Pt.message.isStreaming,timestamp:Pt.message.timestamp}}),l.jsx(gWe,{message:Pt.message,pendingApproval:n,onShowContextDetail:s,workspaceCwd:g,isLatest:An,showRetryHint:T,onRetryClick:S,onBranchSession:C,showAssistantActions:Pt.message.role==="assistant"&&ee.has(Pt.message.id),showAssistantBranch:Pt.message.role==="assistant"&&Pt.message.id===U,isLocateFlashing:VA(Pt,Vs),assistantTurnFooterInfo:Mn,generateContent:$})};if(st&&xe===P6)return m;if(Dn&&xe===Ht)return b;const Lt=xe-St,ln=dn[Lt];return ln?$e(ln,Lt===dn.length-1):null},[st,m,Dn,b,Ht,n,s,$,St,dn,Vs,ee,U,g,T,S,C,fr,P,L,j,O]),Cn=f.useCallback(xe=>xe?sq(xe):void 0,[]);return f.useLayoutEffect(()=>{if(i)return;const xe=gt.current;bt.current&&!xe||_e.current&&!xe||(Ve.current||xe||!it.current)&&(it.current||pt(!0),Vt(xe?"smooth":"auto"),gt.current=!1)},[hs,t,Ot,i,Vt,pt]),f.useLayoutEffect(()=>{ot()},[t,ot,Ot,hs]),l.jsxs("div",{ref:kt,className:n4(ts.list,st&&p?ts.listWithWelcomeHeader:void 0),"data-web-shell-message-list":!0,onClickCapture:Gr,children:[os&&l.jsx(uYe,{label:F("editor.sessionLoading")}),a&&!os&&l.jsx("div",{className:ts.historyStatus,role:"status",children:F("history.loadingEarlier")}),c&&!os&&l.jsx("div",{className:ts.historyStatus,role:"status",children:F("history.capacityReached")}),l.jsx(lYe,{entries:se,currentTurnId:te,currentRange:de,hidden:!V||!sn,onSelect:Cr}),Yt?l.jsx("div",{className:ts.virtualSizer,style:{height:hs},children:pr.map(xe=>l.jsx("div",{"data-index":xe.index,ref:Rs.measureElement,className:n4(ts.virtualRow,Cn(dn[xe.index-St])),"data-web-shell-message-row":!0,style:{position:"absolute",top:0,left:0,right:0,transform:`translateY(${xe.start}px)`},children:Xt(xe.index)},xe.key))}):Array.from({length:Ot},(xe,$e)=>{const Lt=rs($e),ln=dn[$e-St];return l.jsx("div",{"data-index":$e,className:Cn(ln),"data-web-shell-message-row":!0,children:Xt($e)},Lt)})]})}));/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */function dYe(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 iq(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||!dYe(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 hYe="_editorShell_w8qpa_1",fYe="_editorShellDropdownOpen_w8qpa_7",mYe="_container_w8qpa_11",pYe="_content_w8qpa_30",gYe="_dacAura_w8qpa_46",bYe="_dacHalo_w8qpa_47",yYe="_atPortalLayer_w8qpa_188",xYe="_slashPanel_w8qpa_226",vYe="_slashPanelBody_w8qpa_235",wYe="_slashList_w8qpa_240",kYe="_slashEntry_w8qpa_267",_Ye="_slashSection_w8qpa_273",SYe="_slashSectionHeader_w8qpa_279",CYe="_slashSectionCount_w8qpa_292",TYe="_slashItem_w8qpa_300",EYe="_slashItemActive_w8qpa_326",AYe="_slashCommand_w8qpa_330",NYe="_slashDetail_w8qpa_335",jYe="_slashDetailCommand_w8qpa_345",MYe="_slashDetailText_w8qpa_355",IYe="_slashDescription_w8qpa_375",RYe="_atPanel_w8qpa_386",DYe="_atPanelHeaderWrap_w8qpa_410",LYe="_atPanelHeader_w8qpa_410",PYe="_atBackButton_w8qpa_425",OYe="_atPanelTitle_w8qpa_447",BYe="_atTabsWrap_w8qpa_456",$Ye="_atTabs_w8qpa_456",zYe="_atTab_w8qpa_456",FYe="_atTabScrollButton_w8qpa_480",qYe="_atTabActive_w8qpa_512",HYe="_atSearchInput_w8qpa_523",UYe="_atList_w8qpa_542",VYe="_atItem_w8qpa_570",WYe="_atItemActive_w8qpa_592",GYe="_atItemSingleLine_w8qpa_596",KYe="_atItemMain_w8qpa_602",YYe="_atItemLeading_w8qpa_613",XYe="_atItemIcon_w8qpa_623",QYe="_atItemImageIcon_w8qpa_634",JYe="_atItemIconSpin_w8qpa_642",ZYe="_atItemLabel_w8qpa_646",eXe="_atItemSubtitle_w8qpa_647",tXe="_atItemDescription_w8qpa_674",nXe="_atItemTrailing_w8qpa_685",sXe="_atEmpty_w8qpa_692",rXe="_attachments_w8qpa_710",iXe="_tags_w8qpa_720",oXe="_tag_w8qpa_720",aXe="_tagContent_w8qpa_743",lXe="_tagTooltip_w8qpa_751",cXe="_tagLabel_w8qpa_775",uXe="_tagValue_w8qpa_776",dXe="_tagIcon_w8qpa_780",hXe="_tagRemove_w8qpa_815",fXe="_editorArea_w8qpa_835",mXe="_shellPrefix_w8qpa_863",pXe="_toolbar_w8qpa_901",gXe="_toolbarLeading_w8qpa_911",bXe="_toolbarStart_w8qpa_912",yXe="_toolbarEnd_w8qpa_913",xXe="_toolbarLeft_w8qpa_914",vXe="_toolbarRight_w8qpa_915",wXe="_gitBranchChip_w8qpa_939",kXe="_gitBranchChipButton_w8qpa_956",_Xe="_gitBranchIcon_w8qpa_976",SXe="_gitBranchText_w8qpa_988",CXe="_gitBranchIconWrap_w8qpa_999",TXe="_gitBranchBadgeDot_w8qpa_1007",EXe="_gitBranchIndicators_w8qpa_1026",AXe="_gitBranchDirtyDot_w8qpa_1033",NXe="_gitBranchAheadBehind_w8qpa_1041",jXe="_gitBranchStash_w8qpa_1046",MXe="_gitBranchConflicted_w8qpa_1059",IXe="_gitBranchOperation_w8qpa_1073",RXe="_gitBranchTooltip_w8qpa_1081",DXe="_gitBranchTooltipTitle_w8qpa_1087",LXe="_gitBranchTooltipRow_w8qpa_1091",PXe="_workspaceChip_w8qpa_1097",OXe="_workspaceChipAccented_w8qpa_1116",BXe="_workspaceChipIcon_w8qpa_1120",$Xe="_workspaceChipText_w8qpa_1136",zXe="_toolbarRightCustom_w8qpa_1148",FXe="_toolbarMeasurements_w8qpa_1154",qXe="_dropdownWrapper_w8qpa_1165",HXe="_dropdownWrapperCompact_w8qpa_1169",UXe="_dropdownList_w8qpa_1174",VXe="_dropdownListConstrained_w8qpa_1184",WXe="_dropdownEmpty_w8qpa_1188",GXe="_dropdownItem_w8qpa_1195",KXe="_dropdownRich_w8qpa_1212",YXe="_dropdownCheck_w8qpa_1221",XXe="_dropdownItemActive_w8qpa_1233",QXe="_dropdownItemIcon_w8qpa_1238",JXe="_dropdownItemCheck_w8qpa_1239",ZXe="_dropdownItemContent_w8qpa_1256",eQe="_dropdownItemLabel_w8qpa_1263",tQe="_dropdownItemDesc_w8qpa_1273",nQe="_toolBtn_w8qpa_1287",sQe="_modeToolBtn_w8qpa_1305",rQe="_modelToolBtn_w8qpa_1306",iQe="_workspaceSelectTrigger_w8qpa_1315",oQe="_workspaceSelectTooltipTrigger_w8qpa_1333",aQe="_gitBranchChipCompact_w8qpa_1350",lQe="_workspaceChipCompact_w8qpa_1351",cQe="_workspaceSelectTriggerCompact_w8qpa_1352",uQe="_toolBtnCompact_w8qpa_1353",dQe="_workspaceSelectTooltipTriggerCompact_w8qpa_1363",hQe="_toolBtnText_w8qpa_1373",fQe="_toolBtnArrow_w8qpa_1374",mQe="_toolBtnIcon_w8qpa_1401",pQe="_widthModeBtn_w8qpa_1417",gQe="_quickActionsBtn_w8qpa_1426",bQe="_toolBtnModeIcon_w8qpa_1435",yQe="_toolBtnModelIcon_w8qpa_1436",xQe="_quickActionsPanel_w8qpa_1482",vQe="_quickActionsHeader_w8qpa_1495",wQe="_quickActionsLayout_w8qpa_1502",kQe="_quickActionsGrid_w8qpa_1509",_Qe="_quickAction_w8qpa_1426",SQe="_quickActionLabel_w8qpa_1540",CQe="_quickKeysGrid_w8qpa_1555",TQe="_quickKey_w8qpa_1555",EQe="_quickKeyLabel_w8qpa_1584",AQe="_sendBtn_w8qpa_1597",NQe="_sendBtnRunning_w8qpa_1635",jQe="_sendIcon_w8qpa_1648",MQe="_stopIcon_w8qpa_1654",IQe="_loadingIcon_w8qpa_1661",RQe="_sendBtnArmed_w8qpa_1673",DQe="_escLabel_w8qpa_1741",LQe="_srOnly_w8qpa_1749",PQe="_images_w8qpa_1771",OQe="_imageThumb_w8qpa_1779",BQe="_imageRemove_w8qpa_1794",$Qe="_searchPanel_w8qpa_1815",zQe="_searchBar_w8qpa_1832",FQe="_searchLabel_w8qpa_1840",qQe="_searchInput_w8qpa_1845",HQe="_searchResults_w8qpa_1859",UQe="_searchResult_w8qpa_1859",VQe="_searchResultActive_w8qpa_1892",WQe="_searchResultMarker_w8qpa_1897",GQe="_searchResultText_w8qpa_1902",KQe="_searchEmpty_w8qpa_1909",ge={editorShell:hYe,editorShellDropdownOpen:fYe,container:mYe,content:pYe,dacAura:gYe,dacHalo:bYe,atPortalLayer:yYe,slashPanel:xYe,slashPanelBody:vYe,slashList:wYe,slashEntry:kYe,slashSection:_Ye,slashSectionHeader:SYe,slashSectionCount:CYe,slashItem:TYe,slashItemActive:EYe,slashCommand:AYe,slashDetail:NYe,slashDetailCommand:jYe,slashDetailText:MYe,slashDescription:IYe,atPanel:RYe,atPanelHeaderWrap:DYe,atPanelHeader:LYe,atBackButton:PYe,atPanelTitle:OYe,atTabsWrap:BYe,atTabs:$Ye,atTab:zYe,atTabScrollButton:FYe,atTabActive:qYe,atSearchInput:HYe,atList:UYe,atItem:VYe,atItemActive:WYe,atItemSingleLine:GYe,atItemMain:KYe,atItemLeading:YYe,atItemIcon:XYe,atItemImageIcon:QYe,atItemIconSpin:JYe,atItemLabel:ZYe,atItemSubtitle:eXe,atItemDescription:tXe,atItemTrailing:nXe,atEmpty:sXe,attachments:rXe,tags:iXe,tag:oXe,tagContent:aXe,tagTooltip:lXe,tagLabel:cXe,tagValue:uXe,tagIcon:dXe,tagRemove:hXe,editorArea:fXe,shellPrefix:mXe,toolbar:pXe,toolbarLeading:gXe,toolbarStart:bXe,toolbarEnd:yXe,toolbarLeft:xXe,toolbarRight:vXe,gitBranchChip:wXe,gitBranchChipButton:kXe,gitBranchIcon:_Xe,gitBranchText:SXe,gitBranchIconWrap:CXe,gitBranchBadgeDot:TXe,gitBranchIndicators:EXe,gitBranchDirtyDot:AXe,gitBranchAheadBehind:NXe,gitBranchStash:jXe,gitBranchConflicted:MXe,gitBranchOperation:IXe,gitBranchTooltip:RXe,gitBranchTooltipTitle:DXe,gitBranchTooltipRow:LXe,workspaceChip:PXe,workspaceChipAccented:OXe,workspaceChipIcon:BXe,workspaceChipText:$Xe,toolbarRightCustom:zXe,toolbarMeasurements:FXe,dropdownWrapper:qXe,dropdownWrapperCompact:HXe,dropdownList:UXe,dropdownListConstrained:VXe,dropdownEmpty:WXe,dropdownItem:GXe,dropdownRich:KXe,dropdownCheck:YXe,dropdownItemActive:XXe,dropdownItemIcon:QXe,dropdownItemCheck:JXe,dropdownItemContent:ZXe,dropdownItemLabel:eQe,dropdownItemDesc:tQe,toolBtn:nQe,modeToolBtn:sQe,modelToolBtn:rQe,workspaceSelectTrigger:iQe,workspaceSelectTooltipTrigger:oQe,gitBranchChipCompact:aQe,workspaceChipCompact:lQe,workspaceSelectTriggerCompact:cQe,toolBtnCompact:uQe,workspaceSelectTooltipTriggerCompact:dQe,toolBtnText:hQe,toolBtnArrow:fQe,toolBtnIcon:mQe,widthModeBtn:pQe,quickActionsBtn:gQe,toolBtnModeIcon:bQe,toolBtnModelIcon:yQe,quickActionsPanel:xQe,quickActionsHeader:vQe,quickActionsLayout:wQe,quickActionsGrid:kQe,quickAction:_Qe,quickActionLabel:SQe,quickKeysGrid:CQe,quickKey:TQe,quickKeyLabel:EQe,sendBtn:AQe,sendBtnRunning:NQe,sendIcon:jQe,stopIcon:MQe,loadingIcon:IQe,sendBtnArmed:RQe,escLabel:DQe,srOnly:LQe,images:PQe,imageThumb:OQe,imageRemove:BQe,searchPanel:$Qe,searchBar:zQe,searchLabel:FQe,searchInput:qQe,searchResults:HQe,searchResult:UQe,searchResultActive:VQe,searchResultMarker:WQe,searchResultText:GQe,searchEmpty:KQe},YQe=["--chat-editor-accent-color","--chat-editor-text-primary","--accent","--background","--foreground","--muted-foreground","--chat-editor-border-color","--font-sans"];function XQe({menu:e,anchorRef:t,panelRef:n,onSelect:s,onAccept:r,onBack:i,onSearch:o,onSelectTab:a}){const c=Yd(),{t:u}=ut(),d=f.useRef([]),h=f.useRef(null),m=f.useRef(null),[p,g]=f.useState(null),[b,v]=f.useState({});f.useEffect(()=>{var _;(_=d.current[e.selectedIndex])==null||_.scrollIntoView({block:"nearest"})},[e.level,e.selectedIndex]),f.useEffect(()=>{if(e.level!=="items"||e.inputMode!=="search"||document.activeElement===h.current)return;const _=()=>{var N;return(N=h.current)==null?void 0:N.focus()},B=window.requestAnimationFrame(_),A=window.setTimeout(_,0);return()=>{window.cancelAnimationFrame(B),window.clearTimeout(A)}},[e.inputMode,e.level,e.selectedProviderId]),f.useLayoutEffect(()=>{const _=t.current;if(!_)return;const B=getComputedStyle(_);v(Object.fromEntries(YQe.map(A=>[A,B.getPropertyValue(A)])))},[t]),f.useLayoutEffect(()=>{const _=t.current;if(!_)return;let B=null;const A=()=>{var G;const P=_.getBoundingClientRect(),L=((G=n.current)==null?void 0:G.offsetWidth)??360,O=getComputedStyle(_),$=Number.parseFloat(O.getPropertyValue("--web-shell-popover-safe-top"))||48,z=Math.max(96,Math.min(300,P.top-$-8)),F={left:Math.max(12,Math.min(P.left+16,window.innerWidth-L-12)),bottom:window.innerHeight-P.top+8,width:P.width,maxHeight:z};g(I=>I&&I.left===F.left&&I.bottom===F.bottom&&I.width===F.width&&I.maxHeight===F.maxHeight?I:F)},N=()=>{B===null&&(B=window.requestAnimationFrame(()=>{B=null,A()}))};A();const j=new ResizeObserver(N);return j.observe(_),window.addEventListener("resize",N),window.addEventListener("scroll",N,!0),()=>{B!==null&&window.cancelAnimationFrame(B),j.disconnect(),window.removeEventListener("resize",N),window.removeEventListener("scroll",N,!0)}},[t,n]);const x=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===yo?void 0:_.description??_.detail,icon:_.icon,iconMode:_.iconMode,iconColor:_.iconColor,iconSpin:_.iconSpin,iconTooltip:_.iconTooltip,trailing:_.kind==="directory"||_.kind==="mcp-server"?"›":"",item:_}));if(f.useEffect(()=>{d.current.length=x.length},[x.length]),!p)return null;const y=e.providers.find(_=>_.id===e.selectedProviderId),w=e.itemMode==="mcpResources"&&e.mcpServerName?Nr(e.mcpServerName)??"[invalid]":(y==null?void 0:y.label)??"",k=e.itemMode==="mcpResources"&&e.mcpServerName?Nr(e.mcpServerName)??"[invalid]":(y==null?void 0:y.textValue)??"",T=e.level==="items"?(y==null?void 0:y.textValue)??u("at.menu"):u("at.menu"),S="at-mention-listbox",C=e.selectedIndex>=0&&e.selectedIndex<x.length?`at-mention-option-${e.selectedIndex}`:void 0;return ju.createPortal(l.jsx("div",{className:ge.atPortalLayer,style:b,children:l.jsxs("div",{ref:n,className:ge.atPanel,"data-at-mention-panel":"true",style:{...b,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"&&l.jsxs("div",{className:ge.atPanelHeaderWrap,children:[l.jsxs("div",{className:ge.atPanelHeader,children:[l.jsx("button",{type:"button",className:ge.atBackButton,"aria-label":u("common.back"),onMouseDown:_=>{_.preventDefault(),_.stopPropagation()},onClick:_=>{_.preventDefault(),_.stopPropagation(),i()},children:"‹"}),l.jsx("span",{className:ge.atPanelTitle,title:k,children:w})]}),l.jsx("input",{ref:h,className:ge.atSearchInput,value:e.query,placeholder:u("common.search"),"aria-label":u("common.search"),"aria-controls":S,"aria-activedescendant":C,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(),x.length===0)return;s(Math.max(0,e.selectedIndex-1))}else if(_.key==="ArrowDown"){if(_.preventDefault(),_.stopPropagation(),x.length===0)return;s(Math.min(x.length-1,e.selectedIndex+1))}}}}),e.tabs&&e.tabs.length>0&&l.jsxs("div",{className:ge.atTabsWrap,children:[l.jsx("button",{type:"button",className:ge.atTabScrollButton,"aria-label":"Previous tab",onClick:_=>{_.preventDefault(),_.stopPropagation(),oq(m.current,"previous")},children:"‹"}),l.jsx("div",{ref:m,className:ge.atTabs,role:"tablist",children:e.tabs.map(_=>{const B=_.id===e.selectedTabId,A=_.textValue??(typeof _.label=="string"?_.label:_.id);return l.jsx("button",{type:"button",role:"tab","aria-selected":B,disabled:_.disabled,className:`${ge.atTab} ${B?ge.atTabActive:""}`,title:A,onClick:N=>{N.preventDefault(),N.stopPropagation(),a(_.id)},children:_.label},_.id)})}),l.jsx("button",{type:"button",className:ge.atTabScrollButton,"aria-label":"Next tab",onClick:_=>{_.preventDefault(),_.stopPropagation(),oq(m.current,"next")},children:"›"})]})]}),l.jsx("div",{id:S,className:ge.atList,role:x.length>0?"listbox":void 0,"aria-label":x.length>0?T:void 0,children:e.loading&&x.length===0?l.jsx("div",{className:ge.atEmpty,role:"status","aria-live":"polite",children:u("common.loading")}):x.length===0?l.jsx("div",{className:ge.atEmpty,role:"status","aria-live":"polite",children:u("common.noResults")}):x.map((_,B)=>{const A=B===e.selectedIndex,N="item"in _?y==null?void 0:y.provider:_.provider.provider;let j;if("item"in _&&(N!=null&&N.renderItem))try{j=N.renderItem({item:_.item,provider:N,selected:A})}catch(L){console.warn("[WebShell] at mention item render failed",L)}const P="icon"in _&&_.icon&&P1(_.icon)?_.icon:void 0;return l.jsxs("button",{ref:L=>{d.current[B]=L},type:"button",id:`at-mention-option-${B}`,role:"option","aria-selected":A,className:`${ge.atItem} ${A?ge.atItemActive:""} ${_.description?"":ge.atItemSingleLine}`,style:{"--at-item-main-template":QQe(JQe(_.label,_.labelTitle),"subtitle"in _?_.subtitle:void 0)},onMouseEnter:()=>s(B),onMouseDown:L=>{L.preventDefault(),L.stopPropagation()},onClick:L=>{L.preventDefault(),L.stopPropagation(),r(B)},children:[j??l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:ge.atItemMain,children:[l.jsxs("span",{className:ge.atItemLeading,children:["icon"in _&&P&&(_.iconMode==="image"?l.jsx("img",{className:ge.atItemImageIcon,src:P,title:_.iconTooltip,alt:"","aria-hidden":"true"}):l.jsx("span",{className:`${ge.atItemIcon} ${_.iconSpin?ge.atItemIconSpin:""}`,style:{...Kh("--at-item-icon-url",P),color:_.iconColor},title:_.iconTooltip,"aria-hidden":"true"})),l.jsx("span",{className:ge.atItemLabel,title:_.labelTitle,children:_.label})]}),"subtitle"in _&&_.subtitle&&l.jsx("span",{className:ge.atItemSubtitle,title:_.subtitle,children:_.subtitle})]}),_.description&&l.jsx("span",{className:ge.atItemDescription,title:_.description,children:_.description})]}),_.trailing&&l.jsx("span",{className:ge.atItemTrailing,"aria-hidden":"true",children:_.trailing})]},_.id)})})]})}),c??document.body)}function oq(e,t){if(!e)return;const n=Math.max(96,e.clientWidth*.75);e.scrollBy({left:t==="previous"?-n:n,behavior:"smooth"})}function QQe(e,t){if(!t)return"minmax(0, 1fr)";const n=aq(e);return aq(t)<=12?"minmax(0, 1fr) max-content":n<=18?"max-content minmax(0, 1fr)":"minmax(0, 3fr) minmax(0, 2fr)"}function JQe(e,t){return typeof e=="string"?e:typeof e=="number"?String(e):t||""}function aq(e){return Array.from(e).reduce((t,n)=>t+(n.charCodeAt(0)>255?2:1),0)}const ZQe="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",eJe="/assets/default-aEtf0G7-.svg",fie="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",tJe="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",nJe="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",sJe="_icon_i7y0u_1",rJe={icon:sJe},iJe={auto:ZQe,"auto-edit":fie,default:eJe,plan:tJe,yolo:nJe};function ly({mode:e}){const t=iJe[e];return t?l.jsx("span",{className:rJe.icon,style:Kh("--mode-icon-url",t),"aria-hidden":"true"}):l.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:l.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 oJe(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,c=a&&i>0;return s=o??s,{showHeader:a,showDivider:c,count:a&&o?n.get(o)??0:0}})}function Yh(e){return e.replace(/\([^()]+\)$/,"")}/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */const z6=16e3,aJe=4096,lq=6e4;function lJe(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 cJe="qwen-bearer.",uJe="qwen-ws";function dJe(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`${cJe}${s}`}function hJe(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 fJe(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 mJe(e){const{baseUrl:t,token:n,onFinal:s,onError:r}=e,[i,o]=f.useState("idle"),[a,c]=f.useState(""),[u,d]=f.useState(0),[h,m]=f.useState(void 0),p=f.useRef({}),g=f.useRef(!0),b=f.useRef(0),v=f.useRef("idle"),x=f.useRef(s);x.current=s;const y=f.useRef(r);y.current=r;const w=f.useCallback(j=>{v.current=j,o(j)},[]),k=f.useCallback(()=>{const j=p.current;j.transcribeTimeout&&(clearTimeout(j.transcribeTimeout),j.transcribeTimeout=void 0)},[]),T=f.useCallback(()=>{var P;const j=p.current;j.processor&&(j.processor.onaudioprocess=null);for(const L of[j.processor,j.source,j.sink])try{L==null||L.disconnect()}catch{}(P=j.stream)==null||P.getTracks().forEach(L=>L.stop()),j.context&&j.context.state!=="closed"&&j.context.close().catch(()=>{}),j.processor=void 0,j.sink=void 0,j.source=void 0,j.stream=void 0,j.context=void 0},[]),S=f.useCallback(()=>{b.current++,T();const j=p.current;if(k(),j.ws){try{j.ws.onmessage=null,j.ws.onerror=null,j.ws.onclose=null,j.ws.close()}catch{}j.ws=void 0}},[T,k]),C=f.useCallback((j,P)=>{var L;!g.current||P!==void 0&&b.current!==P||(S(),w("error"),c(""),d(0),m(j),(L=y.current)==null||L.call(y,j))},[S,w]),_=f.useCallback((j,P)=>{P!==void 0&&b.current!==P||(S(),g.current&&(w("idle"),c(""),d(0),x.current(j)))},[S,w]),B=f.useCallback(()=>{if(v.current!=="idle"&&v.current!=="error")return;m(void 0),c(""),w("connecting");const j=++b.current,P=()=>!g.current||b.current!==j;(async()=>{var L;try{if(!((L=navigator.mediaDevices)!=null&&L.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 O;try{O=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0}})}catch(Q){throw new Error(hJe(Q))}if(P()){O.getTracks().forEach(Q=>Q.stop());return}p.current.stream=O;const $=new AudioContext({sampleRate:z6});if($.sampleRate!==z6)throw O.getTracks().forEach(Q=>Q.stop()),$.close().catch(()=>{}),new Error(`Browser audio rate ${$.sampleRate} Hz is not the required ${z6} Hz.`);if(p.current.context=$,$.state==="suspended"&&await $.resume(),P()){O.getTracks().forEach(Q=>Q.stop()),$.close().catch(()=>{});return}const z=$.createMediaStreamSource(O),F=$.createScriptProcessor(aJe,1,1),G=$.createGain();G.gain.value=0,p.current.source=z,p.current.processor=F,p.current.sink=G;const I=new WebSocket(lJe(t),n?[uJe,dJe(n)]:void 0);I.binaryType="arraybuffer",p.current.ws=I,F.onaudioprocess=Q=>{const{pcm:V,level:M}=fJe(Q.inputBuffer.getChannelData(0));g.current&&d(M),I.readyState===WebSocket.OPEN&&I.send(V)},I.onopen=()=>{if(P()){F.onaudioprocess=null;for(const V of[F,z,G])try{V.disconnect()}catch{}O.getTracks().forEach(V=>V.stop()),$.state!=="closed"&&$.close().catch(()=>{});const Q=p.current;Q.ws===I&&(Q.ws=void 0),Q.processor===F&&(Q.processor=void 0),Q.source===z&&(Q.source=void 0),Q.sink===G&&(Q.sink=void 0),Q.stream===O&&(Q.stream=void 0),Q.context===$&&(Q.context=void 0);try{I.close()}catch{}return}I.send(JSON.stringify({type:"start"})),z.connect(F),F.connect(G),G.connect($.destination),k(),p.current.transcribeTimeout=setTimeout(()=>{v.current==="recording"&&C("No response from server. Check that the voice model is running.",j)},lq),g.current&&w("recording")},I.onmessage=Q=>{(v.current==="connecting"||v.current==="recording")&&k();let V;try{V=JSON.parse(String(Q.data))}catch{return}V.type==="interim"?g.current&&c(V.text??""):V.type==="final"?_(V.text??"",j):V.type==="error"&&C(V.message??V.text??"Voice transcription failed.",j)},I.onerror=()=>{},I.onclose=Q=>{if(g.current&&(v.current==="recording"||v.current==="connecting"||v.current==="transcribing")){const V=Q.code||1006,M=Q.reason||"none";C(`Voice connection closed (code=${V}, reason=${M}).`,j)}}}catch(O){C(O instanceof Error?O.message:String(O),j)}})()},[t,n,C,_,w,k]),A=f.useCallback(()=>{const j=p.current.ws;if(!j||j.readyState!==WebSocket.OPEN){S(),w("idle");return}T(),d(0),w("transcribing");const P=b.current;try{j.send(JSON.stringify({type:"stop"})),k(),p.current.transcribeTimeout=setTimeout(()=>{v.current==="transcribing"&&C("Transcription timed out.",P)},lq)}catch{C("Failed to finalize voice transcription.",P)}},[S,T,C,w,k]),N=f.useCallback(()=>{const j=p.current.ws;if(j&&j.readyState===WebSocket.OPEN)try{j.send(JSON.stringify({type:"abort"}))}catch{}S(),w("idle"),c(""),d(0)},[S,w]);return f.useEffect(()=>(g.current=!0,()=>{g.current=!1,S()}),[S]),{status:i,interimText:a,audioLevel:u,errorMessage:h,start:B,stop:A,abort:N}}const pJe="_root_9hwm9_7",gJe="_iconBtn_9hwm9_14",bJe="_error_9hwm9_47",yJe="_connecting_9hwm9_51",xJe="_pill_9hwm9_56",vJe="_transcribing_9hwm9_75",wJe="_recDot_9hwm9_79",kJe="_wave_9hwm9_88",_Je="_bar_9hwm9_95",SJe="_time_9hwm9_103",CJe="_stop_9hwm9_111",TJe="_spinner_9hwm9_118",EJe="_interim_9hwm9_128",Po={root:pJe,iconBtn:gJe,error:bJe,connecting:yJe,pill:xJe,transcribing:vJe,recDot:wJe,wave:kJe,bar:_Je,time:SJe,stop:CJe,spinner:TJe,interim:EJe},AJe="voice_transcribe",cq=16,NJe=()=>l.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24","aria-hidden":"true",fill:"currentColor",children:[l.jsx("path",{d:"M12 14a3 3 0 0 0 3-3V6a3 3 0 0 0-6 0v5a3 3 0 0 0 3 3Z"}),l.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"})]}),jJe=()=>l.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24","aria-hidden":"true",fill:"currentColor",children:l.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})});function MJe(e){const t=Math.floor(e/1e3),n=Math.floor(t/60),s=String(t%60).padStart(2,"0");return`${n}:${s}`}function IJe({onInsert:e,disabled:t}){var N;const n=dc(),{t:s}=ut(),r=((N=n.capabilities)==null?void 0:N.features)??[],[i,o]=f.useState(void 0),{status:a,interimText:c,audioLevel:u,errorMessage:d,start:h,stop:m,abort:p}=mJe({baseUrl:n.baseUrl,token:n.token,onFinal:j=>{const P=j.trim();P?(o(void 0),e(P)):o(s("voice.noSpeech"))}}),g=a==="recording",[b,v]=f.useState(()=>new Array(cq).fill(0));f.useEffect(()=>{if(!g){v(new Array(cq).fill(0));return}v(j=>[...j.slice(1),Math.min(1,u*8)])},[u,g]);const[x,y]=f.useState(0);if(f.useEffect(()=>{if(!g){y(0);return}const j=performance.now(),P=setInterval(()=>y(performance.now()-j),200);return()=>clearInterval(P)},[g]),!r.includes(AJe))return null;const w=a==="connecting",k=a==="transcribing",T=a==="error",S=!!i&&!T,C=g||w,_=g?s("voice.stopDictation"):k?s("voice.transcribing"):w?s("voice.starting"):T?s("voice.errorRetry",{message:d??""}):s(S?"voice.noSpeechRetry":"voice.startDictation");let B;if(g)B=l.jsxs("button",{type:"button",className:Po.pill,onClick:()=>m(),"aria-label":_,title:_,children:[l.jsx("span",{className:Po.recDot,"aria-hidden":"true"}),l.jsx("span",{className:Po.wave,"aria-hidden":"true",children:b.map((j,P)=>l.jsx("span",{className:Po.bar,style:{height:`${2+Math.round(j*14)}px`}},P))}),l.jsx("span",{className:Po.time,children:MJe(x)}),l.jsx("span",{className:Po.stop,"aria-hidden":"true",children:l.jsx(jJe,{})})]});else if(k)B=l.jsxs("span",{className:`${Po.pill} ${Po.transcribing}`,role:"status","aria-label":_,children:[l.jsx("span",{className:Po.spinner,"aria-hidden":"true"}),l.jsx("span",{className:Po.time,children:"…"})]});else{const j=[Po.iconBtn,T?Po.error:"",w?Po.connecting:""].filter(Boolean).join(" ");B=l.jsx("button",{type:"button",className:j,onClick:()=>{if(w)p();else{if(t)return;o(void 0),h()}},disabled:!!t&&!C,"aria-label":_,title:d??i??_,children:l.jsx(NJe,{})})}const A=g&&c||T||S;return l.jsxs("span",{className:Po.root,children:[B,A&&l.jsx("span",{role:"status","aria-live":"polite",className:`${Po.interim}${T?` ${Po.error}`:""}`,children:T?d||s("voice.error"):S?i:c})]})}function F1({delayDuration:e=0,...t}){return l.jsx(Ree,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function q1({...e}){return l.jsx(Dee,{"data-slot":"tooltip",...e})}function H1({...e}){return l.jsx(Lee,{"data-slot":"tooltip-trigger",...e})}function U1({className:e,sideOffset:t=0,children:n,...s}){const r=Yd();return l.jsx(Pee,{container:r??void 0,children:l.jsxs(Oee,{"data-slot":"tooltip-content",sideOffset:t,className:Kt("z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md border border-border bg-popover px-3 py-1.5 text-xs text-popover-foreground 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,l.jsx(O7e,{className:"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] fill-popover"})]})})}function RJe(){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[l.jsx("circle",{cx:"6",cy:"5",r:"2.5",stroke:"currentColor",strokeWidth:"1.8"}),l.jsx("circle",{cx:"18",cy:"6",r:"2.5",stroke:"currentColor",strokeWidth:"1.8"}),l.jsx("circle",{cx:"6",cy:"19",r:"2.5",stroke:"currentColor",strokeWidth:"1.8"}),l.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 mie(e){const t=(e==null?void 0:e.staged)??0,n=(e==null?void 0:e.unstaged)??0,s=(e==null?void 0:e.untracked)??0,r=(e==null?void 0:e.conflicted)??0;return{detached:(e==null?void 0:e.detached)??!1,staged:t,unstaged:n,untracked:s,conflicted:r,ahead:(e==null?void 0:e.ahead)??0,behind:(e==null?void 0:e.behind)??0,stashCount:(e==null?void 0:e.stashCount)??0,operation:e==null?void 0:e.operation,dirty:t+n+s+r>0}}function DJe(e){return e.conflicted>0?"error":e.operation||e.detached?"warning":e.dirty?"accent":null}function WA({branch:e,status:t,compact:n}){const{t:s}=ut(),r=mie(t),i=DJe(r);return l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:ge.gitBranchIconWrap,children:[l.jsx("span",{className:ge.gitBranchIcon,children:r.detached?l.jsx(Vme,{}):l.jsx(RJe,{})}),n&&i&&l.jsx("span",{className:ge.gitBranchBadgeDot,"data-tone":i,"aria-hidden":"true"})]}),l.jsx("span",{className:ge.gitBranchText,children:e}),!n&&l.jsxs("span",{className:ge.gitBranchIndicators,"aria-hidden":"true",children:[r.operation&&l.jsx("span",{className:ge.gitBranchOperation,children:s(`git.operation.${r.operation}`)}),r.conflicted>0&&l.jsxs("span",{className:ge.gitBranchConflicted,children:[l.jsx(Jpe,{}),r.conflicted]}),r.dirty&&l.jsx("span",{className:ge.gitBranchDirtyDot}),r.ahead>0&&l.jsxs("span",{className:ge.gitBranchAheadBehind,children:["↑",r.ahead]}),r.behind>0&&l.jsxs("span",{className:ge.gitBranchAheadBehind,children:["↓",r.behind]}),r.stashCount>0&&l.jsxs("span",{className:ge.gitBranchStash,children:[l.jsx(hpe,{}),r.stashCount]})]})]})}function pie({branch:e,status:t,compact:n=!1,onOpenDiff:s}){const{t:r}=ut(),i=mie(t),o=[];i.operation&&o.push(r(`git.operation.${i.operation}`)),i.detached&&o.push(r("git.detached")),i.conflicted>0&&o.push(r("git.conflicted",{count:i.conflicted})),i.staged>0&&o.push(r("git.staged",{count:i.staged})),i.unstaged>0&&o.push(r("git.unstaged",{count:i.unstaged})),i.untracked>0&&o.push(r("git.untracked",{count:i.untracked})),i.ahead>0&&o.push(r("git.ahead",{count:i.ahead})),i.behind>0&&o.push(r("git.behind",{count:i.behind})),i.stashCount>0&&o.push(r("git.stash",{count:i.stashCount}));const a=o.length>0?`${r("git.currentBranch",{branch:e})} — ${o.join(", ")}`:(t==null?void 0:t.computedAt)!==void 0?`${r("git.currentBranch",{branch:e})} — ${r("git.clean")}`:r("git.currentBranch",{branch:e}),c=`${ge.gitBranchChip} ${n?ge.gitBranchChipCompact:""} ${s?ge.gitBranchChipButton:""}`,u={"data-web-shell-git-branch":!0,"data-detached":i.detached?"true":void 0,"data-dirty":i.dirty?"true":void 0,"data-operation":i.operation??void 0,"data-clickable":s?"true":void 0},d=l.jsx(WA,{branch:e,status:t,compact:n});return l.jsx(F1,{delayDuration:300,children:l.jsxs(q1,{children:[l.jsx(H1,{asChild:!0,children:s?l.jsx("button",{type:"button",className:c,"aria-label":a,onClick:s,...u,children:d}):l.jsx("output",{className:c,"aria-label":a,...u,children:d})}),l.jsx(U1,{side:"top",children:l.jsxs("div",{className:ge.gitBranchTooltip,children:[l.jsx("div",{className:ge.gitBranchTooltipTitle,children:i.detached?`${r("git.detached")} (${e})`:e}),o.length>0?o.map(h=>l.jsx("div",{className:ge.gitBranchTooltipRow,children:h},h)):(t==null?void 0:t.computedAt)!==void 0?l.jsx("div",{className:ge.gitBranchTooltipRow,children:r("git.clean")}):null]})})]})})}const LJe="_red_179c6_21",PJe="_orange_179c6_24",OJe="_yellow_179c6_27",BJe="_green_179c6_30",$Je="_blue_179c6_33",zJe="_purple_179c6_36",AI={red:LJe,orange:PJe,yellow:OJe,green:BJe,blue:$Je,purple:zJe};function FJe(){return l.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:l.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 qJe({name:e,title:t,ariaLabel:n,color:s,compact:r=!1}){const i=[ge.workspaceChip,r?ge.workspaceChipCompact:"",s?AI[s]:"",s?ge.workspaceChipAccented:""].filter(Boolean).join(" ");return l.jsx(F1,{delayDuration:300,children:l.jsxs(q1,{children:[l.jsx(H1,{asChild:!0,children:l.jsxs("output",{className:i,"aria-label":n,"data-web-shell-workspace":!0,"data-web-shell-workspace-title":t,children:[l.jsx("span",{className:ge.workspaceChipIcon,children:l.jsx(FJe,{})}),l.jsx("span",{className:ge.workspaceChipText,children:e})]})}),l.jsx(U1,{side:"top",children:t})]})})}function HJe(e,t){const n=t.trim().toLocaleLowerCase();return n?e.filter(s=>`${s.label}
${s.searchText??""}`.toLocaleLowerCase().includes(n)):[...e]}function uq({availableWidth:e,items:t}){const n=Object.fromEntries(t.map(r=>[r.id,r.ready!==!1]));let s=t.reduce((r,i)=>r+(n[i.id]?i.expansionWidth:0),0);for(const r of t){if(s<=e)break;n[r.id]&&(n[r.id]=!1,s-=r.expansionWidth)}return n}function UJe({availableWidth:e,items:t,currentVisibility:n,expansionMargin:s}){const r=uq({availableWidth:e,items:t}),i=uq({availableWidth:Math.max(0,e-s),items:t});return Object.fromEntries(t.map(o=>[o.id,n[o.id]?r[o.id]:i[o.id]]))}function VJe({toolbarWidth:e,leadingWidth:t,rightWidth:n,currentExpansionWidth:s,gap:r}){const i=Math.max(0,t-s);return Math.max(0,e-n-i-r)}function WJe({currentModelLabel:e,lastConfirmedModelLabel:t}){const n=e||t;return{modelLabel:n,modelLabelReady:!!n,nextConfirmedModelLabel:n}}const GJe=["approvalMode","gitBranch","model","widthMode","voice","workspace"],KJe=new Set(GJe),YJe={"&":{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 dq(){return typeof window>"u"?!1:typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window.matchMedia=="function"&&window.matchMedia("(hover: none), (pointer: coarse)").matches}function XJe({tag:e,content:t,tooltip:n,onActivate:s,onRemove:r}){const i=f.useRef(null),o=Yd(),a=n!=null,c=l.jsx("span",{className:ge.tagContent,"data-web-shell-composer-tag-trigger":!0,role:s?"button":void 0,tabIndex:s||a?0:void 0,onClick:d=>{var h;s&&(d.stopPropagation(),s(((h=i.current)==null?void 0:h.getBoundingClientRect())??d.currentTarget.getBoundingClientRect()))},onKeyDown:d=>{var h;s&&(d.key!=="Enter"&&d.key!==" "||(d.preventDefault(),s(((h=i.current)==null?void 0:h.getBoundingClientRect())??d.currentTarget.getBoundingClientRect())))},children:t}),u=l.jsxs("span",{ref:i,className:ge.tag,"data-web-shell-composer-tag":!0,children:[a?l.jsx(Lee,{asChild:!0,children:c}):c,r&&l.jsx("button",{type:"button",className:ge.tagRemove,"aria-label":`Remove ${hI(e)}`,onMouseDown:d=>d.preventDefault(),onClick:d=>{d.stopPropagation(),r()},onKeyDown:d=>{if(d.key==="Enter"||d.key===" "){d.stopPropagation();return}d.key!=="Backspace"&&d.key!=="Delete"||(d.preventDefault(),d.stopPropagation(),r())},children:"×"})]});return a?l.jsxs(Dee,{disableHoverableContent:!1,children:[u,l.jsx(Pee,{container:o??void 0,children:l.jsx(Oee,{className:ge.tagTooltip,"data-web-shell-composer-tag-tooltip":!0,sideOffset:6,collisionPadding:8,avoidCollisions:!0,children:n})})]}):u}function QJe(){return l.jsx("svg",{className:ge.sendIcon,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:l.jsx("path",{d:"M10 15.5v-11M5.5 9 10 4.5 14.5 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function JJe(){return l.jsx("span",{className:ge.stopIcon,"aria-hidden":"true"})}function ZJe(){return l.jsx("span",{className:ge.loadingIcon,"aria-hidden":"true"})}function eZe(){return l.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[7,12,17].flatMap(e=>[7,12,17].map(t=>l.jsx("circle",{cx:t,cy:e,r:"1.35",fill:"currentColor"},`${t}-${e}`)))})}function tZe(e,t){let n,s,r,i,o=0,a=0;const c=(b,v)=>{e.style.setProperty("--dac-glow-on",b.toFixed(4)),e.style.setProperty("--dac-glow-pulse",v.toFixed(4))},u=b=>{n!==void 0&&window.cancelAnimationFrame(n);const v=o,x=b-v;if(Math.abs(x)<.001){o=b,c(b,a);return}const y=performance.now(),w=k=>{const T=Math.min((k-y)/220,1);o=v+x*(1-(1-T)**2),c(o,a),n=T<1?window.requestAnimationFrame(w):void 0};n=window.requestAnimationFrame(w)},d=()=>{s!==void 0&&window.cancelAnimationFrame(s);const b=a,v=performance.now(),x=y=>{const w=Math.min((y-v)/300,1);a=b*(1-w),c(o,a),s=w<1?window.requestAnimationFrame(x):void 0};s=window.requestAnimationFrame(x)},h=b=>{b?e.setAttribute("data-dac-typing",""):e.removeAttribute("data-dac-typing")},m=()=>u(1),p=()=>{u(0),h(!1),i!==void 0&&window.clearTimeout(i)},g=()=>{s!==void 0&&window.cancelAnimationFrame(s),r!==void 0&&window.clearTimeout(r),a=1,c(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",m),t.addEventListener("blur",p),t.addEventListener("keydown",g),document.activeElement===t&&u(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",m),t.removeEventListener("blur",p),t.removeEventListener("keydown",g),c(0,0),h(!1)}}function nZe({mode:e}){return e==="wide"?l.jsxs("svg",{viewBox:"0 0 1024 1024","aria-hidden":"true",children:[l.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)"}),l.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)"})]}):l.jsx("svg",{viewBox:"0 0 1024 1024","aria-hidden":"true",children:l.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 F6(){return l.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[l.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"}),l.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 sZe(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 rZe=[{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 iZe(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"m3 8.3 3.1 3.1L13 4.6",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}function gie(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 oZe(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]??gie(e,t)}function hq({open:e,items:t,activeId:n,onOpenChange:s,onSelect:r,trigger:i,tooltip:o,showCheck:a=!1,searchable:c=!1,searchLabel:u,noResultsLabel:d}){const[h,m]=f.useState(""),[p,g]=f.useState(null),b=f.useRef(!1),v=f.useRef(!1),x=f.useRef(null),y=t.some(T=>T.description||T.icon),w=c?HJe(t,h):t;f.useEffect(()=>{e||m("")},[e]);const k=y||a;return l.jsxs(Ax,{open:e,onOpenChange:T=>{var S;T&&(b.current=!1,v.current=!1,g(((S=x.current)==null?void 0:S.closest("[data-web-shell-root]"))??null)),s(T)},children:[o?l.jsx(F1,{delayDuration:300,children:l.jsxs(q1,{children:[l.jsx(H1,{asChild:!0,children:l.jsx(yS,{ref:x,asChild:!0,children:i})}),l.jsx(U1,{side:"top",children:o})]})}):l.jsx(yS,{ref:x,asChild:!0,children:i}),l.jsxs(Nx,{side:"top",align:"start",collisionPadding:8,collisionBoundary:p??void 0,"data-web-shell-toolbar-popover":!0,onClick:T=>T.stopPropagation(),onPointerDownOutside:T=>{const S=T.target;S instanceof Element&&S.closest("[data-web-shell-toolbar-popover-trigger]")&&(v.current=!0)},onCloseAutoFocus:T=>{if(v.current){T.preventDefault(),v.current=!1;return}if(document.activeElement instanceof HTMLElement&&document.activeElement.closest("[data-web-shell-toolbar-popover]")){T.preventDefault();return}b.current&&(T.preventDefault(),b.current=!1)},children:[c&&l.jsx(li,{type:"search",value:h,"aria-label":u,placeholder:u,autoComplete:"off",onChange:T=>m(T.target.value)}),l.jsxs("div",{className:`${ge.dropdownList} ${y?ge.dropdownRich:a?ge.dropdownCheck:""} ${c?ge.dropdownListConstrained:""}`,children:[w.map(T=>l.jsx("button",{type:"button",className:`${ge.dropdownItem} ${T.id===n?ge.dropdownItemActive:""}`,onClick:()=>{b.current=!0,r(T.id)},children:k?l.jsxs(l.Fragment,{children:[y&&l.jsx("span",{className:ge.dropdownItemIcon,children:T.icon}),l.jsxs("span",{className:ge.dropdownItemContent,children:[l.jsx("span",{className:ge.dropdownItemLabel,children:T.label}),T.description&&l.jsx("span",{className:ge.dropdownItemDesc,children:T.description})]}),l.jsx("span",{className:ge.dropdownItemCheck,children:T.id===n?l.jsx(iZe,{}):null})]}):T.label},T.id)),w.length===0&&d&&l.jsx("div",{className:ge.dropdownEmpty,role:"status",children:d(h)})]})]})]})}function aZe({menu:e,anchorRef:t,panelRef:n,detailRef:s,onClose:r,onSelect:i,onAccept:o}){const a=f.useRef([]),c=f.useRef(null),[u,d]=f.useState(null),[h,m]=f.useState(null);f.useEffect(()=>{var y;(y=a.current[e.selectedIndex])==null||y.scrollIntoView({block:"nearest"})},[e.items,e.selectedIndex]),f.useEffect(()=>{m(null)},[e.items]),f.useLayoutEffect(()=>{var y;d(((y=t.current)==null?void 0:y.closest("[data-web-shell-root]"))??null)},[t]),f.useEffect(()=>{const y=w=>{w.key!=="Escape"||!w.isComposing&&w.keyCode!==229||(Object.defineProperty(w,"key",{configurable:!0,value:"Process"}),window.addEventListener("keydown",k=>{k===w&&Reflect.deleteProperty(w,"key")},{once:!0}))};return window.addEventListener("keydown",y,{capture:!0}),()=>{window.removeEventListener("keydown",y,{capture:!0})}},[]);const p=oJe(e.items,e.kind),g=Math.max(...e.items.map(y=>Array.from(y.label).length),0),b=Math.max(...e.items.map(y=>Array.from(y.detail??"").length),0),v=b>0,x={"--slash-command-col":`${Math.min(Math.max(g+1,10),24)}ch`,"--slash-desc-col":v?`${Math.min(Math.max(b+1,18),36)}ch`:"0px","--slash-column-gap":v?"2ch":"0px"};return l.jsxs(l.Fragment,{children:[l.jsxs(Ax,{open:!0,onOpenChange:y=>{y||r()},children:[l.jsx(g$,{virtualRef:t}),l.jsx(Nx,{ref:n,side:"top",align:"start",alignOffset:16,sideOffset:8,collisionPadding:12,collisionBoundary:u??void 0,role:"listbox","data-web-shell-slash-menu":!0,style:x,onOpenAutoFocus:y=>y.preventDefault(),onCloseAutoFocus:y=>y.preventDefault(),onInteractOutside:y=>{var k,T;const w=y.target;w instanceof Node&&((k=t.current)!=null&&k.contains(w)||(T=s.current)!=null&&T.contains(w))&&y.preventDefault()},onMouseDown:y=>y.preventDefault(),onMouseLeave:y=>{var k;const w=y.relatedTarget;w instanceof Node&&((k=s.current)!=null&&k.contains(w))||m(null)},children:l.jsx("div",{className:ge.slashPanel,children:l.jsx("div",{className:ge.slashPanelBody,children:l.jsx("div",{className:ge.slashList,onScroll:()=>m(null),children:e.items.map((y,w)=>{const k=p[w];return l.jsxs("div",{className:ge.slashEntry,children:[k.showHeader&&l.jsxs(l.Fragment,{children:[k.showDivider&&l.jsx("div",{className:ge.slashSection}),l.jsxs("div",{className:ge.slashSectionHeader,children:[l.jsx("span",{children:y.section}),k.count>0?l.jsx("span",{className:ge.slashSectionCount,children:k.count}):null]})]}),l.jsxs("button",{ref:T=>{a.current[w]=T},type:"button",role:"option","aria-selected":w===e.selectedIndex,"data-has-description":y.detail?"":void 0,className:`${ge.slashItem} ${w===e.selectedIndex?ge.slashItemActive:""}`,onMouseEnter:T=>{if(i(w),!y.detail){m(null);return}c.current=T.currentTarget,m({label:y.label,detail:y.detail})},onMouseDown:T=>{T.preventDefault(),T.stopPropagation(),o(w)},children:[l.jsx("span",{className:ge.slashCommand,children:y.label}),y.detail&&l.jsx("span",{className:ge.slashDescription,children:y.detail})]})]},`${y.id}:${w}`)})})})})})]}),l.jsxs(Ax,{open:!!h,onOpenChange:y=>{y||m(null)},children:[l.jsx(g$,{virtualRef:c}),h&&l.jsx(Nx,{ref:s,side:"right",align:"start",sideOffset:8,collisionPadding:12,collisionBoundary:u??void 0,"data-web-shell-slash-detail":!0,onOpenAutoFocus:y=>y.preventDefault(),onCloseAutoFocus:y=>y.preventDefault(),onMouseLeave:y=>{var k;const w=y.relatedTarget;w instanceof Node&&((k=n.current)!=null&&k.contains(w))||m(null)},children:l.jsxs("div",{className:ge.slashDetail,children:[l.jsx("div",{className:ge.slashDetailCommand,children:h.label}),l.jsx("div",{className:ge.slashDetailText,children:h.detail})]})})]})]})}function lZe({actions:e,onRun:t,onPressKey:n}){const{t:s}=ut();return l.jsxs("div",{className:ge.quickActionsPanel,onMouseDown:r=>r.stopPropagation(),onClick:r=>r.stopPropagation(),children:[l.jsx("div",{className:ge.quickActionsHeader,children:s("quickActions.title")}),l.jsxs("div",{className:ge.quickActionsLayout,children:[l.jsx("div",{className:ge.quickActionsGrid,children:e.map(r=>l.jsx("button",{type:"button",className:ge.quickAction,onClick:()=>t(r),children:l.jsx("span",{className:ge.quickActionLabel,children:r.label})},r.id))}),l.jsx("div",{className:ge.quickKeysGrid,children:rZe.map(r=>l.jsx("button",{type:"button",className:ge.quickKey,title:s(r.descriptionKey),onMouseDown:i=>i.preventDefault(),onClick:()=>n(r),children:l.jsx("span",{className:ge.quickKeyLabel,children:r.label})},r.id))})]})]})}const bie=f.memo(f.forwardRef(function(t,n){var hn;const{onSubmit:s,onInputTextChange:r,onCycleMode:i,onToggleShortcuts:o,onCancel:a,isRunning:c=!1,isPreparing:u=!1,cancelArmed:d=!1,disabled:h=!1,placeholderText:m="Type a message...",commands:p,skills:g=[],slashCommandCategoryOrder:b,queuedMessages:v=[],onPopQueuedMessages:x,currentMode:y="default",currentModel:w="",gitBranch:k,gitStatus:T,onOpenGitDiff:S,workspaceName:C,workspaceTitle:_,workspaceColor:B,chatWidthMode:A="1000",showChatWidthToggle:N=!0,chatWidthToggleMin:j,visibleToolbarActions:P,availableModels:L=[],onSelectMode:O,onSelectModel:$,workspaces:z,selectedWorkspaceCwd:F,workspaceSelectionDisabled:G=!1,onSelectWorkspace:I,atWorkspaceCwd:Q,onChatWidthModeChange:V,onFocusFooter:M,dialogOpen:re=!1,followupState:se,onAcceptFollowup:X,onDismissFollowup:J,sessionName:de,composerInput:W,composerInputVersion:te,builtinAtProviders:U,atProviders:ee,composerTagIcons:oe}=t,{renderComposerToolbarStart:Ce,renderComposerToolbarEnd:he,renderComposerToolbarRight:ye,renderComposerTag:Ve,renderComposerTagTooltip:it,onComposerTagClick:At}=Lu(),Ee=DOe({onSubmit:s,onInputTextChange:r,onCycleMode:i,onToggleShortcuts:o,disabled:h,placeholderText:m,commands:p,skills:g,slashCommandCategoryOrder:b,queuedMessages:v,onPopQueuedMessages:x,currentMode:y,onFocusFooter:M,dialogOpen:re,followupState:se,onAcceptFollowup:X,onDismissFollowup:J,sessionName:de,composerInput:W,composerInputVersion:te,builtinAtProviders:U,atProviders:ee,atWorkspaceCwd:Q,composerTagIcons:oe,renderComposerTag:Ve,renderComposerTagTooltip:it,onComposerTagClick:At,editorTheme:YJe}),{t:me}=ut();f.useImperativeHandle(n,()=>Ee.handle,[Ee.handle]);const[bt,et]=f.useState(!1),[qe,Ke]=f.useState(!1),[ke,ne]=f.useState(!1),[gt,We]=f.useState(!1),[tt,jt]=f.useState(dq),jn=f.useRef(null),kn=f.useRef(null),Be=f.useRef(null),ht=f.useRef(null),ve=f.useRef(null),Me=f.useRef(null),_e=f.useRef(null),Xe=f.useRef(null),ue=f.useRef(null),Fe=f.useRef(null),kt=f.useRef(null),bn=f.useRef(null),Pe=f.useRef(!1),yn=f.useRef(!1),[je,Ne]=f.useState(!1),[ot,pt]=f.useState({workspaceSelect:!1,workspace:!1,gitBranch:!1,mode:!1,model:!1}),[dn,De]=f.useState(""),sn=Ee.slashMenu,Dn=Ee.closeSlashMenu,os=Ee.atMenu,st=Ee.closeAtMenu,St=!!sn,Ht=!!os,Ot=Ee.viewRef;f.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const Le=window.matchMedia("(hover: none), (pointer: coarse)"),Nt=()=>jt(dq());return Nt(),Le.addEventListener("change",Nt),()=>Le.removeEventListener("change",Nt)},[]),f.useEffect(()=>{tt||ne(!1)},[tt]),f.useEffect(()=>{if(!St&&!Ht)return;const Le=Nt=>{var cs,gr,le;const Tn=Nt.target,_n=jn.current;Tn instanceof Node&&_n&&!_n.contains(Tn)&&!((cs=kn.current)!=null&&cs.contains(Tn))&&!((gr=Be.current)!=null&&gr.contains(Tn))&&!((le=ht.current)!=null&&le.contains(Tn))&&(Dn(),st())};return window.addEventListener("mousedown",Le),window.addEventListener("touchstart",Le),()=>{window.removeEventListener("mousedown",Le),window.removeEventListener("touchstart",Le)}},[Ht,St,st,Dn]),f.useEffect(()=>{var Tn;const Le=jn.current,Nt=(Tn=Ot.current)==null?void 0:Tn.contentDOM;if(!(!Le||!Nt))return tZe(Le,Nt)},[Ot]),f.useEffect(()=>{const Le=jn.current,Nt=j;if(!Le||Nt===void 0){Ne(!1);return}const Tn=()=>{Ne(Le.getBoundingClientRect().width>=Nt-50)};Tn();const _n=new ResizeObserver(Tn);return _n.observe(Le),()=>_n.disconnect()},[j]);const Yt=f.useMemo(()=>N4.map(Le=>({id:Le,label:oZe(Le,me),description:me(`mode.desc.${Le}`),icon:l.jsx(ly,{mode:Le})})),[me]),Pn=f.useMemo(()=>{if(!P)return null;const Le=P.filter(Nt=>KJe.has(Nt));return new Set(Le)},[P]),Hn=Le=>Pn?Pn.has(Le):!0,as=Hn("approvalMode"),Bs=Hn("model"),fr=f.useMemo(()=>new Set(p.map(Le=>Le.name.replace(/^\/+/,""))),[p]),Gr=f.useCallback(Le=>fr.has(Le),[fr]),rs=f.useMemo(()=>[{id:"new",label:me("quickActions.new"),action:{type:"run",command:"/new"}},{id:"resume",label:me("quickActions.resume"),action:{type:"run",command:"/resume"}},{id:"delete",label:me("quickActions.delete"),action:{type:"run",command:"/delete"}},{id:"branch",label:me("quickActions.branch"),action:{type:"run",command:"/branch"}},{id:"rewind",label:me("quickActions.rewind"),action:{type:"run",command:"/rewind"}},{id:"history-search",label:me("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:me("quickActions.recap"),action:{type:"run",command:"/recap"}},{id:"stats",label:me("quickActions.stats"),action:{type:"run",command:"/stats"}},{id:"context",label:me("quickActions.context"),action:{type:"run",command:"/context"}},{id:"status",label:me("quickActions.status"),action:{type:"run",command:"/status"}},{id:"skills",label:me("quickActions.skills"),action:{type:"run",command:"/skills detail"}},{id:"tools",label:me("quickActions.tools"),action:{type:"run",command:"/tools desc"}},{id:"agents",label:me("quickActions.agents"),action:{type:"run",command:"/agents"}},{id:"mcp",label:me("quickActions.mcp"),action:{type:"run",command:"/mcp"}},{id:"memory",label:me("quickActions.memory"),action:{type:"run",command:"/memory"}},{id:"theme",label:me("quickActions.theme"),action:{type:"run",command:"/theme"}},{id:"shell",label:Ee.shellMode?me("quickActions.exitShellMode"):me("quickActions.shellMode"),action:{type:"shell"}},{id:"goal",label:me("quickActions.setGoal"),action:{type:"insert",text:"/goal "}}].filter(Le=>{const Nt=sZe(Le);return!Nt||Gr(Nt)}),[Ee.shellMode,Gr,me]),Vt=f.useMemo(()=>L.map(Le=>({id:Le.id,label:Yh(Le.label||Le.id),searchText:`${Le.label??""}
${Le.id}`})),[L]),Qn=f.useCallback(Le=>{O==null||O(Le),et(!1),Ee.focus()},[O,Ee]),Rs=f.useCallback(Le=>{$==null||$(Le),Ke(!1),Ee.focus()},[$,Ee]),pr=f.useCallback(Le=>{const Nt=Ee.viewRef.current;Nt&&(Nt.focus(),Nt.contentDOM.dispatchEvent(new KeyboardEvent("keydown",{...Le,bubbles:!0,cancelable:!0})))},[Ee]),hs=f.useCallback(Le=>{if(ne(!1),et(!1),Ke(!1),Ee.closeSlashMenu(),Ee.closeAtMenu(),Le.action.type==="insert"){Ee.insertText(Le.action.text,{mode:"replace"});return}if(Le.action.type==="shell"){Ee.toggleShellMode();return}if(Le.action.type==="key"){pr(Le.action.item.event);return}s(Le.action.command)},[Ee,pr,s]),xr=f.useCallback(Le=>{pr(Le.event),Le.id==="ctrl-r"&&ne(!1)},[pr]),{searchMode:ci,searchQuery:_s,searchMatches:Vs,searchActiveIndex:ls,searchInputRef:Ws,searchUiRef:Ss,closeSearch:Xs,handleSearchKeyDown:Cr,handleSearchInput:Lr,handleSearchCompositionEnd:pe}=Ee.searchState,Ie=Le=>{const Nt=Ve==null?void 0:Ve({tag:Le,placement:"composer",readonly:!1});if(Nt!=null)return Nt;const Tn=eC(Le),_n=tC(Le),cs=Le.kind?"":Tn,gr=Le.icon??Dp(Le.kind,oe),le=gr&&(ON(gr)||P1(gr))?gr:void 0;return!cs&&!_n?l.jsx("span",{className:ge.tagLabel,children:Le.id}):l.jsxs(l.Fragment,{children:[le&&l.jsx("span",{className:ge.tagIcon,style:Kh("--composer-tag-icon-url",le),"aria-hidden":"true"}),cs&&l.jsx("span",{className:ge.tagLabel,children:cs}),_n&&l.jsx("span",{className:ge.tagValue,children:_n})]})},Ge=gie(y,me),Xt=w?((hn=L.find(Le=>Le.id===w))==null?void 0:hn.label)??(w.startsWith("qwen-route:")?"":Yh(w)):"",{modelLabel:Cn,modelLabelReady:Un}=WJe({currentModelLabel:Xt,lastConfirmedModelLabel:dn}),xe=z==null?void 0:z.find(Le=>F?Le.cwd===F:Le.primary),$e=(xe==null?void 0:xe.label)??"",Lt=!!(z&&z.length>1&&I),ln=!!(C&&Hn("workspace")),Pt=!!(k&&Hn("gitBranch"));f.useLayoutEffect(()=>{Xt&&Xt!==dn&&De(Xt)},[Xt,dn]);const An=ot.workspaceSelect,Xn=ot.workspace,Mn=ot.gitBranch,Gn=ot.mode,Zn=ot.model,Vn=c&&!Ee.hasContent;return f.useLayoutEffect(()=>{const Le=ve.current,Nt=Me.current,Tn=_e.current,_n=kt.current;if(!Le||!Nt||!Tn||!_n)return;const cs=()=>{const Qe=vr=>{const ni=_n.querySelector(`[data-toolbar-measure="${vr}:collapsed"]`),Tr=_n.querySelector(`[data-toolbar-measure="${vr}:expanded"]`);return Math.max(0,Math.ceil((Tr==null?void 0:Tr.getBoundingClientRect().width)??0)-Math.ceil((ni==null?void 0:ni.getBoundingClientRect().width)??0))},xn=[...Lt?[{id:"workspaceSelect",expansionWidth:Qe("workspaceSelect")}]:[],...ln?[{id:"workspace",expansionWidth:Qe("workspace")}]:[],...Pt?[{id:"gitBranch",expansionWidth:Qe("gitBranch")}]:[],...as?[{id:"mode",expansionWidth:Qe("mode")}]:[],...Bs?[{id:"model",expansionWidth:Qe("model"),ready:Un}]:[]],Bt=xn.reduce((vr,ni)=>vr+(ot[ni.id]?ni.expansionWidth:0),0),$n=Nt.scrollWidth,Qs=Math.ceil(Number.parseFloat(getComputedStyle(Le).columnGap)||0),vs=VJe({toolbarWidth:Math.floor(Le.getBoundingClientRect().width),leadingWidth:$n,rightWidth:Math.ceil(Tn.getBoundingClientRect().width),currentExpansionWidth:Bt,gap:Qs}),is=UJe({availableWidth:vs,items:xn,currentVisibility:ot,expansionMargin:xn.length}),Js={workspaceSelect:is.workspaceSelect??!1,workspace:is.workspace??!1,gitBranch:is.gitBranch??!1,mode:is.mode??!1,model:is.model??!1};pt(vr=>Object.keys(Js).every(Tr=>vr[Tr]===Js[Tr])?vr:Js)};cs();const gr=new ResizeObserver(cs);gr.observe(Le),gr.observe(Nt),gr.observe(Tn);for(const Qe of _n.children)gr.observe(Qe);const le=[Xe.current,ue.current,Fe.current].filter(Qe=>Qe!==null),Se=()=>{for(const Qe of le){gr.observe(Qe);for(const xn of Qe.children)gr.observe(xn)}};Se();const He=new MutationObserver(()=>{Se(),cs()});for(const Qe of le)He.observe(Qe,{attributes:!0,characterData:!0,childList:!0,subtree:!0});return()=>{He.disconnect(),gr.disconnect()}},[he,ye,Ce,h,k,Pt,c,Cn,Un,Ge,de,Bs,as,ot,ln,C,Lt,$e]),l.jsxs("div",{className:`${ge.editorShell} ${bt||qe?ge.editorShellDropdownOpen:""}`,"data-composer":!0,"data-web-shell-composer":!0,children:[l.jsxs("div",{ref:jn,className:ge.container,"data-web-shell-composer-surface":!0,"data-dac-glow":!0,onClick:()=>{et(!1),Ke(!1),ne(!1),Ee.focus()},children:[l.jsx("div",{className:ge.dacAura,"aria-hidden":"true"}),l.jsx("div",{className:ge.dacHalo,"aria-hidden":"true"}),ci&&l.jsxs("div",{ref:Ss,className:ge.searchPanel,onMouseDown:Le=>Le.stopPropagation(),onClick:Le=>Le.stopPropagation(),children:[l.jsxs("div",{className:ge.searchBar,children:[l.jsx("span",{className:ge.searchLabel,children:me("editor.searchLabel")}),l.jsx("input",{ref:Ws,className:ge.searchInput,value:_s,onChange:Lr,onCompositionEnd:pe,onKeyDown:Cr,placeholder:me("editor.searchPlaceholder")})]}),Vs.length>0&&l.jsx("div",{className:ge.searchResults,children:Vs.map((Le,Nt)=>l.jsxs("button",{type:"button",className:`${ge.searchResult} ${Nt===ls?ge.searchResultActive:""}`,onMouseDown:Tn=>{Tn.preventDefault(),Ee.replaceEditorText(Le),Xs(!1)},children:[l.jsx("span",{className:ge.searchResultMarker,children:Nt===ls?"›":""}),l.jsx("span",{className:ge.searchResultText,children:Le})]},`${Le}-${Nt}`))}),Vs.length===0&&l.jsx("div",{className:ge.searchEmpty,children:me("editor.noHistory")})]}),l.jsxs("div",{className:ge.content,children:[(Ee.composerTags.length>0||Ee.pastedImages.length>0)&&l.jsxs("div",{className:ge.attachments,"data-web-shell-composer-attachments":!0,children:[Ee.composerTags.length>0&&l.jsx(Ree,{delayDuration:0,disableHoverableContent:!1,children:l.jsx("div",{className:ge.tags,children:Ee.composerTags.map(Le=>{const Nt={tag:Le,placement:"composer",readonly:!1};let Tn;try{Tn=it==null?void 0:it(Nt)}catch(_n){console.warn("[WebShell] composer tag tooltip render failed",_n)}return l.jsx(XJe,{tag:Le,content:Ie(Le),tooltip:Tn,onActivate:At?_n=>At({...Nt,anchorRect:_n}):void 0,onRemove:Le.removable!==!1?()=>{var _n;Ee.removeTopTag(Le.id),(_n=Ee.viewRef.current)==null||_n.focus()}:void 0},Le.id)})})}),Ee.pastedImages.length>0&&l.jsx("div",{className:ge.images,children:Ee.pastedImages.map((Le,Nt)=>l.jsxs("div",{className:ge.imageThumb,children:[l.jsx("img",{src:`data:${Le.media_type};base64,${Le.data}`,alt:""}),l.jsx("button",{className:ge.imageRemove,onClick:Tn=>{Tn.stopPropagation(),Ee.removeImage(Nt)},children:"×"})]},Nt))})]}),Ee.slashMenu&&l.jsx(aZe,{menu:Ee.slashMenu,anchorRef:jn,panelRef:kn,detailRef:Be,onClose:Ee.closeSlashMenu,onSelect:Ee.selectSlashCompletion,onAccept:Ee.acceptSlashCompletion}),Ee.atMenu&&l.jsx(XQe,{menu:Ee.atMenu,anchorRef:jn,panelRef:ht,onSelect:Ee.selectAtCompletion,onAccept:Ee.acceptAtCompletion,onBack:()=>{const Le=Ee.backAtCategories();return Le==="categories"&&window.setTimeout(()=>Ee.focus(),0),!!Le},onSearch:Ee.updateAtSearch,onSelectTab:Ee.selectAtTab}),l.jsxs("div",{className:ge.editorArea,children:[Ee.shellMode&&l.jsx("span",{className:ge.shellPrefix,"aria-hidden":"true",children:"!"}),l.jsx("div",{ref:Ee.containerRef,"data-web-shell-composer-editor":!0})]}),l.jsxs("div",{ref:ve,className:ge.toolbar,children:[l.jsxs("div",{ref:Me,className:ge.toolbarLeading,children:[Ce&&l.jsx("div",{ref:Xe,className:ge.toolbarStart,children:l.jsx(Ce,{disabled:h,isRunning:c,currentMode:y,currentModel:w,sessionName:de})}),l.jsxs("div",{className:ge.toolbarLeft,children:[Lt&&z&&I&&l.jsxs(Af,{value:xe==null?void 0:xe.id,disabled:G,onValueChange:Le=>{const Nt=z.find(Tn=>Tn.id===Le);Nt&&(I(Nt.primary?void 0:Nt.cwd),Pe.current=!0,We(!1),requestAnimationFrame(()=>{var Tn;(Tn=bn.current)==null||Tn.blur()}))},children:[l.jsx(F1,{delayDuration:300,children:l.jsxs(q1,{open:gt,onOpenChange:Le=>{Le&&(Pe.current||!yn.current)||We(Le)},children:[l.jsx(H1,{asChild:!0,children:l.jsx("span",{className:`${ge.workspaceSelectTooltipTrigger} ${An?"":ge.workspaceSelectTooltipTriggerCompact}`,onPointerEnter:()=>{yn.current=!0},onPointerLeave:()=>{yn.current=!1,Pe.current=!1},onBlur:()=>{yn.current||(Pe.current=!1)},children:l.jsxs(jf,{ref:bn,size:"sm",className:`${ge.toolBtn} ${ge.workspaceSelectTrigger} ${An?"":ge.workspaceSelectTriggerCompact}`,"aria-label":me("sidebar.workspaceSelectLabel"),children:[l.jsx(C2,{size:16,strokeWidth:1.2}),l.jsx(Nf,{})]})})}),l.jsx(U1,{side:"top",children:$e})]})}),l.jsx(Mf,{position:"popper",align:"start",children:l.jsx(yM,{children:z.map(Le=>l.jsx(vl,{value:Le.id,children:Le.label},Le.id))})})]}),ln&&C&&l.jsx(qJe,{name:C,title:_??C,color:B,compact:!Xn,ariaLabel:me("workspace.paneLabel",{name:C})}),Pt&&k&&l.jsx(pie,{branch:k,status:T,compact:!Mn,onOpenDiff:S}),as&&l.jsx("div",{className:`${ge.dropdownWrapper} ${Gn?"":ge.dropdownWrapperCompact}`,children:l.jsx(hq,{open:bt,items:Yt,activeId:y,onOpenChange:Le=>{et(Le),Le&&Ke(!1)},onSelect:Qn,tooltip:Ge,trigger:l.jsxs("button",{className:`${ge.toolBtn} ${ge.modeToolBtn} ${Gn?"":ge.toolBtnCompact}`,"data-web-shell-mode-button":!0,"data-web-shell-toolbar-popover-trigger":!0,onClick:Le=>{Le.stopPropagation(),Ee.closeSlashMenu(),Ee.closeAtMenu(),ne(!1)},"aria-label":me("status.mode"),children:[l.jsx("span",{className:ge.toolBtnModeIcon,children:l.jsx(ly,{mode:y})}),Gn&&l.jsx("span",{className:ge.toolBtnText,children:Ge}),l.jsx("span",{className:ge.toolBtnArrow,children:l.jsx(zl,{})})]})})}),Bs&&l.jsx("div",{className:`${ge.dropdownWrapper} ${Zn?"":ge.dropdownWrapperCompact}`,children:l.jsx(hq,{open:qe,items:Vt,activeId:w,onOpenChange:Le=>{Ke(Le),Le&&et(!1)},onSelect:Rs,tooltip:Cn,showCheck:!0,searchable:!0,searchLabel:me("common.search"),noResultsLabel:Le=>me("model.noMatch",{query:Le}),trigger:l.jsxs("button",{className:`${ge.toolBtn} ${ge.modelToolBtn} ${Zn?"":ge.toolBtnCompact}`,"data-web-shell-model-button":!0,"data-web-shell-toolbar-popover-trigger":!0,onClick:Le=>{Le.stopPropagation(),Ee.closeSlashMenu(),Ee.closeAtMenu(),ne(!1)},"aria-label":me("model.select"),children:[l.jsx("span",{className:ge.toolBtnModelIcon,children:l.jsx(F6,{})}),Zn&&l.jsx("span",{className:ge.toolBtnText,children:Cn}),l.jsx("span",{className:ge.toolBtnArrow,children:l.jsx(zl,{})})]})})}),he&&l.jsx("div",{ref:ue,className:ge.toolbarEnd,children:l.jsx(he,{disabled:h,isRunning:c,currentMode:y,currentModel:w,sessionName:de})})]})]}),l.jsxs("div",{ref:_e,className:ge.toolbarRight,children:[tt&&rs.length>0&&l.jsx("button",{className:`${ge.toolBtn} ${ge.quickActionsBtn}`,onClick:Le=>{Le.stopPropagation(),Ee.closeSlashMenu(),Ee.closeAtMenu(),et(!1),Ke(!1),ne(Nt=>!Nt)},"aria-expanded":ke,"aria-label":me("quickActions.open"),title:me("quickActions.open"),"data-tooltip":me("quickActions.open"),children:l.jsx("span",{className:ge.toolBtnIcon,children:l.jsx(eZe,{})})}),ye&&l.jsx("div",{ref:Fe,className:ge.toolbarRightCustom,children:l.jsx(ye,{disabled:h,isRunning:c,currentMode:y,currentModel:w,sessionName:de})}),N&&je&&Hn("widthMode")&&l.jsx("button",{className:`${ge.toolBtn} ${ge.widthModeBtn}`,onClick:Le=>{Le.stopPropagation(),V==null||V(A==="wide"?"1000":"wide")},disabled:!V,"aria-label":me(A==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),title:me(A==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),"data-tooltip":me(A==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),children:l.jsx("span",{className:ge.toolBtnIcon,children:l.jsx(nZe,{mode:A})})}),Hn("voice")&&l.jsx(IJe,{disabled:h,onInsert:Le=>{const Nt=Ee.getText(),Tn=Nt&&!/\s$/.test(Nt)?" ":"";Ee.insertText(`${Tn}${Le} `),Ee.focus()}}),l.jsx("button",{className:u||Vn?`${ge.sendBtn} ${ge.sendBtnRunning}${d?` ${ge.sendBtnArmed}`:""}`:ge.sendBtn,disabled:u?!0:Vn?!a:Ee.disabled||!Ee.hasContent,"data-web-shell-composer-submit":!0,onClick:Le=>{if(Le.stopPropagation(),!u){if(Vn){a==null||a();return}Ee.submitText()}},"aria-label":me(u?"common.loading":Vn?d?"stream.cancelArmed":"stream.cancel":"editor.send"),title:c&&d?me("stream.cancelArmed"):void 0,children:u?l.jsx(ZJe,{}):Vn?d?l.jsx("span",{className:ge.escLabel,"aria-hidden":"true",children:"Esc"}):l.jsx(JJe,{}):l.jsx(QJe,{})}),l.jsx("span",{role:"status","aria-live":"polite",className:ge.srOnly,children:c&&d?me("stream.cancelArmed"):""})]})]}),l.jsxs("div",{ref:kt,className:ge.toolbarMeasurements,"aria-hidden":"true",children:[Lt&&xe&&l.jsxs(l.Fragment,{children:[l.jsxs("span",{"data-toolbar-measure":"workspaceSelect:collapsed",className:`${ge.toolBtn} ${ge.workspaceSelectTrigger} ${ge.workspaceSelectTriggerCompact}`,children:[l.jsx(C2,{size:16,strokeWidth:1.2}),l.jsx("span",{className:ge.toolBtnText,children:$e}),l.jsx("span",{className:ge.toolBtnArrow,children:l.jsx(zl,{})})]}),l.jsxs("span",{"data-toolbar-measure":"workspaceSelect:expanded",className:`${ge.toolBtn} ${ge.workspaceSelectTrigger}`,children:[l.jsx(C2,{size:16,strokeWidth:1.2}),l.jsx("span",{className:ge.toolBtnText,children:$e}),l.jsx("span",{className:ge.toolBtnArrow,children:l.jsx(zl,{})})]})]}),ln&&C&&l.jsxs(l.Fragment,{children:[l.jsxs("span",{"data-toolbar-measure":"workspace:collapsed",className:`${ge.workspaceChip} ${ge.workspaceChipCompact}`,children:[l.jsx("span",{className:ge.workspaceChipIcon}),l.jsx("span",{className:ge.workspaceChipText,children:C})]}),l.jsxs("span",{"data-toolbar-measure":"workspace:expanded",className:ge.workspaceChip,children:[l.jsx("span",{className:ge.workspaceChipIcon}),l.jsx("span",{className:ge.workspaceChipText,children:C})]})]}),Pt&&k&&l.jsxs(l.Fragment,{children:[l.jsx("span",{"data-toolbar-measure":"gitBranch:collapsed",className:`${ge.gitBranchChip} ${ge.gitBranchChipCompact}`,children:l.jsx(WA,{branch:k,status:T,compact:!0})}),l.jsx("span",{"data-toolbar-measure":"gitBranch:expanded",className:ge.gitBranchChip,children:l.jsx(WA,{branch:k,status:T,compact:!1})})]}),l.jsxs("span",{"data-toolbar-measure":"mode:collapsed",className:`${ge.toolBtn} ${ge.modeToolBtn} ${ge.toolBtnCompact}`,children:[l.jsx("span",{className:ge.toolBtnModeIcon,children:l.jsx(ly,{mode:y})}),l.jsx("span",{className:ge.toolBtnText,children:Ge}),l.jsx("span",{className:ge.toolBtnArrow,children:l.jsx(zl,{})})]}),l.jsxs("span",{"data-toolbar-measure":"mode:expanded",className:`${ge.toolBtn} ${ge.modeToolBtn}`,children:[l.jsx("span",{className:ge.toolBtnModeIcon,children:l.jsx(ly,{mode:y})}),l.jsx("span",{className:ge.toolBtnText,children:Ge}),l.jsx("span",{className:ge.toolBtnArrow,children:l.jsx(zl,{})})]}),l.jsxs("span",{"data-toolbar-measure":"model:collapsed",className:`${ge.toolBtn} ${ge.modelToolBtn} ${ge.toolBtnCompact}`,children:[l.jsx("span",{className:ge.toolBtnModelIcon,children:l.jsx(F6,{})}),l.jsx("span",{className:ge.toolBtnText,children:Cn}),l.jsx("span",{className:ge.toolBtnArrow,children:l.jsx(zl,{})})]}),l.jsxs("span",{"data-toolbar-measure":"model:expanded",className:`${ge.toolBtn} ${ge.modelToolBtn}`,children:[l.jsx("span",{className:ge.toolBtnModelIcon,children:l.jsx(F6,{})}),l.jsx("span",{className:ge.toolBtnText,children:Cn}),l.jsx("span",{className:ge.toolBtnArrow,children:l.jsx(zl,{})})]})]})]})]}),tt&&ke&&rs.length>0&&l.jsx(lZe,{actions:rs,onRun:hs,onPressKey:xr})]})})),cZe="_bar_17p6f_1",uZe="_left_17p6f_12",dZe="_right_17p6f_13",hZe="_settingsButton_17p6f_23",fZe="_modeButton_17p6f_49",mZe="_modeHint_17p6f_62",pZe="_modeLabel_17p6f_67",gZe="_modeDefault_17p6f_71",bZe="_modePlan_17p6f_75",yZe="_modeAutoEdit_17p6f_79",xZe="_modeAuto_17p6f_79",vZe="_modeYolo_17p6f_87",wZe="_shortcutsButton_17p6f_96",kZe="_modelButton_17p6f_114",_Ze="_model_17p6f_114",SZe="_contextButton_17p6f_138",CZe="_context_17p6f_138",TZe="_goal_17p6f_161",EZe="_goalButton_17p6f_167",AZe="_separator_17p6f_184",NZe="_taskPill_17p6f_188",mi={bar:cZe,left:uZe,right:dZe,settingsButton:hZe,modeButton:fZe,modeHint:mZe,modeLabel:pZe,modeDefault:gZe,modePlan:bZe,modeAutoEdit:yZe,modeAuto:xZe,modeYolo:vZe,shortcutsButton:wZe,modelButton:kZe,model:_Ze,contextButton:SZe,context:CZe,goal:TZe,goalButton:EZe,separator:AZe,taskPill:NZe},jZe=1e3;function MZe(e,t){switch(e){case"default":return{label:t("mode.default"),className:mi.modeDefault};case"plan":return{label:t("mode.plan"),className:mi.modePlan};case"auto-edit":return{label:t("mode.auto-edit"),className:mi.modeAutoEdit};case"auto":return{label:t("mode.auto"),className:mi.modeAuto};case"yolo":return{label:t("mode.yolo"),className:mi.modeYolo};default:return null}}function IZe(){return l.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:[l.jsx("circle",{cx:"12",cy:"12",r:"3"}),l.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 q6(e,t,n,s){return s(e===1?t:n,{count:e})}function RZe(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(q6(r.shell,"tasks.pill.shell","tasks.pill.shells",t)),r.agent>0&&i.push(q6(r.agent,"tasks.pill.agent","tasks.pill.agents",t)),r.monitor>0&&i.push(q6(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 DZe(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 LZe=f.forwardRef(function({onSelectMode:t,onSelectModel:n,onShowContext:s,onOpenSettings:r,onOpenTasks:i,onReturnToInput:o,tasks:a,activeGoal:c,onOpenGoals:u,hideSettings:d,onToggleShortcuts:h,compact:m=!1},p){const g=Cl(),b=g.status==="connected",v=g.currentModel??"",x=g.currentMode??"",y=g.tokenCount??0,w=g.contextWindow??0,{t:k}=ut(),S=(w>0?y/w*100:0).toFixed(1),C=MZe(x,k),[,_]=f.useState(0),B=f.useRef(null);f.useEffect(()=>{if(!c)return;const z=setInterval(()=>_(F=>(F+1)%1e6),jZe);return()=>clearInterval(z)},[c]);const A=f.useMemo(()=>RZe(a,k),[a,k]),N=!m&&(b||!!C),j=c?DZe(Date.now()-c.setAt):"",P=c?`◎ ${k("goal.statusActive")}${j?` (${j})`:""}`:"",L=!!A||!m,O=!m&&!!v||!m&&w>0&&y>0||!!P;if(f.useImperativeHandle(p,()=>({focusTaskPill(){var z;return A?((z=B.current)==null||z.focus({preventScroll:!0}),!0):!1}}),[A]),!L&&!O)return null;const $=z=>{if(z.key==="Enter"||z.key==="ArrowDown"||z.key==="n"&&z.ctrlKey){z.preventDefault(),z.stopPropagation(),i==null||i();return}if(z.key==="ArrowUp"||z.key==="Escape"||z.key==="p"&&z.ctrlKey){z.preventDefault(),z.stopPropagation(),o==null||o();return}z.key.length===1&&!z.metaKey&&!z.ctrlKey&&!z.altKey&&(z.preventDefault(),z.stopPropagation(),o==null||o(z.key))};return l.jsxs("div",{className:mi.bar,children:[l.jsxs("div",{className:mi.left,children:[b&&!d&&!m&&l.jsx("button",{type:"button",className:mi.settingsButton,onClick:r,onMouseDown:z=>z.stopPropagation(),onTouchStart:z=>z.stopPropagation(),title:k("settings.title"),"aria-label":k("settings.title"),"aria-haspopup":"dialog",children:l.jsx(IZe,{})}),C&&!m&&l.jsxs("button",{type:"button",className:mi.modeButton,onClick:t,onMouseDown:z=>z.stopPropagation(),onTouchStart:z=>z.stopPropagation(),title:k("mode.select"),"aria-haspopup":"listbox",children:[l.jsx("span",{className:`${mi.modeLabel} ${C.className}`,children:C.label}),!m&&l.jsx("span",{className:mi.modeHint,children:k("status.modeHint")})]}),!m&&l.jsx(l.Fragment,{children:h?l.jsx("button",{type:"button",className:mi.shortcutsButton,onClick:h,onMouseDown:z=>z.stopPropagation(),onTouchStart:z=>z.stopPropagation(),"aria-haspopup":"dialog","aria-label":k("status.shortcuts"),children:k("status.shortcuts")}):l.jsx("span",{children:k("status.shortcuts")})}),A&&l.jsxs(l.Fragment,{children:[N&&l.jsx("span",{className:mi.separator,children:"·"}),l.jsx("button",{ref:B,type:"button",className:mi.taskPill,onClick:i,onKeyDown:$,disabled:!i,children:A})]})]}),l.jsxs("div",{className:mi.right,children:[!m&&v&&l.jsx("button",{type:"button",className:mi.modelButton,onClick:n,onMouseDown:z=>z.stopPropagation(),onTouchStart:z=>z.stopPropagation(),title:k("model.select"),"aria-haspopup":"listbox",children:l.jsx("span",{className:mi.model,children:v})}),!m&&w>0&&y>0&&l.jsx("button",{type:"button",className:mi.contextButton,onClick:s,title:k("contextUsage.title"),children:l.jsx("span",{className:mi.context,children:k("status.contextUsed",{pct:S})})}),P&&(u?l.jsx("button",{type:"button",className:mi.goalButton,onClick:u,title:c==null?void 0:c.condition,"aria-label":c!=null&&c.condition?`${k("sidebar.goals")}: ${c.condition}`:k("sidebar.goals"),children:l.jsx("span",{className:mi.goal,children:P})}):l.jsx("span",{className:mi.goal,title:c==null?void 0:c.condition,children:P}))]})]})}),PZe=15e3,OZe=["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."],BZe=["正在努力搬砖，请稍候...","老板在身后，快加载啊！","头发掉光前，一定能加载完...","服务器正在深呼吸，准备放大招...","正在向服务器投喂咖啡...","正在赋能全链路，寻找关键抓手...","正在降本增效，优化加载路径...","正在打破部门壁垒，沉淀方法论...","正在拥抱变化，迭代核心价值...","正在对齐颗粒度，打磨底层逻辑...","大力出奇迹，正在强行加载...","只要我不写代码，代码就没有 Bug...","正在把 Bug 转化为 Feature...","只要我不尴尬，Bug 就追不上我...","正在试图理解去年的自己写了什么...","正在猿力觉醒中，请耐心等待...","正在询问产品经理：这需求是真的吗？","正在给产品经理画饼，请稍等...","每一行代码，都在努力让世界变得更好一点点...","每一个伟大的想法，都值得这份耐心的等待...","别急，美好的事物总是需要一点时间去酝酿...","愿你的代码永无 Bug，愿你的梦想终将成真...","哪怕只有 0.1% 的进度，也是在向目标靠近...","加载的是字节，承载的是对技术的热爱..."];function fq(e){return(e??(typeof navigator<"u"?navigator.language.toLowerCase():"")).toLowerCase().startsWith("zh")?BZe:OZe}function $Ze(){const e=R4(),t=mv(),n=e!=="idle",s=f.useRef(0),r=f.useRef(0),[i,o]=f.useState({estimatedOutputTokens:0,isReceivingContent:!1}),a=f.useMemo(()=>{let u=0,d=0,h=!1;const m=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 b=t[g];if(b.kind==="assistant"&&!b.parentToolCallId&&(u+=b.text.length,b.streaming&&(h=!0)),b.kind==="tool"&&!b.parentToolCallId){if(b.rawInput!==void 0)try{u+=JSON.stringify(b.rawInput).length}catch{}const v=zZe(b.rawOutput);v!==void 0&&!m.has(b.toolCallId)&&(d+=v,m.add(b.toolCallId))}}return{chars:u,agentTokens:d,isReceiving:h}},[t]),c=f.useRef(a);return c.current=a,a.chars<r.current&&(s.current=a.chars),r.current=a.chars,f.useEffect(()=>{if(!n){s.current=0,o({estimatedOutputTokens:0,isReceivingContent:!1});return}const u=setInterval(()=>{const{chars:d,agentTokens:h,isReceiving:m}=c.current;if(d<s.current){s.current=d,o({estimatedOutputTokens:h+Math.round(d/4),isReceivingContent:m});return}const p=d-s.current;if(p<=0){o(v=>{const x={estimatedOutputTokens:h+Math.round(s.current/4),isReceivingContent:m};return v.estimatedOutputTokens===x.estimatedOutputTokens&&v.isReceivingContent===x.isReceivingContent?v:x});return}let g;p<70?g=3:p<=200?g=Math.max(3,Math.round(p*.2)):g=50;const b=Math.min(s.current+g,d);s.current=b,o({estimatedOutputTokens:h+Math.round(b/4),isReceivingContent:m})},100);return()=>clearInterval(u)},[n]),i}function zZe(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 FZe(e){return e<1e3?`${e}`:e<1e4?`${(e/1e3).toFixed(1)}k`:`${Math.floor(e/1e3)}k`}function Z0(e){const t=Math.round(e);return Math.abs(t)<1e6?t.toLocaleString():`${(t/1e6).toFixed(1)}M`}const qZe="_status_zld2v_1",HZe="_spinner_zld2v_11",UZe="_label_zld2v_15",VZe="_meta_zld2v_19",Uk={status:qZe,spinner:HZe,label:UZe,meta:VZe},H6=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];function yie({startedAt:e,showPhrase:t=!0}){const n=R4(),{estimatedOutputTokens:s,isReceivingContent:r}=$Ze(),{language:i,t:o}=ut(),{loadingPhrases:a}=Lu(),c=f.useRef(a);c.current=a;const u=f.useCallback(S=>{var C;try{return((C=c.current)==null?void 0:C.call(c,S))??fq(S)}catch(_){return console.warn("[web-shell] loadingPhrases resolver threw; using defaults",_),fq(S)}},[]),[d,h]=f.useState(0),m=f.useRef(Date.now()),[p,g]=f.useState(0),[b,v]=f.useState(()=>u(i)[0]??""),x=n!=="idle";if(f.useEffect(()=>{if(!x){h(0);return}m.current=e??Date.now(),h(mq(m.current));const S=setInterval(()=>{h(mq(m.current))},1e3);return()=>clearInterval(S)},[x,e]),f.useEffect(()=>{if(!t)return;if(n==="idle"){v(u(i)[0]??"");return}const S=()=>{const _=u(i),B=Math.floor(Math.random()*_.length);v(_[B]??"")};S();const C=setInterval(S,PZe);return()=>clearInterval(C)},[i,n,u,t]),f.useEffect(()=>{if(n==="idle")return;const S=setInterval(()=>{g(C=>(C+1)%H6.length)},250);return()=>clearInterval(S)},[n]),n==="idle")return null;const y=H6[p%H6.length],w=r?"↓":"↑",k=d<60?`${d}s`:WZe(d*1e3),T=s>0?` · ${w} ${o("stream.tokens",{count:FZe(s)})}`:"";return l.jsxs("div",{className:Uk.status,children:[l.jsx("span",{className:Uk.spinner,children:y}),t&&b&&l.jsx("span",{className:Uk.label,children:b}),l.jsxs("span",{className:Uk.meta,children:["(",k,T," · ",o("stream.cancel"),")"]})]})}function WZe(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 mq(e){return Math.max(0,Math.ceil((Date.now()-e)/1e3))}const GZe="_host_1scjy_1",KZe="_toast_1scjy_13",YZe="_message_1scjy_31",XZe="_close_1scjy_39",QZe="_info_1scjy_58",JZe="_success_1scjy_62",ZZe="_warning_1scjy_66",eet="_error_1scjy_70",cy={host:GZe,toast:KZe,message:YZe,close:XZe,info:QZe,success:JZe,warning:ZZe,error:eet};function tet({toasts:e,onDismiss:t,autoDismissMs:n=5e3}){return e.length===0?null:l.jsx("div",{className:cy.host,role:"status","aria-live":"polite","data-web-shell-toast-host":!0,children:e.map(s=>l.jsx(net,{toast:s,onDismiss:t,autoDismissMs:n},s.id))})}function net({toast:e,onDismiss:t,autoDismissMs:n}){const{t:s}=ut();return f.useEffect(()=>{const r=window.setTimeout(()=>t(e.id),n);return()=>window.clearTimeout(r)},[n,t,e.id]),l.jsxs("div",{className:`${cy.toast} ${cy[e.tone]}`,"data-web-shell-toast":!0,"data-tone":e.tone,children:[l.jsx("div",{className:cy.message,children:e.message}),l.jsx("button",{type:"button",className:cy.close,onClick:()=>t(e.id),"aria-label":s("toast.dismiss"),title:s("toast.dismissShort"),children:"x"})]})}const set="_panel_n876c_1",ret="_summary_n876c_10",iet="_progressRing_n876c_27",oet="_stepText_n876c_41",aet="_statusSegmentWrap_n876c_48",cet="_separator_n876c_55",uet="_statusSegment_n876c_48",det="_statusSegmentButton_n876c_61",het="_fullText_n876c_83",fet="_compactText_n876c_87",met="_detail_n876c_106",pet="_item_n876c_138",get="_icon_n876c_148",bet="_loadingIcon_n876c_156",yet="_content_n876c_165",xet="_completed_n876c_173",vet="_inProgress_n876c_187",wet="_pending_n876c_192",no={panel:set,summary:ret,progressRing:iet,stepText:oet,statusSegmentWrap:aet,separator:cet,statusSegment:uet,statusSegmentButton:det,fullText:het,compactText:fet,detail:met,item:pet,icon:get,loadingIcon:bet,content:yet,completed:xet,inProgress:vet,pending:wet};function ket(e){switch(e){case"completed":return no.completed;case"in_progress":return no.inProgress;case"pending":return no.pending}}const _et=f.memo(function({todos:t,title:n,statusItems:s=[]}){const{t:r}=ut();if(t.length===0&&s.length===0)return null;const i=t.length,o=i>0,a=t.findIndex(p=>p.status==="in_progress"),c=a>=0?a:t.findIndex(p=>p.status==="pending"),u=o?c>=0?c+1:i:0,d=o?u/i:0,h=s.map(p=>p.ariaLabel??p.title??(typeof p.label=="string"?p.label:void 0)).filter(Boolean).join(", ")||void 0,m=o?r("todo.stepProgress",{current:u,total:i}):h;return l.jsxs("section",{className:no.panel,"aria-label":n??(o?r("todo.title"):h),tabIndex:0,children:[l.jsxs("div",{className:no.summary,"aria-label":m,children:[o&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:no.progressRing,style:{"--todo-progress":String(d)},"aria-hidden":"true"}),l.jsxs("span",{className:no.stepText,children:[l.jsx("span",{className:no.fullText,children:r("todo.stepProgress",{current:u,total:i})}),l.jsx("span",{className:no.compactText,children:r("todo.stepFraction",{current:u,total:i})})]})]}),s.map((p,g)=>l.jsxs("span",{className:no.statusSegmentWrap,children:[(i>0||g>0)&&l.jsx("span",{className:no.separator,"aria-hidden":"true",children:"·"}),p.onClick?l.jsx("button",{type:"button",className:no.statusSegmentButton,title:p.title,"aria-label":p.ariaLabel,onClick:p.onClick,children:p.label}):l.jsx("span",{className:no.statusSegment,title:p.title,children:p.label})]},p.id))]}),i>0&&l.jsx("div",{className:no.detail,role:"tooltip",children:t.map((p,g)=>l.jsxs("div",{className:`${no.item} ${ket(p.status)}`,children:[l.jsx("span",{className:no.icon,"aria-hidden":"true",children:p.status==="in_progress"?l.jsx("span",{className:no.loadingIcon}):QS(p.status)}),l.jsx("span",{className:no.content,title:p.content,children:p.content})]},`${p.id||g}:${p.content}`))})]})}),Cet="_header_leiy3_1",Tet="_titleRow_leiy3_11",Eet="_title_leiy3_11",Aet="_subtitle_leiy3_31",Vk={header:Cet,titleRow:Tet,title:Eet,subtitle:Aet};function Net(e){const{t}=ut();return l.jsxs("div",{className:Vk.header,children:[l.jsxs("div",{className:Vk.titleRow,children:[l.jsx("span",{children:t("welcome.titlePrefix")}),l.jsx("span",{className:Vk.title,children:"Qwen Code"})]}),l.jsx("div",{className:Vk.subtitle,children:t("welcome.prompt")})]})}const jet="_themeDark_1tp31_1",Met="_themeLight_1tp31_25",pq={themeDark:jet,themeLight:Met},Iet={sm:"sm:max-w-[420px]",md:"sm:max-w-[560px]",lg:"sm:max-w-[720px]",xl:"sm:max-w-[900px]"},Ret=["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 gq(e){return e?Array.from(e.querySelectorAll(Ret)):[]}const eg=[],xie=f.createContext(null);function GA(e){return e===null?!0:eg[eg.length-1]===e}function Qr({title:e,subtitle:t,size:n="md",allowFullscreen:s=!1,onClose:r,children:i}){const{t:o}=ut(),a=w1(),[c,u]=f.useState(!1),d=f.useRef(null),h=f.useRef(r);h.current=r;const[m]=f.useState(()=>typeof document<"u"?document.activeElement:null),p=f.useRef(!1),g=f.useRef(!1),b=f.useRef(null);b.current===null&&(b.current={}),f.useEffect(()=>{const k=b.current;eg.push(k);const T=S=>{S.key!=="Escape"||!S.isComposing&&S.keyCode!==229||!GA(k)||(Object.defineProperty(S,"key",{configurable:!0,value:"Process"}),document.addEventListener("keydown",C=>{C===S&&Reflect.deleteProperty(S,"key")},{capture:!0,once:!0}))};return window.addEventListener("keydown",T,{capture:!0}),()=>{var A,N;window.removeEventListener("keydown",T,{capture:!0});const S=eg.indexOf(k);if(S>=0&&eg.splice(S,1),eg.length===0){(A=m==null?void 0:m.focus)==null||A.call(m);return}const C=Array.from(document.querySelectorAll("[data-keyboard-scope]")),_=C[C.length-1];(N=gq(_).find(j=>!j.hasAttribute("data-dialog-close"))??_)==null||N.focus()}},[m]);const v=k=>{p.current=k.target===k.currentTarget,g.current=!1},x=k=>{g.current=k.target===k.currentTarget},y=k=>{const T=p.current&&g.current&&k.target===k.currentTarget;p.current=!1,g.current=!1,T&&r()},w=a===$r.Light?pq.themeLight:pq.themeDark;return l.jsx(Wg,{open:!0,onOpenChange:k=>{k||r()},children:l.jsx(xie.Provider,{value:b.current,children:l.jsxs(Gg,{ref:d,showCloseButton:!1,overlayProps:{onMouseDown:v,onMouseUp:x,onClick:y},className:`${w} ${a===$r.Dark?"dark":""} flex max-h-[min(80vh,calc(100vh-48px))] flex-col gap-0 overflow-hidden p-0 font-mono text-sm ${c?"h-[calc(100vh-32px)] max-h-[calc(100vh-32px)] max-w-[calc(100vw-32px)] sm:max-w-[calc(100vw-32px)]":Iet[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||GA(b.current)&&(k.preventDefault(),h.current())},onOpenAutoFocus:k=>{var S;k.preventDefault(),(S=gq(d.current).find(C=>!C.hasAttribute("data-dialog-close"))??d.current)==null||S.focus()},onCloseAutoFocus:k=>k.preventDefault(),children:[l.jsxs(Kg,{className:"flex-row items-center gap-2 border-b px-4 py-2.5 text-left",children:[l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx(Xg,{children:e}),t&&l.jsx(Ex,{className:"mt-0.5 text-xs",children:t})]}),s&&l.jsx(qn,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>u(k=>!k),"aria-label":o(c?"common.exitFullscreen":"common.fullscreen"),"aria-pressed":c,title:o(c?"common.exitFullscreen":"common.fullscreen"),children:c?l.jsx(LG,{}):l.jsx(DG,{})}),l.jsx(IE,{asChild:!0,children:l.jsx(qn,{type:"button",variant:"ghost",size:"icon-sm","aria-label":o("common.close"),title:o("common.close"),"data-dialog-close":!0,children:l.jsx(MN,{})})})]}),l.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto p-4","data-dialog-fullscreen":c?"":void 0,children:i})]})})})}function Wk(e,t){return t<=0||e<0?0:e>t-1?t-1:e}const Det=new Set(["button","submit","reset"]),Let=new Set(["checkbox","radio","button","submit","reset","range","color","file"]);function bq(){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 Det.has(e.type);const n=e.getAttribute("role");return n==="button"||n==="link"||n==="menuitem"}function U6(){const e=typeof document<"u"?document.activeElement:null;if(!e)return!1;const t=e.tagName;return t==="TEXTAREA"?!0:t==="INPUT"?!Let.has(e.type):e.isContentEditable===!0}function rm({itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:s,enabled:r=!0}){const i=f.useContext(xie),o=f.useRef({itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:s});o.current={itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:s};const[a,c]=f.useState(!1);return f.useEffect(()=>{if(!r)return;const u=()=>c(!0),d=()=>c(!1),h=m=>{if(!GA(i)||m.defaultPrevented||m.isComposing||m.keyCode===229||m.metaKey||m.ctrlKey||m.altKey||m.shiftKey)return;const{itemCount:p,activeIndex:g}=o.current;if(!(p<=0))switch(m.key){case"ArrowDown":m.preventDefault(),u(),o.current.onActiveIndexChange(Wk(g+1,p));break;case"ArrowUp":m.preventDefault(),u(),o.current.onActiveIndexChange(Wk(g-1,p));break;case"Home":if(U6())return;m.preventDefault(),u(),o.current.onActiveIndexChange(0);break;case"End":if(U6())return;m.preventDefault(),u(),o.current.onActiveIndexChange(p-1);break;case"Enter":{if(bq()||g<0)return;m.preventDefault(),o.current.onConfirm(Wk(g,p));break}case" ":{if(bq()||U6()||g<0)return;m.preventDefault(),o.current.onConfirm(Wk(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 Pet="_picker_5cmbf_4",Oet="_selected_5cmbf_98",Bet="_disabled_5cmbf_114",$et={picker:Pet,"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:Oet,"picker-keyboard-only":"_picker-keyboard-only_5cmbf_106",disabled:Bet,"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 en(...e){return e.filter(t=>!!t).map(t=>$et[t]).filter(Boolean).join(" ")}const zet="_list_jbgdx_1",Fet="_row_jbgdx_16",qet="_selected_jbgdx_32",Het="_keyboardOnly_jbgdx_39",Uet="_modeName_jbgdx_47",Vet="_modeIcon_jbgdx_51",Wet="_modeText_jbgdx_67",Get="_modeDesc_jbgdx_83",wh={list:zet,row:Fet,selected:qet,keyboardOnly:Het,modeName:Uet,modeIcon:Vet,modeText:Wet,modeDesc:Get};function Ket({currentMode:e,onSelect:t}){const{t:n}=ut(),s=f.useRef(null),r=N4.map(m=>({id:m,name:n(`mode.listLabel.${m}`),description:n(`mode.desc.${m}`)})),i=r.findIndex(m=>m.id===e),[o,a]=f.useState(i>=0?i:0),c=f.useRef(!1);f.useEffect(()=>{c.current||i<0||a(i)},[i]);const u=m=>{c.current=!0,a(m)},d=m=>{const p=r[m];p&&t(p.id)},{keyboardMode:h}=rm({itemCount:r.length,activeIndex:o,onActiveIndexChange:u,onConfirm:d});return f.useEffect(()=>{var p;const m=(p=s.current)==null?void 0:p.children[o];m==null||m.scrollIntoView({block:"nearest"})},[o]),l.jsx("div",{className:`${wh.list} ${h?wh.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((m,p)=>{const g=p===o,b=m.id===e;return l.jsxs("div",{id:`mode-opt-${p}`,role:"option","aria-selected":b,className:`${wh.row} ${g?wh.selected:""} ${b?en("dialog-current"):""}`,"data-web-shell-approval-mode-option":!0,"data-mode-id":m.id,onClick:()=>d(p),onMouseMove:()=>u(p),children:[l.jsx("span",{className:wh.modeIcon,children:l.jsx(ly,{mode:m.id})}),l.jsxs("span",{className:wh.modeText,children:[l.jsx("span",{className:wh.modeName,children:m.name}),l.jsx("span",{className:wh.modeDesc,children:m.description})]})]},m.id)})})}function cC(e){const[t,n]=f.useState(""),[s,r]=f.useState(""),i=f.useRef(!1),o=f.useRef(""),a=f.useRef(e);a.current=e;const c=f.useCallback(m=>{var p;m!==o.current&&(o.current=m,r(m),(p=a.current)==null||p.call(a,m))},[]),u=f.useCallback(m=>{const p=m.target.value;n(p),i.current||c(p)},[c]),d=f.useCallback(()=>{i.current=!0},[]),h=f.useCallback(m=>{i.current=!1;const p=m.currentTarget.value;n(p),c(p)},[c]);return{filterValue:s,inputProps:{value:t,onChange:u,onCompositionStart:d,onCompositionEnd:h}}}function s4(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 NI({session:e,active:t,current:n,confirmed:s,disabled:r,currentLabel:i,optionId:o,ariaSelected:a,leading:c,trailing:u,resumeSelector:d,onClick:h,onActivate:m}){const{t:p}=ut(),g=e.updatedAt||e.createdAt;return l.jsxs("div",{id:o,role:"option","aria-selected":a??n,"aria-current":n?"true":void 0,"aria-disabled":r||void 0,className:en("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:m,children:[l.jsxs("div",{className:en("picker-item-row"),children:[c,l.jsx("span",{className:en("picker-item-title"),children:e.displayName||e.sessionId.slice(0,8)}),u]}),l.jsxs("div",{className:en("picker-item-meta"),children:[l.jsx("span",{children:g&&s4(g,p)}),l.jsx("span",{className:en("picker-item-detail"),children:p("common.clients",{count:e.clientCount??0})}),e.hasActivePrompt&&l.jsx("span",{className:en("picker-item-detail"),children:p("resume.activePrompt")})]})]})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const cd=1e3,jI="session_organization",r4="default",vie=100,wie=5e4;function qv(e,t={}){const{autoLoad:n=!1,enabled:s=!0,pageSize:r,archiveState:i,view:o,group:a}=t,c=S2({autoLoad:n,enabled:s&&!e,pageSize:r,archiveState:i,view:o,group:a,sourceType:r4}),{reload:u,deleteSession:d,deleteSessions:h}=c,m=dc(),p=f.useRef(0),[g,b]=f.useState({sessions:[],loading:!1}),v=f.useCallback(async()=>{if(!e||!s)return[];const T=++p.current;b(S=>({cwd:e,sessions:S.cwd===e?S.sessions:[],loading:!0}));try{const C=(await m.client.workspaceByCwd(e).listWorkspaceSessions({pageSize:r,archiveState:i,view:o,group:a,sourceType:r4})).map(_=>({..._,workspaceCwd:e}));return p.current===T&&b({cwd:e,sessions:C,loading:!1}),C}catch(S){const C=S instanceof Error?S:new Error(String(S));throw p.current===T&&b({cwd:e,sessions:[],loading:!1,error:C}),C}},[i,s,a,r,o,m.client,e]);f.useEffect(()=>{if(e)return p.current+=1,b({cwd:e,sessions:[],loading:n&&s}),n&&s&&v().catch(()=>{}),()=>{p.current+=1}},[n,s,v,e]);const x=f.useCallback(()=>e?v():u(),[u,v,e]),y=f.useCallback(async T=>{if(!e)return h(T);const S=await m.client.workspaceByCwd(e).deleteSessionsData(T);return await v(),S},[h,v,m.client,e]),w=f.useCallback(async T=>{if(!e)return d(T);const S=await y([T]);if(S.errors.length>0)throw new Error(S.errors[0].error);return S.removed.length>0||S.notFound.length>0},[d,y,e]);if(!e)return c;const k=g.cwd===e?g:void 0;return{sessions:(k==null?void 0:k.sessions)??[],loading:(k==null?void 0:k.loading)??(n&&s),error:k==null?void 0:k.error,reload:x,deleteSession:w,deleteSessions:y,releaseSession:c.releaseSession}}const KA="resume-session-list",yq=e=>`${KA}-opt-${e}`;function Yet({onSelect:e,onClose:t,workspaceCwd:n}){const{t:s}=ut(),r=Cl(),{sessions:i,loading:o,error:a}=qv(n,{autoLoad:!0}),c=r.sessionId,[u,d]=f.useState(-1),{filterValue:h,inputProps:m}=cC(()=>d(-1)),p=f.useRef(null),g=f.useRef(null),b=h?i.filter(y=>{const w=h.toLowerCase();return(y.displayName||"").toLowerCase().includes(w)||y.sessionId.toLowerCase().includes(w)}):i;f.useEffect(()=>{u>=b.length&&b.length>0&&d(b.length-1)},[b.length,u]),f.useEffect(()=>{var w;const y=(w=p.current)==null?void 0:w.children[u];y==null||y.scrollIntoView({block:"nearest"})},[u]);const v=y=>{const w=b[y];w&&(e(w.sessionId),t())},{keyboardMode:x}=rm({itemCount:b.length,activeIndex:u,onActiveIndexChange:d,onConfirm:v});return f.useEffect(()=>{var y;(y=g.current)==null||y.focus()},[]),l.jsxs("div",{className:en("picker","picker-in-shell"),"data-web-shell-resume-dialog":!0,children:[l.jsxs("div",{className:en("picker-search"),children:[l.jsxs("span",{className:en("picker-search-label"),children:[s("resume.search"),":"," "]}),l.jsx("input",{ref:g,className:en("picker-search-input"),"aria-label":s("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":KA,"aria-activedescendant":u>=0&&u<b.length?yq(u):void 0,...m,placeholder:""})]}),l.jsx("div",{className:en("picker-sep")}),l.jsxs("div",{id:KA,role:"listbox",className:en("picker-list",x?"picker-keyboard-only":void 0),ref:p,children:[o&&l.jsx("div",{className:en("picker-empty"),children:s("common.loading")}),!o&&a&&l.jsx("div",{className:en("picker-empty"),children:a.message||s("resume.failedToLoad")}),!o&&!a&&b.length===0&&l.jsx("div",{className:en("picker-empty"),children:h?s("resume.noMatch",{query:h}):s("resume.none")}),!o&&b.map((y,w)=>l.jsx(NI,{session:y,optionId:yq(w),active:w===u,current:y.sessionId===c,currentLabel:s("resume.current"),resumeSelector:!0,onClick:()=>v(w),onActivate:()=>d(w)},y.sessionId))]})]})}const Xet="_layout_1sigx_1",Qet="_list_1sigx_9",Jet="_row_1sigx_23",Zet="_selected_1sigx_39",ett="_keyboardOnly_1sigx_46",ttt="_label_1sigx_54",ntt="_divider_1sigx_58",stt="_number_1sigx_65",rtt="_provider_1sigx_71",itt="_badge_1sigx_86",ott="_detail_1sigx_92",att="_detailRow_1sigx_104",ltt="_detailLabel_1sigx_111",ctt="_detailValue_1sigx_117",utt="_empty_1sigx_122",ra={layout:Xet,list:Qet,row:Jet,selected:Zet,keyboardOnly:ett,label:ttt,divider:ntt,number:stt,provider:rtt,badge:itt,detail:ott,detailRow:att,detailLabel:ltt,detailValue:ctt,empty:utt};function dtt(e,t){return e?`${e.toLocaleString()} ${t("contextUsage.tokens")}`:t("model.contextWindow.unknown")}function htt(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 xq(e){if(e.authType)return e.authType;const t=e.id.match(/\(([^()]+)\)$/);return t==null?void 0:t[1]}function ftt(e){return e.label?e.label:e.baseModelId?e.baseModelId:e.id.replace(/\([^()]+\)$/,"")}function mtt(e){return[e.authType??"",e.id,e.baseUrl??"",e.envKey??""].join("\0")}function ptt(e,t){return t?e.baseModelId??e.id.replace(/\([^()]+\)$/,""):e.id}function Gk({label:e,value:t}){return l.jsxs("div",{className:ra.detailRow,children:[l.jsx("span",{className:ra.detailLabel,children:e}),l.jsx("span",{className:ra.detailValue,children:t})]})}function gtt({mode:e="main",onSelect:t,models:n,currentModelId:s}){const r=Cl(),i=s??r.currentModel??"",o=f.useMemo(()=>n??r.models??[],[n,r.models]),{t:a}=ut(),c=f.useRef(null),u=e==="fast",d=e==="voice",h=e==="vision",m=o.findIndex(k=>k.id===i),[p,g]=f.useState(m>=0?m:0),b=f.useRef(!1);f.useEffect(()=>{b.current||o.length===0||g(m>=0?m:0)},[o.length,m]);const v=k=>{b.current=!0,g(k)};f.useEffect(()=>{p>=o.length&&o.length>0&&g(o.length-1)},[o.length,p]);const x=o[p]??o[0],y=k=>{const T=o[k];T&&t(ptt(T,u))},{keyboardMode:w}=rm({itemCount:o.length,activeIndex:p,onActiveIndexChange:v,onConfirm:y});return f.useEffect(()=>{var T;const k=(T=c.current)==null?void 0:T.children[p];k==null||k.scrollIntoView({block:"nearest"})},[p]),l.jsxs("div",{className:ra.layout,children:[l.jsxs("div",{className:`${ra.list} ${w?ra.keyboardOnly:""}`,ref:c,role:"listbox",tabIndex:0,"aria-activedescendant":o.length>0?`model-opt-${p}`:void 0,"aria-label":a(u?"model.setFast":d?"model.setVoice":h?"model.setVision":"model.select"),"data-web-shell-model-dialog":!0,children:[o.length===0?l.jsx("div",{className:ra.empty,children:a("model.none")}):null,o.map((k,T)=>{const S=T===p,C=T===m,_=xq(k);return l.jsxs("div",{id:`model-opt-${T}`,role:"option","aria-selected":C,className:`${ra.row} ${S?ra.selected:""} ${C?en("dialog-current"):""}`,"data-web-shell-model-option":!0,"data-model-id":k.id,onClick:()=>y(T),onMouseMove:()=>v(T),children:[l.jsxs("span",{className:ra.number,children:[T+1,"."]}),_?l.jsxs("span",{className:ra.provider,children:["[",_,"]"]}):null,l.jsx("span",{className:ra.label,children:ftt(k)}),k.isRuntime?l.jsx("span",{className:ra.badge,children:a("common.runtime")}):null]},mtt(k))})]}),x?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:ra.divider}),l.jsxs("div",{className:ra.detail,children:[l.jsx(Gk,{label:a("model.modality"),value:htt(x.modalities,a)}),l.jsx(Gk,{label:a("model.contextWindow"),value:dtt(x.contextWindow,a)}),xq(x)!=="qwen-oauth"?l.jsxs(l.Fragment,{children:[l.jsx(Gk,{label:a("model.baseUrl"),value:x.baseUrl??a("model.default")}),l.jsx(Gk,{label:a("model.apiKey"),value:x.envKey??a("model.notSet")})]}):null]})]}):null]})}const btt="_body_2kfet_1",ytt="_hint_2kfet_8",xtt="_list_2kfet_13",vtt="_empty_2kfet_21",wtt="_row_2kfet_27",ktt="_rowSelected_2kfet_51",_tt="_badge_2kfet_56",Stt="_label_2kfet_74",Ctt="_footer_2kfet_78",Ttt="_count_2kfet_86",Ett="_actions_2kfet_91",Att="_cancel_2kfet_96",Ntt="_confirm_2kfet_97",nl={body:btt,hint:ytt,list:xtt,empty:vtt,row:wtt,rowSelected:ktt,badge:_tt,label:Stt,footer:Ctt,count:Ttt,actions:Ett,cancel:Att,confirm:Ntt};function jtt({models:e,current:t,max:n,onConfirm:s,onClose:r}){const{t:i}=ut(),[o,a]=f.useState(()=>{const d=new Set,h=[];for(const m of t){const p=m.trim();if(!(!p||d.has(p))&&(d.add(p),h.push(p),h.length>=n))break}return h}),c=f.useMemo(()=>{const d=new Set(e.map(m=>m.baseId)),h=o.filter(m=>!d.has(m)).map(m=>({baseId:m,label:m}));return[...e,...h]},[e,o]),u=d=>{a(h=>h.includes(d)?h.filter(m=>m!==d):h.length>=n?h:[...h,d])};return l.jsxs("div",{className:nl.body,children:[l.jsx("div",{className:nl.hint,children:i("settings.models.fallbacks.hint",{max:n})}),l.jsxs("div",{className:nl.list,role:"group","aria-label":i("settings.models.fallbacks.title"),children:[c.length===0&&l.jsx("div",{className:nl.empty,children:i("settings.models.fallbacks.empty")}),c.map(d=>{const h=o.indexOf(d.baseId),m=h>=0,p=o.length>=n&&!m;return l.jsxs("button",{type:"button","aria-pressed":m,className:`${nl.row} ${m?nl.rowSelected:""}`,"aria-disabled":p||void 0,title:p?i("settings.models.fallbacks.limitReached",{max:n}):void 0,onClick:()=>u(d.baseId),children:[l.jsx("span",{className:nl.badge,children:m?h+1:""}),l.jsx("span",{className:nl.label,children:d.label})]},d.baseId)})]}),l.jsxs("div",{className:nl.footer,children:[l.jsxs("span",{className:nl.count,children:[o.length,"/",n]}),l.jsxs("div",{className:nl.actions,children:[l.jsx("button",{type:"button",className:nl.cancel,onClick:r,children:i("settings.models.cancel")}),l.jsx("button",{type:"button",className:nl.confirm,onClick:()=>s(o),children:i("settings.models.fallbacks.confirm")})]})]})]})}function $m(e){return e.replace(/[：:\s]+$/u,"")}const Mtt="_panel_irhhk_1",Itt="_embedded_irhhk_13",Rtt="_footer_irhhk_21",Dtt="_titleLine_irhhk_25",Ltt="_icon_irhhk_32",Ptt="_title_irhhk_25",Ott="_subtitle_irhhk_44",Btt="_text_irhhk_49",$tt="_options_irhhk_55",ztt="_option_irhhk_55",Ftt="_optionActive_irhhk_77",qtt="_optionLabel_irhhk_81",Htt="_optionIcon_irhhk_86",Utt="_optionContent_irhhk_119",Vtt="_optionDesc_irhhk_129",Wtt="_badge_irhhk_135",Gtt="_toolDetail_irhhk_170",Ktt="_toolDetailTitle_irhhk_175",Ytt="_toolDetailBody_irhhk_180",Xtt="_toolList_irhhk_181",Qtt="_textInput_irhhk_193",Jtt="_textArea_irhhk_211",Ztt="_summary_irhhk_231",ent="_summaryRow_irhhk_238",tnt="_summaryLabel_irhhk_244",nnt="_summaryValue_irhhk_250",snt="_summaryBlockTitle_irhhk_255",rnt="_summaryBlock_irhhk_255",int="_manageList_irhhk_295",ont="_manageItem_irhhk_301",ant="_manageItemExpanded_irhhk_307",lnt="_manageRow_irhhk_312",cnt="_manageRowActive_irhhk_329",unt="_manageIcon_irhhk_333",dnt="_manageName_irhhk_362",hnt="_levelTag_irhhk_370",fnt="_manageChevron_irhhk_380",mnt="_manageChevronExpanded_irhhk_398",pnt="_manageDetail_irhhk_402",gnt="_manageDetailInner_irhhk_409",bnt="_manageDetailHeader_irhhk_419",ynt="_manageActions_irhhk_426",xnt="_manageButton_irhhk_433",vnt="_dangerButton_irhhk_453",wnt="_deleteText_irhhk_457",knt="_viewerRow_irhhk_487",_nt="_viewerLabel_irhhk_500",Snt="_viewerField_irhhk_507",Cnt="_viewerSectionTitle_irhhk_512",Tnt="_viewerBlock_irhhk_518",Ent="_closed_irhhk_524",Ant="_closedText_irhhk_528",Nnt="_loading_irhhk_534",jnt="_error_irhhk_539",Mnt="_createWizard_irhhk_545",Int="_createSteps_irhhk_551",Rnt="_createStepPill_irhhk_559",Dnt="_createStepPillActive_irhhk_571",Lnt="_createStepPillDone_irhhk_576",Pnt="_createStepNumber_irhhk_580",Ont="_createStepLabel_irhhk_591",Bnt="_createBody_irhhk_597",$nt="_createActions_irhhk_601",lt={panel:Mtt,embedded:Itt,footer:Rtt,titleLine:Dtt,icon:Ltt,title:Ptt,subtitle:Ott,text:Btt,options:$tt,option:ztt,optionActive:Ftt,optionLabel:qtt,optionIcon:Htt,optionContent:Utt,optionDesc:Vtt,badge:Wtt,toolDetail:Gtt,toolDetailTitle:Ktt,toolDetailBody:Ytt,toolList:Xtt,textInput:Qtt,textArea:Jtt,summary:Ztt,summaryRow:ent,summaryLabel:tnt,summaryValue:nnt,summaryBlockTitle:snt,summaryBlock:rnt,manageList:int,manageItem:ont,manageItemExpanded:ant,manageRow:lnt,manageRowActive:cnt,manageIcon:unt,manageName:dnt,levelTag:hnt,manageChevron:fnt,manageChevronExpanded:mnt,manageDetail:pnt,manageDetailInner:gnt,manageDetailHeader:bnt,manageActions:ynt,manageButton:xnt,dangerButton:vnt,deleteText:wnt,viewerRow:knt,viewerLabel:_nt,viewerField:Snt,viewerSectionTitle:Cnt,viewerBlock:Tnt,closed:Ent,closedText:Ant,loading:Nnt,error:jnt,createWizard:Mnt,createSteps:Int,createStepPill:Rnt,createStepPillActive:Dnt,createStepPillDone:Lnt,createStepNumber:Pnt,createStepLabel:Ont,createBody:Bnt,createActions:$nt};function kie(e){if(e==="project")return"workspace";if(e==="user")return"global"}function _ie(e){return kie(e.level)!==void 0&&!e.isBuiltin&&e.level!=="extension"}function znt(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 fu=$m;function Fnt(e){return e.displayName||e.name}function Sie(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 Cie(e){const t=e.toLowerCase();return["edit","write","delete","move","patch","replace","create"].some(n=>t.includes(n))}function Tie(e){const t=e.toLowerCase();return["shell","exec","run","command","terminal","bash","spawn"].some(n=>t.includes(n))}function qnt(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 Hnt({mode:e,embedded:t=!1,onMessage:n,onClose:s}){const{t:r}=ut(),{agents:i,loading:o,reload:a,getAgent:c,createAgent:u,generateAgent:d,deleteAgent:h}=rme({autoLoad:!0}),{tools:m}=AG({autoLoad:!0}),[p,g]=f.useState(!1),[b,v]=f.useState(()=>e==="manage"?"manage":e==="create"||e==="create-user"||e==="create-project"?"create":"menu"),[x,y]=f.useState(0),[w,k]=f.useState(0),[T,S]=f.useState(null),[C,_]=f.useState(null),[B,A]=f.useState(!1),[N,j]=f.useState(null),[P,L]=f.useState(1),[O,$]=f.useState(()=>e==="create-user"?"global":"workspace"),[z,F]=f.useState("manual"),[G,I]=f.useState(""),[Q,V]=f.useState(""),[M,re]=f.useState(""),[se,X]=f.useState([]),[J,de]=f.useState(0),[W,te]=f.useState(!1),[U,ee]=f.useState(!1),oe=f.useRef(0),Ce=f.useCallback(()=>{g(!0),s()},[s]),he=f.useMemo(()=>{const et=i.filter(ne=>ne.level==="project"),qe=i.filter(ne=>ne.level==="user"),Ke=i.filter(ne=>ne.level==="builtin"),ke=i.filter(ne=>ne.level==="extension");return{project:et,user:qe,builtin:Ke,extension:ke}},[i]),ye=f.useMemo(()=>[...he.project,...he.user,...he.builtin,...he.extension],[he]),Ve=f.useMemo(()=>{const et=m.filter(ne=>ne.enabled).map(Fnt).sort((ne,gt)=>ne.localeCompare(gt)),qe=et.filter(Sie),Ke=et.filter(Cie),ke=et.filter(Tie);return[{id:"all",label:r("agent.create.tools.all"),tools:[]},{id:"read",label:r("agent.create.tools.readOnly"),tools:qe},{id:"edit",label:r("agent.create.tools.readEdit"),tools:[...new Set([...qe,...Ke])]},{id:"execute",label:r("agent.create.tools.readEditExecute"),tools:[...new Set([...qe,...Ke,...ke])]}]},[r,m]);f.useEffect(()=>{if(b!=="manage")return;const et=C!==null?ye[C]:void 0;et&&c(et.name).then(S).catch(qe=>j(qe instanceof Error?qe.message:String(qe)))},[b,ye,C,c]),f.useEffect(()=>{w>=ye.length&&ye.length>0&&k(ye.length-1),C!==null&&C>=ye.length&&_(null)},[C,ye.length,w]);const it=f.useCallback((et=w)=>{const qe=ye[et];if(!qe||!_ie(qe))return;const Ke=kie(qe.level);Ke&&(A(!0),h(qe.name,Ke).then(()=>{n(r("agent.deleted",{name:qe.name})),S(null),_(null),k(0),a()}).catch(ke=>j(ke instanceof Error?ke.message:String(ke))).finally(()=>A(!1)))},[ye,w,h,n,a,r]),At=f.useCallback(()=>{if(!G.trim()||!Q.trim()||!M.trim()){j(r("agent.create.required"));return}A(!0),u({name:G.trim(),description:Q.trim(),systemPrompt:M.trim(),scope:O,tools:se}).then(et=>{n(r("agent.created",{name:et.agent.name})),Ce()}).catch(et=>j(et instanceof Error?et.message:String(et))).finally(()=>A(!1))},[G,Q,M,O,se,u,n,Ce,r]),Ee=f.useCallback(async()=>{const et=Q.trim();if(!et||W)return;const qe=oe.current+1;oe.current=qe,te(!0),ee(!1),j(null);try{const Ke=await d(et);if(oe.current!==qe)return;I(Ke.name),V(Ke.description),re(Ke.systemPrompt),L(z==="manual"?6:4),de(0)}catch(Ke){if(oe.current!==qe)return;j(r("agent.create.generateFailed",{error:Ke instanceof Error?Ke.message:String(Ke)})),ee(!0)}finally{oe.current===qe&&te(!1)}},[Q,W,z,d,r]),me=f.useCallback(et=>{if(et==="name"&&G.trim())L(4),ee(!0);else if(et==="prompt"&&M.trim())L(5),ee(!0);else if(et==="desc"&&Q.trim()){if(z==="qwen"){Ee();return}L(z==="manual"?6:4),de(0),ee(!1)}},[G,Q,M,z,Ee]);if(p)return l.jsx("div",{className:`${lt.panel} ${t?lt.embedded:""} ${lt.closed}`,children:l.jsx("div",{className:lt.closedText,children:r("agents.closed")})});if(o&&i.length===0)return l.jsxs("div",{className:`${lt.panel} ${t?lt.embedded:""}`,children:[l.jsxs("div",{className:lt.titleLine,children:[l.jsx("span",{className:lt.icon,children:"?"}),l.jsx("span",{className:lt.title,children:r("agents.title")})]}),l.jsx("div",{className:lt.loading,children:r("common.loading")})]});const bt=r("agents.title");return l.jsxs("div",{className:`${lt.panel} ${t?lt.embedded:""}`,children:[!t&&b!=="create"&&l.jsxs("div",{className:lt.titleLine,children:[l.jsx("span",{className:lt.icon,children:"?"}),l.jsx("span",{className:lt.title,children:bt}),l.jsx("span",{className:lt.subtitle,children:r("agent.count",{count:i.length})})]}),N&&l.jsx("div",{className:lt.error,children:N}),b==="menu"&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:lt.text,children:r("agent.selectAction")}),l.jsxs("div",{className:lt.options,children:[l.jsx(zm,{idx:0,active:x===0,label:r("agent.manage"),desc:r("agent.manage.desc"),onClick:()=>{y(0),v("manage")},onHover:()=>y(0)}),l.jsx(zm,{idx:1,active:x===1,label:r("agent.create"),desc:r("agent.create.desc"),onClick:()=>{y(1),v("create")},onHover:()=>y(1)})]}),l.jsx("div",{className:lt.footer,children:r("agent.footer.nav")})]}),b==="manage"&&l.jsx(Unt,{agents:ye,expandedAgentIdx:C,selectedAgent:T,busy:B,onToggleAgent:et=>{k(et),_(qe=>qe===et?null:et),S(null)},onDelete:et=>{B||it(et)},t:r}),b==="create"&&l.jsx(Vnt,{step:P,method:z,scope:O,name:G,desc:Q,prompt:M,tools:se,toolCategories:Ve,selIdx:J,busy:B,generating:W,inputFocused:U,onSetName:I,onSetDesc:V,onSetPrompt:re,onInputNext:me,onInputFocus:()=>ee(!0),onInputBlur:()=>ee(!1),onSetStep:L,onSetSelectedIndex:de,onSelectLocation:et=>{de(et),$(et===0?"workspace":"global")},onSelectMethod:et=>{de(et),F(et===0?"qwen":"manual")},onSelectTools:et=>{var qe;de(et),X(((qe=Ve[et])==null?void 0:qe.tools)??[])},onSave:()=>{B||At()},t:r})]})}function zm({idx:e,active:t,label:n,desc:s,badge:r,numbered:i=!1,onClick:o,onHover:a}){return l.jsxs("div",{className:`${lt.option} ${t?lt.optionActive:""}`,onClick:o,onMouseEnter:a,children:[l.jsx("span",{className:lt.optionIcon,"aria-hidden":"true"}),l.jsxs("span",{className:lt.optionContent,children:[l.jsxs("span",{className:lt.optionLabel,children:[i?`${e+1}. `:"",n,r&&l.jsx("span",{className:lt.badge,children:r})]}),s&&l.jsx("span",{className:lt.optionDesc,children:s})]})]})}function Unt({agents:e,expandedAgentIdx:t,selectedAgent:n,busy:s,onToggleAgent:r,onDelete:i,t:o}){const[a,c]=f.useState(null),u=f.useMemo(()=>new Set(e.filter(d=>d.level==="project").map(d=>d.name)),[e]);return e.length===0?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:lt.text,children:o("agent.empty")}),l.jsx("div",{className:lt.text,children:o("agent.createFirstHint")})]}):l.jsx("div",{className:lt.manageList,children:e.map((d,h)=>{const m=t===h,p=m&&(n==null?void 0:n.name)===d.name?n:null,g=_ie(d),b=(p==null?void 0:p.tools)??[],v=b.length===0||b.includes("*")?o("agent.create.tools.all"):b.join(", ");return l.jsxs("div",{className:`${lt.manageItem} ${m?lt.manageItemExpanded:""}`,children:[l.jsxs("button",{type:"button",className:`${lt.manageRow} ${m?lt.manageRowActive:""}`,onClick:()=>{c(null),r(h)},children:[l.jsx("span",{className:lt.manageIcon,"aria-hidden":"true"}),l.jsx("span",{className:lt.manageName,children:d.name}),l.jsx("span",{className:lt.levelTag,children:znt(d.level,o)}),d.level==="user"&&u.has(d.name)?l.jsx("span",{className:lt.levelTag,children:o("agent.overriddenBadge")}):null,l.jsx("span",{className:`${lt.manageChevron} ${m?lt.manageChevronExpanded:""}`})]}),m?l.jsx("div",{className:lt.manageDetail,children:p?l.jsxs("div",{className:lt.manageDetailInner,children:[l.jsx("div",{className:lt.manageDetailHeader,children:g?l.jsx("div",{className:lt.manageActions,children:a===h?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:lt.deleteText,children:s?o("agent.delete.loading"):o("agent.delete.confirm",{name:d.name})}),l.jsx("button",{type:"button",className:lt.manageButton,onClick:()=>c(null),disabled:s,children:o("common.cancel")}),l.jsx("button",{type:"button",className:`${lt.manageButton} ${lt.dangerButton}`,onClick:()=>i(h),disabled:s,children:o("agent.action.delete")})]}):l.jsx("button",{type:"button",className:`${lt.manageButton} ${lt.dangerButton}`,onClick:()=>c(h),disabled:s,children:o("agent.action.delete")})}):null}),l.jsxs("div",{className:lt.viewerField,children:[l.jsx("div",{className:lt.viewerSectionTitle,children:fu(o("agent.toolsLabel"))}),l.jsx("div",{className:lt.viewerBlock,children:v})]}),l.jsxs("div",{className:lt.viewerField,children:[l.jsx("div",{className:lt.viewerSectionTitle,children:fu(o("agent.filePathLabel"))}),l.jsx("div",{className:lt.viewerBlock,children:p.filePath||"—"})]}),p.model?l.jsxs("div",{className:lt.viewerRow,children:[l.jsx("span",{className:lt.viewerLabel,children:fu(o("agent.modelLabel"))}),l.jsx("span",{children:p.model})]}):null,l.jsxs("div",{className:lt.viewerField,children:[l.jsx("div",{className:lt.viewerSectionTitle,children:fu(o("agent.descriptionLabel"))}),l.jsx("div",{className:lt.viewerBlock,children:p.description||"—"})]}),l.jsxs("div",{className:lt.viewerField,children:[l.jsx("div",{className:lt.viewerSectionTitle,children:fu(o("agent.systemPromptLabel"))}),l.jsx("div",{className:lt.viewerBlock,children:p.systemPrompt||"—"})]})]}):l.jsx("div",{className:lt.loading,children:o("common.loading")})}):null]},`${d.level}:${d.name}`)})})}function Vnt({step:e,method:t,scope:n,name:s,desc:r,prompt:i,tools:o,toolCategories:a,selIdx:c,busy:u,generating:d,inputFocused:h,onSetName:m,onSetDesc:p,onSetPrompt:g,onInputNext:b,onInputFocus:v,onInputBlur:x,onSetStep:y,onSetSelectedIndex:w,onSelectLocation:k,onSelectMethod:T,onSelectTools:S,onSave:C,t:_}){const B=f.useRef(null),A=f.useRef(null),N=f.useRef(null);f.useEffect(()=>{var Q,V,M,re;h&&(t==="manual"?e===3?(Q=B.current)==null||Q.focus():e===4?(V=N.current)==null||V.focus():e===5&&((M=A.current)==null||M.focus()):e===3&&((re=A.current)==null||re.focus()))},[e,t,h]);const j=t==="manual"?6:4,P=j+1,L=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")],O=Q=>Q===1?n==="workspace"?0:1:Q===2?t==="qwen"?0:1:Q===j?qnt(a,o):0,$=Q=>{y(Q),w(O(Q)),t==="manual"&&(Q===3||Q===4||Q===5)||t==="qwen"&&Q===3?v():x()},z=()=>{e<=1||d||$(e-1)},F=()=>{if(!d){if(e===1){$(2);return}if(e===2){$(3);return}if(t==="manual"&&e===3){b("name");return}if(t==="manual"&&e===4){b("prompt");return}if(t==="manual"&&e===5||t==="qwen"&&e===3){b("desc");return}e===j&&(S(c),$(P))}},G=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 I=null;if(e===1&&(I=l.jsx(l.Fragment,{children:l.jsxs("div",{className:lt.options,children:[l.jsx(zm,{idx:0,active:c===0,label:_("agent.create.project.cli"),numbered:!0,onClick:()=>k(0)}),l.jsx(zm,{idx:1,active:c===1,label:_("agent.create.user.cli"),numbered:!0,onClick:()=>k(1)})]})})),e===2&&(I=l.jsx(l.Fragment,{children:l.jsxs("div",{className:lt.options,children:[l.jsx(zm,{idx:0,active:c===0,label:_("agent.create.method.qwen.recommended"),numbered:!0,onClick:()=>T(0)}),l.jsx(zm,{idx:1,active:c===1,label:_("agent.create.method.manual"),numbered:!0,onClick:()=>T(1)})]})})),t==="manual"&&e===3&&(I=l.jsxs(l.Fragment,{children:[l.jsx("div",{className:lt.text,children:_("agent.create.nameHelp")}),l.jsx("input",{ref:B,className:lt.textInput,value:s,onChange:Q=>m(Q.target.value),onFocus:v,onBlur:x,placeholder:_("agent.create.namePlaceholder"),autoFocus:!0})]})),t==="manual"&&e===4&&(I=l.jsxs(l.Fragment,{children:[l.jsx("div",{className:lt.text,children:_("agent.create.promptHelp")}),l.jsx("textarea",{ref:N,className:lt.textArea,value:i,onChange:Q=>g(Q.target.value),onFocus:v,onBlur:x,placeholder:_("agent.create.promptPlaceholder.cli"),autoFocus:!0})]})),t==="manual"&&e===5&&(I=l.jsxs(l.Fragment,{children:[l.jsx("div",{className:lt.text,children:_("agent.create.manualDescHelp")}),l.jsx("textarea",{ref:A,className:lt.textArea,value:r,onChange:Q=>p(Q.target.value),onFocus:v,onBlur:x,placeholder:_("agent.create.manualDescPlaceholder"),autoFocus:!0})]})),t==="qwen"&&e===3&&(I=l.jsxs(l.Fragment,{children:[l.jsx("div",{className:lt.text,children:_("agent.create.qwenHint")}),d?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:lt.text,children:_("agent.create.generatingConfig")}),l.jsx("div",{className:lt.footer,children:_("agent.footer.generating")})]}):l.jsx(l.Fragment,{children:l.jsx("textarea",{ref:A,className:lt.textArea,value:r,onChange:Q=>p(Q.target.value),onFocus:v,onBlur:x,placeholder:_("agent.create.qwenPlaceholder"),autoFocus:!0})})]})),e===j){const Q=a[c]??a[0],V=(Q==null?void 0:Q.tools)??[],M=(Q==null?void 0:Q.id)==="all"?_("agent.create.tools.allInfo"):V.length>0?V.join(", "):_("agent.create.tools.none"),re=V.filter(Sie),se=V.filter(Cie),X=V.filter(Tie);I=l.jsxs(l.Fragment,{children:[l.jsx("div",{className:lt.options,children:a.map((J,de)=>l.jsx(zm,{idx:de,active:c===de,label:J.label,numbered:!0,onClick:()=>S(de)},J.id))}),l.jsx("div",{className:lt.toolDetail,children:(Q==null?void 0:Q.id)==="all"?l.jsx("div",{className:lt.toolDetailBody,children:M}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:lt.toolDetailTitle,children:_("agent.create.tools.selected")}),l.jsx("div",{className:lt.toolList,children:V.length===0?M:l.jsxs(l.Fragment,{children:[re.length>0&&l.jsxs("div",{children:[_("agent.create.tools.readOnlyLabel")," ",re.join(", ")]}),se.length>0&&l.jsxs("div",{children:[_("agent.create.tools.editLabel")," ",se.join(", ")]}),X.length>0&&l.jsxs("div",{children:[_("agent.create.tools.executionLabel")," ",X.join(", ")]})]})})]})})]})}if(e===P){const Q=o.length===0?"*":o.join(", ");I=l.jsx(l.Fragment,{children:l.jsxs("div",{className:lt.summary,children:[l.jsxs("div",{className:lt.summaryRow,children:[l.jsx("span",{className:lt.summaryLabel,children:fu(_("agent.create.name"))}),l.jsx("span",{className:lt.summaryValue,children:s||"—"})]}),l.jsxs("div",{className:lt.summaryRow,children:[l.jsx("span",{className:lt.summaryLabel,children:fu(_("agent.location"))}),l.jsx("span",{className:lt.summaryValue,children:_(n==="workspace"?"agent.create.project.cli":"agent.create.user.cli")})]}),l.jsxs("div",{className:lt.summaryRow,children:[l.jsx("span",{className:lt.summaryLabel,children:fu(_("agent.toolsLabel"))}),l.jsx("span",{className:lt.summaryValue,children:Q})]}),l.jsx("div",{className:lt.summaryBlockTitle,children:fu(_("agent.descriptionLabel"))}),l.jsx("div",{className:lt.summaryBlock,children:r||"—"}),l.jsx("div",{className:lt.summaryBlockTitle,children:fu(_("agent.systemPromptLabel"))}),l.jsx("div",{className:lt.summaryBlock,children:i||"—"})]})})}return l.jsxs("div",{className:lt.createWizard,children:[l.jsx("div",{className:lt.createSteps,children:L.map((Q,V)=>{const M=V+1;return l.jsxs("div",{className:`${lt.createStepPill} ${M===Math.min(e,j)?lt.createStepPillActive:""} ${M<Math.min(e,j)?lt.createStepPillDone:""}`,children:[l.jsx("span",{className:lt.createStepNumber,children:M}),l.jsx("span",{className:lt.createStepLabel,children:Q})]},`${M}:${Q}`)})}),l.jsx("div",{className:lt.createBody,children:I}),l.jsxs("div",{className:lt.createActions,children:[l.jsx("button",{type:"button",className:lt.manageButton,onClick:z,disabled:e<=1||d||u,children:_("common.previous")}),e===P?l.jsx("button",{type:"button",className:lt.manageButton,onClick:C,disabled:u,children:_(u?"agent.create.loading":"agent.create.save")}):l.jsx("button",{type:"button",className:lt.manageButton,onClick:F,disabled:G,children:_("common.next")})]})]})}const Wnt="_page_1np31_1",Gnt="_tabs_1np31_11",Knt="_memoryCard_1np31_19",Ynt="_memoryCardActive_1np31_35",Xnt="_memoryTitle_1np31_44",Qnt="_detailPath_1np31_48",Jnt="_status_1np31_49",Znt="_actionButton_1np31_54",est="_primaryButton_1np31_55",tst="_secondaryButton_1np31_56",nst="_detail_1np31_48",sst="_detailHeader_1np31_79",rst="_detailTitleWrap_1np31_87",ist="_actions_1np31_91",ost="_content_1np31_105",ast="_editor_1np31_106",lst="_editorFooter_1np31_127",bo={page:Wnt,tabs:Gnt,memoryCard:Knt,memoryCardActive:Ynt,memoryTitle:Xnt,detailPath:Qnt,status:Jnt,actionButton:Znt,primaryButton:est,secondaryButton:tst,detail:nst,detailHeader:sst,detailTitleWrap:rst,actions:ist,content:ost,editor:ast,editorFooter:lst};function vq(e,t){return e.find(n=>n.scope===t)}function wq(e,t){return t(e==="global"?"memory.global":"memory.project")}function cst({refreshSignal:e=0,addSignal:t=0,addScope:n="workspace",onMessage:s}){var I,Q;const{t:r}=ut(),{files:i,loading:o,error:a,readFile:c,reload:u,writeMemory:d}=ime({autoLoad:!0}),h=f.useRef(null),m=f.useRef(0),[p,g]=f.useState("workspace"),[b,v]=f.useState("view"),[x,y]=f.useState(""),[w,k]=f.useState(""),[T,S]=f.useState(!1),[C,_]=f.useState(!1),[B,A]=f.useState(null),N=f.useRef(0),j=f.useMemo(()=>{const V=vq(i,"global"),M=vq(i,"workspace");return[{scope:"workspace",title:r("memory.project"),description:r("memory.project.desc"),fallbackPath:"QWEN.md",file:M},{scope:"global",title:r("memory.global"),description:r("memory.global.desc"),fallbackPath:"~/.qwen/QWEN.md",file:V}]},[i,r]),P=j.find(V=>V.scope===p)??j[0],L=f.useCallback((V,M)=>{const re=++m.current;if(v(M),A(null),y(""),k(""),!(V!=null&&V.file)){M==="edit"&&requestAnimationFrame(()=>{var se;return(se=h.current)==null?void 0:se.focus()});return}S(!0),c(V.file.path).then(se=>{re===m.current&&(y(se.content),k(se.content),se.truncated&&A(r("memory.fileTruncated")),requestAnimationFrame(()=>{var X;return(X=h.current)==null?void 0:X.focus()}))}).catch(se=>{if(re!==m.current)return;const X=se instanceof Error?se.message:String(se);A(X),V.scope!=="global"&&(s==null||s(X,"error"))}).finally(()=>{re===m.current&&S(!1)})},[s,c,r]);f.useEffect(()=>{P&&L(P,b)},[(I=P==null?void 0:P.file)==null?void 0:I.path,P==null?void 0:P.scope]),f.useEffect(()=>{a&&A(a.message)},[a]),f.useEffect(()=>{e<=0||u().then(()=>A(r("memory.refreshed"))).catch(V=>{const M=V instanceof Error?V.message:String(V);A(M),s==null||s(M,"error")})},[s,e,u,r]),f.useEffect(()=>{if(t<=0||N.current===t)return;N.current=t;const V=n==="global"?"global":"workspace";g(V);const M=j.find(re=>re.scope===V);L(M,"edit")},[n,t,j,L]);const O=V=>{g(V.scope),L(V,"view")},$=()=>{P&&L(P,"edit")},z=()=>{if(P){if(!w.trim()){A(r("memory.contentEmpty"));return}_(!0),A(null),d({scope:P.scope,mode:"replace",content:w}).then(V=>{const M=r("memory.saved",{scope:wq(P.scope,r),bytes:V.bytesWritten,path:V.filePath});y(w),v("view"),A(M),s==null||s(M,"status"),u().catch(()=>{})}).catch(V=>{const M=V instanceof Error?V.message:String(V);A(M),s==null||s(M,"error")}).finally(()=>_(!1))}},F=((Q=P==null?void 0:P.file)==null?void 0:Q.path)??(P==null?void 0:P.fallbackPath)??"",G=B??(o?r("memory.loading"):null);return l.jsxs("div",{className:bo.page,children:[l.jsx("nav",{className:bo.tabs,"aria-label":r("memory.menu"),children:j.map(V=>{const M=V.scope===p;return l.jsx("button",{type:"button",className:`${bo.memoryCard} ${M?bo.memoryCardActive:""}`,onClick:()=>O(V),children:l.jsx("span",{className:bo.memoryTitle,children:V.title})},V.scope)})}),l.jsxs("section",{className:bo.detail,children:[l.jsxs("header",{className:bo.detailHeader,children:[l.jsx("div",{className:bo.detailTitleWrap,children:l.jsx("div",{className:bo.detailPath,children:F})}),l.jsx("div",{className:bo.actions,children:l.jsx("button",{type:"button",className:bo.actionButton,onClick:$,children:r("settings.action.edit")})})]}),G&&l.jsx("div",{className:bo.status,children:G}),b==="edit"?l.jsxs(l.Fragment,{children:[l.jsx("textarea",{ref:h,className:bo.editor,value:w,disabled:C||T,onChange:V=>k(V.target.value),placeholder:r("memory.placeholder",{scope:P?wq(P.scope,r):""})}),l.jsxs("div",{className:bo.editorFooter,children:[l.jsx("button",{type:"button",className:bo.secondaryButton,disabled:C,onClick:()=>{k(x),v("view")},children:r("common.cancel")}),l.jsx("button",{type:"button",className:bo.primaryButton,disabled:C||T,onClick:z,children:r(C?"memory.saving":"memory.save")})]})]}):l.jsx("pre",{className:bo.content,children:T?r("memory.loadingFile"):x||r("memory.noFiles")})]})]})}const ust="_panel_cxp6w_1",dst="_steps_cxp6w_10",hst="_stepPill_cxp6w_18",fst="_stepPillActive_cxp6w_29",mst="_stepPillDone_cxp6w_34",pst="_stepNumber_cxp6w_38",gst="_stepLabel_cxp6w_49",bst="_body_cxp6w_55",yst="_text_cxp6w_59",xst="_muted_cxp6w_64",vst="_options_cxp6w_68",wst="_option_cxp6w_68",kst="_optionActive_cxp6w_90",_st="_label_cxp6w_94",Sst="_optionText_cxp6w_98",Cst="_description_cxp6w_112",Tst="_input_cxp6w_119",Est="_preview_cxp6w_135",Ast="_error_cxp6w_146",Nst="_link_cxp6w_150",jst="_terms_cxp6w_161",Mst="_actions_cxp6w_169",Ist="_actionButton_cxp6w_177",rr={panel:ust,steps:dst,stepPill:hst,stepPillActive:fst,stepPillDone:mst,stepNumber:pst,stepLabel:gst,body:bst,text:yst,muted:xst,options:vst,option:wst,optionActive:kst,label:_st,optionText:Sst,description:Cst,input:Tst,preview:Est,error:Ast,link:Nst,terms:jst,actions:Mst,actionButton:Ist};function Rst(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 zb(e){return e==="anthropic"?"https://api.anthropic.com/v1":e==="gemini"?"https://generativelanguage.googleapis.com":"https://api.openai.com/v1"}function kq(e){var t;return((t=e==null?void 0:e.models)==null?void 0:t.map(n=>n.id).join(", "))??""}function Dst(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 Lst(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 V6(e){return[...new Set(e.split(",").map(t=>t.trim()).filter(t=>t.length>0))]}function Pst({onMessage:e,onClose:t}){const{t:n}=ut(),s=fo(),[r,i]=f.useState("groups"),[o,a]=f.useState(0),[c,u]=f.useState(0),[d,h]=f.useState("providers"),[m,p]=f.useState(0),[g,b]=f.useState(),[v,x]=f.useState("alibaba"),[y,w]=f.useState(null),[k,T]=f.useState("openai"),[S,C]=f.useState(""),[_,B]=f.useState(""),[A,N]=f.useState(""),[j,P]=f.useState(!1),[L,O]=f.useState(!1),[$,z]=f.useState(!0),[F,G]=f.useState(!0),[I,Q]=f.useState(!1),[V,M]=f.useState(!1),[re,se]=f.useState(""),[X,J]=f.useState(!0),[de,W]=f.useState(!1),[te,U]=f.useState(null);f.useEffect(()=>{s.getAuthProviders().then(ve=>{b(ve),J(!1)}).catch(ve=>{U(ve instanceof Error?ve.message:String(ve)),J(!1)})},[s]);const ee=f.useMemo(()=>(g==null?void 0:g.groups)??[],[g]),oe=f.useMemo(()=>{var Me;return(((Me=ee.find(_e=>_e.id===v))==null?void 0:Me.providerIds)??[]).map(_e=>g==null?void 0:g.providers.find(Xe=>Xe.id===_e)).filter(_e=>!!_e)},[g,v,ee]),Ce=f.useMemo(()=>(y==null?void 0:y.steps)??[],[y==null?void 0:y.steps]),he=Ce[m],ye=(y==null?void 0:y.showAdvancedConfig)===!0,Ve=f.useMemo(()=>L?["thinking","modality","image","video","audio","pdf","context"]:["thinking","modality","context"],[L]),it=Ve.indexOf("context"),At=he==="apiKey"||he==="models"||he==="baseUrl"&&!Array.isArray(y==null?void 0:y.baseUrl),[Ee,me]=f.useState(0),bt=f.useCallback((ve,Me="providers")=>{var Xe,ue;w(ve),h(Me);const _e=((Xe=ve.protocolOptions)==null?void 0:Xe[0])??ve.protocol;T(_e),typeof ve.baseUrl=="string"?C(ve.baseUrl):Array.isArray(ve.baseUrl)?C(((ue=ve.baseUrl[0])==null?void 0:ue.url)??""):C(zb(_e)),B(""),N(kq(ve)),P(!1),O(!1),z(!0),G(!0),Q(!1),M(!1),se(""),p(0),me(0),U(null),i(ve.steps.length>0?"step":"review")},[]),et=f.useCallback(()=>{if(U(null),r==="groups"){t();return}if(r==="providers"){i("groups");return}if(r==="review"){if(Ce.length===0){i(d);return}i("step"),p(Math.max(0,Ce.length-1));return}if(m>0){p(ve=>ve-1),me(0);return}i(d)},[t,d,m,Ce.length,r]),qe=f.useCallback(()=>{if(!y||de)return;W(!0),U(null);const ve=Number(re);s.installAuthProvider({providerId:y.id,protocol:k,baseUrl:S,apiKey:_,modelIds:V6(A),advancedConfig:j||L||Number.isFinite(ve)&&ve>0?{...j?{enableThinking:!0}:{},...L?{multimodal:{...$?{image:!0}:{},...F?{video:!0}:{},...I?{audio:!0}:{},...V?{pdf:!0}:{}}}:{},...Number.isFinite(ve)&&ve>0?{contextWindowSize:ve}:{}}:void 0}).then(Me=>{e(Me.message),t()}).catch(Me=>{const _e=Me instanceof Error?Me.message:String(Me);U(_e),e(_e,"error")}).finally(()=>W(!1))},[_,S,re,L,I,$,V,F,A,t,e,k,y,de,j,s]),Ke=f.useCallback(()=>{if(y){if(he==="baseUrl"){const ve=S.trim()||zb(k);if(!ve){U(n("auth.baseUrlRequired"));return}if(!/^https?:\/\//i.test(ve)){U(n("auth.baseUrlInvalid"));return}S.trim()||C(ve)}if(he==="apiKey"&&_.trim().length===0){U(n("auth.apiKeyRequired"));return}if(he==="models"&&V6(A).length===0){U(n("auth.modelsRequired"));return}U(null),m>=Ce.length-1?ye?i("review"):qe():(p(ve=>ve+1),me(0))}},[_,S,he,A,k,y,qe,ye,m,Ce.length,n]),ke=f.useCallback(ve=>{switch(ve){case"thinking":P(Me=>!Me);return;case"modality":O(Me=>!Me);return;case"image":z(Me=>!Me);return;case"video":G(Me=>!Me);return;case"audio":Q(Me=>!Me);return;case"pdf":M(Me=>!Me);return;case"context":Ke();return;default:return}},[Ke]),ne=f.useCallback(()=>{if(r==="groups"){const ve=ee[o];if(!ve)return;if(ve.id==="custom"){const Me=ve.providerIds.map(_e=>g==null?void 0:g.providers.find(Xe=>Xe.id===_e)).find(_e=>!!_e);Me&&bt(Me,"groups");return}x(ve.id),u(0),i("providers");return}if(r==="providers"){const ve=oe[c];ve&&bt(ve,"providers");return}if(r==="review"){qe();return}if(!(!y||!he)){if(he==="protocol"){const ve=(y.protocolOptions??[y.protocol])[Ee];ve&&(T(ve),y.baseUrl||C(zb(ve))),Ke();return}if(he==="baseUrl"&&Array.isArray(y.baseUrl)){const ve=y.baseUrl[Ee];ve&&C(ve.url),Ke();return}if(he==="advancedConfig"){ke(Ve[Ee]);return}Ke()}},[he,g,Ke,o,ee,Ee,y,c,oe,qe,bt,r,ke,Ve]),gt=f.useCallback(ve=>{if(r==="groups"){const Me=ee[ve];if(!Me)return;if(Me.id==="custom"){const _e=Me.providerIds.map(Xe=>g==null?void 0:g.providers.find(ue=>ue.id===Xe)).find(Xe=>!!Xe);_e&&bt(_e,"groups");return}x(Me.id),u(0),i("providers");return}if(r==="providers"){const Me=oe[ve];Me&&bt(Me,"providers");return}if(!y||!he){r==="review"&&qe();return}if(he==="protocol"){const Me=(y.protocolOptions??[y.protocol])[ve];Me&&(T(Me),y.baseUrl||C(zb(Me))),Ke();return}if(he==="baseUrl"&&Array.isArray(y.baseUrl)){const Me=y.baseUrl[ve];Me&&C(Me.url),Ke();return}he==="advancedConfig"&&ke(Ve[ve])},[he,g,Ke,ee,ke,Ve,y,oe,qe,bt,r]),We=(ve,Me,_e)=>l.jsx("div",{className:rr.options,children:ve.map((Xe,ue)=>l.jsx("button",{type:"button",className:`${rr.option} ${Me===ue?rr.optionActive:""}`,onClick:()=>{_e(ue),gt(ue)},children:l.jsxs("div",{className:rr.optionText,children:[l.jsx("div",{className:rr.label,children:Xe.label}),Xe.description&&l.jsx("div",{className:rr.description,children:Xe.description})]})},Xe.value))}),tt=()=>{if(!y||!he)return null;if(he==="protocol"){const _e=y.protocolOptions??[y.protocol];return We(Rst(n).filter(Xe=>_e.includes(Xe.value)),Ee,me)}if(he==="baseUrl")return Array.isArray(y.baseUrl)?We(y.baseUrl.map(_e=>({value:_e.url,label:_e.label,description:_e.url})),Ee,me):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:rr.text,children:n("auth.baseUrlPrompt")}),l.jsx("input",{className:rr.input,value:S,placeholder:zb(k),onChange:_e=>{C(_e.target.value),U(null)},onKeyDown:_e=>{_e.key==="Enter"&&(_e.preventDefault(),_e.stopPropagation(),Ke())},autoFocus:!0}),y.documentationUrl&&l.jsx("a",{className:rr.link,href:y.documentationUrl,target:"_blank",rel:"noreferrer",children:n("auth.documentation")})]});if(he==="apiKey")return l.jsxs(l.Fragment,{children:[y.documentationUrl&&l.jsxs("a",{className:rr.link,href:y.documentationUrl,target:"_blank",rel:"noreferrer",children:[n("auth.documentation"),": ",y.documentationUrl]}),l.jsx("input",{className:rr.input,type:"password",value:_,placeholder:y.apiKeyPlaceholder??n("auth.apiKeyPlaceholder"),onChange:_e=>{B(_e.target.value),U(null)},onKeyDown:_e=>{_e.key==="Enter"&&(_e.preventDefault(),_e.stopPropagation(),Ke())},autoFocus:!0})]});if(he==="models"){const _e=kq(y);return l.jsxs(l.Fragment,{children:[_e&&l.jsx("div",{className:rr.muted,children:n("auth.modelsPrompt",{modelIds:_e})}),l.jsx("input",{className:rr.input,value:A,placeholder:_e||n("auth.modelsPlaceholder"),onChange:Xe=>{N(Xe.target.value),U(null)},onKeyDown:Xe=>{Xe.key==="Enter"&&(Xe.preventDefault(),Xe.stopPropagation(),Ke())},autoFocus:!0})]})}const ve=_e=>_e?"◉":"○",Me=[{value:"thinking",label:`${ve(j)} ${n("auth.advanced.thinking")}`,description:n("auth.advanced.thinkingDesc")},{value:"modality",label:`${ve(L)} ${n("auth.advanced.modality")}`,description:n("auth.advanced.modalityDesc")}];return L&&Me.push({value:"image",label:`${ve($)} ${n("auth.advanced.modalityImage")}`},{value:"video",label:`${ve(F)} ${n("auth.advanced.modalityVideo")}`},{value:"audio",label:`${ve(I)} ${n("auth.advanced.modalityAudio")}`},{value:"pdf",label:`${ve(V)} ${n("auth.advanced.modalityPdf")}`}),Me.push({value:"context",label:`${n("auth.advanced.contextWindow")}: ${re||"auto"}`,description:n("auth.advanced.contextDesc")}),l.jsxs(l.Fragment,{children:[l.jsx("div",{className:rr.text,children:n("auth.advanced.prompt")}),We(Me,Ee,me),l.jsx("input",{className:rr.input,value:re,placeholder:n("common.auto"),onChange:_e=>se(_e.target.value.replace(/[^0-9]/g,"")),onFocus:()=>me(it),onKeyDown:_e=>{_e.key==="Enter"&&(_e.preventDefault(),_e.stopPropagation(),Ke())}})]})},jt=f.useMemo(()=>{if(!y)return"";const ve=y.envKey??`${k.toUpperCase()}_API_KEY`,Me=V6(A),_e={};if(j&&(_e.extra_body={enable_thinking:!0}),L){const Fe={};$&&(Fe.image=!0),F&&(Fe.video=!0),I&&(Fe.audio=!0),V&&(Fe.pdf=!0),Object.keys(Fe).length>0&&(_e.modalities=Fe)}const Xe=Number(re);Number.isFinite(Xe)&&Xe>0&&(_e.contextWindowSize=Xe);const ue=Object.keys(_e).length>0;return JSON.stringify({env:{[ve]:Lst(_,n)},modelProviders:{[k]:Me.map(Fe=>({id:Fe,name:Fe,baseUrl:S.trim(),envKey:ve,...ue?{generationConfig:_e}:{}}))},security:{auth:{selectedType:k}},model:{name:Me[0]}},null,2)},[_,S,re,L,I,$,V,F,A,k,y,n,j]),jn=f.useMemo(()=>{const ve=[n("auth.step.group"),n("auth.step.provider")];return y&&(ve.push(...Ce.map(Me=>Dst(Me,y,n))),ye&&ve.push(n("auth.review"))),ve},[y,ye,Ce,n]),kn=f.useMemo(()=>r==="groups"?1:r==="providers"?2:r==="step"?Math.min(3+m,jn.length):jn.length,[m,jn.length,r]),Be=X?l.jsx("div",{className:rr.muted,children:n("common.loading")}):r==="groups"?l.jsxs(l.Fragment,{children:[We(ee.map(ve=>({value:ve.id,label:n(ve.label),description:n(ve.description)})),o,a),l.jsxs("div",{className:rr.terms,children:[l.jsxs("div",{children:[n("auth.termsTitle"),":"]}),l.jsx("a",{className:rr.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"?We(oe.map(ve=>({value:ve.id,label:n(ve.label),description:n(ve.description)})),c,u):r==="step"?tt():l.jsxs(l.Fragment,{children:[l.jsx("div",{className:rr.text,children:n("auth.reviewText")}),l.jsx("div",{className:rr.preview,children:jt})]}),ht=()=>{if(r==="review"){qe();return}if(At||he==="advancedConfig"){Ke();return}ne()};return l.jsxs("div",{className:rr.panel,children:[l.jsx("div",{className:rr.steps,children:jn.map((ve,Me)=>{const _e=Me+1;return l.jsxs("div",{className:`${rr.stepPill} ${_e===kn?rr.stepPillActive:""} ${_e<kn?rr.stepPillDone:""}`,children:[l.jsx("span",{className:rr.stepNumber,children:_e}),l.jsx("span",{className:rr.stepLabel,children:ve})]},`${_e}:${ve}`)})}),l.jsx("div",{className:rr.body,children:Be}),te&&l.jsx("div",{className:rr.error,children:te}),l.jsxs("div",{className:rr.actions,children:[l.jsx("button",{type:"button",className:rr.actionButton,onClick:et,disabled:r==="groups"||X||de,children:n("common.previous")}),l.jsx("button",{type:"button",className:rr.actionButton,onClick:ht,disabled:X||de,children:n(r==="review"?de?"auth.saving":"auth.save":"common.next")})]})]})}function Ost(e){return e.displayName||e.name}const Eie="tools-list",_q=e=>`${Eie}-opt-${e}`;function Bst(){const{t:e}=ut(),{status:t,tools:n,loading:s,error:r}=AG({autoLoad:!0}),[i,o]=f.useState(0),[a,c]=f.useState(null),[u,d]=f.useState(()=>new Set),h=f.useRef(null);f.useEffect(()=>{var b,v;r?c(r.message):(v=(b=t==null?void 0:t.errors)==null?void 0:b[0])!=null&&v.error?c(t.errors[0].error):t&&c(null)},[t,r]);const m=f.useCallback(b=>{d(v=>v.has(b.name)?new Set:new Set([b.name]))},[]);f.useEffect(()=>{i>=n.length&&n.length>0&&o(n.length-1)},[i,n.length]),f.useEffect(()=>{var v;const b=(v=h.current)==null?void 0:v.children[i];b==null||b.scrollIntoView({block:"nearest"})},[i]);const{keyboardMode:p}=rm({itemCount:n.length,activeIndex:i,onActiveIndexChange:o,onConfirm:b=>{const v=n[b];v!=null&&v.description&&m(v)}}),g=f.useMemo(()=>{if(!t)return"";const b=n.filter(v=>v.enabled).length;return e("tools.summary",{enabled:b,total:n.length})},[t,n,e]);return l.jsxs("div",{className:en("picker","picker-in-shell"),children:[g&&l.jsx("div",{className:en("picker-search"),children:l.jsx("span",{className:en("picker-search-hint"),children:g})}),(a||s)&&l.jsx("div",{className:en("picker-search"),children:l.jsx("span",{className:en("picker-search-hint"),children:a||e("tools.loading")})}),l.jsx("div",{className:en("picker-sep")}),l.jsxs("div",{id:Eie,role:"listbox","aria-label":e("tools.title"),tabIndex:0,"aria-activedescendant":n.length>0?_q(i):void 0,className:en("picker-list",p?"picker-keyboard-only":void 0),ref:h,children:[!s&&n.length===0&&l.jsx("div",{className:en("picker-empty"),children:e("tools.empty")}),n.map((b,v)=>{const x=u.has(b.name),y=b.description??"";return l.jsxs("div",{id:_q(v),role:"option","aria-selected":!1,"aria-expanded":y?x:void 0,className:en("picker-item","picker-session-item","tools-picker-item",v===i?"selected":void 0,x?"tools-picker-item-expanded":void 0),onClick:()=>{o(v),b.description&&m(b)},onMouseMove:()=>o(v),children:[l.jsxs("div",{className:en("picker-item-row"),children:[l.jsx("span",{className:en("tools-item-icon"),"aria-hidden":"true"}),l.jsx("span",{className:en("picker-item-title"),children:Ost(b)}),l.jsx("span",{className:en("tools-status-badge",b.enabled?"tools-status-badge-enabled":"tools-status-badge-disabled"),children:b.enabled?e("tools.status.enabled"):e("tools.status.disabled")}),y?l.jsx("svg",{className:en("tools-item-chevron",x?"tools-item-chevron-expanded":void 0),viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}):null]}),x&&y&&l.jsx("div",{className:en("tools-desc-expanded"),children:l.jsx("div",{className:en("tools-desc-body"),children:y})})]},b.name)})]})]})}const $st="_placeholder_3wrps_1",zst="_fileList_3wrps_7",Fst="_file_3wrps_7",qst="_fileHeader_3wrps_19",Hst="_fileStats_3wrps_37",Ust="_statAdd_3wrps_45",Vst="_statDel_3wrps_49",Wst="_fileBinary_3wrps_53",Gst="_filePath_3wrps_57",Kst="_fileOldPath_3wrps_65",Yst="_fileTag_3wrps_69",Xst="_fileBody_3wrps_79",Qst="_filePlaceholder_3wrps_83",Jst="_hiddenNote_3wrps_89",Zst="_diffLines_3wrps_95",ert="_diffLine_3wrps_95",trt="_diffLineAdd_3wrps_107",nrt="_diffLineDel_3wrps_111",srt="_diffLineContext_3wrps_115",rrt="_diffLineMeta_3wrps_119",irt="_diffOldNo_3wrps_125",ort="_diffNewNo_3wrps_126",art="_diffMarker_3wrps_137",lrt="_diffContent_3wrps_153",Ks={placeholder:$st,fileList:zst,file:Fst,fileHeader:qst,fileStats:Hst,statAdd:Ust,statDel:Vst,fileBinary:Wst,filePath:Gst,fileOldPath:Kst,fileTag:Yst,fileBody:Xst,filePlaceholder:Qst,hiddenNote:Jst,diffLines:Zst,diffLine:ert,diffLineAdd:trt,diffLineDel:nrt,diffLineContext:srt,diffLineMeta:rrt,diffOldNo:irt,diffNewNo:ort,diffMarker:art,diffContent:lrt},crt={add:Ks.diffLineAdd,del:Ks.diffLineDel,context:Ks.diffLineContext,meta:Ks.diffLineMeta};function urt(e){return e===$r.Light?"github-light-default":"github-dark-default"}async function drt(e,t,n){const{resolvedLang:s}=vM(Vre(t));let r=null;if(s!=="text")try{r=await GX(s)}catch{r=null}const i=[];for(const o of e){const a=[],c=[];for(const x of o.lines){const y=x[0],w=x.slice(1);y==="+"?a.push(w):y==="-"?c.push(w):y===" "&&(a.push(w),c.push(w))}const u=a.join(`
`),d=c.join(`
`);let h=null,m=null;if(r){const x=s;if(!yE(u))try{h=r.codeToTokens(u,{lang:x,theme:n}).tokens}catch{h=null}if(!yE(d))try{m=r.codeToTokens(d,{lang:x,theme:n}).tokens}catch{m=null}}let p=0,g=0,b=o.oldStart,v=o.newStart;for(const x of o.lines){const y=x[0],w=x.slice(1);y==="+"?(i.push({type:"add",oldNo:null,newNo:v,text:w,tokens:(h==null?void 0:h[p])??null}),p++,v++):y==="-"?(i.push({type:"del",oldNo:b,newNo:null,text:w,tokens:(m==null?void 0:m[g])??null}),g++,b++):y===" "?(i.push({type:"context",oldNo:b,newNo:v,text:w,tokens:(h==null?void 0:h[p])??null}),p++,g++,b++,v++):i.push({type:"meta",oldNo:null,newNo:null,text:x,tokens:null})}}return i}function hrt(e){return!e.tokens||e.tokens.length===0?e.text:e.tokens.map((t,n)=>l.jsx("span",{style:t.color?{color:t.color}:void 0,children:t.content},n))}function frt({hunks:e,path:t}){const{t:n}=ut(),s=w1(),r=urt(s),[i,o]=f.useState(null),[a,c]=f.useState(!1);return f.useEffect(()=>{let u=!1;return o(null),c(!1),drt(e,t,r).then(d=>{u||o(d)}).catch(()=>{u||c(!0)}),()=>{u=!0}},[e,t,r]),a?l.jsx("div",{className:Ks.filePlaceholder,children:n("gitDiff.fileError")}):i===null?l.jsx("div",{className:Ks.filePlaceholder,children:n("gitDiff.loading")}):l.jsx("div",{className:Ks.diffLines,children:(i??[]).map((u,d)=>l.jsxs("div",{className:`${Ks.diffLine} ${crt[u.type]}`,children:[l.jsx("span",{className:Ks.diffOldNo,children:u.oldNo??""}),l.jsx("span",{className:Ks.diffNewNo,children:u.newNo??""}),l.jsx("span",{className:Ks.diffMarker,children:u.type==="add"?"+":u.type==="del"?"-":u.type==="meta"?"":" "}),l.jsx("code",{className:Ks.diffContent,children:hrt(u)})]},d))})}function mrt({workspaceCwd:e,file:t}){const{t:n}=ut(),{client:s}=dc(),[r,i]=f.useState(!1),[o,a]=f.useState(null),[c,u]=f.useState(!1),[d,h]=f.useState(!1),[m,p]=f.useState(!1),g=f.useRef(!1);f.useEffect(()=>(g.current=!1,()=>{g.current=!0}),[]);const b=()=>{const x=!r;i(x),x&&o===null&&!d&&!t.isBinary&&(h(!0),p(!1),s.workspaceByCwd(e).workspaceGitDiffFile(t.path,t.oldPath).then(y=>{g.current||(a(y.hunks),u(y.truncated===!0))}).catch(()=>{g.current||p(!0)}).finally(()=>{g.current||h(!1)}))},v=Y2(t.path);return l.jsxs("div",{className:Ks.file,children:[l.jsxs("button",{type:"button",className:Ks.fileHeader,onClick:b,"aria-expanded":r,"aria-label":n(r?"gitDiff.collapse":"gitDiff.expand",{path:t.oldPath?`${Y2(t.oldPath)} → ${v}`:v}),children:[l.jsx("span",{className:Ks.fileStats,children:t.isBinary?l.jsx("span",{className:Ks.fileBinary,children:n("gitDiff.binary")}):l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:Ks.statAdd,children:["+",t.added??0]}),l.jsxs("span",{className:Ks.statDel,children:["-",t.removed??0]})]})}),l.jsxs("span",{className:Ks.filePath,title:v,children:[t.oldPath?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Ks.fileOldPath,children:Y2(t.oldPath)})," → "]}):null,v]}),t.isUntracked&&l.jsx("span",{className:Ks.fileTag,children:n("gitDiff.untracked")}),t.isDeleted&&l.jsx("span",{className:Ks.fileTag,children:n("gitDiff.deleted")})]}),r&&l.jsx("div",{className:Ks.fileBody,children:t.isBinary?l.jsx("div",{className:Ks.filePlaceholder,children:n("gitDiff.binary")}):d?l.jsx("div",{className:Ks.filePlaceholder,children:n("gitDiff.loading")}):m?l.jsx("div",{className:Ks.filePlaceholder,children:n("gitDiff.fileError")}):o&&o.length>0?l.jsxs(l.Fragment,{children:[l.jsx(frt,{hunks:o,path:t.path}),c&&l.jsx("div",{className:Ks.filePlaceholder,role:"note",children:n("gitDiff.truncated")})]}):l.jsx("div",{className:Ks.filePlaceholder,children:n("gitDiff.noDiff")})})]})}function prt({workspaceCwd:e,onClose:t}){const{t:n}=ut(),{client:s}=dc(),[r,i]=f.useState(null),[o,a]=f.useState(!0),[c,u]=f.useState(!1);f.useEffect(()=>{let m=!1;return a(!0),u(!1),s.workspaceByCwd(e).workspaceGitDiff().then(p=>{m||i(p)}).catch(()=>{m||u(!0)}).finally(()=>{m||a(!1)}),()=>{m=!0}},[s,e]);const d=r&&r.available?n("gitDiff.summary",{count:r.filesCount,added:r.linesAdded,removed:r.linesRemoved}):void 0;let h;return o?h=l.jsx("div",{className:Ks.placeholder,children:n("gitDiff.loading")}):c?h=l.jsx("div",{className:Ks.placeholder,children:n("gitDiff.error")}):!r||!r.available?h=l.jsx("div",{className:Ks.placeholder,children:n("gitDiff.unavailable")}):r.files.length===0?h=l.jsx("div",{className:Ks.placeholder,children:n("gitDiff.empty")}):h=l.jsxs("div",{className:Ks.fileList,children:[r.files.map(m=>l.jsx(mrt,{workspaceCwd:e,file:m},`${e}:${m.path}`)),r.hiddenCount>0&&l.jsx("div",{className:Ks.hiddenNote,children:n("gitDiff.hidden",{count:r.hiddenCount})})]}),l.jsx(Qr,{title:n("gitDiff.title"),subtitle:d,size:"xl",allowFullscreen:!0,onClose:t,children:h})}function grt(e,t,n="all",s="all"){const r=t.trim().toLowerCase();return e.filter(i=>n!=="all"&&i.level!==n||s==="disabled"&&i.status!=="disabled"||s==="enabled"&&i.status==="disabled"?!1:r?i.name.toLowerCase().includes(r):!0)}function brt(e,t){return e&&t.some(n=>n.name===e)?e:null}const yrt=Bp("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 Fi({className:e,variant:t,...n}){return l.jsx("div",{"data-slot":"alert",role:"alert",className:Kt(yrt({variant:t}),e),...n})}function Fm({className:e,...t}){return l.jsx("div",{"data-slot":"alert-title",className:Kt("font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",e),...t})}function qi({className:e,...t}){return l.jsx("div",{"data-slot":"alert-description",className:Kt("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 xrt=Bp("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 za({className:e,variant:t="default",asChild:n=!1,...s}){const r=n?Mj:"span";return l.jsx(r,{"data-slot":"badge","data-variant":t,className:Kt(xrt({variant:t}),e),...s})}function a1({className:e,...t}){return l.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",className:Kt(e),...t})}function l1({className:e,...t}){return l.jsx("ol",{"data-slot":"breadcrumb-list",className:Kt("flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground",e),...t})}function oo({className:e,...t}){return l.jsx("li",{"data-slot":"breadcrumb-item",className:Kt("inline-flex items-center gap-1",e),...t})}function Xh({asChild:e,className:t,...n}){const s=e?Mj:"a";return l.jsx(s,{"data-slot":"breadcrumb-link",className:Kt("transition-colors hover:text-foreground",t),...n})}function Gl({className:e,...t}){return l.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:Kt("font-normal text-foreground",e),...t})}function Qh({children:e,className:t,...n}){return l.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:Kt("[&>svg]:size-3.5",t),...n,children:e??l.jsx(D4,{})})}function Kl({className:e,size:t="default",...n}){return l.jsx("div",{"data-slot":"card","data-size":t,className:Kt("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 gd({className:e,...t}){return l.jsx("div",{"data-slot":"card-header",className:Kt("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 bd({className:e,...t}){return l.jsx("div",{"data-slot":"card-title",className:Kt("text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",e),...t})}function Jh({className:e,...t}){return l.jsx("div",{"data-slot":"card-description",className:Kt("text-sm text-muted-foreground",e),...t})}function vrt({className:e,...t}){return l.jsx("div",{"data-slot":"card-action",className:Kt("col-start-2 row-span-2 row-start-1 self-start justify-self-end",e),...t})}function op({className:e,...t}){return l.jsx("div",{"data-slot":"card-content",className:Kt("px-(--card-spacing)",e),...t})}function jd({className:e,...t}){return l.jsx("div",{"data-slot":"empty",className:Kt("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 Md({className:e,...t}){return l.jsx("div",{"data-slot":"empty-header",className:Kt("flex max-w-sm flex-col items-center gap-2",e),...t})}const wrt=Bp("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 Id({className:e,variant:t="default",...n}){return l.jsx("div",{"data-slot":"empty-icon","data-variant":t,className:Kt(wrt({variant:t,className:e})),...n})}function Rd({className:e,...t}){return l.jsx("div",{"data-slot":"empty-title",className:Kt("text-sm font-medium tracking-tight",e),...t})}function Hv({className:e,...t}){return l.jsx("div",{"data-slot":"empty-description",className:Kt("text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...t})}function krt({className:e,...t}){return l.jsx("div",{"data-slot":"empty-content",className:Kt("flex w-full max-w-sm min-w-0 flex-col items-center gap-2.5 text-sm text-balance",e),...t})}function kg({...e}){return l.jsx(Y6e,{"data-slot":"dropdown-menu",...e})}function _rt({container:e,...t}){const n=Yd();return l.jsx(Q6e,{"data-slot":"dropdown-menu-portal",container:e??n??void 0,...t})}function _g({...e}){return l.jsx(X6e,{"data-slot":"dropdown-menu-trigger",...e})}function Sg({className:e,align:t="start",sideOffset:n=4,...s}){return l.jsx(_rt,{children:l.jsx(J6e,{"data-slot":"dropdown-menu-content",sideOffset:n,align:t,className:Kt("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 c1({...e}){return l.jsx(Z6e,{"data-slot":"dropdown-menu-group",...e})}function $o({className:e,inset:t,variant:n="default",...s}){return l.jsx(e8e,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:Kt("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 Srt({className:e,...t}){return l.jsx(t8e,{"data-slot":"dropdown-menu-separator",className:Kt("-mx-1 my-1 h-px bg-border",e),...t})}function Sq({...e}){return l.jsx(n8e,{"data-slot":"dropdown-menu-sub",...e})}function Cq({className:e,inset:t,children:n,...s}){return l.jsxs(s8e,{"data-slot":"dropdown-menu-sub-trigger","data-inset":t,className:Kt("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,l.jsx(D4,{className:"ml-auto"})]})}function Tq({className:e,...t}){return l.jsx(r8e,{"data-slot":"dropdown-menu-sub-content",className:Kt("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})}function No({className:e,...t}){return l.jsx(gpe,{"data-slot":"spinner",role:"status","aria-label":"Loading",className:Kt("size-4 animate-spin",e),...t})}function YA({...e}){return l.jsx(e5e,{"data-slot":"alert-dialog",...e})}function Crt({container:e,...t}){const n=Yd();return l.jsx(t5e,{"data-slot":"alert-dialog-portal",container:e??n??void 0,...t})}const Trt=f.forwardRef(function({className:t,...n},s){return l.jsx(n5e,{ref:s,"data-slot":"alert-dialog-overlay",className:Kt("fixed inset-0 z-50 bg-black/10 duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",t),...n})}),XA=f.forwardRef(function({className:t,size:n="default",...s},r){return l.jsxs(Crt,{children:[l.jsx(Trt,{}),l.jsx(s5e,{ref:r,"data-slot":"alert-dialog-content","data-size":n,className:Kt("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100vh-2rem)] w-full -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none focus-visible:ring-3 focus-visible:ring-ring/50 data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=middle]:max-w-[calc(100%-2rem)] data-[size=default]:sm:max-w-sm data-[size=middle]:sm:max-w-xl 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),...s})]})});function QA({className:e,...t}){return l.jsx("div",{"data-slot":"alert-dialog-header",className:Kt("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",e),...t})}function JA({className:e,...t}){return l.jsx("div",{"data-slot":"alert-dialog-footer",className:Kt("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",e),...t})}function ZA({className:e,...t}){return l.jsx(o5e,{"data-slot":"alert-dialog-title",className:Kt("text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",e),...t})}function e9({className:e,...t}){return l.jsx(a5e,{"data-slot":"alert-dialog-description",className:Kt("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}function Aie({className:e,variant:t="default",size:n="default",...s}){return l.jsx(qn,{variant:t,size:n,asChild:!0,children:l.jsx(r5e,{"data-slot":"alert-dialog-action",className:Kt(e),...s})})}function t9({className:e,variant:t="outline",size:n="default",...s}){return l.jsx(qn,{variant:t,size:n,asChild:!0,children:l.jsx(i5e,{"data-slot":"alert-dialog-cancel",className:Kt(e),...s})})}const Ert=Bp("group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-muted"},size:{default:"h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",sm:"h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] 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 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2"}},defaultVariants:{variant:"default",size:"default"}}),Nie=f.createContext({size:"default",variant:"default",spacing:2,orientation:"horizontal"});function jie({className:e,variant:t,size:n,spacing:s=2,orientation:r="horizontal",children:i,...o}){return l.jsx(fM,{orientation:r,"data-slot":"toggle-group","data-variant":t,"data-size":n,"data-spacing":s,"data-orientation":r,style:{"--gap":s},className:Kt("group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch",e),...o,children:l.jsx(Nie.Provider,{value:{variant:t,size:n,spacing:s,orientation:r},children:i})})}function Mie({className:e,children:t,variant:n="default",size:s="default",...r}){const i=f.useContext(Nie);return l.jsx(_ee,{"data-slot":"toggle-group-item","data-variant":i.variant||n,"data-size":i.size||s,"data-spacing":i.spacing,className:Kt("shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t",Ert({variant:i.variant||n,size:i.size||s}),e),...r,children:t})}function Uv({className:e,orientation:t="horizontal",...n}){return l.jsx(m7e,{orientation:t,"data-slot":"tabs","data-orientation":t,className:Kt("group/tabs flex gap-2 data-horizontal:flex-col",e),...n})}const Art=Bp("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 Vv({className:e,variant:t="default",...n}){return l.jsx(p7e,{"data-slot":"tabs-list","data-variant":t,className:Kt(Art({variant:t}),e),...n})}function So({className:e,...t}){return l.jsx(g7e,{"data-slot":"tabs-trigger",className:Kt("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 Pa({className:e,...t}){return l.jsx(b7e,{"data-slot":"tabs-content",className:Kt("flex-1 text-sm outline-none",e),...t})}const Nrt=6*1024*1024;function jrt(e,t){const n=e&&typeof e=="object"?e.body:void 0,s=n&&typeof n=="object"?n.code:void 0;return s==="invalid_skill_source"?t("skills.install.error.invalidSource"):s==="invalid_skill_scope"?t("skills.install.error.invalidScope"):s==="invalid_skill_name"?t("skills.install.error.invalidName"):s==="skill_manifest_missing"?t("skills.install.error.manifestMissing"):s==="invalid_skill_package"||s==="invalid_skill_manifest"||s==="skill_name_mismatch"||s==="unsafe_skill_path"?t("skills.install.error.invalidPackage"):s==="skill_package_too_large"?t("skills.install.error.zipTooLarge"):s==="invalid_skill_folder"?t("skills.install.error.invalidFolder"):s==="github_api_failed"||s==="github_skill_download_failed"?t("skills.install.error.githubFailed"):s==="skill_not_found"?t("skills.install.error.notFound"):s==="token_required"?t("skills.install.error.authentication"):s==="untrusted_workspace"?t("skills.install.error.untrusted"):sa(e)||t("skills.install.failed")}async function Mrt(e){const t=new Uint8Array(await e.arrayBuffer());let n="";for(let s=0;s<t.length;s+=32768)n+=String.fromCharCode(...t.subarray(s,s+32768));return btoa(n)}function Irt({open:e,onOpenChange:t,onInstall:n}){const{t:s}=ut(),[r,i]=f.useState(""),[o,a]=f.useState("workspace"),[c,u]=f.useState("github"),[d,h]=f.useState(""),[m,p]=f.useState(""),[g,b]=f.useState(null),[v,x]=f.useState(!1),[y,w]=f.useState(null);function k(){i(""),a("workspace"),u("github"),h(""),p(""),b(null),w(null)}async function T(){x(!0),w(null);try{if(!r.trim())throw new Error(s("skills.install.error.nameRequired"));let S;if(c==="github"){if(!d.trim())throw new Error(s("skills.install.error.githubRequired"));S={type:"github",url:d.trim()}}else if(c==="folder"){if(!m.trim())throw new Error(s("skills.install.error.folderRequired"));S={type:"folder",path:m.trim()}}else{if(!g)throw new Error(s("skills.install.selectZip"));if(g.size>Nrt)throw new Error(s("skills.install.error.zipTooLarge"));S={type:"zip",contentBase64:await Mrt(g)}}await n({name:r.trim(),scope:o,source:S}),t(!1),k()}catch(S){w(jrt(S,s))}finally{x(!1)}}return l.jsx(Wg,{open:e,onOpenChange:S=>{v||(t(S),S||k())},children:l.jsxs(Gg,{className:"sm:max-w-lg",showCloseButton:!1,onPointerDownOutside:S=>S.preventDefault(),children:[l.jsxs(Kg,{children:[l.jsx(Xg,{children:s("skills.install.title")}),l.jsx(Ex,{children:s("skills.install.description")})]}),l.jsxs("div",{className:"grid gap-4",children:[y?l.jsxs(Fi,{variant:"destructive",children:[l.jsx(Ra,{}),l.jsx(qi,{children:y})]}):null,l.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("skills.install.name"),l.jsx(li,{value:r,onChange:S=>i(S.target.value),placeholder:"my-skill",disabled:v})]}),l.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("skills.install.scope"),l.jsxs(Af,{value:o,onValueChange:S=>a(S),disabled:v,children:[l.jsx(jf,{className:"w-full",children:l.jsx(Nf,{})}),l.jsxs(Mf,{children:[l.jsx(vl,{value:"workspace",children:s("skills.install.scope.workspace")}),l.jsx(vl,{value:"global",children:s("skills.install.scope.global")})]})]})]}),l.jsxs(Uv,{value:c,onValueChange:S=>u(S),children:[l.jsxs(Vv,{className:"grid w-full grid-cols-3",children:[l.jsx(So,{value:"github",disabled:v,children:"GitHub"}),l.jsx(So,{value:"folder",disabled:v,children:s("skills.install.folder")}),l.jsx(So,{value:"zip",disabled:v,children:"ZIP"})]}),l.jsx(Pa,{value:"github",className:"pt-3",children:l.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("skills.install.githubUrl"),l.jsx(li,{type:"url",value:d,onChange:S=>h(S.target.value),placeholder:"https://github.com/owner/repo/blob/main/skill/SKILL.md",disabled:v})]})}),l.jsx(Pa,{value:"folder",className:"pt-3",children:l.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("skills.install.folderPath"),l.jsx(li,{value:m,onChange:S=>p(S.target.value),placeholder:"/absolute/path/to/my-skill",disabled:v})]})}),l.jsx(Pa,{value:"zip",className:"pt-3",children:l.jsxs("div",{className:"grid gap-2",children:[l.jsx(li,{type:"file",accept:".zip,application/zip",onChange:S=>{var _;const C=((_=S.target.files)==null?void 0:_[0])??null;b(C),C&&i(B=>B||C.name.replace(/\.zip$/i,""))},disabled:v}),g?l.jsx("div",{className:"text-xs text-muted-foreground",children:s("skills.install.zipSelected",{name:g.name})}):null]})})]})]}),l.jsxs(Yg,{children:[l.jsx(qn,{variant:"outline",onClick:()=>{t(!1),k()},disabled:v,children:s("common.cancel")}),l.jsxs(qn,{onClick:()=>void T(),disabled:v,children:[v?l.jsx(No,{"data-icon":"inline-start"}):l.jsx(e0e,{"data-icon":"inline-start"}),s("skills.install.action")]})]})]})})}const Rrt="_skillGrid_1hucr_1",Drt={skillGrid:Rrt};function Eq(e,t){return t(`skills.level.${e.level}`)}function Aq(e,t){return t(e.status==="disabled"?"skills.status.disabled":"skills.status.enabled")}function Nq(e){return e.status==="disabled"?"":"bg-[var(--success-bg)] text-[var(--success-color)]"}function Lrt(e,t){const n=e&&typeof e=="object"?e.body:void 0,s=n&&typeof n=="object"?n.code:void 0;return s==="skill_inactive_extension"?t("skills.error.inactiveExtension"):s==="skill_not_toggleable"?t("skills.notToggleable"):e instanceof Error?e.message:t("skills.toggleFailed")}function b0({label:e,value:t}){return l.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[l.jsx("div",{className:"text-sm font-medium",children:e}),l.jsx("div",{className:"break-words text-sm text-muted-foreground",children:t})]})}function jq({compact:e=!1}){const{t}=ut();return l.jsx(F1,{delayDuration:300,children:l.jsxs(q1,{children:[l.jsx(H1,{asChild:!0,children:l.jsx(za,{variant:"secondary",className:e?"text-[10px]":void 0,children:t("skills.manualReference")})}),l.jsx(U1,{children:t("skills.manualReferenceHint")})]})})}function Iie({onClose:e,onUseSkill:t,embedded:n}){var U,ee,oe,Ce;const{t:s}=ut(),r=dc(),{status:i,skills:o,loading:a,error:c,reload:u,setEnabled:d,install:h,remove:m}=ome({autoLoad:!0}),p=((U=r.capabilities)==null?void 0:U.features.includes("workspace_skill_toggle"))===!0,g=((ee=r.capabilities)==null?void 0:ee.features.includes("workspace_skill_manage"))===!0,[b,v]=f.useState(""),[x,y]=f.useState("all"),[w,k]=f.useState("enabled"),[T,S]=f.useState({}),[C,_]=f.useState(null),[B,A]=f.useState(null),[N,j]=f.useState(!1),[P,L]=f.useState(!1),[O,$]=f.useState(null),[z,F]=f.useState(null),G=f.useMemo(()=>o.map(he=>({...he,status:T[he.name]??he.status})),[o,T]),I=f.useMemo(()=>G.find(he=>he.name===C),[G,C]),Q=f.useMemo(()=>grt(G,b,x,w),[G,x,b,w]),V=G.filter(he=>he.status==="disabled").length,M=(c==null?void 0:c.message)??((Ce=(oe=i==null?void 0:i.errors)==null?void 0:oe[0])==null?void 0:Ce.error),re=[{value:"all",label:s("skills.filter.all")},{value:"user",label:s("skills.filter.user")},{value:"project",label:s("skills.filter.project")},{value:"extension",label:s("skills.filter.extension")},{value:"bundled",label:s("skills.filter.bundled")}];f.useEffect(()=>{_(he=>brt(he,G))},[G]),f.useEffect(()=>{S(he=>{const ye={...he};let Ve=!1;for(const it of o)ye[it.name]===it.status&&(delete ye[it.name],Ve=!0);return Ve?ye:he})},[o]),f.useEffect(()=>{n==null||n.onDetailChange(!!I)},[n,I]);async function se(he){const ye=he.status==="disabled";A(he.name),F(null);try{await d(he.name,ye),S(Ve=>({...Ve,[he.name]:ye?"ok":"disabled"})),await u(),F({skillName:he.name,text:s(ye?"skills.enabled":"skills.disabled"),error:!1})}catch(Ve){F({skillName:he.name,text:Lrt(Ve,s),error:!0})}finally{A(null)}}async function X(he){$(null),await h(he),$(s("skills.install.succeeded",{name:he.name.trim()})),await u().catch(()=>{})}async function J(){if(!I)return;const he=I.level==="project"?"workspace":"global";A(I.name);try{await m(I.name,he),L(!1),_(null),$(s("skills.delete.succeeded",{name:I.name})),await u().catch(()=>{})}catch(ye){L(!1),F({skillName:I.name,text:ye instanceof Error?ye.message:s("skills.delete.failed"),error:!0})}finally{A(null)}}function de(){_(null),u()}const W=l.jsx(a1,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(l1,{className:"text-base",children:[l.jsx(oo,{children:l.jsx(qn,{variant:"ghost",size:"icon",onClick:e,"aria-label":s("common.back"),children:l.jsx(jN,{})})}),l.jsx(oo,{children:I?l.jsx(Xh,{asChild:!0,children:l.jsx("button",{type:"button",onClick:de,children:s("skills.title")})}):l.jsx(Gl,{children:s("skills.title")})}),I?l.jsx(Qh,{}):null,I?l.jsx(oo,{children:l.jsx(Gl,{children:I.name})}):null]})}),te=n?I?l.jsx(a1,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(l1,{className:"h-8 text-sm",children:[l.jsx(oo,{children:l.jsx(Xh,{asChild:!0,children:l.jsx("button",{type:"button",onClick:()=>{de(),n.onDetailChange(!1)},children:s("skills.title")})})}),l.jsx(Qh,{}),l.jsx(oo,{children:l.jsx(Gl,{children:I.name})})]})}):null:W;if(I){const he=`/${I.name}${I.argumentHint?` ${I.argumentHint}`:""}`;return l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[te,l.jsxs("div",{className:"flex w-full flex-col gap-6",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-xl bg-muted",children:l.jsx(T2,{})}),l.jsx("div",{className:"min-w-0 flex-1",children:l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("h1",{className:"break-words text-2xl font-semibold text-balance",children:I.name}),l.jsx(za,{variant:"outline",children:Eq(I,s)}),l.jsx(za,{variant:"secondary",className:Nq(I),children:Aq(I,s)}),I.modelInvocable?null:l.jsx(jq,{})]})}),l.jsxs(qn,{disabled:I.status==="disabled",onClick:()=>t(I.name),children:[l.jsx(Ipe,{"data-icon":"inline-start"}),s("skills.run")]}),l.jsxs(kg,{children:[l.jsx(_g,{asChild:!0,children:l.jsx(qn,{variant:"ghost",size:"icon",disabled:B!==null,"aria-label":s("skills.actions"),"data-testid":"skill-actions",children:B===I.name?l.jsx(No,{}):l.jsx(cg,{})})}),l.jsx(Sg,{align:"end",onCloseAutoFocus:ye=>ye.preventDefault(),children:l.jsxs(c1,{children:[l.jsx($o,{disabled:B!==null||!p||I.userInvocable===!1,title:p?I.userInvocable===!1?s("skills.notToggleable"):void 0:s("skills.toggleUnsupported"),onSelect:()=>void se(I),children:s(I.status==="disabled"?"skills.enable":"skills.disable")}),g&&(I.level==="project"||I.level==="user")?l.jsx($o,{variant:"destructive",disabled:B!==null,onSelect:()=>L(!0),children:s("skills.delete.action")}):null]})})]})]}),(z==null?void 0:z.skillName)===I.name?l.jsxs(Fi,{variant:z.error?"destructive":"default",children:[z.error?l.jsx(Ra,{}):l.jsx(dx,{}),l.jsx(qi,{children:z.text})]}):null,M||I.error?l.jsxs(Fi,{variant:"destructive",children:[l.jsx(Ra,{}),l.jsx(qi,{children:I.error||M})]}):null,l.jsxs(Kl,{children:[l.jsxs(gd,{children:[l.jsx(bd,{className:"text-sm",children:s("skills.details")}),l.jsx(Jh,{children:I.description||s("skills.noDescription")})]}),l.jsxs(op,{className:"grid gap-6 sm:grid-cols-2",children:[l.jsx(b0,{label:s("skills.invocation"),value:he}),l.jsx(b0,{label:s("skills.level"),value:Eq(I,s)}),l.jsx(b0,{label:s("skills.modelAccess"),value:I.modelInvocable?s("skills.modelAccess.enabled"):s("skills.modelAccess.disabled")}),l.jsx(b0,{label:s("skills.model"),value:I.model||"-"}),l.jsx(b0,{label:s("skills.extension"),value:I.extensionName||"-"}),I.hint?l.jsx("div",{className:"sm:col-span-2",children:l.jsx(b0,{label:s("skills.hint"),value:I.hint})}):null]})]}),l.jsx(YA,{open:P,onOpenChange:ye=>{!ye&&B!==null||L(ye)},children:l.jsxs(XA,{children:[l.jsxs(QA,{children:[l.jsx(ZA,{children:s("skills.delete.title")}),l.jsx(e9,{children:s("skills.delete.description",{name:I.name})})]}),l.jsxs(JA,{children:[l.jsx(t9,{disabled:B!==null,children:s("common.cancel")}),l.jsxs(Aie,{variant:"destructive",disabled:B!==null,onClick:ye=>{ye.preventDefault(),J()},children:[B?l.jsx(No,{"data-icon":"inline-start"}):null,s("skills.delete.action")]})]})]})})]})]})}return l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[te,l.jsxs("div",{className:"flex w-full flex-col gap-6",children:[l.jsxs("div",{className:"flex items-start justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl font-semibold text-balance",children:s("skills.title")}),l.jsx("p",{className:"mt-1 text-sm text-muted-foreground tabular-nums",children:s("skills.count",{count:o.length,enabled:o.length-V,disabled:V})})]}),l.jsxs("div",{className:"flex gap-2",children:[g?l.jsxs(qn,{onClick:()=>j(!0),children:[l.jsx(hx,{"data-icon":"inline-start"}),s("skills.install.action")]}):null,l.jsxs(qn,{variant:"outline",disabled:a,onClick:()=>void u(),children:[a?l.jsx(No,{"data-icon":"inline-start"}):l.jsx(My,{"data-icon":"inline-start"}),s("common.refresh")]})]})]}),M?l.jsxs(Fi,{variant:"destructive",children:[l.jsx(Ra,{}),l.jsx(qi,{children:M})]}):null,O?l.jsxs(Fi,{children:[l.jsx(dx,{}),l.jsx(qi,{children:O})]}):null,l.jsxs("div",{className:"relative",children:[l.jsx(Fd,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),l.jsx(li,{name:"skill-search","aria-label":s("skills.search"),autoComplete:"off",value:b,onChange:he=>v(he.target.value),placeholder:s("skills.search"),className:"pl-9"})]}),l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[l.jsx(jie,{type:"single",value:x,onValueChange:he=>{he&&y(he)},variant:"outline",size:"sm","aria-label":s("skills.filter.label"),children:re.map(he=>l.jsx(Mie,{value:he.value,children:he.label},he.value))}),l.jsxs(Af,{value:w,onValueChange:he=>k(he),children:[l.jsx(jf,{className:"w-32","aria-label":s("skills.filter.status.label"),children:l.jsx(Nf,{})}),l.jsxs(Mf,{children:[l.jsx(vl,{value:"all",children:s("skills.filter.status.all")}),l.jsx(vl,{value:"enabled",children:s("skills.filter.status.enabled")}),l.jsx(vl,{value:"disabled",children:s("skills.filter.status.disabled")})]})]})]}),Q.length?l.jsx("div",{className:Drt.skillGrid,"data-column-count":Math.min(Q.length,4),children:Q.map(he=>l.jsx(Kl,{size:"sm",role:"button",tabIndex:0,"aria-label":he.name,className:"cursor-pointer transition-colors hover:bg-accent/30 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none",onClick:()=>_(he.name),onKeyDown:ye=>{(ye.key==="Enter"||ye.key===" ")&&(ye.preventDefault(),_(he.name))},children:l.jsx(gd,{className:"block",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted",children:l.jsx(T2,{className:"size-5"})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-2",children:[l.jsx(bd,{className:"min-w-0 flex-1 truncate",children:he.name}),l.jsxs("div",{className:"flex shrink-0 gap-1",children:[l.jsx(za,{variant:"secondary",className:`${Nq(he)} text-[10px]`,children:Aq(he,s)}),he.modelInvocable?null:l.jsx(jq,{compact:!0})]})]}),l.jsx(Jh,{className:"mt-1 min-w-0 text-xs",children:l.jsx(F1,{delayDuration:300,children:l.jsxs(q1,{children:[l.jsx(H1,{asChild:!0,children:l.jsx("span",{className:"block truncate",children:he.description||s("skills.noDescription")})}),l.jsx(U1,{children:he.description||s("skills.noDescription")})]})})})]})]})})},he.name))}):l.jsx(jd,{className:"border",children:l.jsxs(Md,{children:[l.jsx(Id,{variant:"icon",children:b||x!=="all"||w!=="all"?l.jsx(Fd,{}):l.jsx(T2,{})}),l.jsx(Rd,{children:s(b||x!=="all"||w!=="all"?"skills.noMatches":"skills.empty")})]})})]}),l.jsx(Irt,{open:N,onOpenChange:j,onInstall:X})]})}const Prt="_chart_1xbk4_1",Ort="_plot_1xbk4_8",Brt="_svg_1xbk4_13",$rt="_cursor_1xbk4_30",zrt="_tooltip_1xbk4_40",Frt="_tooltipBelow_1xbk4_62",qrt="_tooltipTime_1xbk4_67",Hrt="_tooltipRow_1xbk4_73",Urt="_tooltipLabel_1xbk4_79",Vrt="_tooltipValue_1xbk4_83",Wrt="_axis_1xbk4_91",Grt="_legend_1xbk4_96",Krt="_legendItem_1xbk4_105",Yrt="_swatch_1xbk4_112",Xrt="_legendLabel_1xbk4_118",Qrt="_legendValue_1xbk4_123",Jrt="_peak_1xbk4_131",Zi={chart:Prt,plot:Ort,svg:Brt,cursor:$rt,tooltip:zrt,tooltipBelow:Frt,tooltipTime:qrt,tooltipRow:Hrt,tooltipLabel:Urt,tooltipValue:Vrt,axis:Wrt,legend:Grt,legendItem:Krt,swatch:Yrt,legendLabel:Xrt,legendValue:Qrt,peak:Jrt},n9=320,uy=64,Na=3,Kk=n9-Na*2,Yk=uy-Na*2;function Mq(e,t){return Number.isFinite(e)?e:t}const Zrt=84;function eit(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 tit(e){return new Date(e).toLocaleTimeString()}function Rie({series:e,timestamps:t,format:n=a=>String(Math.round(a)),formatTime:s=tit,zeroBased:r=!0,ariaLabel:i,peakLabel:o="peak"}){const a=f.useRef(null),[c,u]=f.useState(null),[d,h]=f.useState(!1),m=f.useRef(void 0),{paths:p,maxV:g,maxLen:b,min:v,span:x}=f.useMemo(()=>{const A=e.reduce((z,F)=>Math.max(z,F.values.length),0);let N=0,j=r?0:Number.POSITIVE_INFINITY;for(const z of e)for(const F of z.values)Number.isFinite(F)&&(F>N&&(N=F),F<j&&(j=F));Number.isFinite(j)||(j=0);const P=N-j||1,L=z=>A<=1?Na+Kk/2:Na+z/(A-1)*Kk,O=z=>Na+Yk-(Mq(z,j)-j)/P*Yk;return{paths:e.map(z=>{const F=z.values.map((Q,V)=>`${V===0?"M":"L"}${L(V).toFixed(1)},${O(Q).toFixed(1)}`).join(" "),G=z.values.length-1,I=G>=0?{cx:L(G),cy:O(z.values[G]),color:z.color}:void 0;return{key:z.label,d:F,color:z.color,dot:I}}),maxV:N,maxLen:A,min:j,span:P}},[e,r]),y=b>0,w=A=>b<=1?Na+Kk/2:Na+A/(b-1)*Kk,k=A=>Na+Yk-(Mq(A,v)-v)/x*Yk,T=A=>{const N=a.current;if(!N||b===0)return;const j=N.getBoundingClientRect();if(j.width===0)return;const P=(A.clientX-j.left)/j.width,L=Math.max(0,Math.min(b-1,Math.round(P*(b-1))));u(L),m.current===void 0&&(m.current=eit(N));const O=m.current,$=O?O.getBoundingClientRect().top:0;h(j.top-$<Zrt)},S=()=>u(null),C=c!=null&&c>=0&&c<b?c:null,_=C!=null?w(C):0,B=C!=null&&b>1?C/(b-1)*100:50;return l.jsxs("div",{className:Zi.chart,children:[l.jsxs("div",{className:Zi.plot,children:[l.jsxs("svg",{ref:a,viewBox:`0 0 ${n9} ${uy}`,preserveAspectRatio:"none",role:"img","aria-label":i,className:Zi.svg,onPointerMove:T,onPointerLeave:S,children:[l.jsx("line",{x1:Na,y1:uy-Na,x2:n9-Na,y2:uy-Na,className:Zi.axis,vectorEffect:"non-scaling-stroke"}),p.map(A=>l.jsx("path",{d:A.d,fill:"none",stroke:A.color,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round",vectorEffect:"non-scaling-stroke"},A.key)),C!=null&&l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:_,y1:Na,x2:_,y2:uy-Na,className:Zi.cursor,vectorEffect:"non-scaling-stroke"}),e.map(A=>C<A.values.length?l.jsx("circle",{cx:_,cy:k(A.values[C]),r:2.5,fill:A.color,vectorEffect:"non-scaling-stroke"},`${A.label}-hover`):null)]}),C==null&&p.map(A=>A.dot?l.jsx("circle",{cx:A.dot.cx,cy:A.dot.cy,r:2,fill:A.dot.color,vectorEffect:"non-scaling-stroke"},`${A.key}-dot`):null)]}),C!=null&&l.jsxs("div",{className:`${Zi.tooltip} ${d?Zi.tooltipBelow:""}`,style:{left:`${B}%`},role:"tooltip",children:[t&&t[C]!=null&&l.jsx("div",{className:Zi.tooltipTime,children:s(t[C])}),e.map(A=>C<A.values.length?l.jsxs("div",{className:Zi.tooltipRow,children:[l.jsx("svg",{className:Zi.swatch,viewBox:"0 0 8 8","aria-hidden":"true",children:l.jsx("rect",{width:"8",height:"8",rx:"1.5",fill:A.color})}),l.jsx("span",{className:Zi.tooltipLabel,children:A.label}),l.jsx("span",{className:Zi.tooltipValue,children:n(A.values[C])})]},A.label):null)]})]}),l.jsxs("div",{className:Zi.legend,children:[e.map(A=>{const N=A.values.length?A.values[A.values.length-1]:void 0;return l.jsxs("span",{className:Zi.legendItem,children:[l.jsx("svg",{className:Zi.swatch,viewBox:"0 0 8 8","aria-hidden":"true",children:l.jsx("rect",{width:"8",height:"8",rx:"1.5",fill:A.color})}),l.jsx("span",{className:Zi.legendLabel,children:A.label}),N!==void 0&&l.jsx("span",{className:Zi.legendValue,children:n(N)})]},A.label)}),y&&l.jsx("span",{className:Zi.peak,children:`${o} ${n(g)}`})]})]})}const nit="_wrap_1icv6_1",sit="_tooltip_1icv6_11",rit="_legend_1icv6_27",iit="_legendLabel_1icv6_35",oit="_scroll_1icv6_39",ait="_grid_1icv6_44",lit="_month_1icv6_51",cit="_weekday_1icv6_59",uit="_cell_1icv6_69",dit="_legendCell_1icv6_75",hit="_lvl0_1icv6_82",fit="_lvl1_1icv6_85",mit="_lvl2_1icv6_88",pit="_lvl3_1icv6_91",git="_lvl4_1icv6_94",bit="_today_1icv6_98",na={wrap:nit,tooltip:sit,legend:rit,legendLabel:iit,scroll:oit,grid:ait,month:lit,weekday:cit,cell:uit,legendCell:dit,lvl0:hit,lvl1:fit,lvl2:mit,lvl3:pit,lvl4:git,today:bit},W6=864e5,yit=4;function G6(e){const t=new Date(e);return t.setHours(0,0,0,0),t}function Iq(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 xit(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 vit(e,[t,n,s]){return e<=0?0:e<=t?1:e<=n?2:e<=s?3:yit}function wit(e,t,n){const s=Math.max(1,Math.floor(t)),r=G6(Date.now()),i=G6(r.getTime()-(s-1)*W6),o=(i.getDay()+6)%7,a=G6(i.getTime()-o*W6),c=Math.round((r.getTime()-a.getTime())/W6)+1,u=[],d=[],h=Iq(r),m=new Date(a.getTime());for(let w=0;w<c;w++){const k=Iq(m),T=e[k],S=(T==null?void 0:T.tokens)??0;d.push(S),u.push({dateKey:k,tokens:S,cacheReadRate:(T==null?void 0:T.cacheReadRate)??0,isToday:k===h,weekday:w%7,week:Math.floor(w/7)}),m.setDate(m.getDate()+1)}const p=xit(d),g=u.map(w=>({...w,level:vit(w.tokens,p)})),b=Math.ceil(c/7),v=[];let x=-1;const y=new Date(a.getTime());for(let w=0;w<b;w++){const k=y.getMonth();k!==x&&(v.push({week:w,text:y.toLocaleDateString(n,{month:"short"})}),x=k),y.setDate(y.getDate()+7)}return{cells:g,months:v,weeks:b}}function kit({heatmap:e,days:t}){const{t:n,language:s}=ut(),r=f.useMemo(()=>wit(e,t,s),[e,t,s]),i=f.useRef(null),[o,a]=f.useState(null),c={0:n("daemon.usage.dowMon"),2:n("daemon.usage.dowWed"),4:n("daemon.usage.dowFri")},u=d=>{const h=d.target.closest("[data-date]"),m=i.current;if(!h||!m)return;const p=h.dataset.date??"",g=Number(h.dataset.tokens??"0"),b=Number(h.dataset.cache??"0"),v=h.getBoundingClientRect(),x=m.getBoundingClientRect();a({left:v.left-x.left+v.width/2,top:v.top-x.top,text:n("daemon.usage.cellTokens",{date:p,tokens:Z0(g),cache:Math.round(b*100)})})};return l.jsxs("div",{className:na.wrap,ref:i,children:[l.jsxs("div",{className:na.legend,children:[l.jsx("span",{className:na.legendLabel,children:n("daemon.usage.low")}),[0,1,2,3,4].map(d=>l.jsx("span",{className:`${na.cell} ${na.legendCell} ${na[`lvl${d}`]}`},d)),l.jsx("span",{className:na.legendLabel,children:n("daemon.usage.high")})]}),l.jsx("div",{className:na.scroll,onMouseOver:u,onMouseLeave:()=>a(null),children:l.jsxs("div",{className:na.grid,role:"img","aria-label":n("daemon.usage.heatmapTitle"),style:{gridTemplateColumns:`auto repeat(${r.weeks}, var(--hm-cell))`},children:[r.months.map(d=>l.jsx("div",{className:na.month,style:{gridColumn:d.week+2,gridRow:1},children:d.text},`m-${d.week}`)),[0,2,4].map(d=>l.jsx("div",{className:na.weekday,style:{gridColumn:1,gridRow:d+2},children:c[d]},`wd-${d}`)),r.cells.map(d=>l.jsx("div",{className:`${na.cell} ${na[`lvl${d.level}`]} ${d.isToday?na.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&&l.jsx("div",{className:na.tooltip,style:{left:o.left,top:o.top},role:"status",children:o.text})]})}const _it="_usage_1kfmt_1",Sit="_toolbar_1kfmt_9",Cit="_segmented_1kfmt_14",Tit="_segment_1kfmt_14",Eit="_segmentActive_1kfmt_41",Ait="_hero_1kfmt_48",Nit="_heroMain_1kfmt_59",jit="_heroLabel_1kfmt_63",Mit="_heroNumber_1kfmt_71",Iit="_heroSub_1kfmt_82",Rit="_refresh_1kfmt_87",Dit="_stats_1kfmt_109",Lit="_stat_1kfmt_109",Pit="_statValue_1kfmt_121",Oit="_statLabel_1kfmt_130",Bit="_section_1kfmt_139",$it="_sectionTitle_1kfmt_145",zit="_sectionSub_1kfmt_154",Fit="_breakdown_1kfmt_161",qit="_metric_1kfmt_167",Hit="_metricHead_1kfmt_173",Uit="_tick_1kfmt_179",Vit="_tick_input_1kfmt_186",Wit="_tick_output_1kfmt_190",Git="_tick_cache_1kfmt_198",Kit="_metricLabel_1kfmt_202",Yit="_metricValue_1kfmt_209",Xit="_metricHint_1kfmt_219",Qit="_state_1kfmt_225",Jit="_modelList_1kfmt_233",Zit="_modelRow_1kfmt_239",eot="_modelHead_1kfmt_245",tot="_modelRank_1kfmt_251",not="_modelMeta_1kfmt_262",sot="_modelName_1kfmt_267",rot="_modelSub_1kfmt_277",iot="_modelShare_1kfmt_282",oot="_modelTrack_1kfmt_289",aot="_modelFill_1kfmt_296",lot="_modelFillCache_1kfmt_303",cot="_skillTable_1kfmt_310",uot="_right_1kfmt_334",dot="_bars_1kfmt_339",hot="_barsBody_1kfmt_345",fot="_barCol_1kfmt_352",mot="_bar_1kfmt_339",pot="_barsCaption_1kfmt_371",wn={usage:_it,toolbar:Sit,segmented:Cit,segment:Tit,segmentActive:Eit,hero:Ait,heroMain:Nit,heroLabel:jit,heroNumber:Mit,heroSub:Iit,refresh:Rit,stats:Dit,stat:Lit,statValue:Pit,statLabel:Oit,section:Bit,sectionTitle:$it,sectionSub:zit,breakdown:Fit,metric:qit,metricHead:Hit,tick:Uit,tick_input:Vit,tick_output:Wit,tick_cache:Git,metricLabel:Kit,metricValue:Yit,metricHint:Xit,state:Qit,modelList:Jit,modelRow:Zit,modelHead:eot,modelRank:tot,modelMeta:not,modelName:sot,modelSub:rot,modelShare:iot,modelTrack:oot,modelFill:aot,modelFillCache:lot,skillTable:cot,right:uot,bars:dot,barsBody:hot,barCol:fot,bar:mot,barsCaption:pot},Die=12,got=Math.round(Die*30.44),bot=["today","week","month"],yot={today:"daemon.usage.today",week:"daemon.usage.period7d",month:"daemon.usage.period30d"},xot={today:"daemon.usage.today",week:"daemon.usage.rangeWeek",month:"daemon.usage.rangeMonth"},vot={today:"daemon.usage.rangeWordToday",week:"daemon.usage.rangeWordWeek",month:"daemon.usage.rangeWordMonth"},Rq=["#3b82f6","#14b8a6","#f59e0b","#ef4444","#8b5cf6","#22c55e","#06b6d4","#ec4899"];function wot(e){return new Date(`${e}T00:00:00`).getTime()}function K6(e,t){return new Date(`${e}T00:00:00`).toLocaleDateString(t,{month:"short",day:"numeric"})}function kot(e,t){return new Date(e).toLocaleDateString(t,{month:"short",day:"numeric"})}function Xk({label:e,value:t}){return l.jsxs("div",{className:wn.stat,children:[l.jsx("div",{className:wn.statValue,children:t.toLocaleString()}),l.jsx("div",{className:wn.statLabel,children:e})]})}function Y6({accent:e,value:t,label:n,hint:s}){return l.jsxs("div",{className:wn.metric,children:[l.jsxs("div",{className:wn.metricHead,children:[l.jsx("span",{className:`${wn.tick} ${wn[`tick_${e}`]}`}),l.jsx("span",{className:wn.metricLabel,children:n})]}),l.jsx("div",{className:wn.metricValue,children:t}),l.jsx("div",{className:wn.metricHint,children:s})]})}function _ot({rank:e,model:t,color:n}){const{t:s}=ut(),r=Math.max(0,Math.min(100,t.share*100)),i=Math.max(0,Math.min(100,t.cacheReadRate*100));return l.jsxs("div",{className:wn.modelRow,children:[l.jsxs("div",{className:wn.modelHead,children:[l.jsx("span",{className:wn.modelRank,style:{color:n},children:String(e).padStart(2,"0")}),l.jsxs("div",{className:wn.modelMeta,children:[l.jsx("div",{className:wn.modelName,children:t.model}),l.jsx("div",{className:wn.modelSub,children:s("daemon.usage.modelMeta",{tokens:Z0(t.totalTokens),cache:Math.round(i)})})]}),l.jsxs("span",{className:wn.modelShare,style:{color:n},children:[Math.round(r),"%"]})]}),l.jsx("div",{className:wn.modelTrack,children:l.jsx("div",{className:wn.modelFill,style:{width:`${r}%`,background:n},children:l.jsx("div",{className:wn.modelFillCache,style:{width:`${i}%`}})})})]})}function Sot({points:e,format:t,locale:n}){const s=Math.max(1,...e.map(r=>r.value));return l.jsxs("div",{className:wn.bars,children:[l.jsx("div",{className:wn.barsBody,children:e.map((r,i)=>l.jsx("div",{className:wn.barCol,title:`${K6(r.label,n)} · ${t(r.value)}`,children:l.jsx("div",{className:wn.bar,style:{height:`${r.value/s*100}%`}})},`${r.label}-${i}`))}),e.length>1&&l.jsxs("div",{className:wn.barsCaption,children:[l.jsx("span",{children:K6(e[0].label,n)}),l.jsx("span",{children:K6(e[e.length-1].label,n)})]})]})}function Cot(){const{t:e,language:t}=ut(),[n,s]=f.useState("today"),{dashboard:r,loading:i,error:o,reload:a}=ame({range:n,heatmapDays:got,autoLoad:!0}),c=l.jsx("div",{className:wn.segmented,role:"group","aria-label":e("daemon.usage.rangeGroup"),children:bot.map(y=>l.jsx("button",{type:"button",className:`${wn.segment} ${y===n?wn.segmentActive:""}`,"aria-pressed":y===n,onClick:()=>s(y),children:e(yot[y])},y))});if(!r)return l.jsxs("div",{className:wn.usage,children:[l.jsx("div",{className:wn.toolbar,children:c}),i?l.jsx("div",{className:wn.state,children:e("daemon.usage.loading")}):o?l.jsxs("div",{className:wn.state,children:[e("daemon.usage.failed"),": ",o.message]}):l.jsx("div",{className:wn.state,children:e("daemon.usage.empty")})]});const{summary:u,models:d,skills:h,daily:m,heatmap:p,heatmapDays:g}=r,b=u.linesAdded+u.linesRemoved,v=u.totalTokens>0||Object.keys(p).length>0,x=e(vot[r.range]);return l.jsxs("div",{className:wn.usage,"aria-busy":i,children:[l.jsx("div",{className:wn.toolbar,children:c}),l.jsxs("header",{className:wn.hero,children:[l.jsxs("div",{className:wn.heroMain,children:[l.jsx("div",{className:wn.heroLabel,children:e(xot[r.range])}),l.jsx("div",{className:wn.heroNumber,children:Z0(u.totalTokens)}),l.jsx("div",{className:wn.heroSub,children:e("daemon.usage.tokensConsumed")})]}),l.jsx("button",{type:"button",className:wn.refresh,onClick:()=>void a(),disabled:i,children:e("daemon.refresh")})]}),l.jsxs("div",{className:wn.stats,children:[l.jsx(Xk,{label:e("daemon.usage.sessions"),value:u.sessions}),l.jsx(Xk,{label:e("daemon.usage.requests"),value:u.requests}),l.jsx(Xk,{label:e("daemon.usage.tools"),value:u.toolCalls}),l.jsx(Xk,{label:e("daemon.usage.changes"),value:b})]}),l.jsxs("section",{className:wn.section,children:[l.jsx("h4",{className:wn.sectionTitle,children:e("daemon.usage.breakdownTitle")}),l.jsxs("div",{className:wn.breakdown,children:[l.jsx(Y6,{accent:"input",value:Z0(u.inputTokens),label:e("daemon.usage.inputTokens"),hint:e("daemon.usage.inputHint")}),l.jsx(Y6,{accent:"output",value:Z0(u.outputTokens+u.thoughtsTokens),label:e("daemon.usage.outputTokens"),hint:e("daemon.usage.outputHint")}),l.jsx(Y6,{accent:"cache",value:`${Math.round(u.cacheReadRate*100)}%`,label:e("daemon.usage.cacheRead"),hint:e("daemon.usage.cacheHint")})]})]}),l.jsxs("section",{className:wn.section,children:[l.jsx("h4",{className:wn.sectionTitle,children:e("daemon.usage.heatmapTitle")}),l.jsx("div",{className:wn.sectionSub,children:e("daemon.usage.heatmapSub",{months:Die})}),v?l.jsx(kit,{heatmap:p,days:g}):l.jsx("div",{className:wn.state,children:e("daemon.usage.empty")})]}),d.length>0&&l.jsxs("section",{className:wn.section,children:[l.jsxs("h4",{className:wn.sectionTitle,children:[x," ",e("daemon.usage.modelShareTitle")]}),l.jsx("div",{className:wn.sectionSub,children:e("daemon.usage.modelShareSub")}),l.jsx("div",{className:wn.modelList,children:d.map((y,w)=>l.jsx(_ot,{rank:w+1,model:y,color:Rq[w%Rq.length]},y.model))})]}),h.length>0&&l.jsxs("section",{className:wn.section,children:[l.jsxs("h4",{className:wn.sectionTitle,children:[x," ",e("daemon.usage.skillTitle")]}),l.jsx("div",{className:wn.sectionSub,children:e("daemon.usage.skillSub")}),l.jsxs("table",{className:wn.skillTable,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:e("daemon.usage.skillName")}),l.jsx("th",{className:wn.right,children:e("daemon.usage.skillCount")})]})}),l.jsx("tbody",{children:h.map(y=>l.jsxs("tr",{children:[l.jsx("td",{children:y.name}),l.jsx("td",{className:wn.right,children:y.count.toLocaleString()})]},y.name))})]})]}),m.length>1&&l.jsxs("section",{className:wn.section,children:[l.jsxs("h4",{className:wn.sectionTitle,children:[x," ",e("daemon.usage.dailyTokensTitle")]}),l.jsx("div",{className:wn.sectionSub,children:e("daemon.usage.dailyTokensSub")}),l.jsx(Rie,{series:[{label:e("daemon.usage.tokensConsumed"),values:m.map(y=>y.tokens),color:"var(--agent-blue-400)"}],timestamps:m.map(y=>wot(y.date)),format:Z0,formatTime:y=>kot(y,t),ariaLabel:e("daemon.usage.dailyTokensTitle"),peakLabel:e("daemon.charts.peak")})]}),m.length>1&&l.jsxs("section",{className:wn.section,children:[l.jsxs("h4",{className:wn.sectionTitle,children:[x," ",e("daemon.usage.dailySessionsTitle")]}),l.jsx("div",{className:wn.sectionSub,children:e("daemon.usage.dailySessionsSub")}),l.jsx(Sot,{points:m.map(y=>({label:y.date,value:y.sessions})),format:y=>y.toLocaleString(),locale:t})]})]})}const Tot="_dialog_lw868_4",Eot="_toolbar_lw868_12",Aot="_toolbarActions_lw868_19",Not="_updatedAt_lw868_26",jot="_refreshError_lw868_31",Mot="_refreshButton_lw868_36",Iot="_badge_lw868_51",Rot="_levelOk_lw868_61",Dot="_levelWarning_lw868_66",Lot="_levelError_lw868_71",Pot="_levelUnavailable_lw868_76",Oot="_tabs_lw868_81",Bot="_tab_lw868_81",$ot="_tabActive_lw868_106",zot="_grid_lw868_114",Fot="_chartsGrid_lw868_113",qot="_card_lw868_128",Hot="_cardTitle_lw868_135",Uot="_cardHeader_lw868_147",Vot="_infoHint_lw868_162",Wot="_infoHintButton_lw868_168",Got="_infoHintTip_lw868_197",Kot="_row_lw868_231",Yot="_rowLabel_lw868_240",Xot="_rowValue_lw868_244",Qot="_pathRow_lw868_253",Jot="_pathValue_lw868_247",Zot="_empty_lw868_274",eat="_issueRow_lw868_279",tat="_issueMessage_lw868_286",nat="_featureChips_lw868_290",sat="_featureChip_lw868_290",rat="_summaryChip_lw868_311",iat="_sessionRow_lw868_320",oat="_sessionName_lw868_329",aat="_sessionMeta_lw868_335",lat="_activePrompt_lw868_344",cat="_workspaceRow_lw868_348",uat="_workspaceRowHead_lw868_357",dat="_workspaceName_lw868_363",hat="_workspaceDuration_lw868_367",fat="_workspaceError_lw868_374",mat="_workspaceSummary_lw868_381",pat="_workspaceCell_lw868_388",gat="_workspaceCellLabel_lw868_397",bat="_workspaceCellMessage_lw868_402",un={dialog:Tot,toolbar:Eot,toolbarActions:Aot,updatedAt:Not,refreshError:jot,refreshButton:Mot,badge:Iot,levelOk:Rot,levelWarning:Dot,levelError:Lot,levelUnavailable:Pot,tabs:Oot,tab:Bot,tabActive:$ot,grid:zot,chartsGrid:Fot,card:qot,cardTitle:Hot,cardHeader:Uot,infoHint:Vot,infoHintButton:Wot,infoHintTip:Got,row:Kot,rowLabel:Yot,rowValue:Xot,pathRow:Qot,pathValue:Jot,empty:Zot,issueRow:eat,issueMessage:tat,featureChips:nat,featureChip:sat,summaryChip:rat,sessionRow:iat,sessionName:oat,sessionMeta:aat,activePrompt:lat,workspaceRow:cat,workspaceRowHead:uat,workspaceName:dat,workspaceDuration:hat,workspaceError:fat,workspaceSummary:mat,workspaceCell:pat,workspaceCellLabel:gat,workspaceCellMessage:bat},yat=5e3,y0=[{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 Lie(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 Zh(e){return e=Math.max(0,e),e>=6e4?Lie(e):e>=1e3?`${(e/1e3).toFixed(e%1e3===0?0:1)}s`:`${e}ms`}function i4(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 Fb(e){const t=Math.round(e);return t>=1e4?`${(t/1e3).toFixed(t%1e3===0?0:1)}k`:t.toLocaleString()}function xat(e){return`${e.toFixed(e>=100||e===0?0:1)}%`}function vat(e){return e.exitCode!=null?`${e.state} (exit ${e.exitCode})`:e.signal?`${e.state} (${e.signal})`:e.state}function Dq(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const wat=["cells","servers","errors","skills","tools","providers","hooks","extensions","budgets"];function kat(e){if(!Dq(e))return[];const t=[];for(const n of wat){const s=e[n];if(Array.isArray(s))for(const r of s){if(!Dq(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 s9(e){switch(e){case"ok":return un.levelOk;case"warning":return un.levelWarning;case"error":return un.levelError;default:return un.levelUnavailable}}function ir({label:e,value:t}){return l.jsxs("div",{className:un.row,children:[l.jsx("span",{className:un.rowLabel,children:e}),l.jsx("span",{className:un.rowValue,children:t})]})}function _at({text:e}){return l.jsxs("span",{className:un.infoHint,children:[l.jsx("button",{type:"button",className:un.infoHintButton,"aria-label":e,children:l.jsx("span",{"aria-hidden":"true",children:"ⓘ"})}),l.jsx("span",{"aria-hidden":"true",className:un.infoHintTip,children:e})]})}function Fl({title:e,help:t,children:n}){return l.jsxs("section",{className:un.card,children:[t?l.jsxs("div",{className:un.cardHeader,children:[l.jsx("h3",{className:un.cardTitle,children:e}),l.jsx(_at,{text:t})]}):l.jsx("h3",{className:un.cardTitle,children:e}),n]})}function Sat({name:e,section:t}){const{t:n}=ut(),s=Object.entries(t.summary??{}),r=kat(t.data);return l.jsxs("div",{className:un.workspaceRow,children:[l.jsxs("div",{className:un.workspaceRowHead,children:[l.jsx("span",{className:`${un.badge} ${s9(t.status)}`,children:n(`daemon.level.${t.status}`)}),l.jsx("span",{className:un.workspaceName,children:e}),l.jsx("span",{className:un.workspaceDuration,children:Zh(t.durationMs)})]}),t.error&&l.jsx("div",{className:un.workspaceError,children:t.error.message}),r.map((i,o)=>l.jsxs("div",{className:un.workspaceCell,children:[l.jsx("span",{className:`${un.badge} ${s9(i.status)}`,children:n(`daemon.level.${i.status}`)}),l.jsx("span",{className:un.workspaceCellLabel,children:i.label}),i.message&&l.jsx("span",{className:un.workspaceCellMessage,children:i.message})]},`${i.label}-${o}`)),s.length>0&&l.jsx("div",{className:un.workspaceSummary,children:s.map(([i,o])=>l.jsxs("span",{className:un.summaryChip,children:[i,": ",o===null?n("common.na"):String(o)]},i))})]})}function Cat({report:e}){const{t}=ut(),n=e.full;if(!n)return null;const s=Object.entries(n.workspace).sort(([r],[i])=>r.localeCompare(i));return l.jsxs(l.Fragment,{children:[l.jsx(Fl,{title:t("daemon.full.sessions.title"),children:n.sessions.length===0?l.jsx("div",{className:un.empty,children:t("daemon.full.sessions.empty")}):n.sessions.map(r=>l.jsxs("div",{className:un.sessionRow,children:[l.jsx("div",{className:un.sessionName,children:r.displayName||r.sessionId}),l.jsxs("div",{className:un.sessionMeta,children:[l.jsx("span",{children:t("common.clients",{count:r.clientCount})}),l.jsx("span",{children:t("daemon.full.session.pendingPrompts",{count:r.pendingPromptCount})}),l.jsx("span",{children:t("daemon.full.session.pendingPermissions",{count:r.pendingPermissionCount})}),r.hasActivePrompt&&l.jsx("span",{className:un.activePrompt,children:t("daemon.full.session.prompting")})]})]},r.sessionId))}),l.jsx(Fl,{title:t("daemon.full.workspace.title"),children:s.length===0?l.jsx("div",{className:un.empty,children:t("daemon.full.workspace.empty")}):s.map(([r,i])=>l.jsx(Sat,{name:r,section:i},r))}),l.jsxs(Fl,{title:t("daemon.full.auth.title"),children:[l.jsx(ir,{label:t("daemon.full.auth.providers"),value:n.auth.supportedDeviceFlowProviders.join(", ")||t("daemon.none")}),l.jsx(ir,{label:t("daemon.full.auth.pending"),value:n.auth.pendingDeviceFlowCount}),l.jsx(ir,{label:t("daemon.full.acp.title"),value:n.acpConnections.length})]})]})}function Tat({series:e}){const{t}=ut();if(e.length===0)return l.jsx(Fl,{title:t("daemon.charts.title"),children:l.jsx("div",{className:un.empty,children:t("daemon.charts.empty")})});const n=i=>e.map(i),s=e.map(i=>i.t),r=(i,o,a,c)=>l.jsx(Fl,{title:t(i),help:t(c),children:l.jsx(Rie,{series:a,timestamps:s,format:o,ariaLabel:t(i),peakLabel:t("daemon.charts.peak")})});return l.jsxs("div",{className:`${un.grid} ${un.chartsGrid}`,children:[r("daemon.charts.concurrency",Fb,[{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",Fb,[{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",Zh,[{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",Zh,[{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",Fb,[{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",Zh,[{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",Zh,[{label:t("daemon.charts.eventLoopLag"),values:n(i=>i.eventLoopLagP99Ms),color:"var(--error-color)"}],"daemon.charts.eventLoop.help"),r("daemon.charts.cpu",xat,[{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",i4,[{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",i4,[{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",Fb,[{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",Fb,[{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 Eat(){var _;const{t:e}=ut(),[t,n]=f.useState("overview"),s=f.useRef([]),r=(B,A)=>{var j;let N;if(B.key==="ArrowRight"||B.key==="ArrowDown")N=(A+1)%y0.length;else if(B.key==="ArrowLeft"||B.key==="ArrowUp")N=(A-1+y0.length)%y0.length;else if(B.key==="Home")N=0;else if(B.key==="End")N=y0.length-1;else return;B.preventDefault(),n(y0[N].id),(j=s.current[N])==null||j.focus()},i=C7({autoLoad:!0,detail:"summary"}),o=C7({autoLoad:!0,detail:"full"}),a=i.reload,c=o.reload,u=f.useRef(!1);f.useEffect(()=>{const B=window.setInterval(()=>{document.hidden||u.current||(u.current=!0,a().finally(()=>{u.current=!1}))},yat);return()=>window.clearInterval(B)},[a]);const d=f.useCallback(()=>{a(),c()},[a,c]),h=i.report??o.report,m=o.report,p=i.loading||o.loading,g=i.error??o.error;if(!h)return l.jsx("div",{className:un.dialog,children:l.jsx("div",{className:un.empty,children:g?`${e("daemon.loadFailed")}: ${g.message}`:e("daemon.loading")})});const b=m??h,{daemon:v,runtime:x,security:y,limits:w,capabilities:k}=h,T=x.transport.acp,S=Object.values(x.rateLimit.rejectedSinceStart).reduce((B,A)=>B+A,0),C=B=>B===null?e("daemon.limits.unlimited"):B;return l.jsxs("div",{className:un.dialog,children:[l.jsxs("div",{className:un.toolbar,children:[l.jsx("span",{role:"status","aria-label":`${e("daemon.title")}: ${e(`daemon.level.${b.status}`)}`,className:`${un.badge} ${s9(b.status)}`,children:e(`daemon.level.${b.status}`)}),l.jsx("span",{className:un.updatedAt,children:e("daemon.updatedAt",{time:new Date(h.generatedAt).toLocaleTimeString()})}),i.error&&i.report&&l.jsx("span",{className:un.refreshError,children:e("daemon.loadFailed")}),l.jsx("div",{className:un.toolbarActions,children:l.jsx("button",{type:"button",className:un.refreshButton,onClick:d,disabled:p,children:e("daemon.refresh")})})]}),b.issues.length>0&&l.jsx(Fl,{title:e("daemon.issues.title"),children:b.issues.map((B,A)=>l.jsxs("div",{className:un.issueRow,children:[l.jsx("span",{className:`${un.badge} ${B.severity==="error"?un.levelError:un.levelWarning}`,children:B.severity==="error"?e("daemon.level.error"):e("daemon.level.warning")}),l.jsx("span",{className:un.issueMessage,children:B.message})]},`${B.code}-${A}`))}),l.jsx("div",{className:un.tabs,role:"tablist","aria-label":e("daemon.title"),children:y0.map((B,A)=>l.jsx("button",{ref:N=>{s.current[A]=N},type:"button",role:"tab",id:`daemon-tab-${B.id}`,"aria-selected":B.id===t,"aria-controls":`daemon-tabpanel-${B.id}`,tabIndex:B.id===t?0:-1,className:`${un.tab} ${B.id===t?un.tabActive:""}`,onClick:()=>n(B.id),onKeyDown:N=>r(N,A),children:e(B.labelKey)},B.id))}),t==="overview"&&l.jsxs("div",{role:"tabpanel",id:"daemon-tabpanel-overview","aria-labelledby":"daemon-tab-overview",tabIndex:0,className:un.grid,children:[l.jsxs(Fl,{title:e("daemon.overview.title"),children:[v.qwenCodeVersion&&l.jsx(ir,{label:e("daemon.overview.version"),value:v.qwenCodeVersion}),l.jsx(ir,{label:e("daemon.overview.pid"),value:v.pid}),l.jsx(ir,{label:e("daemon.overview.mode"),value:v.mode}),l.jsx(ir,{label:e("daemon.overview.uptime"),value:Lie(v.uptimeMs)}),l.jsxs("div",{className:un.pathRow,children:[l.jsx("span",{className:un.rowLabel,children:e("daemon.overview.workspace")}),l.jsx("span",{className:un.pathValue,title:v.workspaceCwd,children:l.jsx("bdi",{children:v.workspaceCwd})})]})]}),l.jsxs(Fl,{title:e("daemon.runtime.title"),children:[x.error?l.jsxs("div",{className:un.workspaceError,children:[e("daemon.runtime.startFailed"),": ",x.error]}):x.loading?l.jsx("div",{className:un.empty,children:e("daemon.runtime.startingUp")}):null,l.jsx(ir,{label:e("daemon.runtime.activeSessions"),value:x.sessions.active}),x.activity&&l.jsxs(l.Fragment,{children:[l.jsx(ir,{label:e("daemon.runtime.activePrompts"),value:x.activity.activePrompts}),l.jsx(ir,{label:e("daemon.runtime.idle"),value:x.activity.idleSinceMs===null?e("daemon.runtime.noActivity"):Zh(x.activity.idleSinceMs)})]}),l.jsx(ir,{label:e("daemon.runtime.pendingPermissions"),value:x.permissions.pending}),l.jsx(ir,{label:e("daemon.runtime.permissionPolicy"),value:x.permissions.policy}),l.jsx(ir,{label:e("daemon.runtime.channel"),value:x.channel.live?e("daemon.runtime.channelLive"):e("daemon.runtime.channelDown")}),x.channelWorker.enabled&&l.jsxs(l.Fragment,{children:[l.jsx(ir,{label:e("daemon.runtime.channelWorker"),value:vat(x.channelWorker)}),x.channelWorker.error&&l.jsx("div",{className:un.workspaceError,children:x.channelWorker.error}),(x.channelWorker.restartCount??0)>0&&l.jsx(ir,{label:e("daemon.runtime.channelWorkerRestarts"),value:x.channelWorker.restartCount})]}),l.jsx(ir,{label:e("daemon.runtime.memory"),value:`${i4(x.process.rss)} / ${i4(x.process.heapUsed)}`})]}),l.jsxs(Fl,{title:e("daemon.transport.title"),children:[l.jsx(ir,{label:e("daemon.transport.restSse"),value:x.transport.restSseActive}),T.enabled?l.jsxs(l.Fragment,{children:[l.jsx(ir,{label:e("daemon.transport.acpConnections"),value:T.connections}),l.jsx(ir,{label:e("daemon.transport.acpStreams"),value:`${T.sessionStreams} / ${T.sseStreams} / ${T.wsStreams}`}),l.jsx(ir,{label:e("daemon.transport.pendingRequests"),value:T.pendingClientRequests})]}):l.jsx("div",{className:un.empty,children:e("daemon.transport.acpDisabled")}),l.jsx(ir,{label:e("daemon.transport.rateLimitRejected"),value:x.rateLimit.enabled?S:e("common.disabled")})]}),l.jsxs(Fl,{title:e("daemon.security.title"),children:[l.jsx(ir,{label:e("daemon.security.token"),value:y.tokenConfigured?e("daemon.security.configured"):e("daemon.security.notConfigured")}),l.jsx(ir,{label:e("daemon.security.requireAuth"),value:y.requireAuth?e("common.enabled"):e("common.disabled")}),l.jsx(ir,{label:e("daemon.security.loopback"),value:y.loopbackBind?e("common.enabled"):e("common.disabled")}),l.jsx(ir,{label:e("daemon.security.allowOrigin"),value:y.allowOriginMode}),l.jsx(ir,{label:e("daemon.security.shell"),value:y.sessionShellCommandEnabled?e("common.enabled"):e("common.disabled")})]}),l.jsxs(Fl,{title:e("daemon.limits.title"),children:[l.jsx(ir,{label:e("daemon.limits.maxSessions"),value:C(w.maxSessions)}),l.jsx(ir,{label:e("daemon.limits.maxPendingPrompts"),value:C(w.maxPendingPromptsPerSession)}),l.jsx(ir,{label:e("daemon.limits.maxConnections"),value:C(w.listenerMaxConnections)}),l.jsx(ir,{label:e("daemon.limits.eventRing"),value:w.eventRingSize}),l.jsx(ir,{label:e("daemon.limits.promptDeadline"),value:w.promptDeadlineMs===null?e("daemon.limits.unlimited"):Zh(w.promptDeadlineMs)}),l.jsx(ir,{label:e("daemon.limits.sessionIdle"),value:Zh(w.sessionIdleTimeoutMs)})]}),l.jsx(Fl,{title:k.features.length?e("daemon.capabilities.titleCount",{count:k.features.length}):e("daemon.capabilities.title"),children:k.features.length===0?l.jsx("span",{className:un.empty,children:e("daemon.none")}):l.jsx("div",{className:un.featureChips,children:[...k.features].sort().map(B=>l.jsx("span",{className:un.featureChip,children:B},B))})})]}),t==="usage"&&l.jsx("div",{role:"tabpanel",id:"daemon-tabpanel-usage","aria-labelledby":"daemon-tab-usage",tabIndex:0,children:l.jsx(zd,{label:"daemon-usage",fallback:l.jsx("div",{className:un.empty,children:e("daemon.usage.failed")}),children:l.jsx(Cot,{})})}),t==="metrics"&&l.jsx("div",{role:"tabpanel",id:"daemon-tabpanel-metrics","aria-labelledby":"daemon-tab-metrics",tabIndex:0,children:l.jsx(Tat,{series:((_=h.runtime.metrics)==null?void 0:_.series)??[]})}),t==="diagnostics"&&l.jsx("div",{role:"tabpanel",id:"daemon-tabpanel-diagnostics","aria-labelledby":"daemon-tab-diagnostics",tabIndex:0,children:l.jsx(zd,{label:"daemon-status-detail",fallback:l.jsx("div",{className:un.empty,children:e("daemon.details.failed")}),children:m!=null&&m.full?l.jsx(Cat,{report:m}):o.loading?l.jsx("div",{className:un.empty,children:e("daemon.details.loading")}):o.error?l.jsxs("div",{className:un.empty,children:[e("daemon.details.failed"),": ",o.error.message]}):l.jsx("div",{className:un.empty,children:e("daemon.details.failed")})})})]})}function Aat(){const{t:e}=ut();return l.jsx(zd,{label:"daemon-status",fallback:t=>l.jsx("div",{className:un.dialog,children:l.jsxs("div",{className:un.empty,children:[e("daemon.loadFailed"),": ",t.message]})}),children:l.jsx(Eat,{})})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Pie="split",mf=6;function Nat(e,t,n){const s=new URL(t);return s.pathname="/",s.searchParams.set(Pie,e.join(",")),n&&(s.hash=new URLSearchParams({token:n}).toString()),s.toString()}function jat(e){const t=new URLSearchParams(e).get(Pie);return t?t.split(",").map(n=>n.trim()).filter(Boolean):[]}const MI="qwen-webshell-split-sessions";function Mat(e){const t=Array.from(new Set(e.filter(Boolean))).slice(0,mf);try{sessionStorage.setItem(MI,JSON.stringify(t))}catch{}}function Iat(){try{const e=sessionStorage.getItem(MI);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?Array.from(new Set(t.filter(n=>typeof n=="string"&&n.length>0))).slice(0,mf):[]}catch{return[]}}function Rat(){try{sessionStorage.removeItem(MI)}catch{}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function u1(e){return e.split(/[\\/]+/).filter(Boolean).at(-1)??e}function II(e){var t;return(((t=e==null?void 0:e.workspaces)==null?void 0:t.length)??0)>1}function Dat(e,t){return!!e&&!!t&&e!==t}function Oie(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 Qk=[];function Bie(e=!0){var c;const t=dc(),n=t.client,s=e?(((c=t.capabilities)==null?void 0:c.workspaces)??[]).filter(u=>!u.primary&&u.trusted).map(u=>u.cwd).join(`
`):"",[r,i]=f.useState(Qk),o=f.useCallback(async()=>{const u=s?s.split(`
`):[];if(u.length===0)return Qk;const d=await Promise.allSettled(u.map(m=>n.listWorkspaceSessions(m,{pageSize:cd,archiveState:"active",sourceType:r4}))),h=[];return d.forEach((m,p)=>{m.status==="fulfilled"?h.push(...m.value):console.warn(`[useOtherWorkspaceSessions] failed to list sessions for ${u[p]}:`,m.reason)}),h.length===0?Qk:h},[n,s]),a=f.useCallback(async()=>{s&&i(await o())},[s,o]);return f.useEffect(()=>{if(!s){i(d=>d.length===0?d:Qk);return}let u=!1;return o().then(d=>{u||i(d)}),()=>{u=!0}},[s,o]),{sessions:r,reload:a}}function Lat(){if(typeof window>"u")return"";const e=new URLSearchParams(window.location.search).get("daemon")||"";return e?zat(e):""}let dy;const Pat="qwen-daemon-auth",Oat=2500;function $ie(){return dy||(typeof window>"u"?void 0:(dy=new URLSearchParams(window.location.hash.replace(/^#/,"")).get("token")||new URLSearchParams(window.location.search).get("token")||void 0,dy))}function Bat(e=Oat){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),dy=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)!==Pat)return;const c=typeof a.token=="string"?a.token:"";s(c.trim()||void 0)},i=setTimeout(()=>s(void 0),e);window.addEventListener("message",r)})}function $at(){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 zat(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 Fat="_panel_1s6rs_1",qat="_toolbar_1s6rs_9",Hat="_count_1s6rs_16",Uat="_selectAll_1s6rs_21",Vat="_actionButton_1s6rs_30",Wat="_refreshButton_1s6rs_50",Gat="_notice_1s6rs_61",Kat="_grid_1s6rs_71",Yat="_card_1s6rs_80",Xat="_cardCurrent_1s6rs_91",Qat="_cardTop_1s6rs_96",Jat="_cardCheckbox_1s6rs_103",Zat="_colorDot_1s6rs_108",elt="_cardLabel_1s6rs_115",tlt="_currentBadge_1s6rs_135",nlt="_cardMeta_1s6rs_145",slt="_metaItem_1s6rs_153",rlt="_statusBadge_1s6rs_162",ilt="_statusApproval_1s6rs_172",olt="_statusRunning_1s6rs_181",alt="_statusIdle_1s6rs_190",llt="_workspaceBadge_1s6rs_202",clt="_workspaceBadgeOther_1s6rs_218",ult="_empty_1s6rs_223",dlt="_colorRed_1s6rs_231",hlt="_colorOrange_1s6rs_234",flt="_colorYellow_1s6rs_237",mlt="_colorGreen_1s6rs_240",plt="_colorBlue_1s6rs_243",glt="_colorPurple_1s6rs_246",Cs={panel:Fat,toolbar:qat,count:Hat,selectAll:Uat,actionButton:Vat,refreshButton:Wat,notice:Gat,grid:Kat,card:Yat,cardCurrent:Xat,cardTop:Qat,cardCheckbox:Jat,colorDot:Zat,cardLabel:elt,currentBadge:tlt,cardMeta:nlt,metaItem:slt,statusBadge:rlt,statusApproval:ilt,statusRunning:olt,statusIdle:alt,workspaceBadge:llt,workspaceBadgeOther:clt,empty:ult,colorRed:dlt,colorOrange:hlt,colorYellow:flt,colorGreen:mlt,colorBlue:plt,colorPurple:glt},blt=3e3,ylt=1e4,Lq={needsApproval:0,running:1,idle:2};function xlt(e,t,n,s){const r=new Map(t.map(o=>[o.sessionId,o])),i=e.map(o=>{var d,h;const a=r.get(o.sessionId),c=o.hasActivePrompt??(a==null?void 0:a.hasActivePrompt)??!1,u=((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:u?"needsApproval":c?"running":"idle",clientCount:o.clientCount??(a==null?void 0:a.clientCount)??0,model:(h=a==null?void 0:a.currentModelId)!=null&&h.startsWith("qwen-route:")?void 0:a!=null&&a.currentModelId?Yh(a.currentModelId):void 0,updatedAt:o.updatedAt||o.createdAt,color:o.color,isCurrent:o.sessionId===n,workspaceCwd:o.workspaceCwd,isNonPrimary:Dat(o.workspaceCwd,s)}});return i.sort((o,a)=>{const c=Lq[o.status]-Lq[a.status];return c!==0?c:(a.updatedAt??"").localeCompare(o.updatedAt??"")}),i}function Jk(...e){return e.filter(Boolean).join(" ")}function vlt(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 Pq(e){switch(e){case"needsApproval":return Cs.statusApproval;case"running":return Cs.statusRunning;default:return Cs.statusIdle}}function wlt({onOpenSession:e,onOpenSplit:t,includeOtherWorkspaces:n,workspaceCwd:s}){var I,Q,V;const{t:r}=ut(),i=Cl(),o=i.sessionId,a=((Q=(I=i.capabilities)==null?void 0:I.features)==null?void 0:Q.includes(jI))??!1,{sessions:c,loading:u,error:d,reload:h}=qv(s,{autoLoad:!0,pageSize:cd,archiveState:"active",...a?{view:"organized",group:"all"}:{}}),{sessions:m,reload:p}=Bie(n&&!s),g=f.useMemo(()=>Oie(c,m),[c,m]),b=!s&&n&&II(i.capabilities),v=C7({autoLoad:!0,detail:"full"}),x=v.reload,y=v.report,[w,k]=f.useState(()=>new Set),[T,S]=f.useState(!1),C=f.useRef(!1);f.useEffect(()=>{const M=window.setInterval(()=>{document.hidden||C.current||(C.current=!0,Promise.all([h(),p()]).finally(()=>{C.current=!1}))},blt);return()=>window.clearInterval(M)},[h,p]);const _=f.useRef(!1);f.useEffect(()=>{const M=window.setInterval(()=>{document.hidden||_.current||(_.current=!0,x().finally(()=>{_.current=!1}))},ylt);return()=>window.clearInterval(M)},[x]);const B=(V=i.capabilities)==null?void 0:V.workspaceCwd,A=f.useMemo(()=>{var M;return xlt(g,((M=y==null?void 0:y.full)==null?void 0:M.sessions)??[],o,B)},[g,y,o,B]),N=f.useCallback(M=>{k(re=>{const se=new Set(re);return se.has(M)?se.delete(M):se.add(M),se})},[]),j=A.map(M=>M.sessionId).filter(M=>w.has(M)),P=j.length,L=A.length>0&&P===A.length,O=j.slice(0,mf),$=P>mf,z=f.useCallback(()=>{k(M=>{const re=A.map(X=>X.sessionId);return re.length>0&&re.every(X=>M.has(X))?new Set:new Set(re)})},[A]);f.useEffect(()=>{k(M=>{if(M.size===0)return M;const re=new Set(A.map(J=>J.sessionId));let se=!1;const X=new Set;for(const J of M)re.has(J)?X.add(J):se=!0;return se?X:M})},[A]);const F=f.useCallback(()=>{if(O.length===0)return;const M=Nat(O,window.location.href,$ie()),re=window.open(M,"_blank");re&&(re.opener=null,re.focus()),S(!re)},[O]),G=f.useCallback(()=>{h(),p(),x()},[h,p,x]);return A.length===0?l.jsx("div",{className:Cs.panel,children:l.jsx("div",{className:Cs.empty,children:u?r("sessionsOverview.loading"):d?`${r("sessionsOverview.loadFailed")}: ${d.message}`:r("sessionsOverview.empty")})}):l.jsxs("div",{className:Cs.panel,children:[l.jsxs("div",{className:Cs.toolbar,children:[l.jsx("span",{className:Cs.count,children:r("sessionsOverview.count",{count:A.length})}),l.jsxs("label",{className:Cs.selectAll,children:[l.jsx("input",{type:"checkbox",checked:L,onChange:z}),r("sessionsOverview.selectAll")]}),l.jsx("button",{type:"button",className:Cs.actionButton,disabled:P===0,onClick:F,title:r("sessionsOverview.openInTabHint"),children:r("sessionsOverview.openInTab")}),t&&l.jsx("button",{type:"button",className:Cs.actionButton,disabled:P===0,onClick:()=>t(O),title:r("sessionsOverview.openInSplitHint"),children:r("sessionsOverview.openInSplit")}),l.jsx("button",{type:"button",className:Cs.refreshButton,onClick:G,children:r("sessionsOverview.refresh")})]}),$&&l.jsx("div",{className:Cs.notice,role:"status",children:r("sessionsOverview.splitCap",{max:mf})}),T&&l.jsx("div",{className:Cs.notice,role:"alert",children:r("sessionsOverview.popupBlocked")}),d&&l.jsxs("div",{className:Cs.notice,role:"alert",children:[r("sessionsOverview.loadFailed"),": ",d.message]}),l.jsx("ul",{className:Cs.grid,children:A.map(M=>l.jsxs("li",{className:Jk(Cs.card,Pq(M.status),M.isCurrent&&Cs.cardCurrent),children:[l.jsxs("div",{className:Cs.cardTop,children:[l.jsx("input",{type:"checkbox",className:Cs.cardCheckbox,checked:w.has(M.sessionId),onChange:()=>N(M.sessionId),"aria-label":r("sessionsOverview.selectSession",{name:M.label})}),M.color&&l.jsx("span",{className:Jk(Cs.colorDot,vlt(M.color)),"aria-hidden":"true"}),l.jsx("button",{type:"button",className:Cs.cardLabel,onClick:()=>e(M.sessionId),title:M.label,children:M.label}),M.isCurrent&&l.jsx("span",{className:Cs.currentBadge,children:r("sessionsOverview.current")})]}),l.jsxs("div",{className:Cs.cardMeta,children:[l.jsx("span",{className:Jk(Cs.statusBadge,Pq(M.status)),children:r(`sessionsOverview.status.${M.status}`)}),b&&l.jsx("span",{className:Jk(Cs.workspaceBadge,M.isNonPrimary&&Cs.workspaceBadgeOther),title:M.workspaceCwd,children:u1(M.workspaceCwd)}),M.model&&l.jsx("span",{className:Cs.metaItem,title:M.model,children:M.model}),M.clientCount>0&&l.jsx("span",{className:Cs.metaItem,title:r("sessionsOverview.openElsewhere"),children:r("common.clients",{count:M.clientCount})}),M.updatedAt&&l.jsx("span",{className:Cs.metaItem,children:s4(M.updatedAt,r)})]})]},M.sessionId))})]})}function klt({onOpenSession:e,onOpenSplit:t,includeOtherWorkspaces:n=!0,workspaceCwd:s}){const{t:r}=ut();return l.jsx(zd,{label:"session-overview",fallback:i=>l.jsx("div",{className:Cs.panel,children:l.jsxs("div",{className:Cs.empty,children:[r("sessionsOverview.loadFailed"),": ",i.message]})}),children:l.jsx(wlt,{onOpenSession:e,onOpenSplit:t,includeOtherWorkspaces:n,workspaceCwd:s})})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function _lt(e){return e.startsWith("language_changed (unrecognized daemon event):")||e.startsWith("Model switched: ")}function Slt(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 Clt(e,t){return e===void 0?{}:t?{data:{...Uo(e)??{value:e},errorKind:t}}:{data:e}}function Tlt(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 Elt(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 Alt(e){const n=e.meta;return(n==null?void 0:n.source)==="background_notification"&&n.qwenDiscreteMessage===!0&&n.backgroundTask!==void 0}function Nlt(e){return Alt(e)||!e.text&&!e.usage?null:e}function Oq(e){return e.text.length===0}function jlt(e){const t=e.flatMap((n,s)=>{const r=Uo(n),i=la(r,"content");return i?[{id:la(r,"id")??`plan-${s}`,content:i,status:Plt(la(r,"status")),...(()=>{const a=Olt(la(r,"priority"));return a?{priority:a}:{}})()}]:[]});return t.length>0?t:void 0}function Bq(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 Mlt(e,t={}){var u,d,h;const n=[],s=((u=t.labels)==null?void 0:u.promptCancelled)??"Request cancelled.",r=new Map,i=new Map;let o=null,a=null,c=!1;for(let m=0;m<e.length;m++){const p=e[m],g=p.serverTimestamp??p.clientReceivedAt;switch(p.kind){case"user":{o=null,a=null,c=!1;const b=p,v=Uo(b.meta),x=la(v,"source"),y=Array.isArray(v==null?void 0:v.inputAnnotations)?v.inputAnnotations:void 0,w={id:p.id,role:"user",content:b.text,timestamp:g,...x?{source:x}:{},...y?{inputAnnotations:y}:{}};b.images&&b.images.length>0&&(w.images=b.images.map(k=>({data:k.data,mimeType:k.mimeType||"image/*"}))),n.push(w);break}case"assistant":{const b=Nlt(p);if(!b)break;const v=b.parentToolCallId?r.get(b.parentToolCallId):void 0;if(v){$q(v,b.text);break}const x=Xlt(b.text);if(x){let w=null,k=!1,T=0,S=0;for(const C of x)C.kind==="insight"?C.data.type==="insight_progress"?w=C.data:C.data.type==="insight_ready"?(k=!0,n.push({id:`${p.id}-ir-${T++}`,role:"insight_ready",path:C.data.path,timestamp:g})):C.data.type==="insight_error"&&(k=!0,n.push({id:`${p.id}-ie-${S++}`,role:"insight_error",error:C.data.error,timestamp:g})):(n.push({id:`${p.id}-t-${n.length}`,role:"assistant",content:C.text,timestamp:g}),o=n.length-1,a=null);w&&!k&&n.push({id:`${p.id}-ip`,role:"insight_progress",stage:w.stage,progress:w.progress,detail:w.detail,timestamp:g}),c=!0;break}const y=o!==null?n[o]:void 0;if(y&&y.role==="assistant"&&!c&&!Oq(b)){const w=Bq(y.usage,b.usage);n[o]={...y,content:y.content+b.text,isStreaming:b.streaming,...w?{usage:w}:{}},c=!1,a=null}else if(!Oq(b))n.push({id:p.id,role:"assistant",content:b.text,isStreaming:b.streaming,timestamp:g,...b.usage?{usage:b.usage}:{}}),o=n.length-1,a=null,c=!1;else if(b.usage&&y&&y.role==="assistant"){const w=Bq(y.usage,b.usage);n[o]={...y,...w?{usage:w}:{}}}break}case"thought":{const b=p,v=b.parentToolCallId?r.get(b.parentToolCallId):void 0;if(v){$q(v,b.text);break}const x=a!==null?n[a]:void 0;x&&x.role==="thinking"&&!c?(n[a]={...x,content:x.content+b.text,isStreaming:b.streaming},c=!1):(n.push({id:p.id,role:"thinking",content:b.text,isStreaming:b.streaming,timestamp:g}),a=n.length-1,c=!1),o=null;break}case"tool":{const v=Blt(p),x=i.get(v.callId);x!=null&&x.title&&(v.title=x.title),!v.args&&(x!=null&&x.args)&&(v.args=x.args);const y=v.parentToolCallId?r.get(v.parentToolCallId):void 0,w=r.get(v.callId);if(w){zq(w,v);break}if(y){Ilt(y,v),r.set(v.callId,v);break}X6(n,p.id,v,g),r.set(v.callId,v),o=null,a=null,c=!0;break}case"shell":{const b=p,v=n[n.length-1];if(v&&v.role==="tool_group"){const x=Rlt(v.tools),y=v.tools[x];if(y){const w=typeof y.rawOutput=="string"?y.rawOutput:"",k={...y,rawOutput:w+b.text};n[n.length-1]={...v,tools:[...v.tools.slice(0,x),k,...v.tools.slice(x+1)]},r.get(y.callId)===y&&r.set(y.callId,k)}}else n.push({id:p.id,role:"tool_group",tools:[{callId:p.id,toolName:"shell",status:"completed",kind:"execute",rawOutput:b.text}],timestamp:g}),c=!0;break}case"user_shell":{const b=p;n.push({id:p.id,role:"user_shell",command:b.command,output:b.text,...b.cwd?{cwd:b.cwd}:{},timestamp:g}),c=!0;break}case"permission":{const b=p;zlt(b,i);const v=$lt(b);if(!v)break;const x=zie(v);if(!b.resolved)break;const y=r.get(v.callId);if(y){const w=y.status;v.toolName=y.toolName,b.resolved&&(Q6(b.resolved)?v.status=x?v.status:"in_progress":(v.status="failed",v.endTime=b.updatedAt)),zq(y,v),b.resolved&&x&&Q6(b.resolved)&&(y.status=w);break}if(b.resolved){Q6(b.resolved)?(x||(v.status="in_progress"),X6(n,p.id,v,g),r.set(v.callId,v),c=!0):(v.status="failed",v.endTime=b.updatedAt,X6(n,p.id,v,g),r.set(v.callId,v),c=!0);break}break}case"status":case"debug":{const b=p,v=b.source==="session_branched"?Tlt(b.data):null,x=b.source==="mid_turn_message_injected"?Elt(b.data):null,y=v&&((d=t.labels)!=null&&d.branchSuccess)?t.labels.branchSuccess(v):x&&((h=t.labels)!=null&&h.midTurnInserted)?t.labels.midTurnInserted(x):b.text;if(_lt(y))break;const w=Llt(y);if(w){n.push({id:p.id,role:"plan",todos:w,timestamp:g}),c=!0;break}n.push({id:p.id,role:"system",content:y,variant:"info",timestamp:g,...b.source?{source:b.source}:{},...b.data!==void 0?{data:b.data}:{}}),c=!0;break}case"error":{const b=p,v=b.errorKind;n.push({id:p.id,role:"system",content:Slt(b,t.labels),variant:"error",retryable:b.source==="turn_error",timestamp:g,...b.source?{source:b.source}:{},...Clt(b.data,v)}),c=!0;break}case"prompt_cancelled":n.push({id:p.id,role:"system",content:s,variant:"info",source:"prompt_cancelled",timestamp:g}),c=!0;break}}return n}function Ilt(e,t){e.subTools||(e.subTools=[]),e.subTools.push(t)}function $q(e,t){e.subContent=(e.subContent||"")+t}function X6(e,t,n,s){const r=o=>zie(o)||sh(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 Rlt(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 zq(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 zie(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||e.subTools||e.subContent||Dlt(e.rawOutput)?!0:!!((n=e.args)!=null&&n.subagent_type)}function Dlt(e){return!!e&&typeof e=="object"&&e.type==="task_execution"}function Llt(e){const t=e.startsWith("plan: ")?e.slice(6):void 0;if(t)try{const n=JSON.parse(t),s=Uo(n);return(s==null?void 0:s.sessionUpdate)!=="plan"||!Array.isArray(s.entries)?void 0:jlt(s.entries)}catch{return}}function Uo(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function la(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function Plt(e){return e==="completed"||e==="in_progress"||e==="pending"?e:"pending"}function Olt(e){return e==="high"||e==="medium"||e==="low"?e:void 0}function Blt(e){const t=qlt(e),n=Flt(e,t),s=Hlt(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:qie(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 $lt(e){const t=Uo(e.toolCall);if(!t)return;const n=Fie(t);if(Array.isArray(n==null?void 0:n.questions))return;const s=Uo(t._meta),r=la(t,"kind"),i=la(s,"toolName")??la(t,"toolName")??la(t,"name")??(n!=null&&n.subagent_type?"agent":void 0)??(r==="fetch"?"web_fetch":r),o=la(t,"toolCallId")??la(t,"id");return!o||!i?void 0:{callId:o,toolName:i,title:la(t,"title")??e.title,status:"pending",kind:qie(i,r),args:n,startTime:e.createdAt}}function zlt(e,t){const n=Uo(e.toolCall),s=la(n,"toolCallId")??la(n,"id");if(!s)return;const r=la(n,"title")??e.title,i=n?Fie(n):void 0;Array.isArray(i==null?void 0:i.questions)&&t.set(s,{...r?{title:r}:{},...i?{args:i}:{}})}function Q6(e){const[t="",n=""]=e.toLowerCase().split(":",2);return Fq(t)?!0:t!=="selected"?!1:Fq(n.trim())}function Fq(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 Fie(e){return Uo(e.rawInput)??Uo(e.input)??Uo(e.args)}function Flt(e,t){var r;const n=(r=e.toolName)==null?void 0:r.toLowerCase();if(n!=="agent"&&n!=="task")return!1;const s=Uo(t);return(s==null?void 0:s.status)==="background"}function qlt(e){return Ult(e)&&e.status==="failed"?Vlt(e)??e.details??e.rawOutput:!Wlt(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 Hlt(e){if(!Array.isArray(e))return;const t=e.flatMap(n=>{const s=Uo(n);if(!s)return[];const r=s.type;if(r==="content"){const i=Uo(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 Ult(e){if(!e.toolName)return!1;const t=e.toolName.toLowerCase();return t==="ask_user_question"||t==="askuserquestion"}function Vlt(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 Wlt(e){return e==="cancelled"||e==="canceled"}const Glt=['"insight_progress":','"insight_ready":','"insight_error":'];function Klt(e){try{const t=JSON.parse(e),n=Uo(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=Uo(t.insight_ready);if(s&&typeof s.path=="string")return{type:"insight_ready",path:s.path};const r=Uo(t.insight_error);if(r&&typeof r.error=="string")return{type:"insight_error",error:r.error}}catch{}return null}function Ylt(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 Xlt(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(!Glt.some(m=>a.startsWith(m))){s=o+1;continue}const u=Ylt(e,o);if(!u){s=o+1;continue}const d=Klt(u);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+u.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 qie(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 Qlt(e,t){return Mlt(e,{labels:{promptCancelled:t("request.cancelled"),branchSuccess:n=>t("branch.success",{name:n}),midTurnInserted:n=>t("midTurn.inserted",{message:n}),modelStreamInterrupted:t("error.modelStreamInterrupted")}})}function Hie(e){const t=mv();return f.useMemo(()=>Qlt(t,e),[t,e])}const Jlt="session_artifacts";function Uie(){var T,S;const e=x1(),t=Cl(),n=TG(),s=Kd(),r=s==null?void 0:s.artifactsVersion,i=t.status==="connected",o=((S=(T=t.capabilities)==null?void 0:T.features)==null?void 0:S.includes(Jlt))??!1,a=t.sessionId,[c,u]=f.useState([]),[d,h]=f.useState(!1),[m,p]=f.useState(null),g=f.useRef(0),b=f.useRef(void 0),v=f.useRef(n),x=f.useRef(r),y=f.useCallback(async()=>{const C=g.current+1;if(g.current=C,!a){b.current=void 0,u([]),p(null),h(!1);return}if(!i){b.current=void 0,u([]),p(null),h(!1);return}if(!o){b.current=void 0,u([]),p(null),h(!1);return}b.current!==void 0&&b.current!==a&&u([]),h(!0);try{const _=await e.loadArtifacts();if(g.current!==C)return;b.current=a,u(_.artifacts),p(null)}catch(_){if(g.current!==C)return;if(Zlt(_)){p(null);return}p(_ instanceof Error?_.message:String(_))}finally{g.current===C&&h(!1)}},[e,i,a,o]),w=f.useRef(y);w.current=y,f.useEffect(()=>{y()},[y]),f.useEffect(()=>{const C=v.current;v.current=n,C!=="idle"&&n==="idle"&&w.current()},[n]),f.useEffect(()=>{const C=x.current;x.current=r,C!==void 0&&r!==void 0&&r!==C&&w.current()},[r]);const k=f.useMemo(()=>new Map(c.map(C=>[C.id,C])),[c]);return{artifacts:c,artifactById:k,loading:d,error:m,refresh:y}}function Zlt(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 ect(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 c=r.findIndex(u=>u.text===a&&(!u.images||u.images.length===0));c>=0&&(r.splice(c,1),i=!0)}return i?r:null}function tct(e,t,n,s){return e?!0:(s.append(t),!1)}function Vie(e){const t=e.trimStart();return t.startsWith("/")||t.startsWith("!")}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const nct=100;function sct(e,t){return e.trim()?e===t||e.startsWith(`${t}
`)?e:`${t}
${e}`:t}function qq(e,t){return e.length!==t.length?!1:e.every((n,s)=>{var i,o,a,c;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)===(((c=r.inputAnnotations)==null?void 0:c.length)??0)})}function Hq(e){if(!(!e||e.length===0))return e.map(t=>({data:t.data,mimeType:t.media_type||"image/*"}))}function Wie({connected:e,sessionId:t,clientId:n,streamingState:s,sessionActions:r,store:i,editorRef:o,reportError:a,notifySuccess:c,t:u}){const[d,h]=f.useState([]),m=f.useRef([]),p=f.useRef(1),g=f.useRef(t),b=f.useRef(null),v=f.useRef(new Set),x=f.useRef(new Set),y=f.useRef(new Set),w=f.useRef(new Map),k=f.useRef(new Set),T=f.useRef([]),S=f.useRef(s),C=f.useRef(0);g.current=t,S.current=s;const _=f.useMemo(()=>d.map(W=>W.text),[d]);f.useEffect(()=>{m.current=d},[d]),f.useEffect(()=>{var W;m.current=[],h([]),w.current.clear(),k.current.clear(),T.current=[];for(const te of v.current)te.abort();v.current.clear(),x.current.clear(),y.current.clear(),O.current=void 0,(W=b.current)==null||W.abort(),b.current=null},[t]);const B=f.useCallback((W,te)=>{const U=m.current.filter(ee=>ee.serverPromptId?W.some(oe=>oe.promptId===ee.serverPromptId):!0);for(const ee of W){if(x.current.has(ee.promptId))continue;const oe=U.findIndex(ye=>ye.serverPromptId===ee.promptId),Ce=y.current.has(ee.promptId);if(oe!==-1){if(Ce){U.splice(oe,1);continue}U[oe]={...U[oe],text:ee.text,serverState:ee.state};continue}const he=U.filter(ye=>!ye.serverPromptId&&ye.serverState==="submitting"&&ye.text===ee.text);if(he.length===1){const ye=U.indexOf(he[0]);if(Ce){U.splice(ye,1);continue}U[ye]={...he[0],serverPromptId:ee.promptId,serverState:ee.state};continue}ee.state==="running"||Ce||U.push({id:p.current++,sessionId:te,text:ee.text,serverPromptId:ee.promptId,serverState:ee.state})}qq(m.current,U)||(m.current=U,h(U))},[]),A=f.useCallback(async(W=t)=>{if(!e||!W||g.current!==W)return"skipped";const te=++C.current;try{const U=await r.getPendingPrompts({sessionId:W});return te!==C.current?"superseded":g.current!==W?"skipped":(B(U.pendingPrompts.filter(ee=>ee.state==="queued"||ee.state==="running"),W),"refreshed")}catch(U){return console.warn("Failed to refresh pending prompts",U),"failed"}},[e,r,t,B]),N=f.useCallback(W=>{const te=g.current,U=W.filter(he=>he.sessionId===void 0||he.sessionId===te);if(U.length===0)return;const ee=new Set(m.current.map(he=>he.id)),oe=U.filter(he=>!ee.has(he.id));if(oe.length===0)return;const Ce=[...m.current,...oe].sort((he,ye)=>he.id-ye.id);m.current=Ce,h(Ce)},[]),j=f.useCallback((W,te,U)=>{var Ce,he,ye,Ve;if(U!==void 0&&g.current!==U)return;const ee=((Ce=o.current)==null?void 0:Ce.getText())??"",oe=sct(ee,W);oe!==ee&&((he=o.current)==null||he.setText(oe),te&&te.length>0&&((ye=o.current)==null||ye.restoreImages(te))),(Ve=o.current)==null||Ve.focus()},[o]),P=f.useSyncExternalStore(Rfe,Ife),L=f.useRef(P),O=f.useRef(void 0);f.useEffect(()=>{if(!e||!t)return;const W=L.current!==P;if(L.current=P,!W){if(m.current.length>0||s==="idle"||O.current===t)return;O.current=t}A()},[P,e,t,s,A]);const $=f.useSyncExternalStore(Dfe,sP,sP);f.useEffect(()=>{var te;if(!t||$.length===0)return;const W=[];for(const U of $){if(U.data.sessionId!==t)continue;W.push(U);const ee=U.data.promptId;if(ee){if(U.type==="pending_prompt_started"){if(x.current.has(ee))continue;if((U.originatorClientId===void 0||U.originatorClientId===n)&&!y.current.has(ee)){const Ce=typeof U.data.text=="string"?U.data.text:"",he=m.current.find(Ve=>Ve.serverPromptId===ee)??m.current.find(Ve=>!Ve.serverPromptId&&Ve.serverState==="submitting"&&Ve.text===Ce),ye=(he==null?void 0:he.text)??"";ye&&(y.current.add(ee),i.appendLocalUserMessage(ye,Hq(he==null?void 0:he.images),(te=he==null?void 0:he.inputAnnotations)!=null&&te.length?{inputAnnotations:he.inputAnnotations}:void 0))}A()}else if(U.type==="turn_complete"){y.current.delete(ee);const oe=w.current.get(ee);if(w.current.delete(ee),oe)oe();else if(!k.current.has(ee))for(k.current.add(ee),T.current.push(ee);T.current.length>nct;){const Ce=T.current.shift();Ce&&k.current.delete(Ce)}}else if(U.type==="turn_error"||U.type==="pending_prompt_completed"&&U.data.state==="removed"){y.current.delete(ee);const oe=w.current.get(ee);w.current.delete(ee),oe==null||oe(),k.current.delete(ee),T.current=T.current.filter(Ce=>Ce!==ee)}}}Pfe(W)},[$,t,n,i,A]);const z=f.useCallback((W,te)=>{if(k.current.delete(W)){T.current=T.current.filter(U=>U!==W),te();return}w.current.set(W,te)},[]),F=f.useCallback((W,te,U,ee)=>{const oe=W.trim();if(!oe)return!0;const Ce=p.current++,he=g.current,ye=new AbortController;v.current.add(ye);const Ve=te?[...te]:void 0,it=ee?[...ee]:void 0,At={id:Ce,sessionId:he,text:oe,images:Ve,inputAnnotations:it,onComplete:U,serverState:"submitting"};return m.current=[...m.current,At],h(m.current),r.submitPrompt(oe,{images:te,inputAnnotations:it,optimisticUserMessage:!1,sessionId:he,signal:ye.signal}).then(Ee=>{if(v.current.delete(ye),g.current!==he){r.removePendingPrompt(Ee.promptId,{sessionId:he}).catch(qe=>{console.warn("[useQueuedPrompts] cleanup removePendingPrompt failed after session change",{targetSessionId:he,promptId:Ee.promptId,error:qe})});return}if(S.current==="idle"){y.current.has(Ee.promptId)||(y.current.add(Ee.promptId),i.appendLocalUserMessage(oe,Hq(Ve),it!=null&&it.length?{inputAnnotations:it}:void 0));const qe=m.current.filter(Ke=>Ke.id!==Ce);m.current=qe,h(qe),U&&z(Ee.promptId,U);return}const me=m.current,bt=me.findIndex(qe=>qe.id===Ce);if(bt===-1){r.removePendingPrompt(Ee.promptId,{sessionId:he}).then(qe=>{qe.removed||A(he)},()=>{A(he)});return}const et=[...me];et[bt]={...et[bt],serverPromptId:Ee.promptId,serverState:"queued"},m.current=et,h(et),U&&z(Ee.promptId,U)}).catch(Ee=>{if(v.current.delete(ye),g.current!==he||!m.current.some(bt=>bt.id===Ce))return;const me=m.current.filter(bt=>bt.id!==Ce);m.current=me,h(me),j(oe,Ve,he),a(Ee,u("queue.queueFailed"))}),!0},[A,a,j,r,z,i,u]);f.useEffect(()=>{if(s!=="idle")return;const W=b.current;W&&(W.abort(),b.current=null)},[s]);const G=f.useCallback(W=>{const te=m.current;if(te.length===0)return null;const U=W===void 0?te.length-1:te.findIndex(Ce=>Ce.id===W);if(U<0)return null;const ee=te[U],oe=te.filter((Ce,he)=>he!==U);return m.current=oe,h(oe),(ee==null?void 0:ee.text)??null},[]),I=f.useCallback((W,te)=>{const U=m.current.map(ee=>ee.id===W?{...ee,...te}:ee);qq(U,m.current)||(m.current=U,h(U))},[]),Q=f.useCallback(async(W,te,U)=>{if(!W.serverPromptId)return!0;if(W.serverState!=="queued"||x.current.has(W.serverPromptId))return!1;const ee=W.sessionId;x.current.add(W.serverPromptId),I(W.id,te);try{const oe=await r.removePendingPrompt(W.serverPromptId,{sessionId:ee});return x.current.delete(W.serverPromptId),oe.removed?(w.current.delete(W.serverPromptId),await A(ee)==="failed"&&(I(W.id,{isEditing:!1,isRemoving:!1}),a(new Error("Queue changed but pending prompts could not refresh"),U)),!0):(I(W.id,{isEditing:!1,isRemoving:!1}),await A(ee),a(new Error("Prompt could not be removed from queue"),U),!1)}catch(oe){return x.current.delete(W.serverPromptId),I(W.id,{isEditing:!1,isRemoving:!1}),await A(ee)!=="refreshed"&&N([W]),a(oe,U),!1}},[A,a,N,r,I]),V=f.useCallback(W=>{const te=m.current.find(U=>U.id===W);if((te==null?void 0:te.serverState)!=="submitting"&&te){if(!te.serverPromptId){const U=m.current.filter(ee=>ee.id!==W);m.current=U,h(U);return}Q(te,{isRemoving:!0},u("queue.deleteFailed"))}},[Q,u]),M=f.useCallback(async W=>{var he;const te=m.current.find(ye=>ye.id===W);if(!te||(((he=te.images)==null?void 0:he.length)??0)>0||te.serverState==="submitting"||te.isEditing||te.isRemoving||Vie(te.text))return;const U=te.serverPromptId?te.onComplete??w.current.get(te.serverPromptId):void 0,ee=()=>{te.serverPromptId&&w.current.delete(te.serverPromptId),U==null||U()};if(te.serverPromptId&&!await Q(te,{isRemoving:!0},u("queue.insertFailed")))return;let oe=b.current;oe||(oe=new AbortController,b.current=oe);let Ce;try{Ce=await r.enqueueMidTurnMessage(te.text,{signal:oe.signal})}catch(ye){te.serverPromptId&&(j(te.text,te.images,te.sessionId),ee()),a(ye,u("queue.insertFailed"));return}if(!Ce.accepted){te.serverPromptId&&(j(te.text,te.images,te.sessionId),ee()),a(new Error("Queued message was not accepted for insertion"),u("queue.insertFailed"));return}if(ee(),!te.serverPromptId){const ye=m.current.filter(Ve=>Ve.id!==W);m.current=ye,h(ye)}c(u("queue.inserted"))},[Q,c,a,j,r,u]),re=f.useCallback(async W=>{const te=m.current.find(ee=>ee.id===W);if(!te||te.serverState==="submitting"||te.isEditing||te.isRemoving)return;if(te.serverPromptId){if(!await Q(te,{isEditing:!0},u("queue.editFailed")))return;j(te.text,te.images,te.sessionId);return}const U=G(W);U&&j(U,te.images,te.sessionId)},[G,Q,j,u]),se=f.useCallback(()=>{const W=m.current;if(W.length===0)return!1;const te=W[W.length-1];if(!te)return!1;if(te.serverState==="submitting"||te.isEditing||te.isRemoving)return!0;if(!te.serverPromptId){const U=G(te.id);return U?(j(U,te.images,te.sessionId),!0):!1}return te.serverState!=="queued"?!1:((async()=>{await Q(te,{isEditing:!0},u("queue.editFailed"))&&j(te.text,te.images,te.sessionId)})().catch(U=>{a(U,u("queue.editFailed"))}),!0)},[G,Q,a,j,u]),X=f.useCallback(()=>{if(m.current.length===0)return!1;const W=g.current,te=m.current.filter(ye=>ye.serverState==="submitting"),U=m.current.filter(ye=>ye.serverState!=="submitting");for(const ye of[...te].reverse())j(ye.text,ye.images,ye.sessionId);for(const ye of v.current)ye.abort();const ee=U.filter(ye=>ye.serverPromptId);if(ee.length===0)return m.current=[],h([]),i.dispatch([{type:"status",text:u("queue.cleared")}]),!0;const oe=new Set(m.current.map(ye=>ye.id)),Ce=new Set(ee.map(ye=>ye.serverPromptId).filter(ye=>!!ye));for(const ye of Ce)x.current.add(ye);const he=m.current.filter(ye=>!oe.has(ye.id)).concat(ee.map(ye=>({...ye,isRemoving:!0})));return m.current=he,h(he),(async()=>{var At;const ye=[];if(await Promise.all(ee.map(async Ee=>{const me=Ee.serverPromptId;try{if((await r.removePendingPrompt(me,{sessionId:Ee.sessionId})).removed){w.current.delete(me);return}ye.push(Ee)}catch{ye.push(Ee)}finally{x.current.delete(me)}})),g.current!==W)return;const Ve=ye.map(Ee=>({...Ee,isRemoving:!1})),it=m.current.filter(Ee=>Ee.serverPromptId?!Ce.has(Ee.serverPromptId):!oe.has(Ee.id)).concat(Ve);if(m.current=it,h(it),ye.length>0){a(new Error("Some prompts could not be removed from queue"),u("queue.deleteFailed")),A((At=ye[0])==null?void 0:At.sessionId);return}i.dispatch([{type:"status",text:u("queue.cleared")}])})(),!0},[A,a,j,i,u,r]),{batches:J,consume:de}=hme();return f.useEffect(()=>{if(!t||J.length===0)return;const W=ect(m.current,J,t,n);W&&(m.current=W,h(W)),de(J.filter(te=>te.sessionId===t))},[J,t,n,de]),{queuedPrompts:d,queuedTexts:_,enqueuePrompt:F,removeQueuedPrompt:V,insertQueuedPrompt:M,editQueuedPrompt:re,editLastQueuedPrompt:se,clearQueuedPrompts:X}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function r9(e){var t;return!((t=e==null?void 0:e.rawInput)!=null&&t.questions)||!Array.isArray(e.rawInput.questions)?!1:e.toolName?Rc(e.toolName):!0}const rct=3e4;function o4(e){return N4.includes(e)}async function ict({sessionActions:e,modelId:t,modeId:n,workspaceCwd:s,onSessionCreated:r,onSessionAllocated:i,getCurrentSessionId:o,warn:a=console.warn}){const c=n&&o4(n)?n:void 0,{sessionId:u}=await e.createSession({workspaceCwd:s,sourceType:r4,...c?{approvalMode:c}:{}});i==null||i(u);let d="prepare new session";try{if(r){d="run onSessionCreated";let p;try{await Promise.race([r(u),new Promise((g,b)=>{p=setTimeout(()=>b(new Error("onSessionCreated timed out")),rct)})])}finally{clearTimeout(p)}}d="verify session identity";const h=o();if(h!==void 0&&h!==u)throw new Error(`Session changed before attach: expected ${u}, found ${h}`);d="attach new session",await e.attachSession(),d="verify attached session";const m=o();if(m!==void 0&&m!==u)throw new Error(`Session changed while attaching: expected ${u}, found ${m}`)}catch(h){a(`[WebShell] failed to ${d}:`,h),await e.releaseSession(u).catch(p=>{a("[WebShell] failed to release unattached session:",p)});const m=o();throw m===void 0||m===u?await e.clearSession().catch(p=>{a("[WebShell] failed to clear unattached session:",p)}):a(`[WebShell] skipping clearSession: expected ${u}, found ${m}`),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 oct=new Set(["coder-model(qwen-oauth)"]);function hy(e){return!oct.has(e.id)}function act({catchingUp:e,pendingApproval:t,isPreparingPrompt:n}){return!!(e||t||n)}function Gie({catchingUp:e,isPreparingPrompt:t,isStreaming:n}){return e?"loading":t||n?"processing":"idle"}function lct(e){switch(Gie(e)){case"loading":return"common.loading";case"processing":return"editor.processing";case"idle":return"editor.placeholder"}}function Kie({connectionStatus:e,hasSession:t,restartSseOnPrompt:n}){return e==="error"?!0:e==="disconnected"&&(!n||!t)}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const i9=["blue","green","purple","orange","yellow","red"];for(const e of i9){if(AI[e])continue;const t=`WorkspaceAccent.module.css is missing a class for the "${e}" accent`;console.error(t)}function cct(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return Math.abs(t)}function uct(e,t){if(!e)return;const s=((t==null?void 0:t.workspaces)??[]).findIndex(i=>i.cwd===e),r=s>=0?s:cct(e);return i9[r%i9.length]}function Yie(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:"diff",description:e("local.diff")},{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 dct={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"},hct={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 Xie(e){return hct[e]}function Qie(e,t){return e.map(n=>{const s=dct[n.name];return!s||n.source&&n.source!=="builtin-command"?n:{...n,description:t(s)}})}function Jie(...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 fct="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",mct="/assets/insert-DmRbh9Rv.svg",pct="/assets/queue-DWpnpFgW.svg",gct="_app_12eko_1",bct="_appChat_12eko_43",yct="_appChatEmpty_12eko_49",xct="_appShell_12eko_54",vct="_chatPane_12eko_62",wct="_artifactResizeHandle_12eko_71",kct="_chatPaneShowingPage_12eko_91",_ct="_fullPage_12eko_97",Sct="_fullPageHeader_12eko_106",Cct="_splitApprovalNotice_12eko_116",Tct="_fullPageBack_12eko_142",Ect="_fullPageTitle_12eko_159",Act="_fullPageBody_12eko_164",Nct="_mobileDrawer_12eko_171",jct="_mobileBackdrop_12eko_175",Mct="_mobileDrawerForced_12eko_182",Ict="_hamburgerButton_12eko_210",Rct="_mobileDrawerOpen_12eko_255",Dct="_hamburgerButtonFloating_12eko_290",Lct="_appWithSidebar_12eko_298",Pct="_themeDark_12eko_334",Oct="_themeLight_12eko_402",Bct="_content_12eko_470",$ct="_contentHasMessages_12eko_478",zct="_missingSessionState_12eko_487",Fct="_missingSessionMessage_12eko_500",qct="_missingSessionButton_12eko_507",Hct="_panelHost_12eko_542",Uct="_panelHeader_12eko_550",Vct="_panelBack_12eko_560",Wct="_panelTitle_12eko_586",Gct="_panelBody_12eko_595",Kct="_chatViewWrap_12eko_607",Yct="_chatViewHidden_12eko_615",Xct="_chatSubtree_12eko_619",Qct="_chatSubtreeHidden_12eko_623",Jct="_footer_12eko_636",Zct="_bottomPanels_12eko_646",eut="_approvalOverlay_12eko_661",tut="_scrollToBottomLayer_12eko_675",nut="_scrollToBottomLayerWithTodos_12eko_686",sut="_scrollToBottomButton_12eko_693",rut="_scrollToBottomIcon_12eko_722",iut="_btwPanel_12eko_728",out="_composer_12eko_735",aut="_composerHeader_12eko_740",lut="_customFooter_12eko_744",cut="_escClearStatus_12eko_750",uut="_composerActionTip_12eko_757",dut="_composerActionTipIcon_12eko_767",hut="_composerActionTipText_12eko_774",fut="_composerActionTipActions_12eko_781",mut="_composerActionTipButton_12eko_787",put="_composerActionTipButtonPrimary_12eko_804",gut="_emptyWelcomeFooter_12eko_823",but="_mobileWelcomeFooterMiddle_12eko_827",yut="_mobileWelcomeGroup_12eko_831",xut="_chatPaneWithMobileComposerBottom_12eko_836",vut="_chatViewWithMobileComposerBottom_12eko_841",wut="_chatViewWithWelcomeMiddle_12eko_854",kut="_footerWithCustomFooter_12eko_854",_ut="_desktopWelcomeFooter_12eko_888",Sut="_queuedPrompts_12eko_897",Cut="_queuedPrompt_12eko_897",Tut="_queuedPromptIcon_12eko_927",Eut="_queuedPromptMaskIcon_12eko_937",Aut="_queuedPromptActionIcon_12eko_938",Nut="_queuedPromptText_12eko_951",jut="_queuedPromptState_12eko_959",Mut="_queuedPromptSpinner_12eko_967",Iut="_queuedPromptActions_12eko_982",Rut="_queuedPromptAction_12eko_938",Dut="_queuedHint_12eko_1027",Mt={app:gct,appChat:bct,appChatEmpty:yct,appShell:xct,chatPane:vct,artifactResizeHandle:wct,chatPaneShowingPage:kct,fullPage:_ct,fullPageHeader:Sct,splitApprovalNotice:Cct,fullPageBack:Tct,fullPageTitle:Ect,fullPageBody:Act,mobileDrawer:Nct,mobileBackdrop:jct,mobileDrawerForced:Mct,hamburgerButton:Ict,mobileDrawerOpen:Rct,hamburgerButtonFloating:Dct,appWithSidebar:Lct,themeDark:Pct,themeLight:Oct,content:Bct,contentHasMessages:$ct,missingSessionState:zct,missingSessionMessage:Fct,missingSessionButton:qct,panelHost:Hct,panelHeader:Uct,panelBack:Vct,panelTitle:Wct,panelBody:Gct,chatViewWrap:Kct,chatViewHidden:Yct,chatSubtree:Xct,chatSubtreeHidden:Qct,footer:Jct,bottomPanels:Zct,approvalOverlay:eut,scrollToBottomLayer:tut,scrollToBottomLayerWithTodos:nut,scrollToBottomButton:sut,scrollToBottomIcon:rut,btwPanel:iut,composer:out,composerHeader:aut,customFooter:lut,escClearStatus:cut,composerActionTip:uut,composerActionTipIcon:dut,composerActionTipText:hut,composerActionTipActions:fut,composerActionTipButton:mut,composerActionTipButtonPrimary:put,emptyWelcomeFooter:gut,mobileWelcomeFooterMiddle:but,mobileWelcomeGroup:yut,chatPaneWithMobileComposerBottom:xut,chatViewWithMobileComposerBottom:vut,chatViewWithWelcomeMiddle:wut,footerWithCustomFooter:kut,desktopWelcomeFooter:_ut,queuedPrompts:Sut,queuedPrompt:Cut,queuedPromptIcon:Tut,queuedPromptMaskIcon:Eut,queuedPromptActionIcon:Aut,queuedPromptText:Nut,queuedPromptState:jut,queuedPromptSpinner:Mut,queuedPromptActions:Iut,queuedPromptAction:Rut,queuedHint:Dut},Uq=240;function Zie({prompts:e,t,onDelete:n,onInsert:s,onEdit:r}){return e.length===0?null:l.jsxs("div",{className:Mt.queuedPrompts,children:[e.map(i=>{var x;const o=i.text.replace(/\s+/g," ").trim(),a=o.length>Uq?`${o.slice(0,Uq)}...`:o,c=((x=i.images)==null?void 0:x.length)??0,u=Vie(i.text),d=i.serverState==="submitting",h=i.serverState==="running",m=i.isRemoving===!0,p=d||h||i.isEditing===!0||m;let g=t("queue.insertTip");p?g=t("queue.submittingDisabled"):u&&(g=t("queue.insertCommandDisabled"));let b=t("queue.editTip");p&&(b=t("queue.submittingDisabled"));const v=t(p?"queue.submittingDisabled":"queue.deleteTip");return l.jsxs("div",{className:Mt.queuedPrompt,children:[l.jsx("span",{className:Mt.queuedPromptIcon,"aria-hidden":"true",children:l.jsx("span",{className:Mt.queuedPromptMaskIcon,style:Kh("--queued-icon-url",pct)})}),l.jsxs("span",{className:Mt.queuedPromptText,children:[a,c>0?` ${t("queue.imageCount",{count:c})}`:"",d||i.isEditing||m?l.jsxs("span",{className:Mt.queuedPromptState,children:[l.jsx("span",{className:Mt.queuedPromptSpinner}),m?t("queue.removing"):i.isEditing?t("queue.editing"):t("queue.submitting")]}):null]}),l.jsxs("span",{className:Mt.queuedPromptActions,children:[c===0&&l.jsxs("button",{type:"button",className:Mt.queuedPromptAction,onClick:()=>s(i.id),disabled:u||p,title:g,children:[l.jsx("span",{className:Mt.queuedPromptActionIcon,style:Kh("--queued-icon-url",mct),"aria-hidden":"true"}),t("queue.insert")]}),l.jsx("button",{type:"button",className:Mt.queuedPromptAction,onClick:()=>n(i.id),disabled:p,"aria-label":t("queue.delete"),title:v,children:l.jsx("span",{className:Mt.queuedPromptActionIcon,style:Kh("--queued-icon-url",fct),"aria-hidden":"true"})}),l.jsx("button",{type:"button",className:Mt.queuedPromptAction,onClick:()=>r(i.id),disabled:p,"aria-label":t("queue.edit"),title:b,children:l.jsx("span",{className:Mt.queuedPromptActionIcon,style:Kh("--queued-icon-url",fie),"aria-hidden":"true"})})]})]},i.id)}),l.jsx("div",{className:Mt.queuedHint,children:t("queue.footer")})]})}const Lut="_approval_5nswb_1",Put="_floating_5nswb_18",Out="_header_5nswb_31",But="_icon_5nswb_41",$ut="_name_5nswb_56",zut="_desc_5nswb_67",Fut="_content_5nswb_87",qut="_code_5nswb_105",Hut="_codeBlock_5nswb_113",Uut="_question_5nswb_136",Vut="_options_5nswb_148",Wut="_option_5nswb_148",Gut="_optionPlain_5nswb_183",Kut="_optionSecondary_5nswb_193",Yut="_optionPrimary_5nswb_200",Xut="_optionActive_5nswb_211",Qut="_pointer_5nswb_215",Jut="_num_5nswb_219",Zut="_label_5nswb_223",xi={approval:Lut,floating:Put,header:Out,icon:But,name:$ut,desc:zut,content:Fut,code:qut,codeBlock:Hut,question:Uut,options:Vut,option:Wut,optionPlain:Gut,optionSecondary:Kut,optionPrimary:Yut,optionActive:Xut,pointer:Qut,num:Jut,label:Zut};function edt(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 tdt(e){const t=[];for(const n of e.content)n.type==="text"&&n.text&&t.push(n.text);return t.join(`
`)}function ndt(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 sdt(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 rdt(e){var n;const t=(n=e.rawInput)==null?void 0:n.description;return typeof t=="string"&&t.trim()?t.trim():e.title}function J6(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 Vq(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 Zk(e){return e.map((t,n)=>({option:t,index:n})).sort((t,n)=>{const s=Vq(t.option)-Vq(n.option);return s===0?t.index-n.index:s}).map(({option:t})=>t)}function idt(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 odt(e){return e.kind==="allow_once"?xi.optionPrimary:e.kind==="allow_always"?xi.optionSecondary:e.kind==="reject_once"||e.kind==="reject_always"?xi.optionPlain:xi.optionSecondary}function eoe({request:e,onConfirm:t,variant:n="inline",keyboardActive:s=!0}){const{t:r}=ut(),i=f.useMemo(()=>Zk(e.options),[e.options]),[o,a]=f.useState(()=>J6(Zk(e.options))),c=f.useRef(e);c.current=e;const u=f.useRef(o);u.current=o;const d=f.useRef(!1),h=f.useRef([]),m=f.useId(),p=f.useId(),g=f.useId(),b=f.useId();f.useEffect(()=>{const $=J6(Zk(c.current.options));d.current=!1,u.current=$,a($)},[e.id]);const v=edt(e.title),x=e.toolName||v.toolName||e.kind||"Tool",y=Ec(x,r),w=rdt(e),k=tdt(e),T=f.useCallback($=>{d.current||(d.current=!0,t(c.current.id,$))},[t]),S=f.useCallback($=>{const z=h.current[$];z&&(document.activeElement===z&&z.blur(),z.focus())},[]),C=f.useRef(!1),_=f.useRef(e.id);f.useEffect(()=>{const $=C.current,z=_.current;if(C.current=s,_.current=e.id,!s)return;const F=e.id!==z;$&&!F||S(F?J6(Zk(c.current.options)):u.current)},[s,e.id,S]);const B=f.useCallback($=>{const z=i.length,F=(u.current+$+z)%z;u.current=F,a(F),S(F)},[i.length,S]),A=f.useCallback($=>{const z=i.length;if($.key==="ArrowDown"||$.key==="j")$.preventDefault(),B(1);else if($.key==="ArrowUp"||$.key==="k")$.preventDefault(),B(-1);else if($.key==="Home")$.preventDefault(),u.current=0,a(0),S(0);else if($.key==="End"){$.preventDefault();const F=z-1;u.current=F,a(F),S(F)}else if($.key==="Escape"){$.preventDefault();const F=c.current.options.find(G=>G.kind==="reject_once"||G.kind==="reject_always");F&&T(F.id)}else if($.key>="1"&&$.key<="9"){const F=parseInt($.key,10)-1;F<z&&($.preventDefault(),T(i[F].id))}},[i,B,T,S]),N=ndt(e),j=Xue(e.toolName),P=sdt(e),L=!!(N&&P||k&&k!==e.title),O=j?r("approval.launchAgentQuestion"):N?r("approval.execQuestion",{tool:y}):r("approval.changeQuestion");return l.jsxs("div",{className:n==="floating"?`${xi.approval} ${xi.floating}`:xi.approval,"data-web-shell-permission-panel":!0,role:"alertdialog","aria-labelledby":m,"aria-describedby":[p,w?g:null,L?b:null].filter(Boolean).join(" "),onKeyDown:A,children:[l.jsxs("div",{className:xi.header,children:[l.jsx("span",{className:xi.icon,"aria-hidden":"true",children:"?"}),l.jsx("span",{className:xi.name,id:m,children:y})]}),w&&l.jsx("div",{className:xi.desc,id:g,title:w,children:w}),N&&P?l.jsx("div",{className:xi.code,children:l.jsx("pre",{className:xi.codeBlock,id:b,title:P,children:P})}):k&&k!==e.title?l.jsx("pre",{className:xi.content,id:b,title:k,children:k}):null,l.jsx("div",{className:xi.question,id:p,children:O}),l.jsx("div",{className:xi.options,role:"radiogroup",children:i.map(($,z)=>{const F=z===o,G=idt($),I=G?r(G):$.label;return l.jsxs("button",{type:"button",ref:Q=>{h.current[z]=Q},className:`${xi.option} ${odt($)} ${F?xi.optionActive:""}`,"data-web-shell-permission-option":!0,"data-option-id":$.id,tabIndex:F?0:-1,role:"radio","aria-checked":F,"aria-keyshortcuts":z<9?String(z+1):void 0,onClick:()=>T($.id),onFocus:()=>{u.current=z,a(z)},children:[l.jsx("span",{className:xi.pointer,"aria-hidden":"true",children:F?"›":" "}),l.jsxs("span",{className:xi.num,"aria-hidden":"true",children:[z+1,"."]}),l.jsx("span",{className:xi.label,children:I})]},$.id)})})]})}const adt="_question_1paag_1",ldt="_floating_1paag_18",cdt="_titleLine_1paag_30",udt="_icon_1paag_38",ddt="_toolName_1paag_42",hdt="_toolDesc_1paag_46",fdt="_tabs_1paag_53",mdt="_topRight_1paag_63",pdt="_collapseButton_1paag_70",gdt="_collapseIcon_1paag_89",bdt="_collapseIconCollapsed_1paag_95",ydt="_collapsed_1paag_99",xdt="_tab_1paag_53",vdt="_tabActive_1paag_118",wdt="_text_1paag_135",kdt="_description_1paag_143",_dt="_multiHint_1paag_151",Sdt="_options_1paag_157",Cdt="_option_1paag_157",Tdt="_optionActive_1paag_194",Edt="_optionSelected_1paag_195",Adt="_optionLabel_1paag_200",Ndt="_pointer_1paag_205",jdt="_optionNum_1paag_209",Mdt="_editIcon_1paag_226",Idt="_optionContent_1paag_258",Rdt="_optionPlaceholder_1paag_274",Ddt="_optionDesc_1paag_279",Ldt="_customInput_1paag_286",Pdt="_customTrigger_1paag_301",Odt="_actions_1paag_327",Bdt="_button_1paag_335",$dt="_submitButton_1paag_361",zdt="_ignoreButton_1paag_367",xs={question:adt,floating:ldt,titleLine:cdt,icon:udt,toolName:ddt,toolDesc:hdt,tabs:fdt,topRight:mdt,collapseButton:pdt,collapseIcon:gdt,collapseIconCollapsed:bdt,collapsed:ydt,tab:xdt,tabActive:vdt,text:wdt,description:kdt,multiHint:_dt,options:Sdt,option:Cdt,optionActive:Tdt,optionSelected:Edt,optionLabel:Adt,pointer:Ndt,optionNum:jdt,editIcon:Mdt,optionContent:Idt,optionPlaceholder:Rdt,optionDesc:Ddt,customInput:Ldt,customTrigger:Pdt,actions:Odt,button:Bdt,submitButton:$dt,ignoreButton:zdt};function toe({request:e,onConfirm:t,variant:n="inline",keyboardActive:s=!0}){const{t:r}=ut(),i=f.useMemo(()=>{var U;return Array.isArray((U=e.rawInput)==null?void 0:U.questions)?e.rawInput.questions:[]},[e.rawInput]),[o,a]=f.useState(0),[c,u]=f.useState(null),[d,h]=f.useState({}),[m,p]=f.useState({}),[g,b]=f.useState({}),[v,x]=f.useState(!1),[y,w]=f.useState(!1),k=f.useRef(!1),T=f.useRef([]),S=f.useRef(null),C=f.useRef(c);C.current=c;const _=f.useId(),B=f.useId();f.useEffect(()=>{const U=i[0];k.current=!1,w(!1),a(0),C.current=U!=null&&U.options.length?0:null,u(U!=null&&U.options.length?0:null),h(U&&!U.multiSelect&&U.options[0]?{0:U.options[0].label}:{}),p({}),b(U!=null&&U.multiSelect&&U.options[0]?{0:[U.options[0].label]}:{}),x(!1)},[i,e.id]);const A=i[o],N=(A==null?void 0:A.multiSelect)??!1,j=f.useCallback(()=>{const U={};for(let ee=0;ee<i.length;ee++){const oe=i[ee];if(oe)if(oe.multiSelect){const Ce=g[ee]||[],he=m[ee],ye=he?[...Ce,he]:Ce;U[String(ee)]=ye.join(", ")}else U[String(ee)]=d[ee]||m[ee]||""}return U},[i,g,m,d]),P=f.useCallback(()=>{if(k.current)return;const U=e.options.find(ee=>ee.kind==="allow_once");U&&(k.current=!0,t(e.id,U.id,j()))},[j,e,t]),L=f.useCallback(()=>{if(k.current)return;const U=e.options.find(ee=>ee.kind==="reject_once"||ee.kind==="reject_always");U&&(k.current=!0,t(e.id,U.id,void 0))},[e,t]),O=f.useCallback(U=>{U!==void 0&&p(ee=>({...ee,[o]:U})),N||h(ee=>{if(!(o in ee))return ee;const oe={...ee};return delete oe[o],oe}),x(!0)},[o,N]),$=f.useCallback(U=>{if(!A)return;if(U===A.options.length){O();return}const oe=A.options[U].label;if(N){const Ce=g[o]||[],he=Ce.includes(oe)?Ce.filter(ye=>ye!==oe):[...Ce,oe];b({...g,[o]:he})}else{const Ce={...d,[o]:oe};h(Ce),p(he=>{if(!(o in he))return he;const ye={...he};return delete ye[o],ye})}},[A,o,N,g,d,O]),z=f.useCallback(U=>{if(!A||!N)return;if(U===A.options.length){O();return}const ee=A.options[U].label,oe=g[o]||[],Ce=oe.includes(ee)?oe.filter(he=>he!==ee):[...oe,ee];b({...g,[o]:Ce})},[A,N,g,o,O]),F=f.useCallback(U=>{if(A){if(C.current=U,u(U),U===A.options.length){O();return}N?z(U):$(U)}},[A,N,O,z,$]),G=f.useCallback(U=>{var ee,oe;A&&(C.current=U,u(U),U===A.options.length?((ee=S.current)==null||ee.focus(),N||h(Ce=>{if(!(o in Ce))return Ce;const he={...Ce};return delete he[o],he})):((oe=T.current[U])==null||oe.focus(),N||$(U)))},[A,o,N,$]),I=f.useCallback(U=>{if(!A)return;const ee=A.options.length+1,oe=C.current??0;G((oe+U+ee)%ee)},[A,G]),Q=f.useCallback(U=>{if(Sp(U.target)||!U.target.closest("[data-web-shell-ask-option]")||!A)return;const ee=A.options.length+1;if(U.key==="ArrowDown"||U.key==="j")U.preventDefault(),I(1);else if(U.key==="ArrowUp"||U.key==="k")U.preventDefault(),I(-1);else if(U.key==="Home")U.preventDefault(),G(0);else if(U.key==="End")U.preventDefault(),G(ee-1);else if(U.key==="Escape")U.preventDefault(),L();else if(U.key>="1"&&U.key<="9"){const oe=parseInt(U.key,10)-1;oe<ee&&(U.preventDefault(),F(oe))}},[A,I,G,L,F]),V=f.useRef(!1),M=f.useRef(e.id),re=f.useRef((A==null?void 0:A.options.length)??0);if(re.current=(A==null?void 0:A.options.length)??0,f.useEffect(()=>{var Ce,he;const U=V.current,ee=M.current;if(V.current=s,M.current=e.id,!s||U&&e.id===ee)return;const oe=C.current??0;oe===re.current?(Ce=S.current)==null||Ce.focus():(he=T.current[oe])==null||he.focus()},[s,e.id]),i.length===0)return null;const se=U=>{const ee=i[U];return ee?ee.multiSelect?(g[U]||[]).length>0||!!m[U]:!!d[U]||!!m[U]:!1},X=i.every((U,ee)=>se(ee)),J=Math.min(o,i.length-1),de=U=>{const ee=i[U];if(a(U),x(!1),!(ee!=null&&ee.options.length)){u(null);return}if(u(0),ee.multiSelect){b(oe=>(oe[U]||[]).length>0||m[U]?oe:{...oe,[U]:[ee.options[0].label]});return}h(oe=>oe[U]||m[U]?oe:{...oe,[U]:ee.options[0].label})},W=()=>{o<=0||de(o-1)},te=()=>{o>=i.length-1||de(o+1)};return l.jsxs("div",{className:`${xs.question} ${n==="floating"?xs.floating:""} ${y?xs.collapsed:""}`,"data-web-shell-ask-panel":!0,role:"alertdialog","aria-label":Ec("ask_user_question",r),"aria-labelledby":y?void 0:`${B} ${_}`,onKeyDown:Q,children:[l.jsxs("div",{className:xs.titleLine,children:[l.jsx("span",{className:xs.icon,"aria-hidden":"true",children:"?"}),l.jsx("span",{className:xs.toolName,id:B,children:Ec("ask_user_question",r)}),l.jsx("span",{className:xs.toolDesc,children:r("askUser.progress",{current:J+1,total:i.length})}),l.jsxs("div",{className:xs.topRight,children:[l.jsx("div",{className:xs.tabs,children:i.map((U,ee)=>l.jsx("span",{className:`${xs.tab} ${ee===o?xs.tabActive:""}`,"aria-hidden":"true"},ee))}),l.jsx("button",{type:"button",className:xs.collapseButton,onClick:()=>w(U=>!U),"aria-expanded":!y,"aria-label":r(y?"common.expand":"common.collapse"),title:r(y?"common.expand":"common.collapse"),children:l.jsx("svg",{viewBox:"0 0 16 16",className:`${xs.collapseIcon} ${y?xs.collapseIconCollapsed:""}`,children:l.jsx("path",{d:"M4 6l4 4 4-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})})})]})]}),!y&&l.jsxs(l.Fragment,{children:[A?l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:xs.text,id:_,children:[A.question,N&&l.jsxs("span",{className:xs.multiHint,children:[" ","(",r("askUser.multiHint"),")"]})]}),l.jsx("p",{className:xs.description,children:r("askUser.selectAnswer")}),l.jsxs("div",{className:xs.options,role:N?"group":"radiogroup","aria-labelledby":_,children:[A.options.map((U,ee)=>{const oe=ee===c,Ce=N?(g[o]||[]).includes(U.label):d[o]===U.label;return l.jsxs("button",{type:"button",ref:he=>{T.current[ee]=he},className:`${xs.option} ${oe?xs.optionActive:""} ${Ce?xs.optionSelected:""}`,"data-web-shell-ask-option":!0,tabIndex:oe?0:-1,role:N?void 0:"radio","aria-checked":N?void 0:Ce,"aria-pressed":N?Ce:void 0,"aria-keyshortcuts":ee<9?String(ee+1):void 0,onClick:()=>F(ee),onFocus:()=>u(ee),children:[l.jsx("span",{className:xs.pointer,"aria-hidden":"true",children:oe?"›":" "}),l.jsx("span",{className:xs.optionNum,"aria-hidden":"true",children:ee+1}),l.jsxs("span",{className:xs.optionContent,children:[l.jsx("span",{className:xs.optionLabel,children:U.label}),U.description&&l.jsx("span",{className:xs.optionDesc,children:U.description})]})]},U.label)}),(()=>{const U=c===A.options.length,ee=!!m[o];return l.jsxs("div",{className:`${xs.option} ${U?xs.optionActive:""} ${ee?xs.optionSelected:""}`,onClick:()=>F(A.options.length),children:[l.jsx("span",{className:xs.pointer,"aria-hidden":"true",children:U?"›":" "}),l.jsx("span",{className:xs.editIcon,"aria-hidden":"true",children:l.jsx("svg",{viewBox:"0 0 16 16",children:l.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"})})}),v?l.jsx("input",{type:"text",className:xs.customInput,placeholder:r("askUser.typePlaceholder"),value:m[o]||"","aria-label":r("askUser.typePlaceholder"),onChange:oe=>p({...m,[o]:oe.target.value}),onClick:oe=>oe.stopPropagation(),onFocus:()=>u(A.options.length),onBlur:()=>x(!1),autoFocus:!0}):l.jsx("button",{type:"button",ref:S,className:`${xs.customTrigger} ${m[o]?"":xs.optionPlaceholder}`,"data-web-shell-ask-option":!0,tabIndex:U?0:-1,role:N?void 0:"radio","aria-checked":N?void 0:ee,"aria-pressed":N?ee:void 0,"aria-keyshortcuts":A.options.length<9?String(A.options.length+1):void 0,onFocus:()=>u(A.options.length),children:m[o]||r("askUser.typePlaceholder")})]})})()]})]}):null,l.jsxs("div",{className:xs.actions,children:[l.jsx("button",{type:"button",className:xs.ignoreButton,onClick:L,children:r("askUser.ignore")}),i.length>1&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:xs.button,disabled:o<=0,onClick:W,children:r("common.previous")}),l.jsx("button",{type:"button",className:xs.button,disabled:o>=i.length-1,onClick:te,children:r("common.next")})]}),l.jsx("button",{type:"button",className:`${xs.button} ${xs.submitButton}`,disabled:!X,onClick:P,children:r("askUser.submit")})]})]})]})}const Fdt=1e6;function noe(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 noe(n))t.add(s);return Array.from(t)}function soe(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 c of a.tools){for(const u of noe(c))s.set(u,i);roe(c,i,r)}}const o=new Map;for(const a of t){const c=qdt(r,a,n);if(c.size===0&&a.toolCallId){const u=s.get(a.toolCallId);u&&c.add(u)}for(const u of c){const d=o.get(u);d?d.some(h=>h.id===a.id)||d.push(a):o.set(u,[a])}}return o}function roe(e,t,n){e.toolName.toLowerCase()==="record_artifact"&&n.push({turnId:t,workspacePath:yd(e.args,"workspacePath"),managedId:yd(e.args,"managedId"),url:yd(e.args,"url")});for(const s of e.subTools??[])roe(s,t,n)}function qdt(e,t,n){const s=new Set;for(const r of e){if(r.workspacePath&&t.workspacePath&&hoe(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 ioe(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=>Cp(a.workspacePath)).filter(a=>!!a));for(const a of i.tools)loe(a,r,o,s,n)}return s}function ooe(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)aoe(r,n,t)}return t}function aoe(e,t,n){const s=Hdt(e);if(s){const r=n.get(t);r?r.push(s):n.set(t,[s])}for(const r of e.subTools??[])aoe(r,t,n)}function Hdt(e){if(e.status!=="completed"||e.toolName.toLowerCase()!=="cron_create")return null;const t=RI(e);if(t!=null&&t.error)return null;const n=yd(e.args,"cron"),s=yd(e.args,"prompt");if(!n||!s)return null;const r=yd(t,"returnDisplay")??yd(t,"llmContent")??(typeof e.rawOutput=="string"?e.rawOutput:void 0),i=r?coe(r):void 0;return{id:r?Ydt(r)??e.callId:e.callId,toolCallId:e.callId,title:Xdt(s),cron:n,prompt:s,recurring:Wq(e.args,"recurring")??!0,durable:Wq(e.args,"durable")??!1,...i?{display:i}:{}}}function loe(e,t,n,s,r){const i=Udt(e,n,r);if(i){const o=s.get(t);o?Qdt(o,i):s.set(t,[i])}for(const o of e.subTools??[])loe(o,t,n,s,r)}function Udt(e,t,n){if(e.status!=="completed")return null;const s=e.toolName.toLowerCase();if(s!=="write_file"&&s!=="edit")return null;const r=Vdt(e);if(!r)return null;const i=Cp(r),o=Wdt(e),a=Kdt(e),c=Gdt(a);return{path:r,status:o,toolCallId:e.callId,isArtifact:Array.from(t).some(u=>hoe(i,u,n)),...c?{additions:c.additions,deletions:c.deletions}:{},diffs:a}}function Vdt(e){var n,s;const t=J2(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 yd(e,...t){if(e)for(const n of t){const s=e[n];if(typeof s=="string"&&s.trim())return s}}function J2(e,...t){if(e)for(const n of t){const s=e[n];if(typeof s=="string")return s}}function Wdt(e){if(e.toolName.toLowerCase()==="write_file")return"created";const t=RI(e),n=(yd(t,"returnDisplay")??"").toLowerCase();return n.includes("created new file")||n.includes("successfully created")||n.includes("created and wrote")?"created":"modified"}function Gdt(e){const t=uoe(e);return t?doe(t.oldText,t.newText):void 0}function Kdt(e){const t=RI(e),n=J2(t,"originalContent"),s=J2(t,"newContent");if(n!==void 0||s!==void 0)return[{oldText:n??"",newText:s??"",fileDiff:yd(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=J2(e.args,"content");return i!==void 0?[{oldText:"",newText:i,fullContent:!0}]:[]}return[]}function RI(e){return e.rawOutput&&typeof e.rawOutput=="object"?e.rawOutput:void 0}function Wq(e,t){const n=e==null?void 0:e[t];return typeof n=="boolean"?n:void 0}function coe(e){return e.split(/\r\n|\r|\n/).map(t=>t.trim()).find(Boolean)}function Ydt(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 Xdt(e){const t=coe(e)??e.trim();return t.length>36?`${t.slice(0,36)}...`:t}function Qdt(e,t){const n=Cp(t.path),s=e.findIndex(h=>Cp(h.path)===n);if(s<0){e.push(t);return}const r=e[s],{additions:i,deletions:o,...a}=r,c=Jdt(r.diffs,t.diffs),u=uoe(c),d=u?doe(u.oldText,u.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:c}}function Jdt(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 uoe(e){const t=e.at(-1);return t!=null&&t.fullContent?t:void 0}function doe(e,t){const n=Gq(e),s=Gq(t);if(n.length*s.length>Fdt)return;const r=Zdt(n,s);return{additions:s.length-r,deletions:n.length-r}}function Gq(e){return e?e.replace(/\r?\n$/,"").split(/\r\n|\r|\n/):[]}function Zdt(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 hoe(e,t,n){return tie(e,t,n)}const eht="_pane_4s0kf_1",tht="_header_4s0kf_13",nht="_workspaceTag_4s0kf_36",sht="_workspaceTagDot_4s0kf_52",rht="_workspaceTagText_4s0kf_60",iht="_connectionError_4s0kf_69",oht="_connectionErrorText_4s0kf_77",aht="_title_4s0kf_84",lht="_closeButton_4s0kf_95",cht="_maximizeButton_4s0kf_96",uht="_body_4s0kf_124",dht="_footer_4s0kf_132",hht="_approval_4s0kf_138",Ea={pane:eht,header:tht,workspaceTag:nht,workspaceTagDot:sht,workspaceTagText:rht,connectionError:iht,connectionErrorText:oht,title:aht,closeButton:lht,maximizeButton:cht,body:uht,footer:dht,approval:hht},Kq=["approvalMode","model","voice"];function fht({title:e,workspaceCwd:t,onClose:n,onToggleMaximize:s,isMaximized:r=!1,onError:i,onRightPanelOpen:o,onPaneArtifactsChange:a,messageTurnOutputs:c,restartSseOnPrompt:u=!1}){var gt,We;const{t:d}=ut(),h=Cl(),m=x1(),p=fo(),g=dc(),b=Hie(d),v=mv(),x=CG(),y=I4(),w=R4(),{artifacts:k}=Uie();f.useEffect(()=>{const tt=h.sessionId;if(tt)return a==null||a(tt,k,p),()=>{a==null||a(tt,[],p)}},[k,h.sessionId,a,p]);const T=f.useRef(w);T.current=w;const S=f.useRef(null),{followupState:C,onAcceptFollowup:_,onDismissFollowup:B,clear:A}=jG({onAccept:tt=>{var jt;(jt=S.current)==null||jt.insertText(tt)}}),N=f.useCallback((tt,jt)=>{i?i(tt,jt):console.error(jt,tt)},[i]),j=f.useCallback(tt=>y.dispatch([{type:"status",text:tt}]),[y]),P=f.useMemo(()=>A7(v),[v]),L=r9(P),O=P&&!L?P:null,$=P&&L?P:null,z=f.useRef(O);z.current=O;const F=O!==null||$!==null,G=w!=="idle",I=f.useMemo(()=>soe(b,k,h.workspaceCwd||""),[b,k,h.workspaceCwd]),Q=f.useMemo(()=>ioe(b,I,h.workspaceCwd||""),[b,I,h.workspaceCwd]),V=f.useMemo(()=>ooe(b),[b]),M=f.useMemo(()=>new Set(c??sie),[c]),{queuedPrompts:re,queuedTexts:se,enqueuePrompt:X,removeQueuedPrompt:J,insertQueuedPrompt:de,editQueuedPrompt:W,editLastQueuedPrompt:te,clearQueuedPrompts:U}=Wie({connected:h.status==="connected",sessionId:h.sessionId,clientId:h.clientId,streamingState:w,sessionActions:m,store:y,editorRef:S,reportError:N,notifySuccess:j,t:d}),ee=f.useMemo(()=>{if(G)for(let tt=b.length-1;tt>=0;tt--){const jt=b[tt];if((jt==null?void 0:jt.role)==="user")return jt.timestamp}},[b,G]),oe=f.useCallback((tt,jt,jn,kn)=>{const Be=tt.trim();if(!Be||Kie({connectionStatus:h.status,hasSession:!!h.sessionId,restartSseOnPrompt:u}))return!1;const ht=kn==null?void 0:kn.inputAnnotations;return T.current==="idle"?(m.sendPrompt(Be,{...jt&&jt.length?{images:jt}:{},...ht?{inputAnnotations:ht}:{},onAdmitted:()=>{A(),jn==null||jn()}}).catch(ve=>N(ve,"Failed to send prompt")),!1):ht?X(Be,jt,void 0,ht):X(Be,jt)},[m,A,h.sessionId,h.status,X,N,u]),Ce=f.useCallback((tt,jt,jn)=>{m.submitPermission(tt,jt,jn).catch(kn=>N(kn,"Failed to submit permission choice"))},[m,N]),he=f.useCallback(()=>{m.cancel().catch(tt=>N(tt,"Failed to cancel request"))},[m,N]),ye=f.useCallback(tt=>{if(o){if(tt.kind==="artifact"||tt.kind==="scheduled_task"){o({...tt,workspaceActions:p});return}o(tt)}},[o,p]),Ve=f.useMemo(()=>Qie(Jie(h.commands??[],Yie(d)),d).map(tt=>{const jt=Xie(tt.name);return jt?{...tt,displayCategory:"skill",description:d(jt)}:tt}),[h.commands,d]),it=f.useMemo(()=>(h.models??[]).filter(hy).map(tt=>({id:tt.id,label:Yh(tt.label||tt.id)})),[h.models]),At=f.useCallback(tt=>{if(!o4(tt)){N(new Error(`Unsupported approval mode: ${tt}`),"Failed to set approval mode");return}m.setApprovalMode(tt).then(()=>{const jt=z.current;if(!jt||!(tt==="yolo"||tt==="auto-edit"&&jt.toolKind==="edit"))return;const kn=jt.options.find(Be=>Be.kind==="allow_once");kn&&m.submitPermission(jt.id,kn.id).catch(Be=>N(Be,"Failed to auto-approve tool call"))}).catch(jt=>N(jt,"Failed to set approval mode"))},[m,N]),Ee=f.useCallback(tt=>{m.setModel(tt).catch(jt=>N(jt,"Failed to switch model"))},[m,N]),me=e||h.displayName||((gt=h.sessionId)==null?void 0:gt.slice(0,8))||"",bt=t??h.workspaceCwd,et=II(g.capabilities)&&!!bt,qe=f.useMemo(()=>et?[...Kq,"workspace"]:Kq,[et]),Ke=et&&bt?u1(bt):void 0,ke=et?uct(bt,g.capabilities):void 0,ne=ke?AI[ke]:void 0;return l.jsxs("section",{className:Ea.pane,"data-testid":"chat-pane","aria-label":me,children:[l.jsxs("header",{className:`${Ea.header} ${ne??""}`.trim(),children:[Ke&&l.jsxs("span",{role:"img",className:Ea.workspaceTag,title:bt,"aria-label":d("workspace.paneLabel",{name:Ke}),"data-web-shell-pane-workspace":!0,children:[l.jsx("span",{className:Ea.workspaceTagDot,"aria-hidden":"true"}),l.jsx("span",{className:Ea.workspaceTagText,children:Ke})]}),l.jsx("span",{className:Ea.title,title:me,children:me}),s&&l.jsx("button",{type:"button",className:Ea.maximizeButton,onClick:s,"aria-pressed":r,"aria-label":d(r?"splitView.restorePane":"splitView.maximizePane"),title:d(r?"splitView.restorePane":"splitView.maximizePane"),children:r?l.jsx(LG,{size:16,"aria-hidden":!0}):l.jsx(DG,{size:16,"aria-hidden":!0})}),n&&l.jsx("button",{type:"button",className:Ea.closeButton,onClick:n,"aria-label":d("splitView.closePane"),title:d("splitView.closePane"),children:l.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:l.jsx("path",{d:"M6 6l12 12M18 6L6 18",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),h.error&&l.jsx("div",{className:Ea.connectionError,role:"alert",children:l.jsxs("span",{className:Ea.connectionErrorText,children:[d("splitView.paneConnectionError"),": ",h.error]})}),l.jsx("div",{className:Ea.body,children:l.jsx(hie,{messages:b,pendingApproval:O,loadingTranscript:h.loadingTranscript,catchingUp:h.catchingUp,hasOlderHistory:x.hasMore,loadingOlderHistory:x.loading,historyCapacityReached:x.capacityReached,onLoadOlderHistory:x.loadMore,isResponding:G,workspaceCwd:h.workspaceCwd||"",hideSessionTimeline:!0,turnFileChanges:M.has("file")?Q:void 0,turnArtifacts:M.has("artifact")?I:void 0,turnScheduledTasks:M.has("scheduled_task")?V:void 0,onTurnOutputOpen:ye,generateContent:(We=h.capabilities)!=null&&We.features.includes("session_generation")?m.generateSessionContent:void 0})}),l.jsxs("div",{className:Ea.footer,children:[O&&l.jsx("div",{className:Ea.approval,"data-testid":"pane-approval",children:l.jsx(eoe,{request:O,onConfirm:Ce,variant:"floating",keyboardActive:!1})}),$&&l.jsx("div",{className:Ea.approval,"data-testid":"pane-approval",children:l.jsx(toe,{request:$,onConfirm:Ce,variant:"floating",keyboardActive:!1})}),l.jsx(yie,{startedAt:ee,showPhrase:!1}),l.jsx(Zie,{prompts:re,t:d,onDelete:J,onInsert:de,onEdit:W}),l.jsx(bie,{ref:S,onSubmit:oe,onCancel:he,isRunning:G,commands:Ve,queuedMessages:se,onPopQueuedMessages:te,onClearQueuedMessages:U,visibleToolbarActions:qe,workspaceName:et&&bt?u1(bt):void 0,workspaceTitle:bt,workspaceColor:ke,currentMode:h.currentMode??"default",currentModel:h.currentModel??"",availableModels:it,onSelectMode:At,onSelectModel:Ee,dialogOpen:F,followupState:C,onAcceptFollowup:_,onDismissFollowup:B,placeholderText:d("splitView.composerPlaceholder")})]})]})}const mht="_split_99j2q_1",pht="_toolbar_99j2q_9",ght="_backButton_99j2q_18",bht="_title_99j2q_35",yht="_count_99j2q_40",xht="_addWrap_99j2q_45",vht="_addButton_99j2q_50",wht="_picker_99j2q_70",kht="_pickerItem_99j2q_87",_ht="_pickerItemLabel_99j2q_102",Sht="_pickerItemWorkspace_99j2q_112",Cht="_panes_99j2q_131",Tht="_paneSlot_99j2q_140",Eht="_empty_99j2q_153",Aht="_paneError_99j2q_162",Nht="_paneErrorTitle_99j2q_175",jht="_paneErrorMessage_99j2q_180",Mht="_paneErrorClose_99j2q_185",eo={split:mht,toolbar:pht,backButton:ght,title:bht,count:yht,addWrap:xht,addButton:vht,picker:wht,pickerItem:kht,pickerItemLabel:_ht,pickerItemWorkspace:Sht,panes:Cht,paneSlot:Tht,empty:Eht,paneError:Aht,paneErrorTitle:Nht,paneErrorMessage:jht,paneErrorClose:Mht},Z6=mf;function Iht({sessionIds:e,onPanesChange:t,onExit:n,onError:s,onRightPanelOpen:r,onPaneArtifactsChange:i,messageTurnOutputs:o,sessionListReloadToken:a,includeOtherWorkspaces:c=!0,workspaceCwd:u,restartSseOnPrompt:d}){var J,de;const{t:h}=ut(),m=Cl(),p=m.sessionId,g=((de=(J=m.capabilities)==null?void 0:J.features)==null?void 0:de.includes(jI))??!1,{sessions:b,reload:v}=qv(u,{autoLoad:!0,pageSize:cd,archiveState:"active",...g?{view:"organized",group:"all"}:{}}),{sessions:x,reload:y}=Bie(c&&!u),w=f.useMemo(()=>Oie(b,x),[b,x]),k=!u&&c&&II(m.capabilities),T=!!u||k,S=e!==void 0,C=f.useMemo(()=>Array.from(new Set((e??[]).filter(Boolean))).slice(0,Z6),[e]),[_,B]=f.useState(()=>C.length>0?C:p?[p]:[]),[A,N]=f.useState(!1),[j,P]=f.useState(null),L=f.useRef(null),[O]=f.useState(()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).slice(2));f.useEffect(()=>{S&&B(W=>W.length===C.length&&W.every((te,U)=>te===C[U])?W:C)},[C,S]);const $=f.useRef(_);$.current=_,f.useEffect(()=>{if(!A)return;const W=U=>{var ee;(ee=L.current)!=null&&ee.contains(U.target)||N(!1)},te=U=>{U.key==="Escape"&&N(!1)};return document.addEventListener("mousedown",W),document.addEventListener("keydown",te),()=>{document.removeEventListener("mousedown",W),document.removeEventListener("keydown",te)}},[A]),f.useEffect(()=>{A&&(v(),y())},[A,v,y]);const z=f.useRef(a);f.useEffect(()=>{a!==void 0&&a!==z.current&&(z.current=a,v(),y())},[a,v,y]);const F=f.useMemo(()=>{var te;const W=new Map;for(const U of w)W.set(U.sessionId,((te=U.displayName)==null?void 0:te.trim())||U.sessionId.slice(0,8));return W},[w]),G=f.useMemo(()=>{const W=new Map;for(const te of w)W.set(te.sessionId,te.workspaceCwd);return p&&m.workspaceCwd&&!W.has(p)&&W.set(p,m.workspaceCwd),W},[w,p,m.workspaceCwd]),I=f.useCallback(W=>{const te=$.current;if(te.includes(W)||te.length>=Z6){N(!1);return}const U=[...te,W];P(null),S?t==null||t(U):B(U),N(!1)},[t,S]),Q=f.useRef(!1);f.useEffect(()=>{_.length>0?Q.current=!0:Q.current&&n()},[_,n]),f.useEffect(()=>{S||t==null||t(_)},[_,t,S]);const V=f.useCallback(W=>{const te=$.current;if(!te.includes(W))return;const U=te.filter(ee=>ee!==W);S?t==null||t(U):B(U)},[t,S]),M=f.useCallback(W=>{P(te=>te===W?null:W)},[]);f.useEffect(()=>{j&&(_.length<2||!_.includes(j))&&P(null)},[_,j]),f.useEffect(()=>{if(!j)return;const W=te=>{te.key!=="Escape"||te.defaultPrevented||A||Sp(te.target)||P(null)};return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[j,A]);const re=f.useMemo(()=>w.filter(W=>!_.includes(W.sessionId)),[w,_]),se=_.length<Z6&&re.length>0,X=_.length>1;return l.jsxs("div",{className:eo.split,"data-testid":"split-view",children:[l.jsxs("header",{className:eo.toolbar,children:[l.jsx("button",{type:"button",className:eo.backButton,onClick:n,"aria-label":h("common.back"),title:h("common.back"),children:l.jsx("svg",{viewBox:"0 0 24 24",width:"18",height:"18","aria-hidden":"true",children:l.jsx("path",{d:"M15 18l-6-6 6-6",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),l.jsx("span",{className:eo.title,children:h("splitView.title")}),l.jsx("span",{className:eo.count,children:h("splitView.count",{count:_.length})}),l.jsxs("div",{className:eo.addWrap,ref:L,children:[l.jsxs("button",{type:"button",className:eo.addButton,disabled:!se,"aria-haspopup":"listbox","aria-expanded":A,onClick:()=>N(W=>!W),children:["+ ",h("splitView.addPane")]}),A&&re.length>0&&l.jsx("ul",{className:eo.picker,role:"listbox",children:re.map(W=>l.jsx("li",{role:"option","aria-selected":"false",children:l.jsxs("button",{type:"button",className:eo.pickerItem,onClick:()=>I(W.sessionId),children:[l.jsx("span",{className:eo.pickerItemLabel,children:F.get(W.sessionId)??W.sessionId.slice(0,8)}),k&&l.jsx("span",{className:eo.pickerItemWorkspace,title:W.workspaceCwd,children:u1(W.workspaceCwd)})]})},W.sessionId))})]})]}),l.jsx("div",{className:eo.panes,children:_.length===0?l.jsx("div",{className:eo.empty,children:h("splitView.empty")}):_.map(W=>{const te=G.get(W),U=j===W,ee=j!==null&&!U;return l.jsx("div",{className:eo.paneSlot,"data-pane-hidden":ee?"":void 0,children:l.jsx(zd,{label:`split-pane:${W}`,resetKeys:[W],fallback:oe=>l.jsxs("div",{className:eo.paneError,role:"alert",children:[l.jsx("div",{className:eo.paneErrorTitle,children:F.get(W)??W.slice(0,8)}),l.jsxs("div",{className:eo.paneErrorMessage,children:[h("splitView.paneError"),": ",oe.message]}),l.jsx("button",{type:"button",className:eo.paneErrorClose,onClick:()=>V(W),children:h("splitView.closePane")})]}),children:l.jsx(SG,{sessionId:W,workspaceCwd:T?te??u:void 0,clientId:`split-pane:${O}:${W}`,historyPageSize:vie,maxBlocks:wie,suppressOwnUserEcho:!0,restartEventStreamOnPrompt:d,children:l.jsx(fht,{title:F.get(W),workspaceCwd:te,onClose:()=>V(W),onToggleMaximize:X?()=>M(W):void 0,isMaximized:U,onError:s,onRightPanelOpen:r,onPaneArtifactsChange:i,messageTurnOutputs:o,restartSseOnPrompt:d})})})},T?`${W}:${te??""}`:W)})})]})}const Rht="_root_12cvm_1",Dht="_intro_12cvm_8",Lht="_toolbar_12cvm_14",Pht="_count_12cvm_22",Oht="_toolbarActions_12cvm_28",Bht="_primaryButton_12cvm_34",$ht="_secondaryButton_12cvm_35",zht="_formFields_12cvm_73",Fht="_field_12cvm_79",qht="_fieldGrow_12cvm_86",Hht="_fieldLabel_12cvm_90",Uht="_required_12cvm_96",Vht="_input_12cvm_107",Wht="_textarea_12cvm_108",Ght="_select_12cvm_109",Kht="_promptEditorWrap_12cvm_127",Yht="_promptEditor_12cvm_127",Xht="_promptPlaceholder_12cvm_159",Qht="_promptTag_12cvm_173",Jht="_promptTagIcon_12cvm_189",Zht="_promptTagValue_12cvm_200",eft="_referencePopover_12cvm_210",tft="_referenceBar_12cvm_214",nft="_referenceButton_12cvm_221",sft="_referenceButtonActive_12cvm_238",rft="_referenceButtonIcon_12cvm_243",ift="_referencePicker_12cvm_253",oft="_referenceItem_12cvm_265",aft="_referenceItemLabel_12cvm_288",lft="_referenceItemDescription_12cvm_289",cft="_referenceEmpty_12cvm_306",uft="_referenceError_12cvm_307",dft="_scheduleRow_12cvm_317",hft="_preview_12cvm_329",fft="_previewLabel_12cvm_337",mft="_previewCron_12cvm_342",pft="_previewInvalid_12cvm_352",gft="_formError_12cvm_357",bft="_loadError_12cvm_358",yft="_formActions_12cvm_364",xft="_empty_12cvm_372",vft="_list_12cvm_379",wft="_card_12cvm_387",kft="_cardDisabled_12cvm_398",_ft="_cardHeader_12cvm_402",Sft="_cardTitle_12cvm_408",Cft="_cardMenu_12cvm_419",Tft="_iconAction_12cvm_426",Eft="_toggle_12cvm_452",Aft="_toggleOn_12cvm_471",Nft="_toggleKnob_12cvm_475",jft="_cardPrompt_12cvm_490",Mft="_cardFooter_12cvm_503",Ift="_schedulePill_12cvm_512",Rft="_clockIcon_12cvm_524",Dft="_recurringTag_12cvm_529",Lft="_workspacePill_12cvm_537",Pft="_workspaceIcon_12cvm_554",Oft="_countdown_12cvm_559",Bft="_hourglassIcon_12cvm_570",$ft="_lastFired_12cvm_575",zft="_runsToggle_12cvm_583",Fft="_runsList_12cvm_600",qft="_runsItem_12cvm_614",ze={root:Rht,intro:Dht,toolbar:Lht,count:Pht,toolbarActions:Oht,primaryButton:Bht,secondaryButton:$ht,formFields:zht,field:Fht,fieldGrow:qht,fieldLabel:Hht,required:Uht,input:Vht,textarea:Wht,select:Ght,promptEditorWrap:Kht,promptEditor:Yht,promptPlaceholder:Xht,promptTag:Qht,promptTagIcon:Jht,promptTagValue:Zht,referencePopover:eft,referenceBar:tft,referenceButton:nft,referenceButtonActive:sft,referenceButtonIcon:rft,referencePicker:ift,referenceItem:oft,referenceItemLabel:aft,referenceItemDescription:lft,referenceEmpty:cft,referenceError:uft,scheduleRow:dft,preview:hft,previewLabel:fft,previewCron:mft,previewInvalid:pft,formError:gft,loadError:bft,formActions:yft,empty:xft,list:vft,card:wft,cardDisabled:kft,cardHeader:_ft,cardTitle:Sft,cardMenu:Cft,iconAction:Tft,toggle:Eft,toggleOn:Aft,toggleKnob:Nft,cardPrompt:jft,cardFooter:Mft,schedulePill:Ift,clockIcon:Rft,recurringTag:Dft,workspacePill:Lft,workspaceIcon:Pft,countdown:Oft,hourglassIcon:Bft,lastFired:$ft,runsToggle:zft,runsList:Fft,runsItem:qft},Hft="_panel_1ycr0_1",Uft="_header_1ycr0_11",Vft="_tabs_1ycr0_28",Wft="_tabItem_1ycr0_37",Gft="_tab_1ycr0_28",Kft="_tabIcon_1ycr0_67",Yft="_tabIconSvg_1ycr0_77",Xft="_tabActive_1ycr0_84",Qft="_tabCloseButton_1ycr0_99",Jft="_tabCloseIcon_1ycr0_119",Zft="_iconButton_1ycr0_125",emt="_iconButtonActive_1ycr0_143",tmt="_toolbarIcon_1ycr0_147",nmt="_body_1ycr0_153",smt="_empty_1ycr0_160",rmt="_meta_1ycr0_198",imt="_detail_1ycr0_203",omt="_section_1ycr0_208",amt="_sectionTitle_1ycr0_213",lmt="_description_1ycr0_220",cmt="_actionsRow_1ycr0_224",umt="_fieldGrid_1ycr0_231",dmt="_fieldLabel_1ycr0_238",hmt="_fieldValue_1ycr0_247",fmt="_link_1ycr0_252",mmt="_review_1ycr0_261",pmt="_reviewToolbar_1ycr0_268",gmt="_reviewToolbarTitle_1ycr0_277",bmt="_reviewToolbarActions_1ycr0_284",ymt="_reviewTotalsButton_1ycr0_290",xmt="_reviewContent_1ycr0_308",vmt="_reviewContentListOnly_1ycr0_318",wmt="_reviewContentStacked_1ycr0_322",kmt="_reviewList_1ycr0_327",_mt="_reviewListWithExpanded_1ycr0_335",Smt="_reviewSplitHandle_1ycr0_348",Cmt="_reviewItem_1ycr0_363",Tmt="_reviewItemExpanded_1ycr0_368",Emt="_reviewRow_1ycr0_375",Amt="_fileIcon_1ycr0_396",Nmt="_reviewPath_1ycr0_410",jmt="_treeName_1ycr0_411",Mmt="_pathPrefix_1ycr0_427",Imt="_pathFileName_1ycr0_433",Rmt="_lineStats_1ycr0_441",Dmt="_additions_1ycr0_450",Lmt="_deletions_1ycr0_454",Pmt="_chevron_1ycr0_458",Omt="_chevronOpen_1ycr0_464",Bmt="_chevronIcon_1ycr0_468",$mt="_diffPreview_1ycr0_474",zmt="_codeMirrorDiff_1ycr0_484",Fmt="_codeMirrorDiffWrap_1ycr0_492",qmt="_diffError_1ycr0_500",Hmt="_codeMirrorFile_1ycr0_525",Umt="_diffEmpty_1ycr0_591",Vmt="_tree_1ycr0_411",Wmt="_treeNode_1ycr0_604",Gmt="_treeChildren_1ycr0_608",Kmt="_treeRow_1ycr0_622",Ymt="_treeFolder_1ycr0_655",Xmt="_treeFile_1ycr0_659",Qmt="_treeTwisty_1ycr0_668",Jmt="_treeChevronIcon_1ycr0_677",Zmt="_treeChevron_1ycr0_677",ept="_treeChevronClosed_1ycr0_688",tpt="_treeContent_1ycr0_692",npt="_reviewBadge_1ycr0_715",spt="_htmlPreviewWrap_1ycr0_728",rpt="_htmlPreview_1ycr0_728",ipt="_previewError_1ycr0_744",opt="_filePreviewWrap_1ycr0_750",Je={panel:Hft,header:Uft,tabs:Vft,tabItem:Wft,tab:Gft,tabIcon:Kft,tabIconSvg:Yft,tabActive:Xft,tabCloseButton:Qft,tabCloseIcon:Jft,iconButton:Zft,iconButtonActive:emt,toolbarIcon:tmt,body:nmt,empty:smt,meta:rmt,detail:imt,section:omt,sectionTitle:amt,description:lmt,actionsRow:cmt,fieldGrid:umt,fieldLabel:dmt,fieldValue:hmt,link:fmt,review:mmt,reviewToolbar:pmt,reviewToolbarTitle:gmt,reviewToolbarActions:bmt,reviewTotalsButton:ymt,reviewContent:xmt,reviewContentListOnly:vmt,reviewContentStacked:wmt,reviewList:kmt,reviewListWithExpanded:_mt,reviewSplitHandle:Smt,reviewItem:Cmt,reviewItemExpanded:Tmt,reviewRow:Emt,fileIcon:Amt,reviewPath:Nmt,treeName:jmt,pathPrefix:Mmt,pathFileName:Imt,lineStats:Rmt,additions:Dmt,deletions:Lmt,chevron:Pmt,chevronOpen:Omt,chevronIcon:Bmt,diffPreview:$mt,codeMirrorDiff:zmt,codeMirrorDiffWrap:Fmt,diffError:qmt,codeMirrorFile:Hmt,diffEmpty:Umt,tree:Vmt,treeNode:Wmt,treeChildren:Gmt,treeRow:Kmt,treeFolder:Ymt,treeFile:Xmt,treeTwisty:Qmt,treeChevronIcon:Jmt,treeChevron:Zmt,treeChevronClosed:ept,treeContent:tpt,reviewBadge:npt,htmlPreviewWrap:spt,htmlPreview:rpt,previewError:ipt,filePreviewWrap:opt},apt=740,lpt=700,cpt=["daily","weekdays","weekly","hourly","minutes","custom"],upt=[1,2,3,4,5,6,10,12,15,20,30];function dpt({artifacts:e,tabs:t,activeTabId:n,reviewChanges:s,selectedReviewPath:r,panelWidth:i,workspaceCwd:o,loading:a,error:c,onSelectTab:u,onCloseTab:d,onClose:h}){const m=t.find(b=>b.id===n)??t[0],p=fo(),g=(m==null?void 0:m.kind)==="artifact"||(m==null?void 0:m.kind)==="scheduled_task"?m.workspaceActions??p:p;return l.jsxs("aside",{className:Je.panel,style:i?{flexBasis:i,width:i}:void 0,"aria-label":"Right panel",children:[l.jsxs("div",{className:Je.header,children:[l.jsx("div",{className:Je.tabs,role:"tablist","aria-label":"Right panel",children:t.map(b=>l.jsxs("div",{className:[Je.tabItem,b.id===(m==null?void 0:m.id)?Je.tabActive:""].filter(Boolean).join(" "),children:[l.jsxs("button",{type:"button",role:"tab","aria-selected":b.id===(m==null?void 0:m.id),className:Je.tab,onClick:()=>u(b.id),title:b.title,children:[l.jsx("span",{className:Je.tabIcon,"aria-hidden":"true",children:b.kind==="review"?l.jsx(fpt,{}):b.kind==="artifact"?l.jsx(mpt,{}):l.jsx(ppt,{})}),b.title]}),l.jsx("button",{type:"button",className:Je.tabCloseButton,onClick:()=>d(b.id),"aria-label":`Close ${b.title}`,title:"Close",children:l.jsx(hpt,{})})]},b.id))}),l.jsx("button",{type:"button",className:Je.iconButton,onClick:h,"aria-label":"Close artifacts panel",title:"Close",children:"×"})]}),l.jsx("div",{className:Je.body,children:m?m.kind==="review"?l.jsx(ypt,{changes:s,selectedPath:r,panelWidth:i,workspaceCwd:o}):m.kind==="artifact"?l.jsx(gpt,{artifacts:e,artifactId:m.artifactId,workspaceActions:g,previewContent:m.previewContent,loading:a,error:c}):l.jsx(bpt,{task:m.task,actions:g},m.id):l.jsx("div",{className:Je.empty,children:"No panel selected."})})]})}function hpt(){return l.jsx("svg",{className:Je.tabCloseIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:l.jsx("path",{d:"m4.5 4.5 7 7M11.5 4.5l-7 7",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function fpt(){return l.jsxs("svg",{className:Je.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false",children:[l.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"1.6"}),l.jsx("path",{d:"M9 9.5h6M12 6.5v6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),l.jsx("path",{d:"M9 16h6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}function mpt(){return l.jsxs("svg",{className:Je.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false",children:[l.jsx("rect",{x:"6",y:"4",width:"12",height:"16",rx:"2",stroke:"currentColor",strokeWidth:"1.8"}),l.jsx("path",{d:"M9 10h6M9 14h4",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})]})}function ppt(){return l.jsxs("svg",{className:Je.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false",children:[l.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3",stroke:"currentColor",strokeWidth:"1.8"}),l.jsx("path",{d:"M12 8v4l3 2",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function gpt({artifacts:e,artifactId:t,workspaceActions:n,previewContent:s,loading:r,error:i}){const o=e.find(a=>a.id===t);return o?l.jsx(jpt,{artifact:o,workspaceActions:n,previewContent:s}):r?l.jsx("div",{className:Je.empty,children:"Loading artifact..."}):i?l.jsx("div",{className:Je.empty,children:i}):l.jsx("div",{className:Je.empty,children:"Artifact not found."})}function bpt({task:e,actions:t}){const{t:n}=ut(),[s,r]=f.useState(null),[i,o]=f.useState(!0),[a,c]=f.useState(null),[u,d]=f.useState(""),[h,m]=f.useState(e.prompt),[p,g]=f.useState(()=>Ch(e.cron)),[b,v]=f.useState(!1),[x,y]=f.useState(!1),[w,k]=f.useState(!1),[T,S]=f.useState(!1),[C,_]=f.useState(null),B=f.useCallback(async()=>{if(!e.durable){r(null),d(""),m(e.prompt),g(Ch(e.cron)),c(null),o(!1);return}o(!0),c(null);try{const X=(await t.listScheduledTasks()).find(J=>J.id===e.id)??null;r(X),X?(d(X.name??""),m(X.prompt),g(Ch(X.cron))):(d(""),m(e.prompt),g(Ch(e.cron)))}catch(se){c(se instanceof Error?se.message:String(se))}finally{o(!1)}},[t,e.cron,e.durable,e.id,e.prompt]);f.useEffect(()=>{B()},[B]);const A=!e.durable,N=e.durable&&!i&&!a&&!s,j=!!s,P=(s==null?void 0:s.name)||(s==null?void 0:s.prompt)||e.title,L=(s==null?void 0:s.prompt)??e.prompt,O=(s==null?void 0:s.cron)??e.cron,$=(s==null?void 0:s.recurring)??e.recurring,z=s==null?void 0:s.enabled,F=f.useCallback(()=>{s&&(d(s.name??""),m(s.prompt),g(Ch(s.cron)),_(null),v(!0))},[s]),G=f.useCallback(()=>{v(!1),_(null),s&&(d(s.name??""),m(s.prompt),g(Ch(s.cron)))},[s]),I=f.useCallback(async()=>{if(!s)return;const se=e4(p);if(!se){_(n("scheduledTasks.error.invalidSchedule"));return}if(h.trim().length===0){_(n("scheduledTasks.error.emptyPrompt"));return}S(!0),_(null);try{const X=await t.updateScheduledTask(s.id,{cron:se,prompt:h.trim(),name:u.trim()||null});r(X),d(X.name??""),m(X.prompt),g(Ch(X.cron)),v(!1)}catch(X){_(X instanceof Error?X.message:String(X))}finally{S(!1)}},[t,p,s,u,h,n]),Q=f.useCallback(async()=>{if(s){k(!0),_(null);try{const se=await t.updateScheduledTask(s.id,{enabled:!s.enabled});r(se)}catch(se){_(se instanceof Error?se.message:String(se))}finally{k(!1)}}},[t,s]),V=f.useCallback(async()=>{if(s){k(!0),_(null);try{await t.deleteScheduledTask(s.id),r(null),y(!1)}catch(se){_(se instanceof Error?se.message:String(se))}finally{k(!1)}}},[t,s]),M=e4(p),re=M?Zx(M,n):null;return l.jsxs("div",{className:Je.detail,children:[i&&l.jsx("div",{className:Je.empty,children:n("scheduledTasks.loading")}),a&&l.jsx("div",{className:ze.loadError,children:a}),N&&l.jsx("div",{className:Je.empty,children:n("scheduledTasks.deletedSnapshot")}),A&&l.jsx("div",{className:Je.empty,children:n("scheduledTasks.sessionScopedSnapshot")}),!N&&l.jsx("div",{className:Je.section,children:l.jsxs("div",{className:Je.fieldGrid,children:[l.jsx("span",{className:Je.fieldLabel,children:n("scheduledTasks.name")}),l.jsx("span",{className:Je.fieldValue,children:P}),l.jsx("span",{className:Je.fieldLabel,children:n("scheduledTasks.taskId")}),l.jsx("span",{className:Je.fieldValue,children:e.id}),l.jsx("span",{className:Je.fieldLabel,children:n("scheduledTasks.schedule")}),l.jsx("span",{className:Je.fieldValue,children:Zx(O,n)}),l.jsx("span",{className:Je.fieldLabel,children:"Cron"}),l.jsx("span",{className:Je.fieldValue,children:O}),l.jsx("span",{className:Je.fieldLabel,children:n("scheduledTasks.type")}),l.jsx("span",{className:Je.fieldValue,children:n($?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),z!==void 0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Je.fieldLabel,children:n("scheduledTasks.status")}),l.jsx("span",{className:Je.fieldValue,children:n(z?"scheduledTasks.enable":"scheduledTasks.disable")})]})]})}),!N&&l.jsxs("div",{className:Je.section,children:[l.jsx("div",{className:Je.sectionTitle,children:"Prompt"}),l.jsx("div",{className:Je.description,children:L})]}),C&&l.jsx("div",{className:ze.formError,children:C}),l.jsxs("div",{className:Je.actionsRow,children:[l.jsx("button",{type:"button",className:ze.primaryButton,disabled:!j||w,onClick:F,children:n("scheduledTasks.edit")}),l.jsx("button",{type:"button",className:ze.secondaryButton,disabled:!j||w,onClick:()=>void Q(),children:s!=null&&s.enabled?n("scheduledTasks.disable"):n("scheduledTasks.enable")}),l.jsx("button",{type:"button",className:ze.secondaryButton,disabled:!j||w,onClick:()=>y(!0),children:n("scheduledTasks.delete")})]}),x&&s&&l.jsx(Qr,{title:n("scheduledTasks.deleteConfirmTitle"),size:"sm",onClose:()=>y(!1),children:l.jsxs("div",{className:ze.formFields,children:[l.jsx("div",{className:Je.description,children:n("scheduledTasks.deleteConfirm",{name:s.name||s.prompt})}),C&&l.jsx("div",{className:ze.formError,children:C}),l.jsxs("div",{className:ze.formActions,children:[l.jsx("button",{type:"button",className:ze.secondaryButton,onClick:()=>y(!1),disabled:w,children:n("scheduledTasks.cancel")}),l.jsx("button",{type:"button",className:ze.primaryButton,onClick:()=>void V(),disabled:w,children:n("scheduledTasks.delete")})]})]})}),b&&l.jsx(Qr,{title:n("scheduledTasks.editTitle"),size:"md",onClose:G,children:l.jsxs("div",{className:ze.formFields,children:[l.jsxs("label",{className:ze.field,children:[l.jsx("span",{className:ze.fieldLabel,children:n("scheduledTasks.name")}),l.jsx("input",{className:ze.input,type:"text",value:u,maxLength:200,placeholder:n("scheduledTasks.namePlaceholder"),onChange:se=>d(se.target.value)})]}),l.jsxs("label",{className:ze.field,children:[l.jsxs("span",{className:ze.fieldLabel,children:[n("scheduledTasks.prompt"),l.jsx("span",{className:ze.required,children:"*"})]}),l.jsx("textarea",{className:ze.textarea,value:h,rows:4,maxLength:1e5,placeholder:n("scheduledTasks.promptPlaceholder"),onChange:se=>m(se.target.value)})]}),l.jsxs("div",{className:ze.scheduleRow,children:[l.jsxs("label",{className:ze.field,children:[l.jsx("span",{className:ze.fieldLabel,children:n("scheduledTasks.frequency")}),l.jsx("select",{className:ze.select,value:p.frequency,onChange:se=>{const X=se.target.value;g(J=>({...J,frequency:X,...X==="hourly"?{time:"00:00"}:{}}))},children:cpt.map(se=>l.jsx("option",{value:se,children:n(`scheduledTasks.freq.${se}`)},se))})]}),(p.frequency==="daily"||p.frequency==="weekdays"||p.frequency==="weekly")&&l.jsxs("label",{className:ze.field,children:[l.jsx("span",{className:ze.fieldLabel,children:n("scheduledTasks.time")}),l.jsx("input",{className:ze.input,type:"time",value:p.time,onChange:se=>g(X=>({...X,time:se.target.value}))})]}),p.frequency==="weekly"&&l.jsxs("label",{className:ze.field,children:[l.jsx("span",{className:ze.fieldLabel,children:n("scheduledTasks.weekday")}),l.jsx("select",{className:ze.select,value:p.weekday,onChange:se=>g(X=>({...X,weekday:Number(se.target.value)})),children:n("scheduledTasks.weekdayNames").split(",").map((se,X)=>l.jsx("option",{value:X,children:se},X))})]}),p.frequency==="minutes"&&l.jsxs("label",{className:ze.field,children:[l.jsx("span",{className:ze.fieldLabel,children:n("scheduledTasks.interval")}),l.jsx("select",{className:ze.select,value:p.minuteInterval,onChange:se=>g(X=>({...X,minuteInterval:Number(se.target.value)})),children:upt.map(se=>l.jsx("option",{value:se,children:se},se))})]}),p.frequency==="custom"&&l.jsxs("label",{className:`${ze.field} ${ze.fieldGrow}`,children:[l.jsx("span",{className:ze.fieldLabel,children:n("scheduledTasks.cron")}),l.jsx("input",{className:ze.input,type:"text",value:p.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:se=>g(X=>({...X,customCron:se.target.value}))})]})]}),l.jsx("div",{className:ze.preview,children:re?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:ze.previewLabel,children:re}),l.jsx("code",{className:ze.previewCron,children:M})]}):l.jsx("span",{className:ze.previewInvalid,children:n("scheduledTasks.error.invalidSchedule")})}),C&&l.jsx("div",{className:ze.formError,children:C}),l.jsxs("div",{className:ze.formActions,children:[l.jsx("button",{type:"button",className:ze.secondaryButton,onClick:G,disabled:T,children:n("scheduledTasks.cancel")}),l.jsx("button",{type:"button",className:ze.primaryButton,onClick:()=>void I(),disabled:T,children:n(T?"scheduledTasks.saving":"scheduledTasks.save")})]})]})})]})}function ypt({changes:e,selectedPath:t,panelWidth:n,workspaceCwd:s}){const{t:r}=ut(),[i,o]=f.useState(()=>!n||n>=apt),[a,c]=f.useState(!0),[u,d]=f.useState(!1),[h,m]=f.useState(520),p=f.useRef(h),g=f.useRef(null),b=f.useRef(null),[v,x]=f.useState(null),y=i,w=f.useMemo(()=>Apt(e,s),[e,s]);f.useEffect(()=>{x(t)},[t]),f.useEffect(()=>{p.current=h},[h]),f.useEffect(()=>{const C=g.current;if(!C)return;const _=()=>{d(C.clientWidth<lpt)};_();const B=new ResizeObserver(_);return B.observe(C),()=>B.disconnect()},[a]),f.useEffect(()=>()=>{var C;return(C=b.current)==null?void 0:C.call(b)},[]);const k=f.useCallback(C=>{const _=g.current;if(!_)return;C.preventDefault();const B=C.currentTarget;B.setPointerCapture(C.pointerId);const A=C.clientX,N=p.current,j=_.getBoundingClientRect().width,P=Math.max(180,j-180),L=document.body.style.cursor,O=document.body.style.userSelect;let $=N,z=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const F=()=>{z=null,m($)},G=V=>{$=Math.min(P,Math.max(180,N+(V.clientX-A))),z===null&&(z=window.requestAnimationFrame(F))};let I=()=>{};const Q=V=>{b.current=null,z!==null&&(window.cancelAnimationFrame(z),z=null),V&&m($),B.hasPointerCapture(C.pointerId)&&B.releasePointerCapture(C.pointerId),document.body.style.cursor=L,document.body.style.userSelect=O,window.removeEventListener("pointermove",G),window.removeEventListener("pointerup",I),window.removeEventListener("pointercancel",I)};I=()=>Q(!0),b.current=()=>Q(!1),window.addEventListener("pointermove",G),window.addEventListener("pointerup",I),window.addEventListener("pointercancel",I)},[]);if(e.length===0)return l.jsx("div",{className:Je.empty,children:"No file changes to review."});const T=nie(e),S=C=>{x(_=>_===C?null:C)};return l.jsxs("div",{className:Je.review,children:[l.jsxs("div",{className:Je.reviewToolbar,children:[l.jsxs("div",{className:Je.reviewToolbarTitle,children:[l.jsx("span",{children:r("turnOutputs.previousTurn")}),l.jsx(t4,{additions:T==null?void 0:T.additions,deletions:T==null?void 0:T.deletions,className:Je.lineStats,additionsClassName:Je.additions,deletionsClassName:Je.deletions})]}),l.jsxs("div",{className:Je.reviewToolbarActions,children:[l.jsxs("button",{type:"button",className:Je.reviewTotalsButton,onClick:()=>c(C=>!C),"aria-expanded":a,children:[l.jsx("span",{children:r("turnOutputs.fileCount",{count:e.length})}),l.jsx("span",{className:[Je.chevron,a?Je.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:l.jsx(Xq,{})})]}),l.jsx("button",{type:"button",className:[Je.iconButton,i?Je.iconButtonActive:""].filter(Boolean).join(" "),onClick:()=>o(C=>!C),"aria-label":r(i?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),title:r(i?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),children:i?l.jsx(Tpt,{}):l.jsx(Cpt,{})})]})]}),a&&l.jsxs("div",{ref:g,className:[Je.reviewContent,y?"":Je.reviewContentListOnly,y&&u?Je.reviewContentStacked:""].filter(Boolean).join(" "),style:{"--review-list-width":`${h}px`},children:[l.jsx("div",{className:[Je.reviewList,v?Je.reviewListWithExpanded:""].filter(Boolean).join(" "),children:e.map(C=>{const _=v===C.path;return l.jsxs("div",{className:[Je.reviewItem,_?Je.reviewItemExpanded:""].filter(Boolean).join(" "),children:[l.jsxs("button",{type:"button",className:Je.reviewRow,"data-selected":C.path===t||void 0,onClick:()=>S(C.path),children:[l.jsx("span",{className:Je.fileIcon,children:goe(C.path)}),l.jsx(kpt,{path:CI(C.path,s),title:C.path}),l.jsx(t4,{additions:C.additions,deletions:C.deletions,className:Je.lineStats,additionsClassName:Je.additions,deletionsClassName:Je.deletions}),l.jsx("span",{className:[Je.chevron,_?Je.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:l.jsx(Xq,{})})]}),_&&l.jsx(xpt,{change:C})]},`${C.toolCallId}:${C.path}`)})}),y&&!u&&l.jsx("div",{className:Je.reviewSplitHandle,role:"separator","aria-orientation":"vertical",onPointerDown:k}),y&&l.jsx("div",{className:Je.tree,children:w.children.map(C=>l.jsx(foe,{node:C,depth:0,selectedPath:t},C.path))})]})]})}function xpt({change:e}){if(e.diffs.length===0)return l.jsx("div",{className:Je.diffEmpty,children:"No diff available."});const t=vpt(e.diffs);return l.jsx("div",{className:Je.diffPreview,children:t.map((n,s)=>l.jsx(wpt,{oldText:n.oldText,newText:n.newText},s))})}function vpt(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 wpt({oldText:e,newText:t}){const n=f.useRef(null),[s,r]=f.useState(null),[i,o]=f.useState(null);return f.useEffect(()=>{const a=n.current;if(!a)return;const c=()=>r(a.clientWidth>=720);c();const u=new ResizeObserver(c);return u.observe(a),()=>u.disconnect()},[]),f.useEffect(()=>{const a=n.current;if(!a||s===null)return;a.replaceChildren(),o(null);let c=!1,u=null;const d=[rre,It.editable.of(!1),qs.readOnly.of(!0),It.lineWrapping],h={scanLimit:1e3,timeout:500},m={margin:3,minSize:8};return ie(async()=>{const{MergeView:p,unifiedMergeView:g}=await import("./index-wFXp7W68.js");return{MergeView:p,unifiedMergeView:g}},[]).then(({MergeView:p,unifiedMergeView:g})=>{if(!c)try{if(s){u=new p({a:{doc:e,extensions:d},b:{doc:t,extensions:d},parent:a,highlightChanges:!0,gutter:!0,revertControls:void 0,collapseUnchanged:m,diffConfig:h});return}u=new It({doc:t,extensions:[...d,g({original:e,highlightChanges:!0,gutter:!0,mergeControls:!1,allowInlineDiffs:!0,collapseUnchanged:m,diffConfig:h})],parent:a})}catch(b){c||o(b instanceof Error?b.message:String(b))}}).catch(p=>{c||o(p instanceof Error?p.message:String(p))}),()=>{c=!0,u==null||u.destroy()}},[s,t,e]),l.jsxs("div",{className:Je.codeMirrorDiffWrap,children:[l.jsx("div",{ref:n,className:Je.codeMirrorDiff}),i&&l.jsxs("div",{className:Je.diffError,children:["Diff unavailable: ",i]})]})}function foe({node:e,depth:t,selectedPath:n}){var d,h;const s=!!e.file,[r,i]=f.useState(!0),o=[Je.treeRow,s?Je.treeFile:Je.treeFolder].filter(Boolean).join(" "),a={paddingLeft:10+t*18,"--tree-row-line-left":`${19+Math.max(0,t-1)*18}px`},c={"--tree-children-line-left":`${19+t*18}px`},u=l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Je.treeTwisty,children:!s&&l.jsx("span",{className:[Je.treeChevron,r?"":Je.treeChevronClosed].filter(Boolean).join(" "),children:l.jsx(Ept,{})})}),l.jsxs("span",{className:Je.treeContent,children:[s&&l.jsx("span",{className:Je.fileIcon,children:goe(e.path)}),l.jsx("span",{className:Je.treeName,children:e.name})]}),((d=e.file)==null?void 0:d.isArtifact)&&l.jsx("span",{className:Je.reviewBadge,children:"artifact"})]});return l.jsxs("div",{className:Je.treeNode,children:[s?l.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:u}):l.jsx("button",{type:"button",className:o,"data-depth":t,style:a,title:e.path,"aria-expanded":r,onClick:()=>i(m=>!m),children:u}),!s&&r&&e.children.length>0&&l.jsx("div",{className:Je.treeChildren,style:c,children:e.children.map(m=>l.jsx(foe,{node:m,depth:t+1,selectedPath:n},m.path))})]})}function kpt({path:e,title:t}){const n=f.useRef(null),[s,r]=f.useState(()=>moe(e));return f.useLayoutEffect(()=>{const i=n.current;if(!i)return;const o=()=>r(_pt(e,i));o();const a=new ResizeObserver(o);return a.observe(i),()=>a.disconnect()},[e]),l.jsxs("span",{ref:n,className:Je.reviewPath,title:t??e,children:[s.prefix&&l.jsx("span",{className:Je.pathPrefix,children:s.prefix}),l.jsx("span",{className:Je.pathFileName,children:s.leaf})]})}function moe(e){const t=e.lastIndexOf("/");return t<0?{prefix:"",leaf:e}:{prefix:e.slice(0,t+1),leaf:e.slice(t+1)}}let Yq=null;function _pt(e,t){const n=moe(e),s=t.clientWidth;if(s<=0)return n;const r=Spt(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 c=".../";for(let u=1;u<i.length;u++){const h=`.../${i.slice(i.length-1-u,-1).join("/")}/`;if(r(h)+a>s)break;c=h}return{prefix:c,leaf:o}}function Spt(e){Yq??(Yq=document.createElement("canvas"));const t=Yq.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 Cpt(){return l.jsxs("svg",{className:Je.toolbarIcon,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[l.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"}),l.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 Tpt(){return l.jsxs("svg",{className:Je.toolbarIcon,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[l.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"}),l.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 Xq(){return l.jsx("svg",{className:Je.chevronIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:l.jsx("path",{d:"m6 4 4 4-4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ept(){return l.jsx("svg",{className:Je.treeChevronIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:l.jsx("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function Apt(e,t){const n={name:"",path:"",children:[]};for(const s of e){const r=CI(s.path,t).split("/").filter(Boolean);let i=n;for(let o=0;o<r.length;o++){const a=r[o],c=r.slice(0,o+1).join("/");let u=i.children.find(d=>d.name===a);u||(u={name:a,path:c,children:[]},i.children.push(u)),o===r.length-1&&(u.file=s),i=u}}return poe(n),n}function poe(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)poe(t)}function Npt(e){return Cp(e).split("/").filter(Boolean).at(-1)??e}function goe(e){var r;const t=Npt(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 jpt({artifact:e,workspaceActions:t,previewContent:n}){var c;const s=EWe(e),r=rte(e.url)?e.url:void 0,i=((c=e.metadata)==null?void 0:c.artifactType)==="automation_snapshot",o=e.storage==="workspace"&&!!e.workspacePath;return o&&e.workspacePath&&Mpt(e)&&e.workspacePath?l.jsx(Ipt,{workspacePath:e.workspacePath,artifactVersion:e.updatedAt,workspaceActions:t,previewContent:n}):o&&e.workspacePath?l.jsx(Rpt,{workspacePath:e.workspacePath,artifactVersion:e.updatedAt,workspaceActions:t}):l.jsxs("div",{className:Je.detail,children:[l.jsxs("div",{className:Je.section,children:[l.jsx("div",{className:Je.sectionTitle,children:i?"Automation Snapshot":"Artifact"}),l.jsxs("div",{className:Je.fieldGrid,children:[l.jsx(ru,{label:"Type",value:Zre(e.kind)}),l.jsx(ru,{label:"Storage",value:e.storage}),l.jsx(ru,{label:"Status",value:e.status}),l.jsx(ru,{label:"Source",value:e.source}),l.jsx(ru,{label:"Size",value:eie(e.sizeBytes)}),l.jsx(ru,{label:"Created",value:e.createdAt}),l.jsx(ru,{label:"Updated",value:e.updatedAt}),e.toolName&&l.jsx(ru,{label:"Tool",value:e.toolName}),e.toolCallId&&l.jsx(ru,{label:"Tool call",value:e.toolCallId})]})]}),e.description&&l.jsxs("div",{className:Je.section,children:[l.jsx("div",{className:Je.sectionTitle,children:"Description"}),l.jsx("div",{className:Je.description,children:e.description})]}),i&&e.metadata&&l.jsxs("div",{className:Je.section,children:[l.jsx("div",{className:Je.sectionTitle,children:"Details"}),l.jsxs("div",{className:Je.fieldGrid,children:[x0(e.metadata,"automationId","Automation ID"),x0(e.metadata,"schedule","Schedule"),x0(e.metadata,"timezone","Timezone"),x0(e.metadata,"status","Status"),x0(e.metadata,"nextRunAt","Next run"),x0(e.metadata,"prompt","Prompt")]})]}),(s||r)&&l.jsxs("div",{className:Je.section,children:[l.jsx("div",{className:Je.sectionTitle,children:"Location"}),r?l.jsx("a",{className:Je.link,href:r,target:"_blank",rel:"noreferrer",children:r}):l.jsx("div",{className:Je.meta,children:s})]})]})}function Mpt(e){var n;const t=((n=e.workspacePath)==null?void 0:n.toLowerCase())??"";return e.kind==="html"||t.endsWith(".html")||t.endsWith(".htm")}function Ipt({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s}){const[r,i]=f.useState(s??null),[o,a]=f.useState(null);return f.useEffect(()=>{let c=!1;return i(s??null),a(null),n.readWorkspaceFile(e).then(u=>{c||(i(u.content),u.truncated&&a("Preview is truncated because the file is too large."))}).catch(u=>{c||a(u instanceof Error?u.message:String(u))}),()=>{c=!0}},[t,s,n,e]),l.jsxs("div",{className:Je.htmlPreviewWrap,children:[r===null?l.jsx("div",{className:Je.empty,children:"Loading preview..."}):l.jsx("iframe",{className:Je.htmlPreview,referrerPolicy:"no-referrer",sandbox:"",srcDoc:AWe(r),title:`Preview ${e}`}),o&&l.jsx("div",{className:Je.previewError,children:o})]})}function Rpt({workspacePath:e,artifactVersion:t,workspaceActions:n}){const s=f.useRef(null),[r,i]=f.useState(null),[o,a]=f.useState(null);return f.useEffect(()=>{let c=!1;return i(null),a(null),n.readWorkspaceFile(e).then(u=>{c||(i(u.content),u.truncated&&a("File is truncated because it is too large."))}).catch(u=>{c||a(u instanceof Error?u.message:String(u))}),()=>{c=!0}},[t,n,e]),f.useEffect(()=>{const c=s.current;if(!c||r===null)return;c.replaceChildren();let u;try{u=new It({doc:r,extensions:[rre,It.editable.of(!1),qs.readOnly.of(!0),It.lineWrapping],parent:c})}catch(d){a(d instanceof Error?d.message:String(d));return}return()=>u.destroy()},[r]),l.jsxs("div",{className:Je.filePreviewWrap,children:[r===null?l.jsx("div",{className:Je.empty,children:"Loading file..."}):l.jsx("div",{ref:s,className:Je.codeMirrorFile}),o&&l.jsx("div",{className:Je.previewError,children:o})]})}function ru({label:e,value:t}){return t?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Je.fieldLabel,children:e}),l.jsx("span",{className:Je.fieldValue,children:t})]}):null}function x0(e,t,n){const s=e[t];return s==null||s===""?null:l.jsx(ru,{label:n,value:String(s)},t)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Dpt="(min-width: 1024px)";function Qq(e=Dpt){const[t,n]=f.useState(()=>Lpt(e));return f.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 Lpt(e){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(e).matches}function boe(e){try{return new Date(e).toLocaleString()}catch{return String(e)}}function Ppt(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`${boe(e.at)}${n}${s}`}function kh(e){return`${e.workspaceId??""}:${e.id}`}const Opt=["daily","weekdays","weekly","hourly","minutes","custom"],Bpt=[1,2,3,4,5,6,10,12,15,20,30],$pt=2147483647,zpt=3,Fpt=3e4,ev=1e5,qpt=/[^\p{L}\p{N}_.-]/gu,Jq=/(^|[\s])(@(?:ext|mcp):(?:\\.[^\s\\]*|[^\s\\])+|\/(?:\\.[^\s\\/]*|[^\s\\/])+)(?=$|\s)/gu,Hpt=["--background","--foreground","--muted","--muted-foreground","--border","--error-color","--font-mono"];function e8(e){return e.replace(qpt,"\\$&")}function t8(e){return e.replace(/\\(.)/g,"$1")}function Upt(e){if(e.startsWith("@ext:")){const t=t8(e.slice(5));return{id:`extension:${t}`,kind:"extension",label:t,insertText:e}}if(e.startsWith("@mcp:")){const t=t8(e.slice(5));return{id:`mcp:${t}`,kind:"mcp",label:t,insertText:e}}if(e.startsWith("/")){const t=t8(e.slice(1));return t?{id:`skill:${t}`,kind:"skill",label:t,insertText:e}:null}return null}function Vpt(e){return e.displayName&&e.displayName!==e.name?e.displayName:e.description}function Wpt(e){return e.description||e.argumentHint||e.level}function Gpt(e){return e.description||e.mcpStatus}function yoe(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+=yoe(s)}),e.tagName==="DIV"||e.tagName==="P"?`${n}
`:n}function xoe(e){let t="";return e.childNodes.forEach(n=>{t+=yoe(n)}),t}function voe(e){return e.replace(/\u00a0/g," ").replace(/\n$/,"")}function uC(e){return voe(xoe(e))}function Kpt(e){return voe(xoe(e))}function DI(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function n8(e,t){t&&e.appendChild(document.createTextNode(t))}function woe(e,t){if(DI(e),!t)return;t.split(`
`).forEach((s,r)=>{r>0&&e.appendChild(document.createElement("br")),Ypt(e,s)})}function Zq(e){let t=uC(e);return t.length>ev?(t=t.slice(0,ev),woe(e,t)):t.trim().length===0&&(DI(e),t=""),t}function eH(e,t){const n=ev-uC(e).length;n<=0||document.execCommand("insertText",!1,t.slice(0,n))}function tH(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:Kpt(n.cloneContents())}:null}function koe(e){const t=document.createElement("span");t.className=ze.promptTag,t.contentEditable="false",t.dataset.promptTagSerialized=e.insertText.trim();const n=Dp(e.kind);if(n){const r=document.createElement("span");r.className=ze.promptTagIcon,r.style.setProperty("--composer-tag-icon-url",Z3(n)),r.setAttribute("aria-hidden","true"),t.appendChild(r)}const s=document.createElement("span");return s.className=ze.promptTagValue,s.textContent=e.label,t.appendChild(s),t}function Ypt(e,t){let n=0;Jq.lastIndex=0;for(const s of t.matchAll(Jq)){const[r,i,o]=s,a=s.index??0,c=Upt(o);c&&(n8(e,t.slice(n,a)),n8(e,i),e.appendChild(koe(c)),n=a+r.length)}n8(e,t.slice(n))}function Xpt(e,t){var a;const n=window.getSelection(),s=koe(t),r=document.createTextNode(" ");uC(e).trim().length===0&&DI(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 Qpt({value:e,label:t,placeholder:n,onChange:s,insertItem:r,onInserted:i}){const o=f.useRef(null),a=f.useRef("");return f.useEffect(()=>{const c=o.current;c&&e!==a.current&&(woe(c,e),a.current=e)},[e]),f.useEffect(()=>{const c=o.current;if(!c||!r)return;Xpt(c,r);const u=uC(c);a.current=u,s(u),c.focus(),i()},[r,s,i]),l.jsxs("div",{className:ze.promptEditorWrap,children:[l.jsx("div",{ref:o,className:ze.promptEditor,contentEditable:!0,role:"textbox","aria-label":t,"aria-multiline":"true","aria-placeholder":n,onInput:c=>{const u=Zq(c.currentTarget);a.current=u,s(u)},onPaste:c=>{c.preventDefault(),eH(c.currentTarget,c.clipboardData.getData("text/plain"))},onDrop:c=>{c.preventDefault(),eH(c.currentTarget,c.dataTransfer.getData("text/plain"))},onCopy:c=>{const u=tH(c.currentTarget);u&&(c.preventDefault(),c.clipboardData.setData("text/plain",u.text))},onCut:c=>{const u=tH(c.currentTarget);if(!u)return;c.preventDefault(),c.clipboardData.setData("text/plain",u.text),u.selection.deleteFromDocument();const d=Zq(c.currentTarget);a.current=d,s(d)}}),e.trim().length===0&&l.jsx("div",{className:ze.promptPlaceholder,children:n})]})}function Jpt({onRunPrompt:e,onCreateViaChat:t,onOpenSession:n,workspaces:s,lockedWorkspace:r,onError:i}){const{t:o}=ut(),a=fo(),c=f.useMemo(()=>s??[],[s]),u=!r&&c.length>1,d=f.useMemo(()=>c.filter(ue=>ue.primary||ue.trusted),[c]),h=f.useCallback(ue=>ue.primary?void 0:ue.id,[]),m=r?h(r):void 0,[p,g]=f.useState(null),[b,v]=f.useState(null),[x,y]=f.useState(null),[w,k]=f.useState(null),[T,S]=f.useState(!1),[C,_]=f.useState(null),[B,A]=f.useState(m),[N,j]=f.useState(""),[P,L]=f.useState(""),[O,$]=f.useState(au),[z,F]=f.useState(!1),[G,I]=f.useState(null),[Q,V]=f.useState(null),[M,re]=f.useState([]),[se,X]=f.useState(!1),[J,de]=f.useState(null),[W,te]=f.useState(null),U=f.useRef(null),ee=f.useRef(null),[oe,Ce]=f.useState(null),[he,ye]=f.useState({}),[Ve,it]=f.useState(null),[At,Ee]=f.useState(()=>Date.now()),me=f.useRef(!0),bt=f.useRef(0),et=f.useRef(0);f.useEffect(()=>(me.current=!0,()=>{me.current=!1}),[]);const qe=f.useCallback(async()=>{const ue=++bt.current;try{let Fe,kt=null;if(r?Fe=(await a.listScheduledTasks(m)).map(Pe=>({...Pe,workspaceId:m,workspaceCwd:r.cwd})):u?Fe=(await Promise.all(d.map(async yn=>{try{return(await a.listScheduledTasks(h(yn))).map(Ne=>({...Ne,workspaceId:h(yn),workspaceCwd:yn.cwd}))}catch(je){return kt||(kt=je instanceof Error?je.message:String(je)),[]}}))).flat():Fe=await a.listScheduledTasks(),!me.current||ue!==bt.current)return;const bn=[...Fe].sort((Pe,yn)=>yn.createdAt-Pe.createdAt);g(bn),v(kt)}catch(Fe){if(!me.current||ue!==bt.current)return;v(Fe instanceof Error?Fe.message:String(Fe)),g(kt=>kt??[])}},[a,u,r,m,d,h]);f.useEffect(()=>{qe()},[qe]);const Ke=!!(p!=null&&p.some(ue=>ue.nextRunAt!=null));f.useEffect(()=>{if(!Ke)return;const ue=window.setInterval(()=>Ee(Date.now()),1e3);return()=>window.clearInterval(ue)},[Ke]);const ke=f.useRef(0);f.useEffect(()=>{if(!p)return;let ue=1/0;for(const Pe of p)Pe.nextRunAt!=null&&Pe.nextRunAt<ue&&(ue=Pe.nextRunAt);if(!Number.isFinite(ue))return;const Fe=ue-Date.now();let kt;Fe>0?(ke.current=0,kt=Math.min(Fe+2e3,$pt)):kt=ke.current++<zpt?1e3:Fpt;const bn=window.setTimeout(()=>void qe(),kt);return()=>window.clearTimeout(bn)},[p,qe]);const ne=e4(O),gt=ne?Zx(ne,o):null,We=f.useCallback(()=>{const ue=U.current;if(!ue){Ce(null);return}const Fe=getComputedStyle(ue);ye(Object.fromEntries(Hpt.map(Ne=>[Ne,Fe.getPropertyValue(Ne)])));const kt=ue.getBoundingClientRect(),bn=Math.min(420,window.innerWidth-24),Pe=Math.max(12,Math.min(kt.left,window.innerWidth-bn-12)),yn=kt.bottom+6,je=Math.max(140,Math.min(320,window.innerHeight-yn-12));Ce(Ne=>{const ot={left:Pe,top:yn,width:bn,maxHeight:je};return Ne&&Ne.left===ot.left&&Ne.top===ot.top&&Ne.width===ot.width&&Ne.maxHeight===ot.maxHeight?Ne:ot})},[]),tt=f.useCallback(()=>{et.current+=1,V(null),re([]),X(!1),de(null),te(null),Ce(null),ye({})},[]),jt=f.useCallback(async ue=>{const Fe=++et.current;if(Q===ue){tt();return}We(),V(ue),X(!0),de(null),re([]);try{let kt;if(ue==="extension"?kt=((await a.loadExtensionsStatus()).extensions??[]).filter(Pe=>Pe.isActive).map(Pe=>({id:Pe.id||Pe.name,kind:ue,label:Pe.name,description:Vpt(Pe),insertText:`@ext:${e8(Pe.name)} `})):ue==="skill"?kt=((await a.loadSkillsStatus()).skills??[]).filter(Pe=>Pe.modelInvocable).map(Pe=>({id:Pe.name,kind:ue,label:Pe.name,description:Wpt(Pe),insertText:`/${e8(Pe.name)} `})):kt=((await a.loadMcpStatus()).servers??[]).filter(Pe=>!Pe.disabled).map(Pe=>({id:Pe.name,kind:ue,label:Pe.name,description:Gpt(Pe),insertText:`@mcp:${e8(Pe.name)} `})),!me.current||Fe!==et.current)return;re(kt)}catch(kt){if(!me.current||Fe!==et.current)return;de(kt instanceof Error?kt.message:String(kt))}finally{me.current&&Fe===et.current&&X(!1)}},[a,Q,tt,We]);f.useEffect(()=>{if(!Q)return;We();const ue=bn=>{const Pe=U.current,yn=ee.current;Pe!=null&&Pe.contains(bn.target)||yn!=null&&yn.contains(bn.target)||tt()},Fe=bn=>{bn.key==="Escape"&&(bn.preventDefault(),bn.stopPropagation(),tt())},kt=()=>We();return document.addEventListener("pointerdown",ue),document.addEventListener("keydown",Fe,!0),window.addEventListener("resize",kt),window.addEventListener("scroll",kt,!0),()=>{document.removeEventListener("pointerdown",ue),document.removeEventListener("keydown",Fe,!0),window.removeEventListener("resize",kt),window.removeEventListener("scroll",kt,!0)}},[Q,tt,We]);const jn=f.useCallback(()=>{j(""),L(""),$(au),I(null),S(!1),_(null),A(m),tt()},[m,tt]),kn=f.useCallback(()=>{_(null),A(m),j(""),L(""),$(au),I(null),tt(),S(!0)},[m,tt]),Be=f.useCallback(ue=>{_(ue.id),A(ue.workspaceId),j(ue.name??""),L(ue.prompt),$(Ch(ue.cron)),I(null),tt(),S(!0)},[tt]),ht=f.useCallback(async()=>{const ue=e4(O);if(!ue){I(o("scheduledTasks.error.invalidSchedule"));return}if(P.trim().length===0){I(o("scheduledTasks.error.emptyPrompt"));return}if(P.length>ev){I(o("scheduledTasks.error.promptTooLong",{max:ev}));return}F(!0),I(null);try{if(C?await a.updateScheduledTask(C,{cron:ue,prompt:P.trim(),name:N.trim()||null},B):await a.createScheduledTask({cron:ue,prompt:P.trim(),name:N.trim()||null,recurring:!0,enabled:!0},B),!me.current)return;jn(),await qe()}catch(Fe){if(!me.current)return;I(Fe instanceof Error?Fe.message:String(Fe))}finally{me.current&&F(!1)}},[a,O,C,B,N,P,qe,jn,o]),ve=f.useCallback(async ue=>{y(kh(ue));try{await a.updateScheduledTask(ue.id,{enabled:!ue.enabled},ue.workspaceId),await qe()}catch(Fe){i(Fe,o("scheduledTasks.error.toggleFailed"))}finally{me.current&&y(null)}},[a,i,qe,o]),Me=f.useCallback(async ue=>{if(!(!ue.enabled||w!==null)){k(ue.id);try{const Fe=(await a.listScheduledTasks(ue.workspaceId)).find(kt=>kt.id===ue.id);if(!Fe||!Fe.enabled){await qe().catch(()=>{}),i(new Error("This task is no longer runnable."),o("scheduledTasks.error.runFailed"));return}if(Fe.recurring){await e(Fe.prompt,Fe.sessionId);try{await a.runScheduledTask(Fe.id,ue.workspaceId),await qe()}catch(kt){i(kt,o("scheduledTasks.error.runFailed"))}}else{await a.runScheduledTask(Fe.id,ue.workspaceId),await qe();try{await e(Fe.prompt,Fe.sessionId)}catch(kt){i(kt,o("scheduledTasks.error.oneShotConsumedButFailed"));return}}}catch(Fe){i(Fe,o("scheduledTasks.error.runFailed"))}finally{k(null)}}},[a,i,e,qe,w,o]),_e=f.useCallback(async ue=>{const Fe=ue.name||ue.prompt,kt=Fe.length>60?`${Fe.slice(0,57)}…`:Fe;if(window.confirm(o("scheduledTasks.deleteConfirm",{name:kt}))){y(kh(ue));try{await a.deleteScheduledTask(ue.id,ue.workspaceId),await qe()}catch(bn){i(bn,o("scheduledTasks.error.deleteFailed"))}finally{me.current&&y(null)}}},[a,i,qe,o]),Xe=Q&&oe?ju.createPortal(l.jsx("div",{ref:ee,className:ze.referencePicker,role:"listbox","aria-label":o("scheduledTasks.referencePicker"),style:{...he,left:oe.left,top:oe.top,width:oe.width,maxHeight:oe.maxHeight},children:se?l.jsx("div",{className:ze.referenceEmpty,children:o("scheduledTasks.reference.loading")}):J?l.jsx("div",{className:ze.referenceError,children:J}):M.length===0?l.jsx("div",{className:ze.referenceEmpty,children:o("scheduledTasks.reference.empty")}):M.map(ue=>l.jsxs("button",{type:"button",className:ze.referenceItem,role:"option","aria-selected":"false",onMouseDown:Fe=>Fe.preventDefault(),onClick:()=>{te(ue),V(null)},children:[l.jsx("span",{className:ze.referenceItemLabel,children:ue.label}),ue.description&&l.jsx("span",{className:ze.referenceItemDescription,children:ue.description})]},`${ue.kind}:${ue.id}`))}),document.body):null;return l.jsxs("div",{className:ze.root,children:[l.jsx("div",{className:ze.intro,children:o("scheduledTasks.subtitle")}),l.jsxs("div",{className:ze.toolbar,children:[l.jsx("div",{className:ze.count,children:p===null?o("scheduledTasks.loading"):o("scheduledTasks.count",{count:p.length})}),l.jsxs("div",{className:ze.toolbarActions,children:[l.jsx("button",{type:"button",className:ze.secondaryButton,onClick:()=>void qe(),children:o("scheduledTasks.refresh")}),l.jsx("button",{type:"button",className:ze.secondaryButton,onClick:t,children:o("scheduledTasks.createViaChat")}),l.jsx("button",{type:"button",className:ze.primaryButton,onClick:kn,children:o("scheduledTasks.new")})]})]}),T&&l.jsx(Qr,{title:o(C?"scheduledTasks.editTitle":"scheduledTasks.new"),size:"md",onClose:jn,children:l.jsxs("div",{className:ze.formFields,children:[u&&l.jsxs("label",{className:ze.field,children:[l.jsx("span",{className:ze.fieldLabel,children:o("scheduledTasks.workspace")}),l.jsx("select",{className:ze.select,value:B??"",disabled:!!C||d.length<=1,onChange:ue=>A(ue.target.value||void 0),children:d.map(ue=>l.jsx("option",{value:h(ue)??"",children:u1(ue.cwd)},ue.id))})]}),l.jsxs("label",{className:ze.field,children:[l.jsx("span",{className:ze.fieldLabel,children:o("scheduledTasks.name")}),l.jsx("input",{className:ze.input,type:"text",value:N,maxLength:200,placeholder:o("scheduledTasks.namePlaceholder"),onChange:ue=>j(ue.target.value)})]}),l.jsxs("label",{className:ze.field,children:[l.jsxs("span",{className:ze.fieldLabel,children:[o("scheduledTasks.prompt"),l.jsx("span",{className:ze.required,children:"*"})]}),l.jsx(Qpt,{value:P,label:o("scheduledTasks.prompt"),placeholder:o("scheduledTasks.promptPlaceholder"),onChange:L,insertItem:W,onInserted:()=>te(null)})]}),l.jsx("div",{ref:U,className:ze.referencePopover,children:l.jsx("div",{className:ze.referenceBar,children:["extension","skill","mcp"].map(ue=>{const Fe=Dp(ue);return l.jsxs("button",{type:"button",className:`${ze.referenceButton} ${Q===ue?ze.referenceButtonActive:""}`,"aria-expanded":Q===ue,onClick:()=>void jt(ue),children:[Fe&&l.jsx("span",{className:ze.referenceButtonIcon,style:{"--composer-tag-icon-url":Z3(Fe)},"aria-hidden":!0}),o(`scheduledTasks.reference.${ue}`)]},ue)})})}),l.jsxs("div",{className:ze.scheduleRow,children:[l.jsxs("label",{className:ze.field,children:[l.jsx("span",{className:ze.fieldLabel,children:o("scheduledTasks.frequency")}),l.jsx("select",{className:ze.select,value:O.frequency,onChange:ue=>{const Fe=ue.target.value;$(kt=>({...kt,frequency:Fe,...Fe==="hourly"?{time:"00:00"}:{}}))},children:Opt.map(ue=>l.jsx("option",{value:ue,children:o(`scheduledTasks.freq.${ue}`)},ue))})]}),(O.frequency==="daily"||O.frequency==="weekdays"||O.frequency==="weekly")&&l.jsxs("label",{className:ze.field,children:[l.jsx("span",{className:ze.fieldLabel,children:o("scheduledTasks.time")}),l.jsx("input",{className:ze.input,type:"time",value:O.time,onChange:ue=>$(Fe=>({...Fe,time:ue.target.value}))})]}),O.frequency==="weekly"&&l.jsxs("label",{className:ze.field,children:[l.jsx("span",{className:ze.fieldLabel,children:o("scheduledTasks.weekday")}),l.jsx("select",{className:ze.select,value:O.weekday,onChange:ue=>$(Fe=>({...Fe,weekday:Number(ue.target.value)})),children:o("scheduledTasks.weekdayNames").split(",").map((ue,Fe)=>l.jsx("option",{value:Fe,children:ue},Fe))})]}),O.frequency==="minutes"&&l.jsxs("label",{className:ze.field,children:[l.jsx("span",{className:ze.fieldLabel,children:o("scheduledTasks.interval")}),l.jsx("select",{className:ze.select,value:O.minuteInterval,onChange:ue=>$(Fe=>({...Fe,minuteInterval:Number(ue.target.value)})),children:Bpt.map(ue=>l.jsx("option",{value:ue,children:ue},ue))})]}),O.frequency==="custom"&&l.jsxs("label",{className:`${ze.field} ${ze.fieldGrow}`,children:[l.jsx("span",{className:ze.fieldLabel,children:o("scheduledTasks.cron")}),l.jsx("input",{className:ze.input,type:"text",value:O.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:ue=>$(Fe=>({...Fe,customCron:ue.target.value}))})]})]}),l.jsx("div",{className:ze.preview,children:gt?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:ze.previewLabel,children:gt}),l.jsx("code",{className:ze.previewCron,children:ne})]}):l.jsx("span",{className:ze.previewInvalid,children:o("scheduledTasks.error.invalidSchedule")})}),G&&l.jsx("div",{className:ze.formError,children:G}),l.jsxs("div",{className:ze.formActions,children:[l.jsx("button",{type:"button",className:ze.secondaryButton,onClick:jn,disabled:z,children:o("scheduledTasks.cancel")}),l.jsx("button",{type:"button",className:ze.primaryButton,onClick:()=>void ht(),disabled:z,children:o(z?C?"scheduledTasks.saving":"scheduledTasks.creating":C?"scheduledTasks.save":"scheduledTasks.create")})]})]})}),Xe,b&&l.jsx("div",{className:ze.loadError,children:b}),p!==null&&p.length===0&&!b&&l.jsx("div",{className:ze.empty,children:o("scheduledTasks.empty")}),l.jsx("div",{className:ze.list,children:(p??[]).map(ue=>{const Fe=ue.name||ue.prompt,kt=x===kh(ue);return l.jsxs("div",{className:`${ze.card} ${ue.enabled?"":ze.cardDisabled}`,children:[l.jsxs("div",{className:ze.cardHeader,children:[l.jsx("button",{type:"button",role:"switch","aria-checked":ue.enabled,"aria-label":ue.enabled?o("scheduledTasks.disable"):o("scheduledTasks.enable"),className:`${ze.toggle} ${ue.enabled?ze.toggleOn:""}`,onClick:()=>void ve(ue),disabled:kt,children:l.jsx("span",{className:ze.toggleKnob})}),l.jsx("div",{className:ze.cardTitle,title:Fe,children:Fe}),l.jsxs("div",{className:ze.cardMenu,children:[l.jsx("button",{type:"button",className:ze.iconAction,onClick:()=>void Me(ue),disabled:!ue.enabled||w!==null,title:o("scheduledTasks.runNow"),"aria-label":o("scheduledTasks.runNow"),children:"▶"}),l.jsx("button",{type:"button",className:ze.iconAction,onClick:()=>Be(ue),disabled:kt,title:o("scheduledTasks.edit"),"aria-label":o("scheduledTasks.edit"),children:"✎"}),l.jsx("button",{type:"button",className:ze.iconAction,onClick:()=>void _e(ue),disabled:kt,title:o("scheduledTasks.delete"),"aria-label":o("scheduledTasks.delete"),children:"✕"})]})]}),ue.name&&l.jsx("div",{className:ze.cardPrompt,title:ue.prompt,children:ue.prompt}),l.jsxs("div",{className:ze.cardFooter,children:[u&&ue.workspaceCwd&&l.jsxs("span",{className:ze.workspacePill,title:ue.workspaceCwd,children:[l.jsx("span",{className:ze.workspaceIcon,"aria-hidden":"true",children:"⌂"}),u1(ue.workspaceCwd)]}),l.jsxs("span",{className:ze.schedulePill,children:[l.jsx("span",{className:ze.clockIcon,"aria-hidden":"true",children:"◷"}),Zx(ue.cron,o)]}),l.jsx("span",{className:ze.recurringTag,children:o(ue.recurring?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),ue.nextRunAt!=null&&l.jsxs("span",{className:ze.countdown,"data-testid":"scheduled-task-next-run",title:o("scheduledTasks.nextRunTooltip",{when:boe(ue.nextRunAt)}),children:[l.jsx("span",{className:ze.hourglassIcon,"aria-hidden":"true",children:"⏳"}),CWe(ue.nextRunAt-At,o)]}),l.jsx("span",{className:ze.lastFired,children:TWe(ue,o)}),ue.sessionId&&n?l.jsx("button",{type:"button",className:ze.runsToggle,onClick:()=>n(ue.sessionId),title:o("scheduledTasks.viewHistoryHint"),children:ue.runs.length>0?o("scheduledTasks.viewHistory",{count:ue.runs.length}):o("scheduledTasks.viewHistoryEmpty")}):ue.runs.length>0&&l.jsx("button",{type:"button",className:ze.runsToggle,"aria-expanded":Ve===kh(ue),onClick:()=>it(bn=>bn===kh(ue)?null:kh(ue)),children:o("scheduledTasks.runHistory",{count:ue.runs.length})})]}),Ve===kh(ue)&&ue.runs.length>0&&l.jsx("ul",{className:ze.runsList,children:[...ue.runs].reverse().map((bn,Pe)=>l.jsx("li",{className:ze.runsItem,children:Ppt(bn,o)},`${bn.at}-${Pe}`))})]},kh(ue))})})]})}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Zpt=new Set(["clear","stop","off","reset","none","cancel"]);function o9(e){return e.replace(/^\/goal\b/i,"").trim()}function e0t(e){return/^\/goal\b/i.test(e.trim())?LI(o9(e.trim())):!1}function LI(e){return Zpt.has(e.trim().toLowerCase())}const t0t="_root_v50oc_1",n0t="_intro_v50oc_8",s0t="_toolbar_v50oc_14",r0t="_count_v50oc_22",i0t="_toolbarActions_v50oc_28",o0t="_primaryButton_v50oc_34",a0t="_secondaryButton_v50oc_35",l0t="_formFields_v50oc_80",c0t="_field_v50oc_86",u0t="_fieldLabel_v50oc_93",d0t="_required_v50oc_102",h0t="_textarea_v50oc_59",f0t="_formHint_v50oc_126",m0t="_formError_v50oc_132",p0t="_loadError_v50oc_133",g0t="_degraded_v50oc_140",b0t="_formActions_v50oc_148",y0t="_empty_v50oc_156",x0t="_list_v50oc_163",v0t="_card_v50oc_169",w0t="_cardHeader_v50oc_180",k0t="_statusDot_v50oc_188",_0t="_statusDotRunning_v50oc_196",S0t="_cardTitle_v50oc_200",C0t="_cardMenu_v50oc_211",T0t="_iconAction_v50oc_218",E0t="_cardReason_v50oc_250",A0t="_reasonLabel_v50oc_262",N0t="_cardFooter_v50oc_266",j0t="_statusPill_v50oc_274",M0t="_meta_v50oc_285",I0t="_sessionLink_v50oc_290",zs={root:t0t,intro:n0t,toolbar:s0t,count:r0t,toolbarActions:i0t,primaryButton:o0t,secondaryButton:a0t,formFields:l0t,field:c0t,fieldLabel:u0t,required:d0t,textarea:h0t,formHint:f0t,formError:m0t,loadError:p0t,degraded:g0t,formActions:b0t,empty:y0t,list:x0t,card:v0t,cardHeader:w0t,statusDot:k0t,statusDotRunning:_0t,cardTitle:S0t,cardMenu:C0t,iconAction:T0t,cardReason:E0t,reasonLabel:A0t,cardFooter:N0t,statusPill:j0t,meta:M0t,sessionLink:I0t},R0t=1e4,D0t=1e3;function L0t({onCreateGoal:e,onOpenSession:t,onError:n}){const{t:s}=ut(),r=fo(),[i,o]=f.useState(null),[a,c]=f.useState(0),[u,d]=f.useState(null),[h,m]=f.useState(null),[p,g]=f.useState(!1),[b,v]=f.useState(""),[x,y]=f.useState(!1),[w,k]=f.useState(null),[T,S]=f.useState(()=>Date.now()),C=f.useRef(!0),_=f.useRef(0);f.useEffect(()=>(C.current=!0,()=>{C.current=!1}),[]);const B=f.useCallback(async()=>{const L=++_.current;try{const O=await r.listGoals();if(!C.current||L!==_.current)return;o(O.goals),c(O.droppedCount),d(null)}catch(O){if(!C.current||L!==_.current)return;d(O instanceof Error?O.message:String(O)),o($=>$??[]),c(0)}},[r]);f.useEffect(()=>{let L=!1,O=0;const $=async()=>{await B(),!L&&(O=window.setTimeout(()=>void $(),R0t))};return $(),()=>{L=!0,window.clearTimeout(O)}},[B]);const A=!!(i!=null&&i.length);f.useEffect(()=>{if(!A)return;const L=window.setInterval(()=>S(Date.now()),D0t);return()=>window.clearInterval(L)},[A]);const N=f.useCallback(()=>{v(""),k(null),g(!1)},[]),j=f.useCallback(async()=>{const L=b.trim();if(L.length===0){k(s("goals.error.emptyCondition"));return}if(LI(L)){k(s("goals.error.clearKeyword",{word:L}));return}y(!0),k(null);try{const O=await e(L);if(!C.current||O===!1)return;N()}catch(O){if(!C.current){n(O,s("goals.error.createFailed"));return}k(O instanceof Error?O.message:String(O))}finally{C.current&&y(!1)}},[b,e,n,N,s]),P=f.useCallback(async L=>{const O=L.condition.length>60?`${L.condition.slice(0,57)}…`:L.condition;if(window.confirm(s("goals.clearConfirm",{condition:O}))){m(L.sessionId);try{await r.clearGoal(L.sessionId),await B()}catch($){n($,s("goals.error.clearFailed"))}finally{C.current&&m(null)}}},[r,n,B,s]);return l.jsxs("div",{className:zs.root,children:[l.jsx("div",{className:zs.intro,children:s("goals.subtitle")}),l.jsxs("div",{className:zs.toolbar,children:[l.jsx("div",{className:zs.count,children:i===null?s("goals.loading"):s("goals.count",{count:i.length})}),l.jsxs("div",{className:zs.toolbarActions,children:[l.jsx("button",{type:"button",className:zs.secondaryButton,onClick:()=>void B(),children:s("goals.refresh")}),l.jsx("button",{type:"button",className:zs.primaryButton,onClick:()=>{v(""),k(null),g(!0)},children:s("goals.new")})]})]}),p&&l.jsx(Qr,{title:s("goals.new"),size:"md",onClose:N,children:l.jsxs("div",{className:zs.formFields,children:[l.jsxs("label",{className:zs.field,children:[l.jsxs("span",{className:zs.fieldLabel,children:[s("goals.condition"),l.jsx("span",{className:zs.required,children:"*"})]}),l.jsx("textarea",{className:zs.textarea,value:b,rows:4,placeholder:s("goals.conditionPlaceholder"),onChange:L=>v(L.target.value)})]}),l.jsx("div",{className:zs.formHint,children:s("goals.newHint")}),w&&l.jsx("div",{className:zs.formError,role:"alert",children:w}),l.jsxs("div",{className:zs.formActions,children:[l.jsx("button",{type:"button",className:zs.secondaryButton,onClick:N,disabled:x,children:s("goals.cancel")}),l.jsx("button",{type:"button",className:zs.primaryButton,onClick:()=>void j(),disabled:x,children:s(x?"goals.creating":"goals.create")})]})]})}),u&&l.jsx("div",{className:zs.loadError,role:"alert",children:u}),a>0&&l.jsx("div",{className:zs.degraded,"data-testid":"goals-dropped",children:s("goals.dropped",{count:a})}),i!==null&&i.length===0&&!u&&l.jsx("div",{className:zs.empty,children:s("goals.empty")}),l.jsx("div",{className:zs.list,role:"list",children:(i??[]).map(L=>{const O=h===L.sessionId;return l.jsxs("div",{className:zs.card,role:"listitem",children:[l.jsxs("div",{className:zs.cardHeader,children:[l.jsx("span",{className:`${zs.statusDot} ${L.hasActivePrompt?zs.statusDotRunning:""}`,"aria-hidden":"true"}),l.jsx("div",{className:zs.cardTitle,title:L.condition,children:L.condition}),l.jsx("div",{className:zs.cardMenu,children:l.jsx("button",{type:"button",className:zs.iconAction,onClick:()=>void P(L),disabled:O,title:s("goals.clear"),"aria-label":s("goals.clear"),children:"✕"})})]}),L.lastReason&&l.jsxs("div",{className:zs.cardReason,children:[l.jsxs("span",{className:zs.reasonLabel,children:[s("goal.lastCheck"),":"]})," ",L.lastReason]}),l.jsxs("div",{className:zs.cardFooter,children:[l.jsx("span",{className:zs.statusPill,children:s(L.hasActivePrompt?"goals.running":"goals.idle")}),l.jsx("span",{className:zs.meta,children:L.iterations>0?s(L.iterations===1?"goal.turn":"goal.turns",{count:L.iterations}):s("goals.notYetEvaluated")}),l.jsx("span",{className:zs.meta,"data-testid":"goal-elapsed",children:YS(Math.max(0,T-L.setAt))}),l.jsx("button",{type:"button",className:zs.sessionLink,onClick:()=>t(L.sessionId),title:s("goals.openSessionHint"),"aria-label":`${s("goals.openSessionHint")}: ${L.displayName||L.sessionId}`,children:L.displayName||L.sessionId})]})]},L.sessionId)})})]})}const P0t="_extensionGrid_1aki4_1",O0t={extensionGrid:P0t};function B0t(e,t){return e&&t.some(n=>n.name===e)?e:null}function $0t(e,t){const n=t.trim().toLowerCase();return n?e.filter(s=>[s.name,s.displayName,s.description].filter(r=>!!r).some(r=>r.toLowerCase().includes(n))):[...e]}function z0t({className:e,...t}){return l.jsx(mZ,{"data-slot":"radio-group",className:Kt("grid w-full gap-2",e),...t})}function F0t({className:e,...t}){return l.jsx(bZ,{"data-slot":"radio-group-item",className:Kt("group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input 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 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary",e),...t,children:l.jsx(xZ,{"data-slot":"radio-group-indicator",className:"flex size-4 items-center justify-center",children:l.jsx("span",{className:"absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground"})})})}function _oe({className:e,orientation:t="horizontal",decorative:n=!0,...s}){return l.jsx(a7e,{"data-slot":"separator",decorative:n,orientation:t,className:Kt("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",e),...s})}const nH="update available";function qb(e){return e.displayName||e.name}function s8(e,t){return e.isActive?t("extensions.manage.status.enabled"):t("extensions.manage.status.disabled")}function r8(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"updating":return t("extensions.manage.updating");case"updated":return t("extensions.manage.updateComplete");case"updated with warnings":return t("extensions.manage.updatedWithWarnings");case"updated, needs restart":return t("extensions.manage.restartRequired");case"error":return t("extensions.manage.updateError");case"unknown":case void 0:return t("extensions.manage.unknownUpdate")}}function e2(e,t,n){switch(e){case"enable":return n("extensions.manage.enabling",{name:t});case"disable":return n("extensions.manage.disabling",{name:t});case"uninstall":return n("extensions.manage.uninstalling",{name:t});case"update":return n("extensions.manage.updatingExtension",{name:t});default:return n("extensions.manage.queued",{name:t})}}function q0t(e,t,n){switch(e){case"enable":return n("extensions.manage.enabled",{name:t});case"disable":return n("extensions.manage.disabled",{name:t});case"uninstall":return n("extensions.manage.uninstalled",{name:t});case"update":return n("extensions.manage.updated",{name:t});default:return n("extensions.manage.queued",{name:t})}}function nd({label:e,value:t}){return l.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[l.jsx("div",{className:"text-sm font-medium",children:$m(e)}),l.jsx("div",{className:"break-words text-sm text-muted-foreground",children:t})]})}function Hb({items:e,empty:t,icon:n}){return e.length?l.jsx(Kl,{children:l.jsx(op,{className:"flex flex-col",children:e.map((s,r)=>l.jsxs("div",{children:[r>0?l.jsx(_oe,{}):null,l.jsxs("div",{className:"flex min-w-0 items-center gap-3 py-3 [contain-intrinsic-size:auto_44px] [content-visibility:auto]",children:[l.jsx(n,{className:"size-4 shrink-0 text-muted-foreground"}),l.jsx("span",{className:"min-w-0 break-words",children:s})]})]},s))})}):l.jsx(jd,{className:"border",children:l.jsxs(Md,{children:[l.jsx(Id,{variant:"icon",children:l.jsx(n,{})}),l.jsx(Rd,{children:t})]})})}function sH({pendingInteraction:e,submitting:t,selectedPlugin:n,interactionValue:s,setSelectedPlugin:r,setInteractionValue:i,submit:o,t:a}){return l.jsx(Wg,{open:!!e,onOpenChange:c=>{!c&&e&&!t&&o({cancelled:!0})},children:l.jsxs(Gg,{showCloseButton:!1,className:"max-h-[calc(100vh-2rem)] overflow-y-auto sm:max-w-3xl",children:[l.jsxs(Kg,{className:"items-start px-3 text-left",children:[l.jsx(Xg,{children:(e==null?void 0:e.interaction.kind)==="setting"?e.interaction.setting.name:a("extensions.manage.selectExtension")}),l.jsx(Ex,{children:(e==null?void 0:e.interaction.kind)==="marketplace_plugin"?a("extensions.manage.installSelectPluginDescription",{marketplace:e.interaction.marketplace.name}):e==null?void 0:e.interaction.setting.description})]}),(e==null?void 0:e.interaction.kind)==="marketplace_plugin"?l.jsx(z0t,{"aria-label":a("extensions.manage.selectExtension"),value:n,onValueChange:r,className:"flex flex-col gap-2 px-3",children:e.interaction.plugins.map(c=>{var d;const u=`marketplace-plugin-${c.name}`;return l.jsxs("div",{className:"flex items-start gap-3 rounded-md border border-border p-3 has-data-[state=checked]:bg-accent/50",children:[l.jsx(F0t,{id:u,value:c.name,disabled:t,className:"mt-0.5"}),l.jsxs("label",{htmlFor:u,className:"flex min-w-0 flex-1 cursor-pointer flex-col gap-1",children:[l.jsx("span",{className:"font-medium",children:c.name}),l.jsx("span",{className:"text-sm text-muted-foreground",children:c.description??c.category??(c.source==="."||c.source==="./"?a("extensions.manage.marketplaceRoot"):c.source)??a("extensions.manage.noDescription")}),(d=c.tags)!=null&&d.length?l.jsx("span",{className:"text-xs text-muted-foreground",children:c.tags.join(" · ")}):null]})]},c.name)})}):null,(e==null?void 0:e.interaction.kind)==="marketplace_plugin"?l.jsxs(Yg,{children:[l.jsx(qn,{variant:"outline",disabled:t,onClick:()=>o({cancelled:!0}),children:a("common.cancel")}),l.jsxs(qn,{disabled:t||!n,onClick:()=>o({pluginName:n}),children:[t?l.jsx(No,{}):null,e.owner==="mutation"?a("extensions.manage.update"):a("extensions.manage.install")]})]}):(e==null?void 0:e.interaction.kind)==="setting"?l.jsxs(l.Fragment,{children:[l.jsx(li,{autoComplete:"off","aria-label":e.interaction.setting.name,type:e.interaction.setting.sensitive?"password":"text",value:s,onChange:c=>i(c.target.value),onKeyDown:c=>{c.key==="Enter"&&!t&&(c.preventDefault(),o({value:s}))}}),l.jsxs(Yg,{children:[l.jsx(qn,{variant:"outline",disabled:t,onClick:()=>o({cancelled:!0}),children:a("common.cancel")}),l.jsxs(qn,{disabled:t,onClick:()=>o({value:s}),children:[t?l.jsx(No,{}):null,e.owner==="mutation"?a("extensions.manage.update"):a("extensions.manage.install")]})]})]}):null]})})}function Soe({onClose:e,initialFocusRef:t,embedded:n}){const{t:s}=ut(),r=Cl(),i=fo(),o=Kd(),[a,c]=f.useState([]),[u,d]=f.useState(null),[h,m]=f.useState(""),[p,g]=f.useState({}),[b,v]=f.useState(!1),[x,y]=f.useState(null),[w,k]=f.useState(null),[T,S]=f.useState(null),[C,_]=f.useState(null),[B,A]=f.useState(!1),[N,j]=f.useState(null),[P,L]=f.useState(!1),[O,$]=f.useState(""),[z,F]=f.useState(!1),[G,I]=f.useState(null),[Q,V]=f.useState(null),M=f.useRef(null),[re,se]=f.useState(""),[X,J]=f.useState(""),[de,W]=f.useState(!1),[te,U]=f.useState(!1),ee=f.useRef(!1),oe=f.useRef(null),Ce=f.useRef(null),he=f.useRef(new Map),ye=f.useRef(null),[Ve,it]=f.useState(null),At=f.useCallback(Be=>{Be&&Ce.current!==Be||(Ce.current=null,M.current=null,V(null),se(""),J(""))},[]),Ee=f.useCallback((Be,ht,ve)=>{M.current!==ht.id&&(se(""),J(""),M.current=ht.id),Ce.current=Be,V({operationId:Be,interaction:ht,owner:ve})},[]),me=f.useCallback((Be=!1)=>(v(!0),i.loadExtensionsStatus().then(ht=>{var Me,_e;const ve=ht.extensions??[];c(Xe=>{const ue=oe.current;if(!ue||ve.some(kt=>kt.name===ue))return ve;const Fe=Xe.find(kt=>kt.name===ue);return Fe?[...ve,Fe]:ve}),Be||S(((_e=(Me=ht.errors)==null?void 0:Me[0])==null?void 0:_e.error)??null),d(Xe=>Xe&&oe.current===Xe?Xe:B0t(Xe,ve))}).catch(ht=>{S(ht instanceof Error?ht.message:String(ht))}).finally(()=>v(!1))),[i]),bt=f.useCallback(()=>i.checkExtensionUpdates(r.clientId).then(Be=>g(Be.states)).catch(Be=>{S(Be instanceof Error?Be.message:String(Be))}),[i,r.clientId]);f.useEffect(()=>{me()},[me]),f.useEffect(()=>{let Be=!1,ht,ve=2e3;const Me=async()=>{try{const{operations:_e}=await i.activeExtensionOperations();if(Be)return;const Xe=_e.filter(Fe=>Fe.operation==="install").sort((Fe,kt)=>kt.createdAt-Fe.createdAt)[0];Xe&&I(Fe=>Fe??{operationId:Xe.operationId,source:Xe.source??Xe.name??"extension"});const ue=_e.find(Fe=>Fe.operation!=="install");ue&&(ee.current=!0,ue.operation==="uninstall"&&(oe.current=ue.name??"extension"),it(Fe=>Fe??{operationId:ue.operationId,name:ue.name??"extension",operation:ue.operation}),k(Fe=>Fe??ue.name??null)),_(null),U(!0)}catch(_e){Be||(_(_e instanceof Error?_e.message:String(_e)),ht=setTimeout(()=>void Me(),ve),ve=Math.min(ve*2,3e4))}};return Me(),()=>{Be=!0,ht&&clearTimeout(ht)}},[i]);const et=f.useRef((o==null?void 0:o.extensionsVersion)??0);f.useEffect(()=>{const Be=(o==null?void 0:o.extensionsVersion)??0;Be!==et.current&&(et.current=Be,g({}),me(!0))},[me,o==null?void 0:o.extensionsVersion]),f.useEffect(()=>{a.length!==0&&bt()},[bt,a]),f.useEffect(()=>{if(!G)return;let Be=!1,ht,ve=1e3;const Me=async()=>{var _e,Xe;try{const ue=await i.extensionOperationStatus(G.operationId);if(Be)return;if(ve=1e3,ue.status==="waiting_for_input"){ue.interaction?(Ee(ue.operationId,ue.interaction,"install"),ht=setTimeout(()=>void Me(),5e3)):(S(s("extensions.manage.operationFailed")),At(G.operationId),I(null));return}if(ue.status==="failed"){S(s("extensions.install.failed",{source:G.source,error:ue.error??""})),At(G.operationId),I(null);return}if(ue.status==="succeeded"||ue.status==="succeeded_with_refresh_error"){S(ue.status==="succeeded_with_refresh_error"?s("extensions.manage.refreshFailed",{error:((_e=ue.result)==null?void 0:_e.error)??""}):s("extensions.install.installed",{name:((Xe=ue.result)==null?void 0:Xe.name)??G.source})),At(G.operationId),I(null),me(!0);return}S(s("extensions.install.started",{source:G.source})),ht=setTimeout(()=>void Me(),1e3)}catch(ue){if(Be)return;if(S(ue instanceof Error?ue.message:String(ue)),ue instanceof ac&&ue.status===404){At(G.operationId),I(null);return}ht=setTimeout(()=>void Me(),ve),ve=Math.min(ve*2,3e4)}};return Me(),()=>{Be=!0,ht&&clearTimeout(ht)}},[i,At,me,G,Ee,s]);const qe=f.useCallback(Be=>{if(!Q)return;const ht=Q.owner,ve=()=>{ht==="install"?I(Me=>Me&&{...Me}):it(Me=>Me&&{...Me})};W(!0),i.respondToExtensionInteraction(Q.operationId,Q.interaction.id,Be,r.clientId).then(()=>{At(Q.operationId),ve()}).catch(Me=>{S(Me instanceof Error?Me.message:String(Me)),At(Q.operationId),ve()}).finally(()=>W(!1))},[i,At,r.clientId,Q]);f.useEffect(()=>{if(!Ve)return;let Be=!1,ht,ve=1e3;const Me=async()=>{var _e;try{const Xe=await i.extensionOperationStatus(Ve.operationId);if(Be)return;if(ve=1e3,Xe.status==="waiting_for_input"){Xe.interaction?(Ee(Xe.operationId,Xe.interaction,"mutation"),ht=setTimeout(()=>void Me(),5e3)):(S(s("extensions.manage.operationFailed")),At(Ve.operationId),it(null),k(null),ee.current=!1,Ve.operation==="uninstall"&&(oe.current=null,me(!0)));return}if(Xe.status==="failed"){S(Xe.error??s("extensions.manage.operationFailed")),At(Ve.operationId),it(null),k(null),ee.current=!1,Xe.operation==="uninstall"&&(oe.current=null,me(!0));return}if(Xe.status==="succeeded"||Xe.status==="succeeded_with_refresh_error"){Xe.status==="succeeded_with_refresh_error"?S(s("extensions.manage.refreshFailed",{error:((_e=Xe.result)==null?void 0:_e.error)??""})):Xe.operation==="uninstall"?S(null):S(q0t(Xe.operation,Ve.name,s)),At(Ve.operationId),it(null),k(null),ee.current=!1,Xe.operation==="uninstall"&&(oe.current=null,d(null)),Xe.operation==="update"&&g(ue=>{const Fe={...ue};return delete Fe[Ve.name],Fe}),me(!0);return}S(e2(Xe.operation,Ve.name,s)),ht=setTimeout(()=>void Me(),1e3)}catch(Xe){if(Be)return;if(S(Xe instanceof Error?Xe.message:String(Xe)),Xe instanceof ac&&Xe.status===404){At(Ve.operationId),it(null),k(null),ee.current=!1,Ve.operation==="uninstall"&&(oe.current=null,me(!0));return}ht=setTimeout(()=>void Me(),ve),ve=Math.min(ve*2,3e4)}};return Me(),()=>{Be=!0,ht&&clearTimeout(ht)}},[i,At,me,Ve,Ee,s]);const Ke=f.useCallback(()=>{S(null),me()},[me]),ke=f.useCallback(Be=>{y(Be),S(null),g(ht=>({...ht,[Be]:"checking for updates"})),i.checkExtensionUpdates(r.clientId).then(ht=>{g(ht.states),S(r8(ht.states[Be],s))}).catch(ht=>{g(ve=>({...ve,[Be]:"error"})),S(ht instanceof Error?ht.message:String(ht))}).finally(()=>y(null))},[i,r.clientId,s]),ne=f.useCallback(()=>{const Be=O.trim(),ht=r.clientId;!Be||!te||G||Ve||ee.current||(F(!0),S(null),i.installExtension({source:Be,consent:!0},ht).then(ve=>{I({operationId:ve.operationId,source:Be}),$(""),L(!1)}).catch(ve=>{S(ve instanceof Error?ve.message:String(ve))}).finally(()=>F(!1)))},[i,r.clientId,O,te,G,Ve]),gt=f.useCallback((Be,ht,ve={})=>{const Me=r.clientId;if(!te||G||Ve||x||ee.current)return!1;ee.current=!0,ve.operation==="uninstall"&&(oe.current=Be),k(Be),S(ve.startMessage??null);let _e=!1;return ht(Me).then(Xe=>{const ue=Xe&&typeof Xe=="object"&&"operationId"in Xe&&typeof Xe.operationId=="string"?Xe.operationId:void 0;if(ue){_e=!0,it({operationId:ue,name:Be,operation:ve.operation});return}S(s("extensions.manage.queued",{name:Be}))}).catch(Xe=>{S(Xe instanceof Error?Xe.message:String(Xe))}).finally(()=>{_e||(ee.current=!1,k(null),ve.operation==="uninstall"&&(oe.current=null),me(!0))}),!0},[r.clientId,x,me,te,G,Ve,s]),We=f.useMemo(()=>a.find(Be=>Be.name===u),[a,u]);f.useEffect(()=>{n==null||n.onDetailChange(!!We)},[n,We]);const tt=f.useMemo(()=>$0t(a,h),[a,h]),jt=f.useCallback(()=>{ye.current=u,d(null)},[u]);f.useEffect(()=>{var Be;u||!ye.current||((Be=he.current.get(ye.current))==null||Be.focus(),ye.current=null)},[u]);const jn=l.jsx(a1,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(l1,{className:"text-base",children:[l.jsx(oo,{children:l.jsx(qn,{variant:"ghost",size:"icon",onClick:e,"aria-label":s("common.back"),children:l.jsx(jN,{})})}),l.jsx(oo,{children:We?l.jsx(Xh,{asChild:!0,children:l.jsx("button",{type:"button",onClick:jt,children:s("extensions.manage.title")})}):l.jsx(Gl,{children:s("extensions.manage.title")})}),We?l.jsx(Qh,{}):null,We?l.jsx(oo,{children:l.jsx(Gl,{children:qb(We)})}):null]})}),kn=n?We?l.jsx(a1,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(l1,{className:"h-8 text-sm",children:[l.jsx(oo,{children:l.jsx(Xh,{asChild:!0,children:l.jsx("button",{type:"button",onClick:n.onRoot,children:s("extensions.manage.title")})})}),l.jsx(Qh,{}),l.jsx(oo,{children:l.jsx(Gl,{children:qb(We)})})]})}):null:jn;if(We){const Be=We.details,ht=p[We.name]??We.updateState,ve=!te||G!==null||w!==null||Ve!==null,Me=x===We.name,_e=We.isActive?"disable":"enable",Xe=yn=>gt(We.name,je=>_e==="enable"?i.enableExtension(We.name,{scope:yn},je):i.disableExtension(We.name,{scope:yn},je),{operation:_e,startMessage:e2(_e,We.name,s)}),ue=(Be==null?void 0:Be.commands)??[],Fe=(Be==null?void 0:Be.skills)??[],kt=(Be==null?void 0:Be.agents)??[],bn=(Be==null?void 0:Be.mcpServers)??[],Pe=(Be==null?void 0:Be.contextFiles)??[];return l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[kn,l.jsxs("div",{className:"flex w-full flex-col gap-6",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-xl bg-muted",children:l.jsx(fP,{})}),l.jsx("div",{className:"min-w-0 flex-1",children:l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("h1",{className:"break-words text-2xl font-semibold",children:qb(We)}),l.jsxs(za,{variant:"outline",children:["v",We.version]}),l.jsx(za,{variant:"secondary",className:We.isActive?"bg-[var(--success-bg)] text-[var(--success-color)]":void 0,children:s8(We,s)})]})}),l.jsxs(kg,{open:B,onOpenChange:A,children:[l.jsx(_g,{asChild:!0,children:l.jsx(qn,{variant:"ghost",size:"icon",disabled:ve||Me,"aria-label":s("extensions.manage.actions"),children:ve||Me?l.jsx(No,{}):l.jsx(cg,{})})}),l.jsxs(Sg,{align:"end",children:[l.jsxs(c1,{children:[l.jsx($o,{disabled:ve||x!==null,onSelect:()=>ke(We.name),children:s("extensions.manage.checkUpdates")}),l.jsx($o,{disabled:ve||Me||ht!==nH,onSelect:()=>gt(We.name,yn=>i.updateExtension(We.name,yn),{operation:"update",startMessage:e2("update",We.name,s)}),children:s("extensions.manage.update")}),l.jsxs($o,{disabled:ve||Me,onSelect:()=>Xe("user"),children:[s(_e==="enable"?"extensions.manage.enable":"extensions.manage.disable"),"· ",s("settings.scope.user")]}),l.jsxs($o,{disabled:ve||Me,onSelect:()=>Xe("workspace"),children:[s(_e==="enable"?"extensions.manage.enable":"extensions.manage.disable"),"· ",s("settings.scope.workspace")]})]}),l.jsx(Srt,{}),l.jsx(c1,{children:l.jsx($o,{variant:"destructive",disabled:ve||Me,onSelect:yn=>{yn.preventDefault(),A(!1),j(We.name)},children:s("extensions.manage.uninstallAction")})})]})]})]}),T||C?l.jsxs(Fi,{children:[l.jsx(Ra,{}),l.jsx(qi,{className:"break-words",children:T??C})]}):null,l.jsxs(Uv,{defaultValue:"overview",children:[l.jsxs(Vv,{className:"max-w-full overflow-x-auto",children:[l.jsx(So,{value:"overview",children:s("extensions.manage.overview")}),l.jsxs(So,{value:"commands",children:[$m(s("extensions.manage.commands"))," ",ue.length]}),l.jsxs(So,{value:"skills",children:[$m(s("extensions.manage.skills"))," ",Fe.length]}),l.jsxs(So,{value:"agents",children:[$m(s("extensions.manage.agents"))," ",kt.length]}),l.jsxs(So,{value:"mcp",children:[$m(s("extensions.manage.mcpServers"))," ",bn.length]}),l.jsxs(So,{value:"context",children:[$m(s("extensions.manage.contextFiles"))," ",Pe.length]})]}),l.jsx(Pa,{value:"overview",className:"pt-4",children:l.jsxs(Kl,{children:[l.jsxs(gd,{children:[l.jsx(bd,{children:s("extensions.manage.overview")}),We.description?l.jsx(Jh,{children:We.description}):null]}),l.jsxs(op,{className:"grid gap-6 sm:grid-cols-2",children:[l.jsx(nd,{label:s("extensions.manage.name"),value:We.name}),l.jsx(nd,{label:s("extensions.manage.version"),value:We.version}),l.jsx(nd,{label:s("extensions.manage.status"),value:s8(We,s)}),l.jsx(nd,{label:s("extensions.manage.source"),value:We.source??"-"}),l.jsx(nd,{label:s("extensions.manage.path"),value:We.path}),l.jsx(nd,{label:s("extensions.manage.updateStatus"),value:r8(ht,s)}),l.jsx(nd,{label:s("extensions.manage.installType"),value:We.installType??"-"}),l.jsx(nd,{label:s("extensions.manage.origin"),value:We.originSource??"-"}),l.jsx(nd,{label:s("extensions.manage.settings"),value:((Be==null?void 0:Be.settings)??[]).join(", ")||"-"})]})]})}),l.jsx(Pa,{value:"commands",className:"pt-4",children:l.jsx(Hb,{items:ue,empty:s("extensions.manage.emptyCommands"),icon:Yme})}),l.jsx(Pa,{value:"skills",className:"pt-4",children:l.jsx(Hb,{items:Fe,empty:s("extensions.manage.emptySkills"),icon:T2})}),l.jsx(Pa,{value:"agents",className:"pt-4",children:l.jsx(Hb,{items:kt,empty:s("extensions.manage.emptyAgents"),icon:IG})}),l.jsx(Pa,{value:"mcp",className:"pt-4",children:l.jsx(Hb,{items:bn,empty:s("extensions.manage.emptyMcpServers"),icon:ug})}),l.jsx(Pa,{value:"context",className:"pt-4",children:l.jsx(Hb,{items:Pe,empty:s("extensions.manage.emptyContextFiles"),icon:epe})})]})]}),l.jsx(YA,{open:N===We.name,onOpenChange:yn=>{yn||j(null)},children:l.jsxs(XA,{children:[l.jsxs(QA,{className:"place-items-start text-left",children:[l.jsx(ZA,{children:s("extensions.manage.uninstallAction")}),l.jsx(e9,{children:s("extensions.manage.uninstallConfirm",{name:We.name})})]}),l.jsxs(JA,{children:[l.jsx(t9,{children:s("common.cancel")}),l.jsx(Aie,{variant:"destructive",onClick:()=>{N&&gt(N,yn=>i.uninstallExtension(N,yn),{operation:"uninstall",startMessage:e2("uninstall",N,s)})&&j(null)},children:s("extensions.manage.uninstallAction")})]})]})}),l.jsx(sH,{pendingInteraction:Q,submitting:de,selectedPlugin:X,interactionValue:re,setSelectedPlugin:J,setInteractionValue:se,submit:qe,t:s})]})}return l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[kn,l.jsxs("div",{className:"flex w-full flex-col gap-6",children:[l.jsxs("div",{className:"flex items-start justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{ref:t,tabIndex:-1,className:"text-2xl font-semibold outline-none",children:s("extensions.manage.title")}),l.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:s("extensions.manage.count",{count:a.length})})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[l.jsxs(qn,{variant:"outline",disabled:b,onClick:Ke,children:[b?l.jsx(No,{}):l.jsx(My,{"data-icon":"inline-start"}),s("common.refresh")]}),l.jsxs(qn,{disabled:!te||!!(G||Ve||w),onClick:()=>L(!0),children:[l.jsx(hx,{"data-icon":"inline-start"}),s("extensions.manage.add")]})]})]}),T||C?l.jsxs(Fi,{children:[l.jsx(Ra,{}),l.jsx(qi,{className:"break-words",children:T??C})]}):null,l.jsxs("div",{className:"relative",children:[l.jsx(Fd,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),l.jsx(li,{name:"extension-search","aria-label":s("extensions.manage.search"),autoComplete:"off",value:h,onChange:Be=>m(Be.target.value),placeholder:s("extensions.manage.search"),className:"pl-9"})]}),tt.length?l.jsx("div",{className:O0t.extensionGrid,"data-column-count":Math.min(tt.length,4),children:tt.map(Be=>{const ht=p[Be.name]??Be.updateState;return l.jsx(Kl,{ref:ve=>{ve?he.current.set(Be.name,ve):he.current.delete(Be.name)},size:"sm",role:"button",tabIndex:0,"aria-label":qb(Be),className:"cursor-pointer transition-colors hover:bg-accent/30 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none",onClick:()=>d(Be.name),onKeyDown:ve=>{(ve.key==="Enter"||ve.key===" ")&&(ve.preventDefault(),d(Be.name))},children:l.jsx(gd,{className:"block",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted",children:l.jsx(fP,{className:"size-5"})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-2",children:[l.jsx(bd,{className:"min-w-0 truncate",children:qb(Be)}),l.jsx("div",{className:"flex shrink-0 justify-end",children:l.jsx(za,{variant:"secondary",className:Be.isActive?"bg-[var(--success-bg)] text-[10px] text-[var(--success-color)]":"text-[10px]",children:s8(Be,s)})})]}),ht===nH?l.jsx("div",{className:"mt-1",children:l.jsx(za,{className:"text-[10px]",children:r8(ht,s)})}):null,l.jsx(Jh,{className:"mt-1 truncate text-xs",children:Be.description||s("extensions.manage.noDescription")})]})]})})},Be.id||Be.name)})}):l.jsx(jd,{className:"border",children:l.jsxs(Md,{children:[l.jsx(Id,{variant:"icon",children:h?l.jsx(Fd,{}):l.jsx(Lme,{})}),l.jsx(Rd,{children:s(h?"extensions.manage.noMatches":"extensions.manage.empty")}),h?null:l.jsx(Hv,{children:s("extensions.manage.emptyDescription")})]})})]}),l.jsx(YA,{open:P,onOpenChange:Be=>{(Be||!z)&&L(Be)},children:l.jsxs(XA,{size:"middle",children:[l.jsxs(QA,{className:"place-items-start text-left",children:[l.jsx(ZA,{children:s("extensions.manage.add")}),l.jsx(e9,{children:s("extensions.manage.installDescription")})]}),l.jsx(li,{id:"extension-source",name:"extension-source","aria-label":s("extensions.manage.installDescription"),autoComplete:"off",value:O,onChange:Be=>$(Be.target.value),placeholder:s("extensions.manage.sourcePlaceholder")}),l.jsxs(JA,{children:[l.jsx(t9,{disabled:z,children:s("common.cancel")}),l.jsxs(qn,{disabled:z||!te||!!(G||Ve||w)||!O.trim(),onClick:ne,children:[z?l.jsx(No,{}):null,s("extensions.manage.install")]})]})]})}),l.jsx(sH,{pendingInteraction:Q,submitting:de,selectedPlugin:X,interactionValue:re,setSelectedPlugin:J,setInteractionValue:se,submit:qe,t:s})]})}const H0t="_connectedBadge_1erz5_1",U0t="_serverGrid_1erz5_6",Coe={connectedBadge:H0t,serverGrid:U0t};function V0t({className:e,...t}){return l.jsx("textarea",{"data-slot":"textarea",className:Kt("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 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",e),...t})}const t2=`{
  "command": "",
  "args": []
}`;function dC(e){if(e.configOrigin)return e.configOrigin;if(e.extensionName||e.source==="extension")return"extension";const t=e.source;return t==="project"&&e.removable===!1?"project_mcp_json":t==="workspace"||t==="project"?"workspace_settings":e.removable?"user_settings":void 0}function Z2(e){const t=dC(e);return t==="workspace_settings"?"workspace":t==="extension"?"extension":"user"}function W0t(e){const t=dC(e);return t==="extension"||t==="workspace_settings"||t==="user_settings"}function rH(e,t){const n=Z2(e);return t(n==="workspace"?"mcp.source.workspace":n==="extension"?"mcp.source.extension":"mcp.source.user")}function iH(e,t){var s;const n=(s=e.settings.find(r=>r.key==="mcpServers"))==null?void 0:s.values[t];return!n||typeof n!="object"||Array.isArray(n)?{}:Object.fromEntries(Object.entries(n))}function oH(e,t){return e.disabled?t("mcp.status.disabled"):e.approvalState==="pending"?t("mcp.status.needsApproval"):e.approvalState==="rejected"?t("mcp.status.rejected"):e.authenticationState==="pending"?t("mcp.status.authenticating"):e.mcpStatus==="connected"?t("mcp.status.connected"):e.mcpStatus==="connecting"?t("mcp.status.connecting"):t("mcp.status.disconnectedTitle")}function aH(e){return!e.disabled&&!e.approvalState&&e.mcpStatus==="connected"?Coe.connectedBadge:""}function G0t(e,t){var s;const n=e.config;return n!=null&&n.httpUrl?`${n.httpUrl} (http)`:n!=null&&n.url?`${n.url} (sse)`:n!=null&&n.command?`${n.command} ${((s=n.args)==null?void 0:s.join(" "))??""} (stdio)`.trim():e.transport?`(${e.transport})`:t("mcp.status.unknown")}function K0t(e,t){const n=[],s=!!e.approvalState,r=dC(e);return(r==="user_settings"||r==="workspace_settings")&&n.push({id:"edit",label:t("mcp.action.edit")}),!e.disabled&&!s&&!e.requiresAuth&&e.mcpStatus==="disconnected"&&n.push({id:"reconnect",label:t("mcp.action.reconnect")}),!e.disabled&&s&&n.push({id:"approve",label:t("mcp.action.approve")}),(r!=="extension"||e.disabled)&&n.push({id:e.disabled?"enable":"disable",label:e.disabled?t("mcp.action.enable"):t("mcp.action.disable")}),!e.disabled&&!s&&(e.mcpStatus!=="disconnected"||e.requiresAuth)&&(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")})),e.removable&&n.push({id:"remove",label:t("mcp.action.remove")}),n}function i8(e,t,n){return[`${t("mcp.oauth.server")}: ${e}`,t("mcp.oauth.starting",{name:e}),n].filter(Boolean).join(`
`)}function Y0t(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function X0t(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 cl({label:e,value:t}){return l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("div",{className:"text-sm font-medium",children:e}),l.jsx("div",{className:"break-words text-sm text-muted-foreground",children:t})]})}function Q0t({tool:e,t}){var i;const n=X0t(e,t),s=e.schema,r=(s==null?void 0:s.parametersJsonSchema)??(s==null?void 0:s.parameters)??s;return l.jsxs("div",{className:"flex flex-col gap-5",children:[e.isValid?null:l.jsxs(Fi,{variant:"destructive",children:[l.jsx(Ra,{}),l.jsx(Fm,{children:t("mcp.invalidToolWarning")}),l.jsxs(qi,{children:[e.invalidReason||t("mcp.status.unknown"),l.jsx("span",{className:"mt-1 block",children:t("mcp.invalidToolHelp")})]})]}),l.jsx(cl,{label:t("mcp.description"),value:((i=e.description)==null?void 0:i.trim())||t("mcp.noDescription")}),n?l.jsx(cl,{label:t("mcp.annotations"),value:n}):null,l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsx("div",{className:"text-sm font-medium",children:t("mcp.inputSchema")}),r?l.jsx("pre",{className:"max-h-96 overflow-auto rounded-lg bg-muted p-4 text-xs leading-relaxed",children:JSON.stringify(r,null,2)}):l.jsx("div",{className:"text-sm text-muted-foreground",children:t("mcp.noSchema")})]})]})}function J0t({resource:e,t}){const n=e.title||e.name||"";return l.jsxs("div",{className:"flex flex-col gap-5",children:[l.jsx(cl,{label:t("mcp.resource.uriLabel"),value:e.uri}),n&&n!==e.uri?l.jsx(cl,{label:t("mcp.resource.nameLabel"),value:n}):null,e.mimeType?l.jsx(cl,{label:t("mcp.resource.mimeTypeLabel"),value:e.mimeType}):null,typeof e.size=="number"?l.jsx(cl,{label:t("mcp.resource.sizeLabel"),value:t("mcp.resource.bytes",{count:e.size})}):null,e.description?l.jsx(cl,{label:t("mcp.description"),value:e.description.trim()}):null]})}function Toe({message:e,onClose:t,embedded:n}){var bn,Pe,yn,je;const{t:s}=ut(),r=EG({autoLoad:!1}),i=NG({autoLoad:!1}),[o,a]=f.useState(e.status),[c,u]=f.useState(e.toolsByServer),[d,h]=f.useState(e.resourcesByServer??{}),[m,p]=f.useState(null),[g,b]=f.useState(null),[v,x]=f.useState(null),[y,w]=f.useState("overview"),[k,T]=f.useState(""),[S,C]=f.useState("all"),[_,B]=f.useState(null),[A,N]=f.useState(!1),[j,P]=f.useState(!1),[L,O]=f.useState(!1),[$,z]=f.useState(null),[F,G]=f.useState(""),[I,Q]=f.useState(""),[V,M]=f.useState("workspace"),[re,se]=f.useState(t2),[X,J]=f.useState(!1),[de,W]=f.useState(null),[te,U]=f.useState(null),[ee,oe]=f.useState(null),[Ce,he]=f.useState({}),ye=f.useRef(e.status.discoveryState==="completed"),Ve=f.useRef(!0);f.useEffect(()=>(Ve.current=!0,()=>{Ve.current=!1}),[]);const it=f.useCallback(async()=>(await new Promise(Ne=>window.setTimeout(Ne,1500)),Ve.current),[]),At=f.useCallback(async(Ne,ot=!0,pt=!1)=>{var dn;if(await(Ne==="initialize"?r.initialize():r.reloadConfig()),!Ve.current)return!1;for(let De=0;De<40;De+=1){if(!await it())return!1;const sn=await r.reload();if(!Ve.current)return!1;if(sn){if((!pt||sn.discoveryState==="completed")&&a(Dn=>ot&&sn.servers.length===0&&Dn.servers.length>0?{...sn,servers:Dn.servers}:sn),(dn=sn.errors)!=null&&dn.length)return ot&&oe({text:sn.errors.map(Dn=>Dn.error||Dn.hint||Dn.kind).join(`
`),error:!0}),!1;if(sn.discoveryState==="completed")return ot&&oe(null),!0;if(sn.initialized&&sn.discoveryState==="not_started"&&sn.servers.length===0)return pt&&a(sn),ot&&oe({text:s("mcp.discovery.empty")}),!0}}return ot&&oe({text:s("mcp.discovery.timeout"),error:!0}),!1},[r,s,it]);f.useEffect(()=>{ye.current||(ye.current=!0,N(!0),At("initialize").catch(Ne=>{Ve.current&&oe({text:sa(Ne),error:!0})}).finally(()=>{Ve.current&&N(!1)}))},[At]);const Ee=f.useMemo(()=>(o.servers??[]).filter(W0t),[o.servers]),me=Ee.find(Ne=>Ne.name===m)??null,bt=me?((bn=c[me.name])==null?void 0:bn.tools)??[]:[],et=me?((Pe=d[me.name])==null?void 0:Pe.resources)??[]:[],qe=bt.find(Ne=>Ne.name===g)??null,Ke=et.find(Ne=>Ne.uri===v)??null;f.useEffect(()=>{n==null||n.onDetailChange(!!me)},[n,me]);const ke=f.useMemo(()=>{const Ne=k.trim().toLowerCase();return Ee.filter(ot=>{var De,sn;const pt=S==="all"||Z2(ot)===S,dn=!Ne||ot.name.toLowerCase().includes(Ne)||((De=ot.description)==null?void 0:De.toLowerCase().includes(Ne))||((sn=ot.extensionName)==null?void 0:sn.toLowerCase().includes(Ne));return pt&&!!dn})},[k,Ee,S]),ne=f.useCallback(async Ne=>{const ot=[],[pt,dn]=await Promise.allSettled([r.loadTools(Ne.name),Ne.resourceCount?r.loadResources(Ne.name):Promise.resolve(null)]);if(pt.status==="fulfilled")u(De=>({...De,[Ne.name]:pt.value})),he(De=>({...De,[Ne.name]:{...De[Ne.name],tools:void 0}}));else{ot.push(pt.reason);const De=sa(pt.reason);he(sn=>({...sn,[Ne.name]:{...sn[Ne.name],tools:De}}))}if(dn.status==="fulfilled"&&dn.value!==null){const De=dn.value;h(sn=>({...sn,[Ne.name]:De})),he(sn=>({...sn,[Ne.name]:{...sn[Ne.name],resources:void 0}}))}else if(dn.status==="rejected"){ot.push(dn.reason);const De=sa(dn.reason);he(sn=>({...sn,[Ne.name]:{...sn[Ne.name],resources:De}}))}else h(De=>{if(!(Ne.name in De))return De;const sn={...De};return delete sn[Ne.name],sn}),he(De=>({...De,[Ne.name]:{...De[Ne.name],resources:void 0}}));if(ot.length>0)throw new AggregateError(ot,`${Ne.name}: ${ot.map(sa).join("; ")}`)},[r]),gt=f.useCallback(async()=>{if(!j){P(!0),oe(null);try{const Ne=await r.reload();if(!Ne)return;a(Ne)}catch(Ne){oe({text:sa(Ne),error:!0})}finally{P(!1)}}},[r,j]),We=f.useCallback(async()=>{const Ne=F.trim(),ot=$!==null;if(!Ne){W(s("mcp.add.nameRequired"));return}let pt;try{const De=JSON.parse(re);if(!De||typeof De!="object"||Array.isArray(De))throw new Error(s("mcp.add.configInvalid"));const sn=I.trim();pt={...De,...sn?{description:sn}:{}}}catch(De){W(sa(De));return}W(null),J(!0);let dn=!1;try{await i.setValue(V,"mcpServers",pt,{mcpServerMutation:{operation:"set",name:Ne}}),dn=!0,oe(null);const De=await At("reload",!1).catch(()=>!1);oe({...ot?{serverName:Ne}:{},text:De?s(ot?"mcp.edit.done":"mcp.add.done",{name:Ne}):s("mcp.runtime.notUpdated"),error:!De}),O(!1),z(null),G(""),Q(""),se(t2)}catch(De){dn?(oe({...ot?{serverName:Ne}:{},text:s("mcp.runtime.notUpdated"),error:!0}),O(!1),z(null),G(""),Q(""),se(t2)):W(sa(De))}finally{J(!1)}},[r,$,re,I,F,V,i,At,s]),tt=f.useCallback(async()=>{if(!te)return;B(te.name);let Ne=!1;try{const ot=await i.reload();if(!ot){oe({serverName:te.name,text:s("mcp.add.settingsUnavailable"),error:!0});return}const pt=Z2(te)==="workspace"?"workspace":"user",dn=iH(ot,pt);if(!(te.name in dn)){oe({serverName:te.name,text:s("mcp.remove.notWorkspace"),error:!0});return}await i.setValue(pt,"mcpServers",{},{mcpServerMutation:{operation:"remove",name:te.name}}),Ne=!0,U(null),oe({serverName:te.name,text:s("mcp.action.running",{action:s("mcp.action.remove")})}),await At("reload",!1,!0).catch(()=>!1)?(p(null),b(null),x(null),oe(null)):oe({serverName:te.name,text:s("mcp.runtime.removeNotUpdated"),error:!0})}catch(ot){oe({serverName:te.name,text:Ne?s("mcp.runtime.removeNotUpdated"):s("mcp.action.failed",{error:sa(ot)}),error:!0})}finally{B(null)}},[te,i,At,s]),jt=f.useCallback(async Ne=>{if(_)return;const ot=dC(Ne);if(ot!=="user_settings"&&ot!=="workspace_settings")return;const pt=ot==="workspace_settings"?"workspace":"user";B(Ne.name),oe(null);try{const dn=await i.reload();if(!dn)throw new Error(s("mcp.add.settingsUnavailable"));const De=iH(dn,pt)[Ne.name];if(!De||typeof De!="object"||Array.isArray(De))throw new Error(s("mcp.edit.notFound"));const sn={...De},Dn=sn.description;delete sn.description,z(Ne),G(Ne.name),M(pt),Q(typeof Dn=="string"?Dn:""),se(JSON.stringify(sn,null,2)),W(null),O(!0)}catch(dn){oe({serverName:Ne.name,text:s("mcp.action.failed",{error:sa(dn)}),error:!0})}finally{B(null)}},[_,i,s]),jn=f.useCallback(async(Ne,ot)=>{var pt,dn,De,sn;if(!_){if(ot.id==="remove"){U(Ne);return}if(ot.id==="edit"){await jt(Ne);return}B(Ne.name),oe({serverName:Ne.name,text:ot.id==="authenticate"?i8(Ne.name,s):s("mcp.action.running",{action:ot.label})});try{let Dn="",os,st=!1;if(ot.id==="reconnect"){const Ht=await r.restartServer(Ne.name);if(!Ve.current)return;if("restarted"in Ht&&!Ht.restarted)throw Ht.reason==="authentication_required"?new Error(s("mcp.reconnect.authenticationRequired")):new Error(s("mcp.reconnect.skipped",{reason:Ht.reason}));if("entries"in Ht&&(Ht.entries.length===0||Ht.entries.every(Ot=>!Ot.restarted)))throw new Error(s("mcp.reconnect.skipped",{reason:Ht.entries.map(Ot=>Ot.reason).filter(Boolean).join(", ")||"not connected"}))}else{const Ht=await r.manageServer(Ne.name,ot.id);if(!Ve.current)return;os=Ht.authUrl,Dn=[...Ht.messages??[]].join(`
`),st=ot.id==="authenticate"&&Ht.pending===!0,st&&oe({serverName:Ne.name,text:i8(Ne.name,s,Dn),...os?{authUrl:os}:{}})}let St;if(st){for(let Ht=0;Ht<400;Ht+=1){if(!await it())return;const Ot=await r.reload();if(!Ve.current)return;if(!Ot)continue;a(Ot);const Yt=(pt=Ot.errors)==null?void 0:pt[0];if(Yt)throw new Error(Yt.error||Yt.hint||s("mcp.oauth.statusFailed"));const Pn=(dn=Ot.servers)==null?void 0:dn.find(Hn=>Hn.name===Ne.name);if(!Pn)throw new Error(s("mcp.oauth.serverRemoved"));if(Pn.authenticationState==="failed")throw new Error(Pn.authenticationError||s("mcp.oauth.authenticationFailed"));if(Pn.authenticationState==="succeeded"||Pn.authenticationState===void 0&&Pn.mcpStatus==="connected"){St=Ot;break}}if(!St)throw new Error(s("mcp.oauth.timeout"))}else{if(St=await r.reload(),!Ve.current)return;for(let Ht=0;(St==null?void 0:St.discoveryState)!==void 0&&St.discoveryState!=="completed"&&!((De=St.errors)!=null&&De.length)&&Ht<40;Ht+=1){if(!await it())return;const Ot=await r.reload();if(!Ve.current)return;Ot&&(St=Ot,a(Ot))}}if(St){a(St);const Ht=(sn=St.servers)==null?void 0:sn.find(Ot=>Ot.name===Ne.name);if(Ht&&(St.discoveryState===void 0||St.discoveryState==="completed")){try{await ne(Ht)}catch{}if(!Ve.current)return}}oe({serverName:Ne.name,text:st?s("mcp.action.done",{action:ot.label}):ot.id==="authenticate"&&Dn?i8(Ne.name,s,Dn):Dn||s("mcp.action.done",{action:ot.label}),...!st&&os?{authUrl:os}:{}})}catch(Dn){Ve.current&&oe({serverName:Ne.name,text:s("mcp.action.failed",{error:sa(Dn)}),error:!0})}finally{Ve.current&&B(null)}}},[_,ne,r,jt,s,it]),kn=Ne=>{p(Ne.name),w("overview"),b(null),x(null),oe(null),!Ne.approvalState&&ne(Ne).catch(ot=>{oe({serverName:Ne.name,text:s("mcp.action.failed",{error:sa(ot)}),error:!0})})},Be=()=>{_===null&&(p(null),b(null),x(null),P(!0),r.reload().then(Ne=>{Ne&&a(Ne)}).catch(Ne=>{oe({text:sa(Ne),error:!0})}).finally(()=>P(!1)))},ht=()=>{b(null),x(null)},ve=l.jsx(a1,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(l1,{className:"text-base",children:[l.jsx(oo,{children:l.jsx(qn,{variant:"ghost",size:"icon",disabled:_!==null,onClick:t,"aria-label":s("common.back"),children:l.jsx(jN,{})})}),l.jsx(oo,{children:me?l.jsx(Xh,{asChild:!0,children:l.jsx("button",{type:"button",disabled:_!==null,onClick:Be,children:s("mcp.title")})}):l.jsx(Gl,{children:s("mcp.title")})}),me?l.jsx(Qh,{}):null,me?l.jsx(oo,{children:qe||Ke?l.jsx(Xh,{asChild:!0,children:l.jsx("button",{type:"button",onClick:ht,children:me.name})}):l.jsx(Gl,{children:me.name})}):null,qe||Ke?l.jsx(Qh,{}):null,qe?l.jsx(oo,{children:l.jsx(Gl,{children:qe.name})}):null,Ke?l.jsx(oo,{children:l.jsx(Gl,{children:Ke.title||Ke.name||Ke.uri})}):null]})}),Me=qe?qe.name:Ke?Ke.title||Ke.name||Ke.uri:me==null?void 0:me.name,_e=n?me?l.jsx(a1,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(l1,{className:"h-8 text-sm",children:[l.jsx(oo,{children:l.jsx(Xh,{asChild:!0,children:l.jsx("button",{type:"button",disabled:_!==null,onClick:Be,children:s("mcp.title")})})}),l.jsx(Qh,{}),l.jsx(oo,{children:qe||Ke?l.jsx(Xh,{asChild:!0,children:l.jsx("button",{type:"button",onClick:ht,children:me.name})}):l.jsx(Gl,{children:me.name})}),qe||Ke?l.jsx(Qh,{}):null,qe||Ke?l.jsx(oo,{children:l.jsx(Gl,{children:Me})}):null]})}):null:ve,Xe=l.jsx(Wg,{open:te!==null,onOpenChange:Ne=>!Ne&&U(null),children:l.jsxs(Gg,{showCloseButton:!1,children:[l.jsxs(Kg,{children:[l.jsx(Xg,{children:s("mcp.remove.title")}),l.jsx(Ex,{children:s(te&&Z2(te)==="workspace"?"mcp.remove.description":"mcp.remove.description.global",{name:(te==null?void 0:te.name)??""})})]}),l.jsxs(Yg,{children:[l.jsx(qn,{variant:"outline",onClick:()=>U(null),disabled:_!==null,children:s("common.cancel")}),l.jsxs(qn,{variant:"destructive",onClick:()=>void tt(),disabled:_!==null,children:[_?l.jsx(No,{"data-icon":"inline-start"}):l.jsx(Iy,{"data-icon":"inline-start"}),s("mcp.action.remove")]})]})]})}),ue=l.jsx(Wg,{open:L,onOpenChange:Ne=>{X||(O(Ne),Ne||z(null))},children:l.jsxs(Gg,{className:"sm:max-w-lg",showCloseButton:!1,children:[l.jsxs(Kg,{children:[l.jsx(Xg,{children:s($?"mcp.edit.title":"mcp.add.title")}),l.jsx(Ex,{children:s($?"mcp.edit.description":"mcp.add.description")})]}),l.jsxs("div",{className:"grid gap-4",children:[de?l.jsxs(Fi,{variant:"destructive",children:[l.jsx(Ra,{}),l.jsx(qi,{children:de})]}):null,l.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("mcp.add.name"),l.jsx(li,{value:F,onChange:Ne=>G(Ne.target.value),placeholder:"my-mcp-server",disabled:X||$!==null})]}),l.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("mcp.add.serverDescription"),l.jsx(li,{value:I,onChange:Ne=>Q(Ne.target.value),placeholder:s("mcp.add.serverDescriptionPlaceholder"),disabled:X})]}),l.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("mcp.add.scope"),l.jsxs(Af,{value:V,onValueChange:Ne=>M(Ne),disabled:X||$!==null,children:[l.jsx(jf,{className:"w-full",children:l.jsx(Nf,{})}),l.jsxs(Mf,{children:[l.jsx(vl,{value:"workspace",children:s("settings.scope.workspace")}),l.jsx(vl,{value:"user",children:s("mcp.add.scope.global")})]})]})]}),l.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("mcp.add.config"),l.jsx(V0t,{className:"min-h-44 font-mono text-xs",value:re,onChange:Ne=>se(Ne.target.value),disabled:X})]})]}),l.jsxs(Yg,{children:[l.jsx(qn,{variant:"outline",onClick:()=>{O(!1),z(null)},disabled:X,children:s("common.cancel")}),l.jsxs(qn,{onClick:()=>void We(),disabled:X,children:[X?l.jsx(No,{"data-icon":"inline-start"}):null,s(X?$?"mcp.edit.saving":"mcp.add.adding":$?"mcp.edit.save":"mcp.add.button")]})]})]})});if(qe&&me)return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[_e,l.jsxs("div",{className:"flex w-full flex-col gap-6",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("div",{className:"flex size-11 shrink-0 items-center justify-center rounded-xl bg-muted",children:l.jsx(E7,{})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h1",{className:"break-words text-2xl font-semibold",children:qe.name}),l.jsx("p",{className:"text-sm text-muted-foreground",children:qe.serverToolName||me.name})]})]}),l.jsx(Kl,{children:l.jsx(op,{children:l.jsx(Q0t,{tool:qe,t:s})})})]})]}),ue]});if(Ke&&me)return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[_e,l.jsxs("div",{className:"flex w-full flex-col gap-6",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("div",{className:"flex size-11 shrink-0 items-center justify-center rounded-xl bg-muted",children:l.jsx(T7,{})}),l.jsx("h1",{className:"min-w-0 break-words text-2xl font-semibold",children:Ke.title||Ke.name||Ke.uri})]}),l.jsx(Kl,{children:l.jsx(op,{children:l.jsx(J0t,{resource:Ke,t:s})})})]})]}),ue]});if(me){const Ne=bt,ot=et,pt=Ce[me.name],dn=K0t(me,s);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[_e,l.jsxs("div",{className:"flex w-full flex-col gap-6",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-xl bg-muted",children:l.jsx(ug,{})}),l.jsx("div",{className:"min-w-0 flex-1",children:l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("h1",{className:"break-words text-2xl font-semibold",children:me.name}),l.jsx(za,{variant:"secondary",className:aH(me),children:oH(me,s)}),l.jsx(za,{variant:"outline",children:rH(me,s)})]})}),l.jsxs(kg,{children:[l.jsx(_g,{asChild:!0,children:l.jsx(qn,{variant:"ghost",size:"icon",disabled:_!==null,"aria-label":s("mcp.actions"),"data-testid":"mcp-server-actions",children:_===me.name?l.jsx(No,{}):l.jsx(cg,{})})}),l.jsx(Sg,{align:"end",onCloseAutoFocus:De=>De.preventDefault(),children:l.jsx(c1,{children:dn.map(De=>l.jsx($o,{"data-testid":`mcp-server-action-${De.id}`,variant:De.id==="remove"?"destructive":"default",disabled:_!==null,onSelect:()=>void jn(me,De),children:De.label},De.id))})})]})]}),(ee==null?void 0:ee.serverName)===me.name?l.jsxs(Fi,{variant:ee.error?"destructive":"default",children:[ee.error?l.jsx(Ra,{}):l.jsx(dx,{}),l.jsxs(qi,{className:"whitespace-pre-wrap break-words",children:[l.jsx("p",{children:ee.text}),ee.authUrl&&Y0t(ee.authUrl)?l.jsx("a",{className:"mt-2 inline-block underline underline-offset-3",href:ee.authUrl,target:"_blank",rel:"noreferrer",children:s("mcp.oauth.open")}):null]})]}):null,l.jsxs(Uv,{value:y,onValueChange:w,children:[l.jsxs(Vv,{children:[l.jsx(So,{value:"overview",children:s("mcp.basicInfo")}),l.jsxs(So,{value:"tools",children:[s("mcp.tools")," ",Ne.length]}),l.jsxs(So,{value:"resources",children:[s("mcp.resources")," ",me.resourceCount??ot.length]})]}),l.jsx(Pa,{value:"overview",className:"pt-4",children:l.jsxs(Kl,{children:[l.jsxs(gd,{children:[l.jsx(bd,{className:"text-sm",children:s("mcp.descriptionTitle")}),l.jsx(Jh,{children:((yn=me.description)==null?void 0:yn.trim())||"-"})]}),l.jsxs(op,{className:"grid gap-6 sm:grid-cols-2",children:[l.jsx(cl,{label:s("mcp.source"),value:rH(me,s)}),l.jsx(cl,{label:s("mcp.transport"),value:me.transport}),l.jsx(cl,{label:s("mcp.command"),value:G0t(me,s)}),l.jsx(cl,{label:s("mcp.workingDirectory"),value:((je=me.config)==null?void 0:je.cwd)||o.workspaceCwd}),me.error?l.jsx(cl,{label:s("mcp.invalidReasonLabel"),value:me.error}):null,me.hint?l.jsx(cl,{label:s("mcp.description"),value:me.hint}):null]})]})}),l.jsx(Pa,{value:"tools",className:"pt-4",children:pt!=null&&pt.tools?l.jsxs(Fi,{variant:"destructive",children:[l.jsx(Ra,{}),l.jsx(Fm,{children:s("mcp.loadingTools")}),l.jsx(qi,{children:pt.tools})]}):Ne.length?l.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:Ne.map(De=>l.jsx(Kl,{size:"sm",role:"button",tabIndex:0,className:"cursor-pointer transition-colors hover:bg-accent/50",onClick:()=>b(De.name),onKeyDown:sn=>{(sn.key==="Enter"||sn.key===" ")&&(sn.preventDefault(),b(De.name))},children:l.jsxs(gd,{children:[l.jsx(bd,{className:"break-words",children:De.name}),l.jsx(Jh,{className:"line-clamp-2 text-xs",children:De.description||s("mcp.noDescription")}),De.isValid?null:l.jsx(vrt,{children:l.jsx(za,{variant:"destructive",children:s("mcp.status.blocked")})})]})},De.name))}):l.jsx(jd,{className:"rounded-xl border border-dashed",children:l.jsxs(Md,{children:[l.jsx(Id,{variant:"icon",children:l.jsx(E7,{})}),l.jsx(Rd,{children:s("mcp.emptyTools")})]})})}),l.jsx(Pa,{value:"resources",className:"pt-4",children:pt!=null&&pt.resources?l.jsxs(Fi,{variant:"destructive",children:[l.jsx(Ra,{}),l.jsx(Fm,{children:s("mcp.resourcesUnavailable")}),l.jsx(qi,{children:pt.resources})]}):ot.length?l.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:ot.map(De=>l.jsx(Kl,{size:"sm",role:"button",tabIndex:0,className:"cursor-pointer transition-colors hover:bg-accent/50",onClick:()=>x(De.uri),onKeyDown:sn=>{(sn.key==="Enter"||sn.key===" ")&&(sn.preventDefault(),x(De.uri))},children:l.jsxs(gd,{children:[l.jsx(bd,{className:"break-words",children:De.title||De.name||De.uri}),l.jsx(Jh,{className:"break-all",children:De.uri})]})},De.uri))}):l.jsx(jd,{className:"rounded-xl border border-dashed",children:l.jsxs(Md,{children:[l.jsx(Id,{variant:"icon",children:l.jsx(T7,{})}),l.jsx(Rd,{children:s("mcp.noResources")})]})})})]})]})]}),Xe,ue]})}const Fe=Ee.filter(Ne=>!Ne.disabled&&Ne.mcpStatus==="connecting").length,kt=[{value:"all",label:s("mcp.source.all")},{value:"user",label:s("mcp.source.user")},{value:"workspace",label:s("mcp.source.workspace")},{value:"extension",label:s("mcp.source.extension")}];return l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[_e,l.jsxs("div",{className:"flex w-full flex-col gap-6",children:[l.jsxs("div",{className:"flex items-start justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl font-semibold text-balance",children:s("mcp.title")}),l.jsx("p",{className:"mt-1 text-sm text-muted-foreground tabular-nums",children:s("mcp.servers",{count:Ee.length})})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs(qn,{variant:"outline",onClick:()=>void gt(),disabled:j,children:[j?l.jsx(No,{"data-icon":"inline-start"}):l.jsx(My,{"data-icon":"inline-start"}),s("common.refresh")]}),l.jsxs(qn,{onClick:()=>{z(null),G(""),Q(""),M("workspace"),se(t2),W(null),O(!0)},disabled:X,children:[l.jsx(hx,{"data-icon":"inline-start"}),s("mcp.add.button")]})]})]}),A&&Fe===0?l.jsxs(Fi,{children:[l.jsx(My,{className:"animate-spin"}),l.jsx(Fm,{children:s("mcp.discovery.initializing")}),l.jsx(qi,{children:s("mcp.startingNote")})]}):Fe>0?l.jsxs(Fi,{children:[l.jsx(My,{}),l.jsx(Fm,{children:s("mcp.starting",{count:Fe})}),l.jsx(qi,{children:s("mcp.startingNote")})]}):null,ee&&!ee.serverName?l.jsxs(Fi,{variant:ee.error?"destructive":"default",children:[l.jsx(Ra,{}),l.jsx(qi,{children:ee.text})]}):null,(o.errors??[]).map((Ne,ot)=>l.jsxs(Fi,{variant:"destructive",children:[l.jsx(Ra,{}),l.jsx(Fm,{children:Ne.kind}),l.jsx(qi,{children:Ne.error||Ne.hint||s("mcp.status.unknown")})]},`${Ne.kind}-${ot}`)),o.budgetMode&&o.budgetMode!=="off"?l.jsxs(Fi,{children:[l.jsx(Ra,{}),l.jsx(qi,{children:s("mcp.clientBudget",{count:o.clientCount??0,budget:o.clientBudget??"∞"})})]}):null,l.jsxs("div",{className:"relative",children:[l.jsx(Fd,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),l.jsx(li,{className:"pl-9",value:k,onChange:Ne=>T(Ne.target.value),placeholder:`${s("common.search")} MCP…`})]}),l.jsx(jie,{type:"single",value:S,onValueChange:Ne=>{Ne&&C(Ne)},variant:"outline",size:"sm","aria-label":s("mcp.source"),children:kt.map(Ne=>l.jsx(Mie,{value:Ne.value,children:Ne.label},Ne.value))}),ke.length?l.jsx("div",{className:Coe.serverGrid,"data-column-count":Math.min(ke.length,4),children:ke.map(Ne=>{var ot;return l.jsx(Kl,{size:"sm",role:"button",tabIndex:0,"aria-label":Ne.name,className:"cursor-pointer transition-colors hover:bg-accent/30 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none",onClick:()=>kn(Ne),onKeyDown:pt=>{(pt.key==="Enter"||pt.key===" ")&&(pt.preventDefault(),kn(Ne))},children:l.jsx(gd,{className:"block",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted",children:l.jsx(ug,{className:"size-5"})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-2",children:[l.jsx(bd,{className:"min-w-0 flex-1 truncate",children:Ne.name}),l.jsx(za,{variant:"secondary",className:`${aH(Ne)} shrink-0 text-[10px]`,children:oH(Ne,s)})]}),l.jsx(Jh,{className:"mt-1 truncate text-xs",children:((ot=Ne.description)==null?void 0:ot.trim())||"-"})]})]})})},Ne.name)})}):l.jsx(jd,{className:"border",children:l.jsxs(Md,{children:[l.jsx(Id,{variant:"icon",children:k||S!=="all"?l.jsx(Fd,{}):l.jsx(ug,{})}),l.jsx(Rd,{children:s(k||S!=="all"?"mcp.noMatches":"mcp.empty")}),!k&&S==="all"?l.jsx(Hv,{children:s("mcp.emptyDescription")}):null]})})]}),ue]})}function Z0t({mcpMessage:e,loadMcpMessage:t,onClose:n,onUseSkill:s,initialFocusRef:r}){const{t:i}=ut(),[o,a]=f.useState("extensions"),[c,u]=f.useState(!1),[d,h]=f.useState(0),[m,p]=f.useState(!1),[g,b]=f.useState(null),v=f.useCallback(()=>{p(!1),b(null),t().then(()=>p(!0)).catch(k=>{b(k instanceof Error?k.message:String(k))})},[t]),x=f.useCallback(()=>{u(!1),h(k=>k+1)},[]),y=f.useMemo(()=>({onRoot:x,onDetailChange:u}),[x]),w=k=>{const T=k;a(T),u(!1),h(S=>S+1),T==="mcp"&&v()};return l.jsxs(Uv,{value:o,onValueChange:w,className:"w-full",children:[c?null:l.jsx("div",{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(Vv,{className:"h-8","aria-label":i("plugins.sections"),children:[l.jsx(So,{ref:r,value:"extensions",children:i("plugins.extensions")}),l.jsx(So,{value:"mcp",children:i("plugins.mcp")}),l.jsx(So,{value:"skills",children:i("plugins.skills")})]})}),l.jsx(Pa,{value:o,className:"mt-0",children:o==="extensions"?l.jsx(Soe,{onClose:n,embedded:y},`extensions-${d}`):o==="skills"?l.jsx(Iie,{onClose:n,onUseSkill:s,embedded:y},`skills-${d}`):g?l.jsxs(Fi,{variant:"destructive",className:"mt-4",children:[l.jsx(Fm,{children:i("plugins.mcpLoadFailed")}),l.jsxs(qi,{className:"space-y-3",children:[l.jsx("p",{children:g}),l.jsx(qn,{variant:"outline",size:"sm",onClick:v,children:i("common.retry")})]})]}):e&&m?l.jsx(Toe,{message:e,onClose:n,embedded:y},`mcp-${d}`):l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8 pt-4",children:[l.jsxs("div",{className:"relative",children:[l.jsx(Fd,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),l.jsx(li,{"aria-label":i("common.search"),readOnly:!0,className:"pl-9",placeholder:`${i("common.search")} MCP…`})]}),l.jsx(jd,{className:"border",children:l.jsxs(Md,{children:[l.jsx(Id,{variant:"icon",children:l.jsx(ug,{})}),l.jsx(Rd,{children:i("mcp.empty")}),l.jsx(Hv,{children:i("mcp.emptyDescription")})]})})]})})]})}const egt="_section_1ghly_1",tgt="_header_1ghly_12",ngt="_title_1ghly_19",sgt="_addButton_1ghly_24",rgt="_hint_1ghly_38",igt="_empty_1ghly_39",ogt="_provider_1ghly_45",agt="_providerName_1ghly_51",lgt="_modelRow_1ghly_59",cgt="_modelInfo_1ghly_70",ugt="_modelName_1ghly_78",dgt="_modelBaseUrl_1ghly_84",hgt="_currentBadge_1ghly_91",fgt="_runtimeBadge_1ghly_99",mgt="_modelActions_1ghly_107",pgt="_actionButton_1ghly_114",ggt="_deleteButton_1ghly_115",bgt="_confirmButton_1ghly_116",Ei={section:egt,header:tgt,title:ngt,addButton:sgt,hint:rgt,empty:igt,provider:ogt,providerName:agt,modelRow:lgt,modelInfo:cgt,modelName:ugt,modelBaseUrl:dgt,currentBadge:hgt,runtimeBadge:fgt,modelActions:mgt,actionButton:pgt,deleteButton:ggt,confirmButton:bgt};function e_(e,t){return`${e.authType}:${t.modelId}:${t.baseUrl??""}`}function ygt(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 e_(r.provider,r.model);const i=n.filter(({model:o})=>o.baseModelId===t);if(i.length===1)return e_(i[0].provider,i[0].model)}const s=n.find(({model:r})=>r.isCurrent);return s?e_(s.provider,s.model):void 0}function xgt({providers:e,currentModelId:t,loading:n,error:s,busy:r,onSelectModel:i,onDeleteModel:o,onAddModel:a}){const{t:c}=ut(),[u,d]=f.useState(null);f.useEffect(()=>{if(u===null)return;const p=g=>{g.key==="Escape"&&d(null)};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[u]);const h=e.some(p=>p.models.length>0),m=ygt(e,t);return l.jsxs("div",{className:Ei.section,"data-testid":"model-management",children:[l.jsxs("div",{className:Ei.header,children:[l.jsx("span",{className:Ei.title,children:c("settings.models.title")}),l.jsx("button",{type:"button",className:Ei.addButton,disabled:r,onClick:a,children:c("settings.models.add")})]}),s&&l.jsx("div",{className:Ei.hint,children:s.message}),n&&!h&&l.jsx("div",{className:Ei.hint,children:c("settings.models.loading")}),!n&&!h&&!s&&l.jsx("div",{className:Ei.empty,children:c("settings.models.empty")}),e.map((p,g)=>p.models.length===0?null:l.jsxs("div",{className:Ei.provider,children:[l.jsx("div",{className:Ei.providerName,children:p.authType}),p.models.map(b=>{const v=e_(p,b),x=v===m,y=u===v,w=b.name||b.baseModelId;return l.jsxs("div",{className:Ei.modelRow,children:[l.jsxs("div",{className:Ei.modelInfo,children:[l.jsx("span",{className:Ei.modelName,children:b.name||b.baseModelId}),x&&l.jsx("span",{className:Ei.currentBadge,children:c("settings.models.current")}),b.isRuntime&&l.jsx("span",{className:Ei.runtimeBadge,children:c("settings.models.runtime")}),b.baseUrl&&l.jsx("span",{className:Ei.modelBaseUrl,children:b.baseUrl})]}),l.jsxs("div",{className:Ei.modelActions,children:[!x&&l.jsx("button",{type:"button",className:Ei.actionButton,disabled:r,"aria-label":`${c("settings.models.setCurrent")} ${w}`,onClick:()=>i(b.modelId),children:c("settings.models.setCurrent")}),!b.isRuntime&&(y?l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:Ei.confirmButton,disabled:r,"aria-label":`${c("settings.models.confirmDelete")} ${w}`,onClick:()=>{d(null),o({authType:p.authType,modelId:b.baseModelId,...b.baseUrl?{baseUrl:b.baseUrl}:{}})},children:c("settings.models.confirmDelete")}),l.jsx("button",{type:"button",className:Ei.actionButton,disabled:r,"aria-label":`${c("settings.models.cancel")} ${w}`,onClick:()=>d(null),children:c("settings.models.cancel")})]}):l.jsx("button",{type:"button",className:Ei.deleteButton,disabled:r,"aria-label":`${c("settings.models.delete")} ${w}`,onClick:()=>d(v),children:c("settings.models.delete")}))]})]},v)})]},`${p.authType}:${g}`))]})}function PI({className:e,...t}){return l.jsx("div",{"data-slot":"field-group",className:Kt("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 vgt=Bp("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 Cg({className:e,orientation:t="vertical",...n}){return l.jsx("div",{role:"group","data-slot":"field","data-orientation":t,className:Kt(vgt({orientation:t}),e),...n})}function Eoe({className:e,...t}){return l.jsx("div",{"data-slot":"field-content",className:Kt("group/field-content flex flex-1 flex-col gap-0.5 leading-snug",e),...t})}function Yy({className:e,...t}){return l.jsx(RE,{"data-slot":"field-label",className:Kt("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 wgt({className:e,...t}){return l.jsx("div",{"data-slot":"field-label",className:Kt("flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50",e),...t})}function a9({className:e,...t}){return l.jsx("p",{"data-slot":"field-description",className:Kt("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 kgt({className:e,children:t,errors:n,...s}){const r=f.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:l.jsx("ul",{className:"ml-4 flex list-disc flex-col gap-1",children:i.map((a,c)=>(a==null?void 0:a.message)&&l.jsx("li",{children:a.message},c))})},[t,n]);return r?l.jsx("div",{role:"alert","data-slot":"field-error",className:Kt("text-sm font-normal text-destructive",e),...s,children:r}):null}function Aoe({className:e,size:t="default",...n}){return l.jsx(eee,{"data-slot":"switch","data-size":t,className:Kt("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:l.jsx(nee,{"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"})})}const _gt=new Set(["fastModel","visionModel","voiceModel","modelFallbacks"]),Sgt=new Set(["ui.hideTips","ui.enableUserFeedback","ui.compactMode","ui.compactInline","mcpServers"]);function hC(e,t,n){const s=e(t);return s===t?n:s}function lH(e,t){return hC(t,`settings.category.${e}`,e)}function v0(e,t){return hC(t,`settings.label.${e.key}`,e.label)}function Cgt(e,t){if(e.description)return hC(t,`settings.description.${e.key}`,e.description)}function Noe(e,t,n,s){return hC(s,`settings.option.${e.key}.${String(t)}`,n)}function Tgt(e,t,n){const s=Moe(e,t);if(s==null)return"";if(e.key===qm){const i=BN(s,$r.Dark);return n(`theme.${i}`)}if(e.key===z_){const i=RN(s);return i?DN(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?Noe(e,i.value,i.label,n):String(s)}const r=String(s);return r.length>24?`${r.slice(0,21)}…`:r}function joe(e,t){return(t==="user"?e.values.user:e.values.workspace)!==void 0}function Egt(e,t){if(t==="workspace"?e.values.user!==void 0:e.values.workspace!==void 0)return joe(e,t)?"settings.alsoModifiedIn":"settings.modifiedIn"}function Moe(e,t){const n=t==="user"?e.values.user:e.values.workspace;return n!==void 0?n:e.values.effective}function Agt(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 cH({category:e}){const t=e.toLowerCase(),n=t.includes("ui")?_pe:t.includes("tool")?E7:t.includes("context")?T7:t.includes("privacy")?Fpe:t.includes("model")?IG:t.includes("daemon")?ug:t.includes("advanced")?Hpe:t.includes("experimental")?npe:OG;return l.jsx(n,{"data-icon":"inline-start","aria-hidden":"true"})}function uH({title:e,description:t,metadata:n,control:s}){return l.jsxs(Cg,{orientation:"responsive",className:"min-h-20 gap-6 px-5 py-4 max-md:px-4",children:[l.jsxs(Eoe,{className:"min-w-0",children:[l.jsxs(wgt,{children:[e,n]}),t&&l.jsx(a9,{className:"max-w-3xl",children:t})]}),l.jsx("div",{className:"flex min-w-0 justify-end max-md:justify-start",children:s})]})}function Ngt({name:e,label:t,type:n,value:s,disabled:r,onCommit:i,onInvalid:o}){const a=String(s??""),[c,u]=f.useState(a);f.useEffect(()=>u(a),[a]);const d=()=>{if(n==="number"){const h=c.trim(),m=Number(h);if(!h||!Number.isFinite(m)){u(a),o();return}m!==s&&i(m);return}c!==a&&i(c)};return l.jsx(li,{type:n,name:e,autoComplete:"off","aria-label":t,value:c,disabled:r,className:"w-[min(80px,50vw)] max-md:w-full",onChange:h=>u(h.target.value),onBlur:d,onKeyDown:h=>{h.key==="Enter"&&h.currentTarget.blur(),h.key==="Escape"&&(u(a),h.currentTarget.blur())}})}function jgt({settingsState:e,onLanguageChange:t,onSubDialog:n,onThemeChange:s,chatWidthMode:r,onChatWidthModeChange:i,modelManagement:o,embedded:a=!1}){const{language:c,t:u}=ut(),d=w1(),{status:h,settings:m,loading:p,error:g,reload:b,setValue:v}=e,[x,y]=f.useState("workspace"),[w,k]=f.useState(""),[T,S]=f.useState(null),[C,_]=f.useState(null),[B,A]=f.useState(!1),N=p&&!h,j=f.useMemo(()=>{const F=m.filter(V=>!Sgt.has(V.key)),G=Agt(F).map(V=>({id:V.category,label:lH(V.category,u),items:V.items.map(M=>({type:"setting",setting:M}))})),I={type:"local",localKey:"chatWidth"},Q=G.find(V=>V.items.some(M=>M.type==="setting"&&M.setting.key===qm));if(Q){const V=Q.items.findIndex(M=>M.type==="setting"&&M.setting.key===qm);Q.items.splice(V+1,0,I)}else G.push({id:"UI",label:lH("UI",u),items:[I]});return G},[m,u]);f.useEffect(()=>{j.length!==0&&(j.some(F=>F.id===w)||k(j[0].id))},[w,j]),f.useEffect(()=>{var F;g?_(g.message):(F=h==null?void 0:h.warnings)!=null&&F.length?_(h.warnings.map(G=>u("settings.corrupted",{recovered:G.recovered?"true":"false"})).join("; ")):m.length>0&&_(null)},[g,m,h,u]);const P=f.useCallback((F,G)=>{B||_(null),S(F),v(x,F,G).then(async I=>{try{await b()}catch{}I!=null&&I.requiresRestart&&F!==z_&&A(!0)}).catch(I=>{_(I instanceof Error?I.message:String(I))}).finally(()=>S(null))},[b,B,x,v]),L=j.find(F=>F.id===w)??j[0],O=L==null?void 0:L.items.some(F=>F.type==="setting"&&F.setting.category==="Model"),$=(F,G,I,Q,V=!1)=>l.jsxs(Af,{value:F,disabled:V,onValueChange:G,children:[l.jsx(jf,{size:"sm","aria-label":Q,className:"w-[min(160px,50vw)] bg-background max-md:w-full",children:l.jsx(Nf,{})}),l.jsx(Mf,{position:"popper",align:"end",children:l.jsx(yM,{children:I.map(M=>l.jsx(vl,{value:M.value,children:M.label},M.value))})})]}),z=F=>{var V;const G=Moe(F,x),Q=T===F.key;if(F.key===qm)return $(BN(G)??d,M=>{const re=M;s(re),P(qm,GG(re))},VG.map(M=>({value:M,label:u(`theme.${M}`)})),v0(F,u),Q);if(F.key===z_)return $(RN(G)??c,M=>t(M,x),S0e.map(M=>({value:M,label:DN(M)})),v0(F,u),Q);if(_gt.has(F.key))return l.jsx(qn,{type:"button",variant:"outline",size:"sm",disabled:Q,className:"max-w-[260px] truncate",onClick:()=>n(F.key,x),children:Tgt(F,x,u)||u("settings.action.select")});if(F.type==="boolean"){const M=G===!0;return l.jsx(Aoe,{checked:M,disabled:Q,onCheckedChange:re=>P(F.key,re),"aria-label":v0(F,u)})}if(F.type==="enum"&&((V=F.options)!=null&&V.length)){const M=F.options.findIndex(re=>re.value===G);return $(M>=0?String(M):"",re=>{var X;const se=(X=F.options)==null?void 0:X[Number(re)];se&&P(F.key,se.value)},F.options.map((re,se)=>({value:String(se),label:Noe(F,re.value,re.label,u)})),v0(F,u),Q)}return l.jsx(Ngt,{name:F.key,label:v0(F,u),type:F.type==="number"?"number":"text",value:G,disabled:Q,onCommit:M=>P(F.key,M),onInvalid:()=>_(u("settings.invalidNumber"))})};return l.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&&l.jsx("div",{className:"flex items-center justify-between border-b border-border px-5 py-4",children:l.jsxs("div",{children:[l.jsx("h2",{className:"text-base font-semibold text-balance",children:u("settings.title")}),l.jsx("div",{className:"mt-0.5 text-xs text-muted-foreground",children:u("settings.scope.workspace")})]})}),(C||N)&&l.jsxs(Fi,{className:"mx-4 mt-3 w-auto",children:[N&&l.jsx(No,{}),l.jsx(qi,{children:C||u("settings.loading")})]}),l.jsxs(Uv,{value:x,className:"flex min-h-0 flex-1 flex-col gap-0",onValueChange:F=>{y(F)},children:[l.jsxs("div",{className:"flex items-center justify-between gap-4 border-b border-border px-3 py-2",children:[l.jsxs(Vv,{className:"p-0",children:[l.jsx(So,{value:"workspace",children:u("settings.scope.workspace")}),l.jsx(So,{value:"user",children:u("settings.scope.user")})]}),B&&l.jsx(za,{variant:"secondary",children:u("settings.requiresRestart")})]}),l.jsxs(Pa,{value:x,forceMount:!0,className:"grid min-h-0 flex-1 grid-cols-[190px_minmax(0,1fr)] outline-none max-md:grid-cols-1",children:[l.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":u("settings.title"),children:j.map(F=>l.jsxs(qn,{type:"button",variant:F.id===w?"secondary":"ghost",size:"sm","aria-current":F.id===w?"page":void 0,className:"w-full justify-start gap-2 px-2.5 max-md:w-auto max-md:shrink-0",onClick:()=>k(F.id),children:[l.jsx(cH,{category:F.id}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:F.label}),l.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:F.items.length})]},F.id))}),l.jsxs("section",{className:"min-h-0 min-w-0 overflow-y-auto bg-background p-5 max-md:p-3",children:[!p&&!L&&l.jsx(jd,{className:"min-h-60",children:l.jsxs(Md,{children:[l.jsx(Id,{variant:"icon",children:l.jsx(OG,{})}),l.jsx(Rd,{children:u("settings.empty")}),l.jsx(Hv,{children:u("settings.empty")})]})}),L&&l.jsxs("div",{className:"mx-auto w-full max-w-5xl",children:[l.jsxs(Kl,{children:[l.jsx(gd,{children:l.jsxs(bd,{className:"flex items-center gap-2",children:[l.jsx(cH,{category:L.id}),L.label]})}),l.jsx(op,{className:"-mb-(--card-spacing) p-0",children:l.jsx(PI,{className:"gap-0",children:L.items.map((F,G)=>{const I=G>0&&l.jsx(_oe,{className:"mx-5 w-auto max-md:mx-4"});if(F.type==="local")return l.jsxs("div",{children:[I,l.jsx(uH,{title:u("settings.label.ui.chatWidth"),description:u("settings.description.ui.chatWidth"),control:$(r,X=>i(X),[{value:"1000",label:u("settings.option.ui.chatWidth.1000")},{value:"wide",label:u("settings.option.ui.chatWidth.wide")}],u("settings.label.ui.chatWidth"),!1)})]},F.localKey);const Q=F.setting,V=Cgt(Q,u),M=Egt(Q,x),re=joe(Q,x),se=M?u(M,{scope:u(x==="workspace"?"settings.scope.user":"settings.scope.workspace")}):void 0;return l.jsxs("div",{children:[I,l.jsx(uH,{title:v0(Q,u),description:[V,se].filter(Boolean).join(" · ")||void 0,metadata:re?l.jsx(za,{variant:"secondary",children:u(x==="workspace"?"settings.scope.workspace":"settings.scope.user")}):void 0,control:T===Q.key?l.jsx(No,{}):z(Q)})]},Q.key)})})})]}),O&&o&&l.jsx("div",{className:"mt-4",children:l.jsx(xgt,{...o})})]})]})]})]}),!a&&l.jsx("div",{className:"border-t border-border px-5 py-3 text-xs text-muted-foreground",children:u("settings.footer")})]})}const Mgt="_dialog_1ymqd_1",Igt="_toolbar_1ymqd_12",Rgt="_tabs_1ymqd_21",Dgt="_tab_1ymqd_21",Lgt="_tabActive_1ymqd_39",Pgt="_search_1ymqd_48",Ogt="_general_1ymqd_60",Bgt="_shortcuts_1ymqd_67",$gt="_shortcut_1ymqd_67",zgt="_shortcutKey_1ymqd_87",Fgt="_shortcutDesc_1ymqd_95",qgt="_commandList_1ymqd_101",Hgt="_commandCard_1ymqd_108",Ugt="_commandCardExpanded_1ymqd_115",Vgt="_commandRow_1ymqd_119",Wgt="_commandName_1ymqd_135",Ggt="_commandTag_1ymqd_142",Kgt="_chevron_1ymqd_152",Ygt="_chevronExpanded_1ymqd_160",Xgt="_commandDetail_1ymqd_164",Qgt="_commandDescription_1ymqd_174",Jgt="_commandSubcommands_1ymqd_175",Zgt="_empty_1ymqd_182",oi={dialog:Mgt,toolbar:Igt,tabs:Rgt,tab:Dgt,tabActive:Lgt,search:Pgt,general:Ogt,shortcuts:Bgt,shortcut:$gt,shortcutKey:zgt,shortcutDesc:Fgt,commandList:qgt,commandCard:Hgt,commandCardExpanded:Ugt,commandRow:Vgt,commandName:Wgt,commandTag:Ggt,chevron:Kgt,chevronExpanded:Ygt,commandDetail:Xgt,commandDescription:Qgt,commandSubcommands:Jgt,empty:Zgt},e1t=[{id:"general",labelKey:"help.tab.general"},{id:"commands",labelKey:"help.tab.commands"},{id:"custom-commands",labelKey:"help.tab.custom"}],t1t=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"]),n1t=[["@","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 s1t(e){return[`/${e.name}`,e.argumentHint].filter(Boolean).join(" ")}function l9(e){return!t1t.has(e.name)}function r1t(e,t){return l9(e)?t("help.commandMeta.custom"):t("help.commandMeta.builtIn")}function i1t(e,t,n){const s=n.trim().toLowerCase();return e.filter(r=>r.name&&r.description!==void 0).filter(r=>t==="commands"?!l9(r):t==="custom-commands"?l9(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 o1t(){const{t:e}=ut();return l.jsx("div",{className:oi.general,children:l.jsx("div",{className:oi.shortcuts,children:n1t.map(([t,n])=>l.jsxs("div",{className:oi.shortcut,children:[l.jsx("span",{className:oi.shortcutDesc,children:e(n)}),l.jsx("span",{className:oi.shortcutKey,children:t})]},t))})})}function a1t({commands:e,tab:t,query:n}){const{t:s}=ut(),[r,i]=f.useState(null),o=f.useMemo(()=>i1t(e,t,n),[e,n,t]);return o.length===0?l.jsx("div",{className:oi.empty,children:s(t==="custom-commands"?"help.emptyCustom":"help.empty")}):l.jsx("div",{className:oi.commandList,children:o.map(a=>{var u;const c=r===a.name;return l.jsxs("article",{className:`${oi.commandCard} ${c?oi.commandCardExpanded:""}`,children:[l.jsxs("button",{type:"button",className:oi.commandRow,onClick:()=>i(c?null:a.name),"aria-expanded":c,children:[l.jsx("span",{className:oi.commandName,children:s1t(a)}),l.jsx("span",{className:oi.commandTag,children:r1t(a,s)}),l.jsx("svg",{className:`${oi.chevron} ${c?oi.chevronExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})]}),c&&l.jsxs("div",{className:oi.commandDetail,children:[a.description&&l.jsx("div",{className:oi.commandDescription,children:a.description}),!!((u=a.subcommands)!=null&&u.length)&&l.jsxs("div",{className:oi.commandSubcommands,children:[s("help.subcommands"),": ",a.subcommands.join(", ")]})]})]},a.name)})})}function l1t({commands:e}){const{t}=ut(),[n,s]=f.useState("general"),{filterValue:r,inputProps:i}=cC(),o=n!=="general";return l.jsxs("div",{className:oi.dialog,children:[l.jsxs("div",{className:oi.toolbar,children:[l.jsx("div",{className:oi.tabs,children:e1t.map(a=>l.jsx("button",{type:"button",className:`${oi.tab} ${a.id===n?oi.tabActive:""}`,onClick:()=>s(a.id),children:t(a.labelKey)},a.id))}),o&&l.jsx("input",{className:oi.search,...i,placeholder:t("help.search")})]}),n==="general"?l.jsx(o1t,{}):l.jsx(a1t,{commands:e,tab:n,query:r})]})}function c1t({currentTheme:e,onSelect:t,onClose:n}){const{t:s}=ut(),r=VG.map(d=>({id:d,label:s(`theme.${d}`),description:s(`theme.${d}.desc`)})),[i,o]=f.useState(()=>{const d=r.findIndex(h=>h.id===e);return d>=0?d:0}),a=f.useRef(null),c=d=>{const h=r[d];h&&(t(h.id),n())},{keyboardMode:u}=rm({itemCount:r.length,activeIndex:i,onActiveIndexChange:o,onConfirm:c});return f.useEffect(()=>{var h;const d=(h=a.current)==null?void 0:h.children[i];d==null||d.scrollIntoView({block:"nearest"})},[i]),l.jsx("div",{className:en("picker-list","picker-list-compact",u?"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 m=d.id===e;return l.jsxs("div",{id:`theme-opt-${h}`,role:"option","aria-selected":m,className:en("picker-item","picker-session-item",h===i?"selected":void 0,m?"dialog-current":void 0),"data-web-shell-theme-option":!0,"data-theme-id":d.id,onClick:()=>c(h),onMouseMove:()=>o(h),children:[l.jsx("div",{className:en("picker-item-row"),children:l.jsx("span",{className:en("picker-item-title"),children:d.label})}),l.jsx("div",{className:en("picker-item-meta"),children:d.description})]},d.id)})})}const c9="delete-session-list",dH=e=>`${c9}-opt-${e}`;function u1t({onDeleted:e,onError:t,onClose:n,workspaceCwd:s}){const{t:r}=ut(),i=Cl(),{sessions:o,loading:a,error:c,deleteSession:u,deleteSessions:d}=qv(s,{autoLoad:!0}),h=i.sessionId,[m,p]=f.useState(!1),[g,b]=f.useState(-1),[v,x]=f.useState(new Set),{filterValue:y,inputProps:w}=cC(()=>{b(-1),x(new Set)}),[k,T]=f.useState(null),S=f.useRef(null),C=f.useRef(null);f.useEffect(()=>{c&&T(c.message)},[c]);const _=f.useMemo(()=>y?o.filter(L=>{const O=y.toLowerCase();return(L.displayName||"").toLowerCase().includes(O)||L.sessionId.toLowerCase().includes(O)}):o,[o,y]),B=f.useCallback(L=>{L!==h&&x(O=>{const $=new Set(O);return $.has(L)?$.delete(L):$.add(L),$})},[h]);f.useEffect(()=>{if(v.size===0)return;const L=new Set(_.map(O=>O.sessionId));x(O=>{const $=new Set([...O].filter(z=>L.has(z)));return $.size===O.size?O:$})},[_,v.size]),f.useEffect(()=>{g>=_.length&&_.length>0&&b(_.length-1)},[_.length,g]),f.useEffect(()=>{var O;const L=(O=S.current)==null?void 0:O.children[g];L==null||L.scrollIntoView({block:"nearest"})},[g]),f.useEffect(()=>{var L;(L=C.current)==null||L.focus()},[]);const{keyboardMode:A}=rm({itemCount:_.length,activeIndex:g,onActiveIndexChange:b,onConfirm:L=>{const O=_[L];O&&B(O.sessionId)}}),N=f.useCallback(()=>{if(m)return;if(v.size>0){const O=new Set(_.map(z=>z.sessionId)),$=Array.from(v).filter(z=>O.has(z));if($.length===0)return;p(!0),d($).then(z=>{const F=z.removed.length+z.notFound.length,G=z.errors.length;if(G>0&&F>0){t(new Error(r("delete.partialFail",{removed:F,failed:G,detail:z.errors[0].error}))),n();return}if(G>0){T(r("delete.allFailed",{count:G,reason:z.errors[0].error})),p(!1),x(new Set);return}if(F===0){T(r("delete.nonRemoved")),p(!1),x(new Set);return}e([...z.removed,...z.notFound]),n()}).catch(z=>{t(z),p(!1)});return}const L=_[g];if(L){if(L.sessionId===h){T(r("delete.cannotCurrent"));return}p(!0),u(L.sessionId).then(O=>{if(!O){T(r("delete.notFound")),p(!1);return}e([L.sessionId]),n()}).catch(O=>{t(O),p(!1)})}},[h,u,d,m,_,n,e,t,g,v,r]),j=v.size>0,P=!m&&!a&&j;return l.jsxs("div",{className:en("picker","picker-in-shell"),children:[l.jsxs("div",{className:en("picker-search"),children:[l.jsxs("span",{className:en("picker-search-label"),children:[r("resume.search"),":"," "]}),l.jsx("input",{ref:C,className:en("picker-search-input"),"aria-label":r("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":c9,"aria-activedescendant":g>=0&&g<_.length?dH(g):void 0,...w,placeholder:""}),l.jsx("span",{className:en("picker-search-hint"),children:k||(m?r("delete.deleting"):a?r("common.loading"):j?r("delete.selected",{count:v.size}):y?r("delete.matches",{count:_.length}):"")})]}),l.jsx("div",{className:en("picker-sep")}),l.jsxs("div",{id:c9,role:"listbox","aria-multiselectable":"true",className:en("picker-list",A?"picker-keyboard-only":void 0),ref:S,children:[a&&l.jsx("div",{className:en("picker-empty"),children:r("common.loading")}),!a&&c&&l.jsx("div",{className:en("picker-empty"),children:c.message}),!a&&!c&&_.length===0&&l.jsx("div",{className:en("picker-empty"),children:y?r("delete.noMatch",{query:y}):r("delete.none")}),!a&&_.map((L,O)=>{const $=L.sessionId===h,z=v.has(L.sessionId);return l.jsx(NI,{session:L,optionId:dH(O),active:O===g,ariaSelected:z,current:!1,disabled:$,leading:l.jsx("span",{className:en("picker-item-checkbox",z?"picker-item-checkbox-checked":void 0),children:z?"[x] ":"[ ] "}),trailing:$?l.jsx("span",{className:en("picker-item-badge"),children:r("resume.current")}):void 0,onClick:()=>{b(O),$||B(L.sessionId)},onActivate:()=>b(O)},L.sessionId)})]}),l.jsx("div",{className:en("picker-sep")}),l.jsxs("div",{className:en("dialog-footer-actions"),children:[l.jsx("button",{type:"button",className:en("dialog-inline-button"),onClick:n,disabled:m,children:r("common.cancel")}),l.jsx("button",{type:"button",className:en("dialog-danger-button"),onClick:N,disabled:!P,children:r(m?"delete.deleting":"delete.action")})]})]})}const u9="release-session-list",hH=e=>`${u9}-opt-${e}`;function d1t({onReleased:e,onError:t,onClose:n,workspaceCwd:s}){const{t:r}=ut(),i=Cl(),{sessions:o,loading:a,error:c,releaseSession:u}=qv(s,{autoLoad:!0}),d=i.sessionId,[h,m]=f.useState(!1),[p,g]=f.useState(-1),[b,v]=f.useState(null),{filterValue:x,inputProps:y}=cC(()=>{g(-1),v(null)}),[w,k]=f.useState(null),T=f.useRef(null),S=f.useRef(null);f.useEffect(()=>{c&&k(c.message)},[c]);const C=x?o.filter(L=>{const O=x.toLowerCase();return(L.displayName||"").toLowerCase().includes(O)||L.sessionId.toLowerCase().includes(O)}):o,_=L=>{const O=C[L];if(!O)return;const $=O.sessionId===d,z=(O.clientCount??0)>0||O.hasActivePrompt===!0;$||!z||(g(L),v(O.sessionId))};f.useEffect(()=>{p>=C.length&&C.length>0&&g(C.length-1)},[C.length,p]),f.useEffect(()=>{var O;const L=(O=T.current)==null?void 0:O.children[p];L==null||L.scrollIntoView({block:"nearest"})},[p]),f.useEffect(()=>{var L;(L=S.current)==null||L.focus()},[]);const{keyboardMode:B}=rm({itemCount:C.length,activeIndex:p,onActiveIndexChange:g,onConfirm:_}),A=f.useCallback(L=>{const O=L??C.find(z=>z.sessionId===b)??void 0;if(!O||h)return;if(!((O.clientCount??0)>0||O.hasActivePrompt===!0)){k(r("release.inactive"));return}if(O.sessionId===d){k(r("release.cannotCurrent"));return}u&&(m(!0),u(O.sessionId).then(()=>{e(O.sessionId),n()}).catch(z=>{t(z),m(!1)}))},[d,h,C,n,t,e,u,b,r]),N=C.find(L=>L.sessionId===b)??void 0,j=N&&((N.clientCount??0)>0||N.hasActivePrompt===!0),P=!h&&!a&&!!N&&N.sessionId!==d&&!!j;return l.jsxs("div",{className:en("picker","picker-in-shell"),children:[l.jsxs("div",{className:en("picker-search"),children:[l.jsxs("span",{className:en("picker-search-label"),children:[r("resume.search"),":"," "]}),l.jsx("input",{ref:S,className:en("picker-search-input"),"aria-label":r("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":u9,"aria-activedescendant":p>=0&&p<C.length?hH(p):void 0,...y,placeholder:""}),l.jsx("span",{className:en("picker-search-hint"),children:w||(h?r("release.releasing"):a?r("common.loading"):x?r("release.matches",{count:C.length}):"")})]}),l.jsx("div",{className:en("picker-sep")}),l.jsxs("div",{id:u9,role:"listbox",className:en("picker-list",B?"picker-keyboard-only":void 0),ref:T,children:[a&&l.jsx("div",{className:en("picker-empty"),children:r("common.loading")}),!a&&C.length===0&&l.jsx("div",{className:en("picker-empty"),children:x?r("release.noMatch",{query:x}):r("release.none")}),!a&&C.map((L,O)=>{const $=L.sessionId===d,z=(L.clientCount??0)>0||L.hasActivePrompt===!0,F=$||!z;return l.jsx(NI,{session:L,optionId:hH(O),active:O===p,confirmed:L.sessionId===b,ariaSelected:L.sessionId===b,current:!1,disabled:F,trailing:$?l.jsx("span",{className:en("picker-item-badge"),children:r("resume.current")}):z?void 0:l.jsx("span",{className:en("picker-item-badge"),children:r("release.inactiveBadge")}),onClick:()=>_(O),onActivate:()=>g(O)},L.sessionId)})]}),l.jsx("div",{className:en("picker-sep")}),l.jsxs("div",{className:en("dialog-footer-actions"),children:[l.jsx("button",{type:"button",className:en("dialog-inline-button"),onClick:n,disabled:h,children:r("common.cancel")}),l.jsx("button",{type:"button",className:en("dialog-danger-button"),onClick:()=>A(),disabled:!P,children:r(h?"release.releasing":"release.action")})]})]})}const h1t="_root_ieg2d_1",f1t="_list_ieg2d_8",m1t="_item_ieg2d_21",p1t="_itemCursor_ieg2d_42",g1t="_itemSelected_ieg2d_49",b1t="_prompt_ieg2d_61",y1t="_keyboardOnly_ieg2d_68",x1t="_itemDisabled_ieg2d_77",v1t="_turn_ieg2d_91",w1t="_time_ieg2d_96",k1t="_footer_ieg2d_102",_1t="_footerMessage_ieg2d_112",S1t="_dangerButton_ieg2d_118",sl={root:h1t,list:f1t,item:m1t,itemCursor:p1t,itemSelected:g1t,prompt:b1t,keyboardOnly:y1t,itemDisabled:x1t,turn:v1t,time:w1t,footer:k1t,footerMessage:_1t,dangerButton:S1t},C1t="rewind-snapshot-list",fH=e=>`${C1t}-opt-${e}`;function T1t(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 E1t(e){const t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString():e}function A1t({blocks:e,loadSnapshots:t,rewind:n,onError:s,onClose:r}){const{t:i}=ut(),[o,a]=f.useState([]),[c,u]=f.useState(!0),[d,h]=f.useState(null),[m,p]=f.useState(0),[g,b]=f.useState(null),[v,x]=f.useState(null);f.useEffect(()=>{let _=!0;return u(!0),t().then(B=>{_&&a(B.snapshots)}).catch(B=>{_&&s(B)}).finally(()=>{_&&u(!1)}),()=>{_=!1}},[t,s]);const y=f.useMemo(()=>o.map(_=>({snapshot:_,promptText:T1t(e,_.turnIndex)})).sort((_,B)=>_.snapshot.turnIndex-B.snapshot.turnIndex),[e,o]);f.useEffect(()=>{m>=y.length&&y.length>0&&p(y.length-1)},[y.length,m]);const w=f.useRef(null),k=d!==null,T=_=>{!_||d||(h(_),x(null),n(_).then(()=>{r()}).catch(B=>{s(B),x(i("rewind.failed",{reason:B instanceof Error?B.message:String(B)})),h(null)}))},S=_=>{const B=y[_];B&&(p(_),b(B.snapshot.promptId))},{keyboardMode:C}=rm({itemCount:y.length,activeIndex:m,onActiveIndexChange:p,onConfirm:S,enabled:!k});return f.useEffect(()=>{var B;const _=(B=w.current)==null?void 0:B.children[m];_==null||_.scrollIntoView({block:"nearest"})},[m]),f.useEffect(()=>{var B;if(c||y.length===0)return;const _=document.activeElement;(_==null?void 0:_.getAttribute("role"))==="dialog"&&((B=w.current)==null||B.focus())},[c,y.length]),c?l.jsx("div",{className:en("picker-empty"),children:i("rewind.loading")}):y.length===0?l.jsx("div",{className:en("picker-empty"),children:i("rewind.empty")}):l.jsxs("div",{className:sl.root,children:[l.jsx("div",{className:`${sl.list} ${C?sl.keyboardOnly:""}`,ref:w,role:"listbox","aria-label":i("rewind.title"),tabIndex:0,"aria-activedescendant":y.length>0?fH(m):void 0,children:y.map(({snapshot:_,promptText:B},A)=>{const N=A===m,j=g===_.promptId,P=B||i("rewind.promptFallback",{id:_.promptId.slice(-8)});return l.jsxs("div",{id:fH(A),role:"option","aria-selected":j,"aria-disabled":k||void 0,className:`${sl.item} ${N?sl.itemCursor:""} ${j?sl.itemSelected:""} ${k?sl.itemDisabled:""}`,onClick:()=>{k||S(A)},onMouseMove:()=>p(A),children:[l.jsxs("div",{className:sl.prompt,title:P,children:[l.jsxs("span",{className:sl.turn,children:["#",_.turnIndex+1]})," ",P]}),l.jsx("div",{className:sl.time,children:E1t(_.timestamp)})]},_.promptId)})}),l.jsxs("div",{className:sl.footer,children:[v&&l.jsx("span",{className:sl.footerMessage,role:"alert",children:v}),l.jsx("button",{type:"button",className:en("dialog-inline-button"),onClick:r,disabled:d!==null,children:i("common.cancel")}),l.jsx("button",{type:"button",className:`${en("dialog-danger-button")} ${sl.dangerButton}`,onClick:()=>T(g),disabled:!g||d!==null,children:i(d?"rewind.rewinding":"rewind.confirm")})]})]})}const o8="add-workspace-hint",mH="add-workspace-error",n2="add-workspace-suggestions",N1t=150;function pH(e){return e.startsWith("/")||/^[A-Za-z]:[\\/]/.test(e)}function j1t({onClose:e,onAdd:t,onSuggest:n}){const{t:s}=ut(),[r,i]=f.useState(""),[o,a]=f.useState(null),[c,u]=f.useState(!1),[d,h]=f.useState(!0),[m,p]=f.useState([]),[g,b]=f.useState(!1),[v,x]=f.useState(-1),[y,w]=f.useState("/"),k=f.useRef(null),T=f.useRef(!1);T.current=g&&m.length>0;const S=f.useRef(0),C=f.useRef(!1);f.useEffect(()=>{var P;(P=k.current)==null||P.focus()},[]);const _=f.useCallback(()=>{b(!1),x(-1)},[]);f.useEffect(()=>{if(!n)return;if(!pH(r)){p([]),_();return}const P=++S.current,L=!C.current;C.current=!1;const O=setTimeout(()=>{n(r).then($=>{P===S.current&&(p($.suggestions),w($.sep||"/"),x(-1),(L||T.current)&&b($.suggestions.length>0))},()=>{P===S.current&&(p([]),_())})},N1t);return()=>clearTimeout(O)},[r,n,_]),f.useEffect(()=>{const P=L=>{L.key!=="Escape"||!T.current||L.isComposing||L.keyCode===229||(L.preventDefault(),_())};return window.addEventListener("keydown",P,{capture:!0}),()=>window.removeEventListener("keydown",P,{capture:!0})},[_]);const B=f.useCallback(P=>{var L;C.current=!1,i(P.path+y),a(null),_(),(L=k.current)==null||L.focus()},[y,_]),A=f.useCallback(P=>{const L=g&&m.length>0;if(P.key==="ArrowDown"){if(P.preventDefault(),!L){m.length>0&&b(!0);return}x(O=>(O+1)%m.length);return}if(P.key==="ArrowUp"){if(!L)return;P.preventDefault(),x(O=>(O<=0?m.length:O)-1);return}if(P.key==="Tab"&&L&&!P.shiftKey){const O=v>=0?m[v]:m.length===1?m[0]:void 0;O&&(P.preventDefault(),B(O));return}P.key==="Enter"&&L&&v>=0&&(P.preventDefault(),B(m[v]))},[g,m,v,B]),N=f.useCallback(async P=>{P.preventDefault();const L=r.trim();if(L){if(!pH(L)){a(s("sidebar.addWorkspaceAbsError"));return}a(null),u(!0),_();try{await t(L,d),e()}catch(O){a(O instanceof Error?O.message:s("sidebar.addWorkspaceError"))}finally{u(!1)}}},[r,d,t,e,_,s]),j=g&&m.length>0;return l.jsx(Qr,{title:s("sidebar.addWorkspaceTitle"),size:"md",onClose:e,children:l.jsxs("form",{className:"flex flex-col gap-6",onSubmit:N,children:[l.jsxs(PI,{children:[l.jsxs(Cg,{"data-invalid":o?!0:void 0,children:[l.jsx(Yy,{htmlFor:"add-workspace-path",children:s("sidebar.addWorkspacePath")}),l.jsxs("div",{className:"relative",children:[l.jsx(li,{ref:k,id:"add-workspace-path",type:"text",placeholder:"/absolute/path/to/project",value:r,onChange:P=>{i(P.target.value),o&&a(null)},onKeyDown:A,onBlur:()=>{setTimeout(()=>{C.current=!0,_()},100)},disabled:c,autoCapitalize:"off",autoCorrect:"off",autoComplete:"off",spellCheck:!1,role:"combobox","aria-expanded":j,"aria-controls":j?n2:void 0,"aria-activedescendant":j&&v>=0?`${n2}-${v}`:void 0,"aria-describedby":o?`${mH} ${o8}`:o8,"aria-invalid":o?!0:void 0}),j&&l.jsx("ul",{id:n2,role:"listbox","aria-label":s("sidebar.addWorkspaceSuggestions"),className:"absolute inset-x-0 top-full z-50 mt-1 max-h-56 overflow-y-auto rounded-md border bg-popover py-1 text-popover-foreground shadow-md",children:m.map((P,L)=>l.jsxs("li",{id:`${n2}-${L}`,role:"option","aria-selected":L===v,className:`cursor-pointer truncate px-3 py-1.5 ${L===v?"bg-accent text-accent-foreground":"hover:bg-accent/50"}`,onMouseDown:O=>{O.preventDefault(),B(P)},onMouseEnter:()=>x(L),children:[P.name,l.jsx("span",{className:"text-muted-foreground",children:y})]},P.path))})]}),l.jsx(a9,{id:o8,children:s("sidebar.addWorkspaceHint")}),o&&l.jsx(kgt,{id:mH,children:o})]}),l.jsxs(Cg,{orientation:"horizontal",children:[l.jsxs(Eoe,{children:[l.jsx(Yy,{htmlFor:"add-workspace-persist",children:s("sidebar.addWorkspacePersist")}),l.jsx(a9,{children:s("sidebar.addWorkspacePersistHint")})]}),l.jsx(Aoe,{id:"add-workspace-persist",checked:d,onCheckedChange:h,disabled:c})]})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(qn,{type:"button",variant:"outline",onClick:e,disabled:c,children:s("sidebar.addWorkspaceCancel")}),l.jsx(qn,{type:"submit",disabled:c||!r.trim(),children:s(c?"sidebar.addWorkspaceAdding":"sidebar.addWorkspaceRegister")})]})]})})}const Ioe="qwen-code-web-shell-collapsed-session-groups",Wv="ws:";function gH(e){return!e.startsWith(Wv)}function M1t(e,t){return`${Wv}${e}|group:${t}`}function Roe(e){return`${Wv}${e}|ungrouped`}function I1t(e,t){return t.startsWith(`${Wv}${e}|`)}function OI(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(Ioe);if(!e)return new Set;const t=JSON.parse(e);return Array.isArray(t)?new Set(t.filter(n=>typeof n=="string"&&n.trim().length>0)):new Set}catch{return new Set}}function R1t(e){try{window.localStorage.setItem(Ioe,JSON.stringify(Array.from(e).sort()))}catch{}}function Doe(e,t){const n=OI(),s=new Set(Array.from(n).filter(r=>!t(r)));for(const r of e)s.add(r);R1t(s)}function D1t(e){const t=OI(),n=new Set,s=`${Wv}${e}|group:`,r=Roe(e);for(const i of t)i===r?n.add("ungrouped"):i.startsWith(s)&&n.add(i.slice(s.length));return n}function L1t(e,t){const n=new Set;for(const s of t)n.add(s==="ungrouped"?Roe(e):M1t(e,s));Doe(n,s=>I1t(e,s))}const P1t="_sidebar_m4krq_1",O1t="_resizing_m4krq_20",B1t="_collapsed_m4krq_24",$1t="_newChatButton_m4krq_30",z1t="_pluginButton_m4krq_31",F1t="_footerButton_m4krq_32",q1t="_collapseButton_m4krq_33",H1t="_projectRow_m4krq_34",U1t="_sessionRow_m4krq_35",V1t="_sessionGroupHeader_m4krq_36",W1t="_sessionGroupActionButton_m4krq_37",G1t="_retry_m4krq_38",K1t="_iconButton_m4krq_39",Y1t="_projectIconButton_m4krq_40",X1t="_sessionActionButton_m4krq_41",Q1t="_groupMenuItem_m4krq_42",J1t="_secondaryButton_m4krq_43",Z1t="_dangerButton_m4krq_44",ebt="_primaryNav_m4krq_80",tbt="_navIcon_m4krq_129",nbt="_topRow_m4krq_155",sbt="_brandLogo_m4krq_170",rbt="_brandName_m4krq_186",ibt="_workspacePicker_m4krq_206",obt="_workspacePickerLabel_m4krq_213",abt="_workspacePickerHeader_m4krq_220",lbt="_workspaceAddIconButton_m4krq_227",cbt="_workspaceList_m4krq_247",ubt="_workspaceSessionBody_m4krq_253",dbt="_projectsHeader_m4krq_257",hbt="_pinnedSessionList_m4krq_267",fbt="_projectsHeaderToggle_m4krq_275",mbt="_projectsHeaderAction_m4krq_276",pbt="_projectsHeaderActions_m4krq_284",gbt="_projectSearch_m4krq_335",bbt="_addWorkspaceButton_m4krq_357",ybt="_body_m4krq_377",xbt="_sectionTitle_m4krq_387",vbt="_projectRowExpanded_m4krq_402",wbt="_workspaceHeaderActions_m4krq_428",kbt="_workspaceHeaderAction_m4krq_428",_bt="_projectName_m4krq_471",Sbt="_sessionText_m4krq_472",Cbt="_projectHoverAction_m4krq_487",Tbt="_sessionList_m4krq_496",Ebt="_sessionGroupSection_m4krq_511",Abt="_sessionGroupHeaderRow_m4krq_517",Nbt="_sessionGroupDot_m4krq_553",jbt="_sessionGroupDotMuted_m4krq_560",Mbt="_sessionGroupTitle_m4krq_564",Ibt="_sessionGroupCount_m4krq_571",Rbt="_sessionGroupChevron_m4krq_576",Dbt="_sessionGroupHeaderActions_m4krq_597",Lbt="_sessionGroupList_m4krq_627",Pbt="_currentSession_m4krq_645",Obt="_busySession_m4krq_650",Bbt="_floatingTooltip_m4krq_655",$bt="_tooltipContent_m4krq_685",zbt="_tooltipTitle_m4krq_691",Fbt="_tooltipTags_m4krq_698",qbt="_tooltipTag_m4krq_698",Hbt="_tooltipTagRunning_m4krq_718",Ubt="_tooltipTagNew_m4krq_723",Vbt="_tooltipMeta_m4krq_728",Wbt="_sessionStatusSlot_m4krq_743",Gbt="_sessionStatusDot_m4krq_755",Kbt="_sidebarPulse_m4krq_1",Ybt="_sessionTitlePin_m4krq_765",Xbt="_sessionMetaSlot_m4krq_797",Qbt="_sessionAttention_m4krq_807",Jbt="_sessionAttentionUserInput_m4krq_821",Zbt="_sessionLoading_m4krq_826",eyt="_sessionTime_m4krq_836",tyt="_sidebarSpin_m4krq_1",nyt="_runningSession_m4krq_855",syt="_sessionActions_m4krq_871",ryt="_activeSessionActionButton_m4krq_937",iyt="_searchInput_m4krq_956",oyt="_renameInput_m4krq_970",ayt="_dialogSelect_m4krq_976",lyt="_dialogInput_m4krq_986",cyt="_groupMenu_m4krq_42",uyt="_groupMenuItemActive_m4krq_1028",dyt="_groupMenuName_m4krq_1034",hyt="_groupMenuDot_m4krq_1042",fyt="_groupMenuEmptyDot_m4krq_1043",myt="_groupMenuIcon_m4krq_1044",pyt="_groupMenuCheck_m4krq_1072",gyt="_groupMenuSeparator_m4krq_1079",byt="_groupColorRed_m4krq_1085",yyt="_groupColorOrange_m4krq_1089",xyt="_groupColorYellow_m4krq_1093",vyt="_groupColorGreen_m4krq_1097",wyt="_groupColorBlue_m4krq_1101",kyt="_groupColorPurple_m4krq_1105",_yt="_groupColorCustom_m4krq_1109",Syt="_renameForm_m4krq_1119",Cyt="_notice_m4krq_1135",Tyt="_confirmContent_m4krq_1150",Eyt="_confirmDescription_m4krq_1156",Ayt="_workspaceRemovalActivityList_m4krq_1163",Nyt="_confirmActions_m4krq_1171",jyt="_groupForm_m4krq_1177",Myt="_fieldStack_m4krq_1184",Iyt="_groupCustomColorRow_m4krq_1212",Ryt="_groupColorPicker_m4krq_1219",Dyt="_groupHexField_m4krq_1229",Lyt="_groupColorError_m4krq_1239",Pyt="_footer_m4krq_32",Oyt="_footerPrimary_m4krq_1294",Byt="_footerActions_m4krq_1295",$yt="_footerButtonLabel_m4krq_1311",zyt="_footerCompact_m4krq_1318",Fyt="_footerTight_m4krq_1319",qyt="_version_m4krq_1354",Hyt="_resizeHandle_m4krq_1397",Uyt="_sessionActionButtonActive_m4krq_1425",Vyt="_menuActive_m4krq_1431",Wyt="_actionMenu_m4krq_1435",Gyt="_actionMenuItem_m4krq_1452",Kyt="_actionMenuItemDanger_m4krq_1483",Yyt="_actionMenuIcon_m4krq_1493",Xyt="_actionMenuLabel_m4krq_1512",Qyt="_archivedSection_m4krq_1520",Jyt="_archivedHeader_m4krq_1527",Zyt="_archivedChevron_m4krq_1553",ext="_archivedTitle_m4krq_1572",txt="_archivedCount_m4krq_1581",nxt="_archivedList_m4krq_1596",sxt="_archivedRow_m4krq_1603",rxt="_mobileOpen_m4krq_1612",Ae={sidebar:P1t,resizing:O1t,collapsed:B1t,newChatButton:$1t,pluginButton:z1t,footerButton:F1t,collapseButton:q1t,projectRow:H1t,sessionRow:U1t,sessionGroupHeader:V1t,sessionGroupActionButton:W1t,retry:G1t,iconButton:K1t,projectIconButton:Y1t,sessionActionButton:X1t,groupMenuItem:Q1t,secondaryButton:J1t,dangerButton:Z1t,primaryNav:ebt,navIcon:tbt,topRow:nbt,brandLogo:sbt,brandName:rbt,workspacePicker:ibt,workspacePickerLabel:obt,workspacePickerHeader:abt,workspaceAddIconButton:lbt,workspaceList:cbt,workspaceSessionBody:ubt,projectsHeader:dbt,pinnedSessionList:hbt,projectsHeaderToggle:fbt,projectsHeaderAction:mbt,projectsHeaderActions:pbt,projectSearch:gbt,addWorkspaceButton:bbt,body:ybt,sectionTitle:xbt,projectRowExpanded:vbt,workspaceHeaderActions:wbt,workspaceHeaderAction:kbt,projectName:_bt,sessionText:Sbt,projectHoverAction:Cbt,sessionList:Tbt,sessionGroupSection:Ebt,sessionGroupHeaderRow:Abt,sessionGroupDot:Nbt,sessionGroupDotMuted:jbt,sessionGroupTitle:Mbt,sessionGroupCount:Ibt,sessionGroupChevron:Rbt,sessionGroupHeaderActions:Dbt,sessionGroupList:Lbt,currentSession:Pbt,busySession:Obt,floatingTooltip:Bbt,tooltipContent:$bt,tooltipTitle:zbt,tooltipTags:Fbt,tooltipTag:qbt,tooltipTagRunning:Hbt,tooltipTagNew:Ubt,tooltipMeta:Vbt,sessionStatusSlot:Wbt,sessionStatusDot:Gbt,sidebarPulse:Kbt,sessionTitlePin:Ybt,sessionMetaSlot:Xbt,sessionAttention:Qbt,sessionAttentionUserInput:Jbt,sessionLoading:Zbt,sessionTime:eyt,sidebarSpin:tyt,runningSession:nyt,sessionActions:syt,activeSessionActionButton:ryt,searchInput:iyt,renameInput:oyt,dialogSelect:ayt,dialogInput:lyt,groupMenu:cyt,groupMenuItemActive:uyt,groupMenuName:dyt,groupMenuDot:hyt,groupMenuEmptyDot:fyt,groupMenuIcon:myt,groupMenuCheck:pyt,groupMenuSeparator:gyt,groupColorRed:byt,groupColorOrange:yyt,groupColorYellow:xyt,groupColorGreen:vyt,groupColorBlue:wyt,groupColorPurple:kyt,groupColorCustom:_yt,renameForm:Syt,notice:Cyt,confirmContent:Tyt,confirmDescription:Eyt,workspaceRemovalActivityList:Ayt,confirmActions:Nyt,groupForm:jyt,fieldStack:Myt,groupCustomColorRow:Iyt,groupColorPicker:Ryt,groupHexField:Dyt,groupColorError:Lyt,footer:Pyt,footerPrimary:Oyt,footerActions:Byt,footerButtonLabel:$yt,footerCompact:zyt,footerTight:Fyt,version:qyt,resizeHandle:Hyt,sessionActionButtonActive:Uyt,menuActive:Vyt,actionMenu:Wyt,actionMenuItem:Gyt,actionMenuItemDanger:Kyt,actionMenuIcon:Yyt,actionMenuLabel:Xyt,archivedSection:Qyt,archivedHeader:Jyt,archivedChevron:Zyt,archivedTitle:ext,archivedCount:txt,archivedList:nxt,archivedRow:sxt,mobileOpen:rxt};function d9({label:e,count:t,expanded:n,color:s,children:r,onToggle:i,onRename:o,onDelete:a,renameLabel:c,deleteLabel:u,actionsDisabled:d}){const h=s!=null&&s.startsWith("#")?Ae.groupColorCustom:s?Ae[`groupColor${s[0].toUpperCase()}${s.slice(1)}`]:Ae.sessionGroupDotMuted,m=s!=null&&s.startsWith("#")?{"--session-group-custom-color":s}:void 0;return l.jsxs("section",{className:Ae.sessionGroupSection,"aria-label":e,children:[l.jsxs("div",{className:Ae.sessionGroupHeaderRow,children:[l.jsxs("button",{type:"button",className:Ae.sessionGroupHeader,"aria-expanded":n,onClick:i,children:[l.jsx("span",{className:`${Ae.sessionGroupDot} ${h}`,style:m,"aria-hidden":"true"}),l.jsx("span",{className:Ae.sessionGroupTitle,children:e}),l.jsxs("span",{className:Ae.sessionGroupCount,children:["· ",t]}),l.jsx("span",{className:Ae.sessionGroupChevron,"aria-hidden":"true",children:n?l.jsx(zl,{}):l.jsx(D4,{})})]}),(o||a)&&l.jsxs("div",{className:Ae.sessionGroupHeaderActions,children:[o&&l.jsx("button",{className:Ae.sessionGroupActionButton,type:"button",title:c,"aria-label":c,disabled:d,onClick:o,children:l.jsx(PG,{})}),a&&l.jsx("button",{className:Ae.sessionGroupActionButton,type:"button",title:u,"aria-label":u,disabled:d,onClick:a,children:l.jsx(Iy,{})})]})]}),n&&l.jsx("div",{className:Ae.sessionGroupList,children:r})]})}const ixt="_section_szodv_1",oxt="_headerRow_szodv_6",axt="_header_szodv_6",lxt="_headerDisabled_szodv_34",cxt="_headerContent_szodv_42",uxt="_chevron_szodv_50",dxt="_folderIcon_szodv_55",hxt="_chevronOpen_szodv_59",fxt="_name_szodv_63",mxt="_badge_szodv_71",pxt="_gitPill_szodv_85",gxt="_sessions_szodv_100",bxt="_empty_szodv_107",yxt="_error_szodv_113",xxt="_sessionItemReadOnly_szodv_119",vxt="_sessionName_szodv_130",wxt="_sessionTime_szodv_137",to={section:ixt,headerRow:oxt,header:axt,headerDisabled:lxt,headerContent:cxt,chevron:uxt,folderIcon:dxt,chevronOpen:hxt,name:fxt,badge:mxt,gitPill:pxt,sessions:gxt,empty:bxt,error:yxt,sessionItemReadOnly:xxt,sessionName:vxt,sessionTime:wxt};function bH(...e){return e.filter(Boolean).join(" ")}function kxt(e){return e.split(/[\\/]+/).filter(Boolean).at(-1)??e}function _xt(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-zA-Z]:[\\/]/.test(e)}function Sxt(e){var n;return((n=e.displayName)==null?void 0:n.trim())||e.sessionId.slice(0,8)}function Cxt({open:e}){const t=e?ape:C2;return l.jsx(t,{className:to.folderIcon,size:16,strokeWidth:1.2,"aria-hidden":"true"})}function Txt({workspace:e,renderHeader:t,client:n,reloadToken:s,untrustedLabel:r,readOnlyLabel:i,trustToOpenLabel:o,noSessionsLabel:a,loadErrorLabel:c,organizationEnabled:u,ungroupedLabel:d,formatTime:h,searchQuery:m="",expanded:p,autoExpandKey:g,onExpandedChange:b,renderSessions:v=!0,renderSession:x,headerActions:y,onRenameGroup:w,onDeleteGroup:k,renameGroupLabel:T,deleteGroupLabel:S,groupActionsDisabled:C,excludePinned:_=!1,onOpenGitDiff:B}){const[A,N]=f.useState([]),[j,P]=f.useState([]),[L,O]=f.useState(!1),[$,z]=f.useState(!1),[F,G]=f.useState(()=>D1t(e.id)),[I,Q]=f.useState(!1),[V,M]=f.useState(),re=p??$,se=!e.primary&&!e.trusted,X=e.primary&&!e.trusted;f.useEffect(()=>{p===void 0&&z(!1)},[p,e.id]),f.useEffect(()=>{L1t(e.id,F)},[F,e.id]),f.useEffect(()=>{p===void 0&&g&&z(!0)},[g,p]);const J=f.useCallback(async()=>{if(!X)try{const oe=await n.workspaceByCwd(e.cwd).listWorkspaceSessions({pageSize:cd,archiveState:"active",...u?{view:"organized",group:"all"}:{}});N(oe),O(!1)}catch(oe){console.warn("[WorkspaceSection] session poll failed:",oe),O(!0)}},[n,X,u,e.cwd]);f.useEffect(()=>{if(!v||X||!u){P([]);return}let oe=!1;return n.workspaceByCwd(e.cwd).listSessionGroups().then(Ce=>{oe||P(Ce.groups)}).catch(Ce=>{console.warn("[WorkspaceSection] group catalog load failed:",Ce)}),()=>{oe=!0}},[n,X,u,s,v,e.cwd]),f.useEffect(()=>{if(!v||!re&&!m.trim()||(J(),se))return;const oe=setInterval(()=>void J(),1e4);return()=>clearInterval(oe)},[re,J,se,s,v,m]);const de=_xt(e.cwd)?e.cwd:void 0,W=f.useRef(!1),te=f.useCallback(async()=>{if(!(!B||!e.trusted||!de))try{const oe=await n.workspaceByCwd(de).workspaceGit();W.current=!1,M(oe)}catch(oe){W.current||(console.warn("[WorkspaceSection] git status poll failed:",oe),W.current=!0)}},[n,de,B,e.trusted]);f.useEffect(()=>{if(!B||!e.trusted||!de){M(void 0);return}te();const oe=()=>void te();window.addEventListener("focus",oe);const Ce=window.setInterval(()=>{document.visibilityState==="visible"&&te()},6e4);return()=>{window.removeEventListener("focus",oe),window.clearInterval(Ce)}},[de,te,B,s,e.trusted]);const U=f.useMemo(()=>{const oe=m.trim().toLowerCase();return A.filter(Ce=>_&&Ce.isPinned?!1:oe?(Ce.displayName||"").toLowerCase().includes(oe)||Ce.sessionId.toLowerCase().includes(oe):!0)},[_,m,A]),ee=f.useMemo(()=>{if(!u||j.length===0)return null;const oe=new Set;return{sections:j.map(he=>{const ye=U.filter(Ve=>Ve.groupId===he.id);return ye.forEach(Ve=>oe.add(Ve.sessionId)),{group:he,sessions:ye}}),ungrouped:U.filter(he=>!oe.has(he.sessionId))}},[j,u,U]);return l.jsxs("div",{className:to.section,children:[l.jsxs("div",{className:bH(to.headerRow,X&&to.headerDisabled),onMouseEnter:()=>Q(!0),onMouseLeave:()=>Q(!1),onFocus:()=>Q(!0),onBlur:oe=>{oe.currentTarget.contains(oe.relatedTarget)||Q(!1)},children:[l.jsx("button",{className:to.header,type:"button",disabled:X,"aria-expanded":re,onClick:()=>{const oe=!re;z(oe),b==null||b(oe)},children:t?t(re):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:bH(to.chevron,re&&to.chevronOpen),children:l.jsx(Cxt,{open:re})}),l.jsx("span",{className:to.headerContent,children:l.jsx("span",{className:to.name,children:kxt(e.cwd)})}),!e.trusted&&l.jsx("span",{className:to.badge,children:r}),se&&l.jsx("span",{className:to.badge,children:i})]})}),B&&e.trusted&&(V==null?void 0:V.branch)&&l.jsx("span",{className:to.gitPill,children:l.jsx(pie,{branch:V.branch,status:V,compact:!0,onOpenDiff:()=>B(e.cwd)})}),y==null?void 0:y(I)]}),v&&(re||!!m.trim())&&!X&&l.jsx("div",{className:to.sessions,children:L?l.jsx("div",{className:to.error,role:"status",children:c}):U.length===0?l.jsx("div",{className:to.empty,children:a}):ee?l.jsxs(l.Fragment,{children:[ee.sections.map(({group:oe,sessions:Ce})=>l.jsx(d9,{id:`group:${oe.id}`,label:oe.name,count:Ce.length,color:oe.color,expanded:!F.has(oe.id),onToggle:()=>{G(he=>{const ye=new Set(he);return ye.has(oe.id)?ye.delete(oe.id):ye.add(oe.id),ye})},onRename:w?()=>w(oe,e.cwd):void 0,onDelete:k?()=>k(oe,e.cwd):void 0,renameLabel:T,deleteLabel:S,actionsDisabled:C,children:Ce.map(he=>x(he))},oe.id)),ee.ungrouped.length>0&&l.jsx(d9,{id:"ungrouped",label:d,count:ee.ungrouped.length,expanded:!F.has("ungrouped"),onToggle:()=>{G(oe=>{const Ce=new Set(oe);return Ce.has("ungrouped")?Ce.delete("ungrouped"):Ce.add("ungrouped"),Ce})},children:ee.ungrouped.map(oe=>x(oe))})]}):U.map(oe=>{if(!se)return x(oe);const Ce=Sxt(oe),he=oe.createdAt?h(oe.createdAt):"";return l.jsxs("div",{className:to.sessionItemReadOnly,role:"note","aria-label":`${Ce}${he?`, ${he}`:""}. ${o}`,children:[l.jsx("span",{className:to.sessionName,children:Ce}),he&&l.jsx("span",{className:to.sessionTime,children:he})]},oe.sessionId)})})]})}const Loe="qwen-code-web-shell-sidebar-width",s2=260,Ext=220,Poe=420,Axt=344,Nxt=250,Ooe=200,jxt=56,yH=Ooe-jxt,Mxt=2e3,Ixt=3e4,xH=96,Rxt="recent",a8=240,w0=8,l8="__custom__",k0="#416ef5";function Tm(e,t){return`${t??""}\0${e}`}const Dxt=["settings","version","theme","scheduledTasks","goals","sessionsOverview","splitView","daemonStatus","collapse"],_0=["red","orange","yellow","green","blue","purple"];function rl(...e){return e.filter(Boolean).join(" ")}function vH(e){return e instanceof DOMException&&e.name==="AbortError"}function Lxt(e){return e?e.split(/[\\/]+/).filter(Boolean).at(-1)??e:""}function t_(e){var n;return((n=e.displayName)==null?void 0:n.trim())||e.sessionId.slice(0,8)}function Pxt(e){const t=t_(e).replace(/\s+/g," ").trim();return t.length<=xH?t:`${t.slice(0,xH-3).trimEnd()}...`}function Oxt(e){if(!e.createdAt)return 0;const t=Date.parse(e.createdAt);return Number.isFinite(t)?t:0}function r2(e){return e[0]??"blue"}function h9(e){const t=e.trim();if(/^#[0-9a-f]{6}$/i.test(t))return t.toLowerCase()}function wH(e,t){const n=e.trim();return t.includes(n)?n:h9(n)}function kH(e){if(e.startsWith("#"))return Ae.groupColorCustom;switch(e){case"red":return Ae.groupColorRed;case"orange":return Ae.groupColorOrange;case"yellow":return Ae.groupColorYellow;case"green":return Ae.groupColorGreen;case"blue":return Ae.groupColorBlue;case"purple":return Ae.groupColorPurple}}function Bxt(e){return e.startsWith("#")?{backgroundColor:e}:void 0}function a4(e){return Math.min(Poe,Math.max(Ext,e))}function $xt(e){return Math.min(Poe,Math.max(Ooe,e))}function zxt(){if(typeof window>"u")return s2;try{const e=window.localStorage.getItem(Loe),t=e?Number(e):s2;return Number.isFinite(t)?a4(t):s2}catch{return s2}}function _H(e){try{window.localStorage.setItem(Loe,String(a4(e)))}catch{}}function Fxt(){return l.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{d:"M12 5v14M5 12h14"})})}function qxt(){return l.jsx("svg",{viewBox:"0 0 141.38 140","aria-hidden":"true",children:l.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 SH({expanded:e}){return l.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:e?l.jsx("path",{d:"m6 9 6 6 6-6"}):l.jsx("path",{d:"m9 6 6 6-6 6"})})}function Hxt({collapsed:e,onCollapsedChange:t,onOpenSettings:n,onOpenPlugins:s,onOpenDaemonStatus:r,onOpenScheduledTasks:i,onOpenGoals:o,onOpenSessions:a,canOpenSessionsOverview:c,onOpenSplitView:u,canOpenSplitView:d,onNewSession:h,onLoadSession:m,onSelectCurrentSession:p,onError:g,theme:b,onThemeChange:v,mobileOpen:x,sessionListReloadToken:y,selectedWorkspaceCwd:w,onSelectWorkspace:k,onOpenGitDiff:T,workspaces:S,lockedWorkspaceCwd:C,lockedWorkspace:_,branding:B,footer:A}){var Yp,eb,tb,Hu,im,ih,oh,Xp,om,Qp,Ml,Qi,ah,ew,Jp,tw;const{t:N}=ut(),j=Cl(),P=x1(),L=fo(),O=dc(),$=f.useMemo(()=>new Set(A===!1?[]:(A==null?void 0:A.items)??Dxt),[A]),z=B!==!1&&!(x&&((B==null?void 0:B.hideWhenCompact)??!0)),F=!!((eb=(Yp=j.capabilities)==null?void 0:Yp.features)!=null&&eb.includes(jI)),G=!!((Hu=(tb=j.capabilities)==null?void 0:tb.features)!=null&&Hu.includes("session_archive")),I=!!((ih=(im=j.capabilities)==null?void 0:im.features)!=null&&ih.includes("workspace_qualified_rest_core")),Q=f.useMemo(()=>{var K;return S??((K=O.capabilities)==null?void 0:K.workspaces)??[]},[S,(oh=O.capabilities)==null?void 0:oh.workspaces]),V=((Xp=Q.find(K=>K.primary))==null?void 0:Xp.cwd)??((om=O.capabilities)==null?void 0:om.workspaceCwd)??j.workspaceCwd,M=C?Q.find(K=>K.cwd===C):void 0,re=!C||(M==null?void 0:M.primary)===!0,{sessions:se,loading:X,error:J,data:de,reload:W,deleteSession:te,exportSession:U,archiveSession:ee}=S2({autoLoad:!0,enabled:re,pageSize:cd,archiveState:"active",...F?{view:"organized",group:"all"}:{}}),oe=!F||!re||de!==void 0,{sessions:Ce,reload:he}=S2({autoLoad:F,enabled:F&&re,pageSize:cd,archiveState:"active",view:"organized",group:"pinned"}),[ye,Ve]=f.useState(!1),[it,At]=f.useState(!0),[Ee,me]=f.useState([]),{sessions:bt,loading:et,error:qe,reload:Ke,deleteSession:ke,unarchiveSession:ne}=S2({autoLoad:!0,enabled:G&&ye&&re,pageSize:cd,archiveState:"archived",...F?{view:"organized",group:"all"}:{}}),[gt,We]=f.useState([]),[tt,jt]=f.useState(!1),[jn,kn]=f.useState(!1),[Be,ht]=f.useState(0),[ve,Me]=f.useState([]),[_e,Xe]=f.useState([]),[ue,Fe]=f.useState([]),[kt,bn]=f.useState(!1),[Pe,yn]=f.useState(null),[je,Ne]=f.useState(""),[ot,pt]=f.useState(()=>new Set),dn=f.useRef(new Set),[De,sn]=f.useState(()=>new Set),Dn=f.useRef(new Set),[os,st]=f.useState(!1),St=f.useRef(!1),[Ht,Ot]=f.useState(null),[Yt,Pn]=f.useState(null),[Hn,as]=f.useState(null),[Bs,fr]=f.useState(""),[Gr,rs]=f.useState("blue"),[Vt,Qn]=f.useState(k0),[Rs,pr]=f.useState(null),[hs,xr]=f.useState(()=>new Set(Array.from(OI()).filter(gH))),ci=f.useRef(new Set),_s=f.useRef(!0),[Vs,ls]=f.useState(!F),[Ws,Ss]=f.useState(F);Ws!==F&&(Ss(F),ls(!F));const[Xs,Cr]=f.useState(zxt),[Lr,pe]=f.useState(!1),[Ie,Ge]=f.useState(!0),[Xt,Cn]=f.useState(!1),[Un,xe]=f.useState(!1),[$e,Lt]=f.useState(null),[ln,Pt]=f.useState(null),[An,Xn]=f.useState(!1),Mn=f.useRef(!1),Gn=f.useRef(!1),[Zn,Vn]=f.useState(!1),[hn,Le]=f.useState(0),[Nt,Tn]=f.useState(null),_n=f.useCallback(()=>{Le(K=>K+1)},[]);f.useEffect(()=>(Mn.current=!0,()=>{Mn.current=!1,Gn.current=!0}),[]);const[cs,gr]=f.useState(""),[le,Se]=f.useState(!1),[He,Qe]=f.useState(()=>new Set),xn=f.useRef(null),Bt=f.useRef(!1),$n=f.useRef(null),Qs=f.useRef(null),vs=f.useRef(!1),is=f.useRef(null),Js=j.sessionId,vr=!!((Ml=(Qp=j.capabilities)==null?void 0:Qp.features)!=null&&Ml.includes("workspace_runtime_removal")),ni=((ah=(Qi=j.capabilities)==null?void 0:Qi.features)==null?void 0:ah.includes("session_export"))??!1,Tr=((Jp=(ew=j.capabilities)==null?void 0:ew.features)==null?void 0:Jp.includes("workspace_archived_session_export"))??!1,mo=Js?Tm(Js,j.workspaceCwd):null,Nl=Lxt(j.workspaceCwd)||N("sidebar.projectFallback"),Pr=f.useMemo(()=>{const K=Q.length>0?Q:[{id:"primary",cwd:j.workspaceCwd||Nl,primary:!0,trusted:!0}];return C?K.filter(we=>we.cwd===C):K},[j.workspaceCwd,C,Nl,Q]),rt=f.useMemo(()=>{const K=new Map;for(const we of[...re?Ce:[],...Ee])K.set(Tm(we.sessionId,we.workspaceCwd||V),we);return[...K.values()]},[re,V,Ce,Ee]),Dt=f.useCallback(K=>{const we=Pr.find(Te=>Te.cwd===K.workspaceCwd);return!we||we.primary?L:O.client.workspaceByCwd(we.cwd)},[Pr,O.client,L]),pn=f.useCallback(K=>{var we;return!K||((we=Pr.find(Te=>Te.cwd===K))==null?void 0:we.primary)!==!1},[Pr]),Ut=f.useCallback(K=>Tm(K.sessionId,K.workspaceCwd||V),[V]),rn=f.useCallback(K=>mo===Ut(K),[mo,Ut]),zn=f.useCallback(K=>{const we=Pr.find(Te=>Te.cwd===K.workspaceCwd);return(we==null?void 0:we.trusted)===!1?!1:G&&((we==null?void 0:we.primary)!==!1||I)},[Pr,G,I]),fs=f.useCallback(K=>{const we=K.workspaceCwd||V,Te=Pr.find(Ue=>Ue.cwd===we);return Tr&&(Te==null?void 0:Te.trusted)===!0?Te.cwd:void 0},[Tr,Pr,V]);f.useEffect(()=>{if(!F){me([]);return}const K=Pr.filter(Te=>!Te.primary&&Te.trusted);let we=!1;return Promise.allSettled(K.map(async Te=>(await O.client.workspaceByCwd(Te.cwd).listWorkspaceSessions({pageSize:cd,archiveState:"active",view:"organized",group:"pinned"})).map(vt=>({...vt,workspaceCwd:Te.cwd})))).then(Te=>{we||me(Te.flatMap(Ue=>Ue.status==="fulfilled"?Ue.value:[]))}),()=>{we=!0}},[Pr,F,O.client,hn]);const tr=f.useMemo(()=>{const K=new Map;for(const we of[...re?bt:[],...gt])K.set(Ut(we),we);return[...K.values()]},[bt,Ut,re,gt]),Ci=re&&et||tt,mr=re&&!!qe||jn;f.useEffect(()=>{if(!ye)return;if(!G||!I){We([]),jt(!1),kn(!1);return}const K=Pr.filter(Te=>!Te.primary&&Te.trusted);if(K.length===0){We([]),jt(!1),kn(!1);return}let we=!1;return jt(!0),Promise.allSettled(K.map(async Te=>(await O.client.workspaceByCwd(Te.cwd).listWorkspaceSessions({pageSize:cd,archiveState:"archived",...F?{view:"organized",group:"all"}:{}})).map(vt=>({...vt,workspaceCwd:Te.cwd})))).then(Te=>{if(we)return;const Ue=Te.filter(vt=>vt.status==="rejected");We(Te.flatMap(vt=>vt.status==="fulfilled"?vt.value:[])),kn(Ue.length>0);for(const vt of Ue)console.warn("[WebShellSidebar] archived session load failed:",vt.reason)}).finally(()=>{we||jt(!1)}),()=>{we=!0}},[ye,Pr,F,Be,G,O.client,I,hn]);const po=((tw=j.capabilities)==null?void 0:tw.qwenCodeVersion)||"",go=po?/^\d/.test(po)?`v${po}`:po:"",xa=!e&&Xs<Axt,Ka=!e&&Xs<Nxt,Ya={"--web-shell-sidebar-width":`${Xs}px`},xt=os;f.useEffect(()=>{var Te;if(!Js)return;const K=Pr.find(Ue=>Ue.cwd===j.workspaceCwd)??(Pr.length===1&&((Te=Pr[0])!=null&&Te.primary)?Pr[0]:void 0);if(!K)return;const we=`session:${Js}:${K.id}`;Qs.current!==we&&(Qs.current=we,Ge(!0),K.primary?pe(!0):Tn({id:K.id,key:we}))},[j.workspaceCwd,Js,Pr]),f.useEffect(()=>{if(Js||w!==void 0||!O.capabilities)return;const K=Q.find(Te=>Te.cwd===j.workspaceCwd),we=`new:${(K==null?void 0:K.id)??"primary"}`;if(Qs.current!==we){if(Qs.current=we,Ge(!0),K&&!K.primary){pe(!1),Tn({id:K.id,key:we}),k==null||k(K.cwd);return}pe(!0)}},[j.workspaceCwd,Js,k,w,O.capabilities,Q]);const En=f.useCallback((K,we,Te)=>{const Ue=Tm(K,Te||V),vt=new Set(dn.current);we?vt.add(Ue):vt.delete(Ue),dn.current=vt,pt(vt)},[V]),si=f.useCallback(async()=>{if(!F){Me([]),Fe([]),ls(!0);return}try{const K=await L.listSessionGroups();Me(K.groups),Xe(K.groups),Fe(K.colorOptions),ls(!0)}catch(K){g(K,N("sidebar.groupsLoadFailed"))}},[g,F,N,L]);f.useEffect(()=>{if(!F){Me([]),Fe([]),ls(!0);return}ls(!1),si()},[F,si]),f.useEffect(()=>{if(!Yt)return;const K=Te=>{var Ue;(Ue=xn.current)!=null&&Ue.contains(Te.target)||Pn(null)},we=Te=>{Te.key==="Escape"&&Pn(null)};return document.addEventListener("mousedown",K),document.addEventListener("keydown",we),()=>{document.removeEventListener("mousedown",K),document.removeEventListener("keydown",we)}},[Yt]),f.useEffect(()=>{if(!Yt)return;const K=window.requestAnimationFrame(()=>{var Ue;const we=Array.from(((Ue=xn.current)==null?void 0:Ue.querySelectorAll("button:not(:disabled)"))??[]),Te=we.find(vt=>vt.getAttribute("aria-checked")==="true")??we[0];Te==null||Te.focus()});return()=>window.cancelAnimationFrame(K)},[Yt]);const ar=f.useCallback(K=>{var In,On;const we=Array.from(((In=xn.current)==null?void 0:In.querySelectorAll("button:not(:disabled)"))??[]);if(we.length===0)return;const Te=we.indexOf(document.activeElement),Ue=Te>=0?Te:-1;let vt;if(K.key==="ArrowDown")vt=(Ue+1)%we.length;else if(K.key==="ArrowUp")vt=(Ue-1+we.length)%we.length;else if(K.key==="Home")vt=0;else if(K.key==="End")vt=we.length-1;else if(K.key==="Escape"){K.preventDefault(),Pn(null);return}vt!==void 0&&(K.preventDefault(),(On=we[vt])==null||On.focus())},[]);f.useEffect(()=>()=>{var K;(K=is.current)==null||K.call(is,!1)},[]),f.useEffect(()=>{e&&(pe(!1),Cn(!1),gr(""))},[e]);const nr=f.useMemo(()=>se.some(K=>K.hasActivePrompt),[se]);f.useEffect(()=>{if(!Lr&&!nr)return;const K=nr&&!J?Mxt:Ixt,we=window.setInterval(()=>{document.hidden||vs.current||(vs.current=!0,W().finally(()=>{vs.current=!1}))},K);return()=>window.clearInterval(we)},[J,nr,Lr,W]);const Ti=f.useRef(y);f.useEffect(()=>{y!==void 0&&y!==Ti.current&&!document.hidden&&!vs.current&&(Ti.current=y,vs.current=!0,W().finally(()=>{vs.current=!1}))},[y,W]),f.useEffect(()=>{const K=new Map(se.map(Te=>[Ut(Te),!!Te.hasActivePrompt])),we=$n.current;$n.current=K,we!==null&&Qe(Te=>{const Ue=new Set(Te);let vt=!1;for(const[In,On]of we){const Jn=K.get(In);On&&Jn===!1&&In!==mo&&!Ue.has(In)&&(Ue.add(In),vt=!0)}for(const In of Ue)(In===mo||!K.has(In)||K.get(In))&&(Ue.delete(In),vt=!0);return vt?Ue:Te})},[mo,Ut,se]);const Qo=f.useCallback(async(K,we)=>{var Ue;const Te=await L.addWorkspace(K,{persist:we});if(we&&Te.persisted!==!0)throw new Error(N("sidebar.addWorkspacePersistenceError"));try{await((Ue=O.refreshCapabilities)==null?void 0:Ue.call(O))}catch{}},[N,L,O]),Ds=f.useCallback(K=>L.suggestWorkspacePaths(K),[L]),ui=f.useCallback(async K=>{var we;if(Mn.current){w===K.cwd&&(k==null||k(void 0)),Le(Te=>Te+1);try{await((we=O.refreshCapabilities)==null?void 0:we.call(O))}catch{}Mn.current&&(Lt(null),Pt(null),Vn(!1),W().catch(()=>{}),Ke().catch(()=>{}))}},[k,W,Ke,w,O]),va=f.useCallback(K=>{An||(Gn.current=!1,Pt(null),Vn(!1),Lt(K))},[An]),As=f.useCallback(async()=>{const K=$e;if(!K||An)return;const we=ln!==null;if(!(we&&j.sessionId&&j.workspaceCwd===K.cwd)){Xn(!0);try{await L.removeWorkspace(K.id,{force:we}),await ui(K)}catch(Te){if(!Mn.current)return;if(Te instanceof ac){const Ue=Te.body;if(Te.status===409&&(Ue==null?void 0:Ue.code)==="workspace_busy"&&Ue.activity){Pt(Ue.activity);return}if(Te.status===400&&(Ue==null?void 0:Ue.code)==="workspace_mismatch"){await ui(K);return}if(Te.status===409&&((Ue==null?void 0:Ue.code)==="workspace_removal_in_progress"||(Ue==null?void 0:Ue.code)==="workspace_registration_in_progress")){Vn(!0);let vt=Te,In=!0;for(let On=0;On<20;On++){if(!Mn.current||Gn.current||(await new Promise(Jn=>window.setTimeout(Jn,250)),!Mn.current||Gn.current))return;try{await L.removeWorkspace(K.id,{force:we}),await ui(K);return}catch(Jn){if(!Mn.current)return;if(vt=Jn,Jn instanceof ac){const Zs=Jn.body;if(Jn.status===400&&(Zs==null?void 0:Zs.code)==="workspace_mismatch"){await ui(K);return}if(Jn.status===409&&(Zs==null?void 0:Zs.code)==="workspace_busy"&&Zs.activity){Vn(!1),Pt(Zs.activity);return}if(Jn.status===409&&((Zs==null?void 0:Zs.code)==="workspace_removal_in_progress"||(Zs==null?void 0:Zs.code)==="workspace_registration_in_progress"))continue}In=!1;break}}if(!Mn.current||Gn.current)return;Vn(!1),g(In?new Error("Workspace removal remained in progress after retries."):vt,N("sidebar.removeWorkspaceError"));return}}g(Te,N("sidebar.removeWorkspaceError"))}finally{Mn.current&&Xn(!1)}}},[j.sessionId,j.workspaceCwd,g,ui,N,L,ln,$e,An]),Ls=f.useCallback(K=>{St.current||(St.current=!0,st(!0),(async()=>{try{await h(K)&&(W().catch(()=>{}),_n())}catch(we){vH(we)||g(we,N("sidebar.newSessionFailed"))}finally{St.current=!1,st(!1)}})())},[_n,g,h,W,N]),fc=f.useCallback((K,we)=>{const Te=Tm(K,we||V);if(Te===mo){p==null||p();return}dn.current.has(Te)||(Qe(Ue=>{if(!Ue.has(Te))return Ue;const vt=new Set(Ue);return vt.delete(Te),vt}),En(K,!0,we),(async()=>{try{await m(K,we)}catch(Ue){vH(Ue)||g(Ue,N("sidebar.switchFailed"))}finally{En(K,!1,we)}})())},[mo,g,m,p,V,En,N]),Dc=f.useCallback(K=>{yn(K.sessionId),Ne(t_(K))},[]),Xa=f.useCallback(()=>{yn(null),Ne("")},[]),mc=f.useCallback(()=>{const K=je.trim();if(!K||Pe!==Js){Xa();return}const we=Pe;dn.current.has(Tm(we,j.workspaceCwd))||(En(we,!0,j.workspaceCwd),P.renameSession(K).then(()=>{Xa(),W(),_n()}).catch(Te=>{g(Te,N("sidebar.renameFailed")),Xa()}).finally(()=>{En(we,!1,j.workspaceCwd)}))},[P,_n,Xa,j.workspaceCwd,Js,je,Pe,g,W,En,N]),Lc=f.useCallback(K=>{rn(K)||Ot(K)},[rn]),rh=f.useCallback((K,we,Te)=>{const Ue=Tm(K,Te||V),vt=new Set(Dn.current);we?vt.add(Ue):vt.delete(Ue),Dn.current=vt,sn(vt)},[V]),Pc=f.useCallback(K=>{const we=K.sessionId,Te=Ut(K),Ue=K.isArchived===!0;(Ue?!fs(K):!ni)||Dn.current.has(Te)||(rh(we,!0,K.workspaceCwd),(async()=>{try{let vt;if(Ue){const Jn=fs(K);if(!Jn)return;vt=await O.client.workspaceByCwd(Jn).exportArchivedSession(we,{format:"html"})}else vt=await U(we,"html");const In=new Blob([vt.content],{type:vt.mimeType||"text/html"}),On=URL.createObjectURL(In);try{const Jn=document.createElement("a");Jn.href=On,Jn.download=vt.filename,document.body.appendChild(Jn),Jn.click(),Jn.remove()}finally{URL.revokeObjectURL(On)}}catch(vt){g(vt,N("sidebar.exportFailed"))}finally{rh(we,!1,K.workspaceCwd)}})())},[ni,U,fs,Ut,g,rh,N,O.client]),Qa=f.useCallback(()=>{if(!Ht)return;const K=Ht.sessionId,we=Ut(Ht);if(rn(Ht)){Ot(null);return}const Te=!!Ht.isArchived;if(Ot(null),dn.current.has(we))return;En(K,!0,Ht.workspaceCwd),(pn(Ht.workspaceCwd)?Te?ke:te:vt=>O.client.workspaceByCwd(Ht.workspaceCwd).deleteSessionsData([vt]))(K).then(()=>{W(),Ke(),_n()}).catch(vt=>g(vt,N("sidebar.deleteFailed"))).finally(()=>{En(K,!1,Ht.workspaceCwd)})},[_n,ke,Ht,te,Ut,rn,pn,g,W,Ke,En,N,O.client]),Up=f.useCallback(K=>{rn(K)&&Dc(K)},[rn,Dc]),V1=f.useCallback(()=>{Pn(null),fr(""),rs(r2(ue)),Qn(k0),as({mode:"create"})},[ue]),W1=f.useCallback(K=>{(async()=>{try{const we=await O.client.workspaceByCwd(K).listSessionGroups();Pn(null),fr(""),rs(r2(we.colorOptions)),Qn(k0),as({mode:"create",workspaceCwd:K})}catch(we){g(we,N("sidebar.groupsLoadFailed"))}})()},[g,N,O.client]),Fu=f.useCallback(K=>{Pn(null),fr(""),rs(r2(ue)),Qn(k0),as({mode:"create",targetSession:K,workspaceCwd:K.workspaceCwd})},[ue]),Vp=f.useCallback((K,we)=>{fr(K.name),rs(K.color),Qn(h9(K.color)??k0),as({mode:"edit",group:K,workspaceCwd:we})},[]),G1=f.useCallback(()=>{kt||(as(null),fr(""),rs(r2(ue)),Qn(k0))},[ue,kt]),K1=f.useCallback(()=>{if(!Hn)return;const K=Bs.trim(),we=wH(Gr,ue.length>0?ue:_0);!K||!we||(async()=>{bn(!0);try{const Te=pn(Hn.workspaceCwd)?L:O.client.workspaceByCwd(Hn.workspaceCwd),Ue=Hn.mode==="create"?await Te.createSessionGroup({name:K,color:we}):await Te.updateSessionGroup(Hn.group.id,{name:K,color:we});if(Hn.mode==="create"&&Hn.targetSession)try{await Te.updateSessionOrganization(Hn.targetSession.sessionId,{groupId:Ue.id,color:null}),Hn.workspaceCwd||W().catch(()=>{}),_n()}catch(vt){as(null),fr(""),Hn.workspaceCwd||si().catch(()=>{}),g(vt,N("sidebar.groupAssignFailedAfterCreate"));return}as(null),fr(""),Hn.workspaceCwd?_n():si().catch(()=>{})}catch(Te){g(Te,Hn.mode==="create"?N("sidebar.groupCreateFailed"):N("sidebar.groupUpdateFailed"))}finally{bn(!1)}})()},[_n,ue,Gr,Hn,Bs,pn,g,W,si,N,L,O.client]),Fr=f.useCallback((K,we)=>{pr({group:K,workspaceCwd:we})},[]),Gv=f.useCallback(()=>{if(!Rs)return;bn(!0),(pn(Rs.workspaceCwd)?L:O.client.workspaceByCwd(Rs.workspaceCwd)).deleteSessionGroup(Rs.group.id).then(()=>{pr(null),Rs.workspaceCwd?_n():W().catch(()=>{})}).catch(we=>g(we,N("sidebar.groupDeleteFailed"))).then(()=>Rs.workspaceCwd?void 0:si().catch(()=>{})).finally(()=>bn(!1))},[Rs,pn,g,W,si,N,_n,O.client,L]),Kv=f.useCallback(K=>{const we=K.sessionId,Te=Ut(K);if(!F||dn.current.has(Te))return;En(we,!0,K.workspaceCwd),Dt(K).updateSessionOrganization(we,{isPinned:!K.isPinned}).then(()=>{W().catch(()=>{}),he().catch(()=>{}),_n()}).catch(vt=>g(vt,N("sidebar.organizationFailed"))).finally(()=>{En(we,!1,K.workspaceCwd)})},[_n,Ut,Dt,g,F,W,he,En,N]),Y1=f.useCallback(K=>{const we=K.sessionId,Te=Ut(K);!zn(K)||rn(K)||dn.current.has(Te)||(En(we,!0,K.workspaceCwd),(async()=>{try{if(pn(K.workspaceCwd))await ee(we);else{const vt=(await O.client.workspaceByCwd(K.workspaceCwd).archiveSessionsData([we])).errors.find(In=>In.sessionId===we);vt&&g(new Error(vt.error),N("sidebar.archiveFailed"))}}catch(Ue){g(Ue,N("sidebar.archiveFailed"))}finally{W().catch(()=>{}),Ke().catch(()=>{}),_n(),En(we,!1,K.workspaceCwd)}})())},[ee,_n,zn,Ut,pn,rn,g,W,Ke,En,N,O.client]),X1=f.useCallback(K=>{const we=K.sessionId,Te=Ut(K);zn(K)&&(dn.current.has(Te)||(En(we,!0,K.workspaceCwd),(async()=>{try{if(pn(K.workspaceCwd))await ne(we);else{const vt=(await O.client.workspaceByCwd(K.workspaceCwd).unarchiveSessionsData([we])).errors.find(In=>In.sessionId===we);vt&&g(new Error(vt.error),N("sidebar.unarchiveFailed"))}}catch(Ue){g(Ue,N("sidebar.unarchiveFailed"))}finally{W().catch(()=>{}),Ke().catch(()=>{}),_n(),En(we,!1,K.workspaceCwd)}})()))},[_n,zn,Ut,pn,g,W,Ke,En,N,ne,O.client]),Q1=f.useCallback(async(K,we)=>{let Te=0;try{const ka=await Dt(we).listSessionGroups();Xe(ka.groups),Fe(ka.colorOptions),Te=ka.groups.length}catch(ka){g(ka,N("sidebar.groupsLoadFailed"));return}if(!K.isConnected)return;const Ue=K.getBoundingClientRect(),vt=typeof window>"u"?Ue.right+a8:window.innerWidth,In=typeof window>"u"?Ue.top+320:window.innerHeight,On=Math.min(320,34*(Te+_0.length+2)+25),Jn=Ue.right+w0+a8<=vt?Ue.right+w0:Math.max(w0,Ue.left-a8-w0),Zs=Math.max(w0,Math.min(Ue.top,In-On-w0));Pn({session:we,top:Zs,left:Jn})},[Dt,g,N]),jl=f.useCallback((K,we)=>{const Te=K.sessionId,Ue=Ut(K);if(!F||dn.current.has(Ue))return;Pn(null),En(Te,!0,K.workspaceCwd),Dt(K).updateSessionOrganization(Te,{groupId:we,color:null}).then(()=>{W().catch(()=>{}),_n()}).catch(In=>g(In,N("sidebar.organizationFailed"))).finally(()=>{En(Te,!1,K.workspaceCwd)})},[_n,Ut,Dt,g,F,W,En,N]),fC=f.useCallback((K,we)=>{const Te=K.sessionId,Ue=Ut(K);if(!F||dn.current.has(Ue))return;Pn(null),En(Te,!0,K.workspaceCwd),Dt(K).updateSessionOrganization(Te,{color:we,groupId:null}).then(()=>{W().catch(()=>{}),_n()}).catch(In=>g(In,N("sidebar.organizationFailed"))).finally(()=>{En(Te,!1,K.workspaceCwd)})},[_n,Ut,Dt,g,F,W,En,N]),pc=f.useMemo(()=>{const K=cs.trim().toLowerCase(),we=se.filter(vt=>!vt.isPinned),Te=K?we.filter(vt=>t_(vt).toLowerCase().includes(K)||vt.sessionId.toLowerCase().includes(K)):we.slice();if(F)return Te;const Ue=new Map(Te.map(vt=>[vt.sessionId,Oxt(vt)]));return Te.sort((vt,In)=>(Ue.get(In.sessionId)??0)-(Ue.get(vt.sessionId)??0))},[F,cs,se]),Ja=f.useMemo(()=>{if(!F)return[];const K=cs.trim().length>0,we=new Set(ve.map(On=>On.id)),Te=new Map,Ue=new Map;for(const On of ve)Ue.set(On.id,[]);const vt=[];for(const On of pc){if(On.color&&_0.includes(On.color)){const Zs=Te.get(On.color)??[];Zs.push(On),Te.set(On.color,Zs);continue}const Jn=On.groupId&&we.has(On.groupId)?Ue.get(On.groupId):void 0;Jn?Jn.push(On):vt.push(On)}const In=[];for(const On of _0){const Jn=Te.get(On);!Jn||Jn.length===0||In.push({id:`color:${On}`,kind:"color",label:N(`sidebar.groupColor.${On}`),countLabel:String(Jn.length),color:On,sessions:Jn})}for(const On of ve){const Jn=Ue.get(On.id)??[];K&&Jn.length===0||In.push({id:`group:${On.id}`,kind:"group",label:On.name,countLabel:String(Jn.length),color:On.color,group:On,sessions:Jn})}return vt.length>0&&In.length>0&&In.push({id:Rxt,kind:"recent",label:N("sidebar.groupUngrouped"),countLabel:String(vt.length),sessions:vt}),In},[pc,ve,F,cs,N]);f.useEffect(()=>{if(!F||!Vs||!oe)return;const K=Ja.map(Te=>Te.id).filter(Te=>!ci.current.has(Te));if(_s.current){_s.current=!1;for(const Te of K)ci.current.add(Te);return}if(K.length!==0){for(const Te of K)ci.current.add(Te);xr(Te=>{const Ue=new Set(Te);for(const vt of K)Ue.add(vt);return Ue})}},[Vs,F,Ja,oe]),f.useEffect(()=>{Doe(hs,gH)},[hs]);const Yv=f.useCallback(K=>{xr(we=>{const Te=new Set(we);return Te.has(K)?Te.delete(K):Te.add(K),Te})},[]),Xv=f.useCallback(K=>{var gc;if(e)return;K.preventDefault(),(gc=is.current)==null||gc.call(is,!0),Se(!0);const we=K.clientX,Te=Xs,Ue=document.body.style.cursor,vt=document.body.style.userSelect;let In=!1,On=()=>{};document.body.style.cursor="col-resize",document.body.style.userSelect="none";try{K.currentTarget.setPointerCapture(K.pointerId)}catch{}function Jn(Jo){return Te+Jo-we}function Zs(){const Jo=a4(Te);Cr(Jo),_H(Jo)}function ka(){In||(In=!0,Zs(),On(!0),t(!0))}function am(Jo){const Ro=Jn(Jo.clientX);if(Ro<=yH){ka();return}Cr($xt(Ro))}On=function(Ro){document.body.style.cursor=Ue,document.body.style.userSelect=vt,window.removeEventListener("pointermove",am),window.removeEventListener("pointerup",lh),window.removeEventListener("pointercancel",di),is.current=null,Ro&&Se(!1)};function lh(Jo){const Ro=Jn(Jo.clientX);if(Ro<=yH){ka();return}const Gs=a4(Ro);Cr(Gs),_H(Gs),On(!0)}function di(){On(!0)}is.current=On,window.addEventListener("pointermove",am),window.addEventListener("pointerup",lh,{once:!0}),window.addEventListener("pointercancel",di,{once:!0})},[e,t,Xs]),J1=Ht?Pxt(Ht):"",Wp=Yt!=null&&Yt.session.color&&_0.includes(Yt.session.color)?Yt.session.color:null,Qv=!Wp&&(Yt!=null&&Yt.session.groupId)&&_e.some(K=>K.id===Yt.session.groupId)?Yt.session.groupId:null,mC=ue.length>0?ue:_0,Z1=Qv===null&&Wp===null,Jv=(Rs==null?void 0:Rs.group.name)??"",Gp=ue.length>0?ue:["blue"],Oc=wH(Gr,Gp),Zv=!Gp.includes(Gr),pC=Bs.trim().length>0&&Oc!==void 0&&!kt,Kp=(Hn==null?void 0:Hn.mode)==="create"?N("sidebar.groupCreate"):N("sidebar.groupRename"),wa=f.useCallback((K,we={})=>{const{isArchived:Te=!1,readOnly:Ue=!1}=we,vt=Ut(K),In=t_(K),On=K.updatedAt||K.createdAt,Jn=On?s4(On,N):"",Zs=ot.has(vt),ka=De.has(vt),am=!rn(K)&&He.has(vt),lh=l.jsxs("div",{className:Ae.tooltipContent,children:[l.jsx("div",{className:Ae.tooltipTitle,children:In}),l.jsxs("div",{className:Ae.tooltipTags,children:[K.hasActivePrompt&&l.jsx("span",{className:rl(Ae.tooltipTag,Ae.tooltipTagRunning),children:N("sidebar.running")}),am&&l.jsx("span",{className:rl(Ae.tooltipTag,Ae.tooltipTagNew),children:N("sidebar.completedUnread")}),l.jsx("span",{className:Ae.tooltipTag,children:N("sidebar.clients",{count:K.clientCount??0})})]}),l.jsx("div",{className:Ae.tooltipMeta,children:K.sessionId})]});if(Te)return l.jsxs("div",{className:rl(Ae.sessionRow,Ae.archivedRow,Zs&&Ae.busySession),children:[l.jsx("span",{className:Ae.sessionText,children:In}),l.jsxs("div",{className:Ae.sessionMetaSlot,children:[l.jsx("span",{className:Ae.sessionTime,children:Jn}),l.jsx("div",{className:Ae.sessionActions,onClick:Gs=>Gs.stopPropagation(),onKeyDown:Gs=>Gs.stopPropagation(),children:l.jsxs(kg,{children:[l.jsx(_g,{asChild:!0,children:l.jsx("button",{className:Ae.sessionActionButton,type:"button","aria-label":N("sidebar.moreActions"),title:N("sidebar.moreActions"),children:l.jsx(cg,{})})}),l.jsx(Sg,{align:"end",className:"w-auto min-w-40",onPointerDownOutside:()=>{Bt.current=!0},onCloseAutoFocus:Gs=>{Bt.current&&(Bt.current=!1,Gs.preventDefault())},children:l.jsxs(c1,{children:[l.jsxs(Sq,{children:[l.jsxs(Cq,{children:[l.jsx(dx,{}),N("sidebar.details")]}),l.jsx(Tq,{className:"min-w-64 p-3",children:lh})]}),fs(K)&&l.jsxs($o,{disabled:ka,onSelect:()=>Pc(K),children:[l.jsx(hP,{}),N("sidebar.export")]}),zn(K)&&l.jsxs($o,{onSelect:()=>X1(K),children:[l.jsx(Ame,{}),N("sidebar.unarchive")]}),l.jsxs($o,{variant:"destructive",onSelect:()=>Lc(K),children:[l.jsx(Iy,{}),N("sidebar.delete")]})]})})]})})]})]},vt);const di=rn(K),gc=di&&Pe===K.sessionId,Jo=!K.isWaitingForPermission&&K.isWaitingForUserQuestion,Ro=K.isWaitingForPermission?N("sidebar.waitingForApproval"):Jo?N("sidebar.userInputNeeded"):null;return l.jsx("div",{className:rl(Ae.sessionRow,di&&Ae.currentSession,K.isPinned&&Ae.pinnedSession,K.hasActivePrompt&&Ae.runningSession,Zs&&Ae.busySession),role:"button",tabIndex:0,"aria-current":di?"page":void 0,onClick:()=>fc(K.sessionId,K.workspaceCwd),onDoubleClick:()=>{!Ue&&di&&!e&&Dc(K)},onKeyDown:Gs=>{Gs.key==="Enter"&&fc(K.sessionId,K.workspaceCwd)},children:!e&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Ae.sessionStatusSlot,children:am?l.jsx("span",{className:Ae.sessionStatusDot,"aria-hidden":"true"}):null}),gc&&!Ue?l.jsx("form",{className:Ae.renameForm,onClick:Gs=>Gs.stopPropagation(),onSubmit:Gs=>{Gs.preventDefault(),mc()},children:l.jsx("input",{autoFocus:!0,className:Ae.renameInput,value:je,onChange:Gs=>Ne(Gs.target.value),onBlur:Xa,onKeyDown:Gs=>{Gs.key==="Escape"&&(Gs.preventDefault(),Xa())}})}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Ae.sessionText,children:In}),l.jsxs("div",{className:Ae.sessionMetaSlot,children:[Ro&&l.jsx("span",{className:rl(Ae.sessionAttention,Jo&&Ae.sessionAttentionUserInput),"aria-label":Ro,children:Ro}),K.hasActivePrompt?l.jsx("span",{className:Ae.sessionLoading,"aria-label":N("sidebar.running")}):Ro?null:l.jsx("span",{className:Ae.sessionTime,children:Jn}),Ue&&zn(K)&&l.jsx("div",{className:Ae.sessionActions,onClick:Gs=>Gs.stopPropagation(),onKeyDown:Gs=>Gs.stopPropagation(),children:l.jsx("button",{className:Ae.sessionActionButton,type:"button",disabled:Zs||di,"aria-label":N("sidebar.archive"),title:N(di?"sidebar.archiveCurrentDisabled":"sidebar.archive"),onClick:()=>Y1(K),children:l.jsx(dP,{})})}),!Ue&&l.jsxs("div",{className:Ae.sessionActions,onClick:Gs=>Gs.stopPropagation(),onKeyDown:Gs=>Gs.stopPropagation(),children:[F&&l.jsx("button",{className:rl(Ae.sessionActionButton,K.isPinned&&Ae.activeSessionActionButton),type:"button",disabled:Zs,"aria-label":K.isPinned?N("sidebar.unpin"):N("sidebar.pin"),title:K.isPinned?N("sidebar.unpin"):N("sidebar.pin"),onClick:()=>Kv(K),children:l.jsx(jpe,{})}),zn(K)&&l.jsx("button",{className:Ae.sessionActionButton,type:"button",disabled:Zs||di,"aria-label":N("sidebar.archive"),title:N(di?"sidebar.archiveCurrentDisabled":"sidebar.archive"),onClick:()=>Y1(K),children:l.jsx(dP,{})}),l.jsxs(kg,{children:[l.jsx(_g,{asChild:!0,children:l.jsx("button",{className:Ae.sessionActionButton,type:"button","aria-label":N("sidebar.moreActions"),title:N("sidebar.moreActions"),children:l.jsx(cg,{})})}),l.jsx(Sg,{align:"end",className:"w-auto min-w-40",onPointerDownOutside:()=>{Bt.current=!0},onCloseAutoFocus:Gs=>{Bt.current&&(Bt.current=!1,Gs.preventDefault())},children:l.jsxs(c1,{children:[l.jsxs(Sq,{children:[l.jsxs(Cq,{children:[l.jsx(dx,{}),N("sidebar.details")]}),l.jsx(Tq,{className:"min-w-64 p-3",children:lh})]}),l.jsxs($o,{disabled:!di,title:di?void 0:N("sidebar.renameCurrentOnly"),onSelect:()=>Up(K),children:[l.jsx(PG,{}),N("sidebar.rename")]}),F&&l.jsxs($o,{disabled:Zs,onSelect:Gs=>Q1(Gs.currentTarget,K),children:[l.jsx(ipe,{}),N("sidebar.sessionGroup")]}),ni&&l.jsxs($o,{disabled:ka,onSelect:()=>Pc(K),children:[l.jsx(hP,{}),N("sidebar.export")]}),l.jsxs($o,{variant:"destructive",disabled:di,title:di?N("sidebar.currentDeleteDisabled"):void 0,onSelect:()=>Lc(K),children:[l.jsx(Iy,{}),N("sidebar.delete")]})]})})]})]})]})]})]})},vt)},[ot,zn,ni,Xa,e,He,je,Pe,De,fs,Ut,Y1,Lc,Pc,fc,Up,Kv,X1,rn,Q1,F,mc,Dc,N]),sr=f.useMemo(()=>X&&se.length===0?l.jsx("div",{className:Ae.notice,children:N("sidebar.loadingSessions")}):J&&se.length===0?l.jsx("button",{className:Ae.retry,type:"button",onClick:W,children:N("sidebar.loadFailed")}):pc.length===0&&(cs.trim()||!F||Ja.length===0)?l.jsx("div",{className:Ae.notice,children:N("sidebar.searchEmpty")}):F?Ja.length===0?pc.map(K=>wa(K)):Ja.map(K=>{const we=!hs.has(K.id),Te=K.group;return l.jsx(d9,{id:K.id,label:K.label,count:K.sessions.length,color:K.color,expanded:we,onToggle:()=>Yv(K.id),onRename:K.kind==="group"&&Te?()=>Vp(Te):void 0,onDelete:K.kind==="group"&&Te?()=>Fr(Te):void 0,renameLabel:N("sidebar.groupRename"),deleteLabel:N("sidebar.groupDelete"),actionsDisabled:kt,children:K.sessions.map(Ue=>wa(Ue))},K.id)}):pc.map(K=>wa(K)),[hs,J,pc,kt,Fr,Vp,X,F,W,wa,cs,Ja,se.length,N,Yv]),qu=f.useMemo(()=>{if(!G||e||cs.trim())return null;const K=l.jsxs("button",{type:"button",className:Ae.archivedHeader,"aria-expanded":ye,onClick:()=>Ve(Ue=>!Ue),children:[l.jsx("span",{className:Ae.archivedTitle,style:{flex:"0 1 auto"},children:N("sidebar.archivedTitle")}),l.jsx("span",{className:Ae.archivedChevron,"aria-hidden":"true",children:ye?l.jsx(zl,{}):l.jsx(D4,{})}),ye&&tr.length>0&&l.jsx("span",{className:Ae.archivedCount,children:tr.length})]});if(!ye)return l.jsx("div",{className:Ae.archivedSection,children:K});const we=l.jsx("button",{className:Ae.retry,type:"button",onClick:()=>{Ke(),ht(Ue=>Ue+1)},children:N("sidebar.loadFailed")});let Te;return Ci&&tr.length===0?Te=l.jsx("div",{className:Ae.notice,children:N("sidebar.loadingSessions")}):mr&&tr.length===0?Te=we:tr.length===0?Te=l.jsx("div",{className:Ae.notice,children:N("sidebar.archivedEmpty")}):Te=l.jsxs(l.Fragment,{children:[tr.map(Ue=>wa(Ue,{isArchived:!0})),mr&&we]}),l.jsxs("div",{className:Ae.archivedSection,children:[K,l.jsx("div",{className:Ae.archivedList,children:Te})]})},[ye,tr,e,mr,Ci,Ke,wa,cs,G,ht,N]);return l.jsxs(l.Fragment,{children:[l.jsxs("aside",{className:rl(Ae.sidebar,e&&Ae.collapsed,le&&Ae.resizing,x&&Ae.mobileOpen),"aria-label":N("sidebar.label"),style:Ya,children:[Yt&&l.jsxs("div",{ref:xn,className:Ae.groupMenu,role:"menu","aria-label":N("sidebar.sessionGroup"),style:{top:Yt.top,left:Yt.left},onClick:K=>K.stopPropagation(),onKeyDown:ar,onMouseDown:K=>K.stopPropagation(),children:[l.jsxs("button",{className:rl(Ae.groupMenuItem,Z1&&Ae.groupMenuItemActive),type:"button",role:"menuitemradio","aria-checked":Z1,onClick:()=>jl(Yt.session,null),children:[l.jsx("span",{className:Ae.groupMenuEmptyDot}),l.jsx("span",{className:Ae.groupMenuName,children:N("sidebar.groupUngrouped")}),Z1&&l.jsx("span",{className:Ae.groupMenuCheck,children:"✓"})]}),mC.map(K=>{const we=Wp===K;return l.jsxs("button",{className:rl(Ae.groupMenuItem,we&&Ae.groupMenuItemActive),type:"button",role:"menuitemradio","aria-checked":we,onClick:()=>fC(Yt.session,K),children:[l.jsx("span",{className:rl(Ae.groupMenuDot,kH(K))}),l.jsx("span",{className:Ae.groupMenuName,children:N(`sidebar.groupColor.${K}`)}),we&&l.jsx("span",{className:Ae.groupMenuCheck,children:"✓"})]},`color:${K}`)}),_e.map(K=>{const we=Qv===K.id;return l.jsxs("button",{className:rl(Ae.groupMenuItem,we&&Ae.groupMenuItemActive),type:"button",role:"menuitemradio","aria-checked":we,onClick:()=>jl(Yt.session,K.id),children:[l.jsx("span",{className:rl(Ae.groupMenuDot,kH(K.color)),style:Bxt(K.color)}),l.jsx("span",{className:Ae.groupMenuName,children:K.name}),we&&l.jsx("span",{className:Ae.groupMenuCheck,children:"✓"})]},K.id)}),l.jsx("div",{className:Ae.groupMenuSeparator}),l.jsxs("button",{className:Ae.groupMenuItem,type:"button",role:"menuitem",onClick:()=>Fu(Yt.session),children:[l.jsx("span",{className:Ae.groupMenuIcon,children:l.jsx(Fxt,{})}),l.jsx("span",{className:Ae.groupMenuName,children:N("sidebar.groupCreate")})]})]}),Ht&&l.jsx(Qr,{title:N("delete.title"),size:"sm",onClose:()=>Ot(null),children:l.jsxs("div",{className:Ae.confirmContent,children:[l.jsx("p",{className:Ae.confirmDescription,children:N("sidebar.deleteConfirmDescription",{name:J1})}),l.jsxs("div",{className:Ae.confirmActions,children:[l.jsx("button",{className:Ae.secondaryButton,type:"button",onClick:()=>Ot(null),children:N("common.cancel")}),l.jsx("button",{className:Ae.dangerButton,type:"button",onClick:Qa,children:N("sidebar.delete")})]})]})}),$e&&l.jsx(Qr,{title:N("sidebar.removeWorkspaceTitle"),size:"sm",onClose:()=>{(!An||Zn)&&(Gn.current=!0,Lt(null),Pt(null),Vn(!1))},children:l.jsxs("div",{className:Ae.confirmContent,children:[l.jsx("p",{className:Ae.confirmDescription,children:ln?N("sidebar.removeWorkspaceBusy",{name:$e.cwd}):N("sidebar.removeWorkspaceConfirm",{name:$e.cwd})}),ln&&l.jsxs("ul",{className:Ae.workspaceRemovalActivityList,children:[l.jsx("li",{children:N("sidebar.removeWorkspaceSessions",{count:ln.sessions})}),l.jsx("li",{children:N("sidebar.removeWorkspacePrompts",{count:ln.activePrompts})}),l.jsx("li",{children:N("sidebar.removeWorkspaceStarts",{count:ln.pendingSessionStarts})}),l.jsx("li",{children:N("sidebar.removeWorkspaceConnections",{count:ln.acpConnections})}),l.jsx("li",{children:N("sidebar.removeWorkspaceMemoryTasks",{count:ln.memoryTasks})}),l.jsx("li",{children:N("sidebar.removeWorkspaceWorkers",{count:ln.channelWorkers})}),l.jsx("li",{children:N("sidebar.removeWorkspaceVoiceSessions",{count:ln.voiceSessions??0})})]}),ln&&j.sessionId&&j.workspaceCwd===$e.cwd&&l.jsx("p",{className:Ae.confirmDescription,children:N("sidebar.removeWorkspaceCurrentSession")}),Zn&&l.jsx("p",{className:Ae.confirmDescription,children:N("sidebar.removeWorkspaceInProgress")}),l.jsxs("div",{className:Ae.confirmActions,children:[l.jsx("button",{className:Ae.secondaryButton,type:"button",disabled:An&&!Zn,onClick:()=>{Gn.current=!0,Lt(null),Pt(null),Vn(!1)},children:N("common.cancel")}),l.jsx("button",{className:Ae.dangerButton,type:"button",disabled:An||Zn||ln!==null&&!!j.sessionId&&j.workspaceCwd===$e.cwd,onClick:()=>void As(),children:N(ln?"sidebar.forceRemoveWorkspace":"sidebar.removeWorkspace")})]})]})}),Hn&&l.jsx(Qr,{title:Kp,size:"sm",onClose:G1,children:l.jsxs("form",{className:"flex flex-col gap-6",onSubmit:K=>{K.preventDefault(),K1()},children:[l.jsxs(PI,{children:[l.jsxs(Cg,{children:[l.jsx(Yy,{htmlFor:"session-group-name",children:N("sidebar.groupNamePrompt")}),l.jsx(li,{id:"session-group-name",value:Bs,autoFocus:!0,maxLength:64,onChange:K=>fr(K.target.value)})]}),l.jsxs(Cg,{children:[l.jsx(Yy,{htmlFor:"session-group-color",children:N("sidebar.groupColor")}),l.jsxs(Af,{value:Zv?l8:Gr,onValueChange:K=>{rs(K===l8?Vt:K)},children:[l.jsx(jf,{id:"session-group-color",className:"w-full",children:l.jsx(Nf,{})}),l.jsx(Mf,{children:l.jsxs(yM,{children:[Gp.map(K=>l.jsx(vl,{value:K,children:N(`sidebar.groupColor.${K}`)},K)),l.jsx(vl,{value:l8,children:N("sidebar.groupColor.custom")})]})})]})]}),Zv&&l.jsxs(Cg,{children:[l.jsx(Yy,{htmlFor:"session-group-hex-color",children:N("sidebar.groupColor.hex")}),l.jsxs("div",{className:Ae.groupCustomColorRow,children:[l.jsx(li,{className:Ae.groupColorPicker,type:"color",value:Vt,"aria-label":N("sidebar.groupColor.picker"),onChange:K=>{const we=K.target.value.toLowerCase();Qn(we),rs(we)}}),l.jsx(li,{id:"session-group-hex-color",value:Gr,maxLength:7,spellCheck:!1,"aria-invalid":Oc===void 0,onChange:K=>{const we=K.target.value,Te=we.trim(),Ue=Te&&!Te.startsWith("#")?`#${Te}`:we;rs(Ue);const vt=h9(Ue);vt&&Qn(vt)}})]}),Oc===void 0&&l.jsx("span",{className:Ae.groupColorError,role:"alert",children:N("sidebar.groupColor.invalid")})]})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(qn,{type:"button",variant:"outline",disabled:kt,onClick:G1,children:N("common.cancel")}),l.jsx(qn,{type:"submit",disabled:!pC,children:N("common.save")})]})]})}),Rs&&l.jsx(Qr,{title:N("sidebar.groupDelete"),size:"sm",onClose:()=>{kt||pr(null)},children:l.jsxs("div",{className:Ae.confirmContent,children:[l.jsx("p",{className:Ae.confirmDescription,children:N("sidebar.groupDeleteConfirm",{name:Jv})}),l.jsxs("div",{className:Ae.confirmActions,children:[l.jsx("button",{className:Ae.secondaryButton,type:"button",disabled:kt,onClick:()=>pr(null),children:N("common.cancel")}),l.jsx("button",{className:Ae.dangerButton,type:"button",disabled:kt,onClick:Gv,children:N("sidebar.groupDelete")})]})]})}),z&&l.jsx("div",{className:Ae.topRow,children:B!=null&&B.render?B.render():l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Ae.brandLogo,"aria-hidden":"true",children:l.jsx(qxt,{})}),!e&&l.jsx("span",{className:Ae.brandName,children:"Qwen Code"})]})}),l.jsxs("div",{className:Ae.primaryNav,children:[l.jsxs("button",{className:Ae.newChatButton,type:"button",title:N("sidebar.newTask"),"aria-label":N("sidebar.newTask"),disabled:xt,onClick:()=>Ls(),children:[l.jsx("span",{className:Ae.navIcon,children:l.jsx(mP,{size:16,strokeWidth:1.2})}),!e&&l.jsx("span",{children:N("sidebar.newTask")})]}),l.jsxs("button",{className:Ae.pluginButton,type:"button",title:N("sidebar.plugins"),"aria-label":N("sidebar.plugins"),onClick:s,children:[l.jsx("span",{className:Ae.navIcon,children:l.jsx(Ime,{size:16,strokeWidth:1.2})}),!e&&l.jsx("span",{children:N("sidebar.plugins")})]}),$.has("scheduledTasks")&&l.jsxs("button",{className:Ae.pluginButton,type:"button",title:N("sidebar.scheduledTasks"),"aria-label":N("sidebar.scheduledTasks"),onClick:i,children:[l.jsx("span",{className:Ae.navIcon,children:l.jsx(Ome,{size:16,strokeWidth:1.2})}),!e&&l.jsx("span",{children:N("sidebar.scheduledTasks")})]}),$.has("goals")&&l.jsxs("button",{className:Ae.pluginButton,type:"button",title:N("sidebar.goals"),"aria-label":N("sidebar.goals"),onClick:o,children:[l.jsx("span",{className:Ae.navIcon,children:l.jsx(Ype,{size:16,strokeWidth:1.2})}),!e&&l.jsx("span",{children:N("sidebar.goals")})]})]}),l.jsx("div",{className:Ae.body,children:l.jsxs("div",{className:Ae.sessionList,children:[!e&&rt.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:Ae.projectsHeader,children:l.jsxs("button",{className:Ae.projectsHeaderToggle,type:"button","aria-expanded":it,onClick:()=>At(K=>!K),children:[l.jsx("span",{children:N("sidebar.pinnedSessions")}),l.jsx(SH,{expanded:it})]})}),it&&l.jsx("div",{className:Ae.pinnedSessionList,children:rt.map(K=>wa(K))})]}),!e&&l.jsxs("div",{className:Ae.projectsHeader,children:[l.jsxs("button",{className:Ae.projectsHeaderToggle,type:"button","aria-expanded":Ie,onClick:()=>Ge(K=>!K),children:[l.jsx("span",{children:N("sidebar.project")}),l.jsx(SH,{expanded:Ie})]}),l.jsxs("div",{className:Ae.projectsHeaderActions,children:[l.jsx("button",{className:Ae.projectsHeaderAction,type:"button",title:N("sidebar.search"),"aria-label":N("sidebar.search"),onClick:()=>{Cn(K=>(K&&gr(""),!K)),Ge(!0)},children:l.jsx(Fd,{})}),!C&&l.jsx("button",{className:Ae.projectsHeaderAction,type:"button",title:N("sidebar.addWorkspace"),"aria-label":N("sidebar.addWorkspace"),onClick:()=>{xe(!0)},children:l.jsx(hx,{})})]})]}),Xt&&!e&&l.jsxs("div",{className:Ae.projectSearch,children:[l.jsx(Fd,{"aria-hidden":"true"}),l.jsx(li,{value:cs,placeholder:N("sidebar.searchPlaceholder"),"aria-label":N("sidebar.search"),autoFocus:!0,onChange:K=>gr(K.target.value),onKeyDown:K=>{K.key==="Escape"&&(gr(""),Cn(!1))}})]}),(e||Ie)&&l.jsx(l.Fragment,{children:!e&&l.jsx("div",{className:Ae.workspacePicker,children:l.jsx("div",{className:Ae.workspaceList,children:Pr.map(K=>l.jsxs(f.Fragment,{children:[l.jsx(Txt,{workspace:K,renderHeader:C&&(_!=null&&_.render)?we=>{var Te;return(Te=_.render)==null?void 0:Te.call(_,K,{expanded:we})}:void 0,client:O.client,reloadToken:hn,untrustedLabel:N("sidebar.workspaceUntrusted"),readOnlyLabel:N("sidebar.workspaceReadOnly"),trustToOpenLabel:N("sidebar.workspaceTrustToOpen"),noSessionsLabel:N("sidebar.noSessions"),loadErrorLabel:N("sidebar.loadFailed"),organizationEnabled:F,ungroupedLabel:N("sidebar.groupUngrouped"),onRenameGroup:Vp,onDeleteGroup:Fr,renameGroupLabel:N("sidebar.groupRename"),deleteGroupLabel:N("sidebar.groupDelete"),groupActionsDisabled:kt,excludePinned:!0,onOpenGitDiff:T,formatTime:we=>s4(we,N),searchQuery:cs,expanded:K.primary?Lr:void 0,autoExpandKey:(Nt==null?void 0:Nt.id)===K.id?Nt==null?void 0:Nt.key:void 0,onExpandedChange:K.primary?pe:void 0,renderSessions:!K.primary,renderSession:we=>wa({...we,workspaceCwd:K.cwd},{readOnly:!K.primary}),headerActions:we=>{if(C&&(_!=null&&_.render))return null;const Te=!C&&vr&&!K.primary&&K.removable===!0;return!K.trusted&&!Te?null:l.jsxs("div",{className:Ae.workspaceHeaderActions,style:{visibility:we?"visible":"hidden"},children:[K.trusted&&l.jsxs(l.Fragment,{children:[l.jsx("button",{className:Ae.workspaceHeaderAction,type:"button","aria-label":N("sidebar.groupCreate"),onClick:Ue=>{Ue.preventDefault(),Ue.stopPropagation(),K.primary?V1():W1(K.cwd)},children:l.jsx(hx,{size:16,strokeWidth:1.2})}),l.jsx("button",{className:Ae.workspaceHeaderAction,type:"button",title:N("sidebar.newTask"),"aria-label":N("sidebar.newTask"),onClick:Ue=>{Ue.preventDefault(),Ue.stopPropagation(),Ls(K.primary?void 0:K.cwd)},children:l.jsx(mP,{size:16,strokeWidth:1.2})})]}),Te&&l.jsxs(kg,{children:[l.jsx(_g,{asChild:!0,children:l.jsx("button",{className:Ae.workspaceHeaderAction,type:"button","aria-label":N("sidebar.workspaceActions"),disabled:An&&($e==null?void 0:$e.id)===K.id,children:l.jsx(cg,{size:16,strokeWidth:1.2})})}),l.jsx(Sg,{align:"end",children:l.jsxs($o,{variant:"destructive","aria-label":`${N("sidebar.removeWorkspace")}: ${K.cwd}`,onSelect:()=>va(K),children:[l.jsx(Iy,{}),N("sidebar.removeWorkspace")]})})]})]})}}),K.primary&&(Lr||cs.trim())?l.jsx("div",{className:Ae.workspaceSessionBody,children:sr}):null]},K.id))})})}),qu]})}),A!==!1&&l.jsxs("div",{className:rl(Ae.footer,xa&&Ae.footerCompact,Ka&&Ae.footerTight),children:[l.jsxs("div",{className:Ae.footerPrimary,children:[$.has("settings")&&l.jsxs("button",{className:Ae.footerButton,type:"button",title:N("sidebar.settings"),"aria-label":N("sidebar.settings"),onClick:n,children:[l.jsx("span",{className:`${Ae.navIcon} ${Ae.settingsIcon}`,children:l.jsx($pe,{size:16,strokeWidth:1.2})}),!e&&!xa&&l.jsx("span",{className:Ae.footerButtonLabel,children:N("sidebar.settings")})]}),!e&&!Ka&&go&&$.has("version")&&l.jsx("span",{className:Ae.version,title:`Qwen Code ${go}`,children:go})]}),l.jsxs("div",{className:Ae.footerActions,children:[$.has("theme")&&l.jsx("button",{className:Ae.collapseButton,type:"button",title:b===$r.Dark?N("sidebar.themeLight"):N("sidebar.themeDark"),"aria-label":b===$r.Dark?N("sidebar.themeLight"):N("sidebar.themeDark"),onClick:()=>v(b===$r.Dark?$r.Light:$r.Dark),children:b===$r.Dark?l.jsx(Gpe,{size:16,strokeWidth:1.2}):l.jsx(vpe,{size:16,strokeWidth:1.2})}),c&&$.has("sessionsOverview")&&l.jsx("button",{className:Ae.collapseButton,type:"button",title:N("sidebar.sessionsOverview"),"aria-label":N("sidebar.sessionsOverview"),onClick:a,children:l.jsx(mpe,{size:16,strokeWidth:1.2})}),d&&$.has("splitView")&&l.jsx("button",{className:Ae.collapseButton,type:"button",title:N("sidebar.splitView"),"aria-label":N("sidebar.splitView"),onClick:u,children:l.jsx(Gme,{size:16,strokeWidth:1.2})}),$.has("daemonStatus")&&l.jsx("button",{className:Ae.collapseButton,type:"button",title:N("sidebar.daemonStatus"),"aria-label":N("sidebar.daemonStatus"),onClick:r,children:l.jsx(Tme,{size:16,strokeWidth:1.2})}),!x&&$.has("collapse")&&l.jsx("button",{className:Ae.collapseButton,type:"button",title:N(e?"sidebar.expand":"sidebar.collapse"),"aria-label":N(e?"sidebar.expand":"sidebar.collapse"),onClick:()=>t(!e),children:e?l.jsx(Epe,{size:16,strokeWidth:1.2}):l.jsx(Cpe,{size:16,strokeWidth:1.2})})]})]}),l.jsx("div",{className:Ae.resizeHandle,role:"separator","aria-orientation":"vertical",onPointerDown:Xv})]}),!C&&Un&&l.jsx(j1t,{onClose:()=>xe(!1),onAdd:Qo,onSuggest:Ds})]})}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Uxt(e){return e.key!=="b"&&e.key!=="B"||e.altKey||e.shiftKey?!1:e.metaKey!==e.ctrlKey}function Vxt(e){const[t,n]=f.useState(e);return f.useEffect(()=>{const s=window.requestAnimationFrame(()=>{n(e)});return()=>window.cancelAnimationFrame(s)},[e]),t}const Wxt=3e3,Gxt=2;function CH(e){return e.some(t=>t.status==="running"||t.status==="paused")}function Kxt(e,t,n=0){const s=x1(),[r,i]=f.useState([]),[o,a]=f.useState(!1),[c,u]=f.useState(!1),d=f.useRef(0),h=f.useRef(!1);f.useEffect(()=>{if(!t){i([]),a(!1),d.current=0;return}},[t]),f.useEffect(()=>{!t||!e||(d.current=0,a(!0))},[t,e]),f.useEffect(()=>{!t||n===0||(d.current=0,a(!0))},[t,n]),f.useEffect(()=>{if(c||!t||!o)return;let p=!1;const g=()=>{h.current||(h.current=!0,s.getTasks().then(v=>{if(!p){if(i(v.tasks),v.tasks.length===0){d.current+=1,d.current>=Gxt&&a(!1);return}d.current=0,CH(v.tasks)||a(!1)}}).catch(v=>{p||console.warn("[web-shell] failed to refresh tasks:",v)}).finally(()=>{h.current=!1}))};g();const b=setInterval(g,Wxt);return()=>{p=!0,clearInterval(b)}},[s,t,o,c]);const m=f.useRef(r);return m.current=r,f.useEffect(()=>{const p=g=>{const b=g.detail,v=(b==null?void 0:b.active)===!0;u(v),!v&&CH(m.current)&&a(!0)};return window.addEventListener(Jx,p),()=>window.removeEventListener(Jx,p)},[]),r}function Yxt(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((c,u)=>c===a[u]):!1})}function Xxt(e){const t=f.useRef(e);return Yxt(t.current,e)||(t.current=e),t.current}function Qxt(e,t){const n=f.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 zi={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"},TH=1024,Jxt=new RegExp(String.raw`(?<![\w$])\$(?![\s\d$])(?=[^$\n]{1,${TH}}\S\$)([^$\n]{1,${TH}})\$(?![\w$])`,"g");function Zxt(e){var u,d,h;const t=[],n=e.split(/\r?\n/),s=/^ *(`{3,}|~{3,}) *([^`]*)$/,r=new Map;let i=null,o=null,a=null,c=[];for(const m of n){const p=m.match(s);if(!i){if(p){if(i=p[1]??null,o=((d=(u=p[2])==null?void 0:u.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;c=[]}continue}if(p&&((h=p[1])!=null&&h.startsWith(i[0]??""))&&p[1].length>=i.length){t.push({lang:o,content:c.join(`
`),index:t.length+1,langIndex:a}),i=null,o=null,a=null,c=[];continue}c.push(m)}return t}function evt(e){var c;const t=[],n=e.split(/\r?\n/),s=/^ *(`{3,}|~{3,}) *([^`]*)$/,r=/^ *\$\$ *$/;let i=null,o=!1,a=[];for(const u of n){const d=u.match(s);if(i){d&&((c=d[1])!=null&&c.startsWith(i[0]??""))&&d[1].length>=i.length&&(i=null);continue}if(!o){if(d){i=d[1]??null;continue}r.test(u)&&(o=!0,a=[]);continue}if(r.test(u)){t.push({content:a.join(`
`),index:t.length+1}),o=!1,a=[];continue}a.push(u)}return t}function tvt(e){var a;const t=[],n=e.split(/\r?\n/),s=/^ *(`{3,}|~{3,}) *([^`]*)$/,r=/^ *\$\$ *$/;let i=null,o=!1;for(const c of n){const u=c.match(s);if(i){u&&((a=u[1])!=null&&a.startsWith(i[0]??""))&&u[1].length>=i.length&&(i=null);continue}if(o){r.test(c)&&(o=!1);continue}if(u){i=u[1]??null;continue}if(r.test(c)){o=!0;continue}for(const d of c.matchAll(Jxt)){const h=d[1];h&&t.push({content:h,index:t.length+1})}}return t}function EH(e,t){return t&&e.langIndex!==null?`${t} code block ${e.langIndex}`:`Code block ${e.index}`}function nvt(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=Zxt(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 c=i?r.filter(h=>h.lang===i):r;if(c.length===0)return null;if(o!==null){const h=i?c.find(m=>m.langIndex===o):r.find(m=>m.index===o);return h?{content:h.content,label:EH(h,i)}:null}const u=c[c.length-1];return u?{content:u.content,label:EH(u,i)}:null}function AH(e,t){const n=tvt(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 svt(e,t){var u;const n=t.trim().split(/\s+/).filter(Boolean),s=(u=n[0])==null?void 0:u.toLowerCase();if(s!=="latex"&&s!=="math"&&s!=="inline-latex")return;if(s==="inline-latex")return AH(e,n.slice(1));const r=n.slice(1),i=r.findIndex(d=>d.toLowerCase()==="inline");if(i!==-1)return AH(e,r.filter((d,h)=>h!==i));const o=evt(e);if(o.length===0)return null;let a=null;for(const d of r)/^\d+$/.test(d)&&(a=Number(d));const c=a!==null?o.find(d=>d.index===a):o[o.length-1];return c?{content:c.content,label:`LaTeX block ${c.index}`}:null}function rvt(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 ivt(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 ovt(e,t,n=ivt){const s=rvt(e);if(s===null)return{status:"info",message:zi.NO_OUTPUT};if(!s)return{status:"info",message:zi.NO_TEXT};try{const r=svt(s,t);if(r===null)return{status:"info",message:t.trim().split(/\s+/).some(c=>c==="inline")||t.trim().toLowerCase().startsWith("inline-latex")?zi.INLINE_LATEX_MISSING:zi.LATEX_MISSING};if(r!==void 0)return await n(r.content),{status:"info",message:`${r.label}${zi.COPIED_SUFFIX}`};const i=nvt(s,t);if(i===null)return{status:"info",message:zi.CODE_MISSING};const o=(i==null?void 0:i.content)??s;return await n(o),{status:"info",message:i?`${i.label}${zi.COPIED_SUFFIX}`:zi.OUTPUT_COPIED}}catch(r){const i=r instanceof Error?r.message:String(r);return{status:"error",message:`${zi.CLIPBOARD_PREFIX}${i}`}}}function avt(e){return typeof e=="object"&&e!==null}function Boe(e){const t="Model switched: ";return e.startsWith(t)?e.slice(t.length).trim().replace(/\([^()]+\)$/,""):null}function BI(e){return e.role==="system"&&e.variant==="info"&&e.source==="model_switch_summary"}function lvt(e){if(!BI(e)||!avt(e.data))return null;const t=e.data.modelId;return typeof t=="string"&&t?t:null}function cvt(e){const t=new Set;for(const n of e){if(!BI(n))continue;const s=lvt(n);s&&t.add(s)}return t.size===0?[...e]:e.filter(n=>{if(n.role!=="system"||n.variant!=="info")return!0;const s=Boe(n.content);return!s||!t.has(s)})}function uvt(e){return e.role!=="system"||e.variant!=="info"?!1:Boe(e.content)!==null||BI(e)}function dvt(e){const t=e.findIndex(n=>!uvt(n));return t<0?[]:e.slice(t)}function NH(e){return dvt(cvt(e))}function hvt(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 jH(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 fvt(e){const t=e.match(/^(.+)\(([^()]+)\)$/);return t?`${t[2]}:${t[1]}`:e}function MH(e){const t=e.match(/^(.+)\(([^()]+)\)$/);return t?t[1]:e}function mvt(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 pvt=12,gvt=8,bvt=.35,yvt=2,xvt=.1,vvt=700,wvt=10*60*1e3,kvt=.75,_vt=280,Svt=[/^继续[吧呢]?$/,/^行[吧吗]?$/,/^好的?$/,/^再[看试说解释改跑补].*/,/^顺手.*/,/^上面.*/,/^刚才.*/,/^这个报错.*/,/^那你.*/,/^帮我修.*/,/^帮我看下.*/,/^跑(一下)?(测试|看看).*/,/^这个实现.*/,/^这个 PR.*/i,/^继续当前.*/,/^continue$/i,/^ok(?:ay)?$/i,/^retry$/i,/^fix (?:that|this|it)/i,/^run (?:the )?tests?/i],Cvt=[/新的?(功能|任务|方向|话题)/,/写(一篇)?(设计文档|文档|spec|方案)/i,/产品方案/,/脑爆/,/另一个(功能|方向|任务|主题)/,/不继续当前/,/切到(一个)?新的?(任务|方向|话题)/,/start (a )?new/i,/new (feature|task|design|spec|doc|workflow)/i,/product (design|plan|spec)/i,/brainstorm/i];function Tvt(e){const t=e.trim();return Svt.some(n=>n.test(t))}function Evt(e){const t=e.trim();return Cvt.some(n=>n.test(t))}function Avt(e){return e.filter(n=>(n.role==="user"||n.role==="assistant")&&typeof n.content=="string"&&n.content.trim().length>0).slice(-8).map(n=>({role:n.role,text:n.content.trim().slice(0,_vt)}))}function Nvt(e){const t=e.recentMessages.map((n,s)=>`${s+1}. ${n.role}: ${n.text}`).join(`
`);return["You are deciding whether a user's new message still belongs in the current coding session.","Suggest starting a new session only when the new message is clearly a different task or topic, and continuing in the current session would likely add context noise or wasted token usage.","Be conservative. When in doubt, keep the current session.","Do NOT suggest a new session for follow-up questions, implementation continuations, debugging iterations, review follow-ups, or adjacent design discussion about the same repo, PR, bug, or feature.","Return JSON only with keys: shouldSuggestNewSession (boolean) and confidence (0-1 number).","",`Context usage ratio: ${e.contextUsageRatio.toFixed(2)}`,`Visible message count: ${e.messageCount}`,"","Recent visible messages:",t||"(none)","","Current user input:",e.currentInput].join(`
`)}function IH(e){try{const t=JSON.parse(e);return typeof t.shouldSuggestNewSession!="boolean"||typeof t.confidence!="number"?null:{shouldSuggestNewSession:t.shouldSuggestNewSession,confidence:t.confidence}}catch{return null}}function jvt(e){const t=IH(e);if(t)return t;const n=e.indexOf("{"),s=e.lastIndexOf("}");if(n===-1||s<=n)return null;const r=e.slice(n,s+1);return r===e?null:IH(r)}function Mvt({enabled:e,inputText:t,messages:n,sessionId:s,contextUsageRatio:r,isRunning:i,dialogOpen:o,generateContent:a}){const[c,u]=f.useState(null),d=f.useRef(null),h=f.useRef(null),m=f.useRef(0),p=f.useRef(s),g=f.useMemo(()=>Avt(n),[n]),b=f.useCallback(()=>{var y;d.current&&(clearTimeout(d.current),d.current=null),(y=h.current)==null||y.abort(),h.current=null},[]),v=f.useCallback(()=>{u(null),b()},[b]),x=f.useCallback(()=>{m.current=Date.now()+wvt,u(null),b()},[b]);return f.useEffect(()=>{p.current!==s&&(u(null),b(),p.current=s)},[b,s]),f.useEffect(()=>{if(b(),!e||!a||!s){u(null);return}const y=t.trim();if(y.length<pvt){u(null);return}if(Tvt(y)){u(null);return}const w=Evt(y);if(i||o){u(null);return}if(w?g.length<yvt&&r<xvt:g.length<gvt&&r<bvt){u(null);return}if(Date.now()<m.current){u(null);return}return u(null),d.current=setTimeout(()=>{const k=new AbortController;h.current=k;const T=Nvt({recentMessages:g,currentInput:y,contextUsageRatio:r,messageCount:g.length});(async()=>{let S="";try{for await(const _ of a(T,{signal:k.signal})){if(h.current!==k)return;if(_.type==="delta")S+=_.text;else if(_.type==="error"){h.current===k&&u(null);return}}if(h.current!==k)return;const C=jvt(S.trim());if(C&&C.shouldSuggestNewSession&&C.confidence>=kvt){u({isVisible:!0,classifiedInput:y});return}u(null)}catch{k.signal.aborted||u(null)}finally{h.current===k&&(h.current=null)}})()},vvt),()=>{b()}},[b,r,o,e,a,t,i,g,s]),{suggestion:c,dismiss:v,suppress:x}}const Ep=f.createContext(!1),$I=f.createContext(new Map),$oe=f.createContext(new Map);function Ivt({timeline:e,details:t,children:n}){return l.jsx($I.Provider,{value:e,children:l.jsx($oe.Provider,{value:t,children:n})})}const Ub=N4,c8=760,S0=320,i2=500,Rvt=20,Dvt=3e4;function Lvt(e){return(e.skills??[]).filter(t=>t.status==="ok").map(t=>({name:t.name,description:t.description??"",...t.argumentHint?{argumentHint:t.argumentHint}:{}})).sort((t,n)=>t.name.localeCompare(n.name))}const Pvt="ui.compactMode",Ovt="ui.hideTips",Bvt={main:"model.select",fast:"model.setFast",voice:"model.setVoice",vision:"model.setVision"};function u8(e){return e.trim().replace(/^\/+/,"").toLowerCase()}function $vt(e){const t=e;return t.source!=="goal"?null:XS(t.data)??XS(t.text)}function zvt(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.kind!=="status")continue;const s=$vt(n);if(s)return s.kind==="set"||s.kind==="checking"?{condition:s.condition,setAt:s.setAt??n.serverTimestamp??n.createdAt}:null}return null}const RH={insertText:()=>{},setText:()=>{},addTags:()=>{},removeTag:()=>{},clear:()=>{},submit:()=>{}},Fvt=[],zoe=1e3,DH=6,LH=40,Foe="qwen-code-web-shell-chat-width",qvt=40,qoe="qwen-code-web-shell-sidebar-collapsed";function Hvt(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,lockedWorkspace:e.lockedWorkspace}:{enabled:!1,defaultCollapsed:!1,showCompactToggle:!0}}function Uvt(e){if(typeof window>"u")return e;try{const t=window.localStorage.getItem(qoe);if(t==="true")return!0;if(t==="false")return!1}catch{}return e}function PH(e){try{window.localStorage.setItem(qoe,String(e))}catch{}}function n_(){return`${zoe}`}function Vvt(){if(typeof window>"u")return n_();try{return window.localStorage.getItem(Foe)==="wide"?"wide":n_()}catch{return n_()}}function Wvt(e){try{window.localStorage.setItem(Foe,e)}catch{}}function Hoe(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:zoe}function Gvt(e,t){const n=`${Hoe(t)}px`,s=`calc(${n} + ${qvt}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 OH(e,t){if(e){if(typeof e=="function"){e(t);return}e.current=t}}function BH(e,t){if(e){if(typeof e=="function"){e(t);return}e.current=t}}function Kvt(e,t){return e.length===t.length&&e.every((n,s)=>n===t[s])}function Yvt(){if(typeof window>"u")return"en";const e=new URLSearchParams(window.location.search);return kd(e.get("language")??e.get("lang")??navigator.language)}function Xvt(e,t){return e instanceof Error?e.message:t}function d8(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function C0(e){return typeof e=="object"&&e!==null&&e._alreadyDispatched===!0}function Qvt(e){return e.category==="validation"||e.category==="user_action"||e.category==="system"}function Jvt(e){return e.severity==="warning"?"warning":e.severity==="info"?"info":"error"}function h8(e){return typeof e=="object"&&e!==null}function Zvt(e){if(!h8(e))return null;const t=e._meta;if(!h8(t))return null;const n=t.qwenModelSwitch;if(!h8(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 ewt(e,t){return t("model.usingModel",{isRuntime:e.isRuntime?1:0,modelId:e.modelId})}function twt(e){return e.toolKind==="edit"}function nwt(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 swt(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 rwt(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const s of n.tools)(zG(s)||swt(s))&&t.push(`${s.callId}:${s.status}`);return t.join("|")}function iwt(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 owt(e,t){return e===zi.NO_OUTPUT?t("copy.noOutput"):e===zi.NO_TEXT?t("copy.noText"):e===zi.CODE_MISSING?t("copy.codeMissing"):e===zi.LATEX_MISSING?t("copy.latexMissing"):e===zi.INLINE_LATEX_MISSING?t("copy.inlineLatexMissing"):e===zi.OUTPUT_COPIED?t("copy.outputCopied"):e.startsWith(zi.CLIPBOARD_PREFIX)?`${t("copy.failedFallback")}. ${e.slice(zi.CLIPBOARD_PREFIX.length)}`:e.endsWith(zi.COPIED_SUFFIX)?t("copy.toClipboard",{label:e.slice(0,-zi.COPIED_SUFFIX.length)}):e}function o2(e,t,n){const s=e.find(r=>r.key===n);if(s)return t==="user"?s.values.user:s.values.workspace}function awt({onSessionIdChange:e,onSessionCreated:t,theme:n,onThemeChange:s,language:r,onLanguageChange:i,className:o,style:a,onConnectionChange:c,onStreamingStateChange:u,onError:d,onBugReport:h,hiddenSlashCommands:m,slashCommandCategoryOrder:p,builtinAtProviders:g,atProviders:b,composerTagIcons:v,renderToolHeaderExtra:x,renderWelcomeHeader:y,renderWelcomeFooter:w,mobileWelcomeFooterMiddle:k=!1,parseUserMessageContent:T,renderUserMessageContent:S,renderComposerTag:C,renderComposerTagTooltip:_,onComposerTagClick:B,renderAssistantTurnFooter:A,renderComposerToolbarStart:N,renderComposerToolbarEnd:j,renderComposerToolbarRight:P,renderComposerHeader:L,renderFooter:O,bottomStatusItems:$,chatMaxWidth:z,sidebar:F,splitSessionIds:G,onSplitSessionIdsChange:I,onRightPanelOpen:Q,messageTurnOutputs:V,shellRef:M,composerToolbarActions:re,composerPlaceholders:se,compactThinking:X=!1,collapseCompletedTurns:J=!0,markdownTableMode:de="basic",virtualScrollThreshold:W,markdown:te,loadingPhrases:U,onTranscriptChange:ee,onToast:oe,composerRef:Ce,onComposerReady:he,composerInput:ye,composerInputVersion:Ve,onSessionChange:it,onSubmitBefore:At,restartSseOnPrompt:Ee,lockedWorkspaceCwd:me,lockedWorkspaceCapability:bt}={}){var UR,VR,WR,GR,KR;const[et,qe]=f.useState(Vvt),[Ke,ke]=f.useState(()=>r===void 0?Yvt():kd(r)),ne=f.useMemo(()=>LN(Ke),[Ke]),gt=f.useMemo(()=>Hvt(F),[F]),[We,tt]=f.useState(()=>Uvt(gt.defaultCollapsed)),[jt,jn]=f.useState(null),[kn,Be]=f.useState(!1),[ht,ve]=f.useState(!1),Me=f.useCallback(()=>{Be(!1),ve(!1)},[]),_e=Qq(),Xe=Qq("(min-width: 1200px)");f.useEffect(()=>{gt.enabled||Me()},[Me,gt.enabled]),f.useEffect(()=>{const R=window.matchMedia("(max-width: 760px)"),q=Z=>{Z.matches||Me()};return R.addEventListener("change",q),()=>R.removeEventListener("change",q)},[Me]),f.useEffect(()=>{if(!kn)return;const R=fe=>{if(fe.key!=="Escape"||Ci.current)return;const Oe=fe.target;Sp(Oe)&&!(Oe!=null&&Oe.closest("[data-sidebar-shell]"))||(fe.stopPropagation(),fe.preventDefault(),Me())},q=document.body.style.overflow;document.body.style.overflow="hidden";const Z=fe=>{const Oe=fe.target;Oe!=null&&Oe.closest("[data-sidebar-shell]")&&!Oe.closest(`.${Mt.mobileBackdrop}`)||fe.preventDefault()};return document.addEventListener("touchmove",Z,{passive:!1}),window.addEventListener("keydown",R,!0),()=>{document.body.style.overflow=q,document.removeEventListener("touchmove",Z),window.removeEventListener("keydown",R,!0)}},[kn,Me]);const ue=f.useCallback(R=>{tt(R),PH(R)},[]);f.useEffect(()=>{if(!gt.enabled)return;const R=q=>{if(!Uxt(q))return;const Z=q.target;if(Sp(Z)&&!(Z!=null&&Z.closest("[data-web-shell-composer-editor]")))return;if(q.preventDefault(),ht||window.matchMedia("(max-width: 760px)").matches){kn?(Be(!1),ve(!1)):Be(!0);return}const fe=!We;tt(fe),PH(fe)};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[gt.enabled,kn,ht,We]);const Fe=f.useMemo(()=>({composerTagIcons:v,renderToolHeaderExtra:x,renderWelcomeHeader:y,renderWelcomeFooter:w,parseUserMessageContent:T,renderUserMessageContent:S,renderComposerTag:C,renderComposerTagTooltip:_,onComposerTagClick:B,renderAssistantTurnFooter:A,renderComposerToolbarStart:N,renderComposerToolbarEnd:j,renderComposerToolbarRight:P,renderComposerHeader:L,renderFooter:O,compactThinking:X,collapseCompletedTurns:J,markdownTableMode:de,markdown:te,loadingPhrases:U}),[v,x,y,w,T,S,C,_,B,A,N,j,P,L,O,X,J,de,te,U]),kt=O,bn=L,Pe=I4(),yn=mv(),je=Cl(),Ne=CG(),ot=dc(),pt=f.useMemo(()=>{var q;const R=((q=ot.capabilities)==null?void 0:q.workspaces)??[];return bt&&!R.some(Z=>Z.cwd===bt.cwd)?[...R,bt]:R},[bt,(UR=ot.capabilities)==null?void 0:UR.workspaces]),dn=f.useMemo(()=>me?pt.filter(R=>R.cwd===me):pt,[me,pt]),De=x1(),{notices:sn,dismissNotice:Dn}=Jfe(),os=fo(),[st,St]=f.useState(void 0),Ht=f.useRef(st);Ht.current=st;const[Ot,Yt]=f.useState(void 0),Pn=f.useRef(void 0),Hn=f.useMemo(()=>{var R;return je.sessionId?je.workspaceCwd:me??st??((R=pt.find(q=>q.primary))==null?void 0:R.cwd)},[je.sessionId,je.workspaceCwd,me,st,pt]);f.useEffect(()=>{if(!Hn){Pn.current=void 0,Yt(void 0);return}Pn.current!==Hn&&(Pn.current=Hn,Yt(void 0));let R=!1;const q=()=>{ot.client.workspaceByCwd(Hn).workspaceGit().then(Oe=>{R||Yt(Oe)}).catch(()=>{R||Yt(void 0)})};q();const Z=()=>q();window.addEventListener("focus",Z);const fe=window.setInterval(()=>{document.visibilityState==="visible"&&q()},3e4);return()=>{R=!0,window.removeEventListener("focus",Z),window.clearInterval(fe)}},[Hn,je.gitBranch,ot.client]);const as=f.useRef(oe);as.current=oe;const Bs=f.useRef(0),[fr,Gr]=f.useState([]),rs=f.useCallback(R=>{Gr(q=>q.filter(Z=>Z.id!==R))},[]),Vt=f.useCallback((R,q)=>{if(as.current){as.current(R,q);return}const Z={id:`web-shell-toast-${Date.now()}-${++Bs.current}`,tone:R,message:q};Gr(fe=>[...fe.filter(wt=>wt.tone!==R||wt.message!==q),Z].slice(-4))},[]),Qn=Hie(ne),Rs=f.useRef(Qn);Rs.current=Qn;const[pr,hs]=f.useState(null),[xr,ci]=f.useState(null),_s=f.useRef(1),Vs=f.useRef(1),ls=f.useRef(null),Ws=f.useRef(null),Ss=f.useRef(je.sessionId),Xs=f.useRef(void 0),Cr=f.useRef(void 0),Lr=f.useRef(void 0),pe=f.useRef(je.sessionId),Ie=f.useMemo(()=>{const R=[pr].filter(Z=>Z!==null);if(R.length===0)return NH(Qn);const q=[...Qn];for(const Z of R.sort((fe,Oe)=>fe.anchorIndex-Oe.anchorIndex)){const fe=Z.anchorAfterId?q.findIndex(wt=>wt.id===Z.anchorAfterId):-1,Oe=fe>=0?fe+1:Math.min(Z.anchorIndex,q.length);q.splice(Oe,0,Z.message)}return NH(q)},[Qn,pr]),{artifacts:Ge,loading:Xt,error:Cn}=Uie(),[Un,xe]=f.useState([]),[$e,Lt]=f.useState(()=>new Map),[ln,Pt]=f.useState([]);f.useEffect(()=>{if(Un.length===0||Ge.length===0)return;const R=new Set(Ge.map(Z=>Z.id)),q=new Set(ln.filter(Z=>Z.kind==="artifact"&&Z.workspaceActions).map(Z=>Z.kind==="artifact"?Z.artifactId:""));xe(Z=>{const fe=Z.filter(Oe=>!R.has(Oe.id)||q.has(Oe.id));return fe.length===Z.length?Z:fe})},[Ge,Un.length,ln]);const An=f.useMemo(()=>Array.from($e.values()).flatMap(R=>[...R.artifacts]),[$e]),Xn=f.useMemo(()=>{if(Un.length===0&&An.length===0)return Ge;const R=[...Ge];for(const q of[...Un,...An])R.findIndex(fe=>fe.id===q.id)<0&&R.push(q);return R},[Ge,Un,An]),Mn=f.useCallback((R,q,Z)=>{Lt(Oe=>{const wt=Oe.get(R);if((wt==null?void 0:wt.workspaceActions)===Z&&wt.artifacts.length===q.length&&wt.artifacts.every((Wt,dt)=>{const mt=q[dt];return(mt==null?void 0:mt.id)===Wt.id&&mt.updatedAt===Wt.updatedAt&&mt.sizeBytes===Wt.sizeBytes}))return Oe;const cn=new Map(Oe);return q.length===0?cn.delete(R):cn.set(R,{artifacts:[...q],workspaceActions:Z}),cn});const fe=new Set(q.map(Oe=>Oe.id));Pt(Oe=>{let wt=!1;const Bn=Oe.map(cn=>{if(cn.kind!=="artifact"||!fe.has(cn.artifactId))return cn;const Wt={id:cn.id,kind:"artifact",title:cn.title,artifactId:cn.artifactId,workspaceActions:cn.workspaceActions??Z};return cn.previewContent!==void 0&&(wt=!0),cn.workspaceActions||(wt=!0),Wt});return wt?Bn:Oe})},[]),Gn=f.useMemo(()=>soe(Ie,Ge,je.workspaceCwd||""),[Ie,Ge,je.workspaceCwd]),Zn=f.useMemo(()=>ioe(Ie,Gn,je.workspaceCwd||""),[Ie,Gn,je.workspaceCwd]),Vn=f.useMemo(()=>ooe(Ie),[Ie]),hn=f.useMemo(()=>new Set(V??sie),[V]),[Le,Nt]=f.useState(!1),Tn=f.useRef(Le);Tn.current=Le;const[_n,cs]=f.useState(null),gr=f.useRef(_n);gr.current=_n;const[le,Se]=f.useState([]),[He,Qe]=f.useState(null),[xn,Bt]=f.useState(c8),$n=f.useRef(null),Qs=f.useRef(null),vs=f.useRef(new Map),is=f.useRef(je.sessionId);Qs.current={open:Le,tabs:ln,activeTabId:_n,reviewChanges:le,selectedReviewPath:He,extraArtifacts:Un,width:xn},f.useEffect(()=>{const R=is.current;if(R){const fe=Qs.current;if(fe&&(vs.current.set(R,fe),vs.current.size>Rvt)){const Oe=vs.current.keys().next().value;Oe&&vs.current.delete(Oe)}}const q=je.sessionId;is.current=q;const Z=q?vs.current.get(q):void 0;if(!Z){Nt(!1),Pt([]),cs(null),Se([]),Qe(null),xe([]),Lt(new Map),Bt(c8);return}Nt(Z.open),Pt(Z.tabs),cs(Z.activeTabId),Se(Z.reviewChanges),Qe(Z.selectedReviewPath),xe(Z.extraArtifacts),Lt(new Map),Bt(Z.width)},[je.sessionId]);const Js=f.useCallback(()=>{var q;const R=(q=Ws.current)==null?void 0:q.getBoundingClientRect().width;return R?Math.max(S0,xn+R-i2):Math.max(S0,window.innerWidth-i2)},[xn]),vr=f.useCallback(()=>{var Z;const R=((Z=Ws.current)==null?void 0:Z.getBoundingClientRect().width)??window.innerWidth,q=Math.max(S0,R-i2);return Math.min(q,Math.max(c8,Math.round(R*.56)))},[]),ni=f.useCallback((R,q)=>{if(!R)return;const Z=Xn.find(Oe=>Oe.id===R),fe={id:`artifact:${R}`,kind:"artifact",artifactId:R,title:(Z==null?void 0:Z.title)??"Artifact",...q!==void 0?{previewContent:q}:{}};Pt(Oe=>Oe.some(wt=>wt.id===fe.id)?Oe.map(wt=>wt.id===fe.id?{...wt,...fe}:wt):[...Oe,fe]),cs(fe.id),Bt(Oe=>Tn.current?Oe:vr()),Nt(!0)},[Xn,vr]),Tr=f.useCallback((R,q)=>{const Z={id:"review",kind:"review",title:ne("turnOutputs.review")};Pt(fe=>fe.some(Oe=>Oe.id===Z.id)?fe:[Z,...fe]),cs(Z.id),Se(R),Qe(q??null),Bt(fe=>Tn.current?fe:vr()),Nt(!0)},[vr,ne]),mo=f.useCallback((R,q)=>{const Z={id:`scheduled-task:${R.toolCallId}`,kind:"scheduled_task",title:ne("scheduledTasks.title"),task:R,...q?{workspaceActions:q}:{}};Pt(fe=>fe.some(Oe=>Oe.id===Z.id)?fe.map(Oe=>Oe.id===Z.id?Z:Oe):[...fe,Z]),cs(Z.id),Bt(fe=>Tn.current?fe:vr()),Nt(!0)},[vr,ne]),Nl=f.useCallback(R=>{if(Q){Q(R);return}if(R.kind==="review"){Tr(R.changes,R.selectedPath);return}if(R.kind==="scheduled_task"){mo(R.task,R.workspaceActions);return}R.workspaceActions||xe(Z=>{const fe=Z.findIndex(wt=>wt.id===R.artifact.id);if(fe<0)return[...Z,R.artifact];const Oe=[...Z];return Oe[fe]=R.artifact,Oe});const q={id:R.id,kind:"artifact",title:R.title,artifactId:R.artifactId,...R.workspaceActions?{workspaceActions:R.workspaceActions}:{},...R.previewContent!==void 0?{previewContent:R.previewContent}:{}};Pt(Z=>Z.some(fe=>fe.id===q.id)?Z.map(fe=>fe.id===q.id?{...fe,...q}:fe):[...Z,q]),cs(q.id),Bt(Z=>Tn.current?Z:vr()),Nt(!0)},[vr,Q,Tr,mo]),Pr=f.useCallback(()=>{Nt(!1),Pt([]),cs(null),Se([]),Qe(null),xe([]),Lt(new Map)},[]);f.useLayoutEffect(()=>{if(!Le)return;const R=()=>{Bt(fe=>{var Bn;const Oe=((Bn=Ws.current)==null?void 0:Bn.getBoundingClientRect().width)??window.innerWidth-fe,wt=Math.max(S0,fe+Oe-i2);return Math.min(fe,wt)})};R(),window.addEventListener("resize",R);const q=Ws.current,Z=new ResizeObserver(R);return q&&Z.observe(q),()=>{window.removeEventListener("resize",R),Z.disconnect()}},[Le]);const rt=f.useCallback(R=>{Pt(q=>{const Z=q.filter(fe=>fe.id!==R);if(Z.length===0)return Nt(!1),cs(null),Se([]),Qe(null),xe([]),Lt(new Map),Z;if(gr.current===R){const fe=q.findIndex(wt=>wt.id===R),Oe=Z[Math.min(fe,Z.length-1)]??Z[0];cs(Oe.id)}return Z})},[]),Dt=f.useCallback(R=>{R.preventDefault();const q=R.currentTarget;q.setPointerCapture(R.pointerId);const Z=R.clientX,fe=xn,Oe=Js(),wt=document.body.style.cursor,Bn=document.body.style.userSelect;let cn=fe,Wt=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const dt=()=>{Wt=null,Bt(cn)},mt=Or=>{cn=Math.min(Oe,Math.max(S0,fe-(Or.clientX-Z))),Wt===null&&(Wt=window.requestAnimationFrame(dt))};let bs=()=>{};const ms=Or=>{$n.current=null,Wt!==null&&(window.cancelAnimationFrame(Wt),Wt=null),Or&&Bt(cn),q.hasPointerCapture(R.pointerId)&&q.releasePointerCapture(R.pointerId),document.body.style.cursor=wt,document.body.style.userSelect=Bn,window.removeEventListener("pointermove",mt),window.removeEventListener("pointerup",bs),window.removeEventListener("pointercancel",bs)};bs=()=>ms(!0),$n.current=()=>ms(!1),window.addEventListener("pointermove",mt),window.addEventListener("pointerup",bs),window.addEventListener("pointercancel",bs)},[xn,Js]);f.useEffect(()=>()=>{var R;return(R=$n.current)==null?void 0:R.call($n)},[]);const pn=Vxt(yn),Ut=f.useMemo(()=>A7(pn),[pn]),rn=Xxt(Ut),zn=!(je.catchingUp&&jt!==null),fs=r9(rn)&&zn?rn:null,tr=rn&&!r9(rn)&&zn?rn:null,Ci=f.useRef(rn);Ci.current=zn?rn:null;const mr=tr!==null||fs!==null,po=f.useRef(mr);po.current=mr||zn&&A7(yn)!==null;const go=f.useMemo(()=>pUe(Qn),[Qn]),xa=f.useRef(null),Ka=f.useMemo(()=>{const R=bUe(Qn),q=xa.current;if(q&&q.signature===R)return q.timeline;const Z=gUe(Qn);return xa.current={signature:R,timeline:Z},Z},[Qn]),Ya=f.useRef(null),xt=f.useMemo(()=>{const R=yUe(Qn),q=Ya.current;if(q&&q.signature===R)return q.details;const Z=SUe(Qn);return Ya.current={signature:R,details:Z},Z},[Qn]),En=Qxt(go.todos,R=>`${R.id}:${R.status}:${R.content}`),si=go.allCompleted,[ar,nr]=f.useState("hidden"),Ti=je.catchingUp||En.length===0||si?"hidden":"active";Ti!==ar&&nr(Ti);const Qo=Ti!=="hidden",Ds=$??Fvt,ui=Qo||Ds.length>0,va=f.useRef(null),As=f.useRef(null),[Ls,fc]=f.useState(null),Dc=f.useRef(new Set),Xa=f.useRef(null),[mc,Lc]=f.useState(0),[rh,Pc]=f.useState(0);f.useLayoutEffect(()=>{if(!ui){Lc(0),Pc(0);return}const R=Xa.current;if(!R){Lc(LH),Pc(0);return}const q=()=>{const fe=va.current,Oe=R.getBoundingClientRect(),wt=fe==null?void 0:fe.getBoundingClientRect(),Bn=Math.ceil(Oe.height),cn=wt?Math.max(0,wt.top-Oe.top):Bn+DH;Pc(Bn),Lc(Math.max(LH,Math.ceil(cn)))};if(q(),typeof ResizeObserver>"u")return;const Z=new ResizeObserver(q);return Z.observe(R),va.current&&Z.observe(va.current),()=>Z.disconnect()},[ui]);const Qa=f.useMemo(()=>({"--web-shell-bottom-panel-inset":`${mc}px`,"--web-shell-bottom-panel-height":`${rh}px`,"--web-shell-bottom-panel-gap":`${DH}px`}),[rh,mc]),Up=f.useMemo(()=>rwt(Qn),[Qn]),[V1,W1]=f.useState(0),Fu=Kxt(Up,je.status==="connected",V1),Vp=f.useMemo(()=>O?Fu.map(iwt):[],[Fu,O]),G1=f.useRef(null),K1=f.useRef(null),Fr=f.useRef(null),Gv=f.useRef(null),[Kv,Y1]=f.useState(!1),X1=f.useRef(null),Q1=f.useRef(!1),jl=f.useCallback((R="smooth")=>{requestAnimationFrame(()=>{var q;(q=K1.current)==null||q.scrollToBottom(R),requestAnimationFrame(()=>{var Z;(Z=K1.current)==null||Z.scrollToBottom(R)})})},[]),fC=f.useCallback(R=>{Fr.current=R,OH(Ce,R??RH),R&&Gv.current!==R&&(Gv.current=R,he==null||he(R))},[Ce,he]);f.useEffect(()=>{OH(Ce,Fr.current??RH)},[Ce]);const[pc,Ja]=f.useState(null),[Yv,Xv]=f.useState(!1),J1=f.useRef(!1),Wp=f.useRef(null);Wp.current=pc;const{followupState:Qv,onAcceptFollowup:mC,onDismissFollowup:Z1,clear:Jv}=jG({onAccept:R=>{var q;(q=Fr.current)==null||q.insertText(R)}}),Gp=f.useRef(""),Oc=f.useRef(null),[Zv,pC]=f.useState(""),[Kp,wa]=f.useState(!1),sr=R4(),qu=f.useRef(sr),Yp=f.useRef(Date.now()),eb=f.useRef(sr);eb.current==="idle"&&sr!=="idle"&&(Yp.current=Date.now()),eb.current=sr;const tb=f.useMemo(()=>{if(sr!=="idle"){for(let R=Ie.length-1;R>=0;R--){const q=Ie[R];if((q==null?void 0:q.role)==="user")return q.timestamp??Yp.current}return Yp.current}},[Ie,sr]),Hu=f.useRef(""),im=f.useRef(void 0),ih=f.useRef(null),oh=f.useRef(null),[Xp,om]=f.useState(!1),Qp=f.useRef(Xp);Qp.current=Xp;const Ml=je.status==="connected",Qi=Kd(),[ah,ew]=f.useState([]),[Jp,tw]=f.useState(!1),K=f.useRef(0),we=f.useCallback(async R=>{const q=++K.current;try{const Z=R&&ot.client?await ot.client.workspaceByCwd(R).workspaceSkills():await os.loadSkillsStatus();if(q!==K.current)return;ew(Lvt(Z)),tw(!0)}catch{return}},[ot.client,os]);f.useEffect(()=>{Ml&&we(je.workspaceCwd)},[Ml,je.workspaceCwd,we]);const[Te,Ue]=f.useState(null),vt=f.useRef(Te),[In,On]=f.useState("workspace"),[Jn,Zs]=f.useState(!1),ka=f.useRef(Jn),[am,lh]=f.useState([]),[di,gc]=f.useState(!1),[Jo,Ro]=f.useState(!1),[Gs,gC]=f.useState(!1),[zI,bC]=f.useState(!1),[FI,yC]=f.useState(!1),[qI,xC]=f.useState(!1),[HI,vC]=f.useState(!1),[UI,VI]=f.useState(!1),[wC,nw]=f.useState(void 0),[qr,yi]=f.useState("chat"),[Uu,kC]=f.useState([]),_C=f.useRef(Uu);_C.current=Uu;const[sw,SC]=f.useState(null),[gs,Vu]=f.useState(null),Oi=f.useCallback(()=>Vu(null),[]),WI=f.useCallback(R=>{Oi(),window.setTimeout(()=>{var q,Z;(q=Fr.current)==null||q.setText(`/${R} `),(Z=Fr.current)==null||Z.focus()},0)},[Oi]),_a=f.useCallback(R=>{yi("chat"),Vu(R)},[]),Goe=f.useCallback(async()=>{const R=await os.loadMcpStatus();SC({status:R,toolsByServer:{},resourcesByServer:{},showDescriptions:!1,showSchema:!1,showTips:!1})},[os]),CC=f.useCallback(()=>{Vu(null),yi("scheduledTasks")},[]),Zp=f.useCallback(()=>{Vu(null),yi("goals")},[]),GI=f.useCallback(()=>{gt.enabled&&(Vu(null),yi("chat"),ve(!0),Be(!0))},[gt.enabled]),lm=f.useCallback(R=>{Vu(null),kC(q=>{const Z=Array.from(new Set((R??[]).filter(Boolean))).slice(0,mf);return Z.length>0?Z:q.length>0?q:je.sessionId?[je.sessionId]:[]}),yi("split")},[je.sessionId]),TC=f.useMemo(()=>Array.from(new Set((G??[]).filter(Boolean))).slice(0,mf).join("\0"),[G]),Do=G!==void 0,Bc=f.useRef(I);Bc.current=I;const KI=f.useCallback(()=>{var q;if(!Do){lm();return}const R=Uu.length>0?Uu:je.sessionId?[je.sessionId]:[];(q=Bc.current)==null||q.call(Bc,R)},[je.sessionId,Do,lm,Uu]);f.useEffect(()=>{if(!Do)return;const R=TC?TC.split("\0"):[];kC(q=>Kvt(q,R)?q:R),R.length>0?(Vu(q=>q===null?q:null),yi(q=>q==="split"?q:"split")):yi(q=>q==="split"?"chat":q)},[Do,TC]);const Koe=f.useCallback(R=>{var q;Do||kC(R),(q=Bc.current)==null||q.call(Bc,R)},[Do]),rw=f.useCallback(()=>{var R;Do&&((R=Bc.current)==null||R.call(Bc,[]))},[Do]),Yoe=f.useCallback(()=>{rw(),Rat(),_a("sessions")},[rw,_a]);f.useEffect(()=>{const R=jat(window.location.search);if(R.length>0){const Z=new URL(window.location.href);Z.searchParams.delete("split"),window.history.replaceState(null,"",Z),Do||lm(R);return}if(Do)return;const q=Iat();q.length>0&&lm(q)},[Do,lm]),f.useEffect(()=>{Do||qr==="split"&&Uu.length>0&&Mat(Uu)},[qr,Uu,Do]);const EC=f.useRef(!1),AC=f.useRef(!1);f.useEffect(()=>{if(_e){AC.current&&(AC.current=!1,!Do&&_C.current.length>0&&yi(R=>R==="chat"?"split":R));return}if(gs==="sessions"&&Vu(null),qr==="split"&&(rw(),yi("chat"),EC.current=!0,!Do)){AC.current=!0;const R=_C.current[0];R&&!Ss.current&&De.loadSession(R).catch(()=>{})}},[_e,gs,qr,rw,Do,De]),f.useEffect(()=>{var R;qr!=="chat"||!EC.current||(EC.current=!1,!gs&&!mr&&((R=Fr.current)==null||R.focus()))},[qr,gs,mr]);const YI=f.useRef(null),XI=f.useRef(null),QI=f.useRef(null),JI=f.useRef(gs),ZI=f.useRef(mr);f.useEffect(()=>{var Z,fe,Oe,wt,Bn;const R=JI.current,q=ZI.current;if(JI.current=gs,ZI.current=mr,gs){if(gs==="extensions"){(Z=XI.current)==null||Z.focus();return}if(gs==="plugins"){(fe=QI.current)==null||fe.focus();return}(Oe=YI.current)==null||Oe.focus()}else R?mr||(wt=Fr.current)==null||wt.focus():q&&!mr&&((Bn=Fr.current)==null||Bn.focus())},[gs,mr]),f.useEffect(()=>{mr&&(gs&&Vu(null),Te&&Ue(null),di&&gc(!1),(qr==="scheduledTasks"||qr==="goals")&&yi("chat"))},[mr,gs,Te,di,qr]);const Xoe=tr!==null&&!gs&&Te===null&&!di&&qr==="chat",Qoe=fs!==null&&!gs&&Te===null&&!di&&qr==="chat",[eR,tR]=f.useState(!1),[cm,NC]=f.useState(!1),nR=f.useRef(cm),[Joe,Zoe]=f.useState(0),[eae,tae]=f.useState(0),[nae,sR]=f.useState(0),sae=f.useCallback(()=>{let R=!1;return sR(q=>q+1),()=>{R||(R=!0,sR(q=>Math.max(0,q-1)))}},[]),rR=f.useRef((Qi==null?void 0:Qi.extensionsVersion)??0);f.useEffect(()=>{const R=(Qi==null?void 0:Qi.extensionsVersion)??0;if(R!==rR.current){rR.current=R;const q=Qi==null?void 0:Qi.lastExtensionChange;if((q==null?void 0:q.status)==="failed"){Pe.dispatch([{type:"error",text:ne("extensions.action.failed",{name:q.name??"",source:q.source??"",error:q.error??ne("error.unknown")})}]);return}if((q==null?void 0:q.status)==="installed"){const Z=q.name??q.source??ne("extensions.label");Pe.dispatch([{type:"status",text:q.version?ne("extensions.install.installedWithVersion",{name:Z,version:q.version}):ne("extensions.install.installed",{name:Z})}])}else if(q!=null&&q.status){const Z=q.name??q.source??ne("extensions.label"),fe=q.status==="updated"&&q.version?"extensions.manage.updatedWithVersion":`extensions.manage.${q.status}`;Pe.dispatch([{type:"status",text:ne(fe,{name:Z,version:q.version??""})}])}De.refreshCommands().catch(()=>{Pe.dispatch([{type:"error",text:ne("extensions.commands.refreshFailed")}])})}},[Qi==null?void 0:Qi.extensionsVersion,Qi==null?void 0:Qi.lastExtensionChange,De,Pe,ne]);const[rae,iae]=f.useState("workspace"),[nb,jC]=f.useState(null),[oae,iR]=f.useState(!1),[aae,oR]=f.useState(!1),iw=f.useRef(null),e0=f.useRef(null),[MC,ow]=f.useState(null),[um,IC]=f.useState(n??$r.Dark),[ch,aR]=f.useState(""),aw=f.useRef(ch);aw.current=ch;const t0=f.useCallback(R=>{aw.current=R,aR(R)},[]),$s=f.useRef(je);$s.current=je;const Ji=f.useCallback(()=>$s.current.sessionId?!0:(Vt("info",ne("localCommand.noSession")),!1),[Vt,ne]),lR=je.displayName,[Il,RC]=f.useState("default"),DC=f.useRef(Il);DC.current=Il;const sb=f.useCallback(R=>{DC.current=R,RC(R)},[]),[LC,dm]=f.useState(!1),rb=f.useRef(null),PC=f.useRef(null),cR=f.useRef(0),$c=f.useRef(null),uR=f.useRef(t);uR.current=t;const lw=f.useRef(void 0);f.useEffect(()=>{qr!=="goals"&&(lw.current=void 0)},[qr]);const dR=f.useCallback(()=>{const R=$s.current.sessionId;if(rb.current)return!R||R===PC.current?rb.current:Promise.resolve();if(R)return Promise.resolve();const q=(async()=>{var Bn;const fe=aw.current||$s.current.currentModel,Oe=DC.current||$s.current.currentMode,wt=(Bn=pt.find(cn=>cn.primary))==null?void 0:Bn.cwd;await ict({sessionActions:De,modelId:fe,modeId:Oe,workspaceCwd:me??Ht.current??wt,onSessionCreated:uR.current,onSessionAllocated:cn=>{PC.current=cn},getCurrentSessionId:()=>$s.current.sessionId}),St(void 0)})();rb.current=q;const Z=()=>{rb.current===q&&(rb.current=null,PC.current=null)};return q.then(Z,Z),q},[me,De,pt]),Wu=f.useRef(At);Wu.current=At;const[hR,fR]=f.useState(0),ib=f.useRef(null);f.useEffect(()=>()=>{ib.current!==null&&clearTimeout(ib.current)},[]);const mR=f.useCallback(R=>{it==null||it(R),fR(q=>q+1)},[it]),Lo=f.useRef(mR);Lo.current=mR;const Zo=f.useCallback(async(R,q,Z)=>{var ms,Or;const fe=!R.trimStart().startsWith("/"),Oe=Hu.current,wt=im.current,Bn=oh.current,cn=Qp.current;!(Z!=null&&Z.retry)&&fe&&(Hu.current=R,im.current=q,oh.current=null),om(!1);const Wt=!$s.current.sessionId;if(Wu.current){dm(!0);try{await Wu.current({sessionId:$s.current.sessionId,prompt:R})}catch(Kr){console.warn("[web-shell] onSubmitBefore rejected, prompt cancelled",Kr),dm(!1),Hu.current=Oe,im.current=wt,oh.current=Bn,om(cn);return}Wt||dm(!1)}!Wu.current&&Wt&&dm(!0),Jv();try{await dR()}finally{Wt&&dm(!1)}const dt={images:q,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&&((ms=Fr.current)==null||ms.clear());const mt=$s.current.sessionId;return mt&&R.trim()&&((Or=Lo.current)==null||Or.call(Lo,{type:"submit",sessionId:mt,prompt:R,queued:!1}),ib.current!==null&&clearTimeout(ib.current),ib.current=setTimeout(()=>{fR(Kr=>Kr+1)},2e3)),await De.sendPrompt(R,dt)},[Jv,dR,De]),lae=f.useMemo(()=>(je.models??[]).filter(hy).map(R=>({id:R.id,label:Yh(R.label||R.id)})),[je.models]),ob=Hn,zc=Jo||Gs||zI||FI||qI||HI||UI||wC!==void 0||Te!==null||di||MC!==null||sw!==null||nb!==null||eR||cm||nae>0||gs!==null||qr!=="chat",mn=f.useCallback((R,q)=>{if(d8(R)||VW(R)||C0(R))return;const Z=Xvt(R,q);console.error("[web-shell]",Z,R),Vt("error",Z)},[Vt]),cae=f.useCallback(R=>Vt("success",R),[Vt]),{queuedPrompts:uae,queuedTexts:dae,enqueuePrompt:OC,removeQueuedPrompt:hae,insertQueuedPrompt:fae,editQueuedPrompt:mae,editLastQueuedPrompt:pae,clearQueuedPrompts:gae}=Wie({connected:Ml,sessionId:je.sessionId,clientId:je.clientId,streamingState:sr,sessionActions:De,store:Pe,editorRef:Fr,reportError:mn,notifySuccess:cae,t:ne}),hm=f.useCallback((R,q,Z,fe,Oe)=>{var cn;if(Wu.current)return Wu.current({sessionId:$s.current.sessionId,prompt:R}).then(()=>{var mt,bs;OC(R,q,Z,Oe)!==!1&&(fe?fe():(mt=Fr.current)==null||mt.clear());const dt=$s.current.sessionId;dt&&R.trim()&&((bs=Lo.current)==null||bs.call(Lo,{type:"submit",sessionId:dt,prompt:R,queued:!0}))}).catch(Wt=>{console.warn("[web-shell] onSubmitBefore rejected queued prompt, cancelled",Wt)}),!1;const wt=OC(R,q,Z,Oe),Bn=$s.current.sessionId;return Bn&&R.trim()&&((cn=Lo.current)==null||cn.call(Lo,{type:"submit",sessionId:Bn,prompt:R,queued:!0})),wt},[OC]);f.useEffect(()=>{for(const R of sn)Qvt(R)?Vt(Jvt(R),R.message):R.category!=="lifecycle"&&console.warn("[web-shell] daemon notice",R),Dn(R.id)},[Dn,sn,Vt]);const BC=f.useRef(h);BC.current=h,f.useEffect(()=>{var R;Ss.current=je.sessionId,(R=ls.current)==null||R.abort(),ls.current=null,hs(null),ci(null),ow(null),mw.current=0},[je.sessionId]);const pR=f.useCallback(()=>{var Oe;if(!Ji())return;const R=`local-recap-${_s.current++}`,q=Qn.length,Z=(Oe=Qn.at(-1))==null?void 0:Oe.id,fe=je.sessionId;hs({anchorAfterId:Z,anchorIndex:q,message:{id:R,role:"system",content:`※ ${ne("recap.label")}: ${ne("recap.loading")}`,variant:"info",source:"recap"}}),De.recapSession().then(wt=>{Ss.current===fe&&hs({anchorAfterId:Z,anchorIndex:q,message:{id:R,role:"system",content:wt.recap?`※ ${ne("recap.label")}: ${wt.recap}`:ne("recap.empty"),variant:"info",source:"recap"}})},wt=>{Ss.current===fe&&(hs(null),!d8(wt)&&!C0(wt)&&console.warn("[web-shell] unhandled recap failure",wt))})},[je.sessionId,Qn,Ji,De,ne]),gR=f.useCallback(R=>{var wt;const q=R.trim();if(!q){Vt("error",ne("btw.empty"));return}if(!Ji())return;const Z=`local-btw-${Vs.current++}`,fe=je.sessionId;(wt=ls.current)==null||wt.abort();const Oe=new AbortController;ls.current=Oe,ci({id:Z,role:"btw",question:q,answer:"",isPending:!0}),De.btwSession(q,{signal:Oe.signal}).then(Bn=>{Ss.current===fe&&ls.current===Oe&&(ls.current=null,ci({id:Z,role:"btw",question:q,answer:Bn.answer||ne("btw.emptyAnswer"),isPending:!1}))},Bn=>{Ss.current===fe&&ls.current===Oe&&(ls.current=null,ci(null),!d8(Bn)&&!C0(Bn)&&console.warn("[web-shell] unhandled btw failure",Bn))})},[je.sessionId,Vt,Ji,De,ne]),bR=f.useCallback(()=>{var R;(R=ls.current)==null||R.abort(),ls.current=null,ci(null)},[]);f.useEffect(()=>{const R=q=>{var Bn;if(zc||rn)return;const Z=xr;if(!Z||Z.role!=="btw")return;const fe=q.key.toLowerCase(),Oe=q.key==="Escape"&&!q.ctrlKey&&!q.metaKey&&!q.altKey&&!q.shiftKey,wt=q.ctrlKey&&!q.metaKey&&!q.altKey&&!q.shiftKey&&(fe==="c"||fe==="d");if(Z.isPending){if(!Oe&&!wt)return}else{const cn=((Bn=Fr.current)==null?void 0:Bn.hasInput())??!1;if(!(!q.ctrlKey&&!q.metaKey&&!q.altKey&&!q.shiftKey&&(q.key==="Escape"||!cn&&(q.key==="Enter"||q.key===" "))))return}q.preventDefault(),q.stopPropagation(),bR()};return window.addEventListener("keydown",R,!0),()=>window.removeEventListener("keydown",R,!0)},[zc,xr,bR,rn]);const Gu=f.useCallback((R,q)=>tct(qu.current!=="idle",R,q,{append:Z=>Pe.appendLocalUserMessage(Z)}),[Pe]),Fc=f.useCallback(()=>(Vt("error",ne("queue.commandBlocked")),!1),[Vt,ne]),ab=f.useCallback(R=>{IC(R),s==null||s(R)},[s]),n0=f.useCallback(R=>{ke(R),i==null||i(R)},[i]),yR=f.useCallback(()=>{xC(!0)},[]),xR=NG({autoLoad:!0}),cw=lme({autoLoad:!0}),uw=cw.reload,[bae,dw]=f.useState(!1),{settings:uh,setValue:Rl,reload:dh}=xR,s0=uh.find(R=>R.key===qm),r0=uh.find(R=>R.key===Ovt),i0=uh.find(R=>R.key===z_),yae=(()=>{const R=o2(uh,In,"voiceModel");return typeof R=="string"&&R.trim()?R.trim():void 0})(),xae=(()=>{const R=o2(uh,In,"visionModel");if(!(typeof R!="string"||!R.trim()))return mvt(R.trim())})(),vae=(()=>{const R=o2(uh,In,"fastModel");return typeof R=="string"&&R.trim()?R.trim():void 0})(),wae=f.useMemo(()=>{const R=o2(uh,In,"modelFallbacks");return typeof R=="string"?R.split(",").map(q=>q.trim()).filter(Boolean):[]},[uh,In]),kae=f.useMemo(()=>{const R=new Set,q=[];for(const Z of(je.models??[]).filter(hy).filter(fe=>!fe.isRuntime)){const fe=Z.baseModelId??MH(Z.id);R.has(fe)||(R.add(fe),q.push({baseId:fe,label:Yh(Z.label||Z.baseModelId||Z.id)}))}return q},[je.models]),[hw,vR]=f.useState(!1),$C=f.useRef(hw);$C.current=hw,f.useEffect(()=>{if(n){IC(n);return}const R=BN(s0==null?void 0:s0.values.effective);R&&IC(R)},[n,s0==null?void 0:s0.values.effective]),f.useEffect(()=>{if(r!==void 0){ke(kd(r));return}const R=RN(i0==null?void 0:i0.values.effective);R&&ke(R)},[r,i0==null?void 0:i0.values.effective]);const _ae=f.useCallback((R,q="user")=>{const Z=Ke,Oe=`/language ui ${R}${q==="workspace"?" --project":" --global"}`;n0(R);const wt=()=>Promise.all([De.refreshCommands(),dh()]);if(qu.current!=="idle"){n0(Z),Fc();return}Zo(Oe,void 0).then(wt).catch(Bn=>{n0(Z),mn(Bn,"Failed to sync /language command")})},[Fc,n0,dh,mn,Zo,Ke,De]),wR=f.useCallback(()=>{if(qu.current!=="idle"){Pe.dispatch([{type:"status",text:ne("clear.blocked")}]);return}Pe.reset()},[Pe,ne]),kR=f.useCallback(()=>{const R=$C.current,q=!$C.current;vR(q),Rl("workspace",Pvt,q).catch(Z=>{vR(R),mn(Z,ne("compact.saveFailed"))})},[mn,Rl,ne]),hh=f.useCallback(R=>{if(!o4(R)){mn(new Error(`Unsupported approval mode: ${R}`),ne("local.approvalMode"));return}if(!$s.current.sessionId){sb(R);return}De.setApprovalMode(R).then(q=>{const Z=q.mode||R;RC(Z);const fe=Ci.current;if(!fe)return;if(R==="yolo"||R==="auto-edit"&&twt(fe)){const wt=fe.options.find(Bn=>Bn.kind==="allow_once");if(wt){const Bn=fe.title||"";Pe.dispatch([{type:"status",text:ne("mode.autoApproved",{tool:Bn})}]),De.submitPermission(fe.id,wt.id).catch(cn=>{mn(cn,"Failed to auto-approve tool call")})}}}).catch(q=>{mn(q,ne("local.approvalMode"))})},[De,mn,Pe,ne,sb]);f.useEffect(()=>{qu.current=sr},[sr]),f.useEffect(()=>{vt.current=Te,ka.current=Jn,nR.current=cm},[Te,Jn,cm]),f.useEffect(()=>{let R=null;for(let Z=yn.length-1;Z>=0;Z--){const fe=yn[Z];if((fe==null?void 0:fe.kind)==="user")break;if((fe==null?void 0:fe.kind)==="error"&&fe.source==="turn_error"){R=fe.id;break}if((fe==null?void 0:fe.kind)!=="debug")break}const q=Ml&&R!==null&&R!==oh.current&&Hu.current.length>0;ih.current=q?R:null,om(q)},[yn,Ml]),f.useEffect(()=>{u==null||u(sr)},[sr,u]);const _R=f.useRef(sr),SR=f.useRef(void 0);f.useEffect(()=>{var q;const R=_R.current;if(_R.current=sr,sr!=="idle"&&(SR.current=$s.current.sessionId),R!=="idle"&&sr==="idle"){const Z=$s.current.sessionId;if(!Z||Z!==SR.current)return;const fe=ih.current!=null?new Error(`Turn error (block ${ih.current})`):void 0;(q=Lo.current)==null||q.call(Lo,{type:"turn_complete",sessionId:Z,error:fe})}},[sr]),f.useEffect(()=>{c==null||c(je.status)},[je.status,c]),f.useEffect(()=>{ee==null||ee(yn)},[yn,ee]),f.useEffect(()=>{if(je.error){const R=new Error(je.error);d==null||d(R)}},[je.error,d]),f.useEffect(()=>{aR(je.currentModel??"")},[je.currentModel,je.sessionId]),f.useEffect(()=>{RC(je.currentMode??"default")},[je.currentMode,je.sessionId]),f.useEffect(()=>{const R=pe.current;if(je.sessionId&&je.sessionId!==R&&Ja(null),pe.current=je.sessionId,!je.sessionId&&je.missingSession){Xs.current=je.sessionId,Cr.current=void 0,Lr.current=void 0;return}const q=pt.find(fe=>fe.cwd===je.workspaceCwd);if(je.sessionId&&!ot.capabilities)return;const Z=q&&!q.primary?q.id:void 0;Xs.current===je.sessionId&&Cr.current===Z&&Lr.current===je.workspaceCwd||(Xs.current=je.sessionId,Cr.current=Z,Lr.current=je.workspaceCwd,e==null||e(je.sessionId,Z,je.workspaceCwd))},[je.missingSession,je.sessionId,je.workspaceCwd,e,ot.capabilities,pt]);const CR=f.useRef(void 0),zC=f.useRef(void 0);f.useEffect(()=>{var Z;const R=je.sessionId,q=je.displayName;if(!(!R||!q)){if(R!==CR.current){CR.current=R,zC.current=q;return}q!==zC.current&&(zC.current=q,(Z=Lo.current)==null||Z.call(Lo,{type:"rename",sessionId:R,newName:q}))}},[je.sessionId,je.displayName]),f.useEffect(()=>{const R=zvt(yn);Ja(q=>R?(q==null?void 0:q.condition)===R.condition&&q.setAt===R.setAt?q:R:q&&null)},[yn]),f.useEffect(()=>{const R=q=>{const Z=q.detail;if(!(Z!=null&&Z.active)){Ja(null);return}Z.condition&&Ja({condition:Z.condition,setAt:Z.setAt??Date.now()})};return window.addEventListener($A,R),()=>window.removeEventListener($A,R)},[]);const fw=f.useRef(null),mw=f.useRef(0);f.useEffect(()=>{mw.current=0},[je.sessionId]),f.useEffect(()=>{function Z(){if(document.hidden){fw.current===null&&(fw.current=Date.now());return}const fe=fw.current;if(fw.current=null,fe===null||Date.now()-fe<18e4||qu.current!=="idle"||!je.sessionId)return;const Oe=Pe.getSnapshot().blocks.length;Oe-mw.current<4||(mw.current=Oe,De.recapSession().then(wt=>{wt.recap&&Pe.dispatch([{type:"status",text:`※ ${ne("recap.label")}: ${wt.recap}`,source:"recap"}])},wt=>{console.error("[auto-recap] failed:",wt)}))}return document.addEventListener("visibilitychange",Z),()=>document.removeEventListener("visibilitychange",Z)},[je.sessionId,De,Pe,ne]);const FC=f.useCallback(()=>{const R=o4(Il)?Ub.indexOf(Il):-1,q=Ub[(R+1)%Ub.length];hh(q)},[Il,hh]),lb=f.useCallback((R,q)=>{Ji()&&(Gu(R)||De.getContextUsage({detail:q}).then(Z=>{Pe.dispatch([{type:"status",text:l$e(Z)}]),jl("smooth")}).catch(Z=>{mn(Z,"Failed to load context usage")}))},[Gu,Pe,Ji,De,mn,jl]),Sae=f.useCallback(()=>{lb("/context detail",!0)},[lb]),pw=f.useCallback(R=>{Ji()&&De.branchSession(R||void 0).then(q=>{Pe.dispatch([{type:"status",text:ne("branch.success",{name:q.displayName})}])}).catch(q=>{mn(q,ne("branch.failed"))})},[mn,Ji,De,Pe,ne]),Cae=f.useCallback(()=>{pw()},[pw]),cb=f.useRef(0),gw=f.useCallback(R=>{const q=++cb.current;return window.setTimeout(()=>{var Z;q!==cb.current||po.current||R!==void 0&&$s.current.sessionId!==R||(Z=Fr.current)==null||Z.focus()},0),q},[]),Dl=f.useCallback(async(R,q)=>{const Z=me??R;Ht.current=Z,St(Z),Me(),Oi(),q!=null&&q.keepView||yi("chat");let fe;try{const Oe=De.clearSession();return fe=gw(),await Promise.all([Oe,we(Z)]),!0}catch(Oe){return cb.current===fe&&(cb.current+=1),mn(Oe,"Failed to start a new chat"),!1}},[Me,Oi,me,mn,we,gw,De]);f.useEffect(()=>()=>{Oc.current&&clearTimeout(Oc.current)},[]);const Tae=f.useCallback(R=>{Gp.current=R,Oc.current&&clearTimeout(Oc.current),Oc.current=setTimeout(()=>{pC(R),Oc.current=null},120)},[]),{suggestion:ub,dismiss:TR,suppress:ER}=Mvt({enabled:((VR=je.capabilities)==null?void 0:VR.features.includes("session_generation"))===!0,inputText:Zv,messages:Qn,sessionId:je.sessionId,contextUsageRatio:(je.contextWindow??0)>0?(je.tokenCount??0)/(je.contextWindow??0):0,isRunning:sr!=="idle",dialogOpen:zc||mr,generateContent:De.generateSessionContent}),bw=f.useCallback(R=>{const q=$c.current;if(!q||R!==void 0&&q.token!==R)return;const Z=$s.current.sessionId;if(q.sourceSessionId!==void 0&&Z!==void 0&&Z!==q.sourceSessionId){$c.current=null,wa(!1);return}q.sessionClearCompleted&&Z===void 0&&(q.submitScheduled||($c.current={...q,submitScheduled:!0},window.setTimeout(()=>{var Oe,wt;const fe=$c.current;if(!(!fe||fe.token!==q.token)){if($s.current.sessionId!==void 0){$c.current=null,wa(!1);return}$c.current=null,(Oe=Fr.current)==null||Oe.submit(),(wt=Fr.current)==null||wt.focus(),wa(!1)}},0)))},[]);f.useEffect(()=>{bw()},[je.sessionId,bw]);const Eae=f.useCallback(()=>{const R=Gp.current.trim();if(!R||Kp)return;if((ub==null?void 0:ub.classifiedInput)!==R){TR();return}ER(),wa(!0);const q=cR.current+1;cR.current=q,$c.current={token:q,sourceSessionId:$s.current.sessionId,sessionClearCompleted:!1,submitScheduled:!1},Dl().then(Z=>{const fe=$c.current;if(!Z||(fe==null?void 0:fe.token)!==q){(fe==null?void 0:fe.token)===q&&($c.current=null),wa(!1);return}$c.current={...fe,sessionClearCompleted:!0},e==null||e(void 0),bw(q)})},[Dl,TR,bw,Kp,ub,e,ER]),AR=f.useMemo(()=>({openSplitView:()=>{Me(),KI()},openSessionOverview:()=>{Me(),_a("sessions")},openSessionDrawer:GI,createNewSession:()=>Dl()}),[Me,Dl,_a,GI,KI]);f.useEffect(()=>{BH(M,AR)},[AR,M]),f.useEffect(()=>()=>{BH(M,null)},[M]);const Aae=f.useCallback(async()=>{if(!J1.current){J1.current=!0,Xv(!0);try{await Dl()&&(e==null||e(void 0))}finally{J1.current=!1,Xv(!1)}}},[Dl,e]),fm=f.useCallback(async(R,q)=>{cb.current+=1,jn(R),Me(),Oi();try{await De.loadSession(R,{workspaceCwd:q})}catch(Z){throw jn(fe=>fe===R?null:fe),Z}},[Me,Oi,De]),qC=f.useCallback(R=>{yi("chat"),fm(R).catch(q=>{mn(q,"Failed to open session")})},[fm,mn]);f.useEffect(()=>{const R=q=>{const Z=q.detail;typeof Z=="string"&&Z&&qC(Z)};return window.addEventListener("qwen:open-session",R),()=>window.removeEventListener("qwen:open-session",R)},[qC]),f.useEffect(()=>{jt!==null&&je.sessionId===jt&&!je.loadingTranscript&&!je.catchingUp&&(jn(null),gw(jt))},[je.catchingUp,je.loadingTranscript,je.sessionId,gw,jt]);const mm=f.useRef(null),HC=f.useCallback(R=>{const q=mm.current;q&&q.sessionId===R&&(clearTimeout(q.timer),mm.current=null)},[]),yw=f.useCallback(R=>new Promise((q,Z)=>{let fe=!1;Zo(R,void 0,{onAdmitted:()=>{fe||(fe=!0,q())}}).then(()=>{fe||Z(new Error("Run was cancelled before it started"))},wt=>{fe||Z(wt)})}),[Zo]),xw=f.useCallback(()=>{const R=mm.current,q=$s.current;!R||q.sessionId!==R.sessionId||q.loadingTranscript||q.catchingUp||(clearTimeout(R.timer),mm.current=null,yw(R.prompt).then(()=>R.resolve(),Z=>R.reject(Z)))},[yw]),Nae=f.useCallback((R,q)=>{if(yi("chat"),!q)return yw(R);const Z=mm.current;return Z&&(clearTimeout(Z.timer),mm.current=null,Z.reject(new Error("superseded by another run"))),new Promise((fe,Oe)=>{const wt=setTimeout(()=>{HC(q),Oe(new Error("Timed out switching to the task session"))},Dvt);mm.current={sessionId:q,prompt:R,resolve:fe,reject:Oe,timer:wt},fm(q).then(()=>xw()).catch(Bn=>{HC(q),Oe(Bn)})})},[yw,fm,HC,xw]);f.useEffect(()=>{xw()},[je.sessionId,je.loadingTranscript,je.catchingUp,xw]);const UC=f.useCallback(()=>{Ji()&&De.getTasks().then(R=>{ow({snapshot:R})}).catch(R=>{mn(R,"Failed to load tasks")})},[mn,Ji,De]),NR=f.useCallback((R,q)=>{Ja({condition:R,setAt:q}),Pe.dispatch([{type:"status",text:PF({kind:"set",condition:R,setAt:q})}])},[Pe]),jR=f.useCallback(R=>{R&&(Pe.dispatch([{type:"status",text:PF({kind:"cleared",condition:R.condition,durationMs:Date.now()-R.setAt})}]),Ja(null))},[Pe]),vw=f.useCallback(R=>Ji()?(Pe.appendLocalUserMessage(R),De.clearGoal().catch(q=>{mn(q,"Failed to clear /goal")}),!0):!1,[mn,Ji,De,Pe]),jae=f.useCallback(()=>De.getRewindSnapshots(),[De]),Mae=f.useCallback(R=>De.rewindSession(R,{rewindFiles:!1}).then(()=>{}),[De]),Iae=f.useCallback(R=>{if(C0(R))return;const q=R instanceof Error?R.message:String(R);Vt("error",ne("rewind.failed",{reason:q}))},[Vt,ne]),MR=f.useCallback((R,q,Z)=>{const fe=o9(R),Oe=(Z==null?void 0:Z.sendToDaemon)??!0,wt=()=>{const Bn=!!Wu.current,cn=!$s.current.sessionId||Bn;return Zo(R,q,{clearComposerOnPromptStart:cn,commitComposerAccepted:Bn?Z==null?void 0:Z.commitComposerAccepted:void 0}).catch(Wt=>{mn(Wt,"Failed to send /goal command")}),!cn};return fe&&LI(fe)?Oe?vw(R):(Pe.appendLocalUserMessage(R),jR(Wp.current),!0):fe?Oe?wt():(Pe.appendLocalUserMessage(R),NR(fe,Date.now()),!0):(Zp(),!0)},[jR,NR,vw,Zp,mn,Zo,Pe,$s]),db=f.useMemo(()=>new Set((m??[]).map(u8).filter(Boolean)),[m]),Rae=db.has("settings"),IR=f.useCallback((R,q,Z,fe)=>{var Bn;if($s.current.loadingTranscript)return Vt("warning",ne("editor.sessionLoading")),!1;if(Kie({connectionStatus:$s.current.status,hasSession:!!$s.current.sessionId,restartSseOnPrompt:!!Ee}))return Vt("warning",ne("editor.connectionDisconnected")),!1;const Oe=qu.current!=="idle",wt=(cn,Wt,dt,mt)=>{const bs=!!Wu.current,ms=!$s.current.sessionId||bs;return Zo(cn,Wt,{...mt,clearComposerOnPromptStart:ms,commitComposerAccepted:bs?Z:void 0}).catch(Or=>mn(Or,dt)),!ms};if(R.startsWith("/")){const cn=R.match(/^\/([\w-]+)/);if(cn){const Wt=cn[1];if(db.has(u8(Wt)))return Oe?hm(R,q,void 0,Z,fe==null?void 0:fe.inputAnnotations):wt(R,q,"Failed to send hidden slash command",{inputAnnotations:fe==null?void 0:fe.inputAnnotations});if(Wt==="help")return xC(!0),!0;if(Wt==="diff")return ob?(nw(ob),!0):(Vt("info",ne("localCommand.diffNoWorkspace")),!0);if(Wt==="tasks")return UC(),!0;if(Wt==="goal")return o9(R)?Oe?e0t(R)?vw(R):Fc():MR(R,q,{commitComposerAccepted:Z}):(Zp(),!0);if(Wt==="theme"){const dt=R.slice(cn[0].length).trim().toLowerCase();return dt==="dark"||dt==="light"?ab(dt):dt?Vt("error",ne("error.unsupportedTheme")):vC(!0),!0}if(Wt==="language"){const dt=R.slice(cn[0].length).trim(),[mt,bs]=dt.split(/\s+/);if(!dt)return Pe.dispatch([{type:"status",text:[ne("language.current",{language:DN(Ke)}),ne("language.usage"),ne("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;if((mt==null?void 0:mt.toLowerCase())==="ui"){if(!bs)return Pe.dispatch([{type:"status",text:[ne("language.set"),"",ne("language.usage"),"",ne("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;const ms=bs.toLowerCase();if(!["en","zh","zh-cn","zh_cn"].includes(ms))return Vt("error",ne("language.invalid")),!0;const Kr=kd(bs);if(n0(Kr),!Oe){const Za=!!Wu.current,qc=!$s.current.sessionId||Za;return Zo(`/language ui ${Kr}`,void 0,{clearComposerOnPromptStart:qc,commitComposerAccepted:Za?Z:void 0}).then(()=>De.refreshCommands()).catch(Pl=>{mn(Pl,"Failed to sync /language command")}),!qc}return!0}}if(Wt==="copy"){const dt=R.slice(cn[0].length).trim();return ovt(Rs.current,dt).then(mt=>{Pe.dispatch([{type:mt.status==="error"?"error":"status",text:owt(mt.message,ne)}])}).catch(mt=>{mn(mt,ne("copy.failedFallback"))}),!0}if(Wt==="delete")return gC(!0),!0;if(Wt==="release")return bC(!0),!0;if(Wt==="rewind")return Ji()?(yC(!0),!0):!1;if(Wt==="branch"){if(Oe)return Fc();const dt=R.slice(cn[0].length).trim();return pw(dt||void 0),!0}if(Wt==="fork"){if(Oe)return Fc();if(!Ji())return!1;const dt=R.slice(cn[0].length).trim();return dt?(De.forkSession(dt).then(mt=>{if(!mt.launched){Vt("warning",ne("fork.notStarted"));return}W1(bs=>bs+1),Vt("success",ne("fork.started",{name:mt.description}))}).catch(mt=>{const bs=mt instanceof Error?mt.message:String(mt);mn(mt,ne("fork.failed",{reason:bs}))}),!0):(Vt("error",ne("fork.empty")),!0)}if(Wt==="auth")return NC(!0),!0;if(Wt==="model"){const dt=R.slice(cn[0].length).trim();if(dt==="--fast")return Ue("fast"),!0;if(dt.startsWith("--fast "))return Oe?hm(R,q,void 0,Z,fe==null?void 0:fe.inputAnnotations):wt(R,q,"Failed to send /model --fast",{inputAnnotations:fe==null?void 0:fe.inputAnnotations});if(dt==="--voice")return Gu(R,q)||os.loadProviders().then(mt=>{lh(iq(mt)),Ue("voice")}).catch(mt=>mn(mt,ne("model.setVoice"))),!0;if(dt.startsWith("--voice ")){const mt=dt.replace(/^--voice\s+/,"");return Rl("workspace","voiceModel",mt).catch(bs=>mn(bs,ne("model.setVoice"))),!0}if(dt==="--vision")return Ue("vision"),!0;if(dt.startsWith("--vision ")){const mt=dt.replace(/^--vision\s+/,"");return Rl("workspace","visionModel",mt).catch(bs=>mn(bs,ne("model.setVision"))),!0}if(dt){if(!$s.current.sessionId)return t0(dt),!0;De.setModel(dt).then(()=>{t0(dt)}).catch(mt=>{mn(mt,ne("model.switch"))})}else Ue("main");return!0}if(Wt==="plan"){if(Oe)return Fc();const dt=R.slice(cn[0].length).trim();return $s.current.sessionId?(dt&&dm(!0),De.setApprovalMode("plan").then(()=>{if(sb("plan"),dt)return Zo(dt,q,{clearComposerOnPromptStart:!0,inputAnnotations:fe==null?void 0:fe.inputAnnotations}).catch(mt=>mn(mt,"Failed to send plan prompt"))}).catch(mt=>{mn(mt,ne("mode.plan"))}).finally(()=>{dt&&dm(!1)}),!dt):(sb("plan"),dt?wt(dt,q,"Failed to send plan prompt",{inputAnnotations:fe==null?void 0:fe.inputAnnotations}):!0)}if(Wt==="approval-mode"){const dt=R.slice(cn[0].length).trim();return dt?hh(dt):gc(!0),!0}if(Wt==="mcp"){const dt=R.slice(cn[0].length).trim().toLowerCase();return os.loadMcpStatus().then(mt=>{SC({status:mt,toolsByServer:{},resourcesByServer:{},showDescriptions:dt==="desc",showSchema:dt==="schema",showTips:!dt}),_a("mcp")}).catch(mt=>{mn(mt,"Failed to load MCP status")}),!0}if(Wt==="skills"){const dt=R.slice(cn[0].length).trim();if(!dt||dt==="detail"||dt==="details")_a("skills");else return Oe?hm(R,q,void 0,Z,fe==null?void 0:fe.inputAnnotations):wt(R,q,"Failed to send /skills command",{inputAnnotations:fe==null?void 0:fe.inputAnnotations});return!0}if(Wt==="tools"){const dt=R.slice(cn[0].length).trim().toLowerCase();if(dt==="desc"||dt==="descriptions")VI(!0);else{if(Gu(R,q))return!0;os.loadToolsStatus().then(mt=>{const bs=(mt==null?void 0:mt.tools)??[];if(bs.length===0)Pe.dispatch([{type:"status",text:ne("tools.none")}]);else{const ms=bs.map(Or=>`- ${Or.displayName||Or.name}`).join(`
`);Pe.dispatch([{type:"status",text:`${ne("tools.available")}

${ms}`}])}jl("smooth")}).catch(mt=>{mn(mt,"Failed to load tools")})}return!0}if(Wt==="settings")return _a("settings"),!0;if(Wt==="schedule")return CC(),!0;if(Wt==="context"){const dt=R.slice(cn[0].length).trim().toLowerCase();if(dt===""||dt==="detail"||dt==="-d")return lb(R,dt==="detail"||dt==="-d"),!0}if(Wt==="memory"){const dt=R.slice(cn[0].length).trim().toLowerCase();if(dt==="refresh")Zoe(mt=>mt+1);else if(dt==="add"||dt.startsWith("add ")){const mt=dt.slice(3).trim();iae(mt==="user"||mt==="global"?"global":"workspace"),tae(bs=>bs+1)}return tR(!0),!0}if(Wt==="agents"){const dt=R.slice(cn[0].length).trim().toLowerCase();let mt="menu";return dt==="create"?mt="create":dt==="create user"||dt==="create global"?mt="create-user":dt==="create project"||dt==="create workspace"?mt="create-project":dt==="manage"&&(mt="manage"),jC(mt),!0}if(Wt==="extensions"){const dt=R.slice(cn[0].length).trim(),mt=(Bn=dt.split(/\s+/)[0])==null?void 0:Bn.toLowerCase();if(!mt||mt==="manage")return _a("extensions"),!0;if(mt==="install"){if(Oe)return Fc();const bs=dt.slice(7).trim().split(/\s+/);let ms="",Or,Kr,Za,qc,Pl=null;for(let Ol=0;Ol<bs.length;Ol++){const ea=bs[Ol];if(ea)if(ea==="--auto-update")Za=!0;else if(ea==="--pre-release"||ea==="--allow-pre-release")qc=!0;else if(ea==="--ref"||ea==="--registry"){const pm=bs[Ol+1];if(!pm||pm.startsWith("--")){Pl=ne("extensions.install.missingOptionValue",{option:ea});break}ea==="--ref"?Or=pm:Kr=pm,Ol+=1}else if(ea.startsWith("--")){Pl=ne("extensions.install.unknownOption",{option:ea});break}else if(!ms)ms=ea;else{Pl=ne("extensions.install.usage");break}}if(Pl)return Pe.appendLocalUserMessage(R),Pe.dispatch([{type:"error",text:Pl}]),!0;if(!ms)return Pe.appendLocalUserMessage(R),Pe.dispatch([{type:"error",text:ne("extensions.install.usage")}]),!0;const Hc=$s.current.clientId;return Hc?(Pe.appendLocalUserMessage(R),Pe.dispatch([{type:"status",text:ne("extensions.install.started",{source:ms})}]),os.installExtension({source:ms,...Or?{ref:Or}:{},...Kr?{registry:Kr}:{},...Za!==void 0?{autoUpdate:Za}:{},...qc!==void 0?{allowPreRelease:qc}:{},consent:!0},Hc).then(()=>{}).catch(Ol=>{mn(Ol,ne("extensions.install.requestFailed"))}),!0):(Vt("warning",ne("extensions.install.waitForSession")),!0)}return Gu(R,q)||Pe.dispatch([{type:"error",text:ne("extensions.install.usage")}]),!0}if(Wt==="clear"||Wt==="new"||Wt==="reset")return Dl(),!0;if(Wt==="rename"){const dt=nwt(R.slice(cn[0].length));if(dt.type==="auto"||dt.type==="delegate")return Oe?hm(R,q,void 0,Z,fe==null?void 0:fe.inputAnnotations):wt(R,q,"Failed to send /rename command",{inputAnnotations:fe==null?void 0:fe.inputAnnotations});const mt=dt.displayName;return mt?Ji()?(De.renameSession(mt).then(()=>{Pe.dispatch([{type:"status",text:ne("rename.success",{name:mt})}])}).catch(bs=>{mn(bs,"Failed to rename session")}),!0):!1:(Vt("error",ne("rename.empty")),!0)}if(Wt==="resume"){const dt=R.slice(cn[0].length).trim();return dt?(Me(),Oi(),De.loadSession(dt).catch(mt=>{mn(mt,"Failed to load session")})):(Me(),Ro(!0)),!0}if(Wt==="recap")return pR(),!0;if(Wt==="btw")return gR(R.slice(cn[0].length)),!0;if(Wt==="stats"){const dt=R.slice(cn[0].length).trim().toLowerCase();let mt="overview";return dt==="model"?mt="model":dt==="tools"&&(mt="tools"),Ji()?(Gu(R,q)||De.getStats().then(bs=>{Pe.dispatch([{type:"status",text:X$e(bs,mt)}]),jl("smooth")}).catch(()=>{}),!0):!1}if(Wt==="status"||Wt==="about")return Gu(R,q)||Promise.all([os.loadPreflight().catch(()=>null),os.loadProviders().catch(()=>null),os.loadEnv().catch(()=>null)]).then(([dt,mt,bs])=>{var pm,YR,XR,QR,JR,ZR;const ms=jH(dt,bs);let Or=ms.authSource;!Or&&((pm=mt==null?void 0:mt.current)!=null&&pm.authType)&&(Or=mt.current.authType);const Kr=[];ms.nodeVersion&&Kr.push(`Node.js v${ms.nodeVersion}`),ms.npmVersion&&Kr.push(`npm ${ms.npmVersion}`);let Za="";Or&&(Or.startsWith("oauth")||Or==="qwen-oauth"?Za="Qwen OAuth":Za=`API Key - ${Or}`);const qc=`${ms.platform} ${ms.arch}`.trim(),Pl=aw.current,Hc=$s.current,ea={cliVersion:((YR=Hc.capabilities)==null?void 0:YR.qwenCodeVersion)||"",runtime:Kr.join(" / "),platform:qc,auth:Za,baseUrl:((XR=mt==null?void 0:mt.current)==null?void 0:XR.baseUrl)||"",model:Pl||Hc.currentModel||((QR=mt==null?void 0:mt.current)==null?void 0:QR.modelId)||"",fastModel:((JR=mt==null?void 0:mt.current)==null?void 0:JR.fastModelId)||Pl||Hc.currentModel||((ZR=mt==null?void 0:mt.current)==null?void 0:ZR.modelId)||"",sessionId:Hc.sessionId||"",sandbox:ms.sandbox,proxy:ms.proxy,memoryUsage:ms.memoryUsage};Pe.dispatch([{type:"status",text:fze(ea)}]),jl("smooth")}),!0;if(Wt==="bug"){const dt=R.slice(cn[0].length).trim();return Gu(R,q)||Promise.all([os.loadPreflight().catch(()=>null),os.loadEnv().catch(()=>null)]).then(([mt,bs])=>{var Za;const ms=jH(mt,bs),Or=((Za=$s.current.capabilities)==null?void 0:Za.qwenCodeVersion)||"",Kr={};if(Or&&(Kr.cliVersion=Or),ms.nodeVersion&&(Kr.nodeVersion=ms.nodeVersion),ms.npmVersion&&(Kr.npmVersion=ms.npmVersion),ms.platform&&(Kr.platform=ms.platform),ms.arch&&(Kr.arch=ms.arch),ms.sandbox&&(Kr.sandbox=ms.sandbox),ms.memoryUsage&&(Kr.memoryUsage=ms.memoryUsage),BC.current)BC.current({title:dt,systemInfo:Kr}),Pe.dispatch([{type:"status",text:ne("bug.submitted")}]);else{const qc=Object.entries(Kr).filter(([,Ol])=>Ol).map(([Ol,ea])=>`${Ol}: ${ea}`).join(`
`),Pl=`https://github.com/QwenLM/qwen-code/issues/new?template=bug_report.yml&title=${encodeURIComponent(dt)}&info=${encodeURIComponent(`
`+qc+`
`)}`,Hc=window.open(Pl,"_blank");Hc?(Hc.opener=null,Pe.dispatch([{type:"status",text:ne("bug.submitted")}])):Vt("error",ne("bug.popupBlocked"))}}).catch(mt=>{mn(mt,ne("bug.failed"))}),!0}}return Oe?hm(R,q,void 0,Z,fe==null?void 0:fe.inputAnnotations):wt(R,q,"Failed to send command",{inputAnnotations:fe==null?void 0:fe.inputAnnotations})}else if(R.startsWith("!")){if(Oe)return Vt("error",ne("queue.shellBlocked")),!1;const cn=R.slice(1).trim();return!cn||!Ji()?!1:(De.sendShellCommand(cn).catch(Wt=>{mn(Wt,"Failed to execute shell command")}),!0)}else return Oe?hm(R,q,void 0,Z,fe==null?void 0:fe.inputAnnotations):wt(R,q,"Failed to send message",{inputAnnotations:fe==null?void 0:fe.inputAnnotations})},[Zo,De,Pe,hm,Gu,pw,Me,Oi,_a,CC,Zp,Dl,ob,vw,MR,ab,hh,n0,Fc,UC,db,Vt,mn,pR,gR,Ji,Ee,jl,Ke,t0,sb,Rl,lb,ne,os]),Dae=f.useCallback((R,q,Z,fe)=>{const Oe=IR(R,q,Z,fe);return Oe!==!1&&jl("smooth"),Oe},[IR,jl]),RR=f.useCallback((R,q,Z)=>{De.submitPermission(R,q,Z).catch(fe=>{mn(fe,"Failed to submit permission choice")})},[De,mn]),VC=f.useCallback(()=>{De.cancel().catch(R=>{mn(R,"Failed to cancel request")})},[De,mn]),Lae=f.useCallback(()=>{var R;return zc?!1:((R=G1.current)==null?void 0:R.focusTaskPill())??!1},[zc]),Pae=f.useCallback(R=>{var q,Z;if(R){(q=Fr.current)==null||q.insertText(R);return}(Z=Fr.current)==null||Z.focus()},[]),Oae=f.useCallback(R=>{Y1(R)},[]),WC=f.useCallback(()=>{Qp.current&&Ml&&qu.current==="idle"&&ih.current&&Hu.current?(oh.current=ih.current,om(!1),Zo(Hu.current,im.current,{optimisticUserMessage:!1,retry:!0}).catch(R=>mn(R,"Failed to retry prompt"))):Pe.dispatch([{type:"status",text:ne("retry.none")}])},[Ml,Zo,mn,Pe,ne]);f.useEffect(()=>{const R=q=>{if(!zc&&q.ctrlKey&&!q.metaKey&&!q.altKey&&!q.shiftKey){if(q.key==="l"){q.preventDefault(),wR();return}if(q.key==="o"){q.preventDefault(),kR();return}if(q.key==="y"){q.preventDefault(),WC();return}}};return window.addEventListener("keydown",R,!0),()=>window.removeEventListener("keydown",R,!0)},[zc,wR,kR,WC,Pe,ne]);const fh=f.useCallback(()=>{iw.current=null,iR(!1),oR(!1),e0.current&&(clearTimeout(e0.current),e0.current=null)},[]),DR=f.useRef({streamingState:sr,pendingApproval:rn,interactionBlocked:zc,activePanel:gs,closePanel:Oi,handleCancel:VC,handleCycleMode:FC});DR.current={streamingState:sr,pendingApproval:rn,interactionBlocked:zc,activePanel:gs,closePanel:Oi,handleCancel:VC,handleCycleMode:FC};const Bae=sr!=="idle";f.useEffect(()=>{fh()},[Bae,fh]),f.useEffect(()=>{const Z=(Oe,wt)=>{iw.current=Oe,Oe==="cancel"?oR(!0):iR(!0),e0.current&&clearTimeout(e0.current),e0.current=setTimeout(fh,wt)},fe=Oe=>{var cn,Wt;if(Oe.defaultPrevented||Oe.isComposing)return;const wt=DR.current;if(Oe.key==="Escape"&&wt.activePanel){const dt=Oe.target;dt!=null&&dt.closest("[data-sidebar-shell]")||(Oe.preventDefault(),wt.closePanel());return}if(Oe.key!=="Escape"){iw.current!==null&&fh(),Oe.key==="Tab"&&Oe.shiftKey&&!wt.interactionBlocked&&(Oe.preventDefault(),wt.handleCycleMode());return}const Bn=hvt({blocked:!!wt.pendingApproval||wt.interactionBlocked,streaming:wt.streamingState!=="idle",hasInput:!!((cn=Fr.current)!=null&&cn.hasInput()),armed:iw.current});if(Bn.kind!=="ignore")switch(Oe.preventDefault(),Bn.kind){case"cancel":wt.handleCancel(),fh();break;case"clear":(Wt=Fr.current)==null||Wt.clear(),fh();break;case"arm":Z(Bn.action,Bn.action==="cancel"?2e3:500);break}};return window.addEventListener("keydown",fe),()=>{window.removeEventListener("keydown",fe),fh()}},[fh]);const LR=act({catchingUp:!!je.catchingUp,pendingApproval:rn!==null,isPreparingPrompt:LC}),PR={catchingUp:!!je.catchingUp,isPreparingPrompt:LC,isStreaming:sr!=="idle"},$ae=Gie(PR),ww=se==null?void 0:se[$ae],zae=ww!=null&&ww.trim()?ww:ne(lct(PR)),hb=f.useCallback(R=>{if(!$s.current.sessionId){t0(R);return}dw(!0),De.setModel(R).then(q=>{const Z=Zvt(q);t0((Z==null?void 0:Z.modelId)??R),Z&&Pe.dispatch({type:"debug",text:ewt(Z,ne),source:"model_switch_summary",data:Z})}).catch(q=>{mn(q,ne("model.switch"))}).finally(()=>dw(!1))},[De,Pe,mn,ne,t0]),Fae=f.useCallback(R=>{dw(!0),os.deleteModel(R).then(q=>{q!=null&&q.requiresRestart&&Pe.dispatch([{type:"status",text:ne("settings.requiresRestart")}]),uw().catch(Z=>{console.warn("[web-shell] failed to reload providers after delete",Z)}),dh().catch(Z=>{console.warn("[web-shell] failed to reload settings after delete",Z)})}).catch(q=>{mn(q,ne("settings.models.deleteFailed"))}).finally(()=>dw(!1))},[os,uw,dh,mn,Pe,ne]),OR=f.useCallback(()=>{NC(!1),uw().catch(R=>{console.warn("[web-shell] failed to reload providers after auth dialog close",R)})},[uw]),qae=f.useCallback(R=>{Zs(!1),Rl(In,"modelFallbacks",R.join(",")).then(q=>{q!=null&&q.requiresRestart&&Pe.dispatch([{type:"status",text:ne("settings.requiresRestart")}]),dh().catch(Z=>{console.warn("[web-shell] failed to reload settings after fallbacks save",Z)})}).catch(q=>mn(q,ne("settings.models.fallbacks.saveFailed")))},[In,Rl,dh,mn,Pe,ne]),Hae=f.useCallback(R=>{if(sr!=="idle"){Fc();return}Oi(),Zo(`/model --fast ${R}${In==="user"?" --global":" --project"}`).then(()=>{dh().catch(Z=>{console.warn("[web-shell] failed to reload workspace settings after fast-model switch",Z)})}).catch(Z=>{mn(Z,"Failed to switch fast model")})},[Fc,Oi,Zo,sr,mn,dh,In]),Uae=f.useCallback(R=>{const q=MH(R);Rl(In,"voiceModel",q).catch(Z=>mn(Z,ne("model.setVoice")))},[In,mn,Rl,ne]),Vae=f.useCallback(R=>{const q=fvt(R);Rl(In,"visionModel",q).catch(Z=>mn(Z,ne("model.setVision")))},[In,mn,Rl,ne]),Wae={main:hb,fast:Hae,voice:Uae,vision:Vae};f.useEffect(()=>{!Te&&!Jn&&!cm&&On("workspace")},[Te,Jn,cm]);const BR=f.useMemo(()=>{const R=new Set((je.skills??[]).map(fe=>fe.toLowerCase())),q=Jp?(je.commands??[]).filter(fe=>fe.source!=="skill"&&!R.has(fe.name.toLowerCase())):je.commands??[],Z=Jp?ah.map(fe=>({name:fe.name,description:fe.description,...fe.argumentHint?{argumentHint:fe.argumentHint}:{},source:"skill",displayCategory:"skill"})):[];return Qie(Jie(q,Z,Yie(ne)),ne).filter(fe=>!db.has(u8(fe.name))).map(fe=>{const Oe=Xie(fe.name);return Oe?{...fe,displayCategory:"skill",description:ne(Oe)}:fe})},[je.commands,je.skills,db,ah,Jp,ne]),fb=f.useMemo(()=>{var R;return{version:((R=je.capabilities)==null?void 0:R.qwenCodeVersion)||"",cwd:je.workspaceCwd||"",currentModel:ch,currentMode:Il,hideTips:(r0==null?void 0:r0.values.effective)===!0}},[(WR=je.capabilities)==null?void 0:WR.qwenCodeVersion,je.workspaceCwd,ch,Il,r0==null?void 0:r0.values.effective]),Gae=f.useMemo(()=>y?y(fb):l.jsx(Net,{...fb}),[y,fb]),kw=f.useMemo(()=>w==null?void 0:w(fb),[w,fb]),Ll=!je.sessionId&&Ie.length===0&&!Qo&&!rn&&!xr,$R=Ll&&k,mb=$R&&!!kw,Kae=Ll&&mb,GC=Ll&&$R,zR=je.status!=="connecting"&&!je.sessionId&&je.missingSession===!0&&!gs&&qr==="chat",KC=Ll?n_():et,Yae=Hoe(z),FR=[Mt.app,Mt.appChat,Ll?Mt.appChatEmpty:void 0,gt.enabled?Mt.appWithSidebar:void 0,um===$r.Light?Mt.themeLight:Mt.themeDark,um===$r.Dark?"dark":void 0,o].filter(Boolean).join(" "),qR=f.useMemo(()=>({...a,...Gvt(KC,z)}),[z,KC,a]),HR=f.useCallback(R=>{qe(R),Wvt(R)},[]);return f.useLayoutEffect(()=>{const R=va.current;if(!R)return;const q=X1.current,Z=Q1.current,fe=R.getBoundingClientRect();if(Z&&!Ll&&q){const Oe=q.top-fe.top;Math.abs(Oe)>1&&(R.style.transition="width 320ms ease",R.style.transform=`translateY(${Oe}px)`,requestAnimationFrame(()=>{R.style.transition="width 320ms ease, transform 280ms ease",R.style.transform=""}),window.setTimeout(()=>{R.style.transition=""},320))}X1.current=fe,Q1.current=Ll},[Ll]),f.useLayoutEffect(()=>{const R=document.createElement("div");return R.dataset.webShellPortalRoot="",R.dataset.webShellShadcn="",document.body.appendChild(R),fc(R),()=>{R.remove(),fc(null)}},[]),f.useLayoutEffect(()=>{const R=As.current;if(!R||!Ls)return;let q=null;const Z=()=>{q=null;const Bn=getComputedStyle(R),cn=new Set;Ls.dataset.webShellShadcn="",Ls.classList.toggle("dark",um===$r.Dark),Ls.lang=Ke;for(let Wt=0;Wt<Bn.length;Wt+=1){const dt=Bn[Wt];dt.startsWith("--")&&(cn.add(dt),Ls.style.setProperty(dt,Bn.getPropertyValue(dt)))}for(const Wt of Dc.current)cn.has(Wt)||Ls.style.removeProperty(Wt);Dc.current=cn},fe=()=>{q===null&&(q=requestAnimationFrame(Z))};Z();const Oe=new MutationObserver(fe);let wt=R;for(;wt;)Oe.observe(wt,{attributes:!0,attributeFilter:["class","style","data-theme","lang"]}),wt=wt.parentElement;return window.addEventListener("resize",fe),()=>{Oe.disconnect(),window.removeEventListener("resize",fe),q!==null&&cancelAnimationFrame(q)}},[FR,qR,Ls,Ke,um]),l.jsx(G0e,{value:um,children:l.jsx(A0e,{language:Ke,children:l.jsx(HG.Provider,{value:Ls,children:l.jsxs("div",{ref:As,className:FR,style:qR,"data-web-shell-root":!0,"data-web-shell-shadcn":!0,lang:Ke,children:[!oe&&l.jsx(tet,{toasts:fr,onDismiss:rs}),Jo&&l.jsx(Qr,{title:ne("resume.title"),size:"lg",onClose:()=>Ro(!1),children:l.jsx(Yet,{workspaceCwd:me,onSelect:R=>{Me(),Oi(),De.loadSession(R).catch(q=>{mn(q,"Failed to load session")})},onClose:()=>Ro(!1)})}),Te&&l.jsx(Qr,{title:ne(Bvt[Te]),size:"lg",onClose:()=>Ue(null),children:l.jsx(gtt,{mode:Te,models:Te==="voice"?am:void 0,currentModelId:Te==="voice"?yae:Te==="vision"?xae:Te==="fast"?vae:void 0,onSelect:R=>{Te&&Wae[Te](R),Ue(null)}})}),di&&l.jsx(Qr,{title:ne("mode.select"),size:"sm",onClose:()=>gc(!1),children:l.jsx(Ket,{currentMode:Il,onSelect:R=>{hh(R),gc(!1)}})}),UI&&l.jsx(Qr,{title:ne("tools.title"),size:"lg",onClose:()=>VI(!1),children:l.jsx(Bst,{})}),wC&&l.jsx(prt,{workspaceCwd:wC,onClose:()=>nw(void 0)}),MC&&l.jsx(Qr,{title:ne("tasks.title"),size:"lg",onClose:()=>ow(null),children:l.jsx(Ore,{message:MC,embedded:!0,manageActiveEvent:!1,onClose:()=>ow(null)})}),nb&&l.jsx(Qr,{title:ne(nb==="manage"?"agent.manage":nb==="menu"?"agents.title":"agent.create"),size:"lg",onClose:()=>jC(null),children:l.jsx(Hnt,{mode:nb,embedded:!0,onMessage:R=>Pe.dispatch([{type:"status",text:R}]),onClose:()=>jC(null)})}),eR&&l.jsx(Qr,{title:ne("memory.menu"),size:"lg",onClose:()=>tR(!1),children:l.jsx(cst,{refreshSignal:Joe,addSignal:eae,addScope:rae,onMessage:(R,q="status")=>{Pe.dispatch([{type:q,text:R}])}})}),qI&&l.jsx(Qr,{title:ne("help.title"),size:"md",onClose:()=>xC(!1),children:l.jsx(l1t,{commands:BR})}),HI&&l.jsx(Qr,{title:ne("theme.title"),size:"sm",onClose:()=>vC(!1),children:l.jsx(c1t,{currentTheme:um,onSelect:ab,onClose:()=>vC(!1)})}),cm&&l.jsx(Qr,{title:ne("auth.title"),size:"lg",onClose:OR,children:l.jsx(Pst,{onMessage:(R,q="status")=>{Pe.dispatch([q==="error"?{type:"error",text:R}:{type:"status",text:R}])},onClose:OR})}),Jn&&l.jsx(Qr,{title:ne("settings.models.fallbacks.title"),size:"md",onClose:()=>Zs(!1),children:l.jsx(jtt,{models:kae,current:wae,max:3,onConfirm:qae,onClose:()=>Zs(!1)})}),Gs&&l.jsx(Qr,{title:ne("delete.title"),size:"lg",onClose:()=>gC(!1),children:l.jsx(u1t,{workspaceCwd:me,onDeleted:R=>{Pe.dispatch([{type:"status",text:R.length===1?`${ne("delete.deleted")} (${R[0].slice(0,8)})`:ne("delete.deletedCount",{count:R.length})}])},onError:R=>{if(C0(R))return;const q=R instanceof Error?R.message:String(R);Vt("error",ne("delete.failed",{reason:q}))},onClose:()=>gC(!1)})}),zI&&l.jsx(Qr,{title:ne("release.title"),size:"lg",onClose:()=>bC(!1),children:l.jsx(d1t,{workspaceCwd:me,onReleased:R=>{Pe.dispatch([{type:"status",text:`${ne("release.released")} (${R.slice(0,8)})`}])},onError:R=>{if(C0(R))return;const q=R instanceof Error?R.message:String(R);Vt("error",ne("release.failed",{reason:q}))},onClose:()=>bC(!1)})}),FI&&l.jsx(Qr,{title:ne("rewind.title"),subtitle:ne("rewind.subtitle"),size:"lg",onClose:()=>yC(!1),children:l.jsx(A1t,{blocks:yn,loadSnapshots:jae,rewind:Mae,onError:Iae,onClose:()=>yC(!1)})}),l.jsxs("div",{className:Mt.appShell,children:[gt.enabled&&l.jsxs("div",{"data-sidebar-shell":"",...kn?{role:"dialog","aria-modal":"true"}:{},"aria-label":ne("sidebar.label"),className:[Mt.mobileDrawer,kn?Mt.mobileDrawerOpen:void 0,ht?Mt.mobileDrawerForced:void 0].filter(Boolean).join(" "),children:[l.jsx("div",{className:Mt.mobileBackdrop,onClick:Me,"aria-hidden":"true"}),l.jsx(Hxt,{collapsed:(We||qr==="split"&&!Xe)&&!kn,onCollapsedChange:ue,onOpenSettings:()=>{Me(),_a("settings")},onOpenPlugins:()=>{Me(),_a("plugins")},onOpenDaemonStatus:()=>{Me(),_a("status")},onOpenScheduledTasks:()=>{Me(),CC()},onOpenGoals:()=>{Me(),Zp()},onOpenSessions:()=>{Me(),_a("sessions")},canOpenSessionsOverview:_e,onOpenSplitView:()=>{Me(),lm()},canOpenSplitView:_e,theme:um,onThemeChange:R=>{ab(R),Rl("workspace",qm,GG(R))},onNewSession:R=>Dl(R),onLoadSession:(R,q)=>(yi("chat"),fm(R,q)),onSelectCurrentSession:()=>{Me(),yi("chat"),Oi()},onError:mn,mobileOpen:kn,sessionListReloadToken:hR,selectedWorkspaceCwd:st,onSelectWorkspace:St,onOpenGitDiff:nw,workspaces:pt,lockedWorkspaceCwd:me,lockedWorkspace:gt.lockedWorkspace,branding:gt.branding,footer:gt.footer})]}),l.jsxs("div",{ref:Ws,className:[Mt.chatPane,qr!=="chat"?Mt.chatPaneShowingPage:void 0,GC?Mt.chatPaneWithMobileComposerBottom:void 0].filter(Boolean).join(" "),children:[gt.enabled&&gt.showCompactToggle&&!gs&&qr==="chat"&&l.jsx("button",{type:"button",className:[Mt.hamburgerButton,Ll?Mt.hamburgerButtonFloating:void 0].filter(Boolean).join(" "),onClick:()=>{ve(!1),Be(R=>!R)},"aria-label":ne("sidebar.toggleMenu"),"aria-expanded":kn,children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),l.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),l.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),gs&&l.jsxs("section",{className:Mt.panelHost,role:"region","data-testid":"inline-panel","aria-label":ne(gs==="settings"?"settings.title":gs==="status"?"daemon.title":gs==="extensions"?"extensions.manage.title":gs==="mcp"?"mcp.title":gs==="skills"?"skills.title":gs==="plugins"?"plugins.title":"sessionsOverview.title"),children:[gs!=="extensions"&&gs!=="mcp"&&gs!=="skills"&&gs!=="plugins"&&l.jsxs("div",{className:Mt.panelHeader,children:[l.jsx("button",{ref:YI,type:"button",className:Mt.panelBack,"data-testid":"panel-back",onClick:Oi,"aria-label":ne("common.back"),title:ne("common.back"),children:l.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{d:"M15 5l-7 7 7 7",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),l.jsx("div",{className:Mt.panelTitle,children:ne(gs==="settings"?"settings.title":gs==="status"?"daemon.title":"sessionsOverview.title")})]}),l.jsx("div",{className:Mt.panelBody,children:gs==="settings"?l.jsx(jgt,{settingsState:xR,embedded:!0,onLanguageChange:_ae,onThemeChange:ab,chatWidthMode:et,onChatWidthModeChange:HR,modelManagement:{providers:cw.providers,currentModelId:je.currentModel??void 0,loading:cw.loading,error:cw.error,busy:bae,onSelectModel:hb,onDeleteModel:Fae,onAddModel:()=>NC(!0)},onSubDialog:(R,q)=>{R==="fastModel"?(On(q),Ue("fast")):R==="visionModel"?(On(q),Ue("vision")):R==="voiceModel"?os.loadProviders().then(Z=>{lh(iq(Z)),vt.current===null&&!ka.current&&!nR.current&&(On(q),Ue("voice"))}).catch(Z=>mn(Z,ne("model.setVoice"))):R==="modelFallbacks"?(On(q),Zs(!0)):R==="tools.approvalMode"&&gc(!0)}}):gs==="status"?l.jsx(Aat,{}):gs==="extensions"?l.jsx(Soe,{onClose:Oi,initialFocusRef:XI}):gs==="mcp"&&sw?l.jsx(Toe,{message:sw,onClose:()=>{SC(null),Oi()}}):gs==="skills"?l.jsx(Iie,{onClose:Oi,onUseSkill:WI}):gs==="plugins"?l.jsx(Z0t,{mcpMessage:sw,loadMcpMessage:async()=>{try{await Goe()}catch(R){throw mn(R,"Failed to load MCP status"),R}},onClose:Oi,onUseSkill:WI,initialFocusRef:QI}):l.jsx(klt,{onOpenSession:qC,onOpenSplit:lm,includeOtherWorkspaces:!me,workspaceCwd:me})},gs)]}),qr==="scheduledTasks"&&l.jsxs("div",{className:Mt.fullPage,"data-testid":"scheduled-tasks-page",children:[l.jsxs("div",{className:Mt.fullPageHeader,children:[l.jsx("button",{type:"button",className:Mt.fullPageBack,onClick:()=>yi("chat"),"aria-label":ne("common.back"),title:ne("common.back"),children:l.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:l.jsx("path",{d:"M15 18l-6-6 6-6"})})}),l.jsx("div",{className:Mt.fullPageTitle,children:ne("scheduledTasks.title")})]}),l.jsx("div",{className:Mt.fullPageBody,children:l.jsx(Jpt,{onRunPrompt:Nae,workspaces:me?dn:pt,lockedWorkspace:bt,onCreateViaChat:()=>{Dl().then(R=>{R&&(e==null||e(void 0),window.setTimeout(()=>{var q,Z;(q=Fr.current)==null||q.insertText(ne("scheduledTasks.chatStarter"),{mode:"replace"}),(Z=Fr.current)==null||Z.focus()},0))})},onOpenSession:R=>{yi("chat"),fm(R).catch(q=>{mn(q,"Failed to open session")})},onError:mn})})]}),qr==="goals"&&l.jsxs("div",{className:Mt.fullPage,"data-testid":"goals-page",children:[l.jsxs("div",{className:Mt.fullPageHeader,children:[l.jsx("button",{type:"button",className:Mt.fullPageBack,onClick:()=>yi("chat"),"aria-label":ne("common.back"),title:ne("common.back"),children:l.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:l.jsx("path",{d:"M15 18l-6-6 6-6"})})}),l.jsx("div",{className:Mt.fullPageTitle,children:ne("goals.title")})]}),l.jsx("div",{className:Mt.fullPageBody,children:l.jsx(L0t,{onCreateGoal:async R=>{const q=lw.current;if(!(q!==void 0&&$s.current.sessionId===q)){if(!await Dl(void 0,{keepView:!0}))return!1;e==null||e(void 0)}try{await Zo(`/goal ${R}`,void 0,{clearComposerOnPromptStart:!0})}catch(fe){throw lw.current=$s.current.sessionId,fe}lw.current=void 0,yi("chat")},onOpenSession:R=>{yi("chat"),fm(R).catch(q=>{mn(q,"Failed to open session")})},onError:mn})})]}),qr==="split"&&l.jsxs("div",{className:Mt.fullPage,"data-testid":"split-view-page",children:[mr&&l.jsxs("div",{className:Mt.splitApprovalNotice,role:"status","data-testid":"split-approval-notice",children:[l.jsx("span",{children:ne("splitView.outerApprovalPending")}),l.jsx("button",{type:"button",onClick:()=>yi("chat"),children:ne("splitView.goToApproval")})]}),l.jsx(yP,{value:Fe,children:l.jsx(Ep.Provider,{value:hw,children:l.jsx(Iht,{sessionIds:Uu,onPanesChange:Koe,sessionListReloadToken:hR,includeOtherWorkspaces:!me,workspaceCwd:me,onExit:Yoe,onError:mn,onRightPanelOpen:Nl,onPaneArtifactsChange:Mn,messageTurnOutputs:V,restartSseOnPrompt:Ee})})})]}),l.jsxs("div",{className:[Mt.chatViewWrap,GC?Mt.chatViewWithMobileComposerBottom:void 0,Kae?Mt.chatViewWithWelcomeMiddle:void 0,gs||qr!=="chat"?Mt.chatViewHidden:void 0].filter(Boolean).join(" "),"aria-hidden":gs||qr!=="chat"?!0:void 0,children:[zR&&l.jsxs("div",{className:Mt.missingSessionState,children:[l.jsx("div",{className:Mt.missingSessionMessage,children:ne("session.missing")}),l.jsx("button",{type:"button",className:Mt.missingSessionButton,disabled:Yv,onClick:Aae,children:ne("session.new")})]}),l.jsx("div",{className:zR?Mt.chatSubtreeHidden:Mt.chatSubtree,children:l.jsxs(yP,{value:Fe,children:[l.jsx(Ep.Provider,{value:hw,children:l.jsx(Ivt,{timeline:Ka,details:xt,children:l.jsx(KX.Provider,{value:sae,children:(()=>{var fe;const R=[Mt.content,Qo||Ie.length>0||rn?Mt.contentHasMessages:void 0].filter(Boolean).join(" "),q=l.jsx(hie,{ref:K1,messages:Ie,pendingApproval:tr,onShowContextDetail:Sae,loadingTranscript:je.loadingTranscript,catchingUp:je.catchingUp,hasOlderHistory:Ne.hasMore,loadingOlderHistory:Ne.loading,historyCapacityReached:Ne.capacityReached,onLoadOlderHistory:Ne.loadMore,isResponding:sr!=="idle",activeTurnStartedAt:tb,workspaceCwd:je.workspaceCwd||"",hideSessionTimeline:KC==="wide",showRetryHint:Xp,onRetryClick:WC,onBranchSession:Cae,bottomOverlayInset:mc,welcomeHeader:Ll?Gae:void 0,centerWelcomeHeader:mb||void 0,tailContent:void 0,tailKey:void 0,onCanScrollToBottomChange:Oae,virtualScrollThreshold:W,turnFileChanges:hn.has("file")?Zn:void 0,turnArtifacts:hn.has("artifact")?Gn:void 0,turnScheduledTasks:hn.has("scheduled_task")?Vn:void 0,onTurnOutputOpen:Nl,onReviewChanges:Tr,onOpenArtifact:ni,onOpenScheduledTask:mo,generateContent:(fe=je.capabilities)!=null&&fe.features.includes("session_generation")?De.generateSessionContent:void 0}),Z=!mb&&(xr==null?void 0:xr.role)==="btw"?l.jsx("div",{className:Mt.btwPanel,children:l.jsx(Qre,{question:xr.question,answer:xr.answer,isPending:xr.isPending})}):null;return mb?l.jsxs("div",{className:Mt.mobileWelcomeGroup,children:[l.jsxs("div",{style:Qa,className:R,children:[q,Z]}),l.jsx("div",{className:Mt.mobileWelcomeFooterMiddle,children:kw})]}):l.jsxs("div",{style:Qa,className:R,children:[q,Z]})})()})})}),l.jsxs("div",{ref:va,style:Qa,className:kt?`${Mt.footer} ${Mt.footerWithCustomFooter}`:Mt.footer,children:[Kv&&l.jsx("div",{className:ui?`${Mt.scrollToBottomLayer} ${Mt.scrollToBottomLayerWithTodos}`:Mt.scrollToBottomLayer,children:l.jsx("button",{type:"button",className:Mt.scrollToBottomButton,"aria-label":ne("chat.scrollToBottom"),onClick:()=>jl("smooth"),children:l.jsx("svg",{className:Mt.scrollToBottomIcon,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{d:"M12 5v13M6.5 12.5 12 18l5.5-5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})})}),ui&&l.jsx("div",{ref:Xa,className:Mt.bottomPanels,children:l.jsx(_et,{todos:Qo?En:[],statusItems:Ds})}),tr&&qr==="chat"&&l.jsx("div",{"data-testid":"approval-overlay",className:Mt.approvalOverlay,children:l.jsx(eoe,{request:tr,onConfirm:RR,variant:"floating",keyboardActive:Xoe})}),fs&&qr==="chat"&&l.jsx("div",{"data-testid":"approval-overlay",className:Mt.approvalOverlay,children:l.jsx(toe,{request:fs,onConfirm:RR,variant:"floating",keyboardActive:Qoe})}),l.jsxs("div",{className:Mt.composer,children:[sr!=="idle"?l.jsx(yie,{startedAt:tb}):ub?l.jsxs("div",{className:Mt.composerActionTip,role:"status","data-testid":"new-session-suggestion",children:[l.jsx("span",{className:Mt.composerActionTipIcon,"aria-hidden":"true",children:"✦"}),l.jsx("span",{className:Mt.composerActionTipText,children:ne("editor.newSessionSuggestionTitle")}),l.jsx("div",{className:Mt.composerActionTipActions,children:l.jsx("button",{type:"button",className:`${Mt.composerActionTipButton} ${Mt.composerActionTipButtonPrimary}`,"data-testid":"new-session-suggestion-start",onMouseDown:R=>R.preventDefault(),onClick:Eae,children:ne("editor.newSessionSuggestionStart")})})]}):oae&&sr==="idle"?l.jsx("div",{className:Mt.escClearStatus,role:"status",children:ne("editor.escClearHint")}):null,l.jsx(Zie,{prompts:uae,t:ne,onDelete:hae,onInsert:fae,onEdit:mae}),bn&&l.jsx("div",{className:Mt.composerHeader,children:l.jsx(bn,{disabled:LR,isRunning:sr!=="idle",currentMode:Il,currentModel:ch,sessionName:lR})}),l.jsx(bie,{ref:fC,onSubmit:Dae,onInputTextChange:Tae,onCycleMode:FC,onToggleShortcuts:yR,onCancel:VC,isRunning:sr!=="idle",isPreparing:LC||Kp,cancelArmed:aae,disabled:LR||Kp,commands:BR,skills:ah,slashCommandCategoryOrder:p,builtinAtProviders:g,atProviders:b,composerTagIcons:v,queuedMessages:dae,onFocusFooter:Lae,onPopQueuedMessages:pae,onClearQueuedMessages:gae,currentMode:Il,currentModel:ch,gitBranch:je.sessionId?je.gitBranch:(Ot==null?void 0:Ot.branch)??void 0,gitStatus:Ot,onOpenGitDiff:ob?()=>nw(ob):void 0,chatWidthMode:et,showChatWidthToggle:!Ll,chatWidthToggleMin:Yae,visibleToolbarActions:re,availableModels:lae,onSelectMode:hh,onSelectModel:hb,workspaces:!me&&pt.length>1?pt.map(R=>({id:R.id,cwd:R.cwd,label:R.cwd.split(/[\\/]+/).filter(Boolean).at(-1)??R.cwd,primary:R.primary})):void 0,selectedWorkspaceCwd:je.sessionId?(GR=pt.find(R=>R.cwd===je.workspaceCwd))!=null&&GR.primary?void 0:je.workspaceCwd:st,workspaceSelectionDisabled:!!je.sessionId,atWorkspaceCwd:me??(je.sessionId?je.workspaceCwd:st??((KR=pt.find(R=>R.primary))==null?void 0:KR.cwd)),onSelectWorkspace:R=>{Ht.current=R,St(R)},onChatWidthModeChange:HR,sessionName:lR,dialogOpen:zc||mr,followupState:Qv,onAcceptFollowup:mC,onDismissFollowup:Z1,composerInput:ye,composerInputVersion:Ve,placeholderText:zae})]}),kt?GC?l.jsx("div",{className:Mt.customFooter,children:l.jsx(kt,{connected:Ml,mode:Il,model:ch,streamingState:sr,contextUsageRatio:(je.contextWindow??0)>0?(je.tokenCount??0)/(je.contextWindow??0):0,activeGoal:pc,tasks:Vp,availableModes:Ub,availableModels:(je.models??[]).filter(hy).map(R=>({id:R.id,label:Yh(R.label||R.id),contextWindow:R.contextWindow})),skills:ah,onSelectMode:hh,onSelectModel:hb})}):l.jsx(kt,{connected:Ml,mode:Il,model:ch,streamingState:sr,contextUsageRatio:(je.contextWindow??0)>0?(je.tokenCount??0)/(je.contextWindow??0):0,activeGoal:pc,tasks:Vp,availableModes:Ub,availableModels:(je.models??[]).filter(hy).map(R=>({id:R.id,label:Yh(R.label||R.id),contextWindow:R.contextWindow})),skills:ah,onSelectMode:hh,onSelectModel:hb}):l.jsx(LZe,{onSelectMode:()=>gc(R=>!R),onSelectModel:()=>Ue(R=>R?null:"main"),onShowContext:()=>lb("/context",!1),onOpenSettings:()=>_a("settings"),ref:G1,onOpenTasks:()=>UC(),onReturnToInput:Pae,tasks:Fu,activeGoal:pc,onOpenGoals:Zp,hideSettings:Rae,onToggleShortcuts:yR,compact:!0}),Ll&&kw&&l.jsx("div",{className:[Mt.emptyWelcomeFooter,mb?Mt.desktopWelcomeFooter:void 0].filter(Boolean).join(" "),children:kw})]})]})})]})]}),Le&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:Mt.artifactResizeHandle,role:"separator","aria-orientation":"vertical","aria-valuemin":S0,"aria-valuemax":Js(),"aria-valuenow":xn,onPointerDown:Dt}),l.jsx(dpt,{artifacts:Xn,tabs:ln,activeTabId:_n,reviewChanges:le,selectedReviewPath:He,panelWidth:xn,workspaceCwd:je.workspaceCwd||"",loading:Xt,error:Cn,onSelectTab:cs,onCloseTab:rt,onClose:Pr})]})]})]})})})})}function f8({title:e,description:t,actionLabel:n,onAction:s,theme:r,icon:i}){return l.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:l.jsxs(jd,{className:"border",children:[l.jsxs(Md,{children:[l.jsx(Id,{variant:"icon",children:i??l.jsx(cpe,{})}),l.jsx(Rd,{children:e}),l.jsx(Hv,{children:t})]}),l.jsx(krt,{children:l.jsx(qn,{onClick:s,children:n})})]})})}function lwt({sessionId:e,workspaceId:t,workspaceCwd:n,lockWorkspaceCwd:s,clientId:r,restartSseOnPrompt:i,webShellProps:o}){var C,_,B,A;const a=dc(),c=fo(),[u,d]=f.useState(!1),[h,m]=f.useState(),[p,g]=f.useState(),b=f.useRef(void 0);f.useEffect(()=>d(!1),[e,s,n,t]);const v=u?void 0:e,x=u?void 0:s??n,y=x?void 0:t,w=f.useMemo(()=>{var j,P,L;const N=(P=(j=a.capabilities)==null?void 0:j.workspaces)==null?void 0:P.find(O=>O.cwd===x);if(N)return N;if(x&&x===((L=a.capabilities)==null?void 0:L.workspaceCwd))return{id:"primary",cwd:x,primary:!0,trusted:!0}},[x,(C=a.capabilities)==null?void 0:C.workspaceCwd,(_=a.capabilities)==null?void 0:_.workspaces]),k=s&&(h==null?void 0:h.requestedCwd)===s?h.workspace:void 0,T=x?w??k:(A=(B=a.capabilities)==null?void 0:B.workspaces)==null?void 0:A.find(N=>N.id===y),S=f.useMemo(()=>LN(kd(o.language)),[o.language]);return f.useEffect(()=>{var j;if(!s||!a.capabilities||w||(h==null?void 0:h.requestedCwd)===s||p===s)return;((j=b.current)==null?void 0:j.cwd)!==s&&(b.current={cwd:s,promise:c.addWorkspace(s,{persist:!0}).then(P=>{if(P.persisted!==!0)throw new Error("Workspace registration was not persisted");return P})});let N=!1;return b.current.promise.then(async P=>{var L;if(!N){m({requestedCwd:s,workspace:P}),g(void 0);try{await((L=a.refreshCapabilities)==null?void 0:L.call(a))}catch{}}}).catch(()=>{N||g(s)}),()=>{N=!0}},[w,h,p,a,a.capabilities,a.refreshCapabilities,c,s]),(x||y)&&a.status==="error"?l.jsx(f8,{title:S("workspace.loadFailed"),description:S("workspace.loadFailedDescription"),actionLabel:S("common.retry"),theme:o.theme,icon:l.jsx(pP,{}),onAction:()=>{var N;(N=a.refreshCapabilities)==null||N.call(a).catch(()=>{})}}):(x||y)&&!a.capabilities?l.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 ${o.theme==="dark"?"dark":""}`,role:"status","aria-live":"polite",children:[l.jsx(No,{}),l.jsx("span",{children:S("common.loading")})]}):s&&p===s?l.jsx(f8,{title:S("workspace.loadFailed"),description:S("workspace.loadFailedDescription"),actionLabel:S("common.retry"),theme:o.theme,icon:l.jsx(pP,{}),onAction:()=>{b.current=void 0,g(void 0)}}):s&&!T?l.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 ${o.theme==="dark"?"dark":""}`,role:"status","aria-live":"polite",children:[l.jsx(No,{}),l.jsx("span",{children:S("common.loading")})]}):(x||y)&&!T?l.jsx(f8,{title:S("workspace.notFound"),description:S("workspace.notFoundDescription"),actionLabel:S("session.new"),theme:o.theme,onAction:()=>{var N;d(!0),(N=o.onSessionIdChange)==null||N.call(o,void 0,void 0)}}):l.jsx(SG,{sessionId:v,workspaceCwd:T==null?void 0:T.cwd,clientId:r,historyPageSize:vie,maxBlocks:wie,suppressOwnUserEcho:!0,restartEventStreamOnPrompt:i,children:l.jsx(awt,{...o,restartSseOnPrompt:i,lockedWorkspaceCwd:s?T==null?void 0:T.cwd:void 0,lockedWorkspaceCapability:s?T:void 0})},`${(T==null?void 0:T.id)??y??"primary"}:${v??"new"}`)}const cwt=Lat(),Uoe="qwen-code-web-shell-language",Voe="qwen-code-web-shell-theme";function Woe(e){if(e===$r.Dark||e===$r.Light)return e}function uwt(){const e=new URLSearchParams(window.location.search).get("theme");return Woe(e)}function dwt(){try{return Woe(window.localStorage.getItem(Voe))}catch{return}}function hwt(e){try{window.localStorage.setItem(Voe,e)}catch{}}function fwt(){return uwt()??dwt()??$r.Dark}function mwt(){try{const e=window.localStorage.getItem(Uoe);return e?kd(e):void 0}catch{return}}function pwt(e){try{window.localStorage.setItem(Uoe,e)}catch{}}function gwt(){const e=new URLSearchParams(window.location.search),t=e.get("language")??e.get("lang");return kd(t||(mwt()??navigator.language))}function bwt(){const e=window.location.pathname.match(/\/session\/([^/]+)/);if(e)try{return decodeURIComponent(e[1])}catch{return}}function ywt(){return new URLSearchParams(window.location.search).get("workspace")||void 0}function xwt(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 vwt({daemonToken:e}){const[t,n]=f.useState(()=>fwt()),[s,r]=f.useState(()=>gwt()),[i]=f.useState(()=>bwt()),[o]=f.useState(()=>ywt()),a=cwt||window.location.origin;f.useEffect(()=>{const h=document.documentElement;h.classList.remove("theme-dark","theme-light","dark"),h.classList.add(`theme-${t}`),h.classList.toggle("dark",t===$r.Dark);const m=document.querySelector('meta[name="theme-color"]');m&&m.setAttribute("content",t==="light"?"#ffffff":"#0d0d0d")},[t]);const c=f.useCallback(h=>{n(h),hwt(h)},[]),u=f.useCallback(h=>{r(h),pwt(h)},[]),d=f.useCallback((h,m)=>{xwt(h,m)},[]);return l.jsx(zd,{label:"web-shell-root",fallback:(h,m)=>l.jsx(yme,{error:h,onRetry:m,language:s}),children:l.jsx(kfe,{baseUrl:a,token:e,children:l.jsx(lwt,{sessionId:i,workspaceId:o,webShellProps:{theme:t,onThemeChange:c,language:s,onLanguageChange:u,onSessionIdChange:d,sidebar:!0,compactThinking:!0,markdownTableMode:"advanced"}})})})}async function wwt(){const e=$ie()??await Bat();$at(),Kue.createRoot(document.getElementById("root")).render(l.jsx(KH.StrictMode,{children:l.jsx(vwt,{daemonToken:e})}))}wwt();export{qp as C,Sn as D,It as E,an as F,Vd as G,nm as P,Ms as R,Io as S,er as T,ei as V,Al as W,ie as _,ss as a,qs as b,Ui as c,Rf as d,Au as e,Wwt as f,WMe as g,yIe as h,s_ as i,l4 as j,Nwt as k,Bf as l};
