codemini-cli 0.5.4 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/codemini-web/dist/assets/{highlighted-body-OFNGDK62-C0p6xCdM.js → highlighted-body-OFNGDK62-DC-rSI65.js} +1 -1
- package/codemini-web/dist/assets/{index-SZnRN7a3.css → index-DErltUwI.css} +1 -1
- package/codemini-web/dist/assets/{index-fbvf7RS1.js → index-cYRgZ3WI.js} +4 -4
- package/codemini-web/dist/assets/mermaid-GHXKKRXX-DdvTRIYD.js +1 -0
- package/codemini-web/dist/index.html +2 -2
- package/deployment.md +5 -5
- package/package.json +1 -1
- package/src/core/chat-runtime.js +53 -13
- package/src/core/fff-adapter.js +1 -1
- package/codemini-web/dist/assets/mermaid-GHXKKRXX-DgSNlEad.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/highlighted-body-OFNGDK62-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/highlighted-body-OFNGDK62-DC-rSI65.js","assets/rolldown-runtime-S-ySWqyJ.js","assets/angular-html-DlSp9HPG.js","assets/html-GfHBuoLs.js","assets/css-Dr0v2l-V.js","assets/javascript-Cx8CXBJR.js","assets/angular-ts-B29Ypg6B.js","assets/scss-YARKxu2i.js","assets/apl-BASZ7uB_.js","assets/json-CY14kIzN.js","assets/xml-DyJ3D9rW.js","assets/java-Ds1cyVrp.js","assets/astro-l-XABzN2.js","assets/postcss-DiNtjF5e.js","assets/tsx-5O-M05V0.js","assets/typescript-hRweav8r.js","assets/blade-B3_bxlV2.js","assets/html-derivative-ChSmSZXY.js","assets/sql-Q6zkgi_w.js","assets/bsl-D3u1l2dW.js","assets/sdbl-D4tJqBiC.js","assets/c-CgTSul4N.js","assets/cairo-CoQzhJ_o.js","assets/python-BhsI1K6K.js","assets/cobol-D_kesMA-.js","assets/coffee-DF15_0rk.js","assets/cpp-Cudwe5mG.js","assets/glsl-C4rvog10.js","assets/regexp-CK-1EP63.js","assets/crystal-DV9Nijjb.js","assets/shellscript-CxhArCCJ.js","assets/edge-BosfXYh1.js","assets/elixir-Dw_vsdUl.js","assets/elm-DPfFNNkG.js","assets/erb-DZuoCU5t.js","assets/ruby-CZgIYPlP.js","assets/graphql-Dg0Ewf8Q.js","assets/jsx-DmH5dwMF.js","assets/haml-DyIc_iO2.js","assets/lua-BeSXusec.js","assets/yaml-C-G727Y6.js","assets/erlang-CqHCISqs.js","assets/markdown-CbgVmtS5.js","assets/fortran-fixed-form-60ZQAHDk.js","assets/fortran-free-form-BVNtEstX.js","assets/fsharp-Ch5ZVinn.js","assets/gdresource-CqNLhJW1.js","assets/gdscript-D-FJCTl3.js","assets/gdshader-Czvzt8dR.js","assets/git-commit-CSWECvqq.js","assets/diff-RUsawely.js","assets/git-rebase-MUvuytPe.js","assets/glimmer-js-HDDEErW7.js","assets/glimmer-ts-Dq0_BflX.js","assets/hack-DjE76gIx.js","assets/handlebars-DQ4X08Zf.js","assets/http-DMTBhQm8.js","assets/hurl-XIpACwjS.js","assets/csv-CqpUSPyF.js","assets/hxml-PnV_FpS-.js","assets/haxe-1eAUKQ0B.js","assets/jinja-8ATGhxJO.js","assets/jison-CSsYnr7O.js","assets/julia-vjG00jwO.js","assets/r-BKej5r_k.js","assets/just-C7G3KFgN.js","assets/perl-DdF12AsD.js","assets/latex-D8-NgtPj.js","assets/tex-CxEkh6NI.js","assets/liquid-D2m0XXrV.js","assets/marko-DPnRthJQ.js","assets/less-BKjOc0Gl.js","assets/mdc-BLdFHYKv.js","assets/nextflow-c8YCPRRb.js","assets/nextflow-groovy-o7ZjyFmf.js","assets/nginx-u-hq5m-a.js","assets/nim-B5b6_jZr.js","assets/php-CyQZnE0l.js","assets/pug-HwoxZo9M.js","assets/qml-CysuucQ6.js","assets/razor-ZpEr_C9H.js","assets/csharp-Cqz84DXU.js","assets/rst-CjO4XFKz.js","assets/cmake-CdseusyP.js","assets/sas-DPGT0TjQ.js","assets/shaderlab-JWcsxey4.js","assets/hlsl-Df5oFh9i.js","assets/shellsession-DYmuifdt.js","assets/soy-7iHZG9Jz.js","assets/sparql-BGRSvFxd.js","assets/turtle-PTxTluYn.js","assets/stata-lXN9BRaz.js","assets/surrealql-l0SGzwOs.js","assets/svelte-BM89dRu0.js","assets/templ-D1GoDFsp.js","assets/go-D6k5URxL.js","assets/ts-tags-B88Nbzcl.js","assets/twig-B3Kws0Fb.js","assets/vue-CT36qSUr.js","assets/vue-html-bJyjqZnI.js","assets/vue-vine-BLqV15Pm.js","assets/stylus-oqceM0yt.js","assets/xsl-BOsdDgv_.js","assets/angular-html-CHsdtmkx.js","assets/html-B7kk5NVw.js","assets/css-z2ijrDWT.js","assets/javascript-WC6XFf_S.js","assets/angular-ts-JNDGGWj0.js","assets/scss-CaciJ0Gl.js","assets/apl-Byuv-g-O.js","assets/json-CmuSmrUv.js","assets/xml-BkdunjRC.js","assets/java-X0I2c5Az.js","assets/astro-CTzEugGW.js","assets/postcss-DrpvRGGG.js","assets/tsx-CfyUE2pW.js","assets/typescript-C6LvTgbf.js","assets/blade-Dt6km9YT.js","assets/html-derivative-Ba28nVB3.js","assets/sql-CZAMrWdL.js","assets/bsl-CPV9KqsG.js","assets/sdbl-DoQ_zDzo.js","assets/c-Bv0tI3pq.js","assets/cairo-CyiRuu7R.js","assets/python-DcnbpNOV.js","assets/cobol-DqhY5el-.js","assets/coffee-rY-gkJy7.js","assets/cpp-Bw-qV0P6.js","assets/glsl-C8VPaAWs.js","assets/regexp-da3KYCEG.js","assets/crystal-Bw1_1hFA.js","assets/shellscript-KUJZnuCi.js","assets/edge-r5NIe9Lp.js","assets/elixir-B04apOJS.js","assets/elm-Cezz_HNz.js","assets/erb-BNioEFKQ.js","assets/ruby-BOVYgV5O.js","assets/graphql-WZCiqIl-.js","assets/jsx-Bl4e1-KE.js","assets/haml-B8MRe8CS.js","assets/lua-BroxvhVt.js","assets/yaml-D_uvhEF7.js","assets/erlang-BC8wryba.js","assets/markdown-DMIvNSB1.js","assets/fortran-fixed-form-CyrImzNA.js","assets/fortran-free-form-CIAQqF5W.js","assets/fsharp-OCW_PZ4J.js","assets/gdresource-Cl3bohRI.js","assets/gdscript-B_XVILZe.js","assets/gdshader-BOrkFM_X.js","assets/git-commit-DJZpdBwB.js","assets/diff-D4HSRbRn.js","assets/git-rebase-BJE30GTP.js","assets/glimmer-js-Dn6vjgHP.js","assets/glimmer-ts-mq-Q_zEE.js","assets/hack-DeD259o6.js","assets/handlebars-GoJyzhp1.js","assets/http-Deln4Vyb.js","assets/hurl-CYSuhGkj.js","assets/csv-DUpZC5ZD.js","assets/hxml-BmF7ngDz.js","assets/haxe-Df79h8x1.js","assets/jinja-Dx5IcFSt.js","assets/jison-DuNOGix6.js","assets/julia-Cqc1ADyw.js","assets/r-B4lG5syH.js","assets/just-BlUYrdKb.js","assets/perl-BIcNvyL6.js","assets/latex-BEPTKliI.js","assets/tex-ezg8IclB.js","assets/liquid-BUh7yINm.js","assets/marko-Dm8xPXkG.js","assets/less-DgluPI4Z.js","assets/mdc-Dzipcsdb.js","assets/nextflow-BRiWOV-p.js","assets/nextflow-groovy-D6rYlJlL.js","assets/nginx-Da_Uewgc.js","assets/nim-CvgRYLO2.js","assets/php-BP-3TkW_.js","assets/pug-_XoIcKf3.js","assets/qml-DWxWu28U.js","assets/razor-DQ6FV4WL.js","assets/csharp-Ca2kU4Te.js","assets/rst-DDrWKQ9c.js","assets/cmake-CCC7tP43.js","assets/sas-DYNukvU9.js","assets/shaderlab-TbUUdmUb.js","assets/hlsl-CckLjo_3.js","assets/shellsession-BeWGuVoR.js","assets/soy-h0dQKbQs.js","assets/sparql-DIFvSn1n.js","assets/turtle-BsUuoeVK.js","assets/stata-C5mLa_ER.js","assets/surrealql-DyoUfV6n.js","assets/svelte-CijnRGul.js","assets/templ-CNjJl440.js","assets/go-iV8pwUYW.js","assets/ts-tags-DV6nguf9.js","assets/twig-BROkIZLg.js","assets/vue-BUQP_8VF.js","assets/vue-html-Bx2Sgp8M.js","assets/vue-vine-RK3AHrhp.js","assets/stylus-BO6mlOab.js","assets/xsl-C66i1pDH.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{n as e,r as t,t as n}from"./rolldown-runtime-S-ySWqyJ.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var r=n((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.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`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ee(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var k=/\/+/g;function A(e,t){return typeof e==`object`&&e&&e.key!=null?ee(``+e.key):t.toString(36)}function j(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(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 M(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,M(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+A(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(k,`$&/`)+`/`),M(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(k,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+A(a,u),c+=M(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+A(a,u++),c+=M(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return M(j(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function te(e,t,n){if(e==null)return e;var r=[],i=0;return M(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ne(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var N=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&&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)},P={map:te,forEach:function(e,t,n){te(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return te(e,function(){t++}),t},toArray:function(e){return te(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=P,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:ne}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,N)}catch(e){N(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.5`})),i=n(((e,t)=>{t.exports=r()})),a=n((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&A(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&A(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var ee=new MessageChannel,k=ee.port2;ee.port1.onmessage=D,O=function(){k.postMessage(null)}}else O=function(){_(D,0)};function A(t,n){C=_(function(){t(e.unstable_now())},n)}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(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,A(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),o=n(((e,t)=>{t.exports=a()})),s=n((e=>{var t=i();function n(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 r(){}var a={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return s(e,t,null,r)},e.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.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??a.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=l(t.as,t.crossOrigin);a.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 a.d.m(e)},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.5`})),c=n(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=s()})),l=n((e=>{var t=o(),n=i(),r=c();function a(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 s(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function l(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 u(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 d(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 f(e){if(l(e)!==e)throw Error(a(188))}function p(e){var t=e.alternate;if(!t){if(t=l(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return f(i),e;if(o===r)return f(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var s=!1,c=i.child;c;){if(c===n){s=!0,n=i,r=o;break}if(c===r){s=!0,r=i,n=o;break}c=c.sibling}if(!s){for(c=o.child;c;){if(c===n){s=!0,n=o,r=i;break}if(c===r){s=!0,r=o,n=i;break}c=c.sibling}if(!s)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),ee=Symbol.for(`react.activity`),k=Symbol.for(`react.memo_cache_sentinel`),A=Symbol.iterator;function j(e){return typeof e!=`object`||!e?null:(e=A&&e[A]||e[`@@iterator`],typeof e==`function`?e:null)}var M=Symbol.for(`react.client.reference`);function te(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===M?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case ee:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?te(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return te(e(t))}catch{}}return null}var ne=Array.isArray,N=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re={pending:!1,data:null,method:null,action:null},ie=[],ae=-1;function oe(e){return{current:e}}function F(e){0>ae||(e.current=ie[ae],ie[ae]=null,ae--)}function I(e,t){ae++,ie[ae]=e.current,e.current=t}var se=oe(null),ce=oe(null),le=oe(null),ue=oe(null);function de(e,t){switch(I(le,t),I(ce,e),I(se,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?$d(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=$d(t),e=ef(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}F(se),I(se,e)}function fe(){F(se),F(ce),F(le)}function pe(e){e.memoizedState!==null&&I(ue,e);var t=se.current,n=ef(t,e.type);t!==n&&(I(ce,e),I(se,n))}function me(e){ce.current===e&&(F(se),F(ce)),ue.current===e&&(F(ue),lp._currentValue=re)}var he,ge;function _e(e){if(he===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);he=t&&t[1]||``,ge=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+he+e+ge}var ve=!1;function ye(e,t){if(!e||ve)return``;ve=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
@@ -168,14 +168,14 @@ ${e}</tr>
|
|
|
168
168
|
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${EM(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=DM(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+EM(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=DM(e);if(i===null)return EM(n);e=i;let a=`<img src="${e}" alt="${EM(n)}"`;return t&&(a+=` title="${EM(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:EM(e.text)}},LM=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},RM=class e{options;renderer;textRenderer;constructor(e){this.options=e||pj,this.options.renderer=this.options.renderer||new IM,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new LM}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},zM=class{options;block;constructor(e){this.options=e||pj}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?FM.lex:FM.lexInline}provideParser(e=this.block){return e?RM.parse:RM.parseInline}},BM=new class{defaults=fj();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=RM;Renderer=IM;TextRenderer=LM;Lexer=FM;Tokenizer=PM;Hooks=zM;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new IM(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new PM(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new zM;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];zM.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&zM.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return FM.lex(e,t??this.defaults)}parser(e,t){return RM.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?FM.lex:FM.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?RM.parse:RM.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?FM.lex:FM.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?RM.parse:RM.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
169
169
|
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+EM(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function VM(e,t){return BM.parse(e,t)}VM.options=VM.setOptions=function(e){return BM.setOptions(e),VM.defaults=BM.defaults,mj(VM.defaults),VM},VM.getDefaults=fj,VM.defaults=pj,VM.use=function(...e){return BM.use(...e),VM.defaults=BM.defaults,mj(VM.defaults),VM},VM.walkTokens=function(e,t){return BM.walkTokens(e,t)},VM.parseInline=BM.parseInline,VM.Parser=RM,VM.parser=RM.parse,VM.Renderer=IM,VM.TextRenderer=LM,VM.Lexer=FM,VM.lexer=FM.lex,VM.Tokenizer=PM,VM.Hooks=zM,VM.parse=VM,VM.options,VM.setOptions,VM.use,VM.walkTokens,VM.parseInline,RM.parse,FM.lex;var HM=`modulepreload`,UM=function(e){return`/`+e},WM={},$=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=UM(t,n),t in WM)return;WM[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:HM,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},GM=300,KM=`300px`,qM=500;function JM(e={}){let{immediate:t=!1,debounceDelay:n=GM,rootMargin:r=KM,idleTimeout:i=qM}=e,[a,o]=(0,d.useState)(!1),s=(0,d.useRef)(null),c=(0,d.useRef)(null),l=(0,d.useRef)(null),u=(0,d.useMemo)(()=>e=>{let t=Date.now();return window.setTimeout(()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-t))})},1)},[]),f=(0,d.useMemo)(()=>typeof window<`u`&&window.requestIdleCallback?(e,t)=>window.requestIdleCallback(e,t):u,[u]),p=(0,d.useMemo)(()=>typeof window<`u`&&window.cancelIdleCallback?e=>window.cancelIdleCallback(e):e=>{clearTimeout(e)},[]);return(0,d.useEffect)(()=>{if(t){o(!0);return}let e=s.current;if(!e)return;c.current&&=(clearTimeout(c.current),null),l.current&&=(p(l.current),null);let a=()=>{c.current&&=(clearTimeout(c.current),null),l.current&&=(p(l.current),null)},u=e=>{l.current=f(t=>{t.timeRemaining()>0||t.didTimeout?(o(!0),e.disconnect()):l.current=f(()=>{o(!0),e.disconnect()},{timeout:i/2})},{timeout:i})},d=e=>{a(),c.current=window.setTimeout(()=>{var t;let n=e.takeRecords();(n.length===0||(t=n.at(-1)?.isIntersecting)!=null&&t)&&u(e)},n)},m=(e,t)=>{e.isIntersecting?d(t):a()},h=new IntersectionObserver(e=>{for(let t of e)m(t,h)},{rootMargin:r,threshold:0});return h.observe(e),()=>{c.current&&clearTimeout(c.current),l.current&&p(l.current),h.disconnect()}},[t,n,r,i,p,f]),{shouldRender:a,containerRef:s}}var YM=/\s/,XM=/^\s+$/,ZM=new Set([`code`,`pre`,`svg`,`math`,`annotation`]),QM=e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`element`,$M=e=>e.some(e=>QM(e)&&ZM.has(e.tagName)),eN=e=>{let t=[],n=``,r=!1;for(let i of e){let e=YM.test(i);e!==r&&n&&(t.push(n),n=``),n+=i,r=e}return n&&t.push(n),t},tN=e=>{let t=[],n=``;for(let r of e)YM.test(r)?n+=r:(n&&=(t.push(n),``),t.push(r));return n&&t.push(n),t},nN=(e,t,n,r,i,a)=>{let o=`--sd-animation:sd-${t};--sd-duration:${i?0:n}ms;--sd-easing:${r}`;return a&&(o+=`;--sd-delay:${a}ms`),{type:`element`,tagName:`span`,properties:{"data-sd-animate":!0,style:o},children:[{type:`text`,value:e}]}},rN=(e,t,n,r,i)=>{let a=t.at(-1);if(!(a&&`children`in a))return;if($M(t))return ym;let o=a,s=o.children.indexOf(e);if(s===-1)return;let c=e.value;if(!c.trim()){i.count+=c.length;return}let l=n.sep===`char`?tN(c):eN(c),u=r.prevContentLength,d=l.map(e=>{let t=i.count;if(i.count+=e.length,XM.test(e))return{type:`text`,value:e};let r=u>0&&t<u,a=r?0:i.newIndex++*n.stagger;return nN(e,n.animation,n.duration,n.easing,r,a)});return o.children.splice(s,1,...d),s+d.length},iN=0;function aN(e){let t={animation:e?.animation??`fadeIn`,duration:e?.duration??150,easing:e?.easing??`ease`,sep:e?.sep??`word`,stagger:e?.stagger??40},n={prevContentLength:0,lastRenderCharCount:0},r=iN++,i=()=>e=>{let r={count:0,newIndex:0};bm(e,`text`,(e,i)=>rN(e,i,t,n,r)),n.lastRenderCharCount=r.count,n.prevContentLength=0};return Object.defineProperty(i,`name`,{value:`rehypeAnimate$${r}`}),{name:`animate`,type:`animate`,rehypePlugin:i,setPrevContentLength(e){n.prevContentLength=e},getLastRenderCharCount(){let e=n.lastRenderCharCount;return n.lastRenderCharCount=0,e}}}aN();var oN=(0,d.createContext)(!1),sN=()=>(0,d.useContext)(oN),cN=(...e)=>fd(Hl(e)),lN=(e,t)=>{if(!e||!t)return t;let n=`${e}:`;return t.split(/\s+/).filter(Boolean).map(t=>t.startsWith(n)?t:`${e}:${t}`).join(` `)},uN=e=>e?(...t)=>lN(e,fd(Hl(t))):cN,dN=(e,t,n)=>{let r=typeof t==`string`&&n.startsWith(`text/csv`)?``:``,i=typeof t==`string`?new Blob([r+t],{type:n}):t,a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=e,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(a)},fN=(0,d.createContext)(cN),pN=()=>(0,d.useContext)(fN),mN=cN(`block`,`before:content-[counter(line)]`,`before:inline-block`,`before:[counter-increment:line]`,`before:w-6`,`before:mr-4`,`before:text-[13px]`,`before:text-right`,`before:text-muted-foreground/50`,`before:font-mono`,`before:select-none`),hN=e=>{let t={};for(let n of e.split(`;`)){let e=n.indexOf(`:`);if(e>0){let r=n.slice(0,e).trim(),i=n.slice(e+1).trim();r&&i&&(t[r]=i)}}return t},gN=(0,d.memo)(({children:e,result:t,language:n,className:r,startLine:i,lineNumbers:a=!0,...o})=>{let s=pN(),c=(0,d.useMemo)(()=>s(mN),[s]),l=(0,d.useMemo)(()=>{let e={};return t.bg&&(e[`--sdm-bg`]=t.bg),t.fg&&(e[`--sdm-fg`]=t.fg),t.rootStyle&&Object.assign(e,hN(t.rootStyle)),e},[t.bg,t.fg,t.rootStyle]);return(0,_.jsx)(`div`,{className:s(r,`overflow-x-auto rounded-md border border-border bg-background p-4 text-sm`),"data-language":n,"data-streamdown":`code-block-body`,...o,children:(0,_.jsx)(`pre`,{className:s(r,`bg-[var(--sdm-bg,inherit]`,`dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,inherit)]`),style:l,children:(0,_.jsx)(`code`,{className:a?s(`[counter-increment:line_0] [counter-reset:line]`):void 0,style:a&&i&&i>1?{counterReset:`line ${i-1}`}:void 0,children:t.tokens.map((e,t)=>(0,_.jsx)(`span`,{className:a?c:void 0,children:e.length===0||e.length===1&&e[0].content===``?`
|
|
170
170
|
`:e.map((e,t)=>{let n={},r=!!e.bgColor;if(e.color&&(n[`--sdm-c`]=e.color),e.bgColor&&(n[`--sdm-tbg`]=e.bgColor),e.htmlStyle)for(let[t,i]of Object.entries(e.htmlStyle))t===`color`?n[`--sdm-c`]=i:t===`background-color`?(n[`--sdm-tbg`]=i,r=!0):n[t]=i;return(0,_.jsx)(`span`,{className:s(`text-[var(--sdm-c,inherit)]`,`dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]`,r&&`bg-[var(--sdm-tbg)]`,r&&`dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]`),style:n,...e.htmlAttrs,children:e.content},t)})},t))})})})},(e,t)=>e.result===t.result&&e.language===t.language&&e.className===t.className&&e.startLine===t.startLine&&e.lineNumbers===t.lineNumbers),_N=({className:e,language:t,style:n,isIncomplete:r,...i})=>(0,_.jsx)(`div`,{className:pN()(`my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2`,e),"data-incomplete":r||void 0,"data-language":t,"data-streamdown":`code-block`,style:{contentVisibility:`auto`,containIntrinsicSize:`auto 200px`,...n},...i}),vN=(0,d.createContext)({code:``}),yN=()=>(0,d.useContext)(vN),bN=({language:e})=>{let t=pN();return(0,_.jsx)(`div`,{className:t(`flex h-8 items-center text-muted-foreground text-xs`),"data-language":e,"data-streamdown":`code-block-header`,children:(0,_.jsx)(`span`,{className:t(`ml-1 font-mono lowercase`),children:e})})},xN=e=>{let t=e.length;for(;t>0&&e[t-1]===`
|
|
171
|
-
`;)t--;return e.slice(0,t)},SN=(0,d.lazy)(()=>$(()=>import(`./highlighted-body-OFNGDK62-
|
|
171
|
+
`;)t--;return e.slice(0,t)},SN=(0,d.lazy)(()=>$(()=>import(`./highlighted-body-OFNGDK62-DC-rSI65.js`).then(e=>({default:e.HighlightedCodeBlockBody})),__vite__mapDeps([0,1]))),CN=({code:e,language:t,className:n,children:r,isIncomplete:i=!1,startLine:a,lineNumbers:o,...s})=>{let c=pN(),l=(0,d.useMemo)(()=>xN(e),[e]),u=(0,d.useMemo)(()=>({bg:`transparent`,fg:`inherit`,tokens:l.split(`
|
|
172
172
|
`).map(e=>[{content:e,color:`inherit`,bgColor:`transparent`,htmlStyle:{},offset:0}])}),[l]);return(0,_.jsx)(vN.Provider,{value:{code:e},children:(0,_.jsxs)(_N,{isIncomplete:i,language:t,children:[(0,_.jsx)(bN,{language:t}),r?(0,_.jsx)(`div`,{className:c(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,_.jsx)(`div`,{className:c(`pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur`),"data-streamdown":`code-block-actions`,children:r})}):null,(0,_.jsx)(d.Suspense,{fallback:(0,_.jsx)(gN,{className:n,language:t,lineNumbers:o,result:u,startLine:a,...s}),children:(0,_.jsx)(SN,{className:n,code:l,language:t,lineNumbers:o,raw:u,startLine:a,...s})})]})})},wN={CheckIcon:e=>(0,_.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,_.jsx)(`path`,{clipRule:`evenodd`,d:`M15.5607 3.99999L15.0303 4.53032L6.23744 13.3232C5.55403 14.0066 4.44599 14.0066 3.76257 13.3232L4.2929 12.7929L3.76257 13.3232L0.969676 10.5303L0.439346 9.99999L1.50001 8.93933L2.03034 9.46966L4.82323 12.2626C4.92086 12.3602 5.07915 12.3602 5.17678 12.2626L13.9697 3.46966L14.5 2.93933L15.5607 3.99999Z`,fill:`currentColor`,fillRule:`evenodd`})}),CopyIcon:e=>(0,_.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,_.jsx)(`path`,{clipRule:`evenodd`,d:`M2.75 0.5C1.7835 0.5 1 1.2835 1 2.25V9.75C1 10.7165 1.7835 11.5 2.75 11.5H3.75H4.5V10H3.75H2.75C2.61193 10 2.5 9.88807 2.5 9.75V2.25C2.5 2.11193 2.61193 2 2.75 2H8.25C8.38807 2 8.5 2.11193 8.5 2.25V3H10V2.25C10 1.2835 9.2165 0.5 8.25 0.5H2.75ZM7.75 4.5C6.7835 4.5 6 5.2835 6 6.25V13.75C6 14.7165 6.7835 15.5 7.75 15.5H13.25C14.2165 15.5 15 14.7165 15 13.75V6.25C15 5.2835 14.2165 4.5 13.25 4.5H7.75ZM7.5 6.25C7.5 6.11193 7.61193 6 7.75 6H13.25C13.3881 6 13.5 6.11193 13.5 6.25V13.75C13.5 13.8881 13.3881 14 13.25 14H7.75C7.61193 14 7.5 13.8881 7.5 13.75V6.25Z`,fill:`currentColor`,fillRule:`evenodd`})}),DownloadIcon:e=>(0,_.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,_.jsx)(`path`,{clipRule:`evenodd`,d:`M8.75 1V1.75V8.68934L10.7197 6.71967L11.25 6.18934L12.3107 7.25L11.7803 7.78033L8.70711 10.8536C8.31658 11.2441 7.68342 11.2441 7.29289 10.8536L4.21967 7.78033L3.68934 7.25L4.75 6.18934L5.28033 6.71967L7.25 8.68934V1.75V1H8.75ZM13.5 9.25V13.5H2.5V9.25V8.5H1V9.25V14C1 14.5523 1.44771 15 2 15H14C14.5523 15 15 14.5523 15 14V9.25V8.5H13.5V9.25Z`,fill:`currentColor`,fillRule:`evenodd`})}),ExternalLinkIcon:e=>(0,_.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,_.jsx)(`path`,{clipRule:`evenodd`,d:`M13.5 10.25V13.25C13.5 13.3881 13.3881 13.5 13.25 13.5H2.75C2.61193 13.5 2.5 13.3881 2.5 13.25L2.5 2.75C2.5 2.61193 2.61193 2.5 2.75 2.5H5.75H6.5V1H5.75H2.75C1.7835 1 1 1.7835 1 2.75V13.25C1 14.2165 1.7835 15 2.75 15H13.25C14.2165 15 15 14.2165 15 13.25V10.25V9.5H13.5V10.25ZM9 1H9.75H14.2495C14.6637 1 14.9995 1.33579 14.9995 1.75V6.25V7H13.4995V6.25V3.56066L8.53033 8.52978L8 9.06011L6.93934 7.99945L7.46967 7.46912L12.4388 2.5H9.75H9V1Z`,fill:`currentColor`,fillRule:`evenodd`})}),Loader2Icon:e=>(0,_.jsxs)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:[(0,_.jsx)(`path`,{d:`M8 0V4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,_.jsx)(`path`,{d:`M8 16V12`,opacity:`0.5`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,_.jsx)(`path`,{d:`M3.29773 1.52783L5.64887 4.7639`,opacity:`0.9`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,_.jsx)(`path`,{d:`M12.7023 1.52783L10.3511 4.7639`,opacity:`0.1`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,_.jsx)(`path`,{d:`M12.7023 14.472L10.3511 11.236`,opacity:`0.4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,_.jsx)(`path`,{d:`M3.29773 14.472L5.64887 11.236`,opacity:`0.6`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,_.jsx)(`path`,{d:`M15.6085 5.52783L11.8043 6.7639`,opacity:`0.2`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,_.jsx)(`path`,{d:`M0.391602 10.472L4.19583 9.23598`,opacity:`0.7`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,_.jsx)(`path`,{d:`M15.6085 10.4722L11.8043 9.2361`,opacity:`0.3`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,_.jsx)(`path`,{d:`M0.391602 5.52783L4.19583 6.7639`,opacity:`0.8`,stroke:`currentColor`,strokeWidth:`1.5`})]}),Maximize2Icon:e=>(0,_.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,_.jsx)(`path`,{clipRule:`evenodd`,d:`M1 5.25V6H2.5V5.25V2.5H5.25H6V1H5.25H2C1.44772 1 1 1.44772 1 2V5.25ZM5.25 14.9994H6V13.4994H5.25H2.5V10.7494V9.99939H1V10.7494V13.9994C1 14.5517 1.44772 14.9994 2 14.9994H5.25ZM15 10V10.75V14C15 14.5523 14.5523 15 14 15H10.75H10V13.5H10.75H13.5V10.75V10H15ZM10.75 1H10V2.5H10.75H13.5V5.25V6H15V5.25V2C15 1.44772 14.5523 1 14 1H10.75Z`,fill:`currentColor`,fillRule:`evenodd`})}),RotateCcwIcon:e=>(0,_.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,_.jsx)(`path`,{clipRule:`evenodd`,d:`M13.5 8C13.5 4.96643 11.0257 2.5 7.96452 2.5C5.42843 2.5 3.29365 4.19393 2.63724 6.5H5.25H6V8H5.25H0.75C0.335787 8 0 7.66421 0 7.25V2.75V2H1.5V2.75V5.23347C2.57851 2.74164 5.06835 1 7.96452 1C11.8461 1 15 4.13001 15 8C15 11.87 11.8461 15 7.96452 15C5.62368 15 3.54872 13.8617 2.27046 12.1122L1.828 11.5066L3.03915 10.6217L3.48161 11.2273C4.48831 12.6051 6.12055 13.5 7.96452 13.5C11.0257 13.5 13.5 11.0336 13.5 8Z`,fill:`currentColor`,fillRule:`evenodd`})}),XIcon:e=>(0,_.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,_.jsx)(`path`,{clipRule:`evenodd`,d:`M12.4697 13.5303L13 14.0607L14.0607 13L13.5303 12.4697L9.06065 7.99999L13.5303 3.53032L14.0607 2.99999L13 1.93933L12.4697 2.46966L7.99999 6.93933L3.53032 2.46966L2.99999 1.93933L1.93933 2.99999L2.46966 3.53032L6.93933 7.99999L2.46966 12.4697L1.93933 13L2.99999 14.0607L3.53032 13.5303L7.99999 9.06065L12.4697 13.5303Z`,fill:`currentColor`,fillRule:`evenodd`})}),ZoomInIcon:e=>(0,_.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,_.jsx)(`path`,{clipRule:`evenodd`,d:`M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H5.875V4.75V4.125H7.125V4.75V5.875H8.25H8.875V7.125H8.25H7.125V8.25V8.875H5.875V8.25V7.125H4.75H4.125V5.875Z`,fill:`currentColor`,fillRule:`evenodd`})}),ZoomOutIcon:e=>(0,_.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,_.jsx)(`path`,{clipRule:`evenodd`,d:`M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H8.25H8.875V7.125H8.25H4.75H4.125V5.875Z`,fill:`currentColor`,fillRule:`evenodd`})})},TN=(0,d.createContext)(wN),EN=(e,t)=>{if(e===t)return!0;if(!(e&&t))return e===t;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length?n.every(n=>e[n]===t[n]):!1},DN=({icons:e,children:t})=>{let n=(0,d.useRef)(e),r=(0,d.useRef)(e?{...wN,...e}:wN);EN(n.current,e)||(n.current=e,r.current=e?{...wN,...e}:wN);let i=r.current;return(0,_.jsx)(TN.Provider,{value:i,children:t})},ON=()=>(0,d.useContext)(TN),kN={copyCode:`Copy Code`,downloadFile:`Download file`,downloadDiagram:`Download diagram`,downloadDiagramAsSvg:`Download diagram as SVG`,downloadDiagramAsPng:`Download diagram as PNG`,downloadDiagramAsMmd:`Download diagram as MMD`,viewFullscreen:`View fullscreen`,exitFullscreen:`Exit fullscreen`,mermaidFormatSvg:`SVG`,mermaidFormatPng:`PNG`,mermaidFormatMmd:`MMD`,copyTable:`Copy table`,copyTableAsMarkdown:`Copy table as Markdown`,copyTableAsCsv:`Copy table as CSV`,copyTableAsTsv:`Copy table as TSV`,downloadTable:`Download table`,downloadTableAsCsv:`Download table as CSV`,downloadTableAsMarkdown:`Download table as Markdown`,tableFormatMarkdown:`Markdown`,tableFormatCsv:`CSV`,tableFormatTsv:`TSV`,imageNotAvailable:`Image not available`,downloadImage:`Download image`,openExternalLink:`Open external link?`,externalLinkWarning:`You're about to visit an external website.`,close:`Close`,copyLink:`Copy link`,copied:`Copied`,openLink:`Open link`},AN=(0,d.createContext)(kN),jN=()=>(0,d.useContext)(AN),MN=({onCopy:e,onError:t,timeout:n=2e3,children:r,className:i,code:a,...o})=>{let s=pN(),[c,l]=(0,d.useState)(!1),u=(0,d.useRef)(0),{code:f}=yN(),{isAnimating:p}=(0,d.useContext)(RF),m=jN(),h=a??f,g=async()=>{var r;if(typeof window>`u`||!((r=navigator==null?void 0:navigator.clipboard)!=null&&r.writeText)){t?.(Error(`Clipboard API not available`));return}try{c||(await navigator.clipboard.writeText(h),l(!0),e?.(),u.current=window.setTimeout(()=>l(!1),n))}catch(e){t?.(e)}};(0,d.useEffect)(()=>()=>{window.clearTimeout(u.current)},[]);let v=ON(),y=c?v.CheckIcon:v.CopyIcon;return(0,_.jsx)(`button`,{className:s(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),"data-streamdown":`code-block-copy-button`,disabled:p,onClick:g,title:m.copyCode,type:`button`,...o,children:r??(0,_.jsx)(y,{size:14})})},NN={"1c":`1c`,"1c-query":`1cq`,abap:`abap`,"actionscript-3":`as`,ada:`ada`,adoc:`adoc`,"angular-html":`html`,"angular-ts":`ts`,apache:`conf`,apex:`cls`,apl:`apl`,applescript:`applescript`,ara:`ara`,asciidoc:`adoc`,asm:`asm`,astro:`astro`,awk:`awk`,ballerina:`bal`,bash:`sh`,bat:`bat`,batch:`bat`,be:`be`,beancount:`beancount`,berry:`berry`,bibtex:`bib`,bicep:`bicep`,blade:`blade.php`,bsl:`bsl`,c:`c`,"c#":`cs`,"c++":`cpp`,cadence:`cdc`,cairo:`cairo`,cdc:`cdc`,clarity:`clar`,clj:`clj`,clojure:`clj`,"closure-templates":`soy`,cmake:`cmake`,cmd:`cmd`,cobol:`cob`,codeowners:`CODEOWNERS`,codeql:`ql`,coffee:`coffee`,coffeescript:`coffee`,"common-lisp":`lisp`,console:`sh`,coq:`v`,cpp:`cpp`,cql:`cql`,crystal:`cr`,cs:`cs`,csharp:`cs`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cql`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,docker:`dockerfile`,dockerfile:`dockerfile`,dotenv:`env`,"dream-maker":`dm`,edge:`edge`,elisp:`el`,elixir:`ex`,elm:`elm`,"emacs-lisp":`el`,erb:`erb`,erl:`erl`,erlang:`erl`,f:`f`,"f#":`fs`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`f90`,f95:`f95`,fennel:`fnl`,fish:`fish`,fluent:`ftl`,for:`for`,"fortran-fixed-form":`f`,"fortran-free-form":`f90`,fs:`fs`,fsharp:`fs`,fsl:`fsl`,ftl:`ftl`,gdresource:`tres`,gdscript:`gd`,gdshader:`gdshader`,genie:`gs`,gherkin:`feature`,"git-commit":`gitcommit`,"git-rebase":`gitrebase`,gjs:`js`,gleam:`gleam`,"glimmer-js":`js`,"glimmer-ts":`ts`,glsl:`glsl`,gnuplot:`plt`,go:`go`,gql:`gql`,graphql:`graphql`,groovy:`groovy`,gts:`gts`,hack:`hack`,haml:`haml`,handlebars:`hbs`,haskell:`hs`,haxe:`hx`,hbs:`hbs`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,hs:`hs`,html:`html`,"html-derivative":`html`,http:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,jade:`jade`,java:`java`,javascript:`js`,jinja:`jinja`,jison:`jison`,jl:`jl`,js:`js`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,julia:`jl`,kotlin:`kt`,kql:`kql`,kt:`kt`,kts:`kts`,kusto:`kql`,latex:`tex`,lean:`lean`,lean4:`lean`,less:`less`,liquid:`liquid`,lisp:`lisp`,lit:`lit`,llvm:`ll`,log:`log`,logo:`logo`,lua:`lua`,luau:`luau`,make:`mak`,makefile:`mak`,markdown:`md`,marko:`marko`,matlab:`m`,md:`md`,mdc:`mdc`,mdx:`mdx`,mediawiki:`wiki`,mermaid:`mmd`,mips:`s`,mipsasm:`s`,mmd:`mmd`,mojo:`mojo`,move:`move`,nar:`nar`,narrat:`narrat`,nextflow:`nf`,nf:`nf`,nginx:`conf`,nim:`nim`,nix:`nix`,nu:`nu`,nushell:`nu`,objc:`m`,"objective-c":`m`,"objective-cpp":`mm`,ocaml:`ml`,pascal:`pas`,perl:`pl`,perl6:`p6`,php:`php`,plsql:`pls`,po:`po`,polar:`polar`,postcss:`pcss`,pot:`pot`,potx:`potx`,powerquery:`pq`,powershell:`ps1`,prisma:`prisma`,prolog:`pl`,properties:`properties`,proto:`proto`,protobuf:`proto`,ps:`ps`,ps1:`ps1`,pug:`pug`,puppet:`pp`,purescript:`purs`,py:`py`,python:`py`,ql:`ql`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,racket:`rkt`,raku:`raku`,razor:`cshtml`,rb:`rb`,reg:`reg`,regex:`regex`,regexp:`regexp`,rel:`rel`,riscv:`s`,rs:`rs`,rst:`rst`,ruby:`rb`,rust:`rs`,sas:`sas`,sass:`sass`,scala:`scala`,scheme:`scm`,scss:`scss`,sdbl:`sdbl`,sh:`sh`,shader:`shader`,shaderlab:`shader`,shell:`sh`,shellscript:`sh`,shellsession:`sh`,smalltalk:`st`,solidity:`sol`,soy:`soy`,sparql:`rq`,spl:`spl`,splunk:`spl`,sql:`sql`,"ssh-config":`config`,stata:`do`,styl:`styl`,stylus:`styl`,svelte:`svelte`,swift:`swift`,"system-verilog":`sv`,systemd:`service`,talon:`talon`,talonscript:`talon`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,terraform:`tf`,tex:`tex`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`ts`,"ts-tags":`ts`,tsp:`tsp`,tsv:`tsv`,tsx:`tsx`,turtle:`ttl`,twig:`twig`,typ:`typ`,typescript:`ts`,typespec:`tsp`,typst:`typ`,v:`v`,vala:`vala`,vb:`vb`,verilog:`v`,vhdl:`vhdl`,vim:`vim`,viml:`vim`,vimscript:`vim`,vue:`vue`,"vue-html":`html`,"vue-vine":`vine`,vy:`vy`,vyper:`vy`,wasm:`wasm`,wenyan:`wy`,wgsl:`wgsl`,wiki:`wiki`,wikitext:`wiki`,wit:`wit`,wl:`wl`,wolfram:`wl`,xml:`xml`,xsl:`xsl`,yaml:`yaml`,yml:`yml`,zenscript:`zs`,zig:`zig`,zsh:`zsh`,文言:`wy`},PN=({onDownload:e,onError:t,language:n,children:r,className:i,code:a,...o})=>{let s=pN(),{code:c}=yN(),{isAnimating:l}=(0,d.useContext)(RF),u=jN(),f=ON(),p=a??c,m=`file.${n&&n in NN?NN[n]:`txt`}`;return(0,_.jsx)(`button`,{className:s(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),"data-streamdown":`code-block-download-button`,disabled:l,onClick:()=>{try{dN(m,p,`text/plain`),e?.()}catch(e){t?.(e)}},title:u.downloadFile,type:`button`,...o,children:r??(0,_.jsx)(f.DownloadIcon,{size:14})})},FN=()=>{let{Loader2Icon:e}=ON(),t=pN();return(0,_.jsxs)(`div`,{className:t(`w-full divide-y divide-border overflow-hidden rounded-xl border border-border`),children:[(0,_.jsx)(`div`,{className:t(`h-[46px] w-full bg-muted/80`)}),(0,_.jsx)(`div`,{className:t(`flex w-full items-center justify-center p-4`),children:(0,_.jsx)(e,{className:t(`size-4 animate-spin`)})})]})},IN=/\.[^/.]+$/,LN=({node:e,className:t,src:n,alt:r,onLoad:i,onError:a,...o})=>{let{DownloadIcon:s}=ON(),c=pN(),l=(0,d.useRef)(null),[u,f]=(0,d.useState)(!1),[p,m]=(0,d.useState)(!1),h=jN(),g=o.width!=null||o.height!=null,v=(u||g)&&!p,y=p&&!g;(0,d.useEffect)(()=>{let e=l.current;if(e!=null&&e.complete){let t=e.naturalWidth>0;f(t),m(!t)}},[]);let b=(0,d.useCallback)(e=>{f(!0),m(!1),i?.(e)},[i]),x=(0,d.useCallback)(e=>{f(!1),m(!0),a?.(e)},[a]),S=async()=>{if(n)try{let e=await(await fetch(n)).blob(),t=new URL(n,window.location.origin).pathname.split(`/`).pop()||``,i=t.split(`.`).pop(),a=t.includes(`.`)&&i!==void 0&&i.length<=4,o=``;if(a)o=t;else{let n=e.type,i=`png`;n.includes(`jpeg`)||n.includes(`jpg`)?i=`jpg`:n.includes(`png`)?i=`png`:n.includes(`svg`)?i=`svg`:n.includes(`gif`)?i=`gif`:n.includes(`webp`)&&(i=`webp`),o=`${(r||t||`image`).replace(IN,``)}.${i}`}dN(o,e,e.type)}catch{window.open(n,`_blank`)}};return n?(0,_.jsxs)(`div`,{className:c(`group relative my-4 inline-block`),"data-streamdown":`image-wrapper`,children:[(0,_.jsx)(`img`,{alt:r,className:c(`max-w-full rounded-lg`,y&&`hidden`,t),"data-streamdown":`image`,onError:x,onLoad:b,ref:l,src:n,...o}),y&&(0,_.jsx)(`span`,{className:c(`text-muted-foreground text-xs italic`),"data-streamdown":`image-fallback`,children:h.imageNotAvailable}),(0,_.jsx)(`div`,{className:c(`pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block`)}),v&&(0,_.jsx)(`button`,{className:c(`absolute right-2 bottom-2 flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background/90 shadow-sm backdrop-blur-sm transition-all duration-200 hover:bg-background`,`opacity-0 group-hover:opacity-100`),onClick:S,title:h.downloadImage,type:`button`,children:(0,_.jsx)(s,{size:14})})]}):null},RN=0,zN=()=>{RN+=1,RN===1&&(document.body.style.overflow=`hidden`)},BN=()=>{RN=Math.max(0,RN-1),RN===0&&(document.body.style.overflow=``)},VN=({url:e,isOpen:t,onClose:n,onConfirm:r})=>{let{CheckIcon:i,CopyIcon:a,ExternalLinkIcon:o,XIcon:s}=ON(),c=pN(),[l,u]=(0,d.useState)(!1),f=jN(),p=(0,d.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),u(!0),setTimeout(()=>u(!1),2e3)}catch{}},[e]),m=(0,d.useCallback)(()=>{r(),n()},[r,n]);return(0,d.useEffect)(()=>{if(t){zN();let e=e=>{e.key===`Escape`&&n()};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),BN()}}},[t,n]),t?(0,_.jsx)(`div`,{className:c(`fixed inset-0 z-50 flex items-center justify-center bg-background/50 backdrop-blur-sm`),"data-streamdown":`link-safety-modal`,onClick:n,onKeyDown:e=>{e.key===`Escape`&&n()},role:`button`,tabIndex:0,children:(0,_.jsxs)(`div`,{className:c(`relative mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border bg-background p-6 shadow-lg`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,_.jsx)(`button`,{className:c(`absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:n,title:f.close,type:`button`,children:(0,_.jsx)(s,{size:16})}),(0,_.jsxs)(`div`,{className:c(`flex flex-col gap-2`),children:[(0,_.jsxs)(`div`,{className:c(`flex items-center gap-2 font-semibold text-lg`),children:[(0,_.jsx)(o,{size:20}),(0,_.jsx)(`span`,{children:f.openExternalLink})]}),(0,_.jsx)(`p`,{className:c(`text-muted-foreground text-sm`),children:f.externalLinkWarning})]}),(0,_.jsx)(`div`,{className:c(`break-all rounded-md bg-muted p-3 font-mono text-sm`,e.length>100&&`max-h-32 overflow-y-auto`),children:e}),(0,_.jsxs)(`div`,{className:c(`flex gap-2`),children:[(0,_.jsx)(`button`,{className:c(`flex flex-1 items-center justify-center gap-2 rounded-md border bg-background px-4 py-2 font-medium text-sm transition-all hover:bg-muted`),onClick:p,type:`button`,children:l?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(i,{size:14}),(0,_.jsx)(`span`,{children:f.copied})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(a,{size:14}),(0,_.jsx)(`span`,{children:f.copyLink})]})}),(0,_.jsxs)(`button`,{className:c(`flex flex-1 items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 font-medium text-primary-foreground text-sm transition-all hover:bg-primary/90`),onClick:m,type:`button`,children:[(0,_.jsx)(o,{size:14}),(0,_.jsx)(`span`,{children:f.openLink})]})]})]})}):null},HN=(0,d.createContext)(null),UN=()=>(0,d.useContext)(HN),WN=()=>UN()?.code??null,GN=()=>UN()?.mermaid??null,KN=e=>{var t;let n=UN();return n!=null&&n.renderers&&e&&(t=n.renderers.find(t=>Array.isArray(t.language)?t.language.includes(e):t.language===e))!=null?t:null},qN=(e,t)=>new Promise((t,n)=>{let r=`data:image/svg+xml;base64,`+btoa(unescape(encodeURIComponent(e))),i=new Image;i.crossOrigin=`anonymous`,i.onload=()=>{let e=document.createElement(`canvas`),r=i.width*5,a=i.height*5;e.width=r,e.height=a;let o=e.getContext(`2d`);if(!o){n(Error(`Failed to create 2D canvas context for PNG export`));return}o.drawImage(i,0,0,r,a),e.toBlob(e=>{if(!e){n(Error(`Failed to create PNG blob`));return}t(e)},`image/png`)},i.onerror=()=>n(Error(`Failed to load SVG image`)),i.src=r}),JN=({chart:e,children:t,className:n,onDownload:r,config:i,onError:a})=>{let o=pN(),[s,c]=(0,d.useState)(!1),l=(0,d.useRef)(null),{isAnimating:u}=(0,d.useContext)(RF),f=ON(),p=GN(),m=jN(),h=async t=>{try{if(t===`mmd`){dN(`diagram.mmd`,e,`text/plain`),c(!1),r?.(t);return}if(!p){a?.(Error(`Mermaid plugin not available`));return}let n=p.getMermaid(i),o=e.split(``).reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0),s=`mermaid-${Math.abs(o)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:l}=await n.render(s,e);if(!l){a?.(Error(`SVG not found. Please wait for the diagram to render.`));return}if(t===`svg`){dN(`diagram.svg`,l,`image/svg+xml`),c(!1),r?.(t);return}if(t===`png`){dN(`diagram.png`,await qN(l),`image/png`),r?.(t),c(!1);return}}catch(e){a?.(e)}};return(0,d.useEffect)(()=>{let e=e=>{let t=e.composedPath();l.current&&!t.includes(l.current)&&c(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,_.jsxs)(`div`,{className:o(`relative`),ref:l,children:[(0,_.jsx)(`button`,{className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,n),disabled:u,onClick:()=>c(!s),title:m.downloadDiagram,type:`button`,children:t??(0,_.jsx)(f.DownloadIcon,{size:14})}),s?(0,_.jsxs)(`div`,{className:o(`absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,_.jsx)(`button`,{className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>h(`svg`),title:m.downloadDiagramAsSvg,type:`button`,children:m.mermaidFormatSvg}),(0,_.jsx)(`button`,{className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>h(`png`),title:m.downloadDiagramAsPng,type:`button`,children:m.mermaidFormatPng}),(0,_.jsx)(`button`,{className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>h(`mmd`),title:m.downloadDiagramAsMmd,type:`button`,children:m.mermaidFormatMmd})]}):null]})},YN=({chart:e,config:t,onFullscreen:n,onExit:r,className:i,...a})=>{let{Maximize2Icon:o,XIcon:s}=ON(),c=pN(),[l,u]=(0,d.useState)(!1),{isAnimating:f,controls:p}=(0,d.useContext)(RF),m=jN(),h=(()=>{if(typeof p==`boolean`)return p;let e=p.mermaid;return e===!1?!1:e===!0||e===void 0?!0:e.panZoom!==!1})(),g=()=>{u(!l)};return(0,d.useEffect)(()=>{if(l){zN();let e=e=>{e.key===`Escape`&&u(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),BN()}}},[l]),(0,d.useEffect)(()=>{l?n?.():r&&r()},[l,n,r]),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`button`,{className:c(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),disabled:f,onClick:g,title:m.viewFullscreen,type:`button`,...a,children:(0,_.jsx)(o,{size:14})}),l?(0,E.createPortal)((0,_.jsxs)(`div`,{className:c(`fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm`),onClick:g,onKeyDown:e=>{e.key===`Escape`&&g()},role:`button`,tabIndex:0,children:[(0,_.jsx)(`button`,{className:c(`absolute top-4 right-4 z-10 rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:g,title:m.exitFullscreen,type:`button`,children:(0,_.jsx)(s,{size:20})}),(0,_.jsx)(`div`,{className:c(`flex size-full items-center justify-center p-4`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:(0,_.jsx)(HF,{chart:e,className:c(`size-full [&_svg]:h-auto [&_svg]:w-auto`),config:t,fullscreen:!0,showControls:h})})]}),document.body):null]})},XN=e=>{let t=[],n=[],r=e.querySelectorAll(`thead th`);for(let e of r)t.push(e.textContent?.trim()||``);let i=e.querySelectorAll(`tbody tr`);for(let e of i){let t=[],r=e.querySelectorAll(`td`);for(let e of r)t.push(e.textContent?.trim()||``);n.push(t)}return{headers:t,rows:n}},ZN=e=>{let{headers:t,rows:n}=e,r=e=>{let t=!1,n=!1;for(let r of e){if(r===`"`){t=!0,n=!0;break}(r===`,`||r===`
|
|
173
173
|
`)&&(t=!0)}return t?n?`"${e.replace(/"/g,`""`)}"`:`"${e}"`:e},i=t.length>0?n.length+1:n.length,a=Array(i),o=0;t.length>0&&(a[o]=t.map(r).join(`,`),o+=1);for(let e of n)a[o]=e.map(r).join(`,`),o+=1;return a.join(`
|
|
174
174
|
`)},QN=e=>{let{headers:t,rows:n}=e,r=e=>{let t=!1;for(let n of e)if(n===` `||n===`
|
|
175
175
|
`||n===`\r`){t=!0;break}if(!t)return e;let n=[];for(let t of e)t===` `?n.push(`\\t`):t===`
|
|
176
176
|
`?n.push(`\\n`):t===`\r`?n.push(`\\r`):n.push(t);return n.join(``)},i=t.length>0?n.length+1:n.length,a=Array(i),o=0;t.length>0&&(a[o]=t.map(r).join(` `),o+=1);for(let e of n)a[o]=e.map(r).join(` `),o+=1;return a.join(`
|
|
177
177
|
`)},$N=e=>{let t=!1;for(let n of e)if(n===`\\`||n===`|`){t=!0;break}if(!t)return e;let n=[];for(let t of e)t===`\\`?n.push(`\\\\`):t===`|`?n.push(`\\|`):n.push(t);return n.join(``)},eP=e=>{let{headers:t,rows:n}=e;if(t.length===0)return``;let r=Array(n.length+2),i=0;r[i]=`| ${t.map(e=>$N(e)).join(` | `)} |`,i+=1;let a=Array(t.length);for(let e=0;e<t.length;e+=1)a[e]=`---`;r[i]=`| ${a.join(` | `)} |`,i+=1;for(let e of n)if(e.length<t.length){let n=Array(t.length);for(let r=0;r<t.length;r+=1)n[r]=r<e.length?$N(e[r]):``;r[i]=`| ${n.join(` | `)} |`,i+=1}else r[i]=`| ${e.map(e=>$N(e)).join(` | `)} |`,i+=1;return r.join(`
|
|
178
|
-
`)},tP=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let a=pN(),[o,s]=(0,d.useState)(!1),[c,l]=(0,d.useState)(!1),u=(0,d.useRef)(null),f=(0,d.useRef)(0),{isAnimating:p}=(0,d.useContext)(RF),m=jN(),h=async e=>{var t;if(typeof window>`u`||!((t=navigator==null?void 0:navigator.clipboard)!=null&&t.write)){r?.(Error(`Clipboard API not available`));return}try{let t=(u.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let a=XN(t),o=({csv:ZN,tsv:QN,md:eP}[e]||eP)(a),c=new ClipboardItem({"text/plain":new Blob([o],{type:`text/plain`}),"text/html":new Blob([t.outerHTML],{type:`text/html`})});await navigator.clipboard.write([c]),l(!0),s(!1),n?.(e),f.current=window.setTimeout(()=>l(!1),i)}catch(e){r?.(e)}};(0,d.useEffect)(()=>{let e=e=>{let t=e.composedPath();u.current&&!t.includes(u.current)&&s(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e),window.clearTimeout(f.current)}},[]);let g=ON(),v=c?g.CheckIcon:g.CopyIcon;return(0,_.jsxs)(`div`,{className:a(`relative`),ref:u,children:[(0,_.jsx)(`button`,{className:a(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:p,onClick:()=>s(!o),title:m.copyTable,type:`button`,children:e??(0,_.jsx)(v,{height:14,width:14})}),o?(0,_.jsxs)(`div`,{className:a(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,_.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>h(`md`),title:m.copyTableAsMarkdown,type:`button`,children:m.tableFormatMarkdown}),(0,_.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>h(`csv`),title:m.copyTableAsCsv,type:`button`,children:m.tableFormatCsv}),(0,_.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>h(`tsv`),title:m.copyTableAsTsv,type:`button`,children:m.tableFormatTsv})]}):null]})},nP=({children:e,className:t,onDownload:n,onError:r})=>{let i=pN(),[a,o]=(0,d.useState)(!1),s=(0,d.useRef)(null),{isAnimating:c}=(0,d.useContext)(RF),l=jN(),u=ON(),f=e=>{try{let t=(s.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let i=XN(t),a=e===`csv`?ZN(i):eP(i);dN(`table.${e===`csv`?`csv`:`md`}`,a,e===`csv`?`text/csv`:`text/markdown`),o(!1),n?.(e)}catch(e){r?.(e)}};return(0,d.useEffect)(()=>{let e=e=>{let t=e.composedPath();s.current&&!t.includes(s.current)&&o(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,_.jsxs)(`div`,{className:i(`relative`),ref:s,children:[(0,_.jsx)(`button`,{className:i(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:c,onClick:()=>o(!a),title:l.downloadTable,type:`button`,children:e??(0,_.jsx)(u.DownloadIcon,{size:14})}),a?(0,_.jsxs)(`div`,{className:i(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,_.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>f(`csv`),title:l.downloadTableAsCsv,type:`button`,children:l.tableFormatCsv}),(0,_.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>f(`markdown`),title:l.downloadTableAsMarkdown,type:`button`,children:l.tableFormatMarkdown})]}):null]})},rP=({children:e,className:t,showCopy:n=!0,showDownload:r=!0})=>{let{Maximize2Icon:i,XIcon:a}=ON(),o=pN(),[s,c]=(0,d.useState)(!1),{isAnimating:l}=(0,d.useContext)(RF),u=jN(),f=()=>{c(!0)},p=()=>{c(!1)};return(0,d.useEffect)(()=>{if(s){zN();let e=e=>{e.key===`Escape`&&c(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),BN()}}},[s]),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`button`,{className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:l,onClick:f,title:u.viewFullscreen,type:`button`,children:(0,_.jsx)(i,{size:14})}),s?(0,E.createPortal)((0,_.jsx)(`div`,{"aria-label":u.viewFullscreen,"aria-modal":`true`,className:o(`fixed inset-0 z-50 flex flex-col bg-background`),"data-streamdown":`table-fullscreen`,onClick:p,onKeyDown:e=>{e.key===`Escape`&&p()},role:`dialog`,children:(0,_.jsxs)(`div`,{className:o(`flex h-full flex-col`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,_.jsxs)(`div`,{className:o(`flex items-center justify-end gap-1 p-4`),children:[n?(0,_.jsx)(tP,{}):null,r?(0,_.jsx)(nP,{}):null,(0,_.jsx)(`button`,{className:o(`rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:p,title:u.exitFullscreen,type:`button`,children:(0,_.jsx)(a,{size:20})})]}),(0,_.jsx)(`div`,{className:o(`flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10`),children:(0,_.jsx)(`table`,{className:o(`w-full border-collapse border border-border`),"data-streamdown":`table`,children:e})})]})}),document.body):null]})},iP=({children:e,className:t,showControls:n,showCopy:r=!0,showDownload:i=!0,showFullscreen:a=!0,...o})=>{let s=pN(),c=n&&r,l=n&&i,u=n&&a,d=c||l||u;return(0,_.jsxs)(`div`,{className:s(`my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2`),"data-streamdown":`table-wrapper`,children:[d?(0,_.jsxs)(`div`,{className:s(`flex items-center justify-end gap-1`),children:[c?(0,_.jsx)(tP,{}):null,l?(0,_.jsx)(nP,{}):null,u?(0,_.jsx)(rP,{showCopy:c,showDownload:l,children:e}):null]}):null,(0,_.jsx)(`div`,{className:s(`border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background`),children:(0,_.jsx)(`table`,{className:s(`w-full divide-y divide-border`,t),"data-streamdown":`table`,...o,children:e})})]})},aP=/startLine=(\d+)/,oP=/\bnoLineNumbers\b/,sP=(0,d.lazy)(()=>$(()=>import(`./mermaid-GHXKKRXX-DgSNlEad.js`).then(e=>({default:e.Mermaid})),[])),cP=/language-([^\s]+)/;function lP(e,t){if(!(e!=null&&e.position||t!=null&&t.position))return!0;if(!(e!=null&&e.position&&t!=null&&t.position))return!1;let n=e.position.start,r=t.position.start,i=e.position.end,a=t.position.end;return n?.line===r?.line&&n?.column===r?.column&&i?.line===a?.line&&i?.column===a?.column}function uP(e,t){return e.className===t.className&&lP(e.node,t.node)}var dP=(e,t)=>typeof e==`boolean`?e:e[t]!==!1,fP=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.table;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},pP=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.code;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},mP=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.mermaid;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},hP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`ol`,{className:pN()(`list-inside list-decimal whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`ordered-list`,...r,children:e}),(e,t)=>uP(e,t));hP.displayName=`MarkdownOl`;var gP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`li`,{className:pN()(`py-1 [&>p]:inline`,t),"data-streamdown":`list-item`,...r,children:e}),(e,t)=>e.className===t.className&&lP(e.node,t.node));gP.displayName=`MarkdownLi`;var _P=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`ul`,{className:pN()(`list-inside list-disc whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`unordered-list`,...r,children:e}),(e,t)=>uP(e,t));_P.displayName=`MarkdownUl`;var vP=(0,d.memo)(({className:e,node:t,...n})=>(0,_.jsx)(`hr`,{className:pN()(`my-6 border-border`,e),"data-streamdown":`horizontal-rule`,...n}),(e,t)=>uP(e,t));vP.displayName=`MarkdownHr`;var yP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`span`,{className:pN()(`font-semibold`,t),"data-streamdown":`strong`,...r,children:e}),(e,t)=>uP(e,t));yP.displayName=`MarkdownStrong`;var bP=(0,d.memo)(({children:e,className:t,href:n,node:r,...i})=>{let a=pN(),{linkSafety:o}=(0,d.useContext)(RF),[s,c]=(0,d.useState)(!1),l=n===`streamdown:incomplete-link`,u=(0,d.useCallback)(async e=>{if(!(!(o!=null&&o.enabled&&n)||l)){if(e.preventDefault(),o.onLinkCheck&&await o.onLinkCheck(n)){window.open(n,`_blank`,`noreferrer`);return}c(!0)}},[o,n,l]),f=(0,d.useCallback)(()=>{n&&window.open(n,`_blank`,`noreferrer`)},[n]),p=(0,d.useCallback)(()=>{c(!1)},[]),m={url:n??``,isOpen:s,onClose:p,onConfirm:f};return o!=null&&o.enabled&&n?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`button`,{className:a(`wrap-anywhere appearance-none text-left font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,onClick:u,type:`button`,children:e}),o.renderModal?o.renderModal(m):(0,_.jsx)(VN,{...m})]}):(0,_.jsx)(`a`,{className:a(`wrap-anywhere font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,href:n,rel:`noreferrer`,target:`_blank`,...i,children:e})},(e,t)=>uP(e,t)&&e.href===t.href);bP.displayName=`MarkdownA`;var xP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`h1`,{className:pN()(`mt-6 mb-2 font-semibold text-3xl`,t),"data-streamdown":`heading-1`,...r,children:e}),(e,t)=>uP(e,t));xP.displayName=`MarkdownH1`;var SP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`h2`,{className:pN()(`mt-6 mb-2 font-semibold text-2xl`,t),"data-streamdown":`heading-2`,...r,children:e}),(e,t)=>uP(e,t));SP.displayName=`MarkdownH2`;var CP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`h3`,{className:pN()(`mt-6 mb-2 font-semibold text-xl`,t),"data-streamdown":`heading-3`,...r,children:e}),(e,t)=>uP(e,t));CP.displayName=`MarkdownH3`;var wP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`h4`,{className:pN()(`mt-6 mb-2 font-semibold text-lg`,t),"data-streamdown":`heading-4`,...r,children:e}),(e,t)=>uP(e,t));wP.displayName=`MarkdownH4`;var TP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`h5`,{className:pN()(`mt-6 mb-2 font-semibold text-base`,t),"data-streamdown":`heading-5`,...r,children:e}),(e,t)=>uP(e,t));TP.displayName=`MarkdownH5`;var EP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`h6`,{className:pN()(`mt-6 mb-2 font-semibold text-sm`,t),"data-streamdown":`heading-6`,...r,children:e}),(e,t)=>uP(e,t));EP.displayName=`MarkdownH6`;var DP=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let{controls:i}=(0,d.useContext)(RF);return(0,_.jsx)(iP,{className:t,showControls:dP(i,`table`),showCopy:fP(i,`copy`),showDownload:fP(i,`download`),showFullscreen:fP(i,`fullscreen`),...r,children:e})},(e,t)=>uP(e,t));DP.displayName=`MarkdownTable`;var OP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`thead`,{className:pN()(`bg-muted/80`,t),"data-streamdown":`table-header`,...r,children:e}),(e,t)=>uP(e,t));OP.displayName=`MarkdownThead`;var kP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`tbody`,{className:pN()(`divide-y divide-border`,t),"data-streamdown":`table-body`,...r,children:e}),(e,t)=>uP(e,t));kP.displayName=`MarkdownTbody`;var AP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`tr`,{className:pN()(`border-border`,t),"data-streamdown":`table-row`,...r,children:e}),(e,t)=>uP(e,t));AP.displayName=`MarkdownTr`;var jP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`th`,{className:pN()(`whitespace-nowrap px-4 py-2 text-left font-semibold text-sm`,t),"data-streamdown":`table-header-cell`,...r,children:e}),(e,t)=>uP(e,t));jP.displayName=`MarkdownTh`;var MP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`td`,{className:pN()(`px-4 py-2 text-sm`,t),"data-streamdown":`table-cell`,...r,children:e}),(e,t)=>uP(e,t));MP.displayName=`MarkdownTd`;var NP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`blockquote`,{className:pN()(`my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic`,t),"data-streamdown":`blockquote`,...r,children:e}),(e,t)=>uP(e,t));NP.displayName=`MarkdownBlockquote`;var PP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`sup`,{className:pN()(`text-sm`,t),"data-streamdown":`superscript`,...r,children:e}),(e,t)=>uP(e,t));PP.displayName=`MarkdownSup`;var FP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`sub`,{className:pN()(`text-sm`,t),"data-streamdown":`subscript`,...r,children:e}),(e,t)=>uP(e,t));FP.displayName=`MarkdownSub`;var IP=(0,d.memo)(({children:e,className:t,node:n,...r})=>{if(`data-footnotes`in r){let n=e=>{if(!(0,d.isValidElement)(e))return!1;let t=Array.isArray(e.props.children)?e.props.children:[e.props.children],n=!1,r=!1;for(let e of t)if(e){if(typeof e==`string`)e.trim()!==``&&(n=!0);else if((0,d.isValidElement)(e))if(e.props?.[`data-footnote-backref`]!==void 0)r=!0;else{let t=Array.isArray(e.props.children)?e.props.children:[e.props.children];for(let e of t){if(typeof e==`string`&&e.trim()!==``){n=!0;break}if((0,d.isValidElement)(e)&&e.props?.[`data-footnote-backref`]===void 0){n=!0;break}}}}return r&&!n},i=Array.isArray(e)?e.map(e=>{if(!(0,d.isValidElement)(e))return e;if(e.type===hP){let t=(Array.isArray(e.props.children)?e.props.children:[e.props.children]).filter(e=>!n(e));return t.length===0?null:{...e,props:{...e.props,children:t}}}return e}):e;return(Array.isArray(i)?i.some(e=>e!==null):i!==null)?(0,_.jsx)(`section`,{className:t,...r,children:i}):null}return(0,_.jsx)(`section`,{className:t,...r,children:e})},(e,t)=>uP(e,t));IP.displayName=`MarkdownSection`;var LP=(0,d.memo)(({node:e,className:t,children:n,...r})=>{let i=pN(),a=!(`data-block`in r),{mermaid:o,controls:s,lineNumbers:c}=(0,d.useContext)(RF),l=GN(),u=sN(),f=(t?.match(cP))?.at(1)??``,p=KN(f);if(a)return(0,_.jsx)(`code`,{className:i(`rounded bg-muted px-1.5 py-0.5 font-mono text-sm`,t),"data-streamdown":`inline-code`,...r,children:n});let m=e?.properties?.metastring,h=m?.match(aP),g=h?Number.parseInt(h[1],10):void 0,v=g!==void 0&&g>=1?g:void 0,y=!(m&&oP.test(m))&&c!==!1,b=``;if((0,d.isValidElement)(n)&&n.props&&typeof n.props==`object`&&`children`in n.props&&typeof n.props.children==`string`?b=n.props.children:typeof n==`string`&&(b=n),p){let e=p.component;return(0,_.jsx)(d.Suspense,{fallback:(0,_.jsx)(FN,{}),children:(0,_.jsx)(e,{code:b,isIncomplete:u,language:f,meta:m})})}if(f===`mermaid`&&l){let e=dP(s,`mermaid`),n=mP(s,`download`),r=mP(s,`copy`),a=mP(s,`fullscreen`),c=mP(s,`panZoom`),l=e&&(n||r||a);return(0,_.jsx)(d.Suspense,{fallback:(0,_.jsx)(FN,{}),children:(0,_.jsxs)(`div`,{className:i(`group relative my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2`,t),"data-streamdown":`mermaid-block`,children:[(0,_.jsx)(`div`,{className:i(`flex h-8 items-center text-muted-foreground text-xs`),children:(0,_.jsx)(`span`,{className:i(`ml-1 font-mono lowercase`),children:`mermaid`})}),l?(0,_.jsx)(`div`,{className:i(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,_.jsxs)(`div`,{className:i(`pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur`),"data-streamdown":`mermaid-block-actions`,children:[n?(0,_.jsx)(JN,{chart:b,config:o?.config}):null,r?(0,_.jsx)(MN,{code:b}):null,a?(0,_.jsx)(YN,{chart:b,config:o?.config}):null]})}):null,(0,_.jsx)(`div`,{className:i(`rounded-md border border-border bg-background`),children:(0,_.jsx)(sP,{chart:b,config:o?.config,showControls:c})})]})})}let x=dP(s,`code`),S=pP(s,`download`),C=pP(s,`copy`);return(0,_.jsx)(CN,{className:t,code:b,isIncomplete:u,language:f,lineNumbers:y,startLine:v,children:x?(0,_.jsxs)(_.Fragment,{children:[S?(0,_.jsx)(PN,{code:b,language:f}):null,C?(0,_.jsx)(MN,{}):null]}):null})},(e,t)=>e.className===t.className&&lP(e.node,t.node));LP.displayName=`MarkdownCode`;var RP=(0,d.memo)(LN,(e,t)=>e.className===t.className&&lP(e.node,t.node));RP.displayName=`MarkdownImg`;var zP=(0,d.memo)(({children:e,node:t,...n})=>{let r=(Array.isArray(e)?e:[e]).filter(e=>e!=null&&e!==``);if(r.length===1&&(0,d.isValidElement)(r[0])){let t=r[0].props.node?.tagName;if(t===`img`||t===`code`&&`data-block`in r[0].props)return(0,_.jsx)(_.Fragment,{children:e})}return(0,_.jsx)(`p`,{...n,children:e})},(e,t)=>uP(e,t));zP.displayName=`MarkdownParagraph`;var BP={ol:hP,li:gP,ul:_P,hr:vP,strong:yP,a:bP,h1:xP,h2:SP,h3:CP,h4:wP,h5:TP,h6:EP,table:DP,thead:OP,tbody:kP,tr:AP,th:jP,td:MP,blockquote:NP,code:LP,img:RP,pre:({children:e})=>(0,d.isValidElement)(e)?(0,d.cloneElement)(e,{"data-block":`true`}):e,sup:PP,sub:FP,p:zP,section:IP},VP=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,HP=/\p{L}/u;function UP(e){let t=e.replace(/^#{1,6}\s+/gm,``).replace(/(\*{1,3}|_{1,3})/g,``).replace(/`[^`]*`/g,``).replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/^[\s>*\-+\d.]+/gm,``);for(let e of t){if(VP.test(e))return`rtl`;if(HP.test(e))return`ltr`}return`ltr`}var WP=/^[ \t]{0,3}(`{3,}|~{3,})/,GP=/^\|?[ \t]*:?-{1,}:?[ \t]*(\|[ \t]*:?-{1,}:?[ \t]*)*\|?$/,KP=e=>{let t=e.split(`
|
|
178
|
+
`)},tP=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let a=pN(),[o,s]=(0,d.useState)(!1),[c,l]=(0,d.useState)(!1),u=(0,d.useRef)(null),f=(0,d.useRef)(0),{isAnimating:p}=(0,d.useContext)(RF),m=jN(),h=async e=>{var t;if(typeof window>`u`||!((t=navigator==null?void 0:navigator.clipboard)!=null&&t.write)){r?.(Error(`Clipboard API not available`));return}try{let t=(u.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let a=XN(t),o=({csv:ZN,tsv:QN,md:eP}[e]||eP)(a),c=new ClipboardItem({"text/plain":new Blob([o],{type:`text/plain`}),"text/html":new Blob([t.outerHTML],{type:`text/html`})});await navigator.clipboard.write([c]),l(!0),s(!1),n?.(e),f.current=window.setTimeout(()=>l(!1),i)}catch(e){r?.(e)}};(0,d.useEffect)(()=>{let e=e=>{let t=e.composedPath();u.current&&!t.includes(u.current)&&s(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e),window.clearTimeout(f.current)}},[]);let g=ON(),v=c?g.CheckIcon:g.CopyIcon;return(0,_.jsxs)(`div`,{className:a(`relative`),ref:u,children:[(0,_.jsx)(`button`,{className:a(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:p,onClick:()=>s(!o),title:m.copyTable,type:`button`,children:e??(0,_.jsx)(v,{height:14,width:14})}),o?(0,_.jsxs)(`div`,{className:a(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,_.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>h(`md`),title:m.copyTableAsMarkdown,type:`button`,children:m.tableFormatMarkdown}),(0,_.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>h(`csv`),title:m.copyTableAsCsv,type:`button`,children:m.tableFormatCsv}),(0,_.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>h(`tsv`),title:m.copyTableAsTsv,type:`button`,children:m.tableFormatTsv})]}):null]})},nP=({children:e,className:t,onDownload:n,onError:r})=>{let i=pN(),[a,o]=(0,d.useState)(!1),s=(0,d.useRef)(null),{isAnimating:c}=(0,d.useContext)(RF),l=jN(),u=ON(),f=e=>{try{let t=(s.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let i=XN(t),a=e===`csv`?ZN(i):eP(i);dN(`table.${e===`csv`?`csv`:`md`}`,a,e===`csv`?`text/csv`:`text/markdown`),o(!1),n?.(e)}catch(e){r?.(e)}};return(0,d.useEffect)(()=>{let e=e=>{let t=e.composedPath();s.current&&!t.includes(s.current)&&o(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,_.jsxs)(`div`,{className:i(`relative`),ref:s,children:[(0,_.jsx)(`button`,{className:i(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:c,onClick:()=>o(!a),title:l.downloadTable,type:`button`,children:e??(0,_.jsx)(u.DownloadIcon,{size:14})}),a?(0,_.jsxs)(`div`,{className:i(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,_.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>f(`csv`),title:l.downloadTableAsCsv,type:`button`,children:l.tableFormatCsv}),(0,_.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>f(`markdown`),title:l.downloadTableAsMarkdown,type:`button`,children:l.tableFormatMarkdown})]}):null]})},rP=({children:e,className:t,showCopy:n=!0,showDownload:r=!0})=>{let{Maximize2Icon:i,XIcon:a}=ON(),o=pN(),[s,c]=(0,d.useState)(!1),{isAnimating:l}=(0,d.useContext)(RF),u=jN(),f=()=>{c(!0)},p=()=>{c(!1)};return(0,d.useEffect)(()=>{if(s){zN();let e=e=>{e.key===`Escape`&&c(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),BN()}}},[s]),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`button`,{className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:l,onClick:f,title:u.viewFullscreen,type:`button`,children:(0,_.jsx)(i,{size:14})}),s?(0,E.createPortal)((0,_.jsx)(`div`,{"aria-label":u.viewFullscreen,"aria-modal":`true`,className:o(`fixed inset-0 z-50 flex flex-col bg-background`),"data-streamdown":`table-fullscreen`,onClick:p,onKeyDown:e=>{e.key===`Escape`&&p()},role:`dialog`,children:(0,_.jsxs)(`div`,{className:o(`flex h-full flex-col`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,_.jsxs)(`div`,{className:o(`flex items-center justify-end gap-1 p-4`),children:[n?(0,_.jsx)(tP,{}):null,r?(0,_.jsx)(nP,{}):null,(0,_.jsx)(`button`,{className:o(`rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:p,title:u.exitFullscreen,type:`button`,children:(0,_.jsx)(a,{size:20})})]}),(0,_.jsx)(`div`,{className:o(`flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10`),children:(0,_.jsx)(`table`,{className:o(`w-full border-collapse border border-border`),"data-streamdown":`table`,children:e})})]})}),document.body):null]})},iP=({children:e,className:t,showControls:n,showCopy:r=!0,showDownload:i=!0,showFullscreen:a=!0,...o})=>{let s=pN(),c=n&&r,l=n&&i,u=n&&a,d=c||l||u;return(0,_.jsxs)(`div`,{className:s(`my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2`),"data-streamdown":`table-wrapper`,children:[d?(0,_.jsxs)(`div`,{className:s(`flex items-center justify-end gap-1`),children:[c?(0,_.jsx)(tP,{}):null,l?(0,_.jsx)(nP,{}):null,u?(0,_.jsx)(rP,{showCopy:c,showDownload:l,children:e}):null]}):null,(0,_.jsx)(`div`,{className:s(`border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background`),children:(0,_.jsx)(`table`,{className:s(`w-full divide-y divide-border`,t),"data-streamdown":`table`,...o,children:e})})]})},aP=/startLine=(\d+)/,oP=/\bnoLineNumbers\b/,sP=(0,d.lazy)(()=>$(()=>import(`./mermaid-GHXKKRXX-DdvTRIYD.js`).then(e=>({default:e.Mermaid})),[])),cP=/language-([^\s]+)/;function lP(e,t){if(!(e!=null&&e.position||t!=null&&t.position))return!0;if(!(e!=null&&e.position&&t!=null&&t.position))return!1;let n=e.position.start,r=t.position.start,i=e.position.end,a=t.position.end;return n?.line===r?.line&&n?.column===r?.column&&i?.line===a?.line&&i?.column===a?.column}function uP(e,t){return e.className===t.className&&lP(e.node,t.node)}var dP=(e,t)=>typeof e==`boolean`?e:e[t]!==!1,fP=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.table;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},pP=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.code;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},mP=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.mermaid;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},hP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`ol`,{className:pN()(`list-inside list-decimal whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`ordered-list`,...r,children:e}),(e,t)=>uP(e,t));hP.displayName=`MarkdownOl`;var gP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`li`,{className:pN()(`py-1 [&>p]:inline`,t),"data-streamdown":`list-item`,...r,children:e}),(e,t)=>e.className===t.className&&lP(e.node,t.node));gP.displayName=`MarkdownLi`;var _P=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`ul`,{className:pN()(`list-inside list-disc whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`unordered-list`,...r,children:e}),(e,t)=>uP(e,t));_P.displayName=`MarkdownUl`;var vP=(0,d.memo)(({className:e,node:t,...n})=>(0,_.jsx)(`hr`,{className:pN()(`my-6 border-border`,e),"data-streamdown":`horizontal-rule`,...n}),(e,t)=>uP(e,t));vP.displayName=`MarkdownHr`;var yP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`span`,{className:pN()(`font-semibold`,t),"data-streamdown":`strong`,...r,children:e}),(e,t)=>uP(e,t));yP.displayName=`MarkdownStrong`;var bP=(0,d.memo)(({children:e,className:t,href:n,node:r,...i})=>{let a=pN(),{linkSafety:o}=(0,d.useContext)(RF),[s,c]=(0,d.useState)(!1),l=n===`streamdown:incomplete-link`,u=(0,d.useCallback)(async e=>{if(!(!(o!=null&&o.enabled&&n)||l)){if(e.preventDefault(),o.onLinkCheck&&await o.onLinkCheck(n)){window.open(n,`_blank`,`noreferrer`);return}c(!0)}},[o,n,l]),f=(0,d.useCallback)(()=>{n&&window.open(n,`_blank`,`noreferrer`)},[n]),p=(0,d.useCallback)(()=>{c(!1)},[]),m={url:n??``,isOpen:s,onClose:p,onConfirm:f};return o!=null&&o.enabled&&n?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`button`,{className:a(`wrap-anywhere appearance-none text-left font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,onClick:u,type:`button`,children:e}),o.renderModal?o.renderModal(m):(0,_.jsx)(VN,{...m})]}):(0,_.jsx)(`a`,{className:a(`wrap-anywhere font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,href:n,rel:`noreferrer`,target:`_blank`,...i,children:e})},(e,t)=>uP(e,t)&&e.href===t.href);bP.displayName=`MarkdownA`;var xP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`h1`,{className:pN()(`mt-6 mb-2 font-semibold text-3xl`,t),"data-streamdown":`heading-1`,...r,children:e}),(e,t)=>uP(e,t));xP.displayName=`MarkdownH1`;var SP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`h2`,{className:pN()(`mt-6 mb-2 font-semibold text-2xl`,t),"data-streamdown":`heading-2`,...r,children:e}),(e,t)=>uP(e,t));SP.displayName=`MarkdownH2`;var CP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`h3`,{className:pN()(`mt-6 mb-2 font-semibold text-xl`,t),"data-streamdown":`heading-3`,...r,children:e}),(e,t)=>uP(e,t));CP.displayName=`MarkdownH3`;var wP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`h4`,{className:pN()(`mt-6 mb-2 font-semibold text-lg`,t),"data-streamdown":`heading-4`,...r,children:e}),(e,t)=>uP(e,t));wP.displayName=`MarkdownH4`;var TP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`h5`,{className:pN()(`mt-6 mb-2 font-semibold text-base`,t),"data-streamdown":`heading-5`,...r,children:e}),(e,t)=>uP(e,t));TP.displayName=`MarkdownH5`;var EP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`h6`,{className:pN()(`mt-6 mb-2 font-semibold text-sm`,t),"data-streamdown":`heading-6`,...r,children:e}),(e,t)=>uP(e,t));EP.displayName=`MarkdownH6`;var DP=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let{controls:i}=(0,d.useContext)(RF);return(0,_.jsx)(iP,{className:t,showControls:dP(i,`table`),showCopy:fP(i,`copy`),showDownload:fP(i,`download`),showFullscreen:fP(i,`fullscreen`),...r,children:e})},(e,t)=>uP(e,t));DP.displayName=`MarkdownTable`;var OP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`thead`,{className:pN()(`bg-muted/80`,t),"data-streamdown":`table-header`,...r,children:e}),(e,t)=>uP(e,t));OP.displayName=`MarkdownThead`;var kP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`tbody`,{className:pN()(`divide-y divide-border`,t),"data-streamdown":`table-body`,...r,children:e}),(e,t)=>uP(e,t));kP.displayName=`MarkdownTbody`;var AP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`tr`,{className:pN()(`border-border`,t),"data-streamdown":`table-row`,...r,children:e}),(e,t)=>uP(e,t));AP.displayName=`MarkdownTr`;var jP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`th`,{className:pN()(`whitespace-nowrap px-4 py-2 text-left font-semibold text-sm`,t),"data-streamdown":`table-header-cell`,...r,children:e}),(e,t)=>uP(e,t));jP.displayName=`MarkdownTh`;var MP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`td`,{className:pN()(`px-4 py-2 text-sm`,t),"data-streamdown":`table-cell`,...r,children:e}),(e,t)=>uP(e,t));MP.displayName=`MarkdownTd`;var NP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`blockquote`,{className:pN()(`my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic`,t),"data-streamdown":`blockquote`,...r,children:e}),(e,t)=>uP(e,t));NP.displayName=`MarkdownBlockquote`;var PP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`sup`,{className:pN()(`text-sm`,t),"data-streamdown":`superscript`,...r,children:e}),(e,t)=>uP(e,t));PP.displayName=`MarkdownSup`;var FP=(0,d.memo)(({children:e,className:t,node:n,...r})=>(0,_.jsx)(`sub`,{className:pN()(`text-sm`,t),"data-streamdown":`subscript`,...r,children:e}),(e,t)=>uP(e,t));FP.displayName=`MarkdownSub`;var IP=(0,d.memo)(({children:e,className:t,node:n,...r})=>{if(`data-footnotes`in r){let n=e=>{if(!(0,d.isValidElement)(e))return!1;let t=Array.isArray(e.props.children)?e.props.children:[e.props.children],n=!1,r=!1;for(let e of t)if(e){if(typeof e==`string`)e.trim()!==``&&(n=!0);else if((0,d.isValidElement)(e))if(e.props?.[`data-footnote-backref`]!==void 0)r=!0;else{let t=Array.isArray(e.props.children)?e.props.children:[e.props.children];for(let e of t){if(typeof e==`string`&&e.trim()!==``){n=!0;break}if((0,d.isValidElement)(e)&&e.props?.[`data-footnote-backref`]===void 0){n=!0;break}}}}return r&&!n},i=Array.isArray(e)?e.map(e=>{if(!(0,d.isValidElement)(e))return e;if(e.type===hP){let t=(Array.isArray(e.props.children)?e.props.children:[e.props.children]).filter(e=>!n(e));return t.length===0?null:{...e,props:{...e.props,children:t}}}return e}):e;return(Array.isArray(i)?i.some(e=>e!==null):i!==null)?(0,_.jsx)(`section`,{className:t,...r,children:i}):null}return(0,_.jsx)(`section`,{className:t,...r,children:e})},(e,t)=>uP(e,t));IP.displayName=`MarkdownSection`;var LP=(0,d.memo)(({node:e,className:t,children:n,...r})=>{let i=pN(),a=!(`data-block`in r),{mermaid:o,controls:s,lineNumbers:c}=(0,d.useContext)(RF),l=GN(),u=sN(),f=(t?.match(cP))?.at(1)??``,p=KN(f);if(a)return(0,_.jsx)(`code`,{className:i(`rounded bg-muted px-1.5 py-0.5 font-mono text-sm`,t),"data-streamdown":`inline-code`,...r,children:n});let m=e?.properties?.metastring,h=m?.match(aP),g=h?Number.parseInt(h[1],10):void 0,v=g!==void 0&&g>=1?g:void 0,y=!(m&&oP.test(m))&&c!==!1,b=``;if((0,d.isValidElement)(n)&&n.props&&typeof n.props==`object`&&`children`in n.props&&typeof n.props.children==`string`?b=n.props.children:typeof n==`string`&&(b=n),p){let e=p.component;return(0,_.jsx)(d.Suspense,{fallback:(0,_.jsx)(FN,{}),children:(0,_.jsx)(e,{code:b,isIncomplete:u,language:f,meta:m})})}if(f===`mermaid`&&l){let e=dP(s,`mermaid`),n=mP(s,`download`),r=mP(s,`copy`),a=mP(s,`fullscreen`),c=mP(s,`panZoom`),l=e&&(n||r||a);return(0,_.jsx)(d.Suspense,{fallback:(0,_.jsx)(FN,{}),children:(0,_.jsxs)(`div`,{className:i(`group relative my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2`,t),"data-streamdown":`mermaid-block`,children:[(0,_.jsx)(`div`,{className:i(`flex h-8 items-center text-muted-foreground text-xs`),children:(0,_.jsx)(`span`,{className:i(`ml-1 font-mono lowercase`),children:`mermaid`})}),l?(0,_.jsx)(`div`,{className:i(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,_.jsxs)(`div`,{className:i(`pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur`),"data-streamdown":`mermaid-block-actions`,children:[n?(0,_.jsx)(JN,{chart:b,config:o?.config}):null,r?(0,_.jsx)(MN,{code:b}):null,a?(0,_.jsx)(YN,{chart:b,config:o?.config}):null]})}):null,(0,_.jsx)(`div`,{className:i(`rounded-md border border-border bg-background`),children:(0,_.jsx)(sP,{chart:b,config:o?.config,showControls:c})})]})})}let x=dP(s,`code`),S=pP(s,`download`),C=pP(s,`copy`);return(0,_.jsx)(CN,{className:t,code:b,isIncomplete:u,language:f,lineNumbers:y,startLine:v,children:x?(0,_.jsxs)(_.Fragment,{children:[S?(0,_.jsx)(PN,{code:b,language:f}):null,C?(0,_.jsx)(MN,{}):null]}):null})},(e,t)=>e.className===t.className&&lP(e.node,t.node));LP.displayName=`MarkdownCode`;var RP=(0,d.memo)(LN,(e,t)=>e.className===t.className&&lP(e.node,t.node));RP.displayName=`MarkdownImg`;var zP=(0,d.memo)(({children:e,node:t,...n})=>{let r=(Array.isArray(e)?e:[e]).filter(e=>e!=null&&e!==``);if(r.length===1&&(0,d.isValidElement)(r[0])){let t=r[0].props.node?.tagName;if(t===`img`||t===`code`&&`data-block`in r[0].props)return(0,_.jsx)(_.Fragment,{children:e})}return(0,_.jsx)(`p`,{...n,children:e})},(e,t)=>uP(e,t));zP.displayName=`MarkdownParagraph`;var BP={ol:hP,li:gP,ul:_P,hr:vP,strong:yP,a:bP,h1:xP,h2:SP,h3:CP,h4:wP,h5:TP,h6:EP,table:DP,thead:OP,tbody:kP,tr:AP,th:jP,td:MP,blockquote:NP,code:LP,img:RP,pre:({children:e})=>(0,d.isValidElement)(e)?(0,d.cloneElement)(e,{"data-block":`true`}):e,sup:PP,sub:FP,p:zP,section:IP},VP=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,HP=/\p{L}/u;function UP(e){let t=e.replace(/^#{1,6}\s+/gm,``).replace(/(\*{1,3}|_{1,3})/g,``).replace(/`[^`]*`/g,``).replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/^[\s>*\-+\d.]+/gm,``);for(let e of t){if(VP.test(e))return`rtl`;if(HP.test(e))return`ltr`}return`ltr`}var WP=/^[ \t]{0,3}(`{3,}|~{3,})/,GP=/^\|?[ \t]*:?-{1,}:?[ \t]*(\|[ \t]*:?-{1,}:?[ \t]*)*\|?$/,KP=e=>{let t=e.split(`
|
|
179
179
|
`),n=null,r=0;for(let e of t){let t=WP.exec(e);if(n===null){if(t){let e=t[1];n=e[0],r=e.length}}else if(t){let e=t[1],i=e[0],a=e.length;i===n&&a>=r&&(n=null,r=0)}}return n!==null},qP=e=>{let t=e.split(`
|
|
180
180
|
`);for(let e of t){let t=e.trim();if(t.length>0&&t.includes(`|`)&&GP.test(t))return!0}return!1},JP=()=>e=>{Sm(e,`html`,(e,t,n)=>{!n||typeof t!=`number`||(n.children[t]={type:`text`,value:e.value})})},YP=[],XP={allowDangerousHtml:!0},ZP=new WeakMap,QP=new class{constructor(){this.cache=new Map,this.keyCache=new WeakMap,this.maxSize=100}generateCacheKey(e){let t=this.keyCache.get(e);if(t)return t;let n=e.rehypePlugins,r=e.remarkPlugins,i=e.remarkRehypeOptions;if(!(n||r||i)){let t=`default`;return this.keyCache.set(e,t),t}let a=e=>{if(!e||e.length===0)return``;let t=``;for(let n=0;n<e.length;n+=1){let r=e[n];if(n>0&&(t+=`,`),Array.isArray(r)){let[e,n]=r;if(typeof e==`function`){let n=ZP.get(e);n||(n=e.name,ZP.set(e,n)),t+=n}else t+=String(e);t+=`:`,t+=JSON.stringify(n)}else if(typeof r==`function`){let e=ZP.get(r);e||(e=r.name,ZP.set(r,e)),t+=e}else t+=String(r)}return t},o=a(n),s=`${a(r)}::${o}::${i?JSON.stringify(i):``}`;return this.keyCache.set(e,s),s}get(e){let t=this.generateCacheKey(e),n=this.cache.get(t);return n&&(this.cache.delete(t),this.cache.set(t,n)),n}set(e,t){let n=this.generateCacheKey(e);if(this.cache.size>=this.maxSize){let e=this.cache.keys().next().value;e&&this.cache.delete(e)}this.cache.set(n,t)}clear(){this.cache.clear()}},$P=e=>{let t=eF(e),n=e.children||``;return sF(t.runSync(t.parse(n),n),e)},eF=e=>{let t=QP.get(e);if(t)return t;let n=nF(e);return QP.set(e,n),n},tF=e=>e.some(e=>Array.isArray(e)?e[0]===Kb:e===Kb),nF=e=>{let t=e.rehypePlugins||YP,n=e.remarkPlugins||YP,r=tF(t)?n:[...n,JP],i=e.remarkRehypeOptions?{...XP,...e.remarkRehypeOptions}:XP;return nj().use(Lk).use(r).use(OA,i).use(t)},rF=e=>e,iF=(e,t,n,r)=>{n?e.children.splice(t,1):e.children[t]={type:`text`,value:r}},aF=(e,t)=>{for(let n in QO)if(Object.hasOwn(QO,n)&&Object.hasOwn(e.properties,n)){let r=e.properties[n],i=QO[n];(i===null||i.includes(e.tagName))&&(e.properties[n]=t(String(r||``),n,e)??void 0)}},oF=(e,t,n,r,i,a)=>{let o=!1;return r?o=!r.includes(e.tagName):i&&(o=i.includes(e.tagName)),!o&&a&&typeof t==`number`&&(o=!a(e,t,n)),o},sF=(e,t)=>{let{allowElement:n,allowedElements:r,disallowedElements:i,skipHtml:a,unwrapDisallowed:o,urlTransform:s}=t;if(n||r||i||a||s){let t=s||rF;Sm(e,(e,s,c)=>{if(e.type===`raw`&&c&&typeof s==`number`)return iF(c,s,a,e.value),s;if(e.type===`element`&&(aF(e,t),oF(e,s,c,r,i,n)&&c&&typeof s==`number`))return o&&e.children?c.children.splice(s,1,...e.children):c.children.splice(s,1),s})}return AO(e,{Fragment:_.Fragment,components:t.components,ignoreInvalidStyle:!0,jsx:_.jsx,jsxs:_.jsxs,passKeys:!0,passNode:!0})},cF=/\[\^[\w-]{1,200}\](?!:)/,lF=/\[\^[\w-]{1,200}\]:/,uF=/<(\w+)[\s>]/,dF=new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`]),fF=new Map,pF=new Map,mF=e=>{let t=e.toLowerCase(),n=fF.get(t);if(n)return n;let r=RegExp(`<${t}(?=[\\s>/])[^>]*>`,`gi`);return fF.set(t,r),r},hF=e=>{let t=e.toLowerCase(),n=pF.get(t);if(n)return n;let r=RegExp(`</${t}(?=[\\s>])[^>]*>`,`gi`);return pF.set(t,r),r},gF=(e,t)=>{if(dF.has(t.toLowerCase()))return 0;let n=e.match(mF(t));if(!n)return 0;let r=0;for(let e of n)e.trimEnd().endsWith(`/>`)||(r+=1);return r},_F=(e,t)=>{let n=e.match(hF(t));return n?n.length:0},vF=e=>{let t=0;for(let n=0;n<e.length-1;n+=1)e[n]===`$`&&e[n+1]===`$`&&(t+=1,n+=1);return t},yF=e=>{let t=cF.test(e),n=lF.test(e);if(t||n)return[e];let r=FM.lex(e,{gfm:!0}),i=[],a=[],o=!1;for(let e of r){let t=e.raw,n=i.length;if(a.length>0){i[n-1]+=t;let e=a.at(-1),r=gF(t,e),o=_F(t,e);for(let t=0;t<r;t+=1)a.push(e);for(let t=0;t<o;t+=1)a.length>0&&a.at(-1)===e&&a.pop();continue}if(e.type===`html`&&e.block){let e=t.match(uF);if(e){let n=e[1];gF(t,n)>_F(t,n)&&a.push(n)}}if(n>0&&!o){let e=i[n-1];if(vF(e)%2==1){i[n-1]=e+t;continue}}i.push(t),e.type!==`space`&&(o=e.type===`code`)}return i},bF=(e,t)=>{if(!t.length)return e;let n=e;for(let e of t){let t=RegExp(`(<${e}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${e}\\s*>)`,`gi`);n=n.replace(t,(e,t,n,r)=>{if(!n.includes(`
|
|
181
181
|
|
|
@@ -338,7 +338,7 @@ XID_Continue XIDC
|
|
|
338
338
|
XID_Start XIDS`.split(/\s/).map(e=>[BH(e),e])),PU=new Map([[`s`,vU(383)],[vU(383),`s`]]),FU=new Map([[vU(223),vU(7838)],[vU(107),vU(8490)],[vU(229),vU(8491)],[vU(969),vU(8486)]]),IU=new Map([zU(453),zU(456),zU(459),zU(498),...BU(8072,8079),...BU(8088,8095),...BU(8104,8111),zU(8124),zU(8140),zU(8188)]),LU=new Map([[`alnum`,yU`[\p{Alpha}\p{Nd}]`],[`alpha`,yU`\p{Alpha}`],[`ascii`,yU`\p{ASCII}`],[`blank`,yU`[\p{Zs}\t]`],[`cntrl`,yU`\p{Cc}`],[`digit`,yU`\p{Nd}`],[`graph`,yU`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],[`lower`,yU`\p{Lower}`],[`print`,yU`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],[`punct`,yU`[\p{P}\p{S}]`],[`space`,yU`\p{space}`],[`upper`,yU`\p{Upper}`],[`word`,yU`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],[`xdigit`,yU`\p{AHex}`]]);function RU(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function zU(e){let t=vU(e);return[t.toLowerCase(),t]}function BU(e,t){return RU(e,t).map(e=>zU(e))}var VU=new Set([`Lower`,`Lowercase`,`Upper`,`Uppercase`,`Ll`,`Lowercase_Letter`,`Lt`,`Titlecase_Letter`,`Lu`,`Uppercase_Letter`]);function HU(e,t){let n={accuracy:`default`,asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:`ES2025`,...t};KU(e);let r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:wU(n.bestEffortTarget,`ES2024`),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};UH(e,UU,r);let i={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},a={currentFlags:i,prevFlags:null,globalFlags:i,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};return UH(e,WU,a),UH(e,GU,{groupsByName:a.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:a.reffedNodesByReferencer}),e._originMap=a.groupOriginByCopy,e._strategy=r.strategy,e}var UU={AbsenceFunction({node:e,parent:t,replaceWith:n}){let{body:r,kind:i}=e;if(i===`repeater`){let e=TH();e.body[0].body.push(EH({negate:!0,body:r}),MH(`Any`));let i=TH();i.body[0].body.push(kH(`greedy`,0,1/0,e)),n(dW(i,t),{traverse:!0})}else throw Error(`Unsupported absence function "(?~|"`)},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:r}){let i=e.body.filter(e=>e.kind===`flags`);for(let e=n+1;e<t.body.length;e++){let n=t.body[e];CU(r,n,[]).push(...i)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let n=$U(t.get(e));if(n){let t=TH({flags:n});t.body[0].body=e.body,e.body=[dW(t,e)]}}}},Assertion({node:e,parent:t,key:n,container:r,root:i,remove:a,replaceWith:o},s){let{kind:c,negate:l}=e,{asciiWordBoundaries:u,avoidSubclass:d,supportedGNodes:f,wordIsAscii:p}=s;if(c===`text_segment_boundary`)throw Error(`Unsupported text segment boundary "\\${l?`Y`:`y`}"`);if(c===`line_end`)o(dW(EH({body:[hH({body:[gH(`string_end`)]}),hH({body:[yH(10)]})]}),t));else if(c===`line_start`)o(dW(cW(yU`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if(c===`search_start`)if(f.has(e))i.flags.sticky=!0,a();else{let e=r[n-1];if(e&&aW(e))o(dW(EH({negate:!0}),t));else if(d)throw Error(yU`Uses "\G" in a way that requires a subclass`);else o(uW(gH(`string_start`),t)),s.strategy=`clip_search`}else if(!(c===`string_end`||c===`string_start`))if(c===`string_end_newline`)o(dW(cW(yU`(?=\n?\z)`),t));else if(c===`word_boundary`){if(!p&&!u){let e=`(?:(?<=${jU})(?!${jU})|(?<!${jU})(?=${jU}))`,n=`(?:(?<=${jU})(?=${jU})|(?<!${jU})(?!${jU}))`;o(dW(cW(l?n:e),t))}}else throw Error(`Unexpected assertion kind "${c}"`)},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!sW(n)&&(n=QU(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!sW(r)&&(r=QU(r,t),e.name=r),n.set(e.number,e),r&&n.set(r,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){t.kind===`intersection`&&n(dW(bH({body:[e]}),t),{traverse:!0})},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:r,minTargetEs2024:i,digitIsAscii:a,spaceIsAscii:o,wordIsAscii:s}){let{kind:c,negate:l,value:u}=e;if(a&&(c===`digit`||u===`digit`)){n(uW(SH(`digit`,{negate:l}),t));return}if(o&&(c===`space`||u===`space`)){n(dW(lW(cW(kU),l),t));return}if(s&&(c===`word`||u===`word`)){n(uW(SH(`word`,{negate:l}),t));return}if(c===`any`)n(uW(MH(`Any`),t));else if(c===`digit`)n(uW(MH(`Nd`,{negate:l}),t));else if(c!==`dot`)if(c===`text_segment`){if(r===`strict`)throw Error(yU`Use of "\X" requires non-strict accuracy`);let e=`\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?`,a=yU`\p{RI}{2}|${e}(?:\u200D${e})*`;n(dW(cW(yU`(?>\r\n|${i?yU`\p{RGI_Emoji}`:a}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(c===`hex`)n(uW(MH(`AHex`,{negate:l}),t));else if(c===`newline`)n(dW(cW(l?`[^
|
|
339
339
|
]`:`(?>\r
|
|
340
340
|
?|[
|
|
341
|
-
\v\f
\u2028\u2029])`),t));else if(c===`posix`)if(!i&&(u===`graph`||u===`print`)){if(r===`strict`)throw Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let e={graph:`!-~`,print:` -~`}[u];l&&(e=`\0-${vU(e.codePointAt(0)-1)}${vU(e.codePointAt(2)+1)}-\u{10FFFF}`),n(dW(cW(`[${e}]`),t))}else n(dW(lW(cW(LU.get(u)),l),t));else if(c===`property`)NU.has(BH(u))||(e.key=`sc`);else if(c===`space`)n(uW(MH(`space`,{negate:l}),t));else if(c===`word`)n(dW(lW(cW(jU),l),t));else throw Error(`Unexpected character set kind "${c}"`)},Directive({node:e,parent:t,root:n,remove:r,replaceWith:i,removeAllPrevSiblings:a,removeAllNextSiblings:o}){let{kind:s,flags:c}=e;if(s===`flags`)if(!c.enable&&!c.disable)r();else{let e=TH({flags:c});e.body[0].body=o(),i(dW(e,t),{traverse:!0})}else if(s===`keep`){let e=n.body[0],r=n.body.length===1&&nH(e,{type:`Group`})&&e.body[0].body.length===1?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw Error(yU`Uses "\K" in a way that's unsupported`);let o=EH({behind:!0});o.body[0].body=a(),i(dW(o,t))}else throw Error(`Unexpected directive kind "${s}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw Error(`Unsupported flag "P"`);if(e.textSegmentMode===`word`)throw Error(`Unsupported flag "y{w}"`);[`digitIsAscii`,`extended`,`posixIsAscii`,`spaceIsAscii`,`wordIsAscii`,`textSegmentMode`].forEach(t=>delete e[t]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;let{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){let{kind:n}=e;n===`lookbehind`&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){let{kind:r}=e;if(r===`fail`)n(dW(EH({negate:!0}),t));else throw Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type===`Quantifier`){let t=TH();t.body[0].body.push(e.body),e.body=dW(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let n=[],r=!1,i=!1;for(let t of e.body)if(t.body.length===1&&t.body[0].kind===`search_start`)t.body.pop();else{let e=nW(t.body);e?(r=!0,Array.isArray(e)?n.push(...e):n.push(e)):i=!0}r&&!i&&n.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if(t===`strict`&&n&&r)throw Error(yU`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!sW(n)&&(n=QU(n,t),e.ref=n)}},WU={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){let{orphan:r,ref:i}=e;r||n.set(e,[...t.get(i).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:i,groupsByName:a,multiplexCapturesToLeftByRef:o,openRefs:s,reffedNodesByReferencer:c}){let l=i.get(e);if(l&&s.has(e.number)){let r=uW(XU(e.number),t);c.set(r,s.get(e.number)),n(r);return}s.set(e.number,e),o.set(e.number,[]),e.name&&CU(o,e.name,[]);let u=o.get(e.name??e.number);for(let t=0;t<u.length;t++){let n=u[t];if(l===n.node||l&&l===n.origin||e===n.origin){u.splice(t,1);break}}if(o.get(e.number).push({node:e,origin:l}),e.name&&o.get(e.name).push({node:e,origin:l}),e.name){let t=CU(a,e.name,new Map),n=!1;if(l)n=!0;else for(let e of t.values())if(!e.hasDuplicateNameToRemove){n=!0;break}a.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:n})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=SU(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){let{isRecursive:i,ref:a}=e;if(i){let n=t;for(;(n=n.parent)&&!(n.type===`CapturingGroup`&&(n.name===a||n.number===a)););r.reffedNodesByReferencer.set(e,n);return}let o=r.subroutineRefMap.get(a),s=a===0,c=s?XU(0):YU(o,r.groupOriginByCopy,null),l=c;if(!s){let e=$U(ZU(o,e=>e.type===`Group`&&!!e.flags)),t=e?SU(r.globalFlags,e):r.globalFlags;qU(t,r.currentFlags)||(l=TH({flags:eW(t)}),l.body[0].body.push(c))}n(dW(l,t),{traverse:!s})}},GU={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}let i=r.reffedNodesByReferencer.get(e).filter(t=>JU(t,e));i.length?i.length>1?n(dW(TH({atomic:!0,body:i.reverse().map(e=>hH({body:[_H(e.number)]}))}),t)):e.ref=i[0].number:n(dW(EH({negate:!0}),t))},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){let n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let t=0;t<n;t++){let t=vH();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){!e.isRecursive||e.ref===0||(e.ref=t.reffedNodesByReferencer.get(e).number)}};function KU(e){UH(e,{"*"({node:e,parent:t}){e.parent=t}})}function qU(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function JU(e,t){let n=t;do{if(n.type===`Regex`)return!1;if(n.type===`Alternative`)continue;if(n===e)return!1;let t=tW(n.parent);for(let r of t){if(r===n)break;if(r===e||rW(r,e))return!0}}while(n=n.parent);throw Error(`Unexpected path`)}function YU(e,t,n,r){let i=Array.isArray(e)?[]:{};for(let[a,o]of Object.entries(e))a===`parent`?i.parent=Array.isArray(n)?r:n:o&&typeof o==`object`?i[a]=YU(o,t,i,n):(a===`type`&&o===`CapturingGroup`&&t.set(i,t.get(e)??e),i[a]=o);return i}function XU(e){let t=jH(e);return t.isRecursive=!0,t}function ZU(e,t){let n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function QU(e,t){if(t.has(e))return t.get(e);let n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/gu,`_`)}`;return t.set(e,n),n}function $U(e){let t=[`dotAll`,`ignoreCase`],n={enable:{},disable:{}};return e.forEach(({flags:e})=>{t.forEach(t=>{e.enable?.[t]&&(delete n.disable[t],n.enable[t]=!0),e.disable?.[t]&&(n.disable[t]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function eW({dotAll:e,ignoreCase:t}){let n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),(!e||!t)&&(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function tW(e){if(!e)throw Error(`Node expected`);let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function nW(e){let t=e.find(e=>e.kind===`search_start`||oW(e,{negate:!1})||!iW(e));if(!t)return null;if(t.kind===`search_start`)return t;if(t.type===`LookaroundAssertion`)return t.body[0].body[0];if(t.type===`CapturingGroup`||t.type===`Group`){let e=[];for(let n of t.body){let t=nW(n.body);if(!t)return null;Array.isArray(t)?e.push(...t):e.push(t)}return e}return null}function rW(e,t){let n=tW(e)??[];for(let e of n)if(e===t||rW(e,t))return!0;return!1}function iW({type:e}){return e===`Assertion`||e===`Directive`||e===`LookaroundAssertion`}function aW(e){let t=[`Character`,`CharacterClass`,`CharacterSet`];return t.includes(e.type)||e.type===`Quantifier`&&e.min&&t.includes(e.body.type)}function oW(e,t){let n={negate:null,...t};return e.type===`LookaroundAssertion`&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&nH(e.body[0],{type:`Assertion`,kind:`search_start`})}function sW(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function cW(e,t){let n=aH(e,{...t,unicodePropertyMap:NU}).body;return n.length>1||n[0].body.length>1?TH({body:n}):n[0].body[0]}function lW(e,t){return e.negate=t,e}function uW(e,t){return e.parent=t,e}function dW(e,t){return KU(e),e.parent=t,e}function fW(e,t){let n=OU(t),r=wU(n.target,`ES2024`),i=wU(n.target,`ES2025`),a=n.rules.recursionLimit;if(!Number.isInteger(a)||a<2||a>20)throw Error(`Invalid recursionLimit; use 2-20`);let o=null,s=null;if(!i){let t=[e.flags.ignoreCase];UH(e,pW,{getCurrentModI:()=>t.at(-1),popModI(){t.pop()},pushModI(e){t.push(e)},setHasCasedChar(){t.at(-1)?o=!0:s=!0}})}let c={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||o)&&!s)},l=e,u={accuracy:n.accuracy,appliedGlobalFlags:c,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:l,originMap:e._originMap,recursionLimit:a,useAppliedIgnoreCase:!!(!i&&o&&s),useFlagMods:i,useFlagV:r,verbose:n.verbose};function d(e){return u.lastNode=l,l=e,TU(mW[e.type],`Unexpected node type "${e.type}"`)(e,u,d)}let f={pattern:e.body.map(d).join(`|`),flags:d(e.flags),options:{...e.options}};return r||(delete f.options.force.v,f.options.disable.v=!0,f.options.unicodeSetsPlugin=null),f._captureTransfers=new Map,f._hiddenCaptures=[],u.captureMap.forEach((e,t)=>{e.hidden&&f._hiddenCaptures.push(t),e.transferTo&&CU(f._captureTransfers,e.transferTo,[]).push(t)}),f}var pW={"*":{enter({node:e},t){if(EW(e)){let n=t.getCurrentModI();t.pushModI(e.flags?SU({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){EW(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){bW(vU(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),xW(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind===`property`&&VU.has(e.value)&&t.setHasCasedChar()}},mW={Alternative({body:e},t,n){return e.map(n).join(``)},Assertion({kind:e,negate:t}){if(e===`string_end`)return`$`;if(e===`string_start`)return`^`;if(e===`word_boundary`)return t?yU`\B`:yU`\b`;throw Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!=`number`)throw Error(`Unexpected named backref in transformed AST`);if(!t.useFlagMods&&t.accuracy===`strict`&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw Error(`Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy`);return`\\`+e},CapturingGroup(e,t,n){let{body:r,name:i,number:a}=e,o={ignoreCase:t.currentFlags.ignoreCase},s=t.originMap.get(e);return s&&(o.hidden=!0,a>s.number&&(o.transferTo=s.number)),t.captureMap.set(a,o),`(${i?`?<${i}>`:``}${r.map(n).join(`|`)})`},Character({value:e},t){let n=vU(e),r=SW(e,{escDigit:t.lastNode.type===`Backreference`,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&bW(n)){let e=MU(n);return t.inCharClass?e.join(``):e.length>1?`[${e.join(``)}]`:e[0]}return n},CharacterClass(e,t,n){let{kind:r,negate:i,parent:a}=e,{body:o}=e;if(r===`intersection`&&!t.useFlagV)throw Error(`Use of character class intersection requires min target ES2024`);bU.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&o.some(OW)&&(o=[yH(45),...o.filter(e=>!OW(e))]);let s=()=>`[${i?`^`:``}${o.map(n).join(r===`intersection`?`&&`:``)}]`;if(!t.inCharClass){if((!t.useFlagV||bU.bugNestedClassIgnoresNegation)&&!i){let t=o.filter(e=>e.type===`CharacterClass`&&e.kind===`union`&&e.negate);if(t.length){let r=TH(),i=r.body[0];return r.parent=a,i.parent=r,o=o.filter(e=>!t.includes(e)),e.body=o,o.length?(e.parent=i,i.body.push(e)):r.body.pop(),t.forEach(e=>{let t=hH({body:[e]});e.parent=t,t.parent=r,r.body.push(t)}),n(r)}}t.inCharClass=!0;let r=s();return t.inCharClass=!1,r}let c=o[0];if(r===`union`&&!i&&c&&((!t.useFlagV||!t.verbose)&&a.kind===`union`&&!(bU.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&a.kind===`intersection`&&o.length===1&&c.type!==`CharacterClassRange`))return o.map(n).join(``);if(!t.useFlagV&&a.type===`CharacterClass`)throw Error(`Uses nested character class in a way that requires min target ES2024`);return s()},CharacterClassRange(e,t){let n=e.min.value,r=e.max.value,i={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},a=SW(n,i),o=SW(r,i),s=new Set;return t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&CW(xW(e)).forEach(e=>{s.add(Array.isArray(e)?`${SW(e[0],i)}-${SW(e[1],i)}`:SW(e,i))}),`${a}-${o}${[...s].join(``)}`},CharacterSet({kind:e,negate:t,value:n,key:r},i){if(e===`dot`)return i.currentFlags.dotAll?i.appliedGlobalFlags.dotAll||i.useFlagMods?`.`:`[^]`:yU`[^\n]`;if(e===`digit`)return t?yU`\D`:yU`\d`;if(e===`property`){if(i.useAppliedIgnoreCase&&i.currentFlags.ignoreCase&&VU.has(n))throw Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?yU`\P`:yU`\p`}{${r?`${r}=`:``}${n}}`}if(e===`word`)return t?yU`\W`:yU`\w`;throw Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?`i`:``)+(e.dotAll?`s`:``)+(e.sticky?`y`:``)},Group({atomic:e,body:t,flags:n,parent:r},i,a){let o=i.currentFlags;n&&(i.currentFlags=SU(o,n));let s=t.map(a).join(`|`),c=!i.verbose&&t.length===1&&r.type!==`Quantifier`&&!e&&(!i.useFlagMods||!n)?s:`(?${wW(e,n,i.useFlagMods)}${s})`;return i.currentFlags=o,c},LookaroundAssertion({body:e,kind:t,negate:n},r,i){return`(?${`${t===`lookahead`?``:`<`}${n?`!`:`=`}`}${e.map(i).join(`|`)})`},Quantifier(e,t,n){return n(e.body)+TW(e)},Subroutine({isRecursive:e,ref:t},n){if(!e)throw Error(`Unexpected non-recursive subroutine in transformed AST`);let r=n.recursionLimit;return t===0?`(?R=${r})`:yU`\g<${t}&R=${r}>`}},hW=new Set([`$`,`(`,`)`,`*`,`+`,`.`,`?`,`[`,`\\`,`]`,`^`,`{`,`|`,`}`]),gW=new Set([`-`,`\\`,`]`,`^`,`[`]),_W=new Set("()-/[\\]^{|}!#$%&*+,.:;<=>?@`~".split(``)),vW=new Map([[9,yU`\t`],[10,yU`\n`],[11,yU`\v`],[12,yU`\f`],[13,yU`\r`],[8232,yU`\u2028`],[8233,yU`\u2029`],[65279,yU`\uFEFF`]]),yW=/^\p{Cased}$/u;function bW(e){return yW.test(e)}function xW(e,t){let n=!!t?.firstOnly,r=e.min.value,i=e.max.value,a=[];if(r<65&&(i===65535||i>=131071)||r===65536&&i>=131071)return a;for(let e=r;e<=i;e++){let t=vU(e);if(!bW(t))continue;let o=MU(t).filter(e=>{let t=e.codePointAt(0);return t<r||t>i});if(o.length&&(a.push(...o),n))break}return a}function SW(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(vW.has(e))return vW.get(e);if(e<32||e>126&&e<160||e>262143||t&&DW(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,`0`)}`;let i=n?r?_W:gW:hW,a=vU(e);return(i.has(a)?`\\`:``)+a}function CW(e){let t=e.map(e=>e.codePointAt(0)).sort((e,t)=>e-t),n=[],r=null;for(let e=0;e<t.length;e++)t[e+1]===t[e]+1?r??=t[e]:r===null?n.push(t[e]):(n.push([r,t[e]]),r=null);return n}function wW(e,t,n){if(e)return`>`;let r=``;if(t&&n){let{enable:e,disable:n}=t;r=(e?.ignoreCase?`i`:``)+(e?.dotAll?`s`:``)+(n?`-`:``)+(n?.ignoreCase?`i`:``)+(n?.dotAll?`s`:``)}return`${r}:`}function TW({kind:e,max:t,min:n}){let r;return r=!n&&t===1?`?`:!n&&t===1/0?`*`:n===1&&t===1/0?`+`:n===t?`{${n}}`:`{${n},${t===1/0?``:t}}`,r+{greedy:``,lazy:`?`,possessive:`+`}[e]}function EW({type:e}){return e===`CapturingGroup`||e===`Group`||e===`LookaroundAssertion`}function DW(e){return e>47&&e<58}function OW({type:e,value:t}){return e===`Character`&&t===45}var kW=class e extends RegExp{#e=new Map;#t=null;#n;#r=null;#i=null;rawOptions={};get source(){return this.#n||`(?:)`}constructor(t,n,r){let i=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw Error(`Cannot provide options when copying a regexp`);let i=t;super(i,n),this.#n=i.source,i instanceof e&&(this.#e=i.#e,this.#r=i.#r,this.#i=i.#i,this.rawOptions=i.rawOptions)}else{let e={hiddenCaptures:[],strategy:null,transfers:[],...r};super(i?``:t,n),this.#n=t,this.#e=jW(e.hiddenCaptures,e.transfers),this.#i=e.strategy,this.rawOptions=r??{}}i||(this.#t=this)}exec(t){if(!this.#t){let{lazyCompile:t,...n}=this.rawOptions;this.#t=new e(this.#n,this.flags,n)}let n=this.global||this.sticky,r=this.lastIndex;if(this.#i===`clip_search`&&n&&r){this.lastIndex=0;let e=this.#a(t.slice(r));return e&&(AW(e,r,t,this.hasIndices),this.lastIndex+=r),e}return this.#a(t)}#a(e){this.#t.lastIndex=this.lastIndex;let t=super.exec.call(this.#t,e);if(this.lastIndex=this.#t.lastIndex,!t||!this.#e.size)return t;let n=[...t];t.length=1;let r;this.hasIndices&&(r=[...t.indices],t.indices.length=1);let i=[0];for(let e=1;e<n.length;e++){let{hidden:a,transferTo:o}=this.#e.get(e)??{};if(a?i.push(null):(i.push(t.length),t.push(n[e]),this.hasIndices&&t.indices.push(r[e])),o&&n[e]!==void 0){let a=i[o];if(!a)throw Error(`Invalid capture transfer to "${a}"`);if(t[a]=n[e],this.hasIndices&&(t.indices[a]=r[e]),t.groups){this.#r||=MW(this.source);let i=this.#r.get(o);i&&(t.groups[i]=n[e],this.hasIndices&&(t.indices.groups[i]=r[e]))}}}return t}};function AW(e,t,n,r){if(e.index+=t,e.input=n,r){let n=e.indices;for(let e=0;e<n.length;e++){let r=n[e];r&&(n[e]=[r[0]+t,r[1]+t])}let r=n.groups;r&&Object.keys(r).forEach(e=>{let n=r[e];n&&(r[e]=[n[0]+t,n[1]+t])})}}function jW(e,t){let n=new Map;for(let t of e)n.set(t,{hidden:!0});for(let[e,r]of t)for(let t of r)CU(n,t,{}).transferTo=e;return n}function MW(e){let t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map,r=0,i=0,a;for(;a=t.exec(e);){let{0:e,groups:{capture:t,name:o}}=a;e===`[`?r++:r?e===`]`&&r--:t&&(i++,o&&n.set(i,o))}return n}function NW(e,t){let n=PW(e,t);return n.options?new kW(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function PW(e,t){let n=OU(t),r=HU(aH(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:NU}),{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),i=fW(r,n),a=fU(i.pattern,{captureTransfers:i._captureTransfers,hiddenCaptures:i._hiddenCaptures,mode:`external`}),o=nU(aU(a.pattern).pattern,{captureTransfers:a.captureTransfers,hiddenCaptures:a.hiddenCaptures}),s={pattern:o.pattern,flags:`${n.hasIndices?`d`:``}${n.global?`g`:``}${i.flags}${i.options.disable.v?`u`:`v`}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw Error(`Lazy compilation requires subclass`)}else{let e=o.hiddenCaptures.sort((e,t)=>e-t),t=Array.from(o.captureTransfers),i=r._strategy,a=s.pattern.length>=n.lazyCompileLength;(e.length||t.length||i||a)&&(s.options={...e.length&&{hiddenCaptures:e},...t.length&&{transfers:t},...i&&{strategy:i},...a&&{lazyCompile:a}})}return s}var FW=[`github-light`,`github-dark`,`catppuccin-latte`,`catppuccin-mocha`,`tokyo-night`,`one-light`,`one-dark-pro`,`github-light-default`,`github-dark-default`,`light-plus`,`dark-plus`],IW=null,LW=null;function RW(){return LW?Promise.resolve(LW):(IW||=iV({themes:FW,langs:[]}).then(e=>(LW=e,e)),IW)}var zW=new Set;typeof window<`u`&&window.addEventListener(`codemini-theme-palette-change`,()=>{IW=null,LW=null,zW.clear()});async function BW(e){if(!e||zW.has(e))return;let t=await RW();try{t.getLoadedLanguages().includes(e)||await t.loadLanguage(e),zW.add(e)}catch{zW.add(e)}}function VW(){return RW().catch(()=>{}),{name:`shiki`,type:`code-highlighter`,getThemes:()=>FW,getSupportedLanguages:()=>LW?LW.getLoadedLanguages():[],supportsLanguage:e=>LW?LW.getLoadedLanguages().includes(e):!1,highlight:(e,t)=>{let{code:n,language:r}=e;return UW(n,r)||(BW(r).then(()=>{t&&t(UW(n,r)||HW(n))}),HW(n))}}}function HW(e){return{fg:void 0,bg:void 0,rootStyle:void 0,tokens:String(e??``).split(/\r?\n/).map(e=>[{content:e}])}}function UW(e,t){if(!LW)return null;try{if(!LW.getLoadedLanguages().includes(t))return null;let n=LW.codeToTokens(e,{lang:t,themes:WW(),defaultColor:!1});return{fg:n.fg,bg:n.bg,rootStyle:n.rootStyle,tokens:n.tokens}}catch{return null}}function WW(){if(typeof document>`u`)return{light:`github-light`,dark:`github-dark`};let e=document.documentElement.dataset.palette||`default`;return e===`catppuccin`?{light:`catppuccin-latte`,dark:`catppuccin-mocha`}:e===`tokyonight`?{light:`github-light`,dark:`tokyo-night`}:e===`one`?{light:`one-light`,dark:`one-dark-pro`}:e===`github`?{light:`github-light-default`,dark:`github-dark-default`}:e===`vscode`?{light:`light-plus`,dark:`dark-plus`}:{light:`github-light`,dark:`github-dark`}}var GW=VW(),KW=class extends d.Component{state={hasError:!1,retryCount:0};retryTimer=null;static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){console.warn(`Streamdown render failed; retrying with markdown renderer.`,e),!(this.state.retryCount>=2)&&(clearTimeout(this.retryTimer),this.retryTimer=window.setTimeout(()=>{this.setState(e=>({hasError:!1,retryCount:e.retryCount+1}))},80))}componentDidUpdate(e){(e.fallbackText!==this.props.fallbackText||e.resetKey!==this.props.resetKey)&&(this.state.hasError||this.state.retryCount)&&(clearTimeout(this.retryTimer),this.setState({hasError:!1,retryCount:0}))}componentWillUnmount(){clearTimeout(this.retryTimer)}render(){return this.state.hasError?(0,_.jsx)(`div`,{className:`msg-body whitespace-pre-wrap text-(--text-primary)`,children:this.props.fallbackText}):this.props.children}};function qW({text:e,streaming:t,className:n}){let r=typeof e==`string`?e:String(e||``);if(!r)return null;let i=t?`streaming`:`static`;return(0,_.jsx)(KW,{fallbackText:r,resetKey:i,children:(0,_.jsx)(`div`,{className:B(`msg-body`,t&&`streaming-cursor`,n),children:(0,_.jsx)(BF,{mode:i,isAnimating:t,parseIncompleteMarkdown:!0,showLineNumbers:!1,plugins:{code:GW},controls:{tables:!0,codeBlocks:!0,mermaid:{display:!0,wrap:!0}},children:r})})})}function JW({todos:e}){return e?.length?(0,_.jsx)(`div`,{className:`space-y-1 mt-2`,children:e.map((e,t)=>{let n=e.status===`completed`?`✓`:e.status===`in_progress`?`●`:``;return(0,_.jsxs)(`div`,{className:B(`flex items-center gap-2 text-[13px] py-0.5`,e.status===`completed`&&`text-(--accent-green)`,e.status===`in_progress`&&`text-(--accent-blue)`,e.status===`pending`&&`text-(--muted-foreground)`),children:[(0,_.jsx)(`span`,{className:`w-4 text-center shrink-0`,children:n}),(0,_.jsx)(`span`,{children:e.content||e.activeForm})]},t)})}):null}var YW={you:{badge:`bg-(--accent-blue-bg) text-(--accent-blue)`,label:`You`},general:{badge:`bg-(--accent-green-bg) text-(--accent-green)`,label:`General`},coder:{badge:`bg-(--accent-green-bg) text-(--accent-green)`,label:`Coder`},advisor:{badge:`bg-(--accent-blue-bg) text-(--accent-blue)`,label:`Advisor`},planner:{badge:`bg-(--accent-purple-bg) text-(--accent-purple)`,label:`Planner`},reviewer:{badge:`bg-(--accent-orange-bg) text-(--accent-orange)`,label:`Reviewer`},tester:{badge:`bg-(--accent-blue-bg) text-(--accent-blue)`,label:`Tester`},summarizer:{badge:`bg-(--accent-cyan-bg) text-(--accent-cyan)`,label:`Summarizer`},system:{badge:`bg-(--muted) text-(--muted-foreground)`,label:`System`},error:{badge:`bg-(--accent-red-bg) text-(--accent-red)`,label:`Error`},pending:{badge:`bg-(--accent-cyan-bg) text-(--accent-cyan)`,label:`Pending`}},XW={running:`bg-(--accent-blue-bg) text-(--accent-blue)`,done:`bg-(--accent-green-bg) text-(--accent-green)`,error:`bg-(--accent-red-bg) text-(--accent-red)`,auto:`bg-(--accent-purple-bg) text-(--accent-purple)`},ZW=3;function QW(e){let t=String(e||``);return t===`Dream triggered...`?{status:`running`,title:`Dream started`,description:`Auto memory consolidation is running in the background.`}:t===`Dream complete`?{status:`done`,title:`Dream complete`,description:`Memory consolidation finished.`}:t.startsWith(`Dream done`)?{status:`done`,title:t,description:`Memory inbox and stale buckets were consolidated.`}:t.startsWith(`Dream failed:`)?{status:`error`,title:`Dream failed`,description:t.slice(13).trim()||`Unknown error.`}:null}function $W({notice:e}){let t=e.status===`running`?fp:e.status===`error`?$f:Qf;return(0,_.jsx)(`div`,{className:`py-2 px-6`,children:(0,_.jsx)(`div`,{className:`max-w-[860px] mx-auto flex justify-center`,children:(0,_.jsxs)(`div`,{className:B(`inline-flex max-w-full items-center gap-2 rounded-lg border px-3 py-2 text-left text-xs shadow-sm`,e.status===`error`?`border-(--accent-red)/30 bg-(--accent-red-bg) text-(--accent-red)`:`border-(--border-default) bg-(--bg-secondary) text-(--text-secondary)`),children:[(0,_.jsx)(t,{size:14,className:B(`shrink-0`,e.status===`running`&&`animate-spin text-(--accent-cyan)`,e.status===`done`&&`text-(--accent-green)`)}),(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsx)(`div`,{className:`font-medium text-(--text-primary) truncate`,children:e.title}),e.description&&(0,_.jsx)(`div`,{className:`mt-0.5 text-(--text-muted) truncate`,children:e.description})]})]})})})}function eG({cards:e}){let[t,n]=(0,d.useState)(!1),r=e.length,i=r>ZW&&!t,a=r-ZW,o=i?e.slice(r-ZW):e;return(0,_.jsxs)(`div`,{className:`space-y-2 my-2`,children:[i&&a>0&&(0,_.jsxs)(`button`,{type:`button`,className:`block w-full py-1.5 px-3 text-[11px] text-(--accent-blue) cursor-pointer text-left bg-transparent border-0`,onClick:()=>n(!0),children:[`+`,a,` more tool calls`]}),o.map(e=>(0,_.jsx)(lm,{card:e},e.id)),t&&r>ZW&&(0,_.jsxs)(`button`,{type:`button`,className:`block w-full py-1.5 px-3 text-[11px] text-(--accent-blue) cursor-pointer text-left bg-transparent border-0`,onClick:()=>n(!1),children:[`Collapse `,a,` older tool calls`]})]})}function tG(e){let t=[],n=[],r=()=>{n.length>0&&(t.push({type:`tools`,cards:n}),n=[])};for(let i of e)i.type===`tools`?n.push(...i.cards):i.type===`text`&&i.text&&(r(),t.push({type:`text`,text:i.text,isStreaming:i.isStreaming}));return r(),t}function nG({text:e,skills:t=[]}){let n=String(e||``).match(/^(\/([A-Za-z0-9_-]+))(\s+[\s\S]*)?$/);if(!n)return(0,_.jsx)(qW,{text:e,streaming:!1});let[,r,i,a=``]=n;if(i===`dream`)return(0,_.jsxs)(`div`,{className:`msg-body whitespace-pre-wrap text-(--text-primary)`,children:[(0,_.jsxs)(md,{children:[(0,_.jsx)(hd,{asChild:!0,children:(0,_.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-(--accent-cyan-bg) px-1.5 py-0.5 text-(--accent-cyan) font-mono text-[0.92em] cursor-help align-baseline`,children:[(0,_.jsx)(mp,{size:13}),r]})}),(0,_.jsxs)(gd,{side:`top`,sideOffset:8,className:`max-w-75 px-4 py-3 leading-relaxed whitespace-normal`,children:[(0,_.jsx)(`div`,{className:`font-semibold mb-1.5`,children:`Dream`}),(0,_.jsx)(`div`,{className:`text-(--text-secondary)`,children:`Consolidates memory inbox entries and stale memory buckets. It can run manually with /dream or automatically when the inbox threshold is reached.`})]})]}),a]});let o=t.find(e=>e.name===i);return o?(0,_.jsxs)(`div`,{className:`msg-body whitespace-pre-wrap text-(--text-primary)`,children:[(0,_.jsxs)(md,{children:[(0,_.jsx)(hd,{asChild:!0,children:(0,_.jsx)(`span`,{className:`inline-flex items-center rounded-md bg-(--accent-purple-bg) px-1.5 py-0.5 text-accent-purple font-mono text-[0.92em] cursor-help align-baseline`,children:r})}),(0,_.jsxs)(gd,{side:`top`,sideOffset:8,className:`max-w-75 px-4 py-3 leading-relaxed whitespace-normal`,children:[(0,_.jsx)(`div`,{className:`font-semibold mb-1.5`,children:o.name}),(0,_.jsx)(`div`,{className:`text-(--text-secondary)`,children:o.description||`No description`})]})]}),a]}):(0,_.jsx)(qW,{text:e,streaming:!1})}function rG({message:e,skills:t=[]}){let{role:n,segments:r,skillBadges:i,fileChanges:a,startupTodos:o,text:s,timestamp:c,planStep:l}=e,u=YW[n]||YW.general,f=c?rm(c):``,p=(0,d.useMemo)(()=>tG(r||[]),[r]);if(n===`divider`)return(0,_.jsx)(`div`,{className:`py-3 px-6 text-center`,children:(0,_.jsxs)(`div`,{className:`max-w-[860px] mx-auto relative`,children:[(0,_.jsx)(`div`,{className:`border-t border-border`}),(0,_.jsx)(`span`,{className:`text-xs text-(--text-muted) bg-(--bg-primary) px-2 absolute -top-2.5 left-1/2 -translate-x-1/2 whitespace-nowrap`,children:text||`以上内容已压缩`})]})});if(n===`system`){let e=QW(s);return e?(0,_.jsx)($W,{notice:e}):s?.includes(`等待计划审阅`)||s?.includes(`Waiting for plan review`)?null:(0,_.jsx)(`div`,{className:`py-2 px-6 text-xs text-(--text-muted) text-center`,children:(0,_.jsxs)(`div`,{className:`max-w-[860px] mx-auto px-3 py-1`,children:[s,o&&(0,_.jsx)(JW,{todos:o})]})})}let m=n===`you`&&(s||r?.filter(e=>e.type===`text`).map(e=>e.text).join(``))||``;return(0,_.jsx)(`div`,{className:B(`py-2 my-[22px]`,n===`you`&&`flex justify-end`),children:n===`you`?(0,_.jsxs)(`div`,{className:`w-fit max-w-full bg-(--bg-tertiary) rounded-2xl px-4 py-3`,children:[m&&(0,_.jsx)(nG,{text:m,skills:t}),o&&(0,_.jsx)(JW,{todos:o})]}):(0,_.jsxs)(`div`,{children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,_.jsx)(`span`,{className:B(`inline-flex items-center px-2 py-px rounded-full text-[11px] font-semibold uppercase tracking-[0.3px]`,u.badge),children:u.label}),f&&(0,_.jsx)(`span`,{className:`text-[11px] text-(--text-muted)`,children:f})]}),p.map((e,t)=>e.type===`text`?(0,_.jsx)(qW,{text:e.text,streaming:e.isStreaming},`t-${t}-${e.isStreaming?`s`:`d`}`):e.type===`tools`?(0,_.jsx)(eG,{cards:e.cards},`tg-${t}`):null),l&&p.length===0&&l.status!==`done`&&l.status!==`failed`&&(0,_.jsxs)(`div`,{className:`text-[12px] text-(--text-muted) inline-flex items-center gap-1.5`,children:[(0,_.jsx)(`span`,{className:`inline-block size-1 rounded-full bg-(--accent-blue) animate-pulse`}),(0,_.jsx)(`span`,{children:`等待工具调用或模型输出…`})]}),i?.length>0&&(0,_.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,children:i.map((e,t)=>(0,_.jsx)(`span`,{className:B(`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[11px] font-medium`,XW[e.status]),children:e.status===`auto`?`${V(`skillAuto`)}: ${e.name}`:`${e.name} - ${V(`skill`+e.status.charAt(0).toUpperCase()+e.status.slice(1))}`},t))}),a?.length>0&&(0,_.jsxs)(`div`,{className:`mt-2 border border-(--border-default) rounded-lg bg-(--bg-secondary) p-3`,children:[(0,_.jsx)(`div`,{className:`text-xs font-semibold text-(--text-secondary) mb-1`,children:V(`fileChanges`)}),a.map((e,t)=>(0,_.jsxs)(`div`,{className:`flex items-center gap-2 text-xs py-0.5 font-mono`,children:[(0,_.jsx)(`span`,{className:B(`text-[10px] font-semibold px-[5px] py-px rounded`,{edit:`bg-(--accent-blue-bg) text-(--accent-blue)`,create:`bg-(--accent-green-bg) text-(--accent-green)`,delete:`bg-(--accent-red-bg) text-(--accent-red)`}[e.action]||`bg-(--muted) text-(--text-muted)`),children:e.action?.toUpperCase()}),(0,_.jsx)(`span`,{className:`truncate flex-1 text-(--text-primary)`,children:e.path}),e.linesAdded!=null&&(0,_.jsxs)(`span`,{className:`text-(--accent-green) text-[11px]`,children:[`+`,e.linesAdded]}),e.linesRemoved!=null&&(0,_.jsxs)(`span`,{className:`text-(--accent-red) text-[11px]`,children:[`-`,e.linesRemoved]})]},t))]})]})})}function iG({messages:e,projectCwd:t,skills:n=[],gitInfo:r,messagesLoading:i}){let a=(0,d.useRef)(null),[o,s]=(0,d.useState)(!0),[c,l]=(0,d.useState)(!1),[u,f]=(0,d.useState)(!1);return(0,d.useEffect)(()=>{let e=a.current;if(!e)return;let t=()=>{let t=e.scrollHeight-e.scrollTop-e.clientHeight<80;s(t),l(e.scrollTop>400),f(!t&&e.scrollTop>100)};return e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)},[]),(0,d.useEffect)(()=>{o&&a.current&&requestAnimationFrame(()=>{a.current&&(a.current.scrollTop=a.current.scrollHeight)})},[e,o]),(0,_.jsxs)(`div`,{className:`flex-1 relative overflow-hidden`,children:[i&&e.length===0&&(0,_.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center pointer-events-none`,children:(0,_.jsx)(Xp,{})}),!i&&e.length===0&&(0,_.jsxs)(`div`,{className:`absolute left-1/2 top-[38%] -translate-x-1/2 -translate-y-1/2 w-[min(760px,calc(100%-48px))] text-center pointer-events-none`,children:[(0,_.jsx)(`h1`,{className:`text-[clamp(24px,2.4vw,36px)] font-medium leading-tight tracking-normal`,children:V(`buildInProject`).replace(`{{project}}`,t||`qurio-coder`)}),r?.isGit&&(0,_.jsxs)(`div`,{className:`mt-4 flex items-center justify-center gap-3 text-[13px] text-(--text-muted)`,children:[(0,_.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,_.jsx)(op,{size:13}),(0,_.jsx)(`span`,{children:r.branch})]}),r.dirty?(0,_.jsxs)(_.Fragment,{children:[r.staged>0&&(0,_.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-green-600 dark:text-green-400`,children:[(0,_.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-current`}),V(`gitStaged`),` `,r.staged]}),r.modified>0&&(0,_.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-amber-600 dark:text-amber-400`,children:[(0,_.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-current`}),V(`gitModified`),` `,r.modified]}),r.untracked>0&&(0,_.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,_.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-current`}),V(`gitUntracked`),` `,r.untracked]})]}):(0,_.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,_.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-emerald-500`}),V(`gitClean`)]})]})]}),(0,_.jsx)(`div`,{ref:a,className:`h-full overflow-y-auto py-[44px_0_28px] scroll-smooth`,style:{scrollbarWidth:`thin`},children:(0,_.jsx)(`div`,{className:`w-[min(960px,calc(100%-96px))] mx-auto`,children:e.map(e=>(0,_.jsx)(rG,{message:e,skills:n},e.id))})}),(0,_.jsxs)(`div`,{className:`absolute right-7 bottom-[220px] flex flex-col gap-2 z-20`,children:[c&&(0,_.jsx)(`button`,{className:`w-9 h-9 rounded-full bg-(--bg-input) border border-(--border-default) cursor-pointer flex items-center justify-center text-(--text-secondary) hover:bg-(--bg-hover) hover:text-(--text-primary) animate-in fade-in-0 zoom-in-95`,style:{boxShadow:`var(--shadow-default)`},onClick:()=>a.current?.scrollTo({top:0,behavior:`smooth`}),children:(0,_.jsx)(Uf,{size:16})}),u&&(0,_.jsx)(`button`,{className:`w-9 h-9 rounded-full bg-(--bg-input) border border-(--border-default) cursor-pointer flex items-center justify-center text-(--text-secondary) hover:bg-(--bg-hover) hover:text-(--text-primary) animate-in fade-in-0 zoom-in-95`,style:{boxShadow:`var(--shadow-default)`},onClick:()=>{s(!0),a.current?.scrollTo({top:a.current.scrollHeight,behavior:`smooth`})},children:(0,_.jsx)(Hf,{size:16})})]})]})}var aG=new Set([`superpowers-lite`]);function oG(){return[{value:`auto`,label:V(`autoMode`),desc:V(`autoModeDesc`)},{value:`plan`,label:V(`planMode`),desc:V(`planModeDesc`)}]}var sG=[{name:`dream`,insert:`/dream `,icon:mp,description:`Run memory consolidation now. Auto dream still runs in the background when needed.`},{name:`compact`,insert:`/compact `,icon:Vf,description:`Compress the current conversation context while keeping the useful working summary.`},{name:`memory`,insert:`/memory `,icon:ep,description:`Inspect or manage remembered project and user context.`},{name:`capture`,insert:`/capture `,icon:Kf,description:`Capture an explicit note into the memory inbox for later consolidation.`},{name:`inbox`,insert:`/inbox `,icon:up,description:`Review pending memory inbox entries.`},{name:`reflect`,insert:`/reflect `,icon:Tp,description:`Draft or update a reusable skill from the current workflow.`},{name:`retry`,insert:`/retry `,icon:bp,description:`Retry the last assistant turn.`}],cG=new Set(sG.map(e=>e.name));function lG({current:e,disabled:t=!1}){let[n,r]=(0,d.useState)(!1),[i,a]=(0,d.useState)(!1),o=oG(),s=o.find(t=>t.value===e)||o[0],c=async n=>{if(!(n===e||i||t)){a(!0);try{let e=await Pd(n);if(e?.error)throw Error(e.message||`Failed to switch mode`)}catch{}finally{a(!1)}r(!1)}};return(0,_.jsxs)(Np,{open:n,onOpenChange:e=>!t&&r(e),children:[(0,_.jsx)(Pp,{asChild:!0,children:(0,_.jsxs)(`button`,{type:`button`,className:B(`border-0 bg-transparent text-(--text-muted) w-auto px-2 h-[30px] rounded-lg inline-flex items-center justify-center gap-1 shrink-0 cursor-pointer text-[12px] whitespace-nowrap hover:bg-(--bg-hover) hover:text-(--text-primary)`,(i||t)&&`opacity-50 pointer-events-none`),disabled:t,title:V(t?`switchModeDisabled`:`switchMode`),children:[(0,_.jsx)(wp,{size:14}),(0,_.jsx)(`span`,{className:`truncate`,children:s.label}),(0,_.jsx)(Yf,{size:11})]})}),(0,_.jsxs)(Fp,{side:`top`,align:`start`,sideOffset:6,className:`w-56 p-1 rounded-lg bg-(--bg-primary) border border-(--border-default) shadow-lg`,children:[(0,_.jsx)(`div`,{className:`text-[11px] text-(--text-muted) px-2 py-1.5 font-medium`,children:V(`executionMode`)}),(0,_.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:o.map(n=>(0,_.jsxs)(`button`,{disabled:t||i,className:B(`w-full border-0 rounded-md px-2 py-1.5 text-left text-[12px] cursor-pointer flex items-center gap-2`,(t||i)&&`opacity-50 cursor-not-allowed`,e===n.value?`bg-(--bg-active) text-(--text-primary) font-medium`:`bg-transparent text-(--text-secondary) hover:bg-(--bg-hover) hover:text-(--text-primary)`),onClick:()=>c(n.value),children:[(0,_.jsx)(`span`,{className:`shrink-0`,children:n.label}),(0,_.jsx)(`span`,{className:`text-[10px] text-(--text-muted) min-w-0 text-right leading-4`,children:n.desc})]},n.value))})]})]})}function uG(){let[e,t]=(0,d.useState)([]),[n,r]=(0,d.useState)(``),[i,a]=(0,d.useState)(!1),o=(0,d.useCallback)(async()=>{try{let e=await $d(),n=Array.isArray(e)?e:[];t(n);let i=n.find(e=>e.active);r(i?i.name:``)}catch{}},[]);(0,d.useEffect)(()=>{o()},[o]);let s=async e=>{await af(e),r(e),a(!1),o()};return(0,_.jsxs)(Np,{open:i,onOpenChange:a,children:[(0,_.jsx)(Pp,{asChild:!0,children:(0,_.jsxs)(`button`,{type:`button`,className:`border-0 bg-transparent text-(--text-muted) w-auto px-2 h-[30px] rounded-lg inline-flex items-center justify-center gap-1 shrink-0 cursor-pointer text-[12px] whitespace-nowrap hover:bg-(--bg-hover) hover:text-(--text-primary)`,title:V(`soulSwitch`),children:[(0,_.jsx)(`span`,{className:`truncate max-w-[60px]`,children:n||`default`}),(0,_.jsx)(Yf,{size:11})]})}),(0,_.jsxs)(Fp,{side:`top`,align:`start`,sideOffset:6,className:`w-52 p-1 rounded-lg bg-(--bg-primary) border border-(--border-default) shadow-lg`,children:[(0,_.jsx)(`div`,{className:`text-[11px] text-(--text-muted) px-2 py-1.5 font-medium`,children:V(`switchSoul`)}),(0,_.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:e.map(e=>(0,_.jsxs)(`button`,{className:B(`w-full border-0 rounded-md px-2 py-1.5 text-left text-[12px] cursor-pointer flex items-center gap-2`,e.active?`bg-(--bg-active) text-(--text-primary) font-medium`:`bg-transparent text-(--text-secondary) hover:bg-(--bg-hover) hover:text-(--text-primary)`),onClick:()=>s(e.name),children:[(0,_.jsx)(`span`,{className:`truncate flex-1`,children:e.name}),(0,_.jsx)(`span`,{className:`text-[10px] text-(--text-muted) shrink-0`,children:e.scope===`builtin`?V(`builtin`):V(`custom`)})]},`${e.scope}-${e.name}`))})]})]})}function dG({query:e,onSelect:t,visible:n}){let[r,i]=(0,d.useState)([]),[a,o]=(0,d.useState)(null);(0,d.useEffect)(()=>{n&&qd().then(e=>{i(Array.isArray(e)?e.filter(e=>e.enabled!==!1&&!aG.has(e.name)&&!cG.has(e.name)):[])}).catch(()=>{})},[n]);let s=e.trim().toLowerCase(),c=(0,d.useMemo)(()=>sG.filter(e=>!s||e.name.includes(s)||e.description.toLowerCase().includes(s)).map(e=>({...e,kind:`action`,key:`action-${e.name}`})),[s]),l=(0,d.useMemo)(()=>r.filter(e=>!s||e.name.toLowerCase().includes(s)||(e.description||``).toLowerCase().includes(s)).map(e=>({name:e.name,insert:`/${e.name} `,icon:lp,description:e.description||`Manual skill`,kind:`skill`,key:`skill-${e.name}`})),[r,s]);if(!n)return null;let u=c.length>0||l.length>0,f=(e,n)=>n.length?(0,_.jsxs)(`div`,{className:`py-1`,children:[(0,_.jsx)(`div`,{className:`px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.45px] text-(--text-muted)`,children:e}),(0,_.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:n.map(e=>{let n=e.icon,r=a===e.key;return(0,_.jsxs)(`button`,{className:B(`w-full border-0 rounded-md px-2.5 py-2 text-left cursor-pointer grid grid-cols-[22px_minmax(96px,180px)_minmax(0,1fr)_auto] items-start gap-2 text-[12px] transition-colors`,r?`bg-(--bg-hover) text-(--text-primary)`:`bg-transparent text-(--text-secondary) hover:bg-(--bg-hover) hover:text-(--text-primary)`),onClick:()=>t(e.insert),onMouseEnter:()=>o(e.key),onMouseLeave:()=>o(null),children:[(0,_.jsx)(`span`,{className:B(`mt-0.5 inline-flex size-5 items-center justify-center rounded-md transition-colors`,e.kind===`action`?`bg-(--accent-cyan-bg) text-(--accent-cyan)`:`bg-(--accent-purple-bg) text-(--accent-purple)`,!r&&`opacity-80`),children:(0,_.jsx)(n,{size:12})}),(0,_.jsxs)(`span`,{className:`truncate font-medium leading-5 font-mono`,children:[`/`,e.name]}),(0,_.jsx)(`span`,{className:`text-(--text-muted) text-[11px] leading-5 overflow-hidden`,style:{display:`-webkit-box`,WebkitLineClamp:2,WebkitBoxOrient:`vertical`},children:e.description}),(0,_.jsx)(`span`,{className:B(`mt-0.5 rounded-full border px-1.5 py-0.5 text-[10px] uppercase leading-none`,e.kind===`action`?`border-(--accent-cyan)/25 text-(--accent-cyan)`:`border-(--accent-purple)/25 text-(--accent-purple)`),children:e.kind})]},e.key)})})]}):null;return(0,_.jsxs)(`div`,{className:`absolute bottom-full left-0 right-0 mb-1.5 max-h-[360px] overflow-y-auto rounded-xl border border-(--border-default) bg-(--bg-primary) shadow-lg z-50 animate-in fade-in-0 zoom-in-95 slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95`,style:{scrollbarWidth:`thin`},children:[(0,_.jsxs)(`div`,{className:`px-2.5 py-1.5 text-[11px] text-(--text-muted) font-medium flex items-center gap-1.5 border-b border-(--border-default)`,children:[(0,_.jsx)(Tp,{size:11}),`Commands`]}),!u&&(0,_.jsx)(`div`,{className:`px-2.5 py-5 text-[12px] text-(--text-muted) text-center`,children:`No matching commands`}),f(`Actions`,c),c.length>0&&l.length>0&&(0,_.jsx)(`div`,{className:`mx-2.5 h-px bg-(--border-default)`}),f(`Skills`,l)]})}function fG({onSubmit:e,onAbort:t,busy:n,disabled:r=!1,disabledReason:i=``,runtimeState:a,history:o,onCompletionRequest:s,onOpenProject:c,projectCwd:l}){let[u,f]=(0,d.useState)(``),[p,m]=(0,d.useState)([]),[h,g]=(0,d.useState)(-1),[v,y]=(0,d.useState)(``),[b,x]=(0,d.useState)(!1),[S,C]=(0,d.useState)(``),w=(0,d.useRef)(null),T=(a||{}).mode||`normal`,E=n||r;(0,d.useEffect)(()=>{o&&o.length&&p.length===0&&m([...o].reverse())},[o]),(0,d.useEffect)(()=>{E&&x(!1)},[E]);let D=(0,d.useCallback)(()=>{let t=u.trim();!t||E||(e(t),f(``),x(!1),g(-1),w.current&&(w.current.style.height=`auto`))},[u,E,e]),O=(0,d.useCallback)(e=>{if(e.key===`Enter`&&!e.shiftKey){if(b){e.preventDefault();return}e.preventDefault(),D();return}if(b&&e.key===`Escape`){e.preventDefault(),x(!1);return}if(e.key===`ArrowUp`&&p.length>0&&!b){e.preventDefault(),h===-1&&y(u);let t=Math.min(h+1,p.length-1);g(t),f(p[t]);return}if(e.key===`ArrowDown`&&h!==-1&&!b){e.preventDefault();let t=h-1;g(t),f(t<0?v:p[t]);return}e.key===`Tab`&&e.preventDefault()},[u,p,h,v,D,b]),ee=(0,d.useCallback)(e=>{let t=e.target.value;f(t),e.target.style.height=`auto`,e.target.style.height=Math.min(e.target.scrollHeight,160)+`px`,t===`/`?(x(!0),C(``)):t.startsWith(`/`)&&!t.includes(` `)?(x(!0),C(t.slice(1))):x(!1),t.startsWith(`/`)&&s&&s(t)},[s]);return(0,_.jsxs)(`div`,{className:`w-full relative`,children:[(0,_.jsx)(dG,{query:S,onSelect:(0,d.useCallback)(e=>{f(e),x(!1),w.current?.focus()},[]),visible:b}),(0,_.jsxs)(`div`,{className:`flex flex-col gap-2 p-[12px_14px_10px] border border-(--border-strong) rounded-2xl bg-(--bg-input)`,style:{boxShadow:`var(--shadow-default)`},children:[(0,_.jsx)(`div`,{className:`flex min-h-[32px]`,children:(0,_.jsx)(`textarea`,{ref:w,value:u,onChange:ee,onKeyDown:O,placeholder:n?V(`inputDisabled`):r?i||V(`inputDisabled`):V(`askAnything`),disabled:E,rows:1,className:`flex-1 resize-none border-0 outline-none bg-transparent text-(--text-primary) min-h-[32px] max-h-[160px] p-0 leading-[1.5] text-[14px] placeholder:text-(--text-muted) disabled:opacity-50 disabled:cursor-not-allowed`,style:{height:`auto`}})}),(0,_.jsxs)(`div`,{className:`flex items-center gap-1.5 min-h-[30px] flex-wrap`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,_.jsx)(`button`,{type:`button`,className:`border-0 bg-transparent text-(--text-muted) min-w-[30px] h-[30px] rounded-lg inline-flex items-center justify-center shrink-0 cursor-pointer hover:bg-(--bg-hover) hover:text-(--text-primary)`,title:V(`addContext`),children:(0,_.jsx)(_p,{size:16})}),(0,_.jsxs)(`button`,{type:`button`,className:`border-0 bg-transparent text-(--text-muted) w-auto px-2 h-[30px] rounded-lg inline-flex items-center justify-center gap-1.5 shrink-0 cursor-pointer text-[12px] whitespace-nowrap hover:bg-(--bg-hover) hover:text-(--text-primary)`,title:V(`switchWorkspace`),onClick:c,children:[(0,_.jsx)(ap,{size:13,className:`shrink-0`}),(0,_.jsx)(`span`,{className:`truncate max-w-[80px]`,children:l||`...`}),(0,_.jsx)(Yf,{size:11})]}),(0,_.jsx)(lG,{current:T,disabled:E}),(0,_.jsx)(uG,{})]}),(0,_.jsx)(`div`,{className:`flex items-center gap-1.5 ml-auto`,children:n?(0,_.jsx)(`button`,{type:`button`,className:`border-0 text-(--accent-red) min-w-[32px] h-[32px] rounded-full inline-flex items-center justify-center shrink-0 cursor-pointer bg-(--accent-red-bg) hover:opacity-80`,onClick:t,title:V(`abort`),children:(0,_.jsx)(pp,{size:14})}):(0,_.jsx)(`button`,{type:`button`,className:B(`border-0 min-w-[34px] w-[34px] h-[34px] rounded-full inline-flex items-center justify-center shrink-0 cursor-pointer transition-all`,u.trim()&&!E?`bg-(--text-primary) text-(--bg-primary) hover:opacity-90`:`bg-(--text-muted)/30 text-(--bg-primary) cursor-not-allowed`),onClick:D,disabled:!u.trim()||E,title:V(`sending`),children:(0,_.jsx)(Uf,{size:16})})})]})]})]})}var pG={thinking:`bg-(--accent-blue)`,streaming:`bg-(--accent-green)`,tooling:`bg-(--accent-orange)`,live:`bg-(--accent-cyan)`};function mG({runtimeState:e,live:t,stageLabel:n}){let r=e||{};r.mode;let i=r.currentContextTokens||0,a=r.maxContextTokens||0,o=a?Math.round(i/a*100):0,s=o<40?`bg-(--accent-green)`:o<75?`bg-(--accent-orange)`:`bg-(--accent-red)`,c=Object.keys(pG).find(e=>(n||``).includes(e))||`live`;return(0,_.jsxs)(`div`,{className:`flex items-center gap-3 flex-1 min-w-0 text-[12px] text-(--text-muted) overflow-hidden`,children:[(0,_.jsxs)(`span`,{className:`inline-flex items-center gap-1 whitespace-nowrap`,children:[(0,_.jsx)(Gf,{size:13,className:`shrink-0 opacity-70`}),(0,_.jsx)(`span`,{children:r.model?.toUpperCase()||`-`})]}),(0,_.jsxs)(`span`,{className:`inline-flex items-center gap-1 whitespace-nowrap`,children:[(0,_.jsx)(vp,{size:13,className:`shrink-0 opacity-70`}),(0,_.jsx)(`span`,{children:r.sdkProvider?.toUpperCase()||`-`})]}),a>0&&(0,_.jsxs)(`span`,{className:`inline-flex items-center gap-1 whitespace-nowrap`,children:[(0,_.jsx)(qf,{size:13,className:`shrink-0 opacity-70`}),(0,_.jsx)(`span`,{children:`CTX`}),(0,_.jsx)(`span`,{className:`w-12 h-1 bg-(--muted) rounded-full overflow-hidden`,children:(0,_.jsx)(`span`,{className:B(`block h-full rounded-full transition-all`,s),style:{width:`${o}%`}})}),(0,_.jsxs)(`span`,{children:[o,`%`]})]}),(0,_.jsxs)(`span`,{className:`inline-flex items-center gap-1 ml-auto whitespace-nowrap`,children:[(0,_.jsx)(`span`,{className:B(`w-1.5 h-1.5 rounded-full shrink-0`,t?pG[c]:`bg-(--text-muted)`,t&&`animate-pulse`)}),(0,_.jsx)(`span`,{children:t?n:V(`idle`)})]})]})}function hG({className:e,value:t,...n}){return(0,_.jsx)(Io,{"data-slot":`progress`,className:B(`relative h-2 w-full overflow-hidden rounded-full bg-primary/20`,e),...n,children:(0,_.jsx)(Lo,{"data-slot":`progress-indicator`,className:`h-full w-full flex-1 bg-primary transition-all`,style:{transform:`translateX(-${100-(t||0)}%)`}})})}function gG(){return[{value:`fast`,label:V(`generationDepthFast`)},{value:`standard`,label:V(`generationDepthStandard`)},{value:`deep`,label:V(`generationDepthDeep`)}]}function _G(e){if(!e)return``;try{return new Intl.DateTimeFormat(`zh-CN`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}).format(new Date(e))}catch{return``}}function vG(e){let t=Number(e||0);return!Number.isFinite(t)||t<=0?``:t<1024?`${t} B`:t<1024*1024?`${Math.round(t/1024)} KB`:`${(t/1024/1024).toFixed(1)} MB`}function yG(e,t){let n=Array.isArray(e)?e:[];if(!n.length)return{done:0,total:0,pct:8,label:t||V(`startingAnalysis`),detail:V(`preparingScan`)};let r=n.filter(e=>e.status===`done`).length,i=n.find(e=>e.status===`failed`),a=n.find(e=>e.status===`running`)||n.find(e=>e.status===`in_progress`)||n.find(e=>e.status===`pending`)||n[n.length-1];return{done:r,total:n.length,pct:Math.max(8,Math.round(r/n.length*100)),label:i?V(`generationFailed`):a?.title||t||V(`generatingCodeWiki`),detail:i?i.title:`${r}/${n.length} ${V(`stepsCompleted`)}${a?.role?` · ${a.role.toUpperCase()}`:``}`}}function bG({steps:e,stageLabel:t,compact:n=!1}){let r=yG(e,t);return(0,_.jsxs)(`div`,{className:B(`rounded-lg border border-(--border-default) bg-(--bg-primary) p-3 text-left`,n?`mt-3`:`mt-5 w-full max-w-md`),children:[(0,_.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,_.jsx)(`span`,{className:`truncate text-[12px] font-medium text-(--text-primary)`,children:r.label}),r.total>0&&(0,_.jsxs)(`span`,{className:`shrink-0 text-[11px] text-(--text-muted)`,children:[r.done,`/`,r.total]})]}),(0,_.jsx)(hG,{value:r.pct,className:`mt-2 h-1.5`}),(0,_.jsx)(`p`,{className:`mt-2 truncate text-[11px] text-(--text-muted)`,children:r.detail})]})}function xG(e,t){if(!Array.isArray(e)||e.length===0)return[{type:`tools`,cards:[t]}];let n=e[e.length-1];return n.type===`tools`?[...e.slice(0,-1),{...n,cards:[...n.cards,t]}]:[...e,{type:`tools`,cards:[t]}]}function SG(e,t,n){return(Array.isArray(e)?e:[]).map(e=>{if(e.type!==`tools`)return e;let r=e.cards.findIndex(e=>e.id===t);if(r===-1)return e;let i=[...e.cards];return i[r]=n(i[r]),{...e,cards:i}})}function CG(e){let t=Array.isArray(e)?e:[];return t.length===0?[{type:`text`,text:``,isStreaming:!1}]:t[t.length-1].type===`text`?t:[...t,{type:`text`,text:``,isStreaming:!1}]}function wG(e,t){let n=String(t||``);if(!n)return Array.isArray(e)?e:[];let r=CG(e),i=r[r.length-1];return[...r.slice(0,-1),{...i,text:`${i.text||``}${n}`,isStreaming:!0}]}function TG(e,t){let n=CG(e),r=n.length-1;return n.map((e,n)=>n===r&&e.type===`text`?{...e,text:t,isStreaming:!1}:e)}function EG(e){return(Array.isArray(e)?e:[]).map(e=>e.type===`text`?{...e,isStreaming:!1}:e)}function DG(e,t){switch(t?.type){case`assistant:delta`:return{...e,segments:wG(e.segments,t.text)};case`assistant:response`:return{...e,segments:t.text?TG(e.segments,t.text):EG(e.segments)};case`tool:start`:return{...e,segments:xG(e.segments,{id:t.id,name:t.name,arguments:t.arguments,status:`running`,durationMs:null,summary:``,result:``})};case`tool:result`:return{...e,segments:SG(e.segments,t.id,e=>({...e,result:t.content||e.result||``}))};case`tool:end`:return{...e,segments:SG(e.segments,t.id,e=>({...e,status:`done`,durationMs:t.durationMs,summary:t.summary||e.summary||``}))};case`tool:error`:return{...e,segments:SG(e.segments,t.id,e=>({...e,status:`error`,durationMs:t.durationMs,summary:t.summary||e.summary||``}))};case`tool:blocked`:return{...e,segments:SG(e.segments,t.id,e=>({...e,status:`blocked`,summary:e.summary||`Tool blocked`}))};case`codewiki:done`:return{...e,loading:!1,segments:EG(e.segments)};case`codewiki:error`:return{...e,role:`error`,loading:!1,segments:[{type:`text`,text:t.message||V(`codewikiFailed`),isStreaming:!1}]};default:return e}}function OG({projectCwd:e,projectKey:t,busy:n,planSteps:r=[],stageLabel:i=``}){let[a,o]=(0,d.useState)([]),[s,c]=(0,d.useState)(``),[l,u]=(0,d.useState)(!0),[f,p]=(0,d.useState)(!1),[m,h]=(0,d.useState)(``),[g,v]=(0,d.useState)(!1),[y,b]=(0,d.useState)(``),[x,S]=(0,d.useState)(``),[C,w]=(0,d.useState)(!1),[T,E]=(0,d.useState)(null),[D,O]=(0,d.useState)(!1),[ee,k]=(0,d.useState)(`standard`),[A,j]=(0,d.useState)([]),[M,te]=(0,d.useState)(!1),ne=(0,d.useRef)(null),N=(0,d.useMemo)(()=>a.find(e=>e.file===s)||null,[a,s]),P=N?`/api/codewiki/report/${encodeURIComponent(N.file)}`:``,re=(0,d.useCallback)(async({preferNewest:e=!1}={})=>{u(!0),h(``);try{let t=await of(),n=[...Array.isArray(t?.reports)?t.reports:[]].sort((e,t)=>new Date(t.mtime||0)-new Date(e.mtime||0));o(n),c(t=>e&&n[0]?n[0].file:n.some(e=>e.file===t)?t:n[0]?.file||``)}catch(e){h(e?.message||V(`failedToLoad`))}finally{u(!1)}},[]);(0,d.useEffect)(()=>{o([]),c(``),v(!1),b(``),S(``),j([]),te(!1),re({preferNewest:!0})},[re,t]),(0,d.useEffect)(()=>{let e=ne.current;e&&requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight})},[A,M]),(0,d.useEffect)(()=>{f&&n&&w(!0)},[n,f]),(0,d.useEffect)(()=>{!f||n||!C||(re({preferNewest:!0}),p(!1),w(!1))},[n,f,re,C]);let ie=async()=>{if(!(n||f)){h(``),p(!0),w(!1);try{let e=await sf(ee);e?.error&&(p(!1),h(e.message||V(`failedToStart`)))}catch(e){p(!1),h(e?.message||V(`failedToStart`))}}},ae=async e=>{e.preventDefault();let t=y.trim();if(!t||F||M)return;let n=Date.now(),r=`cw-assistant-${n}`;S(t),b(``),h(``),j(e=>[...e,{id:`cw-user-${n}`,role:`you`,text:t,segments:[{type:`text`,text:t,isStreaming:!1}],timestamp:new Date().toISOString()},{id:r,role:`general`,text:``,segments:[],timestamp:new Date().toISOString(),loading:!0}]),te(!0);try{await cf({question:t,reportFile:N?.file||``,onEvent:e=>{j(t=>t.map(t=>t.id===r?DG(t,e):t))}})}catch(e){j(t=>t.map(t=>t.id===r?{...t,role:`error`,loading:!1,segments:[{type:`text`,text:e?.message||V(`codewikiFailed`),isStreaming:!1}]}:t))}finally{te(!1)}},oe=async()=>{if(T){O(!0),h(``);try{let e=await lf(T.file);e?.error?h(e.message||V(`failedToDelete`)):(E(null),v(!1),await re({preferNewest:!1}))}catch(e){h(e?.message||V(`failedToDelete`))}finally{O(!1)}}},F=n||f,I=F||M;return(0,_.jsxs)(`div`,{className:`flex-1 min-h-0 bg-(--bg-primary) rounded-[18px] border border-(--border-default) border-b-0 overflow-hidden my-1 mx-1`,children:[(0,_.jsxs)(`div`,{className:`grid h-full min-h-0 grid-cols-[260px_minmax(0,1fr)_420px] max-xl:grid-cols-[220px_minmax(0,1fr)] max-lg:grid-cols-1`,children:[(0,_.jsxs)(`aside`,{className:`border-r border-(--border-default) bg-(--bg-secondary) min-h-0 flex flex-col max-lg:hidden`,children:[(0,_.jsxs)(`div`,{className:`p-4 border-b border-(--border-default)`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2 text-(--text-primary)`,children:[(0,_.jsx)(Wf,{size:18}),(0,_.jsx)(`span`,{className:`font-semibold text-[15px]`,children:`CodeWiki`})]}),(0,_.jsx)(`p`,{className:`mt-2 text-[12px] leading-5 text-(--text-muted) truncate`,title:e||``,children:e||V(`currentProject`)}),(0,_.jsx)(`div`,{className:`mt-4 grid grid-cols-3 gap-1 rounded-lg border border-(--border-default) bg-(--bg-primary) p-1`,children:gG().map(e=>(0,_.jsx)(`button`,{type:`button`,className:B(`h-7 rounded-md text-[12px] text-(--text-muted) hover:bg-(--bg-hover) hover:text-(--text-primary) disabled:cursor-not-allowed disabled:opacity-60`,ee===e.value&&`bg-(--bg-active) text-(--text-primary)`),disabled:F,onClick:()=>k(e.value),children:e.label},e.value))}),(0,_.jsxs)(`button`,{className:`mt-3 w-full h-9 rounded-lg border border-(--border-default) bg-(--bg-primary) text-[13px] text-(--text-primary) inline-flex items-center justify-center gap-2 hover:bg-(--bg-hover) disabled:cursor-not-allowed disabled:opacity-60`,onClick:ie,disabled:F,children:[f?(0,_.jsx)(fp,{size:15,className:`animate-spin`}):(0,_.jsx)(Tp,{size:15}),V(f?`generating`:`generateNew`)]}),f&&(0,_.jsx)(bG,{steps:r,stageLabel:i,compact:!0})]}),(0,_.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3`,children:[(0,_.jsx)(`span`,{className:`text-[12px] font-medium text-(--text-muted)`,children:V(`report`)}),(0,_.jsx)(`button`,{className:`inline-flex size-7 items-center justify-center rounded-md text-(--text-muted) hover:bg-(--bg-hover) hover:text-(--text-primary)`,onClick:()=>re({preferNewest:!0}),title:V(`refreshReport`),"aria-label":V(`refreshReport`),children:(0,_.jsx)(yp,{size:14})})]}),(0,_.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-2 pb-4`,children:[l&&(0,_.jsxs)(`div`,{className:`px-3 py-6 text-[12px] text-(--text-muted) inline-flex items-center gap-2`,children:[(0,_.jsx)(fp,{size:14,className:`animate-spin`}),V(`loadingReport`)]}),!l&&a.length===0&&(0,_.jsx)(`div`,{className:`mx-2 rounded-lg border border-dashed border-(--border-default) px-3 py-4 text-[12px] leading-5 text-(--text-muted)`,children:V(`noReportYet`)}),(0,_.jsx)(`div`,{className:`flex flex-col gap-1`,children:a.map(e=>(0,_.jsxs)(`div`,{className:B(`group w-full rounded-lg px-3 py-2 text-left hover:bg-(--bg-hover) cursor-pointer`,s===e.file&&`bg-(--bg-active)`),onClick:()=>{c(e.file),v(!1)},children:[(0,_.jsxs)(`span`,{className:`flex items-start gap-2 text-[13px] text-(--text-primary)`,children:[(0,_.jsx)(ip,{size:14,className:`shrink-0 mt-0.5 text-(--text-muted)`}),(0,_.jsx)(`span`,{className:`min-w-0 flex-1 break-words`,children:e.file}),(0,_.jsxs)(Np,{children:[(0,_.jsx)(Pp,{asChild:!0,children:(0,_.jsx)(`button`,{type:`button`,className:`inline-flex size-6 shrink-0 items-center justify-center rounded-md text-(--text-muted) opacity-0 hover:bg-(--bg-active) hover:text-(--text-primary) group-hover:opacity-100 focus:opacity-100`,onClick:e=>e.stopPropagation(),"aria-label":V(`reportActions`),children:(0,_.jsx)(tp,{size:14})})}),(0,_.jsx)(Fp,{align:`end`,className:`w-36 border-(--border-default) bg-(--bg-primary) p-1 text-(--text-primary)`,onClick:e=>e.stopPropagation(),children:(0,_.jsx)(`button`,{type:`button`,className:`w-full rounded-md px-2.5 py-2 text-left text-[13px] text-(--accent-red) hover:bg-(--accent-red-bg)`,onClick:()=>E(e),children:V(`deleteReport`)})})]})]}),(0,_.jsxs)(`span`,{className:`mt-1 block truncate pl-6 text-[11px] text-(--text-muted)`,children:[_G(e.mtime),vG(e.size)?` · ${vG(e.size)}`:``]})]},e.file))})]})]}),(0,_.jsxs)(`main`,{className:`min-w-0 min-h-0 flex flex-col bg-(--bg-primary)`,children:[m&&(0,_.jsxs)(`div`,{className:`mx-5 mt-4 rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-[12px] text-red-400 inline-flex items-center gap-2`,children:[(0,_.jsx)(Zf,{size:14}),m]}),(0,_.jsx)(`div`,{className:`flex-1 min-h-0 p-4`,children:!N&&!l?(0,_.jsxs)(`div`,{className:`h-full min-h-[420px] rounded-xl border border-dashed border-(--border-default) bg-(--bg-secondary) flex flex-col items-center justify-center text-center px-8`,children:[(0,_.jsx)(Wf,{size:34,className:`text-(--text-muted)`}),(0,_.jsx)(`h2`,{className:`mt-4 text-[18px] font-semibold text-(--text-primary)`,children:V(`noCodeWiki`)}),(0,_.jsx)(`p`,{className:`mt-2 max-w-md text-[13px] leading-6 text-(--text-muted)`,children:V(`reportWillShow`)}),(0,_.jsxs)(`button`,{className:`mt-5 h-10 rounded-lg bg-(--text-primary) px-4 text-[13px] font-medium text-(--bg-primary) inline-flex items-center gap-2 disabled:cursor-not-allowed disabled:opacity-60`,onClick:ie,disabled:F,children:[f?(0,_.jsx)(fp,{size:16,className:`animate-spin`}):(0,_.jsx)(Tp,{size:16}),V(f?`generating`:`generateNew`)]}),(0,_.jsx)(`div`,{className:`mt-3 grid w-full max-w-xs grid-cols-3 gap-1 rounded-lg border border-(--border-default) bg-(--bg-primary) p-1`,children:gG().map(e=>(0,_.jsx)(`button`,{type:`button`,className:B(`h-7 rounded-md text-[12px] text-(--text-muted) hover:bg-(--bg-hover) hover:text-(--text-primary) disabled:cursor-not-allowed disabled:opacity-60`,ee===e.value&&`bg-(--bg-active) text-(--text-primary)`),disabled:F,onClick:()=>k(e.value),children:e.label},e.value))}),f&&(0,_.jsx)(bG,{steps:r,stageLabel:i})]}):(0,_.jsx)(`div`,{className:`h-full min-h-[420px] overflow-hidden rounded-xl border border-(--border-default) bg-(--bg-secondary)`,children:g?(0,_.jsxs)(`div`,{className:`h-full flex flex-col items-center justify-center px-8 text-center`,children:[(0,_.jsx)(Zf,{size:28,className:`text-(--text-muted)`}),(0,_.jsx)(`p`,{className:`mt-3 text-[13px] text-(--text-secondary)`,children:V(`reportLoadFailed`)}),(0,_.jsx)(`button`,{className:`mt-4 h-8 rounded-md border border-(--border-default) px-3 text-[12px] text-(--text-primary) hover:bg-(--bg-hover)`,onClick:()=>v(!1),children:V(`retry`)})]}):N?(0,_.jsx)(`iframe`,{title:`CodeWiki ${N.file}`,src:P,sandbox:`allow-scripts`,className:`h-full w-full border-0 bg-white`,onLoad:()=>v(!1),onError:()=>v(!0)},N.file):(0,_.jsxs)(`div`,{className:`h-full flex items-center justify-center text-[13px] text-(--text-muted)`,children:[(0,_.jsx)(fp,{size:16,className:`mr-2 animate-spin`}),V(`loading`)]})})})]}),(0,_.jsxs)(`aside`,{className:`border-l border-(--border-default) bg-(--bg-secondary) min-h-0 flex flex-col max-xl:hidden`,children:[(0,_.jsx)(`div`,{className:`p-4 border-b border-(--border-default)`,children:(0,_.jsx)(`p`,{className:`mt-2 text-[12px] leading-5 text-(--text-muted)`,children:V(f?`noQuestionsDuringGeneration`:`tempReadOnlyQa`)})}),(0,_.jsx)(`div`,{ref:ne,className:`flex-1 min-h-0 overflow-y-auto px-4 py-3`,children:A.length===0?(0,_.jsxs)(`div`,{className:`rounded-xl border border-(--border-default) bg-(--bg-primary) p-4`,children:[(0,_.jsx)(`p`,{className:`text-[13px] font-medium text-(--text-primary)`,children:V(f?`generatingCodeWiki`:M||n?`processingQuestion`:`canAskAboutProject`)}),(0,_.jsx)(`p`,{className:`mt-2 text-[12px] leading-5 text-(--text-muted)`,children:f?V(`askAfterGeneration`):x||V(`exampleQuestions`)})]}):(0,_.jsx)(`div`,{className:`flex flex-col`,children:A.map(e=>(0,_.jsxs)(`div`,{children:[(0,_.jsx)(rG,{message:e}),e.loading&&(!e.segments||e.segments.length===0)&&(0,_.jsxs)(`div`,{className:`mt-[-12px] mb-3 ml-1 inline-flex items-center gap-2 rounded-xl border border-(--border-default) bg-(--bg-primary) px-3 py-2 text-[12px] text-(--text-muted)`,children:[(0,_.jsx)(fp,{size:14,className:`animate-spin`}),V(`answering`)]})]},e.id))})}),(0,_.jsx)(`form`,{className:`p-4 border-t border-(--border-default)`,onSubmit:ae,children:(0,_.jsxs)(`div`,{className:`flex items-center gap-2 rounded-full border border-(--border-default) bg-(--bg-primary) px-3 py-2`,children:[(0,_.jsx)(`input`,{value:y,onChange:e=>b(e.target.value),placeholder:f?V(`generatingCodeWiki`):M||n?V(`answering`):`Ask about this repository`,disabled:I,className:`min-w-0 flex-1 border-0 bg-transparent text-[13px] text-(--text-primary) outline-none placeholder:text-(--text-muted) disabled:opacity-60`}),(0,_.jsx)(`button`,{type:`submit`,className:`inline-flex size-7 items-center justify-center rounded-full text-(--text-muted) hover:bg-(--bg-hover) hover:text-(--text-primary) disabled:cursor-not-allowed disabled:opacity-50`,disabled:I||!y.trim(),"aria-label":V(`sendingQuestion`),children:M?(0,_.jsx)(fp,{size:15,className:`animate-spin`}):(0,_.jsx)(Sp,{size:15})})]})})]})]}),(0,_.jsx)(Yp,{open:!!T,title:V(`deleteReportConfirm`),description:V(`deleteReportDescription`).replace(`{{report}}`,T?.title||T?.file||``),loading:D,onOpenChange:e=>!e&&E(null),onConfirm:oe})]})}function kG(e,t){return e===`delete`?`delete`:e===`run`?`run`:t?.planApproval?`plan`:t?.reflectApproval?`reflect`:`generic`}function AG(e){if(!e)return{};try{let t=typeof e==`string`?JSON.parse(e):e;return{...t,_raw:JSON.stringify(t)}}catch{return{_raw:String(e)}}}function jG({label:e,value:t}){return(0,_.jsxs)(`div`,{className:`flex gap-3 py-1.5`,children:[(0,_.jsx)(`span`,{className:`text-[13px] font-medium text-(--text-muted) w-20 shrink-0`,children:e}),(0,_.jsx)(`span`,{className:`text-[13px] font-mono break-all text-(--text-primary)`,children:String(t)})]})}function MG({variant:e,args:t,details:n}){if(e===`delete`){let e=AG(t);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(jG,{label:`File`,value:e.path||e.name||`-`}),(0,_.jsx)(jG,{label:`Type`,value:e.type||`file`})]})}return e===`run`?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(jG,{label:`Command`,value:AG(t).command||`-`}),n?.risk&&(0,_.jsx)(jG,{label:`Risk`,value:n.risk}),n?.description&&(0,_.jsx)(jG,{label:`Info`,value:n.description})]}):e===`plan`?(0,_.jsxs)(_.Fragment,{children:[n?.title&&(0,_.jsx)(`p`,{className:`text-sm mb-2`,children:n.title}),n?.steps&&(0,_.jsx)(`ol`,{className:`list-decimal list-inside space-y-1`,children:n.steps.map((e,t)=>(0,_.jsxs)(`li`,{className:`text-sm`,children:[e.role||``,`: `,e.title||``]},t))})]}):e===`reflect`?(0,_.jsxs)(_.Fragment,{children:[n?.scope&&(0,_.jsx)(jG,{label:`Scope`,value:n.scope}),n?.skillName&&(0,_.jsx)(jG,{label:`Skill`,value:n.skillName}),n?.targetPath&&(0,_.jsx)(jG,{label:`Path`,value:n.targetPath})]}):(0,_.jsx)(jG,{label:`Tool`,value:AG(t)._raw||`-`})}function NG({request:e,open:t,onDecision:n}){if(!e)return null;let{id:r,toolName:i,displayName:a,arguments:o,details:s}=e,c=kG(i,s);return(0,_.jsx)(Vp,{open:t,onOpenChange:e=>{e||n(r,!1)},children:(0,_.jsxs)(Wp,{className:`sm:max-w-lg`,children:[(0,_.jsx)(Gp,{children:(0,_.jsx)(qp,{children:{delete:V(`deleteApproval`),run:V(`runApproval`),plan:V(`planApproval`),reflect:V(`reflectApproval`),generic:V(`approveTitle`)}[c]||V(`approveTitle`)})}),(0,_.jsx)(`div`,{className:`py-2`,children:(0,_.jsx)(MG,{variant:c,args:o,details:s})}),(0,_.jsxs)(Kp,{className:`gap-2`,children:[(0,_.jsx)(Bp,{variant:`outline`,onClick:()=>n(r,!1),children:V(`deny`)}),(0,_.jsx)(Bp,{onClick:()=>n(r,!0),children:V(`approve`)})]})]})})}var PG=Rp(`inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 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/90`,secondary:`bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90`,destructive:`bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90`,outline:`border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,ghost:`[a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,link:`text-primary underline-offset-4 [a&]:hover:underline`}},defaultVariants:{variant:`default`}});function FG({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,_.jsx)(n?y:`span`,{"data-slot":`badge`,"data-variant":t,className:B(PG({variant:t}),e),...r})}function IG({className:e,...t}){return(0,_.jsx)(`textarea`,{"data-slot":`textarea`,className:B(`flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40`,e),...t})}var LG={planner:`bg-(--accent-purple-bg) text-(--accent-purple)`,coder:`bg-(--accent-green-bg) text-(--accent-green)`,reviewer:`bg-(--accent-orange-bg) text-(--accent-orange)`,tester:`bg-(--accent-blue-bg) text-(--accent-blue)`,advisor:`bg-(--accent-blue-bg) text-(--accent-blue)`,summarizer:`bg-(--accent-cyan-bg) text-(--accent-cyan)`};function RG({steps:e}){if(!e?.length)return null;let t=e.filter(e=>e.status===`done`).length,n=t===e.length,r=Math.round(t/e.length*100);return(0,_.jsxs)(`div`,{className:`border border-(--border-default) rounded-lg p-3 my-2 max-w-3xl mx-auto bg-(--bg-secondary)`,children:[(0,_.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,_.jsx)(`span`,{className:`text-[13px] font-medium text-(--text-primary)`,children:V(`planTitle`)}),(0,_.jsx)(FG,{className:B(`text-[11px]`,n?`bg-(--accent-green-bg) text-(--accent-green)`:`bg-(--accent-blue-bg) text-(--accent-blue)`),children:n?V(`planDone`):`${t}/${e.length}`})]}),(0,_.jsx)(hG,{value:r,className:`h-1.5 mb-3`}),(0,_.jsx)(`div`,{className:`space-y-1.5`,children:e.map((e,t)=>(0,_.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,_.jsx)(`span`,{className:B(`w-5 h-5 rounded-full flex items-center justify-center text-[11px] font-medium shrink-0`,e.status===`done`&&`bg-(--accent-green-bg) text-(--accent-green)`,e.status===`failed`&&`bg-(--accent-red-bg) text-(--accent-red)`,e.status===`running`&&`bg-(--accent-blue-bg) text-(--accent-blue)`,e.status===`pending`&&`bg-(--muted) text-(--muted-foreground)`),children:e.status===`done`?`✓`:e.status===`failed`?`✗`:e.status===`running`?`▶`:e.index+1}),(0,_.jsx)(FG,{variant:`outline`,className:B(`text-[11px] px-1.5 py-0`,LG[e.role]||`bg-(--muted) text-(--muted-foreground)`),children:e.role?.toUpperCase()}),(0,_.jsx)(`span`,{className:`truncate text-(--text-secondary)`,children:e.title})]},t))})]})}function zG({plan:e,onAction:t,disabled:n=!1}){let[r,i]=(0,d.useState)(!1),[a,o]=(0,d.useState)(``);if(!e)return null;let s=Array.isArray(e.steps)?e.steps:[];return(0,_.jsxs)(`div`,{className:`border border-(--border-default) rounded-lg p-3 max-w-3xl mx-auto bg-(--bg-secondary) space-y-2.5`,children:[(0,_.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,_.jsx)(`span`,{className:`text-[13px] font-medium text-(--text-primary)`,children:V(`planReviewTitle`)}),(0,_.jsx)(FG,{className:`text-[11px] bg-(--accent-orange-bg) text-(--accent-orange)`,children:V(`planReviewStatus`)})]}),(0,_.jsx)(`p`,{className:`text-[13px] text-(--text-secondary) leading-relaxed`,children:e.goal}),e.summary&&(0,_.jsx)(`p`,{className:`text-[12px] text-(--text-muted) leading-relaxed`,children:e.summary}),(0,_.jsx)(`div`,{className:`space-y-1.5`,children:s.map((e,t)=>(0,_.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,_.jsx)(`span`,{className:`w-5 h-5 rounded-full bg-(--muted) text-(--muted-foreground) flex items-center justify-center text-[11px] font-medium shrink-0`,children:t+1}),(0,_.jsx)(FG,{variant:`outline`,className:B(`text-[11px] px-1.5 py-0 shrink-0`,LG[e.role||``]||`bg-(--muted) text-(--muted-foreground)`),children:String(e.role||`step`).toUpperCase()}),(0,_.jsx)(`span`,{className:`truncate text-(--text-secondary)`,children:e.title})]},t))}),r&&(0,_.jsx)(IG,{value:a,onChange:e=>o(e.target.value),placeholder:V(`planEditPlaceholder`),className:`min-h-[64px] text-[13px]`,autoFocus:!0}),(0,_.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,_.jsx)(Bp,{variant:`destructive`,size:`xs`,disabled:n,onClick:()=>t(`reject`),children:V(`planReject`)}),(0,_.jsx)(Bp,{variant:`outline`,size:`xs`,disabled:n||r&&!a.trim(),onClick:()=>{r?(a.trim()&&t(`edit`,a),a.trim()&&(i(!1),o(``))):i(!0)},children:V(r?`planSubmitFeedback`:`planEdit`)}),(0,_.jsx)(Bp,{size:`xs`,disabled:n,onClick:()=>t(`approve`),children:V(`planApprove`)})]})]})}function BG({className:e,type:t,...n}){return(0,_.jsx)(`input`,{type:t,"data-slot":`input`,className:B(`h-8 w-full min-w-0 rounded-md border border-(--border-default) bg-transparent px-3 py-1 text-[13px] transition-colors outline-none placeholder:text-(--text-muted) disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50`,`focus-visible:border-(--text-secondary) focus-visible:ring-0`,e),...n})}function VG({...e}){return(0,_.jsx)(Ic,{"data-slot":`select`,...e})}function HG({...e}){return(0,_.jsx)(Rc,{"data-slot":`select-value`,...e})}function UG({className:e,size:t,children:n,...r}){return(0,_.jsxs)(Lc,{"data-slot":`select-trigger`,"data-size":t,className:B(`flex w-fit items-center justify-between gap-2 rounded-md border border-(--border-default) bg-transparent px-3 py-1 text-[13px] whitespace-nowrap transition-colors outline-none focus-visible:border-(--text-secondary) focus-visible:ring-0 disabled:cursor-not-allowed disabled:opacity-50 data-[placeholder]:text-(--text-muted) h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-(--text-muted)`,e),...r,children:[n,(0,_.jsx)(zc,{asChild:!0,children:(0,_.jsx)(Yf,{className:`size-3.5 opacity-50`})})]})}function WG({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,_.jsx)(Bc,{children:(0,_.jsxs)(Vc,{"data-slot":`select-content`,className:B(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border border-(--border-default) bg-(--bg-primary) text-(--text-primary) shadow-md 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]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-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:r,...i,children:[(0,_.jsx)(KG,{}),(0,_.jsx)(Hc,{className:B(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,_.jsx)(qG,{})]})})}function GG({className:e,children:t,...n}){return(0,_.jsxs)(Uc,{"data-slot":`select-item`,className:B(`relative flex w-full cursor-pointer items-center gap-2 rounded-md py-1.5 pr-8 pl-2 text-[13px] outline-hidden select-none hover:bg-(--bg-hover) data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-(--text-muted) *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,_.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,_.jsx)(Gc,{children:(0,_.jsx)(Jf,{className:`size-4`})})}),(0,_.jsx)(Wc,{children:t})]})}function KG({className:e,...t}){return(0,_.jsx)(Kc,{"data-slot":`select-scroll-up-button`,className:B(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,_.jsx)(Yf,{className:`size-4 rotate-180`})})}function qG({className:e,...t}){return(0,_.jsx)(qc,{"data-slot":`select-scroll-down-button`,className:B(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,_.jsx)(Yf,{className:`size-4`})})}function JG(e,t){return t.split(`.`).reduce((e,t)=>e?.[t],e)}function YG({open:e,onOpenChange:t}){let n=[{title:V(`gateway`),keys:[{path:`gateway.base_url`,label:V(`baseUrl`),placeholder:`http://127.0.0.1:8000/v1`},{path:`gateway.api_key`,label:V(`apiKey`),type:`password`,placeholder:`sk-...`},{path:`gateway.timeout_ms`,label:V(`timeout`),type:`number`},{path:`gateway.max_retries`,label:V(`maxRetries`),type:`number`}]},{title:V(`sdk`),keys:[{path:`sdk.provider`,label:V(`provider`),options:[`openai-compatible`,`anthropic`]}]},{title:V(`model`),keys:[{path:`model.name`,label:V(`modelName`),placeholder:`gpt-4.1-mini`},{path:`model.fast_name`,label:V(`fastModel`),placeholder:`fallback to Model Name when empty`},{path:`model.max_context_tokens`,label:V(`maxContextTokens`),type:`number`}]},{title:V(`execution`),keys:[{path:`execution.mode`,label:V(`mode`),options:[`auto`,`plan`]},{path:`execution.max_steps`,label:V(`maxSteps`),type:`number`},{path:`ui.reply_language`,label:V(`replyLanguage`),options:[`zh`,`en`]}]},{title:V(`context`),keys:[{path:`context.preflight_trigger_pct`,label:V(`preflightTrigger`),type:`number`,placeholder:`60`},{path:`context.hard_limit_pct`,label:V(`hardLimit`),type:`number`,placeholder:`98`},{path:`context.tool_result_max_chars`,label:V(`toolResultMaxChars`),type:`number`,placeholder:`12000`},{path:`context.microcompact_enabled`,label:V(`microcompactEnabled`),options:[`true`,`false`]},{path:`context.microcompact_keep_recent`,label:V(`microcompactKeepRecent`),type:`number`,placeholder:`5`}]},{title:V(`shell`),keys:[{path:`shell.default`,label:V(`defaultShell`),options:[`bash`,`powershell`,`zsh`,`cmd`]}]}],[r,i]=(0,d.useState)(null),[a,o]=(0,d.useState)({}),[s,c]=(0,d.useState)(!1);(0,d.useEffect)(()=>{e&&(c(!0),zd().then(e=>{i(e),o({})}).catch(()=>{}).finally(()=>c(!1)))},[e]);let l=(e,t)=>{o(n=>({...n,[e]:t}))},u=e=>e in a?a[e]:r?String(JG(r,e)??``):``,f=Object.keys(a).length>0;return(0,_.jsx)(Vp,{open:e,onOpenChange:t,children:(0,_.jsxs)(Wp,{className:`sm:max-w-[640px] max-h-[80vh] flex flex-col`,children:[(0,_.jsx)(Gp,{className:`shrink-0`,children:(0,_.jsx)(qp,{children:V(`settingsTitle`)})}),(0,_.jsx)(`div`,{className:`space-y-5 py-1 overflow-y-auto flex-1 min-h-0`,children:s?(0,_.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,_.jsx)(Xp,{})}):n.map((e,t)=>(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`div`,{className:`text-[13px] font-semibold text-(--text-secondary) mb-2.5 uppercase tracking-[0.3px]`,children:e.title}),(0,_.jsx)(`div`,{className:`space-y-2.5`,children:e.keys.map(e=>(0,_.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,_.jsx)(`label`,{className:`text-[13px] text-(--text-muted) w-32 shrink-0`,children:e.label}),e.options?(0,_.jsxs)(VG,{value:u(e.path),onValueChange:t=>l(e.path,t),children:[(0,_.jsx)(UG,{className:`flex-1 h-8 text-[13px]`,children:(0,_.jsx)(HG,{})}),(0,_.jsx)(WG,{children:e.options.map(e=>(0,_.jsx)(GG,{value:e,children:e},e))})]}):(0,_.jsx)(BG,{type:e.type||`text`,value:u(e.path),onChange:t=>l(e.path,t.target.value),placeholder:e.placeholder||``,className:`flex-1 h-8 text-[13px]`})]},e.path))}),t<n.length-1&&(0,_.jsx)(Mp,{className:`mt-4 bg-(--border-default)`})]},e.title))}),(0,_.jsxs)(Kp,{className:`gap-2 shrink-0`,children:[(0,_.jsx)(Bp,{variant:`outline`,onClick:()=>t(!1),className:`text-[13px]`,children:V(`cancel`)}),(0,_.jsx)(Bp,{onClick:async()=>{try{for(let[e,t]of Object.entries(a))await Bd(e,n.flatMap(e=>e.keys).find(t=>t.path===e)?.type===`number`?Number(t):t);o({}),t(!1)}catch(e){console.error(`Config save failed:`,e)}},disabled:!f,className:`text-[13px]`,children:V(`saveChanges`)})]})]})})}function XG({className:e,children:t,...n}){return(0,_.jsxs)(bs,{"data-slot":`scroll-area`,className:B(`relative`,e),...n,children:[(0,_.jsx)(xs,{"data-slot":`scroll-area-viewport`,className:`size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1`,children:t}),(0,_.jsx)(ZG,{}),(0,_.jsx)(Ss,{})]})}function ZG({className:e,orientation:t=`vertical`,...n}){return(0,_.jsx)(Jo,{"data-slot":`scroll-area-scrollbar`,orientation:t,className:B(`flex touch-none p-px transition-colors select-none`,t===`vertical`&&`h-full w-2.5 border-l border-l-transparent`,t===`horizontal`&&`h-2.5 flex-col border-t border-t-transparent`,e),...n,children:(0,_.jsx)(as,{"data-slot":`scroll-area-thumb`,className:`relative flex-1 rounded-full bg-border`})})}function QG({open:e,onOpenChange:t,onOpenProject:n}){let[r,i]=(0,d.useState)(``),[a,o]=(0,d.useState)(null),[s,c]=(0,d.useState)(``);(0,d.useEffect)(()=>{e&&Vd().then(e=>{i(e.cwd||``),c(e.cwd||`/`),l(e.cwd||`/`)}).catch(()=>{})},[e]);let l=async e=>{try{o(await Kd(e)),c(e)}catch{}},u=()=>{let e=r.trim();e&&(t(!1),n(e))},f=(s||``).replace(/\\/g,`/`),p=f.startsWith(`/`),m=f.split(`/`).filter(Boolean);return(0,_.jsx)(Vp,{open:e,onOpenChange:t,children:(0,_.jsxs)(Wp,{className:`sm:max-w-lg`,children:[(0,_.jsx)(Gp,{children:(0,_.jsx)(qp,{children:V(`selectProject`)})}),(0,_.jsxs)(`div`,{className:`flex gap-2`,children:[(0,_.jsx)(BG,{value:r,onChange:e=>i(e.target.value),placeholder:V(`enterOrBrowse`),onKeyDown:e=>e.key===`Enter`&&u(),className:`flex-1 h-8 text-[13px]`}),(0,_.jsx)(Bp,{onClick:u,className:`text-[13px] h-8`,children:V(`select`)})]}),(0,_.jsxs)(`div`,{className:`border border-(--border-default) rounded-lg overflow-hidden`,children:[(0,_.jsx)(`div`,{className:`flex items-center gap-1 text-[12px] px-3 py-2 border-b border-(--border-default) bg-(--bg-secondary) flex-wrap text-(--text-secondary)`,children:m.map((e,t)=>{let n=(p?`/`:``)+m.slice(0,t+1).join(`/`);return(0,_.jsxs)(`span`,{className:`flex items-center gap-1`,children:[t>0&&(0,_.jsx)(`span`,{className:`text-(--text-muted)`,children:`/`}),(0,_.jsx)(`button`,{onClick:()=>{i(n),l(n)},className:B(`hover:underline cursor-pointer border-0 bg-transparent`,t===m.length-1?`text-(--text-primary) font-medium`:`text-(--accent-blue)`),children:e})]},t)})}),(0,_.jsx)(XG,{className:`h-[240px]`,children:a&&(0,_.jsxs)(`div`,{className:`p-2`,children:[m.length>0&&(0,_.jsx)(`button`,{className:`w-full text-left px-2 py-1.5 text-[13px] hover:bg-(--bg-hover) rounded cursor-pointer flex items-center gap-2 border-0 bg-transparent text-(--text-secondary)`,onClick:()=>{let e=(p?`/`:``)+m.slice(0,-1).join(`/`);i(e),l(e)},children:(0,_.jsx)(`span`,{children:`..`})}),(a.dirs||[]).map(e=>(0,_.jsxs)(`button`,{className:`w-full text-left px-2 py-1.5 text-[13px] hover:bg-(--bg-hover) rounded cursor-pointer flex items-center gap-2 border-0 bg-transparent text-(--text-secondary)`,onClick:()=>{i(e.path),l(e.path)},children:[(0,_.jsx)(`span`,{className:`flex-1 truncate`,children:e.name}),e.isGit&&(0,_.jsx)(`span`,{className:`text-[11px] text-(--text-muted) bg-(--bg-tertiary) px-1.5 py-0.5 rounded`,children:`git`})]},e.path)),!(a.dirs||[]).length&&!a.error&&(0,_.jsx)(`div`,{className:`text-center text-[12px] text-(--text-muted) py-4`,children:V(`noSubDirs`)})]})})]})]})})}var $G=[`all`,`enabled`,`builtin`,`custom`];function eK({checked:e,onClick:t,title:n}){return(0,_.jsx)(`button`,{type:`button`,onClick:t,title:n,"aria-pressed":e,className:B(`relative h-5 w-9 rounded-full border shadow-inner transition-colors`,e?`border-(--text-primary) bg-(--text-primary)`:`border-(--border-strong) bg-(--bg-hover)`),children:(0,_.jsx)(`span`,{className:B(`absolute left-0.5 top-0.5 size-3.5 rounded-full transition-transform`,e?`bg-(--bg-primary)`:`bg-(--text-muted)`,e?`translate-x-4`:`translate-x-0`)})})}function tK(e){return V(e===`builtin`?`builtin`:e===`global`?`globalScope`:`projectScope`)}function nK(e){return e?.scope===`builtin`}function rK(e){return nK(e)||e?.enabled!==!1}function iK({skill:e,onSave:t,onCancel:n}){let[r,i]=(0,d.useState)(e?.name||``),[a,o]=(0,d.useState)(e?.description||``),[s,c]=(0,d.useState)(``),[l,u]=(0,d.useState)(!1),f=!e;return(0,d.useEffect)(()=>{if(i(e?.name||``),o(e?.description||``),!e){c(``);return}u(!0),Jd(e.name).then(e=>c(e.content||``)).catch(()=>{}).finally(()=>u(!1))},[e]),(0,_.jsxs)(`div`,{className:`space-y-3`,children:[(0,_.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`div`,{className:`text-[13px] font-medium text-(--text-primary)`,children:V(f?`newSkill`:`editSkill`)}),(0,_.jsx)(`div`,{className:`mt-0.5 text-[11px] text-(--text-muted)`,children:V(`skillEditorHint`)})]}),(0,_.jsx)(FG,{variant:`outline`,className:`rounded-md px-1.5 py-0 text-[10px]`,children:f?V(`projectScope`):tK(e.scope)})]}),(0,_.jsxs)(`div`,{className:`grid gap-3`,children:[(0,_.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,_.jsx)(`label`,{className:`text-[12px] text-(--text-muted)`,children:V(`name`)}),(0,_.jsx)(BG,{value:r,onChange:e=>i(e.target.value),disabled:!f,placeholder:`my-skill`,className:`h-8 text-[13px]`})]}),f&&(0,_.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,_.jsx)(`label`,{className:`text-[12px] text-(--text-muted)`,children:V(`description`)}),(0,_.jsx)(BG,{value:a,onChange:e=>o(e.target.value),placeholder:V(`skillDescriptionPlaceholder`),className:`h-8 text-[13px]`})]}),(0,_.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,_.jsx)(`label`,{className:`text-[12px] text-(--text-muted)`,children:V(`skillContent`)}),l?(0,_.jsxs)(`div`,{className:`rounded-md border border-(--border-default) py-8 text-center text-[12px] text-(--text-muted)`,children:[V(`loading`),`...`]}):(0,_.jsx)(IG,{value:s,onChange:e=>c(e.target.value),className:`min-h-[240px] resize-y text-[13px] font-mono leading-5`,placeholder:`---
|
|
341
|
+
\v\f
\u2028\u2029])`),t));else if(c===`posix`)if(!i&&(u===`graph`||u===`print`)){if(r===`strict`)throw Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let e={graph:`!-~`,print:` -~`}[u];l&&(e=`\0-${vU(e.codePointAt(0)-1)}${vU(e.codePointAt(2)+1)}-\u{10FFFF}`),n(dW(cW(`[${e}]`),t))}else n(dW(lW(cW(LU.get(u)),l),t));else if(c===`property`)NU.has(BH(u))||(e.key=`sc`);else if(c===`space`)n(uW(MH(`space`,{negate:l}),t));else if(c===`word`)n(dW(lW(cW(jU),l),t));else throw Error(`Unexpected character set kind "${c}"`)},Directive({node:e,parent:t,root:n,remove:r,replaceWith:i,removeAllPrevSiblings:a,removeAllNextSiblings:o}){let{kind:s,flags:c}=e;if(s===`flags`)if(!c.enable&&!c.disable)r();else{let e=TH({flags:c});e.body[0].body=o(),i(dW(e,t),{traverse:!0})}else if(s===`keep`){let e=n.body[0],r=n.body.length===1&&nH(e,{type:`Group`})&&e.body[0].body.length===1?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw Error(yU`Uses "\K" in a way that's unsupported`);let o=EH({behind:!0});o.body[0].body=a(),i(dW(o,t))}else throw Error(`Unexpected directive kind "${s}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw Error(`Unsupported flag "P"`);if(e.textSegmentMode===`word`)throw Error(`Unsupported flag "y{w}"`);[`digitIsAscii`,`extended`,`posixIsAscii`,`spaceIsAscii`,`wordIsAscii`,`textSegmentMode`].forEach(t=>delete e[t]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;let{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){let{kind:n}=e;n===`lookbehind`&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){let{kind:r}=e;if(r===`fail`)n(dW(EH({negate:!0}),t));else throw Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type===`Quantifier`){let t=TH();t.body[0].body.push(e.body),e.body=dW(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let n=[],r=!1,i=!1;for(let t of e.body)if(t.body.length===1&&t.body[0].kind===`search_start`)t.body.pop();else{let e=nW(t.body);e?(r=!0,Array.isArray(e)?n.push(...e):n.push(e)):i=!0}r&&!i&&n.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if(t===`strict`&&n&&r)throw Error(yU`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!sW(n)&&(n=QU(n,t),e.ref=n)}},WU={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){let{orphan:r,ref:i}=e;r||n.set(e,[...t.get(i).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:i,groupsByName:a,multiplexCapturesToLeftByRef:o,openRefs:s,reffedNodesByReferencer:c}){let l=i.get(e);if(l&&s.has(e.number)){let r=uW(XU(e.number),t);c.set(r,s.get(e.number)),n(r);return}s.set(e.number,e),o.set(e.number,[]),e.name&&CU(o,e.name,[]);let u=o.get(e.name??e.number);for(let t=0;t<u.length;t++){let n=u[t];if(l===n.node||l&&l===n.origin||e===n.origin){u.splice(t,1);break}}if(o.get(e.number).push({node:e,origin:l}),e.name&&o.get(e.name).push({node:e,origin:l}),e.name){let t=CU(a,e.name,new Map),n=!1;if(l)n=!0;else for(let e of t.values())if(!e.hasDuplicateNameToRemove){n=!0;break}a.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:n})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=SU(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){let{isRecursive:i,ref:a}=e;if(i){let n=t;for(;(n=n.parent)&&!(n.type===`CapturingGroup`&&(n.name===a||n.number===a)););r.reffedNodesByReferencer.set(e,n);return}let o=r.subroutineRefMap.get(a),s=a===0,c=s?XU(0):YU(o,r.groupOriginByCopy,null),l=c;if(!s){let e=$U(ZU(o,e=>e.type===`Group`&&!!e.flags)),t=e?SU(r.globalFlags,e):r.globalFlags;qU(t,r.currentFlags)||(l=TH({flags:eW(t)}),l.body[0].body.push(c))}n(dW(l,t),{traverse:!s})}},GU={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}let i=r.reffedNodesByReferencer.get(e).filter(t=>JU(t,e));i.length?i.length>1?n(dW(TH({atomic:!0,body:i.reverse().map(e=>hH({body:[_H(e.number)]}))}),t)):e.ref=i[0].number:n(dW(EH({negate:!0}),t))},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){let n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let t=0;t<n;t++){let t=vH();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){!e.isRecursive||e.ref===0||(e.ref=t.reffedNodesByReferencer.get(e).number)}};function KU(e){UH(e,{"*"({node:e,parent:t}){e.parent=t}})}function qU(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function JU(e,t){let n=t;do{if(n.type===`Regex`)return!1;if(n.type===`Alternative`)continue;if(n===e)return!1;let t=tW(n.parent);for(let r of t){if(r===n)break;if(r===e||rW(r,e))return!0}}while(n=n.parent);throw Error(`Unexpected path`)}function YU(e,t,n,r){let i=Array.isArray(e)?[]:{};for(let[a,o]of Object.entries(e))a===`parent`?i.parent=Array.isArray(n)?r:n:o&&typeof o==`object`?i[a]=YU(o,t,i,n):(a===`type`&&o===`CapturingGroup`&&t.set(i,t.get(e)??e),i[a]=o);return i}function XU(e){let t=jH(e);return t.isRecursive=!0,t}function ZU(e,t){let n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function QU(e,t){if(t.has(e))return t.get(e);let n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/gu,`_`)}`;return t.set(e,n),n}function $U(e){let t=[`dotAll`,`ignoreCase`],n={enable:{},disable:{}};return e.forEach(({flags:e})=>{t.forEach(t=>{e.enable?.[t]&&(delete n.disable[t],n.enable[t]=!0),e.disable?.[t]&&(n.disable[t]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function eW({dotAll:e,ignoreCase:t}){let n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),(!e||!t)&&(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function tW(e){if(!e)throw Error(`Node expected`);let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function nW(e){let t=e.find(e=>e.kind===`search_start`||oW(e,{negate:!1})||!iW(e));if(!t)return null;if(t.kind===`search_start`)return t;if(t.type===`LookaroundAssertion`)return t.body[0].body[0];if(t.type===`CapturingGroup`||t.type===`Group`){let e=[];for(let n of t.body){let t=nW(n.body);if(!t)return null;Array.isArray(t)?e.push(...t):e.push(t)}return e}return null}function rW(e,t){let n=tW(e)??[];for(let e of n)if(e===t||rW(e,t))return!0;return!1}function iW({type:e}){return e===`Assertion`||e===`Directive`||e===`LookaroundAssertion`}function aW(e){let t=[`Character`,`CharacterClass`,`CharacterSet`];return t.includes(e.type)||e.type===`Quantifier`&&e.min&&t.includes(e.body.type)}function oW(e,t){let n={negate:null,...t};return e.type===`LookaroundAssertion`&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&nH(e.body[0],{type:`Assertion`,kind:`search_start`})}function sW(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function cW(e,t){let n=aH(e,{...t,unicodePropertyMap:NU}).body;return n.length>1||n[0].body.length>1?TH({body:n}):n[0].body[0]}function lW(e,t){return e.negate=t,e}function uW(e,t){return e.parent=t,e}function dW(e,t){return KU(e),e.parent=t,e}function fW(e,t){let n=OU(t),r=wU(n.target,`ES2024`),i=wU(n.target,`ES2025`),a=n.rules.recursionLimit;if(!Number.isInteger(a)||a<2||a>20)throw Error(`Invalid recursionLimit; use 2-20`);let o=null,s=null;if(!i){let t=[e.flags.ignoreCase];UH(e,pW,{getCurrentModI:()=>t.at(-1),popModI(){t.pop()},pushModI(e){t.push(e)},setHasCasedChar(){t.at(-1)?o=!0:s=!0}})}let c={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||o)&&!s)},l=e,u={accuracy:n.accuracy,appliedGlobalFlags:c,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:l,originMap:e._originMap,recursionLimit:a,useAppliedIgnoreCase:!!(!i&&o&&s),useFlagMods:i,useFlagV:r,verbose:n.verbose};function d(e){return u.lastNode=l,l=e,TU(mW[e.type],`Unexpected node type "${e.type}"`)(e,u,d)}let f={pattern:e.body.map(d).join(`|`),flags:d(e.flags),options:{...e.options}};return r||(delete f.options.force.v,f.options.disable.v=!0,f.options.unicodeSetsPlugin=null),f._captureTransfers=new Map,f._hiddenCaptures=[],u.captureMap.forEach((e,t)=>{e.hidden&&f._hiddenCaptures.push(t),e.transferTo&&CU(f._captureTransfers,e.transferTo,[]).push(t)}),f}var pW={"*":{enter({node:e},t){if(EW(e)){let n=t.getCurrentModI();t.pushModI(e.flags?SU({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){EW(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){bW(vU(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),xW(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind===`property`&&VU.has(e.value)&&t.setHasCasedChar()}},mW={Alternative({body:e},t,n){return e.map(n).join(``)},Assertion({kind:e,negate:t}){if(e===`string_end`)return`$`;if(e===`string_start`)return`^`;if(e===`word_boundary`)return t?yU`\B`:yU`\b`;throw Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!=`number`)throw Error(`Unexpected named backref in transformed AST`);if(!t.useFlagMods&&t.accuracy===`strict`&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw Error(`Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy`);return`\\`+e},CapturingGroup(e,t,n){let{body:r,name:i,number:a}=e,o={ignoreCase:t.currentFlags.ignoreCase},s=t.originMap.get(e);return s&&(o.hidden=!0,a>s.number&&(o.transferTo=s.number)),t.captureMap.set(a,o),`(${i?`?<${i}>`:``}${r.map(n).join(`|`)})`},Character({value:e},t){let n=vU(e),r=SW(e,{escDigit:t.lastNode.type===`Backreference`,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&bW(n)){let e=MU(n);return t.inCharClass?e.join(``):e.length>1?`[${e.join(``)}]`:e[0]}return n},CharacterClass(e,t,n){let{kind:r,negate:i,parent:a}=e,{body:o}=e;if(r===`intersection`&&!t.useFlagV)throw Error(`Use of character class intersection requires min target ES2024`);bU.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&o.some(OW)&&(o=[yH(45),...o.filter(e=>!OW(e))]);let s=()=>`[${i?`^`:``}${o.map(n).join(r===`intersection`?`&&`:``)}]`;if(!t.inCharClass){if((!t.useFlagV||bU.bugNestedClassIgnoresNegation)&&!i){let t=o.filter(e=>e.type===`CharacterClass`&&e.kind===`union`&&e.negate);if(t.length){let r=TH(),i=r.body[0];return r.parent=a,i.parent=r,o=o.filter(e=>!t.includes(e)),e.body=o,o.length?(e.parent=i,i.body.push(e)):r.body.pop(),t.forEach(e=>{let t=hH({body:[e]});e.parent=t,t.parent=r,r.body.push(t)}),n(r)}}t.inCharClass=!0;let r=s();return t.inCharClass=!1,r}let c=o[0];if(r===`union`&&!i&&c&&((!t.useFlagV||!t.verbose)&&a.kind===`union`&&!(bU.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&a.kind===`intersection`&&o.length===1&&c.type!==`CharacterClassRange`))return o.map(n).join(``);if(!t.useFlagV&&a.type===`CharacterClass`)throw Error(`Uses nested character class in a way that requires min target ES2024`);return s()},CharacterClassRange(e,t){let n=e.min.value,r=e.max.value,i={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},a=SW(n,i),o=SW(r,i),s=new Set;return t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&CW(xW(e)).forEach(e=>{s.add(Array.isArray(e)?`${SW(e[0],i)}-${SW(e[1],i)}`:SW(e,i))}),`${a}-${o}${[...s].join(``)}`},CharacterSet({kind:e,negate:t,value:n,key:r},i){if(e===`dot`)return i.currentFlags.dotAll?i.appliedGlobalFlags.dotAll||i.useFlagMods?`.`:`[^]`:yU`[^\n]`;if(e===`digit`)return t?yU`\D`:yU`\d`;if(e===`property`){if(i.useAppliedIgnoreCase&&i.currentFlags.ignoreCase&&VU.has(n))throw Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?yU`\P`:yU`\p`}{${r?`${r}=`:``}${n}}`}if(e===`word`)return t?yU`\W`:yU`\w`;throw Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?`i`:``)+(e.dotAll?`s`:``)+(e.sticky?`y`:``)},Group({atomic:e,body:t,flags:n,parent:r},i,a){let o=i.currentFlags;n&&(i.currentFlags=SU(o,n));let s=t.map(a).join(`|`),c=!i.verbose&&t.length===1&&r.type!==`Quantifier`&&!e&&(!i.useFlagMods||!n)?s:`(?${wW(e,n,i.useFlagMods)}${s})`;return i.currentFlags=o,c},LookaroundAssertion({body:e,kind:t,negate:n},r,i){return`(?${`${t===`lookahead`?``:`<`}${n?`!`:`=`}`}${e.map(i).join(`|`)})`},Quantifier(e,t,n){return n(e.body)+TW(e)},Subroutine({isRecursive:e,ref:t},n){if(!e)throw Error(`Unexpected non-recursive subroutine in transformed AST`);let r=n.recursionLimit;return t===0?`(?R=${r})`:yU`\g<${t}&R=${r}>`}},hW=new Set([`$`,`(`,`)`,`*`,`+`,`.`,`?`,`[`,`\\`,`]`,`^`,`{`,`|`,`}`]),gW=new Set([`-`,`\\`,`]`,`^`,`[`]),_W=new Set("()-/[\\]^{|}!#$%&*+,.:;<=>?@`~".split(``)),vW=new Map([[9,yU`\t`],[10,yU`\n`],[11,yU`\v`],[12,yU`\f`],[13,yU`\r`],[8232,yU`\u2028`],[8233,yU`\u2029`],[65279,yU`\uFEFF`]]),yW=/^\p{Cased}$/u;function bW(e){return yW.test(e)}function xW(e,t){let n=!!t?.firstOnly,r=e.min.value,i=e.max.value,a=[];if(r<65&&(i===65535||i>=131071)||r===65536&&i>=131071)return a;for(let e=r;e<=i;e++){let t=vU(e);if(!bW(t))continue;let o=MU(t).filter(e=>{let t=e.codePointAt(0);return t<r||t>i});if(o.length&&(a.push(...o),n))break}return a}function SW(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(vW.has(e))return vW.get(e);if(e<32||e>126&&e<160||e>262143||t&&DW(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,`0`)}`;let i=n?r?_W:gW:hW,a=vU(e);return(i.has(a)?`\\`:``)+a}function CW(e){let t=e.map(e=>e.codePointAt(0)).sort((e,t)=>e-t),n=[],r=null;for(let e=0;e<t.length;e++)t[e+1]===t[e]+1?r??=t[e]:r===null?n.push(t[e]):(n.push([r,t[e]]),r=null);return n}function wW(e,t,n){if(e)return`>`;let r=``;if(t&&n){let{enable:e,disable:n}=t;r=(e?.ignoreCase?`i`:``)+(e?.dotAll?`s`:``)+(n?`-`:``)+(n?.ignoreCase?`i`:``)+(n?.dotAll?`s`:``)}return`${r}:`}function TW({kind:e,max:t,min:n}){let r;return r=!n&&t===1?`?`:!n&&t===1/0?`*`:n===1&&t===1/0?`+`:n===t?`{${n}}`:`{${n},${t===1/0?``:t}}`,r+{greedy:``,lazy:`?`,possessive:`+`}[e]}function EW({type:e}){return e===`CapturingGroup`||e===`Group`||e===`LookaroundAssertion`}function DW(e){return e>47&&e<58}function OW({type:e,value:t}){return e===`Character`&&t===45}var kW=class e extends RegExp{#e=new Map;#t=null;#n;#r=null;#i=null;rawOptions={};get source(){return this.#n||`(?:)`}constructor(t,n,r){let i=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw Error(`Cannot provide options when copying a regexp`);let i=t;super(i,n),this.#n=i.source,i instanceof e&&(this.#e=i.#e,this.#r=i.#r,this.#i=i.#i,this.rawOptions=i.rawOptions)}else{let e={hiddenCaptures:[],strategy:null,transfers:[],...r};super(i?``:t,n),this.#n=t,this.#e=jW(e.hiddenCaptures,e.transfers),this.#i=e.strategy,this.rawOptions=r??{}}i||(this.#t=this)}exec(t){if(!this.#t){let{lazyCompile:t,...n}=this.rawOptions;this.#t=new e(this.#n,this.flags,n)}let n=this.global||this.sticky,r=this.lastIndex;if(this.#i===`clip_search`&&n&&r){this.lastIndex=0;let e=this.#a(t.slice(r));return e&&(AW(e,r,t,this.hasIndices),this.lastIndex+=r),e}return this.#a(t)}#a(e){this.#t.lastIndex=this.lastIndex;let t=super.exec.call(this.#t,e);if(this.lastIndex=this.#t.lastIndex,!t||!this.#e.size)return t;let n=[...t];t.length=1;let r;this.hasIndices&&(r=[...t.indices],t.indices.length=1);let i=[0];for(let e=1;e<n.length;e++){let{hidden:a,transferTo:o}=this.#e.get(e)??{};if(a?i.push(null):(i.push(t.length),t.push(n[e]),this.hasIndices&&t.indices.push(r[e])),o&&n[e]!==void 0){let a=i[o];if(!a)throw Error(`Invalid capture transfer to "${a}"`);if(t[a]=n[e],this.hasIndices&&(t.indices[a]=r[e]),t.groups){this.#r||=MW(this.source);let i=this.#r.get(o);i&&(t.groups[i]=n[e],this.hasIndices&&(t.indices.groups[i]=r[e]))}}}return t}};function AW(e,t,n,r){if(e.index+=t,e.input=n,r){let n=e.indices;for(let e=0;e<n.length;e++){let r=n[e];r&&(n[e]=[r[0]+t,r[1]+t])}let r=n.groups;r&&Object.keys(r).forEach(e=>{let n=r[e];n&&(r[e]=[n[0]+t,n[1]+t])})}}function jW(e,t){let n=new Map;for(let t of e)n.set(t,{hidden:!0});for(let[e,r]of t)for(let t of r)CU(n,t,{}).transferTo=e;return n}function MW(e){let t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map,r=0,i=0,a;for(;a=t.exec(e);){let{0:e,groups:{capture:t,name:o}}=a;e===`[`?r++:r?e===`]`&&r--:t&&(i++,o&&n.set(i,o))}return n}function NW(e,t){let n=PW(e,t);return n.options?new kW(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function PW(e,t){let n=OU(t),r=HU(aH(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:NU}),{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),i=fW(r,n),a=fU(i.pattern,{captureTransfers:i._captureTransfers,hiddenCaptures:i._hiddenCaptures,mode:`external`}),o=nU(aU(a.pattern).pattern,{captureTransfers:a.captureTransfers,hiddenCaptures:a.hiddenCaptures}),s={pattern:o.pattern,flags:`${n.hasIndices?`d`:``}${n.global?`g`:``}${i.flags}${i.options.disable.v?`u`:`v`}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw Error(`Lazy compilation requires subclass`)}else{let e=o.hiddenCaptures.sort((e,t)=>e-t),t=Array.from(o.captureTransfers),i=r._strategy,a=s.pattern.length>=n.lazyCompileLength;(e.length||t.length||i||a)&&(s.options={...e.length&&{hiddenCaptures:e},...t.length&&{transfers:t},...i&&{strategy:i},...a&&{lazyCompile:a}})}return s}var FW=[`github-light`,`github-dark`,`catppuccin-latte`,`catppuccin-mocha`,`tokyo-night`,`one-light`,`one-dark-pro`,`github-light-default`,`github-dark-default`,`light-plus`,`dark-plus`],IW=null,LW=null;function RW(){return LW?Promise.resolve(LW):(IW||=iV({themes:FW,langs:[]}).then(e=>(LW=e,e)),IW)}var zW=new Set;typeof window<`u`&&window.addEventListener(`codemini-theme-palette-change`,()=>{IW=null,LW=null,zW.clear()});async function BW(e){if(!e||zW.has(e))return;let t=await RW();try{t.getLoadedLanguages().includes(e)||await t.loadLanguage(e),zW.add(e)}catch{zW.add(e)}}function VW(){return RW().catch(()=>{}),{name:`shiki`,type:`code-highlighter`,getThemes:()=>FW,getSupportedLanguages:()=>LW?LW.getLoadedLanguages():[],supportsLanguage:e=>LW?LW.getLoadedLanguages().includes(e):!1,highlight:(e,t)=>{let{code:n,language:r}=e;return UW(n,r)||(BW(r).then(()=>{t&&t(UW(n,r)||HW(n))}),HW(n))}}}function HW(e){return{fg:void 0,bg:void 0,rootStyle:void 0,tokens:String(e??``).split(/\r?\n/).map(e=>[{content:e}])}}function UW(e,t){if(!LW)return null;try{if(!LW.getLoadedLanguages().includes(t))return null;let n=LW.codeToTokens(e,{lang:t,themes:WW(),defaultColor:!1});return{fg:n.fg,bg:n.bg,rootStyle:n.rootStyle,tokens:n.tokens}}catch{return null}}function WW(){if(typeof document>`u`)return{light:`github-light`,dark:`github-dark`};let e=document.documentElement.dataset.palette||`default`;return e===`catppuccin`?{light:`catppuccin-latte`,dark:`catppuccin-mocha`}:e===`tokyonight`?{light:`github-light`,dark:`tokyo-night`}:e===`one`?{light:`one-light`,dark:`one-dark-pro`}:e===`github`?{light:`github-light-default`,dark:`github-dark-default`}:e===`vscode`?{light:`light-plus`,dark:`dark-plus`}:{light:`github-light`,dark:`github-dark`}}var GW=VW(),KW=class extends d.Component{state={hasError:!1,retryCount:0};retryTimer=null;static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){console.warn(`Streamdown render failed; retrying with markdown renderer.`,e),!(this.state.retryCount>=2)&&(clearTimeout(this.retryTimer),this.retryTimer=window.setTimeout(()=>{this.setState(e=>({hasError:!1,retryCount:e.retryCount+1}))},80))}componentDidUpdate(e){(e.fallbackText!==this.props.fallbackText||e.resetKey!==this.props.resetKey)&&(this.state.hasError||this.state.retryCount)&&(clearTimeout(this.retryTimer),this.setState({hasError:!1,retryCount:0}))}componentWillUnmount(){clearTimeout(this.retryTimer)}render(){return this.state.hasError?(0,_.jsx)(`div`,{className:`msg-body whitespace-pre-wrap text-(--text-primary)`,children:this.props.fallbackText}):this.props.children}};function qW({text:e,streaming:t,className:n}){let r=typeof e==`string`?e:String(e||``);if(!r)return null;let i=t?`streaming`:`static`;return(0,_.jsx)(KW,{fallbackText:r,resetKey:i,children:(0,_.jsx)(`div`,{className:B(`msg-body`,t&&`streaming-cursor`,n),children:(0,_.jsx)(BF,{mode:i,isAnimating:t,parseIncompleteMarkdown:!0,showLineNumbers:!1,plugins:{code:GW},controls:{tables:!0,codeBlocks:!0,mermaid:{display:!0,wrap:!0}},children:r})})})}function JW({todos:e}){return e?.length?(0,_.jsx)(`div`,{className:`space-y-1 mt-2`,children:e.map((e,t)=>{let n=e.status===`completed`?`✓`:e.status===`in_progress`?`●`:``;return(0,_.jsxs)(`div`,{className:B(`flex items-center gap-2 text-[13px] py-0.5`,e.status===`completed`&&`text-(--accent-green)`,e.status===`in_progress`&&`text-(--accent-blue)`,e.status===`pending`&&`text-(--muted-foreground)`),children:[(0,_.jsx)(`span`,{className:`w-4 text-center shrink-0`,children:n}),(0,_.jsx)(`span`,{children:e.content||e.activeForm})]},t)})}):null}var YW={you:{badge:`bg-(--accent-blue-bg) text-(--accent-blue)`,label:`You`},general:{badge:`bg-(--accent-green-bg) text-(--accent-green)`,label:`General`},coder:{badge:`bg-(--accent-green-bg) text-(--accent-green)`,label:`Coder`},advisor:{badge:`bg-(--accent-blue-bg) text-(--accent-blue)`,label:`Advisor`},planner:{badge:`bg-(--accent-purple-bg) text-(--accent-purple)`,label:`Planner`},reviewer:{badge:`bg-(--accent-orange-bg) text-(--accent-orange)`,label:`Reviewer`},tester:{badge:`bg-(--accent-blue-bg) text-(--accent-blue)`,label:`Tester`},summarizer:{badge:`bg-(--accent-cyan-bg) text-(--accent-cyan)`,label:`Summarizer`},system:{badge:`bg-(--muted) text-(--muted-foreground)`,label:`System`},error:{badge:`bg-(--accent-red-bg) text-(--accent-red)`,label:`Error`},pending:{badge:`bg-(--accent-cyan-bg) text-(--accent-cyan)`,label:`Pending`}},XW={running:`bg-(--accent-blue-bg) text-(--accent-blue)`,done:`bg-(--accent-green-bg) text-(--accent-green)`,error:`bg-(--accent-red-bg) text-(--accent-red)`,auto:`bg-(--accent-purple-bg) text-(--accent-purple)`},ZW=3;function QW(e){let t=String(e||``);return t===`Dream triggered...`?{status:`running`,title:`Dream started`,description:`Auto memory consolidation is running in the background.`}:t===`Dream complete`?{status:`done`,title:`Dream complete`,description:`Memory consolidation finished.`}:t.startsWith(`Dream done`)?{status:`done`,title:t,description:`Memory inbox and stale buckets were consolidated.`}:t.startsWith(`Dream failed:`)?{status:`error`,title:`Dream failed`,description:t.slice(13).trim()||`Unknown error.`}:null}function $W({notice:e}){let t=e.status===`running`?fp:e.status===`error`?$f:Qf;return(0,_.jsx)(`div`,{className:`py-2 px-6`,children:(0,_.jsx)(`div`,{className:`max-w-[860px] mx-auto flex justify-center`,children:(0,_.jsxs)(`div`,{className:B(`inline-flex max-w-full items-center gap-2 rounded-lg border px-3 py-2 text-left text-xs shadow-sm`,e.status===`error`?`border-(--accent-red)/30 bg-(--accent-red-bg) text-(--accent-red)`:`border-(--border-default) bg-(--bg-secondary) text-(--text-secondary)`),children:[(0,_.jsx)(t,{size:14,className:B(`shrink-0`,e.status===`running`&&`animate-spin text-(--accent-cyan)`,e.status===`done`&&`text-(--accent-green)`)}),(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsx)(`div`,{className:`font-medium text-(--text-primary) truncate`,children:e.title}),e.description&&(0,_.jsx)(`div`,{className:`mt-0.5 text-(--text-muted) truncate`,children:e.description})]})]})})})}function eG({cards:e}){let[t,n]=(0,d.useState)(!1),r=e.length,i=r>ZW&&!t,a=r-ZW,o=i?e.slice(r-ZW):e;return(0,_.jsxs)(`div`,{className:`space-y-2 my-2`,children:[i&&a>0&&(0,_.jsxs)(`button`,{type:`button`,className:`block w-full py-1.5 px-3 text-[11px] text-(--accent-blue) cursor-pointer text-left bg-transparent border-0`,onClick:()=>n(!0),children:[`+`,a,` more tool calls`]}),o.map(e=>(0,_.jsx)(lm,{card:e},e.id)),t&&r>ZW&&(0,_.jsxs)(`button`,{type:`button`,className:`block w-full py-1.5 px-3 text-[11px] text-(--accent-blue) cursor-pointer text-left bg-transparent border-0`,onClick:()=>n(!1),children:[`Collapse `,a,` older tool calls`]})]})}function tG(e){let t=[],n=[],r=()=>{n.length>0&&(t.push({type:`tools`,cards:n}),n=[])};for(let i of e)i.type===`tools`?n.push(...i.cards):i.type===`text`&&i.text&&(r(),t.push({type:`text`,text:i.text,isStreaming:i.isStreaming}));return r(),t}function nG({text:e,skills:t=[]}){let n=String(e||``).match(/^(\/([A-Za-z0-9_-]+))(\s+[\s\S]*)?$/);if(!n)return(0,_.jsx)(qW,{text:e,streaming:!1});let[,r,i,a=``]=n;if(i===`dream`)return(0,_.jsxs)(`div`,{className:`msg-body whitespace-pre-wrap text-(--text-primary)`,children:[(0,_.jsxs)(md,{children:[(0,_.jsx)(hd,{asChild:!0,children:(0,_.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-(--accent-cyan-bg) px-1.5 py-0.5 text-(--accent-cyan) font-mono text-[0.92em] cursor-help align-baseline`,children:[(0,_.jsx)(mp,{size:13}),r]})}),(0,_.jsxs)(gd,{side:`top`,sideOffset:8,className:`max-w-75 px-4 py-3 leading-relaxed whitespace-normal`,children:[(0,_.jsx)(`div`,{className:`font-semibold mb-1.5`,children:`Dream`}),(0,_.jsx)(`div`,{className:`text-(--text-secondary)`,children:`Consolidates memory inbox entries and stale memory buckets. It can run manually with /dream or automatically when the inbox threshold is reached.`})]})]}),a]});let o=t.find(e=>e.name===i);return o?(0,_.jsxs)(`div`,{className:`msg-body whitespace-pre-wrap text-(--text-primary)`,children:[(0,_.jsxs)(md,{children:[(0,_.jsx)(hd,{asChild:!0,children:(0,_.jsx)(`span`,{className:`inline-flex items-center rounded-md bg-(--accent-purple-bg) px-1.5 py-0.5 text-accent-purple font-mono text-[0.92em] cursor-help align-baseline`,children:r})}),(0,_.jsxs)(gd,{side:`top`,sideOffset:8,className:`max-w-75 px-4 py-3 leading-relaxed whitespace-normal`,children:[(0,_.jsx)(`div`,{className:`font-semibold mb-1.5`,children:o.name}),(0,_.jsx)(`div`,{className:`text-(--text-secondary)`,children:o.description||`No description`})]})]}),a]}):(0,_.jsx)(qW,{text:e,streaming:!1})}function rG({message:e,skills:t=[]}){let{role:n,segments:r,skillBadges:i,fileChanges:a,startupTodos:o,text:s,timestamp:c,planStep:l}=e,u=YW[n]||YW.general,f=c?rm(c):``,p=(0,d.useMemo)(()=>tG(r||[]),[r]);if(n===`divider`)return(0,_.jsx)(`div`,{className:`py-3 px-6 text-center`,children:(0,_.jsxs)(`div`,{className:`max-w-[860px] mx-auto relative`,children:[(0,_.jsx)(`div`,{className:`border-t border-border`}),(0,_.jsx)(`span`,{className:`text-xs text-(--text-muted) bg-(--bg-primary) px-2 absolute -top-2.5 left-1/2 -translate-x-1/2 whitespace-nowrap`,children:s||`以上内容已压缩`})]})});if(n===`system`){let e=QW(s);return e?(0,_.jsx)($W,{notice:e}):s?.includes(`等待计划审阅`)||s?.includes(`Waiting for plan review`)?null:(0,_.jsx)(`div`,{className:`py-2 px-6 text-xs text-(--text-muted) text-center`,children:(0,_.jsxs)(`div`,{className:`max-w-[860px] mx-auto px-3 py-1`,children:[s,o&&(0,_.jsx)(JW,{todos:o})]})})}let m=n===`you`&&(s||r?.filter(e=>e.type===`text`).map(e=>e.text).join(``))||``;return(0,_.jsx)(`div`,{className:B(`py-2 my-[22px]`,n===`you`&&`flex justify-end`),children:n===`you`?(0,_.jsxs)(`div`,{className:`w-fit max-w-full bg-(--bg-tertiary) rounded-2xl px-4 py-3`,children:[m&&(0,_.jsx)(nG,{text:m,skills:t}),o&&(0,_.jsx)(JW,{todos:o})]}):(0,_.jsxs)(`div`,{children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,_.jsx)(`span`,{className:B(`inline-flex items-center px-2 py-px rounded-full text-[11px] font-semibold uppercase tracking-[0.3px]`,u.badge),children:u.label}),f&&(0,_.jsx)(`span`,{className:`text-[11px] text-(--text-muted)`,children:f})]}),p.map((e,t)=>e.type===`text`?(0,_.jsx)(qW,{text:e.text,streaming:e.isStreaming},`t-${t}-${e.isStreaming?`s`:`d`}`):e.type===`tools`?(0,_.jsx)(eG,{cards:e.cards},`tg-${t}`):null),l&&p.length===0&&l.status!==`done`&&l.status!==`failed`&&(0,_.jsxs)(`div`,{className:`text-[12px] text-(--text-muted) inline-flex items-center gap-1.5`,children:[(0,_.jsx)(`span`,{className:`inline-block size-1 rounded-full bg-(--accent-blue) animate-pulse`}),(0,_.jsx)(`span`,{children:`等待工具调用或模型输出…`})]}),i?.length>0&&(0,_.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,children:i.map((e,t)=>(0,_.jsx)(`span`,{className:B(`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[11px] font-medium`,XW[e.status]),children:e.status===`auto`?`${V(`skillAuto`)}: ${e.name}`:`${e.name} - ${V(`skill`+e.status.charAt(0).toUpperCase()+e.status.slice(1))}`},t))}),a?.length>0&&(0,_.jsxs)(`div`,{className:`mt-2 border border-(--border-default) rounded-lg bg-(--bg-secondary) p-3`,children:[(0,_.jsx)(`div`,{className:`text-xs font-semibold text-(--text-secondary) mb-1`,children:V(`fileChanges`)}),a.map((e,t)=>(0,_.jsxs)(`div`,{className:`flex items-center gap-2 text-xs py-0.5 font-mono`,children:[(0,_.jsx)(`span`,{className:B(`text-[10px] font-semibold px-[5px] py-px rounded`,{edit:`bg-(--accent-blue-bg) text-(--accent-blue)`,create:`bg-(--accent-green-bg) text-(--accent-green)`,delete:`bg-(--accent-red-bg) text-(--accent-red)`}[e.action]||`bg-(--muted) text-(--text-muted)`),children:e.action?.toUpperCase()}),(0,_.jsx)(`span`,{className:`truncate flex-1 text-(--text-primary)`,children:e.path}),e.linesAdded!=null&&(0,_.jsxs)(`span`,{className:`text-(--accent-green) text-[11px]`,children:[`+`,e.linesAdded]}),e.linesRemoved!=null&&(0,_.jsxs)(`span`,{className:`text-(--accent-red) text-[11px]`,children:[`-`,e.linesRemoved]})]},t))]})]})})}function iG({messages:e,projectCwd:t,skills:n=[],gitInfo:r,messagesLoading:i}){let a=(0,d.useRef)(null),[o,s]=(0,d.useState)(!0),[c,l]=(0,d.useState)(!1),[u,f]=(0,d.useState)(!1);return(0,d.useEffect)(()=>{let e=a.current;if(!e)return;let t=()=>{let t=e.scrollHeight-e.scrollTop-e.clientHeight<80;s(t),l(e.scrollTop>400),f(!t&&e.scrollTop>100)};return e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)},[]),(0,d.useEffect)(()=>{o&&a.current&&requestAnimationFrame(()=>{a.current&&(a.current.scrollTop=a.current.scrollHeight)})},[e,o]),(0,_.jsxs)(`div`,{className:`flex-1 relative overflow-hidden`,children:[i&&e.length===0&&(0,_.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center pointer-events-none`,children:(0,_.jsx)(Xp,{})}),!i&&e.length===0&&(0,_.jsxs)(`div`,{className:`absolute left-1/2 top-[38%] -translate-x-1/2 -translate-y-1/2 w-[min(760px,calc(100%-48px))] text-center pointer-events-none`,children:[(0,_.jsx)(`h1`,{className:`text-[clamp(24px,2.4vw,36px)] font-medium leading-tight tracking-normal`,children:V(`buildInProject`).replace(`{{project}}`,t||`qurio-coder`)}),r?.isGit&&(0,_.jsxs)(`div`,{className:`mt-4 flex items-center justify-center gap-3 text-[13px] text-(--text-muted)`,children:[(0,_.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,_.jsx)(op,{size:13}),(0,_.jsx)(`span`,{children:r.branch})]}),r.dirty?(0,_.jsxs)(_.Fragment,{children:[r.staged>0&&(0,_.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-green-600 dark:text-green-400`,children:[(0,_.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-current`}),V(`gitStaged`),` `,r.staged]}),r.modified>0&&(0,_.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-amber-600 dark:text-amber-400`,children:[(0,_.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-current`}),V(`gitModified`),` `,r.modified]}),r.untracked>0&&(0,_.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,_.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-current`}),V(`gitUntracked`),` `,r.untracked]})]}):(0,_.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,_.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-emerald-500`}),V(`gitClean`)]})]})]}),(0,_.jsx)(`div`,{ref:a,className:`h-full overflow-y-auto py-[44px_0_28px] scroll-smooth`,style:{scrollbarWidth:`thin`},children:(0,_.jsx)(`div`,{className:`w-[min(960px,calc(100%-96px))] mx-auto`,children:e.map(e=>(0,_.jsx)(rG,{message:e,skills:n},e.id))})}),(0,_.jsxs)(`div`,{className:`absolute right-7 bottom-[220px] flex flex-col gap-2 z-20`,children:[c&&(0,_.jsx)(`button`,{className:`w-9 h-9 rounded-full bg-(--bg-input) border border-(--border-default) cursor-pointer flex items-center justify-center text-(--text-secondary) hover:bg-(--bg-hover) hover:text-(--text-primary) animate-in fade-in-0 zoom-in-95`,style:{boxShadow:`var(--shadow-default)`},onClick:()=>a.current?.scrollTo({top:0,behavior:`smooth`}),children:(0,_.jsx)(Uf,{size:16})}),u&&(0,_.jsx)(`button`,{className:`w-9 h-9 rounded-full bg-(--bg-input) border border-(--border-default) cursor-pointer flex items-center justify-center text-(--text-secondary) hover:bg-(--bg-hover) hover:text-(--text-primary) animate-in fade-in-0 zoom-in-95`,style:{boxShadow:`var(--shadow-default)`},onClick:()=>{s(!0),a.current?.scrollTo({top:a.current.scrollHeight,behavior:`smooth`})},children:(0,_.jsx)(Hf,{size:16})})]})]})}var aG=new Set([`superpowers-lite`]);function oG(){return[{value:`auto`,label:V(`autoMode`),desc:V(`autoModeDesc`)},{value:`plan`,label:V(`planMode`),desc:V(`planModeDesc`)}]}var sG=[{name:`dream`,insert:`/dream `,icon:mp,description:`Run memory consolidation now. Auto dream still runs in the background when needed.`},{name:`compact`,insert:`/compact `,icon:Vf,description:`Compress the current conversation context while keeping the useful working summary.`},{name:`memory`,insert:`/memory `,icon:ep,description:`Inspect or manage remembered project and user context.`},{name:`capture`,insert:`/capture `,icon:Kf,description:`Capture an explicit note into the memory inbox for later consolidation.`},{name:`inbox`,insert:`/inbox `,icon:up,description:`Review pending memory inbox entries.`},{name:`reflect`,insert:`/reflect `,icon:Tp,description:`Draft or update a reusable skill from the current workflow.`},{name:`retry`,insert:`/retry `,icon:bp,description:`Retry the last assistant turn.`}],cG=new Set(sG.map(e=>e.name));function lG({current:e,disabled:t=!1}){let[n,r]=(0,d.useState)(!1),[i,a]=(0,d.useState)(!1),o=oG(),s=o.find(t=>t.value===e)||o[0],c=async n=>{if(!(n===e||i||t)){a(!0);try{let e=await Pd(n);if(e?.error)throw Error(e.message||`Failed to switch mode`)}catch{}finally{a(!1)}r(!1)}};return(0,_.jsxs)(Np,{open:n,onOpenChange:e=>!t&&r(e),children:[(0,_.jsx)(Pp,{asChild:!0,children:(0,_.jsxs)(`button`,{type:`button`,className:B(`border-0 bg-transparent text-(--text-muted) w-auto px-2 h-[30px] rounded-lg inline-flex items-center justify-center gap-1 shrink-0 cursor-pointer text-[12px] whitespace-nowrap hover:bg-(--bg-hover) hover:text-(--text-primary)`,(i||t)&&`opacity-50 pointer-events-none`),disabled:t,title:V(t?`switchModeDisabled`:`switchMode`),children:[(0,_.jsx)(wp,{size:14}),(0,_.jsx)(`span`,{className:`truncate`,children:s.label}),(0,_.jsx)(Yf,{size:11})]})}),(0,_.jsxs)(Fp,{side:`top`,align:`start`,sideOffset:6,className:`w-56 p-1 rounded-lg bg-(--bg-primary) border border-(--border-default) shadow-lg`,children:[(0,_.jsx)(`div`,{className:`text-[11px] text-(--text-muted) px-2 py-1.5 font-medium`,children:V(`executionMode`)}),(0,_.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:o.map(n=>(0,_.jsxs)(`button`,{disabled:t||i,className:B(`w-full border-0 rounded-md px-2 py-1.5 text-left text-[12px] cursor-pointer flex items-center gap-2`,(t||i)&&`opacity-50 cursor-not-allowed`,e===n.value?`bg-(--bg-active) text-(--text-primary) font-medium`:`bg-transparent text-(--text-secondary) hover:bg-(--bg-hover) hover:text-(--text-primary)`),onClick:()=>c(n.value),children:[(0,_.jsx)(`span`,{className:`shrink-0`,children:n.label}),(0,_.jsx)(`span`,{className:`text-[10px] text-(--text-muted) min-w-0 text-right leading-4`,children:n.desc})]},n.value))})]})]})}function uG(){let[e,t]=(0,d.useState)([]),[n,r]=(0,d.useState)(``),[i,a]=(0,d.useState)(!1),o=(0,d.useCallback)(async()=>{try{let e=await $d(),n=Array.isArray(e)?e:[];t(n);let i=n.find(e=>e.active);r(i?i.name:``)}catch{}},[]);(0,d.useEffect)(()=>{o()},[o]);let s=async e=>{await af(e),r(e),a(!1),o()};return(0,_.jsxs)(Np,{open:i,onOpenChange:a,children:[(0,_.jsx)(Pp,{asChild:!0,children:(0,_.jsxs)(`button`,{type:`button`,className:`border-0 bg-transparent text-(--text-muted) w-auto px-2 h-[30px] rounded-lg inline-flex items-center justify-center gap-1 shrink-0 cursor-pointer text-[12px] whitespace-nowrap hover:bg-(--bg-hover) hover:text-(--text-primary)`,title:V(`soulSwitch`),children:[(0,_.jsx)(`span`,{className:`truncate max-w-[60px]`,children:n||`default`}),(0,_.jsx)(Yf,{size:11})]})}),(0,_.jsxs)(Fp,{side:`top`,align:`start`,sideOffset:6,className:`w-52 p-1 rounded-lg bg-(--bg-primary) border border-(--border-default) shadow-lg`,children:[(0,_.jsx)(`div`,{className:`text-[11px] text-(--text-muted) px-2 py-1.5 font-medium`,children:V(`switchSoul`)}),(0,_.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:e.map(e=>(0,_.jsxs)(`button`,{className:B(`w-full border-0 rounded-md px-2 py-1.5 text-left text-[12px] cursor-pointer flex items-center gap-2`,e.active?`bg-(--bg-active) text-(--text-primary) font-medium`:`bg-transparent text-(--text-secondary) hover:bg-(--bg-hover) hover:text-(--text-primary)`),onClick:()=>s(e.name),children:[(0,_.jsx)(`span`,{className:`truncate flex-1`,children:e.name}),(0,_.jsx)(`span`,{className:`text-[10px] text-(--text-muted) shrink-0`,children:e.scope===`builtin`?V(`builtin`):V(`custom`)})]},`${e.scope}-${e.name}`))})]})]})}function dG({query:e,onSelect:t,visible:n}){let[r,i]=(0,d.useState)([]),[a,o]=(0,d.useState)(null);(0,d.useEffect)(()=>{n&&qd().then(e=>{i(Array.isArray(e)?e.filter(e=>e.enabled!==!1&&!aG.has(e.name)&&!cG.has(e.name)):[])}).catch(()=>{})},[n]);let s=e.trim().toLowerCase(),c=(0,d.useMemo)(()=>sG.filter(e=>!s||e.name.includes(s)||e.description.toLowerCase().includes(s)).map(e=>({...e,kind:`action`,key:`action-${e.name}`})),[s]),l=(0,d.useMemo)(()=>r.filter(e=>!s||e.name.toLowerCase().includes(s)||(e.description||``).toLowerCase().includes(s)).map(e=>({name:e.name,insert:`/${e.name} `,icon:lp,description:e.description||`Manual skill`,kind:`skill`,key:`skill-${e.name}`})),[r,s]);if(!n)return null;let u=c.length>0||l.length>0,f=(e,n)=>n.length?(0,_.jsxs)(`div`,{className:`py-1`,children:[(0,_.jsx)(`div`,{className:`px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.45px] text-(--text-muted)`,children:e}),(0,_.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:n.map(e=>{let n=e.icon,r=a===e.key;return(0,_.jsxs)(`button`,{className:B(`w-full border-0 rounded-md px-2.5 py-2 text-left cursor-pointer grid grid-cols-[22px_minmax(96px,180px)_minmax(0,1fr)_auto] items-start gap-2 text-[12px] transition-colors`,r?`bg-(--bg-hover) text-(--text-primary)`:`bg-transparent text-(--text-secondary) hover:bg-(--bg-hover) hover:text-(--text-primary)`),onClick:()=>t(e.insert),onMouseEnter:()=>o(e.key),onMouseLeave:()=>o(null),children:[(0,_.jsx)(`span`,{className:B(`mt-0.5 inline-flex size-5 items-center justify-center rounded-md transition-colors`,e.kind===`action`?`bg-(--accent-cyan-bg) text-(--accent-cyan)`:`bg-(--accent-purple-bg) text-(--accent-purple)`,!r&&`opacity-80`),children:(0,_.jsx)(n,{size:12})}),(0,_.jsxs)(`span`,{className:`truncate font-medium leading-5 font-mono`,children:[`/`,e.name]}),(0,_.jsx)(`span`,{className:`text-(--text-muted) text-[11px] leading-5 overflow-hidden`,style:{display:`-webkit-box`,WebkitLineClamp:2,WebkitBoxOrient:`vertical`},children:e.description}),(0,_.jsx)(`span`,{className:B(`mt-0.5 rounded-full border px-1.5 py-0.5 text-[10px] uppercase leading-none`,e.kind===`action`?`border-(--accent-cyan)/25 text-(--accent-cyan)`:`border-(--accent-purple)/25 text-(--accent-purple)`),children:e.kind})]},e.key)})})]}):null;return(0,_.jsxs)(`div`,{className:`absolute bottom-full left-0 right-0 mb-1.5 max-h-[360px] overflow-y-auto rounded-xl border border-(--border-default) bg-(--bg-primary) shadow-lg z-50 animate-in fade-in-0 zoom-in-95 slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95`,style:{scrollbarWidth:`thin`},children:[(0,_.jsxs)(`div`,{className:`px-2.5 py-1.5 text-[11px] text-(--text-muted) font-medium flex items-center gap-1.5 border-b border-(--border-default)`,children:[(0,_.jsx)(Tp,{size:11}),`Commands`]}),!u&&(0,_.jsx)(`div`,{className:`px-2.5 py-5 text-[12px] text-(--text-muted) text-center`,children:`No matching commands`}),f(`Actions`,c),c.length>0&&l.length>0&&(0,_.jsx)(`div`,{className:`mx-2.5 h-px bg-(--border-default)`}),f(`Skills`,l)]})}function fG({onSubmit:e,onAbort:t,busy:n,disabled:r=!1,disabledReason:i=``,runtimeState:a,history:o,onCompletionRequest:s,onOpenProject:c,projectCwd:l}){let[u,f]=(0,d.useState)(``),[p,m]=(0,d.useState)([]),[h,g]=(0,d.useState)(-1),[v,y]=(0,d.useState)(``),[b,x]=(0,d.useState)(!1),[S,C]=(0,d.useState)(``),w=(0,d.useRef)(null),T=(a||{}).mode||`normal`,E=n||r;(0,d.useEffect)(()=>{o&&o.length&&p.length===0&&m([...o].reverse())},[o]),(0,d.useEffect)(()=>{E&&x(!1)},[E]);let D=(0,d.useCallback)(()=>{let t=u.trim();!t||E||(e(t),f(``),x(!1),g(-1),w.current&&(w.current.style.height=`auto`))},[u,E,e]),O=(0,d.useCallback)(e=>{if(e.key===`Enter`&&!e.shiftKey){if(b){e.preventDefault();return}e.preventDefault(),D();return}if(b&&e.key===`Escape`){e.preventDefault(),x(!1);return}if(e.key===`ArrowUp`&&p.length>0&&!b){e.preventDefault(),h===-1&&y(u);let t=Math.min(h+1,p.length-1);g(t),f(p[t]);return}if(e.key===`ArrowDown`&&h!==-1&&!b){e.preventDefault();let t=h-1;g(t),f(t<0?v:p[t]);return}e.key===`Tab`&&e.preventDefault()},[u,p,h,v,D,b]),ee=(0,d.useCallback)(e=>{let t=e.target.value;f(t),e.target.style.height=`auto`,e.target.style.height=Math.min(e.target.scrollHeight,160)+`px`,t===`/`?(x(!0),C(``)):t.startsWith(`/`)&&!t.includes(` `)?(x(!0),C(t.slice(1))):x(!1),t.startsWith(`/`)&&s&&s(t)},[s]);return(0,_.jsxs)(`div`,{className:`w-full relative`,children:[(0,_.jsx)(dG,{query:S,onSelect:(0,d.useCallback)(e=>{f(e),x(!1),w.current?.focus()},[]),visible:b}),(0,_.jsxs)(`div`,{className:`flex flex-col gap-2 p-[12px_14px_10px] border border-(--border-strong) rounded-2xl bg-(--bg-input)`,style:{boxShadow:`var(--shadow-default)`},children:[(0,_.jsx)(`div`,{className:`flex min-h-[32px]`,children:(0,_.jsx)(`textarea`,{ref:w,value:u,onChange:ee,onKeyDown:O,placeholder:n?V(`inputDisabled`):r?i||V(`inputDisabled`):V(`askAnything`),disabled:E,rows:1,className:`flex-1 resize-none border-0 outline-none bg-transparent text-(--text-primary) min-h-[32px] max-h-[160px] p-0 leading-[1.5] text-[14px] placeholder:text-(--text-muted) disabled:opacity-50 disabled:cursor-not-allowed`,style:{height:`auto`}})}),(0,_.jsxs)(`div`,{className:`flex items-center gap-1.5 min-h-[30px] flex-wrap`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,_.jsx)(`button`,{type:`button`,className:`border-0 bg-transparent text-(--text-muted) min-w-[30px] h-[30px] rounded-lg inline-flex items-center justify-center shrink-0 cursor-pointer hover:bg-(--bg-hover) hover:text-(--text-primary)`,title:V(`addContext`),children:(0,_.jsx)(_p,{size:16})}),(0,_.jsxs)(`button`,{type:`button`,className:`border-0 bg-transparent text-(--text-muted) w-auto px-2 h-[30px] rounded-lg inline-flex items-center justify-center gap-1.5 shrink-0 cursor-pointer text-[12px] whitespace-nowrap hover:bg-(--bg-hover) hover:text-(--text-primary)`,title:V(`switchWorkspace`),onClick:c,children:[(0,_.jsx)(ap,{size:13,className:`shrink-0`}),(0,_.jsx)(`span`,{className:`truncate max-w-[80px]`,children:l||`...`}),(0,_.jsx)(Yf,{size:11})]}),(0,_.jsx)(lG,{current:T,disabled:E}),(0,_.jsx)(uG,{})]}),(0,_.jsx)(`div`,{className:`flex items-center gap-1.5 ml-auto`,children:n?(0,_.jsx)(`button`,{type:`button`,className:`border-0 text-(--accent-red) min-w-[32px] h-[32px] rounded-full inline-flex items-center justify-center shrink-0 cursor-pointer bg-(--accent-red-bg) hover:opacity-80`,onClick:t,title:V(`abort`),children:(0,_.jsx)(pp,{size:14})}):(0,_.jsx)(`button`,{type:`button`,className:B(`border-0 min-w-[34px] w-[34px] h-[34px] rounded-full inline-flex items-center justify-center shrink-0 cursor-pointer transition-all`,u.trim()&&!E?`bg-(--text-primary) text-(--bg-primary) hover:opacity-90`:`bg-(--text-muted)/30 text-(--bg-primary) cursor-not-allowed`),onClick:D,disabled:!u.trim()||E,title:V(`sending`),children:(0,_.jsx)(Uf,{size:16})})})]})]})]})}var pG={thinking:`bg-(--accent-blue)`,streaming:`bg-(--accent-green)`,tooling:`bg-(--accent-orange)`,live:`bg-(--accent-cyan)`};function mG({runtimeState:e,live:t,stageLabel:n}){let r=e||{};r.mode;let i=r.currentContextTokens||0,a=r.maxContextTokens||0,o=a?Math.round(i/a*100):0,s=o<40?`bg-(--accent-green)`:o<75?`bg-(--accent-orange)`:`bg-(--accent-red)`,c=Object.keys(pG).find(e=>(n||``).includes(e))||`live`;return(0,_.jsxs)(`div`,{className:`flex items-center gap-3 flex-1 min-w-0 text-[12px] text-(--text-muted) overflow-hidden`,children:[(0,_.jsxs)(`span`,{className:`inline-flex items-center gap-1 whitespace-nowrap`,children:[(0,_.jsx)(Gf,{size:13,className:`shrink-0 opacity-70`}),(0,_.jsx)(`span`,{children:r.model?.toUpperCase()||`-`})]}),(0,_.jsxs)(`span`,{className:`inline-flex items-center gap-1 whitespace-nowrap`,children:[(0,_.jsx)(vp,{size:13,className:`shrink-0 opacity-70`}),(0,_.jsx)(`span`,{children:r.sdkProvider?.toUpperCase()||`-`})]}),a>0&&(0,_.jsxs)(`span`,{className:`inline-flex items-center gap-1 whitespace-nowrap`,children:[(0,_.jsx)(qf,{size:13,className:`shrink-0 opacity-70`}),(0,_.jsx)(`span`,{children:`CTX`}),(0,_.jsx)(`span`,{className:`w-12 h-1 bg-(--muted) rounded-full overflow-hidden`,children:(0,_.jsx)(`span`,{className:B(`block h-full rounded-full transition-all`,s),style:{width:`${o}%`}})}),(0,_.jsxs)(`span`,{children:[o,`%`]})]}),(0,_.jsxs)(`span`,{className:`inline-flex items-center gap-1 ml-auto whitespace-nowrap`,children:[(0,_.jsx)(`span`,{className:B(`w-1.5 h-1.5 rounded-full shrink-0`,t?pG[c]:`bg-(--text-muted)`,t&&`animate-pulse`)}),(0,_.jsx)(`span`,{children:t?n:V(`idle`)})]})]})}function hG({className:e,value:t,...n}){return(0,_.jsx)(Io,{"data-slot":`progress`,className:B(`relative h-2 w-full overflow-hidden rounded-full bg-primary/20`,e),...n,children:(0,_.jsx)(Lo,{"data-slot":`progress-indicator`,className:`h-full w-full flex-1 bg-primary transition-all`,style:{transform:`translateX(-${100-(t||0)}%)`}})})}function gG(){return[{value:`fast`,label:V(`generationDepthFast`)},{value:`standard`,label:V(`generationDepthStandard`)},{value:`deep`,label:V(`generationDepthDeep`)}]}function _G(e){if(!e)return``;try{return new Intl.DateTimeFormat(`zh-CN`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}).format(new Date(e))}catch{return``}}function vG(e){let t=Number(e||0);return!Number.isFinite(t)||t<=0?``:t<1024?`${t} B`:t<1024*1024?`${Math.round(t/1024)} KB`:`${(t/1024/1024).toFixed(1)} MB`}function yG(e,t){let n=Array.isArray(e)?e:[];if(!n.length)return{done:0,total:0,pct:8,label:t||V(`startingAnalysis`),detail:V(`preparingScan`)};let r=n.filter(e=>e.status===`done`).length,i=n.find(e=>e.status===`failed`),a=n.find(e=>e.status===`running`)||n.find(e=>e.status===`in_progress`)||n.find(e=>e.status===`pending`)||n[n.length-1];return{done:r,total:n.length,pct:Math.max(8,Math.round(r/n.length*100)),label:i?V(`generationFailed`):a?.title||t||V(`generatingCodeWiki`),detail:i?i.title:`${r}/${n.length} ${V(`stepsCompleted`)}${a?.role?` · ${a.role.toUpperCase()}`:``}`}}function bG({steps:e,stageLabel:t,compact:n=!1}){let r=yG(e,t);return(0,_.jsxs)(`div`,{className:B(`rounded-lg border border-(--border-default) bg-(--bg-primary) p-3 text-left`,n?`mt-3`:`mt-5 w-full max-w-md`),children:[(0,_.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,_.jsx)(`span`,{className:`truncate text-[12px] font-medium text-(--text-primary)`,children:r.label}),r.total>0&&(0,_.jsxs)(`span`,{className:`shrink-0 text-[11px] text-(--text-muted)`,children:[r.done,`/`,r.total]})]}),(0,_.jsx)(hG,{value:r.pct,className:`mt-2 h-1.5`}),(0,_.jsx)(`p`,{className:`mt-2 truncate text-[11px] text-(--text-muted)`,children:r.detail})]})}function xG(e,t){if(!Array.isArray(e)||e.length===0)return[{type:`tools`,cards:[t]}];let n=e[e.length-1];return n.type===`tools`?[...e.slice(0,-1),{...n,cards:[...n.cards,t]}]:[...e,{type:`tools`,cards:[t]}]}function SG(e,t,n){return(Array.isArray(e)?e:[]).map(e=>{if(e.type!==`tools`)return e;let r=e.cards.findIndex(e=>e.id===t);if(r===-1)return e;let i=[...e.cards];return i[r]=n(i[r]),{...e,cards:i}})}function CG(e){let t=Array.isArray(e)?e:[];return t.length===0?[{type:`text`,text:``,isStreaming:!1}]:t[t.length-1].type===`text`?t:[...t,{type:`text`,text:``,isStreaming:!1}]}function wG(e,t){let n=String(t||``);if(!n)return Array.isArray(e)?e:[];let r=CG(e),i=r[r.length-1];return[...r.slice(0,-1),{...i,text:`${i.text||``}${n}`,isStreaming:!0}]}function TG(e,t){let n=CG(e),r=n.length-1;return n.map((e,n)=>n===r&&e.type===`text`?{...e,text:t,isStreaming:!1}:e)}function EG(e){return(Array.isArray(e)?e:[]).map(e=>e.type===`text`?{...e,isStreaming:!1}:e)}function DG(e,t){switch(t?.type){case`assistant:delta`:return{...e,segments:wG(e.segments,t.text)};case`assistant:response`:return{...e,segments:t.text?TG(e.segments,t.text):EG(e.segments)};case`tool:start`:return{...e,segments:xG(e.segments,{id:t.id,name:t.name,arguments:t.arguments,status:`running`,durationMs:null,summary:``,result:``})};case`tool:result`:return{...e,segments:SG(e.segments,t.id,e=>({...e,result:t.content||e.result||``}))};case`tool:end`:return{...e,segments:SG(e.segments,t.id,e=>({...e,status:`done`,durationMs:t.durationMs,summary:t.summary||e.summary||``}))};case`tool:error`:return{...e,segments:SG(e.segments,t.id,e=>({...e,status:`error`,durationMs:t.durationMs,summary:t.summary||e.summary||``}))};case`tool:blocked`:return{...e,segments:SG(e.segments,t.id,e=>({...e,status:`blocked`,summary:e.summary||`Tool blocked`}))};case`codewiki:done`:return{...e,loading:!1,segments:EG(e.segments)};case`codewiki:error`:return{...e,role:`error`,loading:!1,segments:[{type:`text`,text:t.message||V(`codewikiFailed`),isStreaming:!1}]};default:return e}}function OG({projectCwd:e,projectKey:t,busy:n,planSteps:r=[],stageLabel:i=``}){let[a,o]=(0,d.useState)([]),[s,c]=(0,d.useState)(``),[l,u]=(0,d.useState)(!0),[f,p]=(0,d.useState)(!1),[m,h]=(0,d.useState)(``),[g,v]=(0,d.useState)(!1),[y,b]=(0,d.useState)(``),[x,S]=(0,d.useState)(``),[C,w]=(0,d.useState)(!1),[T,E]=(0,d.useState)(null),[D,O]=(0,d.useState)(!1),[ee,k]=(0,d.useState)(`standard`),[A,j]=(0,d.useState)([]),[M,te]=(0,d.useState)(!1),ne=(0,d.useRef)(null),N=(0,d.useMemo)(()=>a.find(e=>e.file===s)||null,[a,s]),P=N?`/api/codewiki/report/${encodeURIComponent(N.file)}`:``,re=(0,d.useCallback)(async({preferNewest:e=!1}={})=>{u(!0),h(``);try{let t=await of(),n=[...Array.isArray(t?.reports)?t.reports:[]].sort((e,t)=>new Date(t.mtime||0)-new Date(e.mtime||0));o(n),c(t=>e&&n[0]?n[0].file:n.some(e=>e.file===t)?t:n[0]?.file||``)}catch(e){h(e?.message||V(`failedToLoad`))}finally{u(!1)}},[]);(0,d.useEffect)(()=>{o([]),c(``),v(!1),b(``),S(``),j([]),te(!1),re({preferNewest:!0})},[re,t]),(0,d.useEffect)(()=>{let e=ne.current;e&&requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight})},[A,M]),(0,d.useEffect)(()=>{f&&n&&w(!0)},[n,f]),(0,d.useEffect)(()=>{!f||n||!C||(re({preferNewest:!0}),p(!1),w(!1))},[n,f,re,C]);let ie=async()=>{if(!(n||f)){h(``),p(!0),w(!1);try{let e=await sf(ee);e?.error&&(p(!1),h(e.message||V(`failedToStart`)))}catch(e){p(!1),h(e?.message||V(`failedToStart`))}}},ae=async e=>{e.preventDefault();let t=y.trim();if(!t||F||M)return;let n=Date.now(),r=`cw-assistant-${n}`;S(t),b(``),h(``),j(e=>[...e,{id:`cw-user-${n}`,role:`you`,text:t,segments:[{type:`text`,text:t,isStreaming:!1}],timestamp:new Date().toISOString()},{id:r,role:`general`,text:``,segments:[],timestamp:new Date().toISOString(),loading:!0}]),te(!0);try{await cf({question:t,reportFile:N?.file||``,onEvent:e=>{j(t=>t.map(t=>t.id===r?DG(t,e):t))}})}catch(e){j(t=>t.map(t=>t.id===r?{...t,role:`error`,loading:!1,segments:[{type:`text`,text:e?.message||V(`codewikiFailed`),isStreaming:!1}]}:t))}finally{te(!1)}},oe=async()=>{if(T){O(!0),h(``);try{let e=await lf(T.file);e?.error?h(e.message||V(`failedToDelete`)):(E(null),v(!1),await re({preferNewest:!1}))}catch(e){h(e?.message||V(`failedToDelete`))}finally{O(!1)}}},F=n||f,I=F||M;return(0,_.jsxs)(`div`,{className:`flex-1 min-h-0 bg-(--bg-primary) rounded-[18px] border border-(--border-default) border-b-0 overflow-hidden my-1 mx-1`,children:[(0,_.jsxs)(`div`,{className:`grid h-full min-h-0 grid-cols-[260px_minmax(0,1fr)_420px] max-xl:grid-cols-[220px_minmax(0,1fr)] max-lg:grid-cols-1`,children:[(0,_.jsxs)(`aside`,{className:`border-r border-(--border-default) bg-(--bg-secondary) min-h-0 flex flex-col max-lg:hidden`,children:[(0,_.jsxs)(`div`,{className:`p-4 border-b border-(--border-default)`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2 text-(--text-primary)`,children:[(0,_.jsx)(Wf,{size:18}),(0,_.jsx)(`span`,{className:`font-semibold text-[15px]`,children:`CodeWiki`})]}),(0,_.jsx)(`p`,{className:`mt-2 text-[12px] leading-5 text-(--text-muted) truncate`,title:e||``,children:e||V(`currentProject`)}),(0,_.jsx)(`div`,{className:`mt-4 grid grid-cols-3 gap-1 rounded-lg border border-(--border-default) bg-(--bg-primary) p-1`,children:gG().map(e=>(0,_.jsx)(`button`,{type:`button`,className:B(`h-7 rounded-md text-[12px] text-(--text-muted) hover:bg-(--bg-hover) hover:text-(--text-primary) disabled:cursor-not-allowed disabled:opacity-60`,ee===e.value&&`bg-(--bg-active) text-(--text-primary)`),disabled:F,onClick:()=>k(e.value),children:e.label},e.value))}),(0,_.jsxs)(`button`,{className:`mt-3 w-full h-9 rounded-lg border border-(--border-default) bg-(--bg-primary) text-[13px] text-(--text-primary) inline-flex items-center justify-center gap-2 hover:bg-(--bg-hover) disabled:cursor-not-allowed disabled:opacity-60`,onClick:ie,disabled:F,children:[f?(0,_.jsx)(fp,{size:15,className:`animate-spin`}):(0,_.jsx)(Tp,{size:15}),V(f?`generating`:`generateNew`)]}),f&&(0,_.jsx)(bG,{steps:r,stageLabel:i,compact:!0})]}),(0,_.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3`,children:[(0,_.jsx)(`span`,{className:`text-[12px] font-medium text-(--text-muted)`,children:V(`report`)}),(0,_.jsx)(`button`,{className:`inline-flex size-7 items-center justify-center rounded-md text-(--text-muted) hover:bg-(--bg-hover) hover:text-(--text-primary)`,onClick:()=>re({preferNewest:!0}),title:V(`refreshReport`),"aria-label":V(`refreshReport`),children:(0,_.jsx)(yp,{size:14})})]}),(0,_.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-2 pb-4`,children:[l&&(0,_.jsxs)(`div`,{className:`px-3 py-6 text-[12px] text-(--text-muted) inline-flex items-center gap-2`,children:[(0,_.jsx)(fp,{size:14,className:`animate-spin`}),V(`loadingReport`)]}),!l&&a.length===0&&(0,_.jsx)(`div`,{className:`mx-2 rounded-lg border border-dashed border-(--border-default) px-3 py-4 text-[12px] leading-5 text-(--text-muted)`,children:V(`noReportYet`)}),(0,_.jsx)(`div`,{className:`flex flex-col gap-1`,children:a.map(e=>(0,_.jsxs)(`div`,{className:B(`group w-full rounded-lg px-3 py-2 text-left hover:bg-(--bg-hover) cursor-pointer`,s===e.file&&`bg-(--bg-active)`),onClick:()=>{c(e.file),v(!1)},children:[(0,_.jsxs)(`span`,{className:`flex items-start gap-2 text-[13px] text-(--text-primary)`,children:[(0,_.jsx)(ip,{size:14,className:`shrink-0 mt-0.5 text-(--text-muted)`}),(0,_.jsx)(`span`,{className:`min-w-0 flex-1 break-words`,children:e.file}),(0,_.jsxs)(Np,{children:[(0,_.jsx)(Pp,{asChild:!0,children:(0,_.jsx)(`button`,{type:`button`,className:`inline-flex size-6 shrink-0 items-center justify-center rounded-md text-(--text-muted) opacity-0 hover:bg-(--bg-active) hover:text-(--text-primary) group-hover:opacity-100 focus:opacity-100`,onClick:e=>e.stopPropagation(),"aria-label":V(`reportActions`),children:(0,_.jsx)(tp,{size:14})})}),(0,_.jsx)(Fp,{align:`end`,className:`w-36 border-(--border-default) bg-(--bg-primary) p-1 text-(--text-primary)`,onClick:e=>e.stopPropagation(),children:(0,_.jsx)(`button`,{type:`button`,className:`w-full rounded-md px-2.5 py-2 text-left text-[13px] text-(--accent-red) hover:bg-(--accent-red-bg)`,onClick:()=>E(e),children:V(`deleteReport`)})})]})]}),(0,_.jsxs)(`span`,{className:`mt-1 block truncate pl-6 text-[11px] text-(--text-muted)`,children:[_G(e.mtime),vG(e.size)?` · ${vG(e.size)}`:``]})]},e.file))})]})]}),(0,_.jsxs)(`main`,{className:`min-w-0 min-h-0 flex flex-col bg-(--bg-primary)`,children:[m&&(0,_.jsxs)(`div`,{className:`mx-5 mt-4 rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-[12px] text-red-400 inline-flex items-center gap-2`,children:[(0,_.jsx)(Zf,{size:14}),m]}),(0,_.jsx)(`div`,{className:`flex-1 min-h-0 p-4`,children:!N&&!l?(0,_.jsxs)(`div`,{className:`h-full min-h-[420px] rounded-xl border border-dashed border-(--border-default) bg-(--bg-secondary) flex flex-col items-center justify-center text-center px-8`,children:[(0,_.jsx)(Wf,{size:34,className:`text-(--text-muted)`}),(0,_.jsx)(`h2`,{className:`mt-4 text-[18px] font-semibold text-(--text-primary)`,children:V(`noCodeWiki`)}),(0,_.jsx)(`p`,{className:`mt-2 max-w-md text-[13px] leading-6 text-(--text-muted)`,children:V(`reportWillShow`)}),(0,_.jsxs)(`button`,{className:`mt-5 h-10 rounded-lg bg-(--text-primary) px-4 text-[13px] font-medium text-(--bg-primary) inline-flex items-center gap-2 disabled:cursor-not-allowed disabled:opacity-60`,onClick:ie,disabled:F,children:[f?(0,_.jsx)(fp,{size:16,className:`animate-spin`}):(0,_.jsx)(Tp,{size:16}),V(f?`generating`:`generateNew`)]}),(0,_.jsx)(`div`,{className:`mt-3 grid w-full max-w-xs grid-cols-3 gap-1 rounded-lg border border-(--border-default) bg-(--bg-primary) p-1`,children:gG().map(e=>(0,_.jsx)(`button`,{type:`button`,className:B(`h-7 rounded-md text-[12px] text-(--text-muted) hover:bg-(--bg-hover) hover:text-(--text-primary) disabled:cursor-not-allowed disabled:opacity-60`,ee===e.value&&`bg-(--bg-active) text-(--text-primary)`),disabled:F,onClick:()=>k(e.value),children:e.label},e.value))}),f&&(0,_.jsx)(bG,{steps:r,stageLabel:i})]}):(0,_.jsx)(`div`,{className:`h-full min-h-[420px] overflow-hidden rounded-xl border border-(--border-default) bg-(--bg-secondary)`,children:g?(0,_.jsxs)(`div`,{className:`h-full flex flex-col items-center justify-center px-8 text-center`,children:[(0,_.jsx)(Zf,{size:28,className:`text-(--text-muted)`}),(0,_.jsx)(`p`,{className:`mt-3 text-[13px] text-(--text-secondary)`,children:V(`reportLoadFailed`)}),(0,_.jsx)(`button`,{className:`mt-4 h-8 rounded-md border border-(--border-default) px-3 text-[12px] text-(--text-primary) hover:bg-(--bg-hover)`,onClick:()=>v(!1),children:V(`retry`)})]}):N?(0,_.jsx)(`iframe`,{title:`CodeWiki ${N.file}`,src:P,sandbox:`allow-scripts`,className:`h-full w-full border-0 bg-white`,onLoad:()=>v(!1),onError:()=>v(!0)},N.file):(0,_.jsxs)(`div`,{className:`h-full flex items-center justify-center text-[13px] text-(--text-muted)`,children:[(0,_.jsx)(fp,{size:16,className:`mr-2 animate-spin`}),V(`loading`)]})})})]}),(0,_.jsxs)(`aside`,{className:`border-l border-(--border-default) bg-(--bg-secondary) min-h-0 flex flex-col max-xl:hidden`,children:[(0,_.jsx)(`div`,{className:`p-4 border-b border-(--border-default)`,children:(0,_.jsx)(`p`,{className:`mt-2 text-[12px] leading-5 text-(--text-muted)`,children:V(f?`noQuestionsDuringGeneration`:`tempReadOnlyQa`)})}),(0,_.jsx)(`div`,{ref:ne,className:`flex-1 min-h-0 overflow-y-auto px-4 py-3`,children:A.length===0?(0,_.jsxs)(`div`,{className:`rounded-xl border border-(--border-default) bg-(--bg-primary) p-4`,children:[(0,_.jsx)(`p`,{className:`text-[13px] font-medium text-(--text-primary)`,children:V(f?`generatingCodeWiki`:M||n?`processingQuestion`:`canAskAboutProject`)}),(0,_.jsx)(`p`,{className:`mt-2 text-[12px] leading-5 text-(--text-muted)`,children:f?V(`askAfterGeneration`):x||V(`exampleQuestions`)})]}):(0,_.jsx)(`div`,{className:`flex flex-col`,children:A.map(e=>(0,_.jsxs)(`div`,{children:[(0,_.jsx)(rG,{message:e}),e.loading&&(!e.segments||e.segments.length===0)&&(0,_.jsxs)(`div`,{className:`mt-[-12px] mb-3 ml-1 inline-flex items-center gap-2 rounded-xl border border-(--border-default) bg-(--bg-primary) px-3 py-2 text-[12px] text-(--text-muted)`,children:[(0,_.jsx)(fp,{size:14,className:`animate-spin`}),V(`answering`)]})]},e.id))})}),(0,_.jsx)(`form`,{className:`p-4 border-t border-(--border-default)`,onSubmit:ae,children:(0,_.jsxs)(`div`,{className:`flex items-center gap-2 rounded-full border border-(--border-default) bg-(--bg-primary) px-3 py-2`,children:[(0,_.jsx)(`input`,{value:y,onChange:e=>b(e.target.value),placeholder:f?V(`generatingCodeWiki`):M||n?V(`answering`):`Ask about this repository`,disabled:I,className:`min-w-0 flex-1 border-0 bg-transparent text-[13px] text-(--text-primary) outline-none placeholder:text-(--text-muted) disabled:opacity-60`}),(0,_.jsx)(`button`,{type:`submit`,className:`inline-flex size-7 items-center justify-center rounded-full text-(--text-muted) hover:bg-(--bg-hover) hover:text-(--text-primary) disabled:cursor-not-allowed disabled:opacity-50`,disabled:I||!y.trim(),"aria-label":V(`sendingQuestion`),children:M?(0,_.jsx)(fp,{size:15,className:`animate-spin`}):(0,_.jsx)(Sp,{size:15})})]})})]})]}),(0,_.jsx)(Yp,{open:!!T,title:V(`deleteReportConfirm`),description:V(`deleteReportDescription`).replace(`{{report}}`,T?.title||T?.file||``),loading:D,onOpenChange:e=>!e&&E(null),onConfirm:oe})]})}function kG(e,t){return e===`delete`?`delete`:e===`run`?`run`:t?.planApproval?`plan`:t?.reflectApproval?`reflect`:`generic`}function AG(e){if(!e)return{};try{let t=typeof e==`string`?JSON.parse(e):e;return{...t,_raw:JSON.stringify(t)}}catch{return{_raw:String(e)}}}function jG({label:e,value:t}){return(0,_.jsxs)(`div`,{className:`flex gap-3 py-1.5`,children:[(0,_.jsx)(`span`,{className:`text-[13px] font-medium text-(--text-muted) w-20 shrink-0`,children:e}),(0,_.jsx)(`span`,{className:`text-[13px] font-mono break-all text-(--text-primary)`,children:String(t)})]})}function MG({variant:e,args:t,details:n}){if(e===`delete`){let e=AG(t);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(jG,{label:`File`,value:e.path||e.name||`-`}),(0,_.jsx)(jG,{label:`Type`,value:e.type||`file`})]})}return e===`run`?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(jG,{label:`Command`,value:AG(t).command||`-`}),n?.risk&&(0,_.jsx)(jG,{label:`Risk`,value:n.risk}),n?.description&&(0,_.jsx)(jG,{label:`Info`,value:n.description})]}):e===`plan`?(0,_.jsxs)(_.Fragment,{children:[n?.title&&(0,_.jsx)(`p`,{className:`text-sm mb-2`,children:n.title}),n?.steps&&(0,_.jsx)(`ol`,{className:`list-decimal list-inside space-y-1`,children:n.steps.map((e,t)=>(0,_.jsxs)(`li`,{className:`text-sm`,children:[e.role||``,`: `,e.title||``]},t))})]}):e===`reflect`?(0,_.jsxs)(_.Fragment,{children:[n?.scope&&(0,_.jsx)(jG,{label:`Scope`,value:n.scope}),n?.skillName&&(0,_.jsx)(jG,{label:`Skill`,value:n.skillName}),n?.targetPath&&(0,_.jsx)(jG,{label:`Path`,value:n.targetPath})]}):(0,_.jsx)(jG,{label:`Tool`,value:AG(t)._raw||`-`})}function NG({request:e,open:t,onDecision:n}){if(!e)return null;let{id:r,toolName:i,displayName:a,arguments:o,details:s}=e,c=kG(i,s);return(0,_.jsx)(Vp,{open:t,onOpenChange:e=>{e||n(r,!1)},children:(0,_.jsxs)(Wp,{className:`sm:max-w-lg`,children:[(0,_.jsx)(Gp,{children:(0,_.jsx)(qp,{children:{delete:V(`deleteApproval`),run:V(`runApproval`),plan:V(`planApproval`),reflect:V(`reflectApproval`),generic:V(`approveTitle`)}[c]||V(`approveTitle`)})}),(0,_.jsx)(`div`,{className:`py-2`,children:(0,_.jsx)(MG,{variant:c,args:o,details:s})}),(0,_.jsxs)(Kp,{className:`gap-2`,children:[(0,_.jsx)(Bp,{variant:`outline`,onClick:()=>n(r,!1),children:V(`deny`)}),(0,_.jsx)(Bp,{onClick:()=>n(r,!0),children:V(`approve`)})]})]})})}var PG=Rp(`inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 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/90`,secondary:`bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90`,destructive:`bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90`,outline:`border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,ghost:`[a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,link:`text-primary underline-offset-4 [a&]:hover:underline`}},defaultVariants:{variant:`default`}});function FG({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,_.jsx)(n?y:`span`,{"data-slot":`badge`,"data-variant":t,className:B(PG({variant:t}),e),...r})}function IG({className:e,...t}){return(0,_.jsx)(`textarea`,{"data-slot":`textarea`,className:B(`flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40`,e),...t})}var LG={planner:`bg-(--accent-purple-bg) text-(--accent-purple)`,coder:`bg-(--accent-green-bg) text-(--accent-green)`,reviewer:`bg-(--accent-orange-bg) text-(--accent-orange)`,tester:`bg-(--accent-blue-bg) text-(--accent-blue)`,advisor:`bg-(--accent-blue-bg) text-(--accent-blue)`,summarizer:`bg-(--accent-cyan-bg) text-(--accent-cyan)`};function RG({steps:e}){if(!e?.length)return null;let t=e.filter(e=>e.status===`done`).length,n=t===e.length,r=Math.round(t/e.length*100);return(0,_.jsxs)(`div`,{className:`border border-(--border-default) rounded-lg p-3 my-2 max-w-3xl mx-auto bg-(--bg-secondary)`,children:[(0,_.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,_.jsx)(`span`,{className:`text-[13px] font-medium text-(--text-primary)`,children:V(`planTitle`)}),(0,_.jsx)(FG,{className:B(`text-[11px]`,n?`bg-(--accent-green-bg) text-(--accent-green)`:`bg-(--accent-blue-bg) text-(--accent-blue)`),children:n?V(`planDone`):`${t}/${e.length}`})]}),(0,_.jsx)(hG,{value:r,className:`h-1.5 mb-3`}),(0,_.jsx)(`div`,{className:`space-y-1.5`,children:e.map((e,t)=>(0,_.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,_.jsx)(`span`,{className:B(`w-5 h-5 rounded-full flex items-center justify-center text-[11px] font-medium shrink-0`,e.status===`done`&&`bg-(--accent-green-bg) text-(--accent-green)`,e.status===`failed`&&`bg-(--accent-red-bg) text-(--accent-red)`,e.status===`running`&&`bg-(--accent-blue-bg) text-(--accent-blue)`,e.status===`pending`&&`bg-(--muted) text-(--muted-foreground)`),children:e.status===`done`?`✓`:e.status===`failed`?`✗`:e.status===`running`?`▶`:e.index+1}),(0,_.jsx)(FG,{variant:`outline`,className:B(`text-[11px] px-1.5 py-0`,LG[e.role]||`bg-(--muted) text-(--muted-foreground)`),children:e.role?.toUpperCase()}),(0,_.jsx)(`span`,{className:`truncate text-(--text-secondary)`,children:e.title})]},t))})]})}function zG({plan:e,onAction:t,disabled:n=!1}){let[r,i]=(0,d.useState)(!1),[a,o]=(0,d.useState)(``);if(!e)return null;let s=Array.isArray(e.steps)?e.steps:[];return(0,_.jsxs)(`div`,{className:`border border-(--border-default) rounded-lg p-3 max-w-3xl mx-auto bg-(--bg-secondary) space-y-2.5`,children:[(0,_.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,_.jsx)(`span`,{className:`text-[13px] font-medium text-(--text-primary)`,children:V(`planReviewTitle`)}),(0,_.jsx)(FG,{className:`text-[11px] bg-(--accent-orange-bg) text-(--accent-orange)`,children:V(`planReviewStatus`)})]}),(0,_.jsx)(`p`,{className:`text-[13px] text-(--text-secondary) leading-relaxed`,children:e.goal}),e.summary&&(0,_.jsx)(`p`,{className:`text-[12px] text-(--text-muted) leading-relaxed`,children:e.summary}),(0,_.jsx)(`div`,{className:`space-y-1.5`,children:s.map((e,t)=>(0,_.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,_.jsx)(`span`,{className:`w-5 h-5 rounded-full bg-(--muted) text-(--muted-foreground) flex items-center justify-center text-[11px] font-medium shrink-0`,children:t+1}),(0,_.jsx)(FG,{variant:`outline`,className:B(`text-[11px] px-1.5 py-0 shrink-0`,LG[e.role||``]||`bg-(--muted) text-(--muted-foreground)`),children:String(e.role||`step`).toUpperCase()}),(0,_.jsx)(`span`,{className:`truncate text-(--text-secondary)`,children:e.title})]},t))}),r&&(0,_.jsx)(IG,{value:a,onChange:e=>o(e.target.value),placeholder:V(`planEditPlaceholder`),className:`min-h-[64px] text-[13px]`,autoFocus:!0}),(0,_.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,_.jsx)(Bp,{variant:`destructive`,size:`xs`,disabled:n,onClick:()=>t(`reject`),children:V(`planReject`)}),(0,_.jsx)(Bp,{variant:`outline`,size:`xs`,disabled:n||r&&!a.trim(),onClick:()=>{r?(a.trim()&&t(`edit`,a),a.trim()&&(i(!1),o(``))):i(!0)},children:V(r?`planSubmitFeedback`:`planEdit`)}),(0,_.jsx)(Bp,{size:`xs`,disabled:n,onClick:()=>t(`approve`),children:V(`planApprove`)})]})]})}function BG({className:e,type:t,...n}){return(0,_.jsx)(`input`,{type:t,"data-slot":`input`,className:B(`h-8 w-full min-w-0 rounded-md border border-(--border-default) bg-transparent px-3 py-1 text-[13px] transition-colors outline-none placeholder:text-(--text-muted) disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50`,`focus-visible:border-(--text-secondary) focus-visible:ring-0`,e),...n})}function VG({...e}){return(0,_.jsx)(Ic,{"data-slot":`select`,...e})}function HG({...e}){return(0,_.jsx)(Rc,{"data-slot":`select-value`,...e})}function UG({className:e,size:t,children:n,...r}){return(0,_.jsxs)(Lc,{"data-slot":`select-trigger`,"data-size":t,className:B(`flex w-fit items-center justify-between gap-2 rounded-md border border-(--border-default) bg-transparent px-3 py-1 text-[13px] whitespace-nowrap transition-colors outline-none focus-visible:border-(--text-secondary) focus-visible:ring-0 disabled:cursor-not-allowed disabled:opacity-50 data-[placeholder]:text-(--text-muted) h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-(--text-muted)`,e),...r,children:[n,(0,_.jsx)(zc,{asChild:!0,children:(0,_.jsx)(Yf,{className:`size-3.5 opacity-50`})})]})}function WG({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,_.jsx)(Bc,{children:(0,_.jsxs)(Vc,{"data-slot":`select-content`,className:B(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border border-(--border-default) bg-(--bg-primary) text-(--text-primary) shadow-md 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]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-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:r,...i,children:[(0,_.jsx)(KG,{}),(0,_.jsx)(Hc,{className:B(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,_.jsx)(qG,{})]})})}function GG({className:e,children:t,...n}){return(0,_.jsxs)(Uc,{"data-slot":`select-item`,className:B(`relative flex w-full cursor-pointer items-center gap-2 rounded-md py-1.5 pr-8 pl-2 text-[13px] outline-hidden select-none hover:bg-(--bg-hover) data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-(--text-muted) *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,_.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,_.jsx)(Gc,{children:(0,_.jsx)(Jf,{className:`size-4`})})}),(0,_.jsx)(Wc,{children:t})]})}function KG({className:e,...t}){return(0,_.jsx)(Kc,{"data-slot":`select-scroll-up-button`,className:B(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,_.jsx)(Yf,{className:`size-4 rotate-180`})})}function qG({className:e,...t}){return(0,_.jsx)(qc,{"data-slot":`select-scroll-down-button`,className:B(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,_.jsx)(Yf,{className:`size-4`})})}function JG(e,t){return t.split(`.`).reduce((e,t)=>e?.[t],e)}function YG({open:e,onOpenChange:t}){let n=[{title:V(`gateway`),keys:[{path:`gateway.base_url`,label:V(`baseUrl`),placeholder:`http://127.0.0.1:8000/v1`},{path:`gateway.api_key`,label:V(`apiKey`),type:`password`,placeholder:`sk-...`},{path:`gateway.timeout_ms`,label:V(`timeout`),type:`number`},{path:`gateway.max_retries`,label:V(`maxRetries`),type:`number`}]},{title:V(`sdk`),keys:[{path:`sdk.provider`,label:V(`provider`),options:[`openai-compatible`,`anthropic`]}]},{title:V(`model`),keys:[{path:`model.name`,label:V(`modelName`),placeholder:`gpt-4.1-mini`},{path:`model.fast_name`,label:V(`fastModel`),placeholder:`fallback to Model Name when empty`},{path:`model.max_context_tokens`,label:V(`maxContextTokens`),type:`number`}]},{title:V(`execution`),keys:[{path:`execution.mode`,label:V(`mode`),options:[`auto`,`plan`]},{path:`execution.max_steps`,label:V(`maxSteps`),type:`number`},{path:`ui.reply_language`,label:V(`replyLanguage`),options:[`zh`,`en`]}]},{title:V(`context`),keys:[{path:`context.preflight_trigger_pct`,label:V(`preflightTrigger`),type:`number`,placeholder:`60`},{path:`context.hard_limit_pct`,label:V(`hardLimit`),type:`number`,placeholder:`98`},{path:`context.tool_result_max_chars`,label:V(`toolResultMaxChars`),type:`number`,placeholder:`12000`},{path:`context.microcompact_enabled`,label:V(`microcompactEnabled`),options:[`true`,`false`]},{path:`context.microcompact_keep_recent`,label:V(`microcompactKeepRecent`),type:`number`,placeholder:`5`}]},{title:V(`shell`),keys:[{path:`shell.default`,label:V(`defaultShell`),options:[`bash`,`powershell`,`zsh`,`cmd`]}]}],[r,i]=(0,d.useState)(null),[a,o]=(0,d.useState)({}),[s,c]=(0,d.useState)(!1);(0,d.useEffect)(()=>{e&&(c(!0),zd().then(e=>{i(e),o({})}).catch(()=>{}).finally(()=>c(!1)))},[e]);let l=(e,t)=>{o(n=>({...n,[e]:t}))},u=e=>e in a?a[e]:r?String(JG(r,e)??``):``,f=Object.keys(a).length>0;return(0,_.jsx)(Vp,{open:e,onOpenChange:t,children:(0,_.jsxs)(Wp,{className:`sm:max-w-[640px] max-h-[80vh] flex flex-col`,children:[(0,_.jsx)(Gp,{className:`shrink-0`,children:(0,_.jsx)(qp,{children:V(`settingsTitle`)})}),(0,_.jsx)(`div`,{className:`space-y-5 py-1 overflow-y-auto flex-1 min-h-0`,children:s?(0,_.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,_.jsx)(Xp,{})}):n.map((e,t)=>(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`div`,{className:`text-[13px] font-semibold text-(--text-secondary) mb-2.5 uppercase tracking-[0.3px]`,children:e.title}),(0,_.jsx)(`div`,{className:`space-y-2.5`,children:e.keys.map(e=>(0,_.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,_.jsx)(`label`,{className:`text-[13px] text-(--text-muted) w-32 shrink-0`,children:e.label}),e.options?(0,_.jsxs)(VG,{value:u(e.path),onValueChange:t=>l(e.path,t),children:[(0,_.jsx)(UG,{className:`flex-1 h-8 text-[13px]`,children:(0,_.jsx)(HG,{})}),(0,_.jsx)(WG,{children:e.options.map(e=>(0,_.jsx)(GG,{value:e,children:e},e))})]}):(0,_.jsx)(BG,{type:e.type||`text`,value:u(e.path),onChange:t=>l(e.path,t.target.value),placeholder:e.placeholder||``,className:`flex-1 h-8 text-[13px]`})]},e.path))}),t<n.length-1&&(0,_.jsx)(Mp,{className:`mt-4 bg-(--border-default)`})]},e.title))}),(0,_.jsxs)(Kp,{className:`gap-2 shrink-0`,children:[(0,_.jsx)(Bp,{variant:`outline`,onClick:()=>t(!1),className:`text-[13px]`,children:V(`cancel`)}),(0,_.jsx)(Bp,{onClick:async()=>{try{for(let[e,t]of Object.entries(a))await Bd(e,n.flatMap(e=>e.keys).find(t=>t.path===e)?.type===`number`?Number(t):t);o({}),t(!1)}catch(e){console.error(`Config save failed:`,e)}},disabled:!f,className:`text-[13px]`,children:V(`saveChanges`)})]})]})})}function XG({className:e,children:t,...n}){return(0,_.jsxs)(bs,{"data-slot":`scroll-area`,className:B(`relative`,e),...n,children:[(0,_.jsx)(xs,{"data-slot":`scroll-area-viewport`,className:`size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1`,children:t}),(0,_.jsx)(ZG,{}),(0,_.jsx)(Ss,{})]})}function ZG({className:e,orientation:t=`vertical`,...n}){return(0,_.jsx)(Jo,{"data-slot":`scroll-area-scrollbar`,orientation:t,className:B(`flex touch-none p-px transition-colors select-none`,t===`vertical`&&`h-full w-2.5 border-l border-l-transparent`,t===`horizontal`&&`h-2.5 flex-col border-t border-t-transparent`,e),...n,children:(0,_.jsx)(as,{"data-slot":`scroll-area-thumb`,className:`relative flex-1 rounded-full bg-border`})})}function QG({open:e,onOpenChange:t,onOpenProject:n}){let[r,i]=(0,d.useState)(``),[a,o]=(0,d.useState)(null),[s,c]=(0,d.useState)(``);(0,d.useEffect)(()=>{e&&Vd().then(e=>{i(e.cwd||``),c(e.cwd||`/`),l(e.cwd||`/`)}).catch(()=>{})},[e]);let l=async e=>{try{o(await Kd(e)),c(e)}catch{}},u=()=>{let e=r.trim();e&&(t(!1),n(e))},f=(s||``).replace(/\\/g,`/`),p=f.startsWith(`/`),m=f.split(`/`).filter(Boolean);return(0,_.jsx)(Vp,{open:e,onOpenChange:t,children:(0,_.jsxs)(Wp,{className:`sm:max-w-lg`,children:[(0,_.jsx)(Gp,{children:(0,_.jsx)(qp,{children:V(`selectProject`)})}),(0,_.jsxs)(`div`,{className:`flex gap-2`,children:[(0,_.jsx)(BG,{value:r,onChange:e=>i(e.target.value),placeholder:V(`enterOrBrowse`),onKeyDown:e=>e.key===`Enter`&&u(),className:`flex-1 h-8 text-[13px]`}),(0,_.jsx)(Bp,{onClick:u,className:`text-[13px] h-8`,children:V(`select`)})]}),(0,_.jsxs)(`div`,{className:`border border-(--border-default) rounded-lg overflow-hidden`,children:[(0,_.jsx)(`div`,{className:`flex items-center gap-1 text-[12px] px-3 py-2 border-b border-(--border-default) bg-(--bg-secondary) flex-wrap text-(--text-secondary)`,children:m.map((e,t)=>{let n=(p?`/`:``)+m.slice(0,t+1).join(`/`);return(0,_.jsxs)(`span`,{className:`flex items-center gap-1`,children:[t>0&&(0,_.jsx)(`span`,{className:`text-(--text-muted)`,children:`/`}),(0,_.jsx)(`button`,{onClick:()=>{i(n),l(n)},className:B(`hover:underline cursor-pointer border-0 bg-transparent`,t===m.length-1?`text-(--text-primary) font-medium`:`text-(--accent-blue)`),children:e})]},t)})}),(0,_.jsx)(XG,{className:`h-[240px]`,children:a&&(0,_.jsxs)(`div`,{className:`p-2`,children:[m.length>0&&(0,_.jsx)(`button`,{className:`w-full text-left px-2 py-1.5 text-[13px] hover:bg-(--bg-hover) rounded cursor-pointer flex items-center gap-2 border-0 bg-transparent text-(--text-secondary)`,onClick:()=>{let e=(p?`/`:``)+m.slice(0,-1).join(`/`);i(e),l(e)},children:(0,_.jsx)(`span`,{children:`..`})}),(a.dirs||[]).map(e=>(0,_.jsxs)(`button`,{className:`w-full text-left px-2 py-1.5 text-[13px] hover:bg-(--bg-hover) rounded cursor-pointer flex items-center gap-2 border-0 bg-transparent text-(--text-secondary)`,onClick:()=>{i(e.path),l(e.path)},children:[(0,_.jsx)(`span`,{className:`flex-1 truncate`,children:e.name}),e.isGit&&(0,_.jsx)(`span`,{className:`text-[11px] text-(--text-muted) bg-(--bg-tertiary) px-1.5 py-0.5 rounded`,children:`git`})]},e.path)),!(a.dirs||[]).length&&!a.error&&(0,_.jsx)(`div`,{className:`text-center text-[12px] text-(--text-muted) py-4`,children:V(`noSubDirs`)})]})})]})]})})}var $G=[`all`,`enabled`,`builtin`,`custom`];function eK({checked:e,onClick:t,title:n}){return(0,_.jsx)(`button`,{type:`button`,onClick:t,title:n,"aria-pressed":e,className:B(`relative h-5 w-9 rounded-full border shadow-inner transition-colors`,e?`border-(--text-primary) bg-(--text-primary)`:`border-(--border-strong) bg-(--bg-hover)`),children:(0,_.jsx)(`span`,{className:B(`absolute left-0.5 top-0.5 size-3.5 rounded-full transition-transform`,e?`bg-(--bg-primary)`:`bg-(--text-muted)`,e?`translate-x-4`:`translate-x-0`)})})}function tK(e){return V(e===`builtin`?`builtin`:e===`global`?`globalScope`:`projectScope`)}function nK(e){return e?.scope===`builtin`}function rK(e){return nK(e)||e?.enabled!==!1}function iK({skill:e,onSave:t,onCancel:n}){let[r,i]=(0,d.useState)(e?.name||``),[a,o]=(0,d.useState)(e?.description||``),[s,c]=(0,d.useState)(``),[l,u]=(0,d.useState)(!1),f=!e;return(0,d.useEffect)(()=>{if(i(e?.name||``),o(e?.description||``),!e){c(``);return}u(!0),Jd(e.name).then(e=>c(e.content||``)).catch(()=>{}).finally(()=>u(!1))},[e]),(0,_.jsxs)(`div`,{className:`space-y-3`,children:[(0,_.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`div`,{className:`text-[13px] font-medium text-(--text-primary)`,children:V(f?`newSkill`:`editSkill`)}),(0,_.jsx)(`div`,{className:`mt-0.5 text-[11px] text-(--text-muted)`,children:V(`skillEditorHint`)})]}),(0,_.jsx)(FG,{variant:`outline`,className:`rounded-md px-1.5 py-0 text-[10px]`,children:f?V(`projectScope`):tK(e.scope)})]}),(0,_.jsxs)(`div`,{className:`grid gap-3`,children:[(0,_.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,_.jsx)(`label`,{className:`text-[12px] text-(--text-muted)`,children:V(`name`)}),(0,_.jsx)(BG,{value:r,onChange:e=>i(e.target.value),disabled:!f,placeholder:`my-skill`,className:`h-8 text-[13px]`})]}),f&&(0,_.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,_.jsx)(`label`,{className:`text-[12px] text-(--text-muted)`,children:V(`description`)}),(0,_.jsx)(BG,{value:a,onChange:e=>o(e.target.value),placeholder:V(`skillDescriptionPlaceholder`),className:`h-8 text-[13px]`})]}),(0,_.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,_.jsx)(`label`,{className:`text-[12px] text-(--text-muted)`,children:V(`skillContent`)}),l?(0,_.jsxs)(`div`,{className:`rounded-md border border-(--border-default) py-8 text-center text-[12px] text-(--text-muted)`,children:[V(`loading`),`...`]}):(0,_.jsx)(IG,{value:s,onChange:e=>c(e.target.value),className:`min-h-[240px] resize-y text-[13px] font-mono leading-5`,placeholder:`---
|
|
342
342
|
name: my-skill
|
|
343
343
|
description: ...
|
|
344
344
|
---
|