@rainmanhhh/pi-web 0.15.25 → 0.15.26
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/README.md +8 -17
- package/README.zh-CN.md +8 -17
- package/dist/server.mjs +123 -123
- package/dist/static/assets/{CodeMirrorEditor-akm7jmju.js → CodeMirrorEditor-DIiHnHN2.js} +1 -1
- package/dist/static/assets/{abnfDiagram-VCTEODGH-DeKR-Dkz.js → abnfDiagram-VCTEODGH-DLG-FvFC.js} +1 -1
- package/dist/static/assets/architecture-7GRP2DOG-V-hLMD7V.js +1 -0
- package/dist/static/assets/{architectureDiagram-5GKGNRK7-BTgJsIYi.js → architectureDiagram-5GKGNRK7-BHXs2K7Q.js} +1 -1
- package/dist/static/assets/{blockDiagram-I7D4REHJ-Cm1LVrIG.js → blockDiagram-I7D4REHJ-DG50vMTb.js} +1 -1
- package/dist/static/assets/{c4Diagram-7LVT6UL2-BF5wxDif.js → c4Diagram-7LVT6UL2-CpYmjg4f.js} +1 -1
- package/dist/static/assets/channel-BGfmKd3N.js +1 -0
- package/dist/static/assets/{chunk-4HAMMTFA-BqQb3rd3.js → chunk-4HAMMTFA-CxuZzCf5.js} +1 -1
- package/dist/static/assets/{chunk-75Z2AOVW-BsnyAdKc.js → chunk-75Z2AOVW-BHdGga9h.js} +1 -1
- package/dist/static/assets/{chunk-DU6HZSFF-Bz4MstcP.js → chunk-DU6HZSFF-C9NyR4eD.js} +3 -3
- package/dist/static/assets/{chunk-F27PBJKO-BCr1waQv.js → chunk-F27PBJKO-DpyXeodJ.js} +1 -1
- package/dist/static/assets/{chunk-GMAD6QVW-DxWn3Mm1.js → chunk-GMAD6QVW-78XWZVBD.js} +1 -1
- package/dist/static/assets/{chunk-GVQU2GXP-C3mi0dNH.js → chunk-GVQU2GXP-BS_zah4P.js} +1 -1
- package/dist/static/assets/{chunk-IMKFNOWR-D9sanBR-.js → chunk-IMKFNOWR-DZmAlHvE.js} +1 -1
- package/dist/static/assets/{chunk-L3NEJ4N5-BtAAz7XM.js → chunk-L3NEJ4N5-9M0F_QJ3.js} +1 -1
- package/dist/static/assets/{chunk-OSK3NFVY-DdnVo75a.js → chunk-OSK3NFVY-DEKeRwkT.js} +1 -1
- package/dist/static/assets/{chunk-P2QGCYS3-_7w_fBBi.js → chunk-P2QGCYS3-DVCHs6L2.js} +1 -1
- package/dist/static/assets/{chunk-POPQ4Y6H-BhyIR_WI.js → chunk-POPQ4Y6H-Br1gO1bK.js} +1 -1
- package/dist/static/assets/{chunk-PWAF6VOD-CMnaIxhX.js → chunk-PWAF6VOD-s9nE5cJ5.js} +1 -1
- package/dist/static/assets/{chunk-SHT3W25Y-xOdmRmOH.js → chunk-SHT3W25Y-vN-1POTV.js} +1 -1
- package/dist/static/assets/{chunk-SVP7TREG-CkMykiFE.js → chunk-SVP7TREG-C5iCGGrR.js} +1 -1
- package/dist/static/assets/{chunk-TICWLB2K-CyWLr5yT.js → chunk-TICWLB2K-iKss14Kx.js} +1 -1
- package/dist/static/assets/classDiagram-ZZMXUADV-B-Q38QiL.js +1 -0
- package/dist/static/assets/classDiagram-v2-VYDZK3BY-B-Q38QiL.js +1 -0
- package/dist/static/assets/{cynefin-OW5HDTMX-DVbgv6Mb.js → cynefin-OW5HDTMX-wUBY8mye.js} +1 -1
- package/dist/static/assets/{cynefinDiagram-5FMLGOSQ-DkdbGunM.js → cynefinDiagram-5FMLGOSQ-BBfqNYxW.js} +1 -1
- package/dist/static/assets/{dagre-GXQ25YYZ-CECWSpgv.js → dagre-GXQ25YYZ-u2Fx5giL.js} +1 -1
- package/dist/static/assets/{diagram-S7CK7UJ4-CYoT6aeF.js → diagram-S7CK7UJ4-ewrQdUCW.js} +1 -1
- package/dist/static/assets/{diagram-UQ7AKVKN-DShJKzBR.js → diagram-UQ7AKVKN-BRyo1B2Q.js} +1 -1
- package/dist/static/assets/{diagram-VSXAHHWV-BIDJeHKf.js → diagram-VSXAHHWV-Dz7e2BMM.js} +1 -1
- package/dist/static/assets/{diagram-VX7I27RA-Bo1lY382.js → diagram-VX7I27RA-BXlAuUBB.js} +1 -1
- package/dist/static/assets/{diagram-Z3DM3KII-ClnJ2jSh.js → diagram-Z3DM3KII-K5C_v28j.js} +1 -1
- package/dist/static/assets/{ebnfDiagram-PWID7BFC-TJa4Z4op.js → ebnfDiagram-PWID7BFC-ClXS6KpV.js} +1 -1
- package/dist/static/assets/{erDiagram-RLTQ6QDP-ClgJt_ee.js → erDiagram-RLTQ6QDP-C0ClhOqP.js} +1 -1
- package/dist/static/assets/eventmodeling-NTZA5JFV-Y_lBwv0_.js +1 -0
- package/dist/static/assets/flowDiagram-HODETNUW-B8dGoyK0.js +1 -0
- package/dist/static/assets/{ganttDiagram-EL5Y4UJY-C97bUls2.js → ganttDiagram-EL5Y4UJY-BdDphtij.js} +1 -1
- package/dist/static/assets/{gitGraph-4MIJSDKK-B2N_hwri.js → gitGraph-4MIJSDKK-Br2lT4sS.js} +1 -1
- package/dist/static/assets/{gitGraphDiagram-WWUBYQGX-DGSCBcnk.js → gitGraphDiagram-WWUBYQGX-D1yoSahN.js} +1 -1
- package/dist/static/assets/{highlighted-body-KPVGNVTW-Co_-jo4H.js → highlighted-body-KPVGNVTW-McvGMRtr.js} +1 -1
- package/dist/static/assets/{index-DVSMlsdZ.js → index-BbcgQFTP.js} +6 -6
- package/dist/static/assets/{info-A6RAGUB7-DcJvgGv6.js → info-A6RAGUB7-Dw-ff4ue.js} +1 -1
- package/dist/static/assets/{infoDiagram-27XIBGKW-5NdM28v_.js → infoDiagram-27XIBGKW-BjW3vxPT.js} +1 -1
- package/dist/static/assets/{ishikawaDiagram-5VMMS53U-BJg2OXo2.js → ishikawaDiagram-5VMMS53U-F6-IKFvV.js} +1 -1
- package/dist/static/assets/{journeyDiagram-3NMN7TZE-DS_9ENhc.js → journeyDiagram-3NMN7TZE-9AAgKEGW.js} +1 -1
- package/dist/static/assets/{kanban-definition-UXKFOSKX-Xp5TVUNp.js → kanban-definition-UXKFOSKX-DcYAikOJ.js} +1 -1
- package/dist/static/assets/{line-CXBzl-mY.js → line-DAWpylln.js} +1 -1
- package/dist/static/assets/mermaid-HWGCJPDP-BXpzT6aa.js +1 -0
- package/dist/static/assets/{mermaid-parser.core-DSK10fAX.js → mermaid-parser.core-Cr8Iaj6Q.js} +3 -3
- package/dist/static/assets/{mermaid.core-aY_IlyaS.js → mermaid.core-DADvtc6n.js} +4 -4
- package/dist/static/assets/{mindmap-definition-YA3MSWOX-xu4uv3hr.js → mindmap-definition-YA3MSWOX-DUAml3Om.js} +1 -1
- package/dist/static/assets/{packet-AYTQ26CC-DXncnSSt.js → packet-AYTQ26CC-BIVAICp6.js} +1 -1
- package/dist/static/assets/{pegDiagram-XKGWAZYB-BQMJhLfR.js → pegDiagram-XKGWAZYB-ChBMBDW1.js} +1 -1
- package/dist/static/assets/{pie-WAS4IAKB-D_eQSauW.js → pie-WAS4IAKB-CGXvuPuR.js} +1 -1
- package/dist/static/assets/{pieDiagram-E7YTZNPT-B1mIyvSo.js → pieDiagram-E7YTZNPT-BJJF9uQl.js} +1 -1
- package/dist/static/assets/{quadrantDiagram-AXDQQJYC-Cr_lZ8-Q.js → quadrantDiagram-AXDQQJYC-Cu8bhfPR.js} +1 -1
- package/dist/static/assets/{radar-RG4KPBEZ-9fT2X2BL.js → radar-RG4KPBEZ-DWPq4hx7.js} +1 -1
- package/dist/static/assets/{railroad-74A4TZTK-Cs4P8oQO.js → railroad-74A4TZTK-BVEvewKD.js} +1 -1
- package/dist/static/assets/railroad-abnf-HS5TGJTU-Dbg1QZp2.js +1 -0
- package/dist/static/assets/railroad-ebnf-LZEXJU2U-AHWHMsNp.js +1 -0
- package/dist/static/assets/railroad-peg-WCYAUIDC-D-ymX7et.js +1 -0
- package/dist/static/assets/{railroadDiagram-O6MQD6OU-CAPueSvm.js → railroadDiagram-O6MQD6OU-B07t3cRv.js} +1 -1
- package/dist/static/assets/{requirementDiagram-BXWQKSXE-Zn_fafg_.js → requirementDiagram-BXWQKSXE-BaODdgPK.js} +1 -1
- package/dist/static/assets/{sankeyDiagram-P5KCCOFB-_R1xk8R5.js → sankeyDiagram-P5KCCOFB-DH8OuyTA.js} +1 -1
- package/dist/static/assets/{sequenceDiagram-WJ2MYXX4-Cz7X8YU1.js → sequenceDiagram-WJ2MYXX4-7p-N2D3K.js} +1 -1
- package/dist/static/assets/{stateDiagram-D77RDMKH-D8MTtLdV.js → stateDiagram-D77RDMKH-BKd2u1p9.js} +1 -1
- package/dist/static/assets/stateDiagram-v2-MP3YSRHH-Cpa6Xfgi.js +1 -0
- package/dist/static/assets/{swimlanes-42K2YHIH-WycVrEnd.js → swimlanes-42K2YHIH-CBSChLpa.js} +1 -1
- package/dist/static/assets/swimlanesDiagram-VR7AAH4N-CZUKsELT.js +8 -0
- package/dist/static/assets/{timeline-definition-24CTP7MA-BDZtFa3M.js → timeline-definition-24CTP7MA-BCtBUg1c.js} +1 -1
- package/dist/static/assets/{treeView-Q6P3EWNA-BsFjPitK.js → treeView-Q6P3EWNA-ug13Qt_I.js} +1 -1
- package/dist/static/assets/{treemap-WGGIJYW6-DGXXYaW3.js → treemap-WGGIJYW6-JqS-DR-B.js} +1 -1
- package/dist/static/assets/{vennDiagram-4TSXK5OY-Dg85x-9J.js → vennDiagram-4TSXK5OY-EiEPohHX.js} +1 -1
- package/dist/static/assets/{wardley-WFR3VGLG-DVuZoX7b.js → wardley-WFR3VGLG-BBmilDRw.js} +1 -1
- package/dist/static/assets/{wardleyDiagram-VM6X3IG4-DI7FreTt.js → wardleyDiagram-VM6X3IG4-CQk7nQMV.js} +1 -1
- package/dist/static/assets/{xychartDiagram-S5SC5T6Z-DsvWrXCA.js → xychartDiagram-S5SC5T6Z-UzNgGjo0.js} +1 -1
- package/dist/static/index.html +1 -1
- package/dist/static/recommended-plugins.json +8 -0
- package/package.json +3 -3
- package/public/recommended-plugins.json +8 -0
- package/dist/static/assets/architecture-7GRP2DOG-CGzMFzMD.js +0 -1
- package/dist/static/assets/channel-pSVoASzT.js +0 -1
- package/dist/static/assets/classDiagram-ZZMXUADV-BQikV5a1.js +0 -1
- package/dist/static/assets/classDiagram-v2-VYDZK3BY-BQikV5a1.js +0 -1
- package/dist/static/assets/eventmodeling-NTZA5JFV-BK66JW78.js +0 -1
- package/dist/static/assets/flowDiagram-HODETNUW-B6jjYayk.js +0 -1
- package/dist/static/assets/mermaid-HWGCJPDP-Dpt1zea-.js +0 -1
- package/dist/static/assets/railroad-abnf-HS5TGJTU-Di4YQYqs.js +0 -1
- package/dist/static/assets/railroad-ebnf-LZEXJU2U-BGLR6XGG.js +0 -1
- package/dist/static/assets/railroad-peg-WCYAUIDC-DlC8oesQ.js +0 -1
- package/dist/static/assets/stateDiagram-v2-MP3YSRHH-BWcoCjL5.js +0 -1
- package/dist/static/assets/swimlanesDiagram-VR7AAH4N-BvHt7SGz.js +0 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/highlighted-body-KPVGNVTW-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/highlighted-body-KPVGNVTW-McvGMRtr.js","assets/rolldown-runtime-hePW80VL.js","assets/mermaid.core-DADvtc6n.js","assets/chunk-75Z2AOVW-BHdGga9h.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-B6xuSHsQ.js","assets/chunk-DU6HZSFF-C9NyR4eD.js","assets/dist-v5Q1xZ2K.js","assets/chunk-PWAF6VOD-s9nE5cJ5.js","assets/chunk-GMAD6QVW-78XWZVBD.js","assets/chunk-P2QGCYS3-DVCHs6L2.js","assets/chunk-4HAMMTFA-CxuZzCf5.js","assets/rough.esm-Dy-Kn_BL.js","assets/chunk-GVQU2GXP-BS_zah4P.js","assets/chunk-OSK3NFVY-DEKeRwkT.js","assets/line-DAWpylln.js","assets/path-fybaL0A-.js","assets/array-BifhSqXX.js","assets/graphlib-DS17s2tU.js","assets/chunk-L3NEJ4N5-9M0F_QJ3.js","assets/CodeMirrorEditor-DIiHnHN2.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{n as e,r as t,t as n}from"./rolldown-runtime-hePW80VL.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),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`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 k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(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 N(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,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(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(A,`$&/`)+`/`)+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+j(a,u),c+=N(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+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(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 ee(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function te(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 P=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)},ne={map:ee,forEach:function(e,t,n){ee(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ee(e,function(){t++}),t},toArray:function(e){return ee(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=ne,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:te}},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,P)}catch(e){P(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.8`})),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&&j(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&&j(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 k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(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,j(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.8`})),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`),k=Symbol.for(`react.activity`),A=Symbol.for(`react.memo_cache_sentinel`),j=Symbol.iterator;function M(e){return typeof e!=`object`||!e?null:(e=j&&e[j]||e[`@@iterator`],typeof e==`function`?e:null)}var N=Symbol.for(`react.client.reference`);function ee(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===N?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 k: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?ee(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return ee(e(t))}catch{}}return null}var te=Array.isArray,P=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne=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)?tf(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=tf(t),e=nf(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=nf(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),fp._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(`
|
|
@@ -438,7 +438,7 @@ ${e}</tr>
|
|
|
438
438
|
`}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>${c0(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=l0(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+c0(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=l0(e);if(i===null)return c0(n);e=i;let a=`<img src="${e}" alt="${c0(n)}"`;return t&&(a+=` title="${c0(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:c0(e.text)}},y0=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}},b0=class e{options;renderer;textRenderer;constructor(e){this.options=e||Y$,this.options.renderer=this.options.renderer||new v0,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new y0}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}},x0=class{options;block;constructor(e){this.options=e||Y$}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?_0.lex:_0.lexInline}provideParser(e=this.block){return e?b0.parse:b0.parseInline}},S0=new class{defaults=J$();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=b0;Renderer=v0;TextRenderer=y0;Lexer=_0;Tokenizer=g0;Hooks=x0;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 v0(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 g0(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 x0;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];t[r]=x0.passThroughHooks.has(n)?e=>{if(this.defaults.async&&x0.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)}:(...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 _0.lex(e,t??this.defaults)}parser(e,t){return b0.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?_0.lex:_0.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?b0.parse:b0.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?_0.lex:_0.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?b0.parse:b0.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+=`
|
|
439
439
|
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+c0(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function C0(e,t){return S0.parse(e,t)}C0.options=C0.setOptions=function(e){return S0.setOptions(e),C0.defaults=S0.defaults,X$(C0.defaults),C0},C0.getDefaults=J$,C0.defaults=Y$,C0.use=function(...e){return S0.use(...e),C0.defaults=S0.defaults,X$(C0.defaults),C0},C0.walkTokens=function(e,t){return S0.walkTokens(e,t)},C0.parseInline=S0.parseInline,C0.Parser=b0,C0.parser=b0.parse,C0.Renderer=v0,C0.TextRenderer=y0,C0.Lexer=_0,C0.lexer=_0.lex,C0.Tokenizer=g0,C0.Hooks=x0,C0.parse=C0,C0.options,C0.setOptions,C0.use,C0.walkTokens,C0.parseInline,b0.parse,_0.lex;var w0=`modulepreload`,T0=function(e){return`/`+e},E0={},D0=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}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=T0(t,n),t=s(t),t in E0)return;E0[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:w0,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.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)})},O0=300,k0=`300px`,A0=500;function j0(e={}){let{immediate:t=!1,debounceDelay:n=O0,rootMargin:r=k0,idleTimeout:i=A0}=e,[a,o]=(0,_.useState)(!1),s=(0,_.useRef)(null),c=(0,_.useRef)(null),l=(0,_.useRef)(null),u=(0,_.useMemo)(()=>e=>{let t=Date.now();return window.setTimeout(()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-t))})},1)},[]),d=(0,_.useMemo)(()=>typeof window<`u`&&window.requestIdleCallback?(e,t)=>window.requestIdleCallback(e,t):u,[u]),f=(0,_.useMemo)(()=>typeof window<`u`&&window.cancelIdleCallback?e=>window.cancelIdleCallback(e):e=>{clearTimeout(e)},[]);return(0,_.useEffect)(()=>{if(t){o(!0);return}let e=s.current;if(!e)return;c.current&&=(clearTimeout(c.current),null),l.current&&=(f(l.current),null);let a=()=>{c.current&&=(clearTimeout(c.current),null),l.current&&=(f(l.current),null)},u=e=>{l.current=d(t=>{t.timeRemaining()>0||t.didTimeout?(o(!0),e.disconnect()):l.current=d(()=>{o(!0),e.disconnect()},{timeout:i/2})},{timeout:i})},p=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?p(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&&f(l.current),h.disconnect()}},[t,n,r,i,f,d]),{shouldRender:a,containerRef:s}}var M0=320,N0=4,P0=()=>typeof performance>`u`?Date.now():performance.now();function F0(e){let t=e?.now??P0,n=e?.maxBacklogMs??M0,r=0,i=0;return{now:t,beginPass(e){i=Math.min(Math.max(r,e),e+n)},mark(){return i},rewind(e){i=e},take(e,t,r){if(e<=0)return{baseDelay:0,step:Math.max(0,t)};let a=Math.max(0,t),o=a===0?0:Math.min(a,N0),s=Math.max(i,r),c=r+n,l=s+Math.max(0,e-1)*a,u=a;if(l>c&&e>1){if(s<c){let t=c-s;u=Math.max(o,t/(e-1))}else u=o}let d=Math.max(0,Math.round(s-r));return i=s+e*u,{baseDelay:d,step:u}},commitPass(){r=i}}}var I0=/\s/,L0=/^\s+$/,R0=new Set([`pre`,`svg`,`math`,`annotation`]),z0=new Set([`img`,`hr`]),B0=e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`element`,V0=e=>e.some(e=>B0(e)&&R0.has(e.tagName)),H0=e=>{for(let t=e.length-1;t>=0;t--){let n=e[t];if(B0(n)&&n.tagName===`li`)return n}},U0=(e,t,n,r)=>{e.properties??={},e.properties[`data-sd-animate-marker`]=!0;let i=typeof e.properties.style==`string`?`${e.properties.style};`:``;e.properties.style=`${i}--sd-marker-duration:${t}ms;--sd-marker-delay:${Math.round(n)}ms;--sd-marker-easing:${r}`},W0=new Set([`ul`,`ol`,`li`]),G0=e=>{for(let t of e.children)if(B0(t)){if(t.tagName===`input`)return t;if(W0.has(t.tagName))continue;let e=G0(t);if(e)return e}},K0=(e,t,n,r)=>{e.properties??={},e.properties[`data-sd-animate`]=!0;let i=typeof e.properties.style==`string`?`${e.properties.style};`:``;e.properties.style=`${i}--sd-animation:sd-${t.animation};--sd-duration:${n}ms;--sd-easing:${t.easing};--sd-delay:${Math.round(r)}ms`},q0=(e,t,n,r)=>{let i=G0(e);i&&K0(i,t,n,r)},J0=(e,t,n,r,i,a)=>{if(V0(t))return;let o=r.prevContentLength,s=i.count;i.count+=1;let c=o>0&&s<o,l=c?0:a.baseDelay+i.newIndex++*a.step;K0(e,n,c?0:n.duration,l)},Y0=e=>{var t;for(let n=e.length-1;n>=0;--n){let r=e[n];if(B0(r)){if((t=r.properties)!=null&&t[`data-sd-animated`])break;r.properties={...r.properties,"data-sd-animated":!0}}}},X0=e=>{let t=[],n=``,r=!1;for(let i of e){let e=I0.test(i);if(e!==r&&n){if(e){n+=i,r=!0;continue}t.push(n),n=``}n+=i,r=e}return n&&t.push(n),t},Z0=e=>{let t=[],n=``;for(let r of e)I0.test(r)?t.length>0&&!L0.test(t.at(-1))?t[t.length-1]+=r:n+=r:(n&&=(t.push(n),``),t.push(r));return n&&(t.length>0?t[t.length-1]+=n:t.push(n)),t},Q0=(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:${Math.round(a)}ms`),{type:`element`,tagName:`span`,properties:{"data-sd-animate":!0,style:o},children:[{type:`text`,value:e}]}},$0=(e,t)=>!(e>0&&t<e),e2=e=>B0(e)&&z0.has(e.tagName),t2=(e,t,n)=>{let r=0,i=0;return dD(e,e=>e.type===`text`||e2(e),(e,a)=>{if(V0(a))return uD;if(e2(e)){$0(n,i)&&(r+=1),i+=1;return}let o=e.value;if(!o.trim()){i+=o.length;return}let s=t.sep===`char`?Z0(o):X0(o);for(let e of s){let t=i;i+=e.length,!L0.test(e)&&$0(n,t)&&(r+=1)}}),r},n2=(e,t,n,r,i,a)=>{var o;let s=t.at(-1);if(!(s&&`children`in s))return;if(V0(t))return uD;let c=s,l=c.children.indexOf(e);if(l===-1)return;let u=e.value;if(!u.trim()){i.count+=u.length;return}let d=n.sep===`char`?Z0(u):X0(u),f=r.prevContentLength,p=!1,m=H0(t),h=!!(m&&!((o=m.properties)!=null&&o[`data-sd-animate-marker`])),g=!1,_=d.map(e=>{let t=i.count;if(i.count+=e.length,L0.test(e))return{type:`text`,value:e};let r=f>0&&t<f,o=r?0:a.baseDelay+i.newIndex++*a.step;if(p=!0,m&&h&&!g){let e=r?0:n.duration;U0(m,e,o,n.easing),q0(m,n,e,o),g=!0}return Q0(e,n.animation,n.duration,n.easing,r,o)});return p&&Y0(t),c.children.splice(l,1,..._),l+_.length},r2=0;function i2(e){let t={animation:e?.animation??`fadeIn`,duration:e?.duration??150,easing:e?.easing??`ease`,sep:e?.sep??`word`,stagger:e?.stagger??40,timeline:e?.timeline},n={committedCharCount:0,prevContentLength:0,lastRenderCharCount:0,pendingMark:null},r=r2++,i=()=>e=>{let r={count:0,newIndex:0};n.prevContentLength=n.committedCharCount;let i=t.timeline,a=i?.now()??P0();i&&(n.pendingMark===null?n.pendingMark=i.mark():i.rewind(n.pendingMark));let o=i?i.take(t2(e,t,n.prevContentLength),t.stagger,a):{baseDelay:0,step:t.stagger};dD(e,e=>e.type===`text`||e2(e),(e,i)=>{if(e.type===`text`)return n2(e,i,t,n,r,o);J0(e,i,t,n,r,o)}),n.lastRenderCharCount=r.count,n.prevContentLength=0};return Object.defineProperty(i,"name",{value:`rehypeAnimate$${r}`}),{name:`animate`,type:`animate`,rehypePlugin:i,setPrevContentLength(e){n.committedCharCount=e,n.prevContentLength=e},getLastRenderCharCount(){return n.lastRenderCharCount},commit(){n.committedCharCount=n.lastRenderCharCount,n.pendingMark=null}}}i2();var a2=(0,_.createContext)(!1),o2=()=>(0,_.useContext)(a2),s2=(...e)=>Rp(Vr(e)),c2=(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(` `)},l2=e=>e?(...t)=>c2(e,Rp(Vr(t))):s2,u2=(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)},d2=(0,_.createContext)(s2),f2=()=>(0,_.useContext)(d2),p2=8,m2=e=>{if(e!==void 0&&e!==0&&e!==1/0){if(typeof e==`number`)return Number.isFinite(e)&&e>0?`${e}px`:void 0;if(e!==`0`&&e!==`none`&&e!==`Infinity`)return e}},h2=(e,t,n)=>{let r=(0,_.useRef)(null),i=(0,_.useRef)(!0),a=(0,_.useRef)(!1);return(0,_.useEffect)(()=>{let e=r.current;if(!(e&&t))return;let n=()=>{let t=e.scrollHeight-e.scrollTop-e.clientHeight<p2;i.current=t};return e.addEventListener(`scroll`,n,{passive:!0}),()=>e.removeEventListener(`scroll`,n)},[t]),(0,_.useEffect)(()=>{e&&!a.current&&(i.current=!0),e||(i.current=!0),a.current=e},[e]),(0,_.useEffect)(()=>{let n=r.current;n&&t&&e&&i.current&&n.scrollTo({top:n.scrollHeight,behavior:`instant`})},[e,t,n]),r},g2=s2(`block`),_2=s2(`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`),v2=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},y2=(0,_.memo)(({children:e,result:t,language:n,className:r,maxHeight:i,startLine:a,lineNumbers:o=!0,...s})=>{let c=f2(),{isAnimating:l}=(0,_.useContext)(n6),u=m2(i),d=h2(l,!!u,t),f=(0,_.useMemo)(()=>c(_2),[c]),p=(0,_.useMemo)(()=>c(g2),[c]),m=(0,_.useMemo)(()=>{let e={};return t.bg&&(e[`--sdm-bg`]=t.bg),t.fg&&(e[`--sdm-fg`]=t.fg),t.rootStyle&&Object.assign(e,v2(t.rootStyle)),e},[t.bg,t.fg,t.rootStyle]);return(0,L.jsx)(`div`,{className:c(r,u?`overflow-y-auto`:null,`overflow-x-auto rounded-md border border-border bg-background p-4 text-sm`),"data-language":n,"data-streamdown":`code-block-body`,ref:d,style:u?{maxHeight:u}:void 0,...s,children:(0,L.jsx)(`pre`,{className:c(r,`bg-[var(--sdm-bg,inherit)]`,`dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,inherit))]`),style:m,children:(0,L.jsx)(`code`,{className:o?c(`[counter-increment:line_0] [counter-reset:line]`):void 0,style:o&&a&&a>1?{counterReset:`line ${a-1}`}:void 0,children:t.tokens.map((e,t)=>(0,L.jsx)(`span`,{className:o?f:p,children:e.length===0||e.length===1&&e[0].content===``?`
|
|
440
440
|
`: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,L.jsx)(`span`,{className:c(`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))})})})}),b2=({className:e,language:t,style:n,isIncomplete:r,...i})=>{let a=f2();return(0,L.jsx)(`div`,{className:a(`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})},x2=(0,_.createContext)({code:``}),S2=()=>(0,_.useContext)(x2),C2=({language:e})=>{let t=f2();return(0,L.jsx)(`div`,{className:t(`flex h-8 items-center text-muted-foreground text-xs`),"data-language":e,"data-streamdown":`code-block-header`,children:(0,L.jsx)(`span`,{className:t(`ml-1 font-mono lowercase`),children:e})})},w2=e=>{let t=e.length;for(;t>0&&e[t-1]===`
|
|
441
|
-
`;)t--;return e.slice(0,t)},T2=(0,_.lazy)(()=>D0(()=>import(`./highlighted-body-KPVGNVTW-
|
|
441
|
+
`;)t--;return e.slice(0,t)},T2=(0,_.lazy)(()=>D0(()=>import(`./highlighted-body-KPVGNVTW-McvGMRtr.js`).then(e=>({default:e.HighlightedCodeBlockBody})),__vite__mapDeps([0,1]))),E2=({code:e,language:t,className:n,children:r,isIncomplete:i=!1,startLine:a,lineNumbers:o,...s})=>{let c=f2(),{codeBlockMaxHeight:l}=(0,_.useContext)(n6),u=(0,_.useMemo)(()=>w2(e),[e]),d=(0,_.useMemo)(()=>({bg:`transparent`,fg:`inherit`,tokens:u.split(`
|
|
442
442
|
`).map(e=>[{content:e,color:`inherit`,bgColor:`transparent`,htmlStyle:{},offset:0}])}),[u]);return(0,L.jsx)(x2.Provider,{value:{code:e},children:(0,L.jsxs)(b2,{dir:`ltr`,isIncomplete:i,language:t,children:[(0,L.jsx)(C2,{language:t}),r?(0,L.jsx)(`div`,{className:c(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,L.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,L.jsx)(_.Suspense,{fallback:(0,L.jsx)(y2,{className:n,language:t,lineNumbers:o,maxHeight:l,result:d,startLine:a,...s}),children:(0,L.jsx)(T2,{className:n,code:u,language:t,lineNumbers:o,maxHeight:l,raw:d,startLine:a,...s})})]})})},D2={CheckIcon:e=>(0,L.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,L.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,L.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,L.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,L.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,L.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,L.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,L.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,L.jsxs)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:[(0,L.jsx)(`path`,{d:`M8 0V4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,L.jsx)(`path`,{d:`M8 16V12`,opacity:`0.5`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,L.jsx)(`path`,{d:`M3.29773 1.52783L5.64887 4.7639`,opacity:`0.9`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,L.jsx)(`path`,{d:`M12.7023 1.52783L10.3511 4.7639`,opacity:`0.1`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,L.jsx)(`path`,{d:`M12.7023 14.472L10.3511 11.236`,opacity:`0.4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,L.jsx)(`path`,{d:`M3.29773 14.472L5.64887 11.236`,opacity:`0.6`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,L.jsx)(`path`,{d:`M15.6085 5.52783L11.8043 6.7639`,opacity:`0.2`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,L.jsx)(`path`,{d:`M0.391602 10.472L4.19583 9.23598`,opacity:`0.7`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,L.jsx)(`path`,{d:`M15.6085 10.4722L11.8043 9.2361`,opacity:`0.3`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,L.jsx)(`path`,{d:`M0.391602 5.52783L4.19583 6.7639`,opacity:`0.8`,stroke:`currentColor`,strokeWidth:`1.5`})]}),Maximize2Icon:e=>(0,L.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,L.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,L.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,L.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,L.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,L.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,L.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,L.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,L.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,L.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`})})},O2=(0,_.createContext)(D2),k2=(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])},A2=({icons:e,children:t})=>{let n=(0,_.useRef)(e),r=(0,_.useRef)(e?{...D2,...e}:D2);k2(n.current,e)||(n.current=e,r.current=e?{...D2,...e}:D2);let i=r.current;return(0,L.jsx)(O2.Provider,{value:i,children:t})},j2=()=>(0,_.useContext)(O2),M2={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`,zoomIn:`Zoom in`,zoomOut:`Zoom out`,resetView:`Reset zoom and pan`,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`},N2=(0,_.createContext)(M2),P2=()=>(0,_.useContext)(N2),F2=({onCopy:e,onError:t,timeout:n=2e3,children:r,className:i,code:a,...o})=>{let s=f2(),[c,l]=(0,_.useState)(!1),u=(0,_.useRef)(0),{code:d}=S2(),{isAnimating:f}=(0,_.useContext)(n6),p=P2(),m=a??d,h=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(m),l(!0),e?.(),u.current=window.setTimeout(()=>l(!1),n))}catch(e){t?.(e)}};(0,_.useEffect)(()=>()=>{window.clearTimeout(u.current)},[]);let g=j2(),v=c?g.CheckIcon:g.CopyIcon;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{"aria-label":p.copyCode,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:f,onClick:h,title:p.copyCode,type:`button`,...o,children:r??(0,L.jsx)(v,{"aria-hidden":`true`,size:14})}),c&&(0,L.jsx)(`output`,{"aria-live":`polite`,className:`sr-only`,children:p.copied})]})},I2=(e,t,n)=>{if(typeof e==`boolean`)return n;let r=e[t];if(typeof r!=`object`)return n;let i=r.download;return typeof i==`object`&&i.filename||n},L2={"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`},R2=({onDownload:e,onError:t,language:n,children:r,className:i,code:a,...o})=>{let s=f2(),{code:c}=S2(),{isAnimating:l,controls:u}=(0,_.useContext)(n6),d=P2(),f=j2(),p=a??c,m=n&&n in L2?L2[n]:`txt`,h=`${I2(u,`code`,`file`)}.${m}`;return(0,L.jsx)(`button`,{"aria-label":d.downloadFile,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{u2(h,p,`text/plain`),e?.()}catch(e){t?.(e)}},title:d.downloadFile,type:`button`,...o,children:r??(0,L.jsx)(f.DownloadIcon,{size:14})})},z2=()=>{let{Loader2Icon:e}=j2(),t=f2();return(0,L.jsxs)(`div`,{className:t(`w-full divide-y divide-border overflow-hidden rounded-xl border border-border`),children:[(0,L.jsx)(`div`,{className:t(`h-[46px] w-full bg-muted/80`)}),(0,L.jsx)(`div`,{className:t(`flex w-full items-center justify-center p-4`),children:(0,L.jsx)(e,{className:t(`size-4 animate-spin`)})})]})},B2=/\.[^/.]+$/,V2=({node:e,className:t,src:n,alt:r,onLoad:i,onError:a,showControls:o=!0,showDownloadControl:s=!0,...c})=>{let{DownloadIcon:l}=j2(),u=f2(),d=(0,_.useRef)(null),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(!1),g=P2(),v=c.width!=null||c.height!=null,y=(f||v)&&!m&&o&&s,b=m&&!v;(0,_.useEffect)(()=>{let e=d.current;if(e!=null&&e.complete){let t=e.naturalWidth>0;p(t),h(!t)}},[]);let x=(0,_.useCallback)(e=>{p(!0),h(!1),i?.(e)},[i]),S=(0,_.useCallback)(e=>{p(!1),h(!0),a?.(e)},[a]),C=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(B2,``)}.${i}`}u2(o,e,e.type)}catch{window.open(n,`_blank`)}};return n?(0,L.jsxs)(`div`,{className:u(`group relative my-4 inline-block`),"data-streamdown":`image-wrapper`,children:[(0,L.jsx)(`img`,{alt:r,className:u(`max-w-full rounded-lg`,b&&`hidden`,t),"data-streamdown":`image`,onError:S,onLoad:x,ref:d,src:n,...c}),b&&(0,L.jsx)(`span`,{className:u(`text-muted-foreground text-xs italic`),"data-streamdown":`image-fallback`,children:g.imageNotAvailable}),o&&(0,L.jsx)(`div`,{className:u(`pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block`),"data-streamdown":`image-overlay`}),y&&(0,L.jsx)(`button`,{className:u(`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:C,title:g.downloadImage,type:`button`,children:(0,L.jsx)(l,{size:14})})]}):null},H2=0,U2=()=>{H2+=1,H2===1&&(document.body.style.overflow=`hidden`)},W2=()=>{H2=Math.max(0,H2-1),H2===0&&(document.body.style.overflow=``)},G2=({url:e,isOpen:t,onClose:n,onConfirm:r})=>{let{CheckIcon:i,CopyIcon:a,ExternalLinkIcon:o,XIcon:s}=j2(),c=f2(),[l,u]=(0,_.useState)(!1),d=P2(),f=(0,_.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),u(!0),setTimeout(()=>u(!1),2e3)}catch{}},[e]),p=(0,_.useCallback)(()=>{r(),n()},[r,n]);if((0,_.useEffect)(()=>{if(t){U2();let e=e=>{e.key===`Escape`&&n()};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),W2()}}},[t,n]),!t||typeof document>`u`)return null;let m=(0,L.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,L.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,L.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:d.close,type:`button`,children:(0,L.jsx)(s,{size:16})}),(0,L.jsxs)(`div`,{className:c(`flex flex-col gap-2`),children:[(0,L.jsxs)(`div`,{className:c(`flex items-center gap-2 font-semibold text-lg`),children:[(0,L.jsx)(o,{size:20}),(0,L.jsx)(`span`,{children:d.openExternalLink})]}),(0,L.jsx)(`p`,{className:c(`text-muted-foreground text-sm`),children:d.externalLinkWarning})]}),(0,L.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,L.jsxs)(`div`,{className:c(`flex gap-2`),children:[(0,L.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:f,type:`button`,children:l?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(i,{size:14}),(0,L.jsx)(`span`,{children:d.copied})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(a,{size:14}),(0,L.jsx)(`span`,{children:d.copyLink})]})}),(0,L.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:p,type:`button`,children:[(0,L.jsx)(o,{size:14}),(0,L.jsx)(`span`,{children:d.openLink})]})]})]})});return(0,tr.createPortal)(m,document.body)},K2=(0,_.createContext)(null),q2=()=>(0,_.useContext)(K2),J2=()=>q2()?.code??null,Y2=()=>q2()?.mermaid??null,X2=e=>{var t;let n=q2();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},Z2=e=>{if(typeof DOMParser>`u`||typeof XMLSerializer>`u`)return e;let t=new DOMParser().parseFromString(e,`text/html`).querySelector(`svg`);return t?new XMLSerializer().serializeToString(t):e},Q2=(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}),$2=({chart:e,children:t,className:n,onDownload:r,config:i,onError:a})=>{let o=f2(),[s,c]=(0,_.useState)(!1),l=(0,_.useRef)(null),{isAnimating:u,controls:d}=(0,_.useContext)(n6),f=j2(),p=Y2(),m=P2(),h=I2(d,`mermaid`,`diagram`),g=async t=>{try{if(t===`mmd`){u2(`${h}.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}let u=Z2(l);if(t===`svg`){u2(`${h}.svg`,u,`image/svg+xml`),c(!1),r?.(t);return}if(t===`png`){let e=await Q2(u);u2(`${h}.png`,e,`image/png`),r?.(t),c(!1);return}}catch(e){a?.(e)}};return(0,_.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,L.jsxs)(`div`,{className:o(`relative`),ref:l,children:[(0,L.jsx)(`button`,{"aria-label":m.downloadDiagram,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,L.jsx)(f.DownloadIcon,{"aria-hidden":`true`,size:14})}),s?(0,L.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,L.jsx)(`button`,{"aria-label":m.downloadDiagramAsSvg,className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`svg`),title:m.downloadDiagramAsSvg,type:`button`,children:m.mermaidFormatSvg}),(0,L.jsx)(`button`,{"aria-label":m.downloadDiagramAsPng,className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`png`),title:m.downloadDiagramAsPng,type:`button`,children:m.mermaidFormatPng}),(0,L.jsx)(`button`,{"aria-label":m.downloadDiagramAsMmd,className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`mmd`),title:m.downloadDiagramAsMmd,type:`button`,children:m.mermaidFormatMmd})]}):null]})},e4=({chart:e,config:t,onFullscreen:n,onExit:r,className:i,...a})=>{let{Maximize2Icon:o,XIcon:s}=j2(),c=f2(),[l,u]=(0,_.useState)(!1),{isAnimating:d,controls:f}=(0,_.useContext)(n6),p=P2(),m=(()=>{if(typeof f==`boolean`)return f;let e=f.mermaid;return e===!1?!1:e===!0||e===void 0||e.panZoom!==!1})(),h=(()=>{if(typeof f==`boolean`)return f;let e=f.mermaid;return e===!1?!1:e===!0||e===void 0||e.download!==!1})(),g=(()=>{if(typeof f==`boolean`)return f;let e=f.mermaid;return e===!1?!1:e===!0||e===void 0||e.copy!==!1})(),v=()=>{u(!l)};return(0,_.useEffect)(()=>{if(l){U2();let e=e=>{e.key===`Escape`&&u(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),W2()}}},[l]),(0,_.useEffect)(()=>{l?n?.():r&&r()},[l,n,r]),(0,L.jsxs)(L.Fragment,{children:[(0,L.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:d,onClick:v,title:p.viewFullscreen,type:`button`,...a,"aria-label":p.viewFullscreen,children:(0,L.jsx)(o,{"aria-hidden":`true`,size:14})}),l?(0,tr.createPortal)((0,L.jsxs)(`div`,{"aria-label":p.viewFullscreen,"aria-modal":`true`,className:c(`fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm`),"data-streamdown":`mermaid-fullscreen`,onClick:v,onKeyDown:e=>{e.key===`Escape`&&v()},role:`dialog`,children:[(0,L.jsxs)(`div`,{className:c(`absolute top-4 right-4 z-10 flex items-center gap-1`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[h?(0,L.jsx)($2,{chart:e,config:t}):null,g?(0,L.jsx)(F2,{code:e}):null,(0,L.jsx)(`button`,{"aria-label":p.exitFullscreen,className:c(`rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:v,title:p.exitFullscreen,type:`button`,children:(0,L.jsx)(s,{"aria-hidden":`true`,size:20})})]}),(0,L.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,L.jsx)(o6,{chart:e,className:c(`size-full [&_svg]:h-auto [&_svg]:w-auto`),config:t,fullscreen:!0,showControls:m})})]}),document.body):null]})};function t4(e){if(e.nodeType===Node.TEXT_NODE)return e.textContent??``;if(e.nodeType!==Node.ELEMENT_NODE)return``;let t=e;return t.tagName===`BR`?`
|
|
443
443
|
`:Array.from(t.childNodes).map(t4).join(``)}var n4=e=>{let t=[],n=[],r=e.querySelectorAll(`thead th`);for(let e of r)t.push(t4(e).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(t4(e).trim());n.push(t)}return{headers:t,rows:n}},r4=e=>{if(typeof e!=`object`)return`,`;let t=e.table;return typeof t==`object`?t.csvSeparator??`,`:`,`},i4=(e,t=`,`)=>{let n;n=t===`auto`?Intl.NumberFormat().format(1.1).includes(`,`)?`;`:`,`:t;let{headers:r,rows:i}=e,a=e=>{let t=!1;for(let r of e)if(r===n||r===`"`||r===`
|
|
444
444
|
`||r===`\r`){t=!0;break}return t?`"${e.replace(/"/g,`""`)}"`:e},o=r.length>0?i.length+1:i.length,s=Array(o),c=0;r.length>0&&(s[c]=r.map(a).join(n),c+=1);for(let e of i)s[c]=e.map(a).join(n),c+=1;return s.join(`
|
|
@@ -448,7 +448,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error
|
|
|
448
448
|
`)},o4=e=>{let t=!1;for(let n of e)if(n===`\\`||n===`|`||n===`
|
|
449
449
|
`){t=!0;break}if(!t)return e;let n=[];for(let t of e)t===`\\`?n.push(`\\\\`):t===`|`?n.push(`\\|`):t===`
|
|
450
450
|
`?n.push(`<br>`):n.push(t);return n.join(``)},s4=e=>{let{headers:t,rows:n}=e;if(t.length===0)return``;let r=Array(n.length+2),i=0,a=t.map(e=>o4(e));r[i]=`| ${a.join(` | `)} |`,i+=1;let o=Array(t.length);for(let e=0;e<t.length;e+=1)o[e]=`---`;r[i]=`| ${o.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?o4(e[r]):``;r[i]=`| ${n.join(` | `)} |`,i+=1}else{let t=e.map(e=>o4(e));r[i]=`| ${t.join(` | `)} |`,i+=1}return r.join(`
|
|
451
|
-
`)},c4=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let a=f2(),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(!1),u=(0,_.useRef)(null),d=(0,_.useRef)(0),{isAnimating:f,controls:p}=(0,_.useContext)(n6),m=P2(),h=r4(p),g=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=n4(t),o=``;o=e===`csv`?i4(a,h):e===`tsv`?a4(a):s4(a);let 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),d.current=window.setTimeout(()=>l(!1),i)}catch(e){r?.(e)}};(0,_.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(d.current)}},[]);let v=j2(),y=c?v.CheckIcon:v.CopyIcon;return(0,L.jsxs)(`div`,{className:a(`relative`),ref:u,children:[(0,L.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:f,onClick:()=>s(!o),title:m.copyTable,type:`button`,children:e??(0,L.jsx)(y,{height:14,width:14})}),o?(0,L.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,L.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`md`),title:m.copyTableAsMarkdown,type:`button`,children:m.tableFormatMarkdown}),(0,L.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`csv`),title:m.copyTableAsCsv,type:`button`,children:m.tableFormatCsv}),(0,L.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`tsv`),title:m.copyTableAsTsv,type:`button`,children:m.tableFormatTsv})]}):null]})},l4=({children:e,className:t,onDownload:n,onError:r})=>{let i=f2(),[a,o]=(0,_.useState)(!1),s=(0,_.useRef)(null),{isAnimating:c,controls:l}=(0,_.useContext)(n6),u=P2(),d=j2(),f=r4(l),p=e=>{try{let t=(s.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let i=n4(t),a=e===`csv`?i4(i,f):s4(i),c=e===`csv`?`csv`:`md`;u2(`${I2(l,`table`,`table`)}.${c}`,a,e===`csv`?`text/csv`:`text/markdown`),o(!1),n?.(e)}catch(e){r?.(e)}};return(0,_.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,L.jsxs)(`div`,{className:i(`relative`),ref:s,children:[(0,L.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:u.downloadTable,type:`button`,children:e??(0,L.jsx)(d.DownloadIcon,{size:14})}),a?(0,L.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,L.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>p(`csv`),title:u.downloadTableAsCsv,type:`button`,children:u.tableFormatCsv}),(0,L.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>p(`markdown`),title:u.downloadTableAsMarkdown,type:`button`,children:u.tableFormatMarkdown})]}):null]})},u4=({children:e,className:t,showCopy:n=!0,showDownload:r=!0})=>{let{Maximize2Icon:i,XIcon:a}=j2(),o=f2(),[s,c]=(0,_.useState)(!1),{isAnimating:l}=(0,_.useContext)(n6),u=P2(),d=()=>{c(!0)},f=()=>{c(!1)};return(0,_.useEffect)(()=>{if(s){U2();let e=e=>{e.key===`Escape`&&c(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),W2()}}},[s]),(0,L.jsxs)(L.Fragment,{children:[(0,L.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:d,title:u.viewFullscreen,type:`button`,children:(0,L.jsx)(i,{size:14})}),s?(0,tr.createPortal)((0,L.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:f,onKeyDown:e=>{e.key===`Escape`&&f()},role:`dialog`,children:(0,L.jsxs)(`div`,{className:o(`flex h-full flex-col`),"data-streamdown":`table-wrapper`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,L.jsxs)(`div`,{className:o(`flex items-center justify-end gap-1 p-4`),children:[n?(0,L.jsx)(c4,{}):null,r?(0,L.jsx)(l4,{}):null,(0,L.jsx)(`button`,{className:o(`rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:f,title:u.exitFullscreen,type:`button`,children:(0,L.jsx)(a,{size:20})})]}),(0,L.jsx)(`div`,{className:o(`flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10`),children:(0,L.jsx)(`table`,{className:o(`w-full border-collapse border border-border`),"data-streamdown":`table`,children:e})})]})}),document.body):null]})},d4=({children:e,className:t,maxHeight:n,showControls:r,showCopy:i=!0,showDownload:a=!0,showFullscreen:o=!0,...s})=>{let c=f2(),{isAnimating:l}=(0,_.useContext)(n6),u=m2(n),d=h2(l,!!u,e),f=r&&i,p=r&&a,m=r&&o,h=f||p||m;return(0,L.jsxs)(`div`,{className:c(`my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2`),"data-streamdown":`table-wrapper`,children:[h?(0,L.jsxs)(`div`,{className:c(`flex items-center justify-end gap-1`),children:[f?(0,L.jsx)(c4,{}):null,p?(0,L.jsx)(l4,{}):null,m?(0,L.jsx)(u4,{showCopy:f,showDownload:p,children:e}):null]}):null,(0,L.jsx)(`div`,{className:c(`border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background`),ref:d,style:u?{maxHeight:u}:void 0,children:(0,L.jsx)(`table`,{className:c(`w-full divide-y divide-border`,t),"data-streamdown":`table`,...s,children:e})})]})},f4=/startLine=(\d+)/,p4=/\bnoLineNumbers\b/,m4=(0,_.lazy)(()=>D0(()=>import(`./mermaid-HWGCJPDP-Dpt1zea-.js`).then(e=>({default:e.Mermaid})),[])),h4=/language-([^\s]+)/,g4=`node`;function _4(e,t){let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;let r=e,i=t;for(let e of n)if(e!==g4&&!Object.is(r[e],i[e]))return!1;return!0}function v4(e,t){return e?.properties?.metastring===t?.properties?.metastring}var y4=(e,t)=>typeof e==`boolean`?e:e[t]!==!1,b4=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.table;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},x4=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.code;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},S4=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.mermaid;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},C4=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.image;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},w4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`ol`,{className:i(`list-inside list-decimal whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`ordered-list`,...r,children:e})},(e,t)=>_4(e,t));w4.displayName=`MarkdownOl`;var T4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`li`,{className:i(`py-1 [&>p]:inline`,t),"data-streamdown":`list-item`,...r,children:e})},(e,t)=>_4(e,t));T4.displayName=`MarkdownLi`;var E4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`ul`,{className:i(`list-inside list-disc whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`unordered-list`,...r,children:e})},(e,t)=>_4(e,t));E4.displayName=`MarkdownUl`;var D4=(0,_.memo)(({className:e,node:t,...n})=>{let r=f2();return(0,L.jsx)(`hr`,{className:r(`my-6 border-border`,e),"data-streamdown":`horizontal-rule`,...n})},(e,t)=>_4(e,t));D4.displayName=`MarkdownHr`;var O4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`span`,{className:i(`font-semibold`,t),"data-streamdown":`strong`,...r,children:e})},(e,t)=>_4(e,t));O4.displayName=`MarkdownStrong`;var k4=(0,_.memo)(({children:e,className:t,href:n,node:r,...i})=>{let a=f2(),{linkSafety:o}=(0,_.useContext)(n6),[s,c]=(0,_.useState)(!1),l=n===`streamdown:incomplete-link`,u=(0,_.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]),d=(0,_.useCallback)(()=>{n&&window.open(n,`_blank`,`noreferrer`)},[n]),f=(0,_.useCallback)(()=>{c(!1)},[]),p={url:n??``,isOpen:s,onClose:f,onConfirm:d};return o!=null&&o.enabled&&n?(0,L.jsxs)(L.Fragment,{children:[(0,L.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(p):(0,L.jsx)(G2,{...p})]}):(0,L.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)=>_4(e,t));k4.displayName=`MarkdownA`;var A4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`h1`,{className:i(`mt-6 mb-2 font-semibold text-3xl`,t),"data-streamdown":`heading-1`,...r,children:e})},(e,t)=>_4(e,t));A4.displayName=`MarkdownH1`;var j4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`h2`,{className:i(`mt-6 mb-2 font-semibold text-2xl`,t),"data-streamdown":`heading-2`,...r,children:e})},(e,t)=>_4(e,t));j4.displayName=`MarkdownH2`;var M4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`h3`,{className:i(`mt-6 mb-2 font-semibold text-xl`,t),"data-streamdown":`heading-3`,...r,children:e})},(e,t)=>_4(e,t));M4.displayName=`MarkdownH3`;var N4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`h4`,{className:i(`mt-6 mb-2 font-semibold text-lg`,t),"data-streamdown":`heading-4`,...r,children:e})},(e,t)=>_4(e,t));N4.displayName=`MarkdownH4`;var P4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`h5`,{className:i(`mt-6 mb-2 font-semibold text-base`,t),"data-streamdown":`heading-5`,...r,children:e})},(e,t)=>_4(e,t));P4.displayName=`MarkdownH5`;var F4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`h6`,{className:i(`mt-6 mb-2 font-semibold text-sm`,t),"data-streamdown":`heading-6`,...r,children:e})},(e,t)=>_4(e,t));F4.displayName=`MarkdownH6`;var I4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let{controls:i,tableMaxHeight:a}=(0,_.useContext)(n6),o=y4(i,`table`),s=b4(i,`copy`),c=b4(i,`download`),l=b4(i,`fullscreen`);return(0,L.jsx)(d4,{className:t,maxHeight:a,showControls:o,showCopy:s,showDownload:c,showFullscreen:l,...r,children:e})},(e,t)=>_4(e,t));I4.displayName=`MarkdownTable`;var L4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`thead`,{className:i(`bg-muted/80`,t),"data-streamdown":`table-header`,...r,children:e})},(e,t)=>_4(e,t));L4.displayName=`MarkdownThead`;var R4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`tbody`,{className:i(`divide-y divide-border`,t),"data-streamdown":`table-body`,...r,children:e})},(e,t)=>_4(e,t));R4.displayName=`MarkdownTbody`;var z4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`tr`,{className:i(`border-border`,t),"data-streamdown":`table-row`,...r,children:e})},(e,t)=>_4(e,t));z4.displayName=`MarkdownTr`;var B4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`th`,{className:i(`whitespace-nowrap px-4 py-2 text-left font-semibold text-sm`,t),"data-streamdown":`table-header-cell`,...r,children:e})},(e,t)=>_4(e,t));B4.displayName=`MarkdownTh`;var V4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`td`,{className:i(`px-4 py-2 text-sm`,t),"data-streamdown":`table-cell`,...r,children:e})},(e,t)=>_4(e,t));V4.displayName=`MarkdownTd`;var H4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`blockquote`,{className:i(`my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic`,t),"data-streamdown":`blockquote`,...r,children:e})},(e,t)=>_4(e,t));H4.displayName=`MarkdownBlockquote`;var U4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`sup`,{className:i(`text-sm`,t),"data-streamdown":`superscript`,...r,children:e})},(e,t)=>_4(e,t));U4.displayName=`MarkdownSup`;var W4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`sub`,{className:i(`text-sm`,t),"data-streamdown":`subscript`,...r,children:e})},(e,t)=>_4(e,t));W4.displayName=`MarkdownSub`;var G4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{if(`data-footnotes`in r){let n=e=>{if(!(0,_.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,_.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,_.isValidElement)(e)&&e.props?.[`data-footnote-backref`]===void 0){n=!0;break}}}}}return r&&!n},i=Array.isArray(e)?e.map(e=>{if(!(0,_.isValidElement)(e))return e;if(e.type===w4){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,L.jsx)(`section`,{className:t,...r,children:i}):null}return(0,L.jsx)(`section`,{className:t,...r,children:e})},(e,t)=>_4(e,t));G4.displayName=`MarkdownSection`;var K4=(0,_.memo)(({node:e,className:t,children:n,...r})=>{let i=f2(),a=!(`data-block`in r),{mermaid:o,controls:s,lineNumbers:c}=(0,_.useContext)(n6),l=Y2(),u=o2(),d=(t?.match(h4))?.at(1)??``,f=X2(d);if(a)return(0,L.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 p=e?.properties?.metastring,m=p?.match(f4),h=m?Number.parseInt(m[1],10):void 0,g=h!==void 0&&h>=1?h:void 0,v=!(p&&p4.test(p))&&c!==!1,y=``;if((0,_.isValidElement)(n)&&n.props&&typeof n.props==`object`&&`children`in n.props&&typeof n.props.children==`string`?y=n.props.children:typeof n==`string`&&(y=n),f){let e=f.component;return(0,L.jsx)(_.Suspense,{fallback:(0,L.jsx)(z2,{}),children:(0,L.jsx)(e,{code:y,isIncomplete:u,language:d,meta:p})})}if(d===`mermaid`&&l){let e=y4(s,`mermaid`),n=S4(s,`download`),r=S4(s,`copy`),a=S4(s,`fullscreen`),c=S4(s,`panZoom`),l=e&&(n||r||a);return(0,L.jsx)(_.Suspense,{fallback:(0,L.jsx)(z2,{}),children:(0,L.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,L.jsx)(`div`,{className:i(`flex h-8 items-center text-muted-foreground text-xs`),children:(0,L.jsx)(`span`,{className:i(`ml-1 font-mono lowercase`),children:`mermaid`})}),l?(0,L.jsx)(`div`,{className:i(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,L.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,L.jsx)($2,{chart:y,config:o?.config}):null,r?(0,L.jsx)(F2,{code:y}):null,a?(0,L.jsx)(e4,{chart:y,config:o?.config}):null]})}):null,(0,L.jsx)(`div`,{className:i(`rounded-md border border-border bg-background`),children:(0,L.jsx)(m4,{chart:y,config:o?.config,showControls:c})})]})})}let b=y4(s,`code`),x=x4(s,`download`),S=x4(s,`copy`),{"data-block":C,...w}=r;return(0,L.jsx)(E2,{className:t,code:y,isIncomplete:u,language:d,lineNumbers:v,startLine:g,...w,children:b?(0,L.jsxs)(L.Fragment,{children:[x?(0,L.jsx)(R2,{code:y,language:d}):null,S?(0,L.jsx)(F2,{}):null]}):null})},(e,t)=>_4(e,t)&&v4(e.node,t.node));K4.displayName=`MarkdownCode`;var q4=(0,_.memo)(({node:e,className:t,...n})=>{let{controls:r}=(0,_.useContext)(n6),i=y4(r,`image`),a=i&&C4(r,`download`);return(0,L.jsx)(V2,{className:t,node:e,showControls:i,showDownloadControl:a,...n})},(e,t)=>_4(e,t));q4.displayName=`MarkdownImg`;var J4=(0,_.memo)(({children:e,node:t,...n})=>{let r=(Array.isArray(e)?e:[e]).filter(e=>e!=null&&e!==``);if(r.length===1&&(0,_.isValidElement)(r[0])){let t=r[0].props.node?.tagName;if(t===`img`||t===`code`&&`data-block`in r[0].props)return(0,L.jsx)(L.Fragment,{children:e})}return(0,L.jsx)(`p`,{...n,children:e})},(e,t)=>_4(e,t));J4.displayName=`MarkdownParagraph`;var Y4={ol:w4,li:T4,ul:E4,hr:D4,strong:O4,a:k4,h1:A4,h2:j4,h3:M4,h4:N4,h5:P4,h6:F4,table:I4,thead:L4,tbody:R4,tr:z4,th:B4,td:V4,blockquote:H4,code:K4,img:q4,pre:({children:e})=>(0,_.isValidElement)(e)?(0,_.cloneElement)(e,{"data-block":`true`}):e,sup:U4,sub:W4,p:J4,section:G4},X4=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,Z4=/\p{L}/u;function Q4(e){let t=e.replace(/(```|~~~)[\s\S]*?\1/g,``).replace(/^#{1,6}\s+/gm,``).replace(/(\*{1,3}|_{1,3})/g,``).replace(/`[^`]*`/g,``).replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/^[\s>*\-+\d.]+/gm,``),n,r=0,i=0;for(let e of t){if(X4.test(e)){n??=`rtl`,i+=1;continue}Z4.test(e)&&(n??=`ltr`,r+=1)}return i>r?`rtl`:r>i?`ltr`:n??`ltr`}var $4=/^[ \t]{0,3}(`{3,}|~{3,})/,e3=/^\|?[ \t]*:?-{1,}:?[ \t]*(\|[ \t]*:?-{1,}:?[ \t]*)*\|?$/,t3=e=>{let t=e.split(`
|
|
451
|
+
`)},c4=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let a=f2(),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(!1),u=(0,_.useRef)(null),d=(0,_.useRef)(0),{isAnimating:f,controls:p}=(0,_.useContext)(n6),m=P2(),h=r4(p),g=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=n4(t),o=``;o=e===`csv`?i4(a,h):e===`tsv`?a4(a):s4(a);let 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),d.current=window.setTimeout(()=>l(!1),i)}catch(e){r?.(e)}};(0,_.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(d.current)}},[]);let v=j2(),y=c?v.CheckIcon:v.CopyIcon;return(0,L.jsxs)(`div`,{className:a(`relative`),ref:u,children:[(0,L.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:f,onClick:()=>s(!o),title:m.copyTable,type:`button`,children:e??(0,L.jsx)(y,{height:14,width:14})}),o?(0,L.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,L.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`md`),title:m.copyTableAsMarkdown,type:`button`,children:m.tableFormatMarkdown}),(0,L.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`csv`),title:m.copyTableAsCsv,type:`button`,children:m.tableFormatCsv}),(0,L.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`tsv`),title:m.copyTableAsTsv,type:`button`,children:m.tableFormatTsv})]}):null]})},l4=({children:e,className:t,onDownload:n,onError:r})=>{let i=f2(),[a,o]=(0,_.useState)(!1),s=(0,_.useRef)(null),{isAnimating:c,controls:l}=(0,_.useContext)(n6),u=P2(),d=j2(),f=r4(l),p=e=>{try{let t=(s.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let i=n4(t),a=e===`csv`?i4(i,f):s4(i),c=e===`csv`?`csv`:`md`;u2(`${I2(l,`table`,`table`)}.${c}`,a,e===`csv`?`text/csv`:`text/markdown`),o(!1),n?.(e)}catch(e){r?.(e)}};return(0,_.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,L.jsxs)(`div`,{className:i(`relative`),ref:s,children:[(0,L.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:u.downloadTable,type:`button`,children:e??(0,L.jsx)(d.DownloadIcon,{size:14})}),a?(0,L.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,L.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>p(`csv`),title:u.downloadTableAsCsv,type:`button`,children:u.tableFormatCsv}),(0,L.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>p(`markdown`),title:u.downloadTableAsMarkdown,type:`button`,children:u.tableFormatMarkdown})]}):null]})},u4=({children:e,className:t,showCopy:n=!0,showDownload:r=!0})=>{let{Maximize2Icon:i,XIcon:a}=j2(),o=f2(),[s,c]=(0,_.useState)(!1),{isAnimating:l}=(0,_.useContext)(n6),u=P2(),d=()=>{c(!0)},f=()=>{c(!1)};return(0,_.useEffect)(()=>{if(s){U2();let e=e=>{e.key===`Escape`&&c(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),W2()}}},[s]),(0,L.jsxs)(L.Fragment,{children:[(0,L.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:d,title:u.viewFullscreen,type:`button`,children:(0,L.jsx)(i,{size:14})}),s?(0,tr.createPortal)((0,L.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:f,onKeyDown:e=>{e.key===`Escape`&&f()},role:`dialog`,children:(0,L.jsxs)(`div`,{className:o(`flex h-full flex-col`),"data-streamdown":`table-wrapper`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,L.jsxs)(`div`,{className:o(`flex items-center justify-end gap-1 p-4`),children:[n?(0,L.jsx)(c4,{}):null,r?(0,L.jsx)(l4,{}):null,(0,L.jsx)(`button`,{className:o(`rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:f,title:u.exitFullscreen,type:`button`,children:(0,L.jsx)(a,{size:20})})]}),(0,L.jsx)(`div`,{className:o(`flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10`),children:(0,L.jsx)(`table`,{className:o(`w-full border-collapse border border-border`),"data-streamdown":`table`,children:e})})]})}),document.body):null]})},d4=({children:e,className:t,maxHeight:n,showControls:r,showCopy:i=!0,showDownload:a=!0,showFullscreen:o=!0,...s})=>{let c=f2(),{isAnimating:l}=(0,_.useContext)(n6),u=m2(n),d=h2(l,!!u,e),f=r&&i,p=r&&a,m=r&&o,h=f||p||m;return(0,L.jsxs)(`div`,{className:c(`my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2`),"data-streamdown":`table-wrapper`,children:[h?(0,L.jsxs)(`div`,{className:c(`flex items-center justify-end gap-1`),children:[f?(0,L.jsx)(c4,{}):null,p?(0,L.jsx)(l4,{}):null,m?(0,L.jsx)(u4,{showCopy:f,showDownload:p,children:e}):null]}):null,(0,L.jsx)(`div`,{className:c(`border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background`),ref:d,style:u?{maxHeight:u}:void 0,children:(0,L.jsx)(`table`,{className:c(`w-full divide-y divide-border`,t),"data-streamdown":`table`,...s,children:e})})]})},f4=/startLine=(\d+)/,p4=/\bnoLineNumbers\b/,m4=(0,_.lazy)(()=>D0(()=>import(`./mermaid-HWGCJPDP-BXpzT6aa.js`).then(e=>({default:e.Mermaid})),[])),h4=/language-([^\s]+)/,g4=`node`;function _4(e,t){let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;let r=e,i=t;for(let e of n)if(e!==g4&&!Object.is(r[e],i[e]))return!1;return!0}function v4(e,t){return e?.properties?.metastring===t?.properties?.metastring}var y4=(e,t)=>typeof e==`boolean`?e:e[t]!==!1,b4=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.table;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},x4=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.code;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},S4=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.mermaid;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},C4=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.image;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},w4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`ol`,{className:i(`list-inside list-decimal whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`ordered-list`,...r,children:e})},(e,t)=>_4(e,t));w4.displayName=`MarkdownOl`;var T4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`li`,{className:i(`py-1 [&>p]:inline`,t),"data-streamdown":`list-item`,...r,children:e})},(e,t)=>_4(e,t));T4.displayName=`MarkdownLi`;var E4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`ul`,{className:i(`list-inside list-disc whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`unordered-list`,...r,children:e})},(e,t)=>_4(e,t));E4.displayName=`MarkdownUl`;var D4=(0,_.memo)(({className:e,node:t,...n})=>{let r=f2();return(0,L.jsx)(`hr`,{className:r(`my-6 border-border`,e),"data-streamdown":`horizontal-rule`,...n})},(e,t)=>_4(e,t));D4.displayName=`MarkdownHr`;var O4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`span`,{className:i(`font-semibold`,t),"data-streamdown":`strong`,...r,children:e})},(e,t)=>_4(e,t));O4.displayName=`MarkdownStrong`;var k4=(0,_.memo)(({children:e,className:t,href:n,node:r,...i})=>{let a=f2(),{linkSafety:o}=(0,_.useContext)(n6),[s,c]=(0,_.useState)(!1),l=n===`streamdown:incomplete-link`,u=(0,_.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]),d=(0,_.useCallback)(()=>{n&&window.open(n,`_blank`,`noreferrer`)},[n]),f=(0,_.useCallback)(()=>{c(!1)},[]),p={url:n??``,isOpen:s,onClose:f,onConfirm:d};return o!=null&&o.enabled&&n?(0,L.jsxs)(L.Fragment,{children:[(0,L.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(p):(0,L.jsx)(G2,{...p})]}):(0,L.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)=>_4(e,t));k4.displayName=`MarkdownA`;var A4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`h1`,{className:i(`mt-6 mb-2 font-semibold text-3xl`,t),"data-streamdown":`heading-1`,...r,children:e})},(e,t)=>_4(e,t));A4.displayName=`MarkdownH1`;var j4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`h2`,{className:i(`mt-6 mb-2 font-semibold text-2xl`,t),"data-streamdown":`heading-2`,...r,children:e})},(e,t)=>_4(e,t));j4.displayName=`MarkdownH2`;var M4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`h3`,{className:i(`mt-6 mb-2 font-semibold text-xl`,t),"data-streamdown":`heading-3`,...r,children:e})},(e,t)=>_4(e,t));M4.displayName=`MarkdownH3`;var N4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`h4`,{className:i(`mt-6 mb-2 font-semibold text-lg`,t),"data-streamdown":`heading-4`,...r,children:e})},(e,t)=>_4(e,t));N4.displayName=`MarkdownH4`;var P4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`h5`,{className:i(`mt-6 mb-2 font-semibold text-base`,t),"data-streamdown":`heading-5`,...r,children:e})},(e,t)=>_4(e,t));P4.displayName=`MarkdownH5`;var F4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`h6`,{className:i(`mt-6 mb-2 font-semibold text-sm`,t),"data-streamdown":`heading-6`,...r,children:e})},(e,t)=>_4(e,t));F4.displayName=`MarkdownH6`;var I4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let{controls:i,tableMaxHeight:a}=(0,_.useContext)(n6),o=y4(i,`table`),s=b4(i,`copy`),c=b4(i,`download`),l=b4(i,`fullscreen`);return(0,L.jsx)(d4,{className:t,maxHeight:a,showControls:o,showCopy:s,showDownload:c,showFullscreen:l,...r,children:e})},(e,t)=>_4(e,t));I4.displayName=`MarkdownTable`;var L4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`thead`,{className:i(`bg-muted/80`,t),"data-streamdown":`table-header`,...r,children:e})},(e,t)=>_4(e,t));L4.displayName=`MarkdownThead`;var R4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`tbody`,{className:i(`divide-y divide-border`,t),"data-streamdown":`table-body`,...r,children:e})},(e,t)=>_4(e,t));R4.displayName=`MarkdownTbody`;var z4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`tr`,{className:i(`border-border`,t),"data-streamdown":`table-row`,...r,children:e})},(e,t)=>_4(e,t));z4.displayName=`MarkdownTr`;var B4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`th`,{className:i(`whitespace-nowrap px-4 py-2 text-left font-semibold text-sm`,t),"data-streamdown":`table-header-cell`,...r,children:e})},(e,t)=>_4(e,t));B4.displayName=`MarkdownTh`;var V4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`td`,{className:i(`px-4 py-2 text-sm`,t),"data-streamdown":`table-cell`,...r,children:e})},(e,t)=>_4(e,t));V4.displayName=`MarkdownTd`;var H4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`blockquote`,{className:i(`my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic`,t),"data-streamdown":`blockquote`,...r,children:e})},(e,t)=>_4(e,t));H4.displayName=`MarkdownBlockquote`;var U4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`sup`,{className:i(`text-sm`,t),"data-streamdown":`superscript`,...r,children:e})},(e,t)=>_4(e,t));U4.displayName=`MarkdownSup`;var W4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{let i=f2();return(0,L.jsx)(`sub`,{className:i(`text-sm`,t),"data-streamdown":`subscript`,...r,children:e})},(e,t)=>_4(e,t));W4.displayName=`MarkdownSub`;var G4=(0,_.memo)(({children:e,className:t,node:n,...r})=>{if(`data-footnotes`in r){let n=e=>{if(!(0,_.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,_.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,_.isValidElement)(e)&&e.props?.[`data-footnote-backref`]===void 0){n=!0;break}}}}}return r&&!n},i=Array.isArray(e)?e.map(e=>{if(!(0,_.isValidElement)(e))return e;if(e.type===w4){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,L.jsx)(`section`,{className:t,...r,children:i}):null}return(0,L.jsx)(`section`,{className:t,...r,children:e})},(e,t)=>_4(e,t));G4.displayName=`MarkdownSection`;var K4=(0,_.memo)(({node:e,className:t,children:n,...r})=>{let i=f2(),a=!(`data-block`in r),{mermaid:o,controls:s,lineNumbers:c}=(0,_.useContext)(n6),l=Y2(),u=o2(),d=(t?.match(h4))?.at(1)??``,f=X2(d);if(a)return(0,L.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 p=e?.properties?.metastring,m=p?.match(f4),h=m?Number.parseInt(m[1],10):void 0,g=h!==void 0&&h>=1?h:void 0,v=!(p&&p4.test(p))&&c!==!1,y=``;if((0,_.isValidElement)(n)&&n.props&&typeof n.props==`object`&&`children`in n.props&&typeof n.props.children==`string`?y=n.props.children:typeof n==`string`&&(y=n),f){let e=f.component;return(0,L.jsx)(_.Suspense,{fallback:(0,L.jsx)(z2,{}),children:(0,L.jsx)(e,{code:y,isIncomplete:u,language:d,meta:p})})}if(d===`mermaid`&&l){let e=y4(s,`mermaid`),n=S4(s,`download`),r=S4(s,`copy`),a=S4(s,`fullscreen`),c=S4(s,`panZoom`),l=e&&(n||r||a);return(0,L.jsx)(_.Suspense,{fallback:(0,L.jsx)(z2,{}),children:(0,L.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,L.jsx)(`div`,{className:i(`flex h-8 items-center text-muted-foreground text-xs`),children:(0,L.jsx)(`span`,{className:i(`ml-1 font-mono lowercase`),children:`mermaid`})}),l?(0,L.jsx)(`div`,{className:i(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,L.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,L.jsx)($2,{chart:y,config:o?.config}):null,r?(0,L.jsx)(F2,{code:y}):null,a?(0,L.jsx)(e4,{chart:y,config:o?.config}):null]})}):null,(0,L.jsx)(`div`,{className:i(`rounded-md border border-border bg-background`),children:(0,L.jsx)(m4,{chart:y,config:o?.config,showControls:c})})]})})}let b=y4(s,`code`),x=x4(s,`download`),S=x4(s,`copy`),{"data-block":C,...w}=r;return(0,L.jsx)(E2,{className:t,code:y,isIncomplete:u,language:d,lineNumbers:v,startLine:g,...w,children:b?(0,L.jsxs)(L.Fragment,{children:[x?(0,L.jsx)(R2,{code:y,language:d}):null,S?(0,L.jsx)(F2,{}):null]}):null})},(e,t)=>_4(e,t)&&v4(e.node,t.node));K4.displayName=`MarkdownCode`;var q4=(0,_.memo)(({node:e,className:t,...n})=>{let{controls:r}=(0,_.useContext)(n6),i=y4(r,`image`),a=i&&C4(r,`download`);return(0,L.jsx)(V2,{className:t,node:e,showControls:i,showDownloadControl:a,...n})},(e,t)=>_4(e,t));q4.displayName=`MarkdownImg`;var J4=(0,_.memo)(({children:e,node:t,...n})=>{let r=(Array.isArray(e)?e:[e]).filter(e=>e!=null&&e!==``);if(r.length===1&&(0,_.isValidElement)(r[0])){let t=r[0].props.node?.tagName;if(t===`img`||t===`code`&&`data-block`in r[0].props)return(0,L.jsx)(L.Fragment,{children:e})}return(0,L.jsx)(`p`,{...n,children:e})},(e,t)=>_4(e,t));J4.displayName=`MarkdownParagraph`;var Y4={ol:w4,li:T4,ul:E4,hr:D4,strong:O4,a:k4,h1:A4,h2:j4,h3:M4,h4:N4,h5:P4,h6:F4,table:I4,thead:L4,tbody:R4,tr:z4,th:B4,td:V4,blockquote:H4,code:K4,img:q4,pre:({children:e})=>(0,_.isValidElement)(e)?(0,_.cloneElement)(e,{"data-block":`true`}):e,sup:U4,sub:W4,p:J4,section:G4},X4=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,Z4=/\p{L}/u;function Q4(e){let t=e.replace(/(```|~~~)[\s\S]*?\1/g,``).replace(/^#{1,6}\s+/gm,``).replace(/(\*{1,3}|_{1,3})/g,``).replace(/`[^`]*`/g,``).replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/^[\s>*\-+\d.]+/gm,``),n,r=0,i=0;for(let e of t){if(X4.test(e)){n??=`rtl`,i+=1;continue}Z4.test(e)&&(n??=`ltr`,r+=1)}return i>r?`rtl`:r>i?`ltr`:n??`ltr`}var $4=/^[ \t]{0,3}(`{3,}|~{3,})/,e3=/^\|?[ \t]*:?-{1,}:?[ \t]*(\|[ \t]*:?-{1,}:?[ \t]*)*\|?$/,t3=e=>{let t=e.split(`
|
|
452
452
|
`),n=null,r=0;for(let e of t){let t=$4.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},n3=e=>{let t=e.split(`
|
|
453
453
|
`);for(let e of t){let t=e.trim();if(t.length>0&&t.includes(`|`)&&e3.test(t))return!0}return!1},r3=()=>e=>{pD(e,`html`,(e,t,n)=>{!n||typeof t!=`number`||(n.children[t]={type:`text`,value:e.value})})},i3=[],a3={allowDangerousHtml:!0},o3=new WeakMap,s3=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=o3.get(e);n||(n=e.name,o3.set(e,n)),t+=n}else t+=String(e);t+=`:`,t+=JSON.stringify(n)}else if(typeof r==`function`){let e=o3.get(r);e||(e=r.name,o3.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()}},c3=e=>{let t=l3(e),n=e.children||``;return g3(t.runSync(t.parse(n),n),e)},l3=e=>{let t=s3.get(e);if(t)return t;let n=d3(e);return s3.set(e,n),n},u3=e=>e.some(e=>Array.isArray(e)?e[0]===hB:e===hB),d3=e=>{let t=e.rehypePlugins||i3,n=e.remarkPlugins||i3,r=u3(t)?n:[...n,r3],i=e.remarkRehypeOptions?{...a3,...e.remarkRehypeOptions}:a3;return ZD().use(aE).use(r).use(CD,i).use(t)},f3=e=>e,p3=(e,t,n,r)=>{n?e.children.splice(t,1):e.children[t]={type:`text`,value:r}},m3=(e,t)=>{for(let n in OC)if(Object.hasOwn(OC,n)&&Object.hasOwn(e.properties,n)){let r=e.properties[n],i=OC[n];(i===null||i.includes(e.tagName))&&(e.properties[n]=t(String(r||``),n,e)??void 0)}},h3=(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},g3=(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||f3;pD(e,(e,s,c)=>{if(e.type===`raw`&&c&&typeof s==`number`)return p3(c,s,a,e.value),s;if(e.type===`element`&&(m3(e,t),h3(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 oC(e,{Fragment:L.Fragment,components:t.components,ignoreInvalidStyle:!0,jsx:L.jsx,jsxs:L.jsxs,passKeys:!0,passNode:!0})},_3=/\[\^[\w-]{1,200}\](?!:)/,v3=/\[\^[\w-]{1,200}\]:/,y3=/<([A-Za-z][\w:-]*)[\s>/]/,b3=new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`]),x3=new Map,S3=new Map,C3=e=>{let t=e.toLowerCase(),n=x3.get(t);if(n)return n;let r=RegExp(`<${t}(?=[\\s>/])[^>]*>`,`gi`);return x3.set(t,r),r},w3=e=>{let t=e.toLowerCase(),n=S3.get(t);if(n)return n;let r=RegExp(`</${t}(?=[\\s>])[^>]*>`,`gi`);return S3.set(t,r),r},T3=(e,t)=>{if(b3.has(t.toLowerCase()))return 0;let n=e.match(C3(t));if(!n)return 0;let r=0;for(let e of n)e.trimEnd().endsWith(`/>`)||(r+=1);return r},E3=(e,t)=>{let n=e.match(w3(t));return n?n.length:0},D3=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},O3=e=>{let t=_3.test(e),n=v3.test(e);if(t||n)return[e];let r=_0.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=T3(t,e),o=E3(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(y3);if(e){let n=e[1];T3(t,n)>E3(t,n)&&a.push(n)}}if(n>0&&!o){let e=i[n-1];if(D3(e)%2==1){i[n-1]=e+t;continue}}i.push(t),e.type!==`space`&&(o=e.type===`code`)}return i},k3=/^\n*/,A3=/\n*$/,j3=/\n\n/g,M3=(e,t,n)=>t.includes(`
|
|
454
454
|
`)?`${e}${t.replace(j3,`
|
|
@@ -478,7 +478,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
478
478
|
`);n.forEach(function(t,i){var o=r&&d.length+a,s={type:`text`,value:`${t}
|
|
479
479
|
`};if(i===0){var c=g(u.slice(f+1,p).concat(U6({children:[s],className:e.properties.className})),o);d.push(c)}else if(i===n.length-1){var l=u[p+1]&&u[p+1].children&&u[p+1].children[0],m={type:`text`,value:`${t}`};if(l){var h=U6({children:[m],className:e.properties.className});u.splice(p+1,0,h)}else{var _=g([m],o,e.properties.className);d.push(_)}}else{var v=g([s],o,e.properties.className);d.push(v)}}),f=p}p++};p<u.length;)_();if(f!==u.length-1){var v=u.slice(f+1,u.length);if(v&&v.length){var y=g(v,r&&d.length+a);d.push(y)}}return t?d:(l=[]).concat.apply(l,d)}function K6(e){var t=e.rows,n=e.stylesheet,r=e.useInlineStyles;return t.map(function(e,t){return j6({node:e,stylesheet:n,useInlineStyles:r,key:`code-segment-${t}`})})}function q6(e){return e&&e.highlightAuto!==void 0}function J6(e){var t=e.astGenerator,n=e.language,r=e.code,i=e.defaultCodeValue;if(q6(t)){var a=M6(t,n);return n===`text`?{value:i,language:`text`}:a?t.highlight(n,r):t.highlightAuto(r)}try{return n&&n!==`text`?{value:t.highlight(r,n)}:{value:i}}catch{return{value:i}}}function Y6(e,t){return function(n){var r=n.language,i=n.children,a=n.style,o=a===void 0?t:a,s=n.customStyle,c=s===void 0?{}:s,l=n.codeTagProps,u=l===void 0?{className:r?`language-${r}`:void 0,style:F6(F6({},o[`code[class*="language-"]`]),o[`code[class*="language-${r}"]`])}:l,d=n.useInlineStyles,f=d===void 0||d,p=n.showLineNumbers,m=p!==void 0&&p,h=n.showInlineLineNumbers,g=h===void 0||h,v=n.startingLineNumber,y=v===void 0?1:v,b=n.lineNumberContainerStyle,x=n.lineNumberStyle,S=x===void 0?{}:x,C=n.wrapLines,w=n.wrapLongLines,T=w!==void 0&&w,E=n.lineProps,D=E===void 0?{}:E,O=n.renderer,k=n.PreTag,A=k===void 0?`pre`:k,j=n.CodeTag,M=j===void 0?`code`:j,N=n.code,ee=N===void 0?(Array.isArray(i)?i[0]:i)||``:N,te=n.astGenerator,P=d6(n,N6);te||=e;var ne=m?_.createElement(z6,{containerStyle:b,codeStyle:u.style||{},numberStyle:S,startingLineNumber:y,codeString:ee}):null,re=o.hljs||o[`pre[class*="language-"]`]||{backgroundColor:`#fff`},ie=q6(te)?`hljs`:`prismjs`,ae=f?Object.assign({},P,{style:Object.assign({},re,c)}):Object.assign({},P,{className:P.className?`${ie} ${P.className}`:ie,style:Object.assign({},c)});if(u.style=F6(T?{whiteSpace:`pre-wrap`}:{whiteSpace:`pre`},u.style),!te)return _.createElement(A,ae,ne,_.createElement(M,u,ee));(C===void 0&&O||T)&&(C=!0),O||=K6;var oe=[{type:`text`,value:ee}],F=J6({astGenerator:te,language:r,code:ee,defaultCodeValue:oe});F.language===null&&(F.value=oe);var I=y+(ee.match(/\n/g)?.length??0),se=G6(F,C,D,m,g,y,I,S,T);return _.createElement(A,ae,_.createElement(M,u,!g&&ne,O({rows:se,stylesheet:o,useInlineStyles:f})))}}var X6=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),Z6={0:`�`,128:`€`,130:`‚`,131:`ƒ`,132:`„`,133:`…`,134:`†`,135:`‡`,136:`ˆ`,137:`‰`,138:`Š`,139:`‹`,140:`Œ`,142:`Ž`,145:`‘`,146:`’`,147:`“`,148:`”`,149:`•`,150:`–`,151:`—`,152:`˜`,153:`™`,154:`š`,155:`›`,156:`œ`,158:`ž`,159:`Ÿ`};function Q6(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=48&&t<=57}function $6(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}function e8(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}function t8(e){return e8(e)||Q6(e)}var n8=[``,`Named character references must be terminated by a semicolon`,`Numeric character references must be terminated by a semicolon`,`Named character references cannot be empty`,`Numeric character references cannot be empty`,`Named character references must be known`,`Numeric character references cannot be disallowed`,`Numeric character references cannot be outside the permissible Unicode range`];function r8(e,t){let n=t||{},r=typeof n.additional==`string`?n.additional.charCodeAt(0):n.additional,i=[],a=0,o=-1,s=``,c,l;n.position&&(`start`in n.position||`indent`in n.position?(l=n.position.indent,c=n.position.start):c=n.position);let u=(c?c.line:0)||1,d=(c?c.column:0)||1,f=m(),p;for(a--;++a<=e.length;)if(p===10&&(d=(l?l[o]:0)||1),p=e.charCodeAt(a),p===38){let t=e.charCodeAt(a+1);if(t===9||t===10||t===12||t===32||t===38||t===60||Number.isNaN(t)||r&&t===r){s+=String.fromCharCode(p),d++;continue}let o=a+1,c=o,l=o,u;if(t===35){l=++c;let t=e.charCodeAt(l);t===88||t===120?(u=`hexadecimal`,l=++c):u=`decimal`}else u=`named`;let _=``,v=``,y=``,b=u===`named`?t8:u===`decimal`?Q6:$6;for(l--;++l<=e.length;){let t=e.charCodeAt(l);if(!b(t))break;y+=String.fromCharCode(t),u===`named`&&X6.includes(y)&&(_=y,v=FC(y))}let x=e.charCodeAt(l)===59;if(x){l++;let e=u===`named`&&FC(y);e&&(_=y,v=e)}let S=1+l-o,C=``;if(!(!x&&n.nonTerminated===!1)){if(!y)u!==`named`&&h(4,S);else if(u===`named`){if(x&&!v)h(5,1);else if(_!==y&&(l=c+_.length,S=1+l-c,x=!1),!x){let t=_?1:3;if(n.attribute){let n=e.charCodeAt(l);n===61?(h(t,S),v=``):t8(n)?v=``:h(t,S)}else h(t,S)}C=v}else{x||h(2,S);let e=Number.parseInt(y,u===`hexadecimal`?16:10);if(i8(e))h(7,S),C=`�`;else if(e in Z6)h(6,S),C=Z6[e];else{let t=``;a8(e)&&h(6,S),e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10|55296),e=56320|e&1023),C=t+String.fromCharCode(e)}}}if(C){g(),f=m(),a=l-1,d+=l-o+1,i.push(C);let t=m();t.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,C,{start:f,end:t},e.slice(o-1,l)),f=t}else y=e.slice(o-1,l),s+=y,d+=y.length,a=l-1}else p===10&&(u++,o++,d=0),Number.isNaN(p)?g():(s+=String.fromCharCode(p),d++);return i.join(``);function m(){return{line:u,column:d,offset:a+((c?c.offset:0)||0)}}function h(e,t){let r;n.warning&&(r=m(),r.column+=t,r.offset+=t,n.warning.call(n.warningContext||void 0,n8[e],r,e))}function g(){s&&=(i.push(s),n.text&&n.text.call(n.textContext||void 0,s,{start:f,end:m()}),``)}}function i8(e){return e>=55296&&e<=57343||e>1114111}function a8(e){return e>=1&&e<=8||e===11||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(e&65535)==65535||(e&65535)==65534}var o8=0,s8={},c8={util:{type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++o8}),e.__id},clone:function e(t,n){n||={};var r,i;switch(c8.util.type(t)){case`Object`:if(i=c8.util.objId(t),n[i])return n[i];for(var a in r={},n[i]=r,t)t.hasOwnProperty(a)&&(r[a]=e(t[a],n));return r;case`Array`:return i=c8.util.objId(t),n[i]?n[i]:(r=[],n[i]=r,t.forEach(function(t,i){r[i]=e(t,n)}),r);default:return t}}},languages:{plain:s8,plaintext:s8,text:s8,txt:s8,extend:function(e,t){var n=c8.util.clone(c8.languages[e]);for(var r in t)n[r]=t[r];return n},insertBefore:function(e,t,n,r){r||=c8.languages;var i=r[e],a={};for(var o in i)if(i.hasOwnProperty(o)){if(o==t)for(var s in n)n.hasOwnProperty(s)&&(a[s]=n[s]);n.hasOwnProperty(o)||(a[o]=i[o])}var c=r[e];return r[e]=a,c8.languages.DFS(c8.languages,function(t,n){n===c&&t!=e&&(this[t]=a)}),a},DFS:function e(t,n,r,i){i||={};var a=c8.util.objId;for(var o in t)if(t.hasOwnProperty(o)){n.call(t,o,t[o],r||o);var s=t[o],c=c8.util.type(s);c===`Object`&&!i[a(s)]?(i[a(s)]=!0,e(s,n,null,i)):c===`Array`&&!i[a(s)]&&(i[a(s)]=!0,e(s,n,o,i))}}},plugins:{},highlight:function(e,t,n){var r={code:e,grammar:t,language:n};if(c8.hooks.run(`before-tokenize`,r),!r.grammar)throw Error(`The language "`+r.language+`" has no grammar.`);return r.tokens=c8.tokenize(r.code,r.grammar),c8.hooks.run(`after-tokenize`,r),l8.stringify(c8.util.encode(r.tokens),r.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var i=new f8;return p8(i,i.head,e),d8(e,i,t,i.head,0),h8(i)},hooks:{all:{},add:function(e,t){var n=c8.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=c8.hooks.all[e];if(!(!n||!n.length))for(var r=0,i;i=n[r++];)i(t)}},Token:l8};function l8(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=(r||``).length|0}function u8(e,t,n,r){e.lastIndex=t;var i=e.exec(n);if(i&&r&&i[1]){var a=i[1].length;i.index+=a,i[0]=i[0].slice(a)}return i}function d8(e,t,n,r,i,a){for(var o in n)if(!(!n.hasOwnProperty(o)||!n[o])){var s=n[o];s=Array.isArray(s)?s:[s];for(var c=0;c<s.length;++c){if(a&&a.cause==o+`,`+c)return;var l=s[c],u=l.inside,d=!!l.lookbehind,f=!!l.greedy,p=l.alias;if(f&&!l.pattern.global){var m=l.pattern.toString().match(/[imsuy]*$/)[0];l.pattern=RegExp(l.pattern.source,m+`g`)}for(var h=l.pattern||l,g=r.next,_=i;g!==t.tail&&!(a&&_>=a.reach);_+=g.value.length,g=g.next){var v=g.value;if(t.length>e.length)return;if(!(v instanceof l8)){var y=1,b;if(f){if(b=u8(h,_,e,d),!b||b.index>=e.length)break;var x=b.index,S=b.index+b[0].length,C=_;for(C+=g.value.length;x>=C;)g=g.next,C+=g.value.length;if(C-=g.value.length,_=C,g.value instanceof l8)continue;for(var w=g;w!==t.tail&&(C<S||typeof w.value==`string`);w=w.next)y++,C+=w.value.length;y--,v=e.slice(_,C),b.index-=_}else if(b=u8(h,0,v,d),!b)continue;var x=b.index,T=b[0],E=v.slice(0,x),D=v.slice(x+T.length),O=_+v.length;a&&O>a.reach&&(a.reach=O);var k=g.prev;E&&(k=p8(t,k,E),_+=E.length),m8(t,k,y);var A=new l8(o,u?c8.tokenize(T,u):T,p,T);if(g=p8(t,k,A),D&&p8(t,g,D),y>1){var j={cause:o+`,`+c,reach:O};d8(e,t,n,g.prev,_,j),a&&j.reach>a.reach&&(a.reach=j.reach)}}}}}}function f8(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function p8(e,t,n){var r=t.next,i={value:n,prev:t,next:r};return t.next=i,r.prev=i,e.length++,i}function m8(e,t,n){for(var r=t.next,i=0;i<n&&r!==e.tail;i++)r=r.next;t.next=r,r.prev=t,e.length-=i}function h8(e){for(var t=[],n=e.head.next;n!==e.tail;)t.push(n.value),n=n.next;return t}var g8=c8;function _8(){}_8.prototype=g8;var v8=new _8;v8.highlight=y8,v8.register=b8,v8.alias=x8,v8.registered=S8,v8.listLanguages=C8,v8.util.encode=T8,v8.Token.stringify=w8;function y8(e,t){if(typeof e!=`string`)throw TypeError("Expected `string` for `value`, got `"+e+"`");let n,r;if(t&&typeof t==`object`)n=t;else{if(r=t,typeof r!=`string`)throw TypeError("Expected `string` for `name`, got `"+r+"`");if(Object.hasOwn(v8.languages,r))n=v8.languages[r];else throw Error("Unknown language: `"+r+"` is not registered")}return{type:`root`,children:g8.highlight.call(v8,e,n,r)}}function b8(e){if(typeof e!=`function`||!e.displayName)throw Error("Expected `function` for `syntax`, got `"+e+"`");Object.hasOwn(v8.languages,e.displayName)||e(v8)}function x8(e,t){let n=v8.languages,r={};typeof e==`string`?t&&(r[e]=t):r=e;let i;for(i in r)if(Object.hasOwn(r,i)){let e=r[i],t=typeof e==`string`?[e]:e,a=-1;for(;++a<t.length;)n[t[a]]=n[i]}}function S8(e){if(typeof e!=`string`)throw TypeError("Expected `string` for `aliasOrLanguage`, got `"+e+"`");return Object.hasOwn(v8.languages,e)}function C8(){let e=v8.languages,t=[],n;for(n in e)Object.hasOwn(e,n)&&typeof e[n]==`object`&&t.push(n);return t}function w8(e,t){if(typeof e==`string`)return{type:`text`,value:e};if(Array.isArray(e)){let n=[],r=-1;for(;++r<e.length;)e[r]!==null&&e[r]!==void 0&&e[r]!==``&&n.push(w8(e[r],t));return n}let n={attributes:{},classes:[`token`,e.type],content:w8(e.content,t),language:t,tag:`span`,type:e.type};return e.alias&&n.classes.push(...typeof e.alias==`string`?[e.alias]:e.alias),v8.hooks.run(`wrap`,n),PO(n.tag+`.`+n.classes.join(`.`),E8(n.attributes),n.content)}function T8(e){return e}function E8(e){let t;for(t in e)Object.hasOwn(e,t)&&(e[t]=r8(e[t]));return e}var D8=Y6(v8,{});D8.registerLanguage=function(e,t){return v8.register(t)},D8.alias=function(e,t){return v8.alias(e,t)},O8.displayName=`markup`,O8.aliases=[`atom`,`html`,`mathml`,`rss`,`ssml`,`svg`,`xml`];function O8(e){e.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:`attr-equals`},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:`named-entity`},/&#x?[\da-f]{1,8};/i]},e.languages.markup.tag.inside[`attr-value`].inside.entity=e.languages.markup.entity,e.languages.markup.doctype.inside[`internal-subset`].inside=e.languages.markup,e.hooks.add(`wrap`,function(e){e.type===`entity`&&(e.attributes.title=e.content.value.replace(/&/,`&`))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(t,n){var r={};r[`language-`+n]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:e.languages[n]},r.cdata=/^<!\[CDATA\[|\]\]>$/i;var i={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:r}};i[`language-`+n]={pattern:/[\s\S]+/,inside:e.languages[n]};var a={};a[t]={pattern:RegExp(`(<__[^>]*>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[\\s\\S])*?(?=<\\/__>)`.replace(/__/g,function(){return t}),`i`),lookbehind:!0,greedy:!0,inside:i},e.languages.insertBefore(`markup`,`cdata`,a)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(t,n){e.languages.markup.tag.inside[`special-attr`].push({pattern:RegExp(`(^|["'\\s])(?:`+t+`)\\s*=\\s*(?:"[^"]*"|'[^']*'|[^\\s'">=]+(?=[\\s>]))`,`i`),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[n,`language-`+n],inside:e.languages[n]},punctuation:[{pattern:/^=/,alias:`attr-equals`},/"|'/]}}}})}}),e.languages.html=e.languages.markup,e.languages.mathml=e.languages.markup,e.languages.svg=e.languages.markup,e.languages.xml=e.languages.extend(`markup`,{}),e.languages.ssml=e.languages.xml,e.languages.atom=e.languages.xml,e.languages.rss=e.languages.xml}k8.displayName=`css`,k8.aliases=[];function k8(e){(function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp(`@[\\w-](?:[^;{\\s"']|\\s+(?!\\s)|`+t.source+`)*?(?:;|(?=\\s*\\{))`),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:`selector`},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp(`\\burl\\((?:`+t.source+`|(?:[^\\\\\\r\\n()"']|\\\\[\\s\\S])*)\\)`,`i`),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp(`^`+t.source+`$`),alias:`url`}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+t.source+`)*(?=\\s*\\{)`),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined(`style`,`css`),n.tag.addAttribute(`style`,`css`))})(e)}A8.displayName=`clike`,A8.aliases=[];function A8(e){e.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/}}j8.displayName=`javascript`,j8.aliases=[`js`];function j8(e){e.register(A8),e.languages.javascript=e.languages.extend(`clike`,{"class-name":[e.languages.clike[`class-name`],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(`(^|[^\\w$])(?:NaN|Infinity|0[bB][01]+(?:_[01]+)*n?|0[oO][0-7]+(?:_[0-7]+)*n?|0[xX][\\dA-Fa-f]+(?:_[\\dA-Fa-f]+)*n?|\\d+(?:_\\d+)*n|(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:[Ee][+-]?\\d+(?:_\\d+)*)?)(?![\\w$])`),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),e.languages.javascript[`class-name`][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,e.languages.insertBefore(`javascript`,`keyword`,{regex:{pattern:RegExp(`((?:^|[^$\\w\\xA0-\\uFFFF."'\\])\\s]|\\b(?:return|yield))\\s*)\\/(?:(?:\\[(?:[^\\]\\\\\\r\\n]|\\\\.)*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}|(?:\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.)*\\])*\\])*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}v[dgimyus]{0,7})(?=(?:\\s|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/)*(?:$|[\\r\\n,.;:})\\]]|\\/\\/))`),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:`language-regex`,inside:e.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:`function`},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:e.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:e.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:e.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:e.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),e.languages.insertBefore(`javascript`,`string`,{hashbang:{pattern:/^#!.*/,greedy:!0,alias:`comment`},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:`string`},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:`punctuation`},rest:e.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:`property`}}),e.languages.insertBefore(`javascript`,`operator`,{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:`property`}}),e.languages.markup&&(e.languages.markup.tag.addInlined(`script`,`javascript`),e.languages.markup.tag.addAttribute(`on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)`,`javascript`)),e.languages.js=e.languages.javascript}M8.displayName=`sql`,M8.aliases=[];function M8(e){e.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/}}N8.displayName=`c`,N8.aliases=[];function N8(e){e.register(A8),e.languages.c=e.languages.extend(`clike`,{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),e.languages.insertBefore(`c`,`string`,{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),e.languages.insertBefore(`c`,`string`,{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:`property`,inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},e.languages.c.string],char:e.languages.c.char,comment:e.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:`function`}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:`keyword`},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:e.languages.c}}}}),e.languages.insertBefore(`c`,`function`,{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete e.languages.c.boolean}P8.displayName=`cpp`,P8.aliases=[];function P8(e){e.register(N8),(function(e){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,n=`\\b(?!<keyword>)\\w+(?:\\s*\\.\\s*\\w+)*\\b`.replace(/<keyword>/g,function(){return t.source});e.languages.cpp=e.languages.extend(`c`,{"class-name":[{pattern:RegExp(`(\\b(?:class|concept|enum|struct|typename)\\s+)(?!<keyword>)\\w+`.replace(/<keyword>/g,function(){return t.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),e.languages.insertBefore(`cpp`,`string`,{module:{pattern:RegExp(`(\\b(?:import|module)\\s+)(?:"(?:\\\\(?:\\r\\n|[\\s\\S])|[^"\\\\\\r\\n])*"|<[^<>\\r\\n]*>|`+`<mod-name>(?:\\s*:\\s*<mod-name>)?|:\\s*<mod-name>`.replace(/<mod-name>/g,function(){return n})+`)`),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:`string`,greedy:!0}}),e.languages.insertBefore(`cpp`,`keyword`,{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:`class-name`,inside:e.languages.cpp}}}}),e.languages.insertBefore(`cpp`,`operator`,{"double-colon":{pattern:/::/,alias:`punctuation`}}),e.languages.insertBefore(`cpp`,`class-name`,{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend(`cpp`,{})}}),e.languages.insertBefore(`inside`,`double-colon`,{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp[`base-clause`])})(e)}F8.displayName=`bash`,F8.aliases=[`sh`,`shell`];function F8(e){(function(e){var t=`\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b`,n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:`punctuation`,inside:null},r={bash:n,environment:{pattern:RegExp(`\\$`+t),alias:`constant`},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp(`(\\{)`+t),lookbehind:!0,alias:`constant`}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:`important`},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:`function`},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:`function`}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:`variable`,lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp(`(^|[\\s;|&]|[<>]\\()`+t),lookbehind:!0,alias:`constant`}},alias:`variable`,lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:`variable`,lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp(`\\$?`+t),alias:`constant`},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:`class-name`},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:`important`},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:`important`}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=e.languages.bash;for(var i=[`comment`,`function-name`,`for-or-select`,`assign-left`,`parameter`,`string`,`environment`,`function`,`keyword`,`builtin`,`boolean`,`file-descriptor`,`operator`,`punctuation`,`number`],a=r.variable[1].inside,o=0;o<i.length;o++)a[i[o]]=e.languages.bash[i[o]];e.languages.sh=e.languages.bash,e.languages.shell=e.languages.bash})(e)}I8.displayName=`yaml`,I8.aliases=[`yml`];function I8(e){(function(e){var t=/[*&][^\s[\]{},]+/,n=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r=`(?:`+n.source+`(?:[ ]+`+t.source+`)?|`+t.source+`(?:[ ]+`+n.source+`)?)`,i=`(?:[^\\s\\x00-\\x08\\x0e-\\x1f!"#%&'*,\\-:>?@[\\]\`{|}\\x7f-\\x84\\x86-\\x9f\\ud800-\\udfff\\ufffe\\uffff]|[?:-]<PLAIN>)(?:[ \\t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*`.replace(/<PLAIN>/g,function(){return`[^\\s\\x00-\\x08\\x0e-\\x1f,[\\]{}\\x7f-\\x84\\x86-\\x9f\\ud800-\\udfff\\ufffe\\uffff]`}),a=`"(?:[^"\\\\\\r\\n]|\\\\.)*"|'(?:[^'\\\\\\r\\n]|\\\\.)*'`;function o(e,t){t=(t||``).replace(/m/g,``)+`m`;var n=`([:\\-,[{]\\s*(?:\\s<<prop>>[ \\t]+)?)(?:<<value>>)(?=[ \\t]*(?:$|,|\\]|\\}|(?:[\\r\\n]\\s*)?#))`.replace(/<<prop>>/g,function(){return r}).replace(/<<value>>/g,function(){return e});return RegExp(n,t)}e.languages.yaml={scalar:{pattern:RegExp(`([\\-:]\\s*(?:\\s<<prop>>[ \\t]+)?[|>])[ \\t]*(?:((?:\\r?\\n|\\r)[ \\t]+)\\S[^\\r\\n]*(?:\\2[^\\r\\n]+)*)`.replace(/<<prop>>/g,function(){return r})),lookbehind:!0,alias:`string`},comment:/#.*/,key:{pattern:RegExp(`((?:^|[:\\-,[{\\r\\n?])[ \\t]*(?:<<prop>>[ \\t]+)?)<<key>>(?=\\s*:\\s)`.replace(/<<prop>>/g,function(){return r}).replace(/<<key>>/g,function(){return`(?:`+i+`|`+a+`)`})),lookbehind:!0,greedy:!0,alias:`atrule`},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:`important`},datetime:{pattern:o(`\\d{4}-\\d\\d?-\\d\\d?(?:[tT]|[ \\t]+)\\d\\d?:\\d{2}:\\d{2}(?:\\.\\d*)?(?:[ \\t]*(?:Z|[-+]\\d\\d?(?::\\d{2})?))?|\\d{4}-\\d{2}-\\d{2}|\\d\\d?:\\d{2}(?::\\d{2}(?:\\.\\d*)?)?`),lookbehind:!0,alias:`number`},boolean:{pattern:o(`false|true`,`i`),lookbehind:!0,alias:`important`},null:{pattern:o(`null|~`,`i`),lookbehind:!0,alias:`important`},string:{pattern:o(a),lookbehind:!0,greedy:!0},number:{pattern:o(`[+-]?(?:0x[\\da-f]+|0o[0-7]+|(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?|\\.inf|\\.nan)`,`i`),lookbehind:!0},tag:n,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml})(e)}L8.displayName=`markdown`,L8.aliases=[`md`];function L8(e){e.register(O8),(function(e){function t(e){return e=e.replace(/<inner>/g,function(){return`(?:\\\\.|[^\\\\\\n\\r]|(?:\\n|\\r\\n?)(?![\\r\\n]))`}),RegExp(`((?:^|[^\\\\])(?:\\\\{2})*)(?:`+e+`)`)}var n="(?:\\\\.|``(?:[^`\\r\\n]|`(?!`))+``|`[^`\\r\\n]+`|[^\\\\|\\r\\n`])+",r=`\\|?__(?:\\|__)+\\|?(?:(?:\\n|\\r\\n?)|(?![\\s\\S]))`.replace(/__/g,function(){return n}),i=`\\|?[ \\t]*:?-{3,}:?[ \\t]*(?:\\|[ \\t]*:?-{3,}:?[ \\t]*)+\\|?(?:\\n|\\r\\n?)`;e.languages.markdown=e.languages.extend(`markup`,{}),e.languages.insertBefore(`markdown`,`prolog`,{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:[`yaml`,`language-yaml`],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:`punctuation`},table:{pattern:RegExp(`^`+r+i+`(?:`+r+`)*`,`m`),inside:{"table-data-rows":{pattern:RegExp(`^(`+r+i+`)(?:`+r+`)*$`),lookbehind:!0,inside:{"table-data":{pattern:RegExp(n),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp(`^(`+r+`)`+i+`$`),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp(`^`+r+`$`),inside:{"table-header":{pattern:RegExp(n),alias:`important`,inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:`keyword`},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:`important`,inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:`important`,inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:`punctuation`},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:`punctuation`},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:`url`},bold:{pattern:t(`\\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\\b|\\*\\*(?:(?!\\*)<inner>|\\*(?:(?!\\*)<inner>)+\\*)+\\*\\*`),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:t(`\\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\\b|\\*(?:(?!\\*)<inner>|\\*\\*(?:(?!\\*)<inner>)+\\*\\*)+\\*`),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:t(`(~~?)(?:(?!~)<inner>)+\\2`),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:[`code`,`keyword`]},url:{pattern:t(`!?\\[(?:(?!\\])<inner>)+\\](?:\\([^\\s)]+(?:[\\t ]+"(?:\\\\.|[^"\\\\])*")?\\)|[ \\t]?\\[(?:(?!\\])<inner>)+\\])`),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),[`url`,`bold`,`italic`,`strike`].forEach(function(t){[`url`,`bold`,`italic`,`strike`,`code-snippet`].forEach(function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])})}),e.hooks.add(`after-tokenize`,function(e){if(e.language!==`markdown`&&e.language!==`md`)return;function t(e){if(!(!e||typeof e==`string`))for(var n=0,r=e.length;n<r;n++){var i=e[n];if(i.type!==`code`){t(i.content);continue}var a=i.content[1],o=i.content[3];if(a&&o&&a.type===`code-language`&&o.type===`code-block`&&typeof a.content==`string`){var s=a.content.replace(/\b#/g,`sharp`).replace(/\b\+\+/g,`pp`);s=(/[a-z][\w-]*/i.exec(s)||[``])[0].toLowerCase();var c=`language-`+s;o.alias?typeof o.alias==`string`?o.alias=[o.alias,c]:o.alias.push(c):o.alias=[c]}}}t(e.tokens)}),e.hooks.add(`wrap`,function(t){if(t.type===`code-block`){for(var n=``,r=0,i=t.classes.length;r<i;r++){var a=t.classes[r],o=/language-(.+)/.exec(a);if(o){n=o[1];break}}var s=e.languages[n];if(s)t.content=e.highlight(t.content.value,s,n);else if(n&&n!==`none`&&e.plugins.autoloader){var c=`md-`+new Date().valueOf()+`-`+Math.floor(Math.random()*0x2386f26fc10000);t.attributes.id=c,e.plugins.autoloader.loadLanguages(n,function(){var t=document.getElementById(c);t&&(t.innerHTML=e.highlight(t.textContent,e.languages[n],n))})}}}),RegExp(e.languages.markup.tag.pattern.source,`gi`),String.fromCodePoint||String.fromCharCode,e.languages.md=e.languages.markdown})(e)}R8.displayName=`csharp`,R8.aliases=[`cs`,`dotnet`];function R8(e){e.register(A8),(function(e){function t(e,t){return e.replace(/<<(\d+)>>/g,function(e,n){return`(?:`+t[+n]+`)`})}function n(e,n,r){return RegExp(t(e,n),r||``)}function r(e,t){for(var n=0;n<t;n++)e=e.replace(/<<self>>/g,function(){return`(?:`+e+`)`});return e.replace(/<<self>>/g,`[^\\s\\S]`)}var i={type:`bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void`,typeDeclaration:`class enum interface record struct`,contextual:`add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\s*{)`,other:`abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield`};function a(e){return`\\b(?:`+e.trim().replace(/ /g,`|`)+`)\\b`}var o=a(i.typeDeclaration),s=RegExp(a(i.type+` `+i.typeDeclaration+` `+i.contextual+` `+i.other)),c=a(i.typeDeclaration+` `+i.contextual+` `+i.other),l=a(i.type+` `+i.typeDeclaration+` `+i.other),u=r(`<(?:[^<>;=+\\-*/%&|^]|<<self>>)*>`,2),d=r(`\\((?:[^()]|<<self>>)*\\)`,2),f=`@?\\b[A-Za-z_]\\w*\\b`,p=t(`<<0>>(?:\\s*<<1>>)?`,[f,u]),m=t(`(?!<<0>>)<<1>>(?:\\s*\\.\\s*<<1>>)*`,[c,p]),h=`\\[\\s*(?:,\\s*)*\\]`,g=t(`<<0>>(?:\\s*(?:\\?\\s*)?<<1>>)*(?:\\s*\\?)?`,[m,h]),_=t(`(?:<<0>>|<<1>>)(?:\\s*(?:\\?\\s*)?<<2>>)*(?:\\s*\\?)?`,[t(`\\(<<0>>+(?:,<<0>>+)+\\)`,[t(`[^,()<>[\\];=+\\-*/%&|^]|<<0>>|<<1>>|<<2>>`,[u,d,h])]),m,h]),v={keyword:s,punctuation:/[<>()?,.:[\]]/},y=`'(?:[^\\r\\n'\\\\]|\\\\.|\\\\[Uux][\\da-fA-F]{1,8})'`,b=`"(?:\\\\.|[^\\\\"\\r\\n])*"`,x=`@"(?:""|\\\\[\\s\\S]|[^\\\\"])*"(?!")`;e.languages.csharp=e.languages.extend(`clike`,{string:[{pattern:n(`(^|[^$\\\\])<<0>>`,[x]),lookbehind:!0,greedy:!0},{pattern:n(`(^|[^@$\\\\])<<0>>`,[b]),lookbehind:!0,greedy:!0}],"class-name":[{pattern:n(`(\\busing\\s+static\\s+)<<0>>(?=\\s*;)`,[m]),lookbehind:!0,inside:v},{pattern:n(`(\\busing\\s+<<0>>\\s*=\\s*)<<1>>(?=\\s*;)`,[f,_]),lookbehind:!0,inside:v},{pattern:n(`(\\busing\\s+)<<0>>(?=\\s*=)`,[f]),lookbehind:!0},{pattern:n(`(\\b<<0>>\\s+)<<1>>`,[o,p]),lookbehind:!0,inside:v},{pattern:n(`(\\bcatch\\s*\\(\\s*)<<0>>`,[m]),lookbehind:!0,inside:v},{pattern:n(`(\\bwhere\\s+)<<0>>`,[f]),lookbehind:!0},{pattern:n(`(\\b(?:is(?:\\s+not)?|as)\\s+)<<0>>`,[g]),lookbehind:!0,inside:v},{pattern:n(`\\b<<0>>(?=\\s+(?!<<1>>|with\\s*\\{)<<2>>(?:\\s*[=,;:{)\\]]|\\s+(?:in|when)\\b))`,[_,l,f]),inside:v}],keyword:s,number:/(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:[dflmu]|lu|ul)?\b/i,operator:/>>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,punctuation:/\?\.?|::|[{}[\];(),.:]/}),e.languages.insertBefore(`csharp`,`number`,{range:{pattern:/\.\./,alias:`operator`}}),e.languages.insertBefore(`csharp`,`punctuation`,{"named-parameter":{pattern:n(`([(,]\\s*)<<0>>(?=\\s*:)`,[f]),lookbehind:!0,alias:`punctuation`}}),e.languages.insertBefore(`csharp`,`class-name`,{namespace:{pattern:n(`(\\b(?:namespace|using)\\s+)<<0>>(?:\\s*\\.\\s*<<0>>)*(?=\\s*[;{])`,[f]),lookbehind:!0,inside:{punctuation:/\./}},"type-expression":{pattern:n(`(\\b(?:default|sizeof|typeof)\\s*\\(\\s*(?!\\s))(?:[^()\\s]|\\s(?!\\s)|<<0>>)*(?=\\s*\\))`,[d]),lookbehind:!0,alias:`class-name`,inside:v},"return-type":{pattern:n(`<<0>>(?=\\s+(?:<<1>>\\s*(?:=>|[({]|\\.\\s*this\\s*\\[)|this\\s*\\[))`,[_,m]),inside:v,alias:`class-name`},"constructor-invocation":{pattern:n(`(\\bnew\\s+)<<0>>(?=\\s*[[({])`,[_]),lookbehind:!0,inside:v,alias:`class-name`},"generic-method":{pattern:n(`<<0>>\\s*<<1>>(?=\\s*\\()`,[f,u]),inside:{function:n(`^<<0>>`,[f]),generic:{pattern:RegExp(u),alias:`class-name`,inside:v}}},"type-list":{pattern:n(`\\b((?:<<0>>\\s+<<1>>|record\\s+<<1>>\\s*<<5>>|where\\s+<<2>>)\\s*:\\s*)(?:<<3>>|<<4>>|<<1>>\\s*<<5>>|<<6>>)(?:\\s*,\\s*(?:<<3>>|<<4>>|<<6>>))*(?=\\s*(?:where|[{;]|=>|$))`,[o,p,f,_,s.source,d,`\\bnew\\s*\\(\\s*\\)`]),lookbehind:!0,inside:{"record-arguments":{pattern:n(`(^(?!new\\s*\\()<<0>>\\s*)<<1>>`,[p,d]),lookbehind:!0,greedy:!0,inside:e.languages.csharp},keyword:s,"class-name":{pattern:RegExp(_),greedy:!0,inside:v},punctuation:/[,()]/}},preprocessor:{pattern:/(^[\t ]*)#.*/m,lookbehind:!0,alias:`property`,inside:{directive:{pattern:/(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,lookbehind:!0,alias:`keyword`}}}});var S=b+`|`+y,C=t(`\\/(?![*/])|\\/\\/[^\\r\\n]*[\\r\\n]|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/|<<0>>`,[S]),w=r(t(`[^"'/()]|<<0>>|\\(<<self>>*\\)`,[C]),2),T=`\\b(?:assembly|event|field|method|module|param|property|return|type)\\b`,E=t(`<<0>>(?:\\s*\\(<<1>>*\\))?`,[m,w]);e.languages.insertBefore(`csharp`,`class-name`,{attribute:{pattern:n(`((?:^|[^\\s\\w>)?])\\s*\\[\\s*)(?:<<0>>\\s*:\\s*)?<<1>>(?:\\s*,\\s*<<1>>)*(?=\\s*\\])`,[T,E]),lookbehind:!0,greedy:!0,inside:{target:{pattern:n(`^<<0>>(?=\\s*:)`,[T]),alias:`keyword`},"attribute-arguments":{pattern:n(`\\(<<0>>*\\)`,[w]),inside:e.languages.csharp},"class-name":{pattern:RegExp(m),inside:{punctuation:/\./}},punctuation:/[:,]/}}});var D=`:[^}\\r\\n]+`,O=r(t(`[^"'/()]|<<0>>|\\(<<self>>*\\)`,[C]),2),k=t(`\\{(?!\\{)(?:(?![}:])<<0>>)*<<1>>?\\}`,[O,D]),A=r(t(`[^"'/()]|\\/(?!\\*)|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/|<<0>>|\\(<<self>>*\\)`,[S]),2),j=t(`\\{(?!\\{)(?:(?![}:])<<0>>)*<<1>>?\\}`,[A,D]);function M(t,r){return{interpolation:{pattern:n(`((?:^|[^{])(?:\\{\\{)*)<<0>>`,[t]),lookbehind:!0,inside:{"format-string":{pattern:n(`(^\\{(?:(?![}:])<<0>>)*)<<1>>(?=\\}$)`,[r,D]),lookbehind:!0,inside:{punctuation:/^:/}},punctuation:/^\{|\}$/,expression:{pattern:/[\s\S]+/,alias:`language-csharp`,inside:e.languages.csharp}}},string:/[\s\S]+/}}e.languages.insertBefore(`csharp`,`string`,{"interpolation-string":[{pattern:n(`(^|[^\\\\])(?:\\$@|@\\$)"(?:""|\\\\[\\s\\S]|\\{\\{|<<0>>|[^\\\\{"])*"`,[k]),lookbehind:!0,greedy:!0,inside:M(k,O)},{pattern:n(`(^|[^@\\\\])\\$"(?:\\\\.|\\{\\{|<<0>>|[^\\\\"{])*"`,[j]),lookbehind:!0,greedy:!0,inside:M(j,A)}],char:{pattern:RegExp(y),greedy:!0}}),e.languages.dotnet=e.languages.cs=e.languages.csharp})(e)}z8.displayName=`diff`,z8.aliases=[];function z8(e){(function(e){e.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var t={"deleted-sign":`-`,"deleted-arrow":`<`,"inserted-sign":`+`,"inserted-arrow":`>`,unchanged:` `,diff:`!`};Object.keys(t).forEach(function(n){var r=t[n],i=[];/^\w+$/.test(n)||i.push(/\w+/.exec(n)[0]),n===`diff`&&i.push(`bold`),e.languages.diff[n]={pattern:RegExp(`^(?:[`+r+`].*(?:\r
|
|
480
480
|
?|
|
|
481
|
-
|(?![\\s\\S])))+`,`m`),alias:i,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}}}),Object.defineProperty(e.languages.diff,"PREFIXES",{value:t})})(e)}B8.displayName=`docker`,B8.aliases=[`dockerfile`];function B8(e){(function(e){var t=`(?:[ \\t]+(?![ \\t])(?:<SP_BS>)?|<SP_BS>)`.replace(/<SP_BS>/g,function(){return`\\\\[\\r\\n](?:\\s|\\\\[\\r\\n]|#.*(?!.))*(?![\\s#]|\\\\[\\r\\n])`}),n=`"(?:[^"\\\\\\r\\n]|\\\\(?:\\r\\n|[\\s\\S]))*"|'(?:[^'\\\\\\r\\n]|\\\\(?:\\r\\n|[\\s\\S]))*'`,r=`--[\\w-]+=(?:<STR>|(?!["'])(?:[^\\s\\\\]|\\\\.)+)`.replace(/<STR>/g,function(){return n}),i={pattern:RegExp(n),greedy:!0},a={pattern:/(^[ \t]*)#.*/m,lookbehind:!0,greedy:!0};function o(e,n){return e=e.replace(/<OPT>/g,function(){return r}).replace(/<SP>/g,function(){return t}),RegExp(e,n)}e.languages.docker={instruction:{pattern:/(^[ \t]*)(?:ADD|ARG|CMD|COPY|ENTRYPOINT|ENV|EXPOSE|FROM|HEALTHCHECK|LABEL|MAINTAINER|ONBUILD|RUN|SHELL|STOPSIGNAL|USER|VOLUME|WORKDIR)(?=\s)(?:\\.|[^\r\n\\])*(?:\\$(?:\s|#.*$)*(?![\s#])(?:\\.|[^\r\n\\])*)*/im,lookbehind:!0,greedy:!0,inside:{options:{pattern:o(`(^(?:ONBUILD<SP>)?\\w+<SP>)<OPT>(?:<SP><OPT>)*`,`i`),lookbehind:!0,greedy:!0,inside:{property:{pattern:/(^|\s)--[\w-]+/,lookbehind:!0},string:[i,{pattern:/(=)(?!["'])(?:[^\s\\]|\\.)+/,lookbehind:!0}],operator:/\\$/m,punctuation:/=/}},keyword:[{pattern:o(`(^(?:ONBUILD<SP>)?HEALTHCHECK<SP>(?:<OPT><SP>)*)(?:CMD|NONE)\\b`,`i`),lookbehind:!0,greedy:!0},{pattern:o(`(^(?:ONBUILD<SP>)?FROM<SP>(?:<OPT><SP>)*(?!--)[^ \\t\\\\]+<SP>)AS`,`i`),lookbehind:!0,greedy:!0},{pattern:o(`(^ONBUILD<SP>)\\w+`,`i`),lookbehind:!0,greedy:!0},{pattern:/^\w+/,greedy:!0}],comment:a,string:i,variable:/\$(?:\w+|\{[^{}"'\\]*\})/,operator:/\\$/m}},comment:a},e.languages.dockerfile=e.languages.docker})(e)}V8.displayName=`go`,V8.aliases=[];function V8(e){e.register(A8),e.languages.go=e.languages.extend(`clike`,{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),e.languages.insertBefore(`go`,`string`,{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete e.languages.go[`class-name`]}H8.displayName=`scss`,H8.aliases=[];function H8(e){e.register(k8),e.languages.scss=e.languages.extend(`css`,{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:`important`},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),e.languages.insertBefore(`scss`,`atrule`,{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),e.languages.insertBefore(`scss`,`important`,{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),e.languages.insertBefore(`scss`,`function`,{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:`keyword`},placeholder:{pattern:/%[-\w]+/,alias:`selector`},statement:{pattern:/\B!(?:default|optional)\b/i,alias:`keyword`},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:`keyword`},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),e.languages.scss.atrule.inside.rest=e.languages.scss}U8.displayName=`json`,U8.aliases=[`webmanifest`];function U8(e){e.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:`keyword`}},e.languages.webmanifest=e.languages.json}W8.displayName=`java`,W8.aliases=[];function W8(e){e.register(A8),(function(e){var t=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,n=`(?:[a-z]\\w*\\s*\\.\\s*)*(?:[A-Z]\\w*\\s*\\.\\s*)*`,r={pattern:RegExp(`(^|[^\\w.])`+n+`[A-Z](?:[\\d_A-Z]*[a-z]\\w*)?\\b`),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};e.languages.java=e.languages.extend(`clike`,{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[r,{pattern:RegExp(`(^|[^\\w.])`+n+`[A-Z]\\w*(?=\\s+\\w+\\s*[;,=()]|\\s*(?:\\[[\\s,]*\\]\\s*)?::\\s*new\\b)`),lookbehind:!0,inside:r.inside},{pattern:RegExp(`(\\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\\s+)`+n+`[A-Z]\\w*\\b`),lookbehind:!0,inside:r.inside}],keyword:t,function:[e.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),e.languages.insertBefore(`java`,`string`,{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:`string`},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),e.languages.insertBefore(`java`,`class-name`,{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:`punctuation`},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":r,keyword:t,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(`(\\bimport\\s+)`+n+`(?:[A-Z]\\w*|\\*)(?=\\s*;)`),lookbehind:!0,inside:{namespace:r.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(`(\\bimport\\s+static\\s+)`+n+`(?:\\w+|\\*)(?=\\s*;)`),lookbehind:!0,alias:`static`,inside:{namespace:r.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(`(\\b(?:exports|import(?:\\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\\s+)(?!<keyword>)[a-z]\\w*(?:\\.[a-z]\\w*)*\\.?`.replace(/<keyword>/g,function(){return t.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(e)}G8.displayName=`typescript`,G8.aliases=[`ts`];function G8(e){e.register(j8),(function(e){e.languages.typescript=e.languages.extend(`javascript`,{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript[`literal-property`];var t=e.languages.extend(`typescript`,{});delete t[`class-name`],e.languages.typescript[`class-name`].inside=t,e.languages.insertBefore(`typescript`,`function`,{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:`operator`},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:`class-name`,inside:t}}}}),e.languages.ts=e.languages.typescript})(e)}K8.displayName=`python`,K8.aliases=[`py`];function K8(e){e.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:`punctuation`},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:`string`},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:[`annotation`,`punctuation`],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},e.languages.python[`string-interpolation`].inside.interpolation.inside.rest=e.languages.python,e.languages.py=e.languages.python}q8.displayName=`jsx`,q8.aliases=[];function q8(e){e.register(j8),e.register(O8),(function(e){var t=e.util.clone(e.languages.javascript),n=`(?:\\s|\\/\\/.*(?!.)|\\/\\*(?:[^*]|\\*(?!\\/))\\*\\/)`,r=`(?:\\{(?:\\{(?:\\{[^{}]*\\}|[^{}])*\\}|[^{}])*\\})`,i=`(?:\\{<S>*\\.{3}(?:[^{}]|<BRACES>)*\\})`;function a(e,t){return e=e.replace(/<S>/g,function(){return n}).replace(/<BRACES>/g,function(){return r}).replace(/<SPREAD>/g,function(){return i}),RegExp(e,t)}i=a(i).source,e.languages.jsx=e.languages.extend(`markup`,t),e.languages.jsx.tag.pattern=a(`<\\/?(?:[\\w.:-]+(?:<S>+(?:[\\w.:$-]+(?:=(?:"(?:\\\\[\\s\\S]|[^\\\\"])*"|'(?:\\\\[\\s\\S]|[^\\\\'])*'|[^\\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\\/?)?>`),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside[`attr-value`].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside[`class-name`]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore(`inside`,`attr-name`,{spread:{pattern:a(`<SPREAD>`),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore(`inside`,`special-attr`,{script:{pattern:a(`=<BRACES>`),alias:`language-javascript`,inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:`punctuation`},rest:e.languages.jsx}}},e.languages.jsx.tag);var o=function(e){return e?typeof e==`string`?e:typeof e.content==`string`?e.content:e.content.map(o).join(``):``},s=function(t){for(var n=[],r=0;r<t.length;r++){var i=t[r],a=!1;if(typeof i!=`string`&&(i.type===`tag`&&i.content[0]&&i.content[0].type===`tag`?i.content[0].content[0].content===`</`?n.length>0&&n[n.length-1].tagName===o(i.content[0].content[1])&&n.pop():i.content[i.content.length-1].content===`/>`||n.push({tagName:o(i.content[0].content[1]),openedBraces:0}):n.length>0&&i.type===`punctuation`&&i.content===`{`?n[n.length-1].openedBraces++:n.length>0&&n[n.length-1].openedBraces>0&&i.type===`punctuation`&&i.content===`}`?n[n.length-1].openedBraces--:a=!0),(a||typeof i==`string`)&&n.length>0&&n[n.length-1].openedBraces===0){var c=o(i);r<t.length-1&&(typeof t[r+1]==`string`||t[r+1].type===`plain-text`)&&(c+=o(t[r+1]),t.splice(r+1,1)),r>0&&(typeof t[r-1]==`string`||t[r-1].type===`plain-text`)&&(c=o(t[r-1])+c,t.splice(r-1,1),r--),t[r]=new e.Token(`plain-text`,c,null,c)}i.content&&typeof i.content!=`string`&&s(i.content)}};e.hooks.add(`after-tokenize`,function(e){(e.language===`jsx`||e.language===`tsx`)&&s(e.tokens)})})(e)}J8.displayName=`tsx`,J8.aliases=[];function J8(e){e.register(q8),e.register(G8),(function(e){var t=e.util.clone(e.languages.typescript);e.languages.tsx=e.languages.extend(`jsx`,t),delete e.languages.tsx.parameter,delete e.languages.tsx[`literal-property`];var n=e.languages.tsx.tag;n.pattern=RegExp(`(^|[^\\w$]|(?=<\\/))(?:`+n.pattern.source+`)`,n.pattern.flags),n.lookbehind=!0})(e)}Y8.displayName=`rust`,Y8.aliases=[];function Y8(e){(function(e){for(var t=`\\/\\*(?:[^*/]|\\*(?!\\/)|\\/(?!\\*)|<self>)*\\*\\/`,n=0;n<2;n++)t=t.replace(/<self>/g,function(){return t});t=t.replace(/<self>/g,function(){return`[^\\s\\S]`}),e.languages.rust={comment:[{pattern:RegExp(`(^|[^\\\\])`+t),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:`attr-name`,inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:`punctuation`},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:`symbol`},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:`punctuation`},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:`function`},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:`class-name`},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:`namespace`},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:`namespace`,inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:`property`},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},e.languages.rust[`closure-params`].inside.rest=e.languages.rust,e.languages.rust.attribute.inside.string=e.languages.rust.string})(e)}var X8=F8,Z8=N8,Q8=P8,$8=R8,e5=k8,t5=z8,n5=B8,r5=V8,i5=W8,a5=j8,o5=U8,s5=q8,c5=L8,l5=O8,u5=K8,d5=Y8,f5=H8,p5=M8,m5=J8,h5=G8,g5=I8,_5={'code[class*="language-"]':{color:`#393A34`,fontFamily:`"Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace`,direction:`ltr`,textAlign:`left`,whiteSpace:`pre`,wordSpacing:`normal`,wordBreak:`normal`,fontSize:`.9em`,lineHeight:`1.2em`,MozTabSize:`4`,OTabSize:`4`,tabSize:`4`,WebkitHyphens:`none`,MozHyphens:`none`,msHyphens:`none`,hyphens:`none`},'pre[class*="language-"]':{color:`#393A34`,fontFamily:`"Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace`,direction:`ltr`,textAlign:`left`,whiteSpace:`pre`,wordSpacing:`normal`,wordBreak:`normal`,fontSize:`.9em`,lineHeight:`1.2em`,MozTabSize:`4`,OTabSize:`4`,tabSize:`4`,WebkitHyphens:`none`,MozHyphens:`none`,msHyphens:`none`,hyphens:`none`,padding:`1em`,margin:`.5em 0`,overflow:`auto`,border:`1px solid #dddddd`,backgroundColor:`white`},'pre > code[class*="language-"]':{fontSize:`1em`},'pre[class*="language-"]::-moz-selection':{background:`#C1DEF1`},'pre[class*="language-"] ::-moz-selection':{background:`#C1DEF1`},'code[class*="language-"]::-moz-selection':{background:`#C1DEF1`},'code[class*="language-"] ::-moz-selection':{background:`#C1DEF1`},'pre[class*="language-"]::selection':{background:`#C1DEF1`},'pre[class*="language-"] ::selection':{background:`#C1DEF1`},'code[class*="language-"]::selection':{background:`#C1DEF1`},'code[class*="language-"] ::selection':{background:`#C1DEF1`},':not(pre) > code[class*="language-"]':{padding:`.2em`,paddingTop:`1px`,paddingBottom:`1px`,background:`#f8f8f8`,border:`1px solid #dddddd`},comment:{color:`#008000`,fontStyle:`italic`},prolog:{color:`#008000`,fontStyle:`italic`},doctype:{color:`#008000`,fontStyle:`italic`},cdata:{color:`#008000`,fontStyle:`italic`},namespace:{Opacity:`.7`},string:{color:`#A31515`},punctuation:{color:`#393A34`},operator:{color:`#393A34`},url:{color:`#36acaa`},symbol:{color:`#36acaa`},number:{color:`#36acaa`},boolean:{color:`#36acaa`},variable:{color:`#36acaa`},constant:{color:`#36acaa`},inserted:{color:`#36acaa`},atrule:{color:`#0000ff`},keyword:{color:`#0000ff`},"attr-value":{color:`#0000ff`},".language-autohotkey .token.selector":{color:`#0000ff`},".language-json .token.boolean":{color:`#0000ff`},".language-json .token.number":{color:`#0000ff`},'code[class*="language-css"]':{color:`#0000ff`},function:{color:`#393A34`},deleted:{color:`#9a050f`},".language-autohotkey .token.tag":{color:`#9a050f`},selector:{color:`#800000`},".language-autohotkey .token.keyword":{color:`#00009f`},important:{color:`#e90`,fontWeight:`bold`},bold:{fontWeight:`bold`},italic:{fontStyle:`italic`},"class-name":{color:`#2B91AF`},".language-json .token.property":{color:`#2B91AF`},tag:{color:`#800000`},"attr-name":{color:`#ff0000`},property:{color:`#ff0000`},regex:{color:`#ff0000`},entity:{color:`#ff0000`},"directive.tag.tag":{background:`#ffff00`,color:`#393A34`},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:`#a5a5a5`},".line-numbers .line-numbers-rows > span:before":{color:`#2B91AF`},".line-highlight.line-highlight":{background:`linear-gradient(to right, rgba(193, 222, 241, 0.2) 70%, rgba(221, 222, 241, 0))`}},v5={'pre[class*="language-"]':{color:`#d4d4d4`,fontSize:`13px`,textShadow:`none`,fontFamily:`Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace`,direction:`ltr`,textAlign:`left`,whiteSpace:`pre`,wordSpacing:`normal`,wordBreak:`normal`,lineHeight:`1.5`,MozTabSize:`4`,OTabSize:`4`,tabSize:`4`,WebkitHyphens:`none`,MozHyphens:`none`,msHyphens:`none`,hyphens:`none`,padding:`1em`,margin:`.5em 0`,overflow:`auto`,background:`#1e1e1e`},'code[class*="language-"]':{color:`#d4d4d4`,fontSize:`13px`,textShadow:`none`,fontFamily:`Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace`,direction:`ltr`,textAlign:`left`,whiteSpace:`pre`,wordSpacing:`normal`,wordBreak:`normal`,lineHeight:`1.5`,MozTabSize:`4`,OTabSize:`4`,tabSize:`4`,WebkitHyphens:`none`,MozHyphens:`none`,msHyphens:`none`,hyphens:`none`},'pre[class*="language-"]::selection':{textShadow:`none`,background:`#264F78`},'code[class*="language-"]::selection':{textShadow:`none`,background:`#264F78`},'pre[class*="language-"] *::selection':{textShadow:`none`,background:`#264F78`},'code[class*="language-"] *::selection':{textShadow:`none`,background:`#264F78`},':not(pre) > code[class*="language-"]':{padding:`.1em .3em`,borderRadius:`.3em`,color:`#db4c69`,background:`#1e1e1e`},".namespace":{Opacity:`.7`},"doctype.doctype-tag":{color:`#569CD6`},"doctype.name":{color:`#9cdcfe`},comment:{color:`#6a9955`},prolog:{color:`#6a9955`},punctuation:{color:`#d4d4d4`},".language-html .language-css .token.punctuation":{color:`#d4d4d4`},".language-html .language-javascript .token.punctuation":{color:`#d4d4d4`},property:{color:`#9cdcfe`},tag:{color:`#569cd6`},boolean:{color:`#569cd6`},number:{color:`#b5cea8`},constant:{color:`#9cdcfe`},symbol:{color:`#b5cea8`},inserted:{color:`#b5cea8`},unit:{color:`#b5cea8`},selector:{color:`#d7ba7d`},"attr-name":{color:`#9cdcfe`},string:{color:`#ce9178`},char:{color:`#ce9178`},builtin:{color:`#ce9178`},deleted:{color:`#ce9178`},".language-css .token.string.url":{textDecoration:`underline`},operator:{color:`#d4d4d4`},entity:{color:`#569cd6`},"operator.arrow":{color:`#569CD6`},atrule:{color:`#ce9178`},"atrule.rule":{color:`#c586c0`},"atrule.url":{color:`#9cdcfe`},"atrule.url.function":{color:`#dcdcaa`},"atrule.url.punctuation":{color:`#d4d4d4`},keyword:{color:`#569CD6`},"keyword.module":{color:`#c586c0`},"keyword.control-flow":{color:`#c586c0`},function:{color:`#dcdcaa`},"function.maybe-class-name":{color:`#dcdcaa`},regex:{color:`#d16969`},important:{color:`#569cd6`},italic:{fontStyle:`italic`},"class-name":{color:`#4ec9b0`},"maybe-class-name":{color:`#4ec9b0`},console:{color:`#9cdcfe`},parameter:{color:`#9cdcfe`},interpolation:{color:`#9cdcfe`},"punctuation.interpolation-punctuation":{color:`#569cd6`},variable:{color:`#9cdcfe`},"imports.maybe-class-name":{color:`#9cdcfe`},"exports.maybe-class-name":{color:`#9cdcfe`},escape:{color:`#d7ba7d`},"tag.punctuation":{color:`#808080`},cdata:{color:`#808080`},"attr-value":{color:`#ce9178`},"attr-value.punctuation":{color:`#ce9178`},"attr-value.punctuation.attr-equals":{color:`#d4d4d4`},namespace:{color:`#4ec9b0`},'pre[class*="language-javascript"]':{color:`#9cdcfe`},'code[class*="language-javascript"]':{color:`#9cdcfe`},'pre[class*="language-jsx"]':{color:`#9cdcfe`},'code[class*="language-jsx"]':{color:`#9cdcfe`},'pre[class*="language-typescript"]':{color:`#9cdcfe`},'code[class*="language-typescript"]':{color:`#9cdcfe`},'pre[class*="language-tsx"]':{color:`#9cdcfe`},'code[class*="language-tsx"]':{color:`#9cdcfe`},'pre[class*="language-css"]':{color:`#ce9178`},'code[class*="language-css"]':{color:`#ce9178`},'pre[class*="language-html"]':{color:`#d4d4d4`},'code[class*="language-html"]':{color:`#d4d4d4`},".language-regex .token.anchor":{color:`#dcdcaa`},".language-html .token.punctuation":{color:`#808080`},'pre[class*="language-"] > code[class*="language-"]':{position:`relative`,zIndex:`1`},".line-highlight.line-highlight":{background:`#f7ebc6`,boxShadow:`inset 5px 0 0 #f7d87c`,zIndex:`0`}},y5={bash:X8,c:Z8,cpp:Q8,csharp:$8,css:e5,diff:t5,docker:n5,go:r5,java:i5,javascript:a5,json:o5,jsx:s5,markdown:c5,markup:l5,python:u5,rust:d5,scss:f5,sql:p5,tsx:m5,typescript:h5,yaml:g5};for(let[e,t]of Object.entries(y5))D8.registerLanguage(e,t);var b5=.25,x5=.5,S5=3;function C5({code:e,isStreaming:t,defaultPreview:n=!1}){let{isDark:r}=WK(),{t:i}=R(),[a,o]=(0,_.useState)(n),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(!1),d=`${r?`dark`:`light`}\n${e}`,f=a&&!t;(0,_.useEffect)(()=>{if(!f)return;let t=!1;return c({key:d,status:`loading`}),(async()=>{let{default:n}=await D0(async()=>{let{default:e}=await import(`./mermaid.core-aY_IlyaS.js`);return{default:e}},__vite__mapDeps([2,3,4,5,1,6,7,8,9,10,11,12,13,14,15,16,17,18,19]));if(n.initialize({startOnLoad:!1,securityLevel:`strict`,suppressErrorRendering:!0,theme:r?`dark`:`default`}),!await n.parse(e,{suppressErrors:!0}))throw Error(`Invalid Mermaid diagram`);let i=typeof crypto<`u`&&`randomUUID`in crypto?`mermaid-${crypto.randomUUID()}`:`mermaid-${Date.now()}-${Math.random().toString(36).slice(2)}`,a=await n.render(i,e);t||c({key:d,status:`ready`,svg:a.svg})})().catch(()=>{t||c({key:d,status:`error`})}),()=>{t=!0}},[e,d,r,f]);let p=(0,L.jsx)(`button`,{type:`button`,onClick:()=>o(e=>!e),disabled:t,title:i(t?`i18n.previewAfterStreaming`:f?`i18n.showMermaidSource`:`i18n.previewMermaid`),className:[`markdown-code-action`,f?`is-active`:``].filter(Boolean).join(` `),children:i(f?`i18n.source`:`i18n.preview`)});if(!f)return(0,L.jsx)(D5,{code:e,lang:`mermaid`,headerAction:p});let m=s?.key===d&&s.status===`error`?(0,L.jsx)(`div`,{className:`mermaid-block mermaid-block-error`,children:i(`i18n.invalidMermaid`)}):s?.key!==d||s.status!==`ready`?(0,L.jsx)(`div`,{className:`mermaid-block mermaid-block-loading`,"aria-label":i(`i18n.renderingMermaid`)}):(0,L.jsxs)(L.Fragment,{children:[!l&&(0,L.jsx)(`button`,{type:`button`,className:`mermaid-block mermaid-preview-button`,title:i(`i18n.openMermaidViewer`),"aria-label":i(`i18n.openMermaidViewer`),onClick:()=>u(!0),dangerouslySetInnerHTML:{__html:s.svg}}),l&&(0,L.jsx)(w5,{svg:s.svg,onClose:()=>u(!1)})]});return(0,L.jsxs)(`div`,{className:`markdown-code-block`,children:[(0,L.jsxs)(`div`,{className:`markdown-code-header`,children:[(0,L.jsx)(`span`,{className:`markdown-code-lang`,children:`mermaid`}),p]}),m]})}function w5({svg:e,onClose:t}){let{t:n}=R(),r=(0,_.useRef)(null),[i,a]=(0,_.useState)(1);return(0,_.useEffect)(()=>{let e=r.current;if(!e)return;let t=document.body.style.overflow;return document.body.style.overflow=`hidden`,e.showModal(),()=>{document.body.style.overflow=t,e.open&&e.close()}},[]),(0,L.jsx)(`dialog`,{ref:r,className:`mermaid-zoom-dialog`,"aria-label":n(`i18n.mermaidViewer`),onCancel:e=>{e.preventDefault(),t()},onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),t())},children:(0,L.jsxs)(`div`,{className:`mermaid-zoom-layout`,children:[(0,L.jsxs)(`div`,{className:`mermaid-zoom-toolbar`,children:[(0,L.jsx)(`span`,{className:`mermaid-zoom-title`,children:n(`i18n.mermaidDiagram`)}),(0,L.jsxs)(`div`,{className:`mermaid-zoom-actions`,children:[(0,L.jsxs)(`div`,{className:`mermaid-zoom-stepper`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:()=>a(e=>Math.max(x5,e-b5)),disabled:i<=x5,title:n(`i18n.zoomOut`),"aria-label":n(`i18n.zoomOut`),children:(0,L.jsx)(`svg`,{width:z.lg,height:z.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`M5 12h14`})})}),(0,L.jsxs)(`span`,{className:`mermaid-zoom-value`,children:[Math.round(i*100),`%`]}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>a(e=>Math.min(S5,e+b5)),disabled:i>=S5,title:n(`i18n.zoomIn`),"aria-label":n(`i18n.zoomIn`),children:(0,L.jsx)(`svg`,{width:z.lg,height:z.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`M12 5v14M5 12h14`})})})]}),(0,L.jsx)(`button`,{type:`button`,className:`mermaid-zoom-icon-button`,onClick:()=>a(1),title:n(`i18n.fitToWidth`),"aria-label":n(`i18n.fitToWidth`),children:(0,L.jsx)(`svg`,{width:z.lg,height:z.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`M8 3H3v5M16 3h5v5M8 21H3v-5M16 21h5v-5`})})}),(0,L.jsx)(`button`,{type:`button`,className:`mermaid-zoom-icon-button`,onClick:t,title:n(`i18n.close`),"aria-label":n(`i18n.close`),children:(0,L.jsx)(`svg`,{width:z.lg,height:z.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`M6 6l12 12M18 6 6 18`})})})]})]}),(0,L.jsx)(`div`,{className:`mermaid-zoom-viewport`,onClick:e=>{e.target===e.currentTarget&&t()},children:(0,L.jsx)(`div`,{className:`mermaid-zoom-canvas`,style:{width:`${i*100}%`},dangerouslySetInnerHTML:{__html:e}})})]})})}var T5=5e3,E5=800;function D5({code:e,lang:t,headerAction:n,isStreaming:r}){let{isDark:i}=WK(),{t:a}=R(),[o,s]=(0,_.useState)(!1),c=()=>{bK(e).then(()=>{s(!0),setTimeout(()=>s(!1),1500)})},l=e.length>T5||r===!0&&e.length>E5;return(0,L.jsxs)(`div`,{className:`markdown-code-block`,children:[(0,L.jsxs)(`div`,{className:`markdown-code-header`,children:[(0,L.jsx)(`span`,{className:`markdown-code-lang`,children:t||`text`}),(0,L.jsxs)(`div`,{className:`markdown-code-actions`,children:[n,(0,L.jsx)(`button`,{onClick:c,className:`markdown-code-action`,children:a(o?`i18n.copied`:`i18n.copy`)})]})]}),l?(0,L.jsx)(`pre`,{className:`markdown-code-plain`,style:{margin:0,padding:`11px 13px`,fontSize:`var(--text-md)`,lineHeight:1.62,borderRadius:0,background:`color-mix(in srgb, var(--bg) 92%, var(--bg-panel))`,overflow:`auto`},children:(0,L.jsx)(`code`,{style:{fontFamily:`var(--font-mono)`},children:e})}):(0,L.jsx)(D8,{language:t||`text`,style:i?v5:_5,showLineNumbers:!0,lineNumberStyle:{color:`var(--text-dim)`,fontStyle:`normal`},customStyle:{margin:0,padding:`11px 13px`,fontSize:`var(--text-md)`,lineHeight:1.62,borderRadius:0,background:`color-mix(in srgb, var(--bg) 92%, var(--bg-panel))`},codeTagProps:{style:{fontFamily:`var(--font-mono)`}},children:e})]})}function O5({children:e,className:t,isStreaming:n,cwd:r,onOpenFile:i}){let{t:a}=R(),[o,s]=(0,_.useState)(!1),c=!o&&e.length>1e5,l=(0,_.useMemo)(()=>c?l6(e):e,[c,e]),u=(0,_.useMemo)(()=>JU(l),[l]),d=(0,_.useMemo)(()=>({code({className:e,children:t,...r}){let i=e?.replace(`language-`,``).toLowerCase()??``,a=String(t);return e?.includes(`language-`)||a.includes(`
|
|
481
|
+
|(?![\\s\\S])))+`,`m`),alias:i,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}}}),Object.defineProperty(e.languages.diff,"PREFIXES",{value:t})})(e)}B8.displayName=`docker`,B8.aliases=[`dockerfile`];function B8(e){(function(e){var t=`(?:[ \\t]+(?![ \\t])(?:<SP_BS>)?|<SP_BS>)`.replace(/<SP_BS>/g,function(){return`\\\\[\\r\\n](?:\\s|\\\\[\\r\\n]|#.*(?!.))*(?![\\s#]|\\\\[\\r\\n])`}),n=`"(?:[^"\\\\\\r\\n]|\\\\(?:\\r\\n|[\\s\\S]))*"|'(?:[^'\\\\\\r\\n]|\\\\(?:\\r\\n|[\\s\\S]))*'`,r=`--[\\w-]+=(?:<STR>|(?!["'])(?:[^\\s\\\\]|\\\\.)+)`.replace(/<STR>/g,function(){return n}),i={pattern:RegExp(n),greedy:!0},a={pattern:/(^[ \t]*)#.*/m,lookbehind:!0,greedy:!0};function o(e,n){return e=e.replace(/<OPT>/g,function(){return r}).replace(/<SP>/g,function(){return t}),RegExp(e,n)}e.languages.docker={instruction:{pattern:/(^[ \t]*)(?:ADD|ARG|CMD|COPY|ENTRYPOINT|ENV|EXPOSE|FROM|HEALTHCHECK|LABEL|MAINTAINER|ONBUILD|RUN|SHELL|STOPSIGNAL|USER|VOLUME|WORKDIR)(?=\s)(?:\\.|[^\r\n\\])*(?:\\$(?:\s|#.*$)*(?![\s#])(?:\\.|[^\r\n\\])*)*/im,lookbehind:!0,greedy:!0,inside:{options:{pattern:o(`(^(?:ONBUILD<SP>)?\\w+<SP>)<OPT>(?:<SP><OPT>)*`,`i`),lookbehind:!0,greedy:!0,inside:{property:{pattern:/(^|\s)--[\w-]+/,lookbehind:!0},string:[i,{pattern:/(=)(?!["'])(?:[^\s\\]|\\.)+/,lookbehind:!0}],operator:/\\$/m,punctuation:/=/}},keyword:[{pattern:o(`(^(?:ONBUILD<SP>)?HEALTHCHECK<SP>(?:<OPT><SP>)*)(?:CMD|NONE)\\b`,`i`),lookbehind:!0,greedy:!0},{pattern:o(`(^(?:ONBUILD<SP>)?FROM<SP>(?:<OPT><SP>)*(?!--)[^ \\t\\\\]+<SP>)AS`,`i`),lookbehind:!0,greedy:!0},{pattern:o(`(^ONBUILD<SP>)\\w+`,`i`),lookbehind:!0,greedy:!0},{pattern:/^\w+/,greedy:!0}],comment:a,string:i,variable:/\$(?:\w+|\{[^{}"'\\]*\})/,operator:/\\$/m}},comment:a},e.languages.dockerfile=e.languages.docker})(e)}V8.displayName=`go`,V8.aliases=[];function V8(e){e.register(A8),e.languages.go=e.languages.extend(`clike`,{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),e.languages.insertBefore(`go`,`string`,{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete e.languages.go[`class-name`]}H8.displayName=`scss`,H8.aliases=[];function H8(e){e.register(k8),e.languages.scss=e.languages.extend(`css`,{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:`important`},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),e.languages.insertBefore(`scss`,`atrule`,{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),e.languages.insertBefore(`scss`,`important`,{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),e.languages.insertBefore(`scss`,`function`,{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:`keyword`},placeholder:{pattern:/%[-\w]+/,alias:`selector`},statement:{pattern:/\B!(?:default|optional)\b/i,alias:`keyword`},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:`keyword`},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),e.languages.scss.atrule.inside.rest=e.languages.scss}U8.displayName=`json`,U8.aliases=[`webmanifest`];function U8(e){e.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:`keyword`}},e.languages.webmanifest=e.languages.json}W8.displayName=`java`,W8.aliases=[];function W8(e){e.register(A8),(function(e){var t=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,n=`(?:[a-z]\\w*\\s*\\.\\s*)*(?:[A-Z]\\w*\\s*\\.\\s*)*`,r={pattern:RegExp(`(^|[^\\w.])`+n+`[A-Z](?:[\\d_A-Z]*[a-z]\\w*)?\\b`),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};e.languages.java=e.languages.extend(`clike`,{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[r,{pattern:RegExp(`(^|[^\\w.])`+n+`[A-Z]\\w*(?=\\s+\\w+\\s*[;,=()]|\\s*(?:\\[[\\s,]*\\]\\s*)?::\\s*new\\b)`),lookbehind:!0,inside:r.inside},{pattern:RegExp(`(\\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\\s+)`+n+`[A-Z]\\w*\\b`),lookbehind:!0,inside:r.inside}],keyword:t,function:[e.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),e.languages.insertBefore(`java`,`string`,{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:`string`},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),e.languages.insertBefore(`java`,`class-name`,{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:`punctuation`},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":r,keyword:t,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(`(\\bimport\\s+)`+n+`(?:[A-Z]\\w*|\\*)(?=\\s*;)`),lookbehind:!0,inside:{namespace:r.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(`(\\bimport\\s+static\\s+)`+n+`(?:\\w+|\\*)(?=\\s*;)`),lookbehind:!0,alias:`static`,inside:{namespace:r.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(`(\\b(?:exports|import(?:\\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\\s+)(?!<keyword>)[a-z]\\w*(?:\\.[a-z]\\w*)*\\.?`.replace(/<keyword>/g,function(){return t.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(e)}G8.displayName=`typescript`,G8.aliases=[`ts`];function G8(e){e.register(j8),(function(e){e.languages.typescript=e.languages.extend(`javascript`,{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript[`literal-property`];var t=e.languages.extend(`typescript`,{});delete t[`class-name`],e.languages.typescript[`class-name`].inside=t,e.languages.insertBefore(`typescript`,`function`,{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:`operator`},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:`class-name`,inside:t}}}}),e.languages.ts=e.languages.typescript})(e)}K8.displayName=`python`,K8.aliases=[`py`];function K8(e){e.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:`punctuation`},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:`string`},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:[`annotation`,`punctuation`],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},e.languages.python[`string-interpolation`].inside.interpolation.inside.rest=e.languages.python,e.languages.py=e.languages.python}q8.displayName=`jsx`,q8.aliases=[];function q8(e){e.register(j8),e.register(O8),(function(e){var t=e.util.clone(e.languages.javascript),n=`(?:\\s|\\/\\/.*(?!.)|\\/\\*(?:[^*]|\\*(?!\\/))\\*\\/)`,r=`(?:\\{(?:\\{(?:\\{[^{}]*\\}|[^{}])*\\}|[^{}])*\\})`,i=`(?:\\{<S>*\\.{3}(?:[^{}]|<BRACES>)*\\})`;function a(e,t){return e=e.replace(/<S>/g,function(){return n}).replace(/<BRACES>/g,function(){return r}).replace(/<SPREAD>/g,function(){return i}),RegExp(e,t)}i=a(i).source,e.languages.jsx=e.languages.extend(`markup`,t),e.languages.jsx.tag.pattern=a(`<\\/?(?:[\\w.:-]+(?:<S>+(?:[\\w.:$-]+(?:=(?:"(?:\\\\[\\s\\S]|[^\\\\"])*"|'(?:\\\\[\\s\\S]|[^\\\\'])*'|[^\\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\\/?)?>`),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside[`attr-value`].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside[`class-name`]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore(`inside`,`attr-name`,{spread:{pattern:a(`<SPREAD>`),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore(`inside`,`special-attr`,{script:{pattern:a(`=<BRACES>`),alias:`language-javascript`,inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:`punctuation`},rest:e.languages.jsx}}},e.languages.jsx.tag);var o=function(e){return e?typeof e==`string`?e:typeof e.content==`string`?e.content:e.content.map(o).join(``):``},s=function(t){for(var n=[],r=0;r<t.length;r++){var i=t[r],a=!1;if(typeof i!=`string`&&(i.type===`tag`&&i.content[0]&&i.content[0].type===`tag`?i.content[0].content[0].content===`</`?n.length>0&&n[n.length-1].tagName===o(i.content[0].content[1])&&n.pop():i.content[i.content.length-1].content===`/>`||n.push({tagName:o(i.content[0].content[1]),openedBraces:0}):n.length>0&&i.type===`punctuation`&&i.content===`{`?n[n.length-1].openedBraces++:n.length>0&&n[n.length-1].openedBraces>0&&i.type===`punctuation`&&i.content===`}`?n[n.length-1].openedBraces--:a=!0),(a||typeof i==`string`)&&n.length>0&&n[n.length-1].openedBraces===0){var c=o(i);r<t.length-1&&(typeof t[r+1]==`string`||t[r+1].type===`plain-text`)&&(c+=o(t[r+1]),t.splice(r+1,1)),r>0&&(typeof t[r-1]==`string`||t[r-1].type===`plain-text`)&&(c=o(t[r-1])+c,t.splice(r-1,1),r--),t[r]=new e.Token(`plain-text`,c,null,c)}i.content&&typeof i.content!=`string`&&s(i.content)}};e.hooks.add(`after-tokenize`,function(e){(e.language===`jsx`||e.language===`tsx`)&&s(e.tokens)})})(e)}J8.displayName=`tsx`,J8.aliases=[];function J8(e){e.register(q8),e.register(G8),(function(e){var t=e.util.clone(e.languages.typescript);e.languages.tsx=e.languages.extend(`jsx`,t),delete e.languages.tsx.parameter,delete e.languages.tsx[`literal-property`];var n=e.languages.tsx.tag;n.pattern=RegExp(`(^|[^\\w$]|(?=<\\/))(?:`+n.pattern.source+`)`,n.pattern.flags),n.lookbehind=!0})(e)}Y8.displayName=`rust`,Y8.aliases=[];function Y8(e){(function(e){for(var t=`\\/\\*(?:[^*/]|\\*(?!\\/)|\\/(?!\\*)|<self>)*\\*\\/`,n=0;n<2;n++)t=t.replace(/<self>/g,function(){return t});t=t.replace(/<self>/g,function(){return`[^\\s\\S]`}),e.languages.rust={comment:[{pattern:RegExp(`(^|[^\\\\])`+t),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:`attr-name`,inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:`punctuation`},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:`symbol`},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:`punctuation`},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:`function`},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:`class-name`},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:`namespace`},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:`namespace`,inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:`property`},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},e.languages.rust[`closure-params`].inside.rest=e.languages.rust,e.languages.rust.attribute.inside.string=e.languages.rust.string})(e)}var X8=F8,Z8=N8,Q8=P8,$8=R8,e5=k8,t5=z8,n5=B8,r5=V8,i5=W8,a5=j8,o5=U8,s5=q8,c5=L8,l5=O8,u5=K8,d5=Y8,f5=H8,p5=M8,m5=J8,h5=G8,g5=I8,_5={'code[class*="language-"]':{color:`#393A34`,fontFamily:`"Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace`,direction:`ltr`,textAlign:`left`,whiteSpace:`pre`,wordSpacing:`normal`,wordBreak:`normal`,fontSize:`.9em`,lineHeight:`1.2em`,MozTabSize:`4`,OTabSize:`4`,tabSize:`4`,WebkitHyphens:`none`,MozHyphens:`none`,msHyphens:`none`,hyphens:`none`},'pre[class*="language-"]':{color:`#393A34`,fontFamily:`"Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace`,direction:`ltr`,textAlign:`left`,whiteSpace:`pre`,wordSpacing:`normal`,wordBreak:`normal`,fontSize:`.9em`,lineHeight:`1.2em`,MozTabSize:`4`,OTabSize:`4`,tabSize:`4`,WebkitHyphens:`none`,MozHyphens:`none`,msHyphens:`none`,hyphens:`none`,padding:`1em`,margin:`.5em 0`,overflow:`auto`,border:`1px solid #dddddd`,backgroundColor:`white`},'pre > code[class*="language-"]':{fontSize:`1em`},'pre[class*="language-"]::-moz-selection':{background:`#C1DEF1`},'pre[class*="language-"] ::-moz-selection':{background:`#C1DEF1`},'code[class*="language-"]::-moz-selection':{background:`#C1DEF1`},'code[class*="language-"] ::-moz-selection':{background:`#C1DEF1`},'pre[class*="language-"]::selection':{background:`#C1DEF1`},'pre[class*="language-"] ::selection':{background:`#C1DEF1`},'code[class*="language-"]::selection':{background:`#C1DEF1`},'code[class*="language-"] ::selection':{background:`#C1DEF1`},':not(pre) > code[class*="language-"]':{padding:`.2em`,paddingTop:`1px`,paddingBottom:`1px`,background:`#f8f8f8`,border:`1px solid #dddddd`},comment:{color:`#008000`,fontStyle:`italic`},prolog:{color:`#008000`,fontStyle:`italic`},doctype:{color:`#008000`,fontStyle:`italic`},cdata:{color:`#008000`,fontStyle:`italic`},namespace:{Opacity:`.7`},string:{color:`#A31515`},punctuation:{color:`#393A34`},operator:{color:`#393A34`},url:{color:`#36acaa`},symbol:{color:`#36acaa`},number:{color:`#36acaa`},boolean:{color:`#36acaa`},variable:{color:`#36acaa`},constant:{color:`#36acaa`},inserted:{color:`#36acaa`},atrule:{color:`#0000ff`},keyword:{color:`#0000ff`},"attr-value":{color:`#0000ff`},".language-autohotkey .token.selector":{color:`#0000ff`},".language-json .token.boolean":{color:`#0000ff`},".language-json .token.number":{color:`#0000ff`},'code[class*="language-css"]':{color:`#0000ff`},function:{color:`#393A34`},deleted:{color:`#9a050f`},".language-autohotkey .token.tag":{color:`#9a050f`},selector:{color:`#800000`},".language-autohotkey .token.keyword":{color:`#00009f`},important:{color:`#e90`,fontWeight:`bold`},bold:{fontWeight:`bold`},italic:{fontStyle:`italic`},"class-name":{color:`#2B91AF`},".language-json .token.property":{color:`#2B91AF`},tag:{color:`#800000`},"attr-name":{color:`#ff0000`},property:{color:`#ff0000`},regex:{color:`#ff0000`},entity:{color:`#ff0000`},"directive.tag.tag":{background:`#ffff00`,color:`#393A34`},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:`#a5a5a5`},".line-numbers .line-numbers-rows > span:before":{color:`#2B91AF`},".line-highlight.line-highlight":{background:`linear-gradient(to right, rgba(193, 222, 241, 0.2) 70%, rgba(221, 222, 241, 0))`}},v5={'pre[class*="language-"]':{color:`#d4d4d4`,fontSize:`13px`,textShadow:`none`,fontFamily:`Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace`,direction:`ltr`,textAlign:`left`,whiteSpace:`pre`,wordSpacing:`normal`,wordBreak:`normal`,lineHeight:`1.5`,MozTabSize:`4`,OTabSize:`4`,tabSize:`4`,WebkitHyphens:`none`,MozHyphens:`none`,msHyphens:`none`,hyphens:`none`,padding:`1em`,margin:`.5em 0`,overflow:`auto`,background:`#1e1e1e`},'code[class*="language-"]':{color:`#d4d4d4`,fontSize:`13px`,textShadow:`none`,fontFamily:`Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace`,direction:`ltr`,textAlign:`left`,whiteSpace:`pre`,wordSpacing:`normal`,wordBreak:`normal`,lineHeight:`1.5`,MozTabSize:`4`,OTabSize:`4`,tabSize:`4`,WebkitHyphens:`none`,MozHyphens:`none`,msHyphens:`none`,hyphens:`none`},'pre[class*="language-"]::selection':{textShadow:`none`,background:`#264F78`},'code[class*="language-"]::selection':{textShadow:`none`,background:`#264F78`},'pre[class*="language-"] *::selection':{textShadow:`none`,background:`#264F78`},'code[class*="language-"] *::selection':{textShadow:`none`,background:`#264F78`},':not(pre) > code[class*="language-"]':{padding:`.1em .3em`,borderRadius:`.3em`,color:`#db4c69`,background:`#1e1e1e`},".namespace":{Opacity:`.7`},"doctype.doctype-tag":{color:`#569CD6`},"doctype.name":{color:`#9cdcfe`},comment:{color:`#6a9955`},prolog:{color:`#6a9955`},punctuation:{color:`#d4d4d4`},".language-html .language-css .token.punctuation":{color:`#d4d4d4`},".language-html .language-javascript .token.punctuation":{color:`#d4d4d4`},property:{color:`#9cdcfe`},tag:{color:`#569cd6`},boolean:{color:`#569cd6`},number:{color:`#b5cea8`},constant:{color:`#9cdcfe`},symbol:{color:`#b5cea8`},inserted:{color:`#b5cea8`},unit:{color:`#b5cea8`},selector:{color:`#d7ba7d`},"attr-name":{color:`#9cdcfe`},string:{color:`#ce9178`},char:{color:`#ce9178`},builtin:{color:`#ce9178`},deleted:{color:`#ce9178`},".language-css .token.string.url":{textDecoration:`underline`},operator:{color:`#d4d4d4`},entity:{color:`#569cd6`},"operator.arrow":{color:`#569CD6`},atrule:{color:`#ce9178`},"atrule.rule":{color:`#c586c0`},"atrule.url":{color:`#9cdcfe`},"atrule.url.function":{color:`#dcdcaa`},"atrule.url.punctuation":{color:`#d4d4d4`},keyword:{color:`#569CD6`},"keyword.module":{color:`#c586c0`},"keyword.control-flow":{color:`#c586c0`},function:{color:`#dcdcaa`},"function.maybe-class-name":{color:`#dcdcaa`},regex:{color:`#d16969`},important:{color:`#569cd6`},italic:{fontStyle:`italic`},"class-name":{color:`#4ec9b0`},"maybe-class-name":{color:`#4ec9b0`},console:{color:`#9cdcfe`},parameter:{color:`#9cdcfe`},interpolation:{color:`#9cdcfe`},"punctuation.interpolation-punctuation":{color:`#569cd6`},variable:{color:`#9cdcfe`},"imports.maybe-class-name":{color:`#9cdcfe`},"exports.maybe-class-name":{color:`#9cdcfe`},escape:{color:`#d7ba7d`},"tag.punctuation":{color:`#808080`},cdata:{color:`#808080`},"attr-value":{color:`#ce9178`},"attr-value.punctuation":{color:`#ce9178`},"attr-value.punctuation.attr-equals":{color:`#d4d4d4`},namespace:{color:`#4ec9b0`},'pre[class*="language-javascript"]':{color:`#9cdcfe`},'code[class*="language-javascript"]':{color:`#9cdcfe`},'pre[class*="language-jsx"]':{color:`#9cdcfe`},'code[class*="language-jsx"]':{color:`#9cdcfe`},'pre[class*="language-typescript"]':{color:`#9cdcfe`},'code[class*="language-typescript"]':{color:`#9cdcfe`},'pre[class*="language-tsx"]':{color:`#9cdcfe`},'code[class*="language-tsx"]':{color:`#9cdcfe`},'pre[class*="language-css"]':{color:`#ce9178`},'code[class*="language-css"]':{color:`#ce9178`},'pre[class*="language-html"]':{color:`#d4d4d4`},'code[class*="language-html"]':{color:`#d4d4d4`},".language-regex .token.anchor":{color:`#dcdcaa`},".language-html .token.punctuation":{color:`#808080`},'pre[class*="language-"] > code[class*="language-"]':{position:`relative`,zIndex:`1`},".line-highlight.line-highlight":{background:`#f7ebc6`,boxShadow:`inset 5px 0 0 #f7d87c`,zIndex:`0`}},y5={bash:X8,c:Z8,cpp:Q8,csharp:$8,css:e5,diff:t5,docker:n5,go:r5,java:i5,javascript:a5,json:o5,jsx:s5,markdown:c5,markup:l5,python:u5,rust:d5,scss:f5,sql:p5,tsx:m5,typescript:h5,yaml:g5};for(let[e,t]of Object.entries(y5))D8.registerLanguage(e,t);var b5=.25,x5=.5,S5=3;function C5({code:e,isStreaming:t,defaultPreview:n=!1}){let{isDark:r}=WK(),{t:i}=R(),[a,o]=(0,_.useState)(n),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(!1),d=`${r?`dark`:`light`}\n${e}`,f=a&&!t;(0,_.useEffect)(()=>{if(!f)return;let t=!1;return c({key:d,status:`loading`}),(async()=>{let{default:n}=await D0(async()=>{let{default:e}=await import(`./mermaid.core-DADvtc6n.js`);return{default:e}},__vite__mapDeps([2,3,4,5,1,6,7,8,9,10,11,12,13,14,15,16,17,18,19]));if(n.initialize({startOnLoad:!1,securityLevel:`strict`,suppressErrorRendering:!0,theme:r?`dark`:`default`}),!await n.parse(e,{suppressErrors:!0}))throw Error(`Invalid Mermaid diagram`);let i=typeof crypto<`u`&&`randomUUID`in crypto?`mermaid-${crypto.randomUUID()}`:`mermaid-${Date.now()}-${Math.random().toString(36).slice(2)}`,a=await n.render(i,e);t||c({key:d,status:`ready`,svg:a.svg})})().catch(()=>{t||c({key:d,status:`error`})}),()=>{t=!0}},[e,d,r,f]);let p=(0,L.jsx)(`button`,{type:`button`,onClick:()=>o(e=>!e),disabled:t,title:i(t?`i18n.previewAfterStreaming`:f?`i18n.showMermaidSource`:`i18n.previewMermaid`),className:[`markdown-code-action`,f?`is-active`:``].filter(Boolean).join(` `),children:i(f?`i18n.source`:`i18n.preview`)});if(!f)return(0,L.jsx)(D5,{code:e,lang:`mermaid`,headerAction:p});let m=s?.key===d&&s.status===`error`?(0,L.jsx)(`div`,{className:`mermaid-block mermaid-block-error`,children:i(`i18n.invalidMermaid`)}):s?.key!==d||s.status!==`ready`?(0,L.jsx)(`div`,{className:`mermaid-block mermaid-block-loading`,"aria-label":i(`i18n.renderingMermaid`)}):(0,L.jsxs)(L.Fragment,{children:[!l&&(0,L.jsx)(`button`,{type:`button`,className:`mermaid-block mermaid-preview-button`,title:i(`i18n.openMermaidViewer`),"aria-label":i(`i18n.openMermaidViewer`),onClick:()=>u(!0),dangerouslySetInnerHTML:{__html:s.svg}}),l&&(0,L.jsx)(w5,{svg:s.svg,onClose:()=>u(!1)})]});return(0,L.jsxs)(`div`,{className:`markdown-code-block`,children:[(0,L.jsxs)(`div`,{className:`markdown-code-header`,children:[(0,L.jsx)(`span`,{className:`markdown-code-lang`,children:`mermaid`}),p]}),m]})}function w5({svg:e,onClose:t}){let{t:n}=R(),r=(0,_.useRef)(null),[i,a]=(0,_.useState)(1);return(0,_.useEffect)(()=>{let e=r.current;if(!e)return;let t=document.body.style.overflow;return document.body.style.overflow=`hidden`,e.showModal(),()=>{document.body.style.overflow=t,e.open&&e.close()}},[]),(0,L.jsx)(`dialog`,{ref:r,className:`mermaid-zoom-dialog`,"aria-label":n(`i18n.mermaidViewer`),onCancel:e=>{e.preventDefault(),t()},onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),t())},children:(0,L.jsxs)(`div`,{className:`mermaid-zoom-layout`,children:[(0,L.jsxs)(`div`,{className:`mermaid-zoom-toolbar`,children:[(0,L.jsx)(`span`,{className:`mermaid-zoom-title`,children:n(`i18n.mermaidDiagram`)}),(0,L.jsxs)(`div`,{className:`mermaid-zoom-actions`,children:[(0,L.jsxs)(`div`,{className:`mermaid-zoom-stepper`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:()=>a(e=>Math.max(x5,e-b5)),disabled:i<=x5,title:n(`i18n.zoomOut`),"aria-label":n(`i18n.zoomOut`),children:(0,L.jsx)(`svg`,{width:z.lg,height:z.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`M5 12h14`})})}),(0,L.jsxs)(`span`,{className:`mermaid-zoom-value`,children:[Math.round(i*100),`%`]}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>a(e=>Math.min(S5,e+b5)),disabled:i>=S5,title:n(`i18n.zoomIn`),"aria-label":n(`i18n.zoomIn`),children:(0,L.jsx)(`svg`,{width:z.lg,height:z.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`M12 5v14M5 12h14`})})})]}),(0,L.jsx)(`button`,{type:`button`,className:`mermaid-zoom-icon-button`,onClick:()=>a(1),title:n(`i18n.fitToWidth`),"aria-label":n(`i18n.fitToWidth`),children:(0,L.jsx)(`svg`,{width:z.lg,height:z.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`M8 3H3v5M16 3h5v5M8 21H3v-5M16 21h5v-5`})})}),(0,L.jsx)(`button`,{type:`button`,className:`mermaid-zoom-icon-button`,onClick:t,title:n(`i18n.close`),"aria-label":n(`i18n.close`),children:(0,L.jsx)(`svg`,{width:z.lg,height:z.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`M6 6l12 12M18 6 6 18`})})})]})]}),(0,L.jsx)(`div`,{className:`mermaid-zoom-viewport`,onClick:e=>{e.target===e.currentTarget&&t()},children:(0,L.jsx)(`div`,{className:`mermaid-zoom-canvas`,style:{width:`${i*100}%`},dangerouslySetInnerHTML:{__html:e}})})]})})}var T5=5e3,E5=800;function D5({code:e,lang:t,headerAction:n,isStreaming:r}){let{isDark:i}=WK(),{t:a}=R(),[o,s]=(0,_.useState)(!1),c=()=>{bK(e).then(()=>{s(!0),setTimeout(()=>s(!1),1500)})},l=e.length>T5||r===!0&&e.length>E5;return(0,L.jsxs)(`div`,{className:`markdown-code-block`,children:[(0,L.jsxs)(`div`,{className:`markdown-code-header`,children:[(0,L.jsx)(`span`,{className:`markdown-code-lang`,children:t||`text`}),(0,L.jsxs)(`div`,{className:`markdown-code-actions`,children:[n,(0,L.jsx)(`button`,{onClick:c,className:`markdown-code-action`,children:a(o?`i18n.copied`:`i18n.copy`)})]})]}),l?(0,L.jsx)(`pre`,{className:`markdown-code-plain`,style:{margin:0,padding:`11px 13px`,fontSize:`var(--text-md)`,lineHeight:1.62,borderRadius:0,background:`color-mix(in srgb, var(--bg) 92%, var(--bg-panel))`,overflow:`auto`},children:(0,L.jsx)(`code`,{style:{fontFamily:`var(--font-mono)`},children:e})}):(0,L.jsx)(D8,{language:t||`text`,style:i?v5:_5,showLineNumbers:!0,lineNumberStyle:{color:`var(--text-dim)`,fontStyle:`normal`},customStyle:{margin:0,padding:`11px 13px`,fontSize:`var(--text-md)`,lineHeight:1.62,borderRadius:0,background:`color-mix(in srgb, var(--bg) 92%, var(--bg-panel))`},codeTagProps:{style:{fontFamily:`var(--font-mono)`}},children:e})]})}function O5({children:e,className:t,isStreaming:n,cwd:r,onOpenFile:i}){let{t:a}=R(),[o,s]=(0,_.useState)(!1),c=!o&&e.length>1e5,l=(0,_.useMemo)(()=>c?l6(e):e,[c,e]),u=(0,_.useMemo)(()=>JU(l),[l]),d=(0,_.useMemo)(()=>({code({className:e,children:t,...r}){let i=e?.replace(`language-`,``).toLowerCase()??``,a=String(t);return e?.includes(`language-`)||a.includes(`
|
|
482
482
|
`)?i===`mermaid`?(0,L.jsx)(C5,{code:a.replace(/\n$/,``),isStreaming:n}):(0,L.jsx)(D5,{code:a.replace(/\n$/,``),lang:i,isStreaming:n}):(0,L.jsx)(`code`,{className:`markdown-inline-code`,...r,children:t})},pre({children:e}){return(0,L.jsx)(L.Fragment,{children:e})},a({href:e,children:t,...n}){delete n.node;let a=i?_W(e,r):null,o=i;if(!a||!o)return(0,L.jsx)(`a`,{href:e,...n,target:`_blank`,rel:`noopener noreferrer`,children:t});let s=e=>{if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=e.currentTarget.getAttribute(`target`);t&&t!==`_self`||(e.preventDefault(),o(a))};return(0,L.jsx)(`a`,{href:e,...n,onClick:s,children:t})},img({src:e,alt:t,...n}){delete n.node;let i=typeof e==`string`?_W(e,r):null,a=i?`/api/files/${yO(i)}?type=read`:e;return(0,L.jsx)(`img`,{src:a,alt:t??``,loading:`lazy`,...n})},table({children:e}){return(0,L.jsx)(`div`,{className:`markdown-table-wrap`,children:(0,L.jsx)(`table`,{children:e})})},blockquote({children:e}){return(0,L.jsx)(`blockquote`,{children:e})}}),[r,n,i]);return(0,L.jsxs)(`div`,{className:[`markdown-body`,t].filter(Boolean).join(` `),style:{whiteSpace:`pre-wrap`},children:[(0,L.jsx)(i6,{remarkPlugins:QU??void 0,rehypePlugins:eW??void 0,components:d,children:u}),c&&(0,L.jsxs)(`button`,{type:`button`,"aria-label":a(`chat.expandMessage`),title:a(`chat.expandMessage`),onClick:()=>s(!0),style:{display:`flex`,alignItems:`center`,justifyContent:`center`,gap:6,width:`100%`,marginTop:6,padding:`5px 0`,border:`none`,borderTop:`1px solid var(--border)`,background:`var(--bg-subtle)`,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-base)`},children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,children:`…`}),(0,L.jsx)(`svg`,{width:z.base,height:z.base,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`m6 9 6 6 6-6`})})]})]})}var{min:k5,max:A5,abs:j5,floor:M5}=Math,N5=(e,t,n)=>k5(n,A5(t,e)),P5=e=>[...e].sort((e,t)=>e-t),F5=setTimeout,I5=clearTimeout,L5=typeof queueMicrotask==`function`?queueMicrotask:e=>{Promise.resolve().then(e)},R5=()=>{let e;return[new Promise(t=>{e=t}),e]},z5=e=>{let t;return()=>(e&&=(t=e(),void 0),t)},B5=typeof window<`u`,V5=e=>e.documentElement,H5=e=>e.ownerDocument,U5=e=>e.defaultView,W5=z5(()=>!!/iP(hone|od|ad)/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>0),G5=z5(()=>`scrollBehavior`in V5(document).style),K5=e=>A5(e.t(),e.o()),q5=({i:e,l:t,u:n,h:r,v:i,S:a,t:o,$:s,m:c,p:l},u=0)=>{let d=!!l,f=!!u,p=1,m=0,h=0,g=0,_=0,v=0,y=0,b=0,x=0,S=null,C=[0,f?A5(u-1,0):-1],w=0,T=!1,E=new Set,D=()=>g-h,O=()=>D()+v+_,k=(e,t)=>{let i=n(e)-v;return t?o()-i-r(e):i},A=e=>{e&&(W5()&&b!==0||S&&x===1?v+=e:_+=e)};return{_:()=>{E.clear()},I:()=>p,i:(t=200)=>{if(!T||f)return C;let n,r;if(y)[n,r]=C;else{let i=A5(0,O()),a=i+m;d||(t=A5(0,t),b!==1&&(i-=t),b!==2&&(a+=t)),[n,r]=C=e(A5(0,i),A5(0,a)),S&&(n=k5(n,S[0]),r=A5(r,S[1]))}return[A5(n,0),k5(r,s()-1)]},k:e=>t(e-h),R:a,u:k,h:r,C:s,T:()=>g,M:()=>b!==0,o:()=>m,O:()=>h,t:o,L:()=>(y=_,_=0,[y,x===2]),H:(e,t)=>{let n=[e,t];return E.add(n),()=>{E.delete(n)}},W:(n,s)=>{let u,C,j=0;switch(n){case 1:{if(s===g&&x===0)break;let e=y;y=0;let t=s-g,n=j5(t);e&&n<j5(e)+1||x!==0||(b=t<0?2:1),f&&=!1,g=s,j=4;let r=D();r>=-m&&r<=o()&&(j+=1,C=n>m);break}case 2:j=8,b!==0&&(u=!0,j+=1),b=0,x=0,S=null;break;case 3:{let e=s.filter(([e,t])=>!a(e,t));if(!e.length)break;A(e.reduce((e,[t,n])=>{let i;if(x===2)i=!0;else if(S&&x===1)i=t<S[0];else{let e=D(),n=k(t),a=r(t);i=b!==1&&x===0?n+a<=e:n<e&&n+a<e+m}return i&&(e+=n-r(t)),e},0));for(let[t,n]of e){let e=r(t),a=i(t,n);d&&(w+=a?n:n-e)}d&&m&&w>m&&(A(l(t(O()))),d=!1),j=3,C=!0;break}case 4:m!==s&&(m||(T=C=!0),m=s,j=3);break;case 5:s[1]?(A(c(s[0],!0)),x=2,j=1):(c(s[0]),j=1);break;case 6:h=s;break;case 7:x=1;break;case 8:S=e(s,s+m),j=1}j&&(p=1+(2147483647&p),u&&v&&(_+=v,v=0),E.forEach(([e,t])=>{j&e&&t(C)}))}}},J5=(e,t,n,r=0,i=t-1)=>{let a=r;for(;r<=i;){let t=M5((r+i)/2);e(t)<=n?(a=t,r=t+1):i=t-1}return N5(a,0,t-1)},Y5=(e,t,n)=>{let r=n?`unshift`:`push`;for(let n=0;n<t;n++)e[r](-1);return e},X5=(e,t,n)=>{let r=n&&n[1]||t||40,i=-1,a=0,o=n&&n[0],s=o?Y5(o.slice(0,k5(e,o.length)),A5(0,e-o.length)):Y5([],e),c=Y5([],e+1),l=e=>{let t=s[e];return t===-1?r:t},u=t=>{if(!e)return 0;if(i>=t)return c[t];i<0&&(c[0]=0,i=0);let n=i,r=c[n];for(;n<t;)r+=l(n),c[++n]=r;return i=t,r};return{i:(t,n)=>{let r,i;return a=k5(a,e-1),u(a)<=t?(i=J5(u,e,n,a),r=J5(u,e,t,a,i)):(r=J5(u,e,t,void 0,a),i=J5(u,e,n,r)),a=r,[r,i]},l:t=>J5(u,e,t),u,h:l,v:(e,t)=>{let n=s[e]===-1;return s[e]=t,i=k5(e,i),n},S:(e,t=-1)=>s[e]===t,t:()=>u(e),$:()=>e,m:(t,n)=>{let a=t-e;return i=n?-1:k5(t-1,i),e=t,a>0?(Y5(c,a),Y5(s,a,n),r*a):(c.splice(a),(n?s.splice(0,-a):s.splice(a)).reduce((e,t)=>e-(t===-1?r:t),0))},p:t?void 0:e=>{let t=0,n=[];s.forEach((r,i)=>{r!==-1&&(r&&n.push(r),i<e&&t++)}),i=-1;let a=P5(n),o=a.length,c=o/2|0,l=o%2==0?(a[c-1]+a[c])/2:a[c],u=r;return((r=l)-u)*A5(e-t,0)},B:()=>[s.slice(),r]}},Z5=e=>{let t;return{X(n){(t||=new(U5(H5(n))).ResizeObserver(e)).observe(n)},Y(e){t.unobserve(e)},q(){t&&t.disconnect()}}},Q5=(e,t)=>t?-e:e,$5=(e,t,n,r,i,a)=>{let o,s=0,c=!1,l=!1,u=!1,d=!1,f=Date.now,p=()=>{if(c||l)return c=!1,void m();u=!1,e.W(2)},m=()=>{I5(o),o=F5(p,150)},h=()=>{s=f(),u&&(d=!0),a&&e.W(6,a()),e.W(1,r()),m()},g=t=>{if(c||!e.M()||t.ctrlKey)return;let r=f()-s;150>r&&50<r&&(n?t.deltaX:t.deltaY)&&(c=!0)},_=()=>{l=!0,u=d=!1},v=()=>{l=!1,W5()&&(u=!0)};return t.addEventListener(`scroll`,h),t.addEventListener(`wheel`,g,{passive:!0}),t.addEventListener(`touchstart`,_,{passive:!0}),t.addEventListener(`touchend`,v,{passive:!0}),{q:()=>{t.removeEventListener(`scroll`,h),t.removeEventListener(`wheel`,g),t.removeEventListener(`touchstart`,_),t.removeEventListener(`touchend`,v),I5(o)},A:()=>{let[t,n]=e.L();t&&(i(t,n,d),d=!1,n&&e.o()>e.t()&&e.W(1,r()))}}},e7=(e,t,n)=>{let r;return[async(i,a)=>{if(!await t())return;let o,s,c;r&&r();let l=a&&G5(),u=r=()=>{o=!0,I5(s),c&&c()},d=()=>{if(!o){if(e.o()&&(I5(s),s=F5(u,150)),l){for(let[t,n]=e.i(0);t<=n;t++)if(e.R(t))return;u()}e.W(7),n(i(),l)}},f=()=>{if(o)return;let t;c=e.H(2,()=>{t||(t=!0,L5(()=>{t=!1,d()}))}),d()};l?(e.W(8,i()),L5(f)):f()},()=>{r&&r()}]},t7=(e,t)=>{let n,r,i=R5(),a=!1,o=t?`scrollLeft`:`scrollTop`,s=t?`overflowX`:`overflowY`,[c,l]=e7(e,()=>i[0],(e,r)=>{e=Q5(e,a),r?n.scrollTo({[t?`left`:`top`]:e,behavior:`smooth`}):n[o]=e}),u=t?`width`:`height`,d=new WeakMap,f=Z5(t=>{let r=[];for(let{target:i,contentRect:a}of t)if(i.offsetParent){if(i===n)e.W(4,a[u]);else{let e=d.get(i);e!=null&&r.push([e,a[u]])}}r.length&&e.W(3,r)});return{D(c,u=c.parentElement){f.X(n=u),t&&(a=getComputedStyle(u).direction===`rtl`),r=$5(e,u,t,()=>Q5(u[o],a),(t,n,r)=>{if(r){let e=u.style,t=e[s];e[s]=`hidden`,F5(()=>{e[s]=t})}u[o]=Q5(e.T()+t,a),n&&l()}),i[1](!0)},_(){f.q(),r&&r.q(),i[1](!1),i=R5()},N:(e,t)=>(d.set(e,t),f.X(e),()=>{d.delete(e),f.Y(e)}),P:()=>a,V:c,J(){r&&r.A()},j:e.O,G:()=>0}},n7=(e,t)=>{e.V(()=>t)},r7=(e,t,n,{align:r,smooth:i,offset:a=0}={})=>{if(n=N5(n,0,t.C()-1),r===`nearest`){let e=t.u(n),i=t.T();if(e<i)r=`start`;else{if(!(e+t.h(n)>i+t.o()))return;r=`end`}}e.V(()=>a+e.j()+t.u(n)+(r===`end`?t.h(n)-(t.o()-e.G()):r===`center`?(t.h(n)-(t.o()-e.G()))/2:0),i)},i7=B5?_.useLayoutEffect:_.useEffect,a7=`current`,o7=(e,t)=>{if(Array.isArray(e))for(let n of e)o7(n,t);else e==null||typeof e==`boolean`||t.push(e)},s7=(e,t)=>e.key??`_`+t,c7=e=>{let t=(0,_.useRef)(null);return t.current||=e()},l7=e=>{let t=(0,_.useRef)(e);return i7(()=>{t[a7]=e},[e]),t},u7=(0,_.memo)(({ee:e,te:t,oe:n,ne:r,re:i,ie:a,se:o,le:s})=>{let c=(0,_.useRef)(null);i7(()=>t(c[a7],n),[n]);let l=(0,_.useMemo)(()=>{let e={contain:`layout style`,position:i&&s?void 0:`absolute`,[o?`height`:`width`]:`100%`,[o?`top`:`left`]:0,[o?`left`:`top`]:r,visibility:!i||s?void 0:`hidden`};return o&&(e.display=`inline-flex`),e},[r,i,s,o]);return(0,L.jsx)(a,typeof a==`string`?{ref:c,style:l,children:e}:{ref:c,style:l,index:n,children:e})}),d7=(e,t)=>(0,_.useMemo)(()=>{if(typeof e==`function`)return[n=>e(t[n],n),t.length];let n=(e=>{let t=[];return o7(e,t),t})(e);return[e=>n[e],n.length]},[e,t]),f7=(0,_.forwardRef)(({children:e,data:t,bufferSize:n,itemSize:r,shift:i,horizontal:a,keepMounted:o,cache:s,startMargin:c=0,ssrCount:l,as:u=`div`,item:d=`div`,scrollRef:f,onScroll:p,onScrollEnd:m},h)=>{let[g,v]=d7(e,t),y=(0,_.useRef)(null),b=(0,_.useRef)(!!l),x=l7(p),S=l7(m),[C,w,T,E]=c7(()=>{let e=!!a,t=X5(v,r,s),n=q5(t,l);return[n,t,t7(n,e),e]});v!==C.C()&&C.W(5,[v,i]),c!==C.O()&&C.W(6,c);let[D,O]=(0,_.useReducer)(C.I,void 0,C.I),k=C.M(),A=C.t(),j=T.P(),M=[],N=e=>{let t=g(e);return(0,L.jsx)(u7,{te:T.N,oe:e,ne:C.u(e,j),re:C.R(e),ie:d,ee:t,se:E,le:b[a7]},s7(t,e))};if(i7(()=>{b[a7]=!1,C.H(1,e=>{e?(0,tr.flushSync)(O):O()}),C.H(4,()=>{x.current&&x.current(C.T())}),C.H(8,()=>{S.current&&S.current()});let e=y[a7];return f?L5(()=>{f.current&&T.D(e,f[a7])}):T.D(e),()=>{C._(),T._()}},[]),i7(()=>{T.J()},[D]),(0,_.useImperativeHandle)(h,()=>({get cache(){return w.B()},get scrollOffset(){return C.T()},get scrollSize(){return K5(C)},get viewportSize(){return C.o()},findItemIndex:C.k,getItemOffset:C.u,getItemSize:C.h,scrollToIndex:(e,t)=>r7(T,C,e,t),scrollTo:e=>n7(T,e),scrollBy:e=>((e,t,n)=>{n7(e,n+t.T())})(T,C,e)}),[]),o){let e=new Set(o);for(let[t,r]=C.i(n);t<=r;t++)e.add(t);P5([...e]).forEach(e=>{M.push(N(e))})}else for(let[e,t]=C.i(n);e<=t;e++)M.push(N(e));return(0,L.jsx)(u,{ref:y,style:{contain:`size style`,overflowAnchor:`none`,flex:`none`,position:`relative`,width:E?A:`100%`,height:E?`100%`:A,pointerEvents:k?`none`:void 0},children:M})}),p7=100,m7=new Map;function h7(e,t,n){let r=`${e}:${t}:${n}`,i=m7.get(r);if(i)return m7.delete(r),m7.set(r,i),i;let a=fetch(`/api/sessions/${encodeURIComponent(e)}/entries/${encodeURIComponent(t)}/thinking?blockIndex=${n}`).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();if(typeof t.thinking!=`string`)throw Error(`Invalid thinking response`);return t.thinking}).catch(e=>{throw m7.delete(r),e});if(m7.set(r,a),m7.size>p7){let e=m7.keys().next().value;e&&m7.delete(e)}return a}function g7(e){if(!e)return null;let t=new Date(e),n=new Date,r=t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate(),i=t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`});return r?i:`${t.toLocaleDateString([],{month:`short`,day:`numeric`,year:t.getFullYear()===n.getFullYear()?void 0:`numeric`})} ${i}`}function _7(e,t,n){if(t===n||e.role!==`assistant`)return!0;for(let r of e.content??[])if(r.type===`toolCall`&&t?.get(r.toolCallId)!==n?.get(r.toolCallId))return!1;return!0}var v7=(0,_.memo)(function({message:e,isStreaming:t,toolResults:n,modelNames:r,cwd:i,onOpenFile:a,entryId:o,onFork:s,forking:c,onNavigate:l,prevAssistantEntryId:u,onEditContent:d,showTimestamp:f,turnStartTimestamp:p,sessionId:m,streamingBashOutput:h,longBlockCollapseChars:g,recentExpandedBlockKeys:_,modelLabelVisible:v,turnNumber:y}){return e.role===`user`?(0,L.jsx)(y7,{message:e,entryId:o,onFork:s,forking:c,onNavigate:l,prevAssistantEntryId:u,onEditContent:d,turnNumber:y}):e.role===`assistant`?(0,L.jsx)(b7,{message:e,isStreaming:t,toolResults:n,modelNames:r,cwd:i,onOpenFile:a,showTimestamp:f,turnStartTimestamp:p,sessionId:m,entryId:o,longBlockCollapseChars:g,recentExpandedBlockKeys:_,modelLabelVisible:v,turnNumber:y}):e.role===`toolResult`?null:e.role===`custom`?e.customType===`compaction`?(0,L.jsx)(R7,{message:e}):(0,L.jsx)(V7,{message:e,cwd:i,onOpenFile:a}):e.role===`bashExecution`?(0,L.jsx)(dte,{message:e,sessionId:m,streamingOutput:h,longBlockCollapseChars:g}):null},(e,t)=>e.message===t.message&&e.isStreaming===t.isStreaming&&_7(e.message,e.toolResults,t.toolResults)&&e.modelNames===t.modelNames&&e.cwd===t.cwd&&e.onOpenFile===t.onOpenFile&&e.entryId===t.entryId&&e.onFork===t.onFork&&e.forking===t.forking&&e.onNavigate===t.onNavigate&&e.prevAssistantEntryId===t.prevAssistantEntryId&&e.onEditContent===t.onEditContent&&e.showTimestamp===t.showTimestamp&&e.sessionId===t.sessionId&&e.streamingBashOutput===t.streamingBashOutput&&e.modelLabelVisible===t.modelLabelVisible&&e.longBlockCollapseChars===t.longBlockCollapseChars&&e.recentExpandedBlockKeys===t.recentExpandedBlockKeys);function y7({message:e,entryId:t,onFork:n,forking:r,onNavigate:i,prevAssistantEntryId:a,onEditContent:o,turnNumber:s}){let{t:c}=R(),[l,u]=(0,_.useState)(!1),d=typeof e.content==`string`?e.content:e.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
|
|
483
483
|
`),f=typeof e.content==`string`?[]:e.content.filter(e=>e.type===`image`),p=g7(e.timestamp),m=!!t&&!!n,h=!!a&&!!i;return(0,L.jsxs)(`div`,{className:`msg-row`,style:{marginBottom:16,display:`flex`,flexDirection:`column`,alignItems:`flex-end`},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,maxWidth:`85%`},children:[s!==void 0&&(0,L.jsx)(HX,{number:s}),(0,L.jsxs)(`div`,{style:{flex:1,minWidth:0,position:`relative`,background:`var(--user-bg)`,border:`1px solid color-mix(in srgb, var(--accent) 20%, transparent)`,borderRadius:12,padding:`8px 12px`,fontSize:`var(--text-2xl)`,fontFamily:`var(--font-mono)`,lineHeight:1.6,color:`var(--text)`,wordBreak:`break-word`},children:[f.length>0&&(0,L.jsx)(`div`,{style:{display:`flex`,gap:6,flexWrap:`wrap`,marginBottom:d?8:0},children:f.map((e,t)=>{let n=W7(e);return(0,L.jsx)(`img`,{src:n,alt:``,style:{maxWidth:240,maxHeight:240,borderRadius:6,objectFit:`contain`,display:`block`,border:`1px solid color-mix(in srgb, var(--accent) 15%, transparent)`}},t)})}),d&&(0,L.jsx)(`div`,{"data-testid":`user-message`,style:{whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:d})]})]}),(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`flex-end`,gap:6,marginTop:3},children:[(0,L.jsx)(`div`,{className:`msg-row-actions`,style:{display:`flex`,gap:3,transition:`opacity 0.12s`},children:(0,L.jsxs)(`button`,{onClick:()=>{bK(d).then(()=>{u(!0),setTimeout(()=>u(!1),1500)})},title:c(`i18n.copyMessage`),style:{display:`flex`,alignItems:`center`,gap:4,padding:`3px 8px`,height:22,background:`none`,border:`none`,borderRadius:5,color:l?`var(--accent)`:`var(--text-dim)`,cursor:`pointer`,fontSize:`var(--text-sm)`,fontWeight:400,whiteSpace:`nowrap`,transition:`color 0.12s`,"--hover-color":`var(--accent)`,"--hover-bg":`transparent`},className:l?void 0:`hover-shift`,children:[l?(0,L.jsx)(`svg`,{width:z.sm,height:z.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,L.jsx)(`polyline`,{points:`20 6 9 17 4 12`})}):(0,L.jsxs)(`svg`,{width:z.sm,height:z.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,L.jsx)(`rect`,{x:`9`,y:`9`,width:z.lg,height:z.lg,rx:`2`,ry:`2`}),(0,L.jsx)(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})]}),c(l?`i18n.copied`:`i18n.copy`)]})}),(m||h)&&(0,L.jsxs)(`div`,{className:r?`msg-row-actions msg-actions-force`:`msg-row-actions`,style:{display:`flex`,gap:3,transition:`opacity 0.12s`},children:[h&&(0,L.jsxs)(`button`,{onClick:()=>{i(a),o?.(d)},title:c(`i18n.editFromHereTitle`),style:{display:`flex`,alignItems:`center`,gap:4,padding:`3px 8px`,height:22,background:`none`,border:`none`,borderRadius:5,color:`var(--text-dim)`,cursor:`pointer`,fontSize:`var(--text-sm)`,fontWeight:400,whiteSpace:`nowrap`,transition:`color 0.12s`,"--hover-color":`var(--accent)`,"--hover-bg":`transparent`},className:`hover-shift`,children:[(0,L.jsxs)(`svg`,{width:z.sm,height:z.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,L.jsx)(`polyline`,{points:`15 10 20 15 15 20`}),(0,L.jsx)(`path`,{d:`M4 4v7a4 4 0 0 0 4 4h12`})]}),c(`i18n.editFromHere`)]}),m&&(0,L.jsxs)(`button`,{onClick:()=>{n(t)},disabled:r,title:c(r?`i18n.creatingSession`:`i18n.newSessionTitle`),style:{display:`flex`,alignItems:`center`,gap:4,padding:`3px 8px`,height:22,background:`none`,border:`none`,borderRadius:5,color:r?`var(--accent)`:`var(--text-dim)`,cursor:r?`not-allowed`:`pointer`,fontSize:`var(--text-sm)`,fontWeight:400,whiteSpace:`nowrap`,transition:`color 0.12s`,"--hover-color":`var(--accent)`,"--hover-bg":`transparent`},className:r?void 0:`hover-shift`,children:[(0,L.jsxs)(`svg`,{width:z.sm,height:z.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,L.jsx)(`line`,{x1:`6`,y1:`3`,x2:`6`,y2:`15`}),(0,L.jsx)(`circle`,{cx:`18`,cy:`6`,r:`3`}),(0,L.jsx)(`circle`,{cx:`6`,cy:`18`,r:`3`}),(0,L.jsx)(`path`,{d:`M18 9a9 9 0 0 1-9 9`})]}),c(r?`i18n.creating`:`i18n.newSession`)]})]}),p&&(0,L.jsx)(`span`,{style:{fontSize:`var(--text-xs)`,color:`var(--text-dim)`},children:p})]})]})}function b7({message:e,isStreaming:t,toolResults:n,modelNames:r,cwd:i,onOpenFile:a,showTimestamp:o,turnStartTimestamp:s,sessionId:c,entryId:l,longBlockCollapseChars:u,recentExpandedBlockKeys:d,modelLabelVisible:f=!0,turnNumber:p}){let{t:m}=R(),h=o?g7(e.timestamp):null,g=(e.content??[]).map((e,t)=>({block:e,originalIndex:t})).filter(({block:e})=>!kY(e,{isStreaming:t})),v=g.map(({block:e})=>e),y=jY(e,{isStreaming:t}),[b,x]=(0,_.useState)(!1),S=(0,_.useRef)(null),[C,w]=(0,_.useState)(null),T=(0,_.useRef)(g);(0,_.useEffect)(()=>{T.current=g});let E=(0,_.useRef)(new Map),[D,O]=(0,_.useState)(new Map),k=(0,_.useMemo)(()=>{if(!e.timestamp||!s)return;let t=Math.round((e.timestamp-s)/1e3);return t>0?t:void 0},[e.timestamp,s]),A=(0,_.useMemo)(()=>{let t=new Map;if(!n||!e.timestamp)return t;for(let[r,i]of n)if(i.timestamp&&e.timestamp){let n=Math.round((i.timestamp-e.timestamp)/1e3);n>0&&t.set(r,n)}return t},[n,e.timestamp]),j=v.filter(e=>e.type===`text`).map(e=>e.text).join(`
|
|
484
484
|
`);return(0,_.useEffect)(()=>{if(!t)return;let e=setInterval(()=>{if(document.hidden)return;let e=T.current,t=e.map(({block:e})=>e),n=Date.now();e.forEach(({originalIndex:e})=>{E.current.has(e)||E.current.set(e,n)}),O(t=>{let r=!1,i=new Map(t);for(let t=0;t<e.length-1;t++){let a=e[t].originalIndex,o=e[t+1].originalIndex;if(!i.has(a)&&E.current.has(a)){let e=E.current.get(a),t=E.current.get(o)??n;i.set(a,Math.round((t-e)/1e3)),r=!0}}return r?i:t});let r=e[e.length-1];if(r&&r.block.type===`toolCall`){let e=E.current.get(r.originalIndex);e!==void 0&&O(t=>{let i=Math.round((n-e)/1e3);if(t.get(r.originalIndex)===i)return t;let a=new Map(t);return a.set(r.originalIndex,i),a})}let i=0;for(let e of t)e.type===`text`?i+=e.text?.length??0:e.type===`thinking`?i+=e.thinking?.length??0:e.type===`toolCall`&&(i+=JSON.stringify(e.input??{}).length);if(i===0)return;S.current===null&&(S.current=n);let a=(n-S.current)/1e3;a>.5&&w(i/4/a)},300);return()=>{clearInterval(e),S.current=null,w(null)}},[t,O,w,T,E,S]),v.length===0&&!t&&!y?null:(0,L.jsxs)(`div`,{className:`msg-row`,style:{marginBottom:16},children:[f&&(0,L.jsxs)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`,marginBottom:4,display:`flex`,alignItems:`center`,gap:6},children:[p!==void 0&&(0,L.jsx)(HX,{number:p}),e.provider&&(0,L.jsxs)(`span`,{title:`${e.provider}/${e.model}`,style:{whiteSpace:`nowrap`},children:[(0,L.jsxs)(`span`,{style:{color:`var(--text-dim)`},children:[e.provider,`/`]}),(0,L.jsx)(`span`,{style:{color:`var(--text)`,fontWeight:700},children:r?.[`${e.provider}/${e.model}`]??r?.[e.model]??e.model})]}),t&&(()=>{let e=0;for(let t of v)t.type===`text`?e+=t.text?.length??0:t.type===`thinking`?e+=t.thinking?.length??0:t.type===`toolCall`&&(e+=JSON.stringify(t.input??{}).length);let t=Math.round(e/4);return(0,L.jsx)(L.Fragment,{children:t>0&&(0,L.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:4,color:`var(--text)`},title:m(`i18n.estimatedTokens`),children:[(0,L.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:2,fontSize:`var(--text-sm)`,fontWeight:400},children:[(0,L.jsxs)(`svg`,{width:z.xs,height:z.xs,viewBox:`0 0 10 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,L.jsx)(`line`,{x1:`5`,y1:`1.5`,x2:`5`,y2:`8.5`}),(0,L.jsx)(`polyline`,{points:`2 6 5 8.5 8 6`})]}),t]}),C!==null&&(0,L.jsxs)(`span`,{style:{marginLeft:6,padding:`1px 6px`,borderRadius:4,background:C>=50?`#53b3cb`:C>=30?`#9bc53d`:C>=15?`#f9c22e`:`#e01a4f`,color:`#fff`,fontSize:`var(--text-sm)`,fontWeight:400},children:[C.toFixed(1),` t/s`]})]})})})()]}),(0,L.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:g.map(({block:e,originalIndex:r})=>(0,L.jsx)(w7,{block:e,toolResults:n,isStreaming:t,streamingDuration:D.get(r),toolCallDurations:A,cwd:i,onOpenFile:a,sessionId:c,entryId:l,blockIndex:r,longBlockCollapseChars:u,recentExpandedBlockKeys:d},`${l??`stream`}-${r}`))}),y&&(0,L.jsxs)(`div`,{role:`alert`,style:{marginTop:v.length>0?8:0,padding:`7px 10px`,border:`1px solid color-mix(in srgb, var(--status-error) 30%, transparent)`,borderRadius:6,background:`color-mix(in srgb, var(--status-error) 7%, transparent)`,color:`var(--status-error)`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-base)`,lineHeight:1.5,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:[`Error: `,y]}),(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginTop:4},children:[e.usage&&!t&&(0,L.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:ute(e.usage)}),j&&!t&&(0,L.jsxs)(`button`,{onClick:()=>{bK(j).then(()=>{x(!0),setTimeout(()=>x(!1),1500)})},title:m(`i18n.copyMessage`),style:{display:`flex`,alignItems:`center`,gap:4,padding:`3px 8px`,height:22,background:`none`,border:`none`,borderRadius:5,color:b?`var(--accent)`:`var(--text-dim)`,cursor:`pointer`,fontSize:`var(--text-sm)`,fontWeight:400,whiteSpace:`nowrap`,transition:`opacity 0.12s, color 0.12s`,"--hover-color":`var(--accent)`,"--hover-bg":`transparent`},className:b?`msg-row-actions`:`msg-row-actions hover-shift`,children:[b?(0,L.jsx)(`svg`,{width:z.sm,height:z.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,L.jsx)(`polyline`,{points:`20 6 9 17 4 12`})}):(0,L.jsxs)(`svg`,{width:z.sm,height:z.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,L.jsx)(`rect`,{x:`9`,y:`9`,width:z.lg,height:z.lg,rx:`2`,ry:`2`}),(0,L.jsx)(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})]}),m(b?`i18n.copied`:`i18n.copy`)]}),h&&!t&&(0,L.jsxs)(`span`,{style:{fontSize:`var(--text-xs)`,color:`var(--text-dim)`,marginLeft:`auto`,fontVariantNumeric:`tabular-nums`},children:[h,k!==void 0&&(0,L.jsxs)(`span`,{children:[` `,`(`,m(`chat.turnDuration`,{duration:pY(k)}),`)`]})]})]})]})}var x7=24;function S7({text:e}){let t=(0,_.useMemo)(()=>e.split(/\r?\n/),[e]);return typeof ResizeObserver>`u`||t.length<50&&e.length<5e3?(0,L.jsx)(`div`,{style:{whiteSpace:`pre-wrap`,overflowWrap:`break-word`},children:e}):(0,L.jsx)(f7,{data:t,itemSize:x7,children:e=>(0,L.jsx)(`div`,{style:{minHeight:x7,lineHeight:`${x7}px`,whiteSpace:`pre-wrap`,overflowWrap:`break-word`},children:e})})}function C7({text:e,threshold:t,t:n,renderFull:r,isStreaming:i=!1,defaultExpanded:a=!1}){let[o,s]=(0,_.useState)(a),c=e.length;if(!(!i&&c>t))return r?(0,L.jsx)(L.Fragment,{children:r()}):i&&e.length>0?(0,L.jsx)(S7,{text:e}):(0,L.jsx)(L.Fragment,{children:e});let l=Math.max(1,Math.floor(t/2)),u=c-l*2,d=(0,L.jsx)(`button`,{type:`button`,"data-long-block-toggle":``,onClick:()=>s(e=>!e),"aria-expanded":o,style:{display:`block`,width:`100%`,margin:`6px 0`,padding:`3px 8px`,border:`1px dashed var(--border)`,borderRadius:6,background:`none`,color:`var(--text-dim)`,fontSize:`var(--text-sm)`,cursor:`pointer`,textAlign:`center`},children:o?n(`longBlock.collapse`):n(`longBlock.expandHint`,{n:u})});return o?(0,L.jsxs)(L.Fragment,{children:[r?r():(0,L.jsx)(S7,{text:e}),d]}):(0,L.jsxs)(L.Fragment,{children:[e.slice(0,l),d,e.slice(c-l)]})}function w7({block:e,toolResults:t,isStreaming:n,streamingDuration:r,toolCallDurations:i,cwd:a,onOpenFile:o,sessionId:s,entryId:c,blockIndex:l,longBlockCollapseChars:u,recentExpandedBlockKeys:d}){let f=!n&&c!==void 0&&(e.type===`thinking`||e.type===`toolCall`)&&d?.has(Ut(e.type,c,e.type===`toolCall`?e.toolCallId:void 0,e.type===`thinking`?l:void 0))===!0;if(e.type===`text`)return(0,L.jsx)(T7,{block:e,isStreaming:n,cwd:a,onOpenFile:o});if(e.type===`thinking`)return(0,L.jsx)(E7,{block:e,sessionId:s,entryId:c,blockIndex:l,isStreaming:n,keepExpanded:f,longBlockCollapseChars:u});if(e.type===`toolCall`){let a=e,o=t?.get(a.toolCallId),s=i?.get(a.toolCallId)??r;return(0,L.jsx)(O7,{block:a,result:o,duration:s,isStreaming:n,keepExpanded:f,longBlockCollapseChars:u})}return null}function T7({block:e,isStreaming:t,cwd:n,onOpenFile:r}){return(0,L.jsx)(O5,{isStreaming:t,cwd:n,onOpenFile:r,children:e.text})}function E7({block:e,sessionId:t,entryId:n,blockIndex:r,isStreaming:i=!1,keepExpanded:a=!1,longBlockCollapseChars:o=200}){let{t:s}=R(),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)(null),m=(0,_.useRef)(!1),h=(0,_.useRef)(null);(0,_.useEffect)(()=>{e.deferred&&!m.current&&(m.current=!0,g())},[]);let g=async()=>{if(!(!e.deferred||c!==null)){if(!t||!n){p(s(`i18n.thinkingUnavailable`));return}d(!0),p(null);try{l(await h7(t,n,r))}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(!1)}}},v=e.deferred?c:e.thinking,y=UZ(h,i,[v]);return(0,L.jsxs)(`div`,{style:{border:`1px solid var(--border)`,borderRadius:6,overflow:`hidden`,fontSize:`var(--text-base)`},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,padding:`6px 10px`,color:`var(--status-warning)`,fontSize:`var(--text-base)`,cursor:`default`},children:[(0,L.jsx)(ce,{size:z.base,fill:`currentColor`,style:{flexShrink:0,color:`var(--bulb-warning)`}}),(0,L.jsx)(`span`,{children:s(`i18n.thinking`)})]}),(0,L.jsx)(`div`,{ref:h,onScroll:y,style:{padding:`4px 10px 8px 28px`,borderTop:`1px solid var(--border)`,fontSize:`var(--text-lg)`,lineHeight:1.6,color:`var(--text-muted)`,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,fontFamily:`var(--font-mono)`,maxHeight:400,overflowY:`auto`,contentVisibility:`auto`,containIntrinsicBlockSize:400},children:u?(0,L.jsxs)(`span`,{style:{color:`var(--text-dim)`},children:[s(`i18n.loading`),`...`]}):f?(0,L.jsx)(`span`,{style:{color:`var(--status-error)`},children:f}):v?(0,L.jsx)(C7,{text:v,threshold:o,t:s,isStreaming:i,defaultExpanded:a}):OY(e)?(0,L.jsx)(`span`,{style:{color:`var(--text-dim)`,fontStyle:`italic`},children:s(`i18n.thinkingEncrypted`)}):(0,L.jsx)(`span`,{style:{color:`var(--text-dim)`},children:s(`i18n.noThinking`)})})]})}function D7({block:e,result:t,duration:n}){let{t:r}=R(),i=e.input??{},a=typeof i.question==`string`?i.question:null,o=Array.isArray(i.options)?i.options:[],s=t?t.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
|
|
@@ -493,7 +493,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
493
493
|
`:null]},t))})]})})}function Fte({widget:e,saved:t,messages:n,defaultOffset:r,onCloseWidget:i,setWidgetGeometry:a,onSend:o,fillChatInput:s,portalTarget:c}){let{t:l}=R(),[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)(null),m=(0,_.useRef)(null),h=(0,_.useCallback)(t=>{if(u)return;let n=()=>i(e.key,e.lines.join(`
|
|
494
494
|
`));if(window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches){n();return}let r=document.querySelector(`[data-tab-id="widgets"]`)??document.querySelector(`[data-testid="tab-bar"]`);if(!r){n();return}let a=t.currentTarget.getBoundingClientRect(),o=r.getBoundingClientRect(),s=`M ${a.left+a.width/2} ${a.top+a.height/2} L ${o.left+o.width/2} ${o.top+o.height/2}`;d(!0),p(s),window.setTimeout(n,280)},[u,i,e.key,e.lines]);return(0,_.useLayoutEffect)(()=>{if(!f||!m.current)return;let e=m.current;e.style.setProperty(`offset-path`,`path('${f}')`),e.style.setProperty(`offset-rotate`,`0deg`),e.animate([{offsetDistance:`0%`,r:28},{offsetDistance:`100%`,r:2}],{duration:240,easing:`cubic-bezier(0.22, 1, 0.36, 1)`,fill:`forwards`})},[f]),(0,_.useEffect)(()=>{t===void 0?a(e.key,{x:r.dx,y:r.dy,width:560,height:Math.round(window.innerHeight*.6)}):t.collapsed&&i(e.key,e.lines.join(`
|
|
495
495
|
`))},[e.key]),(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(RZ,{testId:`widget-dialog`,title:e.key,align:`center`,portalTarget:c,style:{opacity:+!u,transition:`opacity 200ms ease`},headerExtra:(0,L.jsx)(rr,{label:l(`widgets.collapse`),children:(0,L.jsx)(`button`,{type:`button`,"aria-label":l(`widgets.collapse`),onClick:h,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:26,height:26,borderRadius:6,border:`none`,background:`transparent`,color:`var(--text-muted)`,cursor:`pointer`},className:`hover-shift`,children:(0,L.jsx)(fe,{size:z.xl})})}),position:t?{x:t.x,y:t.y}:void 0,size:t?{width:t.width,height:t.height}:void 0,initialOffset:r,onDragStop:(n,r)=>a(e.key,{x:n,y:r,width:t?.width??560,height:t?.height??Math.round(window.innerHeight*.6)}),onResizeStop:(t,n,r,i)=>a(e.key,{x:r,y:i,width:t,height:n}),children:(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:10},children:[(0,L.jsx)(`pre`,{style:{margin:0,color:`var(--text-muted)`,fontSize:`var(--text-base)`,lineHeight:1.5,whiteSpace:`pre-wrap`,wordBreak:`break-word`,fontFamily:`var(--font-mono)`},children:e.lines.join(`
|
|
496
|
-
`)}),n.length>0&&(0,L.jsx)(`div`,{"data-testid":`widget-bound-messages`,style:{display:`flex`,flexWrap:`wrap`,gap:6,paddingTop:8,borderTop:`1px solid var(--border)`,flexShrink:0},children:n.map((t,n)=>(0,L.jsx)(q7,{msg:t,onSend:o,onFillInput:s,testId:`widget-send-${e.key}-${n}`},n))})]})}),f&&(0,L.jsx)(`div`,{"data-testid":`widget-collapse-trail`,style:{position:`fixed`,inset:0,zIndex:70,pointerEvents:`none`},children:(0,L.jsx)(`svg`,{width:`100%`,height:`100%`,style:{position:`absolute`,inset:0},children:(0,L.jsx)(`circle`,{ref:m,r:28,fill:`var(--accent)`,fillOpacity:.7})})})]})}function Ite(){let{t:e}=R(),t=(0,_.useSyncExternalStore)(Ln,Rn,Rn);if(t.length===0)return null;let n=t[t.length-1],r=t.length;return(0,L.jsx)(Xs,{open:!0,onOpenChange:()=>{},children:(0,L.jsxs)(ec,{children:[(0,L.jsx)(nc,{style:{position:`fixed`,inset:0,zIndex:1200,background:`rgba(0, 0, 0, 0.45)`}}),(0,L.jsxs)(oc,{role:`alertdialog`,"aria-modal":`true`,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),style:{position:`fixed`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,zIndex:1200,maxWidth:480,width:`calc(100% - 48px)`,background:`var(--bg)`,border:`1px solid var(--border)`,borderRadius:10,padding:`16px 20px`,boxShadow:`0 8px 32px rgba(0, 0, 0, 0.35)`},children:[(0,L.jsxs)(dc,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:10,fontSize:`var(--text-base)`,fontWeight:600,color:`var(--text)`},children:[(0,L.jsx)(`span`,{style:{color:`var(--status-error)`},children:`⚠`}),(0,L.jsx)(`span`,{children:r>1?e(`errors.titleCount`,{count:r}):e(`errors.title`)})]}),(0,L.jsx)(pc,{asChild:!0,children:(0,L.jsx)(`div`,{children:n.kind===`api`?(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:6},children:[(0,L.jsxs)(`span`,{style:{fontSize:`var(--text-xs)`,padding:`1px 8px`,borderRadius:999,background:`color-mix(in srgb, var(--status-error) 14%, transparent)`,color:`var(--status-error)`,fontWeight:600,whiteSpace:`nowrap`},children:[`HTTP `,n.status||`ERR`]}),n.context&&(0,L.jsx)(`span`,{style:{fontSize:`var(--text-xs)`,color:`var(--text-dim)`},children:n.context})]}),(0,L.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text)`,wordBreak:`break-word`},children:n.message})]}):(0,L.jsxs)(`div`,{children:[n.context&&(0,L.jsx)(`div`,{style:{fontSize:`var(--text-xs)`,color:`var(--text-dim)`,marginBottom:6},children:n.context}),(0,L.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text)`,wordBreak:`break-word`},children:n.message})]})})}),(0,L.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8,marginTop:16},children:[r>1&&(0,L.jsx)(`button`,{type:`button`,onClick:Bn,style:{border:`1px solid var(--border)`,background:`none`,color:`var(--text-muted)`,borderRadius:6,padding:`4px 12px`,fontSize:`var(--text-sm)`,cursor:`pointer`},children:e(`errors.clearAll`)}),(0,L.jsx)(`button`,{type:`button`,onClick:zn,style:{border:`none`,background:`var(--accent)`,color:`#fff`,borderRadius:6,padding:`4px 14px`,fontSize:`var(--text-sm)`,cursor:`pointer`},children:e(`errors.close`)})]})]})]})})}var o9=[],Lte=1,s9=new Set;function c9(){for(let e of s9)e()}function Rte(e){return s9.add(e),()=>{s9.delete(e)}}function l9(){return o9}function zte(e){let t={id:Lte++,label:e??``};o9=[...o9,t],c9();let n=!1;return()=>{n||(n=!0,o9=o9.filter(e=>e.id!==t.id),c9())}}var u9=new WeakMap;function Bte(e){if(!e.isConnected)return()=>{};let t=u9.get(e);if(!t){let n=document.createElement(`div`);n.style.cssText=`position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb, var(--bg) 50%, transparent);z-index:5;`,n.innerHTML=`<div style="width:16px;height:16px;border:2px solid var(--border);border-top-color:var(--text-dim);border-radius:50%;animation:spin 0.8s linear infinite;"></div>`;let r=null;getComputedStyle(e).position===`static`&&(r=e.style.position,e.style.position=`relative`),e.appendChild(n),t={count:0,el:n,prevPosition:r},u9.set(e,t)}t.count++;let n=!1;return()=>{n||(n=!0,t.count--,t.count<=0&&(t.el.remove(),t.prevPosition!==null&&(t.prevPosition?e.style.position=t.prevPosition:e.style.removeProperty(`position`)),u9.delete(e)))}}async function Vte(e){try{return await e.json()}catch{return null}}async function d9(e,t,n){let r=n?.loading??`fullscreen`,i=r===`fullscreen`?zte(n?.label):r instanceof HTMLElement?Bte(r):null;try{let n;try{n=await fetch(e,t)}catch(e){throw new An(e instanceof Error?e.message:`Network error`,0)}if(!n.ok){let e=await Vte(n);throw new An(e&&typeof e==`object`&&`error`in e&&typeof e.error==`string`?e.error:`HTTP ${n.status}`,n.status,e)}let r=await n.text();return r?JSON.parse(r):void 0}catch(e){throw e instanceof An?e:new An(e instanceof Error?e.message:String(e),0)}finally{i?.()}}var f9={},Hte=6e4;function p9(e,t){return e===`Not found`?t(`files.notFound`):e===`Access denied`?t(`files.accessDenied`):e}async function m9(e,t){return((await d9(`/api/files/${yO(e)}?type=list`,void 0,t)).entries??[]).map(t=>({name:t.name,fullPath:CO(e,t.name),isDir:t.isDir,size:t.size,children:t.isDir?[]:void 0,loaded:!t.isDir}))}async function h9(e,t){return d9(`/api/git/status?${new URLSearchParams({cwd:e}).toString()}`,void 0,t)}var g9={modified:`files.modified`,added:`files.added`,deleted:`files.deleted`,renamed:`files.renamed`,untracked:`files.untracked`,conflict:`files.conflict`},_9={modified:`var(--status-warning)`,added:`var(--status-success)`,deleted:`var(--status-error)`,renamed:`var(--accent)`,untracked:`var(--status-success)`,conflict:`var(--status-error)`};function v9({status:e,t}){return(0,L.jsx)(`span`,{title:t(g9[e.status]),"aria-label":t(g9[e.status]),style:{width:14,height:14,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`,color:_9[e.status],fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,fontWeight:600},children:e.code})}function Ute(e,t,n,r){return new Promise((i,a)=>{let o=new FormData;t.forEach(e=>o.append(`files`,e,e.name));let s=new XMLHttpRequest;s.open(`POST`,`/api/files/${yO(e)}?type=upload&conflict=${n}`),s.upload.onprogress=e=>{e.lengthComputable&&e.total>0&&r(Math.round(e.loaded/e.total*100))},s.onerror=()=>a(Error(`Network error while uploading files`)),s.onabort=()=>a(Error(`Upload cancelled`)),s.onload=()=>{let e={};try{e=JSON.parse(s.responseText)}catch{s.responseText&&(e.error=s.responseText)}i({status:s.status,data:e})},s.send(o)})}function y9({size:e=11}){return(0,L.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,L.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,L.jsx)(`path`,{d:`M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8`})]})}function b9({onClick:e,title:t}){return(0,L.jsx)(rr,{label:t,children:(0,L.jsx)(`button`,{type:`button`,onClick:e,"aria-label":t,style:{width:24,height:24,padding:0,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,border:`none`,borderRadius:4,background:`none`,color:`var(--text-dim)`,cursor:`pointer`,"--hover-color":`var(--text-muted)`,"--hover-bg":`var(--bg-hover)`},className:`hover-shift`,children:(0,L.jsxs)(`svg`,{width:z.lg,height:z.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,L.jsx)(`path`,{d:`m6 6 12 12`}),(0,L.jsx)(`path`,{d:`m18 6-12 12`})]})})})}function x9({node:e,depth:t,cwd:n,onOpenFile:r,onAtMention:i,expandedPaths:a,onToggleExpanded:o,refreshToken:s,highlightedPaths:c,gitStatusByPath:l,changedDirectoryPaths:u,t:d}){let f=a.has(e.fullPath),p=c.has(e.fullPath),m=vO(e.fullPath),h=l.get(m),g=e.isDir&&(h!==void 0||u.has(m)),[v,y]=(0,_.useState)(e.children??[]),[b,x]=(0,_.useState)(e.loaded??!1),[S,C]=(0,_.useState)(!1),w=(0,_.useCallback)(async(t=!1)=>{if(!(b&&!t))try{let t=await m9(e.fullPath,{loading:`silent`});y(t),x(!0)}catch{}},[b,e.fullPath]);(0,_.useEffect)(()=>{f&&b&&w(!0)},[s]);let T=(0,_.useCallback)(()=>{if(e.isDir){let t=!f;o(e.fullPath,t),t&&!b&&w()}else r(e.fullPath,e.name)},[e.isDir,e.fullPath,e.name,b,f,w,r,o]);return(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{onClick:T,onMouseEnter:()=>C(!0),onMouseLeave:()=>C(!1),style:{position:`relative`,display:`flex`,alignItems:`center`,gap:4,paddingLeft:8+t*14,paddingRight:8,height:24,cursor:`pointer`,background:S?`var(--bg-hover)`:`transparent`,borderRadius:4,userSelect:`none`},children:[e.isDir&&(0,L.jsx)(`svg`,{width:z.xs,height:z.xs,viewBox:`0 0 10 10`,fill:`none`,stroke:`var(--text-dim)`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0,transform:f?`rotate(90deg)`:`none`,transition:`transform 0.1s`},children:(0,L.jsx)(`polyline`,{points:`3 2 7 5 3 8`})}),!e.isDir&&(0,L.jsx)(`span`,{style:{width:10,flexShrink:0}}),(0,L.jsx)(`span`,{style:{flexShrink:0,display:`flex`,alignItems:`center`},children:e.isDir?(0,L.jsx)(FG,{size:z.xl,open:f}):lK(e.name,14)}),(0,L.jsx)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--text)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,flex:1},title:e.fullPath,children:e.name}),p&&(0,L.jsx)(`span`,{title:d(`files.newlyUploaded`),"aria-label":d(`files.newlyUploaded`),style:{width:14,height:14,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,L.jsx)(`span`,{style:{width:6,height:6,borderRadius:`50%`,background:`var(--accent)`}})}),!S&&!e.isDir&&h&&(0,L.jsx)(v9,{status:h,t:d}),!S&&g&&(0,L.jsx)(`span`,{title:d(`files.containsChangedFiles`),"aria-label":d(`files.containsChangedFiles`),style:{width:14,height:14,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,L.jsx)(`span`,{style:{width:6,height:6,borderRadius:`50%`,background:`var(--status-warning)`}})}),i&&S&&(0,L.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),i(SO(e.fullPath,n),e.isDir)},title:d(`files.insertPath`),style:{position:`absolute`,right:e.isDir?4:28,top:`50%`,transform:`translateY(-50%)`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:4,padding:`0 8px`,height:20,background:`var(--bg-panel)`,border:`1px solid var(--border)`,borderRadius:4,color:`var(--accent)`,cursor:`pointer`,fontSize:`var(--text-sm)`,fontWeight:600,whiteSpace:`nowrap`},children:[(0,L.jsx)(y9,{}),d(`files.mention`)]}),S&&!e.isDir&&(0,L.jsx)(`a`,{href:`/api/files/${yO(e.fullPath)}?type=download`,download:!0,onClick:e=>e.stopPropagation(),title:d(`files.download`),style:{position:`absolute`,right:4,top:`50%`,transform:`translateY(-50%)`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:4,padding:`0 5px`,height:20,background:`var(--bg-panel)`,border:`1px solid var(--border)`,borderRadius:4,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-sm)`,fontWeight:600,whiteSpace:`nowrap`,textDecoration:`none`},children:(0,L.jsxs)(`svg`,{width:z.sm,height:z.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,L.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,L.jsx)(`polyline`,{points:`7 10 12 15 17 10`}),(0,L.jsx)(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]})})]}),e.isDir&&f&&(0,L.jsxs)(`div`,{children:[v.map(e=>(0,L.jsx)(x9,{node:e,depth:t+1,cwd:n,onOpenFile:r,onAtMention:i,expandedPaths:a,onToggleExpanded:o,refreshToken:s,highlightedPaths:c,gitStatusByPath:l,changedDirectoryPaths:u,t:d},e.fullPath)),v.length===0&&b&&(0,L.jsx)(`div`,{style:{paddingLeft:8+(t+1)*14,fontSize:`var(--text-sm)`,color:`var(--text-dim)`,height:22,display:`flex`,alignItems:`center`},children:d(`files.empty`)})]})]})}function S9({status:e,cwd:t,onOpenFile:n,onStageToggle:r,unstage:i,t:a}){let o=bO(e.filePath),s=SO(e.filePath,t);return(0,L.jsxs)(`div`,{"data-testid":`git-change-row`,onClick:()=>n(e.filePath,o,{modeHint:`diff`}),className:`git-change-row row-hover-bg`,title:e.filePath,style:{display:`flex`,alignItems:`center`,gap:6,paddingLeft:10,paddingRight:8,height:24,cursor:`pointer`,borderRadius:4,userSelect:`none`},children:[r!==void 0&&(0,L.jsx)(`button`,{type:`button`,"data-testid":`git-stage-toggle`,onClick:t=>{t.stopPropagation(),r(e)},"aria-label":a(i?`files.unstageFile`:`files.stageFile`),style:{width:16,height:16,padding:0,marginLeft:-4,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,border:`none`,borderRadius:4,background:`none`,color:`var(--text-dim)`,cursor:`pointer`,"--hover-color":`var(--text-muted)`,"--hover-bg":`var(--bg-hover)`},className:`hover-shift`,children:(0,L.jsx)(`svg`,{width:z.sm,height:z.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`,"aria-hidden":`true`,children:i?(0,L.jsx)(`path`,{d:`M6 12h12`}):(0,L.jsx)(`path`,{d:`M12 5v14M5 12h14`})})}),(0,L.jsx)(v9,{status:e,t:a}),(0,L.jsx)(`span`,{style:{flexShrink:0,display:`flex`,alignItems:`center`,opacity:.85},children:lK(o,13)}),(0,L.jsx)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--text)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,flex:1},children:s}),e.lineStats&&(e.lineStats.additions>0||e.lineStats.deletions>0)&&(0,L.jsxs)(`span`,{style:{flexShrink:0,display:`flex`,alignItems:`center`,gap:5,fontFamily:`var(--font-mono)`,fontSize:`var(--text-xs)`,fontVariantNumeric:`tabular-nums`},children:[e.lineStats.additions>0&&(0,L.jsxs)(`span`,{style:{color:`var(--status-success)`},children:[`+`,e.lineStats.additions]}),e.lineStats.deletions>0&&(0,L.jsxs)(`span`,{style:{color:`var(--status-error)`},children:[`-`,e.lineStats.deletions]})]})]})}function Wte({message:e,onMessageChange:t,commitBusy:n,canCommit:r,onCommit:i,pushBusy:a,canPush:o,onPush:s,pullBusy:c,canPull:l,onPull:u,aiBusy:d,canAiGenerate:f,onAiGenerate:p,autoGenerateOnEmpty:m,hasModelForAuto:h,aiModelHint:g,t:v}){let y=(0,_.useRef)(null),b=e.trim()===``,x=b&&m&&h&&f&&!d,S=n||!x&&b||!r;return(0,_.useLayoutEffect)(()=>{let e=y.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,120)}px`)},[e]),(0,L.jsx)(`div`,{style:{display:`flex`,padding:`4px 2px 6px`},children:(0,L.jsxs)(`div`,{style:{position:`relative`,display:`flex`,flexDirection:`column`,flex:1,minWidth:0,backgroundColor:`var(--bg)`,backgroundImage:n||d||a||c?`linear-gradient(90deg, transparent 13%, color-mix(in srgb, var(--accent) 18%, transparent) 25%, transparent 37%, transparent 63%, color-mix(in srgb, var(--shine-highlight) 50%, transparent) 75%, transparent 87%)`:void 0,backgroundSize:n||d||a||c?`200% 100%`:void 0,animation:n||d||a||c?`pi-status-shine 1.5s linear infinite`:void 0,borderRadius:6,border:`1px solid var(--border)`},children:[(0,L.jsx)(`textarea`,{ref:y,"data-testid":`git-commit-message`,value:e,disabled:n||d||a||c,placeholder:d?g?`${v(`git.ai.generating`)}(${g})`:v(`git.ai.generating`):v(`files.commitMessagePlaceholder`),onChange:e=>t(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),S||i())},rows:1,style:{flex:`0 1 auto`,minWidth:0,resize:`none`,boxSizing:`content-box`,overflowY:`auto`,maxHeight:120,fontSize:`var(--text-base)`,lineHeight:1.4,padding:`4px 6px`,color:n||d||a||c?`var(--text-dim)`:`var(--text)`,background:`transparent`,border:`none`,borderRadius:6,outline:`none`}}),(0,L.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:4,padding:`2px 6px 4px`},children:[(0,L.jsx)(rr,{label:(()=>{let e=v(d?`git.ai.generating`:`git.ai.generate`);return g?`${e}(${g})`:e})(),children:(0,L.jsx)(`button`,{onClick:p,disabled:d||!f||n||a||c,"aria-label":v(`git.ai.generate`),style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:36,height:30,padding:0,flexShrink:0,background:`none`,border:`1px solid transparent`,borderRadius:6,color:d||!f||n||a||c?`var(--text-dim)`:`var(--accent)`,cursor:d||!f||n||a||c?`default`:`pointer`},children:d?(0,L.jsx)(de,{size:z.lg,style:{animation:`spin 0.8s linear infinite`}}):(0,L.jsx)(Oe,{size:z.lg})})}),(0,L.jsx)(rr,{label:n?v(`files.committing`):S&&b&&!x?v(`files.commitMessageRequired`):x?`${v(`git.ai.generateAndCommit`)} (Ctrl+Enter)`:`${v(`files.commit`)} (Ctrl+Enter)`,children:(0,L.jsx)(`button`,{"data-testid":`git-commit`,onClick:i,disabled:S||c,"aria-label":v(`files.commit`),style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:36,height:30,padding:0,flexShrink:0,background:`none`,border:`1px solid transparent`,borderRadius:6,color:S||c?`var(--text-dim)`:`var(--accent)`,cursor:S||c?`default`:`pointer`},children:n?(0,L.jsx)(de,{size:z[`2xl`],style:{animation:`spin 0.8s linear infinite`}}):(0,L.jsx)(ae,{size:z[`2xl`]})})}),(0,L.jsx)(rr,{label:v(a?`files.pushing`:o?`files.push`:`files.pushUpToDate`),children:(0,L.jsx)(`button`,{"data-testid":`git-push`,onClick:s,disabled:a||n||c||!o,"aria-label":v(`files.push`),style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:36,height:30,padding:0,flexShrink:0,background:`none`,border:`1px solid transparent`,borderRadius:6,color:a||n||c||!o?`var(--text-dim)`:`var(--accent)`,cursor:a||n||c||!o?`default`:`pointer`},children:a?(0,L.jsx)(de,{size:z.lg,style:{animation:`spin 0.8s linear infinite`}}):(0,L.jsx)(A,{size:z[`2xl`]})})}),(0,L.jsx)(rr,{label:v(c?`files.pulling`:l?`files.pull`:`files.pullUpToDate`),children:(0,L.jsx)(`button`,{"data-testid":`git-pull`,onClick:u,disabled:c||n||a||!l,"aria-label":v(`files.pull`),style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:36,height:30,padding:0,flexShrink:0,background:`none`,border:`1px solid transparent`,borderRadius:6,color:c||n||a||!l?`var(--text-dim)`:`var(--accent)`,cursor:c||n||a||!l?`default`:`pointer`},children:c?(0,L.jsx)(de,{size:z.lg,style:{animation:`spin 0.8s linear infinite`}}):(0,L.jsx)(k,{size:z[`2xl`]})})})]})]})})}function C9({prefix:e,count:t,additions:n,deletions:r,t:i}){return(0,L.jsxs)(`div`,{"aria-label":i(`files.changeStats`,{count:t,additions:n,deletions:r}),style:{display:`flex`,alignItems:`center`,gap:6,height:24,padding:`0 10px`,fontSize:`var(--text-base)`},children:[e&&(0,L.jsx)(`span`,{style:{color:`var(--text-dim)`},children:e}),(0,L.jsx)(`span`,{style:{color:`var(--text-dim)`},children:i(`files.changedCount`,{count:t})}),(0,L.jsxs)(`span`,{style:{color:_9.added,fontFamily:`var(--font-mono)`},children:[`+`,n]}),(0,L.jsxs)(`span`,{style:{color:_9.deleted,fontFamily:`var(--font-mono)`},children:[`-`,r]})]})}function w9({message:e,onDismiss:t}){let{t:n}=R();return(0,L.jsxs)(`div`,{role:`alert`,style:{display:`flex`,alignItems:`center`,gap:6,marginTop:4,padding:`6px 8px`,fontSize:`var(--text-sm)`,lineHeight:1.35,color:`var(--status-error)`,background:`var(--bg)`,border:`1px solid var(--status-error)`,borderRadius:6},children:[(0,L.jsx)(`span`,{style:{minWidth:0,flex:1,overflowWrap:`anywhere`,maxHeight:140,overflowY:`auto`,whiteSpace:`pre-wrap`},children:e}),(0,L.jsx)(b9,{onClick:t,title:n(`files.dismissError`)})]})}function Gte({children:e}){return(0,L.jsx)(`div`,{style:{padding:`0 4px 2px`},children:e})}var Kte=(0,_.forwardRef)(function({children:e},t){return(0,L.jsx)(`div`,{ref:t,style:{padding:`2px 4px`},children:e})}),qte=(0,_.forwardRef)(function({cwd:e,onOpenFile:t,refreshKey:n,searchQuery:r,onAtMention:i,onAtMentions:a,onUploadBusyChange:o,changesCollapsed:s,onChangesCountChange:c,sessionId:l,onOpenConfig:u},d){let{t:f}=R(),[p,m]=(0,_.useState)([]),[h,g]=(0,_.useState)(!0),[v,y]=(0,_.useState)(null),b=(0,_.useRef)(null),[x,S]=(0,_.useState)(new Set),[C,w]=(0,_.useState)(0),T=(r??``).trim().toLowerCase(),E=(0,_.useMemo)(()=>{if(!T)return p;function e(t){if(t.name.toLowerCase().includes(T))return t;if(t.isDir&&t.children){let n=t.children.map(e).filter(e=>e!==null);if(n.length>0)return{...t,children:n}}return null}return p.map(e).filter(e=>e!==null)},[p,T]),[D,O]=(0,_.useState)(new Set),[k,A]=(0,_.useState)([]),[j,M]=(0,_.useState)({additions:0,deletions:0}),[N,ee]=(0,_.useState)([]),[te,P]=(0,_.useState)({additions:0,deletions:0}),ne=(0,_.useMemo)(()=>T?N.filter(t=>SO(t.filePath,e).toLowerCase().includes(T)):N,[N,T,e]),re=(0,_.useMemo)(()=>T?k.filter(t=>SO(t.filePath,e).toLowerCase().includes(T)):k,[k,T,e]),[ie,ae]=(0,_.useState)({branch:null,upstream:null,ahead:0,behind:0,hasUpstream:!1}),[oe,F]=(0,_.useState)(null),[I,se]=(0,_.useState)(``),[ce,le]=(0,_.useState)(!1),[ue,de]=(0,_.useState)(null),[fe,pe]=(0,_.useState)(!1),[me,he]=(0,_.useState)(!1),[ge,_e]=(0,_.useState)(null),ve=Tr(),ye=(0,_.useRef)(0),[be,xe]=(0,_.useState)(!1),[Se,Ce]=(0,_.useState)(!1),we=(0,_.useSyncExternalStore)(Et.subscribe,()=>Et.get()?.preferences??f9,()=>f9),Te=(0,_.useSyncExternalStore)(wt.subscribe,()=>wt.get()),Ee=we.commitMessageAutoGenerateOnEmpty!==!1,De=we.commitStageAllConfirm!==!1,ke=we.commitMessageUseCurrentModel===!0?!!(l||Te?.defaultModel||(Te?.modelList?.length??0)>0):!!(typeof we.commitMessageModel==`string`&&we.commitMessageModel),[Ae,je]=(0,_.useState)(!1),[Me,Ne]=(0,_.useState)(null),Pe=(0,_.useRef)(null),[Fe,Ie]=(0,_.useState)(!1),[Le,Re]=(0,_.useState)(null),[ze,Ve]=(0,_.useState)(`idle`),[He,Ue]=(0,_.useState)(0),[We,Ge]=(0,_.useState)(null),[Ke,qe]=(0,_.useState)(null),[Je,Ye]=(0,_.useState)(null),Xe=(0,_.useRef)(null),Ze=(0,_.useRef)(null),Qe=`${n??0}:${C}`,$e=ze!==`idle`,et=(0,_.useMemo)(()=>new Map(k.map(e=>[vO(e.filePath),e])),[k]),tt=(0,_.useMemo)(()=>{let t=new Set,n=vO(e).replace(/\/$/,``);for(let e of k){let r=xO(vO(e.filePath));for(;(r===n||r.startsWith(`${n}/`))&&(t.add(r),r!==n);){let e=xO(r);if(e===r)break;r=e}}return t},[e,k]),nt=(0,_.useCallback)((e,t)=>{S(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]),rt=(0,_.useCallback)(t=>{let n=t.uploaded??[],r=t.skipped??[],i=t.errors??[];qe({uploaded:n,skipped:r,errors:i}),n.length>0&&(O(new Set(n.map(t=>CO(e,t)))),w(e=>e+1))},[e]),it=(0,_.useCallback)(async(t,n)=>{Ye(null),Ge(null),Ue(0),Ve(`uploading`);try{let{status:r,data:i}=await Ute(e,t,n,Ue);if(r===409&&i.conflicts?.length){Ye({files:t,conflicts:i.conflicts,nonReplaceable:i.nonReplaceable??[]});return}if(r<200||r>=300)throw Error(i.error??`Upload failed (HTTP ${r})`);Ue(100),rt(i)}catch(e){Ge(e instanceof Error?e.message:String(e))}finally{Ve(`idle`)}},[rt,e]),at=(0,_.useCallback)(async t=>{if(!(t.length===0||$e)){qe(null),O(new Set),Ye(null),Ge(null),Ue(0),Ve(`checking`);try{let n=await d9(`/api/files/${yO(e)}?type=upload-check`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({fileNames:t.map(e=>e.name)})},{loading:`silent`});if(n.conflicts?.length){Ye({files:t,conflicts:n.conflicts,nonReplaceable:n.nonReplaceable??[]});return}await it(t,`error`)}catch(e){Ge(e instanceof Error?e.message:String(e))}finally{Ve(`idle`)}}},[e,it,$e]),ot=(0,_.useCallback)(e=>{let t=Array.from(e.target.files??[]);e.target.value=``,at(t)},[at]);(0,_.useImperativeHandle)(d,()=>({openUploadPicker(){$e||Ze.current?.click()}}),[$e]);let st=(0,_.useCallback)(async()=>{je(!0);try{let t=await d9(`/api/git/push`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:e})},{loading:`silent`});console.info(`[git-push] ok:`,t.output||`(empty output)`),Ne({ok:!0,output:t.output??``})}catch(e){let t=e instanceof Error?e.message:String(e);console.info(`[git-push] failed:`,t),Ne({ok:!1,output:t})}finally{je(!1),w(e=>e+1)}},[e]),ct=(0,_.useCallback)(async()=>{Ie(!0);try{let t=await d9(`/api/git/pull`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:e})},{loading:`silent`});console.info(`[git-pull] ok:`,t.output||`(empty output)`),Re({ok:!0,output:t.output??``})}catch(e){let t=e instanceof Error?e.message:String(e);console.info(`[git-pull] failed:`,t),Re({ok:!1,output:t})}finally{Ie(!1),w(e=>e+1)}},[e]),lt=(()=>{let e=we.gitAutoFetchIntervalSec;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:0})();(0,_.useEffect)(()=>{if(lt<=0||!e)return;let t=()=>{document.hidden||d9(`/api/git/autofetch-status?cwd=${encodeURIComponent(e)}`,{},{loading:`silent`}).then(e=>{e.cached!==!1&&ae(t=>({...t,ahead:e.ahead??t.ahead,behind:e.behind??t.behind}))}).catch(()=>{})};t();let n=setInterval(t,lt*1e3),r=()=>{document.hidden||t()};return document.addEventListener(`visibilitychange`,r),()=>{clearInterval(n),document.removeEventListener(`visibilitychange`,r)}},[e,lt]),(0,_.useEffect)(()=>{if(Pe.current&&clearTimeout(Pe.current),Me)return Pe.current=setTimeout(()=>Ne(null),1e4),()=>{Pe.current&&clearTimeout(Pe.current)}},[Me]);let ut=(0,_.useRef)(null);(0,_.useEffect)(()=>{if(ut.current&&clearTimeout(ut.current),Le)return ut.current=setTimeout(()=>Re(null),1e4),()=>{ut.current&&clearTimeout(ut.current)}},[Le]),(0,_.useEffect)(()=>{o?.($e)},[o,$e]),(0,_.useEffect)(()=>()=>o?.(!1),[o]),(0,_.useEffect)(()=>{let t=Xe.current!==e;Xe.current=e,t&&(S(new Set),O(new Set),qe(null),Ye(null),Ge(null)),y(null),g(t);let n=!1;return m9(e,{loading:`silent`}).then(e=>{n||m(e)}).catch(e=>{n||(y(e instanceof Error?e.message:String(e)),In(e,`file explorer`))}).finally(()=>{n||g(!1)}),()=>{n=!0}},[e,n,C]),(0,_.useEffect)(()=>{let t=!1;return h9(e,{loading:`silent`}).then(e=>{if(!t){let t=e.isGitRepository;A(t?e.files:[]),M(t?{additions:e.additions,deletions:e.deletions}:{additions:0,deletions:0}),ee(t?e.stagedFiles:[]),P(t?{additions:e.stagedAdditions,deletions:e.stagedDeletions}:{additions:0,deletions:0}),ae(t?{branch:e.branch??null,upstream:e.upstream??null,ahead:e.ahead??0,behind:e.behind??0,hasUpstream:e.hasUpstream??!1}:{branch:null,upstream:null,ahead:0,behind:0,hasUpstream:!1})}}).catch(()=>{t||(A([]),M({additions:0,deletions:0}),ee([]),P({additions:0,deletions:0}),ae({branch:null,upstream:null,ahead:0,behind:0,hasUpstream:!1}))}),()=>{t=!0}},[e,n,C]);let dt=(0,_.useCallback)(async(t,n)=>{F(null);try{let r=await fetch(`/api/git/stage`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:e,filePath:t.filePath,action:n?`unstage`:`stage`})}),i=await r.json().catch(()=>({}));if(!r.ok)throw Error(i.error??`Git ${n?`unstage`:`stage`} failed (HTTP ${r.status})`);w(e=>e+1)}catch(e){F(e instanceof Error?e.message:String(e))}},[e]);(0,_.useEffect)(()=>{c?.(k.length+N.length)},[k,N,c]);let ft=(0,_.useCallback)(async(t,n)=>{let r=n??I;le(!0),de(null);try{let n=await fetch(`/api/git/commit`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:e,message:r,stageAll:t})}),i=await n.json().catch(()=>({}));if(!n.ok)throw Error(i.error??`Commit failed (HTTP ${n.status})`);se(``),de(null),pe(!1),w(e=>e+1)}catch(e){de(e instanceof Error?e.message:String(e))}finally{le(!1)}},[e,I]),pt=(0,_.useCallback)(async()=>{if(me||ce||Ae||Se)return null;let t=++ye.current,n=Et.get()?.preferences??{};if(Object.keys(n).length===0)try{await Et.refresh(),n=Et.get()?.preferences??{}}catch{}let r=n.commitMessageUseCurrentModel===!0,i=typeof n.commitMessageModel==`string`?n.commitMessageModel:``,a=``,o=``;if(r){if(l)try{let e=await d9(`/api/agent/${encodeURIComponent(l)}`),t=e.state?.model??e.model??null;if(t){let e=t;a=e.provider??``,o=e.id??e.modelId??``}if(!a||!o)try{let e=await d9(`/api/sessions/${encodeURIComponent(l)}/state`);e.model&&(a=e.model.provider,o=e.model.id)}catch{}}catch{}if(!a||!o)try{let e=wt.get();if(!e?.defaultModel)try{await wt.refresh(),e=wt.get()}catch{}if(e?.defaultModel?.provider){let t=e.defaultModel;a=t.provider??``,o=t.modelId??t.id??``}if((!a||!o)&&e?.modelList?.[0]){let t=e.modelList[0];a=t.provider??``,o=t.modelId??t.id??``}}catch{}if(!a||!o)return _e(f(`git.ai.noSessionModel`)),null}else{if(!i)return xe(!0),null;let e=i.indexOf(`/`);if(e===-1||(a=i.slice(0,e),o=i.slice(e+1),!a||!o))return _e(f(`git.ai.invalidModel`)),null}let s=n.commitMessageMaxTokens,c=typeof s==`number`&&Number.isFinite(s)?Math.min(4096,Math.max(64,Math.round(s))):512;he(!0),_e(null);try{let n=await ve.start(t=>fetch(`/api/git/generate-commit`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:e,provider:a,modelId:o,maxTokens:c}),signal:t}),Hte,{joinKey:`generate`}).promise;if(t!==ye.current)return null;let r=await n.json().catch(()=>({}));if(!n.ok)throw Error(r.error??`Generate failed (HTTP ${n.status})`);if(!r.message)throw Error(`Empty response`);return se(r.message),r.message}catch(e){return t!==ye.current||e instanceof Cr&&e.message===`cancelled`||_e(e instanceof Error?e.message:String(e)),null}finally{t===ye.current&&he(!1)}},[me,ce,Ae,Se,e,l,f,ve]),mt=(0,_.useCallback)(async()=>{let t=await h9(e),n=t.isGitRepository;A(n?t.files:[]),M(n?{additions:t.additions,deletions:t.deletions}:{additions:0,deletions:0}),ee(n?t.stagedFiles:[]),P(n?{additions:t.stagedAdditions,deletions:t.stagedDeletions}:{additions:0,deletions:0}),ae(n?{branch:t.branch??null,upstream:t.upstream??null,ahead:t.ahead??0,behind:t.behind??0,hasUpstream:t.hasUpstream??!1}:{branch:null,upstream:null,ahead:0,behind:0,hasUpstream:!1});let r=I.trim()===``,i=n?t.stagedFiles??[]:[],a=n?t.files??[]:[],o=i.length+a.length>0;if(r&&Ee&&ke&&o&&!me&&!ce&&!Ae&&!Se){Ce(!0);try{let e=await pt();if(!e)return;i.length>0?await ft(!1,e):De?pe(!0):await ft(!0,e)}finally{Ce(!1)}return}i.length>0?ft(!1):De?pe(!0):ft(!0)},[e,I,Ee,ke,De,me,ce,Ae,Se,pt,ft]),ht=$e||Je!==null||We!==null||Ke!==null,gt=(0,_.useCallback)(()=>{!Ke||Ke.uploaded.length===0||a?.(Ke.uploaded.map(t=>SO(CO(e,t),e)))},[e,a,Ke]);return(0,L.jsxs)(`div`,{style:{minHeight:`100%`},children:[(0,L.jsx)(`input`,{ref:Ze,type:`file`,multiple:!0,hidden:!0,onChange:ot}),ht&&(0,L.jsxs)(`div`,{style:{padding:`6px 8px`,borderBottom:`1px solid var(--border)`},children:[$e&&(0,L.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-label":ze===`checking`?f(`files.checking`):f(`files.uploading`,{progress:He}),children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8,minHeight:14,color:`var(--text-muted)`},children:[ze===`checking`?(0,L.jsx)(`svg`,{width:z.lg,height:z.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,style:{animation:`spin 0.8s linear infinite`},"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`M21 12a9 9 0 1 1-5.7-8.4`})}):(0,L.jsxs)(`svg`,{width:z.lg,height:z.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,L.jsx)(`path`,{d:`M12 16V4`}),(0,L.jsx)(`path`,{d:`m7 9 5-5 5 5`}),(0,L.jsx)(`path`,{d:`M5 20h14`})]}),ze===`uploading`&&(0,L.jsxs)(`span`,{style:{fontSize:`var(--text-xs)`},children:[He,`%`]})]}),ze===`uploading`&&(0,L.jsx)(`div`,{style:{height:3,marginTop:4,overflow:`hidden`,borderRadius:2,background:`var(--border)`},children:(0,L.jsx)(`div`,{style:{width:`${He}%`,height:`100%`,background:`var(--text-muted)`,transition:`width 120ms ease`}})})]}),Je&&(0,L.jsxs)(`div`,{role:`alert`,style:{padding:7,border:`1px solid color-mix(in srgb, #f59e0b 55%, var(--border))`,borderRadius:4,background:`color-mix(in srgb, #f59e0b 9%, var(--bg-panel))`},children:[(0,L.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text)`,lineHeight:1.35,overflowWrap:`anywhere`},children:f(`files.conflictSummary`,{count:Je.conflicts.length,countSuffix:Je.conflicts.length===1?``:`s`,files:Je.conflicts.join(`, `)})}),Je.nonReplaceable.length>0&&(0,L.jsx)(`div`,{style:{marginTop:3,fontSize:`var(--text-xs)`,color:`#f59e0b`,lineHeight:1.35,overflowWrap:`anywhere`},children:f(`files.cannotReplace`,{files:Je.nonReplaceable.join(`, `)})}),(0,L.jsxs)(`div`,{style:{display:`flex`,gap:5,marginTop:7},children:[(0,L.jsx)(`button`,{type:`button`,onClick:()=>void it(Je.files,`overwrite`),style:{height:22,padding:`0 7px`,border:`1px solid var(--status-error)`,borderRadius:4,background:`transparent`,color:`var(--status-error)`,cursor:`pointer`,fontSize:`var(--text-xs)`},children:f(`files.replace`)}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>void it(Je.files,`skip`),style:{height:22,padding:`0 7px`,border:`1px solid var(--border)`,borderRadius:4,background:`var(--bg-panel)`,color:`var(--text)`,cursor:`pointer`,fontSize:`var(--text-xs)`},children:f(`files.skipExisting`)}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>Ye(null),style:{height:22,padding:`0 7px`,border:`none`,borderRadius:4,background:`transparent`,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-xs)`},children:f(`files.cancel`)})]})]}),We&&(0,L.jsxs)(`div`,{role:`alert`,style:{display:`flex`,alignItems:`flex-start`,gap:6,fontSize:`var(--text-sm)`,lineHeight:1.35,color:`var(--status-error)`},children:[(0,L.jsx)(`span`,{style:{minWidth:0,flex:1,overflowWrap:`anywhere`},children:We}),(0,L.jsx)(b9,{onClick:()=>Ge(null),title:f(`files.dismissError`)})]}),Ke&&(0,L.jsxs)(`div`,{"aria-live":`polite`,children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,minHeight:22,fontSize:`var(--text-sm)`},children:[(0,L.jsxs)(`div`,{style:{minWidth:0,flex:1,display:`flex`,alignItems:`center`,gap:8},children:[Ke.uploaded.length>0&&(0,L.jsxs)(`span`,{title:`${Ke.uploaded.length} uploaded`,"aria-label":`${Ke.uploaded.length} uploaded`,style:{display:`flex`,alignItems:`center`,gap:3,color:`var(--status-success)`},children:[(0,L.jsx)(`svg`,{width:z.lg,height:z.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`m5 12 4 4L19 6`})}),(0,L.jsx)(`span`,{children:Ke.uploaded.length})]}),Ke.skipped.length>0&&(0,L.jsxs)(`span`,{title:`${Ke.skipped.length} skipped`,"aria-label":`${Ke.skipped.length} skipped`,style:{display:`flex`,alignItems:`center`,gap:3,color:`var(--text-dim)`},children:[(0,L.jsxs)(`svg`,{width:z.lg,height:z.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,L.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,L.jsx)(`path`,{d:`M8 12h8`})]}),(0,L.jsx)(`span`,{children:Ke.skipped.length})]}),Ke.errors.length>0&&(0,L.jsxs)(`span`,{title:f(`files.uploadFailed`,{count:Ke.errors.length}),"aria-label":f(`files.uploadFailed`,{count:Ke.errors.length}),style:{display:`flex`,alignItems:`center`,gap:3,color:`var(--status-error)`},children:[(0,L.jsxs)(`svg`,{width:z.lg,height:z.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,L.jsx)(`path`,{d:`M12 3 2.5 20h19L12 3Z`}),(0,L.jsx)(`path`,{d:`M12 9v4`}),(0,L.jsx)(`path`,{d:`M12 17h.01`})]}),(0,L.jsx)(`span`,{children:Ke.errors.length})]})]}),Ke.uploaded.length>0&&a&&(0,L.jsxs)(`button`,{type:`button`,onClick:gt,title:Ke.uploaded.length===1?f(`files.addUploadedFile`):f(`files.addAllUploadedFiles`),"aria-label":Ke.uploaded.length===1?f(`files.addUploadedFile`):f(`files.addAllUploadedFiles`),style:{height:22,padding:`0 7px`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:4,flexShrink:0,border:`1px solid var(--border)`,borderRadius:4,background:`var(--bg-panel)`,color:`var(--accent)`,cursor:`pointer`,fontSize:`var(--text-sm)`,fontWeight:600,whiteSpace:`nowrap`},children:[(0,L.jsx)(y9,{}),f(`files.mention`)]}),(0,L.jsx)(b9,{onClick:()=>qe(null),title:f(`files.dismissUploadResults`)})]}),Ke.errors.map(e=>(0,L.jsxs)(`div`,{title:e.error,style:{display:`flex`,alignItems:`center`,gap:4,marginTop:3,minWidth:0,fontSize:`var(--text-xs)`,color:`var(--status-error)`},children:[(0,L.jsxs)(`svg`,{width:z.sm,height:z.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0},"aria-hidden":`true`,children:[(0,L.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,L.jsx)(`path`,{d:`M12 8v5`}),(0,L.jsx)(`path`,{d:`M12 17h.01`})]}),(0,L.jsx)(`span`,{style:{minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.name})]},e.name))]})]}),!s&&(0,L.jsxs)(Gte,{children:[(0,L.jsx)(Wte,{message:I,onMessageChange:se,commitBusy:ce||Se,canCommit:N.length+k.length>0,onCommit:mt,pushBusy:Ae,canPush:ie.hasUpstream?ie.ahead>0:!!ie.branch&&ie.branch!==`HEAD`,onPush:st,pullBusy:Fe,canPull:ie.hasUpstream&&ie.behind>0,onPull:ct,aiBusy:me,canAiGenerate:N.length+k.length>0,onAiGenerate:()=>{se(``),pt()},autoGenerateOnEmpty:Ee,hasModelForAuto:ke,aiModelHint:(()=>{if(we.commitMessageUseCurrentModel===!0)return f(`git.ai.usingCurrentModel`);let e=typeof we.commitMessageModel==`string`?we.commitMessageModel:``;return e?f(`git.ai.usingModel`,{model:e}):``})(),t:f}),Me&&(0,L.jsxs)(`div`,{role:`status`,"aria-live":`polite`,style:{marginTop:4,padding:`6px 8px`,borderRadius:6,border:`1px solid ${Me.ok?`var(--status-success)`:`var(--status-error)`}`,background:`var(--bg)`,fontSize:`var(--text-sm)`,lineHeight:1.5},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:4},children:[(0,L.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:Me.ok?`var(--status-success)`:`var(--status-error)`,flexShrink:0}}),(0,L.jsx)(`span`,{style:{color:`var(--text-muted)`,flex:1,minWidth:0},children:f(Me.ok?`files.pushSuccess`:`files.pushFailed`)}),(0,L.jsx)(`button`,{onClick:()=>Ne(null),"aria-label":f(`files.dismissError`),style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:16,height:16,padding:0,background:`none`,border:`none`,borderRadius:4,color:`var(--text-dim)`,cursor:`pointer`,flexShrink:0},children:(0,L.jsx)(Be,{size:z.base})})]}),Me.output&&(0,L.jsx)(`pre`,{style:{margin:0,maxHeight:140,overflow:`auto`,whiteSpace:`pre-wrap`,wordBreak:`break-all`,color:Me.ok?`var(--text-muted)`:`var(--status-error)`,fontFamily:`var(--font-mono)`},children:Me.output})]}),Le&&(0,L.jsxs)(`div`,{role:`status`,"aria-live":`polite`,style:{marginTop:4,padding:`6px 8px`,borderRadius:6,border:`1px solid ${Le.ok?`var(--status-success)`:`var(--status-error)`}`,background:`var(--bg)`,fontSize:`var(--text-sm)`,lineHeight:1.5},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:4},children:[(0,L.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:Le.ok?`var(--status-success)`:`var(--status-error)`,flexShrink:0}}),(0,L.jsx)(`span`,{style:{color:`var(--text-muted)`,flex:1,minWidth:0},children:f(Le.ok?`files.pullSuccess`:`files.pullFailed`)}),(0,L.jsx)(`button`,{onClick:()=>Re(null),"aria-label":f(`files.dismissError`),style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:16,height:16,padding:0,background:`none`,border:`none`,borderRadius:4,color:`var(--text-dim)`,cursor:`pointer`,flexShrink:0},children:(0,L.jsx)(Be,{size:z.base})})]}),Le.output&&(0,L.jsx)(`pre`,{style:{margin:0,maxHeight:140,overflow:`auto`,whiteSpace:`pre-wrap`,wordBreak:`break-all`,color:Le.ok?`var(--text-muted)`:`var(--status-error)`,fontFamily:`var(--font-mono)`},children:Le.output})]}),ue&&(0,L.jsx)(w9,{message:ue,onDismiss:()=>de(null)}),oe&&(0,L.jsx)(w9,{message:p9(oe,f),onDismiss:()=>F(null)}),ge&&(0,L.jsx)(w9,{message:ge,onDismiss:()=>_e(null)}),(0,L.jsx)(C9,{prefix:f(`files.stagedPrefix`),count:ne.length,additions:te.additions,deletions:te.deletions,t:f}),ne.length>0?ne.map(n=>(0,L.jsx)(S9,{status:n,cwd:e,onOpenFile:t,onStageToggle:e=>void dt(e,!0),unstage:!0,t:f},`staged-${n.filePath}`)):(0,L.jsx)(`div`,{style:{padding:`8px 10px`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`,textAlign:`center`},children:f(`files.noStagedChanges`)}),(0,L.jsx)(`div`,{style:{height:6}}),(0,L.jsx)(C9,{prefix:f(`files.unstagedPrefix`),count:re.length,additions:j.additions,deletions:j.deletions,t:f}),re.length>0?re.map(n=>(0,L.jsx)(S9,{status:n,cwd:e,onOpenFile:t,onStageToggle:e=>void dt(e,!1),t:f},n.filePath)):(0,L.jsx)(`div`,{style:{padding:`8px 10px`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`,textAlign:`center`},children:f(`files.noUnstagedChanges`)})]}),s&&(0,L.jsxs)(Kte,{ref:b,children:[v?(0,L.jsx)(`div`,{style:{padding:`8px 12px`,fontSize:`var(--text-sm)`,color:`var(--status-error)`},children:p9(v,f)}):(T?E:p).map(n=>(0,L.jsx)(x9,{node:n,depth:0,cwd:e,onOpenFile:t,onAtMention:i,expandedPaths:x,onToggleExpanded:nt,refreshToken:Qe,highlightedPaths:D,gitStatusByPath:et,changedDirectoryPaths:tt,t:f},n.fullPath)),!h&&!v&&p.length===0&&(0,L.jsx)(`div`,{style:{padding:`8px 12px`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:f(`files.noFiles`)})]}),(0,L.jsx)(Yp,{open:be,title:f(`git.ai.notConfiguredTitle`),description:f(`git.ai.notConfiguredDesc`),confirmText:f(`git.ai.goToConfig`),cancelText:f(`sidebar.cancel`),onCancel:()=>xe(!1),onConfirm:()=>{xe(!1),u?.(`git`)},icon:(0,L.jsx)(Oe,{size:z[`5xl`],style:{color:`var(--accent)`}})}),(0,L.jsx)(Yp,{open:fe,title:f(`files.commitTitle`),description:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{children:f(`files.confirmStageAllCommit`,{count:k.length})}),I.trim()!==``&&(0,L.jsx)(`div`,{style:{marginTop:8,padding:`6px 10px`,background:`var(--bg)`,border:`1px solid var(--border)`,borderRadius:6,fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,color:`var(--text-muted)`,whiteSpace:`pre-wrap`,wordBreak:`break-word`,maxHeight:120,overflowY:`auto`,textAlign:`left`},children:I.trim()})]}),confirmText:f(`files.stageAllAndCommit`),cancelText:f(`sidebar.cancel`),onCancel:()=>pe(!1),onConfirm:()=>{pe(!1),ft(!0)},icon:(0,L.jsxs)(`svg`,{width:z[`5xl`],height:z[`5xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`var(--status-warning)`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,style:{flexShrink:0,marginTop:1},children:[(0,L.jsx)(`path`,{d:`M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10Z`}),(0,L.jsx)(`path`,{d:`m9 12 2 2 4-4`})]})})]})});function T9({visible:e=!0,gap:t=4,items:n}){return e?(0,L.jsx)(`div`,{style:{display:`flex`,gap:t,flexShrink:0},children:n.map(e=>(0,L.jsx)(rr,{label:e.title,children:(0,L.jsx)(`button`,{type:`button`,onClick:e.onClick,disabled:e.disabled,"data-testid":e.testId,"aria-label":e.title,"aria-pressed":e.ariaPressed,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:32,height:32,padding:0,background:e.background??`transparent`,border:`1px solid ${e.borderColor??`var(--border)`}`,borderRadius:7,color:e.color??`var(--text-muted)`,cursor:e.disabled?`default`:`pointer`,flexShrink:0,opacity:e.disabled?.6:1,transition:`background 0.12s, color 0.12s, border-color 0.12s`,"--hover-bg":e.danger?`color-mix(in srgb, var(--status-error) 8%, transparent)`:`var(--bg-selected)`,"--hover-color":e.danger?`var(--status-error)`:`var(--accent)`,"--hover-border":e.danger?`color-mix(in srgb, var(--status-error) 35%, transparent)`:`color-mix(in srgb, var(--accent) 35%, transparent)`},className:e.skipHover?void 0:`hover-shift`,children:e.icon})},e.key))}):null}var E9=2;function Jte({scrollStepPx:e=200,wrapperStyle:t,children:n,testId:r,hintTestId:i}){let a=(0,_.useRef)(null),[o,s]=(0,_.useState)({scrollHeight:0,clientHeight:0,scrollTop:0}),c=(0,_.useCallback)(()=>{if(document.hidden)return;let e=a.current;e&&s({scrollHeight:e.scrollHeight,clientHeight:e.clientHeight,scrollTop:e.scrollTop})},[]);(0,_.useLayoutEffect)(()=>{c();let e=a.current;if(!e)return;let t=new ResizeObserver(c);return t.observe(e),()=>t.disconnect()},[c]);let{scrollHeight:l,clientHeight:u,scrollTop:d}=o,f=l-u>20,p=d<=E9,m=d+u>=l-E9,h=t=>{let n=a.current;if(!n)return;let r=Math.max(0,n.scrollHeight-n.clientHeight);n.scrollTo({top:Math.max(0,Math.min(r,n.scrollTop+t*e)),behavior:`smooth`})},g=e=>{let t=a.current;t&&t.scrollTo({top:e===`top`?0:Math.max(0,t.scrollHeight-t.clientHeight),behavior:`smooth`})};return(0,L.jsxs)(`div`,{style:{position:`relative`,...t},children:[(0,L.jsx)(`div`,{ref:a,"data-testid":r,onScroll:c,style:{position:`absolute`,inset:0,overflowY:`auto`,overflowX:`hidden`,padding:0},children:n}),f&&!p&&(0,L.jsx)(mK,{direction:`up`,visible:!0,testId:i?`${i}-scroll-up`:void 0,onHover:()=>h(-1),onClick:()=>g(`top`)}),f&&!m&&(0,L.jsx)(mK,{direction:`down`,visible:!0,testId:i?`${i}-scroll-down`:void 0,onHover:()=>h(1),onClick:()=>g(`bottom`)})]})}function Yte({...e}){return(0,L.jsx)(ja,{"data-slot":`collapsible`,...e})}function Xte({...e}){return(0,L.jsx)(Ea,{"data-slot":`collapsible-trigger`,...e})}function Zte({...e}){return(0,L.jsx)(Oa,{"data-slot":`collapsible-content`,...e})}function Qte({title:e,titleTooltip:t,open:n,onToggle:r,collapsible:i=!0,actions:a,expandedFlex:o=`1 1 0`,style:s,children:c}){return(0,L.jsxs)(Yte,{open:n,onOpenChange:r,style:{borderTop:`1px solid var(--border)`,display:`flex`,flexDirection:`column`,flex:n?o:`0 0 auto`,minHeight:0,overflow:`hidden`,...s},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,flexShrink:0,background:`var(--bg-panel)`},children:[(0,L.jsx)(rr,{label:t??e,children:(0,L.jsx)(Xte,{asChild:!0,children:(0,L.jsxs)(`button`,{type:`button`,disabled:!i,style:{display:`flex`,alignItems:`center`,gap:6,flex:`0 0 auto`,height:36,padding:`0 12px`,background:`none`,border:`none`,color:`var(--text-muted)`,cursor:i?`pointer`:`default`,fontSize:`var(--text-base)`,fontWeight:600,letterSpacing:`0.05em`,textTransform:`none`,textAlign:`left`},children:[i&&(0,L.jsx)(`svg`,{width:z.xs,height:z.xs,viewBox:`0 0 10 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{transform:n?`rotate(90deg)`:`none`,transition:`transform 0.15s`,flexShrink:0},children:(0,L.jsx)(`polyline`,{points:`3 2 7 5 3 8`})}),(0,L.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e})]})})}),a&&(0,L.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,marginLeft:`auto`,minWidth:0,gap:6,flexShrink:1,paddingRight:4},children:a})]}),(0,L.jsx)(Zte,{style:{display:`flex`,flexDirection:`column`,minHeight:0,flex:1},children:c})]})}function D9({title:e,titleTooltip:t,open:n,onToggle:r,collapsible:i=!0,actions:a,headerExtra:o,expandedFlex:s=`1 1 0`,scrollStepPx:c=200,testId:l,hintTestId:u,rootTestId:d,scrollStyle:f,style:p,children:m}){return(0,L.jsx)(`div`,{"data-testid":d,style:{display:`flex`,flexDirection:`column`,border:`1px solid var(--border)`,borderRadius:0,background:`var(--bg-panel)`,overflow:`hidden`,...p},children:(0,L.jsxs)(Qte,{title:e,titleTooltip:t,open:n,onToggle:r,collapsible:i,actions:a,expandedFlex:s,style:{borderTop:`none`},children:[o,(0,L.jsx)(Jte,{scrollStepPx:c,wrapperStyle:{flex:1,minHeight:0,...f},testId:l,hintTestId:u,children:m})]})})}function $te({cwd:e,onOpenFile:t,explorerRefreshKey:n,onExplorerRefresh:r,onAtMention:i,onAtMentions:a,sessionId:o,onOpenConfig:s}){let{t:c}=R(),[l,u]=(0,_.useState)(0),[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(0),[h,g]=(0,_.useState)(!0),[v,y]=(0,_.useState)(!1),b=(0,_.useRef)(null),x=(0,_.useRef)(null),[S,C]=(0,_.useState)(!1),[T,E]=(0,_.useState)(``),D=(0,_.useRef)(null);return(0,_.useEffect)(()=>{S&&D.current?.focus()},[S]),er(()=>{n!==void 0&&u(e=>e+1)},[n]),e?(0,L.jsx)(D9,{title:c(`files.explorer`),open:!0,onToggle:()=>{},collapsible:!1,testId:`explorer-scroll`,hintTestId:`explorer`,style:{flex:1,minHeight:0},scrollStyle:{background:`var(--bg)`},actions:(0,L.jsx)(T9,{items:[{key:`git`,testId:`explorer-changes-toggle`,onClick:()=>g(e=>!e),title:c(`sidebar.changedFiles`,{count:p}),ariaPressed:!h,color:p>0?`var(--accent)`:`var(--text-muted)`,background:h?void 0:`var(--bg-selected)`,borderColor:h?void 0:`var(--accent)`,icon:(0,L.jsx)(ie,{size:z.lg})},{key:`search`,testId:`explorer-search-toggle`,onClick:()=>{S&&E(``),C(e=>!e)},title:c(`files.search`),ariaPressed:S,color:S?`var(--accent)`:`var(--text-muted)`,background:S?`var(--bg-selected)`:void 0,icon:(0,L.jsx)(we,{size:z.lg})},{key:`upload`,onClick:()=>x.current?.openUploadPicker(),disabled:d,title:c(`sidebar.uploadFilesTitle`),color:`var(--text-muted)`,icon:(0,L.jsx)(ve,{size:z.base})},{key:`refresh`,onClick:()=>{r?r():u(e=>e+1),y(!0),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>y(!1),2e3)},title:c(`sidebar.refreshExplorer`),skipHover:v,color:v?`var(--status-success)`:`var(--text-muted)`,background:v?`color-mix(in srgb, var(--status-success) 18%, transparent)`:void 0,icon:v?(0,L.jsx)(w,{size:z.lg,color:`var(--status-success)`,strokeWidth:2.5}):(0,L.jsx)(be,{size:z.lg})}]}),headerExtra:S?(0,L.jsxs)(`div`,{"data-testid":`explorer-search`,style:{display:`flex`,alignItems:`center`,gap:4,width:`100%`,minWidth:0,padding:`4px 8px`,background:`var(--bg)`,borderBottom:`1px solid var(--border)`,boxSizing:`border-box`},children:[(0,L.jsx)(we,{size:z.lg,color:`var(--text-muted)`,style:{flexShrink:0}}),(0,L.jsx)(`input`,{ref:D,"data-testid":`explorer-search-input`,value:T,onChange:e=>E(e.target.value),placeholder:c(`files.searchPlaceholder`),"aria-label":c(`files.search`),style:{flex:1,minWidth:0,background:`transparent`,border:`none`,outline:`none`,color:`var(--text)`,fontSize:`var(--text-sm)`}}),T&&(0,L.jsx)(`button`,{type:`button`,onClick:()=>{E(``),D.current?.focus()},"aria-label":c(`chat.clearSearch`),style:{border:`none`,background:`transparent`,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-sm)`,display:`flex`,alignItems:`center`,justifyContent:`center`,width:16,height:16,padding:0,flexShrink:0},children:(0,L.jsx)(Be,{size:z.base})})]}):void 0,children:(0,L.jsx)(qte,{ref:x,cwd:e,onOpenFile:t??(()=>{}),refreshKey:l,searchQuery:T,onAtMention:i,onAtMentions:a,onUploadBusyChange:f,changesCollapsed:h,onChangesCountChange:m,sessionId:o,onOpenConfig:s})}):null}var ene=262144,O9=10485760,tne={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,svg:`image/svg+xml`,bmp:`image/bmp`,ico:`image/x-icon`,avif:`image/avif`},nne={mp3:`audio/mpeg`,wav:`audio/wav`,ogg:`audio/ogg`,oga:`audio/ogg`,opus:`audio/ogg`,m4a:`audio/mp4`,aac:`audio/aac`,flac:`audio/flac`,weba:`audio/webm`,webm:`audio/webm`};function rne(e){return e.replace(/\\/g,`/`).split(`/`).pop()??``}function k9(e){return rne(e).toLowerCase().split(`.`).pop()??``}function ine(e){return tne[k9(e)]??null}function ane(e){return nne[k9(e)]??null}function one(e){let t=k9(e);return t===`pdf`||t===`docx`?t:null}function sne(e){return ine(e)!==null}function cne(e){return ane(e)!==null}function lne(e){return one(e)!==null}async function une(e,t){let n=e.split(/[\\/]/).filter(Boolean),r=n.pop();if(!r)throw Error(`Invalid file path`);let i=n.join(`/`)||`/`,a=new FormData;a.append(`files`,new File([t],r,{type:`text/plain`}));let o=await fetch(`/api/files/${yO(i)}?type=upload&conflict=overwrite`,{method:`POST`,body:a});if(!o.ok){let e=`Save failed (${o.status})`;try{let t=await o.json();t?.error&&(e=t.error)}catch{}throw Error(e)}}var dne=(0,_.lazy)(()=>D0(()=>import(`./CodeMirrorEditor-akm7jmju.js`),__vite__mapDeps([20,1]))),fne={source:`Source`,preview:`Preview`,diff:`Diff`},A9={fontFamily:`var(--font-mono)`,fontSize:`var(--text-lg)`,lineHeight:1.6},j9={width:48,minWidth:48,padding:`0 10px`,textAlign:`right`,color:`var(--text-dim)`,background:`var(--bg-panel)`,borderRight:`1px solid var(--border)`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,fontStyle:`normal`,fontVariantNumeric:`tabular-nums`,lineHeight:`20.8px`,userSelect:`none`,flexShrink:0,verticalAlign:`top`};function pne(){return(0,L.jsxs)(`svg`,{width:z.xl,height:z.xl,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,L.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,L.jsx)(`path`,{d:`M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8`})]})}function M9(e){return(e.nodeType===Node.ELEMENT_NODE?e:e.parentElement)?.closest(`.file-source-line[data-line-number]`)??null}function N9(e,t){if(!t||t.isCollapsed||t.rangeCount===0)return null;let n=t.getRangeAt(0);if(!e.contains(n.startContainer)||!e.contains(n.endContainer))return null;let r=M9(n.startContainer),i=M9(n.endContainer);if(!r||!i||!e.contains(r)||!e.contains(i))return null;let a=Number(r.dataset.lineNumber),o=Number(i.dataset.lineNumber);if(!Number.isInteger(a)||!Number.isInteger(o))return null;if(a<o){let e=r.querySelector(`.file-source-line-content`);if(e?.contains(n.startContainer)){let t=document.createRange();if(t.selectNodeContents(e),t.setStart(n.startContainer,n.startOffset),t.toString().length===0){let e=r.nextElementSibling;e instanceof HTMLElement&&e.matches(`.file-source-line[data-line-number]`)&&(r=e,a=Number(r.dataset.lineNumber))}}let t=i.querySelector(`.file-source-line-content`);if(t?.contains(n.endContainer)){let e=document.createRange();if(e.selectNodeContents(t),e.setEnd(n.endContainer,n.endOffset),e.toString().length===0){let e=i.previousElementSibling;e instanceof HTMLElement&&e.matches(`.file-source-line[data-line-number]`)&&(i=e,o=Number(i.dataset.lineNumber))}}}return a>o?null:{startLine:a,endLine:o}}function mne({rows:e,stylesheet:t,useInlineStyles:n,wrapLines:r}){return e.map((e,i)=>{let a=e.children??[],o=a[0]?.properties?.className,s=Array.isArray(o)&&o.includes(`react-syntax-highlighter-line-number`),c=s?a[0]:null,l=s?a.slice(1):a;return(0,L.jsxs)(`span`,{className:`file-source-line`,"data-line-number":i+1,style:{display:`flex`,minWidth:`100%`},children:[c&&j6({node:c,stylesheet:t,useInlineStyles:n,key:`source-line-number-${i}`}),(0,L.jsx)(`span`,{className:`file-source-line-content`,style:{flex:`1 1 auto`,minWidth:0,overflowWrap:r?`anywhere`:`normal`,whiteSpace:r?`pre-wrap`:`pre`},children:l.map((e,r)=>j6({node:e,stylesheet:t,useInlineStyles:n,key:`source-token-${i}-${r}`}))})]},`source-line-${i}`)})}function P9(e,t,n,r={}){let i=yO(e),a=new URLSearchParams({type:t});n&&a.set(`sessionId`,n);for(let[e,t]of Object.entries(r))t!==void 0&&a.set(e,String(t));return`/api/files/${i}?${a.toString()}`}function F9({filePath:e,sourceSessionId:t}){let{t:n}=R();return(0,L.jsx)(rr,{label:n(`i18n.downloadFile`),children:(0,L.jsx)(`a`,{href:P9(e,`download`,t),download:bO(e),"aria-label":n(`i18n.downloadFile`),className:`file-viewer-icon-button`,children:(0,L.jsxs)(`svg`,{width:z.xl,height:z.xl,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,L.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,L.jsx)(`polyline`,{points:`7 10 12 15 17 10`}),(0,L.jsx)(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]})})})}function I9(e,t,n){let[r,i]=(0,_.useState)(!1),a=(0,_.useRef)(n);(0,_.useEffect)(()=>{a.current=n});let o=(0,_.useRef)(null);return(0,_.useEffect)(()=>(i(!1),o.current?.(),o.current=bJ({ch:`watch`,filePath:e},e=>{e.event===`connected`?i(!0):e.event===`error`?i(!1):a.current(e)}),()=>{o.current?.(),o.current=null}),[e]),{watching:r,closeWatch:(0,_.useCallback)(()=>{o.current?.(),o.current=null,i(!1)},[])}}function L9({filePath:e,cwd:t,extLabel:n,watching:r,sourceSessionId:i,ellipsis:a,children:o}){let{t:s}=R();return(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,padding:`4px 16px`,borderBottom:`1px solid var(--border)`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`,background:`var(--bg)`,flexShrink:0},children:[(0,L.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,...a?{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`}:{}},title:e,children:SO(e,t)}),(0,L.jsx)(`span`,{style:{marginLeft:`auto`},children:n}),o,(0,L.jsxs)(`span`,{title:s(r?`i18n.liveSync`:`i18n.notWatching`),style:{display:`flex`,alignItems:`center`,gap:4,color:r?`var(--status-success)`:`var(--text-dim)`},children:[(0,L.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:r?`var(--status-success)`:`var(--border)`,display:`inline-block`,boxShadow:r?`0 0 4px var(--status-success)`:`none`}}),r?`live`:`static`]}),(0,L.jsx)(F9,{filePath:e,sourceSessionId:i})]})}function R9(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function hne(e){let t=qZ(e);return t?t.flatMap(e=>e.rows.flatMap(e=>{if(e.type===`hunk`)return[];if(e.left.type===`context`&&e.right.type===`context`)return[{type:`unchanged`,text:e.right.text,oldLineNo:e.left.lineNo,newLineNo:e.right.lineNo}];let t=[];return e.left.type===`removed`&&t.push({type:`removed`,text:e.left.text,oldLineNo:e.left.lineNo,newLineNo:null}),e.right.type===`added`&&t.push({type:`added`,text:e.right.text,oldLineNo:null,newLineNo:e.right.lineNo}),t})):[]}function gne({patch:e}){let{t}=R(),n=hne(e);if(!n.some(e=>e.type!==`unchanged`))return(0,L.jsx)(`div`,{style:{padding:`12px 16px`,fontSize:`var(--text-base)`,color:`var(--text-dim)`,fontFamily:`var(--font-mono)`},children:t(`i18n.noChanges`)});let r=new Set(n.flatMap((e,t)=>e.type===`unchanged`?[]:[t])),i=new Set;for(let e of r)for(let t=Math.max(0,e-3);t<=Math.min(n.length-1,e+3);t++)i.add(t);let a=[],o=0;for(;o<n.length;)if(i.has(o)){let e=[];for(;o<n.length&&i.has(o);)e.push(n[o]),o++;a.push({hidden:!1,lines:e})}else{let e=0;for(;o<n.length&&!i.has(o);)e++,o++;a.push({hidden:!0,count:e})}return(0,L.jsx)(`div`,{className:`file-diff-view`,style:{width:`max-content`,minWidth:`100%`,...A9},children:a.map((e,t)=>{if(e.hidden)return(0,L.jsxs)(`div`,{style:{padding:`2px 16px`,color:`var(--text-dim)`,background:`var(--bg-panel)`,fontSize:`var(--text-sm)`,borderTop:`1px solid var(--border)`,borderBottom:`1px solid var(--border)`},children:[`... `,e.count,` unchanged lines ...`]},t);let n=e.lines.map((e,t)=>{let n=e.type===`added`?`color-mix(in srgb, var(--status-success) 12%, transparent)`:e.type===`removed`?`color-mix(in srgb, var(--status-error) 14%, transparent)`:`transparent`,r=e.type===`added`?`+`:e.type===`removed`?`-`:` `,i=e.type===`added`?`var(--status-success)`:e.type===`removed`?`var(--status-error)`:`var(--text-dim)`;return(0,L.jsxs)(`div`,{className:`file-diff-line`,style:{display:`flex`,minWidth:`100%`,background:n,borderLeft:e.type===`added`?`3px solid var(--status-success)`:e.type===`removed`?`3px solid var(--status-error)`:`3px solid transparent`},children:[(0,L.jsx)(`span`,{style:j9,children:e.type===`removed`?e.oldLineNo:e.newLineNo}),(0,L.jsx)(`span`,{style:{minWidth:16,padding:`0 6px`,color:i,userSelect:`none`,flexShrink:0,fontWeight:600},children:r}),(0,L.jsx)(`span`,{className:`file-diff-line-content`,style:{flexShrink:0,padding:`0 8px 0 0`,whiteSpace:`pre`,color:`var(--text)`},children:e.text||`\xA0`})]},t)});return(0,L.jsx)(`div`,{children:n},t)})})}function _ne({filePath:e,cwd:t,sourceSessionId:n}){let[r,i]=(0,_.useState)(0),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(null),d=bO(e).toLowerCase().split(`.`).pop()??``;er(()=>{i(0),o(null),c(null),u(null)},[e,n]);let{watching:f}=I9(e,n,e=>{typeof e.size==`number`&&o(e.size),i(e=>e+1)}),p=P9(e,`read`,n,r?{v:r}:void 0),m=a==null?null:R9(a);return(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`hidden`},children:[(0,L.jsxs)(L9,{filePath:e,cwd:t,extLabel:d||`image`,watching:f,sourceSessionId:n,children:[s&&(0,L.jsxs)(`span`,{children:[s.w,` × `,s.h]}),m&&(0,L.jsx)(`span`,{children:m})]}),(0,L.jsx)(`div`,{style:{flex:1,overflow:`auto`,backgroundColor:`var(--bg-panel)`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:16,backgroundImage:`linear-gradient(45deg, var(--bg) 25%, transparent 25%), linear-gradient(-45deg, var(--bg) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--bg) 75%), linear-gradient(-45deg, transparent 75%, var(--bg) 75%)`,backgroundSize:`16px 16px`,backgroundPosition:`0 0, 0 8px, 8px -8px, -8px 0px`},children:l?(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:4},children:[(0,L.jsx)(`div`,{style:{color:`var(--status-error)`,fontSize:`var(--text-lg)`},children:l}),(0,L.jsx)(z9,{filePath:e,sourceSessionId:n,cwd:t})]}):(0,L.jsx)(`img`,{src:p,alt:e,onLoad:e=>{let t=e.currentTarget;c({w:t.naturalWidth,h:t.naturalHeight})},onError:()=>u(`Failed to load image`),style:{maxWidth:`100%`,maxHeight:`100%`,objectFit:`contain`,boxShadow:`0 2px 8px var(--shadow-color)`}})})]})}function vne({filePath:e,cwd:t,sourceSessionId:n}){let[r,i]=(0,_.useState)(0),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(null),d=bO(e).toLowerCase().split(`.`).pop()??``;er(()=>{i(0),o(null),c(null),u(null)},[e,n]);let{watching:f}=I9(e,n,e=>{typeof e.size==`number`&&o(e.size),c(null),u(null),i(e=>e+1)}),p=P9(e,`read`,n,r?{v:r}:void 0);return(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`hidden`},children:[(0,L.jsxs)(L9,{filePath:e,cwd:t,extLabel:d||`audio`,watching:f,sourceSessionId:n,children:[s!=null&&(0,L.jsx)(`span`,{children:pY(s)}),a!=null&&(0,L.jsx)(`span`,{children:R9(a)})]}),(0,L.jsx)(`div`,{style:{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:24,background:`var(--bg-panel)`},children:(0,L.jsxs)(`div`,{style:{width:`min(680px, 100%)`},children:[l&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{style:{color:`var(--status-error)`,fontSize:`var(--text-lg)`,marginBottom:12,textAlign:`center`},children:l}),(0,L.jsx)(z9,{filePath:e,sourceSessionId:n,cwd:t})]}),(0,L.jsx)(`audio`,{controls:!0,preload:`metadata`,src:p,onLoadedMetadata:e=>c(e.currentTarget.duration),onError:()=>u(`Failed to load audio`),style:{width:`100%`}},p)]})})]})}function yne({filePath:e,cwd:t,sourceSessionId:n}){let{t:r}=R(),[i,a]=(0,_.useState)(0),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(null),u=k9(e),d=u===`pdf`,f=d?P9(e,`read`,n,i?{v:i}:void 0):P9(e,`preview`,n,i?{v:i}:void 0);(0,_.useEffect)(()=>{a(0),s(null),l(null),fetch(P9(e,`meta`,n)).then(e=>e.json()).then(e=>{e.error&&l(e.error),typeof e.size==`number`&&(s(e.size),!d&&e.size>10485760&&l(r(`files.docTooLargeForPreview`,{limit:R9(O9)})))}).catch(e=>l(String(e)))},[e,d,n,r]);let{watching:p}=I9(e,n,e=>{if(typeof e.size==`number`&&(s(e.size),!d&&e.size>10485760)){l(r(`files.docTooLargeForPreview`,{limit:R9(O9)}));return}l(null),a(e=>e+1)});return(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`hidden`},children:[(0,L.jsx)(L9,{filePath:e,cwd:t,extLabel:u===`docx`?`docx preview`:`pdf`,watching:p,sourceSessionId:n,ellipsis:!0,children:o!=null&&(0,L.jsx)(`span`,{children:R9(o)})}),(0,L.jsx)(`div`,{style:{flex:1,minHeight:0,background:`var(--bg-panel)`},children:c?(0,L.jsxs)(`div`,{style:{height:`100%`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,padding:24,color:`var(--status-error)`,fontSize:`var(--text-lg)`,textAlign:`center`},children:[(0,L.jsx)(`div`,{children:c}),(0,L.jsx)(z9,{filePath:e,sourceSessionId:n,cwd:t})]}):(0,L.jsx)(`iframe`,{src:f,sandbox:d?void 0:`allow-same-origin`,title:r(`i18n.previewFile`,{file:bO(e)}),style:{width:`100%`,height:`100%`,border:`none`,background:d?`var(--bg)`:`#eef1f5`}},f)})]})}function z9({filePath:e,sourceSessionId:t,cwd:n}){let{t:r}=R(),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(null),c=typeof n==`string`&&/^[a-zA-Z]:[\\/]/.test(n)||typeof n==`string`&&n.startsWith(`\\\\`),l=(0,_.useCallback)(async n=>{a(!0),s(null);try{let i=await fetch(P9(e,`open`,t,n?{chooseApp:1}:void 0),{method:`POST`}),a=await i.json().catch(()=>null);i.ok?s({ok:!0,text:r(`files.openLaunched`)}):s({ok:!1,text:a?.error??`HTTP ${i.status}`})}catch(e){s({ok:!1,text:String(e)})}finally{a(!1)}},[e,t,r]);return(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:10,marginTop:16},children:[o&&(0,L.jsx)(`div`,{style:{color:o.ok?`var(--text-muted)`:`var(--status-error)`,fontSize:`var(--text-sm)`,maxWidth:460,textAlign:`center`,lineHeight:1.5},children:o.text}),(0,L.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,L.jsx)(`button`,{type:`button`,disabled:i,onClick:()=>l(!1),className:`file-viewer-mode-button file-open-action-button`,children:r(`files.openInSystemApp`)}),c&&(0,L.jsx)(`button`,{type:`button`,disabled:i,onClick:()=>l(!0),className:`file-viewer-mode-button file-open-action-button`,children:r(`files.chooseOtherApp`)})]})]})}function bne({filePath:e,cwd:t,sourceSessionId:n,onOpenFile:r,onMentionLines:i,onSaved:a,gitRefreshKey:o,initialDisplayMode:s}){return sne(e)?(0,L.jsx)(_ne,{filePath:e,cwd:t,sourceSessionId:n}):cne(e)?(0,L.jsx)(vne,{filePath:e,cwd:t,sourceSessionId:n}):lne(e)?(0,L.jsx)(yne,{filePath:e,cwd:t,sourceSessionId:n}):(0,L.jsx)(Sne,{filePath:e,cwd:t,sourceSessionId:n,onOpenFile:r,onMentionLines:i,onSaved:a,gitRefreshKey:o,initialDisplayMode:s})}function xne({filePath:e,cwd:t,metadata:n,watching:r,isDeletedDiff:i,displayModes:a,effectiveDisplayMode:o,setDisplayMode:s,wrapLines:c,setWrapLines:l,editMode:u,dirty:d,handleSave:f,saveState:p,highlightReady:m,selectedLineRange:h,handleMentionSelectedLines:g,fileContent:_,sourceSessionId:v,t:y,saveError:b,enterEdit:x,cancelEdit:S}){return(0,L.jsxs)(`div`,{className:`file-viewer-toolbar`,style:{display:`flex`,alignItems:`center`,gap:8,padding:`5px 12px`,borderBottom:`1px solid var(--border)`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`,background:`var(--bg)`,flexShrink:0},children:[(0,L.jsx)(rr,{label:e,children:(0,L.jsx)(`span`,{className:`file-viewer-path`,style:{fontFamily:`var(--font-mono)`},children:SO(e,t)})}),(0,L.jsx)(rr,{label:n,children:(0,L.jsx)(`span`,{className:`file-viewer-meta`,children:n})}),!i&&(0,L.jsx)(rr,{label:y(r?`i18n.liveSync`:`i18n.notWatching`),children:(0,L.jsx)(`span`,{"aria-label":y(r?`i18n.liveSync`:`i18n.notWatching`),className:`file-viewer-live-indicator`,style:{background:r?`var(--status-success)`:`var(--border)`,boxShadow:r?`0 0 4px var(--status-success)`:`none`}})}),(0,L.jsxs)(`div`,{className:`file-viewer-controls`,children:[a.length>1&&(0,L.jsx)(`div`,{className:`file-viewer-mode-switch`,"aria-label":y(`i18n.fileViewMode`),children:a.map(e=>{let t=o===e;return(0,L.jsx)(rr,{label:e===`diff`?y(`i18n.compareHead`):void 0,children:(0,L.jsx)(`button`,{type:`button`,onClick:()=>s(e),"aria-pressed":t,className:`file-viewer-mode-button`,style:{background:t?`var(--bg-selected)`:`transparent`,color:t?`var(--text)`:`var(--text-muted)`},children:fne[e]})},e)})}),(0,L.jsxs)(`div`,{className:`file-viewer-actions`,children:[o===`source`&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(rr,{label:y(`i18n.mentionSelectedLines`),children:(0,L.jsx)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:g,"aria-label":y(`i18n.mentionSelectedLines`),disabled:!h,className:`file-viewer-icon-button`,children:(0,L.jsx)(pne,{})})}),(0,L.jsx)(rr,{label:y(c?`i18n.disableWrap`:`i18n.enableWrap`),children:(0,L.jsx)(`button`,{type:`button`,onClick:()=>l(e=>!e),"aria-label":y(c?`i18n.disableWrap`:`i18n.enableWrap`),"aria-pressed":c,className:`file-viewer-icon-button`,style:{background:c?`var(--bg-selected)`:`transparent`,color:c?`var(--text)`:`var(--text-muted)`},children:(0,L.jsxs)(`svg`,{width:z.xl,height:z.xl,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,L.jsx)(`path`,{d:`M4 7V4h16v3`}),(0,L.jsx)(`path`,{d:`M9 20h6`}),(0,L.jsx)(`path`,{d:`M12 4v16`})]})})})]}),o===`source`&&m&&!u&&(0,L.jsx)(`a`,{href:P9(e,`download`,v),download:bO(e),"aria-label":y(`i18n.downloadFile`),className:`file-viewer-icon-button`,style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,textDecoration:`none`},children:(0,L.jsxs)(`svg`,{width:z.xl,height:z.xl,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,L.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,L.jsx)(`polyline`,{points:`7 10 12 15 17 10`}),(0,L.jsx)(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]})}),!i&&o===`source`&&(0,L.jsx)(`div`,{className:`file-viewer-edit-controls`,style:{display:`flex`,alignItems:`center`,gap:8,marginLeft:8},children:u?(0,L.jsxs)(L.Fragment,{children:[d&&(0,L.jsx)(rr,{label:y(`i18n.unsavedChanges`),children:(0,L.jsx)(`span`,{"aria-label":y(`i18n.unsavedChanges`),style:{color:`var(--status-warning)`,fontWeight:700},children:`●`})}),(0,L.jsx)(rr,{label:y(`i18n.saveFileShortcut`),children:(0,L.jsx)(`button`,{type:`button`,onClick:f,disabled:!d||p===`saving`,"aria-label":y(`i18n.saveFile`),className:`file-viewer-icon-button`,style:{background:d?`var(--accent)`:`transparent`,color:d?`var(--bg)`:`var(--text-muted)`},children:p===`saving`?(0,L.jsx)(de,{size:z.lg,className:`animate-spin`}):(0,L.jsx)(Ce,{size:z.lg})})}),(0,L.jsx)(rr,{label:y(`i18n.cancelEdit`),children:(0,L.jsx)(`button`,{type:`button`,onClick:S,"aria-label":y(`i18n.cancelEdit`),className:`file-viewer-icon-button`,children:(0,L.jsx)(Be,{size:z.lg})})}),p===`error`&&b&&(0,L.jsx)(`span`,{style:{color:`var(--status-error)`,fontSize:`var(--text-sm)`},children:y(`i18n.saveFailed`,{error:b})}),p===`saved`&&!d&&(0,L.jsx)(`span`,{style:{color:`var(--status-success)`,fontSize:`var(--text-sm)`},children:y(`i18n.saved`)})]}):(0,L.jsx)(rr,{label:y(`i18n.editFile`),children:(0,L.jsx)(`button`,{type:`button`,onClick:x,"aria-label":y(`i18n.editFile`),className:`file-viewer-icon-button`,children:(0,L.jsx)(ge,{size:z.lg})})})}),!i&&(0,L.jsx)(F9,{filePath:e,sourceSessionId:v})]})]})]})}function Sne({filePath:e,cwd:t,sourceSessionId:n,onOpenFile:r,onMentionLines:i,onSaved:a,gitRefreshKey:o,initialDisplayMode:s}){let{isDark:c}=WK(),{t:l}=R(),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(null),[m,h]=(0,_.useState)(!1),[g,v]=(0,_.useState)(!0),[y,b]=(0,_.useState)(null),[x,S]=(0,_.useState)(null),[C,w]=(0,_.useState)(`source`),[T,E]=(0,_.useState)(!1),[D,O]=(0,_.useState)(!1),k=(0,_.useRef)(0),A=(0,_.useRef)(null),[j,M]=(0,_.useState)(null),[N,ee]=(0,_.useState)(!1),[te,P]=(0,_.useState)(``),[ne,re]=(0,_.useState)(!1),[ie,ae]=(0,_.useState)(`idle`),[oe,F]=(0,_.useState)(null),I=(0,_.useRef)(!1);I.current=N;let se=(0,_.useCallback)(e=>fetch(P9(e,`read`,n)).then(async e=>{let t=await e.json();return t.error?(b(t.error),S(e.status),null):(b(null),S(null),d(t),t)}).catch(e=>(b(String(e)),null)),[n]),ce=(0,_.useCallback)(async e=>{let n=++k.current;if(h(!0),!t){p(null),h(!1);return}try{let r=new URLSearchParams({cwd:t,path:e}),i=await fetch(`/api/git/diff?${r.toString()}`),a=await i.json();if(n!==k.current)return;p(i.ok&&a.supported&&typeof a.patch==`string`?a:null)}catch{n===k.current&&p(null)}finally{n===k.current&&h(!1)}},[t]);(0,_.useEffect)(()=>{v(!0),b(null),S(null),d(null),p(null),w(s===`diff`?`diff`:`source`),O(!1),ee(!1),P(``),re(!1),ae(`idle`),F(null),se(e).finally(()=>v(!1))},[e,se]);let{watching:le,closeWatch:ue}=I9(e,n,()=>{I.current||(se(e),ce(e))});(0,_.useEffect)(()=>{ce(e)},[ce,e,o]),(0,_.useEffect)(()=>{u?.language===`markdown`&&s!==`diff`&&w(`preview`)},[u?.language,s]);let fe=f?.supported===!0&&typeof f.patch==`string`,pe=fe&&f.status===`deleted`;(0,_.useEffect)(()=>{pe&&ue()},[pe,ue]);let me=(0,_.useMemo)(()=>u?.language===`markdown`?JU(u.content):``,[u]);(0,_.useEffect)(()=>{let e=()=>{let e=A.current;M(i&&C===`source`&&e?N9(e,window.getSelection()):null)};if(e(),!(!i||C!==`source`))return document.addEventListener(`selectionchange`,e),()=>document.removeEventListener(`selectionchange`,e)},[u?.content,C,i]);let he=(0,_.useCallback)(n=>{!i||!n||i(SO(e,t),n.startLine,n.endLine)},[t,e,i]),ge=(0,_.useCallback)(()=>{he(j)},[he,j]);(0,_.useEffect)(()=>{if(!i||C!==`source`)return;let e=e=>{if(e.repeat||e.key.toLowerCase()!==`i`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey)return;let t=e.target;if(t instanceof Element&&t.closest(`input, textarea, [contenteditable='true']`))return;let n=A.current,r=n?N9(n,window.getSelection()):null;r&&(e.preventDefault(),he(r))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[C,he,i]);let _e=(0,_.useCallback)(()=>{P(u?.content??``),re(!1),ae(`idle`),F(null),ee(!0)},[u?.content]),ve=(0,_.useCallback)(()=>{ee(!1),re(!1),ae(`idle`),F(null),se(e)},[e,se]),ye=(0,_.useCallback)(e=>{P(e),re(e!==(u?.content??``))},[u?.content]),be=(0,_.useCallback)(async()=>{if(ne){ae(`saving`),F(null);try{await une(e,te),d(e=>e&&{...e,content:te}),re(!1),ae(`saved`),a?.(e)}catch(e){ae(`error`),F(e instanceof Error?e.message:String(e))}}},[ne,te,e,a]),xe=u?.content??``;if((0,_.useEffect)(()=>{E(!1)},[xe]),(0,_.useEffect)(()=>{if((pe?`diff`:C)!==`source`||T)return;let e=setTimeout(()=>E(!0),0);return()=>clearTimeout(e)},[pe,C,T]),g||C===`diff`&&m)return(0,L.jsxs)(`div`,{style:{height:`100%`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:12,color:`var(--text-muted)`,fontSize:`var(--text-lg)`},children:[(0,L.jsx)(de,{size:z.lg,className:`animate-spin`,"aria-hidden":`true`}),l(`i18n.loading`)]});if(y&&!pe)return(0,L.jsxs)(`div`,{style:{height:`100%`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,padding:24,color:`var(--status-error)`,fontSize:`var(--text-lg)`,textAlign:`center`},children:[(0,L.jsx)(`div`,{children:x===413?l(`files.fileTooLargeForPreview`,{limit:R9(ene)}):y}),x===413&&(0,L.jsx)(z9,{filePath:e,sourceSessionId:n,cwd:t})]});if(!u&&!pe)return null;let Se=u?.language??`text`,Ce=Se===`html`,we=Se===`markdown`,Te=Ce||we,Ee=xO(e),De=xe.split(`
|
|
496
|
+
`)}),n.length>0&&(0,L.jsx)(`div`,{"data-testid":`widget-bound-messages`,style:{display:`flex`,flexWrap:`wrap`,gap:6,paddingTop:8,borderTop:`1px solid var(--border)`,flexShrink:0},children:n.map((t,n)=>(0,L.jsx)(q7,{msg:t,onSend:o,onFillInput:s,testId:`widget-send-${e.key}-${n}`},n))})]})}),f&&(0,L.jsx)(`div`,{"data-testid":`widget-collapse-trail`,style:{position:`fixed`,inset:0,zIndex:70,pointerEvents:`none`},children:(0,L.jsx)(`svg`,{width:`100%`,height:`100%`,style:{position:`absolute`,inset:0},children:(0,L.jsx)(`circle`,{ref:m,r:28,fill:`var(--accent)`,fillOpacity:.7})})})]})}function Ite(){let{t:e}=R(),t=(0,_.useSyncExternalStore)(Ln,Rn,Rn);if(t.length===0)return null;let n=t[t.length-1],r=t.length;return(0,L.jsx)(Xs,{open:!0,onOpenChange:()=>{},children:(0,L.jsxs)(ec,{children:[(0,L.jsx)(nc,{style:{position:`fixed`,inset:0,zIndex:1200,background:`rgba(0, 0, 0, 0.45)`}}),(0,L.jsxs)(oc,{role:`alertdialog`,"aria-modal":`true`,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),style:{position:`fixed`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,zIndex:1200,maxWidth:480,width:`calc(100% - 48px)`,background:`var(--bg)`,border:`1px solid var(--border)`,borderRadius:10,padding:`16px 20px`,boxShadow:`0 8px 32px rgba(0, 0, 0, 0.35)`},children:[(0,L.jsxs)(dc,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:10,fontSize:`var(--text-base)`,fontWeight:600,color:`var(--text)`},children:[(0,L.jsx)(`span`,{style:{color:`var(--status-error)`},children:`⚠`}),(0,L.jsx)(`span`,{children:r>1?e(`errors.titleCount`,{count:r}):e(`errors.title`)})]}),(0,L.jsx)(pc,{asChild:!0,children:(0,L.jsx)(`div`,{children:n.kind===`api`?(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:6},children:[(0,L.jsxs)(`span`,{style:{fontSize:`var(--text-xs)`,padding:`1px 8px`,borderRadius:999,background:`color-mix(in srgb, var(--status-error) 14%, transparent)`,color:`var(--status-error)`,fontWeight:600,whiteSpace:`nowrap`},children:[`HTTP `,n.status||`ERR`]}),n.context&&(0,L.jsx)(`span`,{style:{fontSize:`var(--text-xs)`,color:`var(--text-dim)`},children:n.context})]}),(0,L.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text)`,wordBreak:`break-word`},children:n.message})]}):(0,L.jsxs)(`div`,{children:[n.context&&(0,L.jsx)(`div`,{style:{fontSize:`var(--text-xs)`,color:`var(--text-dim)`,marginBottom:6},children:n.context}),(0,L.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text)`,wordBreak:`break-word`},children:n.message})]})})}),(0,L.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8,marginTop:16},children:[r>1&&(0,L.jsx)(`button`,{type:`button`,onClick:Bn,style:{border:`1px solid var(--border)`,background:`none`,color:`var(--text-muted)`,borderRadius:6,padding:`4px 12px`,fontSize:`var(--text-sm)`,cursor:`pointer`},children:e(`errors.clearAll`)}),(0,L.jsx)(`button`,{type:`button`,onClick:zn,style:{border:`none`,background:`var(--accent)`,color:`#fff`,borderRadius:6,padding:`4px 14px`,fontSize:`var(--text-sm)`,cursor:`pointer`},children:e(`errors.close`)})]})]})]})})}var o9=[],Lte=1,s9=new Set;function c9(){for(let e of s9)e()}function Rte(e){return s9.add(e),()=>{s9.delete(e)}}function l9(){return o9}function zte(e){let t={id:Lte++,label:e??``};o9=[...o9,t],c9();let n=!1;return()=>{n||(n=!0,o9=o9.filter(e=>e.id!==t.id),c9())}}var u9=new WeakMap;function Bte(e){if(!e.isConnected)return()=>{};let t=u9.get(e);if(!t){let n=document.createElement(`div`);n.style.cssText=`position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb, var(--bg) 50%, transparent);z-index:5;`,n.innerHTML=`<div style="width:16px;height:16px;border:2px solid var(--border);border-top-color:var(--text-dim);border-radius:50%;animation:spin 0.8s linear infinite;"></div>`;let r=null;getComputedStyle(e).position===`static`&&(r=e.style.position,e.style.position=`relative`),e.appendChild(n),t={count:0,el:n,prevPosition:r},u9.set(e,t)}t.count++;let n=!1;return()=>{n||(n=!0,t.count--,t.count<=0&&(t.el.remove(),t.prevPosition!==null&&(t.prevPosition?e.style.position=t.prevPosition:e.style.removeProperty(`position`)),u9.delete(e)))}}async function Vte(e){try{return await e.json()}catch{return null}}async function d9(e,t,n){let r=n?.loading??`fullscreen`,i=r===`fullscreen`?zte(n?.label):r instanceof HTMLElement?Bte(r):null;try{let n;try{n=await fetch(e,t)}catch(e){throw new An(e instanceof Error?e.message:`Network error`,0)}if(!n.ok){let e=await Vte(n);throw new An(e&&typeof e==`object`&&`error`in e&&typeof e.error==`string`?e.error:`HTTP ${n.status}`,n.status,e)}let r=await n.text();return r?JSON.parse(r):void 0}catch(e){throw e instanceof An?e:new An(e instanceof Error?e.message:String(e),0)}finally{i?.()}}var f9={},Hte=6e4;function p9(e,t){return e===`Not found`?t(`files.notFound`):e===`Access denied`?t(`files.accessDenied`):e}async function m9(e,t){return((await d9(`/api/files/${yO(e)}?type=list`,void 0,t)).entries??[]).map(t=>({name:t.name,fullPath:CO(e,t.name),isDir:t.isDir,size:t.size,children:t.isDir?[]:void 0,loaded:!t.isDir}))}async function h9(e,t){return d9(`/api/git/status?${new URLSearchParams({cwd:e}).toString()}`,void 0,t)}var g9={modified:`files.modified`,added:`files.added`,deleted:`files.deleted`,renamed:`files.renamed`,untracked:`files.untracked`,conflict:`files.conflict`},_9={modified:`var(--status-warning)`,added:`var(--status-success)`,deleted:`var(--status-error)`,renamed:`var(--accent)`,untracked:`var(--status-success)`,conflict:`var(--status-error)`};function v9({status:e,t}){return(0,L.jsx)(`span`,{title:t(g9[e.status]),"aria-label":t(g9[e.status]),style:{width:14,height:14,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`,color:_9[e.status],fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,fontWeight:600},children:e.code})}function Ute(e,t,n,r){return new Promise((i,a)=>{let o=new FormData;t.forEach(e=>o.append(`files`,e,e.name));let s=new XMLHttpRequest;s.open(`POST`,`/api/files/${yO(e)}?type=upload&conflict=${n}`),s.upload.onprogress=e=>{e.lengthComputable&&e.total>0&&r(Math.round(e.loaded/e.total*100))},s.onerror=()=>a(Error(`Network error while uploading files`)),s.onabort=()=>a(Error(`Upload cancelled`)),s.onload=()=>{let e={};try{e=JSON.parse(s.responseText)}catch{s.responseText&&(e.error=s.responseText)}i({status:s.status,data:e})},s.send(o)})}function y9({size:e=11}){return(0,L.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,L.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,L.jsx)(`path`,{d:`M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8`})]})}function b9({onClick:e,title:t}){return(0,L.jsx)(rr,{label:t,children:(0,L.jsx)(`button`,{type:`button`,onClick:e,"aria-label":t,style:{width:24,height:24,padding:0,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,border:`none`,borderRadius:4,background:`none`,color:`var(--text-dim)`,cursor:`pointer`,"--hover-color":`var(--text-muted)`,"--hover-bg":`var(--bg-hover)`},className:`hover-shift`,children:(0,L.jsxs)(`svg`,{width:z.lg,height:z.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,L.jsx)(`path`,{d:`m6 6 12 12`}),(0,L.jsx)(`path`,{d:`m18 6-12 12`})]})})})}function x9({node:e,depth:t,cwd:n,onOpenFile:r,onAtMention:i,expandedPaths:a,onToggleExpanded:o,refreshToken:s,highlightedPaths:c,gitStatusByPath:l,changedDirectoryPaths:u,t:d}){let f=a.has(e.fullPath),p=c.has(e.fullPath),m=vO(e.fullPath),h=l.get(m),g=e.isDir&&(h!==void 0||u.has(m)),[v,y]=(0,_.useState)(e.children??[]),[b,x]=(0,_.useState)(e.loaded??!1),[S,C]=(0,_.useState)(!1),w=(0,_.useCallback)(async(t=!1)=>{if(!(b&&!t))try{let t=await m9(e.fullPath,{loading:`silent`});y(t),x(!0)}catch{}},[b,e.fullPath]);(0,_.useEffect)(()=>{f&&b&&w(!0)},[s]);let T=(0,_.useCallback)(()=>{if(e.isDir){let t=!f;o(e.fullPath,t),t&&!b&&w()}else r(e.fullPath,e.name)},[e.isDir,e.fullPath,e.name,b,f,w,r,o]);return(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{onClick:T,onMouseEnter:()=>C(!0),onMouseLeave:()=>C(!1),style:{position:`relative`,display:`flex`,alignItems:`center`,gap:4,paddingLeft:8+t*14,paddingRight:8,height:24,cursor:`pointer`,background:S?`var(--bg-hover)`:`transparent`,borderRadius:4,userSelect:`none`},children:[e.isDir&&(0,L.jsx)(`svg`,{width:z.xs,height:z.xs,viewBox:`0 0 10 10`,fill:`none`,stroke:`var(--text-dim)`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0,transform:f?`rotate(90deg)`:`none`,transition:`transform 0.1s`},children:(0,L.jsx)(`polyline`,{points:`3 2 7 5 3 8`})}),!e.isDir&&(0,L.jsx)(`span`,{style:{width:10,flexShrink:0}}),(0,L.jsx)(`span`,{style:{flexShrink:0,display:`flex`,alignItems:`center`},children:e.isDir?(0,L.jsx)(FG,{size:z.xl,open:f}):lK(e.name,14)}),(0,L.jsx)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--text)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,flex:1},title:e.fullPath,children:e.name}),p&&(0,L.jsx)(`span`,{title:d(`files.newlyUploaded`),"aria-label":d(`files.newlyUploaded`),style:{width:14,height:14,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,L.jsx)(`span`,{style:{width:6,height:6,borderRadius:`50%`,background:`var(--accent)`}})}),!S&&!e.isDir&&h&&(0,L.jsx)(v9,{status:h,t:d}),!S&&g&&(0,L.jsx)(`span`,{title:d(`files.containsChangedFiles`),"aria-label":d(`files.containsChangedFiles`),style:{width:14,height:14,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,L.jsx)(`span`,{style:{width:6,height:6,borderRadius:`50%`,background:`var(--status-warning)`}})}),i&&S&&(0,L.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),i(SO(e.fullPath,n),e.isDir)},title:d(`files.insertPath`),style:{position:`absolute`,right:e.isDir?4:28,top:`50%`,transform:`translateY(-50%)`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:4,padding:`0 8px`,height:20,background:`var(--bg-panel)`,border:`1px solid var(--border)`,borderRadius:4,color:`var(--accent)`,cursor:`pointer`,fontSize:`var(--text-sm)`,fontWeight:600,whiteSpace:`nowrap`},children:[(0,L.jsx)(y9,{}),d(`files.mention`)]}),S&&!e.isDir&&(0,L.jsx)(`a`,{href:`/api/files/${yO(e.fullPath)}?type=download`,download:!0,onClick:e=>e.stopPropagation(),title:d(`files.download`),style:{position:`absolute`,right:4,top:`50%`,transform:`translateY(-50%)`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:4,padding:`0 5px`,height:20,background:`var(--bg-panel)`,border:`1px solid var(--border)`,borderRadius:4,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-sm)`,fontWeight:600,whiteSpace:`nowrap`,textDecoration:`none`},children:(0,L.jsxs)(`svg`,{width:z.sm,height:z.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,L.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,L.jsx)(`polyline`,{points:`7 10 12 15 17 10`}),(0,L.jsx)(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]})})]}),e.isDir&&f&&(0,L.jsxs)(`div`,{children:[v.map(e=>(0,L.jsx)(x9,{node:e,depth:t+1,cwd:n,onOpenFile:r,onAtMention:i,expandedPaths:a,onToggleExpanded:o,refreshToken:s,highlightedPaths:c,gitStatusByPath:l,changedDirectoryPaths:u,t:d},e.fullPath)),v.length===0&&b&&(0,L.jsx)(`div`,{style:{paddingLeft:8+(t+1)*14,fontSize:`var(--text-sm)`,color:`var(--text-dim)`,height:22,display:`flex`,alignItems:`center`},children:d(`files.empty`)})]})]})}function S9({status:e,cwd:t,onOpenFile:n,onStageToggle:r,unstage:i,t:a}){let o=bO(e.filePath),s=SO(e.filePath,t);return(0,L.jsxs)(`div`,{"data-testid":`git-change-row`,onClick:()=>n(e.filePath,o,{modeHint:`diff`}),className:`git-change-row row-hover-bg`,title:e.filePath,style:{display:`flex`,alignItems:`center`,gap:6,paddingLeft:10,paddingRight:8,height:24,cursor:`pointer`,borderRadius:4,userSelect:`none`},children:[r!==void 0&&(0,L.jsx)(`button`,{type:`button`,"data-testid":`git-stage-toggle`,onClick:t=>{t.stopPropagation(),r(e)},"aria-label":a(i?`files.unstageFile`:`files.stageFile`),style:{width:16,height:16,padding:0,marginLeft:-4,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,border:`none`,borderRadius:4,background:`none`,color:`var(--text-dim)`,cursor:`pointer`,"--hover-color":`var(--text-muted)`,"--hover-bg":`var(--bg-hover)`},className:`hover-shift`,children:(0,L.jsx)(`svg`,{width:z.sm,height:z.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`,"aria-hidden":`true`,children:i?(0,L.jsx)(`path`,{d:`M6 12h12`}):(0,L.jsx)(`path`,{d:`M12 5v14M5 12h14`})})}),(0,L.jsx)(v9,{status:e,t:a}),(0,L.jsx)(`span`,{style:{flexShrink:0,display:`flex`,alignItems:`center`,opacity:.85},children:lK(o,13)}),(0,L.jsx)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--text)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,flex:1},children:s}),e.lineStats&&(e.lineStats.additions>0||e.lineStats.deletions>0)&&(0,L.jsxs)(`span`,{style:{flexShrink:0,display:`flex`,alignItems:`center`,gap:5,fontFamily:`var(--font-mono)`,fontSize:`var(--text-xs)`,fontVariantNumeric:`tabular-nums`},children:[e.lineStats.additions>0&&(0,L.jsxs)(`span`,{style:{color:`var(--status-success)`},children:[`+`,e.lineStats.additions]}),e.lineStats.deletions>0&&(0,L.jsxs)(`span`,{style:{color:`var(--status-error)`},children:[`-`,e.lineStats.deletions]})]})]})}function Wte({message:e,onMessageChange:t,commitBusy:n,canCommit:r,onCommit:i,pushBusy:a,canPush:o,onPush:s,pullBusy:c,canPull:l,onPull:u,aiBusy:d,canAiGenerate:f,onAiGenerate:p,autoGenerateOnEmpty:m,hasModelForAuto:h,aiModelHint:g,t:v}){let y=(0,_.useRef)(null),b=e.trim()===``,x=b&&m&&h&&f&&!d,S=n||!x&&b||!r;return(0,_.useLayoutEffect)(()=>{let e=y.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,120)}px`)},[e]),(0,L.jsx)(`div`,{style:{display:`flex`,padding:`4px 2px 6px`},children:(0,L.jsxs)(`div`,{style:{position:`relative`,display:`flex`,flexDirection:`column`,flex:1,minWidth:0,backgroundColor:`var(--bg)`,backgroundImage:n||d||a||c?`linear-gradient(90deg, transparent 13%, color-mix(in srgb, var(--accent) 18%, transparent) 25%, transparent 37%, transparent 63%, color-mix(in srgb, var(--shine-highlight) 50%, transparent) 75%, transparent 87%)`:void 0,backgroundSize:n||d||a||c?`200% 100%`:void 0,animation:n||d||a||c?`pi-status-shine 1.5s linear infinite`:void 0,borderRadius:6,border:`1px solid var(--border)`},children:[(0,L.jsx)(`textarea`,{ref:y,"data-testid":`git-commit-message`,value:e,disabled:n||d||a||c,placeholder:d?g?`${v(`git.ai.generating`)}(${g})`:v(`git.ai.generating`):v(`files.commitMessagePlaceholder`),onChange:e=>t(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),S||i())},rows:1,style:{flex:`0 1 auto`,minWidth:0,resize:`none`,boxSizing:`content-box`,overflowY:`auto`,maxHeight:120,fontSize:`var(--text-base)`,lineHeight:1.4,padding:`4px 6px`,color:n||d||a||c?`var(--text-dim)`:`var(--text)`,background:`transparent`,border:`none`,borderRadius:6,outline:`none`}}),(0,L.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:4,padding:`2px 6px 4px`},children:[(0,L.jsx)(rr,{label:(()=>{let e=v(d?`git.ai.generating`:`git.ai.generate`);return g?`${e}(${g})`:e})(),children:(0,L.jsx)(`button`,{onClick:p,disabled:d||!f||n||a||c,"aria-label":v(`git.ai.generate`),style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:36,height:30,padding:0,flexShrink:0,background:`none`,border:`1px solid transparent`,borderRadius:6,color:d||!f||n||a||c?`var(--text-dim)`:`var(--accent)`,cursor:d||!f||n||a||c?`default`:`pointer`},children:d?(0,L.jsx)(de,{size:z.lg,style:{animation:`spin 0.8s linear infinite`}}):(0,L.jsx)(Oe,{size:z.lg})})}),(0,L.jsx)(rr,{label:n?v(`files.committing`):S&&b&&!x?v(`files.commitMessageRequired`):x?`${v(`git.ai.generateAndCommit`)} (Ctrl+Enter)`:`${v(`files.commit`)} (Ctrl+Enter)`,children:(0,L.jsx)(`button`,{"data-testid":`git-commit`,onClick:i,disabled:S||c,"aria-label":v(`files.commit`),style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:36,height:30,padding:0,flexShrink:0,background:`none`,border:`1px solid transparent`,borderRadius:6,color:S||c?`var(--text-dim)`:`var(--accent)`,cursor:S||c?`default`:`pointer`},children:n?(0,L.jsx)(de,{size:z[`2xl`],style:{animation:`spin 0.8s linear infinite`}}):(0,L.jsx)(ae,{size:z[`2xl`]})})}),(0,L.jsx)(rr,{label:v(a?`files.pushing`:o?`files.push`:`files.pushUpToDate`),children:(0,L.jsx)(`button`,{"data-testid":`git-push`,onClick:s,disabled:a||n||c||!o,"aria-label":v(`files.push`),style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:36,height:30,padding:0,flexShrink:0,background:`none`,border:`1px solid transparent`,borderRadius:6,color:a||n||c||!o?`var(--text-dim)`:`var(--accent)`,cursor:a||n||c||!o?`default`:`pointer`},children:a?(0,L.jsx)(de,{size:z.lg,style:{animation:`spin 0.8s linear infinite`}}):(0,L.jsx)(A,{size:z[`2xl`]})})}),(0,L.jsx)(rr,{label:v(c?`files.pulling`:l?`files.pull`:`files.pullUpToDate`),children:(0,L.jsx)(`button`,{"data-testid":`git-pull`,onClick:u,disabled:c||n||a||!l,"aria-label":v(`files.pull`),style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:36,height:30,padding:0,flexShrink:0,background:`none`,border:`1px solid transparent`,borderRadius:6,color:c||n||a||!l?`var(--text-dim)`:`var(--accent)`,cursor:c||n||a||!l?`default`:`pointer`},children:c?(0,L.jsx)(de,{size:z.lg,style:{animation:`spin 0.8s linear infinite`}}):(0,L.jsx)(k,{size:z[`2xl`]})})})]})]})})}function C9({prefix:e,count:t,additions:n,deletions:r,t:i}){return(0,L.jsxs)(`div`,{"aria-label":i(`files.changeStats`,{count:t,additions:n,deletions:r}),style:{display:`flex`,alignItems:`center`,gap:6,height:24,padding:`0 10px`,fontSize:`var(--text-base)`},children:[e&&(0,L.jsx)(`span`,{style:{color:`var(--text-dim)`},children:e}),(0,L.jsx)(`span`,{style:{color:`var(--text-dim)`},children:i(`files.changedCount`,{count:t})}),(0,L.jsxs)(`span`,{style:{color:_9.added,fontFamily:`var(--font-mono)`},children:[`+`,n]}),(0,L.jsxs)(`span`,{style:{color:_9.deleted,fontFamily:`var(--font-mono)`},children:[`-`,r]})]})}function w9({message:e,onDismiss:t}){let{t:n}=R();return(0,L.jsxs)(`div`,{role:`alert`,style:{display:`flex`,alignItems:`center`,gap:6,marginTop:4,padding:`6px 8px`,fontSize:`var(--text-sm)`,lineHeight:1.35,color:`var(--status-error)`,background:`var(--bg)`,border:`1px solid var(--status-error)`,borderRadius:6},children:[(0,L.jsx)(`span`,{style:{minWidth:0,flex:1,overflowWrap:`anywhere`,maxHeight:140,overflowY:`auto`,whiteSpace:`pre-wrap`},children:e}),(0,L.jsx)(b9,{onClick:t,title:n(`files.dismissError`)})]})}function Gte({children:e}){return(0,L.jsx)(`div`,{style:{padding:`0 4px 2px`},children:e})}var Kte=(0,_.forwardRef)(function({children:e},t){return(0,L.jsx)(`div`,{ref:t,style:{padding:`2px 4px`},children:e})}),qte=(0,_.forwardRef)(function({cwd:e,onOpenFile:t,refreshKey:n,searchQuery:r,onAtMention:i,onAtMentions:a,onUploadBusyChange:o,changesCollapsed:s,onChangesCountChange:c,sessionId:l,onOpenConfig:u},d){let{t:f}=R(),[p,m]=(0,_.useState)([]),[h,g]=(0,_.useState)(!0),[v,y]=(0,_.useState)(null),b=(0,_.useRef)(null),[x,S]=(0,_.useState)(new Set),[C,w]=(0,_.useState)(0),T=(r??``).trim().toLowerCase(),E=(0,_.useMemo)(()=>{if(!T)return p;function e(t){if(t.name.toLowerCase().includes(T))return t;if(t.isDir&&t.children){let n=t.children.map(e).filter(e=>e!==null);if(n.length>0)return{...t,children:n}}return null}return p.map(e).filter(e=>e!==null)},[p,T]),[D,O]=(0,_.useState)(new Set),[k,A]=(0,_.useState)([]),[j,M]=(0,_.useState)({additions:0,deletions:0}),[N,ee]=(0,_.useState)([]),[te,P]=(0,_.useState)({additions:0,deletions:0}),ne=(0,_.useMemo)(()=>T?N.filter(t=>SO(t.filePath,e).toLowerCase().includes(T)):N,[N,T,e]),re=(0,_.useMemo)(()=>T?k.filter(t=>SO(t.filePath,e).toLowerCase().includes(T)):k,[k,T,e]),[ie,ae]=(0,_.useState)({branch:null,upstream:null,ahead:0,behind:0,hasUpstream:!1}),[oe,F]=(0,_.useState)(null),[I,se]=(0,_.useState)(``),[ce,le]=(0,_.useState)(!1),[ue,de]=(0,_.useState)(null),[fe,pe]=(0,_.useState)(!1),[me,he]=(0,_.useState)(!1),[ge,_e]=(0,_.useState)(null),ve=Tr(),ye=(0,_.useRef)(0),[be,xe]=(0,_.useState)(!1),[Se,Ce]=(0,_.useState)(!1),we=(0,_.useSyncExternalStore)(Et.subscribe,()=>Et.get()?.preferences??f9,()=>f9),Te=(0,_.useSyncExternalStore)(wt.subscribe,()=>wt.get()),Ee=we.commitMessageAutoGenerateOnEmpty!==!1,De=we.commitStageAllConfirm!==!1,ke=we.commitMessageUseCurrentModel===!0?!!(l||Te?.defaultModel||(Te?.modelList?.length??0)>0):!!(typeof we.commitMessageModel==`string`&&we.commitMessageModel),[Ae,je]=(0,_.useState)(!1),[Me,Ne]=(0,_.useState)(null),Pe=(0,_.useRef)(null),[Fe,Ie]=(0,_.useState)(!1),[Le,Re]=(0,_.useState)(null),[ze,Ve]=(0,_.useState)(`idle`),[He,Ue]=(0,_.useState)(0),[We,Ge]=(0,_.useState)(null),[Ke,qe]=(0,_.useState)(null),[Je,Ye]=(0,_.useState)(null),Xe=(0,_.useRef)(null),Ze=(0,_.useRef)(null),Qe=`${n??0}:${C}`,$e=ze!==`idle`,et=(0,_.useMemo)(()=>new Map(k.map(e=>[vO(e.filePath),e])),[k]),tt=(0,_.useMemo)(()=>{let t=new Set,n=vO(e).replace(/\/$/,``);for(let e of k){let r=xO(vO(e.filePath));for(;(r===n||r.startsWith(`${n}/`))&&(t.add(r),r!==n);){let e=xO(r);if(e===r)break;r=e}}return t},[e,k]),nt=(0,_.useCallback)((e,t)=>{S(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]),rt=(0,_.useCallback)(t=>{let n=t.uploaded??[],r=t.skipped??[],i=t.errors??[];qe({uploaded:n,skipped:r,errors:i}),n.length>0&&(O(new Set(n.map(t=>CO(e,t)))),w(e=>e+1))},[e]),it=(0,_.useCallback)(async(t,n)=>{Ye(null),Ge(null),Ue(0),Ve(`uploading`);try{let{status:r,data:i}=await Ute(e,t,n,Ue);if(r===409&&i.conflicts?.length){Ye({files:t,conflicts:i.conflicts,nonReplaceable:i.nonReplaceable??[]});return}if(r<200||r>=300)throw Error(i.error??`Upload failed (HTTP ${r})`);Ue(100),rt(i)}catch(e){Ge(e instanceof Error?e.message:String(e))}finally{Ve(`idle`)}},[rt,e]),at=(0,_.useCallback)(async t=>{if(!(t.length===0||$e)){qe(null),O(new Set),Ye(null),Ge(null),Ue(0),Ve(`checking`);try{let n=await d9(`/api/files/${yO(e)}?type=upload-check`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({fileNames:t.map(e=>e.name)})},{loading:`silent`});if(n.conflicts?.length){Ye({files:t,conflicts:n.conflicts,nonReplaceable:n.nonReplaceable??[]});return}await it(t,`error`)}catch(e){Ge(e instanceof Error?e.message:String(e))}finally{Ve(`idle`)}}},[e,it,$e]),ot=(0,_.useCallback)(e=>{let t=Array.from(e.target.files??[]);e.target.value=``,at(t)},[at]);(0,_.useImperativeHandle)(d,()=>({openUploadPicker(){$e||Ze.current?.click()}}),[$e]);let st=(0,_.useCallback)(async()=>{je(!0);try{let t=await d9(`/api/git/push`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:e})},{loading:`silent`});console.info(`[git-push] ok:`,t.output||`(empty output)`),Ne({ok:!0,output:t.output??``})}catch(e){let t=e instanceof Error?e.message:String(e);console.info(`[git-push] failed:`,t),Ne({ok:!1,output:t})}finally{je(!1),w(e=>e+1)}},[e]),ct=(0,_.useCallback)(async()=>{Ie(!0);try{let t=await d9(`/api/git/pull`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:e})},{loading:`silent`});console.info(`[git-pull] ok:`,t.output||`(empty output)`),Re({ok:!0,output:t.output??``})}catch(e){let t=e instanceof Error?e.message:String(e);console.info(`[git-pull] failed:`,t),Re({ok:!1,output:t})}finally{Ie(!1),w(e=>e+1)}},[e]),lt=(()=>{let e=we.gitAutoFetchIntervalSec;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:0})();(0,_.useEffect)(()=>{if(lt<=0||!e)return;let t=()=>{document.hidden||d9(`/api/git/autofetch-status?cwd=${encodeURIComponent(e)}`,{},{loading:`silent`}).then(e=>{e.cached!==!1&&ae(t=>({...t,ahead:e.ahead??t.ahead,behind:e.behind??t.behind}))}).catch(()=>{})};t();let n=setInterval(t,lt*1e3),r=()=>{document.hidden||t()};return document.addEventListener(`visibilitychange`,r),()=>{clearInterval(n),document.removeEventListener(`visibilitychange`,r)}},[e,lt]),(0,_.useEffect)(()=>{if(Pe.current&&clearTimeout(Pe.current),Me)return Pe.current=setTimeout(()=>Ne(null),1e4),()=>{Pe.current&&clearTimeout(Pe.current)}},[Me]);let ut=(0,_.useRef)(null);(0,_.useEffect)(()=>{if(ut.current&&clearTimeout(ut.current),Le)return ut.current=setTimeout(()=>Re(null),1e4),()=>{ut.current&&clearTimeout(ut.current)}},[Le]),(0,_.useEffect)(()=>{o?.($e)},[o,$e]),(0,_.useEffect)(()=>()=>o?.(!1),[o]),(0,_.useEffect)(()=>{let t=Xe.current!==e;Xe.current=e,t&&(S(new Set),O(new Set),qe(null),Ye(null),Ge(null)),y(null),g(t);let n=!1;return m9(e,{loading:`silent`}).then(e=>{n||m(e)}).catch(e=>{n||(y(e instanceof Error?e.message:String(e)),In(e,`file explorer`))}).finally(()=>{n||g(!1)}),()=>{n=!0}},[e,n,C]),(0,_.useEffect)(()=>{let t=!1;return h9(e,{loading:`silent`}).then(e=>{if(!t){let t=e.isGitRepository;A(t?e.files:[]),M(t?{additions:e.additions,deletions:e.deletions}:{additions:0,deletions:0}),ee(t?e.stagedFiles:[]),P(t?{additions:e.stagedAdditions,deletions:e.stagedDeletions}:{additions:0,deletions:0}),ae(t?{branch:e.branch??null,upstream:e.upstream??null,ahead:e.ahead??0,behind:e.behind??0,hasUpstream:e.hasUpstream??!1}:{branch:null,upstream:null,ahead:0,behind:0,hasUpstream:!1})}}).catch(()=>{t||(A([]),M({additions:0,deletions:0}),ee([]),P({additions:0,deletions:0}),ae({branch:null,upstream:null,ahead:0,behind:0,hasUpstream:!1}))}),()=>{t=!0}},[e,n,C]);let dt=(0,_.useCallback)(async(t,n)=>{F(null);try{let r=await fetch(`/api/git/stage`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:e,filePath:t.filePath,action:n?`unstage`:`stage`})}),i=await r.json().catch(()=>({}));if(!r.ok)throw Error(i.error??`Git ${n?`unstage`:`stage`} failed (HTTP ${r.status})`);w(e=>e+1)}catch(e){F(e instanceof Error?e.message:String(e))}},[e]);(0,_.useEffect)(()=>{c?.(k.length+N.length)},[k,N,c]);let ft=(0,_.useCallback)(async(t,n)=>{let r=n??I;le(!0),de(null);try{let n=await fetch(`/api/git/commit`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:e,message:r,stageAll:t})}),i=await n.json().catch(()=>({}));if(!n.ok)throw Error(i.error??`Commit failed (HTTP ${n.status})`);se(``),de(null),pe(!1),w(e=>e+1)}catch(e){de(e instanceof Error?e.message:String(e))}finally{le(!1)}},[e,I]),pt=(0,_.useCallback)(async()=>{if(me||ce||Ae||Se)return null;let t=++ye.current,n=Et.get()?.preferences??{};if(Object.keys(n).length===0)try{await Et.refresh(),n=Et.get()?.preferences??{}}catch{}let r=n.commitMessageUseCurrentModel===!0,i=typeof n.commitMessageModel==`string`?n.commitMessageModel:``,a=``,o=``;if(r){if(l)try{let e=await d9(`/api/agent/${encodeURIComponent(l)}`),t=e.state?.model??e.model??null;if(t){let e=t;a=e.provider??``,o=e.id??e.modelId??``}if(!a||!o)try{let e=await d9(`/api/sessions/${encodeURIComponent(l)}/state`);e.model&&(a=e.model.provider,o=e.model.id)}catch{}}catch{}if(!a||!o)try{let e=wt.get();if(!e?.defaultModel)try{await wt.refresh(),e=wt.get()}catch{}if(e?.defaultModel?.provider){let t=e.defaultModel;a=t.provider??``,o=t.modelId??t.id??``}if((!a||!o)&&e?.modelList?.[0]){let t=e.modelList[0];a=t.provider??``,o=t.modelId??t.id??``}}catch{}if(!a||!o)return _e(f(`git.ai.noSessionModel`)),null}else{if(!i)return xe(!0),null;let e=i.indexOf(`/`);if(e===-1||(a=i.slice(0,e),o=i.slice(e+1),!a||!o))return _e(f(`git.ai.invalidModel`)),null}let s=n.commitMessageMaxTokens,c=typeof s==`number`&&Number.isFinite(s)?Math.min(4096,Math.max(64,Math.round(s))):512;he(!0),_e(null);try{let n=await ve.start(t=>fetch(`/api/git/generate-commit`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:e,provider:a,modelId:o,maxTokens:c}),signal:t}),Hte,{joinKey:`generate`}).promise;if(t!==ye.current)return null;let r=await n.json().catch(()=>({}));if(!n.ok)throw Error(r.error??`Generate failed (HTTP ${n.status})`);if(!r.message)throw Error(`Empty response`);return se(r.message),r.message}catch(e){return t!==ye.current||e instanceof Cr&&e.message===`cancelled`||_e(e instanceof Error?e.message:String(e)),null}finally{t===ye.current&&he(!1)}},[me,ce,Ae,Se,e,l,f,ve]),mt=(0,_.useCallback)(async()=>{let t=await h9(e),n=t.isGitRepository;A(n?t.files:[]),M(n?{additions:t.additions,deletions:t.deletions}:{additions:0,deletions:0}),ee(n?t.stagedFiles:[]),P(n?{additions:t.stagedAdditions,deletions:t.stagedDeletions}:{additions:0,deletions:0}),ae(n?{branch:t.branch??null,upstream:t.upstream??null,ahead:t.ahead??0,behind:t.behind??0,hasUpstream:t.hasUpstream??!1}:{branch:null,upstream:null,ahead:0,behind:0,hasUpstream:!1});let r=I.trim()===``,i=n?t.stagedFiles??[]:[],a=n?t.files??[]:[],o=i.length+a.length>0;if(r&&Ee&&ke&&o&&!me&&!ce&&!Ae&&!Se){Ce(!0);try{let e=await pt();if(!e)return;i.length>0?await ft(!1,e):De?pe(!0):await ft(!0,e)}finally{Ce(!1)}return}i.length>0?ft(!1):De?pe(!0):ft(!0)},[e,I,Ee,ke,De,me,ce,Ae,Se,pt,ft]),ht=$e||Je!==null||We!==null||Ke!==null,gt=(0,_.useCallback)(()=>{!Ke||Ke.uploaded.length===0||a?.(Ke.uploaded.map(t=>SO(CO(e,t),e)))},[e,a,Ke]);return(0,L.jsxs)(`div`,{style:{minHeight:`100%`},children:[(0,L.jsx)(`input`,{ref:Ze,type:`file`,multiple:!0,hidden:!0,onChange:ot}),ht&&(0,L.jsxs)(`div`,{style:{padding:`6px 8px`,borderBottom:`1px solid var(--border)`},children:[$e&&(0,L.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-label":ze===`checking`?f(`files.checking`):f(`files.uploading`,{progress:He}),children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8,minHeight:14,color:`var(--text-muted)`},children:[ze===`checking`?(0,L.jsx)(`svg`,{width:z.lg,height:z.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,style:{animation:`spin 0.8s linear infinite`},"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`M21 12a9 9 0 1 1-5.7-8.4`})}):(0,L.jsxs)(`svg`,{width:z.lg,height:z.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,L.jsx)(`path`,{d:`M12 16V4`}),(0,L.jsx)(`path`,{d:`m7 9 5-5 5 5`}),(0,L.jsx)(`path`,{d:`M5 20h14`})]}),ze===`uploading`&&(0,L.jsxs)(`span`,{style:{fontSize:`var(--text-xs)`},children:[He,`%`]})]}),ze===`uploading`&&(0,L.jsx)(`div`,{style:{height:3,marginTop:4,overflow:`hidden`,borderRadius:2,background:`var(--border)`},children:(0,L.jsx)(`div`,{style:{width:`${He}%`,height:`100%`,background:`var(--text-muted)`,transition:`width 120ms ease`}})})]}),Je&&(0,L.jsxs)(`div`,{role:`alert`,style:{padding:7,border:`1px solid color-mix(in srgb, #f59e0b 55%, var(--border))`,borderRadius:4,background:`color-mix(in srgb, #f59e0b 9%, var(--bg-panel))`},children:[(0,L.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text)`,lineHeight:1.35,overflowWrap:`anywhere`},children:f(`files.conflictSummary`,{count:Je.conflicts.length,countSuffix:Je.conflicts.length===1?``:`s`,files:Je.conflicts.join(`, `)})}),Je.nonReplaceable.length>0&&(0,L.jsx)(`div`,{style:{marginTop:3,fontSize:`var(--text-xs)`,color:`#f59e0b`,lineHeight:1.35,overflowWrap:`anywhere`},children:f(`files.cannotReplace`,{files:Je.nonReplaceable.join(`, `)})}),(0,L.jsxs)(`div`,{style:{display:`flex`,gap:5,marginTop:7},children:[(0,L.jsx)(`button`,{type:`button`,onClick:()=>void it(Je.files,`overwrite`),style:{height:22,padding:`0 7px`,border:`1px solid var(--status-error)`,borderRadius:4,background:`transparent`,color:`var(--status-error)`,cursor:`pointer`,fontSize:`var(--text-xs)`},children:f(`files.replace`)}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>void it(Je.files,`skip`),style:{height:22,padding:`0 7px`,border:`1px solid var(--border)`,borderRadius:4,background:`var(--bg-panel)`,color:`var(--text)`,cursor:`pointer`,fontSize:`var(--text-xs)`},children:f(`files.skipExisting`)}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>Ye(null),style:{height:22,padding:`0 7px`,border:`none`,borderRadius:4,background:`transparent`,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-xs)`},children:f(`files.cancel`)})]})]}),We&&(0,L.jsxs)(`div`,{role:`alert`,style:{display:`flex`,alignItems:`flex-start`,gap:6,fontSize:`var(--text-sm)`,lineHeight:1.35,color:`var(--status-error)`},children:[(0,L.jsx)(`span`,{style:{minWidth:0,flex:1,overflowWrap:`anywhere`},children:We}),(0,L.jsx)(b9,{onClick:()=>Ge(null),title:f(`files.dismissError`)})]}),Ke&&(0,L.jsxs)(`div`,{"aria-live":`polite`,children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,minHeight:22,fontSize:`var(--text-sm)`},children:[(0,L.jsxs)(`div`,{style:{minWidth:0,flex:1,display:`flex`,alignItems:`center`,gap:8},children:[Ke.uploaded.length>0&&(0,L.jsxs)(`span`,{title:`${Ke.uploaded.length} uploaded`,"aria-label":`${Ke.uploaded.length} uploaded`,style:{display:`flex`,alignItems:`center`,gap:3,color:`var(--status-success)`},children:[(0,L.jsx)(`svg`,{width:z.lg,height:z.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`m5 12 4 4L19 6`})}),(0,L.jsx)(`span`,{children:Ke.uploaded.length})]}),Ke.skipped.length>0&&(0,L.jsxs)(`span`,{title:`${Ke.skipped.length} skipped`,"aria-label":`${Ke.skipped.length} skipped`,style:{display:`flex`,alignItems:`center`,gap:3,color:`var(--text-dim)`},children:[(0,L.jsxs)(`svg`,{width:z.lg,height:z.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,L.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,L.jsx)(`path`,{d:`M8 12h8`})]}),(0,L.jsx)(`span`,{children:Ke.skipped.length})]}),Ke.errors.length>0&&(0,L.jsxs)(`span`,{title:f(`files.uploadFailed`,{count:Ke.errors.length}),"aria-label":f(`files.uploadFailed`,{count:Ke.errors.length}),style:{display:`flex`,alignItems:`center`,gap:3,color:`var(--status-error)`},children:[(0,L.jsxs)(`svg`,{width:z.lg,height:z.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,L.jsx)(`path`,{d:`M12 3 2.5 20h19L12 3Z`}),(0,L.jsx)(`path`,{d:`M12 9v4`}),(0,L.jsx)(`path`,{d:`M12 17h.01`})]}),(0,L.jsx)(`span`,{children:Ke.errors.length})]})]}),Ke.uploaded.length>0&&a&&(0,L.jsxs)(`button`,{type:`button`,onClick:gt,title:Ke.uploaded.length===1?f(`files.addUploadedFile`):f(`files.addAllUploadedFiles`),"aria-label":Ke.uploaded.length===1?f(`files.addUploadedFile`):f(`files.addAllUploadedFiles`),style:{height:22,padding:`0 7px`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:4,flexShrink:0,border:`1px solid var(--border)`,borderRadius:4,background:`var(--bg-panel)`,color:`var(--accent)`,cursor:`pointer`,fontSize:`var(--text-sm)`,fontWeight:600,whiteSpace:`nowrap`},children:[(0,L.jsx)(y9,{}),f(`files.mention`)]}),(0,L.jsx)(b9,{onClick:()=>qe(null),title:f(`files.dismissUploadResults`)})]}),Ke.errors.map(e=>(0,L.jsxs)(`div`,{title:e.error,style:{display:`flex`,alignItems:`center`,gap:4,marginTop:3,minWidth:0,fontSize:`var(--text-xs)`,color:`var(--status-error)`},children:[(0,L.jsxs)(`svg`,{width:z.sm,height:z.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0},"aria-hidden":`true`,children:[(0,L.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,L.jsx)(`path`,{d:`M12 8v5`}),(0,L.jsx)(`path`,{d:`M12 17h.01`})]}),(0,L.jsx)(`span`,{style:{minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.name})]},e.name))]})]}),!s&&(0,L.jsxs)(Gte,{children:[(0,L.jsx)(Wte,{message:I,onMessageChange:se,commitBusy:ce||Se,canCommit:N.length+k.length>0,onCommit:mt,pushBusy:Ae,canPush:ie.hasUpstream?ie.ahead>0:!!ie.branch&&ie.branch!==`HEAD`,onPush:st,pullBusy:Fe,canPull:ie.hasUpstream&&ie.behind>0,onPull:ct,aiBusy:me,canAiGenerate:N.length+k.length>0,onAiGenerate:()=>{se(``),pt()},autoGenerateOnEmpty:Ee,hasModelForAuto:ke,aiModelHint:(()=>{if(we.commitMessageUseCurrentModel===!0)return f(`git.ai.usingCurrentModel`);let e=typeof we.commitMessageModel==`string`?we.commitMessageModel:``;return e?f(`git.ai.usingModel`,{model:e}):``})(),t:f}),Me&&(0,L.jsxs)(`div`,{role:`status`,"aria-live":`polite`,style:{marginTop:4,padding:`6px 8px`,borderRadius:6,border:`1px solid ${Me.ok?`var(--status-success)`:`var(--status-error)`}`,background:`var(--bg)`,fontSize:`var(--text-sm)`,lineHeight:1.5},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:4},children:[(0,L.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:Me.ok?`var(--status-success)`:`var(--status-error)`,flexShrink:0}}),(0,L.jsx)(`span`,{style:{color:`var(--text-muted)`,flex:1,minWidth:0},children:f(Me.ok?`files.pushSuccess`:`files.pushFailed`)}),(0,L.jsx)(`button`,{onClick:()=>Ne(null),"aria-label":f(`files.dismissError`),style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:16,height:16,padding:0,background:`none`,border:`none`,borderRadius:4,color:`var(--text-dim)`,cursor:`pointer`,flexShrink:0},children:(0,L.jsx)(Be,{size:z.base})})]}),Me.output&&(0,L.jsx)(`pre`,{style:{margin:0,maxHeight:140,overflow:`auto`,whiteSpace:`pre-wrap`,wordBreak:`break-all`,color:Me.ok?`var(--text-muted)`:`var(--status-error)`,fontFamily:`var(--font-mono)`},children:Me.output})]}),Le&&(0,L.jsxs)(`div`,{role:`status`,"aria-live":`polite`,style:{marginTop:4,padding:`6px 8px`,borderRadius:6,border:`1px solid ${Le.ok?`var(--status-success)`:`var(--status-error)`}`,background:`var(--bg)`,fontSize:`var(--text-sm)`,lineHeight:1.5},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:4},children:[(0,L.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:Le.ok?`var(--status-success)`:`var(--status-error)`,flexShrink:0}}),(0,L.jsx)(`span`,{style:{color:`var(--text-muted)`,flex:1,minWidth:0},children:f(Le.ok?`files.pullSuccess`:`files.pullFailed`)}),(0,L.jsx)(`button`,{onClick:()=>Re(null),"aria-label":f(`files.dismissError`),style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:16,height:16,padding:0,background:`none`,border:`none`,borderRadius:4,color:`var(--text-dim)`,cursor:`pointer`,flexShrink:0},children:(0,L.jsx)(Be,{size:z.base})})]}),Le.output&&(0,L.jsx)(`pre`,{style:{margin:0,maxHeight:140,overflow:`auto`,whiteSpace:`pre-wrap`,wordBreak:`break-all`,color:Le.ok?`var(--text-muted)`:`var(--status-error)`,fontFamily:`var(--font-mono)`},children:Le.output})]}),ue&&(0,L.jsx)(w9,{message:ue,onDismiss:()=>de(null)}),oe&&(0,L.jsx)(w9,{message:p9(oe,f),onDismiss:()=>F(null)}),ge&&(0,L.jsx)(w9,{message:ge,onDismiss:()=>_e(null)}),(0,L.jsx)(C9,{prefix:f(`files.stagedPrefix`),count:ne.length,additions:te.additions,deletions:te.deletions,t:f}),ne.length>0?ne.map(n=>(0,L.jsx)(S9,{status:n,cwd:e,onOpenFile:t,onStageToggle:e=>void dt(e,!0),unstage:!0,t:f},`staged-${n.filePath}`)):(0,L.jsx)(`div`,{style:{padding:`8px 10px`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`,textAlign:`center`},children:f(`files.noStagedChanges`)}),(0,L.jsx)(`div`,{style:{height:6}}),(0,L.jsx)(C9,{prefix:f(`files.unstagedPrefix`),count:re.length,additions:j.additions,deletions:j.deletions,t:f}),re.length>0?re.map(n=>(0,L.jsx)(S9,{status:n,cwd:e,onOpenFile:t,onStageToggle:e=>void dt(e,!1),t:f},n.filePath)):(0,L.jsx)(`div`,{style:{padding:`8px 10px`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`,textAlign:`center`},children:f(`files.noUnstagedChanges`)})]}),s&&(0,L.jsxs)(Kte,{ref:b,children:[v?(0,L.jsx)(`div`,{style:{padding:`8px 12px`,fontSize:`var(--text-sm)`,color:`var(--status-error)`},children:p9(v,f)}):(T?E:p).map(n=>(0,L.jsx)(x9,{node:n,depth:0,cwd:e,onOpenFile:t,onAtMention:i,expandedPaths:x,onToggleExpanded:nt,refreshToken:Qe,highlightedPaths:D,gitStatusByPath:et,changedDirectoryPaths:tt,t:f},n.fullPath)),!h&&!v&&p.length===0&&(0,L.jsx)(`div`,{style:{padding:`8px 12px`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:f(`files.noFiles`)})]}),(0,L.jsx)(Yp,{open:be,title:f(`git.ai.notConfiguredTitle`),description:f(`git.ai.notConfiguredDesc`),confirmText:f(`git.ai.goToConfig`),cancelText:f(`sidebar.cancel`),onCancel:()=>xe(!1),onConfirm:()=>{xe(!1),u?.(`git`)},icon:(0,L.jsx)(Oe,{size:z[`5xl`],style:{color:`var(--accent)`}})}),(0,L.jsx)(Yp,{open:fe,title:f(`files.commitTitle`),description:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{children:f(`files.confirmStageAllCommit`,{count:k.length})}),I.trim()!==``&&(0,L.jsx)(`div`,{style:{marginTop:8,padding:`6px 10px`,background:`var(--bg)`,border:`1px solid var(--border)`,borderRadius:6,fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,color:`var(--text-muted)`,whiteSpace:`pre-wrap`,wordBreak:`break-word`,maxHeight:120,overflowY:`auto`,textAlign:`left`},children:I.trim()})]}),confirmText:f(`files.stageAllAndCommit`),cancelText:f(`sidebar.cancel`),onCancel:()=>pe(!1),onConfirm:()=>{pe(!1),ft(!0)},icon:(0,L.jsxs)(`svg`,{width:z[`5xl`],height:z[`5xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`var(--status-warning)`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,style:{flexShrink:0,marginTop:1},children:[(0,L.jsx)(`path`,{d:`M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10Z`}),(0,L.jsx)(`path`,{d:`m9 12 2 2 4-4`})]})})]})});function T9({visible:e=!0,gap:t=4,items:n}){return e?(0,L.jsx)(`div`,{style:{display:`flex`,gap:t,flexShrink:0},children:n.map(e=>(0,L.jsx)(rr,{label:e.title,children:(0,L.jsx)(`button`,{type:`button`,onClick:e.onClick,disabled:e.disabled,"data-testid":e.testId,"aria-label":e.title,"aria-pressed":e.ariaPressed,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:32,height:32,padding:0,background:e.background??`transparent`,border:`1px solid ${e.borderColor??`var(--border)`}`,borderRadius:7,color:e.color??`var(--text-muted)`,cursor:e.disabled?`default`:`pointer`,flexShrink:0,opacity:e.disabled?.6:1,transition:`background 0.12s, color 0.12s, border-color 0.12s`,"--hover-bg":e.danger?`color-mix(in srgb, var(--status-error) 8%, transparent)`:`var(--bg-selected)`,"--hover-color":e.danger?`var(--status-error)`:`var(--accent)`,"--hover-border":e.danger?`color-mix(in srgb, var(--status-error) 35%, transparent)`:`color-mix(in srgb, var(--accent) 35%, transparent)`},className:e.skipHover?void 0:`hover-shift`,children:e.icon})},e.key))}):null}var E9=2;function Jte({scrollStepPx:e=200,wrapperStyle:t,children:n,testId:r,hintTestId:i}){let a=(0,_.useRef)(null),[o,s]=(0,_.useState)({scrollHeight:0,clientHeight:0,scrollTop:0}),c=(0,_.useCallback)(()=>{if(document.hidden)return;let e=a.current;e&&s({scrollHeight:e.scrollHeight,clientHeight:e.clientHeight,scrollTop:e.scrollTop})},[]);(0,_.useLayoutEffect)(()=>{c();let e=a.current;if(!e)return;let t=new ResizeObserver(c);return t.observe(e),()=>t.disconnect()},[c]);let{scrollHeight:l,clientHeight:u,scrollTop:d}=o,f=l-u>20,p=d<=E9,m=d+u>=l-E9,h=t=>{let n=a.current;if(!n)return;let r=Math.max(0,n.scrollHeight-n.clientHeight);n.scrollTo({top:Math.max(0,Math.min(r,n.scrollTop+t*e)),behavior:`smooth`})},g=e=>{let t=a.current;t&&t.scrollTo({top:e===`top`?0:Math.max(0,t.scrollHeight-t.clientHeight),behavior:`smooth`})};return(0,L.jsxs)(`div`,{style:{position:`relative`,...t},children:[(0,L.jsx)(`div`,{ref:a,"data-testid":r,onScroll:c,style:{position:`absolute`,inset:0,overflowY:`auto`,overflowX:`hidden`,padding:0},children:n}),f&&!p&&(0,L.jsx)(mK,{direction:`up`,visible:!0,testId:i?`${i}-scroll-up`:void 0,onHover:()=>h(-1),onClick:()=>g(`top`)}),f&&!m&&(0,L.jsx)(mK,{direction:`down`,visible:!0,testId:i?`${i}-scroll-down`:void 0,onHover:()=>h(1),onClick:()=>g(`bottom`)})]})}function Yte({...e}){return(0,L.jsx)(ja,{"data-slot":`collapsible`,...e})}function Xte({...e}){return(0,L.jsx)(Ea,{"data-slot":`collapsible-trigger`,...e})}function Zte({...e}){return(0,L.jsx)(Oa,{"data-slot":`collapsible-content`,...e})}function Qte({title:e,titleTooltip:t,open:n,onToggle:r,collapsible:i=!0,actions:a,expandedFlex:o=`1 1 0`,style:s,children:c}){return(0,L.jsxs)(Yte,{open:n,onOpenChange:r,style:{borderTop:`1px solid var(--border)`,display:`flex`,flexDirection:`column`,flex:n?o:`0 0 auto`,minHeight:0,overflow:`hidden`,...s},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,flexShrink:0,background:`var(--bg-panel)`},children:[(0,L.jsx)(rr,{label:t??e,children:(0,L.jsx)(Xte,{asChild:!0,children:(0,L.jsxs)(`button`,{type:`button`,disabled:!i,style:{display:`flex`,alignItems:`center`,gap:6,flex:`0 0 auto`,height:36,padding:`0 12px`,background:`none`,border:`none`,color:`var(--text-muted)`,cursor:i?`pointer`:`default`,fontSize:`var(--text-base)`,fontWeight:600,letterSpacing:`0.05em`,textTransform:`none`,textAlign:`left`},children:[i&&(0,L.jsx)(`svg`,{width:z.xs,height:z.xs,viewBox:`0 0 10 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{transform:n?`rotate(90deg)`:`none`,transition:`transform 0.15s`,flexShrink:0},children:(0,L.jsx)(`polyline`,{points:`3 2 7 5 3 8`})}),(0,L.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e})]})})}),a&&(0,L.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,marginLeft:`auto`,minWidth:0,gap:6,flexShrink:1,paddingRight:4},children:a})]}),(0,L.jsx)(Zte,{style:{display:`flex`,flexDirection:`column`,minHeight:0,flex:1},children:c})]})}function D9({title:e,titleTooltip:t,open:n,onToggle:r,collapsible:i=!0,actions:a,headerExtra:o,expandedFlex:s=`1 1 0`,scrollStepPx:c=200,testId:l,hintTestId:u,rootTestId:d,scrollStyle:f,style:p,children:m}){return(0,L.jsx)(`div`,{"data-testid":d,style:{display:`flex`,flexDirection:`column`,border:`1px solid var(--border)`,borderRadius:0,background:`var(--bg-panel)`,overflow:`hidden`,...p},children:(0,L.jsxs)(Qte,{title:e,titleTooltip:t,open:n,onToggle:r,collapsible:i,actions:a,expandedFlex:s,style:{borderTop:`none`},children:[o,(0,L.jsx)(Jte,{scrollStepPx:c,wrapperStyle:{flex:1,minHeight:0,...f},testId:l,hintTestId:u,children:m})]})})}function $te({cwd:e,onOpenFile:t,explorerRefreshKey:n,onExplorerRefresh:r,onAtMention:i,onAtMentions:a,sessionId:o,onOpenConfig:s}){let{t:c}=R(),[l,u]=(0,_.useState)(0),[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(0),[h,g]=(0,_.useState)(!0),[v,y]=(0,_.useState)(!1),b=(0,_.useRef)(null),x=(0,_.useRef)(null),[S,C]=(0,_.useState)(!1),[T,E]=(0,_.useState)(``),D=(0,_.useRef)(null);return(0,_.useEffect)(()=>{S&&D.current?.focus()},[S]),er(()=>{n!==void 0&&u(e=>e+1)},[n]),e?(0,L.jsx)(D9,{title:c(`files.explorer`),open:!0,onToggle:()=>{},collapsible:!1,testId:`explorer-scroll`,hintTestId:`explorer`,style:{flex:1,minHeight:0},scrollStyle:{background:`var(--bg)`},actions:(0,L.jsx)(T9,{items:[{key:`git`,testId:`explorer-changes-toggle`,onClick:()=>g(e=>!e),title:c(`sidebar.changedFiles`,{count:p}),ariaPressed:!h,color:p>0?`var(--accent)`:`var(--text-muted)`,background:h?void 0:`var(--bg-selected)`,borderColor:h?void 0:`var(--accent)`,icon:(0,L.jsx)(ie,{size:z.lg})},{key:`search`,testId:`explorer-search-toggle`,onClick:()=>{S&&E(``),C(e=>!e)},title:c(`files.search`),ariaPressed:S,color:S?`var(--accent)`:`var(--text-muted)`,background:S?`var(--bg-selected)`:void 0,icon:(0,L.jsx)(we,{size:z.lg})},{key:`upload`,onClick:()=>x.current?.openUploadPicker(),disabled:d,title:c(`sidebar.uploadFilesTitle`),color:`var(--text-muted)`,icon:(0,L.jsx)(ve,{size:z.base})},{key:`refresh`,onClick:()=>{r?r():u(e=>e+1),y(!0),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>y(!1),2e3)},title:c(`sidebar.refreshExplorer`),skipHover:v,color:v?`var(--status-success)`:`var(--text-muted)`,background:v?`color-mix(in srgb, var(--status-success) 18%, transparent)`:void 0,icon:v?(0,L.jsx)(w,{size:z.lg,color:`var(--status-success)`,strokeWidth:2.5}):(0,L.jsx)(be,{size:z.lg})}]}),headerExtra:S?(0,L.jsxs)(`div`,{"data-testid":`explorer-search`,style:{display:`flex`,alignItems:`center`,gap:4,width:`100%`,minWidth:0,padding:`4px 8px`,background:`var(--bg)`,borderBottom:`1px solid var(--border)`,boxSizing:`border-box`},children:[(0,L.jsx)(we,{size:z.lg,color:`var(--text-muted)`,style:{flexShrink:0}}),(0,L.jsx)(`input`,{ref:D,"data-testid":`explorer-search-input`,value:T,onChange:e=>E(e.target.value),placeholder:c(`files.searchPlaceholder`),"aria-label":c(`files.search`),style:{flex:1,minWidth:0,background:`transparent`,border:`none`,outline:`none`,color:`var(--text)`,fontSize:`var(--text-sm)`}}),T&&(0,L.jsx)(`button`,{type:`button`,onClick:()=>{E(``),D.current?.focus()},"aria-label":c(`chat.clearSearch`),style:{border:`none`,background:`transparent`,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-sm)`,display:`flex`,alignItems:`center`,justifyContent:`center`,width:16,height:16,padding:0,flexShrink:0},children:(0,L.jsx)(Be,{size:z.base})})]}):void 0,children:(0,L.jsx)(qte,{ref:x,cwd:e,onOpenFile:t??(()=>{}),refreshKey:l,searchQuery:T,onAtMention:i,onAtMentions:a,onUploadBusyChange:f,changesCollapsed:h,onChangesCountChange:m,sessionId:o,onOpenConfig:s})}):null}var ene=262144,O9=10485760,tne={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,svg:`image/svg+xml`,bmp:`image/bmp`,ico:`image/x-icon`,avif:`image/avif`},nne={mp3:`audio/mpeg`,wav:`audio/wav`,ogg:`audio/ogg`,oga:`audio/ogg`,opus:`audio/ogg`,m4a:`audio/mp4`,aac:`audio/aac`,flac:`audio/flac`,weba:`audio/webm`,webm:`audio/webm`};function rne(e){return e.replace(/\\/g,`/`).split(`/`).pop()??``}function k9(e){return rne(e).toLowerCase().split(`.`).pop()??``}function ine(e){return tne[k9(e)]??null}function ane(e){return nne[k9(e)]??null}function one(e){let t=k9(e);return t===`pdf`||t===`docx`?t:null}function sne(e){return ine(e)!==null}function cne(e){return ane(e)!==null}function lne(e){return one(e)!==null}async function une(e,t){let n=e.split(/[\\/]/).filter(Boolean),r=n.pop();if(!r)throw Error(`Invalid file path`);let i=n.join(`/`)||`/`,a=new FormData;a.append(`files`,new File([t],r,{type:`text/plain`}));let o=await fetch(`/api/files/${yO(i)}?type=upload&conflict=overwrite`,{method:`POST`,body:a});if(!o.ok){let e=`Save failed (${o.status})`;try{let t=await o.json();t?.error&&(e=t.error)}catch{}throw Error(e)}}var dne=(0,_.lazy)(()=>D0(()=>import(`./CodeMirrorEditor-DIiHnHN2.js`),__vite__mapDeps([20,1]))),fne={source:`Source`,preview:`Preview`,diff:`Diff`},A9={fontFamily:`var(--font-mono)`,fontSize:`var(--text-lg)`,lineHeight:1.6},j9={width:48,minWidth:48,padding:`0 10px`,textAlign:`right`,color:`var(--text-dim)`,background:`var(--bg-panel)`,borderRight:`1px solid var(--border)`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,fontStyle:`normal`,fontVariantNumeric:`tabular-nums`,lineHeight:`20.8px`,userSelect:`none`,flexShrink:0,verticalAlign:`top`};function pne(){return(0,L.jsxs)(`svg`,{width:z.xl,height:z.xl,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,L.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,L.jsx)(`path`,{d:`M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8`})]})}function M9(e){return(e.nodeType===Node.ELEMENT_NODE?e:e.parentElement)?.closest(`.file-source-line[data-line-number]`)??null}function N9(e,t){if(!t||t.isCollapsed||t.rangeCount===0)return null;let n=t.getRangeAt(0);if(!e.contains(n.startContainer)||!e.contains(n.endContainer))return null;let r=M9(n.startContainer),i=M9(n.endContainer);if(!r||!i||!e.contains(r)||!e.contains(i))return null;let a=Number(r.dataset.lineNumber),o=Number(i.dataset.lineNumber);if(!Number.isInteger(a)||!Number.isInteger(o))return null;if(a<o){let e=r.querySelector(`.file-source-line-content`);if(e?.contains(n.startContainer)){let t=document.createRange();if(t.selectNodeContents(e),t.setStart(n.startContainer,n.startOffset),t.toString().length===0){let e=r.nextElementSibling;e instanceof HTMLElement&&e.matches(`.file-source-line[data-line-number]`)&&(r=e,a=Number(r.dataset.lineNumber))}}let t=i.querySelector(`.file-source-line-content`);if(t?.contains(n.endContainer)){let e=document.createRange();if(e.selectNodeContents(t),e.setEnd(n.endContainer,n.endOffset),e.toString().length===0){let e=i.previousElementSibling;e instanceof HTMLElement&&e.matches(`.file-source-line[data-line-number]`)&&(i=e,o=Number(i.dataset.lineNumber))}}}return a>o?null:{startLine:a,endLine:o}}function mne({rows:e,stylesheet:t,useInlineStyles:n,wrapLines:r}){return e.map((e,i)=>{let a=e.children??[],o=a[0]?.properties?.className,s=Array.isArray(o)&&o.includes(`react-syntax-highlighter-line-number`),c=s?a[0]:null,l=s?a.slice(1):a;return(0,L.jsxs)(`span`,{className:`file-source-line`,"data-line-number":i+1,style:{display:`flex`,minWidth:`100%`},children:[c&&j6({node:c,stylesheet:t,useInlineStyles:n,key:`source-line-number-${i}`}),(0,L.jsx)(`span`,{className:`file-source-line-content`,style:{flex:`1 1 auto`,minWidth:0,overflowWrap:r?`anywhere`:`normal`,whiteSpace:r?`pre-wrap`:`pre`},children:l.map((e,r)=>j6({node:e,stylesheet:t,useInlineStyles:n,key:`source-token-${i}-${r}`}))})]},`source-line-${i}`)})}function P9(e,t,n,r={}){let i=yO(e),a=new URLSearchParams({type:t});n&&a.set(`sessionId`,n);for(let[e,t]of Object.entries(r))t!==void 0&&a.set(e,String(t));return`/api/files/${i}?${a.toString()}`}function F9({filePath:e,sourceSessionId:t}){let{t:n}=R();return(0,L.jsx)(rr,{label:n(`i18n.downloadFile`),children:(0,L.jsx)(`a`,{href:P9(e,`download`,t),download:bO(e),"aria-label":n(`i18n.downloadFile`),className:`file-viewer-icon-button`,children:(0,L.jsxs)(`svg`,{width:z.xl,height:z.xl,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,L.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,L.jsx)(`polyline`,{points:`7 10 12 15 17 10`}),(0,L.jsx)(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]})})})}function I9(e,t,n){let[r,i]=(0,_.useState)(!1),a=(0,_.useRef)(n);(0,_.useEffect)(()=>{a.current=n});let o=(0,_.useRef)(null);return(0,_.useEffect)(()=>(i(!1),o.current?.(),o.current=bJ({ch:`watch`,filePath:e},e=>{e.event===`connected`?i(!0):e.event===`error`?i(!1):a.current(e)}),()=>{o.current?.(),o.current=null}),[e]),{watching:r,closeWatch:(0,_.useCallback)(()=>{o.current?.(),o.current=null,i(!1)},[])}}function L9({filePath:e,cwd:t,extLabel:n,watching:r,sourceSessionId:i,ellipsis:a,children:o}){let{t:s}=R();return(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,padding:`4px 16px`,borderBottom:`1px solid var(--border)`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`,background:`var(--bg)`,flexShrink:0},children:[(0,L.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,...a?{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`}:{}},title:e,children:SO(e,t)}),(0,L.jsx)(`span`,{style:{marginLeft:`auto`},children:n}),o,(0,L.jsxs)(`span`,{title:s(r?`i18n.liveSync`:`i18n.notWatching`),style:{display:`flex`,alignItems:`center`,gap:4,color:r?`var(--status-success)`:`var(--text-dim)`},children:[(0,L.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:r?`var(--status-success)`:`var(--border)`,display:`inline-block`,boxShadow:r?`0 0 4px var(--status-success)`:`none`}}),r?`live`:`static`]}),(0,L.jsx)(F9,{filePath:e,sourceSessionId:i})]})}function R9(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function hne(e){let t=qZ(e);return t?t.flatMap(e=>e.rows.flatMap(e=>{if(e.type===`hunk`)return[];if(e.left.type===`context`&&e.right.type===`context`)return[{type:`unchanged`,text:e.right.text,oldLineNo:e.left.lineNo,newLineNo:e.right.lineNo}];let t=[];return e.left.type===`removed`&&t.push({type:`removed`,text:e.left.text,oldLineNo:e.left.lineNo,newLineNo:null}),e.right.type===`added`&&t.push({type:`added`,text:e.right.text,oldLineNo:null,newLineNo:e.right.lineNo}),t})):[]}function gne({patch:e}){let{t}=R(),n=hne(e);if(!n.some(e=>e.type!==`unchanged`))return(0,L.jsx)(`div`,{style:{padding:`12px 16px`,fontSize:`var(--text-base)`,color:`var(--text-dim)`,fontFamily:`var(--font-mono)`},children:t(`i18n.noChanges`)});let r=new Set(n.flatMap((e,t)=>e.type===`unchanged`?[]:[t])),i=new Set;for(let e of r)for(let t=Math.max(0,e-3);t<=Math.min(n.length-1,e+3);t++)i.add(t);let a=[],o=0;for(;o<n.length;)if(i.has(o)){let e=[];for(;o<n.length&&i.has(o);)e.push(n[o]),o++;a.push({hidden:!1,lines:e})}else{let e=0;for(;o<n.length&&!i.has(o);)e++,o++;a.push({hidden:!0,count:e})}return(0,L.jsx)(`div`,{className:`file-diff-view`,style:{width:`max-content`,minWidth:`100%`,...A9},children:a.map((e,t)=>{if(e.hidden)return(0,L.jsxs)(`div`,{style:{padding:`2px 16px`,color:`var(--text-dim)`,background:`var(--bg-panel)`,fontSize:`var(--text-sm)`,borderTop:`1px solid var(--border)`,borderBottom:`1px solid var(--border)`},children:[`... `,e.count,` unchanged lines ...`]},t);let n=e.lines.map((e,t)=>{let n=e.type===`added`?`color-mix(in srgb, var(--status-success) 12%, transparent)`:e.type===`removed`?`color-mix(in srgb, var(--status-error) 14%, transparent)`:`transparent`,r=e.type===`added`?`+`:e.type===`removed`?`-`:` `,i=e.type===`added`?`var(--status-success)`:e.type===`removed`?`var(--status-error)`:`var(--text-dim)`;return(0,L.jsxs)(`div`,{className:`file-diff-line`,style:{display:`flex`,minWidth:`100%`,background:n,borderLeft:e.type===`added`?`3px solid var(--status-success)`:e.type===`removed`?`3px solid var(--status-error)`:`3px solid transparent`},children:[(0,L.jsx)(`span`,{style:j9,children:e.type===`removed`?e.oldLineNo:e.newLineNo}),(0,L.jsx)(`span`,{style:{minWidth:16,padding:`0 6px`,color:i,userSelect:`none`,flexShrink:0,fontWeight:600},children:r}),(0,L.jsx)(`span`,{className:`file-diff-line-content`,style:{flexShrink:0,padding:`0 8px 0 0`,whiteSpace:`pre`,color:`var(--text)`},children:e.text||`\xA0`})]},t)});return(0,L.jsx)(`div`,{children:n},t)})})}function _ne({filePath:e,cwd:t,sourceSessionId:n}){let[r,i]=(0,_.useState)(0),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(null),d=bO(e).toLowerCase().split(`.`).pop()??``;er(()=>{i(0),o(null),c(null),u(null)},[e,n]);let{watching:f}=I9(e,n,e=>{typeof e.size==`number`&&o(e.size),i(e=>e+1)}),p=P9(e,`read`,n,r?{v:r}:void 0),m=a==null?null:R9(a);return(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`hidden`},children:[(0,L.jsxs)(L9,{filePath:e,cwd:t,extLabel:d||`image`,watching:f,sourceSessionId:n,children:[s&&(0,L.jsxs)(`span`,{children:[s.w,` × `,s.h]}),m&&(0,L.jsx)(`span`,{children:m})]}),(0,L.jsx)(`div`,{style:{flex:1,overflow:`auto`,backgroundColor:`var(--bg-panel)`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:16,backgroundImage:`linear-gradient(45deg, var(--bg) 25%, transparent 25%), linear-gradient(-45deg, var(--bg) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--bg) 75%), linear-gradient(-45deg, transparent 75%, var(--bg) 75%)`,backgroundSize:`16px 16px`,backgroundPosition:`0 0, 0 8px, 8px -8px, -8px 0px`},children:l?(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:4},children:[(0,L.jsx)(`div`,{style:{color:`var(--status-error)`,fontSize:`var(--text-lg)`},children:l}),(0,L.jsx)(z9,{filePath:e,sourceSessionId:n,cwd:t})]}):(0,L.jsx)(`img`,{src:p,alt:e,onLoad:e=>{let t=e.currentTarget;c({w:t.naturalWidth,h:t.naturalHeight})},onError:()=>u(`Failed to load image`),style:{maxWidth:`100%`,maxHeight:`100%`,objectFit:`contain`,boxShadow:`0 2px 8px var(--shadow-color)`}})})]})}function vne({filePath:e,cwd:t,sourceSessionId:n}){let[r,i]=(0,_.useState)(0),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(null),d=bO(e).toLowerCase().split(`.`).pop()??``;er(()=>{i(0),o(null),c(null),u(null)},[e,n]);let{watching:f}=I9(e,n,e=>{typeof e.size==`number`&&o(e.size),c(null),u(null),i(e=>e+1)}),p=P9(e,`read`,n,r?{v:r}:void 0);return(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`hidden`},children:[(0,L.jsxs)(L9,{filePath:e,cwd:t,extLabel:d||`audio`,watching:f,sourceSessionId:n,children:[s!=null&&(0,L.jsx)(`span`,{children:pY(s)}),a!=null&&(0,L.jsx)(`span`,{children:R9(a)})]}),(0,L.jsx)(`div`,{style:{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:24,background:`var(--bg-panel)`},children:(0,L.jsxs)(`div`,{style:{width:`min(680px, 100%)`},children:[l&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{style:{color:`var(--status-error)`,fontSize:`var(--text-lg)`,marginBottom:12,textAlign:`center`},children:l}),(0,L.jsx)(z9,{filePath:e,sourceSessionId:n,cwd:t})]}),(0,L.jsx)(`audio`,{controls:!0,preload:`metadata`,src:p,onLoadedMetadata:e=>c(e.currentTarget.duration),onError:()=>u(`Failed to load audio`),style:{width:`100%`}},p)]})})]})}function yne({filePath:e,cwd:t,sourceSessionId:n}){let{t:r}=R(),[i,a]=(0,_.useState)(0),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(null),u=k9(e),d=u===`pdf`,f=d?P9(e,`read`,n,i?{v:i}:void 0):P9(e,`preview`,n,i?{v:i}:void 0);(0,_.useEffect)(()=>{a(0),s(null),l(null),fetch(P9(e,`meta`,n)).then(e=>e.json()).then(e=>{e.error&&l(e.error),typeof e.size==`number`&&(s(e.size),!d&&e.size>10485760&&l(r(`files.docTooLargeForPreview`,{limit:R9(O9)})))}).catch(e=>l(String(e)))},[e,d,n,r]);let{watching:p}=I9(e,n,e=>{if(typeof e.size==`number`&&(s(e.size),!d&&e.size>10485760)){l(r(`files.docTooLargeForPreview`,{limit:R9(O9)}));return}l(null),a(e=>e+1)});return(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`hidden`},children:[(0,L.jsx)(L9,{filePath:e,cwd:t,extLabel:u===`docx`?`docx preview`:`pdf`,watching:p,sourceSessionId:n,ellipsis:!0,children:o!=null&&(0,L.jsx)(`span`,{children:R9(o)})}),(0,L.jsx)(`div`,{style:{flex:1,minHeight:0,background:`var(--bg-panel)`},children:c?(0,L.jsxs)(`div`,{style:{height:`100%`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,padding:24,color:`var(--status-error)`,fontSize:`var(--text-lg)`,textAlign:`center`},children:[(0,L.jsx)(`div`,{children:c}),(0,L.jsx)(z9,{filePath:e,sourceSessionId:n,cwd:t})]}):(0,L.jsx)(`iframe`,{src:f,sandbox:d?void 0:`allow-same-origin`,title:r(`i18n.previewFile`,{file:bO(e)}),style:{width:`100%`,height:`100%`,border:`none`,background:d?`var(--bg)`:`#eef1f5`}},f)})]})}function z9({filePath:e,sourceSessionId:t,cwd:n}){let{t:r}=R(),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(null),c=typeof n==`string`&&/^[a-zA-Z]:[\\/]/.test(n)||typeof n==`string`&&n.startsWith(`\\\\`),l=(0,_.useCallback)(async n=>{a(!0),s(null);try{let i=await fetch(P9(e,`open`,t,n?{chooseApp:1}:void 0),{method:`POST`}),a=await i.json().catch(()=>null);i.ok?s({ok:!0,text:r(`files.openLaunched`)}):s({ok:!1,text:a?.error??`HTTP ${i.status}`})}catch(e){s({ok:!1,text:String(e)})}finally{a(!1)}},[e,t,r]);return(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:10,marginTop:16},children:[o&&(0,L.jsx)(`div`,{style:{color:o.ok?`var(--text-muted)`:`var(--status-error)`,fontSize:`var(--text-sm)`,maxWidth:460,textAlign:`center`,lineHeight:1.5},children:o.text}),(0,L.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,L.jsx)(`button`,{type:`button`,disabled:i,onClick:()=>l(!1),className:`file-viewer-mode-button file-open-action-button`,children:r(`files.openInSystemApp`)}),c&&(0,L.jsx)(`button`,{type:`button`,disabled:i,onClick:()=>l(!0),className:`file-viewer-mode-button file-open-action-button`,children:r(`files.chooseOtherApp`)})]})]})}function bne({filePath:e,cwd:t,sourceSessionId:n,onOpenFile:r,onMentionLines:i,onSaved:a,gitRefreshKey:o,initialDisplayMode:s}){return sne(e)?(0,L.jsx)(_ne,{filePath:e,cwd:t,sourceSessionId:n}):cne(e)?(0,L.jsx)(vne,{filePath:e,cwd:t,sourceSessionId:n}):lne(e)?(0,L.jsx)(yne,{filePath:e,cwd:t,sourceSessionId:n}):(0,L.jsx)(Sne,{filePath:e,cwd:t,sourceSessionId:n,onOpenFile:r,onMentionLines:i,onSaved:a,gitRefreshKey:o,initialDisplayMode:s})}function xne({filePath:e,cwd:t,metadata:n,watching:r,isDeletedDiff:i,displayModes:a,effectiveDisplayMode:o,setDisplayMode:s,wrapLines:c,setWrapLines:l,editMode:u,dirty:d,handleSave:f,saveState:p,highlightReady:m,selectedLineRange:h,handleMentionSelectedLines:g,fileContent:_,sourceSessionId:v,t:y,saveError:b,enterEdit:x,cancelEdit:S}){return(0,L.jsxs)(`div`,{className:`file-viewer-toolbar`,style:{display:`flex`,alignItems:`center`,gap:8,padding:`5px 12px`,borderBottom:`1px solid var(--border)`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`,background:`var(--bg)`,flexShrink:0},children:[(0,L.jsx)(rr,{label:e,children:(0,L.jsx)(`span`,{className:`file-viewer-path`,style:{fontFamily:`var(--font-mono)`},children:SO(e,t)})}),(0,L.jsx)(rr,{label:n,children:(0,L.jsx)(`span`,{className:`file-viewer-meta`,children:n})}),!i&&(0,L.jsx)(rr,{label:y(r?`i18n.liveSync`:`i18n.notWatching`),children:(0,L.jsx)(`span`,{"aria-label":y(r?`i18n.liveSync`:`i18n.notWatching`),className:`file-viewer-live-indicator`,style:{background:r?`var(--status-success)`:`var(--border)`,boxShadow:r?`0 0 4px var(--status-success)`:`none`}})}),(0,L.jsxs)(`div`,{className:`file-viewer-controls`,children:[a.length>1&&(0,L.jsx)(`div`,{className:`file-viewer-mode-switch`,"aria-label":y(`i18n.fileViewMode`),children:a.map(e=>{let t=o===e;return(0,L.jsx)(rr,{label:e===`diff`?y(`i18n.compareHead`):void 0,children:(0,L.jsx)(`button`,{type:`button`,onClick:()=>s(e),"aria-pressed":t,className:`file-viewer-mode-button`,style:{background:t?`var(--bg-selected)`:`transparent`,color:t?`var(--text)`:`var(--text-muted)`},children:fne[e]})},e)})}),(0,L.jsxs)(`div`,{className:`file-viewer-actions`,children:[o===`source`&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(rr,{label:y(`i18n.mentionSelectedLines`),children:(0,L.jsx)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:g,"aria-label":y(`i18n.mentionSelectedLines`),disabled:!h,className:`file-viewer-icon-button`,children:(0,L.jsx)(pne,{})})}),(0,L.jsx)(rr,{label:y(c?`i18n.disableWrap`:`i18n.enableWrap`),children:(0,L.jsx)(`button`,{type:`button`,onClick:()=>l(e=>!e),"aria-label":y(c?`i18n.disableWrap`:`i18n.enableWrap`),"aria-pressed":c,className:`file-viewer-icon-button`,style:{background:c?`var(--bg-selected)`:`transparent`,color:c?`var(--text)`:`var(--text-muted)`},children:(0,L.jsxs)(`svg`,{width:z.xl,height:z.xl,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,L.jsx)(`path`,{d:`M4 7V4h16v3`}),(0,L.jsx)(`path`,{d:`M9 20h6`}),(0,L.jsx)(`path`,{d:`M12 4v16`})]})})})]}),o===`source`&&m&&!u&&(0,L.jsx)(`a`,{href:P9(e,`download`,v),download:bO(e),"aria-label":y(`i18n.downloadFile`),className:`file-viewer-icon-button`,style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,textDecoration:`none`},children:(0,L.jsxs)(`svg`,{width:z.xl,height:z.xl,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,L.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,L.jsx)(`polyline`,{points:`7 10 12 15 17 10`}),(0,L.jsx)(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]})}),!i&&o===`source`&&(0,L.jsx)(`div`,{className:`file-viewer-edit-controls`,style:{display:`flex`,alignItems:`center`,gap:8,marginLeft:8},children:u?(0,L.jsxs)(L.Fragment,{children:[d&&(0,L.jsx)(rr,{label:y(`i18n.unsavedChanges`),children:(0,L.jsx)(`span`,{"aria-label":y(`i18n.unsavedChanges`),style:{color:`var(--status-warning)`,fontWeight:700},children:`●`})}),(0,L.jsx)(rr,{label:y(`i18n.saveFileShortcut`),children:(0,L.jsx)(`button`,{type:`button`,onClick:f,disabled:!d||p===`saving`,"aria-label":y(`i18n.saveFile`),className:`file-viewer-icon-button`,style:{background:d?`var(--accent)`:`transparent`,color:d?`var(--bg)`:`var(--text-muted)`},children:p===`saving`?(0,L.jsx)(de,{size:z.lg,className:`animate-spin`}):(0,L.jsx)(Ce,{size:z.lg})})}),(0,L.jsx)(rr,{label:y(`i18n.cancelEdit`),children:(0,L.jsx)(`button`,{type:`button`,onClick:S,"aria-label":y(`i18n.cancelEdit`),className:`file-viewer-icon-button`,children:(0,L.jsx)(Be,{size:z.lg})})}),p===`error`&&b&&(0,L.jsx)(`span`,{style:{color:`var(--status-error)`,fontSize:`var(--text-sm)`},children:y(`i18n.saveFailed`,{error:b})}),p===`saved`&&!d&&(0,L.jsx)(`span`,{style:{color:`var(--status-success)`,fontSize:`var(--text-sm)`},children:y(`i18n.saved`)})]}):(0,L.jsx)(rr,{label:y(`i18n.editFile`),children:(0,L.jsx)(`button`,{type:`button`,onClick:x,"aria-label":y(`i18n.editFile`),className:`file-viewer-icon-button`,children:(0,L.jsx)(ge,{size:z.lg})})})}),!i&&(0,L.jsx)(F9,{filePath:e,sourceSessionId:v})]})]})]})}function Sne({filePath:e,cwd:t,sourceSessionId:n,onOpenFile:r,onMentionLines:i,onSaved:a,gitRefreshKey:o,initialDisplayMode:s}){let{isDark:c}=WK(),{t:l}=R(),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(null),[m,h]=(0,_.useState)(!1),[g,v]=(0,_.useState)(!0),[y,b]=(0,_.useState)(null),[x,S]=(0,_.useState)(null),[C,w]=(0,_.useState)(`source`),[T,E]=(0,_.useState)(!1),[D,O]=(0,_.useState)(!1),k=(0,_.useRef)(0),A=(0,_.useRef)(null),[j,M]=(0,_.useState)(null),[N,ee]=(0,_.useState)(!1),[te,P]=(0,_.useState)(``),[ne,re]=(0,_.useState)(!1),[ie,ae]=(0,_.useState)(`idle`),[oe,F]=(0,_.useState)(null),I=(0,_.useRef)(!1);I.current=N;let se=(0,_.useCallback)(e=>fetch(P9(e,`read`,n)).then(async e=>{let t=await e.json();return t.error?(b(t.error),S(e.status),null):(b(null),S(null),d(t),t)}).catch(e=>(b(String(e)),null)),[n]),ce=(0,_.useCallback)(async e=>{let n=++k.current;if(h(!0),!t){p(null),h(!1);return}try{let r=new URLSearchParams({cwd:t,path:e}),i=await fetch(`/api/git/diff?${r.toString()}`),a=await i.json();if(n!==k.current)return;p(i.ok&&a.supported&&typeof a.patch==`string`?a:null)}catch{n===k.current&&p(null)}finally{n===k.current&&h(!1)}},[t]);(0,_.useEffect)(()=>{v(!0),b(null),S(null),d(null),p(null),w(s===`diff`?`diff`:`source`),O(!1),ee(!1),P(``),re(!1),ae(`idle`),F(null),se(e).finally(()=>v(!1))},[e,se]);let{watching:le,closeWatch:ue}=I9(e,n,()=>{I.current||(se(e),ce(e))});(0,_.useEffect)(()=>{ce(e)},[ce,e,o]),(0,_.useEffect)(()=>{u?.language===`markdown`&&s!==`diff`&&w(`preview`)},[u?.language,s]);let fe=f?.supported===!0&&typeof f.patch==`string`,pe=fe&&f.status===`deleted`;(0,_.useEffect)(()=>{pe&&ue()},[pe,ue]);let me=(0,_.useMemo)(()=>u?.language===`markdown`?JU(u.content):``,[u]);(0,_.useEffect)(()=>{let e=()=>{let e=A.current;M(i&&C===`source`&&e?N9(e,window.getSelection()):null)};if(e(),!(!i||C!==`source`))return document.addEventListener(`selectionchange`,e),()=>document.removeEventListener(`selectionchange`,e)},[u?.content,C,i]);let he=(0,_.useCallback)(n=>{!i||!n||i(SO(e,t),n.startLine,n.endLine)},[t,e,i]),ge=(0,_.useCallback)(()=>{he(j)},[he,j]);(0,_.useEffect)(()=>{if(!i||C!==`source`)return;let e=e=>{if(e.repeat||e.key.toLowerCase()!==`i`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey)return;let t=e.target;if(t instanceof Element&&t.closest(`input, textarea, [contenteditable='true']`))return;let n=A.current,r=n?N9(n,window.getSelection()):null;r&&(e.preventDefault(),he(r))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[C,he,i]);let _e=(0,_.useCallback)(()=>{P(u?.content??``),re(!1),ae(`idle`),F(null),ee(!0)},[u?.content]),ve=(0,_.useCallback)(()=>{ee(!1),re(!1),ae(`idle`),F(null),se(e)},[e,se]),ye=(0,_.useCallback)(e=>{P(e),re(e!==(u?.content??``))},[u?.content]),be=(0,_.useCallback)(async()=>{if(ne){ae(`saving`),F(null);try{await une(e,te),d(e=>e&&{...e,content:te}),re(!1),ae(`saved`),a?.(e)}catch(e){ae(`error`),F(e instanceof Error?e.message:String(e))}}},[ne,te,e,a]),xe=u?.content??``;if((0,_.useEffect)(()=>{E(!1)},[xe]),(0,_.useEffect)(()=>{if((pe?`diff`:C)!==`source`||T)return;let e=setTimeout(()=>E(!0),0);return()=>clearTimeout(e)},[pe,C,T]),g||C===`diff`&&m)return(0,L.jsxs)(`div`,{style:{height:`100%`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:12,color:`var(--text-muted)`,fontSize:`var(--text-lg)`},children:[(0,L.jsx)(de,{size:z.lg,className:`animate-spin`,"aria-hidden":`true`}),l(`i18n.loading`)]});if(y&&!pe)return(0,L.jsxs)(`div`,{style:{height:`100%`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,padding:24,color:`var(--status-error)`,fontSize:`var(--text-lg)`,textAlign:`center`},children:[(0,L.jsx)(`div`,{children:x===413?l(`files.fileTooLargeForPreview`,{limit:R9(ene)}):y}),x===413&&(0,L.jsx)(z9,{filePath:e,sourceSessionId:n,cwd:t})]});if(!u&&!pe)return null;let Se=u?.language??`text`,Ce=Se===`html`,we=Se===`markdown`,Te=Ce||we,Ee=xO(e),De=xe.split(`
|
|
497
497
|
`),Oe=pe?`diff`:C,ke=pe?[`diff`]:[`source`,...Te?[`preview`]:[],`diff`],Ae=pe?l(`files.deleted`):`${Se} · ${De.length} lines · ${R9(u.size)}`;return(0,L.jsxs)(`div`,{className:`file-viewer-shell`,style:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`hidden`},children:[(0,L.jsx)(xne,{filePath:e,cwd:t,metadata:Ae,watching:le,isDeletedDiff:pe,displayModes:ke,effectiveDisplayMode:Oe,setDisplayMode:w,wrapLines:D,setWrapLines:O,editMode:N,dirty:ne,handleSave:be,saveState:ie,saveError:oe,enterEdit:_e,cancelEdit:ve,highlightReady:T,selectedLineRange:j,handleMentionSelectedLines:ge,fileContent:xe,sourceSessionId:n,t:l}),(0,L.jsxs)(`div`,{ref:A,className:`file-viewer-content`,style:{flex:1,overflow:`auto`,paddingRight:4,background:`var(--bg)`},children:[Oe===`source`&&(0,L.jsx)(`div`,{className:`file-viewer-source`,style:{display:`block`,height:`100%`,overflow:`auto`,background:`var(--bg)`},children:N?(0,L.jsx)(_.Suspense,{fallback:(0,L.jsx)(`div`,{style:{height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`var(--text-muted)`},children:(0,L.jsx)(de,{size:z.lg,className:`animate-spin`,"aria-hidden":`true`})}),children:(0,L.jsx)(dne,{initialValue:te,language:Se,isDark:c,onChange:ye,onSave:be},e)}):T?(0,L.jsx)(D8,{className:D?`file-source-view is-wrapped`:`file-source-view`,language:Se===`text`?`plaintext`:Se,style:c?v5:_5,showLineNumbers:!0,lineNumberStyle:{...j9},customStyle:{margin:0,padding:0,border:0,background:`var(--bg)`,...A9,width:D?`100%`:`max-content`,minWidth:`100%`,minHeight:`100%`,overflow:`visible`},codeTagProps:{style:{fontFamily:`var(--font-mono)`,overflowWrap:D?`anywhere`:`normal`}},renderer:e=>(0,L.jsx)(mne,{...e,wrapLines:D}),wrapLongLines:D,children:xe}):(0,L.jsx)(`pre`,{className:D?`file-source-view is-wrapped`:`file-source-view`,style:{margin:0,padding:0,border:0,background:`var(--bg)`,...A9,fontFamily:`var(--font-mono)`,whiteSpace:D?`pre-wrap`:`pre`,overflowWrap:D?`anywhere`:`normal`,width:D?`100%`:`max-content`,minWidth:`100%`,minHeight:`100%`,overflow:`visible`},children:xe})}),Oe===`diff`&&fe?(0,L.jsx)(gne,{patch:f.patch}):Oe===`diff`?(0,L.jsx)(`div`,{style:{height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`var(--text-muted)`,fontSize:`var(--text-lg)`},children:l(`i18n.noChanges`)}):Ce&&Oe===`preview`?(0,L.jsx)(`iframe`,{srcDoc:xe,sandbox:`allow-scripts`,style:{width:`100%`,height:`100%`,border:`none`,background:`var(--bg)`},title:l(`i18n.htmlPreview`)}):we&&Oe===`preview`?(0,L.jsx)(`div`,{className:`markdown-body markdown-file-preview`,style:{padding:`24px 32px`},children:(0,L.jsx)(dO,{remarkPlugins:$U,rehypePlugins:tW,components:{code({className:e,children:t,...n}){let r=e?.replace(`language-`,``).toLowerCase()??``,i=String(t);return e?.includes(`language-`)||i.includes(`
|
|
498
498
|
`)?r===`mermaid`?(0,L.jsx)(C5,{code:i.replace(/\n$/,``),defaultPreview:!0}):(0,L.jsx)(D5,{code:i.replace(/\n$/,``),lang:r}):(0,L.jsx)(`code`,{className:e,...n,children:t})},pre({children:e}){return(0,L.jsx)(L.Fragment,{children:e})},a({href:e,children:t,...n}){return delete n.node,(0,L.jsx)(yW,{href:e,markdownDir:Ee,onOpenFile:r,...n,children:t})},img({src:e,alt:r,...i}){delete i.node;let a=typeof e==`string`?_W(e,Ee,t??Ee):null,o=a?P9(a,`read`,n):e;return(0,L.jsx)(`img`,{src:o,alt:r??``,loading:`lazy`,...i})}},children:me})}):null]})]})}var Cne=3e3,wne=6e4;function B9(e,t){return e?e.error?e.path.split(/[\\/]/).pop()||t:e.name||e.firstMessage.slice(0,50)||t.slice(0,12):t.slice(0,12)}function Tne(e,t){return e.filter(e=>!t.has(e))}function Ene(e,t,n,r){switch(e.type){case`prompt_error`:case`extension_error`:{if(!n.errors)return null;let t=e.errorMessage??r(`i18n.commandFailed`);return{title:r(`chat.taskErrorNotificationTitle`),body:t,tag:`agent-error-${e.sessionId}`}}case`extension_ui_request`:{if(!n.questions)return null;let t=e.method;if(t!==`select`&&t!==`confirm`&&t!==`input`&&t!==`editor`)return null;let i=e.title??r(`chat.questionNotificationTitle`);return{title:r(`chat.questionNotificationTitle`),body:i,tag:`question-${e.id??e.sessionId}`}}default:return null}}function Dne(){let{t:e}=R(),{notifyEvents:t}=Gn(),[n,r]=(0,_.useState)([]),i=(0,_.useRef)([]);(0,_.useEffect)(()=>{i.current=n});let a=(0,_.useRef)(t);(0,_.useEffect)(()=>{a.current=t});let o=(0,_.useRef)(e);(0,_.useEffect)(()=>{o.current=e});let{runningSessionIds:s}=wY(),c=(0,_.useRef)(!1),l=(0,_.useRef)([]),u=(0,_.useRef)(new Map);(0,_.useEffect)(()=>{if(!a.current.taskComplete)return;let e=c.current?l.current:null;if(l.current=[...s],c.current=!0,!e)return;let t=Tne(e,s);if(t.length===0)return;let n=Date.now();for(let e of t){let t=u.current.get(e);t!==void 0&&n-t<Cne||(i.current.some(t=>t.id===e)||f.current(),console.info(`[notify] completion via running-snapshot (${e})`),eq({title:o.current(`chat.taskCompleteNotificationTitle`),body:o.current(`chat.sessionCompletedNotificationBody`,{name:B9(i.current.find(t=>t.id===e),e)}),tag:`session-complete-${e}`,notifyWhileActive:a.current.notifyWhileActive}))}},[s]);let d=(0,_.useCallback)(async()=>{try{let e=await fetch(`/api/sessions`,{cache:`no-store`});if(!e.ok)return;let t=await e.json();t.sessions&&r(t.sessions)}catch{}},[]),f=(0,_.useRef)(d);return(0,_.useEffect)(()=>{f.current=d}),(0,_.useEffect)(()=>{d();let e=setInterval(()=>void d(),wne);return()=>clearInterval(e)},[d]),(0,_.useEffect)(()=>bJ({ch:`global`},e=>{let t=e;if(!t.sessionId)return;let n=t.sessionId;(t.type===`prompt_error`||t.type===`extension_error`)&&u.current.set(n,Date.now()),i.current.some(e=>e.id===n)||f.current();let r=Ene(t,B9(i.current.find(e=>e.id===n),n),a.current,o.current);r&&(console.info(`[agent-events] notifying: ${r.title}`),eq({...r,notifyWhileActive:a.current.notifyWhileActive}))}),[]),null}var One=3;function kne(){let{t:e}=R(),t=(0,_.useSyncExternalStore)(Rte,l9,l9);if(t.length===0)return null;let n=t.slice(0,One),r=t.length-n.length;return(0,L.jsx)(`div`,{"aria-busy":`true`,style:{position:`fixed`,inset:0,zIndex:1150,background:`color-mix(in srgb, var(--bg) 40%, transparent)`,display:`flex`,alignItems:`center`,justifyContent:`center`,pointerEvents:`none`},children:(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:10,minWidth:220,maxWidth:`60vw`,padding:`14px 18px`,background:`var(--bg)`,border:`1px solid var(--border)`,borderRadius:`var(--radius)`,boxShadow:`0 8px 32px rgba(0,0,0,0.25)`},children:[n.map(t=>(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,fontSize:`var(--text-sm)`,color:`var(--text)`},children:[(0,L.jsx)(`div`,{style:{width:14,height:14,flexShrink:0,border:`2px solid var(--border)`,borderTopColor:`var(--accent)`,borderRadius:`50%`,animation:`spin 0.8s linear infinite`}}),(0,L.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t.label||e(`loading.inProgress`)})]},t.id)),r>0&&(0,L.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:e(`loading.more`,{count:r})})]})})}function Ane({cwd:e,busy:t,error:n,onCancel:r,onConfirm:i}){let{t:a}=R();return(0,L.jsx)(Hp,{open:!0,onOpenChange:e=>{!e&&!t&&r()},children:(0,L.jsxs)(Kp,{className:`w-[440px] gap-0 overflow-hidden rounded-lg p-0`,style:{zIndex:1100,maxWidth:`100%`},showCloseButton:!1,onPointerDownOutside:e=>{t&&e.preventDefault()},onEscapeKeyDown:e=>{t&&e.preventDefault()},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,gap:12,padding:`18px 18px 14px`},children:[(0,L.jsxs)(`svg`,{width:z[`5xl`],height:z[`5xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`var(--status-warning)`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,style:{flexShrink:0,marginTop:1},children:[(0,L.jsx)(`path`,{d:`M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10Z`}),(0,L.jsx)(`path`,{d:`m9 12 2 2 4-4`})]}),(0,L.jsxs)(`div`,{style:{minWidth:0},children:[(0,L.jsx)(qp,{style:{fontSize:`var(--text-2xl)`,fontWeight:700,color:`var(--text)`,lineHeight:1.4},children:a(`trust.dialogTitle`)}),(0,L.jsx)(Jp,{style:{marginTop:7,fontSize:`var(--text-base)`,lineHeight:1.6,color:`var(--text-muted)`},children:a(`trust.dialogBody`)}),(0,L.jsx)(`code`,{style:{display:`block`,marginTop:10,padding:`8px 10px`,border:`1px solid var(--border)`,borderRadius:5,background:`var(--bg)`,color:`var(--text)`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,overflowWrap:`anywhere`},children:e}),n&&(0,L.jsx)(`div`,{role:`alert`,style:{marginTop:10,color:`var(--status-error)`,fontSize:`var(--text-base)`,lineHeight:1.5},children:n})]})]}),(0,L.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8,padding:`10px 18px`,borderTop:`1px solid var(--border)`},children:[(0,L.jsx)(Vp,{type:`button`,variant:`outline`,onClick:r,disabled:t,className:`h-8 px-3 text-xs`,children:a(`trust.cancel`)}),(0,L.jsx)(Vp,{type:`button`,onClick:i,disabled:t,className:`h-8 px-3 text-xs`,style:{cursor:t?`wait`:`pointer`},children:a(t?`trust.trusting`:`trust.trustProject`)})]})]})})}function jne({onCancel:e,onSelect:t,busy:n=!1,error:r}){let{t:i}=R(),[a,o]=(0,_.useState)(!0),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(``),[p,m]=(0,_.useState)([]),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(``),[b,x]=(0,_.useState)(null),[S,C]=(0,_.useState)(!0),w=(0,_.useRef)(null),T=(0,_.useCallback)(async e=>{C(!0),x(null);try{let t=await nW(e),n=t.path??e??`/`;c(n),u(t.parentPath??null),f(n),m(t.directories??[]),g(t.drives??null),y(``)}catch(e){x(e instanceof Error?e.message:String(e))}finally{C(!1)}},[]);(0,_.useEffect)(()=>{T()},[T]);let E=e=>{e.preventDefault();let t=d.trim();t&&T(t)},D=d.trim()!==s,O=!!s&&!D&&!n,k=!!l||oW(s),A=v.trim().toLowerCase(),j=e=>!A||e.toLowerCase().includes(A),M=h===null?[]:h.filter(e=>j(e.name)||j(e.path)),N=p.filter(e=>j(e.name));return(0,L.jsx)(Hp,{open:a,onOpenChange:t=>{!t&&!n&&(o(!1),e())},children:(0,L.jsxs)(Kp,{className:`directory-picker-light flex w-[520px] max-w-[calc(100vw-16px)] flex-col gap-0 overflow-hidden p-0`,style:{height:`min(620px, calc(100dvh - 16px))`},showCloseButton:!1,onPointerDownOutside:e=>{n&&e.preventDefault()},onEscapeKeyDown:e=>{n&&e.preventDefault()},onOpenAutoFocus:e=>{e.preventDefault(),w.current?.focus()},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,flexShrink:0,padding:`12px 18px`,borderBottom:`1px solid var(--border)`},children:[(0,L.jsx)(qp,{style:{fontWeight:700,fontSize:`var(--text-2xl)`,color:`var(--text)`},children:i(`directoryPicker.selectDirectory`)}),(0,L.jsx)(Wp,{asChild:!0,children:(0,L.jsx)(`button`,{type:`button`,disabled:n,title:i(`i18n.close`),"aria-label":i(`i18n.close`),style:{padding:`2px 6px`,border:0,background:`none`,color:`var(--text-muted)`,fontSize:`var(--text-5xl)`,lineHeight:1,cursor:n?`default`:`pointer`,opacity:n?.5:1},children:`×`})})]}),(0,L.jsxs)(`form`,{onSubmit:E,style:{display:`flex`,alignItems:`center`,gap:8,flexShrink:0,padding:`10px 14px`,borderBottom:`1px solid var(--border)`},children:[(0,L.jsx)(`button`,{className:`directory-picker-back`,type:`button`,onClick:()=>void T(l??void 0),disabled:S||!k,title:i(`directoryPicker.goToParent`),"aria-label":i(`directoryPicker.goToParent`),style:{width:36,height:36,padding:0,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,border:`1px solid var(--border)`,borderRadius:6,background:`#ffffff`,color:`var(--text-muted)`,cursor:k?`pointer`:`default`,opacity:k?1:.45},children:(0,L.jsx)(`svg`,{width:z[`3xl`],height:z[`3xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`m18 15-6-6-6 6`})})}),(0,L.jsx)(`label`,{htmlFor:`directory-path`,style:{position:`absolute`,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,border:0},children:i(`directoryPicker.directoryPath`)}),(0,L.jsx)(Tx,{className:`directory-picker-path h-9 flex-1 font-mono text-xs`,id:`directory-path`,type:`text`,ref:w,value:d,placeholder:`/path/to/project or ~/project`,autoComplete:`off`,spellCheck:!1,style:rW,onChange:e=>{f(e.target.value),x(null)}}),(0,L.jsx)(`button`,{className:`directory-picker-action`,type:`submit`,disabled:S||!d.trim(),title:i(`directoryPicker.goToDirectory`),style:{minWidth:58,height:36,padding:`0 12px`,border:`1px solid var(--border)`,borderRadius:6,background:`#ffffff`,color:`var(--text-muted)`,cursor:S||!d.trim()?`default`:`pointer`,opacity:S||!d.trim()?.6:1},children:i(`directoryPicker.go`)})]}),(0,L.jsxs)(`div`,{className:`directory-picker-list`,style:{flex:1,minHeight:0,overflow:`auto`,padding:`8px 10px`},children:[S?(0,L.jsx)(`div`,{style:{padding:8,color:`var(--text-dim)`,fontSize:`var(--text-sm)`},children:i(`directoryPicker.loadingDirectories`)}):h===null?N.length>0?N.map(e=>(0,L.jsxs)(`button`,{className:`directory-picker-entry`,type:`button`,onClick:()=>void T(e.path),title:e.path,style:{width:`100%`,minHeight:30,display:`flex`,alignItems:`center`,gap:7,padding:`5px 8px`,border:0,borderRadius:5,background:`none`,color:`var(--text-muted)`,cursor:`pointer`,textAlign:`left`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`},children:[(0,L.jsx)(iW,{}),(0,L.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.name})]},e.path)):(0,L.jsx)(`div`,{style:{padding:8,color:`var(--text-dim)`,fontSize:`var(--text-sm)`},children:i(A?`directoryPicker.noMatches`:`directoryPicker.noSubdirectories`)}):M.length>0?M.map(e=>(0,L.jsxs)(`button`,{className:`directory-picker-entry`,type:`button`,onClick:()=>void T(e.path),title:e.path,style:{width:`100%`,minHeight:34,display:`flex`,alignItems:`center`,gap:7,padding:`6px 8px`,border:0,borderRadius:5,background:`none`,color:`var(--text-muted)`,cursor:`pointer`,textAlign:`left`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`},children:[(0,L.jsx)(aW,{}),(0,L.jsx)(`span`,{children:e.name})]},e.path)):(0,L.jsx)(`div`,{style:{padding:8,color:`var(--text-dim)`,fontSize:`var(--text-sm)`},children:i(A?`directoryPicker.noMatches`:`directoryPicker.noDrives`)}),(b||r)&&(0,L.jsx)(`div`,{style:{padding:`8px`,color:`var(--status-error)`,fontSize:`var(--text-sm)`},children:b??r})]}),(0,L.jsxs)(`div`,{className:`directory-picker-footer`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,gap:10,flexShrink:0,padding:`10px 18px`,borderTop:`1px solid var(--border)`},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,flex:1,minWidth:0},children:[(0,L.jsxs)(`svg`,{width:z.lg,height:z.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,style:{color:`var(--text-dim)`,flexShrink:0},children:[(0,L.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,L.jsx)(`path`,{d:`m21 21-4.3-4.3`})]}),(0,L.jsx)(Tx,{className:`directory-picker-search h-8 flex-1`,type:`text`,value:v,placeholder:i(`directoryPicker.search`),"aria-label":i(`directoryPicker.search`),autoComplete:`off`,spellCheck:!1,style:rW,onChange:e=>y(e.target.value)})]}),(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,flexShrink:0},children:[(0,L.jsx)(`button`,{className:`directory-picker-action`,type:`button`,onClick:e,disabled:n,style:{padding:`6px 14px`,border:`1px solid var(--border)`,borderRadius:6,background:`none`,color:`var(--text-muted)`,cursor:n?`default`:`pointer`,fontSize:`var(--text-lg)`},children:i(`i18n.cancel`)}),(0,L.jsx)(`button`,{className:`directory-picker-action`,type:`button`,onClick:()=>t(s),disabled:!O,title:i(D?`directoryPicker.openBeforeSelecting`:`directoryPicker.selectCurrentDirectory`),style:{padding:`6px 16px`,border:0,borderRadius:6,background:`var(--accent)`,color:`var(--on-accent)`,fontSize:`var(--text-lg)`,fontWeight:600,opacity:O?1:.6,cursor:O?`pointer`:`default`},children:i(n?`i18n.checking`:`directoryPicker.selectThisFolder`)})]})]})]})})}function Mne(e){return e.error?e.path.split(/[\\/]/).pop()||e.id:e.name||e.firstMessage.slice(0,50)||e.id.slice(0,12)}var V9=(e,t)=>e.replace(/\\/g,`/`)===t.replace(/\\/g,`/`),H9=e=>e.replace(/\\/g,`/`).replace(/\/+$/,``).replace(/^[a-zA-Z]:/,e=>e.toLowerCase()),U9=`pi-web:unread-session-ids`;function Nne(){if(typeof window>`u`)return new Set;try{let e=window.localStorage.getItem(U9);if(!e)return new Set;let t=JSON.parse(e);return Array.isArray(t)?new Set(t.filter(e=>typeof e==`string`)):new Set}catch{return new Set}}function W9(e){if(!(typeof window>`u`))try{e.size===0?window.localStorage.removeItem(U9):window.localStorage.setItem(U9,JSON.stringify([...e]))}catch{}}function Pne(){let[e,t]=(0,_.useState)(()=>Nne());return(0,_.useEffect)(()=>{W9(e)},[e]),{unreadSessionIds:e,setUnreadSessionIds:t}}function Fne(e){let{selectedCwd:t,selectedCwdProp:n,refreshKey:r,setSelectedCwd:i}=e,[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(``),[p,m]=(0,_.useState)(null),[h,g]=(0,_.useState)(!1),[v,y]=(0,_.useState)(null),[b,x]=(0,_.useState)(null),[S,C]=(0,_.useState)(``),w=(0,_.useRef)(null),T=(0,_.useRef)(null),E=(0,_.useRef)(null);(0,_.useEffect)(()=>{n&&n!==E.current&&(E.current=n,i(n))},[n,i]);let D=(0,_.useCallback)(()=>{c(!1),u(!1),f(``),m(null),y(null),C(``)},[]),[O,k]=(0,_.useState)(0);(0,_.useLayoutEffect)(()=>{if(!t){o(null),x(null);return}let e=!1;return x(t),fetch(`/api/worktrees?cwd=${encodeURIComponent(t)}`).then(e=>e.json()).then(n=>{if(!e){if(x(null),n.error||!n.projectRoot){o(null);return}o({forCwd:t,projectRoot:n.projectRoot,isGit:n.isGit??!1,isTopLevel:n.isTopLevel??!1,worktrees:n.worktrees??[]})}}).catch(()=>{e||(x(null),o(null))}),()=>{e=!0}},[t,O,r]);let A=(0,_.useCallback)(async()=>{let e=d.trim();if(!(!e||h||!a)){g(!0),m(null);try{let t=await fetch(`/api/worktrees`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:a.projectRoot,branch:e})}),n=await t.json().catch(()=>({}));if(!t.ok||n.error||!n.path){m(n.error??`HTTP ${t.status}`);return}D(),o(t=>t&&{...t,forCwd:n.path,worktrees:[...t.worktrees,{path:n.path,branch:e,isMain:!1}]}),i(n.path),k(e=>e+1)}catch(e){m(e instanceof Error?e.message:String(e))}finally{g(!1)}}},[D,d,h,a,i]),j=(0,_.useCallback)(async(e,n)=>{if(!(!a||h)){g(!0),m(null);try{let r=await fetch(`/api/worktrees`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:a.projectRoot,path:e,force:n})}),o=await r.json().catch(()=>({}));if(!r.ok){if(o.dirty&&!n){y(e);return}m(o.error??`HTTP ${r.status}`);return}D(),t&&e&&V9(t,e)&&i(a.projectRoot),k(e=>e+1)}catch(e){m(e instanceof Error?e.message:String(e))}finally{g(!1)}}},[D,a,h,t,i]);return(0,_.useEffect)(()=>{let e=e=>{w.current&&!w.current.contains(e.target)&&D()};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[D]),{worktreeState:a,worktreeLoadingCwd:b,wtDropdownOpen:s,setWtDropdownOpen:c,wtNewOpen:l,setWtNewOpen:u,wtNewBranch:d,setWtNewBranch:f,wtError:p,setWtError:m,wtBusy:h,wtConfirmRemove:v,setWtConfirmRemove:y,wtFilter:S,setWtFilter:C,wtDropdownRef:w,wtNewInputRef:T,closeWorktrees:D,handleCreateWorktree:A,handleRemoveWorktree:j}}function Ine({wt:e,selectedCwd:t,homeDir:n,setSelectedCwd:r}){let{t:i}=R(),{worktreeState:a,wtFilter:o,setWtFilter:s,wtDropdownOpen:c,setWtDropdownOpen:l,wtDropdownRef:u,closeWorktrees:d,handleRemoveWorktree:f,wtConfirmRemove:p,setWtConfirmRemove:m,wtBusy:h,wtNewOpen:g,setWtNewOpen:_,wtNewBranch:v,setWtNewBranch:y,wtNewInputRef:b,handleCreateWorktree:x,wtError:S,setWtError:C}=e;if(!a)return null;let w=a.worktrees.find(e=>V9(e.path,t))??a.worktrees.find(e=>e.isMain),T=a.worktrees.length>=8,E=T&&o.trim()?a.worktrees.filter(e=>(e.branch??K9(e.path,n)).toLowerCase().includes(o.trim().toLowerCase())):a.worktrees;return(0,L.jsxs)(`div`,{ref:u,"data-testid":`worktree-switcher`,style:{position:`relative`,marginTop:6},children:[(0,L.jsxs)(`button`,{"data-testid":`worktree-switcher-trigger`,onClick:()=>l(e=>!e),title:w?i(`sidebar.switchWorktreeTitle`,{path:w.path}):i(`sidebar.switchWorktree`),style:{width:`100%`,height:29,boxSizing:`border-box`,display:`flex`,alignItems:`center`,gap:6,padding:`0 10px`,background:`var(--bg-input)`,border:`1px solid var(--border)`,borderRadius:7,cursor:`pointer`,fontSize:`var(--text-sm)`,lineHeight:1.35,color:`var(--text-muted)`,textAlign:`left`},children:[(0,L.jsxs)(`svg`,{width:z.sm,height:z.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0,color:w&&!w.isMain?`var(--accent)`:`var(--text-dim)`},children:[(0,L.jsx)(`line`,{x1:`6`,y1:`3`,x2:`6`,y2:`15`}),(0,L.jsx)(`circle`,{cx:`18`,cy:`6`,r:`3`}),(0,L.jsx)(`circle`,{cx:`6`,cy:`18`,r:`3`}),(0,L.jsx)(`path`,{d:`M18 9a9 9 0 0 1-9 9`})]}),(0,L.jsx)(q9,{text:w?w.branch??K9(w.path,n):`…`,style:{flex:1,fontFamily:`var(--font-mono)`,color:`var(--text)`}}),w?.isMain&&(0,L.jsx)(`span`,{style:{flexShrink:0,color:`var(--text-dim)`,fontSize:`var(--text-xs)`},children:i(`sidebar.main`)}),a.worktrees.length>1&&(0,L.jsx)(`span`,{style:{flexShrink:0,color:`var(--text-dim)`,fontSize:`var(--text-xs)`},children:a.worktrees.length}),(0,L.jsx)(`svg`,{width:`9`,height:`9`,viewBox:`0 0 10 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0},children:(0,L.jsx)(`polyline`,{points:`2 3.5 5 6.5 8 3.5`})})]}),(0,L.jsxs)(Bne,{open:c,style:{position:`absolute`,top:`calc(100% + 4px)`,left:0,right:0,zIndex:100,background:`var(--bg)`,border:`1px solid var(--border)`,borderRadius:8,boxShadow:`0 6px 20px var(--shadow-color)`,overflow:`hidden`},children:[T&&(0,L.jsx)(`div`,{style:{padding:`6px 8px`,borderBottom:`1px solid var(--border)`},children:(0,L.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(s(``),d())},placeholder:i(`sidebar.filterWorktrees`),autoFocus:!0,style:{width:`100%`,fontSize:`var(--text-sm)`,fontFamily:`var(--font-mono)`,padding:`5px 8px`,border:`1px solid var(--border)`,borderRadius:5,outline:`none`,background:`var(--bg)`,color:`var(--text)`,boxSizing:`border-box`}})}),(0,L.jsxs)(`div`,{style:{maxHeight:`min(40vh, 300px)`,overflowY:`auto`},children:[E.map(e=>{let o=V9(e.path,t)||e.isMain&&!a.worktrees.some(e=>V9(e.path,t));return p===e.path?(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,padding:`7px 10px`,borderBottom:`1px solid var(--border)`,background:`color-mix(in srgb, var(--status-error) 6%, transparent)`},children:[(0,L.jsx)(`span`,{style:{flex:1,fontSize:`var(--text-sm)`,color:`var(--text)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:i(`sidebar.forceRemoveCheckout`)}),(0,L.jsx)(`button`,{"data-testid":`worktree-force-remove`,onClick:()=>void f(e.path,!0),disabled:h,style:{padding:`3px 9px`,background:`var(--status-error)`,border:`none`,borderRadius:5,color:`var(--on-error)`,fontSize:`var(--text-sm)`,fontWeight:600,cursor:`pointer`,flexShrink:0},children:i(`sidebar.force`)}),(0,L.jsx)(`button`,{onClick:()=>m(null),style:{padding:`3px 9px`,background:`var(--bg-hover)`,border:`1px solid var(--border)`,borderRadius:5,color:`var(--text-muted)`,fontSize:`var(--text-sm)`,cursor:`pointer`,flexShrink:0},children:i(`sidebar.cancel`)})]},e.path):(0,L.jsxs)(`div`,{className:`wt-row`,"data-testid":`worktree-row`,style:{display:`flex`,alignItems:`center`,borderBottom:`1px solid var(--border)`},children:[(0,L.jsxs)(`button`,{"data-testid":`worktree-item`,onClick:()=>{r(e.path),d()},title:e.path,style:{flex:1,minWidth:0,display:`flex`,alignItems:`center`,gap:7,padding:`8px 10px`,background:`var(--bg)`,border:`none`,color:o?`var(--text)`:`var(--text-muted)`,cursor:`pointer`,textAlign:`left`,fontSize:`var(--text-sm)`,fontFamily:`var(--font-mono)`},children:[o?(0,L.jsx)(`svg`,{width:z.xs,height:z.xs,viewBox:`0 0 10 10`,fill:`none`,stroke:`var(--accent)`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0},children:(0,L.jsx)(`polyline`,{points:`1.5 5 4 7.5 8.5 2.5`})}):(0,L.jsx)(`span`,{style:{width:10,flexShrink:0}}),(0,L.jsx)(q9,{text:e.branch??K9(e.path,n),style:{flex:1}}),e.isMain&&(0,L.jsx)(`span`,{style:{flexShrink:0,color:`var(--text-dim)`,fontSize:`var(--text-xs)`},children:i(`sidebar.main`)})]}),!e.isMain&&(0,L.jsx)(`button`,{"data-testid":`worktree-remove`,onClick:()=>void f(e.path,!1),disabled:h,title:i(`sidebar.removeWorktreeTitle`,{path:e.path}),style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:34,height:28,padding:0,marginRight:4,background:`none`,border:`none`,color:`var(--text-dim)`,cursor:`pointer`,borderRadius:5,flexShrink:0,transition:`color 0.12s, background 0.12s`,"--hover-color":`var(--status-error)`,"--hover-bg":`color-mix(in srgb, var(--status-error) 8%, transparent)`},className:`hover-shift`,children:(0,L.jsxs)(`svg`,{width:z.base,height:z.base,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,L.jsx)(`polyline`,{points:`3 6 5 6 21 6`}),(0,L.jsx)(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),(0,L.jsx)(`path`,{d:`M10 11v6M14 11v6`}),(0,L.jsx)(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})]})})]},e.path)}),T&&E.length===0&&o.trim()&&(0,L.jsx)(`div`,{style:{padding:`8px 10px`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:i(`sidebar.noMatchingWorktrees`)})]}),g?(0,L.jsxs)(`div`,{style:{padding:`6px 8px`},children:[(0,L.jsx)(`input`,{ref:b,"data-testid":`worktree-new-branch-input`,value:v,onChange:e=>{y(e.target.value),C(null)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),x()),e.key===`Escape`&&(_(!1),y(``),C(null))},placeholder:i(`sidebar.branchName`),style:{width:`100%`,fontSize:`var(--text-sm)`,fontFamily:`var(--font-mono)`,padding:`5px 8px`,border:`1px solid var(--accent)`,borderRadius:5,outline:`none`,background:`var(--bg)`,color:`var(--text)`,boxSizing:`border-box`}}),(0,L.jsxs)(`div`,{style:{display:`flex`,gap:5,marginTop:5},children:[(0,L.jsx)(`button`,{"data-testid":`worktree-create`,onClick:()=>void x(),disabled:h||!v.trim(),style:{flex:1,padding:`4px 0`,background:`var(--accent)`,border:`none`,borderRadius:5,color:`var(--on-accent)`,fontSize:`var(--text-sm)`,fontWeight:600,cursor:h||!v.trim()?`not-allowed`:`pointer`,opacity:h||!v.trim()?.65:1},children:i(h?`sidebar.creating`:`sidebar.create`)}),(0,L.jsx)(`button`,{onClick:()=>{_(!1),y(``),C(null)},style:{flex:1,padding:`4px 0`,background:`var(--bg-hover)`,border:`1px solid var(--border)`,borderRadius:5,color:`var(--text-muted)`,fontSize:`var(--text-sm)`,cursor:`pointer`},children:i(`sidebar.cancel`)})]})]}):(0,L.jsxs)(`button`,{"data-testid":`worktree-new`,onClick:e=>{e.stopPropagation(),_(!0),C(null),setTimeout(()=>b.current?.focus(),0)},title:i(`sidebar.createWorktreeTitle`),style:{display:`flex`,alignItems:`center`,gap:7,width:`100%`,padding:`8px 10px`,background:`none`,border:`none`,color:`var(--text-muted)`,cursor:`pointer`,textAlign:`left`,fontSize:`var(--text-sm)`},children:[(0,L.jsxs)(`svg`,{width:z.xs,height:z.xs,viewBox:`0 0 10 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.1`,strokeLinecap:`round`,style:{flexShrink:0},children:[(0,L.jsx)(`line`,{x1:`5`,y1:`1`,x2:`5`,y2:`9`}),(0,L.jsx)(`line`,{x1:`1`,y1:`5`,x2:`9`,y2:`5`})]}),(0,L.jsx)(`span`,{children:i(`sidebar.newWorktree`)})]}),S&&(0,L.jsx)(`div`,{style:{padding:`5px 10px 8px`,color:`var(--status-error)`,fontSize:`var(--text-sm)`,lineHeight:1.35,overflowWrap:`anywhere`},children:S})]})]})}function G9(e,t){let n=new Date(e),r=new Date().getTime()-n.getTime(),i=Math.floor(r/6e4),a=Math.floor(r/36e5),o=Math.floor(r/864e5);return i<1?t(`sidebar.justNow`):i<60?t(`sidebar.minutesAgo`,{count:i}):a<24?t(`sidebar.hoursAgo`,{count:a}):o<7?t(`sidebar.daysAgo`,{count:o}):n.toLocaleDateString()}function Lne(e){let t=new Map;for(let n of e){let e=n.projectRoot??n.cwd;if(!e)continue;let r=t.get(e);(!r||n.modified>r)&&t.set(e,n.modified)}return[...t.entries()].sort((e,t)=>t[1].localeCompare(e[1])).map(([e])=>e)}function K9(e,t){return t&&e.startsWith(t)?`~${e.slice(t.length)}`:e}function Rne(e){let t=e.split(/[\\/]+/).filter(Boolean);return t.length?t[t.length-1]:e}function q9({text:e,style:t}){return(0,L.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,display:`block`,minWidth:0,lineHeight:1.35,direction:`rtl`,textAlign:`left`,...t},children:(0,L.jsx)(`span`,{style:{unicodeBidi:`plaintext`},children:e})})}function J9({session:e}){return(0,L.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:4,color:`var(--danger)`,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},title:`${e.path}: ${e.error}`,children:[(0,L.jsxs)(`svg`,{width:z.xs,height:z.xs,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,style:{flexShrink:0},children:[(0,L.jsx)(`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`}),(0,L.jsx)(`path`,{d:`M12 9v4`}),(0,L.jsx)(`path`,{d:`M12 17h.01`})]}),e.error]})}var Y9=140,zne=2e3;function Bne({open:e,children:t,style:n}){let[r,i]=(0,_.useState)(e),[a,o]=(0,_.useState)(e);return(0,_.useEffect)(()=>{let t,n;return e?(i(!0),o(!1),t=window.requestAnimationFrame(()=>{t=window.requestAnimationFrame(()=>o(!0))})):(o(!1),n=setTimeout(()=>i(!1),Y9)),()=>{t!==void 0&&window.cancelAnimationFrame(t),n&&clearTimeout(n)}},[e]),r?(0,L.jsx)(`div`,{style:{...n,opacity:+!!a,transform:a?`translateY(0) scale(1)`:`translateY(-8px) scale(0.96)`,transformOrigin:`top center`,transition:`opacity ${Y9}ms ease, transform ${Y9}ms ease`,pointerEvents:e?`auto`:`none`},children:t}):null}function Vne(e){let t=new Map;for(let n of e)t.set(n.id,{session:n,children:[]});let n=new Map;for(let t of e)t.parentSessionId&&n.set(t.id,t.parentSessionId);function r(e){let r=n.get(e),i=new Set;for(;r;){if(i.has(r))return null;if(i.add(r),t.has(r))return r;r=n.get(r)}return null}let i=[];for(let e of t.values()){let n=r(e.session.id);n?t.get(n).children.push(e):i.push(e)}let a=e=>{e.sort((e,t)=>t.session.modified.localeCompare(e.session.modified)),e.forEach(e=>a(e.children))};return a(i),i}function Hne({selectedSessionId:e,selectedSession:t,onSelectSession:n,onNewSession:r,initialSessionId:i,skipInitialProjectSelection:a,onInitialRestoreDone:o,refreshKey:s,onSessionDeleted:c,onUnseenSession:l,selectedCwd:u,onCwdChange:d,savedWorkspaces:f,onSavedWorkspacesChange:p,onOpenFile:m}){let{t:h}=R(),[g,v]=(0,_.useState)([]),[y,b]=(0,_.useState)(!0),[x,S]=(0,_.useState)(null),[C,T]=(0,_.useState)(null),[E,D]=(0,_.useState)(``),[O,k]=(0,_.useState)(!1),[A,j]=(0,_.useState)(``),[M,N]=(0,_.useState)(null),[ee,te]=(0,_.useState)(!1),P=Fne({selectedCwd:C,selectedCwdProp:u,refreshKey:s,setSelectedCwd:T}),{worktreeState:ne,worktreeLoadingCwd:ie}=P,[ae,oe]=(0,_.useState)(!1),[F,I]=(0,_.useState)(``),se=(0,_.useRef)(null);(0,_.useEffect)(()=>{ae&&se.current?.focus()},[ae]);let[ce,le]=(0,_.useState)(!1),[ue,de]=(0,_.useState)(()=>new Set),fe=(0,_.useCallback)(e=>{de(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})},[]),pe=(0,_.useCallback)(e=>{de(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n}),yJ(e),l?.(e)},[l]),{unreadSessionIds:me,setUnreadSessionIds:he}=Pne(),ge=Gq(),{runningSessionIds:_e,runningPhases:ve,runningPhaseSince:ye,runningBusySince:xe,setRunningSessionIds:Se,runningPollAuthoritativeRef:Ce}=wY(),Te=(0,_.useRef)(new Set),Ee=(0,_.useRef)(null),De=(0,_.useRef)(0),Oe=(0,_.useCallback)(async(e=!1,t=!1)=>{try{e&&b(!0);let n=t?await Tt.refresh():await Tt.load();v(n.sessions),Ce.current||Se(new Set(n.runningSessionIds??[]));let r=new Set(n.sessions.map(e=>e.id));he(e=>{if(e.size===0)return e;let t=new Set([...e].filter(e=>r.has(e)));return t.size===e.size?e:t}),S(null),e||(le(!0),Ee.current&&clearTimeout(Ee.current),Ee.current=setTimeout(()=>le(!1),2e3))}catch(e){S(String(e))}finally{e&&b(!1)}},[he,Se,Ce]),ke=(0,_.useRef)(!1);(0,_.useEffect)(()=>{let e=!ke.current;ke.current=!0,Oe(e,e)},[Oe,s]),(0,_.useEffect)(()=>{W9(me)},[me]),(0,_.useEffect)(()=>{let t=[...Te.current].filter(t=>!_e.has(t)&&t!==e),n=[..._e];if((t.length>0||n.length>0)&&he(e=>{let r=new Set(e);return n.forEach(e=>r.delete(e)),t.forEach(e=>r.add(e)),r}),t.length>0&&Oe(!1),[..._e].filter(e=>!g.some(t=>t.id===e)).length>0){let e=Date.now();e-De.current>=zne&&(De.current=e,Oe(!1,!0))}Te.current=_e},[_e,e,g,Oe,he]),(0,_.useEffect)(()=>{e&&(Hq(e),he(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n}))},[e,he]),(0,_.useEffect)(()=>{fetch(`/api/home`).then(e=>e.json()).then(e=>{e.home&&D(e.home)}).catch(e=>console.error(`[pi-web] load home dir:`,e))},[]);let Ae=(0,_.useRef)(!1),je=(0,_.useCallback)(e=>e?ne?.forCwd&&V9(ne.forCwd,e)||ne?.worktrees.some(t=>V9(t.path,e))?ne.projectRoot:g.find(t=>t.cwd&&V9(t.cwd,e))?.projectRoot??e:null,[ne,g]),Me=(0,_.useRef)(null);(0,_.useEffect)(()=>{Me.current!==C&&(Me.current=C,d?.(C,je(C)))},[C,d,je]),(0,_.useEffect)(()=>{if(!(g.length===0||a)&&C===null){if(i&&!Ae.current){Ae.current=!0;let e=g.find(e=>e.id===i);if(e){T(e.cwd),fe(e.id),n(e,!0);return}o?.()}let e=Lne(g);e.length>0&&T(e[0])}},[g,C,i,a,n,o,fe]);let Ne=(0,_.useCallback)(async e=>{let t=(e??A).trim();if(!(!t||ee)){te(!0),N(null);try{let e=await fetch(`/api/cwd/validate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:t})}),n=await e.json().catch(()=>({}));if(!e.ok||n.error){N(n.error??`HTTP ${e.status}`);return}let r=n.cwd??t;if(T(r),k(!1),j(``),p){let e=f??[];e.some(e=>H9(e)===H9(r))||p([...e,r])}}catch(e){N(e instanceof Error?e.message:String(e))}finally{te(!1)}}},[A,ee,f,p]),Pe=(0,_.useCallback)(async e=>{try{if((await fetch(`/api/sessions/${encodeURIComponent(e.id)}`,{method:`HEAD`})).status===404){S(h(`sidebar.sessionDeleted`)),Oe(!1,!0);return}}catch{}e.cwd&&T(e.cwd),fe(e.id),n(e)},[n,h,Oe,fe]),Fe=(0,_.useCallback)(e=>{let t=e??C;if(!t)return;let n=typeof crypto.randomUUID==`function`?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`;r?.(n,t)},[C,r]),[Ie,Le]=(0,_.useState)({}),[Re,ze]=(0,_.useState)(null),[Be,Ve]=(0,_.useState)(null),[He,Ue]=(0,_.useState)(!1),We=je(C),Ge=g,Ke=!!(ne?.isGit&&ne.isTopLevel&&C&&We===ne.projectRoot),qe=(C&&ne&&We===ne.projectRoot&&!Ke?ne.isGit?{label:h(`sidebar.openRepoRoot`),title:h(`sidebar.openRepoRootTitle`)}:{label:h(`sidebar.gitRepoRootOnly`),title:h(`sidebar.gitRepoRootOnlyTitle`)}:null)??(C&&ie===C&&!Ke?{label:h(`sidebar.worktrees`),title:h(`sidebar.checkingWorktrees`)}:null),Je=(0,_.useCallback)(async e=>{Ve(null),Ue(!0);try{await Promise.all(e.sessions.map(e=>fetch(`/api/sessions/${encodeURIComponent(e.id)}`,{method:`DELETE`}).then(t=>{t.ok||console.error(`[sidebar] failed to delete ${e.id}:`,t.status)}).catch(t=>console.error(`[sidebar] failed to delete ${e.id}:`,t))));for(let t of e.sessions)c?.(t.id);let t=f??[];p&&t.some(t=>H9(t)===H9(e.root))&&p(t.filter(t=>H9(t)!==H9(e.root))),Oe(!1,!0)}finally{Ue(!1)}},[c,Oe,f,p]),Ye=(0,_.useMemo)(()=>{let e=t&&!Ge.some(e=>e.id===t.id)?[{...t,projectRoot:t.projectRoot??je(t.cwd)??void 0},...Ge]:Ge,n=new Map,r=new Map;for(let t of e){let e=t.projectRoot??t.cwd??`unknown`,i=e===`unknown`?e:H9(e);n.has(i)||(n.set(i,[]),r.set(i,e)),n.get(i).push(t)}let i=[...n.entries()].map(([e,t])=>({root:r.get(e)??e,sessions:t})).sort((e,t)=>{let n=e=>Math.max(...e.map(e=>{let t=new Date(e.modified).getTime();return Number.isNaN(t)?0:t}));return n(t.sessions)-n(e.sessions)}),a=[];if(C){let e=je(C);e&&!n.has(H9(e))&&a.push({root:e,sessions:[]})}let o=new Set([...n.keys()]);for(let e of a)o.add(H9(e.root));let s=[];for(let e of f??[]){let t=H9(e);o.has(t)||(o.add(t),s.push({root:e,sessions:[]}))}return[...a,...i,...s]},[Ge,C,je,t,f]),Xe=F.trim().toLowerCase(),Ze=(0,_.useMemo)(()=>Xe?Ye.map(e=>({...e,sessions:e.sessions.filter(e=>Mne(e).toLowerCase().includes(Xe))})).filter(e=>e.sessions.length>0):Ye,[Ye,Xe]);return(0,L.jsxs)(`div`,{"data-testid":`session-sidebar`,style:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`hidden`},children:[O&&(0,L.jsx)(jne,{busy:ee,error:M,onCancel:()=>{k(!1),N(null)},onSelect:e=>void Ne(e)}),(0,L.jsxs)(D9,{title:h(`sidebar.workspace`),open:!0,onToggle:()=>{},collapsible:!1,testId:`workspace-scroll`,hintTestId:`workspace`,scrollStyle:{flex:`1 1 auto`,minHeight:80,background:`var(--bg)`},style:{flex:1,minHeight:0},actions:(0,L.jsx)(T9,{items:[{key:`search`,testId:`workspace-search-toggle`,onClick:()=>{ae&&I(``),oe(e=>!e)},title:h(`sidebar.searchSessions`),ariaPressed:ae,color:ae?`var(--accent)`:`var(--text-muted)`,background:ae?`var(--bg-selected)`:void 0,icon:(0,L.jsx)(we,{size:z.lg})},{key:`new-workspace`,testId:`new-workspace`,onClick:()=>k(!0),title:h(`sidebar.newWorkspace`),color:`var(--text-muted)`,icon:(0,L.jsx)(re,{size:z.xl})},{key:`refresh`,testId:`session-refresh`,onClick:()=>Oe(!1,!0),title:h(`sidebar.refresh`),skipHover:ce,color:ce?`var(--status-success)`:`var(--text-muted)`,background:ce?`color-mix(in srgb, var(--status-success) 18%, transparent)`:void 0,icon:ce?(0,L.jsx)(w,{size:z.xl,color:`var(--status-success)`,strokeWidth:2.5}):(0,L.jsx)(be,{size:z.xl})}]}),headerExtra:(0,L.jsxs)(L.Fragment,{children:[ae&&(0,L.jsxs)(`div`,{"data-testid":`workspace-search`,style:{display:`flex`,alignItems:`center`,gap:4,width:`100%`,minWidth:0,padding:`4px 8px`,background:`var(--bg)`,borderBottom:`1px solid var(--border)`,boxSizing:`border-box`},children:[(0,L.jsx)(we,{size:z.lg,color:`var(--text-muted)`,style:{flexShrink:0}}),(0,L.jsx)(`input`,{ref:se,value:F,onChange:e=>I(e.target.value),placeholder:h(`sidebar.searchSessionsPlaceholder`),"aria-label":h(`sidebar.searchSessions`),style:{flex:1,minWidth:0,background:`transparent`,border:`none`,outline:`none`,color:`var(--text)`,fontSize:`var(--text-sm)`}}),F&&(0,L.jsx)(`button`,{type:`button`,onClick:()=>{I(``),se.current?.focus()},"aria-label":h(`chat.clearSearch`),style:{border:`none`,background:`transparent`,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-sm)`,flexShrink:0,padding:0},children:`✕`})]}),Ke&&(0,L.jsx)(Ine,{wt:P,selectedCwd:C,homeDir:E,setSelectedCwd:T}),qe&&(0,L.jsxs)(`button`,{type:`button`,"aria-disabled":`true`,tabIndex:-1,title:qe.title,style:{width:`100%`,height:29,boxSizing:`border-box`,marginTop:6,display:`flex`,alignItems:`center`,gap:6,padding:`0 10px`,border:`1px solid var(--border)`,borderRadius:7,background:`var(--bg-hover)`,color:`var(--text-dim)`,fontSize:`var(--text-sm)`,lineHeight:1.35,whiteSpace:`nowrap`,textAlign:`left`,cursor:`default`,opacity:.82},children:[(0,L.jsxs)(`svg`,{width:z.sm,height:z.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0},children:[(0,L.jsx)(`line`,{x1:`6`,y1:`3`,x2:`6`,y2:`15`}),(0,L.jsx)(`circle`,{cx:`18`,cy:`6`,r:`3`}),(0,L.jsx)(`circle`,{cx:`6`,cy:`18`,r:`3`}),(0,L.jsx)(`path`,{d:`M18 9a9 9 0 0 1-9 9`})]}),(0,L.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`},children:qe.label})]})]}),children:[y&&(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`16px 14px`,color:`var(--text-muted)`,fontSize:`var(--text-base)`},children:[(0,L.jsx)(`div`,{style:{width:14,height:14,border:`2px solid var(--border)`,borderTopColor:`var(--text-dim)`,borderRadius:`50%`,animation:`spin 0.8s linear infinite`,flexShrink:0}}),h(`sidebar.loading`)]}),x&&(0,L.jsx)(`div`,{style:{padding:`12px 14px`,color:`var(--status-error)`,fontSize:`var(--text-base)`},children:x}),!y&&!x&&Xe&&Ze.length===0&&(0,L.jsx)(`div`,{style:{padding:`16px 14px`,color:`var(--text-muted)`,fontSize:`var(--text-base)`},children:h(`sidebar.searchSessionsNoResults`)}),Ze.map(t=>{let n=t.sessions.some(t=>t.id===e)||t.root===We;return(0,L.jsxs)(`div`,{children:[(0,L.jsx)(Une,{group:t,groupSelected:n,hoveredGroup:Re,confirmDeleteGroup:Be,deletingGroup:He,runningSessionIds:_e,interactionBadges:ge,collapsed:!!Ie[t.root],setHoveredGroup:ze,setGroupCollapsed:Le,setConfirmDeleteGroup:Ve,handleDeleteGroup:Je,handleNewSession:Fe,copyText:bK}),(Xe||!Ie[t.root])&&(t.sessions.length===0?(0,L.jsx)(`div`,{style:{padding:`10px 14px`,color:`var(--text-muted)`,fontSize:`var(--text-sm)`},children:h(`sidebar.noSessions`)}):Vne(t.sessions).map(t=>(0,L.jsx)(X9,{node:t,selectedSessionId:e,runningSessionIds:_e,runningPhases:ve,runningPhaseSince:ye,runningBusySince:xe,unreadSessionIds:me,seenSessionIds:ue,interactionBadges:ge,onSelectSession:Pe,onRenamed:()=>Oe(!1,!0),onSessionDeleted:e=>{c?.(e),Oe(!1,!0)},onUnseen:pe,depth:0},t.session.id)))]},t.root)})]})]})}function Une({group:e,groupSelected:t,hoveredGroup:n,confirmDeleteGroup:r,deletingGroup:i,runningSessionIds:a,interactionBadges:o,collapsed:s,setHoveredGroup:c,setGroupCollapsed:l,setConfirmDeleteGroup:u,handleDeleteGroup:d,handleNewSession:f,copyText:p}){let{t:m}=R(),h=e.sessions.some(e=>a.has(e.id)),g=e.sessions.some(e=>o.has(e.id));return(0,L.jsx)(`div`,{"data-testid":`workspace-group-header`,onMouseEnter:()=>c(e.root),onMouseLeave:()=>c(null),style:{display:`flex`,alignItems:`center`,gap:4,height:40,padding:`0 2px`,boxSizing:`border-box`,fontSize:`var(--text-base)`,fontFamily:`var(--font-mono)`,color:`var(--text)`,fontWeight:600,textTransform:`none`,letterSpacing:.6,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,cursor:r===e.root?`default`:`pointer`,background:r===e.root?`color-mix(in srgb, var(--status-error) 6%, transparent)`:n===e.root?`var(--bg-hover)`:`var(--bg)`},onClick:r===e.root?void 0:()=>{l(t=>({...t,[e.root]:!t[e.root]}))},children:r===e.root?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{style:{flex:1,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:m(`sidebar.deleteWorkspace`,{count:e.sessions.length})}),(0,L.jsxs)(`div`,{style:{display:`flex`,gap:5,flexShrink:0},children:[(0,L.jsx)(`button`,{onClick:t=>{t.stopPropagation(),d(e)},disabled:i,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,gap:4,height:22,padding:`0 9px`,background:`var(--status-error)`,border:`none`,borderRadius:5,color:`var(--on-error)`,cursor:i?`default`:`pointer`,opacity:i?.6:1,fontSize:`var(--text-sm)`,fontWeight:600,whiteSpace:`nowrap`},children:m(`sidebar.delete`)}),(0,L.jsx)(`button`,{onClick:e=>{e.stopPropagation(),u(null)},disabled:i,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:22,padding:`0 9px`,background:`var(--bg)`,border:`1px solid var(--border)`,borderRadius:5,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-sm)`,fontWeight:500,whiteSpace:`nowrap`},children:m(`sidebar.cancel`)})]})]}):(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)(`div`,{style:{display:`inline-flex`,alignItems:`center`,gap:6,flex:1,minWidth:0,height:38,boxSizing:`border-box`,padding:`0 8px`,border:`none`,borderRadius:0,background:g&&s?`linear-gradient(180deg, transparent calc(100% - 25px), color-mix(in srgb, var(--border) 25%, transparent) 100%)`:h&&s?`linear-gradient(90deg, transparent 13%, color-mix(in srgb, var(--accent) 18%, transparent) 25%, transparent 37%, transparent 63%, color-mix(in srgb, var(--shine-highlight) 50%, transparent) 75%, transparent 87%), linear-gradient(180deg, transparent calc(100% - 25px), color-mix(in srgb, var(--border) 25%, transparent) 100%)`:`linear-gradient(180deg, transparent calc(100% - 25px), color-mix(in srgb, var(--border) 25%, transparent) 100%)`,backgroundSize:h&&s&&!g?`200% 100%, auto`:void 0,animation:g&&s?`interaction-bg-blink 1s ease-in-out infinite`:h&&s?`pi-status-shine 1.5s linear infinite`:void 0,boxShadow:`0 2px 8px var(--shadow-color)`,margin:`0 -2px`},children:[(0,L.jsxs)(`span`,{style:{position:`relative`,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:30,height:22,flexShrink:0},children:[(0,L.jsx)(`svg`,{width:`30`,height:`22`,viewBox:`0 0 24 24`,fill:t?`color-mix(in srgb, var(--accent) 18%, transparent)`:`var(--bg)`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{color:t?`var(--accent)`:`var(--text-muted)`,opacity:.95},children:(0,L.jsx)(`path`,{d:`M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z`})}),(0,L.jsx)(`span`,{style:{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -38%)`,color:`var(--text-muted)`,fontSize:`var(--text-xs)`,fontWeight:400,lineHeight:1,textAlign:`center`,fontVariantNumeric:`tabular-nums`,userSelect:`none`},children:e.sessions.length})]}),(0,L.jsx)(rr,{label:e.root,wrapperStyle:{flex:1,minWidth:0,overflow:`hidden`},children:(0,L.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,maxWidth:`100%`,lineHeight:`20px`},children:Rne(e.root)})}),n===e.root&&(0,L.jsx)(T9,{items:[{key:`new-session`,onClick:t=>{t.stopPropagation(),f(e.root)},title:m(`sidebar.newSessionTitle`,{path:e.root}),icon:(0,L.jsx)(ve,{size:z.base})},{key:`copy-path`,onClick:t=>{t.stopPropagation(),p(e.root)},title:m(`sidebar.copyPath`),icon:(0,L.jsx)(j,{size:z.base})},{key:`delete-workspace`,onClick:t=>{t.stopPropagation(),u(e.root)},title:m(`sidebar.deleteWorkspaceTitle`),danger:!0,icon:(0,L.jsx)(Ne,{size:z.base})}]})]})})})}function X9({node:e,selectedSessionId:t,runningSessionIds:n,runningPhases:r,runningPhaseSince:i,runningBusySince:a,unreadSessionIds:o,seenSessionIds:s,interactionBadges:c,onSelectSession:l,onRenamed:u,onSessionDeleted:d,onUnseen:f,depth:p}){let[m,h]=(0,_.useState)(!1),g=e.children.length>0;return(0,L.jsxs)(`div`,{style:{paddingBottom:1,backgroundImage:`linear-gradient(90deg, transparent, var(--border), transparent)`,backgroundPosition:`0 100%`,backgroundSize:`100% 1px`,backgroundRepeat:`no-repeat`},children:[(0,L.jsxs)(`div`,{style:{position:`relative`},children:[p>0&&(0,L.jsx)(`div`,{style:{position:`absolute`,left:p*12+6,top:0,bottom:0,width:1,background:`var(--border)`,pointerEvents:`none`}}),(0,L.jsx)(Gne,{session:e.session,isSelected:e.session.id===t,isRunning:n.has(e.session.id),phase:r[e.session.id],phaseSince:i[e.session.id],busySince:a[e.session.id],isUnread:o.has(e.session.id),isSeen:s.has(e.session.id),hasInteractionBadge:c.has(e.session.id),onClick:()=>l(e.session),onRenamed:u,onDeleted:e=>d?.(e),onUnseen:f,depth:p,hasChildren:g,collapsed:m,onToggleCollapse:()=>h(e=>!e)})]}),g&&!m&&(0,L.jsx)(`div`,{children:e.children.map(e=>(0,L.jsx)(X9,{node:e,selectedSessionId:t,runningSessionIds:n,runningPhases:r,runningPhaseSince:i,runningBusySince:a,unreadSessionIds:o,seenSessionIds:s,interactionBadges:c,onSelectSession:l,onRenamed:u,onSessionDeleted:d,onUnseen:f,depth:p+1},e.session.id))})]})}function Wne(){let{t:e}=R();return(0,L.jsx)(`span`,{title:e(`sidebar.newActivity`),"aria-label":e(`sidebar.newSessionActivity`),style:{width:14,height:14,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,color:`var(--accent)`},children:(0,L.jsxs)(`svg`,{width:z.xl,height:z.xl,viewBox:`0 0 14 14`,fill:`none`,"aria-hidden":`true`,style:{display:`block`},children:[(0,L.jsx)(`circle`,{cx:`7`,cy:`7`,r:`2.5`,fill:`currentColor`}),(0,L.jsx)(`circle`,{cx:`7`,cy:`7`,r:`3`,stroke:`currentColor`,strokeWidth:`1.4`,opacity:`0.32`,style:{transformOrigin:`center`,animation:`session-ring-pulse 1.6s ease-in-out infinite`}})]})})}function Gne({session:e,isSelected:t,isRunning:n,phase:r,phaseSince:i,busySince:a,isUnread:o,isSeen:s=!0,hasInteractionBadge:c=!1,onClick:l,onRenamed:u,onDeleted:d,onUnseen:f,depth:p=0,hasChildren:m=!1,collapsed:h=!1,onToggleCollapse:g}){let{t:v}=R(),y=TY(!!(n&&r),i),b=TY(!!n,a),[x,S]=(0,_.useState)(!1),[C,w]=(0,_.useState)(!1),[T,E]=(0,_.useState)(``),[D,O]=(0,_.useState)(!1),[k,A]=(0,_.useState)(!1),M=(0,_.useRef)(null),N=e.error?e.path.split(/[\\/]/).pop()||e.id:e.name||e.firstMessage.slice(0,50)||e.id.slice(0,12),ee=(0,_.useCallback)(t=>{t.stopPropagation(),E(e.name??``),w(!0),setTimeout(()=>M.current?.select(),0)},[e.name]),te=(0,_.useCallback)(async()=>{let t=T.trim();if(w(!1),t!==(e.name??``))try{await fetch(`/api/sessions/${encodeURIComponent(e.id)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:t})}),u?.()}catch{}},[T,e.id,e.name,u]),P=(0,_.useCallback)(async()=>{O(!1),A(!0);try{await fetch(`/api/sessions/${encodeURIComponent(e.id)}`,{method:`DELETE`}),d?.(e.id)}catch{A(!1)}},[e.id,d]),ne=(0,_.useCallback)(e=>{e.stopPropagation(),e.shiftKey?P():O(!0)},[P]),re=(0,_.useCallback)(e=>{e.stopPropagation(),P()},[P]),ie=(0,_.useCallback)(e=>{e.stopPropagation(),O(!1)},[]);return(0,L.jsx)(`div`,{"data-testid":`session-item`,"data-session-id":e.id,onClick:D||C?void 0:l,title:c?v(`sidebar.interactionBadge`):void 0,onMouseEnter:()=>S(!0),onMouseLeave:()=>{S(!1)},style:{height:54,animation:c?`interaction-bg-blink 1s ease-in-out infinite`:void 0,display:`flex`,alignItems:`center`,paddingLeft:p>0?p*12+14:14,paddingRight:8,cursor:D||C?`default`:`pointer`,backgroundColor:D?`color-mix(in srgb, var(--status-error) 6%, transparent)`:x?`var(--bg-hover)`:`transparent`,transition:`background 0.1s`,opacity:k?.5:1,gap:6,overflow:`hidden`},className:t&&!D?`row-selected-gradient`:void 0,children:D?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,L.jsx)(`div`,{style:{fontSize:`var(--text-base)`,color:`var(--text)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:N}),(0,L.jsxs)(`div`,{style:{marginTop:2,display:`flex`,alignItems:`center`,gap:8,color:`var(--text-dim)`,fontSize:`var(--text-sm)`,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:[e.error?(0,L.jsx)(J9,{session:e}):(0,L.jsx)(`span`,{title:e.modified,children:G9(e.modified,v)}),(0,L.jsx)(`span`,{children:v(`sidebar.messagesCount`,{count:e.messageCount})})]})]}),(0,L.jsxs)(`div`,{style:{display:`flex`,gap:5,flexShrink:0},children:[(0,L.jsxs)(`button`,{onClick:re,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,gap:4,height:30,padding:`0 11px`,background:`var(--status-error)`,border:`none`,borderRadius:6,color:`var(--on-error)`,cursor:`pointer`,fontSize:`var(--text-base)`,fontWeight:600,whiteSpace:`nowrap`},children:[(0,L.jsx)(Ne,{size:z.base}),v(`sidebar.delete`)]}),(0,L.jsx)(`button`,{onClick:ie,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:30,padding:`0 11px`,background:`var(--bg)`,border:`1px solid var(--border)`,borderRadius:6,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-base)`,fontWeight:500,whiteSpace:`nowrap`},children:v(`sidebar.cancel`)})]})]}):C?(0,L.jsx)(`input`,{ref:M,"data-testid":`session-rename-input`,value:T,onChange:e=>E(e.target.value),onBlur:te,onKeyDown:e=>{e.key===`Enter`&&te(),e.key===`Escape`&&w(!1)},autoFocus:!0,style:{flex:1,fontSize:`var(--text-base)`,padding:`5px 8px`,border:`1px solid var(--accent)`,borderRadius:5,outline:`none`,background:`var(--bg)`,color:`var(--text)`,height:30}}):(0,L.jsxs)(L.Fragment,{children:[p>0&&(0,L.jsxs)(`svg`,{width:z.xs,height:z.xs,viewBox:`0 0 24 24`,fill:`none`,stroke:`var(--text-dim)`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0},children:[(0,L.jsx)(`line`,{x1:`6`,y1:`3`,x2:`6`,y2:`15`}),(0,L.jsx)(`circle`,{cx:`18`,cy:`6`,r:`3`}),(0,L.jsx)(`circle`,{cx:`6`,cy:`18`,r:`3`}),(0,L.jsx)(`path`,{d:`M18 9a9 9 0 0 1-9 9`})]}),(0,L.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,L.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:5,minWidth:0,fontSize:`var(--text-base)`,fontWeight:t?600:400,lineHeight:1.4,color:s?`var(--text)`:`var(--text-dim)`},title:N,children:(0,L.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,minWidth:0},children:N})}),(0,L.jsxs)(`div`,{style:{marginTop:2,display:`flex`,alignItems:`center`,gap:8,color:`var(--text-dim)`,fontSize:`var(--text-sm)`,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:[e.error?(0,L.jsx)(J9,{session:e}):n?(0,L.jsx)(Y7,{phase:r??{kind:`running_command`},elapsed:y,totalElapsed:b}):o?(0,L.jsx)(Wne,{}):(0,L.jsx)(`span`,{title:e.modified,children:G9(e.modified,v)}),!e.error&&n?null:(0,L.jsx)(`span`,{children:v(`sidebar.messagesCount`,{count:e.messageCount})}),e.worktreeBranch&&(0,L.jsxs)(`span`,{title:`Worktree: ${e.cwd}`,style:{display:`flex`,alignItems:`center`,gap:3,color:`var(--accent)`,minWidth:0,overflow:`hidden`},children:[(0,L.jsxs)(`svg`,{width:`9`,height:`9`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0},children:[(0,L.jsx)(`line`,{x1:`6`,y1:`3`,x2:`6`,y2:`15`}),(0,L.jsx)(`circle`,{cx:`18`,cy:`6`,r:`3`}),(0,L.jsx)(`circle`,{cx:`6`,cy:`18`,r:`3`}),(0,L.jsx)(`path`,{d:`M18 9a9 9 0 0 1-9 9`})]}),(0,L.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.worktreeBranch})]})]})]}),m&&(0,L.jsx)(rr,{label:h?`Expand forks`:`Collapse forks`,children:(0,L.jsx)(`button`,{onClick:e=>{e.stopPropagation(),g?.()},style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:20,height:20,padding:0,flexShrink:0,background:`none`,border:`none`,color:`var(--text-dim)`,cursor:`pointer`,transform:h?`rotate(-90deg)`:`none`,transition:`transform 0.15s`},children:(0,L.jsx)(`svg`,{width:z.xs,height:z.xs,viewBox:`0 0 10 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,L.jsx)(`polyline`,{points:`2 3.5 5 6.5 8 3.5`})})})}),(0,L.jsx)(T9,{visible:x,items:[...s&&f?[{key:`unseen`,onClick:t=>{t.stopPropagation(),f(e.id)},title:v(`sidebar.disconnect`)||`断开`,icon:(0,L.jsx)(Fe,{size:z.base})}]:[],{key:`copy-path`,onClick:t=>{t.stopPropagation(),bK(e.path)},title:v(`sidebar.copyPath`),icon:(0,L.jsx)(j,{size:z.base})},{key:`rename`,testId:`session-rename`,onClick:ee,title:v(`sidebar.rename`),icon:(0,L.jsx)(ge,{size:z.xl})},{key:`delete`,testId:`session-delete`,onClick:ne,title:v(`sidebar.deleteWithShiftClick`),danger:!0,icon:(0,L.jsx)(Ne,{size:z.xl})}]})]})})}function Kne({geometries:e,messages:t,onAddMessage:n,onRemoveMessage:r,onUpdateMessage:i,widgets:a,closedKeys:o,onReopen:s}){let{t:c}=R(),[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(null),p=(0,_.useRef)(null);(0,_.useEffect)(()=>()=>{p.current&&clearTimeout(p.current)},[]);let m=e=>a.find(t=>t.key===e)?.lines[0],h=(e,t,n)=>{s(e),f({key:e,x:t,y:n}),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>f(null),2500)},g=[...new Set([...Object.keys(e),...o.keys()])].map(t=>[t,e[t]]);return(0,L.jsxs)(`div`,{style:{height:`100%`,display:`flex`,flexDirection:`column`,background:`var(--bg)`},children:[g.length===0?(0,L.jsx)(`div`,{style:{padding:`32px 16px`,textAlign:`center`,color:`var(--text-dim)`,fontSize:`var(--text-lg)`,lineHeight:1.6},children:c(`config.widgets.empty`)}):(0,L.jsx)(`div`,{style:{flex:1,minHeight:0,overflowY:`auto`,padding:10,display:`flex`,flexDirection:`row`,flexWrap:`wrap`,alignContent:`flex-start`,gap:6},children:g.map(([e,a])=>{let s=t[e]??[],d=o.has(e),f=m(e);return(0,L.jsxs)(`div`,{"data-testid":`widget-config-item-${e}`,style:{flex:`1 1 200px`,boxSizing:`border-box`,padding:`8px 10px`,borderRadius:5,background:`var(--bg-panel)`,border:`1px solid var(--border)`},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:7,flexWrap:`wrap`},children:[(0,L.jsxs)(`div`,{style:{minWidth:0,flex:`1 1 120px`},children:[(0,L.jsx)(`div`,{style:{fontSize:`var(--text-base)`,fontWeight:600,fontFamily:`var(--font-mono)`,color:`var(--text)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e}),a&&(0,L.jsxs)(`div`,{style:{marginTop:2,fontSize:`var(--text-sm)`,fontFamily:`var(--font-mono)`,color:`var(--text-dim)`},children:[c(`config.widgets.x`),`: `,a.x,` `,c(`config.widgets.y`),`: `,a.y,` ·`,` `,c(`config.widgets.width`),`: `,a.width,` `,c(`config.widgets.height`),`:`,` `,a.height]})]}),(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4,flexShrink:0},children:[d&&(0,L.jsxs)(`button`,{type:`button`,"data-testid":`widget-expand-${e}`,"aria-label":c(`widgets.reopen`),title:c(`widgets.reopen`),onClick:t=>h(e,t.clientX,t.clientY),style:{display:`flex`,alignItems:`center`,gap:4,padding:`4px 8px`,borderRadius:5,border:`1px solid var(--border)`,background:`var(--bg)`,color:`var(--text-muted)`,fontSize:`var(--text-sm)`,cursor:`pointer`},className:`hover-shift`,children:[(0,L.jsx)(te,{size:13,"aria-hidden":!0}),c(`widgets.reopen`)]}),(0,L.jsxs)(`button`,{type:`button`,"data-testid":`widget-bind-${e}`,onClick:()=>u(e),style:{display:`flex`,alignItems:`center`,gap:4,padding:`4px 8px`,borderRadius:5,border:`1px solid var(--border)`,background:`var(--bg)`,color:`var(--text-muted)`,fontSize:`var(--text-sm)`,cursor:`pointer`},children:[(0,L.jsx)(le,{size:13,"aria-hidden":!0}),c(`config.widgets.bind`)]})]})]}),f&&(0,L.jsx)(`div`,{style:{marginTop:4,fontSize:`var(--text-sm)`,color:`var(--text-muted)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:f}),(0,L.jsx)(MG,{messages:s,onAdd:t=>n(e,t),onRemove:t=>r(e,t),onUpdate:(t,n)=>i(e,t,n),bindOpen:l===e,onBindOpenChange:e=>{e||u(null)},ns:`widgets`,bindTestIdPrefix:`widget-bind`,editTestIdPrefix:`widget-edit`,chipTestIdPrefix:`widget-bound-${e}`,bindHintArgs:{key:e}})]},e)})}),d&&(0,L.jsx)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":`widget-expanded-toast`,style:{position:`fixed`,left:Math.min(d.x,window.innerWidth-180),top:d.y+12,transform:`translateX(-50%)`,zIndex:2e3,padding:`8px 12px`,borderRadius:7,border:`1px solid var(--status-success)`,background:`var(--bg)`,color:`var(--text)`,fontSize:`var(--text-base)`,boxShadow:`0 4px 16px var(--shadow-strong)`,whiteSpace:`nowrap`},children:c(`widgets.expandedToChat`,{key:d.key})})]})}var qne=e=>window.history.replaceState(null,``,e),Z9=36,Jne=176,Yne=224,Q9=86,$9=116;function Xne(){let[e,t]=(0,_.useState)(!1);(0,_.useEffect)(()=>{t(!0)},[]);let[n]=(0,_.useState)(()=>fq(new URLSearchParams(window.location.search))),{isDark:r,toggleTheme:i}=WK(),{locale:a,setLocale:o,t:s,supportedLocales:c}=R(),l=ft();XK();let{settingsValue:u,defaultThinkingLevel:d,setDefaultThinkingLevel:f,compaction:p,retry:m,defaultProjectTrust:h,setDefaultProjectTrust:g,subagents:v,savedWorkspaces:y,handleSavedWorkspacesChange:b,widgetGeometries:x,setWidgetGeometry:S,widgetMessages:C,addWidgetMessage:w,removeWidgetMessage:T,updateWidgetMessage:E,fontScale:D,setFontScale:O}=bn({isDark:r,toggleTheme:i}),[k,A]=(0,_.useState)(null),{selectedSession:j,effectiveNewSessionCwd:M,showChat:N,projectTrustCwd:ee,refreshKey:te,sessionKey:P,explorerRefreshKey:ne,setExplorerRefreshKey:re,modelsRefreshKey:ie,setModelsRefreshKey:ae,activeCwd:oe,initialCwdStatus:F,initialCwdError:I,initialSessionRestored:se,projectTrust:ce,projectTrustDialogOpen:le,setProjectTrustDialogOpen:ue,projectTrustBusy:de,projectTrustError:fe,setProjectTrustError:pe,extensionDialogActiveRef:me,handleSelectSession:he,handleNewSession:ge,handleSessionCreated:_e,handleAgentEnd:ve,handleSessionRenamed:ye,handleSessionForked:be,handleSessionDeleted:xe,handleSessionUnseen:Se,handleCwdChange:Ce,handleTrustProject:we,handleExplorerRefresh:Te,handleInitialRestoreDone:De}=Hn({initialNavigation:n,onProjectSwitch:()=>{A(null),Oe(e=>e.filter(e=>e.kind!==`file`)),ke(null),qne(`/`)},onSessionSelected:e=>{l&&!e&&Xe(!1)},onTopPanelReset:()=>A(null)}),{setSavedTabs:Oe,setActiveSavedId:ke,configTabOpen:Ae,configSection:je,setConfigSection:Me,configTabActive:Ne,activeFileTab:Pe,fileTabs:Fe,modelConfigFocus:Ie,handleOpenFile:Le,openConfigTab:Re,handleOpenModelConfig:ze,closeConfigTab:Be,handleCloseMainTab:Ve}=zK({onSessionSelected:()=>{wt(!1),l&&Xe(!1)},onRefreshModels:()=>ae(e=>e+1)}),{value:He}=Ue(jt),We=(0,_.useMemo)(()=>He?Qn(He):0,[He]),Ge=(0,_.useMemo)(()=>He?$n(He,s(`common.plugins`)):[],[He,s]),[Ke,qe]=(0,_.useState)(!1),Je=(0,_.useCallback)(e=>{Le(e,bO(e),{sourceSessionId:j?.id??null})},[Le,j?.id]),[Ye,Xe]=(0,_.useState)(!0),[Ze,Qe]=(0,_.useState)(!1),$e=(0,_.useRef)(280),et=(0,_.useRef)(280),tt=(0,_.useCallback)(()=>typeof window>`u`?480:Tn({viewportWidth:window.innerWidth,rightPanelOpen:!1,rightPanelWidth:0}),[]),nt=kn({ariaLabel:s(`layout.resizeSidebar`),cssVariable:`--sidebar-width`,defaultWidth:280,getMaxWidth:tt,growthDirection:`right`,maxWidth:480,minWidth:180,storageKey:`pi-sidebar-width`,widthRef:$e}),rt=nt.reclampWidth,it=kn({ariaLabel:s(`layout.resizeWidgetPanel`),cssVariable:`--widget-panel-width`,defaultWidth:280,getMaxWidth:()=>typeof window>`u`?560:En({viewportWidth:window.innerWidth,sidebarOpen:Ye,sidebarWidth:nt.width}),growthDirection:`left`,maxWidth:560,minWidth:200,storageKey:`pi-widget-panel-width`,widthRef:et});(0,_.useEffect)(()=>{l&&Xe(!1)},[l,Xe]),(0,_.useEffect)(()=>{Qe(!0)},[]),(0,_.useEffect)(()=>{rt()},[rt]);let at=(0,_.useRef)(void 0);(0,_.useEffect)(()=>{oe!==at.current&&(at.current=oe,At(oe),jt.load().catch(e=>console.error(`[pi-web] load updates:`,e)))},[oe]);let ot=(0,_.useRef)(null),st=(0,_.useRef)(null),ct=(0,_.useRef)(null),lt=(0,_.useRef)(null),ut=(0,_.useRef)(null),dt=xx(),pt=(0,_.useCallback)(()=>{dt.schedule(()=>{A(null)},150)},[dt]),mt=dt.cancel,[_t,vt]=(0,_.useState)(null),yt=(0,_.useCallback)(e=>{l&&Xe(!1),A(t=>t===e?null:e)},[l]),bt=(0,_.useCallback)(()=>{l&&A(null),Xe(e=>!e)},[l]);(0,_.useEffect)(()=>{if(!k)return;let e=()=>{if(document.hidden)return;let e=st.current?.getBoundingClientRect();if(e){if(k===`language`&&!l&<.current){let t=lt.current.getBoundingClientRect(),n=ct.current?.getBoundingClientRect(),r=n?.top??t.top,i=n?.bottom??t.bottom,a=Math.min(Jne,n?.width??e.width),o=Math.min(t.left-1,Math.max(n?.left??e.left,(n?.right??e.right)-a)),s=i+4;vt({top:s+Q9>window.innerHeight-4?r-Q9:s,left:o,width:a});return}if(k===`fontSize`&&!l&&ut.current){let t=ut.current.getBoundingClientRect(),n=ct.current?.getBoundingClientRect(),r=n?.top??t.top,i=n?.bottom??t.bottom,a=Math.min(Yne,n?.width??e.width),o=Math.min(t.left-1,Math.max(n?.left??e.left,(n?.right??e.right)-a)),s=i+4;vt({top:s+$9>window.innerHeight-4?r-$9:s,left:o,width:a});return}vt({top:e.bottom,left:e.left,width:e.width})}};e();let t=new ResizeObserver(e);return st.current&&t.observe(st.current),lt.current&&t.observe(lt.current),ut.current&&t.observe(ut.current),()=>t.disconnect()},[k,l]);let{widgetPanelOpen:xt,setWidgetPanelOpen:St,widgetsTabActive:Ct,setWidgetsTabActive:wt,extensionWidgets:Tt,closedWidgets:Et,handleCloseWidget:Dt,handleReopenWidget:Ot,handleExtensionWidgetsChange:kt,rightSidebarOpen:Mt,setRightSidebarOpen:Nt,closedWidgetCount:Pt}=ZK({widgetGeometries:x,setWidgetGeometry:S}),Ft=l?xt:Mt,It=(0,_.useCallback)((e,t)=>{ot.current?.insertText(lq(e,t))},[]),Lt=(0,_.useCallback)(e=>{let t=dq(e);t&&ot.current?.insertText(t)},[]),Rt=(0,_.useCallback)((e,t,n)=>{ot.current?.insertText(uq(e,t,n))},[]),zt=n.sessionId;ht({onNewSession:e=>ge(`kb-${Date.now()}`,e),activeCwd:oe});let Bt=se&&!N,Vt=[{id:AK,label:s(`tabs.chat`),closable:!1,icon:(0,L.jsx)(`svg`,{width:z.lg,height:z.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`})})},{id:MK,label:s(`tabs.widgets`),badge:Pt,closable:!1,icon:(0,L.jsxs)(`svg`,{width:z.lg,height:z.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,L.jsx)(`rect`,{x:`3`,y:`3`,width:`7`,height:`7`,rx:`1`}),(0,L.jsx)(`rect`,{x:`14`,y:`3`,width:`7`,height:`7`,rx:`1`}),(0,L.jsx)(`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`}),(0,L.jsx)(`rect`,{x:`14`,y:`14`,width:`7`,height:`7`,rx:`1`})]})},...Ae?[{id:jK,label:s(`config.title`),closable:!0,icon:(0,L.jsx)(Ee,{width:z.lg,height:z.lg,"aria-hidden":`true`})}]:[],...Fe],Ht=oe?bO(oe)||oe:null,Ut=Ht?`Pi Web · ${Ht}`:`Pi Web`;(0,_.useEffect)(()=>{document.title=Ut},[Ut]),(0,_.useEffect)(()=>{let e=()=>{document.title=Ut};return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[Ut]);let Wt=gt(),Gt=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{ref:ct,style:{padding:`2px 8px`,flexShrink:0,display:`flex`,justifyContent:`space-between`,gap:4},children:[{label:s(`config.title`),onClick:()=>{A(null),Re()},disabled:!1,badge:We,icon:(0,L.jsx)(Ee,{width:z[`3xl`],height:z[`3xl`],"aria-hidden":`true`})},...Wt===`granted`||Wt==="default"||Wt===`denied`?[{label:s(Wt===`granted`?`notify.permission.grantedHint`:Wt===`denied`?`notify.permission.deniedHint`:`notify.permission.requestHint`),ariaLabel:s(Wt===`granted`?`notify.permission.granted`:Wt===`denied`?`notify.permission.denied`:`notify.permission.request`),onClick:Wt===`granted`?()=>{}:()=>tq(),disabled:!1,testId:`notify-permission`,color:Wt===`granted`?`var(--status-success)`:Wt===`denied`?`var(--status-error)`:`var(--accent)`,icon:(0,L.jsx)(`svg`,{width:z[`3xl`],height:z[`3xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:Wt===`denied`?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`path`,{d:`M8.7 3A6 6 0 0 1 18 8a21.3 21.3 0 0 0 .6 5`}),(0,L.jsx)(`path`,{d:`M17 17H3s3-2 3-9a4.67 4.67 0 0 1 .3-1.7`}),(0,L.jsx)(`path`,{d:`M10.3 21a1.94 1.94 0 0 0 3.4 0`}),(0,L.jsx)(`path`,{d:`m2 2 20 20`})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`path`,{d:`M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9`}),(0,L.jsx)(`path`,{d:`M10.3 21a1.94 1.94 0 0 0 3.4 0`})]})})}]:[],{label:s(r?`theme.light`:`theme.dark`),onClick:()=>i(),disabled:!1,ariaPressed:r,icon:r?(0,L.jsxs)(`svg`,{width:z[`3xl`],height:z[`3xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,L.jsx)(`circle`,{cx:`12`,cy:`12`,r:`5`}),(0,L.jsx)(`line`,{x1:`12`,y1:`1`,x2:`12`,y2:`3`}),(0,L.jsx)(`line`,{x1:`12`,y1:`21`,x2:`12`,y2:`23`}),(0,L.jsx)(`line`,{x1:`4.22`,y1:`4.22`,x2:`5.64`,y2:`5.64`}),(0,L.jsx)(`line`,{x1:`18.36`,y1:`18.36`,x2:`19.78`,y2:`19.78`}),(0,L.jsx)(`line`,{x1:`1`,y1:`12`,x2:`3`,y2:`12`}),(0,L.jsx)(`line`,{x1:`21`,y1:`12`,x2:`23`,y2:`12`}),(0,L.jsx)(`line`,{x1:`4.22`,y1:`19.78`,x2:`5.64`,y2:`18.36`}),(0,L.jsx)(`line`,{x1:`18.36`,y1:`5.64`,x2:`19.78`,y2:`4.22`})]}):(0,L.jsx)(`svg`,{width:z[`3xl`],height:z[`3xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,L.jsx)(`path`,{d:`M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z`})})},{label:s(`common.language`),onClick:()=>{l&&Xe(!1),mt(),A(`language`)},onMouseEnter:()=>{mt(),k!==`language`&&A(`language`)},onMouseLeave:pt,disabled:!1,ref:lt,ariaExpanded:k===`language`,noTooltip:!0,icon:(0,L.jsxs)(`svg`,{width:z[`3xl`],height:z[`3xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,L.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,L.jsx)(`line`,{x1:`2`,y1:`12`,x2:`22`,y2:`12`}),(0,L.jsx)(`path`,{d:`M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z`})]})},{label:s(`theme.fontSize`),onClick:()=>{l&&Xe(!1),mt(),A(`fontSize`)},onMouseEnter:()=>{mt(),k!==`fontSize`&&A(`fontSize`)},onMouseLeave:pt,disabled:!1,ref:ut,ariaExpanded:k===`fontSize`,noTooltip:!0,icon:(0,L.jsxs)(`svg`,{width:z[`3xl`],height:z[`3xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,L.jsx)(`polyline`,{points:`4 7 4 4 20 4 20 7`}),(0,L.jsx)(`line`,{x1:`9`,y1:`20`,x2:`15`,y2:`20`}),(0,L.jsx)(`line`,{x1:`12`,y1:`4`,x2:`12`,y2:`20`})]})}].map(({label:e,onClick:t,onMouseEnter:n,onMouseLeave:r,disabled:i,icon:a,ref:o,ariaPressed:s,ariaExpanded:c,noTooltip:l,badge:u,color:d,ariaLabel:f,testId:p})=>{let m=(0,L.jsxs)(`button`,{ref:o,onClick:t,disabled:i,"data-testid":p,"aria-label":f??e,"aria-pressed":s,"aria-haspopup":c===void 0?void 0:`menu`,"aria-expanded":c,style:{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`,position:`relative`,height:32,padding:0,background:`none`,border:`none`,borderRadius:9,...d?{color:d}:{color:`var(--text-muted)`},cursor:i?`default`:`pointer`,opacity:i?.35:1,transition:`background 0.12s, color 0.12s`,"--hover-color":`var(--text)`},onMouseEnter:n,onMouseLeave:r,className:`hover-shift`,children:[a,u!==void 0&&u>0?(0,L.jsx)(`span`,{"data-testid":`settings-update-badge`,style:{position:`absolute`,top:3,right:3,minWidth:15,height:15,padding:`0 4px`,borderRadius:8,background:`var(--status-error)`,color:`#fff`,fontSize:10,fontWeight:600,lineHeight:`15px`,textAlign:`center`},children:u}):null]});return l?(0,L.jsx)(`div`,{style:{flex:1,minWidth:0,display:`flex`},children:m},e):(0,L.jsx)(rr,{label:e,wrapperStyle:{flex:1,minWidth:0,display:`flex`},children:m},e)})}),We>0&&!Ke&&(0,L.jsxs)(`div`,{role:`status`,"data-testid":`update-banner`,style:{display:`flex`,alignItems:`center`,gap:8,padding:`6px 12px`,borderBottom:`1px solid var(--border)`,background:`color-mix(in srgb, var(--status-warning) 10%, var(--bg-panel))`,fontSize:`var(--text-sm)`,color:`var(--text)`,flexShrink:0},children:[(0,L.jsx)(`span`,{style:{flex:1,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:s(`updates.banner`,{items:Ge.join(`, `)})}),(0,L.jsx)(`button`,{type:`button`,"data-testid":`update-banner-view`,onClick:()=>{Re(),Me(`updates`)},style:{padding:`3px 10px`,border:`1px solid var(--border)`,borderRadius:6,background:`none`,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-sm)`,flexShrink:0},children:s(`updates.view`)}),(0,L.jsx)(`button`,{type:`button`,"aria-label":s(`i18n.close`),onClick:()=>qe(!0),style:{padding:`2px 6px`,border:`none`,background:`none`,color:`var(--text-dim)`,cursor:`pointer`,fontSize:`var(--text-sm)`,flexShrink:0},children:`✕`})]}),(0,L.jsx)(Hne,{selectedSessionId:j?.id??null,selectedSession:j,onSelectSession:he,onNewSession:ge,initialSessionId:zt,skipInitialProjectSelection:n.requestedCwd!==null,onInitialRestoreDone:De,refreshKey:te,onSessionDeleted:xe,onUnseenSession:Se,selectedCwd:j?.cwd??M,onCwdChange:Ce,savedWorkspaces:y,onSavedWorkspacesChange:b,onOpenFile:Le})]});if(!e)return(0,L.jsx)(pq,{});let Kt=(0,L.jsx)(rr,{label:s(Ye?`sidebar.hide`:`sidebar.show`),children:(0,L.jsx)(`button`,{onClick:bt,"aria-label":s(Ye?`sidebar.hide`:`sidebar.show`),"aria-pressed":Ye,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:Z9,height:Z9,padding:0,background:`none`,border:`none`,borderRight:`1px solid var(--border)`,color:Ye?`var(--text)`:`var(--text-muted)`,cursor:`pointer`,flexShrink:0,transition:`color 0.12s`,"--hover-color":`var(--text)`},className:`hover-shift`,children:(0,L.jsxs)(`svg`,{width:z[`4xl`],height:z[`4xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,L.jsx)(`rect`,{x:`3`,y:`3`,width:z[`4xl`],height:z[`4xl`],rx:`2`}),(0,L.jsx)(`line`,{x1:`9`,y1:`3`,x2:`9`,y2:`21`})]})})}),qt=N&&ce?.requiresTrust&&!ce.trusted?(0,L.jsx)(rr,{label:s(`trust.resourcesNotLoaded`),wrapperStyle:{height:`100%`},children:(0,L.jsxs)(`button`,{type:`button`,onClick:()=>{pe(null),ue(!0)},"aria-label":s(`trust.resourcesNotLoaded`),style:{display:`flex`,alignItems:`center`,gap:6,height:`100%`,padding:l?`0 10px`:`0 12px`,background:`none`,border:`none`,borderLeft:`1px solid var(--border)`,color:`var(--status-warning)`,cursor:`pointer`,flexShrink:0,fontSize:`var(--text-sm)`,whiteSpace:`nowrap`},children:[(0,L.jsxs)(`svg`,{width:z.lg,height:z.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,L.jsx)(`path`,{d:`M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10Z`}),(0,L.jsx)(`path`,{d:`M12 8v4`}),(0,L.jsx)(`path`,{d:`M12 16h.01`})]}),!l&&(0,L.jsx)(`span`,{children:s(`trust.resourcesNotLoaded`)})]})}):null,Jt=(0,L.jsx)(rr,{label:s(Ft?`sidebar.hide`:`sidebar.show`),children:(0,L.jsx)(`button`,{onClick:()=>{l?St(e=>!e):Nt(e=>!e)},"aria-controls":`widget-panel`,"aria-expanded":Ft,"aria-label":s(Ft?`sidebar.hide`:`sidebar.show`),"data-testid":`widget-panel-toggle`,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:36,height:36,padding:0,background:`none`,border:`none`,borderLeft:`1px solid var(--border)`,color:xt?`var(--text)`:`var(--text-muted)`,cursor:`pointer`,flexShrink:0,transition:`color 0.12s`,"--hover-color":`var(--text)`},className:`hover-shift`,children:(0,L.jsxs)(`svg`,{width:z[`4xl`],height:z[`4xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,L.jsx)(`rect`,{x:`3`,y:`3`,width:z[`4xl`],height:z[`4xl`],rx:`2`}),(0,L.jsx)(`line`,{x1:`15`,y1:`3`,x2:`15`,y2:`21`})]})})});return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Wn,{value:u,children:(0,L.jsx)(KK,{value:{activeTopPanel:k,toggleTopPanel:yt,closeTopPanel:()=>A(null)},children:(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)(nr,{delayDuration:0,children:[(0,L.jsx)(`style`,{children:`
|
|
499
499
|
@media (max-width: 640px) {
|
|
@@ -506,4 +506,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
506
506
|
box-shadow: none;
|
|
507
507
|
}
|
|
508
508
|
}
|
|
509
|
-
`}),(0,L.jsx)(Dne,{}),(0,L.jsxs)(`div`,{style:{display:`flex`,width:`100%`,height:`var(--app-viewport-height, 100dvh)`,paddingLeft:`env(safe-area-inset-left)`,paddingRight:`env(safe-area-inset-right)`,overflow:`hidden`,background:`var(--bg)`},children:[(0,L.jsx)(`div`,{className:`sidebar-overlay-backdrop${Ze?``:` sidebar-mobile-pending`}`,onClick:()=>Xe(!1),style:{position:`fixed`,inset:0,zIndex:199,background:`var(--overlay)`,opacity:+!!Ye,pointerEvents:Ye?`auto`:`none`,transition:`opacity 0.25s ease`}}),(0,L.jsx)(`div`,{ref:nt.panelRef,id:`session-sidebar`,className:`sidebar-container${Ye?` sidebar-open`:` sidebar-closed`}${Ze?``:` sidebar-mobile-pending`}${nt.isResizing?` sidebar-resizing`:``}`,"data-testid":`sidebar`,style:{"--sidebar-width":`${nt.width}px`,background:`var(--bg-panel)`,borderRight:`1px solid var(--border)`,display:`flex`,flexDirection:`column`,flexShrink:0,paddingTop:`env(safe-area-inset-top)`,paddingBottom:`env(safe-area-inset-bottom)`,zIndex:200},children:Gt}),Ye&&(0,L.jsx)(rr,{label:`${s(`layout.resizeSidebar`)}: ${s(`layout.resizeHint`)}`,wrapperStyle:{display:`flex`,flex:`0 0 0`,width:0},children:(0,L.jsx)(`div`,{...nt.separatorProps,"aria-controls":`session-sidebar`,className:`panel-resize-handle sidebar-resize-handle${nt.isResizing?` is-resizing`:``}`,"data-resize-handle":`sidebar`})}),(0,L.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,overflow:`hidden`,minWidth:0},children:[k&&_t&&(0,L.jsxs)(`div`,{onMouseEnter:mt,onMouseLeave:pt,style:{position:`fixed`,top:_t.top,left:_t.left,width:_t.width,maxHeight:`calc(100dvh - ${_t.top}px)`,overflowY:`auto`,zIndex:1500},children:[k===`language`&&(0,L.jsx)(`div`,{role:`menu`,"aria-label":s(`common.language`),style:{background:`var(--bg-panel)`,border:`1px solid var(--border)`,overflow:`hidden`,padding:4},children:c.map(e=>(0,L.jsx)(`button`,{type:`button`,onClick:()=>{o(e.id),A(null)},role:`menuitemradio`,"aria-checked":a===e.id,style:{display:`flex`,alignItems:`center`,width:`100%`,height:34,padding:`0 10px`,border:`none`,borderRadius:4,background:a===e.id?`var(--bg-selected)`:`transparent`,color:`var(--text)`,cursor:`pointer`,textAlign:`left`,fontSize:`var(--text-base)`,transition:`background 0.1s`},className:a===e.id?void 0:`hover-shift`,children:(0,L.jsx)(`span`,{children:e.label})},e.id))}),k===`fontSize`&&(0,L.jsxs)(`div`,{role:`menu`,"aria-label":s(`theme.fontSize`),style:{background:`var(--bg-panel)`,border:`1px solid var(--border)`,padding:`10px 12px 12px`},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,fontSize:`var(--text-base)`,color:`var(--text-muted)`,marginBottom:8},children:[(0,L.jsx)(`span`,{children:s(`theme.fontSize`)}),(0,L.jsxs)(`span`,{style:{fontFamily:`var(--font-mono)`,color:`var(--text)`,fontWeight:600},children:[Math.round(D*100),`%`]})]}),(0,L.jsx)(`input`,{type:`range`,min:.85,max:1.3,step:.05,value:D,onChange:e=>O(Number(e.target.value)),"aria-label":s(`theme.fontSize`),style:{width:`100%`,accentColor:`var(--accent)`,cursor:`pointer`}}),(0,L.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,fontSize:`var(--text-xs)`,color:`var(--text-dim)`,marginTop:4},children:[(0,L.jsx)(`span`,{children:`85%`}),(0,L.jsx)(`span`,{children:`130%`})]})]})]}),(0,L.jsxs)(yK,{tabs:Vt,activeTabId:Ne?jK:Ct?MK:Pe?NK(Pe.filePath):AK,leftExtra:Kt,rightExtra:Jt,onSelectTab:e=>{if(e===`widgets`){wt(!0),ke(null);return}wt(!1),ke(e===`chat`?null:e)},onCloseTab:Ve,tabBarRef:st,overlay:(0,L.jsxs)(L.Fragment,{children:[F===`validating`&&(0,L.jsxs)(`div`,{role:`status`,style:{height:`100%`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:8,padding:24,color:`var(--text-muted)`,textAlign:`center`},children:[(0,L.jsx)(`div`,{style:{fontSize:`var(--text-xl)`,color:`var(--text)`},children:s(`workspace.opening`)}),(0,L.jsx)(`div`,{style:{maxWidth:`min(720px, 100%)`,overflowWrap:`anywhere`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-base)`},children:n.requestedCwd})]}),F===`error`&&(0,L.jsxs)(`div`,{role:`alert`,style:{height:`100%`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:8,padding:24,color:`var(--text-muted)`,textAlign:`center`},children:[(0,L.jsx)(`div`,{style:{fontSize:`var(--text-xl)`,color:`var(--status-error)`},children:s(`workspace.unable`)}),(0,L.jsx)(`div`,{style:{maxWidth:`min(720px, 100%)`,overflowWrap:`anywhere`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-base)`},children:n.requestedCwd}),(0,L.jsx)(`div`,{style:{maxWidth:720,fontSize:`var(--text-base)`},children:I})]}),Bt&&(oe?(0,L.jsx)(`div`,{style:{height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`var(--text-muted)`,fontSize:`var(--text-2xl)`},children:s(`workspace.selectSession`)}):(0,L.jsxs)(`div`,{style:{height:`100%`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:12,userSelect:`none`},children:[(0,L.jsx)(`div`,{style:{fontSize:`var(--text-6xl)`,fontWeight:700,fontStyle:`italic`,color:`var(--accent)`},children:`Pi Web`}),(0,L.jsx)(`div`,{style:{fontSize:`var(--text-base)`,color:`var(--text-muted)`},children:s(`workspace.selectWorkspace`)})]}))]}),children:[(0,L.jsx)(_K,{id:jK,testId:`config-tab-pane`,children:(0,L.jsx)(DK,{section:je,onSectionChange:Me,cwd:ee,sessionId:j?.id??null,onClose:Be,onOpenFile:Le,sidebarWidth:nt.width,onSidebarWidthChange:nt.setWidth,widgetPanelWidth:it.width,onWidgetPanelWidthChange:it.setWidth,modelConfigFocus:Ie,defaultThinkingLevel:d,onDefaultThinkingLevelChange:f,compaction:p,onCompactionChange:e=>hn({firstPaint:{compaction:e}}),retry:m,onRetryChange:e=>hn({firstPaint:{retry:e}}),defaultProjectTrust:h,onDefaultProjectTrustChange:g,subagents:v,onSubagentsChange:e=>hn({firstPaint:{subagents:{defaultModel:e.defaultModel||void 0,defaultThinking:e.defaultThinking||void 0}}})})}),(0,L.jsx)(_K,{id:Pe?NK(Pe.filePath):`file:`,testId:`file-tab-pane`,children:Pe&&(0,L.jsx)(bne,{filePath:Pe.filePath,cwd:oe??void 0,sourceSessionId:Pe.sourceSessionId,gitRefreshKey:ne,initialDisplayMode:Pe.initialDisplayMode,onMentionLines:Rt,onSaved:()=>re(e=>e+1),onOpenFile:e=>Le(e,bO(e),{sourceSessionId:Pe.sourceSessionId})})}),(0,L.jsx)(_K,{id:AK,keepAlive:!0,testId:`chat-tab-pane`,scroll:`hidden`,activeWhen:N,children:(0,L.jsx)(`div`,{style:{flex:1,minHeight:0,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:(0,L.jsx)(Ote,{session:j,newSessionCwd:M,onAgentEnd:ve,onSessionCreated:_e,onSessionForked:be,modelsRefreshKey:ie,onOpenModelConfig:ze,chatInputRef:ot,onOpenFile:Je,onSessionRenamed:ye,windowTitleBase:Ht,toolbarExtra:qt,closedWidgetKeys:Et,onCloseWidget:Dt,onExtensionWidgetsChange:kt,onExtensionDialogChange:e=>{me.current=e}},P)})}),(0,L.jsx)(_K,{id:MK,keepAlive:!0,testId:`widgets-tab-pane`,zIndex:1,activeWhen:N,children:(0,L.jsx)(Kne,{geometries:x,messages:C,onAddMessage:w,onRemoveMessage:T,onUpdateMessage:E,widgets:Tt,closedKeys:Et,onReopen:Ot})})]})]}),Ft&&(0,L.jsx)(rr,{label:`${s(`layout.resizeWidgetPanel`)}: ${s(`layout.resizeHint`)}`,wrapperStyle:{display:`flex`,flex:`0 0 0`,width:0},children:(0,L.jsx)(`div`,{...it.separatorProps,"aria-controls":`widget-panel`,className:`panel-resize-handle widget-panel-resize-handle${it.isResizing?` is-resizing`:``}`,"data-resize-handle":`widget-panel`})}),!l&&!Mt?null:(0,L.jsx)(`div`,{ref:it.panelRef,"aria-controls":`widget-panel`,style:l?{position:`fixed`,inset:0,zIndex:250,display:`flex`,flexDirection:`column`}:{"--widget-panel-width":`${it.width}px`,width:`var(--widget-panel-width)`,display:`flex`,flexDirection:`column`,minWidth:0,overflow:`hidden`,borderLeft:`1px solid var(--border)`,background:`var(--bg)`},children:(0,L.jsx)($te,{cwd:j?.cwd??M,onOpenFile:Le,explorerRefreshKey:ne,onExplorerRefresh:Te,onAtMention:It,onAtMentions:Lt,sessionId:j?.id??null,onOpenConfig:e=>Re(e)})})]}),le&&ee&&(0,L.jsx)(Ane,{cwd:ee,busy:de,error:fe,onCancel:()=>{de||ue(!1)},onConfirm:()=>void we()})]})})})}),(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Ite,{}),(0,L.jsx)(kne,{})]})]})}var Zne=class extends _.Component{constructor(...e){super(...e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){In(e,`render error`)}render(){return this.state.hasError?(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:12,height:`100vh`,color:`var(--text)`,fontSize:`var(--text-base)`},children:[(0,L.jsx)(`span`,{children:`⚠️`}),(0,L.jsx)(`span`,{children:`Something went wrong while rendering.`}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>{this.setState({hasError:!1})},style:{border:`1px solid var(--border)`,background:`none`,color:`var(--text)`,borderRadius:6,padding:`4px 14px`,cursor:`pointer`},children:`Try again`})]}):this.props.children}};function Qne(){return(0,_.useEffect)(()=>{if(!(`serviceWorker`in navigator))return;let e=()=>{navigator.serviceWorker.register(`/sw.js?v=0.15.25`,{scope:`/`,updateViaCache:`none`}).catch(e=>{console.error(`Failed to register the Pi Web service worker:`,e)})};if(document.readyState===`complete`){e();return}return window.addEventListener(`load`,e,{once:!0}),()=>window.removeEventListener(`load`,e)},[]),null}var $ne=`piE2eFixtureDir`;function ere(){return typeof window>`u`?null:new URL(window.location.href).searchParams.get(`piE2eFixtureDir`)}function tre(){if(typeof document>`u`)return;let e=ere();e&&(document.cookie=`${$ne}=${encodeURIComponent(e)}; path=/; SameSite=Lax`)}async function nre(){tre(),Nq(!0),Iq();let e=Pq(`boot`),t=null;try{let n=await Et.load();e(`preferences catalog loaded`,`locale=${n.firstPaint?.locale}`);let r=n.firstPaint?.locale;(r===`en`||r===`zh-CN`)&&(t=r,document.documentElement.lang=r===`zh-CN`?`zh-CN`:`en`);let i=n.theme;if(i===`dark`?document.documentElement.classList.add(`dark`):document.documentElement.classList.remove(`dark`),i)try{localStorage.setItem(`pi-theme`,i)}catch{}}catch{}e(`root render`),window.addEventListener(`unhandledrejection`,e=>{In(e.reason,`unhandled promise rejection`)}),window.addEventListener(`error`,e=>{let t=(e.error instanceof Error?e.error.message:``)||e.message||``;t.includes(`ResizeObserver loop`)||t.startsWith(`Script error`)||In(e.error??e.message,`uncaught error`)}),(0,He.createRoot)(document.getElementById(`root`)).render((0,L.jsx)(_.StrictMode,{children:(0,L.jsx)(Zne,{children:(0,L.jsxs)(st,{initialLocale:t,children:[(0,L.jsx)(Xne,{}),(0,L.jsx)(Qne,{})]})})}))}nre();export{D0 as a,i as c,y2 as i,n6 as n,bk as o,o6 as r,tt as s,J2 as t};
|
|
509
|
+
`}),(0,L.jsx)(Dne,{}),(0,L.jsxs)(`div`,{style:{display:`flex`,width:`100%`,height:`var(--app-viewport-height, 100dvh)`,paddingLeft:`env(safe-area-inset-left)`,paddingRight:`env(safe-area-inset-right)`,overflow:`hidden`,background:`var(--bg)`},children:[(0,L.jsx)(`div`,{className:`sidebar-overlay-backdrop${Ze?``:` sidebar-mobile-pending`}`,onClick:()=>Xe(!1),style:{position:`fixed`,inset:0,zIndex:199,background:`var(--overlay)`,opacity:+!!Ye,pointerEvents:Ye?`auto`:`none`,transition:`opacity 0.25s ease`}}),(0,L.jsx)(`div`,{ref:nt.panelRef,id:`session-sidebar`,className:`sidebar-container${Ye?` sidebar-open`:` sidebar-closed`}${Ze?``:` sidebar-mobile-pending`}${nt.isResizing?` sidebar-resizing`:``}`,"data-testid":`sidebar`,style:{"--sidebar-width":`${nt.width}px`,background:`var(--bg-panel)`,borderRight:`1px solid var(--border)`,display:`flex`,flexDirection:`column`,flexShrink:0,paddingTop:`env(safe-area-inset-top)`,paddingBottom:`env(safe-area-inset-bottom)`,zIndex:200},children:Gt}),Ye&&(0,L.jsx)(rr,{label:`${s(`layout.resizeSidebar`)}: ${s(`layout.resizeHint`)}`,wrapperStyle:{display:`flex`,flex:`0 0 0`,width:0},children:(0,L.jsx)(`div`,{...nt.separatorProps,"aria-controls":`session-sidebar`,className:`panel-resize-handle sidebar-resize-handle${nt.isResizing?` is-resizing`:``}`,"data-resize-handle":`sidebar`})}),(0,L.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,overflow:`hidden`,minWidth:0},children:[k&&_t&&(0,L.jsxs)(`div`,{onMouseEnter:mt,onMouseLeave:pt,style:{position:`fixed`,top:_t.top,left:_t.left,width:_t.width,maxHeight:`calc(100dvh - ${_t.top}px)`,overflowY:`auto`,zIndex:1500},children:[k===`language`&&(0,L.jsx)(`div`,{role:`menu`,"aria-label":s(`common.language`),style:{background:`var(--bg-panel)`,border:`1px solid var(--border)`,overflow:`hidden`,padding:4},children:c.map(e=>(0,L.jsx)(`button`,{type:`button`,onClick:()=>{o(e.id),A(null)},role:`menuitemradio`,"aria-checked":a===e.id,style:{display:`flex`,alignItems:`center`,width:`100%`,height:34,padding:`0 10px`,border:`none`,borderRadius:4,background:a===e.id?`var(--bg-selected)`:`transparent`,color:`var(--text)`,cursor:`pointer`,textAlign:`left`,fontSize:`var(--text-base)`,transition:`background 0.1s`},className:a===e.id?void 0:`hover-shift`,children:(0,L.jsx)(`span`,{children:e.label})},e.id))}),k===`fontSize`&&(0,L.jsxs)(`div`,{role:`menu`,"aria-label":s(`theme.fontSize`),style:{background:`var(--bg-panel)`,border:`1px solid var(--border)`,padding:`10px 12px 12px`},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,fontSize:`var(--text-base)`,color:`var(--text-muted)`,marginBottom:8},children:[(0,L.jsx)(`span`,{children:s(`theme.fontSize`)}),(0,L.jsxs)(`span`,{style:{fontFamily:`var(--font-mono)`,color:`var(--text)`,fontWeight:600},children:[Math.round(D*100),`%`]})]}),(0,L.jsx)(`input`,{type:`range`,min:.85,max:1.3,step:.05,value:D,onChange:e=>O(Number(e.target.value)),"aria-label":s(`theme.fontSize`),style:{width:`100%`,accentColor:`var(--accent)`,cursor:`pointer`}}),(0,L.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,fontSize:`var(--text-xs)`,color:`var(--text-dim)`,marginTop:4},children:[(0,L.jsx)(`span`,{children:`85%`}),(0,L.jsx)(`span`,{children:`130%`})]})]})]}),(0,L.jsxs)(yK,{tabs:Vt,activeTabId:Ne?jK:Ct?MK:Pe?NK(Pe.filePath):AK,leftExtra:Kt,rightExtra:Jt,onSelectTab:e=>{if(e===`widgets`){wt(!0),ke(null);return}wt(!1),ke(e===`chat`?null:e)},onCloseTab:Ve,tabBarRef:st,overlay:(0,L.jsxs)(L.Fragment,{children:[F===`validating`&&(0,L.jsxs)(`div`,{role:`status`,style:{height:`100%`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:8,padding:24,color:`var(--text-muted)`,textAlign:`center`},children:[(0,L.jsx)(`div`,{style:{fontSize:`var(--text-xl)`,color:`var(--text)`},children:s(`workspace.opening`)}),(0,L.jsx)(`div`,{style:{maxWidth:`min(720px, 100%)`,overflowWrap:`anywhere`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-base)`},children:n.requestedCwd})]}),F===`error`&&(0,L.jsxs)(`div`,{role:`alert`,style:{height:`100%`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:8,padding:24,color:`var(--text-muted)`,textAlign:`center`},children:[(0,L.jsx)(`div`,{style:{fontSize:`var(--text-xl)`,color:`var(--status-error)`},children:s(`workspace.unable`)}),(0,L.jsx)(`div`,{style:{maxWidth:`min(720px, 100%)`,overflowWrap:`anywhere`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-base)`},children:n.requestedCwd}),(0,L.jsx)(`div`,{style:{maxWidth:720,fontSize:`var(--text-base)`},children:I})]}),Bt&&(oe?(0,L.jsx)(`div`,{style:{height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`var(--text-muted)`,fontSize:`var(--text-2xl)`},children:s(`workspace.selectSession`)}):(0,L.jsxs)(`div`,{style:{height:`100%`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:12,userSelect:`none`},children:[(0,L.jsx)(`div`,{style:{fontSize:`var(--text-6xl)`,fontWeight:700,fontStyle:`italic`,color:`var(--accent)`},children:`Pi Web`}),(0,L.jsx)(`div`,{style:{fontSize:`var(--text-base)`,color:`var(--text-muted)`},children:s(`workspace.selectWorkspace`)})]}))]}),children:[(0,L.jsx)(_K,{id:jK,testId:`config-tab-pane`,children:(0,L.jsx)(DK,{section:je,onSectionChange:Me,cwd:ee,sessionId:j?.id??null,onClose:Be,onOpenFile:Le,sidebarWidth:nt.width,onSidebarWidthChange:nt.setWidth,widgetPanelWidth:it.width,onWidgetPanelWidthChange:it.setWidth,modelConfigFocus:Ie,defaultThinkingLevel:d,onDefaultThinkingLevelChange:f,compaction:p,onCompactionChange:e=>hn({firstPaint:{compaction:e}}),retry:m,onRetryChange:e=>hn({firstPaint:{retry:e}}),defaultProjectTrust:h,onDefaultProjectTrustChange:g,subagents:v,onSubagentsChange:e=>hn({firstPaint:{subagents:{defaultModel:e.defaultModel||void 0,defaultThinking:e.defaultThinking||void 0}}})})}),(0,L.jsx)(_K,{id:Pe?NK(Pe.filePath):`file:`,testId:`file-tab-pane`,children:Pe&&(0,L.jsx)(bne,{filePath:Pe.filePath,cwd:oe??void 0,sourceSessionId:Pe.sourceSessionId,gitRefreshKey:ne,initialDisplayMode:Pe.initialDisplayMode,onMentionLines:Rt,onSaved:()=>re(e=>e+1),onOpenFile:e=>Le(e,bO(e),{sourceSessionId:Pe.sourceSessionId})})}),(0,L.jsx)(_K,{id:AK,keepAlive:!0,testId:`chat-tab-pane`,scroll:`hidden`,activeWhen:N,children:(0,L.jsx)(`div`,{style:{flex:1,minHeight:0,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:(0,L.jsx)(Ote,{session:j,newSessionCwd:M,onAgentEnd:ve,onSessionCreated:_e,onSessionForked:be,modelsRefreshKey:ie,onOpenModelConfig:ze,chatInputRef:ot,onOpenFile:Je,onSessionRenamed:ye,windowTitleBase:Ht,toolbarExtra:qt,closedWidgetKeys:Et,onCloseWidget:Dt,onExtensionWidgetsChange:kt,onExtensionDialogChange:e=>{me.current=e}},P)})}),(0,L.jsx)(_K,{id:MK,keepAlive:!0,testId:`widgets-tab-pane`,zIndex:1,activeWhen:N,children:(0,L.jsx)(Kne,{geometries:x,messages:C,onAddMessage:w,onRemoveMessage:T,onUpdateMessage:E,widgets:Tt,closedKeys:Et,onReopen:Ot})})]})]}),Ft&&(0,L.jsx)(rr,{label:`${s(`layout.resizeWidgetPanel`)}: ${s(`layout.resizeHint`)}`,wrapperStyle:{display:`flex`,flex:`0 0 0`,width:0},children:(0,L.jsx)(`div`,{...it.separatorProps,"aria-controls":`widget-panel`,className:`panel-resize-handle widget-panel-resize-handle${it.isResizing?` is-resizing`:``}`,"data-resize-handle":`widget-panel`})}),!l&&!Mt?null:(0,L.jsx)(`div`,{ref:it.panelRef,"aria-controls":`widget-panel`,style:l?{position:`fixed`,inset:0,zIndex:250,display:`flex`,flexDirection:`column`}:{"--widget-panel-width":`${it.width}px`,width:`var(--widget-panel-width)`,display:`flex`,flexDirection:`column`,minWidth:0,overflow:`hidden`,borderLeft:`1px solid var(--border)`,background:`var(--bg)`},children:(0,L.jsx)($te,{cwd:j?.cwd??M,onOpenFile:Le,explorerRefreshKey:ne,onExplorerRefresh:Te,onAtMention:It,onAtMentions:Lt,sessionId:j?.id??null,onOpenConfig:e=>Re(e)})})]}),le&&ee&&(0,L.jsx)(Ane,{cwd:ee,busy:de,error:fe,onCancel:()=>{de||ue(!1)},onConfirm:()=>void we()})]})})})}),(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Ite,{}),(0,L.jsx)(kne,{})]})]})}var Zne=class extends _.Component{constructor(...e){super(...e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){In(e,`render error`)}render(){return this.state.hasError?(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:12,height:`100vh`,color:`var(--text)`,fontSize:`var(--text-base)`},children:[(0,L.jsx)(`span`,{children:`⚠️`}),(0,L.jsx)(`span`,{children:`Something went wrong while rendering.`}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>{this.setState({hasError:!1})},style:{border:`1px solid var(--border)`,background:`none`,color:`var(--text)`,borderRadius:6,padding:`4px 14px`,cursor:`pointer`},children:`Try again`})]}):this.props.children}};function Qne(){return(0,_.useEffect)(()=>{if(!(`serviceWorker`in navigator))return;let e=()=>{navigator.serviceWorker.register(`/sw.js?v=0.15.26`,{scope:`/`,updateViaCache:`none`}).catch(e=>{console.error(`Failed to register the Pi Web service worker:`,e)})};if(document.readyState===`complete`){e();return}return window.addEventListener(`load`,e,{once:!0}),()=>window.removeEventListener(`load`,e)},[]),null}var $ne=`piE2eFixtureDir`;function ere(){return typeof window>`u`?null:new URL(window.location.href).searchParams.get(`piE2eFixtureDir`)}function tre(){if(typeof document>`u`)return;let e=ere();e&&(document.cookie=`${$ne}=${encodeURIComponent(e)}; path=/; SameSite=Lax`)}async function nre(){tre(),Nq(!0),Iq();let e=Pq(`boot`),t=null;try{let n=await Et.load();e(`preferences catalog loaded`,`locale=${n.firstPaint?.locale}`);let r=n.firstPaint?.locale;(r===`en`||r===`zh-CN`)&&(t=r,document.documentElement.lang=r===`zh-CN`?`zh-CN`:`en`);let i=n.theme;if(i===`dark`?document.documentElement.classList.add(`dark`):document.documentElement.classList.remove(`dark`),i)try{localStorage.setItem(`pi-theme`,i)}catch{}}catch{}e(`root render`),window.addEventListener(`unhandledrejection`,e=>{In(e.reason,`unhandled promise rejection`)}),window.addEventListener(`error`,e=>{let t=(e.error instanceof Error?e.error.message:``)||e.message||``;t.includes(`ResizeObserver loop`)||t.startsWith(`Script error`)||In(e.error??e.message,`uncaught error`)}),(0,He.createRoot)(document.getElementById(`root`)).render((0,L.jsx)(_.StrictMode,{children:(0,L.jsx)(Zne,{children:(0,L.jsxs)(st,{initialLocale:t,children:[(0,L.jsx)(Xne,{}),(0,L.jsx)(Qne,{})]})})}))}nre();export{D0 as a,i as c,y2 as i,n6 as n,bk as o,o6 as r,tt as s,J2 as t};
|