@i14ks/ccv 0.45.0 → 0.47.0

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 (100) hide show
  1. package/THIRD-PARTY-NOTICES.md +1688 -461
  2. package/bundle/ccv.mjs +1377 -216
  3. package/package.json +1 -1
  4. package/web/assets/MarkdownTextEditor-B3B8_rFw.js +60 -0
  5. package/web/assets/{abnfDiagram-S7VZAUFO-CNj02zRV.js → abnfDiagram-S7VZAUFO-DJLBYC4E.js} +1 -1
  6. package/web/assets/{architectureDiagram-YGSQEFNW-UnapXBnq.js → architectureDiagram-YGSQEFNW-CjOULv4y.js} +1 -1
  7. package/web/assets/{blockDiagram-APKKGZFW-By1mA1_j.js → blockDiagram-APKKGZFW-BxtAGaqL.js} +1 -1
  8. package/web/assets/{c4Diagram-KJ2TOQU5-DxR8Tp-K.js → c4Diagram-KJ2TOQU5-DixwjD35.js} +1 -1
  9. package/web/assets/{chunk-2Q5K7J3B-CfcIu3Ah.js → chunk-2Q5K7J3B-D5RSYb7c.js} +1 -1
  10. package/web/assets/{chunk-5VM5RSS4-Ddk-Fv2Y.js → chunk-5VM5RSS4-Zw9KRmHP.js} +1 -1
  11. package/web/assets/{chunk-HFQBQIA3-DqPjzTQu.js → chunk-HFQBQIA3-Dz3Jqjvc.js} +1 -1
  12. package/web/assets/{chunk-JWPE2WC7-VUIzkY_4.js → chunk-JWPE2WC7-CYC8lXvq.js} +1 -1
  13. package/web/assets/{chunk-KQLB2F66-Bi85gKHH.js → chunk-KQLB2F66-BpsntY2B.js} +2 -2
  14. package/web/assets/{chunk-KS47KZWR-BZwBvPDM.js → chunk-KS47KZWR-CIw-CgK1.js} +1 -1
  15. package/web/assets/{chunk-OY52VR5R-B_DWv6kS.js → chunk-OY52VR5R-DyNxKUIK.js} +1 -1
  16. package/web/assets/{chunk-TU62E6Q5-BZ5M8LNU.js → chunk-TU62E6Q5-CHgxHE0R.js} +1 -1
  17. package/web/assets/{chunk-XXDRQBXY-DcC5f1oO.js → chunk-XXDRQBXY-CQ0zLLMg.js} +1 -1
  18. package/web/assets/{classDiagram-v2-L25IHNXF-CiZfI5zH.js → classDiagram-v2-L25IHNXF-DyN77x6F.js} +1 -1
  19. package/web/assets/codemirror-Dh-4cMdO.js +1 -0
  20. package/web/assets/codemirrorImages-BHHbVBQN.js +1 -0
  21. package/web/assets/{cose-bilkent-JH36ORCC-OecldNrx.js → cose-bilkent-JH36ORCC-D1H3X9ot.js} +1 -1
  22. package/web/assets/{cynefin-EF2NZ3EQ-BHDQXZEc.js → cynefin-EF2NZ3EQ-B4SsJI8I.js} +1 -1
  23. package/web/assets/{cynefinDiagram-L36ESFBY-COnZzGKx.js → cynefinDiagram-L36ESFBY-D543PDJ4.js} +1 -1
  24. package/web/assets/{dagre-SPEB5RXH-XxNubJTv.js → dagre-SPEB5RXH-CksMpjx8.js} +1 -1
  25. package/web/assets/{diagram-3B7GL73J-BEpsszbY.js → diagram-3B7GL73J-DywKf_aW.js} +1 -1
  26. package/web/assets/{diagram-DNEMPZML-DAKChpAZ.js → diagram-DNEMPZML-QaEKUl5W.js} +1 -1
  27. package/web/assets/{diagram-L3MUGCDN-CvDcHjXy.js → diagram-L3MUGCDN-51y_ny8R.js} +1 -1
  28. package/web/assets/{diagram-LA4NIPWU-BO-n7J3S.js → diagram-LA4NIPWU-Cg_nbBL_.js} +1 -1
  29. package/web/assets/{diagram-MHCOC4E2-BW8MchVY.js → diagram-MHCOC4E2-DFHCPZYb.js} +1 -1
  30. package/web/assets/{diagram-XPFHEONP-DjiEBmkx.js → diagram-XPFHEONP-dBKRRNZa.js} +1 -1
  31. package/web/assets/{ebnfDiagram-UZSYDL2S-DKGunvzj.js → ebnfDiagram-UZSYDL2S-BwTgNIAm.js} +1 -1
  32. package/web/assets/{elk-XV6XMXQE-b9lmTG03.js → elk-XV6XMXQE-BR-xb3ob.js} +1 -1
  33. package/web/assets/{erDiagram-EYBAPDEH-DT_k1OGC.js → erDiagram-EYBAPDEH-BB1wg_fV.js} +1 -1
  34. package/web/assets/{flowDiagram-MALGAFMO-BUqGlWOn.js → flowDiagram-MALGAFMO-CRDw4nX3.js} +1 -1
  35. package/web/assets/{ganttDiagram-23REXITY-Cbr_kL7O.js → ganttDiagram-23REXITY-MYQEYJ-I.js} +1 -1
  36. package/web/assets/{gitGraphDiagram-STJD7YCW-Cw6S4Bcr.js → gitGraphDiagram-STJD7YCW-Dhn0_pRI.js} +1 -1
  37. package/web/assets/{index-Cl3pbMFT.js → index-7ivf0ID5.js} +1 -1
  38. package/web/assets/index-BJHr8-zK.js +1 -0
  39. package/web/assets/{index-BLmLDrEY.js → index-BJdwUs7I.js} +1 -1
  40. package/web/assets/index-BK9FAkRg.js +1 -0
  41. package/web/assets/index-BLLxsupM.js +13 -0
  42. package/web/assets/{index-DQnArn0a.js → index-Bod45-bM.js} +2 -2
  43. package/web/assets/index-C13EW7hw.js +3 -0
  44. package/web/assets/index-CE1Pd4z7.js +7 -0
  45. package/web/assets/{index-Du5Qar1T.js → index-CaL1Ugw4.js} +1 -1
  46. package/web/assets/index-Cbs1XkJa.js +1 -0
  47. package/web/assets/index-DIouQVG8.js +1 -0
  48. package/web/assets/index-DRJgyVu5.js +1 -0
  49. package/web/assets/index-DaBTH0ea.js +1 -0
  50. package/web/assets/{index-DvFMS_gT.js → index-DlMbLAnE.js} +4 -4
  51. package/web/assets/index-DqLAItfN.js +1 -0
  52. package/web/assets/index-DqxhStF7.js +1 -0
  53. package/web/assets/index-DtR2v4RD.js +1 -0
  54. package/web/assets/{index-dkD_YPIB.js → index-DtwnaAnT.js} +2 -2
  55. package/web/assets/index-PAORgBv5.js +7 -0
  56. package/web/assets/index-Vcq4gwWv.js +1 -0
  57. package/web/assets/index-eIS20v-m.css +1 -0
  58. package/web/assets/index-gy3hTMSD.js +167 -0
  59. package/web/assets/index-v-BrSiuM.js +1 -0
  60. package/web/assets/{infoDiagram-KBXO4MBG-CusT957H.js → infoDiagram-KBXO4MBG-By-j1Q2z.js} +1 -1
  61. package/web/assets/{ishikawaDiagram-M35NCXHK-DlxUISb3.js → ishikawaDiagram-M35NCXHK-Cj7pfKCW.js} +1 -1
  62. package/web/assets/{journeyDiagram-OPLOXDXO-B7X0y02x.js → journeyDiagram-OPLOXDXO-B7acuJLi.js} +1 -1
  63. package/web/assets/{kanban-definition-BZKZHSQY-DzEKGEDz.js → kanban-definition-BZKZHSQY-B0N1FM8N.js} +1 -1
  64. package/web/assets/{mermaid.core-BM9CG8VU.js → mermaid.core-Rt-JZroF.js} +5 -5
  65. package/web/assets/{mindmap-definition-I2QAS2VK-DgE3KgdI.js → mindmap-definition-I2QAS2VK-Du6Bq1D4.js} +1 -1
  66. package/web/assets/{pegDiagram-FD4XPPHP-2wTO2ZJT.js → pegDiagram-FD4XPPHP-Cx3y_VAW.js} +1 -1
  67. package/web/assets/{pieDiagram-J4AKIIQI-CKRDBux_.js → pieDiagram-J4AKIIQI-DrpfcCiI.js} +1 -1
  68. package/web/assets/{quadrantDiagram-XTYBLID2-Ceg_KG7b.js → quadrantDiagram-XTYBLID2-BbJ2d8x8.js} +1 -1
  69. package/web/assets/{railroadDiagram-MRQ6NCDL-DkyGV8eQ.js → railroadDiagram-MRQ6NCDL-C8B9eHMq.js} +1 -1
  70. package/web/assets/{requirementDiagram-Y7LWUY3S-DEpWnvQ5.js → requirementDiagram-Y7LWUY3S--8FcyGsP.js} +1 -1
  71. package/web/assets/{sankeyDiagram-WGJFYUXA-D06-ObVT.js → sankeyDiagram-WGJFYUXA-CYq-mQmD.js} +1 -1
  72. package/web/assets/{sequenceDiagram-5NDRBG5M-CNgwRsPl.js → sequenceDiagram-5NDRBG5M-C-Llg4wI.js} +1 -1
  73. package/web/assets/{sizeCapture-INFHLROL-DLPIeXe1.js → sizeCapture-INFHLROL-80lnJyWe.js} +1 -1
  74. package/web/assets/{stateDiagram-v2-FJ4FJNEA-CjTQ5dpG.js → stateDiagram-v2-FJ4FJNEA-QZyfUycB.js} +1 -1
  75. package/web/assets/{swimlanes-UMQ2AFYF-eJkqG_t9.js → swimlanes-UMQ2AFYF-BxT8Ql8H.js} +1 -1
  76. package/web/assets/swimlanesDiagram-OMPLPG4O-BZDLC88s.js +8 -0
  77. package/web/assets/{timeline-definition-SEUHKTQE-CUTdCFpH.js → timeline-definition-SEUHKTQE-DWywP4r0.js} +4 -4
  78. package/web/assets/{usecaseDiagram-AFA6YXN4-BHojL49I.js → usecaseDiagram-AFA6YXN4-BgmSQD90.js} +1 -1
  79. package/web/assets/{vennDiagram-NNMJR3RB-Bk5isaer.js → vennDiagram-NNMJR3RB-B9ikZp8F.js} +1 -1
  80. package/web/assets/{wardleyDiagram-S7YFUSEH-DolRO_uR.js → wardleyDiagram-S7YFUSEH-CptNVfVi.js} +1 -1
  81. package/web/assets/{xychartDiagram-GGNKY7IX-V3IUgdp-.js → xychartDiagram-GGNKY7IX-DV4TDhUT.js} +1 -1
  82. package/web/index.html +2 -2
  83. package/web/assets/codemirror-B_zWrnLp.js +0 -1
  84. package/web/assets/index-B1IBfUz9.css +0 -1
  85. package/web/assets/index-B5vdEupB.js +0 -1
  86. package/web/assets/index-BO8effSp.js +0 -1
  87. package/web/assets/index-BYJrmc8N.js +0 -1
  88. package/web/assets/index-B_SP1UWv.js +0 -1
  89. package/web/assets/index-BdwT0-rx.js +0 -152
  90. package/web/assets/index-BoggcMUx.js +0 -7
  91. package/web/assets/index-COYbUhJ2.js +0 -7
  92. package/web/assets/index-CfWAy0wv.js +0 -1
  93. package/web/assets/index-Ch08lakn.js +0 -1
  94. package/web/assets/index-CnRY1mXR.js +0 -1
  95. package/web/assets/index-Ctc6whsQ.js +0 -1
  96. package/web/assets/index-D7DCXKEo.js +0 -13
  97. package/web/assets/index-DnFYUU1x.js +0 -3
  98. package/web/assets/index-HQJZpoPE.js +0 -1
  99. package/web/assets/index-qkpXZNl3.js +0 -1
  100. package/web/assets/swimlanesDiagram-OMPLPG4O-D-nejod0.js +0 -8
@@ -0,0 +1,167 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-BLLxsupM.js","./index-BJdwUs7I.js","./index-7ivf0ID5.js","./index-BHot-lnj.js","./index-PAORgBv5.js","./index-Vcq4gwWv.js","./index-CaL1Ugw4.js","./index-DIouQVG8.js","./index-DqxhStF7.js","./index-DqLAItfN.js","./index-DlMbLAnE.js","./index-C13EW7hw.js","./index-BK9FAkRg.js","./index-Cbs1XkJa.js","./index-DaBTH0ea.js","./index-v-BrSiuM.js","./index-CE1Pd4z7.js","./index-DRJgyVu5.js","./index-Bod45-bM.js","./index-DtR2v4RD.js","./index-DtwnaAnT.js","./index-BJHr8-zK.js","./codemirror-Dh-4cMdO.js","./codemirrorImages-BHHbVBQN.js","./katex-DxB02YXk.css","./mermaid.core-Rt-JZroF.js","./_commonjsHelpers-CqkleIqs.js","./MarkdownTextEditor-B3B8_rFw.js","./xterm-D6Mng-DB.js","./addon-fit-CevVMrUA.js","./addon-web-links-CnB65OV_.js","./xterm-DYP7pi_n.css"])))=>i.map(i=>d[i]);
2
+ var Ej=Object.defineProperty;var M_=n=>{throw TypeError(n)};var Cj=(n,l,i)=>l in n?Ej(n,l,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[l]=i;var nn=(n,l,i)=>Cj(n,typeof l!="symbol"?l+"":l,i),mp=(n,l,i)=>l.has(n)||M_("Cannot "+i);var tt=(n,l,i)=>(mp(n,l,"read from private field"),i?i.call(n):l.get(n)),On=(n,l,i)=>l.has(n)?M_("Cannot add the same private member more than once"):l instanceof WeakSet?l.add(n):l.set(n,i),$t=(n,l,i,r)=>(mp(n,l,"write to private field"),r?r.call(n,i):l.set(n,i),i),os=(n,l,i)=>(mp(n,l,"access private method"),i);(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const u of o)if(u.type==="childList")for(const m of u.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&r(m)}).observe(document,{childList:!0,subtree:!0});function i(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function r(o){if(o.ep)return;o.ep=!0;const u=i(o);fetch(o.href,u)}})();var pp={exports:{}},pd={};/**
3
+ * @license React
4
+ * react-jsx-runtime.production.js
5
+ *
6
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */var R_;function Tj(){if(R_)return pd;R_=1;var n=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function i(r,o,u){var m=null;if(u!==void 0&&(m=""+u),o.key!==void 0&&(m=""+o.key),"key"in o){u={};for(var p in o)p!=="key"&&(u[p]=o[p])}else u=o;return o=u.ref,{$$typeof:n,type:r,key:m,ref:o!==void 0?o:null,props:u}}return pd.Fragment=l,pd.jsx=i,pd.jsxs=i,pd}var D_;function Aj(){return D_||(D_=1,pp.exports=Tj()),pp.exports}var s=Aj(),gp={exports:{}},ot={};/**
11
+ * @license React
12
+ * react.production.js
13
+ *
14
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
15
+ *
16
+ * This source code is licensed under the MIT license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ */var L_;function Mj(){if(L_)return ot;L_=1;var n=Symbol.for("react.transitional.element"),l=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),m=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),_=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),j=Symbol.for("react.activity"),v=Symbol.iterator;function k(A){return A===null||typeof A!="object"?null:(A=v&&A[v]||A["@@iterator"],typeof A=="function"?A:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,C={};function I(A,W,me){this.props=A,this.context=W,this.refs=C,this.updater=me||N}I.prototype.isReactComponent={},I.prototype.setState=function(A,W){if(typeof A!="object"&&typeof A!="function"&&A!=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,A,W,"setState")},I.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function D(){}D.prototype=I.prototype;function G(A,W,me){this.props=A,this.context=W,this.refs=C,this.updater=me||N}var P=G.prototype=new D;P.constructor=G,E(P,I.prototype),P.isPureReactComponent=!0;var V=Array.isArray;function z(){}var H={H:null,A:null,T:null,S:null},te=Object.prototype.hasOwnProperty;function F(A,W,me){var Ee=me.ref;return{$$typeof:n,type:A,key:W,ref:Ee!==void 0?Ee:null,props:me}}function fe(A,W){return F(A.type,W,A.props)}function Q(A){return typeof A=="object"&&A!==null&&A.$$typeof===n}function X(A){var W={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(me){return W[me]})}var ge=/\/+/g;function U(A,W){return typeof A=="object"&&A!==null&&A.key!=null?X(""+A.key):W.toString(36)}function L(A){switch(A.status){case"fulfilled":return A.value;case"rejected":throw A.reason;default:switch(typeof A.status=="string"?A.then(z,z):(A.status="pending",A.then(function(W){A.status==="pending"&&(A.status="fulfilled",A.value=W)},function(W){A.status==="pending"&&(A.status="rejected",A.reason=W)})),A.status){case"fulfilled":return A.value;case"rejected":throw A.reason}}throw A}function M(A,W,me,Ee,$){var de=typeof A;(de==="undefined"||de==="boolean")&&(A=null);var ae=!1;if(A===null)ae=!0;else switch(de){case"bigint":case"string":case"number":ae=!0;break;case"object":switch(A.$$typeof){case n:case l:ae=!0;break;case b:return ae=A._init,M(ae(A._payload),W,me,Ee,$)}}if(ae)return $=$(A),ae=Ee===""?"."+U(A,0):Ee,V($)?(me="",ae!=null&&(me=ae.replace(ge,"$&/")+"/"),M($,W,me,"",function(Ge){return Ge})):$!=null&&(Q($)&&($=fe($,me+($.key==null||A&&A.key===$.key?"":(""+$.key).replace(ge,"$&/")+"/")+ae)),W.push($)),1;ae=0;var qe=Ee===""?".":Ee+":";if(V(A))for(var Se=0;Se<A.length;Se++)Ee=A[Se],de=qe+U(Ee,Se),ae+=M(Ee,W,me,de,$);else if(Se=k(A),typeof Se=="function")for(A=Se.call(A),Se=0;!(Ee=A.next()).done;)Ee=Ee.value,de=qe+U(Ee,Se++),ae+=M(Ee,W,me,de,$);else if(de==="object"){if(typeof A.then=="function")return M(L(A),W,me,Ee,$);throw W=String(A),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return ae}function O(A,W,me){if(A==null)return A;var Ee=[],$=0;return M(A,Ee,"","",function(de){return W.call(me,de,$++)}),Ee}function J(A){if(A._status===-1){var W=A._result;W=W(),W.then(function(me){(A._status===0||A._status===-1)&&(A._status=1,A._result=me)},function(me){(A._status===0||A._status===-1)&&(A._status=2,A._result=me)}),A._status===-1&&(A._status=0,A._result=W)}if(A._status===1)return A._result.default;throw A._result}var le=typeof reportError=="function"?reportError:function(A){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof A=="object"&&A!==null&&typeof A.message=="string"?String(A.message):String(A),error:A});if(!window.dispatchEvent(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",A);return}console.error(A)},ce={map:O,forEach:function(A,W,me){O(A,function(){W.apply(this,arguments)},me)},count:function(A){var W=0;return O(A,function(){W++}),W},toArray:function(A){return O(A,function(W){return W})||[]},only:function(A){if(!Q(A))throw Error("React.Children.only expected to receive a single React element child.");return A}};return ot.Activity=j,ot.Children=ce,ot.Component=I,ot.Fragment=i,ot.Profiler=o,ot.PureComponent=G,ot.StrictMode=r,ot.Suspense=g,ot.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=H,ot.__COMPILER_RUNTIME={__proto__:null,c:function(A){return H.H.useMemoCache(A)}},ot.cache=function(A){return function(){return A.apply(null,arguments)}},ot.cacheSignal=function(){return null},ot.cloneElement=function(A,W,me){if(A==null)throw Error("The argument must be a React element, but you passed "+A+".");var Ee=E({},A.props),$=A.key;if(W!=null)for(de in W.key!==void 0&&($=""+W.key),W)!te.call(W,de)||de==="key"||de==="__self"||de==="__source"||de==="ref"&&W.ref===void 0||(Ee[de]=W[de]);var de=arguments.length-2;if(de===1)Ee.children=me;else if(1<de){for(var ae=Array(de),qe=0;qe<de;qe++)ae[qe]=arguments[qe+2];Ee.children=ae}return F(A.type,$,Ee)},ot.createContext=function(A){return A={$$typeof:m,_currentValue:A,_currentValue2:A,_threadCount:0,Provider:null,Consumer:null},A.Provider=A,A.Consumer={$$typeof:u,_context:A},A},ot.createElement=function(A,W,me){var Ee,$={},de=null;if(W!=null)for(Ee in W.key!==void 0&&(de=""+W.key),W)te.call(W,Ee)&&Ee!=="key"&&Ee!=="__self"&&Ee!=="__source"&&($[Ee]=W[Ee]);var ae=arguments.length-2;if(ae===1)$.children=me;else if(1<ae){for(var qe=Array(ae),Se=0;Se<ae;Se++)qe[Se]=arguments[Se+2];$.children=qe}if(A&&A.defaultProps)for(Ee in ae=A.defaultProps,ae)$[Ee]===void 0&&($[Ee]=ae[Ee]);return F(A,de,$)},ot.createRef=function(){return{current:null}},ot.forwardRef=function(A){return{$$typeof:p,render:A}},ot.isValidElement=Q,ot.lazy=function(A){return{$$typeof:b,_payload:{_status:-1,_result:A},_init:J}},ot.memo=function(A,W){return{$$typeof:_,type:A,compare:W===void 0?null:W}},ot.startTransition=function(A){var W=H.T,me={};H.T=me;try{var Ee=A(),$=H.S;$!==null&&$(me,Ee),typeof Ee=="object"&&Ee!==null&&typeof Ee.then=="function"&&Ee.then(z,le)}catch(de){le(de)}finally{W!==null&&me.types!==null&&(W.types=me.types),H.T=W}},ot.unstable_useCacheRefresh=function(){return H.H.useCacheRefresh()},ot.use=function(A){return H.H.use(A)},ot.useActionState=function(A,W,me){return H.H.useActionState(A,W,me)},ot.useCallback=function(A,W){return H.H.useCallback(A,W)},ot.useContext=function(A){return H.H.useContext(A)},ot.useDebugValue=function(){},ot.useDeferredValue=function(A,W){return H.H.useDeferredValue(A,W)},ot.useEffect=function(A,W){return H.H.useEffect(A,W)},ot.useEffectEvent=function(A){return H.H.useEffectEvent(A)},ot.useId=function(){return H.H.useId()},ot.useImperativeHandle=function(A,W,me){return H.H.useImperativeHandle(A,W,me)},ot.useInsertionEffect=function(A,W){return H.H.useInsertionEffect(A,W)},ot.useLayoutEffect=function(A,W){return H.H.useLayoutEffect(A,W)},ot.useMemo=function(A,W){return H.H.useMemo(A,W)},ot.useOptimistic=function(A,W){return H.H.useOptimistic(A,W)},ot.useReducer=function(A,W,me){return H.H.useReducer(A,W,me)},ot.useRef=function(A){return H.H.useRef(A)},ot.useState=function(A){return H.H.useState(A)},ot.useSyncExternalStore=function(A,W,me){return H.H.useSyncExternalStore(A,W,me)},ot.useTransition=function(){return H.H.useTransition()},ot.version="19.2.8",ot}var O_;function bg(){return O_||(O_=1,gp.exports=Mj()),gp.exports}var x=bg(),xp={exports:{}},gd={},_p={exports:{}},bp={};/**
19
+ * @license React
20
+ * scheduler.production.js
21
+ *
22
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
23
+ *
24
+ * This source code is licensed under the MIT license found in the
25
+ * LICENSE file in the root directory of this source tree.
26
+ */var z_;function Rj(){return z_||(z_=1,(function(n){function l(M,O){var J=M.length;M.push(O);e:for(;0<J;){var le=J-1>>>1,ce=M[le];if(0<o(ce,O))M[le]=O,M[J]=ce,J=le;else break e}}function i(M){return M.length===0?null:M[0]}function r(M){if(M.length===0)return null;var O=M[0],J=M.pop();if(J!==O){M[0]=J;e:for(var le=0,ce=M.length,A=ce>>>1;le<A;){var W=2*(le+1)-1,me=M[W],Ee=W+1,$=M[Ee];if(0>o(me,J))Ee<ce&&0>o($,me)?(M[le]=$,M[Ee]=J,le=Ee):(M[le]=me,M[W]=J,le=W);else if(Ee<ce&&0>o($,J))M[le]=$,M[Ee]=J,le=Ee;else break e}}return O}function o(M,O){var J=M.sortIndex-O.sortIndex;return J!==0?J:M.id-O.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;n.unstable_now=function(){return u.now()}}else{var m=Date,p=m.now();n.unstable_now=function(){return m.now()-p}}var g=[],_=[],b=1,j=null,v=3,k=!1,N=!1,E=!1,C=!1,I=typeof setTimeout=="function"?setTimeout:null,D=typeof clearTimeout=="function"?clearTimeout:null,G=typeof setImmediate<"u"?setImmediate:null;function P(M){for(var O=i(_);O!==null;){if(O.callback===null)r(_);else if(O.startTime<=M)r(_),O.sortIndex=O.expirationTime,l(g,O);else break;O=i(_)}}function V(M){if(E=!1,P(M),!N)if(i(g)!==null)N=!0,z||(z=!0,X());else{var O=i(_);O!==null&&L(V,O.startTime-M)}}var z=!1,H=-1,te=5,F=-1;function fe(){return C?!0:!(n.unstable_now()-F<te)}function Q(){if(C=!1,z){var M=n.unstable_now();F=M;var O=!0;try{e:{N=!1,E&&(E=!1,D(H),H=-1),k=!0;var J=v;try{t:{for(P(M),j=i(g);j!==null&&!(j.expirationTime>M&&fe());){var le=j.callback;if(typeof le=="function"){j.callback=null,v=j.priorityLevel;var ce=le(j.expirationTime<=M);if(M=n.unstable_now(),typeof ce=="function"){j.callback=ce,P(M),O=!0;break t}j===i(g)&&r(g),P(M)}else r(g);j=i(g)}if(j!==null)O=!0;else{var A=i(_);A!==null&&L(V,A.startTime-M),O=!1}}break e}finally{j=null,v=J,k=!1}O=void 0}}finally{O?X():z=!1}}}var X;if(typeof G=="function")X=function(){G(Q)};else if(typeof MessageChannel<"u"){var ge=new MessageChannel,U=ge.port2;ge.port1.onmessage=Q,X=function(){U.postMessage(null)}}else X=function(){I(Q,0)};function L(M,O){H=I(function(){M(n.unstable_now())},O)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(M){M.callback=null},n.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):te=0<M?Math.floor(1e3/M):5},n.unstable_getCurrentPriorityLevel=function(){return v},n.unstable_next=function(M){switch(v){case 1:case 2:case 3:var O=3;break;default:O=v}var J=v;v=O;try{return M()}finally{v=J}},n.unstable_requestPaint=function(){C=!0},n.unstable_runWithPriority=function(M,O){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var J=v;v=M;try{return O()}finally{v=J}},n.unstable_scheduleCallback=function(M,O,J){var le=n.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?le+J:le):J=le,M){case 1:var ce=-1;break;case 2:ce=250;break;case 5:ce=1073741823;break;case 4:ce=1e4;break;default:ce=5e3}return ce=J+ce,M={id:b++,callback:O,priorityLevel:M,startTime:J,expirationTime:ce,sortIndex:-1},J>le?(M.sortIndex=J,l(_,M),i(g)===null&&M===i(_)&&(E?(D(H),H=-1):E=!0,L(V,J-le))):(M.sortIndex=ce,l(g,M),N||k||(N=!0,z||(z=!0,X()))),M},n.unstable_shouldYield=fe,n.unstable_wrapCallback=function(M){var O=v;return function(){var J=v;v=O;try{return M.apply(this,arguments)}finally{v=J}}}})(bp)),bp}var I_;function Dj(){return I_||(I_=1,_p.exports=Rj()),_p.exports}var yp={exports:{}},Vs={};/**
27
+ * @license React
28
+ * react-dom.production.js
29
+ *
30
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
31
+ *
32
+ * This source code is licensed under the MIT license found in the
33
+ * LICENSE file in the root directory of this source tree.
34
+ */var U_;function Lj(){if(U_)return Vs;U_=1;var n=bg();function l(g){var _="https://react.dev/errors/"+g;if(1<arguments.length){_+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)_+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+g+"; visit "+_+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var r={d:{f:i,r:function(){throw Error(l(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for("react.portal");function u(g,_,b){var j=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:j==null?null:""+j,children:g,containerInfo:_,implementation:b}}var m=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function p(g,_){if(g==="font")return"";if(typeof _=="string")return _==="use-credentials"?_:""}return Vs.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Vs.createPortal=function(g,_){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!_||_.nodeType!==1&&_.nodeType!==9&&_.nodeType!==11)throw Error(l(299));return u(g,_,null,b)},Vs.flushSync=function(g){var _=m.T,b=r.p;try{if(m.T=null,r.p=2,g)return g()}finally{m.T=_,r.p=b,r.d.f()}},Vs.preconnect=function(g,_){typeof g=="string"&&(_?(_=_.crossOrigin,_=typeof _=="string"?_==="use-credentials"?_:"":void 0):_=null,r.d.C(g,_))},Vs.prefetchDNS=function(g){typeof g=="string"&&r.d.D(g)},Vs.preinit=function(g,_){if(typeof g=="string"&&_&&typeof _.as=="string"){var b=_.as,j=p(b,_.crossOrigin),v=typeof _.integrity=="string"?_.integrity:void 0,k=typeof _.fetchPriority=="string"?_.fetchPriority:void 0;b==="style"?r.d.S(g,typeof _.precedence=="string"?_.precedence:void 0,{crossOrigin:j,integrity:v,fetchPriority:k}):b==="script"&&r.d.X(g,{crossOrigin:j,integrity:v,fetchPriority:k,nonce:typeof _.nonce=="string"?_.nonce:void 0})}},Vs.preinitModule=function(g,_){if(typeof g=="string")if(typeof _=="object"&&_!==null){if(_.as==null||_.as==="script"){var b=p(_.as,_.crossOrigin);r.d.M(g,{crossOrigin:b,integrity:typeof _.integrity=="string"?_.integrity:void 0,nonce:typeof _.nonce=="string"?_.nonce:void 0})}}else _==null&&r.d.M(g)},Vs.preload=function(g,_){if(typeof g=="string"&&typeof _=="object"&&_!==null&&typeof _.as=="string"){var b=_.as,j=p(b,_.crossOrigin);r.d.L(g,b,{crossOrigin:j,integrity:typeof _.integrity=="string"?_.integrity:void 0,nonce:typeof _.nonce=="string"?_.nonce:void 0,type:typeof _.type=="string"?_.type:void 0,fetchPriority:typeof _.fetchPriority=="string"?_.fetchPriority:void 0,referrerPolicy:typeof _.referrerPolicy=="string"?_.referrerPolicy:void 0,imageSrcSet:typeof _.imageSrcSet=="string"?_.imageSrcSet:void 0,imageSizes:typeof _.imageSizes=="string"?_.imageSizes:void 0,media:typeof _.media=="string"?_.media:void 0})}},Vs.preloadModule=function(g,_){if(typeof g=="string")if(_){var b=p(_.as,_.crossOrigin);r.d.m(g,{as:typeof _.as=="string"&&_.as!=="script"?_.as:void 0,crossOrigin:b,integrity:typeof _.integrity=="string"?_.integrity:void 0})}else r.d.m(g)},Vs.requestFormReset=function(g){r.d.r(g)},Vs.unstable_batchedUpdates=function(g,_){return g(_)},Vs.useFormState=function(g,_,b){return m.H.useFormState(g,_,b)},Vs.useFormStatus=function(){return m.H.useHostTransitionStatus()},Vs.version="19.2.8",Vs}var $_;function zy(){if($_)return yp.exports;$_=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(l){console.error(l)}}return n(),yp.exports=Lj(),yp.exports}/**
35
+ * @license React
36
+ * react-dom-client.production.js
37
+ *
38
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
39
+ *
40
+ * This source code is licensed under the MIT license found in the
41
+ * LICENSE file in the root directory of this source tree.
42
+ */var B_;function Oj(){if(B_)return gd;B_=1;var n=Dj(),l=bg(),i=zy();function r(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}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 o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function u(e){var t=e,a=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(a=t.return),e=t.return;while(e)}return t.tag===3?a:null}function m(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 p(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 g(e){if(u(e)!==e)throw Error(r(188))}function _(e){var t=e.alternate;if(!t){if(t=u(e),t===null)throw Error(r(188));return t!==e?null:e}for(var a=e,c=t;;){var d=a.return;if(d===null)break;var f=d.alternate;if(f===null){if(c=d.return,c!==null){a=c;continue}break}if(d.child===f.child){for(f=d.child;f;){if(f===a)return g(d),e;if(f===c)return g(d),t;f=f.sibling}throw Error(r(188))}if(a.return!==c.return)a=d,c=f;else{for(var y=!1,w=d.child;w;){if(w===a){y=!0,a=d,c=f;break}if(w===c){y=!0,c=d,a=f;break}w=w.sibling}if(!y){for(w=f.child;w;){if(w===a){y=!0,a=f,c=d;break}if(w===c){y=!0,c=f,a=d;break}w=w.sibling}if(!y)throw Error(r(189))}}if(a.alternate!==c)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?e:t}function b(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=b(e),t!==null)return t;e=e.sibling}return null}var j=Object.assign,v=Symbol.for("react.element"),k=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),I=Symbol.for("react.profiler"),D=Symbol.for("react.consumer"),G=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),V=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),te=Symbol.for("react.lazy"),F=Symbol.for("react.activity"),fe=Symbol.for("react.memo_cache_sentinel"),Q=Symbol.iterator;function X(e){return e===null||typeof e!="object"?null:(e=Q&&e[Q]||e["@@iterator"],typeof e=="function"?e:null)}var ge=Symbol.for("react.client.reference");function U(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ge?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case E:return"Fragment";case I:return"Profiler";case C:return"StrictMode";case V:return"Suspense";case z:return"SuspenseList";case F:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case N:return"Portal";case G:return e.displayName||"Context";case D:return(e._context.displayName||"Context")+".Consumer";case P:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case H:return t=e.displayName||null,t!==null?t:U(e.type)||"Memo";case te:t=e._payload,e=e._init;try{return U(e(t))}catch{}}return null}var L=Array.isArray,M=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J={pending:!1,data:null,method:null,action:null},le=[],ce=-1;function A(e){return{current:e}}function W(e){0>ce||(e.current=le[ce],le[ce]=null,ce--)}function me(e,t){ce++,le[ce]=e.current,e.current=t}var Ee=A(null),$=A(null),de=A(null),ae=A(null);function qe(e,t){switch(me(de,t),me($,e),me(Ee,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?e_(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=e_(t),e=t_(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}W(Ee),me(Ee,e)}function Se(){W(Ee),W($),W(de)}function Ge(e){e.memoizedState!==null&&me(ae,e);var t=Ee.current,a=t_(t,e.type);t!==a&&(me($,e),me(Ee,a))}function Ve(e){$.current===e&&(W(Ee),W($)),ae.current===e&&(W(ae),dd._currentValue=J)}var Je,Ft;function dt(e){if(Je===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);Je=t&&t[1]||"",Ft=-1<a.stack.indexOf(`
43
+ at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
44
+ `+Je+e+Ft}var jn=!1;function Ze(e,t){if(!e||jn)return"";jn=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(t){var we=function(){throw Error()};if(Object.defineProperty(we.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(we,[])}catch(he){var ue=he}Reflect.construct(e,[],we)}else{try{we.call()}catch(he){ue=he}e.call(we.prototype)}}else{try{throw Error()}catch(he){ue=he}(we=e())&&typeof we.catch=="function"&&we.catch(function(){})}}catch(he){if(he&&ue&&typeof he.stack=="string")return[he.stack,ue.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var d=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");d&&d.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=c.DetermineComponentFrameRoot(),y=f[0],w=f[1];if(y&&w){var q=y.split(`
45
+ `),re=w.split(`
46
+ `);for(d=c=0;c<q.length&&!q[c].includes("DetermineComponentFrameRoot");)c++;for(;d<re.length&&!re[d].includes("DetermineComponentFrameRoot");)d++;if(c===q.length||d===re.length)for(c=q.length-1,d=re.length-1;1<=c&&0<=d&&q[c]!==re[d];)d--;for(;1<=c&&0<=d;c--,d--)if(q[c]!==re[d]){if(c!==1||d!==1)do if(c--,d--,0>d||q[c]!==re[d]){var ye=`
47
+ `+q[c].replace(" at new "," at ");return e.displayName&&ye.includes("<anonymous>")&&(ye=ye.replace("<anonymous>",e.displayName)),ye}while(1<=c&&0<=d);break}}}finally{jn=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?dt(a):""}function js(e,t){switch(e.tag){case 26:case 27:case 5:return dt(e.type);case 16:return dt("Lazy");case 13:return e.child!==t&&t!==null?dt("Suspense Fallback"):dt("Suspense");case 19:return dt("SuspenseList");case 0:case 15:return Ze(e.type,!1);case 11:return Ze(e.type.render,!1);case 1:return Ze(e.type,!0);case 31:return dt("Activity");default:return""}}function lt(e){try{var t="",a=null;do t+=js(e,a),a=e,e=e.return;while(e);return t}catch(c){return`
48
+ Error generating stack: `+c.message+`
49
+ `+c.stack}}var mt=Object.prototype.hasOwnProperty,Me=n.unstable_scheduleCallback,nt=n.unstable_cancelCallback,In=n.unstable_shouldYield,kt=n.unstable_requestPaint,ut=n.unstable_now,Un=n.unstable_getCurrentPriorityLevel,$n=n.unstable_ImmediatePriority,Gt=n.unstable_UserBlockingPriority,it=n.unstable_NormalPriority,vt=n.unstable_LowPriority,Kt=n.unstable_IdlePriority,es=n.log,fs=n.unstable_setDisableYieldValue,Tt=null,Lt=null;function fn(e){if(typeof es=="function"&&fs(e),Lt&&typeof Lt.setStrictMode=="function")try{Lt.setStrictMode(Tt,e)}catch{}}var Qt=Math.clz32?Math.clz32:Ae,zs=Math.log,_e=Math.LN2;function Ae(e){return e>>>=0,e===0?32:31-(zs(e)/_e|0)|0}var Pe=256,et=262144,Qe=4194304;function Ot(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 Zt(e,t,a){var c=e.pendingLanes;if(c===0)return 0;var d=0,f=e.suspendedLanes,y=e.pingedLanes;e=e.warmLanes;var w=c&134217727;return w!==0?(c=w&~f,c!==0?d=Ot(c):(y&=w,y!==0?d=Ot(y):a||(a=w&~e,a!==0&&(d=Ot(a))))):(w=c&~f,w!==0?d=Ot(w):y!==0?d=Ot(y):a||(a=c&~e,a!==0&&(d=Ot(a)))),d===0?0:t!==0&&t!==d&&(t&f)===0&&(f=d&-d,a=t&-t,f>=a||f===32&&(a&4194048)!==0)?t:d}function Kn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Sl(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 Bn(){var e=Qe;return Qe<<=1,(Qe&62914560)===0&&(Qe=4194304),e}function Et(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function _t(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Is(e,t,a,c,d,f){var y=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var w=e.entanglements,q=e.expirationTimes,re=e.hiddenUpdates;for(a=y&~a;0<a;){var ye=31-Qt(a),we=1<<ye;w[ye]=0,q[ye]=-1;var ue=re[ye];if(ue!==null)for(re[ye]=null,ye=0;ye<ue.length;ye++){var he=ue[ye];he!==null&&(he.lane&=-536870913)}a&=~we}c!==0&&Qn(e,c,0),f!==0&&d===0&&e.tag!==0&&(e.suspendedLanes|=f&~(y&~t))}function Qn(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var c=31-Qt(t);e.entangledLanes|=t,e.entanglements[c]=e.entanglements[c]|1073741824|a&261930}function Es(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var c=31-Qt(a),d=1<<c;d&t|e[c]&t&&(e[c]|=t),a&=~d}}function Mn(e,t){var a=t&-t;return a=(a&42)!==0?1:hs(a),(a&(e.suspendedLanes|t))!==0?0:a}function hs(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 ms(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Zn(){var e=O.p;return e!==0?e:(e=window.event,e===void 0?32:k_(e.type))}function Qs(e,t){var a=O.p;try{return O.p=e,t()}finally{O.p=a}}var hn=Math.random().toString(36).slice(2),wt="__reactFiber$"+hn,At="__reactProps$"+hn,cn="__reactContainer$"+hn,ps="__reactEvents$"+hn,Rn="__reactListeners$"+hn,ua="__reactHandles$"+hn,Us="__reactResources$"+hn,B="__reactMarker$"+hn;function xe(e){delete e[wt],delete e[At],delete e[ps],delete e[Rn],delete e[ua]}function Re(e){var t=e[wt];if(t)return t;for(var a=e.parentNode;a;){if(t=a[cn]||a[wt]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=c_(e);e!==null;){if(a=e[wt])return a;e=c_(e)}return t}e=a,a=e.parentNode}return null}function Ke(e){if(e=e[wt]||e[cn]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ht(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(r(33))}function on(e){var t=e[Us];return t||(t=e[Us]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function rt(e){e[B]=!0}var cl=new Set,Zs={};function ts(e,t){Ns(e,t),Ns(e+"Capture",t)}function Ns(e,t){for(Zs[e]=t,e=0;e<t.length;e++)cl.add(t[e])}var Ps=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]*$"),Bl={},da={};function Hl(e){return mt.call(da,e)?!0:mt.call(Bl,e)?!1:Ps.test(e)?da[e]=!0:(Bl[e]=!0,!1)}function fa(e,t,a){if(Hl(t))if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var c=t.toLowerCase().slice(0,5);if(c!=="data-"&&c!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+a)}}function El(e,t,a){if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+a)}}function mn(e,t,a,c){if(c===null)e.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(t,a,""+c)}}function pn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ql(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ol(e,t,a){var c=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var d=c.get,f=c.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return d.call(this)},set:function(y){a=""+y,f.call(this,y)}}),Object.defineProperty(e,t,{enumerable:c.enumerable}),{getValue:function(){return a},setValue:function(y){a=""+y},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ul(e){if(!e._valueTracker){var t=ql(e)?"checked":"value";e._valueTracker=ol(e,t,""+e[t])}}function Pt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),c="";return e&&(c=ql(e)?e.checked?"true":"false":e.value),e=c,e!==a?(t.setValue(e),!0):!1}function Gl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Hn=/[\n"\\]/g;function Pn(e){return e.replace(Hn,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Oa(e,t,a,c,d,f,y,w){e.name="",y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?e.type=y:e.removeAttribute("type"),t!=null?y==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+pn(t)):e.value!==""+pn(t)&&(e.value=""+pn(t)):y!=="submit"&&y!=="reset"||e.removeAttribute("value"),t!=null?Nn(e,y,pn(t)):a!=null?Nn(e,y,pn(a)):c!=null&&e.removeAttribute("value"),d==null&&f!=null&&(e.defaultChecked=!!f),d!=null&&(e.checked=d&&typeof d!="function"&&typeof d!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.name=""+pn(w):e.removeAttribute("name")}function Yl(e,t,a,c,d,f,y,w){if(f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.type=f),t!=null||a!=null){if(!(f!=="submit"&&f!=="reset"||t!=null)){ul(e);return}a=a!=null?""+pn(a):"",t=t!=null?""+pn(t):a,w||t===e.value||(e.value=t),e.defaultValue=t}c=c??d,c=typeof c!="function"&&typeof c!="symbol"&&!!c,e.checked=w?e.checked:!!c,e.defaultChecked=!!c,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(e.name=y),ul(e)}function Nn(e,t,a){t==="number"&&Gl(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function qn(e,t,a,c){if(e=e.options,t){t={};for(var d=0;d<a.length;d++)t["$"+a[d]]=!0;for(a=0;a<e.length;a++)d=t.hasOwnProperty("$"+e[a].value),e[a].selected!==d&&(e[a].selected=d),d&&c&&(e[a].defaultSelected=!0)}else{for(a=""+pn(a),t=null,d=0;d<e.length;d++){if(e[d].value===a){e[d].selected=!0,c&&(e[d].defaultSelected=!0);return}t!==null||e[d].disabled||(t=e[d])}t!==null&&(t.selected=!0)}}function Gn(e,t,a){if(t!=null&&(t=""+pn(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+pn(a):""}function ha(e,t,a,c){if(t==null){if(c!=null){if(a!=null)throw Error(r(92));if(L(c)){if(1<c.length)throw Error(r(93));c=c[0]}a=c}a==null&&(a=""),t=a}a=pn(t),e.defaultValue=a,c=e.textContent,c===a&&c!==""&&c!==null&&(e.value=c),ul(e)}function ns(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var ks=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 $s(e,t,a){var c=t.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?c?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":c?e.setProperty(t,a):typeof a!="number"||a===0||ks.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function Yt(e,t,a){if(t!=null&&typeof t!="object")throw Error(r(62));if(e=e.style,a!=null){for(var c in a)!a.hasOwnProperty(c)||t!=null&&t.hasOwnProperty(c)||(c.indexOf("--")===0?e.setProperty(c,""):c==="float"?e.cssFloat="":e[c]="");for(var d in t)c=t[d],t.hasOwnProperty(d)&&a[d]!==c&&$s(e,d,c)}else for(var f in t)t.hasOwnProperty(f)&&$s(e,f,t[f])}function Bs(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 Vl=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"]]),tc=/^[\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 Ws(e){return tc.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Yn(){}var Xl=null;function Fl(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var dl=null,fl=null;function di(e){var t=Ke(e);if(t&&(e=t.stateNode)){var a=e[At]||null;e:switch(e=t.stateNode,t.type){case"input":if(Oa(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),t=a.name,a.type==="radio"&&t!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Pn(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var c=a[t];if(c!==e&&c.form===e.form){var d=c[At]||null;if(!d)throw Error(r(90));Oa(c,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name)}}for(t=0;t<a.length;t++)c=a[t],c.form===e.form&&Pt(c)}break e;case"textarea":Gn(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&qn(e,!!a.multiple,t,!1)}}}var Kl=!1;function fi(e,t,a){if(Kl)return e(t,a);Kl=!0;try{var c=e(t);return c}finally{if(Kl=!1,(dl!==null||fl!==null)&&(If(),dl&&(t=dl,e=fl,fl=dl=null,di(t),e)))for(t=0;t<e.length;t++)di(e[t])}}function hl(e,t){var a=e.stateNode;if(a===null)return null;var c=a[At]||null;if(c===null)return null;a=c[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(e=e.type,c=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!c;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(r(231,t,typeof a));return a}var Wn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Js=!1;if(Wn)try{var be={};Object.defineProperty(be,"passive",{get:function(){Js=!0}}),window.addEventListener("test",be,be),window.removeEventListener("test",be,be)}catch{Js=!1}var S=null,K=null,pe=null;function ve(){if(pe)return pe;var e,t=K,a=t.length,c,d="value"in S?S.value:S.textContent,f=d.length;for(e=0;e<a&&t[e]===d[e];e++);var y=a-e;for(c=1;c<=y&&t[a-c]===d[f-c];c++);return pe=d.slice(e,1<c?1-c:void 0)}function ze(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 Ye(){return!0}function at(){return!1}function gt(e){function t(a,c,d,f,y){this._reactName=a,this._targetInst=d,this.type=c,this.nativeEvent=f,this.target=y,this.currentTarget=null;for(var w in e)e.hasOwnProperty(w)&&(a=e[w],this[w]=a?a(f):f[w]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?Ye:at,this.isPropagationStopped=at,this}return j(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Ye)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Ye)},persist:function(){},isPersistent:Ye}),t}var gn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},un=gt(gn),kn=j({},gn,{view:0,detail:0}),Wt=gt(kn),wn,T,oe,Te=j({},kn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:lc,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!==oe&&(oe&&e.type==="mousemove"?(wn=e.screenX-oe.screenX,T=e.screenY-oe.screenY):T=wn=0,oe=e),wn)},movementY:function(e){return"movementY"in e?e.movementY:T}}),Ie=gt(Te),zt=j({},Te,{dataTransfer:0}),xn=gt(zt),ss=j({},kn,{relatedTarget:0}),sn=gt(ss),qd=j({},gn,{animationName:0,elapsedTime:0,pseudoElement:0}),nr=gt(qd),no=j({},gn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),nm=gt(no),sm=j({},gn,{data:0}),nc=gt(sm),ma={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},sc={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"},Cs={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Gd(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Cs[e])?!!t[e]:!1}function lc(){return Gd}var so=j({},kn,{key:function(e){if(e.key){var t=ma[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ze(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?sc[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:lc,charCode:function(e){return e.type==="keypress"?ze(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ze(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),lm=gt(so),lo=j({},Te,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ao=gt(lo),ml=j({},kn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:lc}),io=gt(ml),ro=j({},gn,{propertyName:0,elapsedTime:0,pseudoElement:0}),yu=gt(ro),Yd=j({},Te,{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}),am=gt(Yd),im=j({},gn,{newState:0,oldState:0}),rm=gt(im),cm=[9,13,27,32],vu=Wn&&"CompositionEvent"in window,za=null;Wn&&"documentMode"in document&&(za=document.documentMode);var om=Wn&&"TextEvent"in window&&!za,co=Wn&&(!vu||za&&8<za&&11>=za),Vd=" ",ac=!1;function Hs(e,t){switch(e){case"keyup":return cm.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function sr(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var pl=!1;function ic(e,t){switch(e){case"compositionend":return sr(t);case"keypress":return t.which!==32?null:(ac=!0,Vd);case"textInput":return e=t.data,e===Vd&&ac?null:e;default:return null}}function oo(e,t){if(pl)return e==="compositionend"||!vu&&Hs(e,t)?(e=ve(),pe=K=S=null,pl=!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 co&&t.locale!=="ko"?null:t.data;default:return null}}var uo={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 Ia(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!uo[e.type]:t==="textarea"}function qs(e,t,a,c){dl?fl?fl.push(c):fl=[c]:dl=c,t=Yf(t,"onChange"),0<t.length&&(a=new un("onChange","change",null,a,c),e.push({event:a,listeners:t}))}var lr=null,rc=null;function Xd(e){Kx(e,0)}function pa(e){var t=ht(e);if(Pt(t))return e}function hi(e,t){if(e==="change")return t}var cc=!1;if(Wn){var ar;if(Wn){var ir="oninput"in document;if(!ir){var ga=document.createElement("div");ga.setAttribute("oninput","return;"),ir=typeof ga.oninput=="function"}ar=ir}else ar=!1;cc=ar&&(!document.documentMode||9<document.documentMode)}function Fd(){lr&&(lr.detachEvent("onpropertychange",Cl),rc=lr=null)}function Cl(e){if(e.propertyName==="value"&&pa(rc)){var t=[];qs(t,rc,e,Fl(e)),fi(Xd,t)}}function oc(e,t,a){e==="focusin"?(Fd(),lr=t,rc=a,lr.attachEvent("onpropertychange",Cl)):e==="focusout"&&Fd()}function fo(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return pa(rc)}function uc(e,t){if(e==="click")return pa(t)}function ho(e,t){if(e==="input"||e==="change")return pa(t)}function um(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ts=typeof Object.is=="function"?Object.is:um;function Ua(e,t){if(Ts(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),c=Object.keys(t);if(a.length!==c.length)return!1;for(c=0;c<a.length;c++){var d=a[c];if(!mt.call(t,d)||!Ts(e[d],t[d]))return!1}return!0}function ju(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function dc(e,t){var a=ju(e);e=0;for(var c;a;){if(a.nodeType===3){if(c=e+a.textContent.length,e<=t&&c>=t)return{node:a,offset:t-e};e=c}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=ju(a)}}function Nu(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Nu(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function $a(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Gl(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=Gl(e.document)}return t}function mi(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 dm=Wn&&"documentMode"in document&&11>=document.documentMode,Ba=null,rr=null,pi=null,mo=!1;function fc(e,t,a){var c=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;mo||Ba==null||Ba!==Gl(c)||(c=Ba,"selectionStart"in c&&mi(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),pi&&Ua(pi,c)||(pi=c,c=Yf(rr,"onSelect"),0<c.length&&(t=new un("onSelect","select",null,t,a),e.push({event:t,listeners:c}),t.target=Ba)))}function gl(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var Ha={animationend:gl("Animation","AnimationEnd"),animationiteration:gl("Animation","AnimationIteration"),animationstart:gl("Animation","AnimationStart"),transitionrun:gl("Transition","TransitionRun"),transitionstart:gl("Transition","TransitionStart"),transitioncancel:gl("Transition","TransitionCancel"),transitionend:gl("Transition","TransitionEnd")},cr={},or={};Wn&&(or=document.createElement("div").style,"AnimationEvent"in window||(delete Ha.animationend.animation,delete Ha.animationiteration.animation,delete Ha.animationstart.animation),"TransitionEvent"in window||delete Ha.transitionend.transition);function gi(e){if(cr[e])return cr[e];if(!Ha[e])return e;var t=Ha[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in or)return cr[e]=t[a];return e}var hc=gi("animationend"),Kd=gi("animationiteration"),mc=gi("animationstart"),po=gi("transitionrun"),ku=gi("transitionstart"),pc=gi("transitioncancel"),qa=gi("transitionend"),gc=new Map,xc="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(" ");xc.push("scrollEnd");function Tl(e,t){gc.set(e,t),ts(t,[e])}var Ql=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},As=[],xi=0,ur=0;function _c(){for(var e=xi,t=ur=xi=0;t<e;){var a=As[t];As[t++]=null;var c=As[t];As[t++]=null;var d=As[t];As[t++]=null;var f=As[t];if(As[t++]=null,c!==null&&d!==null){var y=c.pending;y===null?d.next=d:(d.next=y.next,y.next=d),c.pending=d}f!==0&&dr(a,d,f)}}function _i(e,t,a,c){As[xi++]=e,As[xi++]=t,As[xi++]=a,As[xi++]=c,ur|=c,e.lanes|=c,e=e.alternate,e!==null&&(e.lanes|=c)}function Al(e,t,a,c){return _i(e,t,a,c),Pl(e)}function Zl(e,t){return _i(e,null,null,t),Pl(e)}function dr(e,t,a){e.lanes|=a;var c=e.alternate;c!==null&&(c.lanes|=a);for(var d=!1,f=e.return;f!==null;)f.childLanes|=a,c=f.alternate,c!==null&&(c.childLanes|=a),f.tag===22&&(e=f.stateNode,e===null||e._visibility&1||(d=!0)),e=f,f=f.return;return e.tag===3?(f=e.stateNode,d&&t!==null&&(d=31-Qt(a),e=f.hiddenUpdates,c=e[d],c===null?e[d]=[t]:c.push(t),t.lane=a|536870912),f):null}function Pl(e){if(50<ld)throw ld=0,Um=null,Error(r(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Wl={};function Sn(e,t,a,c){this.tag=e,this.key=a,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=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ms(e,t,a,c){return new Sn(e,t,a,c)}function wu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function xa(e,t){var a=e.alternate;return a===null?(a=Ms(e.tag,t,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,t=e.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function go(e,t){e.flags&=65011714;var a=e.alternate;return a===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=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,t=a.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function bi(e,t,a,c,d,f){var y=0;if(c=e,typeof e=="function")wu(e)&&(y=1);else if(typeof e=="string")y=pj(e,a,Ee.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case F:return e=Ms(31,a,t,d),e.elementType=F,e.lanes=f,e;case E:return dn(a.children,d,f,t);case C:y=8,d|=24;break;case I:return e=Ms(12,a,t,d|2),e.elementType=I,e.lanes=f,e;case V:return e=Ms(13,a,t,d),e.elementType=V,e.lanes=f,e;case z:return e=Ms(19,a,t,d),e.elementType=z,e.lanes=f,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case G:y=10;break e;case D:y=9;break e;case P:y=11;break e;case H:y=14;break e;case te:y=16,c=null;break e}y=29,a=Error(r(130,e===null?"null":typeof e,"")),c=null}return t=Ms(y,a,t,d),t.elementType=e,t.type=c,t.lanes=f,t}function dn(e,t,a,c){return e=Ms(7,e,c,t),e.lanes=a,e}function fr(e,t,a){return e=Ms(6,e,null,t),e.lanes=a,e}function hr(e){var t=Ms(18,null,null,0);return t.stateNode=e,t}function yi(e,t,a){return t=Ms(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Ml=new WeakMap;function el(e,t){if(typeof e=="object"&&e!==null){var a=Ml.get(e);return a!==void 0?a:(t={value:e,source:t,stack:lt(t)},Ml.set(e,t),t)}return{value:e,source:t,stack:lt(t)}}var It=[],vi=0,bc=null,tl=0,nl=[],Rs=0,Rl=null,Gs=1,Jn="";function Jl(e,t){It[vi++]=tl,It[vi++]=bc,bc=e,tl=t}function ji(e,t,a){nl[Rs++]=Gs,nl[Rs++]=Jn,nl[Rs++]=Rl,Rl=e;var c=Gs;e=Jn;var d=32-Qt(c)-1;c&=~(1<<d),a+=1;var f=32-Qt(t)+d;if(30<f){var y=d-d%5;f=(c&(1<<y)-1).toString(32),c>>=y,d-=y,Gs=1<<32-Qt(t)+d|a<<d|c,Jn=f+e}else Gs=1<<f|a<<d|c,Jn=e}function Ni(e){e.return!==null&&(Jl(e,1),ji(e,1,0))}function ki(e){for(;e===bc;)bc=It[--vi],It[vi]=null,tl=It[--vi],It[vi]=null;for(;e===Rl;)Rl=nl[--Rs],nl[Rs]=null,Jn=nl[--Rs],nl[Rs]=null,Gs=nl[--Rs],nl[Rs]=null}function mr(e,t){nl[Rs++]=Gs,nl[Rs++]=Jn,nl[Rs++]=Rl,Gs=t.id,Jn=t.overflow,Rl=e}var ls=null,Mt=null,xt=!1,Ga=null,ne=!1,Su=Error(r(519));function sl(e){var t=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw yc(el(t,e)),Su}function xo(e){var t=e.stateNode,a=e.type,c=e.memoizedProps;switch(t[wt]=e,t[At]=c,a){case"dialog":yt("cancel",t),yt("close",t);break;case"iframe":case"object":case"embed":yt("load",t);break;case"video":case"audio":for(a=0;a<id.length;a++)yt(id[a],t);break;case"source":yt("error",t);break;case"img":case"image":case"link":yt("error",t),yt("load",t);break;case"details":yt("toggle",t);break;case"input":yt("invalid",t),Yl(t,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0);break;case"select":yt("invalid",t);break;case"textarea":yt("invalid",t),ha(t,c.value,c.defaultValue,c.children)}a=c.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||t.textContent===""+a||c.suppressHydrationWarning===!0||Wx(t.textContent,a)?(c.popover!=null&&(yt("beforetoggle",t),yt("toggle",t)),c.onScroll!=null&&yt("scroll",t),c.onScrollEnd!=null&&yt("scrollend",t),c.onClick!=null&&(t.onclick=Yn),t=!0):t=!1,t||sl(e,!0)}function Qd(e){for(ls=e.return;ls;)switch(ls.tag){case 5:case 31:case 13:ne=!1;return;case 27:case 3:ne=!0;return;default:ls=ls.return}}function _a(e){if(e!==ls)return!1;if(!xt)return Qd(e),xt=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Jm(e.type,e.memoizedProps)),a=!a),a&&Mt&&sl(e),Qd(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));Mt=r_(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));Mt=r_(e)}else t===27?(t=Mt,Ir(e.type)?(e=lp,lp=null,Mt=e):Mt=t):Mt=ls?la(e.stateNode.nextSibling):null;return!0}function wi(){Mt=ls=null,xt=!1}function Eu(){var e=Ga;return e!==null&&(jl===null?jl=e:jl.push.apply(jl,e),Ga=null),e}function yc(e){Ga===null?Ga=[e]:Ga.push(e)}var Y=A(null),ba=null,gs=null;function as(e,t,a){me(Y,t._currentValue),t._currentValue=a}function ea(e){e._currentValue=Y.current,W(Y)}function pr(e,t,a){for(;e!==null;){var c=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,c!==null&&(c.childLanes|=t)):c!==null&&(c.childLanes&t)!==t&&(c.childLanes|=t),e===a)break;e=e.return}}function _o(e,t,a,c){var d=e.child;for(d!==null&&(d.return=e);d!==null;){var f=d.dependencies;if(f!==null){var y=d.child;f=f.firstContext;e:for(;f!==null;){var w=f;f=d;for(var q=0;q<t.length;q++)if(w.context===t[q]){f.lanes|=a,w=f.alternate,w!==null&&(w.lanes|=a),pr(f.return,a,e),c||(y=null);break e}f=w.next}}else if(d.tag===18){if(y=d.return,y===null)throw Error(r(341));y.lanes|=a,f=y.alternate,f!==null&&(f.lanes|=a),pr(y,a,e),y=null}else y=d.child;if(y!==null)y.return=d;else for(y=d;y!==null;){if(y===e){y=null;break}if(d=y.sibling,d!==null){d.return=y.return,y=d;break}y=y.return}d=y}}function gr(e,t,a,c){e=null;for(var d=t,f=!1;d!==null;){if(!f){if((d.flags&524288)!==0)f=!0;else if((d.flags&262144)!==0)break}if(d.tag===10){var y=d.alternate;if(y===null)throw Error(r(387));if(y=y.memoizedProps,y!==null){var w=d.type;Ts(d.pendingProps.value,y.value)||(e!==null?e.push(w):e=[w])}}else if(d===ae.current){if(y=d.alternate,y===null)throw Error(r(387));y.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(e!==null?e.push(dd):e=[dd])}d=d.return}e!==null&&_o(t,e,a,c),t.flags|=262144}function Ys(e){for(e=e.firstContext;e!==null;){if(!Ts(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Si(e){ba=e,gs=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function is(e){return En(ba,e)}function bo(e,t){return ba===null&&Si(e),En(e,t)}function En(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},gs===null){if(e===null)throw Error(r(308));gs=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else gs=gs.next=t;return a}var Zd=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(a,c){e.push(c)}};this.abort=function(){t.aborted=!0,e.forEach(function(a){return a()})}},fm=n.unstable_scheduleCallback,hm=n.unstable_NormalPriority,Vn={$$typeof:G,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Cu(){return{controller:new Zd,data:new Map,refCount:0}}function Dl(e){e.refCount--,e.refCount===0&&fm(hm,function(){e.controller.abort()})}var vc=null,Tu=0,Ei=0,xr=null;function mm(e,t){if(vc===null){var a=vc=[];Tu=0,Ei=Ym(),xr={status:"pending",value:void 0,then:function(c){a.push(c)}}}return Tu++,t.then(Pd,Pd),t}function Pd(){if(--Tu===0&&vc!==null){xr!==null&&(xr.status="fulfilled");var e=vc;vc=null,Ei=0,xr=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function pm(e,t){var a=[],c={status:"pending",value:null,reason:null,then:function(d){a.push(d)}};return e.then(function(){c.status="fulfilled",c.value=t;for(var d=0;d<a.length;d++)(0,a[d])(t)},function(d){for(c.status="rejected",c.reason=d,d=0;d<a.length;d++)(0,a[d])(void 0)}),c}var Wd=M.S;M.S=function(e,t){jx=ut(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&mm(e,t),Wd!==null&&Wd(e,t)};var Ci=A(null);function Au(){var e=Ci.current;return e!==null?e:rn.pooledCache}function Ya(e,t){t===null?me(Ci,Ci.current):me(Ci,t.pool)}function Jd(){var e=Au();return e===null?null:{parent:Vn._currentValue,pool:e}}var _r=Error(r(460)),jc=Error(r(474)),yo=Error(r(542)),vo={then:function(){}};function Va(e){return e=e.status,e==="fulfilled"||e==="rejected"}function ef(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(Yn,Yn),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Ru(e),e;default:if(typeof t.status=="string")t.then(Yn,Yn);else{if(e=rn,e!==null&&100<e.shellSuspendCounter)throw Error(r(482));e=t,e.status="pending",e.then(function(c){if(t.status==="pending"){var d=t;d.status="fulfilled",d.value=c}},function(c){if(t.status==="pending"){var d=t;d.status="rejected",d.reason=c}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Ru(e),e}throw Xa=t,_r}}function Ti(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Xa=a,_r):a}}var Xa=null;function Mu(){if(Xa===null)throw Error(r(459));var e=Xa;return Xa=null,e}function Ru(e){if(e===_r||e===yo)throw Error(r(483))}var br=null,Nc=0;function yr(e){var t=Nc;return Nc+=1,br===null&&(br=[]),ef(br,e,t)}function vr(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function jr(e,t){throw t.$$typeof===v?Error(r(525)):(e=Object.prototype.toString.call(t),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function tf(e){function t(se,Z){if(e){var ie=se.deletions;ie===null?(se.deletions=[Z],se.flags|=16):ie.push(Z)}}function a(se,Z){if(!e)return null;for(;Z!==null;)t(se,Z),Z=Z.sibling;return null}function c(se){for(var Z=new Map;se!==null;)se.key!==null?Z.set(se.key,se):Z.set(se.index,se),se=se.sibling;return Z}function d(se,Z){return se=xa(se,Z),se.index=0,se.sibling=null,se}function f(se,Z,ie){return se.index=ie,e?(ie=se.alternate,ie!==null?(ie=ie.index,ie<Z?(se.flags|=67108866,Z):ie):(se.flags|=67108866,Z)):(se.flags|=1048576,Z)}function y(se){return e&&se.alternate===null&&(se.flags|=67108866),se}function w(se,Z,ie,je){return Z===null||Z.tag!==6?(Z=fr(ie,se.mode,je),Z.return=se,Z):(Z=d(Z,ie),Z.return=se,Z)}function q(se,Z,ie,je){var Fe=ie.type;return Fe===E?ye(se,Z,ie.props.children,je,ie.key):Z!==null&&(Z.elementType===Fe||typeof Fe=="object"&&Fe!==null&&Fe.$$typeof===te&&Ti(Fe)===Z.type)?(Z=d(Z,ie.props),vr(Z,ie),Z.return=se,Z):(Z=bi(ie.type,ie.key,ie.props,null,se.mode,je),vr(Z,ie),Z.return=se,Z)}function re(se,Z,ie,je){return Z===null||Z.tag!==4||Z.stateNode.containerInfo!==ie.containerInfo||Z.stateNode.implementation!==ie.implementation?(Z=yi(ie,se.mode,je),Z.return=se,Z):(Z=d(Z,ie.children||[]),Z.return=se,Z)}function ye(se,Z,ie,je,Fe){return Z===null||Z.tag!==7?(Z=dn(ie,se.mode,je,Fe),Z.return=se,Z):(Z=d(Z,ie),Z.return=se,Z)}function we(se,Z,ie){if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return Z=fr(""+Z,se.mode,ie),Z.return=se,Z;if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case k:return ie=bi(Z.type,Z.key,Z.props,null,se.mode,ie),vr(ie,Z),ie.return=se,ie;case N:return Z=yi(Z,se.mode,ie),Z.return=se,Z;case te:return Z=Ti(Z),we(se,Z,ie)}if(L(Z)||X(Z))return Z=dn(Z,se.mode,ie,null),Z.return=se,Z;if(typeof Z.then=="function")return we(se,yr(Z),ie);if(Z.$$typeof===G)return we(se,bo(se,Z),ie);jr(se,Z)}return null}function ue(se,Z,ie,je){var Fe=Z!==null?Z.key:null;if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return Fe!==null?null:w(se,Z,""+ie,je);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case k:return ie.key===Fe?q(se,Z,ie,je):null;case N:return ie.key===Fe?re(se,Z,ie,je):null;case te:return ie=Ti(ie),ue(se,Z,ie,je)}if(L(ie)||X(ie))return Fe!==null?null:ye(se,Z,ie,je,null);if(typeof ie.then=="function")return ue(se,Z,yr(ie),je);if(ie.$$typeof===G)return ue(se,Z,bo(se,ie),je);jr(se,ie)}return null}function he(se,Z,ie,je,Fe){if(typeof je=="string"&&je!==""||typeof je=="number"||typeof je=="bigint")return se=se.get(ie)||null,w(Z,se,""+je,Fe);if(typeof je=="object"&&je!==null){switch(je.$$typeof){case k:return se=se.get(je.key===null?ie:je.key)||null,q(Z,se,je,Fe);case N:return se=se.get(je.key===null?ie:je.key)||null,re(Z,se,je,Fe);case te:return je=Ti(je),he(se,Z,ie,je,Fe)}if(L(je)||X(je))return se=se.get(ie)||null,ye(Z,se,je,Fe,null);if(typeof je.then=="function")return he(se,Z,ie,yr(je),Fe);if(je.$$typeof===G)return he(se,Z,ie,bo(Z,je),Fe);jr(Z,je)}return null}function $e(se,Z,ie,je){for(var Fe=null,Rt=null,He=Z,ft=Z=0,Nt=null;He!==null&&ft<ie.length;ft++){He.index>ft?(Nt=He,He=null):Nt=He.sibling;var Dt=ue(se,He,ie[ft],je);if(Dt===null){He===null&&(He=Nt);break}e&&He&&Dt.alternate===null&&t(se,He),Z=f(Dt,Z,ft),Rt===null?Fe=Dt:Rt.sibling=Dt,Rt=Dt,He=Nt}if(ft===ie.length)return a(se,He),xt&&Jl(se,ft),Fe;if(He===null){for(;ft<ie.length;ft++)He=we(se,ie[ft],je),He!==null&&(Z=f(He,Z,ft),Rt===null?Fe=He:Rt.sibling=He,Rt=He);return xt&&Jl(se,ft),Fe}for(He=c(He);ft<ie.length;ft++)Nt=he(He,se,ft,ie[ft],je),Nt!==null&&(e&&Nt.alternate!==null&&He.delete(Nt.key===null?ft:Nt.key),Z=f(Nt,Z,ft),Rt===null?Fe=Nt:Rt.sibling=Nt,Rt=Nt);return e&&He.forEach(function(qr){return t(se,qr)}),xt&&Jl(se,ft),Fe}function We(se,Z,ie,je){if(ie==null)throw Error(r(151));for(var Fe=null,Rt=null,He=Z,ft=Z=0,Nt=null,Dt=ie.next();He!==null&&!Dt.done;ft++,Dt=ie.next()){He.index>ft?(Nt=He,He=null):Nt=He.sibling;var qr=ue(se,He,Dt.value,je);if(qr===null){He===null&&(He=Nt);break}e&&He&&qr.alternate===null&&t(se,He),Z=f(qr,Z,ft),Rt===null?Fe=qr:Rt.sibling=qr,Rt=qr,He=Nt}if(Dt.done)return a(se,He),xt&&Jl(se,ft),Fe;if(He===null){for(;!Dt.done;ft++,Dt=ie.next())Dt=we(se,Dt.value,je),Dt!==null&&(Z=f(Dt,Z,ft),Rt===null?Fe=Dt:Rt.sibling=Dt,Rt=Dt);return xt&&Jl(se,ft),Fe}for(He=c(He);!Dt.done;ft++,Dt=ie.next())Dt=he(He,se,ft,Dt.value,je),Dt!==null&&(e&&Dt.alternate!==null&&He.delete(Dt.key===null?ft:Dt.key),Z=f(Dt,Z,ft),Rt===null?Fe=Dt:Rt.sibling=Dt,Rt=Dt);return e&&He.forEach(function(Sj){return t(se,Sj)}),xt&&Jl(se,ft),Fe}function tn(se,Z,ie,je){if(typeof ie=="object"&&ie!==null&&ie.type===E&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case k:e:{for(var Fe=ie.key;Z!==null;){if(Z.key===Fe){if(Fe=ie.type,Fe===E){if(Z.tag===7){a(se,Z.sibling),je=d(Z,ie.props.children),je.return=se,se=je;break e}}else if(Z.elementType===Fe||typeof Fe=="object"&&Fe!==null&&Fe.$$typeof===te&&Ti(Fe)===Z.type){a(se,Z.sibling),je=d(Z,ie.props),vr(je,ie),je.return=se,se=je;break e}a(se,Z);break}else t(se,Z);Z=Z.sibling}ie.type===E?(je=dn(ie.props.children,se.mode,je,ie.key),je.return=se,se=je):(je=bi(ie.type,ie.key,ie.props,null,se.mode,je),vr(je,ie),je.return=se,se=je)}return y(se);case N:e:{for(Fe=ie.key;Z!==null;){if(Z.key===Fe)if(Z.tag===4&&Z.stateNode.containerInfo===ie.containerInfo&&Z.stateNode.implementation===ie.implementation){a(se,Z.sibling),je=d(Z,ie.children||[]),je.return=se,se=je;break e}else{a(se,Z);break}else t(se,Z);Z=Z.sibling}je=yi(ie,se.mode,je),je.return=se,se=je}return y(se);case te:return ie=Ti(ie),tn(se,Z,ie,je)}if(L(ie))return $e(se,Z,ie,je);if(X(ie)){if(Fe=X(ie),typeof Fe!="function")throw Error(r(150));return ie=Fe.call(ie),We(se,Z,ie,je)}if(typeof ie.then=="function")return tn(se,Z,yr(ie),je);if(ie.$$typeof===G)return tn(se,Z,bo(se,ie),je);jr(se,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint"?(ie=""+ie,Z!==null&&Z.tag===6?(a(se,Z.sibling),je=d(Z,ie),je.return=se,se=je):(a(se,Z),je=fr(ie,se.mode,je),je.return=se,se=je),y(se)):a(se,Z)}return function(se,Z,ie,je){try{Nc=0;var Fe=tn(se,Z,ie,je);return br=null,Fe}catch(He){if(He===_r||He===yo)throw He;var Rt=Ms(29,He,null,se.mode);return Rt.lanes=je,Rt.return=se,Rt}finally{}}}var Fa=tf(!0),jo=tf(!1),ya=!1;function kc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function No(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 va(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ja(e,t,a){var c=e.updateQueue;if(c===null)return null;if(c=c.shared,(Ut&2)!==0){var d=c.pending;return d===null?t.next=t:(t.next=d.next,d.next=t),c.pending=t,t=Pl(e),dr(e,null,a),t}return _i(e,c,t,a),Pl(e)}function wc(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var c=t.lanes;c&=e.pendingLanes,a|=c,t.lanes=a,Es(e,a)}}function ko(e,t){var a=e.updateQueue,c=e.alternate;if(c!==null&&(c=c.updateQueue,a===c)){var d=null,f=null;if(a=a.firstBaseUpdate,a!==null){do{var y={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};f===null?d=f=y:f=f.next=y,a=a.next}while(a!==null);f===null?d=f=t:f=f.next=t}else d=f=t;a={baseState:c.baseState,firstBaseUpdate:d,lastBaseUpdate:f,shared:c.shared,callbacks:c.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var Sc=!1;function Nr(){if(Sc){var e=xr;if(e!==null)throw e}}function kr(e,t,a,c){Sc=!1;var d=e.updateQueue;ya=!1;var f=d.firstBaseUpdate,y=d.lastBaseUpdate,w=d.shared.pending;if(w!==null){d.shared.pending=null;var q=w,re=q.next;q.next=null,y===null?f=re:y.next=re,y=q;var ye=e.alternate;ye!==null&&(ye=ye.updateQueue,w=ye.lastBaseUpdate,w!==y&&(w===null?ye.firstBaseUpdate=re:w.next=re,ye.lastBaseUpdate=q))}if(f!==null){var we=d.baseState;y=0,ye=re=q=null,w=f;do{var ue=w.lane&-536870913,he=ue!==w.lane;if(he?(jt&ue)===ue:(c&ue)===ue){ue!==0&&ue===Ei&&(Sc=!0),ye!==null&&(ye=ye.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var $e=e,We=w;ue=t;var tn=a;switch(We.tag){case 1:if($e=We.payload,typeof $e=="function"){we=$e.call(tn,we,ue);break e}we=$e;break e;case 3:$e.flags=$e.flags&-65537|128;case 0:if($e=We.payload,ue=typeof $e=="function"?$e.call(tn,we,ue):$e,ue==null)break e;we=j({},we,ue);break e;case 2:ya=!0}}ue=w.callback,ue!==null&&(e.flags|=64,he&&(e.flags|=8192),he=d.callbacks,he===null?d.callbacks=[ue]:he.push(ue))}else he={lane:ue,tag:w.tag,payload:w.payload,callback:w.callback,next:null},ye===null?(re=ye=he,q=we):ye=ye.next=he,y|=ue;if(w=w.next,w===null){if(w=d.shared.pending,w===null)break;he=w,w=he.next,he.next=null,d.lastBaseUpdate=he,d.shared.pending=null}}while(!0);ye===null&&(q=we),d.baseState=q,d.firstBaseUpdate=re,d.lastBaseUpdate=ye,f===null&&(d.shared.lanes=0),Rr|=y,e.lanes=y,e.memoizedState=we}}function wo(e,t){if(typeof e!="function")throw Error(r(191,e));e.call(t)}function nf(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)wo(a[e],t)}var Ka=A(null),So=A(0);function sf(e,t){e=Gi,me(So,e),me(Ka,t),Gi=e|t.baseLanes}function Du(){me(So,Gi),me(Ka,Ka.current)}function Lu(){Gi=So.current,W(Ka),W(So)}var xs=A(null),ll=null;function Qa(e){var t=e.alternate;me(Dn,Dn.current&1),me(xs,e),ll===null&&(t===null||Ka.current!==null||t.memoizedState!==null)&&(ll=e)}function Eo(e){me(Dn,Dn.current),me(xs,e),ll===null&&(ll=e)}function lf(e){e.tag===22?(me(Dn,Dn.current),me(xs,e),ll===null&&(ll=e)):Za()}function Za(){me(Dn,Dn.current),me(xs,xs.current)}function al(e){W(xs),ll===e&&(ll=null),W(Dn)}var Dn=A(0);function Co(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||np(a)||sp(a)))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)!==0)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 Na=0,ct=null,Ht=null,Xn=null,To=!1,wr=!1,Ai=!1,Ec=0,Cc=0,Sr=null,gm=0;function Cn(){throw Error(r(321))}function Er(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!Ts(e[a],t[a]))return!1;return!0}function Tc(e,t,a,c,d,f){return Na=f,ct=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,M.H=e===null||e.memoizedState===null?Ef:$o,Ai=!1,f=a(c,d),Ai=!1,wr&&(f=af(t,a,c,d)),Ac(e),f}function Ac(e){M.H=Oi;var t=Ht!==null&&Ht.next!==null;if(Na=0,Xn=Ht=ct=null,To=!1,Cc=0,Sr=null,t)throw Error(r(300));e===null||Jt||(e=e.dependencies,e!==null&&Ys(e)&&(Jt=!0))}function af(e,t,a,c){ct=e;var d=0;do{if(wr&&(Sr=null),Cc=0,wr=!1,25<=d)throw Error(r(301));if(d+=1,Xn=Ht=null,e.updateQueue!=null){var f=e.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}M.H=Zu,f=t(a,c)}while(wr);return f}function rf(){var e=M.H,t=e.useState()[0];return t=typeof t.then=="function"?Mc(t):t,e=e.useState()[0],(Ht!==null?Ht.memoizedState:null)!==e&&(ct.flags|=1024),t}function Ou(){var e=Ec!==0;return Ec=0,e}function Ao(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function Mo(e){if(To){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}To=!1}Na=0,Xn=Ht=ct=null,wr=!1,Cc=Ec=0,Sr=null}function _s(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Xn===null?ct.memoizedState=Xn=e:Xn=Xn.next=e,Xn}function Ln(){if(Ht===null){var e=ct.alternate;e=e!==null?e.memoizedState:null}else e=Ht.next;var t=Xn===null?ct.memoizedState:Xn.next;if(t!==null)Xn=t,Ht=e;else{if(e===null)throw ct.alternate===null?Error(r(467)):Error(r(310));Ht=e,e={memoizedState:Ht.memoizedState,baseState:Ht.baseState,baseQueue:Ht.baseQueue,queue:Ht.queue,next:null},Xn===null?ct.memoizedState=Xn=e:Xn=Xn.next=e}return Xn}function Ro(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Mc(e){var t=Cc;return Cc+=1,Sr===null&&(Sr=[]),e=ef(Sr,e,t),t=ct,(Xn===null?t.memoizedState:Xn.next)===null&&(t=t.alternate,M.H=t===null||t.memoizedState===null?Ef:$o),e}function Do(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Mc(e);if(e.$$typeof===G)return is(e)}throw Error(r(438,String(e)))}function zu(e){var t=null,a=ct.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var c=ct.alternate;c!==null&&(c=c.updateQueue,c!==null&&(c=c.memoCache,c!=null&&(t={data:c.data.map(function(d){return d.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=Ro(),ct.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),c=0;c<e;c++)a[c]=fe;return t.index++,a}function ka(e,t){return typeof t=="function"?t(e):t}function Lo(e){var t=Ln();return Iu(t,Ht,e)}function Iu(e,t,a){var c=e.queue;if(c===null)throw Error(r(311));c.lastRenderedReducer=a;var d=e.baseQueue,f=c.pending;if(f!==null){if(d!==null){var y=d.next;d.next=f.next,f.next=y}t.baseQueue=d=f,c.pending=null}if(f=e.baseState,d===null)e.memoizedState=f;else{t=d.next;var w=y=null,q=null,re=t,ye=!1;do{var we=re.lane&-536870913;if(we!==re.lane?(jt&we)===we:(Na&we)===we){var ue=re.revertLane;if(ue===0)q!==null&&(q=q.next={lane:0,revertLane:0,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null}),we===Ei&&(ye=!0);else if((Na&ue)===ue){re=re.next,ue===Ei&&(ye=!0);continue}else we={lane:0,revertLane:re.revertLane,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},q===null?(w=q=we,y=f):q=q.next=we,ct.lanes|=ue,Rr|=ue;we=re.action,Ai&&a(f,we),f=re.hasEagerState?re.eagerState:a(f,we)}else ue={lane:we,revertLane:re.revertLane,gesture:re.gesture,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},q===null?(w=q=ue,y=f):q=q.next=ue,ct.lanes|=we,Rr|=we;re=re.next}while(re!==null&&re!==t);if(q===null?y=f:q.next=w,!Ts(f,e.memoizedState)&&(Jt=!0,ye&&(a=xr,a!==null)))throw a;e.memoizedState=f,e.baseState=y,e.baseQueue=q,c.lastRenderedState=f}return d===null&&(c.lanes=0),[e.memoizedState,c.dispatch]}function Uu(e){var t=Ln(),a=t.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=e;var c=a.dispatch,d=a.pending,f=t.memoizedState;if(d!==null){a.pending=null;var y=d=d.next;do f=e(f,y.action),y=y.next;while(y!==d);Ts(f,t.memoizedState)||(Jt=!0),t.memoizedState=f,t.baseQueue===null&&(t.baseState=f),a.lastRenderedState=f}return[f,c]}function Oo(e,t,a){var c=ct,d=Ln(),f=xt;if(f){if(a===void 0)throw Error(r(407));a=a()}else a=t();var y=!Ts((Ht||d).memoizedState,a);if(y&&(d.memoizedState=a,Jt=!0),d=d.queue,Ri(uf.bind(null,c,d,e),[e]),d.getSnapshot!==t||y||Xn!==null&&Xn.memoizedState.tag&1){if(c.flags|=2048,ta(9,{destroy:void 0},of.bind(null,c,d,a,t),null),rn===null)throw Error(r(349));f||(Na&127)!==0||cf(c,t,a)}return a}function cf(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=ct.updateQueue,t===null?(t=Ro(),ct.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function of(e,t,a,c){t.value=a,t.getSnapshot=c,df(t)&&ff(e)}function uf(e,t,a){return a(function(){df(t)&&ff(e)})}function df(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!Ts(e,a)}catch{return!0}}function ff(e){var t=Zl(e,2);t!==null&&Nl(t,e,2)}function $u(e){var t=_s();if(typeof e=="function"){var a=e;if(e=a(),Ai){fn(!0);try{a()}finally{fn(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ka,lastRenderedState:e},t}function hf(e,t,a,c){return e.baseState=a,Iu(e,Ht,typeof c=="function"?c:ka)}function mf(e,t,a,c,d){if(Uo(e))throw Error(r(485));if(e=t.action,e!==null){var f={payload:d,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(y){f.listeners.push(y)}};M.T!==null?a(!0):f.isTransition=!1,c(f),a=t.pending,a===null?(f.next=t.pending=f,Bu(t,f)):(f.next=a.next,t.pending=a.next=f)}}function Bu(e,t){var a=t.action,c=t.payload,d=e.state;if(t.isTransition){var f=M.T,y={};M.T=y;try{var w=a(d,c),q=M.S;q!==null&&q(y,w),Rc(e,t,w)}catch(re){il(e,t,re)}finally{f!==null&&y.types!==null&&(f.types=y.types),M.T=f}}else try{f=a(d,c),Rc(e,t,f)}catch(re){il(e,t,re)}}function Rc(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(c){xl(e,t,c)},function(c){return il(e,t,c)}):xl(e,t,a)}function xl(e,t,a){t.status="fulfilled",t.value=a,ln(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,Bu(e,a)))}function il(e,t,a){var c=e.pending;if(e.pending=null,c!==null){c=c.next;do t.status="rejected",t.reason=a,ln(t),t=t.next;while(t!==c)}e.action=null}function ln(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function zo(e,t){return t}function pf(e,t){if(xt){var a=rn.formState;if(a!==null){e:{var c=ct;if(xt){if(Mt){t:{for(var d=Mt,f=ne;d.nodeType!==8;){if(!f){d=null;break t}if(d=la(d.nextSibling),d===null){d=null;break t}}f=d.data,d=f==="F!"||f==="F"?d:null}if(d){Mt=la(d.nextSibling),c=d.data==="F!";break e}}sl(c)}c=!1}c&&(t=a[0])}}return a=_s(),a.memoizedState=a.baseState=t,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:zo,lastRenderedState:t},a.queue=c,a=wf.bind(null,ct,c),c.dispatch=a,c=$u(!1),f=Io.bind(null,ct,!1,c.queue),c=_s(),d={state:t,dispatch:null,action:e,pending:null},c.queue=d,a=mf.bind(null,ct,d,f,a),d.dispatch=a,c.memoizedState=e,[t,a,!1]}function gf(e){var t=Ln();return Dc(t,Ht,e)}function Dc(e,t,a){if(t=Iu(e,t,zo)[0],e=Lo(ka)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var c=Mc(t)}catch(y){throw y===_r?yo:y}else c=t;t=Ln();var d=t.queue,f=d.dispatch;return a!==t.memoizedState&&(ct.flags|=2048,ta(9,{destroy:void 0},xf.bind(null,d,a),null)),[c,f,e]}function xf(e,t){e.action=t}function Lc(e){var t=Ln(),a=Ht;if(a!==null)return Dc(t,a,e);Ln(),t=t.memoizedState,a=Ln();var c=a.queue.dispatch;return a.memoizedState=e,[t,c,!1]}function ta(e,t,a,c){return e={tag:e,create:a,deps:c,inst:t,next:null},t=ct.updateQueue,t===null&&(t=Ro(),ct.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(c=a.next,a.next=e,e.next=c,t.lastEffect=e),e}function Hu(){return Ln().memoizedState}function Mi(e,t,a,c){var d=_s();ct.flags|=e,d.memoizedState=ta(1|t,{destroy:void 0},a,c===void 0?null:c)}function Oc(e,t,a,c){var d=Ln();c=c===void 0?null:c;var f=d.memoizedState.inst;Ht!==null&&c!==null&&Er(c,Ht.memoizedState.deps)?d.memoizedState=ta(t,f,a,c):(ct.flags|=e,d.memoizedState=ta(1|t,f,a,c))}function _f(e,t){Mi(8390656,8,e,t)}function Ri(e,t){Oc(2048,8,e,t)}function bf(e){ct.flags|=4;var t=ct.updateQueue;if(t===null)t=Ro(),ct.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function yf(e){var t=Ln().memoizedState;return bf({ref:t,nextImpl:e}),function(){if((Ut&2)!==0)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function zc(e,t){return Oc(4,2,e,t)}function vf(e,t){return Oc(4,4,e,t)}function Cr(e,t){if(typeof t=="function"){e=e();var a=t(e);return function(){typeof a=="function"?a():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Di(e,t,a){a=a!=null?a.concat([e]):null,Oc(4,4,Cr.bind(null,t,e),a)}function qu(){}function Gu(e,t){var a=Ln();t=t===void 0?null:t;var c=a.memoizedState;return t!==null&&Er(t,c[1])?c[0]:(a.memoizedState=[e,t],e)}function Yu(e,t){var a=Ln();t=t===void 0?null:t;var c=a.memoizedState;if(t!==null&&Er(t,c[1]))return c[0];if(c=e(),Ai){fn(!0);try{e()}finally{fn(!1)}}return a.memoizedState=[c,t],c}function Vu(e,t,a){return a===void 0||(Na&1073741824)!==0&&(jt&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=kx(),ct.lanes|=e,Rr|=e,a)}function jf(e,t,a,c){return Ts(a,t)?a:Ka.current!==null?(e=Vu(e,a,c),Ts(e,t)||(Jt=!0),e):(Na&42)===0||(Na&1073741824)!==0&&(jt&261930)===0?(Jt=!0,e.memoizedState=a):(e=kx(),ct.lanes|=e,Rr|=e,t)}function Xu(e,t,a,c,d){var f=O.p;O.p=f!==0&&8>f?f:8;var y=M.T,w={};M.T=w,Io(e,!1,t,a);try{var q=d(),re=M.S;if(re!==null&&re(w,q),q!==null&&typeof q=="object"&&typeof q.then=="function"){var ye=pm(q,c);Li(e,t,ye,Ul(e))}else Li(e,t,c,Ul(e))}catch(we){Li(e,t,{then:function(){},status:"rejected",reason:we},Ul())}finally{O.p=f,y!==null&&w.types!==null&&(y.types=w.types),M.T=y}}function Nf(){}function Fu(e,t,a,c){if(e.tag!==5)throw Error(r(476));var d=kf(e).queue;Xu(e,d,t,J,a===null?Nf:function(){return na(e),a(c)})}function kf(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:J,baseState:J,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ka,lastRenderedState:J},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ka,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function na(e){var t=kf(e);t.next===null&&(t=e.alternate.memoizedState),Li(e,t.next.queue,{},Ul())}function Ku(){return is(dd)}function Ll(){return Ln().memoizedState}function Ic(){return Ln().memoizedState}function xm(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=Ul();e=va(a);var c=ja(t,e,a);c!==null&&(Nl(c,t,a),wc(c,t,a)),t={cache:Cu()},e.payload=t;return}t=t.return}}function Qu(e,t,a){var c=Ul();a={lane:c,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Uo(e)?Sf(t,a):(a=Al(e,t,a,c),a!==null&&(Nl(a,e,c),wa(a,t,c)))}function wf(e,t,a){var c=Ul();Li(e,t,a,c)}function Li(e,t,a,c){var d={lane:c,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Uo(e))Sf(t,d);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=t.lastRenderedReducer,f!==null))try{var y=t.lastRenderedState,w=f(y,a);if(d.hasEagerState=!0,d.eagerState=w,Ts(w,y))return _i(e,t,d,0),rn===null&&_c(),!1}catch{}finally{}if(a=Al(e,t,d,c),a!==null)return Nl(a,e,c),wa(a,t,c),!0}return!1}function Io(e,t,a,c){if(c={lane:2,revertLane:Ym(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Uo(e)){if(t)throw Error(r(479))}else t=Al(e,a,c,2),t!==null&&Nl(t,e,2)}function Uo(e){var t=e.alternate;return e===ct||t!==null&&t===ct}function Sf(e,t){wr=To=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function wa(e,t,a){if((a&4194048)!==0){var c=t.lanes;c&=e.pendingLanes,a|=c,t.lanes=a,Es(e,a)}}var Oi={readContext:is,use:Do,useCallback:Cn,useContext:Cn,useEffect:Cn,useImperativeHandle:Cn,useLayoutEffect:Cn,useInsertionEffect:Cn,useMemo:Cn,useReducer:Cn,useRef:Cn,useState:Cn,useDebugValue:Cn,useDeferredValue:Cn,useTransition:Cn,useSyncExternalStore:Cn,useId:Cn,useHostTransitionStatus:Cn,useFormState:Cn,useActionState:Cn,useOptimistic:Cn,useMemoCache:Cn,useCacheRefresh:Cn};Oi.useEffectEvent=Cn;var Ef={readContext:is,use:Do,useCallback:function(e,t){return _s().memoizedState=[e,t===void 0?null:t],e},useContext:is,useEffect:_f,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Mi(4194308,4,Cr.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Mi(4194308,4,e,t)},useInsertionEffect:function(e,t){Mi(4,2,e,t)},useMemo:function(e,t){var a=_s();t=t===void 0?null:t;var c=e();if(Ai){fn(!0);try{e()}finally{fn(!1)}}return a.memoizedState=[c,t],c},useReducer:function(e,t,a){var c=_s();if(a!==void 0){var d=a(t);if(Ai){fn(!0);try{a(t)}finally{fn(!1)}}}else d=t;return c.memoizedState=c.baseState=d,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:d},c.queue=e,e=e.dispatch=Qu.bind(null,ct,e),[c.memoizedState,e]},useRef:function(e){var t=_s();return e={current:e},t.memoizedState=e},useState:function(e){e=$u(e);var t=e.queue,a=wf.bind(null,ct,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:qu,useDeferredValue:function(e,t){var a=_s();return Vu(a,e,t)},useTransition:function(){var e=$u(!1);return e=Xu.bind(null,ct,e.queue,!0,!1),_s().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var c=ct,d=_s();if(xt){if(a===void 0)throw Error(r(407));a=a()}else{if(a=t(),rn===null)throw Error(r(349));(jt&127)!==0||cf(c,t,a)}d.memoizedState=a;var f={value:a,getSnapshot:t};return d.queue=f,_f(uf.bind(null,c,f,e),[e]),c.flags|=2048,ta(9,{destroy:void 0},of.bind(null,c,f,a,t),null),a},useId:function(){var e=_s(),t=rn.identifierPrefix;if(xt){var a=Jn,c=Gs;a=(c&~(1<<32-Qt(c)-1)).toString(32)+a,t="_"+t+"R_"+a,a=Ec++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=gm++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Ku,useFormState:pf,useActionState:pf,useOptimistic:function(e){var t=_s();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=Io.bind(null,ct,!0,a),a.dispatch=t,[e,t]},useMemoCache:zu,useCacheRefresh:function(){return _s().memoizedState=xm.bind(null,ct)},useEffectEvent:function(e){var t=_s(),a={impl:e};return t.memoizedState=a,function(){if((Ut&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}},$o={readContext:is,use:Do,useCallback:Gu,useContext:is,useEffect:Ri,useImperativeHandle:Di,useInsertionEffect:zc,useLayoutEffect:vf,useMemo:Yu,useReducer:Lo,useRef:Hu,useState:function(){return Lo(ka)},useDebugValue:qu,useDeferredValue:function(e,t){var a=Ln();return jf(a,Ht.memoizedState,e,t)},useTransition:function(){var e=Lo(ka)[0],t=Ln().memoizedState;return[typeof e=="boolean"?e:Mc(e),t]},useSyncExternalStore:Oo,useId:Ll,useHostTransitionStatus:Ku,useFormState:gf,useActionState:gf,useOptimistic:function(e,t){var a=Ln();return hf(a,Ht,e,t)},useMemoCache:zu,useCacheRefresh:Ic};$o.useEffectEvent=yf;var Zu={readContext:is,use:Do,useCallback:Gu,useContext:is,useEffect:Ri,useImperativeHandle:Di,useInsertionEffect:zc,useLayoutEffect:vf,useMemo:Yu,useReducer:Uu,useRef:Hu,useState:function(){return Uu(ka)},useDebugValue:qu,useDeferredValue:function(e,t){var a=Ln();return Ht===null?Vu(a,e,t):jf(a,Ht.memoizedState,e,t)},useTransition:function(){var e=Uu(ka)[0],t=Ln().memoizedState;return[typeof e=="boolean"?e:Mc(e),t]},useSyncExternalStore:Oo,useId:Ll,useHostTransitionStatus:Ku,useFormState:Lc,useActionState:Lc,useOptimistic:function(e,t){var a=Ln();return Ht!==null?hf(a,Ht,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:zu,useCacheRefresh:Ic};Zu.useEffectEvent=yf;function h(e,t,a,c){t=e.memoizedState,a=a(c,t),a=a==null?t:j({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var R={enqueueSetState:function(e,t,a){e=e._reactInternals;var c=Ul(),d=va(c);d.payload=t,a!=null&&(d.callback=a),t=ja(e,d,c),t!==null&&(Nl(t,e,c),wc(t,e,c))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var c=Ul(),d=va(c);d.tag=1,d.payload=t,a!=null&&(d.callback=a),t=ja(e,d,c),t!==null&&(Nl(t,e,c),wc(t,e,c))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=Ul(),c=va(a);c.tag=2,t!=null&&(c.callback=t),t=ja(e,c,a),t!==null&&(Nl(t,e,a),wc(t,e,a))}};function ee(e,t,a,c,d,f,y){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(c,f,y):t.prototype&&t.prototype.isPureReactComponent?!Ua(a,c)||!Ua(d,f):!0}function Ne(e,t,a,c){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(a,c),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(a,c),t.state!==e&&R.enqueueReplaceState(t,t.state,null)}function Le(e,t){var a=t;if("ref"in t){a={};for(var c in t)c!=="ref"&&(a[c]=t[c])}if(e=e.defaultProps){a===t&&(a=j({},a));for(var d in e)a[d]===void 0&&(a[d]=e[d])}return a}function pt(e){Ql(e)}function an(e){console.error(e)}function bs(e){Ql(e)}function Ol(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(c){setTimeout(function(){throw c})}}function sa(e,t,a){try{var c=e.onCaughtError;c(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(d){setTimeout(function(){throw d})}}function _l(e,t,a){return a=va(a),a.tag=3,a.payload={element:null},a.callback=function(){Ol(e,t)},a}function Sa(e){return e=va(e),e.tag=3,e}function Ea(e,t,a,c){var d=a.type.getDerivedStateFromError;if(typeof d=="function"){var f=c.value;e.payload=function(){return d(f)},e.callback=function(){sa(t,a,c)}}var y=a.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(e.callback=function(){sa(t,a,c),typeof d!="function"&&(Dr===null?Dr=new Set([this]):Dr.add(this));var w=c.stack;this.componentDidCatch(c.value,{componentStack:w!==null?w:""})})}function zi(e,t,a,c,d){if(a.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(t=a.alternate,t!==null&&gr(t,a,d,!0),a=xs.current,a!==null){switch(a.tag){case 31:case 13:return ll===null?Uf():a.alternate===null&&Fn===0&&(Fn=3),a.flags&=-257,a.flags|=65536,a.lanes=d,c===vo?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([c]):t.add(c),Hm(e,c,d)),!1;case 22:return a.flags|=65536,c===vo?a.flags|=16384:(t=a.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([c])},a.updateQueue=t):(a=t.retryQueue,a===null?t.retryQueue=new Set([c]):a.add(c)),Hm(e,c,d)),!1}throw Error(r(435,a.tag))}return Hm(e,c,d),Uf(),!1}if(xt)return t=xs.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=d,c!==Su&&(e=Error(r(422),{cause:c}),yc(el(e,a)))):(c!==Su&&(t=Error(r(423),{cause:c}),yc(el(t,a))),e=e.current.alternate,e.flags|=65536,d&=-d,e.lanes|=d,c=el(c,a),d=_l(e.stateNode,c,d),ko(e,d),Fn!==4&&(Fn=2)),!1;var f=Error(r(520),{cause:c});if(f=el(f,a),sd===null?sd=[f]:sd.push(f),Fn!==4&&(Fn=2),t===null)return!0;c=el(c,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=d&-d,a.lanes|=e,e=_l(a.stateNode,c,e),ko(a,e),!1;case 1:if(t=a.type,f=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||f!==null&&typeof f.componentDidCatch=="function"&&(Dr===null||!Dr.has(f))))return a.flags|=65536,d&=-d,a.lanes|=d,d=Sa(d),Ea(d,e,a,c),ko(a,d),!1}a=a.return}while(a!==null);return!1}var ys=Error(r(461)),Jt=!1;function rs(e,t,a,c){t.child=e===null?jo(t,null,a,c):Fa(t,e.child,a,c)}function ke(e,t,a,c,d){a=a.render;var f=t.ref;if("ref"in c){var y={};for(var w in c)w!=="ref"&&(y[w]=c[w])}else y=c;return Si(t),c=Tc(e,t,a,y,f,d),w=Ou(),e!==null&&!Jt?(Ao(e,t,d),Ii(e,t,d)):(xt&&w&&Ni(t),t.flags|=1,rs(e,t,c,d),t.child)}function Ce(e,t,a,c,d){if(e===null){var f=a.type;return typeof f=="function"&&!wu(f)&&f.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=f,Ue(e,t,f,c,d)):(e=bi(a.type,null,c,t,t.mode,d),e.ref=t.ref,e.return=t,t.child=e)}if(f=e.child,!wm(e,d)){var y=f.memoizedProps;if(a=a.compare,a=a!==null?a:Ua,a(y,c)&&e.ref===t.ref)return Ii(e,t,d)}return t.flags|=1,e=xa(f,c),e.ref=t.ref,e.return=t,t.child=e}function Ue(e,t,a,c,d){if(e!==null){var f=e.memoizedProps;if(Ua(f,c)&&e.ref===t.ref)if(Jt=!1,t.pendingProps=c=f,wm(e,d))(e.flags&131072)!==0&&(Jt=!0);else return t.lanes=e.lanes,Ii(e,t,d)}return _m(e,t,a,c,d)}function Be(e,t,a,c){var d=c.children,f=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.mode==="hidden"){if((t.flags&128)!==0){if(f=f!==null?f.baseLanes|a:a,e!==null){for(c=t.child=e.child,d=0;c!==null;)d=d|c.lanes|c.childLanes,c=c.sibling;c=d&~f}else c=0,t.child=null;return qt(e,t,f,a,c)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ya(t,f!==null?f.cachePool:null),f!==null?sf(t,f):Du(),lf(t);else return c=t.lanes=536870912,qt(e,t,f!==null?f.baseLanes|a:a,a,c)}else f!==null?(Ya(t,f.cachePool),sf(t,f),Za(),t.memoizedState=null):(e!==null&&Ya(t,null),Du(),Za());return rs(e,t,d,a),t.child}function Xe(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function qt(e,t,a,c,d){var f=Au();return f=f===null?null:{parent:Vn._currentValue,pool:f},t.memoizedState={baseLanes:a,cachePool:f},e!==null&&Ya(t,null),Du(),lf(t),e!==null&&gr(e,t,c,!0),t.childLanes=d,null}function Tr(e,t){return t=Tf({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Kg(e,t,a){return Fa(t,e.child,null,a),e=Tr(t,t.pendingProps),e.flags|=2,al(t),t.memoizedState=null,e}function wv(e,t,a){var c=t.pendingProps,d=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(xt){if(c.mode==="hidden")return e=Tr(t,c),t.lanes=536870912,Xe(null,e);if(Eo(t),(e=Mt)?(e=i_(e,ne),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Rl!==null?{id:Gs,overflow:Jn}:null,retryLane:536870912,hydrationErrors:null},a=hr(e),a.return=t,t.child=a,ls=t,Mt=null)):e=null,e===null)throw sl(t);return t.lanes=536870912,null}return Tr(t,c)}var f=e.memoizedState;if(f!==null){var y=f.dehydrated;if(Eo(t),d)if(t.flags&256)t.flags&=-257,t=Kg(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(r(558));else if(Jt||gr(e,t,a,!1),d=(a&e.childLanes)!==0,Jt||d){if(c=rn,c!==null&&(y=Mn(c,a),y!==0&&y!==f.retryLane))throw f.retryLane=y,Zl(e,y),Nl(c,e,y),ys;Uf(),t=Kg(e,t,a)}else e=f.treeContext,Mt=la(y.nextSibling),ls=t,xt=!0,Ga=null,ne=!1,e!==null&&mr(t,e),t=Tr(t,c),t.flags|=4096;return t}return e=xa(e.child,{mode:c.mode,children:c.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Cf(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(r(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function _m(e,t,a,c,d){return Si(t),a=Tc(e,t,a,c,void 0,d),c=Ou(),e!==null&&!Jt?(Ao(e,t,d),Ii(e,t,d)):(xt&&c&&Ni(t),t.flags|=1,rs(e,t,a,d),t.child)}function Qg(e,t,a,c,d,f){return Si(t),t.updateQueue=null,a=af(t,c,a,d),Ac(e),c=Ou(),e!==null&&!Jt?(Ao(e,t,f),Ii(e,t,f)):(xt&&c&&Ni(t),t.flags|=1,rs(e,t,a,f),t.child)}function Zg(e,t,a,c,d){if(Si(t),t.stateNode===null){var f=Wl,y=a.contextType;typeof y=="object"&&y!==null&&(f=is(y)),f=new a(c,f),t.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=R,t.stateNode=f,f._reactInternals=t,f=t.stateNode,f.props=c,f.state=t.memoizedState,f.refs={},kc(t),y=a.contextType,f.context=typeof y=="object"&&y!==null?is(y):Wl,f.state=t.memoizedState,y=a.getDerivedStateFromProps,typeof y=="function"&&(h(t,a,y,c),f.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(y=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),y!==f.state&&R.enqueueReplaceState(f,f.state,null),kr(t,c,f,d),Nr(),f.state=t.memoizedState),typeof f.componentDidMount=="function"&&(t.flags|=4194308),c=!0}else if(e===null){f=t.stateNode;var w=t.memoizedProps,q=Le(a,w);f.props=q;var re=f.context,ye=a.contextType;y=Wl,typeof ye=="object"&&ye!==null&&(y=is(ye));var we=a.getDerivedStateFromProps;ye=typeof we=="function"||typeof f.getSnapshotBeforeUpdate=="function",w=t.pendingProps!==w,ye||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(w||re!==y)&&Ne(t,f,c,y),ya=!1;var ue=t.memoizedState;f.state=ue,kr(t,c,f,d),Nr(),re=t.memoizedState,w||ue!==re||ya?(typeof we=="function"&&(h(t,a,we,c),re=t.memoizedState),(q=ya||ee(t,a,q,c,ue,re,y))?(ye||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount()),typeof f.componentDidMount=="function"&&(t.flags|=4194308)):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=c,t.memoizedState=re),f.props=c,f.state=re,f.context=y,c=q):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),c=!1)}else{f=t.stateNode,No(e,t),y=t.memoizedProps,ye=Le(a,y),f.props=ye,we=t.pendingProps,ue=f.context,re=a.contextType,q=Wl,typeof re=="object"&&re!==null&&(q=is(re)),w=a.getDerivedStateFromProps,(re=typeof w=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(y!==we||ue!==q)&&Ne(t,f,c,q),ya=!1,ue=t.memoizedState,f.state=ue,kr(t,c,f,d),Nr();var he=t.memoizedState;y!==we||ue!==he||ya||e!==null&&e.dependencies!==null&&Ys(e.dependencies)?(typeof w=="function"&&(h(t,a,w,c),he=t.memoizedState),(ye=ya||ee(t,a,ye,c,ue,he,q)||e!==null&&e.dependencies!==null&&Ys(e.dependencies))?(re||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(c,he,q),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(c,he,q)),typeof f.componentDidUpdate=="function"&&(t.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof f.componentDidUpdate!="function"||y===e.memoizedProps&&ue===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&ue===e.memoizedState||(t.flags|=1024),t.memoizedProps=c,t.memoizedState=he),f.props=c,f.state=he,f.context=q,c=ye):(typeof f.componentDidUpdate!="function"||y===e.memoizedProps&&ue===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&ue===e.memoizedState||(t.flags|=1024),c=!1)}return f=c,Cf(e,t),c=(t.flags&128)!==0,f||c?(f=t.stateNode,a=c&&typeof a.getDerivedStateFromError!="function"?null:f.render(),t.flags|=1,e!==null&&c?(t.child=Fa(t,e.child,null,d),t.child=Fa(t,null,a,d)):rs(e,t,a,d),t.memoizedState=f.state,e=t.child):e=Ii(e,t,d),e}function Pg(e,t,a,c){return wi(),t.flags|=256,rs(e,t,a,c),t.child}var bm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ym(e){return{baseLanes:e,cachePool:Jd()}}function vm(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=Il),e}function Wg(e,t,a){var c=t.pendingProps,d=!1,f=(t.flags&128)!==0,y;if((y=f)||(y=e!==null&&e.memoizedState===null?!1:(Dn.current&2)!==0),y&&(d=!0,t.flags&=-129),y=(t.flags&32)!==0,t.flags&=-33,e===null){if(xt){if(d?Qa(t):Za(),(e=Mt)?(e=i_(e,ne),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Rl!==null?{id:Gs,overflow:Jn}:null,retryLane:536870912,hydrationErrors:null},a=hr(e),a.return=t,t.child=a,ls=t,Mt=null)):e=null,e===null)throw sl(t);return sp(e)?t.lanes=32:t.lanes=536870912,null}var w=c.children;return c=c.fallback,d?(Za(),d=t.mode,w=Tf({mode:"hidden",children:w},d),c=dn(c,d,a,null),w.return=t,c.return=t,w.sibling=c,t.child=w,c=t.child,c.memoizedState=ym(a),c.childLanes=vm(e,y,a),t.memoizedState=bm,Xe(null,c)):(Qa(t),jm(t,w))}var q=e.memoizedState;if(q!==null&&(w=q.dehydrated,w!==null)){if(f)t.flags&256?(Qa(t),t.flags&=-257,t=Nm(e,t,a)):t.memoizedState!==null?(Za(),t.child=e.child,t.flags|=128,t=null):(Za(),w=c.fallback,d=t.mode,c=Tf({mode:"visible",children:c.children},d),w=dn(w,d,a,null),w.flags|=2,c.return=t,w.return=t,c.sibling=w,t.child=c,Fa(t,e.child,null,a),c=t.child,c.memoizedState=ym(a),c.childLanes=vm(e,y,a),t.memoizedState=bm,t=Xe(null,c));else if(Qa(t),sp(w)){if(y=w.nextSibling&&w.nextSibling.dataset,y)var re=y.dgst;y=re,c=Error(r(419)),c.stack="",c.digest=y,yc({value:c,source:null,stack:null}),t=Nm(e,t,a)}else if(Jt||gr(e,t,a,!1),y=(a&e.childLanes)!==0,Jt||y){if(y=rn,y!==null&&(c=Mn(y,a),c!==0&&c!==q.retryLane))throw q.retryLane=c,Zl(e,c),Nl(y,e,c),ys;np(w)||Uf(),t=Nm(e,t,a)}else np(w)?(t.flags|=192,t.child=e.child,t=null):(e=q.treeContext,Mt=la(w.nextSibling),ls=t,xt=!0,Ga=null,ne=!1,e!==null&&mr(t,e),t=jm(t,c.children),t.flags|=4096);return t}return d?(Za(),w=c.fallback,d=t.mode,q=e.child,re=q.sibling,c=xa(q,{mode:"hidden",children:c.children}),c.subtreeFlags=q.subtreeFlags&65011712,re!==null?w=xa(re,w):(w=dn(w,d,a,null),w.flags|=2),w.return=t,c.return=t,c.sibling=w,t.child=c,Xe(null,c),c=t.child,w=e.child.memoizedState,w===null?w=ym(a):(d=w.cachePool,d!==null?(q=Vn._currentValue,d=d.parent!==q?{parent:q,pool:q}:d):d=Jd(),w={baseLanes:w.baseLanes|a,cachePool:d}),c.memoizedState=w,c.childLanes=vm(e,y,a),t.memoizedState=bm,Xe(e.child,c)):(Qa(t),a=e.child,e=a.sibling,a=xa(a,{mode:"visible",children:c.children}),a.return=t,a.sibling=null,e!==null&&(y=t.deletions,y===null?(t.deletions=[e],t.flags|=16):y.push(e)),t.child=a,t.memoizedState=null,a)}function jm(e,t){return t=Tf({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Tf(e,t){return e=Ms(22,e,null,t),e.lanes=0,e}function Nm(e,t,a){return Fa(t,e.child,null,a),e=jm(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Jg(e,t,a){e.lanes|=t;var c=e.alternate;c!==null&&(c.lanes|=t),pr(e.return,t,a)}function km(e,t,a,c,d,f){var y=e.memoizedState;y===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:c,tail:a,tailMode:d,treeForkCount:f}:(y.isBackwards=t,y.rendering=null,y.renderingStartTime=0,y.last=c,y.tail=a,y.tailMode=d,y.treeForkCount=f)}function ex(e,t,a){var c=t.pendingProps,d=c.revealOrder,f=c.tail;c=c.children;var y=Dn.current,w=(y&2)!==0;if(w?(y=y&1|2,t.flags|=128):y&=1,me(Dn,y),rs(e,t,c,a),c=xt?tl:0,!w&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Jg(e,a,t);else if(e.tag===19)Jg(e,a,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(d){case"forwards":for(a=t.child,d=null;a!==null;)e=a.alternate,e!==null&&Co(e)===null&&(d=a),a=a.sibling;a=d,a===null?(d=t.child,t.child=null):(d=a.sibling,a.sibling=null),km(t,!1,d,a,f,c);break;case"backwards":case"unstable_legacy-backwards":for(a=null,d=t.child,t.child=null;d!==null;){if(e=d.alternate,e!==null&&Co(e)===null){t.child=d;break}e=d.sibling,d.sibling=a,a=d,d=e}km(t,!0,a,null,f,c);break;case"together":km(t,!1,null,null,void 0,c);break;default:t.memoizedState=null}return t.child}function Ii(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),Rr|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(gr(e,t,a,!1),(a&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,a=xa(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=xa(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function wm(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Ys(e)))}function Sv(e,t,a){switch(t.tag){case 3:qe(t,t.stateNode.containerInfo),as(t,Vn,e.memoizedState.cache),wi();break;case 27:case 5:Ge(t);break;case 4:qe(t,t.stateNode.containerInfo);break;case 10:as(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Eo(t),null;break;case 13:var c=t.memoizedState;if(c!==null)return c.dehydrated!==null?(Qa(t),t.flags|=128,null):(a&t.child.childLanes)!==0?Wg(e,t,a):(Qa(t),e=Ii(e,t,a),e!==null?e.sibling:null);Qa(t);break;case 19:var d=(e.flags&128)!==0;if(c=(a&t.childLanes)!==0,c||(gr(e,t,a,!1),c=(a&t.childLanes)!==0),d){if(c)return ex(e,t,a);t.flags|=128}if(d=t.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),me(Dn,Dn.current),c)break;return null;case 22:return t.lanes=0,Be(e,t,a,t.pendingProps);case 24:as(t,Vn,e.memoizedState.cache)}return Ii(e,t,a)}function tx(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)Jt=!0;else{if(!wm(e,a)&&(t.flags&128)===0)return Jt=!1,Sv(e,t,a);Jt=(e.flags&131072)!==0}else Jt=!1,xt&&(t.flags&1048576)!==0&&ji(t,tl,t.index);switch(t.lanes=0,t.tag){case 16:e:{var c=t.pendingProps;if(e=Ti(t.elementType),t.type=e,typeof e=="function")wu(e)?(c=Le(e,c),t.tag=1,t=Zg(null,t,e,c,a)):(t.tag=0,t=_m(null,t,e,c,a));else{if(e!=null){var d=e.$$typeof;if(d===P){t.tag=11,t=ke(null,t,e,c,a);break e}else if(d===H){t.tag=14,t=Ce(null,t,e,c,a);break e}}throw t=U(e)||e,Error(r(306,t,""))}}return t;case 0:return _m(e,t,t.type,t.pendingProps,a);case 1:return c=t.type,d=Le(c,t.pendingProps),Zg(e,t,c,d,a);case 3:e:{if(qe(t,t.stateNode.containerInfo),e===null)throw Error(r(387));c=t.pendingProps;var f=t.memoizedState;d=f.element,No(e,t),kr(t,c,null,a);var y=t.memoizedState;if(c=y.cache,as(t,Vn,c),c!==f.cache&&_o(t,[Vn],a,!0),Nr(),c=y.element,f.isDehydrated)if(f={element:c,isDehydrated:!1,cache:y.cache},t.updateQueue.baseState=f,t.memoizedState=f,t.flags&256){t=Pg(e,t,c,a);break e}else if(c!==d){d=el(Error(r(424)),t),yc(d),t=Pg(e,t,c,a);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Mt=la(e.firstChild),ls=t,xt=!0,Ga=null,ne=!0,a=jo(t,null,c,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(wi(),c===d){t=Ii(e,t,a);break e}rs(e,t,c,a)}t=t.child}return t;case 26:return Cf(e,t),e===null?(a=f_(t.type,null,t.pendingProps,null))?t.memoizedState=a:xt||(a=t.type,e=t.pendingProps,c=Vf(de.current).createElement(a),c[wt]=t,c[At]=e,Ds(c,a,e),rt(c),t.stateNode=c):t.memoizedState=f_(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Ge(t),e===null&&xt&&(c=t.stateNode=o_(t.type,t.pendingProps,de.current),ls=t,ne=!0,d=Mt,Ir(t.type)?(lp=d,Mt=la(c.firstChild)):Mt=d),rs(e,t,t.pendingProps.children,a),Cf(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&xt&&((d=c=Mt)&&(c=nj(c,t.type,t.pendingProps,ne),c!==null?(t.stateNode=c,ls=t,Mt=la(c.firstChild),ne=!1,d=!0):d=!1),d||sl(t)),Ge(t),d=t.type,f=t.pendingProps,y=e!==null?e.memoizedProps:null,c=f.children,Jm(d,f)?c=null:y!==null&&Jm(d,y)&&(t.flags|=32),t.memoizedState!==null&&(d=Tc(e,t,rf,null,null,a),dd._currentValue=d),Cf(e,t),rs(e,t,c,a),t.child;case 6:return e===null&&xt&&((e=a=Mt)&&(a=sj(a,t.pendingProps,ne),a!==null?(t.stateNode=a,ls=t,Mt=null,e=!0):e=!1),e||sl(t)),null;case 13:return Wg(e,t,a);case 4:return qe(t,t.stateNode.containerInfo),c=t.pendingProps,e===null?t.child=Fa(t,null,c,a):rs(e,t,c,a),t.child;case 11:return ke(e,t,t.type,t.pendingProps,a);case 7:return rs(e,t,t.pendingProps,a),t.child;case 8:return rs(e,t,t.pendingProps.children,a),t.child;case 12:return rs(e,t,t.pendingProps.children,a),t.child;case 10:return c=t.pendingProps,as(t,t.type,c.value),rs(e,t,c.children,a),t.child;case 9:return d=t.type._context,c=t.pendingProps.children,Si(t),d=is(d),c=c(d),t.flags|=1,rs(e,t,c,a),t.child;case 14:return Ce(e,t,t.type,t.pendingProps,a);case 15:return Ue(e,t,t.type,t.pendingProps,a);case 19:return ex(e,t,a);case 31:return wv(e,t,a);case 22:return Be(e,t,a,t.pendingProps);case 24:return Si(t),c=is(Vn),e===null?(d=Au(),d===null&&(d=rn,f=Cu(),d.pooledCache=f,f.refCount++,f!==null&&(d.pooledCacheLanes|=a),d=f),t.memoizedState={parent:c,cache:d},kc(t),as(t,Vn,d)):((e.lanes&a)!==0&&(No(e,t),kr(t,null,null,a),Nr()),d=e.memoizedState,f=t.memoizedState,d.parent!==c?(d={parent:c,cache:c},t.memoizedState=d,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=d),as(t,Vn,c)):(c=f.cache,as(t,Vn,c),c!==d.cache&&_o(t,[Vn],a,!0))),rs(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(r(156,t.tag))}function Ui(e){e.flags|=4}function Sm(e,t,a,c,d){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(d&335544128)===d)if(e.stateNode.complete)e.flags|=8192;else if(Cx())e.flags|=8192;else throw Xa=vo,jc}else e.flags&=-16777217}function nx(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!x_(t))if(Cx())e.flags|=8192;else throw Xa=vo,jc}function Af(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Bn():536870912,e.lanes|=t,Go|=t)}function Pu(e,t){if(!xt)switch(e.tailMode){case"hidden":t=e.tail;for(var a=null;t!==null;)t.alternate!==null&&(a=t),t=t.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:c.sibling=null}}function _n(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,c=0;if(t)for(var d=e.child;d!==null;)a|=d.lanes|d.childLanes,c|=d.subtreeFlags&65011712,c|=d.flags&65011712,d.return=e,d=d.sibling;else for(d=e.child;d!==null;)a|=d.lanes|d.childLanes,c|=d.subtreeFlags,c|=d.flags,d.return=e,d=d.sibling;return e.subtreeFlags|=c,e.childLanes=a,t}function Ev(e,t,a){var c=t.pendingProps;switch(ki(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return _n(t),null;case 1:return _n(t),null;case 3:return a=t.stateNode,c=null,e!==null&&(c=e.memoizedState.cache),t.memoizedState.cache!==c&&(t.flags|=2048),ea(Vn),Se(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(_a(t)?Ui(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Eu())),_n(t),null;case 26:var d=t.type,f=t.memoizedState;return e===null?(Ui(t),f!==null?(_n(t),nx(t,f)):(_n(t),Sm(t,d,null,c,a))):f?f!==e.memoizedState?(Ui(t),_n(t),nx(t,f)):(_n(t),t.flags&=-16777217):(e=e.memoizedProps,e!==c&&Ui(t),_n(t),Sm(t,d,e,c,a)),null;case 27:if(Ve(t),a=de.current,d=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==c&&Ui(t);else{if(!c){if(t.stateNode===null)throw Error(r(166));return _n(t),null}e=Ee.current,_a(t)?xo(t):(e=o_(d,c,a),t.stateNode=e,Ui(t))}return _n(t),null;case 5:if(Ve(t),d=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==c&&Ui(t);else{if(!c){if(t.stateNode===null)throw Error(r(166));return _n(t),null}if(f=Ee.current,_a(t))xo(t);else{var y=Vf(de.current);switch(f){case 1:f=y.createElementNS("http://www.w3.org/2000/svg",d);break;case 2:f=y.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;default:switch(d){case"svg":f=y.createElementNS("http://www.w3.org/2000/svg",d);break;case"math":f=y.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;case"script":f=y.createElement("div"),f.innerHTML="<script><\/script>",f=f.removeChild(f.firstChild);break;case"select":f=typeof c.is=="string"?y.createElement("select",{is:c.is}):y.createElement("select"),c.multiple?f.multiple=!0:c.size&&(f.size=c.size);break;default:f=typeof c.is=="string"?y.createElement(d,{is:c.is}):y.createElement(d)}}f[wt]=t,f[At]=c;e:for(y=t.child;y!==null;){if(y.tag===5||y.tag===6)f.appendChild(y.stateNode);else if(y.tag!==4&&y.tag!==27&&y.child!==null){y.child.return=y,y=y.child;continue}if(y===t)break e;for(;y.sibling===null;){if(y.return===null||y.return===t)break e;y=y.return}y.sibling.return=y.return,y=y.sibling}t.stateNode=f;e:switch(Ds(f,d,c),d){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&Ui(t)}}return _n(t),Sm(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==c&&Ui(t);else{if(typeof c!="string"&&t.stateNode===null)throw Error(r(166));if(e=de.current,_a(t)){if(e=t.stateNode,a=t.memoizedProps,c=null,d=ls,d!==null)switch(d.tag){case 27:case 5:c=d.memoizedProps}e[wt]=t,e=!!(e.nodeValue===a||c!==null&&c.suppressHydrationWarning===!0||Wx(e.nodeValue,a)),e||sl(t,!0)}else e=Vf(e).createTextNode(c),e[wt]=t,t.stateNode=e}return _n(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(c=_a(t),a!==null){if(e===null){if(!c)throw Error(r(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[wt]=t}else wi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;_n(t),e=!1}else a=Eu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(al(t),t):(al(t),null);if((t.flags&128)!==0)throw Error(r(558))}return _n(t),null;case 13:if(c=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(d=_a(t),c!==null&&c.dehydrated!==null){if(e===null){if(!d)throw Error(r(318));if(d=t.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(r(317));d[wt]=t}else wi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;_n(t),d=!1}else d=Eu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=d),d=!0;if(!d)return t.flags&256?(al(t),t):(al(t),null)}return al(t),(t.flags&128)!==0?(t.lanes=a,t):(a=c!==null,e=e!==null&&e.memoizedState!==null,a&&(c=t.child,d=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(d=c.alternate.memoizedState.cachePool.pool),f=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(f=c.memoizedState.cachePool.pool),f!==d&&(c.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),Af(t,t.updateQueue),_n(t),null);case 4:return Se(),e===null&&Km(t.stateNode.containerInfo),_n(t),null;case 10:return ea(t.type),_n(t),null;case 19:if(W(Dn),c=t.memoizedState,c===null)return _n(t),null;if(d=(t.flags&128)!==0,f=c.rendering,f===null)if(d)Pu(c,!1);else{if(Fn!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(f=Co(e),f!==null){for(t.flags|=128,Pu(c,!1),e=f.updateQueue,t.updateQueue=e,Af(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)go(a,e),a=a.sibling;return me(Dn,Dn.current&1|2),xt&&Jl(t,c.treeForkCount),t.child}e=e.sibling}c.tail!==null&&ut()>Of&&(t.flags|=128,d=!0,Pu(c,!1),t.lanes=4194304)}else{if(!d)if(e=Co(f),e!==null){if(t.flags|=128,d=!0,e=e.updateQueue,t.updateQueue=e,Af(t,e),Pu(c,!0),c.tail===null&&c.tailMode==="hidden"&&!f.alternate&&!xt)return _n(t),null}else 2*ut()-c.renderingStartTime>Of&&a!==536870912&&(t.flags|=128,d=!0,Pu(c,!1),t.lanes=4194304);c.isBackwards?(f.sibling=t.child,t.child=f):(e=c.last,e!==null?e.sibling=f:t.child=f,c.last=f)}return c.tail!==null?(e=c.tail,c.rendering=e,c.tail=e.sibling,c.renderingStartTime=ut(),e.sibling=null,a=Dn.current,me(Dn,d?a&1|2:a&1),xt&&Jl(t,c.treeForkCount),e):(_n(t),null);case 22:case 23:return al(t),Lu(),c=t.memoizedState!==null,e!==null?e.memoizedState!==null!==c&&(t.flags|=8192):c&&(t.flags|=8192),c?(a&536870912)!==0&&(t.flags&128)===0&&(_n(t),t.subtreeFlags&6&&(t.flags|=8192)):_n(t),a=t.updateQueue,a!==null&&Af(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),c=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(c=t.memoizedState.cachePool.pool),c!==a&&(t.flags|=2048),e!==null&&W(Ci),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),ea(Vn),_n(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function Cv(e,t){switch(ki(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ea(Vn),Se(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ve(t),null;case 31:if(t.memoizedState!==null){if(al(t),t.alternate===null)throw Error(r(340));wi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(al(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));wi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return W(Dn),null;case 4:return Se(),null;case 10:return ea(t.type),null;case 22:case 23:return al(t),Lu(),e!==null&&W(Ci),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ea(Vn),null;case 25:return null;default:return null}}function sx(e,t){switch(ki(t),t.tag){case 3:ea(Vn),Se();break;case 26:case 27:case 5:Ve(t);break;case 4:Se();break;case 31:t.memoizedState!==null&&al(t);break;case 13:al(t);break;case 19:W(Dn);break;case 10:ea(t.type);break;case 22:case 23:al(t),Lu(),e!==null&&W(Ci);break;case 24:ea(Vn)}}function Wu(e,t){try{var a=t.updateQueue,c=a!==null?a.lastEffect:null;if(c!==null){var d=c.next;a=d;do{if((a.tag&e)===e){c=void 0;var f=a.create,y=a.inst;c=f(),y.destroy=c}a=a.next}while(a!==d)}}catch(w){Xt(t,t.return,w)}}function Ar(e,t,a){try{var c=t.updateQueue,d=c!==null?c.lastEffect:null;if(d!==null){var f=d.next;c=f;do{if((c.tag&e)===e){var y=c.inst,w=y.destroy;if(w!==void 0){y.destroy=void 0,d=t;var q=a,re=w;try{re()}catch(ye){Xt(d,q,ye)}}}c=c.next}while(c!==f)}}catch(ye){Xt(t,t.return,ye)}}function lx(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{nf(t,a)}catch(c){Xt(e,e.return,c)}}}function ax(e,t,a){a.props=Le(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(c){Xt(e,t,c)}}function Ju(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var c=e.stateNode;break;case 30:c=e.stateNode;break;default:c=e.stateNode}typeof a=="function"?e.refCleanup=a(c):a.current=c}}catch(d){Xt(e,t,d)}}function Pa(e,t){var a=e.ref,c=e.refCleanup;if(a!==null)if(typeof c=="function")try{c()}catch(d){Xt(e,t,d)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(d){Xt(e,t,d)}else a.current=null}function ix(e){var t=e.type,a=e.memoizedProps,c=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&c.focus();break e;case"img":a.src?c.src=a.src:a.srcSet&&(c.srcset=a.srcSet)}}catch(d){Xt(e,e.return,d)}}function Em(e,t,a){try{var c=e.stateNode;Zv(c,e.type,a,t),c[At]=t}catch(d){Xt(e,e.return,d)}}function rx(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ir(e.type)||e.tag===4}function Cm(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||rx(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&&Ir(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Tm(e,t,a){var c=e.tag;if(c===5||c===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=Yn));else if(c!==4&&(c===27&&Ir(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(Tm(e,t,a),e=e.sibling;e!==null;)Tm(e,t,a),e=e.sibling}function Mf(e,t,a){var c=e.tag;if(c===5||c===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(c!==4&&(c===27&&Ir(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Mf(e,t,a),e=e.sibling;e!==null;)Mf(e,t,a),e=e.sibling}function cx(e){var t=e.stateNode,a=e.memoizedProps;try{for(var c=e.type,d=t.attributes;d.length;)t.removeAttributeNode(d[0]);Ds(t,c,a),t[wt]=e,t[At]=a}catch(f){Xt(e,e.return,f)}}var $i=!1,cs=!1,Am=!1,ox=typeof WeakSet=="function"?WeakSet:Set,ws=null;function Tv(e,t){if(e=e.containerInfo,Pm=Wf,e=$a(e),mi(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var c=a.getSelection&&a.getSelection();if(c&&c.rangeCount!==0){a=c.anchorNode;var d=c.anchorOffset,f=c.focusNode;c=c.focusOffset;try{a.nodeType,f.nodeType}catch{a=null;break e}var y=0,w=-1,q=-1,re=0,ye=0,we=e,ue=null;t:for(;;){for(var he;we!==a||d!==0&&we.nodeType!==3||(w=y+d),we!==f||c!==0&&we.nodeType!==3||(q=y+c),we.nodeType===3&&(y+=we.nodeValue.length),(he=we.firstChild)!==null;)ue=we,we=he;for(;;){if(we===e)break t;if(ue===a&&++re===d&&(w=y),ue===f&&++ye===c&&(q=y),(he=we.nextSibling)!==null)break;we=ue,ue=we.parentNode}we=he}a=w===-1||q===-1?null:{start:w,end:q}}else a=null}a=a||{start:0,end:0}}else a=null;for(Wm={focusedElem:e,selectionRange:a},Wf=!1,ws=t;ws!==null;)if(t=ws,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ws=e;else for(;ws!==null;){switch(t=ws,f=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)d=e[a],d.ref.impl=d.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&f!==null){e=void 0,a=t,d=f.memoizedProps,f=f.memoizedState,c=a.stateNode;try{var $e=Le(a.type,d);e=c.getSnapshotBeforeUpdate($e,f),c.__reactInternalSnapshotBeforeUpdate=e}catch(We){Xt(a,a.return,We)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)tp(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":tp(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(r(163))}if(e=t.sibling,e!==null){e.return=t.return,ws=e;break}ws=t.return}}function ux(e,t,a){var c=a.flags;switch(a.tag){case 0:case 11:case 15:Hi(e,a),c&4&&Wu(5,a);break;case 1:if(Hi(e,a),c&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(y){Xt(a,a.return,y)}else{var d=Le(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(d,t,e.__reactInternalSnapshotBeforeUpdate)}catch(y){Xt(a,a.return,y)}}c&64&&lx(a),c&512&&Ju(a,a.return);break;case 3:if(Hi(e,a),c&64&&(e=a.updateQueue,e!==null)){if(t=null,a.child!==null)switch(a.child.tag){case 27:case 5:t=a.child.stateNode;break;case 1:t=a.child.stateNode}try{nf(e,t)}catch(y){Xt(a,a.return,y)}}break;case 27:t===null&&c&4&&cx(a);case 26:case 5:Hi(e,a),t===null&&c&4&&ix(a),c&512&&Ju(a,a.return);break;case 12:Hi(e,a);break;case 31:Hi(e,a),c&4&&hx(e,a);break;case 13:Hi(e,a),c&4&&mx(e,a),c&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=Uv.bind(null,a),lj(e,a))));break;case 22:if(c=a.memoizedState!==null||$i,!c){t=t!==null&&t.memoizedState!==null||cs,d=$i;var f=cs;$i=c,(cs=t)&&!f?qi(e,a,(a.subtreeFlags&8772)!==0):Hi(e,a),$i=d,cs=f}break;case 30:break;default:Hi(e,a)}}function dx(e){var t=e.alternate;t!==null&&(e.alternate=null,dx(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&xe(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 Tn=null,bl=!1;function Bi(e,t,a){for(a=a.child;a!==null;)fx(e,t,a),a=a.sibling}function fx(e,t,a){if(Lt&&typeof Lt.onCommitFiberUnmount=="function")try{Lt.onCommitFiberUnmount(Tt,a)}catch{}switch(a.tag){case 26:cs||Pa(a,t),Bi(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:cs||Pa(a,t);var c=Tn,d=bl;Ir(a.type)&&(Tn=a.stateNode,bl=!1),Bi(e,t,a),cd(a.stateNode),Tn=c,bl=d;break;case 5:cs||Pa(a,t);case 6:if(c=Tn,d=bl,Tn=null,Bi(e,t,a),Tn=c,bl=d,Tn!==null)if(bl)try{(Tn.nodeType===9?Tn.body:Tn.nodeName==="HTML"?Tn.ownerDocument.body:Tn).removeChild(a.stateNode)}catch(f){Xt(a,t,f)}else try{Tn.removeChild(a.stateNode)}catch(f){Xt(a,t,f)}break;case 18:Tn!==null&&(bl?(e=Tn,l_(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),Po(e)):l_(Tn,a.stateNode));break;case 4:c=Tn,d=bl,Tn=a.stateNode.containerInfo,bl=!0,Bi(e,t,a),Tn=c,bl=d;break;case 0:case 11:case 14:case 15:Ar(2,a,t),cs||Ar(4,a,t),Bi(e,t,a);break;case 1:cs||(Pa(a,t),c=a.stateNode,typeof c.componentWillUnmount=="function"&&ax(a,t,c)),Bi(e,t,a);break;case 21:Bi(e,t,a);break;case 22:cs=(c=cs)||a.memoizedState!==null,Bi(e,t,a),cs=c;break;default:Bi(e,t,a)}}function hx(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Po(e)}catch(a){Xt(t,t.return,a)}}}function mx(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Po(e)}catch(a){Xt(t,t.return,a)}}function Av(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new ox),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new ox),t;default:throw Error(r(435,e.tag))}}function Rf(e,t){var a=Av(e);t.forEach(function(c){if(!a.has(c)){a.add(c);var d=$v.bind(null,e,c);c.then(d,d)}})}function yl(e,t){var a=t.deletions;if(a!==null)for(var c=0;c<a.length;c++){var d=a[c],f=e,y=t,w=y;e:for(;w!==null;){switch(w.tag){case 27:if(Ir(w.type)){Tn=w.stateNode,bl=!1;break e}break;case 5:Tn=w.stateNode,bl=!1;break e;case 3:case 4:Tn=w.stateNode.containerInfo,bl=!0;break e}w=w.return}if(Tn===null)throw Error(r(160));fx(f,y,d),Tn=null,bl=!1,f=d.alternate,f!==null&&(f.return=null),d.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)px(t,e),t=t.sibling}var Ca=null;function px(e,t){var a=e.alternate,c=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:yl(t,e),vl(e),c&4&&(Ar(3,e,e.return),Wu(3,e),Ar(5,e,e.return));break;case 1:yl(t,e),vl(e),c&512&&(cs||a===null||Pa(a,a.return)),c&64&&$i&&(e=e.updateQueue,e!==null&&(c=e.callbacks,c!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?c:a.concat(c))));break;case 26:var d=Ca;if(yl(t,e),vl(e),c&512&&(cs||a===null||Pa(a,a.return)),c&4){var f=a!==null?a.memoizedState:null;if(c=e.memoizedState,a===null)if(c===null)if(e.stateNode===null){e:{c=e.type,a=e.memoizedProps,d=d.ownerDocument||d;t:switch(c){case"title":f=d.getElementsByTagName("title")[0],(!f||f[B]||f[wt]||f.namespaceURI==="http://www.w3.org/2000/svg"||f.hasAttribute("itemprop"))&&(f=d.createElement(c),d.head.insertBefore(f,d.querySelector("head > title"))),Ds(f,c,a),f[wt]=e,rt(f),c=f;break e;case"link":var y=p_("link","href",d).get(c+(a.href||""));if(y){for(var w=0;w<y.length;w++)if(f=y[w],f.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&f.getAttribute("rel")===(a.rel==null?null:a.rel)&&f.getAttribute("title")===(a.title==null?null:a.title)&&f.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){y.splice(w,1);break t}}f=d.createElement(c),Ds(f,c,a),d.head.appendChild(f);break;case"meta":if(y=p_("meta","content",d).get(c+(a.content||""))){for(w=0;w<y.length;w++)if(f=y[w],f.getAttribute("content")===(a.content==null?null:""+a.content)&&f.getAttribute("name")===(a.name==null?null:a.name)&&f.getAttribute("property")===(a.property==null?null:a.property)&&f.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&f.getAttribute("charset")===(a.charSet==null?null:a.charSet)){y.splice(w,1);break t}}f=d.createElement(c),Ds(f,c,a),d.head.appendChild(f);break;default:throw Error(r(468,c))}f[wt]=e,rt(f),c=f}e.stateNode=c}else g_(d,e.type,e.stateNode);else e.stateNode=m_(d,c,e.memoizedProps);else f!==c?(f===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):f.count--,c===null?g_(d,e.type,e.stateNode):m_(d,c,e.memoizedProps)):c===null&&e.stateNode!==null&&Em(e,e.memoizedProps,a.memoizedProps)}break;case 27:yl(t,e),vl(e),c&512&&(cs||a===null||Pa(a,a.return)),a!==null&&c&4&&Em(e,e.memoizedProps,a.memoizedProps);break;case 5:if(yl(t,e),vl(e),c&512&&(cs||a===null||Pa(a,a.return)),e.flags&32){d=e.stateNode;try{ns(d,"")}catch($e){Xt(e,e.return,$e)}}c&4&&e.stateNode!=null&&(d=e.memoizedProps,Em(e,d,a!==null?a.memoizedProps:d)),c&1024&&(Am=!0);break;case 6:if(yl(t,e),vl(e),c&4){if(e.stateNode===null)throw Error(r(162));c=e.memoizedProps,a=e.stateNode;try{a.nodeValue=c}catch($e){Xt(e,e.return,$e)}}break;case 3:if(Kf=null,d=Ca,Ca=Xf(t.containerInfo),yl(t,e),Ca=d,vl(e),c&4&&a!==null&&a.memoizedState.isDehydrated)try{Po(t.containerInfo)}catch($e){Xt(e,e.return,$e)}Am&&(Am=!1,gx(e));break;case 4:c=Ca,Ca=Xf(e.stateNode.containerInfo),yl(t,e),vl(e),Ca=c;break;case 12:yl(t,e),vl(e);break;case 31:yl(t,e),vl(e),c&4&&(c=e.updateQueue,c!==null&&(e.updateQueue=null,Rf(e,c)));break;case 13:yl(t,e),vl(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Lf=ut()),c&4&&(c=e.updateQueue,c!==null&&(e.updateQueue=null,Rf(e,c)));break;case 22:d=e.memoizedState!==null;var q=a!==null&&a.memoizedState!==null,re=$i,ye=cs;if($i=re||d,cs=ye||q,yl(t,e),cs=ye,$i=re,vl(e),c&8192)e:for(t=e.stateNode,t._visibility=d?t._visibility&-2:t._visibility|1,d&&(a===null||q||$i||cs||Uc(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){q=a=t;try{if(f=q.stateNode,d)y=f.style,typeof y.setProperty=="function"?y.setProperty("display","none","important"):y.display="none";else{w=q.stateNode;var we=q.memoizedProps.style,ue=we!=null&&we.hasOwnProperty("display")?we.display:null;w.style.display=ue==null||typeof ue=="boolean"?"":(""+ue).trim()}}catch($e){Xt(q,q.return,$e)}}}else if(t.tag===6){if(a===null){q=t;try{q.stateNode.nodeValue=d?"":q.memoizedProps}catch($e){Xt(q,q.return,$e)}}}else if(t.tag===18){if(a===null){q=t;try{var he=q.stateNode;d?a_(he,!0):a_(q.stateNode,!1)}catch($e){Xt(q,q.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 e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;a===t&&(a=null),t=t.return}a===t&&(a=null),t.sibling.return=t.return,t=t.sibling}c&4&&(c=e.updateQueue,c!==null&&(a=c.retryQueue,a!==null&&(c.retryQueue=null,Rf(e,a))));break;case 19:yl(t,e),vl(e),c&4&&(c=e.updateQueue,c!==null&&(e.updateQueue=null,Rf(e,c)));break;case 30:break;case 21:break;default:yl(t,e),vl(e)}}function vl(e){var t=e.flags;if(t&2){try{for(var a,c=e.return;c!==null;){if(rx(c)){a=c;break}c=c.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var d=a.stateNode,f=Cm(e);Mf(e,f,d);break;case 5:var y=a.stateNode;a.flags&32&&(ns(y,""),a.flags&=-33);var w=Cm(e);Mf(e,w,y);break;case 3:case 4:var q=a.stateNode.containerInfo,re=Cm(e);Tm(e,re,q);break;default:throw Error(r(161))}}catch(ye){Xt(e,e.return,ye)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function gx(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;gx(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Hi(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)ux(e,t.alternate,t),t=t.sibling}function Uc(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ar(4,t,t.return),Uc(t);break;case 1:Pa(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&ax(t,t.return,a),Uc(t);break;case 27:cd(t.stateNode);case 26:case 5:Pa(t,t.return),Uc(t);break;case 22:t.memoizedState===null&&Uc(t);break;case 30:Uc(t);break;default:Uc(t)}e=e.sibling}}function qi(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var c=t.alternate,d=e,f=t,y=f.flags;switch(f.tag){case 0:case 11:case 15:qi(d,f,a),Wu(4,f);break;case 1:if(qi(d,f,a),c=f,d=c.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch(re){Xt(c,c.return,re)}if(c=f,d=c.updateQueue,d!==null){var w=c.stateNode;try{var q=d.shared.hiddenCallbacks;if(q!==null)for(d.shared.hiddenCallbacks=null,d=0;d<q.length;d++)wo(q[d],w)}catch(re){Xt(c,c.return,re)}}a&&y&64&&lx(f),Ju(f,f.return);break;case 27:cx(f);case 26:case 5:qi(d,f,a),a&&c===null&&y&4&&ix(f),Ju(f,f.return);break;case 12:qi(d,f,a);break;case 31:qi(d,f,a),a&&y&4&&hx(d,f);break;case 13:qi(d,f,a),a&&y&4&&mx(d,f);break;case 22:f.memoizedState===null&&qi(d,f,a),Ju(f,f.return);break;case 30:break;default:qi(d,f,a)}t=t.sibling}}function Mm(e,t){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&Dl(a))}function Rm(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Dl(e))}function Ta(e,t,a,c){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)xx(e,t,a,c),t=t.sibling}function xx(e,t,a,c){var d=t.flags;switch(t.tag){case 0:case 11:case 15:Ta(e,t,a,c),d&2048&&Wu(9,t);break;case 1:Ta(e,t,a,c);break;case 3:Ta(e,t,a,c),d&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Dl(e)));break;case 12:if(d&2048){Ta(e,t,a,c),e=t.stateNode;try{var f=t.memoizedProps,y=f.id,w=f.onPostCommit;typeof w=="function"&&w(y,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(q){Xt(t,t.return,q)}}else Ta(e,t,a,c);break;case 31:Ta(e,t,a,c);break;case 13:Ta(e,t,a,c);break;case 23:break;case 22:f=t.stateNode,y=t.alternate,t.memoizedState!==null?f._visibility&2?Ta(e,t,a,c):ed(e,t):f._visibility&2?Ta(e,t,a,c):(f._visibility|=2,Bo(e,t,a,c,(t.subtreeFlags&10256)!==0||!1)),d&2048&&Mm(y,t);break;case 24:Ta(e,t,a,c),d&2048&&Rm(t.alternate,t);break;default:Ta(e,t,a,c)}}function Bo(e,t,a,c,d){for(d=d&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var f=e,y=t,w=a,q=c,re=y.flags;switch(y.tag){case 0:case 11:case 15:Bo(f,y,w,q,d),Wu(8,y);break;case 23:break;case 22:var ye=y.stateNode;y.memoizedState!==null?ye._visibility&2?Bo(f,y,w,q,d):ed(f,y):(ye._visibility|=2,Bo(f,y,w,q,d)),d&&re&2048&&Mm(y.alternate,y);break;case 24:Bo(f,y,w,q,d),d&&re&2048&&Rm(y.alternate,y);break;default:Bo(f,y,w,q,d)}t=t.sibling}}function ed(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,c=t,d=c.flags;switch(c.tag){case 22:ed(a,c),d&2048&&Mm(c.alternate,c);break;case 24:ed(a,c),d&2048&&Rm(c.alternate,c);break;default:ed(a,c)}t=t.sibling}}var td=8192;function Ho(e,t,a){if(e.subtreeFlags&td)for(e=e.child;e!==null;)_x(e,t,a),e=e.sibling}function _x(e,t,a){switch(e.tag){case 26:Ho(e,t,a),e.flags&td&&e.memoizedState!==null&&gj(a,Ca,e.memoizedState,e.memoizedProps);break;case 5:Ho(e,t,a);break;case 3:case 4:var c=Ca;Ca=Xf(e.stateNode.containerInfo),Ho(e,t,a),Ca=c;break;case 22:e.memoizedState===null&&(c=e.alternate,c!==null&&c.memoizedState!==null?(c=td,td=16777216,Ho(e,t,a),td=c):Ho(e,t,a));break;default:Ho(e,t,a)}}function bx(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 nd(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var c=t[a];ws=c,vx(c,e)}bx(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)yx(e),e=e.sibling}function yx(e){switch(e.tag){case 0:case 11:case 15:nd(e),e.flags&2048&&Ar(9,e,e.return);break;case 3:nd(e);break;case 12:nd(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Df(e)):nd(e);break;default:nd(e)}}function Df(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var c=t[a];ws=c,vx(c,e)}bx(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ar(8,t,t.return),Df(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,Df(t));break;default:Df(t)}e=e.sibling}}function vx(e,t){for(;ws!==null;){var a=ws;switch(a.tag){case 0:case 11:case 15:Ar(8,a,t);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var c=a.memoizedState.cachePool.pool;c!=null&&c.refCount++}break;case 24:Dl(a.memoizedState.cache)}if(c=a.child,c!==null)c.return=a,ws=c;else e:for(a=e;ws!==null;){c=ws;var d=c.sibling,f=c.return;if(dx(c),c===a){ws=null;break e}if(d!==null){d.return=f,ws=d;break e}ws=f}}}var Mv={getCacheForType:function(e){var t=is(Vn),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return is(Vn).controller.signal}},Rv=typeof WeakMap=="function"?WeakMap:Map,Ut=0,rn=null,bt=null,jt=0,Vt=0,zl=null,Mr=!1,qo=!1,Dm=!1,Gi=0,Fn=0,Rr=0,$c=0,Lm=0,Il=0,Go=0,sd=null,jl=null,Om=!1,Lf=0,jx=0,Of=1/0,zf=null,Dr=null,vs=0,Lr=null,Yo=null,Yi=0,zm=0,Im=null,Nx=null,ld=0,Um=null;function Ul(){return(Ut&2)!==0&&jt!==0?jt&-jt:M.T!==null?Ym():Zn()}function kx(){if(Il===0)if((jt&536870912)===0||xt){var e=et;et<<=1,(et&3932160)===0&&(et=262144),Il=e}else Il=536870912;return e=xs.current,e!==null&&(e.flags|=32),Il}function Nl(e,t,a){(e===rn&&(Vt===2||Vt===9)||e.cancelPendingCommit!==null)&&(Vo(e,0),Or(e,jt,Il,!1)),_t(e,a),((Ut&2)===0||e!==rn)&&(e===rn&&((Ut&2)===0&&($c|=a),Fn===4&&Or(e,jt,Il,!1)),Wa(e))}function wx(e,t,a){if((Ut&6)!==0)throw Error(r(327));var c=!a&&(t&127)===0&&(t&e.expiredLanes)===0||Kn(e,t),d=c?Ov(e,t):Bm(e,t,!0),f=c;do{if(d===0){qo&&!c&&Or(e,t,0,!1);break}else{if(a=e.current.alternate,f&&!Dv(a)){d=Bm(e,t,!1),f=!1;continue}if(d===2){if(f=t,e.errorRecoveryDisabledLanes&f)var y=0;else y=e.pendingLanes&-536870913,y=y!==0?y:y&536870912?536870912:0;if(y!==0){t=y;e:{var w=e;d=sd;var q=w.current.memoizedState.isDehydrated;if(q&&(Vo(w,y).flags|=256),y=Bm(w,y,!1),y!==2){if(Dm&&!q){w.errorRecoveryDisabledLanes|=f,$c|=f,d=4;break e}f=jl,jl=d,f!==null&&(jl===null?jl=f:jl.push.apply(jl,f))}d=y}if(f=!1,d!==2)continue}}if(d===1){Vo(e,0),Or(e,t,0,!0);break}e:{switch(c=e,f=d,f){case 0:case 1:throw Error(r(345));case 4:if((t&4194048)!==t)break;case 6:Or(c,t,Il,!Mr);break e;case 2:jl=null;break;case 3:case 5:break;default:throw Error(r(329))}if((t&62914560)===t&&(d=Lf+300-ut(),10<d)){if(Or(c,t,Il,!Mr),Zt(c,0,!0)!==0)break e;Yi=t,c.timeoutHandle=n_(Sx.bind(null,c,a,jl,zf,Om,t,Il,$c,Go,Mr,f,"Throttled",-0,0),d);break e}Sx(c,a,jl,zf,Om,t,Il,$c,Go,Mr,f,null,-0,0)}}break}while(!0);Wa(e)}function Sx(e,t,a,c,d,f,y,w,q,re,ye,we,ue,he){if(e.timeoutHandle=-1,we=t.subtreeFlags,we&8192||(we&16785408)===16785408){we={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Yn},_x(t,f,we);var $e=(f&62914560)===f?Lf-ut():(f&4194048)===f?jx-ut():0;if($e=xj(we,$e),$e!==null){Yi=f,e.cancelPendingCommit=$e(Lx.bind(null,e,t,f,a,c,d,y,w,q,ye,we,null,ue,he)),Or(e,f,y,!re);return}}Lx(e,t,f,a,c,d,y,w,q)}function Dv(e){for(var t=e;;){var a=t.tag;if((a===0||a===11||a===15)&&t.flags&16384&&(a=t.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var c=0;c<a.length;c++){var d=a[c],f=d.getSnapshot;d=d.value;try{if(!Ts(f(),d))return!1}catch{return!1}}if(a=t.child,t.subtreeFlags&16384&&a!==null)a.return=t,t=a;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 Or(e,t,a,c){t&=~Lm,t&=~$c,e.suspendedLanes|=t,e.pingedLanes&=~t,c&&(e.warmLanes|=t),c=e.expirationTimes;for(var d=t;0<d;){var f=31-Qt(d),y=1<<f;c[f]=-1,d&=~y}a!==0&&Qn(e,a,t)}function If(){return(Ut&6)===0?(ad(0),!1):!0}function $m(){if(bt!==null){if(Vt===0)var e=bt.return;else e=bt,gs=ba=null,Mo(e),br=null,Nc=0,e=bt;for(;e!==null;)sx(e.alternate,e),e=e.return;bt=null}}function Vo(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,Jv(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Yi=0,$m(),rn=e,bt=a=xa(e.current,null),jt=t,Vt=0,zl=null,Mr=!1,qo=Kn(e,t),Dm=!1,Go=Il=Lm=$c=Rr=Fn=0,jl=sd=null,Om=!1,(t&8)!==0&&(t|=t&32);var c=e.entangledLanes;if(c!==0)for(e=e.entanglements,c&=t;0<c;){var d=31-Qt(c),f=1<<d;t|=e[d],c&=~f}return Gi=t,_c(),a}function Ex(e,t){ct=null,M.H=Oi,t===_r||t===yo?(t=Mu(),Vt=3):t===jc?(t=Mu(),Vt=4):Vt=t===ys?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,zl=t,bt===null&&(Fn=1,Ol(e,el(t,e.current)))}function Cx(){var e=xs.current;return e===null?!0:(jt&4194048)===jt?ll===null:(jt&62914560)===jt||(jt&536870912)!==0?e===ll:!1}function Tx(){var e=M.H;return M.H=Oi,e===null?Oi:e}function Ax(){var e=M.A;return M.A=Mv,e}function Uf(){Fn=4,Mr||(jt&4194048)!==jt&&xs.current!==null||(qo=!0),(Rr&134217727)===0&&($c&134217727)===0||rn===null||Or(rn,jt,Il,!1)}function Bm(e,t,a){var c=Ut;Ut|=2;var d=Tx(),f=Ax();(rn!==e||jt!==t)&&(zf=null,Vo(e,t)),t=!1;var y=Fn;e:do try{if(Vt!==0&&bt!==null){var w=bt,q=zl;switch(Vt){case 8:$m(),y=6;break e;case 3:case 2:case 9:case 6:xs.current===null&&(t=!0);var re=Vt;if(Vt=0,zl=null,Xo(e,w,q,re),a&&qo){y=0;break e}break;default:re=Vt,Vt=0,zl=null,Xo(e,w,q,re)}}Lv(),y=Fn;break}catch(ye){Ex(e,ye)}while(!0);return t&&e.shellSuspendCounter++,gs=ba=null,Ut=c,M.H=d,M.A=f,bt===null&&(rn=null,jt=0,_c()),y}function Lv(){for(;bt!==null;)Mx(bt)}function Ov(e,t){var a=Ut;Ut|=2;var c=Tx(),d=Ax();rn!==e||jt!==t?(zf=null,Of=ut()+500,Vo(e,t)):qo=Kn(e,t);e:do try{if(Vt!==0&&bt!==null){t=bt;var f=zl;t:switch(Vt){case 1:Vt=0,zl=null,Xo(e,t,f,1);break;case 2:case 9:if(Va(f)){Vt=0,zl=null,Rx(t);break}t=function(){Vt!==2&&Vt!==9||rn!==e||(Vt=7),Wa(e)},f.then(t,t);break e;case 3:Vt=7;break e;case 4:Vt=5;break e;case 7:Va(f)?(Vt=0,zl=null,Rx(t)):(Vt=0,zl=null,Xo(e,t,f,7));break;case 5:var y=null;switch(bt.tag){case 26:y=bt.memoizedState;case 5:case 27:var w=bt;if(y?x_(y):w.stateNode.complete){Vt=0,zl=null;var q=w.sibling;if(q!==null)bt=q;else{var re=w.return;re!==null?(bt=re,$f(re)):bt=null}break t}}Vt=0,zl=null,Xo(e,t,f,5);break;case 6:Vt=0,zl=null,Xo(e,t,f,6);break;case 8:$m(),Fn=6;break e;default:throw Error(r(462))}}zv();break}catch(ye){Ex(e,ye)}while(!0);return gs=ba=null,M.H=c,M.A=d,Ut=a,bt!==null?0:(rn=null,jt=0,_c(),Fn)}function zv(){for(;bt!==null&&!In();)Mx(bt)}function Mx(e){var t=tx(e.alternate,e,Gi);e.memoizedProps=e.pendingProps,t===null?$f(e):bt=t}function Rx(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=Qg(a,t,t.pendingProps,t.type,void 0,jt);break;case 11:t=Qg(a,t,t.pendingProps,t.type.render,t.ref,jt);break;case 5:Mo(t);default:sx(a,t),t=bt=go(t,Gi),t=tx(a,t,Gi)}e.memoizedProps=e.pendingProps,t===null?$f(e):bt=t}function Xo(e,t,a,c){gs=ba=null,Mo(t),br=null,Nc=0;var d=t.return;try{if(zi(e,d,t,a,jt)){Fn=1,Ol(e,el(a,e.current)),bt=null;return}}catch(f){if(d!==null)throw bt=d,f;Fn=1,Ol(e,el(a,e.current)),bt=null;return}t.flags&32768?(xt||c===1?e=!0:qo||(jt&536870912)!==0?e=!1:(Mr=e=!0,(c===2||c===9||c===3||c===6)&&(c=xs.current,c!==null&&c.tag===13&&(c.flags|=16384))),Dx(t,e)):$f(t)}function $f(e){var t=e;do{if((t.flags&32768)!==0){Dx(t,Mr);return}e=t.return;var a=Ev(t.alternate,t,Gi);if(a!==null){bt=a;return}if(t=t.sibling,t!==null){bt=t;return}bt=t=e}while(t!==null);Fn===0&&(Fn=5)}function Dx(e,t){do{var a=Cv(e.alternate,e);if(a!==null){a.flags&=32767,bt=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){bt=e;return}bt=e=a}while(e!==null);Fn=6,bt=null}function Lx(e,t,a,c,d,f,y,w,q){e.cancelPendingCommit=null;do Bf();while(vs!==0);if((Ut&6)!==0)throw Error(r(327));if(t!==null){if(t===e.current)throw Error(r(177));if(f=t.lanes|t.childLanes,f|=ur,Is(e,a,f,y,w,q),e===rn&&(bt=rn=null,jt=0),Yo=t,Lr=e,Yi=a,zm=f,Im=d,Nx=c,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Bv(it,function(){return $x(),null})):(e.callbackNode=null,e.callbackPriority=0),c=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||c){c=M.T,M.T=null,d=O.p,O.p=2,y=Ut,Ut|=4;try{Tv(e,t,a)}finally{Ut=y,O.p=d,M.T=c}}vs=1,Ox(),zx(),Ix()}}function Ox(){if(vs===1){vs=0;var e=Lr,t=Yo,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=M.T,M.T=null;var c=O.p;O.p=2;var d=Ut;Ut|=4;try{px(t,e);var f=Wm,y=$a(e.containerInfo),w=f.focusedElem,q=f.selectionRange;if(y!==w&&w&&w.ownerDocument&&Nu(w.ownerDocument.documentElement,w)){if(q!==null&&mi(w)){var re=q.start,ye=q.end;if(ye===void 0&&(ye=re),"selectionStart"in w)w.selectionStart=re,w.selectionEnd=Math.min(ye,w.value.length);else{var we=w.ownerDocument||document,ue=we&&we.defaultView||window;if(ue.getSelection){var he=ue.getSelection(),$e=w.textContent.length,We=Math.min(q.start,$e),tn=q.end===void 0?We:Math.min(q.end,$e);!he.extend&&We>tn&&(y=tn,tn=We,We=y);var se=dc(w,We),Z=dc(w,tn);if(se&&Z&&(he.rangeCount!==1||he.anchorNode!==se.node||he.anchorOffset!==se.offset||he.focusNode!==Z.node||he.focusOffset!==Z.offset)){var ie=we.createRange();ie.setStart(se.node,se.offset),he.removeAllRanges(),We>tn?(he.addRange(ie),he.extend(Z.node,Z.offset)):(ie.setEnd(Z.node,Z.offset),he.addRange(ie))}}}}for(we=[],he=w;he=he.parentNode;)he.nodeType===1&&we.push({element:he,left:he.scrollLeft,top:he.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<we.length;w++){var je=we[w];je.element.scrollLeft=je.left,je.element.scrollTop=je.top}}Wf=!!Pm,Wm=Pm=null}finally{Ut=d,O.p=c,M.T=a}}e.current=t,vs=2}}function zx(){if(vs===2){vs=0;var e=Lr,t=Yo,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=M.T,M.T=null;var c=O.p;O.p=2;var d=Ut;Ut|=4;try{ux(e,t.alternate,t)}finally{Ut=d,O.p=c,M.T=a}}vs=3}}function Ix(){if(vs===4||vs===3){vs=0,kt();var e=Lr,t=Yo,a=Yi,c=Nx;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?vs=5:(vs=0,Yo=Lr=null,Ux(e,e.pendingLanes));var d=e.pendingLanes;if(d===0&&(Dr=null),ms(a),t=t.stateNode,Lt&&typeof Lt.onCommitFiberRoot=="function")try{Lt.onCommitFiberRoot(Tt,t,void 0,(t.current.flags&128)===128)}catch{}if(c!==null){t=M.T,d=O.p,O.p=2,M.T=null;try{for(var f=e.onRecoverableError,y=0;y<c.length;y++){var w=c[y];f(w.value,{componentStack:w.stack})}}finally{M.T=t,O.p=d}}(Yi&3)!==0&&Bf(),Wa(e),d=e.pendingLanes,(a&261930)!==0&&(d&42)!==0?e===Um?ld++:(ld=0,Um=e):ld=0,ad(0)}}function Ux(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Dl(t)))}function Bf(){return Ox(),zx(),Ix(),$x()}function $x(){if(vs!==5)return!1;var e=Lr,t=zm;zm=0;var a=ms(Yi),c=M.T,d=O.p;try{O.p=32>a?32:a,M.T=null,a=Im,Im=null;var f=Lr,y=Yi;if(vs=0,Yo=Lr=null,Yi=0,(Ut&6)!==0)throw Error(r(331));var w=Ut;if(Ut|=4,yx(f.current),xx(f,f.current,y,a),Ut=w,ad(0,!1),Lt&&typeof Lt.onPostCommitFiberRoot=="function")try{Lt.onPostCommitFiberRoot(Tt,f)}catch{}return!0}finally{O.p=d,M.T=c,Ux(e,t)}}function Bx(e,t,a){t=el(a,t),t=_l(e.stateNode,t,2),e=ja(e,t,2),e!==null&&(_t(e,2),Wa(e))}function Xt(e,t,a){if(e.tag===3)Bx(e,e,a);else for(;t!==null;){if(t.tag===3){Bx(t,e,a);break}else if(t.tag===1){var c=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(Dr===null||!Dr.has(c))){e=el(a,e),a=Sa(2),c=ja(t,a,2),c!==null&&(Ea(a,c,t,e),_t(c,2),Wa(c));break}}t=t.return}}function Hm(e,t,a){var c=e.pingCache;if(c===null){c=e.pingCache=new Rv;var d=new Set;c.set(t,d)}else d=c.get(t),d===void 0&&(d=new Set,c.set(t,d));d.has(a)||(Dm=!0,d.add(a),e=Iv.bind(null,e,t,a),t.then(e,e))}function Iv(e,t,a){var c=e.pingCache;c!==null&&c.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,rn===e&&(jt&a)===a&&(Fn===4||Fn===3&&(jt&62914560)===jt&&300>ut()-Lf?(Ut&2)===0&&Vo(e,0):Lm|=a,Go===jt&&(Go=0)),Wa(e)}function Hx(e,t){t===0&&(t=Bn()),e=Zl(e,t),e!==null&&(_t(e,t),Wa(e))}function Uv(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),Hx(e,a)}function $v(e,t){var a=0;switch(e.tag){case 31:case 13:var c=e.stateNode,d=e.memoizedState;d!==null&&(a=d.retryLane);break;case 19:c=e.stateNode;break;case 22:c=e.stateNode._retryCache;break;default:throw Error(r(314))}c!==null&&c.delete(t),Hx(e,a)}function Bv(e,t){return Me(e,t)}var Hf=null,Fo=null,qm=!1,qf=!1,Gm=!1,zr=0;function Wa(e){e!==Fo&&e.next===null&&(Fo===null?Hf=Fo=e:Fo=Fo.next=e),qf=!0,qm||(qm=!0,qv())}function ad(e,t){if(!Gm&&qf){Gm=!0;do for(var a=!1,c=Hf;c!==null;){if(e!==0){var d=c.pendingLanes;if(d===0)var f=0;else{var y=c.suspendedLanes,w=c.pingedLanes;f=(1<<31-Qt(42|e)+1)-1,f&=d&~(y&~w),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(a=!0,Vx(c,f))}else f=jt,f=Zt(c,c===rn?f:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(f&3)===0||Kn(c,f)||(a=!0,Vx(c,f));c=c.next}while(a);Gm=!1}}function Hv(){qx()}function qx(){qf=qm=!1;var e=0;zr!==0&&Wv()&&(e=zr);for(var t=ut(),a=null,c=Hf;c!==null;){var d=c.next,f=Gx(c,t);f===0?(c.next=null,a===null?Hf=d:a.next=d,d===null&&(Fo=a)):(a=c,(e!==0||(f&3)!==0)&&(qf=!0)),c=d}vs!==0&&vs!==5||ad(e),zr!==0&&(zr=0)}function Gx(e,t){for(var a=e.suspendedLanes,c=e.pingedLanes,d=e.expirationTimes,f=e.pendingLanes&-62914561;0<f;){var y=31-Qt(f),w=1<<y,q=d[y];q===-1?((w&a)===0||(w&c)!==0)&&(d[y]=Sl(w,t)):q<=t&&(e.expiredLanes|=w),f&=~w}if(t=rn,a=jt,a=Zt(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),c=e.callbackNode,a===0||e===t&&(Vt===2||Vt===9)||e.cancelPendingCommit!==null)return c!==null&&c!==null&&nt(c),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Kn(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(c!==null&&nt(c),ms(a)){case 2:case 8:a=Gt;break;case 32:a=it;break;case 268435456:a=Kt;break;default:a=it}return c=Yx.bind(null,e),a=Me(a,c),e.callbackPriority=t,e.callbackNode=a,t}return c!==null&&c!==null&&nt(c),e.callbackPriority=2,e.callbackNode=null,2}function Yx(e,t){if(vs!==0&&vs!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Bf()&&e.callbackNode!==a)return null;var c=jt;return c=Zt(e,e===rn?c:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),c===0?null:(wx(e,c,t),Gx(e,ut()),e.callbackNode!=null&&e.callbackNode===a?Yx.bind(null,e):null)}function Vx(e,t){if(Bf())return null;wx(e,t,!0)}function qv(){ej(function(){(Ut&6)!==0?Me($n,Hv):qx()})}function Ym(){if(zr===0){var e=Ei;e===0&&(e=Pe,Pe<<=1,(Pe&261888)===0&&(Pe=256)),zr=e}return zr}function Xx(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Ws(""+e)}function Fx(e,t){var a=t.ownerDocument.createElement("input");return a.name=t.name,a.value=t.value,e.id&&a.setAttribute("form",e.id),t.parentNode.insertBefore(a,t),e=new FormData(e),a.parentNode.removeChild(a),e}function Gv(e,t,a,c,d){if(t==="submit"&&a&&a.stateNode===d){var f=Xx((d[At]||null).action),y=c.submitter;y&&(t=(t=y[At]||null)?Xx(t.formAction):y.getAttribute("formAction"),t!==null&&(f=t,y=null));var w=new un("action","action",null,c,d);e.push({event:w,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(zr!==0){var q=y?Fx(d,y):new FormData(d);Fu(a,{pending:!0,data:q,method:d.method,action:f},null,q)}}else typeof f=="function"&&(w.preventDefault(),q=y?Fx(d,y):new FormData(d),Fu(a,{pending:!0,data:q,method:d.method,action:f},f,q))},currentTarget:d}]})}}for(var Vm=0;Vm<xc.length;Vm++){var Xm=xc[Vm],Yv=Xm.toLowerCase(),Vv=Xm[0].toUpperCase()+Xm.slice(1);Tl(Yv,"on"+Vv)}Tl(hc,"onAnimationEnd"),Tl(Kd,"onAnimationIteration"),Tl(mc,"onAnimationStart"),Tl("dblclick","onDoubleClick"),Tl("focusin","onFocus"),Tl("focusout","onBlur"),Tl(po,"onTransitionRun"),Tl(ku,"onTransitionStart"),Tl(pc,"onTransitionCancel"),Tl(qa,"onTransitionEnd"),Ns("onMouseEnter",["mouseout","mouseover"]),Ns("onMouseLeave",["mouseout","mouseover"]),Ns("onPointerEnter",["pointerout","pointerover"]),Ns("onPointerLeave",["pointerout","pointerover"]),ts("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ts("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ts("onBeforeInput",["compositionend","keypress","textInput","paste"]),ts("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ts("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ts("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var id="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(" "),Xv=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(id));function Kx(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var c=e[a],d=c.event;c=c.listeners;e:{var f=void 0;if(t)for(var y=c.length-1;0<=y;y--){var w=c[y],q=w.instance,re=w.currentTarget;if(w=w.listener,q!==f&&d.isPropagationStopped())break e;f=w,d.currentTarget=re;try{f(d)}catch(ye){Ql(ye)}d.currentTarget=null,f=q}else for(y=0;y<c.length;y++){if(w=c[y],q=w.instance,re=w.currentTarget,w=w.listener,q!==f&&d.isPropagationStopped())break e;f=w,d.currentTarget=re;try{f(d)}catch(ye){Ql(ye)}d.currentTarget=null,f=q}}}}function yt(e,t){var a=t[ps];a===void 0&&(a=t[ps]=new Set);var c=e+"__bubble";a.has(c)||(Qx(t,e,2,!1),a.add(c))}function Fm(e,t,a){var c=0;t&&(c|=4),Qx(a,e,c,t)}var Gf="_reactListening"+Math.random().toString(36).slice(2);function Km(e){if(!e[Gf]){e[Gf]=!0,cl.forEach(function(a){a!=="selectionchange"&&(Xv.has(a)||Fm(a,!1,e),Fm(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Gf]||(t[Gf]=!0,Fm("selectionchange",!1,t))}}function Qx(e,t,a,c){switch(k_(t)){case 2:var d=yj;break;case 8:d=vj;break;default:d=op}a=d.bind(null,t,a,e),d=void 0,!Js||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(d=!0),c?d!==void 0?e.addEventListener(t,a,{capture:!0,passive:d}):e.addEventListener(t,a,!0):d!==void 0?e.addEventListener(t,a,{passive:d}):e.addEventListener(t,a,!1)}function Qm(e,t,a,c,d){var f=c;if((t&1)===0&&(t&2)===0&&c!==null)e:for(;;){if(c===null)return;var y=c.tag;if(y===3||y===4){var w=c.stateNode.containerInfo;if(w===d)break;if(y===4)for(y=c.return;y!==null;){var q=y.tag;if((q===3||q===4)&&y.stateNode.containerInfo===d)return;y=y.return}for(;w!==null;){if(y=Re(w),y===null)return;if(q=y.tag,q===5||q===6||q===26||q===27){c=f=y;continue e}w=w.parentNode}}c=c.return}fi(function(){var re=f,ye=Fl(a),we=[];e:{var ue=gc.get(e);if(ue!==void 0){var he=un,$e=e;switch(e){case"keypress":if(ze(a)===0)break e;case"keydown":case"keyup":he=lm;break;case"focusin":$e="focus",he=sn;break;case"focusout":$e="blur",he=sn;break;case"beforeblur":case"afterblur":he=sn;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":he=Ie;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":he=xn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":he=io;break;case hc:case Kd:case mc:he=nr;break;case qa:he=yu;break;case"scroll":case"scrollend":he=Wt;break;case"wheel":he=am;break;case"copy":case"cut":case"paste":he=nm;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":he=ao;break;case"toggle":case"beforetoggle":he=rm}var We=(t&4)!==0,tn=!We&&(e==="scroll"||e==="scrollend"),se=We?ue!==null?ue+"Capture":null:ue;We=[];for(var Z=re,ie;Z!==null;){var je=Z;if(ie=je.stateNode,je=je.tag,je!==5&&je!==26&&je!==27||ie===null||se===null||(je=hl(Z,se),je!=null&&We.push(rd(Z,je,ie))),tn)break;Z=Z.return}0<We.length&&(ue=new he(ue,$e,null,a,ye),we.push({event:ue,listeners:We}))}}if((t&7)===0){e:{if(ue=e==="mouseover"||e==="pointerover",he=e==="mouseout"||e==="pointerout",ue&&a!==Xl&&($e=a.relatedTarget||a.fromElement)&&(Re($e)||$e[cn]))break e;if((he||ue)&&(ue=ye.window===ye?ye:(ue=ye.ownerDocument)?ue.defaultView||ue.parentWindow:window,he?($e=a.relatedTarget||a.toElement,he=re,$e=$e?Re($e):null,$e!==null&&(tn=u($e),We=$e.tag,$e!==tn||We!==5&&We!==27&&We!==6)&&($e=null)):(he=null,$e=re),he!==$e)){if(We=Ie,je="onMouseLeave",se="onMouseEnter",Z="mouse",(e==="pointerout"||e==="pointerover")&&(We=ao,je="onPointerLeave",se="onPointerEnter",Z="pointer"),tn=he==null?ue:ht(he),ie=$e==null?ue:ht($e),ue=new We(je,Z+"leave",he,a,ye),ue.target=tn,ue.relatedTarget=ie,je=null,Re(ye)===re&&(We=new We(se,Z+"enter",$e,a,ye),We.target=ie,We.relatedTarget=tn,je=We),tn=je,he&&$e)t:{for(We=Fv,se=he,Z=$e,ie=0,je=se;je;je=We(je))ie++;je=0;for(var Fe=Z;Fe;Fe=We(Fe))je++;for(;0<ie-je;)se=We(se),ie--;for(;0<je-ie;)Z=We(Z),je--;for(;ie--;){if(se===Z||Z!==null&&se===Z.alternate){We=se;break t}se=We(se),Z=We(Z)}We=null}else We=null;he!==null&&Zx(we,ue,he,We,!1),$e!==null&&tn!==null&&Zx(we,tn,$e,We,!0)}}e:{if(ue=re?ht(re):window,he=ue.nodeName&&ue.nodeName.toLowerCase(),he==="select"||he==="input"&&ue.type==="file")var Rt=hi;else if(Ia(ue))if(cc)Rt=ho;else{Rt=fo;var He=oc}else he=ue.nodeName,!he||he.toLowerCase()!=="input"||ue.type!=="checkbox"&&ue.type!=="radio"?re&&Bs(re.elementType)&&(Rt=hi):Rt=uc;if(Rt&&(Rt=Rt(e,re))){qs(we,Rt,a,ye);break e}He&&He(e,ue,re),e==="focusout"&&re&&ue.type==="number"&&re.memoizedProps.value!=null&&Nn(ue,"number",ue.value)}switch(He=re?ht(re):window,e){case"focusin":(Ia(He)||He.contentEditable==="true")&&(Ba=He,rr=re,pi=null);break;case"focusout":pi=rr=Ba=null;break;case"mousedown":mo=!0;break;case"contextmenu":case"mouseup":case"dragend":mo=!1,fc(we,a,ye);break;case"selectionchange":if(dm)break;case"keydown":case"keyup":fc(we,a,ye)}var ft;if(vu)e:{switch(e){case"compositionstart":var Nt="onCompositionStart";break e;case"compositionend":Nt="onCompositionEnd";break e;case"compositionupdate":Nt="onCompositionUpdate";break e}Nt=void 0}else pl?Hs(e,a)&&(Nt="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Nt="onCompositionStart");Nt&&(co&&a.locale!=="ko"&&(pl||Nt!=="onCompositionStart"?Nt==="onCompositionEnd"&&pl&&(ft=ve()):(S=ye,K="value"in S?S.value:S.textContent,pl=!0)),He=Yf(re,Nt),0<He.length&&(Nt=new nc(Nt,e,null,a,ye),we.push({event:Nt,listeners:He}),ft?Nt.data=ft:(ft=sr(a),ft!==null&&(Nt.data=ft)))),(ft=om?ic(e,a):oo(e,a))&&(Nt=Yf(re,"onBeforeInput"),0<Nt.length&&(He=new nc("onBeforeInput","beforeinput",null,a,ye),we.push({event:He,listeners:Nt}),He.data=ft)),Gv(we,e,re,a,ye)}Kx(we,t)})}function rd(e,t,a){return{instance:e,listener:t,currentTarget:a}}function Yf(e,t){for(var a=t+"Capture",c=[];e!==null;){var d=e,f=d.stateNode;if(d=d.tag,d!==5&&d!==26&&d!==27||f===null||(d=hl(e,a),d!=null&&c.unshift(rd(e,d,f)),d=hl(e,t),d!=null&&c.push(rd(e,d,f))),e.tag===3)return c;e=e.return}return[]}function Fv(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Zx(e,t,a,c,d){for(var f=t._reactName,y=[];a!==null&&a!==c;){var w=a,q=w.alternate,re=w.stateNode;if(w=w.tag,q!==null&&q===c)break;w!==5&&w!==26&&w!==27||re===null||(q=re,d?(re=hl(a,f),re!=null&&y.unshift(rd(a,re,q))):d||(re=hl(a,f),re!=null&&y.push(rd(a,re,q)))),a=a.return}y.length!==0&&e.push({event:t,listeners:y})}var Kv=/\r\n?/g,Qv=/\u0000|\uFFFD/g;function Px(e){return(typeof e=="string"?e:""+e).replace(Kv,`
50
+ `).replace(Qv,"")}function Wx(e,t){return t=Px(t),Px(e)===t}function en(e,t,a,c,d,f){switch(a){case"children":typeof c=="string"?t==="body"||t==="textarea"&&c===""||ns(e,c):(typeof c=="number"||typeof c=="bigint")&&t!=="body"&&ns(e,""+c);break;case"className":El(e,"class",c);break;case"tabIndex":El(e,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":El(e,a,c);break;case"style":Yt(e,c,f);break;case"data":if(t!=="object"){El(e,"data",c);break}case"src":case"href":if(c===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(c==null||typeof c=="function"||typeof c=="symbol"||typeof c=="boolean"){e.removeAttribute(a);break}c=Ws(""+c),e.setAttribute(a,c);break;case"action":case"formAction":if(typeof c=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof f=="function"&&(a==="formAction"?(t!=="input"&&en(e,t,"name",d.name,d,null),en(e,t,"formEncType",d.formEncType,d,null),en(e,t,"formMethod",d.formMethod,d,null),en(e,t,"formTarget",d.formTarget,d,null)):(en(e,t,"encType",d.encType,d,null),en(e,t,"method",d.method,d,null),en(e,t,"target",d.target,d,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){e.removeAttribute(a);break}c=Ws(""+c),e.setAttribute(a,c);break;case"onClick":c!=null&&(e.onclick=Yn);break;case"onScroll":c!=null&&yt("scroll",e);break;case"onScrollEnd":c!=null&&yt("scrollend",e);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(r(61));if(a=c.__html,a!=null){if(d.children!=null)throw Error(r(60));e.innerHTML=a}}break;case"multiple":e.multiple=c&&typeof c!="function"&&typeof c!="symbol";break;case"muted":e.muted=c&&typeof c!="function"&&typeof c!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(c==null||typeof c=="function"||typeof c=="boolean"||typeof c=="symbol"){e.removeAttribute("xlink:href");break}a=Ws(""+c),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":c!=null&&typeof c!="function"&&typeof c!="symbol"?e.setAttribute(a,""+c):e.removeAttribute(a);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":c&&typeof c!="function"&&typeof c!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":c===!0?e.setAttribute(a,""):c!==!1&&c!=null&&typeof c!="function"&&typeof c!="symbol"?e.setAttribute(a,c):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":c!=null&&typeof c!="function"&&typeof c!="symbol"&&!isNaN(c)&&1<=c?e.setAttribute(a,c):e.removeAttribute(a);break;case"rowSpan":case"start":c==null||typeof c=="function"||typeof c=="symbol"||isNaN(c)?e.removeAttribute(a):e.setAttribute(a,c);break;case"popover":yt("beforetoggle",e),yt("toggle",e),fa(e,"popover",c);break;case"xlinkActuate":mn(e,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":mn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":mn(e,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":mn(e,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":mn(e,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":mn(e,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":mn(e,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":mn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":mn(e,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":fa(e,"is",c);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=Vl.get(a)||a,fa(e,a,c))}}function Zm(e,t,a,c,d,f){switch(a){case"style":Yt(e,c,f);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(r(61));if(a=c.__html,a!=null){if(d.children!=null)throw Error(r(60));e.innerHTML=a}}break;case"children":typeof c=="string"?ns(e,c):(typeof c=="number"||typeof c=="bigint")&&ns(e,""+c);break;case"onScroll":c!=null&&yt("scroll",e);break;case"onScrollEnd":c!=null&&yt("scrollend",e);break;case"onClick":c!=null&&(e.onclick=Yn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Zs.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(d=a.endsWith("Capture"),t=a.slice(2,d?a.length-7:void 0),f=e[At]||null,f=f!=null?f[a]:null,typeof f=="function"&&e.removeEventListener(t,f,d),typeof c=="function")){typeof f!="function"&&f!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,c,d);break e}a in e?e[a]=c:c===!0?e.setAttribute(a,""):fa(e,a,c)}}}function Ds(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":yt("error",e),yt("load",e);var c=!1,d=!1,f;for(f in a)if(a.hasOwnProperty(f)){var y=a[f];if(y!=null)switch(f){case"src":c=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:en(e,t,f,y,a,null)}}d&&en(e,t,"srcSet",a.srcSet,a,null),c&&en(e,t,"src",a.src,a,null);return;case"input":yt("invalid",e);var w=f=y=d=null,q=null,re=null;for(c in a)if(a.hasOwnProperty(c)){var ye=a[c];if(ye!=null)switch(c){case"name":d=ye;break;case"type":y=ye;break;case"checked":q=ye;break;case"defaultChecked":re=ye;break;case"value":f=ye;break;case"defaultValue":w=ye;break;case"children":case"dangerouslySetInnerHTML":if(ye!=null)throw Error(r(137,t));break;default:en(e,t,c,ye,a,null)}}Yl(e,f,w,q,re,y,d,!1);return;case"select":yt("invalid",e),c=y=f=null;for(d in a)if(a.hasOwnProperty(d)&&(w=a[d],w!=null))switch(d){case"value":f=w;break;case"defaultValue":y=w;break;case"multiple":c=w;default:en(e,t,d,w,a,null)}t=f,a=y,e.multiple=!!c,t!=null?qn(e,!!c,t,!1):a!=null&&qn(e,!!c,a,!0);return;case"textarea":yt("invalid",e),f=d=c=null;for(y in a)if(a.hasOwnProperty(y)&&(w=a[y],w!=null))switch(y){case"value":c=w;break;case"defaultValue":d=w;break;case"children":f=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(r(91));break;default:en(e,t,y,w,a,null)}ha(e,c,d,f);return;case"option":for(q in a)if(a.hasOwnProperty(q)&&(c=a[q],c!=null))switch(q){case"selected":e.selected=c&&typeof c!="function"&&typeof c!="symbol";break;default:en(e,t,q,c,a,null)}return;case"dialog":yt("beforetoggle",e),yt("toggle",e),yt("cancel",e),yt("close",e);break;case"iframe":case"object":yt("load",e);break;case"video":case"audio":for(c=0;c<id.length;c++)yt(id[c],e);break;case"image":yt("error",e),yt("load",e);break;case"details":yt("toggle",e);break;case"embed":case"source":case"link":yt("error",e),yt("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(re in a)if(a.hasOwnProperty(re)&&(c=a[re],c!=null))switch(re){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:en(e,t,re,c,a,null)}return;default:if(Bs(t)){for(ye in a)a.hasOwnProperty(ye)&&(c=a[ye],c!==void 0&&Zm(e,t,ye,c,a,void 0));return}}for(w in a)a.hasOwnProperty(w)&&(c=a[w],c!=null&&en(e,t,w,c,a,null))}function Zv(e,t,a,c){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var d=null,f=null,y=null,w=null,q=null,re=null,ye=null;for(he in a){var we=a[he];if(a.hasOwnProperty(he)&&we!=null)switch(he){case"checked":break;case"value":break;case"defaultValue":q=we;default:c.hasOwnProperty(he)||en(e,t,he,null,c,we)}}for(var ue in c){var he=c[ue];if(we=a[ue],c.hasOwnProperty(ue)&&(he!=null||we!=null))switch(ue){case"type":f=he;break;case"name":d=he;break;case"checked":re=he;break;case"defaultChecked":ye=he;break;case"value":y=he;break;case"defaultValue":w=he;break;case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(r(137,t));break;default:he!==we&&en(e,t,ue,he,c,we)}}Oa(e,y,w,q,re,ye,f,d);return;case"select":he=y=w=ue=null;for(f in a)if(q=a[f],a.hasOwnProperty(f)&&q!=null)switch(f){case"value":break;case"multiple":he=q;default:c.hasOwnProperty(f)||en(e,t,f,null,c,q)}for(d in c)if(f=c[d],q=a[d],c.hasOwnProperty(d)&&(f!=null||q!=null))switch(d){case"value":ue=f;break;case"defaultValue":w=f;break;case"multiple":y=f;default:f!==q&&en(e,t,d,f,c,q)}t=w,a=y,c=he,ue!=null?qn(e,!!a,ue,!1):!!c!=!!a&&(t!=null?qn(e,!!a,t,!0):qn(e,!!a,a?[]:"",!1));return;case"textarea":he=ue=null;for(w in a)if(d=a[w],a.hasOwnProperty(w)&&d!=null&&!c.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:en(e,t,w,null,c,d)}for(y in c)if(d=c[y],f=a[y],c.hasOwnProperty(y)&&(d!=null||f!=null))switch(y){case"value":ue=d;break;case"defaultValue":he=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(r(91));break;default:d!==f&&en(e,t,y,d,c,f)}Gn(e,ue,he);return;case"option":for(var $e in a)if(ue=a[$e],a.hasOwnProperty($e)&&ue!=null&&!c.hasOwnProperty($e))switch($e){case"selected":e.selected=!1;break;default:en(e,t,$e,null,c,ue)}for(q in c)if(ue=c[q],he=a[q],c.hasOwnProperty(q)&&ue!==he&&(ue!=null||he!=null))switch(q){case"selected":e.selected=ue&&typeof ue!="function"&&typeof ue!="symbol";break;default:en(e,t,q,ue,c,he)}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 We in a)ue=a[We],a.hasOwnProperty(We)&&ue!=null&&!c.hasOwnProperty(We)&&en(e,t,We,null,c,ue);for(re in c)if(ue=c[re],he=a[re],c.hasOwnProperty(re)&&ue!==he&&(ue!=null||he!=null))switch(re){case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(r(137,t));break;default:en(e,t,re,ue,c,he)}return;default:if(Bs(t)){for(var tn in a)ue=a[tn],a.hasOwnProperty(tn)&&ue!==void 0&&!c.hasOwnProperty(tn)&&Zm(e,t,tn,void 0,c,ue);for(ye in c)ue=c[ye],he=a[ye],!c.hasOwnProperty(ye)||ue===he||ue===void 0&&he===void 0||Zm(e,t,ye,ue,c,he);return}}for(var se in a)ue=a[se],a.hasOwnProperty(se)&&ue!=null&&!c.hasOwnProperty(se)&&en(e,t,se,null,c,ue);for(we in c)ue=c[we],he=a[we],!c.hasOwnProperty(we)||ue===he||ue==null&&he==null||en(e,t,we,ue,c,he)}function Jx(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Pv(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),c=0;c<a.length;c++){var d=a[c],f=d.transferSize,y=d.initiatorType,w=d.duration;if(f&&w&&Jx(y)){for(y=0,w=d.responseEnd,c+=1;c<a.length;c++){var q=a[c],re=q.startTime;if(re>w)break;var ye=q.transferSize,we=q.initiatorType;ye&&Jx(we)&&(q=q.responseEnd,y+=ye*(q<w?1:(w-re)/(q-re)))}if(--c,t+=8*(f+y)/(d.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 Pm=null,Wm=null;function Vf(e){return e.nodeType===9?e:e.ownerDocument}function e_(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 t_(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 Jm(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 ep=null;function Wv(){var e=window.event;return e&&e.type==="popstate"?e===ep?!1:(ep=e,!0):(ep=null,!1)}var n_=typeof setTimeout=="function"?setTimeout:void 0,Jv=typeof clearTimeout=="function"?clearTimeout:void 0,s_=typeof Promise=="function"?Promise:void 0,ej=typeof queueMicrotask=="function"?queueMicrotask:typeof s_<"u"?function(e){return s_.resolve(null).then(e).catch(tj)}:n_;function tj(e){setTimeout(function(){throw e})}function Ir(e){return e==="head"}function l_(e,t){var a=t,c=0;do{var d=a.nextSibling;if(e.removeChild(a),d&&d.nodeType===8)if(a=d.data,a==="/$"||a==="/&"){if(c===0){e.removeChild(d),Po(t);return}c--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")c++;else if(a==="html")cd(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,cd(a);for(var f=a.firstChild;f;){var y=f.nextSibling,w=f.nodeName;f[B]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&f.rel.toLowerCase()==="stylesheet"||a.removeChild(f),f=y}}else a==="body"&&cd(e.ownerDocument.body);a=d}while(a);Po(t)}function a_(e,t){var a=e;e=0;do{var c=a.nextSibling;if(a.nodeType===1?t?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(t?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),c&&c.nodeType===8)if(a=c.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=c}while(a)}function tp(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":tp(a),xe(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function nj(e,t,a,c){for(;e.nodeType===1;){var d=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!c&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(c){if(!e[B])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(f=e.getAttribute("rel"),f==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(f!==d.rel||e.getAttribute("href")!==(d.href==null||d.href===""?null:d.href)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin)||e.getAttribute("title")!==(d.title==null?null:d.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(f=e.getAttribute("src"),(f!==(d.src==null?null:d.src)||e.getAttribute("type")!==(d.type==null?null:d.type)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&f&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var f=d.name==null?null:""+d.name;if(d.type==="hidden"&&e.getAttribute("name")===f)return e}else return e;if(e=la(e.nextSibling),e===null)break}return null}function sj(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=la(e.nextSibling),e===null))return null;return e}function i_(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=la(e.nextSibling),e===null))return null;return e}function np(e){return e.data==="$?"||e.data==="$~"}function sp(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function lj(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var c=function(){t(),a.removeEventListener("DOMContentLoaded",c)};a.addEventListener("DOMContentLoaded",c),e._reactRetry=c}}function la(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 lp=null;function r_(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return la(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function c_(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(t===0)return e;t--}else a!=="/$"&&a!=="/&"||t++}e=e.previousSibling}return null}function o_(e,t,a){switch(t=Vf(a),e){case"html":if(e=t.documentElement,!e)throw Error(r(452));return e;case"head":if(e=t.head,!e)throw Error(r(453));return e;case"body":if(e=t.body,!e)throw Error(r(454));return e;default:throw Error(r(451))}}function cd(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);xe(e)}var aa=new Map,u_=new Set;function Xf(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Vi=O.d;O.d={f:aj,r:ij,D:rj,C:cj,L:oj,m:uj,X:fj,S:dj,M:hj};function aj(){var e=Vi.f(),t=If();return e||t}function ij(e){var t=Ke(e);t!==null&&t.tag===5&&t.type==="form"?na(t):Vi.r(e)}var Ko=typeof document>"u"?null:document;function d_(e,t,a){var c=Ko;if(c&&typeof t=="string"&&t){var d=Pn(t);d='link[rel="'+e+'"][href="'+d+'"]',typeof a=="string"&&(d+='[crossorigin="'+a+'"]'),u_.has(d)||(u_.add(d),e={rel:e,crossOrigin:a,href:t},c.querySelector(d)===null&&(t=c.createElement("link"),Ds(t,"link",e),rt(t),c.head.appendChild(t)))}}function rj(e){Vi.D(e),d_("dns-prefetch",e,null)}function cj(e,t){Vi.C(e,t),d_("preconnect",e,t)}function oj(e,t,a){Vi.L(e,t,a);var c=Ko;if(c&&e&&t){var d='link[rel="preload"][as="'+Pn(t)+'"]';t==="image"&&a&&a.imageSrcSet?(d+='[imagesrcset="'+Pn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(d+='[imagesizes="'+Pn(a.imageSizes)+'"]')):d+='[href="'+Pn(e)+'"]';var f=d;switch(t){case"style":f=Qo(e);break;case"script":f=Zo(e)}aa.has(f)||(e=j({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),aa.set(f,e),c.querySelector(d)!==null||t==="style"&&c.querySelector(od(f))||t==="script"&&c.querySelector(ud(f))||(t=c.createElement("link"),Ds(t,"link",e),rt(t),c.head.appendChild(t)))}}function uj(e,t){Vi.m(e,t);var a=Ko;if(a&&e){var c=t&&typeof t.as=="string"?t.as:"script",d='link[rel="modulepreload"][as="'+Pn(c)+'"][href="'+Pn(e)+'"]',f=d;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=Zo(e)}if(!aa.has(f)&&(e=j({rel:"modulepreload",href:e},t),aa.set(f,e),a.querySelector(d)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(ud(f)))return}c=a.createElement("link"),Ds(c,"link",e),rt(c),a.head.appendChild(c)}}}function dj(e,t,a){Vi.S(e,t,a);var c=Ko;if(c&&e){var d=on(c).hoistableStyles,f=Qo(e);t=t||"default";var y=d.get(f);if(!y){var w={loading:0,preload:null};if(y=c.querySelector(od(f)))w.loading=5;else{e=j({rel:"stylesheet",href:e,"data-precedence":t},a),(a=aa.get(f))&&ap(e,a);var q=y=c.createElement("link");rt(q),Ds(q,"link",e),q._p=new Promise(function(re,ye){q.onload=re,q.onerror=ye}),q.addEventListener("load",function(){w.loading|=1}),q.addEventListener("error",function(){w.loading|=2}),w.loading|=4,Ff(y,t,c)}y={type:"stylesheet",instance:y,count:1,state:w},d.set(f,y)}}}function fj(e,t){Vi.X(e,t);var a=Ko;if(a&&e){var c=on(a).hoistableScripts,d=Zo(e),f=c.get(d);f||(f=a.querySelector(ud(d)),f||(e=j({src:e,async:!0},t),(t=aa.get(d))&&ip(e,t),f=a.createElement("script"),rt(f),Ds(f,"link",e),a.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},c.set(d,f))}}function hj(e,t){Vi.M(e,t);var a=Ko;if(a&&e){var c=on(a).hoistableScripts,d=Zo(e),f=c.get(d);f||(f=a.querySelector(ud(d)),f||(e=j({src:e,async:!0,type:"module"},t),(t=aa.get(d))&&ip(e,t),f=a.createElement("script"),rt(f),Ds(f,"link",e),a.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},c.set(d,f))}}function f_(e,t,a,c){var d=(d=de.current)?Xf(d):null;if(!d)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=Qo(a.href),a=on(d).hoistableStyles,c=a.get(t),c||(c={type:"style",instance:null,count:0,state:null},a.set(t,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Qo(a.href);var f=on(d).hoistableStyles,y=f.get(e);if(y||(d=d.ownerDocument||d,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(e,y),(f=d.querySelector(od(e)))&&!f._p&&(y.instance=f,y.state.loading=5),aa.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},aa.set(e,a),f||mj(d,e,a,y.state))),t&&c===null)throw Error(r(528,""));return y}if(t&&c!==null)throw Error(r(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Zo(a),a=on(d).hoistableScripts,c=a.get(t),c||(c={type:"script",instance:null,count:0,state:null},a.set(t,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function Qo(e){return'href="'+Pn(e)+'"'}function od(e){return'link[rel="stylesheet"]['+e+"]"}function h_(e){return j({},e,{"data-precedence":e.precedence,precedence:null})}function mj(e,t,a,c){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?c.loading=1:(t=e.createElement("link"),c.preload=t,t.addEventListener("load",function(){return c.loading|=1}),t.addEventListener("error",function(){return c.loading|=2}),Ds(t,"link",a),rt(t),e.head.appendChild(t))}function Zo(e){return'[src="'+Pn(e)+'"]'}function ud(e){return"script[async]"+e}function m_(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var c=e.querySelector('style[data-href~="'+Pn(a.href)+'"]');if(c)return t.instance=c,rt(c),c;var d=j({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return c=(e.ownerDocument||e).createElement("style"),rt(c),Ds(c,"style",d),Ff(c,a.precedence,e),t.instance=c;case"stylesheet":d=Qo(a.href);var f=e.querySelector(od(d));if(f)return t.state.loading|=4,t.instance=f,rt(f),f;c=h_(a),(d=aa.get(d))&&ap(c,d),f=(e.ownerDocument||e).createElement("link"),rt(f);var y=f;return y._p=new Promise(function(w,q){y.onload=w,y.onerror=q}),Ds(f,"link",c),t.state.loading|=4,Ff(f,a.precedence,e),t.instance=f;case"script":return f=Zo(a.src),(d=e.querySelector(ud(f)))?(t.instance=d,rt(d),d):(c=a,(d=aa.get(f))&&(c=j({},a),ip(c,d)),e=e.ownerDocument||e,d=e.createElement("script"),rt(d),Ds(d,"link",c),e.head.appendChild(d),t.instance=d);case"void":return null;default:throw Error(r(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(c=t.instance,t.state.loading|=4,Ff(c,a.precedence,e));return t.instance}function Ff(e,t,a){for(var c=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=c.length?c[c.length-1]:null,f=d,y=0;y<c.length;y++){var w=c[y];if(w.dataset.precedence===t)f=w;else if(f!==d)break}f?f.parentNode.insertBefore(e,f.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function ap(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function ip(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Kf=null;function p_(e,t,a){if(Kf===null){var c=new Map,d=Kf=new Map;d.set(a,c)}else d=Kf,c=d.get(a),c||(c=new Map,d.set(a,c));if(c.has(e))return c;for(c.set(e,null),a=a.getElementsByTagName(e),d=0;d<a.length;d++){var f=a[d];if(!(f[B]||f[wt]||e==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var y=f.getAttribute(t)||"";y=e+y;var w=c.get(y);w?w.push(f):c.set(y,[f])}}return c}function g_(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function pj(e,t,a){if(a===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 x_(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function gj(e,t,a,c){if(a.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var d=Qo(c.href),f=t.querySelector(od(d));if(f){t=f._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Qf.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=f,rt(f);return}f=t.ownerDocument||t,c=h_(c),(d=aa.get(d))&&ap(c,d),f=f.createElement("link"),rt(f);var y=f;y._p=new Promise(function(w,q){y.onload=w,y.onerror=q}),Ds(f,"link",c),a.instance=f}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Qf.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var rp=0;function xj(e,t){return e.stylesheets&&e.count===0&&Pf(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var c=setTimeout(function(){if(e.stylesheets&&Pf(e,e.stylesheets),e.unsuspend){var f=e.unsuspend;e.unsuspend=null,f()}},6e4+t);0<e.imgBytes&&rp===0&&(rp=62500*Pv());var d=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Pf(e,e.stylesheets),e.unsuspend)){var f=e.unsuspend;e.unsuspend=null,f()}},(e.imgBytes>rp?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(c),clearTimeout(d)}}:null}function Qf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Pf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Zf=null;function Pf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Zf=new Map,t.forEach(_j,e),Zf=null,Qf.call(e))}function _j(e,t){if(!(t.state.loading&4)){var a=Zf.get(e);if(a)var c=a.get(null);else{a=new Map,Zf.set(e,a);for(var d=e.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<d.length;f++){var y=d[f];(y.nodeName==="LINK"||y.getAttribute("media")!=="not all")&&(a.set(y.dataset.precedence,y),c=y)}c&&a.set(null,c)}d=t.instance,y=d.getAttribute("data-precedence"),f=a.get(y)||c,f===c&&a.set(null,d),a.set(y,d),this.count++,c=Qf.bind(this),d.addEventListener("load",c),d.addEventListener("error",c),f?f.parentNode.insertBefore(d,f.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(d,e.firstChild)),t.state.loading|=4}}var dd={$$typeof:G,Provider:null,Consumer:null,_currentValue:J,_currentValue2:J,_threadCount:0};function bj(e,t,a,c,d,f,y,w,q){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=Et(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Et(0),this.hiddenUpdates=Et(null),this.identifierPrefix=c,this.onUncaughtError=d,this.onCaughtError=f,this.onRecoverableError=y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=q,this.incompleteTransitions=new Map}function __(e,t,a,c,d,f,y,w,q,re,ye,we){return e=new bj(e,t,a,y,q,re,ye,we,w),t=1,f===!0&&(t|=24),f=Ms(3,null,null,t),e.current=f,f.stateNode=e,t=Cu(),t.refCount++,e.pooledCache=t,t.refCount++,f.memoizedState={element:c,isDehydrated:a,cache:t},kc(f),e}function b_(e){return e?(e=Wl,e):Wl}function y_(e,t,a,c,d,f){d=b_(d),c.context===null?c.context=d:c.pendingContext=d,c=va(t),c.payload={element:a},f=f===void 0?null:f,f!==null&&(c.callback=f),a=ja(e,c,t),a!==null&&(Nl(a,e,t),wc(a,e,t))}function v_(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function cp(e,t){v_(e,t),(e=e.alternate)&&v_(e,t)}function j_(e){if(e.tag===13||e.tag===31){var t=Zl(e,67108864);t!==null&&Nl(t,e,67108864),cp(e,67108864)}}function N_(e){if(e.tag===13||e.tag===31){var t=Ul();t=hs(t);var a=Zl(e,t);a!==null&&Nl(a,e,t),cp(e,t)}}var Wf=!0;function yj(e,t,a,c){var d=M.T;M.T=null;var f=O.p;try{O.p=2,op(e,t,a,c)}finally{O.p=f,M.T=d}}function vj(e,t,a,c){var d=M.T;M.T=null;var f=O.p;try{O.p=8,op(e,t,a,c)}finally{O.p=f,M.T=d}}function op(e,t,a,c){if(Wf){var d=up(c);if(d===null)Qm(e,t,c,Jf,a),w_(e,c);else if(Nj(d,e,t,a,c))c.stopPropagation();else if(w_(e,c),t&4&&-1<jj.indexOf(e)){for(;d!==null;){var f=Ke(d);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var y=Ot(f.pendingLanes);if(y!==0){var w=f;for(w.pendingLanes|=2,w.entangledLanes|=2;y;){var q=1<<31-Qt(y);w.entanglements[1]|=q,y&=~q}Wa(f),(Ut&6)===0&&(Of=ut()+500,ad(0))}}break;case 31:case 13:w=Zl(f,2),w!==null&&Nl(w,f,2),If(),cp(f,2)}if(f=up(c),f===null&&Qm(e,t,c,Jf,a),f===d)break;d=f}d!==null&&c.stopPropagation()}else Qm(e,t,c,null,a)}}function up(e){return e=Fl(e),dp(e)}var Jf=null;function dp(e){if(Jf=null,e=Re(e),e!==null){var t=u(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=m(t),e!==null)return e;e=null}else if(a===31){if(e=p(t),e!==null)return e;e=null}else if(a===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Jf=e,null}function k_(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(Un()){case $n:return 2;case Gt:return 8;case it:case vt:return 32;case Kt:return 268435456;default:return 32}default:return 32}}var fp=!1,Ur=null,$r=null,Br=null,fd=new Map,hd=new Map,Hr=[],jj="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 w_(e,t){switch(e){case"focusin":case"focusout":Ur=null;break;case"dragenter":case"dragleave":$r=null;break;case"mouseover":case"mouseout":Br=null;break;case"pointerover":case"pointerout":fd.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":hd.delete(t.pointerId)}}function md(e,t,a,c,d,f){return e===null||e.nativeEvent!==f?(e={blockedOn:t,domEventName:a,eventSystemFlags:c,nativeEvent:f,targetContainers:[d]},t!==null&&(t=Ke(t),t!==null&&j_(t)),e):(e.eventSystemFlags|=c,t=e.targetContainers,d!==null&&t.indexOf(d)===-1&&t.push(d),e)}function Nj(e,t,a,c,d){switch(t){case"focusin":return Ur=md(Ur,e,t,a,c,d),!0;case"dragenter":return $r=md($r,e,t,a,c,d),!0;case"mouseover":return Br=md(Br,e,t,a,c,d),!0;case"pointerover":var f=d.pointerId;return fd.set(f,md(fd.get(f)||null,e,t,a,c,d)),!0;case"gotpointercapture":return f=d.pointerId,hd.set(f,md(hd.get(f)||null,e,t,a,c,d)),!0}return!1}function S_(e){var t=Re(e.target);if(t!==null){var a=u(t);if(a!==null){if(t=a.tag,t===13){if(t=m(a),t!==null){e.blockedOn=t,Qs(e.priority,function(){N_(a)});return}}else if(t===31){if(t=p(a),t!==null){e.blockedOn=t,Qs(e.priority,function(){N_(a)});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function eh(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=up(e.nativeEvent);if(a===null){a=e.nativeEvent;var c=new a.constructor(a.type,a);Xl=c,a.target.dispatchEvent(c),Xl=null}else return t=Ke(a),t!==null&&j_(t),e.blockedOn=a,!1;t.shift()}return!0}function E_(e,t,a){eh(e)&&a.delete(t)}function kj(){fp=!1,Ur!==null&&eh(Ur)&&(Ur=null),$r!==null&&eh($r)&&($r=null),Br!==null&&eh(Br)&&(Br=null),fd.forEach(E_),hd.forEach(E_)}function th(e,t){e.blockedOn===t&&(e.blockedOn=null,fp||(fp=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,kj)))}var nh=null;function C_(e){nh!==e&&(nh=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){nh===e&&(nh=null);for(var t=0;t<e.length;t+=3){var a=e[t],c=e[t+1],d=e[t+2];if(typeof c!="function"){if(dp(c||a)===null)continue;break}var f=Ke(a);f!==null&&(e.splice(t,3),t-=3,Fu(f,{pending:!0,data:d,method:a.method,action:c},c,d))}}))}function Po(e){function t(q){return th(q,e)}Ur!==null&&th(Ur,e),$r!==null&&th($r,e),Br!==null&&th(Br,e),fd.forEach(t),hd.forEach(t);for(var a=0;a<Hr.length;a++){var c=Hr[a];c.blockedOn===e&&(c.blockedOn=null)}for(;0<Hr.length&&(a=Hr[0],a.blockedOn===null);)S_(a),a.blockedOn===null&&Hr.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(c=0;c<a.length;c+=3){var d=a[c],f=a[c+1],y=d[At]||null;if(typeof f=="function")y||C_(a);else if(y){var w=null;if(f&&f.hasAttribute("formAction")){if(d=f,y=f[At]||null)w=y.formAction;else if(dp(d)!==null)continue}else w=y.action;typeof w=="function"?a[c+1]=w:(a.splice(c,3),c-=3),C_(a)}}}function T_(){function e(f){f.canIntercept&&f.info==="react-transition"&&f.intercept({handler:function(){return new Promise(function(y){return d=y})},focusReset:"manual",scroll:"manual"})}function t(){d!==null&&(d(),d=null),c||setTimeout(a,20)}function a(){if(!c&&!navigation.transition){var f=navigation.currentEntry;f&&f.url!=null&&navigation.navigate(f.url,{state:f.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var c=!1,d=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){c=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),d!==null&&(d(),d=null)}}}function hp(e){this._internalRoot=e}sh.prototype.render=hp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));var a=t.current,c=Ul();y_(a,c,e,t,null,null)},sh.prototype.unmount=hp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;y_(e.current,2,null,e,null,null),If(),t[cn]=null}};function sh(e){this._internalRoot=e}sh.prototype.unstable_scheduleHydration=function(e){if(e){var t=Zn();e={blockedOn:null,target:e,priority:t};for(var a=0;a<Hr.length&&t!==0&&t<Hr[a].priority;a++);Hr.splice(a,0,e),a===0&&S_(e)}};var A_=l.version;if(A_!=="19.2.8")throw Error(r(527,A_,"19.2.8"));O.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=_(t),e=e!==null?b(e):null,e=e===null?null:e.stateNode,e};var wj={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var lh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!lh.isDisabled&&lh.supportsFiber)try{Tt=lh.inject(wj),Lt=lh}catch{}}return gd.createRoot=function(e,t){if(!o(e))throw Error(r(299));var a=!1,c="",d=pt,f=an,y=bs;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(c=t.identifierPrefix),t.onUncaughtError!==void 0&&(d=t.onUncaughtError),t.onCaughtError!==void 0&&(f=t.onCaughtError),t.onRecoverableError!==void 0&&(y=t.onRecoverableError)),t=__(e,1,!1,null,null,a,c,null,d,f,y,T_),e[cn]=t.current,Km(e),new hp(t)},gd.hydrateRoot=function(e,t,a){if(!o(e))throw Error(r(299));var c=!1,d="",f=pt,y=an,w=bs,q=null;return a!=null&&(a.unstable_strictMode===!0&&(c=!0),a.identifierPrefix!==void 0&&(d=a.identifierPrefix),a.onUncaughtError!==void 0&&(f=a.onUncaughtError),a.onCaughtError!==void 0&&(y=a.onCaughtError),a.onRecoverableError!==void 0&&(w=a.onRecoverableError),a.formState!==void 0&&(q=a.formState)),t=__(e,1,!0,t,a??null,c,d,q,f,y,w,T_),t.context=b_(null),a=t.current,c=Ul(),c=hs(c),d=va(c),d.callback=null,ja(a,d,c),a=c,t.current.lanes=a,_t(t,a),Wa(t),e[cn]=t.current,Km(e),new sh(t)},gd.version="19.2.8",gd}var H_;function zj(){if(H_)return xp.exports;H_=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(l){console.error(l)}}return n(),xp.exports=Oj(),xp.exports}var Ij=zj();const Iy=1,Ki="main",q_=["skills","agents","hooks","commands","plugins","output-styles","CLAUDE.md","settings.json","keybindings.json"],Ji=["orange","blue","green","purple","pink","teal"],ah={maxCount:5,maxTotalBytes:5*1024*1024};function Uj(n){return`${n.replace(/[^\p{L}\p{N}\p{M}]/gu,"-").replace(/-+/g,"-").toLowerCase().replace(/^-|-$/g,"")||"project"}-${Uy(n)}`}function $j(n){const l=n.replace(/[^a-zA-Z0-9]/g,"-").replace(/-+/g,"-").toLowerCase(),i=`${l.replace(/^-+|-+$/g,"")||"project"}-${Uy(n)}`,r=Uj(n);return[l,i].filter(o=>o!==r)}function Uy(n){const l=/^[a-zA-Z]:[\\/]|^\\\\/.test(n);return Bj(l?n.toLowerCase():n)}function Bj(n){let l=3735928559,i=1103547991;for(let r=0;r<n.length;r++){const o=n.charCodeAt(r);l=Math.imul(l^o,2654435761),i=Math.imul(i^o,1597334677)}return l=Math.imul(l^l>>>16,2246822507)^Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507)^Math.imul(l^l>>>13,3266489909),(4294967296*(2097151&i)+(l>>>0)).toString(36)}const yg=x.createContext({accounts:[],auth:{},multi:!1});function vg(){return x.useContext(yg)}function Hj(n,l="claude"){const{accounts:i,multi:r}=x.useContext(yg);return!r||l!==void 0&&l!=="claude"||!n?null:i.find(o=>o.id===n)??null}const Sh={orange:"оранжевый",blue:"синий",green:"зелёный",purple:"фиолетовый",pink:"розовый",teal:"бирюзовый"};function $y(n){const l=Array.from(n.trim())[0];return l?l.toUpperCase():"?"}function By(n){return n?n.loggedIn?n.plan||"вход выполнен":"вход не выполнен":""}const Hy="ccv:last-account";function qj(){try{return localStorage.getItem(Hy)}catch{return null}}function Gj(n){try{localStorage.setItem(Hy,n)}catch{}}function Da({account:n,size:l="sm",className:i}){const r=`Аккаунт «${n.name}», ${Sh[n.color]}`;return s.jsx("span",{className:`acct-mark acct-mark--${l} acct--${n.color}${i?` ${i}`:""}`,role:"img","aria-label":r,title:r,children:s.jsx("span",{"aria-hidden":"true",children:$y(n.name)})})}function G_({account:n,onClick:l,className:i}){const r=s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"acct-mark acct-mark--sm","aria-hidden":"true",children:s.jsx("span",{children:$y(n.name)})}),s.jsx("span",{className:"acct-chip__name",children:n.name})]}),o=`acct-chip acct--${n.color}${i?` ${i}`:""}`,u=`Сессия идёт под аккаунтом «${n.name}» — лимиты и тариф берутся из него`;return l?s.jsx("button",{type:"button",className:o,title:u,"aria-label":`Аккаунт «${n.name}». Открыть аккаунты`,onClick:l,children:r}):s.jsx("span",{className:o,title:u,role:"group","aria-label":`Аккаунт «${n.name}»`,children:r})}var Wi,cu,ou,uu,du,Ud,fu,Kh,qy;class Yj{constructor(l){On(this,Kh);On(this,Wi,null);On(this,cu,new Set);On(this,ou,500);On(this,uu,null);On(this,du,!1);On(this,Ud,null);On(this,fu,null);this.url=l}get statusText(){return this.connected?"Хост на связи":"Нет связи с хостом"}onStatus(l){$t(this,fu,l)}connect(){if(tt(this,du))return;const l=new WebSocket(this.url);$t(this,Wi,l),l.addEventListener("open",()=>{var i,r;$t(this,ou,500),this.send({type:"hello",protocol:Iy,clientName:"ccv-web"}),(i=tt(this,Ud))==null||i.call(this),(r=tt(this,fu))==null||r.call(this)}),l.addEventListener("message",i=>{let r;try{r=JSON.parse(String(i.data))}catch{return}for(const o of tt(this,cu))o(r)}),l.addEventListener("close",()=>{var i;$t(this,Wi,null),(i=tt(this,fu))==null||i.call(this),os(this,Kh,qy).call(this)}),l.addEventListener("error",()=>l.close())}onReconnect(l){$t(this,Ud,l)}on(l){return tt(this,cu).add(l),()=>tt(this,cu).delete(l)}send(l){var i;((i=tt(this,Wi))==null?void 0:i.readyState)===WebSocket.OPEN&&tt(this,Wi).send(JSON.stringify(l))}get connected(){var l;return((l=tt(this,Wi))==null?void 0:l.readyState)===WebSocket.OPEN}close(){var l;$t(this,du,!0),(l=tt(this,Wi))==null||l.close()}}Wi=new WeakMap,cu=new WeakMap,ou=new WeakMap,uu=new WeakMap,du=new WeakMap,Ud=new WeakMap,fu=new WeakMap,Kh=new WeakSet,qy=function(){if(tt(this,du)||tt(this,uu)!==null)return;const l=tt(this,ou);$t(this,ou,Math.min(l*2,1e4)),$t(this,uu,window.setTimeout(()=>{$t(this,uu,null),this.connect()},l))};const Vj=1,Gy="ccv:relay",Eh="ccv:relay.host";function Xj(){try{const n=localStorage.getItem(Gy);if(!n)return null;const l=JSON.parse(n);return typeof(l==null?void 0:l.token)!="string"||typeof l.expiresAt=="number"&&l.expiresAt<=Date.now()?null:l}catch{return null}}function Yy(){localStorage.removeItem(Gy)}var ii,hu,ri,mu,pu,Zr,Fc,Kc,Pr,Qc,gu,Zc,Pc,yn,Xr,Kp,Vy,Hc,Qp;class Fj{constructor(l){On(this,yn);On(this,ii,null);On(this,hu,new Set);On(this,ri,null);On(this,mu,null);On(this,pu,500);On(this,Zr,null);On(this,Fc,!1);On(this,Kc,!1);On(this,Pr,!1);On(this,Qc,null);On(this,gu,"Подключаемся…");On(this,Zc,0);On(this,Pc,[]);this.session=l}get connected(){return tt(this,Kc)&&tt(this,Pr)}get statusText(){return tt(this,gu)}get hostId(){return tt(this,Qc)}on(l){return tt(this,hu).add(l),()=>tt(this,hu).delete(l)}onReconnect(l){$t(this,mu,l)}onStatus(l){$t(this,ri,l)}connect(){tt(this,Fc)||os(this,yn,Kp).call(this)}send(l){if(!tt(this,Kc)){tt(this,Pc).length<64&&tt(this,Pc).push(l);return}os(this,yn,Hc).call(this,{t:"client.frame",body:l})}close(){var l;$t(this,Fc,!0),tt(this,Zr)!==null&&window.clearTimeout(tt(this,Zr)),(l=tt(this,ii))==null||l.close()}}ii=new WeakMap,hu=new WeakMap,ri=new WeakMap,mu=new WeakMap,pu=new WeakMap,Zr=new WeakMap,Fc=new WeakMap,Kc=new WeakMap,Pr=new WeakMap,Qc=new WeakMap,gu=new WeakMap,Zc=new WeakMap,Pc=new WeakMap,yn=new WeakSet,Xr=function(l){var i;tt(this,gu)!==l&&($t(this,gu,l),(i=tt(this,ri))==null||i.call(this))},Kp=async function(){if(tt(this,ii))return;if(!tt(this,Qc))try{$t(this,Qc,await Kj(this.session.token))}catch(r){os(this,yn,Xr).call(this,r instanceof Error?r.message:String(r)),os(this,yn,Qp).call(this);return}const l=location.protocol==="https:"?"wss":"ws",i=new WebSocket(`${l}://${location.host}/relay/client`);$t(this,ii,i),i.addEventListener("open",()=>{os(this,yn,Hc).call(this,{t:"client.hello",protocol:Vj,token:this.session.token})}),i.addEventListener("message",r=>{let o;try{o=JSON.parse(String(r.data))}catch{return}os(this,yn,Vy).call(this,o)}),i.addEventListener("close",()=>{var r;$t(this,ii,null),$t(this,Kc,!1),$t(this,Pr,!1),os(this,yn,Xr).call(this,"Нет связи с сервером"),(r=tt(this,ri))==null||r.call(this),os(this,yn,Qp).call(this)}),i.addEventListener("error",()=>i.close())},Vy=function(l){var i,r,o,u,m,p,g;switch(l.t){case"client.ok":$t(this,pu,500),os(this,yn,Hc).call(this,{t:"client.attach",hostId:tt(this,Qc)??"",...tt(this,Zc)>0?{sinceRseq:tt(this,Zc)}:{}});return;case"client.attached":$t(this,Kc,!0),$t(this,Pr,l.online),$t(this,Zc,l.rseq),os(this,yn,Xr).call(this,l.online?"Хост на связи":"Компьютер не на связи"),os(this,yn,Hc).call(this,{t:"client.frame",body:{type:"hello",protocol:Iy,clientName:"ccv-web-relay"}});const _=tt(this,Pc);$t(this,Pc,[]);for(const b of _)os(this,yn,Hc).call(this,{t:"client.frame",body:b});(i=tt(this,mu))==null||i.call(this),(r=tt(this,ri))==null||r.call(this);return;case"host.frame":{l.rseq>0&&$t(this,Zc,l.rseq);const b=l.body;for(const j of tt(this,hu))j(b);return}case"host.online":$t(this,Pr,!0),os(this,yn,Xr).call(this,"Хост на связи"),(o=tt(this,mu))==null||o.call(this),(u=tt(this,ri))==null||u.call(this);return;case"host.offline":$t(this,Pr,!1),os(this,yn,Xr).call(this,"Компьютер не на связи"),(m=tt(this,ri))==null||m.call(this);return;case"ping":os(this,yn,Hc).call(this,{t:"pong",nonce:l.nonce});return;case"error":if(l.code==="auth"){Yy(),location.href="/login";return}if(l.code==="not_found"){localStorage.removeItem(Eh),os(this,yn,Xr).call(this,"Этот компьютер отвязан от аккаунта"),$t(this,Fc,!0),(p=tt(this,ii))==null||p.close();return}l.code!=="offline"&&os(this,yn,Xr).call(this,l.message),(g=tt(this,ri))==null||g.call(this);return}},Hc=function(l){var i;((i=tt(this,ii))==null?void 0:i.readyState)===WebSocket.OPEN&&tt(this,ii).send(JSON.stringify(l))},Qp=function(){if(tt(this,Fc)||tt(this,Zr)!==null)return;const l=tt(this,pu);$t(this,pu,Math.min(l*2,1e4)),$t(this,Zr,window.setTimeout(()=>{$t(this,Zr,null),os(this,yn,Kp).call(this)},l))};async function Kj(n){const l=new URLSearchParams(location.search).get("host");if(l)return localStorage.setItem(Eh,l),l;const i=localStorage.getItem(Eh);if(i)return i;const r=await fetch("/api/hosts",{headers:{authorization:`Bearer ${n}`}});if(r.status===401)throw Yy(),location.href="/login",new Error("нужен вход");const u=(await r.json()).hosts??[];if(u.length===1&&u[0])return localStorage.setItem(Eh,u[0].id),u[0].id;throw location.href="/hosts",new Error("выберите компьютер")}function Ch(){return location.pathname==="/app"||location.pathname.startsWith("/app/")?"relay":"local"}const Qj=`${location.protocol==="https:"?"wss":"ws"}://${location.host}/ws`;function Zj(){if(Ch()==="local")return new Yj(Qj);const n=Xj();return n?new Fj(n):(location.replace(`/login?next=${encodeURIComponent(location.pathname+location.search)}`),null)}const Xy="ccv:drafts",Fy=40,Pj=2e4,Wj=500;let Cd=null,Td=null;function jg(){if(Cd)return Cd;const n=new Map;try{const l=localStorage.getItem(Xy);if(l){const i=JSON.parse(l);if(typeof i=="object"&&i!==null)for(const[r,o]of Object.entries(i))typeof o=="string"&&o!==""&&n.set(r,o)}}catch{}return Cd=n,window.addEventListener("pagehide",Py),n}function vp(n){return jg().get(n)??""}function Ky(n,l){const i=jg(),r=l.slice(0,Pj),o=i.has(n);if(o&&i.delete(n),r!=="")i.set(n,r);else if(!o)return;for(;i.size>Fy;){const u=i.keys().next();if(u.done)break;i.delete(u.value)}e1(),Zy()}function Qy(){const n=new Set,l=[...jg().keys(),...Gc.keys()];for(const i of l)n.add(i.startsWith("side:")?i.slice(5):i);return[...n].sort()}const Gc=new Map;function jp(n){return Gc.get(n)??{images:[],docs:[]}}function Y_(n,l){for(Gc.delete(n),(l.images.length>0||l.docs.length>0)&&Gc.set(n,l);Gc.size>Fy;){const i=Gc.keys().next();if(i.done)break;Gc.delete(i.value)}Zy()}const Zp=new Set;let V_="";function Jj(n){return Zp.add(n),()=>Zp.delete(n)}function Zy(){const n=Qy(),l=n.join(`
51
+ `);if(l!==V_){V_=l;for(const i of Zp)i(n)}}function e1(){Td===null&&(Td=window.setTimeout(Py,Wj))}function Py(){if(Td!==null&&window.clearTimeout(Td),Td=null,!!Cd)try{localStorage.setItem(Xy,JSON.stringify(Object.fromEntries(Cd)))}catch{}}const Xs={items:[],pending:[],lastSeq:0,contextTokens:null},Np={entries:[],total:0,loading:!1};function Wy(n){var l;return((l=n.entries[0])==null?void 0:l.seq)??1}function kp(n){return n.total>0&&Wy(n)>1}function t1(n,l){const i=new Set(n.entries.map(o=>o.seq));return{entries:[...n.entries,...l.entries.filter(o=>!i.has(o.seq))].sort((o,u)=>o.seq-u.seq),total:l.total,loading:!1}}function n1(n){return Th(Xs,n).items.map(l=>({...l,id:`h:${l.id}`}))}function Th(n,l){let i=n;for(const r of l)r.seq<=i.lastSeq||(i={...s1(i,r.event,r.seq),lastSeq:r.seq});return i}function s1(n,l,i){var o,u;const r=n.items;switch(l.kind){case"user.message":return Ja(n,{id:`u${i}`,kind:"user",text:l.text,images:l.images,files:l.files});case"assistant.delta":{const m=r.findIndex(g=>g.id===l.blockId);if(m===-1)return Ja(n,{id:l.blockId,kind:"assistant",text:l.text,streaming:!0});const p=r[m];return Wo(n,m,{...p,text:p.text+l.text})}case"assistant.text":{const m=r.findIndex(g=>g.id===l.blockId),p={id:l.blockId,kind:"assistant",text:l.text,streaming:!1};return m===-1?Ja(n,p):Wo(n,m,p)}case"thinking.delta":{const m=r.findIndex(g=>g.id===l.blockId);if(m===-1)return Ja(n,{id:l.blockId,kind:"thinking",text:l.text});const p=r[m];return Wo(n,m,{...p,text:p.text+l.text})}case"assistant.thinking":{const m=r.findIndex(g=>g.id===l.blockId),p={id:l.blockId,kind:"thinking",text:l.text};return m===-1?Ja(n,p):Wo(n,m,p)}case"tool.use":return Ja(n,{id:`t${l.toolUseId}`,kind:"tool",toolUseId:l.toolUseId,name:l.name,input:l.input,result:null,isError:!1,awaitingPermission:!1});case"tool.result":{const m=r.findIndex(g=>g.kind==="tool"&&g.toolUseId===l.toolUseId);if(m===-1)return n;const p=r[m];return Wo(n,m,{...p,result:l.content,isError:l.isError,awaitingPermission:!1})}case"permission.request":return{...n,pending:[...n.pending,{requestId:l.requestId,toolName:l.toolName,input:l.input,...l.reason?{reason:l.reason}:{},...l.questions?{questions:l.questions}:{},...l.toolUseId?{toolUseId:l.toolUseId}:{}}]};case"permission.resolved":{const m=n.pending.find(g=>g.requestId===l.requestId),p=n.pending.filter(g=>g.requestId!==l.requestId);if(l.answers&&(m!=null&&m.toolUseId)){const g=r.findIndex(_=>_.kind==="tool"&&_.toolUseId===m.toolUseId);if(g!==-1){const _=r[g];return Wo({...n,pending:p},g,{..._,answers:l.answers})}}return l.decision==="allow"?{...n,pending:p}:Ja({...n,pending:p},{id:`p${i}`,kind:"notice",tone:"info",text:`Отклонено${l.reason?`: ${l.reason}`:""}`})}case"result":{const m=n.items.map(g=>g.kind==="assistant"&&g.streaming?{...g,streaming:!1}:g),p=l.contextTokens??n.contextTokens;return Ja({...n,items:m,contextTokens:p},{id:`r${i}`,kind:"result",subtype:l.subtype,isError:l.isError,durationMs:l.durationMs,costUsd:l.costUsd,inputTokens:((o=l.usage)==null?void 0:o.inputTokens)??0,outputTokens:((u=l.usage)==null?void 0:u.outputTokens)??0})}case"system":return l.subtype!=="compact_boundary"?n:Ja(n,{id:`s${i}`,kind:"notice",tone:"info",text:"Контекст сжат"});case"error":return Ja(n,{id:`e${i}`,kind:"notice",tone:"error",text:l.message});case"state":return n;case"rewound":return n;default:return n}}function l1(n,l){let i=0;for(let r=0;r<n.length;r++)if(n[r].event.kind==="user.message"){if(i===l)return n.slice(0,r);i++}return n}function a1(n,l,i){const r=l-i;if(r<=0)return[];let o=0;for(let u=0;u<n.length;u++)if(n[u].kind==="user"){if(o===r)return n.slice(0,u);o++}return n}function Ja(n,l){return{...n,items:[...n.items,l]}}function Wo(n,l,i){const r=n.items.slice();return r[l]=i,{...n,items:r}}const Pp="ccv:theme",wp=["system","light","dark"];function i1(){const[n,l]=x.useState(r1);x.useEffect(()=>{const o=window.matchMedia("(prefers-color-scheme: dark)"),u=()=>{const m=n==="dark"||n==="system"&&o.matches;document.documentElement.dataset.theme=m?"dark":"light"};return u(),o.addEventListener("change",u),()=>o.removeEventListener("change",u)},[n]);const i=x.useCallback(o=>{try{localStorage.setItem(Pp,o)}catch{}l(o)},[]),r=x.useCallback(()=>{l(o=>{const u=wp[(wp.indexOf(o)+1)%wp.length];try{localStorage.setItem(Pp,u)}catch{}return u})},[]);return[n,i,r]}function r1(){try{const n=localStorage.getItem(Pp);if(n==="light"||n==="dark"||n==="system")return n}catch{}return"system"}const Ng=[{value:"default",hint:"спрашивать перед каждым действием"},{value:"acceptEdits",hint:"правки файлов без подтверждения"},{value:"plan",hint:"только чтение и план, без изменений"},{value:"auto",hint:"спрашивать только о рискованном — решает сам"},{value:"bypassPermissions",hint:"ничего не спрашивать"}],c1=[{value:"default",hint:"рискованное agy отклоняет сам: спросить он не может"},{value:"acceptEdits",hint:"правки файлов без подтверждения, команды — нет"},{value:"plan",hint:"только план, без изменений"},{value:"bypassPermissions",hint:"разрешено всё, включая команды"}],o1=[{value:"default",hint:"спрашивать перед командами и правками"},{value:"acceptEdits",hint:"правки файлов без подтверждения, команды — с вопросом"},{value:"plan",hint:"только чтение и план, без изменений"},{value:"dontAsk",hint:"не спрашивать: что вне песочницы, отклоняется"},{value:"bypassPermissions",hint:"ничего не спрашивать, без песочницы"}];function us(n){return n==null||n==="claude"}function X_(n){return n==="antigravity"?"Antigravity":n==="codex"?"Codex":"Claude"}const Wc={sidebar:{side:"left",min:200,max:520,width:276,label:"сессий"},files:{side:"left",min:180,max:560,width:260,label:"файлов"},search:{side:"left",min:220,max:640,width:320,label:"поиска"},git:{side:"left",min:220,max:640,width:320,label:"истории"},ask:{side:"right",min:260,max:720,width:380,label:"вопроса"}},u1=320,Jy="ccv:panes";function d1(n){return`--${n}-w`}function e0(n,l){const i=Wc[n];return Math.round(Math.min(i.max,Math.max(i.min,l)))}function f1(){const n={};for(const l of Object.keys(Wc))n[l]=Wc[l].width;try{const l=localStorage.getItem(Jy);if(l){const i=JSON.parse(l);for(const r of Object.keys(Wc)){const o=i[r];typeof o=="number"&&Number.isFinite(o)&&(n[r]=e0(r,o))}}}catch{}return n}function h1(){const[n,l]=x.useState(f1),i=x.useCallback(m=>{try{localStorage.setItem(Jy,JSON.stringify(m))}catch{}},[]),r=x.useCallback((m,p)=>{l(g=>{const _=e0(m,p);if(g[m]===_)return g;const b={...g,[m]:_};return i(b),b})},[i]),o=x.useCallback(m=>{l(p=>{const g={...p,[m]:Wc[m].width};return i(g),g})},[i]),u={};for(const m of Object.keys(Wc))u[d1(m)]=`${n[m]}px`;return{widths:n,style:u,setWidth:r,reset:o}}const Sp=260,t0=120,m1=200,F_="ccv:terminal-h";function K_(n,l){return Math.round(Math.min(l,Math.max(t0,n)))}function p1(){const[n,l]=x.useState(()=>{try{const u=localStorage.getItem(F_);if(u){const m=Number(u);if(Number.isFinite(m))return K_(m,1/0)}}catch{}return Sp}),i=x.useCallback(u=>{try{localStorage.setItem(F_,String(u))}catch{}},[]),r=x.useCallback((u,m)=>{const p=K_(u,m);l(g=>g===p?g:(i(p),p))},[i]),o=x.useCallback(()=>{l(Sp),i(Sp)},[i]);return{height:n,setHeight:r,reset:o}}function $d(n){const[l,i]=x.useState(()=>typeof window>"u"?!1:window.matchMedia(n).matches);return x.useEffect(()=>{const r=window.matchMedia(n),o=()=>i(r.matches);return o(),r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[n]),l}const g1=500,x1=6;function n0({onLongPress:n,onClick:l,disabled:i=!1,thresholdMs:r=g1,moveCancelPx:o=x1}){const u=x.useRef(null),[m,p]=x.useState(!1),g=x.useCallback(()=>{u.current&&window.clearTimeout(u.current.timer),u.current=null,p(!1)},[]),_=x.useCallback(E=>{if(i||E.button!==0)return;const C={timer:0,x:E.clientX,y:E.clientY,fired:!1};C.timer=window.setTimeout(()=>{C.fired=!0,p(!1),n()},r),u.current=C,p(!0)},[i,r,n]),b=x.useCallback(E=>{const C=u.current;!C||C.fired||Math.hypot(E.clientX-C.x,E.clientY-C.y)>o&&g()},[o,g]),j=x.useCallback(()=>{u.current&&!u.current.fired?g():p(!1)},[g]),v=x.useCallback(E=>{var C;if((C=u.current)!=null&&C.fired){u.current=null,E.preventDefault();return}if(!i){if(E.shiftKey){n();return}l()}},[i,l,n]),k=x.useCallback(E=>{E.preventDefault()},[]),N=x.useCallback(E=>{i||E.shiftKey&&(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),n())},[i,n]);return{holding:m,thresholdMs:r,handlers:{onPointerDown:_,onPointerMove:b,onPointerUp:j,onPointerCancel:j,onPointerLeave:j,onClick:v,onContextMenu:k,onKeyDown:N}}}const _1={height:0,offsetTop:0,offsetLeft:0};function Q_(){if(typeof window>"u")return _1;const n=window.visualViewport;return n?{height:n.height,offsetTop:n.offsetTop,offsetLeft:n.offsetLeft}:{height:window.innerHeight,offsetTop:0,offsetLeft:0}}function b1(n){const[l,i]=x.useState(Q_);return x.useEffect(()=>{if(!n)return;const r=window.visualViewport,o=()=>{const u=Q_();i(m=>m.height===u.height&&m.offsetTop===u.offsetTop&&m.offsetLeft===u.offsetLeft?m:u)};return o(),r?(r.addEventListener("resize",o),r.addEventListener("scroll",o),()=>{r.removeEventListener("resize",o),r.removeEventListener("scroll",o)}):(window.addEventListener("resize",o),()=>window.removeEventListener("resize",o))},[n]),l}function kg(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var to=kg();function s0(n){to=n}var Yc={exec:()=>null};function Jo(n){let l=[];return i=>{let r=Math.max(0,Math.min(3,i-1)),o=l[r];return o||(o=n(r),l[r]=o),o}}function St(n,l=""){let i=typeof n=="string"?n:n.source,r={replace:(o,u)=>{let m=typeof u=="string"?u:u.source;return m=m.replace(Fs.caret,"$1"),i=i.replace(o,m),r},getRegex:()=>new RegExp(i,l)};return r}var y1=((n="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+n)}catch{return!1}})(),Fs={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Jo(n=>new RegExp(`^ {0,${n}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Jo(n=>new RegExp(`^ {0,${n}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Jo(n=>new RegExp(`^ {0,${n}}(?:\`\`\`|~~~)`)),headingBeginRegex:Jo(n=>new RegExp(`^ {0,${n}}#`)),htmlBeginRegex:Jo(n=>new RegExp(`^ {0,${n}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Jo(n=>new RegExp(`^ {0,${n}}>`))},v1=/^(?:[ \t]*(?:\n|$))+/,j1=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,N1=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Bd=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,k1=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,wg=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,l0=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,a0=St(l0).replace(/bull/g,wg).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),w1=St(l0).replace(/bull/g,wg).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Sg=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,S1=/^[^\n]+/,Eg=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,E1=St(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Eg).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),C1=St(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,wg).getRegex(),Qh="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Cg=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,T1=St("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Cg).replace("tag",Qh).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),i0=n=>St(Sg).replace("hr",Bd).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list",n).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Qh).getRegex(),A1=i0(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),M1=i0(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),R1=St(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",M1).getRegex(),Tg={blockquote:R1,code:j1,def:E1,fences:N1,heading:k1,hr:Bd,html:T1,lheading:a0,list:C1,newline:v1,paragraph:A1,table:Yc,text:S1},Z_=St("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Bd).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Qh).getRegex(),D1={...Tg,lheading:w1,table:Z_,paragraph:St(Sg).replace("hr",Bd).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Z_).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Qh).getRegex()},L1={...Tg,html:St(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Cg).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Yc,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:St(Sg).replace("hr",Bd).replace("heading",` *#{1,6} *[^
52
+ ]`).replace("lheading",a0).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},O1=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,z1=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,r0=/^( {2,}|\\)\n(?!\s*$)/,I1=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,xu=/[\p{P}\p{S}]/u,Zh=/[\s\p{P}\p{S}]/u,Ag=/[^\s\p{P}\p{S}]/u,U1=St(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Zh).getRegex(),c0=/(?!~)[\p{P}\p{S}]/u,$1=/(?!~)[\s\p{P}\p{S}]/u,B1=/(?:[^\s\p{P}\p{S}]|~)/u,H1=St(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",y1?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),o0=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,q1=St(o0,"u").replace(/punct/g,xu).getRegex(),G1=St(o0,"u").replace(/punct/g,c0).getRegex(),u0="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Y1=St(u0,"gu").replace(/notPunctSpace/g,Ag).replace(/punctSpace/g,Zh).replace(/punct/g,xu).getRegex(),V1=St(u0,"gu").replace(/notPunctSpace/g,B1).replace(/punctSpace/g,$1).replace(/punct/g,c0).getRegex(),X1=St("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ag).replace(/punctSpace/g,Zh).replace(/punct/g,xu).getRegex(),F1=St(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,xu).getRegex(),K1="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Q1=St(K1,"gu").replace(/notPunctSpace/g,Ag).replace(/punctSpace/g,Zh).replace(/punct/g,xu).getRegex(),Z1=St(/\\(punct)/,"gu").replace(/punct/g,xu).getRegex(),P1=St(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),W1=St(Cg).replace("(?:-->|$)","-->").getRegex(),J1=St("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",W1).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),zh=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,eN=St(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",zh).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),d0=St(/^!?\[(label)\]\[(ref)\]/).replace("label",zh).replace("ref",Eg).getRegex(),f0=St(/^!?\[(ref)\](?:\[\])?/).replace("ref",Eg).getRegex(),tN=St("reflink|nolink(?!\\()","g").replace("reflink",d0).replace("nolink",f0).getRegex(),P_=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Mg={_backpedal:Yc,anyPunctuation:Z1,autolink:P1,blockSkip:H1,br:r0,code:z1,del:Yc,delLDelim:Yc,delRDelim:Yc,emStrongLDelim:q1,emStrongRDelimAst:Y1,emStrongRDelimUnd:X1,escape:O1,link:eN,nolink:f0,punctuation:U1,reflink:d0,reflinkSearch:tN,tag:J1,text:I1,url:Yc},nN={...Mg,link:St(/^!?\[(label)\]\((.*?)\)/).replace("label",zh).getRegex(),reflink:St(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",zh).getRegex()},Wp={...Mg,emStrongRDelimAst:V1,emStrongLDelim:G1,delLDelim:F1,delRDelim:Q1,url:St(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",P_).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:St(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",P_).getRegex()},sN={...Wp,br:St(r0).replace("{2,}","*").getRegex(),text:St(Wp.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ih={normal:Tg,gfm:D1,pedantic:L1},xd={normal:Mg,gfm:Wp,breaks:sN,pedantic:nN},lN={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},W_=n=>lN[n];function si(n,l){if(l){if(Fs.escapeTest.test(n))return n.replace(Fs.escapeReplace,W_)}else if(Fs.escapeTestNoEncode.test(n))return n.replace(Fs.escapeReplaceNoEncode,W_);return n}function J_(n){try{n=encodeURI(n).replace(Fs.percentDecode,"%")}catch{return null}return n}function eb(n,l){var u;let i=n.replace(Fs.findPipe,(m,p,g)=>{let _=!1,b=p;for(;--b>=0&&g[b]==="\\";)_=!_;return _?"|":" |"}),r=i.split(Fs.splitPipe),o=0;if(r[0].trim()||r.shift(),r.length>0&&!((u=r.at(-1))!=null&&u.trim())&&r.pop(),l)if(r.length>l)r.splice(l);else for(;r.length<l;)r.push("");for(;o<r.length;o++)r[o]=r[o].trim().replace(Fs.slashPipe,"|");return r}function Gr(n,l,i){let r=n.length;if(r===0)return"";let o=0;for(;o<r&&n.charAt(r-o-1)===l;)o++;return n.slice(0,r-o)}function tb(n){let l=n.split(`
53
+ `),i=l.length-1;for(;i>=0&&Fs.blankLine.test(l[i]);)i--;return l.length-i<=2?n:l.slice(0,i+1).join(`
54
+ `)}function aN(n,l){if(n.indexOf(l[1])===-1)return-1;let i=0;for(let r=0;r<n.length;r++)if(n[r]==="\\")r++;else if(n[r]===l[0])i++;else if(n[r]===l[1]&&(i--,i<0))return r;return i>0?-2:-1}function iN(n,l=0){let i=l,r="";for(let o of n)if(o===" "){let u=4-i%4;r+=" ".repeat(u),i+=u}else r+=o,i++;return r}function nb(n,l,i,r,o){let u=l.href,m=l.title||null,p=n[1].replace(o.other.outputLinkReplace,"$1");r.state.inLink=!0;let g={type:n[0].charAt(0)==="!"?"image":"link",raw:i,href:u,title:m,text:p,tokens:r.inlineTokens(p)};return r.state.inLink=!1,g}function rN(n,l,i){let r=n.match(i.other.indentCodeCompensation);if(r===null)return l;let o=r[1];return l.split(`
55
+ `).map(u=>{let m=u.match(i.other.beginningSpace);if(m===null)return u;let[p]=m;return p.length>=o.length?u.slice(o.length):u}).join(`
56
+ `)}var Ih=class{constructor(n){nn(this,"options");nn(this,"rules");nn(this,"lexer");this.options=n||to}space(n){let l=this.rules.block.newline.exec(n);if(l&&l[0].length>0)return{type:"space",raw:l[0]}}code(n){let l=this.rules.block.code.exec(n);if(l){let i=this.options.pedantic?l[0]:tb(l[0]),r=i.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:i,codeBlockStyle:"indented",text:r}}}fences(n){let l=this.rules.block.fences.exec(n);if(l){let i=l[0],r=rN(i,l[3]||"",this.rules);return{type:"code",raw:i,lang:l[2]?l[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):l[2],text:r}}}heading(n){let l=this.rules.block.heading.exec(n);if(l){let i=l[2].trim();if(this.rules.other.endingHash.test(i)){let r=Gr(i,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(i=r.trim())}return{type:"heading",raw:Gr(l[0],`
57
+ `),depth:l[1].length,text:i,tokens:this.lexer.inline(i)}}}hr(n){let l=this.rules.block.hr.exec(n);if(l)return{type:"hr",raw:Gr(l[0],`
58
+ `)}}blockquote(n){let l=this.rules.block.blockquote.exec(n);if(l){let i=Gr(l[0],`
59
+ `).split(`
60
+ `),r="",o="",u=[];for(;i.length>0;){let m=!1,p=[],g;for(g=0;g<i.length;g++)if(this.rules.other.blockquoteStart.test(i[g]))p.push(i[g]),m=!0;else if(!m)p.push(i[g]);else break;i=i.slice(g);let _=p.join(`
61
+ `),b=_.replace(this.rules.other.blockquoteSetextReplace,`
62
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
63
+ ${_}`:_,o=o?`${o}
64
+ ${b}`:b;let j=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(b,u,!0),this.lexer.state.top=j,i.length===0)break;let v=u.at(-1);if((v==null?void 0:v.type)==="code")break;if((v==null?void 0:v.type)==="blockquote"){let k=v,N=k.raw+`
65
+ `+i.join(`
66
+ `),E=this.blockquote(N);u[u.length-1]=E,r=r.substring(0,r.length-k.raw.length)+E.raw,o=o.substring(0,o.length-k.text.length)+E.text;break}else if((v==null?void 0:v.type)==="list"){let k=v,N=k.raw+`
67
+ `+i.join(`
68
+ `),E=this.list(N);u[u.length-1]=E,r=r.substring(0,r.length-v.raw.length)+E.raw,o=o.substring(0,o.length-k.raw.length)+E.raw,i=N.substring(u.at(-1).raw.length).split(`
69
+ `);continue}}return{type:"blockquote",raw:r,tokens:u,text:o}}}list(n){let l=this.rules.block.list.exec(n);if(l){let i=l[1].trim(),r=i.length>1,o={type:"list",raw:"",ordered:r,start:r?+i.slice(0,-1):"",loose:!1,items:[]};i=r?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=r?i:"[*+-]");let u=this.rules.other.listItemRegex(i),m=!1;for(;n;){let g=!1,_="",b="";if(!(l=u.exec(n))||this.rules.block.hr.test(n))break;_=l[0],n=n.substring(_.length);let j=iN(l[2].split(`
70
+ `,1)[0],l[1].length),v=n.split(`
71
+ `,1)[0],k=!j.trim(),N=0;if(this.options.pedantic?(N=2,b=j.trimStart()):k?N=l[1].length+1:(N=j.search(this.rules.other.nonSpaceChar),N=N>4?1:N,b=j.slice(N),N+=l[1].length),k&&this.rules.other.blankLine.test(v)&&(_+=v+`
72
+ `,n=n.substring(v.length+1),g=!0),!g){let E=this.rules.other.nextBulletRegex(N),C=this.rules.other.hrRegex(N),I=this.rules.other.fencesBeginRegex(N),D=this.rules.other.headingBeginRegex(N),G=this.rules.other.htmlBeginRegex(N),P=this.rules.other.blockquoteBeginRegex(N);for(;n;){let V=n.split(`
73
+ `,1)[0],z;if(v=V,this.options.pedantic?(v=v.replace(this.rules.other.listReplaceNesting," "),z=v):z=v.replace(this.rules.other.tabCharGlobal," "),I.test(v)||D.test(v)||G.test(v)||P.test(v)||E.test(v)||C.test(v))break;if(z.search(this.rules.other.nonSpaceChar)>=N||!v.trim())b+=`
74
+ `+z.slice(N);else{if(k||j.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||I.test(j)||D.test(j)||C.test(j))break;b+=`
75
+ `+v}k=!v.trim(),_+=V+`
76
+ `,n=n.substring(V.length+1),j=z.slice(N)}}o.loose||(m?o.loose=!0:this.rules.other.doubleBlankLine.test(_)&&(m=!0)),o.items.push({type:"list_item",raw:_,task:!!this.options.gfm&&this.rules.other.listIsTask.test(b),loose:!1,text:b,tokens:[]}),o.raw+=_}let p=o.items.at(-1);if(p)p.raw=p.raw.trimEnd(),p.text=p.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let g of o.items){this.lexer.state.top=!1,g.tokens=this.lexer.blockTokens(g.text,[]);let _=g.tokens[0];if(g.task&&((_==null?void 0:_.type)==="text"||(_==null?void 0:_.type)==="paragraph")){g.text=g.text.replace(this.rules.other.listReplaceTask,""),_.raw=_.raw.replace(this.rules.other.listReplaceTask,""),_.text=_.text.replace(this.rules.other.listReplaceTask,"");for(let j=this.lexer.inlineQueue.length-1;j>=0;j--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[j].src)){this.lexer.inlineQueue[j].src=this.lexer.inlineQueue[j].src.replace(this.rules.other.listReplaceTask,"");break}let b=this.rules.other.listTaskCheckbox.exec(g.raw);if(b){let j={type:"checkbox",raw:b[0]+" ",checked:b[0]!=="[ ]"};g.checked=j.checked,o.loose?g.tokens[0]&&["paragraph","text"].includes(g.tokens[0].type)&&"tokens"in g.tokens[0]&&g.tokens[0].tokens?(g.tokens[0].raw=j.raw+g.tokens[0].raw,g.tokens[0].text=j.raw+g.tokens[0].text,g.tokens[0].tokens.unshift(j)):g.tokens.unshift({type:"paragraph",raw:j.raw,text:j.raw,tokens:[j]}):g.tokens.unshift(j)}}else g.task&&(g.task=!1);if(!o.loose){let b=g.tokens.filter(v=>v.type==="space"),j=b.length>0&&b.some(v=>this.rules.other.anyLine.test(v.raw));o.loose=j}}if(o.loose)for(let g of o.items){g.loose=!0;for(let _ of g.tokens)_.type==="text"&&(_.type="paragraph")}return o}}html(n){let l=this.rules.block.html.exec(n);if(l){let i=tb(l[0]);return{type:"html",block:!0,raw:i,pre:l[1]==="pre"||l[1]==="script"||l[1]==="style",text:i}}}def(n){let l=this.rules.block.def.exec(n);if(l){let i=l[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=l[2]?l[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=l[3]?l[3].substring(1,l[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):l[3];return{type:"def",tag:i,raw:Gr(l[0],`
77
+ `),href:r,title:o}}}table(n){var m;let l=this.rules.block.table.exec(n);if(!l||!this.rules.other.tableDelimiter.test(l[2]))return;let i=eb(l[1]),r=l[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=(m=l[3])!=null&&m.trim()?l[3].replace(this.rules.other.tableRowBlankLine,"").split(`
78
+ `):[],u={type:"table",raw:Gr(l[0],`
79
+ `),header:[],align:[],rows:[]};if(i.length===r.length){for(let p of r)this.rules.other.tableAlignRight.test(p)?u.align.push("right"):this.rules.other.tableAlignCenter.test(p)?u.align.push("center"):this.rules.other.tableAlignLeft.test(p)?u.align.push("left"):u.align.push(null);for(let p=0;p<i.length;p++)u.header.push({text:i[p],tokens:this.lexer.inline(i[p]),header:!0,align:u.align[p]});for(let p of o)u.rows.push(eb(p,u.header.length).map((g,_)=>({text:g,tokens:this.lexer.inline(g),header:!1,align:u.align[_]})));return u}}lheading(n){let l=this.rules.block.lheading.exec(n);if(l){let i=l[1].trim();return{type:"heading",raw:Gr(l[0],`
80
+ `),depth:l[2].charAt(0)==="="?1:2,text:i,tokens:this.lexer.inline(i)}}}paragraph(n){let l=this.rules.block.paragraph.exec(n);if(l){let i=l[1].charAt(l[1].length-1)===`
81
+ `?l[1].slice(0,-1):l[1];return{type:"paragraph",raw:l[0],text:i,tokens:this.lexer.inline(i)}}}text(n){let l=this.rules.block.text.exec(n);if(l)return{type:"text",raw:l[0],text:l[0],tokens:this.lexer.inline(l[0])}}escape(n){let l=this.rules.inline.escape.exec(n);if(l)return{type:"escape",raw:l[0],text:l[1]}}tag(n){let l=this.rules.inline.tag.exec(n);if(l)return!this.lexer.state.inLink&&this.rules.other.startATag.test(l[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(l[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(l[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(l[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:l[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:l[0]}}link(n){let l=this.rules.inline.link.exec(n);if(l){let i=l[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(i)){if(!this.rules.other.endAngleBracket.test(i))return;let u=Gr(i.slice(0,-1),"\\");if((i.length-u.length)%2===0)return}else{let u=aN(l[2],"()");if(u===-2)return;if(u>-1){let m=(l[0].indexOf("!")===0?5:4)+l[1].length+u;l[2]=l[2].substring(0,u),l[0]=l[0].substring(0,m).trim(),l[3]=""}}let r=l[2],o="";if(this.options.pedantic){let u=this.rules.other.pedanticHrefTitle.exec(r);u&&(r=u[1],o=u[3])}else o=l[3]?l[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(i)?r=r.slice(1):r=r.slice(1,-1)),nb(l,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},l[0],this.lexer,this.rules)}}reflink(n,l){let i;if((i=this.rules.inline.reflink.exec(n))||(i=this.rules.inline.nolink.exec(n))){let r=(i[2]||i[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=l[r.toLowerCase()];if(!o){let u=i[0].charAt(0);return{type:"text",raw:u,text:u}}return nb(i,o,i[0],this.lexer,this.rules)}}emStrong(n,l,i=""){let r=this.rules.inline.emStrongLDelim.exec(n);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&i.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!i||this.rules.inline.punctuation.exec(i))){let o=[...r[0]].length-1,u,m,p=o,g=0,_=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(_.lastIndex=0,l=l.slice(-1*n.length+o);(r=_.exec(l))!==null;){if(u=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!u)continue;if(m=[...u].length,r[3]||r[4]){p+=m;continue}else if((r[5]||r[6])&&o%3&&!((o+m)%3)){g+=m;continue}if(p-=m,p>0)continue;m=Math.min(m,m+p+g);let b=[...r[0]][0].length,j=n.slice(0,o+r.index+b+m);if(Math.min(o,m)%2){let k=j.slice(1,-1);return{type:"em",raw:j,text:k,tokens:this.lexer.inlineTokens(k)}}let v=j.slice(2,-2);return{type:"strong",raw:j,text:v,tokens:this.lexer.inlineTokens(v)}}}}codespan(n){let l=this.rules.inline.code.exec(n);if(l){let i=l[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(i),o=this.rules.other.startingSpaceChar.test(i)&&this.rules.other.endingSpaceChar.test(i);return r&&o&&(i=i.substring(1,i.length-1)),{type:"codespan",raw:l[0],text:i}}}br(n){let l=this.rules.inline.br.exec(n);if(l)return{type:"br",raw:l[0]}}del(n,l,i=""){let r=this.rules.inline.delLDelim.exec(n);if(r&&(!r[1]||!i||this.rules.inline.punctuation.exec(i))){let o=[...r[0]].length-1,u,m,p=o,g=this.rules.inline.delRDelim;for(g.lastIndex=0,l=l.slice(-1*n.length+o);(r=g.exec(l))!==null;){if(u=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!u||(m=[...u].length,m!==o))continue;if(r[3]||r[4]){p+=m;continue}if(p-=m,p>0)continue;m=Math.min(m,m+p);let _=[...r[0]][0].length,b=n.slice(0,o+r.index+_+m),j=b.slice(o,-o);return{type:"del",raw:b,text:j,tokens:this.lexer.inlineTokens(j)}}}}autolink(n){let l=this.rules.inline.autolink.exec(n);if(l){let i,r;return l[2]==="@"?(i=l[1],r="mailto:"+i):(i=l[1],r=i),{type:"link",raw:l[0],text:i,href:r,tokens:[{type:"text",raw:i,text:i}]}}}url(n){var i;let l;if(l=this.rules.inline.url.exec(n)){let r,o;if(l[2]==="@")r=l[0],o="mailto:"+r;else{let u;do u=l[0],l[0]=((i=this.rules.inline._backpedal.exec(l[0]))==null?void 0:i[0])??"";while(u!==l[0]);r=l[0],l[1]==="www."?o="http://"+l[0]:o=l[0]}return{type:"link",raw:l[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(n){let l=this.rules.inline.text.exec(n);if(l){let i=this.lexer.state.inRawBlock;return{type:"text",raw:l[0],text:l[0],escaped:i}}}},Ma=class Jp{constructor(l){nn(this,"tokens");nn(this,"options");nn(this,"state");nn(this,"inlineQueue");nn(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=l||to,this.options.tokenizer=this.options.tokenizer||new Ih,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let i={other:Fs,block:ih.normal,inline:xd.normal};this.options.pedantic?(i.block=ih.pedantic,i.inline=xd.pedantic):this.options.gfm&&(i.block=ih.gfm,this.options.breaks?i.inline=xd.breaks:i.inline=xd.gfm),this.tokenizer.rules=i}static get rules(){return{block:ih,inline:xd}}static lex(l,i){return new Jp(i).lex(l)}static lexInline(l,i){return new Jp(i).inlineTokens(l)}lex(l){l=l.replace(Fs.carriageReturn,`
82
+ `),this.blockTokens(l,this.tokens);for(let i=0;i<this.inlineQueue.length;i++){let r=this.inlineQueue[i];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(l,i=[],r=!1){var u,m,p;this.tokenizer.lexer=this,this.options.pedantic&&(l=l.replace(Fs.tabCharGlobal," ").replace(Fs.spaceLine,""));let o=1/0;for(;l;){if(l.length<o)o=l.length;else{this.infiniteLoopError(l.charCodeAt(0));break}let g;if((m=(u=this.options.extensions)==null?void 0:u.block)!=null&&m.some(b=>(g=b.call({lexer:this},l,i))?(l=l.substring(g.raw.length),i.push(g),!0):!1))continue;if(g=this.tokenizer.space(l)){l=l.substring(g.raw.length);let b=i.at(-1);g.raw.length===1&&b!==void 0?b.raw+=`
83
+ `:i.push(g);continue}if(g=this.tokenizer.code(l)){l=l.substring(g.raw.length);let b=i.at(-1);(b==null?void 0:b.type)==="paragraph"||(b==null?void 0:b.type)==="text"?(b.raw+=(b.raw.endsWith(`
84
+ `)?"":`
85
+ `)+g.raw,b.text+=`
86
+ `+g.text,this.inlineQueue.at(-1).src=b.text):i.push(g);continue}if(g=this.tokenizer.fences(l)){l=l.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.heading(l)){l=l.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.hr(l)){l=l.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.blockquote(l)){l=l.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.list(l)){l=l.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.html(l)){l=l.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.def(l)){l=l.substring(g.raw.length);let b=i.at(-1);(b==null?void 0:b.type)==="paragraph"||(b==null?void 0:b.type)==="text"?(b.raw+=(b.raw.endsWith(`
87
+ `)?"":`
88
+ `)+g.raw,b.text+=`
89
+ `+g.raw,this.inlineQueue.at(-1).src=b.text):this.tokens.links[g.tag]||(this.tokens.links[g.tag]={href:g.href,title:g.title},i.push(g));continue}if(g=this.tokenizer.table(l)){l=l.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.lheading(l)){l=l.substring(g.raw.length),i.push(g);continue}let _=l;if((p=this.options.extensions)!=null&&p.startBlock){let b=1/0,j=l.slice(1),v;this.options.extensions.startBlock.forEach(k=>{v=k.call({lexer:this},j),typeof v=="number"&&v>=0&&(b=Math.min(b,v))}),b<1/0&&b>=0&&(_=l.substring(0,b+1))}if(this.state.top&&(g=this.tokenizer.paragraph(_))){let b=i.at(-1);r&&(b==null?void 0:b.type)==="paragraph"?(b.raw+=(b.raw.endsWith(`
90
+ `)?"":`
91
+ `)+g.raw,b.text+=`
92
+ `+g.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=b.text):i.push(g),r=_.length!==l.length,l=l.substring(g.raw.length);continue}if(g=this.tokenizer.text(l)){l=l.substring(g.raw.length);let b=i.at(-1);(b==null?void 0:b.type)==="text"?(b.raw+=(b.raw.endsWith(`
93
+ `)?"":`
94
+ `)+g.raw,b.text+=`
95
+ `+g.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=b.text):i.push(g);continue}if(l){this.infiniteLoopError(l.charCodeAt(0));break}}return this.state.top=!0,i}inline(l,i=[]){return this.inlineQueue.push({src:l,tokens:i}),i}inlineTokens(l,i=[]){var p,g,_,b,j;this.tokenizer.lexer=this;let r=l;if(this.tokens.links){let v=Object.keys(this.tokens.links);v.length>0&&(r=r.replace(this.tokenizer.rules.inline.reflinkSearch,k=>v.includes(k.slice(k.lastIndexOf("[")+1,-1))?"["+"a".repeat(k.length-2)+"]":k))}r=r.replace(this.tokenizer.rules.inline.anyPunctuation,"++"),r=r.replace(this.tokenizer.rules.inline.blockSkip,(v,k,N)=>{let E=N?N.length:0;return v.slice(0,E)+"["+"a".repeat(v.length-E-2)+"]"}),r=((g=(p=this.options.hooks)==null?void 0:p.emStrongMask)==null?void 0:g.call({lexer:this},r))??r;let o=!1,u="",m=1/0;for(;l;){if(l.length<m)m=l.length;else{this.infiniteLoopError(l.charCodeAt(0));break}o||(u=""),o=!1;let v;if((b=(_=this.options.extensions)==null?void 0:_.inline)!=null&&b.some(N=>(v=N.call({lexer:this},l,i))?(l=l.substring(v.raw.length),i.push(v),!0):!1))continue;if(v=this.tokenizer.escape(l)){l=l.substring(v.raw.length),i.push(v);continue}if(v=this.tokenizer.tag(l)){l=l.substring(v.raw.length),i.push(v);continue}if(v=this.tokenizer.link(l)){l=l.substring(v.raw.length),i.push(v);continue}if(v=this.tokenizer.reflink(l,this.tokens.links)){l=l.substring(v.raw.length);let N=i.at(-1);v.type==="text"&&(N==null?void 0:N.type)==="text"?(N.raw+=v.raw,N.text+=v.text):i.push(v);continue}if(v=this.tokenizer.emStrong(l,r,u)){l=l.substring(v.raw.length),i.push(v);continue}if(v=this.tokenizer.codespan(l)){l=l.substring(v.raw.length),i.push(v);continue}if(v=this.tokenizer.br(l)){l=l.substring(v.raw.length),i.push(v);continue}if(v=this.tokenizer.del(l,r,u)){l=l.substring(v.raw.length),i.push(v);continue}if(v=this.tokenizer.autolink(l)){l=l.substring(v.raw.length),i.push(v);continue}if(!this.state.inLink&&(v=this.tokenizer.url(l))){l=l.substring(v.raw.length),i.push(v);continue}let k=l;if((j=this.options.extensions)!=null&&j.startInline){let N=1/0,E=l.slice(1),C;this.options.extensions.startInline.forEach(I=>{C=I.call({lexer:this},E),typeof C=="number"&&C>=0&&(N=Math.min(N,C))}),N<1/0&&N>=0&&(k=l.substring(0,N+1))}if(v=this.tokenizer.inlineText(k)){l=l.substring(v.raw.length),v.raw.slice(-1)!=="_"&&(u=v.raw.slice(-1)),o=!0;let N=i.at(-1);(N==null?void 0:N.type)==="text"?(N.raw+=v.raw,N.text+=v.text):i.push(v);continue}if(l){this.infiniteLoopError(l.charCodeAt(0));break}}return i}infiniteLoopError(l){let i="Infinite loop on byte: "+l;if(this.options.silent)console.error(i);else throw new Error(i)}},Uh=class{constructor(n){nn(this,"options");nn(this,"parser");this.options=n||to}space(n){return""}code({text:n,lang:l,escaped:i}){var u;let r=(u=(l||"").match(Fs.notSpaceStart))==null?void 0:u[0],o=n.replace(Fs.endingNewline,"")+`
96
+ `;return r?'<pre><code class="language-'+si(r)+'">'+(i?o:si(o,!0))+`</code></pre>
97
+ `:"<pre><code>"+(i?o:si(o,!0))+`</code></pre>
98
+ `}blockquote({tokens:n}){return`<blockquote>
99
+ ${this.parser.parse(n)}</blockquote>
100
+ `}html({text:n}){return n}def(n){return""}heading({tokens:n,depth:l}){return`<h${l}>${this.parser.parseInline(n)}</h${l}>
101
+ `}hr(n){return`<hr>
102
+ `}list(n){let l=n.ordered,i=n.start,r="";for(let m=0;m<n.items.length;m++){let p=n.items[m];r+=this.listitem(p)}let o=l?"ol":"ul",u=l&&i!==1?' start="'+i+'"':"";return"<"+o+u+`>
103
+ `+r+"</"+o+`>
104
+ `}listitem(n){return`<li>${this.parser.parse(n.tokens)}</li>
105
+ `}checkbox({checked:n}){return"<input "+(n?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:n}){return`<p>${this.parser.parseInline(n)}</p>
106
+ `}table(n){let l="",i="";for(let o=0;o<n.header.length;o++)i+=this.tablecell(n.header[o]);l+=this.tablerow({text:i});let r="";for(let o=0;o<n.rows.length;o++){let u=n.rows[o];i="";for(let m=0;m<u.length;m++)i+=this.tablecell(u[m]);r+=this.tablerow({text:i})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
107
+ <thead>
108
+ `+l+`</thead>
109
+ `+r+`</table>
110
+ `}tablerow({text:n}){return`<tr>
111
+ ${n}</tr>
112
+ `}tablecell(n){let l=this.parser.parseInline(n.tokens),i=n.header?"th":"td";return(n.align?`<${i} align="${n.align}">`:`<${i}>`)+l+`</${i}>
113
+ `}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${si(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:l,tokens:i}){let r=this.parser.parseInline(i),o=J_(n);if(o===null)return r;n=o;let u='<a href="'+n+'"';return l&&(u+=' title="'+si(l)+'"'),u+=">"+r+"</a>",u}image({href:n,title:l,text:i,tokens:r}){r&&(i=this.parser.parseInline(r,this.parser.textRenderer));let o=J_(n);if(o===null)return si(i);n=o;let u=`<img src="${n}" alt="${si(i)}"`;return l&&(u+=` title="${si(l)}"`),u+=">",u}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:si(n.text)}},Rg=class{strong({text:n}){return n}em({text:n}){return n}codespan({text:n}){return n}del({text:n}){return n}html({text:n}){return n}text({text:n}){return n}link({text:n}){return""+n}image({text:n}){return""+n}br(){return""}checkbox({raw:n}){return n}},Ra=class eg{constructor(l){nn(this,"options");nn(this,"renderer");nn(this,"textRenderer");this.options=l||to,this.options.renderer=this.options.renderer||new Uh,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Rg}static parse(l,i){return new eg(i).parse(l)}static parseInline(l,i){return new eg(i).parseInline(l)}parse(l){var r,o;this.renderer.parser=this;let i="";for(let u=0;u<l.length;u++){let m=l[u];if((o=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&o[m.type]){let g=m,_=this.options.extensions.renderers[g.type].call({parser:this},g);if(_!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(g.type)){i+=_||"";continue}}let p=m;switch(p.type){case"space":{i+=this.renderer.space(p);break}case"hr":{i+=this.renderer.hr(p);break}case"heading":{i+=this.renderer.heading(p);break}case"code":{i+=this.renderer.code(p);break}case"table":{i+=this.renderer.table(p);break}case"blockquote":{i+=this.renderer.blockquote(p);break}case"list":{i+=this.renderer.list(p);break}case"checkbox":{i+=this.renderer.checkbox(p);break}case"html":{i+=this.renderer.html(p);break}case"def":{i+=this.renderer.def(p);break}case"paragraph":{i+=this.renderer.paragraph(p);break}case"text":{i+=this.renderer.text(p);break}default:{let g='Token with "'+p.type+'" type was not found.';if(this.options.silent)return console.error(g),"";throw new Error(g)}}}return i}parseInline(l,i=this.renderer){var o,u;this.renderer.parser=this;let r="";for(let m=0;m<l.length;m++){let p=l[m];if((u=(o=this.options.extensions)==null?void 0:o.renderers)!=null&&u[p.type]){let _=this.options.extensions.renderers[p.type].call({parser:this},p);if(_!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(p.type)){r+=_||"";continue}}let g=p;switch(g.type){case"escape":{r+=i.text(g);break}case"html":{r+=i.html(g);break}case"link":{r+=i.link(g);break}case"image":{r+=i.image(g);break}case"checkbox":{r+=i.checkbox(g);break}case"strong":{r+=i.strong(g);break}case"em":{r+=i.em(g);break}case"codespan":{r+=i.codespan(g);break}case"br":{r+=i.br(g);break}case"del":{r+=i.del(g);break}case"text":{r+=i.text(g);break}default:{let _='Token with "'+g.type+'" type was not found.';if(this.options.silent)return console.error(_),"";throw new Error(_)}}}return r}},wh,wd=(wh=class{constructor(n){nn(this,"options");nn(this,"block");this.options=n||to}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(n=this.block){return n?Ma.lex:Ma.lexInline}provideParser(n=this.block){return n?Ra.parse:Ra.parseInline}},nn(wh,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),nn(wh,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),wh),cN=class{constructor(...n){nn(this,"defaults",kg());nn(this,"options",this.setOptions);nn(this,"parse",this.parseMarkdown(!0));nn(this,"parseInline",this.parseMarkdown(!1));nn(this,"Parser",Ra);nn(this,"Renderer",Uh);nn(this,"TextRenderer",Rg);nn(this,"Lexer",Ma);nn(this,"Tokenizer",Ih);nn(this,"Hooks",wd);this.use(...n)}walkTokens(n,l){var r,o;let i=[];for(let u of n)switch(i=i.concat(l.call(this,u)),u.type){case"table":{let m=u;for(let p of m.header)i=i.concat(this.walkTokens(p.tokens,l));for(let p of m.rows)for(let g of p)i=i.concat(this.walkTokens(g.tokens,l));break}case"list":{let m=u;i=i.concat(this.walkTokens(m.items,l));break}default:{let m=u;(o=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&o[m.type]?this.defaults.extensions.childTokens[m.type].forEach(p=>{let g=m[p].flat(1/0);i=i.concat(this.walkTokens(g,l))}):m.tokens&&(i=i.concat(this.walkTokens(m.tokens,l)))}}return i}use(...n){let l=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(i=>{let r={...i};if(r.async=this.defaults.async||r.async||!1,i.extensions&&(i.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){let u=l.renderers[o.name];u?l.renderers[o.name]=function(...m){let p=o.renderer.apply(this,m);return p===!1&&(p=u.apply(this,m)),p}:l.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let u=l[o.level];u?u.unshift(o.tokenizer):l[o.level]=[o.tokenizer],o.start&&(o.level==="block"?l.startBlock?l.startBlock.push(o.start):l.startBlock=[o.start]:o.level==="inline"&&(l.startInline?l.startInline.push(o.start):l.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(l.childTokens[o.name]=o.childTokens)}),r.extensions=l),i.renderer){let o=this.defaults.renderer||new Uh(this.defaults);for(let u in i.renderer){if(!(u in o))throw new Error(`renderer '${u}' does not exist`);if(["options","parser"].includes(u))continue;let m=u,p=i.renderer[m],g=o[m];o[m]=(..._)=>{let b=p.apply(o,_);return b===!1&&(b=g.apply(o,_)),b||""}}r.renderer=o}if(i.tokenizer){let o=this.defaults.tokenizer||new Ih(this.defaults);for(let u in i.tokenizer){if(!(u in o))throw new Error(`tokenizer '${u}' does not exist`);if(["options","rules","lexer"].includes(u))continue;let m=u,p=i.tokenizer[m],g=o[m];o[m]=(..._)=>{let b=p.apply(o,_);return b===!1&&(b=g.apply(o,_)),b}}r.tokenizer=o}if(i.hooks){let o=this.defaults.hooks||new wd;for(let u in i.hooks){if(!(u in o))throw new Error(`hook '${u}' does not exist`);if(["options","block"].includes(u))continue;let m=u,p=i.hooks[m],g=o[m];wd.passThroughHooks.has(u)?o[m]=_=>{if(this.defaults.async&&wd.passThroughHooksRespectAsync.has(u))return(async()=>{let j=await p.call(o,_);return g.call(o,j)})();let b=p.call(o,_);return g.call(o,b)}:o[m]=(..._)=>{if(this.defaults.async)return(async()=>{let j=await p.apply(o,_);return j===!1&&(j=await g.apply(o,_)),j})();let b=p.apply(o,_);return b===!1&&(b=g.apply(o,_)),b}}r.hooks=o}if(i.walkTokens){let o=this.defaults.walkTokens,u=i.walkTokens;r.walkTokens=function(m){let p=[];return p.push(u.call(this,m)),o&&(p=p.concat(o.call(this,m))),p}}this.defaults={...this.defaults,...r}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,l){return Ma.lex(n,l??this.defaults)}parser(n,l){return Ra.parse(n,l??this.defaults)}parseMarkdown(n){return(l,i)=>{let r={...i},o={...this.defaults,...r},u=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&r.async===!1)return u(new 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 l>"u"||l===null)return u(new Error("marked(): input parameter is undefined or null"));if(typeof l!="string")return u(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(l)+", string expected"));if(o.hooks&&(o.hooks.options=o,o.hooks.block=n),o.async)return(async()=>{let m=o.hooks?await o.hooks.preprocess(l):l,p=await(o.hooks?await o.hooks.provideLexer(n):n?Ma.lex:Ma.lexInline)(m,o),g=o.hooks?await o.hooks.processAllTokens(p):p;o.walkTokens&&await Promise.all(this.walkTokens(g,o.walkTokens));let _=await(o.hooks?await o.hooks.provideParser(n):n?Ra.parse:Ra.parseInline)(g,o);return o.hooks?await o.hooks.postprocess(_):_})().catch(u);try{o.hooks&&(l=o.hooks.preprocess(l));let m=(o.hooks?o.hooks.provideLexer(n):n?Ma.lex:Ma.lexInline)(l,o);o.hooks&&(m=o.hooks.processAllTokens(m)),o.walkTokens&&this.walkTokens(m,o.walkTokens);let p=(o.hooks?o.hooks.provideParser(n):n?Ra.parse:Ra.parseInline)(m,o);return o.hooks&&(p=o.hooks.postprocess(p)),p}catch(m){return u(m)}}}onError(n,l){return i=>{if(i.message+=`
114
+ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error occurred:</p><pre>"+si(i.message+"",!0)+"</pre>";return l?Promise.resolve(r):r}if(l)return Promise.reject(i);throw i}}},eo=new cN;function Bt(n,l){return eo.parse(n,l)}Bt.options=Bt.setOptions=function(n){return eo.setOptions(n),Bt.defaults=eo.defaults,s0(Bt.defaults),Bt};Bt.getDefaults=kg;Bt.defaults=to;Bt.use=function(...n){return eo.use(...n),Bt.defaults=eo.defaults,s0(Bt.defaults),Bt};Bt.walkTokens=function(n,l){return eo.walkTokens(n,l)};Bt.parseInline=eo.parseInline;Bt.Parser=Ra;Bt.parser=Ra.parse;Bt.Renderer=Uh;Bt.TextRenderer=Rg;Bt.Lexer=Ma;Bt.lexer=Ma.lex;Bt.Tokenizer=Ih;Bt.Hooks=wd;Bt.parse=Bt;Bt.options;Bt.setOptions;Bt.use;Bt.walkTokens;Bt.parseInline;Ra.parse;Ma.lex;/*! @license DOMPurify 3.4.17 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.17/LICENSE */function sb(n,l){(l==null||l>n.length)&&(l=n.length);for(var i=0,r=Array(l);i<l;i++)r[i]=n[i];return r}function oN(n){if(Array.isArray(n))return n}function uN(n,l){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var r,o,u,m,p=[],g=!0,_=!1;try{if(u=(i=i.call(n)).next,l!==0)for(;!(g=(r=u.call(i)).done)&&(p.push(r.value),p.length!==l);g=!0);}catch(b){_=!0,o=b}finally{try{if(!g&&i.return!=null&&(m=i.return(),Object(m)!==m))return}finally{if(_)throw o}}return p}}function dN(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
115
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */function fN(n,l){return oN(n)||uN(n,l)||hN(n,l)||dN()}function hN(n,l){if(n){if(typeof n=="string")return sb(n,l);var i={}.toString.call(n).slice(8,-1);return i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set"?Array.from(n):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?sb(n,l):void 0}}const h0=Object.entries,lb=Object.setPrototypeOf,mN=Object.isFrozen,m0=Object.getPrototypeOf,p0=Object.getOwnPropertyDescriptor;let Ss=Object.freeze,Os=Object.seal,eu=Object.create,g0=typeof Reflect<"u"&&Reflect,tg=g0.apply,ng=g0.construct;Ss||(Ss=function(l){return l});Os||(Os=function(l){return l});tg||(tg=function(l,i){for(var r=arguments.length,o=new Array(r>2?r-2:0),u=2;u<r;u++)o[u-2]=arguments[u];return l.apply(i,o)});ng||(ng=function(l){for(var i=arguments.length,r=new Array(i>1?i-1:0),o=1;o<i;o++)r[o-1]=arguments[o];return new l(...r)});const Xi=An(Array.prototype.forEach),pN=An(Array.prototype.lastIndexOf),ab=An(Array.prototype.pop),_d=An(Array.prototype.push),gN=An(Array.prototype.slice),xN=An(Array.prototype.splice),au=Array.isArray,Ep=x0(Set),Cp=An(Set.prototype.add),bd=An(Set.prototype.has),qc=An(String.prototype.toLowerCase),Tp=An(String.prototype.toString),ib=An(String.prototype.match),yd=An(String.prototype.replace),rb=An(String.prototype.indexOf),_N=An(String.prototype.trim),bN=An(Number.prototype.toString),yN=An(Boolean.prototype.toString),cb=typeof BigInt>"u"?null:An(BigInt.prototype.toString),ob=typeof Symbol>"u"?null:An(Symbol.prototype.toString),kl=An(Object.prototype.hasOwnProperty),vd=An(Object.prototype.toString),Ls=An(RegExp.prototype.test),Fi=x0(TypeError);function An(n){return function(l){l instanceof RegExp&&(l.lastIndex=0);for(var i=arguments.length,r=new Array(i>1?i-1:0),o=1;o<i;o++)r[o-1]=arguments[o];return tg(n,l,r)}}function x0(n){return function(){for(var l=arguments.length,i=new Array(l),r=0;r<l;r++)i[r]=arguments[r];return ng(n,i)}}function Ct(n,l){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:qc;if(lb&&lb(n,null),!au(l))return n;let r=l.length;for(;r--;){let o=l[r];if(typeof o=="string"){const u=i(o);u!==o&&(mN(l)||(l[r]=u),o=u)}n[o]=!0}return n}function vN(n){for(let l=0;l<n.length;l++)kl(n,l)||(n[l]=null);return n}function $l(n){const l=eu(null);for(const r of h0(n)){var i=fN(r,2);const o=i[0],u=i[1];kl(n,o)&&(au(u)?l[o]=vN(u):u&&typeof u=="object"&&u.constructor===Object?l[o]=$l(u):l[o]=u)}return l}function jN(n){switch(typeof n){case"string":return n;case"number":return bN(n);case"boolean":return yN(n);case"bigint":return cb?cb(n):"0";case"symbol":return ob?ob(n):"Symbol()";case"undefined":return vd(n);case"function":case"object":{if(n===null)return vd(n);const l=n,i=ia(l,"toString");if(typeof i=="function"){const r=i(l);return typeof r=="string"?r:vd(r)}return vd(n)}default:return vd(n)}}function ia(n,l){for(;n!==null;){const r=p0(n,l);if(r){if(r.get)return An(r.get);if(typeof r.value=="function")return An(r.value)}n=m0(n)}function i(){return null}return i}function NN(n,l){for(;n!==null;){const i=p0(n,l);if(i)return i.get?An(i.get):null;n=m0(n)}return null}function kN(n){try{return Ls(n,""),!0}catch{return!1}}const ub=Ss(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Ap=Ss(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Mp=Ss(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),wN=Ss(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Rp=Ss(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),SN=Ss(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),db=Ss(["#text"]),fb=Ss(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Dp=Ss(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),hb=Ss(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),rh=Ss(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),EN=Os(/{{[\w\W]*|^[\w\W]*}}/g),CN=Os(/<%[\w\W]*|^[\w\W]*%>/g),TN=Os(/\${[\w\W]*/g),AN=Os(/^data-[\-\w.\u00B7-\uFFFF]+$/),MN=Os(/^aria-[\-\w]+$/),mb=Os(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),RN=Os(/^(?:\w+script|data):/i),DN=Os(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),LN=Os(/^html$/i),ON=Os(/^[a-z][.\w]*(-[.\w]+)+$/i),Lp=Os(/<[/\w!]/g),pb=Os(/<[/\w]/g),zN=Os(/<\/no(script|embed|frames)/i),gb=Os(/\/>/i),ds={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},IN=Ss(Ct({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),UN=function(){return typeof window>"u"?null:window},$N=function(l,i){if(typeof l!="object"||typeof l.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";i&&i.hasAttribute(o)&&(r=i.getAttribute(o));const u="dompurify"+(r?"#"+r:"");try{return l.createPolicy(u,{createHTML(m){return m},createScriptURL(m){return m}})}catch{return console.warn("TrustedTypes policy "+u+" could not be created."),null}},xb=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Yr=function(l,i,r,o){return kl(l,i)&&au(l[i])?Ct(o.base?$l(o.base):{},l[i],o.transform):r},Op=function(l,i,r){const o=kl(l,i)?l[i]:void 0;return o&&typeof o=="object"?$l(o):r()};function _0(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:UN();const l=be=>_0(be);if(l.version="3.4.17",l.removed=[],!n||!n.document||n.document.nodeType!==ds.document||!n.Element)return l.isSupported=!1,l;let i=n.document;const r=i,o=r.currentScript;n.DocumentFragment;const u=n.HTMLTemplateElement,m=n.Node,p=n.Element,g=n.NodeFilter;n.NamedNodeMap===void 0&&(n.NamedNodeMap||n.MozNamedAttrMap),n.HTMLFormElement;const _=n.DOMParser,b=n.trustedTypes,j=p.prototype,v=ia(j,"cloneNode"),k=ia(j,"remove"),N=ia(j,"removeAttributeNode"),E=ia(j,"nextSibling"),C=ia(j,"childNodes"),I=ia(j,"parentNode"),D=ia(j,"shadowRoot"),G=ia(j,"attributes"),P=m&&m.prototype?ia(m.prototype,"nodeType"):null,V=m&&m.prototype?ia(m.prototype,"nodeName"):null,z=m&&m.prototype?ia(m.prototype,"ownerDocument"):null,H=function(S){return P?P(S):S.nodeType},te=function(S){return V?V(S):S.nodeName},F=NN(j,"namespaceURI"),fe=function(S){return F?F(S):S.namespaceURI};if(typeof u=="function"){const be=i.createElement("template");be.content&&be.content.ownerDocument&&(i=be.content.ownerDocument)}let Q,X="",ge,U=!1,L=0;const M=function(){if(L>0)throw Fi('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},O=function(S){M(),L++;try{return Q.createHTML(S)}finally{L--}},J=function(S){M(),L++;try{return Q.createScriptURL(S)}finally{L--}},le=function(){return U||(ge=$N(b,o),U=!0),ge},ce=i,A=ce.implementation,W=ce.createNodeIterator,me=ce.createDocumentFragment,Ee=ce.getElementsByTagName,$=r.importNode;let de=xb();l.isSupported=typeof h0=="function"&&typeof I=="function"&&A&&A.createHTMLDocument!==void 0;const ae=EN,qe=CN,Se=TN,Ge=AN,Ve=MN,Je=RN,Ft=DN,dt=ON;let jn=mb,Ze=null;const js=Ct({},[...ub,...Ap,...Mp,...Rp,...db]);let lt=null;const mt=Ct({},[...fb,...Dp,...hb,...rh]);let Me=Object.seal(eu(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),nt=null,In=null;const kt=Object.seal(eu(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ut=!0,Un=!0,$n=!1,Gt=!0,it=!1,vt=!0,Kt=!1,es=!1,fs=null,Tt=null,Lt=!1,fn=!1,Qt=!1,zs=!1,_e=!0,Ae=!1;const Pe="user-content-";let et=!0,Qe=!1,Ot=null,Zt={},Kn=null;const Sl=Ct({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Bn=null;const Et=Ct({},["audio","video","img","source","image","track"]);let _t=null;const Is=Ct({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Qn="http://www.w3.org/1998/Math/MathML",Es="http://www.w3.org/2000/svg",Mn="http://www.w3.org/1999/xhtml";let hs=Mn,ms=!1,Zn=null;const Qs=Ct({},[Qn,Es,Mn],Tp),hn=Ss(["mi","mo","mn","ms","mtext"]);let wt=Ct({},hn);const At=Ss(["annotation-xml"]);let cn=Ct({},At);const ps=Ct({},["title","style","font","a","script"]);let Rn=null;const ua=["application/xhtml+xml","text/html"],Us="text/html";let B=null,xe=null;const Re=i.createElement("form"),Ke=function(S){return S instanceof RegExp||S instanceof Function},ht=function(){let S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(xe&&xe===S)return;(!S||typeof S!="object")&&(S={}),S=$l(S),Rn=ua.indexOf(S.PARSER_MEDIA_TYPE)===-1?Us:S.PARSER_MEDIA_TYPE,B=Rn==="application/xhtml+xml"?Tp:qc,Ze=Yr(S,"ALLOWED_TAGS",js,{transform:B}),lt=Yr(S,"ALLOWED_ATTR",mt,{transform:B}),Zn=Yr(S,"ALLOWED_NAMESPACES",Qs,{transform:Tp}),_t=Yr(S,"ADD_URI_SAFE_ATTR",Is,{transform:B,base:Is}),Bn=Yr(S,"ADD_DATA_URI_TAGS",Et,{transform:B,base:Et}),Kn=Yr(S,"FORBID_CONTENTS",Sl,{transform:B}),nt=Yr(S,"FORBID_TAGS",$l({}),{transform:B}),In=Yr(S,"FORBID_ATTR",$l({}),{transform:B}),Zt=kl(S,"USE_PROFILES")?S.USE_PROFILES&&typeof S.USE_PROFILES=="object"?$l(S.USE_PROFILES):S.USE_PROFILES:!1,ut=S.ALLOW_ARIA_ATTR!==!1,Un=S.ALLOW_DATA_ATTR!==!1,$n=S.ALLOW_UNKNOWN_PROTOCOLS||!1,Gt=S.ALLOW_SELF_CLOSE_IN_ATTR!==!1,it=S.SAFE_FOR_TEMPLATES||!1,vt=S.SAFE_FOR_XML!==!1,Kt=S.WHOLE_DOCUMENT||!1,fn=S.RETURN_DOM||!1,Qt=S.RETURN_DOM_FRAGMENT||!1,zs=S.RETURN_TRUSTED_TYPE||!1,Lt=S.FORCE_BODY||!1,_e=S.SANITIZE_DOM!==!1,Ae=S.SANITIZE_NAMED_PROPS||!1,et=S.KEEP_CONTENT!==!1,Qe=S.IN_PLACE||!1,jn=kN(S.ALLOWED_URI_REGEXP)?S.ALLOWED_URI_REGEXP:mb,hs=typeof S.NAMESPACE=="string"?S.NAMESPACE:Mn,wt=Op(S,"MATHML_TEXT_INTEGRATION_POINTS",()=>Ct({},hn)),cn=Op(S,"HTML_INTEGRATION_POINTS",()=>Ct({},At));const K=Op(S,"CUSTOM_ELEMENT_HANDLING",()=>eu(null));if(Me=eu(null),kl(K,"tagNameCheck")&&Ke(K.tagNameCheck)&&(Me.tagNameCheck=K.tagNameCheck),kl(K,"attributeNameCheck")&&Ke(K.attributeNameCheck)&&(Me.attributeNameCheck=K.attributeNameCheck),kl(K,"allowCustomizedBuiltInElements")&&typeof K.allowCustomizedBuiltInElements=="boolean"&&(Me.allowCustomizedBuiltInElements=K.allowCustomizedBuiltInElements),Os(Me),it&&(Un=!1),Qt&&(fn=!0),Zt&&(Ze=Ct({},db),lt=eu(null),Zt.html===!0&&(Ct(Ze,ub),Ct(lt,fb)),Zt.svg===!0&&(Ct(Ze,Ap),Ct(lt,Dp),Ct(lt,rh)),Zt.svgFilters===!0&&(Ct(Ze,Mp),Ct(lt,Dp),Ct(lt,rh)),Zt.mathMl===!0&&(Ct(Ze,Rp),Ct(lt,hb),Ct(lt,rh))),kt.tagCheck=null,kt.attributeCheck=null,kl(S,"ADD_TAGS")&&(typeof S.ADD_TAGS=="function"?kt.tagCheck=S.ADD_TAGS:au(S.ADD_TAGS)&&(Ze===js&&(Ze=$l(Ze)),Ct(Ze,S.ADD_TAGS,B))),kl(S,"ADD_ATTR")&&(typeof S.ADD_ATTR=="function"?kt.attributeCheck=S.ADD_ATTR:au(S.ADD_ATTR)&&(lt===mt&&(lt=$l(lt)),Ct(lt,S.ADD_ATTR,B))),kl(S,"ADD_FORBID_CONTENTS")&&au(S.ADD_FORBID_CONTENTS)&&(Kn===Sl&&(Kn=$l(Kn)),Ct(Kn,S.ADD_FORBID_CONTENTS,B)),et&&(Ze["#text"]=!0),Kt&&Ct(Ze,["html","head","body"]),Ze.table&&(Ct(Ze,["tbody"]),delete nt.tbody),S.TRUSTED_TYPES_POLICY){if(typeof S.TRUSTED_TYPES_POLICY.createHTML!="function")throw Fi('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof S.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Fi('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const pe=Q;Q=S.TRUSTED_TYPES_POLICY;try{X=O("")}catch(ve){throw Q=pe,ve}}else S.TRUSTED_TYPES_POLICY===null?(Q=void 0,X=""):(Q===void 0&&(Q=le()),Q&&typeof X=="string"&&(X=O("")));Ss&&Ss(S),xe=S},on=Ct({},[...Ap,...Mp,...wN]),rt=Ct({},[...Rp,...SN]),cl=function(S,K,pe){return K.namespaceURI===Mn?S==="svg":K.namespaceURI===Qn?S==="svg"&&(pe==="annotation-xml"||wt[pe]):!!on[S]},Zs=function(S,K,pe){return K.namespaceURI===Mn?S==="math":K.namespaceURI===Es?S==="math"&&cn[pe]:!!rt[S]},ts=function(S,K,pe){return K.namespaceURI===Es&&!cn[pe]||K.namespaceURI===Qn&&!wt[pe]?!1:!rt[S]&&(ps[S]||!on[S])},Ns=function(S){const K=fe(S),pe=qc(te(S)),ve=I(S);let ze,Ye;return ve&&H(ve)===ds.element?(ze={namespaceURI:fe(ve)},Ye=qc(te(ve))):(ze={namespaceURI:hs},Ye="template"),Zn[K]?K===Es?cl(pe,ze,Ye):K===Qn?Zs(pe,ze,Ye):K===Mn?ts(pe,ze,Ye):!!(Rn==="application/xhtml+xml"&&Zn[K]):!1},Ps=function(S){_d(l.removed,{element:S});try{I(S).removeChild(S)}catch{if(k(S),!I(S))throw Fi("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Bl=function(S,K,pe){try{N(S,K)}catch{try{S.removeAttribute(pe)}catch{}}},da=function(S){mn(S);const K=C(S);K&&Xi(gN(K),ve=>{try{k(ve)}catch{}});const pe=H(S)===ds.element?G(S):null;if(pe)for(let ve=pe.length-1;ve>=0;--ve){const ze=pe[ve],Ye=ze&&ze.name;typeof Ye=="string"&&Bl(S,ze,Ye)}},Hl=function(S,K,pe){if(!pe)try{pe=K.getAttributeNode(S)}catch{pe=null}_d(l.removed,{attribute:pe||null,from:K});try{pe?N(K,pe):K.removeAttribute(S)}catch{try{K.removeAttribute(S)}catch{}}if(S==="is")if(fn||Qt)try{Ps(K)}catch{}else try{K.setAttribute(S,"")}catch{}},fa=function(S){const K=G(S);if(K)for(let pe=K.length-1;pe>=0;--pe){const ve=K[pe],ze=ve&&ve.name;typeof ze!="string"||lt[B(ze)]||Bl(S,ve,ze)}},El=function(S,K){let pe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const ve=[S];for(;ve.length>0;){const ze=ve.pop();if(K(ze)===!1)continue;if(pe&&H(ze)===ds.element){const at=D(ze);ks(at)&&ve.push(at)}const Ye=C(ze);if(Ye)for(let at=Ye.length-1;at>=0;--at)ve.push(Ye[at])}},mn=function(S){El(S,K=>{H(K)===ds.element&&fa(K)})},pn=function(S){const K=[];return El(S,pe=>{K.push(pe)},!0),K},ql=function(S,K){const pe=Ep();Xi(pn(S),ve=>{H(ve)===ds.element&&Cp(pe,ve)}),Xi(K,ve=>{H(ve)===ds.element&&!bd(pe,ve)&&fa(ve)})},ol=function(S,K){let pe=!1;return Xi(l.removed,ve=>{ve.element&&(pe=pe||ve.element===S,mn(ve.element))}),ql(S,K),pe},ul=8,Pt=function(S,K){const pe=Ot;let ve=null;const ze=()=>(ve||(ve=Ep(),Xi(K,Ye=>{Cp(ve,Ye)})),ve);for(let Ye=0;;Ye++){const at=pn(S),gt=[S];let gn=!1;if(Xi(at,un=>{H(un)===ds.documentFragment?_d(gt,un):!gn&&!bd(pe,un)&&(gn=bd(ze(),un))}),!gn)return;if(Ye>=ul)throw Fi("the tree kept changing during in-place sanitization; refusing to return it");Xi(gt,(un,kn)=>{Gl(un,kn>0,S,ze())})}},Gl=function(S,K,pe,ve){const ze=Nn(S);let Ye;for(;Ye=ze.nextNode();)!bd(ve,Ye)||bd(Ot,Ye)||(K&&Yt(de.uponSanitizeShadowNode,Ye,null),Xl(Ye,pe),hl(Ye,pe),ks(Ye.content)&&Wn(Ye.content))},Hn=function(S){Ot&&Cp(Ot,S)},Pn=function(S,K){return vt?S==="patchsrc"?!0:S==="for"&&K!=="label"&&K!=="output":!1},Oa=function(S){vt&&El(S,K=>{const pe=H(K);if(pe===ds.processingInstruction||pe===ds.comment&&Ls(pb,K.data)){try{k(K)}catch{}return!1}if(pe===ds.element){const ve=K,ze=B(te(K));try{ve.hasAttribute&&ve.hasAttribute("patchsrc")&&ve.removeAttribute("patchsrc"),ve.hasAttribute&&ve.hasAttribute("for")&&Pn("for",ze)&&ve.removeAttribute("for")}catch{}}return!0})},Yl=function(S){let K=null,pe=null;if(Lt)S="<remove></remove>"+S;else{const Ye=ib(S,/^[\r\n\t ]+/);pe=Ye&&Ye[0]}Rn==="application/xhtml+xml"&&hs===Mn&&(S='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+S+"</body></html>");const ve=Q?O(S):S;if(hs===Mn)try{K=new _().parseFromString(ve,Rn)}catch{}if(!K||!K.documentElement){K=A.createDocument(hs,"template",null);try{K.documentElement.innerHTML=ms?X:ve}catch{}}const ze=K.body||K.documentElement;return S&&pe&&ze.insertBefore(i.createTextNode(pe),ze.childNodes[0]||null),hs===Mn?Ee.call(K,Kt?"html":"body")[0]:Kt?K.documentElement:ze},Nn=function(S){const K=z?z(S):S.ownerDocument;return W.call(K||S,S,g.SHOW_ELEMENT|g.SHOW_COMMENT|g.SHOW_TEXT|g.SHOW_PROCESSING_INSTRUCTION|g.SHOW_CDATA_SECTION,null)},qn=function(S){return S=yd(S,ae," "),S=yd(S,qe," "),S=yd(S,Se," "),S},Gn=function(S){var K;ha(S);const pe=(K=S.querySelectorAll)===null||K===void 0?void 0:K.call(S,"template");pe&&Xi(pe,ve=>{ks(ve.content)&&Gn(ve.content)})},ha=function(S){S.normalize();const K=z?z(S):S.ownerDocument,pe=W.call(K||S,S,g.SHOW_TEXT|g.SHOW_COMMENT|g.SHOW_CDATA_SECTION|g.SHOW_PROCESSING_INSTRUCTION,null);let ve=pe.nextNode();for(;ve;)ve.data=qn(ve.data),ve=pe.nextNode()},ns=function(S){const K=V?V(S):null;return typeof K!="string"||B(K)!=="form"?!1:typeof S.nodeName!="string"||typeof S.textContent!="string"||typeof S.removeChild!="function"||S.attributes!==G(S)||typeof S.removeAttribute!="function"||typeof S.removeAttributeNode!="function"||typeof S.getAttributeNode!="function"||typeof S.setAttribute!="function"||typeof S.namespaceURI!="string"||typeof S.insertBefore!="function"||typeof S.hasChildNodes!="function"||S.nodeType!==P(S)||S.childNodes!==C(S)},ks=function(S){if(!P||typeof S!="object"||S===null)return!1;try{return P(S)===ds.documentFragment}catch{return!1}},$s=function(S){if(!P||typeof S!="object"||S===null)return!1;try{return typeof P(S)=="number"}catch{return!1}};function Yt(be,S,K){be.length!==0&&Xi(be,pe=>{pe.call(l,S,K,xe)})}const Bs=function(S,K){return!!(vt&&S.hasChildNodes()&&!$s(S.firstElementChild)&&Ls(Lp,S.textContent)&&Ls(Lp,S.innerHTML)||vt&&IN[K]&&H(S)===ds.element&&fe(S)===Mn&&($s(S.firstElementChild)||typeof S.textContent=="string"&&Ls(Lp,S.textContent))||S.nodeType===ds.processingInstruction||vt&&S.nodeType===ds.comment&&Ls(pb,S.data))},Vl=function(S,K){if(S instanceof RegExp)return Ls(S,K);if(S instanceof Function){for(var pe=arguments.length,ve=new Array(pe>2?pe-2:0),ze=2;ze<pe;ze++)ve[ze-2]=arguments[ze];return!!S(K,...ve)}return!1},tc=function(S,K,pe){if(!nt[K]&&fl(K)&&Vl(Me.tagNameCheck,K))return!1;if(et&&!Kn[K]&&!Kn[qc(K)]){const ve=I(S),ze=C(S);if(ze&&ve){const Ye=ze.length;for(let at=Ye-1;at>=0;--at){const gt=S===pe?v(ze[at],!0):ze[at];ve.insertBefore(gt,E(S))}}}return Ps(S),!0},Ws=function(S,K,pe,ve){return S.length===0?K:K===pe||K===ve?$l(K):K},Yn=function(S,K){return S===K||I(S)!==null?!1:(Qe&&mn(S),!0)},Xl=function(S,K){if(Hn(S),Yt(de.beforeSanitizeElements,S,null),Yn(S,K))return!0;if(ns(S))return Ps(S),!0;const pe=B(te(S));if(Ze=Ws(de.uponSanitizeElement,Ze,js,fs),Yt(de.uponSanitizeElement,S,{tagName:pe,allowedTags:Ze}),Yn(S,K))return!0;if(Bs(S,pe))return Ps(S),!0;if(nt[pe]||!(kt.tagCheck instanceof Function&&kt.tagCheck(pe))&&!Ze[pe]){const ve=tc(S,pe,K);return ve===!1&&(Yt(de.afterSanitizeElements,S,null),Yn(S,K))?!0:ve}if(H(S)===ds.element&&!Ns(S)||(pe==="noscript"||pe==="noembed"||pe==="noframes")&&Ls(zN,S.innerHTML))return Ps(S),!0;if(it&&S.nodeType===ds.text){const ve=qn(S.textContent);S.textContent!==ve&&(_d(l.removed,{element:S.cloneNode()}),S.textContent=ve)}return Yt(de.afterSanitizeElements,S,null),Yn(S,K)},Fl=function(S,K,pe){if(In[K]||Pn(K,S)||_e&&(K==="id"||K==="name")&&(pe in i||pe in Re))return!1;const ve=lt[K]||kt.attributeCheck instanceof Function&&kt.attributeCheck(K,S);return Un&&Ls(Ge,K)||ut&&Ls(Ve,K)?!0:ve?_t[K]||Ls(jn,yd(pe,Ft,""))||(K==="src"||K==="xlink:href"||K==="href")&&S!=="script"&&rb(pe,"data:")===0&&Bn[S]||$n&&!Ls(Je,yd(pe,Ft,""))?!0:!pe:fl(S)&&Vl(Me.tagNameCheck,S)&&Vl(Me.attributeNameCheck,K,S)||K==="is"&&Me.allowCustomizedBuiltInElements&&Vl(Me.tagNameCheck,pe)},dl=Ct({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),fl=function(S){return!dl[qc(S)]&&Ls(dt,S)},di=function(S,K,pe,ve){if(Q&&typeof b=="object"&&typeof b.getAttributeType=="function"&&!pe)switch(b.getAttributeType(S,K)){case"TrustedHTML":return O(ve);case"TrustedScriptURL":return J(ve)}return ve},Kl=function(S,K,pe,ve){try{return pe?S.setAttributeNS(pe,K,ve):S.setAttribute(K,ve),ns(S)?(Ps(S),!1):!0}catch{return Hl(K,S),!1}},fi=function(S,K){return vt&&Ls(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,K)?!0:qc(S)==="attributename"&&ib(K,"href")!==null},hl=function(S,K){if(Yt(de.beforeSanitizeAttributes,S,null),Yn(S,K))return;const pe=S.attributes;if(!pe||ns(S))return;lt=Ws(de.uponSanitizeAttribute,lt,mt,Tt);const ve={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:lt,forceKeepAttr:void 0};let ze=pe.length;const Ye=B(S.nodeName);for(;ze--;){const at=pe[ze],gt=at.name,gn=at.namespaceURI,un=at.value,kn=B(gt),Wt=un;let wn=gt==="value"?Wt:_N(Wt),T=!1;if(ve.attrName=kn,ve.attrValue=wn,ve.keepAttr=!0,ve.forceKeepAttr=void 0,Yt(de.uponSanitizeAttribute,S,ve),wn=ve.attrValue,Ae&&(kn==="id"||kn==="name")&&rb(wn,Pe)!==0&&(Hl(gt,S,at),wn=Pe+wn,T=!0),fi(gt,wn)){Hl(gt,S,at);continue}if(!ve.forceKeepAttr){if(!ve.keepAttr){Hl(gt,S,at);continue}if(!Gt&&Ls(gb,wn)){Hl(gt,S,at);continue}if(it&&(wn=qn(wn)),!Fl(Ye,kn,wn)){Hl(gt,S,at);continue}wn=di(Ye,kn,gn,wn),wn!==Wt&&Kl(S,gt,gn,wn)&&T&&ab(l.removed)}}Yt(de.afterSanitizeAttributes,S,null),Yn(S,K)},Wn=function(S){let K=null;const pe=Nn(S);for(Yt(de.beforeSanitizeShadowDOM,S,null);K=pe.nextNode();)if(Yt(de.uponSanitizeShadowNode,K,null),Xl(K,S),hl(K,S),ks(K.content)&&Wn(K.content),H(K)===ds.element){const ve=D(K);ks(ve)&&(Js(ve),Wn(ve))}it&&ha(S),Yt(de.afterSanitizeShadowDOM,S,null)},Js=function(S){const K=[{node:S,shadow:null}];for(;K.length>0;){const pe=K.pop();if(pe.shadow){Wn(pe.shadow);continue}const ve=pe.node,ze=H(ve)===ds.element,Ye=C(ve);if(Ye)for(let at=Ye.length-1;at>=0;--at)K.push({node:Ye[at],shadow:null});if(ze){const at=V?V(ve):null;if(typeof at=="string"&&B(at)==="template"){const gt=ve.content;ks(gt)&&K.push({node:gt,shadow:null})}}if(ze){const at=D(ve);ks(at)&&K.push({node:null,shadow:at},{node:at,shadow:null})}}};return l.sanitize=function(be){let S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},K=null,pe=null,ve=null,ze=null;if(ms=!be,ms&&(be="<!-->"),typeof be!="string"&&!$s(be)&&(be=jN(be),typeof be!="string"))throw Fi("dirty is not a string, aborting");if(!l.isSupported)return be;es?(Ze=fs,lt=Tt):ht(S),(de.uponSanitizeElement.length>0||de.uponSanitizeAttribute.length>0)&&(Ze=$l(Ze)),de.uponSanitizeAttribute.length>0&&(lt=$l(lt)),l.removed=[];const Ye=Qe&&typeof be!="string"&&$s(be);let at=[];const gt=Ot;if(Ye){Oa(be);const kn=te(be);if(typeof kn=="string"){const Wt=B(kn);if(!Ze[Wt]||nt[Wt])throw da(be),Fi("root node is forbidden and cannot be sanitized in-place")}if(ns(be))throw da(be),Fi("root node is clobbered and cannot be sanitized in-place");at=pn(be),Ot=Ep()}else if($s(be))K=Yl("<!---->"),pe=K.ownerDocument.importNode(be,!0),pe.nodeType===ds.element&&pe.nodeName==="BODY"||pe.nodeName==="HTML"?K=pe:K.appendChild(pe),Js(K);else{if(!fn&&!it&&!Kt&&be.indexOf("<")===-1)return Q&&zs?O(be):be;if(K=Yl(be),!K)return fn?null:zs?X:""}K&&Lt&&Ps(K.firstChild);const gn=Ye?be:K;try{Ye&&Js(be);const kn=Nn(gn);for(;ve=kn.nextNode();)Xl(ve,gn),hl(ve,gn),ks(ve.content)&&Wn(ve.content);Ye&&Pt(be,at)}catch(kn){throw Ye&&(da(be),ol(be,at)),kn}finally{Ot=gt}if(Ye){if(ol(be,at))throw Fi("a node selected for removal could not be safely returned; refusing to sanitize in place");return it&&Gn(be),be}if(fn){if(it&&Gn(K),Qt)for(ze=me.call(K.ownerDocument);K.firstChild;)ze.appendChild(K.firstChild);else ze=K;return(lt.shadowroot||lt.shadowrootmode)&&(ze=$.call(r,ze,!0)),ze}let un=Kt?K.outerHTML:K.innerHTML;return Kt&&Ze["!doctype"]&&K.ownerDocument&&K.ownerDocument.doctype&&K.ownerDocument.doctype.name&&Ls(LN,K.ownerDocument.doctype.name)&&(un="<!DOCTYPE "+K.ownerDocument.doctype.name+`>
116
+ `+un),it&&(un=qn(un)),Q&&zs?O(un):un},l.setConfig=function(){let be=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ht(be),es=!0,fs=Ze,Tt=lt},l.clearConfig=function(){xe=null,es=!1,fs=null,Tt=null,Q=ge,X=""},l.isValidAttribute=function(be,S,K){xe||ht({});const pe=B(be),ve=B(S);return typeof K=="string"&&(fi(S,K)||!Gt&&Ls(gb,K))?!1:Fl(pe,ve,K)},l.addHook=function(be,S){typeof S=="function"&&kl(de,be)&&_d(de[be],S)},l.removeHook=function(be,S){if(kl(de,be)){if(S!==void 0){const K=pN(de[be],S);return K===-1?void 0:xN(de[be],K,1)[0]}return ab(de[be])}},l.removeHooks=function(be){kl(de,be)&&(de[be]=[])},l.removeAllHooks=function(){de=xb()},l}var BN=_0();const HN=1024;let qN=0;class oa{constructor(l,i){this.from=l,this.to=i}}class vn{constructor(l={}){this.id=qN++,this.perNode=!!l.perNode,this.deserialize=l.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=l.combine||null}add(l){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof l!="function"&&(l=La.match(l)),i=>{let r=l(i);return r===void 0?null:[this,r]}}}vn.closedBy=new vn({deserialize:n=>n.split(" ")});vn.openedBy=new vn({deserialize:n=>n.split(" ")});vn.group=new vn({deserialize:n=>n.split(" ")});vn.isolate=new vn({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});vn.contextHash=new vn({perNode:!0});vn.lookAhead=new vn({perNode:!0});vn.mounted=new vn({perNode:!0});class iu{constructor(l,i,r,o=!1){this.tree=l,this.overlay=i,this.parser=r,this.bracketed=o}static get(l){return l&&l.props&&l.props[vn.mounted.id]}}const GN=Object.create(null);class La{constructor(l,i,r,o=0){this.name=l,this.props=i,this.id=r,this.flags=o}static define(l){let i=l.props&&l.props.length?Object.create(null):GN,r=(l.top?1:0)|(l.skipped?2:0)|(l.error?4:0)|(l.name==null?8:0),o=new La(l.name||"",i,l.id,r);if(l.props){for(let u of l.props)if(Array.isArray(u)||(u=u(o)),u){if(u[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");i[u[0].id]=u[1]}}return o}prop(l){return this.props[l.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(l){if(typeof l=="string"){if(this.name==l)return!0;let i=this.prop(vn.group);return i?i.indexOf(l)>-1:!1}return this.id==l}static match(l){let i=Object.create(null);for(let r in l)for(let o of r.split(" "))i[o]=l[r];return r=>{for(let o=r.prop(vn.group),u=-1;u<(o?o.length:0);u++){let m=i[u<0?r.name:o[u]];if(m)return m}}}}La.none=new La("",Object.create(null),0,8);class b0{constructor(l){this.types=l;for(let i=0;i<l.length;i++)if(l[i].id!=i)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...l){let i=[];for(let r of this.types){let o=null;for(let u of l){let m=u(r);if(m){o||(o=Object.assign({},r.props));let p=m[1],g=m[0];g.combine&&g.id in o&&(p=g.combine(o[g.id],p)),o[g.id]=p}}i.push(o?new La(r.name,o,r.id,r.flags):r)}return new b0(i)}}const ch=new WeakMap,_b=new WeakMap;var bn;(function(n){n[n.ExcludeBuffers=1]="ExcludeBuffers",n[n.IncludeAnonymous=2]="IncludeAnonymous",n[n.IgnoreMounts=4]="IgnoreMounts",n[n.IgnoreOverlays=8]="IgnoreOverlays",n[n.EnterBracketed=16]="EnterBracketed"})(bn||(bn={}));class wl{constructor(l,i,r,o,u){if(this.type=l,this.children=i,this.positions=r,this.length=o,this.props=null,u&&u.length){this.props=Object.create(null);for(let[m,p]of u)this.props[typeof m=="number"?m:m.id]=p}}toString(){let l=iu.get(this);if(l&&!l.overlay)return l.tree.toString();let i="";for(let r of this.children){let o=r.toString();o&&(i&&(i+=","),i+=o)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(i.length?"("+i+")":""):i}cursor(l=0){return new $h(this.topNode,l)}cursorAt(l,i=0,r=0){let o=ch.get(this)||this.topNode,u=new $h(o);return u.moveTo(l,i),ch.set(this,u._tree),u}get topNode(){return new Ks(this,0,0,null)}resolve(l,i=0){let r=Ld(ch.get(this)||this.topNode,l,i,!1);return ch.set(this,r),r}resolveInner(l,i=0){let r=Ld(_b.get(this)||this.topNode,l,i,!0);return _b.set(this,r),r}resolveStack(l,i=0){return XN(this,l,i)}iterate(l){let{enter:i,leave:r,from:o=0,to:u=this.length}=l,m=l.mode||0,p=(m&bn.IncludeAnonymous)>0;for(let g=this.cursor(m|bn.IncludeAnonymous);;){let _=!1;if(g.from<=u&&g.to>=o&&(!p&&g.type.isAnonymous||i(g)!==!1)){if(g.firstChild())continue;_=!0}for(;_&&r&&(p||!g.type.isAnonymous)&&r(g),!g.nextSibling();){if(!g.parent())return;_=!0}}}prop(l){return l.perNode?this.props?this.props[l.id]:void 0:this.type.prop(l)}get propValues(){let l=[];if(this.props)for(let i in this.props)l.push([+i,this.props[i]]);return l}balance(l={}){return this.children.length<=8?this:Og(La.none,this.children,this.positions,0,this.children.length,0,this.length,(i,r,o)=>new wl(this.type,i,r,o,this.propValues),l.makeTree||((i,r,o)=>new wl(La.none,i,r,o)))}static build(l){return FN(l)}}wl.empty=new wl(La.none,[],[],0);class Dg{constructor(l,i){this.buffer=l,this.index=i}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Dg(this.buffer,this.index)}}class Jr{constructor(l,i,r){this.buffer=l,this.length=i,this.set=r}get type(){return La.none}toString(){let l=[];for(let i=0;i<this.buffer.length;)l.push(this.childString(i)),i=this.buffer[i+3];return l.join(",")}childString(l){let i=this.buffer[l],r=this.buffer[l+3],o=this.set.types[i],u=o.name;if(/\W/.test(u)&&!o.isError&&(u=JSON.stringify(u)),l+=4,r==l)return u;let m=[];for(;l<r;)m.push(this.childString(l)),l=this.buffer[l+3];return u+"("+m.join(",")+")"}findChild(l,i,r,o,u){let{buffer:m}=this,p=-1;for(let g=l;g!=i&&!(y0(u,o,m[g+1],m[g+2])&&(p=g,r>0));g=m[g+3]);return p}slice(l,i,r){let o=this.buffer,u=new Uint16Array(i-l),m=0;for(let p=l,g=0;p<i;){u[g++]=o[p++],u[g++]=o[p++]-r;let _=u[g++]=o[p++]-r;u[g++]=o[p++]-l,m=Math.max(m,_)}return new Jr(u,m,this.set)}}function y0(n,l,i,r){switch(n){case-2:return i<l;case-1:return r>=l&&i<l;case 0:return i<l&&r>l;case 1:return i<=l&&r>l;case 2:return r>l;case 4:return!0}}function Ld(n,l,i,r){for(var o;n.from==n.to||(i<1?n.from>=l:n.from>l)||(i>-1?n.to<=l:n.to<l);){let m=!r&&n instanceof Ks&&n.index<0?null:n.parent;if(!m)return n;n=m}let u=r?0:bn.IgnoreOverlays;if(r)for(let m=n,p=m.parent;p;m=p,p=m.parent)m instanceof Ks&&m.index<0&&((o=p.enter(l,i,u))===null||o===void 0?void 0:o.from)!=m.from&&(n=p);for(;;){let m=n.enter(l,i,u);if(!m)return n;n=m}}class v0{cursor(l=0){return new $h(this,l)}getChild(l,i=null,r=null){let o=bb(this,l,i,r);return o.length?o[0]:null}getChildren(l,i=null,r=null){return bb(this,l,i,r)}resolve(l,i=0){return Ld(this,l,i,!1)}resolveInner(l,i=0){return Ld(this,l,i,!0)}matchContext(l){return sg(this.parent,l)}enterUnfinishedNodesBefore(l){let i=this.childBefore(l),r=this;for(;i;){let o=i.lastChild;if(!o||o.to!=i.to)break;o.type.isError&&o.from==o.to?(r=i,i=o.prevSibling):i=o}return r}get node(){return this}get next(){return this.parent}}class Ks extends v0{constructor(l,i,r,o){super(),this._tree=l,this.from=i,this.index=r,this._parent=o}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(l,i,r,o,u=0){for(let m=this;;){for(let{children:p,positions:g}=m._tree,_=i>0?p.length:-1;l!=_;l+=i){let b=p[l],j=g[l]+m.from,v;if(!(!(u&bn.EnterBracketed&&b instanceof wl&&(v=iu.get(b))&&!v.overlay&&v.bracketed&&r>=j&&r<=j+b.length)&&!y0(o,r,j,j+b.length))){if(b instanceof Jr){if(u&bn.ExcludeBuffers)continue;let k=b.findChild(0,b.buffer.length,i,r-j,o);if(k>-1)return new ci(new YN(m,b,l,j),null,k)}else if(u&bn.IncludeAnonymous||!b.type.isAnonymous||Lg(b)){let k;if(!(u&bn.IgnoreMounts)&&(k=iu.get(b))&&!k.overlay)return new Ks(k.tree,j,l,m);let N=new Ks(b,j,l,m);return u&bn.IncludeAnonymous||!N.type.isAnonymous?N:N.nextChild(i<0?b.children.length-1:0,i,r,o,u)}}}if(u&bn.IncludeAnonymous||!m.type.isAnonymous||(m.index>=0?l=m.index+i:l=i<0?-1:m._parent._tree.children.length,m=m._parent,!m))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(l){return this.nextChild(0,1,l,2)}childBefore(l){return this.nextChild(this._tree.children.length-1,-1,l,-2)}prop(l){return this._tree.prop(l)}enter(l,i,r=0){let o;if(!(r&bn.IgnoreOverlays)&&(o=iu.get(this._tree))&&o.overlay){let u=l-this.from,m=r&bn.EnterBracketed&&o.bracketed;for(let{from:p,to:g}of o.overlay)if((i>0||m?p<=u:p<u)&&(i<0||m?g>=u:g>u))return new Ks(o.tree,o.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,l,i,r)}nextSignificantParent(){let l=this;for(;l.type.isAnonymous&&l._parent;)l=l._parent;return l}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function bb(n,l,i,r){let o=n.cursor(),u=[];if(!o.firstChild())return u;if(i!=null){for(let m=!1;!m;)if(m=o.type.is(i),!o.nextSibling())return u}for(;;){if(r!=null&&o.type.is(r))return u;if(o.type.is(l)&&u.push(o.node),!o.nextSibling())return r==null?u:[]}}function sg(n,l,i=l.length-1){for(let r=n;i>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(l[i]&&l[i]!=r.name)return!1;i--}}return!0}class YN{constructor(l,i,r,o){this.parent=l,this.buffer=i,this.index=r,this.start=o}}class ci extends v0{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(l,i,r){super(),this.context=l,this._parent=i,this.index=r,this.type=l.buffer.set.types[l.buffer.buffer[r]]}child(l,i,r){let{buffer:o}=this.context,u=o.findChild(this.index+4,o.buffer[this.index+3],l,i-this.context.start,r);return u<0?null:new ci(this.context,this,u)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(l){return this.child(1,l,2)}childBefore(l){return this.child(-1,l,-2)}prop(l){return this.type.prop(l)}enter(l,i,r=0){if(r&bn.ExcludeBuffers)return null;let{buffer:o}=this.context,u=o.findChild(this.index+4,o.buffer[this.index+3],i>0?1:-1,l-this.context.start,i);return u<0?null:new ci(this.context,this,u)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(l){return this._parent?null:this.context.parent.nextChild(this.context.index+l,l,0,4)}get nextSibling(){let{buffer:l}=this.context,i=l.buffer[this.index+3];return i<(this._parent?l.buffer[this._parent.index+3]:l.buffer.length)?new ci(this.context,this._parent,i):this.externalSibling(1)}get prevSibling(){let{buffer:l}=this.context,i=this._parent?this._parent.index+4:0;return this.index==i?this.externalSibling(-1):new ci(this.context,this._parent,l.findChild(i,this.index,-1,0,4))}get tree(){return null}toTree(){let l=[],i=[],{buffer:r}=this.context,o=this.index+4,u=r.buffer[this.index+3];if(u>o){let m=r.buffer[this.index+1];l.push(r.slice(o,u,m)),i.push(0)}return new wl(this.type,l,i,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function j0(n){if(!n.length)return null;let l=0,i=n[0];for(let u=1;u<n.length;u++){let m=n[u];(m.from>i.from||m.to<i.to)&&(i=m,l=u)}let r=i instanceof Ks&&i.index<0?null:i.parent,o=n.slice();return r?o[l]=r:o.splice(l,1),new VN(o,i)}class VN{constructor(l,i){this.heads=l,this.node=i}get next(){return j0(this.heads)}}function XN(n,l,i){let r=n.resolveInner(l,i),o=null;for(let u=r instanceof Ks?r:r.context.parent;u;u=u.parent)if(u.index<0){let m=u.parent;(o||(o=[r])).push(m.resolve(l,i)),u=m}else{let m=iu.get(u.tree);if(m&&m.overlay&&m.overlay[0].from<=l&&m.overlay[m.overlay.length-1].to>=l){let p=new Ks(m.tree,m.overlay[0].from+u.from,-1,u);(o||(o=[r])).push(Ld(p,l,i,!1))}}return o?j0(o):r}class $h{get name(){return this.type.name}constructor(l,i=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=i&~bn.EnterBracketed,l instanceof Ks)this.yieldNode(l);else{this._tree=l.context.parent,this.buffer=l.context;for(let r=l._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=l,this.yieldBuf(l.index)}}yieldNode(l){return l?(this._tree=l,this.type=l.type,this.from=l.from,this.to=l.to,!0):!1}yieldBuf(l,i){this.index=l;let{start:r,buffer:o}=this.buffer;return this.type=i||o.set.types[o.buffer[l]],this.from=r+o.buffer[l+1],this.to=r+o.buffer[l+2],!0}yield(l){return l?l instanceof Ks?(this.buffer=null,this.yieldNode(l)):(this.buffer=l.context,this.yieldBuf(l.index,l.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(l,i,r){if(!this.buffer)return this.yield(this._tree.nextChild(l<0?this._tree._tree.children.length-1:0,l,i,r,this.mode));let{buffer:o}=this.buffer,u=o.findChild(this.index+4,o.buffer[this.index+3],l,i-this.buffer.start,r);return u<0?!1:(this.stack.push(this.index),this.yieldBuf(u))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(l){return this.enterChild(1,l,2)}childBefore(l){return this.enterChild(-1,l,-2)}enter(l,i,r=this.mode){return this.buffer?r&bn.ExcludeBuffers?!1:this.enterChild(1,l,i):this.yield(this._tree.enter(l,i,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&bn.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let l=this.mode&bn.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(l)}sibling(l){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+l,l,0,4,this.mode)):!1;let{buffer:i}=this.buffer,r=this.stack.length-1;if(l<0){let o=r<0?0:this.stack[r]+4;if(this.index!=o)return this.yieldBuf(i.findChild(o,this.index,-1,0,4))}else{let o=i.buffer[this.index+3];if(o<(r<0?i.buffer.length:i.buffer[this.stack[r]+3]))return this.yieldBuf(o)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+l,l,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(l){let i,r,{buffer:o}=this;if(o){if(l>0){if(this.index<o.buffer.buffer.length)return!1}else for(let u=0;u<this.index;u++)if(o.buffer.buffer[u+3]<this.index)return!1;({index:i,parent:r}=o)}else({index:i,_parent:r}=this._tree);for(;r;{index:i,_parent:r}=r)if(i>-1)for(let u=i+l,m=l<0?-1:r._tree.children.length;u!=m;u+=l){let p=r._tree.children[u];if(this.mode&bn.IncludeAnonymous||p instanceof Jr||!p.type.isAnonymous||Lg(p))return!1}return!0}move(l,i){if(i&&this.enterChild(l,0,4))return!0;for(;;){if(this.sibling(l))return!0;if(this.atLastNode(l)||!this.parent())return!1}}next(l=!0){return this.move(1,l)}prev(l=!0){return this.move(-1,l)}moveTo(l,i=0){for(;(this.from==this.to||(i<1?this.from>=l:this.from>l)||(i>-1?this.to<=l:this.to<l))&&this.parent(););for(;this.enterChild(1,l,i););return this}get node(){if(!this.buffer)return this._tree;let l=this.bufferNode,i=null,r=0;if(l&&l.context==this.buffer)e:for(let o=this.index,u=this.stack.length;u>=0;){for(let m=l;m;m=m._parent)if(m.index==o){if(o==this.index)return m;i=m,r=u+1;break e}o=this.stack[--u]}for(let o=r;o<this.stack.length;o++)i=new ci(this.buffer,i,this.stack[o]);return this.bufferNode=new ci(this.buffer,i,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(l,i){for(let r=0;;){let o=!1;if(this.type.isAnonymous||l(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(o=!0)}for(;;){if(o&&i&&i(this),o=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,o=!0}}}matchContext(l){if(!this.buffer)return sg(this.node.parent,l);let{buffer:i}=this.buffer,{types:r}=i.set;for(let o=l.length-1,u=this.stack.length-1;o>=0;u--){if(u<0)return sg(this._tree,l,o);let m=r[i.buffer[this.stack[u]]];if(!m.isAnonymous){if(l[o]&&l[o]!=m.name)return!1;o--}}return!0}}function Lg(n){return n.children.some(l=>l instanceof Jr||!l.type.isAnonymous||Lg(l))}function FN(n){var l;let{buffer:i,nodeSet:r,maxBufferLength:o=HN,reused:u=[],minRepeatType:m=r.types.length}=n,p=Array.isArray(i)?new Dg(i,i.length):i,g=r.types,_=0,b=0;function j(V,z,H,te,F,fe){let{id:Q,start:X,end:ge,size:U}=p,L=b,M=_;if(U<0)if(p.next(),U==-1){let A=u[Q];H.push(A),te.push(X-V);return}else if(U==-3){_=Q;return}else if(U==-4){b=Q;return}else throw new RangeError(`Unrecognized record size: ${U}`);let O=g[Q],J,le,ce=X-V;if(ge-X<=o&&(le=C(p.pos-z,F))){let A=new Uint16Array(le.size-le.skip),W=p.pos-le.size,me=A.length;for(;p.pos>W;)me=I(le.start,A,me);J=new Jr(A,ge-le.start,r),ce=le.start-V}else{let A=p.pos-U;p.next();let W=[],me=[],Ee=Q>=m?Q:-1,$=0,de=ge;for(;p.pos>A;)Ee>=0&&p.id==Ee&&p.size>=0?(p.end<=de-o&&(N(W,me,X,$,p.end,de,Ee,L,M),$=W.length,de=p.end),p.next()):fe>2500?v(X,A,W,me):j(X,A,W,me,Ee,fe+1);if(Ee>=0&&$>0&&$<W.length&&N(W,me,X,$,X,de,Ee,L,M),W.reverse(),me.reverse(),Ee>-1&&$>0){let ae=k(O,M);J=Og(O,W,me,0,W.length,0,ge-X,ae,ae)}else J=E(O,W,me,ge-X,L-ge,M)}H.push(J),te.push(ce)}function v(V,z,H,te){let F=[],fe=0,Q=-1;for(;p.pos>z;){let{id:X,start:ge,end:U,size:L}=p;if(L>4)p.next();else{if(Q>-1&&ge<Q)break;Q<0&&(Q=U-o),F.push(X,ge,U),fe++,p.next()}}if(fe){let X=new Uint16Array(fe*4),ge=F[F.length-2];for(let U=F.length-3,L=0;U>=0;U-=3)X[L++]=F[U],X[L++]=F[U+1]-ge,X[L++]=F[U+2]-ge,X[L++]=L;H.push(new Jr(X,F[2]-ge,r)),te.push(ge-V)}}function k(V,z){return(H,te,F)=>{let fe=0,Q=H.length-1,X,ge;if(Q>=0&&(X=H[Q])instanceof wl){if(!Q&&X.type==V&&X.length==F)return X;(ge=X.prop(vn.lookAhead))&&(fe=te[Q]+X.length+ge)}return E(V,H,te,F,fe,z)}}function N(V,z,H,te,F,fe,Q,X,ge){let U=[],L=[];for(;V.length>te;)U.push(V.pop()),L.push(z.pop()+H-F);V.push(E(r.types[Q],U,L,fe-F,X-fe,ge)),z.push(F-H)}function E(V,z,H,te,F,fe,Q){if(fe){let X=[vn.contextHash,fe];Q=Q?[X].concat(Q):[X]}if(F>25){let X=[vn.lookAhead,F];Q=Q?[X].concat(Q):[X]}return new wl(V,z,H,te,Q)}function C(V,z){let H=p.fork(),te=0,F=0,fe=0,Q=H.end-o,X={size:0,start:0,skip:0};e:for(let ge=H.pos-V;H.pos>ge;){let U=H.size;if(H.id==z&&U>=0){X.size=te,X.start=F,X.skip=fe,fe+=4,te+=4,H.next();continue}let L=H.pos-U;if(U<0||L<ge||H.start<Q)break;let M=H.id>=m?4:0,O=H.start;for(H.next();H.pos>L;){if(H.size<0)if(H.size==-3||H.size==-4)M+=4;else break e;else H.id>=m&&(M+=4);H.next()}F=O,te+=U,fe+=M}return(z<0||te==V)&&(X.size=te,X.start=F,X.skip=fe),X.size>4?X:void 0}function I(V,z,H){let{id:te,start:F,end:fe,size:Q}=p;if(p.next(),Q>=0&&te<m){let X=H;if(Q>4){let ge=p.pos-(Q-4);for(;p.pos>ge;)H=I(V,z,H)}z[--H]=X,z[--H]=fe-V,z[--H]=F-V,z[--H]=te}else Q==-3?_=te:Q==-4&&(b=te);return H}let D=[],G=[];for(;p.pos>0;)j(n.start||0,n.bufferStart||0,D,G,-1,0);let P=(l=n.length)!==null&&l!==void 0?l:D.length?G[0]+D[0].length:0;return new wl(g[n.topID],D.reverse(),G.reverse(),P)}const yb=new WeakMap;function Ah(n,l){if(!n.isAnonymous||l instanceof Jr||l.type!=n)return 1;let i=yb.get(l);if(i==null){i=1;for(let r of l.children){if(r.type!=n||!(r instanceof wl)){i=1;break}i+=Ah(n,r)}yb.set(l,i)}return i}function Og(n,l,i,r,o,u,m,p,g){let _=0;for(let N=r;N<o;N++)_+=Ah(n,l[N]);let b=Math.ceil(_*1.5/8),j=[],v=[];function k(N,E,C,I,D){for(let G=C;G<I;){let P=G,V=E[G],z=Ah(n,N[G]);for(G++;G<I;G++){let H=Ah(n,N[G]);if(z+H>=b)break;z+=H}if(G==P+1){if(z>b){let H=N[P];k(H.children,H.positions,0,H.children.length,E[P]+D);continue}j.push(N[P])}else{let H=E[G-1]+N[G-1].length-V;j.push(Og(n,N,E,P,G,V,H,null,g))}v.push(V+D-u)}}return k(l,i,r,o,0),(p||g)(j,v,m)}class hM{constructor(){this.map=new WeakMap}setBuffer(l,i,r){let o=this.map.get(l);o||this.map.set(l,o=new Map),o.set(i,r)}getBuffer(l,i){let r=this.map.get(l);return r&&r.get(i)}set(l,i){l instanceof ci?this.setBuffer(l.context.buffer,l.index,i):l instanceof Ks&&this.map.set(l.tree,i)}get(l){return l instanceof ci?this.getBuffer(l.context.buffer,l.index):l instanceof Ks?this.map.get(l.tree):void 0}cursorSet(l,i){l.buffer?this.setBuffer(l.buffer.buffer,l.index,i):this.map.set(l.tree,i)}cursorGet(l){return l.buffer?this.getBuffer(l.buffer.buffer,l.index):this.map.get(l.tree)}}class Od{constructor(l,i,r,o,u=!1,m=!1){this.from=l,this.to=i,this.tree=r,this.offset=o,this.open=(u?1:0)|(m?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(l,i=[],r=!1){let o=[new Od(0,l.length,l,0,!1,r)];for(let u of i)u.to>l.length&&o.push(u);return o}static applyChanges(l,i,r=128){if(!i.length)return l;let o=[],u=1,m=l.length?l[0]:null;for(let p=0,g=0,_=0;;p++){let b=p<i.length?i[p]:null,j=b?b.fromA:1e9;if(j-g>=r)for(;m&&m.from<j;){let v=m;if(g>=v.from||j<=v.to||_){let k=Math.max(v.from,g)-_,N=Math.min(v.to,j)-_;v=k>=N?null:new Od(k,N,v.tree,v.offset+_,p>0,!!b)}if(v&&o.push(v),m.to>j)break;m=u<l.length?l[u++]:null}if(!b)break;g=b.toA,_=b.toA-b.toB}return o}}class mM{startParse(l,i,r){return typeof l=="string"&&(l=new KN(l)),r=r?r.length?r.map(o=>new oa(o.from,o.to)):[new oa(0,0)]:[new oa(0,l.length)],this.createParse(l,i||[],r)}parse(l,i,r){let o=this.startParse(l,i,r);for(;;){let u=o.advance();if(u)return u}}}class KN{constructor(l){this.string=l}get length(){return this.string.length}chunk(l){return this.string.slice(l)}get lineChunks(){return!1}read(l,i){return this.string.slice(l,i)}}function pM(n){return(l,i,r,o)=>new ZN(l,n,i,r,o)}class vb{constructor(l,i,r,o,u,m){this.parser=l,this.parse=i,this.overlay=r,this.bracketed=o,this.target=u,this.from=m}}function jb(n){if(!n.length||n.some(l=>l.from>=l.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(n))}class QN{constructor(l,i,r,o,u,m,p,g){this.parser=l,this.predicate=i,this.mounts=r,this.index=o,this.start=u,this.bracketed=m,this.target=p,this.prev=g,this.depth=0,this.ranges=[]}}const lg=new vn({perNode:!0});class ZN{constructor(l,i,r,o,u){this.nest=i,this.input=r,this.fragments=o,this.ranges=u,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=l}advance(){if(this.baseParse){let r=this.baseParse.advance();if(!r)return null;if(this.baseParse=null,this.baseTree=r,this.startInner(),this.stoppedAt!=null)for(let o of this.inner)o.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let r=this.baseTree;return this.stoppedAt!=null&&(r=new wl(r.type,r.children,r.positions,r.length,r.propValues.concat([[lg,this.stoppedAt]]))),r}let l=this.inner[this.innerDone],i=l.parse.advance();if(i){this.innerDone++;let r=Object.assign(Object.create(null),l.target.props);r[vn.mounted.id]=new iu(i,l.overlay,l.parser,l.bracketed),l.target.props=r}return null}get parsedPos(){if(this.baseParse)return 0;let l=this.input.length;for(let i=this.innerDone;i<this.inner.length;i++)this.inner[i].from<l&&(l=Math.min(l,this.inner[i].parse.parsedPos));return l}stopAt(l){if(this.stoppedAt=l,this.baseParse)this.baseParse.stopAt(l);else for(let i=this.innerDone;i<this.inner.length;i++)this.inner[i].parse.stopAt(l)}startInner(){let l=new JN(this.fragments),i=null,r=null,o=new $h(new Ks(this.baseTree,this.ranges[0].from,0,null),bn.IncludeAnonymous|bn.IgnoreMounts);e:for(let u,m;;){let p=!0,g;if(this.stoppedAt!=null&&o.from>=this.stoppedAt)p=!1;else if(l.hasNode(o)){if(i){let _=i.mounts.find(b=>b.frag.from<=o.from&&b.frag.to>=o.to&&b.mount.overlay);if(_)for(let b of _.mount.overlay){let j=b.from+_.pos,v=b.to+_.pos;j>=o.from&&v<=o.to&&!i.ranges.some(k=>k.from<v&&k.to>j)&&i.ranges.push({from:j,to:v})}}p=!1}else if(r&&(m=PN(r.ranges,o.from,o.to)))p=m!=2;else if(!o.type.isAnonymous&&(u=this.nest(o,this.input))&&(o.from<o.to||!u.overlay)){o.tree||(WN(o),i&&i.depth++,r&&r.depth++);let _=l.findMounts(o.from,u.parser);if(typeof u.overlay=="function")i=new QN(u.parser,u.overlay,_,this.inner.length,o.from,!!u.bracketed,o.tree,i);else{let b=wb(this.ranges,u.overlay||(o.from<o.to?[new oa(o.from,o.to)]:[]));b.length&&jb(b),(b.length||!u.overlay)&&this.inner.push(new vb(u.parser,b.length?u.parser.startParse(this.input,Sb(_,b),b):u.parser.startParse(""),u.overlay?u.overlay.map(j=>new oa(j.from-o.from,j.to-o.from)):null,!!u.bracketed,o.tree,b.length?b[0].from:o.from)),u.overlay?b.length&&(r={ranges:b,depth:0,prev:r}):p=!1}}else if(i&&(g=i.predicate(o))&&(g===!0&&(g=new oa(o.from,o.to)),g.from<g.to)){let _=i.ranges.length-1;_>=0&&i.ranges[_].to==g.from?i.ranges[_]={from:i.ranges[_].from,to:g.to}:i.ranges.push(g)}if(p&&o.firstChild())i&&i.depth++,r&&r.depth++;else for(;!o.nextSibling();){if(!o.parent())break e;if(i&&!--i.depth){let _=wb(this.ranges,i.ranges);_.length&&(jb(_),this.inner.splice(i.index,0,new vb(i.parser,i.parser.startParse(this.input,Sb(i.mounts,_),_),i.ranges.map(b=>new oa(b.from-i.start,b.to-i.start)),i.bracketed,i.target,_[0].from))),i=i.prev}r&&!--r.depth&&(r=r.prev)}}}}function PN(n,l,i){for(let r of n){if(r.from>=i)break;if(r.to>l)return r.from<=l&&r.to>=i?2:1}return 0}function Nb(n,l,i,r,o,u){if(l<i){let m=n.buffer[l+1];r.push(n.slice(l,i,m)),o.push(m-u)}}function WN(n){let{node:l}=n,i=[],r=l.context.buffer;do i.push(n.index),n.parent();while(!n.tree);let o=n.tree,u=o.children.indexOf(r),m=o.children[u],p=m.buffer,g=[u];function _(b,j,v,k,N,E){let C=i[E],I=[],D=[];Nb(m,b,C,I,D,k);let G=p[C+1],P=p[C+2];g.push(I.length);let V=E?_(C+4,p[C+3],m.set.types[p[C]],G,P-G,E-1):l.toTree();return I.push(V),D.push(G-k),Nb(m,p[C+3],j,I,D,k),new wl(v,I,D,N)}o.children[u]=_(0,p.length,La.none,0,m.length,i.length-1);for(let b of g){let j=n.tree.children[b],v=n.tree.positions[b];n.yield(new Ks(j,v+n.from,b,n._tree))}}class kb{constructor(l,i){this.offset=i,this.done=!1,this.cursor=l.cursor(bn.IncludeAnonymous|bn.IgnoreMounts)}moveTo(l){let{cursor:i}=this,r=l-this.offset;for(;!this.done&&i.from<r;)if(!(i.to>=l&&i.enter(r,1,bn.IgnoreOverlays|bn.ExcludeBuffers)))if(i.to<=l)i.next(!1)||(this.done=!0);else break}hasNode(l){if(this.moveTo(l.from),!this.done&&this.cursor.from+this.offset==l.from&&this.cursor.tree)for(let i=this.cursor.tree;;){if(i==l.tree)return!0;if(i.children.length&&i.positions[0]==0&&i.children[0]instanceof wl)i=i.children[0];else break}return!1}}class JN{constructor(l){var i;if(this.fragments=l,this.curTo=0,this.fragI=0,l.length){let r=this.curFrag=l[0];this.curTo=(i=r.tree.prop(lg))!==null&&i!==void 0?i:r.to,this.inner=new kb(r.tree,-r.offset)}else this.curFrag=this.inner=null}hasNode(l){for(;this.curFrag&&l.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=l.from&&this.curTo>=l.to&&this.inner.hasNode(l)}nextFrag(){var l;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let i=this.curFrag=this.fragments[this.fragI];this.curTo=(l=i.tree.prop(lg))!==null&&l!==void 0?l:i.to,this.inner=new kb(i.tree,-i.offset)}}findMounts(l,i){var r;let o=[];if(this.inner){this.inner.cursor.moveTo(l,1);for(let u=this.inner.cursor.node;u;u=u.parent){let m=(r=u.tree)===null||r===void 0?void 0:r.prop(vn.mounted);if(m&&m.parser==i)for(let p=this.fragI;p<this.fragments.length;p++){let g=this.fragments[p];if(g.from>=u.to)break;g.tree==this.curFrag.tree&&o.push({frag:g,pos:u.from-g.offset,mount:m})}}}return o}}function wb(n,l){let i=null,r=l;for(let o=1,u=0;o<n.length;o++){let m=n[o-1].to,p=n[o].from;for(;u<r.length;u++){let g=r[u];if(g.from>=p)break;g.to<=m||(i||(r=i=l.slice()),g.from<m?(i[u]=new oa(g.from,m),g.to>p&&i.splice(u+1,0,new oa(p,g.to))):g.to>p?i[u--]=new oa(p,g.to):i.splice(u--,1))}}return r}function ek(n,l,i,r){let o=0,u=0,m=!1,p=!1,g=-1e9,_=[];for(;;){let b=o==n.length?1e9:m?n[o].to:n[o].from,j=u==l.length?1e9:p?l[u].to:l[u].from;if(m!=p){let v=Math.max(g,i),k=Math.min(b,j,r);v<k&&_.push(new oa(v,k))}if(g=Math.min(b,j),g==1e9)break;b==g&&(m?(m=!1,o++):m=!0),j==g&&(p?(p=!1,u++):p=!0)}return _}function Sb(n,l){let i=[];for(let{pos:r,mount:o,frag:u}of n){let m=r+(o.overlay?o.overlay[0].from:0),p=m+o.tree.length,g=Math.max(u.from,m),_=Math.min(u.to,p);if(o.overlay){let b=o.overlay.map(v=>new oa(v.from+r,v.to+r)),j=ek(l,b,g,_);for(let v=0,k=g;;v++){let N=v==j.length,E=N?_:j[v].from;if(E>k&&i.push(new Od(k,E,o.tree,-m,u.from>=k||u.openStart,u.to<=E||u.openEnd)),N)break;k=j[v].to}}else i.push(new Od(g,_,o.tree,-m,u.from>=m||u.openStart,u.to<=p||u.openEnd))}return i}let tk=0;class ca{constructor(l,i,r,o){this.name=l,this.set=i,this.base=r,this.modified=o,this.id=tk++}toString(){let{name:l}=this;for(let i of this.modified)i.name&&(l=`${i.name}(${l})`);return l}static define(l,i){let r=typeof l=="string"?l:"?";if(l instanceof ca&&(i=l),i!=null&&i.base)throw new Error("Can not derive from a modified tag");let o=new ca(r,[],null,[]);if(o.set.push(o),i)for(let u of i.set)o.set.push(u);return o}static defineModifier(l){let i=new Bh(l);return r=>r.modified.indexOf(i)>-1?r:Bh.get(r.base||r,r.modified.concat(i).sort((o,u)=>o.id-u.id))}}let nk=0;class Bh{constructor(l){this.name=l,this.instances=[],this.id=nk++}static get(l,i){if(!i.length)return l;let r=i[0].instances.find(p=>p.base==l&&sk(i,p.modified));if(r)return r;let o=[],u=new ca(l.name,o,l,i);for(let p of i)p.instances.push(u);let m=lk(i);for(let p of l.set)if(!p.modified.length)for(let g of m)o.push(Bh.get(p,g));return u}}function sk(n,l){return n.length==l.length&&n.every((i,r)=>i==l[r])}function lk(n){let l=[[]];for(let i=0;i<n.length;i++)for(let r=0,o=l.length;r<o;r++)l.push(l[r].concat(n[i]));return l.sort((i,r)=>r.length-i.length)}function gM(n){let l=Object.create(null);for(let i in n){let r=n[i];Array.isArray(r)||(r=[r]);for(let o of i.split(" "))if(o){let u=[],m=2,p=o;for(let j=0;;){if(p=="..."&&j>0&&j+3==o.length){m=1;break}let v=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(p);if(!v)throw new RangeError("Invalid path: "+o);if(u.push(v[0]=="*"?"":v[0][0]=='"'?JSON.parse(v[0]):v[0]),j+=v[0].length,j==o.length)break;let k=o[j++];if(j==o.length&&k=="!"){m=0;break}if(k!="/")throw new RangeError("Invalid path: "+o);p=o.slice(j)}let g=u.length-1,_=u[g];if(!_)throw new RangeError("Invalid path: "+o);let b=new zd(r,m,g>0?u.slice(0,g):null);l[_]=b.sort(l[_])}}return N0.add(l)}const N0=new vn({combine(n,l){let i,r,o;for(;n||l;){if(!n||l&&n.depth>=l.depth?(o=l,l=l.next):(o=n,n=n.next),i&&i.mode==o.mode&&!o.context&&!i.context)continue;let u=new zd(o.tags,o.mode,o.context);i?i.next=u:r=u,i=u}return r}});class zd{constructor(l,i,r,o){this.tags=l,this.mode=i,this.context=r,this.next=o}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(l){return!l||l.depth<this.depth?(this.next=l,this):(l.next=this.sort(l.next),l)}get depth(){return this.context?this.context.length:0}}zd.empty=new zd([],2,null);function k0(n,l){let i=Object.create(null);for(let u of n)if(!Array.isArray(u.tag))i[u.tag.id]=u.class;else for(let m of u.tag)i[m.id]=u.class;let{scope:r,all:o=null}=l||{};return{style:u=>{let m=o;for(let p of u)for(let g of p.set){let _=i[g.id];if(_){m=m?m+" "+_:_;break}}return m},scope:r}}function ak(n,l){let i=null;for(let r of n){let o=r.style(l);o&&(i=i?i+" "+o:o)}return i}function ik(n,l,i,r=0,o=n.length){let u=new ck(r,Array.isArray(l)?l:[l],i);u.highlightRange(n.cursor(),r,o,"",u.highlighters),u.flush(o)}function rk(n,l,i,r,o,u=0,m=n.length){let p=u;function g(_,b){if(!(_<=p)){for(let j=n.slice(p,_),v=0;;){let k=j.indexOf(`
117
+ `,v),N=k<0?j.length:k;if(N>v&&r(j.slice(v,N),b),k<0)break;o(),v=k+1}p=_}}ik(l,i,(_,b,j)=>{g(_,""),g(b,j)},u,m),g(m,"")}class ck{constructor(l,i,r){this.at=l,this.highlighters=i,this.span=r,this.class=""}startSpan(l,i){i!=this.class&&(this.flush(l),l>this.at&&(this.at=l),this.class=i)}flush(l){l>this.at&&this.class&&this.span(this.at,l,this.class)}highlightRange(l,i,r,o,u){let{type:m,from:p,to:g}=l;if(p>=r||g<=i)return;m.isTop&&(u=this.highlighters.filter(k=>!k.scope||k.scope(m)));let _=o,b=ok(l)||zd.empty,j=ak(u,b.tags);if(j&&(_&&(_+=" "),_+=j,b.mode==1&&(o+=(o?" ":"")+j)),this.startSpan(Math.max(i,p),_),b.opaque)return;let v=l.tree&&l.tree.prop(vn.mounted);if(v&&v.overlay){let k=l.node.enter(v.overlay[0].from+p,1),N=this.highlighters.filter(C=>!C.scope||C.scope(v.tree.type)),E=l.firstChild();for(let C=0,I=p;;C++){let D=C<v.overlay.length?v.overlay[C]:null,G=D?D.from+p:g,P=Math.max(i,I),V=Math.min(r,G);if(P<V&&E)for(;l.from<V&&(this.highlightRange(l,P,V,o,u),this.startSpan(Math.min(V,l.to),_),!(l.to>=G||!l.nextSibling())););if(!D||G>r)break;I=D.to+p,I>i&&(this.highlightRange(k.cursor(),Math.max(i,D.from+p),Math.min(r,I),"",N),this.startSpan(Math.min(r,I),_))}E&&l.parent()}else if(l.firstChild()){v&&(o="");do if(!(l.to<=i)){if(l.from>=r)break;this.highlightRange(l,i,r,o,u),this.startSpan(Math.min(r,l.to),_)}while(l.nextSibling());l.parent()}}}function ok(n){let l=n.type.prop(N0);for(;l&&l.context&&!n.matchContext(l.context);)l=l.next;return l||null}const De=ca.define,oh=De(),Kr=De(),Eb=De(Kr),Cb=De(Kr),Qr=De(),uh=De(Qr),zp=De(Qr),li=De(),Bc=De(li),ei=De(),ti=De(),ag=De(),jd=De(ag),dh=De(),Oe={comment:oh,lineComment:De(oh),blockComment:De(oh),docComment:De(oh),name:Kr,variableName:De(Kr),typeName:Eb,tagName:De(Eb),propertyName:Cb,attributeName:De(Cb),className:De(Kr),labelName:De(Kr),namespace:De(Kr),macroName:De(Kr),literal:Qr,string:uh,docString:De(uh),character:De(uh),attributeValue:De(uh),number:zp,integer:De(zp),float:De(zp),bool:De(Qr),regexp:De(Qr),escape:De(Qr),color:De(Qr),url:De(Qr),keyword:ei,self:De(ei),null:De(ei),atom:De(ei),unit:De(ei),modifier:De(ei),operatorKeyword:De(ei),controlKeyword:De(ei),definitionKeyword:De(ei),moduleKeyword:De(ei),operator:ti,derefOperator:De(ti),arithmeticOperator:De(ti),logicOperator:De(ti),bitwiseOperator:De(ti),compareOperator:De(ti),updateOperator:De(ti),definitionOperator:De(ti),typeOperator:De(ti),controlOperator:De(ti),punctuation:ag,separator:De(ag),bracket:jd,angleBracket:De(jd),squareBracket:De(jd),paren:De(jd),brace:De(jd),content:li,heading:Bc,heading1:De(Bc),heading2:De(Bc),heading3:De(Bc),heading4:De(Bc),heading5:De(Bc),heading6:De(Bc),contentSeparator:De(li),list:De(li),quote:De(li),emphasis:De(li),strong:De(li),link:De(li),monospace:De(li),strikethrough:De(li),inserted:De(),deleted:De(),changed:De(),invalid:De(),meta:dh,documentMeta:De(dh),annotation:De(dh),processingInstruction:De(dh),definition:ca.defineModifier("definition"),constant:ca.defineModifier("constant"),function:ca.defineModifier("function"),standard:ca.defineModifier("standard"),local:ca.defineModifier("local"),special:ca.defineModifier("special")};for(let n in Oe){let l=Oe[n];l instanceof ca&&(l.name=n)}k0([{tag:Oe.link,class:"tok-link"},{tag:Oe.heading,class:"tok-heading"},{tag:Oe.emphasis,class:"tok-emphasis"},{tag:Oe.strong,class:"tok-strong"},{tag:Oe.keyword,class:"tok-keyword"},{tag:Oe.atom,class:"tok-atom"},{tag:Oe.bool,class:"tok-bool"},{tag:Oe.url,class:"tok-url"},{tag:Oe.labelName,class:"tok-labelName"},{tag:Oe.inserted,class:"tok-inserted"},{tag:Oe.deleted,class:"tok-deleted"},{tag:Oe.literal,class:"tok-literal"},{tag:Oe.string,class:"tok-string"},{tag:Oe.number,class:"tok-number"},{tag:[Oe.regexp,Oe.escape,Oe.special(Oe.string)],class:"tok-string2"},{tag:Oe.variableName,class:"tok-variableName"},{tag:Oe.local(Oe.variableName),class:"tok-variableName tok-local"},{tag:Oe.definition(Oe.variableName),class:"tok-variableName tok-definition"},{tag:Oe.special(Oe.variableName),class:"tok-variableName2"},{tag:Oe.definition(Oe.propertyName),class:"tok-propertyName tok-definition"},{tag:Oe.typeName,class:"tok-typeName"},{tag:Oe.namespace,class:"tok-namespace"},{tag:Oe.className,class:"tok-className"},{tag:Oe.macroName,class:"tok-macroName"},{tag:Oe.propertyName,class:"tok-propertyName"},{tag:Oe.operator,class:"tok-operator"},{tag:Oe.comment,class:"tok-comment"},{tag:Oe.meta,class:"tok-meta"},{tag:Oe.invalid,class:"tok-invalid"},{tag:Oe.punctuation,class:"tok-punctuation"}]);const uk="modulepreload",dk=function(n,l){return new URL(n,l).href},Tb={},st=function(l,i,r){let o=Promise.resolve();if(i&&i.length>0){let m=function(b){return Promise.all(b.map(j=>Promise.resolve(j).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};const p=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),_=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));o=m(i.map(b=>{if(b=dk(b,r),b in Tb)return;Tb[b]=!0;const j=b.endsWith(".css"),v=j?'[rel="stylesheet"]':"";if(!!r)for(let E=p.length-1;E>=0;E--){const C=p[E];if(C.href===b&&(!j||C.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${b}"]${v}`))return;const N=document.createElement("link");if(N.rel=j?"stylesheet":uk,j||(N.as="script"),N.crossOrigin="",N.href=b,_&&N.setAttribute("nonce",_),document.head.appendChild(N),j)return new Promise((E,C)=>{N.addEventListener("load",E),N.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${b}`)))})}))}function u(m){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=m,window.dispatchEvent(p),!p.defaultPrevented)throw m}return o.then(m=>{for(const p of m||[])p.status==="rejected"&&u(p.reason);return l().catch(u)})},w0={js:async()=>(await st(async()=>{const{javascript:n}=await import("./index-BLLxsupM.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).javascript({jsx:!0}),cjs:async()=>(await st(async()=>{const{javascript:n}=await import("./index-BLLxsupM.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).javascript(),mjs:async()=>(await st(async()=>{const{javascript:n}=await import("./index-BLLxsupM.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).javascript(),jsx:async()=>(await st(async()=>{const{javascript:n}=await import("./index-BLLxsupM.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).javascript({jsx:!0}),ts:async()=>(await st(async()=>{const{javascript:n}=await import("./index-BLLxsupM.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).javascript({typescript:!0}),mts:async()=>(await st(async()=>{const{javascript:n}=await import("./index-BLLxsupM.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).javascript({typescript:!0}),cts:async()=>(await st(async()=>{const{javascript:n}=await import("./index-BLLxsupM.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).javascript({typescript:!0}),tsx:async()=>(await st(async()=>{const{javascript:n}=await import("./index-BLLxsupM.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).javascript({typescript:!0,jsx:!0}),json:async()=>(await st(async()=>{const{json:n}=await import("./index-DIouQVG8.js");return{json:n}},__vite__mapDeps([7,1,2,3,4,5]),import.meta.url)).json(),jsonc:async()=>(await st(async()=>{const{json:n}=await import("./index-DIouQVG8.js");return{json:n}},__vite__mapDeps([7,1,2,3,4,5]),import.meta.url)).json(),css:async()=>(await st(async()=>{const{css:n}=await import("./index-DqxhStF7.js");return{css:n}},__vite__mapDeps([8,1,2,3,4,5]),import.meta.url)).css(),scss:async()=>(await st(async()=>{const{css:n}=await import("./index-DqxhStF7.js");return{css:n}},__vite__mapDeps([8,1,2,3,4,5]),import.meta.url)).css(),less:async()=>(await st(async()=>{const{css:n}=await import("./index-DqxhStF7.js");return{css:n}},__vite__mapDeps([8,1,2,3,4,5]),import.meta.url)).css(),html:async()=>(await st(async()=>{const{html:n}=await import("./index-DqLAItfN.js");return{html:n}},__vite__mapDeps([9,1,8,2,3,4,5,0,6]),import.meta.url)).html(),htm:async()=>(await st(async()=>{const{html:n}=await import("./index-DqLAItfN.js");return{html:n}},__vite__mapDeps([9,1,8,2,3,4,5,0,6]),import.meta.url)).html(),vue:async()=>(await st(async()=>{const{html:n}=await import("./index-DqLAItfN.js");return{html:n}},__vite__mapDeps([9,1,8,2,3,4,5,0,6]),import.meta.url)).html(),svelte:async()=>(await st(async()=>{const{html:n}=await import("./index-DqLAItfN.js");return{html:n}},__vite__mapDeps([9,1,8,2,3,4,5,0,6]),import.meta.url)).html(),md:async()=>(await st(async()=>{const{markdown:n}=await import("./index-DlMbLAnE.js");return{markdown:n}},__vite__mapDeps([10,3,4,5,2,6,9,1,8,0]),import.meta.url)).markdown(),markdown:async()=>(await st(async()=>{const{markdown:n}=await import("./index-DlMbLAnE.js");return{markdown:n}},__vite__mapDeps([10,3,4,5,2,6,9,1,8,0]),import.meta.url)).markdown(),py:async()=>(await st(async()=>{const{python:n}=await import("./index-C13EW7hw.js");return{python:n}},__vite__mapDeps([11,1,2,3,4,5,6]),import.meta.url)).python(),pyi:async()=>(await st(async()=>{const{python:n}=await import("./index-C13EW7hw.js");return{python:n}},__vite__mapDeps([11,1,2,3,4,5,6]),import.meta.url)).python(),yaml:async()=>(await st(async()=>{const{yaml:n}=await import("./index-BK9FAkRg.js");return{yaml:n}},__vite__mapDeps([12,1,2,3,4,5]),import.meta.url)).yaml(),yml:async()=>(await st(async()=>{const{yaml:n}=await import("./index-BK9FAkRg.js");return{yaml:n}},__vite__mapDeps([12,1,2,3,4,5]),import.meta.url)).yaml(),rs:async()=>(await st(async()=>{const{rust:n}=await import("./index-Cbs1XkJa.js");return{rust:n}},__vite__mapDeps([13,1,2,3,4,5]),import.meta.url)).rust(),c:async()=>(await st(async()=>{const{cpp:n}=await import("./index-DaBTH0ea.js");return{cpp:n}},__vite__mapDeps([14,1,2,3,4,5]),import.meta.url)).cpp(),h:async()=>(await st(async()=>{const{cpp:n}=await import("./index-DaBTH0ea.js");return{cpp:n}},__vite__mapDeps([14,1,2,3,4,5]),import.meta.url)).cpp(),cc:async()=>(await st(async()=>{const{cpp:n}=await import("./index-DaBTH0ea.js");return{cpp:n}},__vite__mapDeps([14,1,2,3,4,5]),import.meta.url)).cpp(),cpp:async()=>(await st(async()=>{const{cpp:n}=await import("./index-DaBTH0ea.js");return{cpp:n}},__vite__mapDeps([14,1,2,3,4,5]),import.meta.url)).cpp(),hpp:async()=>(await st(async()=>{const{cpp:n}=await import("./index-DaBTH0ea.js");return{cpp:n}},__vite__mapDeps([14,1,2,3,4,5]),import.meta.url)).cpp(),java:async()=>(await st(async()=>{const{java:n}=await import("./index-v-BrSiuM.js");return{java:n}},__vite__mapDeps([15,1,2,3,4,5]),import.meta.url)).java(),go:async()=>(await st(async()=>{const{go:n}=await import("./index-CE1Pd4z7.js");return{go:n}},__vite__mapDeps([16,1,2,3,4,5,6]),import.meta.url)).go(),php:async()=>(await st(async()=>{const{php:n}=await import("./index-DRJgyVu5.js");return{php:n}},__vite__mapDeps([17,1,9,8,2,3,4,5,0,6]),import.meta.url)).php(),sql:async()=>(await st(async()=>{const{sql:n}=await import("./index-Bod45-bM.js");return{sql:n}},__vite__mapDeps([18,2,3,4,5,1,6]),import.meta.url)).sql(),xml:async()=>(await st(async()=>{const{xml:n}=await import("./index-DtR2v4RD.js");return{xml:n}},__vite__mapDeps([19,1,2,3,4,5]),import.meta.url)).xml(),svg:async()=>(await st(async()=>{const{xml:n}=await import("./index-DtR2v4RD.js");return{xml:n}},__vite__mapDeps([19,1,2,3,4,5]),import.meta.url)).xml()},fk={".mcp.json":"json",dockerfile:"yaml",makefile:"yaml"},hk={javascript:"js",node:"js",typescript:"ts",python:"py",python3:"py",yml:"yaml",rust:"rs",golang:"go","c++":"cpp",cplusplus:"cpp"};async function mk(n){const l=hk[n.toLowerCase()]??n.toLowerCase(),i=w0[l];return i?i().catch(()=>null):null}async function pk(n){const l=(n.split("/").pop()??"").toLowerCase(),i=fk[l]??l.split(".").pop()??"",r=w0[i];return r?r().catch(()=>null):null}const gk=k0([{tag:[Oe.keyword,Oe.modifier,Oe.controlKeyword,Oe.moduleKeyword],class:"cmh-key"},{tag:[Oe.propertyName],class:"cmh-prop"},{tag:[Oe.function(Oe.variableName),Oe.labelName],class:"cmh-fn"},{tag:[Oe.color,Oe.constant(Oe.name),Oe.standard(Oe.name),Oe.bool],class:"cmh-const"},{tag:[Oe.typeName,Oe.className,Oe.changed,Oe.annotation,Oe.self,Oe.namespace],class:"cmh-type"},{tag:[Oe.number,Oe.integer,Oe.float],class:"cmh-num"},{tag:[Oe.string,Oe.special(Oe.string),Oe.regexp],class:"cmh-str"},{tag:[Oe.operator,Oe.operatorKeyword,Oe.escape],class:"cmh-op"},{tag:[Oe.meta,Oe.comment],class:"cmh-comment"},{tag:Oe.invalid,class:"cmh-invalid"}]);function fh(n){return n.replace(/[&<>]/g,l=>l==="&"?"&amp;":l==="<"?"&lt;":"&gt;")}async function xk(n,l){const i=l?await mk(l):null;if(!i)return fh(n);try{const r=i.language.parser.parse(n);let o="";return rk(n,r,gk,(u,m)=>{o+=m?`<span class="${m}">${fh(u)}</span>`:fh(u)},()=>{o+=`
118
+ `}),o}catch{return fh(n)}}Bt.setOptions({gfm:!0,breaks:!1});function Id(n){var i;const l=(i=n.split(".").pop())==null?void 0:i.toLowerCase();return l==="md"||l==="markdown"}function Ph(n){var i;const l=(i=n.split(".").pop())==null?void 0:i.toLowerCase();return l==="html"||l==="htm"||l==="svg"}const _k={html:"html",svg:"svg",mermaid:"mermaid"};function Ab(n){return n.replace(/[&<>"']/g,l=>l==="&"?"&amp;":l==="<"?"&lt;":l===">"?"&gt;":l==='"'?"&quot;":"&#39;")}const bk=/^\$\$(?!\s)((?:[^$\n]|\$(?!\$))+?)\$\$/,yk=new RegExp("^\\$(?!\\s|\\$)((?:\\.|[^$\\\\n])+?)(?<!\\s)\\$(?!\\d)"),vk=/^ {0,3}\$\$[ \t]*\n?([\s\S]+?)\n?[ \t]*\$\$[ \t]*(?:\n|$)/;function Mb(n,l){return`<span class="math${l?" math--display":""}" data-tex="${Ab(n)}" data-display="${l?"1":"0"}">${Ab(n)}</span>`}Bt.use({extensions:[{name:"blockMath",level:"block",start:n=>{var l;return(l=n.match(/^ {0,3}\$\$/m))==null?void 0:l.index},tokenizer(n){const l=vk.exec(n);if(l)return{type:"blockMath",raw:l[0],text:l[1].trim()}},renderer:n=>Mb(n.text,!0)+`
119
+ `},{name:"inlineMath",level:"inline",start:n=>n.indexOf("$"),tokenizer(n){const l=bk.exec(n);if(l)return{type:"inlineMath",raw:l[0],text:l[1],display:!0};const i=yk.exec(n);if(i)return{type:"inlineMath",raw:i[0],text:i[1],display:!1}},renderer:n=>Mb(n.text,n.display===!0)}],renderer:{code(n){const l=_k[(n.lang??"").trim().toLowerCase().split(/\s/)[0]??""];if(!l)return!1;const i=n.source??n.text;return`<div class="embed" data-embed="${l}" data-source="${encodeURIComponent(i)}"><pre><code class="language-${l}">${n.text}</code></pre></div>
120
+ `}}});async function Hd(n){const l=await Bt.parse(n,{async:!0,walkTokens:async i=>{if(i.type!=="code")return;const r=i;r.source=r.text,r.text=await xk(r.text,r.lang??""),r.escaped=!0}});return BN.sanitize(l)}const S0="ccv.markdownMode";function Rb(){try{const n=localStorage.getItem(S0);if(n==="text"||n==="code"||n==="preview")return n}catch{}return"preview"}function jk(n){try{localStorage.setItem(S0,n)}catch{}}function Nk(n){return n.previewMode?"preview":n.textMode?"text":"code"}function Db(n,l){return{path:n.path,text:n.content,saved:n.content,eol:n.eol,encoding:n.encoding,mtime:n.mtime,size:n.size,binary:n.binary,tooLarge:n.tooLarge,mediaMime:n.mediaMime,mediaTooLarge:n.mediaTooLarge,stale:!1,revision:l,previewMode:Ph(n.path)||Id(n.path)&&Rb()==="preview",textMode:Id(n.path)&&Rb()==="text"}}function ai(n){return!n.binary&&!n.tooLarge&&n.text!==n.saved}function ig(n){return n.split("/").pop()??n}function Wr(n){const l=n.lastIndexOf("/");return l===-1?"":n.slice(0,l)}function Ad(n){return n<1024?`${n} Б`:n<1024*1024?`${(n/1024).toFixed(1)} КБ`:`${(n/1024/1024).toFixed(1)} МБ`}function kk(n){return`data:${n.mime};base64,${n.base64}`}const wk=/!\[([^\]\n]*)\]\(\s*(<[^>\n]*>|[^)\s]*)(?:\s+(?:"[^"\n]*"|'[^'\n]*'))?\s*\)/g,Sk=/<img\b(?:"[^"]*"|'[^']*'|[^>"'])*>/gi,Ek=/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))/g;function Ck(n){const l=[];let i=null;for(const r of n.split(`
121
+ `)){const o=/^ {0,3}(`{3,}|~{3,})/.exec(r);i===null&&o?(i=o[1][0],l.push(" ".repeat(r.length))):i!==null?(o&&o[1][0]===i&&(i=null),l.push(" ".repeat(r.length))):l.push(r.replace(/`[^`\n]*`/g,u=>" ".repeat(u.length)))}return l.join(`
122
+ `)}function Tk(n){return n.replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&amp;/g,"&")}function Lb(n){return n.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}function Ak(n){const l=Ck(n),i=[];for(const r of l.matchAll(wk)){let o=r[2]??"";o.startsWith("<")&&o.endsWith(">")&&(o=o.slice(1,-1)),i.push({from:r.index,to:r.index+r[0].length,raw:n.slice(r.index,r.index+r[0].length),kind:"md",src:o,alt:r[1]??""})}for(const r of l.matchAll(Sk)){const o=n.slice(r.index,r.index+r[0].length),u={};for(const p of o.matchAll(Ek))u[p[1].toLowerCase()]=Tk(p[2]??p[3]??p[4]??"");const m=/^\d+(\.\d+)?(px)?$/.test(u.width??"")?parseFloat(u.width):void 0;i.push({from:r.index,to:r.index+o.length,raw:o,kind:"html",src:u.src??"",alt:u.alt??"",width:m})}return i.sort((r,o)=>r.from-o.from)}function Mk(n,l){if(n.kind==="md")return`<img src="${Lb(n.src)}" alt="${Lb(n.alt)}" width="${l}">`;const i=/\swidth\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/i;return i.test(n.raw)?n.raw.replace(i,` width="${l}"`):n.raw.replace(/\s*\/?>$/,r=>` width="${l}"${r}`)}function Rk(n,l){const i=l.trim();if(!i||/^[a-z][a-z0-9+.-]*:/i.test(i)||i.startsWith("//"))return{kind:"external"};let r=i.replace(/[?#].*$/,"");try{r=decodeURIComponent(r)}catch{}const o=r.startsWith("/")?[]:n.split("/").slice(0,-1);for(const u of r.split("/"))if(!(u===""||u==="."))if(u===".."){if(o.length===0)return{kind:"outside"};o.pop()}else o.push(u);return o.length===0?{kind:"outside"}:{kind:"project",path:o.join("/")}}const Dk={"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/webp":"webp","image/bmp":"bmp","image/svg+xml":"svg","image/avif":"avif"};function Lk(n){return Dk[n]??((n.split("/")[1]??"").replace(/[^a-z0-9]/gi,"").toLowerCase()||"png")}function Ok(n=new Date){const l=i=>String(i).padStart(2,"0");return`${n.getFullYear()}${l(n.getMonth()+1)}${l(n.getDate())}-${l(n.getHours())}${l(n.getMinutes())}${l(n.getSeconds())}`}function zk(n){return((n.split("/").pop()??n).replace(/\.[^.]*$/,"")||"image").replace(/[^\p{L}\p{N}_.-]+/gu,"-").replace(/^-+|-+$/g,"")||"image"}const Qi="application/x-ccv-fs-path",E0="application/x-ccv-fs-kind";function rg(n){return!!n&&Array.from(n.types).includes(Qi)}function C0(n){const l=n.getData(Qi);return l?{path:l,kind:n.getData(E0)==="dir"?"dir":"file"}:null}const Ik=/\.(png|jpe?g|gif|webp|svg|avif|bmp)$/i;function Uk(n){return Ik.test(n)}function $k(n,l,i){const r=n.split("/").slice(0,-1).filter(Boolean),o=l.split("/").filter(Boolean);let u=0;for(;u<r.length&&u<o.length-1&&r[u]===o[u];)u+=1;const p=[...Array(r.length-u).fill(".."),...o.slice(u)].map(_=>_===".."?_:encodeURIComponent(_)).join("/"),g=o[o.length-1]??l;return i==="dir"?`[${g}/](${p}/)`:Uk(g)?`![](${p})`:`[${g}](${p})`}function er({x:n,y:l,items:i,note:r,onClose:o}){const u=x.useRef(null),[m,p]=x.useState({left:n,top:l}),[g,_]=x.useState(()=>{const k=i.findIndex(N=>!N.disabled);return k===-1?0:k}),b=x.useRef(null);x.useLayoutEffect(()=>{const k=u.current;if(!k)return;b.current=document.elementsFromPoint(n,l).find(D=>!k.contains(D))??null;const N=k.getBoundingClientRect(),E=8,C=Math.max(E,Math.min(n,window.innerWidth-N.width-E)),I=Math.max(E,Math.min(l,window.innerHeight-N.height-E));p({left:C,top:I})},[n,l]),x.useLayoutEffect(()=>{var k;(k=u.current)==null||k.focus()},[]),x.useLayoutEffect(()=>{function k(E){var C;(C=u.current)!=null&&C.contains(E.target)||o()}function N(E){var D;const C=E.target;if(C===document||C===document.documentElement){o();return}if(!(C instanceof Node)||(D=u.current)!=null&&D.contains(C))return;const I=b.current;(!I||C.contains(I))&&o()}return document.addEventListener("mousedown",k),document.addEventListener("scroll",N,!0),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("scroll",N,!0)}},[o]);function j(k){k.disabled||(k.onSelect(),o())}function v(k){if(k.key==="Escape"){k.preventDefault(),k.stopPropagation(),o();return}const N=i.map((E,C)=>({item:E,index:C})).filter(E=>!E.item.disabled);if(N.length!==0){if(k.key==="ArrowDown"||k.key==="ArrowUp"){k.preventDefault();const E=k.key==="ArrowDown"?1:-1,C=N.findIndex(D=>D.index===g),I=N[(((C===-1?0:C)+E)%N.length+N.length)%N.length];I&&_(I.index);return}if(k.key==="Enter"||k.key===" "){k.preventDefault();const E=i[g];E&&j(E)}}}return s.jsxs("div",{ref:u,className:"ctxmenu",style:{left:m.left,top:m.top},role:"menu",tabIndex:-1,onKeyDown:v,children:[r&&s.jsx("div",{className:"ctxmenu__note",children:r}),i.map((k,N)=>s.jsxs("button",{type:"button",role:"menuitem","aria-disabled":k.disabled,className:"ctxmenu__item"+(N===g?" is-cursor":""),onMouseEnter:()=>_(N),onClick:()=>j(k),children:[s.jsx("span",{className:"ctxmenu__label",children:k.label}),k.hint&&s.jsx("span",{className:"ctxmenu__hint",children:k.hint})]},k.id))]})}const Bk=3500,Hk=9e3,Ob=220;function ec({result:n,onDismiss:l}){const[i,r]=x.useState(n),[o,u]=x.useState(!1);if(x.useEffect(()=>{if(!n){r(null),u(!1);return}if(r(n),u(!1),n.url)return;const p=n.ok?Bk:Hk,g=setTimeout(()=>u(!0),p),_=setTimeout(()=>r(null),p+Ob);return()=>{clearTimeout(g),clearTimeout(_)}},[n]),!i)return null;const m=()=>{u(!0),setTimeout(()=>{r(null),l==null||l()},Ob)};return s.jsxs("div",{className:"oplog "+(i.ok?"oplog--ok":"oplog--bad")+(o?" oplog--leaving":"")+(i.url?" oplog--dismissible":""),role:"status","aria-live":i.ok?"polite":"assertive",children:[i.message,i.url&&s.jsxs("a",{className:"oplog__link",href:i.url,target:"_blank",rel:"noreferrer",onClick:p=>p.stopPropagation(),children:[i.url.replace(/^https?:\/\//,"")," ↗"]}),i.url&&l&&s.jsx("button",{type:"button",className:"oplog__dismiss",title:"Закрыть","aria-label":"Закрыть сообщение",onClick:m,children:"✕"})]})}function oi({value:n,className:l,placeholder:i="Название сессии",onCommit:r,onCancel:o}){const[u,m]=x.useState(n),p=x.useRef(null);x.useEffect(()=>{var _;(_=p.current)==null||_.select()},[]);function g(){const _=u.trim();if(!_||_===n)return o();r(_)}return s.jsx("input",{ref:p,className:l?`rename ${l}`:"rename",value:u,autoFocus:!0,spellCheck:!1,placeholder:i,onChange:_=>m(_.target.value),onBlur:g,onKeyDown:_=>{_.stopPropagation(),_.key==="Enter"?(_.preventDefault(),g()):_.key==="Escape"&&(_.preventDefault(),o())}})}function _u({active:n}){return n?s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("path",{d:"M2 5h3V2"}),s.jsx("path",{d:"M14 5h-3V2"}),s.jsx("path",{d:"M2 11h3v3"}),s.jsx("path",{d:"M14 11h-3v3"})]}):s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("path",{d:"M5 2H2v3"}),s.jsx("path",{d:"M11 2h3v3"}),s.jsx("path",{d:"M2 11v3h3"}),s.jsx("path",{d:"M14 11v3h-3"})]})}const qk=500,Gk=200;function Yk({open:n,tree:l,expanded:i,activePath:r,dirty:o,gitChanges:u,result:m,searchResult:p,onSearch:g,onReveal:_,onToggle:b,onOpen:j,onCreate:v,onRename:k,onMove:N,onCopy:E,onDelete:C,onRefresh:I,onClose:D,zoomed:G,onToggleZoom:P}){const[V,z]=x.useState(""),[H,te]=x.useState(null),[F,fe]=x.useState(null),[Q,X]=x.useState(null),[ge,U]=x.useState(null),[L,M]=x.useState(null),[O,J]=x.useState(null),le=$d("(hover: hover)"),ce=x.useRef(null),A=x.useMemo(()=>Fk(u),[u]);function W(_e){return!(!Q||_e===Q.path||Q.kind==="dir"&&_e.startsWith(`${Q.path}/`)||_e===Wr(Q.path))}function me(_e){return!(!L||_e===L.path||L.kind==="dir"&&_e.startsWith(`${L.path}/`)||L.mode==="cut"&&_e===Wr(L.path))}function Ee(_e){M({path:_e.path,kind:_e.kind,mode:"copy"})}function $(_e){M({path:_e.path,kind:_e.kind,mode:"cut"})}function de(_e){!L||!me(_e)||(_e&&!i.has(_e)&&b(_e),L.mode==="cut"?(N(L.path,_e),M(null)):E(L.path,_e))}function ae(_e,Ae){const Pe=_e.touches[0];if(!Pe)return;const et={timer:0,x:Pe.clientX,y:Pe.clientY,el:_e.currentTarget,fired:!1};et.timer=window.setTimeout(()=>{et.fired=!0,Ae(et.x,et.y,et.el)},qk),ce.current=et}function qe(_e){const Ae=ce.current,Pe=_e.touches[0];!Ae||!Pe||Math.hypot(Pe.clientX-Ae.x,Pe.clientY-Ae.y)>10&&(window.clearTimeout(Ae.timer),ce.current=null)}function Se(_e){const Ae=ce.current;Ae&&(window.clearTimeout(Ae.timer),Ae.fired&&_e.preventDefault())}function Ge(){var _e;return(_e=ce.current)!=null&&_e.fired?(ce.current=null,!0):!1}function Ve(_e,Ae,Pe,et){z((et==null?void 0:et.path)??""),J({x:_e,y:Ae,opener:Pe,entry:et})}function Je(){const _e=O==null?void 0:O.opener;J(null),_e!=null&&_e.isConnected&&_e.focus()}function Ft(_e){return{onContextMenu:Ae=>{Ae.preventDefault(),Ve(Ae.clientX,Ae.clientY,Ae.currentTarget,_e)},onTouchStart:Ae=>ae(Ae,(Pe,et,Qe)=>Ve(Pe,et,Qe,_e)),onTouchMove:qe,onTouchEnd:Se,onTouchCancel:Se}}function dt(_e){_e.target===_e.currentTarget&&(_e.preventDefault(),Ve(_e.clientX,_e.clientY,_e.currentTarget,null))}function jn(_e){_e.target===_e.currentTarget&&ae(_e,(Ae,Pe,et)=>Ve(Ae,Pe,et,null))}function Ze(_e){if(!(_e.ctrlKey||_e.metaKey)||_e.target instanceof HTMLInputElement)return;const Ae=_e.key.toLowerCase();if(Ae==="v"){_e.preventDefault(),de(fs());return}if(!V)return;const Pe=zb(l,V);Pe&&(Ae==="c"?(_e.preventDefault(),Ee(Pe)):Ae==="x"&&(_e.preventDefault(),$(Pe)))}function js(_e){return Ae=>{Ae.dataTransfer.effectAllowed="copyMove",Ae.dataTransfer.setData(Qi,_e.path),Ae.dataTransfer.setData(E0,_e.kind),X({path:_e.path,kind:_e.kind})}}function lt(){X(null),U(null)}function mt(_e){return Ae=>{Ae.dataTransfer.types.includes(Qi)&&(Ae.stopPropagation(),!(_e.kind!=="dir"||!W(_e.path))&&(Ae.preventDefault(),Ae.dataTransfer.dropEffect="move",U(_e.path)))}}function Me(_e){return Ae=>{if(!Ae.dataTransfer.types.includes(Qi)||(Ae.stopPropagation(),_e.kind!=="dir"||!W(_e.path)))return;Ae.preventDefault();const Pe=Ae.dataTransfer.getData(Qi);U(null),Pe&&N(Pe,_e.path)}}function nt(_e){!_e.dataTransfer.types.includes(Qi)||!W("")||(_e.preventDefault(),_e.dataTransfer.dropEffect="move",U(""))}function In(_e){if(!_e.dataTransfer.types.includes(Qi)||!W(""))return;_e.preventDefault();const Ae=_e.dataTransfer.getData(Qi);U(null),Ae&&N(Ae,"")}const[kt,ut]=x.useState(""),Un=kt.trim(),$n=Un.length>0,Gt=x.useRef(null),it=x.useRef(g);it.current=g;function vt(_e){ut(_e),Gt.current&&clearTimeout(Gt.current);const Ae=_e.trim();if(!Ae){it.current("");return}Gt.current=setTimeout(()=>it.current(Ae),Gk)}function Kt(_e){Gt.current&&clearTimeout(Gt.current),ut(""),it.current(""),z(_e.path),_(_e)}const es=$n&&(p==null?void 0:p.query)===Un?p:null;function fs(){if(V==="")return"";const _e=zb(l,V);if((_e==null?void 0:_e.kind)==="dir")return V;const Ae=V.lastIndexOf("/");return Ae===-1?"":V.slice(0,Ae)}function Tt(_e,Ae){const Pe=Ae??fs();Pe&&!i.has(Pe)&&b(Pe),fe({parent:Pe,kind:_e})}function Lt(){if(!O)return[];const _e=et=>le?et:void 0;if(!O.entry)return[{id:"paste",label:"Вставить в корень проекта",hint:_e("Ctrl+V"),disabled:!me(""),onSelect:()=>de("")},{id:"new-file",label:"Создать файл",onSelect:()=>Tt("file","")},{id:"new-dir",label:"Создать каталог",onSelect:()=>Tt("dir","")}];const Ae=O.entry,Pe=[Ae.kind==="file"?{id:"open",label:"Открыть",onSelect:()=>j(Ae.path)}:{id:"toggle",label:i.has(Ae.path)?"Свернуть":"Развернуть",onSelect:()=>b(Ae.path)},{id:"copy",label:"Копировать",hint:_e("Ctrl+C"),onSelect:()=>Ee(Ae)},{id:"cut",label:"Вырезать",hint:_e("Ctrl+X"),onSelect:()=>$(Ae)}];return Ae.kind==="dir"&&(Pe.push({id:"paste",label:"Вставить",hint:_e("Ctrl+V"),disabled:!me(Ae.path),onSelect:()=>de(Ae.path)}),Pe.push({id:"new-file",label:"Создать файл",onSelect:()=>Tt("file",Ae.path)}),Pe.push({id:"new-dir",label:"Создать каталог",onSelect:()=>Tt("dir",Ae.path)})),Pe.push({id:"rename",label:"Переименовать",onSelect:()=>te(Ae.path)}),Pe.push({id:"delete",label:"Удалить",onSelect:()=>C(Ae)}),Pe}const fn=$n?[]:Qt("",0);function Qt(_e,Ae){const Pe=l[_e],et=[];if(F&&F.parent===_e&&et.push(s.jsxs("div",{className:"fsrow fsrow--draft",style:Zi(Ae),children:[s.jsx("span",{className:"fsrow__icon",children:F.kind==="dir"?s.jsx(qh,{}):s.jsx(Gh,{})}),s.jsx(oi,{className:"rename--file",value:"",placeholder:F.kind==="dir"?"имя каталога":"имя файла",onCommit:Qe=>{fe(null),v(_e,F.kind,Qe)},onCancel:()=>fe(null)})]},`draft:${_e}`)),!Pe)return et.push(s.jsx("p",{className:"fsrow__pending",style:Zi(Ae),children:"читаем…"},`wait:${_e}`)),et;Pe.length===0&&!F&&et.push(s.jsx("p",{className:"fsrow__pending",style:Zi(Ae),children:"пусто"},`empty:${_e}`));for(const Qe of Pe){const Ot=Qe.kind==="dir"&&i.has(Qe.path);et.push(H===Qe.path?s.jsxs("div",{className:"fsrow fsrow--draft",style:Zi(Ae),children:[s.jsx("span",{className:"fsrow__icon",children:Qe.kind==="dir"?s.jsx(qh,{open:Ot}):s.jsx(Gh,{})}),s.jsx(oi,{className:"rename--file",value:Qe.name,placeholder:"новое имя",onCommit:Zt=>{te(null),k(Qe.path,Zt)},onCancel:()=>te(null)})]},Qe.path):s.jsx(Vk,{entry:Qe,depth:Ae,open:Ot,active:Qe.path===r,selected:Qe.path===V,dirty:o.has(Qe.path),gitStatus:A.get(Qe.path),dragging:(Q==null?void 0:Q.path)===Qe.path,dropTarget:ge===Qe.path,cut:(L==null?void 0:L.mode)==="cut"&&L.path===Qe.path,onClick:()=>{Ge()||(z(Qe.path),Qe.kind==="dir"?b(Qe.path):j(Qe.path))},onRename:()=>te(Qe.path),onDelete:()=>C(Qe),onDragStart:js(Qe),onDragEnd:lt,onDragOver:mt(Qe),onDrop:Me(Qe),...Ft(Qe)},Qe.path)),Ot&&et.push(...Qt(Qe.path,Ae+1))}return et}function zs(){if(!es)return[s.jsx("p",{className:"fsrow__pending",style:Zi(0),children:"ищем…"},"search:wait")];if(es.entries.length===0)return[s.jsx("p",{className:"fsrow__pending",style:Zi(0),children:"ничего не найдено"},"search:empty")];const _e=es.entries.map(Ae=>s.jsx(Xk,{entry:Ae,gitStatus:A.get(Ae.path),onClick:()=>Kt(Ae)},Ae.path));return es.truncated&&_e.push(s.jsxs("p",{className:"fsrow__pending",style:Zi(0),children:["показаны первые ",es.entries.length," — уточните запрос"]},"search:truncated")),_e}return s.jsxs("aside",{className:(n?"sidepane sidepane--files sidepane--open":"sidepane sidepane--files")+(G?" sidepane--zoomed":""),"aria-label":"Файлы проекта",onKeyDown:Ze,children:[s.jsxs("div",{className:"sidepane__head",onDoubleClick:_e=>{P&&(_e.target.closest("button")||P())},children:[s.jsx(Pk,{}),s.jsx("span",{className:"sidepane__title",children:"Файлы"}),s.jsx("button",{className:"sidepane__btn",title:"Новый файл","aria-label":"Новый файл",onClick:()=>Tt("file"),children:s.jsx(Qk,{})}),s.jsx("button",{className:"sidepane__btn",title:"Новый каталог","aria-label":"Новый каталог",onClick:()=>Tt("dir"),children:s.jsx(Zk,{})}),s.jsx("button",{className:"sidepane__btn",title:"Перечитать дерево","aria-label":"Перечитать дерево",onClick:I,children:"↻"}),P&&s.jsx("button",{className:"sidepane__btn",title:G?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":G?"Свернуть панель файлов":"Развернуть панель файлов на весь экран","aria-pressed":G,onClick:P,children:s.jsx(_u,{active:G})}),s.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель файлов",onClick:D,children:"✕"})]}),s.jsxs("div",{className:"fssearch",children:[s.jsx(Wk,{}),s.jsx("input",{className:"fssearch__input",type:"text",value:kt,spellCheck:!1,placeholder:"Поиск файлов и папок…","aria-label":"Поиск файлов и папок",onChange:_e=>vt(_e.target.value),onKeyDown:_e=>{_e.stopPropagation(),_e.key==="Escape"&&(_e.preventDefault(),kt?vt(""):_e.currentTarget.blur())}}),kt&&s.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>vt(""),children:"✕"})]}),s.jsx("div",{className:"sidepane__scroll fstree"+(ge===""?" fstree--drop-target":""),tabIndex:-1,onDragOver:nt,onDrop:In,onContextMenu:dt,onTouchStart:jn,onTouchMove:qe,onTouchEnd:Se,onTouchCancel:Se,children:$n?zs():fn}),s.jsx(ec,{result:m}),O&&s.jsx(er,{x:O.x,y:O.y,items:Lt(),onClose:Je})]})}function Vk({entry:n,depth:l,open:i,active:r,selected:o,dirty:u,gitStatus:m,dragging:p,dropTarget:g,cut:_,onClick:b,onRename:j,onDelete:v,onDragStart:k,onDragEnd:N,onDragOver:E,onDrop:C,onContextMenu:I,onTouchStart:D,onTouchMove:G,onTouchEnd:P,onTouchCancel:V}){const z="fsrow"+(r?" is-open":"")+(o&&!r?" is-selected":"")+(n.ignored?" fsrow--ignored":"")+(p?" fsrow--dragging":"")+(g?" fsrow--drop-target":"")+(_?" fsrow--cut":"");return s.jsxs("div",{className:z,style:Zi(l),draggable:!0,onDragStart:k,onDragEnd:N,onDragOver:E,onDrop:C,onContextMenu:I,onTouchStart:D,onTouchMove:G,onTouchEnd:P,onTouchCancel:V,children:[s.jsxs("button",{className:"fsrow__main",onClick:b,title:T0(n),children:[s.jsx("span",{className:"fsrow__icon"+Hh("fsrow__icon",m),children:n.kind==="dir"?s.jsx(qh,{open:i}):s.jsx(Gh,{})}),s.jsx("span",{className:"fsrow__name"+Hh("fsrow__name",m),children:n.name}),n.ignored&&s.jsx("span",{className:"fsrow__tag",title:"Игнорируется git (.gitignore)",children:"git-ignore"}),u&&s.jsx("span",{className:"fsrow__dot",title:"Есть несохранённые правки"})]}),s.jsx("button",{className:"fsrow__act",title:"Переименовать","aria-label":`Переименовать ${n.name}`,onClick:j,children:"✎"}),s.jsx("button",{className:"fsrow__act",title:"Удалить","aria-label":`Удалить ${n.name}`,onClick:v,children:"✕"})]})}function Xk({entry:n,gitStatus:l,onClick:i}){const r=n.path.slice(0,n.path.length-n.name.length-1);return s.jsxs("button",{className:"fsrow fsrow--search"+(n.ignored?" fsrow--ignored":""),style:Zi(0),onClick:i,title:T0(n),children:[s.jsx("span",{className:"fsrow__icon"+Hh("fsrow__icon",l),children:n.kind==="dir"?s.jsx(qh,{}):s.jsx(Gh,{})}),s.jsx("span",{className:"fsrow__name"+Hh("fsrow__name",l),children:n.name}),n.ignored&&s.jsx("span",{className:"fsrow__tag",children:"git-ignore"}),r&&s.jsx("span",{className:"fsrow__path",children:r})]})}function T0(n){return n.ignored?`${n.path} — игнорируется git (.gitignore)`:n.path}function Zi(n){return{"--depth":n}}function zb(n,l){var o;const i=l.lastIndexOf("/"),r=i===-1?"":l.slice(0,i);return((o=n[r])==null?void 0:o.find(u=>u.path===l))??null}function Fk(n){const l=new Map,i={added:1,modified:2},r=(o,u)=>{const m=l.get(o);(!m||i[u]>i[m])&&l.set(o,u)};for(const o of n){const u=Kk(o.status);if(!u)continue;r(o.path,u);let m=Wr(o.path);for(;r(m,u),!!m;)m=Wr(m)}return l}function Kk(n){if(n==="??")return"added";const[l="",i=""]=n;return l==="A"||l==="R"||l==="C"?"added":l==="M"||i==="M"?"modified":null}function Hh(n,l){return l?` ${n}--git-${l}`:""}function qh({open:n=!1}){return s.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,"aria-hidden":"true",children:n?s.jsx("path",{d:"M2 12.5V4.2a.7.7 0 0 1 .7-.7h3.1l1.5 1.6h4.4a.7.7 0 0 1 .7.7v1.2M2 12.5l1.7-4.6a.7.7 0 0 1 .66-.46h9.2a.5.5 0 0 1 .47.66L12.4 12.5Z"}):s.jsx("path",{d:"M2 12.4V4.2a.7.7 0 0 1 .7-.7h3.1l1.5 1.6h5.9a.7.7 0 0 1 .7.7v6.6a.7.7 0 0 1-.7.7H2.7a.7.7 0 0 1-.7-.7Z"})})}function Gh(){return s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("path",{d:"M9 2H4.4a.7.7 0 0 0-.7.7v10.6a.7.7 0 0 0 .7.7h7.2a.7.7 0 0 0 .7-.7V5.2Z"}),s.jsx("path",{d:"M9 2v3.2h3.3"})]})}function Qk(){return s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,"aria-hidden":"true",children:[s.jsxs("g",{transform:"translate(-1.3,-1.6) scale(0.78)",strokeLinejoin:"round",children:[s.jsx("path",{d:"M9 2H4.4a.7.7 0 0 0-.7.7v10.6a.7.7 0 0 0 .7.7h7.2a.7.7 0 0 0 .7-.7V5.2Z"}),s.jsx("path",{d:"M9 2v3.2h3.3"})]}),s.jsx("path",{d:"M12.2 10.3v3.8M10.3 12.2h3.8",strokeLinecap:"round"})]})}function Zk(){return s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,"aria-hidden":"true",children:[s.jsx("g",{transform:"translate(-1.3,-1.6) scale(0.78)",children:s.jsx("path",{d:"M2 12.4V4.2a.7.7 0 0 1 .7-.7h3.1l1.5 1.6h5.9a.7.7 0 0 1 .7.7v6.6a.7.7 0 0 1-.7.7H2.7a.7.7 0 0 1-.7-.7Z"})}),s.jsx("path",{d:"M12.2 10.3v3.8M10.3 12.2h3.8",strokeLinecap:"round"})]})}function Pk(){return s.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[s.jsx("path",{d:"M2 4.1V3a.6.6 0 0 1 .6-.6h2.6l1.2 1.4h5a.6.6 0 0 1 .6.6v1.1"}),s.jsx("path",{d:"M2 12.6V5.7h11.4a.6.6 0 0 1 .58.75l-1.5 6.2a.6.6 0 0 1-.58.45H2.6a.6.6 0 0 1-.6-.5Z"})]})}function Wk(){return s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[s.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),s.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}const Jk=200;function ew({open:n,result:l,onSearch:i,onOpenMatch:r,onClose:o,zoomed:u,onToggleZoom:m}){const[p,g]=x.useState(""),_=p.trim(),b=_.length>0,j=x.useRef(null),v=x.useRef(i);v.current=i;function k(C){g(C),j.current&&clearTimeout(j.current);const I=C.trim();if(!I){v.current("");return}j.current=setTimeout(()=>v.current(I),Jk)}const N=b&&(l==null?void 0:l.query)===_?l:null;function E(){if(!N)return[s.jsx("p",{className:"fsrow__pending",children:"ищем…"},"grep:wait")];if(N.matches.length===0)return[s.jsx("p",{className:"fsrow__pending",children:"ничего не найдено"},"grep:empty")];const C=[];let I="";for(const D of N.matches)D.path!==I&&(I=D.path,C.push(s.jsx("p",{className:"searchgroup__path",title:D.path,children:D.path},`path:${D.path}`))),C.push(s.jsx(tw,{match:D,onClick:()=>r(D)},`${D.path}:${D.line}:${D.column}`));return N.truncated&&C.push(s.jsxs("p",{className:"fsrow__pending",children:["показаны первые ",N.matches.length," — уточните запрос"]},"grep:truncated")),C}return s.jsxs("aside",{className:(n?"sidepane sidepane--search sidepane--open":"sidepane sidepane--search")+(u?" sidepane--zoomed":""),"aria-label":"Поиск по тексту в проекте",children:[s.jsxs("div",{className:"sidepane__head",onDoubleClick:C=>{m&&(C.target.closest("button")||m())},children:[s.jsx(nw,{}),s.jsx("span",{className:"sidepane__title",children:"Поиск по тексту"}),m&&s.jsx("button",{className:"sidepane__btn",title:u?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":u?"Свернуть панель поиска":"Развернуть панель поиска на весь экран","aria-pressed":u,onClick:m,children:s.jsx(_u,{active:u})}),s.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель поиска",onClick:o,children:"✕"})]}),s.jsxs("div",{className:"fssearch",children:[s.jsx(sw,{}),s.jsx("input",{className:"fssearch__input",type:"text",value:p,spellCheck:!1,placeholder:"Поиск по тексту во всех файлах…","aria-label":"Поиск по тексту во всех файлах",onChange:C=>k(C.target.value),onKeyDown:C=>{C.stopPropagation(),C.key==="Escape"&&(C.preventDefault(),p?k(""):C.currentTarget.blur())}}),p&&s.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>k(""),children:"✕"})]}),s.jsx("div",{className:"sidepane__scroll fstree",children:b?E():s.jsx("p",{className:"sidepane__empty",children:"Введите текст, чтобы найти его во всех файлах проекта."})})]})}function tw({match:n,onClick:l}){const i=n.lineText.slice(0,n.column-1),r=n.lineText.slice(n.column-1,n.column-1+n.matchLength),o=n.lineText.slice(n.column-1+n.matchLength);return s.jsxs("button",{className:"searchmatch",onClick:l,title:`${n.path}:${n.line}`,children:[s.jsx("span",{className:"searchmatch__line",children:n.line}),s.jsxs("span",{className:"searchmatch__text",children:[i,s.jsx("mark",{children:r}),o]})]})}function nw(){return s.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[s.jsx("circle",{cx:"6.8",cy:"6.8",r:"4.3"}),s.jsx("path",{d:"M13.2 13.2 10.1 10.1"})]})}function sw(){return s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[s.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),s.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}let hh=null;function lw(){return hh||(hh=Promise.all([st(()=>import("./index-DtwnaAnT.js"),__vite__mapDeps([20,4,3,5,2,21,6]),import.meta.url),st(()=>import("./index-PAORgBv5.js").then(n=>n.v),__vite__mapDeps([4,3,5]),import.meta.url),st(()=>import("./index-BHot-lnj.js"),[],import.meta.url),st(()=>import("./index-BJHr8-zK.js"),__vite__mapDeps([21,3,4,5,2]),import.meta.url),st(()=>import("./codemirror-Dh-4cMdO.js"),__vite__mapDeps([22,2,3,4,5]),import.meta.url),st(()=>import("./codemirrorImages-BHHbVBQN.js"),__vite__mapDeps([23,4,3,5]),import.meta.url)]).then(([n,l,i,r,o,u])=>({EditorView:l.EditorView,EditorState:i.EditorState,Compartment:i.Compartment,EditorSelection:i.EditorSelection,Prec:i.Prec,keymap:l.keymap,indentWithTab:r.indentWithTab,basicSetup:n.basicSetup,editorTheme:o.editorTheme,editorHighlight:o.editorHighlight,markdownImages:u.markdownImages,refreshImages:u.refreshImages})).catch(n=>{throw hh=null,n})),hh}const aw=new Set(["md","markdown","txt","rst","adoc"]);function iw(n){var l;return aw.has(((l=n.split(".").pop())==null?void 0:l.toLowerCase())??"")}function rw({path:n,doc:l,revision:i,goto:r,onChange:o,onSave:u,images:m,onRequestImage:p,onPasteImage:g}){const _=x.useRef(null),b=x.useRef(null),j=x.useRef(null),v=x.useRef(new Map),k=x.useRef(new Map),N=x.useRef(new Set),E=x.useRef(null),C=x.useRef(o),I=x.useRef(u),D=x.useRef(n),G=x.useRef(i),P=x.useRef(l);C.current=o,I.current=u,D.current=n,G.current=i,P.current=l;const V=x.useRef(m),z=x.useRef(p),H=x.useRef(g);V.current=m,z.current=p,H.current=g;const[te,F]=x.useState("loading"),[fe,Q]=x.useState(!1);function X(O,J,le){Id(le)&&J.dispatch({effects:O.refreshImages.of(null)})}function ge(O,J,le){const ce=b.current,A=D.current===J&&ce,W=A?ce.state:v.current.get(J);if(!W)return;const me=W.doc.toString().indexOf(le);if(me===-1)return;const Ee={from:me,to:me+le.length};if(A){ce.dispatch({changes:Ee});return}const $=W.update({changes:Ee}).state;v.current.set(J,$),C.current(J,$.doc.toString())}function U(O,J){return[O.markdownImages({getDocPath:()=>J,getImage:le=>V.current[le],requestImage:le=>z.current(le)}),O.EditorView.domEventHandlers({dragover(le){return rg(le.dataTransfer)?(le.preventDefault(),le.dataTransfer&&(le.dataTransfer.dropEffect="copy"),!0):!1},drop(le,ce){if(!le.dataTransfer||!rg(le.dataTransfer))return!1;const A=C0(le.dataTransfer);if(!A)return!1;le.preventDefault();const W=ce.posAtCoords({x:le.clientX,y:le.clientY})??ce.state.selection.main.head,me=$k(J,A.path,A.kind),Ee=ce.state.doc.sliceString(Math.max(0,W-1),W),de=(Ee!==""&&!/\s/.test(Ee)?" ":"")+me;return ce.dispatch({changes:{from:W,insert:de},selection:{anchor:W+de.length},userEvent:"input.drop"}),ce.focus(),!0},paste(le,ce){var me;const A=Array.from(((me=le.clipboardData)==null?void 0:me.files)??[]).filter(Ee=>Ee.type.startsWith("image/"));if(A.length===0)return!1;le.preventDefault();const W=[];for(const Ee of A){const $=H.current(J,Ee,()=>{$&&ge(O,J,$)});$&&W.push($)}return W.length>0&&ce.dispatch(ce.state.replaceSelection(W.join(`
123
+ `))),!0}})]}function L(O,J,le,ce,A){const W=v.current.get(ce),me=k.current.get(ce)===A&&(W==null?void 0:W.doc.length)===P.current.length&&W.doc.toString()===P.current;if(W&&me)le.setState(W),X(O,le,ce);else{const $=O.EditorState.create({doc:P.current,extensions:[O.basicSetup,O.Prec.highest(O.keymap.of([{key:"Mod-s",preventDefault:!0,run:()=>(I.current(D.current),!0)}])),O.keymap.of([O.indentWithTab]),J.of([]),iw(ce)?O.EditorView.lineWrapping:[],Id(ce)?U(O,ce):[],O.editorTheme,O.editorHighlight,O.EditorView.updateListener.of(de=>{de.docChanged&&C.current(D.current,de.state.doc.toString())})]});v.current.set(ce,$),k.current.set(ce,A),le.setState($),N.current.delete(ce)}if(N.current.has(ce))return()=>{};let Ee=!1;return pk(ce).then($=>{Ee||!$||D.current!==ce||(le.dispatch({effects:J.reconfigure($)}),v.current.set(ce,le.state),N.current.add(ce))}),()=>{Ee=!0}}x.useEffect(()=>{if(!_.current)return;let J=!1,le=null,ce=null;F("loading"),Q(!1);const A=window.setTimeout(()=>{J||Q(!0)},200);return(async()=>{let W;try{W=await lw()}catch{window.clearTimeout(A),J||F("error");return}if(J||!_.current)return;window.clearTimeout(A);const me=new W.Compartment;E.current=me,j.current=W,ce=new W.EditorView({parent:_.current}),b.current=ce,le=L(W,me,ce,D.current,G.current),F("ready")})(),()=>{J=!0,window.clearTimeout(A),le==null||le(),ce==null||ce.destroy(),b.current===ce&&(b.current=null),j.current=null,E.current=null}},[]),x.useEffect(()=>{const O=j.current,J=b.current,le=E.current;if(!(!O||!J||!le))return L(O,le,J,n,i)},[n,i]),x.useEffect(()=>{const O=b.current,J=j.current;O&&J&&X(J,O,D.current)},[m]);const M=x.useRef(0);return x.useEffect(()=>{const O=b.current,J=j.current;if(!O||!J||!r||r.token===M.current)return;M.current=r.token;const le=O.state.doc.lines,ce=Math.min(Math.max(r.line,1),le),A=O.state.doc.line(ce),W=Math.min(A.from+Math.max(r.column-1,0),A.to);O.dispatch({selection:J.EditorSelection.cursor(W),effects:J.EditorView.scrollIntoView(W,{y:"center"})}),O.focus()},[r]),x.useEffect(()=>()=>{const O=b.current;O&&v.current.set(n,O.state)},[n]),s.jsxs("div",{className:"editor__code",children:[s.jsx("div",{ref:_,className:"editor__code-surface"+(te==="ready"?"":" is-hidden")}),te==="loading"&&fe&&s.jsxs("div",{className:"editor__state work",role:"status",children:[s.jsxs("div",{className:"work__dots",children:[s.jsx("span",{className:"work__dot"}),s.jsx("span",{className:"work__dot"}),s.jsx("span",{className:"work__dot"})]}),s.jsx("span",{className:"work__label",children:"Загружается редактор…"})]}),te==="error"&&s.jsxs("div",{className:"editor__fallback",children:[s.jsxs("div",{className:"editor__fallback-banner",role:"alert",children:[s.jsx("span",{children:"Редактор не загрузился — ниже только просмотр, без сохранения правок."}),s.jsx("button",{className:"btn btn--sm btn--primary",onClick:()=>window.location.reload(),children:"Перезагрузить страницу"})]}),s.jsx("pre",{className:"editor__fallback-text",children:l})]})]})}var A0=zy();let mh=null,ph=null;function cw(){return mh||(mh=Promise.all([st(()=>import("./katex-DFbIS0RS.js"),[],import.meta.url),st(()=>Promise.resolve({}),__vite__mapDeps([24]),import.meta.url)]).then(([n])=>n.default).catch(n=>{throw mh=null,n})),mh}function ow(){return ph||(ph=st(()=>import("./mermaid.core-Rt-JZroF.js").then(n=>n.bb),__vite__mapDeps([25,26]),import.meta.url).then(n=>n.default).catch(n=>{throw ph=null,n})),ph}async function uw(n){const l=[...n.querySelectorAll(".math[data-tex]")];if(l.length===0)return;let i;try{i=await cw()}catch{return}for(const r of l)r.isConnected&&i.render(r.dataset.tex??"",r,{displayMode:r.dataset.display==="1",throwOnError:!1,trust:!1})}let dw=0,Ib=Promise.resolve();function fw(n,l){const i=Ib.then(async()=>{var u,m;const r=await ow();r.initialize({startOnLoad:!1,securityLevel:"strict",theme:l?"dark":"default",layout:"dagre"});const o=`ccv-mermaid-${++dw}`;try{const{svg:p}=await r.render(o,n);return p}finally{(u=document.getElementById(o))==null||u.remove(),(m=document.getElementById(`d${o}`))==null||m.remove()}});return Ib=i.catch(()=>{}),i}async function ui(n){try{return await navigator.clipboard.writeText(n),!0}catch{}const l=document.createElement("textarea");l.value=n,l.setAttribute("readonly",""),l.style.position="fixed",l.style.opacity="0",document.body.appendChild(l);try{return l.select(),document.execCommand("copy")}catch{return!1}finally{l.remove()}}async function cg(){try{return await navigator.clipboard.readText()}catch{return null}}const zg=1600,Jc="Копировать",ru="Скопировано";function tr({text:n,hint:l,className:i}){const[r,o]=x.useState(!1);return x.useEffect(()=>{if(!r)return;const u=setTimeout(()=>o(!1),zg);return()=>clearTimeout(u)},[r]),x.useEffect(()=>o(!1),[n]),s.jsx("button",{type:"button",className:"copybtn"+(r?" copybtn--done":"")+(i?` ${i}`:""),"aria-label":r?ru:`${Jc} ${l}`,title:r?ru:`${Jc} ${l}`,onClick:()=>{ui(n).then(u=>{u&&o(!0)})},children:r?ru:Jc})}function Wh({doc:n,title:l,className:i}){return s.jsx("iframe",{className:"pvframe"+(i?` ${i}`:""),sandbox:"allow-scripts",srcDoc:n,title:l,referrerPolicy:"no-referrer"})}function M0(n){return'<!doctype html><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><style>html,body{margin:0;height:100%;background:#fff}body{display:flex;align-items:center;justify-content:center}svg{max-width:100%;max-height:100%}</style>'+n}function hw(n,l){return n==="svg"?M0(l):l}function R0(n,l){return n.toLowerCase().endsWith(".svg")?M0(l):l}function D0({doc:n,title:l,onClose:i}){return x.useEffect(()=>{const r=o=>{o.key==="Escape"&&i()};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[i]),A0.createPortal(s.jsxs("div",{className:"pvfull",role:"dialog","aria-modal":"true","aria-label":l,children:[s.jsxs("div",{className:"pvfull__bar",children:[s.jsx("span",{className:"pvfull__title",children:l}),s.jsx("button",{type:"button",className:"btn btn--sm",onClick:i,autoFocus:!0,children:"Закрыть"})]}),s.jsx(Wh,{doc:n,title:l,className:"pvfull__frame"})]}),document.body)}function mw(n){try{return decodeURIComponent(n)}catch{return n}}function L0(n,l,i){const[r,o]=x.useState([]);return x.useLayoutEffect(()=>{var p;const u=n.current;if(!u)return;if(uw(u),i){o([]);return}const m=[];for(const g of u.querySelectorAll(".embed[data-embed]")){const _=g.dataset.embed,b=mw(g.dataset.source??""),j=((p=g.querySelector("pre"))==null?void 0:p.outerHTML)??"";g.replaceChildren(),g.classList.add("embed--live"),m.push({node:g,kind:_,source:b,codeHtml:j})}o(m)},[n,l,i]),r.map((u,m)=>A0.createPortal(s.jsx(gw,{slot:u}),u.node,`${m}:${u.source.length}`))}function pw(){const[n,l]=x.useState(()=>document.documentElement.dataset.theme==="dark");return x.useEffect(()=>{const i=new MutationObserver(()=>l(document.documentElement.dataset.theme==="dark"));return i.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>i.disconnect()},[]),n}const Ub={html:"HTML",svg:"SVG",mermaid:"Диаграмма"};function gw({slot:n}){const{kind:l,source:i,codeHtml:r}=n,[o,u]=x.useState(!1),[m,p]=x.useState(!1),g=pw(),[_,b]=x.useState(null);x.useEffect(()=>{if(l!=="mermaid")return;let N=!1;return b(null),fw(i,g).then(E=>{N||b({svg:E})},E=>{N||b({error:E instanceof Error?E.message:String(E)})}),()=>{N=!0}},[l,i,g]);const j=s.jsx("div",{className:"embed__code",dangerouslySetInnerHTML:{__html:r}});if(l==="mermaid"&&(_==null?void 0:_.error)!==void 0)return s.jsxs("div",{className:"embed__card embed__card--error",children:[s.jsxs("div",{className:"embed__bar",children:[s.jsx("span",{className:"embed__kind",children:"Диаграмма"}),s.jsx("span",{className:"embed__err",children:"Ошибка синтаксиса"}),s.jsx("span",{className:"embed__spacer"}),s.jsx(tr,{text:i,hint:"код диаграммы"})]}),s.jsx("pre",{className:"embed__errtext",children:_.error}),j]});const v=`Превью ${Ub[l]}`,k=l==="mermaid"?"":hw(l,i);return s.jsxs("div",{className:"embed__card",children:[s.jsxs("div",{className:"embed__bar",children:[s.jsx("span",{className:"embed__kind",children:Ub[l]}),s.jsx("span",{className:"embed__spacer"}),s.jsxs("div",{className:"editor__viewtoggle",role:"tablist","aria-label":"Режим просмотра",children:[s.jsx("button",{type:"button",role:"tab",className:"btn btn--sm"+(o?"":" is-on"),"aria-selected":!o,onClick:()=>u(!1),children:l==="mermaid"?"Схема":"Превью"}),s.jsx("button",{type:"button",role:"tab",className:"btn btn--sm"+(o?" is-on":""),"aria-selected":o,onClick:()=>u(!0),children:"Код"})]}),s.jsx(tr,{text:i,hint:"код блока"}),l!=="mermaid"&&s.jsx("button",{type:"button",className:"copybtn","aria-label":"Развернуть превью на весь экран",title:"Развернуть на весь экран",onClick:()=>p(!0),children:"Развернуть"})]}),o?j:l==="mermaid"?s.jsx("div",{className:"embed__diagram",children:(_==null?void 0:_.svg)!==void 0?s.jsx("div",{dangerouslySetInnerHTML:{__html:_.svg}}):s.jsx("span",{className:"embed__wait",children:"Рисуем диаграмму…"})}):s.jsx("div",{className:"embed__stage"+(l==="svg"?" embed__stage--svg":""),children:s.jsx(Wh,{doc:k,title:v})}),m&&l!=="mermaid"&&s.jsx(D0,{doc:k,title:v,onClose:()=>p(!1)})]})}function rl({value:n,options:l,onChange:i,className:r,title:o,ariaLabel:u,placeholder:m="—"}){const[p,g]=x.useState(!1),[_,b]=x.useState(0),j=x.useRef(null),v=x.useRef(null),k=l.find(C=>C.value===n)??null;x.useEffect(()=>{if(!p)return;const C=l.findIndex(I=>I.value===n);b(C===-1?0:C)},[p]),x.useEffect(()=>{if(!p)return;function C(I){var D;(D=j.current)!=null&&D.contains(I.target)||g(!1)}return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[p]),x.useEffect(()=>{var C,I;p&&((I=(C=v.current)==null?void 0:C.querySelector(".is-cursor"))==null||I.scrollIntoView({block:"nearest"}))},[p,_]),x.useEffect(()=>{if(!p)return;const C=v.current,I=xw(j.current);if(!C||!I)return;const D=C.getBoundingClientRect().bottom-I.getBoundingClientRect().bottom;D>0&&(I.scrollTop+=Math.min(D+8,C.offsetHeight))},[p]);function N(C){g(!1),C.value!==n&&i(C.value)}function E(C){if(C.key==="Escape"){if(!p)return;C.preventDefault(),C.stopPropagation(),g(!1);return}if(C.key==="ArrowDown"||C.key==="ArrowUp"){if(C.preventDefault(),!p)return g(!0);const I=C.key==="ArrowDown"?1:l.length-1;return b(D=>(D+I)%l.length)}if(C.key==="Enter"||C.key===" "){if(C.preventDefault(),!p)return g(!0);const I=l[_];I&&N(I)}}return s.jsxs("div",{ref:j,className:"select"+(p?" select--open":"")+(r?` ${r}`:""),children:[s.jsxs("button",{type:"button",className:"select__trigger",title:o,"aria-label":u??o,"aria-haspopup":"listbox","aria-expanded":p,onClick:()=>g(C=>!C),onKeyDown:E,children:[s.jsx("span",{className:"select__value",children:(k==null?void 0:k.label)??m}),s.jsx(_w,{})]}),p&&s.jsx("div",{ref:v,className:"select__menu",role:"listbox","aria-label":u??o,children:l.map((C,I)=>s.jsxs("button",{type:"button",role:"option","aria-selected":C.value===n,className:"select__option"+(I===_?" is-cursor":"")+(C.value===n?" is-on":""),onMouseEnter:()=>b(I),onClick:()=>N(C),children:[s.jsx("span",{className:"select__check","aria-hidden":"true",children:C.value===n?"✓":""}),s.jsx("span",{className:"select__label",children:C.label}),C.hint&&s.jsx("span",{className:"select__hint",children:C.hint})]},C.value))})]})}function xw(n){let l=(n==null?void 0:n.parentElement)??null;for(;l;){if(l.scrollHeight>l.clientHeight&&getComputedStyle(l).overflowY!=="visible")return l;l=l.parentElement}return null}function _w(){return s.jsx("svg",{className:"select__chev",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:s.jsx("path",{d:"M3 4.5 6 7.5 9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function bw(){return s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("circle",{cx:"6.6",cy:"6.6",r:"4.3"}),s.jsx("path",{d:"M9.7 9.7 14 14"}),s.jsx("path",{d:"M6.6 4.6v4M4.6 6.6h4"})]})}function yw(){return s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("circle",{cx:"6.6",cy:"6.6",r:"4.3"}),s.jsx("path",{d:"M9.7 9.7 14 14"}),s.jsx("path",{d:"M4.6 6.6h4"})]})}function vw(){return s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("path",{d:"M13 8a5 5 0 1 1-1.6-3.7"}),s.jsx("path",{d:"M13 2.5v3.3h-3.3"})]})}function O0({path:n,mime:l,base64:i,error:r,tooLarge:o,size:u,onRequestMedia:m}){x.useEffect(()=>{!o&&i===void 0&&r===void 0&&m(n)},[]);const p=jw(i,l);return o?s.jsx("div",{className:"mediaview mediaview--message",children:s.jsxs("p",{className:"mediaview__error",children:["Файл слишком велик для просмотра (",Ad(u),"). Лимит — 64 МБ."]})}):r?s.jsxs("div",{className:"mediaview mediaview--message",role:"alert",children:[s.jsx("p",{className:"mediaview__error",children:r}),s.jsx("button",{className:"btn btn--sm btn--primary",onClick:()=>m(n),children:"Повторить"})]}):p?l.startsWith("image/")?s.jsx(kw,{url:p}):l.startsWith("video/")?s.jsx(Sw,{url:p}):null:s.jsxs("div",{className:"mediaview mediaview--message",role:"status",children:[s.jsx("div",{className:"mediaview__progress",children:s.jsx("div",{className:"mediaview__progress-fill"})}),s.jsx("span",{className:"mediaview__label",children:"Загружается…"})]})}function jw(n,l){const[i,r]=x.useState(null);return x.useEffect(()=>{if(n===void 0){r(null);return}const o=atob(n),u=new Uint8Array(o.length);for(let p=0;p<o.length;p++)u[p]=o.charCodeAt(p);const m=URL.createObjectURL(new Blob([u],{type:l}));return r(m),()=>URL.revokeObjectURL(m)},[n,l]),i}const Fr=1,z0=8,gh=1.25;function Nw(n){return Math.min(z0,Math.max(Fr,n))}function kw({url:n}){const[l,i]=x.useState({scale:Fr,x:0,y:0}),[r,o]=x.useState(!1),u=x.useRef(null),m=x.useRef(null);function p(k,N,E){i(C=>{const I=Nw(C.scale*k);if(I===C.scale)return C;if(I<=Fr)return{scale:Fr,x:0,y:0};const D=(N-C.x)/C.scale,G=(E-C.y)/C.scale;return{scale:I,x:N-I*D,y:E-I*G}})}x.useEffect(()=>{const k=u.current;if(!k)return;function N(E){E.preventDefault();const C=k.getBoundingClientRect(),I=E.clientX-C.left-C.width/2,D=E.clientY-C.top-C.height/2;p(E.deltaY<0?gh:1/gh,I,D)}return k.addEventListener("wheel",N,{passive:!1}),()=>k.removeEventListener("wheel",N)},[]);function g(k){l.scale<=Fr||(k.currentTarget.setPointerCapture(k.pointerId),m.current={pointerId:k.pointerId,startX:k.clientX,startY:k.clientY,origX:l.x,origY:l.y},o(!0))}function _(k){const N=m.current;!N||N.pointerId!==k.pointerId||i(E=>({...E,x:N.origX+(k.clientX-N.startX),y:N.origY+(k.clientY-N.startY)}))}function b(){m.current=null,o(!1)}const j=l.scale>Fr,v=!j&&l.x===0&&l.y===0;return s.jsxs("div",{className:"mediaview mediaview--image",children:[s.jsx("div",{ref:u,className:"mediaview__stage"+(j?r?" is-dragging":" is-zoomed":""),onPointerDown:g,onPointerMove:_,onPointerUp:b,onPointerCancel:b,children:s.jsx("img",{src:n,alt:"",className:"mediaview__image",draggable:!1,style:{transform:`translate(${l.x}px, ${l.y}px) scale(${l.scale})`}})}),s.jsxs("div",{className:"mediaview__toolbar",children:[s.jsx("button",{className:"btn btn--sm",disabled:l.scale<=Fr,title:"Уменьшить","aria-label":"Уменьшить",onClick:()=>p(1/gh,0,0),children:s.jsx(yw,{})}),s.jsxs("span",{className:"mediaview__zoomlabel",children:[Math.round(l.scale*100),"%"]}),s.jsx("button",{className:"btn btn--sm",disabled:l.scale>=z0,title:"Увеличить","aria-label":"Увеличить",onClick:()=>p(gh,0,0),children:s.jsx(bw,{})}),s.jsx("button",{className:"btn btn--sm",disabled:v,title:"Вписать в окно","aria-label":"Сбросить масштаб — вписать в окно",onClick:()=>i({scale:Fr,x:0,y:0}),children:s.jsx(vw,{})})]})]})}const ww=[{value:"0.5",label:"0.5×"},{value:"0.75",label:"0.75×"},{value:"1",label:"1× — обычная"},{value:"1.25",label:"1.25×"},{value:"1.5",label:"1.5×"},{value:"2",label:"2×"}];function Sw({url:n}){const l=x.useRef(null),[i,r]=x.useState("1");return x.useEffect(()=>{l.current&&(l.current.playbackRate=Number(i))},[i]),s.jsxs("div",{className:"mediaview mediaview--video",children:[s.jsx("video",{ref:l,className:"mediaview__video",src:n,controls:!0}),s.jsxs("div",{className:"mediaview__speedbar",children:[s.jsx("span",{className:"mediaview__speedlabel",children:"Скорость"}),s.jsx(rl,{className:"mediaview__speedselect",value:i,onChange:r,ariaLabel:"Скорость воспроизведения",options:ww})]})]})}const $b=48;function Ew(n,l,i,r){n.addEventListener("pointerdown",o=>{var D;const u=i();if(!u||o.button!==0)return;o.preventDefault(),o.stopPropagation();const m=o.clientX,p=u.getBoundingClientRect().width,g=u.style.width,_=((D=l.parentElement)==null?void 0:D.clientWidth)||1/0,b=Math.max($b,Math.floor(_)),j=document.createElement("span");j.className="md-img__size",l.appendChild(j),l.classList.add("is-resizing"),n.setPointerCapture(o.pointerId);let v=Math.round(p);const k=()=>{j.textContent=`${v} px`};k();const N=G=>{v=Math.min(b,Math.max($b,Math.round(p+G.clientX-m))),u.style.width=`${v}px`,k()},E=G=>{n.removeEventListener("pointermove",N),n.removeEventListener("pointerup",C),n.removeEventListener("pointercancel",I),j.remove(),l.classList.remove("is-resizing"),G&&v!==Math.round(p)?r(v):u.style.width=g},C=()=>E(!0),I=()=>E(!1);n.addEventListener("pointermove",N),n.addEventListener("pointerup",C),n.addEventListener("pointercancel",I)})}const Cw=x.lazy(()=>st(()=>import("./MarkdownTextEditor-B3B8_rFw.js"),__vite__mapDeps([27,5,26]),import.meta.url));function Tw({file:n,goto:l,onChange:i,onSave:r,onReload:o,onOverwrite:u,onRequestMedia:m,onTogglePreview:p,onSetMarkdownMode:g,preview:_,onRequestPreview:b,images:j,onRequestImage:v,onPasteImage:k}){const N=ai(n),E=Id(n.path)&&!n.binary&&!n.tooLarge,C=Ph(n.path)&&!n.binary&&!n.tooLarge,I=Nk(n),D=C&&n.previewMode,[G,P]=x.useState(!1);x.useEffect(()=>{D&&b(n.path)},[D,n.path,n.mtime,b]);const V=(_==null?void 0:_.html)!==void 0?R0(n.path,_.html):null;return s.jsxs("div",{className:"editor",children:[s.jsxs("div",{className:"editor__bar",children:[s.jsx("span",{className:"editor__path",title:n.path,children:n.path}),s.jsxs("span",{className:"editor__meta",children:[Ad(n.size),n.eol==="crlf"&&" · CRLF"]}),E&&s.jsx("div",{className:"editor__viewtoggle",role:"tablist","aria-label":"Режим просмотра",children:[["preview","Просмотр","Отрендеренный документ, только чтение"],["text","Текст","Писать как в обычном редакторе, без разметки на виду"],["code","Код","Исходник Markdown"]].map(([z,H,te])=>s.jsx("button",{className:"btn btn--sm"+(I===z?" is-on":""),role:"tab",title:te,"aria-selected":I===z,onClick:()=>I!==z&&g(n.path,z),children:H},z))}),C&&s.jsxs("div",{className:"editor__viewtoggle",role:"tablist","aria-label":"Режим просмотра",children:[s.jsx("button",{className:"btn btn--sm"+(n.previewMode?" is-on":""),role:"tab","aria-selected":n.previewMode,onClick:()=>!n.previewMode&&p(n.path),children:"Превью"}),s.jsx("button",{className:"btn btn--sm"+(n.previewMode?"":" is-on"),role:"tab","aria-selected":!n.previewMode,onClick:()=>n.previewMode&&p(n.path),children:"Код"})]}),D&&s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"btn btn--sm",title:"Собрать превью заново",disabled:_==null?void 0:_.loading,onClick:()=>b(n.path,!0),children:"Обновить"}),s.jsx("button",{type:"button",className:"btn btn--sm",title:"Открыть превью на весь экран",disabled:V===null,onClick:()=>P(!0),children:"Развернуть"})]}),s.jsx("button",{className:"btn btn--sm",disabled:!N,title:"Сохранить (Ctrl+S)",onClick:()=>r(n.path),children:N?"Сохранить":"Сохранено"})]}),n.stale&&s.jsxs("div",{className:"editor__warn",children:[s.jsxs("span",{children:["Файл изменился на диске",N?" — а здесь есть несохранённые правки.":"."]}),s.jsx("button",{className:"btn btn--sm",onClick:()=>o(n.path),children:"Взять с диска"}),N&&s.jsx("button",{className:"btn btn--sm btn--danger",onClick:()=>u(n.path),children:"Сохранить поверх"})]}),n.binary&&n.mediaMime?s.jsx(O0,{path:n.path,mime:n.mediaMime,base64:n.mediaBase64,error:n.mediaError,tooLarge:n.mediaTooLarge,size:n.size,onRequestMedia:m},n.path):n.binary?s.jsxs("p",{className:"editor__empty",children:["Это не текстовый файл — редактировать его здесь нечем. ",Ad(n.size)," на диске."]}):n.tooLarge?s.jsxs("p",{className:"editor__empty",children:["Файл слишком велик для редактора (",Ad(n.size),"). Такие правит агент, а не браузер."]}):D?s.jsxs(s.Fragment,{children:[_&&_.missing.length>0&&s.jsxs("div",{className:"editor__note",title:_.missing.join(", "),children:["Не найдено в проекте (",_.missing.length,"):"," ",_.missing.slice(0,3).join(", "),_.missing.length>3?"…":""]}),(_==null?void 0:_.error)!==void 0&&s.jsxs("div",{className:"editor__warn editor__warn--error",children:[s.jsxs("span",{children:["Не удалось собрать превью: ",_.error]}),s.jsx("button",{className:"btn btn--sm",onClick:()=>b(n.path,!0),children:"Повторить"})]}),s.jsxs("div",{className:"webpreview",children:[V!==null?s.jsx(Wh,{doc:V,title:`Превью ${ig(n.path)}`,className:"webpreview__frame"}):(_==null?void 0:_.error)===void 0?s.jsx("p",{className:"editor__empty",children:"Собираем превью…"}):null,(_==null?void 0:_.loading)&&V!==null&&s.jsx("span",{className:"webpreview__busy",children:"Обновляем…"})]}),G&&V!==null&&s.jsx(D0,{doc:V,title:ig(n.path),onClose:()=>P(!1)})]}):E&&I==="text"?s.jsx(x.Suspense,{fallback:s.jsx("p",{className:"editor__empty",children:"Открываем редактор…"}),children:s.jsx(Cw,{path:n.path,doc:n.text,onChange:i,onSave:r,images:j,onRequestImage:v,onPasteImage:k},`${n.path}:${n.revision}`)}):E&&n.previewMode?s.jsx(Aw,{path:n.path,text:n.text,images:j,onRequestImage:v,onChange:i}):s.jsx(rw,{path:n.path,doc:n.text,revision:n.revision,goto:l,onChange:i,onSave:r,images:j,onRequestImage:v,onPasteImage:k})]})}function Aw({path:n,text:l,images:i,onRequestImage:r,onChange:o}){const[u,m]=x.useState(""),p=x.useRef(null),g=L0(p,u,!1),_=x.useMemo(()=>({__html:u}),[u]),b=x.useRef(l),j=x.useRef(o);return b.current=l,j.current=o,x.useEffect(()=>{let v=!1;return Hd(l).then(k=>{v||m(k)}),()=>{v=!0}},[l]),x.useEffect(()=>{var k;const v=p.current;if(v){for(const N of Array.from(v.querySelectorAll("img"))){if((k=N.parentElement)!=null&&k.classList.contains("md-img"))continue;const E=document.createElement("span");E.className="md-img",E.dataset.src0=N.getAttribute("src")??"",N.replaceWith(E),E.appendChild(N);const C=document.createElement("span");C.className="md-img__grip",C.title="Потяните, чтобы изменить ширину",C.setAttribute("aria-label","Изменить ширину картинки"),E.appendChild(C),Ew(C,E,()=>E.querySelector("img"),I=>{var z;const D=Array.from(v.querySelectorAll(".md-img")),G=Ak(b.current),P=G[D.indexOf(E)];if(!P||G.length!==D.length){(z=E.querySelector("img"))==null||z.style.removeProperty("width");return}const V=b.current;j.current(n,V.slice(0,P.from)+Mk(P,I)+V.slice(P.to))})}for(const N of Array.from(v.querySelectorAll(".md-img"))){const E=N.querySelector("img");if(!E)continue;const C=Rk(n,N.dataset.src0??"");let I="ok",D="";if(C.kind==="outside")I="blocked",D=`Путь вне проекта: ${N.dataset.src0}`;else if(C.kind==="project"){const P=i[C.path];if(!P)I="loading",D=`Загружается: ${C.path}`,r(C.path);else if("error"in P)I="missing",D=`Нет файла: ${C.path}`;else{const V=kk(P);E.getAttribute("src")!==V&&E.setAttribute("src",V)}}N.dataset.state=I,E.hidden=I!=="ok";let G=N.querySelector(".md-img__ph");I==="ok"?G==null||G.remove():(G||(G=document.createElement("span"),G.className="md-img__ph",N.prepend(G)),G.textContent=D)}}},[u,i,n,r]),s.jsxs(s.Fragment,{children:[s.jsx("div",{ref:p,className:"markdown-preview",dangerouslySetInnerHTML:_}),g]})}function Mw({files:n,activePath:l,busy:i,onSelect:r,onClose:o,zoomed:u,onToggleZoom:m}){return s.jsxs("div",{className:"worktabs",role:"tablist",onDoubleClick:p=>{m&&(p.target.closest("button")||m())},children:[s.jsxs("button",{className:"worktab"+(l===null?" is-on":""),role:"tab","aria-selected":l===null,onClick:()=>r(null),onDoubleClick:()=>m==null?void 0:m(),children:[s.jsx("span",{className:"worktab__name",children:"Разговор"}),i&&s.jsx("span",{className:"worktab__dot worktab__dot--busy",title:"Агент работает"})]}),n.map(p=>s.jsxs("div",{className:"worktab"+(p.path===l?" is-on":""),role:"tab","aria-selected":p.path===l,onDoubleClick:g=>{m&&(g.target.closest(".worktab__close, .worktab__dot")||m())},children:[s.jsx("button",{className:"worktab__name",title:p.path,onClick:()=>r(p.path),children:ig(p.path)}),ai(p)?s.jsx("button",{className:"worktab__dot",title:"Не сохранено — закрыть","aria-label":`Закрыть ${p.path}`,onClick:()=>o(p.path)}):s.jsx("button",{className:"worktab__close",title:"Закрыть","aria-label":`Закрыть ${p.path}`,onClick:()=>o(p.path),children:"✕"})]},p.path)),s.jsx("div",{className:"worktabs__spacer"}),m&&s.jsx("button",{className:"worktabs__zoom",title:u?"Свернуть — то же самое, что двойной клик по вкладке":"Развернуть на весь экран — то же самое, что двойной клик по вкладке","aria-label":u?"Свернуть колонку разговора":"Развернуть колонку разговора на весь экран","aria-pressed":u,onClick:m,children:s.jsx(_u,{active:u})})]})}function ra(n){return n.claudeSessionId??n.id}function Mh(n,l,i,r){if(!l||l.length===0)return n;const o=new Map(l.map((p,g)=>[p,g])),u=[],m=[];for(const p of n)(o.has(i(p))?u:m).push(p);return u.sort((p,g)=>o.get(i(p))-o.get(i(g))),r==="top"?[...m,...u]:[...u,...m]}function Bb(n){return n.state!=="closed"}function I0(n){return[...n.filter(Bb),...n.filter(l=>!Bb(l))]}function xh(n,l,i,r){if(l===i||!n.includes(l)||!n.includes(i))return null;const o=n.filter(p=>p!==l),u=o.indexOf(i)+(r==="after"?1:0),m=[...o.slice(0,u),l,...o.slice(u)];return m.every((p,g)=>p===n[g])?null:m}function Ig(n,l,i,r){const o=n%10,u=n%100;return o===1&&u!==11?l:o>=2&&o<=4&&(u<12||u>14)?i:r}function U0(n){return`${n} ${Ig(n,"агент","агента","агентов")}`}function Rw(n){const l=n.filter(o=>o.kind==="agent").length,i=n.length-l,r=[];return l>0&&r.push(U0(l)),i>0&&r.push(`${i} ${Ig(i,"задача","задачи","задач")} в фоне`),r.join(" · ")}function Dw(n){switch(n.kind){case"agent":return n.agentType??"агент";case"shell":return"команда";case"workflow":return"сценарий";default:return"задача"}}function Lw(n){const l=Math.max(0,Math.floor(n/1e3)),i=Math.floor(l/3600),r=Math.floor(l%3600/60),o=l%60,u=String(o).padStart(2,"0");return i>0?`${i}:${String(r).padStart(2,"0")}:${u}`:`${r}:${u}`}function Ow(n){return n<1e3?`${n} ток.`:`${(n/1e3).toFixed(1).replace(".",",")} k ток.`}function zw({tasks:n,onStop:l}){const[i,r]=x.useState(!1),[o,u]=x.useState(()=>Date.now()),[m,p]=x.useState(()=>new Set);x.useEffect(()=>{const _=window.setInterval(()=>u(Date.now()),1e3);return()=>window.clearInterval(_)},[]),x.useEffect(()=>{p(_=>{const b=new Set(n.map(v=>v.id)),j=new Set([..._].filter(v=>b.has(v)));return j.size===_.size?_:j})},[n]);const g=_=>{p(b=>new Set(b).add(_)),l(_),window.setTimeout(()=>{p(b=>{if(!b.has(_))return b;const j=new Set(b);return j.delete(_),j})},1e4)};return s.jsxs("div",{className:i?"tasks is-open":"tasks",children:[s.jsxs("button",{type:"button",className:"tasks__toggle","aria-expanded":i,"aria-controls":"tasks-list",onClick:()=>r(_=>!_),children:[s.jsx("span",{className:"tasks__dot","aria-hidden":"true"}),s.jsx("span",{className:"tasks__summary",children:Rw(n)}),s.jsx("svg",{className:"tasks__chev",viewBox:"0 0 16 16","aria-hidden":"true",children:s.jsx("path",{d:"M4 6.5l4 4 4-4",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})]}),i&&s.jsx("ul",{className:"tasks__list",id:"tasks-list",children:n.map(_=>{const b=m.has(_.id);return s.jsxs("li",{className:b?"task is-stopping":"task",children:[s.jsxs("div",{className:"task__main",children:[s.jsxs("div",{className:"task__head",children:[s.jsx("span",{className:"task__kind",children:Dw(_)}),_.background&&s.jsx("span",{className:"task__bg",children:"фон"}),s.jsx("span",{className:"task__time",children:Lw(o-_.startedAt)})]}),s.jsx("div",{className:"task__desc",title:_.description,children:_.description}),(_.activity||_.lastTool)&&s.jsx("div",{className:"task__activity",title:_.activity??_.lastTool??void 0,children:_.activity??_.lastTool}),s.jsxs("div",{className:"task__stats",children:[Ow(_.tokens)," · ",_.toolUses," ",Ig(_.toolUses,"вызов","вызова","вызовов")]})]}),s.jsx("button",{type:"button",className:"btn btn--sm btn--danger task__stop",disabled:b,"aria-label":`Остановить: ${_.description}`,onClick:()=>g(_.id),children:b?"Останавливается":"Стоп"})]},_.id)})})]})}const Iw=""+new URL("antigravity-logo-DRKQga2U.png",import.meta.url).href;function Ug({className:n}){return s.jsx("img",{src:Iw,alt:"","aria-hidden":"true",className:n,style:{aspectRatio:"200 / 184"}})}function $g({className:n}){return s.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[s.jsx("path",{d:"M12 2.6 20.1 7.3v9.4L12 21.4l-8.1-4.7V7.3z"}),s.jsx("path",{d:"m8.9 9.4 2.6 2.6-2.6 2.6"}),s.jsx("path",{d:"M13.2 14.8h2.6"})]})}const Uw=450,$w=6,Bw={claude:{label:"Claude",hint:"Claude Code — как обычно"},antigravity:{label:"Antigravity",hint:"Google agy, отдельная палитра и права"},codex:{label:"Codex",hint:"OpenAI Codex, отдельная палитра и права"}};function Hw({disabled:n,providers:l,lastAccountId:i,onStart:r,onSignIn:o}){var M;const{accounts:u,auth:m,multi:p}=vg(),g=["claude","antigravity","codex"].filter(O=>l.includes(O)).flatMap(O=>O==="claude"&&p?u.map(J=>{const le=m[J.id],ce=By(le);return{key:`claude:${J.id}`,id:"claude",label:J.name,hint:ce?`Claude Code, ${ce}`:"Claude Code",account:J,isDefault:J.id===i,needsLogin:J.id!==Ki&&le!=null&&!le.loggedIn}}):[{key:O,id:O,...Bw[O]}]),_=g.length>1,b=g.find(O=>O.isDefault)??g[0],j=Math.max(0,g.indexOf(b)),[v,k]=x.useState(!1),[N,E]=x.useState(0),[C,I]=x.useState({left:0,top:0}),D=x.useRef(null),G=x.useRef(null),P=x.useRef(null);function V(){P.current&&window.clearTimeout(P.current.timer),P.current=null}function z(){V(),E(j),k(!0)}function H(O){var J;k(!1),O&&((J=D.current)==null||J.focus())}function te(O){if(n||!_||O.button!==0)return;const J={timer:0,x:O.clientX,y:O.clientY,fired:!1};J.timer=window.setTimeout(()=>{J.fired=!0,z()},Uw),P.current=J}function F(O){const J=P.current;!J||J.fired||Math.hypot(O.clientX-J.x,O.clientY-J.y)>$w&&V()}function fe(){P.current&&!P.current.fired&&V()}function Q(O){var J;if((J=P.current)!=null&&J.fired){P.current=null,O.preventDefault();return}n||b&&U(b)}function X(O){_&&(O.preventDefault(),!n&&z())}function ge(O){if(n||!_)return;(O.key==="ArrowDown"||O.key==="ArrowUp"||O.key==="Enter"&&O.shiftKey)&&(O.preventDefault(),z())}x.useLayoutEffect(()=>{if(!v)return;const O=D.current,J=G.current;if(!O||!J)return;const le=O.getBoundingClientRect(),ce=J.getBoundingClientRect(),A=8,W=Math.max(A,Math.min(le.right-ce.width,window.innerWidth-ce.width-A));let me=le.top-ce.height-8;me<A&&(me=Math.min(le.bottom+8,window.innerHeight-ce.height-A)),I({left:W,top:me})},[v]),x.useLayoutEffect(()=>{var O;v&&((O=G.current)==null||O.focus())},[v]),x.useLayoutEffect(()=>{if(!v)return;function O(J){var ce,A;const le=J.target;!((ce=G.current)!=null&&ce.contains(le))&&!((A=D.current)!=null&&A.contains(le))&&H(!1)}return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[v]);function U(O){var J;if(H(!1),O.needsLogin&&O.account){o(O.account.id);return}r(O.id,(J=O.account)==null?void 0:J.id)}function L(O){if(O.key==="Escape"){O.preventDefault(),O.stopPropagation(),H(!0);return}if(O.key==="ArrowDown"||O.key==="ArrowUp"){O.preventDefault();const J=O.key==="ArrowDown"?1:-1;E(le=>(le+J+g.length)%g.length);return}if(O.key==="Enter"||O.key===" "){O.preventDefault();const J=g[N];J&&U(J);return}O.key==="Tab"&&H(!1)}return s.jsxs("div",{className:"newsession",children:[s.jsxs("button",{ref:D,type:"button",className:"btn btn--primary newsession__btn",disabled:n,title:_?p?`Новая сессия под «${((M=b==null?void 0:b.account)==null?void 0:M.name)??""}». Удерживайте, чтобы выбрать агента или аккаунт`:"Удерживайте, чтобы выбрать агента":void 0,"aria-label":p&&(b!=null&&b.account)?`Новая сессия, аккаунт «${b.account.name}»`:void 0,"aria-haspopup":_?"menu":void 0,"aria-expanded":_?v:void 0,onClick:Q,onContextMenu:X,onPointerDown:te,onPointerMove:F,onPointerUp:fe,onPointerCancel:fe,onPointerLeave:fe,onKeyDown:ge,children:["+ Сессия",p&&(b==null?void 0:b.account)&&s.jsx("span",{className:`newsession__acct acct--${b.account.color}`,"aria-hidden":"true"}),_&&s.jsx(qw,{})]}),v&&_&&s.jsx("div",{ref:G,className:"newsession__menu",style:{left:C.left,top:C.top},role:"menu","aria-label":p?"Выбрать агента и аккаунт для новой сессии":"Выбрать агента для новой сессии",tabIndex:-1,onKeyDown:L,children:g.map((O,J)=>{var le;return s.jsxs("button",{type:"button",role:"menuitem",className:"newsession__item"+(J===N?" is-cursor":"")+(J>0&&((le=g[J-1])==null?void 0:le.id)!==O.id?" newsession__item--sep":""),onMouseEnter:()=>E(J),onClick:()=>U(O),children:[O.account?s.jsx("span",{className:"newsession__mark newsession__mark--account",children:s.jsx(Da,{account:O.account,size:"md"})}):s.jsx("span",{className:`newsession__mark newsession__mark--${O.id}`,"aria-hidden":"true",children:O.id==="antigravity"?s.jsx(Ug,{className:"newsession__mark-logo"}):O.id==="codex"?s.jsx($g,{className:"newsession__mark-logo"}):s.jsx(Gw,{})}),s.jsxs("span",{className:"newsession__text",children:[s.jsx("span",{className:"newsession__label",children:O.label}),s.jsx("span",{className:"newsession__hint",children:O.hint})]}),O.needsLogin?s.jsx("span",{className:"newsession__tag newsession__tag--login",children:"Войти"}):O.isDefault&&s.jsx("span",{className:"newsession__tag",children:"по клику"})]},O.key)})})]})}function qw(){return s.jsx("svg",{className:"newsession__caret",viewBox:"0 0 10 6",fill:"none","aria-hidden":"true",children:s.jsx("path",{d:"M1 1.2 5 5 9 1.2",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function Gw(){return s.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:s.jsx("circle",{cx:"8",cy:"8",r:"6",fill:"var(--accent)"})})}const Yw=300,Vw=3,Ip=new Intl.RelativeTimeFormat("ru",{numeric:"auto"});function Xw(n){const l=n-Date.now(),i=Math.abs(l),r=6e4;return i<r?"только что":i<60*r?Ip.format(Math.round(l/r),"minute"):i<1440*r?Ip.format(Math.round(l/(60*r)),"hour"):i<10080*r?Ip.format(Math.round(l/(1440*r)),"day"):new Date(n).toLocaleDateString("ru",{day:"numeric",month:"short",year:"numeric"})}function Fw({query:n,workspaces:l,results:i,onSearch:r,onOpen:o}){const u=n.trim(),m=u.length>=Vw,p=x.useRef(r);if(p.current=r,x.useEffect(()=>{if(!m)return;const b=setTimeout(()=>p.current(u),Yw);return()=>clearTimeout(b)},[m,u]),!m)return null;const g=i!==null&&i.query===u,_=g?i.hits:[];return s.jsxs("div",{className:"contentsearch","aria-live":"polite",children:[s.jsxs("div",{className:"sidebar__section contentsearch__head",children:[s.jsx("span",{className:"sidebar__section-name",children:"В разговорах"}),g&&s.jsx("span",{className:"sidebar__count",children:_.length})]}),!g&&s.jsxs("div",{className:"contentsearch__state",children:[s.jsx("span",{className:"contentsearch__spinner","aria-hidden":"true"}),"Ищем в разговорах…"]}),g&&_.length===0&&s.jsx("div",{className:"contentsearch__state",children:"В разговорах ничего не нашлось"}),_.map(b=>{var v,k;const j=((v=l.find(N=>N.id===b.workspaceId))==null?void 0:v.name)??"";return s.jsxs("button",{type:"button",className:"contentsearch__hit",onClick:()=>o(b),children:[s.jsxs("span",{className:"contentsearch__top",children:[s.jsx("span",{className:"contentsearch__name",children:((k=b.title)==null?void 0:k.trim())||"Без названия"}),b.timestamp!==null&&s.jsx("span",{className:"contentsearch__when",children:Xw(b.timestamp)})]}),j&&s.jsx("span",{className:"contentsearch__project",children:j}),s.jsx(Kw,{hit:b})]},`${b.workspaceId}:${b.sessionId}`)})]})}function Kw({hit:n}){const l=Math.max(0,Math.min(n.matchStart,n.snippet.length)),i=Math.min(n.snippet.length,l+n.matchLength);return s.jsxs("span",{className:"contentsearch__snippet",children:[n.snippet.slice(0,l),s.jsx("mark",{children:n.snippet.slice(l,i)}),n.snippet.slice(i)]})}const $0="ccv:sidebar.collapsed",B0="ccv:sidebar.mode",H0="ccv:sidebar.foldersCollapsed",Hb="ccv:sidebar.expandedProjects",qb="ccv:sidebar.expandedProjectArchives",q0=500,og="транскрипт остаётся на диске — сессию можно вернуть из архива в любой момент.";function Qw({open:n,connected:l,status:i,workspaces:r,archivedWorkspaces:o,workspaceFolders:u,sessionFolders:m,pinnedFolders:p,projectSessions:g,onRequestSessions:_,pinned:b,live:j,listOrder:v,liveSessionsFirst:k,onReorder:N,activeWorkspaceId:E,activeSessionId:C,onSelectWorkspace:I,onRenameSession:D,onStopSession:G,onPinSessions:P,onSelectPinned:V,onCloseWorkspaces:z,onRestoreWorkspaces:H,onUnmarkWorkspaces:te,onArchiveSessions:F,onUnarchiveSessions:fe,onCreateFolder:Q,onRenameFolder:X,onSetFolderColor:ge,onAssignToFolder:U,folderNotice:L,onDismissFolderNotice:M,movingProjectId:O,foldersReady:J,onOpenWorkspace:le,onOpenUnopened:ce,onNewSession:A,enabledProviders:W,lastAccountId:me,onSignInAccount:Ee,onOpenExtensions:$,account:de,onOpenAccount:ae,relay:qe,onOpenRelay:Se,onOpenSettings:Ge,onOpenTasks:Ve,onOpenSite:Je,onOpenVideo:Ft,contentResults:dt,onSearchContent:jn,onOpenContentHit:Ze,themeMode:js,onCycleTheme:lt}){var wn;const mt=vg(),[Me,nt]=x.useState(null),[In,kt]=x.useState(null),[ut,Un]=x.useState(null);function $n(T){return(ut==null?void 0:ut.folderId)===T.id?ut.color??void 0:T.color}function Gt(T){const oe=T&&$n(T);return oe?{"--folder-color":oe}:void 0}const it=x.useRef(void 0),[vt,Kt]=x.useState(null),[es,fs]=x.useState(null),[Tt,Lt]=x.useState(""),[fn,Qt]=x.useState(dS),[zs,_e]=x.useState(fS),[Ae,Pe]=x.useState(hS),[et,Qe]=x.useState(()=>Vb(Hb)),[Ot,Zt]=x.useState(()=>Vb(qb)),[Kn,Sl]=x.useState([]);function Bn(T){Pe(T);try{localStorage.setItem(B0,T)}catch{}}const Et=Tt.trim().toLowerCase(),_t=Et!=="",Is=x.useMemo(()=>Mh(r,v==null?void 0:v.workspaces,T=>T.id,"bottom"),[r,v]),Qn=x.useMemo(()=>{const T=Mh(b,v==null?void 0:v.pinned,ra,"bottom");return k?I0(T):T},[b,v,k]),Es=x.useMemo(()=>Mh(j,v==null?void 0:v.live,ra,"bottom"),[j,v]),Mn=x.useMemo(()=>{const T=new Map,oe=new Map,Te=new Map,Ie=new Map(r.map(zt=>[zt.id,zt.folderId]));for(const zt of j){const xn=X0(zt);$p(T,zt.workspaceId,xn),zt.folderId&&$p(oe,zt.folderId,xn);const ss=Ie.get(zt.workspaceId);ss&&$p(Te,ss,xn)}return{byWorkspace:T,bySessionFolder:oe,byWorkspaceFolder:Te}},[j,r]),hs=T=>T.name.toLowerCase().includes(Et)||T.path.toLowerCase().includes(Et),ms=x.useMemo(()=>J?_t?Is.filter(T=>{if(hs(T))return!0;const oe=g[T.id];return!!oe&&(oe.sessions.some(Te=>Md(Te,Et))||oe.archived.some(Te=>Md(Te,Et)))}):Is:[],[Is,g,Et,_t,J]),Zn=x.useMemo(()=>J?_t?o.filter(hs):o:[],[o,Et,_t,J]),Qs=T=>{var oe;return((oe=r.find(Te=>Te.id===T))==null?void 0:oe.name)??"—"},hn=T=>{var oe;return(oe=r.find(Te=>Te.id===T))==null?void 0:oe.path},wt=x.useMemo(()=>_t?Qn.filter(T=>(T.title??"").toLowerCase().includes(Et)||Qs(T.workspaceId).toLowerCase().includes(Et)):Qn,[Qn,r,Et,_t]),At=x.useMemo(()=>_t?Es.filter(T=>(T.title??"").toLowerCase().includes(Et)||Qs(T.workspaceId).toLowerCase().includes(Et)):Es,[Es,r,Et,_t]),cn=!_t;function ps(T){Qt(oe=>{const Te=oe.includes(T)?oe.filter(Ie=>Ie!==T):[...oe,T];try{localStorage.setItem($0,JSON.stringify(Te))}catch{}return Te})}const Rn=T=>!fn.includes(T);function ua(T){_e(oe=>{const Te=oe.includes(T)?oe.filter(Ie=>Ie!==T):[...oe,T];try{localStorage.setItem(H0,JSON.stringify(Te))}catch{}return Te})}const Us=T=>!zs.includes(T);function B(T,oe){Qe(Te=>{if(Te.includes(T)===oe)return Te;const Ie=oe?[...Te,T]:Te.filter(zt=>zt!==T);return Xb(Hb,Ie),Ie})}function xe(T){Zt(oe=>{const Te=oe.includes(T)?oe.filter(Ie=>Ie!==T):[...oe,T];return Xb(qb,Te),Te})}x.useEffect(()=>{E&&B(E,!0)},[E]),x.useEffect(()=>Sl(T=>T.length?[]:T),[Et]);const Re=x.useRef(new Set);x.useEffect(()=>{if(!l){Re.current.clear();return}for(const T of et)Re.current.has(T)||!r.some(oe=>oe.id===T)||(Re.current.add(T),T!==E&&_(T))},[l,et,r,E]);function Ke(T){const oe=g[T.id],Te=!_t||hs(T),Ie=!Te,zt=Ie?!Kn.includes(T.id):et.includes(T.id),xn=oe?Te?oe.sessions.length:oe.sessions.filter(ss=>Md(ss,Et)).length:void 0;return{entry:oe,showAll:Te,forced:Ie,open:zt,count:xn}}function ht(T,oe){if(oe.forced){Sl(Te=>Te.includes(T.id)?Te.filter(Ie=>Ie!==T.id):[...Te,T.id]);return}B(T.id,!oe.open)}function on(T,oe){ht(T,oe),!oe.open&&T.id!==E&&I(T.id)}const rt=x.useMemo(()=>Rd(ms,u,void 0,!_t),[ms,u,_t]),cl=x.useMemo(()=>{const T=new Map;for(const oe of u){const Te=(oe.unopened??[]).filter(Ie=>!_t||Ie.name.toLowerCase().includes(Et));Te.length&&T.set(oe.id,Te)}return T},[u,Et,_t]),Zs=x.useMemo(()=>{if(!_t)return rt.groups;const T=new Set(rt.groups.map(Te=>Te.folder.id)),oe=u.filter(Te=>!T.has(Te.id)&&cl.has(Te.id)).map(Te=>({folder:Te,items:[]}));return oe.length?[...rt.groups,...oe].sort((Te,Ie)=>Te.folder.name.localeCompare(Ie.folder.name,"ru")):rt.groups},[rt,u,cl,_t]),[ts,Ns]=x.useState([]),Ps=x.useMemo(()=>Rd(Zn,u),[Zn,u]),Bl=x.useMemo(()=>Rd(wt,p,T=>T.pinnedFolderId,!_t),[wt,p,_t]),da=x.useMemo(()=>({groups:[],ungrouped:At}),[At]),Hl=((v==null?void 0:v.workspaces.length)??0)>0,fa=((v==null?void 0:v.pinned.length)??0)>0,El=((v==null?void 0:v.live.length)??0)>0,mn=Dh({enabled:cn,scope:"workspaces",itemKey:T=>T.id,groups:rt.groups,ungrouped:rt.ungrouped,onReorder:N,onMoveToGroup:(T,oe)=>{U("workspace",T,oe.folderId),oe.order&&N("workspaces",oe.order)}}),pn=Dh({enabled:cn,scope:"pinned",itemKey:ra,groups:Bl.groups,ungrouped:Bl.ungrouped,onReorder:N}),ql=Dh({enabled:cn,scope:"live",itemKey:ra,groups:da.groups,ungrouped:da.ungrouped,onReorder:N});x.useEffect(()=>{if(!ut)return;const T=[...p,...u,...m].find(oe=>oe.id===ut.folderId);T&&T.color===(ut.color??void 0)&&Un(null)},[ut,p,u,m]),x.useEffect(()=>()=>window.clearTimeout(it.current),[]);const ol=ug(ms),ul=ug(Zn),[Pt,Gl]=x.useState(null),[Hn,Pn]=x.useState(null),[Oa,Yl]=x.useState(null),[Nn,qn]=x.useState(null),[Gn,ha]=x.useState(null),ns=x.useRef(null);function ks(T,oe){const Te=T.touches[0];if(!Te)return;const Ie={timer:0,x:Te.clientX,y:Te.clientY,el:T.currentTarget,fired:!1};Ie.timer=window.setTimeout(()=>{Ie.fired=!0,oe(Ie.x,Ie.y,Ie.el)},q0),ns.current=Ie}function $s(T){const oe=ns.current,Te=T.touches[0];!oe||!Te||Math.hypot(Te.clientX-oe.x,Te.clientY-oe.y)>10&&(window.clearTimeout(oe.timer),ns.current=null)}function Yt(T){const oe=ns.current;oe&&(window.clearTimeout(oe.timer),oe.fired&&T.preventDefault())}function Bs(){var T;return(T=ns.current)!=null&&T.fired?(ns.current=null,!0):!1}function Vl(){const T=Pt==null?void 0:Pt.opener;Gl(null),T!=null&&T.isConnected&&T.focus()}function tc(){const T=Hn==null?void 0:Hn.opener;Pn(null),T!=null&&T.isConnected&&T.focus()}function Ws(){const T=Nn==null?void 0:Nn.opener;qn(null),T!=null&&T.isConnected&&T.focus()}function Yn(){const T=Gn==null?void 0:Gn.opener;ha(null),T!=null&&T.isConnected&&T.focus()}function Xl(T){return{onContextMenu:oe=>{oe.preventDefault(),Gl({x:oe.clientX,y:oe.clientY,opener:oe.currentTarget,ids:ol.targetsFor(T)})},onTouchStart:oe=>ks(oe,(Te,Ie,zt)=>Gl({x:Te,y:Ie,opener:zt,ids:ol.targetsFor(T)})),onTouchMove:$s,onTouchEnd:Yt,onTouchCancel:Yt}}function Fl(T){return{onContextMenu:oe=>{oe.preventDefault(),Pn({x:oe.clientX,y:oe.clientY,opener:oe.currentTarget,ids:ul.targetsFor(T)})},onTouchStart:oe=>ks(oe,(Te,Ie,zt)=>Pn({x:Te,y:Ie,opener:zt,ids:ul.targetsFor(T)})),onTouchMove:$s,onTouchEnd:Yt,onTouchCancel:Yt}}function dl(T){return{onContextMenu:oe=>{oe.preventDefault(),qn({x:oe.clientX,y:oe.clientY,opener:oe.currentTarget,ids:[T.id]})},onTouchStart:oe=>ks(oe,(Te,Ie,zt)=>qn({x:Te,y:Ie,opener:zt,ids:[T.id]})),onTouchMove:$s,onTouchEnd:Yt,onTouchCancel:Yt}}function fl(T){return{onContextMenu:oe=>{oe.preventDefault(),ha({x:oe.clientX,y:oe.clientY,opener:oe.currentTarget,ids:[T.id]})},onTouchStart:oe=>ks(oe,(Te,Ie,zt)=>ha({x:Te,y:Ie,opener:zt,ids:[T.id]})),onTouchMove:$s,onTouchEnd:Yt,onTouchCancel:Yt}}const di=((E?(wn=g[E])==null?void 0:wn.sessions:void 0)??[]).filter(T=>T.state!=="closed").length,Kl=Pt?ms.find(T=>T.id===Pt.ids[0]):void 0,fi=Pt?[{id:"close",label:Pt.ids.length>1?`Закрыть проекты (${Pt.ids.length})`:"Закрыть проект",onSelect:()=>{z(Pt.ids),ol.clear()}},...Pt.ids.length===1?[{id:"new-session-folder",label:"Новая папка сессий",onSelect:()=>{const T=Pt.ids[0];B(T,!0),fs(T)}}]:[],...Pt.ids.length===1?[{id:"unmark",label:"Снять отметку проекта",onSelect:()=>Yl(Pt.ids[0])}]:[],...Sd({folders:u,ids:Pt.ids,hasFolder:(Kl==null?void 0:Kl.folderId)!=null,assign:(T,oe)=>U("workspace",T,oe),onClear:()=>ol.clear(),onNewFolder:()=>Kt("workspace")}),...Pt.ids.length===1&&cn?mn.menuItems(Pt.ids[0],Hl):[]]:[],hl=Pt?"закрытие не удаляет проект: каталог и история сессий остаются на диске — открыть его снова можно кнопкой «+ Проект»."+(E&&Pt.ids.includes(E)&&di>0?` в нём сейчас незавершённых сессий: ${di} — при закрытии они остановятся на хосте.`:""):void 0,Wn=Hn?Zn.find(T=>T.id===Hn.ids[0]):void 0,Js=Hn?[{id:"restore",label:Hn.ids.length>1?`Вернуть проекты (${Hn.ids.length})`:"Вернуть проект",onSelect:()=>{H(Hn.ids),ul.clear()}},...Hn.ids.length===1?[{id:"unmark",label:"Снять отметку проекта",onSelect:()=>Yl(Hn.ids[0])}]:[],...Sd({folders:u,ids:Hn.ids,hasFolder:(Wn==null?void 0:Wn.folderId)!=null,assign:(T,oe)=>U("workspace",T,oe),onClear:()=>ul.clear(),onNewFolder:()=>Kt("workspace")})]:[],be=Hn?"каталог и история сессий всё это время оставались на диске — восстановление их не трогает.":void 0,S=Nn?wt.find(T=>T.id===Nn.ids[0]):void 0,K=Nn?[{id:"rename",label:"Переименовать",onSelect:()=>nt(Nn.ids[0])},{id:"unpin",label:"Открепить",onSelect:()=>{S&&P(S.workspaceId,[S.id],!1)}},{id:"archive",label:"Убрать в архив",onSelect:()=>{S&&F(S.workspaceId,[S.id])}},...S&&S.workspaceId===E?Sd({folders:m.filter(T=>T.workspaceId===S.workspaceId),ids:[S.id],hasFolder:S.folderId!=null,assign:(T,oe)=>U("session",T,oe,S.workspaceId),onClear:()=>{},onNewFolder:()=>{B(S.workspaceId,!0),fs(S.workspaceId)}}):[],...eS(S?Sd({folders:p,ids:[S.id],hasFolder:S.pinnedFolderId!=null,assign:(T,oe)=>U("pinned",T,oe),onClear:()=>{},onNewFolder:()=>Kt("pinned")}):[]),...cn&&S?pn.menuItems(ra(S),fa):[]]:[],pe=Gn?At.find(T=>T.id===Gn.ids[0]):void 0,ve=Gn?[{id:"stop",label:"Остановить",onSelect:()=>{pe&&G(pe)}},{id:"rename",label:"Переименовать",onSelect:()=>nt(Gn.ids[0])},{id:"pin",label:(pe==null?void 0:pe.pinned)===!0?"Открепить":"Закрепить",onSelect:()=>{pe&&P(pe.workspaceId,[pe.id],pe.pinned!==!0)}},{id:"archive",label:"Убрать в архив",onSelect:()=>{pe&&F(pe.workspaceId,[pe.id])}},...cn&&pe?ql.menuItems(ra(pe),El):[]]:[],ze={start:ks,move:$s,end:Yt,consumed:Bs};function Ye(T,oe){return s.jsxs("div",{className:"row row--confirm",style:Dd(oe),role:"alertdialog","aria-label":`Снять отметку с «${T.name}»`,children:[s.jsx("p",{className:"row__confirm-text",children:`Снять отметку с «${T.name}»? Каталог и файлы останутся на диске, сессии проекта будут остановлены.`}),s.jsxs("div",{className:"row__confirm-bar",children:[s.jsx("button",{type:"button",className:"btn btn--sm",onClick:()=>Yl(null),children:"Отмена"}),s.jsx("button",{type:"button",className:"btn btn--danger btn--sm",autoFocus:!0,onClick:()=>{Yl(null),te([T.id])},children:"Снять отметку"})]})]},T.id)}function at(T,oe){var xn,ss;const Te=oe?1:0;if(Oa===T.id)return Ye(T,Te);const Ie=Ke(T),zt=`ws-branch-${T.id}`;return s.jsxs(x.Fragment,{children:[s.jsxs("div",{"data-row-key":T.id,"data-row-scope":"workspaces",className:tu(T.id===E,ol.selected.includes(T.id),void 0,!!oe)+" row--project"+mn.dropClass(T.id),style:Pi(Te,Gt(oe)),...Xl(T),children:[Vc(oe),cn&&s.jsx("button",{type:"button",className:"row__grip",title:"Перетащить в папку (каталог проекта переедет на диске) или изменить порядок","aria-label":"Перетащить проект: в папку или на другое место в списке",...mn.gripHandlers(T.id),children:s.jsx(Lh,{})}),s.jsx("button",{type:"button",className:"row__chev","aria-expanded":Ie.open,"aria-controls":zt,"aria-label":`${Ie.open?"Свернуть":"Развернуть"} проект «${T.name}»`,title:Ie.open?"Свернуть сессии проекта":"Показать сессии проекта",onClick:()=>{Bs()||on(T,Ie)},children:s.jsx(Jh,{open:Ie.open})}),s.jsxs("button",{className:"row__main",onClick:sn=>{Bs()||ol.click(sn,T,()=>{I(T.id),B(T.id,!0)})},onKeyDown:sn=>mn.onKeyDown(T.id,sn),children:[s.jsxs("span",{className:"row__title",children:[T.name,T.hasClaudeMd&&" ·"]}),s.jsx("span",{className:"row__meta",title:T.path,children:O===T.id?"переносим…":T.path})]}),s.jsx(F0,{agg:Mn.byWorkspace.get(T.id)}),Ie.count!==void 0&&s.jsx("span",{className:"sidebar__count row__count",title:"Всего сессий в проекте, запущенных и нет",children:Ie.count})]}),Ie.open&&s.jsx("div",{id:zt,role:"group","aria-label":`Сессии проекта «${T.name}»`,className:oe?"tree__branch tree__branch--railed":"tree__branch",style:Pi(Te,Gt(oe)),children:s.jsx(Zw,{workspace:T,baseDepth:Te+1,loaded:Ie.entry!==void 0,sessions:((xn=Ie.entry)==null?void 0:xn.sessions)??Gb,archived:((ss=Ie.entry)==null?void 0:ss.archived)??Gb,folders:m.filter(sn=>sn.workspaceId===T.id),needle:Et,showAll:Ie.showAll,reorderEnabled:cn,listOrder:v,liveSessionsFirst:k,activeSessionId:C,archiveExpanded:Ot.includes(T.id),onToggleArchive:()=>xe(T.id),creatingFolder:es===T.id,onStartCreateFolder:()=>fs(T.id),onFinishCreateFolder:()=>fs(null),renamingId:Me,setRenamingId:nt,renderFolderHead:Wt,liveInFolder:Mn.bySessionFolder,isFolderOpen:Us,folderRowStyle:Gt,longPress:ze,onOpenSession:V,onRenameSession:D,onPinSessions:P,onArchiveSessions:F,onUnarchiveSessions:fe,onCreateFolder:Q,onAssignToFolder:U,onReorder:N})})]},T.id)}function gt(T){const oe=cl.get(T.id);if(!oe)return null;const Te=_t||ts.includes(T.id),Ie=Te?oe:oe.slice(0,Yb),zt=oe.length-Ie.length,xn=Pi(1,Gt(T));return s.jsxs("div",{role:"group","aria-label":`Не открытые в ccv каталоги папки «${T.name}»`,children:[Ie.map(ss=>s.jsxs("div",{className:"row row--foldered row--unopened",style:xn,children:[Vc(T),s.jsxs("button",{type:"button",className:"row__main row__main--unopened",title:`${ss.path}
124
+ Не открыт в ccv — нажмите, чтобы открыть как проект`,onClick:()=>ce(ss.path),children:[s.jsx("span",{className:"row__unopened-icon","aria-hidden":"true",children:s.jsx(aS,{})}),s.jsx("span",{className:"row__title",children:ss.name})]})]},ss.path)),(zt>0||Te&&!_t&&oe.length>Yb)&&s.jsxs("div",{className:"row row--foldered row--unopened",style:xn,children:[Vc(T),s.jsxs("button",{type:"button",className:"row__main row__main--unopened row__more","aria-expanded":Te,onClick:()=>Ns(ss=>ss.includes(T.id)?ss.filter(sn=>sn!==T.id):[...ss,T.id]),children:[s.jsx("span",{className:"row__unopened-icon","aria-hidden":"true"}),s.jsx("span",{className:"row__title",children:zt>0?`Ещё ${zt}`:"Свернуть"})]})]})]})}function gn(T,oe){return Oa===T.id?Ye(T,oe?1:0):s.jsxs("div",{className:tu(T.id===E,ul.selected.includes(T.id),void 0,!!oe),style:Gt(oe),...Fl(T),children:[Vc(oe),s.jsxs("button",{className:"row__main",onClick:Te=>{Bs()||ul.click(Te,T,()=>I(T.id))},children:[s.jsxs("span",{className:"row__title",children:[T.name,T.hasClaudeMd&&" ·"]}),s.jsx("span",{className:"row__meta",children:yS(T)})]}),s.jsx("button",{className:"row__restore",title:"Вернуть проект из архива",onClick:()=>H([T.id]),children:"Вернуть"})]},T.id)}function un(T,oe){const Te=ra(T);return s.jsxs("div",{"data-row-key":Te,"data-row-scope":"pinned",className:tu(T.id===C,!1,T.provider,!!oe,!0)+pn.dropClass(Te),style:Gt(oe),...Me===T.id?{}:{title:"Действия со строкой — правый клик или долгое нажатие",...dl(T)},children:[Vc(oe),Me===T.id?s.jsx("div",{className:"row__main",children:s.jsx(oi,{value:T.title??"",onCommit:Ie=>{D(T,Ie),nt(null)},onCancel:()=>nt(null)})}):s.jsxs(s.Fragment,{children:[cn&&s.jsx("button",{type:"button",className:"row__grip",title:"Перетащить, чтобы изменить порядок","aria-label":"Перетащить сессию, чтобы изменить порядок в списке",...pn.gripHandlers(Te),children:s.jsx(Lh,{})}),s.jsx("button",{className:"row__main row__main--session",onClick:()=>{Bs()||V(T)},onKeyDown:Ie=>pn.onKeyDown(Te,Ie),children:s.jsx(Yh,{session:T,pinned:!1,projectName:Qs(T.workspaceId),projectPath:hn(T.workspaceId)})})]})]},T.id)}function kn(T){const oe=ra(T);return s.jsx("div",{"data-row-key":oe,"data-row-scope":"live",className:tu(T.id===C,!1,T.provider,!1,!0)+ql.dropClass(oe),...Me===T.id?{}:{title:"Действия со строкой — правый клик или долгое нажатие",...fl(T)},children:Me===T.id?s.jsx("div",{className:"row__main",children:s.jsx(oi,{value:T.title??"",onCommit:Te=>{D(T,Te),nt(null)},onCancel:()=>nt(null)})}):s.jsxs(s.Fragment,{children:[cn&&s.jsx("button",{type:"button",className:"row__grip",title:"Перетащить, чтобы изменить порядок","aria-label":"Перетащить сессию, чтобы изменить порядок в списке",...ql.gripHandlers(oe),children:s.jsx(Lh,{})}),s.jsx("button",{className:"row__main row__main--session",onClick:()=>{Bs()||V(T)},onKeyDown:Te=>ql.onKeyDown(oe,Te),children:s.jsx(Yh,{session:T,pinned:T.pinned===!0,projectName:Qs(T.workspaceId),projectPath:hn(T.workspaceId)})}),s.jsx("button",{type:"button",className:"row__stop",title:"Остановить сессию","aria-label":"Остановить сессию",onClick:Te=>{Te.stopPropagation(),!Bs()&&G(T)},children:s.jsx(rS,{})})]})},T.id)}function Wt(T,oe,Te={}){return s.jsx(sS,{folder:T,count:oe,live:Te.live,depth:Te.depth??0,droppable:Te.droppable===!0,dropActive:Te.droppable===!0&&mn.isDropFolder(T.id),open:Us(T.id),renaming:In===T.id,onToggle:()=>ua(T.id),onStartRename:()=>kt(T.id),onCommitRename:Ie=>{X(T.id,Ie),kt(null)},onCancelRename:()=>kt(null),onOpenAsProject:T.id.startsWith("dir:")&&T.path?()=>ce(T.path):void 0,color:$n(T),onPreviewColor:Ie=>{window.clearTimeout(it.current),Un({folderId:T.id,color:Ie})},onCommitColor:Ie=>{Un({folderId:T.id,color:Ie}),ge(T.id,Ie),window.clearTimeout(it.current),it.current=window.setTimeout(()=>Un(null),4e3)},onResetColor:()=>{window.clearTimeout(it.current),Un(null),ge(T.id,null)}},T.id)}return s.jsxs("aside",{className:n?"sidebar sidebar--open":"sidebar",children:[s.jsxs("div",{className:"sidebar__head",children:[s.jsx("span",{className:l?"dot dot--on":"dot",title:i}),s.jsx("span",{className:"brand",children:"Claude Code Visual"}),s.jsx("button",{className:"theme-btn",title:`Тема: ${Fb[js]}`,"aria-label":`Тема: ${Fb[js]}. Переключить`,onClick:lt,children:s.jsx(mS,{mode:js})})]}),s.jsxs("div",{className:"sidebar__tabs",role:"tablist","aria-label":"Что показывать в списке",children:[s.jsx("button",{type:"button",role:"tab","aria-selected":Ae==="default",className:Ae==="default"?"sidebar__tab is-active":"sidebar__tab",onClick:()=>Bn("default"),children:s.jsx("span",{className:"sidebar__tab-label",children:"Все"})}),s.jsx("button",{type:"button",role:"tab","aria-selected":Ae==="pinned",className:Ae==="pinned"?"sidebar__tab is-active":"sidebar__tab",onClick:()=>Bn("pinned"),children:s.jsx("span",{className:"sidebar__tab-label",children:"Закреплённые"})}),s.jsxs("button",{type:"button",role:"tab","aria-selected":Ae==="live",className:Ae==="live"?"sidebar__tab is-active":"sidebar__tab",onClick:()=>Bn("live"),children:[s.jsx("span",{className:"sidebar__tab-label",children:"Запущенные"}),j.length>0&&s.jsx("span",{className:"sidebar__tab-count",children:j.length})]})]}),s.jsxs("div",{className:"fssearch fssearch--sidebar",children:[s.jsx(oS,{}),s.jsx("input",{className:"fssearch__input",type:"text",value:Tt,spellCheck:!1,placeholder:"Проект или сессия…","aria-label":"Поиск по проектам и сессиям",onChange:T=>Lt(T.target.value),onKeyDown:T=>{T.stopPropagation(),T.key==="Escape"&&(T.preventDefault(),Tt?Lt(""):T.currentTarget.blur())}}),Tt&&s.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>Lt(""),children:"✕"})]}),s.jsxs("div",{className:"sidebar__scroll",children:[Ae==="pinned"?s.jsxs(s.Fragment,{children:[s.jsx(_h,{title:"Закреплённые",count:wt.length,open:Rn("pinned"),onToggle:()=>ps("pinned"),action:{label:"Новая папка закреплённых",onClick:()=>{Kt("pinned"),Rn("pinned")||ps("pinned")}}}),Rn("pinned")&&s.jsxs(s.Fragment,{children:[vt==="pinned"&&s.jsx("div",{className:"row",children:s.jsx("div",{className:"row__main",children:s.jsx(oi,{value:"",placeholder:"Название папки",onCommit:T=>{Q("pinned",T),Kt(null)},onCancel:()=>Kt(null)})})}),wt.length===0&&s.jsx("div",{className:"row",children:s.jsx("span",{className:"row__meta",children:_t?"Ничего не найдено":"закрепите сессию через её меню (правый клик или долгое нажатие) — она останется под рукой из любого проекта"})}),Bl.groups.map(T=>s.jsxs(x.Fragment,{children:[Wt(T.folder,T.items.length),Us(T.folder.id)&&T.items.map(oe=>un(oe,T.folder))]},T.folder.id)),Bl.ungrouped.map(T=>un(T))]})]}):Ae==="live"?s.jsxs(s.Fragment,{children:[s.jsx(_h,{title:"Запущенные",count:At.length,open:Rn("live"),onToggle:()=>ps("live")}),Rn("live")&&s.jsxs(s.Fragment,{children:[At.length===0&&s.jsx("div",{className:"row",children:s.jsx("span",{className:"row__meta",children:_t?"Ничего не найдено":"Нет запущенных сессий"})}),At.map(T=>kn(T))]})]}):s.jsxs(s.Fragment,{children:[s.jsx(_h,{title:"Проекты",count:ms.length,open:Rn("workspaces"),onToggle:()=>ps("workspaces"),action:{label:"Новая папка проектов",onClick:()=>{Kt("workspace"),Rn("workspaces")||ps("workspaces")}}}),Rn("workspaces")&&s.jsxs(s.Fragment,{children:[L&&s.jsxs("div",{className:"sidebar__notice",role:"alert",children:[s.jsx("span",{children:L}),s.jsx("button",{type:"button",className:"sidebar__notice-close","aria-label":"Закрыть сообщение",onClick:M,children:"✕"})]}),vt==="workspace"&&s.jsx("div",{className:"row",children:s.jsx("div",{className:"row__main",children:s.jsx(oi,{value:"",placeholder:"Название папки",onCommit:T=>{Q("workspace",T),Kt(null)},onCancel:()=>Kt(null)})})}),J&&ms.length===0&&cl.size===0&&s.jsx("div",{className:"row",children:s.jsx("span",{className:"row__meta",children:_t?"Ничего не найдено":"Пока ни одного"})}),Zs.map(T=>s.jsxs(x.Fragment,{children:[Wt(T.folder,T.items.length,{droppable:cn,live:Mn.byWorkspaceFolder.get(T.folder.id)}),Us(T.folder.id)&&T.items.map(oe=>at(oe,T.folder)),Us(T.folder.id)&&gt(T.folder)]},T.folder.id)),rt.ungrouped.map(T=>at(T)),mn.canUngroup&&s.jsx("div",{className:mn.zoneActive?"tree__zone tree__zone--active":"tree__zone","data-drop-zone":"ungrouped",children:"Без папки"})]}),o.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(_h,{title:"Архив проектов",count:Zn.length,open:Rn("workspacesArchive"),onToggle:()=>ps("workspacesArchive"),hint:"проект закрывают вручную; каталог и история сессий остаются на диске и открываются заново отсюда или через «+ Проект»"}),Rn("workspacesArchive")&&s.jsxs(s.Fragment,{children:[Zn.length===0&&s.jsx("div",{className:"row",children:s.jsx("span",{className:"row__meta",children:_t?"Ничего не найдено":"Пока пусто"})}),Ps.groups.map(T=>s.jsxs(x.Fragment,{children:[Wt(T.folder,T.items.length),Us(T.folder.id)&&T.items.map(oe=>gn(oe,T.folder))]},T.folder.id)),Ps.ungrouped.map(T=>gn(T))]})]})]}),s.jsx(Fw,{query:Tt,workspaces:r,results:dt,onSearch:jn,onOpen:Ze})]}),s.jsxs("div",{className:"sidebar__foot",children:[mt.multi?s.jsxs("button",{className:"account-btn",title:"Аккаунты Claude",onClick:ae,children:[s.jsx("span",{className:"account-btn__marks",children:mt.accounts.map(T=>{var Te;const oe=((Te=mt.auth[T.id])==null?void 0:Te.loggedIn)===!1;return s.jsx("span",{className:oe?"account-btn__mark is-out":"account-btn__mark",children:s.jsx(Da,{account:T})},T.id)})}),s.jsx("span",{className:"account-btn__id",children:"Аккаунты Claude"}),mt.accounts.some(T=>{var oe;return((oe=mt.auth[T.id])==null?void 0:oe.loggedIn)===!1})&&s.jsx("span",{className:"chip chip--warn",children:"нет входа"})]}):s.jsxs("button",{className:"account-btn",title:"Аккаунт Claude",onClick:ae,children:[s.jsx("span",{className:de!=null&&de.loggedIn?"dot dot--on":"dot"}),s.jsx("span",{className:"account-btn__id",children:de===null?"Аккаунт":de.loggedIn?de.email||"Вход выполнен":"Войти в аккаунт"}),(de==null?void 0:de.plan)&&s.jsx("span",{className:"chip",children:de.plan})]}),Se&&s.jsxs("button",{className:"account-btn",title:"Доступ с телефона и из браузера",onClick:Se,children:[s.jsx("span",{className:qe!=null&&qe.connected?"dot dot--on":"dot"}),s.jsx("span",{className:"account-btn__id",children:qe===null?"Удалённый доступ":qe.paired?qe.connected?qe.name||"Удалённый доступ включён":"Удалённый доступ · нет связи":"Удалённый доступ"}),(qe==null?void 0:qe.connected)&&qe.clients>0&&s.jsx("span",{className:"chip",children:qe.clients})]}),s.jsxs("div",{className:"sidebar__foot-row",children:[s.jsx("button",{className:"btn btn--ghost",disabled:!$,title:"MCP-серверы и плагины",onClick:()=>$==null?void 0:$(),children:"Расширения"}),s.jsx("button",{className:"btn btn--ghost",title:"Настройки приложения",onClick:Ge,children:"Настройки"}),s.jsx("button",{className:"btn btn--ghost sidebar__tasks",title:"Запланированные задачи","aria-label":"Запланированные задачи",onClick:Ve,children:s.jsxs("svg",{viewBox:"0 0 16 16",width:"15",height:"15",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("circle",{cx:"8",cy:"8",r:"6"}),s.jsx("path",{d:"M8 4.6V8l2.2 1.4"})]})})]}),s.jsxs("div",{className:"sidebar__foot-row",children:[s.jsx("button",{className:"btn btn--ghost",disabled:!E,title:"Страница сайта с выбором элементов и правками",onClick:Je,children:"Сайт"}),s.jsx("button",{className:"btn btn--ghost",disabled:!E,title:"Видео, Remotion и анимации проекта",onClick:Ft,children:"Видео"})]}),s.jsxs("div",{className:"sidebar__foot-row",children:[s.jsx("button",{className:"btn btn--ghost",onClick:le,children:"+ Проект"}),s.jsx(Hw,{disabled:!E,providers:W,lastAccountId:me,onStart:A,onSignIn:Ee})]})]}),Pt&&s.jsx(er,{x:Pt.x,y:Pt.y,items:fi,note:hl,onClose:Vl}),Hn&&s.jsx(er,{x:Hn.x,y:Hn.y,items:Js,note:be,onClose:tc}),Nn&&s.jsx(er,{x:Nn.x,y:Nn.y,items:K,note:og,onClose:Ws}),Gn&&s.jsx(er,{x:Gn.x,y:Gn.y,items:ve,note:og,onClose:Yn})]})}const Gb=[];function Md(n,l){return(n.title??"").toLowerCase().includes(l)}function Vc(n){return n?s.jsx("span",{className:"row__stripe","aria-hidden":"true"}):null}function Pi(n,l){return{"--depth":n,...l}}function Zw({workspace:n,baseDepth:l,loaded:i,sessions:r,archived:o,folders:u,needle:m,showAll:p,reorderEnabled:g,listOrder:_,liveSessionsFirst:b,activeSessionId:j,archiveExpanded:v,onToggleArchive:k,creatingFolder:N,onStartCreateFolder:E,onFinishCreateFolder:C,renamingId:I,setRenamingId:D,renderFolderHead:G,liveInFolder:P,isFolderOpen:V,folderRowStyle:z,longPress:H,onOpenSession:te,onRenameSession:F,onPinSessions:fe,onArchiveSessions:Q,onUnarchiveSessions:X,onCreateFolder:ge,onAssignToFolder:U,onReorder:L}){var mt;const M=n.id,O=m!=="",J=x.useMemo(()=>{const Me=Mh(r,_==null?void 0:_.sessions[M],ra,"top");return b?I0(Me):Me},[r,_,M,b]),le=x.useMemo(()=>p?J:J.filter(Me=>Md(Me,m)),[J,p,m]),ce=x.useMemo(()=>p?o:o.filter(Me=>Md(Me,m)),[o,p,m]),A=x.useMemo(()=>Rd(le,u,void 0,!O),[le,u,O]),W=x.useMemo(()=>Rd(ce,u),[ce,u]),me=(((mt=_==null?void 0:_.sessions[M])==null?void 0:mt.length)??0)>0,Ee=Dh({enabled:g,scope:"sessions",workspaceId:M,itemKey:ra,groups:A.groups,ungrouped:A.ungrouped,onReorder:L}),$=ug(le),[de,ae]=x.useState(null),[qe,Se]=x.useState(!1);x.useEffect(()=>Se(!1),[m]);const Ge=O&&ce.length>0,Ve=Ge?!qe:v;function Je(){const Me=de==null?void 0:de.opener;ae(null),Me!=null&&Me.isConnected&&Me.focus()}function Ft(Me){return{onContextMenu:nt=>{nt.preventDefault(),ae({x:nt.clientX,y:nt.clientY,opener:nt.currentTarget,ids:$.targetsFor(Me)})},onTouchStart:nt=>H.start(nt,(In,kt,ut)=>ae({x:In,y:kt,opener:ut,ids:$.targetsFor(Me)})),onTouchMove:H.move,onTouchEnd:H.end,onTouchCancel:H.end}}const dt=de?le.find(Me=>Me.id===de.ids[0]):void 0,jn=(dt==null?void 0:dt.pinned)!==!0,Ze=de?[...de.ids.length===1?[{id:"rename",label:"Переименовать",onSelect:()=>D(de.ids[0])}]:[],{id:"pin",label:jn?de.ids.length>1?`Закрепить (${de.ids.length})`:"Закрепить":de.ids.length>1?`Открепить (${de.ids.length})`:"Открепить",onSelect:()=>{fe(M,de.ids,jn),$.clear()}},{id:"archive",label:de.ids.length>1?`Убрать в архив (${de.ids.length})`:"Убрать в архив",onSelect:()=>{Q(M,de.ids),$.clear()}},...Sd({folders:u,ids:de.ids,hasFolder:(dt==null?void 0:dt.folderId)!=null,assign:(Me,nt)=>U("session",Me,nt,M),onClear:()=>$.clear(),onNewFolder:E}),...de.ids.length===1&&g&&dt?Ee.menuItems(ra(dt),me):[]]:[];function js(Me,nt,In){const kt=ra(Me);return s.jsxs("div",{"data-row-key":kt,"data-row-scope":"sessions",className:tu(Me.id===j,$.selected.includes(Me.id),Me.provider,!!In,!0)+Ee.dropClass(kt),style:Pi(nt,z(In)),...I===Me.id?{}:Ft(Me),children:[Vc(In),I===Me.id?s.jsx("div",{className:"row__main",children:s.jsx(oi,{value:Me.title??"",onCommit:ut=>{F(Me,ut),D(null)},onCancel:()=>D(null)})}):s.jsxs(s.Fragment,{children:[g&&s.jsx("button",{type:"button",className:"row__grip",title:"Перетащить, чтобы изменить порядок","aria-label":"Перетащить сессию, чтобы изменить порядок в списке",...Ee.gripHandlers(kt),children:s.jsx(Lh,{})}),s.jsx("button",{className:"row__main row__main--session",onClick:ut=>{H.consumed()||$.click(ut,Me,()=>te(Me))},onKeyDown:ut=>Ee.onKeyDown(kt,ut),children:s.jsx(Yh,{session:Me,pinned:Me.pinned===!0})}),s.jsx("button",{className:"row__edit",title:"Переименовать","aria-label":"Переименовать сессию",onClick:()=>{H.consumed()||D(Me.id)},children:"✎"})]})]},Me.id)}function lt(Me,nt,In){return s.jsxs("div",{className:tu(Me.id===j,!1,Me.provider,!!In,!0),style:Pi(nt,z(In)),children:[Vc(In),s.jsx("button",{className:"row__main row__main--session",onClick:()=>te(Me),children:s.jsx(Yh,{session:Me,pinned:!1,archived:!0})}),s.jsx("button",{className:"row__restore",title:"Вернуть сессию из архива",onClick:()=>X(M,[Me.id]),children:"Вернуть"})]},Me.id)}return s.jsxs(s.Fragment,{children:[N&&s.jsx("div",{className:"row row--hint",style:Pi(l,void 0),children:s.jsx("div",{className:"row__main",children:s.jsx(oi,{value:"",placeholder:"Название папки",onCommit:Me=>{ge("session",Me,M),C()},onCancel:C})})}),i?le.length===0&&s.jsx("div",{className:"row row--hint",style:Pi(l,void 0),children:s.jsx("span",{className:"row__meta",children:"Пока ни одной"})}):s.jsx("div",{className:"row row--hint",style:Pi(l,void 0),"aria-busy":"true",children:s.jsx("span",{className:"row__meta",children:"Загрузка…"})}),A.groups.map(Me=>s.jsxs(x.Fragment,{children:[G(Me.folder,Me.items.length,{depth:l,live:P.get(Me.folder.id)}),V(Me.folder.id)&&Me.items.map(nt=>js(nt,l+1,Me.folder))]},Me.folder.id)),A.ungrouped.map(Me=>js(Me,l)),i&&o.length>0&&(!O||ce.length>0)&&s.jsxs(s.Fragment,{children:[s.jsx(Pw,{title:"Архив",count:ce.length,open:Ve,depth:l,hint:"сессии без обращения дольше двух суток уезжают сюда сами; ничего не удаляется",onToggle:()=>Ge?Se(Me=>!Me):k()}),Ve&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"row row--hint",style:Pi(l,void 0),children:s.jsx("span",{className:"row__meta",children:"сюда сами уезжают сессии без обращения дольше двух суток; транскрипт остаётся на диске, ничего не удаляется"})}),W.groups.map(Me=>s.jsxs(x.Fragment,{children:[G(Me.folder,Me.items.length,{depth:l}),V(Me.folder.id)&&Me.items.map(nt=>lt(nt,l+1,Me.folder))]},Me.folder.id)),W.ungrouped.map(Me=>lt(Me,l))]})]}),de&&s.jsx(er,{x:de.x,y:de.y,items:Ze,note:og,onClose:Je})]})}function Pw({title:n,count:l,open:i,depth:r,hint:o,onToggle:u}){const m=i?`Свернуть «${n}»`:`Развернуть «${n}»`;return s.jsx("div",{className:"row",style:Dd(r),children:s.jsxs("button",{className:"row__main",style:G0,"aria-expanded":i,title:`${m} — ${o}`,onClick:u,children:[s.jsx(Jh,{open:i}),s.jsx("span",{style:V0,children:n}),s.jsx("span",{className:"sidebar__count",children:l})]})})}function tu(n,l,i,r,o){const u=["row"];return o&&u.push("row--session"),r&&u.push("row--foldered"),n&&u.push("row--active"),l&&u.push("row--selected"),(i==="antigravity"||i==="codex")&&u.push(`row--${i}`),u.join(" ")}function Rd(n,l,i=o=>o.folderId,r=!1){const o=new Map(l.map(g=>[g.id,g])),u=new Map,m=[];for(const g of n){const _=i(g),b=_?o.get(_):void 0;if(!b){m.push(g);continue}const j=u.get(b.id);j?j.push(g):u.set(b.id,[g])}if(r)for(const g of l)u.has(g.id)||u.set(g.id,[]);return{groups:[...u.entries()].map(([g,_])=>({folder:o.get(g),items:_})).sort((g,_)=>g.folder.name.localeCompare(_.folder.name,"ru")),ungrouped:m}}function Ww(n,l,i){return[...n.flatMap(r=>r.items.map(i)),...l.map(i)]}const Rh="\0ungrouped";function Jw(n,l,i){const r=new Map;for(const o of n)for(const u of o.items)r.set(i(u),o.folder.id);for(const o of l)r.set(i(o),Rh);return r}function Up(n,l,i,r,o){const u=[...l.map(p=>p.items),i].find(p=>p.some(g=>r(g)===n));if(!u)return null;const m=u.findIndex(p=>r(p)===n);return o==="up"?m<=0?null:{target:r(u[m-1]),position:"before"}:m===-1||m>=u.length-1?null:{target:r(u[m+1]),position:"after"}}function Dh(n){const[l,i]=x.useState(null),[r,o]=x.useState(null),[u,m]=x.useState(null),p=n.onMoveToGroup,g=x.useMemo(()=>Ww(n.groups,n.ungrouped,n.itemKey),[n.groups,n.ungrouped,n.itemKey]),_=x.useMemo(()=>Jw(n.groups,n.ungrouped,n.itemKey),[n.groups,n.ungrouped,n.itemKey]),b=x.useRef({raf:0,el:null,x:0,y:0}),j=x.useRef(()=>{});function v(){window.cancelAnimationFrame(b.current.raf),b.current.raf=0,b.current.el=null}function k(Q){v();const X=b.current;if(X.el=Q.closest(".sidebar__scroll"),!X.el)return;const ge=56,U=16,L=()=>{const M=X.el;if(!M)return;const O=M.getBoundingClientRect();let J=0;if(X.y<O.top+ge?J=-U*Math.min(1,(O.top+ge-X.y)/ge):X.y>O.bottom-ge&&(J=U*Math.min(1,(X.y-(O.bottom-ge))/ge)),J!==0){const le=M.scrollTop;M.scrollTop=le+J,M.scrollTop!==le&&j.current(X.x,X.y)}X.raf=window.requestAnimationFrame(L)};X.raf=window.requestAnimationFrame(L)}x.useEffect(()=>v,[]);function N(){v(),i(null),o(null),m(null)}function E(Q,X){n.enabled&&(X.preventDefault(),X.currentTarget.setPointerCapture(X.pointerId),b.current.x=X.clientX,b.current.y=X.clientY,k(X.currentTarget),i(Q),o(null),m(null))}function C(Q,X){if(!l)return;const ge=document.elementFromPoint(Q,X),U=_.get(l);if(p){const ce=ge==null?void 0:ge.closest("[data-drop-folder]"),A=ce?null:ge==null?void 0:ge.closest("[data-drop-zone]");if(ce||A){const W=ce?ce.dataset.dropFolder:null,me=W??Rh;o(null),m(me===U?null:{folderId:W});return}}const L=ge==null?void 0:ge.closest("[data-row-key]"),M=(L==null?void 0:L.dataset.rowScope)===n.scope?L.dataset.rowKey:void 0,O=M?_.get(M):void 0;if(m(null),!M||M===l||O===void 0||!p&&O!==U){o(null);return}const J=L.getBoundingClientRect(),le=X-J.top<J.height/2?"before":"after";o(ce=>(ce==null?void 0:ce.key)===M&&ce.position===le?ce:{key:M,position:le})}j.current=C;function I(Q){b.current.x=Q.clientX,b.current.y=Q.clientY,C(Q.clientX,Q.clientY)}function D(){if(l&&u&&p)p(l,{folderId:u.folderId,order:null});else if(l&&r){const Q=xh(g,l,r.key,r.position),X=_.get(r.key);p&&X!==_.get(l)?p(l,{folderId:X===Rh?null:X??null,order:Q}):Q&&n.onReorder(n.scope,Q,n.workspaceId)}N()}function G(Q,X){if(!n.enabled)return;const ge=Up(Q,n.groups,n.ungrouped,n.itemKey,X);if(!ge)return;const U=xh(g,Q,ge.target,ge.position);U&&n.onReorder(n.scope,U,n.workspaceId)}function P(Q,X){const ge=Up(Q,n.groups,n.ungrouped,n.itemKey,"up"),U=Up(Q,n.groups,n.ungrouped,n.itemKey,"down"),L=[{id:"move-up",label:"Переместить выше",disabled:!ge,onSelect:()=>{if(!ge)return;const M=xh(g,Q,ge.target,ge.position);M&&n.onReorder(n.scope,M,n.workspaceId)}},{id:"move-down",label:"Переместить ниже",disabled:!U,onSelect:()=>{if(!U)return;const M=xh(g,Q,U.target,U.position);M&&n.onReorder(n.scope,M,n.workspaceId)}}];return X&&L.push({id:"reset-order",label:"Сбросить порядок",onSelect:()=>n.onReorder(n.scope,null,n.workspaceId)}),L}function V(Q){return l===Q?" row--dragging":(r==null?void 0:r.key)===Q?r.position==="before"?" row--drop-before":" row--drop-after":""}function z(Q){return{onPointerDown:X=>E(Q,X),onPointerMove:I,onPointerUp:D,onPointerCancel:N,onLostPointerCapture:N}}function H(Q,X){!X.altKey||X.key!=="ArrowUp"&&X.key!=="ArrowDown"||(X.preventDefault(),G(Q,X.key==="ArrowUp"?"up":"down"))}const te=Q=>(u==null?void 0:u.folderId)===Q,F=!!p&&l!==null&&_.get(l)!==Rh,fe=u!==null&&u.folderId===null;return{dragging:l!==null,dropClass:V,gripHandlers:z,onKeyDown:H,menuItems:P,isDropFolder:te,canUngroup:F,zoneActive:fe}}function Sd(n){return[...[...n.folders].sort((i,r)=>i.name.localeCompare(r.name,"ru")).map(i=>({id:`folder:${i.id}`,label:`В папку «${i.name}»`,onSelect:()=>{n.ids.forEach(r=>n.assign(r,i.id)),n.onClear()}})),...n.hasFolder?[{id:"folder:none",label:"Без папки",onSelect:()=>{n.ids.forEach(i=>n.assign(i,null)),n.onClear()}}]:[],{id:"folder:new",label:"Новая папка…",onSelect:n.onNewFolder}]}function eS(n){return n.map(l=>({...l,id:`pinned:${l.id}`,label:l.id==="folder:new"?"Новая папка закреплённых…":l.id==="folder:none"?"Без папки закреплённых":l.label}))}function ug(n){const[l,i]=x.useState([]),r=x.useRef(null);function o(){i([]),r.current=null}function u(p,g,_){if(p.ctrlKey||p.metaKey){i(b=>b.includes(g.id)?b.filter(j=>j!==g.id):[...b,g.id]),r.current=g.id;return}if(p.shiftKey&&r.current){const b=n.findIndex(v=>v.id===r.current),j=n.findIndex(v=>v.id===g.id);if(b!==-1&&j!==-1){const[v,k]=b<j?[b,j]:[j,b];i(n.slice(v,k+1).map(N=>N.id));return}}o(),r.current=g.id,_()}function m(p){return l.includes(p.id)?l:(i([p.id]),r.current=p.id,[p.id])}return{selected:l,click:u,targetsFor:m,clear:o}}const tS={display:"flex",alignItems:"center",gap:6,flex:1,minWidth:0,textAlign:"left"},nS={width:22,height:22,borderRadius:6};function _h({title:n,count:l,open:i,onToggle:r,hint:o,action:u}){const m=i?`Свернуть «${n}»`:`Развернуть «${n}»`;return s.jsxs("div",{className:"sidebar__section",children:[s.jsxs("button",{className:"sidebar__section--btn",style:tS,"aria-expanded":i,title:o?`${m} — ${o}`:m,onClick:r,children:[s.jsx(Jh,{open:i}),s.jsx("span",{className:"sidebar__section-name",children:n}),s.jsx("span",{className:"sidebar__count",children:l})]}),u&&s.jsx("button",{className:"theme-btn",style:nS,title:u.label,"aria-label":u.label,onClick:u.onClick,children:s.jsx(uS,{})})]})}function Dd(n){return{paddingLeft:`calc(37px + ${n} * var(--tree-indent, 24px))`}}const G0={display:"flex",alignItems:"center",gap:6,width:"100%"},Y0={flex:1,minWidth:0,color:"var(--text-2)",fontWeight:500},V0={...Y0,color:"var(--muted)",fontSize:12.5};function sS({folder:n,count:l,live:i,open:r,renaming:o,onToggle:u,onStartRename:m,onCommitRename:p,onCancelRename:g,onOpenAsProject:_,color:b,onPreviewColor:j,onCommitColor:v,onResetColor:k,depth:N,droppable:E,dropActive:C}){const I=x.useRef(null),[D,G]=x.useState(!1),[P,V]=x.useState(null),z=x.useRef(null);x.useEffect(()=>()=>{var U;return window.clearTimeout((U=z.current)==null?void 0:U.timer)},[]);function H(U){const L=U.touches[0];if(!L)return;const M={timer:0,x:L.clientX,y:L.clientY,el:U.currentTarget,fired:!1};M.timer=window.setTimeout(()=>{M.fired=!0,V({x:M.x,y:M.y,opener:M.el})},q0),z.current=M}function te(U){const L=z.current,M=U.touches[0];!L||!M||Math.hypot(M.clientX-L.x,M.clientY-L.y)>10&&(window.clearTimeout(L.timer),z.current=null)}function F(U){const L=z.current;L&&(window.clearTimeout(L.timer),L.fired&&U.preventDefault())}function fe(){const U=P==null?void 0:P.opener;V(null),U!=null&&U.isConnected&&U.focus()}function Q(){const U=I.current;if(U)try{U.showPicker()}catch{U.click()}}const X=[{id:"rename",label:"Переименовать",onSelect:m},{id:"color",label:"Выбрать цвет…",onSelect:Q},...n.color?[{id:"reset-color",label:"Сбросить цвет",onSelect:k}]:[],..._?[{id:"as-project",label:"Это проект",onSelect:()=>G(!0)}]:[]],ge=x.useRef(v);return ge.current=v,x.useEffect(()=>{const U=I.current;if(!U)return;const L=()=>ge.current(U.value);return U.addEventListener("change",L),()=>U.removeEventListener("change",L)},[o,D]),D&&_?s.jsxs("div",{className:"row row--confirm",style:Dd(N),role:"alertdialog","aria-label":`Открыть «${n.name}» как проект`,children:[s.jsx("p",{className:"row__confirm-text",children:`Открыть «${n.name}» как проект? Проекты внутри останутся открытыми, но без папки.`}),s.jsxs("div",{className:"row__confirm-bar",children:[s.jsx("button",{type:"button",className:"btn btn--sm",onClick:()=>G(!1),children:"Отмена"}),s.jsx("button",{type:"button",className:"btn btn--sm",autoFocus:!0,onClick:()=>{G(!1),_()},children:"Открыть как проект"})]})]}):o?s.jsx("div",{className:"row",style:Dd(N),children:s.jsx("div",{className:"row__main",children:s.jsx(oi,{value:n.name,placeholder:"Название папки",onCommit:p,onCancel:g})})}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:C?"row row--drop-target":"row",style:Dd(N),"data-drop-folder":E?n.id:void 0,onContextMenu:U=>{U.preventDefault(),V({x:U.clientX,y:U.clientY,opener:U.currentTarget})},onTouchStart:H,onTouchMove:te,onTouchEnd:F,onTouchCancel:F,children:[s.jsxs("button",{className:"row__main",style:G0,"aria-expanded":r,title:r?`Свернуть папку «${n.name}»`:`Развернуть папку «${n.name}»`,onClick:u,children:[s.jsx(Jh,{open:r}),s.jsx("span",{style:N>0?V0:Y0,children:n.name}),!r&&s.jsx(F0,{agg:i}),s.jsx("span",{className:"sidebar__count",children:l})]}),s.jsxs("span",{className:"row__more",children:[s.jsx("button",{type:"button",className:"row__edit",title:"Действия с папкой","aria-label":`Действия с папкой «${n.name}»`,"aria-haspopup":"menu","aria-expanded":P!==null,onClick:U=>{const L=U.currentTarget.getBoundingClientRect();V({x:L.left,y:L.bottom,opener:U.currentTarget})},children:s.jsx(iS,{})}),s.jsx("input",{ref:I,className:"row__color-input",type:"color",tabIndex:-1,"aria-hidden":"true",value:b??lS(),onChange:U=>j(U.target.value)})]})]}),P&&s.jsx(er,{x:P.x,y:P.y,items:X,onClose:fe})]})}function lS(){const n=getComputedStyle(document.documentElement).getPropertyValue("--folder-default").trim();return/^#[0-9a-f]{6}$/i.test(n)?n.toLowerCase():"#9a978d"}const Yb=8;function aS(){return s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round",children:s.jsx("path",{d:"M2 4.5A1.5 1.5 0 0 1 3.5 3h2.6l1.4 1.5h5A1.5 1.5 0 0 1 14 6v5.5a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 11.5z"})})}function Jh({open:n}){return s.jsx("svg",{className:n?"sidebar__chev sidebar__chev--open":"sidebar__chev",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:s.jsx("path",{d:"M6 3.5 10.5 8 6 12.5"})})}function iS(){return s.jsxs("svg",{viewBox:"0 0 16 16",width:"16",height:"16",fill:"currentColor","aria-hidden":"true",children:[s.jsx("circle",{cx:"3.5",cy:"8",r:"1.3"}),s.jsx("circle",{cx:"8",cy:"8",r:"1.3"}),s.jsx("circle",{cx:"12.5",cy:"8",r:"1.3"})]})}function Lh(){return s.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:[s.jsx("circle",{cx:"5.5",cy:"4",r:"1.15"}),s.jsx("circle",{cx:"5.5",cy:"8",r:"1.15"}),s.jsx("circle",{cx:"5.5",cy:"12",r:"1.15"}),s.jsx("circle",{cx:"10.5",cy:"4",r:"1.15"}),s.jsx("circle",{cx:"10.5",cy:"8",r:"1.15"}),s.jsx("circle",{cx:"10.5",cy:"12",r:"1.15"})]})}function rS(){return s.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:s.jsx("rect",{x:"3.6",y:"3.6",width:"8.8",height:"8.8",rx:"1.8"})})}function cS({className:n}){return s.jsxs("svg",{className:n,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("rect",{x:"4.5",y:"2.4",width:"7",height:"4.2",rx:"1.6"}),s.jsx("path",{d:"M5.4 6.6 8 12.2 10.6 6.6"}),s.jsx("path",{d:"M8 12.2v1.4"})]})}function oS(){return s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[s.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),s.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}function uS(){return s.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round","aria-hidden":"true",children:s.jsx("path",{d:"M8 3.2v9.6M3.2 8h9.6"})})}function dS(){try{const n=localStorage.getItem($0);if(n===null)return["workspacesArchive"];const l=JSON.parse(n);return Array.isArray(l)?l.filter(i=>i==="workspaces"||i==="workspacesArchive"||i==="pinned"||i==="live"):["workspacesArchive"]}catch{return["workspacesArchive"]}}function Vb(n){try{const l=localStorage.getItem(n);if(l===null)return[];const i=JSON.parse(l);return Array.isArray(i)?i.filter(r=>typeof r=="string"):[]}catch{return[]}}function Xb(n,l){try{localStorage.setItem(n,JSON.stringify(l))}catch{}}function fS(){try{const n=localStorage.getItem(H0);if(n===null)return[];const l=JSON.parse(n);return Array.isArray(l)?l.filter(i=>typeof i=="string"):[]}catch{return[]}}function hS(){try{const n=localStorage.getItem(B0);return n==="pinned"||n==="live"?n:"default"}catch{return"default"}}const Fb={system:"как в системе",light:"светлая",dark:"тёмная"};function mS({mode:n}){const l={viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};return n==="dark"?s.jsx("svg",{...l,children:s.jsx("path",{d:"M13.2 9.7A5.4 5.4 0 0 1 6.3 2.8a5.6 5.6 0 1 0 6.9 6.9Z"})}):n==="light"?s.jsxs("svg",{...l,children:[s.jsx("circle",{cx:"8",cy:"8",r:"3.1"}),s.jsx("path",{d:"M8 1.4v1.4M8 13.2v1.4M2.4 8H1M15 8h-1.4M4 4l-1-1M13 13l-1-1M12 4l1-1M3 13l1-1"})]}):s.jsxs("svg",{...l,children:[s.jsx("rect",{x:"1.8",y:"2.6",width:"12.4",height:"8.4",rx:"1.4"}),s.jsx("path",{d:"M5.6 13.4h4.8"})]})}function Kb(n){const l=pS(n),i=(n.tasks??[]).filter(r=>r.kind==="agent").length;return i>0?`${l} · ${U0(i)}`:l}function pS(n){switch(n.state){case"running":return"работает";case"waiting_permission":return"ждёт разрешения";case"idle":return n.backgroundWork?"работает в фоне":gS(n.lastTurn);case"starting":return"запускается";case"reconnecting":return"переподключается";case"error":return"ошибка";case"closed":return"на диске"}}function gS(n){switch(n){case"interrupted":return"прервана";case"stopped":return"остановлена";case"failed":return"оборвалась";case"completed":return"готова";case null:return"ждёт задачу"}}function X0(n){switch(n.state){case"running":return"running";case"starting":return"starting";case"reconnecting":return"reconnecting";case"waiting_permission":return"waiting";case"idle":return n.backgroundWork?"background":xS(n.lastTurn);case"error":return"error";case"closed":return"closed"}}function xS(n){switch(n){case"interrupted":case"stopped":return"halted";case"failed":return"error";case"completed":return"ready";case null:return"fresh"}}function Yh({session:n,pinned:l,projectName:i,projectPath:r,archived:o}){const u=o?"closed":X0(n);return s.jsxs(s.Fragment,{children:[s.jsx("span",{className:`row__lead row__state--${u}`,"aria-hidden":"true",children:s.jsx("span",{className:"row__state-dot"})}),s.jsxs("span",{className:"row__body"+(i!==void 0?" row__body--with-project":"")+(o?" row__body--archived":""),title:o?bS(n):`${Kb(n)} · ${new Date(n.updatedAt).toLocaleString()}`,children:[s.jsx(_S,{title:n.title??"Без названия",pinned:l,provider:n.provider,accountId:n.accountId,projectName:i,projectPath:r}),o?s.jsxs("span",{className:"row__meta row__vh row__vh--wide",children:[s.jsx("span",{className:"row__state",children:n.archivedAuto?"по сроку":"вручную"}),n.archivedAt?s.jsx("span",{className:"row__time",children:` · ${Bp(n.archivedAt)}`}):null]}):s.jsxs("span",{className:`row__meta${u==="closed"?` row__vh${i===void 0?" row__vh--time":""}`:""}`,children:[s.jsx("span",{className:`row__state row__state--${u}${u==="closed"?" row__vh":""}`,children:Kb(n)}),i===void 0&&s.jsx("span",{className:"row__time",children:u==="closed"?Bp(n.updatedAt):` · ${Bp(n.updatedAt)}`})]})]})]})}const Qb=["waiting","error","running","reconnecting","background","starting","halted","ready","fresh","closed"];function $p(n,l,i){const r=n.get(l);if(!r){n.set(l,{count:1,tone:i,waiting:i==="waiting"?1:0});return}r.count+=1,i==="waiting"&&(r.waiting+=1),Qb.indexOf(i)<Qb.indexOf(r.tone)&&(r.tone=i)}function F0({agg:n}){if(!n)return null;const l=`Запущено сессий: ${n.count}`,i=n.waiting>0?`${l}, ждут решения: ${n.waiting}`:l;return s.jsxs("span",{className:`row__live row__state--${n.tone}`,role:"img","aria-label":i,title:i,children:[s.jsx("span",{className:"row__state-dot","aria-hidden":"true"}),s.jsx("span",{"aria-hidden":"true",children:n.count})]})}function _S({title:n,pinned:l,provider:i,accountId:r,projectName:o,projectPath:u}){const m=Hj(r,i);return s.jsxs("span",{className:"row__head",children:[s.jsxs("span",{className:"row__title",children:[l&&s.jsx(cS,{className:"row__pin"}),m&&s.jsx(Da,{account:m,className:"row__acct"}),i==="antigravity"&&s.jsx(Ug,{className:"row__provider"}),i==="codex"&&s.jsx($g,{className:"row__provider row__provider--codex"}),n]}),o!==void 0&&s.jsx("span",{className:"row__project",title:u,children:o})]})}function Bp(n){const l=new Date(n);return l.toDateString()===new Date().toDateString()?l.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):l.toLocaleDateString(void 0,{day:"numeric",month:"short"})}function bS(n){const l=n.archivedAuto?"сама, по сроку молчания":"убрана вручную";return n.archivedAt?`${new Date(n.archivedAt).toLocaleString()} · ${l}`:l}function yS(n){return n.archivedAt?`закрыт ${new Date(n.archivedAt).toLocaleString()}`:"закрыт"}function vS({disabled:n,onDownload:l,onSave:i,saveDisabled:r}){const[o,u]=x.useState(!1),m=x.useRef(null);x.useEffect(()=>{if(!o)return;function g(b){var j;(j=m.current)!=null&&j.contains(b.target)||u(!1)}function _(b){b.key==="Escape"&&(b.stopPropagation(),u(!1))}return document.addEventListener("mousedown",g),document.addEventListener("keydown",_,!0),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",_,!0)}},[o]);function p(g){u(!1),g()}return s.jsxs("div",{className:"select exportmenu",ref:m,children:[s.jsx("button",{type:"button",className:o?"meters-refresh exportmenu__btn is-open":"meters-refresh exportmenu__btn",title:"Экспорт разговора","aria-label":"Экспорт разговора","aria-haspopup":"menu","aria-expanded":o,disabled:n,onClick:()=>u(g=>!g),children:s.jsx(jS,{})}),o&&s.jsxs("div",{className:"select__menu exportmenu__menu",role:"menu",children:[s.jsxs("button",{type:"button",role:"menuitem",className:"exportmenu__item",onClick:()=>p(l),children:[s.jsx("span",{className:"exportmenu__label",children:"Скачать Markdown"}),s.jsx("span",{className:"exportmenu__hint",children:"Файл .md в загрузки"})]}),s.jsxs("button",{type:"button",role:"menuitem",className:"exportmenu__item",disabled:r,onClick:()=>p(i),children:[s.jsx("span",{className:"exportmenu__label",children:"Сохранить в проект"}),s.jsx("span",{className:"exportmenu__hint",children:"Файл .md в корне проекта"})]})]})]})}function jS(){return s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("path",{d:"M8 2v7.5M5 6.7 8 9.7l3-3"}),s.jsx("path",{d:"M3 11v1.4A1.1 1.1 0 0 0 4.1 13.5h7.8A1.1 1.1 0 0 0 13 12.4V11"})]})}const NS="Без названия",kS=["file_path","notebook_path","path","command","pattern","url","query","description","prompt"];function wS(n){if(!n||typeof n!="object")return"";const l=n;for(const i of kS){const r=l[i];if(typeof r=="string"&&r.trim()!=="")return r.replace(/\s+/g," ").trim().slice(0,160)}return""}function SS(n){const l=wS(n.input);return`> 🔧 ${n.name}${l?` ${l}`:""}`}function ES(n){const l=i=>String(i).padStart(2,"0");return`${n.getFullYear()}-${l(n.getMonth()+1)}-${l(n.getDate())} ${l(n.getHours())}:${l(n.getMinutes())}`}function CS(n,l){var m;const i=l.agent??"Claude",r=[];r.push(`# ${((m=l.title)==null?void 0:m.trim())||NS}`,""),l.project&&r.push(`**Проект:** ${l.project} `),r.push(`**Экспортировано:** ${ES(l.now??new Date)}`,""),l.partial&&r.push("_Показана только загруженная часть разговора: более ранние реплики не подгружены._",""),r.push("---","");let o=[];const u=()=>{o.length!==0&&(r.push(o.join(`
125
+ `),""),o=[])};for(const p of n)switch(p.kind){case"user":{u(),r.push("## Вы","");const g=p.text.trim();g&&r.push(g,"");const _=[...(p.files??[]).map(b=>b.name),...p.images&&p.images.length>0?[`изображений: ${p.images.length}`]:[]];_.length>0&&r.push(`_Вложения: ${_.join(", ")}_`,"");break}case"assistant":{u();const g=p.text.trim();if(!g)break;r.push(`## ${i}`,"",g,"");break}case"tool":o.push(SS(p));break}return u(),r.join(`
126
+ `).replace(/\n{3,}/g,`
127
+
128
+ `).trimEnd()+`
129
+ `}const TS=/[\\/:*?"<>|\u0000-\u001f]/g;function Zb(n){return(n??"").replace(TS," ").replace(/\s+/g," ").trim().replace(/^\.+/,"").replace(/[. ]+$/,"").slice(0,80).trim()||"Разговор"}function Pb(n,l){return l<=1?`${n}.md`:`${n} (${l}).md`}function AS(n,l){const i=new Blob([l],{type:"text/markdown;charset=utf-8"}),r=URL.createObjectURL(i),o=document.createElement("a");o.href=r,o.download=n,document.body.appendChild(o),o.click(),o.remove(),setTimeout(()=>URL.revokeObjectURL(r),1e3)}function Vh(n){if(!n)return!1;const l=document.getSelection();if(!l||l.isCollapsed||l.rangeCount===0)return!1;const i=l.getRangeAt(0);return n.contains(i.commonAncestorContainer)||i.intersectsNode(n)}function MS(n,l){const i=x.useRef(!1),r=x.useRef(!1),o=x.useRef(l);return o.current=l,x.useEffect(()=>{const u=n.current;if(!u)return;function m(){const _=i.current||Vh(n.current);r.current&&!_?(r.current=!1,o.current()):r.current=_}function p(_){_.button===0&&(i.current=!0,r.current=!0)}function g(){i.current&&(i.current=!1,m())}return u.addEventListener("pointerdown",p),window.addEventListener("pointerup",g),window.addEventListener("pointercancel",g),document.addEventListener("selectionchange",m),()=>{u.removeEventListener("pointerdown",p),window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",g),document.removeEventListener("selectionchange",m)}},[n]),()=>i.current||Vh(n.current)}const K0=1500;function Q0(n){const l=[];let i=!1;for(const r of n.patch.split(`
130
+ `)){if(l.length>=K0){i=!0;break}if(r.startsWith("@@"))l.push({type:"gap",text:RS(r)});else if(r.startsWith("+"))l.push({type:"add",text:r.slice(1)});else if(r.startsWith("-"))l.push({type:"del",text:r.slice(1)});else{if(r.startsWith("\\"))continue;(r!==""||l.length>0)&&l.push({type:"ctx",text:r.startsWith(" ")?r.slice(1):r})}}return{kind:"patch",filePath:n.path||n.oldPath,rows:l,added:n.added,removed:n.removed,note:DS(n,i)}}function RS(n){const l=/^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@ ?(.*)$/.exec(n);if(!l)return n;const i=Number(l[1]),r=l[2]===void 0?1:Number(l[2]),o=(l[3]??"").trim(),u=r>1?`строки ${i}–${i+r-1}`:`строка ${i}`;return o?`⋯ ${u} · ${o}`:`⋯ ${u}`}function DS(n,l){const i=[];return n.status==="added"&&i.push("новый файл"),n.status==="deleted"&&i.push("файл удалён"),n.status==="renamed"&&i.push(`переименован из ${n.oldPath}`),n.binary?i.push("двоичный файл"):n.patch===""&&i.push("содержимое не показано"),l&&i.push(`показаны первые ${K0} строк`),i.length>0?i.join(" · "):null}const LS={add:"новый файл",delete:"файл удалён",update:"правка файла"};function OS(n){if(!n||typeof n!="object")return null;const l=n.changes;if(!Array.isArray(l)||l.length===0)return null;const i=[];for(const r of l){if(!r||typeof r!="object")continue;const{path:o,kind:u,diff:m}=r;if(typeof o!="string"||o==="")continue;const p=typeof u=="string"?u:"update",_=(typeof m=="string"?m:"").split(`
131
+ `).filter(C=>!/^(diff --git |index |--- |\+\+\+ |new file mode|deleted file mode)/.test(C)),j=_.some(C=>/^(@@|\+|-)/.test(C))?_.join(`
132
+ `):p==="add"?_.map(C=>`+${C}`).join(`
133
+ `):p==="delete"?_.map(C=>`-${C}`).join(`
134
+ `):_.join(`
135
+ `);let v=0,k=0;for(const C of j.split(`
136
+ `))C.startsWith("+")?v++:C.startsWith("-")&&k++;const N=Q0({path:o,oldPath:"",status:p==="add"?"added":p==="delete"?"deleted":"modified",added:v,removed:k,binary:!1,patch:j}),E=LS[p];!N.note&&E&&p!=="update"&&(N.note=E),i.push(N)}return i.length>0?i:null}const Wb=3,zS=15e5;function IS(n,l){if(!l||typeof l!="object")return null;const i=l,r=typeof i.file_path=="string"?i.file_path:"";if(!r)return null;if(n==="Write"){if(typeof i.content!="string")return null;const o=Hp(i.content).map(u=>({type:"add",text:u}));return{kind:"create",filePath:r,rows:o,added:o.length,removed:0,note:"файл записывается целиком"}}if(n==="Edit"){if(typeof i.old_string!="string"||typeof i.new_string!="string")return null;const o=HS(US(Hp(i.old_string),Hp(i.new_string)));return{kind:"edit",filePath:r,rows:o,added:o.filter(u=>u.type==="add").length,removed:o.filter(u=>u.type==="del").length,note:i.replace_all===!0?"все вхождения":null}}return null}function Hp(n){if(n==="")return[];const l=n.split(/\r?\n/);return l.length>1&&l[l.length-1]===""&&l.pop(),l}function US(n,l){let i=0;for(;i<n.length&&i<l.length&&n[i]===l[i];)i++;let r=n.length,o=l.length;for(;r>i&&o>i&&n[r-1]===l[o-1];)r--,o--;const u=m=>({type:"ctx",text:m});return[...n.slice(0,i).map(u),...$S(n.slice(i,r),l.slice(i,o)),...n.slice(r).map(u)]}function $S(n,l){if(n.length===0&&l.length===0)return[];if(n.length===0)return l.map(b=>({type:"add",text:b}));if(l.length===0)return n.map(b=>({type:"del",text:b}));if((n.length+1)*(l.length+1)>zS)return[...n.map(b=>({type:"del",text:b})),...l.map(b=>({type:"add",text:b}))];const i=n.length,r=l.length,o=r+1,u=new Uint32Array((i+1)*o),m=(b,j)=>u[b*o+j]??0;for(let b=i-1;b>=0;b--)for(let j=r-1;j>=0;j--)u[b*o+j]=n[b]===l[j]?m(b+1,j+1)+1:Math.max(m(b+1,j),m(b,j+1));const p=[];let g=0,_=0;for(;g<i&&_<r;){const b=n[g],j=l[_];b===j?(p.push({type:"ctx",text:b}),g++,_++):m(g+1,_)>=m(g,_+1)?(p.push({type:"del",text:b}),g++):(p.push({type:"add",text:j}),_++)}for(;g<i;)p.push({type:"del",text:n[g++]});for(;_<r;)p.push({type:"add",text:l[_++]});return BS(p)}function BS(n){const l=[];let i=[];function r(){l.push(...i.filter(o=>o.type==="del")),l.push(...i.filter(o=>o.type==="add")),i=[]}for(const o of n)o.type==="ctx"?(r(),l.push(o)):i.push(o);return r(),l}function HS(n){if(!n.some(u=>u.type!=="ctx"))return n;const l=n.map(()=>!1);n.forEach((u,m)=>{if(u.type!=="ctx")for(let p=Math.max(0,m-Wb);p<=Math.min(n.length-1,m+Wb);p++)l[p]=!0});const i=[];let r=[];function o(){r.length===1?i.push(...r):r.length>1&&i.push({type:"gap",text:`⋯ ${r.length} ${qS(r.length)} без изменений`}),r=[]}return n.forEach((u,m)=>{l[m]?(o(),i.push(u)):r.push(u)}),o(),i}function qS(n){const l=n%100;if(l>=11&&l<=14)return"строк";switch(n%10){case 1:return"строка";case 2:case 3:case 4:return"строки";default:return"строк"}}function Z0(n,l){if(n==="apply_patch")return OS(l);const i=IS(n,l);return i?[i]:null}function dg(n){if(n<1024)return`${n} Б`;const l=n/1024;if(l<1024)return`${l<10?l.toFixed(1):Math.round(l)} КБ`.replace(".",",");const i=l/1024;return`${i<10?i.toFixed(1):Math.round(i)} МБ`.replace(".",",")}const GS={pdf:"PDF",text:"Текст",file:"Файл"};function P0({file:n,onRemove:l}){return s.jsxs("div",{className:`filechip filechip--${n.kind}`,title:`${n.name}, ${dg(n.size)}`,children:[s.jsx("span",{className:"filechip__icon",children:s.jsx(YS,{kind:n.kind})}),s.jsxs("span",{className:"filechip__body",children:[s.jsx("span",{className:"filechip__name",children:n.name}),s.jsxs("span",{className:"filechip__meta",children:[GS[n.kind],", ",dg(n.size)]})]}),l&&s.jsx("button",{type:"button",className:"filechip__remove","aria-label":`Убрать вложение ${n.name}`,onClick:l,children:s.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round","aria-hidden":"true",children:s.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]})}function YS({kind:n}){return s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("path",{d:"M4 1.8h5.2L12.5 5v8.4a.8.8 0 0 1-.8.8H4a.8.8 0 0 1-.8-.8V2.6a.8.8 0 0 1 .8-.8Z"}),s.jsx("path",{d:"M9.2 1.8V5h3.3"}),n==="pdf"&&s.jsx("rect",{x:"5.1",y:"8.4",width:"5.8",height:"3.4",rx:".7"}),n==="text"&&s.jsx("path",{d:"M5.4 8.2h5.2M5.4 10.2h5.2M5.4 12.2h3"})]})}const W0="ccv.speech",Bg="",J0=.75,ev=2,VS=200,Jb={voice:Bg,rate:1},qp={min:J0,max:ev,step:.05};function bu(){return typeof window<"u"&&"speechSynthesis"in window}function tv(){try{const n=window.localStorage.getItem(W0);if(!n)return Jb;const l=JSON.parse(n),i=typeof l.rate=="number"?l.rate:1;return{voice:typeof l.voice=="string"?l.voice:Bg,rate:Math.min(ev,Math.max(J0,i))}}catch{return Jb}}function XS(n){try{window.localStorage.setItem(W0,JSON.stringify(n))}catch{}}function FS(n){const l=n.replace(/\r\n?/g,`
137
+ `).split(`
138
+ `),i=[];let r=null;for(const u of l){const m=/^\s*(`{3,}|~{3,})/.exec(u);if(m){const p=m[1];r===null?(r=p[0],i.push("блок кода.")):p[0]===r&&(r=null);continue}r===null&&(/^\s*\|.*\|\s*$/.test(u)||/^\s*\|?\s*:?-{2,}:?\s*(\|\s*:?-{2,}:?\s*)+\|?\s*$/.test(u)||/^\s*([-*_])(\s*\1){2,}\s*$/.test(u)||i.push(u))}let o=i.join(`
139
+ `);return o=o.replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/<https?:\/\/[^>]+>/g,"").replace(/https?:\/\/\S+/g,"ссылка").replace(/<\/?[a-zA-Z][^>]*>/g,"").replace(/`([^`]+)`/g,"$1").replace(/^\s{0,3}#{1,6}\s+/gm,"").replace(/^\s*>\s?/gm,"").replace(/^\s*[-*+]\s+(\[[ xX]\]\s+)?/gm,"").replace(/^\s*\d+[.)]\s+/gm,"").replace(/\*\*(.+?)\*\*/g,"$1").replace(new RegExp("(?<![\\w*])\\*(?!\\s)(.+?)\\*(?![\\w*])","g"),"$1").replace(/~~(.+?)~~/g,"$1").replace(/[*_#`~|\\]+/g," "),o=o.split(`
140
+ `).map(u=>u.trim()).filter(u=>u!=="").map(u=>/[.!?…:;]$/.test(u)?u:`${u}.`).join(" "),o.replace(/\s+/g," ").trim()}function KS(n,l=VS){const i=n.match(/[^.!?…]+[.!?…]*\s*/g)??[n],r=[];let o="";const u=()=>{o.trim()!==""&&r.push(o.trim()),o=""};for(const m of i){if(m.length>l){u();for(const p of QS(m,l))r.push(p);continue}(o+m).length>l&&u(),o+=m}return u(),r}function QS(n,l){const i=[];let r=n.trim();for(;r.length>l;){let o=r.lastIndexOf(", ",l);o<l/3&&(o=r.lastIndexOf(" ",l)),o<=0&&(o=l),i.push(r.slice(0,o+1).trim()),r=r.slice(o+1).trim()}return r&&i.push(r),i}function nv(){return bu()?window.speechSynthesis.getVoices():[]}function ZS(){const[n,l]=x.useState(nv);return x.useEffect(()=>{if(!bu())return;const i=window.speechSynthesis,r=()=>l(i.getVoices());return r(),i.addEventListener("voiceschanged",r),()=>i.removeEventListener("voiceschanged",r)},[]),n}function PS(n,l){const i=nv();if(l.voice!==Bg){const p=i.find(g=>g.voiceURI===l.voice);if(p)return p}const r=(n.match(/[Ѐ-ӿ]/g)??[]).length,o=(n.match(/[A-Za-z]/g)??[]).length,u=r>=o?"ru":"en",m=i.filter(p=>p.lang.toLowerCase().startsWith(u));return m.find(p=>p.localService)??m[0]??null}const fg=new Set;let hg=null,Ed=0;function Oh(n){hg=n;for(const l of fg)l()}function WS(n){return fg.add(n),()=>fg.delete(n)}function Hg(){Ed+=1,bu()&&window.speechSynthesis.cancel(),Oh(null)}function sv(n,l,i=tv()){if(!bu())return;const r=FS(l);r!==""&&(Hg(),eE(n,r,i))}function JS(n){sv("sample","Так звучит выбранный голос. This is how the selected voice sounds.",n)}function eE(n,l,i){const r=window.speechSynthesis,o=KS(l),u=PS(l,i),m=Ed;Oh(n),o.forEach((p,g)=>{const _=new SpeechSynthesisUtterance(p);u?(_.voice=u,_.lang=u.lang):_.lang=/[Ѐ-ӿ]/.test(p)?"ru-RU":"en-US",_.rate=i.rate;const b=g===o.length-1;_.onend=()=>{b&&m===Ed&&Oh(null)},_.onerror=()=>{m===Ed&&(Ed+=1,r.cancel(),Oh(null))},r.speak(_)})}function lv(n){const[l,i]=x.useState(()=>hg===n);return x.useEffect(()=>{const r=()=>i(hg===n);return r(),WS(r)},[n]),l}function tE({id:n,text:l}){const i=lv(n);if(!bu())return null;const r=i?"Остановить":"Озвучить";return s.jsx("button",{type:"button",className:"copybtn speakbtn"+(i?" speakbtn--on":""),"aria-pressed":i,"aria-label":i?"Остановить чтение ответа":"Озвучить ответ",title:i?"Остановить чтение ответа":"Прочитать ответ вслух",onClick:()=>i?Hg():sv(n,l),children:r})}function qg({diff:n}){return s.jsxs("div",{className:"diff",children:[s.jsxs("div",{className:"diff__head",children:[s.jsx("span",{className:"diff__path",title:n.filePath,children:n.filePath}),s.jsxs("span",{className:"diff__stat",children:[n.added>0&&s.jsxs("span",{className:"diff__stat--add",children:["+",n.added]}),n.removed>0&&s.jsxs("span",{className:"diff__stat--del",children:["−",n.removed]})]})]}),n.note&&s.jsx("div",{className:"diff__note",children:n.note}),s.jsx("div",{className:"diff__body",children:n.rows.length===0?s.jsx("div",{className:"diff__row diff__row--gap",children:s.jsx("span",{className:"diff__text",children:"пустое содержимое"})}):n.rows.map((l,i)=>s.jsxs("div",{className:`diff__row diff__row--${l.type}`,children:[s.jsx("span",{className:"diff__mark","aria-hidden":"true",children:l.type==="add"?"+":l.type==="del"?"−":""}),s.jsx("span",{className:"diff__text",children:l.text===""?" ":l.text})]},i))})]})}function nE({waiting:n}){const[l,i]=x.useState(0);return x.useEffect(()=>{const r=window.setInterval(()=>i(o=>o+1),1e3);return()=>window.clearInterval(r)},[]),s.jsxs("div",{className:n?"work work--wait":"work",children:[s.jsxs("span",{className:"work__dots","aria-hidden":"true",children:[s.jsx("span",{className:"work__dot"}),s.jsx("span",{className:"work__dot"}),s.jsx("span",{className:"work__dot"})]}),s.jsx("span",{className:"work__label",children:n?"ждёт разрешения":"думает"}),!n&&s.jsxs("span",{className:"work__time",children:[l," с"]})]})}function zn({title:n,children:l,actions:i,className:r,sheet:o=!1,onClose:u}){const m=x.useRef(null);return x.useEffect(()=>{function p(g){if(g.key==="Escape"){g.preventDefault(),g.stopPropagation(),u();return}if(g.key!=="Tab")return;const _=m.current;if(!_)return;const b=_.querySelectorAll('button, input, textarea, select, a[href], [tabindex]:not([tabindex="-1"])'),j=b[0],v=b[b.length-1];!j||!v||(g.shiftKey&&document.activeElement===j?(g.preventDefault(),v.focus()):!g.shiftKey&&document.activeElement===v&&(g.preventDefault(),j.focus()))}return document.addEventListener("keydown",p,!0),()=>document.removeEventListener("keydown",p,!0)},[u]),s.jsx("div",{className:o?"modal-backdrop modal-backdrop--sheet":"modal-backdrop",onMouseDown:p=>{p.target===p.currentTarget&&u()},children:s.jsxs("div",{ref:m,className:r?`modal ${r}`:"modal",role:"dialog","aria-modal":"true","aria-label":n,children:[s.jsxs("div",{className:"modal__head",children:[s.jsx("h2",{className:"modal__title",children:n}),s.jsx("button",{className:"modal__close","aria-label":"Закрыть",onClick:u,children:"✕"})]}),s.jsx("div",{className:"modal__body",children:l}),i&&s.jsx("div",{className:"modal__actions",children:i})]})})}const sE="После этой реплики агент не менял файлов.";function lE(n){const l=n%10,i=n%100;return l===1&&i!==11?"файл":l>=2&&l<=4&&(i<12||i>14)?"файла":"файлов"}function aE({userIndex:n,onRewindFiles:l,onClose:i}){const[r,o]=x.useState({kind:"loading"}),u=x.useRef(!0),m=x.useRef(!1);x.useEffect(()=>(u.current=!0,l(n,!0).then(v=>{if(!u.current)return;const k=v.filesChanged??[];!v.canRewind||k.length===0?o({kind:"empty",message:v.error||sE}):o({kind:"preview",reply:v})},v=>{u.current&&o({kind:"empty",message:v instanceof Error?v.message:String(v)})}),()=>{u.current=!1}),[]);function p(){m.current||(m.current=!0,o({kind:"running"}),l(n,!1).then(v=>{var C;if(m.current=!1,!u.current)return;if(!v.canRewind||v.error){o({kind:"done",error:!0,message:v.error||"Не удалось откатить файлы."});return}const k=((C=v.filesChanged)==null?void 0:C.length)??0,N=v.skippedLinks??0,E=N>0?` Пропущено ссылок: ${N}.`:"";o({kind:"done",error:!1,message:`Восстановлено файлов: ${k}.${E}`})},v=>{m.current=!1,u.current&&o({kind:"done",error:!0,message:v instanceof Error?v.message:String(v)})}))}const g=r.kind==="running",_=()=>{g||i()};let b,j;if(r.kind==="loading"||r.kind==="running")b=s.jsxs("p",{className:"modal__text rewind__status",role:"status",children:[s.jsx("span",{className:"rewind__spinner","aria-hidden":"true"}),r.kind==="loading"?"Считаем изменения…":"Откатываем файлы…"]}),j=s.jsx("button",{type:"button",className:"btn",onClick:_,disabled:g,children:"Отмена"});else if(r.kind==="empty"||r.kind==="done"){const v=r.kind==="done"&&r.error;b=s.jsx("p",{className:v?"modal__error":"modal__text",role:v?"alert":"status",children:r.message}),j=s.jsx("button",{type:"button",className:"btn btn--primary",onClick:_,children:"Закрыть"})}else{const{reply:v}=r,k=v.filesChanged??[];b=s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"modal__text",children:"Файлы, которые агент менял после этой реплики, вернутся к состоянию на её момент. Разговор не изменится."}),s.jsx("ul",{className:"rewind__files","aria-label":"Файлы к откату",children:k.map(N=>s.jsx("li",{className:"rewind__file",title:N,children:s.jsx("span",{className:"rewind__path",children:N})},N))}),s.jsxs("p",{className:"rewind__summary",children:[k.length," ",lE(k.length),v.insertions!==void 0||v.deletions!==void 0?s.jsxs(s.Fragment,{children:[" · ",s.jsxs("span",{className:"rewind__add",children:["+",v.insertions??0]})," ",s.jsxs("span",{className:"rewind__del",children:["−",v.deletions??0]})]}):null]})]}),j=s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"btn",onClick:_,children:"Отмена"}),s.jsx("button",{type:"button",className:"btn btn--warn",onClick:p,children:"Откатить"})]})}return s.jsx(zn,{title:"Откатить файлы?",onClose:_,actions:j,className:"modal--rewind",children:b})}function Gg({items:n,busy:l,waiting:i,history:r=[],historyHasMore:o=!1,historyLoading:u=!1,onLoadHistory:m,sessionId:p,onEditMessage:g,onRewindFiles:_,onOpenPreview:b,empty:j="Сессия пуста. Опишите задачу — Claude Code работает в каталоге проекта с полным набором инструментов."}){const v=x.useRef(null),k=x.useRef(null),N=x.useRef(!0),E=x.useRef(null),C=x.useRef(null),I=x.useRef(!1),D=x.useRef(null),G=MS(v,()=>{var F;return(F=D.current)==null?void 0:F.call(D)}),P=x.useRef(G);P.current=G,x.useEffect(()=>{N.current=!0,E.current=null,I.current=!1,C.current!==null&&(clearTimeout(C.current),C.current=null)},[p]),x.useEffect(()=>{const F=v.current,fe=k.current;if(!F||!fe)return;function Q(U){!F||U===F.scrollTop||(I.current=!0,F.scrollTop=U)}function X(){if(!F)return;const U=E.current;if(U){const L=ty(F,U.id);if(L){const M=L.getBoundingClientRect().top-F.getBoundingClientRect().top;Q(F.scrollTop+(M-U.top))}C.current!==null&&clearTimeout(C.current),C.current=setTimeout(()=>{E.current=null},500);return}N.current&&!P.current()&&Q(F.scrollHeight)}D.current=X;const ge=new ResizeObserver(X);return ge.observe(fe),()=>{D.current=null,ge.disconnect(),C.current!==null&&clearTimeout(C.current)}},[]);function V(){const F=v.current;if(F){if(I.current){I.current=!1;return}N.current=F.scrollHeight-F.scrollTop-F.clientHeight<80}}function z(){if(u)return;const F=v.current,fe=r[0];if(F&&fe){const Q=ty(F,fe.id);Q&&(E.current={id:fe.id,top:Q.getBoundingClientRect().top-F.getBoundingClientRect().top})}m==null||m()}let H=0;function te(F){return F.kind==="user"?H++:-1}return s.jsx("div",{className:"transcript",ref:v,onScroll:V,children:s.jsxs("div",{className:"stream",ref:k,children:[o&&s.jsx("button",{type:"button",className:"transcript__more",onClick:z,disabled:u,children:u?"Загружаем…":"Показать более раннее"}),r.map(F=>s.jsx(ey,{item:F,userIndex:te(F),onEditMessage:g,onRewindFiles:_,onOpenPreview:b},F.id)),r.length>0&&n.length>0&&s.jsx("div",{className:"transcript__divider",children:s.jsx("span",{children:"дальше — сессия открыта заново"})}),r.length===0&&n.length===0&&s.jsx("p",{className:"empty",children:j}),n.map(F=>s.jsx(ey,{item:F,userIndex:te(F),onEditMessage:g,onRewindFiles:_,onOpenPreview:b},F.id)),l&&s.jsx(nE,{waiting:i})]})})}function ey({item:n,userIndex:l,onEditMessage:i,onRewindFiles:r,onOpenPreview:o}){switch(n.kind){case"user":return s.jsx(rE,{item:n,userIndex:l,onEditMessage:i,onRewindFiles:r});case"assistant":return s.jsxs("div",{className:"msg--assistant","data-item-id":n.id,children:[s.jsx(cE,{text:n.text,streaming:n.streaming===!0}),n.streaming&&s.jsx("span",{className:"caret"}),n.text.trim()!==""&&s.jsxs("div",{className:"msg--assistant__foot",children:[!n.streaming&&s.jsx(tE,{id:n.id,text:n.text}),s.jsx(tr,{text:n.text,hint:"ответ целиком"})]})]});case"thinking":return s.jsx("div",{className:"thinking","data-item-id":n.id,children:n.text});case"tool":return s.jsx(uE,{item:n,onOpenPreview:o});case"result":return s.jsxs("div",{className:"result-line","data-item-id":n.id,children:[s.jsx("span",{children:n.isError?"✗ "+n.subtype:"✓ готово"}),s.jsxs("span",{children:[(n.durationMs/1e3).toFixed(1)," с"]}),n.costUsd!==null&&s.jsxs("span",{children:["$",n.costUsd.toFixed(4)]}),s.jsxs("span",{children:["↑",sy(n.inputTokens)," ↓",sy(n.outputTokens)]})]});case"notice":return s.jsx("div",{className:n.tone==="error"?"notice notice--error":"notice","data-item-id":n.id,children:n.text})}}const iE=500;function rE({item:n,userIndex:l,onEditMessage:i,onRewindFiles:r}){const[o,u]=x.useState(null),[m,p]=x.useState(!1),[g,_]=x.useState(n.text),[b,j]=x.useState(!1),[v,k]=x.useState(!1),N=x.useRef(null),E=x.useRef(!1),C=$d("(max-width: 860px)"),I=x.useRef(null);function D(U,L){u({x:U,y:L})}function G(U){U.preventDefault(),D(U.clientX,U.clientY)}function P(U){const L=U.touches[0];if(!L)return;const M={timer:0,x:L.clientX,y:L.clientY,fired:!1};M.timer=window.setTimeout(()=>{M.fired=!0,D(M.x,M.y)},iE),I.current=M}function V(U){const L=I.current,M=U.touches[0];!L||!M||Math.hypot(M.clientX-L.x,M.clientY-L.y)>10&&(window.clearTimeout(L.timer),I.current=null)}function z(U){const L=I.current;L&&(window.clearTimeout(L.timer),L.fired&&U.preventDefault())}function H(){_(n.text),k(!1),p(!0)}function te(){p(!1)}function F(){const U=g.trim();if(U===""&&!(n.images&&n.images.length>0))return;const L=i==null?void 0:i(l,U,n.images,r&&v?{rewindFiles:!0}:void 0);if(L instanceof Promise){if(E.current)return;E.current=!0,L.then(M=>{E.current=!1,M&&p(!1)},()=>{E.current=!1});return}L!==!1&&p(!1)}x.useEffect(()=>{const U=N.current;!U||!m||(U.style.height="auto",U.style.height=`${U.scrollHeight}px`)},[g,m]),x.useEffect(()=>{if(!m)return;const U=N.current;U&&(U.focus(),U.setSelectionRange(U.value.length,U.value.length))},[m]);function fe(U){if(U.key==="Escape"){U.preventDefault(),U.stopPropagation(),te();return}U.key==="Enter"&&!U.shiftKey&&!C&&(U.preventDefault(),F())}const Q=n.images&&n.images.length>0&&s.jsx("div",{className:"msg--user__images",children:n.images.map((U,L)=>s.jsx("img",{className:"msg--user__image",src:`data:${U.mediaType};base64,${U.data}`,alt:"Вложение"},L))}),X=n.files&&n.files.length>0&&s.jsx("div",{className:"msg--user__files",children:n.files.map((U,L)=>s.jsx(P0,{file:U},L))});if(m){const U=g.trim()!==""||!!(n.images&&n.images.length>0);return s.jsxs("div",{className:"msg--user msg--user--editing","data-item-id":n.id,children:[Q,X,s.jsxs("div",{className:"msg--user__edit",children:[s.jsx("textarea",{ref:N,className:"msg--user__edit-field",value:g,onChange:L=>_(L.target.value),onKeyDown:fe,rows:1}),s.jsxs("div",{className:"msg--user__edit-actions",children:[r&&s.jsxs("label",{className:"checkrow",children:[s.jsx("input",{type:"checkbox",className:"checkrow__input",checked:v,onChange:L=>k(L.target.checked)}),s.jsx("span",{className:"checkrow__box","aria-hidden":"true"}),s.jsx("span",{className:"checkrow__label",children:"Откатить и файлы"})]}),s.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:te,children:"Отмена"}),s.jsx("button",{type:"button",className:"btn btn--sm btn--primary",onClick:F,disabled:!U,children:"Сохранить"})]})]})]})}const ge=[{id:"copy",label:"Копировать",onSelect:()=>void ui(n.text)},...i?[{id:"edit",label:"Изменить",onSelect:H}]:[],...r?[{id:"rewind-files",label:"Откатить файлы",onSelect:()=>j(!0)}]:[]];return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"msg--user","data-item-id":n.id,onContextMenu:G,onTouchStart:P,onTouchMove:V,onTouchEnd:z,onTouchCancel:z,children:[Q,X,n.text,o&&s.jsx(er,{x:o.x,y:o.y,items:ge,onClose:()=>u(null)})]}),b&&r&&s.jsx(aE,{userIndex:l,onRewindFiles:r,onClose:()=>j(!1)})]})}function ty(n,l){const i=n.querySelectorAll("[data-item-id]");for(const r of i)if(r.dataset.itemId===l)return r;return null}function cE({text:n,streaming:l}){const[i,r]=x.useState(""),o=x.useRef(null),u=L0(o,i,l),m=x.useMemo(()=>({__html:i}),[i]),p=x.useRef([]),g=x.useRef(null);x.useEffect(()=>{let b=!1;return Hd(n).then(j=>{if(b)return;const v=oE(j);if(Vh(o.current)){g.current=v;return}g.current=null,r(v)}),()=>{b=!0}},[n]),x.useEffect(()=>{function b(){const j=g.current;j===null||Vh(o.current)||(g.current=null,r(j))}return document.addEventListener("selectionchange",b),()=>document.removeEventListener("selectionchange",b)},[]),x.useEffect(()=>{const b=p.current;return()=>b.forEach(j=>clearTimeout(j))},[]);function _(b){var k,N;const j=b.target.closest(".codeblock__copy");if(!(j instanceof HTMLElement))return;const v=((N=(k=j.parentElement)==null?void 0:k.querySelector("pre"))==null?void 0:N.textContent)??"";v!==""&&ui(v).then(E=>{if(!E)return;j.textContent=ru,j.setAttribute("aria-label",ru),j.classList.add("copybtn--done");const C=window.setTimeout(()=>{j.isConnected&&(j.textContent=Jc,j.setAttribute("aria-label",mg),j.classList.remove("copybtn--done"))},zg);p.current.push(C)})}return s.jsxs(s.Fragment,{children:[s.jsx("div",{ref:o,className:"markdown-preview msg--assistant__body",onClick:_,dangerouslySetInnerHTML:m}),u]})}const mg=`${Jc} блок кода`;function oE(n){if(!n.includes("<pre"))return n;const l=new DOMParser().parseFromString(n,"text/html");for(const i of l.body.querySelectorAll("pre")){const r=l.createElement("div");r.className="codeblock",i.replaceWith(r),r.append(i);const o=l.createElement("button");o.type="button",o.className="copybtn codeblock__copy",o.setAttribute("aria-label",mg),o.title=mg,o.textContent=Jc,r.append(o)}return l.body.innerHTML}function uE({item:n,onOpenPreview:l}){const[i,r]=x.useState(!1),o=n.result===null,u=Z0(n.name,n.input),m=n.name==="AskUserQuestion"?mE(n.input):null,p=l&&(n.name==="Write"||n.name==="Edit")&&!n.isError?dE(n.input):null;return s.jsxs("div",{className:"tool"+(n.isError?" tool--error":"")+(n.awaitingPermission?" tool--wait":""),"data-item-id":n.id,children:[s.jsxs("button",{className:"tool__head",onClick:()=>r(g=>!g),children:[s.jsx("span",{className:"tool__name",children:n.name}),s.jsx("span",{className:"tool__arg",children:m?hE(m):fE(n.input)}),s.jsx("span",{className:"tool__status",children:o?"…":n.isError?"ошибка":i?"▴":"▾"})]}),p&&s.jsx("div",{className:"tool__actions",children:s.jsx("button",{type:"button",className:"btn btn--sm",onClick:()=>l==null?void 0:l(p),children:"Открыть превью"})}),i&&s.jsxs("div",{className:"tool__body",children:[m?s.jsx(pE,{questions:m,answers:n.answers}):u?u.map((g,_)=>s.jsx(qg,{diff:g},_)):s.jsx(ny,{text:JSON.stringify(n.input,null,2),hint:"аргументы вызова"}),n.result!==null&&(!m||n.isError)&&s.jsx(ny,{text:n.result,hint:"результат вызова",style:{marginTop:10}})]})]})}function ny({text:n,hint:l,style:i}){return s.jsxs("div",{className:"codeblock",style:i,children:[s.jsx("pre",{className:"code",children:n}),s.jsx(tr,{text:n,hint:l,className:"codeblock__copy"})]})}function dE(n){if(typeof n!="object"||n===null)return null;const l=n.file_path;return typeof l=="string"&&Ph(l)?l:null}function fE(n){if(!n||typeof n!="object")return"";const l=n;for(const i of["file_path","command","pattern","path","url","prompt"]){const r=l[i];if(typeof r=="string")return r.replace(/\s+/g," ").slice(0,160)}return JSON.stringify(l).slice(0,160)}function hE(n){var i;const l=n.map(r=>r.header).filter(r=>r.length>0);return l.length===n.length?l.join(" · "):((i=n[0])==null?void 0:i.question.replace(/\s+/g," ").slice(0,160))??""}function mE(n){if(typeof n!="object"||n===null)return null;const l=n.questions;if(!Array.isArray(l)||l.length===0)return null;const i=[];for(const r of l){if(typeof r!="object"||r===null)return null;const{question:o,header:u,options:m,multiSelect:p}=r;if(typeof o!="string"||!Array.isArray(m)||m.length===0)return null;const g=[];for(const _ of m){if(typeof _!="object"||_===null)return null;const{label:b,description:j,preview:v}=_;if(typeof b!="string"||typeof j!="string")return null;g.push({label:b,description:j,...typeof v=="string"?{preview:v}:{}})}i.push({question:o,header:typeof u=="string"?u:"",options:g,multiSelect:p===!0})}return i}function pE({questions:n,answers:l}){return s.jsx("div",{className:"tool__questions",children:n.map((i,r)=>s.jsxs("div",{className:"tool__question",children:[s.jsxs("div",{className:"tool__question-head",children:[i.header&&s.jsx("span",{className:"chip chip--accent",children:i.header}),s.jsx("span",{className:"tool__question-text",children:i.question})]}),s.jsx("div",{className:"tool__question-answer",children:l!=null&&l[i.question]?s.jsx("span",{className:"tool__answer-value",children:l[i.question]}):s.jsx("span",{className:"tool__answer-empty",children:"не отвечено"})})]},r))})}function sy(n){return n>=1e3?`${(n/1e3).toFixed(1)}k`:String(n)}const gE="ccv.dictation.lang",ly="ru-RU";function xE(n){try{return Function.prototype.toString.call(n).includes("[native code]")}catch{return!1}}function ay(){const n=window,l=[n.SpeechRecognition,n.webkitSpeechRecognition].filter(r=>typeof r=="function"),i=l.find(xE);return!i&&l.length>0&&Aa("распознавание подменено: родной реализации в странице нет"),i??l[0]??null}function av(){var n;try{return((n=localStorage.getItem(gE))==null?void 0:n.trim())||ly}catch{return ly}}function Aa(n,l){l===void 0?console.debug(`[dictation] ${n}`):console.debug(`[dictation] ${n}`,l)}const _E=3,bE=400,yE=5,vE=250,jE=2e3,NE=2e4;async function kE(){try{return(await navigator.permissions.query({name:"microphone"})).state==="granted"}catch{return!1}}const wE={"not-allowed":"Браузер не дал доступ к микрофону","service-not-allowed":"Браузер не дал доступ к микрофону","audio-capture":"Микрофон не найден",network:"Сервис распознавания недоступен","language-not-supported":`Распознавание не знает языка ${av()}`};function SE(n){const[l]=x.useState(()=>ay()!==null),[i,r]=x.useState(!1),[o,u]=x.useState(null),m=x.useRef(null),p=x.useRef(!1),g=x.useRef(!1),_=x.useRef(n),b=x.useRef({openedAt:0,audio:!1,heard:!1,everHeard:!1,silent:0,dead:0,lastError:"",warned:!1}),j=x.useRef(null),v=x.useRef(!1),k=x.useRef(null),N=x.useCallback(()=>{k.current&&clearTimeout(k.current),k.current=null},[]),E=x.useCallback(()=>{N();const P=async V=>{if(k.current=null,!(!p.current||v.current)){if(!V&&!await kE()){if(Aa("ждём ответа на запрос доступа к микрофону"),!p.current||v.current)return;k.current=setTimeout(()=>void P(!0),NE);return}Aa("движок не ответил на start()"),p.current=!1,r(!1),u("Распознавание не отвечает — проверьте расширения браузера и доступ к микрофону")}};k.current=setTimeout(()=>void P(!1),jE)},[N]);x.useEffect(()=>{_.current=n}),x.useEffect(()=>{const P=ay();if(!P)return;const V=new P;return V.lang=av(),V.continuous=!0,V.interimResults=!0,V.onstart=()=>{Aa("сессия открыта"),v.current=!0,N(),r(!0)},V.onaudiostart=()=>{Aa("пошёл звук с микрофона"),b.current.audio=!0},V.onresult=z=>{var fe;if(g.current)return;let H="",te="";for(let Q=z.resultIndex;Q<z.results.length;Q++){const X=z.results[Q];if(!X)continue;const ge=((fe=X[0])==null?void 0:fe.transcript)??"";X.isFinal?H+=ge:te+=ge}const F=b.current;F.heard=!0,F.everHeard=!0,Aa("распознано",{final:H,interim:te}),_.current(H,te)},V.onerror=z=>{b.current.lastError=z.error,Aa("ошибка движка",z.error),!(z.error==="no-speech"||z.error==="aborted")&&(p.current=!1,r(!1),u(wE[z.error]??`Распознавание не работает: ${z.error}`))},V.onend=()=>{g.current=!1,v.current=!1;const z=b.current,H=Date.now()-z.openedAt;if(Aa("сессия закрыта",{мс:H,звук:z.audio,слова:z.heard,ошибка:z.lastError||null}),!p.current){r(!1);return}if(z.dead=!z.audio&&H<bE?z.dead+1:0,z.dead>=yE){p.current=!1,r(!1),u(z.lastError?`Распознавание не работает: ${z.lastError}`:"Распознавание закрывается сразу после запуска — проверьте доступ к микрофону в настройках сайта");return}z.silent=z.heard?0:z.silent+1,!z.everHeard&&!z.warned&&z.silent>=_E&&(z.warned=!0,u(z.audio?"Микрофон слушает, но речь не распознаётся — проверьте язык диктовки и уровень звука":"С микрофона не идёт звук — проверьте устройство ввода в настройках сайта в браузере")),j.current=setTimeout(()=>{if(j.current=null,!!p.current){z.openedAt=Date.now(),z.audio=!1,z.heard=!1,z.lastError="",E();try{V.start()}catch{}}},vE)},m.current=V,()=>{p.current=!1,j.current&&clearTimeout(j.current),j.current=null,N(),V.onend=null,V.onresult=null,V.onerror=null,V.onstart=null,V.onaudiostart=null,V.abort(),m.current=null}},[]);const C=x.useCallback(()=>{var P;if(p.current){if(p.current=!1,Aa("выключение микрофона"),j.current&&clearTimeout(j.current),j.current=null,N(),!v.current){r(!1);return}(P=m.current)==null||P.stop()}},[]),I=x.useCallback(()=>{const P=m.current;if(P){if(!window.isSecureContext){u("Микрофон доступен только по https или с localhost");return}u(null),p.current=!0,g.current=!1,j.current&&clearTimeout(j.current),j.current=null,b.current={openedAt:Date.now(),audio:!1,heard:!1,everHeard:!1,silent:0,dead:0,lastError:"",warned:!1},r(!0),Aa("включение микрофона",{язык:P.lang}),E();try{P.start()}catch(V){Aa("start() не прошёл",V)}}},[E]),D=x.useCallback(()=>{p.current?C():I()},[I,C]),G=x.useCallback(()=>{var P;p.current&&v.current&&(g.current=!0,(P=m.current)==null||P.abort())},[]);return{supported:l,listening:i,error:o,toggle:D,stop:C,drop:G}}const EE="(max-width: 860px)",iy=/^\/(\S*)$/,CE=new Set(["model","permissions"]);function TE(n){return CE.has(n.name)||n.name.startsWith("__")}const AE=new Set(["clear","rename"]),ry=/(?:^|\s)@([^\s@]*)$/,ME=200,RE=100,DE=190,LE=20*1024*1024,OE=1568,zE=.85;let Xh=0;const IE=new Set(["txt","md","markdown","csv","tsv","json","jsonl","ndjson","yaml","yml","xml","html","htm","css","scss","less","js","mjs","cjs","ts","tsx","jsx","py","go","rs","java","kt","swift","c","cpp","cc","h","hpp","cs","rb","php","sh","bash","zsh","ps1","bat","sql","log","ini","toml","cfg","conf","env","properties","gradle","vue","svelte","lua","r","dart","scala","tex","rst","diff","patch","graphql","proto"]),UE=/^(text\/|application\/(json|xml|x-yaml|yaml|toml|x-sh|javascript|typescript|sql|x-ndjson))/;function cy(n){const l=n.lastIndexOf(".");return l===-1?"":n.slice(l+1).toLowerCase()}function $E(n){return n.type==="application/pdf"||cy(n.name)==="pdf"?"pdf":UE.test(n.type)||IE.has(cy(n.name))?"text":"file"}function BE(n){return new Promise(l=>{const i=new FileReader;i.onload=()=>{const r=typeof i.result=="string"?i.result:"";l(r.slice(r.indexOf(",")+1))},i.onerror=()=>l(null),i.readAsDataURL(n)})}async function HE(n){const l=await BE(n);if(l===null)return null;const i=$E(n);return Xh+=1,{id:`att${Xh}`,kind:i,name:n.name||"файл",mediaType:n.type||(i==="text"?"text/plain":"application/octet-stream"),size:n.size,data:l}}async function qE(n){var j,v;if(!n.type.startsWith("image/")||n.size>LE)return null;const l=await GE(n);if(!l)return null;const{width:i,height:r}=l;if(i<=0||r<=0)return null;const o=Math.min(1,OE/Math.max(i,r)),u=document.createElement("canvas");u.width=Math.max(1,Math.round(i*o)),u.height=Math.max(1,Math.round(r*o));const m=u.getContext("2d");if(!m)return null;m.drawImage(l.image,0,0,u.width,u.height),(v=(j=l.image).close)==null||v.call(j);const p=n.type==="image/png",g=p?"image/png":"image/jpeg",_=u.toDataURL(g,p?void 0:zE),b=_.slice(_.indexOf(",")+1);return b?(Xh+=1,{id:`att${Xh}`,mediaType:g,data:b,previewUrl:_}):null}async function GE(n){if(typeof createImageBitmap=="function")try{const l=await createImageBitmap(n);return{image:l,width:l.width,height:l.height}}catch{}return new Promise(l=>{const i=URL.createObjectURL(n),r=new Image;r.onload=()=>{URL.revokeObjectURL(i),l({image:r,width:r.naturalWidth,height:r.naturalHeight})},r.onerror=()=>{URL.revokeObjectURL(i),l(null)},r.src=i})}function iv({disabled:n,busy:l,commands:i,sessionTitle:r,contextResult:o,className:u,placeholder:m,draftKey:p,sendLabel:g="Отправить",autoFocus:_=!1,attachmentsEnabled:b=!0,sendBlocked:j=!1,insertRequest:v=null,onInsertConsumed:k,onContextSearch:N,onCommand:E,onSend:C,onInterrupt:I,onEscape:D}){var Us;const G=$d(EE),[P,V]=x.useState(()=>p?vp(p):""),[z,H]=x.useState(!1),[te,F]=x.useState(0),fe=x.useRef(null),Q=x.useRef(null),X=x.useRef(!1),ge=x.useRef(null),[U,L]=x.useState(()=>p?vp(p).length:0),[M,O]=x.useState(()=>p?[...jp(p).images]:[]),[J,le]=x.useState(()=>p?[...jp(p).docs]:[]),ce=x.useRef([]),A=x.useRef([]);ce.current=M,A.current=J;const[W,me]=x.useState(null),[Ee,$]=x.useState(!1),[de,ae]=x.useState(!1),qe=x.useRef(0),Se=x.useRef(null),Ge=x.useCallback(B=>{!b||B.length===0||(async()=>{const xe=[],Re=[];let Ke=!1;const ht=()=>ce.current.length+A.current.length>=ah.maxCount;for(const rt of B){if(ht()){Ke=!0;break}if(rt.type.startsWith("image/")){const ts=await qE(rt);if(!ts){xe.push(rt.name||"изображение");continue}ce.current=[...ce.current,ts],O(ce.current);continue}if(A.current.reduce((ts,Ns)=>ts+Ns.size,0)+rt.size>ah.maxTotalBytes){Re.push(rt.name||"файл");continue}const Zs=await HE(rt);if(!Zs){xe.push(rt.name||"файл");continue}A.current=[...A.current,Zs],le(A.current)}const on=[];Ke&&on.push(`К сообщению можно приложить не больше ${ah.maxCount} вложений.`),Re.length>0&&on.push(`Документы вместе не больше ${dg(ah.maxTotalBytes)}: не добавлено — ${Re.join(", ")}.`),xe.length>0&&on.push(`Не удалось прочитать: ${xe.join(", ")}.`),on.length>0&&me({ok:!1,message:on.join(" ")})})()},[b]);function Ve(B){O(xe=>xe.filter(Re=>Re.id!==B))}function Je(B){le(xe=>xe.filter(Re=>Re.id!==B))}function Ft(B){var Ke;if(!b)return;const xe=(Ke=B.clipboardData)==null?void 0:Ke.items;if(!xe)return;const Re=[];for(const ht of xe){if(ht.kind!=="file")continue;const on=ht.getAsFile();on&&Re.push(on)}Re.length!==0&&(B.preventDefault(),Ge(Re))}function dt(B){const xe=B.target.files?Array.from(B.target.files):[];B.target.value="",Ge(xe)}const jn=B=>b&&!n&&Array.from(B.dataTransfer.types).includes("Files"),Ze=B=>!n&&rg(B.dataTransfer);function js(B){if(Ze(B)){B.preventDefault(),qe.current+=1,ae(!0);return}jn(B)&&(B.preventDefault(),qe.current+=1,$(!0))}function lt(B){if(Ze(B)){B.preventDefault(),B.dataTransfer.dropEffect="copy";return}jn(B)&&(B.preventDefault(),B.dataTransfer.dropEffect="copy")}function mt(B){!jn(B)&&!Ze(B)||(qe.current=Math.max(0,qe.current-1),qe.current===0&&($(!1),ae(!1)))}function Me(B){if(Ze(B)){B.preventDefault(),qe.current=0,ae(!1);const xe=C0(B.dataTransfer);xe&&hn(xe);return}jn(B)&&(B.preventDefault(),qe.current=0,$(!1),Ge(Array.from(B.dataTransfer.files)))}x.useEffect(()=>{b||(O([]),le([]))},[b]);const[nt,In]=x.useState([]),[kt,ut]=x.useState(-1),Un=x.useRef(""),[$n,Gt]=x.useState(""),it=SE(x.useCallback((B,xe)=>{B&&V(Re=>Gp(Re,B)),Gt(xe.trim())},[])),vt=$n?Gp(P,$n):P;x.useEffect(()=>{it.listening||$n===""||(V(B=>Gp(B,$n)),Gt(""))},[it.listening,$n]),x.useEffect(()=>{var B;_&&((B=fe.current)==null||B.focus())},[_]);const Kt=x.useRef(new Map),es=x.useRef(new Map),fs=x.useRef(p),Tt=x.useRef({text:P,caret:U});Tt.current={text:P,caret:U};const Lt=x.useCallback((B,xe,Re)=>{xe===""?(Kt.current.delete(B),es.current.delete(B)):(Kt.current.set(B,xe),es.current.set(B,Re)),Ky(B,xe)},[]),fn=it.drop;x.useLayoutEffect(()=>{const B=fs.current;if(B===p)return;fs.current=p,B&&Lt(B,Tt.current.text,Tt.current.caret);const xe=p?Kt.current.get(p)??vp(p):"",Re=p?es.current.get(p):void 0,Ke=Math.min(Re??xe.length,xe.length);V(xe),L(Ke),ge.current=[Ke,Ke],B&&Y_(B,{images:ce.current,docs:A.current});const ht=p?jp(p):{images:[],docs:[]};ce.current=[...ht.images],A.current=[...ht.docs],O(ce.current),le(A.current),Gt(""),F(0),H(!1),ut(-1),Un.current="",fn()},[p,Lt,fn]),x.useEffect(()=>{p&&Lt(p,P,U)},[p,P,U,Lt]),x.useEffect(()=>{p&&(M!==ce.current||J!==A.current||Y_(p,{images:M,docs:J}))},[p,M,J]);const Qt=n?"Выберите сессию":j?"Нет VPN — отправка остановлена":m??"Опишите задачу… («/» — команды, «@» — файлы)",zs=x.useRef(0),_e=x.useCallback(B=>{const xe=parseFloat(getComputedStyle(B).maxHeight),Re=Number.isFinite(xe)&&xe>0?xe:DE;B.style.height="auto";const Ke=B.scrollHeight;B.style.height=`${Math.min(Ke,Re)}px`,B.style.overflowY=Ke>Re?"auto":"hidden"},[]);x.useEffect(()=>{const B=fe.current;B&&_e(B)},[vt,Qt,n,_e]),x.useLayoutEffect(()=>{const B=fe.current,xe=ge.current;!B||!xe||(ge.current=null,B.setSelectionRange(xe[0],xe[1]))}),x.useEffect(()=>{const B=fe.current;if(!B)return;const xe=new ResizeObserver(([Re])=>{const Ke=Re==null?void 0:Re.contentRect.width;Ke===void 0||Math.abs(Ke-zs.current)<1||(zs.current=Ke,_e(B))});return xe.observe(B),()=>xe.disconnect()},[_e]);const Ae=it.stop;x.useEffect(()=>{n&&Ae()},[n,Ae]);const Pe=x.useMemo(()=>it.error?{ok:!1,message:it.error}:null,[it.error]),et=x.useMemo(()=>{var Re;const B=(Re=iy.exec(P))==null?void 0:Re[1];if(B===void 0)return[];const xe=B.toLowerCase();return i.filter(Ke=>!TE(Ke)&&Yp(Ke,xe)<rv).sort((Ke,ht)=>Yp(Ke,xe)-Yp(ht,xe))},[P,i]),Qe=!z&&et.length>0,Ot=Math.min(te,et.length-1),Zt=z?null:((Us=ry.exec(vt.slice(0,U)))==null?void 0:Us[1])??null,Kn=x.useRef(N);Kn.current=N,x.useEffect(()=>{if(Zt===null||Zt===""||Zt.endsWith("/")){Kn.current(Zt);return}const B=setTimeout(()=>Kn.current(Zt),ME);return()=>clearTimeout(B)},[Zt]);const Sl=Zt!==null&&(o==null?void 0:o.query)===Zt,Bn=Sl?o.entries:[],Et=Zt!==null,_t=Et&&!Sl,Is=Math.min(te,Math.max(Bn.length-1,0));x.useEffect(()=>{var xe,Re;if(!Qe&&!Et)return;const B=Qe?Ot:Is;(Re=(xe=Q.current)==null?void 0:xe.children[B])==null||Re.scrollIntoView({block:"nearest"})},[Qe,Et,Ot,Is]);function Qn(B,xe){var Re;V(B),L(xe),ge.current=[xe,xe],F(0),H(!1),$n!==""&&(Gt(""),it.drop()),(Re=fe.current)==null||Re.focus()}const Es=(v==null?void 0:v.token)??null;x.useEffect(()=>{if(!v)return;const B=Tt.current.text,xe=B.trim()?`${B.trimEnd()}
141
+
142
+ ${v.text}`:v.text;Qn(xe,xe.length),k==null||k(v.token)},[Es]);function Mn(){V(""),Gt(""),F(0),L(0),H(!1),ut(-1),Un.current="",O([]),le([]),it.drop(),p&&Lt(p,"",0)}function hs(B){const xe=B.trim();if(xe===""&&M.length===0&&J.length===0||n||j||X.current)return;const Re=C(xe,M.length>0?M.map(Ke=>({mediaType:Ke.mediaType,data:Ke.data})):void 0,J.length>0?J.map(({kind:Ke,name:ht,mediaType:on,size:rt,data:cl})=>({kind:Ke,name:ht,mediaType:on,size:rt,data:cl})):void 0);if(Re instanceof Promise){X.current=!0,Re.then(Ke=>{X.current=!1,Ke&&ms(xe)},()=>{X.current=!1});return}Re!==!1&&ms(xe)}function ms(B){B!==""&&In(xe=>[B,...xe.filter(Re=>Re!==B)].slice(0,RE)),Mn()}function Zn(B){if(B<-1||B>=nt.length)return;kt===-1&&(Un.current=P);const xe=B===-1?Un.current:nt[B]??"";ut(B),Qn(xe,xe.length)}function Qs(){var Ke;const B=((Ke=fe.current)==null?void 0:Ke.selectionStart)??vt.length,Re=`${B>0&&!/\s$/.test(vt.slice(0,B))?" ":""}@`;Qn(vt.slice(0,B)+Re+vt.slice(B),B+Re.length)}function hn(B){const xe=fe.current,Re=(xe==null?void 0:xe.selectionStart)??vt.length,Ke=(xe==null?void 0:xe.selectionEnd)??Re,ht=vt.slice(0,Re),rt=`${ht!==""&&!/\s$/.test(ht)?" ":""}@${B.path}${B.kind==="dir"?"/":""} `;Qn(ht+rt+vt.slice(Ke),Re+rt.length)}function wt(B){var ht;const xe=(ht=ry.exec(vt.slice(0,U)))==null?void 0:ht[1];if(xe===void 0)return;const Re=U-xe.length-1,Ke=B.kind==="dir"?`@${B.path}/`:`@${B.path} `;Qn(vt.slice(0,Re)+Ke+vt.slice(U),Re+Ke.length)}function At(){var xe;if(j)return;const B=(xe=iy.exec(vt.trim()))==null?void 0:xe[1];if(B&&E(B)){Mn();return}hs(vt)}function cn(B,xe){V(B),L(xe),F(0),H(!1),ut(-1),$n!==""&&(Gt(""),it.drop())}function ps(B){var Ke;const xe=AE.has(B.name)?r:null,Re=`/${B.name} `;V(Re+(xe??"")),L(Re.length+((xe==null?void 0:xe.length)??0)),xe&&(ge.current=[Re.length,Re.length+xe.length]),F(0),(Ke=fe.current)==null||Ke.focus()}function Rn(B){if(E(B.name)){V(""),F(0),H(!1);return}B.argumentHint?ps(B):hs(`/${B.name}`)}function ua(B){if(Qe){if(B.key==="ArrowDown")return B.preventDefault(),F(xe=>(Math.min(xe,et.length-1)+1)%et.length);if(B.key==="ArrowUp"){B.preventDefault();const xe=et.length-1;return F(Re=>(Math.min(Re,xe)+xe)%et.length)}if(B.key==="Enter"&&!B.shiftKey){B.preventDefault();const xe=et[Ot];xe&&Rn(xe);return}if(B.key==="Tab"){B.preventDefault();const xe=et[Ot];xe&&ps(xe);return}if(B.key==="Escape"){B.preventDefault(),B.stopPropagation(),H(!0);return}}if(Et){if(B.key==="ArrowDown"&&Bn.length>0)return B.preventDefault(),F(xe=>(Math.min(xe,Bn.length-1)+1)%Bn.length);if(B.key==="ArrowUp"&&Bn.length>0){B.preventDefault();const xe=Bn.length-1;return F(Re=>(Math.min(Re,xe)+xe)%Bn.length)}if(B.key==="Enter"&&!B.shiftKey||B.key==="Tab"){const xe=Bn[Is];if(xe){B.preventDefault(),wt(xe);return}if(B.key==="Tab")return}if(B.key==="Escape"){B.preventDefault(),B.stopPropagation(),H(!0);return}}if((B.key==="ArrowUp"||B.key==="ArrowDown")&&!B.shiftKey){const xe=B.currentTarget,Re=xe.selectionStart;if(xe.selectionEnd===Re){const ht=B.key==="ArrowUp"?kt+1:kt-1;ht>=-1&&ht<nt.length&&requestAnimationFrame(()=>{xe.selectionStart===Re&&xe.selectionEnd===Re&&Zn(ht)})}}if(B.key==="Escape"&&D){B.preventDefault(),B.stopPropagation(),D();return}B.key==="Enter"&&!B.shiftKey&&!G&&(B.preventDefault(),At())}return s.jsx("div",{className:(u?`composer ${u}`:"composer")+(Ee||de?" is-dragging":""),onDragEnter:js,onDragOver:lt,onDragLeave:mt,onDrop:Me,children:s.jsxs("div",{className:"composer__inner",children:[s.jsx(ec,{result:Pe}),s.jsx(ec,{result:W}),Ee&&s.jsx("div",{className:"composer__drop","aria-hidden":"true",children:"Отпустите, чтобы прикрепить"}),de&&s.jsx("div",{className:"composer__drop","aria-hidden":"true",children:"Отпустите, чтобы упомянуть"}),Et&&!Qe&&s.jsxs("div",{className:"cmdmenu",role:"listbox",ref:Q,children:[Bn.map((B,xe)=>s.jsxs("button",{role:"option","aria-selected":xe===Is,className:xe===Is?"cmdmenu__row is-on":"cmdmenu__row",onMouseEnter:()=>F(xe),onMouseDown:Re=>{Re.preventDefault(),wt(B)},children:[s.jsxs("span",{className:"cmdmenu__name",children:[B.name,B.kind==="dir"?"/":""]}),s.jsx("span",{className:"cmdmenu__desc",children:B.path}),B.ignored&&s.jsx("span",{className:"cmdmenu__tag",children:"git-ignore"})]},B.path)),Bn.length===0&&s.jsx("div",{className:"cmdmenu__empty",children:_t?"ищем…":Zt?"Ничего не нашлось":"Наберите имя файла или каталога"})]}),Qe&&s.jsx("div",{className:"cmdmenu",role:"listbox",ref:Q,children:et.map((B,xe)=>s.jsxs("button",{role:"option","aria-selected":xe===Ot,className:xe===Ot?"cmdmenu__row is-on":"cmdmenu__row",onMouseEnter:()=>F(xe),onMouseDown:Re=>{Re.preventDefault(),Rn(B)},children:[s.jsxs("span",{className:"cmdmenu__name",children:["/",B.name]}),B.argumentHint&&s.jsx("span",{className:"cmdmenu__hint",children:B.argumentHint}),s.jsx("span",{className:"cmdmenu__desc",children:B.description})]},B.name))}),(M.length>0||J.length>0)&&s.jsxs("div",{className:"composer__attachments",children:[M.map(B=>s.jsxs("div",{className:"composer__thumb",children:[s.jsx("img",{src:B.previewUrl,alt:"Вложение"}),s.jsx("button",{type:"button",className:"composer__thumb-remove","aria-label":"Удалить вложение",onClick:()=>Ve(B.id),children:s.jsx(QE,{})})]},B.id)),J.map(B=>s.jsx(P0,{file:B,onRemove:()=>Je(B.id)},B.id))]}),s.jsxs("div",{className:"composer__field",children:[s.jsx("button",{type:"button",className:"addbtn",title:"Добавить контекст — файл проекта («@»)","aria-label":"Добавить контекст",disabled:n,onClick:Qs,children:s.jsx(XE,{})}),b&&s.jsxs(s.Fragment,{children:[s.jsx("input",{ref:Se,type:"file",multiple:!0,className:"composer__fileinput",tabIndex:-1,"aria-hidden":"true",onChange:dt}),s.jsx("button",{type:"button",className:"attachbtn",title:"Прикрепить файл или изображение","aria-label":"Прикрепить файл или изображение",disabled:n,onClick:()=>{var B;return(B=Se.current)==null?void 0:B.click()},children:s.jsx(KE,{})})]}),s.jsx("textarea",{ref:fe,value:vt,disabled:n,placeholder:Qt,onChange:B=>cn(B.target.value,B.target.selectionStart),onSelect:B=>L(B.currentTarget.selectionStart),onKeyDown:ua,onPaste:Ft}),it.supported&&s.jsx("button",{type:"button",className:it.listening?"micbtn is-on":"micbtn",title:it.listening?"Остановить диктовку":"Продиктовать промпт","aria-label":it.listening?"Остановить диктовку":"Продиктовать промпт","aria-pressed":it.listening,disabled:n,onClick:it.toggle,children:s.jsx(ZE,{on:it.listening})}),l?s.jsx("button",{className:"btn",onClick:I,title:"Прервать (Esc)",children:"Стоп"}):s.jsxs("button",{className:"btn btn--primary sendbtn",onClick:At,disabled:n||j||vt.trim()===""&&M.length===0&&J.length===0,"aria-label":g,title:j?"Нет VPN — отправка остановлена":g,children:[s.jsx("span",{className:"sendbtn__label",children:g}),s.jsx(FE,{})]})]})]})})}function Gp(n,l){const i=l.trim();if(i==="")return n;const r=pg(i).slice(YE(n,i)).join(" ");return r===""?n:n===""||/\s$/.test(n)?n+r:`${n} ${r}`}function YE(n,l){const i=pg(n),r=pg(l);for(let o=Math.min(i.length,r.length);o>0;o--)if(i.slice(i.length-o).every((u,m)=>VE(u,r[m]??"")))return o;return 0}function pg(n){return n.split(/\s+/).filter(l=>l!=="")}function VE(n,l){const i=r=>r.toLowerCase().replace(/[.,!?;:…]+$/u,"");return i(n)===i(l)}function XE(){return s.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round","aria-hidden":"true",children:s.jsx("path",{d:"M8 3.4v9.2M3.4 8h9.2"})})}function FE(){return s.jsx("svg",{className:"sendbtn__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:s.jsx("path",{d:"M8 12.5V3.5M4 7.5 8 3.5l4 4"})})}function KE(){return s.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:s.jsx("path",{d:"M10.8 4.2 5.9 9.1a2 2 0 0 0 2.8 2.8l4.6-4.6a3.3 3.3 0 0 0-4.7-4.7L3.9 7.3a4.6 4.6 0 0 0 6.5 6.5l4.4-4.4"})})}function QE(){return s.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round","aria-hidden":"true",children:s.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})}function ZE({on:n}){return s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("rect",{x:"5.9",y:"1.7",width:"4.2",height:"7.6",rx:"2.1",fill:n?"currentColor":"none"}),s.jsx("path",{d:"M3.3 7.3v.8a4.7 4.7 0 0 0 9.4 0v-.8"}),s.jsx("path",{d:"M8 12.8v1.5"})]})}const rv=4;function Yp(n,l){const i=n.name.toLowerCase();return i===l?0:i.startsWith(l)?1:n.aliases.some(r=>r.toLowerCase().startsWith(l))?2:i.includes(l)?3:rv}function PE({request:n,plan:l,queued:i,collapsed:r,onCollapse:o,onAccept:u,onDecline:m}){const[p,g]=x.useState(l),[_,b]=x.useState("preview");x.useEffect(()=>{g(l),b("preview")},[n.requestId,l]);const j=p.trim().length>0;function v(){j&&u(n.requestId,p)}return s.jsx("div",{className:"modal-backdrop modal-backdrop--sheet",hidden:r,children:s.jsxs("div",{className:"plansheet",role:"dialog","aria-modal":"true","aria-label":"План агента",children:[s.jsxs("div",{className:"plansheet__head",children:[s.jsx("span",{className:"plansheet__head-icon","aria-hidden":"true",children:s.jsx(cv,{})}),s.jsxs("span",{className:"plansheet__head-text",children:["План на согласование",i>0&&` — ещё ${i} в очереди`]}),s.jsxs("div",{className:"plansheet__viewtoggle",role:"tablist","aria-label":"Режим просмотра",children:[s.jsx("button",{className:"btn btn--sm"+(_==="preview"?" is-on":""),role:"tab","aria-selected":_==="preview",onClick:()=>b("preview"),children:"Просмотр"}),s.jsx("button",{className:"btn btn--sm"+(_==="source"?" is-on":""),role:"tab","aria-selected":_==="source",onClick:()=>b("source"),children:"Код"})]}),s.jsx(Yg,{onClick:o})]}),s.jsxs("div",{className:"plansheet__body",children:[n.reason&&s.jsx("p",{className:"plansheet__reason",children:n.reason}),s.jsx("div",{className:"plansheet__content",children:_==="preview"?s.jsx(WE,{text:p}):s.jsx("textarea",{className:"plansheet__source",value:p,onChange:k=>g(k.target.value),spellCheck:!1,"aria-label":"Текст плана — можно отредактировать перед тем, как согласиться",autoFocus:!0})})]}),s.jsxs("div",{className:"plansheet__actions",children:[s.jsx("button",{className:"btn",onClick:()=>m(n.requestId),children:"Доработать"}),s.jsx("button",{className:"btn btn--ok",disabled:!j,autoFocus:!0,onClick:v,children:"Одобрить план"})]})]})})}function WE({text:n}){const[l,i]=x.useState("");return x.useEffect(()=>{let r=!1;return Hd(n).then(o=>{r||i(o)}),()=>{r=!0}},[n]),s.jsx("div",{className:"markdown-preview plansheet__preview",dangerouslySetInnerHTML:{__html:l}})}function cv(){return s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("path",{d:"M4.4 2.5h5.6L13 5.5v7.4a.6.6 0 0 1-.6.6H4.4a.6.6 0 0 1-.6-.6V3.1a.6.6 0 0 1 .6-.6Z"}),s.jsx("path",{d:"M9.5 2.5v2.5a.5.5 0 0 0 .5.5h3"}),s.jsx("path",{d:"M5.6 8.6 7 10l3-3.2"})]})}function JE({kind:n,toolName:l,queued:i,onExpand:r}){const o=n==="question"?"Уточняющий вопрос":n==="plan"?"План на согласование":`Разрешить действие: ${l}`;return s.jsxs("button",{type:"button",className:`decision-bar decision-bar--${n}`,onClick:r,children:[s.jsx("span",{className:"decision-bar__icon","aria-hidden":"true",children:n==="question"?"?":n==="plan"?s.jsx(cv,{}):"!"}),s.jsxs("span",{className:"decision-bar__text",children:[s.jsx("span",{className:"decision-bar__title",children:o}),s.jsxs("span",{className:"decision-bar__sub",children:["ждёт вашего решения",i>0&&` — ещё ${i} в очереди`]})]}),s.jsxs("span",{className:"decision-bar__action",children:["Развернуть",s.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:s.jsx("path",{d:"m4 10 4-4 4 4"})})]})]})}function Yg({onClick:n}){return s.jsxs("button",{type:"button",className:"decision-collapse",onClick:n,title:"Свернуть — агент продолжит ждать","aria-label":"Свернуть",children:[s.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:s.jsx("path",{d:"m4 6 4 4 4-4"})}),s.jsx("span",{className:"decision-collapse__label",children:"Свернуть"})]})}function eC({request:n,queued:l,collapsed:i,onCollapse:r,onDecide:o}){const u=Z0(n.toolName,n.input);return s.jsx("div",{className:"modal-backdrop modal-backdrop--sheet",hidden:i,children:s.jsxs("div",{className:"sheet",role:"dialog","aria-modal":"true","aria-label":"Запрос разрешения",children:[s.jsxs("div",{className:"sheet__head",children:[s.jsxs("span",{className:"sheet__head-text",children:["Разрешить действие?",l>0&&` (ещё ${l} в очереди)`]}),s.jsx(Yg,{onClick:r})]}),s.jsxs("div",{className:"sheet__body",children:[s.jsx("div",{className:"sheet__tool",children:n.toolName}),n.reason&&s.jsx("p",{className:"sheet__reason",children:n.reason}),u?u.map((m,p)=>s.jsx(qg,{diff:m},p)):s.jsx("pre",{className:"code",children:JSON.stringify(n.input,null,2)})]}),s.jsxs("div",{className:"sheet__actions",children:[s.jsx("button",{className:"btn",onClick:()=>o(n.requestId,"deny"),children:"Отклонить"}),s.jsx("button",{className:"btn btn--warn",autoFocus:!0,onClick:()=>o(n.requestId,"allow"),children:"Разрешить"})]})]})})}function tC({request:n,queued:l,collapsed:i,onCollapse:r,onAnswer:o,onDecline:u}){const{questions:m}=n,[p,g]=x.useState(()=>m.map(()=>new Set)),[_,b]=x.useState(()=>m.map(()=>"")),[j,v]=x.useState(()=>oy(m));x.useEffect(()=>{g(m.map(()=>new Set)),b(m.map(()=>"")),v(oy(m))},[n.requestId]);const k=x.useMemo(()=>sC(m,p,_),[m,p,_]),N=k!==null;function E(V,z){var H,te;(te=(H=m[V])==null?void 0:H.options[z])!=null&&te.preview&&v(F=>{const fe=F.slice();return fe[V]=z,fe})}function C(V,z,H){g(te=>{const F=te.slice(),fe=new Set(F[V]);return H?fe.has(z)?fe.delete(z):fe.add(z):fe.has(z)||(fe.clear(),fe.add(z)),F[V]=fe,F}),z!=="other"&&E(V,z)}function I(V,z){b(H=>{const te=H.slice();return te[V]=z,te})}function D(){k&&o(n.requestId,k)}function G(V){V.key==="Enter"&&(V.target.closest("button")||N&&(V.preventDefault(),D()))}function P(V){var F;if(!["ArrowDown","ArrowUp","ArrowRight","ArrowLeft"].includes(V.key))return;const z=Array.from(V.currentTarget.querySelectorAll("button.qsheet__option")),H=z.indexOf(document.activeElement);if(H===-1)return;V.preventDefault();const te=V.key==="ArrowDown"||V.key==="ArrowRight"?1:-1;(F=z[(H+te+z.length)%z.length])==null||F.focus()}return s.jsx("div",{className:"modal-backdrop modal-backdrop--sheet",hidden:i,children:s.jsxs("div",{className:"qsheet",role:"dialog","aria-modal":"true","aria-label":"Вопрос от Claude",onKeyDown:G,children:[s.jsxs("div",{className:"qsheet__head",children:[s.jsx("span",{className:"qsheet__head-icon","aria-hidden":"true",children:"?"}),s.jsxs("span",{className:"qsheet__head-text",children:[m.length===1?"Уточняющий вопрос":`Уточняющие вопросы (${m.length})`,l>0&&` — ещё ${l} в очереди`]}),s.jsx(Yg,{onClick:r})]}),s.jsxs("div",{className:"qsheet__body",children:[n.reason&&s.jsx("p",{className:"qsheet__reason",children:n.reason}),m.map((V,z)=>s.jsx(nC,{q:V,qi:z,selected:p[z]??new Set,otherText:_[z]??"",previewIndex:j[z]??null,onToggle:C,onFocusOption:E,onOtherText:I,onOptionsKeyDown:P},z))]}),s.jsxs("div",{className:"qsheet__actions",children:[s.jsx("button",{className:"btn",onClick:()=>u(n.requestId),children:"Не отвечать"}),s.jsx("button",{className:"btn btn--primary",disabled:!N,onClick:D,children:"Ответить"})]})]})})}function nC({q:n,qi:l,selected:i,otherText:r,previewIndex:o,onToggle:u,onFocusOption:m,onOtherText:p,onOptionsKeyDown:g}){var k;const _=n.options.some(N=>N.preview),b=o!==null?(k=n.options[o])==null?void 0:k.preview:void 0,j=i.has("other"),v=n.multiSelect?"checkbox":"radio";return s.jsxs("div",{className:"qsheet__question",children:[s.jsxs("div",{className:"qsheet__qhead",children:[s.jsx("span",{className:"chip chip--accent",children:n.header}),s.jsx("span",{className:"qsheet__qtext",children:n.question})]}),s.jsxs("div",{className:"qsheet__options"+(n.multiSelect?"":" qsheet__options--radio"),role:n.multiSelect?"group":"radiogroup","aria-label":n.question,onKeyDown:g,children:[n.options.map((N,E)=>{const C=i.has(E);return s.jsxs("button",{type:"button",role:v,"aria-checked":C,className:"qsheet__option"+(C?" is-selected":""),onClick:()=>u(l,E,n.multiSelect),onFocus:()=>m(l,E),onMouseEnter:()=>m(l,E),children:[s.jsx("span",{className:"qsheet__opt-mark","aria-hidden":"true"}),s.jsxs("span",{className:"qsheet__opt-body",children:[s.jsx("span",{className:"qsheet__opt-label",children:N.label}),s.jsx("span",{className:"qsheet__opt-desc",children:N.description})]})]},E)}),s.jsxs("div",{className:"qsheet__other",children:[s.jsxs("button",{type:"button",role:v,"aria-checked":j,className:"qsheet__option qsheet__option--other"+(j?" is-selected":""),onClick:()=>u(l,"other",n.multiSelect),children:[s.jsx("span",{className:"qsheet__opt-mark","aria-hidden":"true"}),s.jsxs("span",{className:"qsheet__opt-body",children:[s.jsx("span",{className:"qsheet__opt-label",children:"Другое"}),s.jsx("span",{className:"qsheet__opt-desc",children:"Свой вариант ответа"})]})]}),j&&s.jsx("input",{type:"text",className:"qsheet__other-input",placeholder:"Впишите свой вариант…","aria-label":`Свой вариант ответа на вопрос «${n.question}»`,value:r,onChange:N=>p(l,N.target.value),autoFocus:!0})]})]}),_&&s.jsx("pre",{className:"qsheet__preview",children:b??""})]})}function oy(n){return n.map(l=>{const i=l.options.findIndex(r=>r.preview);return i===-1?null:i})}function sC(n,l,i){const r={};for(let o=0;o<n.length;o++){const u=n[o];if(!u)continue;const m=l[o]??new Set,p=[];for(let g=0;g<u.options.length;g++){const _=u.options[g];_&&m.has(g)&&p.push(_.label)}if(m.has("other")){const g=(i[o]??"").trim();g&&p.push(g)}if(p.length===0)return null;r[u.question]=p.join(", ")}return r}function lC(n,l){if(n!=="ExitPlanMode"||!l||typeof l!="object")return null;const i=l.plan;return typeof i=="string"?i:null}function ov({path:n}){const[l,i]=x.useState(!1),[r,o]=x.useState(!1),u=x.useRef(null);x.useEffect(()=>{if(!l)return;function p(g){var _;(_=u.current)!=null&&_.contains(g.target)||i(!1)}return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[l]),x.useEffect(()=>{if(!r)return;const p=setTimeout(()=>o(!1),zg);return()=>clearTimeout(p)},[r]),x.useEffect(()=>i(!1),[n]);async function m(){await ui(n)&&o(!0)}return s.jsxs("div",{ref:u,className:"cwd",children:[s.jsxs("button",{type:"button",className:"cwd__toggle","aria-expanded":l,title:l?"Свернуть путь":`Полный путь: ${n}`,onClick:()=>i(p=>!p),onKeyDown:p=>{p.key!=="Escape"||!l||(p.preventDefault(),p.stopPropagation(),i(!1))},children:[s.jsx(aC,{open:l}),s.jsx("span",{className:"cwd__short",children:n})]}),l&&s.jsxs("div",{className:"cwd__pop",children:[s.jsx("span",{className:"cwd__full",children:n}),s.jsx("button",{type:"button",className:"btn btn--ghost cwd__copy",onClick:()=>void m(),children:r?ru:Jc})]})]})}function aC({open:n}){return s.jsx("svg",{className:n?"cwd__chev cwd__chev--open":"cwd__chev",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:s.jsx("path",{d:"M6 3.5 10.5 8 6 12.5"})})}const iC=["low","medium","high"];function uv({models:n,value:l,effort:i,ultracode:r,thinking:o,switchOnFlag:u,showSwitchOnFlag:m=!0,className:p,onModel:g,onEffort:_,onUltracode:b,onThinking:j,onSwitchOnFlag:v}){const[k,N]=x.useState(!1),[E,C]=x.useState(0),I=x.useRef(null),D=x.useRef(null),G=n.find(te=>te.value===l)??null,P=G&&G.supportsEffort?G.effortLevels.length>0?G.effortLevels:iC:[],V=P.includes("xhigh");x.useEffect(()=>{if(!k)return;const te=n.findIndex(F=>F.value===l);C(te===-1?0:te)},[k]),x.useEffect(()=>{if(!k)return;function te(F){var fe;(fe=I.current)!=null&&fe.contains(F.target)||N(!1)}return document.addEventListener("mousedown",te),()=>document.removeEventListener("mousedown",te)},[k]),x.useEffect(()=>{var te,F;k&&((F=(te=D.current)==null?void 0:te.querySelector(".is-cursor"))==null||F.scrollIntoView({block:"nearest"}))},[k,E]);function z(te){N(!1),te.value!==l&&g(te.value)}function H(te){if(te.key==="Escape"){if(!k)return;te.preventDefault(),te.stopPropagation(),N(!1);return}if(te.key==="ArrowDown"||te.key==="ArrowUp"){if(te.preventDefault(),!k)return N(!0);if(n.length===0)return;const F=te.key==="ArrowDown"?1:n.length-1;return C(fe=>(fe+F)%n.length)}if(te.key==="Enter"||te.key===" "){if(te.preventDefault(),!k)return N(!0);const F=n[E];F&&z(F)}}return s.jsxs("div",{ref:I,className:"select"+(k?" select--open":"")+(p?` ${p}`:""),children:[s.jsxs("button",{type:"button",className:"select__trigger",title:"Модель, усилие и размышления","aria-label":"Модель, усилие и размышления","aria-haspopup":"menu","aria-expanded":k,onClick:()=>N(te=>!te),onKeyDown:H,children:[(G==null?void 0:G.displayName)??l?s.jsx("span",{className:"select__value",children:(G==null?void 0:G.displayName)??l}):s.jsx("span",{className:"select__value select__value--muted",children:"по умолчанию"}),r?s.jsx("span",{className:"select__suffix select__suffix--hot",children:"ultracode"}):P.length>0&&i&&s.jsx("span",{className:"select__suffix",children:i}),s.jsx(rC,{})]}),k&&s.jsxs("div",{ref:D,className:"select__menu modelmenu",role:"menu",children:[s.jsx("div",{className:"modelmenu__head",children:"Модель"}),n.map((te,F)=>s.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":te.value===l,className:"select__option"+(F===E?" is-cursor":"")+(te.value===l?" is-on":""),onMouseEnter:()=>C(F),onClick:()=>z(te),children:[s.jsx("span",{className:"select__check","aria-hidden":"true",children:te.value===l?"✓":""}),s.jsx("span",{className:"select__label",children:te.displayName}),te.description&&s.jsx("span",{className:"select__hint",children:te.description})]},te.value)),P.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"modelmenu__sep",role:"separator"}),s.jsxs("div",{className:"modelmenu__row",children:[s.jsxs("span",{className:"modelmenu__label",children:["Усилие",s.jsx("span",{className:"modelmenu__desc",children:"насколько усердно модель думает"})]}),s.jsx("span",{className:"modelmenu__levels",children:P.map(te=>s.jsx("button",{type:"button",role:"menuitemradio","aria-checked":te===i,className:te===i?"modelmenu__level is-on":"modelmenu__level",onClick:()=>_(te),children:te},te))})]}),V&&s.jsx(Vp,{label:"Ultracode",desc:"xhigh и постоянная оркестрация подагентами",on:r,onToggle:()=>b(!r)})]}),s.jsx("div",{className:"modelmenu__sep",role:"separator"}),(G==null?void 0:G.supportsThinking)!==!1&&s.jsx(Vp,{label:"Размышления",desc:"расширенное обдумывание перед ответом",on:o,onToggle:()=>j(!o)}),m&&s.jsx(Vp,{label:"Менять модель по флагу",desc:"иначе помеченный ход встаёт на паузу",on:u,onToggle:()=>v(!u)})]})]})}function Vp({label:n,desc:l,on:i,onToggle:r}){return s.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":i,className:"modelmenu__row modelmenu__row--btn",onClick:r,children:[s.jsxs("span",{className:"modelmenu__label",children:[n,s.jsx("span",{className:"modelmenu__desc",children:l})]}),s.jsx("span",{className:i?"switch is-on":"switch","aria-hidden":"true",children:s.jsx("span",{className:"switch__knob"})})]})}function rC(){return s.jsx("svg",{className:"select__chev",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:s.jsx("path",{d:"M3 4.5 6 7.5 9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function cC({candidates:n,searching:l,agentItems:i,agentBusy:r,error:o,roots:u,folders:m,projectsRoot:p,created:g,onSearch:_,onAskAgent:b,onInterrupt:j,onSubmit:v,onCreate:k,onClose:N}){const[E,C]=x.useState("open"),[I,D]=x.useState(""),[G,P]=x.useState(!1),[V,z]=x.useState(""),[H,te]=x.useState(""),[F,fe]=x.useState(""),[Q,X]=x.useState({git:!0,claudeMd:!0,readme:!0}),ge=I.trim(),U=ge!=="",L=V.trim(),M=H.trim(),O=m.find($=>$.id===F),J=O!==void 0&&p!==null,le=M!==""&&(J||F===""&&L!==""),ce=[{value:"",label:"Без папки",hint:"каталог по указанному пути"},...m.map($=>({value:$.id,label:$.name}))];x.useEffect(()=>{V===""&&u.length>0&&z(u[0])},[u]);const A=x.useRef(_);A.current=_,x.useEffect(()=>{if(E!=="open")return;const $=I.trim(),de=setTimeout(()=>A.current($),200);return()=>clearTimeout(de)},[I,E]);function W(){U&&v(ge)}function me(){le&&k(J?p:L,M,Q,J?O.id:void 0)}function Ee(){U&&(P(!0),b(ge))}return g?s.jsxs(zn,{title:"Новый проект",onClose:N,actions:s.jsx("button",{className:"btn btn--primary",onClick:N,autoFocus:!0,children:"Понятно"}),children:[s.jsx("p",{className:"modal__text",children:"Каталог создан и открыт как проект, но часть шагов не удалась."}),s.jsx("p",{className:"newproj__preview",children:g.path}),s.jsx("div",{className:"modal__error",children:s.jsx("ul",{className:"newproj__warnings",children:g.warnings.map($=>s.jsx("li",{children:$},$))})}),s.jsx("p",{className:"modal__text modal__text--dim",children:"Проект открыт и работает — недостающее можно добавить руками, в дереве файлов или из терминала."})]}):s.jsxs(zn,{title:"Новый проект",className:G&&E==="open"?"modal--wide":void 0,onClose:N,actions:s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn",onClick:N,children:"Отмена"}),E==="open"?s.jsxs(s.Fragment,{children:[r?s.jsx("button",{className:"btn",onClick:j,children:"Остановить"}):s.jsx("button",{className:"btn",disabled:!U,onClick:Ee,title:"Найти по описанию",children:"Попросить агента"}),s.jsx("button",{className:"btn btn--primary",disabled:!U,onClick:W,children:"Открыть"})]}):s.jsx("button",{className:"btn btn--primary",disabled:!le,onClick:me,children:"Создать"})]}),children:[s.jsxs("div",{className:"tabs",children:[s.jsx(uy,{label:"Открыть",on:E==="open",onClick:()=>C("open")}),s.jsx(uy,{label:"Создать",on:E==="create",onClick:()=>C("create")})]}),E==="open"?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"modal__text",children:"Каталог, в котором будет работать агент. Введите путь или часть имени — подходящие каталоги появятся ниже."}),s.jsx("label",{className:"field",htmlFor:"workspace-path",children:"Путь или название"}),s.jsx("input",{id:"workspace-path",className:"input input--mono",value:I,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"C:\\Projects\\my-app",onChange:$=>D($.target.value),onKeyDown:$=>{$.key==="Enter"&&($.preventDefault(),W())}}),o&&s.jsx("p",{className:"modal__error",children:o}),n.length>0&&s.jsx("ul",{className:"finds",children:n.map($=>s.jsx("li",{children:s.jsxs("button",{className:"find",disabled:$.open,title:$.open?"Этот проект уже открыт":$.path,onClick:()=>D($.path),onDoubleClick:()=>v($.path),children:[s.jsx("span",{className:"find__name",children:$.name}),s.jsx("span",{className:"find__path",children:$.path}),s.jsx("span",{className:"find__note",children:uC($)})]})},$.path))}),n.length===0&&U&&!l&&!G&&s.jsx("p",{className:"modal__text modal__text--dim",children:"Ничего похожего среди каталогов, где вы работали. Если помните не имя, а суть проекта — опишите его и нажмите «Попросить агента». Проекта ещё нет вовсе — рядом вкладка «Создать»."}),G&&s.jsx("div",{className:"finds__agent",children:s.jsx(Gg,{items:i,busy:r,waiting:!1,empty:"Агент ищет…"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"modal__text",children:"Пустой каталог для нового проекта. Дальше в нём работает агент — с первого промпта, без отдельной настройки."}),m.length>0&&p!==null&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"field",children:"Папка"}),s.jsx(rl,{value:F,options:ce,ariaLabel:"Папка проектов",onChange:fe})]}),J?s.jsxs("p",{className:"account__step newproj__where",children:["Каталог появится внутри папки «",O.name,"» в корне проектов."]}):s.jsxs(s.Fragment,{children:[s.jsx("label",{className:"field",htmlFor:"workspace-parent",children:"Где создать"}),s.jsx("input",{id:"workspace-parent",className:"input input--mono",value:V,spellCheck:!1,autoComplete:"off",placeholder:"C:\\Projects",onChange:$=>z($.target.value)}),u.length>0&&s.jsx("div",{className:"newproj__roots",children:u.map($=>s.jsx("button",{type:"button",className:$===L?"newproj__root is-on":"newproj__root",title:$,onClick:()=>z($),children:oC($)},$))})]}),s.jsx("label",{className:"field newproj__field",htmlFor:"workspace-name",children:"Имя проекта"}),s.jsx("input",{id:"workspace-name",className:"input input--mono",value:H,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"my-app",onChange:$=>te($.target.value),onKeyDown:$=>{$.key==="Enter"&&($.preventDefault(),me())}}),s.jsx("p",{className:"newproj__preview",children:le?dy(J?dy(p,O.name):L,M):"Каталог появится здесь"}),o&&s.jsx("p",{className:"modal__error",children:o}),s.jsxs("div",{className:"newproj__opts",children:[s.jsx(Xp,{label:"git init",desc:"панель истории работает сразу",on:Q.git,onToggle:()=>X($=>({...$,git:!$.git}))}),s.jsx(Xp,{label:"CLAUDE.md",desc:"заготовка инструкций для агента",on:Q.claudeMd,onToggle:()=>X($=>({...$,claudeMd:!$.claudeMd}))}),s.jsx(Xp,{label:"README.md",desc:"по нему проект потом узнаёт поиск",on:Q.readme,onToggle:()=>X($=>({...$,readme:!$.readme}))})]})]})]})}function uy({label:n,on:l,onClick:i}){return s.jsx("button",{type:"button",className:l?"tabs__tab is-on":"tabs__tab","aria-pressed":l,onClick:i,children:n})}function Xp({label:n,desc:l,on:i,onToggle:r}){return s.jsxs("button",{type:"button",role:"checkbox","aria-checked":i,className:"newproj__opt",onClick:r,children:[s.jsxs("span",{className:"newproj__optlabel",children:[n,s.jsx("span",{className:"newproj__optdesc",children:l})]}),s.jsx("span",{className:i?"switch is-on":"switch","aria-hidden":"true",children:s.jsx("span",{className:"switch__knob"})})]})}function dy(n,l){const i=n.includes("\\")?"\\":"/";return n.replace(/[\\/]+$/,"")+i+l}function oC(n){const l=n.includes("\\")?"\\":"/",i=n.split(/[\\/]/).filter(Boolean);return i.length<=2?n:`…${l}${i.slice(-2).join(l)}`}function uC(n){return n.open?"уже открыт":n.why?n.why:n.sessions===0?"рядом с вашими проектами":`${dC(n.sessions)}${fC(n.lastUsedAt)}`}function dC(n){const l=n%10,i=n%100;return i>=11&&i<=14?`${n} сессий`:l===1?`${n} сессия`:l>=2&&l<=4?`${n} сессии`:`${n} сессий`}function fC(n){if(!n)return"";const l=Math.floor((Date.now()-n)/864e5);return l<=0?" · сегодня":l===1?" · вчера":l<30?` · ${l} дн. назад`:` · ${new Date(n).toLocaleDateString("ru-RU")}`}const Vg=7;function hC(n){const l=[],i=[];let r=1;for(const o of n){const u=l.slice();let m=l.indexOf(o.hash);m===-1&&(m=fy(l),l[m]=o.hash);const[p,...g]=o.parents;l[m]=p??null;const _=[];p!==void 0&&_.push({from:m,to:m});for(const v of g){let k=l.indexOf(v);k===-1&&(k=fy(l),l[k]=v),_.push({from:m,to:k})}const b=[];for(let v=0;v<u.length;v++)u[v]===o.hash&&(b.push({from:v,to:m}),v!==m&&(l[v]=null));const j=[];for(let v=0;v<u.length;v++){const k=u[v];!k||k===o.hash||v===m||l[v]===k&&j.push(v)}mC(l),r=Math.max(r,l.length,m+1),i.push({commit:o,col:m,up:b,down:_,through:j})}return{rows:i,columns:Math.min(r,Vg)}}function fy(n){const l=n.indexOf(null);return l!==-1?l:(n.push(null),n.length-1)}function mC(n){for(;n.length>0&&n[n.length-1]===null;)n.pop()}function pC({open:n,state:l,result:i,selected:r,busy:o,onRefresh:u,onShow:m,onCheckout:p,onPush:g,onPull:_,onPublish:b,onConnectRemote:j,onDismissResult:v,onClose:k,zoomed:N,onToggleZoom:E}){const C=hC((l==null?void 0:l.commits)??[]),I=[...l!=null&&l.detached?[{value:"",label:`отделён · ${l.head.slice(0,8)}`}]:[],...((l==null?void 0:l.branches)??[]).map(D=>({value:D.name,label:D.name,hint:D.hash.slice(0,8)}))];return s.jsxs("aside",{className:(n?"sidepane sidepane--git sidepane--open":"sidepane sidepane--git")+(N?" sidepane--zoomed":""),"aria-label":"История git",children:[s.jsxs("div",{className:"sidepane__head",onDoubleClick:D=>{E&&(D.target.closest("button")||E())},children:[s.jsx(vC,{}),s.jsx("span",{className:"sidepane__title",children:"История"}),s.jsx("button",{className:"sidepane__btn",title:"Обновить","aria-label":"Обновить историю",onClick:u,children:"↻"}),E&&s.jsx("button",{className:"sidepane__btn",title:N?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":N?"Свернуть панель истории":"Развернуть панель истории на весь экран","aria-pressed":N,onClick:E,children:s.jsx(_u,{active:N})}),s.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель истории",onClick:k,children:"✕"})]}),l===null?s.jsx("p",{className:"sidepane__empty",children:"Читаем репозиторий…"}):l.available?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"gitbar",children:[s.jsx(rl,{className:"gitbar__branch",title:"Ветка — выбрать значит переключиться",value:l.detached?"":l.branch,options:I,onChange:D=>{D&&p(D,`ветку ${D}`)}}),s.jsx(tr,{text:l.detached?l.head:l.branch,hint:l.detached?"хеш HEAD":"имя ветки"})]}),l.detached&&s.jsx("p",{className:"gitbar__note",children:"HEAD отделён от ветки. Выберите ветку в списке, чтобы вернуться."}),s.jsx("div",{className:"gitbar__actions",children:o?s.jsxs("p",{className:"gitbar__busy",children:[s.jsx(wC,{}),o]}):l.hasRemote?s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button",className:"btn btn--sm",title:"Отправить текущую ветку в origin",onClick:g,children:[s.jsx(jC,{}),"Отправить",l.ahead>0&&s.jsx("span",{className:"gitbar__count",children:l.ahead})]}),s.jsxs("div",{className:"gitbar__group",children:[s.jsxs("button",{type:"button",className:"btn btn--sm",title:"Забрать с origin и перемотать вперёд (git pull --ff-only)",onClick:()=>_(!0),children:[s.jsx(NC,{}),"Забрать",l.behind>0&&s.jsx("span",{className:"gitbar__count",children:l.behind})]}),s.jsx("button",{type:"button",className:"btn btn--sm btn--ghost gitbar__check",title:"Только проверить — git fetch, рабочее дерево не меняется","aria-label":"Проверить, что нового на origin, без изменений на диске",onClick:()=>_(!1),children:s.jsx(kC,{})})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button",className:"btn btn--sm btn--primary",title:"Создать репозиторий на GitHub и отправить в него ветку",onClick:b,children:[s.jsx(my,{}),"Опубликовать на GitHub"]}),s.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",title:"Прописать origin на уже существующий репозиторий",onClick:j,children:"уже есть репозиторий"})]})}),s.jsxs("div",{className:"sidepane__scroll",children:[s.jsx("button",{className:"gitrow gitrow--work"+(r===""?" is-on":""),onClick:()=>m(""),children:s.jsxs("span",{className:"gitrow__body",children:[s.jsx("span",{className:"gitrow__subject",children:l.changed.length>0?`Рабочее дерево · ${l.changed.length} ${TC(l.changed.length)}`:"Рабочее дерево чистое"}),s.jsx("span",{className:"gitrow__meta",children:l.changed.length>0?l.changed.slice(0,4).map(D=>CC(D.path)).join(", "):"незакоммиченных изменений нет"})]})}),C.rows.map(D=>s.jsx(xC,{row:D,columns:C.columns,head:D.commit.hash===l.head,local:l.hasRemote&&!D.commit.pushed,active:r===D.commit.hash,onOpen:()=>m(D.commit.hash)},D.commit.hash)),C.rows.length===0&&s.jsx("p",{className:"sidepane__empty",children:"В репозитории ещё нет коммитов"})]})]}):s.jsxs("div",{className:"gitempty",children:[s.jsx("p",{className:"gitempty__text",children:l.message||"Это не git-репозиторий"}),l.noRepo&&s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button",className:"btn btn--sm btn--primary gitempty__btn",onClick:b,children:[s.jsx(my,{}),"Опубликовать на GitHub"]}),s.jsx("p",{className:"gitempty__hint",children:"Заведёт репозиторий, сделает первый коммит и отправит его на GitHub."})]})]}),s.jsx(ec,{result:i,onDismiss:v})]})}const Nd=50,hy=13,gC=500;function xC({row:n,columns:l,head:i,local:r,active:o,onOpen:u}){const{commit:m}=n,p=m.refs.map(SC).filter(Boolean),[g,_]=x.useState(null),b=x.useRef(null);function j(E){const C=E.touches[0];if(!C)return;const I={timer:0,x:C.clientX,y:C.clientY,fired:!1};I.timer=window.setTimeout(()=>{I.fired=!0,_({x:I.x,y:I.y})},gC),b.current=I}function v(E){const C=b.current,I=E.touches[0];!C||!I||Math.hypot(I.clientX-C.x,I.clientY-C.y)>10&&(window.clearTimeout(C.timer),b.current=null)}function k(E){const C=b.current;C&&(window.clearTimeout(C.timer),C.fired&&E.preventDefault())}function N(){const E=[{id:"hash",label:"Копировать хеш",hint:m.shortHash,onSelect:()=>void ui(m.hash)},{id:"short",label:"Копировать короткий хеш",onSelect:()=>void ui(m.shortHash)},{id:"subject",label:"Копировать сообщение",onSelect:()=>void ui(m.subject)}],C=new Set;for(const I of m.refs){const D=I.startsWith("tag: "),G=EC(I);!G||C.has(G)||(C.add(G),E.push({id:`ref:${G}`,label:D?"Копировать тег":"Копировать ветку",hint:G,onSelect:()=>void ui(G)}))}return E}return s.jsxs(s.Fragment,{children:[s.jsxs("button",{className:"gitrow"+(o?" is-on":""),title:r?"Коммит ещё не отправлен на удалённый репозиторий":void 0,onClick:()=>{var E;if((E=b.current)!=null&&E.fired){b.current=null;return}u()},onContextMenu:E=>{E.preventDefault(),_({x:E.clientX,y:E.clientY})},onTouchStart:j,onTouchMove:v,onTouchEnd:k,onTouchCancel:k,children:[s.jsx(_C,{row:n,columns:l,head:i,local:r}),s.jsxs("span",{className:"gitrow__body",children:[s.jsxs("span",{className:"gitrow__subject",children:[p.map(E=>s.jsx("span",{className:"gitrow__ref",children:E},E)),m.subject]}),s.jsxs("span",{className:"gitrow__meta",children:[m.shortHash," · ",m.author," · ",AC(m.date),r&&s.jsx("span",{className:"gitrow__local",children:"· не отправлен"})]})]})]}),g&&s.jsx(er,{x:g.x,y:g.y,items:N(),onClose:()=>_(null)})]})}function _C({row:n,columns:l,head:i,local:r}){const o=l*hy+6,u=Nd/2,m=_=>8+Math.min(_,Vg-1)*hy,p=r?"3.5 2.5":void 0,g=bh(n.col);return s.jsxs("svg",{className:"gitgraph",width:o,height:Nd,viewBox:`0 0 ${o} ${Nd}`,"aria-hidden":"true",children:[n.through.map(_=>s.jsx("line",{x1:m(_),y1:0,x2:m(_),y2:Nd,style:{stroke:bh(_)}},`t${_}`)),n.up.map((_,b)=>s.jsx("path",{d:`M${m(_.from)} 0 L${m(_.from)} ${u-12} L${m(_.to)} ${u}`,fill:"none",style:{stroke:bh(_.from),strokeDasharray:p}},`u${b}`)),n.down.map((_,b)=>s.jsx("path",{d:`M${m(_.from)} ${u} L${m(_.to)} ${u+12} L${m(_.to)} ${Nd}`,fill:"none",style:{stroke:bh(_.to),strokeDasharray:p}},`d${b}`)),i&&s.jsx("circle",{className:"gitgraph__head",cx:m(n.col),cy:u,r:n.commit.parents.length>1?7.4:6.6}),s.jsx("circle",{className:"gitgraph__dot",cx:m(n.col),cy:u,r:n.commit.parents.length>1?4.6:3.6,style:{stroke:g,fill:r?void 0:g}})]})}function bh(n){return`var(--lane-${n%Vg})`}function bC({detail:n,local:l,onCheckout:i,onClose:r}){const o=n.hash==="";return s.jsxs(zn,{className:"modal--wide",title:o?"Незакоммиченные изменения":`Коммит ${n.shortHash}`,onClose:r,actions:s.jsxs(s.Fragment,{children:[!o&&s.jsx("button",{className:"btn",onClick:()=>i(n.hash,`коммит ${n.shortHash} (HEAD отделится от ветки)`),children:"Переключиться сюда"}),s.jsx("button",{className:"btn btn--primary",onClick:r,children:"Закрыть"})]}),children:[!o&&s.jsxs("div",{className:"commit__head",children:[s.jsxs("div",{className:"commit__line",children:[s.jsx("p",{className:"commit__subject",children:n.subject}),s.jsx(tr,{text:n.subject,hint:"сообщение коммита"})]}),s.jsxs("p",{className:"commit__meta",children:[n.author,n.email&&` <${n.email}>`," · ",MC(n.date)]}),s.jsxs("div",{className:"commit__line commit__line--hash",children:[s.jsx("span",{className:"commit__hash",children:n.hash}),s.jsx(tr,{text:n.hash,hint:"хеш коммита"})]}),l&&s.jsx("p",{className:"commit__meta commit__meta--local",children:"Не отправлен: этого коммита нет ни в одной удалённой ветке."}),n.parents.length>0&&s.jsxs("p",{className:"commit__meta",children:[n.parents.length>1?"слияние: ":"родитель: ",n.parents.map(u=>u.slice(0,8)).join(", ")]}),n.body&&s.jsx("pre",{className:"commit__body",children:n.body})]}),n.truncated&&s.jsx("p",{className:"modal__text",children:"Изменения слишком велики — часть патча не показана."}),n.files.length===0?s.jsx("p",{className:"modal__text",children:"Изменений нет."}):n.files.map(u=>s.jsx(yC,{file:u,defaultOpen:n.files.length<=3},u.path+u.oldPath))]})}function yC({file:n,defaultOpen:l}){const[i,r]=x.useState(l);return s.jsxs("div",{className:"commit__file",children:[s.jsxs("button",{className:"commit__filehead",onClick:()=>r(o=>!o),children:[s.jsx("span",{className:"commit__filepath",children:n.path||n.oldPath}),s.jsxs("span",{className:"diff__stat",children:[n.added>0&&s.jsxs("span",{className:"diff__stat--add",children:["+",n.added]}),n.removed>0&&s.jsxs("span",{className:"diff__stat--del",children:["−",n.removed]})]}),s.jsx("span",{className:"tool__status",children:i?"▴":"▾"})]}),i&&s.jsx(qg,{diff:Q0(n)})]})}function vC(){return s.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[s.jsx("circle",{cx:"4.5",cy:"3.5",r:"1.9"}),s.jsx("circle",{cx:"4.5",cy:"12.5",r:"1.9"}),s.jsx("circle",{cx:"11.5",cy:"8",r:"1.9"}),s.jsx("path",{d:"M4.5 5.4v5.2M6.4 3.9h2.2a1.6 1.6 0 0 1 1.6 1.6v.8"})]})}function jC(){return s.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:s.jsx("path",{d:"M8 13V3M4.5 6.5 8 3l3.5 3.5"})})}function NC(){return s.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:s.jsx("path",{d:"M8 3v10M4.5 9.5 8 13l3.5-3.5"})})}function kC(){return s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("circle",{cx:"7",cy:"7",r:"4"}),s.jsx("path",{d:"m13 13-2.6-2.6"})]})}function my(){return s.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:s.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8Z"})})}function wC(){return s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[s.jsx("path",{d:"M14 8a6 6 0 1 1-6-6c1.68 0 3.29.67 4.49 1.83L14 5.33"}),s.jsx("path",{d:"M14 2v3.33h-3.33"})]})}function SC(n){return n.replace(/^HEAD -> /,"").replace(/^tag: /,"⌂ ").trim()}function EC(n){const l=n.replace(/^HEAD -> /,"").replace(/^tag: /,"").trim();return l==="HEAD"?"":l}function CC(n){const l=n.split("/");return l[l.length-1]??n}function TC(n){const l=n%100;if(l>=11&&l<=14)return"файлов";switch(n%10){case 1:return"файл";case 2:case 3:case 4:return"файла";default:return"файлов"}}function AC(n){const l=Date.parse(n);if(Number.isNaN(l))return n;const i=Math.round((Date.now()-l)/6e4);if(i<1)return"только что";if(i<60)return`${i} мин назад`;const r=Math.round(i/60);if(r<24)return`${r} ч назад`;const o=Math.round(r/24);return o<30?`${o} дн назад`:new Date(l).toLocaleDateString()}function MC(n){const l=Date.parse(n);return Number.isNaN(l)?n:new Date(l).toLocaleString()}function py(n){return n.replace(/[^A-Za-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"")}function RC({status:n,owners:l,files:i,defaultName:r,hasCommits:o,busy:u,result:m,onRefreshStatus:p,onSaveToken:g,onPublish:_,onDismissResult:b,onClose:j}){var J;const[v,k]=x.useState(()=>py(r)),[N,E]=x.useState(""),[C,I]=x.useState(""),[D,G]=x.useState(!0),[P,V]=x.useState("Первый коммит"),[z,H]=x.useState(null),[te,F]=x.useState("");x.useEffect(()=>{!N&&l.length>0&&E(l[0].login)},[N,l]),x.useEffect(()=>{i&&z===null&&H(new Set(i.files))},[i,z]);const fe=(n==null?void 0:n.connected)===!0,Q=l.map(le=>({value:le.login,label:le.login,hint:le.kind==="org"?"организация":void 0})),X=x.useMemo(()=>{if(!i)return[];const le=te.trim().toLowerCase();return le?i.files.filter(ce=>ce.toLowerCase().includes(le)):i.files},[i,te]),ge=(z==null?void 0:z.size)??0,U=fe&&v.trim()!==""&&N!==""&&u===""&&(o||ge>0);function L(le){H(ce=>{const A=new Set(ce??[]);return A.has(le)?A.delete(le):A.add(le),A})}function M(le){H(ce=>{const A=new Set(ce??[]);for(const W of X)le?A.add(W):A.delete(W);return A})}function O(){if(!U)return;const le=(i==null?void 0:i.files)??[];_({owner:N,name:v.trim(),description:C.trim(),private:D,include:o?[]:le.filter(ce=>z==null?void 0:z.has(ce)),ignore:o?[]:le.filter(ce=>!(z!=null&&z.has(ce))),message:o?"":P.trim()||"Первый коммит"})}return s.jsxs(zn,{className:"modal--wide",title:"Опубликовать на GitHub",onClose:j,actions:s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"btn",onClick:j,children:"Отмена"}),s.jsx("button",{type:"button",className:"btn btn--primary",disabled:!U,onClick:O,children:u||"Опубликовать"})]}),children:[s.jsx(DC,{status:n,onRefreshStatus:p,onSaveToken:g}),s.jsxs("div",{className:"publish__section",children:[s.jsx("h3",{className:"publish__heading",children:"Репозиторий"}),s.jsxs("label",{className:"field publish__field",children:[s.jsx("span",{children:"Имя"}),s.jsx("input",{className:"input input--mono",value:v,spellCheck:!1,autoComplete:"off",onChange:le=>k(py(le.target.value))})]}),v.trim()===""&&s.jsx("p",{className:"modal__error",children:"Имя репозитория не может быть пустым."}),s.jsxs("label",{className:"field publish__field",children:[s.jsx("span",{children:"Владелец"}),l.length>1?s.jsx(rl,{className:"settings__select",value:N,options:Q,onChange:E,placeholder:"выберите владельца",ariaLabel:"Владелец репозитория"}):s.jsx("p",{className:"publish__static",children:((J=l[0])==null?void 0:J.login)??"—"})]}),s.jsxs("label",{className:"field publish__field",children:[s.jsx("span",{children:"Описание (необязательно)"}),s.jsx("input",{className:"input",value:C,placeholder:"о чём проект — одной строкой",onChange:le=>I(le.target.value)})]}),s.jsxs("div",{className:"field publish__field",children:[s.jsx("span",{children:"Видимость"}),s.jsxs("div",{className:"access",role:"radiogroup","aria-label":"Видимость репозитория",children:[s.jsx(gy,{title:"Приватный",desc:"Виден только вам и тем, кого вы пригласите. Стоит по умолчанию: репозиторий с чужим кодом, случайно ставший публичным, потом не отозвать.",on:D,onClick:()=>G(!0)}),s.jsx(gy,{title:"Публичный",desc:"Виден всем в интернете — код, история коммитов, всё содержимое.",risky:!0,on:!D,onClick:()=>G(!1)})]})]})]}),!o&&s.jsxs("div",{className:"publish__section",children:[s.jsx("h3",{className:"publish__heading",children:"Файлы первого коммита"}),i===null?s.jsx("p",{className:"modal__text",children:"Читаем файлы…"}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"publish__filehead",children:[s.jsxs("span",{className:"publish__filecount",children:[ge," из ",i.files.length," файлов"]}),s.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>M(!0),children:"Отметить все"}),s.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>M(!1),children:"Снять все"})]}),i.files.length>8&&s.jsx("input",{className:"input publish__filter",value:te,placeholder:"Фильтр по пути…",spellCheck:!1,onChange:le=>F(le.target.value)}),s.jsx("div",{className:"publish__filelist",children:X.length===0?s.jsx("p",{className:"modal__text publish__filesempty",children:"Ничего не найдено по фильтру."}):X.map(le=>s.jsxs("button",{type:"button",role:"checkbox","aria-checked":(z==null?void 0:z.has(le))===!0,className:"publish__file",onClick:()=>L(le),children:[s.jsx("span",{className:"publish__box"+(z!=null&&z.has(le)?" is-on":""),"aria-hidden":"true",children:(z==null?void 0:z.has(le))&&"✓"}),s.jsx("span",{className:"publish__filepath",children:le})]},le))}),i.truncated&&s.jsx("p",{className:"publish__truncated",children:"Каталог больше, чем показано здесь, — часть файлов в список не попала. Их всё равно можно закоммитить потом обычным образом."}),s.jsxs("label",{className:"field publish__field",children:[s.jsx("span",{children:"Сообщение коммита"}),s.jsx("input",{className:"input",value:P,onChange:le=>V(le.target.value)})]})]})]}),s.jsx(ec,{result:m,onDismiss:b})]})}function gy({title:n,desc:l,on:i,risky:r,onClick:o}){return s.jsxs("button",{type:"button",role:"radio","aria-checked":i,className:"access__card"+(i?" is-on":"")+(r?" access__card--risky":""),onClick:o,children:[s.jsx("span",{className:"access__radio","aria-hidden":"true"}),s.jsxs("span",{className:"access__body",children:[s.jsxs("span",{className:"access__title",children:[n,r&&s.jsx("span",{className:"access__risk",children:"видно всем"})]}),s.jsx("span",{className:"access__desc",children:l})]})]})}function DC({status:n,onRefreshStatus:l,onSaveToken:i}){const[r,o]=x.useState(""),[u,m]=x.useState(!1);return s.jsxs("div",{className:"publish__section publish__section--first",children:[s.jsx("h3",{className:"publish__heading",children:"Учётная запись GitHub"}),n===null?s.jsx("p",{className:"modal__text",children:"Проверяем подключение…"}):n.connected?s.jsxs("div",{className:"publish__account",children:[s.jsx("span",{className:"chip chip--ok",children:n.login}),s.jsx("span",{className:"publish__accountvia",children:n.source==="gh"?"через GitHub CLI":"по личному токену"}),n.source==="token"&&s.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>i(""),children:"Отключить токен"})]}):s.jsxs("div",{className:"publish__connect",children:[n.ghInstalled&&s.jsxs("p",{className:"modal__text",children:["В системе установлен ",s.jsx("code",{children:"gh"}),", но вход в нём не выполнен. Можно вместо токена выполнить ",s.jsx("code",{children:"gh auth login"})," в панели терминала и нажать «Проверить снова» — либо ввести личный токен ниже."]}),s.jsxs("label",{className:"field publish__field",children:[s.jsx("span",{children:"Личный токен GitHub"}),s.jsx(LC,{value:r,onChange:o,visible:u,onToggleVisible:()=>m(p=>!p),placeholder:"ghp_…"})]}),s.jsxs("p",{className:"publish__tokenhint",children:["Нужен токен с доступом ",s.jsx("code",{children:"repo"})," — им приложение создаст репозиторий и отправит в него код."," ",s.jsx("a",{href:"https://github.com/settings/tokens/new?scopes=repo&description=Claude%20Code%20Visual",target:"_blank",rel:"noreferrer",children:"Создать токен на GitHub ↗"})]}),n.message&&s.jsx("p",{className:"modal__error",children:n.message}),s.jsxs("div",{className:"extbar",children:[s.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:l,children:"Проверить снова"}),s.jsx("button",{type:"button",className:"btn btn--sm btn--primary",disabled:r.trim()==="",onClick:()=>i(r.trim()),children:"Сохранить токен"})]})]})]})}function LC({value:n,onChange:l,visible:i,onToggleVisible:r,placeholder:o,autoFocus:u}){return s.jsxs("div",{className:"pwfield",children:[s.jsx("input",{className:"input input--mono pwfield__input",type:i?"text":"password",value:n,placeholder:o,spellCheck:!1,autoComplete:"off",autoFocus:u,onChange:m=>l(m.target.value)}),s.jsx("button",{type:"button",className:"pwfield__toggle","aria-label":i?"Скрыть токен":"Показать токен","aria-pressed":i,onClick:r,children:i?s.jsx(zC,{}):s.jsx(OC,{})})]})}function OC(){return s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("path",{d:"M1 8s2.5-5 7-5 7 5 7 5-2.5 5-7 5-7-5-7-5Z"}),s.jsx("circle",{cx:"8",cy:"8",r:"2.1"})]})}function zC(){return s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("path",{d:"M1 8s2.5-5 7-5 7 5 7 5-2.5 5-7 5-7-5-7-5Z"}),s.jsx("circle",{cx:"8",cy:"8",r:"2.1"}),s.jsx("path",{d:"M2 14 14 2"})]})}function IC({busy:n,result:l,onSubmit:i,onDismissResult:r,onClose:o}){const[u,m]=x.useState(""),p=/^(https?|ssh|git):\/\/\S+/i.test(u.trim())||/^[\w.-]+@[\w.-]+:.+/.test(u.trim());return s.jsxs(zn,{title:"Подключить существующий репозиторий",onClose:o,actions:s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"btn",onClick:o,children:"Отмена"}),s.jsx("button",{type:"button",className:"btn btn--primary",disabled:!p||n!=="",onClick:()=>i(u.trim()),children:n||"Подключить"})]}),children:[s.jsxs("p",{className:"modal__text",children:["Пропишет этот адрес как ",s.jsx("code",{children:"origin"})," текущего репозитория. Ничего не отправляется само — после этого в панели появятся обычные «Отправить» и «Забрать»."]}),s.jsxs("label",{className:"field",children:[s.jsx("span",{children:"Адрес репозитория"}),s.jsx("input",{className:"input input--mono",value:u,placeholder:"https://github.com/owner/name.git",spellCheck:!1,autoComplete:"off",autoFocus:!0,onChange:g=>m(g.target.value),onKeyDown:g=>{g.key==="Enter"&&p&&n===""&&i(u.trim())}})]}),s.jsxs("p",{className:"modal__text modal__text--dim",children:["Подходят адреса вида ",s.jsx("code",{children:"https://…"}),", ",s.jsx("code",{children:"ssh://…"}),", ",s.jsx("code",{children:"git://…"})," и"," ",s.jsx("code",{children:"git@host:path"}),"."]}),s.jsx(ec,{result:l,onDismiss:r})]})}function UC({open:n,items:l,busy:i,ready:r,sendBlocked:o,commands:u,contextResult:m,draftKey:p,models:g,model:_,effort:b,ultracode:j,thinking:v,switchOnFlag:k,onContextSearch:N,onCommand:E,onModel:C,onEffort:I,onUltracode:D,onThinking:G,onSwitchOnFlag:P,onAsk:V,onInterrupt:z,onReset:H,onClose:te,zoomed:F,onToggleZoom:fe}){return s.jsxs("aside",{className:(n?"sidepane sidepane--ask sidepane--open":"sidepane sidepane--ask")+(F?" sidepane--zoomed":""),"aria-label":"Вопрос на полях",children:[s.jsxs("div",{className:"sidepane__head",onDoubleClick:Q=>{fe&&(Q.target.closest("button")||fe())},children:[s.jsx($C,{}),s.jsx("span",{className:"sidepane__title",children:"Вопрос на полях"}),s.jsx("button",{className:"sidepane__btn",title:"Начать заново — следующий вопрос возьмёт свежий контекст","aria-label":"Начать боковой разговор заново",disabled:l.length===0,onClick:H,children:"↻"}),fe&&s.jsx("button",{className:"sidepane__btn",title:F?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":F?"Свернуть панель вопроса":"Развернуть панель вопроса на весь экран","aria-pressed":F,onClick:fe,children:s.jsx(_u,{active:F})}),s.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель вопроса",onClick:te,children:"✕"})]}),g.length>0&&s.jsxs("div",{className:"sidepane__tools",children:[s.jsx(uv,{className:"select--compact",models:g,value:_,effort:b,ultracode:j,thinking:v,switchOnFlag:k,onModel:C,onEffort:I,onUltracode:D,onThinking:G,onSwitchOnFlag:P}),s.jsx("span",{className:"sidepane__note",title:"Боковой вопрос работает только на чтение",children:"только чтение"})]}),s.jsx(Gg,{items:l,busy:i,waiting:!1,empty:r?"Спросите о том, что происходит: вопрос уйдёт в сторону от основного разговора и не попадёт в его контекст. Отвечающий видит сессию и проект, но ничего не меняет.":"Откройте сессию — вопрос задаётся о ней."}),s.jsx(iv,{className:"composer--side",disabled:!r,busy:i,commands:u,sessionTitle:null,contextResult:m,draftKey:p?`side:${p}`:null,placeholder:"Спросить, не мешая работе…",sendLabel:"Спросить",autoFocus:n,sendBlocked:o,onContextSearch:N,onCommand:E,onSend:V,onInterrupt:z,onEscape:i?z:te})]})}function $C(){return s.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("path",{d:"M13.6 9.4a1.6 1.6 0 0 1-1.6 1.6H6.2L3.2 13.4V4.2a1.6 1.6 0 0 1 1.6-1.6h7.2a1.6 1.6 0 0 1 1.6 1.6Z"}),s.jsx("path",{d:"M8.4 8.5v-.3c0-.7.9-.9.9-1.7a1 1 0 0 0-1.9-.4"})]})}const BC=75,HC=90;function Xg({usage:n,variant:l="topbar"}){if(!(n!=null&&n.available))return null;const i=n.buckets??[],r=i.length>0?i.map(u=>({key:u.id,label:u.label,window:u.window})):[...n.fiveHour?[{key:"five",label:"5 ч",window:n.fiveHour}]:[],...n.sevenDay?[{key:"week",label:"нед",window:n.sevenDay}]:[]];if(r.length===0)return null;const o=i.length>0?dv(i):`Расход лимитов плана${n.plan?` ${n.plan}`:""}`;return s.jsx("div",{className:l==="card"?"usage usage--card":"usage",title:YC(n,i),role:"group","aria-label":o,children:r.map(u=>s.jsx(qC,{label:u.label,window:u.window},u.key))})}function qC({label:n,window:l}){const i=Math.round(l.utilization),r=XC(l.resetsAt);return s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"usage__label",children:n}),s.jsx("span",{className:"usage__track",role:"progressbar","aria-label":n,"aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":100,children:s.jsx("span",{className:`usage__fill${GC(i)}`,style:{width:`${i}%`}})}),s.jsxs("span",{className:"usage__pct",children:[i,"%"]}),s.jsx("span",{className:"usage__reset",title:Fg(l.resetsAt)||void 0,children:r&&`↻ ${r}`})]})}function GC(n){return n>=HC?" usage__fill--over":n>=BC?" usage__fill--warn":""}function YC(n,l){if(l.length>0)return VC(l);const i=[n.plan?`Лимиты плана ${n.plan}`:"Лимиты плана"],r=(o,u)=>{if(!u)return;const m=Fg(u.resetsAt);i.push(`${o}: ${Math.round(u.utilization)}%${m?`, ${m}`:""}`)};return r("5 часов",n.fiveHour),r("Неделя",n.sevenDay),r("Неделя, Opus",n.sevenDayOpus),i.join(`
143
+ `)}function dv(n){return n.some(l=>l.id.startsWith("codex:"))?"Лимиты Codex":"Квота Antigravity"}function VC(n){const l=[dv(n)];for(const i of n){const r=Fg(i.window.resetsAt),o=Math.round(i.window.utilization);l.push(`${i.title}: ${o}%${r?`, ${r}`:""}`),i.description&&l.push(i.description)}return l.join(`
144
+ `)}function fv(n){if(!n)return null;const l=new Date(n);return Number.isNaN(l.getTime())?null:l}function hv(n){return n.getTime()-Date.now()<1440*60*1e3}function XC(n){const l=fv(n);return l?hv(l)?l.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):l.toLocaleDateString(void 0,{day:"numeric",month:"short"}):""}function Fg(n){const l=fv(n);return l?`обнулится ${hv(l)?`в ${l.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}`:l.toLocaleDateString(void 0,{day:"numeric",month:"long"})}`:""}function mv(){const[n,l]=x.useState(()=>new Date);return x.useEffect(()=>{let i=0;const r=()=>{const u=new Date;l(u),i=window.setTimeout(r,6e4-(u.getSeconds()*1e3+u.getMilliseconds()))};r();const o=()=>{document.hidden||(window.clearTimeout(i),r())};return document.addEventListener("visibilitychange",o),()=>{window.clearTimeout(i),document.removeEventListener("visibilitychange",o)}},[]),s.jsxs("time",{className:"clock",dateTime:n.toISOString(),title:FC(n),children:[s.jsx("span",{className:"clock__time",children:n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}),s.jsx("span",{className:"clock__date",children:n.toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})})]})}function FC(n){return n.toLocaleDateString(void 0,{weekday:"long",day:"numeric",month:"long",year:"numeric"})}function KC({onClose:n,permission:l,model:i,account:r,usage:o,cwd:u,costLabel:m,onRefresh:p,refreshing:g,metersFetchedAt:_,onRename:b,onHandoff:j,onFreshSession:v,handoffWriting:k,handoffAccount:N,onMemory:E,onStop:C,onExportDownload:I,onExportSave:D}){const G=n0({onLongPress:()=>v==null?void 0:v(),onClick:()=>j==null?void 0:j(),disabled:k});return s.jsx(zn,{title:"Настройки сессии",className:"modal--sheet",sheet:!0,onClose:n,children:s.jsxs("div",{className:"sessionmenu",children:[l&&s.jsx(Vr,{label:"Режим прав",children:l}),s.jsx(Vr,{label:"Модель",children:i}),r&&s.jsx(Vr,{label:"Аккаунт",children:r}),(o==null?void 0:o.available)&&(o.fiveHour||o.sevenDay||o.buckets&&o.buckets.length>0)&&s.jsx(Vr,{label:"Лимиты плана",children:s.jsx(Xg,{usage:o})}),s.jsxs("button",{type:"button",className:g?"sessionmenu__refresh is-busy":"sessionmenu__refresh","aria-busy":g,disabled:g,onClick:p,children:[s.jsx(QC,{}),s.jsxs("span",{className:"sessionmenu__refresh-text",children:["Обновить показания",_&&s.jsxs("span",{className:"sessionmenu__refresh-time",children:["обновлено в"," ",new Date(_).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})]})]})]}),s.jsx(Vr,{label:"Время",children:s.jsx(mv,{})}),m&&s.jsx(Vr,{label:"Стоимость хода",children:s.jsx("span",{className:"badge badge--cost",children:m})}),u&&s.jsx(Vr,{label:"Каталог проекта",children:s.jsx(ov,{path:u})}),E&&s.jsx("button",{type:"button",className:"sessionmenu__rename",onClick:E,children:"Память и инструкции"}),I&&s.jsx(Vr,{label:"Экспорт разговора",children:s.jsxs("div",{className:"sessionmenu__export",children:[s.jsx("button",{type:"button",onClick:()=>{n(),I()},children:"Скачать Markdown"}),s.jsx("button",{type:"button",disabled:!D,onClick:()=>{n(),D==null||D()},children:"Сохранить в проект"})]})}),b&&s.jsx("button",{type:"button",className:"sessionmenu__rename",onClick:b,children:"Переименовать сессию"}),j&&s.jsxs("button",{type:"button",className:k?"sessionmenu__handoff is-busy":G.holding?"sessionmenu__handoff is-holding":"sessionmenu__handoff",style:{"--hold-ms":`${G.thresholdMs}ms`},"aria-busy":k,disabled:k,...G.handlers,children:[s.jsx("span",{className:"sessionmenu__handoff-hold","aria-hidden":"true"}),s.jsxs("span",{className:"sessionmenu__handoff-text",children:[k?"Пишется хэндофф…":"Хэндофф и новая сессия",!k&&s.jsx("span",{className:"sessionmenu__handoff-hint",children:"Зажмите — новая сессия без хэндоффа"})]})]}),j&&N,C&&s.jsx("button",{type:"button",className:"sessionmenu__stop",onClick:C,children:"Остановить сессию"})]})})}function Vr({label:n,children:l}){return s.jsxs("div",{className:"sessionmenu__row",children:[s.jsx("span",{className:"sessionmenu__label",children:n}),l]})}function QC(){return s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("path",{d:"M14 8a6 6 0 1 1-6-6c1.68 0 3.29.67 4.49 1.83L14 5.33"}),s.jsx("path",{d:"M14 2v3.33h-3.33"})]})}const ZC={user:"Для всех проектов аккаунта",project:"Для всех, кто работает над проектом",local:"Только для вас, не для репозитория",memory:"Заметки, которые агент ведёт сам"};function PC(n){return new Date(n).toLocaleString("ru-RU",{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"})}function WC(n){return n<1024?`${n} Б`:`${(n/1024).toFixed(1).replace(".",",")} КБ`}function JC({workspaceId:n,workspaceName:l,accountId:i,stateAccountId:r,files:o,file:u,result:m,send:p,onClose:g}){const _=$d("(max-width: 860px)"),[b,j]=x.useState(null),[v,k]=x.useState(!1),[N,E]=x.useState(""),[C,I]=x.useState(0),[D,G]=x.useState(!1),[P,V]=x.useState(""),[z,H]=x.useState(null),[te,F]=x.useState(!1),[fe,Q]=x.useState(!1),X=x.useRef(!1),ge=x.useRef("");ge.current=N;const U=r??i,L=x.useRef(U);L.current=U,x.useEffect(()=>{p({type:"memory.list",workspaceId:n,accountId:i})},[n,i,p]);const M=(o==null?void 0:o.find(de=>de.id===b))??null;x.useEffect(()=>{if(!o||b||_)return;const de=o.find(ae=>ae.exists)??o[0];de&&O(de,!1)},[o]),x.useEffect(()=>{o&&b&&!o.some(de=>de.id===b)&&(j(null),k(!1),Q(!1))},[o,b]);function O(de,ae=!0){j(de.id),k(!1),V(""),H(null),G(!1),ae&&Q(!0),de.exists&&p({type:"memory.read",workspaceId:n,id:de.id,accountId:L.current})}function J(){M&&(E(M.exists&&(u==null?void 0:u.id)===M.id?u.content:""),I(M.exists&&(u==null?void 0:u.id)===M.id?u.mtime:M.mtime),V(""),H(null),k(!0))}function le(de=C){M&&(G(!0),V(""),p({type:"memory.write",workspaceId:n,id:M.id,content:ge.current,baseMtime:de,accountId:L.current}))}x.useEffect(()=>{!u||u.id!==b||X.current&&(X.current=!1,I(u.mtime),H(null),le(u.mtime))},[u]),x.useEffect(()=>{if(!(!m||m.id!==b)){if(G(!1),m.ok){H(null),F(!1),v&&(k(!1),p({type:"memory.read",workspaceId:n,id:m.id,accountId:L.current}));return}if(m.conflict){H({mtime:m.mtime??null});return}V(m.message??"Не удалось выполнить операцию"),F(!1)}},[m]);function ce(){M&&(H(null),k(!1),p({type:"memory.read",workspaceId:n,id:M.id,accountId:L.current}))}function A(){if(M){if((z==null?void 0:z.mtime)!=null){I(z.mtime),H(null),le(z.mtime);return}X.current=!0,p({type:"memory.read",workspaceId:n,id:M.id,accountId:L.current})}}const W=x.useMemo(()=>{const de=o??[],ae=de.filter(Se=>Se.scope!=="memory"),qe=de.filter(Se=>Se.scope==="memory").sort((Se,Ge)=>{const Ve=Se.label==="MEMORY.md"?0:1,Je=Ge.label==="MEMORY.md"?0:1;return Ve-Je||Se.label.localeCompare(Ge.label,"ru")});return{instructions:ae,memory:qe}},[o]),me=M&&(u==null?void 0:u.id)===M.id?u:null,Ee=s.jsxs("nav",{className:"memory__list","aria-label":"Файлы памяти и инструкций",children:[!o&&s.jsx("p",{className:"memory__empty",children:"Загрузка…"}),o&&s.jsxs(s.Fragment,{children:[s.jsx(xy,{title:"Инструкции",files:W.instructions,selectedId:b,onSelect:O}),s.jsx(xy,{title:"Автопамять проекта",files:W.memory,selectedId:b,onSelect:O,empty:"Агент пока ничего не записал в память этого проекта."})]})]}),$=s.jsxs("section",{className:"memory__detail",children:[!M&&s.jsx("p",{className:"memory__empty",children:"Выберите файл слева."}),M&&s.jsxs(s.Fragment,{children:[s.jsxs("header",{className:"memory__head",children:[_&&s.jsx("button",{type:"button",className:"memory__back",onClick:()=>Q(!1),"aria-label":"К списку файлов",children:"‹"}),s.jsxs("div",{className:"memory__headtext",children:[s.jsx("h3",{className:"memory__name",children:M.label}),s.jsx("div",{className:"memory__path",title:M.path,children:M.path})]}),!v&&s.jsxs("div",{className:"memory__tools",children:[M.exists?s.jsx("button",{type:"button",className:"btn",onClick:J,disabled:!me,children:"Изменить"}):s.jsx("button",{type:"button",className:"btn btn--primary",onClick:J,children:"Создать"}),M.deletable&&M.exists&&s.jsx("button",{type:"button",className:"btn btn--danger-ghost",onClick:()=>F(!0),children:"Удалить"})]})]}),z&&s.jsxs("div",{className:"memory__banner",role:"alert",children:[s.jsx("span",{children:"Файл изменили, пока вы его правили."}),s.jsxs("span",{className:"memory__banner-actions",children:[s.jsx("button",{type:"button",className:"btn",onClick:ce,children:"Загрузить заново"}),s.jsx("button",{type:"button",className:"btn btn--warn",onClick:A,children:"Перезаписать"})]})]}),P&&s.jsx("p",{className:"modal__error",role:"alert",children:P}),v?s.jsxs(s.Fragment,{children:[s.jsx("textarea",{className:"input input--mono memory__editor",value:N,spellCheck:!1,autoFocus:!0,"aria-label":`Содержимое ${M.label}`,placeholder:M.exists?"":"Файл пока пуст. Напишите инструкции в Markdown.",onChange:de=>E(de.target.value),onKeyDown:de=>{(de.ctrlKey||de.metaKey)&&de.key==="s"&&(de.preventDefault(),D||le())}}),s.jsxs("div",{className:"memory__editactions",children:[s.jsx("button",{type:"button",className:"btn",disabled:D,onClick:()=>{k(!1),H(null),V("")},children:"Отмена"}),s.jsx("button",{type:"button",className:"btn btn--primary",disabled:D,onClick:()=>le(),children:D?"Сохраняю…":M.exists?"Сохранить":"Создать файл"})]})]}):M.exists?me?s.jsxs(s.Fragment,{children:[s.jsx(eT,{text:me.content}),s.jsxs("footer",{className:"memory__meta",children:[WC(M.size)," · изменён ",PC(M.mtime)]})]}):s.jsx("p",{className:"memory__empty",children:"Загрузка…"}):s.jsxs("div",{className:"memory__missing",children:[s.jsxs("p",{children:[ZC[M.scope],"."]}),s.jsx("p",{children:"Файла пока нет. Создайте его, чтобы агент подхватил инструкции в следующей сессии."})]})]})]});return s.jsxs(zn,{title:"Память и инструкции",className:"modal--memory",onClose:g,children:[s.jsxs("p",{className:"memory__lead",children:["Проект «",l,"». Агент читает эти файлы в начале каждой сессии."]}),s.jsxs("div",{className:"memory"+(_?fe?" memory--detail":" memory--list":""),children:[(!_||!fe)&&Ee,(!_||fe)&&$]}),te&&M&&s.jsx(zn,{title:"Удалить файл памяти?",onClose:()=>F(!1),actions:s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"btn",onClick:()=>F(!1),children:"Отмена"}),s.jsx("button",{type:"button",className:"btn btn--warn",onClick:()=>{p({type:"memory.delete",workspaceId:n,id:M.id,accountId:L.current}),F(!1)},children:"Удалить"})]}),children:s.jsxs("p",{className:"modal__text",children:[M.label," будет удалён с диска. Агент больше не увидит эту запись."]})})]})}function xy({title:n,files:l,selectedId:i,onSelect:r,empty:o}){return s.jsxs("div",{className:"memory__group",children:[s.jsx("h3",{className:"memory__grouptitle",children:n}),l.length===0&&o&&s.jsx("p",{className:"memory__empty memory__empty--inline",children:o}),l.map(u=>s.jsxs("button",{type:"button",className:"memory__item"+(u.id===i?" is-active":"")+(u.exists?"":" is-missing"),"aria-current":u.id===i,onClick:()=>r(u),children:[s.jsxs("span",{className:"memory__itemrow",children:[s.jsx("span",{className:"memory__itemlabel",children:u.label}),!u.exists&&s.jsx("span",{className:"memory__badge",children:"не создан"})]}),s.jsx("span",{className:"memory__itempath",title:u.path,children:u.path})]},u.id))]})}function eT({text:n}){const[l,i]=x.useState("");return x.useEffect(()=>{let r=!1;return Hd(n).then(o=>{r||i(o)}),()=>{r=!0}},[n]),n.trim()?s.jsx("div",{className:"markdown-preview memory__body",dangerouslySetInnerHTML:{__html:l}}):s.jsx("p",{className:"memory__empty",children:"Файл пуст."})}const pv=[{day:1,label:"пн",full:"понедельник"},{day:2,label:"вт",full:"вторник"},{day:3,label:"ср",full:"среда"},{day:4,label:"чт",full:"четверг"},{day:5,label:"пт",full:"пятница"},{day:6,label:"сб",full:"суббота"},{day:0,label:"вс",full:"воскресенье"}],gv=[1,2,3,4,5],Xc=15,tT={default:"По умолчанию (спрашивать)",acceptEdits:"Принимать правки",plan:"Только план",auto:"auto",bypassPermissions:"Без подтверждений"},nT=Ng.map(n=>({value:n.value,label:tT[n.value]??n.value,hint:n.hint})),sT={day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"};function gg(n){return new Date(n).toLocaleString("ru-RU",sT).replace(" г.","")}function lT(n){if(n.kind==="once")return`Один раз ${gg(n.at)}`;if(n.kind==="interval"){const r=n.minutes;return r===60?"Каждый час":r%60===0?`Каждые ${r/60} ч`:`Каждые ${r} мин`}const l=new Set(n.days);let i="";return l.size===7?i="":gv.every(r=>l.has(r))&&l.size===5?i=", пн–пт":l.size===2&&l.has(0)&&l.has(6)?i=", сб–вс":i=", "+pv.filter(r=>l.has(r.day)).map(r=>r.label).join(", "),`Каждый день в ${n.time}${i}`}function xv(n){const l=new Date(n),i=r=>String(r).padStart(2,"0");return`${l.getFullYear()}-${i(l.getMonth()+1)}-${i(l.getDate())}T${i(l.getHours())}:${i(l.getMinutes())}`}function _v(n){const l=new Date(Date.now()+36e5);return l.setMinutes(0,0,0),{name:"",workspaceId:n,prompt:"",kind:"daily",at:xv(l.getTime()),time:"09:00",days:gv,minutes:60,permissionMode:"default",model:"",enabled:!0}}function aT(n){const l=_v(n.workspaceId);return{...l,id:n.id,name:n.name,prompt:n.prompt,kind:n.schedule.kind,at:n.schedule.kind==="once"?xv(n.schedule.at):l.at,time:n.schedule.kind==="daily"?n.schedule.time:l.time,days:n.schedule.kind==="daily"?n.schedule.days:l.days,minutes:n.schedule.kind==="interval"?n.schedule.minutes:l.minutes,permissionMode:n.permissionMode??"default",model:n.model??"",accountId:n.accountId,enabled:n.enabled}}function iT(n,l){return{id:n.id,name:n.name,workspaceId:n.workspaceId,prompt:n.prompt,schedule:n.schedule,enabled:l,permissionMode:n.permissionMode,model:n.model,accountId:n.accountId}}function rT(n){const l={};return n.name.trim()||(l.name="Назовите задачу"),n.workspaceId||(l.workspaceId="Выберите проект"),n.prompt.trim()||(l.prompt="Напишите, что должен сделать агент"),n.kind==="daily"&&n.days.length===0&&(l.days="Выберите хотя бы один день"),n.kind==="daily"&&!/^\d{2}:\d{2}$/.test(n.time)&&(l.time="Укажите время"),n.kind==="interval"&&!(n.minutes>=Xc)&&(l.minutes=`Не меньше ${Xc} минут`),n.kind==="once"&&!Number.isFinite(new Date(n.at).getTime())&&(l.at="Укажите дату и время"),l}function cT(n){const l=n.kind==="once"?{kind:"once",at:new Date(n.at).getTime()}:n.kind==="daily"?{kind:"daily",time:n.time,days:[...n.days].sort()}:{kind:"interval",minutes:Math.max(Xc,Math.round(n.minutes))};return{...n.id?{id:n.id}:{},name:n.name.trim(),workspaceId:n.workspaceId,prompt:n.prompt.trim(),schedule:l,enabled:n.enabled,permissionMode:n.permissionMode,...n.model.trim()?{model:n.model.trim()}:{},...n.accountId?{accountId:n.accountId}:{}}}function oT({tasks:n,workspaces:l,activeWorkspaceId:i,send:r,onOpenSession:o,error:u,onClearError:m,onClose:p}){const[g,_]=x.useState(null),[b,j]=x.useState(null),[v,k]=x.useState(!1);x.useEffect(()=>{v&&(k(!1),_(null))},[n]),x.useEffect(()=>{u&&k(!1)},[u]),x.useEffect(()=>{r({type:"schedule.list"})},[r]);const N=I=>{var D;return((D=l.find(G=>G.id===I))==null?void 0:D.name)??"проект закрыт"};if(g)return s.jsx(uT,{draft:g,workspaces:l,saving:v,error:u,onEdit:m,onBack:()=>{m(),_(null)},onSave:I=>{m(),k(!0),r({type:"schedule.save",task:cT(I)})},onClose:p});const E=I=>{m(),r(I)},C=()=>{var I;return _(_v(i??((I=l[0])==null?void 0:I.id)??""))};return s.jsxs(zn,{title:"Запланированные задачи",className:"modal--tasks",onClose:p,actions:s.jsx("button",{type:"button",className:"btn btn--primary",onClick:C,disabled:l.length===0,children:"Новая задача"}),children:[u&&s.jsx("p",{className:"stasks__error",role:"alert",children:u}),n&&n.length===0&&s.jsxs("div",{className:"stasks__empty",children:[s.jsx("h3",{children:"Регулярная работа без вашего участия"}),s.jsx("p",{children:"Задача по расписанию запускает в проекте новую сессию с вашим промптом: отчёт каждое утро, проверку зависимостей, ночной прогон тестов."}),s.jsx("p",{className:"stasks__hint",children:"Задачи срабатывают только пока запущен ccv. Пропущенные запуски не догоняются."})]}),!n&&s.jsx("p",{className:"modal__text",children:"Загрузка…"}),n&&n.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("ul",{className:"stasks",children:n.map(I=>s.jsxs("li",{className:"stask"+(I.enabled?"":" is-off"),children:[s.jsxs("div",{className:"stask__main",children:[s.jsxs("div",{className:"stask__top",children:[s.jsx("span",{className:"stask__name",children:I.name}),s.jsx("button",{type:"button",role:"switch","aria-checked":I.enabled,"aria-label":I.enabled?`Выключить «${I.name}»`:`Включить «${I.name}»`,className:I.enabled?"switch is-on":"switch",onClick:()=>E({type:"schedule.save",task:iT(I,!I.enabled)}),children:s.jsx("span",{className:"switch__knob"})})]}),s.jsxs("div",{className:"stask__sub",children:[N(I.workspaceId)," · ",lT(I.schedule)]}),s.jsxs("dl",{className:"stask__facts",children:[s.jsxs("div",{children:[s.jsx("dt",{children:"Следующий запуск"}),s.jsx("dd",{children:I.enabled&&I.nextRunAt?gg(I.nextRunAt):"не запланирован"})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Последний"}),s.jsx("dd",{children:I.lastRunAt?gg(I.lastRunAt):"ещё не было"})]})]}),I.lastError&&s.jsxs("p",{className:"stask__error",role:"status",children:["Последний запуск не удался: ",I.lastError]})]}),s.jsxs("div",{className:"stask__actions",children:[s.jsx("button",{type:"button",className:"btn",onClick:()=>E({type:"schedule.run",id:I.id}),children:"Запустить сейчас"}),I.lastSessionId&&s.jsx("button",{type:"button",className:"btn",onClick:()=>o(I),children:"Открыть сессию"}),s.jsx("button",{type:"button",className:"btn btn--ghost",onClick:()=>_(aT(I)),children:"Изменить"}),s.jsx("button",{type:"button",className:"btn btn--danger-ghost",onClick:()=>j(I),children:"Удалить"})]})]},I.id))}),s.jsx("p",{className:"stasks__hint",children:"Задачи срабатывают только пока запущен ccv."})]}),b&&s.jsx(zn,{title:"Удалить задачу?",onClose:()=>j(null),actions:s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"btn",onClick:()=>j(null),children:"Отмена"}),s.jsx("button",{type:"button",className:"btn btn--warn",onClick:()=>{E({type:"schedule.delete",id:b.id}),j(null)},children:"Удалить"})]}),children:s.jsxs("p",{className:"modal__text",children:["Задача «",b.name,"» больше не будет запускаться. Сессии прошлых запусков останутся."]})})]})}function uT({draft:n,workspaces:l,saving:i,error:r,onEdit:o,onBack:u,onSave:m,onClose:p}){const[g,_]=x.useState(n),[b,j]=x.useState(!1),v=rT(g),k=D=>{r&&o(),_(G=>({...G,...D}))},N=D=>b?v[D]:void 0,E=l.map(D=>({value:D.id,label:D.name,hint:D.path}));function C(){i||(j(!0),Object.keys(v).length===0&&m(g))}function I(D){k({days:g.days.includes(D)?g.days.filter(G=>G!==D):[...g.days,D]})}return s.jsx(zn,{title:g.id?"Изменить задачу":"Новая задача",className:"modal--tasks",onClose:p,actions:s.jsxs(s.Fragment,{children:[r&&s.jsx("p",{className:"tform__error tform__error--host",role:"alert",children:r}),s.jsx("button",{type:"button",className:"btn",onClick:u,disabled:i,children:"Отмена"}),s.jsx("button",{type:"button",className:"btn btn--primary",onClick:C,disabled:i,children:i?"Сохраняем…":g.id?"Сохранить":"Создать задачу"})]}),children:s.jsxs("form",{className:"tform",onSubmit:D=>{D.preventDefault(),C()},children:[s.jsxs("div",{className:"tform__row",children:[s.jsx("label",{className:"field",htmlFor:"task-name",children:"Название"}),s.jsx("input",{id:"task-name",className:"input",value:g.name,placeholder:"Например, утренний отчёт",onChange:D=>k({name:D.target.value}),"aria-invalid":!!N("name")}),N("name")&&s.jsx("p",{className:"tform__error",children:N("name")})]}),s.jsxs("div",{className:"tform__row",children:[s.jsx("span",{className:"field",children:"Проект"}),s.jsx(rl,{value:g.workspaceId,options:E,ariaLabel:"Проект",placeholder:"Выберите проект",onChange:D=>k({workspaceId:D})}),N("workspaceId")&&s.jsx("p",{className:"tform__error",children:N("workspaceId")})]}),s.jsxs("div",{className:"tform__row",children:[s.jsx("label",{className:"field",htmlFor:"task-prompt",children:"Что должен сделать агент"}),s.jsx("textarea",{id:"task-prompt",className:"input tform__prompt",rows:5,value:g.prompt,placeholder:"Соберите коммиты за вчера и напишите короткий отчёт",onChange:D=>k({prompt:D.target.value}),"aria-invalid":!!N("prompt")}),N("prompt")&&s.jsx("p",{className:"tform__error",children:N("prompt")})]}),s.jsxs("div",{className:"tform__row",children:[s.jsx("span",{className:"field",children:"Расписание"}),s.jsx("div",{className:"segmented",role:"radiogroup","aria-label":"Вид расписания",children:[["once","Один раз"],["daily","Каждый день"],["interval","Каждые N минут"]].map(([D,G])=>s.jsx("button",{type:"button",role:"radio","aria-checked":g.kind===D,className:g.kind===D?"segmented__opt is-on":"segmented__opt",onClick:()=>k({kind:D}),children:G},D))}),g.kind==="once"&&s.jsxs("div",{className:"tform__sched",children:[s.jsx("input",{type:"datetime-local",className:"input tform__when","aria-label":"Дата и время запуска",value:g.at,onChange:D=>k({at:D.target.value})}),N("at")&&s.jsx("p",{className:"tform__error",children:N("at")})]}),g.kind==="daily"&&s.jsxs("div",{className:"tform__sched",children:[s.jsx("input",{type:"time",className:"input tform__time","aria-label":"Время запуска",value:g.time,onChange:D=>k({time:D.target.value})}),s.jsx("div",{className:"chips",role:"group","aria-label":"Дни недели",children:pv.map(D=>s.jsx("button",{type:"button",className:g.days.includes(D.day)?"chip-toggle is-on":"chip-toggle","aria-pressed":g.days.includes(D.day),title:D.full,onClick:()=>I(D.day),children:D.label},D.day))}),(N("days")||N("time"))&&s.jsx("p",{className:"tform__error",children:N("days")??N("time")})]}),g.kind==="interval"&&s.jsxs("div",{className:"tform__sched",children:[s.jsxs("div",{className:"stepper",children:[s.jsx("button",{type:"button",className:"stepper__btn","aria-label":"Меньше",disabled:g.minutes<=Xc,onClick:()=>k({minutes:Math.max(Xc,g.minutes-(g.minutes>60?30:15))}),children:"−"}),s.jsx("input",{type:"number",className:"input stepper__input","aria-label":"Интервал в минутах",min:Xc,value:Number.isFinite(g.minutes)?g.minutes:"",onChange:D=>k({minutes:D.target.value===""?NaN:Number(D.target.value)})}),s.jsx("span",{className:"stepper__unit",children:"мин"}),s.jsx("button",{type:"button",className:"stepper__btn","aria-label":"Больше",onClick:()=>k({minutes:(g.minutes||0)+(g.minutes>=60?30:15)}),children:"+"})]}),s.jsxs("p",{className:"tform__hint",children:["Не чаще, чем раз в ",Xc," минут."]}),N("minutes")&&s.jsx("p",{className:"tform__error",children:N("minutes")})]})]}),s.jsxs("div",{className:"tform__row",children:[s.jsx("span",{className:"field",children:"Права агента"}),s.jsx(rl,{value:g.permissionMode,options:nT,ariaLabel:"Режим прав",onChange:D=>k({permissionMode:D})}),g.permissionMode==="bypassPermissions"&&s.jsx("p",{className:"tform__hint tform__hint--warn",children:"Агент выполнит всё без вопросов, а вас рядом может не быть."})]}),s.jsxs("div",{className:"tform__row",children:[s.jsx("label",{className:"field",htmlFor:"task-model",children:"Модель"}),s.jsx("input",{id:"task-model",className:"input",value:g.model,placeholder:"По умолчанию (например, sonnet или opus)",onChange:D=>k({model:D.target.value})})]}),s.jsxs("div",{className:"tform__switch",children:[s.jsx("span",{children:"Включена"}),s.jsx("button",{type:"button",role:"switch","aria-checked":g.enabled,"aria-label":"Задача включена",className:g.enabled?"switch is-on":"switch",onClick:()=>k({enabled:!g.enabled}),children:s.jsx("span",{className:"switch__knob"})})]}),s.jsx("button",{type:"submit",hidden:!0})]})})}const xg=n=>`ccv.siteNotes.${n}`;function dT(n){try{const l=localStorage.getItem(xg(n));if(!l)return{url:"",notes:[]};const i=JSON.parse(l),r=Array.isArray(i.notes)?i.notes.filter(o=>!!o&&typeof o.id=="string"&&typeof o.comment=="string"&&!!o.element&&typeof o.element.selector=="string"):[];return{url:typeof i.url=="string"?i.url:"",notes:r}}catch{return{url:"",notes:[]}}}function fT(n,l){try{!l.url&&l.notes.length===0?localStorage.removeItem(xg(n)):localStorage.setItem(xg(n),JSON.stringify(l))}catch{}}function yh(n){try{const l=new URL(n);return l.hash="",l.href}catch{return n}}function hT(n){const l=n.trim();if(!l)return"";if(/^[a-z][a-z0-9+.-]*:\/\//i.test(l))return l;const i=(l.split(/[/:?#]/,1)[0]??"").toLowerCase();return`${i==="localhost"||i.endsWith(".localhost")||/^\d{1,3}(\.\d{1,3}){3}$/.test(i)||l.startsWith("[")?"http":"https"}://${l}`}function _g(n,l){const i=n.replace(/\s+/g," ").trim().replaceAll("`","'");return i.length>l?`${i.slice(0,l-1)}…`:i}function bv(n){const l=_g(n.text,60);return l?`${n.tag}, «${l}»`:n.tag}function mT(n){const l=n.filter(r=>r.comment.trim());return l.length===0?"":`Правки к сайту (выбраны элементы на странице):
145
+
146
+ `+l.map((r,o)=>{var p;const u=r.element,m=[`${o+1}. Страница: ${u.url}`];return m.push(` Элемент: \`${_g(u.selector,300)}\` — ${bv(u)}`),(p=u.source)!=null&&p.file&&m.push(` Исходник: ${u.source.file}${u.source.component?` (${u.source.component})`:""}`),m.push(` Размер: ${Math.round(u.rect.width)}×${Math.round(u.rect.height)}, окно ${u.viewport.width}×${u.viewport.height}`),m.push(` HTML: \`${_g(u.html,200)}\``),m.push(` Правка: ${r.comment.trim().replace(/\n/g,`
147
+ `)}`),m.join(`
148
+ `)}).join(`
149
+
150
+ `)+`
151
+
152
+ Найди эти элементы в коде проекта и внеси правки. Если элемент не находится однозначно — скажи, какие варианты нашёл.`}const vh={width:15,height:15,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};function pT({workspaceId:n,workspaceName:l,remote:i,reply:r,send:o,hasSession:u,onInsertPrompt:m,onClose:p}){const g=x.useRef(dT(n)).current,[_,b]=x.useState(g.url),[j,v]=x.useState(g.url),[k,N]=x.useState(g.notes),[E,C]=x.useState({kind:"idle"}),[I,D]=x.useState(!1),[G,P]=x.useState(0),[V,z]=x.useState(0),[H,te]=x.useState(null),[F,fe]=x.useState(null),Q=x.useRef(null),X=x.useRef(new Map),ge=x.useRef(!1),U=x.useRef([]),L=x.useRef(-1),M=x.useRef(null),O=x.useRef(I);O.current=I;const J=x.useRef(0),le=x.useCallback(Se=>{const Ge=hT(Se);!Ge||i||(ge.current=!0,b(Ge),C({kind:"loading",url:Ge}),o({type:"site.open",url:Ge}))},[i,o]);x.useEffect(()=>{!r||r.n===J.current||(J.current=r.n,ge.current&&(ge.current=!1,r.ok?(C({kind:"open",proxyUrl:r.proxyUrl}),v(r.url),b(r.url),P(Se=>Se+1)):C({kind:"failed",url:r.url,message:r.message})))},[r]),x.useEffect(()=>{fT(n,{url:j,notes:k})},[n,j,k]);const ce=x.useCallback(Se=>{var Ge,Ve;(Ve=(Ge=Q.current)==null?void 0:Ge.contentWindow)==null||Ve.postMessage({source:"ccv-app",...Se},"*")},[]);x.useEffect(()=>{function Se(Ge){var Ft;const Ve=(Ft=Q.current)==null?void 0:Ft.contentWindow;if(!Ve||Ge.source!==Ve)return;const Je=Ge.data;if(!(!Je||Je.source!=="ccv-site"))if(Je.type==="ready"||Je.type==="location"){if(typeof Je.url=="string"){const dt=Je.url;v(dt),b(dt),U.current[L.current]!==dt&&(U.current=[...U.current.slice(0,L.current+1),dt],L.current=U.current.length-1)}if(z(dt=>dt+1),Je.type==="ready"&&(ce({type:"mode",pick:O.current}),M.current)){const dt=M.current;M.current=null,window.setTimeout(()=>ce({type:"flash",selector:dt}),250)}}else if(Je.type==="picked"&&Je.element){const dt=Je.element,jn={id:`${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`,element:dt,comment:""};N(Ze=>[...Ze,jn]),te(jn.id)}else Je.type==="cancel"&&D(!1)}return window.addEventListener("message",Se),()=>window.removeEventListener("message",Se)},[ce]),x.useEffect(()=>{ce({type:"mode",pick:I})},[I,ce]),x.useEffect(()=>{const Se=yh(j),Ge=k.map((Ve,Je)=>({n:Je+1,selector:Ve.element.selector,url:Ve.element.url})).filter(Ve=>yh(Ve.url)===Se).map(({n:Ve,selector:Je})=>({n:Ve,selector:Je}));ce({type:"marks",marks:Ge})},[k,j,V,ce]),x.useEffect(()=>{var Se,Ge;H&&((Se=X.current.get(H))==null||Se.focus(),(Ge=X.current.get(H))==null||Ge.scrollIntoView({block:"nearest"}),te(null))},[H,k]),x.useEffect(()=>{function Se(Ge){Ge.key==="Escape"&&(Ge.preventDefault(),Ge.stopPropagation(),O.current?D(!1):p())}return document.addEventListener("keydown",Se,!0),()=>document.removeEventListener("keydown",Se,!0)},[p]),x.useEffect(()=>{!i&&g.url&&le(g.url)},[]);function A(){if(L.current<=0)return;L.current-=1;const Se=U.current[L.current];Se&&le(Se)}function W(){E.kind==="open"?P(Se=>Se+1):_&&le(_)}function me(Se){E.kind==="open"&&(yh(Se.element.url)===yh(j)?ce({type:"flash",selector:Se.element.selector}):(M.current=Se.element.selector,le(Se.element.url)))}function Ee(Se,Ge){N(Ve=>Ve.map(Je=>Je.id===Se?{...Je,comment:Ge}:Je))}function $(Se){X.current.delete(Se),N(Ge=>Ge.filter(Ve=>Ve.id!==Se))}const de=mT(k);function ae(){de&&(m(de)?(fe(null),p()):fe(de))}const qe=E.kind==="open";return s.jsxs("div",{className:"workpanel",role:"dialog","aria-modal":"true","aria-label":"Сайт",children:[s.jsxs("header",{className:"workpanel__bar",children:[s.jsx("h2",{className:"workpanel__title",children:"Сайт"}),!i&&s.jsxs("form",{className:"siteview__nav",onSubmit:Se=>{Se.preventDefault(),le(_)},children:[s.jsx("button",{type:"button",className:"iconbtn",title:"Назад","aria-label":"Назад",disabled:L.current<=0||E.kind!=="open",onClick:A,children:s.jsx("svg",{...vh,children:s.jsx("path",{d:"M10 3 5 8l5 5"})})}),s.jsx("button",{type:"button",className:"iconbtn",title:"Обновить","aria-label":"Обновить",disabled:E.kind==="idle",onClick:W,children:s.jsx("svg",{...vh,children:s.jsx("path",{d:"M13 8a5 5 0 1 1-1.6-3.7M13 2.5v3h-3"})})}),s.jsx("input",{className:"input input--mono siteview__address",value:_,onChange:Se=>b(Se.target.value),placeholder:"localhost:5173 или адрес сайта","aria-label":"Адрес страницы",spellCheck:!1,autoCapitalize:"off",autoCorrect:"off"}),s.jsxs("button",{type:"button",className:"btn siteview__pick"+(I?" is-on":""),"aria-pressed":I,disabled:!qe,title:qe?"Клик по странице выбирает элемент; Esc выключает":"Сначала откройте страницу",onClick:()=>D(Se=>!Se),children:[s.jsx("svg",{...vh,children:s.jsx("path",{d:"M3 3l4 10 1.6-4.4L13 7 3 3Z"})}),"Выбрать элемент"]})]}),s.jsx("button",{className:"btn btn--ghost workpanel__close",onClick:p,children:"Закрыть"})]}),i?s.jsxs("div",{className:"workpanel__empty",children:[s.jsx("h3",{children:"Окно «Сайт» работает только на компьютере с хостом"}),s.jsx("p",{children:"Страницу открывает прокси, который слушает только 127.0.0.1 машины, где запущен хост. Через удалённый доступ до него не добраться. Откройте Claude Code Visual на этом компьютере."})]}):s.jsxs("div",{className:"siteview",children:[s.jsxs("div",{className:"siteview__stage",children:[E.kind==="open"&&s.jsx("iframe",{ref:Q,className:"siteview__frame",src:E.proxyUrl,title:`Сайт проекта ${l}`,allow:"clipboard-write"},G),E.kind==="idle"&&s.jsxs("div",{className:"workpanel__empty",children:[s.jsx("h3",{children:"Откройте страницу"}),s.jsxs("p",{children:["Введите адрес локального сервера (например, ",s.jsx("code",{children:"localhost:5173"}),") или любого сайта и нажмите Enter. Затем включите «Выбрать элемент», кликайте по нужным местам страницы и пишите к ним правки."]})]}),E.kind==="loading"&&s.jsxs("div",{className:"workpanel__empty",role:"status",children:[s.jsx("div",{className:"mediaview__progress",children:s.jsx("div",{className:"mediaview__progress-fill"})}),s.jsxs("p",{children:["Открываю ",E.url,"…"]})]}),E.kind==="failed"&&s.jsxs("div",{className:"workpanel__empty",role:"alert",children:[s.jsx("h3",{children:"Сайт не ответил"}),s.jsx("p",{children:E.url}),s.jsx("p",{className:"workpanel__error",children:E.message}),s.jsx("button",{className:"btn btn--sm",onClick:()=>le(E.url),children:"Повторить"})]})]}),s.jsxs("aside",{className:"sitenotes","aria-label":"Правки",children:[s.jsx("div",{className:"sitenotes__list",children:k.length===0?s.jsx("p",{className:"sitenotes__hint",children:qe?"Включите «Выбрать элемент» и кликните по странице. Для каждого элемента появится карточка с полем для правки.":"Здесь появятся карточки выбранных элементов."}):k.map((Se,Ge)=>{var Ve;return s.jsxs("article",{className:"sitenote",children:[s.jsxs("div",{className:"sitenote__head",children:[s.jsxs("button",{className:"sitenote__main",onClick:()=>me(Se),title:"Показать элемент на странице",children:[s.jsx("span",{className:"sitenote__n",children:Ge+1}),s.jsxs("span",{className:"sitenote__desc",children:[s.jsx("span",{className:"sitenote__tag",children:bv(Se.element)}),s.jsx("span",{className:"sitenote__sel",children:Se.element.selector}),((Ve=Se.element.source)==null?void 0:Ve.file)&&s.jsxs("span",{className:"sitenote__src",children:[Se.element.source.file,Se.element.source.component?` · ${Se.element.source.component}`:""]})]})]}),s.jsx("button",{className:"iconbtn iconbtn--danger",title:"Удалить карточку","aria-label":`Удалить карточку ${Ge+1}`,onClick:()=>$(Se.id),children:s.jsx("svg",{...vh,children:s.jsx("path",{d:"M3.5 4.5h9M6.5 4.5V3h3v1.5M5 4.5l.5 8h5l.5-8"})})})]}),s.jsx("textarea",{ref:Je=>{Je?X.current.set(Se.id,Je):X.current.delete(Se.id)},className:"input input--area sitenote__comment",value:Se.comment,onChange:Je=>Ee(Se.id,Je.target.value),placeholder:"Что здесь поменять","aria-label":`Правка к элементу ${Ge+1}`,rows:2})]},Se.id)})}),F&&s.jsxs("div",{className:"sitenotes__leftover",role:"status",children:[s.jsx("p",{children:u?"Промпт не удалось вставить в поле ввода.":"Откройте сессию, чтобы вставить промпт в поле ввода. Пока его можно скопировать."}),s.jsx(tr,{text:F,hint:"промпт с правками"})]}),s.jsxs("div",{className:"sitenotes__foot",children:[s.jsx("button",{className:"btn btn--primary",disabled:!de,title:de?"Положить правки в поле ввода сессии":"Напишите правку хотя бы в одной карточке",onClick:ae,children:"Собрать промпт"}),s.jsx("button",{className:"btn btn--ghost",disabled:k.length===0,onClick:()=>{N([]),fe(null)},children:"Очистить"})]})]})]})]})}const gT=/\.(mp4|webm|mov|m4v|ogv)$/i,xT=/https?:\/\/[^\s"'<>)\]\\}]+/g;function _T(n){try{return gT.test(new URL(n).pathname)}catch{return!1}}function bT(n){const l=new Set,i=[],r=o=>{if(o)for(const u of o.matchAll(xT)){const m=u[0].replace(/[.,;:!?]+$/,"");!l.has(m)&&_T(m)&&(l.add(m),i.push(m))}};for(const o of n)o.kind==="assistant"||o.kind==="user"?r(o.text):o.kind==="tool"&&r(o.result);return i}function yT(n){try{const l=new URL(n);return decodeURIComponent(l.pathname.split("/").filter(Boolean).pop()??"")||l.host}catch{return n}}const vT=64*1024*1024,jT={mp4:"video/mp4",m4v:"video/mp4",webm:"video/webm",mov:"video/quicktime",ogv:"video/ogg",mkv:"video/x-matroska"};function NT(n){var l;return jT[((l=n.split(".").pop())==null?void 0:l.toLowerCase())??""]??"video/mp4"}function kT(n){return new Date(n).toLocaleString("ru-RU",{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}).replace(" г.","")}function _y(n,l){return!n||n.kind!==l.kind?!1:n.kind==="link"&&l.kind==="link"?n.url===l.url:n.kind==="remotion"&&l.kind==="remotion"?n.root===l.root:"path"in n&&"path"in l&&n.path===l.path}function wT({workspaceId:n,remote:l,catalog:i,studios:r,links:o,previews:u,mediaCache:m,send:p,onRequestMedia:g,onClose:_}){const[b,j]=x.useState(null),[v,k]=x.useState(!0),[N,E]=x.useState(0),[C,I]=x.useState(null),D=i&&i.workspaceId===n?i:null,G=()=>{k(!0),p({type:"video.scan",workspaceId:n})};x.useEffect(()=>{G()},[n]),x.useEffect(()=>{D&&k(!1)},[D]);const P=x.useRef(_);P.current=_,x.useEffect(()=>{function U(L){L.key==="Escape"&&(L.preventDefault(),L.stopPropagation(),P.current())}return document.addEventListener("keydown",U,!0),()=>document.removeEventListener("keydown",U,!0)},[]);function V(U){j(U),I(null),U.kind==="animation"&&(E(L=>L+1),p({type:"fs.preview",workspaceId:n,path:U.path}))}function z(U){p({type:"fs.preview",workspaceId:n,path:U}),E(L=>L+1)}const H=(D==null?void 0:D.videos)??[],te=(D==null?void 0:D.animations)??[],F=(D==null?void 0:D.remotion)??[],fe=!!D&&o.length===0&&H.length===0&&te.length===0&&F.length===0,Q=(U,L,M,O)=>s.jsx("li",{children:s.jsxs("button",{className:"vidrow"+(_y(b,U)?" is-on":""),"aria-pressed":_y(b,U),onClick:()=>V(U),children:[s.jsx("span",{className:"vidrow__title",children:L}),M&&s.jsx("span",{className:"vidrow__meta",children:M})]})},O),X=U=>`${Ad(U.size)} · ${kT(U.mtime)}`;function ge(){if(!b)return s.jsxs("div",{className:"workpanel__empty",children:[s.jsx("h3",{children:"Выберите видео справа"}),s.jsx("p",{children:"Файл, ссылка или анимация проиграются здесь. Для проекта Remotion откроется Studio."})]});if(b.kind==="link")return s.jsxs("div",{className:"vidstage",children:[s.jsx("video",{className:"vidstage__video",src:b.url,controls:!0,autoPlay:!0,onError:()=>I(b.url)},b.url),s.jsxs("div",{className:"vidstage__bar",children:[s.jsx("span",{className:"vidstage__name",title:b.url,children:b.url}),s.jsx("a",{className:"btn btn--sm",href:b.url,target:"_blank",rel:"noreferrer noopener",children:"Открыть по ссылке"})]}),C===b.url&&s.jsx("p",{className:"workpanel__error",role:"alert",children:"Не удалось проиграть видео. Ссылка могла устареть или сервер не разрешает встраивание."})]});if(b.kind==="file"){const L=H.find(J=>J.path===b.path),M=m[b.path],O=M&&"base64"in M?M:void 0;return s.jsxs("div",{className:"vidstage",children:[s.jsx("div",{className:"vidstage__media",children:s.jsx(O0,{path:b.path,mime:(O==null?void 0:O.mime)??NT(b.path),base64:O==null?void 0:O.base64,error:M&&"error"in M?M.error:void 0,tooLarge:((L==null?void 0:L.size)??0)>vT,size:(L==null?void 0:L.size)??0,onRequestMedia:g},b.path)}),s.jsx("div",{className:"vidstage__bar",children:s.jsx("span",{className:"vidstage__name",title:b.path,children:b.path})})]})}if(b.kind==="animation"){const L=u[b.path];return s.jsxs("div",{className:"vidstage",children:[s.jsx("div",{className:"vidstage__media vidstage__media--page",children:L!=null&&L.error?s.jsx("p",{className:"workpanel__error",role:"alert",children:L.error}):(L==null?void 0:L.html)!==void 0?s.jsx(Wh,{doc:R0(b.path,L.html),title:b.path},N):s.jsxs("div",{className:"workpanel__empty",role:"status",children:[s.jsx("div",{className:"mediaview__progress",children:s.jsx("div",{className:"mediaview__progress-fill"})}),s.jsx("p",{children:"Загружаю страницу…"})]})}),s.jsxs("div",{className:"vidstage__bar",children:[s.jsx("span",{className:"vidstage__name",title:b.path,children:b.path}),s.jsx("button",{className:"btn btn--sm",onClick:()=>z(b.path),children:"Сначала"})]})]})}const U=F.find(L=>L.root===b.root);return U?s.jsx(ST,{project:U,workspaceId:n,remote:l,state:r[U.root],send:p}):null}return s.jsxs("div",{className:"workpanel",role:"dialog","aria-modal":"true","aria-label":"Видео",children:[s.jsxs("header",{className:"workpanel__bar",children:[s.jsx("h2",{className:"workpanel__title",children:"Видео"}),s.jsx("button",{className:"btn btn--sm",disabled:v,onClick:G,children:v?"Ищу…":"Обновить"}),s.jsx("span",{className:"workpanel__spacer"}),s.jsx("button",{className:"btn btn--ghost workpanel__close",onClick:_,children:"Закрыть"})]}),s.jsxs("div",{className:"vidview",children:[s.jsx("div",{className:"vidview__stage",children:ge()}),s.jsxs("nav",{className:"vidlist","aria-label":"Найденное видео",children:[!D&&s.jsx("p",{className:"vidlist__hint",role:"status",children:"Ищу видео в проекте…"}),fe&&s.jsxs("div",{className:"vidlist__empty",children:[s.jsx("h3",{children:"Видео пока нет"}),s.jsx("p",{children:"Раздел собирает видеофайлы проекта (mp4, webm, mov), проекты Remotion, HTML-страницы с анимацией и ссылки на видео из разговора. Когда агент что-нибудь сделает, нажмите «Обновить»."})]}),D&&!fe&&s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"vidgroup",children:[s.jsx("h3",{className:"vidgroup__title",children:"Из разговора"}),o.length===0?s.jsx("p",{className:"vidgroup__none",children:"Ссылок на видео в этой сессии нет."}):s.jsx("ul",{children:[...o].reverse().map(U=>Q({kind:"link",url:U},yT(U),new URL(U).host,U))})]}),s.jsxs("section",{className:"vidgroup",children:[s.jsx("h3",{className:"vidgroup__title",children:"Файлы проекта"}),H.length===0?s.jsx("p",{className:"vidgroup__none",children:"Видеофайлов нет."}):s.jsx("ul",{children:H.map(U=>Q({kind:"file",path:U.path},U.path,X(U),U.path))})]}),s.jsxs("section",{className:"vidgroup",children:[s.jsx("h3",{className:"vidgroup__title",children:"Remotion"}),F.length===0?s.jsx("p",{className:"vidgroup__none",children:"Проектов Remotion нет."}):s.jsx("ul",{children:F.map(U=>{var O;const L=(O=r[U.root])==null?void 0:O.status,M=L==="ready"?"предпросмотр запущен":L==="starting"?"запускается…":U.root==="."?"корень проекта":U.root;return Q({kind:"remotion",root:U.root},U.name,M,U.root)})})]}),s.jsxs("section",{className:"vidgroup",children:[s.jsx("h3",{className:"vidgroup__title",children:"HTML-анимации"}),te.length===0?s.jsx("p",{className:"vidgroup__none",children:"Страниц с анимацией нет."}):s.jsx("ul",{children:te.map(U=>Q({kind:"animation",path:U.path},U.path,X(U),U.path))})]}),D.truncated&&s.jsx("p",{className:"vidlist__warn",role:"status",children:"Проект слишком большой: поиск остановился раньше, чем обошёл все файлы, и показано не всё."})]})]})]})]})}function ST({project:n,workspaceId:l,remote:i,state:r,send:o}){const u=(r==null?void 0:r.status)??"stopped",m=u==="starting"||u==="ready";return s.jsxs("div",{className:"vidstage",children:[s.jsxs("div",{className:"remo",children:[s.jsxs("div",{className:"remo__head",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"remo__name",children:n.name}),s.jsxs("dl",{className:"remo__meta",children:[s.jsx("dt",{children:"Каталог"}),s.jsx("dd",{children:n.root==="."?"корень проекта":n.root}),s.jsx("dt",{children:"Точка входа"}),s.jsx("dd",{children:n.entry??"не найдена"})]})]}),s.jsx("div",{className:"remo__actions",children:m?s.jsx("button",{className:"btn",onClick:()=>o({type:"video.studio.stop",workspaceId:l,root:n.root}),children:"Остановить"}):s.jsx("button",{className:"btn btn--primary",disabled:i,onClick:()=>o({type:"video.studio.start",workspaceId:l,root:n.root}),children:"Открыть предпросмотр"})})]}),!n.installed&&s.jsxs("p",{className:"remo__warn",role:"status",children:["Сначала установите зависимости (npm install) в ",n.root==="."?"корне проекта":n.root,": без них Studio не запустится."]}),i&&s.jsx("p",{className:"remo__warn",role:"status",children:"Studio открывается на localhost компьютера с хостом, через удалённый доступ предпросмотр недоступен. Видеофайлы и ссылки из разговора здесь работают."})]}),u==="starting"&&s.jsxs("div",{className:"workpanel__empty",role:"status",children:[s.jsx("div",{className:"mediaview__progress",children:s.jsx("div",{className:"mediaview__progress-fill"})}),s.jsx("p",{children:"Запускаю Remotion Studio. Первый запуск может занять до минуты."})]}),u==="ready"&&(r==null?void 0:r.url)&&!i&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"vidstage__media vidstage__media--page",children:s.jsx("iframe",{className:"vidstage__studio",src:r.url,title:`Remotion Studio: ${n.name}`,allow:"clipboard-write; fullscreen"})}),s.jsxs("div",{className:"vidstage__bar",children:[s.jsx("span",{className:"vidstage__name",children:r.url}),s.jsx("a",{className:"btn btn--sm",href:r.url,target:"_blank",rel:"noreferrer noopener",children:"Открыть в браузере"})]})]}),u==="failed"&&s.jsxs("div",{className:"remo__failed",role:"alert",children:[s.jsx("h3",{children:"Studio не запустилась"}),(r==null?void 0:r.message)&&s.jsx("p",{children:r.message}),(r==null?void 0:r.log)&&r.log.length>0&&s.jsx("pre",{className:"remo__log",children:r.log.join(`
153
+ `)})]}),u==="stopped"&&!i&&s.jsx("div",{className:"workpanel__empty",children:s.jsx("p",{children:"Studio — это плеер композиции с перемоткой, пропсами и очередью рендера. Нажмите «Открыть предпросмотр»."})})]})}function ET({tab:n,servers:l,plugins:i,marketplaces:r,catalog:o,result:u,auth:m,duplicates:p,accounts:g,remote:_,actions:b,onTab:j,onClose:v}){const k=[{id:"mcp",label:"MCP-серверы",count:l.length},{id:"plugins",label:"Плагины",count:i.length},{id:"catalog",label:"Каталог",count:o.length}];return s.jsxs(zn,{title:"Расширения",className:"modal--wide",onClose:v,children:[s.jsx("div",{className:"tabs",role:"tablist",children:k.map(N=>s.jsxs("button",{role:"tab","aria-selected":n===N.id,className:n===N.id?"tabs__tab is-on":"tabs__tab",onClick:()=>j(N.id),children:[N.label,s.jsx("span",{className:"tabs__count",children:N.count})]},N.id))}),n==="mcp"&&s.jsx(CT,{servers:l,auth:m,accounts:g,remote:_,actions:b,onPlugins:()=>j("plugins")}),n==="plugins"&&s.jsx(OT,{plugins:i,marketplaces:r,duplicates:p,actions:b}),n==="catalog"&&s.jsx(zT,{catalog:o,hasMarketplaces:r.length>0,actions:b,onMarketplaces:()=>j("plugins")}),s.jsx(ec,{result:u})]})}function CT({servers:n,auth:l,accounts:i,remote:r,actions:o,onPlugins:u}){const[m,p]=x.useState(!1);return s.jsxs(s.Fragment,{children:[n.length===0&&!m&&s.jsxs("p",{className:"modal__text",children:["Ни одного MCP-сервера. Добавленный здесь попадёт в ",s.jsx("code",{children:".mcp.json"})," ","проекта — его увидит и консольный ",s.jsx("code",{children:"claude mcp list"}),"."]}),s.jsx("ul",{className:"extlist",children:n.map(g=>{const _=(l==null?void 0:l.name)===g.name?l:null,b=_!==null&&_.active&&_.url==="",j=_!==null&&_.active&&_.url!=="";return s.jsxs("li",{className:"extlist__row",children:[s.jsxs("div",{className:"extlist__head",children:[s.jsx("span",{className:"extlist__name",children:g.name}),s.jsx("span",{className:`chip chip--${RT(g.status)}`,children:MT[g.status]}),g.scope&&s.jsx("span",{className:"chip",children:g.scope}),g.transport&&s.jsx("span",{className:"chip",children:g.transport})]}),g.target&&s.jsx("div",{className:"extlist__meta",title:g.target,children:g.target}),g.error&&s.jsx("div",{className:"extlist__error",children:g.error}),g.tools.length>0&&s.jsxs("div",{className:"extlist__meta",children:["Инструментов: ",g.tools.length," · ",g.tools.slice(0,6).join(", "),g.tools.length>6&&"…"]}),s.jsxs("div",{className:"extlist__actions",children:[g.status==="needs-auth"&&s.jsx("button",{className:j?"btn btn--ghost btn--sm":"btn btn--primary btn--sm",disabled:b,onClick:()=>o.mcpAuth(g.name),children:b?"Запускаем вход…":j?"Начать заново":"Авторизовать"}),s.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>o.mcpAction(g.name,"reconnect"),children:"Переподключить"}),g.status==="disabled"?s.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>o.mcpAction(g.name,"enable"),children:"Включить"}):s.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>o.mcpAction(g.name,"disable"),children:"Выключить"}),g.editable&&s.jsx("button",{className:"btn btn--ghost btn--sm btn--danger",onClick:()=>o.mcpRemove(g.name),children:"Удалить"})]}),_&&s.jsx(TT,{auth:_,accounts:i,remote:r,actions:o,onPlugins:u})]},g.name)})}),m?s.jsx(DT,{onCancel:()=>p(!1),onSubmit:(g,_)=>{o.mcpAdd(g,_),p(!1)}}):s.jsx("div",{className:"extbar",children:s.jsx("button",{className:"btn btn--primary",onClick:()=>p(!0),children:"+ Сервер"})})]})}function TT({auth:n,accounts:l,remote:i,actions:r,onPlugins:o}){var k;const[u,m]=x.useState(""),p=l.find(N=>N.id===n.accountId)??null,g=l.length>1&&p?s.jsxs("div",{className:"extauth__account",children:[s.jsx(Da,{account:p,size:"sm"}),s.jsxs("span",{children:["Вход для аккаунта ",s.jsxs("strong",{children:["«",p.name,"»"]})]})]}):null,_=n.otherAccounts.map(N=>l.find(E=>E.id===N)).find(N=>N!==void 0);function b(){const N=u.trim();N!==""&&(r.mcpAuthCallback(n.name,N),m(""))}if(!n.active)return n.error||!n.done&&n.diagnostic?s.jsxs("div",{className:"extauth",role:"alert",children:[g,n.error&&s.jsx("div",{className:"extlist__error",children:n.error}),n.diagnostic&&s.jsx("p",{className:"extauth__why",children:n.diagnostic.message}),s.jsxs("div",{className:"extlist__actions",children:[s.jsx("button",{className:"btn btn--primary btn--sm",onClick:()=>r.mcpAuth(n.name,n.accountId),children:"Попробовать снова"}),((k=n.diagnostic)==null?void 0:k.kind)==="token-under-other-key"&&s.jsx("button",{className:"btn btn--ghost btn--sm",onClick:o,children:"Открыть вкладку «Плагины»"})]})]}):n.done?s.jsxs("div",{className:"extauth",role:"status",children:[s.jsxs("div",{className:"extauth--done",children:[s.jsx("span",{className:"extauth__tick","aria-hidden":"true",children:"✓"}),"Вход выполнен",g&&p?` для аккаунта «${p.name}»`:"",", сервер подключён."]}),_&&s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"extauth__hint",children:["В аккаунте «",_.name,"» этот сервер тоже без входа."]}),s.jsxs("button",{className:"btn btn--primary btn--sm",onClick:()=>r.mcpAuth(n.name,_.id),children:["Войти и в аккаунте «",_.name,"»"]})]})]}):null;const j=s.jsxs("div",{className:"extauth__paste",children:[i&&s.jsx("label",{className:"extauth__label",htmlFor:`mcp-cb-${n.name}`,children:"Адрес из строки браузера после входа"}),s.jsxs("div",{className:"extform__row",children:[s.jsx("input",{id:`mcp-cb-${n.name}`,"aria-label":"Адрес из строки браузера после входа",className:"input input--mono",value:u,spellCheck:!1,autoComplete:"off",placeholder:"http://localhost:…/callback?code=…",onChange:N=>m(N.target.value),onKeyDown:N=>{N.key==="Enter"&&(N.preventDefault(),b())}}),s.jsx("button",{className:u.trim()===""?"btn btn--ghost btn--sm":"btn btn--primary btn--sm",disabled:u.trim()==="",onClick:b,children:"Отправить"})]}),s.jsx("p",{className:"extauth__hint",children:i?"Браузер покажет ошибку на localhost — это нормально. Скопируйте адрес из его строки и вставьте сюда.":"Скопируйте адрес из строки браузера и вставьте сюда."})]}),v=n.callbackExpected&&(i?j:s.jsxs("details",{className:"extauth__more",children:[s.jsx("summary",{children:"Браузер показал ошибку на localhost?"}),j]}));return s.jsxs("div",{className:"extauth",role:"status",children:[g,n.url&&s.jsxs(s.Fragment,{children:[s.jsx("a",{className:"btn btn--primary extauth__go",href:n.url,target:"_blank",rel:"noopener noreferrer",children:"Открыть страницу входа"}),!i&&s.jsx("p",{className:"extauth__hint",children:"На этом компьютере окно обновится само, как только вы войдёте."})]}),v,n.error&&s.jsx("div",{className:"extlist__error",children:n.error}),s.jsxs("div",{className:"extauth__wait",children:[s.jsx("span",{className:"extauth__dot","aria-hidden":"true"}),AT[n.stage]]})]})}const AT={starting:"Запускаем вход…",waiting:"Ждём завершения входа…",exchanging:"Обмениваем код на токен…",finished:"Завершаем вход…"},MT={connected:"подключён",failed:"ошибка","needs-auth":"нужна авторизация",pending:"подключается",disabled:"выключен",unknown:"неизвестно"};function RT(n){return n==="connected"?"ok":n==="failed"?"bad":n==="needs-auth"?"warn":"mute"}function DT({onSubmit:n,onCancel:l}){const[i,r]=x.useState(""),[o,u]=x.useState("stdio"),[m,p]=x.useState(""),[g,_]=x.useState(""),[b,j]=x.useState(""),v=o==="stdio",k=i.trim()!==""&&(v?m.trim()!=="":g.trim()!=="");function N(){if(k)if(v){const[E,...C]=LT(m);n(i.trim(),{transport:"stdio",command:E??"",args:C,env:by(b)})}else n(i.trim(),{transport:o,url:g.trim(),headers:by(b)})}return s.jsxs("div",{className:"extform extform--card",children:[s.jsx("label",{className:"field",htmlFor:"mcp-name",children:"Имя сервера"}),s.jsx("input",{id:"mcp-name",className:"input input--mono",value:i,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"context7",onChange:E=>r(E.target.value)}),s.jsx("label",{className:"field",children:"Транспорт"}),s.jsx(rl,{title:"Транспорт",value:o,options:[{value:"stdio",label:"stdio",hint:"локальный процесс"},{value:"http",label:"http",hint:"удалённый сервер"},{value:"sse",label:"sse",hint:"удалённый, поток событий"}],onChange:E=>u(E)}),v?s.jsxs(s.Fragment,{children:[s.jsx("label",{className:"field",htmlFor:"mcp-command",children:"Команда с аргументами"}),s.jsx("input",{id:"mcp-command",className:"input input--mono",value:m,spellCheck:!1,autoComplete:"off",placeholder:"npx -y @upstash/context7-mcp",onChange:E=>p(E.target.value)})]}):s.jsxs(s.Fragment,{children:[s.jsx("label",{className:"field",htmlFor:"mcp-url",children:"URL"}),s.jsx("input",{id:"mcp-url",className:"input input--mono",value:g,spellCheck:!1,autoComplete:"off",placeholder:"https://mcp.example.dev/mcp",onChange:E=>_(E.target.value)})]}),s.jsxs("label",{className:"field",htmlFor:"mcp-pairs",children:[v?"Переменные окружения":"Заголовки"," — по одной на строку, необязательно"]}),s.jsx("textarea",{id:"mcp-pairs",className:"input input--mono input--area",value:b,spellCheck:!1,placeholder:v?"API_KEY=xxx":"Authorization: Bearer xxx",onChange:E=>j(E.target.value)}),s.jsxs("div",{className:"extbar",children:[s.jsx("button",{className:"btn",onClick:l,children:"Отмена"}),s.jsx("button",{className:"btn btn--primary",disabled:!k,onClick:N,children:"Подключить"})]})]})}function by(n){const l={};for(const i of n.split(`
154
+ `)){const r=i.trim();if(!r)continue;const o=r.indexOf("="),u=r.indexOf(":"),m=o===-1?u:u===-1?o:Math.min(o,u);m<=0||(l[r.slice(0,m).trim()]=r.slice(m+1).trim())}return l}function LT(n){return(n.trim().match(/"[^"]*"|'[^']*'|\S+/g)??[]).map(l=>l.replace(/^["']|["']$/g,""))}function OT({plugins:n,marketplaces:l,duplicates:i,actions:r}){const[o,u]=x.useState("");return s.jsxs(s.Fragment,{children:[i.map(m=>s.jsxs("div",{className:"extwarn",role:"alert",children:[s.jsxs("div",{className:"extwarn__title",children:["«",m.id,"» записан в реестре ",m.records.length," раз"]}),s.jsx("ul",{className:"extwarn__records",children:m.records.map((p,g)=>s.jsxs("li",{title:p.installPath,children:[p.scope,p.version&&p.version!=="unknown"?`, версия ${p.version}`:""]},`${p.scope}-${p.installPath}-${g}`))}),s.jsx("p",{className:"extauth__hint",children:"Из-за этого у MCP-сервера плагина бывает несколько конфигов, и вход в него может выглядеть «потерянным»."}),s.jsx("div",{className:"extlist__actions",children:s.jsx("button",{className:"btn btn--primary btn--sm",onClick:()=>r.pluginDedupe(m.id),children:"Оставить одну запись"})})]},m.id)),n.length===0&&s.jsx("p",{className:"modal__text",children:"Ни одного установленного плагина. Что можно поставить — на вкладке «Каталог»."}),s.jsx("ul",{className:"extlist",children:n.map(m=>s.jsxs("li",{className:"extlist__row",children:[s.jsxs("div",{className:"extlist__head",children:[s.jsx("span",{className:"extlist__name",children:m.name}),s.jsx("span",{className:m.enabled?"chip chip--ok":"chip chip--mute",children:m.enabled?"включён":"выключен"}),m.version&&m.version!=="unknown"&&s.jsx("span",{className:"chip",children:m.version}),m.scope&&s.jsx("span",{className:"chip",children:m.scope})]}),m.marketplace&&s.jsx("div",{className:"extlist__meta",children:m.marketplace}),m.mcpServers.length>0&&s.jsxs("div",{className:"extlist__meta",children:["MCP-серверы: ",m.mcpServers.join(", ")]}),s.jsxs("div",{className:"extlist__actions",children:[s.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>r.pluginToggle(m.id,!m.enabled),children:m.enabled?"Выключить":"Включить"}),s.jsx("button",{className:"btn btn--ghost btn--sm btn--danger",onClick:()=>r.pluginUninstall(m.id),children:"Удалить"})]})]},m.id))}),s.jsx("div",{className:"sidebar__section",children:"Маркетплейсы"}),s.jsx("ul",{className:"extlist",children:l.map(m=>s.jsxs("li",{className:"extlist__row",children:[s.jsx("div",{className:"extlist__head",children:s.jsx("span",{className:"extlist__name",children:m.name})}),m.source&&s.jsx("div",{className:"extlist__meta",children:m.source}),s.jsx("div",{className:"extlist__actions",children:s.jsx("button",{className:"btn btn--ghost btn--sm btn--danger",onClick:()=>r.marketplaceRemove(m.name),children:"Отключить"})})]},m.name))}),s.jsxs("div",{className:"extform__row",children:[s.jsx("input",{className:"input input--mono",value:o,spellCheck:!1,autoComplete:"off","aria-label":"Источник маркетплейса",placeholder:"owner/repo, URL или путь",onChange:m=>u(m.target.value),onKeyDown:m=>{m.key!=="Enter"||o.trim()===""||(m.preventDefault(),r.marketplaceAdd(o.trim()),u(""))}}),s.jsx("button",{className:"btn",disabled:o.trim()==="",onClick:()=>{r.marketplaceAdd(o.trim()),u("")},children:"Добавить"})]})]})}const kd=30;function zT({catalog:n,hasMarketplaces:l,actions:i,onMarketplaces:r}){const[o,u]=x.useState(""),[m,p]=x.useState(""),[g,_]=x.useState(kd),[b,j]=x.useState(""),v=x.useMemo(()=>[...new Set(n.map(E=>E.category).filter(Boolean))].sort(),[n]),k=x.useMemo(()=>{const N=o.trim().toLowerCase();return n.filter(E=>m&&E.category!==m?!1:N?`${E.name} ${E.displayName} ${E.description} ${E.author}`.toLowerCase().includes(N):!0)},[n,o,m]);return n.length===0?s.jsxs("p",{className:"modal__text",children:[l?"Маркетплейсы подключены, но их каталог ещё не выкачан. Попробуйте открыть окно ещё раз через минуту.":"Ни одного маркетплейса — ставить нечего."," ",s.jsx("button",{className:"linkish",onClick:r,children:"Подключить маркетплейс"})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"catalog__filters",children:[s.jsx("input",{className:"input",value:o,spellCheck:!1,autoComplete:"off","aria-label":"Поиск по каталогу",placeholder:"Поиск: имя, описание, автор",onChange:N=>{u(N.target.value),_(kd)}}),s.jsx(rl,{title:"Категория",value:m,options:[{value:"",label:"все категории"},...v.map(N=>({value:N,label:N}))],onChange:N=>{p(N),_(kd)}})]}),k.length===0?s.jsx("p",{className:"modal__text",children:"Ничего не нашлось."}):s.jsx("ul",{className:"extlist",children:k.slice(0,g).map(N=>s.jsxs("li",{className:"extlist__row",children:[s.jsxs("div",{className:"extlist__head",children:[s.jsx("span",{className:"extlist__name",children:N.name}),N.installed&&s.jsx("span",{className:"chip chip--ok",children:"установлен"}),N.version&&s.jsx("span",{className:"chip",children:N.version}),N.category&&s.jsx("span",{className:"chip",children:N.category})]}),N.description&&s.jsx("div",{className:"catalog__desc",children:N.description}),s.jsxs("div",{className:"extlist__meta",children:[N.author&&`${N.author} · `,N.marketplace]}),s.jsxs("div",{className:"extlist__actions",children:[s.jsx("button",{className:"btn btn--ghost btn--sm",disabled:N.installed,onClick:()=>i.pluginInstall(N.id),children:N.installed?"Уже стоит":"Установить"}),N.homepage&&s.jsx("a",{className:"btn btn--ghost btn--sm",href:N.homepage,target:"_blank",rel:"noreferrer",children:"Страница"})]})]},N.id))}),k.length>g&&s.jsx("div",{className:"extbar",children:s.jsxs("button",{className:"btn",onClick:()=>_(N=>N+kd),children:["Ещё ",Math.min(kd,k.length-g)," из ",k.length-g]})}),s.jsxs("div",{className:"extform",children:[s.jsx("label",{className:"field",htmlFor:"plugin-spec",children:"Или установить по имени — если нужного в каталоге нет"}),s.jsxs("div",{className:"extform__row",children:[s.jsx("input",{id:"plugin-spec",className:"input input--mono",value:b,spellCheck:!1,autoComplete:"off",placeholder:"имя или имя@маркетплейс",onChange:N=>j(N.target.value),onKeyDown:N=>{N.key!=="Enter"||b.trim()===""||(N.preventDefault(),i.pluginInstall(b.trim()),j(""))}}),s.jsx("button",{className:"btn",disabled:b.trim()==="",onClick:()=>{i.pluginInstall(b.trim()),j("")},children:"Установить"})]})]})]})}function IT({accounts:n,auth:l,logins:i,candidates:r,usage:o,actions:u,activeAccountId:m,error:p,onReconnect:g,reconnectBlocked:_,reconnectHint:b,onOpenLogin:j,onClose:v}){const k=n.length>1,[N,E]=x.useState(!1),C=n.find(X=>X.main)??n[0],I=x.useRef(n.length);x.useEffect(()=>{n.length>I.current&&E(!1),I.current=n.length},[n.length]);const D=n.map(X=>`${X.id}:${X.dir}`).join("|"),G=x.useRef(u.discover);G.current=u.discover,x.useEffect(()=>{G.current()},[D]);const P=x.useRef(u.requestUsage);P.current=u.requestUsage;const[V,z]=x.useState(!1);x.useEffect(()=>{P.current();const X=window.setInterval(()=>P.current(),9e4),ge=window.setTimeout(()=>z(!0),25e3);return()=>{window.clearInterval(X),window.clearTimeout(ge)}},[]);const[H,te]=x.useState(null),F=H!==null&&Object.values(o).some(X=>X!=null&&X.fetchedAt>=H),fe=H!==null&&!F;x.useEffect(()=>{if(H===null)return;if(F){te(null);return}const X=window.setTimeout(()=>te(null),25e3);return()=>window.clearTimeout(X)},[H,F]);const Q=(r??[]).filter(X=>X.accountId===null&&!n.some(ge=>ge.dir===X.configDir));return s.jsxs(zn,{title:k?"Аккаунты":"Аккаунт",className:"modal--accounts",onClose:v,children:[s.jsxs("div",{className:"acctlimits",children:[s.jsx("span",{className:"acctlimits__title",children:"Лимиты плана"}),s.jsxs("button",{type:"button",className:fe?"btn btn--ghost btn--sm acctlimits__btn is-busy":"btn btn--ghost btn--sm acctlimits__btn","aria-label":"Обновить лимиты","aria-busy":fe,disabled:fe,onClick:()=>{te(Date.now()),u.requestUsage()},children:[s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("path",{d:"M14 8a6 6 0 1 1-6-6c1.68 0 3.29.67 4.49 1.83L14 5.33"}),s.jsx("path",{d:"M14 2v3.33h-3.33"})]}),s.jsx("span",{"aria-live":"polite",children:fe?"Обновляем…":"Обновить"})]})]}),n.map(X=>{var ge;return s.jsx(XT,{account:X,multi:k,status:l[X.id]??null,usage:o[X.id],usageSettled:V,main:C,loginActive:((ge=i[X.id])==null?void 0:ge.active)===!0,actions:u,takenColors:n.filter(U=>U.id!==X.id).map(U=>U.color),onReconnect:X.id===m?g:null,reconnectBlocked:_,reconnectHint:b,onOpenLogin:()=>j(X.id)},X.id)}),p&&s.jsx("p",{className:"account__warn",role:"alert",children:p}),Q.length>0&&C&&s.jsx(BT,{found:Q,accounts:n,main:C,onConnect:(X,ge,U,L)=>u.add(ge,U,X.configDir,L),onMakeMain:X=>u.update(C.id,{configDir:X.configDir})}),N?s.jsx(QT,{accounts:n,onAdd:u.add,onCancel:()=>E(!1)}):s.jsx("button",{type:"button",className:"btn account__add",onClick:()=>E(!0),children:"+ Добавить аккаунт"})]})}function UT(n){const l=n.split(/[\\/]+/).filter(Boolean),i=l[l.length-1];return i&&(/^(users|home)$/i.test(l[0]??"")||/^(users|home)$/i.test(l[1]??""))&&l.length<=4?`~/${i}`:n}function $T(n){const l=n.split(/[\\/]+/).filter(Boolean);return(l[l.length-1]??"").replace(/^\.+/,"").slice(0,em)}function BT({found:n,accounts:l,main:i,onConnect:r,onMakeMain:o}){return s.jsxs("section",{className:"found","aria-labelledby":"found-title",children:[s.jsx("h3",{className:"found__title",id:"found-title",children:"Найдено на этом компьютере"}),s.jsx("p",{className:"account__step found__lead",children:"Здесь уже есть вход Claude Code. Ничего не копируется: аккаунт просто указывает на эту папку, а вход остаётся у Claude Code."}),s.jsx("ul",{className:"found__list",children:n.map(u=>s.jsx(HT,{candidate:u,accounts:l,main:i,onConnect:r,onMakeMain:o},u.configDir))})]})}function HT({candidate:n,accounts:l,main:i,onConnect:r,onMakeMain:o}){const[u,m]=x.useState(!1),[p,g]=x.useState(!1),[_,b]=x.useState(()=>$T(n.configDir)),[j,v]=x.useState(!0),k=_.trim(),N=l.some(G=>G.name.toLowerCase()===k.toLowerCase()),E=Ji.find(G=>!l.some(P=>P.color===G))??Ji[1],C=`found-${n.configDir.replace(/[^a-z0-9]/gi,"-")}`,I=i.liveSessions>0;function D(G){G.preventDefault(),k!==""&&r(n,k,E,j)}return s.jsxs("li",{className:"found__row",children:[s.jsxs("div",{className:"found__id",children:[s.jsx("span",{className:"found__email",children:n.email||"Вход выполнен"}),n.plan&&s.jsx("span",{className:"chip",children:n.plan})]}),n.organization&&s.jsx("div",{className:"extlist__meta",children:n.organization}),s.jsx("div",{className:"acctcard__dir found__dir",title:n.configDir,children:UT(n.configDir)}),u?s.jsxs("form",{className:"found__form",onSubmit:D,children:[s.jsx("label",{className:"field",htmlFor:`${C}-name`,children:"Название аккаунта"}),s.jsx("input",{id:`${C}-name`,className:"input",value:_,maxLength:em,autoFocus:!0,autoComplete:"off","aria-describedby":N?`${C}-taken`:void 0,onChange:G=>b(G.target.value)}),N&&s.jsx("p",{className:"account__note",id:`${C}-taken`,children:"Такое имя уже есть — хост откажет. Выберите другое."}),s.jsxs("label",{className:"acctform__check",children:[s.jsx("input",{type:"checkbox",checked:j,onChange:G=>v(G.target.checked)}),s.jsxs("span",{children:["Общая конфигурация (ссылки на ",s.jsx("code",{children:"~/.claude-shared"}),")",s.jsx("span",{className:"account__step acctform__checkhint",children:"Что именно делится, задаётся в Настройках. Файлы, которые уже лежат в подключаемой папке, не перезаписываются. Если часть настроек и данных плагинов включена в общие, они станут общими с другими аккаунтами."})]})]}),s.jsxs("div",{className:"extbar",children:[s.jsx("button",{type:"button",className:"btn",onClick:()=>m(!1),children:"Отмена"}),s.jsx("button",{type:"submit",className:"btn btn--primary",disabled:k==="",children:"Подключить"})]})]}):s.jsxs("div",{className:"found__actions",children:[s.jsx("button",{type:"button",className:"btn btn--primary btn--sm",onClick:()=>m(!0),children:"Подключить"}),s.jsxs("button",{type:"button",className:"btn btn--ghost btn--sm found__more","aria-expanded":p,"aria-controls":`${C}-more`,onClick:()=>g(G=>!G),children:["Ещё",s.jsx("svg",{viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",className:p?"is-open":"",children:s.jsx("path",{d:"m3 4.5 3 3 3-3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]})]}),p&&!u&&s.jsxs("div",{className:"found__menu",id:`${C}-more`,children:[s.jsx("button",{type:"button",className:"btn btn--sm",disabled:I,onClick:()=>o(n),children:"Сделать основным"}),s.jsx("span",{className:"account__note found__why",children:I?`Сначала закройте сессии основного аккаунта (${i.liveSessions}).`:`Основной аккаунт «${i.name}» будет брать вход из этой папки.`})]})]})}const qT="Вход выполняется в Настройках → Вход и выход Claude Code.",GT=120*1e3;function YT(n){const l=Math.max(1,Math.round((Date.now()-n)/6e4));if(l<60)return`${l} мин назад`;const i=Math.round(l/60);return i<48?`${i} ч назад`:`${Math.round(i/24)} дн. назад`}function VT({usage:n,settled:l}){if(!n)return s.jsx("p",{className:"account__note usage__state","aria-live":"polite",children:l?"Лимиты не получены — попробуем снова при следующем обновлении.":"Загружаем лимиты…"});if(!n.available)return s.jsx("p",{className:"account__note usage__state",children:"Лимиты недоступны: у этого способа входа нет окон плана."});const i=Date.now()-n.fetchedAt>GT;return s.jsxs("div",{className:"acctusage",children:[s.jsx(Xg,{usage:n,variant:"card"}),i&&s.jsxs("p",{className:"account__step acctusage__age",children:["Показания от ",YT(n.fetchedAt)]})]})}function XT({account:n,multi:l,status:i,usage:r,usageSettled:o,main:u,loginActive:m,actions:p,takenColors:g,onReconnect:_,reconnectBlocked:b,reconnectHint:j,onOpenLogin:v}){const[k,N]=x.useState(!1),E=n.id,C=_!==null&&(i==null?void 0:i.loggedIn)===!0,I=!l,D=!k&&s.jsx("button",{type:"button",className:"btn btn--ghost btn--sm",onClick:()=>N(!0),"aria-label":l?`Изменить аккаунт «${n.name}»`:"Изменить каталог аккаунта",children:l?"Изменить":"Изменить каталог"});return s.jsxs("section",{className:`acctcard acct--${n.color}${I?" acctcard--single":""}`,"aria-label":l?`Аккаунт «${n.name}»`:void 0,children:[l&&s.jsxs("header",{className:"acctcard__head",children:[s.jsx(Da,{account:n,size:"md"}),s.jsxs("div",{className:"acctcard__name",children:[s.jsx("span",{className:"acctcard__title",children:n.name}),n.main&&s.jsx("span",{className:"chip chip--mute",children:"основной"})]}),D]}),k?s.jsx(KT,{account:n,multi:l,main:u,takenColors:g,onSave:G=>{p.update(E,G),N(!1)},onMakeMain:()=>{p.makeMain(E),N(!1)},onRemove:()=>p.remove(E),onCancel:()=>N(!1)}):i===null?s.jsx("p",{className:"modal__text",children:"Спрашиваем у хоста…"}):i.loggedIn?s.jsxs("div",{className:"account",children:[s.jsx("div",{className:"account__id",children:i.email||"Вход выполнен"}),s.jsxs("div",{className:"account__chips",children:[s.jsx("span",{className:"chip chip--ok",children:FT[i.method]??i.method}),i.plan&&s.jsx("span",{className:"chip",children:i.plan})]}),i.organization&&s.jsx("div",{className:"extlist__meta",children:i.organization}),s.jsx(VT,{usage:r,settled:o})]}):s.jsxs("div",{className:"account__signedout",children:[s.jsx("p",{className:"modal__text",children:l?"Вход не выполнен. Сессии этого аккаунта не запустятся, пока вы в него не войдёте.":"Вход не выполнен. Сессии не запустятся, пока аккаунт не подключён."}),s.jsx("p",{className:"account__note",children:m?"Вход идёт — продолжите в Настройках.":qT}),s.jsx("button",{type:"button",className:"btn btn--sm",onClick:v,children:m?"Продолжить вход":"Открыть вход в Настройках"})]}),!k&&n.dir!==""&&s.jsxs("div",{className:"acctdir",children:[s.jsx("div",{className:"acctcard__dir",title:"Каталог конфигурации: вход, тариф, лимиты и транскрипты этого аккаунта",children:n.dir}),n.main&&n.configDir===null&&s.jsx("span",{className:"account__step",children:"унаследован из окружения"}),I&&s.jsx("div",{className:"acctdir__edit",children:D})]}),C&&!k&&s.jsxs(s.Fragment,{children:[b&&s.jsx("p",{className:"account__note",children:j}),s.jsx("div",{className:"extbar account__bar",children:s.jsxs("button",{type:"button",className:"btn account__relink",title:`Переподключить сессию
155
+ ${j}`,"aria-label":"Переподключить сессию",disabled:b,onClick:_??void 0,children:[s.jsx(ZT,{}),"Переподключить"]})})]})]})}const FT={"claude.ai":"подписка Claude",console:"Anthropic Console",apiKey:"API-ключ",none:"нет"};function yv({value:n,taken:l,onChange:i}){function r(o){const u=o.key==="ArrowRight"||o.key==="ArrowDown"?1:o.key==="ArrowLeft"||o.key==="ArrowUp"?-1:0;if(u===0)return;o.preventDefault();const m=Ji.indexOf(n),p=Ji[(m+u+Ji.length)%Ji.length];if(p){i(p);const g=o.currentTarget;window.requestAnimationFrame(()=>{var _;return(_=g.querySelector(`[data-color="${p}"]`))==null?void 0:_.focus()})}}return s.jsx("div",{className:"colorpick",role:"radiogroup","aria-label":"Цвет аккаунта",onKeyDown:r,children:Ji.map(o=>{const u=o===n;return s.jsx("button",{type:"button",role:"radio","aria-checked":u,"aria-label":Sh[o],title:l.includes(o)?`${Sh[o]} — уже у другого аккаунта`:Sh[o],"data-color":o,tabIndex:u?0:-1,className:`colorpick__item acct--${o}${u?" is-selected":""}`,onClick:()=>i(o),children:u&&s.jsx("svg",{viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:s.jsx("path",{d:"M2.6 6.3 5 8.6l4.4-5",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})},o)})})}const em=40;function KT({account:n,multi:l,main:i,takenColors:r,onSave:o,onMakeMain:u,onRemove:m,onCancel:p}){const[g,_]=x.useState(n.name),[b,j]=x.useState(n.color),[v,k]=x.useState(n.dir),[N,E]=x.useState(!1),[C,I]=x.useState(!1),D=g.trim(),G=v.trim(),P=G!==""&&G!==n.dir,V=D!==n.name||b!==n.color||P,z=n.liveSessions,H=z>0,te=`acct-edit-${n.id}`,F=!n.main&&i!==void 0,fe=z>0||((i==null?void 0:i.liveSessions)??0)>0,Q=!n.main;function X(ge){ge.preventDefault(),!(l&&D===""||!V)&&o({...D!==n.name?{name:D}:{},...b!==n.color?{color:b}:{},...P?{configDir:G}:{}})}return s.jsxs("div",{className:"acctform",children:[s.jsxs("form",{className:"extform acctform__fields",onSubmit:X,children:[l&&s.jsxs(s.Fragment,{children:[s.jsx("label",{className:"field",htmlFor:`${te}-name`,children:"Имя"}),s.jsx("input",{id:`${te}-name`,className:"input",value:g,maxLength:em,autoFocus:!0,autoComplete:"off",onChange:ge=>_(ge.target.value)}),s.jsx("span",{className:"field",children:"Цвет"}),s.jsx(yv,{value:b,taken:r,onChange:j})]}),s.jsx("label",{className:"field",htmlFor:`${te}-dir`,children:"Каталог конфигурации"}),s.jsx("input",{id:`${te}-dir`,className:"input input--mono",value:v,disabled:H,spellCheck:!1,autoComplete:"off",autoFocus:!l,placeholder:"~/.claude","aria-describedby":`${te}-dirnote`,onChange:ge=>k(ge.target.value)}),s.jsx("p",{className:"account__step acctform__note",id:`${te}-dirnote`,children:H?`Каталог нельзя менять, пока у аккаунта есть живые сессии (${z}) — сначала закройте их.`:"Здесь лежат вход, тариф и история аккаунта. Файлы не переносятся: аккаунт начнёт брать вход из новой папки."}),n.main&&n.configDir!==null&&s.jsx("button",{type:"button",className:"btn btn--sm acctform__inherit",disabled:H,onClick:()=>o({configDir:null}),children:"Вернуть унаследованный"}),s.jsxs("div",{className:"extbar",children:[s.jsx("button",{type:"button",className:"btn",onClick:p,children:"Отмена"}),s.jsx("button",{type:"submit",className:"btn btn--primary",disabled:l&&D===""||!V,children:"Сохранить"})]})]}),F&&s.jsxs("div",{className:"acctform__zone",children:[s.jsx("h4",{className:"acctform__zonetitle",children:"Основной аккаунт"}),s.jsx("p",{className:"account__note",children:`Аккаунты поменяются местами: «Основной» станет «${n.name}» и наоборот — каталог, имя и цвет. Файлы не переносятся.`}),fe?s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"btn btn--sm",disabled:!0,children:"Сделать основным"}),s.jsx("p",{className:"account__note acctform__why",children:z>0&&((i==null?void 0:i.liveSessions)??0)>0?`Сначала закройте сессии обоих аккаунтов: этого (${z}) и основного (${i==null?void 0:i.liveSessions}).`:z>0?`Сначала закройте сессии этого аккаунта (${z}).`:`Сначала закройте сессии основного аккаунта (${i==null?void 0:i.liveSessions}).`})]}):N?s.jsxs("div",{className:"extbar",children:[s.jsx("button",{type:"button",className:"btn btn--sm",onClick:()=>E(!1),children:"Отмена"}),s.jsx("button",{type:"button",className:"btn btn--primary btn--sm",autoFocus:!0,onClick:u,children:"Поменять местами"})]}):s.jsx("button",{type:"button",className:"btn btn--sm",onClick:()=>E(!0),children:"Сделать основным"})]}),Q&&s.jsxs("div",{className:"acctform__zone",children:[s.jsx("h4",{className:"acctform__zonetitle",children:"Убрать аккаунт"}),z>0?s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"btn btn--danger btn--sm",disabled:!0,children:"Убрать из списка"}),s.jsx("p",{className:"account__note acctform__why",children:`Сначала закройте сессии этого аккаунта (${z}).`})]}):C?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"account__note",role:"alert",children:`Убрать аккаунт «${n.name}» из списка? Его каталог ${n.dir} останется на диске, вход в нём сохранится.`}),s.jsxs("div",{className:"extbar",children:[s.jsx("button",{type:"button",className:"btn btn--sm",onClick:()=>I(!1),children:"Отмена"}),s.jsx("button",{type:"button",className:"btn btn--danger btn--sm",autoFocus:!0,onClick:m,children:"Убрать из списка"})]})]}):s.jsx("button",{type:"button",className:"btn btn--danger btn--sm",onClick:()=>I(!0),children:"Убрать из списка"})]})]})}function QT({accounts:n,onAdd:l,onCancel:i}){const r=n.map(N=>N.color),[o,u]=x.useState(""),[m,p]=x.useState(()=>Ji.find(N=>!r.includes(N))??Ji[1]),[g,_]=x.useState(""),[b,j]=x.useState(!0),v=o.trim();function k(N){N.preventDefault(),v!==""&&l(v,m,g.trim()===""?null:g.trim(),b)}return s.jsxs("form",{className:"extform extform--card acctform",onSubmit:k,children:[s.jsx("label",{className:"field",htmlFor:"acct-new-name",children:"Название аккаунта"}),s.jsx("input",{id:"acct-new-name",className:"input",value:o,maxLength:em,placeholder:"Например, Работа",autoFocus:!0,autoComplete:"off",onChange:N=>u(N.target.value)}),s.jsx("span",{className:"field",children:"Цвет"}),s.jsx(yv,{value:m,taken:r,onChange:p}),s.jsxs("details",{className:"account__fallback acctform__dir",children:[s.jsx("summary",{children:"Каталог конфигурации"}),s.jsx("label",{className:"field",htmlFor:"acct-new-dir",children:"Путь к каталогу"}),s.jsx("input",{id:"acct-new-dir",className:"input input--mono",value:g,spellCheck:!1,autoComplete:"off",placeholder:"~/.claude-ccv-…",onChange:N=>_(N.target.value)}),s.jsxs("p",{className:"account__step",children:["Если оставить пустым, хост создаст отдельный каталог ",s.jsx("code",{children:"~/.claude-ccv-…"})," сам."]})]}),s.jsxs("label",{className:"acctform__check",children:[s.jsx("input",{type:"checkbox",checked:b,onChange:N=>j(N.target.checked)}),s.jsxs("span",{children:["Общая конфигурация (ссылки на ",s.jsx("code",{children:"~/.claude-shared"}),")",s.jsxs("span",{className:"account__step acctform__checkhint",children:["Аккаунт получит ссылки на общую папку, а не копии. Что именно делится, задаётся в Настройках. Вход, лимиты, переписка и ",s.jsx("code",{children:".claude.json"})," остаются отдельными. Если в общие включены настройки и плагины, их данные (в том числе токены плагинов) станут общими с другими аккаунтами."]})]})]}),s.jsxs("p",{className:"account__step",children:[b?"Новый аккаунт начнётся с общей конфигурации из Настроек.":"Новый аккаунт начнётся с чистого листа: своя конфигурация, плагины и CLAUDE.md."," ","Если в папке ещё нет входа, войдите в него отдельно — в Настройках, в разделе «Вход и выход Claude Code»."]}),s.jsxs("div",{className:"extbar",children:[s.jsx("button",{type:"button",className:"btn",onClick:i,children:"Отмена"}),s.jsx("button",{type:"submit",className:"btn btn--primary",disabled:v==="",children:"Добавить"})]})]})}function ZT(){return s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("path",{d:"M14 8a6 6 0 1 1-6-6c1.68 0 3.29.67 4.49 1.83L14 5.33"}),s.jsx("path",{d:"M14 2v3.33h-3.33"})]})}function PT({state:n,onPair:l,onUnpair:i,onClose:r}){const[o,u]=x.useState(""),[m,p]=x.useState(""),[g,_]=x.useState(!1),b=x.useRef(null),j=(n==null?void 0:n.paired)===!0;x.useEffect(()=>{var k;j||(k=b.current)==null||k.focus()},[j]),x.useEffect(()=>{_(!1),j&&u("")},[j,n==null?void 0:n.error]);const v=(n==null?void 0:n.url)??"https://claudevisual.com";return s.jsx(zn,{title:"Удалённый доступ",onClose:r,children:j?s.jsxs("div",{className:"relay",children:[s.jsxs("p",{className:"relay__lede",children:["Компьютер связан с аккаунтом на ",s.jsx("b",{children:yy(v)}),". Открывайте его оттуда с любого устройства — с телефона в том числе."]}),s.jsxs("dl",{className:"relay__facts",children:[s.jsxs("div",{children:[s.jsx("dt",{children:"Имя"}),s.jsx("dd",{children:(n==null?void 0:n.name)??"—"})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Связь"}),s.jsxs("dd",{children:[s.jsx("span",{className:n!=null&&n.connected?"dot dot--on":"dot"})," ",n!=null&&n.connected?"на связи":"нет связи, пробуем переподключиться"]})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Подключено"}),s.jsxs("dd",{children:[(n==null?void 0:n.clients)??0," вкладок"]})]})]}),(n==null?void 0:n.error)&&s.jsx("p",{className:"relay__error",children:n.error}),s.jsx("p",{className:"relay__note",children:"Терминал с удалённых устройств настраивается в настройках приложения, раздел «Терминал»."}),s.jsx("p",{className:"relay__note",children:"Отвязка гасит токен этой машины: чтобы вернуть доступ, понадобится новый код. Сессии Claude Code это не трогает."}),s.jsx("button",{className:"btn btn--danger",onClick:i,children:"Отвязать компьютер"})]}):s.jsxs("div",{className:"relay",children:[s.jsx("p",{className:"relay__lede",children:"Чтобы работать с этим компьютером из браузера и с телефона, свяжите его с аккаунтом."}),s.jsxs("ol",{className:"relay__steps",children:[s.jsxs("li",{children:["Откройте ",s.jsx("b",{children:yy(v)})," и войдите (или зарегистрируйтесь)."]}),s.jsxs("li",{children:["Нажмите ",s.jsx("b",{children:"«Подключить ПК»"})," — появится код из восьми знаков."]}),s.jsx("li",{children:"Введите его сюда."})]}),s.jsxs("form",{className:"relay__form",onSubmit:k=>{k.preventDefault(),o.trim()&&(_(!0),l(o.trim(),m.trim()))},children:[s.jsxs("label",{className:"field",children:[s.jsx("span",{children:"Код сопряжения"}),s.jsx("input",{ref:b,className:"input relay__code",value:o,onChange:k=>u(k.target.value.toUpperCase()),placeholder:"XXXX-XXXX",autoComplete:"off",spellCheck:!1,maxLength:12})]}),s.jsxs("label",{className:"field",children:[s.jsx("span",{children:"Как назвать этот компьютер"}),s.jsx("input",{className:"input",value:m,onChange:k=>p(k.target.value),placeholder:"имя машины",autoComplete:"off",maxLength:64})]}),(n==null?void 0:n.error)&&s.jsx("p",{className:"relay__error",children:n.error}),s.jsx("button",{className:"btn btn--primary",type:"submit",disabled:!o.trim()||g,children:g?"Связываем…":"Связать"})]})]})})}function yy(n){try{return new URL(n).host}catch{return n}}const WT={active:!1,url:"",awaitingCode:!1,output:"",error:null},JT={"claude.ai":"подписка Claude",console:"Anthropic Console",apiKey:"API-ключ",none:"нет"};function eA({accounts:n,auth:l,logins:i,actions:r,remote:o,runningByAccount:u,focusAccountId:m}){return s.jsx("div",{className:"loginlist",children:n.map(p=>s.jsx(tA,{account:p,status:l[p.id]??null,login:i[p.id]??WT,actions:r,remote:o,running:u[p.id]??0,focused:p.id===m},p.id))})}function tA({account:n,status:l,login:i,actions:r,remote:o,running:u,focused:m}){const[p,g]=x.useState(""),[_,b]=x.useState(!1),[j,v]=x.useState(!1),k=x.useRef(null),N=n.id;x.useEffect(()=>{var G;m&&((G=k.current)==null||G.scrollIntoView({block:"nearest"}))},[m]);const E=x.useMemo(()=>{if(i.error)return{ok:!1,message:i.error};const G=i.output.trim();return G===""?null:{ok:!0,message:G}},[i.error,i.output]);function C(G=p){const P=G.trim();P!==""&&(r.submitCode(N,P),g(""))}function I(){if(u>0){b(!1),v(!0);return}r.login(N,"claudeai",!0)}const D=(l==null?void 0:l.loggedIn)===!0;return s.jsxs("section",{ref:k,className:`acctcard logincard acct--${n.color}${m?" is-focused":""}`,"aria-label":`Вход аккаунта «${n.name}»`,children:[s.jsxs("header",{className:"acctcard__head",children:[s.jsx(Da,{account:n,size:"md"}),s.jsxs("div",{className:"acctcard__name",children:[s.jsx("span",{className:"acctcard__title",children:n.name}),n.main&&s.jsx("span",{className:"chip chip--mute",children:"основной"})]}),s.jsx("span",{className:`chip ${l===null?"chip--mute":D?"chip--ok":"chip--warn"}`,children:l===null?"проверяем":D?"вошёл":"не вошёл"})]}),D&&s.jsx("div",{className:"logincard__who",children:[l.email||"Вход выполнен",l.plan,JT[l.method]??l.method].filter(Boolean).join(" · ")}),i.active?s.jsx(sA,{login:i,remote:o,code:p,onCode:g,onSubmit:C,onCancel:()=>r.cancel(N),inputId:`auth-code-${N}`}):s.jsxs(s.Fragment,{children:[s.jsx(ec,{result:E}),(j||_)&&u>0&&s.jsx("p",{className:"account__warn",role:"alert",children:nA(u)}),s.jsx("div",{className:"extbar logincard__bar",children:D?s.jsxs(s.Fragment,{children:[j?s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"btn",onClick:()=>v(!1),children:"Отмена"}),s.jsx("button",{type:"button",className:"btn btn--warn",autoFocus:!0,onClick:()=>{v(!1),r.login(N,"claudeai",!0)},children:"Всё равно сменить"})]}):s.jsx("button",{type:"button",className:"btn",onClick:I,children:"Сменить аккаунт"}),_?s.jsx("button",{type:"button",className:"btn btn--danger",autoFocus:!0,onClick:()=>{b(!1),r.logout(N)},children:"Точно выйти?"}):s.jsx("button",{type:"button",className:"btn",onClick:()=>{v(!1),b(!0)},children:"Выйти"})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"btn",onClick:()=>r.login(N,"console",!1),children:"Через Console"}),s.jsx("button",{type:"button",className:"btn btn--primary",onClick:()=>r.login(N,"claudeai",!1),children:"Войти"})]})})]})]})}function nA(n){const l=n%10,i=n%100,r=l===1&&i!==11,o=r?"сессия":l>=2&&l<=4&&(i<12||i>14)?"сессии":"сессий";return`${n} ${o} сейчас ${r?"работает":"работают"} — смена аккаунта может ${r?"её":"их"} прервать.`}function sA({login:n,remote:l,code:i,onCode:r,onSubmit:o,onCancel:u,inputId:m}){var E;const[p,g]=x.useState(null),_=x.useRef(""),b=x.useRef({code:i,onCode:r,onSubmit:o});b.current={code:i,onCode:r,onSubmit:o};const j=x.useCallback(async C=>{const{code:I,onCode:D,onSubmit:G}=b.current;if(C&&I.trim()!=="")return;const P=await cg();if(P===null){C||g("Не получилось прочитать буфер — вставьте код в поле руками.");return}const V=P.trim();if(!vy(V)){C||g("В буфере не похоже на код: нужен он целиком, вместе с частью после «#». Подойдёт и адрес страницы, на которую увёл браузер, — его тоже разберём.");return}if(C){if(_.current===V)return;_.current=V}g(null),D(V),G(V)},[]);x.useEffect(()=>{if(!n.awaitingCode)return;const C=()=>{document.visibilityState==="visible"&&j(!0)};return document.addEventListener("visibilitychange",C),()=>document.removeEventListener("visibilitychange",C)},[n.awaitingCode,j]);const v=typeof((E=navigator.clipboard)==null?void 0:E.readText)=="function",k=i.trim()!==""&&!vy(i),N=p??(k?"Похоже, скопирована только часть кода — нужен он целиком, вместе с частью после «#».":null);return s.jsxs("div",{className:"account__flow",children:[n.url?l?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"field",children:"Подтвердите вход на странице Anthropic"}),s.jsx("a",{className:"btn btn--primary account__go",href:n.url,target:"_blank",rel:"noreferrer",children:"Открыть страницу входа"}),s.jsx("p",{className:"account__step",children:"После кнопки «Authorize» там появится код — скопируйте его и вернитесь сюда."}),s.jsxs("div",{className:"account__raw",children:[s.jsx("span",{className:"account__rawurl",children:n.url}),s.jsx(tr,{text:n.url,hint:"ссылку входа"})]})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"field",children:"Подтвердите вход в открывшемся браузере"}),s.jsx("p",{className:"account__step",children:"Хост открыл страницу входа на этом же компьютере — там достаточно нажать «Authorize», остальное произойдёт само."}),s.jsxs("details",{className:"account__fallback",children:[s.jsx("summary",{children:"Браузер не открылся"}),s.jsx("p",{className:"account__step",children:"Тогда откройте ссылку сами: страница покажет код, и его нужно будет вставить ниже."}),s.jsx("a",{className:"account__link",href:n.url,target:"_blank",rel:"noreferrer",children:n.url})]})]}):s.jsx("p",{className:"modal__text",children:"Запускаем вход…"}),n.awaitingCode&&s.jsxs(s.Fragment,{children:[s.jsx("label",{className:"field",htmlFor:m,children:"Код со страницы авторизации"}),s.jsxs("div",{className:"extform__row account__coderow",children:[s.jsx("input",{id:m,className:"input input--mono",value:i,autoFocus:!l,spellCheck:!1,autoComplete:"off",placeholder:"код#state",onChange:C=>{g(null),r(C.target.value)},onKeyDown:C=>{C.key==="Enter"&&(C.preventDefault(),o())}}),v&&s.jsx("button",{type:"button",className:"btn",onClick:()=>void j(!1),children:"Вставить код"}),s.jsx("button",{type:"button",className:"btn btn--primary",disabled:i.trim()==="",onClick:()=>o(),children:"Готово"})]}),N&&s.jsx("p",{className:"account__note account__note--code",children:N})]}),n.output.trim()!==""&&s.jsx("pre",{className:"account__log",children:n.output.trim()}),s.jsx("div",{className:"extbar",children:s.jsx("button",{className:"btn",onClick:u,children:"Отменить вход"})})]})}function vy(n){const l=n.trim();if(/^https?:\/\//i.test(l))return/[?#&]code=/.test(l);const[i,r]=l.split("#");return!!i&&!!r&&!/\s/.test(l)}function lA(){const n=bu(),l=ZS(),[i,r]=x.useState(tv),o=lv("sample"),u=x.useMemo(()=>{const p=_=>_.toLowerCase().startsWith("ru")?0:_.toLowerCase().startsWith("en")?1:2,g=[...l].sort((_,b)=>p(_.lang)-p(b.lang)||_.name.localeCompare(b.name));return[{value:"",label:"Автоматически",hint:"Русский или английский — по языку текста"},...g.map(_=>({value:_.voiceURI,label:_.name,hint:_.lang}))]},[l]);function m(p){const g={...i,...p};r(g),XS(g)}return s.jsxs("section",{className:"settings__section",children:[s.jsx("h3",{className:"settings__heading",children:"Озвучка"}),s.jsx("p",{className:"settings__hint",children:"Кнопка «Озвучить» под ответом читает его вслух голосом браузера. Код и таблицы не читаются, вместо блока кода звучит «блок кода»."}),n?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"settings__field",children:[s.jsx("span",{className:"settings__field-label",children:"Голос"}),s.jsx(rl,{className:"settings__select",value:i.voice,options:u,onChange:p=>m({voice:p}),ariaLabel:"Голос озвучки"})]}),s.jsxs("div",{className:"settings__field",children:[s.jsx("span",{className:"settings__field-label",children:"Скорость"}),s.jsxs("div",{className:"voicerate",children:[s.jsx("input",{type:"range",className:"voicerate__range",min:qp.min,max:qp.max,step:qp.step,value:i.rate,"aria-label":"Скорость озвучки",onChange:p=>m({rate:Number(p.target.value)})}),s.jsxs("span",{className:"voicerate__value",children:[i.rate.toFixed(2).replace(/0$/,""),"×"]})]})]}),s.jsx("div",{children:s.jsx("button",{type:"button",className:"btn",onClick:()=>o?Hg():JS(i),children:o?"Остановить":"Проверить"})})]}):s.jsx("p",{className:"settings__hint",children:"Этот браузер не умеет синтезировать речь."})]})}const jy=[{id:"claude",label:"Claude",hint:"Claude Code"},{id:"antigravity",label:"Antigravity",hint:"Google agy"},{id:"codex",label:"Codex",hint:"OpenAI Codex"}],aA=[{id:"skills",label:"Скиллы",hint:"Читаются Claude Code, безопасно делить."},{id:"agents",label:"Агенты",hint:"Читаются Claude Code, безопасно делить."},{id:"commands",label:"Команды",hint:"Читаются Claude Code, безопасно делить."},{id:"hooks",label:"Хуки",hint:"Читаются Claude Code, безопасно делить."},{id:"output-styles",label:"Стили вывода",hint:"Читаются Claude Code, безопасно делить."},{id:"plugins",label:"Плагины",hint:"Вместе с данными плагинов — в них могут лежать токены."},{id:"CLAUDE.md",label:"CLAUDE.md",hint:"Общие инструкции."},{id:"settings.json",label:"settings.json",hint:"Модель, права, хуки, список плагинов: изменение в одном аккаунте сразу видно в другом. Ссылку Claude Code может заменить обычным файлом."},{id:"keybindings.json",label:"keybindings.json",hint:"Сочетания клавиш."}],iA=[{label:"Вход и токены (.credentials.json)",why:"У каждого аккаунта свой."},{label:".claude.json",why:"В нём личность вошедшего и пользовательские MCP-серверы: общий файл смешал бы аккаунты."},{label:"История сессий и лимиты",why:"У каждого аккаунта своя."}],Fp="",rA=[{value:"opus",label:"Opus",hint:"полный список моделей виден, когда открыта сессия"},{value:"sonnet",label:"Sonnet",hint:"полный список моделей виден, когда открыта сессия"},{value:"haiku",label:"Haiku",hint:"полный список моделей виден, когда открыта сессия"}],cA=Ng.map(n=>({value:n.value,label:n.value,hint:n.hint})),jh=3600*1e3,oA=[{value:"6h",label:"6 часов"},{value:"24h",label:"Сутки"},{value:"48h",label:"Двое суток"},{value:"168h",label:"Неделя"},{value:"never",label:"Никогда"}],nu={"6h":6*jh,"24h":24*jh,"48h":48*jh,"168h":168*jh,never:0};function uA(n){return nu[n]??nu["48h"]}const dA=[{value:"5m",label:"5 минут"},{value:"10m",label:"10 минут"},{value:"30m",label:"30 минут"},{value:"60m",label:"Час"},{value:"never",label:"Никогда"}],Nh=60*1e3,su={"5m":5*Nh,"10m":10*Nh,"30m":30*Nh,"60m":60*Nh,never:0};function fA(n){return su[n]??su["10m"]}function hA(n){const l=Object.entries(su).find(([,i])=>i===n);return l?l[0]:Object.keys(su).reduce((i,r)=>Math.abs(su[r]-n)<Math.abs(su[i]-n)?r:i)}function mA(n){const l=Object.entries(nu).find(([,i])=>i===n);return l?l[0]:Object.keys(nu).reduce((i,r)=>Math.abs(nu[r]-n)<Math.abs(nu[i]-n)?r:i)}const pA=[{value:"off",label:"Выключено"},{value:"500",label:"0.5 с"},{value:"1500",label:"1.5 с"},{value:"3000",label:"3 с"},{value:"10000",label:"10 с"}],lu={off:0,500:500,1500:1500,3e3:3e3,1e4:1e4};function gA(n){return lu[n]??lu.off}function Ny(n){return Number.isFinite(n)?Math.min(100,Math.max(0,Math.round(n))):0}function xA(n){const l=Object.entries(lu).find(([,i])=>i===n);return l?l[0]:Object.keys(lu).reduce((i,r)=>Math.abs(lu[r]-n)<Math.abs(lu[i]-n)?r:i)}const _A=[{value:"project",title:"Только текущий проект",description:"Агент молча пишет файлы в открытом проекте и в ~/.claude — настройках самого Claude Code. Чужой проект и любая новая папка — только с явного разрешения."},{value:"projects",title:"Папка с проектами",description:"То же плюс каталог, где лежат открытые проекты, — то есть и соседний проект тоже. Всё остальное — с разрешения."},{value:"all",title:"Все папки на компьютере",description:"Агент пишет файлы куда угодно на диске — вопросов про место записи не будет.",risky:!0}];function bA({settings:n,models:l,relayState:i,networkState:r,local:o,onChange:u,onEnableShell:m,onDisableShell:p,onOpenRelay:g,claudeLogin:_,projectsRootHint:b,onClose:j}){const v=x.useRef(null),k=n===null,N=_.focusAccountId!==null;x.useEffect(()=>{var L;N&&((L=v.current)==null||L.scrollIntoView({block:"start"}))},[N]);const E=(n==null?void 0:n.projectsRoot)??"",[C,I]=x.useState(E);x.useEffect(()=>I(E),[E]);function D(){const L=C.trim();L!==E&&u({projectsRoot:L===""?null:L})}const[G,P]=x.useState(""),[V,z]=x.useState(null),H=!k&&n.networkGuardEnabled,te=(n==null?void 0:n.networkGuardBlockedCountries)??[];function F(){const L=G.trim().toUpperCase();if(L!==""){if(!/^[A-Z]{2}$/.test(L)){z("Нужен код из двух латинских букв, например RU или CN.");return}if(te.includes(L)){z(`Код ${L} уже в списке.`);return}z(null),P(""),u({networkGuardBlockedCountries:[...te,L]})}}const fe=!k&&n.terminalEnabled===!0,Q=!k&&n.liveSessionsFirst===!0,X=!fe,ge=x.useMemo(()=>{const L=[{value:Fp,label:"Как в Claude Code",hint:"модель определят настройки самого Claude Code"},...l.length>0?l.map(M=>({value:M.value,label:M.displayName,hint:M.description})):rA];return n&&n.startModel!==null&&!L.some(M=>M.value===n.startModel)&&L.push({value:n.startModel,label:n.startModel}),L},[l,n]);function U(){var L,M;return(i==null?void 0:i.paired)!==!0?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"settings__hint",children:"Компьютер не связан с аккаунтом — включать удалённый доступ пока не к чему: без пары ни телефон, ни другое устройство этот компьютер вообще не видят."}),s.jsx("button",{type:"button",className:"btn",disabled:X,onClick:g,children:"Связать компьютер"})]}):(L=i.shell)!=null&&L.enabled?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"settings__hint",children:["Разрешён: с телефона и любого другого устройства этого аккаунта можно открыть терминал и выполнить на этом компьютере что угодно — как если бы сидели за ним.",i.shell.confirmedAt&&` Включено ${new Date(i.shell.confirmedAt).toLocaleString()}.`]}),s.jsx("button",{type:"button",className:"btn btn--danger",disabled:X,onClick:p,children:"Запретить"})]}):(M=i.shell)!=null&&M.pending?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"settings__hint",children:["Письмо ушло на ",s.jsx("b",{children:i.shell.email}),". Перейдите по ссылке из него — терминал заработает удалённо."]}),s.jsx("p",{className:"settings__hint",children:"Повторная отправка ограничена раз в минуту — если жали кнопку только что, письмо не придёт и от повторного нажатия тоже. Если сейчас доберётесь до самого компьютера, там разрешение включится сразу, без письма."}),s.jsx("button",{type:"button",className:"btn",disabled:X,onClick:m,children:"Отправить письмо ещё раз"})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"settings__hint",children:"Сейчас с телефона можно смотреть разговоры и файлы, но не запускать команды. Разрешение даёт полный доступ к терминалу этого компьютера: с телефона станет можно выполнить любую команду, как в обычной консоли за этой машиной."}),o?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"settings__hint",children:"Включится сразу — вы уже за этим компьютером, подтверждать доступ к нему нечем и незачем."}),s.jsx("button",{type:"button",className:"btn",disabled:X,onClick:m,children:"Разрешить с телефона"})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"settings__hint",children:"Отсюда мгновенно не включится: на почту аккаунта уйдёт письмо, и терминал заработает только после перехода по ссылке из него."}),s.jsx("button",{type:"button",className:"btn",disabled:X,onClick:m,children:"Прислать письмо"})]})]})}return s.jsx(zn,{title:"Настройки",onClose:j,children:s.jsxs("div",{className:"settings",children:[s.jsxs("section",{className:"settings__section",children:[s.jsx("h3",{className:"settings__heading",children:"Архивация молчащих сессий"}),s.jsx("p",{className:"settings__hint",children:"Сессия, к которой долго не возвращались, сама уезжает в архив — на диске ничего не удаляется, транскрипт остаётся, и её можно вернуть обратно в любой момент."}),k?s.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):s.jsx(rl,{className:"settings__select",value:mA(n.autoArchiveAfterMs),options:oA,onChange:L=>u({autoArchiveAfterMs:uA(L)}),ariaLabel:"Через сколько молчащая сессия уезжает в архив"})]}),s.jsxs("section",{className:"settings__section",children:[s.jsx("h3",{className:"settings__heading",children:"Останавливать простаивающие сессии через"}),s.jsx("p",{className:"settings__hint",children:"Простаивающая живая сессия сама отпускает процесс CLI — освобождает память компьютера, на котором стоит хост. Простой — это когда сессия ничего не делает (не работает, не ждёт разрешения, фоновых задач нет), в ней ничего не происходит и ни в одном открытом окне не висит недописанный черновик для неё. Разговор при этом никуда не девается: открытая заново сессия, как и отправленное в неё сообщение, продолжают с того же места."}),k?s.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):s.jsx(rl,{className:"settings__select",value:hA(n.autoStopAfterMs),options:dA,onChange:L=>u({autoStopAfterMs:fA(L)}),ariaLabel:"Останавливать простаивающие сессии через"})]}),s.jsxs("section",{className:"settings__section",children:[s.jsx("h3",{className:"settings__heading",children:"Корень проектов"}),s.jsx("p",{className:"settings__hint",children:"Папки проектов в боковой панели — настоящие каталоги внутри этого корня, а перенос проекта в папку переносит его каталог на диске. Пусто — корень выбирается автоматически."}),k?s.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):s.jsx("input",{className:"input input--mono",value:C,spellCheck:!1,autoComplete:"off",placeholder:b??"Автоматически","aria-label":"Корень проектов",onChange:L=>I(L.target.value),onBlur:D,onKeyDown:L=>{L.key==="Enter"&&(L.preventDefault(),D())}})]}),s.jsxs("section",{className:"settings__section",children:[s.jsx("h3",{className:"settings__heading",children:"Остановка у лимита плана"}),s.jsx("p",{className:"settings__hint",children:"Когда расход окна лимита доходит до этого порога, хост прерывает все живые сессии Claude, сохраняет хэндофф у занятых и останавливает их — разговор остаётся на диске, а хэндофф показывается баннером в открытой сессии. Antigravity и Codex эта настройка не касается."}),s.jsxs("div",{className:"settings__field",children:[s.jsx("span",{className:"settings__field-label",children:"Остановка у 5-часового лимита, %"}),k?s.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):s.jsxs("div",{className:"settings__pct",children:[s.jsx("input",{type:"number",className:"input settings__pct-input",min:0,max:100,step:1,value:n.limitStopFiveHourPct,onChange:L=>u({limitStopFiveHourPct:Ny(L.target.valueAsNumber)}),"aria-label":"Остановка у 5-часового лимита, %"}),s.jsx("span",{className:"settings__pct-suffix",children:"%"})]}),s.jsx("p",{className:"settings__hint",children:"0 — не останавливать."})]}),s.jsxs("div",{className:"settings__field",children:[s.jsx("span",{className:"settings__field-label",children:"Остановка у недельного лимита, %"}),k?s.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):s.jsxs("div",{className:"settings__pct",children:[s.jsx("input",{type:"number",className:"input settings__pct-input",min:0,max:100,step:1,value:n.limitStopSevenDayPct,onChange:L=>u({limitStopSevenDayPct:Ny(L.target.valueAsNumber)}),"aria-label":"Остановка у недельного лимита, %"}),s.jsx("span",{className:"settings__pct-suffix",children:"%"})]}),s.jsx("p",{className:"settings__hint",children:"0 — не останавливать."})]})]}),s.jsxs("section",{className:"settings__section",children:[s.jsxs("div",{className:"settings__switch-row",children:[s.jsxs("div",{className:"settings__switch-copy",children:[s.jsx("h3",{className:"settings__heading",children:"Kill switch: останавливать агентов, если упал VPN"}),s.jsx("p",{className:"settings__hint",children:"Если VPN отключился, ccv сразу останавливает всех агентов и не даёт отправлять сообщения, пока VPN не вернётся. Как определяем: смотрим, из какой страны Anthropic видит запросы — страна из списка ниже или неудачная проверка считаются падением VPN. Сессии остаются открытыми и продолжатся после возврата VPN. Kill switch самого VPN-клиента это не заменяет — его тоже стоит включить."})]}),k?s.jsx("div",{className:"settings__switch-skeleton","aria-hidden":"true"}):s.jsx("button",{type:"button",role:"switch","aria-checked":H,"aria-label":"Kill switch: останавливать агентов, если упал VPN",className:H?"switch is-on":"switch",onClick:()=>u({networkGuardEnabled:!H}),children:s.jsx("span",{className:"switch__knob"})})]}),H&&r&&s.jsx("p",{className:r.status==="blocked"?"settings__hint settings__netstatus is-bad":"settings__hint settings__netstatus",children:r.status==="blocked"?r.reason??"Маршрут не прошёл проверку.":r.country?`Сейчас: ${r.country} — всё в порядке.`:"Сейчас всё в порядке."}),s.jsxs("div",{className:H?"settings__field":"settings__field settings__nested is-disabled",children:[s.jsx("span",{className:"settings__field-label",children:"Запрещённые страны"}),s.jsxs("ul",{className:"countries","aria-label":"Запрещённые страны",children:[te.map(L=>s.jsxs("li",{className:"countries__chip",children:[s.jsx("span",{children:L}),s.jsx("button",{type:"button",className:"countries__remove","aria-label":`Убрать ${L} из списка`,disabled:!H,onClick:()=>u({networkGuardBlockedCountries:te.filter(M=>M!==L)}),children:"×"})]},L)),te.length===0&&s.jsx("li",{className:"settings__hint",children:"Список пуст: блокировать будет только сбой проверки."})]}),s.jsxs("form",{className:"countries__add",onSubmit:L=>{L.preventDefault(),F()},children:[s.jsx("input",{type:"text",className:"input countries__input",value:G,maxLength:2,placeholder:"RU",autoCapitalize:"characters",spellCheck:!1,disabled:!H,"aria-label":"Код страны, две буквы","aria-invalid":V!==null,onChange:L=>{P(L.target.value.toUpperCase()),z(null)}}),s.jsx("button",{type:"submit",className:"btn",disabled:!H||G.trim()==="",children:"Добавить"})]}),V&&s.jsx("p",{className:"settings__hint countries__error",role:"alert",children:V})]})]}),s.jsxs("section",{className:"settings__section",children:[s.jsx("h3",{className:"settings__heading",children:"Автосохранение"}),s.jsx("p",{className:"settings__hint",children:"Открытый файл сам уезжает на диск, если немного постоять без ввода — ручное сохранение, кнопкой или Ctrl+S, при этом всегда работает как обычно, независимо от этой настройки."}),k?s.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):s.jsx(rl,{className:"settings__select",value:xA(n.autoSaveAfterPauseMs),options:pA,onChange:L=>u({autoSaveAfterPauseMs:gA(L)}),ariaLabel:"Пауза перед автосохранением открытого файла"})]}),s.jsxs("section",{className:"settings__section",children:[s.jsx("h3",{className:"settings__heading",children:"Агенты"}),s.jsx("p",{className:"settings__hint",children:"Выключенный агент не предлагается при создании новой сессии. Уже открытые сессии с ним продолжают работать."}),jy.map(L=>{const M=(n==null?void 0:n.enabledProviders)??["claude","antigravity","codex"],O=!k&&M.includes(L.id),J=O&&M.length<=1;return s.jsxs("div",{className:"settings__switch-row settings__agent",children:[s.jsx("span",{className:`newsession__mark newsession__mark--${L.id}`,"aria-hidden":"true",children:L.id==="antigravity"?s.jsx(Ug,{className:"newsession__mark-logo"}):L.id==="codex"?s.jsx($g,{className:"newsession__mark-logo"}):s.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:s.jsx("circle",{cx:"8",cy:"8",r:"6",fill:"var(--accent)"})})}),s.jsxs("div",{className:"settings__switch-copy settings__agent-copy",children:[s.jsx("span",{className:"settings__field-label",children:L.label}),s.jsx("span",{className:"settings__hint",children:J?"Хотя бы один агент должен остаться включённым":L.hint})]}),k?s.jsx("div",{className:"settings__switch-skeleton","aria-hidden":"true"}):s.jsx("button",{type:"button",role:"switch","aria-checked":O,"aria-label":L.label,disabled:J,title:J?"Хотя бы один агент должен остаться включённым":void 0,className:O?"switch is-on":"switch",onClick:()=>{const le=jy.map(ce=>ce.id).filter(ce=>ce===L.id?!O:M.includes(ce));u({enabledProviders:le})},children:s.jsx("span",{className:"switch__knob"})})]},L.id)})]}),s.jsxs("section",{className:"settings__section","aria-labelledby":"settings-shared-title",children:[s.jsx("h3",{className:"settings__heading",id:"settings-shared-title",children:"Общая конфигурация аккаунтов"}),s.jsx("p",{className:"settings__hint",children:"Выбор действует, когда аккаунт добавляется или подключается с включённым общим доступом. Уже существующие аккаунты не меняются, ссылки не удаляются."}),aA.map(L=>{const M=(n==null?void 0:n.sharedConfigItems)??q_,O=!k&&M.includes(L.id);return s.jsxs("div",{className:"settings__switch-row",children:[s.jsxs("div",{className:"settings__switch-copy",children:[s.jsx("span",{className:"settings__field-label",children:L.label}),s.jsx("span",{className:"settings__hint",children:L.hint})]}),k?s.jsx("div",{className:"settings__switch-skeleton","aria-hidden":"true"}):s.jsx("button",{type:"button",role:"switch","aria-checked":O,"aria-label":L.label,className:O?"switch is-on":"switch",onClick:()=>u({sharedConfigItems:q_.filter(J=>J===L.id?!O:M.includes(J))}),children:s.jsx("span",{className:"switch__knob"})})]},L.id)}),s.jsx("h4",{className:"settings__subheading",children:"Никогда не делится"}),s.jsx("ul",{className:"settings__never",children:iA.map(L=>s.jsxs("li",{children:[s.jsx("span",{className:"settings__never-name",children:L.label}),s.jsx("span",{className:"settings__hint",children:L.why})]},L.label))})]}),s.jsxs("section",{className:"settings__section",children:[s.jsx("h3",{className:"settings__heading",children:"Старт новой сессии"}),s.jsx("p",{className:"settings__hint",children:"Модель и режим прав, с которыми поднимается новая сессия. Уже открытую это не меняет — у неё свои переключатели в шапке."}),s.jsxs("div",{className:"settings__field",children:[s.jsx("span",{className:"settings__field-label",children:"Модель"}),k?s.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):s.jsx(rl,{className:"settings__select",value:n.startModel??Fp,options:ge,onChange:L=>u({startModel:L===Fp?null:L}),ariaLabel:"Модель, с которой поднимается новая сессия"})]}),s.jsxs("div",{className:"settings__field",children:[s.jsx("span",{className:"settings__field-label",children:"Режим прав при старте"}),k?s.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):s.jsx(rl,{className:"settings__select",value:n.startPermissionMode,options:cA,onChange:L=>u({startPermissionMode:L}),ariaLabel:"Режим прав, с которым поднимается новая сессия"})]})]}),s.jsx("section",{className:"settings__section",children:s.jsxs("div",{className:"settings__switch-row",children:[s.jsxs("div",{className:"settings__switch-copy",children:[s.jsx("h3",{className:"settings__heading",children:"Запущенные сессии сверху"}),s.jsx("p",{className:"settings__hint",children:"Сессии, поднятые в хосте прямо сейчас — работают, готовы, ждут разрешения, работают в фоне, переподключаются, — показываются выше остальных в списке сессий проекта и в панели закреплённых. Порядок внутри каждой из двух частей остаётся тем, что задан руками."})]}),k?s.jsx("div",{className:"settings__switch-skeleton","aria-hidden":"true"}):s.jsx("button",{type:"button",role:"switch","aria-checked":Q,"aria-label":"Запущенные сессии сверху",className:Q?"switch is-on":"switch",onClick:()=>u({liveSessionsFirst:!Q}),children:s.jsx("span",{className:"switch__knob"})})]})}),s.jsxs("section",{className:"settings__section",children:[s.jsx("h3",{className:"settings__heading",children:"Доступ к папкам"}),s.jsx("p",{className:"settings__hint",children:"Это про то, где агент пишет файлы (Write, Edit, NotebookEdit), не спрашивая разрешения, — не про чтение: читает он в любом случае. Ничего не запрещается наглухо — выход за выбранную границу просто превращается в обычный запрос прав, который остаётся подтвердить или отклонить."}),s.jsx("div",{className:"access",role:"radiogroup","aria-label":"Доступ к папкам",children:_A.map(L=>{const M=!k&&n.folderAccess===L.value;return s.jsxs("button",{type:"button",role:"radio","aria-checked":M,disabled:k,className:"access__card"+(M?" is-on":"")+(L.risky?" access__card--risky":""),onClick:()=>u({folderAccess:L.value}),children:[s.jsx("span",{className:"access__radio","aria-hidden":"true"}),s.jsxs("span",{className:"access__body",children:[s.jsxs("span",{className:"access__title",children:[L.title,L.risky&&s.jsx("span",{className:"access__risk",children:"самое широкое"})]}),s.jsx("span",{className:"access__desc",children:L.description})]})]},L.value)})})]}),s.jsxs("section",{className:"settings__section",children:[s.jsxs("div",{className:"settings__switch-row",children:[s.jsxs("div",{className:"settings__switch-copy",children:[s.jsx("h3",{className:"settings__heading",children:"Терминал"}),s.jsx("p",{className:"settings__hint",children:"Панель терминала под лентой разговора: команда, которую там набрали, выполняется прямо на этом компьютере с правами вашего пользователя — не в песочнице агента, как Bash-инструмент в разговоре. Выключите — и все открытые вкладки терминала закроются, а процессы в них не переживут закрытия."})]}),k?s.jsx("div",{className:"settings__switch-skeleton","aria-hidden":"true"}):s.jsx("button",{type:"button",role:"switch","aria-checked":fe,"aria-label":"Терминал",className:fe?"switch is-on":"switch",onClick:()=>u({terminalEnabled:!fe}),children:s.jsx("span",{className:"switch__knob"})})]}),s.jsxs("div",{className:"settings__nested"+(X?" is-disabled":""),children:[s.jsx("h4",{className:"settings__nested-heading",children:"Удалённый доступ к терминалу"}),k?s.jsx("p",{className:"settings__hint",children:"Загрузка…"}):s.jsxs(s.Fragment,{children:[X&&s.jsx("p",{className:"settings__hint",children:"Сначала включите терминал выше — удалённый доступ выдаётся к тому, что на этой машине уже разрешено, а не поверх выключенного рубильника."}),U()]})]})]}),s.jsx(lA,{}),s.jsxs("details",{ref:v,className:"settings__section settings__advanced",open:N||void 0,children:[s.jsxs("summary",{className:"settings__advanced-summary",children:[s.jsx("h3",{className:"settings__heading",children:"Вход и выход Claude Code (расширенное)"}),s.jsx("svg",{viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",className:"settings__advanced-chev",children:s.jsx("path",{d:"m3 4.5 3 3 3-3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),s.jsxs("div",{className:"settings__advanced-body",children:[s.jsxs("p",{className:"settings__hint",children:["ccv не хранит ни паролей, ни токенов. Эти кнопки запускают собственные команды Claude Code — ",s.jsx("code",{children:"claude auth login"})," и ",s.jsx("code",{children:"claude auth logout"})," — для папки выбранного аккаунта."]}),s.jsxs("ul",{className:"settings__hint settings__advanced-list",children:[s.jsxs("li",{children:[s.jsx("strong",{children:"Войти"})," — входит в эту папку: откроется ссылка в браузере, и Claude Code попросит код."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Выйти"})," — убирает вход из этой папки для всех сессий аккаунта."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Сменить аккаунт"})," — выйти и войти заново."]})]}),s.jsx(eA,{..._})]})]})]})})}const tm="Новая сессия начнётся с нуля: на другой аккаунт переходит только текст хэндоффа, прежний разговор под ним не открыть.";function vv({targets:n,selectedId:l,sourceId:i,onSelect:r,variant:o,className:u,disabled:m}){const{auth:p}=vg(),g=n.find(z=>z.id===l)??n[0],[_,b]=x.useState(!1),[j,v]=x.useState(0),[k,N]=x.useState({left:0,top:0}),E=x.useRef(null),C=x.useRef(null);function I(){v(Math.max(0,n.findIndex(z=>z.id===l))),b(!0)}function D(z){var H;b(!1),z&&((H=E.current)==null||H.focus())}function G(z){r(z.id),D(!0)}x.useLayoutEffect(()=>{if(!_)return;const z=E.current,H=C.current;if(!z||!H)return;const te=z.getBoundingClientRect(),F=H.getBoundingClientRect(),fe=8,Q=Math.max(fe,Math.min(te.right-F.width,window.innerWidth-F.width-fe));let X=te.bottom+6;X+F.height>window.innerHeight-fe&&(X=Math.max(fe,te.top-F.height-6)),N({left:Q,top:X}),H.focus()},[_]),x.useLayoutEffect(()=>{if(!_)return;function z(H){var F,fe;const te=H.target;!((F=C.current)!=null&&F.contains(te))&&!((fe=E.current)!=null&&fe.contains(te))&&D(!1)}return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[_]);function P(z){if(z.key==="Escape")z.preventDefault(),z.stopPropagation(),D(!0);else if(z.key==="ArrowDown"||z.key==="ArrowUp"){z.preventDefault();const H=z.key==="ArrowDown"?1:-1;v(te=>(te+H+n.length)%n.length)}else if(z.key==="Enter"||z.key===" "){z.preventDefault();const H=n[j];H&&G(H)}else z.key==="Tab"&&D(!1)}if(!g)return null;const V=`Аккаунт новой сессии: «${g.name}». Сменить`;return s.jsxs(s.Fragment,{children:[s.jsxs("button",{ref:E,type:"button",className:`${o==="split"?"splitbtn__caret":"pane-btn pane-btn--target"}${u?` ${u}`:""}`,title:V,"aria-label":V,"aria-haspopup":"menu","aria-expanded":_,disabled:m,onClick:()=>_?D(!1):I(),onKeyDown:z=>{(z.key==="ArrowDown"||z.key==="ArrowUp")&&(z.preventDefault(),I())},children:[o==="mark"&&s.jsx(Da,{account:g,size:"sm",className:"pane-btn__mark"}),s.jsx("svg",{className:"splitbtn__icon",viewBox:"0 0 10 6",fill:"none","aria-hidden":"true",children:s.jsx("path",{d:"M1 1.2 5 5 9 1.2",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})]}),_&&s.jsxs("div",{ref:C,className:"newsession__menu targetmenu",style:{left:k.left,top:k.top},role:"menu","aria-label":"Аккаунт новой сессии",tabIndex:-1,onKeyDown:P,children:[s.jsx("p",{className:"targetmenu__note",children:tm}),n.map((z,H)=>{const te=By(p[z.id]);return s.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":z.id===l,className:"newsession__item"+(H===j?" is-cursor":""),onMouseEnter:()=>v(H),onClick:()=>G(z),children:[s.jsx("span",{className:"newsession__mark newsession__mark--account",children:s.jsx(Da,{account:z,size:"md"})}),s.jsxs("span",{className:"newsession__text",children:[s.jsx("span",{className:"newsession__label",children:z.name}),te&&s.jsx("span",{className:"newsession__hint",children:te})]}),z.id===i&&s.jsx("span",{className:"newsession__tag",children:"прежняя"}),z.id===l&&s.jsx("svg",{className:"targetmenu__check",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:s.jsx("path",{d:"m2.5 6.4 2.4 2.4 4.6-5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})]},z.id)})]})]})}function yA({targets:n,selectedId:l,onSelect:i}){return s.jsxs("div",{className:"targetchips",role:"radiogroup","aria-label":"Аккаунт новой сессии",children:[s.jsx("span",{className:"targetchips__label",children:"Новая сессия на аккаунте"}),s.jsx("div",{className:"targetchips__row",children:n.map(r=>s.jsxs("button",{type:"button",role:"radio","aria-checked":r.id===l,className:`targetchips__chip acct--${r.color}${r.id===l?" is-on":""}`,onClick:()=>i(r.id),children:[s.jsx(Da,{account:r,size:"sm"}),s.jsx("span",{className:"targetchips__name",children:r.name})]},r.id))}),s.jsx("span",{className:"targetchips__note",children:tm})]})}const ky={fiveHour:"5-часовой лимит",sevenDay:"недельный лимит"};function vA(n){if(!n)return"срок неизвестен";const l=new Date(n);return Number.isNaN(l.getTime())?"срок неизвестен":l.toLocaleString()}function wy({label:n,primary:l,choice:i,onContinue:r}){const o=`btn btn--sm${l?" btn--primary":""}`,u=i==null?void 0:i.targets.find(p=>p.id===i.selectedId);if(!i||!u)return s.jsx("button",{type:"button",className:o,onClick:r,children:n});const m=u.id!==i.sourceId;return s.jsxs("span",{className:`splitbtn${l?" splitbtn--primary":""}`,children:[s.jsxs("button",{type:"button",className:`${o} splitbtn__main`,title:m?tm:`Новая сессия на том же аккаунте «${u.name}»`,onClick:r,children:[s.jsx("span",{className:`newsession__acct acct--${u.color}`,"aria-hidden":"true"}),n," на «",u.name,"»"]}),s.jsx(vv,{variant:"split",className:o,targets:i.targets,selectedId:i.selectedId,sourceId:i.sourceId,onSelect:i.onSelect})]})}function jA({handoff:n,onContinue:l,onShow:i,onDismiss:r,sourceAccount:o=null,accountChoice:u=null}){if(n.continuedAt!==void 0){const m=n.limit===null?`Хэндофф записан вручную ${new Date(n.stoppedAt).toLocaleString()}`:`${ky[n.limit]} (${Math.round(n.utilization)} %) — работа прервана ${new Date(n.stoppedAt).toLocaleString()}`;return s.jsxs("div",{className:"handoff handoff--continued",role:"status",children:[s.jsxs("div",{className:"handoff__msg",children:[s.jsx("span",{className:"handoff__dot","aria-hidden":"true"}),s.jsxs("span",{children:[s.jsxs("span",{className:"handoff__continued",children:["Новая сессия из этого хэндоффа уже начата ",new Date(n.continuedAt).toLocaleString(),"."]})," ",m,".",n.source==="journal"&&" Хэндофф собран автоматически из журнала."]})]}),s.jsxs("div",{className:"handoff__actions",children:[s.jsx("button",{type:"button",className:"btn btn--sm",onClick:i,children:"Показать хэндофф"}),s.jsx("button",{type:"button",className:"btn btn--sm",onClick:r,children:"Скрыть"}),s.jsx(wy,{label:"Продолжить ещё раз",primary:!1,choice:u,onContinue:l})]})]})}return s.jsxs("div",{className:"handoff",role:"status",children:[s.jsxs("div",{className:"handoff__msg",children:[s.jsx("span",{className:"handoff__dot","aria-hidden":"true"}),s.jsxs("span",{children:[n.limit===null?s.jsxs(s.Fragment,{children:["Хэндофф записан вручную ",new Date(n.stoppedAt).toLocaleString()," — сессия остановлена."]}):s.jsxs(s.Fragment,{children:[o&&s.jsxs(s.Fragment,{children:[s.jsx(Da,{account:o,size:"sm",className:"handoff__acct"})," ",s.jsxs("strong",{className:"handoff__acctname",children:["«",o.name,"»"]}),":"," "]}),ky[n.limit]," (",Math.round(n.utilization)," %) — работа прервана"," ",new Date(n.stoppedAt).toLocaleString(),". Окно сбросится: ",vA(n.resetsAt),"."]}),n.source==="journal"&&" Хэндофф собран автоматически из журнала."]})]}),u&&u.selectedId!==u.sourceId&&s.jsx("p",{className:"handoff__hint",children:tm}),s.jsxs("div",{className:"handoff__actions",children:[s.jsx(wy,{label:u?"Продолжить":"Продолжить в новой сессии",primary:!0,choice:u,onContinue:l}),s.jsx("button",{type:"button",className:"btn btn--sm",onClick:i,children:"Показать хэндофф"}),s.jsx("button",{type:"button",className:"btn btn--sm",onClick:r,children:"Скрыть"})]})]})}function NA({handoff:n,onClose:l}){const[i,r]=x.useState("");return x.useEffect(()=>{let o=!1;return Hd(n.text).then(u=>{o||r(u)}),()=>{o=!0}},[n.text]),s.jsx(zn,{title:"Хэндофф",className:"modal--wide",onClose:l,children:s.jsx("div",{className:"markdown-preview",dangerouslySetInnerHTML:{__html:i}})})}function kA({state:n}){return s.jsxs("div",{className:"netguard",role:"alert",children:[s.jsxs("svg",{className:"netguard__icon",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[s.jsx("path",{d:"M8 1.8 14.2 13H1.8L8 1.8Z",stroke:"currentColor",strokeWidth:1.4,strokeLinejoin:"round"}),s.jsx("path",{d:"M8 6.4v3",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round"}),s.jsx("circle",{cx:"8",cy:"11.2",r:"0.8",fill:"currentColor"})]}),s.jsxs("div",{className:"netguard__copy",children:[s.jsx("strong",{className:"netguard__reason",children:n.reason??"Не удалось убедиться, что запросы идут через VPN"}),s.jsx("span",{className:"netguard__note",children:"Запросы агента остановлены, отправка отключена. Когда VPN вернётся, сессии можно продолжить: следующее сообщение возобновит разговор."})]})]})}function wA({servers:n,onAuthorize:l,onDismiss:i}){if(n.length===0)return null;const r=n.length===1;return s.jsxs("div",{className:"mcpnotice",role:"status",children:[s.jsxs("div",{className:"mcpnotice__msg",children:[s.jsx("span",{className:"mcpnotice__dot","aria-hidden":"true"}),s.jsx("span",{children:r?s.jsxs(s.Fragment,{children:["MCP-серверу ",s.jsx("strong",{children:n[0]})," нужна авторизация — без неё агент не увидит его инструменты."]}):s.jsx(s.Fragment,{children:"Этим MCP-серверам нужна авторизация — без неё агент не увидит их инструменты."})})]}),s.jsxs("div",{className:"mcpnotice__actions",children:[n.map(o=>s.jsx("button",{type:"button",className:"btn btn--sm btn--primary",onClick:()=>l(o),children:r?"Авторизовать":`Авторизовать «${o}»`},o)),s.jsx("button",{type:"button",className:"btn btn--sm",onClick:i,children:"Скрыть"})]})]})}const Fh={fiveHour:"5-часовой лимит",sevenDay:"недельный лимит"},SA=12e3;function EA(n){const l=n%10,i=n%100;return l===1&&i!==11?"сессии":"сессиях"}function CA({notices:n,onDismiss:l}){return n.length===0?null:s.jsx("div",{className:"limittoasts",children:n.map(i=>s.jsx(TA,{notice:i,onDismiss:()=>l(i.id)},i.id))})}function TA({notice:n,onDismiss:l}){return x.useEffect(()=>{const i=window.setTimeout(l,SA);return()=>window.clearTimeout(i)},[l]),s.jsxs("div",{className:"limittoast",role:"status",children:[s.jsx("span",{className:"limittoast__dot","aria-hidden":"true"}),s.jsx("span",{className:"limittoast__body",children:n.stopped>0?s.jsxs(s.Fragment,{children:["Достигнут ",Fh[n.limit]," (",Math.round(n.utilization)," %): работа прервана в ",n.stopped," ",EA(n.stopped),", хэндоффов —"," ",n.handoffs,". Сессии остаются запущенными."]}):s.jsxs(s.Fragment,{children:["Достигнут ",Fh[n.limit]," (",Math.round(n.utilization)," %): занятых сессий не было — ничего не прервано."]})}),s.jsx("button",{type:"button",className:"limittoast__dismiss","aria-label":"Закрыть уведомление",onClick:l,children:"✕"})]})}function AA(n,l,i=Date.now()){if(!n||!n.available||!l)return null;const r=[["fiveHour",n.fiveHour,l.limitStopFiveHourPct],["sevenDay",n.sevenDay,l.limitStopSevenDayPct]];for(const[o,u,m]of r){if(!u||m<=0||u.utilization<m)continue;const p=Date.parse(u.resetsAt);if(!(!Number.isFinite(p)||p<=i))return{limit:o,utilization:u.utilization,resetsAt:p}}return null}function MA(n,l=Date.now()){const i=new Date(n),r=i.toLocaleTimeString("ru-RU",{hour:"2-digit",minute:"2-digit"});return i.toDateString()===new Date(l).toDateString()?r:`${i.toLocaleDateString("ru-RU",{day:"numeric",month:"short"})}, ${r}`}const RA=16;function DA({pane:n,width:l,onResize:i,onReset:r}){const o=Wc[n],u=x.useRef(null);function m(b){if(b.button!==0)return;const j=document.querySelector(".main"),v=j?Math.max(0,j.getBoundingClientRect().width-u1):0;u.current={x:b.clientX,width:l,max:Math.min(o.max,l+v)},b.currentTarget.setPointerCapture(b.pointerId),document.body.classList.add("is-resizing"),b.preventDefault()}function p(b){const j=u.current;if(!j)return;const v=o.side==="left"?b.clientX-j.x:j.x-b.clientX;i(Math.min(j.max,j.width+v))}function g(b){u.current&&(u.current=null,b.currentTarget.hasPointerCapture(b.pointerId)&&b.currentTarget.releasePointerCapture(b.pointerId),document.body.classList.remove("is-resizing"))}function _(b){const j=b.key==="ArrowRight"?1:b.key==="ArrowLeft"?-1:0;j!==0&&(b.preventDefault(),i(l+j*RA*(o.side==="left"?1:-1)))}return s.jsx("div",{className:`pane-resizer pane-resizer--${n} pane-resizer--${o.side}`,role:"separator","aria-orientation":"vertical","aria-label":`Ширина панели ${o.label}`,"aria-valuenow":l,"aria-valuemin":o.min,"aria-valuemax":o.max,tabIndex:0,title:"Потяните, чтобы изменить ширину; двойной щелчок — ширина по умолчанию",onPointerDown:m,onPointerMove:p,onPointerUp:g,onPointerCancel:g,onDoubleClick:r,onKeyDown:_,children:s.jsx("span",{className:"pane-resizer__line","aria-hidden":"true"})})}const LA=16;function OA({height:n,onResize:l,onReset:i}){const r=x.useRef(null);function o(){const _=document.querySelector(".main .transcript, .main .editor");if(!_)return 1/0;const b=_.getBoundingClientRect().height-m1;return Math.round(n+Math.max(0,b))}function u(_){_.button===0&&(r.current={y:_.clientY,height:n,max:o()},_.currentTarget.setPointerCapture(_.pointerId),document.body.classList.add("is-resizing-row"),_.preventDefault())}function m(_){const b=r.current;if(!b)return;const j=b.y-_.clientY;l(b.height+j,b.max)}function p(_){r.current&&(r.current=null,_.currentTarget.hasPointerCapture(_.pointerId)&&_.currentTarget.releasePointerCapture(_.pointerId),document.body.classList.remove("is-resizing-row"))}function g(_){const b=_.key==="ArrowUp"?1:_.key==="ArrowDown"?-1:0;b!==0&&(_.preventDefault(),l(n+b*LA,o()))}return s.jsx("div",{className:"term-resizer",role:"separator","aria-orientation":"horizontal","aria-label":"Высота панели терминала","aria-valuenow":n,"aria-valuemin":t0,tabIndex:0,title:"Потяните, чтобы изменить высоту; двойной щелчок — высота по умолчанию",onPointerDown:u,onPointerMove:m,onPointerUp:p,onPointerCancel:p,onDoubleClick:i,onKeyDown:g,children:s.jsx("span",{className:"term-resizer__line","aria-hidden":"true"})})}function Sy(){const n=document.documentElement,l=getComputedStyle(n),i=D=>l.getPropertyValue(D).trim(),r=i("--surface"),o=i("--text"),u=i("--text-2"),m=i("--muted"),p=i("--accent"),g=i("--accent-fg"),_=i("--select"),b=i("--danger"),j=i("--ok"),v=i("--warn"),k=i("--cm-fn"),N=i("--cm-key"),E=i("--cm-type"),C=Ey(o,r,55),I=D=>Ey(D,"#ffffff",25);return{background:r,foreground:o,cursor:p,cursorAccent:g,selectionBackground:_,black:C,brightBlack:m,red:b,brightRed:I(b),green:j,brightGreen:I(j),yellow:v,brightYellow:I(v),blue:k,brightBlue:I(k),magenta:N,brightMagenta:I(N),cyan:E,brightCyan:I(E),white:u,brightWhite:o}}function zA(){return getComputedStyle(document.documentElement).getPropertyValue("--mono").trim()}let ni=null;function IA(n){return ni||(ni=document.createElement("span"),ni.style.position="fixed",ni.style.width="0",ni.style.height="0",ni.style.opacity="0",ni.style.pointerEvents="none",document.body.appendChild(ni)),ni.style.color=n,getComputedStyle(ni).color}function Ey(n,l,i){return IA(`color-mix(in srgb, ${n} ${100-i}%, ${l} ${i}%)`)}let kh=null;function UA(){return kh||(kh=Promise.all([st(()=>import("./xterm-D6Mng-DB.js").then(n=>n.x),__vite__mapDeps([28,26]),import.meta.url),st(()=>import("./addon-fit-CevVMrUA.js").then(n=>n.a),__vite__mapDeps([29,26]),import.meta.url),st(()=>import("./addon-web-links-CnB65OV_.js").then(n=>n.a),__vite__mapDeps([30,26]),import.meta.url),st(()=>Promise.resolve({}),__vite__mapDeps([31]),import.meta.url)]).then(([n,l,i])=>({Terminal:n.Terminal,FitAddon:l.FitAddon,WebLinksAddon:i.WebLinksAddon})).catch(n=>{throw kh=null,n})),kh}function $A({terminals:n,activeId:l,blocked:i,error:r,onDismissError:o,height:u,offset:m,mobile:p=!1,zoomed:g,onToggleZoom:_,onSelect:b,onOpen:j,onClose:v,onInput:k,onResize:N,onAttach:E,onHide:C,registerSink:I}){const[D,G]=x.useState(()=>Sy());return x.useEffect(()=>{const P=new MutationObserver(()=>G(Sy()));return P.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>P.disconnect()},[]),s.jsxs("div",{className:"termpanel"+(p?" termpanel--mobile":"")+(!p&&g?" termpanel--zoomed":""),style:p?{height:u,top:(m==null?void 0:m.top)??0,left:(m==null?void 0:m.left)??0}:g?void 0:{height:u},children:[s.jsxs("div",{className:"termpanel__tabbar",onDoubleClick:P=>{_&&(P.target.closest("button")||_())},children:[s.jsx("div",{className:"termpanel__tabs",role:"tablist","aria-label":"Открытые терминалы",children:n.map(P=>s.jsxs("div",{role:"tab","aria-selected":P.id===l,className:"termtab"+(P.id===l?" is-on":"")+(P.exitCode!==null?" termtab--exited":""),onDoubleClick:V=>{_&&(V.target.closest(".termtab__close")||_())},children:[s.jsx("button",{className:"termtab__name",title:P.cwd,onClick:()=>b(P.id),children:P.title}),P.exitCode!==null&&s.jsx("span",{className:"termtab__code",title:`Оболочка завершилась с кодом ${P.exitCode}`,children:P.exitCode}),s.jsx("button",{className:"termtab__close",title:"Закрыть терминал","aria-label":`Закрыть терминал «${P.title}»`,onClick:()=>v(P.id),children:"✕"})]},P.id))}),s.jsx("button",{className:"termpanel__add",title:"Новый терминал","aria-label":"Новый терминал",disabled:i,onClick:j,children:"+"}),s.jsx("div",{className:"termpanel__spacer"}),_&&s.jsx("button",{className:"termpanel__zoom",title:g?"Свернуть терминал — то же самое, что двойной клик по вкладке":"Развернуть терминал на весь экран — то же самое, что двойной клик по вкладке","aria-label":g?"Свернуть терминал":"Развернуть терминал на весь экран","aria-pressed":g,onClick:_,children:s.jsx(_u,{active:g})}),s.jsx("button",{className:"termpanel__hide",title:"Скрыть панель","aria-label":"Скрыть панель терминала",onClick:C,children:"✕"})]}),r&&n.length>0&&s.jsx(Cy,{message:r,strip:!0,onRetry:null,onDismiss:o}),s.jsxs("div",{className:"termpanel__body",children:[r&&n.length===0?s.jsx(Cy,{message:r,onRetry:i?null:j,onDismiss:o}):i?s.jsxs("div",{className:"termpanel__empty",children:[s.jsx("p",{children:"Терминал с удалённых устройств выключен"}),s.jsx("p",{className:"termpanel__hint",children:"Откройте «Удалённый доступ» → «Прислать письмо»: на почту аккаунта придёт ссылка, и после перехода по ней терминал заработает прямо здесь. Если сейчас доберётесь до самого компьютера — там разрешение включается сразу, без письма."})]}):n.length===0&&s.jsxs("div",{className:"termpanel__empty",children:[s.jsx("p",{children:"Терминалов не открыто"}),s.jsx("button",{className:"btn btn--primary",onClick:j,children:"Открыть терминал"})]}),n.map(P=>s.jsx(HA,{id:P.id,exitCode:P.exitCode,active:P.id===l,theme:D,mobile:p,onInput:k,onResize:N,onAttach:E,registerSink:I},P.id))]})]})}function Cy({message:n,strip:l=!1,onRetry:i,onDismiss:r}){const{lede:o,hint:u,details:m}=BA(n);return s.jsxs("div",{className:l?"termfail termfail--strip":"termfail",role:"alert",children:[s.jsxs("div",{className:"termfail__text",children:[s.jsx("p",{className:"termfail__lede",children:o}),u&&s.jsx("p",{className:"termfail__hint",children:u}),m&&s.jsxs("details",{className:"termfail__details",children:[s.jsx("summary",{children:"Подробности"}),s.jsx("pre",{children:m})]})]}),s.jsxs("div",{className:"termfail__bar",children:[i&&s.jsx("button",{className:"btn btn--primary",onClick:i,children:"Открыть терминал"}),s.jsx("button",{className:"btn",onClick:r,children:"Понятно"})]})]})}function BA(n){const[l="",...i]=n.trim().split(`
156
+
157
+ `),r=l.split(`
158
+ `).map(o=>o.trim()).filter(o=>o!=="");return{lede:r[0]??n.trim(),hint:r.slice(1).join(" "),details:i.join(`
159
+
160
+ `).trim()}}function HA({id:n,exitCode:l,active:i,theme:r,mobile:o,onInput:u,onResize:m,onAttach:p,registerSink:g}){const _=x.useRef(null),b=x.useRef(null),j=x.useRef(!1),v=x.useRef(o);v.current=o;const k=x.useRef(r),N=x.useRef(l),[E,C]=x.useState("loading"),[I,D]=x.useState(!1);return x.useEffect(()=>{if(!_.current)return;let P=!1,V=null;C("loading"),D(!1);const z=window.setTimeout(()=>{P||D(!0)},200);return(async()=>{var ce;let H;try{H=await UA()}catch{window.clearTimeout(z),P||C("error");return}if(P||!_.current)return;window.clearTimeout(z);const{Terminal:te,FitAddon:F,WebLinksAddon:fe}=H,Q=new te({fontFamily:zA()||"monospace",fontSize:13,lineHeight:1.2,cursorBlink:!0,cursorStyle:"bar",scrollback:5e3,theme:k.current}),X=new F;Q.loadAddon(X),Q.loadAddon(new fe),Q.open(_.current),b.current=Q,Q.attachCustomKeyEventHandler(A=>{if(A.type!=="keydown"||!(A.ctrlKey||A.metaKey))return!0;if(A.key==="`")return A.preventDefault(),!1;if(A.key==="c"||A.key==="C"){const me=Q.getSelection();return me?(A.preventDefault(),ui(me),!1):!A.shiftKey}return A.key==="v"||A.key==="V"?(A.preventDefault(),cg().then(me=>{me&&Q.paste(me)}),!1):!0});const ge=A=>{A.preventDefault();const W=Q.getSelection();if(W){ui(W),Q.clearSelection();return}cg().then(me=>{me&&Q.paste(me)})};(ce=Q.element)==null||ce.addEventListener("contextmenu",ge);const U=Q.onData(A=>u(n,A));let L={cols:Q.cols,rows:Q.rows},M=null;const O=Q.onResize(({cols:A,rows:W})=>{M!==null&&window.clearTimeout(M),M=window.setTimeout(()=>{M=null,!(A===L.cols&&W===L.rows)&&(L={cols:A,rows:W},m(n,A,W))},100)}),J=new ResizeObserver(()=>{try{X.fit()}catch{return}v.current&&Q.scrollToBottom()});J.observe(_.current);const le=g(n,A=>{A.kind==="buffer"&&Q.reset(),Q.write(A.data)});p(n),N.current!==null&&!j.current&&(j.current=!0,Q.write(`\r
161
+ \x1B[2m— Процесс завершён (код ${N.current}) —\x1B[0m\r
162
+ `)),i&&Q.focus(),V=()=>{var A;M!==null&&window.clearTimeout(M),J.disconnect(),(A=Q.element)==null||A.removeEventListener("contextmenu",ge),U.dispose(),O.dispose(),le(),Q.dispose(),b.current=null},C("ready")})(),()=>{P=!0,window.clearTimeout(z),V==null||V(),V=null}},[n]),x.useEffect(()=>{if(!o)return;const G=_.current;if(!G)return;let P=null,V=0,z=!1;const H=Q=>{Q.pointerType==="mouse"||P!==null||(P=Q.pointerId,V=Q.clientY,z=!1)},te=Q=>{if(Q.pointerId!==P)return;const X=V-Q.clientY;if(!z){if(Math.abs(X)<4)return;z=!0,G.setPointerCapture(Q.pointerId)}V=Q.clientY;const ge=G.querySelector(".xterm-viewport");ge&&(ge.scrollTop+=X)},F=Q=>{Q.pointerId===P&&(G.hasPointerCapture(Q.pointerId)&&G.releasePointerCapture(Q.pointerId),P=null,z=!1)},fe=Q=>Q.stopPropagation();return G.addEventListener("pointerdown",H),G.addEventListener("pointermove",te),G.addEventListener("pointerup",F),G.addEventListener("pointercancel",F),G.addEventListener("touchmove",fe,{capture:!0}),()=>{G.removeEventListener("pointerdown",H),G.removeEventListener("pointermove",te),G.removeEventListener("pointerup",F),G.removeEventListener("pointercancel",F),G.removeEventListener("touchmove",fe,{capture:!0}),P!==null&&G.hasPointerCapture(P)&&G.releasePointerCapture(P)}},[o]),x.useEffect(()=>{k.current=r,b.current&&(b.current.options.theme=r)},[r]),x.useEffect(()=>{var G;i&&((G=b.current)==null||G.focus())},[i]),x.useEffect(()=>{if(N.current=l,l===null){j.current=!1;return}if(j.current)return;const G=b.current;G&&(j.current=!0,G.write(`\r
163
+ \x1B[2m— Процесс завершён (код ${l}) —\x1B[0m\r
164
+ `))},[l]),s.jsxs("div",{className:"termview"+(i?" is-active":""),children:[s.jsx("div",{ref:_,className:"termview__surface"+(E==="ready"?"":" is-hidden")}),E==="loading"&&I&&s.jsxs("div",{className:"termview__state work",role:"status",children:[s.jsxs("div",{className:"work__dots",children:[s.jsx("span",{className:"work__dot"}),s.jsx("span",{className:"work__dot"}),s.jsx("span",{className:"work__dot"})]}),s.jsx("span",{className:"work__label",children:"Загружается терминал…"})]}),E==="error"&&s.jsxs("div",{className:"termview__state termview__state--error",role:"alert",children:[s.jsx("p",{children:"Не удалось загрузить терминал"}),s.jsx("p",{className:"termpanel__hint",children:"Соединение оборвалось раньше, чем приехал нужный модуль — на мобильном relay это обычное дело на слабой сети. Ниже — перезагрузка страницы, а не тихий повтор: открытые терминалы и их содержимое приедут обратно с хоста, а вот черновик в поле ввода внизу — нет."}),s.jsx("button",{className:"btn btn--primary",onClick:()=>window.location.reload(),children:"Перезагрузить страницу"})]})]})}const qA=2e5,GA=75,YA=90;function VA({tokens:n,maxTokens:l,fetchedAt:i}){if(n===null)return null;const r=l??qA,o=Math.min(100,Math.round(n/r*100)),u=`${n.toLocaleString()} из ${r.toLocaleString()} токенов${i?`
165
+ обновлено в ${new Date(i).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}`:""}`;return s.jsxs("div",{className:"contextbar","aria-label":`Занято контекста: ${o}%`,title:u,children:[s.jsx("span",{className:"contextbar__label",children:"контекст"}),s.jsx("span",{className:"contextbar__track",role:"progressbar","aria-valuenow":o,"aria-valuemin":0,"aria-valuemax":100,children:s.jsx("span",{className:`contextbar__fill${XA(o)}`,style:{width:`${o}%`}})}),s.jsxs("span",{className:"contextbar__pct",children:[o,"%"]})]})}function XA(n){return n>=YA?" contextbar__fill--over":n>=GA?" contextbar__fill--warn":""}const jv="ccv:last-session",FA=300*1e3,KA=1e4;function QA(){try{const n=localStorage.getItem(jv);if(!n)return null;const l=JSON.parse(n);if(typeof l!="object"||l===null)return null;const{workspaceId:i,sessionId:r,claudeSessionId:o}=l;return typeof i!="string"||typeof r!="string"?null:{workspaceId:i,sessionId:r,claudeSessionId:typeof o=="string"?o:null}}catch{return null}}function Ty(n){const l=new Set;return n.filter(i=>l.has(i.id)?!1:(l.add(i.id),!0))}function ZA(n,l){const i=n.find(o=>o.id===l);if(i)return i;const r=n.filter(o=>$j(o.path).includes(l));return r.length===1?r[0]:void 0}function PA(n,l){return n.id===l.sessionId?!0:l.claudeSessionId?n.id===l.claudeSessionId||n.claudeSessionId===l.claudeSessionId:!1}const WA={mcp:"mcp",plugins:"plugins",plugin:"plugins"},Ay=[{name:"login",description:"Войти в аккаунт Claude — Настройки, раздел входа",argumentHint:"",aliases:["signin","вход"]},{name:"switch-account",description:"Сменить аккаунт: выйти и войти заново (Настройки)",argumentHint:"",aliases:["account","аккаунт"]},{name:"logout",description:"Выйти из аккаунта Claude (Настройки)",argumentHint:"",aliases:["signout","выход"]}],My=[{id:Ki,name:"Основной",color:"orange",configDir:null,dir:"",main:!0,liveSessions:0}],Nv="ccv.mcpAuthNoticeDismissed";function JA(){try{const n=JSON.parse(localStorage.getItem(Nv)??"[]");return Array.isArray(n)?n.filter(l=>typeof l=="string"):[]}catch{return[]}}function Ry(n,l,i){if(n===null)return null;const r=n.lastIndexOf("/");if(r===-1&&n!=="")return l;const o=i[r===-1?"":n.slice(0,r)];if(!o)return null;const u=n.slice(r+1).toLowerCase();return u===""?{query:n,entries:o}:{query:n,entries:o.filter(m=>m.name.toLowerCase().includes(u)).sort((m,p)=>Dy(m.name,u)-Dy(p.name,u))}}function Dy(n,l){return n.toLowerCase().startsWith(l)?0:1}function Ly(n,l){const i=n.find(o=>o.value===l)??n.find(o=>o.resolvedModel===l),r=l&&!i?l:null;return{rows:[...r?[{value:r,resolvedModel:r,displayName:r,description:"задана в настройках",supportsEffort:!1,effortLevels:[],supportsThinking:!0,supportsAutoMode:!1}]:[],...n],selected:(i==null?void 0:i.value)??r??(n.some(o=>o.value==="default")?"default":"")}}function eM(){var $o,Zu;const n=x.useRef(null),[l,i]=x.useState(!1),[r,o]=x.useState("Нет связи с хостом"),[u,m]=x.useState(null),[p,g]=x.useState(null),_=(p==null?void 0:p.status)==="blocked",[b,j]=x.useState(!1),v=x.useMemo(()=>Ch()==="relay",[]),[k,N]=x.useState([]),[E,C]=x.useState([]),[I,D]=x.useState([]),[G,P]=x.useState([]),[V,z]=x.useState([]),[H,te]=x.useState(!1),[F,fe]=x.useState([]),[Q,X]=x.useState([]),[ge,U]=x.useState({}),[L,M]=x.useState([]),[O,J]=x.useState([]),[le,ce]=x.useState(null),[A,W]=x.useState(null),[me,Ee]=x.useState(null),[$,de]=x.useState(null),[ae,qe]=x.useState(null),[Se,Ge]=x.useState(null),[Ve,Je]=x.useState(Xs),[Ft,dt]=x.useState(Np),[jn,Ze]=x.useState(!1),[js,lt]=x.useState(!1),mt=$d("(max-width: 860px)"),[Me,nt]=x.useState(!1),[In,kt]=x.useState(!1),[ut,Un]=x.useState(null),[$n,Gt]=x.useState(null),[it,vt]=x.useState(null),[Kt,es]=x.useState(null),[fs,Tt]=x.useState(!1),[Lt,fn]=x.useState(!1),[Qt,zs]=x.useState(null),_e=x.useRef(0),[Ae,Pe]=x.useState(null),et=x.useRef(0),[Qe,Ot]=x.useState(!1),[Zt,Kn]=x.useState(null),[Sl,Bn]=x.useState({}),[Et,_t]=x.useState(null),[Is,Qn]=x.useState(null),[Es,Mn]=x.useState(null),[hs,ms]=x.useState(null),[Zn,Qs]=x.useState(null),hn=x.useRef(null);x.useEffect(()=>{mt||nt(!1)},[mt]);const[wt,At]=x.useState(!1),[cn,ps]=x.useState([]),[Rn,ua]=x.useState(!1),[Us,B]=x.useState(Xs),[xe,Re]=x.useState(null),[Ke,ht]=x.useState(null),[on,rt]=x.useState(null),[cl,Zs]=x.useState(null),[ts,Ns]=x.useState(null),[Ps,Bl]=x.useState({}),[da,Hl]=x.useState([]),[fa,El]=x.useState(null),[mn,pn]=x.useState(null),[ql,ol]=x.useState([]),[ul,Pt]=x.useState([]),[Gl,Hn]=x.useState([]),[Pn,Oa]=x.useState([]),[Yl,Nn]=x.useState(null),[qn,Gn]=x.useState(null),[ha,ns]=x.useState([]),[ks,$s]=x.useState(JA),[Yt,Bs]=x.useState(null),[Vl,tc]=x.useState({}),[Ws,Yn]=x.useState(null),[Xl,Fl]=x.useState({}),[dl,fl]=x.useState(null),[di,Kl]=x.useState({}),[fi,hl]=x.useState([]),[Wn,Js]=x.useState(!1),[be,S]=x.useState(My),[K,pe]=x.useState({}),[ve,ze]=x.useState(null),[Ye,at]=x.useState(null),[gt,gn]=x.useState(null),[un,kn]=x.useState(()=>qj()??Ki),[Wt,wn]=x.useState(null),T=(Wt==null?void 0:Wt.enabledProviders)??["claude","antigravity","codex"],[oe,Te]=x.useState(!1),[Ie,zt]=x.useState({}),[xn,ss]=x.useState(null),[sn,qd]=x.useState(null),[nr,no]=x.useState(!1),[nm,,sm]=i1(),nc=h1(),[ma,sc]=x.useState(!1),[Cs,Gd]=x.useState(null),[lc,so]=x.useState(null),[lm,lo]=x.useState(null),[ao,ml]=x.useState(null),[io,ro]=x.useState(null),[yu,Yd]=x.useState(""),[am,im]=x.useState(null),[rm,cm]=x.useState([]),[vu,za]=x.useState(!1),[om,co]=x.useState(null),[Vd,ac]=x.useState(!1),[Hs,sr]=x.useState(!1),[pl,ic]=x.useState({}),[oo,uo]=x.useState([""]),[Ia,qs]=x.useState([]),[lr,rc]=x.useState({}),[Xd,pa]=x.useState({}),hi=x.useRef(new Map),cc=x.useRef({}),ar=h=>{cc.current=h(cc.current),rc(cc.current)},[ir,ga]=x.useState(null),[Fd,Cl]=x.useState(null),[oc,fo]=x.useState(null),[uc,ho]=x.useState(null),[um,Ts]=x.useState(null),[Ua,ju]=x.useState({}),[dc,Nu]=x.useState({}),[$a,mi]=x.useState(!1),[dm,Ba]=x.useState(null),[rr,pi]=x.useState(null),mo=x.useRef(0),fc=x.useRef(null),[gl,Ha]=x.useState(!1),[cr,or]=x.useState([]),[gi,hc]=x.useState(null),[Kd,mc]=x.useState(null),po=p1(),ku=b1(mt&&gl),pc=x.useRef(new Map),qa=(Wt==null?void 0:Wt.terminalEnabled)===!0,gc=Ch()==="relay"&&(($o=u==null?void 0:u.shell)==null?void 0:$o.enabled)!==!0,xc=x.useRef(!1),Tl=x.useCallback((h,R)=>(pc.current.set(h,R),()=>{pc.current.get(h)===R&&pc.current.delete(h)}),[]),[Ql,As]=x.useState(!1),[xi,ur]=x.useState(null),[_c,_i]=x.useState(Xs),[Al,Zl]=x.useState(null),[dr,Pl]=x.useState({}),Wl=x.useRef([]),[Sn,Ms]=x.useState(null);function wu(h){Ms(R=>R===h?null:h)}x.useEffect(()=>{(mt||Sn==="terminal"&&!gl||Sn==="files"&&!Hs||Sn==="search"&&!$a||Sn==="git"&&!ma||Sn==="ask"&&!Ql||Sn==="main"&&Ia.length===0)&&Ms(null)},[Sn,mt,gl,Hs,$a,ma,Ql,Ia.length]);const[xa]=x.useState(QA),go=x.useRef(xa),bi=x.useRef(!1),dn=x.useRef(null),fr=x.useRef(new Map),hr=x.useRef(null),yi=x.useRef(null),Ml=x.useRef(null),el=x.useRef(0),It=x.useRef(null),vi=x.useRef(0);dn.current=ae,It.current=$,vi.current=Ve.lastSeq;const bc=x.useRef(Ft);bc.current=Ft;const tl=x.useRef(null),nl=x.useRef(0);nl.current=_c.lastSeq;const Rs=x.useRef(null),Rl=x.useRef(""),Gs=x.useRef(null),Jn=x.useRef([]),Jl=x.useRef([""]);Jn.current=Ia,Jl.current=oo;const ji=x.useRef(new Map),Ni=x.useRef(new Set),ki=x.useRef(null),mr=x.useRef(null),ls=x.useRef(0),Mt=x.useRef(new Set),xt=x.useRef(new Set);x.useEffect(()=>{const h=Zj();if(!h)return;n.current=h;const R=()=>{i(h.connected),o(h.statusText)};h.onStatus(R),h.onReconnect(()=>{R(),Fl({});const Le=dn.current;Le&&h.send({type:"session.sync",sessionId:Le,sinceSeq:vi.current});const pt=tl.current;pt&&h.send({type:"session.sync",sessionId:pt,sinceSeq:nl.current})});const ee=h.on(Le=>Ga(Le));h.connect();const Ne=window.setInterval(()=>{R(),h.connected&&h.send({type:"ping",nonce:Date.now()})},15e3);return()=>{ee(),window.clearInterval(Ne),h.close()}},[]);const Ga=x.useCallback(h=>{var R,ee,Ne,Le,pt,an,bs,Ol,sa,_l,Sa,Ea,zi,ys,Jt,rs;switch(h.type){case"hello.ok":i(!0);break;case"workspace.list":{N(Ty(h.workspaces)),C(Ty(h.archived)),Ns(null),de(Ue=>{var qt;if(Ue)return Ue;const Be=go.current,Xe=Be&&ZA(h.workspaces,Be.workspaceId);return Be&&Xe&&Xe.id!==Be.workspaceId&&(go.current={...Be,workspaceId:Xe.id}),(Xe==null?void 0:Xe.id)??((qt=h.workspaces[0])==null?void 0:qt.id)??null});const ke=Gs.current;if(!ke)break;const Ce=h.workspaces.find(Ue=>iM(Ue.path,ke));if(!Ce)break;Gs.current=null,At(!1),Ce.id!==It.current&&Oo(),de(Ce.id);break}case"workspace.candidates":if(h.query.trim()!==Rl.current)break;ps(h.candidates),h.source==="host"&&ua(!1);break;case"finder.opened":Rs.current=h.sessionId;break;case"workspace.roots":Hl(h.roots);break;case"workspace.created":if(h.workspace.id!==It.current&&Oo(),de(h.workspace.id),h.warnings.length===0){At(!1),ht(null);break}El({path:h.workspace.path,warnings:h.warnings});break;case"session.list":if(U(ke=>({...ke,[h.workspaceId]:{sessions:h.sessions??[],archived:h.archived??[]}})),h.workspaceId!==It.current)break;fe(h.sessions),X(h.archived);break;case"folder.list":D(h.workspaceFolders),te(!0),P(h.sessionFolders),z(h.pinnedFolders??[]),rt(h.projectsRoot??null),Ns(null);break;case"session.pinned":M(h.sessions);break;case"session.live":J(h.sessions);break;case"session.filesRewound":{const ke=`${h.sessionId}:${h.userIndex}:${h.dryRun}`,Ce=fr.current.get(ke);fr.current.delete(ke),Ce==null||Ce(h);break}case"session.contentResults":ms({query:h.query,hits:h.hits});break;case"order.state":Ee(h.order);break;case"session.summary":if(h.session.id===Rs.current){Re(h.session);break}if(h.session.parentSessionId){h.session.id===tl.current&&Zl(h.session);break}if(J(ke=>{const Ce=ke.findIndex(Be=>Be.id===h.session.id);if(h.session.state==="closed")return Ce===-1?ke:ke.filter(Be=>Be.id!==h.session.id);if(Ce===-1)return[...ke,h.session];const Ue=ke.slice();return Ue[Ce]=h.session,Ue}),fe(ke=>{const Ce=ke.findIndex(Be=>Be.id===h.session.id);if(Ce===-1)return h.session.workspaceId!==It.current?ke:[h.session,...ke];const Ue=ke.slice();return Ue[Ce]=h.session,Ue}),U(ke=>{const Ce=ke[h.session.workspaceId];if(!Ce)return ke;const Ue=Ce.sessions.findIndex(Xe=>Xe.id===h.session.id);let Be;if(Ue!==-1)Be=Ce.sessions.slice(),Be[Ue]=h.session;else{if(Ce.archived.some(Xe=>Xe.id===h.session.id))return ke;Be=[h.session,...Ce.sessions]}return{...ke,[h.session.workspaceId]:{...Ce,sessions:Be}}}),M(ke=>{const Ce=ke.findIndex(Be=>Be.id===h.session.id);if(Ce===-1)return ke;const Ue=ke.slice();return Ue[Ce]={...h.session,pinned:!0,...ke[Ce].pinnedAt?{pinnedAt:ke[Ce].pinnedAt}:{}},Ue}),dn.current===null&&yi.current&&yi.current.workspaceId===h.session.workspaceId&&(Ky(h.session.id,yi.current.text),yi.current=null),Ml.current!==null&&Ml.current===h.session.workspaceId&&h.session.workspaceId===It.current&&(Ml.current=null,qe(ke=>ke??h.session.id)),((R=hr.current)==null?void 0:R.sessionId)===h.session.id){const ke=hr.current;h.session.state==="error"?hr.current=null:h.session.state!=="closed"&&(hr.current=null,(ee=n.current)==null||ee.send({type:"prompt.send",sessionId:ke.sessionId,text:ke.text,images:ke.images,attachments:ke.attachments}))}break;case"usage.state":h.sessionId===dn.current&&(ss(h.usage),no(!1));break;case"context.state":h.sessionId===dn.current&&(qd(h.context),no(!1));break;case"session.capabilities":h.sessionId===dn.current&&Ge(h.capabilities);break;case"session.events":if(h.sessionId===tl.current){_i(ke=>Th(ke,h.entries));break}if(h.sessionId===Rs.current){B(ke=>Th(ke,h.entries));break}if(h.sessionId!==dn.current)break;for(const ke of h.entries){if(ke.event.kind!=="rewound")continue;const Ce=ke.event.toUserIndex,Ue=l1(bc.current.entries,Ce),Be=Ue.reduce((Xe,qt)=>qt.event.kind==="user.message"?Xe+1:Xe,0);dt(Xe=>({...Xe,entries:Ue})),Je(Xe=>({...Xe,items:a1(Xe.items,Ce,Be)}))}Je(ke=>Th(ke,h.entries));break;case"session.history":if(h.sessionId!==dn.current)break;dt(ke=>t1(ke,h));break;case"side.opened":{if(h.parentSessionId!==dn.current)break;tl.current=h.sessionId,ur(h.sessionId);const ke=Wl.current;Wl.current=[];for(const Ce of ke)Ce(h.sessionId);break}case"side.closed":if(h.parentSessionId!==dn.current)break;tl.current=null,ur(null),_i(Xs),Zl(null);break;case"git.state":if(h.workspaceId!==It.current)break;Gd(h.state);break;case"git.commit":if(h.workspaceId!==It.current)break;so(h.detail);break;case"git.result":if(h.workspaceId!==It.current)break;ml({ok:h.ok,message:h.message,url:h.url}),h.ok&&(so(null),lo(null),za(!1),ac(!1));break;case"git.busy":if(h.workspaceId!==It.current)break;Yd(h.label);break;case"git.files":if(h.workspaceId!==It.current)break;co({files:h.files,truncated:h.truncated});break;case"github.status":im(h.status);break;case"github.owners":cm(h.owners);break;case"fs.dir":if(h.workspaceId!==It.current)break;ic(ke=>({...ke,[h.path]:h.entries}));break;case"fs.search":if(h.workspaceId!==It.current)break;if(h.scope!=="tree"){const ke=h.scope;Nu(Ce=>({...Ce,[ke]:{query:h.query,entries:h.entries}}));break}Ts({query:h.query,entries:h.entries,truncated:h.truncated});break;case"fs.grep":if(h.workspaceId!==It.current)break;Ba({query:h.query,matches:h.matches,truncated:h.truncated});break;case"fs.file":{if(h.workspaceId!==It.current)break;const ke=Ni.current.delete(h.file.path);qs(Ue=>{const Be=Ue.findIndex(Tr=>Tr.path===h.file.path);if(Be===-1)return[...Ue,Db(h.file,++ls.current)];const Xe=Ue[Be],qt=Ue.slice();return qt[Be]=Xe.saved===h.file.content&&!ai(Xe)?{...Xe,mtime:h.file.mtime,size:h.file.size,stale:!1}:{...Db(h.file,++ls.current),previewMode:Xe.previewMode,textMode:Xe.textMode},qt}),ke&&ga(h.file.path);const Ce=fc.current;Ce&&Ce.path===h.file.path&&(fc.current=null,pi({...Ce,token:++mo.current}));break}case"fs.previewed":{if(h.workspaceId!==It.current)break;ar(ke=>{const Ce=ke[h.path];return{...ke,[h.path]:{forMtime:(Ce==null?void 0:Ce.forMtime)??h.mtime,loading:!1,html:h.html,missing:h.missing}}});break}case"fs.previewFailed":{if(h.workspaceId!==It.current)break;ar(ke=>{var Ce,Ue;return{...ke,[h.path]:{forMtime:((Ce=ke[h.path])==null?void 0:Ce.forMtime)??0,loading:!1,html:(Ue=ke[h.path])==null?void 0:Ue.html,missing:[],error:h.message}}});break}case"fs.media":{if(h.workspaceId!==It.current)break;Mt.current.delete(h.path),pa(ke=>({...ke,[h.path]:{mime:h.mime,base64:h.base64}})),qs(ke=>ke.map(Ce=>Ce.path===h.path?{...Ce,mediaBase64:h.base64,mediaError:void 0}:Ce));break}case"fs.mediaFailed":{if(h.workspaceId!==It.current)break;Mt.current.delete(h.path),pa(ke=>({...ke,[h.path]:{error:h.message}})),qs(ke=>ke.map(Ce=>Ce.path===h.path?{...Ce,mediaError:h.message}:Ce));break}case"fs.saved":{if(h.workspaceId!==It.current)break;if(((Ne=hn.current)==null?void 0:Ne.path)===h.path){const Xe=hn.current.path;hn.current=null,Cl({ok:!0,message:`Разговор сохранён: ${Xe}`}),Ni.current.add(Xe),(Le=n.current)==null||Le.send({type:"fs.read",workspaceId:h.workspaceId,path:Xe})}const ke=hi.current.get(h.path);hi.current.delete(h.path),Mt.current.delete(h.path),pa(Xe=>{if(!ke&&!(h.path in Xe))return Xe;const qt={...Xe};return ke?qt[h.path]=ke.entry:delete qt[h.path],qt});const Ce=ji.current.get(h.path);ji.current.delete(h.path);const Ue=Ce!==void 0;qs(Xe=>Xe.map(qt=>qt.path!==h.path?qt:Ue?{...qt,saved:Ce,mtime:h.mtime,size:h.size,stale:!1}:{...qt,stale:!0}));const Be=Jn.current.find(Xe=>Xe.path===h.path);!Ue&&Be&&!ai(Be)&&((pt=n.current)==null||pt.send({type:"fs.read",workspaceId:h.workspaceId,path:h.path})),(an=n.current)==null||an.send({type:"git.state",workspaceId:h.workspaceId});break}case"fs.result":{if(h.workspaceId!==It.current)break;if(((bs=hn.current)==null?void 0:bs.path)===h.path&&!h.ok){const Ue=hn.current;if(ji.current.delete(h.path),h.conflict&&Ue.attempt<50){const Be=Ue.attempt+1,Xe=Pb(Ue.base,Be);hn.current={...Ue,attempt:Be,path:Xe},(Ol=n.current)==null||Ol.send({type:"fs.write",workspaceId:h.workspaceId,path:Xe,content:Ue.content,eol:"lf",baseMtime:0})}else hn.current=null,Cl({ok:!1,message:h.message});break}Cl({ok:h.ok,message:h.message}),h.ok||ji.current.delete(h.path);const ke=hi.current.get(h.path);if(!h.ok&&ke&&(hi.current.delete(h.path),pa(Ue=>{if(!(h.path in Ue))return Ue;const Be={...Ue};return delete Be[h.path],Be}),ke.onFail(h.message)),h.conflict&&qs(Ue=>Ue.map(Be=>Be.path===h.path?{...Be,stale:!0}:Be)),mr.current===h.path){const Ue=mr.current;mr.current=null,h.ok&&(Ni.current.add(Ue),(sa=n.current)==null||sa.send({type:"fs.read",workspaceId:h.workspaceId,path:Ue}))}const Ce=ki.current;if(h.ok&&Ce&&Ce.to===h.path){ki.current=null;const Ue=Be=>Be===Ce.from?Ce.to:Be.startsWith(`${Ce.from}/`)?Ce.to+Be.slice(Ce.from.length):Be;qs(Be=>Be.map(Xe=>({...Xe,path:Ue(Xe.path)}))),ga(Be=>Be===null?null:Ue(Be)),uo(Be=>Be.map(Ue)),ic(Be=>{const Xe={};for(const[qt,Tr]of Object.entries(Be))qt===Ce.from||qt.startsWith(`${Ce.from}/`)||(Xe[qt]=Tr);return Xe})}h.ok&&((_l=n.current)==null||_l.send({type:"git.state",workspaceId:h.workspaceId}));break}case"term.list":if(h.workspaceId!==It.current)break;or(h.terminals);break;case"term.opened":if(h.terminal.workspaceId!==It.current)break;mc(null),or(ke=>{const Ce=ke.findIndex(Be=>Be.id===h.terminal.id);if(Ce===-1)return[...ke,h.terminal];const Ue=ke.slice();return Ue[Ce]=h.terminal,Ue}),xc.current&&(xc.current=!1,hc(h.terminal.id));break;case"term.buffer":(Sa=pc.current.get(h.id))==null||Sa({kind:"buffer",data:h.data});break;case"term.data":(Ea=pc.current.get(h.id))==null||Ea({kind:"data",data:h.data});break;case"term.exit":or(ke=>ke.map(Ce=>Ce.id===h.id?{...Ce,exitCode:h.exitCode}:Ce));break;case"term.closed":or(ke=>ke.filter(Ce=>Ce.id!==h.id));break;case"mcp.list":h.sessionId===dn.current&&ol(h.servers);break;case"mcp.auth":h.sessionId===dn.current&&Gn(h.state);break;case"plugin.list":if(h.sessionId!==dn.current)break;Pt(h.plugins),ns(h.duplicates),Hn(h.marketplaces),Oa(h.catalog);break;case"operation.result":h.sessionId===dn.current&&Nn(h.result);break;case"auth.status":pe(ke=>({...ke,[h.accountId]:h.status}));break;case"accounts.candidates":at(h.candidates);break;case"accounts.usage":Bl(ke=>{const Ce={...ke};for(const[Ue,Be]of Object.entries(h.usage))(Be!==null||!(Ue in Ce))&&(Ce[Ue]=Be);return Ce});break;case"accounts.state":S(h.accounts.length>0?h.accounts:My),ze(null),pe(ke=>{const Ce={};for(const Ue of h.accounts)Ce[Ue.id]=h.auth[Ue.id]??ke[Ue.id]??null;return Ce});break;case"relay.state":m(h.state);break;case"memory.state":Un(h.files),Gt(h.accountId);break;case"memory.file":vt({id:h.id,content:h.content,mtime:h.mtime});break;case"memory.result":es({id:h.id,ok:h.ok,message:h.message,conflict:h.conflict,mtime:h.mtime});break;case"site.opened":zs({n:++_e.current,ok:!0,url:h.url,proxyUrl:h.proxyUrl});break;case"site.failed":zs({n:++_e.current,ok:!1,url:h.url,message:h.message});break;case"video.catalog":{const{type:ke,...Ce}=h;Kn(Ce);break}case"video.studio":Bn(ke=>({...ke,[`${h.state.workspaceId}
166
+ ${h.state.root}`]:h.state}));break;case"schedule.state":_t(h.tasks);break;case"network.state":g(h.state);break;case"settings.state":wn(h.settings);break;case"handoff.state":tc(ke=>{if(!h.handoff){if(!(h.sessionId in ke))return ke;const Ce={...ke};return delete Ce[h.sessionId],Ce}return{...ke,[h.sessionId]:h.handoff}});break;case"handoff.written":Fl(ke=>{if(!(h.sessionId in ke))return ke;const Ce={...ke};return delete Ce[h.sessionId],Ce}),h.handoff&&dn.current===h.sessionId?fl(h.handoff):h.handoff||console.warn("[handoff] хост не смог записать хэндофф",h.sessionId);break;case"limit.stopped":el.current+=1,hl(ke=>[...ke,{id:el.current,limit:h.limit,utilization:h.utilization,stopped:h.stopped,handoffs:h.handoffs}]);break;case"auth.login":zt(ke=>({...ke,[h.accountId]:h.state})),h.state.active&&Js(!0);break;case"session.closed":J(ke=>ke.filter(Ce=>Ce.id!==h.sessionId)),fe(ke=>ke.map(Ce=>Ce.id===h.sessionId?{...Ce,state:"closed"}:Ce)),U(ke=>{let Ce=!1;const Ue={};for(const[Be,Xe]of Object.entries(ke))Xe.sessions.some(qt=>qt.id===h.sessionId&&qt.state!=="closed")?(Ce=!0,Ue[Be]={...Xe,sessions:Xe.sessions.map(qt=>qt.id===h.sessionId?{...qt,state:"closed"}:qt)}):Ue[Be]=Xe;return Ce?Ue:ke});break;case"error":console.error("[host]",h.message,h.context??""),(h.context==="workspace.open"||h.context==="workspace.create")&&(Gs.current=null,ht(h.message)),(zi=h.context)!=null&&zi.startsWith("term.")&&mc(h.message),(ys=h.context)!=null&&ys.startsWith("folder.")&&(Ns(null),Zs(`${h.message} Ничего не изменилось.`)),(Jt=h.context)!=null&&Jt.startsWith("accounts.")&&ze(h.message),(rs=h.context)!=null&&rs.startsWith("schedule.")&&Qn(h.message);break}},[]),ne=x.useCallback(h=>{var R;(R=n.current)==null||R.send(h)},[]),Su=x.useCallback((h,R,ee)=>{const Ne=`${h}:${R}:${ee}`;return new Promise(Le=>{const pt=setTimeout(()=>{fr.current.delete(Ne),Le({type:"session.filesRewound",sessionId:h,userIndex:R,dryRun:ee,canRewind:!1,error:"Хост не ответил."})},3e4);fr.current.set(Ne,an=>{clearTimeout(pt),Le(an)}),ne({type:"session.rewindFiles",sessionId:h,userIndex:R,dryRun:ee})})},[ne]);x.useEffect(()=>{$&&ne({type:"session.list",workspaceId:$})},[$,ne]),x.useEffect(()=>{l&&ne({type:"session.pins"})},[l,ne]),x.useEffect(()=>{l&&ne({type:"settings.get"})},[l,ne]),x.useEffect(()=>{if(l)return ne({type:"session.drafts",sessionIds:Qy()}),Jj(h=>ne({type:"session.drafts",sessionIds:h}))},[l,ne]),x.useEffect(()=>{if(bi.current)return;const h=go.current;if(!h||!$)return;if($!==h.workspaceId){bi.current=!0;return}if(ae){bi.current=!0;return}if(F.length===0)return;const R=F.find(ee=>PA(ee,h));bi.current=!0,R&&R.state!=="closed"&&Va(R)},[F,$,ae]),x.useEffect(()=>{!$||gc||!qa||ne({type:"term.list",workspaceId:$})},[$,gc,qa,ne]),x.useEffect(()=>{hc(h=>{var R;return h&&cr.some(ee=>ee.id===h)?h:((R=cr[0])==null?void 0:R.id)??null})},[cr]),x.useEffect(()=>{wt&&ne({type:"workspace.roots"})},[wt,ne]);const sl=x.useCallback(()=>{const h=dn.current;h&&(no(!0),ne({type:"usage.get",sessionId:h}),ne({type:"context.get",sessionId:h}))},[ne]);x.useEffect(()=>{if(!nr)return;const h=window.setTimeout(()=>no(!1),KA);return()=>window.clearTimeout(h)},[nr]);const xo=x.useMemo(()=>{const h=Math.max((xn==null?void 0:xn.fetchedAt)??0,(sn==null?void 0:sn.fetchedAt)??0);return h>0?h:null},[xn==null?void 0:xn.fetchedAt,sn==null?void 0:sn.fetchedAt]);x.useEffect(()=>{if(qd(null),!ae)return;sl();const h=()=>{document.hidden||sl()},R=window.setInterval(h,FA),ee=()=>{document.hidden||sl()};return document.addEventListener("visibilitychange",ee),()=>{window.clearInterval(R),document.removeEventListener("visibilitychange",ee)}},[ae,sl]),x.useEffect(()=>{if(!ae){dt(Np);return}dt({...Np,loading:!0}),ne({type:"session.history",sessionId:ae})},[ae,ne]);const Qd=x.useCallback(()=>{!ae||Ft.loading||!kp(Ft)||(dt(h=>({...h,loading:!0})),ne({type:"session.history",sessionId:ae,before:Wy(Ft)}))},[ae,Ft,ne]),_a=x.useMemo(()=>n1(Ft.entries),[Ft.entries]),wi=x.useMemo(()=>Qe?bT([..._a,...Ve.items]):[],[Qe,_a,Ve.items]),Eu=x.useMemo(()=>{const h={};for(const R of Object.values(Sl))R.workspaceId===$&&(h[R.root]=R);return h},[Sl,$]);function yc(h){return ae?(Pe({token:++et.current,text:h}),ga(null),!0):!1}const Y=x.useMemo(()=>F.find(h=>h.id===ae)??null,[F,ae]),ba=Y!==null&&Y.state!=="closed"&&us(Y.provider)&&Y.parentSessionId===null;x.useEffect(()=>{ol([]),Gn(null),ae&&ba&&ne({type:"mcp.list",sessionId:ae})},[ae,ba,ne]);const gs=ae?(Y==null?void 0:Y.claudeSessionId)??ae:null,as=gs?Vl[gs]??null:null;x.useEffect(()=>{gs&&ne({type:"handoff.get",sessionId:gs})},[gs,ne]),x.useEffect(()=>{Ws&&!(Ws.sessionId in Vl)&&Yn(null)},[Vl,Ws]);const ea=x.useMemo(()=>{var ee;if(!xn)return null;const h=(((ee=xn.buckets)==null?void 0:ee.length)??0)>0,R=!us(Y==null?void 0:Y.provider);return h===R?xn:null},[xn,Y==null?void 0:Y.provider]),pr=be.length>1;function _o(h){return be.some(R=>R.id===h)?h:Ki}const gr=x.useMemo(()=>({accounts:be,auth:K,multi:be.length>1}),[be,K]),Ys=pr&&Y&&us(Y.provider)?be.find(h=>h.id===Y.accountId)??null:null,Si=x.useMemo(()=>{const h={};for(const R of F)us(R.provider)&&(R.state!=="running"&&R.state!=="waiting_permission"||(h[R.accountId]=(h[R.accountId]??0)+1));return h},[F]),is="Обновить лимиты и контекст",bo=is+(xo?`
167
+ обновлено в ${new Date(xo).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}`:"");x.useEffect(()=>{document.documentElement.dataset.provider=(Y==null?void 0:Y.provider)??"claude"},[Y==null?void 0:Y.provider]),x.useEffect(()=>{us(Y==null?void 0:Y.provider)||As(!1)},[Y==null?void 0:Y.provider]);const En=k.find(h=>h.id===$)??E.find(h=>h.id===$)??null;x.useEffect(()=>{if(!$||!ae)return;const h={workspaceId:$,sessionId:ae,claudeSessionId:(Y==null?void 0:Y.claudeSessionId)??null};try{localStorage.setItem(jv,JSON.stringify(h))}catch{}},[$,ae,Y==null?void 0:Y.claudeSessionId]),x.useEffect(()=>{if(!ts)return;const h=window.setTimeout(()=>Ns(null),6e4);return()=>window.clearTimeout(h)},[ts]);function Zd(h){Gs.current=h,ht(null),ne({type:"workspace.open",path:h})}function fm(h,R,ee,Ne){ht(null),ne({type:"workspace.create",parent:h,name:R,init:ee,...Ne?{folderId:Ne}:{}})}function hm(h){if(Rl.current=h,!h){ps([]),ua(!1);return}ua(!0),ne({type:"workspace.find",query:h})}function Vn(h){Rl.current=h,B(Xs),ne({type:"workspace.find.agent",query:h})}function Cu(){At(!1),ht(null),El(null),ps([]),B(Xs),Re(null),Rl.current="",Gs.current=null}function Dl(){const h=dn.current;h&&tl.current&&ne({type:"side.reset",sessionId:h}),tl.current=null,ur(null),_i(Xs),Zl(null),Pl({}),Wl.current=[]}function vc(h){ne({type:"workspace.close",workspaceIds:h}),Ei(h)}function Tu(h){ne({type:"workspace.unmark",workspaceIds:h}),Ei(h)}function Ei(h){!$||!h.includes($)||(Dl(),de(null),qe(null),fe([]),X([]),Je(Xs),Ge(null),lt(!1))}function xr(h,R){ne({type:"session.archive",workspaceId:h,sessionIds:R}),ae&&(R.includes(ae)||Y!=null&&Y.claudeSessionId&&R.includes(Y.claudeSessionId))&&(Dl(),qe(null),Je(Xs),Ge(null),lt(!1))}function mm(h){ne({type:"workspace.restore",workspaceIds:h})}function Pd(h,R,ee){Zs(null),ne({type:"folder.create",scope:h,name:R,workspaceId:ee})}function pm(h,R){Zs(null),ne({type:"folder.rename",folderId:h,name:R})}function Wd(h,R){ne({type:"folder.setColor",folderId:h,color:R})}function Ci(h,R,ee,Ne){Zs(null),h==="workspace"&&Ns(R),ne({type:"folder.assign",scope:h,itemId:R,folderId:ee,workspaceId:Ne})}function Au(h=T[0]??"claude",R){if(!$)return;let ee;h==="claude"&&pr&&(ee=R??_o(un),kn(ee),Gj(ee)),Dl(),qe(null),Ge(null),Je(Xs),lt(!1),Ml.current=$,ne({type:"session.start",workspaceId:$,provider:h,...ee?{accountId:ee}:{}}),Ze(!1)}function Ya(h){Ml.current=null,Dl(),Oo(),de(h),qe(null),Je(Xs),Ge(null),lt(!1),Gd(null),so(null),lo(null),ml(null),Yd(""),za(!1),co(null),ac(!1),or([]),hc(null)}function Jd(h,R,ee){ne({type:"session.pin",workspaceId:h,sessionIds:R,pinned:ee})}function _r(h){return h.state==="running"||h.state==="waiting_permission"||h.state==="reconnecting"||h.backgroundWork}function jc(h){if(_r(h)){ce(h);return}ne({type:"session.close",sessionId:h.id})}function yo(h,R,ee){Ee(Ne=>{const Le=Ne??{workspaces:[],sessions:{},pinned:[],live:[]};if(h==="sessions"){if(!ee)return Ne;const pt={...Le.sessions};return R&&R.length>0?pt[ee]=R:delete pt[ee],{...Le,sessions:pt}}return{...Le,[h]:R??[]}}),ne({type:"order.set",scope:h,ids:R,...ee?{workspaceId:ee}:{}})}function vo(h){h.workspaceId!==$&&Ya(h.workspaceId),Va(h)}function Va(h){if(Ze(!1),Dl(),Je(Xs),Ge(null),lt(!1),h.state==="closed"){qe(null),Ml.current=h.workspaceId,ne({type:"session.start",workspaceId:h.workspaceId,resume:h.claudeSessionId??h.id});return}Ml.current=null,qe(h.id),ne({type:"session.sync",sessionId:h.id,sinceSeq:0})}function ef(h){ne({type:"session.searchContent",query:h})}function Ti(h){const R=F.find(ee=>ee.id===h.sessionId||ee.claudeSessionId===h.sessionId);if(R&&R.workspaceId===h.workspaceId&&h.workspaceId===$){Va(R);return}if(h.workspaceId!==$){Qs(h.sessionId),Ya(h.workspaceId);return}Ze(!1),Dl(),Je(Xs),Ge(null),lt(!1),qe(null),Ml.current=h.workspaceId,ne({type:"session.start",workspaceId:h.workspaceId,resume:h.sessionId})}x.useEffect(()=>{if(!Zn||!$)return;const h=F.find(Ne=>Ne.workspaceId===$&&(Ne.id===Zn||Ne.claudeSessionId===Zn));if(h){Qs(null),Va(h);return}const R=Zn,ee=setTimeout(()=>{Qs(Ne=>Ne===R?null:Ne),Ml.current=$,qe(null),ne({type:"session.start",workspaceId:$,resume:R})},1200);return()=>clearTimeout(ee)},[F,Zn,$]);function Xa(){return CS([..._a,...Ve.items],{title:(Y==null?void 0:Y.title)??null,project:(En==null?void 0:En.name)??null,agent:X_(Y==null?void 0:Y.provider),partial:kp(Ft)})}function Mu(){AS(`${Zb((Y==null?void 0:Y.title)??null)}.md`,Xa())}function Ru(){if(!$)return;const h=Zb((Y==null?void 0:Y.title)??null),R=Xa(),ee=Pb(h,1);hn.current={base:h,attempt:1,path:ee,content:R},ne({type:"fs.write",workspaceId:$,path:ee,content:R,eol:"lf",baseMtime:0})}function br(h){if(!h.lastSessionId)return;Tt(!1);const R=F.find(ee=>ee.id===h.lastSessionId);if(R&&R.workspaceId===$){Va(R);return}Mn(h.lastSessionId),h.workspaceId!==$?Ya(h.workspaceId):ne({type:"session.list",workspaceId:h.workspaceId})}x.useEffect(()=>{if(!Es)return;const h=F.find(R=>R.id===Es);h&&(Mn(null),Va(h))},[F,Es]);function Nc(h,R,ee){if(!ae||_)return!1;const Ne=ae,Le=Y;return Fa(()=>{if((Le==null?void 0:Le.state)==="closed"){hr.current={sessionId:Le.claudeSessionId??Le.id,text:h,images:R,attachments:ee},Va(Le);return}ne({type:"prompt.send",sessionId:Ne,text:h,images:R,attachments:ee})})}const yr=qn!==null&&qn.active&&qn.accountId===(Y==null?void 0:Y.accountId);function vr(){if(!yr||!qn)return Promise.resolve(!0);const h=qn.name;return new Promise(R=>{Bs(ee=>(ee==null||ee.resolve(!1),{name:h,resolve:R}))})}function jr(h){Yt&&(Yt.resolve(h),Bs(null))}function tf(h){$s(R=>{const ee=[...new Set([...R,...h])];try{localStorage.setItem(Nv,JSON.stringify(ee))}catch{}return ee})}function Fa(h){const R=us(Y==null?void 0:Y.provider)?AA(xn,Wt):null;return R?new Promise(ee=>{W(Ne=>(Ne==null||Ne.resolve(!1),{warning:R,resolve:ee}))}).then(ee=>(ee&&h(),ee)):(h(),!0)}function jo(h){A&&(A.resolve(h),W(null))}function ya(h){const R=O.find(Le=>(Le.claudeSessionId??Le.id)===h.sessionId&&Le.state!=="closed"),ee=kc(h.sessionId,h.workspaceId,h.limit!==null),Ne=ee!=null&&ee.canChoose?ee.selectedId:(ee==null?void 0:ee.sourceId)??(R==null?void 0:R.accountId);va(h.workspaceId,h.sessionId,h.text,Ne),R&&ne({type:"session.close",sessionId:R.id})}function kc(h,R,ee){var Sa,Ea,zi;if(!pr)return null;const Ne=ys=>ys.id===h||ys.claudeSessionId===h,Le=O.find(Ne)??F.find(Ne)??((Sa=ge[R])==null?void 0:Sa.sessions.find(Ne));if(Le&&!us(Le.provider))return null;const pt=Le==null?void 0:Le.accountId,an=be.filter(ys=>{var Jt;return((Jt=K[ys.id])==null?void 0:Jt.loggedIn)!==!1}),bs=ys=>ys&&an.some(Jt=>Jt.id===ys)?ys:void 0,Ol=bs(di[h]),sa=pt?(Ea=an.find(ys=>ys.id!==pt))==null?void 0:Ea.id:void 0,_l=Ol??(ee?sa:void 0)??bs(pt)??bs(Ki)??((zi=an[0])==null?void 0:zi.id)??Ki;return{source:be.find(ys=>ys.id===pt)??null,sourceId:pt,targets:an,selectedId:_l,canChoose:an.length>1}}function No(h){va(h.workspaceId,h.claudeSessionId??h.id,null,h.accountId)}function va(h,R,ee,Ne){yi.current=ee===null?null:{workspaceId:h,text:ee},h!==$?Ya(h):(Dl(),qe(null),Ge(null),Je(Xs),lt(!1)),Ml.current=h,ne({type:"session.start",workspaceId:h,provider:"claude",...pr&&Ne?{accountId:Ne}:{},continuesFrom:R,...ee===null?{}:{fromHandoff:!0}}),Ze(!1)}x.useEffect(()=>{dl&&(fl(null),ya(dl))},[dl]);function ja(h){Xl[h.id]||(Fl(R=>({...R,[h.id]:!0})),ne({type:"session.handoff",sessionId:h.id}))}function wc(h){ne({type:"handoff.dismiss",sessionId:h})}function ko(h,R){ne({type:"session.rename",sessionId:h.id,title:R,workspaceId:h.workspaceId}),fe(ee=>ee.map(Ne=>Ne.id===h.id?{...Ne,title:R}:Ne)),U(ee=>{const Ne=ee[h.workspaceId];return Ne?{...ee,[h.workspaceId]:{...Ne,sessions:Ne.sessions.map(Le=>Le.id===h.id?{...Le,title:R}:Le)}}:ee})}function Sc(h){ae&&(Ze(!1),Nn(null),Gn(null),pn(h),ne({type:"mcp.list",sessionId:ae}),ne({type:"plugin.list",sessionId:ae}))}const Nr={mcpAction:(h,R)=>{ae&&(Nn(null),ne({type:"mcp.action",sessionId:ae,name:h,action:R}))},mcpAuth:(h,R)=>{if(!ae)return;const ee=R??(Y==null?void 0:Y.accountId)??Ki;Nn(null),Gn({name:h,accountId:ee,stage:"starting",active:!0,url:"",callbackExpected:!1,done:!1,error:null,diagnostic:null,otherAccounts:[]}),ne({type:"mcp.auth",sessionId:ae,name:h,...R&&R!==(Y==null?void 0:Y.accountId)?{accountId:R}:{}})},mcpAuthCallback:(h,R)=>{ae&&ne({type:"mcp.auth_callback",sessionId:ae,name:h,callbackUrl:R})},mcpAdd:(h,R)=>{ae&&ne({type:"mcp.add",sessionId:ae,name:h,draft:R})},mcpRemove:h=>{ae&&ne({type:"mcp.remove",sessionId:ae,name:h})},pluginInstall:h=>{ae&&ne({type:"plugin.install",sessionId:ae,spec:h})},pluginDedupe:h=>{ae&&(Nn(null),ne({type:"plugin.dedupe",sessionId:ae,id:h}))},pluginUninstall:h=>{ae&&ne({type:"plugin.uninstall",sessionId:ae,id:h})},pluginToggle:(h,R)=>{ae&&ne({type:"plugin.toggle",sessionId:ae,id:h,enabled:R})},marketplaceAdd:h=>{ae&&ne({type:"marketplace.add",sessionId:ae,source:h})},marketplaceRemove:h=>{ae&&ne({type:"marketplace.remove",sessionId:ae,name:h})}};function kr(){Ze(!1),Js(!0),ze(null);for(const h of be)ne({type:"auth.status",accountId:h.id})}const wo={login:(h,R,ee)=>ne({type:"auth.login",mode:R,switchAccount:ee,accountId:h}),submitCode:(h,R)=>ne({type:"auth.code",code:R,accountId:h}),cancel:h=>ne({type:"auth.cancel",accountId:h}),logout:h=>ne({type:"auth.logout",accountId:h})},nf={discover:()=>ne({type:"accounts.discover"}),requestUsage:()=>ne({type:"accounts.usage"}),add:(h,R,ee,Ne)=>{ze(null),ne({type:"accounts.add",name:h,color:R,...ee?{configDir:ee}:{},...Ne?{shareConfig:!0}:{}})},update:(h,R)=>{ze(null),ne({type:"accounts.update",accountId:h,...R})},remove:h=>{ze(null),ne({type:"accounts.remove",accountId:h})},makeMain:h=>{ze(null),ne({type:"accounts.makeMain",accountId:h})}};function Ka(h){Js(!1),Ze(!1),gn(h),Te(!0),ne({type:"settings.get"});for(const R of be)ne({type:"auth.status",accountId:R.id})}function So(){Ze(!1),gn(null),Te(!0),ne({type:"settings.get"});for(const h of be)ne({type:"auth.status",accountId:h.id})}function sf(h){wn(R=>R&&{...R,...h}),ne({type:"settings.update",settings:h})}function Du(h,R,ee){!ae||_||ne({type:"side.ask",sessionId:ae,text:h,images:R,attachments:ee})}function Lu(){ae&&(ne({type:"side.reset",sessionId:ae}),tl.current=null,ur(null),_i(Xs),Zl(null),Pl({}),Wl.current=[])}function xs(h){const R=tl.current;if(R){h(R);return}const ee=dn.current;ee&&(Wl.current.push(h),ne({type:"side.open",sessionId:ee}))}function ll(){$&&ne({type:"git.state",workspaceId:$})}function Qa(h){$&&(lo(h),ne({type:"git.show",workspaceId:$,ref:h}))}function Eo(h,R){ml(null),ro({target:h,label:R})}function lf(){!$||!io||(ne({type:"git.checkout",workspaceId:$,target:io.target}),ro(null))}function Za(){$&&(ml(null),ne({type:"git.push",workspaceId:$}))}function al(h){$&&(ml(null),ne({type:"git.pull",workspaceId:$,merge:h}))}function Dn(){$&&(ml(null),co(null),za(!0),ne({type:"github.status"}),ne({type:"github.owners"}),ne({type:"git.files",workspaceId:$}))}function Co(h){$&&(ml(null),ne({type:"git.publish",workspaceId:$,...h}))}function Na(h){$&&(ml(null),ne({type:"git.remote",workspaceId:$,url:h}))}function ct(){ml(null),ac(!0)}function Ht(h){ne({type:"github.token",token:h}),ne({type:"github.owners"})}function Xn(){ne({type:"github.status"}),ne({type:"github.owners"})}x.useEffect(()=>{if(!(!Hs||!$))for(const h of oo)h in pl||ne({type:"fs.list",workspaceId:$,path:h})},[Hs,oo,pl,$,ne]);function To(h){uo(R=>R.includes(h)?R.filter(ee=>ee!==h):[...R,h])}function wr(h){if(!h){Ts(null);return}$&&ne({type:"fs.search",workspaceId:$,query:h})}function Ai(h){if(!h){Ba(null);return}$&&ne({type:"fs.grep",workspaceId:$,query:h})}const Ec=x.useCallback((h,R)=>{ju(Le=>({...Le,[h]:R}));const ee=It.current;if(R===null||!ee)return;const Ne=R.lastIndexOf("/");if(Ne!==-1){ne({type:"fs.list",workspaceId:ee,path:R.slice(0,Ne)});return}if(R===""){ne({type:"fs.list",workspaceId:ee,path:""});return}ne({type:"fs.search",workspaceId:ee,query:R,scope:h})},[ne]),Cc=x.useMemo(()=>Ry(Ua.mention??null,dc.mention??null,pl),[Ua.mention,dc.mention,pl]),Sr=x.useMemo(()=>Ry(Ua.side??null,dc.side??null,pl),[Ua.side,dc.side,pl]);function gm(h){Er(h.path,{line:h.line,column:h.column})}function Cn(h){const R=[];let ee=Wr(h.path);for(;R.push(ee),!!ee;)ee=Wr(ee);uo(Ne=>{const Le=new Set(Ne);for(const pt of R)Le.add(pt);return h.kind==="dir"&&Le.add(h.path),[...Le]}),h.kind==="file"&&Er(h.path)}function Er(h,R){if(Jn.current.find(Ne=>Ne.path===h)){ga(h),R&&pi({path:h,...R,token:++mo.current});return}$&&(R&&(fc.current={path:h,...R}),Ni.current.add(h),ne({type:"fs.read",workspaceId:$,path:h}))}function Tc(h,R=!1){const ee=Jn.current,Ne=ee.find(an=>an.path===h);if(Ne&&ai(Ne)&&!R){ho(h);return}ho(null);const Le=ee.findIndex(an=>an.path===h),pt=ee.filter(an=>an.path!==h);qs(pt),ga(an=>{var bs;return an===h?((bs=pt[Math.min(Le,pt.length-1)])==null?void 0:bs.path)??null:an})}function Ac(h,R=!1){const ee=Jn.current.find(Ne=>Ne.path===h);!ee||!$||!R&&!ai(ee)||(ji.current.set(h,ee.text),ne({type:"fs.write",workspaceId:$,path:h,content:ee.text,eol:ee.eol,encoding:ee.encoding,baseMtime:ee.mtime,...R?{force:!0}:{}}))}function af(h,R=!1){if(!$)return;const ee=Jn.current.find(pt=>pt.path===h);if(!ee)return;const Ne=cc.current[h];if(!R&&Ne&&Ne.forMtime===ee.mtime)return;const Le={forMtime:ee.mtime,loading:!0,html:Ne==null?void 0:Ne.html,missing:[]};ar(pt=>({...pt,[h]:Le})),ne({type:"fs.preview",workspaceId:$,path:h})}function rf(h){const R=Le=>Le.replaceAll("\\","/"),ee=R(h),Ne=ta?R(ta).replace(/\/+$/,""):"";return Ne&&ee.toLowerCase().startsWith(Ne.toLowerCase()+"/")?ee.slice(Ne.length+1):ee.replace(/^\.\//,"")}function Ou(h){const R=rf(h),ee=Jn.current.find(Ne=>Ne.path===R);ee&&!ee.previewMode&&qs(Ne=>Ne.map(Le=>Le.path===R?{...Le,previewMode:!0,textMode:!1}:Le)),Er(R)}const Ao=x.useRef(new Set);x.useEffect(()=>{var h;if($)for(const R of Ve.items){if(R.kind!=="tool"||R.result===null||R.isError||!["Write","Edit","MultiEdit"].includes(R.name)||Ao.current.has(R.toolUseId))continue;Ao.current.add(R.toolUseId);const ee=(h=R.input)==null?void 0:h.file_path;if(typeof ee!="string"||!Ph(ee))continue;const Ne=rf(ee),Le=Jn.current.find(pt=>pt.path===Ne);Le&&!ai(Le)&&Mo(Ne)}},[Ve.items,$]);function Mo(h){$&&ne({type:"fs.read",workspaceId:$,path:h})}function _s(h){$&&(Mt.current.has(h)||(Mt.current.add(h),ne({type:"fs.readMedia",workspaceId:$,path:h})))}function Ln(h){_s(h)}function Ro(h,R,ee){const Ne=$;if(!Ne)return null;const Le=Wr(h),pt=`${zk(h)}-${Ok()}`,an=Lk(R.type);let bs=`${pt}.${an}`;for(let _l=2;xt.current.has(`${Le}/${bs}`);_l+=1)bs=`${pt}-${_l}.${an}`;const Ol=Le?`${Le}/assets/${bs}`:`assets/${bs}`;xt.current.add(`${Le}/${bs}`);const sa=new FileReader;return sa.onload=()=>{const _l=String(sa.result),Sa=_l.slice(_l.indexOf(",")+1),Ea={mime:R.type,base64:Sa};hi.current.set(Ol,{entry:Ea,onFail:ee}),pa(zi=>({...zi,[Ol]:Ea})),ne({type:"fs.writeBinary",workspaceId:Ne,path:Ol,base64:Sa})},sa.onerror=()=>ee("Не удалось прочитать картинку из буфера обмена."),sa.readAsDataURL(R),`![](assets/${bs})`}const Mc=x.useRef(new Map);function Do(h){const R=Mc.current,ee=R.get(h);ee&&clearTimeout(ee);const Ne=(Wt==null?void 0:Wt.autoSaveAfterPauseMs)??0;Ne<=0||R.set(h,setTimeout(()=>{R.delete(h);const Le=Jn.current.find(pt=>pt.path===h);Le&&ai(Le)&&!Le.stale&&Ac(h)},Ne))}function zu(h,R,ee){if(!$)return;const Ne=h?`${h}/${ee}`:ee;Cl(null),R==="file"&&(mr.current=Ne),ne({type:"fs.create",workspaceId:$,path:Ne,kind:R})}function ka(h,R){if(!$)return;const ee=Wr(h),Ne=ee?`${ee}/${R}`:R;Cl(null),ki.current={from:h,to:Ne},ne({type:"fs.rename",workspaceId:$,path:h,to:Ne})}function Lo(h,R){if(!$)return;const ee=h.slice(h.lastIndexOf("/")+1),Ne=R?`${R}/${ee}`:ee;Ne!==h&&(Cl(null),ki.current={from:h,to:Ne},ne({type:"fs.rename",workspaceId:$,path:h,to:Ne}))}function Iu(h,R){$&&(Cl(null),ne({type:"fs.copy",workspaceId:$,path:h,toDir:R}))}function Uu(h){$&&(Cl(null),fo(null),ne({type:"fs.delete",workspaceId:$,path:h.path}),qs(R=>R.filter(ee=>ee.path!==h.path&&!ee.path.startsWith(`${h.path}/`))),ga(R=>R&&(R===h.path||R.startsWith(`${h.path}/`))?null:R))}function Oo(){ic({}),uo([""]),qs([]),ar(()=>({})),ga(null),Cl(null),Ts(null),Ba(null),ju({}),Nu({}),pi(null),Ni.current.clear(),ji.current.clear(),Mt.current.clear(),hi.current.clear(),pa({}),fc.current=null,ki.current=null,mr.current=null}function cf(){!$||gc||!qa||(mc(null),xc.current=!0,ne({type:"term.open",workspaceId:$,cols:80,rows:24}))}function of(h){ne({type:"term.close",id:h})}function uf(h,R){ae&&ne({type:"permission.respond",sessionId:ae,requestId:h,decision:R})}function df(h,R){ae&&ne({type:"permission.respond",sessionId:ae,requestId:h,decision:"allow",answers:R})}function ff(h){ae&&ne({type:"permission.respond",sessionId:ae,requestId:h,decision:"deny",reason:"Пользователь не стал отвечать на вопросы"})}function $u(h,R){ae&&ne({type:"permission.respond",sessionId:ae,requestId:h,decision:"allow",plan:R})}function hf(h){ae&&ne({type:"permission.respond",sessionId:ae,requestId:h,decision:"deny",reason:"Пользователь просит продолжить планирование"})}x.useEffect(()=>{function h(R){if(R.key!=="Escape")return;if(Sn!==null){const Ne=R.target;if(!(Ne instanceof HTMLElement&&Ne.closest(".termview, .editor, .sidepane"))){Ms(null);return}}if(!ae||Ve.pending.length>0)return;const ee=R.target;ee instanceof HTMLElement&&ee.closest(".sidepane, .editor")||ne({type:"control.interrupt",sessionId:ae})}return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[ae,Ve.pending.length,ne,Sn]),x.useEffect(()=>{function h(R){R.key!=="`"||!(R.ctrlKey||R.metaKey)||qa&&(R.preventDefault(),Ha(ee=>!ee))}return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[qa]);const mf=x.useMemo(()=>{const h=(Se==null?void 0:Se.commands)??[];return h.length===0||!us(Y==null?void 0:Y.provider)?h:[...h,{name:"plugins",description:"Плагины и маркетплейсы — окно приложения",argumentHint:"",aliases:["plugin"]},...Ay]},[Se,Y==null?void 0:Y.provider]);function Bu(h){const R=WA[h];if(R&&us(Y==null?void 0:Y.provider))return Sc(R),!0;if(!us(Y==null?void 0:Y.provider)||!Ay.some(Ne=>Ne.name===h))return!1;const ee=(Y==null?void 0:Y.accountId)??Ki;return Ka(ee),h==="logout"&&wo.logout(ee),h==="switch-account"&&wo.login(ee,"claudeai",!0),!0}const Rc=(Y==null?void 0:Y.state)==="waiting_permission",xl=(Y==null?void 0:Y.state)==="reconnecting",il=(Y==null?void 0:Y.state)==="running"||xl||Rc,ln=Ve.pending[0]??null,zo=ln?lC(ln.toolName,ln.input):null,[pf,gf]=x.useState(()=>new Set),Dc=ln?pf.has(ln.requestId):!1,xf=ln?ln.questions&&ln.questions.length>0?"question":zo!==null?"plan":"permission":null;function Lc(h,R){gf(ee=>{if(ee.has(h)===R)return ee;const Ne=new Set(ee);return R?Ne.add(h):Ne.delete(h),Ne})}x.useEffect(()=>{!ma&&!Hs||!$||il||ne({type:"git.state",workspaceId:$})},[ma,Hs,$,il,ne]),x.useEffect(()=>{if(!(il||!$)){Hs&&ic(h=>{const R={};for(const[ee,Ne]of Object.entries(h))Jl.current.includes(ee)||(R[ee]=Ne);return R});for(const h of Jn.current)ai(h)||ne({type:"fs.read",workspaceId:$,path:h.path})}},[il,$,Hs,ne]);const ta=(Y==null?void 0:Y.cwd)??(Se==null?void 0:Se.cwd)??null,Hu=(Se==null?void 0:Se.models)??[],Mi=(Y==null?void 0:Y.model)??(Se==null?void 0:Se.model)??null,{rows:Oc,selected:_f}=Ly(Hu,Mi),Ri=Al?{model:Al.model,effort:Al.effort,ultracode:Al.ultracode,thinking:Al.thinking,switchOnFlag:Al.switchModelsOnFlag}:{model:dr.model??Mi,effort:dr.effort??(Y==null?void 0:Y.effort)??null,ultracode:dr.ultracode??(Y==null?void 0:Y.ultracode)??!1,thinking:dr.thinking??(Y==null?void 0:Y.thinking)??!0,switchOnFlag:dr.switchOnFlag??(Y==null?void 0:Y.switchModelsOnFlag)??!0},bf=Ly(Hu,Ri.model),yf=(Al==null?void 0:Al.state)==="running",zc=ir?Ia.find(h=>h.path===ir)??null:null,vf=new Set(Ia.filter(ai).map(h=>h.path)),Cr=h=>s.jsx(DA,{pane:h,width:nc.widths[h],onResize:R=>nc.setWidth(h,R),onReset:()=>nc.reset(h)}),Di=h=>mt?null:()=>wu(h),qu=(Y==null?void 0:Y.provider)==="antigravity"?c1:(Y==null?void 0:Y.provider)==="codex"?o1:Ng,Gu=Se&&s.jsx(rl,{title:"Режим прав",value:(Y==null?void 0:Y.permissionMode)??"default",options:qu.map(h=>({value:h.value,label:h.value,hint:h.hint})),onChange:h=>{ae&&ne({type:"control.set_mode",sessionId:ae,mode:h})}}),Yu=Oc.length>0?s.jsx(uv,{models:Oc,value:_f,effort:(Y==null?void 0:Y.effort)??null,ultracode:(Y==null?void 0:Y.ultracode)??!1,thinking:(Y==null?void 0:Y.thinking)??!0,switchOnFlag:(Y==null?void 0:Y.switchModelsOnFlag)??!0,showSwitchOnFlag:us(Y==null?void 0:Y.provider),onModel:h=>{!ae||!h||ne({type:"control.set_model",sessionId:ae,model:h})},onEffort:h=>{ae&&ne({type:"control.set_effort",sessionId:ae,effort:h})},onUltracode:h=>{ae&&ne({type:"control.set_ultracode",sessionId:ae,enabled:h})},onThinking:h=>{ae&&ne({type:"control.set_thinking",sessionId:ae,enabled:h})},onSwitchOnFlag:h=>{ae&&ne({type:"control.set_flag_switch",sessionId:ae,enabled:h})}}):Mi&&s.jsx("span",{className:"badge",children:Mi}),Vu=il&&s.jsx("span",{className:Rc?"badge badge--wait":"badge badge--live",children:Rc?"ждёт":xl?"переподключается":"работает"}),jf=(Y==null?void 0:Y.state)==="closed"&&s.jsx("span",{className:"badge",title:"Разговор сохранён — сессия поднимется заново, как только вы отправите сообщение",children:"остановлена"}),Xu=Vu||jf,Nf=()=>{if(!ae)return;const h=ae;vr().then(R=>{R&&ne({type:"session.reconnect",sessionId:h,...yr?{force:!0}:{}})})},Fu=xl?"Сессия уже поднимает новый процесс":il?"Недоступно, пока идёт ход":"Поднять сессии новый процесс — разговор сохранён",kf=ae&&(xl||(Y==null?void 0:Y.state)==="error")?s.jsxs("div",{className:xl?"relink":"relink relink--error",role:"status",children:[s.jsxs("span",{className:"relink__msg",children:[s.jsx("span",{className:"relink__dot","aria-hidden":"true"}),xl?"Связь оборвалась. Сессия поднимает новый процесс — разговор сохранён.":"Переподключиться не удалось. Разговор сохранён — сессия продолжит с этого места."]}),s.jsx("button",{className:"btn btn--sm",title:xl?"Не ждать паузы между попытками — попробовать сейчас":"Поднять сессии новый процесс и продолжить разговор",onClick:Nf,children:xl?"Переподключить сейчас":"Переподключить"})]}):null,na=as?kc(as.sessionId,as.workspaceId,as.limit!==null):null,Ku=as&&(na!=null&&na.canChoose)?{targets:na.targets,selectedId:na.selectedId,sourceId:na.sourceId,onSelect:h=>Kl(R=>({...R,[as.sessionId]:h}))}:null,Ll=Y&&Y.state!=="closed"&&us(Y.provider)&&gs?kc(gs,Y.workspaceId,!1):null,Ic=Ll!=null&&Ll.canChoose&&gs?h=>Kl(R=>({...R,[gs]:h})):null,xm=as?s.jsx(jA,{handoff:as,sourceAccount:(na==null?void 0:na.source)??null,accountChoice:Ku,onContinue:()=>ya(as),onShow:()=>Yn(as),onDismiss:()=>wc(as.sessionId)}):null,Qu=ba?ql.filter(h=>h.status==="needs-auth"&&!ks.includes(h.name)).map(h=>h.name):[],wf=Qu.length>0&&!mn?s.jsx(wA,{servers:Qu,onAuthorize:h=>{Sc("mcp"),Nr.mcpAuth(h)},onDismiss:()=>tf(Qu)}):null,Li=Y&&Y.totalCostUsd>0?`$${Y.totalCostUsd.toFixed(3)}`:null,Io=us(Y==null?void 0:Y.provider)&&s.jsx("button",{className:Ql?"pane-btn is-on":"pane-btn",title:"Вопрос на полях — спросить, не мешая работе","aria-label":"Вопрос на полях","aria-pressed":Ql,onClick:()=>As(h=>!h),children:s.jsx(cM,{})}),Uo=En&&s.jsx("button",{type:"button",className:"pane-btn",title:"Память и инструкции проекта","aria-label":"Память и инструкции",onClick:()=>kt(!0),children:s.jsx(oM,{})}),Sf=Y&&Y.state!=="closed"&&s.jsx("button",{type:"button",className:"pane-btn pane-btn--stop",title:"Остановить сессию — освобождает память хоста, разговор остаётся на диске","aria-label":"Остановить сессию",onClick:()=>jc(Y),children:s.jsx(lM,{})}),wa=Y?Xl[Y.id]===!0:!1,Oi=n0({onLongPress:()=>{Y&&No(Y)},onClick:()=>{Y&&ja(Y)},disabled:wa}),Ef=Y&&Y.state!=="closed"&&us(Y.provider)&&s.jsxs("button",{type:"button",className:wa?"pane-btn pane-btn--handoff is-busy":Oi.holding?"pane-btn pane-btn--handoff is-holding":"pane-btn pane-btn--handoff",style:{"--hold-ms":`${Oi.thresholdMs}ms`},title:wa?"Пишется хэндофф…":"Клик — хэндофф и новая сессия: агент запишет сводку, сессия остановится, работа продолжится в новой. Зажать (или Shift+клик) — новая пустая сессия без хэндоффа: закрепление переходит, старая сессия продолжает работать.","aria-label":"Хэндофф и новая сессия","aria-busy":wa,disabled:wa,...Oi.handlers,children:[s.jsx("span",{className:"pane-btn__hold","aria-hidden":"true"}),s.jsx(aM,{})]});return s.jsx(yg.Provider,{value:gr,children:s.jsxs("div",{className:"app",style:nc.style,children:[s.jsx(Qw,{open:jn,connected:l,status:r,workspaces:k,archivedWorkspaces:E,workspaceFolders:I,sessionFolders:G,pinnedFolders:V,projectSessions:ge,onRequestSessions:h=>ne({type:"session.list",workspaceId:h}),pinned:L,live:O,listOrder:me,liveSessionsFirst:(Wt==null?void 0:Wt.liveSessionsFirst)===!0,onReorder:yo,activeWorkspaceId:$,activeSessionId:ae,onPinSessions:Jd,onSelectPinned:vo,contentResults:hs,onSearchContent:ef,onOpenContentHit:Ti,onCloseWorkspaces:vc,onRestoreWorkspaces:mm,onUnmarkWorkspaces:Tu,onArchiveSessions:xr,onUnarchiveSessions:(h,R)=>{ne({type:"session.unarchive",workspaceId:h,sessionIds:R})},onCreateFolder:Pd,onRenameFolder:pm,onSetFolderColor:Wd,onAssignToFolder:Ci,folderNotice:cl,onDismissFolderNotice:()=>Zs(null),movingProjectId:ts,foldersReady:H,onSelectWorkspace:Ya,onRenameSession:ko,onStopSession:jc,onOpenWorkspace:()=>At(!0),onOpenUnopened:Zd,onNewSession:Au,enabledProviders:T,lastAccountId:_o(un),onSignInAccount:Ka,onOpenExtensions:ae&&us(Y==null?void 0:Y.provider)?()=>Sc("mcp"):null,account:K[Ki]??null,onOpenAccount:kr,relay:u,onOpenRelay:v?null:()=>j(!0),onOpenSettings:So,onOpenTasks:()=>Tt(!0),onOpenSite:()=>fn(!0),onOpenVideo:()=>Ot(!0),themeMode:nm,onCycleTheme:sm}),Cr("sidebar"),jn&&s.jsx("div",{className:"scrim",onClick:()=>Ze(!1)}),s.jsx(Yk,{open:Hs,tree:pl,expanded:new Set(oo),activePath:ir,dirty:vf,gitChanges:(Cs==null?void 0:Cs.changed)??[],result:Fd,searchResult:um,onSearch:wr,onReveal:Cn,onToggle:To,onOpen:Er,onCreate:zu,onRename:ka,onMove:Lo,onCopy:Iu,onDelete:fo,onRefresh:()=>{Cl(null),ic({}),ll()},onClose:()=>sr(!1),zoomed:Sn==="files",onToggleZoom:Di("files")}),Hs&&Sn!=="files"&&Cr("files"),s.jsx(ew,{open:$a,result:dm,onSearch:Ai,onOpenMatch:gm,onClose:()=>mi(!1),zoomed:Sn==="search",onToggleZoom:Di("search")}),$a&&Sn!=="search"&&Cr("search"),s.jsx(pC,{open:ma,state:Cs,result:ao,selected:lm,busy:yu,onRefresh:ll,onShow:Qa,onCheckout:Eo,onPush:Za,onPull:al,onPublish:Dn,onConnectRemote:ct,onDismissResult:()=>ml(null),onClose:()=>sc(!1),zoomed:Sn==="git",onToggleZoom:Di("git")}),ma&&Sn!=="git"&&Cr("git"),s.jsxs("main",{className:(Sn==="main"||Sn==="terminal"?"main main--zoomed":"main")+(Ys?` main--acct acct--${Ys.color}`:""),children:[p&&_&&s.jsx(kA,{state:p}),s.jsxs("header",{className:"topbar",children:[s.jsx("button",{className:"btn btn--ghost menu-btn",onClick:()=>Ze(!0),children:"☰"}),s.jsx("button",{className:Hs?"pane-btn is-on":"pane-btn",title:"Файлы проекта","aria-label":"Файлы проекта","aria-pressed":Hs,onClick:()=>{sr(h=>!h),sc(!1),mi(!1)},children:s.jsx(tM,{})}),s.jsx("button",{className:$a?"pane-btn is-on":"pane-btn",title:"Поиск по тексту в проекте","aria-label":"Поиск по тексту в проекте","aria-pressed":$a,onClick:()=>{mi(h=>!h),sr(!1),sc(!1)},children:s.jsx(nM,{})}),s.jsx("button",{className:ma?"pane-btn is-on":"pane-btn",title:"История git","aria-label":"История git","aria-pressed":ma,onClick:()=>{sc(h=>!h),sr(!1),mi(!1)},children:s.jsx(sM,{})}),qa&&s.jsx("button",{className:gl?"pane-btn is-on":"pane-btn",title:"Терминал (Ctrl+`)","aria-label":"Терминал","aria-pressed":gl,onClick:()=>Ha(h=>!h),children:s.jsx(rM,{})}),mt&&Io,mt&&s.jsx("button",{className:Me?"pane-btn is-on":"pane-btn",title:"Ещё","aria-label":"Ещё","aria-haspopup":"menu","aria-pressed":Me,onClick:()=>nt(!0),children:s.jsx(uM,{})}),s.jsxs("div",{className:"topbar__id",children:[js&&Y?s.jsx(oi,{className:"rename--title",value:Y.title??"",onCommit:h=>{ko(Y,h),lt(!1)},onCancel:()=>lt(!1)}):s.jsxs("div",{className:"topbar__head",children:[mt&&Ys&&s.jsx(Da,{account:Ys}),s.jsx("button",{className:"topbar__title",disabled:!Y||mt,title:Y&&!mt?"Переименовать сессию":void 0,onClick:()=>lt(!0),children:(Y==null?void 0:Y.title)??"Claude Code Visual"}),En&&s.jsx("span",{className:"topbar__project",title:En.path,children:En.name})]}),mt?Xu:ta&&s.jsx(ov,{path:ta})]}),!mt&&s.jsxs("div",{className:"topbar__tools",children:[s.jsx(vS,{disabled:!Y,saveDisabled:!$,onDownload:Mu,onSave:Ru}),s.jsx("button",{type:"button",className:nr?"meters-refresh is-busy":"meters-refresh",title:bo,"aria-label":is,"aria-busy":nr,disabled:!ae||nr,onClick:sl,children:s.jsx(dM,{})}),Ys&&s.jsx(G_,{account:Ys,onClick:kr}),s.jsx(Xg,{usage:ea}),s.jsx(mv,{}),Gu,Yu,Xu,Li&&s.jsx("span",{className:"badge badge--cost",children:Li}),Ef,Ll&&Ic&&!wa&&s.jsx(vv,{variant:"mark",targets:Ll.targets,selectedId:Ll.selectedId,sourceId:Ll.sourceId,onSelect:Ic}),Sf,Uo,Io]})]}),s.jsx(VA,{tokens:(sn==null?void 0:sn.tokens)??Ve.contextTokens,maxTokens:(sn==null?void 0:sn.maxTokens)??null,fetchedAt:(sn==null?void 0:sn.fetchedAt)??null}),mt&&Me&&s.jsx(KC,{onClose:()=>nt(!1),permission:Gu,model:Yu,account:Ys&&s.jsx(G_,{account:Ys}),usage:ea,cwd:ta,costLabel:Li,onRefresh:sl,refreshing:nr,metersFetchedAt:xo,onRename:Y?()=>{lt(!0),nt(!1)}:null,onHandoff:Y&&Y.state!=="closed"&&us(Y.provider)?()=>{ja(Y),nt(!1)}:null,onFreshSession:Y&&Y.state!=="closed"&&us(Y.provider)?()=>{No(Y),nt(!1)}:null,handoffWriting:wa,handoffAccount:Ll&&Ic&&!wa?s.jsx(yA,{targets:Ll.targets,selectedId:Ll.selectedId,onSelect:Ic}):null,onMemory:En?()=>{kt(!0),nt(!1)}:null,onExportDownload:Y?Mu:null,onExportSave:Y&&$?Ru:null,onStop:Y&&Y.state!=="closed"?()=>{jc(Y),nt(!1)}:null}),Ia.length>0&&s.jsx(Mw,{files:Ia,activePath:ir,busy:il,onSelect:ga,onClose:h=>Tc(h),zoomed:Sn==="main",onToggleZoom:Di("main")}),zc?s.jsx(Tw,{file:zc,goto:(rr==null?void 0:rr.path)===zc.path?rr:null,onChange:(h,R)=>{qs(ee=>ee.map(Ne=>Ne.path===h?{...Ne,text:R}:Ne)),Do(h)},onSave:h=>Ac(h),onReload:Mo,onOverwrite:h=>Ac(h,!0),onRequestMedia:_s,images:Xd,onRequestImage:Ln,onPasteImage:Ro,preview:lr[zc.path],onRequestPreview:af,onTogglePreview:h=>qs(R=>R.map(ee=>ee.path===h?{...ee,previewMode:!ee.previewMode}:ee)),onSetMarkdownMode:(h,R)=>{jk(R),qs(ee=>ee.map(Ne=>Ne.path===h?{...Ne,previewMode:R==="preview",textMode:R==="text"}:Ne))}}):s.jsxs(s.Fragment,{children:[s.jsx(Gg,{items:Ve.items,busy:il&&!xl,waiting:Rc,empty:us(Y==null?void 0:Y.provider)?void 0:`Сессия пуста. Опишите задачу — ${X_(Y==null?void 0:Y.provider)} работает в каталоге проекта.`,onOpenPreview:Ou,history:_a,historyHasMore:kp(Ft),historyLoading:Ft.loading,onLoadHistory:Qd,sessionId:ae??void 0,onEditMessage:us(Y==null?void 0:Y.provider)?(h,R,ee,Ne)=>{if(!ae||_)return!1;const Le=ae,pt=yr;return vr().then(an=>an?Fa(()=>ne({type:"prompt.edit",sessionId:Le,userIndex:h,text:R,images:ee,...Ne!=null&&Ne.rewindFiles?{rewindFiles:!0}:{},...pt?{force:!0}:{}})):!1)}:void 0,onRewindFiles:!us(Y==null?void 0:Y.provider)||!ae?void 0:(h,R)=>Su(ae,h,R)}),kf,xm,wf,ae&&((Zu=Y==null?void 0:Y.tasks)!=null&&Zu.length)?s.jsx(zw,{tasks:Y.tasks,onStop:h=>ne({type:"task.stop",sessionId:ae,taskId:h})}):null,ln&&xf&&Dc&&s.jsx(JE,{kind:xf,toolName:ln.toolName,queued:Ve.pending.length-1,onExpand:()=>Lc(ln.requestId,!1)}),s.jsx(iv,{disabled:!ae,busy:il&&!xl,sendBlocked:_,placeholder:xl?"Промпт уйдёт, как только связь вернётся":(Y==null?void 0:Y.state)==="closed"?"Остановлена — отправьте сообщение, чтобы продолжить":void 0,commands:mf,sessionTitle:(Y==null?void 0:Y.title)??null,contextResult:Cc,draftKey:ae,insertRequest:Ae,onInsertConsumed:h=>Pe(R=>(R==null?void 0:R.token)===h?null:R),onContextSearch:h=>Ec("mention",h),onCommand:Bu,onSend:Nc,onInterrupt:()=>{ae&&ne({type:"control.interrupt",sessionId:ae})}})]}),gl&&qa&&s.jsxs(s.Fragment,{children:[!mt&&Sn!=="terminal"&&s.jsx(OA,{height:po.height,onResize:po.setHeight,onReset:po.reset}),s.jsx($A,{mobile:mt,zoomed:Sn==="terminal",onToggleZoom:Di("terminal"),terminals:cr,activeId:gi,blocked:gc,error:Kd,onDismissError:()=>mc(null),height:mt?ku.height:po.height,offset:mt?{top:ku.offsetTop,left:ku.offsetLeft}:void 0,onSelect:hc,onOpen:cf,onClose:of,onInput:(h,R)=>ne({type:"term.input",id:h,data:R}),onResize:(h,R,ee)=>ne({type:"term.resize",id:h,cols:R,rows:ee}),onAttach:h=>ne({type:"term.attach",id:h}),onHide:()=>Ha(!1),registerSink:Tl})]})]}),s.jsx(UC,{open:Ql,items:_c.items,busy:yf,ready:ae!==null,sendBlocked:_,commands:mf,contextResult:Sr,draftKey:ae,models:bf.rows,model:bf.selected,effort:Ri.effort,ultracode:Ri.ultracode,thinking:Ri.thinking,switchOnFlag:Ri.switchOnFlag,onContextSearch:h=>Ec("side",h),onCommand:Bu,onModel:h=>{h&&(Pl(R=>({...R,model:h})),xs(R=>ne({type:"control.set_model",sessionId:R,model:h})))},onEffort:h=>{Pl(R=>({...R,effort:h,ultracode:!1})),xs(R=>ne({type:"control.set_effort",sessionId:R,effort:h}))},onUltracode:h=>{Pl(R=>({...R,ultracode:h,...h?{effort:"xhigh"}:{}})),xs(R=>ne({type:"control.set_ultracode",sessionId:R,enabled:h}))},onThinking:h=>{Pl(R=>({...R,thinking:h})),xs(R=>ne({type:"control.set_thinking",sessionId:R,enabled:h}))},onSwitchOnFlag:h=>{Pl(R=>({...R,switchOnFlag:h})),xs(R=>ne({type:"control.set_flag_switch",sessionId:R,enabled:h}))},onAsk:Du,onInterrupt:()=>{xi&&ne({type:"control.interrupt",sessionId:xi})},onReset:Lu,onClose:()=>As(!1),zoomed:Sn==="ask",onToggleZoom:Di("ask")}),Ql&&Sn!=="ask"&&Cr("ask"),(ma||Ql||Hs||$a)&&s.jsx("div",{className:"scrim scrim--pane",onClick:()=>{sc(!1),As(!1),sr(!1),mi(!1)}}),lc&&s.jsx(bC,{detail:lc,local:((Cs==null?void 0:Cs.hasRemote)??!1)&&(Cs==null?void 0:Cs.commits.some(h=>h.hash===lc.hash&&!h.pushed))===!0,onCheckout:Eo,onClose:()=>{so(null),lo(null)}}),A&&s.jsxs(zn,{title:"Лимит плана почти исчерпан",onClose:()=>jo(!1),actions:s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn",autoFocus:!0,onClick:()=>jo(!1),children:"Отмена"}),s.jsx("button",{className:"btn btn--primary",onClick:()=>jo(!0),children:"Отправить всё равно"})]}),children:[s.jsxs("p",{className:"modal__text",children:[Fh[A.warning.limit][0].toUpperCase(),Fh[A.warning.limit].slice(1)," использован на"," ",Math.round(A.warning.utilization)," %, сброс в"," ",MA(A.warning.resetsAt),". Сообщение может оборваться на полуслове, когда лимит дойдёт до 100 %."]}),s.jsx("p",{className:"modal__text modal__text--dim",children:"До сброса сессию повторно останавливать не будем."})]}),Yt&&s.jsx(zn,{title:"Прервать вход в MCP-сервер?",onClose:()=>jr(!1),actions:s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn",onClick:()=>jr(!1),children:"Отмена"}),s.jsx("button",{className:"btn btn--warn",onClick:()=>jr(!0),children:"Продолжить"})]}),children:s.jsxs("p",{className:"modal__text",children:["Идёт вход в MCP-сервер «",Yt.name,"» — перезапуск процесса его прервёт. Продолжить?"]})}),le&&s.jsx(zn,{title:"Остановить сессию?",onClose:()=>ce(null),actions:s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn",onClick:()=>ce(null),children:"Отмена"}),s.jsx("button",{className:"btn btn--warn",onClick:()=>{ne({type:"session.close",sessionId:le.id}),ce(null)},children:"Остановить"})]}),children:s.jsx("p",{className:"modal__text",children:"Сессия сейчас работает — остановка прервёт текущий ход. Разговор останется на диске: открыть сессию заново или просто написать в неё снова можно в любой момент."})}),io&&s.jsxs(zn,{title:"Переключить рабочее дерево?",onClose:()=>ro(null),actions:s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn",onClick:()=>ro(null),children:"Отмена"}),s.jsx("button",{className:"btn btn--warn",onClick:lf,children:"Переключиться"})]}),children:[s.jsxs("p",{className:"modal__text",children:["git переключится на ",io.label,". Файлы в каталоге проекта изменятся — это тот же каталог, в котором работает агент."]}),il&&s.jsx("p",{className:"modal__text",children:"Сейчас идёт ход агента: он читает и правит файлы прямо сейчас."}),Cs&&Cs.changed.length>0&&s.jsxs("p",{className:"modal__text",children:["Незакоммиченных изменений: ",Cs.changed.length,". Git откажется переключаться, если они будут затёрты."]})]}),vu&&s.jsx(RC,{status:am,owners:rm,files:om,defaultName:(En==null?void 0:En.name)??"",hasCommits:Cs===null||Cs.head!=="",busy:yu,result:ao,onRefreshStatus:Xn,onSaveToken:Ht,onPublish:Co,onDismissResult:()=>ml(null),onClose:()=>za(!1)}),Vd&&s.jsx(IC,{busy:yu,result:ao,onSubmit:Na,onDismissResult:()=>ml(null),onClose:()=>ac(!1)}),oc&&s.jsx(zn,{title:oc.kind==="dir"?"Удалить каталог?":"Удалить файл?",onClose:()=>fo(null),actions:s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn",onClick:()=>fo(null),children:"Отмена"}),s.jsx("button",{className:"btn btn--warn",onClick:()=>Uu(oc),children:"Удалить"})]}),children:s.jsxs("p",{className:"modal__text",children:[oc.path," будет удалён с диска",oc.kind==="dir"?" вместе со всем содержимым":"",". Корзины здесь нет: это тот же каталог, в котором работает агент."]})}),uc&&s.jsx(zn,{title:"Закрыть без сохранения?",onClose:()=>ho(null),actions:s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn",onClick:()=>ho(null),children:"Отмена"}),s.jsx("button",{className:"btn btn--warn",onClick:()=>Tc(uc,!0),children:"Закрыть"}),s.jsx("button",{className:"btn btn--primary",onClick:()=>{Ac(uc),Tc(uc,!0)},children:"Сохранить и закрыть"})]}),children:s.jsxs("p",{className:"modal__text",children:["В ",uc," есть несохранённые правки."]})}),In&&En&&s.jsx(JC,{workspaceId:En.id,workspaceName:En.name,accountId:Y==null?void 0:Y.accountId,stateAccountId:$n,files:ut,file:it,result:Kt,send:ne,onClose:()=>{kt(!1),Un(null),Gt(null),vt(null),es(null)}}),fs&&s.jsx(oT,{tasks:Et,workspaces:k,activeWorkspaceId:$,send:ne,onOpenSession:br,error:Is,onClearError:()=>Qn(null),onClose:()=>{Tt(!1),Qn(null)}}),Lt&&En&&s.jsx(pT,{workspaceId:En.id,workspaceName:En.name,remote:v,reply:Qt,send:ne,hasSession:!!ae,onInsertPrompt:yc,onClose:()=>fn(!1)},En.id),Qe&&En&&s.jsx(wT,{workspaceId:En.id,remote:v,catalog:Zt,studios:Eu,links:wi,previews:lr,mediaCache:Xd,send:ne,onRequestMedia:_s,onClose:()=>Ot(!1)},En.id),mn&&s.jsx(ET,{tab:mn,servers:ql,plugins:ul,marketplaces:Gl,catalog:Pn,result:Yl,auth:qn,duplicates:ha,accounts:be,remote:v,actions:Nr,onTab:pn,onClose:()=>pn(null)}),Wn&&s.jsx(IT,{accounts:be,auth:K,logins:Ie,candidates:Ye,usage:Ps,actions:nf,onOpenLogin:Ka,activeAccountId:(Ys==null?void 0:Ys.id)??null,error:ve,onReconnect:ae?()=>{Nf(),Js(!1)}:null,reconnectBlocked:il,reconnectHint:Fu,onClose:()=>Js(!1)}),b&&s.jsx(PT,{state:u,onPair:(h,R)=>ne({type:"relay.pair",code:h,...R?{name:R}:{}}),onUnpair:()=>ne({type:"relay.unpair"}),onClose:()=>j(!1)}),oe&&s.jsx(bA,{settings:Wt,projectsRootHint:on,models:(Se==null?void 0:Se.models)??[],relayState:u,networkState:p,local:Ch()==="local",onChange:sf,onEnableShell:()=>ne({type:"relay.shell.enable"}),onDisableShell:()=>ne({type:"relay.shell.disable"}),onOpenRelay:()=>{Te(!1),j(!0)},claudeLogin:{accounts:be,auth:K,logins:Ie,actions:wo,remote:v,runningByAccount:Si,focusAccountId:gt},onClose:()=>{Te(!1),gn(null)}}),wt&&s.jsx(cC,{candidates:cn,searching:Rn,agentItems:Us.items,agentBusy:(xe==null?void 0:xe.state)==="running",error:Ke,roots:da,folders:I,projectsRoot:on,created:fa,onSearch:hm,onAskAgent:Vn,onInterrupt:()=>{const h=Rs.current;h&&ne({type:"control.interrupt",sessionId:h})},onSubmit:Zd,onCreate:fm,onClose:Cu}),ln!=null&&ln.questions&&ln.questions.length>0?s.jsx(tC,{request:{...ln,questions:ln.questions},queued:Ve.pending.length-1,collapsed:Dc,onCollapse:()=>Lc(ln.requestId,!0),onAnswer:df,onDecline:ff}):ln&&zo!==null?s.jsx(PE,{request:ln,plan:zo,queued:Ve.pending.length-1,collapsed:Dc,onCollapse:()=>Lc(ln.requestId,!0),onAccept:$u,onDecline:hf}):ln&&s.jsx(eC,{request:ln,queued:Ve.pending.length-1,collapsed:Dc,onCollapse:()=>Lc(ln.requestId,!0),onDecide:uf}),Ws&&s.jsx(NA,{handoff:Ws,onClose:()=>Yn(null)}),s.jsx(CA,{notices:fi,onDismiss:h=>hl(R=>R.filter(ee=>ee.id!==h))})]})})}function tM(){return s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("path",{d:"M2 4.1V3a.6.6 0 0 1 .6-.6h2.6l1.2 1.4h5a.6.6 0 0 1 .6.6v1.1"}),s.jsx("path",{d:"M2 12.6V5.7h11.4a.6.6 0 0 1 .58.75l-1.5 6.2a.6.6 0 0 1-.58.45H2.6a.6.6 0 0 1-.6-.5Z"})]})}function nM(){return s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[s.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),s.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}function sM(){return s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[s.jsx("circle",{cx:"4.5",cy:"3.5",r:"1.9"}),s.jsx("circle",{cx:"4.5",cy:"12.5",r:"1.9"}),s.jsx("circle",{cx:"11.5",cy:"8",r:"1.9"}),s.jsx("path",{d:"M4.5 5.4v5.2M6.4 3.9h2.2a1.6 1.6 0 0 1 1.6 1.6v.8"})]})}function lM(){return s.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:s.jsx("rect",{x:"3.6",y:"3.6",width:"8.8",height:"8.8",rx:"1.8"})})}function aM(){return s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("rect",{x:"1.8",y:"2.4",width:"7",height:"11.2",rx:"1.5"}),s.jsx("path",{d:"M4.1 5.7h2.4M4.1 10.3h2.4"}),s.jsx("path",{d:"M8.8 8h5.4M11.9 5.6 14.2 8l-2.3 2.4"})]})}function iM(n,l){return Oy(n)===Oy(l)}function Oy(n){return n.replace(/[\\/]+/g,"/").replace(/\/+$/,"").toLowerCase()}function rM(){return s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("rect",{x:"1.6",y:"2.6",width:"12.8",height:"10.8",rx:"1.7"}),s.jsx("path",{d:"M4.3 6 6.6 8l-2.3 2"}),s.jsx("path",{d:"M8.2 10h3.1"})]})}function cM(){return s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("path",{d:"M13.6 9.4a1.6 1.6 0 0 1-1.6 1.6H6.2L3.2 13.4V4.2a1.6 1.6 0 0 1 1.6-1.6h7.2a1.6 1.6 0 0 1 1.6 1.6Z"}),s.jsx("path",{d:"M8.4 8.5v-.3c0-.7.9-.9.9-1.7a1 1 0 0 0-1.9-.4"})]})}function oM(){return s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("path",{d:"M3.5 2.5h7a2 2 0 0 1 2 2v9h-7a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2Z"}),s.jsx("path",{d:"M5.5 5.5h4M5.5 8h4"})]})}function uM(){return s.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:[s.jsx("circle",{cx:"3.2",cy:"8",r:"1.5"}),s.jsx("circle",{cx:"8",cy:"8",r:"1.5"}),s.jsx("circle",{cx:"12.8",cy:"8",r:"1.5"})]})}function dM(){return s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("path",{d:"M14 8a6 6 0 1 1-6-6c1.68 0 3.29.67 4.49 1.83L14 5.33"}),s.jsx("path",{d:"M14 2v3.33h-3.33"})]})}const kv=document.getElementById("root");if(!kv)throw new Error("#root not found");Ij.createRoot(kv).render(s.jsx(x.StrictMode,{children:s.jsx(eM,{})}));export{HN as D,bn as I,b0 as N,mM as P,wl as T,st as _,La as a,vn as b,k0 as c,Od as d,Ew as e,Mk as f,BN as g,ik as h,kk as i,ca as j,pM as k,hM as l,x as m,A0 as n,s as o,Ak as p,rg as q,Rk as r,gM as s,Oe as t,C0 as u,$k as v};