@rainmanhhh/pi-web 0.14.3 → 0.14.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/dist/server.mjs +1 -1
  2. package/dist/static/assets/{CodeMirrorEditor-DSMafr9-.js → CodeMirrorEditor-C_ypSZVf.js} +1 -1
  3. package/dist/static/assets/architecture-YZFGNWBL-BJMdf5nD.js +1 -0
  4. package/dist/static/assets/{architectureDiagram-Q4EWVU46-BKXGUEon.js → architectureDiagram-Q4EWVU46-ytKinlbF.js} +1 -1
  5. package/dist/static/assets/{blockDiagram-DXYQGD6D-DtHKKnNV.js → blockDiagram-DXYQGD6D-C56hp_5x.js} +1 -1
  6. package/dist/static/assets/{c4Diagram-AHTNJAMY-DfNjdjag.js → c4Diagram-AHTNJAMY-DyD37ENs.js} +1 -1
  7. package/dist/static/assets/channel-BbMucKQT.js +1 -0
  8. package/dist/static/assets/{chunk-4TB4RGXK-CQQfRY6d.js → chunk-4TB4RGXK-6D8Zii0G.js} +1 -1
  9. package/dist/static/assets/{chunk-5FUZZQ4R-BT9--VMU.js → chunk-5FUZZQ4R-BJOxa6Bc.js} +1 -1
  10. package/dist/static/assets/{chunk-5PVQY5BW-E7SGdWgk.js → chunk-5PVQY5BW-yr-svrxg.js} +1 -1
  11. package/dist/static/assets/{chunk-EDXVE4YY-DU7Uv6vE.js → chunk-EDXVE4YY-CVAikEAB.js} +1 -1
  12. package/dist/static/assets/{chunk-ENJZ2VHE-DQtmTAKW.js → chunk-ENJZ2VHE-CbWVm8_j.js} +1 -1
  13. package/dist/static/assets/{chunk-ICPOFSXX-mnPIMDGh.js → chunk-ICPOFSXX-6HbuaJP9.js} +1 -1
  14. package/dist/static/assets/{chunk-K5T4RW27-FZnXJnjE.js → chunk-K5T4RW27-DIBgn7-D.js} +1 -1
  15. package/dist/static/assets/{chunk-OYMX7WX6-BYnOHrZV.js → chunk-OYMX7WX6-lfYktOQ3.js} +1 -1
  16. package/dist/static/assets/{chunk-U2HBQHQK-g05X_MA6.js → chunk-U2HBQHQK-DCgM1laD.js} +1 -1
  17. package/dist/static/assets/{chunk-X2U36JSP-BZPGf1aL.js → chunk-X2U36JSP-KPmlfF-o.js} +1 -1
  18. package/dist/static/assets/{chunk-YZCP3GAM-B8imZryx.js → chunk-YZCP3GAM-CWXt2c99.js} +1 -1
  19. package/dist/static/assets/{chunk-ZZ45TVLE-BJ_TZvey.js → chunk-ZZ45TVLE-DDG_VXj-.js} +1 -1
  20. package/dist/static/assets/classDiagram-6PBFFD2Q-D0MY_IAD.js +1 -0
  21. package/dist/static/assets/classDiagram-v2-HSJHXN6E-D0MY_IAD.js +1 -0
  22. package/dist/static/assets/clone-BiAXqv-X.js +1 -0
  23. package/dist/static/assets/{dagre-BKbOt7ji.js → dagre-BhVYzPxz.js} +1 -1
  24. package/dist/static/assets/{dagre-KV5264BT-DgSY2Ba5.js → dagre-KV5264BT-Dxh16oXH.js} +1 -1
  25. package/dist/static/assets/{diagram-5BDNPKRD-BXNflAsd.js → diagram-5BDNPKRD-CB2hRIfo.js} +1 -1
  26. package/dist/static/assets/{diagram-G4DWMVQ6-DzS9xfX_.js → diagram-G4DWMVQ6-BUp_-pSO.js} +1 -1
  27. package/dist/static/assets/{diagram-MMDJMWI5-BoG2YV2C.js → diagram-MMDJMWI5-FQIEN75y.js} +1 -1
  28. package/dist/static/assets/{diagram-TYMM5635-U2rjNzQx.js → diagram-TYMM5635-DuZrLYNG.js} +1 -1
  29. package/dist/static/assets/{erDiagram-SMLLAGMA-CHTodmHm.js → erDiagram-SMLLAGMA-Ca7SQBWr.js} +1 -1
  30. package/dist/static/assets/{flatten-C_yBBeSl.js → flatten-CEQPppMD.js} +1 -1
  31. package/dist/static/assets/{flowDiagram-DWJPFMVM-DFu_v3fI.js → flowDiagram-DWJPFMVM-BfQG7XwS.js} +1 -1
  32. package/dist/static/assets/{ganttDiagram-T4ZO3ILL-CUCMHyF5.js → ganttDiagram-T4ZO3ILL-D6NtMxsJ.js} +1 -1
  33. package/dist/static/assets/gitGraph-7Q5UKJZL-C2fsqXCq.js +1 -0
  34. package/dist/static/assets/{gitGraphDiagram-UUTBAWPF-rfqjvQ6E.js → gitGraphDiagram-UUTBAWPF-BL02rljK.js} +1 -1
  35. package/dist/static/assets/{graphlib-xGFxrNAo.js → graphlib-CcnvjBEI.js} +1 -1
  36. package/dist/static/assets/{highlighted-body-OFNGDK62-D4klPf9N.js → highlighted-body-OFNGDK62-B8ljKzZr.js} +1 -1
  37. package/dist/static/assets/{index-CIK1v_mV.js → index-DXhLJVGI.js} +12 -12
  38. package/dist/static/assets/info-OMHHGYJF-DeoWkyJ7.js +1 -0
  39. package/dist/static/assets/{infoDiagram-42DDH7IO-Bi1fBDfH.js → infoDiagram-42DDH7IO-CBa3n9LP.js} +1 -1
  40. package/dist/static/assets/{ishikawaDiagram-UXIWVN3A-D8NN32RZ.js → ishikawaDiagram-UXIWVN3A-CuKFMztm.js} +1 -1
  41. package/dist/static/assets/{journeyDiagram-VCZTEJTY-C-_XrW_o.js → journeyDiagram-VCZTEJTY-vAkx1nZW.js} +1 -1
  42. package/dist/static/assets/{kanban-definition-6JOO6SKY-SCLxIrx0.js → kanban-definition-6JOO6SKY-Ci3_Ngjy.js} +1 -1
  43. package/dist/static/assets/{line-CVjASbT7.js → line-DdfX2ddv.js} +1 -1
  44. package/dist/static/assets/mermaid-GHXKKRXX-CL5fSR23.js +1 -0
  45. package/dist/static/assets/{mermaid-parser.core-CtITMJFU.js → mermaid-parser.core-N9dNZDq0.js} +2 -2
  46. package/dist/static/assets/{mermaid.core-B5Pfvt4i.js → mermaid.core-BhANQr2H.js} +4 -4
  47. package/dist/static/assets/{mindmap-definition-QFDTVHPH-CUnhD8xy.js → mindmap-definition-QFDTVHPH-CSgak7JW.js} +1 -1
  48. package/dist/static/assets/packet-4T2RLAQJ-97hcXKND.js +1 -0
  49. package/dist/static/assets/pie-ZZUOXDRM-so9GsI0m.js +1 -0
  50. package/dist/static/assets/{pieDiagram-DEJITSTG-0bhPCKQn.js → pieDiagram-DEJITSTG-CX80PTr0.js} +1 -1
  51. package/dist/static/assets/{quadrantDiagram-34T5L4WZ-DbYQ_K2d.js → quadrantDiagram-34T5L4WZ-ByfzYmsF.js} +1 -1
  52. package/dist/static/assets/radar-PYXPWWZC-BxXmYPMw.js +1 -0
  53. package/dist/static/assets/{reduce-NfeZfRJU.js → reduce-DhVn0Dvz.js} +1 -1
  54. package/dist/static/assets/{requirementDiagram-MS252O5E-iApTZcp4.js → requirementDiagram-MS252O5E-BFxuxaN-.js} +1 -1
  55. package/dist/static/assets/{sankeyDiagram-XADWPNL6-BxUa_NbO.js → sankeyDiagram-XADWPNL6-DW47sanB.js} +1 -1
  56. package/dist/static/assets/{sequenceDiagram-FGHM5R23-UOp8Uvyb.js → sequenceDiagram-FGHM5R23-C2uaIx4n.js} +1 -1
  57. package/dist/static/assets/{stateDiagram-FHFEXIEX-CNBP6z0s.js → stateDiagram-FHFEXIEX-DcROaZJM.js} +1 -1
  58. package/dist/static/assets/stateDiagram-v2-QKLJ7IA2-B3ZKU5jZ.js +1 -0
  59. package/dist/static/assets/{timeline-definition-GMOUNBTQ-BMUBUtVF.js → timeline-definition-GMOUNBTQ-CXyl_GCG.js} +1 -1
  60. package/dist/static/assets/treeView-SZITEDCU-Cs49_BRL.js +1 -0
  61. package/dist/static/assets/treemap-W4RFUUIX-C2frOvcN.js +1 -0
  62. package/dist/static/assets/{vennDiagram-DHZGUBPP-_tA3-C6y.js → vennDiagram-DHZGUBPP-BeQQVsPE.js} +1 -1
  63. package/dist/static/assets/wardley-RL74JXVD-BfDr5gok.js +1 -0
  64. package/dist/static/assets/{wardleyDiagram-NUSXRM2D-DSU7lqhe.js → wardleyDiagram-NUSXRM2D-CD6piXgc.js} +1 -1
  65. package/dist/static/assets/{xychartDiagram-5P7HB3ND-C6ldupwG.js → xychartDiagram-5P7HB3ND-BTL0I1by.js} +1 -1
  66. package/dist/static/index.html +1 -1
  67. package/package.json +1 -1
  68. package/dist/static/assets/architecture-YZFGNWBL-CVvRajjQ.js +0 -1
  69. package/dist/static/assets/channel-32A1CqdZ.js +0 -1
  70. package/dist/static/assets/classDiagram-6PBFFD2Q-C5GB6FiX.js +0 -1
  71. package/dist/static/assets/classDiagram-v2-HSJHXN6E-C5GB6FiX.js +0 -1
  72. package/dist/static/assets/clone-B3ii8qUC.js +0 -1
  73. package/dist/static/assets/gitGraph-7Q5UKJZL-BuXuhPqP.js +0 -1
  74. package/dist/static/assets/info-OMHHGYJF-DonquLJ0.js +0 -1
  75. package/dist/static/assets/mermaid-GHXKKRXX-BNiS2a30.js +0 -1
  76. package/dist/static/assets/packet-4T2RLAQJ-TWy53oeO.js +0 -1
  77. package/dist/static/assets/pie-ZZUOXDRM-BYJc_hio.js +0 -1
  78. package/dist/static/assets/radar-PYXPWWZC-BsGfyi_n.js +0 -1
  79. package/dist/static/assets/stateDiagram-v2-QKLJ7IA2-BUu6wXtb.js +0 -1
  80. package/dist/static/assets/treeView-SZITEDCU-LMyV2xPx.js +0 -1
  81. package/dist/static/assets/treemap-W4RFUUIX-Clk0YF-c.js +0 -1
  82. package/dist/static/assets/wardley-RL74JXVD-CjrClIuS.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/highlighted-body-OFNGDK62-D4klPf9N.js","assets/rolldown-runtime-C_s2cVnS.js","assets/mermaid.core-B5Pfvt4i.js","assets/_baseFor-D6HAxaEF.js","assets/src-D3QavEJ4.js","assets/chunk-ICPOFSXX-mnPIMDGh.js","assets/chunk-5PVQY5BW-E7SGdWgk.js","assets/dist-C_yfW-4f.js","assets/chunk-U2HBQHQK-g05X_MA6.js","assets/chunk-BSJP7CBP-BclwT518.js","assets/chunk-ZZ45TVLE-BJ_TZvey.js","assets/chunk-X2U36JSP-BZPGf1aL.js","assets/chunk-5FUZZQ4R-BT9--VMU.js","assets/rough.esm-Dy-Kn_BL.js","assets/chunk-ENJZ2VHE-DQtmTAKW.js","assets/line-CVjASbT7.js","assets/path-fybaL0A-.js","assets/array-BifhSqXX.js","assets/CodeMirrorEditor-DSMafr9-.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/highlighted-body-OFNGDK62-B8ljKzZr.js","assets/rolldown-runtime-C_s2cVnS.js","assets/mermaid.core-BhANQr2H.js","assets/_baseFor-D6HAxaEF.js","assets/src-D3QavEJ4.js","assets/chunk-ICPOFSXX-6HbuaJP9.js","assets/chunk-5PVQY5BW-yr-svrxg.js","assets/dist-C_yfW-4f.js","assets/chunk-U2HBQHQK-DCgM1laD.js","assets/chunk-BSJP7CBP-BclwT518.js","assets/chunk-ZZ45TVLE-DDG_VXj-.js","assets/chunk-X2U36JSP-KPmlfF-o.js","assets/chunk-5FUZZQ4R-BJOxa6Bc.js","assets/rough.esm-Dy-Kn_BL.js","assets/chunk-ENJZ2VHE-CbWVm8_j.js","assets/line-DdfX2ddv.js","assets/path-fybaL0A-.js","assets/array-BifhSqXX.js","assets/CodeMirrorEditor-C_ypSZVf.js"])))=>i.map(i=>d[i]);
2
2
  import{o as e,r as t,t as n}from"./rolldown-runtime-C_s2cVnS.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 P(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 ee(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 F=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)},te={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(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=te,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:ee}},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,F)}catch(e){F(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.4`})),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}}}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.4`})),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 P(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?P(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return P(e(t))}catch{}}return null}var ee=Array.isArray,F=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},re=[],ie=-1;function ae(e){return{current:e}}function oe(e){0>ie||(e.current=re[ie],re[ie]=null,ie--)}function I(e,t){ie++,re[ie]=e.current,e.current=t}var L=ae(null),se=ae(null),R=ae(null),ce=ae(null);function le(e,t){switch(I(R,t),I(se,e),I(L,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?nf(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=nf(t),e=rf(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}oe(L),I(L,e)}function ue(){oe(L),oe(se),oe(R)}function de(e){e.memoizedState!==null&&I(ce,e);var t=L.current,n=rf(t,e.type);t!==n&&(I(se,e),I(L,n))}function fe(e){se.current===e&&(oe(L),oe(se)),ce.current===e&&(oe(ce),pp._currentValue=ne)}var pe,me;function he(e){if(pe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);pe=t&&t[1]||``,me=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+pe+e+me}var ge=!1;function _e(e,t){if(!e||ge)return``;ge=!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(`
@@ -7,7 +7,7 @@ import{o as e,r as t,t as n}from"./rolldown-runtime-C_s2cVnS.js";(function(){let
7
7
  `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{ge=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?he(n):``}function ve(e,t){switch(e.tag){case 26:case 27:case 5:return he(e.type);case 16:return he(`Lazy`);case 13:return e.child!==t&&t!==null?he(`Suspense Fallback`):he(`Suspense`);case 19:return he(`SuspenseList`);case 0:case 15:return _e(e.type,!1);case 11:return _e(e.type.render,!1);case 1:return _e(e.type,!0);case 31:return he(`Activity`);default:return``}}function ye(e){try{var t=``,n=null;do t+=ve(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
8
8
  Error generating stack: `+e.message+`
9
9
  `+e.stack}}var be=Object.prototype.hasOwnProperty,xe=t.unstable_scheduleCallback,Se=t.unstable_cancelCallback,Ce=t.unstable_shouldYield,we=t.unstable_requestPaint,Te=t.unstable_now,Ee=t.unstable_getCurrentPriorityLevel,De=t.unstable_ImmediatePriority,Oe=t.unstable_UserBlockingPriority,ke=t.unstable_NormalPriority,Ae=t.unstable_LowPriority,je=t.unstable_IdlePriority,Me=t.log,Ne=t.unstable_setDisableYieldValue,Pe=null,Fe=null;function Ie(e){if(typeof Me==`function`&&Ne(e),Fe&&typeof Fe.setStrictMode==`function`)try{Fe.setStrictMode(Pe,e)}catch{}}var Le=Math.clz32?Math.clz32:Be,Re=Math.log,ze=Math.LN2;function Be(e){return e>>>=0,e===0?32:31-(Re(e)/ze|0)|0}var Ve=256,He=262144,Ue=4194304;function We(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ge(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=We(n))):i=We(o):i=We(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=We(n))):i=We(o)):i=We(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Ke(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function qe(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Je(){var e=Ue;return Ue<<=1,!(Ue&62914560)&&(Ue=4194304),e}function Ye(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Xe(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ze(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Le(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Qe(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Qe(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Le(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function $e(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Le(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function et(e,t){var n=t&-t;return n=n&42?1:tt(n),(n&(e.suspendedLanes|t))===0?n:0}function tt(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function nt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function rt(){var e=te.p;return e===0?(e=window.event,e===void 0?32:kp(e.type)):e}function it(e,t){var n=te.p;try{return te.p=e,t()}finally{te.p=n}}var at=Math.random().toString(36).slice(2),ot=`__reactFiber$`+at,st=`__reactProps$`+at,ct=`__reactContainer$`+at,lt=`__reactEvents$`+at,ut=`__reactListeners$`+at,dt=`__reactHandles$`+at,ft=`__reactResources$`+at,pt=`__reactMarker$`+at;function mt(e){delete e[ot],delete e[st],delete e[lt],delete e[ut],delete e[dt]}function ht(e){var t=e[ot];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ct]||n[ot]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Ef(e);e!==null;){if(n=e[ot])return n;e=Ef(e)}return t}e=n,n=e.parentNode}return null}function gt(e){if(e=e[ot]||e[ct]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function _t(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(a(33))}function vt(e){var t=e[ft];return t||=e[ft]={hoistableStyles:new Map,hoistableScripts:new Map},t}function yt(e){e[pt]=!0}var bt=new Set,xt={};function St(e,t){Ct(e,t),Ct(e+`Capture`,t)}function Ct(e,t){for(xt[e]=t,e=0;e<t.length;e++)bt.add(t[e])}var wt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),Tt={},Et={};function Dt(e){return be.call(Et,e)?!0:be.call(Tt,e)?!1:wt.test(e)?Et[e]=!0:(Tt[e]=!0,!1)}function Ot(e,t,n){if(Dt(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}}function kt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function At(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function jt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Mt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Nt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Pt(e){if(!e._valueTracker){var t=Mt(e)?`checked`:`value`;e._valueTracker=Nt(e,t,``+e[t])}}function Ft(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Mt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function It(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Lt=/[\n"\\]/g;function Rt(e){return e.replace(Lt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function zt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+jt(t)):e.value!==``+jt(t)&&(e.value=``+jt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Vt(e,o,jt(n)):Vt(e,o,jt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+jt(s):e.removeAttribute(`name`)}function Bt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Pt(e);return}n=n==null?``:``+jt(n),t=t==null?n:``+jt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Pt(e)}function Vt(e,t,n){t===`number`&&It(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Ht(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+jt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Ut(e,t,n){if(t!=null&&(t=``+jt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+jt(n)}function Wt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(a(92));if(ee(r)){if(1<r.length)throw Error(a(93));r=r[0]}n=r}n??=``,t=n}n=jt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Pt(e)}function Gt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Kt=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function qt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Kt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Jt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(a(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var i in t)r=t[i],t.hasOwnProperty(i)&&n[i]!==r&&qt(e,i,r)}else for(var o in t)t.hasOwnProperty(o)&&qt(e,o,t[o])}function Yt(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Xt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Zt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Qt(e){return Zt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function $t(){}var en=null;function tn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var nn=null,rn=null;function an(e){var t=gt(e);if(t&&(e=t.stateNode)){var n=e[st]||null;a:switch(e=t.stateNode,t.type){case`input`:if(zt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Rt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=r[st]||null;if(!i)throw Error(a(90));zt(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Ft(r)}break a;case`textarea`:Ut(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Ht(e,!!n.multiple,t,!1)}}}var on=!1;function sn(e,t,n){if(on)return e(t,n);on=!0;try{return e(t)}finally{if(on=!1,(nn!==null||rn!==null)&&(Mu(),nn&&(t=nn,e=rn,rn=nn=null,an(t),e)))for(t=0;t<e.length;t++)an(e[t])}}function cn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[st]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(a(231,t,typeof n));return n}var ln=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),un=!1;if(ln)try{var dn={};Object.defineProperty(dn,"passive",{get:function(){un=!0}}),window.addEventListener(`test`,dn,dn),window.removeEventListener(`test`,dn,dn)}catch{un=!1}var fn=null,pn=null,mn=null;function hn(){if(mn)return mn;var e,t=pn,n=t.length,r,i=`value`in fn?fn.value:fn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return mn=i.slice(e,1<r?1-r:void 0)}function gn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function _n(){return!0}function vn(){return!1}function yn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?_n:vn,this.isPropagationStopped=vn,this}return h(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=_n)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=_n)},persist:function(){},isPersistent:_n}),t}var bn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},xn=yn(bn),Sn=h({},bn,{view:0,detail:0}),Cn=yn(Sn),wn,Tn,En,Dn=h({},Sn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Rn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==En&&(En&&e.type===`mousemove`?(wn=e.screenX-En.screenX,Tn=e.screenY-En.screenY):Tn=wn=0,En=e),wn)},movementY:function(e){return`movementY`in e?e.movementY:Tn}}),On=yn(Dn),kn=yn(h({},Dn,{dataTransfer:0})),An=yn(h({},Sn,{relatedTarget:0})),jn=yn(h({},bn,{animationName:0,elapsedTime:0,pseudoElement:0})),Mn=yn(h({},bn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Nn=yn(h({},bn,{data:0})),Pn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Fn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},In={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Ln(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=In[e])?!!t[e]:!1}function Rn(){return Ln}var zn=yn(h({},Sn,{key:function(e){if(e.key){var t=Pn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=gn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Fn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Rn,charCode:function(e){return e.type===`keypress`?gn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?gn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Bn=yn(h({},Dn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Vn=yn(h({},Sn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Rn})),Hn=yn(h({},bn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Un=yn(h({},Dn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Wn=yn(h({},bn,{newState:0,oldState:0})),Gn=[9,13,27,32],Kn=ln&&`CompositionEvent`in window,qn=null;ln&&`documentMode`in document&&(qn=document.documentMode);var Jn=ln&&`TextEvent`in window&&!qn,Yn=ln&&(!Kn||qn&&8<qn&&11>=qn),Xn=` `,Zn=!1;function Qn(e,t){switch(e){case`keyup`:return Gn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function $n(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var er=!1;function tr(e,t){switch(e){case`compositionend`:return $n(t);case`keypress`:return t.which===32?(Zn=!0,Xn):null;case`textInput`:return e=t.data,e===Xn&&Zn?null:e;default:return null}}function nr(e,t){if(er)return e===`compositionend`||!Kn&&Qn(e,t)?(e=hn(),mn=pn=fn=null,er=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Yn&&t.locale!==`ko`?null:t.data;default:return null}}var rr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function ir(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!rr[e.type]:t===`textarea`}function ar(e,t,n,r){nn?rn?rn.push(r):rn=[r]:nn=r,t=Bd(t,`onChange`),0<t.length&&(n=new xn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var or=null,sr=null;function cr(e){Md(e,0)}function lr(e){if(Ft(_t(e)))return e}function ur(e,t){if(e===`change`)return t}var dr=!1;if(ln){var fr;if(ln){var pr=`oninput`in document;if(!pr){var mr=document.createElement(`div`);mr.setAttribute(`oninput`,`return;`),pr=typeof mr.oninput==`function`}fr=pr}else fr=!1;dr=fr&&(!document.documentMode||9<document.documentMode)}function hr(){or&&(or.detachEvent(`onpropertychange`,gr),sr=or=null)}function gr(e){if(e.propertyName===`value`&&lr(sr)){var t=[];ar(t,sr,e,tn(e)),sn(cr,t)}}function _r(e,t,n){e===`focusin`?(hr(),or=t,sr=n,or.attachEvent(`onpropertychange`,gr)):e===`focusout`&&hr()}function vr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return lr(sr)}function yr(e,t){if(e===`click`)return lr(t)}function br(e,t){if(e===`input`||e===`change`)return lr(t)}function xr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Sr=typeof Object.is==`function`?Object.is:xr;function Cr(e,t){if(Sr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!be.call(t,i)||!Sr(e[i],t[i]))return!1}return!0}function wr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Tr(e,t){var n=wr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=wr(n)}}function Er(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Er(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Dr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=It(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=It(e.document)}return t}function Or(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var kr=ln&&`documentMode`in document&&11>=document.documentMode,Ar=null,jr=null,Mr=null,Nr=!1;function Pr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Nr||Ar==null||Ar!==It(r)||(r=Ar,`selectionStart`in r&&Or(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Mr&&Cr(Mr,r)||(Mr=r,r=Bd(jr,`onSelect`),0<r.length&&(t=new xn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Ar)))}function Fr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Ir={animationend:Fr(`Animation`,`AnimationEnd`),animationiteration:Fr(`Animation`,`AnimationIteration`),animationstart:Fr(`Animation`,`AnimationStart`),transitionrun:Fr(`Transition`,`TransitionRun`),transitionstart:Fr(`Transition`,`TransitionStart`),transitioncancel:Fr(`Transition`,`TransitionCancel`),transitionend:Fr(`Transition`,`TransitionEnd`)},Lr={},Rr={};ln&&(Rr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Ir.animationend.animation,delete Ir.animationiteration.animation,delete Ir.animationstart.animation),`TransitionEvent`in window||delete Ir.transitionend.transition);function zr(e){if(Lr[e])return Lr[e];if(!Ir[e])return e;var t=Ir[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Rr)return Lr[e]=t[n];return e}var Br=zr(`animationend`),Vr=zr(`animationiteration`),Hr=zr(`animationstart`),Ur=zr(`transitionrun`),Wr=zr(`transitionstart`),Gr=zr(`transitioncancel`),Kr=zr(`transitionend`),qr=new Map,Jr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);Jr.push(`scrollEnd`);function Yr(e,t){qr.set(e,t),St(t,[e])}var Xr=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)},Zr=[],Qr=0,$r=0;function ei(){for(var e=Qr,t=$r=Qr=0;t<e;){var n=Zr[t];Zr[t++]=null;var r=Zr[t];Zr[t++]=null;var i=Zr[t];Zr[t++]=null;var a=Zr[t];if(Zr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&ii(n,i,a)}}function ti(e,t,n,r){Zr[Qr++]=e,Zr[Qr++]=t,Zr[Qr++]=n,Zr[Qr++]=r,$r|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ni(e,t,n,r){return ti(e,t,n,r),ai(e)}function ri(e,t){return ti(e,null,null,t),ai(e)}function ii(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Le(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ai(e){if(50<Cu)throw Cu=0,wu=null,Error(a(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var oi={};function si(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ci(e,t,n,r){return new si(e,t,n,r)}function li(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ui(e,t){var n=e.alternate;return n===null?(n=ci(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function di(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function fi(e,t,n,r,i,o){var s=0;if(r=e,typeof e==`function`)li(e)&&(s=1);else if(typeof e==`string`)s=ip(e,n,L.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=ci(31,n,t,i),e.elementType=k,e.lanes=o,e;case y:return pi(n.children,i,o,t);case b:s=8,i|=24;break;case x:return e=ci(12,n,t,i|2),e.elementType=x,e.lanes=o,e;case T:return e=ci(13,n,t,i),e.elementType=T,e.lanes=o,e;case E:return e=ci(19,n,t,i),e.elementType=E,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:s=10;break a;case S:s=9;break a;case w:s=11;break a;case D:s=14;break a;case O:s=16,r=null;break a}s=29,n=Error(a(130,e===null?`null`:typeof e,``)),r=null}return t=ci(s,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function pi(e,t,n,r){return e=ci(7,e,r,t),e.lanes=n,e}function mi(e,t,n){return e=ci(6,e,null,t),e.lanes=n,e}function hi(e){var t=ci(18,null,null,0);return t.stateNode=e,t}function gi(e,t,n){return t=ci(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var _i=new WeakMap;function vi(e,t){if(typeof e==`object`&&e){var n=_i.get(e);return n===void 0?(t={value:e,source:t,stack:ye(t)},_i.set(e,t),t):n}return{value:e,source:t,stack:ye(t)}}var yi=[],bi=0,xi=null,Si=0,Ci=[],wi=0,Ti=null,Ei=1,Di=``;function Oi(e,t){yi[bi++]=Si,yi[bi++]=xi,xi=e,Si=t}function ki(e,t,n){Ci[wi++]=Ei,Ci[wi++]=Di,Ci[wi++]=Ti,Ti=e;var r=Ei;e=Di;var i=32-Le(r)-1;r&=~(1<<i),n+=1;var a=32-Le(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Ei=1<<32-Le(t)+i|n<<i|r,Di=a+e}else Ei=1<<a|n<<i|r,Di=e}function Ai(e){e.return!==null&&(Oi(e,1),ki(e,1,0))}function ji(e){for(;e===xi;)xi=yi[--bi],yi[bi]=null,Si=yi[--bi],yi[bi]=null;for(;e===Ti;)Ti=Ci[--wi],Ci[wi]=null,Di=Ci[--wi],Ci[wi]=null,Ei=Ci[--wi],Ci[wi]=null}function Mi(e,t){Ci[wi++]=Ei,Ci[wi++]=Di,Ci[wi++]=Ti,Ei=t.id,Di=t.overflow,Ti=e}var Ni=null,Pi=null,Fi=!1,Ii=null,Li=!1,Ri=Error(a(519));function zi(e){throw Gi(vi(Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Ri}function Bi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[ot]=e,t[st]=r,n){case`dialog`:Nd(`cancel`,t),Nd(`close`,t);break;case`iframe`:case`object`:case`embed`:Nd(`load`,t);break;case`video`:case`audio`:for(n=0;n<Ad.length;n++)Nd(Ad[n],t);break;case`source`:Nd(`error`,t);break;case`img`:case`image`:case`link`:Nd(`error`,t),Nd(`load`,t);break;case`details`:Nd(`toggle`,t);break;case`input`:Nd(`invalid`,t),Bt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Nd(`invalid`,t);break;case`textarea`:Nd(`invalid`,t),Wt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Kd(t.textContent,n)?(r.popover!=null&&(Nd(`beforetoggle`,t),Nd(`toggle`,t)),r.onScroll!=null&&Nd(`scroll`,t),r.onScrollEnd!=null&&Nd(`scrollend`,t),r.onClick!=null&&(t.onclick=$t),t=!0):t=!1,t||zi(e,!0)}function Vi(e){for(Ni=e.return;Ni;)switch(Ni.tag){case 5:case 31:case 13:Li=!1;return;case 27:case 3:Li=!0;return;default:Ni=Ni.return}}function Hi(e){if(e!==Ni)return!1;if(!Fi)return Vi(e),Fi=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||af(e.type,e.memoizedProps)),n=!n),n&&Pi&&zi(e),Vi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(317));Pi=Tf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(317));Pi=Tf(e)}else t===27?(t=Pi,pf(e.type)?(e=wf,wf=null,Pi=e):Pi=t):Pi=Ni?Cf(e.stateNode.nextSibling):null;return!0}function Ui(){Pi=Ni=null,Fi=!1}function Wi(){var e=Ii;return e!==null&&(lu===null?lu=e:lu.push.apply(lu,e),Ii=null),e}function Gi(e){Ii===null?Ii=[e]:Ii.push(e)}var Ki=ae(null),qi=null,Ji=null;function Yi(e,t,n){I(Ki,t._currentValue),t._currentValue=n}function Xi(e){e._currentValue=Ki.current,oe(Ki)}function Zi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Qi(e,t,n,r){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var o=i.dependencies;if(o!==null){var s=i.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=i;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Zi(o.return,n,e),r||(s=null);break a}o=c.next}}else if(i.tag===18){if(s=i.return,s===null)throw Error(a(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Zi(s,n,e),s=null}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===e){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}}function $i(e,t,n,r){e=null;for(var i=t,o=!1;i!==null;){if(!o){if(i.flags&524288)o=!0;else if(i.flags&262144)break}if(i.tag===10){var s=i.alternate;if(s===null)throw Error(a(387));if(s=s.memoizedProps,s!==null){var c=i.type;Sr(i.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(i===ce.current){if(s=i.alternate,s===null)throw Error(a(387));s.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e===null?e=[pp]:e.push(pp))}i=i.return}e!==null&&Qi(t,e,n,r),t.flags|=262144}function ea(e){for(e=e.firstContext;e!==null;){if(!Sr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ta(e){qi=e,Ji=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function na(e){return ia(qi,e)}function ra(e,t){return qi===null&&ta(e),ia(e,t)}function ia(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ji===null){if(e===null)throw Error(a(308));Ji=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ji=Ji.next=t;return n}var aa=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},oa=t.unstable_scheduleCallback,sa=t.unstable_NormalPriority,ca={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function la(){return{controller:new aa,data:new Map,refCount:0}}function ua(e){e.refCount--,e.refCount===0&&oa(sa,function(){e.controller.abort()})}var da=null,fa=0,pa=0,ma=null;function ha(e,t){if(da===null){var n=da=[];fa=0,pa=wd(),ma={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return fa++,t.then(ga,ga),t}function ga(){if(--fa===0&&da!==null){ma!==null&&(ma.status=`fulfilled`);var e=da;da=null,pa=0,ma=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function _a(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var va=F.S;F.S=function(e,t){fu=Te(),typeof t==`object`&&t&&typeof t.then==`function`&&ha(e,t),va!==null&&va(e,t)};var ya=ae(null);function ba(){var e=ya.current;return e===null?ql.pooledCache:e}function xa(e,t){t===null?I(ya,ya.current):I(ya,t.pool)}function Sa(){var e=ba();return e===null?null:{parent:ca._currentValue,pool:e}}var Ca=Error(a(460)),wa=Error(a(474)),Ta=Error(a(542)),Ea={then:function(){}};function Da(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Oa(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then($t,$t),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ma(e),e;default:if(typeof t.status==`string`)t.then($t,$t);else{if(e=ql,e!==null&&100<e.shellSuspendCounter)throw Error(a(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ma(e),e}throw Aa=t,Ca}}function ka(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Aa=e,Ca):e}}var Aa=null;function ja(){if(Aa===null)throw Error(a(459));var e=Aa;return Aa=null,e}function Ma(e){if(e===Ca||e===Ta)throw Error(a(483))}var Na=null,Pa=0;function Fa(e){var t=Pa;return Pa+=1,Na===null&&(Na=[]),Oa(Na,e,t)}function Ia(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function La(e,t){throw t.$$typeof===g?Error(a(525)):(e=Object.prototype.toString.call(t),Error(a(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Ra(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function i(e,t){return e=ui(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=mi(n,e.mode,r),t.return=e,t):(t=i(t,n),t.return=e,t)}function l(e,t,n,r){var a=n.type;return a===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===a||typeof a==`object`&&a&&a.$$typeof===O&&ka(a)===t.type)?(t=i(t,n.props),Ia(t,n),t.return=e,t):(t=fi(n.type,n.key,n.props,null,e.mode,r),Ia(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=gi(n,e.mode,r),t.return=e,t):(t=i(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,a){return t===null||t.tag!==7?(t=pi(n,e.mode,r,a),t.return=e,t):(t=i(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=mi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=fi(t.type,t.key,t.props,null,e.mode,n),Ia(n,t),n.return=e,n;case v:return t=gi(t,e.mode,n),t.return=e,t;case O:return t=ka(t),f(e,t,n)}if(ee(t)||M(t))return t=pi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Fa(t),n);if(t.$$typeof===C)return f(e,ra(e,t),n);La(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case _:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case O:return n=ka(n),p(e,t,n,r)}if(ee(n)||M(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Fa(n),r);if(n.$$typeof===C)return p(e,t,ra(e,n),r);La(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case _:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=ka(r),m(e,t,n,r,i)}if(ee(r)||M(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Fa(r),i);if(r.$$typeof===C)return m(e,t,n,ra(t,r),i);La(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Fi&&Oi(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return Fi&&Oi(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),Fi&&Oi(i,h),l}function g(i,s,c,l){if(c==null)throw Error(a(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),Fi&&Oi(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Fi&&Oi(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),Fi&&Oi(i,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=i(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&ka(l)===r.type){n(e,r.sibling),c=i(r,o.props),Ia(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===y?(c=pi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=fi(o.type,o.key,o.props,null,e.mode,c),Ia(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=i(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=gi(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=ka(o),b(e,r,o,c)}if(ee(o))return h(e,r,o,c);if(M(o)){if(l=M(o),typeof l!=`function`)throw Error(a(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Fa(o),c);if(o.$$typeof===C)return b(e,r,ra(e,o),c);La(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,o),c.return=e,e=c):(n(e,r),c=mi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Pa=0;var i=b(e,t,n,r);return Na=null,i}catch(t){if(t===Ca||t===Ta)throw t;var a=ci(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var za=Ra(!0),Ba=Ra(!1),Va=!1;function Ha(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ua(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Wa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ga(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Kl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ai(e),ii(e,null,n),t}return ti(e,r,t,n),ai(e)}function Ka(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$e(e,n)}}function qa(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ja=!1;function Ya(){if(Ja){var e=ma;if(e!==null)throw e}}function Xa(e,t,n,r){Ja=!1;var i=e.updateQueue;Va=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Yl&f)===f:(r&f)===f){f!==0&&f===pa&&(Ja=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(m=g.payload,typeof m==`function`){d=m.call(_,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m==`function`?m.call(_,d,f):m,f==null)break a;d=h({},d,f);break a;case 2:Va=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),ru|=o,e.lanes=o,e.memoizedState=d}}function Za(e,t){if(typeof e!=`function`)throw Error(a(191,e));e.call(t)}function Qa(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Za(n[e],t)}var $a=ae(null),eo=ae(0);function to(e,t){e=tu,I(eo,e),I($a,t),tu=e|t.baseLanes}function no(){I(eo,tu),I($a,$a.current)}function ro(){tu=eo.current,oe($a),oe(eo)}var io=ae(null),ao=null;function oo(e){var t=e.alternate;I(fo,fo.current&1),I(io,e),ao===null&&(t===null||$a.current!==null||t.memoizedState!==null)&&(ao=e)}function so(e){I(fo,fo.current),I(io,e),ao===null&&(ao=e)}function co(e){e.tag===22?(I(fo,fo.current),I(io,e),ao===null&&(ao=e)):lo(e)}function lo(){I(fo,fo.current),I(io,io.current)}function uo(e){oe(io),ao===e&&(ao=null),oe(fo)}var fo=ae(0);function po(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||bf(n)||xf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var mo=0,ho=null,go=null,_o=null,vo=!1,yo=!1,bo=!1,xo=0,So=0,Co=null,wo=0;function To(){throw Error(a(321))}function Eo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Sr(e[n],t[n]))return!1;return!0}function Do(e,t,n,r,i,a){return mo=a,ho=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,F.H=e===null||e.memoizedState===null?Ws:Gs,bo=!1,a=n(r,i),bo=!1,yo&&(a=ko(t,n,r,i)),Oo(e),a}function Oo(e){F.H=Us;var t=go!==null&&go.next!==null;if(mo=0,_o=go=ho=null,vo=!1,So=0,Co=null,t)throw Error(a(300));e===null||cc||(e=e.dependencies,e!==null&&ea(e)&&(cc=!0))}function ko(e,t,n,r){ho=e;var i=0;do{if(yo&&(Co=null),So=0,yo=!1,25<=i)throw Error(a(301));if(i+=1,_o=go=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}F.H=Ks,o=t(n,r)}while(yo);return o}function Ao(){var e=F.H,t=e.useState()[0];return t=typeof t.then==`function`?Lo(t):t,e=e.useState()[0],(go===null?null:go.memoizedState)!==e&&(ho.flags|=1024),t}function jo(){var e=xo!==0;return xo=0,e}function Mo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function No(e){if(vo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}vo=!1}mo=0,_o=go=ho=null,yo=!1,So=xo=0,Co=null}function Po(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return _o===null?ho.memoizedState=_o=e:_o=_o.next=e,_o}function Fo(){if(go===null){var e=ho.alternate;e=e===null?null:e.memoizedState}else e=go.next;var t=_o===null?ho.memoizedState:_o.next;if(t!==null)_o=t,go=e;else{if(e===null)throw ho.alternate===null?Error(a(467)):Error(a(310));go=e,e={memoizedState:go.memoizedState,baseState:go.baseState,baseQueue:go.baseQueue,queue:go.queue,next:null},_o===null?ho.memoizedState=_o=e:_o=_o.next=e}return _o}function Io(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Lo(e){var t=So;return So+=1,Co===null&&(Co=[]),e=Oa(Co,e,t),t=ho,(_o===null?t.memoizedState:_o.next)===null&&(t=t.alternate,F.H=t===null||t.memoizedState===null?Ws:Gs),e}function Ro(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Lo(e);if(e.$$typeof===C)return na(e)}throw Error(a(438,String(e)))}function zo(e){var t=null,n=ho.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=ho.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Io(),ho.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=A;return t.index++,n}function Bo(e,t){return typeof t==`function`?t(e):t}function Vo(e){return Ho(Fo(),go,e)}function Ho(e,t,n){var r=e.queue;if(r===null)throw Error(a(311));r.lastRenderedReducer=n;var i=e.baseQueue,o=r.pending;if(o!==null){if(i!==null){var s=i.next;i.next=o.next,o.next=s}t.baseQueue=i=o,r.pending=null}if(o=e.baseState,i===null)e.memoizedState=o;else{t=i.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(mo&f)===f:(Yl&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===pa&&(d=!0);else if((mo&p)===p){u=u.next,p===pa&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,ho.lanes|=p,ru|=p;f=u.action,bo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,ho.lanes|=f,ru|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Sr(o,e.memoizedState)&&(cc=!0,d&&(n=ma,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return i===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Uo(e){var t=Fo(),n=t.queue;if(n===null)throw Error(a(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,o=t.memoizedState;if(i!==null){n.pending=null;var s=i=i.next;do o=e(o,s.action),s=s.next;while(s!==i);Sr(o,t.memoizedState)||(cc=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Wo(e,t,n){var r=ho,i=Fo(),o=Fi;if(o){if(n===void 0)throw Error(a(407));n=n()}else n=t();var s=!Sr((go||i).memoizedState,n);if(s&&(i.memoizedState=n,cc=!0),i=i.queue,hs(qo.bind(null,r,i,e),[e]),i.getSnapshot!==t||s||_o!==null&&_o.memoizedState.tag&1){if(r.flags|=2048,us(9,{destroy:void 0},Ko.bind(null,r,i,n,t),null),ql===null)throw Error(a(349));o||mo&127||Go(r,t,n)}return n}function Go(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=ho.updateQueue,t===null?(t=Io(),ho.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ko(e,t,n,r){t.value=n,t.getSnapshot=r,Jo(t)&&Yo(e)}function qo(e,t,n){return n(function(){Jo(t)&&Yo(e)})}function Jo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Sr(e,n)}catch{return!0}}function Yo(e){var t=ri(e,2);t!==null&&Du(t,e,2)}function Xo(e){var t=Po();if(typeof e==`function`){var n=e;if(e=n(),bo){Ie(!0);try{n()}finally{Ie(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bo,lastRenderedState:e},t}function Zo(e,t,n,r){return e.baseState=n,Ho(e,go,typeof r==`function`?r:Bo)}function Qo(e,t,n,r,i){if(Bs(e))throw Error(a(485));if(e=t.action,e!==null){var o={payload:i,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};F.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,$o(t,o)):(o.next=n.next,t.pending=n.next=o)}}function $o(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=F.T,o={};F.T=o;try{var s=n(i,r),c=F.S;c!==null&&c(o,s),es(e,t,s)}catch(n){ns(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),F.T=a}}else try{a=n(i,r),es(e,t,a)}catch(n){ns(e,t,n)}}function es(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){ts(e,t,n)},function(n){return ns(e,t,n)}):ts(e,t,n)}function ts(e,t,n){t.status=`fulfilled`,t.value=n,rs(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,$o(e,n)))}function ns(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,rs(t),t=t.next;while(t!==r)}e.action=null}function rs(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function is(e,t){return t}function as(e,t){if(Fi){var n=ql.formState;if(n!==null){a:{var r=ho;if(Fi){if(Pi){b:{for(var i=Pi,a=Li;i.nodeType!==8;){if(!a){i=null;break b}if(i=Cf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Pi=Cf(i.nextSibling),r=i.data===`F!`;break a}}zi(r)}r=!1}r&&(t=n[0])}}return n=Po(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:is,lastRenderedState:t},n.queue=r,n=Ls.bind(null,ho,r),r.dispatch=n,r=Xo(!1),a=zs.bind(null,ho,!1,r.queue),r=Po(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Qo.bind(null,ho,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function os(e){return ss(Fo(),go,e)}function ss(e,t,n){if(t=Ho(e,t,is)[0],e=Vo(Bo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Lo(t)}catch(e){throw e===Ca?Ta:e}else r=t;t=Fo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(ho.flags|=2048,us(9,{destroy:void 0},cs.bind(null,i,n),null)),[r,a,e]}function cs(e,t){e.action=t}function ls(e){var t=Fo(),n=go;if(n!==null)return ss(t,n,e);Fo(),t=t.memoizedState,n=Fo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function us(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=ho.updateQueue,t===null&&(t=Io(),ho.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ds(){return Fo().memoizedState}function fs(e,t,n,r){var i=Po();ho.flags|=e,i.memoizedState=us(1|t,{destroy:void 0},n,r===void 0?null:r)}function ps(e,t,n,r){var i=Fo();r=r===void 0?null:r;var a=i.memoizedState.inst;go!==null&&r!==null&&Eo(r,go.memoizedState.deps)?i.memoizedState=us(t,a,n,r):(ho.flags|=e,i.memoizedState=us(1|t,a,n,r))}function ms(e,t){fs(8390656,8,e,t)}function hs(e,t){ps(2048,8,e,t)}function gs(e){ho.flags|=4;var t=ho.updateQueue;if(t===null)t=Io(),ho.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function _s(e){var t=Fo().memoizedState;return gs({ref:t,nextImpl:e}),function(){if(Kl&2)throw Error(a(440));return t.impl.apply(void 0,arguments)}}function vs(e,t){return ps(4,2,e,t)}function ys(e,t){return ps(4,4,e,t)}function bs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function xs(e,t,n){n=n==null?null:n.concat([e]),ps(4,4,bs.bind(null,t,e),n)}function Ss(){}function Cs(e,t){var n=Fo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Eo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ws(e,t){var n=Fo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Eo(t,r[1]))return r[0];if(r=e(),bo){Ie(!0);try{e()}finally{Ie(!1)}}return n.memoizedState=[r,t],r}function Ts(e,t,n){return n===void 0||mo&1073741824&&!(Yl&261930)?e.memoizedState=t:(e.memoizedState=n,e=Eu(),ho.lanes|=e,ru|=e,n)}function Es(e,t,n,r){return Sr(n,t)?n:$a.current===null?!(mo&42)||mo&1073741824&&!(Yl&261930)?(cc=!0,e.memoizedState=n):(e=Eu(),ho.lanes|=e,ru|=e,t):(e=Ts(e,n,r),Sr(e,t)||(cc=!0),e)}function Ds(e,t,n,r,i){var a=te.p;te.p=a!==0&&8>a?a:8;var o=F.T,s={};F.T=s,zs(e,!1,t,n);try{var c=i(),l=F.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Rs(e,t,_a(c,r),Tu(e)):Rs(e,t,r,Tu(e))}catch(n){Rs(e,t,{then:function(){},status:`rejected`,reason:n},Tu())}finally{te.p=a,o!==null&&s.types!==null&&(o.types=s.types),F.T=o}}function Os(){}function ks(e,t,n,r){if(e.tag!==5)throw Error(a(476));var i=As(e).queue;Ds(e,i,t,ne,n===null?Os:function(){return js(e),n(r)})}function As(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bo,lastRenderedState:ne},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function js(e){var t=As(e);t.next===null&&(t=e.alternate.memoizedState),Rs(e,t.next.queue,{},Tu())}function Ms(){return na(pp)}function Ns(){return Fo().memoizedState}function Ps(){return Fo().memoizedState}function Fs(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Tu();e=Wa(n);var r=Ga(t,e,n);r!==null&&(Du(r,t,n),Ka(r,t,n)),t={cache:la()},e.payload=t;return}t=t.return}}function Is(e,t,n){var r=Tu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Bs(e)?Vs(t,n):(n=ni(e,t,n,r),n!==null&&(Du(n,e,r),Hs(n,t,r)))}function Ls(e,t,n){Rs(e,t,n,Tu())}function Rs(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Bs(e))Vs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Sr(s,o))return ti(e,t,i,0),ql===null&&ei(),!1}catch{}if(n=ni(e,t,i,r),n!==null)return Du(n,e,r),Hs(n,t,r),!0}return!1}function zs(e,t,n,r){if(r={lane:2,revertLane:wd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Bs(e)){if(t)throw Error(a(479))}else t=ni(e,n,r,2),t!==null&&Du(t,e,2)}function Bs(e){var t=e.alternate;return e===ho||t!==null&&t===ho}function Vs(e,t){yo=vo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Hs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$e(e,n)}}var Us={readContext:na,use:Ro,useCallback:To,useContext:To,useEffect:To,useImperativeHandle:To,useLayoutEffect:To,useInsertionEffect:To,useMemo:To,useReducer:To,useRef:To,useState:To,useDebugValue:To,useDeferredValue:To,useTransition:To,useSyncExternalStore:To,useId:To,useHostTransitionStatus:To,useFormState:To,useActionState:To,useOptimistic:To,useMemoCache:To,useCacheRefresh:To};Us.useEffectEvent=To;var Ws={readContext:na,use:Ro,useCallback:function(e,t){return Po().memoizedState=[e,t===void 0?null:t],e},useContext:na,useEffect:ms,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),fs(4194308,4,bs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return fs(4194308,4,e,t)},useInsertionEffect:function(e,t){fs(4,2,e,t)},useMemo:function(e,t){var n=Po();t=t===void 0?null:t;var r=e();if(bo){Ie(!0);try{e()}finally{Ie(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Po();if(n!==void 0){var i=n(t);if(bo){Ie(!0);try{n(t)}finally{Ie(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Is.bind(null,ho,e),[r.memoizedState,e]},useRef:function(e){var t=Po();return e={current:e},t.memoizedState=e},useState:function(e){e=Xo(e);var t=e.queue,n=Ls.bind(null,ho,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Ss,useDeferredValue:function(e,t){return Ts(Po(),e,t)},useTransition:function(){var e=Xo(!1);return e=Ds.bind(null,ho,e.queue,!0,!1),Po().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=ho,i=Po();if(Fi){if(n===void 0)throw Error(a(407));n=n()}else{if(n=t(),ql===null)throw Error(a(349));Yl&127||Go(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,ms(qo.bind(null,r,o,e),[e]),r.flags|=2048,us(9,{destroy:void 0},Ko.bind(null,r,o,n,t),null),n},useId:function(){var e=Po(),t=ql.identifierPrefix;if(Fi){var n=Di,r=Ei;n=(r&~(1<<32-Le(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=xo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=wo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Ms,useFormState:as,useActionState:as,useOptimistic:function(e){var t=Po();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=zs.bind(null,ho,!0,n),n.dispatch=t,[e,t]},useMemoCache:zo,useCacheRefresh:function(){return Po().memoizedState=Fs.bind(null,ho)},useEffectEvent:function(e){var t=Po(),n={impl:e};return t.memoizedState=n,function(){if(Kl&2)throw Error(a(440));return n.impl.apply(void 0,arguments)}}},Gs={readContext:na,use:Ro,useCallback:Cs,useContext:na,useEffect:hs,useImperativeHandle:xs,useInsertionEffect:vs,useLayoutEffect:ys,useMemo:ws,useReducer:Vo,useRef:ds,useState:function(){return Vo(Bo)},useDebugValue:Ss,useDeferredValue:function(e,t){return Es(Fo(),go.memoizedState,e,t)},useTransition:function(){var e=Vo(Bo)[0],t=Fo().memoizedState;return[typeof e==`boolean`?e:Lo(e),t]},useSyncExternalStore:Wo,useId:Ns,useHostTransitionStatus:Ms,useFormState:os,useActionState:os,useOptimistic:function(e,t){return Zo(Fo(),go,e,t)},useMemoCache:zo,useCacheRefresh:Ps};Gs.useEffectEvent=_s;var Ks={readContext:na,use:Ro,useCallback:Cs,useContext:na,useEffect:hs,useImperativeHandle:xs,useInsertionEffect:vs,useLayoutEffect:ys,useMemo:ws,useReducer:Uo,useRef:ds,useState:function(){return Uo(Bo)},useDebugValue:Ss,useDeferredValue:function(e,t){var n=Fo();return go===null?Ts(n,e,t):Es(n,go.memoizedState,e,t)},useTransition:function(){var e=Uo(Bo)[0],t=Fo().memoizedState;return[typeof e==`boolean`?e:Lo(e),t]},useSyncExternalStore:Wo,useId:Ns,useHostTransitionStatus:Ms,useFormState:ls,useActionState:ls,useOptimistic:function(e,t){var n=Fo();return go===null?(n.baseState=e,[e,n.queue.dispatch]):Zo(n,go,e,t)},useMemoCache:zo,useCacheRefresh:Ps};Ks.useEffectEvent=_s;function qs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:h({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Js={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Tu(),i=Wa(r);i.payload=t,n!=null&&(i.callback=n),t=Ga(e,i,r),t!==null&&(Du(t,e,r),Ka(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Tu(),i=Wa(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ga(e,i,r),t!==null&&(Du(t,e,r),Ka(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Tu(),r=Wa(n);r.tag=2,t!=null&&(r.callback=t),t=Ga(e,r,n),t!==null&&(Du(t,e,n),Ka(t,e,n))}};function Ys(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Cr(n,r)||!Cr(i,a):!0}function Xs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Js.enqueueReplaceState(t,t.state,null)}function Zs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=h({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Qs(e){Xr(e)}function $s(e){console.error(e)}function ec(e){Xr(e)}function tc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function nc(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function rc(e,t,n){return n=Wa(n),n.tag=3,n.payload={element:null},n.callback=function(){tc(e,t)},n}function ic(e){return e=Wa(e),e.tag=3,e}function ac(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){nc(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){nc(t,n,r),typeof i!=`function`&&(hu===null?hu=new Set([this]):hu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function oc(e,t,n,r,i){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&$i(t,n,i,!0),n=io.current,n!==null){switch(n.tag){case 31:case 13:return ao===null?zu():n.alternate===null&&nu===0&&(nu=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===Ea?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),id(e,r,i)),!1;case 22:return n.flags|=65536,r===Ea?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),id(e,r,i)),!1}throw Error(a(435,n.tag))}return id(e,r,i),zu(),!1}if(Fi)return t=io.current,t===null?(r!==Ri&&(t=Error(a(423),{cause:r}),Gi(vi(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=vi(r,n),i=rc(e.stateNode,r,i),qa(e,i),nu!==4&&(nu=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==Ri&&(e=Error(a(422),{cause:r}),Gi(vi(e,n)))),!1;var o=Error(a(520),{cause:r});if(o=vi(o,n),cu===null?cu=[o]:cu.push(o),nu!==4&&(nu=2),t===null)return!0;r=vi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=rc(n.stateNode,r,e),qa(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(hu===null||!hu.has(o))))return n.flags|=65536,i&=-i,n.lanes|=i,i=ic(i),ac(i,e,n,r),qa(n,i),!1}n=n.return}while(n!==null);return!1}var sc=Error(a(461)),cc=!1;function lc(e,t,n,r){t.child=e===null?Ba(t,null,n,r):za(t,e.child,n,r)}function uc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return ta(t),r=Do(e,t,n,o,a,i),s=jo(),e!==null&&!cc?(Mo(e,t,i),Pc(e,t,i)):(Fi&&s&&Ai(t),t.flags|=1,lc(e,t,r,i),t.child)}function dc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!li(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,fc(e,t,a,r,i)):(e=fi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Fc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Cr:n,n(o,r)&&e.ref===t.ref)return Pc(e,t,i)}return t.flags|=1,e=ui(a,r),e.ref=t.ref,e.return=t,t.child=e}function fc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Cr(a,r)&&e.ref===t.ref){if(cc=!1,t.pendingProps=r=a,Fc(e,i))e.flags&131072&&(cc=!0);else return t.lanes=e.lanes,Pc(e,t,i)}}return bc(e,t,n,r,i)}function pc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return hc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&xa(t,a===null?null:a.cachePool),a===null?no():to(t,a),co(t);else return r=t.lanes=536870912,hc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&xa(t,null),no(),lo(t)):(xa(t,a.cachePool),to(t,a),lo(t),t.memoizedState=null);return lc(e,t,i,n),t.child}function mc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function hc(e,t,n,r,i){var a=ba();return a=a===null?null:{parent:ca._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&xa(t,null),no(),co(t),e!==null&&$i(e,t,r,!0),t.childLanes=i,null}function gc(e,t){return t=kc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function _c(e,t,n){return za(t,e.child,null,n),e=gc(t,t.pendingProps),e.flags|=2,uo(t),t.memoizedState=null,e}function vc(e,t,n){var r=t.pendingProps,i=!!(t.flags&128);if(t.flags&=-129,e===null){if(Fi){if(r.mode===`hidden`)return e=gc(t,r),t.lanes=536870912,mc(null,e);if(so(t),(e=Pi)?(e=yf(e,Li),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ti===null?null:{id:Ei,overflow:Di},retryLane:536870912,hydrationErrors:null},n=hi(e),n.return=t,t.child=n,Ni=t,Pi=null)):e=null,e===null)throw zi(t);return t.lanes=536870912,null}return gc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(so(t),i){if(t.flags&256)t.flags&=-257,t=_c(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(a(558))}else if(cc||$i(e,t,n,!1),i=(n&e.childLanes)!==0,cc||i){if(r=ql,r!==null&&(s=et(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,ri(e,s),Du(r,e,s),sc;zu(),t=_c(e,t,n)}else e=o.treeContext,Pi=Cf(s.nextSibling),Ni=t,Fi=!0,Ii=null,Li=!1,e!==null&&Mi(t,e),t=gc(t,r),t.flags|=4096;return t}return e=ui(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function yc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(a(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function bc(e,t,n,r,i){return ta(t),n=Do(e,t,n,r,void 0,i),r=jo(),e!==null&&!cc?(Mo(e,t,i),Pc(e,t,i)):(Fi&&r&&Ai(t),t.flags|=1,lc(e,t,n,i),t.child)}function xc(e,t,n,r,i,a){return ta(t),t.updateQueue=null,n=ko(t,r,n,i),Oo(e),r=jo(),e!==null&&!cc?(Mo(e,t,a),Pc(e,t,a)):(Fi&&r&&Ai(t),t.flags|=1,lc(e,t,n,a),t.child)}function Sc(e,t,n,r,i){if(ta(t),t.stateNode===null){var a=oi,o=n.contextType;typeof o==`object`&&o&&(a=na(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Js,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Ha(t),o=n.contextType,a.context=typeof o==`object`&&o?na(o):oi,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(qs(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Js.enqueueReplaceState(a,a.state,null),Xa(t,r,a,i),Ya(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Zs(n,s);a.props=c;var l=a.context,u=n.contextType;o=oi,typeof u==`object`&&u&&(o=na(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Xs(t,a,r,o),Va=!1;var f=t.memoizedState;a.state=f,Xa(t,r,a,i),Ya(),l=t.memoizedState,s||f!==l||Va?(typeof d==`function`&&(qs(t,n,d,r),l=t.memoizedState),(c=Va||Ys(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Ua(e,t),o=t.memoizedProps,u=Zs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=oi,typeof l==`object`&&l&&(c=na(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Xs(t,a,r,c),Va=!1,f=t.memoizedState,a.state=f,Xa(t,r,a,i),Ya();var p=t.memoizedState;o!==d||f!==p||Va||e!==null&&e.dependencies!==null&&ea(e.dependencies)?(typeof s==`function`&&(qs(t,n,s,r),p=t.memoizedState),(u=Va||Ys(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&ea(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,yc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=za(t,e.child,null,i),t.child=za(t,null,n,i)):lc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Pc(e,t,i),e}function Cc(e,t,n,r){return Ui(),t.flags|=256,lc(e,t,n,r),t.child}var wc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Tc(e){return{baseLanes:e,cachePool:Sa()}}function Ec(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=ou),e}function Dc(e,t,n){var r=t.pendingProps,i=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(fo.current&2)),s&&(i=!0,t.flags&=-129),s=!!(t.flags&32),t.flags&=-33,e===null){if(Fi){if(i?oo(t):lo(t),(e=Pi)?(e=yf(e,Li),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ti===null?null:{id:Ei,overflow:Di},retryLane:536870912,hydrationErrors:null},n=hi(e),n.return=t,t.child=n,Ni=t,Pi=null)):e=null,e===null)throw zi(t);return xf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,i?(lo(t),i=t.mode,c=kc({mode:`hidden`,children:c},i),r=pi(r,i,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=Tc(n),r.childLanes=Ec(e,s,n),t.memoizedState=wc,mc(null,r)):(oo(t),Oc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(oo(t),t.flags&=-257,t=Ac(e,t,n)):t.memoizedState===null?(lo(t),c=r.fallback,i=t.mode,r=kc({mode:`visible`,children:r.children},i),c=pi(c,i,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,za(t,e.child,null,n),r=t.child,r.memoizedState=Tc(n),r.childLanes=Ec(e,s,n),t.memoizedState=wc,t=mc(null,r)):(lo(t),t.child=e.child,t.flags|=128,t=null);else if(oo(t),xf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(a(419)),r.stack=``,r.digest=s,Gi({value:r,source:null,stack:null}),t=Ac(e,t,n)}else if(cc||$i(e,t,n,!1),s=(n&e.childLanes)!==0,cc||s){if(s=ql,s!==null&&(r=et(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ri(e,r),Du(s,e,r),sc;bf(c)||zu(),t=Ac(e,t,n)}else bf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Pi=Cf(c.nextSibling),Ni=t,Fi=!0,Ii=null,Li=!1,e!==null&&Mi(t,e),t=Oc(t,r.children),t.flags|=4096);return t}return i?(lo(t),c=r.fallback,i=t.mode,l=e.child,u=l.sibling,r=ui(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=pi(c,i,n,null),c.flags|=2):c=ui(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,mc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=Tc(n):(i=c.cachePool,i===null?i=Sa():(l=ca._currentValue,i=i.parent===l?i:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:i}),r.memoizedState=c,r.childLanes=Ec(e,s,n),t.memoizedState=wc,mc(e.child,r)):(oo(t),n=e.child,e=n.sibling,n=ui(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function Oc(e,t){return t=kc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function kc(e,t){return e=ci(22,e,null,t),e.lanes=0,e}function Ac(e,t,n){return za(t,e.child,null,n),e=Oc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function jc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Zi(e.return,t,n)}function Mc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function Nc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=fo.current,s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,I(fo,o),lc(e,t,r,n),r=Fi?Si:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&jc(e,n,t);else if(e.tag===19)jc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&po(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Mc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&po(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Mc(t,!0,n,null,a,r);break;case`together`:Mc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Pc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ru|=t.lanes,(n&t.childLanes)===0){if(e!==null){if($i(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(a(153));if(t.child!==null){for(e=t.child,n=ui(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ui(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Fc(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&ea(e)))}function Ic(e,t,n){switch(t.tag){case 3:le(t,t.stateNode.containerInfo),Yi(t,ca,e.memoizedState.cache),Ui();break;case 27:case 5:de(t);break;case 4:le(t,t.stateNode.containerInfo);break;case 10:Yi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,so(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(oo(t),e=Pc(e,t,n),e===null?null:e.sibling):Dc(e,t,n):(oo(t),t.flags|=128,null);oo(t);break;case 19:var i=!!(e.flags&128);if(r=(n&t.childLanes)!==0,r||=($i(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Nc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),I(fo,fo.current),r)break;return null;case 22:return t.lanes=0,pc(e,t,n,t.pendingProps);case 24:Yi(t,ca,e.memoizedState.cache)}return Pc(e,t,n)}function Lc(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)cc=!0;else{if(!Fc(e,n)&&!(t.flags&128))return cc=!1,Ic(e,t,n);cc=!!(e.flags&131072)}}else cc=!1,Fi&&t.flags&1048576&&ki(t,Si,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=ka(t.elementType),t.type=e,typeof e==`function`)li(e)?(r=Zs(e,r),t.tag=1,t=Sc(null,t,e,r,n)):(t.tag=0,t=bc(null,t,e,r,n));else{if(e!=null){var i=e.$$typeof;if(i===w){t.tag=11,t=uc(null,t,e,r,n);break a}if(i===D){t.tag=14,t=dc(null,t,e,r,n);break a}}throw t=P(e)||e,Error(a(306,t,``))}}return t;case 0:return bc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,i=Zs(r,t.pendingProps),Sc(e,t,r,i,n);case 3:a:{if(le(t,t.stateNode.containerInfo),e===null)throw Error(a(387));r=t.pendingProps;var o=t.memoizedState;i=o.element,Ua(e,t),Xa(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Yi(t,ca,r),r!==o.cache&&Qi(t,[ca],n,!0),Ya(),r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=Cc(e,t,r,n);break a}if(r!==i){i=vi(Error(a(424)),t),Gi(i),t=Cc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Pi=Cf(e.firstChild),Ni=t,Fi=!0,Ii=null,Li=!0,n=Ba(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ui(),r===i){t=Pc(e,t,n);break a}lc(e,t,r,n)}t=t.child}return t;case 26:return yc(e,t),e===null?(n=Wf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Fi||(n=t.type,e=t.pendingProps,r=tf(R.current).createElement(n),r[ot]=t,r[st]=e,Yd(r,n,e),yt(r),t.stateNode=r):t.memoizedState=Wf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return de(t),e===null&&Fi&&(r=t.stateNode=Df(t.type,t.pendingProps,R.current),Ni=t,Li=!0,i=Pi,pf(t.type)?(wf=i,Pi=Cf(r.firstChild)):Pi=i),lc(e,t,t.pendingProps.children,n),yc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Fi&&((i=r=Pi)&&(r=_f(r,t.type,t.pendingProps,Li),r===null?i=!1:(t.stateNode=r,Ni=t,Pi=Cf(r.firstChild),Li=!1,i=!0)),i||zi(t)),de(t),i=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,af(i,o)?r=null:s!==null&&af(i,s)&&(t.flags|=32),t.memoizedState!==null&&(i=Do(e,t,Ao,null,null,n),pp._currentValue=i),yc(e,t),lc(e,t,r,n),t.child;case 6:return e===null&&Fi&&((e=n=Pi)&&(n=vf(n,t.pendingProps,Li),n===null?e=!1:(t.stateNode=n,Ni=t,Pi=null,e=!0)),e||zi(t)),null;case 13:return Dc(e,t,n);case 4:return le(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=za(t,null,r,n):lc(e,t,r,n),t.child;case 11:return uc(e,t,t.type,t.pendingProps,n);case 7:return lc(e,t,t.pendingProps,n),t.child;case 8:return lc(e,t,t.pendingProps.children,n),t.child;case 12:return lc(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Yi(t,t.type,r.value),lc(e,t,r.children,n),t.child;case 9:return i=t.type._context,r=t.pendingProps.children,ta(t),i=na(i),r=r(i),t.flags|=1,lc(e,t,r,n),t.child;case 14:return dc(e,t,t.type,t.pendingProps,n);case 15:return fc(e,t,t.type,t.pendingProps,n);case 19:return Nc(e,t,n);case 31:return vc(e,t,n);case 22:return pc(e,t,n,t.pendingProps);case 24:return ta(t),r=na(ca),e===null?(i=ba(),i===null&&(i=ql,o=la(),i.pooledCache=o,o.refCount++,o!==null&&(i.pooledCacheLanes|=n),i=o),t.memoizedState={parent:r,cache:i},Ha(t),Yi(t,ca,i)):((e.lanes&n)!==0&&(Ua(e,t),Xa(t,null,null,n),Ya()),i=e.memoizedState,o=t.memoizedState,i.parent===r?(r=o.cache,Yi(t,ca,r),r!==i.cache&&Qi(t,[ca],n,!0)):(i={parent:r,cache:r},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),Yi(t,ca,r))),lc(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(a(156,t.tag))}function Rc(e){e.flags|=4}function zc(e,t,n,r,i){if((t=!!(e.mode&32))&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Iu())e.flags|=8192;else throw Aa=Ea,wa}}else e.flags&=-16777217}function Bc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!ap(t)){if(Iu())e.flags|=8192;else throw Aa=Ea,wa}}function Vc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Je(),e.lanes|=t,su|=t)}function Hc(e,t){if(!Fi)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Uc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Wc(e,t,n){var r=t.pendingProps;switch(ji(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Uc(t),null;case 1:return Uc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Xi(ca),ue(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Hi(t)?Rc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Wi())),Uc(t),null;case 26:var i=t.type,o=t.memoizedState;return e===null?(Rc(t),o===null?(Uc(t),zc(t,i,null,r,n)):(Uc(t),Bc(t,o))):o?o===e.memoizedState?(Uc(t),t.flags&=-16777217):(Rc(t),Uc(t),Bc(t,o)):(e=e.memoizedProps,e!==r&&Rc(t),Uc(t),zc(t,i,e,r,n)),null;case 27:if(fe(t),n=R.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Rc(t);else{if(!r){if(t.stateNode===null)throw Error(a(166));return Uc(t),null}e=L.current,Hi(t)?Bi(t,e):(e=Df(i,r,n),t.stateNode=e,Rc(t))}return Uc(t),null;case 5:if(fe(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Rc(t);else{if(!r){if(t.stateNode===null)throw Error(a(166));return Uc(t),null}if(o=L.current,Hi(t))Bi(t,o);else{var s=tf(R.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;default:switch(i){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(i,{is:r.is}):s.createElement(i)}}o[ot]=t,o[st]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Yd(o,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Rc(t)}}return Uc(t),zc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Rc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(a(166));if(e=R.current,Hi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=Ni,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[ot]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Kd(e.nodeValue,n)),e||zi(t,!0)}else e=tf(e).createTextNode(r),e[ot]=t,t.stateNode=e}return Uc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Hi(t),n!==null){if(e===null){if(!r)throw Error(a(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(557));e[ot]=t}else Ui(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Uc(t),e=!1}else n=Wi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(uo(t),t):(uo(t),null);if(t.flags&128)throw Error(a(558))}return Uc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Hi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(a(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(a(317));i[ot]=t}else Ui(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Uc(t),i=!1}else i=Wi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(uo(t),t):(uo(t),null)}return uo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Vc(t,t.updateQueue),Uc(t),null);case 4:return ue(),e===null&&Id(t.stateNode.containerInfo),Uc(t),null;case 10:return Xi(t.type),Uc(t),null;case 19:if(oe(fo),r=t.memoizedState,r===null)return Uc(t),null;if(i=!!(t.flags&128),o=r.rendering,o===null){if(i)Hc(r,!1);else{if(nu!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=po(e),o!==null){for(t.flags|=128,Hc(r,!1),e=o.updateQueue,t.updateQueue=e,Vc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)di(n,e),n=n.sibling;return I(fo,fo.current&1|2),Fi&&Oi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Te()>pu&&(t.flags|=128,i=!0,Hc(r,!1),t.lanes=4194304)}}else{if(!i){if(e=po(o),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Vc(t,e),Hc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Fi)return Uc(t),null}else 2*Te()-r.renderingStartTime>pu&&n!==536870912&&(t.flags|=128,i=!0,Hc(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Uc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Te(),e.sibling=null,n=fo.current,I(fo,i?n&1|2:n&1),Fi&&Oi(t,r.treeForkCount),e);case 22:case 23:return uo(t),ro(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Uc(t),t.subtreeFlags&6&&(t.flags|=8192)):Uc(t),n=t.updateQueue,n!==null&&Vc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&oe(ya),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Xi(ca),Uc(t),null;case 25:return null;case 30:return null}throw Error(a(156,t.tag))}function Gc(e,t){switch(ji(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Xi(ca),ue(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return fe(t),null;case 31:if(t.memoizedState!==null){if(uo(t),t.alternate===null)throw Error(a(340));Ui()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(uo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));Ui()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return oe(fo),null;case 4:return ue(),null;case 10:return Xi(t.type),null;case 22:case 23:return uo(t),ro(),e!==null&&oe(ya),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Xi(ca),null;case 25:return null;default:return null}}function Kc(e,t){switch(ji(t),t.tag){case 3:Xi(ca),ue();break;case 26:case 27:case 5:fe(t);break;case 4:ue();break;case 31:t.memoizedState!==null&&uo(t);break;case 13:uo(t);break;case 19:oe(fo);break;case 10:Xi(t.type);break;case 22:case 23:uo(t),ro(),e!==null&&oe(ya);break;case 24:Xi(ca)}}function qc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){rd(t,t.return,e)}}function Jc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){rd(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){rd(t,t.return,e)}}function Yc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Qa(t,n)}catch(t){rd(e,e.return,t)}}}function Xc(e,t,n){n.props=Zs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){rd(e,t,n)}}function Zc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){rd(e,t,n)}}function Qc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){rd(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){rd(e,t,n)}else n.current=null}}function $c(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){rd(e,e.return,t)}}function el(e,t,n){try{var r=e.stateNode;Xd(r,e.type,n,t),r[st]=t}catch(t){rd(e,e.return,t)}}function tl(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&pf(e.type)||e.tag===4}function nl(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||tl(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&pf(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function rl(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=$t));else if(r!==4&&(r===27&&pf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(rl(e,t,n),e=e.sibling;e!==null;)rl(e,t,n),e=e.sibling}function il(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&pf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(il(e,t,n),e=e.sibling;e!==null;)il(e,t,n),e=e.sibling}function al(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Yd(t,r,n),t[ot]=e,t[st]=n}catch(t){rd(e,e.return,t)}}var ol=!1,sl=!1,cl=!1,ll=typeof WeakSet==`function`?WeakSet:Set,ul=null;function dl(e,t){if(e=e.containerInfo,$d=Sp,e=Dr(e),Or(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||i!==0&&f.nodeType!==3||(c=s+i),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===i&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(ef={focusedElem:e,selectionRange:n},Sp=!1,ul=t;ul!==null;)if(t=ul,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,ul=e;else for(;ul!==null;){switch(t=ul,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)i=e[n],i.ref.impl=i.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,i=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Zs(n.type,i);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){rd(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)gf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:gf(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(a(163))}if(e=t.sibling,e!==null){e.return=t.return,ul=e;break}ul=t.return}}function fl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Dl(e,n),r&4&&qc(5,n);break;case 1:if(Dl(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){rd(n,n.return,e)}else{var i=Zs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){rd(n,n.return,e)}}}r&64&&Yc(n),r&512&&Zc(n,n.return);break;case 3:if(Dl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Qa(e,t)}catch(e){rd(n,n.return,e)}}break;case 27:t===null&&r&4&&al(n);case 26:case 5:Dl(e,n),t===null&&r&4&&$c(n),r&512&&Zc(n,n.return);break;case 12:Dl(e,n);break;case 31:Dl(e,n),r&4&&vl(e,n);break;case 13:Dl(e,n),r&4&&yl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=sd.bind(null,n),Sf(e,n))));break;case 22:if(r=n.memoizedState!==null||ol,!r){t=t!==null&&t.memoizedState!==null||sl,i=ol;var a=sl;ol=r,(sl=t)&&!a?kl(e,n,!!(n.subtreeFlags&8772)):Dl(e,n),ol=i,sl=a}break;case 30:break;default:Dl(e,n)}}function pl(e){var t=e.alternate;t!==null&&(e.alternate=null,pl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&mt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var ml=null,hl=!1;function gl(e,t,n){for(n=n.child;n!==null;)_l(e,t,n),n=n.sibling}function _l(e,t,n){if(Fe&&typeof Fe.onCommitFiberUnmount==`function`)try{Fe.onCommitFiberUnmount(Pe,n)}catch{}switch(n.tag){case 26:sl||Qc(n,t),gl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:sl||Qc(n,t);var r=ml,i=hl;pf(n.type)&&(ml=n.stateNode,hl=!1),gl(e,t,n),Of(n.stateNode),ml=r,hl=i;break;case 5:sl||Qc(n,t);case 6:if(r=ml,i=hl,ml=null,gl(e,t,n),ml=r,hl=i,ml!==null){if(hl)try{(ml.nodeType===9?ml.body:ml.nodeName===`HTML`?ml.ownerDocument.body:ml).removeChild(n.stateNode)}catch(e){rd(n,t,e)}else try{ml.removeChild(n.stateNode)}catch(e){rd(n,t,e)}}break;case 18:ml!==null&&(hl?(e=ml,mf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Jp(e)):mf(ml,n.stateNode));break;case 4:r=ml,i=hl,ml=n.stateNode.containerInfo,hl=!0,gl(e,t,n),ml=r,hl=i;break;case 0:case 11:case 14:case 15:Jc(2,n,t),sl||Jc(4,n,t),gl(e,t,n);break;case 1:sl||(Qc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Xc(n,t,r)),gl(e,t,n);break;case 21:gl(e,t,n);break;case 22:sl=(r=sl)||n.memoizedState!==null,gl(e,t,n),sl=r;break;default:gl(e,t,n)}}function vl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Jp(e)}catch(e){rd(t,t.return,e)}}}function yl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Jp(e)}catch(e){rd(t,t.return,e)}}function bl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new ll),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new ll),t;default:throw Error(a(435,e.tag))}}function xl(e,t){var n=bl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=cd.bind(null,e,t);t.then(r,r)}})}function Sl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(pf(c.type)){ml=c.stateNode,hl=!1;break a}break;case 5:ml=c.stateNode,hl=!1;break a;case 3:case 4:ml=c.stateNode.containerInfo,hl=!0;break a}c=c.return}if(ml===null)throw Error(a(160));_l(o,s,i),ml=null,hl=!1,o=i.alternate,o!==null&&(o.return=null),i.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)wl(t,e),t=t.sibling}var Cl=null;function wl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Sl(t,e),Tl(e),r&4&&(Jc(3,e,e.return),qc(3,e),Jc(5,e,e.return));break;case 1:Sl(t,e),Tl(e),r&512&&(sl||n===null||Qc(n,n.return)),r&64&&ol&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var i=Cl;if(Sl(t,e),Tl(e),r&512&&(sl||n===null||Qc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null){if(r===null){if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,i=i.ownerDocument||i;b:switch(r){case`title`:o=i.getElementsByTagName(`title`)[0],(!o||o[pt]||o[ot]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=i.createElement(r),i.head.insertBefore(o,i.querySelector(`head > title`))),Yd(o,r,n),o[ot]=e,yt(o),r=o;break a;case`link`:var s=np(`link`,`href`,i).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=i.createElement(r),Yd(o,r,n),i.head.appendChild(o);break;case`meta`:if(s=np(`meta`,`content`,i).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=i.createElement(r),Yd(o,r,n),i.head.appendChild(o);break;default:throw Error(a(468,r))}o[ot]=e,yt(o),r=o}e.stateNode=r}else rp(i,e.type,e.stateNode)}else e.stateNode=Zf(i,r,e.memoizedProps)}else o===r?r===null&&e.stateNode!==null&&el(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?rp(i,e.type,e.stateNode):Zf(i,r,e.memoizedProps))}break;case 27:Sl(t,e),Tl(e),r&512&&(sl||n===null||Qc(n,n.return)),n!==null&&r&4&&el(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Sl(t,e),Tl(e),r&512&&(sl||n===null||Qc(n,n.return)),e.flags&32){i=e.stateNode;try{Gt(i,``)}catch(t){rd(e,e.return,t)}}r&4&&e.stateNode!=null&&(i=e.memoizedProps,el(e,i,n===null?i:n.memoizedProps)),r&1024&&(cl=!0);break;case 6:if(Sl(t,e),Tl(e),r&4){if(e.stateNode===null)throw Error(a(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){rd(e,e.return,t)}}break;case 3:if(tp=null,i=Cl,Cl=jf(t.containerInfo),Sl(t,e),Cl=i,Tl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Jp(t.containerInfo)}catch(t){rd(e,e.return,t)}cl&&(cl=!1,El(e));break;case 4:r=Cl,Cl=jf(e.stateNode.containerInfo),Sl(t,e),Tl(e),Cl=r;break;case 12:Sl(t,e),Tl(e);break;case 31:Sl(t,e),Tl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,xl(e,r)));break;case 13:Sl(t,e),Tl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(du=Te()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,xl(e,r)));break;case 22:i=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=ol,d=sl;if(ol=u||i,sl=d||l,Sl(t,e),sl=d,ol=u,Tl(e),r&8192)a:for(t=e.stateNode,t._visibility=i?t._visibility&-2:t._visibility|1,i&&(n===null||l||ol||sl||Ol(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,i)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){rd(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=i?``:l.memoizedProps}catch(e){rd(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;i?hf(m,!0):hf(l.stateNode,!1)}catch(e){rd(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,xl(e,n))));break;case 19:Sl(t,e),Tl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,xl(e,r)));break;case 30:break;case 21:break;default:Sl(t,e),Tl(e)}}function Tl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(tl(r)){n=r;break}r=r.return}if(n==null)throw Error(a(160));switch(n.tag){case 27:var i=n.stateNode;il(e,nl(e),i);break;case 5:var o=n.stateNode;n.flags&32&&(Gt(o,``),n.flags&=-33),il(e,nl(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;rl(e,nl(e),s);break;default:throw Error(a(161))}}catch(t){rd(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function El(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;El(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Dl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)fl(e,t.alternate,t),t=t.sibling}function Ol(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Jc(4,t,t.return),Ol(t);break;case 1:Qc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Xc(t,t.return,n),Ol(t);break;case 27:Of(t.stateNode);case 26:case 5:Qc(t,t.return),Ol(t);break;case 22:t.memoizedState===null&&Ol(t);break;case 30:Ol(t);break;default:Ol(t)}e=e.sibling}}function kl(e,t,n){for(n&&=!!(t.subtreeFlags&8772),t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:kl(i,a,n),qc(4,a);break;case 1:if(kl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){rd(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Za(c[i],s)}catch(e){rd(r,r.return,e)}}n&&o&64&&Yc(a),Zc(a,a.return);break;case 27:al(a);case 26:case 5:kl(i,a,n),n&&r===null&&o&4&&$c(a),Zc(a,a.return);break;case 12:kl(i,a,n);break;case 31:kl(i,a,n),n&&o&4&&vl(i,a);break;case 13:kl(i,a,n),n&&o&4&&yl(i,a);break;case 22:a.memoizedState===null&&kl(i,a,n),Zc(a,a.return);break;case 30:break;default:kl(i,a,n)}t=t.sibling}}function Al(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&ua(n))}function jl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ua(e))}function Ml(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Nl(e,t,n,r),t=t.sibling}function Nl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Ml(e,t,n,r),i&2048&&qc(9,t);break;case 1:Ml(e,t,n,r);break;case 3:Ml(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ua(e)));break;case 12:if(i&2048){Ml(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){rd(t,t.return,e)}}else Ml(e,t,n,r);break;case 31:Ml(e,t,n,r);break;case 13:Ml(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Ml(e,t,n,r):(a._visibility|=2,Pl(e,t,n,r,!!(t.subtreeFlags&10256)||!1)):a._visibility&2?Ml(e,t,n,r):Fl(e,t),i&2048&&Al(o,t);break;case 24:Ml(e,t,n,r),i&2048&&jl(t.alternate,t);break;default:Ml(e,t,n,r)}}function Pl(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Pl(a,o,s,c,i),qc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Pl(a,o,s,c,i)):u._visibility&2?Pl(a,o,s,c,i):Fl(a,o),i&&l&2048&&Al(o.alternate,o);break;case 24:Pl(a,o,s,c,i),i&&l&2048&&jl(o.alternate,o);break;default:Pl(a,o,s,c,i)}t=t.sibling}}function Fl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Fl(n,r),i&2048&&Al(r.alternate,r);break;case 24:Fl(n,r),i&2048&&jl(r.alternate,r);break;default:Fl(n,r)}t=t.sibling}}var Il=8192;function Ll(e,t,n){if(e.subtreeFlags&Il)for(e=e.child;e!==null;)Rl(e,t,n),e=e.sibling}function Rl(e,t,n){switch(e.tag){case 26:Ll(e,t,n),e.flags&Il&&e.memoizedState!==null&&op(n,Cl,e.memoizedState,e.memoizedProps);break;case 5:Ll(e,t,n);break;case 3:case 4:var r=Cl;Cl=jf(e.stateNode.containerInfo),Ll(e,t,n),Cl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Il,Il=16777216,Ll(e,t,n),Il=r):Ll(e,t,n));break;default:Ll(e,t,n)}}function zl(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Bl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];ul=r,Ul(r,e)}zl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Vl(e),e=e.sibling}function Vl(e){switch(e.tag){case 0:case 11:case 15:Bl(e),e.flags&2048&&Jc(9,e,e.return);break;case 3:Bl(e);break;case 12:Bl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Hl(e)):Bl(e);break;default:Bl(e)}}function Hl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];ul=r,Ul(r,e)}zl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Jc(8,t,t.return),Hl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Hl(t));break;default:Hl(t)}e=e.sibling}}function Ul(e,t){for(;ul!==null;){var n=ul;switch(n.tag){case 0:case 11:case 15:Jc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:ua(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,ul=r;else a:for(n=e;ul!==null;){r=ul;var i=r.sibling,a=r.return;if(pl(r),r===n){ul=null;break a}if(i!==null){i.return=a,ul=i;break a}ul=a}}}var Wl={getCacheForType:function(e){var t=na(ca),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return na(ca).controller.signal}},Gl=typeof WeakMap==`function`?WeakMap:Map,Kl=0,ql=null,Jl=null,Yl=0,Xl=0,Zl=null,Ql=!1,$l=!1,eu=!1,tu=0,nu=0,ru=0,iu=0,au=0,ou=0,su=0,cu=null,lu=null,uu=!1,du=0,fu=0,pu=1/0,mu=null,hu=null,gu=0,_u=null,vu=null,yu=0,bu=0,xu=null,Su=null,Cu=0,wu=null;function Tu(){return Kl&2&&Yl!==0?Yl&-Yl:F.T===null?rt():wd()}function Eu(){if(ou===0){if(!(Yl&536870912)||Fi){var e=He;He<<=1,!(He&3932160)&&(He=262144),ou=e}else ou=536870912}return e=io.current,e!==null&&(e.flags|=32),ou}function Du(e,t,n){(e===ql&&(Xl===2||Xl===9)||e.cancelPendingCommit!==null)&&(Pu(e,0),ju(e,Yl,ou,!1)),Xe(e,n),(!(Kl&2)||e!==ql)&&(e===ql&&(!(Kl&2)&&(iu|=n),nu===4&&ju(e,Yl,ou,!1)),gd(e))}function Ou(e,t,n){if(Kl&6)throw Error(a(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||Ke(e,t),i=r?Hu(e,t):Bu(e,t,!0),o=r;do{if(i===0){$l&&!r&&ju(e,t,0,!1);break}if(n=e.current.alternate,o&&!Au(n)){i=Bu(e,t,!1),o=!1;continue}if(i===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;i=cu;var l=c.current.memoizedState.isDehydrated;if(l&&(Pu(c,s).flags|=256),s=Bu(c,s,!1),s!==2){if(eu&&!l){c.errorRecoveryDisabledLanes|=o,iu|=o,i=4;break a}o=lu,lu=i,o!==null&&(lu===null?lu=o:lu.push.apply(lu,o))}i=s}if(o=!1,i!==2)continue}}if(i===1){Pu(e,0),ju(e,t,0,!0);break}a:{switch(r=e,o=i,o){case 0:case 1:throw Error(a(345));case 4:if((t&4194048)!==t)break;case 6:ju(r,t,ou,!Ql);break a;case 2:lu=null;break;case 3:case 5:break;default:throw Error(a(329))}if((t&62914560)===t&&(i=du+300-Te(),10<i)){if(ju(r,t,ou,!Ql),Ge(r,0,!0)!==0)break a;yu=t,r.timeoutHandle=cf(ku.bind(null,r,n,lu,mu,uu,t,ou,iu,su,Ql,o,`Throttled`,-0,0),i);break a}ku(r,n,lu,mu,uu,t,ou,iu,su,Ql,o,null,-0,0)}break}while(1);gd(e)}function ku(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:$t},Rl(t,a,d);var m=(a&62914560)===a?du-Te():(a&4194048)===a?fu-Te():0;if(m=cp(d,m),m!==null){yu=a,e.cancelPendingCommit=m(Yu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),ju(e,a,o,!l);return}}Yu(e,t,a,n,r,i,o,s,c)}function Au(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Sr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function ju(e,t,n,r){t&=~au,t&=~iu,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Le(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Qe(e,n,t)}function Mu(){return Kl&6?!0:(_d(0,!1),!1)}function Nu(){if(Jl!==null){if(Xl===0)var e=Jl.return;else e=Jl,Ji=qi=null,No(e),Na=null,Pa=0,e=Jl;for(;e!==null;)Kc(e.alternate,e),e=e.return;Jl=null}}function Pu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,lf(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),yu=0,Nu(),ql=e,Jl=n=ui(e.current,null),Yl=t,Xl=0,Zl=null,Ql=!1,$l=Ke(e,t),eu=!1,su=ou=au=iu=ru=nu=0,lu=cu=null,uu=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Le(r),a=1<<i;t|=e[i],r&=~a}return tu=t,ei(),n}function Fu(e,t){ho=null,F.H=Us,t===Ca||t===Ta?(t=ja(),Xl=3):t===wa?(t=ja(),Xl=4):Xl=t===sc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Zl=t,Jl===null&&(nu=1,tc(e,vi(t,e.current)))}function Iu(){var e=io.current;return e===null?!0:(Yl&4194048)===Yl?ao===null:(Yl&62914560)===Yl||Yl&536870912?e===ao:!1}function Lu(){var e=F.H;return F.H=Us,e===null?Us:e}function Ru(){var e=F.A;return F.A=Wl,e}function zu(){nu=4,Ql||(Yl&4194048)!==Yl&&io.current!==null||($l=!0),!(ru&134217727)&&!(iu&134217727)||ql===null||ju(ql,Yl,ou,!1)}function Bu(e,t,n){var r=Kl;Kl|=2;var i=Lu(),a=Ru();(ql!==e||Yl!==t)&&(mu=null,Pu(e,t)),t=!1;var o=nu;a:do try{if(Xl!==0&&Jl!==null){var s=Jl,c=Zl;switch(Xl){case 8:Nu(),o=6;break a;case 3:case 2:case 9:case 6:io.current===null&&(t=!0);var l=Xl;if(Xl=0,Zl=null,Ku(e,s,c,l),n&&$l){o=0;break a}break;default:l=Xl,Xl=0,Zl=null,Ku(e,s,c,l)}}Vu(),o=nu;break}catch(t){Fu(e,t)}while(1);return t&&e.shellSuspendCounter++,Ji=qi=null,Kl=r,F.H=i,F.A=a,Jl===null&&(ql=null,Yl=0,ei()),o}function Vu(){for(;Jl!==null;)Wu(Jl)}function Hu(e,t){var n=Kl;Kl|=2;var r=Lu(),i=Ru();ql!==e||Yl!==t?(mu=null,pu=Te()+500,Pu(e,t)):$l=Ke(e,t);a:do try{if(Xl!==0&&Jl!==null){t=Jl;var o=Zl;b:switch(Xl){case 1:Xl=0,Zl=null,Ku(e,t,o,1);break;case 2:case 9:if(Da(o)){Xl=0,Zl=null,Gu(t);break}t=function(){Xl!==2&&Xl!==9||ql!==e||(Xl=7),gd(e)},o.then(t,t);break a;case 3:Xl=7;break a;case 4:Xl=5;break a;case 7:Da(o)?(Xl=0,Zl=null,Gu(t)):(Xl=0,Zl=null,Ku(e,t,o,7));break;case 5:var s=null;switch(Jl.tag){case 26:s=Jl.memoizedState;case 5:case 27:var c=Jl;if(s?ap(s):c.stateNode.complete){Xl=0,Zl=null;var l=c.sibling;if(l!==null)Jl=l;else{var u=c.return;u===null?Jl=null:(Jl=u,qu(u))}break b}}Xl=0,Zl=null,Ku(e,t,o,5);break;case 6:Xl=0,Zl=null,Ku(e,t,o,6);break;case 8:Nu(),nu=6;break a;default:throw Error(a(462))}}Uu();break}catch(t){Fu(e,t)}while(1);return Ji=qi=null,F.H=r,F.A=i,Kl=n,Jl===null?(ql=null,Yl=0,ei(),nu):0}function Uu(){for(;Jl!==null&&!Ce();)Wu(Jl)}function Wu(e){var t=Lc(e.alternate,e,tu);e.memoizedProps=e.pendingProps,t===null?qu(e):Jl=t}function Gu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=xc(n,t,t.pendingProps,t.type,void 0,Yl);break;case 11:t=xc(n,t,t.pendingProps,t.type.render,t.ref,Yl);break;case 5:No(t);default:Kc(n,t),t=Jl=di(t,tu),t=Lc(n,t,tu)}e.memoizedProps=e.pendingProps,t===null?qu(e):Jl=t}function Ku(e,t,n,r){Ji=qi=null,No(t),Na=null,Pa=0;var i=t.return;try{if(oc(e,i,t,n,Yl)){nu=1,tc(e,vi(n,e.current)),Jl=null;return}}catch(t){if(i!==null)throw Jl=i,t;nu=1,tc(e,vi(n,e.current)),Jl=null;return}t.flags&32768?(Fi||r===1?e=!0:$l||Yl&536870912?e=!1:(Ql=e=!0,(r===2||r===9||r===3||r===6)&&(r=io.current,r!==null&&r.tag===13&&(r.flags|=16384))),Ju(t,e)):qu(t)}function qu(e){var t=e;do{if(t.flags&32768){Ju(t,Ql);return}e=t.return;var n=Wc(t.alternate,t,tu);if(n!==null){Jl=n;return}if(t=t.sibling,t!==null){Jl=t;return}Jl=t=e}while(t!==null);nu===0&&(nu=5)}function Ju(e,t){do{var n=Gc(e.alternate,e);if(n!==null){n.flags&=32767,Jl=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Jl=e;return}Jl=e=n}while(e!==null);nu=6,Jl=null}function Yu(e,t,n,r,i,o,s,c,l){e.cancelPendingCommit=null;do ed();while(gu!==0);if(Kl&6)throw Error(a(327));if(t!==null){if(t===e.current)throw Error(a(177));if(o=t.lanes|t.childLanes,o|=$r,Ze(e,n,o,s,c,l),e===ql&&(Jl=ql=null,Yl=0),vu=t,_u=e,yu=n,bu=o,xu=i,Su=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,ld(ke,function(){return td(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=F.T,F.T=null,i=te.p,te.p=2,s=Kl,Kl|=4;try{dl(e,t,n)}finally{Kl=s,te.p=i,F.T=r}}gu=1,Xu(),Zu(),Qu()}}function Xu(){if(gu===1){gu=0;var e=_u,t=vu,n=!!(t.flags&13878);if(t.subtreeFlags&13878||n){n=F.T,F.T=null;var r=te.p;te.p=2;var i=Kl;Kl|=4;try{wl(t,e);var a=ef,o=Dr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Er(s.ownerDocument.documentElement,s)){if(c!==null&&Or(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Tr(s,h),v=Tr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}Sp=!!$d,ef=$d=null}finally{Kl=i,te.p=r,F.T=n}}e.current=t,gu=2}}function Zu(){if(gu===2){gu=0;var e=_u,t=vu,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=F.T,F.T=null;var r=te.p;te.p=2;var i=Kl;Kl|=4;try{fl(e,t.alternate,t)}finally{Kl=i,te.p=r,F.T=n}}gu=3}}function Qu(){if(gu===4||gu===3){gu=0,we();var e=_u,t=vu,n=yu,r=Su;t.subtreeFlags&10256||t.flags&10256?gu=5:(gu=0,vu=_u=null,$u(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(hu=null),nt(n),t=t.stateNode,Fe&&typeof Fe.onCommitFiberRoot==`function`)try{Fe.onCommitFiberRoot(Pe,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=F.T,i=te.p,te.p=2,F.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{F.T=t,te.p=i}}yu&3&&ed(),gd(e),i=e.pendingLanes,n&261930&&i&42?e===wu?Cu++:(Cu=0,wu=e):Cu=0,_d(0,!1)}}function $u(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ua(t)))}function ed(){return Xu(),Zu(),Qu(),td()}function td(){if(gu!==5)return!1;var e=_u,t=bu;bu=0;var n=nt(yu),r=F.T,i=te.p;try{te.p=32>n?32:n,F.T=null,n=xu,xu=null;var o=_u,s=yu;if(gu=0,vu=_u=null,yu=0,Kl&6)throw Error(a(331));var c=Kl;if(Kl|=4,Vl(o.current),Nl(o,o.current,s,n),Kl=c,_d(0,!1),Fe&&typeof Fe.onPostCommitFiberRoot==`function`)try{Fe.onPostCommitFiberRoot(Pe,o)}catch{}return!0}finally{te.p=i,F.T=r,$u(e,t)}}function nd(e,t,n){t=vi(n,t),t=rc(e.stateNode,t,2),e=Ga(e,t,2),e!==null&&(Xe(e,2),gd(e))}function rd(e,t,n){if(e.tag===3)nd(e,e,n);else for(;t!==null;){if(t.tag===3){nd(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(hu===null||!hu.has(r))){e=vi(n,e),n=ic(2),r=Ga(t,n,2),r!==null&&(ac(n,r,t,e),Xe(r,2),gd(r));break}}t=t.return}}function id(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Gl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(eu=!0,i.add(n),e=ad.bind(null,e,t,n),t.then(e,e))}function ad(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ql===e&&(Yl&n)===n&&(nu===4||nu===3&&(Yl&62914560)===Yl&&300>Te()-du?!(Kl&2)&&Pu(e,0):au|=n,su===Yl&&(su=0)),gd(e)}function od(e,t){t===0&&(t=Je()),e=ri(e,t),e!==null&&(Xe(e,t),gd(e))}function sd(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),od(e,n)}function cd(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(a(314))}r!==null&&r.delete(t),od(e,n)}function ld(e,t){return xe(e,t)}var ud=null,dd=null,fd=!1,pd=!1,md=!1,hd=0;function gd(e){e!==dd&&e.next===null&&(dd===null?ud=dd=e:dd=dd.next=e),pd=!0,fd||(fd=!0,Cd())}function _d(e,t){if(!md&&pd){md=!0;do for(var n=!1,r=ud;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Le(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Sd(r,a))}else a=Yl,a=Ge(r,r===ql?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ke(r,a)||(n=!0,Sd(r,a))}r=r.next}while(n);md=!1}}function vd(){yd()}function yd(){pd=fd=!1;var e=0;hd!==0&&sf()&&(e=hd);for(var t=Te(),n=null,r=ud;r!==null;){var i=r.next,a=bd(r,t);a===0?(r.next=null,n===null?ud=i:n.next=i,i===null&&(dd=n)):(n=r,(e!==0||a&3)&&(pd=!0)),r=i}gu!==0&&gu!==5||_d(e,!1),hd!==0&&(hd=0)}function bd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Le(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=qe(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=ql,n=Yl,n=Ge(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Xl===2||Xl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Se(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Ke(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Se(r),nt(n)){case 2:case 8:n=Oe;break;case 32:n=ke;break;case 268435456:n=je;break;default:n=ke}return r=xd.bind(null,e),n=xe(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Se(r),e.callbackPriority=2,e.callbackNode=null,2}function xd(e,t){if(gu!==0&&gu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(ed()&&e.callbackNode!==n)return null;var r=Yl;return r=Ge(e,e===ql?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Ou(e,r,t),bd(e,Te()),e.callbackNode!=null&&e.callbackNode===n?xd.bind(null,e):null)}function Sd(e,t){if(ed())return null;Ou(e,t,!0)}function Cd(){df(function(){Kl&6?xe(De,vd):yd()})}function wd(){if(hd===0){var e=pa;e===0&&(e=Ve,Ve<<=1,!(Ve&261888)&&(Ve=256)),hd=e}return hd}function Td(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Qt(``+e)}function Ed(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function Dd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Td((i[st]||null).action),o=r.submitter;o&&(t=(t=o[st]||null)?Td(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new xn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(hd!==0){var e=o?Ed(i,o):new FormData(i);ks(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?Ed(i,o):new FormData(i),ks(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Od=0;Od<Jr.length;Od++){var kd=Jr[Od];Yr(kd.toLowerCase(),`on`+(kd[0].toUpperCase()+kd.slice(1)))}Yr(Br,`onAnimationEnd`),Yr(Vr,`onAnimationIteration`),Yr(Hr,`onAnimationStart`),Yr(`dblclick`,`onDoubleClick`),Yr(`focusin`,`onFocus`),Yr(`focusout`,`onBlur`),Yr(Ur,`onTransitionRun`),Yr(Wr,`onTransitionStart`),Yr(Gr,`onTransitionCancel`),Yr(Kr,`onTransitionEnd`),Ct(`onMouseEnter`,[`mouseout`,`mouseover`]),Ct(`onMouseLeave`,[`mouseout`,`mouseover`]),Ct(`onPointerEnter`,[`pointerout`,`pointerover`]),Ct(`onPointerLeave`,[`pointerout`,`pointerover`]),St(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),St(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),St(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),St(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),St(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),St(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Ad=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),jd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Ad));function Md(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Xr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Xr(e)}i.currentTarget=null,a=c}}}}function Nd(e,t){var n=t[lt];n===void 0&&(n=t[lt]=new Set);var r=e+`__bubble`;n.has(r)||(Ld(t,e,2,!1),n.add(r))}function Pd(e,t,n){var r=0;t&&(r|=4),Ld(n,e,r,t)}var Fd=`_reactListening`+Math.random().toString(36).slice(2);function Id(e){if(!e[Fd]){e[Fd]=!0,bt.forEach(function(t){t!==`selectionchange`&&(jd.has(t)||Pd(t,!1,e),Pd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Fd]||(t[Fd]=!0,Pd(`selectionchange`,!1,t))}}function Ld(e,t,n,r){switch(kp(t)){case 2:var i=Cp;break;case 8:i=wp;break;default:i=Tp}n=i.bind(null,t,n,e),i=void 0,!un||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Rd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;s!==null;){if(o=ht(s),o===null)return;if(c=o.tag,c===5||c===6||c===26||c===27){r=a=o;continue a}s=s.parentNode}}r=r.return}sn(function(){var r=a,i=tn(n),o=[];a:{var s=qr.get(e);if(s!==void 0){var c=xn,u=e;switch(e){case`keypress`:if(gn(n)===0)break a;case`keydown`:case`keyup`:c=zn;break;case`focusin`:u=`focus`,c=An;break;case`focusout`:u=`blur`,c=An;break;case`beforeblur`:case`afterblur`:c=An;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:c=On;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=kn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=Vn;break;case Br:case Vr:case Hr:c=jn;break;case Kr:c=Hn;break;case`scroll`:case`scrollend`:c=Cn;break;case`wheel`:c=Un;break;case`copy`:case`cut`:case`paste`:c=Mn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=Bn;break;case`toggle`:case`beforetoggle`:c=Wn}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?s===null?null:s+`Capture`:s;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=cn(m,p),g!=null&&d.push(zd(m,g,h))),f)break;m=m.return}0<d.length&&(s=new c(s,u,null,n,i),o.push({event:s,listeners:d}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,s&&n!==en&&(u=n.relatedTarget||n.fromElement)&&(ht(u)||u[ct]))break a;if((c||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,c?(u=n.relatedTarget||n.toElement,c=r,u=u?ht(u):null,u!==null&&(f=l(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(c=null,u=r),c!==u)){if(d=On,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Bn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?s:_t(c),h=u==null?s:_t(u),s=new d(g,m+`leave`,c,n,i),s.target=f,s.relatedTarget=h,g=null,ht(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,c&&u)b:{for(d=Vd,p=c,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;c!==null&&Hd(o,s,c,d,!1),u!==null&&f!==null&&Hd(o,f,u,d,!0)}}a:{if(s=r?_t(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var v=ur;else if(ir(s)){if(dr)v=br;else{v=vr;var y=_r}}else c=s.nodeName,!c||c.toLowerCase()!==`input`||s.type!==`checkbox`&&s.type!==`radio`?r&&Yt(r.elementType)&&(v=ur):v=yr;if(v&&=v(e,r)){ar(o,v,n,i);break a}y&&y(e,s,r),e===`focusout`&&r&&s.type===`number`&&r.memoizedProps.value!=null&&Vt(s,`number`,s.value)}switch(y=r?_t(r):window,e){case`focusin`:(ir(y)||y.contentEditable===`true`)&&(Ar=y,jr=r,Mr=null);break;case`focusout`:Mr=jr=Ar=null;break;case`mousedown`:Nr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Nr=!1,Pr(o,n,i);break;case`selectionchange`:if(kr)break;case`keydown`:case`keyup`:Pr(o,n,i)}var b;if(Kn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else er?Qn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Yn&&n.locale!==`ko`&&(er||x!==`onCompositionStart`?x===`onCompositionEnd`&&er&&(b=hn()):(fn=i,pn=`value`in fn?fn.value:fn.textContent,er=!0)),y=Bd(r,x),0<y.length&&(x=new Nn(x,e,null,n,i),o.push({event:x,listeners:y}),b?x.data=b:(b=$n(n),b!==null&&(x.data=b)))),(b=Jn?tr(e,n):nr(e,n))&&(x=Bd(r,`onBeforeInput`),0<x.length&&(y=new Nn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:y,listeners:x}),y.data=b)),Dd(o,e,r,n,i)}Md(o,t)})}function zd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Bd(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=cn(e,n),i!=null&&r.unshift(zd(e,i,a)),i=cn(e,t),i!=null&&r.push(zd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Vd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Hd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=cn(n,a),l!=null&&o.unshift(zd(n,l,c))):i||(l=cn(n,a),l!=null&&o.push(zd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Ud=/\r\n?/g,Wd=/\u0000|\uFFFD/g;function Gd(e){return(typeof e==`string`?e:``+e).replace(Ud,`
10
- `).replace(Wd,``)}function Kd(e,t){return t=Gd(t),Gd(e)===t}function qd(e,t,n,r,i,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Gt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Gt(e,``+r);break;case`className`:kt(e,`class`,r);break;case`tabIndex`:kt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:kt(e,n,r);break;case`style`:Jt(e,r,o);break;case`data`:if(t!==`object`){kt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Qt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&qd(e,t,`name`,i.name,i,null),qd(e,t,`formEncType`,i.formEncType,i,null),qd(e,t,`formMethod`,i.formMethod,i,null),qd(e,t,`formTarget`,i.formTarget,i,null)):(qd(e,t,`encType`,i.encType,i,null),qd(e,t,`method`,i.method,i,null),qd(e,t,`target`,i.target,i,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Qt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=$t);break;case`onScroll`:r!=null&&Nd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Nd(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(a(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(a(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Qt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Nd(`beforetoggle`,e),Nd(`toggle`,e),Ot(e,`popover`,r);break;case`xlinkActuate`:At(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:At(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:At(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:At(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:At(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:At(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:At(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:At(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:At(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Ot(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Xt.get(n)||n,Ot(e,n,r))}}function Jd(e,t,n,r,i,o){switch(n){case`style`:Jt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(a(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(a(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Gt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Gt(e,``+r);break;case`onScroll`:r!=null&&Nd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Nd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=$t);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!xt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(i=n.endsWith(`Capture`),t=n.slice(2,i?n.length-7:void 0),o=e[st]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,i),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,i);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Ot(e,n,r)}}}function Yd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Nd(`error`,e),Nd(`load`,e);var r=!1,i=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:i=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(a(137,t));default:qd(e,t,o,s,n,null)}}i&&qd(e,t,`srcSet`,n.srcSet,n,null),r&&qd(e,t,`src`,n.src,n,null);return;case`input`:Nd(`invalid`,e);var c=o=s=i=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:i=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(a(137,t));break;default:qd(e,t,r,d,n,null)}}Bt(e,o,c,l,u,s,i,!1);return;case`select`:for(i in Nd(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(i)&&(c=n[i],c!=null))switch(i){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:qd(e,t,i,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Ht(e,!!r,n,!0):Ht(e,!!r,t,!1);return;case`textarea`:for(s in Nd(`invalid`,e),o=i=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:i=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(a(91));break;default:qd(e,t,s,c,n,null)}Wt(e,r,i,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:qd(e,t,l,r,n,null)}return;case`dialog`:Nd(`beforetoggle`,e),Nd(`toggle`,e),Nd(`cancel`,e),Nd(`close`,e);break;case`iframe`:case`object`:Nd(`load`,e);break;case`video`:case`audio`:for(r=0;r<Ad.length;r++)Nd(Ad[r],e);break;case`image`:Nd(`error`,e),Nd(`load`,e);break;case`details`:Nd(`toggle`,e);break;case`embed`:case`source`:case`link`:Nd(`error`,e),Nd(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(a(137,t));default:qd(e,t,u,r,n,null)}return;default:if(Yt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Jd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&qd(e,t,c,r,n,null))}function Xd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var i=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||qd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:i=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(a(137,t));break;default:m!==f&&qd(e,t,p,m,r,f)}}zt(e,s,c,l,u,d,o,i);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||qd(e,t,o,null,r,l)}for(i in r)if(o=r[i],l=n[i],r.hasOwnProperty(i)&&(o!=null||l!=null))switch(i){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&qd(e,t,i,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Ht(e,!!n,n?[]:``,!1):Ht(e,!!n,t,!0)):Ht(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(i=n[c],n.hasOwnProperty(c)&&i!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:qd(e,t,c,null,r,i)}for(s in r)if(i=r[s],o=n[s],r.hasOwnProperty(s)&&(i!=null||o!=null))switch(s){case`value`:p=i;break;case`defaultValue`:m=i;break;case`children`:break;case`dangerouslySetInnerHTML`:if(i!=null)throw Error(a(91));break;default:i!==o&&qd(e,t,s,i,r,o)}Ut(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:qd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:qd(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&qd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(a(137,t));break;default:qd(e,t,u,p,r,m)}return;default:if(Yt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Jd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Jd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&qd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||qd(e,t,f,p,r,m)}function Zd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Qd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Zd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Zd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var $d=null,ef=null;function tf(e){return e.nodeType===9?e:e.ownerDocument}function nf(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function rf(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function af(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var of=null;function sf(){var e=window.event;return e&&e.type===`popstate`?e!==of&&(of=e,!0):(of=null,!1)}var cf=typeof setTimeout==`function`?setTimeout:void 0,lf=typeof clearTimeout==`function`?clearTimeout:void 0,uf=typeof Promise==`function`?Promise:void 0,df=typeof queueMicrotask==`function`?queueMicrotask:uf===void 0?cf:function(e){return uf.resolve(null).then(e).catch(ff)};function ff(e){setTimeout(function(){throw e})}function pf(e){return e===`head`}function mf(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Jp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)Of(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,Of(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[pt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&Of(e.ownerDocument.body)}n=i}while(n);Jp(t)}function hf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function gf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:gf(n),mt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function _f(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[pt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=Cf(e.nextSibling),e===null)break}return null}function vf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=Cf(e.nextSibling),e===null))return null;return e}function yf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=Cf(e.nextSibling),e===null))return null;return e}function bf(e){return e.data===`$?`||e.data===`$~`}function xf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function Sf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function Cf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var wf=null;function Tf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return Cf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function Ef(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function Df(e,t,n){switch(t=tf(n),e){case`html`:if(e=t.documentElement,!e)throw Error(a(452));return e;case`head`:if(e=t.head,!e)throw Error(a(453));return e;case`body`:if(e=t.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function Of(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);mt(e)}var kf=new Map,Af=new Set;function jf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Mf=te.d;te.d={f:Nf,r:Pf,D:Lf,C:Rf,L:zf,m:Bf,X:Hf,S:Vf,M:Uf};function Nf(){var e=Mf.f(),t=Mu();return e||t}function Pf(e){var t=gt(e);t!==null&&t.tag===5&&t.type===`form`?js(t):Mf.r(e)}var Ff=typeof document>`u`?null:document;function If(e,t,n){var r=Ff;if(r&&typeof t==`string`&&t){var i=Rt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Af.has(i)||(Af.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Yd(t,`link`,e),yt(t),r.head.appendChild(t)))}}function Lf(e){Mf.D(e),If(`dns-prefetch`,e,null)}function Rf(e,t){Mf.C(e,t),If(`preconnect`,e,t)}function zf(e,t,n){Mf.L(e,t,n);var r=Ff;if(r&&e&&t){var i=`link[rel="preload"][as="`+Rt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Rt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Rt(n.imageSizes)+`"]`)):i+=`[href="`+Rt(e)+`"]`;var a=i;switch(t){case`style`:a=Gf(e);break;case`script`:a=Yf(e)}kf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),kf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Kf(a))||t===`script`&&r.querySelector(Xf(a))||(t=r.createElement(`link`),Yd(t,`link`,e),yt(t),r.head.appendChild(t)))}}function Bf(e,t){Mf.m(e,t);var n=Ff;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Rt(r)+`"][href="`+Rt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Yf(e)}if(!kf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),kf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Xf(a)))return}r=n.createElement(`link`),Yd(r,`link`,e),yt(r),n.head.appendChild(r)}}}function Vf(e,t,n){Mf.S(e,t,n);var r=Ff;if(r&&e){var i=vt(r).hoistableStyles,a=Gf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Kf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=kf.get(a))&&$f(e,n);var c=o=r.createElement(`link`);yt(c),Yd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Qf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Hf(e,t){Mf.X(e,t);var n=Ff;if(n&&e){var r=vt(n).hoistableScripts,i=Yf(e),a=r.get(i);a||(a=n.querySelector(Xf(i)),a||(e=h({src:e,async:!0},t),(t=kf.get(i))&&ep(e,t),a=n.createElement(`script`),yt(a),Yd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Uf(e,t){Mf.M(e,t);var n=Ff;if(n&&e){var r=vt(n).hoistableScripts,i=Yf(e),a=r.get(i);a||(a=n.querySelector(Xf(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=kf.get(i))&&ep(e,t),a=n.createElement(`script`),yt(a),Yd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Wf(e,t,n,r){var i=(i=R.current)?jf(i):null;if(!i)throw Error(a(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Gf(n.href),n=vt(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Gf(n.href);var o=vt(i).hoistableStyles,s=o.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=i.querySelector(Kf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),kf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},kf.set(e,n),o||Jf(i,e,n,s.state))),t&&r===null)throw Error(a(528,``));return s}if(t&&r!==null)throw Error(a(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Yf(n),n=vt(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(a(444,e))}}function Gf(e){return`href="`+Rt(e)+`"`}function Kf(e){return`link[rel="stylesheet"][`+e+`]`}function qf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Jf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Yd(t,`link`,n),yt(t),e.head.appendChild(t))}function Yf(e){return`[src="`+Rt(e)+`"]`}function Xf(e){return`script[async]`+e}function Zf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Rt(n.href)+`"]`);if(r)return t.instance=r,yt(r),r;var i=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),yt(r),Yd(r,`style`,i),Qf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Gf(n.href);var o=e.querySelector(Kf(i));if(o)return t.state.loading|=4,t.instance=o,yt(o),o;r=qf(n),(i=kf.get(i))&&$f(r,i),o=(e.ownerDocument||e).createElement(`link`),yt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Yd(o,`link`,r),t.state.loading|=4,Qf(o,n.precedence,e),t.instance=o;case`script`:return o=Yf(n.src),(i=e.querySelector(Xf(o)))?(t.instance=i,yt(i),i):(r=n,(i=kf.get(o))&&(r=h({},n),ep(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),yt(i),Yd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(a(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Qf(r,n.precedence,e));return t.instance}function Qf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function $f(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function ep(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var tp=null;function np(e,t,n){if(tp===null){var r=new Map,i=tp=new Map;i.set(n,r)}else i=tp,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[pt]||a[ot]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function rp(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function ip(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function ap(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function op(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Gf(r.href),a=t.querySelector(Kf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=lp.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,yt(a);return}a=t.ownerDocument||t,r=qf(r),(i=kf.get(i))&&$f(r,i),a=a.createElement(`link`),yt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Yd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=lp.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var sp=0;function cp(e,t){return e.stylesheets&&e.count===0&&dp(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&dp(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&sp===0&&(sp=62500*Qd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&dp(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>sp?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function lp(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)dp(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var up=null;function dp(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,up=new Map,t.forEach(fp,e),up=null,lp.call(e))}function fp(e,t){if(!(t.state.loading&4)){var n=up.get(e);if(n)var r=n.get(null);else{n=new Map,up.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=lp.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var pp={$$typeof:C,Provider:null,Consumer:null,_currentValue:ne,_currentValue2:ne,_threadCount:0};function mp(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ye(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ye(0),this.hiddenUpdates=Ye(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function hp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new mp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ci(3,null,null,t),e.current=a,a.stateNode=e,t=la(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Ha(a),e}function gp(e){return e?(e=oi,e):oi}function _p(e,t,n,r,i,a){i=gp(i),r.context===null?r.context=i:r.pendingContext=i,r=Wa(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ga(e,r,t),n!==null&&(Du(n,e,t),Ka(n,e,t))}function vp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function yp(e,t){vp(e,t),(e=e.alternate)&&vp(e,t)}function bp(e){if(e.tag===13||e.tag===31){var t=ri(e,67108864);t!==null&&Du(t,e,67108864),yp(e,67108864)}}function xp(e){if(e.tag===13||e.tag===31){var t=Tu();t=tt(t);var n=ri(e,t);n!==null&&Du(n,e,t),yp(e,t)}}var Sp=!0;function Cp(e,t,n,r){var i=F.T;F.T=null;var a=te.p;try{te.p=2,Tp(e,t,n,r)}finally{te.p=a,F.T=i}}function wp(e,t,n,r){var i=F.T;F.T=null;var a=te.p;try{te.p=8,Tp(e,t,n,r)}finally{te.p=a,F.T=i}}function Tp(e,t,n,r){if(Sp){var i=Ep(r);if(i===null)Rd(e,t,r,Dp,n),Rp(e,r);else if(Bp(i,e,t,n,r))r.stopPropagation();else if(Rp(e,r),t&4&&-1<Lp.indexOf(e)){for(;i!==null;){var a=gt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=We(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Le(o);s.entanglements[1]|=c,o&=~c}gd(a),!(Kl&6)&&(pu=Te()+500,_d(0,!1))}}break;case 31:case 13:s=ri(a,2),s!==null&&Du(s,a,2),Mu(),yp(a,2)}if(a=Ep(r),a===null&&Rd(e,t,r,Dp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Rd(e,t,r,null,n)}}function Ep(e){return e=tn(e),Op(e)}var Dp=null;function Op(e){if(Dp=null,e=ht(e),e!==null){var t=l(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=u(t),e!==null)return e;e=null}else if(n===31){if(e=d(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Dp=e,null}function kp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Ee()){case De:return 2;case Oe:return 8;case ke:case Ae:return 32;case je:return 268435456;default:return 32}default:return 32}}var Ap=!1,jp=null,Mp=null,Np=null,Pp=new Map,Fp=new Map,Ip=[],Lp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Rp(e,t){switch(e){case`focusin`:case`focusout`:jp=null;break;case`dragenter`:case`dragleave`:Mp=null;break;case`mouseover`:case`mouseout`:Np=null;break;case`pointerover`:case`pointerout`:Pp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Fp.delete(t.pointerId)}}function zp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=gt(t),t!==null&&bp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Bp(e,t,n,r,i){switch(t){case`focusin`:return jp=zp(jp,e,t,n,r,i),!0;case`dragenter`:return Mp=zp(Mp,e,t,n,r,i),!0;case`mouseover`:return Np=zp(Np,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Pp.set(a,zp(Pp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Fp.set(a,zp(Fp.get(a)||null,e,t,n,r,i)),!0}return!1}function Vp(e){var t=ht(e.target);if(t!==null){var n=l(t);if(n!==null){if(t=n.tag,t===13){if(t=u(n),t!==null){e.blockedOn=t,it(e.priority,function(){xp(n)});return}}else if(t===31){if(t=d(n),t!==null){e.blockedOn=t,it(e.priority,function(){xp(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Hp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Ep(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);en=r,n.target.dispatchEvent(r),en=null}else return t=gt(n),t!==null&&bp(t),e.blockedOn=n,!1;t.shift()}return!0}function Up(e,t,n){Hp(e)&&n.delete(t)}function Wp(){Ap=!1,jp!==null&&Hp(jp)&&(jp=null),Mp!==null&&Hp(Mp)&&(Mp=null),Np!==null&&Hp(Np)&&(Np=null),Pp.forEach(Up),Fp.forEach(Up)}function Gp(e,n){e.blockedOn===n&&(e.blockedOn=null,Ap||(Ap=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Wp)))}var Kp=null;function qp(e){Kp!==e&&(Kp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Kp===e&&(Kp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(Op(r||n)===null)continue;break}var a=gt(n);a!==null&&(e.splice(t,3),t-=3,ks(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Jp(e){function t(t){return Gp(t,e)}jp!==null&&Gp(jp,e),Mp!==null&&Gp(Mp,e),Np!==null&&Gp(Np,e),Pp.forEach(t),Fp.forEach(t);for(var n=0;n<Ip.length;n++){var r=Ip[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Ip.length&&(n=Ip[0],n.blockedOn===null);)Vp(n),n.blockedOn===null&&Ip.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[st]||null;if(typeof a==`function`)o||qp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[st]||null)s=o.formAction;else if(Op(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),qp(n)}}}function Yp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Xp(e){this._internalRoot=e}Zp.prototype.render=Xp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(a(409));var n=t.current;_p(n,Tu(),e,t,null,null)},Zp.prototype.unmount=Xp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;_p(e.current,2,null,e,null,null),Mu(),t[ct]=null}};function Zp(e){this._internalRoot=e}Zp.prototype.unstable_scheduleHydration=function(e){if(e){var t=rt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ip.length&&t!==0&&t<Ip[n].priority;n++);Ip.splice(n,0,e),n===0&&Vp(e)}};var Qp=n.version;if(Qp!==`19.2.4`)throw Error(a(527,Qp,`19.2.4`));te.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(a(188)):(e=Object.keys(e).join(`,`),Error(a(268,e)));return e=p(t),e=e===null?null:m(e),e=e===null?null:e.stateNode,e};var $p={bundleType:0,version:`19.2.4`,rendererPackageName:`react-dom`,currentDispatcherRef:F,reconcilerVersion:`19.2.4`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var em=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!em.isDisabled&&em.supportsFiber)try{Pe=em.inject($p),Fe=em}catch{}}e.createRoot=function(e,t){if(!s(e))throw Error(a(299));var n=!1,r=``,i=Qs,o=$s,c=ec;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(o=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=hp(e,1,!1,null,null,n,r,null,i,o,c,Yp),e[ct]=t.current,Id(e),new Xp(t)}})),u=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=l()})),d=e(i(),1),f=u(),p={xs:10,sm:11,base:12,lg:13,xl:14,"2xl":15,"3xl":16,"4xl":18,"5xl":20};function m(e,t={}){return e.replace(/\{([\w.-]+)\}/g,(e,n)=>{let r=t[n];return r===void 0?e:String(r)})}function h(e,t,n,r={}){let i=n[e]?.[t]??n.en?.[t];return i===void 0?t:m(i,r)}function g(e,t,n=new Date){let r=(e instanceof Date?e:new Date(e)).getTime()-n.getTime(),i=Math.abs(r),[a,o]=i<6e4?[`second`,1e3]:i<36e5?[`minute`,6e4]:i<864e5?[`hour`,36e5]:[`day`,864e5],s=Math.round(r/o);return new Intl.RelativeTimeFormat(t,{numeric:`always`}).format(s,a)}var _={id:`en`,label:`English`,messages:{"common.ok":`OK`,"common.language":`Language`,"common.models":`Models`,"common.skills":`Skills`,"common.plugins":`Plugins`,"sidebar.hide":`Collapse sidebar`,"sidebar.show":`Expand sidebar`,"theme.light":`Switch to light mode`,"preferences.defaultThinkingLevel":`Default thinking level`,"preferences.thinkingLevelHint":"Global default for new sessions (settings.json `defaultThinkingLevel`). Not set = field removed, falls back to pi default.","preferences.thinkingLevelNotSet":`Not set (use model default)`,"preferences.compaction":`Auto compaction`,"preferences.compactionHint":"Automatically compact long sessions (settings.json `compaction`). When not configured the pi defaults are shown; any edit writes the full object.","preferences.compactionEnabled":`Enabled`,"preferences.compactionReserveTokens":`Reserve tokens`,"preferences.compactionReserveTokensHint":`Tokens reserved for model output, keeping reply space after compaction`,"preferences.compactionKeepRecentTokens":`Keep recent tokens`,"preferences.compactionKeepRecentTokensHint":`Tokens kept after compaction, counted backwards from the most recent messages`,"preferences.retry":`API retry`,"preferences.retryHint":"Retry settings for provider API calls (settings.json `retry`). When not configured the pi defaults are shown; any edit writes the full object. Provider sub-fields left empty are not written.","preferences.retryEnabled":`Enabled`,"preferences.retryEnabledHint":`Enable retries for failed API calls`,"preferences.retryMaxRetries":`Max retries`,"preferences.retryBaseDelayMs":`Base delay (ms)`,"preferences.retryBaseDelayMsHint":`Initial delay before the first retry, in milliseconds`,"preferences.retryProviderTimeoutMs":`Provider timeout (ms)`,"preferences.retryProviderMaxRetries":`Provider max retries`,"preferences.retryProviderMaxRetryDelayMs":`Provider max delay (ms)`,"preferences.defaultProjectTrust":`Default project trust`,"preferences.projectTrustHint":"Default trust for new projects (settings.json `defaultProjectTrust`). Not set = field removed (falls back to ask).","preferences.projectTrustNotSet":`Not set (ask)`,"preferences.projectTrustAsk":`Ask`,"preferences.projectTrustAlways":`Always trust`,"preferences.projectTrustNever":`Never trust`,"preferences.notifyEvents":`Notifications`,"preferences.notifyEventsHint":`Browser notifications when the tab is not active. Permission is requested on first interaction.`,"notify.permission.request":`Enable notifications`,"notify.permission.requestHint":`Click to enable browser notifications — you'll be alerted when a task finishes even if this tab is in the background`,"notify.permission.granted":`Notifications on`,"notify.permission.grantedHint":`Browser notifications are enabled — you'll be alerted when a task finishes even if this tab is in the background`,"notify.permission.bannerHintBefore":`Click the`,"notify.permission.bannerHintAfter":`button in the top-left toolbar to enable notifications — you'll be alerted when a task completes, errors, or asks a question. Fine-tune in Config Center → Session → Notifications`,"notify.permission.denied":`Notifications blocked`,"notify.permission.deniedHint":`Notifications are blocked by the browser. Click the icon next to the address bar → Site settings, switch notifications to Allow, then try again`,"preferences.notifyWhileActive":`Notify while page active`,"preferences.notifyTaskComplete":`Task complete`,"preferences.notifyErrors":`Errors`,"preferences.notifyQuestions":`Questions`,"preferences.subagentsDefaultModel":`Subagent default model`,"preferences.subagentsDefaultThinking":`Subagent default thinking level`,"preferences.subagentsHint":"Defaults for subagents (settings.json `subagents`). defaultThinking not set = sub-field removed (falls back to pi default).","preferences.subagentsModelPlaceholder":`provider/model-id`,"theme.dark":`Switch to dark mode`,"theme.toggleTheme":`Switch theme`,"theme.darkMode":`Dark`,"theme.lightMode":`Light`,"theme.fontSize":`Font size`,"theme.scrollStep":`Hover scroll step`,"scrollStep.hint":`Pixels scrolled per hover tick on the edge scroll arrows (shared by the panel scroll arrows and the minimap).`,"scrollStep.range":`per hover tick (1-1000)`,"scrollStep.unit":`px`,"theme.autoReloadSeconds":`Auto-reload chat messages interval`,"autoReload.off":`Off (0) — do not auto-reload`,"autoReload.range":`seconds (0 — 3600)`,"autoReload.unit":`s`,"autoReload.hint":`Interval in seconds for re-reading the session file; 0 = off. Keep 0 for single-client use (messages arrive via SSE in real time); set it above 0 for multi-client collaboration (several browsers on the same session) so each client refreshes periodically and picks up chat messages generated by the others.`,"longBlock.hint":`“Blocks” are thinking and tool calls. Bodies beyond the threshold collapse to a head/tail digest; click to expand the full text.`,"recentBlocks.hint":`Streaming blocks and the just-completed block are not counted (the newest completed block always stays expanded). This is how many additional recent completed blocks stay expanded.`,"autoReload.reset":`Reset to default ({n} s)`,"chat.reloadFromDisk":`Reload session from disk`,"chat.reloadFromDiskHint":`Use when multiple clients read/write the same session jsonl at the same time. You can set automatic timed reloading under Config Center → Session.`,"scrollStep.reset":`Reset to default ({n} px)`,"theme.longBlockCollapse":`Long block collapse`,"theme.recentBlocksExpanded":`Recent completed blocks kept expanded`,"layout.sidebarWidth":`Left panel width`,"layout.widgetPanelWidth":`Right panel width`,"layout.widthRange":`px ({min}–{max})`,"layout.widthReset":`Reset to default ({value} px)`,"longBlock.range":`chars (20-10000)`,"longBlock.chars":`chars`,"longBlock.blocks":`blocks`,"longBlock.reset":`Reset to default ({n} chars)`,"recentBlocks.reset":`Reset to default ({n})`,"recentBlocks.range":`0-20, excludes the newest completed block`,"longBlock.expandHint":`… {n} chars folded · click to expand`,"longBlock.collapse":`Click to collapse`,"history.full":`Full history`,"history.unsaved":`Full history is available after the session is saved`,"title.generating":`Generating...`,"title.updated":`Title updated`,"title.failed":`Generation failed`,"title.generate":`Generate title`,"title.unsaved":`Title generation is available after the session is saved`,"title.noMessages":`Send a message before naming this session`,"title.generateSession":`Generate a session title`,"system.prompt":`System prompt`,"system.empty":`System prompt is empty (tools are disabled)`,"system.load":`Send a message to load the system prompt`,"session.info":`Session info`,"session.reload":`Reload session (re-read config and resources)`,"session.name":`Name`,"session.file":`File`,"session.inMemory":`In-memory`,"session.id":`ID`,"session.user":`User`,"session.assistant":`Assistant`,"session.toolCalls":`Tool Calls`,"session.toolResults":`Tool Results`,"session.total":`Total`,"session.input":`Input`,"session.output":`Output`,"session.cacheRead":`Cache Read`,"session.cacheWrite":`Cache Write`,"session.inputHint":`Prompt tokens NOT served from cache: system prompt, history and tool definitions sent to the model, minus the cached portion`,"session.outputHint":`Tokens generated by the model (answers and thinking)`,"session.cacheReadHint":`Tokens served from prompt cache: unchanged context re-read from the previous request at a discounted rate`,"session.cacheWriteHint":`Tokens written to cache for the first time (billed on write, Anthropic-style)`,"session.totalHint":`input + output + cacheRead + cacheWrite`,"session.cacheReadRate":`Cache hit rate: cache-read tokens as a share of all input prompt tokens (input + cacheRead + cacheWrite), the official formula cacheRead / (input + cacheRead + cacheWrite)`,"session.cost":`Cost`,"session.context":`Context`,"session.copy":`Copy {value}`,"session.copied":`Copied`,"session.title":`Session info`,"session.load":`Send a message or run /session to load session info`,"session.infoSection":`Session Info`,"session.messages":`Messages`,"session.tokens":`Tokens`,"session.copyFile":`Copy file path`,"session.copyId":`Copy session ID`,"workspace.opening":`Opening workspace...`,"workspace.unable":`Unable to open workspace`,"workspace.selectSession":`Select a session from the sidebar`,"workspace.selectWorkspace":`Please select a workspace`,"workspace.stepProject":`Select a project directory from the sidebar`,"workspace.stepModels":`Add models via the Models button at the bottom`,"tabs.chat":`Chat`,"tabs.widgets":`Widgets`,"config.title":`Settings`,"config.section.session":`Session`,"config.section.appearance":`Appearance`,"config.section.advanced":`Advanced`,"config.section.startScreen":`Start screen`,"config.section.git":`Git`,"config.section.modelThinking":`Thinking Levels`,"config.section.requiresCwd":`Select a project directory from the sidebar first to browse plugins / skills`,"preferences.pi.unset":`pi default`,"preferences.pi.enableAnalytics":`Enable analytics`,"preferences.pi.enableAnalyticsHint":"Send anonymous usage analytics (settings.json `enableAnalytics`)","preferences.pi.enableInstallTelemetry":`Enable install telemetry`,"preferences.pi.enableInstallTelemetryHint":"Send anonymous install telemetry (settings.json `enableInstallTelemetry`)","preferences.pi.httpProxy":`HTTP proxy`,"preferences.pi.httpProxyHint":"Proxy URL for HTTP requests (settings.json `httpProxy`). Empty input cannot clear an already-set value.","preferences.pi.trackingId":`Analytics tracking ID`,"preferences.pi.trackingIdHint":"Custom analytics tracking ID (settings.json `trackingId`). Empty input cannot clear an already-set value.","preferences.pi.httpIdleTimeoutMs":`HTTP idle timeout (ms)`,"preferences.pi.httpIdleTimeoutMsHint":"HTTP idle timeout in ms (settings.json `httpIdleTimeoutMs`). Empty input cannot clear an already-set value.","preferences.pi.websocketConnectTimeoutMs":`WebSocket connect timeout (ms)`,"preferences.pi.websocketConnectTimeoutMsHint":"WebSocket connect timeout in ms (settings.json `websocketConnectTimeoutMs`). Empty input cannot clear an already-set value.","preferences.pi.branchSummary":`Branch summary`,"preferences.pi.branchSummaryHint":"Branch summary auto-compaction (settings.json `branchSummary`)","preferences.pi.reserveTokens":`Reserve tokens`,"preferences.pi.skipPrompt":`Skip prompt`,"preferences.pi.images":`Image handling`,"preferences.pi.imagesHint":"How the pi engine handles images (settings.json `images`)","preferences.pi.autoResize":`Auto-resize`,"preferences.pi.autoResizeHint":"Downscale images returned by tools such as `read` to save tokens.","preferences.pi.blockImages":`Block images`,"preferences.pi.blockImagesHint":`Strip all image content from messages before they reach the model.`,"config.files.hint":`Edit pi's config files (JSON) directly. Validated before save; backed up automatically (last 10 kept).`,"config.widgets.empty":`No widget configurations yet. Widgets appear here automatically when an extension pops one up.`,"config.widgets.x":`x`,"config.widgets.y":`y`,"config.widgets.width":`w`,"config.widgets.height":`h`,"config.widgets.bind":`Bind message`,"config.widgets.bindTitle":`Bind custom message`,"config.widgets.bindHint":`Bind a quick message to widget "{key}"`,"config.widgets.editTitle":`Edit quick message`,"config.widgets.editHint":`Edit the label, content, and send mode.`,"config.widgets.label":`Label`,"config.widgets.labelPlaceholder":`Button text (e.g. Reload)`,"config.widgets.message":`Message`,"config.widgets.messagePlaceholder":`A slash command or any text (e.g. /reload)`,"config.widgets.sendImmediately":`Send immediately`,"config.widgets.sendMode":`Send mode`,"config.widgets.fillToChatInput":`Fill into chat input`,"config.widgets.sendImmediatelyTooltip":`Send immediately: `,"config.widgets.fillToChatInputTooltip":`Fill into chat input: `,"config.widgets.nameConflict":`Name "{label}" already exists, please use another`,"config.startScreen.nameConflict":`Name "{label}" already exists, please use another`,"config.startScreen.hint":`Quick actions shown on the new-session start screen (below the Pi logo); clicking sends the message immediately or fills it into the chat input, depending on each entry's send mode.`,"config.startScreen.bind":`Bind message`,"config.startScreen.bindTitle":`Bind quick message`,"config.startScreen.bindHint":`Bind a quick message to the start screen.`,"config.startScreen.empty":`No quick messages yet; the start screen will show no quick actions.`,"config.startScreen.unbindTitle":`Unbind message`,"config.startScreen.unbindConfirm":`Unbind "{label}"?`,"config.startScreen.unbind":`Unbind`,"config.widgets.confirm":`Confirm`,"config.widgets.unbindTitle":`Unbind message`,"config.widgets.unbindConfirm":`Unbind "{label}"?`,"config.widgets.unbind":`Unbind`,"config.startScreen.editTitle":`Edit quick message`,"config.startScreen.editHint":`Edit the label, content, and send mode.`,"config.startScreen.reset":`Reset`,"config.startScreen.resetHint":`Restore the built-in default quick messages; keep your own bound messages (ones with the same label as a default are replaced by the default).`,"config.files.save":`Save`,"config.files.saving":`Saving...`,"config.files.saved":`Saved`,"config.files.missing":`Not created yet`,"config.files.placeholder":`Select a config file from the list on the left`,"layout.resizeSidebar":`Resize sidebar`,"layout.resizeWidgetPanel":`Resize widgets panel`,"layout.resizeHint":`Drag to resize. Double-click or press Enter to reset.`,"sidebar.newWorkspace":`New workspace`,"sidebar.searchSessions":`Search sessions`,"sidebar.searchSessionsPlaceholder":`Search sessions…`,"sidebar.justNow":`just now`,"sidebar.minutesAgo":`{count}m ago`,"sidebar.hoursAgo":`{count}h ago`,"sidebar.daysAgo":`{count}d ago`,"sidebar.searchSessionsNoResults":`No matching sessions`,"sidebar.newSessionTitle":`New session in {path}`,"sidebar.refresh":`Refresh`,"directoryPicker.selectDirectory":`Select directory`,"directoryPicker.goToParent":`Go to parent directory`,"directoryPicker.directoryPath":`Directory path`,"directoryPicker.goToDirectory":`Go to directory`,"directoryPicker.go":`Go`,"directoryPicker.loadingDirectories":`Loading directories…`,"directoryPicker.noSubdirectories":`No subdirectories`,"directoryPicker.openBeforeSelecting":`Open this path before selecting it`,"directoryPicker.selectCurrentDirectory":`Select current directory`,"directoryPicker.selectThisFolder":`Select this folder`,"directoryPicker.noDrives":`No drives found`,"directoryPicker.search":`Filter folders`,"directoryPicker.noMatches":`No folders match your filter`,"sidebar.checking":`Checking…`,"sidebar.open":`Open`,"sidebar.cancel":`Cancel`,"sidebar.openRepoRoot":`Worktree switch unavailable`,"sidebar.openRepoRootTitle":`Worktree switching is unavailable here — switch the current working directory to the Git repository root first (from the sidebar).`,"sidebar.gitRepoRootOnly":`Git repo root only`,"sidebar.gitRepoRootOnlyTitle":`Worktrees are available in Git repository roots.`,"sidebar.worktrees":`Worktrees...`,"sidebar.checkingWorktrees":`Checking worktrees for this directory.`,"sidebar.filterWorktrees":`Filter worktrees…`,"sidebar.noMatchingWorktrees":`No matching worktrees`,"sidebar.switchWorktree":`Switch worktree`,"sidebar.switchWorktreeTitle":`Switch worktree: {path}`,"sidebar.main":`main`,"sidebar.forceRemoveCheckout":`Uncommitted changes. Force remove checkout?`,"sidebar.force":`Force`,"sidebar.createWorktreeTitle":`Create a worktree checkout for a branch`,"sidebar.newWorktree":`New worktree…`,"sidebar.branchName":`branch name`,"sidebar.creating":`Creating…`,"sidebar.create":`Create`,"sidebar.uploadFilesTitle":`Upload files to project root`,"sidebar.uploadFiles":`Upload files`,"sidebar.refreshExplorer":`Refresh explorer`,"sidebar.changedFiles":`{count} changed files`,"sidebar.loading":`Loading...`,"sidebar.sessionDeleted":`Session deleted — pick another session`,"sidebar.noSessions":`No sessions found`,"sidebar.workspace":`Workspace`,"sidebar.newActivity":`New activity`,"sidebar.newSessionActivity":`New session activity`,"sidebar.interactionBadge":`Session waiting for interaction`,"sidebar.deleteSession":`Delete {title}?`,"sidebar.deleteWorkspace":`Delete workspace ({count} sessions)?`,"sidebar.deleteWorkspaceTitle":`Delete this workspace and all its sessions`,"sidebar.copyPath":`Copy full path`,"sidebar.rename":`Rename`,"sidebar.delete":`Delete`,"sidebar.deleteWithShiftClick":`Delete (Shift+click to delete without confirmation)`,"sidebar.expandForks":`Expand forks`,"sidebar.collapseForks":`Collapse forks`,"sidebar.disconnect":`Disconnect`,"sidebar.messagesCount":`{count} msgs`,"sidebar.worktreePath":`Worktree: {path}`,"sidebar.removeWorktreeTitle":`Remove worktree checkout {path}; the branch is kept`,"files.modified":`Modified`,"files.added":`Added`,"files.deleted":`Deleted`,"files.renamed":`Renamed`,"files.untracked":`Untracked`,"files.conflict":`Conflict`,"files.newlyUploaded":`Newly uploaded`,"files.containsChangedFiles":`Contains changed files`,"files.insertPath":`Insert path into chat`,"files.mention":`mention`,"files.download":`Download file`,"files.dismissError":`Dismiss error`,"files.addUploadedFile":`Add uploaded file to chat`,"files.addAllUploadedFiles":`Add all uploaded files to chat`,"files.dismissUploadResults":`Dismiss upload results`,"files.loading":`Loading files...`,"files.noFiles":`No files found`,"loading.inProgress":`Working…`,"loading.more":`{count} more…`,"errors.title":`Error`,"errors.titleCount":`Errors ({count})`,"errors.close":`Close`,"errors.clearAll":`Clear all`,"files.notFound":`Not found`,"files.accessDenied":`Access denied`,"files.empty":`Empty`,"files.uploadFailed":`{count} failed`,"files.explorer":`Explorer`,"files.changedCount":`{count} files`,"files.stagedPrefix":`Staged: `,"files.unstagedPrefix":`Unstaged: `,"files.noStagedChanges":`No staged files`,"files.noUnstagedChanges":`No unstaged changes`,"files.commitMessagePlaceholder":`Commit message`,"files.commit":`Commit`,"files.push":`Push to remote (with tags)`,"files.pushing":`Pushing...`,"files.pushSuccess":`Push succeeded`,"files.pushFailed":`Push failed`,"files.pushUpToDate":`Already up to date — nothing to push`,"files.pull":`Pull from remote`,"files.pulling":`Pulling...`,"files.pullSuccess":`Pull succeeded`,"files.pullFailed":`Pull failed`,"files.pullUpToDate":`Already up to date — nothing to pull`,"files.pullNonFastForward":`Pull rejected — local and remote have diverged. Use git pull --rebase or --merge in terminal.`,"files.committing":`Committing…`,"files.commitMessageRequired":`Enter a commit message first`,"files.commitTitle":`Commit changes`,"files.confirmStageAllCommit":`{count} changed files are not staged. Stage them all and commit?`,"files.stageAllAndCommit":`Stage & commit`,"files.stageFile":`Stage file`,"files.unstageFile":`Unstage file`,"files.changeStats":`{count} changed files, {additions} lines added, {deletions} lines deleted`,"git.groupTitle":`Smart Commit Message Generation`,"git.commitModel.followCurrent":`Follow current session model`,"git.commitModel.followCurrentHint":`When on, the commit generation follows the current chat's main model. When off, the fixed model below is used (recommended for a cheap dedicated model).`,"git.commitModel.followCurrentOn":`On: follow current session`,"git.commitModel.followCurrentOff":`Off: use fixed model`,"git.commitModel.fixedModel":`Fixed model`,"git.commitModel.fixedModelHint":`Model used when "follow current session" is off (choose a cheap fixed model; note it may have only ~50k context).`,"git.commitModel.selectPlaceholder":`Select a model`,"git.commitModel.noModels":`No models available`,"git.commitModel.notConfiguredHint":`No fixed model selected. Pick a model before using AI generate.`,"git.ai.generate":`Smart generate`,"git.ai.generating":`Generating…`,"git.ai.notConfiguredTitle":`Model not configured`,"git.ai.notConfiguredDesc":`No model is set for Smart generate. Go to Config Center → Git to set one.`,"git.ai.goToConfig":`Go to settings`,"git.ai.noSession":`Follow-current mode requires an active session`,"git.ai.noSessionModel":`Current session has no model. Select a model in chat first`,"git.commitModel.maxTokens":`Max output tokens`,"git.commitModel.maxTokensHint":`Max output tokens for one generation (64–4096, default 512). Reasoning is minimized: disabled when the model supports it, otherwise reduced to the lowest level.`,"git.commitModel.autoGenerateOnEmpty":`Auto-generate when commit box is empty`,"git.commitModel.autoGenerateOnEmptyHint":`When on, clicking Commit with an empty box auto-generates a message first, then commits. Only when a model is configured; otherwise empty stays disabled. On by default.`,"git.ai.invalidModel":`Configured model is invalid. Reselect it in Config Center.`,"git.ai.autoGenerateOn":`On: auto-generate when empty`,"git.ai.usingCurrentModel":`Using current chat model`,"git.ai.usingModel":`Using {model}`,"git.ai.generateAndCommit":`Smart generate & commit`,"git.ai.autoGenerateOff":`Off`,"git.commitSectionTitle":`Commit`,"git.commitConfirmStageAll":`Confirm “stage all” on commit`,"git.commitConfirmStageAllHint":`When on, committing with only unstaged changes shows a “Stage all & commit” confirmation. When off, it stages all and commits directly. On by default.`,"git.commitConfirmStageAllOn":`On: confirm before staging all`,"git.commitConfirmStageAllOff":`Off: stage all directly`,"modelThinking.desc":`Remember the last thinking level per model or provider. When switching models, the selector restores the remembered level; if the model's available levels don't include it, it falls back to auto (use default). All 7 levels supported: off / minimal / low / medium / high / xhigh / max.`,"modelThinking.byModel":`By model`,"modelThinking.byProvider":`By provider`,"modelThinking.byProviderHint":`Provider fallback: models without a per-model entry use this value.`,"modelThinking.emptyModel":`No per-model memory yet. Selecting a thinking level after switching models will remember it automatically; you can also add one here.`,"modelThinking.emptyProvider":`No per-provider memory yet.`,"modelThinking.selectModelPlaceholder":`Select a model`,"modelThinking.selectProviderPlaceholder":`Select a provider`,"modelThinking.providerInputPlaceholder":`or type a provider name`,"modelThinking.footerHint":`Stored in a standalone file pi-web/model-thinking.json, not the main config. UI-only — pi's set_thinking_level is not intercepted.`,"common.add":`Add`,"common.delete":`Delete`,"files.conflictSummary":`{count} file{countSuffix} already exist: {files}`,"files.cannotReplace":`Cannot replace: {files}`,"files.replace":`Replace`,"files.skipExisting":`Skip existing`,"files.cancel":`Cancel`,"files.checking":`Checking files`,"files.uploading":`Uploading, {progress}%`,"files.search":`Search files`,"files.searchPlaceholder":`Search files...`,"chat.loadingSession":`Loading session...`,"chat.loadingWindow":`Loading messages...`,"chat.runningTool":`Running tool...`,"chat.runningNamedTool":`Running {name}...`,"chat.runningTools":`Running {names}...`,"chat.runningToolsMore":`Running {names} (+{count})...`,"chat.waitingModel":`Waiting for model...`,"chat.turnDuration":`took {duration}`,"chat.aiQuestion":`AI question`,"chat.runningCommand":`Running command...`,"chat.totalElapsed":`total {total}`,"chat.thinking":`Thinking...`,"chat.message":`message`,"chat.messages":`messages`,"chat.toolCall":`tool call`,"chat.toolCalls":`tool calls`,"chat.collapseProcess":`Collapse process details`,"chat.expandProcess":`Expand process details`,"chat.loadEarlier":`Scroll up to load earlier messages ({count} hidden)`,"chat.searchMessages":`Search messages`,"chat.clearSearch":`Clear search query`,"chat.scrollToLatest":`Scroll to latest message`,"chat.expandMessage":`Expand full content`,"chat.searchPlaceholder":`Search chat messages…`,"chat.searchNoResults":`No results`,"chat.searchResults":`{count} results`,"chat.extensionRequest":`extension request`,"chat.cancel":`Cancel`,"chat.confirm":`Confirm`,"chat.submit":`Submit`,"chat.extensionInput":`Extension terminal input`,"chat.extensionSelect":`Select an option`,"chat.extensionConfirm":`Confirm`,"chat.extensionEditor":`Edit`,"chat.extensionPanel":`Extension panel`,"chat.close":`Close`,"chat.notifyErrorTitle":`Error`,"chat.notifyWarningTitle":`Warning`,"chat.queued":`Queued · {count}`,"chat.recall":`Recall to input`,"chat.recallTitle":`Remove all queued messages and put them back into the input box for editing (also triggered by pressing Enter while the input is empty)`,"chat.retrying":`Retrying ({attempt}/{max})…`,"chat.loadingCommands":`Loading commands...`,"chat.slashCommands":`Slash commands · {label}`,"chat.tabEnter":`Tab / Enter`,"chat.noCommands":`No extension, prompt, or skill commands found`,"chat.match":`1 match`,"chat.matches":`{count} matches`,"chat.command":`1 command`,"chat.commands":`{count} commands`,"chat.loadingFiles":`Loading files...`,"chat.files":`Files · {label}{hint}`,"chat.searching":`Searching…`,"chat.noMatchingFiles":`No matching files`,"chat.searchingAll":` · searching all files…`,"chat.indexTruncated":` · index truncated`,"chat.steerPlaceholder":`Steer now / queue follow-up...`,"chat.recallPlaceholder":`Press Enter to recall queued messages, or type a new message…`,"chat.agentPlaceholder":`Agent is running…`,"chat.messagePlaceholder":`Message… Type / for commands, @ for files, ! for shell`,"chat.questionNotificationTitle":`Pi — Question Asked`,"chat.taskCompleteNotificationTitle":`Pi — Task Complete`,"chat.taskErrorNotificationTitle":`Pi — Error`,"chat.sessionCompletedNotificationBody":`Session {name} completed`,"chat.questionNotificationDenied":`Notifications denied: allow them in the browser's site settings to get question alerts while the tab is hidden.`,"chat.steer":`Steer`,"chat.followUp":`Follow-up`,"chat.queueImageBlocked":`Image attachments cannot be queued while the agent is running`,"chat.steerTooltip":`Send this message immediately after the current call finishes`,"chat.followUpTooltip":`Queue this message after the agent finishes`,"chat.send":`Send`,"chat.attachImage":`Attach image`,"chat.filterModels":`Filter models…`,"chat.noMatchingModels":`No matching models`,"chat.moreControls":`More controls`,"chat.collapseControls":`Collapse controls`,"chat.shell":`Shell`,"chat.outputLocal":`output stays local`,"chat.outputModel":`output sent to model`,"chat.noTools":`No tools, read-only`,"chat.builtInTools":`{count} built-in tools`,"chat.allBuiltInTools":`All built-in tools`,"chat.changeReasoning":`Change reasoning level: {level}`,"chat.changeReasoningLabel":`Change reasoning level`,"chat.changeToolPreset":`Change tool preset`,"chat.stopCompaction":`Stop compaction`,"chat.compactContext":`Compact context`,"chat.compacting":`Compacting…`,"chat.compact":`Compact`,"chat.stopAgent":`Stop agent`,"chat.stop":`Stop`,"chat.disableSound":`Disable completion sound`,"chat.enableSound":`Enable completion sound`,"chat.thinkingUseDefault":`Use pi default`,"chat.thinkingOff":`Reasoning off`,"chat.thinkingMinimal":`Minimal reasoning`,"chat.thinkingLow":`Low reasoning`,"chat.thinkingMedium":`Medium reasoning`,"chat.thinkingHigh":`High reasoning`,"chat.thinkingXhigh":`Extra-high reasoning`,"chat.thinkingMax":`Max reasoning`,"chat.thinkingMapTitle":`Higher thinking levels not configured`,"chat.thinkingMapBody":`pi supports up to high thinking by default. To enable {level} level reasoning, configure the "Thinking Level Map" for this model in Config → Models.`,"chat.thinkingMapGo":`Go to settings`,"chat.builtIn":`Built-in`,"chat.extensions":`Extensions`,"chat.prompts":`Prompts`,"chat.skills":`Skills`,"chat.dormant":`dormant`,"chat.commandCompact":`Compress context, optionally with instructions`,"chat.commandReload":`Reload extensions, skills, prompts, and tools`,"chat.commandName":`Set the session display name`,"chat.commandSession":`Show session message, token, and cost stats`,"chat.commandCopy":`Copy the last assistant message`,"chat.compacted":`Compacted`,"chat.tokensSaved":`{saved} saved`,"i18n.close":`Close`,"i18n.resizeList":`Resize {name} list`,"widgets.title":`Widgets`,"widgets.reopen":`Reopen widget`,"widgets.expandedToChat":`Widget [{key}] expanded to the chat view`,"widgets.collapse":`Collapse`,"widgets.open":`Open widgets`,"i18n.copy":`Copy`,"i18n.copied":`Copied`,"i18n.cancel":`Cancel`,"i18n.save":`Save`,"i18n.saving":`Saving…`,"i18n.saved":`Saved`,"i18n.saveChanges":`Save changes`,"i18n.noThinking":`No thinking content`,"i18n.remove":`Remove`,"i18n.removing":`Removing…`,"i18n.delete":`Delete`,"i18n.loading":`Loading...`,"i18n.searchPlaceholder":`Search…`,"i18n.noMatch":`No matches`,"i18n.search":`Search`,"i18n.refresh":`Refresh`,"i18n.update":`Update`,"i18n.updating":`Updating...`,"i18n.check":`Check`,"i18n.checking":`Checking...`,"i18n.install":`Install`,"i18n.installing":`Installing...`,"i18n.noResults":`No results`,"i18n.searchProviders":`Search providers…`,"i18n.noProviders":`No providers match`,"i18n.newModel":`new model`,"i18n.addProvider":`Add provider`,"i18n.selectProviderModel":`Select a provider or model`,"i18n.visibleInPrompt":`Visible in model prompt — click to disable`,"i18n.hiddenFromPrompt":`Hidden from model prompt — click to enable`,"i18n.dormant":`Dormant`,"i18n.hiddenButInvocable":`Hidden from model, still manually invocable`,"i18n.skillSearchPlaceholder":`e.g. react, testing, deploy`,"i18n.searching":`Searching…`,"i18n.noSkills":`No skills found`,"i18n.checkUpdates":`Check updates`,"i18n.updates":`updates`,"i18n.noResolvedResources":`No resolved resources`,"i18n.enablePackage":`Enable package`,"i18n.disablePackage":`Disable package`,"i18n.filtered":`filtered`,"i18n.openSessionToReload":`Open a session to reload`,"i18n.notFound":`Not found`,"i18n.noPlugins":`No plugins configured`,"trust.resourcesNotLoaded":`Restricted mode`,"trust.trustProject":`Trust project`,"trust.trusting":`Trusting...`,"trust.cancel":`Cancel`,"trust.dialogTitle":`Trust this project?`,"trust.dialogBody":`Project resources can run local code. Trust only projects whose contents you know.`,"trust.skillsNotLoaded":`Project skills are not loaded because this project is not trusted.`,"trust.pluginsNotLoaded":`Project plugins are not loaded because this project is not trusted.`,"trust.projectScopeUnavailable":`Project installs are unavailable while project resources are not loaded.`,"i18n.creatingSession":`Creating new session…`,"i18n.creating":`Creating…`,"i18n.subscription":`Subscription`,"i18n.subscriptions":`Subscriptions`,"i18n.customEndpoint":`Custom endpoint format`,"i18n.noChanges":`No changes`,"i18n.branches":`Branches`,"i18n.noActiveSession":`No active session`,"i18n.noActiveSessionToCompact":`No active session to compact`,"i18n.noActiveSessionToReload":`No active session to reload`,"i18n.noActiveSessionToName":`No active session to name`,"i18n.noAssistantMessageToCopy":`No assistant message to copy`,"i18n.commandCompleted":`Command completed`,"i18n.commandFailed":`Command failed`,"i18n.extensionCommandFailed":`Extension command failed`,"i18n.compactedContext":`Compacted context`,"i18n.reloadedSessionResources":`Reloaded session resources`,"i18n.usageName":`Usage: /name <name>`,"i18n.sessionRenamedTo":`Session renamed to {name}`,"i18n.copiedLastAssistantMessage":`Copied last assistant message`,"i18n.failedToRecallQueuedMessages":`Failed to recall queued messages`,"i18n.noBranches":`This session has no branches`,"i18n.source":`Source`,"i18n.preview":`Preview`,"i18n.diff":`Diff`,"i18n.downloadFile":`Download file`,"i18n.liveSync":`Live sync active`,"i18n.notWatching":`Not watching`,"i18n.fileViewMode":`File view mode`,"i18n.editMode":`Edit mode`,"i18n.viewMode":`View mode`,"i18n.compareHead":`Compare working tree with HEAD`,"i18n.mentionSelectedLines":`Mention selected lines`,"i18n.disableWrap":`Disable word wrap`,"i18n.enableWrap":`Enable word wrap`,"i18n.editFile":`Edit file`,"i18n.saveFile":`Save`,"i18n.saveFileShortcut":`Save (Ctrl/Cmd+S)`,"i18n.cancelEdit":`Cancel`,"i18n.saveFailed":`Save failed: {error}`,"i18n.unsavedChanges":`Unsaved changes`,"i18n.htmlPreview":`HTML preview`,"i18n.previewFile":`Preview {file}`,"i18n.invalidMermaid":`Invalid Mermaid diagram`,"i18n.renderingMermaid":`Rendering Mermaid diagram`,"i18n.previewAfterStreaming":`Preview available after streaming`,"i18n.showMermaidSource":`Show Mermaid source`,"i18n.previewMermaid":`Preview Mermaid diagram`,"i18n.openMermaidViewer":`Open diagram viewer`,"i18n.mermaidViewer":`Mermaid diagram viewer`,"i18n.mermaidDiagram":`Mermaid diagram`,"i18n.zoomOut":`Zoom out`,"i18n.zoomIn":`Zoom in`,"i18n.fitToWidth":`Fit to width`,"models.discoveryFetching":`Importing models…`,"models.deleteProviderConfirm":`Delete provider "{name}"? This writes to models.json immediately — all its settings (including the API key) will be removed and cannot be recovered.`,"models.removeModelConfirm":`Remove model "{model}"? This writes to models.json immediately and cannot be recovered.`,"models.discoveryTitle":`Import models`,"models.discoveryFetch":`Import models…`,"models.discoveryFilterPlaceholder":`Filter {count} models…`,"models.discoveryFilter":`Filter upstream models`,"models.discoverySelectShown":`Select shown`,"models.discoveryNoMatches":`No matching models.`,"models.discoveryAdded":`added`,"models.discoveryShowing":`Showing first {shown} of {total}`,"models.discoveryFetched":`{count} models fetched`,"models.discoveryAddSelected":`Add selected`,"models.setDefault":`Set as default`,"models.defaultModel":`Default model`,"models.syncEndpoint":`Sync from endpoint`,"models.lastSyncedAt":`Last synced {time}`,"models.neverSynced":`Never synced`,"models.discoveryFetchTooltip":`Imports from the local cache first: {path}. If absent, syncs from the endpoint once and writes the cache there.`,"models.syncingModels":`Syncing…`,"models.syncedModels":`Synced {count} models`,"models.syncEndpointTooltip":`Fetch the latest model list from {endpoint} and cache it locally; the cached list replaces the built-in one.`,"models.syncEndpointTooltipGeneric":`Fetch the latest model list from this provider's models endpoint and cache it locally; the cached list replaces the built-in one.`,"models.refreshFromCache":`Refresh from synced cache`,"models.refreshing":`Refreshing…`,"models.refreshFromCacheTooltip":`Re-read pi-web/provider/{provider}/models.json and update only the fields that differ from the current effective definition (manual fields like headers are kept).`,"models.refreshNoDiff":`Synced cache matches the effective definition — nothing to update.`,"models.refreshDone":`Override updated from synced cache.`,"models.refreshTimeout":`Refresh timed out — try again later.`,"models.builtinProviders":`Built-in providers`,"models.customProviders":`Custom providers`,"models.syncSaveFailed":`Save draft before sync failed — sync aborted.`,"models.visibleInChat":`Visible in chat`,"models.visibleModels":`Visible models`,"models.visibleModelsCount":`{visible} / {total} visible`,"models.selectAll":`Select all`,"models.invertSelection":`Invert`,"models.searchModels":`Search models…`,"models.noVisibleModels":`No models.`,"models.filterAll":`All`,"models.filterVisible":`Visible`,"models.filterHidden":`Hidden`,"models.invertDisabledTooltip":`All models are already visible; inverting changes nothing`,"models.openOverride":`Edit override`,"models.overrideHint":`Values shown are the effective definition (built-in merged with saved overrides). Only fields you change are saved as overrides; everything else keeps inheriting the built-in definition.`,"models.removeOverride":`Remove override`,"models.providerNameCollision":`Provider "{provider}" conflicts with built-in "{builtin}" (case-insensitive); model visibility cannot be applied. Rename or remove the provider.`,"models.providerNameCollisionShort":`Name conflicts with built-in provider`,"models.builtinVisibilityBlocked":`Model visibility is disabled: custom provider "{custom}" conflicts with "{builtin}" (case-insensitive). Rename or remove the custom provider.`,"models.discoveryAddSelectedCount":`Add selected ({count})`,"models.dataSourceLabel":`Data source:`,"models.catalogSourceEndpoint":`Models endpoint`,"models.catalogSourceDev":`models.dev catalog`,"models.catalogSourceEndpointTooltip":`Source: Provider's /models endpoint`,"models.catalogSourceDevTooltip":`Source: models.dev built-in catalog (https://models.dev)`,"models.catalogEndpointNotFound":`Model ID not found in the models endpoint response`,"models.catalogOverwriteTitle":`Overwrite existing fields?`,"models.catalogOverwriteBody":`{{count}} field(s) already have values that overwriting would change: {{fields}}. Cancel to fill empty fields only.`,"models.catalogOverwriteConfirm":`Overwrite & fill`,"models.catalogOverwriteCancel":`Fill empty only`,"models.catalogFilling":`Filling details…`,"models.catalogFill":`Fill model details`,"models.catalogFilled":`{count} fields filled`,"models.catalogNoEmptyFields":`No empty fields to fill`,"models.catalogNoExactMatch":`No exact models.dev match`,"models.catalogPriceProvider":`Price matched Provider {provider}`,"models.catalogPriceBaseUrl":`Price matched Base URL to {provider}`,"models.catalogPriceConsensus":`Price agreed by {support}/{total} records`,"models.catalogPriceUnreliable":`No reliable price found`,"models.catalogUndo":`Undo`,"models.baseUrl":`Base URL`,"models.apiKey":`API Key`,"models.api":`API Format`,"models.modelId":`ID *`,"models.name":`Name`,"models.apiOverride":`API override`,"models.reasoningThinking":`Reasoning / thinking`,"models.imageInput":`Image input`,"models.imageInputHint":`Checking writes input: ["text", "image"]; unchecking removes input (falls back to ["text"]).`,"models.nameHint":`Leaving empty removes the name field (falls back to the model id).`,"models.apiOverrideHint":`Leaving empty or picking default removes the api field (falls back to the provider's default api).`,"models.reasoningHint":`Unchecking removes the reasoning field (falls back to off).`,"models.compatBoolTrueHint":`Unchecked does not mean false: pi treats a missing field as true. Unchecking writes explicit false so it can actually be turned off.`,"models.compatBoolHint":`Checking writes true; unchecking removes the field (falls back to auto-detect / false default).`,"models.compatSelectHint":`Picking default/none removes the field (falls back to auto-detect).`,"models.thinkingLevelMapHint":`Per level: Default = removes that mapping (falls back to the model's default level); Disabled = writes null; Custom = writes a custom level string.`,"models.compatSection":`Compatibility`,"models.compatInheritHint":`Fields not set on the model show values inherited from this provider (marked · from provider); the inherited value is what actually takes effect until overridden here.`,"models.inheritedFromProvider":`· from provider`,"models.thinkingFormatDeepseekHint":`Selecting "deepseek" also writes requiresReasoningContentOnAssistantMessages: true; any other value removes it.`,"models.samplingParams":`Sampling params`,"models.headers":`Headers`,"models.modelOverrides":`Model overrides`,"models.supportsDeveloperRole":`Developer role`,"models.supportsLongCacheRetention":`Long cache retention`,"models.supportsUsageInStreaming":`Usage in streaming`,"models.supportsFinishReason":`Finish reason in stream`,"models.supportsEagerToolInputStreaming":`Eager tool input streaming`,"models.supportsCacheControlOnTools":`Cache control on tools`,"models.supportsTemperature":`Temperature param`,"models.requiresToolResultName":`Tool result name required`,"models.requiresAssistantAfterToolResult":`Assistant after tool result`,"models.requiresThinkingAsText":`Thinking as text`,"models.requiresReasoningContentOnAssistantMessages":`Reasoning content on assistant`,"models.zaiToolStream":`z.ai tool stream`,"models.supportsThinkingTokenBudget":`Thinking token budget`,"models.supportsOpenAIGrammarTools":`OpenAI grammar tools`,"models.sendSessionAffinityHeaders":`Session affinity headers`,"models.supportsToolSearch":`Tool search`,"models.supportsExplicitPromptCacheMode":`Explicit prompt cache`,"models.forceAdaptiveThinking":`Adaptive thinking`,"models.allowEmptySignature":`Empty thinking signature`,"models.supportsStrictTools":`Strict tool schemas`,"models.supportsStore":`Store param`,"models.supportsReasoningEffort":`Reasoning effort`,"models.supportsStrictMode":`Strict mode`,"models.supportsToolReferences":`Tool references`,"models.maxTokensField":`Max tokens field`,"models.sessionAffinityFormat":`Session affinity format`,"models.deferredToolsMode":`Deferred tools mode`,"models.cacheControlFormat":`Cache control format`,"models.thinkingFormat":`Thinking format`,"models.chatTemplateKwargs":`Chat template kwargs`,"models.chatTemplateArgs":`Chat template args`,"models.openRouterRouting":`OpenRouter routing`,"models.vercelGatewayRouting":`Vercel gateway routing`,"models.thinkingLevelMap":`Thinking level map`,"models.contextWindow":`Context window (tokens)`,"models.maxOutputTokens":`Max output tokens`,"models.costPerMillion":`Cost (per million tokens)`,"models.apiKeyPlaceholder":`ENV_VAR_NAME, !shell-command, or literal key`,"models.apiKeyHint":`Prefix with ! to run a shell command, or use an env var name`,"models.apiKeyStored":`API key is stored. Enter a new key below to replace it, or disconnect to remove it.`,"models.apiKeyPrompt":`Enter your {provider} API key to enable {count} model{s}.`,"models.apiKeyReplacePlaceholder":`Enter new key to replace…`,"models.oauthAlreadyConnected":`Already connected. You can re-login or disconnect.`,"models.oauthConnectPrompt":`Connect your {provider} account.`,"models.enterValue":`Enter value…`,"models.displayNamePlaceholder":`Display name`,"models.connectionLost":`Connection lost`,"models.networkError":`Network error`,"i18n.testingModel":`Testing model connection...`,"i18n.connected":`Connected`,"i18n.failed":`Failed`,"i18n.test":`Test`,"i18n.testConnection":`Test model connection`,"i18n.provider":`Provider`,"i18n.providers":`Providers`,"i18n.model":`Model`,"i18n.providerName":`Provider name`,"i18n.rename":`Rename`,"i18n.default":`Default`,"i18n.disabled":`Disabled`,"plugins.statusLoaded":`Loaded and active`,"plugins.statusInstalled":`Installed, not yet loaded`,"plugins.statusDisabled":`Disabled`,"plugins.statusMissing":`Configured but package not found`,"plugins.extensionFilters":`Extension filters`,"plugins.filterRules":`Filter rules`,"plugins.managePlugins":`Plugins`,"plugins.extensionFiltersHint":`Filters for auto-discovered extensions in ~/.pi/agent/extensions/ and .pi/extensions/. Only patterns starting with !, +, or - take effect; plain paths do nothing.`,"plugins.noExtensionFilters":`No filters configured`,"plugins.addFilter":`Add filter`,"plugins.filterPatternLabel":`Pattern`,"plugins.filterPlaceholder":`!pattern · +path · -path`,"plugins.filterInvalid":`Pattern must start with !, +, or -; plain paths have no effect in the extensions field.`,"plugins.filterPrefixExclude":`Exclude matching extensions`,"plugins.filterPrefixForceInclude":`Force-include exact path`,"plugins.filterPrefixForceExclude":`Force-exclude exact path`,"plugins.filterEffect":`Effect`,"plugins.removeFilter":`Remove filter`,"plugins.npmSourcePlaceholder":`npm:@scope/package`,"plugins.packageInstalled":`Package installed.`,"plugins.packageUpdated":`Package updated.`,"plugins.packageRemoved":`Package removed.`,"plugins.packageDisabled":`Package disabled.`,"plugins.packageEnabled":`Package enabled.`,"plugins.extensionFilterAdded":`Extension filter added.`,"plugins.extensionFilterRemoved":`Extension filter removed.`,"plugins.sessionReloaded":`Session reloaded.`,"i18n.noResources":`No resources`,"i18n.unknown":`Unknown`,"i18n.installedVersion":`installed {version}`,"i18n.configuredVersion":`configured {version}`,"i18n.extensions":`Extensions`,"i18n.prompts":`Prompts`,"i18n.themes":`Themes`,"i18n.resourceCount":`{count} {label}`,"i18n.extensionShort":`ext`,"i18n.versionShort":`ver`,"i18n.skillShort":`skills`,"i18n.promptShort":`prompts`,"i18n.themeShort":`themes`,"i18n.custom":`Custom`,"i18n.clearAll":`clear all`,"i18n.connectedSuccessfully":`Connected successfully.`,"i18n.notConnected":`not connected`,"i18n.configured":`configured`,"i18n.notConfigured":`not configured`,"i18n.openingBrowser":`Opening browser…`,"i18n.submit":`Submit`,"i18n.login":`Login`,"i18n.relogin":`Re-login`,"i18n.disconnect":`Disconnect`,"i18n.networkError":`Network error`,"i18n.continuing":`Continuing…`,"i18n.skills":`Skills`,"i18n.plugins":`Plugins`,"i18n.addSkill":`Add skill`,"i18n.addPlugin":`Add plugin`,"i18n.recommendedPlugins":`Recommended`,"i18n.selectSkill":`Select a skill`,"i18n.selectPackage":`Select a package`,"i18n.configBindings":`Bound config files`,"i18n.addBinding":`Add`,"i18n.configFileNote":`Note (optional)`,"i18n.bindConfigFile":`Bind config file`,"i18n.selectFile":`Select a file`,"i18n.noConfigBindings":`No config files bound`,"i18n.noFiles":`No files`,"i18n.allFiles":`All files`,"i18n.filterByType":`Filter by type`,"i18n.removeBinding":`Remove binding`,"i18n.confirm":`Confirm`,"i18n.updateAvailable":`Update available`,"i18n.upToDate":`Up to date`,"i18n.automaticChecksUnavailable":`Automatic checks unavailable`,"i18n.checkFailed":`Check failed`,"i18n.installed":`Installed`,"i18n.status":`Status`,"i18n.version":`Version`,"i18n.package":`Package`,"i18n.resources":`Resources`,"i18n.installedPath":`Installed path`,"i18n.readme":`README`,"i18n.readmeDetails":`Details`,"i18n.unsafeLinkBlocked":`Blocked unsafe link (only same-directory or sub-directory relative links are allowed): {href}`,"i18n.resolvedResources":`Resolved Resources`,"i18n.reloadSession":`Reload session`,"i18n.reloading":`Reloading...`,"i18n.packageRemoved":`Package removed.`,"i18n.packageInstalled":`Package installed.`,"i18n.packageUpdated":`Package updated.`,"i18n.packageDisabled":`Package disabled.`,"i18n.packageEnabled":`Package enabled.`,"i18n.sessionReloaded":`Session reloaded.`,"i18n.thinking":`Thinking`,"i18n.loadingThinking":`Loading thinking...`,"i18n.copyMessage":`Copy message`,"i18n.editFromHere":`Edit from here`,"i18n.editFromHereTitle":`Edit from here — branches within this session`,"i18n.newSession":`New session`,"i18n.newSessionTitle":`New session — creates an independent copy from here`,"i18n.estimatedTokens":`Estimated token count while streaming`,"i18n.noOutput":`(no output)`,"i18n.noSummary":`(no summary)`,"i18n.conversationCompacted":`Conversation compacted`,"i18n.compactionDescription":`The conversation history before this point was compacted into the following summary:`,"i18n.fileContext":`File context: {details}`,"i18n.readFiles":`Read files`,"i18n.modifiedFiles":`Modified files`,"i18n.hiddenExtensionMessage":`hidden extension message`,"i18n.noMessage":`(no message)`,"i18n.showExtensionMessage":`Show extension message`,"i18n.collapse":`Collapse`,"i18n.expand":`Expand`,"i18n.hideDetails":`Hide details`,"i18n.showDetails":`Show details`,"i18n.thinkingUnavailable":`Thinking content unavailable`,"i18n.thinkingEncrypted":`Thinking content is encrypted (provider-encrypted for context continuity, plaintext not available)`,"i18n.before":`Before`,"i18n.after":`After`}},v={id:`zh-CN`,label:`简体中文`,messages:{"common.ok":`确定`,"common.language":`语言`,"common.models":`模型`,"common.skills":`技能`,"common.plugins":`插件`,"sidebar.hide":`收起侧边栏`,"sidebar.show":`展开侧边栏`,"theme.light":`切换到浅色模式`,"preferences.defaultThinkingLevel":`默认思考级别`,"preferences.thinkingLevelHint":"新会话的全局默认思考级别(settings.json `defaultThinkingLevel`)。未设置=删除该字段(回落 pi 默认)。","preferences.thinkingLevelNotSet":`未设置(跟随模型默认)`,"preferences.compaction":`自动压缩`,"preferences.compactionHint":"自动压缩长会话(settings.json `compaction`)。未配置时按 pi 默认值展示,改动即写入完整对象。","preferences.compactionEnabled":`启用`,"preferences.compactionReserveTokens":`输出预留词元数`,"preferences.compactionReserveTokensHint":`为模型输出预留的词元数,压缩时保留这部分空间供回复使用`,"preferences.compactionKeepRecentTokens":`压缩后保留词元数`,"preferences.compactionKeepRecentTokensHint":`压缩后保留的词元数,从最近聊天记录开始逆向往前计算`,"preferences.retry":`API 重试`,"preferences.retryHint":"供应商 API 调用的重试设置(settings.json `retry`)。未配置时按 pi 默认值展示,改动即写入完整对象;provider 子字段留空则不写入。","preferences.retryEnabled":`启用重试`,"preferences.retryEnabledHint":`是否对失败的 API 调用启用重试`,"preferences.retryMaxRetries":`最大重试次数`,"preferences.retryBaseDelayMs":`基础延迟(毫秒)`,"preferences.retryBaseDelayMsHint":`首次重试前的初始延迟,单位毫秒`,"preferences.retryProviderTimeoutMs":`供应商超时(毫秒)`,"preferences.retryProviderMaxRetries":`供应商最大重试次数`,"preferences.retryProviderMaxRetryDelayMs":`供应商最大延迟(毫秒)`,"preferences.defaultProjectTrust":`新项目默认信任`,"preferences.projectTrustHint":"新项目的默认信任策略(settings.json `defaultProjectTrust`)。未设置=删除该字段(回落「询问」)。","preferences.projectTrustNotSet":`未设置(询问)`,"preferences.projectTrustAsk":`询问`,"preferences.projectTrustAlways":`总是信任`,"preferences.projectTrustNever":`从不信任`,"preferences.notifyEvents":`通知`,"preferences.notifyEventsHint":`标签页非激活时发浏览器通知。权限在首次交互时请求。`,"notify.permission.request":`开启通知`,"notify.permission.requestHint":`点击开启浏览器通知:任务完成时即使不在本页也会提醒`,"notify.permission.granted":`通知已开启`,"notify.permission.grantedHint":`已开启浏览器通知:任务完成时即使不在本页也会提醒`,"notify.permission.bannerHintBefore":`点击左上工具栏的`,"notify.permission.bannerHintAfter":`按钮开启通知权限,任务完成、出错或提问时都能收到浏览器通知,详细设置可在 配置中心 → 会话 → 通知 栏目中调整`,"notify.permission.denied":`通知被阻止`,"notify.permission.deniedHint":`浏览器阻止了通知。请点击地址栏左侧图标 → 站点设置,将通知改为允许后重试`,"preferences.notifyWhileActive":`页面激活时也通知`,"preferences.notifyTaskComplete":`任务完成`,"preferences.notifyErrors":`运行出错`,"preferences.notifyQuestions":`提问`,"preferences.subagentsDefaultModel":`子代理默认模型`,"preferences.subagentsDefaultThinking":`子代理默认思考级别`,"preferences.subagentsHint":"子代理默认配置(settings.json `subagents`)。defaultThinking 未设置=删除该子字段(回落 pi 默认)。","preferences.subagentsModelPlaceholder":`供应商/模型-id`,"theme.dark":`切换到深色模式`,"theme.toggleTheme":`切换主题`,"theme.darkMode":`深色`,"theme.lightMode":`浅色`,"theme.fontSize":`字体大小`,"theme.scrollStep":`悬停滚动步长`,"scrollStep.hint":`悬停滚动方向箭头时,内容每次滚动的像素数(面板滚动箭头与消息地图共用此步长)。`,"scrollStep.range":`每次悬停滚动像素(1-1000)`,"scrollStep.unit":`px`,"theme.autoReloadSeconds":`自动重载聊天消息间隔`,"autoReload.off":`关闭(0)— 不自动刷新`,"autoReload.range":`秒(0 — 3600)`,"autoReload.unit":`秒`,"autoReload.hint":`自动重新读取会话文件的间隔秒数;0 = 关闭。单客户端场景(消息经 SSE 实时推送)保持 0 即可;多客户端协作(多个浏览器同时操作同一会话)时设为大于 0,各客户端定时刷新以读取其他客户端生成的新聊天消息。`,"longBlock.hint":`“块”指思维链(thinking)和工具调用(tool call)。正文超过阈值时折叠为头尾摘要,点击可展开查看全文。`,"recentBlocks.hint":`流式渲染过程中和刚刚完成的块不计入数量(最新完成的块始终展开)。本值表示除此之外,额外保持展开的最近已完成块数。`,"autoReload.reset":`恢复默认({n} 秒)`,"chat.reloadFromDisk":`从磁盘重新加载会话`,"chat.reloadFromDiskHint":`当多个客户端同时读写同一个会话 jsonl 时使用。可在 配置中心 → 会话 页面设置自动定时重载。`,"scrollStep.reset":`恢复默认({n} px)`,"theme.longBlockCollapse":`长块折叠阈值`,"theme.recentBlocksExpanded":`最近完成块保持展开数`,"layout.sidebarWidth":`左侧面板宽度`,"layout.widgetPanelWidth":`右侧面板宽度`,"layout.widthRange":`px({min}–{max})`,"layout.widthReset":`恢复默认({value} px)`,"longBlock.range":`字符数(20-10000)`,"longBlock.chars":`字符`,"longBlock.blocks":`个`,"longBlock.reset":`恢复默认({n} 字符)`,"recentBlocks.reset":`恢复默认({n} 个)`,"recentBlocks.range":`0-20,不含最新完成的块`,"longBlock.expandHint":`… 中间 {n} 字符已折叠 · 点击展开`,"longBlock.collapse":`点击收起`,"history.full":`完整历史`,"history.unsaved":`会话保存后才能查看完整历史`,"title.generating":`正在生成...`,"title.updated":`标题已更新`,"title.failed":`生成失败`,"title.generate":`生成标题`,"title.unsaved":`会话保存后才能生成标题`,"title.noMessages":`请先发送消息,再为会话命名`,"title.generateSession":`生成会话标题`,"system.prompt":`系统提示词`,"system.empty":`系统提示词为空(工具已禁用)`,"system.load":`发送消息以加载系统提示词`,"session.info":`会话信息`,"session.reload":`重载会话(重读配置与资源)`,"session.name":`名称`,"session.file":`文件`,"session.inMemory":`内存中`,"session.id":`ID`,"session.user":`用户`,"session.assistant":`助手`,"session.toolCalls":`工具调用`,"session.toolResults":`工具结果`,"session.total":`总计`,"session.input":`输入`,"session.output":`输出`,"session.cacheRead":`缓存读取`,"session.cacheWrite":`缓存写入`,"session.inputHint":`未命中缓存的输入 token 数:系统提示、会话历史、工具定义等发送给模型的上下文,减去命中缓存的部分`,"session.outputHint":`模型生成回复的 token 数(回答与思考)`,"session.cacheReadHint":`命中 prompt 缓存的 token 数:与上一请求未变的上下文直接从缓存读取,按折扣价计费`,"session.cacheWriteHint":`首次写入缓存的 token 数(Anthropic 风格按写入计费)`,"session.totalHint":`输入 + 输出 + 缓存读取 + 缓存写入`,"session.cacheReadRate":`缓存命中率:命中缓存的 token(缓存读取)占全部输入 prompt(输入 + 缓存读取 + 缓存写入)的比例,即官方口径 cacheRead ÷ (input + cacheRead + cacheWrite)`,"session.cost":`费用`,"session.context":`上下文`,"session.copy":`复制{value}`,"session.copied":`已复制`,"session.title":`会话信息`,"session.load":`发送消息或运行 /session 以加载会话信息`,"session.infoSection":`会话信息`,"session.messages":`消息`,"session.tokens":`Token`,"session.copyFile":`复制文件路径`,"session.copyId":`复制会话 ID`,"workspace.opening":`正在打开工作区...`,"workspace.unable":`无法打开工作区`,"workspace.selectSession":`从侧边栏选择一个会话`,"workspace.selectWorkspace":`请选择工作区`,"workspace.stepProject":`从侧边栏选择项目目录`,"workspace.stepModels":`点击底部的“模型”按钮添加模型`,"tabs.chat":`聊天`,"tabs.widgets":`小组件`,"config.title":`配置`,"config.section.session":`会话`,"config.section.appearance":`外观`,"config.section.advanced":`高级`,"config.section.startScreen":`开始屏幕`,"config.section.git":`Git`,"config.section.modelThinking":`思考级别`,"config.section.requiresCwd":`请先从侧边栏选择项目目录,再浏览插件 / 技能`,"preferences.pi.unset":`pi 默认`,"preferences.pi.enableAnalytics":`启用分析`,"preferences.pi.enableAnalyticsHint":"发送匿名使用分析(settings.json `enableAnalytics`)","preferences.pi.enableInstallTelemetry":`启用安装遥测`,"preferences.pi.enableInstallTelemetryHint":"发送匿名安装遥测(settings.json `enableInstallTelemetry`)","preferences.pi.httpProxy":`HTTP 代理`,"preferences.pi.httpProxyHint":"HTTP 请求的代理地址(settings.json `httpProxy`)。留空无法清除已设置的值。","preferences.pi.trackingId":`分析跟踪 ID`,"preferences.pi.trackingIdHint":"自定义分析跟踪 ID(settings.json `trackingId`)。留空无法清除已设置的值。","preferences.pi.httpIdleTimeoutMs":`HTTP 空闲超时(毫秒)`,"preferences.pi.httpIdleTimeoutMsHint":"HTTP 空闲超时毫秒数(settings.json `httpIdleTimeoutMs`)。留空无法清除已设置的值。","preferences.pi.websocketConnectTimeoutMs":`WebSocket 连接超时(毫秒)`,"preferences.pi.websocketConnectTimeoutMsHint":"WebSocket 连接超时毫秒数(settings.json `websocketConnectTimeoutMs`)。留空无法清除已设置的值。","preferences.pi.branchSummary":`分支摘要`,"preferences.pi.branchSummaryHint":"分支摘要自动压缩(settings.json `branchSummary`)","preferences.pi.reserveTokens":`预留 token`,"preferences.pi.skipPrompt":`跳过提示`,"preferences.pi.images":`图片处理`,"preferences.pi.imagesHint":"pi 引擎如何处理图片(settings.json `images`)","preferences.pi.autoResize":`自动缩放`,"preferences.pi.autoResizeHint":"压缩 `read` 等工具返回的图片以节省 token。","preferences.pi.blockImages":`阻止图片`,"preferences.pi.blockImagesHint":`在消息发送给模型前移除所有图片内容。`,"config.files.hint":`直接编辑 pi 的配置文件(JSON)。保存前校验,写前自动备份(保留最近 10 份)。`,"config.widgets.empty":`暂无小组件配置。插件弹出小组件时会自动在此创建条目。`,"config.widgets.x":`x`,"config.widgets.y":`y`,"config.widgets.width":`宽`,"config.widgets.height":`高`,"config.widgets.bind":`绑定消息`,"config.widgets.bindTitle":`绑定自定义消息`,"config.widgets.bindHint":`为小组件「{key}」绑定一条快捷消息`,"config.widgets.editTitle":`编辑快捷消息`,"config.widgets.editHint":`修改标题、内容与发送方式。`,"config.widgets.label":`描述`,"config.widgets.labelPlaceholder":`按钮显示的文字(如:重载)`,"config.widgets.message":`消息内容`,"config.widgets.messagePlaceholder":`斜杠命令或任意文本(如 /reload)`,"config.widgets.sendImmediately":`立即发送`,"config.widgets.sendMode":`发送方式`,"config.widgets.fillToChatInput":`填充到聊天框`,"config.widgets.sendImmediatelyTooltip":`立即发送:`,"config.widgets.fillToChatInputTooltip":`填充到聊天框:`,"config.widgets.nameConflict":`名称「{label}」已存在,请换一个名称`,"config.startScreen.nameConflict":`名称「{label}」已存在,请换一个名称`,"config.widgets.confirm":`确认`,"config.widgets.unbindTitle":`解绑消息`,"config.widgets.unbindConfirm":`确定解绑「{label}」?`,"config.widgets.unbind":`解绑`,"config.startScreen.hint":`新会话开始屏幕(Pi Logo 下方)展示的快捷入口;点击后按各条绑定的发送方式立即发送或填充到聊天输入框。`,"config.startScreen.bind":`绑定消息`,"config.startScreen.bindTitle":`绑定快捷消息`,"config.startScreen.bindHint":`为开始屏幕绑定一条快捷消息。`,"config.startScreen.editTitle":`编辑快捷消息`,"config.startScreen.editHint":`修改标题、内容与发送方式。`,"config.startScreen.empty":`暂无快捷消息,开始屏幕不会显示快捷入口。`,"config.startScreen.unbindTitle":`解绑消息`,"config.startScreen.unbindConfirm":`确定解绑「{label}」?`,"config.startScreen.unbind":`解绑`,"config.startScreen.reset":`重置`,"config.startScreen.resetHint":`恢复内置默认快捷消息;保留你自绑定的消息(与默认同名的会被默认项覆盖)。`,"config.files.save":`保存`,"config.files.saving":`保存中...`,"config.files.saved":`已保存`,"config.files.missing":`尚未创建`,"config.files.placeholder":`从左侧选择要编辑的配置文件`,"layout.resizeSidebar":`调整侧边栏宽度`,"layout.resizeWidgetPanel":`调整小组件面板宽度`,"layout.resizeHint":`拖动调整宽度。双击或按 Enter 恢复默认值。`,"sidebar.newWorkspace":`新增工作区`,"sidebar.searchSessions":`搜索会话`,"sidebar.searchSessionsPlaceholder":`搜索会话…`,"sidebar.justNow":`刚刚`,"sidebar.minutesAgo":`{count} 分钟前`,"sidebar.hoursAgo":`{count} 小时前`,"sidebar.daysAgo":`{count} 天前`,"sidebar.searchSessionsNoResults":`无匹配会话`,"sidebar.newSessionTitle":`在 {path} 中新建会话`,"sidebar.refresh":`刷新`,"directoryPicker.selectDirectory":`选择目录`,"directoryPicker.goToParent":`转到上级目录`,"directoryPicker.directoryPath":`目录路径`,"directoryPicker.goToDirectory":`转到目录`,"directoryPicker.go":`转到`,"directoryPicker.loadingDirectories":`正在加载目录…`,"directoryPicker.noSubdirectories":`没有子目录`,"directoryPicker.openBeforeSelecting":`选择前请先打开此路径`,"directoryPicker.selectCurrentDirectory":`选择当前目录`,"directoryPicker.selectThisFolder":`选择此文件夹`,"directoryPicker.noDrives":`未找到盘符`,"directoryPicker.search":`筛选文件夹`,"directoryPicker.noMatches":`没有匹配的文件夹`,"sidebar.checking":`检查中…`,"sidebar.open":`打开`,"sidebar.cancel":`取消`,"sidebar.openRepoRoot":`worktree 切换不可用`,"sidebar.openRepoRootTitle":`worktree 切换功能当前不可用:请先在侧栏将当前工作目录切换到 Git 仓库根目录。`,"sidebar.gitRepoRootOnly":`仅 Git 仓库根目录`,"sidebar.gitRepoRootOnlyTitle":`只能在 Git 仓库根目录使用 worktree。`,"sidebar.worktrees":`Worktrees...`,"sidebar.checkingWorktrees":`正在检查此目录的 worktree。`,"sidebar.filterWorktrees":`筛选 worktree…`,"sidebar.noMatchingWorktrees":`没有匹配的 worktree`,"sidebar.switchWorktree":`切换 worktree`,"sidebar.switchWorktreeTitle":`切换 worktree:{path}`,"sidebar.main":`主分支`,"sidebar.forceRemoveCheckout":`存在未提交的更改。强制移除 checkout?`,"sidebar.force":`强制移除`,"sidebar.createWorktreeTitle":`为分支创建 worktree checkout`,"sidebar.newWorktree":`新建 worktree…`,"sidebar.branchName":`分支名称`,"sidebar.creating":`创建中…`,"sidebar.create":`创建`,"sidebar.uploadFilesTitle":`将文件上传到项目根目录`,"sidebar.uploadFiles":`上传文件`,"sidebar.refreshExplorer":`刷新文件浏览器`,"sidebar.changedFiles":`{count} 个变更文件`,"sidebar.loading":`加载中...`,"sidebar.sessionDeleted":`会话已删除,请选择其他会话`,"sidebar.noSessions":`未找到会话`,"sidebar.workspace":`工作区`,"sidebar.newActivity":`有新活动`,"sidebar.newSessionActivity":`会话有新活动`,"sidebar.interactionBadge":`会话等待交互响应`,"sidebar.deleteSession":`删除 {title}?`,"sidebar.deleteWorkspace":`删除工作区({count} 个会话)?`,"sidebar.deleteWorkspaceTitle":`删除此工作区及其所有会话`,"sidebar.copyPath":`复制完整路径`,"sidebar.rename":`重命名`,"sidebar.delete":`删除`,"sidebar.deleteWithShiftClick":`删除(按住 Shift 点击可跳过确认)`,"sidebar.expandForks":`展开分叉`,"sidebar.collapseForks":`折叠分叉`,"sidebar.disconnect":`断开`,"sidebar.messagesCount":`{count} 条消息`,"sidebar.worktreePath":`Worktree:{path}`,"sidebar.removeWorktreeTitle":`移除 worktree checkout {path};保留分支`,"files.modified":`已修改`,"files.added":`已添加`,"files.deleted":`已删除`,"files.renamed":`已重命名`,"files.untracked":`未跟踪`,"files.conflict":`冲突`,"files.newlyUploaded":`刚上传`,"files.containsChangedFiles":`包含已更改文件`,"files.insertPath":`将路径插入聊天`,"files.mention":`提及`,"files.download":`下载文件`,"files.dismissError":`关闭错误`,"files.addUploadedFile":`将上传的文件添加到聊天`,"files.addAllUploadedFiles":`将所有上传的文件添加到聊天`,"files.dismissUploadResults":`关闭上传结果`,"files.loading":`正在加载文件...`,"files.noFiles":`未找到文件`,"loading.inProgress":`处理中…`,"loading.more":`还有 {count} 项…`,"errors.title":`错误`,"errors.titleCount":`错误({count})`,"errors.close":`关闭`,"errors.clearAll":`全部清除`,"files.notFound":`(暂无文件)`,"files.accessDenied":`访问被拒绝`,"files.empty":`(空)`,"files.uploadFailed":`{count} 个失败`,"files.explorer":`文件浏览器`,"files.changedCount":`{count} 个文件`,"files.stagedPrefix":`已暂存:`,"files.unstagedPrefix":`未暂存:`,"files.noStagedChanges":`暂无已暂存文件`,"files.noUnstagedChanges":`暂无变更文件`,"files.commitMessagePlaceholder":`提交信息`,"files.commit":`提交`,"files.push":`推送到远端(含 tag)`,"files.pushing":`推送中...`,"files.pushSuccess":`推送成功`,"files.pushFailed":`推送失败`,"files.pushUpToDate":`已与远端同步,无需推送`,"files.pull":`从远端拉取`,"files.pulling":`拉取中...`,"files.pullSuccess":`拉取成功`,"files.pullFailed":`拉取失败`,"files.pullUpToDate":`已与远端同步,无需拉取`,"files.pullNonFastForward":`拉取被拒绝——本地与远端已分叉。请在终端使用 git pull --rebase 或 --merge 处理。`,"files.committing":`提交中…`,"files.commitMessageRequired":`请先填写 commit message`,"files.commitTitle":`提交更改`,"files.confirmStageAllCommit":`是否暂存全部 {count} 个改动文件并提交?`,"files.stageAllAndCommit":`暂存并提交`,"files.stageFile":`暂存文件`,"files.unstageFile":`取消暂存`,"files.changeStats":`{count} 个变更文件,新增 {additions} 行,删除 {deletions} 行`,"git.groupTitle":`智能提交信息生成`,"git.commitModel.followCurrent":`跟随当前会话模型`,"git.commitModel.followCurrentHint":`开启后,生成提交信息时动态使用当前聊天的主模型;关闭则使用下方固定的模型(推荐使用免费小模型)。`,"git.commitModel.followCurrentOn":`已开启:跟随当前会话`,"git.commitModel.followCurrentOff":`已关闭:使用固定模型`,"git.commitModel.fixedModel":`固定模型`,"git.commitModel.fixedModelHint":`关闭“跟随当前会话”时使用的模型(建议选择固定的免费小模型,注意其上下文可能仅 5 万)。`,"git.commitModel.selectPlaceholder":`选择模型`,"git.commitModel.noModels":`暂无可用模型`,"git.commitModel.notConfiguredHint":`尚未选择固定模型,请先选择一个模型后再使用智能生成。`,"git.ai.generate":`智能生成`,"git.ai.generating":`生成中…`,"git.ai.notConfiguredTitle":`未配置模型`,"git.ai.notConfiguredDesc":`尚未为智能生成指定模型,请前往配置中心 → Git 指定模型后再试。`,"git.ai.goToConfig":`前往配置`,"git.ai.noSession":`跟随模式需要先选择一个会话`,"git.ai.noSessionModel":`当前会话无可用模型,请先在聊天中选择模型`,"git.commitModel.maxTokens":`最大输出长度`,"git.commitModel.maxTokensHint":`单次智能生成允许的最大输出 token 数(64–4096,默认 512)。已尽量降低推理开销:支持关闭的模型会关闭推理,不支持的会降至最低档位。`,"git.commitModel.autoGenerateOnEmpty":`空输入框时提交自动先智能生成`,"git.commitModel.autoGenerateOnEmptyHint":`开启后,点击提交时若输入框为空,会先自动调用智能生成填入信息再提交;仅在已指定模型时生效,未指定模型时空输入框仍禁用提交。默认开启。`,"git.ai.invalidModel":`已配置的模型格式无效,请前往配置中心重新选择`,"git.ai.autoGenerateOn":`已开启:空输入框自动生成`,"git.ai.usingCurrentModel":`使用聊天主模型`,"git.ai.usingModel":`使用 {model}`,"git.ai.generateAndCommit":`智能生成信息并提交`,"git.ai.autoGenerateOff":`已关闭`,"git.commitSectionTitle":`提交`,"git.commitConfirmStageAll":`提交时需确认“暂存全部”`,"git.commitConfirmStageAllHint":`开启后,未暂存时点击提交会先弹出“暂存全部并提交”确认框;关闭则直接暂存全部并提交。默认开启。`,"git.commitConfirmStageAllOn":`已开启:提交前确认`,"git.commitConfirmStageAllOff":`已关闭:直接暂存全部`,"modelThinking.desc":`为每个模型或 Provider 记忆上次选择的思考级别。切换模型时自动选中记忆的档位;若该模型的可用档位不含记忆值则回退到 auto(跟随默认)。支持全部 7 档:off / minimal / low / medium / high / xhigh / max。`,"modelThinking.byModel":`按模型`,"modelThinking.byProvider":`按 Provider`,"modelThinking.byProviderHint":`Provider 级别为回退:同 Provider 下未单独记忆的模型会使用此值。`,"modelThinking.emptyModel":`暂无按模型的记忆。切换模型后用下方思考级别下拉选择,自动记忆;也可在此添加。`,"modelThinking.emptyProvider":`暂无按 Provider 的记忆。`,"modelThinking.selectModelPlaceholder":`选择模型`,"modelThinking.selectProviderPlaceholder":`选择 Provider`,"modelThinking.providerInputPlaceholder":`或输入 Provider 名称`,"modelThinking.footerHint":`配置保存到独立文件 pi-web/model-thinking.json,不影响主配置;仅作用于 UI 下拉,不拦截 pi 的 thinking 调用。`,"common.add":`添加`,"common.delete":`删除`,"files.conflictSummary":`已有 {count} 个文件:{files}`,"files.cannotReplace":`无法替换:{files}`,"files.replace":`替换`,"files.skipExisting":`跳过已有文件`,"files.cancel":`取消`,"files.checking":`正在检查文件`,"files.uploading":`正在上传,{progress}%`,"files.search":`搜索文件`,"files.searchPlaceholder":`搜索文件...`,"chat.loadingSession":`正在加载会话...`,"chat.loadingWindow":`正在加载消息...`,"chat.runningTool":`正在运行工具...`,"chat.runningNamedTool":`正在运行 {name}...`,"chat.runningTools":`正在运行 {names}...`,"chat.runningToolsMore":`正在运行 {names}(另有 {count} 个)...`,"chat.waitingModel":`正在等待模型...`,"chat.turnDuration":`耗时 {duration}`,"chat.aiQuestion":`AI 提问`,"chat.runningCommand":`正在运行命令...`,"chat.totalElapsed":`总计 {total}`,"chat.thinking":`正在思考...`,"chat.message":`条消息`,"chat.messages":`条消息`,"chat.toolCall":`次工具调用`,"chat.toolCalls":`次工具调用`,"chat.collapseProcess":`收起处理详情`,"chat.expandProcess":`展开处理详情`,"chat.loadEarlier":`向上滚动以加载更早的消息(隐藏 {count} 条)`,"chat.searchMessages":`搜索消息`,"chat.clearSearch":`清空搜索关键字`,"chat.scrollToLatest":`滚动到最新消息`,"chat.expandMessage":`展开完整内容`,"chat.searchPlaceholder":`搜索聊天消息…`,"chat.searchNoResults":`没有结果`,"chat.searchResults":`{count} 个结果`,"chat.extensionRequest":`扩展请求`,"chat.cancel":`取消`,"chat.confirm":`确认`,"chat.submit":`提交`,"chat.extensionInput":`扩展终端输入`,"chat.extensionSelect":`请选择`,"chat.extensionConfirm":`确认`,"chat.extensionEditor":`编辑`,"chat.extensionPanel":`扩展面板`,"chat.close":`关闭`,"chat.notifyErrorTitle":`错误`,"chat.notifyWarningTitle":`警告`,"chat.queued":`已排队 · {count}`,"chat.recall":`移回输入框`,"chat.recallTitle":`移除所有排队消息并放回输入框编辑(输入框为空时按回车也可触发)`,"chat.retrying":`正在重试({attempt}/{max})…`,"chat.loadingCommands":`正在加载命令...`,"chat.slashCommands":`斜杠命令 · {label}`,"chat.tabEnter":`Tab / Enter`,"chat.noCommands":`未找到扩展、提示词或技能命令`,"chat.match":`1 个匹配项`,"chat.matches":`{count} 个匹配项`,"chat.command":`1 个命令`,"chat.commands":`{count} 个命令`,"chat.loadingFiles":`正在加载文件...`,"chat.files":`文件 · {label}{hint}`,"chat.searching":`搜索中…`,"chat.noMatchingFiles":`未找到匹配的文件`,"chat.searchingAll":` · 正在搜索所有文件…`,"chat.indexTruncated":` · 索引不完整`,"chat.steerPlaceholder":`立即引导 / 排队后续消息...`,"chat.recallPlaceholder":`回车撤回排队消息到输入框编辑,或输入新消息…`,"chat.agentPlaceholder":`Agent 运行中…`,"chat.messagePlaceholder":`消息…输入 / 使用命令,@ 引用文件,! 执行命令`,"chat.questionNotificationTitle":`Pi — 提问`,"chat.taskCompleteNotificationTitle":`Pi — 任务完成`,"chat.taskErrorNotificationTitle":`Pi — 出错`,"chat.sessionCompletedNotificationBody":`会话 {name} 已完成`,"chat.questionNotificationDenied":`通知被拒绝:在浏览器站点设置中允许后,切走页面时才会收到提问提醒。`,"chat.steer":`引导`,"chat.followUp":`后续消息`,"chat.queueImageBlocked":`运行中无法排队发送带图片的附件`,"chat.steerTooltip":`在当前调用结束后立即发送这条消息`,"chat.followUpTooltip":`在智能体结束后排队发送这条消息`,"chat.send":`发送`,"chat.attachImage":`附加图片`,"chat.filterModels":`筛选模型…`,"chat.noMatchingModels":`没有匹配的模型`,"chat.moreControls":`更多控件`,"chat.collapseControls":`收起控件`,"chat.shell":`Shell`,"chat.outputLocal":`输出保留在本地`,"chat.outputModel":`输出发送给模型`,"chat.noTools":`不使用工具,仅只读`,"chat.builtInTools":`{count} 个内置工具`,"chat.allBuiltInTools":`全部内置工具`,"chat.changeReasoning":`更改推理级别:{level}`,"chat.changeReasoningLabel":`更改推理级别`,"chat.changeToolPreset":`更改工具预设`,"chat.stopCompaction":`停止压缩`,"chat.compactContext":`压缩上下文`,"chat.compacting":`正在压缩…`,"chat.compact":`压缩`,"chat.stopAgent":`停止 Agent`,"chat.stop":`停止`,"chat.disableSound":`关闭完成提示音`,"chat.enableSound":`开启完成提示音`,"chat.thinkingUseDefault":`使用 pi 默认设置`,"chat.thinkingOff":`关闭推理`,"chat.thinkingMinimal":`最低限度推理`,"chat.thinkingLow":`低强度推理`,"chat.thinkingMedium":`中等强度推理`,"chat.thinkingHigh":`高强度推理`,"chat.thinkingXhigh":`超高强度推理`,"chat.thinkingMax":`最高强度推理`,"chat.thinkingMapTitle":`高级思考级别未配置`,"chat.thinkingMapBody":`pi 默认只支持 high 级别。若要开启 {level} 级别推理,请在 配置 → 模型 页面为该模型配置「推理级别映射」。`,"chat.thinkingMapGo":`立即前往`,"chat.builtIn":`内置`,"chat.extensions":`扩展`,"chat.prompts":`提示词`,"chat.skills":`技能`,"chat.dormant":`休眠`,"chat.commandCompact":`压缩上下文,可选附加说明`,"chat.commandReload":`重新加载扩展、技能、提示词和工具`,"chat.commandName":`设置会话显示名称`,"chat.commandSession":`显示会话消息、Token 和费用统计`,"chat.commandCopy":`复制最后一条助手消息`,"chat.compacted":`已压缩`,"chat.tokensSaved":`节省 {saved}`,"i18n.close":`关闭`,"i18n.resizeList":`调整 {name} 列表大小`,"widgets.title":`小组件`,"widgets.reopen":`重新弹出`,"widgets.expandedToChat":`小组件[{key}]已展开到聊天页面`,"widgets.collapse":`收起`,"widgets.open":`展开小组件`,"i18n.copy":`复制`,"i18n.copied":`已复制`,"i18n.cancel":`取消`,"i18n.save":`保存`,"i18n.saving":`保存中…`,"i18n.saved":`已保存`,"i18n.saveChanges":`保存更改`,"i18n.noThinking":`无思考内容`,"i18n.remove":`移除`,"i18n.removing":`移除中…`,"i18n.delete":`删除`,"i18n.loading":`加载中...`,"i18n.searchPlaceholder":`搜索…`,"i18n.noMatch":`无匹配`,"i18n.search":`搜索`,"i18n.refresh":`刷新`,"i18n.update":`更新`,"i18n.updating":`更新中...`,"i18n.check":`检查`,"i18n.checking":`检查中...`,"i18n.install":`安装`,"i18n.installing":`安装中...`,"i18n.noResults":`没有结果`,"i18n.searchProviders":`搜索 Provider…`,"i18n.noProviders":`没有匹配的 Provider`,"i18n.newModel":`新模型`,"i18n.addProvider":`添加 Provider`,"i18n.selectProviderModel":`选择 Provider 或模型`,"i18n.visibleInPrompt":`在模型提示词中可见,点击以禁用`,"i18n.hiddenFromPrompt":`在模型提示词中隐藏,点击以启用`,"i18n.dormant":`休眠`,"i18n.hiddenButInvocable":`对模型隐藏,仍可手动调用`,"i18n.skillSearchPlaceholder":`例如 react、testing、deploy`,"i18n.searching":`搜索中…`,"i18n.noSkills":`未找到技能`,"i18n.checkUpdates":`检查更新`,"i18n.updates":`项更新`,"i18n.noResolvedResources":`没有已解析资源`,"i18n.enablePackage":`启用包`,"i18n.disablePackage":`禁用包`,"i18n.filtered":`已筛选`,"i18n.openSessionToReload":`打开会话后才能重新加载`,"i18n.notFound":`未找到`,"i18n.noPlugins":`未配置插件`,"trust.resourcesNotLoaded":`受限模式`,"trust.trustProject":`信任项目`,"trust.trusting":`正在信任...`,"trust.cancel":`取消`,"trust.dialogTitle":`信任此项目?`,"trust.dialogBody":`项目资源可以运行本地代码。请仅信任你了解其内容的项目。`,"trust.skillsNotLoaded":`此项目尚未受信任,项目技能未加载。`,"trust.pluginsNotLoaded":`此项目尚未受信任,项目插件未加载。`,"trust.projectScopeUnavailable":`项目资源未加载时,无法安装到项目范围。`,"i18n.creatingSession":`正在创建新会话…`,"i18n.creating":`创建中…`,"i18n.subscription":`订阅`,"i18n.subscriptions":`订阅服务`,"i18n.customEndpoint":`自定义端点格式`,"i18n.noChanges":`没有更改`,"i18n.branches":`分支`,"i18n.noActiveSession":`没有活动会话`,"i18n.noActiveSessionToCompact":`没有活动会话可压缩`,"i18n.noActiveSessionToReload":`没有活动会话可重新加载`,"i18n.noActiveSessionToName":`没有活动会话可命名`,"i18n.noAssistantMessageToCopy":`没有可复制的助手消息`,"i18n.commandCompleted":`命令已完成`,"i18n.commandFailed":`命令失败`,"i18n.extensionCommandFailed":`扩展命令失败`,"i18n.compactedContext":`上下文已压缩`,"i18n.reloadedSessionResources":`会话资源已重新加载`,"i18n.usageName":`用法:/name <名称>`,"i18n.sessionRenamedTo":`会话已重命名为 {name}`,"i18n.copiedLastAssistantMessage":`已复制最后一条助手消息`,"i18n.failedToRecallQueuedMessages":`恢复排队消息失败`,"i18n.noBranches":`此会话没有分支`,"i18n.source":`源代码`,"i18n.preview":`预览`,"i18n.diff":`Diff`,"i18n.downloadFile":`下载文件`,"i18n.liveSync":`实时同步已启用`,"i18n.notWatching":`未监视`,"i18n.fileViewMode":`文件视图模式`,"i18n.editMode":`编辑模式`,"i18n.viewMode":`查看模式`,"i18n.compareHead":`比较工作区与 HEAD`,"i18n.mentionSelectedLines":`提及所选行`,"i18n.disableWrap":`禁用自动换行`,"i18n.enableWrap":`启用自动换行`,"i18n.editFile":`编辑文件`,"i18n.saveFile":`保存`,"i18n.saveFileShortcut":`保存(Ctrl/Cmd+S)`,"i18n.cancelEdit":`取消`,"i18n.saveFailed":`保存失败:{error}`,"i18n.unsavedChanges":`有未保存的修改`,"i18n.htmlPreview":`HTML 预览`,"i18n.previewFile":`预览 {file}`,"i18n.invalidMermaid":`Mermaid 图表无效`,"i18n.renderingMermaid":`正在渲染 Mermaid 图表`,"i18n.previewAfterStreaming":`流式输出完成后可预览`,"i18n.showMermaidSource":`显示 Mermaid 源码`,"i18n.previewMermaid":`预览 Mermaid 图表`,"i18n.openMermaidViewer":`打开图表查看器`,"i18n.mermaidViewer":`Mermaid 图表查看器`,"i18n.mermaidDiagram":`Mermaid 图表`,"i18n.zoomOut":`缩小`,"i18n.zoomIn":`放大`,"i18n.fitToWidth":`适应宽度`,"models.discoveryFetching":`正在导入模型…`,"models.deleteProviderConfirm":`确定删除 provider「{name}」?该操作会立即写入 models.json,其全部配置(含 API key)将被移除且无法恢复。`,"models.removeModelConfirm":`确定移除模型「{model}」?该操作会立即写入 models.json 且无法恢复。`,"models.discoveryTitle":`导入模型`,"models.discoveryFetch":`导入模型…`,"models.discoveryFilterPlaceholder":`筛选 {count} 个模型…`,"models.discoveryFilter":`筛选上游模型`,"models.discoverySelectShown":`选择当前结果`,"models.discoveryNoMatches":`没有匹配的模型。`,"models.discoveryAdded":`已添加`,"models.discoveryShowing":`显示前 {shown} 个,共 {total} 个`,"models.discoveryFetched":`已获取 {count} 个模型`,"models.discoveryAddSelected":`添加所选模型`,"models.setDefault":`设为默认`,"models.defaultModel":`默认模型`,"models.syncEndpoint":`从端点同步`,"models.lastSyncedAt":`上次同步:{time}`,"models.neverSynced":`未同步过`,"models.discoveryFetchTooltip":`优先从本地缓存导入:{path};无缓存时自动执行一次从端点同步并写入该缓存。`,"models.syncingModels":`同步中…`,"models.syncedModels":`已同步 {count} 个模型`,"models.syncEndpointTooltip":`从 {endpoint} 拉取最新模型列表并缓存到本地;有缓存时优先于内置列表使用。`,"models.syncEndpointTooltipGeneric":`从该供应商的 models 端点拉取最新模型列表并缓存到本地;有缓存时优先于内置列表使用。`,"models.refreshFromCache":`从同步缓存刷新`,"models.refreshing":`刷新中…`,"models.refreshFromCacheTooltip":`重新读取 pi-web/provider/{provider}/models.json,只更新与当前生效定义不同的字段(headers 等手动字段保留)。`,"models.refreshNoDiff":`同步缓存与当前生效定义一致,无需更新。`,"models.refreshDone":`已从同步缓存更新覆写字段。`,"models.refreshTimeout":`刷新超时,请稍后重试。`,"models.builtinProviders":`内置 Provider`,"models.customProviders":`自定义 Provider`,"models.syncSaveFailed":`同步前保存草稿失败,已中止同步。`,"models.visibleInChat":`聊天可见`,"models.visibleModels":`可见模型`,"models.visibleModelsCount":`可见 {visible} / 共 {total}`,"models.selectAll":`全选`,"models.invertSelection":`反选`,"models.searchModels":`搜索模型…`,"models.noVisibleModels":`无模型。`,"models.filterAll":`全部`,"models.filterVisible":`可见`,"models.filterHidden":`隐藏`,"models.invertDisabledTooltip":`所有模型均已可见,反选不会改变任何状态`,"models.openOverride":`编辑覆写`,"models.overrideHint":`当前显示为合并后的有效值(内置定义 + 已保存的覆写)。只有你修改过的字段会作为覆写保存,其余字段继续继承内置定义。`,"models.removeOverride":`移除覆写`,"models.providerNameCollision":`Provider "{provider}" 与内置 "{builtin}"(大小写不敏感)冲突,模型可见性无法生效,请重命名或删除该 provider。`,"models.providerNameCollisionShort":`与内置 provider 撞名`,"models.builtinVisibilityBlocked":`模型可见性已禁用:自定义 provider "{custom}" 与 "{builtin}"(大小写不敏感)冲突,请重命名或删除该自定义 provider。`,"models.discoveryAddSelectedCount":`添加所选模型({count})`,"models.dataSourceLabel":`数据来源:`,"models.catalogSourceEndpoint":`模型端点`,"models.catalogSourceDev":`models.dev 目录`,"models.catalogSourceEndpointTooltip":`数据来源:Provider 的 /models 端点`,"models.catalogSourceDevTooltip":`数据来源:models.dev 内置目录(https://models.dev)`,"models.catalogEndpointNotFound":`模型端点返回中未找到该模型 ID`,"models.catalogOverwriteTitle":`覆盖已有字段?`,"models.catalogOverwriteBody":`以下 {{count}} 个字段已有值,覆盖填入将修改它们:{{fields}}。取消则仅填充空字段。`,"models.catalogOverwriteConfirm":`覆盖并填入`,"models.catalogOverwriteCancel":`仅填空字段`,"models.catalogFilling":`正在填入模型信息…`,"models.catalogFill":`填入模型信息`,"models.catalogFilled":`已填入 {count} 个字段`,"models.catalogNoEmptyFields":`没有需要填入的空字段`,"models.catalogNoExactMatch":`models.dev 中没有精确匹配`,"models.catalogPriceProvider":`价格已匹配 Provider {provider}`,"models.catalogPriceBaseUrl":`价格已按 Base URL 匹配 {provider}`,"models.catalogPriceConsensus":`价格得到 {support}/{total} 条记录支持`,"models.catalogPriceUnreliable":`未找到可靠价格`,"models.catalogUndo":`撤销`,"models.baseUrl":`Base URL`,"models.apiKey":`API 密钥`,"models.api":`API 格式`,"models.modelId":`ID *`,"models.name":`名称`,"models.apiOverride":`API 覆盖`,"models.reasoningThinking":`推理 / 思考`,"models.imageInput":`图片输入`,"models.imageInputHint":`勾选时写入 input: ["text", "image"];取消勾选则移除 input(回落默认 ["text"])。`,"models.nameHint":`留空删除 name 字段(回落使用模型 id)。`,"models.apiOverrideHint":`留空或选默认删除 api 字段(回落使用 provider 默认 api)。`,"models.reasoningHint":`取消勾选删除 reasoning 字段(回落关闭)。`,"models.compatBoolTrueHint":`未勾选不等于 false:pi 将缺失字段视为 true。取消勾选会写入显式 false,才能真正关闭。`,"models.compatBoolHint":`勾选写入 true;取消勾选删除该字段(回落 auto-detect / false 默认)。`,"models.compatSelectHint":`选「默认/none」删除该字段(回落 auto-detect)。`,"models.thinkingLevelMapHint":`每个级别三种状态:Default=删除该级别映射(回落模型默认级别);Disabled=写入 null 禁用;Custom=写入自定义级别字符串。`,"models.compatSection":`兼容性`,"models.compatInheritHint":`模型自身未设置的项显示从 provider 继承的生效值(标注「· 来自 provider」);在模型级设置后将覆盖继承值。`,"models.inheritedFromProvider":`· 来自 provider`,"models.thinkingFormatDeepseekHint":`选中 deepseek 时会额外写入 requiresReasoningContentOnAssistantMessages: true;选中其他值则移除。`,"models.samplingParams":`采样参数`,"models.headers":`请求头`,"models.modelOverrides":`模型覆盖`,"models.supportsDeveloperRole":`支持 developer role`,"models.supportsLongCacheRetention":`支持长缓存保留`,"models.supportsUsageInStreaming":`流式返回 token 用量`,"models.supportsFinishReason":`流式返回 finish_reason`,"models.supportsEagerToolInputStreaming":`工具输入流式预读`,"models.supportsCacheControlOnTools":`工具定义缓存控制`,"models.supportsTemperature":`支持 temperature 参数`,"models.requiresToolResultName":`工具结果需带 name`,"models.requiresAssistantAfterToolResult":`工具结果后需 assistant 消息`,"models.requiresThinkingAsText":`思考块转为文本`,"models.requiresReasoningContentOnAssistantMessages":`assistant 消息需 reasoning_content`,"models.zaiToolStream":`z.ai tool stream`,"models.supportsThinkingTokenBudget":`支持思考 token 预算`,"models.supportsOpenAIGrammarTools":`支持 OpenAI 语法工具`,"models.sendSessionAffinityHeaders":`发送会话亲和请求头`,"models.supportsToolSearch":`支持工具搜索`,"models.supportsExplicitPromptCacheMode":`显式提示缓存模式`,"models.forceAdaptiveThinking":`强制自适应思考`,"models.allowEmptySignature":`允许空思考签名`,"models.supportsStrictTools":`严格工具 schema`,"models.supportsStore":`支持 store 参数`,"models.supportsReasoningEffort":`支持 reasoning_effort`,"models.supportsStrictMode":`严格模式`,"models.supportsToolReferences":`支持工具引用`,"models.maxTokensField":`最大 token 字段`,"models.sessionAffinityFormat":`会话亲和格式`,"models.deferredToolsMode":`延迟工具模式`,"models.cacheControlFormat":`缓存控制格式`,"models.thinkingFormat":`思考格式`,"models.chatTemplateKwargs":`聊天模板 kwargs`,"models.chatTemplateArgs":`聊天模板 args`,"models.openRouterRouting":`OpenRouter 路由`,"models.vercelGatewayRouting":`Vercel 网关路由`,"models.thinkingLevelMap":`思考级别映射`,"models.contextWindow":`上下文窗口(tokens)`,"models.maxOutputTokens":`最大输出 tokens`,"models.costPerMillion":`成本(每百万 tokens)`,"models.apiKeyPlaceholder":`ENV_VAR_NAME、!shell-command 或字面密钥`,"models.apiKeyHint":`以 ! 开头执行 shell 命令,或使用环境变量名`,"models.apiKeyStored":`已保存 API 密钥。在下方输入新密钥即可替换,或断开连接以移除。`,"models.apiKeyPrompt":`输入 {provider} 的 API 密钥以启用 {count} 个模型。`,"models.apiKeyReplacePlaceholder":`输入新密钥以替换…`,"models.oauthAlreadyConnected":`已连接。可重新登录或断开连接。`,"models.oauthConnectPrompt":`连接你的 {provider} 账户。`,"models.enterValue":`输入值…`,"models.displayNamePlaceholder":`显示名称`,"models.connectionLost":`连接已断开`,"models.networkError":`网络错误`,"i18n.testingModel":`正在测试模型连接...`,"i18n.connected":`已连接`,"i18n.failed":`失败`,"i18n.test":`测试`,"i18n.testConnection":`测试模型连接`,"i18n.provider":`Provider`,"i18n.providers":`提供商`,"i18n.model":`模型`,"i18n.providerName":`Provider 名称`,"i18n.rename":`重命名`,"i18n.default":`默认`,"i18n.disabled":`已禁用`,"plugins.statusLoaded":`已加载并生效`,"plugins.statusInstalled":`已安装,尚未加载`,"plugins.statusDisabled":`已禁用`,"plugins.statusMissing":`已配置但包未找到`,"plugins.extensionFilters":`扩展过滤`,"plugins.filterRules":`过滤规则`,"plugins.managePlugins":`插件管理`,"plugins.extensionFiltersHint":`对 ~/.pi/agent/extensions/ 与 .pi/extensions/ 自动发现目录内扩展的过滤规则。仅以 !、+、- 开头的规则生效;纯路径填写无效。`,"plugins.noExtensionFilters":`未配置过滤规则`,"plugins.addFilter":`添加过滤`,"plugins.filterPatternLabel":`规则`,"plugins.filterPlaceholder":`!pattern · +path · -path`,"plugins.filterInvalid":`规则必须以 !、+ 或 - 开头;纯路径在 extensions 字段中无效。`,"plugins.filterPrefixExclude":`排除匹配的扩展`,"plugins.filterPrefixForceInclude":`强制包含精确路径`,"plugins.filterPrefixForceExclude":`强制排除精确路径`,"plugins.filterEffect":`效果`,"plugins.removeFilter":`移除过滤`,"plugins.npmSourcePlaceholder":`npm:@scope/package`,"plugins.packageInstalled":`包已安装。`,"plugins.packageUpdated":`包已更新。`,"plugins.packageRemoved":`包已移除。`,"plugins.packageDisabled":`包已禁用。`,"plugins.packageEnabled":`包已启用。`,"plugins.extensionFilterAdded":`扩展过滤已添加。`,"plugins.extensionFilterRemoved":`扩展过滤已移除。`,"plugins.sessionReloaded":`会话已重载。`,"i18n.noResources":`没有资源`,"i18n.unknown":`未知`,"i18n.installedVersion":`已安装 {version}`,"i18n.configuredVersion":`已配置 {version}`,"i18n.extensions":`扩展`,"i18n.prompts":`提示词`,"i18n.themes":`主题`,"i18n.resourceCount":`{count}{label}`,"i18n.extensionShort":`扩展`,"i18n.versionShort":`版本`,"i18n.skillShort":`技能`,"i18n.promptShort":`提示词`,"i18n.themeShort":`主题`,"i18n.custom":`自定义`,"i18n.clearAll":`清除全部`,"i18n.connectedSuccessfully":`连接成功。`,"i18n.notConnected":`未连接`,"i18n.configured":`已配置`,"i18n.notConfigured":`未配置`,"i18n.openingBrowser":`正在打开浏览器…`,"i18n.submit":`提交`,"i18n.login":`登录`,"i18n.relogin":`重新登录`,"i18n.disconnect":`断开连接`,"i18n.networkError":`网络错误`,"i18n.continuing":`继续中…`,"i18n.skills":`技能`,"i18n.plugins":`插件`,"i18n.addSkill":`添加技能`,"i18n.addPlugin":`添加插件`,"i18n.recommendedPlugins":`推荐插件`,"i18n.selectSkill":`选择技能`,"i18n.selectPackage":`选择包`,"i18n.configBindings":`绑定的配置文件`,"i18n.addBinding":`添加`,"i18n.configFileNote":`备注(可选)`,"i18n.bindConfigFile":`绑定配置文件`,"i18n.selectFile":`选择文件`,"i18n.noConfigBindings":`尚未绑定配置文件`,"i18n.noFiles":`没有文件`,"i18n.allFiles":`全部文件`,"i18n.filterByType":`按类型筛选`,"i18n.removeBinding":`删除绑定`,"i18n.confirm":`确认`,"i18n.updateAvailable":`有可用更新`,"i18n.upToDate":`已是最新`,"i18n.automaticChecksUnavailable":`自动检查不可用`,"i18n.checkFailed":`检查失败`,"i18n.installed":`已安装`,"i18n.status":`状态`,"i18n.version":`版本`,"i18n.package":`包`,"i18n.resources":`资源`,"i18n.installedPath":`安装路径`,"i18n.readme":`README`,"i18n.readmeDetails":`详情`,"i18n.unsafeLinkBlocked":`已阻止不安全链接(仅允许同目录或子目录的相对链接):{href}`,"i18n.resolvedResources":`已解析资源`,"i18n.reloadSession":`重新加载会话`,"i18n.reloading":`重新加载中...`,"i18n.packageRemoved":`包已移除。`,"i18n.packageInstalled":`包已安装。`,"i18n.packageUpdated":`包已更新。`,"i18n.packageDisabled":`包已禁用。`,"i18n.packageEnabled":`包已启用。`,"i18n.sessionReloaded":`会话已重新加载。`,"i18n.thinking":`思考`,"i18n.loadingThinking":`正在加载思考内容...`,"i18n.copyMessage":`复制消息`,"i18n.editFromHere":`从此处编辑`,"i18n.editFromHereTitle":`从此处编辑,此会话内创建分支`,"i18n.newSession":`新会话`,"i18n.newSessionTitle":`新会话,从此处创建独立副本`,"i18n.estimatedTokens":`流式输出期间的估算 Token 数`,"i18n.noOutput":`(无输出)`,"i18n.noSummary":`(无摘要)`,"i18n.conversationCompacted":`会话已压缩`,"i18n.compactionDescription":`此处之前的会话历史已压缩为以下摘要:`,"i18n.fileContext":`文件上下文:{details}`,"i18n.readFiles":`读取的文件`,"i18n.modifiedFiles":`修改的文件`,"i18n.hiddenExtensionMessage":`隐藏的扩展消息`,"i18n.noMessage":`(无消息)`,"i18n.showExtensionMessage":`显示扩展消息`,"i18n.collapse":`收起`,"i18n.expand":`展开`,"i18n.hideDetails":`隐藏详情`,"i18n.showDetails":`显示详情`,"i18n.thinkingUnavailable":`思考内容不可用`,"i18n.thinkingEncrypted":`思考内容已加密(提供方加密,仅用于上下文连续,无法显示明文)`,"i18n.before":`之前`,"i18n.after":`之后`}},y=new Map;function b(e){if(!e.id.trim())throw Error(`Locale id must not be empty`);if(y.has(e.id))throw Error(`Locale already registered: ${e.id}`);y.set(e.id,e)}function x(e){return y.get(e)}function S(){return[...y.keys()]}function C(e){for(let t of e){let e=t.toLowerCase();if(e===`en`||e.startsWith(`en-`))return`en`;if(e===`zh`||e.startsWith(`zh-`))return`zh-CN`}return`en`}b(_),b(v);var w=n((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),T=n(((e,t)=>{t.exports=w()})),E=T(),D=`pi-locale`,O=`en`,k=(0,d.createContext)(null);function A(){return Object.fromEntries(S().flatMap(e=>{let t=x(e);return t?[[e,t.messages]]:[]}))}function j(){try{let e=window.localStorage.getItem(D);if(e===`en`||e===`zh-CN`)return e}catch{}return null}function M({children:e,initialLocale:t=null}){let[n,r]=(0,d.useState)(()=>typeof window>`u`?t??O:j()??t??C(window.navigator.languages.length?window.navigator.languages:[window.navigator.language])),i=(0,d.useMemo)(()=>S().map(e=>x(e)).filter(e=>!!e),[]),a=(0,d.useMemo)(()=>A(),[]),o=(0,d.useCallback)(e=>{if(x(e)){r(e),document.documentElement.lang=e;try{window.localStorage.setItem(D,e)}catch{}fetch(`/api/preferences`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({firstPaint:{locale:e}})}).catch(()=>{})}},[]),s=(0,d.useCallback)((e,t)=>h(n,e,a,t),[n,a]),c=(0,d.useMemo)(()=>({locale:n,setLocale:o,t:s,supportedLocales:i}),[n,o,s,i]);return(0,E.jsx)(k.Provider,{value:c,children:e})}function N(){let e=(0,d.useContext)(k);if(!e)throw Error(`useI18n must be used inside I18nProvider`);return e}var P=`(max-width: 640px)`;function ee(e){if(typeof window>`u`||!window.matchMedia)return()=>{};let t=window.matchMedia(P);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function F(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(P).matches}function te(){return!1}function ne(){return(0,d.useSyncExternalStore)(ee,F,te)}var re=null;function ie(e){re=e}function ae(e){let{onNewSession:t,activeCwd:n}=e;(0,d.useEffect)(()=>{let e=e=>{if(e.key===`Escape`){if(!re)return;let t=e.target?.tagName;if(t===`TEXTAREA`||t===`INPUT`)return;e.preventDefault(),re();return}if(e.key===`n`&&e.ctrlKey&&e.altKey){if(!n||!t)return;e.preventDefault(),t(n)}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n,t])}function oe(){let[e,t]=(0,d.useState)(()=>typeof Notification>`u`?`unsupported`:Notification.permission);return(0,d.useEffect)(()=>{if(typeof Notification>`u`)return;let e=!1,n,r=()=>{e||t(Notification.permission)};return typeof navigator.permissions?.query==`function`&&navigator.permissions.query({name:`notifications`}).then(t=>{e||(n=t,r(),t.addEventListener(`change`,r))}).catch(()=>{}),()=>{e=!0,n?.removeEventListener(`change`,r)}},[]),e}var I=1200,L=320,se=420;function R(e,t,n){return Math.round(Math.max(t,Math.min(Math.max(t,n),Number.isFinite(e)?e:t)))}function ce(e){let{viewportWidth:t,rightPanelOpen:n,rightPanelWidth:r}=e;if(t<=640)return 480;let i=t<960,a=i?L:se,o=!i&&n?r:0;return Math.min(480,t-a-o)}function le(e){let{viewportWidth:t,sidebarOpen:n,sidebarWidth:r}=e;if(t<960)return I;let i=n?r:0;return Math.min(I,t-se-i)}function ue(e){try{let t=window.localStorage.getItem(e);if(t===null)return null;let n=Number.parseInt(t,10);return Number.isFinite(n)?n:null}catch{return null}}function de(e,t){try{window.localStorage.setItem(e,String(t))}catch{}}function fe(e){let{ariaLabel:t,cssVariable:n,defaultWidth:r,getDefaultWidth:i,getMaxWidth:a,growthDirection:o,maxWidth:s,minWidth:c,storageKey:l,widthRef:u}=e,f=(0,d.useRef)(null),p=(0,d.useRef)(null),m=(0,d.useRef)(!1),[h,g]=(0,d.useState)(r),[_,v]=(0,d.useState)(!1),y=(0,d.useCallback)(()=>Math.min(s,Math.max(c,a())),[a,s,c]),b=(0,d.useCallback)(e=>R(e,c,y()),[y,c]),x=(0,d.useCallback)(e=>{u.current=e,f.current?.style.setProperty(n,`${e}px`)},[n,u]),S=(0,d.useCallback)((e,t={})=>{let{forcePersist:n=!1,persist:r=!0}=t,i=b(e),a=i!==u.current;return x(i),g(i),r&&(a||n)&&de(l,i),i},[x,b,l,u]),C=(0,d.useCallback)(e=>{document.body.style.cursor=e.previousCursor,document.body.style.userSelect=e.previousUserSelect},[]),w=(0,d.useCallback)(e=>{let t=p.current;if(!(!t||t.pointerId!==e)){p.current=null,C(t),v(!1),S(u.current,{forcePersist:!0});try{t.target.hasPointerCapture(e)&&t.target.releasePointerCapture(e)}catch{}}},[S,C,u]),T=(0,d.useCallback)(e=>{if(e.pointerType===`mouse`&&e.button!==0)return;e.preventDefault(),e.stopPropagation();let t=p.current;t&&w(t.pointerId);let n=e.currentTarget;n.focus({preventScroll:!0}),n.setPointerCapture(e.pointerId),p.current={pointerId:e.pointerId,startX:e.clientX,startWidth:u.current,target:n,previousCursor:document.body.style.cursor,previousUserSelect:document.body.style.userSelect},document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,v(!0)},[w,u]),E=(0,d.useCallback)(e=>{let t=p.current;if(!t||t.pointerId!==e.pointerId)return;if(e.pointerType===`mouse`&&e.buttons===0){w(e.pointerId);return}e.preventDefault();let n=o===`right`?1:-1,r=b(t.startWidth+(e.clientX-t.startX)*n);x(r),e.currentTarget.setAttribute(`aria-valuenow`,String(r)),e.currentTarget.setAttribute(`aria-valuetext`,`${r} px`)},[x,b,w,o]),D=(0,d.useCallback)(e=>{w(e.pointerId)},[w]),O=(0,d.useCallback)(e=>{w(e.pointerId)},[w]),k=(0,d.useCallback)(e=>{w(e.pointerId)},[w]),A=(0,d.useCallback)(()=>{let e=i?.()??r;S(e,{forcePersist:!0})},[S,r,i]),j=(0,d.useCallback)(()=>{S(u.current)},[S,u]),M=(0,d.useCallback)(e=>{let t=e.shiftKey?32:12,n=o===`right`?`ArrowRight`:`ArrowLeft`,r=o===`right`?`ArrowLeft`:`ArrowRight`;e.key===n?(e.preventDefault(),S(u.current+t,{forcePersist:!0})):e.key===r?(e.preventDefault(),S(u.current-t,{forcePersist:!0})):e.key===`Home`?(e.preventDefault(),S(c,{forcePersist:!0})):e.key===`End`?(e.preventDefault(),S(y(),{forcePersist:!0})):e.key===`Enter`&&(e.preventDefault(),A())},[S,y,o,c,A,u]);return(0,d.useEffect)(()=>{if(m.current)return;m.current=!0;let e=ue(l),t=e??i?.()??r,n=S(t,{persist:!1});e!==null&&e!==n&&de(l,n)},[S,r,i,l]),(0,d.useEffect)(()=>{if(!m.current)return;S(u.current);let e=()=>{S(u.current)};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[S,u]),(0,d.useEffect)(()=>{if(!_)return;let e=()=>{let e=p.current;e&&w(e.pointerId)},t=()=>{document.visibilityState!==`visible`&&e()};return window.addEventListener(`blur`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`blur`,e),document.removeEventListener(`visibilitychange`,t)}},[w,_]),(0,d.useEffect)(()=>()=>{let e=p.current;e&&(p.current=null,C(e))},[C]),{isResizing:_,panelRef:f,reclampWidth:j,resetWidth:A,setWidth:e=>S(e,{forcePersist:!0}),separatorProps:{"aria-label":t,"aria-orientation":`vertical`,"aria-valuemax":y(),"aria-valuemin":c,"aria-valuenow":h,"aria-valuetext":`${h} px`,onDoubleClick:A,onKeyDown:M,onLostPointerCapture:k,onPointerCancel:O,onPointerDown:T,onPointerMove:E,onPointerUp:D,role:`separator`,tabIndex:0},width:h}}function pe(){let e=(0,d.useRef)(null),t=(0,d.useCallback)(()=>{e.current!==null&&(clearTimeout(e.current),e.current=null)},[]),n=(0,d.useCallback)((n,r)=>{t(),e.current=setTimeout(()=>{e.current=null,n()},r)},[t]);return(0,d.useEffect)(()=>()=>t(),[t]),(0,d.useMemo)(()=>({schedule:n,cancel:t}),[n,t])}var me=(0,d.createContext)(null);function he({value:e,children:t}){return(0,E.jsx)(me.Provider,{value:e,children:t})}function ge(){let e=(0,d.useContext)(me);if(!e)throw Error(`useSettings must be used within SettingsProvider`);return e}function _e(e){let{fetcher:t,ttlMs:n=6e4}=e,r=null,i=null,a=0,o=null,s=new Set,c=()=>{for(let e of[...s])try{e()}catch{}},l=async e=>{try{let o=await t(e);return r=o,i=null,a=Date.now()+n,o}catch(e){throw i=e instanceof Error?e.message:String(e),e}finally{o=null}},u=e=>(o||=l(e).then(e=>(c(),e)),o),d=(e,t)=>new Promise((n,r)=>{if(e.aborted){r(new DOMException(`Aborted`,`AbortError`));return}let i=()=>r(new DOMException(`Aborted`,`AbortError`));e.addEventListener(`abort`,i,{once:!0}),t.then(n,r).finally(()=>e.removeEventListener(`abort`,i))});return{get:()=>r,getError:()=>i,load:e=>{if(r!==null&&Date.now()<a)return Promise.resolve(r);let t=u(!1);return e?d(e,t):t},refresh:e=>{a=0;let t=u(!0);return e?d(e,t):t},subscribe:e=>(s.add(e),()=>s.delete(e)),clear:()=>{r=null,i=null,a=0}}}async function ve(e,t){let n=await fetch(e,t);if(!n.ok)throw Error(`HTTP ${n.status}`);return await n.json()}function ye(){return`/api/sessions`}var be=_e({fetcher:()=>ve(`/api/models`)}),xe=_e({fetcher:()=>ve(ye(),{cache:`no-store`})}),Se=_e({fetcher:()=>ve(`/api/preferences`)}),Ce=_e({fetcher:()=>ve(`/api/models-config`)}),we=_e({fetcher:()=>ve(`/api/plugins/global`)}),Te=_e({fetcher:e=>ve(`/api/skills/global`,e?{cache:`no-store`}:void 0)}),Ee=_e({fetcher:()=>ve(`/api/model-thinking`)}),De=_e({fetcher:async()=>{let[e,t]=await Promise.all([ve(`/api/auth/providers`),ve(`/api/auth/all-providers`)]);return{oauth:e.providers,apiKey:t.providers}}}),Oe=e=>window.history.replaceState(null,``,e);function ke({initialNavigation:e,onProjectSwitch:t,onSessionSelected:n,onTopPanelReset:r}){let[i,a]=(0,d.useState)(null),[o,s]=(0,d.useState)(null),[c,l]=(0,d.useState)(()=>e.requestedCwd?`validating`:`idle`),[u,f]=(0,d.useState)(null),[p,m]=(0,d.useState)(0),[h,g]=(0,d.useState)(0),[_,v]=(0,d.useState)(0),[y,b]=(0,d.useState)(0),[x,S]=(0,d.useState)(()=>!e.sessionId),[C,w]=(0,d.useState)(null),T=(0,d.useRef)(null),E=(0,d.useRef)(!1),D=(0,d.useRef)(!1),[O,k]=(0,d.useState)(null),[A,j]=(0,d.useState)(!1),[M,N]=(0,d.useState)(!1),[P,ee]=(0,d.useState)(null);(0,d.useEffect)(()=>{let t=e.requestedCwd;if(!t)return;let n=new AbortController;return l(`validating`),f(null),fetch(`/api/cwd/validate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:t}),signal:n.signal}).then(async e=>{let t=await e.json().catch(()=>({}));if(!e.ok||!t.cwd)throw Error(t.error??`HTTP ${e.status}`);E.current=!0,s(t.cwd),l(`ready`)}).catch(e=>{n.signal.aborted||(f(e instanceof Error?e.message:String(e)),l(`error`))}),()=>n.abort()},[e]);let F=o??(i===null&&C?C:null),te=i!==null||F!==null,ne=i?.cwd??F;(0,d.useEffect)(()=>{if(k(null),j(!1),ee(null),!ne)return;let e=new AbortController,t=new URLSearchParams(window.location.search).get(`piE2eTrustCwd`);return fetch(`/api/project-trust?cwd=${encodeURIComponent(ne)}${t?`&piE2eTrustCwd=${encodeURIComponent(t)}`:``}`,{signal:e.signal}).then(async e=>{let t=await e.json();if(!e.ok||t.error)throw Error(t.error??`HTTP ${e.status}`);k(t)}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||console.error(`Failed to load project trust:`,e)}),()=>e.abort()},[ne]);let re=(0,d.useCallback)(e=>{xe.load().then(t=>{let n=t.sessions.find(t=>t.id===e);n&&a(t=>t&&t.id===e&&!t.projectRoot?n:t)}).catch(()=>{})},[]),ie=(0,d.useCallback)((e,t=!1)=>{!t&&D.current||(s(null),a(e),g(e=>e+1),S(!0),t&&(E.current=!0),t||Oe(`?session=${encodeURIComponent(e.id)}`),n?.(t))},[n]),ae=(0,d.useCallback)(async(e,t)=>{await fetch(`/api/cwd/validate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:t})}).catch(()=>{}),a(null),s(t),g(e=>e+1),r?.(),n?.(!1),Oe(`/`)},[n,r]),oe=(0,d.useCallback)(e=>{s(null),a(e),m(e=>e+1),re(e.id),Oe(`?session=${encodeURIComponent(e.id)}`)},[re]),I=(0,d.useCallback)(()=>{m(e=>e+1),v(e=>e+1)},[]),L=(0,d.useCallback)((e,t)=>{a(n=>n&&n.id===e?{...n,name:t}:n),m(e=>e+1)},[]),se=(0,d.useCallback)(()=>{v(e=>e+1)},[]),R=(0,d.useCallback)(()=>{S(!0)},[]);return{selectedSession:i,setSelectedSession:a,newSessionCwd:o,effectiveNewSessionCwd:F,showChat:te,projectTrustCwd:ne,refreshKey:p,setRefreshKey:m,explorerRefreshKey:_,setExplorerRefreshKey:v,modelsRefreshKey:y,setModelsRefreshKey:b,sessionKey:h,activeCwd:C,initialCwdStatus:c,initialCwdError:u,initialSessionRestored:x,projectTrust:O,projectTrustDialogOpen:A,setProjectTrustDialogOpen:j,projectTrustBusy:M,projectTrustError:P,setProjectTrustError:ee,extensionDialogActiveRef:D,handleSelectSession:ie,handleNewSession:ae,handleSessionCreated:oe,handleAgentEnd:I,handleSessionRenamed:L,handleSessionForked:(0,d.useCallback)(e=>{m(e=>e+1),g(e=>e+1),s(null),a(t=>({...t??{path:``,cwd:``,created:``,modified:``,messageCount:0,firstMessage:``},id:e})),re(e),Oe(`?session=${encodeURIComponent(e)}`)},[re]),handleSessionDeleted:(0,d.useCallback)(e=>{if(m(e=>e+1),i?.id===e){let e=i.cwd;a(null),s(e??null),g(e=>e+1),r?.(),Oe(`/`)}},[i,r]),handleCwdChange:(0,d.useCallback)((e,n)=>{if(w(e),!e)return;let r=n??e,o=T.current??(i?i.projectRoot??i.cwd:null);if(!o){T.current=r;return}if(T.current=r,E.current){E.current=!1;return}o!==r&&(i?i.projectRoot??i.cwd:null)!==r&&(a(null),s(t=>t&&t!==e?null:t),g(e=>e+1),t?.())},[i,t]),handleTrustProject:(0,d.useCallback)(async()=>{if(!(!ne||M)){N(!0),ee(null);try{let e=await fetch(`/api/project-trust`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:ne})}),t=await e.json();if(!e.ok||t.error)throw Error(t.error??`HTTP ${e.status}`);k(t),j(!1),b(e=>e+1),g(e=>e+1)}catch(e){ee(e instanceof Error?e.message:String(e))}finally{N(!1)}}},[M,ne]),handleExplorerRefresh:se,handleInitialRestoreDone:R}}var Ae=(0,d.createContext)(null);function je({value:e,children:t}){return(0,E.jsx)(Ae.Provider,{value:e,children:t})}function Me(){let e=(0,d.useContext)(Ae);if(!e)throw Error(`useTopPanel must be used within TopPanelProvider`);return e}var Ne=`pi-web-auto-reload-seconds`,Pe=3600;function Fe(e){let t=e.trim();if(t===``)return null;let n=Number(t);return!Number.isInteger(n)||n<0||n>3600?null:n}function Ie(){if(typeof window>`u`)return 0;let e=window.localStorage.getItem(Ne);if(e===null)return 0;let t=Fe(e);return t===null?0:t}var Le=1e3,Re=`pi-web-scroll-step-px`;function ze(e){let t=e.trim();if(t===``)return null;let n=Number(t);return!Number.isFinite(n)||!Number.isInteger(n)||n<1||n>1e3?null:n}function Be(){if(typeof window>`u`)return 200;try{return ze(window.localStorage.getItem(`pi-web-scroll-step-px`)??``)??200}catch{return 200}}var Ve=1e4,He=`pi-web-long-block-collapse-chars`;function Ue(e){let t=e.trim();if(t===``)return null;let n=Number(t);return!Number.isFinite(n)||!Number.isInteger(n)||n<20||n>1e4?null:n}function We(){if(typeof window>`u`)return 200;try{return Ue(window.localStorage.getItem(`pi-web-long-block-collapse-chars`)??``)??200}catch{return 200}}var Ge=`pi-web-long-block-recent-expanded`;function Ke(e){let t=e.trim();if(t===``)return null;let n=Number(t);return!Number.isFinite(n)||!Number.isInteger(n)||n<0||n>20?null:n}function qe(){if(typeof window>`u`)return 0;try{return Ke(window.localStorage.getItem(`pi-web-long-block-recent-expanded`)??``)??0}catch{return 0}}function Je(e,t,n,r){return e===`toolCall`?`tool:${n}`:`thinking:${t}:${r}`}var Ye=`pi-web-notify-events`,Xe={taskComplete:!0,errors:!0,questions:!0,notifyWhileActive:!1};function Ze(){if(typeof window>`u`)return Xe;try{let e=window.localStorage.getItem(Ye);if(!e)return Xe;let t=JSON.parse(e);return{taskComplete:t.taskComplete??Xe.taskComplete,errors:t.errors??Xe.errors,questions:t.questions??Xe.questions,notifyWhileActive:t.notifyWhileActive??Xe.notifyWhileActive}}catch{return Xe}}function Qe(e){window.localStorage.setItem(Ye,JSON.stringify(e))}function $e(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t={};for(let[n,r]of Object.entries(e)){if(typeof n!=`string`||n===``||typeof r!=`object`||!r)continue;let{x:e,y:i,width:a,height:o,collapsed:s}=r;typeof e!=`number`||!Number.isFinite(e)||typeof i!=`number`||!Number.isFinite(i)||typeof a!=`number`||!Number.isFinite(a)||a<=0||typeof o!=`number`||!Number.isFinite(o)||o<=0||(t[n]={x:e,y:i,width:a,height:o,collapsed:typeof s==`boolean`?s:void 0})}return t}var et=[{label:`阅读项目`,message:`阅读当前项目,总结整体目录结构与核心模块的职责。`},{label:`review工作区改动`,message:`review 当前工作区的所有改动,指出潜在问题与改进点。`},{label:`寻找并修复bug`,message:`检查当前代码,寻找并修复其中存在的 bug。`}];function tt(e){if(!Array.isArray(e))return null;let t=[];for(let n of e){if(typeof n!=`object`||!n)continue;let{label:e,message:r,allowAppend:i}=n;if(typeof e!=`string`||e.trim()===``||typeof r!=`string`||r.trim()===``)continue;let a={label:e.trim(),message:r.trim()};i===!0&&(a.allowAppend=!0),t.push(a)}return t}function nt(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t={};for(let[n,r]of Object.entries(e)){if(typeof n!=`string`||n===``)continue;let e=tt(r);e&&e.length>0&&(t[n]=e)}return t}var rt=`pluginConfigBindings`;function it(){if(typeof window>`u`)return{};try{let e=window.localStorage.getItem(rt);if(!e)return{};let t=JSON.parse(e);if(t&&typeof t==`object`)return t}catch{}return{}}function at(){return`/api/preferences`}function ot(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}var st=new Map,ct=2e3;function lt(e){let t=JSON.stringify(e),n=Date.now(),r=st.get(t);r!==void 0&&n-r<ct||(st.set(t,n),fetch(at(),{method:`PUT`,headers:{"Content-Type":`application/json`},body:t}).catch(()=>{}).finally(()=>{Se.refresh().catch(()=>{})}))}var ut={defaultModel:``,defaultThinking:``},dt=`pi-web-font-scale`,ft=1,pt=19.2;function mt({isDark:e,toggleTheme:t}){let[n,r]=(0,d.useState)(()=>{if(typeof window>`u`)return ft;let e=window.localStorage.getItem(dt),t=e===null?NaN:Number(e);return Number.isFinite(t)&&t>=.85&&t<=1.3?t:ft}),[i,a]=(0,d.useState)(()=>Be()),[o,s]=(0,d.useState)(()=>Ie()),[c,l]=(0,d.useState)(()=>We()),[u,f]=(0,d.useState)(()=>qe()),[p,m]=(0,d.useState)(()=>Ze());(0,d.useEffect)(()=>{Qe(p),lt({preferences:{notifyEvents:p}})},[p]);let[h,g]=(0,d.useState)(()=>$e(Se.get()?.preferences?.widgets)??{}),_=(0,d.useRef)(!1);(0,d.useEffect)(()=>{let e=!1;return Se.load().then(()=>{if(e)return;_.current=!0;let t=Se.get()?.preferences;g($e(t?.widgets)??{}),b(nt(t?.widgetMessages)??{}),T(ot(t?.workspaces))}).catch(()=>{_.current=!0}),()=>{e=!0}},[]);let v=(0,d.useCallback)((e,t)=>{g(n=>{let r=n[e];return r&&r.x===t.x&&r.y===t.y&&r.width===t.width&&r.height===t.height&&r.collapsed===t.collapsed?n:{...n,[e]:t}})},[]);(0,d.useEffect)(()=>{_.current&&lt({preferences:{widgets:h}})},[h]);let[y,b]=(0,d.useState)(()=>nt(Se.get()?.preferences?.widgetMessages)??{}),x=(0,d.useCallback)((e,t)=>{if((y[e]??[]).some(e=>e.label===t.label))throw Error(`Name conflict: "${t.label}"`);b(n=>({...n,[e]:[...n[e]??[],t]}))},[y]),S=(0,d.useCallback)((e,t)=>{b(n=>{let r=n[e];if(!r||t<0||t>=r.length)return n;let i={...n},a=r.filter((e,n)=>n!==t);return a.length===0?delete i[e]:i[e]=a,i})},[]),C=(0,d.useCallback)((e,t,n)=>{if((y[e]??[]).some((e,r)=>r!==t&&e.label===n.label))throw Error(`Name conflict: "${n.label}"`);b(r=>{let i=r[e];if(!i||t<0||t>=i.length)return r;let a={...r},o=[...i];return o[t]=n,a[e]=o,a})},[y]);(0,d.useEffect)(()=>{_.current&&lt({preferences:{widgetMessages:y}})},[y]);let[w,T]=(0,d.useState)(()=>ot(Se.get()?.preferences?.workspaces)),E=(0,d.useCallback)(e=>{T(e),lt({preferences:{workspaces:e}})},[]),[D,O]=(0,d.useState)(()=>Se.get()?.preferences?.startScreenMessages??et),k=(0,d.useCallback)(e=>{if(D.some(t=>t.label===e.label))throw Error(`Name conflict: "${e.label}"`);O(t=>[...t,e])},[D]),A=(0,d.useCallback)(e=>{O(t=>e<0||e>=t.length?t:t.filter((t,n)=>n!==e))},[]),j=(0,d.useCallback)((e,t)=>{if(D.some((n,r)=>r!==e&&n.label===t.label))throw Error(`Name conflict: "${t.label}"`);O(n=>{if(e<0||e>=n.length)return n;let r=[...n];return r[e]=t,r})},[D]),M=(0,d.useCallback)(()=>{O(e=>{let t=new Set(et.map(e=>e.label)),n=e.filter(e=>!t.has(e.label));return[...et,...n]})},[]);(0,d.useEffect)(()=>Se.subscribe(()=>O(Se.get()?.preferences?.startScreenMessages??et)),[]),(0,d.useEffect)(()=>{lt({preferences:{startScreenMessages:D}})},[D]);let[N,P]=(0,d.useState)(()=>it()),ee=(0,d.useCallback)((e,t)=>{P(n=>{let r=n[e]??[];return r.some(e=>e.path===t.path)?n:{...n,[e]:[...r,t]}})},[]),F=(0,d.useCallback)((e,t)=>{P(n=>{let r=n[e];if(!r)return n;let i=r.filter(e=>e.path!==t),a={...n};return i.length===0?delete a[e]:a[e]=i,a})},[]);(0,d.useEffect)(()=>{try{window.localStorage.setItem(rt,JSON.stringify(N))}catch{}lt({preferences:{pluginConfigBindings:N}})},[N]);let[te,ne]=(0,d.useState)(()=>Se.get()?.defaultThinkingLevel??``);(0,d.useEffect)(()=>Se.subscribe(()=>ne(Se.get()?.defaultThinkingLevel??``)),[]),(0,d.useEffect)(()=>{te&&lt({firstPaint:{defaultThinkingLevel:te}})},[te]);let re=(0,d.useSyncExternalStore)(Se.subscribe,()=>Se.get()?.compaction??null),ie=(0,d.useMemo)(()=>JSON.stringify(re),[re]);(0,d.useEffect)(()=>{ie&&lt({firstPaint:{compaction:Se.get()?.compaction??null}})},[ie]);let ae=(0,d.useSyncExternalStore)(Se.subscribe,()=>Se.get()?.retry??null),oe=(0,d.useMemo)(()=>JSON.stringify(ae),[ae]);(0,d.useEffect)(()=>{oe&&lt({firstPaint:{retry:Se.get()?.retry??null}})},[oe]);let[I,L]=(0,d.useState)(()=>Se.get()?.defaultProjectTrust??``);(0,d.useEffect)(()=>Se.subscribe(()=>L(Se.get()?.defaultProjectTrust??``)),[]),(0,d.useEffect)(()=>{I&&lt({firstPaint:{defaultProjectTrust:I}})},[I]);let se=(0,d.useSyncExternalStore)(Se.subscribe,()=>Se.get()?.subagents??ut),R=(0,d.useMemo)(()=>({defaultModel:se.defaultModel??``,defaultThinking:se.defaultThinking??``}),[se]);return(0,d.useEffect)(()=>{!R.defaultModel&&!R.defaultThinking||lt({firstPaint:{subagents:{defaultModel:R.defaultModel||void 0,defaultThinking:R.defaultThinking||void 0}}})},[R]),(0,d.useEffect)(()=>{try{window.localStorage.setItem(Ne,String(o))}catch{}lt({preferences:{autoReloadSeconds:o}})},[o]),(0,d.useEffect)(()=>{try{window.localStorage.setItem(Re,String(i))}catch{}lt({preferences:{minimapScrollStepPx:i}})},[i]),(0,d.useEffect)(()=>{try{window.localStorage.setItem(He,String(c))}catch{}lt({preferences:{longBlockCollapseChars:c}})},[c]),(0,d.useEffect)(()=>{try{window.localStorage.setItem(Ge,String(u))}catch{}lt({preferences:{recentBlocksExpanded:u}})},[u]),(0,d.useEffect)(()=>{document.documentElement.style.fontSize=`${n*pt}px`;try{window.localStorage.setItem(dt,String(n))}catch{}lt({firstPaint:{fontScale:n}})},[n]),(0,d.useEffect)(()=>{Se.load().catch(()=>{})},[]),{settingsValue:(0,d.useMemo)(()=>({isDark:e,toggleTheme:t,fontScale:n,setFontScale:r,scrollStepPx:i,setScrollStepPx:a,autoReloadSeconds:o,setAutoReloadSeconds:s,longBlockCollapseChars:c,setLongBlockCollapseChars:l,recentBlocksExpanded:u,setRecentBlocksExpanded:f,notifyEvents:p,setNotifyEvents:m,widgetGeometries:h,setWidgetGeometry:v,widgetMessages:y,addWidgetMessage:x,removeWidgetMessage:S,updateWidgetMessage:C,startScreenMessages:D,addStartScreenMessage:k,removeStartScreenMessage:A,updateStartScreenMessage:j,resetStartScreenMessages:M,pluginConfigBindings:N,addPluginConfigBinding:ee,removePluginConfigBinding:F}),[e,t,n,i,o,c,u,p,h,v,y,x,S,C,D,k,A,j,M,N,ee,F]),defaultThinkingLevel:te,setDefaultThinkingLevel:ne,compaction:re,retry:ae,defaultProjectTrust:I,setDefaultProjectTrust:L,subagents:R,savedWorkspaces:w,handleSavedWorkspacesChange:E,widgetGeometries:h,setWidgetGeometry:v,widgetMessages:y,addWidgetMessage:x,removeWidgetMessage:S,updateWidgetMessage:C,fontScale:n,setFontScale:r}}function ht(e){if(!Number.isFinite(e))return``;let t=Math.round(e),n=Math.floor(t/60),r=t%60;return`${n}:${String(r).padStart(2,`0`)}`}var gt=new Map,_t=new Map,vt=3e4,yt=75e3,bt=1e3,xt=15e3,St=1,Ct=3,wt=null,Tt=0,Et=0,Dt=bt;function Ot(e){return e.ch===`agent`?`agent:${e.sessionId??``}`:e.ch===`watch`?`watch:${e.filePath??``}`:e.ch}function kt(){return`${location.protocol===`https:`?`wss://`:`ws://`}${location.host}/api/ws`}function At(e,t){e.send(JSON.stringify({type:`sub`,...t}))}function jt(){wt&&wt.close();let e=++Et,t;try{t=new WebSocket(kt())}catch{Mt(e);return}wt=t,t.onopen=()=>{Dt=bt,Tt=Date.now();for(let e of _t.values())try{At(t,e)}catch{break}},t.onmessage=n=>{if(e!==Et||wt!==t||(Tt=Date.now(),typeof n.data!=`string`))return;let r;try{r=JSON.parse(n.data)}catch{return}if(r.ch)for(let e of gt.get(r.ch)??[])e(r.data)},t.onclose=()=>{e===Et&&wt===t&&(wt=null,Mt(e))},t.onerror=()=>{}}function Mt(e){setTimeout(()=>{e!==Et||wt||jt()},Dt),Dt=Math.min(Dt*2,xt)}function Nt(){if(!wt||wt.readyState!==St||Date.now()-Tt<=yt)return;Et+=1;let e=wt;wt=null;try{e.close()}catch{}jt()}typeof window<`u`&&(setInterval(Nt,vt),window.addEventListener(`online`,()=>{!wt||wt.readyState===Ct?jt():Nt()}),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&(!wt||wt.readyState===Ct?jt():Nt())}));function Pt(e){if(e&&wt?.readyState===St)try{wt.send(JSON.stringify({type:`unseen`,sessionId:e}))}catch{}}function Ft(e,t){let n=Ot(e),r=gt.get(n);r||(r=new Set,gt.set(n,r)),r.add(t);let i=!_t.has(n);if(_t.set(n,e),wt?.readyState===St&&i)try{At(wt,e)}catch{}else wt||jt();return()=>{let e=gt.get(n);if(e?.delete(t),e&&e.size===0&&(gt.delete(n),_t.delete(n),wt?.readyState===St))try{wt.send(JSON.stringify({type:`unsub`,ch:n}))}catch{}}}var It={runningSessionIds:[],runningPhases:{},runningPhaseSince:{},runningBusySince:{}},Lt=null,Rt={current:!1},zt=new Set;function Bt(){Lt=null;for(let e of zt)e()}function Vt(){return Lt||={runningSessionIds:new Set(It.runningSessionIds),runningPhases:It.runningPhases,runningPhaseSince:It.runningPhaseSince,runningBusySince:It.runningBusySince,setRunningSessionIds:Ht,runningPollAuthoritativeRef:Rt},Lt}function Ht(e){Rt.current||(It={...It,runningSessionIds:[...e]},Bt())}function Ut(e){return zt.add(e),Gt(),()=>zt.delete(e)}var Wt=null;function Gt(){Wt||=Ft({ch:`running`},e=>{if(e.type!==`running`)return;let t=e;It={runningSessionIds:t.runningSessionIds??[],runningPhases:t.phases??{},runningPhaseSince:t.phaseSince??{},runningBusySince:t.busySince??{}},Rt.current=!0,Bt()})}function Kt(){return(0,d.useSyncExternalStore)(Ut,Vt)}function qt(e,t){let[n,r]=(0,d.useState)(null);return(0,d.useEffect)(()=>{if(!e||t===void 0){r(null);return}let n=()=>{document.hidden||r(ht((Date.now()-t)/1e3))};n();let i=setInterval(n,1e3),a=()=>{document.hidden||n()};return document.addEventListener(`visibilitychange`,a),()=>{clearInterval(i),document.removeEventListener(`visibilitychange`,a)}},[e,t]),n}var Jt=new Map,Yt=5e3;function Xt({title:e,body:t,tag:n,notifyWhileActive:r=!1}){if(!(typeof Notification>`u`)&&!(document.hasFocus()&&document.visibilityState===`visible`&&!r)){if(Notification.permission!==`granted`){console.warn(`[notify] skip: permission=${Notification.permission}`);return}try{let r;if(n){let e=Date.now(),t=Jt.get(n);if(t!==void 0&&e-t<Yt)return;Jt.set(n,e),r=`${n}-${e}`}new Notification(e,t?{body:t,tag:r}:{tag:r}),console.info(`[notify] dispatched: ${e}`)}catch(e){console.warn(`[notify] construction failed:`,e)}}}function Zt(){typeof Notification>`u`||Notification.requestPermission()}function Qt(){if(typeof Notification>`u`||Notification.permission!=="default")return;let e=()=>{Zt(),window.removeEventListener(`pointerdown`,e),window.removeEventListener(`keydown`,e)};window.addEventListener(`pointerdown`,e),window.addEventListener(`keydown`,e)}var $t=3e3,en=6e4;function tn(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 nn(e,t){return e.filter(e=>!t.has(e))}function rn(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 an(){let{t:e}=N(),{notifyEvents:t}=ge(),[n,r]=(0,d.useState)([]),i=(0,d.useRef)([]);i.current=n;let a=(0,d.useRef)(t);a.current=t;let o=(0,d.useRef)(e);o.current=e;let{runningSessionIds:s}=Kt(),c=(0,d.useRef)(!1),l=(0,d.useRef)([]),u=(0,d.useRef)(new Map);(0,d.useEffect)(()=>{if(!a.current.taskComplete)return;let e=c.current?l.current:null;if(l.current=[...s],c.current=!0,!e)return;let t=nn(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<$t||(i.current.some(t=>t.id===e)||p.current(),console.info(`[notify] completion via running-snapshot (${e})`),Xt({title:o.current(`chat.taskCompleteNotificationTitle`),body:o.current(`chat.sessionCompletedNotificationBody`,{name:tn(i.current.find(t=>t.id===e),e)}),tag:`session-complete-${e}`,notifyWhileActive:a.current.notifyWhileActive}))}},[s]);let f=(0,d.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{}},[]),p=(0,d.useRef)(f);return p.current=f,(0,d.useEffect)(()=>{f();let e=setInterval(()=>void f(),en);return()=>clearInterval(e)},[f]),(0,d.useEffect)(()=>Ft({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)||p.current();let r=rn(t,tn(i.current.find(e=>e.id===n),n),a.current,o.current);r&&(console.info(`[agent-events] notifying: ${r.title}`),Xt({...r,notifyWhileActive:a.current.notifyWhileActive}))}),[]),null}var on=`var(--text-dim)`;function sn({size:e=14,open:t=!1}){return t?(0,E.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:`none`,children:[(0,E.jsx)(`path`,{d:`M1 4.5A1 1 0 0 1 2 3.5H5.5L7 5h7.5v1H1V4.5Z`,fill:on}),(0,E.jsx)(`path`,{d:`M1 6h14.5L14 13H2L1 6Z`,stroke:on,strokeWidth:`1`,fill:on,fillOpacity:`0.12`})]}):(0,E.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:`none`,children:(0,E.jsx)(`path`,{d:`M1 4.5A1 1 0 0 1 2 3.5H5.5L7 5H14a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V4.5Z`,stroke:on,strokeWidth:`1`,fill:on,fillOpacity:`0.1`})})}function cn({size:e=14}){return(0,E.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:`none`,children:[(0,E.jsx)(`path`,{d:`M3 2h7l3 3v9H3V2Z`,stroke:on,strokeWidth:`1`,fill:on,fillOpacity:`0.08`}),(0,E.jsx)(`path`,{d:`M10 2v3h3`,stroke:on,strokeWidth:`1`,fill:`none`,strokeLinejoin:`round`})]})}function ln({label:e,size:t=14}){let n=t/14;return(0,E.jsxs)(`svg`,{width:t,height:t,viewBox:`0 0 14 14`,fill:`none`,children:[(0,E.jsx)(`path`,{d:`M2.5 1h6l3 3v9h-9V1Z`,stroke:on,strokeWidth:`0.9`,fill:on,fillOpacity:`0.07`,strokeLinejoin:`round`}),(0,E.jsx)(`path`,{d:`M8.5 1v3h3`,stroke:on,strokeWidth:`0.9`,fill:`none`,strokeLinejoin:`round`}),(0,E.jsx)(`text`,{x:`7`,y:`9.5`,textAnchor:`middle`,fontSize:3.4*n,fontFamily:`var(--font-mono), monospace`,fontWeight:`600`,fill:on,letterSpacing:`0`,children:e})]})}function un({size:e=14}){return(0,E.jsx)(ln,{label:`TS`,size:e})}function dn({size:e=14}){return(0,E.jsx)(ln,{label:`TSX`,size:e})}function fn({size:e=14}){return(0,E.jsx)(ln,{label:`JS`,size:e})}function pn({size:e=14}){return(0,E.jsx)(ln,{label:`JSX`,size:e})}function mn({size:e=14}){return(0,E.jsx)(ln,{label:`PY`,size:e})}function hn({size:e=14}){return(0,E.jsx)(ln,{label:`{}`,size:e})}function gn({size:e=14}){return(0,E.jsx)(ln,{label:`CSS`,size:e})}function _n({size:e=14}){return(0,E.jsx)(ln,{label:`SC`,size:e})}function vn({size:e=14}){return(0,E.jsx)(ln,{label:`HTM`,size:e})}function yn({size:e=14}){return(0,E.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 14 14`,fill:`none`,children:[(0,E.jsx)(`path`,{d:`M2.5 1h6l3 3v9h-9V1Z`,stroke:on,strokeWidth:`0.9`,fill:on,fillOpacity:`0.07`,strokeLinejoin:`round`}),(0,E.jsx)(`path`,{d:`M8.5 1v3h3`,stroke:on,strokeWidth:`0.9`,fill:`none`,strokeLinejoin:`round`}),(0,E.jsx)(`path`,{d:`M3.5 9.5V7l1.5 1.5L6.5 7v2.5`,stroke:on,strokeWidth:`0.9`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`}),(0,E.jsx)(`path`,{d:`M8 7v2.5M7 9l1 1.5 1-1.5`,stroke:on,strokeWidth:`0.9`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`})]})}function bn({size:e=14}){return(0,E.jsx)(ln,{label:`YML`,size:e})}function xn({size:e=14}){return(0,E.jsx)(ln,{label:`TOM`,size:e})}function Sn({size:e=14}){return(0,E.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 14 14`,fill:`none`,children:[(0,E.jsx)(`path`,{d:`M2.5 1h6l3 3v9h-9V1Z`,stroke:on,strokeWidth:`0.9`,fill:on,fillOpacity:`0.07`,strokeLinejoin:`round`}),(0,E.jsx)(`path`,{d:`M8.5 1v3h3`,stroke:on,strokeWidth:`0.9`,fill:`none`,strokeLinejoin:`round`}),(0,E.jsx)(`path`,{d:`M4 7.5l2 1.5-2 1.5`,stroke:on,strokeWidth:`0.95`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`}),(0,E.jsx)(`path`,{d:`M7.5 10.5h2.5`,stroke:on,strokeWidth:`0.95`,strokeLinecap:`round`})]})}function Cn({size:e=14}){return(0,E.jsx)(ln,{label:`RS`,size:e})}function wn({size:e=14}){return(0,E.jsx)(ln,{label:`GO`,size:e})}function Tn({size:e=14}){return(0,E.jsx)(ln,{label:`SQL`,size:e})}function En({size:e=14}){return(0,E.jsx)(ln,{label:`GQL`,size:e})}function Dn({size:e=14}){return(0,E.jsx)(ln,{label:`TF`,size:e})}function On({size:e=14}){return(0,E.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 14 14`,fill:`none`,children:[(0,E.jsx)(`path`,{d:`M2.5 1h6l3 3v9h-9V1Z`,stroke:on,strokeWidth:`0.9`,fill:on,fillOpacity:`0.07`,strokeLinejoin:`round`}),(0,E.jsx)(`path`,{d:`M8.5 1v3h3`,stroke:on,strokeWidth:`0.9`,fill:`none`,strokeLinejoin:`round`}),(0,E.jsx)(`rect`,{x:`3.5`,y:`6.5`,width:`2`,height:`1.5`,rx:`0.3`,stroke:on,strokeWidth:`0.8`}),(0,E.jsx)(`rect`,{x:`6`,y:`6.5`,width:`2`,height:`1.5`,rx:`0.3`,stroke:on,strokeWidth:`0.8`}),(0,E.jsx)(`rect`,{x:`3.5`,y:`8.5`,width:`2`,height:`1.5`,rx:`0.3`,stroke:on,strokeWidth:`0.8`})]})}function kn({size:e=14}){return(0,E.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 14 14`,fill:`none`,children:[(0,E.jsx)(`path`,{d:`M2.5 1h6l3 3v9h-9V1Z`,stroke:on,strokeWidth:`0.9`,fill:on,fillOpacity:`0.07`,strokeLinejoin:`round`}),(0,E.jsx)(`path`,{d:`M8.5 1v3h3`,stroke:on,strokeWidth:`0.9`,fill:`none`,strokeLinejoin:`round`}),(0,E.jsx)(`circle`,{cx:`5.5`,cy:`8.5`,r:`1.5`,stroke:on,strokeWidth:`0.9`}),(0,E.jsx)(`path`,{d:`M7 8.5h2.5M8.5 8.5v1.5`,stroke:on,strokeWidth:`0.9`,strokeLinecap:`round`})]})}function An({size:e=14}){return(0,E.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 14 14`,fill:`none`,children:[(0,E.jsx)(`path`,{d:`M2.5 1h6l3 3v9h-9V1Z`,stroke:on,strokeWidth:`0.9`,fill:on,fillOpacity:`0.07`,strokeLinejoin:`round`}),(0,E.jsx)(`path`,{d:`M8.5 1v3h3`,stroke:on,strokeWidth:`0.9`,fill:`none`,strokeLinejoin:`round`}),(0,E.jsx)(`circle`,{cx:`5`,cy:`6.5`,r:`1`,stroke:on,strokeWidth:`0.85`}),(0,E.jsx)(`circle`,{cx:`9`,cy:`6.5`,r:`1`,stroke:on,strokeWidth:`0.85`}),(0,E.jsx)(`circle`,{cx:`5`,cy:`10`,r:`1`,stroke:on,strokeWidth:`0.85`}),(0,E.jsx)(`path`,{d:`M5 7.5V9`,stroke:on,strokeWidth:`0.85`,strokeLinecap:`round`}),(0,E.jsx)(`path`,{d:`M9 7.5v.5a2 2 0 0 1-2 2H6`,stroke:on,strokeWidth:`0.85`,strokeLinecap:`round`,fill:`none`})]})}function jn({size:e=14}){return(0,E.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 14 14`,fill:`none`,children:[(0,E.jsx)(`path`,{d:`M2.5 1h6l3 3v9h-9V1Z`,stroke:on,strokeWidth:`0.9`,fill:on,fillOpacity:`0.07`,strokeLinejoin:`round`}),(0,E.jsx)(`path`,{d:`M8.5 1v3h3`,stroke:on,strokeWidth:`0.9`,fill:`none`,strokeLinejoin:`round`}),(0,E.jsx)(`rect`,{x:`4.5`,y:`8.5`,width:`5`,height:`3`,rx:`0.6`,stroke:on,strokeWidth:`0.9`}),(0,E.jsx)(`path`,{d:`M5.5 8.5V7.5a1.5 1.5 0 0 1 3 0v1`,stroke:on,strokeWidth:`0.9`,strokeLinecap:`round`,fill:`none`})]})}function Mn({size:e=14}){return(0,E.jsx)(ln,{label:`DOC`,size:e})}function Nn({size:e=14}){return(0,E.jsx)(ln,{label:`PDF`,size:e})}function Pn({size:e=14}){return(0,E.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 14 14`,fill:`none`,children:[(0,E.jsx)(`path`,{d:`M2.5 1h6l3 3v9h-9V1Z`,stroke:on,strokeWidth:`0.9`,fill:on,fillOpacity:`0.07`,strokeLinejoin:`round`}),(0,E.jsx)(`path`,{d:`M8.5 1v3h3`,stroke:on,strokeWidth:`0.9`,fill:`none`,strokeLinejoin:`round`}),(0,E.jsx)(`circle`,{cx:`7`,cy:`8.5`,r:`1.3`,stroke:on,strokeWidth:`0.9`}),(0,E.jsx)(`path`,{d:`M7 6.5v.7M7 10.3v.7M5 8.5h.7M8.3 8.5H9M5.5 6.9l.5.5M8.5 9.6l-.5-.5M5.5 10.1l.5-.5M8.5 7.4l-.5.5`,stroke:on,strokeWidth:`0.8`,strokeLinecap:`round`})]})}function Fn(e,t=14){let n=e.toLowerCase(),r=n.split(`.`).pop()??``;if(n===`dockerfile`||n.startsWith(`dockerfile.`))return(0,E.jsx)(On,{size:t});if(n===`.env`||n.startsWith(`.env.`))return(0,E.jsx)(kn,{size:t});if(n===`.gitignore`||n===`.gitattributes`||n===`.gitmodules`)return(0,E.jsx)(An,{size:t});if(n===`package-lock.json`||n===`yarn.lock`||n===`bun.lock`||n===`pnpm-lock.yaml`||n===`cargo.lock`)return(0,E.jsx)(jn,{size:t});if(n.endsWith(`.config.ts`)||n.endsWith(`.config.js`)||n.endsWith(`.config.mjs`)||n.endsWith(`.config.cjs`)||[`.eslintrc`,`.eslintrc.js`,`.eslintrc.json`,`.eslintrc.yml`,`eslint.config.mjs`,`eslint.config.js`].includes(n))return(0,E.jsx)(Pn,{size:t});switch(r){case`ts`:return(0,E.jsx)(un,{size:t});case`tsx`:return(0,E.jsx)(dn,{size:t});case`js`:case`mjs`:case`cjs`:return(0,E.jsx)(fn,{size:t});case`jsx`:return(0,E.jsx)(pn,{size:t});case`py`:return(0,E.jsx)(mn,{size:t});case`json`:case`jsonl`:return(0,E.jsx)(hn,{size:t});case`css`:case`less`:return(0,E.jsx)(gn,{size:t});case`scss`:return(0,E.jsx)(_n,{size:t});case`html`:case`htm`:return(0,E.jsx)(vn,{size:t});case`md`:case`mdx`:return(0,E.jsx)(yn,{size:t});case`yaml`:case`yml`:return(0,E.jsx)(bn,{size:t});case`toml`:return(0,E.jsx)(xn,{size:t});case`sh`:case`bash`:case`zsh`:case`fish`:return(0,E.jsx)(Sn,{size:t});case`rs`:return(0,E.jsx)(Cn,{size:t});case`go`:return(0,E.jsx)(wn,{size:t});case`sql`:return(0,E.jsx)(Tn,{size:t});case`graphql`:case`gql`:return(0,E.jsx)(En,{size:t});case`tf`:case`hcl`:return(0,E.jsx)(Dn,{size:t});case`docx`:return(0,E.jsx)(Mn,{size:t});case`pdf`:return(0,E.jsx)(Nn,{size:t});case`lock`:return(0,E.jsx)(jn,{size:t});default:return(0,E.jsx)(cn,{size:t})}}var In={up:{top:0,left:0,right:0},down:{bottom:0,left:0,right:0},left:{left:0,top:0,bottom:0},right:{right:0,top:0,bottom:0}},Ln={up:{left:`50%`,transform:`translateX(-50%)`},down:{left:`50%`,transform:`translateX(-50%)`},left:{top:`50%`,transform:`translateY(-50%)`},right:{top:`50%`,transform:`translateY(-50%)`}},Rn={up:`linear-gradient(to bottom, var(--bg), transparent)`,down:`linear-gradient(to top, var(--bg), transparent)`,left:`linear-gradient(to right, var(--bg), transparent)`,right:`linear-gradient(to left, var(--bg), transparent)`},zn={up:{borderLeft:`6px solid transparent`,borderRight:`6px solid transparent`,borderBottom:`7px solid var(--text-muted)`},down:{borderLeft:`6px solid transparent`,borderRight:`6px solid transparent`,borderTop:`7px solid var(--text-muted)`},left:{borderTop:`6px solid transparent`,borderBottom:`6px solid transparent`,borderRight:`7px solid var(--text-muted)`},right:{borderTop:`6px solid transparent`,borderBottom:`6px solid transparent`,borderLeft:`7px solid var(--text-muted)`}};function Bn({direction:e,visible:t,onHover:n,hoverInterval:r=200,onClick:i,length:a=`100%`,thickness:o=30,style:s,label:c,testId:l}){let u=(0,d.useRef)(n);u.current=n;let f=(0,d.useRef)(null),p=(0,d.useCallback)(()=>{f.current!==null&&(clearInterval(f.current),f.current=null)},[]),m=(0,d.useCallback)(()=>{p(),u.current?.(),u.current&&(f.current=window.setInterval(()=>u.current?.(),r))},[r,p]);if((0,d.useEffect)(()=>p,[p]),!t)return null;let h=e===`up`||e===`down`,g={position:`absolute`,pointerEvents:`none`,zIndex:49,height:o,...h?{left:0,right:0}:{width:o,top:0,bottom:0},...In[e],background:Rn[e]},_={position:`absolute`,zIndex:50,cursor:`pointer`,background:`transparent`,border:`none`,padding:0,display:`flex`,alignItems:`center`,justifyContent:`center`,...In[e],...h?{width:a,height:o}:{height:a,width:o},...Ln[e],...s};return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`span`,{style:g,"aria-hidden":`true`}),(0,E.jsx)(`button`,{type:`button`,"data-testid":l??`scroll-direction-hint-${e}`,"aria-label":c??`Scroll ${e}`,title:c??`Scroll ${e}`,style:_,onMouseEnter:m,onMouseLeave:p,onClick:i,children:(0,E.jsx)(`span`,{"aria-hidden":`true`,style:{width:0,height:0,pointerEvents:`none`,...zn[e]}})})]})}var Vn=2;function Hn({tabs:e,activeTabId:t,onSelectTab:n,onCloseTab:r,leftExtra:i,rightExtra:a,scrollStepPx:o=200}){let{t:s}=N(),[c,l]=(0,d.useState)(null),u=(0,d.useRef)(null),[f,m]=(0,d.useState)({scrollWidth:0,clientWidth:0,scrollLeft:0}),h=()=>{if(document.hidden)return;let e=u.current;e&&m({scrollWidth:e.scrollWidth,clientWidth:e.clientWidth,scrollLeft:e.scrollLeft})};(0,d.useLayoutEffect)(()=>{h();let e=u.current;if(!e)return;let t=new ResizeObserver(h);return t.observe(e),()=>t.disconnect()},[e]);let{scrollWidth:g,clientWidth:_,scrollLeft:v}=f,y=g-_>20,b=y&&v>Vn,x=y&&v+_<g-Vn,S=e=>{let t=u.current;if(!t)return;let n=Math.max(0,t.scrollWidth-t.clientWidth);t.scrollTo({left:Math.max(0,Math.min(n,t.scrollLeft+e*o)),behavior:`smooth`})},C=e=>{let t=u.current;t&&t.scrollTo({left:e===`left`?0:Math.max(0,t.scrollWidth-t.clientWidth),behavior:`smooth`})};return(0,E.jsxs)(`div`,{"data-testid":`tab-bar`,style:{display:`flex`,alignItems:`flex-end`,background:`var(--bg-panel)`,flexShrink:0,height:`calc(36px + env(safe-area-inset-top))`,paddingTop:`env(safe-area-inset-top)`},children:[i&&(0,E.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,height:36,flexShrink:0},children:i}),(0,E.jsxs)(`div`,{style:{position:`relative`,flex:1,minWidth:0,height:36},children:[(0,E.jsx)(`div`,{ref:u,"data-testid":`tab-scroll`,role:`tablist`,onScroll:h,style:{display:`flex`,alignItems:`flex-end`,overflowX:`auto`,overflowY:`hidden`,height:36},children:e.map(e=>{let i=e.id===t;return(0,E.jsxs)(`div`,{"data-tab-id":e.id,"data-active":i,role:`tab`,"aria-selected":i,onClick:()=>n(e.id),onMouseDown:e=>{e.button===1&&e.preventDefault()},onAuxClick:t=>{t.button===1&&e.closable!==!1&&(t.preventDefault(),t.stopPropagation(),r(e.id))},style:{display:`flex`,alignItems:`center`,justifyContent:`center`,position:`relative`,gap:6,height:36,paddingLeft:30,paddingRight:30,borderRight:`1px solid var(--border)`,background:i?`var(--bg)`:`var(--bg-panel)`,cursor:`pointer`,fontSize:`var(--text-base)`,color:i?`var(--text)`:`var(--text-muted)`,whiteSpace:`nowrap`,maxWidth:180,minWidth:80,flexShrink:0,userSelect:`none`,transition:`background 0.1s, color 0.1s`},children:[(0,E.jsx)(`span`,{style:{flexShrink:0,opacity:i?1:.7,display:`flex`,alignItems:`center`},children:e.icon??(e.filePath?Fn(e.label,13):null)}),(0,E.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,fontWeight:i?500:400},title:e.filePath,children:e.label}),e.badge!=null&&e.badge>0&&(0,E.jsx)(`span`,{style:{flexShrink:0,marginLeft:5,minWidth:16,height:16,padding:`0 5px`,borderRadius:5,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,border:`1px solid var(--accent)`,background:`color-mix(in srgb, var(--accent) 12%, transparent)`,color:`var(--accent)`,fontSize:`var(--text-2xs)`,fontWeight:600,lineHeight:1},children:e.badge>99?`99+`:e.badge}),e.closable!==!1&&(0,E.jsx)(`button`,{onClick:t=>{t.stopPropagation(),r(e.id)},onMouseEnter:()=>l(e.id),onMouseLeave:()=>l(null),style:{display:`flex`,alignItems:`center`,justifyContent:`center`,position:`absolute`,right:6,top:`50%`,transform:`translateY(-50%)`,width:24,height:24,background:c===e.id?`var(--bg-hover)`:`transparent`,border:`none`,borderRadius:4,color:c===e.id?`var(--text)`:`var(--text-dim)`,cursor:`pointer`,padding:0,flexShrink:0,transition:`background 0.1s, color 0.1s`},title:s(`i18n.close`),"aria-label":`${s(`i18n.close`)} ${e.label}`,children:(0,E.jsxs)(`svg`,{width:p.sm,height:p.sm,viewBox:`0 0 10 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,E.jsx)(`line`,{x1:`2`,y1:`2`,x2:`8`,y2:`8`}),(0,E.jsx)(`line`,{x1:`8`,y1:`2`,x2:`2`,y2:`8`})]})})]},e.id)})}),b&&(0,E.jsx)(Bn,{direction:`left`,visible:!0,testId:`tab-scroll-left`,thickness:18,onHover:()=>S(-1),onClick:()=>C(`left`)}),x&&(0,E.jsx)(Bn,{direction:`right`,visible:!0,testId:`tab-scroll-right`,thickness:18,onHover:()=>S(1),onClick:()=>C(`right`)})]}),a&&(0,E.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,height:36,flexShrink:0,paddingRight:`env(safe-area-inset-right)`},children:a})]})}function Un(e){return null}function Wn({activeId:e,children:t}){let n=d.Children.toArray(t).filter(e=>(0,d.isValidElement)(e)&&e.type===Un);return(0,E.jsx)(E.Fragment,{children:n.map(t=>{let n=t.props.activeWhen!==!1&&t.props.id===e;return!t.props.keepAlive&&!n?null:(0,E.jsx)(`div`,{"data-testid":t.props.testId,style:{position:`absolute`,inset:0,display:`flex`,flexDirection:`column`,overflow:t.props.scroll??`auto`,zIndex:t.props.zIndex,contentVisibility:n?`visible`:`hidden`,pointerEvents:n?void 0:`none`},children:t.props.children},t.props.id)})})}function Gn({tabs:e,activeTabId:t,onSelectTab:n,onCloseTab:r,leftExtra:i,rightExtra:a,scrollStepPx:o,tabBarRef:s,overlay:c,children:l}){return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{ref:s,style:{flexShrink:0,background:`var(--bg-panel)`},children:[(0,E.jsx)(Hn,{tabs:e,activeTabId:t,leftExtra:i,rightExtra:a,onSelectTab:n,onCloseTab:r,scrollStepPx:o}),(0,E.jsx)(`div`,{style:{height:1,background:`var(--border)`,flexShrink:0}})]}),(0,E.jsx)(`div`,{style:{flex:1,overflow:`hidden`,position:`relative`,display:`flex`},children:(0,E.jsxs)(`div`,{style:{flex:1,overflow:`hidden`,position:`relative`,minWidth:0,minHeight:0,display:`flex`,flexDirection:`column`},children:[(0,E.jsx)(Wn,{activeId:t,children:l}),c]})})]})}var Kn=new Set;function qn(e){return Kn.add(e),()=>{Kn.delete(e)}}function Jn(){return typeof document>`u`?`light`:document.documentElement.classList.contains(`dark`)?`dark`:`light`}function Yn(){return`light`}function Xn(){let e=(0,d.useSyncExternalStore)(qn,Jn,Yn);return{theme:e,toggleTheme:(0,d.useCallback)(e=>{let t=Jn()===`dark`?`light`:`dark`;t===`dark`?document.documentElement.classList.add(`dark`):document.documentElement.classList.remove(`dark`);try{localStorage.setItem(`pi-theme`,t)}catch{}fetch(`/api/preferences`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({firstPaint:{theme:t}})}).catch(()=>{}),Kn.forEach(e=>e())},[]),isDark:e===`dark`}}function Zn(e,t,n){let[r,i]=(0,d.useState)(()=>{try{let t=localStorage.getItem(e);if(t!==null){let e=JSON.parse(t);return n?n(e):e}}catch{}return typeof t==`function`?t():t});return(0,d.useEffect)(()=>{try{localStorage.setItem(e,JSON.stringify(r))}catch{}},[e,r]),[r,i]}function Qn(e){return{value:(0,d.useSyncExternalStore)(t=>e.subscribe(t),()=>e.get(),()=>e.get()),error:e.getError()}}var $n=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),er=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),tr=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),nr=e=>{let t=tr(e);return t.charAt(0).toUpperCase()+t.slice(1)},rr={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},ir=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},ar=(0,d.createContext)({}),or=()=>(0,d.useContext)(ar),sr=(0,d.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:f=!1,color:p=`currentColor`,className:m=``}=or()??{},h=r??f?Number(n??u)*24/Number(t??l):n??u;return(0,d.createElement)(`svg`,{ref:c,...rr,width:t??l??rr.width,height:t??l??rr.height,stroke:e??p,strokeWidth:h,className:$n(`lucide`,m,i),...!a&&!ir(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,d.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),cr=(e,t)=>{let n=(0,d.forwardRef)(({className:n,...r},i)=>(0,d.createElement)(sr,{ref:i,iconNode:t,className:$n(`lucide-${er(nr(e))}`,`lucide-${e}`,n),...r}));return n.displayName=nr(e),n},lr=cr(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),ur=cr(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),dr=cr(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),fr=cr(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),pr=cr(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),mr=cr(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),hr=cr(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),gr=cr(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),_r=cr(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),vr=cr(`expand`,[[`path`,{d:`m15 15 6 6`,key:`1s409w`}],[`path`,{d:`m15 9 6-6`,key:`ko1vev`}],[`path`,{d:`M21 16v5h-5`,key:`1ck2sf`}],[`path`,{d:`M21 8V3h-5`,key:`1qoq8a`}],[`path`,{d:`M3 16v5h5`,key:`1t08am`}],[`path`,{d:`m3 21 6-6`,key:`wwnumi`}],[`path`,{d:`M3 8V3h5`,key:`1ln10m`}],[`path`,{d:`M9 9 3 3`,key:`v551iv`}]]),yr=cr(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),br=cr(`fold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3-3-3 3`,key:`e37ymu`}],[`path`,{d:`m15 5-3 3-3-3`,key:`19d6lf`}]]),xr=cr(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Sr=cr(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),Cr=cr(`git-commit-horizontal`,[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]]),wr=cr(`hard-drive-upload`,[[`path`,{d:`m16 6-4-4-4 4`,key:`13yo43`}],[`path`,{d:`M12 2v8`,key:`1q4o3n`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,key:`w68u3i`}],[`path`,{d:`M6 18h.01`,key:`uhywen`}],[`path`,{d:`M10 18h.01`,key:`h775k`}]]),Tr=cr(`hourglass`,[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]),Er=cr(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),Dr=cr(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),Or=cr(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),kr=cr(`list-end`,[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M16 12H3`,key:`1a2rj7`}],[`path`,{d:`M9 19H3`,key:`s61nz1`}],[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M21 5v12a2 2 0 0 1-2 2h-6`,key:`hey24a`}]]),Ar=cr(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),jr=cr(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Mr=cr(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Nr=cr(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),Pr=cr(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Fr=cr(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),Ir=cr(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Lr=cr(`puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),Rr=cr(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),zr=cr(`rotate-ccw-clock`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),Br=cr(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Vr=cr(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Hr=cr(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Ur=cr(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),Wr=cr(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Gr=cr(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),Kr=cr(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),qr=cr(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Jr=cr(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Yr=cr(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Xr=cr(`trash`,[[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Zr=cr(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Qr=cr(`unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),$r=cr(`volume-2`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]),ei=cr(`volume-x`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`line`,{x1:`22`,x2:`16`,y1:`9`,y2:`15`,key:`1ewh16`}],[`line`,{x1:`16`,x2:`22`,y1:`9`,y2:`15`,key:`5ykzw1`}]]),ti=cr(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),ni=cr(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),ri=cr(`zap`,[[`path`,{d:`M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z`,key:`1v7up4`}]]),ii=e(c(),1);function ai({children:e}){return(0,E.jsx)(E.Fragment,{children:e})}function oi({label:e,wrapperStyle:t,children:n}){let r=(0,d.useRef)(null),i=(0,d.useRef)(null),[a,o]=(0,d.useState)(!1),[s,c]=(0,d.useState)(!1),[l,u]=(0,d.useState)({top:0,left:0});if((0,d.useLayoutEffect)(()=>{if(!e||!a||!s)return;let t=r.current?.getBoundingClientRect(),n=i.current;if(!t||!n)return;let o=n.offsetWidth;if(!o)return;let c=t.left+t.width/2,l=o/2,d=window.innerWidth,f=Math.max(l+8,Math.min(c,d-l-8));u({top:t.bottom+6,left:f})},[e,a,s]),!e)return(0,E.jsx)(E.Fragment,{children:n});let f=()=>{let e=r.current?.getBoundingClientRect();e&&u({top:e.bottom+6,left:e.left+e.width/2})},p=()=>{f(),c(!0),o(!0)},m=()=>o(!1),h=s&&typeof document<`u`?(0,ii.createPortal)((0,E.jsx)(`div`,{ref:i,role:`tooltip`,"data-slot":`tooltip-content`,style:{position:`fixed`,top:l.top,left:l.left,transform:`translateX(-50%)`,zIndex:9999,width:`max-content`,maxWidth:`min(20rem, calc(100vw - 16px))`,whiteSpace:`pre-line`,overflowWrap:`break-word`,background:`var(--bg-panel)`,color:`var(--text)`,border:`1px solid var(--border)`,borderRadius:`var(--radius-md, 6px)`,padding:`4px 8px`,fontSize:`var(--text-sm)`,lineHeight:1.5,boxShadow:`0 4px 16px -2px var(--shadow-strong)`,pointerEvents:`none`,display:a?`block`:`none`},children:e}),document.body):null;return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`span`,{ref:r,"data-slot":`tooltip-trigger`,title:``,onPointerEnter:p,onPointerLeave:m,onMouseEnter:p,onMouseLeave:m,onFocus:p,onBlur:m,onPointerMove:e=>e.stopPropagation(),style:{display:`inline-flex`,...t},children:n}),h]})}var si={boxSizing:`border-box`,background:`var(--bg-input, var(--bg))`,color:`var(--text)`,border:`1px solid var(--border)`,borderRadius:4,padding:`4px 8px`,fontSize:`var(--text-base)`,fontFamily:`var(--font-mono)`},ci={display:`flex`,alignItems:`center`,justifyContent:`center`,width:22,height:22,padding:0,background:`none`,border:`1px solid var(--border)`,borderRadius:5,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-sm)`,lineHeight:1,flexShrink:0};function li({value:e,onChange:t,parse:n}){let[r,i]=(0,d.useState)(String(e));return(0,d.useEffect)(()=>{i(String(e))},[e]),{draft:r,commit:e=>{i(e);let r=n(e);r!==null&&t(r)}}}function ui({tooltip:e=!1,offText:t,...n}){let{t:r,labelKey:i,unitText:a,rangeText:o,resetText:s,defaultValue:c,min:l,max:u}=n,{draft:d,commit:f}=li(n),p=t!=null&&n.value===c?t:o,m=(0,E.jsx)(`input`,{type:`number`,min:l,max:u,step:1,value:d,onChange:e=>f(e.target.value),"aria-label":r(i),...e?{}:{title:p},style:{flex:1,minWidth:0,...si}}),h=(0,E.jsx)(`button`,{type:`button`,onClick:()=>n.onChange(c),"aria-label":s,...e?{}:{title:s},style:ci,children:`↺`});return(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,width:`100%`},children:[e?(0,E.jsx)(oi,{label:p,wrapperStyle:{flex:1,display:`flex`},children:m}):m,(0,E.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`,whiteSpace:`nowrap`},children:a}),e?(0,E.jsx)(oi,{label:s,children:h}):h]})}function di({unitSuffix:e,offText:t,tooltip:n=!0,...r}){let{t:i,labelKey:a,rangeText:o,resetText:s,value:c,defaultValue:l,min:u,max:d}=r,{draft:f,commit:p}=li(r);return(0,E.jsxs)(`div`,{role:`menu`,"aria-label":i(a),style:{background:`var(--bg-panel)`,borderLeft:`1px solid var(--border)`,borderRight:`1px solid var(--border)`,borderBottom:`1px solid var(--border)`,padding:`10px 12px 12px`},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,fontSize:`var(--text-base)`,color:`var(--text-muted)`,marginBottom:8},children:[(0,E.jsx)(`span`,{children:i(a)}),(0,E.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,E.jsxs)(`span`,{style:{fontFamily:`var(--font-mono)`,color:`var(--text)`,fontWeight:600},children:[c,e]}),(()=>{let e=(0,E.jsx)(`button`,{type:`button`,onClick:()=>r.onChange(l),"aria-label":s,...n?{}:{title:s},style:ci,children:`↺`});return n?(0,E.jsx)(oi,{label:s,children:e}):e})()]})]}),(0,E.jsx)(`input`,{type:`number`,min:u,max:d,step:1,value:f,onChange:e=>p(e.target.value),"aria-label":i(a),style:{width:`100%`,...si}}),(0,E.jsx)(`div`,{style:{fontSize:`var(--text-xs)`,color:`var(--text-dim)`,marginTop:4,textAlign:`center`},children:t!=null&&c===l?t:o})]})}function fi({value:e,onChange:t,t:n,embedded:r}){let i={value:e,onChange:t,parse:ze,min:1,max:Le,defaultValue:200,t:n,labelKey:`theme.scrollStep`,unitText:n(`scrollStep.unit`),rangeText:n(`scrollStep.range`),resetText:n(`scrollStep.reset`,{n:200})};return r?(0,E.jsx)(ui,{...i,tooltip:!0}):(0,E.jsx)(di,{...i,unitSuffix:`px`})}function pi({label:e,hint:t,children:n}){return(0,E.jsxs)(mi,{children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,minWidth:0},children:[(0,E.jsx)(`span`,{style:{fontSize:`var(--text-lg)`,color:`var(--text)`,fontWeight:500,whiteSpace:`nowrap`},children:e}),t&&(0,E.jsx)(oi,{label:t,children:(0,E.jsx)(`span`,{role:`img`,"aria-label":t,style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`,cursor:`help`,lineHeight:1,flexShrink:0},children:`ⓘ`})})]}),(0,E.jsx)(`div`,{style:{flex:1,minWidth:0,maxWidth:320},children:n})]})}function mi({children:e}){return(0,E.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:16,padding:`10px 14px`,border:`1px solid var(--border)`,borderRadius:10,background:`var(--bg-panel)`},children:e})}function hi({sidebarWidth:e,onSidebarWidthChange:t,widgetPanelWidth:n,onWidgetPanelWidthChange:r}){let{t:i}=N(),{isDark:a,toggleTheme:o,fontScale:s,setFontScale:c,scrollStepPx:l,setScrollStepPx:u,longBlockCollapseChars:d,setLongBlockCollapseChars:f,recentBlocksExpanded:p,setRecentBlocksExpanded:m}=ge();return(0,E.jsxs)(`div`,{style:{height:`100%`,overflowY:`auto`,padding:`18px 20px 40px`,display:`flex`,flexDirection:`column`,gap:8,maxWidth:640},children:[(0,E.jsx)(pi,{label:i(`theme.toggleTheme`),children:(0,E.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:16,width:`100%`},children:[{value:!0,key:`dark`,labelKey:`theme.darkMode`},{value:!1,key:`light`,labelKey:`theme.lightMode`}].map(({value:e,key:t,labelKey:n})=>(0,E.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:6,fontSize:`var(--text-base)`,color:`var(--text)`,cursor:`pointer`,whiteSpace:`nowrap`},children:[(0,E.jsx)(`input`,{type:`radio`,name:`theme-mode`,checked:a===e,onChange:e=>{let t=e.currentTarget.getBoundingClientRect();o({x:t.left+t.width/2,y:t.top+t.height/2})},style:{accentColor:`var(--accent)`,cursor:`pointer`,margin:0}}),i(n)]},t))})}),(0,E.jsx)(pi,{label:i(`theme.fontSize`),children:(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,width:`100%`},children:[(0,E.jsx)(`input`,{type:`range`,min:.85,max:1.3,step:.05,value:s,onChange:e=>c(Number(e.target.value)),"aria-label":i(`theme.fontSize`),style:{flex:1,accentColor:`var(--accent)`,cursor:`pointer`}}),(0,E.jsxs)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`var(--text-base)`,color:`var(--text)`,fontWeight:600,minWidth:44,textAlign:`right`},children:[Math.round(s*100),`%`]})]})}),(0,E.jsx)(pi,{label:i(`theme.scrollStep`),hint:i(`scrollStep.hint`),children:(0,E.jsx)(fi,{value:l,onChange:u,t:i,embedded:!0})}),(0,E.jsx)(pi,{label:i(`theme.longBlockCollapse`),hint:i(`longBlock.hint`),children:(0,E.jsx)(vi,{value:d,onChange:f,t:i})}),(0,E.jsx)(pi,{label:i(`theme.recentBlocksExpanded`),hint:i(`recentBlocks.hint`),children:(0,E.jsx)(_i,{value:p,onChange:m,t:i})}),(0,E.jsx)(pi,{label:i(`layout.sidebarWidth`),hint:i(`layout.widthRange`,{min:180,max:480}),children:(0,E.jsx)(gi,{value:e,onChange:t,min:180,max:480,resetTo:280,label:i(`layout.sidebarWidth`),t:i})}),(0,E.jsx)(pi,{label:i(`layout.widgetPanelWidth`),hint:i(`layout.widthRange`,{min:200,max:560}),children:(0,E.jsx)(gi,{value:n,onChange:r,min:200,max:560,resetTo:280,label:i(`layout.widgetPanelWidth`),t:i})}),` `]})}function gi({value:e,onChange:t,min:n,max:r,resetTo:i,label:a,t:o}){return(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,minWidth:0},children:[(0,E.jsx)(`input`,{type:`number`,value:e,min:n,max:r,onChange:e=>{let i=Number.parseInt(e.target.value,10);Number.isFinite(i)&&t(Math.min(r,Math.max(n,i)))},onBlur:()=>t(e),"aria-label":a,style:{width:80,padding:`5px 8px`,border:`1px solid var(--border)`,borderRadius:7,background:`var(--bg)`,color:`var(--text)`,fontSize:`var(--text-lg)`,fontVariantNumeric:`tabular-nums`,outline:`none`}}),(0,E.jsx)(`span`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:`px`}),(0,E.jsx)(oi,{label:o(`layout.widthReset`,{value:i}),children:(0,E.jsx)(`button`,{type:`button`,onClick:()=>t(i),"aria-label":o(`layout.widthReset`,{value:i}),style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:26,height:26,padding:0,background:`none`,border:`none`,borderRadius:5,color:`var(--text-dim)`,cursor:`pointer`},children:(0,E.jsxs)(`svg`,{width:p.base,height:p.base,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,E.jsx)(`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`}),(0,E.jsx)(`path`,{d:`M3 3v5h5`})]})})})]})}function _i({value:e,onChange:t,t:n}){return(0,E.jsx)(ui,{tooltip:!0,value:e,onChange:t,parse:Ke,min:0,max:20,defaultValue:0,t:n,labelKey:`theme.recentBlocksExpanded`,unitText:n(`longBlock.blocks`),rangeText:n(`recentBlocks.range`),resetText:n(`recentBlocks.reset`,{n:0})})}function vi({value:e,onChange:t,t:n}){return(0,E.jsx)(ui,{tooltip:!0,value:e,onChange:t,parse:Ue,min:20,max:Ve,defaultValue:200,t:n,labelKey:`theme.longBlockCollapse`,unitText:n(`longBlock.chars`),rangeText:n(`longBlock.range`),resetText:n(`longBlock.reset`,{n:200})})}var yi=[`auto`,`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`],bi=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`];function xi(e,t){if(!t||t.length===0)return e;let n=new Set(t);if(n.has(e))return e;let r=bi.indexOf(e);for(let e=r+1;e<bi.length;e++)if(n.has(bi[e]))return bi[e];for(let e=r-1;e>=0;e--)if(n.has(bi[e]))return bi[e];return e}var Si={auto:`chat.thinkingUseDefault`,off:`chat.thinkingOff`,minimal:`chat.thinkingMinimal`,low:`chat.thinkingLow`,medium:`chat.thinkingMedium`,high:`chat.thinkingHigh`,xhigh:`chat.thinkingXhigh`,max:`chat.thinkingMax`},Ci={off:`var(--text-dim)`,minimal:`var(--text-muted)`,low:`#60a5fa`,medium:`#a78bfa`,high:`#f472b6`,xhigh:`#fb923c`,max:`#ef4444`};function wi({value:e,onChange:t,t:n,embedded:r}){let i={value:e,onChange:t,parse:Fe,min:0,max:Pe,defaultValue:0,t:n,labelKey:`theme.autoReloadSeconds`,unitText:n(`autoReload.unit`),rangeText:n(`autoReload.range`),resetText:n(`autoReload.reset`,{n:0})};return r?(0,E.jsx)(ui,{...i,tooltip:!0,offText:n(`autoReload.off`)}):(0,E.jsx)(di,{...i,unitSuffix:`s`,offText:n(`autoReload.off`)})}var Ti=Object.defineProperty,Ei=(e,t)=>Ti(e,`name`,{value:t,configurable:!0});function Di(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}Ei(Di,`setRef`);function Oi(...e){return t=>{let n=!1,r=e.map(e=>{let r=Di(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():Di(e[t],null)}}}}Ei(Oi,`composeRefs`);function ki(...e){return d.useCallback(Oi(...e),e)}Ei(ki,`useComposedRefs`);var Ai=Object.defineProperty,ji=(e,t)=>Ai(e,`name`,{value:t,configurable:!0});function Mi(e){let t=d.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];Vi(r)&&typeof Gi==`function`&&(r=Gi(r._payload)),d.Children.forEach(r,e=>{if(zi(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;Vi(n)&&typeof Gi==`function`&&(n=Gi(n._payload)),a=Ii(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=d.cloneElement(a,void 0,s):!o&&d.Children.count(r)===1&&d.isValidElement(r)&&(a=r);let c=a?Ri(a):void 0,l=ki(n,c);if(!a){if(r||r===0)throw Error(o?Wi(e):Ui(e));return r}let u=Li(i,a.props??{});return a.type!==d.Fragment&&(u.ref=n?l:c),d.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}ji(Mi,`createSlot`);var Ni=Mi(`Slot`),Pi=Symbol.for(`radix.slottable`);function Fi(e){let t=ji(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=Pi,t}ji(Fi,`createSlottable`);var Ii=ji((e,t)=>{if(`child`in e.props){let t=e.props.child;return d.isValidElement(t)?d.cloneElement(t,void 0,e.props.children(t.props.children)):null}return d.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function Li(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}ji(Li,`mergeProps`);function Ri(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}ji(Ri,`getElementRef`);function zi(e){return d.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Pi}ji(zi,`isSlottable`);var Bi=Symbol.for(`react.lazy`);function Vi(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Bi&&`_payload`in e&&Hi(e._payload)}ji(Vi,`isLazyComponent`);function Hi(e){return typeof e==`object`&&!!e&&`then`in e}ji(Hi,`isPromiseLike`);var Ui=ji(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),Wi=ji(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),Gi=d.use,Ki=Object.defineProperty,qi=(e,t)=>Ki(e,`name`,{value:t,configurable:!0}),Ji=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Mi(`Primitive.${t}`),r=d.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,E.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Yi(e,t){e&&ii.flushSync(()=>e.dispatchEvent(t))}qi(Yi,`dispatchDiscreteCustomEvent`);var Xi=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),Zi=Object.defineProperty,Qi=(e,t)=>Zi(e,`name`,{value:t,configurable:!0});function $i(e,t){let n=d.createContext(t);n.displayName=e+`Context`;let r=Qi(e=>{let{children:t,...r}=e,i=d.useMemo(()=>r,Object.values(r));return(0,E.jsx)(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=d.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return Qi(i,`useContext`),[r,i]}Qi($i,`createContext`);function ea(e,t=[]){let n=[];function r(t,r){let i=d.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=Qi(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=d.useMemo(()=>o,Object.values(o));return(0,E.jsx)(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=d.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return Qi(s,`useContext`),[o,s]}Qi(r,`createContext`);let i=Qi(()=>{let t=n.map(e=>d.createContext(e));return Qi(function(n){let r=n?.[e]||t;return d.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,ta(i,...t)]}Qi(ea,`createContextScope`);function ta(...e){let t=e[0];if(e.length===1)return t;let n=Qi(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return Qi(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return d.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}Qi(ta,`composeContextScopes`);var na=Object.defineProperty,ra=(e,t)=>na(e,`name`,{value:t,configurable:!0});function ia(e){let t=e+`CollectionProvider`,[n,r]=ea(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=ra(e=>{let{scope:t,children:n}=e,r=d.useRef(null),a=d.useRef(new Map).current;return(0,E.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})},`CollectionProvider`);o.displayName=t;let s=e+`CollectionSlot`,c=Mi(s),l=d.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=ki(t,a(s,n).collectionRef);return(0,E.jsx)(c,{ref:i,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,f=`data-radix-collection-item`,p=Mi(u),m=d.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=d.useRef(null),s=ki(t,o),c=a(u,n);return d.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,E.jsx)(p,{[f]:``,ref:s,children:r})});m.displayName=u;function h(t){let n=a(e+`CollectionConsumer`,t);return d.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${f}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return ra(h,`useCollection`),[{Provider:o,Slot:l,ItemSlot:m},h,r]}ra(ia,`createCollection`);var aa=new WeakMap,oa=class e extends Map{static{ra(this,`OrderedDict`)}#e;constructor(e){super(e),this.#e=[...super.keys()],aa.set(this,!0)}set(e,t){return aa.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,n){let r=this.has(t),i=this.#e.length,a=la(e),o=a>=0?a:i+a,s=o<0||o>=i?-1:o;if(s===this.size||r&&s===this.size-1||s===-1)return this.set(t,n),this;let c=this.size+ +!r;a<0&&o++;let l=[...this.#e],u,d=!1;for(let e=o;e<c;e++)if(o===e){let i=l[e];l[e]===t&&(i=l[e+1]),r&&this.delete(t),u=this.get(i),this.set(t,n)}else{!d&&l[e-1]===t&&(d=!0);let n=l[d?e:e-1],r=u;u=this.get(n),this.delete(n),this.set(n,r)}return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r,t,n)}after(e){let t=this.#e.indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r+1,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return t!==void 0&&this.delete(t)}at(e){let t=sa(this.#e,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=sa(this.#e,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return sa(this.#e,e)}from(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return-1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=0,i=n??this.at(0);for(let n of this)i=r===0&&e.length===1?n:Reflect.apply(t,this,[i,n,r,this]),r++;return i}reduceRight(...e){let[t,n]=e,r=n??this.at(-1);for(let n=this.size-1;n>=0;n--){let i=this.at(n);r=n===this.size-1&&e.length===1?i:Reflect.apply(t,this,[r,i,n,this])}return r}toSorted(t){let n=[...this.entries()].sort(t);return new e(n)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e,i=this.size-1;if(t===void 0)return r;t<0&&(t+=this.size),n!==void 0&&n>0&&(i=n-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),n=this.get(t);r.set(t,n)}return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function sa(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=ca(e,t);return n===-1?void 0:e[n]}ra(sa,`at`);function ca(e,t){let n=e.length,r=la(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}ra(ca,`toSafeIndex`);function la(e){return e!==e||e===0?0:Math.trunc(e)}ra(la,`toSafeInteger`);function ua(e){let t=e+`CollectionProvider`,[n,r]=ea(t),[i,a]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new oa,setItemMap:ra(()=>void 0,`setItemMap`)}),o=ra(({state:e,...t})=>e?(0,E.jsx)(c,{...t,state:e}):(0,E.jsx)(s,{...t}),`CollectionProvider`);o.displayName=t;let s=ra(e=>{let t=g();return(0,E.jsx)(c,{...e,state:t})},`CollectionInit`);s.displayName=t+`Init`;let c=ra(e=>{let{scope:t,children:n,state:r}=e,a=d.useRef(null),[o,s]=d.useState(null),c=ki(a,s),[l,u]=r;return d.useEffect(()=>{if(!o)return;let e=ma(()=>{});return e.observe(o,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[o]),(0,E.jsx)(i,{scope:t,itemMap:l,setItemMap:u,collectionRef:c,collectionRefObject:a,collectionElement:o,children:n})},`CollectionProviderImpl`);c.displayName=t+`Impl`;let l=e+`CollectionSlot`,u=Mi(l),f=d.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=ki(t,a(l,n).collectionRef);return(0,E.jsx)(u,{ref:i,children:r})});f.displayName=l;let p=e+`CollectionItemSlot`,m=Mi(p),h=d.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=d.useRef(null),[s,c]=d.useState(null),l=ki(t,o,c),{setItemMap:u}=a(p,n),f=d.useRef(i);da(f.current,i)||(f.current=i);let h=f.current;return d.useEffect(()=>{let e=h;return u(t=>s?t.has(s)?t.set(s,{...e,element:s}).toSorted(pa):(t.set(s,{...e,element:s}),t.toSorted(pa)):t),()=>{u(e=>!s||!e.has(s)?e:(e.delete(s),new oa(e)))}},[s,h,u]),(0,E.jsx)(m,{"data-radix-collection-item":``,ref:l,children:r})});h.displayName=p;function g(){return d.useState(new oa)}ra(g,`useInitCollection`);function _(t){let{itemMap:n}=a(e+`CollectionConsumer`,t);return n}return ra(_,`useCollection`),[{Provider:o,Slot:f,ItemSlot:h},{createCollectionScope:r,useCollection:_,useInitCollection:g}]}ra(ua,`createCollection`);function da(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}ra(da,`shallowEqual`);function fa(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}ra(fa,`isElementPreceding`);function pa(e,t){return!e[1].element||!t[1].element?0:fa(e[1].element,t[1].element)?-1:1}ra(pa,`sortByDocumentPosition`);function ma(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}ra(ma,`getChildListObserver`);var ha=Object.defineProperty,ga=(e,t)=>ha(e,`name`,{value:t,configurable:!0}),_a=!!(typeof window<`u`&&window.document&&window.document.createElement);function va(e,t,{checkForDefaultPrevented:n=!0}={}){return ga(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}ga(va,`composeEventHandlers`);function ya(e){if(!_a)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}ga(ya,`getOwnerWindow`);function ba(e){if(!_a)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}ga(ba,`getOwnerDocument`);function xa(e,t=!1){let{activeElement:n}=ba(e);if(!n?.nodeName)return null;if(Sa(n)&&n.contentDocument)return xa(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=ba(n).getElementById(e);if(t)return t}}return n}ga(xa,`getActiveElement`);function Sa(e){return e.tagName===`IFRAME`}ga(Sa,`isFrame`);var Ca=globalThis?.document?d.useLayoutEffect:()=>{},wa=Object.defineProperty,Ta=(e,t)=>wa(e,`name`,{value:t,configurable:!0}),Ea=d.useEffectEvent,Da=d.useInsertionEffect;function Oa(e){if(typeof Ea==`function`)return Ea(e);let t=d.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof Da==`function`?Da(()=>{t.current=e}):Ca(()=>{t.current=e}),d.useMemo(()=>((...e)=>t.current?.(...e)),[])}Ta(Oa,`useEffectEvent`);var ka=Object.defineProperty,Aa=(e,t)=>ka(e,`name`,{value:t,configurable:!0}),ja=d.useInsertionEffect||Ca;function Ma({prop:e,defaultProp:t,onChange:n=Aa(()=>{},`onChange`),caller:r}){let[i,a,o]=Na({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,d.useCallback(t=>{if(s){let n=Pa(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}Aa(Ma,`useControllableState`);function Na({defaultProp:e,onChange:t}){let[n,r]=d.useState(e),i=d.useRef(n),a=d.useRef(t);return ja(()=>{a.current=t},[t]),d.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}Aa(Na,`useUncontrolledState`);function Pa(e){return typeof e==`function`}Aa(Pa,`isFunction`);var Fa=Symbol(`RADIX:SYNC_STATE`);function Ia(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=Oa(o),u=[{...n,state:a}];r&&u.push(r);let[f,p]=d.useReducer((t,n)=>{if(n.type===Fa)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),m=f.state,h=d.useRef(m);d.useEffect(()=>{h.current!==m&&(h.current=m,c||l(m))},[m,h,c]);let g=d.useMemo(()=>i===void 0?f:{...f,state:i},[f,i]);return d.useEffect(()=>{c&&!Object.is(i,f.state)&&p({type:Fa,state:i})},[i,f.state,c]),[g,p]}Aa(Ia,`useControllableStateReducer`);var La=Object.defineProperty,Ra=(e,t)=>La(e,`name`,{value:t,configurable:!0});function za(e,t){return d.useReducer((e,n)=>t[e][n]??e,e)}Ra(za,`useStateMachine`);var Ba=Ra(e=>{let{present:t,children:n}=e,r=Va(t),i=typeof n==`function`?n({present:r.isPresent}):d.Children.only(n),a=Ua(r.ref,Ga(i));return typeof n==`function`||r.isPresent?d.cloneElement(i,{ref:a}):null},`Presence`);function Va(e){let[t,n]=d.useState(),r=d.useRef(null),i=d.useRef(e),a=d.useRef(`none`),o=d.useRef(void 0),[s,c]=za(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return d.useEffect(()=>{s===`mounted`?(a.current=o.current??Wa(r.current),o.current=void 0):a.current=`none`},[s]),Ca(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=Wa(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),Ca(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=Ra(a=>{let o=Wa(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=Ra(e=>{e.target===t&&(a.current=Wa(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:d.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=Wa(t)}else r.current=null;n(e)},[])}}Ra(Va,`usePresence`);function Ha(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}Ra(Ha,`setRef`);function Ua(...e){let t=d.useRef(e);return t.current=e,d.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=Ha(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():Ha(n[e],null)}}},[])}Ra(Ua,`useStableComposedRefs`);function Wa(e){return e?.animationName||`none`}Ra(Wa,`getAnimationName`);function Ga(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Ra(Ga,`getElementRef`);var Ka=Object.defineProperty,qa=(e,t)=>Ka(e,`name`,{value:t,configurable:!0}),Ja=d.useId||(()=>void 0),Ya=0;function Xa(e){let[t,n]=d.useState(Ja());return Ca(()=>{e||n(e=>e??String(Ya++))},[e]),e||(t?`radix-${t}`:``)}qa(Xa,`useId`);var Za=Object.defineProperty,Qa=(e,t)=>Za(e,`name`,{value:t,configurable:!0}),$a=`Collapsible`,[eo,to]=ea($a),[no,ro]=eo($a),io=d.forwardRef(Qa(function(e,t){let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=Ma({prop:r,defaultProp:i??!1,onChange:o,caller:$a});return(0,E.jsx)(no,{scope:n,disabled:a,contentId:Xa(),open:c,onOpenToggle:d.useCallback(()=>l(e=>!e),[l]),children:(0,E.jsx)(Ji.div,{"data-state":uo(c),"data-disabled":a?``:void 0,...s,ref:t})})},`Collapsible`)),ao=`CollapsibleTrigger`,oo=d.forwardRef(Qa(function(e,t){let{__scopeCollapsible:n,...r}=e,i=ro(ao,n);return(0,E.jsx)(Ji.button,{type:`button`,"aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open||!1,"data-state":uo(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:va(e.onClick,i.onOpenToggle)})},`CollapsibleTrigger`)),so=`CollapsibleContent`,co=d.forwardRef(Qa(function(e,t){let{forceMount:n,...r}=e,i=ro(so,e.__scopeCollapsible);return(0,E.jsx)(Ba,{present:n||i.open,children:({present:e})=>(0,E.jsx)(lo,{...r,ref:t,present:e})})},`CollapsibleContent`)),lo=d.forwardRef(Qa(function(e,t){let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=ro(so,n),[s,c]=d.useState(r),l=d.useRef(null),u=ki(t,l),f=d.useRef(0),p=f.current,m=d.useRef(0),h=m.current,g=o.open||s,_=d.useRef(g),v=d.useRef(void 0);return d.useEffect(()=>{let e=requestAnimationFrame(()=>_.current=!1);return()=>cancelAnimationFrame(e)},[]),Ca(()=>{let e=l.current;if(e){v.current=v.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();f.current=t.height,m.current=t.width,_.current||(e.style.transitionDuration=v.current.transitionDuration,e.style.animationName=v.current.animationName),c(r)}},[o.open,r]),(0,E.jsx)(Ji.div,{"data-state":uo(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!g,...a,ref:u,style:{"--radix-collapsible-content-height":p?`${p}px`:void 0,"--radix-collapsible-content-width":h?`${h}px`:void 0,...e.style},children:g&&i})},`CollapsibleContentImpl`));function uo(e){return e?`open`:`closed`}Qa(uo,`getState`);var fo=io,po=Object.defineProperty,mo=(e,t)=>po(e,`name`,{value:t,configurable:!0}),ho=d.createContext(void 0);function go(e){let t=d.useContext(ho);return e||t||`ltr`}mo(go,`useDirection`);var _o=Object.defineProperty,vo=(e,t)=>_o(e,`name`,{value:t,configurable:!0});function yo(e){let t=d.useRef(e);return d.useEffect(()=>{t.current=e}),d.useMemo(()=>((...e)=>t.current?.(...e)),[])}vo(yo,`useCallbackRef`);var bo=Object.defineProperty,xo=(e,t)=>bo(e,`name`,{value:t,configurable:!0}),So=`dismissableLayer.update`,Co=`dismissableLayer.pointerDownOutside`,wo=`dismissableLayer.focusOutside`,To,Eo=d.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Do=d.forwardRef(xo(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=d.useContext(Eo),[f,p]=d.useState(null),m=f?.ownerDocument??globalThis?.document,[,h]=d.useState({}),g=ki(t,p),_=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=v?_.indexOf(v):-1,b=f?_.indexOf(f):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,S=b>=y,C=d.useRef(!1),w=Ao(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:m,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:C,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:d.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return S&&!t},[u.branches,S])}),T=jo(e=>{if(r&&C.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},m),D=f?b===_.length-1:!1,O=yo(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return d.useEffect(()=>{if(D)return m.addEventListener(`keydown`,O,{capture:!0}),()=>m.removeEventListener(`keydown`,O,{capture:!0})},[m,D,O]),d.useEffect(()=>{if(f)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(To=m.body.style.pointerEvents,m.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),Mo(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(f),u.layersWithOutsidePointerEventsDisabled.size===0&&(m.body.style.pointerEvents=To))}},[f,m,n,u]),d.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),Mo())},[f,u]),d.useEffect(()=>{let e=xo(()=>h({}),`handleUpdate`);return document.addEventListener(So,e),()=>document.removeEventListener(So,e)},[]),(0,E.jsx)(Ji.div,{...l,ref:g,style:{pointerEvents:x?S?`auto`:`none`:void 0,...e.style},onFocusCapture:va(e.onFocusCapture,T.onFocusCapture),onBlurCapture:va(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:va(e.onPointerDownCapture,w.onPointerDownCapture)})},`DismissableLayer`));function Oo(){let e=d.useContext(Eo),[t,n]=d.useState(null);return d.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}xo(Oo,`useDismissableLayerSurface`);var ko=xo(()=>!0,`IS_TRUE`);function Ao(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=ko}=t,s=yo(e),c=d.useRef(!1),l=d.useRef(!1),u=d.useRef(new Map),f=d.useRef(()=>{});return d.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}xo(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}xo(t,`isOutsideInteractionIntercepted`);function d(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&f.current()},0)}xo(d,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}xo(p,`handleInteractionBubble`);let m=xo(a=>{if(a.target&&!c.current){let d=function(){n.removeEventListener(`click`,f.current);let r=t();e(),r||No(Co,s,p,{discrete:!0})};if(xo(d,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,f.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?d():(n.removeEventListener(`click`,f.current),f.current=d,n.addEventListener(`click`,f.current,{once:!0}))}else n.removeEventListener(`click`,f.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,d,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,f.current);for(let e of h)n.removeEventListener(e,d,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:xo(()=>c.current=!0,`onPointerDownCapture`)}}xo(Ao,`usePointerDownOutside`);function jo(e,t=globalThis?.document){let n=yo(e),r=d.useRef(!1);return d.useEffect(()=>{let e=xo(e=>{e.target&&!r.current&&No(wo,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:xo(()=>r.current=!0,`onFocusCapture`),onBlurCapture:xo(()=>r.current=!1,`onBlurCapture`)}}xo(jo,`useFocusOutside`);function Mo(){let e=new CustomEvent(So);document.dispatchEvent(e)}xo(Mo,`dispatchUpdate`);function No(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Yi(i,a):i.dispatchEvent(a)}xo(No,`handleAndDispatchCustomEvent`);var Po=Object.defineProperty,Fo=(e,t)=>Po(e,`name`,{value:t,configurable:!0}),Io=`focusScope.autoFocusOnMount`,Lo=`focusScope.autoFocusOnUnmount`,Ro={bubbles:!1,cancelable:!0},zo=d.forwardRef(Fo(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=d.useState(null),l=yo(i),u=yo(a),f=d.useRef(null),p=ki(t,c),m=d.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;d.useEffect(()=>{if(r){let e=function(e){if(m.paused||!s)return;let t=e.target;s.contains(t)?f.current=t:Ko(f.current,{select:!0})},t=function(e){if(m.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Ko(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Ko(s)};Fo(e,`handleFocusIn`),Fo(t,`handleFocusOut`),Fo(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,m.paused]),d.useEffect(()=>{if(s){qo.add(m);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(Io,Ro);s.addEventListener(Io,l),s.dispatchEvent(t),t.defaultPrevented||(Bo(Xo(Ho(s)),{select:!0}),document.activeElement===e&&Ko(s))}return()=>{s.removeEventListener(Io,l),setTimeout(()=>{let t=new CustomEvent(Lo,Ro);s.addEventListener(Lo,u),s.dispatchEvent(t),t.defaultPrevented||Ko(e??document.body,{select:!0}),s.removeEventListener(Lo,u),qo.remove(m)},0)}}},[s,l,u,m]);let h=d.useCallback(e=>{if(!n&&!r||m.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=Vo(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Ko(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Ko(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,m.paused]);return(0,E.jsx)(Ji.div,{tabIndex:-1,...o,ref:p,onKeyDown:h})},`FocusScope`));function Bo(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Ko(r,{select:t}),document.activeElement!==n)return}Fo(Bo,`focusFirst`);function Vo(e){let t=Ho(e);return[Uo(t,e),Uo(t.reverse(),e)]}Fo(Vo,`getTabbableEdges`);function Ho(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:Fo(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}Fo(Ho,`getTabbableCandidates`);function Uo(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):Wo(r,{upTo:t})))return r}Fo(Uo,`findVisible`);function Wo(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}Fo(Wo,`isHidden`);function Go(e){return e instanceof HTMLInputElement&&`select`in e}Fo(Go,`isSelectableInput`);function Ko(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Go(e)&&t&&e.select()}}Fo(Ko,`focus`);var qo=Jo();function Jo(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Yo(e,t),e.unshift(t)},remove(t){e=Yo(e,t),e[0]?.resume()}}}Fo(Jo,`createFocusScopesStack`);function Yo(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}Fo(Yo,`arrayRemove`);function Xo(e){return e.filter(e=>e.tagName!==`A`)}Fo(Xo,`removeLinks`);var Zo=Object.defineProperty,Qo=d.forwardRef(((e,t)=>Zo(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=d.useState(!1);Ca(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?ii.createPortal((0,E.jsx)(Ji.div,{...r,ref:t}),o):null},`Portal`)),$o=Object.defineProperty,es=(e,t)=>$o(e,`name`,{value:t,configurable:!0}),ts=0,ns=null;function rs(e){return is(),e.children}es(rs,`FocusGuards`);function is(){d.useEffect(()=>{ns||={start:as(),end:as()};let{start:e,end:t}=ns;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),ts++,()=>{ts===1&&(ns?.start.remove(),ns?.end.remove(),ns=null),ts=Math.max(0,ts-1)}},[])}es(is,`useFocusGuards`);function as(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}es(as,`createFocusGuard`);var os=function(){return os=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},os.apply(this,arguments)};function ss(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function cs(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var ls=`right-scroll-bar-position`,us=`width-before-scroll-bar`,ds=`with-scroll-bars-hidden`,fs=`--removed-body-scroll-bar-size`;function ps(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function ms(e,t){var n=(0,d.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var hs=typeof window<`u`?d.useLayoutEffect:d.useEffect,gs=new WeakMap;function _s(e,t){var n=ms(t||null,function(t){return e.forEach(function(e){return ps(e,t)})});return hs(function(){var t=gs.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||ps(e,null)}),i.forEach(function(e){r.has(e)||ps(e,a)})}gs.set(n,e)},[e]),n}function vs(e){return e}function ys(e,t){t===void 0&&(t=vs);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function bs(e){e===void 0&&(e={});var t=ys(null);return t.options=os({async:!0,ssr:!1},e),t}var xs=function(e){var t=e.sideCar,n=ss(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return d.createElement(r,os({},n))};xs.isSideCarExport=!0;function Ss(e,t){return e.useMedium(t),xs}var Cs=bs(),ws=function(){},Ts=d.forwardRef(function(e,t){var n=d.useRef(null),r=d.useState({onScrollCapture:ws,onWheelCapture:ws,onTouchMoveCapture:ws}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,f=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,_=e.allowPinchZoom,v=e.as,y=v===void 0?`div`:v,b=e.gapMode,x=ss(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=p,C=_s([n,t]),w=os(os({},x),i);return d.createElement(d.Fragment,null,u&&d.createElement(S,{sideCar:Cs,removeScrollBar:l,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:a,allowPinchZoom:!!_,lockRef:n,gapMode:b}),o?d.cloneElement(d.Children.only(s),os(os({},w),{ref:C})):d.createElement(y,os({},w,{className:c,ref:C}),s))});Ts.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Ts.classNames={fullWidth:us,zeroRight:ls};var Es,Ds=function(){if(Es)return Es;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Os(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Ds();return t&&e.setAttribute(`nonce`,t),e}function ks(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function As(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var js=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Os())&&(ks(t,n),As(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Ms=function(){var e=js();return function(t,n){d.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Ns=function(){var e=Ms();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Ps={left:0,top:0,right:0,gap:0},Fs=function(e){return parseInt(e||``,10)||0},Is=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[Fs(n),Fs(r),Fs(i)]},Ls=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Ps;var t=Is(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Rs=Ns(),zs=`data-scroll-locked`,Bs=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
10
+ `).replace(Wd,``)}function Kd(e,t){return t=Gd(t),Gd(e)===t}function qd(e,t,n,r,i,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Gt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Gt(e,``+r);break;case`className`:kt(e,`class`,r);break;case`tabIndex`:kt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:kt(e,n,r);break;case`style`:Jt(e,r,o);break;case`data`:if(t!==`object`){kt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Qt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&qd(e,t,`name`,i.name,i,null),qd(e,t,`formEncType`,i.formEncType,i,null),qd(e,t,`formMethod`,i.formMethod,i,null),qd(e,t,`formTarget`,i.formTarget,i,null)):(qd(e,t,`encType`,i.encType,i,null),qd(e,t,`method`,i.method,i,null),qd(e,t,`target`,i.target,i,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Qt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=$t);break;case`onScroll`:r!=null&&Nd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Nd(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(a(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(a(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Qt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Nd(`beforetoggle`,e),Nd(`toggle`,e),Ot(e,`popover`,r);break;case`xlinkActuate`:At(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:At(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:At(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:At(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:At(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:At(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:At(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:At(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:At(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Ot(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Xt.get(n)||n,Ot(e,n,r))}}function Jd(e,t,n,r,i,o){switch(n){case`style`:Jt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(a(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(a(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Gt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Gt(e,``+r);break;case`onScroll`:r!=null&&Nd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Nd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=$t);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!xt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(i=n.endsWith(`Capture`),t=n.slice(2,i?n.length-7:void 0),o=e[st]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,i),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,i);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Ot(e,n,r)}}}function Yd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Nd(`error`,e),Nd(`load`,e);var r=!1,i=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:i=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(a(137,t));default:qd(e,t,o,s,n,null)}}i&&qd(e,t,`srcSet`,n.srcSet,n,null),r&&qd(e,t,`src`,n.src,n,null);return;case`input`:Nd(`invalid`,e);var c=o=s=i=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:i=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(a(137,t));break;default:qd(e,t,r,d,n,null)}}Bt(e,o,c,l,u,s,i,!1);return;case`select`:for(i in Nd(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(i)&&(c=n[i],c!=null))switch(i){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:qd(e,t,i,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Ht(e,!!r,n,!0):Ht(e,!!r,t,!1);return;case`textarea`:for(s in Nd(`invalid`,e),o=i=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:i=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(a(91));break;default:qd(e,t,s,c,n,null)}Wt(e,r,i,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:qd(e,t,l,r,n,null)}return;case`dialog`:Nd(`beforetoggle`,e),Nd(`toggle`,e),Nd(`cancel`,e),Nd(`close`,e);break;case`iframe`:case`object`:Nd(`load`,e);break;case`video`:case`audio`:for(r=0;r<Ad.length;r++)Nd(Ad[r],e);break;case`image`:Nd(`error`,e),Nd(`load`,e);break;case`details`:Nd(`toggle`,e);break;case`embed`:case`source`:case`link`:Nd(`error`,e),Nd(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(a(137,t));default:qd(e,t,u,r,n,null)}return;default:if(Yt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Jd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&qd(e,t,c,r,n,null))}function Xd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var i=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||qd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:i=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(a(137,t));break;default:m!==f&&qd(e,t,p,m,r,f)}}zt(e,s,c,l,u,d,o,i);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||qd(e,t,o,null,r,l)}for(i in r)if(o=r[i],l=n[i],r.hasOwnProperty(i)&&(o!=null||l!=null))switch(i){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&qd(e,t,i,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Ht(e,!!n,n?[]:``,!1):Ht(e,!!n,t,!0)):Ht(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(i=n[c],n.hasOwnProperty(c)&&i!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:qd(e,t,c,null,r,i)}for(s in r)if(i=r[s],o=n[s],r.hasOwnProperty(s)&&(i!=null||o!=null))switch(s){case`value`:p=i;break;case`defaultValue`:m=i;break;case`children`:break;case`dangerouslySetInnerHTML`:if(i!=null)throw Error(a(91));break;default:i!==o&&qd(e,t,s,i,r,o)}Ut(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:qd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:qd(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&qd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(a(137,t));break;default:qd(e,t,u,p,r,m)}return;default:if(Yt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Jd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Jd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&qd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||qd(e,t,f,p,r,m)}function Zd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Qd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Zd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Zd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var $d=null,ef=null;function tf(e){return e.nodeType===9?e:e.ownerDocument}function nf(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function rf(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function af(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var of=null;function sf(){var e=window.event;return e&&e.type===`popstate`?e!==of&&(of=e,!0):(of=null,!1)}var cf=typeof setTimeout==`function`?setTimeout:void 0,lf=typeof clearTimeout==`function`?clearTimeout:void 0,uf=typeof Promise==`function`?Promise:void 0,df=typeof queueMicrotask==`function`?queueMicrotask:uf===void 0?cf:function(e){return uf.resolve(null).then(e).catch(ff)};function ff(e){setTimeout(function(){throw e})}function pf(e){return e===`head`}function mf(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Jp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)Of(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,Of(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[pt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&Of(e.ownerDocument.body)}n=i}while(n);Jp(t)}function hf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function gf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:gf(n),mt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function _f(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[pt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=Cf(e.nextSibling),e===null)break}return null}function vf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=Cf(e.nextSibling),e===null))return null;return e}function yf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=Cf(e.nextSibling),e===null))return null;return e}function bf(e){return e.data===`$?`||e.data===`$~`}function xf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function Sf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function Cf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var wf=null;function Tf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return Cf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function Ef(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function Df(e,t,n){switch(t=tf(n),e){case`html`:if(e=t.documentElement,!e)throw Error(a(452));return e;case`head`:if(e=t.head,!e)throw Error(a(453));return e;case`body`:if(e=t.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function Of(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);mt(e)}var kf=new Map,Af=new Set;function jf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Mf=te.d;te.d={f:Nf,r:Pf,D:Lf,C:Rf,L:zf,m:Bf,X:Hf,S:Vf,M:Uf};function Nf(){var e=Mf.f(),t=Mu();return e||t}function Pf(e){var t=gt(e);t!==null&&t.tag===5&&t.type===`form`?js(t):Mf.r(e)}var Ff=typeof document>`u`?null:document;function If(e,t,n){var r=Ff;if(r&&typeof t==`string`&&t){var i=Rt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Af.has(i)||(Af.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Yd(t,`link`,e),yt(t),r.head.appendChild(t)))}}function Lf(e){Mf.D(e),If(`dns-prefetch`,e,null)}function Rf(e,t){Mf.C(e,t),If(`preconnect`,e,t)}function zf(e,t,n){Mf.L(e,t,n);var r=Ff;if(r&&e&&t){var i=`link[rel="preload"][as="`+Rt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Rt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Rt(n.imageSizes)+`"]`)):i+=`[href="`+Rt(e)+`"]`;var a=i;switch(t){case`style`:a=Gf(e);break;case`script`:a=Yf(e)}kf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),kf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Kf(a))||t===`script`&&r.querySelector(Xf(a))||(t=r.createElement(`link`),Yd(t,`link`,e),yt(t),r.head.appendChild(t)))}}function Bf(e,t){Mf.m(e,t);var n=Ff;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Rt(r)+`"][href="`+Rt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Yf(e)}if(!kf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),kf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Xf(a)))return}r=n.createElement(`link`),Yd(r,`link`,e),yt(r),n.head.appendChild(r)}}}function Vf(e,t,n){Mf.S(e,t,n);var r=Ff;if(r&&e){var i=vt(r).hoistableStyles,a=Gf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Kf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=kf.get(a))&&$f(e,n);var c=o=r.createElement(`link`);yt(c),Yd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Qf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Hf(e,t){Mf.X(e,t);var n=Ff;if(n&&e){var r=vt(n).hoistableScripts,i=Yf(e),a=r.get(i);a||(a=n.querySelector(Xf(i)),a||(e=h({src:e,async:!0},t),(t=kf.get(i))&&ep(e,t),a=n.createElement(`script`),yt(a),Yd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Uf(e,t){Mf.M(e,t);var n=Ff;if(n&&e){var r=vt(n).hoistableScripts,i=Yf(e),a=r.get(i);a||(a=n.querySelector(Xf(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=kf.get(i))&&ep(e,t),a=n.createElement(`script`),yt(a),Yd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Wf(e,t,n,r){var i=(i=R.current)?jf(i):null;if(!i)throw Error(a(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Gf(n.href),n=vt(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Gf(n.href);var o=vt(i).hoistableStyles,s=o.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=i.querySelector(Kf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),kf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},kf.set(e,n),o||Jf(i,e,n,s.state))),t&&r===null)throw Error(a(528,``));return s}if(t&&r!==null)throw Error(a(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Yf(n),n=vt(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(a(444,e))}}function Gf(e){return`href="`+Rt(e)+`"`}function Kf(e){return`link[rel="stylesheet"][`+e+`]`}function qf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Jf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Yd(t,`link`,n),yt(t),e.head.appendChild(t))}function Yf(e){return`[src="`+Rt(e)+`"]`}function Xf(e){return`script[async]`+e}function Zf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Rt(n.href)+`"]`);if(r)return t.instance=r,yt(r),r;var i=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),yt(r),Yd(r,`style`,i),Qf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Gf(n.href);var o=e.querySelector(Kf(i));if(o)return t.state.loading|=4,t.instance=o,yt(o),o;r=qf(n),(i=kf.get(i))&&$f(r,i),o=(e.ownerDocument||e).createElement(`link`),yt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Yd(o,`link`,r),t.state.loading|=4,Qf(o,n.precedence,e),t.instance=o;case`script`:return o=Yf(n.src),(i=e.querySelector(Xf(o)))?(t.instance=i,yt(i),i):(r=n,(i=kf.get(o))&&(r=h({},n),ep(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),yt(i),Yd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(a(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Qf(r,n.precedence,e));return t.instance}function Qf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function $f(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function ep(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var tp=null;function np(e,t,n){if(tp===null){var r=new Map,i=tp=new Map;i.set(n,r)}else i=tp,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[pt]||a[ot]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function rp(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function ip(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function ap(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function op(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Gf(r.href),a=t.querySelector(Kf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=lp.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,yt(a);return}a=t.ownerDocument||t,r=qf(r),(i=kf.get(i))&&$f(r,i),a=a.createElement(`link`),yt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Yd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=lp.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var sp=0;function cp(e,t){return e.stylesheets&&e.count===0&&dp(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&dp(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&sp===0&&(sp=62500*Qd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&dp(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>sp?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function lp(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)dp(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var up=null;function dp(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,up=new Map,t.forEach(fp,e),up=null,lp.call(e))}function fp(e,t){if(!(t.state.loading&4)){var n=up.get(e);if(n)var r=n.get(null);else{n=new Map,up.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=lp.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var pp={$$typeof:C,Provider:null,Consumer:null,_currentValue:ne,_currentValue2:ne,_threadCount:0};function mp(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ye(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ye(0),this.hiddenUpdates=Ye(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function hp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new mp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ci(3,null,null,t),e.current=a,a.stateNode=e,t=la(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Ha(a),e}function gp(e){return e?(e=oi,e):oi}function _p(e,t,n,r,i,a){i=gp(i),r.context===null?r.context=i:r.pendingContext=i,r=Wa(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ga(e,r,t),n!==null&&(Du(n,e,t),Ka(n,e,t))}function vp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function yp(e,t){vp(e,t),(e=e.alternate)&&vp(e,t)}function bp(e){if(e.tag===13||e.tag===31){var t=ri(e,67108864);t!==null&&Du(t,e,67108864),yp(e,67108864)}}function xp(e){if(e.tag===13||e.tag===31){var t=Tu();t=tt(t);var n=ri(e,t);n!==null&&Du(n,e,t),yp(e,t)}}var Sp=!0;function Cp(e,t,n,r){var i=F.T;F.T=null;var a=te.p;try{te.p=2,Tp(e,t,n,r)}finally{te.p=a,F.T=i}}function wp(e,t,n,r){var i=F.T;F.T=null;var a=te.p;try{te.p=8,Tp(e,t,n,r)}finally{te.p=a,F.T=i}}function Tp(e,t,n,r){if(Sp){var i=Ep(r);if(i===null)Rd(e,t,r,Dp,n),Rp(e,r);else if(Bp(i,e,t,n,r))r.stopPropagation();else if(Rp(e,r),t&4&&-1<Lp.indexOf(e)){for(;i!==null;){var a=gt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=We(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Le(o);s.entanglements[1]|=c,o&=~c}gd(a),!(Kl&6)&&(pu=Te()+500,_d(0,!1))}}break;case 31:case 13:s=ri(a,2),s!==null&&Du(s,a,2),Mu(),yp(a,2)}if(a=Ep(r),a===null&&Rd(e,t,r,Dp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Rd(e,t,r,null,n)}}function Ep(e){return e=tn(e),Op(e)}var Dp=null;function Op(e){if(Dp=null,e=ht(e),e!==null){var t=l(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=u(t),e!==null)return e;e=null}else if(n===31){if(e=d(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Dp=e,null}function kp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Ee()){case De:return 2;case Oe:return 8;case ke:case Ae:return 32;case je:return 268435456;default:return 32}default:return 32}}var Ap=!1,jp=null,Mp=null,Np=null,Pp=new Map,Fp=new Map,Ip=[],Lp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Rp(e,t){switch(e){case`focusin`:case`focusout`:jp=null;break;case`dragenter`:case`dragleave`:Mp=null;break;case`mouseover`:case`mouseout`:Np=null;break;case`pointerover`:case`pointerout`:Pp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Fp.delete(t.pointerId)}}function zp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=gt(t),t!==null&&bp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Bp(e,t,n,r,i){switch(t){case`focusin`:return jp=zp(jp,e,t,n,r,i),!0;case`dragenter`:return Mp=zp(Mp,e,t,n,r,i),!0;case`mouseover`:return Np=zp(Np,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Pp.set(a,zp(Pp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Fp.set(a,zp(Fp.get(a)||null,e,t,n,r,i)),!0}return!1}function Vp(e){var t=ht(e.target);if(t!==null){var n=l(t);if(n!==null){if(t=n.tag,t===13){if(t=u(n),t!==null){e.blockedOn=t,it(e.priority,function(){xp(n)});return}}else if(t===31){if(t=d(n),t!==null){e.blockedOn=t,it(e.priority,function(){xp(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Hp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Ep(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);en=r,n.target.dispatchEvent(r),en=null}else return t=gt(n),t!==null&&bp(t),e.blockedOn=n,!1;t.shift()}return!0}function Up(e,t,n){Hp(e)&&n.delete(t)}function Wp(){Ap=!1,jp!==null&&Hp(jp)&&(jp=null),Mp!==null&&Hp(Mp)&&(Mp=null),Np!==null&&Hp(Np)&&(Np=null),Pp.forEach(Up),Fp.forEach(Up)}function Gp(e,n){e.blockedOn===n&&(e.blockedOn=null,Ap||(Ap=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Wp)))}var Kp=null;function qp(e){Kp!==e&&(Kp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Kp===e&&(Kp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(Op(r||n)===null)continue;break}var a=gt(n);a!==null&&(e.splice(t,3),t-=3,ks(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Jp(e){function t(t){return Gp(t,e)}jp!==null&&Gp(jp,e),Mp!==null&&Gp(Mp,e),Np!==null&&Gp(Np,e),Pp.forEach(t),Fp.forEach(t);for(var n=0;n<Ip.length;n++){var r=Ip[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Ip.length&&(n=Ip[0],n.blockedOn===null);)Vp(n),n.blockedOn===null&&Ip.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[st]||null;if(typeof a==`function`)o||qp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[st]||null)s=o.formAction;else if(Op(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),qp(n)}}}function Yp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Xp(e){this._internalRoot=e}Zp.prototype.render=Xp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(a(409));var n=t.current;_p(n,Tu(),e,t,null,null)},Zp.prototype.unmount=Xp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;_p(e.current,2,null,e,null,null),Mu(),t[ct]=null}};function Zp(e){this._internalRoot=e}Zp.prototype.unstable_scheduleHydration=function(e){if(e){var t=rt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ip.length&&t!==0&&t<Ip[n].priority;n++);Ip.splice(n,0,e),n===0&&Vp(e)}};var Qp=n.version;if(Qp!==`19.2.4`)throw Error(a(527,Qp,`19.2.4`));te.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(a(188)):(e=Object.keys(e).join(`,`),Error(a(268,e)));return e=p(t),e=e===null?null:m(e),e=e===null?null:e.stateNode,e};var $p={bundleType:0,version:`19.2.4`,rendererPackageName:`react-dom`,currentDispatcherRef:F,reconcilerVersion:`19.2.4`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var em=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!em.isDisabled&&em.supportsFiber)try{Pe=em.inject($p),Fe=em}catch{}}e.createRoot=function(e,t){if(!s(e))throw Error(a(299));var n=!1,r=``,i=Qs,o=$s,c=ec;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(o=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=hp(e,1,!1,null,null,n,r,null,i,o,c,Yp),e[ct]=t.current,Id(e),new Xp(t)}})),u=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=l()})),d=e(i(),1),f=u(),p={xs:10,sm:11,base:12,lg:13,xl:14,"2xl":15,"3xl":16,"4xl":18,"5xl":20};function m(e,t={}){return e.replace(/\{([\w.-]+)\}/g,(e,n)=>{let r=t[n];return r===void 0?e:String(r)})}function h(e,t,n,r={}){let i=n[e]?.[t]??n.en?.[t];return i===void 0?t:m(i,r)}function g(e,t,n=new Date){let r=(e instanceof Date?e:new Date(e)).getTime()-n.getTime(),i=Math.abs(r),[a,o]=i<6e4?[`second`,1e3]:i<36e5?[`minute`,6e4]:i<864e5?[`hour`,36e5]:[`day`,864e5],s=Math.round(r/o);return new Intl.RelativeTimeFormat(t,{numeric:`always`}).format(s,a)}var _={id:`en`,label:`English`,messages:{"common.ok":`OK`,"common.language":`Language`,"common.models":`Models`,"common.skills":`Skills`,"common.plugins":`Plugins`,"sidebar.hide":`Collapse sidebar`,"sidebar.show":`Expand sidebar`,"theme.light":`Switch to light mode`,"preferences.defaultThinkingLevel":`Default thinking level`,"preferences.thinkingLevelHint":"Global default for new sessions (settings.json `defaultThinkingLevel`). Not set = field removed, falls back to pi default.","preferences.thinkingLevelNotSet":`Not set (use model default)`,"preferences.compaction":`Auto compaction`,"preferences.compactionHint":"Automatically compact long sessions (settings.json `compaction`). When not configured the pi defaults are shown; any edit writes the full object.","preferences.compactionEnabled":`Enabled`,"preferences.compactionReserveTokens":`Reserve tokens`,"preferences.compactionReserveTokensHint":`Tokens reserved for model output, keeping reply space after compaction`,"preferences.compactionKeepRecentTokens":`Keep recent tokens`,"preferences.compactionKeepRecentTokensHint":`Tokens kept after compaction, counted backwards from the most recent messages`,"preferences.retry":`API retry`,"preferences.retryHint":"Retry settings for provider API calls (settings.json `retry`). When not configured the pi defaults are shown; any edit writes the full object. Provider sub-fields left empty are not written.","preferences.retryEnabled":`Enabled`,"preferences.retryEnabledHint":`Enable retries for failed API calls`,"preferences.retryMaxRetries":`Max retries`,"preferences.retryBaseDelayMs":`Base delay (ms)`,"preferences.retryBaseDelayMsHint":`Initial delay before the first retry, in milliseconds`,"preferences.retryProviderTimeoutMs":`Provider timeout (ms)`,"preferences.retryProviderMaxRetries":`Provider max retries`,"preferences.retryProviderMaxRetryDelayMs":`Provider max delay (ms)`,"preferences.defaultProjectTrust":`Default project trust`,"preferences.projectTrustHint":"Default trust for new projects (settings.json `defaultProjectTrust`). Not set = field removed (falls back to ask).","preferences.projectTrustNotSet":`Not set (ask)`,"preferences.projectTrustAsk":`Ask`,"preferences.projectTrustAlways":`Always trust`,"preferences.projectTrustNever":`Never trust`,"preferences.notifyEvents":`Notifications`,"preferences.notifyEventsHint":`Browser notifications when the tab is not active. Permission is requested on first interaction.`,"notify.permission.request":`Enable notifications`,"notify.permission.requestHint":`Click to enable browser notifications — you'll be alerted when a task finishes even if this tab is in the background`,"notify.permission.granted":`Notifications on`,"notify.permission.grantedHint":`Browser notifications are enabled — you'll be alerted when a task finishes even if this tab is in the background`,"notify.permission.bannerHintBefore":`Click the`,"notify.permission.bannerHintAfter":`button in the top-left toolbar to enable notifications — you'll be alerted when a task completes, errors, or asks a question. Fine-tune in Config Center → Session → Notifications`,"notify.permission.denied":`Notifications blocked`,"notify.permission.deniedHint":`Notifications are blocked by the browser. Click the icon next to the address bar → Site settings, switch notifications to Allow, then try again`,"preferences.notifyWhileActive":`Notify while page active`,"preferences.notifyTaskComplete":`Task complete`,"preferences.notifyErrors":`Errors`,"preferences.notifyQuestions":`Questions`,"preferences.subagentsDefaultModel":`Subagent default model`,"preferences.subagentsDefaultThinking":`Subagent default thinking level`,"preferences.subagentsHint":"Defaults for subagents (settings.json `subagents`). defaultThinking not set = sub-field removed (falls back to pi default).","preferences.subagentsModelPlaceholder":`provider/model-id`,"theme.dark":`Switch to dark mode`,"theme.toggleTheme":`Switch theme`,"theme.darkMode":`Dark`,"theme.lightMode":`Light`,"theme.fontSize":`Font size`,"theme.scrollStep":`Hover scroll step`,"scrollStep.hint":`Pixels scrolled per hover tick on the edge scroll arrows (shared by the panel scroll arrows and the minimap).`,"scrollStep.range":`per hover tick (1-1000)`,"scrollStep.unit":`px`,"theme.autoReloadSeconds":`Auto-reload chat messages interval`,"autoReload.off":`Off (0) — do not auto-reload`,"autoReload.range":`seconds (0 — 3600)`,"autoReload.unit":`s`,"autoReload.hint":`Interval in seconds for re-reading the session file; 0 = off. Keep 0 for single-client use (messages arrive via SSE in real time); set it above 0 for multi-client collaboration (several browsers on the same session) so each client refreshes periodically and picks up chat messages generated by the others.`,"longBlock.hint":`“Blocks” are thinking and tool calls. Bodies beyond the threshold collapse to a head/tail digest; click to expand the full text.`,"recentBlocks.hint":`Streaming blocks and the just-completed block are not counted (the newest completed block always stays expanded). This is how many additional recent completed blocks stay expanded.`,"autoReload.reset":`Reset to default ({n} s)`,"chat.reloadFromDisk":`Reload session from disk`,"chat.reloadFromDiskHint":`Use when multiple clients read/write the same session jsonl at the same time. You can set automatic timed reloading under Config Center → Session.`,"scrollStep.reset":`Reset to default ({n} px)`,"theme.longBlockCollapse":`Long block collapse`,"theme.recentBlocksExpanded":`Recent completed blocks kept expanded`,"layout.sidebarWidth":`Left panel width`,"layout.widgetPanelWidth":`Right panel width`,"layout.widthRange":`px ({min}–{max})`,"layout.widthReset":`Reset to default ({value} px)`,"longBlock.range":`chars (20-10000)`,"longBlock.chars":`chars`,"longBlock.blocks":`blocks`,"longBlock.reset":`Reset to default ({n} chars)`,"recentBlocks.reset":`Reset to default ({n})`,"recentBlocks.range":`0-20, excludes the newest completed block`,"longBlock.expandHint":`… {n} chars folded · click to expand`,"longBlock.collapse":`Click to collapse`,"history.full":`Full history`,"history.unsaved":`Full history is available after the session is saved`,"title.generating":`Generating...`,"title.updated":`Title updated`,"title.failed":`Generation failed`,"title.generate":`Generate title`,"title.unsaved":`Title generation is available after the session is saved`,"title.noMessages":`Send a message before naming this session`,"title.generateSession":`Generate a session title`,"system.prompt":`System prompt`,"system.empty":`System prompt is empty (tools are disabled)`,"system.load":`Send a message to load the system prompt`,"session.info":`Session info`,"session.reload":`Reload session (re-read config and resources)`,"session.name":`Name`,"session.file":`File`,"session.inMemory":`In-memory`,"session.id":`ID`,"session.user":`User`,"session.assistant":`Assistant`,"session.toolCalls":`Tool Calls`,"session.toolResults":`Tool Results`,"session.total":`Total`,"session.input":`Input`,"session.output":`Output`,"session.cacheRead":`Cache Read`,"session.cacheWrite":`Cache Write`,"session.inputHint":`Prompt tokens NOT served from cache: system prompt, history and tool definitions sent to the model, minus the cached portion`,"session.outputHint":`Tokens generated by the model (answers and thinking)`,"session.cacheReadHint":`Tokens served from prompt cache: unchanged context re-read from the previous request at a discounted rate`,"session.cacheWriteHint":`Tokens written to cache for the first time (billed on write, Anthropic-style)`,"session.totalHint":`input + output + cacheRead + cacheWrite`,"session.cacheReadRate":`Cache hit rate: cache-read tokens as a share of all input prompt tokens (input + cacheRead + cacheWrite), the official formula cacheRead / (input + cacheRead + cacheWrite)`,"session.cost":`Cost`,"session.context":`Context`,"session.copy":`Copy {value}`,"session.copied":`Copied`,"session.title":`Session info`,"session.load":`Send a message or run /session to load session info`,"session.infoSection":`Session Info`,"session.messages":`Messages`,"session.tokens":`Tokens`,"session.copyFile":`Copy file path`,"session.copyId":`Copy session ID`,"workspace.opening":`Opening workspace...`,"workspace.unable":`Unable to open workspace`,"workspace.selectSession":`Select a session from the sidebar`,"workspace.selectWorkspace":`Please select a workspace`,"workspace.stepProject":`Select a project directory from the sidebar`,"workspace.stepModels":`Add models via the Models button at the bottom`,"tabs.chat":`Chat`,"tabs.widgets":`Widgets`,"config.title":`Settings`,"config.section.session":`Session`,"config.section.appearance":`Appearance`,"config.section.advanced":`Advanced`,"config.section.startScreen":`Start screen`,"config.section.git":`Git`,"config.section.modelThinking":`Thinking Levels`,"config.section.requiresCwd":`Select a project directory from the sidebar first to browse plugins / skills`,"preferences.pi.unset":`pi default`,"preferences.pi.enableAnalytics":`Enable analytics`,"preferences.pi.enableAnalyticsHint":"Send anonymous usage analytics (settings.json `enableAnalytics`)","preferences.pi.enableInstallTelemetry":`Enable install telemetry`,"preferences.pi.enableInstallTelemetryHint":"Send anonymous install telemetry (settings.json `enableInstallTelemetry`)","preferences.pi.httpProxy":`HTTP proxy`,"preferences.pi.httpProxyHint":"Proxy URL for HTTP requests (settings.json `httpProxy`). Empty input cannot clear an already-set value.","preferences.pi.trackingId":`Analytics tracking ID`,"preferences.pi.trackingIdHint":"Custom analytics tracking ID (settings.json `trackingId`). Empty input cannot clear an already-set value.","preferences.pi.httpIdleTimeoutMs":`HTTP idle timeout (ms)`,"preferences.pi.httpIdleTimeoutMsHint":"HTTP idle timeout in ms (settings.json `httpIdleTimeoutMs`). Empty input cannot clear an already-set value.","preferences.pi.websocketConnectTimeoutMs":`WebSocket connect timeout (ms)`,"preferences.pi.websocketConnectTimeoutMsHint":"WebSocket connect timeout in ms (settings.json `websocketConnectTimeoutMs`). Empty input cannot clear an already-set value.","preferences.pi.branchSummary":`Branch summary`,"preferences.pi.branchSummaryHint":"Branch summary auto-compaction (settings.json `branchSummary`)","preferences.pi.reserveTokens":`Reserve tokens`,"preferences.pi.skipPrompt":`Skip prompt`,"preferences.pi.images":`Image handling`,"preferences.pi.imagesHint":"How the pi engine handles images (settings.json `images`)","preferences.pi.autoResize":`Auto-resize`,"preferences.pi.autoResizeHint":"Downscale images returned by tools such as `read` to save tokens.","preferences.pi.blockImages":`Block images`,"preferences.pi.blockImagesHint":`Strip all image content from messages before they reach the model.`,"config.files.hint":`Edit pi's config files (JSON) directly. Validated before save; backed up automatically (last 10 kept).`,"config.widgets.empty":`No widget configurations yet. Widgets appear here automatically when an extension pops one up.`,"config.widgets.x":`x`,"config.widgets.y":`y`,"config.widgets.width":`w`,"config.widgets.height":`h`,"config.widgets.bind":`Bind message`,"config.widgets.bindTitle":`Bind custom message`,"config.widgets.bindHint":`Bind a quick message to widget "{key}"`,"config.widgets.editTitle":`Edit quick message`,"config.widgets.editHint":`Edit the label, content, and send mode.`,"config.widgets.label":`Label`,"config.widgets.labelPlaceholder":`Button text (e.g. Reload)`,"config.widgets.message":`Message`,"config.widgets.messagePlaceholder":`A slash command or any text (e.g. /reload)`,"config.widgets.sendImmediately":`Send immediately`,"config.widgets.sendMode":`Send mode`,"config.widgets.fillToChatInput":`Fill into chat input`,"config.widgets.sendImmediatelyTooltip":`Send immediately: `,"config.widgets.fillToChatInputTooltip":`Fill into chat input: `,"config.widgets.nameConflict":`Name "{label}" already exists, please use another`,"config.startScreen.nameConflict":`Name "{label}" already exists, please use another`,"config.startScreen.hint":`Quick actions shown on the new-session start screen (below the Pi logo); clicking sends the message immediately or fills it into the chat input, depending on each entry's send mode.`,"config.startScreen.bind":`Bind message`,"config.startScreen.bindTitle":`Bind quick message`,"config.startScreen.bindHint":`Bind a quick message to the start screen.`,"config.startScreen.empty":`No quick messages yet; the start screen will show no quick actions.`,"config.startScreen.unbindTitle":`Unbind message`,"config.startScreen.unbindConfirm":`Unbind "{label}"?`,"config.startScreen.unbind":`Unbind`,"config.widgets.confirm":`Confirm`,"config.widgets.unbindTitle":`Unbind message`,"config.widgets.unbindConfirm":`Unbind "{label}"?`,"config.widgets.unbind":`Unbind`,"config.startScreen.editTitle":`Edit quick message`,"config.startScreen.editHint":`Edit the label, content, and send mode.`,"config.startScreen.reset":`Reset`,"config.startScreen.resetHint":`Restore the built-in default quick messages; keep your own bound messages (ones with the same label as a default are replaced by the default).`,"config.files.save":`Save`,"config.files.saving":`Saving...`,"config.files.saved":`Saved`,"config.files.missing":`Not created yet`,"config.files.placeholder":`Select a config file from the list on the left`,"layout.resizeSidebar":`Resize sidebar`,"layout.resizeWidgetPanel":`Resize widgets panel`,"layout.resizeHint":`Drag to resize. Double-click or press Enter to reset.`,"sidebar.newWorkspace":`New workspace`,"sidebar.searchSessions":`Search sessions`,"sidebar.searchSessionsPlaceholder":`Search sessions…`,"sidebar.justNow":`just now`,"sidebar.minutesAgo":`{count}m ago`,"sidebar.hoursAgo":`{count}h ago`,"sidebar.daysAgo":`{count}d ago`,"sidebar.searchSessionsNoResults":`No matching sessions`,"sidebar.newSessionTitle":`New session in {path}`,"sidebar.refresh":`Refresh`,"directoryPicker.selectDirectory":`Select directory`,"directoryPicker.goToParent":`Go to parent directory`,"directoryPicker.directoryPath":`Directory path`,"directoryPicker.goToDirectory":`Go to directory`,"directoryPicker.go":`Go`,"directoryPicker.loadingDirectories":`Loading directories…`,"directoryPicker.noSubdirectories":`No subdirectories`,"directoryPicker.openBeforeSelecting":`Open this path before selecting it`,"directoryPicker.selectCurrentDirectory":`Select current directory`,"directoryPicker.selectThisFolder":`Select this folder`,"directoryPicker.noDrives":`No drives found`,"directoryPicker.search":`Filter folders`,"directoryPicker.noMatches":`No folders match your filter`,"sidebar.checking":`Checking…`,"sidebar.open":`Open`,"sidebar.cancel":`Cancel`,"sidebar.openRepoRoot":`Worktree switch unavailable`,"sidebar.openRepoRootTitle":`Worktree switching is unavailable here — switch the current working directory to the Git repository root first (from the sidebar).`,"sidebar.gitRepoRootOnly":`Git repo root only`,"sidebar.gitRepoRootOnlyTitle":`Worktrees are available in Git repository roots.`,"sidebar.worktrees":`Worktrees...`,"sidebar.checkingWorktrees":`Checking worktrees for this directory.`,"sidebar.filterWorktrees":`Filter worktrees…`,"sidebar.noMatchingWorktrees":`No matching worktrees`,"sidebar.switchWorktree":`Switch worktree`,"sidebar.switchWorktreeTitle":`Switch worktree: {path}`,"sidebar.main":`main`,"sidebar.forceRemoveCheckout":`Uncommitted changes. Force remove checkout?`,"sidebar.force":`Force`,"sidebar.createWorktreeTitle":`Create a worktree checkout for a branch`,"sidebar.newWorktree":`New worktree…`,"sidebar.branchName":`branch name`,"sidebar.creating":`Creating…`,"sidebar.create":`Create`,"sidebar.uploadFilesTitle":`Upload files to project root`,"sidebar.uploadFiles":`Upload files`,"sidebar.refreshExplorer":`Refresh explorer`,"sidebar.changedFiles":`{count} changed files`,"sidebar.loading":`Loading...`,"sidebar.sessionDeleted":`Session deleted — pick another session`,"sidebar.noSessions":`No sessions found`,"sidebar.workspace":`Workspace`,"sidebar.newActivity":`New activity`,"sidebar.newSessionActivity":`New session activity`,"sidebar.interactionBadge":`Session waiting for interaction`,"sidebar.deleteSession":`Delete {title}?`,"sidebar.deleteWorkspace":`Delete workspace ({count} sessions)?`,"sidebar.deleteWorkspaceTitle":`Delete this workspace and all its sessions`,"sidebar.copyPath":`Copy full path`,"sidebar.rename":`Rename`,"sidebar.delete":`Delete`,"sidebar.deleteWithShiftClick":`Delete (Shift+click to delete without confirmation)`,"sidebar.expandForks":`Expand forks`,"sidebar.collapseForks":`Collapse forks`,"sidebar.disconnect":`Disconnect`,"sidebar.messagesCount":`{count} msgs`,"sidebar.worktreePath":`Worktree: {path}`,"sidebar.removeWorktreeTitle":`Remove worktree checkout {path}; the branch is kept`,"files.modified":`Modified`,"files.added":`Added`,"files.deleted":`Deleted`,"files.renamed":`Renamed`,"files.untracked":`Untracked`,"files.conflict":`Conflict`,"files.newlyUploaded":`Newly uploaded`,"files.containsChangedFiles":`Contains changed files`,"files.insertPath":`Insert path into chat`,"files.mention":`mention`,"files.download":`Download file`,"files.dismissError":`Dismiss error`,"files.addUploadedFile":`Add uploaded file to chat`,"files.addAllUploadedFiles":`Add all uploaded files to chat`,"files.dismissUploadResults":`Dismiss upload results`,"files.loading":`Loading files...`,"files.noFiles":`No files found`,"loading.inProgress":`Working…`,"loading.more":`{count} more…`,"errors.title":`Error`,"errors.titleCount":`Errors ({count})`,"errors.close":`Close`,"errors.clearAll":`Clear all`,"files.notFound":`Not found`,"files.accessDenied":`Access denied`,"files.empty":`Empty`,"files.uploadFailed":`{count} failed`,"files.explorer":`Explorer`,"files.changedCount":`{count} files`,"files.stagedPrefix":`Staged: `,"files.unstagedPrefix":`Unstaged: `,"files.noStagedChanges":`No staged files`,"files.noUnstagedChanges":`No unstaged changes`,"files.commitMessagePlaceholder":`Commit message`,"files.commit":`Commit`,"files.push":`Push to remote (with tags)`,"files.pushing":`Pushing...`,"files.pushSuccess":`Push succeeded`,"files.pushFailed":`Push failed`,"files.pushUpToDate":`Already up to date — nothing to push`,"files.pull":`Pull from remote`,"files.pulling":`Pulling...`,"files.pullSuccess":`Pull succeeded`,"files.pullFailed":`Pull failed`,"files.pullUpToDate":`Already up to date — nothing to pull`,"files.pullNonFastForward":`Pull rejected — local and remote have diverged. Use git pull --rebase or --merge in terminal.`,"files.committing":`Committing…`,"files.commitMessageRequired":`Enter a commit message first`,"files.commitTitle":`Commit changes`,"files.confirmStageAllCommit":`{count} changed files are not staged. Stage them all and commit?`,"files.stageAllAndCommit":`Stage & commit`,"files.stageFile":`Stage file`,"files.unstageFile":`Unstage file`,"files.changeStats":`{count} changed files, {additions} lines added, {deletions} lines deleted`,"git.groupTitle":`Smart Commit Message Generation`,"git.commitModel.followCurrent":`Follow current session model`,"git.commitModel.followCurrentHint":`When on, the commit generation follows the current chat's main model. When off, the fixed model below is used (recommended for a cheap dedicated model).`,"git.commitModel.followCurrentOn":`On: follow current session`,"git.commitModel.followCurrentOff":`Off: use fixed model`,"git.commitModel.fixedModel":`Fixed model`,"git.commitModel.fixedModelHint":`Model used when "follow current session" is off (choose a cheap fixed model; note it may have only ~50k context).`,"git.commitModel.selectPlaceholder":`Select a model`,"git.commitModel.noModels":`No models available`,"git.commitModel.notConfiguredHint":`No fixed model selected. Pick a model before using AI generate.`,"git.ai.generate":`Smart generate`,"git.ai.generating":`Generating…`,"git.ai.notConfiguredTitle":`Model not configured`,"git.ai.notConfiguredDesc":`No model is set for Smart generate. Go to Config Center → Git to set one.`,"git.ai.goToConfig":`Go to settings`,"git.ai.noSession":`Follow-current mode requires an active session`,"git.ai.noSessionModel":`Current session has no model. Select a model in chat first`,"git.commitModel.maxTokens":`Max output tokens`,"git.commitModel.maxTokensHint":`Max output tokens for one generation (64–4096, default 512). Reasoning is minimized: disabled when the model supports it, otherwise reduced to the lowest level.`,"git.commitModel.autoGenerateOnEmpty":`Auto-generate when commit box is empty`,"git.commitModel.autoGenerateOnEmptyHint":`When on, clicking Commit with an empty box auto-generates a message first, then commits. Only when a model is configured; otherwise empty stays disabled. On by default.`,"git.ai.invalidModel":`Configured model is invalid. Reselect it in Config Center.`,"git.ai.autoGenerateOn":`On: auto-generate when empty`,"git.ai.usingCurrentModel":`Using current chat model`,"git.ai.usingModel":`Using {model}`,"git.ai.generateAndCommit":`Smart generate & commit`,"git.ai.autoGenerateOff":`Off`,"git.commitSectionTitle":`Commit`,"git.commitConfirmStageAll":`Confirm “stage all” on commit`,"git.commitConfirmStageAllHint":`When on, committing with only unstaged changes shows a “Stage all & commit” confirmation. When off, it stages all and commits directly. On by default.`,"git.commitConfirmStageAllOn":`On: confirm before staging all`,"git.commitConfirmStageAllOff":`Off: stage all directly`,"modelThinking.desc":`Remember the last thinking level per model or provider. When switching models, the selector restores the remembered level; if the model's available levels don't include it, it falls back to auto (use default). All 7 levels supported: off / minimal / low / medium / high / xhigh / max.`,"modelThinking.byModel":`By model`,"modelThinking.byProvider":`By provider`,"modelThinking.byProviderHint":`Provider fallback: models without a per-model entry use this value.`,"modelThinking.emptyModel":`No per-model memory yet. Selecting a thinking level after switching models will remember it automatically; you can also add one here.`,"modelThinking.emptyProvider":`No per-provider memory yet.`,"modelThinking.selectModelPlaceholder":`Select a model`,"modelThinking.selectProviderPlaceholder":`Select a provider`,"modelThinking.providerInputPlaceholder":`or type a provider name`,"modelThinking.footerHint":`Stored in a standalone file pi-web/model-thinking.json, not the main config. UI-only — pi's set_thinking_level is not intercepted.`,"common.add":`Add`,"common.delete":`Delete`,"files.conflictSummary":`{count} file{countSuffix} already exist: {files}`,"files.cannotReplace":`Cannot replace: {files}`,"files.replace":`Replace`,"files.skipExisting":`Skip existing`,"files.cancel":`Cancel`,"files.checking":`Checking files`,"files.uploading":`Uploading, {progress}%`,"files.search":`Search files`,"files.searchPlaceholder":`Search files...`,"chat.loadingSession":`Loading session...`,"chat.noSessionSelected":`Create or select a session in the left panel`,"chat.loadingWindow":`Loading messages...`,"chat.runningTool":`Running tool...`,"chat.runningNamedTool":`Running {name}...`,"chat.runningTools":`Running {names}...`,"chat.runningToolsMore":`Running {names} (+{count})...`,"chat.waitingModel":`Waiting for model...`,"chat.turnDuration":`took {duration}`,"chat.aiQuestion":`AI question`,"chat.runningCommand":`Running command...`,"chat.totalElapsed":`total {total}`,"chat.thinking":`Thinking...`,"chat.message":`message`,"chat.messages":`messages`,"chat.toolCall":`tool call`,"chat.toolCalls":`tool calls`,"chat.collapseProcess":`Collapse process details`,"chat.expandProcess":`Expand process details`,"chat.loadEarlier":`Scroll up to load earlier messages ({count} hidden)`,"chat.searchMessages":`Search messages`,"chat.clearSearch":`Clear search query`,"chat.scrollToLatest":`Scroll to latest message`,"chat.expandMessage":`Expand full content`,"chat.searchPlaceholder":`Search chat messages…`,"chat.searchNoResults":`No results`,"chat.searchResults":`{count} results`,"chat.extensionRequest":`extension request`,"chat.cancel":`Cancel`,"chat.confirm":`Confirm`,"chat.submit":`Submit`,"chat.extensionInput":`Extension terminal input`,"chat.extensionSelect":`Select an option`,"chat.extensionConfirm":`Confirm`,"chat.extensionEditor":`Edit`,"chat.extensionPanel":`Extension panel`,"chat.close":`Close`,"chat.notifyErrorTitle":`Error`,"chat.notifyWarningTitle":`Warning`,"chat.queued":`Queued · {count}`,"chat.recall":`Recall to input`,"chat.recallTitle":`Remove all queued messages and put them back into the input box for editing (also triggered by pressing Enter while the input is empty)`,"chat.retrying":`Retrying ({attempt}/{max})…`,"chat.loadingCommands":`Loading commands...`,"chat.slashCommands":`Slash commands · {label}`,"chat.tabEnter":`Tab / Enter`,"chat.noCommands":`No extension, prompt, or skill commands found`,"chat.match":`1 match`,"chat.matches":`{count} matches`,"chat.command":`1 command`,"chat.commands":`{count} commands`,"chat.loadingFiles":`Loading files...`,"chat.files":`Files · {label}{hint}`,"chat.searching":`Searching…`,"chat.noMatchingFiles":`No matching files`,"chat.searchingAll":` · searching all files…`,"chat.indexTruncated":` · index truncated`,"chat.steerPlaceholder":`Steer now / queue follow-up...`,"chat.recallPlaceholder":`Press Enter to recall queued messages, or type a new message…`,"chat.agentPlaceholder":`Agent is running…`,"chat.messagePlaceholder":`Message… Type / for commands, @ for files, ! for shell`,"chat.questionNotificationTitle":`Pi — Question Asked`,"chat.taskCompleteNotificationTitle":`Pi — Task Complete`,"chat.taskErrorNotificationTitle":`Pi — Error`,"chat.sessionCompletedNotificationBody":`Session {name} completed`,"chat.questionNotificationDenied":`Notifications denied: allow them in the browser's site settings to get question alerts while the tab is hidden.`,"chat.steer":`Steer`,"chat.followUp":`Follow-up`,"chat.queueImageBlocked":`Image attachments cannot be queued while the agent is running`,"chat.steerTooltip":`Send this message immediately after the current call finishes`,"chat.followUpTooltip":`Queue this message after the agent finishes`,"chat.send":`Send`,"chat.attachImage":`Attach image`,"chat.filterModels":`Filter models…`,"chat.noMatchingModels":`No matching models`,"chat.moreControls":`More controls`,"chat.collapseControls":`Collapse controls`,"chat.shell":`Shell`,"chat.outputLocal":`output stays local`,"chat.outputModel":`output sent to model`,"chat.noTools":`No tools, read-only`,"chat.builtInTools":`{count} built-in tools`,"chat.allBuiltInTools":`All built-in tools`,"chat.changeReasoning":`Change reasoning level: {level}`,"chat.changeReasoningLabel":`Change reasoning level`,"chat.changeToolPreset":`Change tool preset`,"chat.stopCompaction":`Stop compaction`,"chat.compactContext":`Compact context`,"chat.compacting":`Compacting…`,"chat.compact":`Compact`,"chat.stopAgent":`Stop agent`,"chat.stop":`Stop`,"chat.disableSound":`Disable completion sound`,"chat.enableSound":`Enable completion sound`,"chat.thinkingUseDefault":`Use pi default`,"chat.thinkingOff":`Reasoning off`,"chat.thinkingMinimal":`Minimal reasoning`,"chat.thinkingLow":`Low reasoning`,"chat.thinkingMedium":`Medium reasoning`,"chat.thinkingHigh":`High reasoning`,"chat.thinkingXhigh":`Extra-high reasoning`,"chat.thinkingMax":`Max reasoning`,"chat.thinkingMapTitle":`Higher thinking levels not configured`,"chat.thinkingMapBody":`pi supports up to high thinking by default. To enable {level} level reasoning, configure the "Thinking Level Map" for this model in Config → Models.`,"chat.thinkingMapGo":`Go to settings`,"chat.builtIn":`Built-in`,"chat.extensions":`Extensions`,"chat.prompts":`Prompts`,"chat.skills":`Skills`,"chat.dormant":`dormant`,"chat.commandCompact":`Compress context, optionally with instructions`,"chat.commandReload":`Reload extensions, skills, prompts, and tools`,"chat.commandName":`Set the session display name`,"chat.commandSession":`Show session message, token, and cost stats`,"chat.commandCopy":`Copy the last assistant message`,"chat.compacted":`Compacted`,"chat.tokensSaved":`{saved} saved`,"i18n.close":`Close`,"i18n.resizeList":`Resize {name} list`,"widgets.title":`Widgets`,"widgets.reopen":`Reopen widget`,"widgets.expandedToChat":`Widget [{key}] expanded to the chat view`,"widgets.collapse":`Collapse`,"widgets.open":`Open widgets`,"i18n.copy":`Copy`,"i18n.copied":`Copied`,"i18n.cancel":`Cancel`,"i18n.save":`Save`,"i18n.saving":`Saving…`,"i18n.saved":`Saved`,"i18n.saveChanges":`Save changes`,"i18n.noThinking":`No thinking content`,"i18n.remove":`Remove`,"i18n.removing":`Removing…`,"i18n.delete":`Delete`,"i18n.loading":`Loading...`,"i18n.searchPlaceholder":`Search…`,"i18n.noMatch":`No matches`,"i18n.search":`Search`,"i18n.refresh":`Refresh`,"i18n.update":`Update`,"i18n.updating":`Updating...`,"i18n.check":`Check`,"i18n.checking":`Checking...`,"i18n.install":`Install`,"i18n.installing":`Installing...`,"i18n.noResults":`No results`,"i18n.searchProviders":`Search providers…`,"i18n.noProviders":`No providers match`,"i18n.newModel":`new model`,"i18n.addProvider":`Add provider`,"i18n.selectProviderModel":`Select a provider or model`,"i18n.visibleInPrompt":`Visible in model prompt — click to disable`,"i18n.hiddenFromPrompt":`Hidden from model prompt — click to enable`,"i18n.dormant":`Dormant`,"i18n.hiddenButInvocable":`Hidden from model, still manually invocable`,"i18n.skillSearchPlaceholder":`e.g. react, testing, deploy`,"i18n.searching":`Searching…`,"i18n.noSkills":`No skills found`,"i18n.checkUpdates":`Check updates`,"i18n.updates":`updates`,"i18n.noResolvedResources":`No resolved resources`,"i18n.enablePackage":`Enable package`,"i18n.disablePackage":`Disable package`,"i18n.filtered":`filtered`,"i18n.openSessionToReload":`Open a session to reload`,"i18n.notFound":`Not found`,"i18n.noPlugins":`No plugins configured`,"trust.resourcesNotLoaded":`Restricted mode`,"trust.trustProject":`Trust project`,"trust.trusting":`Trusting...`,"trust.cancel":`Cancel`,"trust.dialogTitle":`Trust this project?`,"trust.dialogBody":`Project resources can run local code. Trust only projects whose contents you know.`,"trust.skillsNotLoaded":`Project skills are not loaded because this project is not trusted.`,"trust.pluginsNotLoaded":`Project plugins are not loaded because this project is not trusted.`,"trust.projectScopeUnavailable":`Project installs are unavailable while project resources are not loaded.`,"i18n.creatingSession":`Creating new session…`,"i18n.creating":`Creating…`,"i18n.subscription":`Subscription`,"i18n.subscriptions":`Subscriptions`,"i18n.customEndpoint":`Custom endpoint format`,"i18n.noChanges":`No changes`,"i18n.branches":`Branches`,"i18n.noActiveSession":`No active session`,"i18n.noActiveSessionToCompact":`No active session to compact`,"i18n.noActiveSessionToReload":`No active session to reload`,"i18n.noActiveSessionToName":`No active session to name`,"i18n.noAssistantMessageToCopy":`No assistant message to copy`,"i18n.commandCompleted":`Command completed`,"i18n.commandFailed":`Command failed`,"i18n.extensionCommandFailed":`Extension command failed`,"i18n.compactedContext":`Compacted context`,"i18n.reloadedSessionResources":`Reloaded session resources`,"i18n.usageName":`Usage: /name <name>`,"i18n.sessionRenamedTo":`Session renamed to {name}`,"i18n.copiedLastAssistantMessage":`Copied last assistant message`,"i18n.failedToRecallQueuedMessages":`Failed to recall queued messages`,"i18n.noBranches":`This session has no branches`,"i18n.source":`Source`,"i18n.preview":`Preview`,"i18n.diff":`Diff`,"i18n.downloadFile":`Download file`,"i18n.liveSync":`Live sync active`,"i18n.notWatching":`Not watching`,"i18n.fileViewMode":`File view mode`,"i18n.editMode":`Edit mode`,"i18n.viewMode":`View mode`,"i18n.compareHead":`Compare working tree with HEAD`,"i18n.mentionSelectedLines":`Mention selected lines`,"i18n.disableWrap":`Disable word wrap`,"i18n.enableWrap":`Enable word wrap`,"i18n.editFile":`Edit file`,"i18n.saveFile":`Save`,"i18n.saveFileShortcut":`Save (Ctrl/Cmd+S)`,"i18n.cancelEdit":`Cancel`,"i18n.saveFailed":`Save failed: {error}`,"i18n.unsavedChanges":`Unsaved changes`,"i18n.htmlPreview":`HTML preview`,"i18n.previewFile":`Preview {file}`,"i18n.invalidMermaid":`Invalid Mermaid diagram`,"i18n.renderingMermaid":`Rendering Mermaid diagram`,"i18n.previewAfterStreaming":`Preview available after streaming`,"i18n.showMermaidSource":`Show Mermaid source`,"i18n.previewMermaid":`Preview Mermaid diagram`,"i18n.openMermaidViewer":`Open diagram viewer`,"i18n.mermaidViewer":`Mermaid diagram viewer`,"i18n.mermaidDiagram":`Mermaid diagram`,"i18n.zoomOut":`Zoom out`,"i18n.zoomIn":`Zoom in`,"i18n.fitToWidth":`Fit to width`,"models.discoveryFetching":`Importing models…`,"models.deleteProviderConfirm":`Delete provider "{name}"? This writes to models.json immediately — all its settings (including the API key) will be removed and cannot be recovered.`,"models.removeModelConfirm":`Remove model "{model}"? This writes to models.json immediately and cannot be recovered.`,"models.discoveryTitle":`Import models`,"models.discoveryFetch":`Import models…`,"models.discoveryFilterPlaceholder":`Filter {count} models…`,"models.discoveryFilter":`Filter upstream models`,"models.discoverySelectShown":`Select shown`,"models.discoveryNoMatches":`No matching models.`,"models.discoveryAdded":`added`,"models.discoveryShowing":`Showing first {shown} of {total}`,"models.discoveryFetched":`{count} models fetched`,"models.discoveryAddSelected":`Add selected`,"models.setDefault":`Set as default`,"models.defaultModel":`Default model`,"models.syncEndpoint":`Sync from endpoint`,"models.lastSyncedAt":`Last synced {time}`,"models.neverSynced":`Never synced`,"models.discoveryFetchTooltip":`Imports from the local cache first: {path}. If absent, syncs from the endpoint once and writes the cache there.`,"models.syncingModels":`Syncing…`,"models.syncedModels":`Synced {count} models`,"models.syncEndpointTooltip":`Fetch the latest model list from {endpoint} and cache it locally; the cached list replaces the built-in one.`,"models.syncEndpointTooltipGeneric":`Fetch the latest model list from this provider's models endpoint and cache it locally; the cached list replaces the built-in one.`,"models.refreshFromCache":`Refresh from synced cache`,"models.refreshing":`Refreshing…`,"models.refreshFromCacheTooltip":`Re-read pi-web/provider/{provider}/models.json and update only the fields that differ from the current effective definition (manual fields like headers are kept).`,"models.refreshNoDiff":`Synced cache matches the effective definition — nothing to update.`,"models.refreshDone":`Override updated from synced cache.`,"models.refreshTimeout":`Refresh timed out — try again later.`,"models.builtinProviders":`Built-in providers`,"models.customProviders":`Custom providers`,"models.syncSaveFailed":`Save draft before sync failed — sync aborted.`,"models.visibleInChat":`Visible in chat`,"models.visibleModels":`Visible models`,"models.visibleModelsCount":`{visible} / {total} visible`,"models.selectAll":`Select all`,"models.invertSelection":`Invert`,"models.searchModels":`Search models…`,"models.noVisibleModels":`No models.`,"models.filterAll":`All`,"models.filterVisible":`Visible`,"models.filterHidden":`Hidden`,"models.invertDisabledTooltip":`All models are already visible; inverting changes nothing`,"models.openOverride":`Edit override`,"models.overrideHint":`Values shown are the effective definition (built-in merged with saved overrides). Only fields you change are saved as overrides; everything else keeps inheriting the built-in definition.`,"models.removeOverride":`Remove override`,"models.providerNameCollision":`Provider "{provider}" conflicts with built-in "{builtin}" (case-insensitive); model visibility cannot be applied. Rename or remove the provider.`,"models.providerNameCollisionShort":`Name conflicts with built-in provider`,"models.builtinVisibilityBlocked":`Model visibility is disabled: custom provider "{custom}" conflicts with "{builtin}" (case-insensitive). Rename or remove the custom provider.`,"models.discoveryAddSelectedCount":`Add selected ({count})`,"models.dataSourceLabel":`Data source:`,"models.catalogSourceEndpoint":`Models endpoint`,"models.catalogSourceDev":`models.dev catalog`,"models.catalogSourceEndpointTooltip":`Source: Provider's /models endpoint`,"models.catalogSourceDevTooltip":`Source: models.dev built-in catalog (https://models.dev)`,"models.catalogEndpointNotFound":`Model ID not found in the models endpoint response`,"models.catalogOverwriteTitle":`Overwrite existing fields?`,"models.catalogOverwriteBody":`{{count}} field(s) already have values that overwriting would change: {{fields}}. Cancel to fill empty fields only.`,"models.catalogOverwriteConfirm":`Overwrite & fill`,"models.catalogOverwriteCancel":`Fill empty only`,"models.catalogFilling":`Filling details…`,"models.catalogFill":`Fill model details`,"models.catalogFilled":`{count} fields filled`,"models.catalogNoEmptyFields":`No empty fields to fill`,"models.catalogNoExactMatch":`No exact models.dev match`,"models.catalogPriceProvider":`Price matched Provider {provider}`,"models.catalogPriceBaseUrl":`Price matched Base URL to {provider}`,"models.catalogPriceConsensus":`Price agreed by {support}/{total} records`,"models.catalogPriceUnreliable":`No reliable price found`,"models.catalogUndo":`Undo`,"models.baseUrl":`Base URL`,"models.apiKey":`API Key`,"models.api":`API Format`,"models.modelId":`ID *`,"models.name":`Name`,"models.apiOverride":`API override`,"models.reasoningThinking":`Reasoning / thinking`,"models.imageInput":`Image input`,"models.imageInputHint":`Checking writes input: ["text", "image"]; unchecking removes input (falls back to ["text"]).`,"models.nameHint":`Leaving empty removes the name field (falls back to the model id).`,"models.apiOverrideHint":`Leaving empty or picking default removes the api field (falls back to the provider's default api).`,"models.reasoningHint":`Unchecking removes the reasoning field (falls back to off).`,"models.compatBoolTrueHint":`Unchecked does not mean false: pi treats a missing field as true. Unchecking writes explicit false so it can actually be turned off.`,"models.compatBoolHint":`Checking writes true; unchecking removes the field (falls back to auto-detect / false default).`,"models.compatSelectHint":`Picking default/none removes the field (falls back to auto-detect).`,"models.thinkingLevelMapHint":`Per level: Default = removes that mapping (falls back to the model's default level); Disabled = writes null; Custom = writes a custom level string.`,"models.compatSection":`Compatibility`,"models.compatInheritHint":`Fields not set on the model show values inherited from this provider (marked · from provider); the inherited value is what actually takes effect until overridden here.`,"models.inheritedFromProvider":`· from provider`,"models.thinkingFormatDeepseekHint":`Selecting "deepseek" also writes requiresReasoningContentOnAssistantMessages: true; any other value removes it.`,"models.samplingParams":`Sampling params`,"models.headers":`Headers`,"models.modelOverrides":`Model overrides`,"models.supportsDeveloperRole":`Developer role`,"models.supportsLongCacheRetention":`Long cache retention`,"models.supportsUsageInStreaming":`Usage in streaming`,"models.supportsFinishReason":`Finish reason in stream`,"models.supportsEagerToolInputStreaming":`Eager tool input streaming`,"models.supportsCacheControlOnTools":`Cache control on tools`,"models.supportsTemperature":`Temperature param`,"models.requiresToolResultName":`Tool result name required`,"models.requiresAssistantAfterToolResult":`Assistant after tool result`,"models.requiresThinkingAsText":`Thinking as text`,"models.requiresReasoningContentOnAssistantMessages":`Reasoning content on assistant`,"models.zaiToolStream":`z.ai tool stream`,"models.supportsThinkingTokenBudget":`Thinking token budget`,"models.supportsOpenAIGrammarTools":`OpenAI grammar tools`,"models.sendSessionAffinityHeaders":`Session affinity headers`,"models.supportsToolSearch":`Tool search`,"models.supportsExplicitPromptCacheMode":`Explicit prompt cache`,"models.forceAdaptiveThinking":`Adaptive thinking`,"models.allowEmptySignature":`Empty thinking signature`,"models.supportsStrictTools":`Strict tool schemas`,"models.supportsStore":`Store param`,"models.supportsReasoningEffort":`Reasoning effort`,"models.supportsStrictMode":`Strict mode`,"models.supportsToolReferences":`Tool references`,"models.maxTokensField":`Max tokens field`,"models.sessionAffinityFormat":`Session affinity format`,"models.deferredToolsMode":`Deferred tools mode`,"models.cacheControlFormat":`Cache control format`,"models.thinkingFormat":`Thinking format`,"models.chatTemplateKwargs":`Chat template kwargs`,"models.chatTemplateArgs":`Chat template args`,"models.openRouterRouting":`OpenRouter routing`,"models.vercelGatewayRouting":`Vercel gateway routing`,"models.thinkingLevelMap":`Thinking level map`,"models.contextWindow":`Context window (tokens)`,"models.maxOutputTokens":`Max output tokens`,"models.costPerMillion":`Cost (per million tokens)`,"models.apiKeyPlaceholder":`ENV_VAR_NAME, !shell-command, or literal key`,"models.apiKeyHint":`Prefix with ! to run a shell command, or use an env var name`,"models.apiKeyStored":`API key is stored. Enter a new key below to replace it, or disconnect to remove it.`,"models.apiKeyPrompt":`Enter your {provider} API key to enable {count} model{s}.`,"models.apiKeyReplacePlaceholder":`Enter new key to replace…`,"models.oauthAlreadyConnected":`Already connected. You can re-login or disconnect.`,"models.oauthConnectPrompt":`Connect your {provider} account.`,"models.enterValue":`Enter value…`,"models.displayNamePlaceholder":`Display name`,"models.connectionLost":`Connection lost`,"models.networkError":`Network error`,"i18n.testingModel":`Testing model connection...`,"i18n.connected":`Connected`,"i18n.failed":`Failed`,"i18n.test":`Test`,"i18n.testConnection":`Test model connection`,"i18n.provider":`Provider`,"i18n.providers":`Providers`,"i18n.model":`Model`,"i18n.providerName":`Provider name`,"i18n.rename":`Rename`,"i18n.default":`Default`,"i18n.disabled":`Disabled`,"plugins.statusLoaded":`Loaded and active`,"plugins.statusInstalled":`Installed, not yet loaded`,"plugins.statusDisabled":`Disabled`,"plugins.statusMissing":`Configured but package not found`,"plugins.extensionFilters":`Extension filters`,"plugins.filterRules":`Filter rules`,"plugins.managePlugins":`Plugins`,"plugins.extensionFiltersHint":`Filters for auto-discovered extensions in ~/.pi/agent/extensions/ and .pi/extensions/. Only patterns starting with !, +, or - take effect; plain paths do nothing.`,"plugins.noExtensionFilters":`No filters configured`,"plugins.addFilter":`Add filter`,"plugins.filterPatternLabel":`Pattern`,"plugins.filterPlaceholder":`!pattern · +path · -path`,"plugins.filterInvalid":`Pattern must start with !, +, or -; plain paths have no effect in the extensions field.`,"plugins.filterPrefixExclude":`Exclude matching extensions`,"plugins.filterPrefixForceInclude":`Force-include exact path`,"plugins.filterPrefixForceExclude":`Force-exclude exact path`,"plugins.filterEffect":`Effect`,"plugins.removeFilter":`Remove filter`,"plugins.npmSourcePlaceholder":`npm:@scope/package`,"plugins.packageInstalled":`Package installed.`,"plugins.packageUpdated":`Package updated.`,"plugins.packageRemoved":`Package removed.`,"plugins.packageDisabled":`Package disabled.`,"plugins.packageEnabled":`Package enabled.`,"plugins.extensionFilterAdded":`Extension filter added.`,"plugins.extensionFilterRemoved":`Extension filter removed.`,"plugins.sessionReloaded":`Session reloaded.`,"i18n.noResources":`No resources`,"i18n.unknown":`Unknown`,"i18n.installedVersion":`installed {version}`,"i18n.configuredVersion":`configured {version}`,"i18n.extensions":`Extensions`,"i18n.prompts":`Prompts`,"i18n.themes":`Themes`,"i18n.resourceCount":`{count} {label}`,"i18n.extensionShort":`ext`,"i18n.versionShort":`ver`,"i18n.skillShort":`skills`,"i18n.promptShort":`prompts`,"i18n.themeShort":`themes`,"i18n.custom":`Custom`,"i18n.clearAll":`clear all`,"i18n.connectedSuccessfully":`Connected successfully.`,"i18n.notConnected":`not connected`,"i18n.configured":`configured`,"i18n.notConfigured":`not configured`,"i18n.openingBrowser":`Opening browser…`,"i18n.submit":`Submit`,"i18n.login":`Login`,"i18n.relogin":`Re-login`,"i18n.disconnect":`Disconnect`,"i18n.networkError":`Network error`,"i18n.continuing":`Continuing…`,"i18n.skills":`Skills`,"i18n.plugins":`Plugins`,"i18n.addSkill":`Add skill`,"i18n.addPlugin":`Add plugin`,"i18n.recommendedPlugins":`Recommended`,"i18n.selectSkill":`Select a skill`,"i18n.selectPackage":`Select a package`,"i18n.configBindings":`Bound config files`,"i18n.addBinding":`Add`,"i18n.configFileNote":`Note (optional)`,"i18n.bindConfigFile":`Bind config file`,"i18n.selectFile":`Select a file`,"i18n.noConfigBindings":`No config files bound`,"i18n.noFiles":`No files`,"i18n.allFiles":`All files`,"i18n.filterByType":`Filter by type`,"i18n.removeBinding":`Remove binding`,"i18n.confirm":`Confirm`,"i18n.updateAvailable":`Update available`,"i18n.upToDate":`Up to date`,"i18n.automaticChecksUnavailable":`Automatic checks unavailable`,"i18n.checkFailed":`Check failed`,"i18n.installed":`Installed`,"i18n.status":`Status`,"i18n.version":`Version`,"i18n.package":`Package`,"i18n.resources":`Resources`,"i18n.installedPath":`Installed path`,"i18n.readme":`README`,"i18n.readmeDetails":`Details`,"i18n.unsafeLinkBlocked":`Blocked unsafe link (only same-directory or sub-directory relative links are allowed): {href}`,"i18n.resolvedResources":`Resolved Resources`,"i18n.reloadSession":`Reload session`,"i18n.reloading":`Reloading...`,"i18n.packageRemoved":`Package removed.`,"i18n.packageInstalled":`Package installed.`,"i18n.packageUpdated":`Package updated.`,"i18n.packageDisabled":`Package disabled.`,"i18n.packageEnabled":`Package enabled.`,"i18n.sessionReloaded":`Session reloaded.`,"i18n.thinking":`Thinking`,"i18n.loadingThinking":`Loading thinking...`,"i18n.copyMessage":`Copy message`,"i18n.editFromHere":`Edit from here`,"i18n.editFromHereTitle":`Edit from here — branches within this session`,"i18n.newSession":`New session`,"i18n.newSessionTitle":`New session — creates an independent copy from here`,"i18n.estimatedTokens":`Estimated token count while streaming`,"i18n.noOutput":`(no output)`,"i18n.noSummary":`(no summary)`,"i18n.conversationCompacted":`Conversation compacted`,"i18n.compactionDescription":`The conversation history before this point was compacted into the following summary:`,"i18n.fileContext":`File context: {details}`,"i18n.readFiles":`Read files`,"i18n.modifiedFiles":`Modified files`,"i18n.hiddenExtensionMessage":`hidden extension message`,"i18n.noMessage":`(no message)`,"i18n.showExtensionMessage":`Show extension message`,"i18n.collapse":`Collapse`,"i18n.expand":`Expand`,"i18n.hideDetails":`Hide details`,"i18n.showDetails":`Show details`,"i18n.thinkingUnavailable":`Thinking content unavailable`,"i18n.thinkingEncrypted":`Thinking content is encrypted (provider-encrypted for context continuity, plaintext not available)`,"i18n.before":`Before`,"i18n.after":`After`}},v={id:`zh-CN`,label:`简体中文`,messages:{"common.ok":`确定`,"common.language":`语言`,"common.models":`模型`,"common.skills":`技能`,"common.plugins":`插件`,"sidebar.hide":`收起侧边栏`,"sidebar.show":`展开侧边栏`,"theme.light":`切换到浅色模式`,"preferences.defaultThinkingLevel":`默认思考级别`,"preferences.thinkingLevelHint":"新会话的全局默认思考级别(settings.json `defaultThinkingLevel`)。未设置=删除该字段(回落 pi 默认)。","preferences.thinkingLevelNotSet":`未设置(跟随模型默认)`,"preferences.compaction":`自动压缩`,"preferences.compactionHint":"自动压缩长会话(settings.json `compaction`)。未配置时按 pi 默认值展示,改动即写入完整对象。","preferences.compactionEnabled":`启用`,"preferences.compactionReserveTokens":`输出预留词元数`,"preferences.compactionReserveTokensHint":`为模型输出预留的词元数,压缩时保留这部分空间供回复使用`,"preferences.compactionKeepRecentTokens":`压缩后保留词元数`,"preferences.compactionKeepRecentTokensHint":`压缩后保留的词元数,从最近聊天记录开始逆向往前计算`,"preferences.retry":`API 重试`,"preferences.retryHint":"供应商 API 调用的重试设置(settings.json `retry`)。未配置时按 pi 默认值展示,改动即写入完整对象;provider 子字段留空则不写入。","preferences.retryEnabled":`启用重试`,"preferences.retryEnabledHint":`是否对失败的 API 调用启用重试`,"preferences.retryMaxRetries":`最大重试次数`,"preferences.retryBaseDelayMs":`基础延迟(毫秒)`,"preferences.retryBaseDelayMsHint":`首次重试前的初始延迟,单位毫秒`,"preferences.retryProviderTimeoutMs":`供应商超时(毫秒)`,"preferences.retryProviderMaxRetries":`供应商最大重试次数`,"preferences.retryProviderMaxRetryDelayMs":`供应商最大延迟(毫秒)`,"preferences.defaultProjectTrust":`新项目默认信任`,"preferences.projectTrustHint":"新项目的默认信任策略(settings.json `defaultProjectTrust`)。未设置=删除该字段(回落「询问」)。","preferences.projectTrustNotSet":`未设置(询问)`,"preferences.projectTrustAsk":`询问`,"preferences.projectTrustAlways":`总是信任`,"preferences.projectTrustNever":`从不信任`,"preferences.notifyEvents":`通知`,"preferences.notifyEventsHint":`标签页非激活时发浏览器通知。权限在首次交互时请求。`,"notify.permission.request":`开启通知`,"notify.permission.requestHint":`点击开启浏览器通知:任务完成时即使不在本页也会提醒`,"notify.permission.granted":`通知已开启`,"notify.permission.grantedHint":`已开启浏览器通知:任务完成时即使不在本页也会提醒`,"notify.permission.bannerHintBefore":`点击左上工具栏的`,"notify.permission.bannerHintAfter":`按钮开启通知权限,任务完成、出错或提问时都能收到浏览器通知,详细设置可在 配置中心 → 会话 → 通知 栏目中调整`,"notify.permission.denied":`通知被阻止`,"notify.permission.deniedHint":`浏览器阻止了通知。请点击地址栏左侧图标 → 站点设置,将通知改为允许后重试`,"preferences.notifyWhileActive":`页面激活时也通知`,"preferences.notifyTaskComplete":`任务完成`,"preferences.notifyErrors":`运行出错`,"preferences.notifyQuestions":`提问`,"preferences.subagentsDefaultModel":`子代理默认模型`,"preferences.subagentsDefaultThinking":`子代理默认思考级别`,"preferences.subagentsHint":"子代理默认配置(settings.json `subagents`)。defaultThinking 未设置=删除该子字段(回落 pi 默认)。","preferences.subagentsModelPlaceholder":`供应商/模型-id`,"theme.dark":`切换到深色模式`,"theme.toggleTheme":`切换主题`,"theme.darkMode":`深色`,"theme.lightMode":`浅色`,"theme.fontSize":`字体大小`,"theme.scrollStep":`悬停滚动步长`,"scrollStep.hint":`悬停滚动方向箭头时,内容每次滚动的像素数(面板滚动箭头与消息地图共用此步长)。`,"scrollStep.range":`每次悬停滚动像素(1-1000)`,"scrollStep.unit":`px`,"theme.autoReloadSeconds":`自动重载聊天消息间隔`,"autoReload.off":`关闭(0)— 不自动刷新`,"autoReload.range":`秒(0 — 3600)`,"autoReload.unit":`秒`,"autoReload.hint":`自动重新读取会话文件的间隔秒数;0 = 关闭。单客户端场景(消息经 SSE 实时推送)保持 0 即可;多客户端协作(多个浏览器同时操作同一会话)时设为大于 0,各客户端定时刷新以读取其他客户端生成的新聊天消息。`,"longBlock.hint":`“块”指思维链(thinking)和工具调用(tool call)。正文超过阈值时折叠为头尾摘要,点击可展开查看全文。`,"recentBlocks.hint":`流式渲染过程中和刚刚完成的块不计入数量(最新完成的块始终展开)。本值表示除此之外,额外保持展开的最近已完成块数。`,"autoReload.reset":`恢复默认({n} 秒)`,"chat.reloadFromDisk":`从磁盘重新加载会话`,"chat.reloadFromDiskHint":`当多个客户端同时读写同一个会话 jsonl 时使用。可在 配置中心 → 会话 页面设置自动定时重载。`,"scrollStep.reset":`恢复默认({n} px)`,"theme.longBlockCollapse":`长块折叠阈值`,"theme.recentBlocksExpanded":`最近完成块保持展开数`,"layout.sidebarWidth":`左侧面板宽度`,"layout.widgetPanelWidth":`右侧面板宽度`,"layout.widthRange":`px({min}–{max})`,"layout.widthReset":`恢复默认({value} px)`,"longBlock.range":`字符数(20-10000)`,"longBlock.chars":`字符`,"longBlock.blocks":`个`,"longBlock.reset":`恢复默认({n} 字符)`,"recentBlocks.reset":`恢复默认({n} 个)`,"recentBlocks.range":`0-20,不含最新完成的块`,"longBlock.expandHint":`… 中间 {n} 字符已折叠 · 点击展开`,"longBlock.collapse":`点击收起`,"history.full":`完整历史`,"history.unsaved":`会话保存后才能查看完整历史`,"title.generating":`正在生成...`,"title.updated":`标题已更新`,"title.failed":`生成失败`,"title.generate":`生成标题`,"title.unsaved":`会话保存后才能生成标题`,"title.noMessages":`请先发送消息,再为会话命名`,"title.generateSession":`生成会话标题`,"system.prompt":`系统提示词`,"system.empty":`系统提示词为空(工具已禁用)`,"system.load":`发送消息以加载系统提示词`,"session.info":`会话信息`,"session.reload":`重载会话(重读配置与资源)`,"session.name":`名称`,"session.file":`文件`,"session.inMemory":`内存中`,"session.id":`ID`,"session.user":`用户`,"session.assistant":`助手`,"session.toolCalls":`工具调用`,"session.toolResults":`工具结果`,"session.total":`总计`,"session.input":`输入`,"session.output":`输出`,"session.cacheRead":`缓存读取`,"session.cacheWrite":`缓存写入`,"session.inputHint":`未命中缓存的输入 token 数:系统提示、会话历史、工具定义等发送给模型的上下文,减去命中缓存的部分`,"session.outputHint":`模型生成回复的 token 数(回答与思考)`,"session.cacheReadHint":`命中 prompt 缓存的 token 数:与上一请求未变的上下文直接从缓存读取,按折扣价计费`,"session.cacheWriteHint":`首次写入缓存的 token 数(Anthropic 风格按写入计费)`,"session.totalHint":`输入 + 输出 + 缓存读取 + 缓存写入`,"session.cacheReadRate":`缓存命中率:命中缓存的 token(缓存读取)占全部输入 prompt(输入 + 缓存读取 + 缓存写入)的比例,即官方口径 cacheRead ÷ (input + cacheRead + cacheWrite)`,"session.cost":`费用`,"session.context":`上下文`,"session.copy":`复制{value}`,"session.copied":`已复制`,"session.title":`会话信息`,"session.load":`发送消息或运行 /session 以加载会话信息`,"session.infoSection":`会话信息`,"session.messages":`消息`,"session.tokens":`Token`,"session.copyFile":`复制文件路径`,"session.copyId":`复制会话 ID`,"workspace.opening":`正在打开工作区...`,"workspace.unable":`无法打开工作区`,"workspace.selectSession":`从侧边栏选择一个会话`,"workspace.selectWorkspace":`请选择工作区`,"workspace.stepProject":`从侧边栏选择项目目录`,"workspace.stepModels":`点击底部的“模型”按钮添加模型`,"tabs.chat":`聊天`,"tabs.widgets":`小组件`,"config.title":`配置`,"config.section.session":`会话`,"config.section.appearance":`外观`,"config.section.advanced":`高级`,"config.section.startScreen":`开始屏幕`,"config.section.git":`Git`,"config.section.modelThinking":`思考级别`,"config.section.requiresCwd":`请先从侧边栏选择项目目录,再浏览插件 / 技能`,"preferences.pi.unset":`pi 默认`,"preferences.pi.enableAnalytics":`启用分析`,"preferences.pi.enableAnalyticsHint":"发送匿名使用分析(settings.json `enableAnalytics`)","preferences.pi.enableInstallTelemetry":`启用安装遥测`,"preferences.pi.enableInstallTelemetryHint":"发送匿名安装遥测(settings.json `enableInstallTelemetry`)","preferences.pi.httpProxy":`HTTP 代理`,"preferences.pi.httpProxyHint":"HTTP 请求的代理地址(settings.json `httpProxy`)。留空无法清除已设置的值。","preferences.pi.trackingId":`分析跟踪 ID`,"preferences.pi.trackingIdHint":"自定义分析跟踪 ID(settings.json `trackingId`)。留空无法清除已设置的值。","preferences.pi.httpIdleTimeoutMs":`HTTP 空闲超时(毫秒)`,"preferences.pi.httpIdleTimeoutMsHint":"HTTP 空闲超时毫秒数(settings.json `httpIdleTimeoutMs`)。留空无法清除已设置的值。","preferences.pi.websocketConnectTimeoutMs":`WebSocket 连接超时(毫秒)`,"preferences.pi.websocketConnectTimeoutMsHint":"WebSocket 连接超时毫秒数(settings.json `websocketConnectTimeoutMs`)。留空无法清除已设置的值。","preferences.pi.branchSummary":`分支摘要`,"preferences.pi.branchSummaryHint":"分支摘要自动压缩(settings.json `branchSummary`)","preferences.pi.reserveTokens":`预留 token`,"preferences.pi.skipPrompt":`跳过提示`,"preferences.pi.images":`图片处理`,"preferences.pi.imagesHint":"pi 引擎如何处理图片(settings.json `images`)","preferences.pi.autoResize":`自动缩放`,"preferences.pi.autoResizeHint":"压缩 `read` 等工具返回的图片以节省 token。","preferences.pi.blockImages":`阻止图片`,"preferences.pi.blockImagesHint":`在消息发送给模型前移除所有图片内容。`,"config.files.hint":`直接编辑 pi 的配置文件(JSON)。保存前校验,写前自动备份(保留最近 10 份)。`,"config.widgets.empty":`暂无小组件配置。插件弹出小组件时会自动在此创建条目。`,"config.widgets.x":`x`,"config.widgets.y":`y`,"config.widgets.width":`宽`,"config.widgets.height":`高`,"config.widgets.bind":`绑定消息`,"config.widgets.bindTitle":`绑定自定义消息`,"config.widgets.bindHint":`为小组件「{key}」绑定一条快捷消息`,"config.widgets.editTitle":`编辑快捷消息`,"config.widgets.editHint":`修改标题、内容与发送方式。`,"config.widgets.label":`描述`,"config.widgets.labelPlaceholder":`按钮显示的文字(如:重载)`,"config.widgets.message":`消息内容`,"config.widgets.messagePlaceholder":`斜杠命令或任意文本(如 /reload)`,"config.widgets.sendImmediately":`立即发送`,"config.widgets.sendMode":`发送方式`,"config.widgets.fillToChatInput":`填充到聊天框`,"config.widgets.sendImmediatelyTooltip":`立即发送:`,"config.widgets.fillToChatInputTooltip":`填充到聊天框:`,"config.widgets.nameConflict":`名称「{label}」已存在,请换一个名称`,"config.startScreen.nameConflict":`名称「{label}」已存在,请换一个名称`,"config.widgets.confirm":`确认`,"config.widgets.unbindTitle":`解绑消息`,"config.widgets.unbindConfirm":`确定解绑「{label}」?`,"config.widgets.unbind":`解绑`,"config.startScreen.hint":`新会话开始屏幕(Pi Logo 下方)展示的快捷入口;点击后按各条绑定的发送方式立即发送或填充到聊天输入框。`,"config.startScreen.bind":`绑定消息`,"config.startScreen.bindTitle":`绑定快捷消息`,"config.startScreen.bindHint":`为开始屏幕绑定一条快捷消息。`,"config.startScreen.editTitle":`编辑快捷消息`,"config.startScreen.editHint":`修改标题、内容与发送方式。`,"config.startScreen.empty":`暂无快捷消息,开始屏幕不会显示快捷入口。`,"config.startScreen.unbindTitle":`解绑消息`,"config.startScreen.unbindConfirm":`确定解绑「{label}」?`,"config.startScreen.unbind":`解绑`,"config.startScreen.reset":`重置`,"config.startScreen.resetHint":`恢复内置默认快捷消息;保留你自绑定的消息(与默认同名的会被默认项覆盖)。`,"config.files.save":`保存`,"config.files.saving":`保存中...`,"config.files.saved":`已保存`,"config.files.missing":`尚未创建`,"config.files.placeholder":`从左侧选择要编辑的配置文件`,"layout.resizeSidebar":`调整侧边栏宽度`,"layout.resizeWidgetPanel":`调整小组件面板宽度`,"layout.resizeHint":`拖动调整宽度。双击或按 Enter 恢复默认值。`,"sidebar.newWorkspace":`新增工作区`,"sidebar.searchSessions":`搜索会话`,"sidebar.searchSessionsPlaceholder":`搜索会话…`,"sidebar.justNow":`刚刚`,"sidebar.minutesAgo":`{count} 分钟前`,"sidebar.hoursAgo":`{count} 小时前`,"sidebar.daysAgo":`{count} 天前`,"sidebar.searchSessionsNoResults":`无匹配会话`,"sidebar.newSessionTitle":`在 {path} 中新建会话`,"sidebar.refresh":`刷新`,"directoryPicker.selectDirectory":`选择目录`,"directoryPicker.goToParent":`转到上级目录`,"directoryPicker.directoryPath":`目录路径`,"directoryPicker.goToDirectory":`转到目录`,"directoryPicker.go":`转到`,"directoryPicker.loadingDirectories":`正在加载目录…`,"directoryPicker.noSubdirectories":`没有子目录`,"directoryPicker.openBeforeSelecting":`选择前请先打开此路径`,"directoryPicker.selectCurrentDirectory":`选择当前目录`,"directoryPicker.selectThisFolder":`选择此文件夹`,"directoryPicker.noDrives":`未找到盘符`,"directoryPicker.search":`筛选文件夹`,"directoryPicker.noMatches":`没有匹配的文件夹`,"sidebar.checking":`检查中…`,"sidebar.open":`打开`,"sidebar.cancel":`取消`,"sidebar.openRepoRoot":`worktree 切换不可用`,"sidebar.openRepoRootTitle":`worktree 切换功能当前不可用:请先在侧栏将当前工作目录切换到 Git 仓库根目录。`,"sidebar.gitRepoRootOnly":`仅 Git 仓库根目录`,"sidebar.gitRepoRootOnlyTitle":`只能在 Git 仓库根目录使用 worktree。`,"sidebar.worktrees":`Worktrees...`,"sidebar.checkingWorktrees":`正在检查此目录的 worktree。`,"sidebar.filterWorktrees":`筛选 worktree…`,"sidebar.noMatchingWorktrees":`没有匹配的 worktree`,"sidebar.switchWorktree":`切换 worktree`,"sidebar.switchWorktreeTitle":`切换 worktree:{path}`,"sidebar.main":`主分支`,"sidebar.forceRemoveCheckout":`存在未提交的更改。强制移除 checkout?`,"sidebar.force":`强制移除`,"sidebar.createWorktreeTitle":`为分支创建 worktree checkout`,"sidebar.newWorktree":`新建 worktree…`,"sidebar.branchName":`分支名称`,"sidebar.creating":`创建中…`,"sidebar.create":`创建`,"sidebar.uploadFilesTitle":`将文件上传到项目根目录`,"sidebar.uploadFiles":`上传文件`,"sidebar.refreshExplorer":`刷新文件浏览器`,"sidebar.changedFiles":`{count} 个变更文件`,"sidebar.loading":`加载中...`,"sidebar.sessionDeleted":`会话已删除,请选择其他会话`,"sidebar.noSessions":`未找到会话`,"sidebar.workspace":`工作区`,"sidebar.newActivity":`有新活动`,"sidebar.newSessionActivity":`会话有新活动`,"sidebar.interactionBadge":`会话等待交互响应`,"sidebar.deleteSession":`删除 {title}?`,"sidebar.deleteWorkspace":`删除工作区({count} 个会话)?`,"sidebar.deleteWorkspaceTitle":`删除此工作区及其所有会话`,"sidebar.copyPath":`复制完整路径`,"sidebar.rename":`重命名`,"sidebar.delete":`删除`,"sidebar.deleteWithShiftClick":`删除(按住 Shift 点击可跳过确认)`,"sidebar.expandForks":`展开分叉`,"sidebar.collapseForks":`折叠分叉`,"sidebar.disconnect":`断开`,"sidebar.messagesCount":`{count} 条消息`,"sidebar.worktreePath":`Worktree:{path}`,"sidebar.removeWorktreeTitle":`移除 worktree checkout {path};保留分支`,"files.modified":`已修改`,"files.added":`已添加`,"files.deleted":`已删除`,"files.renamed":`已重命名`,"files.untracked":`未跟踪`,"files.conflict":`冲突`,"files.newlyUploaded":`刚上传`,"files.containsChangedFiles":`包含已更改文件`,"files.insertPath":`将路径插入聊天`,"files.mention":`提及`,"files.download":`下载文件`,"files.dismissError":`关闭错误`,"files.addUploadedFile":`将上传的文件添加到聊天`,"files.addAllUploadedFiles":`将所有上传的文件添加到聊天`,"files.dismissUploadResults":`关闭上传结果`,"files.loading":`正在加载文件...`,"files.noFiles":`未找到文件`,"loading.inProgress":`处理中…`,"loading.more":`还有 {count} 项…`,"errors.title":`错误`,"errors.titleCount":`错误({count})`,"errors.close":`关闭`,"errors.clearAll":`全部清除`,"files.notFound":`(暂无文件)`,"files.accessDenied":`访问被拒绝`,"files.empty":`(空)`,"files.uploadFailed":`{count} 个失败`,"files.explorer":`文件浏览器`,"files.changedCount":`{count} 个文件`,"files.stagedPrefix":`已暂存:`,"files.unstagedPrefix":`未暂存:`,"files.noStagedChanges":`暂无已暂存文件`,"files.noUnstagedChanges":`暂无变更文件`,"files.commitMessagePlaceholder":`提交信息`,"files.commit":`提交`,"files.push":`推送到远端(含 tag)`,"files.pushing":`推送中...`,"files.pushSuccess":`推送成功`,"files.pushFailed":`推送失败`,"files.pushUpToDate":`已与远端同步,无需推送`,"files.pull":`从远端拉取`,"files.pulling":`拉取中...`,"files.pullSuccess":`拉取成功`,"files.pullFailed":`拉取失败`,"files.pullUpToDate":`已与远端同步,无需拉取`,"files.pullNonFastForward":`拉取被拒绝——本地与远端已分叉。请在终端使用 git pull --rebase 或 --merge 处理。`,"files.committing":`提交中…`,"files.commitMessageRequired":`请先填写 commit message`,"files.commitTitle":`提交更改`,"files.confirmStageAllCommit":`是否暂存全部 {count} 个改动文件并提交?`,"files.stageAllAndCommit":`暂存并提交`,"files.stageFile":`暂存文件`,"files.unstageFile":`取消暂存`,"files.changeStats":`{count} 个变更文件,新增 {additions} 行,删除 {deletions} 行`,"git.groupTitle":`智能提交信息生成`,"git.commitModel.followCurrent":`跟随当前会话模型`,"git.commitModel.followCurrentHint":`开启后,生成提交信息时动态使用当前聊天的主模型;关闭则使用下方固定的模型(推荐使用免费小模型)。`,"git.commitModel.followCurrentOn":`已开启:跟随当前会话`,"git.commitModel.followCurrentOff":`已关闭:使用固定模型`,"git.commitModel.fixedModel":`固定模型`,"git.commitModel.fixedModelHint":`关闭“跟随当前会话”时使用的模型(建议选择固定的免费小模型,注意其上下文可能仅 5 万)。`,"git.commitModel.selectPlaceholder":`选择模型`,"git.commitModel.noModels":`暂无可用模型`,"git.commitModel.notConfiguredHint":`尚未选择固定模型,请先选择一个模型后再使用智能生成。`,"git.ai.generate":`智能生成`,"git.ai.generating":`生成中…`,"git.ai.notConfiguredTitle":`未配置模型`,"git.ai.notConfiguredDesc":`尚未为智能生成指定模型,请前往配置中心 → Git 指定模型后再试。`,"git.ai.goToConfig":`前往配置`,"git.ai.noSession":`跟随模式需要先选择一个会话`,"git.ai.noSessionModel":`当前会话无可用模型,请先在聊天中选择模型`,"git.commitModel.maxTokens":`最大输出长度`,"git.commitModel.maxTokensHint":`单次智能生成允许的最大输出 token 数(64–4096,默认 512)。已尽量降低推理开销:支持关闭的模型会关闭推理,不支持的会降至最低档位。`,"git.commitModel.autoGenerateOnEmpty":`空输入框时提交自动先智能生成`,"git.commitModel.autoGenerateOnEmptyHint":`开启后,点击提交时若输入框为空,会先自动调用智能生成填入信息再提交;仅在已指定模型时生效,未指定模型时空输入框仍禁用提交。默认开启。`,"git.ai.invalidModel":`已配置的模型格式无效,请前往配置中心重新选择`,"git.ai.autoGenerateOn":`已开启:空输入框自动生成`,"git.ai.usingCurrentModel":`使用聊天主模型`,"git.ai.usingModel":`使用 {model}`,"git.ai.generateAndCommit":`智能生成信息并提交`,"git.ai.autoGenerateOff":`已关闭`,"git.commitSectionTitle":`提交`,"git.commitConfirmStageAll":`提交时需确认“暂存全部”`,"git.commitConfirmStageAllHint":`开启后,未暂存时点击提交会先弹出“暂存全部并提交”确认框;关闭则直接暂存全部并提交。默认开启。`,"git.commitConfirmStageAllOn":`已开启:提交前确认`,"git.commitConfirmStageAllOff":`已关闭:直接暂存全部`,"modelThinking.desc":`为每个模型或 Provider 记忆上次选择的思考级别。切换模型时自动选中记忆的档位;若该模型的可用档位不含记忆值则回退到 auto(跟随默认)。支持全部 7 档:off / minimal / low / medium / high / xhigh / max。`,"modelThinking.byModel":`按模型`,"modelThinking.byProvider":`按 Provider`,"modelThinking.byProviderHint":`Provider 级别为回退:同 Provider 下未单独记忆的模型会使用此值。`,"modelThinking.emptyModel":`暂无按模型的记忆。切换模型后用下方思考级别下拉选择,自动记忆;也可在此添加。`,"modelThinking.emptyProvider":`暂无按 Provider 的记忆。`,"modelThinking.selectModelPlaceholder":`选择模型`,"modelThinking.selectProviderPlaceholder":`选择 Provider`,"modelThinking.providerInputPlaceholder":`或输入 Provider 名称`,"modelThinking.footerHint":`配置保存到独立文件 pi-web/model-thinking.json,不影响主配置;仅作用于 UI 下拉,不拦截 pi 的 thinking 调用。`,"common.add":`添加`,"common.delete":`删除`,"files.conflictSummary":`已有 {count} 个文件:{files}`,"files.cannotReplace":`无法替换:{files}`,"files.replace":`替换`,"files.skipExisting":`跳过已有文件`,"files.cancel":`取消`,"files.checking":`正在检查文件`,"files.uploading":`正在上传,{progress}%`,"files.search":`搜索文件`,"files.searchPlaceholder":`搜索文件...`,"chat.loadingSession":`正在加载会话...`,"chat.noSessionSelected":`请在左侧面板新增/选择任意会话`,"chat.loadingWindow":`正在加载消息...`,"chat.runningTool":`正在运行工具...`,"chat.runningNamedTool":`正在运行 {name}...`,"chat.runningTools":`正在运行 {names}...`,"chat.runningToolsMore":`正在运行 {names}(另有 {count} 个)...`,"chat.waitingModel":`正在等待模型...`,"chat.turnDuration":`耗时 {duration}`,"chat.aiQuestion":`AI 提问`,"chat.runningCommand":`正在运行命令...`,"chat.totalElapsed":`总计 {total}`,"chat.thinking":`正在思考...`,"chat.message":`条消息`,"chat.messages":`条消息`,"chat.toolCall":`次工具调用`,"chat.toolCalls":`次工具调用`,"chat.collapseProcess":`收起处理详情`,"chat.expandProcess":`展开处理详情`,"chat.loadEarlier":`向上滚动以加载更早的消息(隐藏 {count} 条)`,"chat.searchMessages":`搜索消息`,"chat.clearSearch":`清空搜索关键字`,"chat.scrollToLatest":`滚动到最新消息`,"chat.expandMessage":`展开完整内容`,"chat.searchPlaceholder":`搜索聊天消息…`,"chat.searchNoResults":`没有结果`,"chat.searchResults":`{count} 个结果`,"chat.extensionRequest":`扩展请求`,"chat.cancel":`取消`,"chat.confirm":`确认`,"chat.submit":`提交`,"chat.extensionInput":`扩展终端输入`,"chat.extensionSelect":`请选择`,"chat.extensionConfirm":`确认`,"chat.extensionEditor":`编辑`,"chat.extensionPanel":`扩展面板`,"chat.close":`关闭`,"chat.notifyErrorTitle":`错误`,"chat.notifyWarningTitle":`警告`,"chat.queued":`已排队 · {count}`,"chat.recall":`移回输入框`,"chat.recallTitle":`移除所有排队消息并放回输入框编辑(输入框为空时按回车也可触发)`,"chat.retrying":`正在重试({attempt}/{max})…`,"chat.loadingCommands":`正在加载命令...`,"chat.slashCommands":`斜杠命令 · {label}`,"chat.tabEnter":`Tab / Enter`,"chat.noCommands":`未找到扩展、提示词或技能命令`,"chat.match":`1 个匹配项`,"chat.matches":`{count} 个匹配项`,"chat.command":`1 个命令`,"chat.commands":`{count} 个命令`,"chat.loadingFiles":`正在加载文件...`,"chat.files":`文件 · {label}{hint}`,"chat.searching":`搜索中…`,"chat.noMatchingFiles":`未找到匹配的文件`,"chat.searchingAll":` · 正在搜索所有文件…`,"chat.indexTruncated":` · 索引不完整`,"chat.steerPlaceholder":`立即引导 / 排队后续消息...`,"chat.recallPlaceholder":`回车撤回排队消息到输入框编辑,或输入新消息…`,"chat.agentPlaceholder":`Agent 运行中…`,"chat.messagePlaceholder":`消息…输入 / 使用命令,@ 引用文件,! 执行命令`,"chat.questionNotificationTitle":`Pi — 提问`,"chat.taskCompleteNotificationTitle":`Pi — 任务完成`,"chat.taskErrorNotificationTitle":`Pi — 出错`,"chat.sessionCompletedNotificationBody":`会话 {name} 已完成`,"chat.questionNotificationDenied":`通知被拒绝:在浏览器站点设置中允许后,切走页面时才会收到提问提醒。`,"chat.steer":`引导`,"chat.followUp":`后续消息`,"chat.queueImageBlocked":`运行中无法排队发送带图片的附件`,"chat.steerTooltip":`在当前调用结束后立即发送这条消息`,"chat.followUpTooltip":`在智能体结束后排队发送这条消息`,"chat.send":`发送`,"chat.attachImage":`附加图片`,"chat.filterModels":`筛选模型…`,"chat.noMatchingModels":`没有匹配的模型`,"chat.moreControls":`更多控件`,"chat.collapseControls":`收起控件`,"chat.shell":`Shell`,"chat.outputLocal":`输出保留在本地`,"chat.outputModel":`输出发送给模型`,"chat.noTools":`不使用工具,仅只读`,"chat.builtInTools":`{count} 个内置工具`,"chat.allBuiltInTools":`全部内置工具`,"chat.changeReasoning":`更改推理级别:{level}`,"chat.changeReasoningLabel":`更改推理级别`,"chat.changeToolPreset":`更改工具预设`,"chat.stopCompaction":`停止压缩`,"chat.compactContext":`压缩上下文`,"chat.compacting":`正在压缩…`,"chat.compact":`压缩`,"chat.stopAgent":`停止 Agent`,"chat.stop":`停止`,"chat.disableSound":`关闭完成提示音`,"chat.enableSound":`开启完成提示音`,"chat.thinkingUseDefault":`使用 pi 默认设置`,"chat.thinkingOff":`关闭推理`,"chat.thinkingMinimal":`最低限度推理`,"chat.thinkingLow":`低强度推理`,"chat.thinkingMedium":`中等强度推理`,"chat.thinkingHigh":`高强度推理`,"chat.thinkingXhigh":`超高强度推理`,"chat.thinkingMax":`最高强度推理`,"chat.thinkingMapTitle":`高级思考级别未配置`,"chat.thinkingMapBody":`pi 默认只支持 high 级别。若要开启 {level} 级别推理,请在 配置 → 模型 页面为该模型配置「推理级别映射」。`,"chat.thinkingMapGo":`立即前往`,"chat.builtIn":`内置`,"chat.extensions":`扩展`,"chat.prompts":`提示词`,"chat.skills":`技能`,"chat.dormant":`休眠`,"chat.commandCompact":`压缩上下文,可选附加说明`,"chat.commandReload":`重新加载扩展、技能、提示词和工具`,"chat.commandName":`设置会话显示名称`,"chat.commandSession":`显示会话消息、Token 和费用统计`,"chat.commandCopy":`复制最后一条助手消息`,"chat.compacted":`已压缩`,"chat.tokensSaved":`节省 {saved}`,"i18n.close":`关闭`,"i18n.resizeList":`调整 {name} 列表大小`,"widgets.title":`小组件`,"widgets.reopen":`重新弹出`,"widgets.expandedToChat":`小组件[{key}]已展开到聊天页面`,"widgets.collapse":`收起`,"widgets.open":`展开小组件`,"i18n.copy":`复制`,"i18n.copied":`已复制`,"i18n.cancel":`取消`,"i18n.save":`保存`,"i18n.saving":`保存中…`,"i18n.saved":`已保存`,"i18n.saveChanges":`保存更改`,"i18n.noThinking":`无思考内容`,"i18n.remove":`移除`,"i18n.removing":`移除中…`,"i18n.delete":`删除`,"i18n.loading":`加载中...`,"i18n.searchPlaceholder":`搜索…`,"i18n.noMatch":`无匹配`,"i18n.search":`搜索`,"i18n.refresh":`刷新`,"i18n.update":`更新`,"i18n.updating":`更新中...`,"i18n.check":`检查`,"i18n.checking":`检查中...`,"i18n.install":`安装`,"i18n.installing":`安装中...`,"i18n.noResults":`没有结果`,"i18n.searchProviders":`搜索 Provider…`,"i18n.noProviders":`没有匹配的 Provider`,"i18n.newModel":`新模型`,"i18n.addProvider":`添加 Provider`,"i18n.selectProviderModel":`选择 Provider 或模型`,"i18n.visibleInPrompt":`在模型提示词中可见,点击以禁用`,"i18n.hiddenFromPrompt":`在模型提示词中隐藏,点击以启用`,"i18n.dormant":`休眠`,"i18n.hiddenButInvocable":`对模型隐藏,仍可手动调用`,"i18n.skillSearchPlaceholder":`例如 react、testing、deploy`,"i18n.searching":`搜索中…`,"i18n.noSkills":`未找到技能`,"i18n.checkUpdates":`检查更新`,"i18n.updates":`项更新`,"i18n.noResolvedResources":`没有已解析资源`,"i18n.enablePackage":`启用包`,"i18n.disablePackage":`禁用包`,"i18n.filtered":`已筛选`,"i18n.openSessionToReload":`打开会话后才能重新加载`,"i18n.notFound":`未找到`,"i18n.noPlugins":`未配置插件`,"trust.resourcesNotLoaded":`受限模式`,"trust.trustProject":`信任项目`,"trust.trusting":`正在信任...`,"trust.cancel":`取消`,"trust.dialogTitle":`信任此项目?`,"trust.dialogBody":`项目资源可以运行本地代码。请仅信任你了解其内容的项目。`,"trust.skillsNotLoaded":`此项目尚未受信任,项目技能未加载。`,"trust.pluginsNotLoaded":`此项目尚未受信任,项目插件未加载。`,"trust.projectScopeUnavailable":`项目资源未加载时,无法安装到项目范围。`,"i18n.creatingSession":`正在创建新会话…`,"i18n.creating":`创建中…`,"i18n.subscription":`订阅`,"i18n.subscriptions":`订阅服务`,"i18n.customEndpoint":`自定义端点格式`,"i18n.noChanges":`没有更改`,"i18n.branches":`分支`,"i18n.noActiveSession":`没有活动会话`,"i18n.noActiveSessionToCompact":`没有活动会话可压缩`,"i18n.noActiveSessionToReload":`没有活动会话可重新加载`,"i18n.noActiveSessionToName":`没有活动会话可命名`,"i18n.noAssistantMessageToCopy":`没有可复制的助手消息`,"i18n.commandCompleted":`命令已完成`,"i18n.commandFailed":`命令失败`,"i18n.extensionCommandFailed":`扩展命令失败`,"i18n.compactedContext":`上下文已压缩`,"i18n.reloadedSessionResources":`会话资源已重新加载`,"i18n.usageName":`用法:/name <名称>`,"i18n.sessionRenamedTo":`会话已重命名为 {name}`,"i18n.copiedLastAssistantMessage":`已复制最后一条助手消息`,"i18n.failedToRecallQueuedMessages":`恢复排队消息失败`,"i18n.noBranches":`此会话没有分支`,"i18n.source":`源代码`,"i18n.preview":`预览`,"i18n.diff":`Diff`,"i18n.downloadFile":`下载文件`,"i18n.liveSync":`实时同步已启用`,"i18n.notWatching":`未监视`,"i18n.fileViewMode":`文件视图模式`,"i18n.editMode":`编辑模式`,"i18n.viewMode":`查看模式`,"i18n.compareHead":`比较工作区与 HEAD`,"i18n.mentionSelectedLines":`提及所选行`,"i18n.disableWrap":`禁用自动换行`,"i18n.enableWrap":`启用自动换行`,"i18n.editFile":`编辑文件`,"i18n.saveFile":`保存`,"i18n.saveFileShortcut":`保存(Ctrl/Cmd+S)`,"i18n.cancelEdit":`取消`,"i18n.saveFailed":`保存失败:{error}`,"i18n.unsavedChanges":`有未保存的修改`,"i18n.htmlPreview":`HTML 预览`,"i18n.previewFile":`预览 {file}`,"i18n.invalidMermaid":`Mermaid 图表无效`,"i18n.renderingMermaid":`正在渲染 Mermaid 图表`,"i18n.previewAfterStreaming":`流式输出完成后可预览`,"i18n.showMermaidSource":`显示 Mermaid 源码`,"i18n.previewMermaid":`预览 Mermaid 图表`,"i18n.openMermaidViewer":`打开图表查看器`,"i18n.mermaidViewer":`Mermaid 图表查看器`,"i18n.mermaidDiagram":`Mermaid 图表`,"i18n.zoomOut":`缩小`,"i18n.zoomIn":`放大`,"i18n.fitToWidth":`适应宽度`,"models.discoveryFetching":`正在导入模型…`,"models.deleteProviderConfirm":`确定删除 provider「{name}」?该操作会立即写入 models.json,其全部配置(含 API key)将被移除且无法恢复。`,"models.removeModelConfirm":`确定移除模型「{model}」?该操作会立即写入 models.json 且无法恢复。`,"models.discoveryTitle":`导入模型`,"models.discoveryFetch":`导入模型…`,"models.discoveryFilterPlaceholder":`筛选 {count} 个模型…`,"models.discoveryFilter":`筛选上游模型`,"models.discoverySelectShown":`选择当前结果`,"models.discoveryNoMatches":`没有匹配的模型。`,"models.discoveryAdded":`已添加`,"models.discoveryShowing":`显示前 {shown} 个,共 {total} 个`,"models.discoveryFetched":`已获取 {count} 个模型`,"models.discoveryAddSelected":`添加所选模型`,"models.setDefault":`设为默认`,"models.defaultModel":`默认模型`,"models.syncEndpoint":`从端点同步`,"models.lastSyncedAt":`上次同步:{time}`,"models.neverSynced":`未同步过`,"models.discoveryFetchTooltip":`优先从本地缓存导入:{path};无缓存时自动执行一次从端点同步并写入该缓存。`,"models.syncingModels":`同步中…`,"models.syncedModels":`已同步 {count} 个模型`,"models.syncEndpointTooltip":`从 {endpoint} 拉取最新模型列表并缓存到本地;有缓存时优先于内置列表使用。`,"models.syncEndpointTooltipGeneric":`从该供应商的 models 端点拉取最新模型列表并缓存到本地;有缓存时优先于内置列表使用。`,"models.refreshFromCache":`从同步缓存刷新`,"models.refreshing":`刷新中…`,"models.refreshFromCacheTooltip":`重新读取 pi-web/provider/{provider}/models.json,只更新与当前生效定义不同的字段(headers 等手动字段保留)。`,"models.refreshNoDiff":`同步缓存与当前生效定义一致,无需更新。`,"models.refreshDone":`已从同步缓存更新覆写字段。`,"models.refreshTimeout":`刷新超时,请稍后重试。`,"models.builtinProviders":`内置 Provider`,"models.customProviders":`自定义 Provider`,"models.syncSaveFailed":`同步前保存草稿失败,已中止同步。`,"models.visibleInChat":`聊天可见`,"models.visibleModels":`可见模型`,"models.visibleModelsCount":`可见 {visible} / 共 {total}`,"models.selectAll":`全选`,"models.invertSelection":`反选`,"models.searchModels":`搜索模型…`,"models.noVisibleModels":`无模型。`,"models.filterAll":`全部`,"models.filterVisible":`可见`,"models.filterHidden":`隐藏`,"models.invertDisabledTooltip":`所有模型均已可见,反选不会改变任何状态`,"models.openOverride":`编辑覆写`,"models.overrideHint":`当前显示为合并后的有效值(内置定义 + 已保存的覆写)。只有你修改过的字段会作为覆写保存,其余字段继续继承内置定义。`,"models.removeOverride":`移除覆写`,"models.providerNameCollision":`Provider "{provider}" 与内置 "{builtin}"(大小写不敏感)冲突,模型可见性无法生效,请重命名或删除该 provider。`,"models.providerNameCollisionShort":`与内置 provider 撞名`,"models.builtinVisibilityBlocked":`模型可见性已禁用:自定义 provider "{custom}" 与 "{builtin}"(大小写不敏感)冲突,请重命名或删除该自定义 provider。`,"models.discoveryAddSelectedCount":`添加所选模型({count})`,"models.dataSourceLabel":`数据来源:`,"models.catalogSourceEndpoint":`模型端点`,"models.catalogSourceDev":`models.dev 目录`,"models.catalogSourceEndpointTooltip":`数据来源:Provider 的 /models 端点`,"models.catalogSourceDevTooltip":`数据来源:models.dev 内置目录(https://models.dev)`,"models.catalogEndpointNotFound":`模型端点返回中未找到该模型 ID`,"models.catalogOverwriteTitle":`覆盖已有字段?`,"models.catalogOverwriteBody":`以下 {{count}} 个字段已有值,覆盖填入将修改它们:{{fields}}。取消则仅填充空字段。`,"models.catalogOverwriteConfirm":`覆盖并填入`,"models.catalogOverwriteCancel":`仅填空字段`,"models.catalogFilling":`正在填入模型信息…`,"models.catalogFill":`填入模型信息`,"models.catalogFilled":`已填入 {count} 个字段`,"models.catalogNoEmptyFields":`没有需要填入的空字段`,"models.catalogNoExactMatch":`models.dev 中没有精确匹配`,"models.catalogPriceProvider":`价格已匹配 Provider {provider}`,"models.catalogPriceBaseUrl":`价格已按 Base URL 匹配 {provider}`,"models.catalogPriceConsensus":`价格得到 {support}/{total} 条记录支持`,"models.catalogPriceUnreliable":`未找到可靠价格`,"models.catalogUndo":`撤销`,"models.baseUrl":`Base URL`,"models.apiKey":`API 密钥`,"models.api":`API 格式`,"models.modelId":`ID *`,"models.name":`名称`,"models.apiOverride":`API 覆盖`,"models.reasoningThinking":`推理 / 思考`,"models.imageInput":`图片输入`,"models.imageInputHint":`勾选时写入 input: ["text", "image"];取消勾选则移除 input(回落默认 ["text"])。`,"models.nameHint":`留空删除 name 字段(回落使用模型 id)。`,"models.apiOverrideHint":`留空或选默认删除 api 字段(回落使用 provider 默认 api)。`,"models.reasoningHint":`取消勾选删除 reasoning 字段(回落关闭)。`,"models.compatBoolTrueHint":`未勾选不等于 false:pi 将缺失字段视为 true。取消勾选会写入显式 false,才能真正关闭。`,"models.compatBoolHint":`勾选写入 true;取消勾选删除该字段(回落 auto-detect / false 默认)。`,"models.compatSelectHint":`选「默认/none」删除该字段(回落 auto-detect)。`,"models.thinkingLevelMapHint":`每个级别三种状态:Default=删除该级别映射(回落模型默认级别);Disabled=写入 null 禁用;Custom=写入自定义级别字符串。`,"models.compatSection":`兼容性`,"models.compatInheritHint":`模型自身未设置的项显示从 provider 继承的生效值(标注「· 来自 provider」);在模型级设置后将覆盖继承值。`,"models.inheritedFromProvider":`· 来自 provider`,"models.thinkingFormatDeepseekHint":`选中 deepseek 时会额外写入 requiresReasoningContentOnAssistantMessages: true;选中其他值则移除。`,"models.samplingParams":`采样参数`,"models.headers":`请求头`,"models.modelOverrides":`模型覆盖`,"models.supportsDeveloperRole":`支持 developer role`,"models.supportsLongCacheRetention":`支持长缓存保留`,"models.supportsUsageInStreaming":`流式返回 token 用量`,"models.supportsFinishReason":`流式返回 finish_reason`,"models.supportsEagerToolInputStreaming":`工具输入流式预读`,"models.supportsCacheControlOnTools":`工具定义缓存控制`,"models.supportsTemperature":`支持 temperature 参数`,"models.requiresToolResultName":`工具结果需带 name`,"models.requiresAssistantAfterToolResult":`工具结果后需 assistant 消息`,"models.requiresThinkingAsText":`思考块转为文本`,"models.requiresReasoningContentOnAssistantMessages":`assistant 消息需 reasoning_content`,"models.zaiToolStream":`z.ai tool stream`,"models.supportsThinkingTokenBudget":`支持思考 token 预算`,"models.supportsOpenAIGrammarTools":`支持 OpenAI 语法工具`,"models.sendSessionAffinityHeaders":`发送会话亲和请求头`,"models.supportsToolSearch":`支持工具搜索`,"models.supportsExplicitPromptCacheMode":`显式提示缓存模式`,"models.forceAdaptiveThinking":`强制自适应思考`,"models.allowEmptySignature":`允许空思考签名`,"models.supportsStrictTools":`严格工具 schema`,"models.supportsStore":`支持 store 参数`,"models.supportsReasoningEffort":`支持 reasoning_effort`,"models.supportsStrictMode":`严格模式`,"models.supportsToolReferences":`支持工具引用`,"models.maxTokensField":`最大 token 字段`,"models.sessionAffinityFormat":`会话亲和格式`,"models.deferredToolsMode":`延迟工具模式`,"models.cacheControlFormat":`缓存控制格式`,"models.thinkingFormat":`思考格式`,"models.chatTemplateKwargs":`聊天模板 kwargs`,"models.chatTemplateArgs":`聊天模板 args`,"models.openRouterRouting":`OpenRouter 路由`,"models.vercelGatewayRouting":`Vercel 网关路由`,"models.thinkingLevelMap":`思考级别映射`,"models.contextWindow":`上下文窗口(tokens)`,"models.maxOutputTokens":`最大输出 tokens`,"models.costPerMillion":`成本(每百万 tokens)`,"models.apiKeyPlaceholder":`ENV_VAR_NAME、!shell-command 或字面密钥`,"models.apiKeyHint":`以 ! 开头执行 shell 命令,或使用环境变量名`,"models.apiKeyStored":`已保存 API 密钥。在下方输入新密钥即可替换,或断开连接以移除。`,"models.apiKeyPrompt":`输入 {provider} 的 API 密钥以启用 {count} 个模型。`,"models.apiKeyReplacePlaceholder":`输入新密钥以替换…`,"models.oauthAlreadyConnected":`已连接。可重新登录或断开连接。`,"models.oauthConnectPrompt":`连接你的 {provider} 账户。`,"models.enterValue":`输入值…`,"models.displayNamePlaceholder":`显示名称`,"models.connectionLost":`连接已断开`,"models.networkError":`网络错误`,"i18n.testingModel":`正在测试模型连接...`,"i18n.connected":`已连接`,"i18n.failed":`失败`,"i18n.test":`测试`,"i18n.testConnection":`测试模型连接`,"i18n.provider":`Provider`,"i18n.providers":`提供商`,"i18n.model":`模型`,"i18n.providerName":`Provider 名称`,"i18n.rename":`重命名`,"i18n.default":`默认`,"i18n.disabled":`已禁用`,"plugins.statusLoaded":`已加载并生效`,"plugins.statusInstalled":`已安装,尚未加载`,"plugins.statusDisabled":`已禁用`,"plugins.statusMissing":`已配置但包未找到`,"plugins.extensionFilters":`扩展过滤`,"plugins.filterRules":`过滤规则`,"plugins.managePlugins":`插件管理`,"plugins.extensionFiltersHint":`对 ~/.pi/agent/extensions/ 与 .pi/extensions/ 自动发现目录内扩展的过滤规则。仅以 !、+、- 开头的规则生效;纯路径填写无效。`,"plugins.noExtensionFilters":`未配置过滤规则`,"plugins.addFilter":`添加过滤`,"plugins.filterPatternLabel":`规则`,"plugins.filterPlaceholder":`!pattern · +path · -path`,"plugins.filterInvalid":`规则必须以 !、+ 或 - 开头;纯路径在 extensions 字段中无效。`,"plugins.filterPrefixExclude":`排除匹配的扩展`,"plugins.filterPrefixForceInclude":`强制包含精确路径`,"plugins.filterPrefixForceExclude":`强制排除精确路径`,"plugins.filterEffect":`效果`,"plugins.removeFilter":`移除过滤`,"plugins.npmSourcePlaceholder":`npm:@scope/package`,"plugins.packageInstalled":`包已安装。`,"plugins.packageUpdated":`包已更新。`,"plugins.packageRemoved":`包已移除。`,"plugins.packageDisabled":`包已禁用。`,"plugins.packageEnabled":`包已启用。`,"plugins.extensionFilterAdded":`扩展过滤已添加。`,"plugins.extensionFilterRemoved":`扩展过滤已移除。`,"plugins.sessionReloaded":`会话已重载。`,"i18n.noResources":`没有资源`,"i18n.unknown":`未知`,"i18n.installedVersion":`已安装 {version}`,"i18n.configuredVersion":`已配置 {version}`,"i18n.extensions":`扩展`,"i18n.prompts":`提示词`,"i18n.themes":`主题`,"i18n.resourceCount":`{count}{label}`,"i18n.extensionShort":`扩展`,"i18n.versionShort":`版本`,"i18n.skillShort":`技能`,"i18n.promptShort":`提示词`,"i18n.themeShort":`主题`,"i18n.custom":`自定义`,"i18n.clearAll":`清除全部`,"i18n.connectedSuccessfully":`连接成功。`,"i18n.notConnected":`未连接`,"i18n.configured":`已配置`,"i18n.notConfigured":`未配置`,"i18n.openingBrowser":`正在打开浏览器…`,"i18n.submit":`提交`,"i18n.login":`登录`,"i18n.relogin":`重新登录`,"i18n.disconnect":`断开连接`,"i18n.networkError":`网络错误`,"i18n.continuing":`继续中…`,"i18n.skills":`技能`,"i18n.plugins":`插件`,"i18n.addSkill":`添加技能`,"i18n.addPlugin":`添加插件`,"i18n.recommendedPlugins":`推荐插件`,"i18n.selectSkill":`选择技能`,"i18n.selectPackage":`选择包`,"i18n.configBindings":`绑定的配置文件`,"i18n.addBinding":`添加`,"i18n.configFileNote":`备注(可选)`,"i18n.bindConfigFile":`绑定配置文件`,"i18n.selectFile":`选择文件`,"i18n.noConfigBindings":`尚未绑定配置文件`,"i18n.noFiles":`没有文件`,"i18n.allFiles":`全部文件`,"i18n.filterByType":`按类型筛选`,"i18n.removeBinding":`删除绑定`,"i18n.confirm":`确认`,"i18n.updateAvailable":`有可用更新`,"i18n.upToDate":`已是最新`,"i18n.automaticChecksUnavailable":`自动检查不可用`,"i18n.checkFailed":`检查失败`,"i18n.installed":`已安装`,"i18n.status":`状态`,"i18n.version":`版本`,"i18n.package":`包`,"i18n.resources":`资源`,"i18n.installedPath":`安装路径`,"i18n.readme":`README`,"i18n.readmeDetails":`详情`,"i18n.unsafeLinkBlocked":`已阻止不安全链接(仅允许同目录或子目录的相对链接):{href}`,"i18n.resolvedResources":`已解析资源`,"i18n.reloadSession":`重新加载会话`,"i18n.reloading":`重新加载中...`,"i18n.packageRemoved":`包已移除。`,"i18n.packageInstalled":`包已安装。`,"i18n.packageUpdated":`包已更新。`,"i18n.packageDisabled":`包已禁用。`,"i18n.packageEnabled":`包已启用。`,"i18n.sessionReloaded":`会话已重新加载。`,"i18n.thinking":`思考`,"i18n.loadingThinking":`正在加载思考内容...`,"i18n.copyMessage":`复制消息`,"i18n.editFromHere":`从此处编辑`,"i18n.editFromHereTitle":`从此处编辑,此会话内创建分支`,"i18n.newSession":`新会话`,"i18n.newSessionTitle":`新会话,从此处创建独立副本`,"i18n.estimatedTokens":`流式输出期间的估算 Token 数`,"i18n.noOutput":`(无输出)`,"i18n.noSummary":`(无摘要)`,"i18n.conversationCompacted":`会话已压缩`,"i18n.compactionDescription":`此处之前的会话历史已压缩为以下摘要:`,"i18n.fileContext":`文件上下文:{details}`,"i18n.readFiles":`读取的文件`,"i18n.modifiedFiles":`修改的文件`,"i18n.hiddenExtensionMessage":`隐藏的扩展消息`,"i18n.noMessage":`(无消息)`,"i18n.showExtensionMessage":`显示扩展消息`,"i18n.collapse":`收起`,"i18n.expand":`展开`,"i18n.hideDetails":`隐藏详情`,"i18n.showDetails":`显示详情`,"i18n.thinkingUnavailable":`思考内容不可用`,"i18n.thinkingEncrypted":`思考内容已加密(提供方加密,仅用于上下文连续,无法显示明文)`,"i18n.before":`之前`,"i18n.after":`之后`}},y=new Map;function b(e){if(!e.id.trim())throw Error(`Locale id must not be empty`);if(y.has(e.id))throw Error(`Locale already registered: ${e.id}`);y.set(e.id,e)}function x(e){return y.get(e)}function S(){return[...y.keys()]}function C(e){for(let t of e){let e=t.toLowerCase();if(e===`en`||e.startsWith(`en-`))return`en`;if(e===`zh`||e.startsWith(`zh-`))return`zh-CN`}return`en`}b(_),b(v);var w=n((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),T=n(((e,t)=>{t.exports=w()})),E=T(),D=`pi-locale`,O=`en`,k=(0,d.createContext)(null);function A(){return Object.fromEntries(S().flatMap(e=>{let t=x(e);return t?[[e,t.messages]]:[]}))}function j(){try{let e=window.localStorage.getItem(D);if(e===`en`||e===`zh-CN`)return e}catch{}return null}function M({children:e,initialLocale:t=null}){let[n,r]=(0,d.useState)(()=>typeof window>`u`?t??O:j()??t??C(window.navigator.languages.length?window.navigator.languages:[window.navigator.language])),i=(0,d.useMemo)(()=>S().map(e=>x(e)).filter(e=>!!e),[]),a=(0,d.useMemo)(()=>A(),[]),o=(0,d.useCallback)(e=>{if(x(e)){r(e),document.documentElement.lang=e;try{window.localStorage.setItem(D,e)}catch{}fetch(`/api/preferences`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({firstPaint:{locale:e}})}).catch(()=>{})}},[]),s=(0,d.useCallback)((e,t)=>h(n,e,a,t),[n,a]),c=(0,d.useMemo)(()=>({locale:n,setLocale:o,t:s,supportedLocales:i}),[n,o,s,i]);return(0,E.jsx)(k.Provider,{value:c,children:e})}function N(){let e=(0,d.useContext)(k);if(!e)throw Error(`useI18n must be used inside I18nProvider`);return e}var P=`(max-width: 640px)`;function ee(e){if(typeof window>`u`||!window.matchMedia)return()=>{};let t=window.matchMedia(P);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function F(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(P).matches}function te(){return!1}function ne(){return(0,d.useSyncExternalStore)(ee,F,te)}var re=null;function ie(e){re=e}function ae(e){let{onNewSession:t,activeCwd:n}=e;(0,d.useEffect)(()=>{let e=e=>{if(e.key===`Escape`){if(!re)return;let t=e.target?.tagName;if(t===`TEXTAREA`||t===`INPUT`)return;e.preventDefault(),re();return}if(e.key===`n`&&e.ctrlKey&&e.altKey){if(!n||!t)return;e.preventDefault(),t(n)}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n,t])}function oe(){let[e,t]=(0,d.useState)(()=>typeof Notification>`u`?`unsupported`:Notification.permission);return(0,d.useEffect)(()=>{if(typeof Notification>`u`)return;let e=!1,n,r=()=>{e||t(Notification.permission)};return typeof navigator.permissions?.query==`function`&&navigator.permissions.query({name:`notifications`}).then(t=>{e||(n=t,r(),t.addEventListener(`change`,r))}).catch(()=>{}),()=>{e=!0,n?.removeEventListener(`change`,r)}},[]),e}var I=1200,L=320,se=420;function R(e,t,n){return Math.round(Math.max(t,Math.min(Math.max(t,n),Number.isFinite(e)?e:t)))}function ce(e){let{viewportWidth:t,rightPanelOpen:n,rightPanelWidth:r}=e;if(t<=640)return 480;let i=t<960,a=i?L:se,o=!i&&n?r:0;return Math.min(480,t-a-o)}function le(e){let{viewportWidth:t,sidebarOpen:n,sidebarWidth:r}=e;if(t<960)return I;let i=n?r:0;return Math.min(I,t-se-i)}function ue(e){try{let t=window.localStorage.getItem(e);if(t===null)return null;let n=Number.parseInt(t,10);return Number.isFinite(n)?n:null}catch{return null}}function de(e,t){try{window.localStorage.setItem(e,String(t))}catch{}}function fe(e){let{ariaLabel:t,cssVariable:n,defaultWidth:r,getDefaultWidth:i,getMaxWidth:a,growthDirection:o,maxWidth:s,minWidth:c,storageKey:l,widthRef:u}=e,f=(0,d.useRef)(null),p=(0,d.useRef)(null),m=(0,d.useRef)(!1),[h,g]=(0,d.useState)(r),[_,v]=(0,d.useState)(!1),y=(0,d.useCallback)(()=>Math.min(s,Math.max(c,a())),[a,s,c]),b=(0,d.useCallback)(e=>R(e,c,y()),[y,c]),x=(0,d.useCallback)(e=>{u.current=e,f.current?.style.setProperty(n,`${e}px`)},[n,u]),S=(0,d.useCallback)((e,t={})=>{let{forcePersist:n=!1,persist:r=!0}=t,i=b(e),a=i!==u.current;return x(i),g(i),r&&(a||n)&&de(l,i),i},[x,b,l,u]),C=(0,d.useCallback)(e=>{document.body.style.cursor=e.previousCursor,document.body.style.userSelect=e.previousUserSelect},[]),w=(0,d.useCallback)(e=>{let t=p.current;if(!(!t||t.pointerId!==e)){p.current=null,C(t),v(!1),S(u.current,{forcePersist:!0});try{t.target.hasPointerCapture(e)&&t.target.releasePointerCapture(e)}catch{}}},[S,C,u]),T=(0,d.useCallback)(e=>{if(e.pointerType===`mouse`&&e.button!==0)return;e.preventDefault(),e.stopPropagation();let t=p.current;t&&w(t.pointerId);let n=e.currentTarget;n.focus({preventScroll:!0}),n.setPointerCapture(e.pointerId),p.current={pointerId:e.pointerId,startX:e.clientX,startWidth:u.current,target:n,previousCursor:document.body.style.cursor,previousUserSelect:document.body.style.userSelect},document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,v(!0)},[w,u]),E=(0,d.useCallback)(e=>{let t=p.current;if(!t||t.pointerId!==e.pointerId)return;if(e.pointerType===`mouse`&&e.buttons===0){w(e.pointerId);return}e.preventDefault();let n=o===`right`?1:-1,r=b(t.startWidth+(e.clientX-t.startX)*n);x(r),e.currentTarget.setAttribute(`aria-valuenow`,String(r)),e.currentTarget.setAttribute(`aria-valuetext`,`${r} px`)},[x,b,w,o]),D=(0,d.useCallback)(e=>{w(e.pointerId)},[w]),O=(0,d.useCallback)(e=>{w(e.pointerId)},[w]),k=(0,d.useCallback)(e=>{w(e.pointerId)},[w]),A=(0,d.useCallback)(()=>{let e=i?.()??r;S(e,{forcePersist:!0})},[S,r,i]),j=(0,d.useCallback)(()=>{S(u.current)},[S,u]),M=(0,d.useCallback)(e=>{let t=e.shiftKey?32:12,n=o===`right`?`ArrowRight`:`ArrowLeft`,r=o===`right`?`ArrowLeft`:`ArrowRight`;e.key===n?(e.preventDefault(),S(u.current+t,{forcePersist:!0})):e.key===r?(e.preventDefault(),S(u.current-t,{forcePersist:!0})):e.key===`Home`?(e.preventDefault(),S(c,{forcePersist:!0})):e.key===`End`?(e.preventDefault(),S(y(),{forcePersist:!0})):e.key===`Enter`&&(e.preventDefault(),A())},[S,y,o,c,A,u]);return(0,d.useEffect)(()=>{if(m.current)return;m.current=!0;let e=ue(l),t=e??i?.()??r,n=S(t,{persist:!1});e!==null&&e!==n&&de(l,n)},[S,r,i,l]),(0,d.useEffect)(()=>{if(!m.current)return;S(u.current);let e=()=>{S(u.current)};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[S,u]),(0,d.useEffect)(()=>{if(!_)return;let e=()=>{let e=p.current;e&&w(e.pointerId)},t=()=>{document.visibilityState!==`visible`&&e()};return window.addEventListener(`blur`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`blur`,e),document.removeEventListener(`visibilitychange`,t)}},[w,_]),(0,d.useEffect)(()=>()=>{let e=p.current;e&&(p.current=null,C(e))},[C]),{isResizing:_,panelRef:f,reclampWidth:j,resetWidth:A,setWidth:e=>S(e,{forcePersist:!0}),separatorProps:{"aria-label":t,"aria-orientation":`vertical`,"aria-valuemax":y(),"aria-valuemin":c,"aria-valuenow":h,"aria-valuetext":`${h} px`,onDoubleClick:A,onKeyDown:M,onLostPointerCapture:k,onPointerCancel:O,onPointerDown:T,onPointerMove:E,onPointerUp:D,role:`separator`,tabIndex:0},width:h}}function pe(){let e=(0,d.useRef)(null),t=(0,d.useCallback)(()=>{e.current!==null&&(clearTimeout(e.current),e.current=null)},[]),n=(0,d.useCallback)((n,r)=>{t(),e.current=setTimeout(()=>{e.current=null,n()},r)},[t]);return(0,d.useEffect)(()=>()=>t(),[t]),(0,d.useMemo)(()=>({schedule:n,cancel:t}),[n,t])}var me=(0,d.createContext)(null);function he({value:e,children:t}){return(0,E.jsx)(me.Provider,{value:e,children:t})}function ge(){let e=(0,d.useContext)(me);if(!e)throw Error(`useSettings must be used within SettingsProvider`);return e}function _e(e){let{fetcher:t,ttlMs:n=6e4}=e,r=null,i=null,a=0,o=null,s=new Set,c=()=>{for(let e of[...s])try{e()}catch{}},l=async e=>{try{let o=await t(e);return r=o,i=null,a=Date.now()+n,o}catch(e){throw i=e instanceof Error?e.message:String(e),e}finally{o=null}},u=e=>(o||=l(e).then(e=>(c(),e)),o),d=(e,t)=>new Promise((n,r)=>{if(e.aborted){r(new DOMException(`Aborted`,`AbortError`));return}let i=()=>r(new DOMException(`Aborted`,`AbortError`));e.addEventListener(`abort`,i,{once:!0}),t.then(n,r).finally(()=>e.removeEventListener(`abort`,i))});return{get:()=>r,getError:()=>i,load:e=>{if(r!==null&&Date.now()<a)return Promise.resolve(r);let t=u(!1);return e?d(e,t):t},refresh:e=>{a=0;let t=u(!0);return e?d(e,t):t},subscribe:e=>(s.add(e),()=>s.delete(e)),clear:()=>{r=null,i=null,a=0}}}async function ve(e,t){let n=await fetch(e,t);if(!n.ok)throw Error(`HTTP ${n.status}`);return await n.json()}function ye(){return`/api/sessions`}var be=_e({fetcher:()=>ve(`/api/models`)}),xe=_e({fetcher:()=>ve(ye(),{cache:`no-store`})}),Se=_e({fetcher:()=>ve(`/api/preferences`)}),Ce=_e({fetcher:()=>ve(`/api/models-config`)}),we=_e({fetcher:()=>ve(`/api/plugins/global`)}),Te=_e({fetcher:e=>ve(`/api/skills/global`,e?{cache:`no-store`}:void 0)}),Ee=_e({fetcher:()=>ve(`/api/model-thinking`)}),De=_e({fetcher:async()=>{let[e,t]=await Promise.all([ve(`/api/auth/providers`),ve(`/api/auth/all-providers`)]);return{oauth:e.providers,apiKey:t.providers}}}),Oe=e=>window.history.replaceState(null,``,e);function ke({initialNavigation:e,onProjectSwitch:t,onSessionSelected:n,onTopPanelReset:r}){let[i,a]=(0,d.useState)(null),[o,s]=(0,d.useState)(null),[c,l]=(0,d.useState)(()=>e.requestedCwd?`validating`:`idle`),[u,f]=(0,d.useState)(null),[p,m]=(0,d.useState)(0),[h,g]=(0,d.useState)(0),[_,v]=(0,d.useState)(0),[y,b]=(0,d.useState)(0),[x,S]=(0,d.useState)(()=>!e.sessionId),[C,w]=(0,d.useState)(null),T=(0,d.useRef)(null),E=(0,d.useRef)(!1),D=(0,d.useRef)(!1),[O,k]=(0,d.useState)(null),[A,j]=(0,d.useState)(!1),[M,N]=(0,d.useState)(!1),[P,ee]=(0,d.useState)(null);(0,d.useEffect)(()=>{let t=e.requestedCwd;if(!t)return;let n=new AbortController;return l(`validating`),f(null),fetch(`/api/cwd/validate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:t}),signal:n.signal}).then(async e=>{let t=await e.json().catch(()=>({}));if(!e.ok||!t.cwd)throw Error(t.error??`HTTP ${e.status}`);E.current=!0,s(t.cwd),l(`ready`)}).catch(e=>{n.signal.aborted||(f(e instanceof Error?e.message:String(e)),l(`error`))}),()=>n.abort()},[e]);let F=o??(i===null&&C?C:null),te=i!==null||F!==null,ne=i?.cwd??F;(0,d.useEffect)(()=>{if(k(null),j(!1),ee(null),!ne)return;let e=new AbortController,t=new URLSearchParams(window.location.search).get(`piE2eTrustCwd`);return fetch(`/api/project-trust?cwd=${encodeURIComponent(ne)}${t?`&piE2eTrustCwd=${encodeURIComponent(t)}`:``}`,{signal:e.signal}).then(async e=>{let t=await e.json();if(!e.ok||t.error)throw Error(t.error??`HTTP ${e.status}`);k(t)}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||console.error(`Failed to load project trust:`,e)}),()=>e.abort()},[ne]);let re=(0,d.useCallback)(e=>{xe.load().then(t=>{let n=t.sessions.find(t=>t.id===e);n&&a(t=>t&&t.id===e&&!t.projectRoot?n:t)}).catch(()=>{})},[]),ie=(0,d.useCallback)((e,t=!1)=>{!t&&D.current||(s(null),a(e),g(e=>e+1),S(!0),t&&(E.current=!0),t||Oe(`?session=${encodeURIComponent(e.id)}`),n?.(t))},[n]),ae=(0,d.useCallback)(async(e,t)=>{await fetch(`/api/cwd/validate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:t})}).catch(()=>{}),a(null),s(t),g(e=>e+1),r?.(),n?.(!1),Oe(`/`)},[n,r]),oe=(0,d.useCallback)(e=>{s(null),a(e),m(e=>e+1),re(e.id),Oe(`?session=${encodeURIComponent(e.id)}`)},[re]),I=(0,d.useCallback)(()=>{m(e=>e+1),v(e=>e+1)},[]),L=(0,d.useCallback)((e,t)=>{a(n=>n&&n.id===e?{...n,name:t}:n),m(e=>e+1)},[]),se=(0,d.useCallback)(()=>{v(e=>e+1)},[]),R=(0,d.useCallback)(()=>{S(!0)},[]);return{selectedSession:i,setSelectedSession:a,newSessionCwd:o,effectiveNewSessionCwd:F,showChat:te,projectTrustCwd:ne,refreshKey:p,setRefreshKey:m,explorerRefreshKey:_,setExplorerRefreshKey:v,modelsRefreshKey:y,setModelsRefreshKey:b,sessionKey:h,activeCwd:C,initialCwdStatus:c,initialCwdError:u,initialSessionRestored:x,projectTrust:O,projectTrustDialogOpen:A,setProjectTrustDialogOpen:j,projectTrustBusy:M,projectTrustError:P,setProjectTrustError:ee,extensionDialogActiveRef:D,handleSelectSession:ie,handleNewSession:ae,handleSessionCreated:oe,handleAgentEnd:I,handleSessionRenamed:L,handleSessionForked:(0,d.useCallback)(e=>{m(e=>e+1),g(e=>e+1),s(null),a(t=>({...t??{path:``,cwd:``,created:``,modified:``,messageCount:0,firstMessage:``},id:e})),re(e),Oe(`?session=${encodeURIComponent(e)}`)},[re]),handleSessionDeleted:(0,d.useCallback)(e=>{if(m(e=>e+1),i?.id===e){let e=i.cwd;a(null),s(e??null),g(e=>e+1),r?.(),Oe(`/`)}},[i,r]),handleSessionUnseen:(0,d.useCallback)(e=>{i?.id===e&&(a(null),g(e=>e+1),r?.(),Oe(`/`))},[i,r]),handleCwdChange:(0,d.useCallback)((e,n)=>{if(w(e),!e)return;let r=n??e,o=T.current??(i?i.projectRoot??i.cwd:null);if(!o){T.current=r;return}if(T.current=r,E.current){E.current=!1;return}o!==r&&(i?i.projectRoot??i.cwd:null)!==r&&(a(null),s(t=>t&&t!==e?null:t),g(e=>e+1),t?.())},[i,t]),handleTrustProject:(0,d.useCallback)(async()=>{if(!(!ne||M)){N(!0),ee(null);try{let e=await fetch(`/api/project-trust`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:ne})}),t=await e.json();if(!e.ok||t.error)throw Error(t.error??`HTTP ${e.status}`);k(t),j(!1),b(e=>e+1),g(e=>e+1)}catch(e){ee(e instanceof Error?e.message:String(e))}finally{N(!1)}}},[M,ne]),handleExplorerRefresh:se,handleInitialRestoreDone:R}}var Ae=(0,d.createContext)(null);function je({value:e,children:t}){return(0,E.jsx)(Ae.Provider,{value:e,children:t})}function Me(){let e=(0,d.useContext)(Ae);if(!e)throw Error(`useTopPanel must be used within TopPanelProvider`);return e}var Ne=`pi-web-auto-reload-seconds`,Pe=3600;function Fe(e){let t=e.trim();if(t===``)return null;let n=Number(t);return!Number.isInteger(n)||n<0||n>3600?null:n}function Ie(){if(typeof window>`u`)return 0;let e=window.localStorage.getItem(Ne);if(e===null)return 0;let t=Fe(e);return t===null?0:t}var Le=1e3,Re=`pi-web-scroll-step-px`;function ze(e){let t=e.trim();if(t===``)return null;let n=Number(t);return!Number.isFinite(n)||!Number.isInteger(n)||n<1||n>1e3?null:n}function Be(){if(typeof window>`u`)return 200;try{return ze(window.localStorage.getItem(`pi-web-scroll-step-px`)??``)??200}catch{return 200}}var Ve=1e4,He=`pi-web-long-block-collapse-chars`;function Ue(e){let t=e.trim();if(t===``)return null;let n=Number(t);return!Number.isFinite(n)||!Number.isInteger(n)||n<20||n>1e4?null:n}function We(){if(typeof window>`u`)return 200;try{return Ue(window.localStorage.getItem(`pi-web-long-block-collapse-chars`)??``)??200}catch{return 200}}var Ge=`pi-web-long-block-recent-expanded`;function Ke(e){let t=e.trim();if(t===``)return null;let n=Number(t);return!Number.isFinite(n)||!Number.isInteger(n)||n<0||n>20?null:n}function qe(){if(typeof window>`u`)return 0;try{return Ke(window.localStorage.getItem(`pi-web-long-block-recent-expanded`)??``)??0}catch{return 0}}function Je(e,t,n,r){return e===`toolCall`?`tool:${n}`:`thinking:${t}:${r}`}var Ye=`pi-web-notify-events`,Xe={taskComplete:!0,errors:!0,questions:!0,notifyWhileActive:!1};function Ze(){if(typeof window>`u`)return Xe;try{let e=window.localStorage.getItem(Ye);if(!e)return Xe;let t=JSON.parse(e);return{taskComplete:t.taskComplete??Xe.taskComplete,errors:t.errors??Xe.errors,questions:t.questions??Xe.questions,notifyWhileActive:t.notifyWhileActive??Xe.notifyWhileActive}}catch{return Xe}}function Qe(e){window.localStorage.setItem(Ye,JSON.stringify(e))}function $e(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t={};for(let[n,r]of Object.entries(e)){if(typeof n!=`string`||n===``||typeof r!=`object`||!r)continue;let{x:e,y:i,width:a,height:o,collapsed:s}=r;typeof e!=`number`||!Number.isFinite(e)||typeof i!=`number`||!Number.isFinite(i)||typeof a!=`number`||!Number.isFinite(a)||a<=0||typeof o!=`number`||!Number.isFinite(o)||o<=0||(t[n]={x:e,y:i,width:a,height:o,collapsed:typeof s==`boolean`?s:void 0})}return t}var et=[{label:`阅读项目`,message:`阅读当前项目,总结整体目录结构与核心模块的职责。`},{label:`review工作区改动`,message:`review 当前工作区的所有改动,指出潜在问题与改进点。`},{label:`寻找并修复bug`,message:`检查当前代码,寻找并修复其中存在的 bug。`}];function tt(e){if(!Array.isArray(e))return null;let t=[];for(let n of e){if(typeof n!=`object`||!n)continue;let{label:e,message:r,allowAppend:i}=n;if(typeof e!=`string`||e.trim()===``||typeof r!=`string`||r.trim()===``)continue;let a={label:e.trim(),message:r.trim()};i===!0&&(a.allowAppend=!0),t.push(a)}return t}function nt(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t={};for(let[n,r]of Object.entries(e)){if(typeof n!=`string`||n===``)continue;let e=tt(r);e&&e.length>0&&(t[n]=e)}return t}var rt=`pluginConfigBindings`;function it(){if(typeof window>`u`)return{};try{let e=window.localStorage.getItem(rt);if(!e)return{};let t=JSON.parse(e);if(t&&typeof t==`object`)return t}catch{}return{}}function at(){return`/api/preferences`}function ot(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}var st=new Map,ct=2e3;function lt(e){let t=JSON.stringify(e),n=Date.now(),r=st.get(t);r!==void 0&&n-r<ct||(st.set(t,n),fetch(at(),{method:`PUT`,headers:{"Content-Type":`application/json`},body:t}).catch(()=>{}).finally(()=>{Se.refresh().catch(()=>{})}))}var ut={defaultModel:``,defaultThinking:``},dt=`pi-web-font-scale`,ft=1,pt=19.2;function mt({isDark:e,toggleTheme:t}){let[n,r]=(0,d.useState)(()=>{if(typeof window>`u`)return ft;let e=window.localStorage.getItem(dt),t=e===null?NaN:Number(e);return Number.isFinite(t)&&t>=.85&&t<=1.3?t:ft}),[i,a]=(0,d.useState)(()=>Be()),[o,s]=(0,d.useState)(()=>Ie()),[c,l]=(0,d.useState)(()=>We()),[u,f]=(0,d.useState)(()=>qe()),[p,m]=(0,d.useState)(()=>Ze());(0,d.useEffect)(()=>{Qe(p),lt({preferences:{notifyEvents:p}})},[p]);let[h,g]=(0,d.useState)(()=>$e(Se.get()?.preferences?.widgets)??{}),_=(0,d.useRef)(!1);(0,d.useEffect)(()=>{let e=!1;return Se.load().then(()=>{if(e)return;_.current=!0;let t=Se.get()?.preferences;g($e(t?.widgets)??{}),b(nt(t?.widgetMessages)??{}),T(ot(t?.workspaces))}).catch(()=>{_.current=!0}),()=>{e=!0}},[]);let v=(0,d.useCallback)((e,t)=>{g(n=>{let r=n[e];return r&&r.x===t.x&&r.y===t.y&&r.width===t.width&&r.height===t.height&&r.collapsed===t.collapsed?n:{...n,[e]:t}})},[]);(0,d.useEffect)(()=>{_.current&&lt({preferences:{widgets:h}})},[h]);let[y,b]=(0,d.useState)(()=>nt(Se.get()?.preferences?.widgetMessages)??{}),x=(0,d.useCallback)((e,t)=>{if((y[e]??[]).some(e=>e.label===t.label))throw Error(`Name conflict: "${t.label}"`);b(n=>({...n,[e]:[...n[e]??[],t]}))},[y]),S=(0,d.useCallback)((e,t)=>{b(n=>{let r=n[e];if(!r||t<0||t>=r.length)return n;let i={...n},a=r.filter((e,n)=>n!==t);return a.length===0?delete i[e]:i[e]=a,i})},[]),C=(0,d.useCallback)((e,t,n)=>{if((y[e]??[]).some((e,r)=>r!==t&&e.label===n.label))throw Error(`Name conflict: "${n.label}"`);b(r=>{let i=r[e];if(!i||t<0||t>=i.length)return r;let a={...r},o=[...i];return o[t]=n,a[e]=o,a})},[y]);(0,d.useEffect)(()=>{_.current&&lt({preferences:{widgetMessages:y}})},[y]);let[w,T]=(0,d.useState)(()=>ot(Se.get()?.preferences?.workspaces)),E=(0,d.useCallback)(e=>{T(e),lt({preferences:{workspaces:e}})},[]),[D,O]=(0,d.useState)(()=>Se.get()?.preferences?.startScreenMessages??et),k=(0,d.useCallback)(e=>{if(D.some(t=>t.label===e.label))throw Error(`Name conflict: "${e.label}"`);O(t=>[...t,e])},[D]),A=(0,d.useCallback)(e=>{O(t=>e<0||e>=t.length?t:t.filter((t,n)=>n!==e))},[]),j=(0,d.useCallback)((e,t)=>{if(D.some((n,r)=>r!==e&&n.label===t.label))throw Error(`Name conflict: "${t.label}"`);O(n=>{if(e<0||e>=n.length)return n;let r=[...n];return r[e]=t,r})},[D]),M=(0,d.useCallback)(()=>{O(e=>{let t=new Set(et.map(e=>e.label)),n=e.filter(e=>!t.has(e.label));return[...et,...n]})},[]);(0,d.useEffect)(()=>Se.subscribe(()=>O(Se.get()?.preferences?.startScreenMessages??et)),[]),(0,d.useEffect)(()=>{lt({preferences:{startScreenMessages:D}})},[D]);let[N,P]=(0,d.useState)(()=>it()),ee=(0,d.useCallback)((e,t)=>{P(n=>{let r=n[e]??[];return r.some(e=>e.path===t.path)?n:{...n,[e]:[...r,t]}})},[]),F=(0,d.useCallback)((e,t)=>{P(n=>{let r=n[e];if(!r)return n;let i=r.filter(e=>e.path!==t),a={...n};return i.length===0?delete a[e]:a[e]=i,a})},[]);(0,d.useEffect)(()=>{try{window.localStorage.setItem(rt,JSON.stringify(N))}catch{}lt({preferences:{pluginConfigBindings:N}})},[N]);let[te,ne]=(0,d.useState)(()=>Se.get()?.defaultThinkingLevel??``);(0,d.useEffect)(()=>Se.subscribe(()=>ne(Se.get()?.defaultThinkingLevel??``)),[]),(0,d.useEffect)(()=>{te&&lt({firstPaint:{defaultThinkingLevel:te}})},[te]);let re=(0,d.useSyncExternalStore)(Se.subscribe,()=>Se.get()?.compaction??null),ie=(0,d.useMemo)(()=>JSON.stringify(re),[re]);(0,d.useEffect)(()=>{ie&&lt({firstPaint:{compaction:Se.get()?.compaction??null}})},[ie]);let ae=(0,d.useSyncExternalStore)(Se.subscribe,()=>Se.get()?.retry??null),oe=(0,d.useMemo)(()=>JSON.stringify(ae),[ae]);(0,d.useEffect)(()=>{oe&&lt({firstPaint:{retry:Se.get()?.retry??null}})},[oe]);let[I,L]=(0,d.useState)(()=>Se.get()?.defaultProjectTrust??``);(0,d.useEffect)(()=>Se.subscribe(()=>L(Se.get()?.defaultProjectTrust??``)),[]),(0,d.useEffect)(()=>{I&&lt({firstPaint:{defaultProjectTrust:I}})},[I]);let se=(0,d.useSyncExternalStore)(Se.subscribe,()=>Se.get()?.subagents??ut),R=(0,d.useMemo)(()=>({defaultModel:se.defaultModel??``,defaultThinking:se.defaultThinking??``}),[se]);return(0,d.useEffect)(()=>{!R.defaultModel&&!R.defaultThinking||lt({firstPaint:{subagents:{defaultModel:R.defaultModel||void 0,defaultThinking:R.defaultThinking||void 0}}})},[R]),(0,d.useEffect)(()=>{try{window.localStorage.setItem(Ne,String(o))}catch{}lt({preferences:{autoReloadSeconds:o}})},[o]),(0,d.useEffect)(()=>{try{window.localStorage.setItem(Re,String(i))}catch{}lt({preferences:{minimapScrollStepPx:i}})},[i]),(0,d.useEffect)(()=>{try{window.localStorage.setItem(He,String(c))}catch{}lt({preferences:{longBlockCollapseChars:c}})},[c]),(0,d.useEffect)(()=>{try{window.localStorage.setItem(Ge,String(u))}catch{}lt({preferences:{recentBlocksExpanded:u}})},[u]),(0,d.useEffect)(()=>{document.documentElement.style.fontSize=`${n*pt}px`;try{window.localStorage.setItem(dt,String(n))}catch{}lt({firstPaint:{fontScale:n}})},[n]),(0,d.useEffect)(()=>{Se.load().catch(()=>{})},[]),{settingsValue:(0,d.useMemo)(()=>({isDark:e,toggleTheme:t,fontScale:n,setFontScale:r,scrollStepPx:i,setScrollStepPx:a,autoReloadSeconds:o,setAutoReloadSeconds:s,longBlockCollapseChars:c,setLongBlockCollapseChars:l,recentBlocksExpanded:u,setRecentBlocksExpanded:f,notifyEvents:p,setNotifyEvents:m,widgetGeometries:h,setWidgetGeometry:v,widgetMessages:y,addWidgetMessage:x,removeWidgetMessage:S,updateWidgetMessage:C,startScreenMessages:D,addStartScreenMessage:k,removeStartScreenMessage:A,updateStartScreenMessage:j,resetStartScreenMessages:M,pluginConfigBindings:N,addPluginConfigBinding:ee,removePluginConfigBinding:F}),[e,t,n,i,o,c,u,p,h,v,y,x,S,C,D,k,A,j,M,N,ee,F]),defaultThinkingLevel:te,setDefaultThinkingLevel:ne,compaction:re,retry:ae,defaultProjectTrust:I,setDefaultProjectTrust:L,subagents:R,savedWorkspaces:w,handleSavedWorkspacesChange:E,widgetGeometries:h,setWidgetGeometry:v,widgetMessages:y,addWidgetMessage:x,removeWidgetMessage:S,updateWidgetMessage:C,fontScale:n,setFontScale:r}}function ht(e){if(!Number.isFinite(e))return``;let t=Math.round(e),n=Math.floor(t/60),r=t%60;return`${n}:${String(r).padStart(2,`0`)}`}var gt=new Map,_t=new Map,vt=3e4,yt=75e3,bt=1e3,xt=15e3,St=1,Ct=3,wt=null,Tt=0,Et=0,Dt=bt;function Ot(e){return e.ch===`agent`?`agent:${e.sessionId??``}`:e.ch===`watch`?`watch:${e.filePath??``}`:e.ch}function kt(){return`${location.protocol===`https:`?`wss://`:`ws://`}${location.host}/api/ws`}function At(e,t){e.send(JSON.stringify({type:`sub`,...t}))}function jt(){wt&&wt.close();let e=++Et,t;try{t=new WebSocket(kt())}catch{Mt(e);return}wt=t,t.onopen=()=>{Dt=bt,Tt=Date.now();for(let e of _t.values())try{At(t,e)}catch{break}},t.onmessage=n=>{if(e!==Et||wt!==t||(Tt=Date.now(),typeof n.data!=`string`))return;let r;try{r=JSON.parse(n.data)}catch{return}if(r.ch)for(let e of gt.get(r.ch)??[])e(r.data)},t.onclose=()=>{e===Et&&wt===t&&(wt=null,Mt(e))},t.onerror=()=>{}}function Mt(e){setTimeout(()=>{e!==Et||wt||jt()},Dt),Dt=Math.min(Dt*2,xt)}function Nt(){if(!wt||wt.readyState!==St||Date.now()-Tt<=yt)return;Et+=1;let e=wt;wt=null;try{e.close()}catch{}jt()}typeof window<`u`&&(setInterval(Nt,vt),window.addEventListener(`online`,()=>{!wt||wt.readyState===Ct?jt():Nt()}),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&(!wt||wt.readyState===Ct?jt():Nt())}));function Pt(e){if(e&&wt?.readyState===St)try{wt.send(JSON.stringify({type:`unseen`,sessionId:e}))}catch{}}function Ft(e,t){let n=Ot(e),r=gt.get(n);r||(r=new Set,gt.set(n,r)),r.add(t);let i=!_t.has(n);if(_t.set(n,e),wt?.readyState===St&&i)try{At(wt,e)}catch{}else wt||jt();return()=>{let e=gt.get(n);if(e?.delete(t),e&&e.size===0&&(gt.delete(n),_t.delete(n),wt?.readyState===St))try{wt.send(JSON.stringify({type:`unsub`,ch:n}))}catch{}}}var It={runningSessionIds:[],runningPhases:{},runningPhaseSince:{},runningBusySince:{}},Lt=null,Rt={current:!1},zt=new Set;function Bt(){Lt=null;for(let e of zt)e()}function Vt(){return Lt||={runningSessionIds:new Set(It.runningSessionIds),runningPhases:It.runningPhases,runningPhaseSince:It.runningPhaseSince,runningBusySince:It.runningBusySince,setRunningSessionIds:Ht,runningPollAuthoritativeRef:Rt},Lt}function Ht(e){Rt.current||(It={...It,runningSessionIds:[...e]},Bt())}function Ut(e){return zt.add(e),Gt(),()=>zt.delete(e)}var Wt=null;function Gt(){Wt||=Ft({ch:`running`},e=>{if(e.type!==`running`)return;let t=e;It={runningSessionIds:t.runningSessionIds??[],runningPhases:t.phases??{},runningPhaseSince:t.phaseSince??{},runningBusySince:t.busySince??{}},Rt.current=!0,Bt()})}function Kt(){return(0,d.useSyncExternalStore)(Ut,Vt)}function qt(e,t){let[n,r]=(0,d.useState)(null);return(0,d.useEffect)(()=>{if(!e||t===void 0){r(null);return}let n=()=>{document.hidden||r(ht((Date.now()-t)/1e3))};n();let i=setInterval(n,1e3),a=()=>{document.hidden||n()};return document.addEventListener(`visibilitychange`,a),()=>{clearInterval(i),document.removeEventListener(`visibilitychange`,a)}},[e,t]),n}var Jt=new Map,Yt=5e3;function Xt({title:e,body:t,tag:n,notifyWhileActive:r=!1}){if(!(typeof Notification>`u`)&&!(document.hasFocus()&&document.visibilityState===`visible`&&!r)){if(Notification.permission!==`granted`){console.warn(`[notify] skip: permission=${Notification.permission}`);return}try{let r;if(n){let e=Date.now(),t=Jt.get(n);if(t!==void 0&&e-t<Yt)return;Jt.set(n,e),r=`${n}-${e}`}new Notification(e,t?{body:t,tag:r}:{tag:r}),console.info(`[notify] dispatched: ${e}`)}catch(e){console.warn(`[notify] construction failed:`,e)}}}function Zt(){typeof Notification>`u`||Notification.requestPermission()}function Qt(){if(typeof Notification>`u`||Notification.permission!=="default")return;let e=()=>{Zt(),window.removeEventListener(`pointerdown`,e),window.removeEventListener(`keydown`,e)};window.addEventListener(`pointerdown`,e),window.addEventListener(`keydown`,e)}var $t=3e3,en=6e4;function tn(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 nn(e,t){return e.filter(e=>!t.has(e))}function rn(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 an(){let{t:e}=N(),{notifyEvents:t}=ge(),[n,r]=(0,d.useState)([]),i=(0,d.useRef)([]);i.current=n;let a=(0,d.useRef)(t);a.current=t;let o=(0,d.useRef)(e);o.current=e;let{runningSessionIds:s}=Kt(),c=(0,d.useRef)(!1),l=(0,d.useRef)([]),u=(0,d.useRef)(new Map);(0,d.useEffect)(()=>{if(!a.current.taskComplete)return;let e=c.current?l.current:null;if(l.current=[...s],c.current=!0,!e)return;let t=nn(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<$t||(i.current.some(t=>t.id===e)||p.current(),console.info(`[notify] completion via running-snapshot (${e})`),Xt({title:o.current(`chat.taskCompleteNotificationTitle`),body:o.current(`chat.sessionCompletedNotificationBody`,{name:tn(i.current.find(t=>t.id===e),e)}),tag:`session-complete-${e}`,notifyWhileActive:a.current.notifyWhileActive}))}},[s]);let f=(0,d.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{}},[]),p=(0,d.useRef)(f);return p.current=f,(0,d.useEffect)(()=>{f();let e=setInterval(()=>void f(),en);return()=>clearInterval(e)},[f]),(0,d.useEffect)(()=>Ft({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)||p.current();let r=rn(t,tn(i.current.find(e=>e.id===n),n),a.current,o.current);r&&(console.info(`[agent-events] notifying: ${r.title}`),Xt({...r,notifyWhileActive:a.current.notifyWhileActive}))}),[]),null}var on=`var(--text-dim)`;function sn({size:e=14,open:t=!1}){return t?(0,E.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:`none`,children:[(0,E.jsx)(`path`,{d:`M1 4.5A1 1 0 0 1 2 3.5H5.5L7 5h7.5v1H1V4.5Z`,fill:on}),(0,E.jsx)(`path`,{d:`M1 6h14.5L14 13H2L1 6Z`,stroke:on,strokeWidth:`1`,fill:on,fillOpacity:`0.12`})]}):(0,E.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:`none`,children:(0,E.jsx)(`path`,{d:`M1 4.5A1 1 0 0 1 2 3.5H5.5L7 5H14a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V4.5Z`,stroke:on,strokeWidth:`1`,fill:on,fillOpacity:`0.1`})})}function cn({size:e=14}){return(0,E.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:`none`,children:[(0,E.jsx)(`path`,{d:`M3 2h7l3 3v9H3V2Z`,stroke:on,strokeWidth:`1`,fill:on,fillOpacity:`0.08`}),(0,E.jsx)(`path`,{d:`M10 2v3h3`,stroke:on,strokeWidth:`1`,fill:`none`,strokeLinejoin:`round`})]})}function ln({label:e,size:t=14}){let n=t/14;return(0,E.jsxs)(`svg`,{width:t,height:t,viewBox:`0 0 14 14`,fill:`none`,children:[(0,E.jsx)(`path`,{d:`M2.5 1h6l3 3v9h-9V1Z`,stroke:on,strokeWidth:`0.9`,fill:on,fillOpacity:`0.07`,strokeLinejoin:`round`}),(0,E.jsx)(`path`,{d:`M8.5 1v3h3`,stroke:on,strokeWidth:`0.9`,fill:`none`,strokeLinejoin:`round`}),(0,E.jsx)(`text`,{x:`7`,y:`9.5`,textAnchor:`middle`,fontSize:3.4*n,fontFamily:`var(--font-mono), monospace`,fontWeight:`600`,fill:on,letterSpacing:`0`,children:e})]})}function un({size:e=14}){return(0,E.jsx)(ln,{label:`TS`,size:e})}function dn({size:e=14}){return(0,E.jsx)(ln,{label:`TSX`,size:e})}function fn({size:e=14}){return(0,E.jsx)(ln,{label:`JS`,size:e})}function pn({size:e=14}){return(0,E.jsx)(ln,{label:`JSX`,size:e})}function mn({size:e=14}){return(0,E.jsx)(ln,{label:`PY`,size:e})}function hn({size:e=14}){return(0,E.jsx)(ln,{label:`{}`,size:e})}function gn({size:e=14}){return(0,E.jsx)(ln,{label:`CSS`,size:e})}function _n({size:e=14}){return(0,E.jsx)(ln,{label:`SC`,size:e})}function vn({size:e=14}){return(0,E.jsx)(ln,{label:`HTM`,size:e})}function yn({size:e=14}){return(0,E.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 14 14`,fill:`none`,children:[(0,E.jsx)(`path`,{d:`M2.5 1h6l3 3v9h-9V1Z`,stroke:on,strokeWidth:`0.9`,fill:on,fillOpacity:`0.07`,strokeLinejoin:`round`}),(0,E.jsx)(`path`,{d:`M8.5 1v3h3`,stroke:on,strokeWidth:`0.9`,fill:`none`,strokeLinejoin:`round`}),(0,E.jsx)(`path`,{d:`M3.5 9.5V7l1.5 1.5L6.5 7v2.5`,stroke:on,strokeWidth:`0.9`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`}),(0,E.jsx)(`path`,{d:`M8 7v2.5M7 9l1 1.5 1-1.5`,stroke:on,strokeWidth:`0.9`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`})]})}function bn({size:e=14}){return(0,E.jsx)(ln,{label:`YML`,size:e})}function xn({size:e=14}){return(0,E.jsx)(ln,{label:`TOM`,size:e})}function Sn({size:e=14}){return(0,E.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 14 14`,fill:`none`,children:[(0,E.jsx)(`path`,{d:`M2.5 1h6l3 3v9h-9V1Z`,stroke:on,strokeWidth:`0.9`,fill:on,fillOpacity:`0.07`,strokeLinejoin:`round`}),(0,E.jsx)(`path`,{d:`M8.5 1v3h3`,stroke:on,strokeWidth:`0.9`,fill:`none`,strokeLinejoin:`round`}),(0,E.jsx)(`path`,{d:`M4 7.5l2 1.5-2 1.5`,stroke:on,strokeWidth:`0.95`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`}),(0,E.jsx)(`path`,{d:`M7.5 10.5h2.5`,stroke:on,strokeWidth:`0.95`,strokeLinecap:`round`})]})}function Cn({size:e=14}){return(0,E.jsx)(ln,{label:`RS`,size:e})}function wn({size:e=14}){return(0,E.jsx)(ln,{label:`GO`,size:e})}function Tn({size:e=14}){return(0,E.jsx)(ln,{label:`SQL`,size:e})}function En({size:e=14}){return(0,E.jsx)(ln,{label:`GQL`,size:e})}function Dn({size:e=14}){return(0,E.jsx)(ln,{label:`TF`,size:e})}function On({size:e=14}){return(0,E.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 14 14`,fill:`none`,children:[(0,E.jsx)(`path`,{d:`M2.5 1h6l3 3v9h-9V1Z`,stroke:on,strokeWidth:`0.9`,fill:on,fillOpacity:`0.07`,strokeLinejoin:`round`}),(0,E.jsx)(`path`,{d:`M8.5 1v3h3`,stroke:on,strokeWidth:`0.9`,fill:`none`,strokeLinejoin:`round`}),(0,E.jsx)(`rect`,{x:`3.5`,y:`6.5`,width:`2`,height:`1.5`,rx:`0.3`,stroke:on,strokeWidth:`0.8`}),(0,E.jsx)(`rect`,{x:`6`,y:`6.5`,width:`2`,height:`1.5`,rx:`0.3`,stroke:on,strokeWidth:`0.8`}),(0,E.jsx)(`rect`,{x:`3.5`,y:`8.5`,width:`2`,height:`1.5`,rx:`0.3`,stroke:on,strokeWidth:`0.8`})]})}function kn({size:e=14}){return(0,E.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 14 14`,fill:`none`,children:[(0,E.jsx)(`path`,{d:`M2.5 1h6l3 3v9h-9V1Z`,stroke:on,strokeWidth:`0.9`,fill:on,fillOpacity:`0.07`,strokeLinejoin:`round`}),(0,E.jsx)(`path`,{d:`M8.5 1v3h3`,stroke:on,strokeWidth:`0.9`,fill:`none`,strokeLinejoin:`round`}),(0,E.jsx)(`circle`,{cx:`5.5`,cy:`8.5`,r:`1.5`,stroke:on,strokeWidth:`0.9`}),(0,E.jsx)(`path`,{d:`M7 8.5h2.5M8.5 8.5v1.5`,stroke:on,strokeWidth:`0.9`,strokeLinecap:`round`})]})}function An({size:e=14}){return(0,E.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 14 14`,fill:`none`,children:[(0,E.jsx)(`path`,{d:`M2.5 1h6l3 3v9h-9V1Z`,stroke:on,strokeWidth:`0.9`,fill:on,fillOpacity:`0.07`,strokeLinejoin:`round`}),(0,E.jsx)(`path`,{d:`M8.5 1v3h3`,stroke:on,strokeWidth:`0.9`,fill:`none`,strokeLinejoin:`round`}),(0,E.jsx)(`circle`,{cx:`5`,cy:`6.5`,r:`1`,stroke:on,strokeWidth:`0.85`}),(0,E.jsx)(`circle`,{cx:`9`,cy:`6.5`,r:`1`,stroke:on,strokeWidth:`0.85`}),(0,E.jsx)(`circle`,{cx:`5`,cy:`10`,r:`1`,stroke:on,strokeWidth:`0.85`}),(0,E.jsx)(`path`,{d:`M5 7.5V9`,stroke:on,strokeWidth:`0.85`,strokeLinecap:`round`}),(0,E.jsx)(`path`,{d:`M9 7.5v.5a2 2 0 0 1-2 2H6`,stroke:on,strokeWidth:`0.85`,strokeLinecap:`round`,fill:`none`})]})}function jn({size:e=14}){return(0,E.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 14 14`,fill:`none`,children:[(0,E.jsx)(`path`,{d:`M2.5 1h6l3 3v9h-9V1Z`,stroke:on,strokeWidth:`0.9`,fill:on,fillOpacity:`0.07`,strokeLinejoin:`round`}),(0,E.jsx)(`path`,{d:`M8.5 1v3h3`,stroke:on,strokeWidth:`0.9`,fill:`none`,strokeLinejoin:`round`}),(0,E.jsx)(`rect`,{x:`4.5`,y:`8.5`,width:`5`,height:`3`,rx:`0.6`,stroke:on,strokeWidth:`0.9`}),(0,E.jsx)(`path`,{d:`M5.5 8.5V7.5a1.5 1.5 0 0 1 3 0v1`,stroke:on,strokeWidth:`0.9`,strokeLinecap:`round`,fill:`none`})]})}function Mn({size:e=14}){return(0,E.jsx)(ln,{label:`DOC`,size:e})}function Nn({size:e=14}){return(0,E.jsx)(ln,{label:`PDF`,size:e})}function Pn({size:e=14}){return(0,E.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 14 14`,fill:`none`,children:[(0,E.jsx)(`path`,{d:`M2.5 1h6l3 3v9h-9V1Z`,stroke:on,strokeWidth:`0.9`,fill:on,fillOpacity:`0.07`,strokeLinejoin:`round`}),(0,E.jsx)(`path`,{d:`M8.5 1v3h3`,stroke:on,strokeWidth:`0.9`,fill:`none`,strokeLinejoin:`round`}),(0,E.jsx)(`circle`,{cx:`7`,cy:`8.5`,r:`1.3`,stroke:on,strokeWidth:`0.9`}),(0,E.jsx)(`path`,{d:`M7 6.5v.7M7 10.3v.7M5 8.5h.7M8.3 8.5H9M5.5 6.9l.5.5M8.5 9.6l-.5-.5M5.5 10.1l.5-.5M8.5 7.4l-.5.5`,stroke:on,strokeWidth:`0.8`,strokeLinecap:`round`})]})}function Fn(e,t=14){let n=e.toLowerCase(),r=n.split(`.`).pop()??``;if(n===`dockerfile`||n.startsWith(`dockerfile.`))return(0,E.jsx)(On,{size:t});if(n===`.env`||n.startsWith(`.env.`))return(0,E.jsx)(kn,{size:t});if(n===`.gitignore`||n===`.gitattributes`||n===`.gitmodules`)return(0,E.jsx)(An,{size:t});if(n===`package-lock.json`||n===`yarn.lock`||n===`bun.lock`||n===`pnpm-lock.yaml`||n===`cargo.lock`)return(0,E.jsx)(jn,{size:t});if(n.endsWith(`.config.ts`)||n.endsWith(`.config.js`)||n.endsWith(`.config.mjs`)||n.endsWith(`.config.cjs`)||[`.eslintrc`,`.eslintrc.js`,`.eslintrc.json`,`.eslintrc.yml`,`eslint.config.mjs`,`eslint.config.js`].includes(n))return(0,E.jsx)(Pn,{size:t});switch(r){case`ts`:return(0,E.jsx)(un,{size:t});case`tsx`:return(0,E.jsx)(dn,{size:t});case`js`:case`mjs`:case`cjs`:return(0,E.jsx)(fn,{size:t});case`jsx`:return(0,E.jsx)(pn,{size:t});case`py`:return(0,E.jsx)(mn,{size:t});case`json`:case`jsonl`:return(0,E.jsx)(hn,{size:t});case`css`:case`less`:return(0,E.jsx)(gn,{size:t});case`scss`:return(0,E.jsx)(_n,{size:t});case`html`:case`htm`:return(0,E.jsx)(vn,{size:t});case`md`:case`mdx`:return(0,E.jsx)(yn,{size:t});case`yaml`:case`yml`:return(0,E.jsx)(bn,{size:t});case`toml`:return(0,E.jsx)(xn,{size:t});case`sh`:case`bash`:case`zsh`:case`fish`:return(0,E.jsx)(Sn,{size:t});case`rs`:return(0,E.jsx)(Cn,{size:t});case`go`:return(0,E.jsx)(wn,{size:t});case`sql`:return(0,E.jsx)(Tn,{size:t});case`graphql`:case`gql`:return(0,E.jsx)(En,{size:t});case`tf`:case`hcl`:return(0,E.jsx)(Dn,{size:t});case`docx`:return(0,E.jsx)(Mn,{size:t});case`pdf`:return(0,E.jsx)(Nn,{size:t});case`lock`:return(0,E.jsx)(jn,{size:t});default:return(0,E.jsx)(cn,{size:t})}}var In={up:{top:0,left:0,right:0},down:{bottom:0,left:0,right:0},left:{left:0,top:0,bottom:0},right:{right:0,top:0,bottom:0}},Ln={up:{left:`50%`,transform:`translateX(-50%)`},down:{left:`50%`,transform:`translateX(-50%)`},left:{top:`50%`,transform:`translateY(-50%)`},right:{top:`50%`,transform:`translateY(-50%)`}},Rn={up:`linear-gradient(to bottom, var(--bg), transparent)`,down:`linear-gradient(to top, var(--bg), transparent)`,left:`linear-gradient(to right, var(--bg), transparent)`,right:`linear-gradient(to left, var(--bg), transparent)`},zn={up:{borderLeft:`6px solid transparent`,borderRight:`6px solid transparent`,borderBottom:`7px solid var(--text-muted)`},down:{borderLeft:`6px solid transparent`,borderRight:`6px solid transparent`,borderTop:`7px solid var(--text-muted)`},left:{borderTop:`6px solid transparent`,borderBottom:`6px solid transparent`,borderRight:`7px solid var(--text-muted)`},right:{borderTop:`6px solid transparent`,borderBottom:`6px solid transparent`,borderLeft:`7px solid var(--text-muted)`}};function Bn({direction:e,visible:t,onHover:n,hoverInterval:r=200,onClick:i,length:a=`100%`,thickness:o=30,style:s,label:c,testId:l}){let u=(0,d.useRef)(n);u.current=n;let f=(0,d.useRef)(null),p=(0,d.useCallback)(()=>{f.current!==null&&(clearInterval(f.current),f.current=null)},[]),m=(0,d.useCallback)(()=>{p(),u.current?.(),u.current&&(f.current=window.setInterval(()=>u.current?.(),r))},[r,p]);if((0,d.useEffect)(()=>p,[p]),!t)return null;let h=e===`up`||e===`down`,g={position:`absolute`,pointerEvents:`none`,zIndex:49,height:o,...h?{left:0,right:0}:{width:o,top:0,bottom:0},...In[e],background:Rn[e]},_={position:`absolute`,zIndex:50,cursor:`pointer`,background:`transparent`,border:`none`,padding:0,display:`flex`,alignItems:`center`,justifyContent:`center`,...In[e],...h?{width:a,height:o}:{height:a,width:o},...Ln[e],...s};return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`span`,{style:g,"aria-hidden":`true`}),(0,E.jsx)(`button`,{type:`button`,"data-testid":l??`scroll-direction-hint-${e}`,"aria-label":c??`Scroll ${e}`,title:c??`Scroll ${e}`,style:_,onMouseEnter:m,onMouseLeave:p,onClick:i,children:(0,E.jsx)(`span`,{"aria-hidden":`true`,style:{width:0,height:0,pointerEvents:`none`,...zn[e]}})})]})}var Vn=2;function Hn({tabs:e,activeTabId:t,onSelectTab:n,onCloseTab:r,leftExtra:i,rightExtra:a,scrollStepPx:o=200}){let{t:s}=N(),[c,l]=(0,d.useState)(null),u=(0,d.useRef)(null),[f,m]=(0,d.useState)({scrollWidth:0,clientWidth:0,scrollLeft:0}),h=()=>{if(document.hidden)return;let e=u.current;e&&m({scrollWidth:e.scrollWidth,clientWidth:e.clientWidth,scrollLeft:e.scrollLeft})};(0,d.useLayoutEffect)(()=>{h();let e=u.current;if(!e)return;let t=new ResizeObserver(h);return t.observe(e),()=>t.disconnect()},[e]);let{scrollWidth:g,clientWidth:_,scrollLeft:v}=f,y=g-_>20,b=y&&v>Vn,x=y&&v+_<g-Vn,S=e=>{let t=u.current;if(!t)return;let n=Math.max(0,t.scrollWidth-t.clientWidth);t.scrollTo({left:Math.max(0,Math.min(n,t.scrollLeft+e*o)),behavior:`smooth`})},C=e=>{let t=u.current;t&&t.scrollTo({left:e===`left`?0:Math.max(0,t.scrollWidth-t.clientWidth),behavior:`smooth`})};return(0,E.jsxs)(`div`,{"data-testid":`tab-bar`,style:{display:`flex`,alignItems:`flex-end`,background:`var(--bg-panel)`,flexShrink:0,height:`calc(36px + env(safe-area-inset-top))`,paddingTop:`env(safe-area-inset-top)`},children:[i&&(0,E.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,height:36,flexShrink:0},children:i}),(0,E.jsxs)(`div`,{style:{position:`relative`,flex:1,minWidth:0,height:36},children:[(0,E.jsx)(`div`,{ref:u,"data-testid":`tab-scroll`,role:`tablist`,onScroll:h,style:{display:`flex`,alignItems:`flex-end`,overflowX:`auto`,overflowY:`hidden`,height:36},children:e.map(e=>{let i=e.id===t;return(0,E.jsxs)(`div`,{"data-tab-id":e.id,"data-active":i,role:`tab`,"aria-selected":i,onClick:()=>n(e.id),onMouseDown:e=>{e.button===1&&e.preventDefault()},onAuxClick:t=>{t.button===1&&e.closable!==!1&&(t.preventDefault(),t.stopPropagation(),r(e.id))},style:{display:`flex`,alignItems:`center`,justifyContent:`center`,position:`relative`,gap:6,height:36,paddingLeft:30,paddingRight:30,borderRight:`1px solid var(--border)`,background:i?`var(--bg)`:`var(--bg-panel)`,cursor:`pointer`,fontSize:`var(--text-base)`,color:i?`var(--text)`:`var(--text-muted)`,whiteSpace:`nowrap`,maxWidth:180,minWidth:80,flexShrink:0,userSelect:`none`,transition:`background 0.1s, color 0.1s`},children:[(0,E.jsx)(`span`,{style:{flexShrink:0,opacity:i?1:.7,display:`flex`,alignItems:`center`},children:e.icon??(e.filePath?Fn(e.label,13):null)}),(0,E.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,fontWeight:i?500:400},title:e.filePath,children:e.label}),e.badge!=null&&e.badge>0&&(0,E.jsx)(`span`,{style:{flexShrink:0,marginLeft:5,minWidth:16,height:16,padding:`0 5px`,borderRadius:5,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,border:`1px solid var(--accent)`,background:`color-mix(in srgb, var(--accent) 12%, transparent)`,color:`var(--accent)`,fontSize:`var(--text-2xs)`,fontWeight:600,lineHeight:1},children:e.badge>99?`99+`:e.badge}),e.closable!==!1&&(0,E.jsx)(`button`,{onClick:t=>{t.stopPropagation(),r(e.id)},onMouseEnter:()=>l(e.id),onMouseLeave:()=>l(null),style:{display:`flex`,alignItems:`center`,justifyContent:`center`,position:`absolute`,right:6,top:`50%`,transform:`translateY(-50%)`,width:24,height:24,background:c===e.id?`var(--bg-hover)`:`transparent`,border:`none`,borderRadius:4,color:c===e.id?`var(--text)`:`var(--text-dim)`,cursor:`pointer`,padding:0,flexShrink:0,transition:`background 0.1s, color 0.1s`},title:s(`i18n.close`),"aria-label":`${s(`i18n.close`)} ${e.label}`,children:(0,E.jsxs)(`svg`,{width:p.sm,height:p.sm,viewBox:`0 0 10 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,E.jsx)(`line`,{x1:`2`,y1:`2`,x2:`8`,y2:`8`}),(0,E.jsx)(`line`,{x1:`8`,y1:`2`,x2:`2`,y2:`8`})]})})]},e.id)})}),b&&(0,E.jsx)(Bn,{direction:`left`,visible:!0,testId:`tab-scroll-left`,thickness:18,onHover:()=>S(-1),onClick:()=>C(`left`)}),x&&(0,E.jsx)(Bn,{direction:`right`,visible:!0,testId:`tab-scroll-right`,thickness:18,onHover:()=>S(1),onClick:()=>C(`right`)})]}),a&&(0,E.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,height:36,flexShrink:0,paddingRight:`env(safe-area-inset-right)`},children:a})]})}function Un(e){return null}function Wn({activeId:e,children:t}){let n=d.Children.toArray(t).filter(e=>(0,d.isValidElement)(e)&&e.type===Un);return(0,E.jsx)(E.Fragment,{children:n.map(t=>{let n=t.props.activeWhen!==!1&&t.props.id===e;return!t.props.keepAlive&&!n?null:(0,E.jsx)(`div`,{"data-testid":t.props.testId,style:{position:`absolute`,inset:0,display:`flex`,flexDirection:`column`,overflow:t.props.scroll??`auto`,zIndex:t.props.zIndex,contentVisibility:n?`visible`:`hidden`,pointerEvents:n?void 0:`none`},children:t.props.children},t.props.id)})})}function Gn({tabs:e,activeTabId:t,onSelectTab:n,onCloseTab:r,leftExtra:i,rightExtra:a,scrollStepPx:o,tabBarRef:s,overlay:c,children:l}){return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{ref:s,style:{flexShrink:0,background:`var(--bg-panel)`},children:[(0,E.jsx)(Hn,{tabs:e,activeTabId:t,leftExtra:i,rightExtra:a,onSelectTab:n,onCloseTab:r,scrollStepPx:o}),(0,E.jsx)(`div`,{style:{height:1,background:`var(--border)`,flexShrink:0}})]}),(0,E.jsx)(`div`,{style:{flex:1,overflow:`hidden`,position:`relative`,display:`flex`},children:(0,E.jsxs)(`div`,{style:{flex:1,overflow:`hidden`,position:`relative`,minWidth:0,minHeight:0,display:`flex`,flexDirection:`column`},children:[(0,E.jsx)(Wn,{activeId:t,children:l}),c]})})]})}var Kn=new Set;function qn(e){return Kn.add(e),()=>{Kn.delete(e)}}function Jn(){return typeof document>`u`?`light`:document.documentElement.classList.contains(`dark`)?`dark`:`light`}function Yn(){return`light`}function Xn(){let e=(0,d.useSyncExternalStore)(qn,Jn,Yn);return{theme:e,toggleTheme:(0,d.useCallback)(e=>{let t=Jn()===`dark`?`light`:`dark`;t===`dark`?document.documentElement.classList.add(`dark`):document.documentElement.classList.remove(`dark`);try{localStorage.setItem(`pi-theme`,t)}catch{}fetch(`/api/preferences`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({firstPaint:{theme:t}})}).catch(()=>{}),Kn.forEach(e=>e())},[]),isDark:e===`dark`}}function Zn(e,t,n){let[r,i]=(0,d.useState)(()=>{try{let t=localStorage.getItem(e);if(t!==null){let e=JSON.parse(t);return n?n(e):e}}catch{}return typeof t==`function`?t():t});return(0,d.useEffect)(()=>{try{localStorage.setItem(e,JSON.stringify(r))}catch{}},[e,r]),[r,i]}function Qn(e){return{value:(0,d.useSyncExternalStore)(t=>e.subscribe(t),()=>e.get(),()=>e.get()),error:e.getError()}}var $n=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),er=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),tr=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),nr=e=>{let t=tr(e);return t.charAt(0).toUpperCase()+t.slice(1)},rr={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},ir=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},ar=(0,d.createContext)({}),or=()=>(0,d.useContext)(ar),sr=(0,d.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:f=!1,color:p=`currentColor`,className:m=``}=or()??{},h=r??f?Number(n??u)*24/Number(t??l):n??u;return(0,d.createElement)(`svg`,{ref:c,...rr,width:t??l??rr.width,height:t??l??rr.height,stroke:e??p,strokeWidth:h,className:$n(`lucide`,m,i),...!a&&!ir(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,d.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),cr=(e,t)=>{let n=(0,d.forwardRef)(({className:n,...r},i)=>(0,d.createElement)(sr,{ref:i,iconNode:t,className:$n(`lucide-${er(nr(e))}`,`lucide-${e}`,n),...r}));return n.displayName=nr(e),n},lr=cr(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),ur=cr(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),dr=cr(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),fr=cr(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),pr=cr(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),mr=cr(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),hr=cr(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),gr=cr(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),_r=cr(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),vr=cr(`expand`,[[`path`,{d:`m15 15 6 6`,key:`1s409w`}],[`path`,{d:`m15 9 6-6`,key:`ko1vev`}],[`path`,{d:`M21 16v5h-5`,key:`1ck2sf`}],[`path`,{d:`M21 8V3h-5`,key:`1qoq8a`}],[`path`,{d:`M3 16v5h5`,key:`1t08am`}],[`path`,{d:`m3 21 6-6`,key:`wwnumi`}],[`path`,{d:`M3 8V3h5`,key:`1ln10m`}],[`path`,{d:`M9 9 3 3`,key:`v551iv`}]]),yr=cr(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),br=cr(`fold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3-3-3 3`,key:`e37ymu`}],[`path`,{d:`m15 5-3 3-3-3`,key:`19d6lf`}]]),xr=cr(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Sr=cr(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),Cr=cr(`git-commit-horizontal`,[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]]),wr=cr(`hard-drive-upload`,[[`path`,{d:`m16 6-4-4-4 4`,key:`13yo43`}],[`path`,{d:`M12 2v8`,key:`1q4o3n`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,key:`w68u3i`}],[`path`,{d:`M6 18h.01`,key:`uhywen`}],[`path`,{d:`M10 18h.01`,key:`h775k`}]]),Tr=cr(`hourglass`,[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]),Er=cr(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),Dr=cr(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),Or=cr(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),kr=cr(`list-end`,[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M16 12H3`,key:`1a2rj7`}],[`path`,{d:`M9 19H3`,key:`s61nz1`}],[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M21 5v12a2 2 0 0 1-2 2h-6`,key:`hey24a`}]]),Ar=cr(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),jr=cr(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Mr=cr(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Nr=cr(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),Pr=cr(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Fr=cr(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),Ir=cr(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Lr=cr(`puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),Rr=cr(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),zr=cr(`rotate-ccw-clock`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),Br=cr(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Vr=cr(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Hr=cr(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Ur=cr(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),Wr=cr(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Gr=cr(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),Kr=cr(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),qr=cr(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Jr=cr(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Yr=cr(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Xr=cr(`trash`,[[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Zr=cr(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Qr=cr(`unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),$r=cr(`volume-2`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]),ei=cr(`volume-x`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`line`,{x1:`22`,x2:`16`,y1:`9`,y2:`15`,key:`1ewh16`}],[`line`,{x1:`16`,x2:`22`,y1:`9`,y2:`15`,key:`5ykzw1`}]]),ti=cr(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),ni=cr(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),ri=cr(`zap`,[[`path`,{d:`M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z`,key:`1v7up4`}]]),ii=e(c(),1);function ai({children:e}){return(0,E.jsx)(E.Fragment,{children:e})}function oi({label:e,wrapperStyle:t,children:n}){let r=(0,d.useRef)(null),i=(0,d.useRef)(null),[a,o]=(0,d.useState)(!1),[s,c]=(0,d.useState)(!1),[l,u]=(0,d.useState)({top:0,left:0,placement:`bottom`});if((0,d.useLayoutEffect)(()=>{if(!e||!a||!s)return;let t=r.current?.getBoundingClientRect(),n=i.current;if(!t||!n)return;let o=n.offsetWidth,c=n.offsetHeight;if(!o)return;let l=t.left+t.width/2,d=o/2,f=window.innerWidth,p=window.innerHeight,m=Math.max(d+8,Math.min(l,f-d-8)),h=t.bottom+6+c<=p-8,g=t.top-6-c>=8,_=h||!g?`bottom`:`top`;u({top:_===`bottom`?t.bottom+6:t.top-6,left:m,placement:_})},[e,a,s]),!e)return(0,E.jsx)(E.Fragment,{children:n});let f=()=>{let e=r.current?.getBoundingClientRect();e&&u({top:e.bottom+6,left:e.left+e.width/2,placement:`bottom`})},p=()=>{f(),c(!0),o(!0)},m=()=>o(!1),h=s&&typeof document<`u`?(0,ii.createPortal)((0,E.jsx)(`div`,{ref:i,role:`tooltip`,"data-slot":`tooltip-content`,style:{position:`fixed`,top:l.top,left:l.left,transform:l.placement===`top`?`translate(-50%, -100%)`:`translateX(-50%)`,zIndex:9999,width:`max-content`,maxWidth:`min(20rem, calc(100vw - 16px))`,whiteSpace:`pre-line`,overflowWrap:`break-word`,background:`var(--bg-panel)`,color:`var(--text)`,border:`1px solid var(--border)`,borderRadius:`var(--radius-md, 6px)`,padding:`4px 8px`,fontSize:`var(--text-sm)`,lineHeight:1.5,boxShadow:`0 4px 16px -2px var(--shadow-strong)`,pointerEvents:`none`,display:a?`block`:`none`},children:e}),document.body):null;return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`span`,{ref:r,"data-slot":`tooltip-trigger`,title:``,onPointerEnter:p,onPointerLeave:m,onMouseEnter:p,onMouseLeave:m,onFocus:p,onBlur:m,onPointerMove:e=>e.stopPropagation(),style:{display:`inline-flex`,...t},children:n}),h]})}var si={boxSizing:`border-box`,background:`var(--bg-input, var(--bg))`,color:`var(--text)`,border:`1px solid var(--border)`,borderRadius:4,padding:`4px 8px`,fontSize:`var(--text-base)`,fontFamily:`var(--font-mono)`},ci={display:`flex`,alignItems:`center`,justifyContent:`center`,width:22,height:22,padding:0,background:`none`,border:`1px solid var(--border)`,borderRadius:5,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-sm)`,lineHeight:1,flexShrink:0};function li({value:e,onChange:t,parse:n}){let[r,i]=(0,d.useState)(String(e));return(0,d.useEffect)(()=>{i(String(e))},[e]),{draft:r,commit:e=>{i(e);let r=n(e);r!==null&&t(r)}}}function ui({tooltip:e=!1,offText:t,...n}){let{t:r,labelKey:i,unitText:a,rangeText:o,resetText:s,defaultValue:c,min:l,max:u}=n,{draft:d,commit:f}=li(n),p=t!=null&&n.value===c?t:o,m=(0,E.jsx)(`input`,{type:`number`,min:l,max:u,step:1,value:d,onChange:e=>f(e.target.value),"aria-label":r(i),...e?{}:{title:p},style:{flex:1,minWidth:0,...si}}),h=(0,E.jsx)(`button`,{type:`button`,onClick:()=>n.onChange(c),"aria-label":s,...e?{}:{title:s},style:ci,children:`↺`});return(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,width:`100%`},children:[e?(0,E.jsx)(oi,{label:p,wrapperStyle:{flex:1,display:`flex`},children:m}):m,(0,E.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`,whiteSpace:`nowrap`},children:a}),e?(0,E.jsx)(oi,{label:s,children:h}):h]})}function di({unitSuffix:e,offText:t,tooltip:n=!0,...r}){let{t:i,labelKey:a,rangeText:o,resetText:s,value:c,defaultValue:l,min:u,max:d}=r,{draft:f,commit:p}=li(r);return(0,E.jsxs)(`div`,{role:`menu`,"aria-label":i(a),style:{background:`var(--bg-panel)`,borderLeft:`1px solid var(--border)`,borderRight:`1px solid var(--border)`,borderBottom:`1px solid var(--border)`,padding:`10px 12px 12px`},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,fontSize:`var(--text-base)`,color:`var(--text-muted)`,marginBottom:8},children:[(0,E.jsx)(`span`,{children:i(a)}),(0,E.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,E.jsxs)(`span`,{style:{fontFamily:`var(--font-mono)`,color:`var(--text)`,fontWeight:600},children:[c,e]}),(()=>{let e=(0,E.jsx)(`button`,{type:`button`,onClick:()=>r.onChange(l),"aria-label":s,...n?{}:{title:s},style:ci,children:`↺`});return n?(0,E.jsx)(oi,{label:s,children:e}):e})()]})]}),(0,E.jsx)(`input`,{type:`number`,min:u,max:d,step:1,value:f,onChange:e=>p(e.target.value),"aria-label":i(a),style:{width:`100%`,...si}}),(0,E.jsx)(`div`,{style:{fontSize:`var(--text-xs)`,color:`var(--text-dim)`,marginTop:4,textAlign:`center`},children:t!=null&&c===l?t:o})]})}function fi({value:e,onChange:t,t:n,embedded:r}){let i={value:e,onChange:t,parse:ze,min:1,max:Le,defaultValue:200,t:n,labelKey:`theme.scrollStep`,unitText:n(`scrollStep.unit`),rangeText:n(`scrollStep.range`),resetText:n(`scrollStep.reset`,{n:200})};return r?(0,E.jsx)(ui,{...i,tooltip:!0}):(0,E.jsx)(di,{...i,unitSuffix:`px`})}function pi({label:e,hint:t,children:n}){return(0,E.jsxs)(mi,{children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,minWidth:0},children:[(0,E.jsx)(`span`,{style:{fontSize:`var(--text-lg)`,color:`var(--text)`,fontWeight:500,whiteSpace:`nowrap`},children:e}),t&&(0,E.jsx)(oi,{label:t,children:(0,E.jsx)(`span`,{role:`img`,"aria-label":t,style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`,cursor:`help`,lineHeight:1,flexShrink:0},children:`ⓘ`})})]}),(0,E.jsx)(`div`,{style:{flex:1,minWidth:0,maxWidth:320},children:n})]})}function mi({children:e}){return(0,E.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:16,padding:`10px 14px`,border:`1px solid var(--border)`,borderRadius:10,background:`var(--bg-panel)`},children:e})}function hi({sidebarWidth:e,onSidebarWidthChange:t,widgetPanelWidth:n,onWidgetPanelWidthChange:r}){let{t:i}=N(),{isDark:a,toggleTheme:o,fontScale:s,setFontScale:c,scrollStepPx:l,setScrollStepPx:u,longBlockCollapseChars:d,setLongBlockCollapseChars:f,recentBlocksExpanded:p,setRecentBlocksExpanded:m}=ge();return(0,E.jsxs)(`div`,{style:{height:`100%`,overflowY:`auto`,padding:`18px 20px 40px`,display:`flex`,flexDirection:`column`,gap:8,maxWidth:640},children:[(0,E.jsx)(pi,{label:i(`theme.toggleTheme`),children:(0,E.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:16,width:`100%`},children:[{value:!0,key:`dark`,labelKey:`theme.darkMode`},{value:!1,key:`light`,labelKey:`theme.lightMode`}].map(({value:e,key:t,labelKey:n})=>(0,E.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:6,fontSize:`var(--text-base)`,color:`var(--text)`,cursor:`pointer`,whiteSpace:`nowrap`},children:[(0,E.jsx)(`input`,{type:`radio`,name:`theme-mode`,checked:a===e,onChange:e=>{let t=e.currentTarget.getBoundingClientRect();o({x:t.left+t.width/2,y:t.top+t.height/2})},style:{accentColor:`var(--accent)`,cursor:`pointer`,margin:0}}),i(n)]},t))})}),(0,E.jsx)(pi,{label:i(`theme.fontSize`),children:(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,width:`100%`},children:[(0,E.jsx)(`input`,{type:`range`,min:.85,max:1.3,step:.05,value:s,onChange:e=>c(Number(e.target.value)),"aria-label":i(`theme.fontSize`),style:{flex:1,accentColor:`var(--accent)`,cursor:`pointer`}}),(0,E.jsxs)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`var(--text-base)`,color:`var(--text)`,fontWeight:600,minWidth:44,textAlign:`right`},children:[Math.round(s*100),`%`]})]})}),(0,E.jsx)(pi,{label:i(`theme.scrollStep`),hint:i(`scrollStep.hint`),children:(0,E.jsx)(fi,{value:l,onChange:u,t:i,embedded:!0})}),(0,E.jsx)(pi,{label:i(`theme.longBlockCollapse`),hint:i(`longBlock.hint`),children:(0,E.jsx)(vi,{value:d,onChange:f,t:i})}),(0,E.jsx)(pi,{label:i(`theme.recentBlocksExpanded`),hint:i(`recentBlocks.hint`),children:(0,E.jsx)(_i,{value:p,onChange:m,t:i})}),(0,E.jsx)(pi,{label:i(`layout.sidebarWidth`),hint:i(`layout.widthRange`,{min:180,max:480}),children:(0,E.jsx)(gi,{value:e,onChange:t,min:180,max:480,resetTo:280,label:i(`layout.sidebarWidth`),t:i})}),(0,E.jsx)(pi,{label:i(`layout.widgetPanelWidth`),hint:i(`layout.widthRange`,{min:200,max:560}),children:(0,E.jsx)(gi,{value:n,onChange:r,min:200,max:560,resetTo:280,label:i(`layout.widgetPanelWidth`),t:i})}),` `]})}function gi({value:e,onChange:t,min:n,max:r,resetTo:i,label:a,t:o}){return(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,minWidth:0},children:[(0,E.jsx)(`input`,{type:`number`,value:e,min:n,max:r,onChange:e=>{let i=Number.parseInt(e.target.value,10);Number.isFinite(i)&&t(Math.min(r,Math.max(n,i)))},onBlur:()=>t(e),"aria-label":a,style:{width:80,padding:`5px 8px`,border:`1px solid var(--border)`,borderRadius:7,background:`var(--bg)`,color:`var(--text)`,fontSize:`var(--text-lg)`,fontVariantNumeric:`tabular-nums`,outline:`none`}}),(0,E.jsx)(`span`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:`px`}),(0,E.jsx)(oi,{label:o(`layout.widthReset`,{value:i}),children:(0,E.jsx)(`button`,{type:`button`,onClick:()=>t(i),"aria-label":o(`layout.widthReset`,{value:i}),style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:26,height:26,padding:0,background:`none`,border:`none`,borderRadius:5,color:`var(--text-dim)`,cursor:`pointer`},children:(0,E.jsxs)(`svg`,{width:p.base,height:p.base,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,E.jsx)(`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`}),(0,E.jsx)(`path`,{d:`M3 3v5h5`})]})})})]})}function _i({value:e,onChange:t,t:n}){return(0,E.jsx)(ui,{tooltip:!0,value:e,onChange:t,parse:Ke,min:0,max:20,defaultValue:0,t:n,labelKey:`theme.recentBlocksExpanded`,unitText:n(`longBlock.blocks`),rangeText:n(`recentBlocks.range`),resetText:n(`recentBlocks.reset`,{n:0})})}function vi({value:e,onChange:t,t:n}){return(0,E.jsx)(ui,{tooltip:!0,value:e,onChange:t,parse:Ue,min:20,max:Ve,defaultValue:200,t:n,labelKey:`theme.longBlockCollapse`,unitText:n(`longBlock.chars`),rangeText:n(`longBlock.range`),resetText:n(`longBlock.reset`,{n:200})})}var yi=[`auto`,`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`],bi=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`];function xi(e,t){if(!t||t.length===0)return e;let n=new Set(t);if(n.has(e))return e;let r=bi.indexOf(e);for(let e=r+1;e<bi.length;e++)if(n.has(bi[e]))return bi[e];for(let e=r-1;e>=0;e--)if(n.has(bi[e]))return bi[e];return e}var Si={auto:`chat.thinkingUseDefault`,off:`chat.thinkingOff`,minimal:`chat.thinkingMinimal`,low:`chat.thinkingLow`,medium:`chat.thinkingMedium`,high:`chat.thinkingHigh`,xhigh:`chat.thinkingXhigh`,max:`chat.thinkingMax`},Ci={off:`var(--text-dim)`,minimal:`var(--text-muted)`,low:`#60a5fa`,medium:`#a78bfa`,high:`#f472b6`,xhigh:`#fb923c`,max:`#ef4444`};function wi({value:e,onChange:t,t:n,embedded:r}){let i={value:e,onChange:t,parse:Fe,min:0,max:Pe,defaultValue:0,t:n,labelKey:`theme.autoReloadSeconds`,unitText:n(`autoReload.unit`),rangeText:n(`autoReload.range`),resetText:n(`autoReload.reset`,{n:0})};return r?(0,E.jsx)(ui,{...i,tooltip:!0,offText:n(`autoReload.off`)}):(0,E.jsx)(di,{...i,unitSuffix:`s`,offText:n(`autoReload.off`)})}var Ti=Object.defineProperty,Ei=(e,t)=>Ti(e,`name`,{value:t,configurable:!0});function Di(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}Ei(Di,`setRef`);function Oi(...e){return t=>{let n=!1,r=e.map(e=>{let r=Di(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():Di(e[t],null)}}}}Ei(Oi,`composeRefs`);function ki(...e){return d.useCallback(Oi(...e),e)}Ei(ki,`useComposedRefs`);var Ai=Object.defineProperty,ji=(e,t)=>Ai(e,`name`,{value:t,configurable:!0});function Mi(e){let t=d.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];Vi(r)&&typeof Gi==`function`&&(r=Gi(r._payload)),d.Children.forEach(r,e=>{if(zi(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;Vi(n)&&typeof Gi==`function`&&(n=Gi(n._payload)),a=Ii(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=d.cloneElement(a,void 0,s):!o&&d.Children.count(r)===1&&d.isValidElement(r)&&(a=r);let c=a?Ri(a):void 0,l=ki(n,c);if(!a){if(r||r===0)throw Error(o?Wi(e):Ui(e));return r}let u=Li(i,a.props??{});return a.type!==d.Fragment&&(u.ref=n?l:c),d.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}ji(Mi,`createSlot`);var Ni=Mi(`Slot`),Pi=Symbol.for(`radix.slottable`);function Fi(e){let t=ji(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=Pi,t}ji(Fi,`createSlottable`);var Ii=ji((e,t)=>{if(`child`in e.props){let t=e.props.child;return d.isValidElement(t)?d.cloneElement(t,void 0,e.props.children(t.props.children)):null}return d.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function Li(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}ji(Li,`mergeProps`);function Ri(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}ji(Ri,`getElementRef`);function zi(e){return d.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Pi}ji(zi,`isSlottable`);var Bi=Symbol.for(`react.lazy`);function Vi(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Bi&&`_payload`in e&&Hi(e._payload)}ji(Vi,`isLazyComponent`);function Hi(e){return typeof e==`object`&&!!e&&`then`in e}ji(Hi,`isPromiseLike`);var Ui=ji(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),Wi=ji(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),Gi=d.use,Ki=Object.defineProperty,qi=(e,t)=>Ki(e,`name`,{value:t,configurable:!0}),Ji=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Mi(`Primitive.${t}`),r=d.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,E.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Yi(e,t){e&&ii.flushSync(()=>e.dispatchEvent(t))}qi(Yi,`dispatchDiscreteCustomEvent`);var Xi=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),Zi=Object.defineProperty,Qi=(e,t)=>Zi(e,`name`,{value:t,configurable:!0});function $i(e,t){let n=d.createContext(t);n.displayName=e+`Context`;let r=Qi(e=>{let{children:t,...r}=e,i=d.useMemo(()=>r,Object.values(r));return(0,E.jsx)(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=d.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return Qi(i,`useContext`),[r,i]}Qi($i,`createContext`);function ea(e,t=[]){let n=[];function r(t,r){let i=d.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=Qi(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=d.useMemo(()=>o,Object.values(o));return(0,E.jsx)(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=d.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return Qi(s,`useContext`),[o,s]}Qi(r,`createContext`);let i=Qi(()=>{let t=n.map(e=>d.createContext(e));return Qi(function(n){let r=n?.[e]||t;return d.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,ta(i,...t)]}Qi(ea,`createContextScope`);function ta(...e){let t=e[0];if(e.length===1)return t;let n=Qi(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return Qi(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return d.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}Qi(ta,`composeContextScopes`);var na=Object.defineProperty,ra=(e,t)=>na(e,`name`,{value:t,configurable:!0});function ia(e){let t=e+`CollectionProvider`,[n,r]=ea(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=ra(e=>{let{scope:t,children:n}=e,r=d.useRef(null),a=d.useRef(new Map).current;return(0,E.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})},`CollectionProvider`);o.displayName=t;let s=e+`CollectionSlot`,c=Mi(s),l=d.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=ki(t,a(s,n).collectionRef);return(0,E.jsx)(c,{ref:i,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,f=`data-radix-collection-item`,p=Mi(u),m=d.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=d.useRef(null),s=ki(t,o),c=a(u,n);return d.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,E.jsx)(p,{[f]:``,ref:s,children:r})});m.displayName=u;function h(t){let n=a(e+`CollectionConsumer`,t);return d.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${f}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return ra(h,`useCollection`),[{Provider:o,Slot:l,ItemSlot:m},h,r]}ra(ia,`createCollection`);var aa=new WeakMap,oa=class e extends Map{static{ra(this,`OrderedDict`)}#e;constructor(e){super(e),this.#e=[...super.keys()],aa.set(this,!0)}set(e,t){return aa.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,n){let r=this.has(t),i=this.#e.length,a=la(e),o=a>=0?a:i+a,s=o<0||o>=i?-1:o;if(s===this.size||r&&s===this.size-1||s===-1)return this.set(t,n),this;let c=this.size+ +!r;a<0&&o++;let l=[...this.#e],u,d=!1;for(let e=o;e<c;e++)if(o===e){let i=l[e];l[e]===t&&(i=l[e+1]),r&&this.delete(t),u=this.get(i),this.set(t,n)}else{!d&&l[e-1]===t&&(d=!0);let n=l[d?e:e-1],r=u;u=this.get(n),this.delete(n),this.set(n,r)}return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r,t,n)}after(e){let t=this.#e.indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r+1,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return t!==void 0&&this.delete(t)}at(e){let t=sa(this.#e,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=sa(this.#e,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return sa(this.#e,e)}from(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return-1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=0,i=n??this.at(0);for(let n of this)i=r===0&&e.length===1?n:Reflect.apply(t,this,[i,n,r,this]),r++;return i}reduceRight(...e){let[t,n]=e,r=n??this.at(-1);for(let n=this.size-1;n>=0;n--){let i=this.at(n);r=n===this.size-1&&e.length===1?i:Reflect.apply(t,this,[r,i,n,this])}return r}toSorted(t){let n=[...this.entries()].sort(t);return new e(n)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e,i=this.size-1;if(t===void 0)return r;t<0&&(t+=this.size),n!==void 0&&n>0&&(i=n-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),n=this.get(t);r.set(t,n)}return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function sa(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=ca(e,t);return n===-1?void 0:e[n]}ra(sa,`at`);function ca(e,t){let n=e.length,r=la(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}ra(ca,`toSafeIndex`);function la(e){return e!==e||e===0?0:Math.trunc(e)}ra(la,`toSafeInteger`);function ua(e){let t=e+`CollectionProvider`,[n,r]=ea(t),[i,a]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new oa,setItemMap:ra(()=>void 0,`setItemMap`)}),o=ra(({state:e,...t})=>e?(0,E.jsx)(c,{...t,state:e}):(0,E.jsx)(s,{...t}),`CollectionProvider`);o.displayName=t;let s=ra(e=>{let t=g();return(0,E.jsx)(c,{...e,state:t})},`CollectionInit`);s.displayName=t+`Init`;let c=ra(e=>{let{scope:t,children:n,state:r}=e,a=d.useRef(null),[o,s]=d.useState(null),c=ki(a,s),[l,u]=r;return d.useEffect(()=>{if(!o)return;let e=ma(()=>{});return e.observe(o,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[o]),(0,E.jsx)(i,{scope:t,itemMap:l,setItemMap:u,collectionRef:c,collectionRefObject:a,collectionElement:o,children:n})},`CollectionProviderImpl`);c.displayName=t+`Impl`;let l=e+`CollectionSlot`,u=Mi(l),f=d.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=ki(t,a(l,n).collectionRef);return(0,E.jsx)(u,{ref:i,children:r})});f.displayName=l;let p=e+`CollectionItemSlot`,m=Mi(p),h=d.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=d.useRef(null),[s,c]=d.useState(null),l=ki(t,o,c),{setItemMap:u}=a(p,n),f=d.useRef(i);da(f.current,i)||(f.current=i);let h=f.current;return d.useEffect(()=>{let e=h;return u(t=>s?t.has(s)?t.set(s,{...e,element:s}).toSorted(pa):(t.set(s,{...e,element:s}),t.toSorted(pa)):t),()=>{u(e=>!s||!e.has(s)?e:(e.delete(s),new oa(e)))}},[s,h,u]),(0,E.jsx)(m,{"data-radix-collection-item":``,ref:l,children:r})});h.displayName=p;function g(){return d.useState(new oa)}ra(g,`useInitCollection`);function _(t){let{itemMap:n}=a(e+`CollectionConsumer`,t);return n}return ra(_,`useCollection`),[{Provider:o,Slot:f,ItemSlot:h},{createCollectionScope:r,useCollection:_,useInitCollection:g}]}ra(ua,`createCollection`);function da(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}ra(da,`shallowEqual`);function fa(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}ra(fa,`isElementPreceding`);function pa(e,t){return!e[1].element||!t[1].element?0:fa(e[1].element,t[1].element)?-1:1}ra(pa,`sortByDocumentPosition`);function ma(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}ra(ma,`getChildListObserver`);var ha=Object.defineProperty,ga=(e,t)=>ha(e,`name`,{value:t,configurable:!0}),_a=!!(typeof window<`u`&&window.document&&window.document.createElement);function va(e,t,{checkForDefaultPrevented:n=!0}={}){return ga(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}ga(va,`composeEventHandlers`);function ya(e){if(!_a)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}ga(ya,`getOwnerWindow`);function ba(e){if(!_a)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}ga(ba,`getOwnerDocument`);function xa(e,t=!1){let{activeElement:n}=ba(e);if(!n?.nodeName)return null;if(Sa(n)&&n.contentDocument)return xa(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=ba(n).getElementById(e);if(t)return t}}return n}ga(xa,`getActiveElement`);function Sa(e){return e.tagName===`IFRAME`}ga(Sa,`isFrame`);var Ca=globalThis?.document?d.useLayoutEffect:()=>{},wa=Object.defineProperty,Ta=(e,t)=>wa(e,`name`,{value:t,configurable:!0}),Ea=d.useEffectEvent,Da=d.useInsertionEffect;function Oa(e){if(typeof Ea==`function`)return Ea(e);let t=d.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof Da==`function`?Da(()=>{t.current=e}):Ca(()=>{t.current=e}),d.useMemo(()=>((...e)=>t.current?.(...e)),[])}Ta(Oa,`useEffectEvent`);var ka=Object.defineProperty,Aa=(e,t)=>ka(e,`name`,{value:t,configurable:!0}),ja=d.useInsertionEffect||Ca;function Ma({prop:e,defaultProp:t,onChange:n=Aa(()=>{},`onChange`),caller:r}){let[i,a,o]=Na({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,d.useCallback(t=>{if(s){let n=Pa(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}Aa(Ma,`useControllableState`);function Na({defaultProp:e,onChange:t}){let[n,r]=d.useState(e),i=d.useRef(n),a=d.useRef(t);return ja(()=>{a.current=t},[t]),d.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}Aa(Na,`useUncontrolledState`);function Pa(e){return typeof e==`function`}Aa(Pa,`isFunction`);var Fa=Symbol(`RADIX:SYNC_STATE`);function Ia(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=Oa(o),u=[{...n,state:a}];r&&u.push(r);let[f,p]=d.useReducer((t,n)=>{if(n.type===Fa)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),m=f.state,h=d.useRef(m);d.useEffect(()=>{h.current!==m&&(h.current=m,c||l(m))},[m,h,c]);let g=d.useMemo(()=>i===void 0?f:{...f,state:i},[f,i]);return d.useEffect(()=>{c&&!Object.is(i,f.state)&&p({type:Fa,state:i})},[i,f.state,c]),[g,p]}Aa(Ia,`useControllableStateReducer`);var La=Object.defineProperty,Ra=(e,t)=>La(e,`name`,{value:t,configurable:!0});function za(e,t){return d.useReducer((e,n)=>t[e][n]??e,e)}Ra(za,`useStateMachine`);var Ba=Ra(e=>{let{present:t,children:n}=e,r=Va(t),i=typeof n==`function`?n({present:r.isPresent}):d.Children.only(n),a=Ua(r.ref,Ga(i));return typeof n==`function`||r.isPresent?d.cloneElement(i,{ref:a}):null},`Presence`);function Va(e){let[t,n]=d.useState(),r=d.useRef(null),i=d.useRef(e),a=d.useRef(`none`),o=d.useRef(void 0),[s,c]=za(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return d.useEffect(()=>{s===`mounted`?(a.current=o.current??Wa(r.current),o.current=void 0):a.current=`none`},[s]),Ca(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=Wa(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),Ca(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=Ra(a=>{let o=Wa(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=Ra(e=>{e.target===t&&(a.current=Wa(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:d.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=Wa(t)}else r.current=null;n(e)},[])}}Ra(Va,`usePresence`);function Ha(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}Ra(Ha,`setRef`);function Ua(...e){let t=d.useRef(e);return t.current=e,d.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=Ha(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():Ha(n[e],null)}}},[])}Ra(Ua,`useStableComposedRefs`);function Wa(e){return e?.animationName||`none`}Ra(Wa,`getAnimationName`);function Ga(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Ra(Ga,`getElementRef`);var Ka=Object.defineProperty,qa=(e,t)=>Ka(e,`name`,{value:t,configurable:!0}),Ja=d.useId||(()=>void 0),Ya=0;function Xa(e){let[t,n]=d.useState(Ja());return Ca(()=>{e||n(e=>e??String(Ya++))},[e]),e||(t?`radix-${t}`:``)}qa(Xa,`useId`);var Za=Object.defineProperty,Qa=(e,t)=>Za(e,`name`,{value:t,configurable:!0}),$a=`Collapsible`,[eo,to]=ea($a),[no,ro]=eo($a),io=d.forwardRef(Qa(function(e,t){let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=Ma({prop:r,defaultProp:i??!1,onChange:o,caller:$a});return(0,E.jsx)(no,{scope:n,disabled:a,contentId:Xa(),open:c,onOpenToggle:d.useCallback(()=>l(e=>!e),[l]),children:(0,E.jsx)(Ji.div,{"data-state":uo(c),"data-disabled":a?``:void 0,...s,ref:t})})},`Collapsible`)),ao=`CollapsibleTrigger`,oo=d.forwardRef(Qa(function(e,t){let{__scopeCollapsible:n,...r}=e,i=ro(ao,n);return(0,E.jsx)(Ji.button,{type:`button`,"aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open||!1,"data-state":uo(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:va(e.onClick,i.onOpenToggle)})},`CollapsibleTrigger`)),so=`CollapsibleContent`,co=d.forwardRef(Qa(function(e,t){let{forceMount:n,...r}=e,i=ro(so,e.__scopeCollapsible);return(0,E.jsx)(Ba,{present:n||i.open,children:({present:e})=>(0,E.jsx)(lo,{...r,ref:t,present:e})})},`CollapsibleContent`)),lo=d.forwardRef(Qa(function(e,t){let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=ro(so,n),[s,c]=d.useState(r),l=d.useRef(null),u=ki(t,l),f=d.useRef(0),p=f.current,m=d.useRef(0),h=m.current,g=o.open||s,_=d.useRef(g),v=d.useRef(void 0);return d.useEffect(()=>{let e=requestAnimationFrame(()=>_.current=!1);return()=>cancelAnimationFrame(e)},[]),Ca(()=>{let e=l.current;if(e){v.current=v.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();f.current=t.height,m.current=t.width,_.current||(e.style.transitionDuration=v.current.transitionDuration,e.style.animationName=v.current.animationName),c(r)}},[o.open,r]),(0,E.jsx)(Ji.div,{"data-state":uo(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!g,...a,ref:u,style:{"--radix-collapsible-content-height":p?`${p}px`:void 0,"--radix-collapsible-content-width":h?`${h}px`:void 0,...e.style},children:g&&i})},`CollapsibleContentImpl`));function uo(e){return e?`open`:`closed`}Qa(uo,`getState`);var fo=io,po=Object.defineProperty,mo=(e,t)=>po(e,`name`,{value:t,configurable:!0}),ho=d.createContext(void 0);function go(e){let t=d.useContext(ho);return e||t||`ltr`}mo(go,`useDirection`);var _o=Object.defineProperty,vo=(e,t)=>_o(e,`name`,{value:t,configurable:!0});function yo(e){let t=d.useRef(e);return d.useEffect(()=>{t.current=e}),d.useMemo(()=>((...e)=>t.current?.(...e)),[])}vo(yo,`useCallbackRef`);var bo=Object.defineProperty,xo=(e,t)=>bo(e,`name`,{value:t,configurable:!0}),So=`dismissableLayer.update`,Co=`dismissableLayer.pointerDownOutside`,wo=`dismissableLayer.focusOutside`,To,Eo=d.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Do=d.forwardRef(xo(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=d.useContext(Eo),[f,p]=d.useState(null),m=f?.ownerDocument??globalThis?.document,[,h]=d.useState({}),g=ki(t,p),_=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=v?_.indexOf(v):-1,b=f?_.indexOf(f):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,S=b>=y,C=d.useRef(!1),w=Ao(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:m,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:C,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:d.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return S&&!t},[u.branches,S])}),T=jo(e=>{if(r&&C.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},m),D=f?b===_.length-1:!1,O=yo(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return d.useEffect(()=>{if(D)return m.addEventListener(`keydown`,O,{capture:!0}),()=>m.removeEventListener(`keydown`,O,{capture:!0})},[m,D,O]),d.useEffect(()=>{if(f)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(To=m.body.style.pointerEvents,m.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),Mo(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(f),u.layersWithOutsidePointerEventsDisabled.size===0&&(m.body.style.pointerEvents=To))}},[f,m,n,u]),d.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),Mo())},[f,u]),d.useEffect(()=>{let e=xo(()=>h({}),`handleUpdate`);return document.addEventListener(So,e),()=>document.removeEventListener(So,e)},[]),(0,E.jsx)(Ji.div,{...l,ref:g,style:{pointerEvents:x?S?`auto`:`none`:void 0,...e.style},onFocusCapture:va(e.onFocusCapture,T.onFocusCapture),onBlurCapture:va(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:va(e.onPointerDownCapture,w.onPointerDownCapture)})},`DismissableLayer`));function Oo(){let e=d.useContext(Eo),[t,n]=d.useState(null);return d.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}xo(Oo,`useDismissableLayerSurface`);var ko=xo(()=>!0,`IS_TRUE`);function Ao(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=ko}=t,s=yo(e),c=d.useRef(!1),l=d.useRef(!1),u=d.useRef(new Map),f=d.useRef(()=>{});return d.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}xo(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}xo(t,`isOutsideInteractionIntercepted`);function d(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&f.current()},0)}xo(d,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}xo(p,`handleInteractionBubble`);let m=xo(a=>{if(a.target&&!c.current){let d=function(){n.removeEventListener(`click`,f.current);let r=t();e(),r||No(Co,s,p,{discrete:!0})};if(xo(d,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,f.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?d():(n.removeEventListener(`click`,f.current),f.current=d,n.addEventListener(`click`,f.current,{once:!0}))}else n.removeEventListener(`click`,f.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,d,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,f.current);for(let e of h)n.removeEventListener(e,d,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:xo(()=>c.current=!0,`onPointerDownCapture`)}}xo(Ao,`usePointerDownOutside`);function jo(e,t=globalThis?.document){let n=yo(e),r=d.useRef(!1);return d.useEffect(()=>{let e=xo(e=>{e.target&&!r.current&&No(wo,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:xo(()=>r.current=!0,`onFocusCapture`),onBlurCapture:xo(()=>r.current=!1,`onBlurCapture`)}}xo(jo,`useFocusOutside`);function Mo(){let e=new CustomEvent(So);document.dispatchEvent(e)}xo(Mo,`dispatchUpdate`);function No(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Yi(i,a):i.dispatchEvent(a)}xo(No,`handleAndDispatchCustomEvent`);var Po=Object.defineProperty,Fo=(e,t)=>Po(e,`name`,{value:t,configurable:!0}),Io=`focusScope.autoFocusOnMount`,Lo=`focusScope.autoFocusOnUnmount`,Ro={bubbles:!1,cancelable:!0},zo=d.forwardRef(Fo(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=d.useState(null),l=yo(i),u=yo(a),f=d.useRef(null),p=ki(t,c),m=d.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;d.useEffect(()=>{if(r){let e=function(e){if(m.paused||!s)return;let t=e.target;s.contains(t)?f.current=t:Ko(f.current,{select:!0})},t=function(e){if(m.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Ko(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Ko(s)};Fo(e,`handleFocusIn`),Fo(t,`handleFocusOut`),Fo(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,m.paused]),d.useEffect(()=>{if(s){qo.add(m);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(Io,Ro);s.addEventListener(Io,l),s.dispatchEvent(t),t.defaultPrevented||(Bo(Xo(Ho(s)),{select:!0}),document.activeElement===e&&Ko(s))}return()=>{s.removeEventListener(Io,l),setTimeout(()=>{let t=new CustomEvent(Lo,Ro);s.addEventListener(Lo,u),s.dispatchEvent(t),t.defaultPrevented||Ko(e??document.body,{select:!0}),s.removeEventListener(Lo,u),qo.remove(m)},0)}}},[s,l,u,m]);let h=d.useCallback(e=>{if(!n&&!r||m.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=Vo(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Ko(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Ko(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,m.paused]);return(0,E.jsx)(Ji.div,{tabIndex:-1,...o,ref:p,onKeyDown:h})},`FocusScope`));function Bo(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Ko(r,{select:t}),document.activeElement!==n)return}Fo(Bo,`focusFirst`);function Vo(e){let t=Ho(e);return[Uo(t,e),Uo(t.reverse(),e)]}Fo(Vo,`getTabbableEdges`);function Ho(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:Fo(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}Fo(Ho,`getTabbableCandidates`);function Uo(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):Wo(r,{upTo:t})))return r}Fo(Uo,`findVisible`);function Wo(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}Fo(Wo,`isHidden`);function Go(e){return e instanceof HTMLInputElement&&`select`in e}Fo(Go,`isSelectableInput`);function Ko(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Go(e)&&t&&e.select()}}Fo(Ko,`focus`);var qo=Jo();function Jo(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Yo(e,t),e.unshift(t)},remove(t){e=Yo(e,t),e[0]?.resume()}}}Fo(Jo,`createFocusScopesStack`);function Yo(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}Fo(Yo,`arrayRemove`);function Xo(e){return e.filter(e=>e.tagName!==`A`)}Fo(Xo,`removeLinks`);var Zo=Object.defineProperty,Qo=d.forwardRef(((e,t)=>Zo(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=d.useState(!1);Ca(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?ii.createPortal((0,E.jsx)(Ji.div,{...r,ref:t}),o):null},`Portal`)),$o=Object.defineProperty,es=(e,t)=>$o(e,`name`,{value:t,configurable:!0}),ts=0,ns=null;function rs(e){return is(),e.children}es(rs,`FocusGuards`);function is(){d.useEffect(()=>{ns||={start:as(),end:as()};let{start:e,end:t}=ns;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),ts++,()=>{ts===1&&(ns?.start.remove(),ns?.end.remove(),ns=null),ts=Math.max(0,ts-1)}},[])}es(is,`useFocusGuards`);function as(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}es(as,`createFocusGuard`);var os=function(){return os=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},os.apply(this,arguments)};function ss(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function cs(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var ls=`right-scroll-bar-position`,us=`width-before-scroll-bar`,ds=`with-scroll-bars-hidden`,fs=`--removed-body-scroll-bar-size`;function ps(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function ms(e,t){var n=(0,d.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var hs=typeof window<`u`?d.useLayoutEffect:d.useEffect,gs=new WeakMap;function _s(e,t){var n=ms(t||null,function(t){return e.forEach(function(e){return ps(e,t)})});return hs(function(){var t=gs.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||ps(e,null)}),i.forEach(function(e){r.has(e)||ps(e,a)})}gs.set(n,e)},[e]),n}function vs(e){return e}function ys(e,t){t===void 0&&(t=vs);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function bs(e){e===void 0&&(e={});var t=ys(null);return t.options=os({async:!0,ssr:!1},e),t}var xs=function(e){var t=e.sideCar,n=ss(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return d.createElement(r,os({},n))};xs.isSideCarExport=!0;function Ss(e,t){return e.useMedium(t),xs}var Cs=bs(),ws=function(){},Ts=d.forwardRef(function(e,t){var n=d.useRef(null),r=d.useState({onScrollCapture:ws,onWheelCapture:ws,onTouchMoveCapture:ws}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,f=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,_=e.allowPinchZoom,v=e.as,y=v===void 0?`div`:v,b=e.gapMode,x=ss(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=p,C=_s([n,t]),w=os(os({},x),i);return d.createElement(d.Fragment,null,u&&d.createElement(S,{sideCar:Cs,removeScrollBar:l,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:a,allowPinchZoom:!!_,lockRef:n,gapMode:b}),o?d.cloneElement(d.Children.only(s),os(os({},w),{ref:C})):d.createElement(y,os({},w,{className:c,ref:C}),s))});Ts.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Ts.classNames={fullWidth:us,zeroRight:ls};var Es,Ds=function(){if(Es)return Es;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Os(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Ds();return t&&e.setAttribute(`nonce`,t),e}function ks(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function As(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var js=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Os())&&(ks(t,n),As(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Ms=function(){var e=js();return function(t,n){d.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Ns=function(){var e=Ms();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Ps={left:0,top:0,right:0,gap:0},Fs=function(e){return parseInt(e||``,10)||0},Is=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[Fs(n),Fs(r),Fs(i)]},Ls=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Ps;var t=Is(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Rs=Ns(),zs=`data-scroll-locked`,Bs=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
11
11
  .${ds} {
12
12
  overflow: hidden ${r};
13
13
  padding-right: ${s}px ${r};
@@ -344,13 +344,13 @@ l0,-`+(t+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
344
344
  `)?`\r
345
345
  `:`
346
346
  `,n=e.split(/\r?\n/),r=[],i=null,a=0,o=null;for(let e=0;e<n.length;e++){let t=n[e];if(o){r.push(t),RegExp(`</${o}\\s*>`,`i`).test(t)&&(o=null);continue}let s=t.match(/^ {0,3}(`{3,}|~{3,})/);if(s){let e=s[1][0],n=s[1].length;i?e===i.marker&&n>=i.size&&(i=null):i={marker:e,size:n},a=0,r.push(t);continue}if(i){r.push(t);continue}let c=t.match(/<(code|pre|script|style)\b/i);if(c){let e=c[1].toLowerCase(),n=t.slice((c.index??0)+c[0].length);RegExp(`</${e}\\s*>`,`i`).test(n)||(o=e),a=0,r.push(t);continue}if(/^(?: {4}|\t)/.test(t)||t.trim()===``){a=0,r.push(t);continue}if(a||t.includes("`")){a=uG(t,a),r.push(t);continue}let l=t.match(/^([ ]{0,3})\\\[[ \t]*(.+?)[ \t]*\\\][ \t]*$/);if(l){let e=l[2].trim();if(e){r.push(`${l[1]}$$`,e,`${l[1]}$$`);continue}}let u=t.match(/^([ ]{0,3})\\\[[ \t]*$/);if(u){let t=lG(n,e+1);if(t!==-1){r.push(`${u[1]}$$`,...n.slice(e+1,t),`${u[1]}$$`),e=t;continue}}let d=t.match(/^([ \t]{0,3})\$\$(.+)\$\$[ \t]*$/);if(d){let e=d[2].trim();if(e){r.push(`${d[1]}$$`,e,`${d[1]}$$`);continue}}r.push(dG(t))}return r.join(t)}function lG(e,t){for(let n=t;n<e.length;n++){let t=e[n];if(/^ {0,3}\\\][ \t]*$/.test(t))return n;if(/^ {0,3}(`{3,}|~{3,})/.test(t)||/^ {0,3}\\\[[ \t]*$/.test(t)||/<(code|pre|script|style)\b/i.test(t))return-1}return-1}function uG(e,t){let n=t;for(let t=0;t<e.length;){if(e[t]!=="`"){t++;continue}let r=t+1;for(;e[r]==="`";)r++;let i=r-t;n===0?n=i:i===n&&(n=0),t=r}return n}function dG(e){return/^\s{0,3}\[[^\]]+\]:/.test(e)||/]\s*\(/.test(e)||/<(?:!--|\/?[A-Za-z][^>]*>)/.test(e)||/\b(?:https?|file|mailto):/i.test(e)||/\b[A-Za-z]:\\/.test(e)?e:e.replace(/(?<!\\)\\\(([^`\r\n$]+?)(?<!\\)\\\)/g,(e,t)=>t.trim()?`$${t}$`:e)}var fG=[JW,oG],pG=[JW,oG],mG=[kV,[JV,sG],[OI,{throwOnError:!1,strict:!1}]],hG=[kV,[JV,sG],[OI,{throwOnError:!1,strict:!1}]];function gG(e){return/^[!+-].+/.test(e.trim())}function _G(e){return/^[a-zA-Z]:[\\/]/.test(e)||e.startsWith(`\\\\`)?e.replace(/\\/g,`/`):e}function vG(e){return _G(e).split(`/`).filter(Boolean).map(encodeURIComponent).join(`/`)}function yG(e){let t=_G(e).replace(/\/+$/,``);return t.split(`/`).pop()??t}function bG(e){let t=_G(e).replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n<0?``:n===0?`/`:n===2&&/^[a-zA-Z]:\//.test(t)?t.slice(0,3):t.slice(0,n)}function xG(e,t){if(!t)return e;let n=_G(e),r=_G(t).replace(/\/$/,``);return n.startsWith(`${r}/`)?n.slice(r.length+1):e}function SG(e,t){return`${_G(e).replace(/\/$/,``)}/${t}`}function CG({className:e,type:t,...n}){return(0,E.jsx)(`input`,{type:t,"data-slot":`input`,className:Cm(`h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}async function wG(e){let t=e?`?path=${encodeURIComponent(e)}`:``,n=await fetch(`/api/cwd/browse${t}`),r=await n.json();if(!n.ok||r.error)throw Error(r.error??`HTTP ${n.status}`);return r}var TG={backgroundColor:`#ffffff`,color:`#0f1115`};function EG(){return(0,E.jsx)(`svg`,{width:p.xl,height:p.xl,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.3`,"aria-hidden":`true`,children:(0,E.jsx)(`path`,{d:`M1.5 3h4l1.5 2h7.5v7.5h-13z`})})}function DG(){return(0,E.jsxs)(`svg`,{width:p.xl,height:p.xl,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.3`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,E.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`10`,rx:`1.5`}),(0,E.jsx)(`path`,{d:`M2 9h12`}),(0,E.jsx)(`circle`,{cx:`11.5`,cy:`11`,r:`0.6`,fill:`currentColor`,stroke:`none`})]})}function OG(e){return/^[a-zA-Z]:[\\/]?$/.test(e)}function kG(){return(0,E.jsxs)(`svg`,{width:p.xl,height:p.xl,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.3`,"aria-hidden":`true`,children:[(0,E.jsx)(`path`,{d:`M4 1.5h5l3 3v10h-8z`}),(0,E.jsx)(`path`,{d:`M9 1.5v3h3`})]})}function AG(e){return e.replace(/\\/g,`/`)}function jG({open:e,onCancel:t,onConfirm:n,title:r,confirmText:i,cancelText:a,noteLabel:o,notePlaceholder:s,busy:c=!1,error:l,showFiles:u=!0,showExtensionFilter:f=!1,extensionOptions:m=[],initialPath:h}){let{t:g}=N(),[_,v]=(0,d.useState)(``),[y,b]=(0,d.useState)(null),[x,S]=(0,d.useState)(``),[C,w]=(0,d.useState)([]),[T,D]=(0,d.useState)([]),[O,k]=(0,d.useState)(null),[A,j]=(0,d.useState)(null),[M,P]=(0,d.useState)(``),[ee,F]=(0,d.useState)(``),[te,ne]=(0,d.useState)(``),[re,ie]=(0,d.useState)(null),[ae,oe]=(0,d.useState)(!0),I=(0,d.useRef)(null),L=(0,d.useCallback)(async e=>{oe(!0),ie(null);try{let t=await wG(e),n=AG(t.path??e??`/`);v(n),b(t.parentPath?AG(t.parentPath):null),S(n),w((t.directories??[]).map(e=>({...e,path:AG(e.path)}))),D((t.files??[]).map(e=>({...e,path:AG(e.path)}))),k(t.drives??null),j(null),F(``),ne(``)}catch(e){ie(e instanceof Error?e.message:String(e))}finally{oe(!1)}},[]);(0,d.useEffect)(()=>{e&&(P(``),L(h))},[e,L,h]);let se=e=>{e.preventDefault();let t=AG(x.trim());t&&L(t)},R=!!y||OG(_),ce=ee.trim().toLowerCase(),le=e=>!ce||e.toLowerCase().includes(ce),ue=O===null?[]:O.filter(e=>le(e.name)||le(e.path)),de=C.filter(e=>le(e.name)),fe=u?T.filter(e=>le(e.name)).filter(e=>!te||e.name.toLowerCase().endsWith(te.toLowerCase())):[],pe=!!A&&!c;return(0,E.jsx)(Ax,{open:e,onOpenChange:e=>{!e&&!c&&t()},children:(0,E.jsxs)(Px,{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=>{c&&e.preventDefault()},onEscapeKeyDown:e=>{c&&e.preventDefault()},onOpenAutoFocus:e=>{e.preventDefault(),I.current?.focus()},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,flexShrink:0,padding:`12px 18px`,borderBottom:`1px solid var(--border)`},children:[(0,E.jsx)(Fx,{style:{fontWeight:700,fontSize:`var(--text-2xl)`,color:`var(--text)`},children:r}),(0,E.jsx)(Mx,{asChild:!0,children:(0,E.jsx)(`button`,{type:`button`,disabled:c,title:g(`i18n.close`),"aria-label":g(`i18n.close`),style:{padding:`2px 6px`,border:0,background:`none`,color:`var(--text-muted)`,fontSize:`var(--text-5xl)`,lineHeight:1,cursor:c?`default`:`pointer`,opacity:c?.5:1},children:`×`})})]}),o&&(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,flexShrink:0,padding:`10px 14px`,borderBottom:`1px solid var(--border)`},children:[(0,E.jsx)(`label`,{htmlFor:`file-picker-note`,style:{fontSize:`var(--text-sm)`,color:`var(--text-muted)`,whiteSpace:`nowrap`},children:o}),(0,E.jsx)(CG,{id:`file-picker-note`,className:`h-9 flex-1 bg-bg-panel`,type:`text`,value:M,placeholder:s,autoComplete:`off`,style:TG,onChange:e=>P(e.target.value)})]}),(0,E.jsxs)(`form`,{onSubmit:se,style:{display:`flex`,alignItems:`center`,gap:8,flexShrink:0,padding:`10px 14px`,borderBottom:`1px solid var(--border)`},children:[(0,E.jsx)(`button`,{type:`button`,onClick:()=>void L(y??void 0),disabled:ae||!R,title:g(`directoryPicker.goToParent`),"aria-label":g(`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:TG.backgroundColor,color:`var(--text-muted)`,cursor:R?`pointer`:`default`,opacity:R?1:.45},children:(0,E.jsx)(`svg`,{width:p[`3xl`],height:p[`3xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,E.jsx)(`path`,{d:`m18 15-6-6-6 6`})})}),(0,E.jsx)(`label`,{htmlFor:`file-picker-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:g(`directoryPicker.directoryPath`)}),(0,E.jsx)(CG,{className:`h-9 flex-1 font-mono text-xs bg-bg-panel`,id:`file-picker-path`,type:`text`,ref:I,value:x,placeholder:`/path/to/folder or ~/folder`,autoComplete:`off`,spellCheck:!1,style:TG,onChange:e=>{S(AG(e.target.value)),ie(null)}}),(0,E.jsx)(`button`,{type:`submit`,disabled:ae||!x.trim(),title:g(`directoryPicker.goToDirectory`),style:{minWidth:58,height:36,padding:`0 12px`,border:`1px solid var(--border)`,borderRadius:6,background:TG.backgroundColor,color:`var(--text-muted)`,cursor:ae||!x.trim()?`default`:`pointer`,opacity:ae||!x.trim()?.6:1},children:g(`directoryPicker.go`)})]}),(0,E.jsxs)(`div`,{className:`directory-picker-list`,style:{flex:1,minHeight:0,overflow:`auto`,padding:`8px 10px`},children:[ae?(0,E.jsx)(`div`,{style:{padding:8,color:`var(--text-dim)`,fontSize:`var(--text-sm)`},children:g(`directoryPicker.loadingDirectories`)}):O===null?de.length>0||fe.length>0?(0,E.jsxs)(E.Fragment,{children:[de.map(e=>(0,E.jsxs)(`button`,{type:`button`,onClick:()=>void L(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,E.jsx)(EG,{}),(0,E.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.name})]},e.path)),fe.map(e=>{let t=A===e.path;return(0,E.jsxs)(`button`,{type:`button`,onClick:()=>j(e.path),title:e.path,style:{width:`100%`,minHeight:30,display:`flex`,alignItems:`center`,gap:7,padding:`5px 8px`,border:0,borderRadius:5,background:t?`color-mix(in srgb, var(--accent) 14%, transparent)`:`none`,color:t?`var(--accent)`:`var(--text-muted)`,cursor:`pointer`,textAlign:`left`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`},children:[(0,E.jsx)(kG,{}),(0,E.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.name})]},e.path)})]}):(0,E.jsx)(`div`,{style:{padding:8,color:`var(--text-dim)`,fontSize:`var(--text-sm)`},children:g(ce?`directoryPicker.noMatches`:u?`i18n.noFiles`:`directoryPicker.noSubdirectories`)}):ue.length>0?ue.map(e=>(0,E.jsxs)(`button`,{type:`button`,onClick:()=>void L(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,E.jsx)(DG,{}),(0,E.jsx)(`span`,{children:e.name})]},e.path)):(0,E.jsx)(`div`,{style:{padding:8,color:`var(--text-dim)`,fontSize:`var(--text-sm)`},children:g(ce?`directoryPicker.noMatches`:`directoryPicker.noDrives`)}),(re||l)&&(0,E.jsx)(`div`,{style:{padding:`8px`,color:`var(--status-error)`,fontSize:`var(--text-sm)`},children:re??l})]}),(0,E.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,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,flex:1,minWidth:0},children:[f&&m.length>0&&(0,E.jsxs)(`select`,{value:te,onChange:e=>ne(e.target.value),"aria-label":g(`i18n.filterByType`),style:{flexShrink:0,height:32,padding:`0 6px`,border:`1px solid var(--border)`,borderRadius:6,background:`var(--bg-panel)`,color:`var(--text)`,fontSize:`var(--text-sm)`},children:[(0,E.jsx)(`option`,{value:``,children:g(`i18n.allFiles`)}),m.map(e=>(0,E.jsx)(`option`,{value:e,children:e},e))]}),(0,E.jsxs)(`svg`,{width:p.lg,height:p.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,E.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,E.jsx)(`path`,{d:`m21 21-4.3-4.3`})]}),(0,E.jsx)(CG,{className:`directory-picker-search h-8 flex-1 bg-bg-panel`,type:`text`,value:ee,placeholder:g(`directoryPicker.search`),"aria-label":g(`directoryPicker.search`),autoComplete:`off`,spellCheck:!1,style:TG,onChange:e=>F(e.target.value)})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,flexShrink:0},children:[(0,E.jsx)(`button`,{type:`button`,onClick:t,disabled:c,style:{padding:`6px 14px`,border:`1px solid var(--border)`,borderRadius:6,background:`none`,color:`var(--text-muted)`,cursor:c?`default`:`pointer`,fontSize:`var(--text-lg)`},children:a??g(`i18n.cancel`)}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>A&&n(A,M.trim()),disabled:!pe,title:A?void 0:g(`i18n.selectFile`),style:{padding:`6px 16px`,border:0,borderRadius:6,background:`var(--accent)`,color:`var(--on-accent)`,fontSize:`var(--text-lg)`,fontWeight:600,opacity:pe?1:.6,cursor:pe?`pointer`:`default`},children:c?g(`i18n.checking`):A?`${i}: ${yG(A)}`:i})]})]})]})})}var MG={display:`inline-flex`,alignItems:`center`,gap:4,maxWidth:220,padding:`4px 10px`,borderRadius:12,border:`1px solid var(--accent)`,background:`color-mix(in srgb, var(--accent) 12%, transparent)`,color:`var(--accent)`,fontSize:`var(--text-sm)`,overflow:`hidden`,whiteSpace:`nowrap`,textOverflow:`ellipsis`},NG={minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`};function PG({label:e,onClick:t,onRemove:n,title:r,removeLabel:i,testId:a}){return n?(0,E.jsxs)(`span`,{"data-testid":a,title:r,style:MG,children:[(0,E.jsx)(`button`,{type:`button`,title:r,onClick:t,style:{...NG,flex:1,background:`none`,border:`none`,color:`inherit`,font:`inherit`,padding:0,textAlign:`left`,cursor:t?`pointer`:`default`},children:e}),(0,E.jsx)(`button`,{type:`button`,"aria-label":i??r??`remove`,onClick:n,style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,marginLeft:`auto`,padding:2,borderRadius:4,color:`inherit`,background:`none`,border:`none`,cursor:`pointer`,flexShrink:0},children:(0,E.jsx)(ni,{size:p.sm})})]}):(0,E.jsx)(`button`,{type:`button`,"data-testid":a,title:r,onClick:t,style:{...MG,font:`inherit`,textAlign:`left`,cursor:t?`pointer`:`default`},children:(0,E.jsx)(`span`,{style:NG,children:e})})}function FG(e){try{return decodeURIComponent(e)}catch{return e}}function IG(e){return/^[a-zA-Z]:[\\/]/.test(e)||e.startsWith(`\\\\`)?e.replace(/\\/g,`/`):e}function LG(e){return e.replace(/:\d+(?::\d+)?$/,``)}function RG(e){let t=IG(e),n=/^[a-zA-Z]:\//.test(t),r=t.startsWith(`//`),i=t.startsWith(`/`)&&!n&&!r,a=[];for(let e of t.split(`/`))if(!(!e||e===`.`)){if(e===`..`){a.length>0&&a[a.length-1]!==`..`?a.pop():!i&&!n&&!r&&a.push(e);continue}a.push(e)}let o=a.join(`/`);return n?o:r?`//${o}`:i?`/${o}`:o}function zG(e,t){let n=RG(e).replace(/\/+$/,``),r=RG(t).replace(/\/+$/,``),i=/^[a-zA-Z]:\//.test(n)||/^[a-zA-Z]:\//.test(r),a=i?n.toLowerCase():n,o=i?r.toLowerCase():r;return a===o||a.startsWith(`${o}/`)}function BG(e){return e.startsWith(`#`)||e.startsWith(`?`)?!1:e.startsWith(`./`)||e.startsWith(`../`)||e.includes(`/`)?!0:/(^|\/)\.?[^/]+\.[^/.]+$/.test(e)}function VG(e){try{let t=new URL(e);if(t.protocol!==`file:`)return null;let n=FG(t.pathname);return t.hostname?`//${t.hostname}${n.startsWith(`/`)?n:`/${n}`}`:/^\/[a-zA-Z]:\//.test(n)?n.slice(1):n}catch{return null}}function HG(e,t,n=t){if(!e)return null;let r=e.split(`#`,1)[0].split(`?`,1)[0].trim();if(!r)return null;let i=null,a=null,o=FG(r),s=o.startsWith(`\\\\`),c=IG(o),l=c.toLowerCase();if(l.startsWith(`/api/`)||l.startsWith(`/_next/`)||!s&&c.startsWith(`//`)||/^[a-zA-Z][a-zA-Z0-9+.-]*:/i.test(c)&&!l.startsWith(`file:`)&&!/^[a-zA-Z]:\//.test(c)||(l.startsWith(`file:`)?(i=VG(c),a=i?`absolute`:null):/^[a-zA-Z]:\//.test(c)||c.startsWith(`/`)?(i=c,a=`absolute`):t&&BG(c)&&(i=`${IG(t).replace(/\/+$/,``)}/${c}`,a=`relative`),!i))return null;let u=LG(RG(i));return a===`relative`&&n&&!zG(u,n)?null:u}function UG(e,t){if(!e)return{kind:`external`};let n=e.split(`#`,1)[0].split(`?`,1)[0].trim();if(!n||n.startsWith(`#`)||n.startsWith(`?`))return{kind:`external`};let r=FG(n);if(r.startsWith(`\\\\`))return{kind:`unsafe`};let i=IG(r);if(/^[a-zA-Z]:[\\/]/.test(i))return{kind:`unsafe`};if(/^[a-zA-Z][a-zA-Z0-9+.-]*:/i.test(i)||i.startsWith(`//`))return{kind:`external`};if(i.startsWith(`/`))return{kind:`unsafe`};let a=RG(`${IG(t).replace(/\/+$/,``)}/${i}`);return zG(a,t)?{kind:`safe`,path:LG(a)}:{kind:`unsafe`}}function WG({href:e,markdownDir:t,onOpenFile:n,children:r,...i}){let{t:a}=N();if(!e||!n)return(0,E.jsx)(`a`,{href:e,...i,children:r});let o=UG(e,t),s=t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(o.kind===`safe`?(t.preventDefault(),n(o.path)):o.kind===`unsafe`&&(t.preventDefault(),window.alert(a(`i18n.unsafeLinkBlocked`,{href:e}))))};return o.kind===`external`?(0,E.jsx)(`a`,{href:e,...i,target:`_blank`,rel:`noopener noreferrer`,children:r}):(0,E.jsx)(`a`,{href:e,...i,onClick:s,children:r})}function GG(e){return e.replace(/^\/(?:Users|home)\/[^/]+/,`~`)}var KG=`package`,qG=null,JG=null;function YG(e){return e.trim().match(/^\$?\s*pi\s+install\s+(\S+)\s*$/)?.[1]??e}function XG(e){return`${e.scope}\0${e.source}`}function ZG(e){return`${e.scope}\0${e.pattern}`}function QG(e,t){if(e.disabled)return t(`i18n.disabled`);let n=e.version||e.configuredVersion;return[n?`${t(`i18n.versionShort`)}:${n}`:``,`${t(`i18n.extensionShort`)}:${e.counts.extensions}`,`${t(`i18n.skillShort`)}:${e.counts.skills}`].filter(Boolean).join(` `)}function $G(e,t){let n=[];return e.version&&n.push(t(`i18n.installedVersion`,{version:e.version})),e.configuredVersion&&n.push(t(`i18n.configuredVersion`,{version:e.configuredVersion})),n.length?n.join(` · `):t(`i18n.unknown`)}function eK(e,t){return e===`project`?`${GG(t)}/.pi/agent/{npm,git}`:`~/.pi/agent/{npm,git}`}function tK(e,t,n){let r=t.trim(),i=r.startsWith(`npm:`)?r.slice(4):r;return e.find(e=>e.scope===n&&e.source===r)??e.find(e=>e.scope===n&&e.source===`npm:${i}`)??e.find(e=>e.scope===n&&e.source.endsWith(r))}function nK(e){let t=e[0];return t===`!`?`var(--status-error)`:t===`+`?`var(--status-success)`:`var(--text-dim)`}function rK(e,t){let n=e[0];return t(n===`!`?`plugins.filterPrefixExclude`:n===`+`?`plugins.filterPrefixForceInclude`:`plugins.filterPrefixForceExclude`)}function iK(e){return e===`loaded`?`var(--accent)`:e===`installed`?`var(--status-warning)`:e===`disabled`?`var(--text-dim)`:`var(--status-error)`}function aK(e,t){switch(e){case`loaded`:return t(`plugins.statusLoaded`);case`installed`:return t(`plugins.statusInstalled`);case`disabled`:return t(`plugins.statusDisabled`);default:return t(`plugins.statusMissing`)}}function oK({pkg:e}){let{t}=N(),n=[[`extension`,t(`i18n.extensions`)],[`skill`,t(`i18n.skills`)],[`prompt`,t(`i18n.prompts`)],[`theme`,t(`i18n.themes`)]].map(([t,n])=>({kind:t,label:n,resources:e.resources.filter(e=>e.kind===t)})).filter(e=>e.resources.length>0);return n.length===0?(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,color:`var(--text-dim)`},children:e.disabled?t(`i18n.packageDisabled`):t(`i18n.noResolvedResources`)}):(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:n.map((e,t)=>(0,E.jsxs)(`div`,{style:{borderTop:t===0?`none`:`1px solid var(--border)`,paddingTop:t===0?0:12},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-xs)`,fontWeight:700,color:`var(--text-dim)`,textTransform:`uppercase`,marginBottom:6},children:e.label}),(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:e.resources.map(e=>(0,E.jsxs)(`div`,{style:{minWidth:0},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,color:`var(--text)`,fontFamily:`var(--font-mono)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},title:e.path,children:e.name}),(0,E.jsx)(`div`,{style:{fontSize:`var(--text-xs)`,color:`var(--text-dim)`,fontFamily:`var(--font-mono)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,marginTop:1},title:e.path,children:e.relativePath})]},`${e.kind}:${e.path}`))})]},e.kind))})}function sK({scope:e}){return(0,E.jsx)(`span`,{style:{fontSize:`var(--text-xs)`,padding:`1px 5px`,borderRadius:3,flexShrink:0,background:e===`project`?`color-mix(in srgb, var(--status-info) 12%, transparent)`:`color-mix(in srgb, var(--text-dim) 12%, transparent)`,color:e===`project`?`color-mix(in srgb, var(--status-info) 85%, transparent)`:`var(--text-dim)`},children:e})}function cK(e,t){return{padding:`6px 12px`,background:t?`color-mix(in srgb, var(--status-error) 8%, transparent)`:`none`,border:`1px solid var(--border)`,borderRadius:6,color:t?`var(--status-error)`:`var(--text-muted)`,cursor:e?`not-allowed`:`pointer`,fontSize:`var(--text-base)`,opacity:e?.5:1}}function lK({enabled:e,loading:t,onToggle:n,label:r,testId:i}){return(0,E.jsx)(`button`,{type:`button`,"data-testid":i,onClick:n,disabled:t,title:r,"aria-label":r,"aria-pressed":e,style:{flexShrink:0,width:40,height:22,borderRadius:11,border:`none`,padding:0,cursor:t?`wait`:`pointer`,background:e?`var(--accent)`:`var(--border)`,position:`relative`,transition:`background 0.18s`,outline:`none`,opacity:t?.65:1},children:(0,E.jsx)(`span`,{style:{position:`absolute`,top:3,left:e?21:3,width:16,height:16,borderRadius:`50%`,background:`var(--bg)`,boxShadow:`0 1px 4px var(--shadow-color)`,transition:`left 0.18s cubic-bezier(.4,0,.2,1)`}})})}function uK({value:e,projectResourcesLoaded:t,onChange:n}){let{t:r}=N();return(0,E.jsx)(zx,{value:e,onChange:n,options:[`global`,`project`].map(e=>({value:e,label:e,disabled:e===`project`&&!t,title:e===`project`&&!t?r(`trust.projectScopeUnavailable`):void 0}))})}function dK(e){return{width:`100%`,height:36,padding:`0 11px`,border:`1px solid ${e}`,borderRadius:6,background:`var(--bg-input)`,color:`var(--text)`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-lg)`,outline:`none`}}function fK({examples:e,onPick:t}){return(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:7},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,fontWeight:600,color:`var(--text-muted)`},children:`Examples`}),(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:e.map(e=>(0,E.jsx)(`button`,{type:`button`,onClick:()=>t(e),style:{width:`100%`,minHeight:30,textAlign:`left`,padding:`6px 9px`,border:`1px solid var(--border)`,borderRadius:6,background:`var(--bg-panel)`,color:`var(--text-dim)`,cursor:`pointer`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,"--hover-color":`var(--text-muted)`,"--hover-bg":`var(--bg-hover)`},className:`hover-shift`,children:e},e))})]})}function pK({scope:e,projectResourcesLoaded:t,onScopeChange:n,actionBusy:r,actionDisabled:i,actionLabel:a,onAction:o,actionTestId:s}){let{t:c}=N();return(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,flexWrap:`wrap`},children:[(0,E.jsx)(uK,{value:e,projectResourcesLoaded:t,onChange:n}),(0,E.jsx)(`button`,{type:`button`,"data-testid":s,onClick:o,disabled:i,style:{...cK(i),background:`var(--accent)`,color:`var(--on-accent)`,borderColor:`var(--accent)`},children:r?c(`i18n.installing`):a})]})}var mK=`/recommended-plugins.json`;function hK({packages:e,onPick:t}){let{t:n,locale:r}=N(),[i,a]=(0,d.useState)([]);if((0,d.useEffect)(()=>{fetch(mK).then(e=>e.json()).then(e=>{Array.isArray(e)&&a(e)}).catch(()=>{})},[]),i.length===0)return null;let o=r===`zh-CN`?`zh`:`en`;return(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:7},children:[(0,E.jsxs)(`div`,{style:{fontSize:`var(--text-base)`,fontWeight:600,color:`var(--text-muted)`,display:`flex`,alignItems:`center`,gap:6},children:[(0,E.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{color:`var(--accent)`},children:[(0,E.jsx)(`path`,{d:`M12 2L2 7l10 5 10-5-10-5z`}),(0,E.jsx)(`path`,{d:`M2 17l10 5 10-5`}),(0,E.jsx)(`path`,{d:`M2 12l10 5 10-5`})]}),n(`i18n.recommendedPlugins`)]}),(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:i.map(r=>{let i=e.some(e=>e.source===r.source||e.source===`npm:${r.source.replace(/^npm:/,``)}`||e.source.endsWith(r.source.replace(/^npm:/,``))),a=typeof r.name==`object`?r.name[o]??r.name.en:r.name,s=typeof r.description==`object`?r.description[o]??r.description.en:r.description;return(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8,padding:`8px 10px`,border:`1px solid var(--border)`,borderRadius:6,background:`var(--bg-panel)`},children:[(0,E.jsxs)(`div`,{style:{minWidth:0,flex:1},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,fontWeight:600,color:`var(--text)`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:a}),(0,E.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:s})]}),i?(0,E.jsx)(`span`,{style:{fontSize:`var(--text-sm)`,color:`var(--status-success)`,whiteSpace:`nowrap`,flexShrink:0,display:`inline-flex`,alignItems:`center`,gap:4},children:n(`i18n.installed`)}):(0,E.jsx)(`button`,{type:`button`,onClick:()=>t(r.source),className:`hover-shift`,style:{flexShrink:0,padding:`5px 12px`,border:`1px solid var(--accent)`,borderRadius:6,background:`transparent`,color:`var(--accent)`,cursor:`pointer`,fontSize:`var(--text-sm)`,fontWeight:600,whiteSpace:`nowrap`},children:n(`i18n.install`)})]},r.source)})})]})}function gK({cwd:e,source:t,scope:n,projectResourcesLoaded:r,busy:i,actionError:a,packages:o,onSourceChange:s,onScopeChange:c,onInstall:l}){let{t:u}=N(),f=(0,d.useRef)(null);return(0,d.useEffect)(()=>{f.current?.focus()},[]),(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:18,maxWidth:660,minHeight:`100%`},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:12,flexWrap:`wrap`},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-xl)`,fontWeight:700,color:`var(--text)`},children:u(`i18n.addPlugin`)}),(0,E.jsxs)(`a`,{href:`https://pi.dev/packages`,target:`_blank`,rel:`noopener noreferrer`,style:{display:`inline-flex`,alignItems:`center`,gap:5,color:`var(--accent)`,fontSize:`var(--text-base)`,textDecoration:`none`,whiteSpace:`nowrap`},children:[(0,E.jsxs)(`svg`,{width:`28`,height:`28`,viewBox:`0 0 800 800`,"aria-hidden":`true`,focusable:`false`,style:{flexShrink:0},children:[(0,E.jsx)(`path`,{fill:`#000`,fillRule:`evenodd`,d:`M165.29 165.29H517.36V400H400V517.36H282.65V634.72H165.29ZM282.65 282.65V400H400V282.65Z`}),(0,E.jsx)(`path`,{fill:`#000`,d:`M517.36 400H634.72V634.72H517.36Z`})]}),`pi.dev/packages`]})]}),(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,color:`var(--text-dim)`,fontFamily:`var(--font-mono)`},children:eK(n,e)})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:7},children:[(0,E.jsx)(`label`,{htmlFor:`plugin-source`,style:{fontSize:`var(--text-base)`,fontWeight:600,color:`var(--text-muted)`},children:`Source`}),(0,E.jsx)(oi,{label:(0,E.jsxs)(`span`,{style:{display:`flex`,flexDirection:`column`,gap:2,fontSize:`var(--text-sm)`,fontFamily:`var(--font-mono)`,lineHeight:1.5},children:[(0,E.jsx)(`span`,{children:`npm:@scope/package`}),(0,E.jsx)(`span`,{children:`git:https://github.com/user/repo`}),(0,E.jsx)(`span`,{children:`/absolute/path/to/plugin`})]}),children:(0,E.jsx)(`input`,{id:`plugin-source`,ref:f,value:t,onChange:e=>s(e.target.value),onPaste:e=>{let t=e.clipboardData.getData(`text`),n=YG(t);n!==t&&(e.preventDefault(),s(n))},onBlur:e=>s(YG(e.currentTarget.value)),placeholder:u(`plugins.npmSourcePlaceholder`),style:dK(`var(--border)`),onKeyDown:e=>{e.key===`Enter`&&t.trim()&&!i&&l()}})})]}),(0,E.jsx)(pK,{scope:n,projectResourcesLoaded:r,onScopeChange:c,actionBusy:i,actionDisabled:i||!t.trim(),actionLabel:u(`i18n.install`),onAction:l}),(0,E.jsx)(hK,{packages:o,onPick:s}),a&&(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,color:`var(--status-error)`,whiteSpace:`pre-wrap`},children:a})]})}function _K({pattern:e,scope:t,projectResourcesLoaded:n,busy:r,actionError:i,onPatternChange:a,onScopeChange:o,onAdd:s}){let{t:c}=N(),l=(0,d.useRef)(null),u=e.trim(),f=u.length>0&&!gG(u);return(0,d.useEffect)(()=>{l.current?.focus()},[]),(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:18,maxWidth:660,minHeight:`100%`},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-xl)`,fontWeight:700,color:`var(--text)`},children:c(`plugins.addFilter`)}),(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,color:`var(--text-dim)`,lineHeight:1.5},children:c(`plugins.extensionFiltersHint`)})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:7},children:[(0,E.jsx)(`label`,{htmlFor:`extension-filter-pattern`,style:{fontSize:`var(--text-base)`,fontWeight:600,color:`var(--text-muted)`},children:c(`plugins.filterPatternLabel`)}),(0,E.jsx)(`input`,{id:`extension-filter-pattern`,"data-testid":`extension-filter-pattern`,ref:l,value:e,onChange:e=>a(e.target.value),placeholder:c(`plugins.filterPlaceholder`),style:dK(f?`var(--status-error)`:`var(--border)`),onKeyDown:e=>{e.key===`Enter`&&u&&!f&&!r&&s()}}),f&&(0,E.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--status-error)`},children:c(`plugins.filterInvalid`)})]}),(0,E.jsx)(pK,{scope:t,projectResourcesLoaded:n,onScopeChange:o,actionBusy:r,actionDisabled:r||!u||f,actionLabel:c(`plugins.addFilter`),onAction:s,actionTestId:`extension-filter-add`}),(0,E.jsx)(fK,{examples:[`!**/*.test.ts`,`+./my-ext.ts`,`-./legacy-ext.ts`],onPick:a}),(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,E.jsxs)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`,lineHeight:1.6},children:[(0,E.jsx)(`span`,{style:{color:`var(--status-error)`,fontWeight:700},children:`!`}),` `,c(`plugins.filterPrefixExclude`)]}),(0,E.jsxs)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`,lineHeight:1.6},children:[(0,E.jsx)(`span`,{style:{color:`var(--status-success)`,fontWeight:700},children:`+`}),` `,c(`plugins.filterPrefixForceInclude`)]}),(0,E.jsxs)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`,lineHeight:1.6},children:[(0,E.jsx)(`span`,{style:{color:`var(--text-dim)`,fontWeight:700},children:`-`}),` `,c(`plugins.filterPrefixForceExclude`)]})]}),i&&(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,color:`var(--status-error)`,whiteSpace:`pre-wrap`},children:i})]})}function vK({filter:e,busyKey:t,actionError:n,actionMessage:r,onRemove:i}){let{t:a}=N(),o=ZG(e),s=t?.endsWith(o)??!1;return(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:20},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,justifyContent:`space-between`,gap:12,minWidth:0,flexWrap:`wrap`},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,minWidth:180,flex:1},children:[(0,E.jsx)(sK,{scope:e.scope}),(0,E.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`var(--text-lg)`,color:`var(--text)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.pattern})]}),(0,E.jsx)(`button`,{"data-testid":`extension-filter-remove`,onClick:()=>i(e),disabled:s,style:cK(s,!0),children:a(s?`i18n.removing`:`plugins.removeFilter`)})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,fontWeight:700,color:`var(--text)`},children:a(`plugins.filterEffect`)}),(0,E.jsxs)(`div`,{style:{fontSize:`var(--text-base)`,color:`var(--text-muted)`,lineHeight:1.55},children:[(0,E.jsx)(`span`,{style:{color:nK(e.pattern),fontWeight:700,fontFamily:`var(--font-mono)`},children:e.pattern[0]}),` `,rK(e.pattern,a)]}),(0,E.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`,lineHeight:1.5},children:a(`plugins.extensionFiltersHint`)})]}),r&&(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,color:`var(--status-success)`},children:r}),n&&(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,color:`var(--status-error)`,whiteSpace:`pre-wrap`},children:n})]})}function yK({pkg:e,busyKey:t,actionError:n,actionMessage:r,sessionId:i,onAction:a,onReloadSession:o,onOpenFile:s}){let{t:c}=N(),{pluginConfigBindings:l,addPluginConfigBinding:u,removePluginConfigBinding:d}=ge(),f=XG(e),p=t?.endsWith(f)??!1,m=t===`reload`,h=!e.disabled;return(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:20},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,justifyContent:`space-between`,gap:12,minWidth:0,flexWrap:`wrap`},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,minWidth:180,flex:1},children:[(0,E.jsx)(lK,{enabled:h,loading:p||m,onToggle:()=>a(e.disabled?`enable`:`disable`,e),label:e.disabled?c(`i18n.enablePackage`):c(`i18n.disablePackage`),testId:`package-toggle`}),(0,E.jsx)(sK,{scope:e.scope}),e.disabled?(0,E.jsx)(`span`,{style:{fontSize:`var(--text-xs)`,padding:`1px 5px`,borderRadius:3,background:`color-mix(in srgb, var(--text-dim) 12%, transparent)`,color:`var(--text-dim)`},children:c(`i18n.disabled`)}):e.filtered&&(0,E.jsx)(`span`,{style:{fontSize:`var(--text-xs)`,padding:`1px 5px`,borderRadius:3,background:`color-mix(in srgb, var(--status-warning) 12%, transparent)`,color:`var(--status-warning)`},children:c(`i18n.filtered`)}),(0,E.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`var(--text-base)`,color:`var(--text)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.source})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,gap:8,flexWrap:`wrap`},children:[(0,E.jsx)(`button`,{onClick:()=>a(`update`,e),disabled:p||m,style:cK(p||m),children:t===`update:${f}`?c(`i18n.updating`):c(`i18n.update`)}),(0,E.jsx)(`button`,{onClick:o,disabled:!i||m||p,style:cK(!i||m||p),title:c(i?`i18n.reloadSession`:`i18n.openSessionToReload`),children:c(m?`i18n.reloading`:`i18n.reloadSession`)}),(0,E.jsx)(`button`,{onClick:()=>a(`remove`,e),disabled:p||m,style:cK(p||m,!0),children:t===`remove:${f}`?c(`i18n.removing`):c(`i18n.remove`)})]})]}),(0,E.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`minmax(96px, 130px) minmax(0, 1fr)`,gap:`9px 14px`,fontSize:`var(--text-base)`,lineHeight:1.45},children:[(0,E.jsx)(`div`,{style:{color:`var(--text-dim)`},children:c(`i18n.status`)}),(0,E.jsx)(`div`,{style:{color:iK(e.status),textTransform:`capitalize`},children:e.status}),(0,E.jsx)(`div`,{style:{color:`var(--text-dim)`},children:c(`i18n.version`)}),(0,E.jsx)(`div`,{style:{color:`var(--text-muted)`,fontFamily:`var(--font-mono)`},children:$G(e,c)}),(0,E.jsx)(`div`,{style:{color:`var(--text-dim)`},children:c(`i18n.package`)}),(0,E.jsx)(`div`,{style:{color:`var(--text-muted)`,fontFamily:`var(--font-mono)`,overflowWrap:`anywhere`},children:e.packageName??c(`i18n.unknown`)}),(0,E.jsx)(`div`,{style:{color:`var(--text-dim)`},children:c(`i18n.resources`)}),(0,E.jsx)(`div`,{style:{color:`var(--text-muted)`},children:QG(e,c)}),(0,E.jsx)(`div`,{style:{color:`var(--text-dim)`},children:c(`i18n.installedPath`)}),(0,E.jsx)(`div`,{style:{color:e.installedPath?`var(--text-muted)`:`#ef4444`,fontFamily:`var(--font-mono)`,overflowWrap:`anywhere`},children:e.installedPath?GG(e.installedPath):c(`i18n.notFound`)})]}),e.readmePath&&e.readmeSummary&&(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6,padding:`8px 10px`,border:`1px solid var(--border)`,borderRadius:6,background:`var(--bg-panel)`},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,E.jsx)(`span`,{style:{fontSize:`var(--text-base)`,fontWeight:600,color:`var(--text)`},children:c(`i18n.readme`)}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>s(e.readmePath,yG(e.readmePath)),style:{cursor:`pointer`,fontSize:`var(--text-sm)`,color:`var(--accent)`,background:`none`,border:`none`,padding:0},children:c(`i18n.readmeDetails`)})]}),(0,E.jsx)(`div`,{className:`markdown-body markdown-file-preview`,style:{fontSize:`var(--text-sm)`,lineHeight:1.5,overflowWrap:`anywhere`},children:(0,E.jsx)(Ok,{remarkPlugins:pG,rehypePlugins:hG,components:{a({href:t,children:n,...r}){return delete r.node,(0,E.jsx)(WG,{href:t,markdownDir:bG(e.readmePath),onOpenFile:e=>s(e,yG(e)),...r,children:n})}},children:e.readmeSummary})})]}),(0,E.jsx)(bK,{bindings:l[f]??[],onAdd:e=>u(f,e),onRemove:e=>d(f,e),onOpenFile:s}),(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,fontWeight:700,color:`var(--text)`},children:c(`i18n.resolvedResources`)}),(0,E.jsx)(oK,{pkg:e})]}),r&&(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,color:`var(--status-success)`},children:r}),n&&(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,color:`var(--status-error)`,whiteSpace:`pre-wrap`},children:n})]})}function bK({bindings:e,onAdd:t,onRemove:n,onOpenFile:r}){let{t:i}=N(),[a,o]=(0,d.useState)(null),[s,c]=(0,d.useState)(!1);return(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`flex-start`,gap:8},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,fontWeight:700,color:`var(--text)`},children:i(`i18n.configBindings`)}),(0,E.jsxs)(`button`,{type:`button`,onClick:()=>c(!0),style:{...cK(!1),display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,E.jsx)(Ir,{size:p.sm}),i(`i18n.addBinding`)]})]}),e.length===0?(0,E.jsx)(`p`,{style:{margin:0,fontSize:`var(--text-sm)`,color:`var(--text-muted)`},children:i(`i18n.noConfigBindings`)}):(0,E.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:6},children:[e.map(e=>{let t=e.note?`${yG(e.path)} · ${e.note}`:yG(e.path),n=e.note?`${e.path}\n${e.note}`:e.path;return(0,E.jsx)(oi,{label:n,wrapperStyle:{display:`inline-flex`,minWidth:0},children:(0,E.jsx)(PG,{label:t,title:n,onClick:()=>r(e.path,yG(e.path)),onRemove:()=>o(e.path)})},e.path)}),a!==null&&(0,E.jsx)(Bx,{open:!0,title:i(`i18n.removeBinding`),description:(0,E.jsx)(`span`,{style:{display:`block`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,color:`var(--text-muted)`,overflowWrap:`anywhere`},children:a}),confirmText:i(`i18n.confirm`),cancelText:i(`i18n.cancel`),destructive:!0,onConfirm:()=>{n(a),o(null)},onCancel:()=>o(null)})]}),(0,E.jsx)(jG,{open:s,title:i(`i18n.bindConfigFile`),confirmText:i(`i18n.confirm`),initialPath:`~/.pi`,noteLabel:i(`i18n.configFileNote`),showFiles:!0,showExtensionFilter:!0,extensionOptions:[`.json`,`.json5`,`.yaml`,`.yml`,`.toml`,`.ini`,`.conf`],onCancel:()=>c(!1),onConfirm:(e,n)=>{t({path:e,note:n||void 0}),c(!1)}})]})}function xK({cwd:e,sessionId:t,onClose:n,onOpenFile:r,onReloaded:i,pane:a,globalPackages:o=[],globalExtensionFilters:s=[]}){let c=ne(),{t:l}=N(),[u,f]=(0,d.useState)(null),[m,h]=(0,d.useState)(!0),[g,_]=(0,d.useState)(null),[v,y]=(0,d.useState)(qG),[b,x]=(0,d.useState)(JG),[S,C]=(0,d.useState)(KG),[w,T]=(0,d.useState)(`plugins`),[D,O]=(0,d.useState)(``),[k,A]=(0,d.useState)(``),[j,M]=(0,d.useState)(`global`),[P,ee]=(0,d.useState)(`global`),[F,te]=(0,d.useState)(280),[re,ie]=(0,d.useState)(``),[ae,oe]=(0,d.useState)(null),[I,L]=(0,d.useState)(null),[se,R]=(0,d.useState)(null),ce=(0,d.useMemo)(()=>{let e=u?.packages??[];return!o||o.length===0?e:[...e,...o]},[u?.packages,o]),le=ce.find(e=>XG(e)===v)??null,ue=(0,d.useMemo)(()=>{let e=[...u?.extensionFilters??[],...s??[]],t=new Set;return e.filter(e=>{let n=ZG(e);return!t.has(n)&&(t.add(n),!0)})},[u?.extensionFilters,s]),de=ue.find(e=>ZG(e)===b)??null,fe=u?.projectResourcesLoaded??!0,pe=(0,d.useMemo)(()=>[`project`,`global`].map(e=>({scope:e,packages:ce.filter(t=>t.scope===e)})).filter(e=>e.packages.length>0),[ce]),me=re.trim().toLowerCase(),he=me?pe.map(e=>({...e,packages:e.packages.filter(e=>e.source.toLowerCase().includes(me))})).filter(e=>e.packages.length>0):pe,ge=(0,d.useMemo)(()=>[`project`,`global`].map(e=>({scope:e,filters:ue.filter(t=>t.scope===e)})).filter(e=>e.filters.length>0),[ue]),_e=(0,d.useMemo)(()=>me?ge.map(e=>({...e,filters:e.filters.filter(e=>e.pattern.toLowerCase().includes(me))})).filter(e=>e.filters.length>0):ge,[ge,me]),ve=e=>{T(e),C(e===`plugins`?e=>e===`addFilter`||e===`filter`?le?`package`:`addPlugin`:e:e=>e===`addPlugin`||e===`package`?de?`filter`:`addFilter`:e)},ye=(0,d.useCallback)(async()=>{h(!0),_(null);try{let t=await fetch(`/api/plugins?cwd=${encodeURIComponent(e)}`),n=await t.json();if(!t.ok||n.error)throw Error(n.error??`HTTP ${t.status}`);f(n);let r=[...n.packages,...o??[]],i=[...n.extensionFilters,...s??[]];C(e=>r.length===0&&e!==`addFilter`?`addPlugin`:e),y(e=>e&&r.some(t=>XG(t)===e)?e:r[0]?XG(r[0]):null),x(e=>e&&i.some(t=>ZG(t)===e)?e:null)}catch(e){_(e instanceof Error?e.message:String(e))}finally{h(!1)}},[e,o,s]);(0,d.useEffect)(()=>{ye()},[ye]),(0,d.useEffect)(()=>{KG=S,qG=v,JG=b});let be=(0,d.useCallback)(async(t,n)=>{let r=XG(n);oe(`${t}:${r}`),L(null),R(null);try{let r=await fetch(`/api/plugins`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:t,source:n.source,scope:n.scope,cwd:e})}),i=await r.json();if(!r.ok||i.error)throw Error(i.error??`HTTP ${r.status}`);let a={...i,packages:i.packages.filter(e=>e.scope===`project`),extensionFilters:i.extensionFilters.filter(e=>e.scope===`project`)};if(f(a),t===`remove`)y(a.packages[0]?XG(a.packages[0]):null),a.packages.length===0&&C(`addPlugin`),R(l(`plugins.packageRemoved`));else{let e={install:l(`plugins.packageInstalled`),update:l(`plugins.packageUpdated`),disable:l(`plugins.packageDisabled`),enable:l(`plugins.packageEnabled`),addExtensionFilter:l(`plugins.extensionFilterAdded`),removeExtensionFilter:l(`plugins.extensionFilterRemoved`)};R(e[t])}n.scope===`global`&&we.refresh().catch(()=>{})}catch(e){L(e instanceof Error?e.message:String(e))}finally{oe(null)}},[e,l]),xe=(0,d.useCallback)(async(t,n)=>{let r=ZG(n);oe(`${t}:${r}`),L(null),R(null);try{let i=await fetch(`/api/plugins`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:t,source:n.pattern,scope:n.scope,cwd:e})}),a=await i.json();if(!i.ok||a.error)throw Error(a.error??`HTTP ${i.status}`);let o={...a,packages:a.packages.filter(e=>e.scope===`project`),extensionFilters:a.extensionFilters};f(o),t===`removeExtensionFilter`?(x(null),R(l(`plugins.extensionFilterRemoved`))):(x(r),R(l(`plugins.extensionFilterAdded`))),n.scope===`global`&&we.refresh().catch(()=>{})}catch(e){L(e instanceof Error?e.message:String(e))}finally{oe(null)}},[e,l]),Se=(0,d.useCallback)(async()=>{let t=YG(D).trim();if(!t)return;O(t);let n=`${j}\0${t}`;oe(`install:${n}`),L(null),R(null);try{let r=await fetch(`/api/plugins`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`install`,source:t,scope:j,cwd:e})}),i=await r.json();if(!r.ok||i.error)throw Error(i.error??`HTTP ${r.status}`);let a={...i,packages:i.packages.filter(e=>e.scope===`project`),extensionFilters:i.extensionFilters.filter(e=>e.scope===`project`)};f(a);let o=tK(a.packages,t,j);y(o?XG(o):n),C(`package`),O(``),R(l(`plugins.packageInstalled`)),j===`global`&&we.refresh().catch(()=>{})}catch(e){L(e instanceof Error?e.message:String(e))}finally{oe(null)}},[e,j,D,l]),Ce=(0,d.useCallback)(async()=>{let e=k.trim();if(e){if(!gG(e)){L(l(`plugins.filterInvalid`));return}L(null),R(null),await xe(`addExtensionFilter`,{pattern:e,scope:P}),C(`filter`),A(``)}},[k,P,xe,l]),Te=(0,d.useCallback)(async()=>{if(t){oe(`reload`),L(null),R(null);try{await US(t,{type:`reload`}),i?.(),await ye(),R(l(`plugins.sessionReloaded`))}catch(e){L(e instanceof Error?e.message:String(e))}finally{oe(null)}}},[ye,i,t,l]),Ee=ae?.startsWith(`install:`)??!1,De=ae?.startsWith(`addExtensionFilter:`)??!1;return(0,E.jsx)(`div`,{style:a?{display:`contents`}:{position:`fixed`,inset:0,zIndex:1e3,background:`var(--overlay)`,display:`flex`,alignItems:`center`,justifyContent:`center`},onClick:e=>{e.target===e.currentTarget&&n()},children:(0,E.jsxs)(`div`,{style:a?{width:`100%`,height:`100%`,background:`var(--bg)`,display:`flex`,flexDirection:`column`,overflow:`hidden`}:{width:c?`calc(100vw - 16px)`:860,maxWidth:`calc(100vw - 16px)`,height:c?`calc(100dvh - 16px)`:`76vh`,maxHeight:`calc(100dvh - 16px)`,background:`var(--bg)`,border:`1px solid var(--border)`,borderRadius:8,display:`flex`,flexDirection:`column`,boxShadow:`0 8px 32px var(--shadow-color)`,overflow:`hidden`},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`12px 18px`,borderBottom:`1px solid var(--border)`,flexShrink:0},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,minWidth:0,flexWrap:`wrap`,rowGap:6},children:[(0,E.jsx)(`div`,{style:{display:`inline-flex`,border:`1px solid var(--border)`,borderRadius:7,overflow:`hidden`,flexShrink:0},children:[`plugins`,`filters`].map(e=>{let t=w===e;return(0,E.jsx)(`button`,{type:`button`,"data-testid":e===`plugins`?`plugins-tab-plugins`:`plugins-tab-filters`,onClick:()=>ve(e),style:{padding:`4px 12px`,border:`none`,borderRight:e===`plugins`?`1px solid var(--border)`:`none`,background:t?`var(--accent)`:`transparent`,color:t?`var(--on-accent)`:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-base)`,fontWeight:t?700:400},children:l(e===`plugins`?`plugins.managePlugins`:`plugins.filterRules`)},e)})}),(0,E.jsx)(`code`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-muted)`,fontFamily:`var(--font-mono)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:GG(e)}),(0,E.jsx)(Xx,{testId:`plugins-search`,query:re,onChange:ie,t:l})]}),!a&&(0,E.jsx)(`button`,{onClick:n,style:{background:`none`,border:`none`,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-5xl)`,lineHeight:1,padding:`2px 6px`},children:`×`})]}),!fe&&(0,E.jsx)(`div`,{role:`status`,style:{padding:`8px 18px`,borderBottom:`1px solid var(--border)`,background:`var(--bg-panel)`,color:`var(--text-muted)`,fontSize:`var(--text-base)`},children:l(`trust.pluginsNotLoaded`)}),(0,E.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:c?`column`:`row`,overflow:`hidden`},children:[(0,E.jsxs)(`div`,{style:{width:c?`100%`:F,maxHeight:c?`40vh`:void 0,display:`flex`,flexDirection:`column`,flexShrink:0,background:`var(--bg)`},children:[(0,E.jsx)(`div`,{style:{flex:1,overflowY:`auto`,padding:`8px 6px`},children:m?(0,E.jsx)(`div`,{style:{padding:`10px 8px`,fontSize:`var(--text-base)`,color:`var(--text-muted)`},children:l(`i18n.loading`)}):g?(0,E.jsx)(`div`,{style:{padding:`10px 8px`,fontSize:`var(--text-sm)`,color:`var(--status-error)`},children:g}):w===`plugins`?ce.length===0||me&&he.length===0?(0,E.jsx)(`div`,{style:{padding:`10px 8px`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:l(me?`i18n.noMatch`:`i18n.noPlugins`)}):(0,E.jsx)(E.Fragment,{children:he.map(e=>(0,E.jsxs)(`div`,{style:{marginBottom:6},children:[(0,E.jsx)(`div`,{style:{padding:`4px 8px 3px`,fontSize:`var(--text-xs)`,fontWeight:600,color:`var(--text-dim)`,textTransform:`uppercase`},children:e.scope}),e.packages.map(e=>{let t=XG(e),n=S===`package`&&v===t;return(0,E.jsxs)(`div`,{"data-testid":`package-item-${e.scope}-${e.source}`,onClick:()=>{y(t),C(`package`),L(null),R(null)},style:{display:`flex`,alignItems:`center`,gap:7,padding:`8px 8px`,borderRadius:5,cursor:`pointer`},className:n?`selectable-row row-selected-gradient`:`selectable-row`,children:[(0,E.jsx)(oi,{label:aK(e.status,l),children:(0,E.jsx)(`span`,{style:{flexShrink:0,width:7,height:7,borderRadius:`50%`,background:iK(e.status)}})}),(0,E.jsxs)(`div`,{style:{minWidth:0,flex:1},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,fontWeight:n?600:400,color:`var(--text)`,fontFamily:`var(--font-mono)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:(0,E.jsx)(oi,{label:e.source,children:(0,E.jsx)(`span`,{children:e.source})})}),(0,E.jsx)(`div`,{style:{fontSize:`var(--text-xs)`,color:`var(--text-dim)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,marginTop:2},children:(0,E.jsx)(oi,{label:QG(e,l),children:(0,E.jsxs)(`span`,{style:{display:`inline-flex`,gap:8},children:[(e.version||e.configuredVersion)&&(0,E.jsxs)(`span`,{children:[(0,E.jsxs)(`span`,{children:[l(`i18n.versionShort`),`:`]}),(0,E.jsx)(`span`,{style:{color:`var(--text)`},children:e.version||e.configuredVersion})]}),(0,E.jsxs)(`span`,{children:[(0,E.jsxs)(`span`,{children:[l(`i18n.extensionShort`),`:`]}),(0,E.jsx)(`span`,{style:{color:`var(--text)`},children:e.counts.extensions})]}),(0,E.jsxs)(`span`,{children:[(0,E.jsxs)(`span`,{children:[l(`i18n.skillShort`),`:`]}),(0,E.jsx)(`span`,{style:{color:`var(--text)`},children:e.counts.skills})]})]})})})]})]},t)})]},e.scope))}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`div`,{style:{padding:`4px 8px 3px`,fontSize:`var(--text-xs)`,fontWeight:600,color:`var(--text-dim)`,textTransform:`uppercase`},children:l(`plugins.extensionFilters`)}),(0,E.jsx)(`div`,{style:{padding:`0 8px 4px`,fontSize:`var(--text-xs)`,color:`var(--text-dim)`,lineHeight:1.45},children:l(`plugins.extensionFiltersHint`)}),ge.length===0||me&&_e.length===0?(0,E.jsx)(`div`,{style:{padding:`10px 8px`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:l(me?`i18n.noMatch`:`plugins.noExtensionFilters`)}):_e.map(e=>(0,E.jsxs)(`div`,{style:{marginBottom:6},children:[(0,E.jsx)(`div`,{style:{padding:`4px 8px 3px`,fontSize:`var(--text-xs)`,fontWeight:600,color:`var(--text-dim)`,textTransform:`uppercase`},children:e.scope}),e.filters.map(e=>{let t=ZG(e),n=S===`filter`&&b===t;return(0,E.jsxs)(`div`,{"data-testid":`extension-filter-item-${e.scope}-${e.pattern}`,onClick:()=>{x(t),y(null),C(`filter`),L(null),R(null)},style:{display:`flex`,alignItems:`center`,gap:7,padding:`6px 8px`,borderRadius:5,cursor:`pointer`},className:n?`selectable-row row-selected-gradient`:`selectable-row`,children:[(0,E.jsx)(`span`,{style:{flexShrink:0,width:18,height:18,borderRadius:4,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:`var(--text-sm)`,fontWeight:700,fontFamily:`var(--font-mono)`,color:nK(e.pattern),background:`color-mix(in srgb, var(--border) 55%, transparent)`},children:e.pattern[0]}),(0,E.jsx)(`span`,{style:{minWidth:0,flex:1,fontSize:`var(--text-sm)`,color:`var(--text)`,fontFamily:`var(--font-mono)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:(0,E.jsx)(oi,{label:e.pattern,children:(0,E.jsx)(`span`,{children:e.pattern})})})]},t)})]},`filters-${e.scope}`))]})}),(0,E.jsx)(`div`,{style:{padding:`8px 6px`,borderTop:`1px solid var(--border)`,flexShrink:0},children:w===`plugins`?(0,E.jsxs)(`button`,{type:`button`,onClick:()=>{C(`addPlugin`),L(null),R(null)},style:{display:`flex`,alignItems:`center`,gap:6,padding:`7px 8px`,borderRadius:5,border:`none`,width:`100%`,cursor:`pointer`,color:S===`addPlugin`?`var(--accent)`:`var(--text-dim)`,fontSize:`var(--text-base)`},className:S===`addPlugin`?`row-selected-gradient`:`hover-shift`,children:[(0,E.jsxs)(`svg`,{width:p.lg,height:p.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,E.jsx)(`line`,{x1:`12`,y1:`5`,x2:`12`,y2:`19`}),(0,E.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`})]}),l(`i18n.addPlugin`)]}):(0,E.jsxs)(`button`,{type:`button`,"data-testid":`add-extension-filter-btn`,onClick:()=>{C(`addFilter`),x(null),y(null),L(null),R(null)},style:{display:`flex`,alignItems:`center`,gap:6,padding:`7px 8px`,borderRadius:5,border:`none`,width:`100%`,cursor:`pointer`,color:S===`addFilter`?`var(--accent)`:`var(--text-dim)`,fontSize:`var(--text-base)`},className:S===`addFilter`?`row-selected-gradient`:`hover-shift`,children:[(0,E.jsxs)(`svg`,{width:p.lg,height:p.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,E.jsx)(`path`,{d:`M3 6h18`}),(0,E.jsx)(`path`,{d:`M7 12h10`}),(0,E.jsx)(`path`,{d:`M11 18h2`})]}),l(`plugins.addFilter`)]})})]}),!c&&(0,E.jsx)(wx,{width:F,onResize:te,ariaLabel:l(`i18n.resizeList`,{name:l(`i18n.plugins`)})}),(0,E.jsx)(`div`,{style:{flex:1,overflowY:`auto`,padding:20},children:S===`addFilter`?(0,E.jsx)(_K,{pattern:k,scope:P,projectResourcesLoaded:fe,busy:De,actionError:I,onPatternChange:A,onScopeChange:ee,onAdd:Ce}):m?null:S===`filter`&&de?(0,E.jsx)(vK,{filter:de,busyKey:ae,actionError:I,actionMessage:se,onRemove:e=>void xe(`removeExtensionFilter`,e)},ZG(de)):S===`addPlugin`?(0,E.jsx)(gK,{cwd:e,source:D,scope:j,projectResourcesLoaded:fe,busy:Ee,actionError:I,packages:ce,onSourceChange:O,onScopeChange:M,onInstall:Se}):le?(0,E.jsx)(yK,{pkg:le,busyKey:ae,actionError:I,actionMessage:se,sessionId:t,onAction:be,onReloadSession:Te,onOpenFile:r},XG(le)):(0,E.jsx)(`div`,{style:{height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`var(--text-dim)`,fontSize:`var(--text-lg)`},children:de?null:l(`i18n.selectPackage`)})})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:12,padding:`10px 18px`,borderTop:`1px solid var(--border)`,flexShrink:0},children:[(0,E.jsx)(`div`,{style:{minWidth:0,flex:1,fontSize:`var(--text-sm)`,color:`var(--text-dim)`,overflow:`hidden`},children:u?.diagnostics.length?(0,E.jsxs)(`span`,{title:u.diagnostics.map(e=>`${e.type}: ${e.source?`${e.source}: `:``}${e.message}`).join(`
347
- `),style:{color:u.diagnostics.some(e=>e.type===`error`)?`var(--status-error)`:`var(--status-warning)`},children:[u.diagnostics.length,` diagnostic`,u.diagnostics.length===1?``:`s`]}):(0,E.jsx)(`span`,{children:u?`${u.totals.extensions} ext · ${u.totals.skills} skills · ${u.totals.prompts} prompts · ${u.totals.themes} themes`:``})}),(0,E.jsx)(`button`,{onClick:()=>void ye(),disabled:m||ae!==null,style:cK(m||ae!==null),children:l(`i18n.refresh`)}),(0,E.jsx)(`button`,{onClick:n,style:cK(!1),children:l(`i18n.close`)})]})]})})}function SK(e){return e.replace(/^\/(?:Users|home)\/[^/]+/,`~`)}function CK(e){let t=e.sourceInfo?.source,n=e.sourceInfo?.scope;return n===`user`||t===`user`?`global`:n===`project`||t===`project`?`project`:`path`}function wK(e){let t=CK(e);return t===`path`?t:e.install?.skillsShUrl?`${t} / skills.sh`:t}function TK(e){return e.install?`${e.install.scope}\0${e.install.package}`:null}function EK(e){return e?e.slice(0,8):`unknown`}function DK({enabled:e,loading:t,onToggle:n}){let{t:r}=N();return(0,E.jsx)(`button`,{onClick:n,disabled:t,title:r(e?`i18n.visibleInPrompt`:`i18n.hiddenFromPrompt`),style:{flexShrink:0,width:40,height:22,borderRadius:11,border:`none`,padding:0,cursor:t?`wait`:`pointer`,background:e?`var(--accent)`:`var(--border)`,position:`relative`,transition:`background 0.18s`,outline:`none`},children:(0,E.jsx)(`span`,{style:{position:`absolute`,top:3,left:e?21:3,width:16,height:16,borderRadius:`50%`,background:`var(--bg)`,boxShadow:`0 1px 4px var(--shadow-color)`,transition:`left 0.18s cubic-bezier(.4,0,.2,1)`}})})}function OK({skill:e,cwd:t,onToggle:n,toggling:r,saveError:i,updateStatus:a,checkingUpdate:o,updating:s,updateError:c,onCheckUpdate:l,onUpdate:u}){let{t:d}=N(),f=CK(e),p=!e.disableModelInvocation;function m(e){return f===`project`&&e.startsWith(t)?`./${e.slice(t.length).replace(/^[/\\]/,``)}`:SK(e)}return(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:20},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:7},children:[(0,E.jsx)(`span`,{style:{fontSize:`var(--text-xs)`,padding:`1px 5px`,borderRadius:3,flexShrink:0,background:f===`project`?`color-mix(in srgb, var(--status-info) 12%, transparent)`:`color-mix(in srgb, var(--text-dim) 12%, transparent)`,color:f===`project`?`color-mix(in srgb, var(--status-info) 80%, transparent)`:`var(--text-dim)`},children:f}),(0,E.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`,flex:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:m(e.filePath)}),(0,E.jsx)(DK,{enabled:p,loading:r,onToggle:()=>n(e)})]}),(0,E.jsxs)(`div`,{style:{minHeight:16,display:`flex`,alignItems:`center`,justifyContent:`flex-end`,gap:8,flexWrap:`wrap`,textAlign:`right`},children:[!p&&(0,E.jsx)(`span`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:d(`i18n.hiddenButInvocable`)}),i&&(0,E.jsx)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--status-error)`,overflowWrap:`anywhere`},children:i})]})]}),e.install?.skillsShUrl&&(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5},children:[(0,E.jsx)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--text-muted)`,fontWeight:500},children:`Source`}),(0,E.jsx)(`a`,{href:e.install.skillsShUrl,target:`_blank`,rel:`noreferrer`,title:e.install.skillsShUrl,style:{display:`flex`,alignItems:`center`,gap:8,width:`fit-content`,maxWidth:`100%`,color:`var(--accent)`,textDecoration:`none`},children:(0,E.jsxs)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`var(--text-base)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:[e.install.skillsShUrl.replace(/^https?:\/\//,``),` ↗`]})})]}),e.install&&(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:7},children:[(0,E.jsx)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--text-muted)`,fontWeight:500},children:`Version`}),(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,flexWrap:`wrap`},children:[(0,E.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`var(--text-base)`,color:`var(--text-muted)`},children:EK(a?.currentVersion??e.install.versionHash)}),e.install.canCheckForUpdates&&(0,E.jsx)(`button`,{onClick:l,disabled:o||s,style:{padding:`4px 9px`,border:`1px solid var(--border)`,borderRadius:5,background:`none`,color:`var(--text-muted)`,cursor:o||s?`not-allowed`:`pointer`,opacity:o||s?.5:1,fontSize:`var(--text-sm)`},children:d(`i18n.check`)}),a?.state===`update-available`&&(0,E.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`var(--text-base)`,color:`var(--status-warning)`},children:EK(a.latestVersion)}),(o||a&&a.state!==`update-available`)&&(0,E.jsx)(`span`,{style:{fontSize:`var(--text-base)`,color:o?`var(--accent)`:a?.state===`up-to-date`?`var(--status-success)`:a?.state===`error`?`var(--status-error)`:`var(--text-dim)`},children:o?d(`i18n.checking`):a?.state===`up-to-date`?d(`i18n.upToDate`):a?.state===`unsupported`?d(`i18n.automaticChecksUnavailable`):a?.message||d(`i18n.checkFailed`)}),a?.state===`update-available`&&(0,E.jsx)(`button`,{onClick:u,disabled:s||o,style:{padding:`4px 10px`,border:`none`,borderRadius:5,background:`var(--accent)`,color:`var(--on-accent)`,cursor:s||o?`not-allowed`:`pointer`,opacity:s||o?.5:1,fontSize:`var(--text-sm)`,fontWeight:600},children:d(s?`i18n.updating`:`i18n.update`)})]}),c&&(0,E.jsx)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--status-error)`},children:c})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5},children:[(0,E.jsx)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--text-muted)`,fontWeight:500},children:`Name`}),(0,E.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`var(--text-xl)`,color:`var(--text)`},children:e.name})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5},children:[(0,E.jsx)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--text-muted)`,fontWeight:500},children:`Description`}),(0,E.jsx)(`span`,{style:{fontSize:`var(--text-xl)`,color:`var(--text-muted)`,lineHeight:1.6},children:e.description})]})]})}function kK({cwd:e,installedPackages:t,projectResourcesLoaded:n,onInstalled:r}){let{t:i}=N(),[a,o]=(0,d.useState)(``),[s,c]=(0,d.useState)([]),[l,u]=(0,d.useState)(!1),[f,p]=(0,d.useState)(null),[m,h]=(0,d.useState)(null),[g,_]=(0,d.useState)(null),[v,y]=(0,d.useState)(new Set),[b,x]=(0,d.useState)(`global`),S=(0,d.useRef)(null);(0,d.useEffect)(()=>{S.current?.focus()},[]);let C=(0,d.useCallback)(async e=>{if(e.trim()){u(!0),p(null),c([]);try{let t=await(await fetch(`/api/skills/search`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({query:e.trim()})})).json();if(t.error){p(t.error);return}c(t.results??[]),(t.results??[]).length===0&&p(i(`i18n.noSkills`))}catch(e){p(String(e))}finally{u(!1)}}},[i]),w=(0,d.useCallback)(async t=>{h(t),_(null);try{let n=await fetch(`/api/skills/install`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({package:t,scope:b,cwd:e})}),i=await n.json();if(!n.ok||i.error){_(i.error??`HTTP ${n.status}`);return}y(e=>new Set(e).add(`${b}:${t}`)),r()}catch(e){_(String(e))}finally{h(null)}},[r,b,e]),T=b===`global`?`~/.pi/agent/skills/`:`${SK(e)}/.pi/skills/`;return(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12,marginBottom:20},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-xl)`,fontWeight:600,color:`var(--text)`},children:i(`i18n.addSkill`)}),(0,E.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,E.jsx)(`input`,{ref:S,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&C(a)},placeholder:i(`i18n.skillSearchPlaceholder`),style:{flex:1,padding:`7px 10px`,fontSize:`var(--text-lg)`,background:`var(--bg-input)`,border:`1px solid var(--border)`,borderRadius:6,color:`var(--text)`,outline:`none`}}),(0,E.jsx)(`button`,{onClick:()=>C(a),disabled:l||!a.trim(),style:{padding:`7px 16px`,fontSize:`var(--text-lg)`,borderRadius:6,border:`none`,background:`var(--accent)`,color:`var(--on-accent)`,cursor:l||!a.trim()?`not-allowed`:`pointer`,opacity:l||!a.trim()?.5:1,flexShrink:0},children:i(l?`i18n.searching`:`i18n.search`)})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,E.jsx)(`div`,{style:{display:`flex`,borderRadius:5,border:`1px solid var(--border)`,overflow:`hidden`,fontSize:`var(--text-base)`,flexShrink:0},children:[`global`,`project`].map(e=>(0,E.jsx)(`button`,{onClick:()=>{(e===`global`||n)&&x(e)},disabled:e===`project`&&!n,title:e===`project`&&!n?i(`trust.projectScopeUnavailable`):void 0,style:{padding:`3px 10px`,border:`none`,cursor:e===`project`&&!n?`not-allowed`:`pointer`,background:b===e?`var(--accent)`:`transparent`,color:b===e?`var(--on-accent)`:`var(--text-dim)`,fontWeight:b===e?600:400,opacity:e===`project`&&!n?.45:1,borderRight:e===`global`?`1px solid var(--border)`:`none`},children:e},e))}),(0,E.jsxs)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--text-dim)`,fontFamily:`var(--font-mono)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:[`→ `,T]})]}),f&&(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,color:`var(--status-error)`},children:f}),g&&(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,color:`var(--status-error)`,wordBreak:`break-word`},children:g})]}),s.length>0?(0,E.jsx)(`div`,{style:{flex:1,overflowY:`auto`},children:s.map(e=>{let n=t[b].has(e.package)||v.has(`${b}:${e.package}`),r=m===e.package,a=e.package.indexOf(`@`),o=a>-1?e.package.slice(0,a):e.package,s=a>-1?e.package.slice(a+1):null;return(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:14,padding:`12px 0`,borderBottom:`1px solid var(--border)`},children:[(0,E.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-lg)`,fontWeight:600,color:`var(--text)`,marginBottom:3},children:s??o}),(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,flexWrap:`wrap`},children:[(0,E.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:o}),(0,E.jsx)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--text-muted)`,fontWeight:500},children:e.installs}),e.url&&(0,E.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,style:{fontSize:`var(--text-base)`,color:`var(--accent)`,textDecoration:`none`},children:`skills.sh ↗`})]})]}),(0,E.jsx)(`button`,{onClick:()=>!n&&!r&&w(e.package),disabled:n||r||m!==null,style:{flexShrink:0,padding:`5px 14px`,fontSize:`var(--text-base)`,fontWeight:500,borderRadius:5,border:`1px solid var(--border)`,cursor:n||r||m!==null?`not-allowed`:`pointer`,background:n?`color-mix(in srgb, var(--status-success) 10%, transparent)`:`none`,color:n?`var(--status-success)`:r?`var(--accent)`:`var(--text-muted)`,transition:`color 0.12s`},children:n?`✓ ${i(`i18n.installed`)}`:i(r?`i18n.installing`:`i18n.install`)})]},e.package)})}):!f&&!l&&(0,E.jsxs)(`div`,{style:{fontSize:`var(--text-lg)`,color:`var(--text-dim)`,lineHeight:1.8},children:[`Search`,` `,(0,E.jsx)(`a`,{href:`https://skills.sh`,target:`_blank`,rel:`noreferrer`,style:{color:`var(--accent)`,textDecoration:`none`},children:`skills.sh`}),` `,`to discover and install skills for your agent.`]})]})}var AK=null;function jK({cwd:e,onClose:t,pane:n,homeSkills:r=[]}){let i=ne(),{t:a}=N(),[o,s]=(0,d.useState)([]),c=(0,d.useMemo)(()=>r.length===0?o:[...o,...r],[o,r]),[l,u]=(0,d.useState)(!0),[f,m]=(0,d.useState)(null),[h,g]=(0,d.useState)(AK),[_,v]=(0,d.useState)(new Set),[y,b]=(0,d.useState)(null),[x,S]=(0,d.useState)(!1),[C,w]=(0,d.useState)({}),[T,D]=(0,d.useState)(new Set),[O,k]=(0,d.useState)(!1),[A,j]=(0,d.useState)(null),[M,P]=(0,d.useState)(null),[ee,F]=(0,d.useState)(!0),[te,re]=(0,d.useState)({}),[ie,ae]=(0,d.useState)(280),[oe,I]=(0,d.useState)(``),L=oe.trim().toLowerCase(),se=(0,d.useCallback)(async()=>{u(!0),m(null);try{let t=await fetch(`/api/skills?cwd=${encodeURIComponent(e)}`),n=await t.json();if(!t.ok||n.error)throw Error(n.error??`HTTP ${t.status}`);let r=n.skills??[];if(s(r),F(n.projectResourcesLoaded??!0),r.length>0&&!h){let e=r.find(e=>!e.disableModelInvocation)??r[0];g(e.filePath),e.disableModelInvocation&&re(t=>({...t,[wK(e)]:!0}))}return r}catch(e){return m(String(e)),[]}finally{u(!1)}},[e,h]);(0,d.useEffect)(()=>{w({}),P(null),se()},[e]),(0,d.useEffect)(()=>{AK=h});let R=(0,d.useCallback)(async t=>{let n=(t?[t]:o.filter(e=>!!e.install)).map(TK).filter(e=>!!e);if(n.length!==0){P(null),D(e=>new Set([...e,...n])),t||k(!0);try{let n=await fetch(`/api/skills/check`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:e,package:t?.install?.package,scope:t?.install?.scope})}),r=await n.json();if(!n.ok||r.error)throw Error(r.error??`HTTP ${n.status}`);w(e=>{let t={...e};for(let e of r.updates??[])t[`${e.scope}\0${e.package}`]=e;return t})}catch(e){P(e instanceof Error?e.message:String(e))}finally{D(e=>{let t=new Set(e);for(let e of n)t.delete(e);return t}),t||k(!1)}}},[e,o]),ce=(0,d.useCallback)(async t=>{if(!t.install)return;let n=TK(t);j(n),P(null);try{let r=await fetch(`/api/skills/update`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:e,package:t.install.package,scope:t.install.scope})}),i=await r.json();if(!r.ok||i.error||!i.success)throw Error(i.error??`HTTP ${r.status}`);await se();let a=i.skill?.install?.versionHash;w(e=>({...e,[n]:{package:t.install.package,scope:t.install.scope,state:`up-to-date`,currentVersion:a,latestVersion:a}}))}catch(e){P(e instanceof Error?e.message:String(e))}finally{j(null)}},[e,se]),le=(0,d.useCallback)(async t=>{let n=!t.disableModelInvocation;v(e=>new Set(e).add(t.filePath)),b(null);try{let i=await fetch(`/api/skills`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({filePath:t.filePath,disableModelInvocation:n,cwd:e})}),a=await i.json();if(!i.ok||a.error){b(a.error??`HTTP ${i.status}`);return}s(e=>e.map(e=>e.filePath===t.filePath?{...e,disableModelInvocation:n}:e)),r.some(e=>e.filePath===t.filePath)&&Te.refresh().catch(()=>{}),n&&re(e=>({...e,[wK(t)]:!0}))}catch(e){b(String(e))}finally{v(e=>{let n=new Set(e);return n.delete(t.filePath),n})}},[r,e]),ue=o.find(e=>e.filePath===h)??null;return(0,E.jsx)(`div`,{style:n?{display:`contents`}:{position:`fixed`,inset:0,zIndex:1e3,background:`var(--overlay)`,display:`flex`,alignItems:`center`,justifyContent:`center`},onClick:e=>{e.target===e.currentTarget&&t()},children:(0,E.jsxs)(`div`,{style:n?{width:`100%`,height:`100%`,background:`var(--bg)`,display:`flex`,flexDirection:`column`,overflow:`hidden`}:{width:i?`calc(100vw - 16px)`:860,maxWidth:`calc(100vw - 16px)`,height:i?`calc(100dvh - 16px)`:`78vh`,maxHeight:`calc(100dvh - 16px)`,background:`var(--bg)`,border:`1px solid var(--border)`,borderRadius:10,display:`flex`,flexDirection:`column`,boxShadow:`0 8px 32px var(--shadow-color)`,overflow:`hidden`},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`12px 18px`,borderBottom:`1px solid var(--border)`,flexShrink:0},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:10},children:[(0,E.jsx)(`span`,{style:{fontSize:`var(--text-2xl)`,fontWeight:700,color:`var(--text)`},children:a(`common.skills`)}),(0,E.jsx)(`code`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-muted)`,fontFamily:`var(--font-mono)`,maxWidth:320,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:SK(e)}),(0,E.jsx)(Xx,{testId:`skills-search`,query:oe,onChange:I,t:a})]}),!n&&(0,E.jsx)(`button`,{onClick:t,style:{background:`none`,border:`none`,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-5xl)`,lineHeight:1,padding:`2px 6px`},children:`×`})]}),!ee&&(0,E.jsx)(`div`,{role:`status`,style:{padding:`8px 18px`,borderBottom:`1px solid var(--border)`,background:`var(--bg-panel)`,color:`var(--text-muted)`,fontSize:`var(--text-base)`},children:a(`trust.skillsNotLoaded`)}),(0,E.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:i?`column`:`row`,overflow:`hidden`},children:[(0,E.jsxs)(`div`,{style:{width:i?`100%`:ie,maxHeight:i?`40vh`:void 0,display:`flex`,flexDirection:`column`,flexShrink:0,background:`var(--bg)`},children:[(0,E.jsx)(`div`,{style:{flex:1,overflowY:`auto`,padding:`8px 6px`},children:l?(0,E.jsx)(`div`,{style:{padding:`10px 8px`,fontSize:`var(--text-base)`,color:`var(--text-muted)`},children:a(`i18n.loading`)}):f?(0,E.jsx)(`div`,{style:{padding:`10px 8px`,fontSize:`var(--text-sm)`,color:`var(--status-error)`},children:f}):c.length===0?(0,E.jsx)(`div`,{style:{padding:`10px 8px`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:a(`i18n.noSkills`)}):(()=>{let e=L?c.filter(e=>e.name.toLowerCase().includes(L)):c,t=[],n=[{label:`project / skills.sh`,matches:e=>CK(e)===`project`&&!!e.install?.skillsShUrl},{label:`project`,matches:e=>CK(e)===`project`&&!e.install?.skillsShUrl},{label:`global / skills.sh`,matches:e=>CK(e)===`global`&&!!e.install?.skillsShUrl},{label:`global`,matches:e=>CK(e)===`global`&&!e.install?.skillsShUrl},{label:`path`,matches:e=>CK(e)===`path`}];for(let{label:r,matches:i}of n){let n=e.filter(i);n.length>0&&t.push({label:r,skills:n})}if(t.length===0)return(0,E.jsx)(`div`,{style:{padding:`10px 8px`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:a(`i18n.noMatch`)});let r=e=>{let t=!x&&h===e.filePath,n=e.disableModelInvocation;return(0,E.jsxs)(`div`,{onClick:()=>{g(e.filePath),S(!1)},style:{display:`flex`,alignItems:`center`,gap:7,padding:`8px 8px`,borderRadius:5,cursor:`pointer`},className:t?`selectable-row row-selected-gradient`:`selectable-row`,children:[(0,E.jsx)(`span`,{style:{flexShrink:0,width:7,height:7,borderRadius:`50%`,background:n?`var(--border)`:`var(--accent)`,boxShadow:n?`none`:`0 0 4px var(--accent)`,transition:`background 0.15s, box-shadow 0.15s`}}),(0,E.jsx)(oi,{label:e.name,children:(0,E.jsx)(`span`,{style:{fontSize:`var(--text-base)`,fontWeight:t?600:400,color:n?`var(--text-dim)`:`var(--text)`,fontFamily:`var(--font-mono)`,flex:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.name})}),(()=>{let t=TK(e);return(t?C[t]:void 0)?.state===`update-available`?(0,E.jsx)(`span`,{title:a(`i18n.updateAvailable`),style:{color:`var(--status-warning)`,fontSize:`var(--text-lg)`,lineHeight:1,flexShrink:0},children:`↑`}):null})()]},e.filePath)};return t.map(({label:e,skills:t})=>{let n=t.filter(e=>!e.disableModelInvocation),i=t.filter(e=>e.disableModelInvocation),o=te[e]??!1;return(0,E.jsxs)(`div`,{style:{marginBottom:6},children:[(0,E.jsx)(`div`,{style:{padding:`4px 8px 3px`,fontSize:`var(--text-xs)`,fontWeight:600,color:`var(--text-dim)`,textTransform:`uppercase`,letterSpacing:`0.06em`},children:e}),n.map(r),i.length>0&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{onClick:()=>re(t=>({...t,[e]:!o})),style:{display:`flex`,alignItems:`center`,gap:5,padding:`4px 8px 3px`,fontSize:`var(--text-xs)`,fontWeight:600,color:`var(--text-dim)`,textTransform:`uppercase`,letterSpacing:`0.06em`,cursor:`pointer`,userSelect:`none`},children:[(0,E.jsx)(`span`,{style:{fontSize:`var(--text-3xs)`},children:o?`▾`:`▸`}),a(`i18n.dormant`),` (`,i.length,`)`]}),o||L?i.map(r):null]})]},e)})})()}),(0,E.jsx)(`div`,{style:{padding:`8px 6px`,borderTop:`1px solid var(--border)`,flexShrink:0},children:!L&&(0,E.jsxs)(`div`,{onClick:()=>S(!0),style:{display:`flex`,alignItems:`center`,gap:6,padding:`7px 8px`,borderRadius:5,cursor:`pointer`,color:x?`var(--accent)`:`var(--text-dim)`,fontSize:`var(--text-base)`},className:x?`row-selected-gradient`:`hover-shift`,children:[(0,E.jsxs)(`svg`,{width:p.lg,height:p.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,E.jsx)(`line`,{x1:`12`,y1:`5`,x2:`12`,y2:`19`}),(0,E.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`})]}),a(`i18n.addSkill`)]})})]}),!i&&(0,E.jsx)(wx,{width:ie,onResize:ae,ariaLabel:a(`i18n.resizeList`,{name:a(`i18n.skills`)})}),(0,E.jsx)(`div`,{style:{flex:1,overflowY:`auto`,padding:20},children:x?(0,E.jsx)(kK,{cwd:e,projectResourcesLoaded:ee,installedPackages:{global:new Set(o.filter(e=>e.install?.scope===`global`).map(e=>e.install.package)),project:new Set(o.filter(e=>e.install?.scope===`project`).map(e=>e.install.package))},onInstalled:()=>{se()}}):l?null:ue?(0,E.jsx)(OK,{skill:ue,cwd:e,onToggle:le,toggling:_.has(ue.filePath),saveError:y,updateStatus:TK(ue)?C[TK(ue)]:void 0,checkingUpdate:TK(ue)?T.has(TK(ue)):!1,updating:A===TK(ue),updateError:M,onCheckUpdate:()=>void R(ue),onUpdate:()=>void ce(ue)},ue.filePath):(0,E.jsx)(`div`,{style:{height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`var(--text-dim)`,fontSize:`var(--text-lg)`},children:a(`i18n.selectSkill`)})})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`10px 18px`,borderTop:`1px solid var(--border)`,flexShrink:0},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[c.some(e=>!!e.install)&&(0,E.jsx)(`button`,{onClick:()=>void R(),disabled:O||A!==null,style:{padding:`6px 12px`,background:`none`,border:`1px solid var(--border)`,borderRadius:6,color:`var(--text-muted)`,cursor:O||A!==null?`not-allowed`:`pointer`,opacity:O||A!==null?.5:1,fontSize:`var(--text-base)`},children:a(O?`i18n.checking`:`i18n.checkUpdates`)}),Object.values(C).filter(e=>e.state===`update-available`).length>0&&(0,E.jsxs)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--status-warning)`},children:[Object.values(C).filter(e=>e.state===`update-available`).length,` `,Object.values(C).filter(e=>e.state===`update-available`).length===1?a(`i18n.update`):a(`i18n.updates`)]})]}),(0,E.jsx)(`button`,{onClick:t,style:{padding:`6px 14px`,background:`none`,border:`1px solid var(--border)`,borderRadius:6,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-lg)`},children:a(`i18n.close`)})]})]})})}var MK=[{name:`compact`,description:`chat.commandCompact`,source:`builtin`},{name:`reload`,description:`chat.commandReload`,source:`builtin`},{name:`name`,description:`chat.commandName`,source:`builtin`},{name:`session`,description:`chat.commandSession`,source:`builtin`},{name:`copy`,description:`chat.commandCopy`,source:`builtin`}],NK=[`builtin`,`extension`,`prompt`,`skill`],PK={builtin:`chat.builtIn`,extension:`chat.extensions`,prompt:`chat.prompts`,skill:`chat.skills`},FK={builtin:0,extension:1,prompt:2,skill:3},IK=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`});function LK(e,t,n){let r=e.name.toLowerCase(),i=RK(e,n).toLowerCase();return r===t?0:r.startsWith(t)?1:r.includes(t)?2:i.includes(t)?3:4}function RK(e,t){return e.source===`builtin`?t(e.description):e.description??``}function zK(e,t){return e.source!==`skill`||!e.name.startsWith(`skill:`)?!1:t[e.name.slice(6)]===!0}function BK(e,t){let n=0,r=NK.map(r=>{let i=e.filter(e=>e.source===r);return{source:r,items:(r===`skill`?[...i.filter(e=>!zK(e,t)),...i.filter(e=>zK(e,t))]:i).map(e=>({command:e,index:n++}))}}).filter(e=>e.items.length>0);return{commands:r.flatMap(e=>e.items.map(({command:e})=>e)),groups:r}}function VK(e){return e.startsWith(`/`)&&!/\s/.test(e.slice(1))?e.slice(1).toLowerCase():null}function HK(e){let{value:t,commands:n,skillDormancy:r={},builtinDisabled:i=!1,onLoadCommands:a,onApply:o}=e,{t:s}=N(),c=VK(t),[l,u]=(0,d.useState)(!1),[f,p]=(0,d.useState)(0),m=(0,d.useRef)([]),h=(0,d.useRef)(!1),g=(0,d.useRef)(a);(0,d.useEffect)(()=>{g.current=a});let _=(0,d.useMemo)(()=>c===null?[]:[...i?[]:MK,...n??[]].filter(e=>{let t=e.name.toLowerCase(),n=RK(e,s).toLowerCase();return t.includes(c)||n.includes(c)}).sort((e,t)=>{let n=LK(e,c,s)-LK(t,c,s);return n===0?FK[e.source]-FK[t.source]||IK.compare(e.name,t.name):n}),[c,i,n,s]),{commands:v,groups:y}=(0,d.useMemo)(()=>BK(_,r),[_,r]),b=(0,d.useMemo)(()=>_.length===1?s(c?`chat.match`:`chat.command`):s(c?`chat.matches`:`chat.commands`,{count:_.length}),[_.length,c,s]);(0,d.useEffect)(()=>{if(c===null){u(!1),p(0),h.current=!1;return}u(!0),p(0);let e=g.current;!h.current&&e&&(h.current=!0,Promise.resolve(e()).catch(()=>{h.current=!1}))},[c]),(0,d.useEffect)(()=>{f>=v.length&&p(Math.max(0,v.length-1))},[v.length,f]),(0,d.useEffect)(()=>{m.current.length=v.length},[v.length]),(0,d.useEffect)(()=>{l&&m.current[f]?.scrollIntoView({block:`nearest`,behavior:`smooth`})},[f,l]);let x=(0,d.useCallback)(e=>{let t=v.length-1;if(t<0)return 0;if(e===`left`)return Math.max(0,f-1);if(e===`right`)return Math.min(t,f+1);let n=m.current[f];if(!n)return e===`down`?Math.min(t,f+1):Math.max(0,f-1);let r=n.getBoundingClientRect(),i=r.left+r.width/2,a=r.top+r.height/2,o=-1,s=1/0;for(let n=0;n<=t;n+=1){if(n===f)continue;let t=m.current[n];if(!t)continue;let r=t.getBoundingClientRect(),c=r.top+r.height/2-a;if(e===`down`?c<=4:c>=-4)continue;let l=r.left+r.width/2,u=Math.abs(c)*1e3+Math.abs(l-i);u<s&&(o=n,s=u)}return o>=0?o:e===`down`?Math.min(t,f+1):Math.max(0,f-1)},[v.length,f]),S=(0,d.useCallback)(e=>{o(e),u(!1),p(0)},[o]),C=(0,d.useCallback)(e=>!l||c===null?!1:e.key===`ArrowDown`?(e.preventDefault(),p(x(`down`)),!0):e.key===`ArrowUp`?(e.preventDefault(),p(x(`up`)),!0):e.key===`ArrowRight`?(e.preventDefault(),p(x(`right`)),!0):e.key===`ArrowLeft`?(e.preventDefault(),p(x(`left`)),!0):e.key===`Escape`?(e.preventDefault(),u(!1),!0):(e.key===`Tab`||e.key===`Enter`&&!e.shiftKey)&&v[f]?(e.preventDefault(),S(v[f]),!0):!1,[l,c,x,v,f,S]);return{open:l,query:c,filteredCount:_.length,countLabel:b,displayed:v,groups:y,activeIndex:f,setActiveIndex:p,itemRefs:m,apply:S,handleKeyDown:C}}function UK({palette:e,loading:t,skillDormancy:n}){let{t:r}=N();return e.open&&e.query!==null?(0,E.jsxs)(`div`,{style:{position:`absolute`,left:0,right:0,bottom:`calc(100% + 8px)`,zIndex:120,background:`var(--bg)`,border:`1px solid var(--border)`,borderRadius:8,boxShadow:`0 -6px 20px var(--shadow-color)`,overflow:`hidden`,maxHeight:`min(56vh, 460px)`},children:[(0,E.jsxs)(`div`,{style:{padding:`8px 10px`,borderBottom:`1px solid var(--border)`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8,fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:[(0,E.jsx)(`span`,{children:t?r(`chat.loadingCommands`):r(`chat.slashCommands`,{label:e.countLabel})}),(0,E.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`},children:r(`chat.tabEnter`)})]}),(0,E.jsx)(`div`,{style:{maxHeight:`calc(min(56vh, 460px) - 34px)`,overflowY:`auto`,padding:10},children:!t&&e.filteredCount===0?(0,E.jsx)(`div`,{style:{padding:`2px 2px 4px`,fontSize:`var(--text-base)`,color:`var(--text-dim)`},children:r(`chat.noCommands`)}):e.groups.map(t=>(0,E.jsxs)(`section`,{style:{marginBottom:12},children:[(0,E.jsxs)(`div`,{style:{position:`sticky`,top:-10,zIndex:1,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8,padding:`4px 0 6px`,background:`var(--bg)`,color:`var(--text-dim)`,fontSize:`var(--text-xs)`,fontWeight:600,textTransform:`uppercase`},children:[(0,E.jsx)(`span`,{children:r(PK[t.source])}),(0,E.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontWeight:500},children:t.items.length})]}),(0,E.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(220px, 1fr))`,gap:8},children:t.items.map(({command:t,index:i})=>{let a=i===e.activeIndex,o=zK(t,n);return(0,E.jsxs)(`button`,{ref:t=>{e.itemRefs.current[i]=t},type:`button`,onMouseDown:n=>{n.preventDefault(),e.apply(t)},onMouseEnter:()=>e.setActiveIndex(i),style:{width:`100%`,minWidth:0,minHeight:58,display:`flex`,flexDirection:`column`,gap:4,justifyContent:`center`,padding:`9px 10px`,border:`1px solid ${a?`var(--accent)`:`var(--border)`}`,borderRadius:7,background:a?`var(--bg-selected)`:`var(--bg-panel)`,color:`var(--text)`,cursor:`pointer`,textAlign:`left`,boxShadow:a?`0 0 0 1px color-mix(in srgb, var(--accent) 28%, transparent)`:`none`},children:[(0,E.jsxs)(`span`,{style:{fontSize:`var(--text-lg)`,fontFamily:`var(--font-mono)`,overflowWrap:`anywhere`,wordBreak:`break-word`,color:o?`var(--text-dim)`:void 0},children:[`/`,t.name,o&&(0,E.jsx)(`span`,{style:{marginLeft:6,padding:`0 4px`,border:`1px solid var(--border)`,borderRadius:3,fontSize:`var(--text-2xs)`,color:`var(--text-dim)`,whiteSpace:`nowrap`},children:r(`chat.dormant`)})]}),t.description&&(0,E.jsx)(`span`,{style:{display:`-webkit-box`,WebkitBoxOrient:`vertical`,WebkitLineClamp:2,overflow:`hidden`,fontSize:`var(--text-sm)`,lineHeight:1.35,color:`var(--text-dim)`},children:RK(t,r)})]},`${t.source}:${t.name}`)})})]},t.source))})]}):null}function WK({open:e,onOpenChange:t,onConfirm:n,title:r,hint:i,labelPlaceholder:a,messagePlaceholder:o,initialValue:s,testIdPrefix:c=`bind`}){let{t:l}=N(),[u,f]=(0,d.useState)(s?.label??``),[p,m]=(0,d.useState)(s?.message??``),[h,g]=(0,d.useState)(s?.allowAppend??!1),_=u.trim()!==``&&p.trim()!==``,v=Qn(Te).value,y=(0,d.useMemo)(()=>(v?.skills??[]).map(e=>({name:`skill:${e.name}`,description:e.description,source:`skill`})),[v]),b=(0,d.useMemo)(()=>{let e={};for(let t of v?.skills??[])e[t.name]=t.disableModelInvocation;return e},[v]),x=HK({value:p,commands:y,skillDormancy:b,onLoadCommands:()=>void Te.load().catch(()=>{}),onApply:(0,d.useCallback)(e=>{m(`/${e.name} `)},[])});return(0,E.jsx)(Ax,{open:e,onOpenChange:t,children:(0,E.jsxs)(Px,{className:`sm:max-w-md`,showCloseButton:!0,onEscapeKeyDown:e=>{x.open&&x.query!==null&&e.preventDefault()},children:[(0,E.jsx)(Fx,{style:{fontWeight:700,fontSize:`var(--text-2xl)`,color:`var(--text)`},children:r}),(0,E.jsx)(Ix,{style:{fontSize:`var(--text-base)`,color:`var(--text-dim)`},children:i}),(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:10,marginTop:4},children:[(0,E.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,E.jsx)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--text-muted)`},children:l(`config.widgets.label`)}),(0,E.jsx)(CG,{"data-testid":`${c}-label`,value:u,onChange:e=>f(e.target.value),placeholder:a,autoFocus:!0})]}),(0,E.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,E.jsx)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--text-muted)`},children:l(`config.widgets.message`)}),(0,E.jsxs)(`div`,{style:{position:`relative`},children:[(0,E.jsx)(CG,{"data-testid":`${c}-message`,value:p,onChange:e=>m(e.target.value),placeholder:o,onKeyDown:e=>{x.handleKeyDown(e)||e.key===`Enter`&&_&&(n(u.trim(),p.trim(),h),f(``),m(``),g(!1))}}),(0,E.jsx)(UK,{palette:x,skillDormancy:b})]})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,E.jsx)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--text-muted)`},children:l(`config.widgets.sendMode`)}),(0,E.jsx)(zx,{testId:`${c}-append`,value:h?`fill`:`send`,onChange:e=>g(e===`fill`),options:[{value:`send`,label:l(`config.widgets.sendImmediately`)},{value:`fill`,label:l(`config.widgets.fillToChatInput`)}]})]})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8,marginTop:12},children:[(0,E.jsx)(kx,{type:`button`,variant:`outline`,className:`h-8 px-3 text-xs`,onClick:()=>t(!1),children:l(`i18n.cancel`)}),(0,E.jsx)(kx,{type:`button`,"data-testid":`${c}-confirm`,className:`h-8 px-3 text-xs`,disabled:!_,style:{cursor:_?`pointer`:`default`,opacity:_?1:.5},onClick:()=>{n(u.trim(),p.trim(),h),f(``),m(``),g(!1)},children:l(`config.widgets.confirm`)})]})]})})}function GK({messages:e,onRemove:t,onEdit:n,chipTestIdPrefix:r}){return e.length===0?null:(0,E.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:6,marginTop:8,paddingTop:8,borderTop:`1px solid var(--border)`},children:e.map((e,i)=>(0,E.jsx)(oi,{label:e.message,wrapperStyle:{display:`inline-flex`,minWidth:0},children:(0,E.jsx)(PG,{testId:`${r}-${i}`,label:e.label,title:e.message,onRemove:t?()=>t(i):void 0,onClick:n?()=>n(i):void 0})},i))})}function KK({messages:e,onAdd:t,onRemove:n,onUpdate:r,bindOpen:i,onBindOpenChange:a,ns:o,bindTestIdPrefix:s,editTestIdPrefix:c,chipTestIdPrefix:l,bindHintArgs:u,emptyLabel:f}){let{t:p}=N(),[m,h]=(0,d.useState)(null),[g,_]=(0,d.useState)(null),v=m===null?null:e[m],y=g===null?null:e[g];return(0,E.jsxs)(E.Fragment,{children:[e.length===0?f?(0,E.jsx)(`div`,{style:{padding:`24px 16px`,textAlign:`center`,color:`var(--text-dim)`,fontSize:`var(--text-lg)`,lineHeight:1.6},children:f}):null:(0,E.jsx)(GK,{messages:e,onRemove:e=>h(e),onEdit:e=>_(e),chipTestIdPrefix:l}),i&&(0,E.jsx)(WK,{open:!0,onOpenChange:a,onConfirm:(e,n,r)=>{t({label:e,message:n,allowAppend:r}),a(!1)},testIdPrefix:s,title:p(`config.${o}.bindTitle`),hint:p(`config.${o}.bindHint`,u),labelPlaceholder:p(`config.widgets.labelPlaceholder`),messagePlaceholder:p(`config.widgets.messagePlaceholder`)}),m!==null&&v&&(0,E.jsx)(Bx,{open:!0,title:p(`config.${o}.unbindTitle`),description:(0,E.jsxs)(`span`,{style:{display:`block`},children:[(0,E.jsx)(`span`,{style:{display:`block`},children:p(`config.${o}.unbindConfirm`,{label:v.label})}),(0,E.jsx)(`span`,{style:{display:`block`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,color:`var(--text-muted)`,padding:`6px 8px`,borderRadius:5,background:`var(--bg)`,border:`1px solid var(--border)`,overflowWrap:`anywhere`,marginTop:6},children:v.message})]}),confirmText:p(`config.${o}.unbind`),cancelText:p(`i18n.cancel`),destructive:!0,onCancel:()=>h(null),onConfirm:()=>{n(m),h(null)}}),g!==null&&y&&(0,E.jsx)(WK,{open:!0,onOpenChange:e=>!e&&_(null),onConfirm:(e,t,n)=>{r(g,{label:e,message:t,allowAppend:n}),_(null)},initialValue:y,testIdPrefix:c,title:p(`config.${o}.editTitle`),hint:p(`config.${o}.editHint`),labelPlaceholder:p(`config.widgets.labelPlaceholder`),messagePlaceholder:p(`config.widgets.messagePlaceholder`)},c)]})}function qK(){let{t:e}=N(),{startScreenMessages:t,addStartScreenMessage:n,removeStartScreenMessage:r,updateStartScreenMessage:i,resetStartScreenMessages:a}=ge(),[o,s]=(0,d.useState)(!1);return(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`},children:(0,E.jsxs)(`div`,{style:{flex:1,minHeight:0,overflowY:`auto`,padding:10,display:`flex`,flexDirection:`column`,gap:8},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,color:`var(--text-muted)`},children:e(`config.startScreen.hint`)}),(0,E.jsxs)(`div`,{style:{display:`flex`,gap:6},children:[(0,E.jsx)(oi,{label:e(`config.startScreen.resetHint`),children:(0,E.jsxs)(`button`,{type:`button`,"data-testid":`start-screen-reset`,onClick:a,style:{flexShrink:0,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,E.jsx)(Br,{size:13,"aria-hidden":!0}),e(`config.startScreen.reset`)]})}),(0,E.jsxs)(`button`,{type:`button`,"data-testid":`start-screen-bind`,onClick:()=>s(!0),style:{flexShrink:0,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,E.jsx)(Or,{size:13,"aria-hidden":!0}),e(`config.startScreen.bind`)]})]})]}),(0,E.jsx)(KK,{messages:t,onAdd:n,onRemove:r,onUpdate:i,bindOpen:o,onBindOpenChange:s,ns:`startScreen`,bindTestIdPrefix:`start-screen-bind`,editTestIdPrefix:`start-screen-edit`,chipTestIdPrefix:`start-screen-bound`,emptyLabel:e(`config.startScreen.empty`)})]})})}var JK=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`});function YK(e,t){return JK.compare(`${e.provider}/${e.name||e.modelId}`,`${t.provider}/${t.name||t.modelId}`)}function XK(e,t){let n=t.trim().toLocaleLowerCase();return n?e.filter(e=>`${e.provider}/${e.name}`.toLocaleLowerCase().includes(n)):e}function ZK({value:e,options:t,onChange:n,disabled:r,placeholder:i,variant:a=`form`,isAutoSelection:o}){let{t:s}=N(),[c,l]=(0,d.useState)(!1),[u,f]=(0,d.useState)(``),[m,h]=(0,d.useState)(0),[g,_]=(0,d.useState)(null),v=(0,d.useRef)(null),y=(0,d.useRef)(null),b=(0,d.useRef)(null),x=(0,d.useRef)(null),S=XK([...t].sort(YK),u),C=e?t.find(t=>t.provider===e.provider&&t.modelId===e.modelId)?.name??e.modelId:null;e&&C&&`${e.provider}${C}`,(0,d.useEffect)(()=>{b.current?.scrollIntoView({block:`nearest`})},[m,u]),(0,d.useEffect)(()=>{if(!c)return;let e=e=>{v.current?.contains(e.target)||y.current?.contains(e.target)||(l(!1),f(``))};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[c]);let w=t=>{l(!1),f(``),(e?.provider!==t.provider||e?.modelId!==t.modelId||o)&&n(t.provider,t.modelId)};return(0,E.jsxs)(`div`,{style:{position:`relative`,display:a===`chat`?`flex`:`block`,minWidth:0,flex:a===`chat`?1:void 0},children:[(0,E.jsxs)(`button`,{ref:v,type:`button`,disabled:r,onClick:e=>{if(r)return;if(c){l(!1),f(``);return}let t=e.currentTarget.getBoundingClientRect();_({top:t.top,left:t.left,width:t.width}),l(!0),h(0),requestAnimationFrame(()=>x.current?.focus())},style:a===`chat`?{display:`flex`,alignItems:`center`,gap:6,padding:`8px 12px`,height:32,minWidth:0,maxWidth:`100%`,overflow:`hidden`,background:`none`,border:`none`,borderRadius:9,color:`var(--text-muted)`,cursor:r?`not-allowed`:`pointer`,fontSize:`var(--text-base)`,opacity:r?.5:1}:{display:`flex`,alignItems:`center`,gap:6,padding:`6px 10px`,height:32,width:320,maxWidth:`100%`,background:`var(--bg-input)`,border:`1px solid var(--border)`,borderRadius:6,color:e?`var(--text)`:`var(--text-dim)`,cursor:r?`not-allowed`:`pointer`,fontSize:`var(--text-base)`,textAlign:`left`},className:r?void 0:`hover-shift`,"aria-expanded":c,children:[a===`chat`&&(0,E.jsx)(_r,{size:p[`2xl`],style:{color:`var(--status-info)`,flexShrink:0}}),(0,E.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,minWidth:0,flex:a===`form`?1:void 0},children:e&&C?a===`chat`?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`span`,{style:{color:`var(--text-dim)`},children:[e.provider,`/`]}),(0,E.jsx)(`span`,{style:{fontWeight:700,color:`var(--text)`},children:C})]}):`${e.provider}/${C}`:i??(t.length>0?s(`chat.filterModels`):s(`git.commitModel.noModels`))})]}),c&&g&&(0,E.jsxs)(`div`,{ref:y,"data-testid":`model-dropdown`,style:{position:`fixed`,zIndex:500,background:`var(--bg)`,border:`1px solid var(--border)`,borderRadius:8,boxShadow:`0 -4px 16px var(--shadow-color)`,overflow:`hidden`,display:`flex`,flexDirection:`column`,...a===`chat`?(()=>{let e=window.visualViewport?.height??window.innerHeight,t=e-g.top+6,n=Math.max(120,Math.min(g.top-8,e*.6));return{bottom:t,left:g.left,width:`max-content`,minWidth:g.width,maxHeight:n}})():{top:g.top+32+4,left:g.left,width:g.width,maxHeight:280}},children:[(0,E.jsx)(`div`,{style:{padding:6,borderBottom:`1px solid var(--border)`},children:(0,E.jsx)(`input`,{ref:x,value:u,onChange:e=>{f(e.target.value),h(0)},onKeyDown:e=>{if(e.key===`Escape`)f(``),l(!1);else if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),S.length===0)return;h(t=>e.key===`ArrowDown`?(t+1)%S.length:(t-1+S.length)%S.length)}else if(e.key===`Enter`){let e=S[m]??S[0];e&&w(e)}},placeholder:s(`chat.filterModels`),autoComplete:`off`,spellCheck:!1,style:{width:`100%`,padding:`6px 8px`,background:`var(--bg-hover)`,border:`none`,borderRadius:6,color:`var(--text)`,fontSize:`var(--text-base)`,outline:`none`}})}),(0,E.jsx)(`div`,{style:{minHeight:0,overflowY:`auto`},children:S.length===0?(0,E.jsx)(`div`,{style:{padding:`8px 12px`,color:`var(--text-dim)`,fontSize:`var(--text-base)`,whiteSpace:`nowrap`},children:u.trim()?s(`chat.noMatchingModels`):s(`git.commitModel.noModels`)}):S.map((t,n)=>{let r=e?.provider===t.provider&&e?.modelId===t.modelId,i=n===m;return(0,E.jsxs)(`button`,{ref:i?b:void 0,"data-highlighted":i?`true`:void 0,onClick:()=>w(t),onMouseEnter:()=>h(n),style:{display:`flex`,alignItems:`center`,gap:8,width:`100%`,padding:`7px 12px`,background:i?`var(--bg-hover)`:r?`var(--bg-selected)`:`none`,border:`none`,color:r?`var(--text)`:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-base)`,textAlign:`left`,fontWeight:r?600:400,whiteSpace:`nowrap`},children:[r?(0,E.jsx)(ur,{size:p.xs,strokeWidth:4.8,style:{flexShrink:0}}):(0,E.jsx)(`span`,{style:{width:10,flexShrink:0}}),(0,E.jsxs)(`span`,{style:{display:`inline`},children:[(0,E.jsxs)(`span`,{style:{color:`var(--text-dim)`},children:[t.provider,`/`]}),(0,E.jsx)(`span`,{style:{fontWeight:700},children:t.name})]})]},`${t.provider}:${t.modelId}`)})})]})]})}function QK(e){fetch(`/api/preferences`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({preferences:e})}).catch(()=>{}).finally(()=>void Se.refresh().catch(()=>{}))}var $K={};function eq(){let{t:e}=N(),t=(0,d.useSyncExternalStore)(Se.subscribe,()=>Se.get()?.preferences??$K,()=>$K),n=(0,d.useSyncExternalStore)(be.subscribe,()=>be.get()??null),r=t,i=r.commitMessageUseCurrentModel===!0,a=typeof r.commitMessageModel==`string`?r.commitMessageModel:``,o=typeof r.commitMessageMaxTokens==`number`&&Number.isFinite(r.commitMessageMaxTokens)?r.commitMessageMaxTokens:512,s=r.commitMessageAutoGenerateOnEmpty!==!1,c=r.commitStageAllConfirm!==!1,l=(n?.modelList??[]).map(e=>({provider:e.provider,modelId:e.id,name:e.name})),u=e=>{QK({commitMessageUseCurrentModel:e})},f=(e,t)=>{QK({commitMessageModel:`${e}/${t}`})},p=e=>{let t=Number(e);Number.isFinite(t)&&QK({commitMessageMaxTokens:Math.min(4096,Math.max(64,Math.round(t)))})},m=e=>{QK({commitMessageAutoGenerateOnEmpty:e})},h=e=>{QK({commitStageAllConfirm:e})},g=(()=>{if(!a)return null;let e=a.indexOf(`/`);return e===-1?null:{provider:a.slice(0,e),modelId:a.slice(e+1)}})();return(0,E.jsxs)(`div`,{style:{height:`100%`,overflowY:`auto`,padding:`18px 20px 40px`,display:`flex`,flexDirection:`column`,gap:16,maxWidth:640},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12,padding:`14px 16px`,border:`1px solid var(--border)`,borderRadius:10,background:`var(--bg-panel)`},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,fontWeight:600,color:`var(--text)`,lineHeight:1.4},children:e(`git.commitSectionTitle`)}),(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:(0,E.jsx)(pi,{label:e(`git.commitConfirmStageAll`),hint:e(`git.commitConfirmStageAllHint`),children:(0,E.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:8,cursor:`pointer`,fontSize:`var(--text-base)`},children:[(0,E.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>h(e.target.checked)}),(0,E.jsx)(`span`,{children:e(c?`git.commitConfirmStageAllOn`:`git.commitConfirmStageAllOff`)})]})})})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12,padding:`14px 16px`,border:`1px solid var(--border)`,borderRadius:10,background:`var(--bg-panel)`},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,fontWeight:600,color:`var(--text)`,lineHeight:1.4},children:e(`git.groupTitle`)}),(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,E.jsx)(pi,{label:e(`git.commitModel.followCurrent`),hint:e(`git.commitModel.followCurrentHint`),children:(0,E.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:8,cursor:`pointer`,fontSize:`var(--text-base)`},children:[(0,E.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>u(e.target.checked)}),(0,E.jsx)(`span`,{children:e(i?`git.commitModel.followCurrentOn`:`git.commitModel.followCurrentOff`)})]})}),!i&&(0,E.jsx)(pi,{label:e(`git.commitModel.fixedModel`),hint:e(`git.commitModel.fixedModelHint`),children:(0,E.jsx)(ZK,{value:g,options:l,onChange:f,variant:`form`,placeholder:e(`git.commitModel.selectPlaceholder`)})}),!i&&!a&&(0,E.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--status-warning)`,padding:`0 2px`},children:e(`git.commitModel.notConfiguredHint`)}),(0,E.jsx)(pi,{label:e(`git.commitModel.autoGenerateOnEmpty`),hint:e(`git.commitModel.autoGenerateOnEmptyHint`),children:(0,E.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:8,cursor:`pointer`,fontSize:`var(--text-base)`},children:[(0,E.jsx)(`input`,{type:`checkbox`,checked:s,onChange:e=>m(e.target.checked)}),(0,E.jsx)(`span`,{children:e(s?`git.ai.autoGenerateOn`:`git.ai.autoGenerateOff`)})]})}),(0,E.jsx)(pi,{label:e(`git.commitModel.maxTokens`),hint:e(`git.commitModel.maxTokensHint`),children:(0,E.jsx)(`input`,{type:`number`,min:64,max:4096,step:64,value:o,onChange:e=>p(e.target.value),onBlur:e=>{let t=Number(e.target.value);(!Number.isFinite(t)||t<64||t>4096)&&(e.target.value=String(o))},style:{width:120,height:28,padding:`0 8px`,fontSize:`var(--text-base)`,color:`var(--text)`,background:`var(--bg)`,border:`1px solid var(--border)`,borderRadius:6,outline:`none`}})})]})]})]})}function tq(e){fetch(`/api/model-thinking`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}).catch(()=>{}).finally(()=>void Ee.refresh().catch(()=>{}))}function nq({value:e,providers:t,placeholder:n,onChange:r}){let{t:i}=N(),[a,o]=(0,d.useState)(!1),[s,c]=(0,d.useState)(``),l=(0,d.useRef)(null),u=(0,d.useRef)(null);(0,d.useEffect)(()=>{if(!a)return;let e=e=>{l.current?.contains(e.target)||(o(!1),c(``))};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[a]),(0,d.useEffect)(()=>{a&&requestAnimationFrame(()=>u.current?.focus())},[a]);let f=s.trim().toLocaleLowerCase(),m=f?t.filter(e=>e.toLocaleLowerCase().includes(f)):t,h=e=>{let t=e.trim();t&&(r(t),o(!1),c(``))};return(0,E.jsxs)(`div`,{ref:l,style:{position:`relative`,minWidth:220},children:[(0,E.jsxs)(`button`,{type:`button`,onClick:()=>{if(a){o(!1),c(``);return}c(``),o(!0)},style:{display:`flex`,alignItems:`center`,gap:6,padding:`6px 10px`,height:32,width:220,maxWidth:`100%`,background:`var(--bg-input)`,border:`1px solid var(--border)`,borderRadius:6,color:e?`var(--text)`:`var(--text-dim)`,cursor:`pointer`,fontSize:`var(--text-base)`,textAlign:`left`},className:`hover-shift`,"aria-expanded":a,children:[(0,E.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,flex:1},children:e||n}),(0,E.jsx)(dr,{size:p.sm,style:{color:`var(--text-dim)`,flexShrink:0}})]}),a&&(0,E.jsxs)(`div`,{style:{position:`absolute`,top:36,left:0,width:`max-content`,minWidth:`100%`,zIndex:500,background:`var(--bg)`,border:`1px solid var(--border)`,borderRadius:8,boxShadow:`0 -4px 16px var(--shadow-color)`,overflow:`hidden`,display:`flex`,flexDirection:`column`,maxHeight:280},children:[(0,E.jsx)(`div`,{style:{padding:6,borderBottom:`1px solid var(--border)`,position:`sticky`,top:0,background:`var(--bg)`,zIndex:1},children:(0,E.jsx)(`input`,{ref:u,value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Escape`?(o(!1),c(``)):e.key===`ArrowDown`||e.key===`ArrowUp`?e.preventDefault():e.key===`Enter`&&h(m[0]??s)},placeholder:i(`i18n.searchProviders`),autoComplete:`off`,spellCheck:!1,style:{width:`100%`,padding:`6px 8px`,background:`var(--bg-hover)`,border:`none`,borderRadius:6,color:`var(--text)`,fontSize:`var(--text-base)`,outline:`none`}})}),(0,E.jsxs)(`div`,{style:{overflowY:`auto`},children:[t.filter(e=>!f||e.toLocaleLowerCase().includes(f)).map(t=>{let n=t===e;return(0,E.jsxs)(`button`,{type:`button`,onClick:()=>h(t),style:{display:`flex`,alignItems:`center`,gap:8,width:`100%`,padding:`7px 12px`,background:n?`var(--bg-selected)`:`none`,border:`none`,color:n?`var(--text)`:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-base)`,textAlign:`left`,fontWeight:n?600:400,whiteSpace:`nowrap`},children:[n?(0,E.jsx)(ur,{size:p.xs,strokeWidth:4.8,style:{flexShrink:0}}):(0,E.jsx)(`span`,{style:{width:10,flexShrink:0}}),(0,E.jsx)(`span`,{children:t})]},t)}),f&&!t.some(e=>e.toLocaleLowerCase()===f)&&(0,E.jsxs)(`button`,{type:`button`,onClick:()=>h(s),style:{display:`flex`,alignItems:`center`,gap:8,width:`100%`,padding:`7px 12px`,background:`none`,border:`none`,color:`var(--accent)`,cursor:`pointer`,fontSize:`var(--text-base)`,textAlign:`left`,whiteSpace:`nowrap`},children:[(0,E.jsx)(Ir,{size:p.xs,style:{flexShrink:0}}),(0,E.jsx)(`span`,{children:s.trim()})]}),!f&&t.length===0&&(0,E.jsx)(`div`,{style:{padding:`8px 12px`,color:`var(--text-dim)`,fontSize:`var(--text-base)`},children:i(`chat.noMatchingModels`)})]})]})]})}function rq({value:e,onChange:t,ariaLabel:n,width:r=225}){let{t:i}=N();return(0,E.jsxs)(wm,{value:e,onValueChange:e=>t(e),children:[(0,E.jsx)(Em,{size:`sm`,style:{width:r,background:`var(--bg-input)`,flexShrink:0},"aria-label":n,children:(0,E.jsx)(Tm,{})}),(0,E.jsx)(Dm,{children:bi.map(e=>(0,E.jsxs)(Om,{value:e,className:`text-xs`,children:[(0,E.jsx)(`span`,{className:`font-mono`,children:e}),(0,E.jsx)(`span`,{style:{color:`var(--text-muted)`},children:i(Si[e])})]},e))})]})}var iq={};function aq(){let{t:e}=N(),t=(0,d.useSyncExternalStore)(Ee.subscribe,()=>Ee.get()??iq,()=>iq),n=(0,d.useSyncExternalStore)(be.subscribe,()=>be.get()??null);(0,d.useEffect)(()=>{Ee.load().catch(()=>{})},[]);let r=n?.modelList??[],i=(0,d.useMemo)(()=>r.map(e=>({provider:e.provider,modelId:e.id,name:e.name})),[r]),a=(0,d.useMemo)(()=>{let e=new Set;for(let t of r)e.add(t.provider);for(let n of Object.keys(t.providers??{}))e.add(n);return Array.from(e).sort((e,t)=>e.localeCompare(t))},[r,t.providers]),o=(0,d.useMemo)(()=>Object.entries(t.models??{}).sort(([e],[t])=>e.localeCompare(t)),[t.models]),s=(0,d.useMemo)(()=>Object.entries(t.providers??{}).sort(([e],[t])=>e.localeCompare(t)),[t.providers]),c=(e,n)=>{tq({...t,models:{...t.models??{},[e]:n}})},l=e=>{let n={...t.models??{}};delete n[e];let r={...t};Object.keys(n).length===0?delete r.models:r.models=n,tq(r)},u=(e,n)=>{tq({...t,providers:{...t.providers??{},[e]:n}})},f=e=>{let n={...t.providers??{}};delete n[e];let r={...t};Object.keys(n).length===0?delete r.providers:r.providers=n,tq(r)},[p,m]=(0,d.useState)(null),[h,g]=(0,d.useState)(`medium`),[_,v]=(0,d.useState)(``),[y,b]=(0,d.useState)(`medium`);return(0,E.jsxs)(`div`,{style:{height:`100%`,overflowY:`auto`,padding:`18px 20px 40px`,display:`flex`,flexDirection:`column`,gap:16,maxWidth:720},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-muted)`,lineHeight:1.6},children:e(`modelThinking.desc`)}),(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12,padding:`14px 16px`,border:`1px solid var(--border)`,borderRadius:10,background:`var(--bg-panel)`},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,fontWeight:600,color:`var(--text)`},children:e(`modelThinking.byModel`)}),o.length===0?(0,E.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`,padding:`4px 0`},children:e(`modelThinking.emptyModel`)}):(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:o.map(([t,n])=>(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`8px 10px`,border:`1px solid var(--border)`,borderRadius:8,background:`var(--bg)`},children:[(0,E.jsx)(`span`,{style:{flex:1,fontSize:`var(--text-sm)`,color:`var(--text)`,fontFamily:`var(--font-mono)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t}),(0,E.jsx)(rq,{value:n,onChange:e=>c(t,e),ariaLabel:`${t} ${e(`i18n.thinking`)}`}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>l(t),title:e(`common.delete`),style:{width:28,height:28,display:`flex`,alignItems:`center`,justifyContent:`center`,border:`1px solid var(--border)`,borderRadius:6,background:`var(--bg-panel)`,color:`var(--text-muted)`,cursor:`pointer`},children:(0,E.jsx)(Yr,{size:14})})]},t))}),(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,flexWrap:`wrap`,marginTop:4},children:[(0,E.jsx)(ZK,{value:p?{provider:p.provider,modelId:p.modelId}:null,options:i,onChange:(e,t)=>{let n=i.find(n=>n.provider===e&&n.modelId===t);m(n??{provider:e,modelId:t,name:`${e}/${t}`})},variant:`form`,placeholder:e(`modelThinking.selectModelPlaceholder`)}),(0,E.jsx)(rq,{value:h,onChange:g,ariaLabel:e(`modelThinking.byModel`)}),(0,E.jsxs)(`button`,{type:`button`,onClick:()=>{if(!p)return;let e=`${p.provider}/${p.modelId}`;tq({...t,models:{...t.models??{},[e]:h}}),m(null)},disabled:!p,style:{height:32,padding:`0 12px`,display:`flex`,alignItems:`center`,gap:6,border:`1px solid var(--accent)`,borderRadius:6,background:p?`var(--accent)`:`var(--bg)`,color:p?`white`:`var(--text-dim)`,cursor:p?`pointer`:`not-allowed`,fontSize:`var(--text-sm)`,fontWeight:600},children:[(0,E.jsx)(Ir,{size:14}),` `,e(`common.add`)]})]})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12,padding:`14px 16px`,border:`1px solid var(--border)`,borderRadius:10,background:`var(--bg-panel)`},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,fontWeight:600,color:`var(--text)`},children:e(`modelThinking.byProvider`)}),(0,E.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-muted)`,lineHeight:1.5},children:e(`modelThinking.byProviderHint`)}),s.length===0?(0,E.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`,padding:`4px 0`},children:e(`modelThinking.emptyProvider`)}):(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:s.map(([t,n])=>(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`8px 10px`,border:`1px solid var(--border)`,borderRadius:8,background:`var(--bg)`},children:[(0,E.jsx)(`span`,{style:{flex:1,fontSize:`var(--text-sm)`,color:`var(--text)`,fontFamily:`var(--font-mono)`},children:t}),(0,E.jsx)(rq,{value:n,onChange:e=>u(t,e),ariaLabel:`${t} ${e(`i18n.thinking`)}`}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>f(t),title:e(`common.delete`),style:{width:28,height:28,display:`flex`,alignItems:`center`,justifyContent:`center`,border:`1px solid var(--border)`,borderRadius:6,background:`var(--bg-panel)`,color:`var(--text-muted)`,cursor:`pointer`},children:(0,E.jsx)(Yr,{size:14})})]},t))}),(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,flexWrap:`wrap`,marginTop:4},children:[(0,E.jsx)(nq,{value:_,providers:a,placeholder:e(`modelThinking.selectProviderPlaceholder`),onChange:v}),(0,E.jsx)(rq,{value:y,onChange:b,ariaLabel:e(`modelThinking.byProvider`)}),(0,E.jsxs)(`button`,{type:`button`,onClick:()=>{let e=_.trim();e&&(tq({...t,providers:{...t.providers??{},[e]:y}}),v(``))},disabled:!_.trim(),style:{height:32,padding:`0 12px`,display:`flex`,alignItems:`center`,gap:6,border:`1px solid var(--accent)`,borderRadius:6,background:_.trim()?`var(--accent)`:`var(--bg)`,color:_.trim()?`white`:`var(--text-dim)`,cursor:_.trim()?`pointer`:`not-allowed`,fontSize:`var(--text-sm)`,fontWeight:600},children:[(0,E.jsx)(Ir,{size:14}),` `,e(`common.add`)]})]})]}),(0,E.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`,lineHeight:1.6,padding:`0 2px`},children:e(`modelThinking.footerHint`)})]})}var oq=[`models`,`plugins`,`skills`,`session`,`appearance`,`startScreen`,`git`,`modelThinking`,`advanced`];function sq({section:e,onSectionChange:t,cwd:n,sessionId:r,onClose:i,onOpenFile:a,defaultThinkingLevel:o,onDefaultThinkingLevelChange:s,compaction:c,onCompactionChange:l,retry:u,onRetryChange:f,defaultProjectTrust:p,onDefaultProjectTrustChange:m,subagents:h,onSubagentsChange:g,sidebarWidth:_,onSidebarWidthChange:v,widgetPanelWidth:y,onWidgetPanelWidthChange:b,modelConfigFocus:x}){let{t:S}=N(),{value:C}=Qn(we),{value:w}=Qn(Te);(0,d.useEffect)(()=>{we.load().catch(()=>{}),Te.load().catch(()=>{})},[]);let T=e=>{switch(e){case`models`:return S(`common.models`);case`plugins`:return S(`common.plugins`);case`skills`:return S(`common.skills`);case`startScreen`:return S(`config.section.startScreen`);case`session`:return S(`config.section.session`);case`appearance`:return S(`config.section.appearance`);case`advanced`:return S(`config.section.advanced`);case`git`:return S(`config.section.git`);case`modelThinking`:return S(`config.section.modelThinking`)}},D=e=>{switch(e){case`models`:return(0,E.jsx)(_r,{size:15});case`plugins`:return(0,E.jsx)(Lr,{size:15});case`skills`:return(0,E.jsx)(ti,{size:15});case`startScreen`:return(0,E.jsx)(ri,{size:15});case`session`:return(0,E.jsx)(Gr,{size:15});case`appearance`:return(0,E.jsx)(Mr,{size:15});case`advanced`:return(0,E.jsx)(Ur,{size:15});case`git`:return(0,E.jsx)(Sr,{size:15});case`modelThinking`:return(0,E.jsx)(Dr,{size:15})}},O=oq.map(e=>({id:e,label:T(e),icon:D(e),closable:!1}));return(0,E.jsx)(`div`,{style:{height:`100%`,display:`flex`,flexDirection:`column`,overflow:`hidden`,background:`var(--bg)`},children:(0,E.jsxs)(Gn,{tabs:O,activeTabId:e,onSelectTab:e=>t(e),onCloseTab:()=>{},children:[(0,E.jsx)(Un,{id:`models`,children:(0,E.jsx)(HS,{onClose:i,pane:!0,initialSelection:x?{provider:x.provider,modelId:x.modelId}:null})}),(0,E.jsx)(Un,{id:`plugins`,children:n?(0,E.jsx)(xK,{cwd:n,sessionId:r,onClose:i,onOpenFile:a,pane:!0,globalPackages:C?.packages??[],globalExtensionFilters:C?.extensionFilters??[]}):(0,E.jsx)(cq,{text:S(`config.section.requiresCwd`)})}),(0,E.jsx)(Un,{id:`skills`,children:n?(0,E.jsx)(jK,{cwd:n,onClose:i,pane:!0,homeSkills:w?.skills??[]}):(0,E.jsx)(cq,{text:S(`config.section.requiresCwd`)})}),(0,E.jsx)(Un,{id:`startScreen`,children:(0,E.jsx)(qK,{})}),(0,E.jsx)(Un,{id:`session`,children:(0,E.jsx)(Pm,{defaultThinkingLevel:o,onDefaultThinkingLevelChange:s,compaction:c,onCompactionChange:l,retry:u,onRetryChange:f,defaultProjectTrust:p,onDefaultProjectTrustChange:m,subagents:h,onSubagentsChange:g})}),(0,E.jsx)(Un,{id:`appearance`,children:(0,E.jsx)(hi,{sidebarWidth:_,onSidebarWidthChange:v,widgetPanelWidth:y,onWidgetPanelWidthChange:b})}),(0,E.jsx)(Un,{id:`advanced`,children:(0,E.jsx)(Lm,{})}),(0,E.jsx)(Un,{id:`git`,children:(0,E.jsx)(eq,{})}),(0,E.jsx)(Un,{id:`modelThinking`,children:(0,E.jsx)(aq,{})})]})})}function cq({text:e}){return(0,E.jsx)(`div`,{style:{height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`var(--text-muted)`,fontSize:`var(--text-lg)`,padding:24,textAlign:`center`},children:e})}var lq=`chat`,uq=`config`,dq=`widgets`,fq=e=>`file:${e}`;function pq(e){if(!e||typeof e!=`object`)return null;let t=e;return t.kind===`config`?typeof t.section==`string`&&oq.includes(t.section)?{kind:`config`,section:t.section}:null:t.kind===`file`&&typeof t.filePath==`string`&&t.filePath&&typeof t.label==`string`?{kind:`file`,filePath:t.filePath,label:t.label,sourceSessionId:typeof t.sourceSessionId==`string`?t.sourceSessionId:null,initialDisplayMode:t.initialDisplayMode===`source`||t.initialDisplayMode===`preview`||t.initialDisplayMode===`diff`?t.initialDisplayMode:void 0}:null}var mq=e=>Array.isArray(e)?e.map(pq).filter(e=>e!==null):[];function hq(e){return{id:fq(e.filePath),label:e.label,filePath:e.filePath,sourceSessionId:e.sourceSessionId,initialDisplayMode:e.initialDisplayMode}}function gq(){try{if(localStorage.getItem(`pi:openTabs`)!==null)return[];let e=[],t=JSON.parse(localStorage.getItem(`pi:fileTabs`)??`[]`);if(e.push(...mq(Array.isArray(t)?t.map(e=>({kind:`file`,...typeof e==`object`&&e?e:{}})):[])),localStorage.getItem(`pi:configTabOpen`)===`1`){let t=pq({kind:`config`,section:localStorage.getItem(`pi:configSection`)??`models`});t&&e.unshift(t)}for(let e of[`pi:fileTabs`,`pi:activeFileTab`,`pi:configTabOpen`,`pi:configTabActive`,`pi:configSection`])localStorage.removeItem(e);return e}catch{return[]}}function _q(){try{return localStorage.getItem(`pi:openTabsActive`)===null?localStorage.getItem(`pi:configTabActive`)===`1`?uq:localStorage.getItem(`pi:activeFileTab`):null}catch{return null}}function vq({onSessionSelected:e,onRefreshModels:t}){let[n,r]=Zn(`pi:openTabs`,gq,mq),[i,a]=Zn(`pi:openTabsActive`,_q),[o,s]=(0,d.useState)(null),c=n.find(e=>e.kind===`config`),l=c!==void 0,u=c?.kind===`config`?c.section:`models`,f=(0,d.useCallback)(e=>{r(t=>t.map(t=>t.kind===`config`?{kind:`config`,section:e}:t))},[r]),p=(0,d.useMemo)(()=>n.filter(e=>e.kind===`file`).map(hq),[n]),m=i===null?null:n.find(e=>e.kind===`file`&&fq(e.filePath)===i)??null,h=l&&i===`config`,g=(0,d.useCallback)((t,n,i)=>{let o=i?.sourceSessionId,s=i?.modeHint,c=fq(t);r(e=>{let r=e.find(e=>e.kind===`file`&&e.filePath===t);if(!r)return[...e,{kind:`file`,filePath:t,label:n,sourceSessionId:o,initialDisplayMode:s}];let i=!o||r.sourceSessionId===o,a=!s||r.initialDisplayMode===s;return i&&a?e:e.map(e=>e.kind!==`file`||e.filePath!==t?e:{...e,sourceSessionId:o??e.sourceSessionId,initialDisplayMode:s??e.initialDisplayMode})}),e?.(),a(c)},[e,r,a]),_=(0,d.useCallback)(e=>{r(t=>t.filter(t=>t.kind!==`file`||fq(t.filePath)!==e)),a(t=>{if(t!==e)return t;let r=n.filter(t=>t.kind===`file`&&fq(t.filePath)!==e);return r.length>0?fq(r[r.length-1].filePath):null})},[n,r,a]),v=(0,d.useCallback)(t=>{r(e=>{let n=e.findIndex(e=>e.kind===`config`),r=t??(n>=0&&e[n].kind===`config`?e[n].section:`models`);if(n>=0){let t=[...e];return t[n]={kind:`config`,section:r},t}return[...e,{kind:`config`,section:r}]}),e?.(),a(uq)},[e,r,a]),y=(0,d.useCallback)(e=>{s(e),v(`models`)},[v]),b=(0,d.useCallback)(()=>{r(e=>e.filter(e=>e.kind!==`config`)),a(e=>e===`config`?null:e),s(null),t?.()},[r,a,t]);return{savedTabs:n,setSavedTabs:r,activeSavedId:i,setActiveSavedId:a,configTabOpen:l,configSection:u,setConfigSection:f,configTabActive:h,activeFileTab:m,fileTabs:p,modelConfigFocus:o,handleOpenFile:g,handleCloseFileTab:_,openConfigTab:v,handleOpenModelConfig:y,closeConfigTab:b,handleCloseMainTab:(0,d.useCallback)(e=>{if(e===`config`){b();return}_(e)},[b,_])}}function yq({widgetGeometries:e,setWidgetGeometry:t}){let[n,r]=(0,d.useState)(!0),[i,a]=(0,d.useState)(!1),[o,s]=(0,d.useState)([]),[c,l]=(0,d.useState)(new Map),[u,f]=(0,d.useState)(!0);return{widgetPanelOpen:n,setWidgetPanelOpen:r,widgetsTabActive:i,setWidgetsTabActive:a,extensionWidgets:o,closedWidgets:c,handleCloseWidget:(0,d.useCallback)((n,r)=>{l(e=>new Map(e).set(n,r));let i=e[n];t(n,{x:i?.x??0,y:i?.y??0,width:i?.width??560,height:i?.height??Math.round(window.innerHeight*.6),collapsed:!0})},[e,t]),handleReopenWidget:(0,d.useCallback)(n=>{l(e=>{if(!e.has(n))return e;let t=new Map(e);return t.delete(n),t});let r=e[n];r&&t(n,{...r,collapsed:!1}),a(!1)},[e,t,a]),handleExtensionWidgetsChange:(0,d.useCallback)(n=>{s(n),l(r=>{let i=!1,a=new Map(r);for(let[o,s]of r){let r=n.find(e=>e.key===o);if(r&&r.lines.join(`
347
+ `),style:{color:u.diagnostics.some(e=>e.type===`error`)?`var(--status-error)`:`var(--status-warning)`},children:[u.diagnostics.length,` diagnostic`,u.diagnostics.length===1?``:`s`]}):(0,E.jsx)(`span`,{children:u?`${u.totals.extensions} ext · ${u.totals.skills} skills · ${u.totals.prompts} prompts · ${u.totals.themes} themes`:``})}),(0,E.jsx)(`button`,{onClick:()=>void ye(),disabled:m||ae!==null,style:cK(m||ae!==null),children:l(`i18n.refresh`)}),(0,E.jsx)(`button`,{onClick:n,style:cK(!1),children:l(`i18n.close`)})]})]})})}function SK(e){return e.replace(/^\/(?:Users|home)\/[^/]+/,`~`)}function CK(e){let t=e.sourceInfo?.source,n=e.sourceInfo?.scope;return n===`user`||t===`user`?`global`:n===`project`||t===`project`?`project`:`path`}function wK(e){let t=CK(e);return t===`path`?t:e.install?.skillsShUrl?`${t} / skills.sh`:t}function TK(e){return e.install?`${e.install.scope}\0${e.install.package}`:null}function EK(e){return e?e.slice(0,8):`unknown`}function DK({enabled:e,loading:t,onToggle:n}){let{t:r}=N();return(0,E.jsx)(`button`,{onClick:n,disabled:t,title:r(e?`i18n.visibleInPrompt`:`i18n.hiddenFromPrompt`),style:{flexShrink:0,width:40,height:22,borderRadius:11,border:`none`,padding:0,cursor:t?`wait`:`pointer`,background:e?`var(--accent)`:`var(--border)`,position:`relative`,transition:`background 0.18s`,outline:`none`},children:(0,E.jsx)(`span`,{style:{position:`absolute`,top:3,left:e?21:3,width:16,height:16,borderRadius:`50%`,background:`var(--bg)`,boxShadow:`0 1px 4px var(--shadow-color)`,transition:`left 0.18s cubic-bezier(.4,0,.2,1)`}})})}function OK({skill:e,cwd:t,onToggle:n,toggling:r,saveError:i,updateStatus:a,checkingUpdate:o,updating:s,updateError:c,onCheckUpdate:l,onUpdate:u}){let{t:d}=N(),f=CK(e),p=!e.disableModelInvocation;function m(e){return f===`project`&&e.startsWith(t)?`./${e.slice(t.length).replace(/^[/\\]/,``)}`:SK(e)}return(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:20},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:7},children:[(0,E.jsx)(`span`,{style:{fontSize:`var(--text-xs)`,padding:`1px 5px`,borderRadius:3,flexShrink:0,background:f===`project`?`color-mix(in srgb, var(--status-info) 12%, transparent)`:`color-mix(in srgb, var(--text-dim) 12%, transparent)`,color:f===`project`?`color-mix(in srgb, var(--status-info) 80%, transparent)`:`var(--text-dim)`},children:f}),(0,E.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`,flex:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:m(e.filePath)}),(0,E.jsx)(DK,{enabled:p,loading:r,onToggle:()=>n(e)})]}),(0,E.jsxs)(`div`,{style:{minHeight:16,display:`flex`,alignItems:`center`,justifyContent:`flex-end`,gap:8,flexWrap:`wrap`,textAlign:`right`},children:[!p&&(0,E.jsx)(`span`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:d(`i18n.hiddenButInvocable`)}),i&&(0,E.jsx)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--status-error)`,overflowWrap:`anywhere`},children:i})]})]}),e.install?.skillsShUrl&&(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5},children:[(0,E.jsx)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--text-muted)`,fontWeight:500},children:`Source`}),(0,E.jsx)(`a`,{href:e.install.skillsShUrl,target:`_blank`,rel:`noreferrer`,title:e.install.skillsShUrl,style:{display:`flex`,alignItems:`center`,gap:8,width:`fit-content`,maxWidth:`100%`,color:`var(--accent)`,textDecoration:`none`},children:(0,E.jsxs)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`var(--text-base)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:[e.install.skillsShUrl.replace(/^https?:\/\//,``),` ↗`]})})]}),e.install&&(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:7},children:[(0,E.jsx)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--text-muted)`,fontWeight:500},children:`Version`}),(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,flexWrap:`wrap`},children:[(0,E.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`var(--text-base)`,color:`var(--text-muted)`},children:EK(a?.currentVersion??e.install.versionHash)}),e.install.canCheckForUpdates&&(0,E.jsx)(`button`,{onClick:l,disabled:o||s,style:{padding:`4px 9px`,border:`1px solid var(--border)`,borderRadius:5,background:`none`,color:`var(--text-muted)`,cursor:o||s?`not-allowed`:`pointer`,opacity:o||s?.5:1,fontSize:`var(--text-sm)`},children:d(`i18n.check`)}),a?.state===`update-available`&&(0,E.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`var(--text-base)`,color:`var(--status-warning)`},children:EK(a.latestVersion)}),(o||a&&a.state!==`update-available`)&&(0,E.jsx)(`span`,{style:{fontSize:`var(--text-base)`,color:o?`var(--accent)`:a?.state===`up-to-date`?`var(--status-success)`:a?.state===`error`?`var(--status-error)`:`var(--text-dim)`},children:o?d(`i18n.checking`):a?.state===`up-to-date`?d(`i18n.upToDate`):a?.state===`unsupported`?d(`i18n.automaticChecksUnavailable`):a?.message||d(`i18n.checkFailed`)}),a?.state===`update-available`&&(0,E.jsx)(`button`,{onClick:u,disabled:s||o,style:{padding:`4px 10px`,border:`none`,borderRadius:5,background:`var(--accent)`,color:`var(--on-accent)`,cursor:s||o?`not-allowed`:`pointer`,opacity:s||o?.5:1,fontSize:`var(--text-sm)`,fontWeight:600},children:d(s?`i18n.updating`:`i18n.update`)})]}),c&&(0,E.jsx)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--status-error)`},children:c})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5},children:[(0,E.jsx)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--text-muted)`,fontWeight:500},children:`Name`}),(0,E.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`var(--text-xl)`,color:`var(--text)`},children:e.name})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5},children:[(0,E.jsx)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--text-muted)`,fontWeight:500},children:`Description`}),(0,E.jsx)(`span`,{style:{fontSize:`var(--text-xl)`,color:`var(--text-muted)`,lineHeight:1.6},children:e.description})]})]})}function kK({cwd:e,installedPackages:t,projectResourcesLoaded:n,onInstalled:r}){let{t:i}=N(),[a,o]=(0,d.useState)(``),[s,c]=(0,d.useState)([]),[l,u]=(0,d.useState)(!1),[f,p]=(0,d.useState)(null),[m,h]=(0,d.useState)(null),[g,_]=(0,d.useState)(null),[v,y]=(0,d.useState)(new Set),[b,x]=(0,d.useState)(`global`),S=(0,d.useRef)(null);(0,d.useEffect)(()=>{S.current?.focus()},[]);let C=(0,d.useCallback)(async e=>{if(e.trim()){u(!0),p(null),c([]);try{let t=await(await fetch(`/api/skills/search`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({query:e.trim()})})).json();if(t.error){p(t.error);return}c(t.results??[]),(t.results??[]).length===0&&p(i(`i18n.noSkills`))}catch(e){p(String(e))}finally{u(!1)}}},[i]),w=(0,d.useCallback)(async t=>{h(t),_(null);try{let n=await fetch(`/api/skills/install`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({package:t,scope:b,cwd:e})}),i=await n.json();if(!n.ok||i.error){_(i.error??`HTTP ${n.status}`);return}y(e=>new Set(e).add(`${b}:${t}`)),r()}catch(e){_(String(e))}finally{h(null)}},[r,b,e]),T=b===`global`?`~/.pi/agent/skills/`:`${SK(e)}/.pi/skills/`;return(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12,marginBottom:20},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-xl)`,fontWeight:600,color:`var(--text)`},children:i(`i18n.addSkill`)}),(0,E.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,E.jsx)(`input`,{ref:S,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&C(a)},placeholder:i(`i18n.skillSearchPlaceholder`),style:{flex:1,padding:`7px 10px`,fontSize:`var(--text-lg)`,background:`var(--bg-input)`,border:`1px solid var(--border)`,borderRadius:6,color:`var(--text)`,outline:`none`}}),(0,E.jsx)(`button`,{onClick:()=>C(a),disabled:l||!a.trim(),style:{padding:`7px 16px`,fontSize:`var(--text-lg)`,borderRadius:6,border:`none`,background:`var(--accent)`,color:`var(--on-accent)`,cursor:l||!a.trim()?`not-allowed`:`pointer`,opacity:l||!a.trim()?.5:1,flexShrink:0},children:i(l?`i18n.searching`:`i18n.search`)})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,E.jsx)(`div`,{style:{display:`flex`,borderRadius:5,border:`1px solid var(--border)`,overflow:`hidden`,fontSize:`var(--text-base)`,flexShrink:0},children:[`global`,`project`].map(e=>(0,E.jsx)(`button`,{onClick:()=>{(e===`global`||n)&&x(e)},disabled:e===`project`&&!n,title:e===`project`&&!n?i(`trust.projectScopeUnavailable`):void 0,style:{padding:`3px 10px`,border:`none`,cursor:e===`project`&&!n?`not-allowed`:`pointer`,background:b===e?`var(--accent)`:`transparent`,color:b===e?`var(--on-accent)`:`var(--text-dim)`,fontWeight:b===e?600:400,opacity:e===`project`&&!n?.45:1,borderRight:e===`global`?`1px solid var(--border)`:`none`},children:e},e))}),(0,E.jsxs)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--text-dim)`,fontFamily:`var(--font-mono)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:[`→ `,T]})]}),f&&(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,color:`var(--status-error)`},children:f}),g&&(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,color:`var(--status-error)`,wordBreak:`break-word`},children:g})]}),s.length>0?(0,E.jsx)(`div`,{style:{flex:1,overflowY:`auto`},children:s.map(e=>{let n=t[b].has(e.package)||v.has(`${b}:${e.package}`),r=m===e.package,a=e.package.indexOf(`@`),o=a>-1?e.package.slice(0,a):e.package,s=a>-1?e.package.slice(a+1):null;return(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:14,padding:`12px 0`,borderBottom:`1px solid var(--border)`},children:[(0,E.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-lg)`,fontWeight:600,color:`var(--text)`,marginBottom:3},children:s??o}),(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,flexWrap:`wrap`},children:[(0,E.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:o}),(0,E.jsx)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--text-muted)`,fontWeight:500},children:e.installs}),e.url&&(0,E.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,style:{fontSize:`var(--text-base)`,color:`var(--accent)`,textDecoration:`none`},children:`skills.sh ↗`})]})]}),(0,E.jsx)(`button`,{onClick:()=>!n&&!r&&w(e.package),disabled:n||r||m!==null,style:{flexShrink:0,padding:`5px 14px`,fontSize:`var(--text-base)`,fontWeight:500,borderRadius:5,border:`1px solid var(--border)`,cursor:n||r||m!==null?`not-allowed`:`pointer`,background:n?`color-mix(in srgb, var(--status-success) 10%, transparent)`:`none`,color:n?`var(--status-success)`:r?`var(--accent)`:`var(--text-muted)`,transition:`color 0.12s`},children:n?`✓ ${i(`i18n.installed`)}`:i(r?`i18n.installing`:`i18n.install`)})]},e.package)})}):!f&&!l&&(0,E.jsxs)(`div`,{style:{fontSize:`var(--text-lg)`,color:`var(--text-dim)`,lineHeight:1.8},children:[`Search`,` `,(0,E.jsx)(`a`,{href:`https://skills.sh`,target:`_blank`,rel:`noreferrer`,style:{color:`var(--accent)`,textDecoration:`none`},children:`skills.sh`}),` `,`to discover and install skills for your agent.`]})]})}var AK=null;function jK({cwd:e,onClose:t,pane:n,homeSkills:r=[]}){let i=ne(),{t:a}=N(),[o,s]=(0,d.useState)([]),c=(0,d.useMemo)(()=>r.length===0?o:[...o,...r],[o,r]),[l,u]=(0,d.useState)(!0),[f,m]=(0,d.useState)(null),[h,g]=(0,d.useState)(AK),[_,v]=(0,d.useState)(new Set),[y,b]=(0,d.useState)(null),[x,S]=(0,d.useState)(!1),[C,w]=(0,d.useState)({}),[T,D]=(0,d.useState)(new Set),[O,k]=(0,d.useState)(!1),[A,j]=(0,d.useState)(null),[M,P]=(0,d.useState)(null),[ee,F]=(0,d.useState)(!0),[te,re]=(0,d.useState)({}),[ie,ae]=(0,d.useState)(280),[oe,I]=(0,d.useState)(``),L=oe.trim().toLowerCase(),se=(0,d.useCallback)(async()=>{u(!0),m(null);try{let t=await fetch(`/api/skills?cwd=${encodeURIComponent(e)}`),n=await t.json();if(!t.ok||n.error)throw Error(n.error??`HTTP ${t.status}`);let r=n.skills??[];if(s(r),F(n.projectResourcesLoaded??!0),r.length>0&&!h){let e=r.find(e=>!e.disableModelInvocation)??r[0];g(e.filePath),e.disableModelInvocation&&re(t=>({...t,[wK(e)]:!0}))}return r}catch(e){return m(String(e)),[]}finally{u(!1)}},[e,h]);(0,d.useEffect)(()=>{w({}),P(null),se()},[e]),(0,d.useEffect)(()=>{AK=h});let R=(0,d.useCallback)(async t=>{let n=(t?[t]:o.filter(e=>!!e.install)).map(TK).filter(e=>!!e);if(n.length!==0){P(null),D(e=>new Set([...e,...n])),t||k(!0);try{let n=await fetch(`/api/skills/check`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:e,package:t?.install?.package,scope:t?.install?.scope})}),r=await n.json();if(!n.ok||r.error)throw Error(r.error??`HTTP ${n.status}`);w(e=>{let t={...e};for(let e of r.updates??[])t[`${e.scope}\0${e.package}`]=e;return t})}catch(e){P(e instanceof Error?e.message:String(e))}finally{D(e=>{let t=new Set(e);for(let e of n)t.delete(e);return t}),t||k(!1)}}},[e,o]),ce=(0,d.useCallback)(async t=>{if(!t.install)return;let n=TK(t);j(n),P(null);try{let r=await fetch(`/api/skills/update`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:e,package:t.install.package,scope:t.install.scope})}),i=await r.json();if(!r.ok||i.error||!i.success)throw Error(i.error??`HTTP ${r.status}`);await se();let a=i.skill?.install?.versionHash;w(e=>({...e,[n]:{package:t.install.package,scope:t.install.scope,state:`up-to-date`,currentVersion:a,latestVersion:a}}))}catch(e){P(e instanceof Error?e.message:String(e))}finally{j(null)}},[e,se]),le=(0,d.useCallback)(async t=>{let n=!t.disableModelInvocation;v(e=>new Set(e).add(t.filePath)),b(null);try{let i=await fetch(`/api/skills`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({filePath:t.filePath,disableModelInvocation:n,cwd:e})}),a=await i.json();if(!i.ok||a.error){b(a.error??`HTTP ${i.status}`);return}s(e=>e.map(e=>e.filePath===t.filePath?{...e,disableModelInvocation:n}:e)),r.some(e=>e.filePath===t.filePath)&&Te.refresh().catch(()=>{}),n&&re(e=>({...e,[wK(t)]:!0}))}catch(e){b(String(e))}finally{v(e=>{let n=new Set(e);return n.delete(t.filePath),n})}},[r,e]),ue=o.find(e=>e.filePath===h)??null;return(0,E.jsx)(`div`,{style:n?{display:`contents`}:{position:`fixed`,inset:0,zIndex:1e3,background:`var(--overlay)`,display:`flex`,alignItems:`center`,justifyContent:`center`},onClick:e=>{e.target===e.currentTarget&&t()},children:(0,E.jsxs)(`div`,{style:n?{width:`100%`,height:`100%`,background:`var(--bg)`,display:`flex`,flexDirection:`column`,overflow:`hidden`}:{width:i?`calc(100vw - 16px)`:860,maxWidth:`calc(100vw - 16px)`,height:i?`calc(100dvh - 16px)`:`78vh`,maxHeight:`calc(100dvh - 16px)`,background:`var(--bg)`,border:`1px solid var(--border)`,borderRadius:10,display:`flex`,flexDirection:`column`,boxShadow:`0 8px 32px var(--shadow-color)`,overflow:`hidden`},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`12px 18px`,borderBottom:`1px solid var(--border)`,flexShrink:0},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:10},children:[(0,E.jsx)(`span`,{style:{fontSize:`var(--text-2xl)`,fontWeight:700,color:`var(--text)`},children:a(`common.skills`)}),(0,E.jsx)(`code`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-muted)`,fontFamily:`var(--font-mono)`,maxWidth:320,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:SK(e)}),(0,E.jsx)(Xx,{testId:`skills-search`,query:oe,onChange:I,t:a})]}),!n&&(0,E.jsx)(`button`,{onClick:t,style:{background:`none`,border:`none`,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-5xl)`,lineHeight:1,padding:`2px 6px`},children:`×`})]}),!ee&&(0,E.jsx)(`div`,{role:`status`,style:{padding:`8px 18px`,borderBottom:`1px solid var(--border)`,background:`var(--bg-panel)`,color:`var(--text-muted)`,fontSize:`var(--text-base)`},children:a(`trust.skillsNotLoaded`)}),(0,E.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:i?`column`:`row`,overflow:`hidden`},children:[(0,E.jsxs)(`div`,{style:{width:i?`100%`:ie,maxHeight:i?`40vh`:void 0,display:`flex`,flexDirection:`column`,flexShrink:0,background:`var(--bg)`},children:[(0,E.jsx)(`div`,{style:{flex:1,overflowY:`auto`,padding:`8px 6px`},children:l?(0,E.jsx)(`div`,{style:{padding:`10px 8px`,fontSize:`var(--text-base)`,color:`var(--text-muted)`},children:a(`i18n.loading`)}):f?(0,E.jsx)(`div`,{style:{padding:`10px 8px`,fontSize:`var(--text-sm)`,color:`var(--status-error)`},children:f}):c.length===0?(0,E.jsx)(`div`,{style:{padding:`10px 8px`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:a(`i18n.noSkills`)}):(()=>{let e=L?c.filter(e=>e.name.toLowerCase().includes(L)):c,t=[],n=[{label:`project / skills.sh`,matches:e=>CK(e)===`project`&&!!e.install?.skillsShUrl},{label:`project`,matches:e=>CK(e)===`project`&&!e.install?.skillsShUrl},{label:`global / skills.sh`,matches:e=>CK(e)===`global`&&!!e.install?.skillsShUrl},{label:`global`,matches:e=>CK(e)===`global`&&!e.install?.skillsShUrl},{label:`path`,matches:e=>CK(e)===`path`}];for(let{label:r,matches:i}of n){let n=e.filter(i);n.length>0&&t.push({label:r,skills:n})}if(t.length===0)return(0,E.jsx)(`div`,{style:{padding:`10px 8px`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:a(`i18n.noMatch`)});let r=e=>{let t=!x&&h===e.filePath,n=e.disableModelInvocation;return(0,E.jsxs)(`div`,{onClick:()=>{g(e.filePath),S(!1)},style:{display:`flex`,alignItems:`center`,gap:7,padding:`8px 8px`,borderRadius:5,cursor:`pointer`},className:t?`selectable-row row-selected-gradient`:`selectable-row`,children:[(0,E.jsx)(`span`,{style:{flexShrink:0,width:7,height:7,borderRadius:`50%`,background:n?`var(--border)`:`var(--accent)`,boxShadow:n?`none`:`0 0 4px var(--accent)`,transition:`background 0.15s, box-shadow 0.15s`}}),(0,E.jsx)(oi,{label:e.name,children:(0,E.jsx)(`span`,{style:{fontSize:`var(--text-base)`,fontWeight:t?600:400,color:n?`var(--text-dim)`:`var(--text)`,fontFamily:`var(--font-mono)`,flex:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.name})}),(()=>{let t=TK(e);return(t?C[t]:void 0)?.state===`update-available`?(0,E.jsx)(`span`,{title:a(`i18n.updateAvailable`),style:{color:`var(--status-warning)`,fontSize:`var(--text-lg)`,lineHeight:1,flexShrink:0},children:`↑`}):null})()]},e.filePath)};return t.map(({label:e,skills:t})=>{let n=t.filter(e=>!e.disableModelInvocation),i=t.filter(e=>e.disableModelInvocation),o=te[e]??!1;return(0,E.jsxs)(`div`,{style:{marginBottom:6},children:[(0,E.jsx)(`div`,{style:{padding:`4px 8px 3px`,fontSize:`var(--text-xs)`,fontWeight:600,color:`var(--text-dim)`,textTransform:`uppercase`,letterSpacing:`0.06em`},children:e}),n.map(r),i.length>0&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{onClick:()=>re(t=>({...t,[e]:!o})),style:{display:`flex`,alignItems:`center`,gap:5,padding:`4px 8px 3px`,fontSize:`var(--text-xs)`,fontWeight:600,color:`var(--text-dim)`,textTransform:`uppercase`,letterSpacing:`0.06em`,cursor:`pointer`,userSelect:`none`},children:[(0,E.jsx)(`span`,{style:{fontSize:`var(--text-3xs)`},children:o?`▾`:`▸`}),a(`i18n.dormant`),` (`,i.length,`)`]}),o||L?i.map(r):null]})]},e)})})()}),(0,E.jsx)(`div`,{style:{padding:`8px 6px`,borderTop:`1px solid var(--border)`,flexShrink:0},children:!L&&(0,E.jsxs)(`div`,{onClick:()=>S(!0),style:{display:`flex`,alignItems:`center`,gap:6,padding:`7px 8px`,borderRadius:5,cursor:`pointer`,color:x?`var(--accent)`:`var(--text-dim)`,fontSize:`var(--text-base)`},className:x?`row-selected-gradient`:`hover-shift`,children:[(0,E.jsxs)(`svg`,{width:p.lg,height:p.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,E.jsx)(`line`,{x1:`12`,y1:`5`,x2:`12`,y2:`19`}),(0,E.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`})]}),a(`i18n.addSkill`)]})})]}),!i&&(0,E.jsx)(wx,{width:ie,onResize:ae,ariaLabel:a(`i18n.resizeList`,{name:a(`i18n.skills`)})}),(0,E.jsx)(`div`,{style:{flex:1,overflowY:`auto`,padding:20},children:x?(0,E.jsx)(kK,{cwd:e,projectResourcesLoaded:ee,installedPackages:{global:new Set(o.filter(e=>e.install?.scope===`global`).map(e=>e.install.package)),project:new Set(o.filter(e=>e.install?.scope===`project`).map(e=>e.install.package))},onInstalled:()=>{se()}}):l?null:ue?(0,E.jsx)(OK,{skill:ue,cwd:e,onToggle:le,toggling:_.has(ue.filePath),saveError:y,updateStatus:TK(ue)?C[TK(ue)]:void 0,checkingUpdate:TK(ue)?T.has(TK(ue)):!1,updating:A===TK(ue),updateError:M,onCheckUpdate:()=>void R(ue),onUpdate:()=>void ce(ue)},ue.filePath):(0,E.jsx)(`div`,{style:{height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`var(--text-dim)`,fontSize:`var(--text-lg)`},children:a(`i18n.selectSkill`)})})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`10px 18px`,borderTop:`1px solid var(--border)`,flexShrink:0},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[c.some(e=>!!e.install)&&(0,E.jsx)(`button`,{onClick:()=>void R(),disabled:O||A!==null,style:{padding:`6px 12px`,background:`none`,border:`1px solid var(--border)`,borderRadius:6,color:`var(--text-muted)`,cursor:O||A!==null?`not-allowed`:`pointer`,opacity:O||A!==null?.5:1,fontSize:`var(--text-base)`},children:a(O?`i18n.checking`:`i18n.checkUpdates`)}),Object.values(C).filter(e=>e.state===`update-available`).length>0&&(0,E.jsxs)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--status-warning)`},children:[Object.values(C).filter(e=>e.state===`update-available`).length,` `,Object.values(C).filter(e=>e.state===`update-available`).length===1?a(`i18n.update`):a(`i18n.updates`)]})]}),(0,E.jsx)(`button`,{onClick:t,style:{padding:`6px 14px`,background:`none`,border:`1px solid var(--border)`,borderRadius:6,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-lg)`},children:a(`i18n.close`)})]})]})})}var MK=[{name:`compact`,description:`chat.commandCompact`,source:`builtin`},{name:`reload`,description:`chat.commandReload`,source:`builtin`},{name:`name`,description:`chat.commandName`,source:`builtin`},{name:`session`,description:`chat.commandSession`,source:`builtin`},{name:`copy`,description:`chat.commandCopy`,source:`builtin`}],NK=[`builtin`,`extension`,`prompt`,`skill`],PK={builtin:`chat.builtIn`,extension:`chat.extensions`,prompt:`chat.prompts`,skill:`chat.skills`},FK={builtin:0,extension:1,prompt:2,skill:3},IK=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`});function LK(e,t,n){let r=e.name.toLowerCase(),i=RK(e,n).toLowerCase();return r===t?0:r.startsWith(t)?1:r.includes(t)?2:i.includes(t)?3:4}function RK(e,t){return e.source===`builtin`?t(e.description):e.description??``}function zK(e,t){return e.source!==`skill`||!e.name.startsWith(`skill:`)?!1:t[e.name.slice(6)]===!0}function BK(e,t){let n=0,r=NK.map(r=>{let i=e.filter(e=>e.source===r);return{source:r,items:(r===`skill`?[...i.filter(e=>!zK(e,t)),...i.filter(e=>zK(e,t))]:i).map(e=>({command:e,index:n++}))}}).filter(e=>e.items.length>0);return{commands:r.flatMap(e=>e.items.map(({command:e})=>e)),groups:r}}function VK(e){return e.startsWith(`/`)&&!/\s/.test(e.slice(1))?e.slice(1).toLowerCase():null}function HK(e){let{value:t,commands:n,skillDormancy:r={},builtinDisabled:i=!1,onLoadCommands:a,onApply:o}=e,{t:s}=N(),c=VK(t),[l,u]=(0,d.useState)(!1),[f,p]=(0,d.useState)(0),m=(0,d.useRef)([]),h=(0,d.useRef)(!1),g=(0,d.useRef)(a);(0,d.useEffect)(()=>{g.current=a});let _=(0,d.useMemo)(()=>c===null?[]:[...i?[]:MK,...n??[]].filter(e=>{let t=e.name.toLowerCase(),n=RK(e,s).toLowerCase();return t.includes(c)||n.includes(c)}).sort((e,t)=>{let n=LK(e,c,s)-LK(t,c,s);return n===0?FK[e.source]-FK[t.source]||IK.compare(e.name,t.name):n}),[c,i,n,s]),{commands:v,groups:y}=(0,d.useMemo)(()=>BK(_,r),[_,r]),b=(0,d.useMemo)(()=>_.length===1?s(c?`chat.match`:`chat.command`):s(c?`chat.matches`:`chat.commands`,{count:_.length}),[_.length,c,s]);(0,d.useEffect)(()=>{if(c===null){u(!1),p(0),h.current=!1;return}u(!0),p(0);let e=g.current;!h.current&&e&&(h.current=!0,Promise.resolve(e()).catch(()=>{h.current=!1}))},[c]),(0,d.useEffect)(()=>{f>=v.length&&p(Math.max(0,v.length-1))},[v.length,f]),(0,d.useEffect)(()=>{m.current.length=v.length},[v.length]),(0,d.useEffect)(()=>{l&&m.current[f]?.scrollIntoView({block:`nearest`,behavior:`smooth`})},[f,l]);let x=(0,d.useCallback)(e=>{let t=v.length-1;if(t<0)return 0;if(e===`left`)return Math.max(0,f-1);if(e===`right`)return Math.min(t,f+1);let n=m.current[f];if(!n)return e===`down`?Math.min(t,f+1):Math.max(0,f-1);let r=n.getBoundingClientRect(),i=r.left+r.width/2,a=r.top+r.height/2,o=-1,s=1/0;for(let n=0;n<=t;n+=1){if(n===f)continue;let t=m.current[n];if(!t)continue;let r=t.getBoundingClientRect(),c=r.top+r.height/2-a;if(e===`down`?c<=4:c>=-4)continue;let l=r.left+r.width/2,u=Math.abs(c)*1e3+Math.abs(l-i);u<s&&(o=n,s=u)}return o>=0?o:e===`down`?Math.min(t,f+1):Math.max(0,f-1)},[v.length,f]),S=(0,d.useCallback)(e=>{o(e),u(!1),p(0)},[o]),C=(0,d.useCallback)(e=>!l||c===null?!1:e.key===`ArrowDown`?(e.preventDefault(),p(x(`down`)),!0):e.key===`ArrowUp`?(e.preventDefault(),p(x(`up`)),!0):e.key===`ArrowRight`?(e.preventDefault(),p(x(`right`)),!0):e.key===`ArrowLeft`?(e.preventDefault(),p(x(`left`)),!0):e.key===`Escape`?(e.preventDefault(),u(!1),!0):(e.key===`Tab`||e.key===`Enter`&&!e.shiftKey)&&v[f]?(e.preventDefault(),S(v[f]),!0):!1,[l,c,x,v,f,S]);return{open:l,query:c,filteredCount:_.length,countLabel:b,displayed:v,groups:y,activeIndex:f,setActiveIndex:p,itemRefs:m,apply:S,handleKeyDown:C}}function UK({palette:e,loading:t,skillDormancy:n}){let{t:r}=N();return e.open&&e.query!==null?(0,E.jsxs)(`div`,{"data-testid":`slash-palette`,style:{position:`absolute`,left:0,right:0,bottom:`calc(100% + 8px)`,zIndex:120,background:`var(--bg)`,border:`1px solid var(--border)`,borderRadius:8,boxShadow:`0 -6px 20px var(--shadow-color)`,overflow:`hidden`,maxHeight:`min(56vh, 460px)`},children:[(0,E.jsxs)(`div`,{style:{padding:`8px 10px`,borderBottom:`1px solid var(--border)`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8,fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:[(0,E.jsx)(`span`,{children:t?r(`chat.loadingCommands`):r(`chat.slashCommands`,{label:e.countLabel})}),(0,E.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`},children:r(`chat.tabEnter`)})]}),(0,E.jsx)(`div`,{style:{maxHeight:`calc(min(56vh, 460px) - 34px)`,overflowY:`auto`,padding:10},children:!t&&e.filteredCount===0?(0,E.jsx)(`div`,{style:{padding:`2px 2px 4px`,fontSize:`var(--text-base)`,color:`var(--text-dim)`},children:r(`chat.noCommands`)}):e.groups.map(t=>(0,E.jsxs)(`section`,{style:{marginBottom:12},children:[(0,E.jsxs)(`div`,{style:{position:`sticky`,top:-10,zIndex:1,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8,padding:`4px 0 6px`,background:`var(--bg)`,color:`var(--text-dim)`,fontSize:`var(--text-xs)`,fontWeight:600,textTransform:`uppercase`},children:[(0,E.jsx)(`span`,{children:r(PK[t.source])}),(0,E.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontWeight:500},children:t.items.length})]}),(0,E.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(220px, 1fr))`,gap:8},children:t.items.map(({command:t,index:i})=>{let a=i===e.activeIndex,o=zK(t,n);return(0,E.jsxs)(`button`,{ref:t=>{e.itemRefs.current[i]=t},type:`button`,onMouseDown:n=>{n.preventDefault(),e.apply(t)},onMouseEnter:()=>e.setActiveIndex(i),style:{width:`100%`,minWidth:0,minHeight:58,display:`flex`,flexDirection:`column`,gap:4,justifyContent:`center`,padding:`9px 10px`,border:`1px solid ${a?`var(--accent)`:`var(--border)`}`,borderRadius:7,background:a?`var(--bg-selected)`:`var(--bg-panel)`,color:`var(--text)`,cursor:`pointer`,textAlign:`left`,boxShadow:a?`0 0 0 1px color-mix(in srgb, var(--accent) 28%, transparent)`:`none`},children:[(0,E.jsxs)(`span`,{style:{fontSize:`var(--text-lg)`,fontFamily:`var(--font-mono)`,overflowWrap:`anywhere`,wordBreak:`break-word`,color:o?`var(--text-dim)`:void 0},children:[`/`,t.name,o&&(0,E.jsx)(`span`,{style:{marginLeft:6,padding:`0 4px`,border:`1px solid var(--border)`,borderRadius:3,fontSize:`var(--text-2xs)`,color:`var(--text-dim)`,whiteSpace:`nowrap`},children:r(`chat.dormant`)})]}),t.description&&(0,E.jsx)(`span`,{style:{display:`-webkit-box`,WebkitBoxOrient:`vertical`,WebkitLineClamp:2,overflow:`hidden`,fontSize:`var(--text-sm)`,lineHeight:1.35,color:`var(--text-dim)`},children:RK(t,r)})]},`${t.source}:${t.name}`)})})]},t.source))})]}):null}function WK({open:e,onOpenChange:t,onConfirm:n,title:r,hint:i,labelPlaceholder:a,messagePlaceholder:o,initialValue:s,testIdPrefix:c=`bind`}){let{t:l}=N(),[u,f]=(0,d.useState)(s?.label??``),[p,m]=(0,d.useState)(s?.message??``),[h,g]=(0,d.useState)(s?.allowAppend??!1),_=u.trim()!==``&&p.trim()!==``,v=Qn(Te).value,y=(0,d.useMemo)(()=>(v?.skills??[]).map(e=>({name:`skill:${e.name}`,description:e.description,source:`skill`})),[v]),b=(0,d.useMemo)(()=>{let e={};for(let t of v?.skills??[])e[t.name]=t.disableModelInvocation;return e},[v]),x=HK({value:p,commands:y,skillDormancy:b,onLoadCommands:()=>void Te.load().catch(()=>{}),onApply:(0,d.useCallback)(e=>{m(`/${e.name} `)},[])});return(0,E.jsx)(Ax,{open:e,onOpenChange:t,children:(0,E.jsxs)(Px,{className:`sm:max-w-md`,showCloseButton:!0,onEscapeKeyDown:e=>{x.open&&x.query!==null&&e.preventDefault()},children:[(0,E.jsx)(Fx,{style:{fontWeight:700,fontSize:`var(--text-2xl)`,color:`var(--text)`},children:r}),(0,E.jsx)(Ix,{style:{fontSize:`var(--text-base)`,color:`var(--text-dim)`},children:i}),(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:10,marginTop:4},children:[(0,E.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,E.jsx)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--text-muted)`},children:l(`config.widgets.label`)}),(0,E.jsx)(CG,{"data-testid":`${c}-label`,value:u,onChange:e=>f(e.target.value),placeholder:a,autoFocus:!0})]}),(0,E.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,E.jsx)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--text-muted)`},children:l(`config.widgets.message`)}),(0,E.jsxs)(`div`,{style:{position:`relative`},children:[(0,E.jsx)(CG,{"data-testid":`${c}-message`,value:p,onChange:e=>m(e.target.value),placeholder:o,onKeyDown:e=>{x.handleKeyDown(e)||e.key===`Enter`&&_&&(n(u.trim(),p.trim(),h),f(``),m(``),g(!1))}}),(0,E.jsx)(UK,{palette:x,skillDormancy:b})]})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,E.jsx)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--text-muted)`},children:l(`config.widgets.sendMode`)}),(0,E.jsx)(zx,{testId:`${c}-append`,value:h?`fill`:`send`,onChange:e=>g(e===`fill`),options:[{value:`send`,label:l(`config.widgets.sendImmediately`)},{value:`fill`,label:l(`config.widgets.fillToChatInput`)}]})]})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8,marginTop:12},children:[(0,E.jsx)(kx,{type:`button`,variant:`outline`,className:`h-8 px-3 text-xs`,onClick:()=>t(!1),children:l(`i18n.cancel`)}),(0,E.jsx)(kx,{type:`button`,"data-testid":`${c}-confirm`,className:`h-8 px-3 text-xs`,disabled:!_,style:{cursor:_?`pointer`:`default`,opacity:_?1:.5},onClick:()=>{n(u.trim(),p.trim(),h),f(``),m(``),g(!1)},children:l(`config.widgets.confirm`)})]})]})})}function GK({messages:e,onRemove:t,onEdit:n,chipTestIdPrefix:r}){return e.length===0?null:(0,E.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:6,marginTop:8,paddingTop:8,borderTop:`1px solid var(--border)`},children:e.map((e,i)=>(0,E.jsx)(oi,{label:e.message,wrapperStyle:{display:`inline-flex`,minWidth:0},children:(0,E.jsx)(PG,{testId:`${r}-${i}`,label:e.label,title:e.message,onRemove:t?()=>t(i):void 0,onClick:n?()=>n(i):void 0})},i))})}function KK({messages:e,onAdd:t,onRemove:n,onUpdate:r,bindOpen:i,onBindOpenChange:a,ns:o,bindTestIdPrefix:s,editTestIdPrefix:c,chipTestIdPrefix:l,bindHintArgs:u,emptyLabel:f}){let{t:p}=N(),[m,h]=(0,d.useState)(null),[g,_]=(0,d.useState)(null),v=m===null?null:e[m],y=g===null?null:e[g];return(0,E.jsxs)(E.Fragment,{children:[e.length===0?f?(0,E.jsx)(`div`,{style:{padding:`24px 16px`,textAlign:`center`,color:`var(--text-dim)`,fontSize:`var(--text-lg)`,lineHeight:1.6},children:f}):null:(0,E.jsx)(GK,{messages:e,onRemove:e=>h(e),onEdit:e=>_(e),chipTestIdPrefix:l}),i&&(0,E.jsx)(WK,{open:!0,onOpenChange:a,onConfirm:(e,n,r)=>{t({label:e,message:n,allowAppend:r}),a(!1)},testIdPrefix:s,title:p(`config.${o}.bindTitle`),hint:p(`config.${o}.bindHint`,u),labelPlaceholder:p(`config.widgets.labelPlaceholder`),messagePlaceholder:p(`config.widgets.messagePlaceholder`)}),m!==null&&v&&(0,E.jsx)(Bx,{open:!0,title:p(`config.${o}.unbindTitle`),description:(0,E.jsxs)(`span`,{style:{display:`block`},children:[(0,E.jsx)(`span`,{style:{display:`block`},children:p(`config.${o}.unbindConfirm`,{label:v.label})}),(0,E.jsx)(`span`,{style:{display:`block`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,color:`var(--text-muted)`,padding:`6px 8px`,borderRadius:5,background:`var(--bg)`,border:`1px solid var(--border)`,overflowWrap:`anywhere`,marginTop:6},children:v.message})]}),confirmText:p(`config.${o}.unbind`),cancelText:p(`i18n.cancel`),destructive:!0,onCancel:()=>h(null),onConfirm:()=>{n(m),h(null)}}),g!==null&&y&&(0,E.jsx)(WK,{open:!0,onOpenChange:e=>!e&&_(null),onConfirm:(e,t,n)=>{r(g,{label:e,message:t,allowAppend:n}),_(null)},initialValue:y,testIdPrefix:c,title:p(`config.${o}.editTitle`),hint:p(`config.${o}.editHint`),labelPlaceholder:p(`config.widgets.labelPlaceholder`),messagePlaceholder:p(`config.widgets.messagePlaceholder`)},c)]})}function qK(){let{t:e}=N(),{startScreenMessages:t,addStartScreenMessage:n,removeStartScreenMessage:r,updateStartScreenMessage:i,resetStartScreenMessages:a}=ge(),[o,s]=(0,d.useState)(!1);return(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`},children:(0,E.jsxs)(`div`,{style:{flex:1,minHeight:0,overflowY:`auto`,padding:10,display:`flex`,flexDirection:`column`,gap:8},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,color:`var(--text-muted)`},children:e(`config.startScreen.hint`)}),(0,E.jsxs)(`div`,{style:{display:`flex`,gap:6},children:[(0,E.jsx)(oi,{label:e(`config.startScreen.resetHint`),children:(0,E.jsxs)(`button`,{type:`button`,"data-testid":`start-screen-reset`,onClick:a,style:{flexShrink:0,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,E.jsx)(Br,{size:13,"aria-hidden":!0}),e(`config.startScreen.reset`)]})}),(0,E.jsxs)(`button`,{type:`button`,"data-testid":`start-screen-bind`,onClick:()=>s(!0),style:{flexShrink:0,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,E.jsx)(Or,{size:13,"aria-hidden":!0}),e(`config.startScreen.bind`)]})]})]}),(0,E.jsx)(KK,{messages:t,onAdd:n,onRemove:r,onUpdate:i,bindOpen:o,onBindOpenChange:s,ns:`startScreen`,bindTestIdPrefix:`start-screen-bind`,editTestIdPrefix:`start-screen-edit`,chipTestIdPrefix:`start-screen-bound`,emptyLabel:e(`config.startScreen.empty`)})]})})}var JK=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`});function YK(e,t){return JK.compare(`${e.provider}/${e.name||e.modelId}`,`${t.provider}/${t.name||t.modelId}`)}function XK(e,t){let n=t.trim().toLocaleLowerCase();return n?e.filter(e=>`${e.provider}/${e.name}`.toLocaleLowerCase().includes(n)):e}function ZK({value:e,options:t,onChange:n,disabled:r,placeholder:i,variant:a=`form`,isAutoSelection:o}){let{t:s}=N(),[c,l]=(0,d.useState)(!1),[u,f]=(0,d.useState)(``),[m,h]=(0,d.useState)(0),[g,_]=(0,d.useState)(null),v=(0,d.useRef)(null),y=(0,d.useRef)(null),b=(0,d.useRef)(null),x=(0,d.useRef)(null),S=XK([...t].sort(YK),u),C=e?t.find(t=>t.provider===e.provider&&t.modelId===e.modelId)?.name??e.modelId:null;e&&C&&`${e.provider}${C}`,(0,d.useEffect)(()=>{b.current?.scrollIntoView({block:`nearest`})},[m,u]),(0,d.useEffect)(()=>{if(!c)return;let e=e=>{v.current?.contains(e.target)||y.current?.contains(e.target)||(l(!1),f(``))};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[c]);let w=t=>{l(!1),f(``),(e?.provider!==t.provider||e?.modelId!==t.modelId||o)&&n(t.provider,t.modelId)};return(0,E.jsxs)(`div`,{style:{position:`relative`,display:a===`chat`?`flex`:`block`,minWidth:0,flex:a===`chat`?1:void 0},children:[(0,E.jsxs)(`button`,{ref:v,type:`button`,disabled:r,onClick:e=>{if(r)return;if(c){l(!1),f(``);return}let t=e.currentTarget.getBoundingClientRect();_({top:t.top,left:t.left,width:t.width}),l(!0),h(0),requestAnimationFrame(()=>x.current?.focus())},style:a===`chat`?{display:`flex`,alignItems:`center`,gap:6,padding:`8px 12px`,height:32,minWidth:0,maxWidth:`100%`,overflow:`hidden`,background:`none`,border:`none`,borderRadius:9,color:`var(--text-muted)`,cursor:r?`not-allowed`:`pointer`,fontSize:`var(--text-base)`,opacity:r?.5:1}:{display:`flex`,alignItems:`center`,gap:6,padding:`6px 10px`,height:32,width:320,maxWidth:`100%`,background:`var(--bg-input)`,border:`1px solid var(--border)`,borderRadius:6,color:e?`var(--text)`:`var(--text-dim)`,cursor:r?`not-allowed`:`pointer`,fontSize:`var(--text-base)`,textAlign:`left`},className:r?void 0:`hover-shift`,"aria-expanded":c,children:[a===`chat`&&(0,E.jsx)(_r,{size:p[`2xl`],style:{color:`var(--status-info)`,flexShrink:0}}),(0,E.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,minWidth:0,flex:a===`form`?1:void 0},children:e&&C?a===`chat`?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`span`,{style:{color:`var(--text-dim)`},children:[e.provider,`/`]}),(0,E.jsx)(`span`,{style:{fontWeight:700,color:`var(--text)`},children:C})]}):`${e.provider}/${C}`:i??(t.length>0?s(`chat.filterModels`):s(`git.commitModel.noModels`))})]}),c&&g&&(0,E.jsxs)(`div`,{ref:y,"data-testid":`model-dropdown`,style:{position:`fixed`,zIndex:500,background:`var(--bg)`,border:`1px solid var(--border)`,borderRadius:8,boxShadow:`0 -4px 16px var(--shadow-color)`,overflow:`hidden`,display:`flex`,flexDirection:`column`,...a===`chat`?(()=>{let e=window.visualViewport?.height??window.innerHeight,t=e-g.top+6,n=Math.max(120,Math.min(g.top-8,e*.6));return{bottom:t,left:g.left,width:`max-content`,minWidth:g.width,maxHeight:n}})():{top:g.top+32+4,left:g.left,width:g.width,maxHeight:280}},children:[(0,E.jsx)(`div`,{style:{padding:6,borderBottom:`1px solid var(--border)`},children:(0,E.jsx)(`input`,{ref:x,value:u,onChange:e=>{f(e.target.value),h(0)},onKeyDown:e=>{if(e.key===`Escape`)f(``),l(!1);else if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),S.length===0)return;h(t=>e.key===`ArrowDown`?(t+1)%S.length:(t-1+S.length)%S.length)}else if(e.key===`Enter`){let e=S[m]??S[0];e&&w(e)}},placeholder:s(`chat.filterModels`),autoComplete:`off`,spellCheck:!1,style:{width:`100%`,padding:`6px 8px`,background:`var(--bg-hover)`,border:`none`,borderRadius:6,color:`var(--text)`,fontSize:`var(--text-base)`,outline:`none`}})}),(0,E.jsx)(`div`,{style:{minHeight:0,overflowY:`auto`},children:S.length===0?(0,E.jsx)(`div`,{style:{padding:`8px 12px`,color:`var(--text-dim)`,fontSize:`var(--text-base)`,whiteSpace:`nowrap`},children:u.trim()?s(`chat.noMatchingModels`):s(`git.commitModel.noModels`)}):S.map((t,n)=>{let r=e?.provider===t.provider&&e?.modelId===t.modelId,i=n===m;return(0,E.jsxs)(`button`,{ref:i?b:void 0,"data-highlighted":i?`true`:void 0,onClick:()=>w(t),onMouseEnter:()=>h(n),style:{display:`flex`,alignItems:`center`,gap:8,width:`100%`,padding:`7px 12px`,background:i?`var(--bg-hover)`:r?`var(--bg-selected)`:`none`,border:`none`,color:r?`var(--text)`:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-base)`,textAlign:`left`,fontWeight:r?600:400,whiteSpace:`nowrap`},children:[r?(0,E.jsx)(ur,{size:p.xs,strokeWidth:4.8,style:{flexShrink:0}}):(0,E.jsx)(`span`,{style:{width:10,flexShrink:0}}),(0,E.jsxs)(`span`,{style:{display:`inline`},children:[(0,E.jsxs)(`span`,{style:{color:`var(--text-dim)`},children:[t.provider,`/`]}),(0,E.jsx)(`span`,{style:{fontWeight:700},children:t.name})]})]},`${t.provider}:${t.modelId}`)})})]})]})}function QK(e){fetch(`/api/preferences`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({preferences:e})}).catch(()=>{}).finally(()=>void Se.refresh().catch(()=>{}))}var $K={};function eq(){let{t:e}=N(),t=(0,d.useSyncExternalStore)(Se.subscribe,()=>Se.get()?.preferences??$K,()=>$K),n=(0,d.useSyncExternalStore)(be.subscribe,()=>be.get()??null),r=t,i=r.commitMessageUseCurrentModel===!0,a=typeof r.commitMessageModel==`string`?r.commitMessageModel:``,o=typeof r.commitMessageMaxTokens==`number`&&Number.isFinite(r.commitMessageMaxTokens)?r.commitMessageMaxTokens:512,s=r.commitMessageAutoGenerateOnEmpty!==!1,c=r.commitStageAllConfirm!==!1,l=(n?.modelList??[]).map(e=>({provider:e.provider,modelId:e.id,name:e.name})),u=e=>{QK({commitMessageUseCurrentModel:e})},f=(e,t)=>{QK({commitMessageModel:`${e}/${t}`})},p=e=>{let t=Number(e);Number.isFinite(t)&&QK({commitMessageMaxTokens:Math.min(4096,Math.max(64,Math.round(t)))})},m=e=>{QK({commitMessageAutoGenerateOnEmpty:e})},h=e=>{QK({commitStageAllConfirm:e})},g=(()=>{if(!a)return null;let e=a.indexOf(`/`);return e===-1?null:{provider:a.slice(0,e),modelId:a.slice(e+1)}})();return(0,E.jsxs)(`div`,{style:{height:`100%`,overflowY:`auto`,padding:`18px 20px 40px`,display:`flex`,flexDirection:`column`,gap:16,maxWidth:640},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12,padding:`14px 16px`,border:`1px solid var(--border)`,borderRadius:10,background:`var(--bg-panel)`},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,fontWeight:600,color:`var(--text)`,lineHeight:1.4},children:e(`git.commitSectionTitle`)}),(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:(0,E.jsx)(pi,{label:e(`git.commitConfirmStageAll`),hint:e(`git.commitConfirmStageAllHint`),children:(0,E.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:8,cursor:`pointer`,fontSize:`var(--text-base)`},children:[(0,E.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>h(e.target.checked)}),(0,E.jsx)(`span`,{children:e(c?`git.commitConfirmStageAllOn`:`git.commitConfirmStageAllOff`)})]})})})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12,padding:`14px 16px`,border:`1px solid var(--border)`,borderRadius:10,background:`var(--bg-panel)`},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,fontWeight:600,color:`var(--text)`,lineHeight:1.4},children:e(`git.groupTitle`)}),(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,E.jsx)(pi,{label:e(`git.commitModel.followCurrent`),hint:e(`git.commitModel.followCurrentHint`),children:(0,E.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:8,cursor:`pointer`,fontSize:`var(--text-base)`},children:[(0,E.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>u(e.target.checked)}),(0,E.jsx)(`span`,{children:e(i?`git.commitModel.followCurrentOn`:`git.commitModel.followCurrentOff`)})]})}),!i&&(0,E.jsx)(pi,{label:e(`git.commitModel.fixedModel`),hint:e(`git.commitModel.fixedModelHint`),children:(0,E.jsx)(ZK,{value:g,options:l,onChange:f,variant:`form`,placeholder:e(`git.commitModel.selectPlaceholder`)})}),!i&&!a&&(0,E.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--status-warning)`,padding:`0 2px`},children:e(`git.commitModel.notConfiguredHint`)}),(0,E.jsx)(pi,{label:e(`git.commitModel.autoGenerateOnEmpty`),hint:e(`git.commitModel.autoGenerateOnEmptyHint`),children:(0,E.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:8,cursor:`pointer`,fontSize:`var(--text-base)`},children:[(0,E.jsx)(`input`,{type:`checkbox`,checked:s,onChange:e=>m(e.target.checked)}),(0,E.jsx)(`span`,{children:e(s?`git.ai.autoGenerateOn`:`git.ai.autoGenerateOff`)})]})}),(0,E.jsx)(pi,{label:e(`git.commitModel.maxTokens`),hint:e(`git.commitModel.maxTokensHint`),children:(0,E.jsx)(`input`,{type:`number`,min:64,max:4096,step:64,value:o,onChange:e=>p(e.target.value),onBlur:e=>{let t=Number(e.target.value);(!Number.isFinite(t)||t<64||t>4096)&&(e.target.value=String(o))},style:{width:120,height:28,padding:`0 8px`,fontSize:`var(--text-base)`,color:`var(--text)`,background:`var(--bg)`,border:`1px solid var(--border)`,borderRadius:6,outline:`none`}})})]})]})]})}function tq(e){fetch(`/api/model-thinking`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}).catch(()=>{}).finally(()=>void Ee.refresh().catch(()=>{}))}function nq({value:e,providers:t,placeholder:n,onChange:r}){let{t:i}=N(),[a,o]=(0,d.useState)(!1),[s,c]=(0,d.useState)(``),l=(0,d.useRef)(null),u=(0,d.useRef)(null);(0,d.useEffect)(()=>{if(!a)return;let e=e=>{l.current?.contains(e.target)||(o(!1),c(``))};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[a]),(0,d.useEffect)(()=>{a&&requestAnimationFrame(()=>u.current?.focus())},[a]);let f=s.trim().toLocaleLowerCase(),m=f?t.filter(e=>e.toLocaleLowerCase().includes(f)):t,h=e=>{let t=e.trim();t&&(r(t),o(!1),c(``))};return(0,E.jsxs)(`div`,{ref:l,style:{position:`relative`,minWidth:220},children:[(0,E.jsxs)(`button`,{type:`button`,onClick:()=>{if(a){o(!1),c(``);return}c(``),o(!0)},style:{display:`flex`,alignItems:`center`,gap:6,padding:`6px 10px`,height:32,width:220,maxWidth:`100%`,background:`var(--bg-input)`,border:`1px solid var(--border)`,borderRadius:6,color:e?`var(--text)`:`var(--text-dim)`,cursor:`pointer`,fontSize:`var(--text-base)`,textAlign:`left`},className:`hover-shift`,"aria-expanded":a,children:[(0,E.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,flex:1},children:e||n}),(0,E.jsx)(dr,{size:p.sm,style:{color:`var(--text-dim)`,flexShrink:0}})]}),a&&(0,E.jsxs)(`div`,{style:{position:`absolute`,top:36,left:0,width:`max-content`,minWidth:`100%`,zIndex:500,background:`var(--bg)`,border:`1px solid var(--border)`,borderRadius:8,boxShadow:`0 -4px 16px var(--shadow-color)`,overflow:`hidden`,display:`flex`,flexDirection:`column`,maxHeight:280},children:[(0,E.jsx)(`div`,{style:{padding:6,borderBottom:`1px solid var(--border)`,position:`sticky`,top:0,background:`var(--bg)`,zIndex:1},children:(0,E.jsx)(`input`,{ref:u,value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Escape`?(o(!1),c(``)):e.key===`ArrowDown`||e.key===`ArrowUp`?e.preventDefault():e.key===`Enter`&&h(m[0]??s)},placeholder:i(`i18n.searchProviders`),autoComplete:`off`,spellCheck:!1,style:{width:`100%`,padding:`6px 8px`,background:`var(--bg-hover)`,border:`none`,borderRadius:6,color:`var(--text)`,fontSize:`var(--text-base)`,outline:`none`}})}),(0,E.jsxs)(`div`,{style:{overflowY:`auto`},children:[t.filter(e=>!f||e.toLocaleLowerCase().includes(f)).map(t=>{let n=t===e;return(0,E.jsxs)(`button`,{type:`button`,onClick:()=>h(t),style:{display:`flex`,alignItems:`center`,gap:8,width:`100%`,padding:`7px 12px`,background:n?`var(--bg-selected)`:`none`,border:`none`,color:n?`var(--text)`:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-base)`,textAlign:`left`,fontWeight:n?600:400,whiteSpace:`nowrap`},children:[n?(0,E.jsx)(ur,{size:p.xs,strokeWidth:4.8,style:{flexShrink:0}}):(0,E.jsx)(`span`,{style:{width:10,flexShrink:0}}),(0,E.jsx)(`span`,{children:t})]},t)}),f&&!t.some(e=>e.toLocaleLowerCase()===f)&&(0,E.jsxs)(`button`,{type:`button`,onClick:()=>h(s),style:{display:`flex`,alignItems:`center`,gap:8,width:`100%`,padding:`7px 12px`,background:`none`,border:`none`,color:`var(--accent)`,cursor:`pointer`,fontSize:`var(--text-base)`,textAlign:`left`,whiteSpace:`nowrap`},children:[(0,E.jsx)(Ir,{size:p.xs,style:{flexShrink:0}}),(0,E.jsx)(`span`,{children:s.trim()})]}),!f&&t.length===0&&(0,E.jsx)(`div`,{style:{padding:`8px 12px`,color:`var(--text-dim)`,fontSize:`var(--text-base)`},children:i(`chat.noMatchingModels`)})]})]})]})}function rq({value:e,onChange:t,ariaLabel:n,width:r=225}){let{t:i}=N();return(0,E.jsxs)(wm,{value:e,onValueChange:e=>t(e),children:[(0,E.jsx)(Em,{size:`sm`,style:{width:r,background:`var(--bg-input)`,flexShrink:0},"aria-label":n,children:(0,E.jsx)(Tm,{})}),(0,E.jsx)(Dm,{children:bi.map(e=>(0,E.jsxs)(Om,{value:e,className:`text-xs`,children:[(0,E.jsx)(`span`,{className:`font-mono`,children:e}),(0,E.jsx)(`span`,{style:{color:`var(--text-muted)`},children:i(Si[e])})]},e))})]})}var iq={};function aq(){let{t:e}=N(),t=(0,d.useSyncExternalStore)(Ee.subscribe,()=>Ee.get()??iq,()=>iq),n=(0,d.useSyncExternalStore)(be.subscribe,()=>be.get()??null);(0,d.useEffect)(()=>{Ee.load().catch(()=>{})},[]);let r=n?.modelList??[],i=(0,d.useMemo)(()=>r.map(e=>({provider:e.provider,modelId:e.id,name:e.name})),[r]),a=(0,d.useMemo)(()=>{let e=new Set;for(let t of r)e.add(t.provider);for(let n of Object.keys(t.providers??{}))e.add(n);return Array.from(e).sort((e,t)=>e.localeCompare(t))},[r,t.providers]),o=(0,d.useMemo)(()=>Object.entries(t.models??{}).sort(([e],[t])=>e.localeCompare(t)),[t.models]),s=(0,d.useMemo)(()=>Object.entries(t.providers??{}).sort(([e],[t])=>e.localeCompare(t)),[t.providers]),c=(e,n)=>{tq({...t,models:{...t.models??{},[e]:n}})},l=e=>{let n={...t.models??{}};delete n[e];let r={...t};Object.keys(n).length===0?delete r.models:r.models=n,tq(r)},u=(e,n)=>{tq({...t,providers:{...t.providers??{},[e]:n}})},f=e=>{let n={...t.providers??{}};delete n[e];let r={...t};Object.keys(n).length===0?delete r.providers:r.providers=n,tq(r)},[p,m]=(0,d.useState)(null),[h,g]=(0,d.useState)(`medium`),[_,v]=(0,d.useState)(``),[y,b]=(0,d.useState)(`medium`);return(0,E.jsxs)(`div`,{style:{height:`100%`,overflowY:`auto`,padding:`18px 20px 40px`,display:`flex`,flexDirection:`column`,gap:16,maxWidth:720},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-muted)`,lineHeight:1.6},children:e(`modelThinking.desc`)}),(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12,padding:`14px 16px`,border:`1px solid var(--border)`,borderRadius:10,background:`var(--bg-panel)`},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,fontWeight:600,color:`var(--text)`},children:e(`modelThinking.byModel`)}),o.length===0?(0,E.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`,padding:`4px 0`},children:e(`modelThinking.emptyModel`)}):(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:o.map(([t,n])=>(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`8px 10px`,border:`1px solid var(--border)`,borderRadius:8,background:`var(--bg)`},children:[(0,E.jsx)(`span`,{style:{flex:1,fontSize:`var(--text-sm)`,color:`var(--text)`,fontFamily:`var(--font-mono)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t}),(0,E.jsx)(rq,{value:n,onChange:e=>c(t,e),ariaLabel:`${t} ${e(`i18n.thinking`)}`}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>l(t),title:e(`common.delete`),style:{width:28,height:28,display:`flex`,alignItems:`center`,justifyContent:`center`,border:`1px solid var(--border)`,borderRadius:6,background:`var(--bg-panel)`,color:`var(--text-muted)`,cursor:`pointer`},children:(0,E.jsx)(Yr,{size:14})})]},t))}),(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,flexWrap:`wrap`,marginTop:4},children:[(0,E.jsx)(ZK,{value:p?{provider:p.provider,modelId:p.modelId}:null,options:i,onChange:(e,t)=>{let n=i.find(n=>n.provider===e&&n.modelId===t);m(n??{provider:e,modelId:t,name:`${e}/${t}`})},variant:`form`,placeholder:e(`modelThinking.selectModelPlaceholder`)}),(0,E.jsx)(rq,{value:h,onChange:g,ariaLabel:e(`modelThinking.byModel`)}),(0,E.jsxs)(`button`,{type:`button`,onClick:()=>{if(!p)return;let e=`${p.provider}/${p.modelId}`;tq({...t,models:{...t.models??{},[e]:h}}),m(null)},disabled:!p,style:{height:32,padding:`0 12px`,display:`flex`,alignItems:`center`,gap:6,border:`1px solid var(--accent)`,borderRadius:6,background:p?`var(--accent)`:`var(--bg)`,color:p?`white`:`var(--text-dim)`,cursor:p?`pointer`:`not-allowed`,fontSize:`var(--text-sm)`,fontWeight:600},children:[(0,E.jsx)(Ir,{size:14}),` `,e(`common.add`)]})]})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12,padding:`14px 16px`,border:`1px solid var(--border)`,borderRadius:10,background:`var(--bg-panel)`},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,fontWeight:600,color:`var(--text)`},children:e(`modelThinking.byProvider`)}),(0,E.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-muted)`,lineHeight:1.5},children:e(`modelThinking.byProviderHint`)}),s.length===0?(0,E.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`,padding:`4px 0`},children:e(`modelThinking.emptyProvider`)}):(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:s.map(([t,n])=>(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`8px 10px`,border:`1px solid var(--border)`,borderRadius:8,background:`var(--bg)`},children:[(0,E.jsx)(`span`,{style:{flex:1,fontSize:`var(--text-sm)`,color:`var(--text)`,fontFamily:`var(--font-mono)`},children:t}),(0,E.jsx)(rq,{value:n,onChange:e=>u(t,e),ariaLabel:`${t} ${e(`i18n.thinking`)}`}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>f(t),title:e(`common.delete`),style:{width:28,height:28,display:`flex`,alignItems:`center`,justifyContent:`center`,border:`1px solid var(--border)`,borderRadius:6,background:`var(--bg-panel)`,color:`var(--text-muted)`,cursor:`pointer`},children:(0,E.jsx)(Yr,{size:14})})]},t))}),(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,flexWrap:`wrap`,marginTop:4},children:[(0,E.jsx)(nq,{value:_,providers:a,placeholder:e(`modelThinking.selectProviderPlaceholder`),onChange:v}),(0,E.jsx)(rq,{value:y,onChange:b,ariaLabel:e(`modelThinking.byProvider`)}),(0,E.jsxs)(`button`,{type:`button`,onClick:()=>{let e=_.trim();e&&(tq({...t,providers:{...t.providers??{},[e]:y}}),v(``))},disabled:!_.trim(),style:{height:32,padding:`0 12px`,display:`flex`,alignItems:`center`,gap:6,border:`1px solid var(--accent)`,borderRadius:6,background:_.trim()?`var(--accent)`:`var(--bg)`,color:_.trim()?`white`:`var(--text-dim)`,cursor:_.trim()?`pointer`:`not-allowed`,fontSize:`var(--text-sm)`,fontWeight:600},children:[(0,E.jsx)(Ir,{size:14}),` `,e(`common.add`)]})]})]}),(0,E.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`,lineHeight:1.6,padding:`0 2px`},children:e(`modelThinking.footerHint`)})]})}var oq=[`models`,`plugins`,`skills`,`session`,`appearance`,`startScreen`,`git`,`modelThinking`,`advanced`];function sq({section:e,onSectionChange:t,cwd:n,sessionId:r,onClose:i,onOpenFile:a,defaultThinkingLevel:o,onDefaultThinkingLevelChange:s,compaction:c,onCompactionChange:l,retry:u,onRetryChange:f,defaultProjectTrust:p,onDefaultProjectTrustChange:m,subagents:h,onSubagentsChange:g,sidebarWidth:_,onSidebarWidthChange:v,widgetPanelWidth:y,onWidgetPanelWidthChange:b,modelConfigFocus:x}){let{t:S}=N(),{value:C}=Qn(we),{value:w}=Qn(Te);(0,d.useEffect)(()=>{we.load().catch(()=>{}),Te.load().catch(()=>{})},[]);let T=e=>{switch(e){case`models`:return S(`common.models`);case`plugins`:return S(`common.plugins`);case`skills`:return S(`common.skills`);case`startScreen`:return S(`config.section.startScreen`);case`session`:return S(`config.section.session`);case`appearance`:return S(`config.section.appearance`);case`advanced`:return S(`config.section.advanced`);case`git`:return S(`config.section.git`);case`modelThinking`:return S(`config.section.modelThinking`)}},D=e=>{switch(e){case`models`:return(0,E.jsx)(_r,{size:15});case`plugins`:return(0,E.jsx)(Lr,{size:15});case`skills`:return(0,E.jsx)(ti,{size:15});case`startScreen`:return(0,E.jsx)(ri,{size:15});case`session`:return(0,E.jsx)(Gr,{size:15});case`appearance`:return(0,E.jsx)(Mr,{size:15});case`advanced`:return(0,E.jsx)(Ur,{size:15});case`git`:return(0,E.jsx)(Sr,{size:15});case`modelThinking`:return(0,E.jsx)(Dr,{size:15})}},O=oq.map(e=>({id:e,label:T(e),icon:D(e),closable:!1}));return(0,E.jsx)(`div`,{style:{height:`100%`,display:`flex`,flexDirection:`column`,overflow:`hidden`,background:`var(--bg)`},children:(0,E.jsxs)(Gn,{tabs:O,activeTabId:e,onSelectTab:e=>t(e),onCloseTab:()=>{},children:[(0,E.jsx)(Un,{id:`models`,children:(0,E.jsx)(HS,{onClose:i,pane:!0,initialSelection:x?{provider:x.provider,modelId:x.modelId}:null})}),(0,E.jsx)(Un,{id:`plugins`,children:n?(0,E.jsx)(xK,{cwd:n,sessionId:r,onClose:i,onOpenFile:a,pane:!0,globalPackages:C?.packages??[],globalExtensionFilters:C?.extensionFilters??[]}):(0,E.jsx)(cq,{text:S(`config.section.requiresCwd`)})}),(0,E.jsx)(Un,{id:`skills`,children:n?(0,E.jsx)(jK,{cwd:n,onClose:i,pane:!0,homeSkills:w?.skills??[]}):(0,E.jsx)(cq,{text:S(`config.section.requiresCwd`)})}),(0,E.jsx)(Un,{id:`startScreen`,children:(0,E.jsx)(qK,{})}),(0,E.jsx)(Un,{id:`session`,children:(0,E.jsx)(Pm,{defaultThinkingLevel:o,onDefaultThinkingLevelChange:s,compaction:c,onCompactionChange:l,retry:u,onRetryChange:f,defaultProjectTrust:p,onDefaultProjectTrustChange:m,subagents:h,onSubagentsChange:g})}),(0,E.jsx)(Un,{id:`appearance`,children:(0,E.jsx)(hi,{sidebarWidth:_,onSidebarWidthChange:v,widgetPanelWidth:y,onWidgetPanelWidthChange:b})}),(0,E.jsx)(Un,{id:`advanced`,children:(0,E.jsx)(Lm,{})}),(0,E.jsx)(Un,{id:`git`,children:(0,E.jsx)(eq,{})}),(0,E.jsx)(Un,{id:`modelThinking`,children:(0,E.jsx)(aq,{})})]})})}function cq({text:e}){return(0,E.jsx)(`div`,{style:{height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`var(--text-muted)`,fontSize:`var(--text-lg)`,padding:24,textAlign:`center`},children:e})}var lq=`chat`,uq=`config`,dq=`widgets`,fq=e=>`file:${e}`;function pq(e){if(!e||typeof e!=`object`)return null;let t=e;return t.kind===`config`?typeof t.section==`string`&&oq.includes(t.section)?{kind:`config`,section:t.section}:null:t.kind===`file`&&typeof t.filePath==`string`&&t.filePath&&typeof t.label==`string`?{kind:`file`,filePath:t.filePath,label:t.label,sourceSessionId:typeof t.sourceSessionId==`string`?t.sourceSessionId:null,initialDisplayMode:t.initialDisplayMode===`source`||t.initialDisplayMode===`preview`||t.initialDisplayMode===`diff`?t.initialDisplayMode:void 0}:null}var mq=e=>Array.isArray(e)?e.map(pq).filter(e=>e!==null):[];function hq(e){return{id:fq(e.filePath),label:e.label,filePath:e.filePath,sourceSessionId:e.sourceSessionId,initialDisplayMode:e.initialDisplayMode}}function gq(){try{if(localStorage.getItem(`pi:openTabs`)!==null)return[];let e=[],t=JSON.parse(localStorage.getItem(`pi:fileTabs`)??`[]`);if(e.push(...mq(Array.isArray(t)?t.map(e=>({kind:`file`,...typeof e==`object`&&e?e:{}})):[])),localStorage.getItem(`pi:configTabOpen`)===`1`){let t=pq({kind:`config`,section:localStorage.getItem(`pi:configSection`)??`models`});t&&e.unshift(t)}for(let e of[`pi:fileTabs`,`pi:activeFileTab`,`pi:configTabOpen`,`pi:configTabActive`,`pi:configSection`])localStorage.removeItem(e);return e}catch{return[]}}function _q(){try{return localStorage.getItem(`pi:openTabsActive`)===null?localStorage.getItem(`pi:configTabActive`)===`1`?uq:localStorage.getItem(`pi:activeFileTab`):null}catch{return null}}function vq({onSessionSelected:e,onRefreshModels:t}){let[n,r]=Zn(`pi:openTabs`,gq,mq),[i,a]=Zn(`pi:openTabsActive`,_q),[o,s]=(0,d.useState)(null),c=n.find(e=>e.kind===`config`),l=c!==void 0,u=c?.kind===`config`?c.section:`models`,f=(0,d.useCallback)(e=>{r(t=>t.map(t=>t.kind===`config`?{kind:`config`,section:e}:t))},[r]),p=(0,d.useMemo)(()=>n.filter(e=>e.kind===`file`).map(hq),[n]),m=i===null?null:n.find(e=>e.kind===`file`&&fq(e.filePath)===i)??null,h=l&&i===`config`,g=(0,d.useCallback)((t,n,i)=>{let o=i?.sourceSessionId,s=i?.modeHint,c=fq(t);r(e=>{let r=e.find(e=>e.kind===`file`&&e.filePath===t);if(!r)return[...e,{kind:`file`,filePath:t,label:n,sourceSessionId:o,initialDisplayMode:s}];let i=!o||r.sourceSessionId===o,a=!s||r.initialDisplayMode===s;return i&&a?e:e.map(e=>e.kind!==`file`||e.filePath!==t?e:{...e,sourceSessionId:o??e.sourceSessionId,initialDisplayMode:s??e.initialDisplayMode})}),e?.(),a(c)},[e,r,a]),_=(0,d.useCallback)(e=>{r(t=>t.filter(t=>t.kind!==`file`||fq(t.filePath)!==e)),a(t=>{if(t!==e)return t;let r=n.filter(t=>t.kind===`file`&&fq(t.filePath)!==e);return r.length>0?fq(r[r.length-1].filePath):null})},[n,r,a]),v=(0,d.useCallback)(t=>{r(e=>{let n=e.findIndex(e=>e.kind===`config`),r=t??(n>=0&&e[n].kind===`config`?e[n].section:`models`);if(n>=0){let t=[...e];return t[n]={kind:`config`,section:r},t}return[...e,{kind:`config`,section:r}]}),e?.(),a(uq)},[e,r,a]),y=(0,d.useCallback)(e=>{s(e),v(`models`)},[v]),b=(0,d.useCallback)(()=>{r(e=>e.filter(e=>e.kind!==`config`)),a(e=>e===`config`?null:e),s(null),t?.()},[r,a,t]);return{savedTabs:n,setSavedTabs:r,activeSavedId:i,setActiveSavedId:a,configTabOpen:l,configSection:u,setConfigSection:f,configTabActive:h,activeFileTab:m,fileTabs:p,modelConfigFocus:o,handleOpenFile:g,handleCloseFileTab:_,openConfigTab:v,handleOpenModelConfig:y,closeConfigTab:b,handleCloseMainTab:(0,d.useCallback)(e=>{if(e===`config`){b();return}_(e)},[b,_])}}function yq({widgetGeometries:e,setWidgetGeometry:t}){let[n,r]=(0,d.useState)(!0),[i,a]=(0,d.useState)(!1),[o,s]=(0,d.useState)([]),[c,l]=(0,d.useState)(new Map),[u,f]=(0,d.useState)(!0);return{widgetPanelOpen:n,setWidgetPanelOpen:r,widgetsTabActive:i,setWidgetsTabActive:a,extensionWidgets:o,closedWidgets:c,handleCloseWidget:(0,d.useCallback)((n,r)=>{l(e=>new Map(e).set(n,r));let i=e[n];t(n,{x:i?.x??0,y:i?.y??0,width:i?.width??560,height:i?.height??Math.round(window.innerHeight*.6),collapsed:!0})},[e,t]),handleReopenWidget:(0,d.useCallback)(n=>{l(e=>{if(!e.has(n))return e;let t=new Map(e);return t.delete(n),t});let r=e[n];r&&t(n,{...r,collapsed:!1}),a(!1)},[e,t,a]),handleExtensionWidgetsChange:(0,d.useCallback)(n=>{s(n),l(r=>{let i=!1,a=new Map(r);for(let[o,s]of r){let r=n.find(e=>e.key===o);if(r&&r.lines.join(`
348
348
  `)!==s){a.delete(o),i=!0;let n=e[o];n&&t(o,{...n,collapsed:!1})}}return i?a:r})},[e,t]),rightSidebarOpen:u,setRightSidebarOpen:f,closedWidgetCount:c.size}}function bq({hasFocusedEditable:e,innerHeight:t,viewportHeight:n,viewportScale:r}){let i=Math.abs(r-1)<.01;return e&&i&&t-n>1}function xq(){let e=document.activeElement;return e instanceof HTMLElement?e.isContentEditable||e.tagName===`INPUT`||e.tagName===`SELECT`||e.tagName===`TEXTAREA`:!1}function Sq(){(0,d.useEffect)(()=>{let e=window.visualViewport;if(!e)return;let t=document.documentElement,n=()=>{bq({hasFocusedEditable:xq(),innerHeight:window.innerHeight,viewportHeight:e.height,viewportScale:e.scale})?(t.style.setProperty(`--app-viewport-height`,`${e.height}px`),(window.scrollX!==0||window.scrollY!==0)&&window.scrollTo(0,0)):t.style.removeProperty(`--app-viewport-height`)};return n(),e.addEventListener(`resize`,n),e.addEventListener(`scroll`,n),()=>{e.removeEventListener(`resize`,n),e.removeEventListener(`scroll`,n),t.style.removeProperty(`--app-viewport-height`)}},[])}function Cq(e){let t=/(?:^|\s)@"([^"\n]*)$/.exec(e);if(t)return{start:e.length-(t[1].length+2),query:t[1],quoted:!0};let n=/(?:^|\s)@([^\s"]*)$/.exec(e);return n?{start:e.length-(n[1].length+1),query:n[1],quoted:!1}:null}function wq(e){let t=0;for(let n=0;n<e.length;n++)e[n]===`/`&&t++;return t}function Tq(e){let t=new Set;for(let n of e){let e=n.indexOf(`/`);for(;e!==-1;)t.add(n.slice(0,e)),e=n.indexOf(`/`,e+1)}let n=[];for(let e of t)n.push({path:e,isDir:!0});for(let t of e)t&&n.push({path:t,isDir:!1});return n.sort((e,t)=>wq(e.path)-wq(t.path)||e.path.localeCompare(t.path)),n}function Eq(e,t){let n=e.path.toLowerCase(),r=0;if(t.includes(`/`))n===t?r=100:n.startsWith(t)?r=80:n.includes(t)&&(r=50);else{let e=n.lastIndexOf(`/`),i=e===-1?n:n.slice(e+1);i===t?r=100:i.startsWith(t)?r=80:i.includes(t)?r=50:n.includes(t)&&(r=30)}return e.isDir&&r>0&&(r+=10),r}function Dq(e,t,n=20){let r=t.toLowerCase();if(!r)return e.slice(0,n);let i=[];for(let t of e){let e=Eq(t,r);e>0&&i.push({entry:t,score:e})}return i.sort((e,t)=>t.score-e.score||wq(e.entry.path)-wq(t.entry.path)||e.entry.path.localeCompare(t.entry.path)),i.slice(0,n).map(e=>e.entry)}function Oq(e,t,n=!1){let r=t?`${e}/`:e,i=n||r.includes(` `);if(t){let e=i?`@"${r}"`:`@${r}`;return{text:e,cursorOffset:i?e.length-1:e.length}}let a=i?`@"${r}" `:`@${r} `;return{text:a,cursorOffset:a.length}}function kq(e,t){let n=t?`${e}/`:e;return n.includes(` `)?`@"${n}" `:`@${n} `}function Aq(e,t,n){let r=Math.max(1,Math.min(t,n)),i=Math.max(1,Math.max(t,n));return`${e.includes(` `)?`@"${e}"`:`@${e}`}${r===i?`:${r}`:`:${r}-${i}`} `}function jq(e){return e.map(e=>kq(e,!1)).join(``)}function Mq(e){let t=e.get(`cwd`)?.trim()||null;return{requestedCwd:t,sessionId:t?null:e.get(`session`)}}function Nq(){return(0,E.jsxs)(`div`,{role:`status`,"aria-label":`Loading`,"data-testid":`boot-splash`,style:{position:`fixed`,inset:0,zIndex:9999,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:18,background:`var(--bg)`,color:`var(--text-muted)`},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-6xl)`,fontWeight:700,color:`var(--accent)`,letterSpacing:`0.02em`},children:`pi`}),(0,E.jsx)(`div`,{style:{width:22,height:22,border:`2px solid var(--border)`,borderTopColor:`var(--accent)`,borderRadius:`50%`,animation:`boot-spin 0.8s linear infinite`}}),(0,E.jsx)(`style`,{children:`@keyframes boot-spin { to { transform: rotate(360deg); } }`})]})}var Pq=!1,Fq=performance.now();function Iq(e){Pq=e,Fq=performance.now(),Pq&&Rq(`boot`,`debug log enabled`)}function Lq(e){return(t,n)=>Rq(e,t,n)}function Rq(e,t,n){if(!Pq)return;performance.now()-Fq;let r=new Date,i=(e,t=2)=>String(e).padStart(t,`0`);`${i(r.getHours())}${i(r.getMinutes())}${i(r.getSeconds())}${i(r.getMilliseconds(),3)}`}function zq(){if(!Pq)return;let e=window.fetch;window.fetch=async(t,n)=>{let r=typeof t==`string`?t:t instanceof URL?t.href:t.url,i=n?.method??`GET`,a=performance.now();try{let o=await e(t,n);return Rq(`fetch`,`${i} ${r}`,`${o.status} ${Math.round(performance.now()-a)}ms`),o}catch(e){throw Rq(`fetch`,`${i} ${r}`,`failed ${Math.round(performance.now()-a)}ms`),e}}}var Bq=new Set([`select`,`confirm`,`input`,`editor`]),Vq=new Set,Hq=new Set;function Uq(){for(let e of Hq)e()}function Wq(e){if(Vq.has(e))return;let t=new Set(Vq);t.add(e),Vq=t,Uq()}function Gq(e){if(!Vq.has(e))return;let t=new Set(Vq);t.delete(e),Vq=t,Uq()}function Kq(e){return Hq.add(e),()=>Hq.delete(e)}function qq(){return Vq}function Jq(){return(0,d.useSyncExternalStore)(Kq,qq,qq)}function Yq(e,t,n){let r=`${t}/${n}`;if(e.models?.[r])return e.models[r];if(e.providers?.[t])return e.providers[t]}function Xq(e,t){return e.providers?.[t]}function Zq(e,t,n,r){let i=`${t}/${n}`;if(r===`auto`){if(!e.models?.[i])return e;let t={...e.models};delete t[i];let n={...e};return Object.keys(t).length===0?delete n.models:n.models=t,n}let a=Xq(e,t);if(a!==void 0&&r===a){if(e.models?.[i]){let t={...e.models};delete t[i];let n={...e};return Object.keys(t).length===0?delete n.models:n.models=t,n}return e}return e.models?.[i]===r?e:{...e,models:{...e.models??{},[i]:r}}}function Qq(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function $q(e){return!Qq(e)||e.type!==`toolCall`?null:{type:`toolCall`,toolCallId:typeof e.toolCallId==`string`?e.toolCallId:typeof e.id==`string`?e.id:``,toolName:typeof e.toolName==`string`?e.toolName:typeof e.name==`string`?e.name:``,input:typeof e.input==`object`&&e.input!==null&&!Array.isArray(e.input)?e.input:typeof e.arguments==`object`&&e.arguments!==null&&!Array.isArray(e.arguments)?e.arguments:{}}}function eJ(e){if(e.role!==`assistant`)return e;let t=e.content;if(!Array.isArray(t))return e;let n=t.map(e=>$q(e)??e);return{...e,content:n}}function tJ(e){if(e.role!==`assistant`)return e;let t=e.content;if(!Array.isArray(t))return e;for(let e=0;e<t.length;e++){let n=t[e],r=$q(n);r!==null&&(t[e]=r)}return e}var nJ=e=>{let t=e;return t?typeof t.thinking==`string`?t.thinking.length:typeof t.text==`string`?t.text.length:typeof t.streamingOutput==`string`?t.streamingOutput.length:0:0};function rJ(){let e=new Map,t=new Map;return{snapshot(n){e.clear(),t.clear(),Array.isArray(n)&&n.forEach((n,r)=>{e.set(r,nJ(n)),t.set(r,0)})},take(n,r){let i=e.get(n)??0,a=t.get(n)??0;t.set(n,a+r.length);let o=Math.min(Math.max(i-a,0),r.length);return o>0?r.slice(o):r},reset(){e.clear(),t.clear()}}}var iJ=[],aJ=[`read`,`bash`,`edit`,`write`],oJ=[`bash`,`read`,`edit`,`write`,`grep`,`find`,`ls`],sJ=new Set(oJ);function cJ(e){let t=e.filter(e=>e.active);if(t.length===0)return`none`;let n=t.map(e=>e.name).filter(e=>sJ.has(e)).sort().join(`,`);return n===[...aJ].sort().join(`,`)?`default`:n===[...oJ].sort().join(`,`)?`full`:`default`}function lJ(e){return e===`none`?[...iJ]:e===`full`?[...oJ]:[...aJ]}function uJ(e,t){switch(t.type){case`start`:return{isStreaming:!0,streamingMessage:null};case`update`:return{isStreaming:!0,streamingMessage:t.message};case`end`:case`reset`:return{isStreaming:!1,streamingMessage:null};default:return e}}function dJ(e){if(!e||typeof e!=`object`)return;let t=e.content;if(!Array.isArray(t))return;let n=t.filter(e=>typeof e==`object`&&!!e&&e.type===`text`&&typeof e.text==`string`).map(e=>e.text);return n.length>0?n.join(``):void 0}function fJ(e){return{steering:e?.steering??[],followUp:e?.followUp??[]}}var pJ=700,mJ=1200,hJ=80,gJ=800,_J=600,vJ=2e4,yJ=3e4,bJ=200,xJ=32,SJ=15e3,CJ=1e3,wJ=5e3,TJ=5,EJ=5e3,DJ=180,OJ=new Set([`ArrowUp`,`ArrowDown`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Space`,`Spacebar`]),kJ=class extends Error{constructor(e){super(e===`timeout`?`Timed out connecting to the agent event stream. Please try again.`:`Failed to connect to the agent event stream. Please try again.`),this.status=e,this.name=`EventStreamConnectionError`}};function AJ(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`}function jJ(e){return new Promise(t=>setTimeout(t,e))}function MJ(e){let t=e.findIndex(e=>!e.exiting);return t===-1?e:e.map((e,n)=>n===t?{...e,exiting:!0}:e)}function NJ(e,t){let n=e,r=t;for(;r.length>0&&n.length<TJ;){let[e,...t]=r;n=[...n,e],r=t}return r.length>0&&!n.some(e=>e.exiting)&&(n=MJ(n)),{visible:n,pending:r}}function PJ(e,t){switch(t.type){case`add`:return e.visible.some(e=>e.exiting)||e.visible.length>=TJ?{visible:e.visible.some(e=>e.exiting)?e.visible:MJ(e.visible),pending:[...e.pending,t.notice],modals:e.modals}:{...e,visible:[...e.visible,t.notice]};case`mark_oldest_exiting`:return{...e,visible:MJ(e.visible)};case`add_modal`:return{...e,modals:[...e.modals,t.notice]};case`dismiss_modal`:return{...e,modals:e.modals.filter(e=>e.id!==t.id)};case`remove`:return{...NJ(e.visible.filter(e=>e.id!==t.id),e.pending),modals:e.modals};default:return e}}function FJ(){let[e,t]=(0,d.useReducer)(PJ,{visible:[],pending:[],modals:[]}),n=(0,d.useCallback)(e=>{let n=e.message.trim();if(!n)return;let r={id:e.id??AJ(),message:n,type:e.type??`info`};t(e.modal?{type:`add_modal`,notice:r}:{type:`add`,notice:r})},[]),r=(0,d.useCallback)(e=>{t({type:`dismiss_modal`,id:e})},[]);return(0,d.useEffect)(()=>{if(e.visible.length===0)return;let n=e.visible.find(e=>e.exiting);if(n){let e=setTimeout(()=>{t({type:`remove`,id:n.id})},DJ);return()=>clearTimeout(e)}if(!e.visible[0])return;let r=setTimeout(()=>{t({type:`mark_oldest_exiting`})},EJ);return()=>clearTimeout(r)},[e.visible]),{noticeState:e,addNotice:n,dismissModal:r}}function IJ({messages:e,contextUsage:t,data:n,session:r,sessionIdRef:i}){let[a,o]=(0,d.useState)(null);return{sessionStats:(0,d.useMemo)(()=>{if(a)return a;let o={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},s=0,c=0,l=0,u=0,d=0;for(let t of e){if(t.role===`user`&&(c+=1),t.role===`toolResult`&&(u+=1),t.role!==`assistant`)continue;l+=1;let e=t.usage;d+=t.content.filter(e=>e.type===`toolCall`).length,e&&(o.input+=e.input??0,o.output+=e.output??0,o.cacheRead+=e.cacheRead??0,o.cacheWrite+=e.cacheWrite??0,s+=e.cost?.total??0)}return o.total=o.input+o.output+o.cacheRead+o.cacheWrite,o.total===0&&e.length===0?null:{sessionFile:n?.filePath||void 0,sessionId:i.current??r?.id??``,sessionName:r?.name,userMessages:c,assistantMessages:l,toolCalls:d,toolResults:u,totalMessages:e.length,tokens:o,cost:s,...t?{contextUsage:t}:{}}},[e,a,t,n?.filePath,r?.id,r?.name,i]),setSessionStatsOverride:o}}function LJ({isNew:e,sessionIdRef:t,ensuringNewSessionRef:n,setToolPresetOverride:r}){let[i,a]=(0,d.useState)({}),[o,s]=(0,d.useState)([]),[c,l]=(0,d.useState)(null),[u,f]=(0,d.useState)([]),[p,m]=(0,d.useState)({}),[h,g]=(0,d.useState)({}),[_,v]=(0,d.useState)(null),[y,b]=(0,d.useState)(null),[x,S]=(0,d.useState)(`default`),[C,w]=(0,d.useState)(`auto`),[T,E]=(0,d.useState)(null),[D,O]=(0,d.useState)(null),k=(0,d.useRef)(null),A=(0,d.useRef)(null),j=r??S,M=(0,d.useCallback)((t,n)=>{if(e){let e={provider:t,modelId:n};k.current=e,v(e),O(e);return}E({provider:t,modelId:n})},[e,v]);return{modelNames:i,modelList:o,modelError:c,modelScopeWarnings:u,modelThinkingLevels:p,modelThinkingLevelMaps:h,newSessionModel:_,newSessionDefaultModel:y,toolPreset:x,thinkingLevel:C,currentModelOverride:T,pendingModel:D,setThinkingLevel:w,setPendingModel:O,setNewSessionDefaultModel:b,setCurrentModelOverride:E,setModelError:l,setToolPresetState:j,newSessionModelOverrideRef:k,thinkingLevelOverrideRef:A,loadModels:(0,d.useCallback)(async t=>{let n=await be.load(t);a(n.models),l(n.modelError??null),f(n.modelScopeWarnings??[]),m(n.thinkingLevels??{}),g(n.thinkingLevelMaps??{});let r=n.modelList??[];if(s(r),e){let e=(n.defaultModel?r.find(e=>e.id===n.defaultModel?.modelId&&e.provider===n.defaultModel?.provider):void 0)??r[0];b(t=>t??(e?{provider:e.provider,modelId:e.id}:null));let t=e&&n.thinkingLevelPins?.[`${e.provider}/${e.id}`];A.current===null&&w(e=>e===`auto`?t??`auto`:e)}},[e]),handleModelChange:M,handleThinkingLevelChange:(0,d.useCallback)(async r=>{if(w(r),e&&!t.current&&(A.current=r===`auto`?null:r),r===`auto`)return;let i=t.current??await n.current;if(i)try{await US(i,{type:`set_thinking_level`,level:r})}catch(e){console.error(`Failed to set thinking level:`,e)}},[e,t,n]),handleToolPresetChange:(0,d.useCallback)(async e=>{let r=lJ(e);j(e);let i=t.current??await n.current;if(i)try{await US(i,{type:`set_tools`,toolNames:r})}catch(e){console.error(`Failed to set tools:`,e)}},[j,t,n])}}function RJ({addNotice:e,chatInputRef:t,sessionIdRef:n}){let[r,i]=(0,d.useState)(null),[a,o]=(0,d.useState)(null),[s,c]=(0,d.useState)([]),[l,u]=(0,d.useState)([]);return(0,d.useEffect)(()=>{if(!r?.timeout)return;let e=r.id,t=setTimeout(()=>{Rq(`ui-chain`,`4c dialog auto-close by timeout`,`id=${e.slice(0,8)}`),i(t=>t?.id===e?null:t)},r.timeout);return()=>clearTimeout(t)},[r]),{extensionDialog:r,extensionCustomUi:a,extensionStatuses:s,extensionWidgets:l,setExtensionStatuses:c,setExtensionWidgets:u,respondToExtensionUi:(0,d.useCallback)(async(e,t)=>{let r=n.current;if(i(t=>t?.id===e.id?null:t),r)try{await US(r,{type:`extension_ui_response`,id:e.id,...t})}catch(e){console.error(`Failed to send extension UI response:`,e)}},[n]),sendExtensionCustomInput:(0,d.useCallback)(async(e,t)=>{let r=n.current;if(r)try{await US(r,{type:`extension_ui_input`,id:e.id,data:t})}catch(e){console.error(`Failed to send extension custom UI input:`,e)}},[n]),handleExtensionUiRequest:(0,d.useCallback)(n=>{switch(n.method){case`select`:case`confirm`:case`input`:case`editor`:i(n);break;case`notify`:{let t=n.notifyType??`info`,r=n.message;t===`warning`?console.warn(`[pi] notify (warning): ${r}`):t===`error`?console.error(`[pi] notify (error): ${r}`):console.info(`[pi] notify: ${r}`);let i=typeof r==`string`&&r.length>100;e({id:n.id,message:r,type:t,modal:t===`warning`||t===`error`||i});break}case`setStatus`:c(e=>{let t=e.filter(e=>e.key!==n.statusKey);return n.statusText===void 0?t:[...t,{key:n.statusKey,text:n.statusText}]});break;case`setWidget`:u(e=>{let t=e.filter(e=>e.key!==n.widgetKey);return n.widgetLines?[...t,{key:n.widgetKey,lines:n.widgetLines,placement:n.widgetPlacement??`aboveEditor`}]:t});break;case`setTitle`:n.title&&(document.title=n.title);break;case`set_editor_text`:t?.current?.insertText(n.text);break;case`custom`:o(e=>n.closed?e?.id===n.id?null:e:n)}},[e,t])}}function zJ(e){let t=e.content;return typeof t==`string`?t:Array.isArray(t)?t.map(e=>e&&typeof e==`object`&&e.type===`text`&&typeof e.text==`string`?e.text:``).filter(Boolean).join(`
349
349
  `):``}function BJ(e){if(!e||typeof e!=`object`||e.type!==`image`)return``;let t=e.source;if(t&&typeof t==`object`){let e=t;return[e.type===`url`?`url`:`base64`,typeof e.media_type==`string`?e.media_type:``,typeof e.data==`string`?e.data:``,typeof e.url==`string`?e.url:``].join(`:`)}let n=e;return[`base64`,typeof n.mimeType==`string`?n.mimeType:``,typeof n.data==`string`?n.data:``,``].join(`:`)}function VJ(e){function t(t,n){try{if(localStorage.getItem(`piWebDebug`)===`1`){let e=Error().stack;Rq(`messages`,t,e?.split(`
350
350
  `).slice(1).join(`
351
- `))}}catch{}e(n)}return{apply:(e,n)=>t(e,n),append:(e,n)=>t(`${e}:append`,e=>[...e,n]),replaceAll(e,n){t(`${e}:replaceAll`,n)},truncateFrom:(e,n)=>t(`${e}:truncateFrom`,e=>e.slice(0,Math.max(0,n))),dropLastIf:(e,n)=>t(`${e}:dropLastIf`,e=>n(e[e.length-1])?e.slice(0,-1):e)}}function HJ(e){let t=e.content;return JSON.stringify(typeof t==`string`?{text:t,images:[]}:Array.isArray(t)?{text:zJ(e),images:t.map(BJ).filter(Boolean)}:{text:``,images:[]})}function UJ(e,t){if(!e||typeof e!=`object`)return null;let n=e;return typeof n.tokensBefore!=`number`||typeof n.estimatedTokensAfter!=`number`?null:{reason:t,tokensBefore:n.tokensBefore,estimatedTokensAfter:n.estimatedTokensAfter}}function WJ(e,t,n,r){let i=new Set(t),a=new Set(e.filter(e=>e.role===`user`).map(HJ)),o=[...e];for(let e=0;e<n.length;e++){let t=r[e];if(t!==void 0)i.has(t)||o.push(n[e]);else{let t=n[e];(t.role!==`user`||!a.has(HJ(t)))&&o.push(t)}}return o}function GJ(e){let{session:t,newSessionCwd:n,onAgentEnd:r,onAgentSettled:i,onAgentError:a,onSessionCreated:o,onSessionForked:s,modelsRefreshKey:c}=e,l=t===null&&n!==null,[u,f]=(0,d.useState)(null),[p,m]=(0,d.useState)(!l),[h,g]=(0,d.useState)(null),[_,v]=(0,d.useState)(null),[y,b]=(0,d.useState)([]),x=(0,d.useRef)(null);x.current||=VJ(b);let S=x.current,[C,w]=(0,d.useState)([]),[T,E]=(0,d.useReducer)(uJ,{isStreaming:!1,streamingMessage:null}),D=(0,d.useRef)(null),O=(0,d.useRef)(null),k=(0,d.useRef)(null),A=(0,d.useRef)(new Map),j=(0,d.useRef)(rJ()),M=(0,d.useRef)(!0),P=(0,d.useRef)([]),ee=(0,d.useRef)(new Map),F=(0,d.useRef)(null),te=(0,d.useRef)(null),ne=(0,d.useCallback)(()=>{let e=A.current;if(e.size===0)return;let t=k.current;if(!t){e.clear();return}let n=t.content;if(!Array.isArray(n)){e.clear();return}for(let[t,r]of e){let e=r.join(``),i=n[t];if(!i)continue;let a=j.current.take(t,e);a&&(i.type===`thinking`?i.thinking=(i.thinking??``)+a:i.type===`text`?i.text=(i.text??``)+a:i.type===`toolCall`&&(i.streamingOutput=(i.streamingOutput??``)+a))}e.clear()},[]),re=(0,d.useCallback)(()=>{O.current&&=(clearTimeout(O.current),null),ne();let e=D.current;if(D.current=null,e&&Ye.current){let t=e,n={...e,content:[...t.content??[]]};(0,d.startTransition)(()=>E({type:`update`,message:n}))}else if(k.current&&Ye.current){let e=k.current,t={...e,content:[...e.content??[]]};(0,d.startTransition)(()=>E({type:`update`,message:t}))}},[ne]);(0,d.useEffect)(()=>()=>{O.current&&=(clearTimeout(O.current),null),F.current&&=(clearTimeout(F.current),null),te.current&&=(clearTimeout(te.current),null)},[]);let[ie,ae]=(0,d.useState)(!1),[oe,I]=(0,d.useState)(!1),L=(0,d.useCallback)(e=>{Ye.current=e,ae(e)},[]),se=(0,d.useCallback)(e=>{$e.current=e,I(e)},[]),[R,ce]=(0,d.useState)(``),[le,ue]=(0,d.useState)(null),[de,fe]=(0,d.useState)(null),[pe,me]=(0,d.useState)(null),[he,ge]=(0,d.useState)(null),[_e,ve]=(0,d.useState)(null),[ye,xe]=(0,d.useState)(!1),[Se,Ce]=(0,d.useState)(null),[we,Te]=(0,d.useState)(null),[De,Oe]=(0,d.useState)(null),[ke,Ae]=(0,d.useState)([]),[je,Me]=(0,d.useState)(!1),{noticeState:Ne,addNotice:Pe,dismissModal:Fe}=FJ(),{t:Ie}=N(),[Le,Re]=(0,d.useState)({steering:[],followUp:[]}),[ze,Be]=(0,d.useState)(!1),Ve=(0,d.useRef)(null),He=(0,d.useRef)(null),Ue=(0,d.useRef)(null),We=(0,d.useRef)(null),Ge=(0,d.useRef)(null),Ke=(0,d.useRef)(0),qe=(0,d.useRef)(!1),Je=(0,d.useRef)(t?.id??null),Ye=(0,d.useRef)(!1),Xe=(0,d.useRef)(!1),Ze=(0,d.useRef)(!1),Qe=(0,d.useRef)(-1),$e=(0,d.useRef)(!1),et=(0,d.useRef)(0),tt=(0,d.useRef)(null),nt=(0,d.useRef)(!1),rt=(0,d.useRef)(null),it=(0,d.useRef)(!1),at=(0,d.useRef)(!0),ot=(0,d.useRef)(void 0),st=(0,d.useRef)(0),ct=(0,d.useRef)(0),lt=(0,d.useRef)(null),ut=(0,d.useRef)(null),dt=(0,d.useRef)(null),ft=(0,d.useRef)(!1),pt=(0,d.useRef)(0),mt=(0,d.useRef)(!1),{modelNames:ht,modelList:gt,modelError:_t,modelScopeWarnings:vt,modelThinkingLevels:yt,modelThinkingLevelMaps:bt,newSessionModel:xt,newSessionDefaultModel:St,toolPreset:Ct,thinkingLevel:wt,currentModelOverride:Tt,pendingModel:Et,setThinkingLevel:Dt,setPendingModel:Ot,setNewSessionDefaultModel:kt,setCurrentModelOverride:At,setModelError:jt,setToolPresetState:Mt,newSessionModelOverrideRef:Nt,thinkingLevelOverrideRef:Pt,loadModels:It,handleModelChange:Lt,handleThinkingLevelChange:Rt,handleToolPresetChange:zt}=LJ({isNew:l,sessionIdRef:Je,ensuringNewSessionRef:dt,setToolPresetOverride:e.setToolPreset}),{extensionDialog:Bt,extensionCustomUi:Vt,extensionStatuses:Ht,extensionWidgets:Ut,setExtensionStatuses:Wt,setExtensionWidgets:Gt,respondToExtensionUi:Kt,sendExtensionCustomInput:qt,handleExtensionUiRequest:Jt}=RJ({addNotice:Pe,chatInputRef:e.chatInputRef,sessionIdRef:Je}),Yt=(0,d.useCallback)(e=>{e?.contextUsage!==void 0&&me(e.contextUsage??null),e?.systemPrompt!==void 0&&ge(e.systemPrompt??null),e?.thinkingLevel!==void 0&&Dt(e.thinkingLevel??`auto`),e?.extensionStatuses!==void 0&&Wt(e.extensionStatuses??[]),e?.extensionWidgets!==void 0&&Gt(e.extensionWidgets??[]),e?.queuedMessages!==void 0&&Re(fJ(e.queuedMessages))},[Dt,Wt,Gt]),Xt=Tt??u?.context.model??Et??null,Zt=l?xt??St:Xt,Qt=(0,d.useSyncExternalStore)(Ee.subscribe,()=>Ee.get()??null,()=>null);(0,d.useEffect)(()=>{Ee.load().catch(()=>{})},[]);let $t=(0,d.useRef)(null);(0,d.useEffect)(()=>{if(!Zt||!Qt||Object.keys(yt).length===0)return;let e=Yq(Qt,Zt.provider,Zt.modelId),t=`${Zt.provider}/${Zt.modelId}`;if($t.current&&$t.current.key!==t&&($t.current=null),!e||$t.current)return;let n=yt[t],r=!n||n.includes(e),i;if(r)i=e;else if(e===`auto`||!n||n.length===0)i=`auto`;else{i=xi(e,n);let t=Ee.get()??{},r=Zq(t,Zt.provider,Zt.modelId,i);JSON.stringify(r)!==JSON.stringify(t)&&Ee.load().catch(()=>{}).then(async()=>{try{await fetch(`/api/model-thinking`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify(r)}),await Ee.refresh()}catch{}})}if(i!==wt&&(Dt(i),l&&!Je.current&&(Pt.current=i===`auto`?null:i),i!==`auto`&&Je.current)){let e=Je.current;US(e,{type:`set_thinking_level`,level:i}).catch(()=>{})}},[Zt?.provider,Zt?.modelId,Qt,yt,wt,l]);let en=(0,d.useCallback)(async e=>{if(Zt&&($t.current={key:`${Zt.provider}/${Zt.modelId}`,level:e}),await Rt(e),!Zt)return;try{await Ee.load()}catch{}let t=Ee.get()??{},n=Zq(t,Zt.provider,Zt.modelId,e);if(JSON.stringify(n)!==JSON.stringify(t))try{await fetch(`/api/model-thinking`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify(n)}),await Ee.refresh()}catch{}},[Rt,Zt]),{sessionStats:tn,setSessionStatsOverride:nn}=IJ({messages:y,contextUsage:pe,data:u,session:t,sessionIdRef:Je}),rn=(0,d.useCallback)(async(e,t=!1,n=!1)=>{let r=!1;try{t&&m(!0);let i=new URLSearchParams({deferMedia:`1`}),a=await fetch(`/api/sessions/${encodeURIComponent(e)}?${i}`);if(a.status===404)return t&&(f(null),v(null),S.apply(`loadSession:notFound`,[]),g(null)),null;if(!a.ok)throw Error(`HTTP ${a.status}`);let o=await a.json();if(Je.current!==e)return null;if(f(o),v(o.leafId),mt.current){let e=o.context.entryIds??[];S.apply(`loadSession:keepOptimistic`,t=>WJ(o.context.messages,e,t,C)),w(e)}else S.replaceAll(`loadSession`,o.context.messages),w(o.context.entryIds??[]);if(At(null),g(null),o.context.thinkingLevel&&o.context.thinkingLevel!==`off`&&Dt(o.context.thinkingLevel),r=!0,t&&m(!1),!n)return null;try{let t=await fetch(`/api/sessions/${encodeURIComponent(e)}/state`);if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();if(Je.current!==e)return null;let r=n.state;return r?Yt(r):n.running||Re({steering:[],followUp:[]}),n}catch(e){return console.error(`Failed to load agent state:`,e),null}}catch(e){return g(String(e)),null}finally{t&&!r&&m(!1)}},[Yt,Dt,At,S,C]),an=(0,d.useCallback)(async(e,t,n=!1)=>{try{let r=new URLSearchParams({deferMedia:`1`});t&&r.set(`leafId`,t);let i=`/api/sessions/${encodeURIComponent(e)}/context?${r}`,a=await fetch(i);if(!a.ok)throw Error(`HTTP ${a.status}`);let o=await a.json(),s=o.context.entryIds??[];S.apply(`loadContext merge=${n}`,e=>n?WJ(o.context.messages,s,e,C):o.context.messages),w(s)}catch(e){console.error(`Failed to load context:`,e)}},[C,S]),on=(0,d.useCallback)(async e=>{try{let t=await US(e,{type:`get_tools`});t&&Mt(cJ(t))}catch(e){console.error(`Failed to load tools:`,e)}},[Mt]),sn=(0,d.useCallback)((e=0,t=`(no messages)`)=>{let r=Je.current;!l||!n||!r||ft.current||(ft.current=!0,o?.({id:r,path:``,cwd:n,name:void 0,created:new Date().toISOString(),modified:new Date().toISOString(),messageCount:e,firstMessage:t}))},[l,n,o]),cn=(0,d.useCallback)(async()=>{if(Je.current||!l||!n)return Je.current;if(dt.current)return dt.current;let e=(async()=>{let e=Nt.current,t=Pt.current;e&&Ot(e);let r=lJ(Ct),i=await fetch(`/api/agent/new`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:n,type:`ensure_session`,toolNames:r,...e?{provider:e.provider,modelId:e.modelId}:{},...t?{thinkingLevel:t}:{}})});if(!i.ok)throw Error(`HTTP ${i.status}`);let a=await i.json(),o=a.sessionId;return Je.current=o,a.model&&Nt.current===e&&(Ot(a.model),e||kt(a.model)),a.thinkingLevel&&Pt.current===t&&Dt(a.thinkingLevel),o})();dt.current=e;try{return await e}finally{dt.current=null}},[l,n,Ct,Pt,Nt,Ot,Dt,kt]),ln=(0,d.useCallback)(async()=>{let e=Je.current??await cn();if(!e)return Ae([]),[];Me(!0);try{let t=(await US(e,{type:`get_commands`}))?.commands??[];return Ae(t),t}catch(e){return console.error(`Failed to load slash commands:`,e),Ae([]),[]}finally{Me(!1)}},[cn]),un=(0,d.useCallback)(()=>{Ke.current+=1,qe.current=!1,Ge.current&&=(clearTimeout(Ge.current),null)},[]),dn=(0,d.useCallback)(()=>{Ve.current?.(),Ve.current=null,Ue.current=null,We.current=null},[]),fn=(0,d.useCallback)(e=>{dn();let t=`agent:${e}`,n=!1,r=null,i,a={key:t,promise:null,pending:!0},o=e=>{n||(n=!0,r&&clearTimeout(r),We.current===a&&(a.pending=!1),i({status:e}))};r=setTimeout(()=>o(`timeout`),wJ);let s=new Promise(e=>{i=e});return a.promise=s,Ve.current=Ft({ch:`agent`,sessionId:e},e=>{e.type===`connected`?o(`connected`):(e.type===`not_found`||e.type===`start_failed`)&&o(`closed`)}),Ue.current=e,We.current=a,s},[dn]),pn=(0,d.useCallback)(async e=>{if(Ue.current===e&&Ve.current){let e=We.current;if(e?.pending){let t=await e.promise;if(t.status===`connected`)return;throw dn(),new kJ(t.status)}return}let t=await fn(e);if(t.status!==`connected`)throw dn(),new kJ(t.status)},[dn,fn]),mn=(0,d.useCallback)(()=>{let e=Ye.current;return Ye.current=!1,ae(!1),Oe(null),fe(null),E({type:`end`}),e},[]),hn=(0,d.useCallback)(e=>Qe.current!==e&&(Qe.current=e,r?.(),!0),[r]),gn=(0,d.useCallback)(e=>{un(),qe.current=!0;let t=Ke.current,n=async()=>{if(!(t!==Ke.current||Je.current!==e||!qe.current))try{let r=await fetch(`/api/agent/${encodeURIComponent(e)}`);if(!r.ok)throw Error(`HTTP ${r.status}`);let i=await r.json();if(t!==Ke.current||Je.current!==e||!qe.current)return;let a=i.state;if(i.running&&a&&(a.isStreaming||a.isPromptRunning)){qe.current=!1,Ge.current=null,Xe.current=!!a?.isStreaming,Ze.current=!!a?.isPromptRunning,L(!0),Oe(a?.isStreaming?{kind:`waiting_model`}:{kind:`running_command`});return}if(i.running&&a?.isCompacting){xe(!0),Ge.current=setTimeout(()=>void n(),_J);return}qe.current=!1,Ge.current=null,dn()}catch{if(t!==Ke.current||Je.current!==e||!qe.current)return;Ge.current=setTimeout(()=>void n(),_J)}};Ge.current=setTimeout(()=>void n(),yJ)},[un,dn]),_n=(0,d.useCallback)(async(e=Je.current,t=pt.current)=>{if(pt.current===t)try{e&&await rn(e)}catch(e){if(pt.current!==t)return;throw e}finally{if(pt.current===t){let n=Ze.current,a=Xe.current;Ze.current=!1,Xe.current=!1,mt.current=!1;let o=mn();n?(hn(t),o&&i?.()):a&&o&&(r?.(),i?.()),e&&gn(e)}}},[rn,hn,r,i,gn,mn]),vn=(0,d.useCallback)(async(e,t)=>{await jJ(gJ);let n=Date.now();for(;Ye.current&&Date.now()-n<vJ;){if(t!==void 0&&pt.current!==t)return;try{let n=await fetch(`/api/agent/${encodeURIComponent(e)}`);if(n.ok){let r=await n.json(),i=r.state;if(!r.running||!i||!i.isStreaming&&!i.isPromptRunning){await _n(e,t);return}}}catch{}await jJ(_J)}},[_n]),yn=(0,d.useCallback)(async e=>{let t=et.current+1;for(et.current=t;$e.current&&et.current===t&&Je.current===e;){await jJ(CJ);try{let n=await fetch(`/api/agent/${encodeURIComponent(e)}`);if(!n.ok||(await n.json()).state?.isBashRunning)continue;if(await rn(e),et.current!==t||Je.current!==e)return;se(!1),ue(null);return}catch{}}},[rn]),bn=(0,d.useCallback)(async e=>{if(!Ye.current)return;let t=pt.current;try{let n=await fetch(`/api/agent/${encodeURIComponent(e)}`);if(!n.ok)return;let r=await n.json();if(pt.current!==t)return;let i=r.state;if(xe(i?.isCompacting??!1),Re(fJ(i?.queuedMessages)),r.running&&i&&(i.isStreaming||i.isPromptRunning||i.isCompacting)||!Ye.current)return;i&&Yt(i),await _n(e,t)}catch{}},[Yt,_n]);(0,d.useEffect)(()=>{if(!ie)return;let e=()=>{let e=Je.current;e&&bn(e)},t=()=>{document.visibilityState===`visible`&&e()},n=setInterval(e,SJ);return document.addEventListener(`visibilitychange`,t),window.addEventListener(`online`,e),()=>{clearInterval(n),document.removeEventListener(`visibilitychange`,t),window.removeEventListener(`online`,e)}},[ie,bn]),(0,d.useEffect)(()=>{Ye.current=ie},[ie]),tt.current=(0,d.useCallback)(e=>{let t=e=>{let t=e.assistantMessageEvent;if(!t||typeof t.type!=`string`)return;let n=k.current;if(!n)return;let r=t.contentIndex;if(typeof r!=`number`)return;let i=n.content;if(Array.isArray(i))switch(t.type){case`thinking_start`:{if(i[r]?.type===`thinking`)break;let e={type:`thinking`,thinking:``};r>=i.length?i.push(e):i.splice(r,0,e),M.current=!0;break}case`thinking_delta`:if(i[r]?.type===`thinking`&&typeof t.delta==`string`){let e=A.current,n=e.get(r)??[];n.push(t.delta),e.set(r,n)}break;case`thinking_end`:{let e=A.current;if(e.has(r)){let t=e.get(r);e.delete(r);let n=t.join(``),a=j.current.take(r,n),o=i[r];o?.type===`thinking`&&a&&(o.thinking=(o.thinking??``)+a)}let n=i[r];if(n?.type===`thinking`&&typeof t.content==`string`&&(n.thinking=t.content),n?.type===`thinking`){let e=t.thinkingSignature??t.signature;typeof e==`string`&&e.length>0?n.thinkingSignature=e:e&&typeof e==`object`&&(n.thinkingSignature=JSON.stringify(e)),t.redacted===!0&&(n.redacted=!0);let i=t.partial?.content?.[r];i&&typeof i.thinkingSignature==`string`&&!n.thinkingSignature&&(n.thinkingSignature=i.thinkingSignature),i&&i.redacted===!0&&(n.redacted=!0)}break}case`text_start`:{if(i[r]?.type===`text`)break;let e={type:`text`,text:``};r>=i.length?i.push(e):i.splice(r,0,e),M.current=!0;break}case`text_delta`:if(i[r]?.type===`text`&&typeof t.delta==`string`){let e=A.current,n=e.get(r)??[];n.push(t.delta),e.set(r,n)}break;case`text_end`:{let e=A.current;if(e.has(r)){let t=e.get(r);e.delete(r);let n=t.join(``),a=j.current.take(r,n),o=i[r];o?.type===`text`&&a&&(o.text=(o.text??``)+a)}let n=i[r];n?.type===`text`&&typeof t.content==`string`&&(n.text=t.content);break}case`toolcall_start`:break;case`toolcall_delta`:if(i[r]?.type===`toolCall`&&typeof t.delta==`string`){let e=A.current,n=e.get(r)??[];n.push(t.delta),e.set(r,n)}break;case`toolcall_end`:{let e=A.current;e.has(r)&&e.delete(r),t.toolCall&&typeof t.toolCall==`object`&&(i[r]={type:`toolCall`,...t.toolCall});break}}},n=()=>{if(O.current)return;let e=M.current?xJ:bJ;O.current=setTimeout(()=>{O.current=null,ne();let e=k.current??D.current;if(D.current=null,!e||!Ye.current)return;let t=e.content;if(!(Array.isArray(t)&&t.some(e=>{let t=e.type;return t===`thinking`?!!((e.thinking?.trim()??``)!==``||typeof e.thinkingSignature==`string`&&e.thinkingSignature.length>0||e.redacted):t!==`text`||(e.text?.trim()??``)!==``})))return;M.current=!1;let n={...e,content:[...t??[]]};(0,d.startTransition)(()=>E({type:`update`,message:n}))},e)},o=()=>{if(!Ye.current)return;let r=e.message;if(r&&r.role!==`user`){A.current.clear();let e=tJ(r);j.current.snapshot(e.content),k.current=e,D.current=e,M.current=!0,n()}else k.current&&(t(e),n())};switch(e.type){case`agent_start`:A.current.clear(),k.current=null,D.current=null,M.current=!0,j.current.reset(),un(),Xe.current=!0,L(!0),Oe({kind:`waiting_model`}),fe(null),E({type:`start`});break;case`agent_end`:if(!Ye.current)break;if(Oe(null),fe(null),E({type:`end`}),k.current=null,D.current=null,A.current.clear(),j.current.reset(),O.current&&=(clearTimeout(O.current),null),F.current&&=(clearTimeout(F.current),null),P.current.length){let e=P.current.join(``);P.current=[],e&&ce(t=>t+e)}if(te.current&&=(clearTimeout(te.current),null),ee.current.size){let e=new Map(ee.current);ee.current.clear(),S.apply(`tool_execution_update:batched:drain`,t=>t.map(t=>{if(!(`content`in t)||!Array.isArray(t.content))return t;let n=!1,r=t.content.map(t=>{if(t.type===`toolCall`){let r=e.get(t.toolCallId??``);if(r!==void 0)return n=!0,{...t,streamingOutput:r}}return t});return n?{...t,content:r}:t}))}Je.current&&(rn(Je.current),fetch(`/api/agent/${encodeURIComponent(Je.current)}`).then(e=>e.json()).then(e=>{e.state&&Yt(e.state),Re(fJ(e.state?.queuedMessages))}).catch(()=>{}));break;case`agent_settled`:{let e=Xe.current;if(Xe.current=!1,!e||Ze.current)break;let t=Je.current,n=mn();xe(!1),t&&(rn(t),gn(t)),k.current=null,D.current=null,A.current.clear(),O.current&&=(clearTimeout(O.current),null),n&&(r?.(),i?.());break}case`prompt_done`:{let e=pt.current,t=Ze.current;Ze.current=!1,mt.current=!1;let n=hn(e);if(!t&&!n)break;let a=Je.current;if(a&&rn(a),!Xe.current){let e=mn();a&&gn(a),e&&(r?.(),i?.())}}break;case`prompt_error`:Pe({type:`error`,message:e.errorMessage??Ie(`i18n.commandFailed`)}),a?.(e.errorMessage??Ie(`i18n.commandFailed`));break;case`extension_error`:Pe({type:`error`,message:e.error??Ie(`i18n.extensionCommandFailed`)}),a?.(e.error??Ie(`i18n.extensionCommandFailed`));break;case`message_start`:o();break;case`message_update`:o(),e.assistantMessageEvent?.type?.startsWith(`thinking`)?Oe({kind:`thinking`}):Oe(null);break;case`message_end`:{if(!Ye.current)break;re();let t=e.message;if(t&&t.role===`user`){let e=eJ(t),n=HJ(e),r=mt.current;mt.current=!1,S.apply(`message_end:userEcho`,t=>{let i=t[t.length-1];return i?.role===`user`&&HJ(i)===n?t:r&&i?.role===`user`?[...t.slice(0,-1),e]:[...t,e]})}else t&&S.append(`message_end:assistant`,eJ(t));E({type:`reset`}),k.current=null,D.current=null,A.current.clear(),O.current&&=(clearTimeout(O.current),null),Oe({kind:`waiting_model`});break}case`tool_execution_start`:{let t=e.toolCallId,n=e.toolName;Oe(e=>{let r=e?.kind===`running_tools`?[...e.tools]:[];return r.some(e=>e.id===t)||r.push({id:t,name:n}),{kind:`running_tools`,tools:r}});break}case`tool_execution_update`:{let t=e.toolCallId,n=dJ(e.partialResult);if(n===void 0)break;ee.current.set(t,n),te.current||=setTimeout(()=>{te.current=null;let e=new Map(ee.current);ee.current.clear(),e.size!==0&&(0,d.startTransition)(()=>{S.apply(`tool_execution_update:batched`,t=>t.map(t=>{if(!(`content`in t)||!Array.isArray(t.content))return t;let n=!1,r=t.content.map(t=>{if(t.type===`toolCall`){let r=e.get(t.toolCallId??``);if(r!==void 0)return n=!0,{...t,streamingOutput:r}}return t});return n?{...t,content:r}:t}))})},bJ);break}case`tool_execution_end`:{let t=e.toolCallId;Oe(e=>{if(e?.kind!==`running_tools`)return e;let n=e.tools.filter(e=>e.id!==t);return n.length===0?{kind:`waiting_model`}:{kind:`running_tools`,tools:n}});break}case`bash_execution_update`:{let t=e.delta;if(!t)break;P.current.push(t),F.current||=setTimeout(()=>{F.current=null;let e=P.current;if(P.current=[],e.length===0)return;let t=e.join(``);t&&(0,d.startTransition)(()=>ce(e=>e+t))},bJ);break}case`queue_update`:Re({steering:[...e.steering??[]],followUp:[...e.followUp??[]]});break;case`auto_retry_start`:fe({attempt:e.attempt,maxAttempts:e.maxAttempts,errorMessage:e.errorMessage});break;case`auto_retry_end`:fe(null);break;case`auto_compaction_start`:case`compaction_start`:xe(!0),Ce(null),Te(null);break;case`auto_compaction_end`:case`compaction_end`:xe(!1),e.errorMessage?(Ce(e.errorMessage),Te(null)):e.aborted||(Te(UJ(e.result,e.reason??`auto`)),Je.current&&rn(Je.current));break;case`extension_ui_request`:Jt(e)}},[Pe,un,Jt,rn,hn,r,i,a,gn,mn,Ie,re,Yt,S]);let xn=(0,d.useRef)(Jt);xn.current=Jt,(0,d.useEffect)(()=>(He.current?.(),He.current=Ft({ch:`global`},e=>{if(e.type===`extension_ui_request`&&(Rq(`ui-chain`,`4a ws recv ${e.method}`,`id=${String(e.id).slice(0,8)} evtSid=${String(e.sessionId).slice(0,8)} activeSid=${Je.current?.slice(0,8)??`null`}`),e.sessionId&&e.sessionId!==Je.current&&Bq.has(e.method??``)&&Wq(e.sessionId)),e.sessionId===Je.current){if(e.type===`extension_ui_request`){xn.current?.(e);return}tt.current?.(e)}}),()=>{He.current?.(),He.current=null}),[]);let Sn=(0,d.useCallback)(async(r,i)=>{let a=r.trim();if(!a&&!i?.length||Ye.current||$e.current)return;let o=!i?.length&&a.startsWith(`/`);if(!i?.length&&a.startsWith(`!`)){let e=a.startsWith(`!!`),t=(e?a.slice(2):a.slice(1)).trim();if(!t)return;await ot.current?.(t,e);return}Rq(`ui-chain`,`1 client send`,JSON.stringify(a.slice(0,80)));let s=pt.current+1;un(),Ze.current=!0;let c=i?.map(e=>({type:`image`,source:{type:`base64`,media_type:e.mimeType,data:e.data}})),u={role:`user`,content:c?.length?[...r.trim()?[{type:`text`,text:r}]:[],...c]:r,timestamp:Date.now()};S.append(`handleSend:optimistic`,u),mt.current=!0,pt.current=s,L(!0),Oe(o?{kind:`running_command`}:{kind:`waiting_model`}),E({type:`start`}),it.current=!0,at.current=!0;let d=i?.map(e=>({type:`image`,data:e.data,mimeType:e.mimeType})),f=null,p=!1;try{if(l&&n){let e=xt,t=Je.current??await dt.current,n=t??await cn();n&&(f=n,e&&(Ot(e),t&&await US(n,{type:`set_model`,provider:e.provider,modelId:e.modelId})),await pn(n),p=!0,sn(1,r),await US(n,{type:`prompt`,message:r,...d?.length?{images:d}:{}}))}else if(t){f=t.id,await pn(t.id),p=!0;let e=Tt;await US(t.id,{type:`prompt`,message:r,...d?.length?{images:d}:{},...e?{provider:e.provider,modelId:e.modelId}:{}})}o&&f&&vn(f,s)}catch(t){if(console.error(`Failed to send message:`,t),p&&f){t instanceof kJ||Pe({type:`error`,message:t instanceof Error?t.message:String(t)}),vn(f,s);return}Ze.current=!1,Ye.current=!1,dn(),t instanceof kJ&&(mt.current&&(mt.current=!1,S.dropLastIf(`sendError:rollbackOptimistic`,e=>e?.role===`user`)),Pe({type:`error`,message:t.message}),r&&e.chatInputRef?.current?.insertIfEmpty(r)),mt.current=!1,L(!1),Oe(null),E({type:`end`})}},[l,n,xt,t,cn,pn,sn,Tt,vn,Pe,un,dn,e.chatInputRef,Ot,S]);ot.current=(0,d.useCallback)(async(n,r)=>{if(Ye.current||$e.current)return;let i=`${r?`!!`:`!`}${n}`;se(!0),ue({command:n,excludeFromContext:r}),ce(``);try{let e=Je.current??t?.id??await cn();if(!e)throw Error(`Unable to create a session for the shell command`);await pn(e),sn(1,i),await US(e,{type:`bash`,command:n,excludeFromContext:r}),await rn(e)}catch(t){console.error(`Failed to execute shell command:`,t),Pe({type:`error`,message:t instanceof Error?t.message:String(t)}),e.chatInputRef?.current?.insertIfEmpty(i)}finally{se(!1),ue(null)}},[Pe,pn,cn,rn,e.chatInputRef,sn,t]);let Cn=(0,d.useCallback)(async()=>{let e=Je.current;if(e){if($e.current){try{await US(e,{type:`abort_bash`})}catch(e){console.error(`Failed to abort bash:`,e)}return}try{await US(e,{type:`abort`})}catch(e){console.error(`Failed to abort:`,e)}}},[]),wn=(0,d.useCallback)(async e=>{if($e.current)return;let t=Je.current;if(t){ve(e);try{let{cancelled:n,newSessionId:r}=await US(t,{type:`fork`,entryId:e})??{};!n&&r&&s?.(r)}catch(e){console.error(`Fork failed:`,e)}finally{ve(null)}}},[s]),Tn=(0,d.useCallback)(async e=>{if($e.current)return;let t=Je.current;t&&(US(t,{type:`navigate_tree`,targetId:e}).catch(()=>{}),v(e),await an(t,e))},[an]),En=(0,d.useCallback)(async e=>{if($e.current)return;v(e);let t=Je.current;t&&(await an(t,e),e&&US(t,{type:`navigate_tree`,targetId:e}).catch(()=>{}))},[an]),Dn=(0,d.useCallback)(async()=>{let e=Je.current;if(!(!e||ye)){xe(!0),Ce(null),Te(null);try{let t=await US(e,{type:`compact`});Te(UJ(t,`manual`)),await rn(e,!0)}catch(e){Ce(e instanceof Error?e.message:String(e)),Te(null)}finally{xe(!1)}}},[ye,rn]),On=(0,d.useCallback)(async e=>{if(!e.startsWith(`/`))return{handled:!1};let t=e.match(/^\/([^\s]+)(?:\s+([\s\S]*))?$/);if(!t)return{handled:!1};let[,n,r=``]=t,i=r.trim(),a=Je.current??await cn(),o=e=>(e.handled&&(e.error?Pe({type:`error`,message:e.error}):e.action!==`openSessionStats`&&Pe({type:`success`,message:e.message??Ie(`i18n.commandCompleted`)})),e);try{switch(Be(!0),n){case`compact`:{if(!a||ye)return o({handled:!0,error:Ie(`i18n.noActiveSessionToCompact`)});xe(!0),Ce(null),Te(null);let e=await US(a,{type:`compact`,...i?{customInstructions:i}:{}});return Te(UJ(e,`manual`)),await rn(a,!0)&&sn(),o({handled:!0,message:Ie(`i18n.compactedContext`)})}case`reload`:return a?(await US(a,{type:`reload`}),await be.refresh(),await Promise.all([rn(a,!1,!0),on(a),ln(),It()]),o({handled:!0,message:Ie(`i18n.reloadedSessionResources`)})):o({handled:!0,error:Ie(`i18n.noActiveSessionToReload`)});case`name`:return a?i?(await US(a,{type:`set_session_name`,name:i}),await rn(a)&&sn(),o({handled:!0,message:Ie(`i18n.sessionRenamedTo`,{name:i})})):o({handled:!0,error:Ie(`i18n.usageName`)}):o({handled:!0,error:Ie(`i18n.noActiveSessionToName`)});case`session`:{if(!a)return o({handled:!0,error:Ie(`i18n.noActiveSession`)});let e=await US(a,{type:`get_session_stats`});return e&&nn(e),o({handled:!0,action:`openSessionStats`})}case`copy`:{if(!a)return o({handled:!0,error:Ie(`i18n.noActiveSession`)});let e=(await US(a,{type:`get_last_assistant_text`}))?.text??``;return e?(await navigator.clipboard.writeText(e),o({handled:!0,message:Ie(`i18n.copiedLastAssistantMessage`)})):o({handled:!0,error:Ie(`i18n.noAssistantMessageToCopy`)})}default:return{handled:!1}}}catch(e){return o({handled:!0,error:e instanceof Error?e.message:String(e)})}finally{Be(!1),n===`compact`&&xe(!1)}},[Pe,cn,ye,It,rn,ln,on,sn,nn,Ie]),kn=(0,d.useCallback)(async(e,t,n)=>{let r=Je.current;if(!r)return;let i=t?.map(e=>({type:`image`,data:e.data,mimeType:e.mimeType}));try{await US(r,{...e,...i?.length?{images:i}:{}})}catch(e){console.error(`Failed to ${n}:`,e),Pe({type:`error`,message:e instanceof Error?e.message:String(e)})}},[Pe]),An=(0,d.useCallback)((e,t)=>kn({type:`steer`,message:e},t,`steer`),[kn]),jn=(0,d.useCallback)((e,t,n)=>kn({type:`prompt`,message:e,streamingBehavior:t},n,`queue prompt`),[kn]),Mn=(0,d.useCallback)((e,t)=>kn({type:`follow_up`,message:e},t,`follow up`),[kn]),Nn=(0,d.useCallback)(async()=>{let e=Je.current;if(e)try{await US(e,{type:`abort_compaction`})}catch(e){console.error(`Failed to abort compaction:`,e)}},[]),Pn=(0,d.useCallback)(async()=>{let t=Je.current;if(t)try{let n=await US(t,{type:`clear_queue`});Re({steering:[],followUp:[]});let r=[...n?.steering??[],...n?.followUp??[]];r.length>0&&e.chatInputRef?.current?.prependText(r.join(`
351
+ `))}}catch{}e(n)}return{apply:(e,n)=>t(e,n),append:(e,n)=>t(`${e}:append`,e=>[...e,n]),replaceAll(e,n){t(`${e}:replaceAll`,n)},truncateFrom:(e,n)=>t(`${e}:truncateFrom`,e=>e.slice(0,Math.max(0,n))),dropLastIf:(e,n)=>t(`${e}:dropLastIf`,e=>n(e[e.length-1])?e.slice(0,-1):e)}}function HJ(e){let t=e.content;return JSON.stringify(typeof t==`string`?{text:t,images:[]}:Array.isArray(t)?{text:zJ(e),images:t.map(BJ).filter(Boolean)}:{text:``,images:[]})}function UJ(e,t){if(!e||typeof e!=`object`)return null;let n=e;return typeof n.tokensBefore!=`number`||typeof n.estimatedTokensAfter!=`number`?null:{reason:t,tokensBefore:n.tokensBefore,estimatedTokensAfter:n.estimatedTokensAfter}}function WJ(e,t,n,r){let i=new Set(t),a=new Set(e.filter(e=>e.role===`user`).map(HJ)),o=[...e];for(let e=0;e<n.length;e++){let t=r[e];if(t!==void 0)i.has(t)||o.push(n[e]);else{let t=n[e];(t.role!==`user`||!a.has(HJ(t)))&&o.push(t)}}return o}function GJ(e){let{session:t,newSessionCwd:n,onAgentEnd:r,onAgentSettled:i,onAgentError:a,onSessionCreated:o,onSessionForked:s,modelsRefreshKey:c}=e,l=t===null&&n!==null,[u,f]=(0,d.useState)(null),[p,m]=(0,d.useState)(!l),[h,g]=(0,d.useState)(null),[_,v]=(0,d.useState)(null),[y,b]=(0,d.useState)([]),x=(0,d.useRef)(null);x.current||=VJ(b);let S=x.current,[C,w]=(0,d.useState)([]),[T,E]=(0,d.useReducer)(uJ,{isStreaming:!1,streamingMessage:null}),D=(0,d.useRef)(null),O=(0,d.useRef)(null),k=(0,d.useRef)(null),A=(0,d.useRef)(new Map),j=(0,d.useRef)(rJ()),M=(0,d.useRef)(!0),P=(0,d.useRef)([]),ee=(0,d.useRef)(new Map),F=(0,d.useRef)(null),te=(0,d.useRef)(null),ne=(0,d.useCallback)(()=>{let e=A.current;if(e.size===0)return;let t=k.current;if(!t){e.clear();return}let n=t.content;if(!Array.isArray(n)){e.clear();return}for(let[t,r]of e){let e=r.join(``),i=n[t];if(!i)continue;let a=j.current.take(t,e);a&&(i.type===`thinking`?i.thinking=(i.thinking??``)+a:i.type===`text`?i.text=(i.text??``)+a:i.type===`toolCall`&&(i.streamingOutput=(i.streamingOutput??``)+a))}e.clear()},[]),re=(0,d.useCallback)(()=>{O.current&&=(clearTimeout(O.current),null),ne();let e=D.current;if(D.current=null,e&&Ye.current){let t=e,n={...e,content:[...t.content??[]]};(0,d.startTransition)(()=>E({type:`update`,message:n}))}else if(k.current&&Ye.current){let e=k.current,t={...e,content:[...e.content??[]]};(0,d.startTransition)(()=>E({type:`update`,message:t}))}},[ne]);(0,d.useEffect)(()=>()=>{O.current&&=(clearTimeout(O.current),null),F.current&&=(clearTimeout(F.current),null),te.current&&=(clearTimeout(te.current),null)},[]);let[ie,ae]=(0,d.useState)(!1),[oe,I]=(0,d.useState)(!1),L=(0,d.useCallback)(e=>{Ye.current=e,ae(e)},[]),se=(0,d.useCallback)(e=>{$e.current=e,I(e)},[]),[R,ce]=(0,d.useState)(``),[le,ue]=(0,d.useState)(null),[de,fe]=(0,d.useState)(null),[pe,me]=(0,d.useState)(null),[he,ge]=(0,d.useState)(null),[_e,ve]=(0,d.useState)(null),[ye,xe]=(0,d.useState)(!1),[Se,Ce]=(0,d.useState)(null),[we,Te]=(0,d.useState)(null),[De,Oe]=(0,d.useState)(null),[ke,Ae]=(0,d.useState)([]),[je,Me]=(0,d.useState)(!1),{noticeState:Ne,addNotice:Pe,dismissModal:Fe}=FJ(),{t:Ie}=N(),[Le,Re]=(0,d.useState)({steering:[],followUp:[]}),[ze,Be]=(0,d.useState)(!1),Ve=(0,d.useRef)(null),He=(0,d.useRef)(null),Ue=(0,d.useRef)(null),We=(0,d.useRef)(null),Ge=(0,d.useRef)(null),Ke=(0,d.useRef)(0),qe=(0,d.useRef)(!1),Je=(0,d.useRef)(t?.id??null),Ye=(0,d.useRef)(!1),Xe=(0,d.useRef)(!1),Ze=(0,d.useRef)(!1),Qe=(0,d.useRef)(-1),$e=(0,d.useRef)(!1),et=(0,d.useRef)(0),tt=(0,d.useRef)(null),nt=(0,d.useRef)(!1),rt=(0,d.useRef)(null),it=(0,d.useRef)(!1),at=(0,d.useRef)(!0),ot=(0,d.useRef)(void 0),st=(0,d.useRef)(0),ct=(0,d.useRef)(0),lt=(0,d.useRef)(null),ut=(0,d.useRef)(null),dt=(0,d.useRef)(null),ft=(0,d.useRef)(!1),pt=(0,d.useRef)(0),mt=(0,d.useRef)(!1),{modelNames:ht,modelList:gt,modelError:_t,modelScopeWarnings:vt,modelThinkingLevels:yt,modelThinkingLevelMaps:bt,newSessionModel:xt,newSessionDefaultModel:St,toolPreset:Ct,thinkingLevel:wt,currentModelOverride:Tt,pendingModel:Et,setThinkingLevel:Dt,setPendingModel:Ot,setNewSessionDefaultModel:kt,setCurrentModelOverride:At,setModelError:jt,setToolPresetState:Mt,newSessionModelOverrideRef:Nt,thinkingLevelOverrideRef:Pt,loadModels:It,handleModelChange:Lt,handleThinkingLevelChange:Rt,handleToolPresetChange:zt}=LJ({isNew:l,sessionIdRef:Je,ensuringNewSessionRef:dt,setToolPresetOverride:e.setToolPreset}),{extensionDialog:Bt,extensionCustomUi:Vt,extensionStatuses:Ht,extensionWidgets:Ut,setExtensionStatuses:Wt,setExtensionWidgets:Gt,respondToExtensionUi:Kt,sendExtensionCustomInput:qt,handleExtensionUiRequest:Jt}=RJ({addNotice:Pe,chatInputRef:e.chatInputRef,sessionIdRef:Je}),Yt=(0,d.useCallback)(e=>{e?.contextUsage!==void 0&&me(e.contextUsage??null),e?.systemPrompt!==void 0&&ge(e.systemPrompt??null),e?.thinkingLevel!==void 0&&Dt(e.thinkingLevel??`auto`),e?.extensionStatuses!==void 0&&Wt(e.extensionStatuses??[]),e?.extensionWidgets!==void 0&&Gt(e.extensionWidgets??[]),e?.queuedMessages!==void 0&&Re(fJ(e.queuedMessages))},[Dt,Wt,Gt]),Xt=Tt??u?.context.model??Et??null,Zt=l?xt??St:Xt,Qt=(0,d.useSyncExternalStore)(Ee.subscribe,()=>Ee.get()??null,()=>null);(0,d.useEffect)(()=>{Ee.load().catch(()=>{})},[]);let $t=(0,d.useRef)(null),en=(0,d.useRef)(null);(0,d.useEffect)(()=>{if(!Zt||!Qt||Object.keys(yt).length===0)return;let e=Yq(Qt,Zt.provider,Zt.modelId),t=`${Zt.provider}/${Zt.modelId}`,n=en.current!==null&&en.current!==t;if(en.current=t,$t.current&&$t.current.key!==t&&($t.current=null),!e){n&&!$t.current&&wt!==`auto`&&(Dt(`auto`),l&&!Je.current&&(Pt.current=null));return}if($t.current)return;let r=yt[t],i=!r||r.includes(e),a;if(i)a=e;else if(e===`auto`||!r||r.length===0)a=`auto`;else{a=xi(e,r);let t=Ee.get()??{},n=Zq(t,Zt.provider,Zt.modelId,a);JSON.stringify(n)!==JSON.stringify(t)&&Ee.load().catch(()=>{}).then(async()=>{try{await fetch(`/api/model-thinking`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify(n)}),await Ee.refresh()}catch{}})}if(a!==wt&&(Dt(a),l&&!Je.current&&(Pt.current=a===`auto`?null:a),a!==`auto`&&Je.current)){let e=Je.current;US(e,{type:`set_thinking_level`,level:a}).catch(()=>{})}},[Zt?.provider,Zt?.modelId,Qt,yt,wt,l]);let tn=(0,d.useCallback)(async e=>{if(Zt&&($t.current={key:`${Zt.provider}/${Zt.modelId}`,level:e}),await Rt(e),!Zt)return;try{await Ee.load()}catch{}let t=Ee.get()??{},n=Zq(t,Zt.provider,Zt.modelId,e);if(JSON.stringify(n)!==JSON.stringify(t))try{await fetch(`/api/model-thinking`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify(n)}),await Ee.refresh()}catch{}},[Rt,Zt]),{sessionStats:nn,setSessionStatsOverride:rn}=IJ({messages:y,contextUsage:pe,data:u,session:t,sessionIdRef:Je}),an=(0,d.useCallback)(async(e,t=!1,n=!1)=>{let r=!1;try{t&&m(!0);let i=new URLSearchParams({deferMedia:`1`}),a=await fetch(`/api/sessions/${encodeURIComponent(e)}?${i}`);if(a.status===404)return t&&(f(null),v(null),S.apply(`loadSession:notFound`,[]),g(null)),null;if(!a.ok)throw Error(`HTTP ${a.status}`);let o=await a.json();if(Je.current!==e)return null;if(f(o),v(o.leafId),mt.current){let e=o.context.entryIds??[];S.apply(`loadSession:keepOptimistic`,t=>WJ(o.context.messages,e,t,C)),w(e)}else S.replaceAll(`loadSession`,o.context.messages),w(o.context.entryIds??[]);if(At(null),g(null),o.context.thinkingLevel&&o.context.thinkingLevel!==`off`&&Dt(o.context.thinkingLevel),r=!0,t&&m(!1),!n)return null;try{let t=await fetch(`/api/sessions/${encodeURIComponent(e)}/state`);if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();if(Je.current!==e)return null;let r=n.state;return r?Yt(r):n.running||Re({steering:[],followUp:[]}),n}catch(e){return console.error(`Failed to load agent state:`,e),null}}catch(e){return g(String(e)),null}finally{t&&!r&&m(!1)}},[Yt,Dt,At,S,C]),on=(0,d.useCallback)(async(e,t,n=!1)=>{try{let r=new URLSearchParams({deferMedia:`1`});t&&r.set(`leafId`,t);let i=`/api/sessions/${encodeURIComponent(e)}/context?${r}`,a=await fetch(i);if(!a.ok)throw Error(`HTTP ${a.status}`);let o=await a.json(),s=o.context.entryIds??[];S.apply(`loadContext merge=${n}`,e=>n?WJ(o.context.messages,s,e,C):o.context.messages),w(s)}catch(e){console.error(`Failed to load context:`,e)}},[C,S]),sn=(0,d.useCallback)(async e=>{try{let t=await US(e,{type:`get_tools`});t&&Mt(cJ(t))}catch(e){console.error(`Failed to load tools:`,e)}},[Mt]),cn=(0,d.useCallback)((e=0,t=`(no messages)`)=>{let r=Je.current;!l||!n||!r||ft.current||(ft.current=!0,o?.({id:r,path:``,cwd:n,name:void 0,created:new Date().toISOString(),modified:new Date().toISOString(),messageCount:e,firstMessage:t}))},[l,n,o]),ln=(0,d.useCallback)(async()=>{if(Je.current||!l||!n)return Je.current;if(dt.current)return dt.current;let e=(async()=>{let e=Nt.current,t=Pt.current;e&&Ot(e);let r=lJ(Ct),i=await fetch(`/api/agent/new`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:n,type:`ensure_session`,toolNames:r,...e?{provider:e.provider,modelId:e.modelId}:{},...t?{thinkingLevel:t}:{}})});if(!i.ok)throw Error(`HTTP ${i.status}`);let a=await i.json(),o=a.sessionId;return Je.current=o,a.model&&Nt.current===e&&(Ot(a.model),e||kt(a.model)),a.thinkingLevel&&Pt.current===t&&Dt(a.thinkingLevel),o})();dt.current=e;try{return await e}finally{dt.current=null}},[l,n,Ct,Pt,Nt,Ot,Dt,kt]),un=(0,d.useCallback)(async()=>{let e=Je.current??await ln();if(!e)return Ae([]),[];Me(!0);try{let t=(await US(e,{type:`get_commands`}))?.commands??[];return Ae(t),t}catch(e){return console.error(`Failed to load slash commands:`,e),Ae([]),[]}finally{Me(!1)}},[ln]),dn=(0,d.useCallback)(()=>{Ke.current+=1,qe.current=!1,Ge.current&&=(clearTimeout(Ge.current),null)},[]),fn=(0,d.useCallback)(()=>{Ve.current?.(),Ve.current=null,Ue.current=null,We.current=null},[]),pn=(0,d.useCallback)(e=>{fn();let t=`agent:${e}`,n=!1,r=null,i,a={key:t,promise:null,pending:!0},o=e=>{n||(n=!0,r&&clearTimeout(r),We.current===a&&(a.pending=!1),i({status:e}))};r=setTimeout(()=>o(`timeout`),wJ);let s=new Promise(e=>{i=e});return a.promise=s,Ve.current=Ft({ch:`agent`,sessionId:e},e=>{e.type===`connected`?o(`connected`):(e.type===`not_found`||e.type===`start_failed`)&&o(`closed`)}),Ue.current=e,We.current=a,s},[fn]),mn=(0,d.useCallback)(async e=>{if(Ue.current===e&&Ve.current){let e=We.current;if(e?.pending){let t=await e.promise;if(t.status===`connected`)return;throw fn(),new kJ(t.status)}return}let t=await pn(e);if(t.status!==`connected`)throw fn(),new kJ(t.status)},[fn,pn]),hn=(0,d.useCallback)(()=>{let e=Ye.current;return Ye.current=!1,ae(!1),Oe(null),fe(null),E({type:`end`}),e},[]),gn=(0,d.useCallback)(e=>Qe.current!==e&&(Qe.current=e,r?.(),!0),[r]),_n=(0,d.useCallback)(e=>{dn(),qe.current=!0;let t=Ke.current,n=async()=>{if(!(t!==Ke.current||Je.current!==e||!qe.current))try{let r=await fetch(`/api/agent/${encodeURIComponent(e)}`);if(!r.ok)throw Error(`HTTP ${r.status}`);let i=await r.json();if(t!==Ke.current||Je.current!==e||!qe.current)return;let a=i.state;if(i.running&&a&&(a.isStreaming||a.isPromptRunning)){qe.current=!1,Ge.current=null,Xe.current=!!a?.isStreaming,Ze.current=!!a?.isPromptRunning,L(!0),Oe(a?.isStreaming?{kind:`waiting_model`}:{kind:`running_command`});return}if(i.running&&a?.isCompacting){xe(!0),Ge.current=setTimeout(()=>void n(),_J);return}qe.current=!1,Ge.current=null,fn()}catch{if(t!==Ke.current||Je.current!==e||!qe.current)return;Ge.current=setTimeout(()=>void n(),_J)}};Ge.current=setTimeout(()=>void n(),yJ)},[dn,fn]),vn=(0,d.useCallback)(async(e=Je.current,t=pt.current)=>{if(pt.current===t)try{e&&await an(e)}catch(e){if(pt.current!==t)return;throw e}finally{if(pt.current===t){let n=Ze.current,a=Xe.current;Ze.current=!1,Xe.current=!1,mt.current=!1;let o=hn();n?(gn(t),o&&i?.()):a&&o&&(r?.(),i?.()),e&&_n(e)}}},[an,gn,r,i,_n,hn]),yn=(0,d.useCallback)(async(e,t)=>{await jJ(gJ);let n=Date.now();for(;Ye.current&&Date.now()-n<vJ;){if(t!==void 0&&pt.current!==t)return;try{let n=await fetch(`/api/agent/${encodeURIComponent(e)}`);if(n.ok){let r=await n.json(),i=r.state;if(!r.running||!i||!i.isStreaming&&!i.isPromptRunning){await vn(e,t);return}}}catch{}await jJ(_J)}},[vn]),bn=(0,d.useCallback)(async e=>{let t=et.current+1;for(et.current=t;$e.current&&et.current===t&&Je.current===e;){await jJ(CJ);try{let n=await fetch(`/api/agent/${encodeURIComponent(e)}`);if(!n.ok||(await n.json()).state?.isBashRunning)continue;if(await an(e),et.current!==t||Je.current!==e)return;se(!1),ue(null);return}catch{}}},[an]),xn=(0,d.useCallback)(async e=>{if(!Ye.current)return;let t=pt.current;try{let n=await fetch(`/api/agent/${encodeURIComponent(e)}`);if(!n.ok)return;let r=await n.json();if(pt.current!==t)return;let i=r.state;if(xe(i?.isCompacting??!1),Re(fJ(i?.queuedMessages)),r.running&&i&&(i.isStreaming||i.isPromptRunning||i.isCompacting)||!Ye.current)return;i&&Yt(i),await vn(e,t)}catch{}},[Yt,vn]);(0,d.useEffect)(()=>{if(!ie)return;let e=()=>{let e=Je.current;e&&xn(e)},t=()=>{document.visibilityState===`visible`&&e()},n=setInterval(e,SJ);return document.addEventListener(`visibilitychange`,t),window.addEventListener(`online`,e),()=>{clearInterval(n),document.removeEventListener(`visibilitychange`,t),window.removeEventListener(`online`,e)}},[ie,xn]),(0,d.useEffect)(()=>{Ye.current=ie},[ie]),tt.current=(0,d.useCallback)(e=>{let t=e=>{let t=e.assistantMessageEvent;if(!t||typeof t.type!=`string`)return;let n=k.current;if(!n)return;let r=t.contentIndex;if(typeof r!=`number`)return;let i=n.content;if(Array.isArray(i))switch(t.type){case`thinking_start`:{if(i[r]?.type===`thinking`)break;let e={type:`thinking`,thinking:``};r>=i.length?i.push(e):i.splice(r,0,e),M.current=!0;break}case`thinking_delta`:if(i[r]?.type===`thinking`&&typeof t.delta==`string`){let e=A.current,n=e.get(r)??[];n.push(t.delta),e.set(r,n)}break;case`thinking_end`:{let e=A.current;if(e.has(r)){let t=e.get(r);e.delete(r);let n=t.join(``),a=j.current.take(r,n),o=i[r];o?.type===`thinking`&&a&&(o.thinking=(o.thinking??``)+a)}let n=i[r];if(n?.type===`thinking`&&typeof t.content==`string`&&(n.thinking=t.content),n?.type===`thinking`){let e=t.thinkingSignature??t.signature;typeof e==`string`&&e.length>0?n.thinkingSignature=e:e&&typeof e==`object`&&(n.thinkingSignature=JSON.stringify(e)),t.redacted===!0&&(n.redacted=!0);let i=t.partial?.content?.[r];i&&typeof i.thinkingSignature==`string`&&!n.thinkingSignature&&(n.thinkingSignature=i.thinkingSignature),i&&i.redacted===!0&&(n.redacted=!0)}break}case`text_start`:{if(i[r]?.type===`text`)break;let e={type:`text`,text:``};r>=i.length?i.push(e):i.splice(r,0,e),M.current=!0;break}case`text_delta`:if(i[r]?.type===`text`&&typeof t.delta==`string`){let e=A.current,n=e.get(r)??[];n.push(t.delta),e.set(r,n)}break;case`text_end`:{let e=A.current;if(e.has(r)){let t=e.get(r);e.delete(r);let n=t.join(``),a=j.current.take(r,n),o=i[r];o?.type===`text`&&a&&(o.text=(o.text??``)+a)}let n=i[r];n?.type===`text`&&typeof t.content==`string`&&(n.text=t.content);break}case`toolcall_start`:break;case`toolcall_delta`:if(i[r]?.type===`toolCall`&&typeof t.delta==`string`){let e=A.current,n=e.get(r)??[];n.push(t.delta),e.set(r,n)}break;case`toolcall_end`:{let e=A.current;e.has(r)&&e.delete(r),t.toolCall&&typeof t.toolCall==`object`&&(i[r]={type:`toolCall`,...t.toolCall});break}}},n=()=>{if(O.current)return;let e=M.current?xJ:bJ;O.current=setTimeout(()=>{O.current=null,ne();let e=k.current??D.current;if(D.current=null,!e||!Ye.current)return;let t=e.content;if(!(Array.isArray(t)&&t.some(e=>{let t=e.type;return t===`thinking`?!!((e.thinking?.trim()??``)!==``||typeof e.thinkingSignature==`string`&&e.thinkingSignature.length>0||e.redacted):t!==`text`||(e.text?.trim()??``)!==``})))return;M.current=!1;let n={...e,content:[...t??[]]};(0,d.startTransition)(()=>E({type:`update`,message:n}))},e)},o=()=>{if(!Ye.current)return;let r=e.message;if(r&&r.role!==`user`){A.current.clear();let e=tJ(r);j.current.snapshot(e.content),k.current=e,D.current=e,M.current=!0,n()}else k.current&&(t(e),n())};switch(e.type){case`agent_start`:A.current.clear(),k.current=null,D.current=null,M.current=!0,j.current.reset(),dn(),Xe.current=!0,L(!0),Oe({kind:`waiting_model`}),fe(null),E({type:`start`});break;case`agent_end`:if(!Ye.current)break;if(Oe(null),fe(null),E({type:`end`}),k.current=null,D.current=null,A.current.clear(),j.current.reset(),O.current&&=(clearTimeout(O.current),null),F.current&&=(clearTimeout(F.current),null),P.current.length){let e=P.current.join(``);P.current=[],e&&ce(t=>t+e)}if(te.current&&=(clearTimeout(te.current),null),ee.current.size){let e=new Map(ee.current);ee.current.clear(),S.apply(`tool_execution_update:batched:drain`,t=>t.map(t=>{if(!(`content`in t)||!Array.isArray(t.content))return t;let n=!1,r=t.content.map(t=>{if(t.type===`toolCall`){let r=e.get(t.toolCallId??``);if(r!==void 0)return n=!0,{...t,streamingOutput:r}}return t});return n?{...t,content:r}:t}))}Je.current&&(an(Je.current),fetch(`/api/agent/${encodeURIComponent(Je.current)}`).then(e=>e.json()).then(e=>{e.state&&Yt(e.state),Re(fJ(e.state?.queuedMessages))}).catch(()=>{}));break;case`agent_settled`:{let e=Xe.current;if(Xe.current=!1,!e||Ze.current)break;let t=Je.current,n=hn();xe(!1),t&&(an(t),_n(t)),k.current=null,D.current=null,A.current.clear(),O.current&&=(clearTimeout(O.current),null),n&&(r?.(),i?.());break}case`prompt_done`:{let e=pt.current,t=Ze.current;Ze.current=!1,mt.current=!1;let n=gn(e);if(!t&&!n)break;let a=Je.current;if(a&&an(a),!Xe.current){let e=hn();a&&_n(a),e&&(r?.(),i?.())}}break;case`prompt_error`:Pe({type:`error`,message:e.errorMessage??Ie(`i18n.commandFailed`)}),a?.(e.errorMessage??Ie(`i18n.commandFailed`));break;case`extension_error`:Pe({type:`error`,message:e.error??Ie(`i18n.extensionCommandFailed`)}),a?.(e.error??Ie(`i18n.extensionCommandFailed`));break;case`message_start`:o();break;case`message_update`:o(),e.assistantMessageEvent?.type?.startsWith(`thinking`)?Oe({kind:`thinking`}):Oe(null);break;case`message_end`:{if(!Ye.current)break;re();let t=e.message;if(t&&t.role===`user`){let e=eJ(t),n=HJ(e),r=mt.current;mt.current=!1,S.apply(`message_end:userEcho`,t=>{let i=t[t.length-1];return i?.role===`user`&&HJ(i)===n?t:r&&i?.role===`user`?[...t.slice(0,-1),e]:[...t,e]})}else t&&S.append(`message_end:assistant`,eJ(t));E({type:`reset`}),k.current=null,D.current=null,A.current.clear(),O.current&&=(clearTimeout(O.current),null),Oe({kind:`waiting_model`});break}case`tool_execution_start`:{let t=e.toolCallId,n=e.toolName;Oe(e=>{let r=e?.kind===`running_tools`?[...e.tools]:[];return r.some(e=>e.id===t)||r.push({id:t,name:n}),{kind:`running_tools`,tools:r}});break}case`tool_execution_update`:{let t=e.toolCallId,n=dJ(e.partialResult);if(n===void 0)break;ee.current.set(t,n),te.current||=setTimeout(()=>{te.current=null;let e=new Map(ee.current);ee.current.clear(),e.size!==0&&(0,d.startTransition)(()=>{S.apply(`tool_execution_update:batched`,t=>t.map(t=>{if(!(`content`in t)||!Array.isArray(t.content))return t;let n=!1,r=t.content.map(t=>{if(t.type===`toolCall`){let r=e.get(t.toolCallId??``);if(r!==void 0)return n=!0,{...t,streamingOutput:r}}return t});return n?{...t,content:r}:t}))})},bJ);break}case`tool_execution_end`:{let t=e.toolCallId;Oe(e=>{if(e?.kind!==`running_tools`)return e;let n=e.tools.filter(e=>e.id!==t);return n.length===0?{kind:`waiting_model`}:{kind:`running_tools`,tools:n}});break}case`bash_execution_update`:{let t=e.delta;if(!t)break;P.current.push(t),F.current||=setTimeout(()=>{F.current=null;let e=P.current;if(P.current=[],e.length===0)return;let t=e.join(``);t&&(0,d.startTransition)(()=>ce(e=>e+t))},bJ);break}case`queue_update`:Re({steering:[...e.steering??[]],followUp:[...e.followUp??[]]});break;case`auto_retry_start`:fe({attempt:e.attempt,maxAttempts:e.maxAttempts,errorMessage:e.errorMessage});break;case`auto_retry_end`:fe(null);break;case`auto_compaction_start`:case`compaction_start`:xe(!0),Ce(null),Te(null);break;case`auto_compaction_end`:case`compaction_end`:xe(!1),e.errorMessage?(Ce(e.errorMessage),Te(null)):e.aborted||(Te(UJ(e.result,e.reason??`auto`)),Je.current&&an(Je.current));break;case`extension_ui_request`:Jt(e)}},[Pe,dn,Jt,an,gn,r,i,a,_n,hn,Ie,re,Yt,S]);let Sn=(0,d.useRef)(Jt);Sn.current=Jt,(0,d.useEffect)(()=>(He.current?.(),He.current=Ft({ch:`global`},e=>{if(e.type===`extension_ui_request`&&(Rq(`ui-chain`,`4a ws recv ${e.method}`,`id=${String(e.id).slice(0,8)} evtSid=${String(e.sessionId).slice(0,8)} activeSid=${Je.current?.slice(0,8)??`null`}`),e.sessionId&&e.sessionId!==Je.current&&Bq.has(e.method??``)&&Wq(e.sessionId)),e.sessionId===Je.current){if(e.type===`extension_ui_request`){Sn.current?.(e);return}tt.current?.(e)}}),()=>{He.current?.(),He.current=null}),[]);let Cn=(0,d.useCallback)(async(r,i)=>{let a=r.trim();if(!a&&!i?.length||Ye.current||$e.current)return;let o=!i?.length&&a.startsWith(`/`);if(!i?.length&&a.startsWith(`!`)){let e=a.startsWith(`!!`),t=(e?a.slice(2):a.slice(1)).trim();if(!t)return;await ot.current?.(t,e);return}Rq(`ui-chain`,`1 client send`,JSON.stringify(a.slice(0,80)));let s=pt.current+1;dn(),Ze.current=!0;let c=i?.map(e=>({type:`image`,source:{type:`base64`,media_type:e.mimeType,data:e.data}})),u={role:`user`,content:c?.length?[...r.trim()?[{type:`text`,text:r}]:[],...c]:r,timestamp:Date.now()};S.append(`handleSend:optimistic`,u),mt.current=!0,pt.current=s,L(!0),Oe(o?{kind:`running_command`}:{kind:`waiting_model`}),E({type:`start`}),it.current=!0,at.current=!0;let d=i?.map(e=>({type:`image`,data:e.data,mimeType:e.mimeType})),f=null,p=!1;try{if(l&&n){let e=xt,t=Je.current??await dt.current,n=t??await ln();n&&(f=n,e&&(Ot(e),t&&await US(n,{type:`set_model`,provider:e.provider,modelId:e.modelId})),await mn(n),p=!0,cn(1,r),await US(n,{type:`prompt`,message:r,...d?.length?{images:d}:{}}))}else if(t){f=t.id,await mn(t.id),p=!0;let e=Tt;await US(t.id,{type:`prompt`,message:r,...d?.length?{images:d}:{},...e?{provider:e.provider,modelId:e.modelId}:{}})}o&&f&&yn(f,s)}catch(t){if(console.error(`Failed to send message:`,t),p&&f){t instanceof kJ||Pe({type:`error`,message:t instanceof Error?t.message:String(t)}),yn(f,s);return}Ze.current=!1,Ye.current=!1,fn(),t instanceof kJ&&(mt.current&&(mt.current=!1,S.dropLastIf(`sendError:rollbackOptimistic`,e=>e?.role===`user`)),Pe({type:`error`,message:t.message}),r&&e.chatInputRef?.current?.insertIfEmpty(r)),mt.current=!1,L(!1),Oe(null),E({type:`end`})}},[l,n,xt,t,ln,mn,cn,Tt,yn,Pe,dn,fn,e.chatInputRef,Ot,S]);ot.current=(0,d.useCallback)(async(n,r)=>{if(Ye.current||$e.current)return;let i=`${r?`!!`:`!`}${n}`;se(!0),ue({command:n,excludeFromContext:r}),ce(``);try{let e=Je.current??t?.id??await ln();if(!e)throw Error(`Unable to create a session for the shell command`);await mn(e),cn(1,i),await US(e,{type:`bash`,command:n,excludeFromContext:r}),await an(e)}catch(t){console.error(`Failed to execute shell command:`,t),Pe({type:`error`,message:t instanceof Error?t.message:String(t)}),e.chatInputRef?.current?.insertIfEmpty(i)}finally{se(!1),ue(null)}},[Pe,mn,ln,an,e.chatInputRef,cn,t]);let wn=(0,d.useCallback)(async()=>{let e=Je.current;if(e){if($e.current){try{await US(e,{type:`abort_bash`})}catch(e){console.error(`Failed to abort bash:`,e)}return}try{await US(e,{type:`abort`})}catch(e){console.error(`Failed to abort:`,e)}}},[]),Tn=(0,d.useCallback)(async e=>{if($e.current)return;let t=Je.current;if(t){ve(e);try{let{cancelled:n,newSessionId:r}=await US(t,{type:`fork`,entryId:e})??{};!n&&r&&s?.(r)}catch(e){console.error(`Fork failed:`,e)}finally{ve(null)}}},[s]),En=(0,d.useCallback)(async e=>{if($e.current)return;let t=Je.current;t&&(US(t,{type:`navigate_tree`,targetId:e}).catch(()=>{}),v(e),await on(t,e))},[on]),Dn=(0,d.useCallback)(async e=>{if($e.current)return;v(e);let t=Je.current;t&&(await on(t,e),e&&US(t,{type:`navigate_tree`,targetId:e}).catch(()=>{}))},[on]),On=(0,d.useCallback)(async()=>{let e=Je.current;if(!(!e||ye)){xe(!0),Ce(null),Te(null);try{let t=await US(e,{type:`compact`});Te(UJ(t,`manual`)),await an(e,!0)}catch(e){Ce(e instanceof Error?e.message:String(e)),Te(null)}finally{xe(!1)}}},[ye,an]),kn=(0,d.useCallback)(async e=>{if(!e.startsWith(`/`))return{handled:!1};let t=e.match(/^\/([^\s]+)(?:\s+([\s\S]*))?$/);if(!t)return{handled:!1};let[,n,r=``]=t,i=r.trim(),a=Je.current??await ln(),o=e=>(e.handled&&(e.error?Pe({type:`error`,message:e.error}):e.action!==`openSessionStats`&&Pe({type:`success`,message:e.message??Ie(`i18n.commandCompleted`)})),e);try{switch(Be(!0),n){case`compact`:{if(!a||ye)return o({handled:!0,error:Ie(`i18n.noActiveSessionToCompact`)});xe(!0),Ce(null),Te(null);let e=await US(a,{type:`compact`,...i?{customInstructions:i}:{}});return Te(UJ(e,`manual`)),await an(a,!0)&&cn(),o({handled:!0,message:Ie(`i18n.compactedContext`)})}case`reload`:return a?(await US(a,{type:`reload`}),await be.refresh(),await Promise.all([an(a,!1,!0),sn(a),un(),It()]),o({handled:!0,message:Ie(`i18n.reloadedSessionResources`)})):o({handled:!0,error:Ie(`i18n.noActiveSessionToReload`)});case`name`:return a?i?(await US(a,{type:`set_session_name`,name:i}),await an(a)&&cn(),o({handled:!0,message:Ie(`i18n.sessionRenamedTo`,{name:i})})):o({handled:!0,error:Ie(`i18n.usageName`)}):o({handled:!0,error:Ie(`i18n.noActiveSessionToName`)});case`session`:{if(!a)return o({handled:!0,error:Ie(`i18n.noActiveSession`)});let e=await US(a,{type:`get_session_stats`});return e&&rn(e),o({handled:!0,action:`openSessionStats`})}case`copy`:{if(!a)return o({handled:!0,error:Ie(`i18n.noActiveSession`)});let e=(await US(a,{type:`get_last_assistant_text`}))?.text??``;return e?(await navigator.clipboard.writeText(e),o({handled:!0,message:Ie(`i18n.copiedLastAssistantMessage`)})):o({handled:!0,error:Ie(`i18n.noAssistantMessageToCopy`)})}default:return{handled:!1}}}catch(e){return o({handled:!0,error:e instanceof Error?e.message:String(e)})}finally{Be(!1),n===`compact`&&xe(!1)}},[Pe,ln,ye,It,an,un,sn,cn,rn,Ie]),An=(0,d.useCallback)(async(e,t,n)=>{let r=Je.current;if(!r)return;let i=t?.map(e=>({type:`image`,data:e.data,mimeType:e.mimeType}));try{await US(r,{...e,...i?.length?{images:i}:{}})}catch(e){console.error(`Failed to ${n}:`,e),Pe({type:`error`,message:e instanceof Error?e.message:String(e)})}},[Pe]),jn=(0,d.useCallback)((e,t)=>An({type:`steer`,message:e},t,`steer`),[An]),Mn=(0,d.useCallback)((e,t,n)=>An({type:`prompt`,message:e,streamingBehavior:t},n,`queue prompt`),[An]),Nn=(0,d.useCallback)((e,t)=>An({type:`follow_up`,message:e},t,`follow up`),[An]),Pn=(0,d.useCallback)(async()=>{let e=Je.current;if(e)try{await US(e,{type:`abort_compaction`})}catch(e){console.error(`Failed to abort compaction:`,e)}},[]),Fn=(0,d.useCallback)(async()=>{let t=Je.current;if(t)try{let n=await US(t,{type:`clear_queue`});Re({steering:[],followUp:[]});let r=[...n?.steering??[],...n?.followUp??[]];r.length>0&&e.chatInputRef?.current?.prependText(r.join(`
352
352
 
353
- `))}catch(e){console.error(`Failed to recall queued messages:`,e),Pe({type:`error`,message:Ie(`i18n.failedToRecallQueuedMessages`)})}},[e.chatInputRef,Pe,Ie]),Fn=(0,d.useCallback)((e=`smooth`)=>{ct.current=Date.now()+pJ,lt.current?.scrollIntoView({behavior:e})},[]),In=(0,d.useCallback)(()=>{let e=ut.current,t=rt.current;if(!e||!t)return;let n=t.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop;ct.current=Date.now()+pJ,e.scrollTo({top:n-16,behavior:`smooth`})},[]),Ln=(0,d.useCallback)(e=>{e instanceof KeyboardEvent&&(!OJ.has(e.key)||e.target instanceof Element&&e.target.closest(`input, textarea, [contenteditable='true']`))||(st.current=Date.now()+mJ)},[]),Rn=(0,d.useCallback)(()=>{if(Date.now()<ct.current)return;let e=ut.current;if(e){if(e.scrollHeight-e.scrollTop-e.clientHeight<hJ){at.current=!0;return}Ye.current&&(Date.now()>st.current||(at.current=!1))}},[]);return(0,d.useEffect)(()=>(t?(Je.current=t.id,rn(t.id,!0,!1).then(()=>fn(t.id)).then(()=>rn(t.id,!1,!0)).then(e=>{e?.running&&(on(t.id),(e.state?.isStreaming||e.state?.isPromptRunning)&&(Xe.current=!!e.state.isStreaming,Ze.current=!!e.state.isPromptRunning,L(!0),Oe(e.state.isStreaming?{kind:`waiting_model`}:{kind:`running_command`}),E({type:`start`}),!e.state.isStreaming&&e.state.isPromptRunning&&vn(t.id)),e.state?.isBashRunning&&(se(!0),yn(t.id))),e?.state&&(e.state.isCompacting!==void 0&&xe(e.state.isCompacting),Yt(e.state))})):l&&n&&cn().then(async e=>{if(e){Je.current=e,await fn(e);try{let t=await fetch(`/api/sessions/${encodeURIComponent(e)}/state`);if(!t.ok)return;let n=await t.json();Je.current===e&&Yt(n.state)}catch{}}}),()=>{et.current+=1,un(),dn()}),[]),(0,d.useEffect)(()=>(window.addEventListener(`keydown`,Ln),window.addEventListener(`pointerdown`,Ln,{passive:!0}),()=>{window.removeEventListener(`keydown`,Ln),window.removeEventListener(`pointerdown`,Ln)}),[Ln]),(0,d.useEffect)(()=>{let e=ut.current;if(e)return e.addEventListener(`wheel`,Ln,{passive:!0}),e.addEventListener(`touchstart`,Ln,{passive:!0}),e.addEventListener(`scroll`,Rn,{passive:!0}),()=>{e.removeEventListener(`wheel`,Ln),e.removeEventListener(`touchstart`,Ln),e.removeEventListener(`scroll`,Rn)}},[y.length,p,Rn,Ln]),(0,d.useEffect)(()=>{if(y.length>0){if(it.current)it.current=!1,nt.current=!0,In();else if(!nt.current)nt.current=!0,Fn(`instant`);else if(at.current){let e=ut.current;e&&(e.scrollTop=e.scrollHeight)}}},[y.length,ie,Fn,In]),(0,d.useLayoutEffect)(()=>{if(!at.current||!T.isStreaming)return;let e=ut.current;e&&(e.scrollTop=e.scrollHeight)},[T.isStreaming,T.streamingMessage]),(0,d.useEffect)(()=>{let e=new AbortController,t=()=>It(e.signal).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||jt(e instanceof Error?e.message:String(e))});return c===0?t():be.refresh().catch(()=>{}).then(t),()=>e.abort()},[It,c,jt]),(0,d.useEffect)(()=>{if(!we)return;let e=setTimeout(()=>Te(null),6e3);return()=>clearTimeout(e)},[we]),(0,d.useEffect)(()=>{nn(null)},[y.length,pe?.tokens,pe?.percent,pe?.contextWindow,nn]),{data:u,loading:p,error:h,activeLeafId:_,tree:u?.tree??[],messages:y,entryIds:C,streamState:T,agentRunning:ie,modelNames:ht,modelList:gt,modelError:_t,modelScopeWarnings:vt,modelThinkingLevels:yt,modelThinkingLevelMaps:bt,newSessionModel:xt,toolPreset:Ct,thinkingLevel:wt,retryInfo:de,contextUsage:pe,systemPrompt:he,forkingEntryId:_e,isCompacting:ye,compactError:Se,compactResult:we,currentModel:Xt,displayModel:Zt,sessionStats:tn,slashCommands:ke,slashCommandsLoading:je,queuedMessages:Le,notices:Ne.visible,noticeModals:Ne.modals,dismissNoticeModal:Fe,extensionDialog:Bt,extensionCustomUi:Vt,extensionStatuses:Ht,extensionWidgets:Ut,respondToExtensionUi:Kt,sendExtensionCustomInput:qt,isAutoModelSelection:l&&xt===null,agentPhase:De,isNew:l,sessionIdRef:Je,loadContext:an,messagesEndRef:lt,scrollContainerRef:ut,lastUserMsgRef:rt,pendingScrollToUserRef:it,initialScrollDoneRef:nt,handleSend:Sn,handleAbort:Cn,handleFork:wn,handleNavigate:Tn,handleLeafChange:En,handleModelChange:Lt,handleCompact:Dn,handleSteer:An,handleFollowUp:Mn,handlePromptWithStreamingBehavior:jn,handleAbortCompaction:Nn,handleRecallQueue:Pn,handleBuiltinSlashCommand:On,handleToolPresetChange:zt,handleThinkingLevelChange:en,loadTools:on,loadSlashCommands:ln,setActiveLeafId:v,setData:f,setMessages:S,setSessionStatsOverride:nn,dispatch:E,setAgentRunning:ae,setForkingEntryId:ve,bashRunning:oe,bashOutput:R,pendingBash:le,commandBusy:ze,handleAgentEventRef:tt}}var KJ={background:`linear-gradient(90deg, var(--accent) 0%, var(--accent) 47%, var(--shine-highlight) 53%, var(--shine-highlight) 100%)`,backgroundSize:`200% 100%`,WebkitBackgroundClip:`text`,backgroundClip:`text`,color:`transparent`,animation:`pi-status-shine 1.5s linear infinite`},qJ={animation:`pi-status-icon-pulse 1.5s ease-in-out infinite`};function JJ(e,t){if(e?.kind===`running_tools`){let n=e.tools.map(e=>e.name);return n.length===0?t(`chat.runningTool`):n.length===1?t(`chat.runningNamedTool`,{name:n[0]}):n.length<=3?t(`chat.runningTools`,{names:n.join(`, `)}):t(`chat.runningToolsMore`,{names:n.slice(0,2).join(`, `),count:n.length-2})}return e?.kind===`thinking`?t(`chat.thinking`):e?.kind===`waiting_model`?t(`chat.waitingModel`):e?.kind===`running_command`?t(`chat.runningCommand`):e?.kind===`retrying`?t(`chat.retrying`,{attempt:e.attempt,max:e.maxAttempts}):null}function YJ(e){return e?.kind===`running_tools`?(0,E.jsx)(ti,{size:p.lg}):e?.kind===`running_command`?(0,E.jsx)(Jr,{size:p.lg}):e?.kind===`thinking`?(0,E.jsx)(Dr,{size:p.lg,fill:`currentColor`,style:{color:`var(--bulb-warning)`}}):e?.kind===`retrying`?(0,E.jsx)(Zr,{size:p.lg,style:{color:`var(--status-warning)`}}):(0,E.jsx)(Tr,{size:p.lg})}function XJ({phase:e,elapsed:t,totalElapsed:n}){let{t:r}=N(),i=JJ(e,r)??r(`chat.runningCommand`);return(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,style:{...KJ,minWidth:0,maxWidth:`100%`},children:[(0,E.jsx)(`span`,{className:`inline-flex flex-shrink-0`,style:qJ,children:YJ(e)}),(0,E.jsxs)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,minWidth:0},children:[i,t!=null&&(0,E.jsxs)(E.Fragment,{children:[` · `,t]}),n!=null&&(0,E.jsxs)(E.Fragment,{children:[` · `,r(`chat.totalElapsed`,{total:n})]})]})]})}function ZJ({msg:e,onSend:t,onFillInput:n,testId:r}){let{t:i}=N(),a=()=>{if(e.allowAppend&&n){n(`${e.message} `);return}t(e.message)},o=`${e.allowAppend?i(`config.widgets.fillToChatInputTooltip`):i(`config.widgets.sendImmediatelyTooltip`)}${e.message}`;return(0,E.jsx)(oi,{label:o,children:(0,E.jsx)(PG,{label:e.label,title:o,onClick:a,testId:r})})}function QJ({messages:e,onSend:t,onFillInput:n,testIdPrefix:r=`quick-msg`,wrapperTestId:i=`quick-message-buttons`,center:a=!1}){return e.length===0?null:(0,E.jsx)(`div`,{"data-testid":i,style:{display:`flex`,flexWrap:`wrap`,gap:6,justifyContent:a?`center`:`flex-start`,paddingTop:8,borderTop:a?`1px solid var(--border)`:void 0},children:e.map((e,i)=>(0,E.jsx)(ZJ,{msg:e,onSend:t,onFillInput:n,testId:`${r}-${i}`},i))})}function $J(e){let t=e.currentTime;[523.25,659.25].forEach((n,r)=>{let i=e.createOscillator(),a=e.createGain();i.connect(a),a.connect(e.destination),i.type=`sine`,i.frequency.value=n;let o=t+r*.18;a.gain.setValueAtTime(0,o),a.gain.linearRampToValueAtTime(.18,o+.02),a.gain.exponentialRampToValueAtTime(.001,o+.45),i.start(o),i.stop(o+.45)})}function eY(){let[e,t]=(0,d.useState)(()=>{if(typeof window>`u`)return!0;let e=localStorage.getItem(`pi-sound-enabled`);return e===null||e===`true`}),n=(0,d.useRef)(e);(0,d.useEffect)(()=>{n.current=e},[e]);let r=(0,d.useRef)(null),i=(0,d.useCallback)(()=>{if(r.current&&r.current.state!==`closed`)return r.current;try{r.current=new AudioContext}catch{return null}return r.current},[]),a=(0,d.useCallback)((e=!1)=>{if(!e&&!n.current)return;let t=i();t?.state===`suspended`&&t.resume().catch(()=>{})},[i]);return{soundEnabled:e,onSoundToggle:(0,d.useCallback)(()=>{let e=!n.current;e&&a(!0),n.current=e,localStorage.setItem(`pi-sound-enabled`,String(e)),t(e)},[a]),playDoneSound:(0,d.useCallback)(()=>{if(!n.current)return;let e=i();if(!e)return;let t=()=>{try{$J(e)}catch{}};if(e.state===`suspended`){e.resume().then(t).catch(()=>{});return}t()},[i]),unlockAudio:a,soundEnabledRef:n}}function tY(e){let[t,n]=(0,d.useState)(!1),r=(0,d.useRef)(0);return{isDragOver:t,handleDragEnter:(0,d.useCallback)(e=>{Array.from(e.dataTransfer.items).some(e=>e.type.startsWith(`image/`))&&(e.preventDefault(),r.current+=1,n(!0))},[]),handleDragOver:(0,d.useCallback)(e=>{Array.from(e.dataTransfer.items).some(e=>e.type.startsWith(`image/`))&&e.preventDefault()},[]),handleDragLeave:(0,d.useCallback)(()=>{--r.current,r.current<=0&&(r.current=0,n(!1))},[]),handleDrop:(0,d.useCallback)(t=>{t.preventDefault(),r.current=0,n(!1),e(Array.from(t.dataTransfer.files))},[e])}}var nY=/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~]|\][^\x07]*(?:\x07|\x1B\\))/g,rY=/^\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~]|\][^\x07]*(?:\x07|\x1B\\))/,iY=/\x1B\[([0-9;]*)m/g,aY=/\x1B_pi:c\x07/g,oY=[`#1f2937`,`#dc2626`,`#16a34a`,`#d97706`,`#2563eb`,`#9333ea`,`#0891b2`,`#6b7280`],sY=[`#9ca3af`,`#ef4444`,`#22c55e`,`#f59e0b`,`#3b82f6`,`#a855f7`,`#06b6d4`,`#e5e7eb`];function cY(e){return e.replace(aY,``).replace(nY,``)}function lY(e){let t=[],n=0;for(;n<e.length;){if(e.charCodeAt(n)===27){let t=e.slice(n).match(rY);if(t){n+=t[0].length;continue}}let r=e.codePointAt(n);if(r===void 0)break;let i=String.fromCodePoint(r);t.push({start:n,end:n+i.length,char:i}),n+=i.length}return t}function uY(e,t){let n=lY(e)[t];return n?e.slice(0,n.start)+e.slice(n.end):e}function dY(e){return lY(e)[0]?.char}function fY(e){let t=lY(e);for(let e=t.length-1;e>=0;e--)if(t[e].char.trim()!==``)return e;return-1}function pY(e){let t=e;for(;;){let e=lY(t),n=e[e.length-1];if(n?.char.trim()!==``)return t;t=t.slice(0,n.start)+t.slice(n.end)}}function mY(e){let t=/^[┌├└╭╰][─┬┴┼]+[┐┤┘╮╯]$/,n=[];for(let r of e){let e=r.replace(aY,``),i=cY(e).trimEnd();if(t.test(i))continue;let a=e,o=dY(a);(o===`│`||o===`┃`)&&(a=uY(a,0),dY(a)===` `&&(a=uY(a,0)));let s=fY(a),c=s>=0?lY(a)[s]?.char:void 0;(c===`│`||c===`┃`)&&(a=uY(a,s)),n.push(pY(a))}for(;n.length>0&&cY(n[0]).trim()===``;)n.shift();for(;n.length>0&&cY(n[n.length-1]).trim()===``;)n.pop();return n.length?n:e}function hY(e){if(e>=0&&e<8)return oY[e];if(e>=8&&e<16)return sY[e-8];if(e>=16&&e<=231){let t=e-16,n=Math.floor(t/36),r=Math.floor(t%36/6),i=t%6,a=e=>e===0?0:55+e*40;return`rgb(${a(n)}, ${a(r)}, ${a(i)})`}if(e>=232&&e<=255){let t=8+(e-232)*10;return`rgb(${t}, ${t}, ${t})`}}function gY(e,t){let n={...e};for(let e=0;e<t.length;e++){let r=t[e];if(r===0)for(let e of Object.keys(n))delete n[e];else if(r===1)n.fontWeight=700;else if(r===2)n.opacity=.65;else if(r===3)n.fontStyle=`italic`;else if(r===4)n.textDecoration=`underline`;else if(r===22)delete n.fontWeight,delete n.opacity;else if(r===23)delete n.fontStyle;else if(r===24)delete n.textDecoration;else if(r===39)delete n.color;else if(r===49)delete n.backgroundColor;else if(r>=30&&r<=37)n.color=oY[r-30];else if(r>=90&&r<=97)n.color=sY[r-90];else if(r>=40&&r<=47)n.backgroundColor=oY[r-40];else if(r>=100&&r<=107)n.backgroundColor=sY[r-100];else if((r===38||r===48)&&t[e+1]===2){let[i,a,o]=[t[e+2],t[e+3],t[e+4]];[i,a,o].every(e=>typeof e==`number`&&Number.isFinite(e))&&(r===38?n.color=`rgb(${i}, ${a}, ${o})`:n.backgroundColor=`rgb(${i}, ${a}, ${o})`),e+=4}else if((r===38||r===48)&&t[e+1]===5){let i=hY(t[e+2]);i&&(r===38?n.color=i:n.backgroundColor=i),e+=2}}return n}function _Y(e){let t=[],n={},r=0,i;for(iY.lastIndex=0;(i=iY.exec(e))!==null;){i.index>r&&t.push({text:e.slice(r,i.index),style:n});let a=i[1]?i[1].split(`;`).map(e=>Number(e||`0`)):[0];n=gY(n,a),r=i.index+i[0].length}return r<e.length&&t.push({text:e.slice(r),style:n}),t}var vY=`max(0px, (100% - 868px) / 2)`,yY=`max(0px, calc((100% - 884px) / 2))`;function bY(e){if(navigator.clipboard?.writeText)return navigator.clipboard.writeText(e);try{let t=document.createElement(`textarea`);return t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t),Promise.resolve()}catch{return Promise.reject()}}var xY={ArrowUp:`\x1B[A`,ArrowDown:`\x1B[B`,ArrowRight:`\x1B[C`,ArrowLeft:`\x1B[D`,Home:`\x1B[H`,End:`\x1B[F`,Insert:`\x1B[2~`,Delete:`\x1B[3~`,PageUp:`\x1B[5~`,PageDown:`\x1B[6~`,Escape:`\x1B`,Backspace:``},SY={ArrowLeft:`\x1Bb`,ArrowRight:`\x1Bf`,ArrowUp:`\x1Bp`,ArrowDown:`\x1Bn`};function CY(e){if(e.length!==1)return null;let t=e.toUpperCase().charCodeAt(0);return t>=64&&t<=95?String.fromCharCode(t&31):e===`?`?``:null}function wY(e){if(e.metaKey||e.ctrlKey&&!e.altKey&&e.key.toLowerCase()===`v`)return null;if(e.ctrlKey&&!e.altKey){let t=CY(e.key);if(t)return t}if(e.altKey&&!e.ctrlKey){if(e.key===`Backspace`)return`\x1B`;let t=SY[e.key];if(t)return t;if(e.key.length===1)return`\x1b${e.key}`}return e.key===`Enter`?e.shiftKey?`
353
+ `))}catch(e){console.error(`Failed to recall queued messages:`,e),Pe({type:`error`,message:Ie(`i18n.failedToRecallQueuedMessages`)})}},[e.chatInputRef,Pe,Ie]),In=(0,d.useCallback)((e=`smooth`)=>{ct.current=Date.now()+pJ,lt.current?.scrollIntoView({behavior:e})},[]),Ln=(0,d.useCallback)(()=>{let e=ut.current,t=rt.current;if(!e||!t)return;let n=t.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop;ct.current=Date.now()+pJ,e.scrollTo({top:n-16,behavior:`smooth`})},[]),Rn=(0,d.useCallback)(e=>{e instanceof KeyboardEvent&&(!OJ.has(e.key)||e.target instanceof Element&&e.target.closest(`input, textarea, [contenteditable='true']`))||(st.current=Date.now()+mJ)},[]),zn=(0,d.useCallback)(()=>{if(Date.now()<ct.current)return;let e=ut.current;if(e){if(e.scrollHeight-e.scrollTop-e.clientHeight<hJ){at.current=!0;return}Ye.current&&(Date.now()>st.current||(at.current=!1))}},[]);return(0,d.useEffect)(()=>(t?(Je.current=t.id,an(t.id,!0,!1).then(()=>pn(t.id)).then(()=>an(t.id,!1,!0)).then(e=>{e?.running&&(sn(t.id),(e.state?.isStreaming||e.state?.isPromptRunning)&&(Xe.current=!!e.state.isStreaming,Ze.current=!!e.state.isPromptRunning,L(!0),Oe(e.state.isStreaming?{kind:`waiting_model`}:{kind:`running_command`}),E({type:`start`}),!e.state.isStreaming&&e.state.isPromptRunning&&yn(t.id)),e.state?.isBashRunning&&(se(!0),bn(t.id))),e?.state&&(e.state.isCompacting!==void 0&&xe(e.state.isCompacting),Yt(e.state))})):l&&n&&ln().then(async e=>{if(e){Je.current=e,await pn(e);try{let t=await fetch(`/api/sessions/${encodeURIComponent(e)}/state`);if(!t.ok)return;let n=await t.json();Je.current===e&&Yt(n.state)}catch{}}}),()=>{et.current+=1,dn(),fn()}),[]),(0,d.useEffect)(()=>(window.addEventListener(`keydown`,Rn),window.addEventListener(`pointerdown`,Rn,{passive:!0}),()=>{window.removeEventListener(`keydown`,Rn),window.removeEventListener(`pointerdown`,Rn)}),[Rn]),(0,d.useEffect)(()=>{let e=ut.current;if(e)return e.addEventListener(`wheel`,Rn,{passive:!0}),e.addEventListener(`touchstart`,Rn,{passive:!0}),e.addEventListener(`scroll`,zn,{passive:!0}),()=>{e.removeEventListener(`wheel`,Rn),e.removeEventListener(`touchstart`,Rn),e.removeEventListener(`scroll`,zn)}},[y.length,p,zn,Rn]),(0,d.useEffect)(()=>{if(y.length>0){if(it.current)it.current=!1,nt.current=!0,Ln();else if(!nt.current)nt.current=!0,In(`instant`);else if(at.current){let e=ut.current;e&&(e.scrollTop=e.scrollHeight)}}},[y.length,ie,In,Ln]),(0,d.useLayoutEffect)(()=>{if(!at.current||!T.isStreaming)return;let e=ut.current;e&&(e.scrollTop=e.scrollHeight)},[T.isStreaming,T.streamingMessage]),(0,d.useEffect)(()=>{let e=new AbortController,t=()=>It(e.signal).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||jt(e instanceof Error?e.message:String(e))});return c===0?t():be.refresh().catch(()=>{}).then(t),()=>e.abort()},[It,c,jt]),(0,d.useEffect)(()=>{if(!we)return;let e=setTimeout(()=>Te(null),6e3);return()=>clearTimeout(e)},[we]),(0,d.useEffect)(()=>{rn(null)},[y.length,pe?.tokens,pe?.percent,pe?.contextWindow,rn]),{data:u,loading:p,error:h,activeLeafId:_,tree:u?.tree??[],messages:y,entryIds:C,streamState:T,agentRunning:ie,modelNames:ht,modelList:gt,modelError:_t,modelScopeWarnings:vt,modelThinkingLevels:yt,modelThinkingLevelMaps:bt,newSessionModel:xt,toolPreset:Ct,thinkingLevel:wt,retryInfo:de,contextUsage:pe,systemPrompt:he,forkingEntryId:_e,isCompacting:ye,compactError:Se,compactResult:we,currentModel:Xt,displayModel:Zt,sessionStats:nn,slashCommands:ke,slashCommandsLoading:je,queuedMessages:Le,notices:Ne.visible,noticeModals:Ne.modals,dismissNoticeModal:Fe,extensionDialog:Bt,extensionCustomUi:Vt,extensionStatuses:Ht,extensionWidgets:Ut,respondToExtensionUi:Kt,sendExtensionCustomInput:qt,isAutoModelSelection:l&&xt===null,agentPhase:De,isNew:l,sessionIdRef:Je,loadContext:on,messagesEndRef:lt,scrollContainerRef:ut,lastUserMsgRef:rt,pendingScrollToUserRef:it,initialScrollDoneRef:nt,handleSend:Cn,handleAbort:wn,handleFork:Tn,handleNavigate:En,handleLeafChange:Dn,handleModelChange:Lt,handleCompact:On,handleSteer:jn,handleFollowUp:Nn,handlePromptWithStreamingBehavior:Mn,handleAbortCompaction:Pn,handleRecallQueue:Fn,handleBuiltinSlashCommand:kn,handleToolPresetChange:zt,handleThinkingLevelChange:tn,loadTools:sn,loadSlashCommands:un,setActiveLeafId:v,setData:f,setMessages:S,setSessionStatsOverride:rn,dispatch:E,setAgentRunning:ae,setForkingEntryId:ve,bashRunning:oe,bashOutput:R,pendingBash:le,commandBusy:ze,handleAgentEventRef:tt}}var KJ={background:`linear-gradient(90deg, var(--accent) 0%, var(--accent) 47%, var(--shine-highlight) 53%, var(--shine-highlight) 100%)`,backgroundSize:`200% 100%`,WebkitBackgroundClip:`text`,backgroundClip:`text`,color:`transparent`,animation:`pi-status-shine 1.5s linear infinite`},qJ={animation:`pi-status-icon-pulse 1.5s ease-in-out infinite`};function JJ(e,t){if(e?.kind===`running_tools`){let n=e.tools.map(e=>e.name);return n.length===0?t(`chat.runningTool`):n.length===1?t(`chat.runningNamedTool`,{name:n[0]}):n.length<=3?t(`chat.runningTools`,{names:n.join(`, `)}):t(`chat.runningToolsMore`,{names:n.slice(0,2).join(`, `),count:n.length-2})}return e?.kind===`thinking`?t(`chat.thinking`):e?.kind===`waiting_model`?t(`chat.waitingModel`):e?.kind===`running_command`?t(`chat.runningCommand`):e?.kind===`retrying`?t(`chat.retrying`,{attempt:e.attempt,max:e.maxAttempts}):null}function YJ(e){return e?.kind===`running_tools`?(0,E.jsx)(ti,{size:p.lg}):e?.kind===`running_command`?(0,E.jsx)(Jr,{size:p.lg}):e?.kind===`thinking`?(0,E.jsx)(Dr,{size:p.lg,fill:`currentColor`,style:{color:`var(--bulb-warning)`}}):e?.kind===`retrying`?(0,E.jsx)(Zr,{size:p.lg,style:{color:`var(--status-warning)`}}):(0,E.jsx)(Tr,{size:p.lg})}function XJ({phase:e,elapsed:t,totalElapsed:n}){let{t:r}=N(),i=JJ(e,r)??r(`chat.runningCommand`);return(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,style:{...KJ,minWidth:0,maxWidth:`100%`},children:[(0,E.jsx)(`span`,{className:`inline-flex flex-shrink-0`,style:qJ,children:YJ(e)}),(0,E.jsxs)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,minWidth:0},children:[i,t!=null&&(0,E.jsxs)(E.Fragment,{children:[` · `,t]}),n!=null&&(0,E.jsxs)(E.Fragment,{children:[` · `,r(`chat.totalElapsed`,{total:n})]})]})]})}function ZJ({msg:e,onSend:t,onFillInput:n,testId:r}){let{t:i}=N(),a=()=>{if(e.allowAppend&&n){n(`${e.message} `);return}t(e.message)},o=`${e.allowAppend?i(`config.widgets.fillToChatInputTooltip`):i(`config.widgets.sendImmediatelyTooltip`)}${e.message}`;return(0,E.jsx)(oi,{label:o,children:(0,E.jsx)(PG,{label:e.label,title:o,onClick:a,testId:r})})}function QJ({messages:e,onSend:t,onFillInput:n,testIdPrefix:r=`quick-msg`,wrapperTestId:i=`quick-message-buttons`,center:a=!1}){return e.length===0?null:(0,E.jsx)(`div`,{"data-testid":i,style:{display:`flex`,flexWrap:`wrap`,gap:6,justifyContent:a?`center`:`flex-start`,paddingTop:8,borderTop:a?`1px solid var(--border)`:void 0},children:e.map((e,i)=>(0,E.jsx)(ZJ,{msg:e,onSend:t,onFillInput:n,testId:`${r}-${i}`},i))})}function $J(e){let t=e.currentTime;[523.25,659.25].forEach((n,r)=>{let i=e.createOscillator(),a=e.createGain();i.connect(a),a.connect(e.destination),i.type=`sine`,i.frequency.value=n;let o=t+r*.18;a.gain.setValueAtTime(0,o),a.gain.linearRampToValueAtTime(.18,o+.02),a.gain.exponentialRampToValueAtTime(.001,o+.45),i.start(o),i.stop(o+.45)})}function eY(){let[e,t]=(0,d.useState)(()=>{if(typeof window>`u`)return!0;let e=localStorage.getItem(`pi-sound-enabled`);return e===null||e===`true`}),n=(0,d.useRef)(e);(0,d.useEffect)(()=>{n.current=e},[e]);let r=(0,d.useRef)(null),i=(0,d.useCallback)(()=>{if(r.current&&r.current.state!==`closed`)return r.current;try{r.current=new AudioContext}catch{return null}return r.current},[]),a=(0,d.useCallback)((e=!1)=>{if(!e&&!n.current)return;let t=i();t?.state===`suspended`&&t.resume().catch(()=>{})},[i]);return{soundEnabled:e,onSoundToggle:(0,d.useCallback)(()=>{let e=!n.current;e&&a(!0),n.current=e,localStorage.setItem(`pi-sound-enabled`,String(e)),t(e)},[a]),playDoneSound:(0,d.useCallback)(()=>{if(!n.current)return;let e=i();if(!e)return;let t=()=>{try{$J(e)}catch{}};if(e.state===`suspended`){e.resume().then(t).catch(()=>{});return}t()},[i]),unlockAudio:a,soundEnabledRef:n}}function tY(e){let[t,n]=(0,d.useState)(!1),r=(0,d.useRef)(0);return{isDragOver:t,handleDragEnter:(0,d.useCallback)(e=>{Array.from(e.dataTransfer.items).some(e=>e.type.startsWith(`image/`))&&(e.preventDefault(),r.current+=1,n(!0))},[]),handleDragOver:(0,d.useCallback)(e=>{Array.from(e.dataTransfer.items).some(e=>e.type.startsWith(`image/`))&&e.preventDefault()},[]),handleDragLeave:(0,d.useCallback)(()=>{--r.current,r.current<=0&&(r.current=0,n(!1))},[]),handleDrop:(0,d.useCallback)(t=>{t.preventDefault(),r.current=0,n(!1),e(Array.from(t.dataTransfer.files))},[e])}}var nY=/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~]|\][^\x07]*(?:\x07|\x1B\\))/g,rY=/^\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~]|\][^\x07]*(?:\x07|\x1B\\))/,iY=/\x1B\[([0-9;]*)m/g,aY=/\x1B_pi:c\x07/g,oY=[`#1f2937`,`#dc2626`,`#16a34a`,`#d97706`,`#2563eb`,`#9333ea`,`#0891b2`,`#6b7280`],sY=[`#9ca3af`,`#ef4444`,`#22c55e`,`#f59e0b`,`#3b82f6`,`#a855f7`,`#06b6d4`,`#e5e7eb`];function cY(e){return e.replace(aY,``).replace(nY,``)}function lY(e){let t=[],n=0;for(;n<e.length;){if(e.charCodeAt(n)===27){let t=e.slice(n).match(rY);if(t){n+=t[0].length;continue}}let r=e.codePointAt(n);if(r===void 0)break;let i=String.fromCodePoint(r);t.push({start:n,end:n+i.length,char:i}),n+=i.length}return t}function uY(e,t){let n=lY(e)[t];return n?e.slice(0,n.start)+e.slice(n.end):e}function dY(e){return lY(e)[0]?.char}function fY(e){let t=lY(e);for(let e=t.length-1;e>=0;e--)if(t[e].char.trim()!==``)return e;return-1}function pY(e){let t=e;for(;;){let e=lY(t),n=e[e.length-1];if(n?.char.trim()!==``)return t;t=t.slice(0,n.start)+t.slice(n.end)}}function mY(e){let t=/^[┌├└╭╰][─┬┴┼]+[┐┤┘╮╯]$/,n=[];for(let r of e){let e=r.replace(aY,``),i=cY(e).trimEnd();if(t.test(i))continue;let a=e,o=dY(a);(o===`│`||o===`┃`)&&(a=uY(a,0),dY(a)===` `&&(a=uY(a,0)));let s=fY(a),c=s>=0?lY(a)[s]?.char:void 0;(c===`│`||c===`┃`)&&(a=uY(a,s)),n.push(pY(a))}for(;n.length>0&&cY(n[0]).trim()===``;)n.shift();for(;n.length>0&&cY(n[n.length-1]).trim()===``;)n.pop();return n.length?n:e}function hY(e){if(e>=0&&e<8)return oY[e];if(e>=8&&e<16)return sY[e-8];if(e>=16&&e<=231){let t=e-16,n=Math.floor(t/36),r=Math.floor(t%36/6),i=t%6,a=e=>e===0?0:55+e*40;return`rgb(${a(n)}, ${a(r)}, ${a(i)})`}if(e>=232&&e<=255){let t=8+(e-232)*10;return`rgb(${t}, ${t}, ${t})`}}function gY(e,t){let n={...e};for(let e=0;e<t.length;e++){let r=t[e];if(r===0)for(let e of Object.keys(n))delete n[e];else if(r===1)n.fontWeight=700;else if(r===2)n.opacity=.65;else if(r===3)n.fontStyle=`italic`;else if(r===4)n.textDecoration=`underline`;else if(r===22)delete n.fontWeight,delete n.opacity;else if(r===23)delete n.fontStyle;else if(r===24)delete n.textDecoration;else if(r===39)delete n.color;else if(r===49)delete n.backgroundColor;else if(r>=30&&r<=37)n.color=oY[r-30];else if(r>=90&&r<=97)n.color=sY[r-90];else if(r>=40&&r<=47)n.backgroundColor=oY[r-40];else if(r>=100&&r<=107)n.backgroundColor=sY[r-100];else if((r===38||r===48)&&t[e+1]===2){let[i,a,o]=[t[e+2],t[e+3],t[e+4]];[i,a,o].every(e=>typeof e==`number`&&Number.isFinite(e))&&(r===38?n.color=`rgb(${i}, ${a}, ${o})`:n.backgroundColor=`rgb(${i}, ${a}, ${o})`),e+=4}else if((r===38||r===48)&&t[e+1]===5){let i=hY(t[e+2]);i&&(r===38?n.color=i:n.backgroundColor=i),e+=2}}return n}function _Y(e){let t=[],n={},r=0,i;for(iY.lastIndex=0;(i=iY.exec(e))!==null;){i.index>r&&t.push({text:e.slice(r,i.index),style:n});let a=i[1]?i[1].split(`;`).map(e=>Number(e||`0`)):[0];n=gY(n,a),r=i.index+i[0].length}return r<e.length&&t.push({text:e.slice(r),style:n}),t}var vY=`max(0px, (100% - 868px) / 2)`,yY=`max(0px, calc((100% - 884px) / 2))`;function bY(e){if(navigator.clipboard?.writeText)return navigator.clipboard.writeText(e);try{let t=document.createElement(`textarea`);return t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t),Promise.resolve()}catch{return Promise.reject()}}var xY={ArrowUp:`\x1B[A`,ArrowDown:`\x1B[B`,ArrowRight:`\x1B[C`,ArrowLeft:`\x1B[D`,Home:`\x1B[H`,End:`\x1B[F`,Insert:`\x1B[2~`,Delete:`\x1B[3~`,PageUp:`\x1B[5~`,PageDown:`\x1B[6~`,Escape:`\x1B`,Backspace:``},SY={ArrowLeft:`\x1Bb`,ArrowRight:`\x1Bf`,ArrowUp:`\x1Bp`,ArrowDown:`\x1Bn`};function CY(e){if(e.length!==1)return null;let t=e.toUpperCase().charCodeAt(0);return t>=64&&t<=95?String.fromCharCode(t&31):e===`?`?``:null}function wY(e){if(e.metaKey||e.ctrlKey&&!e.altKey&&e.key.toLowerCase()===`v`)return null;if(e.ctrlKey&&!e.altKey){let t=CY(e.key);if(t)return t}if(e.altKey&&!e.ctrlKey){if(e.key===`Backspace`)return`\x1B`;let t=SY[e.key];if(t)return t;if(e.key.length===1)return`\x1b${e.key}`}return e.key===`Enter`?e.shiftKey?`
354
354
  `:`\r`:e.key===`Tab`?e.shiftKey?`\x1B[Z`:` `:xY[e.key]??null}function TY(e){return`\x1b[200~${e}\x1b[201~`}function EY(e){if(e.type!==`thinking`)return!1;let t=e;return t.thinking.trim()===``&&!!(t.redacted||typeof t.thinkingSignature==`string`&&t.thinkingSignature.trim().length>0)}function DY(e,t={}){return e.type===`thinking`&&!e.deferred&&!t.isStreaming&&e.thinking.trim()===``&&!EY(e)}function OY(e,t={}){return(e.content??[]).filter(e=>!DY(e,t))}function kY(e,t={}){return t.isStreaming||e.stopReason!==`error`?null:e.errorMessage?.trim()||`Unknown provider error`}function AY(e){return e.type===`text`||e.type===`image`}function jY(e,t={}){let n=OY(e,t),r=n.findLastIndex(e=>!AY(e));return r===-1?{answerBlocks:n,processBlocks:[]}:{answerBlocks:n.slice(r+1),processBlocks:n.slice(0,r+1)}}function MY(e){return e.filter(e=>e.type===`toolCall`).length}function NY(e){return e.role===`user`?96:e.role===`assistant`?260:120}function PY(e){return e.role===`assistant`&&jY(e).answerBlocks.some(e=>e.type===`image`||e.type===`text`&&e.text.trim().length>0)}function FY(e,t,n){for(let r=n-1;r>t;r--)if(PY(e[r]))return r;for(let r=n-1;r>t;r--)if(e[r]?.role===`assistant`)return r;return-1}function IY(e,t){let n=0;for(let r of t){let t=e[r];t?.role===`assistant`&&(n+=MY(OY(t)))}return n}function LY(e){return e.role===`assistant`?OY(e).length>0:e.role===`custom`}function RY(e){return e.role===`user`||e.role===`custom`&&e.customType===`compaction`}function zY(e,t,n={}){let r={...e,content:t};return n.omitUsage&&(r.usage=void 0),r}function BY(e,t){let{isLiveTail:n,lastAnchorIdx:r,visibleRefIndexByMessage:i}=t,a=[],o=(t,n={})=>{a.push({key:`message-${t}`,kind:`message`,msgIdx:t,estimate:NY(e[t]),...n})};for(let t=0;t<e.length;){let s=e[t];if(!RY(s)){o(t),t+=1;continue}let c=t,l=c+1;for(;l<e.length&&!RY(e[l]);)l+=1;let u=FY(e,c,l);if(u===-1||n&&l===e.length&&c===r){for(let e=c;e<l;e++)o(e);t=l;continue}o(c);let d=[];for(let e=c+1;e<u;e++)d.push(e);let f=d.filter(t=>LY(e[t])),p=e[u],m=jY(p),h=m.processBlocks.length>0?zY(p,m.processBlocks,{omitUsage:!0}):null,g=m.answerBlocks.length>0||kY(p)?zY(p,m.answerBlocks):null,_=f.length+ +!!h;if(_>0){let t=f.map(e=>i.get(e)).find(e=>typeof e==`number`)??(g?void 0:i.get(u));a.push({key:`group-header-${c}-${u}`,kind:`groupHeader`,groupUserIdx:c,finalAssistantIdx:u,messageCount:_,toolCallCount:IY(e,f)+MY(m.processBlocks),processRefIdx:t,estimate:40}),f.forEach((e,t)=>{o(e,{isProcess:!0,attachRef:!1,groupLast:!h&&t===f.length-1})}),h&&o(u,{isProcessFinal:!0,attachRef:!1,messageOverride:h,showTimestamp:!1,groupLast:!0})}g&&a.push({key:`message-${u}-answer`,kind:`message`,msgIdx:u,estimate:NY(e[u]),messageOverride:g,isAnswer:!0});for(let e=u+1;e<l;e++)o(e);t=l}return a}function VY(e){let t=new Map;return e.forEach((e,n)=>{e.kind===`message`&&t.set(e.msgIdx,n)}),t}var HY=new Map;function UY(e){return{value:e.value,images:e.images.map(e=>({...e}))}}function WY(e){return!e.value&&e.images.length===0}function GY(e){let t=HY.get(e);return t?UY(t):null}function KY(e,t){if(WY(t)){HY.delete(e);return}HY.set(e,UY(t))}function qY(e){HY.delete(e)}var JY=`pi-web:pending-message:`;function YY(e,t){if(!t){ZY(e);return}try{localStorage.setItem(JY+e,t)}catch{}}function XY(e){try{return localStorage.getItem(JY+e)}catch{return null}}function ZY(e){try{localStorage.removeItem(JY+e)}catch{}}function QY(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===43||e===47}function $Y(e){if(!e||e.length%4!=0)return null;let t=e.endsWith(`==`)?2:+!!e.endsWith(`=`),n=e.length-t;for(let t=0;t<n;t+=1)if(!QY(e.charCodeAt(t)))return null;for(let t=n;t<e.length;t+=1)if(e[t]!==`=`)return null;return e.length/4*3-t}function eX(e){if(!e||typeof e!=`object`)return!1;let t=e;if(typeof t.data!=`string`||typeof t.mimeType!=`string`||!t.mimeType.startsWith(`image/`))return!1;let n=$Y(t.data);return n!==null&&n<=10485760}function tX({active:e,label:t,desc:n,onSelect:r}){return(0,E.jsxs)(`button`,{type:`button`,onClick:r,style:{display:`flex`,alignItems:`center`,gap:8,width:`100%`,padding:`7px 12px`,background:e?`var(--bg-selected)`:`none`,border:`none`,color:e?`var(--text)`:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-base)`,textAlign:`left`,fontWeight:e?600:400,whiteSpace:`nowrap`},className:e?`selectable-row is-selected`:`selectable-row`,children:[e?(0,E.jsx)(ur,{size:p.xs,strokeWidth:4.8,style:{flexShrink:0}}):(0,E.jsx)(`span`,{style:{width:10,flexShrink:0}}),(0,E.jsx)(`span`,{style:{flex:1},children:t}),(0,E.jsx)(`span`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`,marginLeft:8},children:n})]})}var nX=[`off`,`default`,`full`],rX={off:`none`,default:`default`,full:`full`},iX=100;function aX(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${Math.round(e/1e3)}k`:e.toLocaleString()}function oX(e){return{data:e.data,mimeType:e.mimeType}}function sX(e){return{...e,previewUrl:`data:${e.mimeType};base64,${e.data}`}}function cX(e){return(e??[]).filter(eX).slice(0,10).map(sX)}function lX(e){e.previewUrl.startsWith(`blob:`)&&URL.revokeObjectURL(e.previewUrl)}function uX({kind:e,text:t}){return(0,E.jsx)(oi,{label:t,wrapperStyle:{display:`flex`,minWidth:0,flex:1},children:(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`3px 10px`,fontSize:`var(--text-base)`,color:`var(--text-muted)`,minWidth:0},children:[(0,E.jsx)(`span`,{style:{flexShrink:0,fontSize:`var(--text-xs)`,fontFamily:`var(--font-mono)`,padding:`1px 7px`,borderRadius:999,border:`1px solid ${e===`steer`?`color-mix(in srgb, var(--accent) 45%, transparent)`:`var(--border)`}`,color:e===`steer`?`var(--accent)`:`var(--text-dim)`},children:e}),(0,E.jsx)(`span`,{style:{minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t})]})})}function dX({tone:e,title:t,body:n}){let r=e===`error`?`239,68,68`:`234,179,8`;return(0,E.jsxs)(`div`,{role:`alert`,style:{display:`flex`,alignItems:`flex-start`,gap:8,maxHeight:120,marginBottom:8,padding:`7px 10px`,overflowY:`auto`,border:`1px solid rgba(${r},0.3)`,borderRadius:6,background:`rgba(${r},0.07)`,color:`rgb(${r})`,fontSize:`var(--text-sm)`,lineHeight:1.45},children:[(0,E.jsx)(Zr,{size:p.lg,style:{flexShrink:0,marginTop:1},"aria-hidden":`true`}),(0,E.jsxs)(`div`,{style:{minWidth:0},children:[(0,E.jsx)(`div`,{style:{fontWeight:600},children:t}),(0,E.jsx)(`div`,{style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:n})]})]})}function fX({error:e}){return e?(0,E.jsx)(dX,{tone:`error`,title:`Model error`,body:e}):null}function pX({warnings:e}){return!e||e.length===0?null:(0,E.jsx)(dX,{tone:`warning`,title:e.length>1?`Model scope warnings`:`Model scope warning`,body:e.join(`
355
355
  `)})}var mX=(0,d.forwardRef)(function({onSend:e,onAbort:t,onSteer:n,onFollowUp:r,isStreaming:i,model:a,isAutoModelSelection:o,modelNames:s,modelList:c,modelError:l,modelScopeWarnings:u,onModelChange:f,onCompact:m,onReloadFromDisk:h,onAbortCompaction:g,isCompacting:_,compactError:v,compactResult:y,toolPreset:b,onToolPresetChange:x,thinkingLevel:S,onThinkingLevelChange:C,availableThinkingLevels:w,thinkingLevelMap:T,onOpenModelConfig:D,retryInfo:O,queuedMessages:k,inputHistory:A=[],onRecallQueue:j,slashCommands:M,slashCommandsLoading:P,onLoadSlashCommands:ee,onBuiltinCommand:F,commandBusy:te,soundEnabled:re,onSoundToggle:ie,onAudioUnlock:ae,onPromptWithStreamingBehavior:oe,draftKey:I,cwd:L},se){let{t:R}=N(),ce=ne(),{isDark:le}=Xn(),[ue,de]=(0,d.useState)(()=>I?GY(I)?.value??``:``),fe=(k?.steering.length??0)+(k?.followUp.length??0),[pe,me]=(0,d.useState)(!1),[he,ge]=(0,d.useState)(null),[_e,ve]=(0,d.useState)(``),[ye,be]=(0,d.useState)(0),xe=(0,d.useRef)(null),[Se,Ce]=(0,d.useState)(!1),[we,Te]=(0,d.useState)(!1),[Ee,De]=(0,d.useState)(!1),[Oe,ke]=(0,d.useState)(null),[Ae,je]=(0,d.useState)(()=>I?cX(GY(I)?.images):[]),Me=ue.trimStart(),Ne=Ae.length===0&&Me.startsWith(`!`),Pe=Ne&&Me.startsWith(`!!`),[Fe,Ie]=(0,d.useState)(null),[Le,Re]=(0,d.useState)(!1),[ze,Be]=(0,d.useState)(0),[Ve,He]=(0,d.useState)(!1),[Ue,We]=(0,d.useState)(0),[Ge,Ke]=(0,d.useState)(null),[qe,Je]=(0,d.useState)(!1),[Ye,Xe]=(0,d.useState)(null),[Ze,Qe]=(0,d.useState)(null),$e=L&&Ze?.cwd===L?Ze.values:{},et=(0,d.useRef)(null),tt=(0,d.useRef)(null),nt=(0,d.useRef)(null),rt=(0,d.useRef)(null),it=(0,d.useRef)(null),at=(0,d.useRef)(null),ot=(0,d.useRef)(null),st=(0,d.useRef)(null),ct=(0,d.useRef)(!1),lt=(0,d.useRef)(0),ut=(0,d.useRef)([]),dt=(0,d.useRef)([]),ft=(0,d.useRef)(null),pt=(0,d.useRef)(null),mt=(0,d.useRef)(I),ht=(0,d.useRef)(ue),gt=(0,d.useRef)(Ae),_t=(0,d.useRef)(0);ht.current=ue,gt.current=Ae,(0,d.useImperativeHandle)(se,()=>({insertIfEmpty(e){let t=et.current;(t?t.value:ue).trim()||(de(e),Ie(null),requestAnimationFrame(()=>{t&&(t.focus(),t.style.height=`auto`,t.style.height=`${Math.min(t.scrollHeight,200)}px`)}))},prependText(e){if(!e.trim())return;let t=et.current,n=[e,t?t.value:ue].filter(e=>e.trim()).join(`
356
356
 
@@ -438,14 +438,14 @@ ${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>${P1(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=F1(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+P1(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=F1(e);if(i===null)return P1(n);e=i;let a=`<img src="${e}" alt="${P1(n)}"`;return t&&(a+=` title="${P1(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:P1(e.text)}},G1=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}},K1=class e{options;renderer;textRenderer;constructor(e){this.options=e||x$,this.options.renderer=this.options.renderer||new W1,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new G1}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}},q1=class{options;block;constructor(e){this.options=e||x$}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?U1.lex:U1.lexInline}provideParser(e=this.block){return e?K1.parse:K1.parseInline}},J1=new class{defaults=b$();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=K1;Renderer=W1;TextRenderer=G1;Lexer=U1;Tokenizer=H1;Hooks=q1;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 W1(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 H1(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 q1;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]=q1.passThroughHooks.has(n)?e=>{if(this.defaults.async&&q1.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 U1.lex(e,t??this.defaults)}parser(e,t){return K1.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?U1.lex:U1.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?K1.parse:K1.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?U1.lex:U1.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?K1.parse:K1.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>`+P1(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Y1(e,t){return J1.parse(e,t)}Y1.options=Y1.setOptions=function(e){return J1.setOptions(e),Y1.defaults=J1.defaults,S$(Y1.defaults),Y1},Y1.getDefaults=b$,Y1.defaults=x$,Y1.use=function(...e){return J1.use(...e),Y1.defaults=J1.defaults,S$(Y1.defaults),Y1},Y1.walkTokens=function(e,t){return J1.walkTokens(e,t)},Y1.parseInline=J1.parseInline,Y1.Parser=K1,Y1.parser=K1.parse,Y1.Renderer=W1,Y1.TextRenderer=G1,Y1.Lexer=U1,Y1.lexer=U1.lex,Y1.Tokenizer=H1,Y1.Hooks=q1,Y1.parse=Y1,Y1.options,Y1.setOptions,Y1.use,Y1.walkTokens,Y1.parseInline,K1.parse,U1.lex;var X1=`modulepreload`,Z1=function(e){return`/`+e},Q1={},$1=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=Z1(t,n),t=s(t),t in Q1)return;Q1[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`:X1,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)})},e0=300,t0=`300px`,n0=500;function r0(e={}){let{immediate:t=!1,debounceDelay:n=e0,rootMargin:r=t0,idleTimeout:i=n0}=e,[a,o]=(0,d.useState)(!1),s=(0,d.useRef)(null),c=(0,d.useRef)(null),l=(0,d.useRef)(null),u=(0,d.useMemo)(()=>e=>{let t=Date.now();return window.setTimeout(()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-t))})},1)},[]),f=(0,d.useMemo)(()=>typeof window<`u`&&window.requestIdleCallback?(e,t)=>window.requestIdleCallback(e,t):u,[u]),p=(0,d.useMemo)(()=>typeof window<`u`&&window.cancelIdleCallback?e=>window.cancelIdleCallback(e):e=>{clearTimeout(e)},[]);return(0,d.useEffect)(()=>{if(t){o(!0);return}let e=s.current;if(!e)return;c.current&&=(clearTimeout(c.current),null),l.current&&=(p(l.current),null);let a=()=>{c.current&&=(clearTimeout(c.current),null),l.current&&=(p(l.current),null)},u=e=>{l.current=f(t=>{t.timeRemaining()>0||t.didTimeout?(o(!0),e.disconnect()):l.current=f(()=>{o(!0),e.disconnect()},{timeout:i/2})},{timeout:i})},d=e=>{a(),c.current=window.setTimeout(()=>{var t;let n=e.takeRecords();(n.length===0||(t=n.at(-1)?.isIntersecting)!=null&&t)&&u(e)},n)},m=(e,t)=>{e.isIntersecting?d(t):a()},h=new IntersectionObserver(e=>{for(let t of e)m(t,h)},{rootMargin:r,threshold:0});return h.observe(e),()=>{c.current&&clearTimeout(c.current),l.current&&p(l.current),h.disconnect()}},[t,n,r,i,p,f]),{shouldRender:a,containerRef:s}}var i0=/\s/,a0=/^\s+$/,o0=new Set([`code`,`pre`,`svg`,`math`,`annotation`]),s0=e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`element`,c0=e=>e.some(e=>s0(e)&&o0.has(e.tagName)),l0=e=>{let t=[],n=``,r=!1;for(let i of e){let e=i0.test(i);e!==r&&n&&(t.push(n),n=``),n+=i,r=e}return n&&t.push(n),t},u0=e=>{let t=[],n=``;for(let r of e)i0.test(r)?n+=r:(n&&=(t.push(n),``),t.push(r));return n&&t.push(n),t},d0=(e,t,n,r,i,a)=>{let o=`--sd-animation:sd-${t};--sd-duration:${i?0:n}ms;--sd-easing:${r}`;return a&&(o+=`;--sd-delay:${a}ms`),{type:`element`,tagName:`span`,properties:{"data-sd-animate":!0,style:o},children:[{type:`text`,value:e}]}},f0=(e,t,n,r,i)=>{let a=t.at(-1);if(!(a&&`children`in a))return;if(c0(t))return DO;let o=a,s=o.children.indexOf(e);if(s===-1)return;let c=e.value;if(!c.trim()){i.count+=c.length;return}let l=n.sep===`char`?u0(c):l0(c),u=r.prevContentLength,d=l.map(e=>{let t=i.count;if(i.count+=e.length,a0.test(e))return{type:`text`,value:e};let r=u>0&&t<u,a=r?0:i.newIndex++*n.stagger;return d0(e,n.animation,n.duration,n.easing,r,a)});return o.children.splice(s,1,...d),s+d.length},p0=0;function m0(e){let t={animation:e?.animation??`fadeIn`,duration:e?.duration??150,easing:e?.easing??`ease`,sep:e?.sep??`word`,stagger:e?.stagger??40},n={prevContentLength:0,lastRenderCharCount:0},r=p0++,i=()=>e=>{let r={count:0,newIndex:0};OO(e,`text`,(e,i)=>f0(e,i,t,n,r)),n.lastRenderCharCount=r.count,n.prevContentLength=0};return Object.defineProperty(i,"name",{value:`rehypeAnimate$${r}`}),{name:`animate`,type:`animate`,rehypePlugin:i,setPrevContentLength(e){n.prevContentLength=e},getLastRenderCharCount(){let e=n.lastRenderCharCount;return n.lastRenderCharCount=0,e}}}m0();var h0=(0,d.createContext)(!1),g0=()=>(0,d.useContext)(h0),_0=(...e)=>Sm(Jf(e)),v0=(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(` `)},y0=e=>e?(...t)=>v0(e,Sm(Jf(t))):_0,b0=(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)},x0=(0,d.createContext)(_0),S0=()=>(0,d.useContext)(x0),C0=_0(`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`),w0=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},T0=(0,d.memo)(({children:e,result:t,language:n,className:r,startLine:i,lineNumbers:a=!0,...o})=>{let s=S0(),c=(0,d.useMemo)(()=>s(C0),[s]),l=(0,d.useMemo)(()=>{let e={};return t.bg&&(e[`--sdm-bg`]=t.bg),t.fg&&(e[`--sdm-fg`]=t.fg),t.rootStyle&&Object.assign(e,w0(t.rootStyle)),e},[t.bg,t.fg,t.rootStyle]);return(0,E.jsx)(`div`,{className:s(r,`overflow-x-auto rounded-md border border-border bg-background p-4 text-sm`),"data-language":n,"data-streamdown":`code-block-body`,...o,children:(0,E.jsx)(`pre`,{className:s(r,`bg-[var(--sdm-bg,inherit]`,`dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,inherit)]`),style:l,children:(0,E.jsx)(`code`,{className:a?s(`[counter-increment:line_0] [counter-reset:line]`):void 0,style:a&&i&&i>1?{counterReset:`line ${i-1}`}:void 0,children:t.tokens.map((e,t)=>(0,E.jsx)(`span`,{className:a?c:void 0,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,E.jsx)(`span`,{className:s(`text-[var(--sdm-c,inherit)]`,`dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]`,r&&`bg-[var(--sdm-tbg)]`,r&&`dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]`),style:n,...e.htmlAttrs,children:e.content},t)})},t))})})})},(e,t)=>e.result===t.result&&e.language===t.language&&e.className===t.className&&e.startLine===t.startLine&&e.lineNumbers===t.lineNumbers),E0=({className:e,language:t,style:n,isIncomplete:r,...i})=>{let a=S0();return(0,E.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})},D0=(0,d.createContext)({code:``}),O0=()=>(0,d.useContext)(D0),k0=({language:e})=>{let t=S0();return(0,E.jsx)(`div`,{className:t(`flex h-8 items-center text-muted-foreground text-xs`),"data-language":e,"data-streamdown":`code-block-header`,children:(0,E.jsx)(`span`,{className:t(`ml-1 font-mono lowercase`),children:e})})},A0=e=>{let t=e.length;for(;t>0&&e[t-1]===`
441
- `;)t--;return e.slice(0,t)},j0=(0,d.lazy)(()=>$1(()=>import(`./highlighted-body-OFNGDK62-D4klPf9N.js`).then(e=>({default:e.HighlightedCodeBlockBody})),__vite__mapDeps([0,1]))),M0=({code:e,language:t,className:n,children:r,isIncomplete:i=!1,startLine:a,lineNumbers:o,...s})=>{let c=S0(),l=(0,d.useMemo)(()=>A0(e),[e]),u=(0,d.useMemo)(()=>({bg:`transparent`,fg:`inherit`,tokens:l.split(`
441
+ `;)t--;return e.slice(0,t)},j0=(0,d.lazy)(()=>$1(()=>import(`./highlighted-body-OFNGDK62-B8ljKzZr.js`).then(e=>({default:e.HighlightedCodeBlockBody})),__vite__mapDeps([0,1]))),M0=({code:e,language:t,className:n,children:r,isIncomplete:i=!1,startLine:a,lineNumbers:o,...s})=>{let c=S0(),l=(0,d.useMemo)(()=>A0(e),[e]),u=(0,d.useMemo)(()=>({bg:`transparent`,fg:`inherit`,tokens:l.split(`
442
442
  `).map(e=>[{content:e,color:`inherit`,bgColor:`transparent`,htmlStyle:{},offset:0}])}),[l]);return(0,E.jsx)(D0.Provider,{value:{code:e},children:(0,E.jsxs)(E0,{isIncomplete:i,language:t,children:[(0,E.jsx)(k0,{language:t}),r?(0,E.jsx)(`div`,{className:c(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,E.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,E.jsx)(d.Suspense,{fallback:(0,E.jsx)(T0,{className:n,language:t,lineNumbers:o,result:u,startLine:a,...s}),children:(0,E.jsx)(j0,{className:n,code:l,language:t,lineNumbers:o,raw:u,startLine:a,...s})})]})})},N0={CheckIcon:e=>(0,E.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,E.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,E.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,E.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,E.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,E.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,E.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,E.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,E.jsxs)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:[(0,E.jsx)(`path`,{d:`M8 0V4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,E.jsx)(`path`,{d:`M8 16V12`,opacity:`0.5`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,E.jsx)(`path`,{d:`M3.29773 1.52783L5.64887 4.7639`,opacity:`0.9`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,E.jsx)(`path`,{d:`M12.7023 1.52783L10.3511 4.7639`,opacity:`0.1`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,E.jsx)(`path`,{d:`M12.7023 14.472L10.3511 11.236`,opacity:`0.4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,E.jsx)(`path`,{d:`M3.29773 14.472L5.64887 11.236`,opacity:`0.6`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,E.jsx)(`path`,{d:`M15.6085 5.52783L11.8043 6.7639`,opacity:`0.2`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,E.jsx)(`path`,{d:`M0.391602 10.472L4.19583 9.23598`,opacity:`0.7`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,E.jsx)(`path`,{d:`M15.6085 10.4722L11.8043 9.2361`,opacity:`0.3`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,E.jsx)(`path`,{d:`M0.391602 5.52783L4.19583 6.7639`,opacity:`0.8`,stroke:`currentColor`,strokeWidth:`1.5`})]}),Maximize2Icon:e=>(0,E.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,E.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,E.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,E.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,E.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,E.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,E.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,E.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,E.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,E.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`})})},P0=(0,d.createContext)(N0),F0=(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])},I0=({icons:e,children:t})=>{let n=(0,d.useRef)(e),r=(0,d.useRef)(e?{...N0,...e}:N0);F0(n.current,e)||(n.current=e,r.current=e?{...N0,...e}:N0);let i=r.current;return(0,E.jsx)(P0.Provider,{value:i,children:t})},L0=()=>(0,d.useContext)(P0),R0={copyCode:`Copy Code`,downloadFile:`Download file`,downloadDiagram:`Download diagram`,downloadDiagramAsSvg:`Download diagram as SVG`,downloadDiagramAsPng:`Download diagram as PNG`,downloadDiagramAsMmd:`Download diagram as MMD`,viewFullscreen:`View fullscreen`,exitFullscreen:`Exit fullscreen`,mermaidFormatSvg:`SVG`,mermaidFormatPng:`PNG`,mermaidFormatMmd:`MMD`,copyTable:`Copy table`,copyTableAsMarkdown:`Copy table as Markdown`,copyTableAsCsv:`Copy table as CSV`,copyTableAsTsv:`Copy table as TSV`,downloadTable:`Download table`,downloadTableAsCsv:`Download table as CSV`,downloadTableAsMarkdown:`Download table as Markdown`,tableFormatMarkdown:`Markdown`,tableFormatCsv:`CSV`,tableFormatTsv:`TSV`,imageNotAvailable:`Image not available`,downloadImage:`Download image`,openExternalLink:`Open external link?`,externalLinkWarning:`You're about to visit an external website.`,close:`Close`,copyLink:`Copy link`,copied:`Copied`,openLink:`Open link`},z0=(0,d.createContext)(R0),B0=()=>(0,d.useContext)(z0),V0=({onCopy:e,onError:t,timeout:n=2e3,children:r,className:i,code:a,...o})=>{let s=S0(),[c,l]=(0,d.useState)(!1),u=(0,d.useRef)(0),{code:f}=O0(),{isAnimating:p}=(0,d.useContext)(q4),m=B0(),h=a??f,g=async()=>{var r;if(typeof window>`u`||!((r=navigator==null?void 0:navigator.clipboard)!=null&&r.writeText)){t?.(Error(`Clipboard API not available`));return}try{c||(await navigator.clipboard.writeText(h),l(!0),e?.(),u.current=window.setTimeout(()=>l(!1),n))}catch(e){t?.(e)}};(0,d.useEffect)(()=>()=>{window.clearTimeout(u.current)},[]);let _=L0(),v=c?_.CheckIcon:_.CopyIcon;return(0,E.jsx)(`button`,{className:s(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),"data-streamdown":`code-block-copy-button`,disabled:p,onClick:g,title:m.copyCode,type:`button`,...o,children:r??(0,E.jsx)(v,{size:14})})},H0={"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`},U0=({onDownload:e,onError:t,language:n,children:r,className:i,code:a,...o})=>{let s=S0(),{code:c}=O0(),{isAnimating:l}=(0,d.useContext)(q4),u=B0(),f=L0(),p=a??c,m=`file.${n&&n in H0?H0[n]:`txt`}`;return(0,E.jsx)(`button`,{className:s(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),"data-streamdown":`code-block-download-button`,disabled:l,onClick:()=>{try{b0(m,p,`text/plain`),e?.()}catch(e){t?.(e)}},title:u.downloadFile,type:`button`,...o,children:r??(0,E.jsx)(f.DownloadIcon,{size:14})})},W0=()=>{let{Loader2Icon:e}=L0(),t=S0();return(0,E.jsxs)(`div`,{className:t(`w-full divide-y divide-border overflow-hidden rounded-xl border border-border`),children:[(0,E.jsx)(`div`,{className:t(`h-[46px] w-full bg-muted/80`)}),(0,E.jsx)(`div`,{className:t(`flex w-full items-center justify-center p-4`),children:(0,E.jsx)(e,{className:t(`size-4 animate-spin`)})})]})},G0=/\.[^/.]+$/,K0=({node:e,className:t,src:n,alt:r,onLoad:i,onError:a,...o})=>{let{DownloadIcon:s}=L0(),c=S0(),l=(0,d.useRef)(null),[u,f]=(0,d.useState)(!1),[p,m]=(0,d.useState)(!1),h=B0(),g=o.width!=null||o.height!=null,_=(u||g)&&!p,v=p&&!g;(0,d.useEffect)(()=>{let e=l.current;if(e!=null&&e.complete){let t=e.naturalWidth>0;f(t),m(!t)}},[]);let y=(0,d.useCallback)(e=>{f(!0),m(!1),i?.(e)},[i]),b=(0,d.useCallback)(e=>{f(!1),m(!0),a?.(e)},[a]),x=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(G0,``)}.${i}`}b0(o,e,e.type)}catch{window.open(n,`_blank`)}};return n?(0,E.jsxs)(`div`,{className:c(`group relative my-4 inline-block`),"data-streamdown":`image-wrapper`,children:[(0,E.jsx)(`img`,{alt:r,className:c(`max-w-full rounded-lg`,v&&`hidden`,t),"data-streamdown":`image`,onError:b,onLoad:y,ref:l,src:n,...o}),v&&(0,E.jsx)(`span`,{className:c(`text-muted-foreground text-xs italic`),"data-streamdown":`image-fallback`,children:h.imageNotAvailable}),(0,E.jsx)(`div`,{className:c(`pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block`)}),_&&(0,E.jsx)(`button`,{className:c(`absolute right-2 bottom-2 flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background/90 shadow-sm backdrop-blur-sm transition-all duration-200 hover:bg-background`,`opacity-0 group-hover:opacity-100`),onClick:x,title:h.downloadImage,type:`button`,children:(0,E.jsx)(s,{size:14})})]}):null},q0=0,J0=()=>{q0+=1,q0===1&&(document.body.style.overflow=`hidden`)},Y0=()=>{q0=Math.max(0,q0-1),q0===0&&(document.body.style.overflow=``)},X0=({url:e,isOpen:t,onClose:n,onConfirm:r})=>{let{CheckIcon:i,CopyIcon:a,ExternalLinkIcon:o,XIcon:s}=L0(),c=S0(),[l,u]=(0,d.useState)(!1),f=B0(),p=(0,d.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),u(!0),setTimeout(()=>u(!1),2e3)}catch{}},[e]),m=(0,d.useCallback)(()=>{r(),n()},[r,n]);return(0,d.useEffect)(()=>{if(t){J0();let e=e=>{e.key===`Escape`&&n()};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),Y0()}}},[t,n]),t?(0,E.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,E.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,E.jsx)(`button`,{className:c(`absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:n,title:f.close,type:`button`,children:(0,E.jsx)(s,{size:16})}),(0,E.jsxs)(`div`,{className:c(`flex flex-col gap-2`),children:[(0,E.jsxs)(`div`,{className:c(`flex items-center gap-2 font-semibold text-lg`),children:[(0,E.jsx)(o,{size:20}),(0,E.jsx)(`span`,{children:f.openExternalLink})]}),(0,E.jsx)(`p`,{className:c(`text-muted-foreground text-sm`),children:f.externalLinkWarning})]}),(0,E.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,E.jsxs)(`div`,{className:c(`flex gap-2`),children:[(0,E.jsx)(`button`,{className:c(`flex flex-1 items-center justify-center gap-2 rounded-md border bg-background px-4 py-2 font-medium text-sm transition-all hover:bg-muted`),onClick:p,type:`button`,children:l?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(i,{size:14}),(0,E.jsx)(`span`,{children:f.copied})]}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(a,{size:14}),(0,E.jsx)(`span`,{children:f.copyLink})]})}),(0,E.jsxs)(`button`,{className:c(`flex flex-1 items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 font-medium text-primary-foreground text-sm transition-all hover:bg-primary/90`),onClick:m,type:`button`,children:[(0,E.jsx)(o,{size:14}),(0,E.jsx)(`span`,{children:f.openLink})]})]})]})}):null},Z0=(0,d.createContext)(null),Q0=()=>(0,d.useContext)(Z0),$0=()=>Q0()?.code??null,e2=()=>Q0()?.mermaid??null,t2=e=>{var t;let n=Q0();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},n2=(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}),r2=({chart:e,children:t,className:n,onDownload:r,config:i,onError:a})=>{let o=S0(),[s,c]=(0,d.useState)(!1),l=(0,d.useRef)(null),{isAnimating:u}=(0,d.useContext)(q4),f=L0(),p=e2(),m=B0(),h=async t=>{try{if(t===`mmd`){b0(`diagram.mmd`,e,`text/plain`),c(!1),r?.(t);return}if(!p){a?.(Error(`Mermaid plugin not available`));return}let n=p.getMermaid(i),o=e.split(``).reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0),s=`mermaid-${Math.abs(o)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:l}=await n.render(s,e);if(!l){a?.(Error(`SVG not found. Please wait for the diagram to render.`));return}if(t===`svg`){b0(`diagram.svg`,l,`image/svg+xml`),c(!1),r?.(t);return}if(t===`png`){b0(`diagram.png`,await n2(l),`image/png`),r?.(t),c(!1);return}}catch(e){a?.(e)}};return(0,d.useEffect)(()=>{let e=e=>{let t=e.composedPath();l.current&&!t.includes(l.current)&&c(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,E.jsxs)(`div`,{className:o(`relative`),ref:l,children:[(0,E.jsx)(`button`,{className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,n),disabled:u,onClick:()=>c(!s),title:m.downloadDiagram,type:`button`,children:t??(0,E.jsx)(f.DownloadIcon,{size:14})}),s?(0,E.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,E.jsx)(`button`,{className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>h(`svg`),title:m.downloadDiagramAsSvg,type:`button`,children:m.mermaidFormatSvg}),(0,E.jsx)(`button`,{className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>h(`png`),title:m.downloadDiagramAsPng,type:`button`,children:m.mermaidFormatPng}),(0,E.jsx)(`button`,{className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>h(`mmd`),title:m.downloadDiagramAsMmd,type:`button`,children:m.mermaidFormatMmd})]}):null]})},i2=({chart:e,config:t,onFullscreen:n,onExit:r,className:i,...a})=>{let{Maximize2Icon:o,XIcon:s}=L0(),c=S0(),[l,u]=(0,d.useState)(!1),{isAnimating:f,controls:p}=(0,d.useContext)(q4),m=B0(),h=(()=>{if(typeof p==`boolean`)return p;let e=p.mermaid;return e===!1?!1:e===!0||e===void 0||e.panZoom!==!1})(),g=()=>{u(!l)};return(0,d.useEffect)(()=>{if(l){J0();let e=e=>{e.key===`Escape`&&u(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),Y0()}}},[l]),(0,d.useEffect)(()=>{l?n?.():r&&r()},[l,n,r]),(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`button`,{className:c(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),disabled:f,onClick:g,title:m.viewFullscreen,type:`button`,...a,children:(0,E.jsx)(o,{size:14})}),l?(0,ii.createPortal)((0,E.jsxs)(`div`,{className:c(`fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm`),onClick:g,onKeyDown:e=>{e.key===`Escape`&&g()},role:`button`,tabIndex:0,children:[(0,E.jsx)(`button`,{className:c(`absolute top-4 right-4 z-10 rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:g,title:m.exitFullscreen,type:`button`,children:(0,E.jsx)(s,{size:20})}),(0,E.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,E.jsx)(Z4,{chart:e,className:c(`size-full [&_svg]:h-auto [&_svg]:w-auto`),config:t,fullscreen:!0,showControls:h})})]}),document.body):null]})},a2=e=>{let t=[],n=[],r=e.querySelectorAll(`thead th`);for(let e of r)t.push(e.textContent?.trim()||``);let i=e.querySelectorAll(`tbody tr`);for(let e of i){let t=[],r=e.querySelectorAll(`td`);for(let e of r)t.push(e.textContent?.trim()||``);n.push(t)}return{headers:t,rows:n}},o2=e=>{let{headers:t,rows:n}=e,r=e=>{let t=!1,n=!1;for(let r of e){if(r===`"`){t=!0,n=!0;break}(r===`,`||r===`
443
443
  `)&&(t=!0)}return t?n?`"${e.replace(/"/g,`""`)}"`:`"${e}"`:e},i=t.length>0?n.length+1:n.length,a=Array(i),o=0;t.length>0&&(a[o]=t.map(r).join(`,`),o+=1);for(let e of n)a[o]=e.map(r).join(`,`),o+=1;return a.join(`
444
444
  `)},s2=e=>{let{headers:t,rows:n}=e,r=e=>{let t=!1;for(let n of e)if(n===` `||n===`
445
445
  `||n===`\r`){t=!0;break}if(!t)return e;let n=[];for(let t of e)t===` `?n.push(`\\t`):t===`
446
446
  `?n.push(`\\n`):t===`\r`?n.push(`\\r`):n.push(t);return n.join(``)},i=t.length>0?n.length+1:n.length,a=Array(i),o=0;t.length>0&&(a[o]=t.map(r).join(` `),o+=1);for(let e of n)a[o]=e.map(r).join(` `),o+=1;return a.join(`
447
447
  `)},c2=e=>{let t=!1;for(let n of e)if(n===`\\`||n===`|`){t=!0;break}if(!t)return e;let n=[];for(let t of e)t===`\\`?n.push(`\\\\`):t===`|`?n.push(`\\|`):n.push(t);return n.join(``)},l2=e=>{let{headers:t,rows:n}=e;if(t.length===0)return``;let r=Array(n.length+2),i=0,a=t.map(e=>c2(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?c2(e[r]):``;r[i]=`| ${n.join(` | `)} |`,i+=1}else{let t=e.map(e=>c2(e));r[i]=`| ${t.join(` | `)} |`,i+=1}return r.join(`
448
- `)},u2=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let a=S0(),[o,s]=(0,d.useState)(!1),[c,l]=(0,d.useState)(!1),u=(0,d.useRef)(null),f=(0,d.useRef)(0),{isAnimating:p}=(0,d.useContext)(q4),m=B0(),h=async e=>{var t;if(typeof window>`u`||!((t=navigator==null?void 0:navigator.clipboard)!=null&&t.write)){r?.(Error(`Clipboard API not available`));return}try{let t=(u.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let a=a2(t),o=({csv:o2,tsv:s2,md:l2}[e]||l2)(a),c=new ClipboardItem({"text/plain":new Blob([o],{type:`text/plain`}),"text/html":new Blob([t.outerHTML],{type:`text/html`})});await navigator.clipboard.write([c]),l(!0),s(!1),n?.(e),f.current=window.setTimeout(()=>l(!1),i)}catch(e){r?.(e)}};(0,d.useEffect)(()=>{let e=e=>{let t=e.composedPath();u.current&&!t.includes(u.current)&&s(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e),window.clearTimeout(f.current)}},[]);let g=L0(),_=c?g.CheckIcon:g.CopyIcon;return(0,E.jsxs)(`div`,{className:a(`relative`),ref:u,children:[(0,E.jsx)(`button`,{className:a(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:p,onClick:()=>s(!o),title:m.copyTable,type:`button`,children:e??(0,E.jsx)(_,{height:14,width:14})}),o?(0,E.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,E.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>h(`md`),title:m.copyTableAsMarkdown,type:`button`,children:m.tableFormatMarkdown}),(0,E.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>h(`csv`),title:m.copyTableAsCsv,type:`button`,children:m.tableFormatCsv}),(0,E.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>h(`tsv`),title:m.copyTableAsTsv,type:`button`,children:m.tableFormatTsv})]}):null]})},d2=({children:e,className:t,onDownload:n,onError:r})=>{let i=S0(),[a,o]=(0,d.useState)(!1),s=(0,d.useRef)(null),{isAnimating:c}=(0,d.useContext)(q4),l=B0(),u=L0(),f=e=>{try{let t=(s.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let i=a2(t),a=e===`csv`?o2(i):l2(i);b0(`table.${e===`csv`?`csv`:`md`}`,a,e===`csv`?`text/csv`:`text/markdown`),o(!1),n?.(e)}catch(e){r?.(e)}};return(0,d.useEffect)(()=>{let e=e=>{let t=e.composedPath();s.current&&!t.includes(s.current)&&o(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,E.jsxs)(`div`,{className:i(`relative`),ref:s,children:[(0,E.jsx)(`button`,{className:i(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:c,onClick:()=>o(!a),title:l.downloadTable,type:`button`,children:e??(0,E.jsx)(u.DownloadIcon,{size:14})}),a?(0,E.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,E.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>f(`csv`),title:l.downloadTableAsCsv,type:`button`,children:l.tableFormatCsv}),(0,E.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>f(`markdown`),title:l.downloadTableAsMarkdown,type:`button`,children:l.tableFormatMarkdown})]}):null]})},f2=({children:e,className:t,showCopy:n=!0,showDownload:r=!0})=>{let{Maximize2Icon:i,XIcon:a}=L0(),o=S0(),[s,c]=(0,d.useState)(!1),{isAnimating:l}=(0,d.useContext)(q4),u=B0(),f=()=>{c(!0)},p=()=>{c(!1)};return(0,d.useEffect)(()=>{if(s){J0();let e=e=>{e.key===`Escape`&&c(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),Y0()}}},[s]),(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`button`,{className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:l,onClick:f,title:u.viewFullscreen,type:`button`,children:(0,E.jsx)(i,{size:14})}),s?(0,ii.createPortal)((0,E.jsx)(`div`,{"aria-label":u.viewFullscreen,"aria-modal":`true`,className:o(`fixed inset-0 z-50 flex flex-col bg-background`),"data-streamdown":`table-fullscreen`,onClick:p,onKeyDown:e=>{e.key===`Escape`&&p()},role:`dialog`,children:(0,E.jsxs)(`div`,{className:o(`flex h-full flex-col`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,E.jsxs)(`div`,{className:o(`flex items-center justify-end gap-1 p-4`),children:[n?(0,E.jsx)(u2,{}):null,r?(0,E.jsx)(d2,{}):null,(0,E.jsx)(`button`,{className:o(`rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:p,title:u.exitFullscreen,type:`button`,children:(0,E.jsx)(a,{size:20})})]}),(0,E.jsx)(`div`,{className:o(`flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10`),children:(0,E.jsx)(`table`,{className:o(`w-full border-collapse border border-border`),"data-streamdown":`table`,children:e})})]})}),document.body):null]})},p2=({children:e,className:t,showControls:n,showCopy:r=!0,showDownload:i=!0,showFullscreen:a=!0,...o})=>{let s=S0(),c=n&&r,l=n&&i,u=n&&a,d=c||l||u;return(0,E.jsxs)(`div`,{className:s(`my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2`),"data-streamdown":`table-wrapper`,children:[d?(0,E.jsxs)(`div`,{className:s(`flex items-center justify-end gap-1`),children:[c?(0,E.jsx)(u2,{}):null,l?(0,E.jsx)(d2,{}):null,u?(0,E.jsx)(f2,{showCopy:c,showDownload:l,children:e}):null]}):null,(0,E.jsx)(`div`,{className:s(`border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background`),children:(0,E.jsx)(`table`,{className:s(`w-full divide-y divide-border`,t),"data-streamdown":`table`,...o,children:e})})]})},m2=/startLine=(\d+)/,h2=/\bnoLineNumbers\b/,g2=(0,d.lazy)(()=>$1(()=>import(`./mermaid-GHXKKRXX-BNiS2a30.js`).then(e=>({default:e.Mermaid})),[])),_2=/language-([^\s]+)/;function v2(e,t){if(!(e!=null&&e.position||t!=null&&t.position))return!0;if(!(e!=null&&e.position&&t!=null&&t.position))return!1;let n=e.position.start,r=t.position.start,i=e.position.end,a=t.position.end;return n?.line===r?.line&&n?.column===r?.column&&i?.line===a?.line&&i?.column===a?.column}function y2(e,t){return e.className===t.className&&v2(e.node,t.node)}var b2=(e,t)=>typeof e==`boolean`?e:e[t]!==!1,x2=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.table;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},S2=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.code;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},C2=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.mermaid;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},w2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`ol`,{className:i(`list-inside list-decimal whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`ordered-list`,...r,children:e})},(e,t)=>y2(e,t));w2.displayName=`MarkdownOl`;var T2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`li`,{className:i(`py-1 [&>p]:inline`,t),"data-streamdown":`list-item`,...r,children:e})},(e,t)=>e.className===t.className&&v2(e.node,t.node));T2.displayName=`MarkdownLi`;var E2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`ul`,{className:i(`list-inside list-disc whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`unordered-list`,...r,children:e})},(e,t)=>y2(e,t));E2.displayName=`MarkdownUl`;var D2=(0,d.memo)(({className:e,node:t,...n})=>{let r=S0();return(0,E.jsx)(`hr`,{className:r(`my-6 border-border`,e),"data-streamdown":`horizontal-rule`,...n})},(e,t)=>y2(e,t));D2.displayName=`MarkdownHr`;var O2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`span`,{className:i(`font-semibold`,t),"data-streamdown":`strong`,...r,children:e})},(e,t)=>y2(e,t));O2.displayName=`MarkdownStrong`;var k2=(0,d.memo)(({children:e,className:t,href:n,node:r,...i})=>{let a=S0(),{linkSafety:o}=(0,d.useContext)(q4),[s,c]=(0,d.useState)(!1),l=n===`streamdown:incomplete-link`,u=(0,d.useCallback)(async e=>{if(!(!(o!=null&&o.enabled&&n)||l)){if(e.preventDefault(),o.onLinkCheck&&await o.onLinkCheck(n)){window.open(n,`_blank`,`noreferrer`);return}c(!0)}},[o,n,l]),f=(0,d.useCallback)(()=>{n&&window.open(n,`_blank`,`noreferrer`)},[n]),p=(0,d.useCallback)(()=>{c(!1)},[]),m={url:n??``,isOpen:s,onClose:p,onConfirm:f};return o!=null&&o.enabled&&n?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`button`,{className:a(`wrap-anywhere appearance-none text-left font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,onClick:u,type:`button`,children:e}),o.renderModal?o.renderModal(m):(0,E.jsx)(X0,{...m})]}):(0,E.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)=>y2(e,t)&&e.href===t.href);k2.displayName=`MarkdownA`;var A2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`h1`,{className:i(`mt-6 mb-2 font-semibold text-3xl`,t),"data-streamdown":`heading-1`,...r,children:e})},(e,t)=>y2(e,t));A2.displayName=`MarkdownH1`;var j2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`h2`,{className:i(`mt-6 mb-2 font-semibold text-2xl`,t),"data-streamdown":`heading-2`,...r,children:e})},(e,t)=>y2(e,t));j2.displayName=`MarkdownH2`;var M2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`h3`,{className:i(`mt-6 mb-2 font-semibold text-xl`,t),"data-streamdown":`heading-3`,...r,children:e})},(e,t)=>y2(e,t));M2.displayName=`MarkdownH3`;var N2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`h4`,{className:i(`mt-6 mb-2 font-semibold text-lg`,t),"data-streamdown":`heading-4`,...r,children:e})},(e,t)=>y2(e,t));N2.displayName=`MarkdownH4`;var P2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`h5`,{className:i(`mt-6 mb-2 font-semibold text-base`,t),"data-streamdown":`heading-5`,...r,children:e})},(e,t)=>y2(e,t));P2.displayName=`MarkdownH5`;var F2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`h6`,{className:i(`mt-6 mb-2 font-semibold text-sm`,t),"data-streamdown":`heading-6`,...r,children:e})},(e,t)=>y2(e,t));F2.displayName=`MarkdownH6`;var I2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let{controls:i}=(0,d.useContext)(q4),a=b2(i,`table`),o=x2(i,`copy`),s=x2(i,`download`),c=x2(i,`fullscreen`);return(0,E.jsx)(p2,{className:t,showControls:a,showCopy:o,showDownload:s,showFullscreen:c,...r,children:e})},(e,t)=>y2(e,t));I2.displayName=`MarkdownTable`;var L2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`thead`,{className:i(`bg-muted/80`,t),"data-streamdown":`table-header`,...r,children:e})},(e,t)=>y2(e,t));L2.displayName=`MarkdownThead`;var R2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`tbody`,{className:i(`divide-y divide-border`,t),"data-streamdown":`table-body`,...r,children:e})},(e,t)=>y2(e,t));R2.displayName=`MarkdownTbody`;var z2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`tr`,{className:i(`border-border`,t),"data-streamdown":`table-row`,...r,children:e})},(e,t)=>y2(e,t));z2.displayName=`MarkdownTr`;var B2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.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)=>y2(e,t));B2.displayName=`MarkdownTh`;var V2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`td`,{className:i(`px-4 py-2 text-sm`,t),"data-streamdown":`table-cell`,...r,children:e})},(e,t)=>y2(e,t));V2.displayName=`MarkdownTd`;var H2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.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)=>y2(e,t));H2.displayName=`MarkdownBlockquote`;var U2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`sup`,{className:i(`text-sm`,t),"data-streamdown":`superscript`,...r,children:e})},(e,t)=>y2(e,t));U2.displayName=`MarkdownSup`;var W2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`sub`,{className:i(`text-sm`,t),"data-streamdown":`subscript`,...r,children:e})},(e,t)=>y2(e,t));W2.displayName=`MarkdownSub`;var G2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{if(`data-footnotes`in r){let n=e=>{if(!(0,d.isValidElement)(e))return!1;let t=Array.isArray(e.props.children)?e.props.children:[e.props.children],n=!1,r=!1;for(let e of t)if(e){if(typeof e==`string`)e.trim()!==``&&(n=!0);else if((0,d.isValidElement)(e)){if(e.props?.[`data-footnote-backref`]!==void 0)r=!0;else{let t=Array.isArray(e.props.children)?e.props.children:[e.props.children];for(let e of t){if(typeof e==`string`&&e.trim()!==``){n=!0;break}if((0,d.isValidElement)(e)&&e.props?.[`data-footnote-backref`]===void 0){n=!0;break}}}}}return r&&!n},i=Array.isArray(e)?e.map(e=>{if(!(0,d.isValidElement)(e))return e;if(e.type===w2){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,E.jsx)(`section`,{className:t,...r,children:i}):null}return(0,E.jsx)(`section`,{className:t,...r,children:e})},(e,t)=>y2(e,t));G2.displayName=`MarkdownSection`;var K2=(0,d.memo)(({node:e,className:t,children:n,...r})=>{let i=S0(),a=!(`data-block`in r),{mermaid:o,controls:s,lineNumbers:c}=(0,d.useContext)(q4),l=e2(),u=g0(),f=(t?.match(_2))?.at(1)??``,p=t2(f);if(a)return(0,E.jsx)(`code`,{className:i(`rounded bg-muted px-1.5 py-0.5 font-mono text-sm`,t),"data-streamdown":`inline-code`,...r,children:n});let m=e?.properties?.metastring,h=m?.match(m2),g=h?Number.parseInt(h[1],10):void 0,_=g!==void 0&&g>=1?g:void 0,v=!(m&&h2.test(m))&&c!==!1,y=``;if((0,d.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),p){let e=p.component;return(0,E.jsx)(d.Suspense,{fallback:(0,E.jsx)(W0,{}),children:(0,E.jsx)(e,{code:y,isIncomplete:u,language:f,meta:m})})}if(f===`mermaid`&&l){let e=b2(s,`mermaid`),n=C2(s,`download`),r=C2(s,`copy`),a=C2(s,`fullscreen`),c=C2(s,`panZoom`),l=e&&(n||r||a);return(0,E.jsx)(d.Suspense,{fallback:(0,E.jsx)(W0,{}),children:(0,E.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,E.jsx)(`div`,{className:i(`flex h-8 items-center text-muted-foreground text-xs`),children:(0,E.jsx)(`span`,{className:i(`ml-1 font-mono lowercase`),children:`mermaid`})}),l?(0,E.jsx)(`div`,{className:i(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,E.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,E.jsx)(r2,{chart:y,config:o?.config}):null,r?(0,E.jsx)(V0,{code:y}):null,a?(0,E.jsx)(i2,{chart:y,config:o?.config}):null]})}):null,(0,E.jsx)(`div`,{className:i(`rounded-md border border-border bg-background`),children:(0,E.jsx)(g2,{chart:y,config:o?.config,showControls:c})})]})})}let b=b2(s,`code`),x=S2(s,`download`),S=S2(s,`copy`);return(0,E.jsx)(M0,{className:t,code:y,isIncomplete:u,language:f,lineNumbers:v,startLine:_,children:b?(0,E.jsxs)(E.Fragment,{children:[x?(0,E.jsx)(U0,{code:y,language:f}):null,S?(0,E.jsx)(V0,{}):null]}):null})},(e,t)=>e.className===t.className&&v2(e.node,t.node));K2.displayName=`MarkdownCode`;var q2=(0,d.memo)(K0,(e,t)=>e.className===t.className&&v2(e.node,t.node));q2.displayName=`MarkdownImg`;var J2=(0,d.memo)(({children:e,node:t,...n})=>{let r=(Array.isArray(e)?e:[e]).filter(e=>e!=null&&e!==``);if(r.length===1&&(0,d.isValidElement)(r[0])){let t=r[0].props.node?.tagName;if(t===`img`||t===`code`&&`data-block`in r[0].props)return(0,E.jsx)(E.Fragment,{children:e})}return(0,E.jsx)(`p`,{...n,children:e})},(e,t)=>y2(e,t));J2.displayName=`MarkdownParagraph`;var Y2={ol:w2,li:T2,ul:E2,hr:D2,strong:O2,a:k2,h1:A2,h2:j2,h3:M2,h4:N2,h5:P2,h6:F2,table:I2,thead:L2,tbody:R2,tr:z2,th:B2,td:V2,blockquote:H2,code:K2,img:q2,pre:({children:e})=>(0,d.isValidElement)(e)?(0,d.cloneElement)(e,{"data-block":`true`}):e,sup:U2,sub:W2,p:J2,section:G2},X2=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,Z2=/\p{L}/u;function Q2(e){let t=e.replace(/^#{1,6}\s+/gm,``).replace(/(\*{1,3}|_{1,3})/g,``).replace(/`[^`]*`/g,``).replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/^[\s>*\-+\d.]+/gm,``);for(let e of t){if(X2.test(e))return`rtl`;if(Z2.test(e))return`ltr`}return`ltr`}var $2=/^[ \t]{0,3}(`{3,}|~{3,})/,e4=/^\|?[ \t]*:?-{1,}:?[ \t]*(\|[ \t]*:?-{1,}:?[ \t]*)*\|?$/,t4=e=>{let t=e.split(`
448
+ `)},u2=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let a=S0(),[o,s]=(0,d.useState)(!1),[c,l]=(0,d.useState)(!1),u=(0,d.useRef)(null),f=(0,d.useRef)(0),{isAnimating:p}=(0,d.useContext)(q4),m=B0(),h=async e=>{var t;if(typeof window>`u`||!((t=navigator==null?void 0:navigator.clipboard)!=null&&t.write)){r?.(Error(`Clipboard API not available`));return}try{let t=(u.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let a=a2(t),o=({csv:o2,tsv:s2,md:l2}[e]||l2)(a),c=new ClipboardItem({"text/plain":new Blob([o],{type:`text/plain`}),"text/html":new Blob([t.outerHTML],{type:`text/html`})});await navigator.clipboard.write([c]),l(!0),s(!1),n?.(e),f.current=window.setTimeout(()=>l(!1),i)}catch(e){r?.(e)}};(0,d.useEffect)(()=>{let e=e=>{let t=e.composedPath();u.current&&!t.includes(u.current)&&s(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e),window.clearTimeout(f.current)}},[]);let g=L0(),_=c?g.CheckIcon:g.CopyIcon;return(0,E.jsxs)(`div`,{className:a(`relative`),ref:u,children:[(0,E.jsx)(`button`,{className:a(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:p,onClick:()=>s(!o),title:m.copyTable,type:`button`,children:e??(0,E.jsx)(_,{height:14,width:14})}),o?(0,E.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,E.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>h(`md`),title:m.copyTableAsMarkdown,type:`button`,children:m.tableFormatMarkdown}),(0,E.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>h(`csv`),title:m.copyTableAsCsv,type:`button`,children:m.tableFormatCsv}),(0,E.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>h(`tsv`),title:m.copyTableAsTsv,type:`button`,children:m.tableFormatTsv})]}):null]})},d2=({children:e,className:t,onDownload:n,onError:r})=>{let i=S0(),[a,o]=(0,d.useState)(!1),s=(0,d.useRef)(null),{isAnimating:c}=(0,d.useContext)(q4),l=B0(),u=L0(),f=e=>{try{let t=(s.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let i=a2(t),a=e===`csv`?o2(i):l2(i);b0(`table.${e===`csv`?`csv`:`md`}`,a,e===`csv`?`text/csv`:`text/markdown`),o(!1),n?.(e)}catch(e){r?.(e)}};return(0,d.useEffect)(()=>{let e=e=>{let t=e.composedPath();s.current&&!t.includes(s.current)&&o(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,E.jsxs)(`div`,{className:i(`relative`),ref:s,children:[(0,E.jsx)(`button`,{className:i(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:c,onClick:()=>o(!a),title:l.downloadTable,type:`button`,children:e??(0,E.jsx)(u.DownloadIcon,{size:14})}),a?(0,E.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,E.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>f(`csv`),title:l.downloadTableAsCsv,type:`button`,children:l.tableFormatCsv}),(0,E.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>f(`markdown`),title:l.downloadTableAsMarkdown,type:`button`,children:l.tableFormatMarkdown})]}):null]})},f2=({children:e,className:t,showCopy:n=!0,showDownload:r=!0})=>{let{Maximize2Icon:i,XIcon:a}=L0(),o=S0(),[s,c]=(0,d.useState)(!1),{isAnimating:l}=(0,d.useContext)(q4),u=B0(),f=()=>{c(!0)},p=()=>{c(!1)};return(0,d.useEffect)(()=>{if(s){J0();let e=e=>{e.key===`Escape`&&c(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),Y0()}}},[s]),(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`button`,{className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:l,onClick:f,title:u.viewFullscreen,type:`button`,children:(0,E.jsx)(i,{size:14})}),s?(0,ii.createPortal)((0,E.jsx)(`div`,{"aria-label":u.viewFullscreen,"aria-modal":`true`,className:o(`fixed inset-0 z-50 flex flex-col bg-background`),"data-streamdown":`table-fullscreen`,onClick:p,onKeyDown:e=>{e.key===`Escape`&&p()},role:`dialog`,children:(0,E.jsxs)(`div`,{className:o(`flex h-full flex-col`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,E.jsxs)(`div`,{className:o(`flex items-center justify-end gap-1 p-4`),children:[n?(0,E.jsx)(u2,{}):null,r?(0,E.jsx)(d2,{}):null,(0,E.jsx)(`button`,{className:o(`rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:p,title:u.exitFullscreen,type:`button`,children:(0,E.jsx)(a,{size:20})})]}),(0,E.jsx)(`div`,{className:o(`flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10`),children:(0,E.jsx)(`table`,{className:o(`w-full border-collapse border border-border`),"data-streamdown":`table`,children:e})})]})}),document.body):null]})},p2=({children:e,className:t,showControls:n,showCopy:r=!0,showDownload:i=!0,showFullscreen:a=!0,...o})=>{let s=S0(),c=n&&r,l=n&&i,u=n&&a,d=c||l||u;return(0,E.jsxs)(`div`,{className:s(`my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2`),"data-streamdown":`table-wrapper`,children:[d?(0,E.jsxs)(`div`,{className:s(`flex items-center justify-end gap-1`),children:[c?(0,E.jsx)(u2,{}):null,l?(0,E.jsx)(d2,{}):null,u?(0,E.jsx)(f2,{showCopy:c,showDownload:l,children:e}):null]}):null,(0,E.jsx)(`div`,{className:s(`border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background`),children:(0,E.jsx)(`table`,{className:s(`w-full divide-y divide-border`,t),"data-streamdown":`table`,...o,children:e})})]})},m2=/startLine=(\d+)/,h2=/\bnoLineNumbers\b/,g2=(0,d.lazy)(()=>$1(()=>import(`./mermaid-GHXKKRXX-CL5fSR23.js`).then(e=>({default:e.Mermaid})),[])),_2=/language-([^\s]+)/;function v2(e,t){if(!(e!=null&&e.position||t!=null&&t.position))return!0;if(!(e!=null&&e.position&&t!=null&&t.position))return!1;let n=e.position.start,r=t.position.start,i=e.position.end,a=t.position.end;return n?.line===r?.line&&n?.column===r?.column&&i?.line===a?.line&&i?.column===a?.column}function y2(e,t){return e.className===t.className&&v2(e.node,t.node)}var b2=(e,t)=>typeof e==`boolean`?e:e[t]!==!1,x2=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.table;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},S2=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.code;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},C2=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.mermaid;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},w2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`ol`,{className:i(`list-inside list-decimal whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`ordered-list`,...r,children:e})},(e,t)=>y2(e,t));w2.displayName=`MarkdownOl`;var T2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`li`,{className:i(`py-1 [&>p]:inline`,t),"data-streamdown":`list-item`,...r,children:e})},(e,t)=>e.className===t.className&&v2(e.node,t.node));T2.displayName=`MarkdownLi`;var E2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`ul`,{className:i(`list-inside list-disc whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`unordered-list`,...r,children:e})},(e,t)=>y2(e,t));E2.displayName=`MarkdownUl`;var D2=(0,d.memo)(({className:e,node:t,...n})=>{let r=S0();return(0,E.jsx)(`hr`,{className:r(`my-6 border-border`,e),"data-streamdown":`horizontal-rule`,...n})},(e,t)=>y2(e,t));D2.displayName=`MarkdownHr`;var O2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`span`,{className:i(`font-semibold`,t),"data-streamdown":`strong`,...r,children:e})},(e,t)=>y2(e,t));O2.displayName=`MarkdownStrong`;var k2=(0,d.memo)(({children:e,className:t,href:n,node:r,...i})=>{let a=S0(),{linkSafety:o}=(0,d.useContext)(q4),[s,c]=(0,d.useState)(!1),l=n===`streamdown:incomplete-link`,u=(0,d.useCallback)(async e=>{if(!(!(o!=null&&o.enabled&&n)||l)){if(e.preventDefault(),o.onLinkCheck&&await o.onLinkCheck(n)){window.open(n,`_blank`,`noreferrer`);return}c(!0)}},[o,n,l]),f=(0,d.useCallback)(()=>{n&&window.open(n,`_blank`,`noreferrer`)},[n]),p=(0,d.useCallback)(()=>{c(!1)},[]),m={url:n??``,isOpen:s,onClose:p,onConfirm:f};return o!=null&&o.enabled&&n?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`button`,{className:a(`wrap-anywhere appearance-none text-left font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,onClick:u,type:`button`,children:e}),o.renderModal?o.renderModal(m):(0,E.jsx)(X0,{...m})]}):(0,E.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)=>y2(e,t)&&e.href===t.href);k2.displayName=`MarkdownA`;var A2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`h1`,{className:i(`mt-6 mb-2 font-semibold text-3xl`,t),"data-streamdown":`heading-1`,...r,children:e})},(e,t)=>y2(e,t));A2.displayName=`MarkdownH1`;var j2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`h2`,{className:i(`mt-6 mb-2 font-semibold text-2xl`,t),"data-streamdown":`heading-2`,...r,children:e})},(e,t)=>y2(e,t));j2.displayName=`MarkdownH2`;var M2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`h3`,{className:i(`mt-6 mb-2 font-semibold text-xl`,t),"data-streamdown":`heading-3`,...r,children:e})},(e,t)=>y2(e,t));M2.displayName=`MarkdownH3`;var N2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`h4`,{className:i(`mt-6 mb-2 font-semibold text-lg`,t),"data-streamdown":`heading-4`,...r,children:e})},(e,t)=>y2(e,t));N2.displayName=`MarkdownH4`;var P2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`h5`,{className:i(`mt-6 mb-2 font-semibold text-base`,t),"data-streamdown":`heading-5`,...r,children:e})},(e,t)=>y2(e,t));P2.displayName=`MarkdownH5`;var F2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`h6`,{className:i(`mt-6 mb-2 font-semibold text-sm`,t),"data-streamdown":`heading-6`,...r,children:e})},(e,t)=>y2(e,t));F2.displayName=`MarkdownH6`;var I2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let{controls:i}=(0,d.useContext)(q4),a=b2(i,`table`),o=x2(i,`copy`),s=x2(i,`download`),c=x2(i,`fullscreen`);return(0,E.jsx)(p2,{className:t,showControls:a,showCopy:o,showDownload:s,showFullscreen:c,...r,children:e})},(e,t)=>y2(e,t));I2.displayName=`MarkdownTable`;var L2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`thead`,{className:i(`bg-muted/80`,t),"data-streamdown":`table-header`,...r,children:e})},(e,t)=>y2(e,t));L2.displayName=`MarkdownThead`;var R2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`tbody`,{className:i(`divide-y divide-border`,t),"data-streamdown":`table-body`,...r,children:e})},(e,t)=>y2(e,t));R2.displayName=`MarkdownTbody`;var z2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`tr`,{className:i(`border-border`,t),"data-streamdown":`table-row`,...r,children:e})},(e,t)=>y2(e,t));z2.displayName=`MarkdownTr`;var B2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.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)=>y2(e,t));B2.displayName=`MarkdownTh`;var V2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`td`,{className:i(`px-4 py-2 text-sm`,t),"data-streamdown":`table-cell`,...r,children:e})},(e,t)=>y2(e,t));V2.displayName=`MarkdownTd`;var H2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.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)=>y2(e,t));H2.displayName=`MarkdownBlockquote`;var U2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`sup`,{className:i(`text-sm`,t),"data-streamdown":`superscript`,...r,children:e})},(e,t)=>y2(e,t));U2.displayName=`MarkdownSup`;var W2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{let i=S0();return(0,E.jsx)(`sub`,{className:i(`text-sm`,t),"data-streamdown":`subscript`,...r,children:e})},(e,t)=>y2(e,t));W2.displayName=`MarkdownSub`;var G2=(0,d.memo)(({children:e,className:t,node:n,...r})=>{if(`data-footnotes`in r){let n=e=>{if(!(0,d.isValidElement)(e))return!1;let t=Array.isArray(e.props.children)?e.props.children:[e.props.children],n=!1,r=!1;for(let e of t)if(e){if(typeof e==`string`)e.trim()!==``&&(n=!0);else if((0,d.isValidElement)(e)){if(e.props?.[`data-footnote-backref`]!==void 0)r=!0;else{let t=Array.isArray(e.props.children)?e.props.children:[e.props.children];for(let e of t){if(typeof e==`string`&&e.trim()!==``){n=!0;break}if((0,d.isValidElement)(e)&&e.props?.[`data-footnote-backref`]===void 0){n=!0;break}}}}}return r&&!n},i=Array.isArray(e)?e.map(e=>{if(!(0,d.isValidElement)(e))return e;if(e.type===w2){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,E.jsx)(`section`,{className:t,...r,children:i}):null}return(0,E.jsx)(`section`,{className:t,...r,children:e})},(e,t)=>y2(e,t));G2.displayName=`MarkdownSection`;var K2=(0,d.memo)(({node:e,className:t,children:n,...r})=>{let i=S0(),a=!(`data-block`in r),{mermaid:o,controls:s,lineNumbers:c}=(0,d.useContext)(q4),l=e2(),u=g0(),f=(t?.match(_2))?.at(1)??``,p=t2(f);if(a)return(0,E.jsx)(`code`,{className:i(`rounded bg-muted px-1.5 py-0.5 font-mono text-sm`,t),"data-streamdown":`inline-code`,...r,children:n});let m=e?.properties?.metastring,h=m?.match(m2),g=h?Number.parseInt(h[1],10):void 0,_=g!==void 0&&g>=1?g:void 0,v=!(m&&h2.test(m))&&c!==!1,y=``;if((0,d.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),p){let e=p.component;return(0,E.jsx)(d.Suspense,{fallback:(0,E.jsx)(W0,{}),children:(0,E.jsx)(e,{code:y,isIncomplete:u,language:f,meta:m})})}if(f===`mermaid`&&l){let e=b2(s,`mermaid`),n=C2(s,`download`),r=C2(s,`copy`),a=C2(s,`fullscreen`),c=C2(s,`panZoom`),l=e&&(n||r||a);return(0,E.jsx)(d.Suspense,{fallback:(0,E.jsx)(W0,{}),children:(0,E.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,E.jsx)(`div`,{className:i(`flex h-8 items-center text-muted-foreground text-xs`),children:(0,E.jsx)(`span`,{className:i(`ml-1 font-mono lowercase`),children:`mermaid`})}),l?(0,E.jsx)(`div`,{className:i(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,E.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,E.jsx)(r2,{chart:y,config:o?.config}):null,r?(0,E.jsx)(V0,{code:y}):null,a?(0,E.jsx)(i2,{chart:y,config:o?.config}):null]})}):null,(0,E.jsx)(`div`,{className:i(`rounded-md border border-border bg-background`),children:(0,E.jsx)(g2,{chart:y,config:o?.config,showControls:c})})]})})}let b=b2(s,`code`),x=S2(s,`download`),S=S2(s,`copy`);return(0,E.jsx)(M0,{className:t,code:y,isIncomplete:u,language:f,lineNumbers:v,startLine:_,children:b?(0,E.jsxs)(E.Fragment,{children:[x?(0,E.jsx)(U0,{code:y,language:f}):null,S?(0,E.jsx)(V0,{}):null]}):null})},(e,t)=>e.className===t.className&&v2(e.node,t.node));K2.displayName=`MarkdownCode`;var q2=(0,d.memo)(K0,(e,t)=>e.className===t.className&&v2(e.node,t.node));q2.displayName=`MarkdownImg`;var J2=(0,d.memo)(({children:e,node:t,...n})=>{let r=(Array.isArray(e)?e:[e]).filter(e=>e!=null&&e!==``);if(r.length===1&&(0,d.isValidElement)(r[0])){let t=r[0].props.node?.tagName;if(t===`img`||t===`code`&&`data-block`in r[0].props)return(0,E.jsx)(E.Fragment,{children:e})}return(0,E.jsx)(`p`,{...n,children:e})},(e,t)=>y2(e,t));J2.displayName=`MarkdownParagraph`;var Y2={ol:w2,li:T2,ul:E2,hr:D2,strong:O2,a:k2,h1:A2,h2:j2,h3:M2,h4:N2,h5:P2,h6:F2,table:I2,thead:L2,tbody:R2,tr:z2,th:B2,td:V2,blockquote:H2,code:K2,img:q2,pre:({children:e})=>(0,d.isValidElement)(e)?(0,d.cloneElement)(e,{"data-block":`true`}):e,sup:U2,sub:W2,p:J2,section:G2},X2=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,Z2=/\p{L}/u;function Q2(e){let t=e.replace(/^#{1,6}\s+/gm,``).replace(/(\*{1,3}|_{1,3})/g,``).replace(/`[^`]*`/g,``).replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/^[\s>*\-+\d.]+/gm,``);for(let e of t){if(X2.test(e))return`rtl`;if(Z2.test(e))return`ltr`}return`ltr`}var $2=/^[ \t]{0,3}(`{3,}|~{3,})/,e4=/^\|?[ \t]*:?-{1,}:?[ \t]*(\|[ \t]*:?-{1,}:?[ \t]*)*\|?$/,t4=e=>{let t=e.split(`
449
449
  `),n=null,r=0;for(let e of t){let t=$2.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},n4=e=>{let t=e.split(`
450
450
  `);for(let e of t){let t=e.trim();if(t.length>0&&t.includes(`|`)&&e4.test(t))return!0}return!1},r4=()=>e=>{AO(e,`html`,(e,t,n)=>{!n||typeof t!=`number`||(n.children[t]={type:`text`,value:e.value})})},i4=[],a4={allowDangerousHtml:!0},o4=new WeakMap,s4=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=o4.get(e);n||(n=e.name,o4.set(e,n)),t+=n}else t+=String(e);t+=`:`,t+=JSON.stringify(n)}else if(typeof r==`function`){let e=o4.get(r);e||(e=r.name,o4.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()}},c4=e=>{let t=l4(e),n=e.children||``;return g4(t.runSync(t.parse(n),n),e)},l4=e=>{let t=s4.get(e);if(t)return t;let n=d4(e);return s4.set(e,n),n},u4=e=>e.some(e=>Array.isArray(e)?e[0]===kV:e===kV),d4=e=>{let t=e.rehypePlugins||i4,n=e.remarkPlugins||i4,r=u4(t)?n:[...n,r4],i=e.remarkRehypeOptions?{...a4,...e.remarkRehypeOptions}:a4;return mk().use(TD).use(r).use(BO,i).use(t)},f4=e=>e,p4=(e,t,n,r)=>{n?e.children.splice(t,1):e.children[t]={type:`text`,value:r}},m4=(e,t)=>{for(let n in Cw)if(Object.hasOwn(Cw,n)&&Object.hasOwn(e.properties,n)){let r=e.properties[n],i=Cw[n];(i===null||i.includes(e.tagName))&&(e.properties[n]=t(String(r||``),n,e)??void 0)}},h4=(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},g4=(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||f4;AO(e,(e,s,c)=>{if(e.type===`raw`&&c&&typeof s==`number`)return p4(c,s,a,e.value),s;if(e.type===`element`&&(m4(e,t),h4(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 tw(e,{Fragment:E.Fragment,components:t.components,ignoreInvalidStyle:!0,jsx:E.jsx,jsxs:E.jsxs,passKeys:!0,passNode:!0})},_4=/\[\^[\w-]{1,200}\](?!:)/,v4=/\[\^[\w-]{1,200}\]:/,y4=/<(\w+)[\s>]/,b4=new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`]),x4=new Map,S4=new Map,C4=e=>{let t=e.toLowerCase(),n=x4.get(t);if(n)return n;let r=RegExp(`<${t}(?=[\\s>/])[^>]*>`,`gi`);return x4.set(t,r),r},w4=e=>{let t=e.toLowerCase(),n=S4.get(t);if(n)return n;let r=RegExp(`</${t}(?=[\\s>])[^>]*>`,`gi`);return S4.set(t,r),r},T4=(e,t)=>{if(b4.has(t.toLowerCase()))return 0;let n=e.match(C4(t));if(!n)return 0;let r=0;for(let e of n)e.trimEnd().endsWith(`/>`)||(r+=1);return r},E4=(e,t)=>{let n=e.match(w4(t));return n?n.length:0},D4=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},O4=e=>{let t=_4.test(e),n=v4.test(e);if(t||n)return[e];let r=U1.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=T4(t,e),o=E4(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(y4);if(e){let n=e[1];T4(t,n)>E4(t,n)&&a.push(n)}}if(n>0&&!o){let e=i[n-1];if(D4(e)%2==1){i[n-1]=e+t;continue}}i.push(t),e.type!==`space`&&(o=e.type===`code`)}return i},k4=(e,t)=>{if(!t.length)return e;let n=e;for(let e of t){let t=RegExp(`(<${e}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${e}\\s*>)`,`gi`);n=n.replace(t,(e,t,n,r)=>{if(!n.includes(`
451
451
 
@@ -465,7 +465,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
465
465
  `);n.forEach(function(t,i){var o=r&&d.length+a,s={type:`text`,value:`${t}
466
466
  `};if(i===0){var c=g(u.slice(f+1,p).concat(P3({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=P3({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 L3(e){var t=e.rows,n=e.stylesheet,r=e.useInlineStyles;return t.map(function(e,t){return S3({node:e,stylesheet:n,useInlineStyles:r,key:`code-segment-${t}`})})}function R3(e){return e&&e.highlightAuto!==void 0}function z3(e){var t=e.astGenerator,n=e.language,r=e.code,i=e.defaultCodeValue;if(R3(t)){var a=C3(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 B3(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:E3(E3({},o[`code[class*="language-"]`]),o[`code[class*="language-${r}"]`])}:l,f=n.useInlineStyles,p=f===void 0||f,m=n.showLineNumbers,h=m!==void 0&&m,g=n.showInlineLineNumbers,_=g===void 0||g,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,P=N===void 0?(Array.isArray(i)?i[0]:i)||``:N,ee=n.astGenerator,F=n3(n,w3);ee||=e;var te=h?d.createElement(A3,{containerStyle:b,codeStyle:u.style||{},numberStyle:S,startingLineNumber:y,codeString:P}):null,ne=o.hljs||o[`pre[class*="language-"]`]||{backgroundColor:`#fff`},re=R3(ee)?`hljs`:`prismjs`,ie=p?Object.assign({},F,{style:Object.assign({},ne,c)}):Object.assign({},F,{className:F.className?`${re} ${F.className}`:re,style:Object.assign({},c)});if(u.style=E3(T?{whiteSpace:`pre-wrap`}:{whiteSpace:`pre`},u.style),!ee)return d.createElement(A,ie,te,d.createElement(M,u,P));(C===void 0&&O||T)&&(C=!0),O||=L3;var ae=[{type:`text`,value:P}],oe=z3({astGenerator:ee,language:r,code:P,defaultCodeValue:ae});oe.language===null&&(oe.value=ae);var I=y+(P.match(/\n/g)?.length??0),L=I3(oe,C,D,h,_,y,I,S,T);return d.createElement(A,ie,d.createElement(M,u,!_&&te,O({rows:L,stylesheet:o,useInlineStyles:p})))}}var V3=`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(`.`),H3={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 U3(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=48&&t<=57}function W3(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}function G3(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}function K3(e){return G3(e)||U3(e)}var q3=[``,`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 J3(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`?K3:u===`decimal`?U3:W3;for(l--;++l<=e.length;){let t=e.charCodeAt(l);if(!b(t))break;y+=String.fromCharCode(t),u===`named`&&V3.includes(y)&&(_=y,v=Aw(y))}let x=e.charCodeAt(l)===59;if(x){l++;let e=u===`named`&&Aw(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=``):K3(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(Y3(e))h(7,S),C=`�`;else if(e in H3)h(6,S),C=H3[e];else{let t=``;X3(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,q3[e],r,e))}function g(){s&&=(i.push(s),n.text&&n.text.call(n.textContext||void 0,s,{start:f,end:m()}),``)}}function Y3(e){return e>=55296&&e<=57343||e>1114111}function X3(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 Z3=0,Q3={},$3={util:{type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++Z3}),e.__id},clone:function e(t,n){n||={};var r,i;switch($3.util.type(t)){case`Object`:if(i=$3.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=$3.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:Q3,plaintext:Q3,text:Q3,txt:Q3,extend:function(e,t){var n=$3.util.clone($3.languages[e]);for(var r in t)n[r]=t[r];return n},insertBefore:function(e,t,n,r){r||=$3.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,$3.languages.DFS($3.languages,function(t,n){n===c&&t!=e&&(this[t]=a)}),a},DFS:function e(t,n,r,i){i||={};var a=$3.util.objId;for(var o in t)if(t.hasOwnProperty(o)){n.call(t,o,t[o],r||o);var s=t[o],c=$3.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($3.hooks.run(`before-tokenize`,r),!r.grammar)throw Error(`The language "`+r.language+`" has no grammar.`);return r.tokens=$3.tokenize(r.code,r.grammar),$3.hooks.run(`after-tokenize`,r),e6.stringify($3.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 r6;return i6(i,i.head,e),n6(e,i,t,i.head,0),o6(i)},hooks:{all:{},add:function(e,t){var n=$3.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=$3.hooks.all[e];if(!(!n||!n.length))for(var r=0,i;i=n[r++];)i(t)}},Token:e6};function e6(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=(r||``).length|0}function t6(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 n6(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 e6)){var y=1,b;if(f){if(b=t6(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 e6)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=t6(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=i6(t,k,E),_+=E.length),a6(t,k,y);var A=new e6(o,u?$3.tokenize(T,u):T,p,T);if(g=i6(t,k,A),D&&i6(t,g,D),y>1){var j={cause:o+`,`+c,reach:O};n6(e,t,n,g.prev,_,j),a&&j.reach>a.reach&&(a.reach=j.reach)}}}}}}function r6(){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 i6(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 a6(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 o6(e){for(var t=[],n=e.head.next;n!==e.tail;)t.push(n.value),n=n.next;return t}var s6=$3;function c6(){}c6.prototype=s6;var l6=new c6;l6.highlight=u6,l6.register=d6,l6.alias=f6,l6.registered=p6,l6.listLanguages=m6,l6.util.encode=g6,l6.Token.stringify=h6;function u6(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(l6.languages,r))n=l6.languages[r];else throw Error("Unknown language: `"+r+"` is not registered")}return{type:`root`,children:s6.highlight.call(l6,e,n,r)}}function d6(e){if(typeof e!=`function`||!e.displayName)throw Error("Expected `function` for `syntax`, got `"+e+"`");Object.hasOwn(l6.languages,e.displayName)||e(l6)}function f6(e,t){let n=l6.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 p6(e){if(typeof e!=`string`)throw TypeError("Expected `string` for `aliasOrLanguage`, got `"+e+"`");return Object.hasOwn(l6.languages,e)}function m6(){let e=l6.languages,t=[],n;for(n in e)Object.hasOwn(e,n)&&typeof e[n]==`object`&&t.push(n);return t}function h6(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(h6(e[r],t));return n}let n={attributes:{},classes:[`token`,e.type],content:h6(e.content,t),language:t,tag:`span`,type:e.type};return e.alias&&n.classes.push(...typeof e.alias==`string`?[e.alias]:e.alias),l6.hooks.run(`wrap`,n),Uk(n.tag+`.`+n.classes.join(`.`),_6(n.attributes),n.content)}function g6(e){return e}function _6(e){let t;for(t in e)Object.hasOwn(e,t)&&(e[t]=J3(e[t]));return e}var v6=B3(l6,{});v6.registerLanguage=function(e,t){return l6.register(t)},v6.alias=function(e,t){return l6.alias(e,t)},y6.displayName=`markup`,y6.aliases=[`atom`,`html`,`mathml`,`rss`,`ssml`,`svg`,`xml`];function y6(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(/&amp;/,`&`))}),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}b6.displayName=`css`,b6.aliases=[];function b6(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)}x6.displayName=`clike`,x6.aliases=[];function x6(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:/[{}[\];(),.:]/}}S6.displayName=`javascript`,S6.aliases=[`js`];function S6(e){e.register(x6),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}C6.displayName=`sql`,C6.aliases=[];function C6(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:/[;[\]()`,.]/}}w6.displayName=`c`,w6.aliases=[];function w6(e){e.register(x6),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}T6.displayName=`cpp`,T6.aliases=[];function T6(e){e.register(w6),(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)}E6.displayName=`bash`,E6.aliases=[`sh`,`shell`];function E6(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)}D6.displayName=`yaml`,D6.aliases=[`yml`];function D6(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)}O6.displayName=`markdown`,O6.aliases=[`md`];function O6(e){e.register(y6),(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)}k6.displayName=`csharp`,k6.aliases=[`cs`,`dotnet`];function k6(e){e.register(x6),(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)}A6.displayName=`diff`,A6.aliases=[];function A6(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
467
467
  ?|
468
- |(?![\\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)}j6.displayName=`docker`,j6.aliases=[`dockerfile`];function j6(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)}M6.displayName=`go`,M6.aliases=[];function M6(e){e.register(x6),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`]}N6.displayName=`scss`,N6.aliases=[];function N6(e){e.register(b6),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}P6.displayName=`json`,P6.aliases=[`webmanifest`];function P6(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}F6.displayName=`java`,F6.aliases=[];function F6(e){e.register(x6),(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)}I6.displayName=`typescript`,I6.aliases=[`ts`];function I6(e){e.register(S6),(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)}L6.displayName=`python`,L6.aliases=[`py`];function L6(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:/![sra](?=[:}]$)/,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}R6.displayName=`jsx`,R6.aliases=[];function R6(e){e.register(S6),e.register(y6),(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)}z6.displayName=`tsx`,z6.aliases=[];function z6(e){e.register(R6),e.register(I6),(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)}B6.displayName=`rust`,B6.aliases=[];function B6(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 V6={'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))`}},H6={'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`}},U6={bash:E6,c:w6,cpp:T6,csharp:k6,css:b6,diff:A6,docker:j6,go:M6,java:F6,javascript:S6,json:P6,jsx:R6,markdown:O6,markup:y6,python:L6,rust:B6,scss:N6,sql:C6,tsx:z6,typescript:I6,yaml:D6};for(let[e,t]of Object.entries(U6))v6.registerLanguage(e,t);var W6=.25,G6=.5,K6=3;function q6({code:e,isStreaming:t,defaultPreview:n=!1}){let{isDark:r}=Xn(),{t:i}=N(),[a,o]=(0,d.useState)(n),[s,c]=(0,d.useState)(null),[l,u]=(0,d.useState)(!1),f=`${r?`dark`:`light`}\n${e}`,p=a&&!t;(0,d.useEffect)(()=>{if(!p)return;let t=!1;return c({key:f,status:`loading`}),(async()=>{let{default:n}=await $1(async()=>{let{default:e}=await import(`./mermaid.core-B5Pfvt4i.js`);return{default:e}},__vite__mapDeps([2,3,4,1,5,6,7,8,9,10,11,12,13,14,15,16,17]));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:f,status:`ready`,svg:a.svg})})().catch(()=>{t||c({key:f,status:`error`})}),()=>{t=!0}},[e,f,r,p]);let m=(0,E.jsx)(`button`,{type:`button`,onClick:()=>o(e=>!e),disabled:t,title:i(t?`i18n.previewAfterStreaming`:p?`i18n.showMermaidSource`:`i18n.previewMermaid`),className:[`markdown-code-action`,p?`is-active`:``].filter(Boolean).join(` `),children:i(p?`i18n.source`:`i18n.preview`)});if(!p)return(0,E.jsx)(Z6,{code:e,lang:`mermaid`,headerAction:m});let h=s?.key===f&&s.status===`error`?(0,E.jsx)(`div`,{className:`mermaid-block mermaid-block-error`,children:i(`i18n.invalidMermaid`)}):s?.key!==f||s.status!==`ready`?(0,E.jsx)(`div`,{className:`mermaid-block mermaid-block-loading`,"aria-label":i(`i18n.renderingMermaid`)}):(0,E.jsxs)(E.Fragment,{children:[!l&&(0,E.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,E.jsx)(J6,{svg:s.svg,onClose:()=>u(!1)})]});return(0,E.jsxs)(`div`,{className:`markdown-code-block`,children:[(0,E.jsxs)(`div`,{className:`markdown-code-header`,children:[(0,E.jsx)(`span`,{className:`markdown-code-lang`,children:`mermaid`}),m]}),h]})}function J6({svg:e,onClose:t}){let{t:n}=N(),r=(0,d.useRef)(null),[i,a]=(0,d.useState)(1);return(0,d.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,E.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,E.jsxs)(`div`,{className:`mermaid-zoom-layout`,children:[(0,E.jsxs)(`div`,{className:`mermaid-zoom-toolbar`,children:[(0,E.jsx)(`span`,{className:`mermaid-zoom-title`,children:n(`i18n.mermaidDiagram`)}),(0,E.jsxs)(`div`,{className:`mermaid-zoom-actions`,children:[(0,E.jsxs)(`div`,{className:`mermaid-zoom-stepper`,children:[(0,E.jsx)(`button`,{type:`button`,onClick:()=>a(e=>Math.max(G6,e-W6)),disabled:i<=G6,title:n(`i18n.zoomOut`),"aria-label":n(`i18n.zoomOut`),children:(0,E.jsx)(`svg`,{width:p.lg,height:p.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,E.jsx)(`path`,{d:`M5 12h14`})})}),(0,E.jsxs)(`span`,{className:`mermaid-zoom-value`,children:[Math.round(i*100),`%`]}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>a(e=>Math.min(K6,e+W6)),disabled:i>=K6,title:n(`i18n.zoomIn`),"aria-label":n(`i18n.zoomIn`),children:(0,E.jsx)(`svg`,{width:p.lg,height:p.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,E.jsx)(`path`,{d:`M12 5v14M5 12h14`})})})]}),(0,E.jsx)(`button`,{type:`button`,className:`mermaid-zoom-icon-button`,onClick:()=>a(1),title:n(`i18n.fitToWidth`),"aria-label":n(`i18n.fitToWidth`),children:(0,E.jsx)(`svg`,{width:p.lg,height:p.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,E.jsx)(`path`,{d:`M8 3H3v5M16 3h5v5M8 21H3v-5M16 21h5v-5`})})}),(0,E.jsx)(`button`,{type:`button`,className:`mermaid-zoom-icon-button`,onClick:t,title:n(`i18n.close`),"aria-label":n(`i18n.close`),children:(0,E.jsx)(`svg`,{width:p.lg,height:p.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,E.jsx)(`path`,{d:`M6 6l12 12M18 6 6 18`})})})]})]}),(0,E.jsx)(`div`,{className:`mermaid-zoom-viewport`,onClick:e=>{e.target===e.currentTarget&&t()},children:(0,E.jsx)(`div`,{className:`mermaid-zoom-canvas`,style:{width:`${i*100}%`},dangerouslySetInnerHTML:{__html:e}})})]})})}var Y6=5e3,X6=800;function Z6({code:e,lang:t,headerAction:n,isStreaming:r}){let{isDark:i}=Xn(),{t:a}=N(),[o,s]=(0,d.useState)(!1),c=()=>{bY(e).then(()=>{s(!0),setTimeout(()=>s(!1),1500)})},l=e.length>Y6||r===!0&&e.length>X6;return(0,E.jsxs)(`div`,{className:`markdown-code-block`,children:[(0,E.jsxs)(`div`,{className:`markdown-code-header`,children:[(0,E.jsx)(`span`,{className:`markdown-code-lang`,children:t||`text`}),(0,E.jsxs)(`div`,{className:`markdown-code-actions`,children:[n,(0,E.jsx)(`button`,{onClick:c,className:`markdown-code-action`,children:a(o?`i18n.copied`:`i18n.copy`)})]})]}),l?(0,E.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,E.jsx)(`code`,{style:{fontFamily:`var(--font-mono)`},children:e})}):(0,E.jsx)(v6,{language:t||`text`,style:i?H6:V6,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 Q6({children:e,className:t,isStreaming:n,cwd:r,onOpenFile:i}){let{t:a}=N(),[o,s]=(0,d.useState)(!1),c=!o&&e.length>1e5,l=(0,d.useMemo)(()=>c?e3(e):e,[c,e]),u=(0,d.useMemo)(()=>cG(l),[l]),f=(0,d.useMemo)(()=>({code({className:e,children:t,...r}){let i=e?.replace(`language-`,``).toLowerCase()??``,a=String(t);return e?.includes(`language-`)||a.includes(`
468
+ |(?![\\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)}j6.displayName=`docker`,j6.aliases=[`dockerfile`];function j6(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)}M6.displayName=`go`,M6.aliases=[];function M6(e){e.register(x6),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`]}N6.displayName=`scss`,N6.aliases=[];function N6(e){e.register(b6),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}P6.displayName=`json`,P6.aliases=[`webmanifest`];function P6(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}F6.displayName=`java`,F6.aliases=[];function F6(e){e.register(x6),(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)}I6.displayName=`typescript`,I6.aliases=[`ts`];function I6(e){e.register(S6),(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)}L6.displayName=`python`,L6.aliases=[`py`];function L6(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:/![sra](?=[:}]$)/,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}R6.displayName=`jsx`,R6.aliases=[];function R6(e){e.register(S6),e.register(y6),(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)}z6.displayName=`tsx`,z6.aliases=[];function z6(e){e.register(R6),e.register(I6),(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)}B6.displayName=`rust`,B6.aliases=[];function B6(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 V6={'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))`}},H6={'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`}},U6={bash:E6,c:w6,cpp:T6,csharp:k6,css:b6,diff:A6,docker:j6,go:M6,java:F6,javascript:S6,json:P6,jsx:R6,markdown:O6,markup:y6,python:L6,rust:B6,scss:N6,sql:C6,tsx:z6,typescript:I6,yaml:D6};for(let[e,t]of Object.entries(U6))v6.registerLanguage(e,t);var W6=.25,G6=.5,K6=3;function q6({code:e,isStreaming:t,defaultPreview:n=!1}){let{isDark:r}=Xn(),{t:i}=N(),[a,o]=(0,d.useState)(n),[s,c]=(0,d.useState)(null),[l,u]=(0,d.useState)(!1),f=`${r?`dark`:`light`}\n${e}`,p=a&&!t;(0,d.useEffect)(()=>{if(!p)return;let t=!1;return c({key:f,status:`loading`}),(async()=>{let{default:n}=await $1(async()=>{let{default:e}=await import(`./mermaid.core-BhANQr2H.js`);return{default:e}},__vite__mapDeps([2,3,4,1,5,6,7,8,9,10,11,12,13,14,15,16,17]));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:f,status:`ready`,svg:a.svg})})().catch(()=>{t||c({key:f,status:`error`})}),()=>{t=!0}},[e,f,r,p]);let m=(0,E.jsx)(`button`,{type:`button`,onClick:()=>o(e=>!e),disabled:t,title:i(t?`i18n.previewAfterStreaming`:p?`i18n.showMermaidSource`:`i18n.previewMermaid`),className:[`markdown-code-action`,p?`is-active`:``].filter(Boolean).join(` `),children:i(p?`i18n.source`:`i18n.preview`)});if(!p)return(0,E.jsx)(Z6,{code:e,lang:`mermaid`,headerAction:m});let h=s?.key===f&&s.status===`error`?(0,E.jsx)(`div`,{className:`mermaid-block mermaid-block-error`,children:i(`i18n.invalidMermaid`)}):s?.key!==f||s.status!==`ready`?(0,E.jsx)(`div`,{className:`mermaid-block mermaid-block-loading`,"aria-label":i(`i18n.renderingMermaid`)}):(0,E.jsxs)(E.Fragment,{children:[!l&&(0,E.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,E.jsx)(J6,{svg:s.svg,onClose:()=>u(!1)})]});return(0,E.jsxs)(`div`,{className:`markdown-code-block`,children:[(0,E.jsxs)(`div`,{className:`markdown-code-header`,children:[(0,E.jsx)(`span`,{className:`markdown-code-lang`,children:`mermaid`}),m]}),h]})}function J6({svg:e,onClose:t}){let{t:n}=N(),r=(0,d.useRef)(null),[i,a]=(0,d.useState)(1);return(0,d.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,E.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,E.jsxs)(`div`,{className:`mermaid-zoom-layout`,children:[(0,E.jsxs)(`div`,{className:`mermaid-zoom-toolbar`,children:[(0,E.jsx)(`span`,{className:`mermaid-zoom-title`,children:n(`i18n.mermaidDiagram`)}),(0,E.jsxs)(`div`,{className:`mermaid-zoom-actions`,children:[(0,E.jsxs)(`div`,{className:`mermaid-zoom-stepper`,children:[(0,E.jsx)(`button`,{type:`button`,onClick:()=>a(e=>Math.max(G6,e-W6)),disabled:i<=G6,title:n(`i18n.zoomOut`),"aria-label":n(`i18n.zoomOut`),children:(0,E.jsx)(`svg`,{width:p.lg,height:p.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,E.jsx)(`path`,{d:`M5 12h14`})})}),(0,E.jsxs)(`span`,{className:`mermaid-zoom-value`,children:[Math.round(i*100),`%`]}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>a(e=>Math.min(K6,e+W6)),disabled:i>=K6,title:n(`i18n.zoomIn`),"aria-label":n(`i18n.zoomIn`),children:(0,E.jsx)(`svg`,{width:p.lg,height:p.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,E.jsx)(`path`,{d:`M12 5v14M5 12h14`})})})]}),(0,E.jsx)(`button`,{type:`button`,className:`mermaid-zoom-icon-button`,onClick:()=>a(1),title:n(`i18n.fitToWidth`),"aria-label":n(`i18n.fitToWidth`),children:(0,E.jsx)(`svg`,{width:p.lg,height:p.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,E.jsx)(`path`,{d:`M8 3H3v5M16 3h5v5M8 21H3v-5M16 21h5v-5`})})}),(0,E.jsx)(`button`,{type:`button`,className:`mermaid-zoom-icon-button`,onClick:t,title:n(`i18n.close`),"aria-label":n(`i18n.close`),children:(0,E.jsx)(`svg`,{width:p.lg,height:p.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,E.jsx)(`path`,{d:`M6 6l12 12M18 6 6 18`})})})]})]}),(0,E.jsx)(`div`,{className:`mermaid-zoom-viewport`,onClick:e=>{e.target===e.currentTarget&&t()},children:(0,E.jsx)(`div`,{className:`mermaid-zoom-canvas`,style:{width:`${i*100}%`},dangerouslySetInnerHTML:{__html:e}})})]})})}var Y6=5e3,X6=800;function Z6({code:e,lang:t,headerAction:n,isStreaming:r}){let{isDark:i}=Xn(),{t:a}=N(),[o,s]=(0,d.useState)(!1),c=()=>{bY(e).then(()=>{s(!0),setTimeout(()=>s(!1),1500)})},l=e.length>Y6||r===!0&&e.length>X6;return(0,E.jsxs)(`div`,{className:`markdown-code-block`,children:[(0,E.jsxs)(`div`,{className:`markdown-code-header`,children:[(0,E.jsx)(`span`,{className:`markdown-code-lang`,children:t||`text`}),(0,E.jsxs)(`div`,{className:`markdown-code-actions`,children:[n,(0,E.jsx)(`button`,{onClick:c,className:`markdown-code-action`,children:a(o?`i18n.copied`:`i18n.copy`)})]})]}),l?(0,E.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,E.jsx)(`code`,{style:{fontFamily:`var(--font-mono)`},children:e})}):(0,E.jsx)(v6,{language:t||`text`,style:i?H6:V6,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 Q6({children:e,className:t,isStreaming:n,cwd:r,onOpenFile:i}){let{t:a}=N(),[o,s]=(0,d.useState)(!1),c=!o&&e.length>1e5,l=(0,d.useMemo)(()=>c?e3(e):e,[c,e]),u=(0,d.useMemo)(()=>cG(l),[l]),f=(0,d.useMemo)(()=>({code({className:e,children:t,...r}){let i=e?.replace(`language-`,``).toLowerCase()??``,a=String(t);return e?.includes(`language-`)||a.includes(`
469
469
  `)?i===`mermaid`?(0,E.jsx)(q6,{code:a.replace(/\n$/,``),isStreaming:n}):(0,E.jsx)(Z6,{code:a.replace(/\n$/,``),lang:i,isStreaming:n}):(0,E.jsx)(`code`,{className:`markdown-inline-code`,...r,children:t})},pre({children:e}){return(0,E.jsx)(E.Fragment,{children:e})},a({href:e,children:t,...n}){delete n.node;let a=i?HG(e,r):null,o=i;if(!a||!o)return(0,E.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,E.jsx)(`a`,{href:e,...n,onClick:s,children:t})},img({src:e,alt:t,...n}){delete n.node;let i=typeof e==`string`?HG(e,r):null,a=i?`/api/files/${vG(i)}?type=read`:e;return(0,E.jsx)(`img`,{src:a,alt:t??``,loading:`lazy`,...n})},table({children:e}){return(0,E.jsx)(`div`,{className:`markdown-table-wrap`,children:(0,E.jsx)(`table`,{children:e})})},blockquote({children:e}){return(0,E.jsx)(`blockquote`,{children:e})}}),[r,n,i]);return(0,E.jsxs)(`div`,{className:[`markdown-body`,t].filter(Boolean).join(` `),style:{whiteSpace:`pre-wrap`},children:[(0,E.jsx)(Y4,{remarkPlugins:fG??void 0,rehypePlugins:mG??void 0,components:f,children:u}),c&&(0,E.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,E.jsx)(`span`,{"aria-hidden":`true`,children:`…`}),(0,E.jsx)(`svg`,{width:p.base,height:p.base,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,E.jsx)(`path`,{d:`m6 9 6 6 6-6`})})]})]})}var{min:$6,max:e8,abs:t8,floor:n8}=Math,r8=(e,t,n)=>$6(n,e8(t,e)),i8=e=>[...e].sort((e,t)=>e-t),a8=setTimeout,o8=typeof queueMicrotask==`function`?queueMicrotask:e=>{Promise.resolve().then(e)},s8=()=>{let e;return[new Promise(t=>{e=t}),e]},c8=e=>{let t;return()=>(e&&=(t=e(),void 0),t)},l8=typeof window<`u`,u8=e=>e.documentElement,d8=e=>e.ownerDocument,f8=e=>e.defaultView,p8=c8(()=>!!/iP(hone|od|ad)/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>0),m8=c8(()=>`scrollBehavior`in u8(document).style),h8=e=>e8(e.t(),e.o()),g8=({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?e8(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&&(p8()&&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=e8(0,O()),a=i+m;d||(t=e8(0,t),b!==1&&(i-=t),b!==2&&(a+=t)),[n,r]=C=e(e8(0,i),e8(0,a)),S&&(n=$6(n,S[0]),r=e8(r,S[1]))}return[e8(n,0),$6(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=t8(t);e&&n<t8(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)}))}}},_8=(e,t,n,r=0,i=t-1)=>{let a=r;for(;r<=i;){let t=n8((r+i)/2);e(t)<=n?(a=t,r=t+1):i=t-1}return r8(a,0,t-1)},v8=(e,t,n)=>{let r=n?`unshift`:`push`;for(let n=0;n<t;n++)e[r](-1);return e},y8=(e,t,n)=>{let r=n&&n[1]||t||40,i=-1,a=0,o=n&&n[0],s=o?v8(o.slice(0,$6(e,o.length)),e8(0,e-o.length)):v8([],e),c=v8([],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=$6(a,e-1),u(a)<=t?(i=_8(u,e,n,a),r=_8(u,e,t,a,i)):(r=_8(u,e,t,void 0,a),i=_8(u,e,n,r)),a=r,[r,i]},l:t=>_8(u,e,t),u,h:l,v:(e,t)=>{let n=s[e]===-1;return s[e]=t,i=$6(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:$6(t-1,i),e=t,a>0?(v8(c,a),v8(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=i8(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)*e8(e-t,0)},B:()=>[s.slice(),r]}},b8=e=>{let t;return{X(n){(t||=new(f8(d8(n))).ResizeObserver(e)).observe(n)},Y(e){t.unobserve(e)},q(){t&&t.disconnect()}}},x8=(e,t)=>t?-e:e,S8=(e,t,n,r,i,a)=>{let o=Date.now,s=0,c=!1,l=!1,u=!1,d=!1,f=(()=>{let t,n=()=>{t!=null&&clearTimeout(t)},r=()=>{n(),t=a8(()=>{t=null,(()=>{if(c||l)return c=!1,void f();u=!1,e.W(2)})()},150)};return r.A=n,r})(),p=()=>{s=o(),u&&(d=!0),a&&e.W(6,a()),e.W(1,r()),f()},m=t=>{if(c||!e.M()||t.ctrlKey)return;let r=o()-s;150>r&&50<r&&(n?t.deltaX:t.deltaY)&&(c=!0)},h=()=>{l=!0,u=d=!1},g=()=>{l=!1,p8()&&(u=!0)};return t.addEventListener(`scroll`,p),t.addEventListener(`wheel`,m,{passive:!0}),t.addEventListener(`touchstart`,h,{passive:!0}),t.addEventListener(`touchend`,g,{passive:!0}),{q:()=>{t.removeEventListener(`scroll`,p),t.removeEventListener(`wheel`,m),t.removeEventListener(`touchstart`,h),t.removeEventListener(`touchend`,g),f.A()},D:()=>{let[t,n]=e.L();t&&(i(t,n,d),d=!1,n&&e.o()>e.t()&&e.W(1,r()))}}},C8=(e,t,n)=>{let r;return[async(i,a)=>{if(!await t())return;r&&r();let o=()=>{let[t,n]=s8();return r=()=>{n(!1)},e.o()&&a8(r,150),[t,e.H(2,()=>{n(!0)})]};if(a&&m8())e.W(8,i()),o8(async()=>{for(;;){let t=!0;for(let[n,r]=e.i();n<=r;n++)if(e.R(n)){t=!1;break}if(t)break;let[n,r]=o();try{if(!await n)return}finally{r()}}e.W(7),n(i(),a)});else for(;;){let[t,r]=o();try{if(e.W(7),n(i()),!await t)return}finally{r()}}},()=>{r&&r()}]},w8=(e,t)=>{let n,r,i=s8(),a=!1,o=t?`scrollLeft`:`scrollTop`,s=t?`overflowX`:`overflowY`,[c,l]=C8(e,()=>i[0],(e,r)=>{e=x8(e,a),r?n.scrollTo({[t?`left`:`top`]:e,behavior:`smooth`}):n[o]=e}),u=t?`width`:`height`,d=new WeakMap,f=b8(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{N(c,u=c.parentElement){f.X(n=u),t&&(a=getComputedStyle(u).direction===`rtl`),r=S8(e,u,t,()=>x8(u[o],a),(t,n,r)=>{if(r){let e=u.style,t=e[s];e[s]=`hidden`,a8(()=>{e[s]=t})}u[o]=x8(e.T()+t,a),n&&l()}),i[1](!0)},_(){f.q(),r&&r.q(),i[1](!1),i=s8()},P:(e,t)=>(d.set(e,t),f.X(e),()=>{d.delete(e),f.Y(e)}),V:()=>a,J:c,j(){r&&r.D()},G:e.O,U:()=>0}},T8=(e,t)=>{e.J(()=>t)},E8=(e,t,n,{align:r,smooth:i,offset:a=0}={})=>{if(n=r8(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.J(()=>a+e.G()+t.u(n)+(r===`end`?t.h(n)-(t.o()-e.U()):r===`center`?(t.h(n)-(t.o()-e.U()))/2:0),i)},D8=l8?d.useLayoutEffect:d.useEffect,O8=`current`,k8=(e,t)=>{if(Array.isArray(e))for(let n of e)k8(n,t);else e==null||typeof e==`boolean`||t.push(e)},A8=(e,t)=>e.key??`_`+t,j8=e=>{let t=(0,d.useRef)(null);return t.current||=e()},M8=e=>{let t=(0,d.useRef)(e);return D8(()=>{t[O8]=e},[e]),t},N8=(0,d.memo)(({te:e,oe:t,ne:n,re:r,ie:i,se:a,le:o,ce:s})=>{let c=(0,d.useRef)(null);D8(()=>t(c[O8],n),[n]);let l=(0,d.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,E.jsx)(a,typeof a==`string`?{ref:c,style:l,children:e}:{ref:c,style:l,index:n,children:e})}),P8=(e,t)=>(0,d.useMemo)(()=>{if(typeof e==`function`)return[n=>e(t[n],n),t.length];let n=(e=>{let t=[];return k8(e,t),t})(e);return[e=>n[e],n.length]},[e,t]),F8=(0,d.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:f=`div`,scrollRef:p,onScroll:m,onScrollEnd:h},g)=>{let[_,v]=P8(e,t),y=(0,d.useRef)(null),b=(0,d.useRef)(!!l),x=M8(m),S=M8(h),[C,w,T,D]=j8(()=>{let e=!!a,t=y8(v,r,s),n=g8(t,l);return[n,t,w8(n,e),e]});v!==C.C()&&C.W(5,[v,i]),c!==C.O()&&C.W(6,c);let[O,k]=(0,d.useReducer)(C.I,void 0,C.I),A=C.M(),j=C.t(),M=T.V(),N=[],P=e=>{let t=_(e);return(0,E.jsx)(N8,{oe:T.P,ne:e,re:C.u(e,M),ie:C.R(e),se:f,te:t,le:D,ce:b[O8]},A8(t,e))};if(D8(()=>{b[O8]=!1,C.H(1,e=>{e?(0,ii.flushSync)(k):k()}),C.H(4,()=>{x.current&&x.current(C.T())}),C.H(8,()=>{S.current&&S.current()});let e=y[O8];return p?o8(()=>{p.current&&T.N(e,p[O8])}):T.N(e),()=>{C._(),T._()}},[]),D8(()=>{T.j()},[O]),(0,d.useImperativeHandle)(g,()=>({get cache(){return w.B()},get scrollOffset(){return C.T()},get scrollSize(){return h8(C)},get viewportSize(){return C.o()},findItemIndex:C.k,getItemOffset:C.u,getItemSize:C.h,scrollToIndex:(e,t)=>E8(T,C,e,t),scrollTo:e=>T8(T,e),scrollBy:e=>((e,t,n)=>{T8(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);i8([...e]).forEach(e=>{N.push(P(e))})}else for(let[e,t]=C.i(n);e<=t;e++)N.push(P(e));return(0,E.jsx)(u,{ref:y,style:{contain:`size style`,overflowAnchor:`none`,flex:`none`,position:`relative`,width:D?j:`100%`,height:D?`100%`:j,pointerEvents:A?`none`:void 0},children:N})}),I8=100,L8=new Map;function R8(e,t,n){let r=`${e}:${t}:${n}`,i=L8.get(r);if(i)return L8.delete(r),L8.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 L8.delete(r),e});if(L8.set(r,a),L8.size>I8){let e=L8.keys().next().value;e&&L8.delete(e)}return a}function z8(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 B8(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 V8=(0,d.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,E.jsx)(H8,{message:e,entryId:o,onFork:s,forking:c,onNavigate:l,prevAssistantEntryId:u,onEditContent:d,turnNumber:y}):e.role===`assistant`?(0,E.jsx)(U8,{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,E.jsx)(s5,{message:e}):(0,E.jsx)(u5,{message:e,cwd:i,onOpenFile:a}):e.role===`bashExecution`?(0,E.jsx)(y5,{message:e,sessionId:m,streamingOutput:h,longBlockCollapseChars:g}):null},(e,t)=>e.message===t.message&&e.isStreaming===t.isStreaming&&B8(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 H8({message:e,entryId:t,onFork:n,forking:r,onNavigate:i,prevAssistantEntryId:a,onEditContent:o,turnNumber:s}){let{t:c}=N(),[l,u]=(0,d.useState)(!1),[f,m]=(0,d.useState)(!1),h=typeof e.content==`string`?e.content:e.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
470
470
  `),g=typeof e.content==`string`?[]:e.content.filter(e=>e.type===`image`),_=z8(e.timestamp),v=!!t&&!!n,y=!!a&&!!i;return(0,E.jsxs)(`div`,{style:{marginBottom:16,display:`flex`,flexDirection:`column`,alignItems:`flex-end`},onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,maxWidth:`85%`},children:[s!==void 0&&(0,E.jsx)(rZ,{number:s}),(0,E.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:[g.length>0&&(0,E.jsx)(`div`,{style:{display:`flex`,gap:6,flexWrap:`wrap`,marginBottom:h?8:0},children:g.map((e,t)=>{let n=p5(e);return(0,E.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)})}),h&&(0,E.jsx)(`div`,{"data-testid":`user-message`,style:{whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:h})]})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`flex-end`,gap:6,marginTop:3},children:[(0,E.jsx)(`div`,{style:{display:`flex`,gap:3,opacity:+!!l,pointerEvents:l?`auto`:`none`,transition:`opacity 0.12s`},children:(0,E.jsxs)(`button`,{onClick:()=>{bY(h).then(()=>{m(!0),setTimeout(()=>m(!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:f?`var(--accent)`:`var(--text-dim)`,cursor:`pointer`,fontSize:`var(--text-sm)`,fontWeight:400,whiteSpace:`nowrap`,transition:`color 0.12s`,"--hover-color":`var(--accent)`},className:f?void 0:`hover-shift`,children:[f?(0,E.jsx)(`svg`,{width:p.sm,height:p.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,E.jsx)(`polyline`,{points:`20 6 9 17 4 12`})}):(0,E.jsxs)(`svg`,{width:p.sm,height:p.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,E.jsx)(`rect`,{x:`9`,y:`9`,width:p.lg,height:p.lg,rx:`2`,ry:`2`}),(0,E.jsx)(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})]}),c(f?`i18n.copied`:`i18n.copy`)]})}),(v||y)&&(0,E.jsxs)(`div`,{style:{display:`flex`,gap:3,opacity:l||r?1:0,pointerEvents:l||r?`auto`:`none`,transition:`opacity 0.12s`},children:[y&&(0,E.jsxs)(`button`,{onClick:()=>{i(a),o?.(h)},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)`},className:`hover-shift`,children:[(0,E.jsxs)(`svg`,{width:p.sm,height:p.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,E.jsx)(`polyline`,{points:`15 10 20 15 15 20`}),(0,E.jsx)(`path`,{d:`M4 4v7a4 4 0 0 0 4 4h12`})]}),c(`i18n.editFromHere`)]}),v&&(0,E.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)`},className:r?void 0:`hover-shift`,children:[(0,E.jsxs)(`svg`,{width:p.sm,height:p.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,E.jsx)(`line`,{x1:`6`,y1:`3`,x2:`6`,y2:`15`}),(0,E.jsx)(`circle`,{cx:`18`,cy:`6`,r:`3`}),(0,E.jsx)(`circle`,{cx:`6`,cy:`18`,r:`3`}),(0,E.jsx)(`path`,{d:`M18 9a9 9 0 0 1-9 9`})]}),c(r?`i18n.creating`:`i18n.newSession`)]})]}),_&&(0,E.jsx)(`span`,{style:{fontSize:`var(--text-xs)`,color:`var(--text-dim)`},children:_})]})]})}function U8({message:e,isStreaming:t,toolResults:n,modelNames:r,cwd:i,onOpenFile:a,showTimestamp:o,turnStartTimestamp:s,sessionId:c,entryId:l,longBlockCollapseChars:u,recentExpandedBlockKeys:f,modelLabelVisible:m=!0,turnNumber:h}){let{t:g}=N(),_=o?z8(e.timestamp):null,v=(e.content??[]).map((e,t)=>({block:e,originalIndex:t})).filter(({block:e})=>!DY(e,{isStreaming:t})),y=v.map(({block:e})=>e),b=kY(e,{isStreaming:t}),[x,S]=(0,d.useState)(!1),[C,w]=(0,d.useState)(!1),T=(0,d.useRef)(null),[D,O]=(0,d.useState)(null),k=(0,d.useRef)(v);k.current=v;let A=(0,d.useRef)(new Map),[j,M]=(0,d.useState)(new Map),P=(0,d.useMemo)(()=>{if(!e.timestamp||!s)return;let t=Math.round((e.timestamp-s)/1e3);return t>0?t:void 0},[e.timestamp,s]),ee=(0,d.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]),F=y.filter(e=>e.type===`text`).map(e=>e.text).join(`
471
471
  `);return(0,d.useEffect)(()=>{if(!t)return;let e=setInterval(()=>{if(document.hidden)return;let e=k.current,t=e.map(({block:e})=>e),n=Date.now();e.forEach(({originalIndex:e})=>{A.current.has(e)||A.current.set(e,n)}),M(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)&&A.current.has(a)){let e=A.current.get(a),t=A.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=A.current.get(r.originalIndex);e!==void 0&&M(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;T.current===null&&(T.current=n);let a=(n-T.current)/1e3;a>.5&&O(i/4/a)},300);return()=>{clearInterval(e),T.current=null,O(null)}},[t]),y.length===0&&!t&&!b?null:(0,E.jsxs)(`div`,{style:{marginBottom:16},onMouseEnter:()=>S(!0),onMouseLeave:()=>S(!1),children:[m&&(0,E.jsxs)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`,marginBottom:4,display:`flex`,alignItems:`center`,gap:6},children:[h!==void 0&&(0,E.jsx)(rZ,{number:h}),e.provider&&(0,E.jsx)(`span`,{children:r?.[`${e.provider}/${e.model}`]??r?.[e.model]??e.model}),t&&(()=>{let e=0;for(let t of y)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,E.jsx)(E.Fragment,{children:t>0&&(0,E.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:4,color:`var(--text)`},title:g(`i18n.estimatedTokens`),children:[(0,E.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:2,fontSize:`var(--text-sm)`,fontWeight:400},children:[(0,E.jsxs)(`svg`,{width:p.xs,height:p.xs,viewBox:`0 0 10 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,E.jsx)(`line`,{x1:`5`,y1:`1.5`,x2:`5`,y2:`8.5`}),(0,E.jsx)(`polyline`,{points:`2 6 5 8.5 8 6`})]}),t]}),D!==null&&(0,E.jsxs)(`span`,{style:{marginLeft:6,padding:`1px 6px`,borderRadius:4,background:D>=50?`#53b3cb`:D>=30?`#9bc53d`:D>=15?`#f9c22e`:`#e01a4f`,color:`#fff`,fontSize:`var(--text-sm)`,fontWeight:400},children:[D.toFixed(1),` t/s`]})]})})})()]}),(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:v.map(({block:e,originalIndex:r})=>(0,E.jsx)(q8,{block:e,toolResults:n,isStreaming:t,streamingDuration:j.get(r),toolCallDurations:ee,cwd:i,onOpenFile:a,sessionId:c,entryId:l,blockIndex:r,longBlockCollapseChars:u,recentExpandedBlockKeys:f},`${l??`stream`}-${r}`))}),b&&(0,E.jsxs)(`div`,{role:`alert`,style:{marginTop:y.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: `,b]}),(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginTop:4},children:[e.usage&&!t&&(0,E.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:v5(e.usage)}),F&&!t&&(0,E.jsxs)(`button`,{onClick:()=>{bY(F).then(()=>{w(!0),setTimeout(()=>w(!1),1500)})},title:g(`i18n.copyMessage`),style:{display:`flex`,alignItems:`center`,gap:4,padding:`3px 8px`,height:22,background:`none`,border:`none`,borderRadius:5,color:C?`var(--accent)`:`var(--text-dim)`,cursor:`pointer`,fontSize:`var(--text-sm)`,fontWeight:400,whiteSpace:`nowrap`,opacity:+!!x,pointerEvents:x?`auto`:`none`,transition:`opacity 0.12s, color 0.12s`,"--hover-color":`var(--accent)`},className:C?void 0:`hover-shift`,children:[C?(0,E.jsx)(`svg`,{width:p.sm,height:p.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,E.jsx)(`polyline`,{points:`20 6 9 17 4 12`})}):(0,E.jsxs)(`svg`,{width:p.sm,height:p.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,E.jsx)(`rect`,{x:`9`,y:`9`,width:p.lg,height:p.lg,rx:`2`,ry:`2`}),(0,E.jsx)(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})]}),g(C?`i18n.copied`:`i18n.copy`)]}),_&&!t&&(0,E.jsxs)(`span`,{style:{fontSize:`var(--text-xs)`,color:`var(--text-dim)`,marginLeft:`auto`,fontVariantNumeric:`tabular-nums`},children:[_,P!==void 0&&(0,E.jsxs)(`span`,{children:[` `,`(`,g(`chat.turnDuration`,{duration:ht(P)}),`)`]})]})]})]})}var W8=24;function G8({text:e}){let t=(0,d.useMemo)(()=>e.split(/\r?\n/),[e]);return typeof ResizeObserver>`u`||t.length<50&&e.length<5e3?(0,E.jsx)(`div`,{style:{whiteSpace:`pre-wrap`,overflowWrap:`break-word`},children:e}):(0,E.jsx)(F8,{data:t,itemSize:W8,children:e=>(0,E.jsx)(`div`,{style:{minHeight:W8,lineHeight:`${W8}px`,whiteSpace:`pre-wrap`,overflowWrap:`break-word`},children:e})})}function K8({text:e,threshold:t,t:n,renderFull:r,isStreaming:i=!1,defaultExpanded:a=!1}){let[o,s]=(0,d.useState)(a),c=e.length;if(!(!i&&c>t))return r?(0,E.jsx)(E.Fragment,{children:r()}):i&&e.length>0?(0,E.jsx)(G8,{text:e}):(0,E.jsx)(E.Fragment,{children:e});let l=Math.max(1,Math.floor(t/2)),u=c-l*2,f=(0,E.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,E.jsxs)(E.Fragment,{children:[r?r():(0,E.jsx)(G8,{text:e}),f]}):(0,E.jsxs)(E.Fragment,{children:[e.slice(0,l),f,e.slice(c-l)]})}function q8({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(Je(e.type,c,e.type===`toolCall`?e.toolCallId:void 0,e.type===`thinking`?l:void 0))===!0;if(e.type===`text`)return(0,E.jsx)(J8,{block:e,isStreaming:n,cwd:a,onOpenFile:o});if(e.type===`thinking`)return(0,E.jsx)(Y8,{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,E.jsx)(Z8,{block:a,result:o,duration:s,isStreaming:n,keepExpanded:f,longBlockCollapseChars:u})}return null}function J8({block:e,isStreaming:t,cwd:n,onOpenFile:r}){return(0,E.jsx)(Q6,{isStreaming:t,cwd:n,onOpenFile:r,children:e.text})}function Y8({block:e,sessionId:t,entryId:n,blockIndex:r,isStreaming:i=!1,keepExpanded:a=!1,longBlockCollapseChars:o=200}){let{t:s}=N(),[c,l]=(0,d.useState)(null),[u,f]=(0,d.useState)(!1),[m,h]=(0,d.useState)(null),g=(0,d.useRef)(!1),_=(0,d.useRef)(null);(0,d.useEffect)(()=>{e.deferred&&!g.current&&(g.current=!0,v())},[]);let v=async()=>{if(!(!e.deferred||c!==null)){if(!t||!n){h(s(`i18n.thinkingUnavailable`));return}f(!0),h(null);try{l(await R8(t,n,r))}catch(e){h(e instanceof Error?e.message:String(e))}finally{f(!1)}}},y=e.deferred?c:e.thinking,b=EZ(_,i,[y]);return(0,E.jsxs)(`div`,{style:{border:`1px solid var(--border)`,borderRadius:6,overflow:`hidden`,fontSize:`var(--text-base)`},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,padding:`6px 10px`,color:`var(--status-warning)`,fontSize:`var(--text-base)`,cursor:`default`},children:[(0,E.jsx)(Dr,{size:p.base,fill:`currentColor`,style:{flexShrink:0,color:`var(--bulb-warning)`}}),(0,E.jsx)(`span`,{children:s(`i18n.thinking`)})]}),(0,E.jsx)(`div`,{ref:_,onScroll:b,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,E.jsxs)(`span`,{style:{color:`var(--text-dim)`},children:[s(`i18n.loading`),`...`]}):m?(0,E.jsx)(`span`,{style:{color:`var(--status-error)`},children:m}):y?(0,E.jsx)(K8,{text:y,threshold:o,t:s,isStreaming:i,defaultExpanded:a}):EY(e)?(0,E.jsx)(`span`,{style:{color:`var(--text-dim)`,fontStyle:`italic`},children:s(`i18n.thinkingEncrypted`)}):(0,E.jsx)(`span`,{style:{color:`var(--text-dim)`},children:s(`i18n.noThinking`)})})]})}function X8({block:e,result:t,duration:n}){let{t:r}=N(),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(`
@@ -476,13 +476,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
476
476
  `)}if(e.role===`assistant`){let t=[];for(let n of e.content)n.type===`text`?t.push(n.text):n.type===`thinking`?t.push(n.thinking??``):n.type===`toolCall`&&t.push(`${n.toolName}(${JSON.stringify(n.input??{})})`);return t.join(`
477
477
  `)}if(e.role===`toolResult`)return e.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
478
478
  `);if(e.role===`bashExecution`){let t=e;return`${t.command}\n${t.output??``}`}return``}var x5=100,S5=44;function C5({messages:e,t,onJump:n}){let[r,i]=(0,d.useState)(``),[a,o]=(0,d.useState)(0),s=(0,d.useRef)(null),c=(0,d.useRef)(null),l=(0,d.useMemo)(()=>e.map((e,t)=>({msgIdx:t,role:e.role,text:b5(e)})),[e]),u=(0,d.useMemo)(()=>{let e=r.trim().toLowerCase();if(!e)return[];let t=[];for(let{msgIdx:n,role:r,text:i}of l){let a=0,o=i.toLowerCase().indexOf(e,a);for(;o!==-1&&t.length<x5;)t.push({msgIdx:n,role:r,text:i,start:o}),a=o+1,o=i.toLowerCase().indexOf(e,a);if(t.length>=x5)break}return t},[l,r]);(0,d.useEffect)(()=>{o(e=>Math.min(e,Math.max(0,u.length-1)))},[u.length]);let f=(0,d.useCallback)(e=>{let t=u[e];t&&(n(t.msgIdx),o(e))},[u,n]),m=(0,d.useCallback)(e=>{if(u.length!==0){if(e.key===`Enter`){e.preventDefault();let t=e.shiftKey?-1:1,n=(a+t+u.length)%u.length;f(n)}else e.key===`ArrowDown`?(e.preventDefault(),f(Math.min(a+1,u.length-1))):e.key===`ArrowUp`&&(e.preventDefault(),f(Math.max(a-1,0)))}},[a,f,u.length]);return(0,d.useEffect)(()=>{(c.current?.children[a])?.scrollIntoView({block:`nearest`})},[a]),(0,E.jsxs)(`div`,{style:{position:`relative`,flex:`1 1 0`,minWidth:0,maxWidth:2040},"data-testid":`search-box`,children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4,padding:`0 6px`,background:`var(--bg)`,border:`1px solid var(--border)`,borderRadius:6,height:30,boxSizing:`border-box`},children:[(0,E.jsx)(Hr,{size:p.xl,color:`var(--text-muted)`,style:{flexShrink:0}}),(0,E.jsx)(`input`,{ref:s,value:r,onChange:e=>i(e.target.value),onKeyDown:m,placeholder:t(`chat.searchPlaceholder`),style:{flex:1,minWidth:0,background:`transparent`,border:`none`,outline:`none`,color:`var(--text)`,fontSize:`var(--text-sm)`}}),r&&(0,E.jsx)(`button`,{type:`button`,onClick:()=>{i(``),s.current?.focus()},"aria-label":t(`chat.clearSearch`),style:{border:`none`,background:`transparent`,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-sm)`,flexShrink:0,padding:0},children:`✕`})]}),r.trim()&&(0,E.jsx)(`div`,{ref:c,style:{position:`absolute`,top:`calc(100% + 6px)`,left:0,right:0,maxHeight:`min(55vh, 480px)`,overflowY:`auto`,background:`var(--bg)`,border:`1px solid var(--border)`,borderRadius:8,boxShadow:`0 8px 24px var(--shadow-color)`,zIndex:60},children:u.length===0?(0,E.jsx)(`div`,{style:{padding:`10px 12px`,fontSize:`var(--text-base)`,color:`var(--text-muted)`},children:t(`chat.searchNoResults`)}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`div`,{style:{padding:`6px 12px`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`,borderBottom:`1px solid var(--border)`},children:t(`chat.searchResults`,{count:u.length})}),u.map((e,t)=>{let n=r.trim(),i=Math.max(0,e.start-S5),o=Math.min(e.text.length,e.start+n.length+S5),s=i>0?`…`:``,c=o<e.text.length?`…`:``,l=`${s}${e.text.slice(i,o)}${c}`;return(0,E.jsxs)(`button`,{type:`button`,onClick:()=>f(t),"data-testid":`search-result`,style:{display:`block`,width:`100%`,textAlign:`left`,padding:`8px 12px`,border:`none`,borderBottom:`1px solid var(--border)`,background:t===a?`var(--bg-selected)`:`transparent`,color:`var(--text)`,cursor:`pointer`,fontSize:`var(--text-base)`,lineHeight:1.5},children:[(0,E.jsxs)(`span`,{style:{color:`var(--text-dim)`,marginRight:6,fontSize:`var(--text-sm)`},children:[`#`,e.msgIdx]}),(0,E.jsx)(`span`,{children:w5(l,n)})]},`${e.msgIdx}-${e.start}`)})]})})]})}function w5(e,t){let n=[],r=e,i=0;for(;r.length>0;){let e=r.toLowerCase().indexOf(t.toLowerCase());if(e===-1){n.push(r);break}e>0&&n.push(r.slice(0,e)),n.push((0,E.jsx)(`mark`,{children:r.slice(e,e+t.length)},i++)),r=r.slice(e+t.length)}return n}function T5({modelName:e,messageCount:t,toolCallCount:n,t:r}){let i=[`${t} ${r(t===1?`chat.message`:`chat.messages`)}`];return n>0&&i.push(`${n} ${r(n===1?`chat.toolCall`:`chat.toolCalls`)}`),(0,E.jsxs)(`div`,{"data-testid":`pd-group-header`,style:{display:`flex`,alignItems:`center`,gap:8,width:`auto`,minHeight:24,padding:`3px 10px`,border:`1px solid var(--border)`,borderRadius:8,background:`var(--bg-panel)`,color:`var(--text-muted)`,fontSize:`var(--text-base)`,lineHeight:1.6},children:[e&&(0,E.jsx)(`span`,{style:{fontWeight:700,color:`var(--text)`,whiteSpace:`nowrap`},children:e}),(0,E.jsx)(`span`,{style:{minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:i.join(` · `)})]})}function E5(e){let{rows:t,messages:n,entryIds:r,modelNames:i,messageCwd:a,onOpenFile:o,sessionBusy:s,isNew:c,handleFork:l,forkingEntryId:u,handleNavigate:f,handleEditContent:p,sessionId:m,longBlockCollapseChars:h,recentExpandedBlockKeys:g,isStreaming:_,flashKey:v,itemRef:y,t:b,messageRefs:x,lastUserMsgRef:S,visibleRefIndexByMessage:C,scrollContainerRef:w,virtualizerRef:T,initialCache:D}=e,O=(0,d.useRef)(!1);(0,d.useLayoutEffect)(()=>{if(O.current)return;O.current=!0;let e=w.current;e&&e.scrollHeight>e.clientHeight&&(e.scrollTop=e.scrollHeight)},[w]);let k=new Map;for(let e of n)e.role===`toolResult`&&k.set(e.toolCallId,e);let A=new Map;{let e=0;for(let t=0;t<n.length;t++)n[t].role===`user`?(e+=1,A.set(t,e)):n[t].role===`assistant`&&e>0&&A.set(t,e)}let j=-1;for(let e=n.length-1;e>=0;e--)if(n[e].role===`user`){j=e;break}let M=(e,t)=>n=>{x.current[t]=n,e===j&&(S.current=n)},N=(e,t={})=>{let d=t.messageOverride??n[e],v=d.role===`user`&&e>0&&n[e-1].role===`assistant`?r[e-1]:void 0,y=d.role===`user`||d.role===`assistant`,b=C.get(e),x=!1;if(d.role===`assistant`){x=!0;for(let t=e+1;t<n.length;t++){let e=n[t].role;if(e===`user`)break;if(e===`assistant`){x=!1;break}}x&&_&&e===n.length-1&&(x=!1)}t.showTimestamp!==void 0&&(x=t.showTimestamp);let S;if(d.role===`assistant`){for(let t=e-1;t>=0;t--)if(n[t].role===`user`){S=n[t].timestamp;break}}let w=(0,E.jsx)(V8,{message:d,toolResults:k,modelNames:i,cwd:a,onOpenFile:o,entryId:r[e],onFork:s||c||e===0&&d.role===`user`?void 0:l,forking:u===r[e],onNavigate:s?void 0:f,prevAssistantEntryId:s?void 0:v,onEditContent:p,showTimestamp:x,turnStartTimestamp:S,sessionId:m,longBlockCollapseChars:h,recentExpandedBlockKeys:g,modelLabelVisible:t.modelLabelVisible,turnNumber:d.role===`user`||d.role===`assistant`&&t.isAnswer?A.get(e):void 0},`message-view-${e}`);return!y||t.attachRef===!1||b===void 0?w:(0,E.jsx)(`div`,{ref:M(e,b),children:w},`message-ref-${e}`)},P=e=>e.role!==`assistant`||!e.provider||!e.model?null:i?.[`${e.provider}/${e.model}`]??i?.[e.model]??e.model,ee=e=>{if(e.kind===`groupHeader`){let t=[];for(let r=e.groupUserIdx+1;r<=e.finalAssistantIdx;r++){let e=n[r];if(!e||e.role!==`assistant`)continue;let i=P(e);i&&!t.includes(i)&&t.push(i)}return(0,E.jsx)(T5,{modelName:t.join(` / `)||void 0,messageCount:e.messageCount,toolCallCount:e.toolCallCount,t:b})}return N(e.msgIdx,{attachRef:e.attachRef,messageOverride:e.messageOverride,showTimestamp:e.showTimestamp,modelLabelVisible:e.isProcess||e.isProcessFinal?!1:void 0,isAnswer:e.isAnswer})},F=e=>e.kind===`groupHeader`?8:e.isProcess||e.isProcessFinal?e.groupLast?14:8:0;return(0,E.jsx)(F8,{ref:T,data:t,cache:D,itemSize:200,bufferSize:400,scrollRef:w,children:e=>{let t=e.kind===`groupHeader`&&e.processRefIdx!==void 0?t=>{x.current[e.processRefIdx]=t}:void 0;return(0,E.jsx)(`div`,{className:v===e.key?`search-flash`:void 0,ref:y(e.key,t),style:{marginBottom:F(e)},children:ee(e)},e.key)}})}var D5={position:`relative`,display:`flex`,alignItems:`stretch`,flexShrink:0,width:`100%`,minWidth:0,height:36,gap:4,paddingLeft:4,paddingRight:4,borderBottom:`1px solid var(--border)`,background:`var(--bg)`},O5={display:`flex`,alignItems:`center`,justifyContent:`center`,alignSelf:`center`,width:32,height:32,padding:0,background:`transparent`,border:`1px solid var(--border)`,borderRadius:7,color:`var(--text-muted)`,flexShrink:0,cursor:`pointer`,transition:`color 0.12s, background 0.12s, border-color 0.12s`,"--hover-color":`var(--text)`,"--hover-bg":`var(--bg-selected)`,"--hover-border":`color-mix(in srgb, var(--accent) 35%, transparent)`},k5={display:`flex`,alignItems:`center`,gap:10,paddingLeft:12,paddingRight:12,height:`100%`,border:`none`,fontSize:`var(--text-sm)`,color:`var(--text-muted)`,whiteSpace:`nowrap`,cursor:`pointer`,fontVariantNumeric:`tabular-nums`,transition:`color 0.1s, background 0.1s`,"--hover-color":`var(--text)`},A5={flexShrink:0};function j5(e){return e>=1e6?`${(e/1e6).toPrecision(3)}M`:e>=1e3?`${(e/1e3).toPrecision(3)}K`:String(e)}function M5({sessionStats:e,contextUsage:t,activeTopPanel:n,toggleTopPanel:r,isMobile:i,t:a,locale:o}){let s=e?.tokens,c=e?.cost??0,l=e=>e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}k`:String(e),u=c>0?c>=.01?`$${c.toFixed(2)}`:`<$0.01`:null,d=`var(--text-muted)`,f=null;if(t?.contextWindow){let e=t.percent;e!==null&&e>90?d=`var(--status-error)`:e!==null&&e>70&&(d=`color-mix(in srgb, var(--status-warning) 95%, transparent)`),f=e===null?`? / ${l(t.contextWindow)}`:`${e.toFixed(0)}% / ${l(t.contextWindow)}`}let m=[];s&&(m.push(`in: ${s.input.toLocaleString(o)}`),m.push(`out: ${s.output.toLocaleString(o)}`),m.push(`cache read: ${s.cacheRead.toLocaleString(o)}`),m.push(`cache write: ${s.cacheWrite.toLocaleString(o)}`),c>0&&m.push(`cost: $${c.toFixed(4)}`));let h=s?s.input+s.cacheRead+s.cacheWrite:0,g=s&&h>0?s.cacheRead/h*100:null,_=(e,t)=>e===null?null:(0,E.jsx)(oi,{label:`${a(t)} · ${e.toFixed(1)}%`,children:(0,E.jsxs)(`span`,{style:{fontSize:`var(--text-xs)`,padding:`0 4px`,borderRadius:8,border:`1px solid color-mix(in srgb, var(--accent) 45%, transparent)`,background:`color-mix(in srgb, var(--accent) 10%, transparent)`,color:`var(--accent)`},children:[e.toFixed(1),`%`]})});if(t?.contextWindow){let e=t.percent;m.push(`context: ${e===null?`unknown`:`${e.toFixed(1)}%`} of ${t.contextWindow.toLocaleString()} tokens`)}let v=m.join(` | `);return(0,E.jsx)(oi,{label:v||a(`session.title`),wrapperStyle:{marginLeft:`auto`,flex:`0 0 auto`},children:(0,E.jsxs)(`button`,{type:`button`,onClick:()=>r(`session`),"aria-label":a(`session.title`),"aria-pressed":n===`session`,style:{...k5,background:n===`session`?`var(--bg-selected)`:`none`,borderTop:n===`session`?`2px solid var(--accent)`:`2px solid transparent`},className:`hover-shift`,children:[i&&(0,E.jsxs)(`svg`,{width:p.xl,height:p.xl,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,E.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12`,y2:`12`}),(0,E.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12.01`,y2:`8`})]}),!i&&s&&s.input>0&&(0,E.jsxs)(`span`,{style:N5,children:[(0,E.jsxs)(`svg`,{width:p.base,height:p.base,viewBox:`0 0 10 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{color:`var(--accent)`},children:[(0,E.jsx)(`line`,{x1:`5`,y1:`8.5`,x2:`5`,y2:`1.5`}),(0,E.jsx)(`polyline`,{points:`2 4 5 1.5 8 4`})]}),l(s.input)]}),!i&&s&&s.output>0&&(0,E.jsxs)(`span`,{style:N5,children:[(0,E.jsxs)(`svg`,{width:p.base,height:p.base,viewBox:`0 0 10 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{color:`var(--status-info)`},children:[(0,E.jsx)(`line`,{x1:`5`,y1:`1.5`,x2:`5`,y2:`8.5`}),(0,E.jsx)(`polyline`,{points:`2 6 5 8.5 8 6`})]}),l(s.output)]}),!i&&s&&s.cacheRead>0&&(0,E.jsxs)(`span`,{style:N5,children:[(0,E.jsxs)(`svg`,{width:p.base,height:p.base,viewBox:`0 0 10 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{color:`var(--status-success)`},children:[(0,E.jsx)(`path`,{d:`M8.5 5a3.5 3.5 0 1 1-1-2.45`}),(0,E.jsx)(`polyline`,{points:`6.5 1.5 8.5 2.5 7.5 4.5`})]}),l(s.cacheRead),_(g,`session.cacheReadRate`)]}),!i&&s&&s.cacheWrite>0&&(0,E.jsxs)(`span`,{style:N5,children:[(0,E.jsxs)(`svg`,{width:p.base,height:p.base,viewBox:`0 0 10 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{color:`var(--status-warning)`},children:[(0,E.jsx)(`path`,{d:`M8.5 5a3.5 3.5 0 1 0-1-2.45`}),(0,E.jsx)(`polyline`,{points:`2.5 1.5 4.5 2.5 3.5 4.5`})]}),l(s.cacheWrite)]}),!i&&u&&(0,E.jsx)(`span`,{style:P5,children:u}),f&&(0,E.jsxs)(`span`,{style:{...N5,color:d},children:[(0,E.jsxs)(`svg`,{width:p.base,height:p.base,viewBox:`0 0 10 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,E.jsx)(`path`,{d:`M1 9 L1 5 Q1 1 5 1 Q9 1 9 5 L9 9`}),(0,E.jsx)(`line`,{x1:`1`,y1:`9`,x2:`9`,y2:`9`})]}),f]})]})})}var N5={display:`flex`,alignItems:`center`,gap:4},P5={display:`flex`,alignItems:`center`,color:`var(--text)`,fontWeight:500},F5={position:`absolute`,top:`100%`,left:0,right:0,zIndex:1500,background:`var(--bg)`,borderBottom:`1px solid var(--border)`,boxShadow:`0 10px 28px var(--shadow-color)`,maxHeight:`calc(100dvh - 80px)`,overflowY:`auto`},I5={padding:`10px 16px`,fontSize:`var(--text-base)`,color:`var(--text-muted)`,fontStyle:`italic`},L5={fontSize:`var(--text-sm)`,fontWeight:700,color:`var(--text)`,marginBottom:6},R5={fontSize:`var(--text-xs)`,borderRadius:8,border:`1px solid color-mix(in srgb, var(--accent) 45%, transparent)`,background:`color-mix(in srgb, var(--accent) 10%, transparent)`,color:`var(--accent)`,whiteSpace:`nowrap`};function z5(e){let[t,n]=(0,d.useState)(null),r=(0,d.useRef)(null);return(0,d.useEffect)(()=>{if(!e){r.current=null,n(null);return}r.current===null&&(r.current=Date.now());let t=()=>{document.hidden||r.current!==null&&n(ht((Date.now()-r.current)/1e3))};t();let i=setInterval(t,1e3),a=()=>{document.hidden||t()};return document.addEventListener(`visibilitychange`,a),()=>{clearInterval(i),document.removeEventListener(`visibilitychange`,a)}},[e]),t}function B5(e){if(e.role!==`user`)return null;if(typeof e.content==`string`){let t=e.content.trim();return t.length>0?t:null}let t=e.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
479
- `).trim();return t.length>0?t:null}function V5({session:e,newSessionCwd:t,onAgentEnd:n,onSessionCreated:r,onSessionForked:i,modelsRefreshKey:a,chatInputRef:o,onOpenModelConfig:s,onSessionRenamed:c,windowTitleBase:l,onOpenFile:u,toolbarExtra:f,closedWidgetKeys:m,onCloseWidget:h,onExtensionWidgetsChange:g,onExtensionDialogChange:_}){let{t:v,locale:y}=N(),{scrollStepPx:b,autoReloadSeconds:x,longBlockCollapseChars:S,recentBlocksExpanded:C,widgetGeometries:w,setWidgetGeometry:T,widgetMessages:D,startScreenMessages:O}=ge(),{soundEnabled:k,onSoundToggle:A,playDoneSound:j,unlockAudio:M}=eY(),P=ne(),ee=oe(),F=(0,d.useRef)(j);F.current=j;let te=(0,d.useRef)(k);te.current=k;let re=(0,d.useRef)(null),ae=(0,d.useCallback)(()=>{te.current&&F.current(),n?.()},[n]),I=(0,d.useCallback)(e=>{o?.current?.insertIfEmpty(e)},[o]),L=(0,d.useCallback)(e=>{o?.current?.fillInput(e)},[o]),[se,R]=(0,d.useState)({kind:`idle`}),ce=pe(),le=(0,d.useRef)(null),[ue,de]=(0,d.useState)(null),fe=pe(),me=(0,d.useRef)(null),he=(0,d.useRef)(null),{activeTopPanel:_e,toggleTopPanel:ve,closeTopPanel:ye}=Me(),be=pe(),xe=(0,d.useCallback)(()=>{be.schedule(()=>{ye()},150)},[be,ye]),Se=be.cancel;(0,d.useEffect)(()=>{ce.cancel(),R({kind:`idle`}),de(null),le.current=e?.id??null},[e?.id,ce]);let Ce=(0,d.useCallback)(()=>{e&&window.open(`/api/sessions/${encodeURIComponent(e.id)}/export?inline=1`,`_blank`,`noopener,noreferrer`)},[e]),we=(0,d.useCallback)((e,t)=>{bY(t).then(()=>{fe.cancel(),de(e),fe.schedule(()=>de(null),1400)})},[fe]),{loading:Te,error:Ee,messages:De,entryIds:Oe,streamState:ke,agentRunning:Ae,bashRunning:je,bashOutput:Ne,pendingBash:Pe,modelNames:Fe,modelList:Ie,modelError:Le,modelScopeWarnings:Re,modelThinkingLevels:ze,modelThinkingLevelMaps:Be,toolPreset:Ve,thinkingLevel:He,retryInfo:Ue,contextUsage:We,forkingEntryId:Ge,isCompacting:Ke,compactError:qe,compactResult:Ye,displayModel:Xe,sessionStats:Ze,systemPrompt:Qe,slashCommands:$e,slashCommandsLoading:et,queuedMessages:tt,notices:nt,noticeModals:rt,dismissNoticeModal:it,extensionDialog:at,extensionCustomUi:ot,extensionStatuses:st,extensionWidgets:ct,respondToExtensionUi:lt,sendExtensionCustomInput:ut,isAutoModelSelection:dt,agentPhase:ft,commandBusy:pt,isNew:mt,tree:gt,sessionIdRef:_t,activeLeafId:vt,loadContext:yt,messagesEndRef:bt,scrollContainerRef:xt,lastUserMsgRef:St,handleSend:Ct,handleAbort:wt,handleFork:Tt,handleNavigate:Et,handleLeafChange:Dt,handleModelChange:Ot,handleCompact:kt,handleSteer:At,handleFollowUp:jt,handlePromptWithStreamingBehavior:Mt,handleAbortCompaction:Nt,handleRecallQueue:Pt,handleBuiltinSlashCommand:Ft,handleToolPresetChange:It,handleThinkingLevelChange:Lt,loadSlashCommands:Rt,setSessionStatsOverride:zt}=GJ({session:e,newSessionCwd:t,onAgentEnd:ae,onSessionCreated:r,onSessionForked:i,modelsRefreshKey:a,chatInputRef:o});(0,d.useEffect)(()=>{g?.(ct)},[ct,g]);let Bt=Ae||je,Vt=(0,d.useCallback)(e=>{Bt?e.startsWith(`/`)?Mt(e,`steer`):At(e):Ct(e)},[Bt,At,Mt,Ct]),Ht=(0,d.useCallback)(async()=>{let t=e?.id;if(!(!t||se.kind===`naming`)){ce.cancel(),ye(),R({kind:`naming`});try{let e=await fetch(`/api/sessions/${encodeURIComponent(t)}/auto-name`,{method:`POST`}),n=await e.json().catch(()=>({}));if(!e.ok||!n.title)throw Error(n.error||`HTTP ${e.status}`);let r=n.title.trim();if(le.current!==t)return;c?.(t,r),zt(e=>e?.sessionId===t?{...e,sessionName:r}:e),R({kind:`success`}),ce.schedule(()=>R({kind:`idle`}),1800)}catch(e){if(le.current!==t)return;let n=e instanceof Error?e.message:String(e);R({kind:`error`,message:n}),ce.schedule(()=>R({kind:`idle`}),5e3)}}},[se.kind,ce,e?.id,ye,c,zt]),Ut=(0,d.useCallback)(async e=>{let t=await Ft(e);return t.handled&&t.action===`openSessionStats`&&ve(`session`),t},[Ft,ve]),Wt=(0,d.useMemo)(()=>{let e=ke.streamingMessage;if(!e||e.role!==`assistant`)return;let t=0;for(let e of De)e.role===`user`&&(t+=1);return t>0?t:void 0},[De,ke.streamingMessage]),Gt=(0,d.useMemo)(()=>{if(C==null)return;let e=[];De.forEach((t,n)=>{t.role===`assistant`&&(t.content??[]).forEach((t,r)=>{t.type===`thinking`?e.push(Je(`thinking`,Oe[n]??``,void 0,r)):t.type===`toolCall`&&e.push(Je(`toolCall`,``,t.toolCallId))})});let t=e.slice(-((C??0)+1));return new Set(t)},[De,Oe,C]),{runningSessionIds:Jt,runningPhaseSince:Yt,runningBusySince:Xt}=Kt(),Zt=e?.id??_t.current??``,$t=Jt.has(Zt)||Ae||pt||je,en=z5($t),tn=qt($t,Yt[Zt]),nn=qt($t,Xt[Zt]),rn=cY(xZ(st)),an=(0,d.useCallback)(()=>{let e=_t.current;e&&yt(e,vt,!0)},[vt,yt,_t]);(0,d.useEffect)(()=>{if(!x||x<=0)return;let e=setInterval(()=>{let e=_t.current;e&&yt(e,vt,!0)},x*1e3);return()=>clearInterval(e)},[x,vt,yt,_t]),(0,d.useEffect)(()=>{!at||re.current===at.id||(re.current=at.id,Rq(`ui-chain`,`4b ExtensionDialog mounted, play sound`,`${at.method} id=${at.id.slice(0,8)} title=${JSON.stringify(at.title)}`),F.current())},[at]),(0,d.useEffect)(()=>{_?.(at!==null)},[at,_]),(0,d.useEffect)(()=>{Qt()},[]),(0,d.useEffect)(()=>{ie(Bt?wt:null)},[Bt,wt]);let on=(0,d.useRef)(``);(0,d.useEffect)(()=>{let e=()=>{if(document.hasFocus())return;let e=ke.isStreaming,t=l?` · ${l}`:``,n;if(at)n=`❓`;else if(Bt){let t=en??``;if(ft?.kind===`running_tools`)n=`🔧 ${t}`.trimEnd();else if(ft?.kind===`running_command`)n=`💻 ${t}`.trimEnd();else if(ft?.kind===`thinking`)n=`💡 ${t}`.trimEnd();else if(ft?.kind===`waiting_model`&&e){let e=[...De].reverse().find(e=>e.role===`assistant`),t=e&&e.role===`assistant`?e.usage:void 0;n=`⬇ ${j5(t?.input??0)}↑ ${j5(t?.output??0)}↓`}else n=`⏳ ${t}`.trimEnd()}else{let e;for(let t=De.length-1;t>=0;t--){let n=De[t];if(!(n.role!==`assistant`||!n.timestamp)){for(let r=t-1;r>=0;r--){let t=De[r];if(t.role===`user`&&t.timestamp){let r=Math.round((n.timestamp-t.timestamp)/1e3);r>0&&(e=r);break}}break}}if(e===void 0)return;n=`✅ ${ht(e)}`}let r=`${n}${t}`;r!==on.current&&(on.current=r,document.title=r)};e();let t=()=>{document.visibilityState===`hidden`&&e()};return document.addEventListener(`visibilitychange`,t),window.addEventListener(`blur`,e),()=>{document.removeEventListener(`visibilitychange`,t),window.removeEventListener(`blur`,e)}},[ft,ke.isStreaming,en,De,Bt,l,at]);let sn=(0,d.useRef)(null);(0,d.useEffect)(()=>{Bt?sn.current===null&&(sn.current=Date.now()):sn.current=null},[Bt]),(0,d.useEffect)(()=>{if(!Bt&&!at)return;let e=()=>{if(!document.hidden||document.hasFocus())return;let e=l?` · ${l}`:``,t;if(at)t=`❓`;else if(Bt){let e=sn.current?ht((Date.now()-sn.current)/1e3):en??``;if(ft?.kind===`running_tools`)t=`🔧 ${e}`.trimEnd();else if(ft?.kind===`running_command`)t=`💻 ${e}`.trimEnd();else if(ft?.kind===`thinking`)t=`💡 ${e}`.trimEnd();else if(ft?.kind===`waiting_model`&&ke.isStreaming){let e=[...De].reverse().find(e=>e.role===`assistant`),n=e&&e.role===`assistant`?e.usage:void 0;t=`⬇ ${j5(n?.input??0)}↑ ${j5(n?.output??0)}↓`}else t=`⏳ ${e}`.trimEnd()}else return;let n=`${t}${e}`;n!==on.current&&(on.current=n,document.title=n)},t=setInterval(e,1e3);return document.addEventListener(`visibilitychange`,e),()=>{clearInterval(t),document.removeEventListener(`visibilitychange`,e)}},[Bt,at,ft,ke.isStreaming,De,l,en]);let[cn,ln]=(0,d.useState)(null),[un,dn]=(0,d.useState)(!0),fn=(0,d.useRef)(new Map),pn=(0,d.useRef)(new Map),mn=(0,d.useRef)(null),hn=(0,d.useRef)(!0),gn=(0,d.useRef)(0),_n=(0,d.useCallback)(()=>{let e=xt.current;e&&(e.scrollTop=e.scrollHeight),hn.current=!0,dn(!0)},[xt]),vn=(0,d.useCallback)(()=>{let e=xt.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight;if(hn.current&&t>0&&e.scrollHeight!==gn.current){gn.current=e.scrollHeight,e.scrollTop=e.scrollHeight;return}t<16?(hn.current=!0,dn(!0)):t>64&&(hn.current=!1,dn(!1)),gn.current=e.scrollHeight},[xt]),yn=(0,d.useRef)(new Map),bn=(0,d.useCallback)((e,t)=>{yn.current.set(e,t);let n=pn.current.get(e);return n||(n=t=>{if(yn.current.get(e)?.(t),!t){fn.current.get(e)?.disconnect(),fn.current.delete(e),yn.current.delete(e);return}let n=fn.current.get(e);n?n.disconnect():(n=new ResizeObserver(()=>{document.hidden||hn.current&&requestAnimationFrame(()=>{if(document.hidden)return;let e=xt.current;e&&hn.current&&(e.scrollTop=e.scrollHeight)})}),fn.current.set(e,n)),n.observe(t)},pn.current.set(e,n)),n},[xt]);(0,d.useEffect)(()=>()=>{fn.current.forEach(e=>e.disconnect()),fn.current.clear(),pn.current.clear(),yn.current.clear()},[]);let xn=e?.id??t??``;(0,d.useEffect)(()=>{if(In(!1),Ln.current=null,fn.current.forEach(e=>e.disconnect()),fn.current.clear(),pn.current.clear(),yn.current.clear(),kn.current=[],St.current=null,xt.current){xt.current.scrollTop=0;let e=xt.current.firstElementChild;if(e&&e.children.length===1){let t=e.firstElementChild;t&&t.style.height&&(t.style.height=`0px`)}}},[xn]),(0,d.useEffect)(()=>{let e=xt.current;if(!e)return;let t=new ResizeObserver(()=>{document.hidden||hn.current&&requestAnimationFrame(()=>{if(document.hidden)return;let e=xt.current;e&&hn.current&&(e.scrollTop=e.scrollHeight)})});return t.observe(e),()=>t.disconnect()},[xt]),(0,d.useEffect)(()=>()=>{},[]);let{isDragOver:Sn,handleDragEnter:Cn,handleDragOver:wn,handleDragLeave:Tn,handleDrop:En}=tY((0,d.useCallback)(e=>{Bt||o?.current?.addImages(e)},[Bt,o])),Dn=De.filter(e=>e.role===`user`||e.role===`assistant`),On=(0,d.useMemo)(()=>{let e=new Set,t=[];for(let n=De.length-1;n>=0;--n){let r=B5(De[n]);if(!(!r||e.has(r))&&(e.add(r),t.push(r),t.length>=50))break}return t.reverse()},[De]),kn=yZ(Dn.length),An=(0,d.useMemo)(()=>{for(let e=De.length-1;e>=0;e--)if(RY(De[e]))return e;return-1},[De]),jn=(0,d.useMemo)(()=>{let e=new Map,t=0;return De.forEach((n,r)=>{(n.role===`user`||n.role===`assistant`)&&e.set(r,t++)}),e},[De]),Mn=(0,d.useMemo)(()=>BY(De,{isLiveTail:(Bt||ke.isStreaming)&&An>=0,lastAnchorIdx:An,visibleRefIndexByMessage:jn}),[De,Bt,ke.isStreaming,An,jn]),Nn=(0,d.useMemo)(()=>VY(Mn),[Mn]),Pn=(0,d.useCallback)(e=>{let t=Nn.get(e);if(t===void 0)return null;let n=mn.current;return n?n.getItemOffset(t):null},[Nn]),[Fn,In]=(0,d.useState)(!1),Ln=(0,d.useRef)(null),Rn=Fn&&Ln.current?[Ln.current,200]:void 0;(0,d.useLayoutEffect)(()=>{Fn||Mn.length!==0&&xt.current&&(Ln.current=Mn.map(e=>e.estimate),In(!0))},[Fn,Mn,xt]);let[zn,Bn]=(0,d.useState)(null),Vn=(0,d.useRef)(null),Hn=(0,d.useCallback)(e=>{let t=Nn.get(e);if(t===void 0)return;let n=mn.current;if(!n)return;n.scrollToIndex(t,{align:`start`,offset:-24,smooth:!0});let r=Mn[t].key;Bn(r),Vn.current&&clearTimeout(Vn.current),Vn.current=setTimeout(()=>{Vn.current=null,Bn(e=>e===r?null:e)},1700)},[Mn,Nn]),Un=mt&&De.length===0&&!ke.isStreaming&&!Bt,Wn=!Ae&&!ke.isStreaming&&!pt&&!je;(0,d.useLayoutEffect)(()=>{if(!O.length||!Wn||!hn.current)return;let e=xt.current;e&&(e.scrollTop=e.scrollHeight)},[O.length,Wn,xt]);let Gn=e?.cwd??t??void 0,Kn=Xe?ze[`${Xe.provider}/${Xe.modelId}`]??null:null,qn=Xe?Be[`${Xe.provider}/${Xe.modelId}`]??null:null,Jn=(0,E.jsx)(mX,{ref:o,onSend:Ct,onAbort:wt,onSteer:Ae?At:void 0,onFollowUp:Ae?jt:void 0,onPromptWithStreamingBehavior:Ae?Mt:void 0,isStreaming:Bt,commandBusy:pt,model:Xe,isAutoModelSelection:dt,modelNames:Fe,modelList:Ie,modelError:Le,modelScopeWarnings:Re,onModelChange:Ot,onCompact:e||mt?kt:void 0,onReloadFromDisk:an,onAbortCompaction:Nt,isCompacting:Ke,compactError:qe,compactResult:Ye,toolPreset:Ve,onToolPresetChange:e||mt?It:void 0,thinkingLevel:He,onThinkingLevelChange:e||mt?Lt:void 0,availableThinkingLevels:Kn,thinkingLevelMap:qn,onOpenModelConfig:s,retryInfo:Ue,queuedMessages:tt,inputHistory:On,onRecallQueue:Pt,slashCommands:$e,slashCommandsLoading:et,onLoadSlashCommands:Rt,onBuiltinCommand:Ut,soundEnabled:k,onSoundToggle:A,onAudioUnlock:M,draftKey:e?.id??(t?`new:${t}`:void 0),cwd:e?.cwd??t});return Te?(0,E.jsx)(`div`,{className:`flex h-full items-center justify-center text-text-muted`,children:v(`chat.loadingSession`)}):Ee?(0,E.jsx)(`div`,{className:`flex h-full items-center justify-center text-red-400`,children:Ee}):(0,E.jsxs)(`div`,{ref:ln,className:`relative flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,style:{paddingBottom:`env(safe-area-inset-bottom)`},onDragEnter:Cn,onDragOver:wn,onDragLeave:Tn,onDrop:En,children:[Sn&&!Bt&&(0,E.jsxs)(`div`,{className:`pointer-events-none absolute inset-0 z-50 flex animate-[drop-zone-in_0.15s_ease_both] items-center justify-center bg-[color-mix(in_srgb,var(--accent)_6%,transparent)] backdrop-blur-[1px]`,children:[(0,E.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center`,children:[0,.8,1.6].map(e=>(0,E.jsx)(`div`,{className:`absolute h-[720px] w-[720px] rounded-full border-[1.5px] border-solid border-[color-mix(in_srgb,var(--accent)_50%,transparent)] animate-[drop-ripple_2.4s_ease-out_infinite_backwards]`,style:{transformOrigin:`center`,animationDelay:`${e}s`}},e))}),(0,E.jsxs)(`svg`,{width:`280`,height:`280`,viewBox:`0 0 140 140`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,className:`drop-shadow-[0_6px_18px_var(--accent-glow)]`,children:[(0,E.jsx)(`rect`,{x:`28`,y:`44`,width:`84`,height:`60`,rx:`8`,fill:`color-mix(in srgb, var(--accent) 8%, transparent)`,stroke:`color-mix(in srgb, var(--accent) 50%, transparent)`,strokeWidth:`1.8`}),(0,E.jsx)(`path`,{d:`M36 100 L54 72 L68 88 L80 74 L104 100Z`,fill:`color-mix(in srgb, var(--accent) 16%, transparent)`,stroke:`color-mix(in srgb, var(--accent) 40%, transparent)`,strokeWidth:`1.4`,strokeLinejoin:`round`}),(0,E.jsx)(`circle`,{cx:`96`,cy:`58`,r:`8`,fill:`color-mix(in srgb, var(--accent) 22%, transparent)`,stroke:`color-mix(in srgb, var(--accent) 55%, transparent)`,strokeWidth:`1.6`}),(0,E.jsxs)(`g`,{stroke:`color-mix(in srgb, var(--accent) 45%, transparent)`,strokeWidth:`1.4`,strokeLinecap:`round`,children:[(0,E.jsx)(`line`,{x1:`96`,y1:`46`,x2:`96`,y2:`43`}),(0,E.jsx)(`line`,{x1:`96`,y1:`70`,x2:`96`,y2:`73`}),(0,E.jsx)(`line`,{x1:`84`,y1:`58`,x2:`81`,y2:`58`}),(0,E.jsx)(`line`,{x1:`108`,y1:`58`,x2:`111`,y2:`58`}),(0,E.jsx)(`line`,{x1:`87.5`,y1:`49.5`,x2:`85.4`,y2:`47.4`}),(0,E.jsx)(`line`,{x1:`104.5`,y1:`66.5`,x2:`106.6`,y2:`68.6`}),(0,E.jsx)(`line`,{x1:`104.5`,y1:`49.5`,x2:`106.6`,y2:`47.4`}),(0,E.jsx)(`line`,{x1:`87.5`,y1:`66.5`,x2:`85.4`,y2:`68.6`})]})]})]}),at&&(0,E.jsx)(W5,{request:at,onRespond:lt}),rt.length>0&&(0,E.jsx)(U5,{modals:rt,onDismiss:it}),ot&&(0,E.jsx)(K5,{request:ot,onInput:ut}),ct.filter(e=>!m.has(e.key)).map((e,t)=>(0,E.jsx)(q5,{widget:e,saved:w[e.key],messages:D[e.key]??[],defaultOffset:t%3==0?{dx:0,dy:0}:t%3==1?{dx:-80,dy:0}:{dx:80,dy:0},onCloseWidget:h,setWidgetGeometry:T,onSend:Vt,fillChatInput:L,portalTarget:cn},e.key)),(0,E.jsxs)(`div`,{ref:me,"data-testid":`chat-toolbar`,style:D5,children:[(0,E.jsx)(oi,{label:v(e?`history.full`:`history.unsaved`),children:(0,E.jsx)(`button`,{onClick:Ce,disabled:!e,"aria-label":v(`history.full`),style:{...O5,color:e?`var(--text-muted)`:`var(--text-dim)`,cursor:e?`pointer`:`not-allowed`,opacity:e?1:.45},className:e?`hover-shift`:void 0,children:(0,E.jsx)(zr,{size:p.base,style:A5})})}),(()=>{let t=!!(e&&(Ze?.userMessages??e.messageCount)>0),n=!e||!t||se.kind===`naming`,r=se.kind===`success`,i=se.kind===`error`,a=se.kind===`naming`?v(`title.generating`):v(r?`title.updated`:i?`title.failed`:`title.generate`),o=e?t?i?se.message:v(`title.generateSession`):v(`title.noMessages`):v(`title.unsaved`);return(0,E.jsx)(oi,{label:o,children:(0,E.jsx)(`button`,{type:`button`,onClick:()=>void Ht(),disabled:n,"aria-label":a,style:{...O5,color:i?`var(--status-error)`:r?`var(--status-success)`:n?`var(--text-dim)`:`var(--text-muted)`,cursor:n?`not-allowed`:`pointer`,opacity:n&&se.kind!==`naming`?.45:1,"--hover-color":i?`var(--status-error)`:`var(--text)`},className:n?void 0:`hover-shift`,children:se.kind===`naming`?(0,E.jsx)(Ar,{className:`animate-spin`,size:p.lg,"aria-hidden":`true`}):r?(0,E.jsx)(ur,{size:p.lg,"aria-hidden":`true`}):(0,E.jsx)(Nr,{size:p.lg,"aria-hidden":`true`,style:A5})})})})(),(0,E.jsx)(oi,{label:v(`i18n.branches`),children:(0,E.jsx)($X,{tree:gt,activeLeafId:vt,onLeafChange:Dt,inline:!0,compact:!0,containerRef:me,open:_e===`branches`,onToggle:()=>ve(`branches`),hasSession:!0})}),(0,E.jsx)(oi,{label:v(`system.prompt`),children:(0,E.jsx)(`button`,{ref:he,onClick:()=>ve(`system`),"aria-label":v(`system.prompt`),"aria-pressed":_e===`system`,style:{...O5,background:_e===`system`?`var(--bg-selected)`:`transparent`,borderColor:_e===`system`?`var(--accent)`:`var(--border)`,cursor:`pointer`,color:_e===`system`?`var(--text)`:`var(--text-muted)`,"--hover-color":`var(--text)`},className:`hover-shift`,children:(0,E.jsx)(yr,{size:p.base,style:A5})})}),(0,E.jsx)(oi,{label:v(`session.reload`),children:(0,E.jsx)(`button`,{type:`button`,"data-testid":`chat-toolbar-reload`,onClick:()=>void Ft(`/reload`),"aria-label":v(`session.reload`),style:{...O5,background:`transparent`,borderColor:`var(--border)`,cursor:`pointer`,color:`var(--text-muted)`,"--hover-color":`var(--text)`},className:`hover-shift`,children:(0,E.jsx)(Rr,{size:p.base,style:A5})})}),(0,E.jsx)(`div`,{style:{marginLeft:8,display:`flex`,alignItems:`center`,flex:1,minWidth:0},children:(0,E.jsx)(C5,{messages:De,t:v,onJump:Hn})}),Ze||We?(0,E.jsx)(M5,{sessionStats:Ze,contextUsage:We,activeTopPanel:_e,toggleTopPanel:ve,isMobile:P,t:v,locale:y}):null,f,_e===`system`&&(0,E.jsx)(`div`,{onMouseEnter:Se,onMouseLeave:xe,style:F5,children:Qe?(0,E.jsx)(`div`,{style:{padding:`12px 16px`,color:`var(--text-muted)`,fontSize:`var(--text-base)`,lineHeight:1.6,whiteSpace:`pre-wrap`,fontFamily:`var(--font-mono)`},children:Qe}):Qe===``?(0,E.jsx)(`div`,{style:I5,children:v(`system.empty`)}):(0,E.jsx)(`div`,{style:I5,children:v(`system.load`)})}),_e===`session`&&(0,E.jsx)(`div`,{onMouseEnter:Se,onMouseLeave:xe,style:{...F5,padding:`12px 16px`},children:Ze?(()=>{let e=[...Ze.sessionName?[{label:v(`session.name`),value:Ze.sessionName,copyField:null}]:[],{label:v(`session.file`),value:Ze.sessionFile??v(`session.inMemory`),copyField:`file`},{label:v(`session.id`),value:Ze.sessionId,copyField:`id`}],t=[[v(`session.user`),Ze.userMessages.toLocaleString(y)],[v(`session.assistant`),Ze.assistantMessages.toLocaleString(y)],[v(`session.toolCalls`),Ze.toolCalls.toLocaleString(y)],[v(`session.toolResults`),Ze.toolResults.toLocaleString(y)],[v(`session.total`),Ze.totalMessages.toLocaleString(y)]],n=Ze.tokens.input+Ze.tokens.cacheRead+Ze.tokens.cacheWrite,r=[[v(`session.input`),Ze.tokens.input.toLocaleString(y),{title:v(`session.inputHint`)}],[v(`session.output`),Ze.tokens.output.toLocaleString(y),{title:v(`session.outputHint`)}],...Ze.tokens.cacheRead>0?[[v(`session.cacheRead`),Ze.tokens.cacheRead.toLocaleString(y),{title:v(`session.cacheReadHint`),badge:n>0?(e=>`${e.toFixed(1)}%`)(Ze.tokens.cacheRead/n*100):void 0,badgeTitle:v(`session.cacheReadRate`)}]]:[],...Ze.tokens.cacheWrite>0?[[v(`session.cacheWrite`),Ze.tokens.cacheWrite.toLocaleString(y),{title:v(`session.cacheWriteHint`)}]]:[],[v(`session.total`),Ze.tokens.total.toLocaleString(y),{title:v(`session.totalHint`)}]],i=We??Ze.contextUsage,a=e=>e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}k`:String(e),o=[...Ze.cost>0?[[v(`session.cost`),`$${Ze.cost.toFixed(4)}`]]:[],...i?.contextWindow?[[v(`session.context`),`${i.percent===null?`?`:`${i.percent.toFixed(1)}%`} / ${a(i.contextWindow)}`]]:[]],s=(e,t,n=`left`,r=!1)=>(0,E.jsxs)(`div`,{style:{minWidth:0},children:[(0,E.jsx)(`div`,{style:L5,children:e}),(0,E.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:r?`max-content max-content max-content`:`auto minmax(0, 1fr) max-content`,columnGap:r?14:12,rowGap:4,justifyContent:r?`start`:void 0},children:t.map(([t,i,a])=>(0,E.jsxs)(`div`,{style:{display:`contents`},children:[(0,E.jsx)(oi,{label:a?.title,wrapperStyle:{display:`flex`,color:`var(--text-dim)`,whiteSpace:`nowrap`},children:(0,E.jsx)(`div`,{style:{color:`var(--text-dim)`,whiteSpace:`nowrap`},children:t})}),(0,E.jsx)(`div`,{style:{color:`var(--text-muted)`,minWidth:0,overflowWrap:r?`normal`:`anywhere`,textAlign:n,whiteSpace:n===`right`?`nowrap`:`normal`},children:i}),(0,E.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`flex-end`,minWidth:0},children:a?.badge&&(0,E.jsx)(oi,{label:`${a.badgeTitle??``}${a.badgeTitle?` · `:``}${a.badge}`,children:(0,E.jsx)(`span`,{style:{padding:`0 5px`,...R5},children:a.badge})})})]},`${e}:${t}`))})]}),c=(e,t)=>{let n=ue===e;return(0,E.jsx)(oi,{label:v(n?`session.copied`:e===`file`?`session.copyFile`:`session.copyId`),children:(0,E.jsx)(`button`,{type:`button`,onClick:()=>we(e,t),style:{alignSelf:`start`,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:22,height:22,marginTop:-2,color:n?`var(--accent)`:`var(--text-dim)`,background:`transparent`,border:`1px solid var(--border)`,borderRadius:4,cursor:`pointer`,flex:`0 0 auto`,transition:`color 0.12s, border-color 0.12s, background 0.12s`,"--hover-color":`var(--accent)`,"--hover-border":`var(--accent)`,"--hover-bg":`var(--bg-hover)`},className:`hover-shift`,children:n?(0,E.jsx)(`svg`,{width:p.base,height:p.base,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,E.jsx)(`polyline`,{points:`20 6 9 17 4 12`})}):(0,E.jsxs)(`svg`,{width:p.base,height:p.base,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,E.jsx)(`rect`,{x:`9`,y:`9`,width:p.lg,height:p.lg,rx:`2`,ry:`2`}),(0,E.jsx)(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})]})})})},l=(0,E.jsxs)(`div`,{style:{minWidth:0},children:[(0,E.jsx)(`div`,{style:L5,children:v(`session.infoSection`)}),(0,E.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`auto minmax(0, 1fr) auto`,columnGap:12,rowGap:8,alignItems:`start`},children:e.map(e=>(0,E.jsxs)(`div`,{style:{display:`contents`},children:[(0,E.jsx)(`div`,{style:{color:`var(--text-dim)`,whiteSpace:`nowrap`},children:e.label}),(0,E.jsx)(`div`,{style:{color:`var(--text-muted)`,minWidth:0,overflowWrap:`anywhere`,wordBreak:`break-word`,whiteSpace:`normal`},children:e.value}),(0,E.jsx)(`div`,{children:e.copyField?c(e.copyField,e.value):null})]},`session-info:${e.label}`))})]});return(0,E.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:P?`1fr`:`minmax(360px, 1.7fr) minmax(140px, 0.55fr) minmax(190px, 0.75fr)`,gap:P?16:24,fontSize:`var(--text-base)`,lineHeight:1.5,fontFamily:`var(--font-mono)`},children:[l,s(v(`session.messages`),t),s(v(`session.tokens`),[...r,...o],`right`,!0)]})})():(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,color:`var(--text-muted)`,fontStyle:`italic`},children:v(`session.load`)})})]}),Un?(0,E.jsx)(`div`,{className:`relative flex flex-1 flex-col items-center justify-center overflow-y-auto px-4 py-8`,children:(0,E.jsxs)(`div`,{className:`w-full max-w-[820px]`,children:[(0,E.jsxs)(`div`,{className:`mb-3`,style:{textAlign:`center`,padding:`40px 0`},children:[ee==="default"?(0,E.jsxs)(`div`,{style:{marginBottom:20,fontSize:`var(--text-sm)`,color:`var(--text-muted)`,lineHeight:1.6},children:[v(`notify.permission.bannerHintBefore`),` `,(0,E.jsxs)(`svg`,{width:16,height:16,viewBox:`0 0 24 24`,fill:`none`,stroke:`var(--accent)`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{display:`inline-block`,verticalAlign:-2},children:[(0,E.jsx)(`path`,{d:`M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9`}),(0,E.jsx)(`path`,{d:`M10.3 21a1.94 1.94 0 0 0 3.4 0`})]}),` `,v(`notify.permission.bannerHintAfter`)]}):null,(0,E.jsx)(`div`,{style:{fontSize:`var(--text-6xl)`,fontWeight:700,fontStyle:`italic`,color:`var(--accent)`},children:`Pi Web`}),t?(0,E.jsx)(`div`,{style:{marginTop:6,fontSize:`var(--text-3xl)`,color:`var(--text-muted)`,fontFamily:`var(--font-mono)`},children:t}):null]}),O.length>0&&(0,E.jsx)(`div`,{style:{marginBottom:28},children:(0,E.jsx)(QJ,{messages:O,onSend:Vt,onFillInput:L,testIdPrefix:`start-screen-msg`,wrapperTestId:`start-screen-messages`,center:!0})}),(0,E.jsx)(`div`,{style:{position:`absolute`,top:12,left:0,right:0,zIndex:40,padding:`0 16px`,pointerEvents:`none`},children:(0,E.jsx)(`div`,{style:{maxWidth:820,margin:`0 auto`},children:(0,E.jsx)(H5,{notices:nt,floating:!0,align:`right`})})}),Jn]})}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,E.jsx)(`div`,{style:{position:`absolute`,top:12,left:0,right:P?0:`calc(${vY} + 48px)`,zIndex:40,padding:`0 16px`,pointerEvents:`none`},children:(0,E.jsx)(`div`,{style:{maxWidth:820,margin:`0 auto`},children:(0,E.jsx)(H5,{notices:nt,floating:!0,align:`right`})})}),(0,E.jsx)(`div`,{ref:xt,onScroll:vn,className:`min-h-0 min-w-0 flex-1 overflow-x-hidden overflow-y-auto pt-4 [scrollbar-width:none] [overflow-anchor:none]`,style:{paddingRight:48},"data-testid":`message-list`,children:(0,E.jsx)(`div`,{style:{minWidth:0,padding:`0 16px`},children:(0,E.jsxs)(`div`,{style:{width:`100%`,minWidth:0,maxWidth:820,margin:`0 auto`},children:[Fn&&(0,E.jsx)(E5,{rows:Mn,messages:De,entryIds:Oe,modelNames:Fe,messageCwd:Gn,onOpenFile:u,sessionBusy:Bt,isNew:mt,handleFork:Tt,forkingEntryId:Ge,handleNavigate:Et,handleEditContent:I,sessionId:e?.id??_t.current??void 0,longBlockCollapseChars:S,recentExpandedBlockKeys:Gt,isStreaming:ke.isStreaming,flashKey:zn,itemRef:bn,t:v,messageRefs:kn,lastUserMsgRef:St,visibleRefIndexByMessage:jn,scrollContainerRef:xt,virtualizerRef:mn,initialCache:Rn},xn||`empty`),ke.isStreaming&&ke.streamingMessage&&(0,E.jsx)(`div`,{children:(0,E.jsx)(V8,{message:ke.streamingMessage,isStreaming:!0,modelNames:Fe,cwd:Gn,onOpenFile:u,longBlockCollapseChars:S,recentExpandedBlockKeys:Gt,turnNumber:Wt})}),(Ae||pt)&&(ft?.kind===`waiting_model`||ft?.kind===`thinking`||!ke.streamingMessage)&&(ft||pt)&&(0,E.jsx)(`div`,{className:`py-2 text-[0.8125rem] text-text-muted`,children:(0,E.jsx)(XJ,{phase:ft??{kind:`running_command`},elapsed:tn,totalElapsed:nn})}),je&&(0,E.jsx)(`div`,{className:`py-2 text-[0.8125rem] text-text-muted`,children:(0,E.jsx)(XJ,{phase:{kind:`running_command`},elapsed:tn,totalElapsed:nn})}),Pe&&(0,E.jsx)(V8,{message:{role:`bashExecution`,command:Pe.command,output:``,excludeFromContext:Pe.excludeFromContext},streamingBashOutput:Ne,sessionId:e?.id??_t.current??void 0,longBlockCollapseChars:S}),Ae&&(0,E.jsx)(`div`,{style:{height:48}}),(0,E.jsx)(`div`,{ref:bt})]})})}),!un&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`span`,{style:{position:`absolute`,left:0,right:0,bottom:0,height:30,background:`linear-gradient(to bottom, transparent, var(--bg))`,pointerEvents:`none`,zIndex:49}}),(0,E.jsx)(`button`,{type:`button`,onClick:_n,"aria-label":v(`chat.scrollToLatest`),"data-testid":`scroll-to-latest`,style:{position:`absolute`,bottom:0,left:`50%`,transform:`translateX(-50%)`,width:`min(100% / 3, 260px)`,zIndex:50,cursor:`pointer`,background:`transparent`,border:`none`,padding:0,height:30,display:`flex`,alignItems:`flex-end`,justifyContent:`center`},children:(0,E.jsx)(oi,{label:v(`chat.scrollToLatest`),children:(0,E.jsx)(`span`,{style:{position:`absolute`,bottom:4,left:`50%`,transform:`translateX(-50%)`,width:12,height:11,display:`flex`,alignItems:`flex-end`,justifyContent:`center`,cursor:`pointer`},children:(0,E.jsx)(`span`,{style:{position:`relative`,width:0,height:0,borderLeft:`6px solid transparent`,borderRight:`6px solid transparent`,borderTop:`7px solid var(--text-muted)`,pointerEvents:`none`}})})})})]}),P?null:(0,E.jsx)(vZ,{messages:De,streamingMessage:ke.streamingMessage,scrollContainer:xt,messageRefs:kn,resolveMessageOffset:Pn,scrollStepPx:b,onWindowJumpTo:e=>{let t=xt.current;t&&(t.scrollTop=e)}})]}),(0,E.jsxs)(`div`,{className:`relative`,children:[(0,E.jsx)(`div`,{style:{padding:`0 16px`,paddingRight:P?16:64},children:(0,E.jsx)(`div`,{style:{maxWidth:820,margin:`0 auto`}})}),O.length>0&&Wn&&(0,E.jsx)(`div`,{style:{padding:`0 16px`,paddingRight:P?16:64},children:(0,E.jsx)(`div`,{style:{maxWidth:820,margin:`0 auto`,paddingBottom:8},children:(0,E.jsx)(QJ,{messages:O,onSend:Vt,onFillInput:L,testIdPrefix:`start-screen-msg`,wrapperTestId:`start-screen-messages`})})}),Jn]}),(0,E.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,flexShrink:0,minWidth:0,height:36,padding:`0 12px`,borderTop:`1px solid var(--border)`,gap:8},children:(0,E.jsx)(oi,{label:rn,wrapperStyle:{display:`flex`,flex:1,minWidth:0},children:(0,E.jsx)(`div`,{role:`status`,"aria-label":rn,style:{alignSelf:`stretch`,display:`flex`,alignItems:`center`,flex:1,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-base)`,color:`var(--text-dim)`},children:rn})})})]})]})}function H5({notices:e,floating:t=!1,align:n=`left`}){return e.length===0?null:(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:n===`right`?`flex-end`:`stretch`,marginBottom:t?0:10},children:e.map((n,r)=>{let i=n.type===`error`?`var(--status-error)`:n.type===`warning`?`var(--status-warning)`:n.type===`success`?`var(--status-success)`:`var(--accent)`;return(0,E.jsxs)(`div`,{className:`notice-shelf-item`,style:{display:`flex`,alignItems:`center`,gap:10,minHeight:60,marginBottom:r===e.length-1?0:6,borderRadius:14,border:`1px solid color-mix(in srgb, var(--border) 70%, transparent)`,background:`var(--bg)`,color:`var(--text-muted)`,width:`fit-content`,maxWidth:`min(100%, 620px)`,boxShadow:t?`0 1px 2px var(--shadow-color), 0 10px 28px -14px var(--shadow-color)`:`0 1px 2px var(--shadow-color), 0 8px 24px -12px var(--shadow-color)`,fontSize:`var(--text-4xl)`,lineHeight:1.45,transformOrigin:`top center`,animation:n.exiting?`notice-shelf-out 0.18s ease-in forwards`:`notice-shelf-in 0.18s ease-out both`,padding:`0 12px`},children:[(0,E.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:i,flexShrink:0}}),(0,E.jsx)(`span`,{style:{padding:`14px 0`,minWidth:0,maxWidth:`100%`,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:n.message})]},n.id)})})}function U5({modals:e,onDismiss:t}){let{t:n}=N();return(0,E.jsx)(E.Fragment,{children:e.map((e,r)=>(0,E.jsx)(qX,{variant:e.type===`error`?`error`:`normal`,align:`center`,width:520,height:320,initialOffset:{dx:r%3*24,dy:r%3*24},title:e.type===`error`?n(`chat.notifyErrorTitle`):n(`chat.notifyWarningTitle`),footer:(0,E.jsx)(`button`,{onClick:()=>t(e.id),style:{padding:`6px 14px`,borderRadius:6,border:`1px solid var(--border)`,background:`var(--bg)`,color:`var(--text)`,cursor:`pointer`},children:n(`chat.close`)}),children:(0,E.jsx)(`div`,{style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,fontSize:`var(--text-lg)`,lineHeight:1.6,color:`var(--text)`},children:e.message})},e.id))})}function W5({request:e,onRespond:t}){let{t:n}=N(),[r,i]=(0,d.useState)(e.method===`editor`?e.prefill??``:``),[a,o]=(0,d.useState)(()=>Date.now());(0,d.useEffect)(()=>{i(e.method===`editor`?e.prefill??``:``),o(Date.now())},[e]),(0,d.useEffect)(()=>{if(!e.expiresAt)return;let t=setInterval(()=>{document.hidden||o(Date.now())},1e3),n=()=>{document.hidden||o(Date.now())};return document.addEventListener(`visibilitychange`,n),()=>{clearInterval(t),document.removeEventListener(`visibilitychange`,n)}},[e.expiresAt]);let s=e.expiresAt?Math.max(0,Math.ceil((e.expiresAt-a)/1e3)):null;(0,d.useEffect)(()=>{s===0&&t(e,{cancelled:!0})},[s===0,e.id]);let c=()=>{e.method===`confirm`?t(e,{confirmed:!0}):t(e,{value:r})},l=e.method===`select`?n(`chat.extensionSelect`):e.method===`confirm`?n(`chat.extensionConfirm`):e.method===`editor`?n(`chat.extensionEditor`):n(`chat.extensionInput`);return(0,E.jsxs)(qX,{testId:`extension-dialog`,title:(0,E.jsxs)(E.Fragment,{children:[l,s!==null&&(0,E.jsxs)(`span`,{style:{color:`var(--text-muted)`,marginLeft:6,fontVariantNumeric:`tabular-nums`},children:[`(`,s,`s)`]})]}),subtitle:n(`chat.extensionRequest`),maxWidth:Math.round(window.innerWidth*.6),footer:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`button`,{onClick:()=>t(e,{cancelled:!0}),style:{padding:`6px 10px`,borderRadius:6,border:`1px solid var(--border)`,background:`var(--bg)`,color:`var(--text-muted)`,cursor:`pointer`},children:n(`chat.cancel`)}),e.method===`confirm`?(0,E.jsx)(`button`,{onClick:c,style:{padding:`6px 10px`,borderRadius:6,border:`1px solid var(--accent)`,background:`var(--accent)`,color:`var(--on-accent)`,cursor:`pointer`},children:n(`chat.confirm`)}):e.method===`select`?null:(0,E.jsx)(`button`,{onClick:c,style:{padding:`6px 10px`,borderRadius:6,border:`1px solid var(--accent)`,background:`var(--accent)`,color:`var(--on-accent)`,cursor:`pointer`},children:n(`chat.submit`)})]}),children:[(0,E.jsx)(`div`,{style:{marginBottom:12,padding:`9px 10px`,borderRadius:7,border:`1px solid var(--border)`,background:`var(--bg)`,color:`var(--text)`,fontSize:`var(--text-lg)`,lineHeight:1.6,whiteSpace:`pre-wrap`,maxHeight:360,overflowY:`auto`},children:e.title}),`Notification`in window&&Notification.permission===`denied`&&(0,E.jsx)(`div`,{style:{marginBottom:10,padding:`7px 10px`,borderRadius:7,border:`1px solid var(--border-warning, var(--border))`,background:`var(--bg-panel)`,color:`var(--text-dim)`,fontSize:`var(--text-sm)`,lineHeight:1.5},children:n(`chat.questionNotificationDenied`)}),e.method===`confirm`&&(0,E.jsx)(`div`,{style:{color:`var(--text-muted)`,fontSize:`var(--text-lg)`,lineHeight:1.6,whiteSpace:`pre-wrap`},children:e.message}),e.method===`select`&&(0,E.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:8},children:e.options.map(n=>(0,E.jsx)(`button`,{onClick:()=>t(e,{value:n}),style:{flex:`1 1 auto`,padding:`9px 10px`,borderRadius:7,border:`1px solid var(--border)`,background:`var(--bg-panel)`,color:`var(--text)`,cursor:`pointer`,textAlign:`left`,fontSize:`var(--text-lg)`},children:n},n))}),e.method===`input`&&(0,E.jsx)(`input`,{autoFocus:!0,value:r,placeholder:e.placeholder,onChange:e=>i(e.target.value),onKeyDown:n=>{n.key===`Enter`&&c(),n.key===`Escape`&&t(e,{cancelled:!0})},style:{width:`100%`,padding:`9px 10px`,borderRadius:7,border:`1px solid var(--border)`,background:`var(--bg-panel)`,color:`var(--text)`,outline:`none`,fontSize:`var(--text-2xl)`}}),e.method===`editor`&&(0,E.jsx)(`textarea`,{autoFocus:!0,value:r,onChange:e=>i(e.target.value),onKeyDown:n=>{n.key===`Escape`&&t(e,{cancelled:!0}),(n.metaKey||n.ctrlKey)&&n.key===`Enter`&&c()},style:{width:`100%`,minHeight:220,padding:10,borderRadius:7,border:`1px solid var(--border)`,background:`var(--bg)`,color:`var(--text)`,outline:`none`,resize:`vertical`,fontSize:`var(--text-2xl)`,lineHeight:1.55,fontFamily:`var(--font-mono)`}})]},e.id)}function G5(e,t){return _Y(e).map((e,n)=>Object.keys(e.style).length>0?(0,E.jsx)(`span`,{style:e.style,children:e.text},`${t}-${n}`):e.text)}function K5({request:e,onInput:t}){let{t:n}=N(),r=(0,d.useRef)(null),i=(0,d.useRef)(!1),a=mY(e.lines);return(0,d.useEffect)(()=>{r.current?.focus()},[e.id]),(0,E.jsx)(`div`,{style:{position:`absolute`,inset:0,zIndex:95,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:20,background:`rgba(0,0,0,0.18)`},children:(0,E.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,onClick:e=>{e.target.closest(`button`)||r.current?.focus()},style:{position:`relative`,width:`min(920px, 100%)`,maxHeight:`min(760px, calc(100vh - 40px))`,border:`1px solid var(--border)`,borderRadius:8,background:`var(--bg)`,boxShadow:`0 20px 60px var(--shadow-strong)`,overflow:`hidden`,outline:`none`},children:[(0,E.jsx)(`textarea`,{ref:r,"aria-label":n(`chat.extensionInput`),autoCapitalize:`off`,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,onKeyDown:n=>{if(i.current||n.nativeEvent.isComposing)return;let r=wY(n);r&&(n.preventDefault(),n.stopPropagation(),t(e,r))},onInput:n=>{if(i.current||n.nativeEvent.isComposing)return;let r=n.currentTarget.value;n.currentTarget.value=``,r&&t(e,r)},onCompositionStart:()=>{i.current=!0},onCompositionEnd:n=>{i.current=!1;let r=n.currentTarget;queueMicrotask(()=>{let n=r.value;r.value=``,n&&t(e,n)})},onPaste:n=>{n.preventDefault();let r=n.clipboardData.getData(`text`);r&&t(e,TY(r))},style:{position:`absolute`,width:1,height:1,padding:0,border:0,opacity:0,pointerEvents:`none`}}),(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:12,padding:`10px 12px`,borderBottom:`1px solid var(--border)`},children:[(0,E.jsx)(`div`,{style:{color:`var(--text)`,fontSize:`var(--text-lg)`,fontWeight:650},children:n(`chat.extensionPanel`)}),(0,E.jsx)(`button`,{onClick:()=>t(e,``),style:{padding:`5px 9px`,borderRadius:6,border:`1px solid var(--border)`,background:`var(--bg-panel)`,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-base)`},children:n(`chat.close`)})]}),(0,E.jsx)(`pre`,{style:{margin:0,padding:14,maxHeight:`calc(min(760px, 100vh - 40px) - 48px)`,overflow:`auto`,background:`var(--bg-panel)`,color:`var(--text)`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-lg)`,lineHeight:1.45,whiteSpace:`pre`},children:(a.length?a:[``]).map((e,t,n)=>(0,E.jsxs)(d.Fragment,{children:[G5(e,`line-${t}`),t<n.length-1?`
479
+ `).trim();return t.length>0?t:null}function V5({session:e,newSessionCwd:t,onAgentEnd:n,onSessionCreated:r,onSessionForked:i,modelsRefreshKey:a,chatInputRef:o,onOpenModelConfig:s,onSessionRenamed:c,windowTitleBase:l,onOpenFile:u,toolbarExtra:f,closedWidgetKeys:m,onCloseWidget:h,onExtensionWidgetsChange:g,onExtensionDialogChange:_}){let{t:v,locale:y}=N(),{scrollStepPx:b,autoReloadSeconds:x,longBlockCollapseChars:S,recentBlocksExpanded:C,widgetGeometries:w,setWidgetGeometry:T,widgetMessages:D,startScreenMessages:O}=ge(),{soundEnabled:k,onSoundToggle:A,playDoneSound:j,unlockAudio:M}=eY(),P=ne(),ee=oe(),F=(0,d.useRef)(j);F.current=j;let te=(0,d.useRef)(k);te.current=k;let re=(0,d.useRef)(null),ae=(0,d.useCallback)(()=>{te.current&&F.current(),n?.()},[n]),I=(0,d.useCallback)(e=>{o?.current?.insertIfEmpty(e)},[o]),L=(0,d.useCallback)(e=>{o?.current?.fillInput(e)},[o]),[se,R]=(0,d.useState)({kind:`idle`}),ce=pe(),le=(0,d.useRef)(null),[ue,de]=(0,d.useState)(null),fe=pe(),me=(0,d.useRef)(null),he=(0,d.useRef)(null),{activeTopPanel:_e,toggleTopPanel:ve,closeTopPanel:ye}=Me(),be=pe(),xe=(0,d.useCallback)(()=>{be.schedule(()=>{ye()},150)},[be,ye]),Se=be.cancel;(0,d.useEffect)(()=>{ce.cancel(),R({kind:`idle`}),de(null),le.current=e?.id??null},[e?.id,ce]);let Ce=(0,d.useCallback)(()=>{e&&window.open(`/api/sessions/${encodeURIComponent(e.id)}/export?inline=1`,`_blank`,`noopener,noreferrer`)},[e]),we=(0,d.useCallback)((e,t)=>{bY(t).then(()=>{fe.cancel(),de(e),fe.schedule(()=>de(null),1400)})},[fe]),{loading:Te,error:Ee,messages:De,entryIds:Oe,streamState:ke,agentRunning:Ae,bashRunning:je,bashOutput:Ne,pendingBash:Pe,modelNames:Fe,modelList:Ie,modelError:Le,modelScopeWarnings:Re,modelThinkingLevels:ze,modelThinkingLevelMaps:Be,toolPreset:Ve,thinkingLevel:He,retryInfo:Ue,contextUsage:We,forkingEntryId:Ge,isCompacting:Ke,compactError:qe,compactResult:Ye,displayModel:Xe,sessionStats:Ze,systemPrompt:Qe,slashCommands:$e,slashCommandsLoading:et,queuedMessages:tt,notices:nt,noticeModals:rt,dismissNoticeModal:it,extensionDialog:at,extensionCustomUi:ot,extensionStatuses:st,extensionWidgets:ct,respondToExtensionUi:lt,sendExtensionCustomInput:ut,isAutoModelSelection:dt,agentPhase:ft,commandBusy:pt,isNew:mt,tree:gt,sessionIdRef:_t,activeLeafId:vt,loadContext:yt,messagesEndRef:bt,scrollContainerRef:xt,lastUserMsgRef:St,handleSend:Ct,handleAbort:wt,handleFork:Tt,handleNavigate:Et,handleLeafChange:Dt,handleModelChange:Ot,handleCompact:kt,handleSteer:At,handleFollowUp:jt,handlePromptWithStreamingBehavior:Mt,handleAbortCompaction:Nt,handleRecallQueue:Pt,handleBuiltinSlashCommand:Ft,handleToolPresetChange:It,handleThinkingLevelChange:Lt,loadSlashCommands:Rt,setSessionStatsOverride:zt}=GJ({session:e,newSessionCwd:t,onAgentEnd:ae,onSessionCreated:r,onSessionForked:i,modelsRefreshKey:a,chatInputRef:o});(0,d.useEffect)(()=>{g?.(ct)},[ct,g]);let Bt=Ae||je,Vt=(0,d.useCallback)(e=>{Bt?e.startsWith(`/`)?Mt(e,`steer`):At(e):Ct(e)},[Bt,At,Mt,Ct]),Ht=(0,d.useCallback)(async()=>{let t=e?.id;if(!(!t||se.kind===`naming`)){ce.cancel(),ye(),R({kind:`naming`});try{let e=await fetch(`/api/sessions/${encodeURIComponent(t)}/auto-name`,{method:`POST`}),n=await e.json().catch(()=>({}));if(!e.ok||!n.title)throw Error(n.error||`HTTP ${e.status}`);let r=n.title.trim();if(le.current!==t)return;c?.(t,r),zt(e=>e?.sessionId===t?{...e,sessionName:r}:e),R({kind:`success`}),ce.schedule(()=>R({kind:`idle`}),1800)}catch(e){if(le.current!==t)return;let n=e instanceof Error?e.message:String(e);R({kind:`error`,message:n}),ce.schedule(()=>R({kind:`idle`}),5e3)}}},[se.kind,ce,e?.id,ye,c,zt]),Ut=(0,d.useCallback)(async e=>{let t=await Ft(e);return t.handled&&t.action===`openSessionStats`&&ve(`session`),t},[Ft,ve]),Wt=(0,d.useMemo)(()=>{let e=ke.streamingMessage;if(!e||e.role!==`assistant`)return;let t=0;for(let e of De)e.role===`user`&&(t+=1);return t>0?t:void 0},[De,ke.streamingMessage]),Gt=(0,d.useMemo)(()=>{if(C==null)return;let e=[];De.forEach((t,n)=>{t.role===`assistant`&&(t.content??[]).forEach((t,r)=>{t.type===`thinking`?e.push(Je(`thinking`,Oe[n]??``,void 0,r)):t.type===`toolCall`&&e.push(Je(`toolCall`,``,t.toolCallId))})});let t=e.slice(-((C??0)+1));return new Set(t)},[De,Oe,C]),{runningSessionIds:Jt,runningPhaseSince:Yt,runningBusySince:Xt}=Kt(),Zt=e?.id??_t.current??``,$t=Jt.has(Zt)||Ae||pt||je,en=z5($t),tn=qt($t,Yt[Zt]),nn=qt($t,Xt[Zt]),rn=cY(xZ(st)),an=(0,d.useCallback)(()=>{let e=_t.current;e&&yt(e,vt,!0)},[vt,yt,_t]);(0,d.useEffect)(()=>{if(!x||x<=0)return;let e=setInterval(()=>{let e=_t.current;e&&yt(e,vt,!0)},x*1e3);return()=>clearInterval(e)},[x,vt,yt,_t]),(0,d.useEffect)(()=>{!at||re.current===at.id||(re.current=at.id,Rq(`ui-chain`,`4b ExtensionDialog mounted, play sound`,`${at.method} id=${at.id.slice(0,8)} title=${JSON.stringify(at.title)}`),F.current())},[at]),(0,d.useEffect)(()=>{_?.(at!==null)},[at,_]),(0,d.useEffect)(()=>{Qt()},[]),(0,d.useEffect)(()=>{ie(Bt?wt:null)},[Bt,wt]);let on=(0,d.useRef)(``);(0,d.useEffect)(()=>{let e=()=>{if(document.hasFocus())return;let e=ke.isStreaming,t=l?` · ${l}`:``,n;if(at)n=`❓`;else if(Bt){let t=en??``;if(ft?.kind===`running_tools`)n=`🔧 ${t}`.trimEnd();else if(ft?.kind===`running_command`)n=`💻 ${t}`.trimEnd();else if(ft?.kind===`thinking`)n=`💡 ${t}`.trimEnd();else if(ft?.kind===`waiting_model`&&e){let e=[...De].reverse().find(e=>e.role===`assistant`),t=e&&e.role===`assistant`?e.usage:void 0;n=`⬇ ${j5(t?.input??0)}↑ ${j5(t?.output??0)}↓`}else n=`⏳ ${t}`.trimEnd()}else{let e;for(let t=De.length-1;t>=0;t--){let n=De[t];if(!(n.role!==`assistant`||!n.timestamp)){for(let r=t-1;r>=0;r--){let t=De[r];if(t.role===`user`&&t.timestamp){let r=Math.round((n.timestamp-t.timestamp)/1e3);r>0&&(e=r);break}}break}}if(e===void 0)return;n=`✅ ${ht(e)}`}let r=`${n}${t}`;r!==on.current&&(on.current=r,document.title=r)};e();let t=()=>{document.visibilityState===`hidden`&&e()};return document.addEventListener(`visibilitychange`,t),window.addEventListener(`blur`,e),()=>{document.removeEventListener(`visibilitychange`,t),window.removeEventListener(`blur`,e)}},[ft,ke.isStreaming,en,De,Bt,l,at]);let sn=(0,d.useRef)(null);(0,d.useEffect)(()=>{Bt?sn.current===null&&(sn.current=Date.now()):sn.current=null},[Bt]),(0,d.useEffect)(()=>{if(!Bt&&!at)return;let e=()=>{if(!document.hidden||document.hasFocus())return;let e=l?` · ${l}`:``,t;if(at)t=`❓`;else if(Bt){let e=sn.current?ht((Date.now()-sn.current)/1e3):en??``;if(ft?.kind===`running_tools`)t=`🔧 ${e}`.trimEnd();else if(ft?.kind===`running_command`)t=`💻 ${e}`.trimEnd();else if(ft?.kind===`thinking`)t=`💡 ${e}`.trimEnd();else if(ft?.kind===`waiting_model`&&ke.isStreaming){let e=[...De].reverse().find(e=>e.role===`assistant`),n=e&&e.role===`assistant`?e.usage:void 0;t=`⬇ ${j5(n?.input??0)}↑ ${j5(n?.output??0)}↓`}else t=`⏳ ${e}`.trimEnd()}else return;let n=`${t}${e}`;n!==on.current&&(on.current=n,document.title=n)},t=setInterval(e,1e3);return document.addEventListener(`visibilitychange`,e),()=>{clearInterval(t),document.removeEventListener(`visibilitychange`,e)}},[Bt,at,ft,ke.isStreaming,De,l,en]);let[cn,ln]=(0,d.useState)(null),[un,dn]=(0,d.useState)(!0),fn=(0,d.useRef)(new Map),pn=(0,d.useRef)(new Map),mn=(0,d.useRef)(null),hn=(0,d.useRef)(!0),gn=(0,d.useRef)(0),_n=(0,d.useCallback)(()=>{let e=xt.current;e&&(e.scrollTop=e.scrollHeight),hn.current=!0,dn(!0)},[xt]),vn=(0,d.useCallback)(()=>{let e=xt.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight;if(hn.current&&t>0&&e.scrollHeight!==gn.current){gn.current=e.scrollHeight,e.scrollTop=e.scrollHeight;return}t<16?(hn.current=!0,dn(!0)):t>64&&(hn.current=!1,dn(!1)),gn.current=e.scrollHeight},[xt]),yn=(0,d.useRef)(new Map),bn=(0,d.useCallback)((e,t)=>{yn.current.set(e,t);let n=pn.current.get(e);return n||(n=t=>{if(yn.current.get(e)?.(t),!t){fn.current.get(e)?.disconnect(),fn.current.delete(e),yn.current.delete(e);return}let n=fn.current.get(e);n?n.disconnect():(n=new ResizeObserver(()=>{document.hidden||hn.current&&requestAnimationFrame(()=>{if(document.hidden)return;let e=xt.current;e&&hn.current&&(e.scrollTop=e.scrollHeight)})}),fn.current.set(e,n)),n.observe(t)},pn.current.set(e,n)),n},[xt]);(0,d.useEffect)(()=>()=>{fn.current.forEach(e=>e.disconnect()),fn.current.clear(),pn.current.clear(),yn.current.clear()},[]);let xn=e?.id??t??``;(0,d.useEffect)(()=>{if(In(!1),Ln.current=null,fn.current.forEach(e=>e.disconnect()),fn.current.clear(),pn.current.clear(),yn.current.clear(),kn.current=[],St.current=null,xt.current){xt.current.scrollTop=0;let e=xt.current.firstElementChild;if(e&&e.children.length===1){let t=e.firstElementChild;t&&t.style.height&&(t.style.height=`0px`)}}},[xn]),(0,d.useEffect)(()=>{let e=xt.current;if(!e)return;let t=new ResizeObserver(()=>{document.hidden||hn.current&&requestAnimationFrame(()=>{if(document.hidden)return;let e=xt.current;e&&hn.current&&(e.scrollTop=e.scrollHeight)})});return t.observe(e),()=>t.disconnect()},[xt]),(0,d.useEffect)(()=>()=>{},[]);let{isDragOver:Sn,handleDragEnter:Cn,handleDragOver:wn,handleDragLeave:Tn,handleDrop:En}=tY((0,d.useCallback)(e=>{Bt||o?.current?.addImages(e)},[Bt,o])),Dn=De.filter(e=>e.role===`user`||e.role===`assistant`),On=(0,d.useMemo)(()=>{let e=new Set,t=[];for(let n=De.length-1;n>=0;--n){let r=B5(De[n]);if(!(!r||e.has(r))&&(e.add(r),t.push(r),t.length>=50))break}return t.reverse()},[De]),kn=yZ(Dn.length),An=(0,d.useMemo)(()=>{for(let e=De.length-1;e>=0;e--)if(RY(De[e]))return e;return-1},[De]),jn=(0,d.useMemo)(()=>{let e=new Map,t=0;return De.forEach((n,r)=>{(n.role===`user`||n.role===`assistant`)&&e.set(r,t++)}),e},[De]),Mn=(0,d.useMemo)(()=>BY(De,{isLiveTail:(Bt||ke.isStreaming)&&An>=0,lastAnchorIdx:An,visibleRefIndexByMessage:jn}),[De,Bt,ke.isStreaming,An,jn]),Nn=(0,d.useMemo)(()=>VY(Mn),[Mn]),Pn=(0,d.useCallback)(e=>{let t=Nn.get(e);if(t===void 0)return null;let n=mn.current;return n?n.getItemOffset(t):null},[Nn]),[Fn,In]=(0,d.useState)(!1),Ln=(0,d.useRef)(null),Rn=Fn&&Ln.current?[Ln.current,200]:void 0;(0,d.useLayoutEffect)(()=>{Fn||Mn.length!==0&&xt.current&&(Ln.current=Mn.map(e=>e.estimate),In(!0))},[Fn,Mn,xt]);let[zn,Bn]=(0,d.useState)(null),Vn=(0,d.useRef)(null),Hn=(0,d.useCallback)(e=>{let t=Nn.get(e);if(t===void 0)return;let n=mn.current;if(!n)return;n.scrollToIndex(t,{align:`start`,offset:-24,smooth:!0});let r=Mn[t].key;Bn(r),Vn.current&&clearTimeout(Vn.current),Vn.current=setTimeout(()=>{Vn.current=null,Bn(e=>e===r?null:e)},1700)},[Mn,Nn]),Un=mt&&De.length===0&&!ke.isStreaming&&!Bt,Wn=!Ae&&!ke.isStreaming&&!pt&&!je;(0,d.useLayoutEffect)(()=>{if(!O.length||!Wn||!hn.current)return;let e=xt.current;e&&(e.scrollTop=e.scrollHeight)},[O.length,Wn,xt]);let Gn=e?.cwd??t??void 0,Kn=Xe?ze[`${Xe.provider}/${Xe.modelId}`]??null:null,qn=Xe?Be[`${Xe.provider}/${Xe.modelId}`]??null:null,Jn=(0,E.jsx)(mX,{ref:o,onSend:Ct,onAbort:wt,onSteer:Ae?At:void 0,onFollowUp:Ae?jt:void 0,onPromptWithStreamingBehavior:Ae?Mt:void 0,isStreaming:Bt,commandBusy:pt,model:Xe,isAutoModelSelection:dt,modelNames:Fe,modelList:Ie,modelError:Le,modelScopeWarnings:Re,onModelChange:Ot,onCompact:e||mt?kt:void 0,onReloadFromDisk:an,onAbortCompaction:Nt,isCompacting:Ke,compactError:qe,compactResult:Ye,toolPreset:Ve,onToolPresetChange:e||mt?It:void 0,thinkingLevel:He,onThinkingLevelChange:e||mt?Lt:void 0,availableThinkingLevels:Kn,thinkingLevelMap:qn,onOpenModelConfig:s,retryInfo:Ue,queuedMessages:tt,inputHistory:On,onRecallQueue:Pt,slashCommands:$e,slashCommandsLoading:et,onLoadSlashCommands:Rt,onBuiltinCommand:Ut,soundEnabled:k,onSoundToggle:A,onAudioUnlock:M,draftKey:e?.id??(t?`new:${t}`:void 0),cwd:e?.cwd??t});return Te?(0,E.jsx)(`div`,{className:`flex h-full items-center justify-center text-text-muted`,children:v(e?`chat.loadingSession`:`chat.noSessionSelected`)}):Ee?(0,E.jsx)(`div`,{className:`flex h-full items-center justify-center text-red-400`,children:Ee}):(0,E.jsxs)(`div`,{ref:ln,className:`relative flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,style:{paddingBottom:`env(safe-area-inset-bottom)`},onDragEnter:Cn,onDragOver:wn,onDragLeave:Tn,onDrop:En,children:[Sn&&!Bt&&(0,E.jsxs)(`div`,{className:`pointer-events-none absolute inset-0 z-50 flex animate-[drop-zone-in_0.15s_ease_both] items-center justify-center bg-[color-mix(in_srgb,var(--accent)_6%,transparent)] backdrop-blur-[1px]`,children:[(0,E.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center`,children:[0,.8,1.6].map(e=>(0,E.jsx)(`div`,{className:`absolute h-[720px] w-[720px] rounded-full border-[1.5px] border-solid border-[color-mix(in_srgb,var(--accent)_50%,transparent)] animate-[drop-ripple_2.4s_ease-out_infinite_backwards]`,style:{transformOrigin:`center`,animationDelay:`${e}s`}},e))}),(0,E.jsxs)(`svg`,{width:`280`,height:`280`,viewBox:`0 0 140 140`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,className:`drop-shadow-[0_6px_18px_var(--accent-glow)]`,children:[(0,E.jsx)(`rect`,{x:`28`,y:`44`,width:`84`,height:`60`,rx:`8`,fill:`color-mix(in srgb, var(--accent) 8%, transparent)`,stroke:`color-mix(in srgb, var(--accent) 50%, transparent)`,strokeWidth:`1.8`}),(0,E.jsx)(`path`,{d:`M36 100 L54 72 L68 88 L80 74 L104 100Z`,fill:`color-mix(in srgb, var(--accent) 16%, transparent)`,stroke:`color-mix(in srgb, var(--accent) 40%, transparent)`,strokeWidth:`1.4`,strokeLinejoin:`round`}),(0,E.jsx)(`circle`,{cx:`96`,cy:`58`,r:`8`,fill:`color-mix(in srgb, var(--accent) 22%, transparent)`,stroke:`color-mix(in srgb, var(--accent) 55%, transparent)`,strokeWidth:`1.6`}),(0,E.jsxs)(`g`,{stroke:`color-mix(in srgb, var(--accent) 45%, transparent)`,strokeWidth:`1.4`,strokeLinecap:`round`,children:[(0,E.jsx)(`line`,{x1:`96`,y1:`46`,x2:`96`,y2:`43`}),(0,E.jsx)(`line`,{x1:`96`,y1:`70`,x2:`96`,y2:`73`}),(0,E.jsx)(`line`,{x1:`84`,y1:`58`,x2:`81`,y2:`58`}),(0,E.jsx)(`line`,{x1:`108`,y1:`58`,x2:`111`,y2:`58`}),(0,E.jsx)(`line`,{x1:`87.5`,y1:`49.5`,x2:`85.4`,y2:`47.4`}),(0,E.jsx)(`line`,{x1:`104.5`,y1:`66.5`,x2:`106.6`,y2:`68.6`}),(0,E.jsx)(`line`,{x1:`104.5`,y1:`49.5`,x2:`106.6`,y2:`47.4`}),(0,E.jsx)(`line`,{x1:`87.5`,y1:`66.5`,x2:`85.4`,y2:`68.6`})]})]})]}),at&&(0,E.jsx)(W5,{request:at,onRespond:lt}),rt.length>0&&(0,E.jsx)(U5,{modals:rt,onDismiss:it}),ot&&(0,E.jsx)(K5,{request:ot,onInput:ut}),ct.filter(e=>!m.has(e.key)).map((e,t)=>(0,E.jsx)(q5,{widget:e,saved:w[e.key],messages:D[e.key]??[],defaultOffset:t%3==0?{dx:0,dy:0}:t%3==1?{dx:-80,dy:0}:{dx:80,dy:0},onCloseWidget:h,setWidgetGeometry:T,onSend:Vt,fillChatInput:L,portalTarget:cn},e.key)),(0,E.jsxs)(`div`,{ref:me,"data-testid":`chat-toolbar`,style:D5,children:[(0,E.jsx)(oi,{label:v(e?`history.full`:`history.unsaved`),children:(0,E.jsx)(`button`,{onClick:Ce,disabled:!e,"aria-label":v(`history.full`),style:{...O5,color:e?`var(--text-muted)`:`var(--text-dim)`,cursor:e?`pointer`:`not-allowed`,opacity:e?1:.45},className:e?`hover-shift`:void 0,children:(0,E.jsx)(zr,{size:p.base,style:A5})})}),(()=>{let t=!!(e&&(Ze?.userMessages??e.messageCount)>0),n=!e||!t||se.kind===`naming`,r=se.kind===`success`,i=se.kind===`error`,a=se.kind===`naming`?v(`title.generating`):v(r?`title.updated`:i?`title.failed`:`title.generate`),o=e?t?i?se.message:v(`title.generateSession`):v(`title.noMessages`):v(`title.unsaved`);return(0,E.jsx)(oi,{label:o,children:(0,E.jsx)(`button`,{type:`button`,onClick:()=>void Ht(),disabled:n,"aria-label":a,style:{...O5,color:i?`var(--status-error)`:r?`var(--status-success)`:n?`var(--text-dim)`:`var(--text-muted)`,cursor:n?`not-allowed`:`pointer`,opacity:n&&se.kind!==`naming`?.45:1,"--hover-color":i?`var(--status-error)`:`var(--text)`},className:n?void 0:`hover-shift`,children:se.kind===`naming`?(0,E.jsx)(Ar,{className:`animate-spin`,size:p.lg,"aria-hidden":`true`}):r?(0,E.jsx)(ur,{size:p.lg,"aria-hidden":`true`}):(0,E.jsx)(Nr,{size:p.lg,"aria-hidden":`true`,style:A5})})})})(),(0,E.jsx)(oi,{label:v(`i18n.branches`),children:(0,E.jsx)($X,{tree:gt,activeLeafId:vt,onLeafChange:Dt,inline:!0,compact:!0,containerRef:me,open:_e===`branches`,onToggle:()=>ve(`branches`),hasSession:!0})}),(0,E.jsx)(oi,{label:v(`system.prompt`),children:(0,E.jsx)(`button`,{ref:he,onClick:()=>ve(`system`),"aria-label":v(`system.prompt`),"aria-pressed":_e===`system`,style:{...O5,background:_e===`system`?`var(--bg-selected)`:`transparent`,borderColor:_e===`system`?`var(--accent)`:`var(--border)`,cursor:`pointer`,color:_e===`system`?`var(--text)`:`var(--text-muted)`,"--hover-color":`var(--text)`},className:`hover-shift`,children:(0,E.jsx)(yr,{size:p.base,style:A5})})}),(0,E.jsx)(oi,{label:v(`session.reload`),children:(0,E.jsx)(`button`,{type:`button`,"data-testid":`chat-toolbar-reload`,onClick:()=>void Ft(`/reload`),"aria-label":v(`session.reload`),style:{...O5,background:`transparent`,borderColor:`var(--border)`,cursor:`pointer`,color:`var(--text-muted)`,"--hover-color":`var(--text)`},className:`hover-shift`,children:pt?(0,E.jsx)(Ar,{className:`animate-spin`,size:p.base,style:A5}):(0,E.jsx)(Rr,{size:p.base,style:A5})})}),(0,E.jsx)(`div`,{style:{marginLeft:8,display:`flex`,alignItems:`center`,flex:1,minWidth:0},children:(0,E.jsx)(C5,{messages:De,t:v,onJump:Hn})}),Ze||We?(0,E.jsx)(M5,{sessionStats:Ze,contextUsage:We,activeTopPanel:_e,toggleTopPanel:ve,isMobile:P,t:v,locale:y}):null,f,_e===`system`&&(0,E.jsx)(`div`,{onMouseEnter:Se,onMouseLeave:xe,style:F5,children:Qe?(0,E.jsx)(`div`,{style:{padding:`12px 16px`,color:`var(--text-muted)`,fontSize:`var(--text-base)`,lineHeight:1.6,whiteSpace:`pre-wrap`,fontFamily:`var(--font-mono)`},children:Qe}):Qe===``?(0,E.jsx)(`div`,{style:I5,children:v(`system.empty`)}):(0,E.jsx)(`div`,{style:I5,children:v(`system.load`)})}),_e===`session`&&(0,E.jsx)(`div`,{onMouseEnter:Se,onMouseLeave:xe,style:{...F5,padding:`12px 16px`},children:Ze?(()=>{let e=[...Ze.sessionName?[{label:v(`session.name`),value:Ze.sessionName,copyField:null}]:[],{label:v(`session.file`),value:Ze.sessionFile??v(`session.inMemory`),copyField:`file`},{label:v(`session.id`),value:Ze.sessionId,copyField:`id`}],t=[[v(`session.user`),Ze.userMessages.toLocaleString(y)],[v(`session.assistant`),Ze.assistantMessages.toLocaleString(y)],[v(`session.toolCalls`),Ze.toolCalls.toLocaleString(y)],[v(`session.toolResults`),Ze.toolResults.toLocaleString(y)],[v(`session.total`),Ze.totalMessages.toLocaleString(y)]],n=Ze.tokens.input+Ze.tokens.cacheRead+Ze.tokens.cacheWrite,r=[[v(`session.input`),Ze.tokens.input.toLocaleString(y),{title:v(`session.inputHint`)}],[v(`session.output`),Ze.tokens.output.toLocaleString(y),{title:v(`session.outputHint`)}],...Ze.tokens.cacheRead>0?[[v(`session.cacheRead`),Ze.tokens.cacheRead.toLocaleString(y),{title:v(`session.cacheReadHint`),badge:n>0?(e=>`${e.toFixed(1)}%`)(Ze.tokens.cacheRead/n*100):void 0,badgeTitle:v(`session.cacheReadRate`)}]]:[],...Ze.tokens.cacheWrite>0?[[v(`session.cacheWrite`),Ze.tokens.cacheWrite.toLocaleString(y),{title:v(`session.cacheWriteHint`)}]]:[],[v(`session.total`),Ze.tokens.total.toLocaleString(y),{title:v(`session.totalHint`)}]],i=We??Ze.contextUsage,a=e=>e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}k`:String(e),o=[...Ze.cost>0?[[v(`session.cost`),`$${Ze.cost.toFixed(4)}`]]:[],...i?.contextWindow?[[v(`session.context`),`${i.percent===null?`?`:`${i.percent.toFixed(1)}%`} / ${a(i.contextWindow)}`]]:[]],s=(e,t,n=`left`,r=!1)=>(0,E.jsxs)(`div`,{style:{minWidth:0},children:[(0,E.jsx)(`div`,{style:L5,children:e}),(0,E.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:r?`max-content max-content max-content`:`auto minmax(0, 1fr) max-content`,columnGap:r?14:12,rowGap:4,justifyContent:r?`start`:void 0},children:t.map(([t,i,a])=>(0,E.jsxs)(`div`,{style:{display:`contents`},children:[(0,E.jsx)(oi,{label:a?.title,wrapperStyle:{display:`flex`,color:`var(--text-dim)`,whiteSpace:`nowrap`},children:(0,E.jsx)(`div`,{style:{color:`var(--text-dim)`,whiteSpace:`nowrap`},children:t})}),(0,E.jsx)(`div`,{style:{color:`var(--text-muted)`,minWidth:0,overflowWrap:r?`normal`:`anywhere`,textAlign:n,whiteSpace:n===`right`?`nowrap`:`normal`},children:i}),(0,E.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`flex-end`,minWidth:0},children:a?.badge&&(0,E.jsx)(oi,{label:`${a.badgeTitle??``}${a.badgeTitle?` · `:``}${a.badge}`,children:(0,E.jsx)(`span`,{style:{padding:`0 5px`,...R5},children:a.badge})})})]},`${e}:${t}`))})]}),c=(e,t)=>{let n=ue===e;return(0,E.jsx)(oi,{label:v(n?`session.copied`:e===`file`?`session.copyFile`:`session.copyId`),children:(0,E.jsx)(`button`,{type:`button`,onClick:()=>we(e,t),style:{alignSelf:`start`,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:22,height:22,marginTop:-2,color:n?`var(--accent)`:`var(--text-dim)`,background:`transparent`,border:`1px solid var(--border)`,borderRadius:4,cursor:`pointer`,flex:`0 0 auto`,transition:`color 0.12s, border-color 0.12s, background 0.12s`,"--hover-color":`var(--accent)`,"--hover-border":`var(--accent)`,"--hover-bg":`var(--bg-hover)`},className:`hover-shift`,children:n?(0,E.jsx)(`svg`,{width:p.base,height:p.base,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,E.jsx)(`polyline`,{points:`20 6 9 17 4 12`})}):(0,E.jsxs)(`svg`,{width:p.base,height:p.base,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,E.jsx)(`rect`,{x:`9`,y:`9`,width:p.lg,height:p.lg,rx:`2`,ry:`2`}),(0,E.jsx)(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})]})})})},l=(0,E.jsxs)(`div`,{style:{minWidth:0},children:[(0,E.jsx)(`div`,{style:L5,children:v(`session.infoSection`)}),(0,E.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`auto minmax(0, 1fr) auto`,columnGap:12,rowGap:8,alignItems:`start`},children:e.map(e=>(0,E.jsxs)(`div`,{style:{display:`contents`},children:[(0,E.jsx)(`div`,{style:{color:`var(--text-dim)`,whiteSpace:`nowrap`},children:e.label}),(0,E.jsx)(`div`,{style:{color:`var(--text-muted)`,minWidth:0,overflowWrap:`anywhere`,wordBreak:`break-word`,whiteSpace:`normal`},children:e.value}),(0,E.jsx)(`div`,{children:e.copyField?c(e.copyField,e.value):null})]},`session-info:${e.label}`))})]});return(0,E.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:P?`1fr`:`minmax(360px, 1.7fr) minmax(140px, 0.55fr) minmax(190px, 0.75fr)`,gap:P?16:24,fontSize:`var(--text-base)`,lineHeight:1.5,fontFamily:`var(--font-mono)`},children:[l,s(v(`session.messages`),t),s(v(`session.tokens`),[...r,...o],`right`,!0)]})})():(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,color:`var(--text-muted)`,fontStyle:`italic`},children:v(`session.load`)})})]}),Un?(0,E.jsx)(`div`,{className:`relative flex flex-1 flex-col items-center justify-center overflow-y-auto px-4 py-8`,children:(0,E.jsxs)(`div`,{className:`w-full max-w-[820px]`,children:[(0,E.jsxs)(`div`,{className:`mb-3`,style:{textAlign:`center`,padding:`40px 0`},children:[ee==="default"?(0,E.jsxs)(`div`,{style:{marginBottom:20,fontSize:`var(--text-sm)`,color:`var(--text-muted)`,lineHeight:1.6},children:[v(`notify.permission.bannerHintBefore`),` `,(0,E.jsxs)(`svg`,{width:16,height:16,viewBox:`0 0 24 24`,fill:`none`,stroke:`var(--accent)`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{display:`inline-block`,verticalAlign:-2},children:[(0,E.jsx)(`path`,{d:`M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9`}),(0,E.jsx)(`path`,{d:`M10.3 21a1.94 1.94 0 0 0 3.4 0`})]}),` `,v(`notify.permission.bannerHintAfter`)]}):null,(0,E.jsx)(`div`,{style:{fontSize:`var(--text-6xl)`,fontWeight:700,fontStyle:`italic`,color:`var(--accent)`},children:`Pi Web`}),t?(0,E.jsx)(`div`,{style:{marginTop:6,fontSize:`var(--text-3xl)`,color:`var(--text-muted)`,fontFamily:`var(--font-mono)`},children:t}):null]}),O.length>0&&(0,E.jsx)(`div`,{style:{marginBottom:28},children:(0,E.jsx)(QJ,{messages:O,onSend:Vt,onFillInput:L,testIdPrefix:`start-screen-msg`,wrapperTestId:`start-screen-messages`,center:!0})}),(0,E.jsx)(`div`,{style:{position:`absolute`,top:12,left:0,right:0,zIndex:40,padding:`0 16px`,pointerEvents:`none`},children:(0,E.jsx)(`div`,{style:{maxWidth:820,margin:`0 auto`},children:(0,E.jsx)(H5,{notices:nt,floating:!0,align:`right`})})}),Jn]})}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,E.jsx)(`div`,{style:{position:`absolute`,top:12,left:0,right:P?0:`calc(${vY} + 48px)`,zIndex:40,padding:`0 16px`,pointerEvents:`none`},children:(0,E.jsx)(`div`,{style:{maxWidth:820,margin:`0 auto`},children:(0,E.jsx)(H5,{notices:nt,floating:!0,align:`right`})})}),(0,E.jsx)(`div`,{ref:xt,onScroll:vn,className:`min-h-0 min-w-0 flex-1 overflow-x-hidden overflow-y-auto pt-4 [scrollbar-width:none] [overflow-anchor:none]`,style:{paddingRight:48},"data-testid":`message-list`,children:(0,E.jsx)(`div`,{style:{minWidth:0,padding:`0 16px`},children:(0,E.jsxs)(`div`,{style:{width:`100%`,minWidth:0,maxWidth:820,margin:`0 auto`},children:[Fn&&(0,E.jsx)(E5,{rows:Mn,messages:De,entryIds:Oe,modelNames:Fe,messageCwd:Gn,onOpenFile:u,sessionBusy:Bt,isNew:mt,handleFork:Tt,forkingEntryId:Ge,handleNavigate:Et,handleEditContent:I,sessionId:e?.id??_t.current??void 0,longBlockCollapseChars:S,recentExpandedBlockKeys:Gt,isStreaming:ke.isStreaming,flashKey:zn,itemRef:bn,t:v,messageRefs:kn,lastUserMsgRef:St,visibleRefIndexByMessage:jn,scrollContainerRef:xt,virtualizerRef:mn,initialCache:Rn},xn||`empty`),ke.isStreaming&&ke.streamingMessage&&(0,E.jsx)(`div`,{children:(0,E.jsx)(V8,{message:ke.streamingMessage,isStreaming:!0,modelNames:Fe,cwd:Gn,onOpenFile:u,longBlockCollapseChars:S,recentExpandedBlockKeys:Gt,turnNumber:Wt})}),(Ae||pt)&&(ft?.kind===`waiting_model`||ft?.kind===`thinking`||!ke.streamingMessage)&&(ft||pt)&&(0,E.jsx)(`div`,{className:`py-2 text-[0.8125rem] text-text-muted`,children:(0,E.jsx)(XJ,{phase:ft??{kind:`running_command`},elapsed:tn,totalElapsed:nn})}),je&&(0,E.jsx)(`div`,{className:`py-2 text-[0.8125rem] text-text-muted`,children:(0,E.jsx)(XJ,{phase:{kind:`running_command`},elapsed:tn,totalElapsed:nn})}),Pe&&(0,E.jsx)(V8,{message:{role:`bashExecution`,command:Pe.command,output:``,excludeFromContext:Pe.excludeFromContext},streamingBashOutput:Ne,sessionId:e?.id??_t.current??void 0,longBlockCollapseChars:S}),Ae&&(0,E.jsx)(`div`,{style:{height:48}}),(0,E.jsx)(`div`,{ref:bt})]})})}),!un&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`span`,{style:{position:`absolute`,left:0,right:0,bottom:0,height:30,background:`linear-gradient(to bottom, transparent, var(--bg))`,pointerEvents:`none`,zIndex:49}}),(0,E.jsx)(`button`,{type:`button`,onClick:_n,"aria-label":v(`chat.scrollToLatest`),"data-testid":`scroll-to-latest`,style:{position:`absolute`,bottom:0,left:`50%`,transform:`translateX(-50%)`,width:`min(100% / 3, 260px)`,zIndex:50,cursor:`pointer`,background:`transparent`,border:`none`,padding:0,height:30,display:`flex`,alignItems:`flex-end`,justifyContent:`center`},children:(0,E.jsx)(oi,{label:v(`chat.scrollToLatest`),children:(0,E.jsx)(`span`,{style:{position:`absolute`,bottom:4,left:`50%`,transform:`translateX(-50%)`,width:12,height:11,display:`flex`,alignItems:`flex-end`,justifyContent:`center`,cursor:`pointer`},children:(0,E.jsx)(`span`,{style:{position:`relative`,width:0,height:0,borderLeft:`6px solid transparent`,borderRight:`6px solid transparent`,borderTop:`7px solid var(--text-muted)`,pointerEvents:`none`}})})})})]}),P?null:(0,E.jsx)(vZ,{messages:De,streamingMessage:ke.streamingMessage,scrollContainer:xt,messageRefs:kn,resolveMessageOffset:Pn,scrollStepPx:b,onWindowJumpTo:e=>{let t=xt.current;t&&(t.scrollTop=e)}})]}),(0,E.jsxs)(`div`,{className:`relative`,children:[(0,E.jsx)(`div`,{style:{padding:`0 16px`,paddingRight:P?16:64},children:(0,E.jsx)(`div`,{style:{maxWidth:820,margin:`0 auto`}})}),O.length>0&&Wn&&(0,E.jsx)(`div`,{style:{padding:`0 16px`,paddingRight:P?16:64},children:(0,E.jsx)(`div`,{style:{maxWidth:820,margin:`0 auto`,paddingBottom:8},children:(0,E.jsx)(QJ,{messages:O,onSend:Vt,onFillInput:L,testIdPrefix:`start-screen-msg`,wrapperTestId:`start-screen-messages`})})}),Jn]}),(0,E.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,flexShrink:0,minWidth:0,height:36,padding:`0 12px`,borderTop:`1px solid var(--border)`,gap:8},children:(0,E.jsx)(oi,{label:rn,wrapperStyle:{display:`flex`,flex:1,minWidth:0},children:(0,E.jsx)(`div`,{role:`status`,"aria-label":rn,style:{alignSelf:`stretch`,display:`flex`,alignItems:`center`,flex:1,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-base)`,color:`var(--text-dim)`},children:rn})})})]})]})}function H5({notices:e,floating:t=!1,align:n=`left`}){return e.length===0?null:(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:n===`right`?`flex-end`:`stretch`,marginBottom:t?0:10},children:e.map((n,r)=>{let i=n.type===`error`?`var(--status-error)`:n.type===`warning`?`var(--status-warning)`:n.type===`success`?`var(--status-success)`:`var(--accent)`;return(0,E.jsxs)(`div`,{className:`notice-shelf-item`,style:{display:`flex`,alignItems:`center`,gap:10,minHeight:60,marginBottom:r===e.length-1?0:6,borderRadius:14,border:`1px solid color-mix(in srgb, var(--border) 70%, transparent)`,background:`var(--bg)`,color:`var(--text-muted)`,width:`fit-content`,maxWidth:`min(100%, 620px)`,boxShadow:t?`0 1px 2px var(--shadow-color), 0 10px 28px -14px var(--shadow-color)`:`0 1px 2px var(--shadow-color), 0 8px 24px -12px var(--shadow-color)`,fontSize:`var(--text-4xl)`,lineHeight:1.45,transformOrigin:`top center`,animation:n.exiting?`notice-shelf-out 0.18s ease-in forwards`:`notice-shelf-in 0.18s ease-out both`,padding:`0 12px`},children:[(0,E.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:i,flexShrink:0}}),(0,E.jsx)(`span`,{style:{padding:`14px 0`,minWidth:0,maxWidth:`100%`,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:n.message})]},n.id)})})}function U5({modals:e,onDismiss:t}){let{t:n}=N();return(0,E.jsx)(E.Fragment,{children:e.map((e,r)=>(0,E.jsx)(qX,{variant:e.type===`error`?`error`:`normal`,align:`center`,width:520,height:320,initialOffset:{dx:r%3*24,dy:r%3*24},title:e.type===`error`?n(`chat.notifyErrorTitle`):n(`chat.notifyWarningTitle`),footer:(0,E.jsx)(`button`,{onClick:()=>t(e.id),style:{padding:`6px 14px`,borderRadius:6,border:`1px solid var(--border)`,background:`var(--bg)`,color:`var(--text)`,cursor:`pointer`},children:n(`chat.close`)}),children:(0,E.jsx)(`div`,{style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,fontSize:`var(--text-lg)`,lineHeight:1.6,color:`var(--text)`},children:e.message})},e.id))})}function W5({request:e,onRespond:t}){let{t:n}=N(),[r,i]=(0,d.useState)(e.method===`editor`?e.prefill??``:``),[a,o]=(0,d.useState)(()=>Date.now());(0,d.useEffect)(()=>{i(e.method===`editor`?e.prefill??``:``),o(Date.now())},[e]),(0,d.useEffect)(()=>{if(!e.expiresAt)return;let t=setInterval(()=>{document.hidden||o(Date.now())},1e3),n=()=>{document.hidden||o(Date.now())};return document.addEventListener(`visibilitychange`,n),()=>{clearInterval(t),document.removeEventListener(`visibilitychange`,n)}},[e.expiresAt]);let s=e.expiresAt?Math.max(0,Math.ceil((e.expiresAt-a)/1e3)):null;(0,d.useEffect)(()=>{s===0&&t(e,{cancelled:!0})},[s===0,e.id]);let c=()=>{e.method===`confirm`?t(e,{confirmed:!0}):t(e,{value:r})},l=e.method===`select`?n(`chat.extensionSelect`):e.method===`confirm`?n(`chat.extensionConfirm`):e.method===`editor`?n(`chat.extensionEditor`):n(`chat.extensionInput`);return(0,E.jsxs)(qX,{testId:`extension-dialog`,title:(0,E.jsxs)(E.Fragment,{children:[l,s!==null&&(0,E.jsxs)(`span`,{style:{color:`var(--text-muted)`,marginLeft:6,fontVariantNumeric:`tabular-nums`},children:[`(`,s,`s)`]})]}),subtitle:n(`chat.extensionRequest`),maxWidth:Math.round(window.innerWidth*.6),footer:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`button`,{onClick:()=>t(e,{cancelled:!0}),style:{padding:`6px 10px`,borderRadius:6,border:`1px solid var(--border)`,background:`var(--bg)`,color:`var(--text-muted)`,cursor:`pointer`},children:n(`chat.cancel`)}),e.method===`confirm`?(0,E.jsx)(`button`,{onClick:c,style:{padding:`6px 10px`,borderRadius:6,border:`1px solid var(--accent)`,background:`var(--accent)`,color:`var(--on-accent)`,cursor:`pointer`},children:n(`chat.confirm`)}):e.method===`select`?null:(0,E.jsx)(`button`,{onClick:c,style:{padding:`6px 10px`,borderRadius:6,border:`1px solid var(--accent)`,background:`var(--accent)`,color:`var(--on-accent)`,cursor:`pointer`},children:n(`chat.submit`)})]}),children:[(0,E.jsx)(`div`,{style:{marginBottom:12,padding:`9px 10px`,borderRadius:7,border:`1px solid var(--border)`,background:`var(--bg)`,color:`var(--text)`,fontSize:`var(--text-lg)`,lineHeight:1.6,whiteSpace:`pre-wrap`,maxHeight:360,overflowY:`auto`},children:e.title}),`Notification`in window&&Notification.permission===`denied`&&(0,E.jsx)(`div`,{style:{marginBottom:10,padding:`7px 10px`,borderRadius:7,border:`1px solid var(--border-warning, var(--border))`,background:`var(--bg-panel)`,color:`var(--text-dim)`,fontSize:`var(--text-sm)`,lineHeight:1.5},children:n(`chat.questionNotificationDenied`)}),e.method===`confirm`&&(0,E.jsx)(`div`,{style:{color:`var(--text-muted)`,fontSize:`var(--text-lg)`,lineHeight:1.6,whiteSpace:`pre-wrap`},children:e.message}),e.method===`select`&&(0,E.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:8},children:e.options.map(n=>(0,E.jsx)(`button`,{onClick:()=>t(e,{value:n}),style:{flex:`1 1 auto`,padding:`9px 10px`,borderRadius:7,border:`1px solid var(--border)`,background:`var(--bg-panel)`,color:`var(--text)`,cursor:`pointer`,textAlign:`left`,fontSize:`var(--text-lg)`},children:n},n))}),e.method===`input`&&(0,E.jsx)(`input`,{autoFocus:!0,value:r,placeholder:e.placeholder,onChange:e=>i(e.target.value),onKeyDown:n=>{n.key===`Enter`&&c(),n.key===`Escape`&&t(e,{cancelled:!0})},style:{width:`100%`,padding:`9px 10px`,borderRadius:7,border:`1px solid var(--border)`,background:`var(--bg-panel)`,color:`var(--text)`,outline:`none`,fontSize:`var(--text-2xl)`}}),e.method===`editor`&&(0,E.jsx)(`textarea`,{autoFocus:!0,value:r,onChange:e=>i(e.target.value),onKeyDown:n=>{n.key===`Escape`&&t(e,{cancelled:!0}),(n.metaKey||n.ctrlKey)&&n.key===`Enter`&&c()},style:{width:`100%`,minHeight:220,padding:10,borderRadius:7,border:`1px solid var(--border)`,background:`var(--bg)`,color:`var(--text)`,outline:`none`,resize:`vertical`,fontSize:`var(--text-2xl)`,lineHeight:1.55,fontFamily:`var(--font-mono)`}})]},e.id)}function G5(e,t){return _Y(e).map((e,n)=>Object.keys(e.style).length>0?(0,E.jsx)(`span`,{style:e.style,children:e.text},`${t}-${n}`):e.text)}function K5({request:e,onInput:t}){let{t:n}=N(),r=(0,d.useRef)(null),i=(0,d.useRef)(!1),a=mY(e.lines);return(0,d.useEffect)(()=>{r.current?.focus()},[e.id]),(0,E.jsx)(`div`,{style:{position:`absolute`,inset:0,zIndex:95,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:20,background:`rgba(0,0,0,0.18)`},children:(0,E.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,onClick:e=>{e.target.closest(`button`)||r.current?.focus()},style:{position:`relative`,width:`min(920px, 100%)`,maxHeight:`min(760px, calc(100vh - 40px))`,border:`1px solid var(--border)`,borderRadius:8,background:`var(--bg)`,boxShadow:`0 20px 60px var(--shadow-strong)`,overflow:`hidden`,outline:`none`},children:[(0,E.jsx)(`textarea`,{ref:r,"aria-label":n(`chat.extensionInput`),autoCapitalize:`off`,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,onKeyDown:n=>{if(i.current||n.nativeEvent.isComposing)return;let r=wY(n);r&&(n.preventDefault(),n.stopPropagation(),t(e,r))},onInput:n=>{if(i.current||n.nativeEvent.isComposing)return;let r=n.currentTarget.value;n.currentTarget.value=``,r&&t(e,r)},onCompositionStart:()=>{i.current=!0},onCompositionEnd:n=>{i.current=!1;let r=n.currentTarget;queueMicrotask(()=>{let n=r.value;r.value=``,n&&t(e,n)})},onPaste:n=>{n.preventDefault();let r=n.clipboardData.getData(`text`);r&&t(e,TY(r))},style:{position:`absolute`,width:1,height:1,padding:0,border:0,opacity:0,pointerEvents:`none`}}),(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:12,padding:`10px 12px`,borderBottom:`1px solid var(--border)`},children:[(0,E.jsx)(`div`,{style:{color:`var(--text)`,fontSize:`var(--text-lg)`,fontWeight:650},children:n(`chat.extensionPanel`)}),(0,E.jsx)(`button`,{onClick:()=>t(e,``),style:{padding:`5px 9px`,borderRadius:6,border:`1px solid var(--border)`,background:`var(--bg-panel)`,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-base)`},children:n(`chat.close`)})]}),(0,E.jsx)(`pre`,{style:{margin:0,padding:14,maxHeight:`calc(min(760px, 100vh - 40px) - 48px)`,overflow:`auto`,background:`var(--bg-panel)`,color:`var(--text)`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-lg)`,lineHeight:1.45,whiteSpace:`pre`},children:(a.length?a:[``]).map((e,t,n)=>(0,E.jsxs)(d.Fragment,{children:[G5(e,`line-${t}`),t<n.length-1?`
480
480
  `:null]},t))})]})})}function q5({widget:e,saved:t,messages:n,defaultOffset:r,onCloseWidget:i,setWidgetGeometry:a,onSend:o,fillChatInput:s,portalTarget:c}){let{t:l}=N(),[u,f]=(0,d.useState)(!1),[m,h]=(0,d.useState)(null),g=(0,d.useRef)(null),_=(0,d.useCallback)(t=>{if(u)return;let n=()=>i(e.key,e.lines.join(`
481
481
  `));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}`;f(!0),h(s),window.setTimeout(n,280)},[u,i,e.key,e.lines]);return(0,d.useLayoutEffect)(()=>{if(!m||!g.current)return;let e=g.current;e.style.setProperty(`offset-path`,`path('${m}')`),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`})},[m]),(0,d.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(`
482
482
  `))},[e.key]),(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(qX,{testId:`widget-dialog`,title:e.key,align:`center`,portalTarget:c,style:{opacity:+!u,transition:`opacity 200ms ease`},headerExtra:(0,E.jsx)(oi,{label:l(`widgets.collapse`),children:(0,E.jsx)(`button`,{type:`button`,"aria-label":l(`widgets.collapse`),onClick:_,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,E.jsx)(jr,{size:p.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,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:10},children:[(0,E.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(`
483
- `)}),n.length>0&&(0,E.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,E.jsx)(ZJ,{msg:t,onSend:o,onFillInput:s,testId:`widget-send-${e.key}-${n}`},n))})]})}),m&&(0,E.jsx)(`div`,{"data-testid":`widget-collapse-trail`,style:{position:`fixed`,inset:0,zIndex:70,pointerEvents:`none`},children:(0,E.jsx)(`svg`,{width:`100%`,height:`100%`,style:{position:`absolute`,inset:0},children:(0,E.jsx)(`circle`,{ref:g,r:28,fill:`var(--accent)`,fillOpacity:.7})})})]})}var J5={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`},Y5={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 X5(e){return e.replace(/\\/g,`/`).split(`/`).pop()??``}function Z5(e){return X5(e).toLowerCase().split(`.`).pop()??``}function Q5(e){return J5[Z5(e)]??null}function $5(e){return Y5[Z5(e)]??null}function e7(e){let t=Z5(e);return t===`pdf`||t===`docx`?t:null}function t7(e){return Q5(e)!==null}function n7(e){return $5(e)!==null}function r7(e){return e7(e)!==null}async function i7(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/${vG(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 a7=(0,d.lazy)(()=>$1(()=>import(`./CodeMirrorEditor-DSMafr9-.js`),__vite__mapDeps([18,1]))),o7={source:`Source`,preview:`Preview`,diff:`Diff`},s7={fontFamily:`var(--font-mono)`,fontSize:`var(--text-lg)`,lineHeight:1.6},c7={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 l7(){return(0,E.jsxs)(`svg`,{width:p.xl,height:p.xl,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,E.jsx)(`path`,{d:`M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8`})]})}function u7(e){return(e.nodeType===Node.ELEMENT_NODE?e:e.parentElement)?.closest(`.file-source-line[data-line-number]`)??null}function d7(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=u7(n.startContainer),i=u7(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 f7({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,E.jsxs)(`span`,{className:`file-source-line`,"data-line-number":i+1,style:{display:`flex`,minWidth:`100%`},children:[c&&S3({node:c,stylesheet:t,useInlineStyles:n,key:`source-line-number-${i}`}),(0,E.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)=>S3({node:e,stylesheet:t,useInlineStyles:n,key:`source-token-${i}-${r}`}))})]},`source-line-${i}`)})}function p7(e,t,n,r={}){let i=vG(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 m7({filePath:e,sourceSessionId:t}){let{t:n}=N();return(0,E.jsx)(oi,{label:n(`i18n.downloadFile`),children:(0,E.jsx)(`a`,{href:p7(e,`download`,t),download:yG(e),"aria-label":n(`i18n.downloadFile`),className:`file-viewer-icon-button`,children:(0,E.jsxs)(`svg`,{width:p.xl,height:p.xl,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,E.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,E.jsx)(`polyline`,{points:`7 10 12 15 17 10`}),(0,E.jsx)(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]})})})}function h7(e,t,n){let[r,i]=(0,d.useState)(!1),a=(0,d.useRef)(n);a.current=n;let o=(0,d.useRef)(null);return(0,d.useEffect)(()=>(i(!1),o.current?.(),o.current=Ft({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,d.useCallback)(()=>{o.current?.(),o.current=null,i(!1)},[])}}function g7({filePath:e,cwd:t,extLabel:n,watching:r,sourceSessionId:i,ellipsis:a,children:o}){let{t:s}=N();return(0,E.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,E.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,...a?{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`}:{}},title:e,children:xG(e,t)}),(0,E.jsx)(`span`,{style:{marginLeft:`auto`},children:n}),o,(0,E.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,E.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,E.jsx)(m7,{filePath:e,sourceSessionId:i})]})}function _7(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function v7(e){let t=DZ(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 y7({patch:e}){let{t}=N(),n=v7(e);if(!n.some(e=>e.type!==`unchanged`))return(0,E.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,E.jsx)(`div`,{className:`file-diff-view`,style:{width:`max-content`,minWidth:`100%`,...s7},children:a.map((e,t)=>{if(e.hidden)return(0,E.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,E.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,E.jsx)(`span`,{style:c7,children:e.type===`removed`?e.oldLineNo:e.newLineNo}),(0,E.jsx)(`span`,{style:{minWidth:16,padding:`0 6px`,color:i,userSelect:`none`,flexShrink:0,fontWeight:600},children:r}),(0,E.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,E.jsx)(`div`,{children:n},t)})})}function b7({filePath:e,cwd:t,sourceSessionId:n}){let[r,i]=(0,d.useState)(0),[a,o]=(0,d.useState)(null),[s,c]=(0,d.useState)(null),[l,u]=(0,d.useState)(null),f=yG(e).toLowerCase().split(`.`).pop()??``;(0,d.useEffect)(()=>{i(0),o(null),c(null),u(null)},[e,n]);let{watching:p}=h7(e,n,e=>{typeof e.size==`number`&&o(e.size),i(e=>e+1)}),m=p7(e,`read`,n,r?{v:r}:void 0),h=a==null?null:_7(a);return(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`hidden`},children:[(0,E.jsxs)(g7,{filePath:e,cwd:t,extLabel:f||`image`,watching:p,sourceSessionId:n,children:[s&&(0,E.jsxs)(`span`,{children:[s.w,` × `,s.h]}),h&&(0,E.jsx)(`span`,{children:h})]}),(0,E.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,E.jsx)(`div`,{style:{color:`var(--status-error)`,fontSize:`var(--text-lg)`},children:l}):(0,E.jsx)(`img`,{src:m,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 x7({filePath:e,cwd:t,sourceSessionId:n}){let[r,i]=(0,d.useState)(0),[a,o]=(0,d.useState)(null),[s,c]=(0,d.useState)(null),[l,u]=(0,d.useState)(null),f=yG(e).toLowerCase().split(`.`).pop()??``;(0,d.useEffect)(()=>{i(0),o(null),c(null),u(null)},[e,n]);let{watching:p}=h7(e,n,e=>{typeof e.size==`number`&&o(e.size),c(null),u(null),i(e=>e+1)}),m=p7(e,`read`,n,r?{v:r}:void 0);return(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`hidden`},children:[(0,E.jsxs)(g7,{filePath:e,cwd:t,extLabel:f||`audio`,watching:p,sourceSessionId:n,children:[s!=null&&(0,E.jsx)(`span`,{children:ht(s)}),a!=null&&(0,E.jsx)(`span`,{children:_7(a)})]}),(0,E.jsx)(`div`,{style:{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:24,background:`var(--bg-panel)`},children:(0,E.jsxs)(`div`,{style:{width:`min(680px, 100%)`},children:[l&&(0,E.jsx)(`div`,{style:{color:`var(--status-error)`,fontSize:`var(--text-lg)`,marginBottom:12,textAlign:`center`},children:l}),(0,E.jsx)(`audio`,{controls:!0,preload:`metadata`,src:m,onLoadedMetadata:e=>c(e.currentTarget.duration),onError:()=>u(`Failed to load audio`),style:{width:`100%`}},m)]})})]})}function S7({filePath:e,cwd:t,sourceSessionId:n}){let{t:r}=N(),[i,a]=(0,d.useState)(0),[o,s]=(0,d.useState)(null),[c,l]=(0,d.useState)(null),u=Z5(e),f=u===`pdf`,p=f?p7(e,`read`,n,i?{v:i}:void 0):p7(e,`preview`,n,i?{v:i}:void 0);(0,d.useEffect)(()=>{a(0),s(null),l(null),fetch(p7(e,`meta`,n)).then(e=>e.json()).then(e=>{e.error&&l(e.error),typeof e.size==`number`&&(s(e.size),!f&&e.size>10485760&&l(`DOCX too large for preview (>10MB)`))}).catch(e=>l(String(e)))},[e,f,n]);let{watching:m}=h7(e,n,e=>{if(typeof e.size==`number`&&(s(e.size),!f&&e.size>10485760)){l(`DOCX too large for preview (>10MB)`);return}l(null),a(e=>e+1)});return(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`hidden`},children:[(0,E.jsx)(g7,{filePath:e,cwd:t,extLabel:u===`docx`?`docx preview`:`pdf`,watching:m,sourceSessionId:n,ellipsis:!0,children:o!=null&&(0,E.jsx)(`span`,{children:_7(o)})}),(0,E.jsx)(`div`,{style:{flex:1,minHeight:0,background:`var(--bg-panel)`},children:c?(0,E.jsx)(`div`,{style:{height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:24,color:`var(--status-error)`,fontSize:`var(--text-lg)`,textAlign:`center`},children:c}):(0,E.jsx)(`iframe`,{src:p,sandbox:f?void 0:`allow-same-origin`,title:r(`i18n.previewFile`,{file:yG(e)}),style:{width:`100%`,height:`100%`,border:`none`,background:f?`var(--bg)`:`#eef1f5`}},p)})]})}function C7({filePath:e,cwd:t,sourceSessionId:n,onOpenFile:r,onMentionLines:i,onSaved:a,gitRefreshKey:o,initialDisplayMode:s}){return t7(e)?(0,E.jsx)(b7,{filePath:e,cwd:t,sourceSessionId:n}):n7(e)?(0,E.jsx)(x7,{filePath:e,cwd:t,sourceSessionId:n}):r7(e)?(0,E.jsx)(S7,{filePath:e,cwd:t,sourceSessionId:n}):(0,E.jsx)(T7,{filePath:e,cwd:t,sourceSessionId:n,onOpenFile:r,onMentionLines:i,onSaved:a,gitRefreshKey:o,initialDisplayMode:s})}function w7({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:m,highlightReady:h,selectedLineRange:g,handleMentionSelectedLines:_,fileContent:v,sourceSessionId:y,t:b,saveError:x,enterEdit:S,cancelEdit:C}){return(0,E.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,E.jsx)(oi,{label:e,children:(0,E.jsx)(`span`,{className:`file-viewer-path`,style:{fontFamily:`var(--font-mono)`},children:xG(e,t)})}),(0,E.jsx)(oi,{label:n,children:(0,E.jsx)(`span`,{className:`file-viewer-meta`,children:n})}),!i&&(0,E.jsx)(oi,{label:b(r?`i18n.liveSync`:`i18n.notWatching`),children:(0,E.jsx)(`span`,{"aria-label":b(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,E.jsxs)(`div`,{className:`file-viewer-controls`,children:[a.length>1&&(0,E.jsx)(`div`,{className:`file-viewer-mode-switch`,"aria-label":b(`i18n.fileViewMode`),children:a.map(e=>{let t=o===e;return(0,E.jsx)(oi,{label:e===`diff`?b(`i18n.compareHead`):void 0,children:(0,E.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:o7[e]})},e)})}),(0,E.jsxs)(`div`,{className:`file-viewer-actions`,children:[o===`source`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(oi,{label:b(`i18n.mentionSelectedLines`),children:(0,E.jsx)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:_,"aria-label":b(`i18n.mentionSelectedLines`),disabled:!g,className:`file-viewer-icon-button`,children:(0,E.jsx)(l7,{})})}),(0,E.jsx)(oi,{label:b(c?`i18n.disableWrap`:`i18n.enableWrap`),children:(0,E.jsx)(`button`,{type:`button`,onClick:()=>l(e=>!e),"aria-label":b(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,E.jsxs)(`svg`,{width:p.xl,height:p.xl,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,E.jsx)(`path`,{d:`M4 7V4h16v3`}),(0,E.jsx)(`path`,{d:`M9 20h6`}),(0,E.jsx)(`path`,{d:`M12 4v16`})]})})})]}),o===`source`&&h&&!u&&(0,E.jsx)(`a`,{href:p7(e,`download`,y),download:yG(e),"aria-label":b(`i18n.downloadFile`),className:`file-viewer-icon-button`,style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,textDecoration:`none`},children:(0,E.jsxs)(`svg`,{width:p.xl,height:p.xl,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,E.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,E.jsx)(`polyline`,{points:`7 10 12 15 17 10`}),(0,E.jsx)(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]})}),!i&&o===`source`&&(0,E.jsx)(`div`,{className:`file-viewer-edit-controls`,style:{display:`flex`,alignItems:`center`,gap:8,marginLeft:8},children:u?(0,E.jsxs)(E.Fragment,{children:[d&&(0,E.jsx)(oi,{label:b(`i18n.unsavedChanges`),children:(0,E.jsx)(`span`,{"aria-label":b(`i18n.unsavedChanges`),style:{color:`var(--status-warning)`,fontWeight:700},children:`●`})}),(0,E.jsx)(oi,{label:b(`i18n.saveFileShortcut`),children:(0,E.jsx)(`button`,{type:`button`,onClick:f,disabled:!d||m===`saving`,"aria-label":b(`i18n.saveFile`),className:`file-viewer-icon-button`,style:{background:d?`var(--accent)`:`transparent`,color:d?`var(--bg)`:`var(--text-muted)`},children:m===`saving`?(0,E.jsx)(Ar,{size:p.lg,className:`animate-spin`}):(0,E.jsx)(Vr,{size:p.lg})})}),(0,E.jsx)(oi,{label:b(`i18n.cancelEdit`),children:(0,E.jsx)(`button`,{type:`button`,onClick:C,"aria-label":b(`i18n.cancelEdit`),className:`file-viewer-icon-button`,children:(0,E.jsx)(ni,{size:p.lg})})}),m===`error`&&x&&(0,E.jsx)(`span`,{style:{color:`var(--status-error)`,fontSize:`var(--text-sm)`},children:b(`i18n.saveFailed`,{error:x})}),m===`saved`&&!d&&(0,E.jsx)(`span`,{style:{color:`var(--status-success)`,fontSize:`var(--text-sm)`},children:b(`i18n.saved`)})]}):(0,E.jsx)(oi,{label:b(`i18n.editFile`),children:(0,E.jsx)(`button`,{type:`button`,onClick:S,"aria-label":b(`i18n.editFile`),className:`file-viewer-icon-button`,children:(0,E.jsx)(Pr,{size:p.lg})})})}),!i&&(0,E.jsx)(m7,{filePath:e,sourceSessionId:y})]})]})]})}function T7({filePath:e,cwd:t,sourceSessionId:n,onOpenFile:r,onMentionLines:i,onSaved:a,gitRefreshKey:o,initialDisplayMode:s}){let{isDark:c}=Xn(),{t:l}=N(),[u,f]=(0,d.useState)(null),[m,h]=(0,d.useState)(null),[g,_]=(0,d.useState)(!1),[v,y]=(0,d.useState)(!0),[b,x]=(0,d.useState)(null),[S,C]=(0,d.useState)(`source`),[w,T]=(0,d.useState)(!1),[D,O]=(0,d.useState)(!1),k=(0,d.useRef)(0),A=(0,d.useRef)(null),[j,M]=(0,d.useState)(null),[P,ee]=(0,d.useState)(!1),[F,te]=(0,d.useState)(``),[ne,re]=(0,d.useState)(!1),[ie,ae]=(0,d.useState)(`idle`),[oe,I]=(0,d.useState)(null),L=(0,d.useRef)(!1);L.current=P;let se=(0,d.useCallback)(e=>fetch(p7(e,`read`,n)).then(e=>e.json()).then(e=>e.error?(x(e.error),null):(x(null),f(e),e)).catch(e=>(x(String(e)),null)),[n]),R=(0,d.useCallback)(async e=>{let n=++k.current;if(_(!0),!t){h(null),_(!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;h(i.ok&&a.supported&&typeof a.patch==`string`?a:null)}catch{n===k.current&&h(null)}finally{n===k.current&&_(!1)}},[t]);(0,d.useEffect)(()=>{y(!0),x(null),f(null),h(null),C(s===`diff`?`diff`:`source`),O(!1),ee(!1),te(``),re(!1),ae(`idle`),I(null),se(e).finally(()=>y(!1))},[e,se]);let{watching:ce,closeWatch:le}=h7(e,n,()=>{L.current||(se(e),R(e))});(0,d.useEffect)(()=>{R(e)},[R,e,o]),(0,d.useEffect)(()=>{u?.language===`markdown`&&s!==`diff`&&C(`preview`)},[u?.language,s]);let ue=m?.supported===!0&&typeof m.patch==`string`,de=ue&&m.status===`deleted`;(0,d.useEffect)(()=>{de&&le()},[de,le]);let fe=(0,d.useMemo)(()=>u?.language===`markdown`?cG(u.content):``,[u]);(0,d.useEffect)(()=>{let e=()=>{let e=A.current;M(i&&S===`source`&&e?d7(e,window.getSelection()):null)};if(e(),!(!i||S!==`source`))return document.addEventListener(`selectionchange`,e),()=>document.removeEventListener(`selectionchange`,e)},[u?.content,S,i]);let pe=(0,d.useCallback)(n=>{!i||!n||i(xG(e,t),n.startLine,n.endLine)},[t,e,i]),me=(0,d.useCallback)(()=>{pe(j)},[pe,j]);(0,d.useEffect)(()=>{if(!i||S!==`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?d7(n,window.getSelection()):null;r&&(e.preventDefault(),pe(r))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[S,pe,i]);let he=(0,d.useCallback)(()=>{te(u?.content??``),re(!1),ae(`idle`),I(null),ee(!0)},[u?.content]),ge=(0,d.useCallback)(()=>{ee(!1),re(!1),ae(`idle`),I(null),se(e)},[e,se]),_e=(0,d.useCallback)(e=>{te(e),re(e!==(u?.content??``))},[u?.content]),ve=(0,d.useCallback)(async()=>{if(ne){ae(`saving`),I(null);try{await i7(e,F),f(e=>e&&{...e,content:F}),re(!1),ae(`saved`),a?.(e)}catch(e){ae(`error`),I(e instanceof Error?e.message:String(e))}}},[ne,F,e,a]),ye=u?.content??``;if((0,d.useEffect)(()=>{T(!1)},[ye]),(0,d.useEffect)(()=>{if((de?`diff`:S)!==`source`||w)return;let e=setTimeout(()=>T(!0),0);return()=>clearTimeout(e)},[de,S,w]),v||S===`diff`&&g)return(0,E.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,E.jsx)(Ar,{size:p.lg,className:`animate-spin`,"aria-hidden":`true`}),l(`i18n.loading`)]});if(b&&!de)return(0,E.jsx)(`div`,{style:{height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`var(--status-error)`,fontSize:`var(--text-lg)`},children:b});if(!u&&!de)return null;let be=u?.language??`text`,xe=be===`html`,Se=be===`markdown`,Ce=xe||Se,we=bG(e),Te=ye.split(`
483
+ `)}),n.length>0&&(0,E.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,E.jsx)(ZJ,{msg:t,onSend:o,onFillInput:s,testId:`widget-send-${e.key}-${n}`},n))})]})}),m&&(0,E.jsx)(`div`,{"data-testid":`widget-collapse-trail`,style:{position:`fixed`,inset:0,zIndex:70,pointerEvents:`none`},children:(0,E.jsx)(`svg`,{width:`100%`,height:`100%`,style:{position:`absolute`,inset:0},children:(0,E.jsx)(`circle`,{ref:g,r:28,fill:`var(--accent)`,fillOpacity:.7})})})]})}var J5={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`},Y5={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 X5(e){return e.replace(/\\/g,`/`).split(`/`).pop()??``}function Z5(e){return X5(e).toLowerCase().split(`.`).pop()??``}function Q5(e){return J5[Z5(e)]??null}function $5(e){return Y5[Z5(e)]??null}function e7(e){let t=Z5(e);return t===`pdf`||t===`docx`?t:null}function t7(e){return Q5(e)!==null}function n7(e){return $5(e)!==null}function r7(e){return e7(e)!==null}async function i7(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/${vG(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 a7=(0,d.lazy)(()=>$1(()=>import(`./CodeMirrorEditor-C_ypSZVf.js`),__vite__mapDeps([18,1]))),o7={source:`Source`,preview:`Preview`,diff:`Diff`},s7={fontFamily:`var(--font-mono)`,fontSize:`var(--text-lg)`,lineHeight:1.6},c7={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 l7(){return(0,E.jsxs)(`svg`,{width:p.xl,height:p.xl,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,E.jsx)(`path`,{d:`M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8`})]})}function u7(e){return(e.nodeType===Node.ELEMENT_NODE?e:e.parentElement)?.closest(`.file-source-line[data-line-number]`)??null}function d7(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=u7(n.startContainer),i=u7(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 f7({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,E.jsxs)(`span`,{className:`file-source-line`,"data-line-number":i+1,style:{display:`flex`,minWidth:`100%`},children:[c&&S3({node:c,stylesheet:t,useInlineStyles:n,key:`source-line-number-${i}`}),(0,E.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)=>S3({node:e,stylesheet:t,useInlineStyles:n,key:`source-token-${i}-${r}`}))})]},`source-line-${i}`)})}function p7(e,t,n,r={}){let i=vG(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 m7({filePath:e,sourceSessionId:t}){let{t:n}=N();return(0,E.jsx)(oi,{label:n(`i18n.downloadFile`),children:(0,E.jsx)(`a`,{href:p7(e,`download`,t),download:yG(e),"aria-label":n(`i18n.downloadFile`),className:`file-viewer-icon-button`,children:(0,E.jsxs)(`svg`,{width:p.xl,height:p.xl,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,E.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,E.jsx)(`polyline`,{points:`7 10 12 15 17 10`}),(0,E.jsx)(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]})})})}function h7(e,t,n){let[r,i]=(0,d.useState)(!1),a=(0,d.useRef)(n);a.current=n;let o=(0,d.useRef)(null);return(0,d.useEffect)(()=>(i(!1),o.current?.(),o.current=Ft({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,d.useCallback)(()=>{o.current?.(),o.current=null,i(!1)},[])}}function g7({filePath:e,cwd:t,extLabel:n,watching:r,sourceSessionId:i,ellipsis:a,children:o}){let{t:s}=N();return(0,E.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,E.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,...a?{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`}:{}},title:e,children:xG(e,t)}),(0,E.jsx)(`span`,{style:{marginLeft:`auto`},children:n}),o,(0,E.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,E.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,E.jsx)(m7,{filePath:e,sourceSessionId:i})]})}function _7(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function v7(e){let t=DZ(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 y7({patch:e}){let{t}=N(),n=v7(e);if(!n.some(e=>e.type!==`unchanged`))return(0,E.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,E.jsx)(`div`,{className:`file-diff-view`,style:{width:`max-content`,minWidth:`100%`,...s7},children:a.map((e,t)=>{if(e.hidden)return(0,E.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,E.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,E.jsx)(`span`,{style:c7,children:e.type===`removed`?e.oldLineNo:e.newLineNo}),(0,E.jsx)(`span`,{style:{minWidth:16,padding:`0 6px`,color:i,userSelect:`none`,flexShrink:0,fontWeight:600},children:r}),(0,E.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,E.jsx)(`div`,{children:n},t)})})}function b7({filePath:e,cwd:t,sourceSessionId:n}){let[r,i]=(0,d.useState)(0),[a,o]=(0,d.useState)(null),[s,c]=(0,d.useState)(null),[l,u]=(0,d.useState)(null),f=yG(e).toLowerCase().split(`.`).pop()??``;(0,d.useEffect)(()=>{i(0),o(null),c(null),u(null)},[e,n]);let{watching:p}=h7(e,n,e=>{typeof e.size==`number`&&o(e.size),i(e=>e+1)}),m=p7(e,`read`,n,r?{v:r}:void 0),h=a==null?null:_7(a);return(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`hidden`},children:[(0,E.jsxs)(g7,{filePath:e,cwd:t,extLabel:f||`image`,watching:p,sourceSessionId:n,children:[s&&(0,E.jsxs)(`span`,{children:[s.w,` × `,s.h]}),h&&(0,E.jsx)(`span`,{children:h})]}),(0,E.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,E.jsx)(`div`,{style:{color:`var(--status-error)`,fontSize:`var(--text-lg)`},children:l}):(0,E.jsx)(`img`,{src:m,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 x7({filePath:e,cwd:t,sourceSessionId:n}){let[r,i]=(0,d.useState)(0),[a,o]=(0,d.useState)(null),[s,c]=(0,d.useState)(null),[l,u]=(0,d.useState)(null),f=yG(e).toLowerCase().split(`.`).pop()??``;(0,d.useEffect)(()=>{i(0),o(null),c(null),u(null)},[e,n]);let{watching:p}=h7(e,n,e=>{typeof e.size==`number`&&o(e.size),c(null),u(null),i(e=>e+1)}),m=p7(e,`read`,n,r?{v:r}:void 0);return(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`hidden`},children:[(0,E.jsxs)(g7,{filePath:e,cwd:t,extLabel:f||`audio`,watching:p,sourceSessionId:n,children:[s!=null&&(0,E.jsx)(`span`,{children:ht(s)}),a!=null&&(0,E.jsx)(`span`,{children:_7(a)})]}),(0,E.jsx)(`div`,{style:{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:24,background:`var(--bg-panel)`},children:(0,E.jsxs)(`div`,{style:{width:`min(680px, 100%)`},children:[l&&(0,E.jsx)(`div`,{style:{color:`var(--status-error)`,fontSize:`var(--text-lg)`,marginBottom:12,textAlign:`center`},children:l}),(0,E.jsx)(`audio`,{controls:!0,preload:`metadata`,src:m,onLoadedMetadata:e=>c(e.currentTarget.duration),onError:()=>u(`Failed to load audio`),style:{width:`100%`}},m)]})})]})}function S7({filePath:e,cwd:t,sourceSessionId:n}){let{t:r}=N(),[i,a]=(0,d.useState)(0),[o,s]=(0,d.useState)(null),[c,l]=(0,d.useState)(null),u=Z5(e),f=u===`pdf`,p=f?p7(e,`read`,n,i?{v:i}:void 0):p7(e,`preview`,n,i?{v:i}:void 0);(0,d.useEffect)(()=>{a(0),s(null),l(null),fetch(p7(e,`meta`,n)).then(e=>e.json()).then(e=>{e.error&&l(e.error),typeof e.size==`number`&&(s(e.size),!f&&e.size>10485760&&l(`DOCX too large for preview (>10MB)`))}).catch(e=>l(String(e)))},[e,f,n]);let{watching:m}=h7(e,n,e=>{if(typeof e.size==`number`&&(s(e.size),!f&&e.size>10485760)){l(`DOCX too large for preview (>10MB)`);return}l(null),a(e=>e+1)});return(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`hidden`},children:[(0,E.jsx)(g7,{filePath:e,cwd:t,extLabel:u===`docx`?`docx preview`:`pdf`,watching:m,sourceSessionId:n,ellipsis:!0,children:o!=null&&(0,E.jsx)(`span`,{children:_7(o)})}),(0,E.jsx)(`div`,{style:{flex:1,minHeight:0,background:`var(--bg-panel)`},children:c?(0,E.jsx)(`div`,{style:{height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:24,color:`var(--status-error)`,fontSize:`var(--text-lg)`,textAlign:`center`},children:c}):(0,E.jsx)(`iframe`,{src:p,sandbox:f?void 0:`allow-same-origin`,title:r(`i18n.previewFile`,{file:yG(e)}),style:{width:`100%`,height:`100%`,border:`none`,background:f?`var(--bg)`:`#eef1f5`}},p)})]})}function C7({filePath:e,cwd:t,sourceSessionId:n,onOpenFile:r,onMentionLines:i,onSaved:a,gitRefreshKey:o,initialDisplayMode:s}){return t7(e)?(0,E.jsx)(b7,{filePath:e,cwd:t,sourceSessionId:n}):n7(e)?(0,E.jsx)(x7,{filePath:e,cwd:t,sourceSessionId:n}):r7(e)?(0,E.jsx)(S7,{filePath:e,cwd:t,sourceSessionId:n}):(0,E.jsx)(T7,{filePath:e,cwd:t,sourceSessionId:n,onOpenFile:r,onMentionLines:i,onSaved:a,gitRefreshKey:o,initialDisplayMode:s})}function w7({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:m,highlightReady:h,selectedLineRange:g,handleMentionSelectedLines:_,fileContent:v,sourceSessionId:y,t:b,saveError:x,enterEdit:S,cancelEdit:C}){return(0,E.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,E.jsx)(oi,{label:e,children:(0,E.jsx)(`span`,{className:`file-viewer-path`,style:{fontFamily:`var(--font-mono)`},children:xG(e,t)})}),(0,E.jsx)(oi,{label:n,children:(0,E.jsx)(`span`,{className:`file-viewer-meta`,children:n})}),!i&&(0,E.jsx)(oi,{label:b(r?`i18n.liveSync`:`i18n.notWatching`),children:(0,E.jsx)(`span`,{"aria-label":b(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,E.jsxs)(`div`,{className:`file-viewer-controls`,children:[a.length>1&&(0,E.jsx)(`div`,{className:`file-viewer-mode-switch`,"aria-label":b(`i18n.fileViewMode`),children:a.map(e=>{let t=o===e;return(0,E.jsx)(oi,{label:e===`diff`?b(`i18n.compareHead`):void 0,children:(0,E.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:o7[e]})},e)})}),(0,E.jsxs)(`div`,{className:`file-viewer-actions`,children:[o===`source`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(oi,{label:b(`i18n.mentionSelectedLines`),children:(0,E.jsx)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:_,"aria-label":b(`i18n.mentionSelectedLines`),disabled:!g,className:`file-viewer-icon-button`,children:(0,E.jsx)(l7,{})})}),(0,E.jsx)(oi,{label:b(c?`i18n.disableWrap`:`i18n.enableWrap`),children:(0,E.jsx)(`button`,{type:`button`,onClick:()=>l(e=>!e),"aria-label":b(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,E.jsxs)(`svg`,{width:p.xl,height:p.xl,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,E.jsx)(`path`,{d:`M4 7V4h16v3`}),(0,E.jsx)(`path`,{d:`M9 20h6`}),(0,E.jsx)(`path`,{d:`M12 4v16`})]})})})]}),o===`source`&&h&&!u&&(0,E.jsx)(`a`,{href:p7(e,`download`,y),download:yG(e),"aria-label":b(`i18n.downloadFile`),className:`file-viewer-icon-button`,style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,textDecoration:`none`},children:(0,E.jsxs)(`svg`,{width:p.xl,height:p.xl,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,E.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,E.jsx)(`polyline`,{points:`7 10 12 15 17 10`}),(0,E.jsx)(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]})}),!i&&o===`source`&&(0,E.jsx)(`div`,{className:`file-viewer-edit-controls`,style:{display:`flex`,alignItems:`center`,gap:8,marginLeft:8},children:u?(0,E.jsxs)(E.Fragment,{children:[d&&(0,E.jsx)(oi,{label:b(`i18n.unsavedChanges`),children:(0,E.jsx)(`span`,{"aria-label":b(`i18n.unsavedChanges`),style:{color:`var(--status-warning)`,fontWeight:700},children:`●`})}),(0,E.jsx)(oi,{label:b(`i18n.saveFileShortcut`),children:(0,E.jsx)(`button`,{type:`button`,onClick:f,disabled:!d||m===`saving`,"aria-label":b(`i18n.saveFile`),className:`file-viewer-icon-button`,style:{background:d?`var(--accent)`:`transparent`,color:d?`var(--bg)`:`var(--text-muted)`},children:m===`saving`?(0,E.jsx)(Ar,{size:p.lg,className:`animate-spin`}):(0,E.jsx)(Vr,{size:p.lg})})}),(0,E.jsx)(oi,{label:b(`i18n.cancelEdit`),children:(0,E.jsx)(`button`,{type:`button`,onClick:C,"aria-label":b(`i18n.cancelEdit`),className:`file-viewer-icon-button`,children:(0,E.jsx)(ni,{size:p.lg})})}),m===`error`&&x&&(0,E.jsx)(`span`,{style:{color:`var(--status-error)`,fontSize:`var(--text-sm)`},children:b(`i18n.saveFailed`,{error:x})}),m===`saved`&&!d&&(0,E.jsx)(`span`,{style:{color:`var(--status-success)`,fontSize:`var(--text-sm)`},children:b(`i18n.saved`)})]}):(0,E.jsx)(oi,{label:b(`i18n.editFile`),children:(0,E.jsx)(`button`,{type:`button`,onClick:S,"aria-label":b(`i18n.editFile`),className:`file-viewer-icon-button`,children:(0,E.jsx)(Pr,{size:p.lg})})})}),!i&&(0,E.jsx)(m7,{filePath:e,sourceSessionId:y})]})]})]})}function T7({filePath:e,cwd:t,sourceSessionId:n,onOpenFile:r,onMentionLines:i,onSaved:a,gitRefreshKey:o,initialDisplayMode:s}){let{isDark:c}=Xn(),{t:l}=N(),[u,f]=(0,d.useState)(null),[m,h]=(0,d.useState)(null),[g,_]=(0,d.useState)(!1),[v,y]=(0,d.useState)(!0),[b,x]=(0,d.useState)(null),[S,C]=(0,d.useState)(`source`),[w,T]=(0,d.useState)(!1),[D,O]=(0,d.useState)(!1),k=(0,d.useRef)(0),A=(0,d.useRef)(null),[j,M]=(0,d.useState)(null),[P,ee]=(0,d.useState)(!1),[F,te]=(0,d.useState)(``),[ne,re]=(0,d.useState)(!1),[ie,ae]=(0,d.useState)(`idle`),[oe,I]=(0,d.useState)(null),L=(0,d.useRef)(!1);L.current=P;let se=(0,d.useCallback)(e=>fetch(p7(e,`read`,n)).then(e=>e.json()).then(e=>e.error?(x(e.error),null):(x(null),f(e),e)).catch(e=>(x(String(e)),null)),[n]),R=(0,d.useCallback)(async e=>{let n=++k.current;if(_(!0),!t){h(null),_(!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;h(i.ok&&a.supported&&typeof a.patch==`string`?a:null)}catch{n===k.current&&h(null)}finally{n===k.current&&_(!1)}},[t]);(0,d.useEffect)(()=>{y(!0),x(null),f(null),h(null),C(s===`diff`?`diff`:`source`),O(!1),ee(!1),te(``),re(!1),ae(`idle`),I(null),se(e).finally(()=>y(!1))},[e,se]);let{watching:ce,closeWatch:le}=h7(e,n,()=>{L.current||(se(e),R(e))});(0,d.useEffect)(()=>{R(e)},[R,e,o]),(0,d.useEffect)(()=>{u?.language===`markdown`&&s!==`diff`&&C(`preview`)},[u?.language,s]);let ue=m?.supported===!0&&typeof m.patch==`string`,de=ue&&m.status===`deleted`;(0,d.useEffect)(()=>{de&&le()},[de,le]);let fe=(0,d.useMemo)(()=>u?.language===`markdown`?cG(u.content):``,[u]);(0,d.useEffect)(()=>{let e=()=>{let e=A.current;M(i&&S===`source`&&e?d7(e,window.getSelection()):null)};if(e(),!(!i||S!==`source`))return document.addEventListener(`selectionchange`,e),()=>document.removeEventListener(`selectionchange`,e)},[u?.content,S,i]);let pe=(0,d.useCallback)(n=>{!i||!n||i(xG(e,t),n.startLine,n.endLine)},[t,e,i]),me=(0,d.useCallback)(()=>{pe(j)},[pe,j]);(0,d.useEffect)(()=>{if(!i||S!==`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?d7(n,window.getSelection()):null;r&&(e.preventDefault(),pe(r))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[S,pe,i]);let he=(0,d.useCallback)(()=>{te(u?.content??``),re(!1),ae(`idle`),I(null),ee(!0)},[u?.content]),ge=(0,d.useCallback)(()=>{ee(!1),re(!1),ae(`idle`),I(null),se(e)},[e,se]),_e=(0,d.useCallback)(e=>{te(e),re(e!==(u?.content??``))},[u?.content]),ve=(0,d.useCallback)(async()=>{if(ne){ae(`saving`),I(null);try{await i7(e,F),f(e=>e&&{...e,content:F}),re(!1),ae(`saved`),a?.(e)}catch(e){ae(`error`),I(e instanceof Error?e.message:String(e))}}},[ne,F,e,a]),ye=u?.content??``;if((0,d.useEffect)(()=>{T(!1)},[ye]),(0,d.useEffect)(()=>{if((de?`diff`:S)!==`source`||w)return;let e=setTimeout(()=>T(!0),0);return()=>clearTimeout(e)},[de,S,w]),v||S===`diff`&&g)return(0,E.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,E.jsx)(Ar,{size:p.lg,className:`animate-spin`,"aria-hidden":`true`}),l(`i18n.loading`)]});if(b&&!de)return(0,E.jsx)(`div`,{style:{height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`var(--status-error)`,fontSize:`var(--text-lg)`},children:b});if(!u&&!de)return null;let be=u?.language??`text`,xe=be===`html`,Se=be===`markdown`,Ce=xe||Se,we=bG(e),Te=ye.split(`
484
484
  `),Ee=de?`diff`:S,De=de?[`diff`]:[`source`,...Ce?[`preview`]:[],`diff`],Oe=de?l(`files.deleted`):`${be} · ${Te.length} lines · ${_7(u.size)}`;return(0,E.jsxs)(`div`,{className:`file-viewer-shell`,style:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`hidden`},children:[(0,E.jsx)(w7,{filePath:e,cwd:t,metadata:Oe,watching:ce,isDeletedDiff:de,displayModes:De,effectiveDisplayMode:Ee,setDisplayMode:C,wrapLines:D,setWrapLines:O,editMode:P,dirty:ne,handleSave:ve,saveState:ie,saveError:oe,enterEdit:he,cancelEdit:ge,highlightReady:w,selectedLineRange:j,handleMentionSelectedLines:me,fileContent:ye,sourceSessionId:n,t:l}),(0,E.jsxs)(`div`,{ref:A,className:`file-viewer-content`,style:{flex:1,overflow:`auto`,paddingRight:4,background:`var(--bg)`},children:[Ee===`source`&&(0,E.jsx)(`div`,{className:`file-viewer-source`,style:{display:`block`,height:`100%`,overflow:`auto`,background:`var(--bg)`},children:P?(0,E.jsx)(d.Suspense,{fallback:(0,E.jsx)(`div`,{style:{height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`var(--text-muted)`},children:(0,E.jsx)(Ar,{size:p.lg,className:`animate-spin`,"aria-hidden":`true`})}),children:(0,E.jsx)(a7,{initialValue:F,language:be,isDark:c,onChange:_e,onSave:ve},e)}):w?(0,E.jsx)(v6,{className:D?`file-source-view is-wrapped`:`file-source-view`,language:be===`text`?`plaintext`:be,style:c?H6:V6,showLineNumbers:!0,lineNumberStyle:{...c7},customStyle:{margin:0,padding:0,border:0,background:`var(--bg)`,...s7,width:D?`100%`:`max-content`,minWidth:`100%`,minHeight:`100%`,overflow:`visible`},codeTagProps:{style:{fontFamily:`var(--font-mono)`,overflowWrap:D?`anywhere`:`normal`}},renderer:e=>(0,E.jsx)(f7,{...e,wrapLines:D}),wrapLongLines:D,children:ye}):(0,E.jsx)(`pre`,{className:D?`file-source-view is-wrapped`:`file-source-view`,style:{margin:0,padding:0,border:0,background:`var(--bg)`,...s7,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:ye})}),Ee===`diff`&&ue?(0,E.jsx)(y7,{patch:m.patch}):Ee===`diff`?(0,E.jsx)(`div`,{style:{height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`var(--text-muted)`,fontSize:`var(--text-lg)`},children:l(`i18n.noChanges`)}):xe&&Ee===`preview`?(0,E.jsx)(`iframe`,{srcDoc:ye,sandbox:`allow-scripts`,style:{width:`100%`,height:`100%`,border:`none`,background:`var(--bg)`},title:l(`i18n.htmlPreview`)}):Se&&Ee===`preview`?(0,E.jsx)(`div`,{className:`markdown-body markdown-file-preview`,style:{padding:`24px 32px`},children:(0,E.jsx)(Ok,{remarkPlugins:pG,rehypePlugins:hG,components:{code({className:e,children:t,...n}){let r=e?.replace(`language-`,``).toLowerCase()??``,i=String(t);return e?.includes(`language-`)||i.includes(`
485
- `)?r===`mermaid`?(0,E.jsx)(q6,{code:i.replace(/\n$/,``),defaultPreview:!0}):(0,E.jsx)(Z6,{code:i.replace(/\n$/,``),lang:r}):(0,E.jsx)(`code`,{className:e,...n,children:t})},pre({children:e}){return(0,E.jsx)(E.Fragment,{children:e})},a({href:e,children:t,...n}){return delete n.node,(0,E.jsx)(WG,{href:e,markdownDir:we,onOpenFile:r,...n,children:t})},img({src:e,alt:r,...i}){delete i.node;let a=typeof e==`string`?HG(e,we,t??we):null,o=a?p7(a,`read`,n):e;return(0,E.jsx)(`img`,{src:o,alt:r??``,loading:`lazy`,...i})}},children:fe})}):null]})]})}function E7({cwd:e,busy:t,error:n,onCancel:r,onConfirm:i}){let{t:a}=N();return(0,E.jsx)(Ax,{open:!0,onOpenChange:e=>{!e&&!t&&r()},children:(0,E.jsxs)(Px,{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,E.jsxs)(`div`,{style:{display:`flex`,gap:12,padding:`18px 18px 14px`},children:[(0,E.jsxs)(`svg`,{width:p[`5xl`],height:p[`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,E.jsx)(`path`,{d:`M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10Z`}),(0,E.jsx)(`path`,{d:`m9 12 2 2 4-4`})]}),(0,E.jsxs)(`div`,{style:{minWidth:0},children:[(0,E.jsx)(Fx,{style:{fontSize:`var(--text-2xl)`,fontWeight:700,color:`var(--text)`,lineHeight:1.4},children:a(`trust.dialogTitle`)}),(0,E.jsx)(Ix,{style:{marginTop:7,fontSize:`var(--text-base)`,lineHeight:1.6,color:`var(--text-muted)`},children:a(`trust.dialogBody`)}),(0,E.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,E.jsx)(`div`,{role:`alert`,style:{marginTop:10,color:`var(--status-error)`,fontSize:`var(--text-base)`,lineHeight:1.5},children:n})]})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8,padding:`10px 18px`,borderTop:`1px solid var(--border)`},children:[(0,E.jsx)(kx,{type:`button`,variant:`outline`,onClick:r,disabled:t,className:`h-8 px-3 text-xs`,children:a(`trust.cancel`)}),(0,E.jsx)(kx,{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 D7({onCancel:e,onSelect:t,busy:n=!1,error:r}){let{t:i}=N(),[a,o]=(0,d.useState)(!0),[s,c]=(0,d.useState)(``),[l,u]=(0,d.useState)(null),[f,m]=(0,d.useState)(``),[h,g]=(0,d.useState)([]),[_,v]=(0,d.useState)(null),[y,b]=(0,d.useState)(``),[x,S]=(0,d.useState)(null),[C,w]=(0,d.useState)(!0),T=(0,d.useRef)(null),D=(0,d.useCallback)(async e=>{w(!0),S(null);try{let t=await wG(e),n=t.path??e??`/`;c(n),u(t.parentPath??null),m(n),g(t.directories??[]),v(t.drives??null),b(``)}catch(e){S(e instanceof Error?e.message:String(e))}finally{w(!1)}},[]);(0,d.useEffect)(()=>{D()},[D]);let O=e=>{e.preventDefault();let t=f.trim();t&&D(t)},k=f.trim()!==s,A=!!s&&!k&&!n,j=!!l||OG(s),M=y.trim().toLowerCase(),P=e=>!M||e.toLowerCase().includes(M),ee=_===null?[]:_.filter(e=>P(e.name)||P(e.path)),F=h.filter(e=>P(e.name));return(0,E.jsx)(Ax,{open:a,onOpenChange:t=>{!t&&!n&&(o(!1),e())},children:(0,E.jsxs)(Px,{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(),T.current?.focus()},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,flexShrink:0,padding:`12px 18px`,borderBottom:`1px solid var(--border)`},children:[(0,E.jsx)(Fx,{style:{fontWeight:700,fontSize:`var(--text-2xl)`,color:`var(--text)`},children:i(`directoryPicker.selectDirectory`)}),(0,E.jsx)(Mx,{asChild:!0,children:(0,E.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,E.jsxs)(`form`,{onSubmit:O,style:{display:`flex`,alignItems:`center`,gap:8,flexShrink:0,padding:`10px 14px`,borderBottom:`1px solid var(--border)`},children:[(0,E.jsx)(`button`,{className:`directory-picker-back`,type:`button`,onClick:()=>void D(l??void 0),disabled:C||!j,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:j?`pointer`:`default`,opacity:j?1:.45},children:(0,E.jsx)(`svg`,{width:p[`3xl`],height:p[`3xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,E.jsx)(`path`,{d:`m18 15-6-6-6 6`})})}),(0,E.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,E.jsx)(CG,{className:`directory-picker-path h-9 flex-1 font-mono text-xs`,id:`directory-path`,type:`text`,ref:T,value:f,placeholder:`/path/to/project or ~/project`,autoComplete:`off`,spellCheck:!1,style:TG,onChange:e=>{m(e.target.value),S(null)}}),(0,E.jsx)(`button`,{className:`directory-picker-action`,type:`submit`,disabled:C||!f.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:C||!f.trim()?`default`:`pointer`,opacity:C||!f.trim()?.6:1},children:i(`directoryPicker.go`)})]}),(0,E.jsxs)(`div`,{className:`directory-picker-list`,style:{flex:1,minHeight:0,overflow:`auto`,padding:`8px 10px`},children:[C?(0,E.jsx)(`div`,{style:{padding:8,color:`var(--text-dim)`,fontSize:`var(--text-sm)`},children:i(`directoryPicker.loadingDirectories`)}):_===null?F.length>0?F.map(e=>(0,E.jsxs)(`button`,{className:`directory-picker-entry`,type:`button`,onClick:()=>void D(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,E.jsx)(EG,{}),(0,E.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.name})]},e.path)):(0,E.jsx)(`div`,{style:{padding:8,color:`var(--text-dim)`,fontSize:`var(--text-sm)`},children:i(M?`directoryPicker.noMatches`:`directoryPicker.noSubdirectories`)}):ee.length>0?ee.map(e=>(0,E.jsxs)(`button`,{className:`directory-picker-entry`,type:`button`,onClick:()=>void D(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,E.jsx)(DG,{}),(0,E.jsx)(`span`,{children:e.name})]},e.path)):(0,E.jsx)(`div`,{style:{padding:8,color:`var(--text-dim)`,fontSize:`var(--text-sm)`},children:i(M?`directoryPicker.noMatches`:`directoryPicker.noDrives`)}),(x||r)&&(0,E.jsx)(`div`,{style:{padding:`8px`,color:`var(--status-error)`,fontSize:`var(--text-sm)`},children:x??r})]}),(0,E.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,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,flex:1,minWidth:0},children:[(0,E.jsxs)(`svg`,{width:p.lg,height:p.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,E.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,E.jsx)(`path`,{d:`m21 21-4.3-4.3`})]}),(0,E.jsx)(CG,{className:`directory-picker-search h-8 flex-1`,type:`text`,value:y,placeholder:i(`directoryPicker.search`),"aria-label":i(`directoryPicker.search`),autoComplete:`off`,spellCheck:!1,style:TG,onChange:e=>b(e.target.value)})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,flexShrink:0},children:[(0,E.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,E.jsx)(`button`,{className:`directory-picker-action`,type:`button`,onClick:()=>t(s),disabled:!A,title:i(k?`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:A?1:.6,cursor:A?`pointer`:`default`},children:i(n?`i18n.checking`:`directoryPicker.selectThisFolder`)})]})]})]})})}function O7({visible:e=!0,gap:t=4,items:n}){return e?(0,E.jsx)(`div`,{style:{display:`flex`,gap:t,flexShrink:0},children:n.map(e=>(0,E.jsx)(oi,{label:e.title,children:(0,E.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 k7=2;function A7({scrollStepPx:e=200,wrapperStyle:t,children:n,testId:r,hintTestId:i}){let a=(0,d.useRef)(null),[o,s]=(0,d.useState)({scrollHeight:0,clientHeight:0,scrollTop:0}),c=()=>{if(document.hidden)return;let e=a.current;e&&s({scrollHeight:e.scrollHeight,clientHeight:e.clientHeight,scrollTop:e.scrollTop})};(0,d.useLayoutEffect)(()=>{c();let e=a.current;if(!e)return;let t=new ResizeObserver(c);return t.observe(e),()=>t.disconnect()},[]);let{scrollHeight:l,clientHeight:u,scrollTop:f}=o,p=l-u>20,m=f<=k7,h=f+u>=l-k7,g=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`})},_=e=>{let t=a.current;t&&t.scrollTo({top:e===`top`?0:Math.max(0,t.scrollHeight-t.clientHeight),behavior:`smooth`})};return(0,E.jsxs)(`div`,{style:{position:`relative`,...t},children:[(0,E.jsx)(`div`,{ref:a,"data-testid":r,onScroll:c,style:{position:`absolute`,inset:0,overflowY:`auto`,overflowX:`hidden`,padding:0},children:n}),p&&!m&&(0,E.jsx)(Bn,{direction:`up`,visible:!0,testId:i?`${i}-scroll-up`:void 0,onHover:()=>g(-1),onClick:()=>_(`top`)}),p&&!h&&(0,E.jsx)(Bn,{direction:`down`,visible:!0,testId:i?`${i}-scroll-down`:void 0,onHover:()=>g(1),onClick:()=>_(`bottom`)})]})}function j7({...e}){return(0,E.jsx)(fo,{"data-slot":`collapsible`,...e})}function M7({...e}){return(0,E.jsx)(oo,{"data-slot":`collapsible-trigger`,...e})}function N7({...e}){return(0,E.jsx)(co,{"data-slot":`collapsible-content`,...e})}function P7({title:e,titleTooltip:t,open:n,onToggle:r,collapsible:i=!0,actions:a,expandedFlex:o=`1 1 0`,style:s,children:c}){return(0,E.jsxs)(j7,{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,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,flexShrink:0,background:`var(--bg-panel)`},children:[(0,E.jsx)(oi,{label:t??e,children:(0,E.jsx)(M7,{asChild:!0,children:(0,E.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,E.jsx)(`svg`,{width:p.xs,height:p.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,E.jsx)(`polyline`,{points:`3 2 7 5 3 8`})}),(0,E.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e})]})})}),a&&(0,E.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,marginLeft:`auto`,minWidth:0,gap:6,flexShrink:1,paddingRight:4},children:a})]}),(0,E.jsx)(N7,{style:{display:`flex`,flexDirection:`column`,minHeight:0,flex:1},children:c})]})}function F7({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,E.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,E.jsxs)(P7,{title:e,titleTooltip:t,open:n,onToggle:r,collapsible:i,actions:a,expandedFlex:s,style:{borderTop:`none`},children:[o,(0,E.jsx)(A7,{scrollStepPx:c,wrapperStyle:{flex:1,minHeight:0,...f},testId:l,hintTestId:u,children:m})]})})}function I7(e){return e.error?e.path.split(/[\\/]/).pop()||e.id:e.name||e.firstMessage.slice(0,50)||e.id.slice(0,12)}var L7=(e,t)=>e.replace(/\\/g,`/`)===t.replace(/\\/g,`/`),R7=e=>e.replace(/\\/g,`/`).replace(/\/+$/,``).replace(/^[a-zA-Z]:/,e=>e.toLowerCase()),z7=`pi-web:unread-session-ids`;function B7(){if(typeof window>`u`)return new Set;try{let e=window.localStorage.getItem(z7);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 V7(e){if(!(typeof window>`u`))try{e.size===0?window.localStorage.removeItem(z7):window.localStorage.setItem(z7,JSON.stringify([...e]))}catch{}}function H7(){let[e,t]=(0,d.useState)(()=>B7());return(0,d.useEffect)(()=>{V7(e)},[e]),{unreadSessionIds:e,setUnreadSessionIds:t}}function U7(e){let{selectedCwd:t,selectedCwdProp:n,refreshKey:r,setSelectedCwd:i}=e,[a,o]=(0,d.useState)(null),[s,c]=(0,d.useState)(!1),[l,u]=(0,d.useState)(!1),[f,p]=(0,d.useState)(``),[m,h]=(0,d.useState)(null),[g,_]=(0,d.useState)(!1),[v,y]=(0,d.useState)(null),[b,x]=(0,d.useState)(null),[S,C]=(0,d.useState)(``),w=(0,d.useRef)(null),T=(0,d.useRef)(null),E=(0,d.useRef)(null);(0,d.useEffect)(()=>{n&&n!==E.current&&(E.current=n,i(n))},[n,i]);let D=(0,d.useCallback)(()=>{c(!1),u(!1),p(``),h(null),y(null),C(``)},[]),[O,k]=(0,d.useState)(0);(0,d.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,d.useCallback)(async()=>{let e=f.trim();if(!(!e||g||!a)){_(!0),h(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){h(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){h(e instanceof Error?e.message:String(e))}finally{_(!1)}}},[D,f,g,a,i]),j=(0,d.useCallback)(async(e,n)=>{if(!(!a||g)){_(!0),h(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}h(o.error??`HTTP ${r.status}`);return}D(),t&&e&&L7(t,e)&&i(a.projectRoot),k(e=>e+1)}catch(e){h(e instanceof Error?e.message:String(e))}finally{_(!1)}}},[D,a,g,t,i]);return(0,d.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:f,setWtNewBranch:p,wtError:m,setWtError:h,wtBusy:g,wtConfirmRemove:v,setWtConfirmRemove:y,wtFilter:S,setWtFilter:C,wtDropdownRef:w,wtNewInputRef:T,closeWorktrees:D,handleCreateWorktree:A,handleRemoveWorktree:j}}function W7({wt:e,selectedCwd:t,homeDir:n,setSelectedCwd:r}){let{t:i}=N(),{worktreeState:a,wtFilter:o,setWtFilter:s,wtDropdownOpen:c,setWtDropdownOpen:l,wtDropdownRef:u,closeWorktrees:d,handleRemoveWorktree:f,wtConfirmRemove:m,setWtConfirmRemove:h,wtBusy:g,wtNewOpen:_,setWtNewOpen:v,wtNewBranch:y,setWtNewBranch:b,wtNewInputRef:x,handleCreateWorktree:S,wtError:C,setWtError:w}=e;if(!a)return null;let T=a.worktrees.find(e=>L7(e.path,t))??a.worktrees.find(e=>e.isMain),D=a.worktrees.length>=8,O=D&&o.trim()?a.worktrees.filter(e=>(e.branch??q7(e.path,n)).toLowerCase().includes(o.trim().toLowerCase())):a.worktrees;return(0,E.jsxs)(`div`,{ref:u,style:{position:`relative`,marginTop:6},children:[(0,E.jsxs)(`button`,{onClick:()=>l(e=>!e),title:T?i(`sidebar.switchWorktreeTitle`,{path:T.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,E.jsxs)(`svg`,{width:p.sm,height:p.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0,color:T&&!T.isMain?`var(--accent)`:`var(--text-dim)`},children:[(0,E.jsx)(`line`,{x1:`6`,y1:`3`,x2:`6`,y2:`15`}),(0,E.jsx)(`circle`,{cx:`18`,cy:`6`,r:`3`}),(0,E.jsx)(`circle`,{cx:`6`,cy:`18`,r:`3`}),(0,E.jsx)(`path`,{d:`M18 9a9 9 0 0 1-9 9`})]}),(0,E.jsx)(Y7,{text:T?T.branch??q7(T.path,n):`…`,style:{flex:1,fontFamily:`var(--font-mono)`,color:`var(--text)`}}),T?.isMain&&(0,E.jsx)(`span`,{style:{flexShrink:0,color:`var(--text-dim)`,fontSize:`var(--text-xs)`},children:i(`sidebar.main`)}),a.worktrees.length>1&&(0,E.jsx)(`span`,{style:{flexShrink:0,color:`var(--text-dim)`,fontSize:`var(--text-xs)`},children:a.worktrees.length}),(0,E.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,E.jsx)(`polyline`,{points:`2 3.5 5 6.5 8 3.5`})})]}),(0,E.jsxs)($7,{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:[D&&(0,E.jsx)(`div`,{style:{padding:`6px 8px`,borderBottom:`1px solid var(--border)`},children:(0,E.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,E.jsxs)(`div`,{style:{maxHeight:`min(40vh, 300px)`,overflowY:`auto`},children:[O.map(e=>{let o=L7(e.path,t)||e.isMain&&!a.worktrees.some(e=>L7(e.path,t));return m===e.path?(0,E.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,E.jsx)(`span`,{style:{flex:1,fontSize:`var(--text-sm)`,color:`var(--text)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:i(`sidebar.forceRemoveCheckout`)}),(0,E.jsx)(`button`,{onClick:()=>void f(e.path,!0),disabled:g,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,E.jsx)(`button`,{onClick:()=>h(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,E.jsxs)(`div`,{className:`wt-row`,style:{display:`flex`,alignItems:`center`,borderBottom:`1px solid var(--border)`},children:[(0,E.jsxs)(`button`,{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,E.jsx)(`svg`,{width:p.xs,height:p.xs,viewBox:`0 0 10 10`,fill:`none`,stroke:`var(--accent)`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0},children:(0,E.jsx)(`polyline`,{points:`1.5 5 4 7.5 8.5 2.5`})}):(0,E.jsx)(`span`,{style:{width:10,flexShrink:0}}),(0,E.jsx)(Y7,{text:e.branch??q7(e.path,n),style:{flex:1}}),e.isMain&&(0,E.jsx)(`span`,{style:{flexShrink:0,color:`var(--text-dim)`,fontSize:`var(--text-xs)`},children:i(`sidebar.main`)})]}),!e.isMain&&(0,E.jsx)(`button`,{onClick:()=>void f(e.path,!1),disabled:g,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,E.jsxs)(`svg`,{width:p.base,height:p.base,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,E.jsx)(`polyline`,{points:`3 6 5 6 21 6`}),(0,E.jsx)(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),(0,E.jsx)(`path`,{d:`M10 11v6M14 11v6`}),(0,E.jsx)(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})]})})]},e.path)}),D&&O.length===0&&o.trim()&&(0,E.jsx)(`div`,{style:{padding:`8px 10px`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:i(`sidebar.noMatchingWorktrees`)})]}),_?(0,E.jsxs)(`div`,{style:{padding:`6px 8px`},children:[(0,E.jsx)(`input`,{ref:x,value:y,onChange:e=>{b(e.target.value),w(null)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),S()),e.key===`Escape`&&(v(!1),b(``),w(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,E.jsxs)(`div`,{style:{display:`flex`,gap:5,marginTop:5},children:[(0,E.jsx)(`button`,{onClick:()=>void S(),disabled:g||!y.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:g||!y.trim()?`not-allowed`:`pointer`,opacity:g||!y.trim()?.65:1},children:i(g?`sidebar.creating`:`sidebar.create`)}),(0,E.jsx)(`button`,{onClick:()=>{v(!1),b(``),w(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,E.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),v(!0),w(null),setTimeout(()=>x.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,E.jsxs)(`svg`,{width:p.xs,height:p.xs,viewBox:`0 0 10 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.1`,strokeLinecap:`round`,style:{flexShrink:0},children:[(0,E.jsx)(`line`,{x1:`5`,y1:`1`,x2:`5`,y2:`9`}),(0,E.jsx)(`line`,{x1:`1`,y1:`5`,x2:`9`,y2:`5`})]}),(0,E.jsx)(`span`,{children:i(`sidebar.newWorktree`)})]}),C&&(0,E.jsx)(`div`,{style:{padding:`5px 10px 8px`,color:`var(--status-error)`,fontSize:`var(--text-sm)`,lineHeight:1.35,overflowWrap:`anywhere`},children:C})]})]})}function G7(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 K7(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 q7(e,t){return t&&e.startsWith(t)?`~${e.slice(t.length)}`:e}function J7(e){let t=e.split(/[\\/]+/).filter(Boolean);return t.length?t[t.length-1]:e}function Y7({text:e,style:t}){return(0,E.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,display:`block`,minWidth:0,lineHeight:1.35,direction:`rtl`,textAlign:`left`,...t},children:(0,E.jsx)(`span`,{style:{unicodeBidi:`plaintext`},children:e})})}function X7({session:e}){return(0,E.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,E.jsxs)(`svg`,{width:p.xs,height:p.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,E.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,E.jsx)(`path`,{d:`M12 9v4`}),(0,E.jsx)(`path`,{d:`M12 17h.01`})]}),e.error]})}var Z7=140,Q7=2e3;function $7({open:e,children:t,style:n}){let[r,i]=(0,d.useState)(e),[a,o]=(0,d.useState)(e);return(0,d.useEffect)(()=>{let t,n;return e?(i(!0),o(!1),t=window.requestAnimationFrame(()=>{t=window.requestAnimationFrame(()=>o(!0))})):(o(!1),n=setTimeout(()=>i(!1),Z7)),()=>{t!==void 0&&window.cancelAnimationFrame(t),n&&clearTimeout(n)}},[e]),r?(0,E.jsx)(`div`,{style:{...n,opacity:+!!a,transform:a?`translateY(0) scale(1)`:`translateY(-8px) scale(0.96)`,transformOrigin:`top center`,transition:`opacity ${Z7}ms ease, transform ${Z7}ms ease`,pointerEvents:e?`auto`:`none`},children:t}):null}function e9(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 t9({selectedSessionId:e,selectedSession:t,onSelectSession:n,onNewSession:r,initialSessionId:i,skipInitialProjectSelection:a,onInitialRestoreDone:o,refreshKey:s,onSessionDeleted:c,selectedCwd:l,onCwdChange:u,savedWorkspaces:f,onSavedWorkspacesChange:m,onOpenFile:h}){let{t:g}=N(),[_,v]=(0,d.useState)([]),[y,b]=(0,d.useState)(!0),[x,S]=(0,d.useState)(null),[C,w]=(0,d.useState)(null),[T,D]=(0,d.useState)(``),[O,k]=(0,d.useState)(!1),[A,j]=(0,d.useState)(``),[M,P]=(0,d.useState)(null),[ee,F]=(0,d.useState)(!1),te=U7({selectedCwd:C,selectedCwdProp:l,refreshKey:s,setSelectedCwd:w}),{worktreeState:ne,worktreeLoadingCwd:re}=te,[ie,ae]=(0,d.useState)(!1),[oe,I]=(0,d.useState)(``),L=(0,d.useRef)(null);(0,d.useEffect)(()=>{ie&&L.current?.focus()},[ie]);let[se,R]=(0,d.useState)(!1),[ce,le]=(0,d.useState)(()=>new Set),ue=(0,d.useCallback)(e=>{le(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})},[]),de=(0,d.useCallback)(e=>{le(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n}),Pt(e)},[]),{unreadSessionIds:fe,setUnreadSessionIds:pe}=H7(),me=Jq(),{runningSessionIds:he,runningPhases:ge,runningPhaseSince:_e,runningBusySince:ve,setRunningSessionIds:ye,runningPollAuthoritativeRef:be}=Kt(),Se=(0,d.useRef)(new Set),Ce=(0,d.useRef)(null),we=(0,d.useRef)(0),Te=(0,d.useCallback)(async(e=!1,t=!1)=>{try{e&&b(!0);let n=t?await xe.refresh():await xe.load();v(n.sessions),be.current||ye(new Set(n.runningSessionIds??[]));let r=new Set(n.sessions.map(e=>e.id));pe(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||(R(!0),Ce.current&&clearTimeout(Ce.current),Ce.current=setTimeout(()=>R(!1),2e3))}catch(e){S(String(e))}finally{e&&b(!1)}},[pe,ye,be]),Ee=(0,d.useRef)(!1);(0,d.useEffect)(()=>{let e=!Ee.current;Ee.current=!0,Te(e,e)},[Te,s]),(0,d.useEffect)(()=>{V7(fe)},[fe]),(0,d.useEffect)(()=>{let t=[...Se.current].filter(t=>!he.has(t)&&t!==e),n=[...he];if((t.length>0||n.length>0)&&pe(e=>{let r=new Set(e);return n.forEach(e=>r.delete(e)),t.forEach(e=>r.add(e)),r}),t.length>0&&Te(!1),[...he].filter(e=>!_.some(t=>t.id===e)).length>0){let e=Date.now();e-we.current>=Q7&&(we.current=e,Te(!1,!0))}Se.current=he},[he,e,_,Te,pe]),(0,d.useEffect)(()=>{e&&(Gq(e),pe(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n}))},[e,pe]),(0,d.useEffect)(()=>{fetch(`/api/home`).then(e=>e.json()).then(e=>{e.home&&D(e.home)}).catch(()=>{})},[]);let De=(0,d.useRef)(!1),Oe=(0,d.useCallback)(e=>e?ne&&ne.forCwd&&L7(ne.forCwd,e)||ne?.worktrees.some(t=>L7(t.path,e))?ne.projectRoot:_.find(t=>t.cwd&&L7(t.cwd,e))?.projectRoot??e:null,[ne,_]),ke=(0,d.useRef)(null);(0,d.useEffect)(()=>{ke.current!==C&&(ke.current=C,u?.(C,Oe(C)))},[C,u,Oe]),(0,d.useEffect)(()=>{if(!(_.length===0||a)&&C===null){if(i&&!De.current){De.current=!0;let e=_.find(e=>e.id===i);if(e){w(e.cwd),ue(e.id),n(e,!0);return}o?.()}let e=K7(_);e.length>0&&w(e[0])}},[_,C,i,a,n,o,ue]);let Ae=(0,d.useCallback)(async e=>{let t=(e??A).trim();if(!(!t||ee)){F(!0),P(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){P(n.error??`HTTP ${e.status}`);return}let r=n.cwd??t;if(w(r),k(!1),j(``),m){let e=f??[];e.some(e=>R7(e)===R7(r))||m([...e,r])}}catch(e){P(e instanceof Error?e.message:String(e))}finally{F(!1)}}},[A,ee,f,m]),je=(0,d.useCallback)(async e=>{try{if((await fetch(`/api/sessions/${encodeURIComponent(e.id)}`,{method:`HEAD`})).status===404){S(g(`sidebar.sessionDeleted`)),Te(!1,!0);return}}catch{}e.cwd&&w(e.cwd),ue(e.id),n(e)},[n,g,Te,ue]),Me=(0,d.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]),[Ne,Pe]=(0,d.useState)({}),[Fe,Ie]=(0,d.useState)(null),[Le,Re]=(0,d.useState)(null),[ze,Be]=(0,d.useState)(!1),Ve=Oe(C),He=_,Ue=!!(ne?.isGit&&ne.isTopLevel&&C&&Ve===ne.projectRoot),We=(C&&ne&&Ve===ne.projectRoot&&!Ue?ne.isGit?{label:g(`sidebar.openRepoRoot`),title:g(`sidebar.openRepoRootTitle`)}:{label:g(`sidebar.gitRepoRootOnly`),title:g(`sidebar.gitRepoRootOnlyTitle`)}:null)??(C&&re===C&&!Ue?{label:g(`sidebar.worktrees`),title:g(`sidebar.checkingWorktrees`)}:null),Ge=(0,d.useCallback)(async e=>{Re(null),Be(!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??[];m&&t.some(t=>R7(t)===R7(e.root))&&m(t.filter(t=>R7(t)!==R7(e.root))),Te(!1,!0)}finally{Be(!1)}},[c,Te,f,m]),Ke=(0,d.useMemo)(()=>{let e=t&&!He.some(e=>e.id===t.id)?[{...t,projectRoot:t.projectRoot??Oe(t.cwd)??void 0},...He]:He,n=new Map,r=new Map;for(let t of e){let e=t.projectRoot??t.cwd??`unknown`,i=e===`unknown`?e:R7(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=Oe(C);e&&!n.has(R7(e))&&a.push({root:e,sessions:[]})}let o=new Set([...n.keys()]);for(let e of a)o.add(R7(e.root));let s=[];for(let e of f??[]){let t=R7(e);o.has(t)||(o.add(t),s.push({root:e,sessions:[]}))}return[...a,...i,...s]},[He,C,Oe,t,f]),qe=oe.trim().toLowerCase(),Je=(0,d.useMemo)(()=>qe?Ke.map(e=>({...e,sessions:e.sessions.filter(e=>I7(e).toLowerCase().includes(qe))})).filter(e=>e.sessions.length>0):Ke,[Ke,qe]);return(0,E.jsxs)(`div`,{"data-testid":`session-sidebar`,style:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`hidden`},children:[O&&(0,E.jsx)(D7,{busy:ee,error:M,onCancel:()=>{k(!1),P(null)},onSelect:e=>void Ae(e)}),(0,E.jsxs)(F7,{title:g(`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,E.jsx)(O7,{items:[{key:`search`,testId:`workspace-search-toggle`,onClick:()=>{ie&&I(``),ae(e=>!e)},title:g(`sidebar.searchSessions`),ariaPressed:ie,color:ie?`var(--accent)`:`var(--text-muted)`,background:ie?`var(--bg-selected)`:void 0,icon:(0,E.jsx)(Hr,{size:p.lg})},{key:`new-workspace`,testId:`new-workspace`,onClick:()=>k(!0),title:g(`sidebar.newWorkspace`),color:`var(--text-muted)`,icon:(0,E.jsx)(xr,{size:p.xl})},{key:`refresh`,testId:`session-refresh`,onClick:()=>Te(!1,!0),title:g(`sidebar.refresh`),skipHover:se,color:se?`var(--status-success)`:`var(--text-muted)`,background:se?`color-mix(in srgb, var(--status-success) 18%, transparent)`:void 0,icon:se?(0,E.jsx)(ur,{size:p.xl,color:`var(--status-success)`,strokeWidth:2.5}):(0,E.jsx)(Rr,{size:p.xl})}]}),headerExtra:(0,E.jsxs)(E.Fragment,{children:[ie&&(0,E.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,E.jsx)(Hr,{size:p.lg,color:`var(--text-muted)`,style:{flexShrink:0}}),(0,E.jsx)(`input`,{ref:L,value:oe,onChange:e=>I(e.target.value),placeholder:g(`sidebar.searchSessionsPlaceholder`),"aria-label":g(`sidebar.searchSessions`),style:{flex:1,minWidth:0,background:`transparent`,border:`none`,outline:`none`,color:`var(--text)`,fontSize:`var(--text-sm)`}}),oe&&(0,E.jsx)(`button`,{type:`button`,onClick:()=>{I(``),L.current?.focus()},"aria-label":g(`chat.clearSearch`),style:{border:`none`,background:`transparent`,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-sm)`,flexShrink:0,padding:0},children:`✕`})]}),Ue&&(0,E.jsx)(W7,{wt:te,selectedCwd:C,homeDir:T,setSelectedCwd:w}),We&&(0,E.jsxs)(`button`,{type:`button`,"aria-disabled":`true`,tabIndex:-1,title:We.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,E.jsxs)(`svg`,{width:p.sm,height:p.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0},children:[(0,E.jsx)(`line`,{x1:`6`,y1:`3`,x2:`6`,y2:`15`}),(0,E.jsx)(`circle`,{cx:`18`,cy:`6`,r:`3`}),(0,E.jsx)(`circle`,{cx:`6`,cy:`18`,r:`3`}),(0,E.jsx)(`path`,{d:`M18 9a9 9 0 0 1-9 9`})]}),(0,E.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`},children:We.label})]})]}),children:[y&&(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`16px 14px`,color:`var(--text-muted)`,fontSize:`var(--text-base)`},children:[(0,E.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}}),g(`sidebar.loading`)]}),x&&(0,E.jsx)(`div`,{style:{padding:`12px 14px`,color:`var(--status-error)`,fontSize:`var(--text-base)`},children:x}),!y&&!x&&qe&&Je.length===0&&(0,E.jsx)(`div`,{style:{padding:`16px 14px`,color:`var(--text-muted)`,fontSize:`var(--text-base)`},children:g(`sidebar.searchSessionsNoResults`)}),Je.map(t=>{let n=t.sessions.some(t=>t.id===e)||t.root===Ve;return(0,E.jsxs)(`div`,{children:[(0,E.jsx)(n9,{group:t,groupSelected:n,hoveredGroup:Fe,confirmDeleteGroup:Le,deletingGroup:ze,runningSessionIds:he,interactionBadges:me,collapsed:!!Ne[t.root],setHoveredGroup:Ie,setGroupCollapsed:Pe,setConfirmDeleteGroup:Re,handleDeleteGroup:Ge,handleNewSession:Me,copyText:bY}),(qe||!Ne[t.root])&&(t.sessions.length===0?(0,E.jsx)(`div`,{style:{padding:`10px 14px`,color:`var(--text-muted)`,fontSize:`var(--text-sm)`},children:g(`sidebar.noSessions`)}):e9(t.sessions).map(t=>(0,E.jsx)(r9,{node:t,selectedSessionId:e,runningSessionIds:he,runningPhases:ge,runningPhaseSince:_e,runningBusySince:ve,unreadSessionIds:fe,seenSessionIds:ce,interactionBadges:me,onSelectSession:je,onRenamed:()=>Te(!1,!0),onSessionDeleted:e=>{c?.(e),Te(!1,!0)},onUnseen:de,depth:0},t.session.id)))]},t.root)})]})]})}function n9({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:m}){let{t:h}=N(),g=e.sessions.some(e=>a.has(e.id)),_=e.sessions.some(e=>o.has(e.id));return(0,E.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,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`span`,{style:{flex:1,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:h(`sidebar.deleteWorkspace`,{count:e.sessions.length})}),(0,E.jsxs)(`div`,{style:{display:`flex`,gap:5,flexShrink:0},children:[(0,E.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:h(`sidebar.delete`)}),(0,E.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:h(`sidebar.cancel`)})]})]}):(0,E.jsx)(E.Fragment,{children:(0,E.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:_&&s?`linear-gradient(180deg, transparent calc(100% - 25px), color-mix(in srgb, var(--border) 25%, transparent) 100%)`:g&&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:g&&s&&!_?`200% 100%, auto`:void 0,animation:_&&s?`interaction-bg-blink 1s ease-in-out infinite`:g&&s?`pi-status-shine 1.5s linear infinite`:void 0,boxShadow:`0 2px 8px var(--shadow-color)`,margin:`0 -2px`},children:[(0,E.jsxs)(`span`,{style:{position:`relative`,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:30,height:22,flexShrink:0},children:[(0,E.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,E.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,E.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,E.jsx)(oi,{label:e.root,wrapperStyle:{flex:1,minWidth:0,overflow:`hidden`},children:(0,E.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,maxWidth:`100%`,lineHeight:`20px`},children:J7(e.root)})}),n===e.root&&(0,E.jsx)(O7,{items:[{key:`new-session`,onClick:t=>{t.stopPropagation(),f(e.root)},title:h(`sidebar.newSessionTitle`,{path:e.root}),icon:(0,E.jsx)(Ir,{size:p.base})},{key:`copy-path`,onClick:t=>{t.stopPropagation(),m(e.root)},title:h(`sidebar.copyPath`),icon:(0,E.jsx)(hr,{size:p.base})},{key:`delete-workspace`,onClick:t=>{t.stopPropagation(),u(e.root)},title:h(`sidebar.deleteWorkspaceTitle`),danger:!0,icon:(0,E.jsx)(Xr,{size:p.base})}]})]})})})}function r9({node:e,selectedSessionId:t,runningSessionIds:n,runningPhases:r,runningPhaseSince:i,runningBusySince:a,unreadSessionIds:o,seenSessionIds:s,interactionBadges:c,onSelectSession:l,onRenamed:u,onSessionDeleted:f,onUnseen:p,depth:m}){let[h,g]=(0,d.useState)(!1),_=e.children.length>0;return(0,E.jsxs)(`div`,{style:{paddingBottom:1,backgroundImage:`linear-gradient(90deg, transparent, var(--border), transparent)`,backgroundPosition:`0 100%`,backgroundSize:`100% 1px`,backgroundRepeat:`no-repeat`},children:[(0,E.jsxs)(`div`,{style:{position:`relative`},children:[m>0&&(0,E.jsx)(`div`,{style:{position:`absolute`,left:m*12+6,top:0,bottom:0,width:1,background:`var(--border)`,pointerEvents:`none`}}),(0,E.jsx)(a9,{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=>f?.(e),onUnseen:p,depth:m,hasChildren:_,collapsed:h,onToggleCollapse:()=>g(e=>!e)})]}),_&&!h&&(0,E.jsx)(`div`,{children:e.children.map(e=>(0,E.jsx)(r9,{node:e,selectedSessionId:t,runningSessionIds:n,runningPhases:r,runningPhaseSince:i,runningBusySince:a,unreadSessionIds:o,seenSessionIds:s,interactionBadges:c,onSelectSession:l,onRenamed:u,onSessionDeleted:f,onUnseen:p,depth:m+1},e.session.id))})]})}function i9(){let{t:e}=N();return(0,E.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,E.jsxs)(`svg`,{width:p.xl,height:p.xl,viewBox:`0 0 14 14`,fill:`none`,"aria-hidden":`true`,style:{display:`block`},children:[(0,E.jsx)(`circle`,{cx:`7`,cy:`7`,r:`2.5`,fill:`currentColor`}),(0,E.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 a9({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:f,onUnseen:m,depth:h=0,hasChildren:g=!1,collapsed:_=!1,onToggleCollapse:v}){let{t:y}=N(),b=qt(!!(n&&r),i),x=qt(!!n,a),[S,C]=(0,d.useState)(!1),[w,T]=(0,d.useState)(!1),[D,O]=(0,d.useState)(``),[k,A]=(0,d.useState)(!1),[j,M]=(0,d.useState)(!1),P=(0,d.useRef)(null),ee=e.error?e.path.split(/[\\/]/).pop()||e.id:e.name||e.firstMessage.slice(0,50)||e.id.slice(0,12),F=(0,d.useCallback)(t=>{t.stopPropagation(),O(e.name??``),T(!0),setTimeout(()=>P.current?.select(),0)},[e.name]),te=(0,d.useCallback)(async()=>{let t=D.trim();if(T(!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{}},[D,e.id,e.name,u]),ne=(0,d.useCallback)(async()=>{A(!1),M(!0);try{await fetch(`/api/sessions/${encodeURIComponent(e.id)}`,{method:`DELETE`}),f?.(e.id)}catch{M(!1)}},[e.id,f]),re=(0,d.useCallback)(e=>{e.stopPropagation(),e.shiftKey?ne():A(!0)},[ne]),ie=(0,d.useCallback)(e=>{e.stopPropagation(),ne()},[ne]),ae=(0,d.useCallback)(e=>{e.stopPropagation(),A(!1)},[]);return(0,E.jsx)(`div`,{"data-testid":`session-item`,"data-session-id":e.id,onClick:k||w?void 0:l,title:c?y(`sidebar.interactionBadge`):void 0,onMouseEnter:()=>C(!0),onMouseLeave:()=>{C(!1)},style:{height:54,animation:c?`interaction-bg-blink 1s ease-in-out infinite`:void 0,display:`flex`,alignItems:`center`,paddingLeft:h>0?h*12+14:14,paddingRight:8,cursor:k||w?`default`:`pointer`,backgroundColor:k?`color-mix(in srgb, var(--status-error) 6%, transparent)`:S?`var(--bg-hover)`:`transparent`,transition:`background 0.1s`,opacity:j?.5:1,gap:6,overflow:`hidden`},className:t&&!k?`row-selected-gradient`:void 0,children:k?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,color:`var(--text)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:ee}),(0,E.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,E.jsx)(X7,{session:e}):(0,E.jsx)(`span`,{title:e.modified,children:G7(e.modified,y)}),(0,E.jsx)(`span`,{children:y(`sidebar.messagesCount`,{count:e.messageCount})})]})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,gap:5,flexShrink:0},children:[(0,E.jsxs)(`button`,{onClick:ie,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,E.jsx)(Xr,{size:p.base}),y(`sidebar.delete`)]}),(0,E.jsx)(`button`,{onClick:ae,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:y(`sidebar.cancel`)})]})]}):w?(0,E.jsx)(`input`,{ref:P,value:D,onChange:e=>O(e.target.value),onBlur:te,onKeyDown:e=>{e.key===`Enter`&&te(),e.key===`Escape`&&T(!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,E.jsxs)(E.Fragment,{children:[h>0&&(0,E.jsxs)(`svg`,{width:p.xs,height:p.xs,viewBox:`0 0 24 24`,fill:`none`,stroke:`var(--text-dim)`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0},children:[(0,E.jsx)(`line`,{x1:`6`,y1:`3`,x2:`6`,y2:`15`}),(0,E.jsx)(`circle`,{cx:`18`,cy:`6`,r:`3`}),(0,E.jsx)(`circle`,{cx:`6`,cy:`18`,r:`3`}),(0,E.jsx)(`path`,{d:`M18 9a9 9 0 0 1-9 9`})]}),(0,E.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,E.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:ee,children:(0,E.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,minWidth:0},children:ee})}),(0,E.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,E.jsx)(X7,{session:e}):n?(0,E.jsx)(XJ,{phase:r??{kind:`running_command`},elapsed:b,totalElapsed:x}):o?(0,E.jsx)(i9,{}):(0,E.jsx)(`span`,{title:e.modified,children:G7(e.modified,y)}),!e.error&&n?null:(0,E.jsx)(`span`,{children:y(`sidebar.messagesCount`,{count:e.messageCount})}),e.worktreeBranch&&(0,E.jsxs)(`span`,{title:`Worktree: ${e.cwd}`,style:{display:`flex`,alignItems:`center`,gap:3,color:`var(--accent)`,minWidth:0,overflow:`hidden`},children:[(0,E.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,E.jsx)(`line`,{x1:`6`,y1:`3`,x2:`6`,y2:`15`}),(0,E.jsx)(`circle`,{cx:`18`,cy:`6`,r:`3`}),(0,E.jsx)(`circle`,{cx:`6`,cy:`18`,r:`3`}),(0,E.jsx)(`path`,{d:`M18 9a9 9 0 0 1-9 9`})]}),(0,E.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.worktreeBranch})]})]})]}),g&&(0,E.jsx)(oi,{label:_?`Expand forks`:`Collapse forks`,children:(0,E.jsx)(`button`,{onClick:e=>{e.stopPropagation(),v?.()},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:_?`rotate(-90deg)`:`none`,transition:`transform 0.15s`},children:(0,E.jsx)(`svg`,{width:p.xs,height:p.xs,viewBox:`0 0 10 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,E.jsx)(`polyline`,{points:`2 3.5 5 6.5 8 3.5`})})})}),(0,E.jsx)(O7,{visible:S,items:[...s&&m?[{key:`unseen`,onClick:t=>{t.stopPropagation(),m(e.id)},title:y(`sidebar.disconnect`)||`断开`,icon:(0,E.jsx)(Qr,{size:p.base})}]:[],{key:`copy-path`,onClick:t=>{t.stopPropagation(),bY(e.path)},title:y(`sidebar.copyPath`),icon:(0,E.jsx)(hr,{size:p.base})},{key:`rename`,onClick:F,title:y(`sidebar.rename`),icon:(0,E.jsx)(Pr,{size:p.xl})},{key:`delete`,testId:`session-delete`,onClick:re,title:y(`sidebar.deleteWithShiftClick`),danger:!0,icon:(0,E.jsx)(Xr,{size:p.xl})}]})]})})}function o9(){let{t:e}=N(),t=(0,d.useSyncExternalStore)(bx,xx,xx);if(t.length===0)return null;let n=t[t.length-1],r=t.length;return(0,E.jsx)(jc,{open:!0,onOpenChange:()=>{},children:(0,E.jsxs)(Fc,{children:[(0,E.jsx)(Lc,{style:{position:`fixed`,inset:0,zIndex:1200,background:`rgba(0, 0, 0, 0.45)`}}),(0,E.jsxs)(Vc,{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,E.jsxs)(Kc,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:10,fontSize:`var(--text-base)`,fontWeight:600,color:`var(--text)`},children:[(0,E.jsx)(`span`,{style:{color:`var(--status-error)`},children:`⚠`}),(0,E.jsx)(`span`,{children:r>1?e(`errors.titleCount`,{count:r}):e(`errors.title`)})]}),(0,E.jsx)(Jc,{asChild:!0,children:(0,E.jsx)(`div`,{children:n.kind===`api`?(0,E.jsxs)(`div`,{children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:6},children:[(0,E.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,E.jsx)(`span`,{style:{fontSize:`var(--text-xs)`,color:`var(--text-dim)`},children:n.context})]}),(0,E.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text)`,wordBreak:`break-word`},children:n.message})]}):(0,E.jsxs)(`div`,{children:[n.context&&(0,E.jsx)(`div`,{style:{fontSize:`var(--text-xs)`,color:`var(--text-dim)`,marginBottom:6},children:n.context}),(0,E.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text)`,wordBreak:`break-word`},children:n.message})]})})}),(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8,marginTop:16},children:[r>1&&(0,E.jsx)(`button`,{type:`button`,onClick:Cx,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,E.jsx)(`button`,{type:`button`,onClick:Sx,style:{border:`none`,background:`var(--accent)`,color:`#fff`,borderRadius:6,padding:`4px 14px`,fontSize:`var(--text-sm)`,cursor:`pointer`},children:e(`errors.close`)})]})]})]})})}var s9=[],c9=1,l9=new Set;function u9(){for(let e of l9)e()}function d9(e){return l9.add(e),()=>{l9.delete(e)}}function f9(){return s9}function p9(e){let t={id:c9++,label:e??``};s9=[...s9,t],u9();let n=!1;return()=>{n||(n=!0,s9=s9.filter(e=>e.id!==t.id),u9())}}var m9=new WeakMap;function h9(e){if(!e.isConnected)return()=>{};let t=m9.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},m9.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`)),m9.delete(e)))}}async function g9(e){try{return await e.json()}catch{return null}}async function _9(e,t,n){let r=n?.loading??`fullscreen`,i=r===`fullscreen`?p9(n?.label):r instanceof HTMLElement?h9(r):null;try{let n;try{n=await fetch(e,t)}catch(e){throw new px(e instanceof Error?e.message:`Network error`,0)}if(!n.ok){let e=await g9(n);throw new px(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 px?e:new px(e instanceof Error?e.message:String(e),0)}finally{i?.()}}var v9=3;function y9(){let{t:e}=N(),t=(0,d.useSyncExternalStore)(d9,f9,f9);if(t.length===0)return null;let n=t.slice(0,v9),r=t.length-n.length;return(0,E.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,E.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,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,fontSize:`var(--text-sm)`,color:`var(--text)`},children:[(0,E.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,E.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t.label||e(`loading.inProgress`)})]},t.id)),r>0&&(0,E.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:e(`loading.more`,{count:r})})]})})}var b9={};function x9(e,t){return e===`Not found`?t(`files.notFound`):e===`Access denied`?t(`files.accessDenied`):e}async function S9(e,t){return((await _9(`/api/files/${vG(e)}?type=list`,void 0,t)).entries??[]).map(t=>({name:t.name,fullPath:SG(e,t.name),isDir:t.isDir,size:t.size,children:t.isDir?[]:void 0,loaded:!t.isDir}))}async function C9(e,t){return _9(`/api/git/status?${new URLSearchParams({cwd:e}).toString()}`,void 0,t)}var w9={modified:`files.modified`,added:`files.added`,deleted:`files.deleted`,renamed:`files.renamed`,untracked:`files.untracked`,conflict:`files.conflict`},T9={modified:`var(--status-warning)`,added:`var(--status-success)`,deleted:`var(--status-error)`,renamed:`var(--accent)`,untracked:`var(--status-success)`,conflict:`var(--status-error)`};function E9({status:e,t}){return(0,E.jsx)(`span`,{title:t(w9[e.status]),"aria-label":t(w9[e.status]),style:{width:14,height:14,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`,color:T9[e.status],fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,fontWeight:600},children:e.code})}function D9(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/${vG(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 O9({size:e=11}){return(0,E.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,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,E.jsx)(`path`,{d:`M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8`})]})}function k9({onClick:e,title:t}){return(0,E.jsx)(oi,{label:t,children:(0,E.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,E.jsxs)(`svg`,{width:p.lg,height:p.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,E.jsx)(`path`,{d:`m6 6 12 12`}),(0,E.jsx)(`path`,{d:`m18 6-12 12`})]})})})}function A9({node:e,depth:t,cwd:n,onOpenFile:r,onAtMention:i,expandedPaths:a,onToggleExpanded:o,refreshToken:s,highlightedPaths:c,gitStatusByPath:l,changedDirectoryPaths:u,t:f}){let m=a.has(e.fullPath),h=c.has(e.fullPath),g=_G(e.fullPath),_=l.get(g),v=e.isDir&&(_!==void 0||u.has(g)),[y,b]=(0,d.useState)(e.children??[]),[x,S]=(0,d.useState)(e.loaded??!1),[C,w]=(0,d.useState)(!1),T=(0,d.useCallback)(async(t=!1)=>{if(!(x&&!t))try{let t=await S9(e.fullPath,{loading:`silent`});b(t),S(!0)}catch{}},[x,e.fullPath]);(0,d.useEffect)(()=>{m&&x&&T(!0)},[s]);let D=(0,d.useCallback)(()=>{if(e.isDir){let t=!m;o(e.fullPath,t),t&&!x&&T()}else r(e.fullPath,e.name)},[e.isDir,e.fullPath,e.name,x,m,T,r,o]);return(0,E.jsxs)(`div`,{children:[(0,E.jsxs)(`div`,{onClick:D,onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),style:{position:`relative`,display:`flex`,alignItems:`center`,gap:4,paddingLeft:8+t*14,paddingRight:8,height:24,cursor:`pointer`,background:C?`var(--bg-hover)`:`transparent`,borderRadius:4,userSelect:`none`},children:[e.isDir&&(0,E.jsx)(`svg`,{width:p.xs,height:p.xs,viewBox:`0 0 10 10`,fill:`none`,stroke:`var(--text-dim)`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0,transform:m?`rotate(90deg)`:`none`,transition:`transform 0.1s`},children:(0,E.jsx)(`polyline`,{points:`3 2 7 5 3 8`})}),!e.isDir&&(0,E.jsx)(`span`,{style:{width:10,flexShrink:0}}),(0,E.jsx)(`span`,{style:{flexShrink:0,display:`flex`,alignItems:`center`},children:e.isDir?(0,E.jsx)(sn,{size:p.xl,open:m}):Fn(e.name,14)}),(0,E.jsx)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--text)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,flex:1},title:e.fullPath,children:e.name}),h&&(0,E.jsx)(`span`,{title:f(`files.newlyUploaded`),"aria-label":f(`files.newlyUploaded`),style:{width:14,height:14,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,E.jsx)(`span`,{style:{width:6,height:6,borderRadius:`50%`,background:`var(--accent)`}})}),!C&&!e.isDir&&_&&(0,E.jsx)(E9,{status:_,t:f}),!C&&v&&(0,E.jsx)(`span`,{title:f(`files.containsChangedFiles`),"aria-label":f(`files.containsChangedFiles`),style:{width:14,height:14,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,E.jsx)(`span`,{style:{width:6,height:6,borderRadius:`50%`,background:`var(--status-warning)`}})}),i&&C&&(0,E.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),i(xG(e.fullPath,n),e.isDir)},title:f(`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,E.jsx)(O9,{}),f(`files.mention`)]}),C&&!e.isDir&&(0,E.jsx)(`a`,{href:`/api/files/${vG(e.fullPath)}?type=download`,download:!0,onClick:e=>e.stopPropagation(),title:f(`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,E.jsxs)(`svg`,{width:p.sm,height:p.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,E.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,E.jsx)(`polyline`,{points:`7 10 12 15 17 10`}),(0,E.jsx)(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]})})]}),e.isDir&&m&&(0,E.jsxs)(`div`,{children:[y.map(e=>(0,E.jsx)(A9,{node:e,depth:t+1,cwd:n,onOpenFile:r,onAtMention:i,expandedPaths:a,onToggleExpanded:o,refreshToken:s,highlightedPaths:c,gitStatusByPath:l,changedDirectoryPaths:u,t:f},e.fullPath)),y.length===0&&x&&(0,E.jsx)(`div`,{style:{paddingLeft:8+(t+1)*14,fontSize:`var(--text-sm)`,color:`var(--text-dim)`,height:22,display:`flex`,alignItems:`center`},children:f(`files.empty`)})]})]})}function j9({status:e,cwd:t,onOpenFile:n,onStageToggle:r,unstage:i,t:a}){let[o,s]=(0,d.useState)(!1),c=yG(e.filePath),l=xG(e.filePath,t);return(0,E.jsxs)(`div`,{onClick:()=>n(e.filePath,c,{modeHint:`diff`}),onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),title:e.filePath,style:{display:`flex`,alignItems:`center`,gap:6,paddingLeft:10,paddingRight:8,height:24,cursor:`pointer`,background:o?`var(--bg-hover)`:`transparent`,borderRadius:4,userSelect:`none`},children:[r!==void 0&&(0,E.jsx)(`button`,{type:`button`,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`,opacity:+!!o,"--hover-color":`var(--text-muted)`,"--hover-bg":`var(--bg-hover)`},className:`hover-shift`,children:(0,E.jsx)(`svg`,{width:p.sm,height:p.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`,"aria-hidden":`true`,children:i?(0,E.jsx)(`path`,{d:`M6 12h12`}):(0,E.jsx)(`path`,{d:`M12 5v14M5 12h14`})})}),(0,E.jsx)(E9,{status:e,t:a}),(0,E.jsx)(`span`,{style:{flexShrink:0,display:`flex`,alignItems:`center`,opacity:.85},children:Fn(c,13)}),(0,E.jsx)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--text)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,flex:1},children:l}),e.lineStats&&(e.lineStats.additions>0||e.lineStats.deletions>0)&&(0,E.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,E.jsxs)(`span`,{style:{color:`var(--status-success)`},children:[`+`,e.lineStats.additions]}),e.lineStats.deletions>0&&(0,E.jsxs)(`span`,{style:{color:`var(--status-error)`},children:[`-`,e.lineStats.deletions]})]})]})}function M9({message:e,onMessageChange:t,commitBusy:n,canCommit:r,onCommit:i,pushBusy:a,canPush:o,onPush:s,pullBusy:c,canPull:l,onPull:u,aiBusy:f,canAiGenerate:m,onAiGenerate:h,autoGenerateOnEmpty:g,hasModelForAuto:_,aiModelHint:v,t:y}){let b=(0,d.useRef)(null),x=e.trim()===``,S=x&&g&&_&&m&&!f,C=n||!S&&x||!r;return(0,d.useLayoutEffect)(()=>{let e=b.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,120)}px`)},[e]),(0,E.jsx)(`div`,{style:{display:`flex`,padding:`4px 2px 6px`},children:(0,E.jsxs)(`div`,{style:{position:`relative`,display:`flex`,flexDirection:`column`,flex:1,minWidth:0,backgroundColor:`var(--bg)`,backgroundImage:n||f||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||f||a||c?`200% 100%`:void 0,animation:n||f||a||c?`pi-status-shine 1.5s linear infinite`:void 0,borderRadius:6,border:`1px solid var(--border)`},children:[(0,E.jsx)(`textarea`,{ref:b,value:e,disabled:n||f||a||c,placeholder:f?v?`${y(`git.ai.generating`)}(${v})`:y(`git.ai.generating`):y(`files.commitMessagePlaceholder`),onChange:e=>t(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),C||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||f||a||c?`var(--text-dim)`:`var(--text)`,background:`transparent`,border:`none`,borderRadius:6,outline:`none`}}),(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:4,padding:`2px 6px 4px`},children:[(0,E.jsx)(oi,{label:(()=>{let e=y(f?`git.ai.generating`:`git.ai.generate`);return v?`${e}(${v})`:e})(),children:(0,E.jsx)(`button`,{onClick:h,disabled:f||!m||n||a||c,"aria-label":y(`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:f||!m||n||a||c?`var(--text-dim)`:`var(--accent)`,cursor:f||!m||n||a||c?`default`:`pointer`},children:f?(0,E.jsx)(Ar,{size:p.lg,style:{animation:`spin 0.8s linear infinite`}}):(0,E.jsx)(Kr,{size:p.lg})})}),(0,E.jsx)(oi,{label:n?y(`files.committing`):C&&x&&!S?y(`files.commitMessageRequired`):S?`${y(`git.ai.generateAndCommit`)} (Ctrl+Enter)`:`${y(`files.commit`)} (Ctrl+Enter)`,children:(0,E.jsx)(`button`,{onClick:i,disabled:C||c,"aria-label":y(`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:C||c?`var(--text-dim)`:`var(--accent)`,cursor:C||c?`default`:`pointer`},children:n?(0,E.jsx)(Ar,{size:p[`2xl`],style:{animation:`spin 0.8s linear infinite`}}):(0,E.jsx)(Cr,{size:p[`2xl`]})})}),(0,E.jsx)(oi,{label:y(a?`files.pushing`:o?`files.push`:`files.pushUpToDate`),children:(0,E.jsx)(`button`,{onClick:s,disabled:a||n||c||!o,"aria-label":y(`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,E.jsx)(Ar,{size:p.lg,style:{animation:`spin 0.8s linear infinite`}}):(0,E.jsx)(mr,{size:p[`2xl`]})})}),(0,E.jsx)(oi,{label:y(c?`files.pulling`:l?`files.pull`:`files.pullUpToDate`),children:(0,E.jsx)(`button`,{onClick:u,disabled:c||n||a||!l,"aria-label":y(`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,E.jsx)(Ar,{size:p.lg,style:{animation:`spin 0.8s linear infinite`}}):(0,E.jsx)(pr,{size:p[`2xl`]})})})]})]})})}function N9({prefix:e,count:t,additions:n,deletions:r,t:i}){return(0,E.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,E.jsx)(`span`,{style:{color:`var(--text-dim)`},children:e}),(0,E.jsx)(`span`,{style:{color:`var(--text-dim)`},children:i(`files.changedCount`,{count:t})}),(0,E.jsxs)(`span`,{style:{color:T9.added,fontFamily:`var(--font-mono)`},children:[`+`,n]}),(0,E.jsxs)(`span`,{style:{color:T9.deleted,fontFamily:`var(--font-mono)`},children:[`-`,r]})]})}function P9({message:e,onDismiss:t}){let{t:n}=N();return(0,E.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,E.jsx)(`span`,{style:{minWidth:0,flex:1,overflowWrap:`anywhere`,maxHeight:140,overflowY:`auto`,whiteSpace:`pre-wrap`},children:e}),(0,E.jsx)(k9,{onClick:t,title:n(`files.dismissError`)})]})}function F9({children:e}){return(0,E.jsx)(`div`,{style:{padding:`0 4px 2px`},children:e})}var I9=(0,d.forwardRef)(function({children:e},t){return(0,E.jsx)(`div`,{ref:t,style:{padding:`2px 4px`},children:e})}),L9=(0,d.forwardRef)(function({cwd:e,onOpenFile:t,refreshKey:n,searchQuery:r,onAtMention:i,onAtMentions:a,onUploadBusyChange:o,changesCollapsed:s,onChangesCountChange:c,sessionId:l,onOpenConfig:u},f){let{t:m}=N(),[h,g]=(0,d.useState)([]),[_,v]=(0,d.useState)(!0),[y,b]=(0,d.useState)(null),x=(0,d.useRef)(null),[S,C]=(0,d.useState)(new Set),[w,T]=(0,d.useState)(0),D=(r??``).trim().toLowerCase(),O=(0,d.useMemo)(()=>{if(!D)return h;function e(t){if(t.name.toLowerCase().includes(D))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 h.map(e).filter(e=>e!==null)},[h,D]),[k,A]=(0,d.useState)(new Set),[j,M]=(0,d.useState)([]),[P,ee]=(0,d.useState)({additions:0,deletions:0}),[F,te]=(0,d.useState)([]),[ne,re]=(0,d.useState)({additions:0,deletions:0}),ie=(0,d.useMemo)(()=>D?F.filter(t=>xG(t.filePath,e).toLowerCase().includes(D)):F,[F,D,e]),ae=(0,d.useMemo)(()=>D?j.filter(t=>xG(t.filePath,e).toLowerCase().includes(D)):j,[j,D,e]),[oe,I]=(0,d.useState)({branch:null,upstream:null,ahead:0,behind:0,hasUpstream:!1}),[L,se]=(0,d.useState)(null),[R,ce]=(0,d.useState)(``),[le,ue]=(0,d.useState)(!1),[de,fe]=(0,d.useState)(null),[pe,me]=(0,d.useState)(!1),[he,ge]=(0,d.useState)(!1),[_e,ve]=(0,d.useState)(null),[ye,xe]=(0,d.useState)(!1),[Ce,we]=(0,d.useState)(!1),Te=(0,d.useSyncExternalStore)(Se.subscribe,()=>Se.get()?.preferences??b9,()=>b9),Ee=(0,d.useSyncExternalStore)(be.subscribe,()=>be.get()),De=Te.commitMessageAutoGenerateOnEmpty!==!1,Oe=Te.commitStageAllConfirm!==!1,ke=Te.commitMessageUseCurrentModel===!0?!!(l||Ee?.defaultModel||(Ee?.modelList?.length??0)>0):!!(typeof Te.commitMessageModel==`string`&&Te.commitMessageModel),[Ae,je]=(0,d.useState)(!1),[Me,Ne]=(0,d.useState)(null),Pe=(0,d.useRef)(null),[Fe,Ie]=(0,d.useState)(!1),[Le,Re]=(0,d.useState)(null),[ze,Be]=(0,d.useState)(`idle`),[Ve,He]=(0,d.useState)(0),[Ue,We]=(0,d.useState)(null),[Ge,Ke]=(0,d.useState)(null),[qe,Je]=(0,d.useState)(null),Ye=(0,d.useRef)(null),Xe=(0,d.useRef)(null),Ze=`${n??0}:${w}`,Qe=ze!==`idle`,$e=(0,d.useMemo)(()=>new Map(j.map(e=>[_G(e.filePath),e])),[j]),et=(0,d.useMemo)(()=>{let t=new Set,n=_G(e).replace(/\/$/,``);for(let e of j){let r=bG(_G(e.filePath));for(;(r===n||r.startsWith(`${n}/`))&&(t.add(r),r!==n);){let e=bG(r);if(e===r)break;r=e}}return t},[e,j]),tt=(0,d.useCallback)((e,t)=>{C(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]),nt=(0,d.useCallback)(t=>{let n=t.uploaded??[],r=t.skipped??[],i=t.errors??[];Ke({uploaded:n,skipped:r,errors:i}),n.length>0&&(A(new Set(n.map(t=>SG(e,t)))),T(e=>e+1))},[e]),rt=(0,d.useCallback)(async(t,n)=>{Je(null),We(null),He(0),Be(`uploading`);try{let{status:r,data:i}=await D9(e,t,n,He);if(r===409&&i.conflicts?.length){Je({files:t,conflicts:i.conflicts,nonReplaceable:i.nonReplaceable??[]});return}if(r<200||r>=300)throw Error(i.error??`Upload failed (HTTP ${r})`);He(100),nt(i)}catch(e){We(e instanceof Error?e.message:String(e))}finally{Be(`idle`)}},[nt,e]),it=(0,d.useCallback)(async t=>{if(!(t.length===0||Qe)){Ke(null),A(new Set),Je(null),We(null),He(0),Be(`checking`);try{let n=await _9(`/api/files/${vG(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){Je({files:t,conflicts:n.conflicts,nonReplaceable:n.nonReplaceable??[]});return}await rt(t,`error`)}catch(e){We(e instanceof Error?e.message:String(e))}finally{Be(`idle`)}}},[e,rt,Qe]),at=(0,d.useCallback)(e=>{let t=Array.from(e.target.files??[]);e.target.value=``,it(t)},[it]);(0,d.useImperativeHandle)(f,()=>({openUploadPicker(){Qe||Xe.current?.click()}}),[Qe]);let ot=(0,d.useCallback)(async()=>{je(!0);try{let t=await _9(`/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),T(e=>e+1)}},[e]),st=(0,d.useCallback)(async()=>{Ie(!0);try{let t=await _9(`/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),T(e=>e+1)}},[e]);(0,d.useEffect)(()=>{if(Pe.current&&clearTimeout(Pe.current),Me)return Pe.current=setTimeout(()=>Ne(null),1e4),()=>{Pe.current&&clearTimeout(Pe.current)}},[Me]);let ct=(0,d.useRef)(null);(0,d.useEffect)(()=>{if(ct.current&&clearTimeout(ct.current),Le)return ct.current=setTimeout(()=>Re(null),1e4),()=>{ct.current&&clearTimeout(ct.current)}},[Le]),(0,d.useEffect)(()=>{o?.(Qe)},[o,Qe]),(0,d.useEffect)(()=>()=>o?.(!1),[o]),(0,d.useEffect)(()=>{let t=Ye.current!==e;Ye.current=e,t&&(C(new Set),A(new Set),Ke(null),Je(null),We(null)),b(null),v(t);let n=!1;return S9(e,{loading:`silent`}).then(e=>{n||g(e)}).catch(e=>{n||(b(e instanceof Error?e.message:String(e)),yx(e,`file explorer`))}).finally(()=>{n||v(!1)}),()=>{n=!0}},[e,n,w]),(0,d.useEffect)(()=>{let t=!1;return C9(e,{loading:`silent`}).then(e=>{if(!t){let t=e.isGitRepository;M(t?e.files:[]),ee(t?{additions:e.additions,deletions:e.deletions}:{additions:0,deletions:0}),te(t?e.stagedFiles:[]),re(t?{additions:e.stagedAdditions,deletions:e.stagedDeletions}:{additions:0,deletions:0}),I(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||(M([]),ee({additions:0,deletions:0}),te([]),re({additions:0,deletions:0}),I({branch:null,upstream:null,ahead:0,behind:0,hasUpstream:!1}))}),()=>{t=!0}},[e,n,w]);let lt=(0,d.useCallback)(async(t,n)=>{se(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})`);T(e=>e+1)}catch(e){se(e instanceof Error?e.message:String(e))}},[e]);(0,d.useEffect)(()=>{c?.(j.length+F.length)},[j,F,c]);let ut=(0,d.useCallback)(async(t,n)=>{let r=n??R;ue(!0),fe(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})`);ce(``),fe(null),me(!1),T(e=>e+1)}catch(e){fe(e instanceof Error?e.message:String(e))}finally{ue(!1)}},[e,R]),dt=(0,d.useCallback)(async()=>{if(he||le||Ae||Ce)return null;let t=Se.get()?.preferences??{};if(Object.keys(t).length===0)try{await Se.refresh(),t=Se.get()?.preferences??{}}catch{}let n=t.commitMessageUseCurrentModel===!0,r=typeof t.commitMessageModel==`string`?t.commitMessageModel:``,i=``,a=``;if(n){if(l)try{let e=await _9(`/api/agent/${encodeURIComponent(l)}`),t=e.state?.model??e.model??null;if(t){let e=t;i=e.provider??``,a=e.id??e.modelId??``}if(!i||!a)try{let e=await _9(`/api/sessions/${encodeURIComponent(l)}/state`);e.model&&(i=e.model.provider,a=e.model.id)}catch{}}catch{}if(!i||!a)try{let e=be.get();if(!e?.defaultModel)try{await be.refresh(),e=be.get()}catch{}if(e?.defaultModel?.provider){let t=e.defaultModel;i=t.provider??``,a=t.modelId??t.id??``}if((!i||!a)&&e?.modelList?.[0]){let t=e.modelList[0];i=t.provider??``,a=t.modelId??t.id??``}}catch{}if(!i||!a)return ve(m(`git.ai.noSessionModel`)),null}else{if(!r)return xe(!0),null;let e=r.indexOf(`/`);if(e===-1||(i=r.slice(0,e),a=r.slice(e+1),!i||!a))return ve(m(`git.ai.invalidModel`)),null}let o=t.commitMessageMaxTokens,s=typeof o==`number`&&Number.isFinite(o)?Math.min(4096,Math.max(64,Math.round(o))):512;ge(!0),ve(null);try{let t=await fetch(`/api/git/generate-commit`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:e,provider:i,modelId:a,maxTokens:s})}),n=await t.json().catch(()=>({}));if(!t.ok)throw Error(n.error??`Generate failed (HTTP ${t.status})`);if(!n.message)throw Error(`Empty response`);return ce(n.message),n.message}catch(e){return ve(e instanceof Error?e.message:String(e)),null}finally{ge(!1)}},[he,le,Ae,Ce,e,l,m]),ft=(0,d.useCallback)(async()=>{let t=await C9(e),n=t.isGitRepository;M(n?t.files:[]),ee(n?{additions:t.additions,deletions:t.deletions}:{additions:0,deletions:0}),te(n?t.stagedFiles:[]),re(n?{additions:t.stagedAdditions,deletions:t.stagedDeletions}:{additions:0,deletions:0}),I(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=R.trim()===``,i=n?t.stagedFiles??[]:[],a=n?t.files??[]:[],o=i.length+a.length>0;if(r&&De&&ke&&o&&!he&&!le&&!Ae&&!Ce){we(!0);try{let e=await dt();if(!e)return;i.length>0?await ut(!1,e):Oe?me(!0):await ut(!0,e)}finally{we(!1)}return}i.length>0?ut(!1):Oe?me(!0):ut(!0)},[e,R,De,ke,Oe,he,le,Ae,Ce,dt,ut]),pt=Qe||qe!==null||Ue!==null||Ge!==null,mt=(0,d.useCallback)(()=>{!Ge||Ge.uploaded.length===0||a?.(Ge.uploaded.map(t=>xG(SG(e,t),e)))},[e,a,Ge]);return(0,E.jsxs)(`div`,{style:{minHeight:`100%`},children:[(0,E.jsx)(`input`,{ref:Xe,type:`file`,multiple:!0,hidden:!0,onChange:at}),pt&&(0,E.jsxs)(`div`,{style:{padding:`6px 8px`,borderBottom:`1px solid var(--border)`},children:[Qe&&(0,E.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-label":ze===`checking`?m(`files.checking`):m(`files.uploading`,{progress:Ve}),children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8,minHeight:14,color:`var(--text-muted)`},children:[ze===`checking`?(0,E.jsx)(`svg`,{width:p.lg,height:p.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,E.jsx)(`path`,{d:`M21 12a9 9 0 1 1-5.7-8.4`})}):(0,E.jsxs)(`svg`,{width:p.lg,height:p.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,E.jsx)(`path`,{d:`M12 16V4`}),(0,E.jsx)(`path`,{d:`m7 9 5-5 5 5`}),(0,E.jsx)(`path`,{d:`M5 20h14`})]}),ze===`uploading`&&(0,E.jsxs)(`span`,{style:{fontSize:`var(--text-xs)`},children:[Ve,`%`]})]}),ze===`uploading`&&(0,E.jsx)(`div`,{style:{height:3,marginTop:4,overflow:`hidden`,borderRadius:2,background:`var(--border)`},children:(0,E.jsx)(`div`,{style:{width:`${Ve}%`,height:`100%`,background:`var(--text-muted)`,transition:`width 120ms ease`}})})]}),qe&&(0,E.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,E.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text)`,lineHeight:1.35,overflowWrap:`anywhere`},children:m(`files.conflictSummary`,{count:qe.conflicts.length,countSuffix:qe.conflicts.length===1?``:`s`,files:qe.conflicts.join(`, `)})}),qe.nonReplaceable.length>0&&(0,E.jsx)(`div`,{style:{marginTop:3,fontSize:`var(--text-xs)`,color:`#f59e0b`,lineHeight:1.35,overflowWrap:`anywhere`},children:m(`files.cannotReplace`,{files:qe.nonReplaceable.join(`, `)})}),(0,E.jsxs)(`div`,{style:{display:`flex`,gap:5,marginTop:7},children:[(0,E.jsx)(`button`,{type:`button`,onClick:()=>void rt(qe.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:m(`files.replace`)}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>void rt(qe.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:m(`files.skipExisting`)}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>Je(null),style:{height:22,padding:`0 7px`,border:`none`,borderRadius:4,background:`transparent`,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-xs)`},children:m(`files.cancel`)})]})]}),Ue&&(0,E.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,E.jsx)(`span`,{style:{minWidth:0,flex:1,overflowWrap:`anywhere`},children:Ue}),(0,E.jsx)(k9,{onClick:()=>We(null),title:m(`files.dismissError`)})]}),Ge&&(0,E.jsxs)(`div`,{"aria-live":`polite`,children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,minHeight:22,fontSize:`var(--text-sm)`},children:[(0,E.jsxs)(`div`,{style:{minWidth:0,flex:1,display:`flex`,alignItems:`center`,gap:8},children:[Ge.uploaded.length>0&&(0,E.jsxs)(`span`,{title:`${Ge.uploaded.length} uploaded`,"aria-label":`${Ge.uploaded.length} uploaded`,style:{display:`flex`,alignItems:`center`,gap:3,color:`var(--status-success)`},children:[(0,E.jsx)(`svg`,{width:p.lg,height:p.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,E.jsx)(`path`,{d:`m5 12 4 4L19 6`})}),(0,E.jsx)(`span`,{children:Ge.uploaded.length})]}),Ge.skipped.length>0&&(0,E.jsxs)(`span`,{title:`${Ge.skipped.length} skipped`,"aria-label":`${Ge.skipped.length} skipped`,style:{display:`flex`,alignItems:`center`,gap:3,color:`var(--text-dim)`},children:[(0,E.jsxs)(`svg`,{width:p.lg,height:p.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,E.jsx)(`path`,{d:`M8 12h8`})]}),(0,E.jsx)(`span`,{children:Ge.skipped.length})]}),Ge.errors.length>0&&(0,E.jsxs)(`span`,{title:m(`files.uploadFailed`,{count:Ge.errors.length}),"aria-label":m(`files.uploadFailed`,{count:Ge.errors.length}),style:{display:`flex`,alignItems:`center`,gap:3,color:`var(--status-error)`},children:[(0,E.jsxs)(`svg`,{width:p.lg,height:p.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,E.jsx)(`path`,{d:`M12 3 2.5 20h19L12 3Z`}),(0,E.jsx)(`path`,{d:`M12 9v4`}),(0,E.jsx)(`path`,{d:`M12 17h.01`})]}),(0,E.jsx)(`span`,{children:Ge.errors.length})]})]}),Ge.uploaded.length>0&&a&&(0,E.jsxs)(`button`,{type:`button`,onClick:mt,title:Ge.uploaded.length===1?m(`files.addUploadedFile`):m(`files.addAllUploadedFiles`),"aria-label":Ge.uploaded.length===1?m(`files.addUploadedFile`):m(`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,E.jsx)(O9,{}),m(`files.mention`)]}),(0,E.jsx)(k9,{onClick:()=>Ke(null),title:m(`files.dismissUploadResults`)})]}),Ge.errors.map(e=>(0,E.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,E.jsxs)(`svg`,{width:p.sm,height:p.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0},"aria-hidden":`true`,children:[(0,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,E.jsx)(`path`,{d:`M12 8v5`}),(0,E.jsx)(`path`,{d:`M12 17h.01`})]}),(0,E.jsx)(`span`,{style:{minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.name})]},e.name))]})]}),!s&&(0,E.jsxs)(F9,{children:[(0,E.jsx)(M9,{message:R,onMessageChange:ce,commitBusy:le||Ce,canCommit:F.length+j.length>0,onCommit:ft,pushBusy:Ae,canPush:oe.hasUpstream?oe.ahead>0:!!oe.branch&&oe.branch!==`HEAD`,onPush:ot,pullBusy:Fe,canPull:oe.hasUpstream&&oe.behind>0,onPull:st,aiBusy:he,canAiGenerate:F.length+j.length>0,onAiGenerate:()=>{ce(``),dt()},autoGenerateOnEmpty:De,hasModelForAuto:ke,aiModelHint:(()=>{if(Te.commitMessageUseCurrentModel===!0)return m(`git.ai.usingCurrentModel`);let e=typeof Te.commitMessageModel==`string`?Te.commitMessageModel:``;return e?m(`git.ai.usingModel`,{model:e}):``})(),t:m}),Me&&(0,E.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,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:4},children:[(0,E.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:Me.ok?`var(--status-success)`:`var(--status-error)`,flexShrink:0}}),(0,E.jsx)(`span`,{style:{color:`var(--text-muted)`,flex:1,minWidth:0},children:m(Me.ok?`files.pushSuccess`:`files.pushFailed`)}),(0,E.jsx)(`button`,{onClick:()=>Ne(null),"aria-label":m(`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,E.jsx)(ni,{size:p.base})})]}),Me.output&&(0,E.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,E.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,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:4},children:[(0,E.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:Le.ok?`var(--status-success)`:`var(--status-error)`,flexShrink:0}}),(0,E.jsx)(`span`,{style:{color:`var(--text-muted)`,flex:1,minWidth:0},children:m(Le.ok?`files.pullSuccess`:`files.pullFailed`)}),(0,E.jsx)(`button`,{onClick:()=>Re(null),"aria-label":m(`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,E.jsx)(ni,{size:p.base})})]}),Le.output&&(0,E.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})]}),de&&(0,E.jsx)(P9,{message:de,onDismiss:()=>fe(null)}),L&&(0,E.jsx)(P9,{message:x9(L,m),onDismiss:()=>se(null)}),_e&&(0,E.jsx)(P9,{message:_e,onDismiss:()=>ve(null)}),(0,E.jsx)(N9,{prefix:m(`files.stagedPrefix`),count:ie.length,additions:ne.additions,deletions:ne.deletions,t:m}),ie.length>0?ie.map(n=>(0,E.jsx)(j9,{status:n,cwd:e,onOpenFile:t,onStageToggle:e=>void lt(e,!0),unstage:!0,t:m},`staged-${n.filePath}`)):(0,E.jsx)(`div`,{style:{padding:`8px 10px`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`,textAlign:`center`},children:m(`files.noStagedChanges`)}),(0,E.jsx)(`div`,{style:{height:6}}),(0,E.jsx)(N9,{prefix:m(`files.unstagedPrefix`),count:ae.length,additions:P.additions,deletions:P.deletions,t:m}),ae.length>0?ae.map(n=>(0,E.jsx)(j9,{status:n,cwd:e,onOpenFile:t,onStageToggle:e=>void lt(e,!1),t:m},n.filePath)):(0,E.jsx)(`div`,{style:{padding:`8px 10px`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`,textAlign:`center`},children:m(`files.noUnstagedChanges`)})]}),s&&(0,E.jsxs)(I9,{ref:x,children:[y?(0,E.jsx)(`div`,{style:{padding:`8px 12px`,fontSize:`var(--text-sm)`,color:`var(--status-error)`},children:x9(y,m)}):(D?O:h).map(n=>(0,E.jsx)(A9,{node:n,depth:0,cwd:e,onOpenFile:t,onAtMention:i,expandedPaths:S,onToggleExpanded:tt,refreshToken:Ze,highlightedPaths:k,gitStatusByPath:$e,changedDirectoryPaths:et,t:m},n.fullPath)),!_&&!y&&h.length===0&&(0,E.jsx)(`div`,{style:{padding:`8px 12px`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:m(`files.noFiles`)})]}),(0,E.jsx)(Bx,{open:ye,title:m(`git.ai.notConfiguredTitle`),description:m(`git.ai.notConfiguredDesc`),confirmText:m(`git.ai.goToConfig`),cancelText:m(`sidebar.cancel`),onCancel:()=>xe(!1),onConfirm:()=>{xe(!1),u?.(`git`)},icon:(0,E.jsx)(Kr,{size:p[`5xl`],style:{color:`var(--accent)`}})}),(0,E.jsx)(Bx,{open:pe,title:m(`files.commitTitle`),description:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`div`,{children:m(`files.confirmStageAllCommit`,{count:j.length})}),R.trim()!==``&&(0,E.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:R.trim()})]}),confirmText:m(`files.stageAllAndCommit`),cancelText:m(`sidebar.cancel`),onCancel:()=>me(!1),onConfirm:()=>{me(!1),ut(!0)},icon:(0,E.jsxs)(`svg`,{width:p[`5xl`],height:p[`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,E.jsx)(`path`,{d:`M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10Z`}),(0,E.jsx)(`path`,{d:`m9 12 2 2 4-4`})]})})]})});function R9({cwd:e,onOpenFile:t,explorerRefreshKey:n,onExplorerRefresh:r,onAtMention:i,onAtMentions:a,sessionId:o,onOpenConfig:s}){let{t:c}=N(),[l,u]=(0,d.useState)(0),[f,m]=(0,d.useState)(!1),[h,g]=(0,d.useState)(0),[_,v]=(0,d.useState)(!0),[y,b]=(0,d.useState)(!1),x=(0,d.useRef)(null),S=(0,d.useRef)(null),[C,w]=(0,d.useState)(!1),[T,D]=(0,d.useState)(``),O=(0,d.useRef)(null);return(0,d.useEffect)(()=>{C&&O.current?.focus()},[C]),(0,d.useEffect)(()=>{n!==void 0&&u(e=>e+1)},[n]),e?(0,E.jsx)(F7,{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,E.jsx)(O7,{items:[{key:`git`,onClick:()=>v(e=>!e),title:c(`sidebar.changedFiles`,{count:h}),ariaPressed:!_,color:h>0?`var(--accent)`:`var(--text-muted)`,background:_?void 0:`var(--bg-selected)`,borderColor:_?void 0:`var(--accent)`,icon:(0,E.jsx)(Sr,{size:p.lg})},{key:`search`,testId:`explorer-search-toggle`,onClick:()=>{C&&D(``),w(e=>!e)},title:c(`files.search`),ariaPressed:C,color:C?`var(--accent)`:`var(--text-muted)`,background:C?`var(--bg-selected)`:void 0,icon:(0,E.jsx)(Hr,{size:p.lg})},{key:`upload`,onClick:()=>S.current?.openUploadPicker(),disabled:f,title:c(`sidebar.uploadFilesTitle`),color:`var(--text-muted)`,icon:(0,E.jsx)(Ir,{size:p.base})},{key:`refresh`,onClick:()=>{r?r():u(e=>e+1),b(!0),x.current&&clearTimeout(x.current),x.current=setTimeout(()=>b(!1),2e3)},title:c(`sidebar.refreshExplorer`),skipHover:y,color:y?`var(--status-success)`:`var(--text-muted)`,background:y?`color-mix(in srgb, var(--status-success) 18%, transparent)`:void 0,icon:y?(0,E.jsx)(ur,{size:p.lg,color:`var(--status-success)`,strokeWidth:2.5}):(0,E.jsx)(Rr,{size:p.lg})}]}),headerExtra:C?(0,E.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,E.jsx)(Hr,{size:p.lg,color:`var(--text-muted)`,style:{flexShrink:0}}),(0,E.jsx)(`input`,{ref:O,"data-testid":`explorer-search-input`,value:T,onChange:e=>D(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,E.jsx)(`button`,{type:`button`,onClick:()=>{D(``),O.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,E.jsx)(ni,{size:p.base})})]}):void 0,children:(0,E.jsx)(L9,{ref:S,cwd:e,onOpenFile:t??(()=>{}),refreshKey:l,searchQuery:T,onAtMention:i,onAtMentions:a,onUploadBusyChange:m,changesCollapsed:_,onChangesCountChange:g,sessionId:o,onOpenConfig:s})}):null}function z9({geometries:e,messages:t,onAddMessage:n,onRemoveMessage:r,onUpdateMessage:i,widgets:a,closedKeys:o,onReopen:s}){let{t:c}=N(),[l,u]=(0,d.useState)(null),[f,p]=(0,d.useState)(null),m=(0,d.useRef)(null);(0,d.useEffect)(()=>()=>{m.current&&clearTimeout(m.current)},[]);let h=e=>a.find(t=>t.key===e)?.lines[0],g=(e,t,n)=>{s(e),p({key:e,x:t,y:n}),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>p(null),2500)},_=[...new Set([...Object.keys(e),...o.keys()])].map(t=>[t,e[t]]);return(0,E.jsxs)(`div`,{style:{height:`100%`,display:`flex`,flexDirection:`column`,background:`var(--bg)`},children:[_.length===0?(0,E.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,E.jsx)(`div`,{style:{flex:1,minHeight:0,overflowY:`auto`,padding:10,display:`flex`,flexDirection:`row`,flexWrap:`wrap`,alignContent:`flex-start`,gap:6},children:_.map(([e,a])=>{let s=t[e]??[],d=o.has(e),f=h(e);return(0,E.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,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:7,flexWrap:`wrap`},children:[(0,E.jsxs)(`div`,{style:{minWidth:0,flex:`1 1 120px`},children:[(0,E.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,E.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,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4,flexShrink:0},children:[d&&(0,E.jsxs)(`button`,{type:`button`,"data-testid":`widget-expand-${e}`,"aria-label":c(`widgets.reopen`),title:c(`widgets.reopen`),onClick:t=>g(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,E.jsx)(vr,{size:13,"aria-hidden":!0}),c(`widgets.reopen`)]}),(0,E.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,E.jsx)(Or,{size:13,"aria-hidden":!0}),c(`config.widgets.bind`)]})]})]}),f&&(0,E.jsx)(`div`,{style:{marginTop:4,fontSize:`var(--text-sm)`,color:`var(--text-muted)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:f}),(0,E.jsx)(KK,{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)})}),f&&(0,E.jsx)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":`widget-expanded-toast`,style:{position:`fixed`,left:Math.min(f.x,window.innerWidth-180),top:f.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:f.key})})]})}var B9=e=>window.history.replaceState(null,``,e),V9=36,H9=176,U9=224,W9=86,G9=116;function K9(){let[e,t]=(0,d.useState)(!1);(0,d.useEffect)(()=>{t(!0)},[]);let[n]=(0,d.useState)(()=>Mq(new URLSearchParams(window.location.search))),{isDark:r,toggleTheme:i}=Xn(),{locale:a,setLocale:o,t:s,supportedLocales:c}=N(),l=ne();Sq();let{settingsValue:u,defaultThinkingLevel:f,setDefaultThinkingLevel:m,compaction:h,retry:g,defaultProjectTrust:_,setDefaultProjectTrust:v,subagents:y,savedWorkspaces:b,handleSavedWorkspacesChange:x,widgetGeometries:S,setWidgetGeometry:C,widgetMessages:w,addWidgetMessage:T,removeWidgetMessage:D,updateWidgetMessage:O,fontScale:k,setFontScale:A}=mt({isDark:r,toggleTheme:i}),{selectedSession:j,effectiveNewSessionCwd:M,showChat:P,projectTrustCwd:ee,refreshKey:F,sessionKey:te,explorerRefreshKey:re,setExplorerRefreshKey:ie,modelsRefreshKey:I,setModelsRefreshKey:L,activeCwd:se,initialCwdStatus:R,initialCwdError:ue,initialSessionRestored:de,projectTrust:me,projectTrustDialogOpen:ge,setProjectTrustDialogOpen:_e,projectTrustBusy:ve,projectTrustError:ye,setProjectTrustError:be,extensionDialogActiveRef:xe,handleSelectSession:Se,handleNewSession:Ce,handleSessionCreated:we,handleAgentEnd:Te,handleSessionRenamed:Ee,handleSessionForked:De,handleSessionDeleted:Oe,handleCwdChange:Ae,handleTrustProject:Me,handleExplorerRefresh:Ne,handleInitialRestoreDone:Pe}=ke({initialNavigation:n,onProjectSwitch:()=>{_t(null),Fe(e=>e.filter(e=>e.kind!==`file`)),Ie(null),B9(`/`)},onSessionSelected:e=>{l&&!e&&Ze(!1)},onTopPanelReset:()=>_t(null)}),{setSavedTabs:Fe,setActiveSavedId:Ie,configTabOpen:Le,configSection:Re,setConfigSection:ze,configTabActive:Be,activeFileTab:Ve,fileTabs:He,modelConfigFocus:Ue,handleOpenFile:We,openConfigTab:Ge,handleOpenModelConfig:Ke,closeConfigTab:qe,handleCloseMainTab:Je}=vq({onSessionSelected:()=>{Tt(!1),l&&Ze(!1)},onRefreshModels:()=>L(e=>e+1)}),Ye=(0,d.useCallback)(e=>{We(e,yG(e),{sourceSessionId:j?.id??null})},[We,j?.id]),[Xe,Ze]=(0,d.useState)(!0),[Qe,$e]=(0,d.useState)(!1),et=(0,d.useRef)(280),tt=(0,d.useRef)(280),nt=(0,d.useCallback)(()=>typeof window>`u`?480:ce({viewportWidth:window.innerWidth,rightPanelOpen:!1,rightPanelWidth:0}),[]),rt=fe({ariaLabel:s(`layout.resizeSidebar`),cssVariable:`--sidebar-width`,defaultWidth:280,getMaxWidth:nt,growthDirection:`right`,maxWidth:480,minWidth:180,storageKey:`pi-sidebar-width`,widthRef:et}),it=rt.reclampWidth,at=fe({ariaLabel:s(`layout.resizeWidgetPanel`),cssVariable:`--widget-panel-width`,defaultWidth:280,getMaxWidth:()=>typeof window>`u`?560:le({viewportWidth:window.innerWidth,sidebarOpen:Xe,sidebarWidth:rt.width}),growthDirection:`left`,maxWidth:560,minWidth:200,storageKey:`pi-widget-panel-width`,widthRef:tt});(0,d.useEffect)(()=>{l&&Ze(!1)},[l]),(0,d.useEffect)(()=>{$e(!0)},[]),(0,d.useEffect)(()=>{it()},[it]);let ot=(0,d.useRef)(null),st=(0,d.useRef)(null),ct=(0,d.useRef)(null),ut=(0,d.useRef)(null),dt=(0,d.useRef)(null),ft=pe(),pt=(0,d.useCallback)(()=>{ft.schedule(()=>{_t(null)},150)},[ft]),ht=ft.cancel,[gt,_t]=(0,d.useState)(null),[vt,yt]=(0,d.useState)(null),bt=(0,d.useCallback)(e=>{l&&Ze(!1),_t(t=>t===e?null:e)},[l]),xt=(0,d.useCallback)(()=>{l&&_t(null),Ze(e=>!e)},[l]);(0,d.useEffect)(()=>{if(!gt)return;let e=()=>{if(document.hidden)return;let e=st.current?.getBoundingClientRect();if(e){if(gt===`language`&&!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(H9,n?.width??e.width),o=Math.min(t.left-1,Math.max(n?.left??e.left,(n?.right??e.right)-a)),s=i+4;yt({top:s+W9>window.innerHeight-4?r-W9:s,left:o,width:a});return}if(gt===`fontSize`&&!l&&dt.current){let t=dt.current.getBoundingClientRect(),n=ct.current?.getBoundingClientRect(),r=n?.top??t.top,i=n?.bottom??t.bottom,a=Math.min(U9,n?.width??e.width),o=Math.min(t.left-1,Math.max(n?.left??e.left,(n?.right??e.right)-a)),s=i+4;yt({top:s+G9>window.innerHeight-4?r-G9:s,left:o,width:a});return}yt({top:e.bottom,left:e.left,width:e.width})}};e();let t=new ResizeObserver(e);return st.current&&t.observe(st.current),ut.current&&t.observe(ut.current),dt.current&&t.observe(dt.current),()=>t.disconnect()},[gt,l]);let{widgetPanelOpen:St,setWidgetPanelOpen:Ct,widgetsTabActive:wt,setWidgetsTabActive:Tt,extensionWidgets:Et,closedWidgets:Dt,handleCloseWidget:Ot,handleReopenWidget:kt,handleExtensionWidgetsChange:At,rightSidebarOpen:jt,setRightSidebarOpen:Mt,closedWidgetCount:Nt}=yq({widgetGeometries:S,setWidgetGeometry:C}),Pt=l?St:jt,Ft=(0,d.useCallback)((e,t)=>{ot.current?.insertText(kq(e,t))},[]),It=(0,d.useCallback)(e=>{let t=jq(e);t&&ot.current?.insertText(t)},[]),Lt=(0,d.useCallback)((e,t,n)=>{ot.current?.insertText(Aq(e,t,n))},[]),Rt=n.sessionId;ae({onNewSession:e=>Ce(`kb-${Date.now()}`,e),activeCwd:se});let zt=de&&!P,Bt=[{id:lq,label:s(`tabs.chat`),closable:!1,icon:(0,E.jsx)(`svg`,{width:p.lg,height:p.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,E.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:dq,label:s(`tabs.widgets`),badge:Nt,closable:!1,icon:(0,E.jsxs)(`svg`,{width:p.lg,height:p.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,E.jsx)(`rect`,{x:`3`,y:`3`,width:`7`,height:`7`,rx:`1`}),(0,E.jsx)(`rect`,{x:`14`,y:`3`,width:`7`,height:`7`,rx:`1`}),(0,E.jsx)(`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`}),(0,E.jsx)(`rect`,{x:`14`,y:`14`,width:`7`,height:`7`,rx:`1`})]})},...Le?[{id:uq,label:s(`config.title`),closable:!0,icon:(0,E.jsx)(Wr,{width:p.lg,height:p.lg,"aria-hidden":`true`})}]:[],...He],Vt=se?yG(se)||se:null,Ht=Vt?`Pi Web · ${Vt}`:`Pi Web`;(0,d.useEffect)(()=>{document.title=Ht},[Ht]),(0,d.useEffect)(()=>{let e=()=>{document.title=Ht};return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[Ht]);let Ut=oe(),Wt=(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`div`,{ref:ct,style:{padding:`2px 8px`,flexShrink:0,display:`flex`,justifyContent:`space-between`,gap:4},children:[{label:s(`config.title`),onClick:()=>Ge(),disabled:!1,icon:(0,E.jsx)(Wr,{width:p[`3xl`],height:p[`3xl`],"aria-hidden":`true`})},...Ut===`granted`||Ut==="default"||Ut===`denied`?[{label:s(Ut===`granted`?`notify.permission.grantedHint`:Ut===`denied`?`notify.permission.deniedHint`:`notify.permission.requestHint`),ariaLabel:s(Ut===`granted`?`notify.permission.granted`:Ut===`denied`?`notify.permission.denied`:`notify.permission.request`),onClick:Ut===`granted`?()=>{}:()=>Zt(),disabled:!1,testId:`notify-permission`,color:Ut===`granted`?`var(--status-success)`:Ut===`denied`?`var(--status-error)`:`var(--accent)`,icon:(0,E.jsx)(`svg`,{width:p[`3xl`],height:p[`3xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:Ut===`denied`?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M8.7 3A6 6 0 0 1 18 8a21.3 21.3 0 0 0 .6 5`}),(0,E.jsx)(`path`,{d:`M17 17H3s3-2 3-9a4.67 4.67 0 0 1 .3-1.7`}),(0,E.jsx)(`path`,{d:`M10.3 21a1.94 1.94 0 0 0 3.4 0`}),(0,E.jsx)(`path`,{d:`m2 2 20 20`})]}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9`}),(0,E.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,E.jsxs)(`svg`,{width:p[`3xl`],height:p[`3xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`5`}),(0,E.jsx)(`line`,{x1:`12`,y1:`1`,x2:`12`,y2:`3`}),(0,E.jsx)(`line`,{x1:`12`,y1:`21`,x2:`12`,y2:`23`}),(0,E.jsx)(`line`,{x1:`4.22`,y1:`4.22`,x2:`5.64`,y2:`5.64`}),(0,E.jsx)(`line`,{x1:`18.36`,y1:`18.36`,x2:`19.78`,y2:`19.78`}),(0,E.jsx)(`line`,{x1:`1`,y1:`12`,x2:`3`,y2:`12`}),(0,E.jsx)(`line`,{x1:`21`,y1:`12`,x2:`23`,y2:`12`}),(0,E.jsx)(`line`,{x1:`4.22`,y1:`19.78`,x2:`5.64`,y2:`18.36`}),(0,E.jsx)(`line`,{x1:`18.36`,y1:`5.64`,x2:`19.78`,y2:`4.22`})]}):(0,E.jsx)(`svg`,{width:p[`3xl`],height:p[`3xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,E.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&&Ze(!1),ht(),_t(`language`)},onMouseEnter:()=>{ht(),gt!==`language`&&_t(`language`)},onMouseLeave:pt,disabled:!1,ref:ut,ariaExpanded:gt===`language`,noTooltip:!0,icon:(0,E.jsxs)(`svg`,{width:p[`3xl`],height:p[`3xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,E.jsx)(`line`,{x1:`2`,y1:`12`,x2:`22`,y2:`12`}),(0,E.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&&Ze(!1),ht(),_t(`fontSize`)},onMouseEnter:()=>{ht(),gt!==`fontSize`&&_t(`fontSize`)},onMouseLeave:pt,disabled:!1,ref:dt,ariaExpanded:gt===`fontSize`,noTooltip:!0,icon:(0,E.jsxs)(`svg`,{width:p[`3xl`],height:p[`3xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,E.jsx)(`polyline`,{points:`4 7 4 4 20 4 20 7`}),(0,E.jsx)(`line`,{x1:`9`,y1:`20`,x2:`15`,y2:`20`}),(0,E.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,color:u,ariaLabel:d,testId:f})=>{let p=(0,E.jsx)(`button`,{ref:o,onClick:t,disabled:i,"data-testid":f,"aria-label":d??e,"aria-pressed":s,"aria-haspopup":c===void 0?void 0:`menu`,"aria-expanded":c,style:{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`,height:32,padding:0,background:`none`,border:`none`,borderRadius:9,...u?{color:u}:{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});return l?(0,E.jsx)(`div`,{style:{flex:1,minWidth:0,display:`flex`},children:p},e):(0,E.jsx)(oi,{label:e,wrapperStyle:{flex:1,minWidth:0,display:`flex`},children:p},e)})}),(0,E.jsx)(t9,{selectedSessionId:j?.id??null,selectedSession:j,onSelectSession:Se,onNewSession:Ce,initialSessionId:Rt,skipInitialProjectSelection:n.requestedCwd!==null,onInitialRestoreDone:Pe,refreshKey:F,onSessionDeleted:Oe,selectedCwd:j?.cwd??M,onCwdChange:Ae,savedWorkspaces:b,onSavedWorkspacesChange:x,onOpenFile:We})]});if(!e)return(0,E.jsx)(Nq,{});let Gt=(0,E.jsx)(oi,{label:s(Xe?`sidebar.hide`:`sidebar.show`),children:(0,E.jsx)(`button`,{onClick:xt,"aria-label":s(Xe?`sidebar.hide`:`sidebar.show`),"aria-pressed":Xe,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:V9,height:V9,padding:0,background:`none`,border:`none`,borderRight:`1px solid var(--border)`,color:Xe?`var(--text)`:`var(--text-muted)`,cursor:`pointer`,flexShrink:0,transition:`color 0.12s`,"--hover-color":`var(--text)`},className:`hover-shift`,children:(0,E.jsxs)(`svg`,{width:p[`4xl`],height:p[`4xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,E.jsx)(`rect`,{x:`3`,y:`3`,width:p[`4xl`],height:p[`4xl`],rx:`2`}),(0,E.jsx)(`line`,{x1:`9`,y1:`3`,x2:`9`,y2:`21`})]})})}),Kt=P&&me?.requiresTrust&&!me.trusted?(0,E.jsx)(oi,{label:s(`trust.resourcesNotLoaded`),wrapperStyle:{height:`100%`},children:(0,E.jsxs)(`button`,{type:`button`,onClick:()=>{be(null),_e(!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,E.jsxs)(`svg`,{width:p.lg,height:p.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,E.jsx)(`path`,{d:`M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10Z`}),(0,E.jsx)(`path`,{d:`M12 8v4`}),(0,E.jsx)(`path`,{d:`M12 16h.01`})]}),!l&&(0,E.jsx)(`span`,{children:s(`trust.resourcesNotLoaded`)})]})}):null,qt=(0,E.jsx)(oi,{label:s(Pt?`sidebar.hide`:`sidebar.show`),children:(0,E.jsx)(`button`,{onClick:()=>{l?Ct(e=>!e):Mt(e=>!e)},"aria-controls":`widget-panel`,"aria-expanded":Pt,"aria-label":s(Pt?`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:St?`var(--text)`:`var(--text-muted)`,cursor:`pointer`,flexShrink:0,transition:`color 0.12s`,"--hover-color":`var(--text)`},className:`hover-shift`,children:(0,E.jsxs)(`svg`,{width:p[`4xl`],height:p[`4xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,E.jsx)(`rect`,{x:`3`,y:`3`,width:p[`4xl`],height:p[`4xl`],rx:`2`}),(0,E.jsx)(`line`,{x1:`15`,y1:`3`,x2:`15`,y2:`21`})]})})});return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(he,{value:u,children:(0,E.jsx)(je,{value:{activeTopPanel:gt,toggleTopPanel:bt,closeTopPanel:()=>_t(null)},children:(0,E.jsx)(E.Fragment,{children:(0,E.jsxs)(ai,{delayDuration:0,children:[(0,E.jsx)(`style`,{children:`
485
+ `)?r===`mermaid`?(0,E.jsx)(q6,{code:i.replace(/\n$/,``),defaultPreview:!0}):(0,E.jsx)(Z6,{code:i.replace(/\n$/,``),lang:r}):(0,E.jsx)(`code`,{className:e,...n,children:t})},pre({children:e}){return(0,E.jsx)(E.Fragment,{children:e})},a({href:e,children:t,...n}){return delete n.node,(0,E.jsx)(WG,{href:e,markdownDir:we,onOpenFile:r,...n,children:t})},img({src:e,alt:r,...i}){delete i.node;let a=typeof e==`string`?HG(e,we,t??we):null,o=a?p7(a,`read`,n):e;return(0,E.jsx)(`img`,{src:o,alt:r??``,loading:`lazy`,...i})}},children:fe})}):null]})]})}function E7({cwd:e,busy:t,error:n,onCancel:r,onConfirm:i}){let{t:a}=N();return(0,E.jsx)(Ax,{open:!0,onOpenChange:e=>{!e&&!t&&r()},children:(0,E.jsxs)(Px,{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,E.jsxs)(`div`,{style:{display:`flex`,gap:12,padding:`18px 18px 14px`},children:[(0,E.jsxs)(`svg`,{width:p[`5xl`],height:p[`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,E.jsx)(`path`,{d:`M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10Z`}),(0,E.jsx)(`path`,{d:`m9 12 2 2 4-4`})]}),(0,E.jsxs)(`div`,{style:{minWidth:0},children:[(0,E.jsx)(Fx,{style:{fontSize:`var(--text-2xl)`,fontWeight:700,color:`var(--text)`,lineHeight:1.4},children:a(`trust.dialogTitle`)}),(0,E.jsx)(Ix,{style:{marginTop:7,fontSize:`var(--text-base)`,lineHeight:1.6,color:`var(--text-muted)`},children:a(`trust.dialogBody`)}),(0,E.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,E.jsx)(`div`,{role:`alert`,style:{marginTop:10,color:`var(--status-error)`,fontSize:`var(--text-base)`,lineHeight:1.5},children:n})]})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8,padding:`10px 18px`,borderTop:`1px solid var(--border)`},children:[(0,E.jsx)(kx,{type:`button`,variant:`outline`,onClick:r,disabled:t,className:`h-8 px-3 text-xs`,children:a(`trust.cancel`)}),(0,E.jsx)(kx,{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 D7({onCancel:e,onSelect:t,busy:n=!1,error:r}){let{t:i}=N(),[a,o]=(0,d.useState)(!0),[s,c]=(0,d.useState)(``),[l,u]=(0,d.useState)(null),[f,m]=(0,d.useState)(``),[h,g]=(0,d.useState)([]),[_,v]=(0,d.useState)(null),[y,b]=(0,d.useState)(``),[x,S]=(0,d.useState)(null),[C,w]=(0,d.useState)(!0),T=(0,d.useRef)(null),D=(0,d.useCallback)(async e=>{w(!0),S(null);try{let t=await wG(e),n=t.path??e??`/`;c(n),u(t.parentPath??null),m(n),g(t.directories??[]),v(t.drives??null),b(``)}catch(e){S(e instanceof Error?e.message:String(e))}finally{w(!1)}},[]);(0,d.useEffect)(()=>{D()},[D]);let O=e=>{e.preventDefault();let t=f.trim();t&&D(t)},k=f.trim()!==s,A=!!s&&!k&&!n,j=!!l||OG(s),M=y.trim().toLowerCase(),P=e=>!M||e.toLowerCase().includes(M),ee=_===null?[]:_.filter(e=>P(e.name)||P(e.path)),F=h.filter(e=>P(e.name));return(0,E.jsx)(Ax,{open:a,onOpenChange:t=>{!t&&!n&&(o(!1),e())},children:(0,E.jsxs)(Px,{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(),T.current?.focus()},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,flexShrink:0,padding:`12px 18px`,borderBottom:`1px solid var(--border)`},children:[(0,E.jsx)(Fx,{style:{fontWeight:700,fontSize:`var(--text-2xl)`,color:`var(--text)`},children:i(`directoryPicker.selectDirectory`)}),(0,E.jsx)(Mx,{asChild:!0,children:(0,E.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,E.jsxs)(`form`,{onSubmit:O,style:{display:`flex`,alignItems:`center`,gap:8,flexShrink:0,padding:`10px 14px`,borderBottom:`1px solid var(--border)`},children:[(0,E.jsx)(`button`,{className:`directory-picker-back`,type:`button`,onClick:()=>void D(l??void 0),disabled:C||!j,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:j?`pointer`:`default`,opacity:j?1:.45},children:(0,E.jsx)(`svg`,{width:p[`3xl`],height:p[`3xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,E.jsx)(`path`,{d:`m18 15-6-6-6 6`})})}),(0,E.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,E.jsx)(CG,{className:`directory-picker-path h-9 flex-1 font-mono text-xs`,id:`directory-path`,type:`text`,ref:T,value:f,placeholder:`/path/to/project or ~/project`,autoComplete:`off`,spellCheck:!1,style:TG,onChange:e=>{m(e.target.value),S(null)}}),(0,E.jsx)(`button`,{className:`directory-picker-action`,type:`submit`,disabled:C||!f.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:C||!f.trim()?`default`:`pointer`,opacity:C||!f.trim()?.6:1},children:i(`directoryPicker.go`)})]}),(0,E.jsxs)(`div`,{className:`directory-picker-list`,style:{flex:1,minHeight:0,overflow:`auto`,padding:`8px 10px`},children:[C?(0,E.jsx)(`div`,{style:{padding:8,color:`var(--text-dim)`,fontSize:`var(--text-sm)`},children:i(`directoryPicker.loadingDirectories`)}):_===null?F.length>0?F.map(e=>(0,E.jsxs)(`button`,{className:`directory-picker-entry`,type:`button`,onClick:()=>void D(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,E.jsx)(EG,{}),(0,E.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.name})]},e.path)):(0,E.jsx)(`div`,{style:{padding:8,color:`var(--text-dim)`,fontSize:`var(--text-sm)`},children:i(M?`directoryPicker.noMatches`:`directoryPicker.noSubdirectories`)}):ee.length>0?ee.map(e=>(0,E.jsxs)(`button`,{className:`directory-picker-entry`,type:`button`,onClick:()=>void D(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,E.jsx)(DG,{}),(0,E.jsx)(`span`,{children:e.name})]},e.path)):(0,E.jsx)(`div`,{style:{padding:8,color:`var(--text-dim)`,fontSize:`var(--text-sm)`},children:i(M?`directoryPicker.noMatches`:`directoryPicker.noDrives`)}),(x||r)&&(0,E.jsx)(`div`,{style:{padding:`8px`,color:`var(--status-error)`,fontSize:`var(--text-sm)`},children:x??r})]}),(0,E.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,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,flex:1,minWidth:0},children:[(0,E.jsxs)(`svg`,{width:p.lg,height:p.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,E.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,E.jsx)(`path`,{d:`m21 21-4.3-4.3`})]}),(0,E.jsx)(CG,{className:`directory-picker-search h-8 flex-1`,type:`text`,value:y,placeholder:i(`directoryPicker.search`),"aria-label":i(`directoryPicker.search`),autoComplete:`off`,spellCheck:!1,style:TG,onChange:e=>b(e.target.value)})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,flexShrink:0},children:[(0,E.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,E.jsx)(`button`,{className:`directory-picker-action`,type:`button`,onClick:()=>t(s),disabled:!A,title:i(k?`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:A?1:.6,cursor:A?`pointer`:`default`},children:i(n?`i18n.checking`:`directoryPicker.selectThisFolder`)})]})]})]})})}function O7({visible:e=!0,gap:t=4,items:n}){return e?(0,E.jsx)(`div`,{style:{display:`flex`,gap:t,flexShrink:0},children:n.map(e=>(0,E.jsx)(oi,{label:e.title,children:(0,E.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 k7=2;function A7({scrollStepPx:e=200,wrapperStyle:t,children:n,testId:r,hintTestId:i}){let a=(0,d.useRef)(null),[o,s]=(0,d.useState)({scrollHeight:0,clientHeight:0,scrollTop:0}),c=()=>{if(document.hidden)return;let e=a.current;e&&s({scrollHeight:e.scrollHeight,clientHeight:e.clientHeight,scrollTop:e.scrollTop})};(0,d.useLayoutEffect)(()=>{c();let e=a.current;if(!e)return;let t=new ResizeObserver(c);return t.observe(e),()=>t.disconnect()},[]);let{scrollHeight:l,clientHeight:u,scrollTop:f}=o,p=l-u>20,m=f<=k7,h=f+u>=l-k7,g=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`})},_=e=>{let t=a.current;t&&t.scrollTo({top:e===`top`?0:Math.max(0,t.scrollHeight-t.clientHeight),behavior:`smooth`})};return(0,E.jsxs)(`div`,{style:{position:`relative`,...t},children:[(0,E.jsx)(`div`,{ref:a,"data-testid":r,onScroll:c,style:{position:`absolute`,inset:0,overflowY:`auto`,overflowX:`hidden`,padding:0},children:n}),p&&!m&&(0,E.jsx)(Bn,{direction:`up`,visible:!0,testId:i?`${i}-scroll-up`:void 0,onHover:()=>g(-1),onClick:()=>_(`top`)}),p&&!h&&(0,E.jsx)(Bn,{direction:`down`,visible:!0,testId:i?`${i}-scroll-down`:void 0,onHover:()=>g(1),onClick:()=>_(`bottom`)})]})}function j7({...e}){return(0,E.jsx)(fo,{"data-slot":`collapsible`,...e})}function M7({...e}){return(0,E.jsx)(oo,{"data-slot":`collapsible-trigger`,...e})}function N7({...e}){return(0,E.jsx)(co,{"data-slot":`collapsible-content`,...e})}function P7({title:e,titleTooltip:t,open:n,onToggle:r,collapsible:i=!0,actions:a,expandedFlex:o=`1 1 0`,style:s,children:c}){return(0,E.jsxs)(j7,{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,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,flexShrink:0,background:`var(--bg-panel)`},children:[(0,E.jsx)(oi,{label:t??e,children:(0,E.jsx)(M7,{asChild:!0,children:(0,E.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,E.jsx)(`svg`,{width:p.xs,height:p.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,E.jsx)(`polyline`,{points:`3 2 7 5 3 8`})}),(0,E.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e})]})})}),a&&(0,E.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,marginLeft:`auto`,minWidth:0,gap:6,flexShrink:1,paddingRight:4},children:a})]}),(0,E.jsx)(N7,{style:{display:`flex`,flexDirection:`column`,minHeight:0,flex:1},children:c})]})}function F7({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,E.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,E.jsxs)(P7,{title:e,titleTooltip:t,open:n,onToggle:r,collapsible:i,actions:a,expandedFlex:s,style:{borderTop:`none`},children:[o,(0,E.jsx)(A7,{scrollStepPx:c,wrapperStyle:{flex:1,minHeight:0,...f},testId:l,hintTestId:u,children:m})]})})}function I7(e){return e.error?e.path.split(/[\\/]/).pop()||e.id:e.name||e.firstMessage.slice(0,50)||e.id.slice(0,12)}var L7=(e,t)=>e.replace(/\\/g,`/`)===t.replace(/\\/g,`/`),R7=e=>e.replace(/\\/g,`/`).replace(/\/+$/,``).replace(/^[a-zA-Z]:/,e=>e.toLowerCase()),z7=`pi-web:unread-session-ids`;function B7(){if(typeof window>`u`)return new Set;try{let e=window.localStorage.getItem(z7);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 V7(e){if(!(typeof window>`u`))try{e.size===0?window.localStorage.removeItem(z7):window.localStorage.setItem(z7,JSON.stringify([...e]))}catch{}}function H7(){let[e,t]=(0,d.useState)(()=>B7());return(0,d.useEffect)(()=>{V7(e)},[e]),{unreadSessionIds:e,setUnreadSessionIds:t}}function U7(e){let{selectedCwd:t,selectedCwdProp:n,refreshKey:r,setSelectedCwd:i}=e,[a,o]=(0,d.useState)(null),[s,c]=(0,d.useState)(!1),[l,u]=(0,d.useState)(!1),[f,p]=(0,d.useState)(``),[m,h]=(0,d.useState)(null),[g,_]=(0,d.useState)(!1),[v,y]=(0,d.useState)(null),[b,x]=(0,d.useState)(null),[S,C]=(0,d.useState)(``),w=(0,d.useRef)(null),T=(0,d.useRef)(null),E=(0,d.useRef)(null);(0,d.useEffect)(()=>{n&&n!==E.current&&(E.current=n,i(n))},[n,i]);let D=(0,d.useCallback)(()=>{c(!1),u(!1),p(``),h(null),y(null),C(``)},[]),[O,k]=(0,d.useState)(0);(0,d.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,d.useCallback)(async()=>{let e=f.trim();if(!(!e||g||!a)){_(!0),h(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){h(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){h(e instanceof Error?e.message:String(e))}finally{_(!1)}}},[D,f,g,a,i]),j=(0,d.useCallback)(async(e,n)=>{if(!(!a||g)){_(!0),h(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}h(o.error??`HTTP ${r.status}`);return}D(),t&&e&&L7(t,e)&&i(a.projectRoot),k(e=>e+1)}catch(e){h(e instanceof Error?e.message:String(e))}finally{_(!1)}}},[D,a,g,t,i]);return(0,d.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:f,setWtNewBranch:p,wtError:m,setWtError:h,wtBusy:g,wtConfirmRemove:v,setWtConfirmRemove:y,wtFilter:S,setWtFilter:C,wtDropdownRef:w,wtNewInputRef:T,closeWorktrees:D,handleCreateWorktree:A,handleRemoveWorktree:j}}function W7({wt:e,selectedCwd:t,homeDir:n,setSelectedCwd:r}){let{t:i}=N(),{worktreeState:a,wtFilter:o,setWtFilter:s,wtDropdownOpen:c,setWtDropdownOpen:l,wtDropdownRef:u,closeWorktrees:d,handleRemoveWorktree:f,wtConfirmRemove:m,setWtConfirmRemove:h,wtBusy:g,wtNewOpen:_,setWtNewOpen:v,wtNewBranch:y,setWtNewBranch:b,wtNewInputRef:x,handleCreateWorktree:S,wtError:C,setWtError:w}=e;if(!a)return null;let T=a.worktrees.find(e=>L7(e.path,t))??a.worktrees.find(e=>e.isMain),D=a.worktrees.length>=8,O=D&&o.trim()?a.worktrees.filter(e=>(e.branch??q7(e.path,n)).toLowerCase().includes(o.trim().toLowerCase())):a.worktrees;return(0,E.jsxs)(`div`,{ref:u,style:{position:`relative`,marginTop:6},children:[(0,E.jsxs)(`button`,{onClick:()=>l(e=>!e),title:T?i(`sidebar.switchWorktreeTitle`,{path:T.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,E.jsxs)(`svg`,{width:p.sm,height:p.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0,color:T&&!T.isMain?`var(--accent)`:`var(--text-dim)`},children:[(0,E.jsx)(`line`,{x1:`6`,y1:`3`,x2:`6`,y2:`15`}),(0,E.jsx)(`circle`,{cx:`18`,cy:`6`,r:`3`}),(0,E.jsx)(`circle`,{cx:`6`,cy:`18`,r:`3`}),(0,E.jsx)(`path`,{d:`M18 9a9 9 0 0 1-9 9`})]}),(0,E.jsx)(Y7,{text:T?T.branch??q7(T.path,n):`…`,style:{flex:1,fontFamily:`var(--font-mono)`,color:`var(--text)`}}),T?.isMain&&(0,E.jsx)(`span`,{style:{flexShrink:0,color:`var(--text-dim)`,fontSize:`var(--text-xs)`},children:i(`sidebar.main`)}),a.worktrees.length>1&&(0,E.jsx)(`span`,{style:{flexShrink:0,color:`var(--text-dim)`,fontSize:`var(--text-xs)`},children:a.worktrees.length}),(0,E.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,E.jsx)(`polyline`,{points:`2 3.5 5 6.5 8 3.5`})})]}),(0,E.jsxs)($7,{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:[D&&(0,E.jsx)(`div`,{style:{padding:`6px 8px`,borderBottom:`1px solid var(--border)`},children:(0,E.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,E.jsxs)(`div`,{style:{maxHeight:`min(40vh, 300px)`,overflowY:`auto`},children:[O.map(e=>{let o=L7(e.path,t)||e.isMain&&!a.worktrees.some(e=>L7(e.path,t));return m===e.path?(0,E.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,E.jsx)(`span`,{style:{flex:1,fontSize:`var(--text-sm)`,color:`var(--text)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:i(`sidebar.forceRemoveCheckout`)}),(0,E.jsx)(`button`,{onClick:()=>void f(e.path,!0),disabled:g,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,E.jsx)(`button`,{onClick:()=>h(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,E.jsxs)(`div`,{className:`wt-row`,style:{display:`flex`,alignItems:`center`,borderBottom:`1px solid var(--border)`},children:[(0,E.jsxs)(`button`,{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,E.jsx)(`svg`,{width:p.xs,height:p.xs,viewBox:`0 0 10 10`,fill:`none`,stroke:`var(--accent)`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0},children:(0,E.jsx)(`polyline`,{points:`1.5 5 4 7.5 8.5 2.5`})}):(0,E.jsx)(`span`,{style:{width:10,flexShrink:0}}),(0,E.jsx)(Y7,{text:e.branch??q7(e.path,n),style:{flex:1}}),e.isMain&&(0,E.jsx)(`span`,{style:{flexShrink:0,color:`var(--text-dim)`,fontSize:`var(--text-xs)`},children:i(`sidebar.main`)})]}),!e.isMain&&(0,E.jsx)(`button`,{onClick:()=>void f(e.path,!1),disabled:g,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,E.jsxs)(`svg`,{width:p.base,height:p.base,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,E.jsx)(`polyline`,{points:`3 6 5 6 21 6`}),(0,E.jsx)(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),(0,E.jsx)(`path`,{d:`M10 11v6M14 11v6`}),(0,E.jsx)(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})]})})]},e.path)}),D&&O.length===0&&o.trim()&&(0,E.jsx)(`div`,{style:{padding:`8px 10px`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:i(`sidebar.noMatchingWorktrees`)})]}),_?(0,E.jsxs)(`div`,{style:{padding:`6px 8px`},children:[(0,E.jsx)(`input`,{ref:x,value:y,onChange:e=>{b(e.target.value),w(null)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),S()),e.key===`Escape`&&(v(!1),b(``),w(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,E.jsxs)(`div`,{style:{display:`flex`,gap:5,marginTop:5},children:[(0,E.jsx)(`button`,{onClick:()=>void S(),disabled:g||!y.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:g||!y.trim()?`not-allowed`:`pointer`,opacity:g||!y.trim()?.65:1},children:i(g?`sidebar.creating`:`sidebar.create`)}),(0,E.jsx)(`button`,{onClick:()=>{v(!1),b(``),w(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,E.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),v(!0),w(null),setTimeout(()=>x.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,E.jsxs)(`svg`,{width:p.xs,height:p.xs,viewBox:`0 0 10 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.1`,strokeLinecap:`round`,style:{flexShrink:0},children:[(0,E.jsx)(`line`,{x1:`5`,y1:`1`,x2:`5`,y2:`9`}),(0,E.jsx)(`line`,{x1:`1`,y1:`5`,x2:`9`,y2:`5`})]}),(0,E.jsx)(`span`,{children:i(`sidebar.newWorktree`)})]}),C&&(0,E.jsx)(`div`,{style:{padding:`5px 10px 8px`,color:`var(--status-error)`,fontSize:`var(--text-sm)`,lineHeight:1.35,overflowWrap:`anywhere`},children:C})]})]})}function G7(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 K7(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 q7(e,t){return t&&e.startsWith(t)?`~${e.slice(t.length)}`:e}function J7(e){let t=e.split(/[\\/]+/).filter(Boolean);return t.length?t[t.length-1]:e}function Y7({text:e,style:t}){return(0,E.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,display:`block`,minWidth:0,lineHeight:1.35,direction:`rtl`,textAlign:`left`,...t},children:(0,E.jsx)(`span`,{style:{unicodeBidi:`plaintext`},children:e})})}function X7({session:e}){return(0,E.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,E.jsxs)(`svg`,{width:p.xs,height:p.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,E.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,E.jsx)(`path`,{d:`M12 9v4`}),(0,E.jsx)(`path`,{d:`M12 17h.01`})]}),e.error]})}var Z7=140,Q7=2e3;function $7({open:e,children:t,style:n}){let[r,i]=(0,d.useState)(e),[a,o]=(0,d.useState)(e);return(0,d.useEffect)(()=>{let t,n;return e?(i(!0),o(!1),t=window.requestAnimationFrame(()=>{t=window.requestAnimationFrame(()=>o(!0))})):(o(!1),n=setTimeout(()=>i(!1),Z7)),()=>{t!==void 0&&window.cancelAnimationFrame(t),n&&clearTimeout(n)}},[e]),r?(0,E.jsx)(`div`,{style:{...n,opacity:+!!a,transform:a?`translateY(0) scale(1)`:`translateY(-8px) scale(0.96)`,transformOrigin:`top center`,transition:`opacity ${Z7}ms ease, transform ${Z7}ms ease`,pointerEvents:e?`auto`:`none`},children:t}):null}function e9(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 t9({selectedSessionId:e,selectedSession:t,onSelectSession:n,onNewSession:r,initialSessionId:i,skipInitialProjectSelection:a,onInitialRestoreDone:o,refreshKey:s,onSessionDeleted:c,onUnseenSession:l,selectedCwd:u,onCwdChange:f,savedWorkspaces:m,onSavedWorkspacesChange:h,onOpenFile:g}){let{t:_}=N(),[v,y]=(0,d.useState)([]),[b,x]=(0,d.useState)(!0),[S,C]=(0,d.useState)(null),[w,T]=(0,d.useState)(null),[D,O]=(0,d.useState)(``),[k,A]=(0,d.useState)(!1),[j,M]=(0,d.useState)(``),[P,ee]=(0,d.useState)(null),[F,te]=(0,d.useState)(!1),ne=U7({selectedCwd:w,selectedCwdProp:u,refreshKey:s,setSelectedCwd:T}),{worktreeState:re,worktreeLoadingCwd:ie}=ne,[ae,oe]=(0,d.useState)(!1),[I,L]=(0,d.useState)(``),se=(0,d.useRef)(null);(0,d.useEffect)(()=>{ae&&se.current?.focus()},[ae]);let[R,ce]=(0,d.useState)(!1),[le,ue]=(0,d.useState)(()=>new Set),de=(0,d.useCallback)(e=>{ue(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})},[]),fe=(0,d.useCallback)(e=>{ue(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n}),Pt(e),l?.(e)},[l]),{unreadSessionIds:pe,setUnreadSessionIds:me}=H7(),he=Jq(),{runningSessionIds:ge,runningPhases:_e,runningPhaseSince:ve,runningBusySince:ye,setRunningSessionIds:be,runningPollAuthoritativeRef:Se}=Kt(),Ce=(0,d.useRef)(new Set),we=(0,d.useRef)(null),Te=(0,d.useRef)(0),Ee=(0,d.useCallback)(async(e=!1,t=!1)=>{try{e&&x(!0);let n=t?await xe.refresh():await xe.load();y(n.sessions),Se.current||be(new Set(n.runningSessionIds??[]));let r=new Set(n.sessions.map(e=>e.id));me(e=>{if(e.size===0)return e;let t=new Set([...e].filter(e=>r.has(e)));return t.size===e.size?e:t}),C(null),e||(ce(!0),we.current&&clearTimeout(we.current),we.current=setTimeout(()=>ce(!1),2e3))}catch(e){C(String(e))}finally{e&&x(!1)}},[me,be,Se]),De=(0,d.useRef)(!1);(0,d.useEffect)(()=>{let e=!De.current;De.current=!0,Ee(e,e)},[Ee,s]),(0,d.useEffect)(()=>{V7(pe)},[pe]),(0,d.useEffect)(()=>{let t=[...Ce.current].filter(t=>!ge.has(t)&&t!==e),n=[...ge];if((t.length>0||n.length>0)&&me(e=>{let r=new Set(e);return n.forEach(e=>r.delete(e)),t.forEach(e=>r.add(e)),r}),t.length>0&&Ee(!1),[...ge].filter(e=>!v.some(t=>t.id===e)).length>0){let e=Date.now();e-Te.current>=Q7&&(Te.current=e,Ee(!1,!0))}Ce.current=ge},[ge,e,v,Ee,me]),(0,d.useEffect)(()=>{e&&(Gq(e),me(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n}))},[e,me]),(0,d.useEffect)(()=>{fetch(`/api/home`).then(e=>e.json()).then(e=>{e.home&&O(e.home)}).catch(()=>{})},[]);let Oe=(0,d.useRef)(!1),ke=(0,d.useCallback)(e=>e?re&&re.forCwd&&L7(re.forCwd,e)||re?.worktrees.some(t=>L7(t.path,e))?re.projectRoot:v.find(t=>t.cwd&&L7(t.cwd,e))?.projectRoot??e:null,[re,v]),Ae=(0,d.useRef)(null);(0,d.useEffect)(()=>{Ae.current!==w&&(Ae.current=w,f?.(w,ke(w)))},[w,f,ke]),(0,d.useEffect)(()=>{if(!(v.length===0||a)&&w===null){if(i&&!Oe.current){Oe.current=!0;let e=v.find(e=>e.id===i);if(e){T(e.cwd),de(e.id),n(e,!0);return}o?.()}let e=K7(v);e.length>0&&T(e[0])}},[v,w,i,a,n,o,de]);let je=(0,d.useCallback)(async e=>{let t=(e??j).trim();if(!(!t||F)){te(!0),ee(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){ee(n.error??`HTTP ${e.status}`);return}let r=n.cwd??t;if(T(r),A(!1),M(``),h){let e=m??[];e.some(e=>R7(e)===R7(r))||h([...e,r])}}catch(e){ee(e instanceof Error?e.message:String(e))}finally{te(!1)}}},[j,F,m,h]),Me=(0,d.useCallback)(async e=>{try{if((await fetch(`/api/sessions/${encodeURIComponent(e.id)}`,{method:`HEAD`})).status===404){C(_(`sidebar.sessionDeleted`)),Ee(!1,!0);return}}catch{}e.cwd&&T(e.cwd),de(e.id),n(e)},[n,_,Ee,de]),Ne=(0,d.useCallback)(e=>{let t=e??w;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)},[w,r]),[Pe,Fe]=(0,d.useState)({}),[Ie,Le]=(0,d.useState)(null),[Re,ze]=(0,d.useState)(null),[Be,Ve]=(0,d.useState)(!1),He=ke(w),Ue=v,We=!!(re?.isGit&&re.isTopLevel&&w&&He===re.projectRoot),Ge=(w&&re&&He===re.projectRoot&&!We?re.isGit?{label:_(`sidebar.openRepoRoot`),title:_(`sidebar.openRepoRootTitle`)}:{label:_(`sidebar.gitRepoRootOnly`),title:_(`sidebar.gitRepoRootOnlyTitle`)}:null)??(w&&ie===w&&!We?{label:_(`sidebar.worktrees`),title:_(`sidebar.checkingWorktrees`)}:null),Ke=(0,d.useCallback)(async e=>{ze(null),Ve(!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=m??[];h&&t.some(t=>R7(t)===R7(e.root))&&h(t.filter(t=>R7(t)!==R7(e.root))),Ee(!1,!0)}finally{Ve(!1)}},[c,Ee,m,h]),qe=(0,d.useMemo)(()=>{let e=t&&!Ue.some(e=>e.id===t.id)?[{...t,projectRoot:t.projectRoot??ke(t.cwd)??void 0},...Ue]:Ue,n=new Map,r=new Map;for(let t of e){let e=t.projectRoot??t.cwd??`unknown`,i=e===`unknown`?e:R7(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(w){let e=ke(w);e&&!n.has(R7(e))&&a.push({root:e,sessions:[]})}let o=new Set([...n.keys()]);for(let e of a)o.add(R7(e.root));let s=[];for(let e of m??[]){let t=R7(e);o.has(t)||(o.add(t),s.push({root:e,sessions:[]}))}return[...a,...i,...s]},[Ue,w,ke,t,m]),Je=I.trim().toLowerCase(),Ye=(0,d.useMemo)(()=>Je?qe.map(e=>({...e,sessions:e.sessions.filter(e=>I7(e).toLowerCase().includes(Je))})).filter(e=>e.sessions.length>0):qe,[qe,Je]);return(0,E.jsxs)(`div`,{"data-testid":`session-sidebar`,style:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`hidden`},children:[k&&(0,E.jsx)(D7,{busy:F,error:P,onCancel:()=>{A(!1),ee(null)},onSelect:e=>void je(e)}),(0,E.jsxs)(F7,{title:_(`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,E.jsx)(O7,{items:[{key:`search`,testId:`workspace-search-toggle`,onClick:()=>{ae&&L(``),oe(e=>!e)},title:_(`sidebar.searchSessions`),ariaPressed:ae,color:ae?`var(--accent)`:`var(--text-muted)`,background:ae?`var(--bg-selected)`:void 0,icon:(0,E.jsx)(Hr,{size:p.lg})},{key:`new-workspace`,testId:`new-workspace`,onClick:()=>A(!0),title:_(`sidebar.newWorkspace`),color:`var(--text-muted)`,icon:(0,E.jsx)(xr,{size:p.xl})},{key:`refresh`,testId:`session-refresh`,onClick:()=>Ee(!1,!0),title:_(`sidebar.refresh`),skipHover:R,color:R?`var(--status-success)`:`var(--text-muted)`,background:R?`color-mix(in srgb, var(--status-success) 18%, transparent)`:void 0,icon:R?(0,E.jsx)(ur,{size:p.xl,color:`var(--status-success)`,strokeWidth:2.5}):(0,E.jsx)(Rr,{size:p.xl})}]}),headerExtra:(0,E.jsxs)(E.Fragment,{children:[ae&&(0,E.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,E.jsx)(Hr,{size:p.lg,color:`var(--text-muted)`,style:{flexShrink:0}}),(0,E.jsx)(`input`,{ref:se,value:I,onChange:e=>L(e.target.value),placeholder:_(`sidebar.searchSessionsPlaceholder`),"aria-label":_(`sidebar.searchSessions`),style:{flex:1,minWidth:0,background:`transparent`,border:`none`,outline:`none`,color:`var(--text)`,fontSize:`var(--text-sm)`}}),I&&(0,E.jsx)(`button`,{type:`button`,onClick:()=>{L(``),se.current?.focus()},"aria-label":_(`chat.clearSearch`),style:{border:`none`,background:`transparent`,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-sm)`,flexShrink:0,padding:0},children:`✕`})]}),We&&(0,E.jsx)(W7,{wt:ne,selectedCwd:w,homeDir:D,setSelectedCwd:T}),Ge&&(0,E.jsxs)(`button`,{type:`button`,"aria-disabled":`true`,tabIndex:-1,title:Ge.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,E.jsxs)(`svg`,{width:p.sm,height:p.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0},children:[(0,E.jsx)(`line`,{x1:`6`,y1:`3`,x2:`6`,y2:`15`}),(0,E.jsx)(`circle`,{cx:`18`,cy:`6`,r:`3`}),(0,E.jsx)(`circle`,{cx:`6`,cy:`18`,r:`3`}),(0,E.jsx)(`path`,{d:`M18 9a9 9 0 0 1-9 9`})]}),(0,E.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`},children:Ge.label})]})]}),children:[b&&(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`16px 14px`,color:`var(--text-muted)`,fontSize:`var(--text-base)`},children:[(0,E.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}}),_(`sidebar.loading`)]}),S&&(0,E.jsx)(`div`,{style:{padding:`12px 14px`,color:`var(--status-error)`,fontSize:`var(--text-base)`},children:S}),!b&&!S&&Je&&Ye.length===0&&(0,E.jsx)(`div`,{style:{padding:`16px 14px`,color:`var(--text-muted)`,fontSize:`var(--text-base)`},children:_(`sidebar.searchSessionsNoResults`)}),Ye.map(t=>{let n=t.sessions.some(t=>t.id===e)||t.root===He;return(0,E.jsxs)(`div`,{children:[(0,E.jsx)(n9,{group:t,groupSelected:n,hoveredGroup:Ie,confirmDeleteGroup:Re,deletingGroup:Be,runningSessionIds:ge,interactionBadges:he,collapsed:!!Pe[t.root],setHoveredGroup:Le,setGroupCollapsed:Fe,setConfirmDeleteGroup:ze,handleDeleteGroup:Ke,handleNewSession:Ne,copyText:bY}),(Je||!Pe[t.root])&&(t.sessions.length===0?(0,E.jsx)(`div`,{style:{padding:`10px 14px`,color:`var(--text-muted)`,fontSize:`var(--text-sm)`},children:_(`sidebar.noSessions`)}):e9(t.sessions).map(t=>(0,E.jsx)(r9,{node:t,selectedSessionId:e,runningSessionIds:ge,runningPhases:_e,runningPhaseSince:ve,runningBusySince:ye,unreadSessionIds:pe,seenSessionIds:le,interactionBadges:he,onSelectSession:Me,onRenamed:()=>Ee(!1,!0),onSessionDeleted:e=>{c?.(e),Ee(!1,!0)},onUnseen:fe,depth:0},t.session.id)))]},t.root)})]})]})}function n9({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:m}){let{t:h}=N(),g=e.sessions.some(e=>a.has(e.id)),_=e.sessions.some(e=>o.has(e.id));return(0,E.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,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`span`,{style:{flex:1,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:h(`sidebar.deleteWorkspace`,{count:e.sessions.length})}),(0,E.jsxs)(`div`,{style:{display:`flex`,gap:5,flexShrink:0},children:[(0,E.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:h(`sidebar.delete`)}),(0,E.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:h(`sidebar.cancel`)})]})]}):(0,E.jsx)(E.Fragment,{children:(0,E.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:_&&s?`linear-gradient(180deg, transparent calc(100% - 25px), color-mix(in srgb, var(--border) 25%, transparent) 100%)`:g&&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:g&&s&&!_?`200% 100%, auto`:void 0,animation:_&&s?`interaction-bg-blink 1s ease-in-out infinite`:g&&s?`pi-status-shine 1.5s linear infinite`:void 0,boxShadow:`0 2px 8px var(--shadow-color)`,margin:`0 -2px`},children:[(0,E.jsxs)(`span`,{style:{position:`relative`,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:30,height:22,flexShrink:0},children:[(0,E.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,E.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,E.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,E.jsx)(oi,{label:e.root,wrapperStyle:{flex:1,minWidth:0,overflow:`hidden`},children:(0,E.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,maxWidth:`100%`,lineHeight:`20px`},children:J7(e.root)})}),n===e.root&&(0,E.jsx)(O7,{items:[{key:`new-session`,onClick:t=>{t.stopPropagation(),f(e.root)},title:h(`sidebar.newSessionTitle`,{path:e.root}),icon:(0,E.jsx)(Ir,{size:p.base})},{key:`copy-path`,onClick:t=>{t.stopPropagation(),m(e.root)},title:h(`sidebar.copyPath`),icon:(0,E.jsx)(hr,{size:p.base})},{key:`delete-workspace`,onClick:t=>{t.stopPropagation(),u(e.root)},title:h(`sidebar.deleteWorkspaceTitle`),danger:!0,icon:(0,E.jsx)(Xr,{size:p.base})}]})]})})})}function r9({node:e,selectedSessionId:t,runningSessionIds:n,runningPhases:r,runningPhaseSince:i,runningBusySince:a,unreadSessionIds:o,seenSessionIds:s,interactionBadges:c,onSelectSession:l,onRenamed:u,onSessionDeleted:f,onUnseen:p,depth:m}){let[h,g]=(0,d.useState)(!1),_=e.children.length>0;return(0,E.jsxs)(`div`,{style:{paddingBottom:1,backgroundImage:`linear-gradient(90deg, transparent, var(--border), transparent)`,backgroundPosition:`0 100%`,backgroundSize:`100% 1px`,backgroundRepeat:`no-repeat`},children:[(0,E.jsxs)(`div`,{style:{position:`relative`},children:[m>0&&(0,E.jsx)(`div`,{style:{position:`absolute`,left:m*12+6,top:0,bottom:0,width:1,background:`var(--border)`,pointerEvents:`none`}}),(0,E.jsx)(a9,{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=>f?.(e),onUnseen:p,depth:m,hasChildren:_,collapsed:h,onToggleCollapse:()=>g(e=>!e)})]}),_&&!h&&(0,E.jsx)(`div`,{children:e.children.map(e=>(0,E.jsx)(r9,{node:e,selectedSessionId:t,runningSessionIds:n,runningPhases:r,runningPhaseSince:i,runningBusySince:a,unreadSessionIds:o,seenSessionIds:s,interactionBadges:c,onSelectSession:l,onRenamed:u,onSessionDeleted:f,onUnseen:p,depth:m+1},e.session.id))})]})}function i9(){let{t:e}=N();return(0,E.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,E.jsxs)(`svg`,{width:p.xl,height:p.xl,viewBox:`0 0 14 14`,fill:`none`,"aria-hidden":`true`,style:{display:`block`},children:[(0,E.jsx)(`circle`,{cx:`7`,cy:`7`,r:`2.5`,fill:`currentColor`}),(0,E.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 a9({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:f,onUnseen:m,depth:h=0,hasChildren:g=!1,collapsed:_=!1,onToggleCollapse:v}){let{t:y}=N(),b=qt(!!(n&&r),i),x=qt(!!n,a),[S,C]=(0,d.useState)(!1),[w,T]=(0,d.useState)(!1),[D,O]=(0,d.useState)(``),[k,A]=(0,d.useState)(!1),[j,M]=(0,d.useState)(!1),P=(0,d.useRef)(null),ee=e.error?e.path.split(/[\\/]/).pop()||e.id:e.name||e.firstMessage.slice(0,50)||e.id.slice(0,12),F=(0,d.useCallback)(t=>{t.stopPropagation(),O(e.name??``),T(!0),setTimeout(()=>P.current?.select(),0)},[e.name]),te=(0,d.useCallback)(async()=>{let t=D.trim();if(T(!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{}},[D,e.id,e.name,u]),ne=(0,d.useCallback)(async()=>{A(!1),M(!0);try{await fetch(`/api/sessions/${encodeURIComponent(e.id)}`,{method:`DELETE`}),f?.(e.id)}catch{M(!1)}},[e.id,f]),re=(0,d.useCallback)(e=>{e.stopPropagation(),e.shiftKey?ne():A(!0)},[ne]),ie=(0,d.useCallback)(e=>{e.stopPropagation(),ne()},[ne]),ae=(0,d.useCallback)(e=>{e.stopPropagation(),A(!1)},[]);return(0,E.jsx)(`div`,{"data-testid":`session-item`,"data-session-id":e.id,onClick:k||w?void 0:l,title:c?y(`sidebar.interactionBadge`):void 0,onMouseEnter:()=>C(!0),onMouseLeave:()=>{C(!1)},style:{height:54,animation:c?`interaction-bg-blink 1s ease-in-out infinite`:void 0,display:`flex`,alignItems:`center`,paddingLeft:h>0?h*12+14:14,paddingRight:8,cursor:k||w?`default`:`pointer`,backgroundColor:k?`color-mix(in srgb, var(--status-error) 6%, transparent)`:S?`var(--bg-hover)`:`transparent`,transition:`background 0.1s`,opacity:j?.5:1,gap:6,overflow:`hidden`},className:t&&!k?`row-selected-gradient`:void 0,children:k?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,color:`var(--text)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:ee}),(0,E.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,E.jsx)(X7,{session:e}):(0,E.jsx)(`span`,{title:e.modified,children:G7(e.modified,y)}),(0,E.jsx)(`span`,{children:y(`sidebar.messagesCount`,{count:e.messageCount})})]})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,gap:5,flexShrink:0},children:[(0,E.jsxs)(`button`,{onClick:ie,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,E.jsx)(Xr,{size:p.base}),y(`sidebar.delete`)]}),(0,E.jsx)(`button`,{onClick:ae,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:y(`sidebar.cancel`)})]})]}):w?(0,E.jsx)(`input`,{ref:P,value:D,onChange:e=>O(e.target.value),onBlur:te,onKeyDown:e=>{e.key===`Enter`&&te(),e.key===`Escape`&&T(!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,E.jsxs)(E.Fragment,{children:[h>0&&(0,E.jsxs)(`svg`,{width:p.xs,height:p.xs,viewBox:`0 0 24 24`,fill:`none`,stroke:`var(--text-dim)`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0},children:[(0,E.jsx)(`line`,{x1:`6`,y1:`3`,x2:`6`,y2:`15`}),(0,E.jsx)(`circle`,{cx:`18`,cy:`6`,r:`3`}),(0,E.jsx)(`circle`,{cx:`6`,cy:`18`,r:`3`}),(0,E.jsx)(`path`,{d:`M18 9a9 9 0 0 1-9 9`})]}),(0,E.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,E.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:ee,children:(0,E.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,minWidth:0},children:ee})}),(0,E.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,E.jsx)(X7,{session:e}):n?(0,E.jsx)(XJ,{phase:r??{kind:`running_command`},elapsed:b,totalElapsed:x}):o?(0,E.jsx)(i9,{}):(0,E.jsx)(`span`,{title:e.modified,children:G7(e.modified,y)}),!e.error&&n?null:(0,E.jsx)(`span`,{children:y(`sidebar.messagesCount`,{count:e.messageCount})}),e.worktreeBranch&&(0,E.jsxs)(`span`,{title:`Worktree: ${e.cwd}`,style:{display:`flex`,alignItems:`center`,gap:3,color:`var(--accent)`,minWidth:0,overflow:`hidden`},children:[(0,E.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,E.jsx)(`line`,{x1:`6`,y1:`3`,x2:`6`,y2:`15`}),(0,E.jsx)(`circle`,{cx:`18`,cy:`6`,r:`3`}),(0,E.jsx)(`circle`,{cx:`6`,cy:`18`,r:`3`}),(0,E.jsx)(`path`,{d:`M18 9a9 9 0 0 1-9 9`})]}),(0,E.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.worktreeBranch})]})]})]}),g&&(0,E.jsx)(oi,{label:_?`Expand forks`:`Collapse forks`,children:(0,E.jsx)(`button`,{onClick:e=>{e.stopPropagation(),v?.()},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:_?`rotate(-90deg)`:`none`,transition:`transform 0.15s`},children:(0,E.jsx)(`svg`,{width:p.xs,height:p.xs,viewBox:`0 0 10 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,E.jsx)(`polyline`,{points:`2 3.5 5 6.5 8 3.5`})})})}),(0,E.jsx)(O7,{visible:S,items:[...s&&m?[{key:`unseen`,onClick:t=>{t.stopPropagation(),m(e.id)},title:y(`sidebar.disconnect`)||`断开`,icon:(0,E.jsx)(Qr,{size:p.base})}]:[],{key:`copy-path`,onClick:t=>{t.stopPropagation(),bY(e.path)},title:y(`sidebar.copyPath`),icon:(0,E.jsx)(hr,{size:p.base})},{key:`rename`,onClick:F,title:y(`sidebar.rename`),icon:(0,E.jsx)(Pr,{size:p.xl})},{key:`delete`,testId:`session-delete`,onClick:re,title:y(`sidebar.deleteWithShiftClick`),danger:!0,icon:(0,E.jsx)(Xr,{size:p.xl})}]})]})})}function o9(){let{t:e}=N(),t=(0,d.useSyncExternalStore)(bx,xx,xx);if(t.length===0)return null;let n=t[t.length-1],r=t.length;return(0,E.jsx)(jc,{open:!0,onOpenChange:()=>{},children:(0,E.jsxs)(Fc,{children:[(0,E.jsx)(Lc,{style:{position:`fixed`,inset:0,zIndex:1200,background:`rgba(0, 0, 0, 0.45)`}}),(0,E.jsxs)(Vc,{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,E.jsxs)(Kc,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:10,fontSize:`var(--text-base)`,fontWeight:600,color:`var(--text)`},children:[(0,E.jsx)(`span`,{style:{color:`var(--status-error)`},children:`⚠`}),(0,E.jsx)(`span`,{children:r>1?e(`errors.titleCount`,{count:r}):e(`errors.title`)})]}),(0,E.jsx)(Jc,{asChild:!0,children:(0,E.jsx)(`div`,{children:n.kind===`api`?(0,E.jsxs)(`div`,{children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:6},children:[(0,E.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,E.jsx)(`span`,{style:{fontSize:`var(--text-xs)`,color:`var(--text-dim)`},children:n.context})]}),(0,E.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text)`,wordBreak:`break-word`},children:n.message})]}):(0,E.jsxs)(`div`,{children:[n.context&&(0,E.jsx)(`div`,{style:{fontSize:`var(--text-xs)`,color:`var(--text-dim)`,marginBottom:6},children:n.context}),(0,E.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text)`,wordBreak:`break-word`},children:n.message})]})})}),(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8,marginTop:16},children:[r>1&&(0,E.jsx)(`button`,{type:`button`,onClick:Cx,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,E.jsx)(`button`,{type:`button`,onClick:Sx,style:{border:`none`,background:`var(--accent)`,color:`#fff`,borderRadius:6,padding:`4px 14px`,fontSize:`var(--text-sm)`,cursor:`pointer`},children:e(`errors.close`)})]})]})]})})}var s9=[],c9=1,l9=new Set;function u9(){for(let e of l9)e()}function d9(e){return l9.add(e),()=>{l9.delete(e)}}function f9(){return s9}function p9(e){let t={id:c9++,label:e??``};s9=[...s9,t],u9();let n=!1;return()=>{n||(n=!0,s9=s9.filter(e=>e.id!==t.id),u9())}}var m9=new WeakMap;function h9(e){if(!e.isConnected)return()=>{};let t=m9.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},m9.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`)),m9.delete(e)))}}async function g9(e){try{return await e.json()}catch{return null}}async function _9(e,t,n){let r=n?.loading??`fullscreen`,i=r===`fullscreen`?p9(n?.label):r instanceof HTMLElement?h9(r):null;try{let n;try{n=await fetch(e,t)}catch(e){throw new px(e instanceof Error?e.message:`Network error`,0)}if(!n.ok){let e=await g9(n);throw new px(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 px?e:new px(e instanceof Error?e.message:String(e),0)}finally{i?.()}}var v9=3;function y9(){let{t:e}=N(),t=(0,d.useSyncExternalStore)(d9,f9,f9);if(t.length===0)return null;let n=t.slice(0,v9),r=t.length-n.length;return(0,E.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,E.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,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,fontSize:`var(--text-sm)`,color:`var(--text)`},children:[(0,E.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,E.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t.label||e(`loading.inProgress`)})]},t.id)),r>0&&(0,E.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:e(`loading.more`,{count:r})})]})})}var b9={};function x9(e,t){return e===`Not found`?t(`files.notFound`):e===`Access denied`?t(`files.accessDenied`):e}async function S9(e,t){return((await _9(`/api/files/${vG(e)}?type=list`,void 0,t)).entries??[]).map(t=>({name:t.name,fullPath:SG(e,t.name),isDir:t.isDir,size:t.size,children:t.isDir?[]:void 0,loaded:!t.isDir}))}async function C9(e,t){return _9(`/api/git/status?${new URLSearchParams({cwd:e}).toString()}`,void 0,t)}var w9={modified:`files.modified`,added:`files.added`,deleted:`files.deleted`,renamed:`files.renamed`,untracked:`files.untracked`,conflict:`files.conflict`},T9={modified:`var(--status-warning)`,added:`var(--status-success)`,deleted:`var(--status-error)`,renamed:`var(--accent)`,untracked:`var(--status-success)`,conflict:`var(--status-error)`};function E9({status:e,t}){return(0,E.jsx)(`span`,{title:t(w9[e.status]),"aria-label":t(w9[e.status]),style:{width:14,height:14,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`,color:T9[e.status],fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,fontWeight:600},children:e.code})}function D9(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/${vG(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 O9({size:e=11}){return(0,E.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,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,E.jsx)(`path`,{d:`M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8`})]})}function k9({onClick:e,title:t}){return(0,E.jsx)(oi,{label:t,children:(0,E.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,E.jsxs)(`svg`,{width:p.lg,height:p.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,E.jsx)(`path`,{d:`m6 6 12 12`}),(0,E.jsx)(`path`,{d:`m18 6-12 12`})]})})})}function A9({node:e,depth:t,cwd:n,onOpenFile:r,onAtMention:i,expandedPaths:a,onToggleExpanded:o,refreshToken:s,highlightedPaths:c,gitStatusByPath:l,changedDirectoryPaths:u,t:f}){let m=a.has(e.fullPath),h=c.has(e.fullPath),g=_G(e.fullPath),_=l.get(g),v=e.isDir&&(_!==void 0||u.has(g)),[y,b]=(0,d.useState)(e.children??[]),[x,S]=(0,d.useState)(e.loaded??!1),[C,w]=(0,d.useState)(!1),T=(0,d.useCallback)(async(t=!1)=>{if(!(x&&!t))try{let t=await S9(e.fullPath,{loading:`silent`});b(t),S(!0)}catch{}},[x,e.fullPath]);(0,d.useEffect)(()=>{m&&x&&T(!0)},[s]);let D=(0,d.useCallback)(()=>{if(e.isDir){let t=!m;o(e.fullPath,t),t&&!x&&T()}else r(e.fullPath,e.name)},[e.isDir,e.fullPath,e.name,x,m,T,r,o]);return(0,E.jsxs)(`div`,{children:[(0,E.jsxs)(`div`,{onClick:D,onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),style:{position:`relative`,display:`flex`,alignItems:`center`,gap:4,paddingLeft:8+t*14,paddingRight:8,height:24,cursor:`pointer`,background:C?`var(--bg-hover)`:`transparent`,borderRadius:4,userSelect:`none`},children:[e.isDir&&(0,E.jsx)(`svg`,{width:p.xs,height:p.xs,viewBox:`0 0 10 10`,fill:`none`,stroke:`var(--text-dim)`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0,transform:m?`rotate(90deg)`:`none`,transition:`transform 0.1s`},children:(0,E.jsx)(`polyline`,{points:`3 2 7 5 3 8`})}),!e.isDir&&(0,E.jsx)(`span`,{style:{width:10,flexShrink:0}}),(0,E.jsx)(`span`,{style:{flexShrink:0,display:`flex`,alignItems:`center`},children:e.isDir?(0,E.jsx)(sn,{size:p.xl,open:m}):Fn(e.name,14)}),(0,E.jsx)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--text)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,flex:1},title:e.fullPath,children:e.name}),h&&(0,E.jsx)(`span`,{title:f(`files.newlyUploaded`),"aria-label":f(`files.newlyUploaded`),style:{width:14,height:14,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,E.jsx)(`span`,{style:{width:6,height:6,borderRadius:`50%`,background:`var(--accent)`}})}),!C&&!e.isDir&&_&&(0,E.jsx)(E9,{status:_,t:f}),!C&&v&&(0,E.jsx)(`span`,{title:f(`files.containsChangedFiles`),"aria-label":f(`files.containsChangedFiles`),style:{width:14,height:14,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,E.jsx)(`span`,{style:{width:6,height:6,borderRadius:`50%`,background:`var(--status-warning)`}})}),i&&C&&(0,E.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),i(xG(e.fullPath,n),e.isDir)},title:f(`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,E.jsx)(O9,{}),f(`files.mention`)]}),C&&!e.isDir&&(0,E.jsx)(`a`,{href:`/api/files/${vG(e.fullPath)}?type=download`,download:!0,onClick:e=>e.stopPropagation(),title:f(`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,E.jsxs)(`svg`,{width:p.sm,height:p.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,E.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,E.jsx)(`polyline`,{points:`7 10 12 15 17 10`}),(0,E.jsx)(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]})})]}),e.isDir&&m&&(0,E.jsxs)(`div`,{children:[y.map(e=>(0,E.jsx)(A9,{node:e,depth:t+1,cwd:n,onOpenFile:r,onAtMention:i,expandedPaths:a,onToggleExpanded:o,refreshToken:s,highlightedPaths:c,gitStatusByPath:l,changedDirectoryPaths:u,t:f},e.fullPath)),y.length===0&&x&&(0,E.jsx)(`div`,{style:{paddingLeft:8+(t+1)*14,fontSize:`var(--text-sm)`,color:`var(--text-dim)`,height:22,display:`flex`,alignItems:`center`},children:f(`files.empty`)})]})]})}function j9({status:e,cwd:t,onOpenFile:n,onStageToggle:r,unstage:i,t:a}){let[o,s]=(0,d.useState)(!1),c=yG(e.filePath),l=xG(e.filePath,t);return(0,E.jsxs)(`div`,{onClick:()=>n(e.filePath,c,{modeHint:`diff`}),onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),title:e.filePath,style:{display:`flex`,alignItems:`center`,gap:6,paddingLeft:10,paddingRight:8,height:24,cursor:`pointer`,background:o?`var(--bg-hover)`:`transparent`,borderRadius:4,userSelect:`none`},children:[r!==void 0&&(0,E.jsx)(`button`,{type:`button`,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`,opacity:+!!o,"--hover-color":`var(--text-muted)`,"--hover-bg":`var(--bg-hover)`},className:`hover-shift`,children:(0,E.jsx)(`svg`,{width:p.sm,height:p.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`,"aria-hidden":`true`,children:i?(0,E.jsx)(`path`,{d:`M6 12h12`}):(0,E.jsx)(`path`,{d:`M12 5v14M5 12h14`})})}),(0,E.jsx)(E9,{status:e,t:a}),(0,E.jsx)(`span`,{style:{flexShrink:0,display:`flex`,alignItems:`center`,opacity:.85},children:Fn(c,13)}),(0,E.jsx)(`span`,{style:{fontSize:`var(--text-base)`,color:`var(--text)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,flex:1},children:l}),e.lineStats&&(e.lineStats.additions>0||e.lineStats.deletions>0)&&(0,E.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,E.jsxs)(`span`,{style:{color:`var(--status-success)`},children:[`+`,e.lineStats.additions]}),e.lineStats.deletions>0&&(0,E.jsxs)(`span`,{style:{color:`var(--status-error)`},children:[`-`,e.lineStats.deletions]})]})]})}function M9({message:e,onMessageChange:t,commitBusy:n,canCommit:r,onCommit:i,pushBusy:a,canPush:o,onPush:s,pullBusy:c,canPull:l,onPull:u,aiBusy:f,canAiGenerate:m,onAiGenerate:h,autoGenerateOnEmpty:g,hasModelForAuto:_,aiModelHint:v,t:y}){let b=(0,d.useRef)(null),x=e.trim()===``,S=x&&g&&_&&m&&!f,C=n||!S&&x||!r;return(0,d.useLayoutEffect)(()=>{let e=b.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,120)}px`)},[e]),(0,E.jsx)(`div`,{style:{display:`flex`,padding:`4px 2px 6px`},children:(0,E.jsxs)(`div`,{style:{position:`relative`,display:`flex`,flexDirection:`column`,flex:1,minWidth:0,backgroundColor:`var(--bg)`,backgroundImage:n||f||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||f||a||c?`200% 100%`:void 0,animation:n||f||a||c?`pi-status-shine 1.5s linear infinite`:void 0,borderRadius:6,border:`1px solid var(--border)`},children:[(0,E.jsx)(`textarea`,{ref:b,value:e,disabled:n||f||a||c,placeholder:f?v?`${y(`git.ai.generating`)}(${v})`:y(`git.ai.generating`):y(`files.commitMessagePlaceholder`),onChange:e=>t(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),C||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||f||a||c?`var(--text-dim)`:`var(--text)`,background:`transparent`,border:`none`,borderRadius:6,outline:`none`}}),(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:4,padding:`2px 6px 4px`},children:[(0,E.jsx)(oi,{label:(()=>{let e=y(f?`git.ai.generating`:`git.ai.generate`);return v?`${e}(${v})`:e})(),children:(0,E.jsx)(`button`,{onClick:h,disabled:f||!m||n||a||c,"aria-label":y(`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:f||!m||n||a||c?`var(--text-dim)`:`var(--accent)`,cursor:f||!m||n||a||c?`default`:`pointer`},children:f?(0,E.jsx)(Ar,{size:p.lg,style:{animation:`spin 0.8s linear infinite`}}):(0,E.jsx)(Kr,{size:p.lg})})}),(0,E.jsx)(oi,{label:n?y(`files.committing`):C&&x&&!S?y(`files.commitMessageRequired`):S?`${y(`git.ai.generateAndCommit`)} (Ctrl+Enter)`:`${y(`files.commit`)} (Ctrl+Enter)`,children:(0,E.jsx)(`button`,{onClick:i,disabled:C||c,"aria-label":y(`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:C||c?`var(--text-dim)`:`var(--accent)`,cursor:C||c?`default`:`pointer`},children:n?(0,E.jsx)(Ar,{size:p[`2xl`],style:{animation:`spin 0.8s linear infinite`}}):(0,E.jsx)(Cr,{size:p[`2xl`]})})}),(0,E.jsx)(oi,{label:y(a?`files.pushing`:o?`files.push`:`files.pushUpToDate`),children:(0,E.jsx)(`button`,{onClick:s,disabled:a||n||c||!o,"aria-label":y(`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,E.jsx)(Ar,{size:p.lg,style:{animation:`spin 0.8s linear infinite`}}):(0,E.jsx)(mr,{size:p[`2xl`]})})}),(0,E.jsx)(oi,{label:y(c?`files.pulling`:l?`files.pull`:`files.pullUpToDate`),children:(0,E.jsx)(`button`,{onClick:u,disabled:c||n||a||!l,"aria-label":y(`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,E.jsx)(Ar,{size:p.lg,style:{animation:`spin 0.8s linear infinite`}}):(0,E.jsx)(pr,{size:p[`2xl`]})})})]})]})})}function N9({prefix:e,count:t,additions:n,deletions:r,t:i}){return(0,E.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,E.jsx)(`span`,{style:{color:`var(--text-dim)`},children:e}),(0,E.jsx)(`span`,{style:{color:`var(--text-dim)`},children:i(`files.changedCount`,{count:t})}),(0,E.jsxs)(`span`,{style:{color:T9.added,fontFamily:`var(--font-mono)`},children:[`+`,n]}),(0,E.jsxs)(`span`,{style:{color:T9.deleted,fontFamily:`var(--font-mono)`},children:[`-`,r]})]})}function P9({message:e,onDismiss:t}){let{t:n}=N();return(0,E.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,E.jsx)(`span`,{style:{minWidth:0,flex:1,overflowWrap:`anywhere`,maxHeight:140,overflowY:`auto`,whiteSpace:`pre-wrap`},children:e}),(0,E.jsx)(k9,{onClick:t,title:n(`files.dismissError`)})]})}function F9({children:e}){return(0,E.jsx)(`div`,{style:{padding:`0 4px 2px`},children:e})}var I9=(0,d.forwardRef)(function({children:e},t){return(0,E.jsx)(`div`,{ref:t,style:{padding:`2px 4px`},children:e})}),L9=(0,d.forwardRef)(function({cwd:e,onOpenFile:t,refreshKey:n,searchQuery:r,onAtMention:i,onAtMentions:a,onUploadBusyChange:o,changesCollapsed:s,onChangesCountChange:c,sessionId:l,onOpenConfig:u},f){let{t:m}=N(),[h,g]=(0,d.useState)([]),[_,v]=(0,d.useState)(!0),[y,b]=(0,d.useState)(null),x=(0,d.useRef)(null),[S,C]=(0,d.useState)(new Set),[w,T]=(0,d.useState)(0),D=(r??``).trim().toLowerCase(),O=(0,d.useMemo)(()=>{if(!D)return h;function e(t){if(t.name.toLowerCase().includes(D))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 h.map(e).filter(e=>e!==null)},[h,D]),[k,A]=(0,d.useState)(new Set),[j,M]=(0,d.useState)([]),[P,ee]=(0,d.useState)({additions:0,deletions:0}),[F,te]=(0,d.useState)([]),[ne,re]=(0,d.useState)({additions:0,deletions:0}),ie=(0,d.useMemo)(()=>D?F.filter(t=>xG(t.filePath,e).toLowerCase().includes(D)):F,[F,D,e]),ae=(0,d.useMemo)(()=>D?j.filter(t=>xG(t.filePath,e).toLowerCase().includes(D)):j,[j,D,e]),[oe,I]=(0,d.useState)({branch:null,upstream:null,ahead:0,behind:0,hasUpstream:!1}),[L,se]=(0,d.useState)(null),[R,ce]=(0,d.useState)(``),[le,ue]=(0,d.useState)(!1),[de,fe]=(0,d.useState)(null),[pe,me]=(0,d.useState)(!1),[he,ge]=(0,d.useState)(!1),[_e,ve]=(0,d.useState)(null),[ye,xe]=(0,d.useState)(!1),[Ce,we]=(0,d.useState)(!1),Te=(0,d.useSyncExternalStore)(Se.subscribe,()=>Se.get()?.preferences??b9,()=>b9),Ee=(0,d.useSyncExternalStore)(be.subscribe,()=>be.get()),De=Te.commitMessageAutoGenerateOnEmpty!==!1,Oe=Te.commitStageAllConfirm!==!1,ke=Te.commitMessageUseCurrentModel===!0?!!(l||Ee?.defaultModel||(Ee?.modelList?.length??0)>0):!!(typeof Te.commitMessageModel==`string`&&Te.commitMessageModel),[Ae,je]=(0,d.useState)(!1),[Me,Ne]=(0,d.useState)(null),Pe=(0,d.useRef)(null),[Fe,Ie]=(0,d.useState)(!1),[Le,Re]=(0,d.useState)(null),[ze,Be]=(0,d.useState)(`idle`),[Ve,He]=(0,d.useState)(0),[Ue,We]=(0,d.useState)(null),[Ge,Ke]=(0,d.useState)(null),[qe,Je]=(0,d.useState)(null),Ye=(0,d.useRef)(null),Xe=(0,d.useRef)(null),Ze=`${n??0}:${w}`,Qe=ze!==`idle`,$e=(0,d.useMemo)(()=>new Map(j.map(e=>[_G(e.filePath),e])),[j]),et=(0,d.useMemo)(()=>{let t=new Set,n=_G(e).replace(/\/$/,``);for(let e of j){let r=bG(_G(e.filePath));for(;(r===n||r.startsWith(`${n}/`))&&(t.add(r),r!==n);){let e=bG(r);if(e===r)break;r=e}}return t},[e,j]),tt=(0,d.useCallback)((e,t)=>{C(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]),nt=(0,d.useCallback)(t=>{let n=t.uploaded??[],r=t.skipped??[],i=t.errors??[];Ke({uploaded:n,skipped:r,errors:i}),n.length>0&&(A(new Set(n.map(t=>SG(e,t)))),T(e=>e+1))},[e]),rt=(0,d.useCallback)(async(t,n)=>{Je(null),We(null),He(0),Be(`uploading`);try{let{status:r,data:i}=await D9(e,t,n,He);if(r===409&&i.conflicts?.length){Je({files:t,conflicts:i.conflicts,nonReplaceable:i.nonReplaceable??[]});return}if(r<200||r>=300)throw Error(i.error??`Upload failed (HTTP ${r})`);He(100),nt(i)}catch(e){We(e instanceof Error?e.message:String(e))}finally{Be(`idle`)}},[nt,e]),it=(0,d.useCallback)(async t=>{if(!(t.length===0||Qe)){Ke(null),A(new Set),Je(null),We(null),He(0),Be(`checking`);try{let n=await _9(`/api/files/${vG(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){Je({files:t,conflicts:n.conflicts,nonReplaceable:n.nonReplaceable??[]});return}await rt(t,`error`)}catch(e){We(e instanceof Error?e.message:String(e))}finally{Be(`idle`)}}},[e,rt,Qe]),at=(0,d.useCallback)(e=>{let t=Array.from(e.target.files??[]);e.target.value=``,it(t)},[it]);(0,d.useImperativeHandle)(f,()=>({openUploadPicker(){Qe||Xe.current?.click()}}),[Qe]);let ot=(0,d.useCallback)(async()=>{je(!0);try{let t=await _9(`/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),T(e=>e+1)}},[e]),st=(0,d.useCallback)(async()=>{Ie(!0);try{let t=await _9(`/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),T(e=>e+1)}},[e]);(0,d.useEffect)(()=>{if(Pe.current&&clearTimeout(Pe.current),Me)return Pe.current=setTimeout(()=>Ne(null),1e4),()=>{Pe.current&&clearTimeout(Pe.current)}},[Me]);let ct=(0,d.useRef)(null);(0,d.useEffect)(()=>{if(ct.current&&clearTimeout(ct.current),Le)return ct.current=setTimeout(()=>Re(null),1e4),()=>{ct.current&&clearTimeout(ct.current)}},[Le]),(0,d.useEffect)(()=>{o?.(Qe)},[o,Qe]),(0,d.useEffect)(()=>()=>o?.(!1),[o]),(0,d.useEffect)(()=>{let t=Ye.current!==e;Ye.current=e,t&&(C(new Set),A(new Set),Ke(null),Je(null),We(null)),b(null),v(t);let n=!1;return S9(e,{loading:`silent`}).then(e=>{n||g(e)}).catch(e=>{n||(b(e instanceof Error?e.message:String(e)),yx(e,`file explorer`))}).finally(()=>{n||v(!1)}),()=>{n=!0}},[e,n,w]),(0,d.useEffect)(()=>{let t=!1;return C9(e,{loading:`silent`}).then(e=>{if(!t){let t=e.isGitRepository;M(t?e.files:[]),ee(t?{additions:e.additions,deletions:e.deletions}:{additions:0,deletions:0}),te(t?e.stagedFiles:[]),re(t?{additions:e.stagedAdditions,deletions:e.stagedDeletions}:{additions:0,deletions:0}),I(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||(M([]),ee({additions:0,deletions:0}),te([]),re({additions:0,deletions:0}),I({branch:null,upstream:null,ahead:0,behind:0,hasUpstream:!1}))}),()=>{t=!0}},[e,n,w]);let lt=(0,d.useCallback)(async(t,n)=>{se(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})`);T(e=>e+1)}catch(e){se(e instanceof Error?e.message:String(e))}},[e]);(0,d.useEffect)(()=>{c?.(j.length+F.length)},[j,F,c]);let ut=(0,d.useCallback)(async(t,n)=>{let r=n??R;ue(!0),fe(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})`);ce(``),fe(null),me(!1),T(e=>e+1)}catch(e){fe(e instanceof Error?e.message:String(e))}finally{ue(!1)}},[e,R]),dt=(0,d.useCallback)(async()=>{if(he||le||Ae||Ce)return null;let t=Se.get()?.preferences??{};if(Object.keys(t).length===0)try{await Se.refresh(),t=Se.get()?.preferences??{}}catch{}let n=t.commitMessageUseCurrentModel===!0,r=typeof t.commitMessageModel==`string`?t.commitMessageModel:``,i=``,a=``;if(n){if(l)try{let e=await _9(`/api/agent/${encodeURIComponent(l)}`),t=e.state?.model??e.model??null;if(t){let e=t;i=e.provider??``,a=e.id??e.modelId??``}if(!i||!a)try{let e=await _9(`/api/sessions/${encodeURIComponent(l)}/state`);e.model&&(i=e.model.provider,a=e.model.id)}catch{}}catch{}if(!i||!a)try{let e=be.get();if(!e?.defaultModel)try{await be.refresh(),e=be.get()}catch{}if(e?.defaultModel?.provider){let t=e.defaultModel;i=t.provider??``,a=t.modelId??t.id??``}if((!i||!a)&&e?.modelList?.[0]){let t=e.modelList[0];i=t.provider??``,a=t.modelId??t.id??``}}catch{}if(!i||!a)return ve(m(`git.ai.noSessionModel`)),null}else{if(!r)return xe(!0),null;let e=r.indexOf(`/`);if(e===-1||(i=r.slice(0,e),a=r.slice(e+1),!i||!a))return ve(m(`git.ai.invalidModel`)),null}let o=t.commitMessageMaxTokens,s=typeof o==`number`&&Number.isFinite(o)?Math.min(4096,Math.max(64,Math.round(o))):512;ge(!0),ve(null);try{let t=await fetch(`/api/git/generate-commit`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:e,provider:i,modelId:a,maxTokens:s})}),n=await t.json().catch(()=>({}));if(!t.ok)throw Error(n.error??`Generate failed (HTTP ${t.status})`);if(!n.message)throw Error(`Empty response`);return ce(n.message),n.message}catch(e){return ve(e instanceof Error?e.message:String(e)),null}finally{ge(!1)}},[he,le,Ae,Ce,e,l,m]),ft=(0,d.useCallback)(async()=>{let t=await C9(e),n=t.isGitRepository;M(n?t.files:[]),ee(n?{additions:t.additions,deletions:t.deletions}:{additions:0,deletions:0}),te(n?t.stagedFiles:[]),re(n?{additions:t.stagedAdditions,deletions:t.stagedDeletions}:{additions:0,deletions:0}),I(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=R.trim()===``,i=n?t.stagedFiles??[]:[],a=n?t.files??[]:[],o=i.length+a.length>0;if(r&&De&&ke&&o&&!he&&!le&&!Ae&&!Ce){we(!0);try{let e=await dt();if(!e)return;i.length>0?await ut(!1,e):Oe?me(!0):await ut(!0,e)}finally{we(!1)}return}i.length>0?ut(!1):Oe?me(!0):ut(!0)},[e,R,De,ke,Oe,he,le,Ae,Ce,dt,ut]),pt=Qe||qe!==null||Ue!==null||Ge!==null,mt=(0,d.useCallback)(()=>{!Ge||Ge.uploaded.length===0||a?.(Ge.uploaded.map(t=>xG(SG(e,t),e)))},[e,a,Ge]);return(0,E.jsxs)(`div`,{style:{minHeight:`100%`},children:[(0,E.jsx)(`input`,{ref:Xe,type:`file`,multiple:!0,hidden:!0,onChange:at}),pt&&(0,E.jsxs)(`div`,{style:{padding:`6px 8px`,borderBottom:`1px solid var(--border)`},children:[Qe&&(0,E.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-label":ze===`checking`?m(`files.checking`):m(`files.uploading`,{progress:Ve}),children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8,minHeight:14,color:`var(--text-muted)`},children:[ze===`checking`?(0,E.jsx)(`svg`,{width:p.lg,height:p.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,E.jsx)(`path`,{d:`M21 12a9 9 0 1 1-5.7-8.4`})}):(0,E.jsxs)(`svg`,{width:p.lg,height:p.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,E.jsx)(`path`,{d:`M12 16V4`}),(0,E.jsx)(`path`,{d:`m7 9 5-5 5 5`}),(0,E.jsx)(`path`,{d:`M5 20h14`})]}),ze===`uploading`&&(0,E.jsxs)(`span`,{style:{fontSize:`var(--text-xs)`},children:[Ve,`%`]})]}),ze===`uploading`&&(0,E.jsx)(`div`,{style:{height:3,marginTop:4,overflow:`hidden`,borderRadius:2,background:`var(--border)`},children:(0,E.jsx)(`div`,{style:{width:`${Ve}%`,height:`100%`,background:`var(--text-muted)`,transition:`width 120ms ease`}})})]}),qe&&(0,E.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,E.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text)`,lineHeight:1.35,overflowWrap:`anywhere`},children:m(`files.conflictSummary`,{count:qe.conflicts.length,countSuffix:qe.conflicts.length===1?``:`s`,files:qe.conflicts.join(`, `)})}),qe.nonReplaceable.length>0&&(0,E.jsx)(`div`,{style:{marginTop:3,fontSize:`var(--text-xs)`,color:`#f59e0b`,lineHeight:1.35,overflowWrap:`anywhere`},children:m(`files.cannotReplace`,{files:qe.nonReplaceable.join(`, `)})}),(0,E.jsxs)(`div`,{style:{display:`flex`,gap:5,marginTop:7},children:[(0,E.jsx)(`button`,{type:`button`,onClick:()=>void rt(qe.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:m(`files.replace`)}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>void rt(qe.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:m(`files.skipExisting`)}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>Je(null),style:{height:22,padding:`0 7px`,border:`none`,borderRadius:4,background:`transparent`,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-xs)`},children:m(`files.cancel`)})]})]}),Ue&&(0,E.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,E.jsx)(`span`,{style:{minWidth:0,flex:1,overflowWrap:`anywhere`},children:Ue}),(0,E.jsx)(k9,{onClick:()=>We(null),title:m(`files.dismissError`)})]}),Ge&&(0,E.jsxs)(`div`,{"aria-live":`polite`,children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,minHeight:22,fontSize:`var(--text-sm)`},children:[(0,E.jsxs)(`div`,{style:{minWidth:0,flex:1,display:`flex`,alignItems:`center`,gap:8},children:[Ge.uploaded.length>0&&(0,E.jsxs)(`span`,{title:`${Ge.uploaded.length} uploaded`,"aria-label":`${Ge.uploaded.length} uploaded`,style:{display:`flex`,alignItems:`center`,gap:3,color:`var(--status-success)`},children:[(0,E.jsx)(`svg`,{width:p.lg,height:p.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,E.jsx)(`path`,{d:`m5 12 4 4L19 6`})}),(0,E.jsx)(`span`,{children:Ge.uploaded.length})]}),Ge.skipped.length>0&&(0,E.jsxs)(`span`,{title:`${Ge.skipped.length} skipped`,"aria-label":`${Ge.skipped.length} skipped`,style:{display:`flex`,alignItems:`center`,gap:3,color:`var(--text-dim)`},children:[(0,E.jsxs)(`svg`,{width:p.lg,height:p.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,E.jsx)(`path`,{d:`M8 12h8`})]}),(0,E.jsx)(`span`,{children:Ge.skipped.length})]}),Ge.errors.length>0&&(0,E.jsxs)(`span`,{title:m(`files.uploadFailed`,{count:Ge.errors.length}),"aria-label":m(`files.uploadFailed`,{count:Ge.errors.length}),style:{display:`flex`,alignItems:`center`,gap:3,color:`var(--status-error)`},children:[(0,E.jsxs)(`svg`,{width:p.lg,height:p.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,E.jsx)(`path`,{d:`M12 3 2.5 20h19L12 3Z`}),(0,E.jsx)(`path`,{d:`M12 9v4`}),(0,E.jsx)(`path`,{d:`M12 17h.01`})]}),(0,E.jsx)(`span`,{children:Ge.errors.length})]})]}),Ge.uploaded.length>0&&a&&(0,E.jsxs)(`button`,{type:`button`,onClick:mt,title:Ge.uploaded.length===1?m(`files.addUploadedFile`):m(`files.addAllUploadedFiles`),"aria-label":Ge.uploaded.length===1?m(`files.addUploadedFile`):m(`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,E.jsx)(O9,{}),m(`files.mention`)]}),(0,E.jsx)(k9,{onClick:()=>Ke(null),title:m(`files.dismissUploadResults`)})]}),Ge.errors.map(e=>(0,E.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,E.jsxs)(`svg`,{width:p.sm,height:p.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0},"aria-hidden":`true`,children:[(0,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,E.jsx)(`path`,{d:`M12 8v5`}),(0,E.jsx)(`path`,{d:`M12 17h.01`})]}),(0,E.jsx)(`span`,{style:{minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.name})]},e.name))]})]}),!s&&(0,E.jsxs)(F9,{children:[(0,E.jsx)(M9,{message:R,onMessageChange:ce,commitBusy:le||Ce,canCommit:F.length+j.length>0,onCommit:ft,pushBusy:Ae,canPush:oe.hasUpstream?oe.ahead>0:!!oe.branch&&oe.branch!==`HEAD`,onPush:ot,pullBusy:Fe,canPull:oe.hasUpstream&&oe.behind>0,onPull:st,aiBusy:he,canAiGenerate:F.length+j.length>0,onAiGenerate:()=>{ce(``),dt()},autoGenerateOnEmpty:De,hasModelForAuto:ke,aiModelHint:(()=>{if(Te.commitMessageUseCurrentModel===!0)return m(`git.ai.usingCurrentModel`);let e=typeof Te.commitMessageModel==`string`?Te.commitMessageModel:``;return e?m(`git.ai.usingModel`,{model:e}):``})(),t:m}),Me&&(0,E.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,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:4},children:[(0,E.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:Me.ok?`var(--status-success)`:`var(--status-error)`,flexShrink:0}}),(0,E.jsx)(`span`,{style:{color:`var(--text-muted)`,flex:1,minWidth:0},children:m(Me.ok?`files.pushSuccess`:`files.pushFailed`)}),(0,E.jsx)(`button`,{onClick:()=>Ne(null),"aria-label":m(`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,E.jsx)(ni,{size:p.base})})]}),Me.output&&(0,E.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,E.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,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:4},children:[(0,E.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:Le.ok?`var(--status-success)`:`var(--status-error)`,flexShrink:0}}),(0,E.jsx)(`span`,{style:{color:`var(--text-muted)`,flex:1,minWidth:0},children:m(Le.ok?`files.pullSuccess`:`files.pullFailed`)}),(0,E.jsx)(`button`,{onClick:()=>Re(null),"aria-label":m(`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,E.jsx)(ni,{size:p.base})})]}),Le.output&&(0,E.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})]}),de&&(0,E.jsx)(P9,{message:de,onDismiss:()=>fe(null)}),L&&(0,E.jsx)(P9,{message:x9(L,m),onDismiss:()=>se(null)}),_e&&(0,E.jsx)(P9,{message:_e,onDismiss:()=>ve(null)}),(0,E.jsx)(N9,{prefix:m(`files.stagedPrefix`),count:ie.length,additions:ne.additions,deletions:ne.deletions,t:m}),ie.length>0?ie.map(n=>(0,E.jsx)(j9,{status:n,cwd:e,onOpenFile:t,onStageToggle:e=>void lt(e,!0),unstage:!0,t:m},`staged-${n.filePath}`)):(0,E.jsx)(`div`,{style:{padding:`8px 10px`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`,textAlign:`center`},children:m(`files.noStagedChanges`)}),(0,E.jsx)(`div`,{style:{height:6}}),(0,E.jsx)(N9,{prefix:m(`files.unstagedPrefix`),count:ae.length,additions:P.additions,deletions:P.deletions,t:m}),ae.length>0?ae.map(n=>(0,E.jsx)(j9,{status:n,cwd:e,onOpenFile:t,onStageToggle:e=>void lt(e,!1),t:m},n.filePath)):(0,E.jsx)(`div`,{style:{padding:`8px 10px`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`,textAlign:`center`},children:m(`files.noUnstagedChanges`)})]}),s&&(0,E.jsxs)(I9,{ref:x,children:[y?(0,E.jsx)(`div`,{style:{padding:`8px 12px`,fontSize:`var(--text-sm)`,color:`var(--status-error)`},children:x9(y,m)}):(D?O:h).map(n=>(0,E.jsx)(A9,{node:n,depth:0,cwd:e,onOpenFile:t,onAtMention:i,expandedPaths:S,onToggleExpanded:tt,refreshToken:Ze,highlightedPaths:k,gitStatusByPath:$e,changedDirectoryPaths:et,t:m},n.fullPath)),!_&&!y&&h.length===0&&(0,E.jsx)(`div`,{style:{padding:`8px 12px`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:m(`files.noFiles`)})]}),(0,E.jsx)(Bx,{open:ye,title:m(`git.ai.notConfiguredTitle`),description:m(`git.ai.notConfiguredDesc`),confirmText:m(`git.ai.goToConfig`),cancelText:m(`sidebar.cancel`),onCancel:()=>xe(!1),onConfirm:()=>{xe(!1),u?.(`git`)},icon:(0,E.jsx)(Kr,{size:p[`5xl`],style:{color:`var(--accent)`}})}),(0,E.jsx)(Bx,{open:pe,title:m(`files.commitTitle`),description:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`div`,{children:m(`files.confirmStageAllCommit`,{count:j.length})}),R.trim()!==``&&(0,E.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:R.trim()})]}),confirmText:m(`files.stageAllAndCommit`),cancelText:m(`sidebar.cancel`),onCancel:()=>me(!1),onConfirm:()=>{me(!1),ut(!0)},icon:(0,E.jsxs)(`svg`,{width:p[`5xl`],height:p[`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,E.jsx)(`path`,{d:`M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10Z`}),(0,E.jsx)(`path`,{d:`m9 12 2 2 4-4`})]})})]})});function R9({cwd:e,onOpenFile:t,explorerRefreshKey:n,onExplorerRefresh:r,onAtMention:i,onAtMentions:a,sessionId:o,onOpenConfig:s}){let{t:c}=N(),[l,u]=(0,d.useState)(0),[f,m]=(0,d.useState)(!1),[h,g]=(0,d.useState)(0),[_,v]=(0,d.useState)(!0),[y,b]=(0,d.useState)(!1),x=(0,d.useRef)(null),S=(0,d.useRef)(null),[C,w]=(0,d.useState)(!1),[T,D]=(0,d.useState)(``),O=(0,d.useRef)(null);return(0,d.useEffect)(()=>{C&&O.current?.focus()},[C]),(0,d.useEffect)(()=>{n!==void 0&&u(e=>e+1)},[n]),e?(0,E.jsx)(F7,{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,E.jsx)(O7,{items:[{key:`git`,onClick:()=>v(e=>!e),title:c(`sidebar.changedFiles`,{count:h}),ariaPressed:!_,color:h>0?`var(--accent)`:`var(--text-muted)`,background:_?void 0:`var(--bg-selected)`,borderColor:_?void 0:`var(--accent)`,icon:(0,E.jsx)(Sr,{size:p.lg})},{key:`search`,testId:`explorer-search-toggle`,onClick:()=>{C&&D(``),w(e=>!e)},title:c(`files.search`),ariaPressed:C,color:C?`var(--accent)`:`var(--text-muted)`,background:C?`var(--bg-selected)`:void 0,icon:(0,E.jsx)(Hr,{size:p.lg})},{key:`upload`,onClick:()=>S.current?.openUploadPicker(),disabled:f,title:c(`sidebar.uploadFilesTitle`),color:`var(--text-muted)`,icon:(0,E.jsx)(Ir,{size:p.base})},{key:`refresh`,onClick:()=>{r?r():u(e=>e+1),b(!0),x.current&&clearTimeout(x.current),x.current=setTimeout(()=>b(!1),2e3)},title:c(`sidebar.refreshExplorer`),skipHover:y,color:y?`var(--status-success)`:`var(--text-muted)`,background:y?`color-mix(in srgb, var(--status-success) 18%, transparent)`:void 0,icon:y?(0,E.jsx)(ur,{size:p.lg,color:`var(--status-success)`,strokeWidth:2.5}):(0,E.jsx)(Rr,{size:p.lg})}]}),headerExtra:C?(0,E.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,E.jsx)(Hr,{size:p.lg,color:`var(--text-muted)`,style:{flexShrink:0}}),(0,E.jsx)(`input`,{ref:O,"data-testid":`explorer-search-input`,value:T,onChange:e=>D(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,E.jsx)(`button`,{type:`button`,onClick:()=>{D(``),O.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,E.jsx)(ni,{size:p.base})})]}):void 0,children:(0,E.jsx)(L9,{ref:S,cwd:e,onOpenFile:t??(()=>{}),refreshKey:l,searchQuery:T,onAtMention:i,onAtMentions:a,onUploadBusyChange:m,changesCollapsed:_,onChangesCountChange:g,sessionId:o,onOpenConfig:s})}):null}function z9({geometries:e,messages:t,onAddMessage:n,onRemoveMessage:r,onUpdateMessage:i,widgets:a,closedKeys:o,onReopen:s}){let{t:c}=N(),[l,u]=(0,d.useState)(null),[f,p]=(0,d.useState)(null),m=(0,d.useRef)(null);(0,d.useEffect)(()=>()=>{m.current&&clearTimeout(m.current)},[]);let h=e=>a.find(t=>t.key===e)?.lines[0],g=(e,t,n)=>{s(e),p({key:e,x:t,y:n}),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>p(null),2500)},_=[...new Set([...Object.keys(e),...o.keys()])].map(t=>[t,e[t]]);return(0,E.jsxs)(`div`,{style:{height:`100%`,display:`flex`,flexDirection:`column`,background:`var(--bg)`},children:[_.length===0?(0,E.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,E.jsx)(`div`,{style:{flex:1,minHeight:0,overflowY:`auto`,padding:10,display:`flex`,flexDirection:`row`,flexWrap:`wrap`,alignContent:`flex-start`,gap:6},children:_.map(([e,a])=>{let s=t[e]??[],d=o.has(e),f=h(e);return(0,E.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,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:7,flexWrap:`wrap`},children:[(0,E.jsxs)(`div`,{style:{minWidth:0,flex:`1 1 120px`},children:[(0,E.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,E.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,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4,flexShrink:0},children:[d&&(0,E.jsxs)(`button`,{type:`button`,"data-testid":`widget-expand-${e}`,"aria-label":c(`widgets.reopen`),title:c(`widgets.reopen`),onClick:t=>g(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,E.jsx)(vr,{size:13,"aria-hidden":!0}),c(`widgets.reopen`)]}),(0,E.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,E.jsx)(Or,{size:13,"aria-hidden":!0}),c(`config.widgets.bind`)]})]})]}),f&&(0,E.jsx)(`div`,{style:{marginTop:4,fontSize:`var(--text-sm)`,color:`var(--text-muted)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:f}),(0,E.jsx)(KK,{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)})}),f&&(0,E.jsx)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":`widget-expanded-toast`,style:{position:`fixed`,left:Math.min(f.x,window.innerWidth-180),top:f.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:f.key})})]})}var B9=e=>window.history.replaceState(null,``,e),V9=36,H9=176,U9=224,W9=86,G9=116;function K9(){let[e,t]=(0,d.useState)(!1);(0,d.useEffect)(()=>{t(!0)},[]);let[n]=(0,d.useState)(()=>Mq(new URLSearchParams(window.location.search))),{isDark:r,toggleTheme:i}=Xn(),{locale:a,setLocale:o,t:s,supportedLocales:c}=N(),l=ne();Sq();let{settingsValue:u,defaultThinkingLevel:f,setDefaultThinkingLevel:m,compaction:h,retry:g,defaultProjectTrust:_,setDefaultProjectTrust:v,subagents:y,savedWorkspaces:b,handleSavedWorkspacesChange:x,widgetGeometries:S,setWidgetGeometry:C,widgetMessages:w,addWidgetMessage:T,removeWidgetMessage:D,updateWidgetMessage:O,fontScale:k,setFontScale:A}=mt({isDark:r,toggleTheme:i}),{selectedSession:j,effectiveNewSessionCwd:M,showChat:P,projectTrustCwd:ee,refreshKey:F,sessionKey:te,explorerRefreshKey:re,setExplorerRefreshKey:ie,modelsRefreshKey:I,setModelsRefreshKey:L,activeCwd:se,initialCwdStatus:R,initialCwdError:ue,initialSessionRestored:de,projectTrust:me,projectTrustDialogOpen:ge,setProjectTrustDialogOpen:_e,projectTrustBusy:ve,projectTrustError:ye,setProjectTrustError:be,extensionDialogActiveRef:xe,handleSelectSession:Se,handleNewSession:Ce,handleSessionCreated:we,handleAgentEnd:Te,handleSessionRenamed:Ee,handleSessionForked:De,handleSessionDeleted:Oe,handleSessionUnseen:Ae,handleCwdChange:Me,handleTrustProject:Ne,handleExplorerRefresh:Pe,handleInitialRestoreDone:Fe}=ke({initialNavigation:n,onProjectSwitch:()=>{vt(null),Ie(e=>e.filter(e=>e.kind!==`file`)),Le(null),B9(`/`)},onSessionSelected:e=>{l&&!e&&Qe(!1)},onTopPanelReset:()=>vt(null)}),{setSavedTabs:Ie,setActiveSavedId:Le,configTabOpen:Re,configSection:ze,setConfigSection:Be,configTabActive:Ve,activeFileTab:He,fileTabs:Ue,modelConfigFocus:We,handleOpenFile:Ge,openConfigTab:Ke,handleOpenModelConfig:qe,closeConfigTab:Je,handleCloseMainTab:Ye}=vq({onSessionSelected:()=>{Et(!1),l&&Qe(!1)},onRefreshModels:()=>L(e=>e+1)}),Xe=(0,d.useCallback)(e=>{Ge(e,yG(e),{sourceSessionId:j?.id??null})},[Ge,j?.id]),[Ze,Qe]=(0,d.useState)(!0),[$e,et]=(0,d.useState)(!1),tt=(0,d.useRef)(280),nt=(0,d.useRef)(280),rt=(0,d.useCallback)(()=>typeof window>`u`?480:ce({viewportWidth:window.innerWidth,rightPanelOpen:!1,rightPanelWidth:0}),[]),it=fe({ariaLabel:s(`layout.resizeSidebar`),cssVariable:`--sidebar-width`,defaultWidth:280,getMaxWidth:rt,growthDirection:`right`,maxWidth:480,minWidth:180,storageKey:`pi-sidebar-width`,widthRef:tt}),at=it.reclampWidth,ot=fe({ariaLabel:s(`layout.resizeWidgetPanel`),cssVariable:`--widget-panel-width`,defaultWidth:280,getMaxWidth:()=>typeof window>`u`?560:le({viewportWidth:window.innerWidth,sidebarOpen:Ze,sidebarWidth:it.width}),growthDirection:`left`,maxWidth:560,minWidth:200,storageKey:`pi-widget-panel-width`,widthRef:nt});(0,d.useEffect)(()=>{l&&Qe(!1)},[l]),(0,d.useEffect)(()=>{et(!0)},[]),(0,d.useEffect)(()=>{at()},[at]);let st=(0,d.useRef)(null),ct=(0,d.useRef)(null),ut=(0,d.useRef)(null),dt=(0,d.useRef)(null),ft=(0,d.useRef)(null),pt=pe(),ht=(0,d.useCallback)(()=>{pt.schedule(()=>{vt(null)},150)},[pt]),gt=pt.cancel,[_t,vt]=(0,d.useState)(null),[yt,bt]=(0,d.useState)(null),xt=(0,d.useCallback)(e=>{l&&Qe(!1),vt(t=>t===e?null:e)},[l]),St=(0,d.useCallback)(()=>{l&&vt(null),Qe(e=>!e)},[l]);(0,d.useEffect)(()=>{if(!_t)return;let e=()=>{if(document.hidden)return;let e=ct.current?.getBoundingClientRect();if(e){if(_t===`language`&&!l&&dt.current){let t=dt.current.getBoundingClientRect(),n=ut.current?.getBoundingClientRect(),r=n?.top??t.top,i=n?.bottom??t.bottom,a=Math.min(H9,n?.width??e.width),o=Math.min(t.left-1,Math.max(n?.left??e.left,(n?.right??e.right)-a)),s=i+4;bt({top:s+W9>window.innerHeight-4?r-W9:s,left:o,width:a});return}if(_t===`fontSize`&&!l&&ft.current){let t=ft.current.getBoundingClientRect(),n=ut.current?.getBoundingClientRect(),r=n?.top??t.top,i=n?.bottom??t.bottom,a=Math.min(U9,n?.width??e.width),o=Math.min(t.left-1,Math.max(n?.left??e.left,(n?.right??e.right)-a)),s=i+4;bt({top:s+G9>window.innerHeight-4?r-G9:s,left:o,width:a});return}bt({top:e.bottom,left:e.left,width:e.width})}};e();let t=new ResizeObserver(e);return ct.current&&t.observe(ct.current),dt.current&&t.observe(dt.current),ft.current&&t.observe(ft.current),()=>t.disconnect()},[_t,l]);let{widgetPanelOpen:Ct,setWidgetPanelOpen:wt,widgetsTabActive:Tt,setWidgetsTabActive:Et,extensionWidgets:Dt,closedWidgets:Ot,handleCloseWidget:kt,handleReopenWidget:At,handleExtensionWidgetsChange:jt,rightSidebarOpen:Mt,setRightSidebarOpen:Nt,closedWidgetCount:Pt}=yq({widgetGeometries:S,setWidgetGeometry:C}),Ft=l?Ct:Mt,It=(0,d.useCallback)((e,t)=>{st.current?.insertText(kq(e,t))},[]),Lt=(0,d.useCallback)(e=>{let t=jq(e);t&&st.current?.insertText(t)},[]),Rt=(0,d.useCallback)((e,t,n)=>{st.current?.insertText(Aq(e,t,n))},[]),zt=n.sessionId;ae({onNewSession:e=>Ce(`kb-${Date.now()}`,e),activeCwd:se});let Bt=de&&!P,Vt=[{id:lq,label:s(`tabs.chat`),closable:!1,icon:(0,E.jsx)(`svg`,{width:p.lg,height:p.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,E.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:dq,label:s(`tabs.widgets`),badge:Pt,closable:!1,icon:(0,E.jsxs)(`svg`,{width:p.lg,height:p.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,E.jsx)(`rect`,{x:`3`,y:`3`,width:`7`,height:`7`,rx:`1`}),(0,E.jsx)(`rect`,{x:`14`,y:`3`,width:`7`,height:`7`,rx:`1`}),(0,E.jsx)(`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`}),(0,E.jsx)(`rect`,{x:`14`,y:`14`,width:`7`,height:`7`,rx:`1`})]})},...Re?[{id:uq,label:s(`config.title`),closable:!0,icon:(0,E.jsx)(Wr,{width:p.lg,height:p.lg,"aria-hidden":`true`})}]:[],...Ue],Ht=se?yG(se)||se:null,Ut=Ht?`Pi Web · ${Ht}`:`Pi Web`;(0,d.useEffect)(()=>{document.title=Ut},[Ut]),(0,d.useEffect)(()=>{let e=()=>{document.title=Ut};return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[Ut]);let Wt=oe(),Gt=(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`div`,{ref:ut,style:{padding:`2px 8px`,flexShrink:0,display:`flex`,justifyContent:`space-between`,gap:4},children:[{label:s(`config.title`),onClick:()=>Ke(),disabled:!1,icon:(0,E.jsx)(Wr,{width:p[`3xl`],height:p[`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`?()=>{}:()=>Zt(),disabled:!1,testId:`notify-permission`,color:Wt===`granted`?`var(--status-success)`:Wt===`denied`?`var(--status-error)`:`var(--accent)`,icon:(0,E.jsx)(`svg`,{width:p[`3xl`],height:p[`3xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:Wt===`denied`?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M8.7 3A6 6 0 0 1 18 8a21.3 21.3 0 0 0 .6 5`}),(0,E.jsx)(`path`,{d:`M17 17H3s3-2 3-9a4.67 4.67 0 0 1 .3-1.7`}),(0,E.jsx)(`path`,{d:`M10.3 21a1.94 1.94 0 0 0 3.4 0`}),(0,E.jsx)(`path`,{d:`m2 2 20 20`})]}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9`}),(0,E.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,E.jsxs)(`svg`,{width:p[`3xl`],height:p[`3xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`5`}),(0,E.jsx)(`line`,{x1:`12`,y1:`1`,x2:`12`,y2:`3`}),(0,E.jsx)(`line`,{x1:`12`,y1:`21`,x2:`12`,y2:`23`}),(0,E.jsx)(`line`,{x1:`4.22`,y1:`4.22`,x2:`5.64`,y2:`5.64`}),(0,E.jsx)(`line`,{x1:`18.36`,y1:`18.36`,x2:`19.78`,y2:`19.78`}),(0,E.jsx)(`line`,{x1:`1`,y1:`12`,x2:`3`,y2:`12`}),(0,E.jsx)(`line`,{x1:`21`,y1:`12`,x2:`23`,y2:`12`}),(0,E.jsx)(`line`,{x1:`4.22`,y1:`19.78`,x2:`5.64`,y2:`18.36`}),(0,E.jsx)(`line`,{x1:`18.36`,y1:`5.64`,x2:`19.78`,y2:`4.22`})]}):(0,E.jsx)(`svg`,{width:p[`3xl`],height:p[`3xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,E.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&&Qe(!1),gt(),vt(`language`)},onMouseEnter:()=>{gt(),_t!==`language`&&vt(`language`)},onMouseLeave:ht,disabled:!1,ref:dt,ariaExpanded:_t===`language`,noTooltip:!0,icon:(0,E.jsxs)(`svg`,{width:p[`3xl`],height:p[`3xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,E.jsx)(`line`,{x1:`2`,y1:`12`,x2:`22`,y2:`12`}),(0,E.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&&Qe(!1),gt(),vt(`fontSize`)},onMouseEnter:()=>{gt(),_t!==`fontSize`&&vt(`fontSize`)},onMouseLeave:ht,disabled:!1,ref:ft,ariaExpanded:_t===`fontSize`,noTooltip:!0,icon:(0,E.jsxs)(`svg`,{width:p[`3xl`],height:p[`3xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,E.jsx)(`polyline`,{points:`4 7 4 4 20 4 20 7`}),(0,E.jsx)(`line`,{x1:`9`,y1:`20`,x2:`15`,y2:`20`}),(0,E.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,color:u,ariaLabel:d,testId:f})=>{let p=(0,E.jsx)(`button`,{ref:o,onClick:t,disabled:i,"data-testid":f,"aria-label":d??e,"aria-pressed":s,"aria-haspopup":c===void 0?void 0:`menu`,"aria-expanded":c,style:{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`,height:32,padding:0,background:`none`,border:`none`,borderRadius:9,...u?{color:u}:{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});return l?(0,E.jsx)(`div`,{style:{flex:1,minWidth:0,display:`flex`},children:p},e):(0,E.jsx)(oi,{label:e,wrapperStyle:{flex:1,minWidth:0,display:`flex`},children:p},e)})}),(0,E.jsx)(t9,{selectedSessionId:j?.id??null,selectedSession:j,onSelectSession:Se,onNewSession:Ce,initialSessionId:zt,skipInitialProjectSelection:n.requestedCwd!==null,onInitialRestoreDone:Fe,refreshKey:F,onSessionDeleted:Oe,onUnseenSession:Ae,selectedCwd:j?.cwd??M,onCwdChange:Me,savedWorkspaces:b,onSavedWorkspacesChange:x,onOpenFile:Ge})]});if(!e)return(0,E.jsx)(Nq,{});let Kt=(0,E.jsx)(oi,{label:s(Ze?`sidebar.hide`:`sidebar.show`),children:(0,E.jsx)(`button`,{onClick:St,"aria-label":s(Ze?`sidebar.hide`:`sidebar.show`),"aria-pressed":Ze,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:V9,height:V9,padding:0,background:`none`,border:`none`,borderRight:`1px solid var(--border)`,color:Ze?`var(--text)`:`var(--text-muted)`,cursor:`pointer`,flexShrink:0,transition:`color 0.12s`,"--hover-color":`var(--text)`},className:`hover-shift`,children:(0,E.jsxs)(`svg`,{width:p[`4xl`],height:p[`4xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,E.jsx)(`rect`,{x:`3`,y:`3`,width:p[`4xl`],height:p[`4xl`],rx:`2`}),(0,E.jsx)(`line`,{x1:`9`,y1:`3`,x2:`9`,y2:`21`})]})})}),qt=P&&me?.requiresTrust&&!me.trusted?(0,E.jsx)(oi,{label:s(`trust.resourcesNotLoaded`),wrapperStyle:{height:`100%`},children:(0,E.jsxs)(`button`,{type:`button`,onClick:()=>{be(null),_e(!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,E.jsxs)(`svg`,{width:p.lg,height:p.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,E.jsx)(`path`,{d:`M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10Z`}),(0,E.jsx)(`path`,{d:`M12 8v4`}),(0,E.jsx)(`path`,{d:`M12 16h.01`})]}),!l&&(0,E.jsx)(`span`,{children:s(`trust.resourcesNotLoaded`)})]})}):null,Jt=(0,E.jsx)(oi,{label:s(Ft?`sidebar.hide`:`sidebar.show`),children:(0,E.jsx)(`button`,{onClick:()=>{l?wt(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:Ct?`var(--text)`:`var(--text-muted)`,cursor:`pointer`,flexShrink:0,transition:`color 0.12s`,"--hover-color":`var(--text)`},className:`hover-shift`,children:(0,E.jsxs)(`svg`,{width:p[`4xl`],height:p[`4xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,E.jsx)(`rect`,{x:`3`,y:`3`,width:p[`4xl`],height:p[`4xl`],rx:`2`}),(0,E.jsx)(`line`,{x1:`15`,y1:`3`,x2:`15`,y2:`21`})]})})});return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(he,{value:u,children:(0,E.jsx)(je,{value:{activeTopPanel:_t,toggleTopPanel:xt,closeTopPanel:()=>vt(null)},children:(0,E.jsx)(E.Fragment,{children:(0,E.jsxs)(ai,{delayDuration:0,children:[(0,E.jsx)(`style`,{children:`
486
486
  @media (max-width: 640px) {
487
487
  .sidebar-overlay-backdrop.sidebar-mobile-pending {
488
488
  opacity: 0 !important;
@@ -493,4 +493,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
493
493
  box-shadow: none;
494
494
  }
495
495
  }
496
- `}),(0,E.jsx)(an,{}),(0,E.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,E.jsx)(`div`,{className:`sidebar-overlay-backdrop${Qe?``:` sidebar-mobile-pending`}`,onClick:()=>Ze(!1),style:{position:`fixed`,inset:0,zIndex:199,background:`var(--overlay)`,opacity:+!!Xe,pointerEvents:Xe?`auto`:`none`,transition:`opacity 0.25s ease`}}),(0,E.jsx)(`div`,{ref:rt.panelRef,id:`session-sidebar`,className:`sidebar-container${Xe?` sidebar-open`:` sidebar-closed`}${Qe?``:` sidebar-mobile-pending`}${rt.isResizing?` sidebar-resizing`:``}`,"data-testid":`sidebar`,style:{"--sidebar-width":`${rt.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:Wt}),Xe&&(0,E.jsx)(oi,{label:`${s(`layout.resizeSidebar`)}: ${s(`layout.resizeHint`)}`,wrapperStyle:{display:`flex`,flex:`0 0 0`,width:0},children:(0,E.jsx)(`div`,{...rt.separatorProps,"aria-controls":`session-sidebar`,className:`panel-resize-handle sidebar-resize-handle${rt.isResizing?` is-resizing`:``}`,"data-resize-handle":`sidebar`})}),(0,E.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,overflow:`hidden`,minWidth:0},children:[gt&&vt&&(0,E.jsxs)(`div`,{onMouseEnter:ht,onMouseLeave:pt,style:{position:`fixed`,top:vt.top,left:vt.left,width:vt.width,maxHeight:`calc(100dvh - ${vt.top}px)`,overflowY:`auto`,zIndex:1500},children:[gt===`language`&&(0,E.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,E.jsx)(`button`,{type:`button`,onClick:()=>{o(e.id),_t(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,E.jsx)(`span`,{children:e.label})},e.id))}),gt===`fontSize`&&(0,E.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,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,fontSize:`var(--text-base)`,color:`var(--text-muted)`,marginBottom:8},children:[(0,E.jsx)(`span`,{children:s(`theme.fontSize`)}),(0,E.jsxs)(`span`,{style:{fontFamily:`var(--font-mono)`,color:`var(--text)`,fontWeight:600},children:[Math.round(k*100),`%`]})]}),(0,E.jsx)(`input`,{type:`range`,min:.85,max:1.3,step:.05,value:k,onChange:e=>A(Number(e.target.value)),"aria-label":s(`theme.fontSize`),style:{width:`100%`,accentColor:`var(--accent)`,cursor:`pointer`}}),(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,fontSize:`var(--text-xs)`,color:`var(--text-dim)`,marginTop:4},children:[(0,E.jsx)(`span`,{children:`85%`}),(0,E.jsx)(`span`,{children:`130%`})]})]})]}),(0,E.jsxs)(Gn,{tabs:Bt,activeTabId:Be?uq:wt?dq:Ve?fq(Ve.filePath):lq,leftExtra:Gt,rightExtra:qt,onSelectTab:e=>{if(e===`widgets`){Tt(!0),Ie(null);return}Tt(!1),Ie(e===`chat`?null:e)},onCloseTab:Je,tabBarRef:st,overlay:(0,E.jsxs)(E.Fragment,{children:[R===`validating`&&(0,E.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,E.jsx)(`div`,{style:{fontSize:`var(--text-xl)`,color:`var(--text)`},children:s(`workspace.opening`)}),(0,E.jsx)(`div`,{style:{maxWidth:`min(720px, 100%)`,overflowWrap:`anywhere`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-base)`},children:n.requestedCwd})]}),R===`error`&&(0,E.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,E.jsx)(`div`,{style:{fontSize:`var(--text-xl)`,color:`var(--status-error)`},children:s(`workspace.unable`)}),(0,E.jsx)(`div`,{style:{maxWidth:`min(720px, 100%)`,overflowWrap:`anywhere`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-base)`},children:n.requestedCwd}),(0,E.jsx)(`div`,{style:{maxWidth:720,fontSize:`var(--text-base)`},children:ue})]}),zt&&(se?(0,E.jsx)(`div`,{style:{height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`var(--text-muted)`,fontSize:`var(--text-2xl)`},children:s(`workspace.selectSession`)}):(0,E.jsxs)(`div`,{style:{height:`100%`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:12,userSelect:`none`},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-6xl)`,fontWeight:700,fontStyle:`italic`,color:`var(--accent)`},children:`Pi Web`}),(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,color:`var(--text-muted)`},children:s(`workspace.selectWorkspace`)})]}))]}),children:[(0,E.jsx)(Un,{id:uq,testId:`config-tab-pane`,children:(0,E.jsx)(sq,{section:Re,onSectionChange:ze,cwd:ee,sessionId:j?.id??null,onClose:qe,onOpenFile:We,sidebarWidth:rt.width,onSidebarWidthChange:rt.setWidth,widgetPanelWidth:at.width,onWidgetPanelWidthChange:at.setWidth,modelConfigFocus:Ue,defaultThinkingLevel:f,onDefaultThinkingLevelChange:m,compaction:h,onCompactionChange:e=>lt({firstPaint:{compaction:e}}),retry:g,onRetryChange:e=>lt({firstPaint:{retry:e}}),defaultProjectTrust:_,onDefaultProjectTrustChange:v,subagents:y,onSubagentsChange:e=>lt({firstPaint:{subagents:{defaultModel:e.defaultModel||void 0,defaultThinking:e.defaultThinking||void 0}}})})}),(0,E.jsx)(Un,{id:Ve?fq(Ve.filePath):`file:`,testId:`file-tab-pane`,children:Ve&&(0,E.jsx)(C7,{filePath:Ve.filePath,cwd:se??void 0,sourceSessionId:Ve.sourceSessionId,gitRefreshKey:re,initialDisplayMode:Ve.initialDisplayMode,onMentionLines:Lt,onSaved:()=>ie(e=>e+1),onOpenFile:e=>We(e,yG(e),{sourceSessionId:Ve.sourceSessionId})})}),(0,E.jsx)(Un,{id:lq,keepAlive:!0,testId:`chat-tab-pane`,scroll:`hidden`,activeWhen:P,children:(0,E.jsx)(`div`,{style:{flex:1,minHeight:0,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:(0,E.jsx)(V5,{session:j,newSessionCwd:M,onAgentEnd:Te,onSessionCreated:we,onSessionForked:De,modelsRefreshKey:I,onOpenModelConfig:Ke,chatInputRef:ot,onOpenFile:Ye,onSessionRenamed:Ee,windowTitleBase:Vt,toolbarExtra:Kt,closedWidgetKeys:Dt,onCloseWidget:Ot,onExtensionWidgetsChange:At,onExtensionDialogChange:e=>{xe.current=e}},te)})}),(0,E.jsx)(Un,{id:dq,keepAlive:!0,testId:`widgets-tab-pane`,zIndex:1,activeWhen:P,children:(0,E.jsx)(z9,{geometries:S,messages:w,onAddMessage:T,onRemoveMessage:D,onUpdateMessage:O,widgets:Et,closedKeys:Dt,onReopen:kt})})]})]}),Pt&&(0,E.jsx)(oi,{label:`${s(`layout.resizeWidgetPanel`)}: ${s(`layout.resizeHint`)}`,wrapperStyle:{display:`flex`,flex:`0 0 0`,width:0},children:(0,E.jsx)(`div`,{...at.separatorProps,"aria-controls":`widget-panel`,className:`panel-resize-handle widget-panel-resize-handle${at.isResizing?` is-resizing`:``}`,"data-resize-handle":`widget-panel`})}),!l&&!jt?null:(0,E.jsx)(`div`,{ref:at.panelRef,"aria-controls":`widget-panel`,style:l?{position:`fixed`,inset:0,zIndex:250,display:`flex`,flexDirection:`column`}:{"--widget-panel-width":`${at.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,E.jsx)(R9,{cwd:j?.cwd??M,onOpenFile:We,explorerRefreshKey:re,onExplorerRefresh:Ne,onAtMention:Ft,onAtMentions:It,sessionId:j?.id??null,onOpenConfig:e=>Ge(e)})})]}),ge&&ee&&(0,E.jsx)(E7,{cwd:ee,busy:ve,error:ye,onCancel:()=>{ve||_e(!1)},onConfirm:()=>void Me()})]})})})}),(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(o9,{}),(0,E.jsx)(y9,{})]})]})}var q9=class extends d.Component{constructor(...e){super(...e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){yx(e,`render error`)}render(){return this.state.hasError?(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:12,height:`100vh`,color:`var(--text)`,fontSize:`var(--text-base)`},children:[(0,E.jsx)(`span`,{children:`⚠️`}),(0,E.jsx)(`span`,{children:`Something went wrong while rendering.`}),(0,E.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 J9(){return(0,d.useEffect)(()=>{if(!(`serviceWorker`in navigator))return;let e=()=>{navigator.serviceWorker.register(`/sw.js?v=0.14.3`,{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 Y9=`piE2eFixtureDir`;function X9(){return typeof window>`u`?null:new URL(window.location.href).searchParams.get(`piE2eFixtureDir`)}function Z9(){if(typeof document>`u`)return;let e=X9();e&&(document.cookie=`${Y9}=${encodeURIComponent(e)}; path=/; SameSite=Lax`)}async function Q9(){Z9(),Iq(!0),zq();let e=Lq(`boot`),t=null;try{let n=await Se.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=>{yx(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`)||yx(e.error??e.message,`uncaught error`)}),(0,f.createRoot)(document.getElementById(`root`)).render((0,E.jsx)(d.StrictMode,{children:(0,E.jsx)(q9,{children:(0,E.jsxs)(M,{initialLocale:t,children:[(0,E.jsx)(K9,{}),(0,E.jsx)(J9,{})]})})}))}Q9();export{$1 as a,Z4 as i,$0 as n,T as o,q4 as r,i as s,T0 as t};
496
+ `}),(0,E.jsx)(an,{}),(0,E.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,E.jsx)(`div`,{className:`sidebar-overlay-backdrop${$e?``:` sidebar-mobile-pending`}`,onClick:()=>Qe(!1),style:{position:`fixed`,inset:0,zIndex:199,background:`var(--overlay)`,opacity:+!!Ze,pointerEvents:Ze?`auto`:`none`,transition:`opacity 0.25s ease`}}),(0,E.jsx)(`div`,{ref:it.panelRef,id:`session-sidebar`,className:`sidebar-container${Ze?` sidebar-open`:` sidebar-closed`}${$e?``:` sidebar-mobile-pending`}${it.isResizing?` sidebar-resizing`:``}`,"data-testid":`sidebar`,style:{"--sidebar-width":`${it.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}),Ze&&(0,E.jsx)(oi,{label:`${s(`layout.resizeSidebar`)}: ${s(`layout.resizeHint`)}`,wrapperStyle:{display:`flex`,flex:`0 0 0`,width:0},children:(0,E.jsx)(`div`,{...it.separatorProps,"aria-controls":`session-sidebar`,className:`panel-resize-handle sidebar-resize-handle${it.isResizing?` is-resizing`:``}`,"data-resize-handle":`sidebar`})}),(0,E.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,overflow:`hidden`,minWidth:0},children:[_t&&yt&&(0,E.jsxs)(`div`,{onMouseEnter:gt,onMouseLeave:ht,style:{position:`fixed`,top:yt.top,left:yt.left,width:yt.width,maxHeight:`calc(100dvh - ${yt.top}px)`,overflowY:`auto`,zIndex:1500},children:[_t===`language`&&(0,E.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,E.jsx)(`button`,{type:`button`,onClick:()=>{o(e.id),vt(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,E.jsx)(`span`,{children:e.label})},e.id))}),_t===`fontSize`&&(0,E.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,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,fontSize:`var(--text-base)`,color:`var(--text-muted)`,marginBottom:8},children:[(0,E.jsx)(`span`,{children:s(`theme.fontSize`)}),(0,E.jsxs)(`span`,{style:{fontFamily:`var(--font-mono)`,color:`var(--text)`,fontWeight:600},children:[Math.round(k*100),`%`]})]}),(0,E.jsx)(`input`,{type:`range`,min:.85,max:1.3,step:.05,value:k,onChange:e=>A(Number(e.target.value)),"aria-label":s(`theme.fontSize`),style:{width:`100%`,accentColor:`var(--accent)`,cursor:`pointer`}}),(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,fontSize:`var(--text-xs)`,color:`var(--text-dim)`,marginTop:4},children:[(0,E.jsx)(`span`,{children:`85%`}),(0,E.jsx)(`span`,{children:`130%`})]})]})]}),(0,E.jsxs)(Gn,{tabs:Vt,activeTabId:Ve?uq:Tt?dq:He?fq(He.filePath):lq,leftExtra:Kt,rightExtra:Jt,onSelectTab:e=>{if(e===`widgets`){Et(!0),Le(null);return}Et(!1),Le(e===`chat`?null:e)},onCloseTab:Ye,tabBarRef:ct,overlay:(0,E.jsxs)(E.Fragment,{children:[R===`validating`&&(0,E.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,E.jsx)(`div`,{style:{fontSize:`var(--text-xl)`,color:`var(--text)`},children:s(`workspace.opening`)}),(0,E.jsx)(`div`,{style:{maxWidth:`min(720px, 100%)`,overflowWrap:`anywhere`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-base)`},children:n.requestedCwd})]}),R===`error`&&(0,E.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,E.jsx)(`div`,{style:{fontSize:`var(--text-xl)`,color:`var(--status-error)`},children:s(`workspace.unable`)}),(0,E.jsx)(`div`,{style:{maxWidth:`min(720px, 100%)`,overflowWrap:`anywhere`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-base)`},children:n.requestedCwd}),(0,E.jsx)(`div`,{style:{maxWidth:720,fontSize:`var(--text-base)`},children:ue})]}),Bt&&(se?(0,E.jsx)(`div`,{style:{height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`var(--text-muted)`,fontSize:`var(--text-2xl)`},children:s(`workspace.selectSession`)}):(0,E.jsxs)(`div`,{style:{height:`100%`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:12,userSelect:`none`},children:[(0,E.jsx)(`div`,{style:{fontSize:`var(--text-6xl)`,fontWeight:700,fontStyle:`italic`,color:`var(--accent)`},children:`Pi Web`}),(0,E.jsx)(`div`,{style:{fontSize:`var(--text-base)`,color:`var(--text-muted)`},children:s(`workspace.selectWorkspace`)})]}))]}),children:[(0,E.jsx)(Un,{id:uq,testId:`config-tab-pane`,children:(0,E.jsx)(sq,{section:ze,onSectionChange:Be,cwd:ee,sessionId:j?.id??null,onClose:Je,onOpenFile:Ge,sidebarWidth:it.width,onSidebarWidthChange:it.setWidth,widgetPanelWidth:ot.width,onWidgetPanelWidthChange:ot.setWidth,modelConfigFocus:We,defaultThinkingLevel:f,onDefaultThinkingLevelChange:m,compaction:h,onCompactionChange:e=>lt({firstPaint:{compaction:e}}),retry:g,onRetryChange:e=>lt({firstPaint:{retry:e}}),defaultProjectTrust:_,onDefaultProjectTrustChange:v,subagents:y,onSubagentsChange:e=>lt({firstPaint:{subagents:{defaultModel:e.defaultModel||void 0,defaultThinking:e.defaultThinking||void 0}}})})}),(0,E.jsx)(Un,{id:He?fq(He.filePath):`file:`,testId:`file-tab-pane`,children:He&&(0,E.jsx)(C7,{filePath:He.filePath,cwd:se??void 0,sourceSessionId:He.sourceSessionId,gitRefreshKey:re,initialDisplayMode:He.initialDisplayMode,onMentionLines:Rt,onSaved:()=>ie(e=>e+1),onOpenFile:e=>Ge(e,yG(e),{sourceSessionId:He.sourceSessionId})})}),(0,E.jsx)(Un,{id:lq,keepAlive:!0,testId:`chat-tab-pane`,scroll:`hidden`,activeWhen:P,children:(0,E.jsx)(`div`,{style:{flex:1,minHeight:0,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:(0,E.jsx)(V5,{session:j,newSessionCwd:M,onAgentEnd:Te,onSessionCreated:we,onSessionForked:De,modelsRefreshKey:I,onOpenModelConfig:qe,chatInputRef:st,onOpenFile:Xe,onSessionRenamed:Ee,windowTitleBase:Ht,toolbarExtra:qt,closedWidgetKeys:Ot,onCloseWidget:kt,onExtensionWidgetsChange:jt,onExtensionDialogChange:e=>{xe.current=e}},te)})}),(0,E.jsx)(Un,{id:dq,keepAlive:!0,testId:`widgets-tab-pane`,zIndex:1,activeWhen:P,children:(0,E.jsx)(z9,{geometries:S,messages:w,onAddMessage:T,onRemoveMessage:D,onUpdateMessage:O,widgets:Dt,closedKeys:Ot,onReopen:At})})]})]}),Ft&&(0,E.jsx)(oi,{label:`${s(`layout.resizeWidgetPanel`)}: ${s(`layout.resizeHint`)}`,wrapperStyle:{display:`flex`,flex:`0 0 0`,width:0},children:(0,E.jsx)(`div`,{...ot.separatorProps,"aria-controls":`widget-panel`,className:`panel-resize-handle widget-panel-resize-handle${ot.isResizing?` is-resizing`:``}`,"data-resize-handle":`widget-panel`})}),!l&&!Mt?null:(0,E.jsx)(`div`,{ref:ot.panelRef,"aria-controls":`widget-panel`,style:l?{position:`fixed`,inset:0,zIndex:250,display:`flex`,flexDirection:`column`}:{"--widget-panel-width":`${ot.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,E.jsx)(R9,{cwd:j?.cwd??M,onOpenFile:Ge,explorerRefreshKey:re,onExplorerRefresh:Pe,onAtMention:It,onAtMentions:Lt,sessionId:j?.id??null,onOpenConfig:e=>Ke(e)})})]}),ge&&ee&&(0,E.jsx)(E7,{cwd:ee,busy:ve,error:ye,onCancel:()=>{ve||_e(!1)},onConfirm:()=>void Ne()})]})})})}),(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(o9,{}),(0,E.jsx)(y9,{})]})]})}var q9=class extends d.Component{constructor(...e){super(...e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){yx(e,`render error`)}render(){return this.state.hasError?(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:12,height:`100vh`,color:`var(--text)`,fontSize:`var(--text-base)`},children:[(0,E.jsx)(`span`,{children:`⚠️`}),(0,E.jsx)(`span`,{children:`Something went wrong while rendering.`}),(0,E.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 J9(){return(0,d.useEffect)(()=>{if(!(`serviceWorker`in navigator))return;let e=()=>{navigator.serviceWorker.register(`/sw.js?v=0.14.5`,{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 Y9=`piE2eFixtureDir`;function X9(){return typeof window>`u`?null:new URL(window.location.href).searchParams.get(`piE2eFixtureDir`)}function Z9(){if(typeof document>`u`)return;let e=X9();e&&(document.cookie=`${Y9}=${encodeURIComponent(e)}; path=/; SameSite=Lax`)}async function Q9(){Z9(),Iq(!0),zq();let e=Lq(`boot`),t=null;try{let n=await Se.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=>{yx(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`)||yx(e.error??e.message,`uncaught error`)}),(0,f.createRoot)(document.getElementById(`root`)).render((0,E.jsx)(d.StrictMode,{children:(0,E.jsx)(q9,{children:(0,E.jsxs)(M,{initialLocale:t,children:[(0,E.jsx)(K9,{}),(0,E.jsx)(J9,{})]})})}))}Q9();export{$1 as a,Z4 as i,$0 as n,T as o,q4 as r,i as s,T0 as t};