@i14ks/ccv 0.48.0 → 0.49.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 (82) hide show
  1. package/bundle/ccv.mjs +350 -560
  2. package/package.json +1 -1
  3. package/web/assets/{MarkdownTextEditor-B3B8_rFw.js → MarkdownTextEditor-Dt2Iu87I.js} +1 -1
  4. package/web/assets/{abnfDiagram-S7VZAUFO-DJLBYC4E.js → abnfDiagram-S7VZAUFO-C6rudl3G.js} +1 -1
  5. package/web/assets/{architectureDiagram-YGSQEFNW-CjOULv4y.js → architectureDiagram-YGSQEFNW-Chxd_j3W.js} +1 -1
  6. package/web/assets/{blockDiagram-APKKGZFW-BxtAGaqL.js → blockDiagram-APKKGZFW-CX9y-KCE.js} +1 -1
  7. package/web/assets/{c4Diagram-KJ2TOQU5-DixwjD35.js → c4Diagram-KJ2TOQU5-SjVMVZLW.js} +1 -1
  8. package/web/assets/{chunk-2Q5K7J3B-D5RSYb7c.js → chunk-2Q5K7J3B-D4joGaMo.js} +1 -1
  9. package/web/assets/{chunk-5VM5RSS4-Zw9KRmHP.js → chunk-5VM5RSS4-Bx6fCaId.js} +1 -1
  10. package/web/assets/{chunk-HFQBQIA3-Dz3Jqjvc.js → chunk-HFQBQIA3-GmYpzkM2.js} +1 -1
  11. package/web/assets/{chunk-JWPE2WC7-CYC8lXvq.js → chunk-JWPE2WC7-YRiv3Zg6.js} +1 -1
  12. package/web/assets/{chunk-KQLB2F66-BpsntY2B.js → chunk-KQLB2F66-DTEa-Nv0.js} +2 -2
  13. package/web/assets/{chunk-KS47KZWR-CIw-CgK1.js → chunk-KS47KZWR-DLIoy_uq.js} +1 -1
  14. package/web/assets/{chunk-OY52VR5R-DyNxKUIK.js → chunk-OY52VR5R-d0ASvNW1.js} +1 -1
  15. package/web/assets/{chunk-TU62E6Q5-CHgxHE0R.js → chunk-TU62E6Q5-Di5_cwgX.js} +1 -1
  16. package/web/assets/{chunk-XXDRQBXY-CQ0zLLMg.js → chunk-XXDRQBXY-B_JAqY4C.js} +1 -1
  17. package/web/assets/{classDiagram-v2-L25IHNXF-DyN77x6F.js → classDiagram-v2-L25IHNXF-DB3TN6Gr.js} +1 -1
  18. package/web/assets/{codemirror-Dh-4cMdO.js → codemirror-C1bYpAmx.js} +1 -1
  19. package/web/assets/{codemirrorImages-BHHbVBQN.js → codemirrorImages-MC8VsJDU.js} +1 -1
  20. package/web/assets/{cose-bilkent-JH36ORCC-D1H3X9ot.js → cose-bilkent-JH36ORCC-CSfL8Y8l.js} +1 -1
  21. package/web/assets/{cynefin-EF2NZ3EQ-B4SsJI8I.js → cynefin-EF2NZ3EQ-Dav5gSV6.js} +1 -1
  22. package/web/assets/{cynefinDiagram-L36ESFBY-D543PDJ4.js → cynefinDiagram-L36ESFBY-D7UuGAHO.js} +1 -1
  23. package/web/assets/{dagre-SPEB5RXH-CksMpjx8.js → dagre-SPEB5RXH-C45VrWYv.js} +1 -1
  24. package/web/assets/{diagram-3B7GL73J-DywKf_aW.js → diagram-3B7GL73J-DCOSOr3V.js} +1 -1
  25. package/web/assets/{diagram-DNEMPZML-QaEKUl5W.js → diagram-DNEMPZML-DYbsw7Q0.js} +1 -1
  26. package/web/assets/{diagram-L3MUGCDN-51y_ny8R.js → diagram-L3MUGCDN-Cf1adeNh.js} +1 -1
  27. package/web/assets/{diagram-LA4NIPWU-Cg_nbBL_.js → diagram-LA4NIPWU-dsheOSjV.js} +1 -1
  28. package/web/assets/{diagram-MHCOC4E2-DFHCPZYb.js → diagram-MHCOC4E2-D8QLy-br.js} +1 -1
  29. package/web/assets/{diagram-XPFHEONP-dBKRRNZa.js → diagram-XPFHEONP-BIwbvAS3.js} +1 -1
  30. package/web/assets/{ebnfDiagram-UZSYDL2S-BwTgNIAm.js → ebnfDiagram-UZSYDL2S-Dfno1buw.js} +1 -1
  31. package/web/assets/{elk-XV6XMXQE-BR-xb3ob.js → elk-XV6XMXQE-CPTpYM05.js} +1 -1
  32. package/web/assets/{erDiagram-EYBAPDEH-BB1wg_fV.js → erDiagram-EYBAPDEH-DIIeNZoS.js} +1 -1
  33. package/web/assets/{flowDiagram-MALGAFMO-CRDw4nX3.js → flowDiagram-MALGAFMO-Dv_SGxd_.js} +1 -1
  34. package/web/assets/{ganttDiagram-23REXITY-MYQEYJ-I.js → ganttDiagram-23REXITY-BVj7_X-p.js} +1 -1
  35. package/web/assets/{gitGraphDiagram-STJD7YCW-Dhn0_pRI.js → gitGraphDiagram-STJD7YCW-Dida84g9.js} +1 -1
  36. package/web/assets/{index-7ivf0ID5.js → index-3swuCbjs.js} +1 -1
  37. package/web/assets/{index-Bod45-bM.js → index-6VtLhZfr.js} +1 -1
  38. package/web/assets/{index-DlMbLAnE.js → index-6ji44meo.js} +1 -1
  39. package/web/assets/{index-CE1Pd4z7.js → index-BBJdr5JT.js} +1 -1
  40. package/web/assets/{index-CaL1Ugw4.js → index-BXS87hWE.js} +1 -1
  41. package/web/assets/index-BlgH7sOz.css +1 -0
  42. package/web/assets/{index-DIouQVG8.js → index-BrzBT7tX.js} +1 -1
  43. package/web/assets/{index-DRJgyVu5.js → index-CCcMvPPM.js} +1 -1
  44. package/web/assets/{index-C13EW7hw.js → index-CSlP1EYA.js} +1 -1
  45. package/web/assets/{index-BK9FAkRg.js → index-Cec-XFvp.js} +1 -1
  46. package/web/assets/{index-DqLAItfN.js → index-CrIvEt3W.js} +1 -1
  47. package/web/assets/{index-BJdwUs7I.js → index-D19W3mPS.js} +1 -1
  48. package/web/assets/{index-v-BrSiuM.js → index-D2m7bnfK.js} +1 -1
  49. package/web/assets/{index-BLLxsupM.js → index-D3KJ44QL.js} +1 -1
  50. package/web/assets/{index-DtR2v4RD.js → index-DEQgVEIp.js} +1 -1
  51. package/web/assets/{index-DaBTH0ea.js → index-DObAlG3d.js} +1 -1
  52. package/web/assets/index-DPTOk3jB.js +166 -0
  53. package/web/assets/{index-Cbs1XkJa.js → index-DPlaluO4.js} +1 -1
  54. package/web/assets/{index-BJHr8-zK.js → index-DqN3Yjn2.js} +1 -1
  55. package/web/assets/{index-DtwnaAnT.js → index-QlFQPxZP.js} +1 -1
  56. package/web/assets/{index-DqxhStF7.js → index-rnuYD-5b.js} +1 -1
  57. package/web/assets/{infoDiagram-KBXO4MBG-By-j1Q2z.js → infoDiagram-KBXO4MBG-TDow-d_4.js} +1 -1
  58. package/web/assets/{ishikawaDiagram-M35NCXHK-Cj7pfKCW.js → ishikawaDiagram-M35NCXHK-CLbrSa1y.js} +1 -1
  59. package/web/assets/{journeyDiagram-OPLOXDXO-B7acuJLi.js → journeyDiagram-OPLOXDXO-p3kvT_Eo.js} +1 -1
  60. package/web/assets/{kanban-definition-BZKZHSQY-B0N1FM8N.js → kanban-definition-BZKZHSQY-pNNn3NfD.js} +1 -1
  61. package/web/assets/{mermaid.core-Rt-JZroF.js → mermaid.core-DjpUkD1z.js} +4 -4
  62. package/web/assets/{mindmap-definition-I2QAS2VK-Du6Bq1D4.js → mindmap-definition-I2QAS2VK-BqPuqnfQ.js} +1 -1
  63. package/web/assets/{pegDiagram-FD4XPPHP-Cx3y_VAW.js → pegDiagram-FD4XPPHP-BeVWcZMC.js} +1 -1
  64. package/web/assets/{pieDiagram-J4AKIIQI-DrpfcCiI.js → pieDiagram-J4AKIIQI-DqXZUVHj.js} +1 -1
  65. package/web/assets/{quadrantDiagram-XTYBLID2-BbJ2d8x8.js → quadrantDiagram-XTYBLID2-CUwRsDjZ.js} +1 -1
  66. package/web/assets/{railroadDiagram-MRQ6NCDL-C8B9eHMq.js → railroadDiagram-MRQ6NCDL-BzrKPnp_.js} +1 -1
  67. package/web/assets/{requirementDiagram-Y7LWUY3S--8FcyGsP.js → requirementDiagram-Y7LWUY3S-DxRAPAAb.js} +1 -1
  68. package/web/assets/{sankeyDiagram-WGJFYUXA-CYq-mQmD.js → sankeyDiagram-WGJFYUXA-Bf96cqWy.js} +1 -1
  69. package/web/assets/{sequenceDiagram-5NDRBG5M-C-Llg4wI.js → sequenceDiagram-5NDRBG5M-COUQWvkl.js} +1 -1
  70. package/web/assets/{sizeCapture-INFHLROL-80lnJyWe.js → sizeCapture-INFHLROL-CnDTd2qA.js} +1 -1
  71. package/web/assets/{stateDiagram-v2-FJ4FJNEA-QZyfUycB.js → stateDiagram-v2-FJ4FJNEA-Be14yvtF.js} +1 -1
  72. package/web/assets/{swimlanes-UMQ2AFYF-BxT8Ql8H.js → swimlanes-UMQ2AFYF-BgwhOIJf.js} +1 -1
  73. package/web/assets/swimlanesDiagram-OMPLPG4O-BvICHG_z.js +8 -0
  74. package/web/assets/{timeline-definition-SEUHKTQE-DWywP4r0.js → timeline-definition-SEUHKTQE-DrzXj456.js} +1 -1
  75. package/web/assets/{usecaseDiagram-AFA6YXN4-BgmSQD90.js → usecaseDiagram-AFA6YXN4-Ptp1a8ek.js} +1 -1
  76. package/web/assets/{vennDiagram-NNMJR3RB-B9ikZp8F.js → vennDiagram-NNMJR3RB-84pzw-p8.js} +1 -1
  77. package/web/assets/{wardleyDiagram-S7YFUSEH-CptNVfVi.js → wardleyDiagram-S7YFUSEH-GlcuH79W.js} +1 -1
  78. package/web/assets/{xychartDiagram-GGNKY7IX-DV4TDhUT.js → xychartDiagram-GGNKY7IX-CyOLgTKD.js} +1 -1
  79. package/web/index.html +2 -2
  80. package/web/assets/index-eIS20v-m.css +0 -1
  81. package/web/assets/index-gy3hTMSD.js +0 -167
  82. package/web/assets/swimlanesDiagram-OMPLPG4O-BZDLC88s.js +0 -8
@@ -0,0 +1,166 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-D3KJ44QL.js","./index-D19W3mPS.js","./index-3swuCbjs.js","./index-BHot-lnj.js","./index-PAORgBv5.js","./index-Vcq4gwWv.js","./index-BXS87hWE.js","./index-BrzBT7tX.js","./index-rnuYD-5b.js","./index-CrIvEt3W.js","./index-6ji44meo.js","./index-CSlP1EYA.js","./index-Cec-XFvp.js","./index-DPlaluO4.js","./index-DObAlG3d.js","./index-D2m7bnfK.js","./index-BBJdr5JT.js","./index-CCcMvPPM.js","./index-6VtLhZfr.js","./index-DEQgVEIp.js","./index-QlFQPxZP.js","./index-DqN3Yjn2.js","./codemirror-C1bYpAmx.js","./codemirrorImages-MC8VsJDU.js","./katex-DxB02YXk.css","./mermaid.core-DjpUkD1z.js","./_commonjsHelpers-CqkleIqs.js","./MarkdownTextEditor-Dt2Iu87I.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 R_=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 Qt=(n,l,i)=>Cj(n,typeof l!="symbol"?l+"":l,i),up=(n,l,i)=>l.has(n)||R_("Cannot "+i);var Ke=(n,l,i)=>(up(n,l,"read from private field"),i?i.call(n):l.get(n)),An=(n,l,i)=>l.has(n)?R_("Cannot add the same private member more than once"):l instanceof WeakSet?l.add(n):l.set(n,i),Ot=(n,l,i,r)=>(up(n,l,"write to private field"),r?r.call(n,i):l.set(n,i),i),Wn=(n,l,i)=>(up(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 dp={exports:{}},gd={};/**
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 D_;function Tj(){if(D_)return gd;D_=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 gd.Fragment=l,gd.jsx=i,gd.jsxs=i,gd}var L_;function Aj(){return L_||(L_=1,dp.exports=Tj()),dp.exports}var s=Aj(),fp={exports:{}},tt={};/**
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 O_;function Mj(){if(O_)return tt;O_=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"),N=Symbol.iterator;function w(A){return A===null||typeof A!="object"?null:(A=N&&A[N]||A["@@iterator"],typeof A=="function"?A:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,E={};function O(A,F,U){this.props=A,this.context=F,this.refs=E,this.updater=U||k}O.prototype.isReactComponent={},O.prototype.setState=function(A,F){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,F,"setState")},O.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function R(){}R.prototype=O.prototype;function H(A,F,U){this.props=A,this.context=F,this.refs=E,this.updater=U||k}var te=H.prototype=new R;te.constructor=H,C(te,O.prototype),te.isPureReactComponent=!0;var Q=Array.isArray;function D(){}var $={H:null,A:null,T:null,S:null},ne=Object.prototype.hasOwnProperty;function Y(A,F,U){var ye=U.ref;return{$$typeof:n,type:A,key:F,ref:ye!==void 0?ye:null,props:U}}function q(A,F){return Y(A.type,F,A.props)}function I(A){return typeof A=="object"&&A!==null&&A.$$typeof===n}function V(A){var F={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(U){return F[U]})}var pe=/\/+/g;function J(A,F){return typeof A=="object"&&A!==null&&A.key!=null?V(""+A.key):F.toString(36)}function le(A){switch(A.status){case"fulfilled":return A.value;case"rejected":throw A.reason;default:switch(typeof A.status=="string"?A.then(D,D):(A.status="pending",A.then(function(F){A.status==="pending"&&(A.status="fulfilled",A.value=F)},function(F){A.status==="pending"&&(A.status="rejected",A.reason=F)})),A.status){case"fulfilled":return A.value;case"rejected":throw A.reason}}throw A}function L(A,F,U,ye,W){var fe=typeof A;(fe==="undefined"||fe==="boolean")&&(A=null);var Le=!1;if(A===null)Le=!0;else switch(fe){case"bigint":case"string":case"number":Le=!0;break;case"object":switch(A.$$typeof){case n:case l:Le=!0;break;case b:return Le=A._init,L(Le(A._payload),F,U,ye,W)}}if(Le)return W=W(A),Le=ye===""?"."+J(A,0):ye,Q(W)?(U="",Le!=null&&(U=Le.replace(pe,"$&/")+"/"),L(W,F,U,"",function(Be){return Be})):W!=null&&(I(W)&&(W=q(W,U+(W.key==null||A&&A.key===W.key?"":(""+W.key).replace(pe,"$&/")+"/")+Le)),F.push(W)),1;Le=0;var lt=ye===""?".":ye+":";if(Q(A))for(var ke=0;ke<A.length;ke++)ye=A[ke],fe=lt+J(ye,ke),Le+=L(ye,F,U,fe,W);else if(ke=w(A),typeof ke=="function")for(A=ke.call(A),ke=0;!(ye=A.next()).done;)ye=ye.value,fe=lt+J(ye,ke++),Le+=L(ye,F,U,fe,W);else if(fe==="object"){if(typeof A.then=="function")return L(le(A),F,U,ye,W);throw F=String(A),Error("Objects are not valid as a React child (found: "+(F==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":F)+"). If you meant to render a collection of children, use an array instead.")}return Le}function z(A,F,U){if(A==null)return A;var ye=[],W=0;return L(A,ye,"","",function(fe){return F.call(U,fe,W++)}),ye}function G(A){if(A._status===-1){var F=A._result;F=F(),F.then(function(U){(A._status===0||A._status===-1)&&(A._status=1,A._result=U)},function(U){(A._status===0||A._status===-1)&&(A._status=2,A._result=U)}),A._status===-1&&(A._status=0,A._result=F)}if(A._status===1)return A._result.default;throw A._result}var ie=typeof reportError=="function"?reportError:function(A){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var F=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(F))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",A);return}console.error(A)},de={map:z,forEach:function(A,F,U){z(A,function(){F.apply(this,arguments)},U)},count:function(A){var F=0;return z(A,function(){F++}),F},toArray:function(A){return z(A,function(F){return F})||[]},only:function(A){if(!I(A))throw Error("React.Children.only expected to receive a single React element child.");return A}};return tt.Activity=j,tt.Children=de,tt.Component=O,tt.Fragment=i,tt.Profiler=o,tt.PureComponent=H,tt.StrictMode=r,tt.Suspense=g,tt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=$,tt.__COMPILER_RUNTIME={__proto__:null,c:function(A){return $.H.useMemoCache(A)}},tt.cache=function(A){return function(){return A.apply(null,arguments)}},tt.cacheSignal=function(){return null},tt.cloneElement=function(A,F,U){if(A==null)throw Error("The argument must be a React element, but you passed "+A+".");var ye=C({},A.props),W=A.key;if(F!=null)for(fe in F.key!==void 0&&(W=""+F.key),F)!ne.call(F,fe)||fe==="key"||fe==="__self"||fe==="__source"||fe==="ref"&&F.ref===void 0||(ye[fe]=F[fe]);var fe=arguments.length-2;if(fe===1)ye.children=U;else if(1<fe){for(var Le=Array(fe),lt=0;lt<fe;lt++)Le[lt]=arguments[lt+2];ye.children=Le}return Y(A.type,W,ye)},tt.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},tt.createElement=function(A,F,U){var ye,W={},fe=null;if(F!=null)for(ye in F.key!==void 0&&(fe=""+F.key),F)ne.call(F,ye)&&ye!=="key"&&ye!=="__self"&&ye!=="__source"&&(W[ye]=F[ye]);var Le=arguments.length-2;if(Le===1)W.children=U;else if(1<Le){for(var lt=Array(Le),ke=0;ke<Le;ke++)lt[ke]=arguments[ke+2];W.children=lt}if(A&&A.defaultProps)for(ye in Le=A.defaultProps,Le)W[ye]===void 0&&(W[ye]=Le[ye]);return Y(A,fe,W)},tt.createRef=function(){return{current:null}},tt.forwardRef=function(A){return{$$typeof:p,render:A}},tt.isValidElement=I,tt.lazy=function(A){return{$$typeof:b,_payload:{_status:-1,_result:A},_init:G}},tt.memo=function(A,F){return{$$typeof:_,type:A,compare:F===void 0?null:F}},tt.startTransition=function(A){var F=$.T,U={};$.T=U;try{var ye=A(),W=$.S;W!==null&&W(U,ye),typeof ye=="object"&&ye!==null&&typeof ye.then=="function"&&ye.then(D,ie)}catch(fe){ie(fe)}finally{F!==null&&U.types!==null&&(F.types=U.types),$.T=F}},tt.unstable_useCacheRefresh=function(){return $.H.useCacheRefresh()},tt.use=function(A){return $.H.use(A)},tt.useActionState=function(A,F,U){return $.H.useActionState(A,F,U)},tt.useCallback=function(A,F){return $.H.useCallback(A,F)},tt.useContext=function(A){return $.H.useContext(A)},tt.useDebugValue=function(){},tt.useDeferredValue=function(A,F){return $.H.useDeferredValue(A,F)},tt.useEffect=function(A,F){return $.H.useEffect(A,F)},tt.useEffectEvent=function(A){return $.H.useEffectEvent(A)},tt.useId=function(){return $.H.useId()},tt.useImperativeHandle=function(A,F,U){return $.H.useImperativeHandle(A,F,U)},tt.useInsertionEffect=function(A,F){return $.H.useInsertionEffect(A,F)},tt.useLayoutEffect=function(A,F){return $.H.useLayoutEffect(A,F)},tt.useMemo=function(A,F){return $.H.useMemo(A,F)},tt.useOptimistic=function(A,F){return $.H.useOptimistic(A,F)},tt.useReducer=function(A,F,U){return $.H.useReducer(A,F,U)},tt.useRef=function(A){return $.H.useRef(A)},tt.useState=function(A){return $.H.useState(A)},tt.useSyncExternalStore=function(A,F,U){return $.H.useSyncExternalStore(A,F,U)},tt.useTransition=function(){return $.H.useTransition()},tt.version="19.2.8",tt}var z_;function _g(){return z_||(z_=1,fp.exports=Mj()),fp.exports}var x=_g(),hp={exports:{}},xd={},mp={exports:{}},pp={};/**
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 I_;function Rj(){return I_||(I_=1,(function(n){function l(L,z){var G=L.length;L.push(z);e:for(;0<G;){var ie=G-1>>>1,de=L[ie];if(0<o(de,z))L[ie]=z,L[G]=de,G=ie;else break e}}function i(L){return L.length===0?null:L[0]}function r(L){if(L.length===0)return null;var z=L[0],G=L.pop();if(G!==z){L[0]=G;e:for(var ie=0,de=L.length,A=de>>>1;ie<A;){var F=2*(ie+1)-1,U=L[F],ye=F+1,W=L[ye];if(0>o(U,G))ye<de&&0>o(W,U)?(L[ie]=W,L[ye]=G,ie=ye):(L[ie]=U,L[F]=G,ie=F);else if(ye<de&&0>o(W,G))L[ie]=W,L[ye]=G,ie=ye;else break e}}return z}function o(L,z){var G=L.sortIndex-z.sortIndex;return G!==0?G:L.id-z.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,N=3,w=!1,k=!1,C=!1,E=!1,O=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,H=typeof setImmediate<"u"?setImmediate:null;function te(L){for(var z=i(_);z!==null;){if(z.callback===null)r(_);else if(z.startTime<=L)r(_),z.sortIndex=z.expirationTime,l(g,z);else break;z=i(_)}}function Q(L){if(C=!1,te(L),!k)if(i(g)!==null)k=!0,D||(D=!0,V());else{var z=i(_);z!==null&&le(Q,z.startTime-L)}}var D=!1,$=-1,ne=5,Y=-1;function q(){return E?!0:!(n.unstable_now()-Y<ne)}function I(){if(E=!1,D){var L=n.unstable_now();Y=L;var z=!0;try{e:{k=!1,C&&(C=!1,R($),$=-1),w=!0;var G=N;try{t:{for(te(L),j=i(g);j!==null&&!(j.expirationTime>L&&q());){var ie=j.callback;if(typeof ie=="function"){j.callback=null,N=j.priorityLevel;var de=ie(j.expirationTime<=L);if(L=n.unstable_now(),typeof de=="function"){j.callback=de,te(L),z=!0;break t}j===i(g)&&r(g),te(L)}else r(g);j=i(g)}if(j!==null)z=!0;else{var A=i(_);A!==null&&le(Q,A.startTime-L),z=!1}}break e}finally{j=null,N=G,w=!1}z=void 0}}finally{z?V():D=!1}}}var V;if(typeof H=="function")V=function(){H(I)};else if(typeof MessageChannel<"u"){var pe=new MessageChannel,J=pe.port2;pe.port1.onmessage=I,V=function(){J.postMessage(null)}}else V=function(){O(I,0)};function le(L,z){$=O(function(){L(n.unstable_now())},z)}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(L){L.callback=null},n.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ne=0<L?Math.floor(1e3/L):5},n.unstable_getCurrentPriorityLevel=function(){return N},n.unstable_next=function(L){switch(N){case 1:case 2:case 3:var z=3;break;default:z=N}var G=N;N=z;try{return L()}finally{N=G}},n.unstable_requestPaint=function(){E=!0},n.unstable_runWithPriority=function(L,z){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var G=N;N=L;try{return z()}finally{N=G}},n.unstable_scheduleCallback=function(L,z,G){var ie=n.unstable_now();switch(typeof G=="object"&&G!==null?(G=G.delay,G=typeof G=="number"&&0<G?ie+G:ie):G=ie,L){case 1:var de=-1;break;case 2:de=250;break;case 5:de=1073741823;break;case 4:de=1e4;break;default:de=5e3}return de=G+de,L={id:b++,callback:z,priorityLevel:L,startTime:G,expirationTime:de,sortIndex:-1},G>ie?(L.sortIndex=G,l(_,L),i(g)===null&&L===i(_)&&(C?(R($),$=-1):C=!0,le(Q,G-ie))):(L.sortIndex=de,l(g,L),k||w||(k=!0,D||(D=!0,V()))),L},n.unstable_shouldYield=q,n.unstable_wrapCallback=function(L){var z=N;return function(){var G=N;N=z;try{return L.apply(this,arguments)}finally{N=G}}}})(pp)),pp}var U_;function Dj(){return U_||(U_=1,mp.exports=Rj()),mp.exports}var gp={exports:{}},Gs={};/**
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 $_;function Lj(){if($_)return Gs;$_=1;var n=_g();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 Gs.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Gs.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)},Gs.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()}},Gs.preconnect=function(g,_){typeof g=="string"&&(_?(_=_.crossOrigin,_=typeof _=="string"?_==="use-credentials"?_:"":void 0):_=null,r.d.C(g,_))},Gs.prefetchDNS=function(g){typeof g=="string"&&r.d.D(g)},Gs.preinit=function(g,_){if(typeof g=="string"&&_&&typeof _.as=="string"){var b=_.as,j=p(b,_.crossOrigin),N=typeof _.integrity=="string"?_.integrity:void 0,w=typeof _.fetchPriority=="string"?_.fetchPriority:void 0;b==="style"?r.d.S(g,typeof _.precedence=="string"?_.precedence:void 0,{crossOrigin:j,integrity:N,fetchPriority:w}):b==="script"&&r.d.X(g,{crossOrigin:j,integrity:N,fetchPriority:w,nonce:typeof _.nonce=="string"?_.nonce:void 0})}},Gs.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)},Gs.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})}},Gs.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)},Gs.requestFormReset=function(g){r.d.r(g)},Gs.unstable_batchedUpdates=function(g,_){return g(_)},Gs.useFormState=function(g,_,b){return m.H.useFormState(g,_,b)},Gs.useFormStatus=function(){return m.H.useHostTransitionStatus()},Gs.version="19.2.8",Gs}var B_;function zy(){if(B_)return gp.exports;B_=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(),gp.exports=Lj(),gp.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 H_;function Oj(){if(H_)return xd;H_=1;var n=Dj(),l=_g(),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 v=!1,S=d.child;S;){if(S===a){v=!0,a=d,c=f;break}if(S===c){v=!0,c=d,a=f;break}S=S.sibling}if(!v){for(S=f.child;S;){if(S===a){v=!0,a=f,c=d;break}if(S===c){v=!0,c=f,a=d;break}S=S.sibling}if(!v)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,N=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),H=Symbol.for("react.context"),te=Symbol.for("react.forward_ref"),Q=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),ne=Symbol.for("react.lazy"),Y=Symbol.for("react.activity"),q=Symbol.for("react.memo_cache_sentinel"),I=Symbol.iterator;function V(e){return e===null||typeof e!="object"?null:(e=I&&e[I]||e["@@iterator"],typeof e=="function"?e:null)}var pe=Symbol.for("react.client.reference");function J(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===pe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case C:return"Fragment";case O:return"Profiler";case E:return"StrictMode";case Q:return"Suspense";case D:return"SuspenseList";case Y:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case k:return"Portal";case H:return e.displayName||"Context";case R:return(e._context.displayName||"Context")+".Consumer";case te:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case $:return t=e.displayName||null,t!==null?t:J(e.type)||"Memo";case ne:t=e._payload,e=e._init;try{return J(e(t))}catch{}}return null}var le=Array.isArray,L=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G={pending:!1,data:null,method:null,action:null},ie=[],de=-1;function A(e){return{current:e}}function F(e){0>de||(e.current=ie[de],ie[de]=null,de--)}function U(e,t){de++,ie[de]=e.current,e.current=t}var ye=A(null),W=A(null),fe=A(null),Le=A(null);function lt(e,t){switch(U(fe,t),U(W,e),U(ye,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?t_(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=t_(t),e=n_(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}F(ye),U(ye,e)}function ke(){F(ye),F(W),F(fe)}function Be(e){e.memoizedState!==null&&U(Le,e);var t=ye.current,a=n_(t,e.type);t!==a&&(U(W,e),U(ye,a))}function Ye(e){W.current===e&&(F(ye),F(W)),Le.current===e&&(F(Le),fd._currentValue=G)}var Qe,qn;function We(e){if(Qe===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);Qe=t&&t[1]||"",qn=-1<a.stack.indexOf(`
43
+ at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
44
+ `+Qe+e+qn}var _n=!1;function Ge(e,t){if(!e||_n)return"";_n=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(t){var Ne=function(){throw Error()};if(Object.defineProperty(Ne.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ne,[])}catch(he){var ue=he}Reflect.construct(e,[],Ne)}else{try{Ne.call()}catch(he){ue=he}e.call(Ne.prototype)}}else{try{throw Error()}catch(he){ue=he}(Ne=e())&&typeof Ne.catch=="function"&&Ne.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(),v=f[0],S=f[1];if(v&&S){var B=v.split(`
45
+ `),oe=S.split(`
46
+ `);for(d=c=0;c<B.length&&!B[c].includes("DetermineComponentFrameRoot");)c++;for(;d<oe.length&&!oe[d].includes("DetermineComponentFrameRoot");)d++;if(c===B.length||d===oe.length)for(c=B.length-1,d=oe.length-1;1<=c&&0<=d&&B[c]!==oe[d];)d--;for(;1<=c&&0<=d;c--,d--)if(B[c]!==oe[d]){if(c!==1||d!==1)do if(c--,d--,0>d||B[c]!==oe[d]){var xe=`
47
+ `+B[c].replace(" at new "," at ");return e.displayName&&xe.includes("<anonymous>")&&(xe=xe.replace("<anonymous>",e.displayName)),xe}while(1<=c&&0<=d);break}}}finally{_n=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?We(a):""}function ct(e,t){switch(e.tag){case 26:case 27:case 5:return We(e.type);case 16:return We("Lazy");case 13:return e.child!==t&&t!==null?We("Suspense Fallback"):We("Suspense");case 19:return We("SuspenseList");case 0:case 15:return Ge(e.type,!1);case 11:return Ge(e.type.render,!1);case 1:return Ge(e.type,!0);case 31:return We("Activity");default:return""}}function nt(e){try{var t="",a=null;do t+=ct(e,a),a=e,e=e.return;while(e);return t}catch(c){return`
48
+ Error generating stack: `+c.message+`
49
+ `+c.stack}}var It=Object.prototype.hasOwnProperty,Se=n.unstable_scheduleCallback,rt=n.unstable_cancelCallback,kn=n.unstable_shouldYield,Ut=n.unstable_requestPaint,ot=n.unstable_now,Fs=n.unstable_getCurrentPriorityLevel,Vn=n.unstable_ImmediatePriority,Rn=n.unstable_UserBlockingPriority,Mt=n.unstable_NormalPriority,$t=n.unstable_LowPriority,an=n.unstable_IdlePriority,bt=n.log,Rt=n.unstable_setDisableYieldValue,nn=null,Zt=null;function St(e){if(typeof bt=="function"&&Rt(e),Zt&&typeof Zt.setStrictMode=="function")try{Zt.setStrictMode(nn,e)}catch{}}var Dt=Math.clz32?Math.clz32:Ee,Xn=Math.log,ge=Math.LN2;function Ee(e){return e>>>=0,e===0?32:31-(Xn(e)/ge|0)|0}var Ve=256,et=262144,Pe=4194304;function Pt(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 st(e,t,a){var c=e.pendingLanes;if(c===0)return 0;var d=0,f=e.suspendedLanes,v=e.pingedLanes;e=e.warmLanes;var S=c&134217727;return S!==0?(c=S&~f,c!==0?d=Pt(c):(v&=S,v!==0?d=Pt(v):a||(a=S&~e,a!==0&&(d=Pt(a))))):(S=c&~f,S!==0?d=Pt(S):v!==0?d=Pt(v):a||(a=c&~e,a!==0&&(d=Pt(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 ut(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function vs(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 Dn(){var e=Pe;return Pe<<=1,(Pe&62914560)===0&&(Pe=4194304),e}function Ls(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function us(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function wn(e,t,a,c,d,f){var v=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 S=e.entanglements,B=e.expirationTimes,oe=e.hiddenUpdates;for(a=v&~a;0<a;){var xe=31-Dt(a),Ne=1<<xe;S[xe]=0,B[xe]=-1;var ue=oe[xe];if(ue!==null)for(oe[xe]=null,xe=0;xe<ue.length;xe++){var he=ue[xe];he!==null&&(he.lane&=-536870913)}a&=~Ne}c!==0&&Ln(e,c,0),f!==0&&d===0&&e.tag!==0&&(e.suspendedLanes|=f&~(v&~t))}function Ln(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var c=31-Dt(t);e.entangledLanes|=t,e.entanglements[c]=e.entanglements[c]|1073741824|a&261930}function Os(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var c=31-Dt(a),d=1<<c;d&t|e[c]&t&&(e[c]|=t),a&=~d}}function sn(e,t){var a=t&-t;return a=(a&42)!==0?1:rn(a),(a&(e.suspendedLanes|t))!==0?0:a}function rn(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 ts(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function cn(){var e=z.p;return e!==0?e:(e=window.event,e===void 0?32:w_(e.type))}function On(e,t){var a=z.p;try{return z.p=e,t()}finally{z.p=a}}var on=Math.random().toString(36).slice(2),yt="__reactFiber$"+on,un="__reactProps$"+on,ds="__reactContainer$"+on,fs="__reactEvents$"+on,Ks="__reactListeners$"+on,yl="__reactHandles$"+on,vl="__reactResources$"+on,vt="__reactMarker$"+on;function zs(e){delete e[yt],delete e[un],delete e[fs],delete e[Ks],delete e[yl]}function zn(e){var t=e[yt];if(t)return t;for(var a=e.parentNode;a;){if(t=a[ds]||a[yt]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=o_(e);e!==null;){if(a=e[yt])return a;e=o_(e)}return t}e=a,a=e.parentNode}return null}function K(e){if(e=e[yt]||e[ds]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function me(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(r(33))}function Ce(e){var t=e[vl];return t||(t=e[vl]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Ie(e){e[vt]=!0}var gt=new Set,ln={};function Nt(e,t){In(e,t),In(e+"Capture",t)}function In(e,t){for(ln[e]=t,e=0;e<t.length;e++)gt.add(t[e])}var Sn=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]*$"),kt={},Qs={};function dn(e){return It.call(Qs,e)?!0:It.call(kt,e)?!1:Sn.test(e)?Qs[e]=!0:(kt[e]=!0,!1)}function jl(e,t,a){if(dn(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 Nl(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 Fn(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 Gt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ca(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function js(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(v){a=""+v,f.call(this,v)}}),Object.defineProperty(e,t,{enumerable:c.enumerable}),{getValue:function(){return a},setValue:function(v){a=""+v},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Wl(e){if(!e._valueTracker){var t=Ca(e)?"checked":"value";e._valueTracker=js(e,t,""+e[t])}}function Ns(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),c="";return e&&(c=Ca(e)?e.checked?"true":"false":e.value),e=c,e!==a?(t.setValue(e),!0):!1}function ns(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 sl=/[\n"\\]/g;function Wt(e){return e.replace(sl,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Zs(e,t,a,c,d,f,v,S){e.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?e.type=v:e.removeAttribute("type"),t!=null?v==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Gt(t)):e.value!==""+Gt(t)&&(e.value=""+Gt(t)):v!=="submit"&&v!=="reset"||e.removeAttribute("value"),t!=null?Jl(e,v,Gt(t)):a!=null?Jl(e,v,Gt(a)):c!=null&&e.removeAttribute("value"),d==null&&f!=null&&(e.defaultChecked=!!f),d!=null&&(e.checked=d&&typeof d!="function"&&typeof d!="symbol"),S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?e.name=""+Gt(S):e.removeAttribute("name")}function ri(e,t,a,c,d,f,v,S){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)){Wl(e);return}a=a!=null?""+Gt(a):"",t=t!=null?""+Gt(t):a,S||t===e.value||(e.value=t),e.defaultValue=t}c=c??d,c=typeof c!="function"&&typeof c!="symbol"&&!!c,e.checked=S?e.checked:!!c,e.defaultChecked=!!c,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(e.name=v),Wl(e)}function Jl(e,t,a){t==="number"&&ns(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function hs(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=""+Gt(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 ea(e,t,a){if(t!=null&&(t=""+Gt(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+Gt(a):""}function ta(e,t,a,c){if(t==null){if(c!=null){if(a!=null)throw Error(r(92));if(le(c)){if(1<c.length)throw Error(r(93));c=c[0]}a=c}a==null&&(a=""),t=a}a=Gt(t),e.defaultValue=a,c=e.textContent,c===a&&c!==""&&c!==null&&(e.value=c),Wl(e)}function Ps(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var ms=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 ll(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||ms.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function Kn(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&&ll(e,d,c)}else for(var f in t)t.hasOwnProperty(f)&&ll(e,f,t[f])}function na(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 Il=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"]]),Fi=/^[\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 sa(e){return Fi.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function dt(){}var la=null;function bn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ul=null,ks=null;function Un(e){var t=K(e);if(t&&(e=t.stateNode)){var a=e[un]||null;e:switch(e=t.stateNode,t.type){case"input":if(Zs(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="'+Wt(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var c=a[t];if(c!==e&&c.form===e.form){var d=c[un]||null;if(!d)throw Error(r(90));Zs(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&&Ns(c)}break e;case"textarea":ea(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&hs(e,!!a.multiple,t,!1)}}}var ci=!1;function al(e,t,a){if(ci)return e(t,a);ci=!0;try{var c=e(t);return c}finally{if(ci=!1,(Ul!==null||ks!==null)&&(Mf(),Ul&&(t=Ul,e=ks,ks=Ul=null,Un(t),e)))for(t=0;t<e.length;t++)Un(e[t])}}function Ws(e,t){var a=e.stateNode;if(a===null)return null;var c=a[un]||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 ss=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ps=!1;if(ss)try{var je={};Object.defineProperty(je,"passive",{get:function(){ps=!0}}),window.addEventListener("test",je,je),window.removeEventListener("test",je,je)}catch{ps=!1}var y=null,T=null,Z=null;function re(){if(Z)return Z;var e,t=T,a=t.length,c,d="value"in y?y.value:y.textContent,f=d.length;for(e=0;e<a&&t[e]===d[e];e++);var v=a-e;for(c=1;c<=v&&t[a-c]===d[f-c];c++);return Z=d.slice(e,1<c?1-c:void 0)}function Me(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 Ae(){return!0}function Xe(){return!1}function ft(e){function t(a,c,d,f,v){this._reactName=a,this._targetInst=d,this.type=c,this.nativeEvent=f,this.target=v,this.currentTarget=null;for(var S in e)e.hasOwnProperty(S)&&(a=e[S],this[S]=a?a(f):f[S]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?Ae:Xe,this.isPropagationStopped=Xe,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=Ae)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Ae)},persist:function(){},isPersistent:Ae}),t}var Qn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},fn=ft(Qn),En=j({},Qn,{view:0,detail:0}),Ta=ft(En),Bt,Ki,Gn,Vr=j({},En,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Zi,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!==Gn&&(Gn&&e.type==="mousemove"?(Bt=e.screenX-Gn.screenX,Ki=e.screenY-Gn.screenY):Ki=Bt=0,Gn=e),Bt)},movementY:function(e){return"movementY"in e?e.movementY:Ki}}),oi=ft(Vr),qc=j({},Vr,{dataTransfer:0}),Zh=ft(qc),Ph=j({},En,{relatedTarget:0}),Qi=ft(Ph),aa=j({},Qn,{animationName:0,elapsedTime:0,pseudoElement:0}),Xr=ft(aa),ws=j({},Qn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),qd=ft(ws),du=j({},Qn,{data:0}),Fr=ft(du),Wh={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Gc={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"},fu={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function il(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=fu[e])?!!t[e]:!1}function Zi(){return il}var Yc=j({},En,{key:function(e){if(e.key){var t=Wh[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Me(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Gc[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Zi,charCode:function(e){return e.type==="keypress"?Me(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Me(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),hu=ft(Yc),Gd=j({},Vr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Yd=ft(Gd),Jh=j({},En,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Zi}),em=ft(Jh),tm=j({},Qn,{propertyName:0,elapsedTime:0,pseudoElement:0}),nm=ft(tm),Vc=j({},Vr,{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}),sm=ft(Vc),mu=j({},Qn,{newState:0,oldState:0}),lm=ft(mu),Xc=[9,13,27,32],Ss=ss&&"CompositionEvent"in window,ia=null;ss&&"documentMode"in document&&(ia=document.documentMode);var ui=ss&&"TextEvent"in window&&!ia,Pi=ss&&(!Ss||ia&&8<ia&&11>=ia),Kr=" ",Qr=!1;function Aa(e,t){switch(e){case"keyup":return Xc.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Is(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var di=!1;function am(e,t){switch(e){case"compositionend":return Is(t);case"keypress":return t.which!==32?null:(Qr=!0,Kr);case"textInput":return e=t.data,e===Kr&&Qr?null:e;default:return null}}function Vd(e,t){if(di)return e==="compositionend"||!Ss&&Aa(e,t)?(e=re(),Z=T=y=null,di=!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 Pi&&t.locale!=="ko"?null:t.data;default:return null}}var Wi={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 fi(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Wi[e.type]:t==="textarea"}function Zr(e,t,a,c){Ul?ks?ks.push(c):ks=[c]:Ul=c,t=Uf(t,"onChange"),0<t.length&&(a=new fn("onChange","change",null,a,c),e.push({event:a,listeners:t}))}var Ma=null,Ra=null;function Da(e){Qx(e,0)}function Fc(e){var t=me(e);if(Ns(t))return e}function kl(e,t){if(e==="change")return t}var Ji=!1;if(ss){var er;if(ss){var hi="oninput"in document;if(!hi){var Pr=document.createElement("div");Pr.setAttribute("oninput","return;"),hi=typeof Pr.oninput=="function"}er=hi}else er=!1;Ji=er&&(!document.documentMode||9<document.documentMode)}function Xd(){Ma&&(Ma.detachEvent("onpropertychange",Kc),Ra=Ma=null)}function Kc(e){if(e.propertyName==="value"&&Fc(Ra)){var t=[];Zr(t,Ra,e,bn(e)),al(Da,t)}}function Qc(e,t,a){e==="focusin"?(Xd(),Ma=t,Ra=a,Ma.attachEvent("onpropertychange",Kc)):e==="focusout"&&Xd()}function Fd(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Fc(Ra)}function Zc(e,t){if(e==="click")return Fc(t)}function Kd(e,t){if(e==="input"||e==="change")return Fc(t)}function mi(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ls=typeof Object.is=="function"?Object.is:mi;function Wr(e,t){if(ls(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(!It.call(t,d)||!ls(e[d],t[d]))return!1}return!0}function Pc(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Jr(e,t){var a=Pc(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=Pc(a)}}function Wc(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Wc(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function pu(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=ns(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=ns(e.document)}return t}function tr(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 nr=ss&&"documentMode"in document&&11>=document.documentMode,La=null,sr=null,ra=null,gu=!1;function ec(e,t,a){var c=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;gu||La==null||La!==ns(c)||(c=La,"selectionStart"in c&&tr(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}),ra&&Wr(ra,c)||(ra=c,c=Uf(sr,"onSelect"),0<c.length&&(t=new fn("onSelect","select",null,t,a),e.push({event:t,listeners:c}),t.target=La)))}function pi(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var ca={animationend:pi("Animation","AnimationEnd"),animationiteration:pi("Animation","AnimationIteration"),animationstart:pi("Animation","AnimationStart"),transitionrun:pi("Transition","TransitionRun"),transitionstart:pi("Transition","TransitionStart"),transitioncancel:pi("Transition","TransitionCancel"),transitionend:pi("Transition","TransitionEnd")},lr={},Jc={};ss&&(Jc=document.createElement("div").style,"AnimationEvent"in window||(delete ca.animationend.animation,delete ca.animationiteration.animation,delete ca.animationstart.animation),"TransitionEvent"in window||delete ca.transitionend.transition);function wl(e){if(lr[e])return lr[e];if(!ca[e])return e;var t=ca[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in Jc)return lr[e]=t[a];return e}var Oa=wl("animationend"),tc=wl("animationiteration"),eo=wl("animationstart"),im=wl("transitionrun"),gi=wl("transitionstart"),to=wl("transitioncancel"),xu=wl("transitionend"),nc=new Map,no="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(" ");no.push("scrollEnd");function Us(e,t){nc.set(e,t),Nt(t,[e])}var rl=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)},Es=[],$l=0,oa=0;function za(){for(var e=$l,t=oa=$l=0;t<e;){var a=Es[t];Es[t++]=null;var c=Es[t];Es[t++]=null;var d=Es[t];Es[t++]=null;var f=Es[t];if(Es[t++]=null,c!==null&&d!==null){var v=c.pending;v===null?d.next=d:(d.next=v.next,v.next=d),c.pending=d}f!==0&&Qd(a,d,f)}}function Jt(e,t,a,c){Es[$l++]=e,Es[$l++]=t,Es[$l++]=a,Es[$l++]=c,oa|=c,e.lanes|=c,e=e.alternate,e!==null&&(e.lanes|=c)}function sc(e,t,a,c){return Jt(e,t,a,c),ar(e)}function xi(e,t){return Jt(e,null,null,t),ar(e)}function Qd(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-Dt(a),e=f.hiddenUpdates,c=e[d],c===null?e[d]=[t]:c.push(t),t.lane=a|536870912),f):null}function ar(e){if(50<ad)throw ad=0,Lm=null,Error(r(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ua={};function Zn(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 gs(e,t,a,c){return new Zn(e,t,a,c)}function _i(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Js(e,t){var a=e.alternate;return a===null?(a=gs(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 Sl(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 lc(e,t,a,c,d,f){var v=0;if(c=e,typeof e=="function")_i(e)&&(v=1);else if(typeof e=="string")v=pj(e,a,ye.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Y:return e=gs(31,a,t,d),e.elementType=Y,e.lanes=f,e;case C:return Et(a.children,d,f,t);case E:v=8,d|=24;break;case O:return e=gs(12,a,t,d|2),e.elementType=O,e.lanes=f,e;case Q:return e=gs(13,a,t,d),e.elementType=Q,e.lanes=f,e;case D:return e=gs(19,a,t,d),e.elementType=D,e.lanes=f,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case H:v=10;break e;case R:v=9;break e;case te:v=11;break e;case $:v=14;break e;case ne:v=16,c=null;break e}v=29,a=Error(r(130,e===null?"null":typeof e,"")),c=null}return t=gs(v,a,t,d),t.elementType=e,t.type=c,t.lanes=f,t}function Et(e,t,a,c){return e=gs(7,e,c,t),e.lanes=a,e}function so(e,t,a){return e=gs(6,e,null,t),e.lanes=a,e}function _u(e){var t=gs(18,null,null,0);return t.stateNode=e,t}function El(e,t,a){return t=gs(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var bu=new WeakMap;function Cs(e,t){if(typeof e=="object"&&e!==null){var a=bu.get(e);return a!==void 0?a:(t={value:e,source:t,stack:nt(t)},bu.set(e,t),t)}return{value:e,source:t,stack:nt(t)}}var da=[],Bl=0,el=null,ir=0,as=[],xs=0,cl=null,$s=1,Cl="";function Bs(e,t){da[Bl++]=ir,da[Bl++]=el,el=e,ir=t}function yu(e,t,a){as[xs++]=$s,as[xs++]=Cl,as[xs++]=cl,cl=e;var c=$s;e=Cl;var d=32-Dt(c)-1;c&=~(1<<d),a+=1;var f=32-Dt(t)+d;if(30<f){var v=d-d%5;f=(c&(1<<v)-1).toString(32),c>>=v,d-=v,$s=1<<32-Dt(t)+d|a<<d|c,Cl=f+e}else $s=1<<f|a<<d|c,Cl=e}function vu(e){e.return!==null&&(Bs(e,1),yu(e,1,0))}function ae(e){for(;e===el;)el=da[--Bl],da[Bl]=null,ir=da[--Bl],da[Bl]=null;for(;e===cl;)cl=as[--xs],as[xs]=null,Cl=as[--xs],as[xs]=null,$s=as[--xs],as[xs]=null}function Zd(e,t){as[xs++]=$s,as[xs++]=Cl,as[xs++]=cl,$s=t.id,Cl=t.overflow,cl=e}var yn=null,Yt=null,ht=!1,Tl=null,ol=!1,ju=Error(r(519));function Ia(e){var t=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ua(Cs(t,e)),ju}function X(e){var t=e.stateNode,a=e.type,c=e.memoizedProps;switch(t[yt]=e,t[un]=c,a){case"dialog":pt("cancel",t),pt("close",t);break;case"iframe":case"object":case"embed":pt("load",t);break;case"video":case"audio":for(a=0;a<rd.length;a++)pt(rd[a],t);break;case"source":pt("error",t);break;case"img":case"image":case"link":pt("error",t),pt("load",t);break;case"details":pt("toggle",t);break;case"input":pt("invalid",t),ri(t,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0);break;case"select":pt("invalid",t);break;case"textarea":pt("invalid",t),ta(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||Jx(t.textContent,a)?(c.popover!=null&&(pt("beforetoggle",t),pt("toggle",t)),c.onScroll!=null&&pt("scroll",t),c.onScrollEnd!=null&&pt("scrollend",t),c.onClick!=null&&(t.onclick=dt),t=!0):t=!1,t||Ia(e,!0)}function lo(e){for(yn=e.return;yn;)switch(yn.tag){case 5:case 31:case 13:ol=!1;return;case 27:case 3:ol=!0;return;default:yn=yn.return}}function Hs(e){if(e!==yn)return!1;if(!ht)return lo(e),ht=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Qm(e.type,e.memoizedProps)),a=!a),a&&Yt&&Ia(e),lo(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));Yt=c_(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));Yt=c_(e)}else t===27?(t=Yt,Sr(e.type)?(e=ep,ep=null,Yt=e):Yt=t):Yt=yn?Xl(e.stateNode.nextSibling):null;return!0}function is(){Yt=yn=null,ht=!1}function ao(){var e=Tl;return e!==null&&(pl===null?pl=e:pl.push.apply(pl,e),Tl=null),e}function Ua(e){Tl===null?Tl=[e]:Tl.push(e)}var io=A(null),bi=null,Yn=null;function $a(e,t,a){U(io,t._currentValue),t._currentValue=a}function Hl(e){e._currentValue=io.current,F(io)}function Nu(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 hn(e,t,a,c){var d=e.child;for(d!==null&&(d.return=e);d!==null;){var f=d.dependencies;if(f!==null){var v=d.child;f=f.firstContext;e:for(;f!==null;){var S=f;f=d;for(var B=0;B<t.length;B++)if(S.context===t[B]){f.lanes|=a,S=f.alternate,S!==null&&(S.lanes|=a),Nu(f.return,a,e),c||(v=null);break e}f=S.next}}else if(d.tag===18){if(v=d.return,v===null)throw Error(r(341));v.lanes|=a,f=v.alternate,f!==null&&(f.lanes|=a),Nu(v,a,e),v=null}else v=d.child;if(v!==null)v.return=d;else for(v=d;v!==null;){if(v===e){v=null;break}if(d=v.sibling,d!==null){d.return=v.return,v=d;break}v=v.return}d=v}}function rr(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 v=d.alternate;if(v===null)throw Error(r(387));if(v=v.memoizedProps,v!==null){var S=d.type;ls(d.pendingProps.value,v.value)||(e!==null?e.push(S):e=[S])}}else if(d===Le.current){if(v=d.alternate,v===null)throw Error(r(387));v.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(e!==null?e.push(fd):e=[fd])}d=d.return}e!==null&&hn(t,e,a,c),t.flags|=262144}function ro(e){for(e=e.firstContext;e!==null;){if(!ls(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function yi(e){bi=e,Yn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function rs(e){return Ba(bi,e)}function co(e,t){return bi===null&&yi(e),Ba(e,t)}function Ba(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},Yn===null){if(e===null)throw Error(r(308));Yn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Yn=Yn.next=t;return a}var rm=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()})}},cm=n.unstable_scheduleCallback,Pd=n.unstable_NormalPriority,$n={$$typeof:H,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ku(){return{controller:new rm,data:new Map,refCount:0}}function ac(e){e.refCount--,e.refCount===0&&cm(Pd,function(){e.controller.abort()})}var ic=null,wu=0,cr=0,or=null;function rc(e,t){if(ic===null){var a=ic=[];wu=0,cr=Bm(),or={status:"pending",value:void 0,then:function(c){a.push(c)}}}return wu++,t.then(Wd,Wd),t}function Wd(){if(--wu===0&&ic!==null){or!==null&&(or.status="fulfilled");var e=ic;ic=null,cr=0,or=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function om(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 oo=L.S;L.S=function(e,t){Nx=ot(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&rc(e,t),oo!==null&&oo(e,t)};var vi=A(null);function Su(){var e=vi.current;return e!==null?e:tn.pooledCache}function ql(e,t){t===null?U(vi,vi.current):U(vi,t.pool)}function Jd(){var e=Su();return e===null?null:{parent:$n._currentValue,pool:e}}var ur=Error(r(460)),uo=Error(r(474)),cc=Error(r(542)),oc={then:function(){}};function ef(e){return e=e.status,e==="fulfilled"||e==="rejected"}function tf(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(dt,dt),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,nf(e),e;default:if(typeof t.status=="string")t.then(dt,dt);else{if(e=tn,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,nf(e),e}throw Ha=t,ur}}function fa(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Ha=a,ur):a}}var Ha=null;function fo(){if(Ha===null)throw Error(r(459));var e=Ha;return Ha=null,e}function nf(e){if(e===ur||e===cc)throw Error(r(483))}var ji=null,Ni=0;function uc(e){var t=Ni;return Ni+=1,ji===null&&(ji=[]),tf(ji,e,t)}function ki(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function dc(e,t){throw t.$$typeof===N?Error(r(525)):(e=Object.prototype.toString.call(t),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Eu(e){function t(se,P){if(e){var ce=se.deletions;ce===null?(se.deletions=[P],se.flags|=16):ce.push(P)}}function a(se,P){if(!e)return null;for(;P!==null;)t(se,P),P=P.sibling;return null}function c(se){for(var P=new Map;se!==null;)se.key!==null?P.set(se.key,se):P.set(se.index,se),se=se.sibling;return P}function d(se,P){return se=Js(se,P),se.index=0,se.sibling=null,se}function f(se,P,ce){return se.index=ce,e?(ce=se.alternate,ce!==null?(ce=ce.index,ce<P?(se.flags|=67108866,P):ce):(se.flags|=67108866,P)):(se.flags|=1048576,P)}function v(se){return e&&se.alternate===null&&(se.flags|=67108866),se}function S(se,P,ce,be){return P===null||P.tag!==6?(P=so(ce,se.mode,be),P.return=se,P):(P=d(P,ce),P.return=se,P)}function B(se,P,ce,be){var qe=ce.type;return qe===C?xe(se,P,ce.props.children,be,ce.key):P!==null&&(P.elementType===qe||typeof qe=="object"&&qe!==null&&qe.$$typeof===ne&&fa(qe)===P.type)?(P=d(P,ce.props),ki(P,ce),P.return=se,P):(P=lc(ce.type,ce.key,ce.props,null,se.mode,be),ki(P,ce),P.return=se,P)}function oe(se,P,ce,be){return P===null||P.tag!==4||P.stateNode.containerInfo!==ce.containerInfo||P.stateNode.implementation!==ce.implementation?(P=El(ce,se.mode,be),P.return=se,P):(P=d(P,ce.children||[]),P.return=se,P)}function xe(se,P,ce,be,qe){return P===null||P.tag!==7?(P=Et(ce,se.mode,be,qe),P.return=se,P):(P=d(P,ce),P.return=se,P)}function Ne(se,P,ce){if(typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint")return P=so(""+P,se.mode,ce),P.return=se,P;if(typeof P=="object"&&P!==null){switch(P.$$typeof){case w:return ce=lc(P.type,P.key,P.props,null,se.mode,ce),ki(ce,P),ce.return=se,ce;case k:return P=El(P,se.mode,ce),P.return=se,P;case ne:return P=fa(P),Ne(se,P,ce)}if(le(P)||V(P))return P=Et(P,se.mode,ce,null),P.return=se,P;if(typeof P.then=="function")return Ne(se,uc(P),ce);if(P.$$typeof===H)return Ne(se,co(se,P),ce);dc(se,P)}return null}function ue(se,P,ce,be){var qe=P!==null?P.key:null;if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return qe!==null?null:S(se,P,""+ce,be);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case w:return ce.key===qe?B(se,P,ce,be):null;case k:return ce.key===qe?oe(se,P,ce,be):null;case ne:return ce=fa(ce),ue(se,P,ce,be)}if(le(ce)||V(ce))return qe!==null?null:xe(se,P,ce,be,null);if(typeof ce.then=="function")return ue(se,P,uc(ce),be);if(ce.$$typeof===H)return ue(se,P,co(se,ce),be);dc(se,ce)}return null}function he(se,P,ce,be,qe){if(typeof be=="string"&&be!==""||typeof be=="number"||typeof be=="bigint")return se=se.get(ce)||null,S(P,se,""+be,qe);if(typeof be=="object"&&be!==null){switch(be.$$typeof){case w:return se=se.get(be.key===null?ce:be.key)||null,B(P,se,be,qe);case k:return se=se.get(be.key===null?ce:be.key)||null,oe(P,se,be,qe);case ne:return be=fa(be),he(se,P,ce,be,qe)}if(le(be)||V(be))return se=se.get(ce)||null,xe(P,se,be,qe,null);if(typeof be.then=="function")return he(se,P,ce,uc(be),qe);if(be.$$typeof===H)return he(se,P,ce,co(P,be),qe);dc(P,be)}return null}function $e(se,P,ce,be){for(var qe=null,Tt=null,He=P,it=P=0,_t=null;He!==null&&it<ce.length;it++){He.index>it?(_t=He,He=null):_t=He.sibling;var At=ue(se,He,ce[it],be);if(At===null){He===null&&(He=_t);break}e&&He&&At.alternate===null&&t(se,He),P=f(At,P,it),Tt===null?qe=At:Tt.sibling=At,Tt=At,He=_t}if(it===ce.length)return a(se,He),ht&&Bs(se,it),qe;if(He===null){for(;it<ce.length;it++)He=Ne(se,ce[it],be),He!==null&&(P=f(He,P,it),Tt===null?qe=He:Tt.sibling=He,Tt=He);return ht&&Bs(se,it),qe}for(He=c(He);it<ce.length;it++)_t=he(He,se,it,ce[it],be),_t!==null&&(e&&_t.alternate!==null&&He.delete(_t.key===null?it:_t.key),P=f(_t,P,it),Tt===null?qe=_t:Tt.sibling=_t,Tt=_t);return e&&He.forEach(function(Mr){return t(se,Mr)}),ht&&Bs(se,it),qe}function Fe(se,P,ce,be){if(ce==null)throw Error(r(151));for(var qe=null,Tt=null,He=P,it=P=0,_t=null,At=ce.next();He!==null&&!At.done;it++,At=ce.next()){He.index>it?(_t=He,He=null):_t=He.sibling;var Mr=ue(se,He,At.value,be);if(Mr===null){He===null&&(He=_t);break}e&&He&&Mr.alternate===null&&t(se,He),P=f(Mr,P,it),Tt===null?qe=Mr:Tt.sibling=Mr,Tt=Mr,He=_t}if(At.done)return a(se,He),ht&&Bs(se,it),qe;if(He===null){for(;!At.done;it++,At=ce.next())At=Ne(se,At.value,be),At!==null&&(P=f(At,P,it),Tt===null?qe=At:Tt.sibling=At,Tt=At);return ht&&Bs(se,it),qe}for(He=c(He);!At.done;it++,At=ce.next())At=he(He,se,it,At.value,be),At!==null&&(e&&At.alternate!==null&&He.delete(At.key===null?it:At.key),P=f(At,P,it),Tt===null?qe=At:Tt.sibling=At,Tt=At);return e&&He.forEach(function(Sj){return t(se,Sj)}),ht&&Bs(se,it),qe}function Kt(se,P,ce,be){if(typeof ce=="object"&&ce!==null&&ce.type===C&&ce.key===null&&(ce=ce.props.children),typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case w:e:{for(var qe=ce.key;P!==null;){if(P.key===qe){if(qe=ce.type,qe===C){if(P.tag===7){a(se,P.sibling),be=d(P,ce.props.children),be.return=se,se=be;break e}}else if(P.elementType===qe||typeof qe=="object"&&qe!==null&&qe.$$typeof===ne&&fa(qe)===P.type){a(se,P.sibling),be=d(P,ce.props),ki(be,ce),be.return=se,se=be;break e}a(se,P);break}else t(se,P);P=P.sibling}ce.type===C?(be=Et(ce.props.children,se.mode,be,ce.key),be.return=se,se=be):(be=lc(ce.type,ce.key,ce.props,null,se.mode,be),ki(be,ce),be.return=se,se=be)}return v(se);case k:e:{for(qe=ce.key;P!==null;){if(P.key===qe)if(P.tag===4&&P.stateNode.containerInfo===ce.containerInfo&&P.stateNode.implementation===ce.implementation){a(se,P.sibling),be=d(P,ce.children||[]),be.return=se,se=be;break e}else{a(se,P);break}else t(se,P);P=P.sibling}be=El(ce,se.mode,be),be.return=se,se=be}return v(se);case ne:return ce=fa(ce),Kt(se,P,ce,be)}if(le(ce))return $e(se,P,ce,be);if(V(ce)){if(qe=V(ce),typeof qe!="function")throw Error(r(150));return ce=qe.call(ce),Fe(se,P,ce,be)}if(typeof ce.then=="function")return Kt(se,P,uc(ce),be);if(ce.$$typeof===H)return Kt(se,P,co(se,ce),be);dc(se,ce)}return typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint"?(ce=""+ce,P!==null&&P.tag===6?(a(se,P.sibling),be=d(P,ce),be.return=se,se=be):(a(se,P),be=so(ce,se.mode,be),be.return=se,se=be),v(se)):a(se,P)}return function(se,P,ce,be){try{Ni=0;var qe=Kt(se,P,ce,be);return ji=null,qe}catch(He){if(He===ur||He===cc)throw He;var Tt=gs(29,He,null,se.mode);return Tt.lanes=be,Tt.return=se,Tt}finally{}}}var qa=Eu(!0),sf=Eu(!1),ha=!1;function fc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ho(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 ma(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Gl(e,t,a){var c=e.updateQueue;if(c===null)return null;if(c=c.shared,(Lt&2)!==0){var d=c.pending;return d===null?t.next=t:(t.next=d.next,d.next=t),c.pending=t,t=ar(e),Qd(e,null,a),t}return Jt(e,c,t,a),ar(e)}function hc(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,Os(e,a)}}function mc(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 v={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};f===null?d=f=v:f=f.next=v,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 Cu=!1;function pc(){if(Cu){var e=or;if(e!==null)throw e}}function gc(e,t,a,c){Cu=!1;var d=e.updateQueue;ha=!1;var f=d.firstBaseUpdate,v=d.lastBaseUpdate,S=d.shared.pending;if(S!==null){d.shared.pending=null;var B=S,oe=B.next;B.next=null,v===null?f=oe:v.next=oe,v=B;var xe=e.alternate;xe!==null&&(xe=xe.updateQueue,S=xe.lastBaseUpdate,S!==v&&(S===null?xe.firstBaseUpdate=oe:S.next=oe,xe.lastBaseUpdate=B))}if(f!==null){var Ne=d.baseState;v=0,xe=oe=B=null,S=f;do{var ue=S.lane&-536870913,he=ue!==S.lane;if(he?(xt&ue)===ue:(c&ue)===ue){ue!==0&&ue===cr&&(Cu=!0),xe!==null&&(xe=xe.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var $e=e,Fe=S;ue=t;var Kt=a;switch(Fe.tag){case 1:if($e=Fe.payload,typeof $e=="function"){Ne=$e.call(Kt,Ne,ue);break e}Ne=$e;break e;case 3:$e.flags=$e.flags&-65537|128;case 0:if($e=Fe.payload,ue=typeof $e=="function"?$e.call(Kt,Ne,ue):$e,ue==null)break e;Ne=j({},Ne,ue);break e;case 2:ha=!0}}ue=S.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:S.tag,payload:S.payload,callback:S.callback,next:null},xe===null?(oe=xe=he,B=Ne):xe=xe.next=he,v|=ue;if(S=S.next,S===null){if(S=d.shared.pending,S===null)break;he=S,S=he.next,he.next=null,d.lastBaseUpdate=he,d.shared.pending=null}}while(!0);xe===null&&(B=Ne),d.baseState=B,d.firstBaseUpdate=oe,d.lastBaseUpdate=xe,f===null&&(d.shared.lanes=0),vr|=v,e.lanes=v,e.memoizedState=Ne}}function lf(e,t){if(typeof e!="function")throw Error(r(191,e));e.call(t)}function dr(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)lf(a[e],t)}var wi=A(null),mo=A(0);function Tu(e,t){e=Li,U(mo,e),U(wi,t),Li=e|t.baseLanes}function Au(){U(mo,Li),U(wi,wi.current)}function Mu(){Li=mo.current,F(wi),F(mo)}var tl=A(null),ul=null;function Ga(e){var t=e.alternate;U(Cn,Cn.current&1),U(tl,e),ul===null&&(t===null||wi.current!==null||t.memoizedState!==null)&&(ul=e)}function Ru(e){U(Cn,Cn.current),U(tl,e),ul===null&&(ul=e)}function af(e){e.tag===22?(U(Cn,Cn.current),U(tl,e),ul===null&&(ul=e)):Ya()}function Ya(){U(Cn,Cn.current),U(tl,tl.current)}function nl(e){F(tl),ul===e&&(ul=null),F(Cn)}var Cn=A(0);function po(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Wm(a)||Jm(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 pa=0,Je=null,Ht=null,Bn=null,go=!1,fr=!1,Yl=!1,hr=0,Va=0,mr=null,rf=0;function vn(){throw Error(r(321))}function xo(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!ls(e[a],t[a]))return!1;return!0}function _o(e,t,a,c,d,f){return pa=f,Je=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,L.H=e===null||e.memoizedState===null?ee:ve,Yl=!1,f=a(c,d),Yl=!1,fr&&(f=cf(t,a,c,d)),bo(e),f}function bo(e){L.H=M;var t=Ht!==null&&Ht.next!==null;if(pa=0,Bn=Ht=Je=null,go=!1,Va=0,mr=null,t)throw Error(r(300));e===null||Te||(e=e.dependencies,e!==null&&ro(e)&&(Te=!0))}function cf(e,t,a,c){Je=e;var d=0;do{if(fr&&(mr=null),Va=0,fr=!1,25<=d)throw Error(r(301));if(d+=1,Bn=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)}L.H=Re,f=t(a,c)}while(fr);return f}function um(){var e=L.H,t=e.useState()[0];return t=typeof t.then=="function"?xc(t):t,e=e.useState()[0],(Ht!==null?Ht.memoizedState:null)!==e&&(Je.flags|=1024),t}function Du(){var e=hr!==0;return hr=0,e}function Lu(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function Ou(e){if(go){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}go=!1}pa=0,Bn=Ht=Je=null,fr=!1,Va=hr=0,mr=null}function Ts(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Bn===null?Je.memoizedState=Bn=e:Bn=Bn.next=e,Bn}function Tn(){if(Ht===null){var e=Je.alternate;e=e!==null?e.memoizedState:null}else e=Ht.next;var t=Bn===null?Je.memoizedState:Bn.next;if(t!==null)Bn=t,Ht=e;else{if(e===null)throw Je.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},Bn===null?Je.memoizedState=Bn=e:Bn=Bn.next=e}return Bn}function yo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function xc(e){var t=Va;return Va+=1,mr===null&&(mr=[]),e=tf(mr,e,t),t=Je,(Bn===null?t.memoizedState:Bn.next)===null&&(t=t.alternate,L.H=t===null||t.memoizedState===null?ee:ve),e}function pr(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return xc(e);if(e.$$typeof===H)return rs(e)}throw Error(r(438,String(e)))}function zu(e){var t=null,a=Je.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var c=Je.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=yo(),Je.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]=q;return t.index++,a}function ga(e,t){return typeof t=="function"?t(e):t}function vo(e){var t=Tn();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 v=d.next;d.next=f.next,f.next=v}t.baseQueue=d=f,c.pending=null}if(f=e.baseState,d===null)e.memoizedState=f;else{t=d.next;var S=v=null,B=null,oe=t,xe=!1;do{var Ne=oe.lane&-536870913;if(Ne!==oe.lane?(xt&Ne)===Ne:(pa&Ne)===Ne){var ue=oe.revertLane;if(ue===0)B!==null&&(B=B.next={lane:0,revertLane:0,gesture:null,action:oe.action,hasEagerState:oe.hasEagerState,eagerState:oe.eagerState,next:null}),Ne===cr&&(xe=!0);else if((pa&ue)===ue){oe=oe.next,ue===cr&&(xe=!0);continue}else Ne={lane:0,revertLane:oe.revertLane,gesture:null,action:oe.action,hasEagerState:oe.hasEagerState,eagerState:oe.eagerState,next:null},B===null?(S=B=Ne,v=f):B=B.next=Ne,Je.lanes|=ue,vr|=ue;Ne=oe.action,Yl&&a(f,Ne),f=oe.hasEagerState?oe.eagerState:a(f,Ne)}else ue={lane:Ne,revertLane:oe.revertLane,gesture:oe.gesture,action:oe.action,hasEagerState:oe.hasEagerState,eagerState:oe.eagerState,next:null},B===null?(S=B=ue,v=f):B=B.next=ue,Je.lanes|=Ne,vr|=Ne;oe=oe.next}while(oe!==null&&oe!==t);if(B===null?v=f:B.next=S,!ls(f,e.memoizedState)&&(Te=!0,xe&&(a=or,a!==null)))throw a;e.memoizedState=f,e.baseState=v,e.baseQueue=B,c.lastRenderedState=f}return d===null&&(c.lanes=0),[e.memoizedState,c.dispatch]}function Uu(e){var t=Tn(),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 v=d=d.next;do f=e(f,v.action),v=v.next;while(v!==d);ls(f,t.memoizedState)||(Te=!0),t.memoizedState=f,t.baseQueue===null&&(t.baseState=f),a.lastRenderedState=f}return[f,c]}function of(e,t,a){var c=Je,d=Tn(),f=ht;if(f){if(a===void 0)throw Error(r(407));a=a()}else a=t();var v=!ls((Ht||d).memoizedState,a);if(v&&(d.memoizedState=a,Te=!0),d=d.queue,Xa(Bu.bind(null,c,d,e),[e]),d.getSnapshot!==t||v||Bn!==null&&Bn.memoizedState.tag&1){if(c.flags|=2048,Si(9,{destroy:void 0},$u.bind(null,c,d,a,t),null),tn===null)throw Error(r(349));f||(pa&127)!==0||uf(c,t,a)}return a}function uf(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=Je.updateQueue,t===null?(t=yo(),Je.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function $u(e,t,a,c){t.value=a,t.getSnapshot=c,_c(t)&&dl(e)}function Bu(e,t,a){return a(function(){_c(t)&&dl(e)})}function _c(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!ls(e,a)}catch{return!0}}function dl(e){var t=xi(e,2);t!==null&&gl(t,e,2)}function qs(e){var t=Ts();if(typeof e=="function"){var a=e;if(e=a(),Yl){St(!0);try{a()}finally{St(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ga,lastRenderedState:e},t}function en(e,t,a,c){return e.baseState=a,Iu(e,Ht,typeof c=="function"?c:ga)}function Hu(e,t,a,c,d){if(kc(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(v){f.listeners.push(v)}};L.T!==null?a(!0):f.isTransition=!1,c(f),a=t.pending,a===null?(f.next=t.pending=f,df(t,f)):(f.next=a.next,t.pending=a.next=f)}}function df(e,t){var a=t.action,c=t.payload,d=e.state;if(t.isTransition){var f=L.T,v={};L.T=v;try{var S=a(d,c),B=L.S;B!==null&&B(v,S),ff(e,t,S)}catch(oe){jo(e,t,oe)}finally{f!==null&&v.types!==null&&(f.types=v.types),L.T=f}}else try{f=a(d,c),ff(e,t,f)}catch(oe){jo(e,t,oe)}}function ff(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(c){bc(e,t,c)},function(c){return jo(e,t,c)}):bc(e,t,a)}function bc(e,t,a){t.status="fulfilled",t.value=a,yc(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,df(e,a)))}function jo(e,t,a){var c=e.pending;if(e.pending=null,c!==null){c=c.next;do t.status="rejected",t.reason=a,yc(t),t=t.next;while(t!==c)}e.action=null}function yc(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function gr(e,t){return t}function qu(e,t){if(ht){var a=tn.formState;if(a!==null){e:{var c=Je;if(ht){if(Yt){t:{for(var d=Yt,f=ol;d.nodeType!==8;){if(!f){d=null;break t}if(d=Xl(d.nextSibling),d===null){d=null;break t}}f=d.data,d=f==="F!"||f==="F"?d:null}if(d){Yt=Xl(d.nextSibling),c=d.data==="F!";break e}}Ia(c)}c=!1}c&&(t=a[0])}}return a=Ts(),a.memoizedState=a.baseState=t,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:gr,lastRenderedState:t},a.queue=c,a=Eo.bind(null,Je,c),c.dispatch=a,c=qs(!1),f=Co.bind(null,Je,!1,c.queue),c=Ts(),d={state:t,dispatch:null,action:e,pending:null},c.queue=d,a=Hu.bind(null,Je,d,f,a),d.dispatch=a,c.memoizedState=e,[t,a,!1]}function vc(e){var t=Tn();return Gu(t,Ht,e)}function Gu(e,t,a){if(t=Iu(e,t,gr)[0],e=vo(ga)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var c=xc(t)}catch(v){throw v===ur?cc:v}else c=t;t=Tn();var d=t.queue,f=d.dispatch;return a!==t.memoizedState&&(Je.flags|=2048,Si(9,{destroy:void 0},dm.bind(null,d,a),null)),[c,f,e]}function dm(e,t){e.action=t}function xr(e){var t=Tn(),a=Ht;if(a!==null)return Gu(t,a,e);Tn(),t=t.memoizedState,a=Tn();var c=a.queue.dispatch;return a.memoizedState=e,[t,c,!1]}function Si(e,t,a,c){return e={tag:e,create:a,deps:c,inst:t,next:null},t=Je.updateQueue,t===null&&(t=yo(),Je.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 hf(){return Tn().memoizedState}function Ei(e,t,a,c){var d=Ts();Je.flags|=e,d.memoizedState=Si(1|t,{destroy:void 0},a,c===void 0?null:c)}function No(e,t,a,c){var d=Tn();c=c===void 0?null:c;var f=d.memoizedState.inst;Ht!==null&&c!==null&&xo(c,Ht.memoizedState.deps)?d.memoizedState=Si(t,f,a,c):(Je.flags|=e,d.memoizedState=Si(1|t,f,a,c))}function _r(e,t){Ei(8390656,8,e,t)}function Xa(e,t){No(2048,8,e,t)}function fm(e){Je.flags|=4;var t=Je.updateQueue;if(t===null)t=yo(),Je.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function Yu(e){var t=Tn().memoizedState;return fm({ref:t,nextImpl:e}),function(){if((Lt&2)!==0)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function Vu(e,t){return No(4,2,e,t)}function mf(e,t){return No(4,4,e,t)}function pf(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 Xu(e,t,a){a=a!=null?a.concat([e]):null,No(4,4,pf.bind(null,t,e),a)}function ko(){}function gf(e,t){var a=Tn();t=t===void 0?null:t;var c=a.memoizedState;return t!==null&&xo(t,c[1])?c[0]:(a.memoizedState=[e,t],e)}function xf(e,t){var a=Tn();t=t===void 0?null:t;var c=a.memoizedState;if(t!==null&&xo(t,c[1]))return c[0];if(c=e(),Yl){St(!0);try{e()}finally{St(!1)}}return a.memoizedState=[c,t],c}function Al(e,t,a){return a===void 0||(pa&1073741824)!==0&&(xt&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=wx(),Je.lanes|=e,vr|=e,a)}function _f(e,t,a,c){return ls(a,t)?a:wi.current!==null?(e=Al(e,a,c),ls(e,t)||(Te=!0),e):(pa&42)===0||(pa&1073741824)!==0&&(xt&261930)===0?(Te=!0,e.memoizedState=a):(e=wx(),Je.lanes|=e,vr|=e,t)}function Ml(e,t,a,c,d){var f=z.p;z.p=f!==0&&8>f?f:8;var v=L.T,S={};L.T=S,Co(e,!1,t,a);try{var B=d(),oe=L.S;if(oe!==null&&oe(S,B),B!==null&&typeof B=="object"&&typeof B.then=="function"){var xe=om(B,c);Nc(e,t,xe,Ol(e))}else Nc(e,t,c,Ol(e))}catch(Ne){Nc(e,t,{then:function(){},status:"rejected",reason:Ne},Ol())}finally{z.p=f,v!==null&&S.types!==null&&(v.types=S.types),L.T=v}}function wo(){}function Fu(e,t,a,c){if(e.tag!==5)throw Error(r(476));var d=So(e).queue;Ml(e,d,t,G,a===null?wo:function(){return bf(e),a(c)})}function So(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:G,baseState:G,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ga,lastRenderedState:G},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ga,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function bf(e){var t=So(e);t.next===null&&(t=e.alternate.memoizedState),Nc(e,t.next.queue,{},Ol())}function jc(){return rs(fd)}function Ku(){return Tn().memoizedState}function yf(){return Tn().memoizedState}function hm(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=Ol();e=ma(a);var c=Gl(t,e,a);c!==null&&(gl(c,t,a),hc(c,t,a)),t={cache:ku()},e.payload=t;return}t=t.return}}function Fa(e,t,a){var c=Ol();a={lane:c,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},kc(e)?Qu(t,a):(a=sc(e,t,a,c),a!==null&&(gl(a,e,c),h(a,t,c)))}function Eo(e,t,a){var c=Ol();Nc(e,t,a,c)}function Nc(e,t,a,c){var d={lane:c,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(kc(e))Qu(t,d);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=t.lastRenderedReducer,f!==null))try{var v=t.lastRenderedState,S=f(v,a);if(d.hasEagerState=!0,d.eagerState=S,ls(S,v))return Jt(e,t,d,0),tn===null&&za(),!1}catch{}finally{}if(a=sc(e,t,d,c),a!==null)return gl(a,e,c),h(a,t,c),!0}return!1}function Co(e,t,a,c){if(c={lane:2,revertLane:Bm(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},kc(e)){if(t)throw Error(r(479))}else t=sc(e,a,c,2),t!==null&&gl(t,e,2)}function kc(e){var t=e.alternate;return e===Je||t!==null&&t===Je}function Qu(e,t){fr=go=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function h(e,t,a){if((a&4194048)!==0){var c=t.lanes;c&=e.pendingLanes,a|=c,t.lanes=a,Os(e,a)}}var M={readContext:rs,use:pr,useCallback:vn,useContext:vn,useEffect:vn,useImperativeHandle:vn,useLayoutEffect:vn,useInsertionEffect:vn,useMemo:vn,useReducer:vn,useRef:vn,useState:vn,useDebugValue:vn,useDeferredValue:vn,useTransition:vn,useSyncExternalStore:vn,useId:vn,useHostTransitionStatus:vn,useFormState:vn,useActionState:vn,useOptimistic:vn,useMemoCache:vn,useCacheRefresh:vn};M.useEffectEvent=vn;var ee={readContext:rs,use:pr,useCallback:function(e,t){return Ts().memoizedState=[e,t===void 0?null:t],e},useContext:rs,useEffect:_r,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Ei(4194308,4,pf.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Ei(4194308,4,e,t)},useInsertionEffect:function(e,t){Ei(4,2,e,t)},useMemo:function(e,t){var a=Ts();t=t===void 0?null:t;var c=e();if(Yl){St(!0);try{e()}finally{St(!1)}}return a.memoizedState=[c,t],c},useReducer:function(e,t,a){var c=Ts();if(a!==void 0){var d=a(t);if(Yl){St(!0);try{a(t)}finally{St(!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=Fa.bind(null,Je,e),[c.memoizedState,e]},useRef:function(e){var t=Ts();return e={current:e},t.memoizedState=e},useState:function(e){e=qs(e);var t=e.queue,a=Eo.bind(null,Je,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:ko,useDeferredValue:function(e,t){var a=Ts();return Al(a,e,t)},useTransition:function(){var e=qs(!1);return e=Ml.bind(null,Je,e.queue,!0,!1),Ts().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var c=Je,d=Ts();if(ht){if(a===void 0)throw Error(r(407));a=a()}else{if(a=t(),tn===null)throw Error(r(349));(xt&127)!==0||uf(c,t,a)}d.memoizedState=a;var f={value:a,getSnapshot:t};return d.queue=f,_r(Bu.bind(null,c,f,e),[e]),c.flags|=2048,Si(9,{destroy:void 0},$u.bind(null,c,f,a,t),null),a},useId:function(){var e=Ts(),t=tn.identifierPrefix;if(ht){var a=Cl,c=$s;a=(c&~(1<<32-Dt(c)-1)).toString(32)+a,t="_"+t+"R_"+a,a=hr++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=rf++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:jc,useFormState:qu,useActionState:qu,useOptimistic:function(e){var t=Ts();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=Co.bind(null,Je,!0,a),a.dispatch=t,[e,t]},useMemoCache:zu,useCacheRefresh:function(){return Ts().memoizedState=hm.bind(null,Je)},useEffectEvent:function(e){var t=Ts(),a={impl:e};return t.memoizedState=a,function(){if((Lt&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}},ve={readContext:rs,use:pr,useCallback:gf,useContext:rs,useEffect:Xa,useImperativeHandle:Xu,useInsertionEffect:Vu,useLayoutEffect:mf,useMemo:xf,useReducer:vo,useRef:hf,useState:function(){return vo(ga)},useDebugValue:ko,useDeferredValue:function(e,t){var a=Tn();return _f(a,Ht.memoizedState,e,t)},useTransition:function(){var e=vo(ga)[0],t=Tn().memoizedState;return[typeof e=="boolean"?e:xc(e),t]},useSyncExternalStore:of,useId:Ku,useHostTransitionStatus:jc,useFormState:vc,useActionState:vc,useOptimistic:function(e,t){var a=Tn();return en(a,Ht,e,t)},useMemoCache:zu,useCacheRefresh:yf};ve.useEffectEvent=Yu;var Re={readContext:rs,use:pr,useCallback:gf,useContext:rs,useEffect:Xa,useImperativeHandle:Xu,useInsertionEffect:Vu,useLayoutEffect:mf,useMemo:xf,useReducer:Uu,useRef:hf,useState:function(){return Uu(ga)},useDebugValue:ko,useDeferredValue:function(e,t){var a=Tn();return Ht===null?Al(a,e,t):_f(a,Ht.memoizedState,e,t)},useTransition:function(){var e=Uu(ga)[0],t=Tn().memoizedState;return[typeof e=="boolean"?e:xc(e),t]},useSyncExternalStore:of,useId:Ku,useHostTransitionStatus:jc,useFormState:xr,useActionState:xr,useOptimistic:function(e,t){var a=Tn();return Ht!==null?en(a,Ht,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:zu,useCacheRefresh:yf};Re.useEffectEvent=Yu;function at(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 Ct={enqueueSetState:function(e,t,a){e=e._reactInternals;var c=Ol(),d=ma(c);d.payload=t,a!=null&&(d.callback=a),t=Gl(e,d,c),t!==null&&(gl(t,e,c),hc(t,e,c))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var c=Ol(),d=ma(c);d.tag=1,d.payload=t,a!=null&&(d.callback=a),t=Gl(e,d,c),t!==null&&(gl(t,e,c),hc(t,e,c))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=Ol(),c=ma(a);c.tag=2,t!=null&&(c.callback=t),t=Gl(e,c,a),t!==null&&(gl(t,e,a),hc(t,e,a))}};function cs(e,t,a,c,d,f,v){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(c,f,v):t.prototype&&t.prototype.isPureReactComponent?!Wr(a,c)||!Wr(d,f):!0}function xa(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&&Ct.enqueueReplaceState(t,t.state,null)}function As(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 Rl(e){rl(e)}function _a(e){console.error(e)}function ba(e){rl(e)}function Vl(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(c){setTimeout(function(){throw c})}}function _s(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 ya(e,t,a){return a=ma(a),a.tag=3,a.payload={element:null},a.callback=function(){Vl(e,t)},a}function Zu(e){return e=ma(e),e.tag=3,e}function _e(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(){_s(t,a,c)}}var v=a.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(e.callback=function(){_s(t,a,c),typeof d!="function"&&(jr===null?jr=new Set([this]):jr.add(this));var S=c.stack;this.componentDidCatch(c.value,{componentStack:S!==null?S:""})})}function we(e,t,a,c,d){if(a.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(t=a.alternate,t!==null&&rr(t,a,d,!0),a=tl.current,a!==null){switch(a.tag){case 31:case 13:return ul===null?Rf():a.alternate===null&&Hn===0&&(Hn=3),a.flags&=-257,a.flags|=65536,a.lanes=d,c===oc?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([c]):t.add(c),Im(e,c,d)),!1;case 22:return a.flags|=65536,c===oc?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)),Im(e,c,d)),!1}throw Error(r(435,a.tag))}return Im(e,c,d),Rf(),!1}if(ht)return t=tl.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=d,c!==ju&&(e=Error(r(422),{cause:c}),Ua(Cs(e,a)))):(c!==ju&&(t=Error(r(423),{cause:c}),Ua(Cs(t,a))),e=e.current.alternate,e.flags|=65536,d&=-d,e.lanes|=d,c=Cs(c,a),d=ya(e.stateNode,c,d),mc(e,d),Hn!==4&&(Hn=2)),!1;var f=Error(r(520),{cause:c});if(f=Cs(f,a),ld===null?ld=[f]:ld.push(f),Hn!==4&&(Hn=2),t===null)return!0;c=Cs(c,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=d&-d,a.lanes|=e,e=ya(a.stateNode,c,e),mc(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"&&(jr===null||!jr.has(f))))return a.flags|=65536,d&=-d,a.lanes|=d,d=Zu(d),_e(d,e,a,c),mc(a,d),!1}a=a.return}while(a!==null);return!1}var ze=Error(r(461)),Te=!1;function Ue(e,t,a,c){t.child=e===null?sf(t,null,a,c):qa(t,e.child,a,c)}function qt(e,t,a,c,d){a=a.render;var f=t.ref;if("ref"in c){var v={};for(var S in c)S!=="ref"&&(v[S]=c[S])}else v=c;return yi(t),c=_o(e,t,a,v,f,d),S=Du(),e!==null&&!Te?(Lu(e,t,d),Ci(e,t,d)):(ht&&S&&vu(t),t.flags|=1,Ue(e,t,c,d),t.child)}function To(e,t,a,c,d){if(e===null){var f=a.type;return typeof f=="function"&&!_i(f)&&f.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=f,Xg(e,t,f,c,d)):(e=lc(a.type,null,c,t,t.mode,d),e.ref=t.ref,e.return=t,t.child=e)}if(f=e.child,!vm(e,d)){var v=f.memoizedProps;if(a=a.compare,a=a!==null?a:Wr,a(v,c)&&e.ref===t.ref)return Ci(e,t,d)}return t.flags|=1,e=Js(f,c),e.ref=t.ref,e.return=t,t.child=e}function Xg(e,t,a,c,d){if(e!==null){var f=e.memoizedProps;if(Wr(f,c)&&e.ref===t.ref)if(Te=!1,t.pendingProps=c=f,vm(e,d))(e.flags&131072)!==0&&(Te=!0);else return t.lanes=e.lanes,Ci(e,t,d)}return mm(e,t,a,c,d)}function Fg(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 Kg(e,t,f,a,c)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ql(t,f!==null?f.cachePool:null),f!==null?Tu(t,f):Au(),af(t);else return c=t.lanes=536870912,Kg(e,t,f!==null?f.baseLanes|a:a,a,c)}else f!==null?(ql(t,f.cachePool),Tu(t,f),Ya(),t.memoizedState=null):(e!==null&&ql(t,null),Au(),Ya());return Ue(e,t,d,a),t.child}function Pu(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Kg(e,t,a,c,d){var f=Su();return f=f===null?null:{parent:$n._currentValue,pool:f},t.memoizedState={baseLanes:a,cachePool:f},e!==null&&ql(t,null),Au(),af(t),e!==null&&rr(e,t,c,!0),t.childLanes=d,null}function vf(e,t){return t=Nf({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Qg(e,t,a){return qa(t,e.child,null,a),e=vf(t,t.pendingProps),e.flags|=2,nl(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(ht){if(c.mode==="hidden")return e=vf(t,c),t.lanes=536870912,Pu(null,e);if(Ru(t),(e=Yt)?(e=r_(e,ol),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:cl!==null?{id:$s,overflow:Cl}:null,retryLane:536870912,hydrationErrors:null},a=_u(e),a.return=t,t.child=a,yn=t,Yt=null)):e=null,e===null)throw Ia(t);return t.lanes=536870912,null}return vf(t,c)}var f=e.memoizedState;if(f!==null){var v=f.dehydrated;if(Ru(t),d)if(t.flags&256)t.flags&=-257,t=Qg(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(r(558));else if(Te||rr(e,t,a,!1),d=(a&e.childLanes)!==0,Te||d){if(c=tn,c!==null&&(v=sn(c,a),v!==0&&v!==f.retryLane))throw f.retryLane=v,xi(e,v),gl(c,e,v),ze;Rf(),t=Qg(e,t,a)}else e=f.treeContext,Yt=Xl(v.nextSibling),yn=t,ht=!0,Tl=null,ol=!1,e!==null&&Zd(t,e),t=vf(t,c),t.flags|=4096;return t}return e=Js(e.child,{mode:c.mode,children:c.children}),e.ref=t.ref,t.child=e,e.return=t,e}function jf(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 mm(e,t,a,c,d){return yi(t),a=_o(e,t,a,c,void 0,d),c=Du(),e!==null&&!Te?(Lu(e,t,d),Ci(e,t,d)):(ht&&c&&vu(t),t.flags|=1,Ue(e,t,a,d),t.child)}function Zg(e,t,a,c,d,f){return yi(t),t.updateQueue=null,a=cf(t,c,a,d),bo(e),c=Du(),e!==null&&!Te?(Lu(e,t,f),Ci(e,t,f)):(ht&&c&&vu(t),t.flags|=1,Ue(e,t,a,f),t.child)}function Pg(e,t,a,c,d){if(yi(t),t.stateNode===null){var f=ua,v=a.contextType;typeof v=="object"&&v!==null&&(f=rs(v)),f=new a(c,f),t.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=Ct,t.stateNode=f,f._reactInternals=t,f=t.stateNode,f.props=c,f.state=t.memoizedState,f.refs={},fc(t),v=a.contextType,f.context=typeof v=="object"&&v!==null?rs(v):ua,f.state=t.memoizedState,v=a.getDerivedStateFromProps,typeof v=="function"&&(at(t,a,v,c),f.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(v=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),v!==f.state&&Ct.enqueueReplaceState(f,f.state,null),gc(t,c,f,d),pc(),f.state=t.memoizedState),typeof f.componentDidMount=="function"&&(t.flags|=4194308),c=!0}else if(e===null){f=t.stateNode;var S=t.memoizedProps,B=As(a,S);f.props=B;var oe=f.context,xe=a.contextType;v=ua,typeof xe=="object"&&xe!==null&&(v=rs(xe));var Ne=a.getDerivedStateFromProps;xe=typeof Ne=="function"||typeof f.getSnapshotBeforeUpdate=="function",S=t.pendingProps!==S,xe||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(S||oe!==v)&&xa(t,f,c,v),ha=!1;var ue=t.memoizedState;f.state=ue,gc(t,c,f,d),pc(),oe=t.memoizedState,S||ue!==oe||ha?(typeof Ne=="function"&&(at(t,a,Ne,c),oe=t.memoizedState),(B=ha||cs(t,a,B,c,ue,oe,v))?(xe||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=oe),f.props=c,f.state=oe,f.context=v,c=B):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),c=!1)}else{f=t.stateNode,ho(e,t),v=t.memoizedProps,xe=As(a,v),f.props=xe,Ne=t.pendingProps,ue=f.context,oe=a.contextType,B=ua,typeof oe=="object"&&oe!==null&&(B=rs(oe)),S=a.getDerivedStateFromProps,(oe=typeof S=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(v!==Ne||ue!==B)&&xa(t,f,c,B),ha=!1,ue=t.memoizedState,f.state=ue,gc(t,c,f,d),pc();var he=t.memoizedState;v!==Ne||ue!==he||ha||e!==null&&e.dependencies!==null&&ro(e.dependencies)?(typeof S=="function"&&(at(t,a,S,c),he=t.memoizedState),(xe=ha||cs(t,a,xe,c,ue,he,B)||e!==null&&e.dependencies!==null&&ro(e.dependencies))?(oe||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(c,he,B),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(c,he,B)),typeof f.componentDidUpdate=="function"&&(t.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof f.componentDidUpdate!="function"||v===e.memoizedProps&&ue===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||v===e.memoizedProps&&ue===e.memoizedState||(t.flags|=1024),t.memoizedProps=c,t.memoizedState=he),f.props=c,f.state=he,f.context=B,c=xe):(typeof f.componentDidUpdate!="function"||v===e.memoizedProps&&ue===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||v===e.memoizedProps&&ue===e.memoizedState||(t.flags|=1024),c=!1)}return f=c,jf(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=qa(t,e.child,null,d),t.child=qa(t,null,a,d)):Ue(e,t,a,d),t.memoizedState=f.state,e=t.child):e=Ci(e,t,d),e}function Wg(e,t,a,c){return is(),t.flags|=256,Ue(e,t,a,c),t.child}var pm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function gm(e){return{baseLanes:e,cachePool:Jd()}}function xm(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=Ll),e}function Jg(e,t,a){var c=t.pendingProps,d=!1,f=(t.flags&128)!==0,v;if((v=f)||(v=e!==null&&e.memoizedState===null?!1:(Cn.current&2)!==0),v&&(d=!0,t.flags&=-129),v=(t.flags&32)!==0,t.flags&=-33,e===null){if(ht){if(d?Ga(t):Ya(),(e=Yt)?(e=r_(e,ol),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:cl!==null?{id:$s,overflow:Cl}:null,retryLane:536870912,hydrationErrors:null},a=_u(e),a.return=t,t.child=a,yn=t,Yt=null)):e=null,e===null)throw Ia(t);return Jm(e)?t.lanes=32:t.lanes=536870912,null}var S=c.children;return c=c.fallback,d?(Ya(),d=t.mode,S=Nf({mode:"hidden",children:S},d),c=Et(c,d,a,null),S.return=t,c.return=t,S.sibling=c,t.child=S,c=t.child,c.memoizedState=gm(a),c.childLanes=xm(e,v,a),t.memoizedState=pm,Pu(null,c)):(Ga(t),_m(t,S))}var B=e.memoizedState;if(B!==null&&(S=B.dehydrated,S!==null)){if(f)t.flags&256?(Ga(t),t.flags&=-257,t=bm(e,t,a)):t.memoizedState!==null?(Ya(),t.child=e.child,t.flags|=128,t=null):(Ya(),S=c.fallback,d=t.mode,c=Nf({mode:"visible",children:c.children},d),S=Et(S,d,a,null),S.flags|=2,c.return=t,S.return=t,c.sibling=S,t.child=c,qa(t,e.child,null,a),c=t.child,c.memoizedState=gm(a),c.childLanes=xm(e,v,a),t.memoizedState=pm,t=Pu(null,c));else if(Ga(t),Jm(S)){if(v=S.nextSibling&&S.nextSibling.dataset,v)var oe=v.dgst;v=oe,c=Error(r(419)),c.stack="",c.digest=v,Ua({value:c,source:null,stack:null}),t=bm(e,t,a)}else if(Te||rr(e,t,a,!1),v=(a&e.childLanes)!==0,Te||v){if(v=tn,v!==null&&(c=sn(v,a),c!==0&&c!==B.retryLane))throw B.retryLane=c,xi(e,c),gl(v,e,c),ze;Wm(S)||Rf(),t=bm(e,t,a)}else Wm(S)?(t.flags|=192,t.child=e.child,t=null):(e=B.treeContext,Yt=Xl(S.nextSibling),yn=t,ht=!0,Tl=null,ol=!1,e!==null&&Zd(t,e),t=_m(t,c.children),t.flags|=4096);return t}return d?(Ya(),S=c.fallback,d=t.mode,B=e.child,oe=B.sibling,c=Js(B,{mode:"hidden",children:c.children}),c.subtreeFlags=B.subtreeFlags&65011712,oe!==null?S=Js(oe,S):(S=Et(S,d,a,null),S.flags|=2),S.return=t,c.return=t,c.sibling=S,t.child=c,Pu(null,c),c=t.child,S=e.child.memoizedState,S===null?S=gm(a):(d=S.cachePool,d!==null?(B=$n._currentValue,d=d.parent!==B?{parent:B,pool:B}:d):d=Jd(),S={baseLanes:S.baseLanes|a,cachePool:d}),c.memoizedState=S,c.childLanes=xm(e,v,a),t.memoizedState=pm,Pu(e.child,c)):(Ga(t),a=e.child,e=a.sibling,a=Js(a,{mode:"visible",children:c.children}),a.return=t,a.sibling=null,e!==null&&(v=t.deletions,v===null?(t.deletions=[e],t.flags|=16):v.push(e)),t.child=a,t.memoizedState=null,a)}function _m(e,t){return t=Nf({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Nf(e,t){return e=gs(22,e,null,t),e.lanes=0,e}function bm(e,t,a){return qa(t,e.child,null,a),e=_m(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function ex(e,t,a){e.lanes|=t;var c=e.alternate;c!==null&&(c.lanes|=t),Nu(e.return,t,a)}function ym(e,t,a,c,d,f){var v=e.memoizedState;v===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:c,tail:a,tailMode:d,treeForkCount:f}:(v.isBackwards=t,v.rendering=null,v.renderingStartTime=0,v.last=c,v.tail=a,v.tailMode=d,v.treeForkCount=f)}function tx(e,t,a){var c=t.pendingProps,d=c.revealOrder,f=c.tail;c=c.children;var v=Cn.current,S=(v&2)!==0;if(S?(v=v&1|2,t.flags|=128):v&=1,U(Cn,v),Ue(e,t,c,a),c=ht?ir:0,!S&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ex(e,a,t);else if(e.tag===19)ex(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&&po(e)===null&&(d=a),a=a.sibling;a=d,a===null?(d=t.child,t.child=null):(d=a.sibling,a.sibling=null),ym(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&&po(e)===null){t.child=d;break}e=d.sibling,d.sibling=a,a=d,d=e}ym(t,!0,a,null,f,c);break;case"together":ym(t,!1,null,null,void 0,c);break;default:t.memoizedState=null}return t.child}function Ci(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),vr|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(rr(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=Js(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=Js(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function vm(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&ro(e)))}function Sv(e,t,a){switch(t.tag){case 3:lt(t,t.stateNode.containerInfo),$a(t,$n,e.memoizedState.cache),is();break;case 27:case 5:Be(t);break;case 4:lt(t,t.stateNode.containerInfo);break;case 10:$a(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Ru(t),null;break;case 13:var c=t.memoizedState;if(c!==null)return c.dehydrated!==null?(Ga(t),t.flags|=128,null):(a&t.child.childLanes)!==0?Jg(e,t,a):(Ga(t),e=Ci(e,t,a),e!==null?e.sibling:null);Ga(t);break;case 19:var d=(e.flags&128)!==0;if(c=(a&t.childLanes)!==0,c||(rr(e,t,a,!1),c=(a&t.childLanes)!==0),d){if(c)return tx(e,t,a);t.flags|=128}if(d=t.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),U(Cn,Cn.current),c)break;return null;case 22:return t.lanes=0,Fg(e,t,a,t.pendingProps);case 24:$a(t,$n,e.memoizedState.cache)}return Ci(e,t,a)}function nx(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)Te=!0;else{if(!vm(e,a)&&(t.flags&128)===0)return Te=!1,Sv(e,t,a);Te=(e.flags&131072)!==0}else Te=!1,ht&&(t.flags&1048576)!==0&&yu(t,ir,t.index);switch(t.lanes=0,t.tag){case 16:e:{var c=t.pendingProps;if(e=fa(t.elementType),t.type=e,typeof e=="function")_i(e)?(c=As(e,c),t.tag=1,t=Pg(null,t,e,c,a)):(t.tag=0,t=mm(null,t,e,c,a));else{if(e!=null){var d=e.$$typeof;if(d===te){t.tag=11,t=qt(null,t,e,c,a);break e}else if(d===$){t.tag=14,t=To(null,t,e,c,a);break e}}throw t=J(e)||e,Error(r(306,t,""))}}return t;case 0:return mm(e,t,t.type,t.pendingProps,a);case 1:return c=t.type,d=As(c,t.pendingProps),Pg(e,t,c,d,a);case 3:e:{if(lt(t,t.stateNode.containerInfo),e===null)throw Error(r(387));c=t.pendingProps;var f=t.memoizedState;d=f.element,ho(e,t),gc(t,c,null,a);var v=t.memoizedState;if(c=v.cache,$a(t,$n,c),c!==f.cache&&hn(t,[$n],a,!0),pc(),c=v.element,f.isDehydrated)if(f={element:c,isDehydrated:!1,cache:v.cache},t.updateQueue.baseState=f,t.memoizedState=f,t.flags&256){t=Wg(e,t,c,a);break e}else if(c!==d){d=Cs(Error(r(424)),t),Ua(d),t=Wg(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(Yt=Xl(e.firstChild),yn=t,ht=!0,Tl=null,ol=!0,a=sf(t,null,c,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(is(),c===d){t=Ci(e,t,a);break e}Ue(e,t,c,a)}t=t.child}return t;case 26:return jf(e,t),e===null?(a=h_(t.type,null,t.pendingProps,null))?t.memoizedState=a:ht||(a=t.type,e=t.pendingProps,c=$f(fe.current).createElement(a),c[yt]=t,c[un]=e,Ms(c,a,e),Ie(c),t.stateNode=c):t.memoizedState=h_(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Be(t),e===null&&ht&&(c=t.stateNode=u_(t.type,t.pendingProps,fe.current),yn=t,ol=!0,d=Yt,Sr(t.type)?(ep=d,Yt=Xl(c.firstChild)):Yt=d),Ue(e,t,t.pendingProps.children,a),jf(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ht&&((d=c=Yt)&&(c=nj(c,t.type,t.pendingProps,ol),c!==null?(t.stateNode=c,yn=t,Yt=Xl(c.firstChild),ol=!1,d=!0):d=!1),d||Ia(t)),Be(t),d=t.type,f=t.pendingProps,v=e!==null?e.memoizedProps:null,c=f.children,Qm(d,f)?c=null:v!==null&&Qm(d,v)&&(t.flags|=32),t.memoizedState!==null&&(d=_o(e,t,um,null,null,a),fd._currentValue=d),jf(e,t),Ue(e,t,c,a),t.child;case 6:return e===null&&ht&&((e=a=Yt)&&(a=sj(a,t.pendingProps,ol),a!==null?(t.stateNode=a,yn=t,Yt=null,e=!0):e=!1),e||Ia(t)),null;case 13:return Jg(e,t,a);case 4:return lt(t,t.stateNode.containerInfo),c=t.pendingProps,e===null?t.child=qa(t,null,c,a):Ue(e,t,c,a),t.child;case 11:return qt(e,t,t.type,t.pendingProps,a);case 7:return Ue(e,t,t.pendingProps,a),t.child;case 8:return Ue(e,t,t.pendingProps.children,a),t.child;case 12:return Ue(e,t,t.pendingProps.children,a),t.child;case 10:return c=t.pendingProps,$a(t,t.type,c.value),Ue(e,t,c.children,a),t.child;case 9:return d=t.type._context,c=t.pendingProps.children,yi(t),d=rs(d),c=c(d),t.flags|=1,Ue(e,t,c,a),t.child;case 14:return To(e,t,t.type,t.pendingProps,a);case 15:return Xg(e,t,t.type,t.pendingProps,a);case 19:return tx(e,t,a);case 31:return wv(e,t,a);case 22:return Fg(e,t,a,t.pendingProps);case 24:return yi(t),c=rs($n),e===null?(d=Su(),d===null&&(d=tn,f=ku(),d.pooledCache=f,f.refCount++,f!==null&&(d.pooledCacheLanes|=a),d=f),t.memoizedState={parent:c,cache:d},fc(t),$a(t,$n,d)):((e.lanes&a)!==0&&(ho(e,t),gc(t,null,null,a),pc()),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),$a(t,$n,c)):(c=f.cache,$a(t,$n,c),c!==d.cache&&hn(t,[$n],a,!0))),Ue(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(r(156,t.tag))}function Ti(e){e.flags|=4}function jm(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(Tx())e.flags|=8192;else throw Ha=oc,uo}else e.flags&=-16777217}function sx(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!__(t))if(Tx())e.flags|=8192;else throw Ha=oc,uo}function kf(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Dn():536870912,e.lanes|=t,Do|=t)}function Wu(e,t){if(!ht)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 mn(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(ae(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return mn(t),null;case 1:return mn(t),null;case 3:return a=t.stateNode,c=null,e!==null&&(c=e.memoizedState.cache),t.memoizedState.cache!==c&&(t.flags|=2048),Hl($n),ke(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Hs(t)?Ti(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,ao())),mn(t),null;case 26:var d=t.type,f=t.memoizedState;return e===null?(Ti(t),f!==null?(mn(t),sx(t,f)):(mn(t),jm(t,d,null,c,a))):f?f!==e.memoizedState?(Ti(t),mn(t),sx(t,f)):(mn(t),t.flags&=-16777217):(e=e.memoizedProps,e!==c&&Ti(t),mn(t),jm(t,d,e,c,a)),null;case 27:if(Ye(t),a=fe.current,d=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==c&&Ti(t);else{if(!c){if(t.stateNode===null)throw Error(r(166));return mn(t),null}e=ye.current,Hs(t)?X(t):(e=u_(d,c,a),t.stateNode=e,Ti(t))}return mn(t),null;case 5:if(Ye(t),d=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==c&&Ti(t);else{if(!c){if(t.stateNode===null)throw Error(r(166));return mn(t),null}if(f=ye.current,Hs(t))X(t);else{var v=$f(fe.current);switch(f){case 1:f=v.createElementNS("http://www.w3.org/2000/svg",d);break;case 2:f=v.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;default:switch(d){case"svg":f=v.createElementNS("http://www.w3.org/2000/svg",d);break;case"math":f=v.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;case"script":f=v.createElement("div"),f.innerHTML="<script><\/script>",f=f.removeChild(f.firstChild);break;case"select":f=typeof c.is=="string"?v.createElement("select",{is:c.is}):v.createElement("select"),c.multiple?f.multiple=!0:c.size&&(f.size=c.size);break;default:f=typeof c.is=="string"?v.createElement(d,{is:c.is}):v.createElement(d)}}f[yt]=t,f[un]=c;e:for(v=t.child;v!==null;){if(v.tag===5||v.tag===6)f.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===t)break e;for(;v.sibling===null;){if(v.return===null||v.return===t)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}t.stateNode=f;e:switch(Ms(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&&Ti(t)}}return mn(t),jm(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==c&&Ti(t);else{if(typeof c!="string"&&t.stateNode===null)throw Error(r(166));if(e=fe.current,Hs(t)){if(e=t.stateNode,a=t.memoizedProps,c=null,d=yn,d!==null)switch(d.tag){case 27:case 5:c=d.memoizedProps}e[yt]=t,e=!!(e.nodeValue===a||c!==null&&c.suppressHydrationWarning===!0||Jx(e.nodeValue,a)),e||Ia(t,!0)}else e=$f(e).createTextNode(c),e[yt]=t,t.stateNode=e}return mn(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(c=Hs(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[yt]=t}else is(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;mn(t),e=!1}else a=ao(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(nl(t),t):(nl(t),null);if((t.flags&128)!==0)throw Error(r(558))}return mn(t),null;case 13:if(c=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(d=Hs(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[yt]=t}else is(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;mn(t),d=!1}else d=ao(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=d),d=!0;if(!d)return t.flags&256?(nl(t),t):(nl(t),null)}return nl(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),kf(t,t.updateQueue),mn(t),null);case 4:return ke(),e===null&&Ym(t.stateNode.containerInfo),mn(t),null;case 10:return Hl(t.type),mn(t),null;case 19:if(F(Cn),c=t.memoizedState,c===null)return mn(t),null;if(d=(t.flags&128)!==0,f=c.rendering,f===null)if(d)Wu(c,!1);else{if(Hn!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(f=po(e),f!==null){for(t.flags|=128,Wu(c,!1),e=f.updateQueue,t.updateQueue=e,kf(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)Sl(a,e),a=a.sibling;return U(Cn,Cn.current&1|2),ht&&Bs(t,c.treeForkCount),t.child}e=e.sibling}c.tail!==null&&ot()>Tf&&(t.flags|=128,d=!0,Wu(c,!1),t.lanes=4194304)}else{if(!d)if(e=po(f),e!==null){if(t.flags|=128,d=!0,e=e.updateQueue,t.updateQueue=e,kf(t,e),Wu(c,!0),c.tail===null&&c.tailMode==="hidden"&&!f.alternate&&!ht)return mn(t),null}else 2*ot()-c.renderingStartTime>Tf&&a!==536870912&&(t.flags|=128,d=!0,Wu(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=ot(),e.sibling=null,a=Cn.current,U(Cn,d?a&1|2:a&1),ht&&Bs(t,c.treeForkCount),e):(mn(t),null);case 22:case 23:return nl(t),Mu(),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&&(mn(t),t.subtreeFlags&6&&(t.flags|=8192)):mn(t),a=t.updateQueue,a!==null&&kf(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&&F(vi),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Hl($n),mn(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function Cv(e,t){switch(ae(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Hl($n),ke(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ye(t),null;case 31:if(t.memoizedState!==null){if(nl(t),t.alternate===null)throw Error(r(340));is()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(nl(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));is()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return F(Cn),null;case 4:return ke(),null;case 10:return Hl(t.type),null;case 22:case 23:return nl(t),Mu(),e!==null&&F(vi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Hl($n),null;case 25:return null;default:return null}}function lx(e,t){switch(ae(t),t.tag){case 3:Hl($n),ke();break;case 26:case 27:case 5:Ye(t);break;case 4:ke();break;case 31:t.memoizedState!==null&&nl(t);break;case 13:nl(t);break;case 19:F(Cn);break;case 10:Hl(t.type);break;case 22:case 23:nl(t),Mu(),e!==null&&F(vi);break;case 24:Hl($n)}}function Ju(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,v=a.inst;c=f(),v.destroy=c}a=a.next}while(a!==d)}}catch(S){Xt(t,t.return,S)}}function br(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 v=c.inst,S=v.destroy;if(S!==void 0){v.destroy=void 0,d=t;var B=a,oe=S;try{oe()}catch(xe){Xt(d,B,xe)}}}c=c.next}while(c!==f)}}catch(xe){Xt(t,t.return,xe)}}function ax(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{dr(t,a)}catch(c){Xt(e,e.return,c)}}}function ix(e,t,a){a.props=As(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(c){Xt(e,t,c)}}function ed(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 Ka(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 rx(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 Nm(e,t,a){try{var c=e.stateNode;Zv(c,e.type,a,t),c[un]=t}catch(d){Xt(e,e.return,d)}}function cx(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Sr(e.type)||e.tag===4}function km(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||cx(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&&Sr(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 wm(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=dt));else if(c!==4&&(c===27&&Sr(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(wm(e,t,a),e=e.sibling;e!==null;)wm(e,t,a),e=e.sibling}function wf(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&&Sr(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(wf(e,t,a),e=e.sibling;e!==null;)wf(e,t,a),e=e.sibling}function ox(e){var t=e.stateNode,a=e.memoizedProps;try{for(var c=e.type,d=t.attributes;d.length;)t.removeAttributeNode(d[0]);Ms(t,c,a),t[yt]=e,t[un]=a}catch(f){Xt(e,e.return,f)}}var Ai=!1,Pn=!1,Sm=!1,ux=typeof WeakSet=="function"?WeakSet:Set,bs=null;function Tv(e,t){if(e=e.containerInfo,Fm=Xf,e=pu(e),tr(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 v=0,S=-1,B=-1,oe=0,xe=0,Ne=e,ue=null;t:for(;;){for(var he;Ne!==a||d!==0&&Ne.nodeType!==3||(S=v+d),Ne!==f||c!==0&&Ne.nodeType!==3||(B=v+c),Ne.nodeType===3&&(v+=Ne.nodeValue.length),(he=Ne.firstChild)!==null;)ue=Ne,Ne=he;for(;;){if(Ne===e)break t;if(ue===a&&++oe===d&&(S=v),ue===f&&++xe===c&&(B=v),(he=Ne.nextSibling)!==null)break;Ne=ue,ue=Ne.parentNode}Ne=he}a=S===-1||B===-1?null:{start:S,end:B}}else a=null}a=a||{start:0,end:0}}else a=null;for(Km={focusedElem:e,selectionRange:a},Xf=!1,bs=t;bs!==null;)if(t=bs,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,bs=e;else for(;bs!==null;){switch(t=bs,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=As(a.type,d);e=c.getSnapshotBeforeUpdate($e,f),c.__reactInternalSnapshotBeforeUpdate=e}catch(Fe){Xt(a,a.return,Fe)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)Pm(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Pm(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,bs=e;break}bs=t.return}}function dx(e,t,a){var c=a.flags;switch(a.tag){case 0:case 11:case 15:Ri(e,a),c&4&&Ju(5,a);break;case 1:if(Ri(e,a),c&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(v){Xt(a,a.return,v)}else{var d=As(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(d,t,e.__reactInternalSnapshotBeforeUpdate)}catch(v){Xt(a,a.return,v)}}c&64&&ax(a),c&512&&ed(a,a.return);break;case 3:if(Ri(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{dr(e,t)}catch(v){Xt(a,a.return,v)}}break;case 27:t===null&&c&4&&ox(a);case 26:case 5:Ri(e,a),t===null&&c&4&&rx(a),c&512&&ed(a,a.return);break;case 12:Ri(e,a);break;case 31:Ri(e,a),c&4&&mx(e,a);break;case 13:Ri(e,a),c&4&&px(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||Ai,!c){t=t!==null&&t.memoizedState!==null||Pn,d=Ai;var f=Pn;Ai=c,(Pn=t)&&!f?Di(e,a,(a.subtreeFlags&8772)!==0):Ri(e,a),Ai=d,Pn=f}break;case 30:break;default:Ri(e,a)}}function fx(e){var t=e.alternate;t!==null&&(e.alternate=null,fx(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&zs(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 jn=null,fl=!1;function Mi(e,t,a){for(a=a.child;a!==null;)hx(e,t,a),a=a.sibling}function hx(e,t,a){if(Zt&&typeof Zt.onCommitFiberUnmount=="function")try{Zt.onCommitFiberUnmount(nn,a)}catch{}switch(a.tag){case 26:Pn||Ka(a,t),Mi(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Pn||Ka(a,t);var c=jn,d=fl;Sr(a.type)&&(jn=a.stateNode,fl=!1),Mi(e,t,a),od(a.stateNode),jn=c,fl=d;break;case 5:Pn||Ka(a,t);case 6:if(c=jn,d=fl,jn=null,Mi(e,t,a),jn=c,fl=d,jn!==null)if(fl)try{(jn.nodeType===9?jn.body:jn.nodeName==="HTML"?jn.ownerDocument.body:jn).removeChild(a.stateNode)}catch(f){Xt(a,t,f)}else try{jn.removeChild(a.stateNode)}catch(f){Xt(a,t,f)}break;case 18:jn!==null&&(fl?(e=jn,a_(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),Ho(e)):a_(jn,a.stateNode));break;case 4:c=jn,d=fl,jn=a.stateNode.containerInfo,fl=!0,Mi(e,t,a),jn=c,fl=d;break;case 0:case 11:case 14:case 15:br(2,a,t),Pn||br(4,a,t),Mi(e,t,a);break;case 1:Pn||(Ka(a,t),c=a.stateNode,typeof c.componentWillUnmount=="function"&&ix(a,t,c)),Mi(e,t,a);break;case 21:Mi(e,t,a);break;case 22:Pn=(c=Pn)||a.memoizedState!==null,Mi(e,t,a),Pn=c;break;default:Mi(e,t,a)}}function mx(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ho(e)}catch(a){Xt(t,t.return,a)}}}function px(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ho(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 ux),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new ux),t;default:throw Error(r(435,e.tag))}}function Sf(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 hl(e,t){var a=t.deletions;if(a!==null)for(var c=0;c<a.length;c++){var d=a[c],f=e,v=t,S=v;e:for(;S!==null;){switch(S.tag){case 27:if(Sr(S.type)){jn=S.stateNode,fl=!1;break e}break;case 5:jn=S.stateNode,fl=!1;break e;case 3:case 4:jn=S.stateNode.containerInfo,fl=!0;break e}S=S.return}if(jn===null)throw Error(r(160));hx(f,v,d),jn=null,fl=!1,f=d.alternate,f!==null&&(f.return=null),d.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)gx(t,e),t=t.sibling}var va=null;function gx(e,t){var a=e.alternate,c=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:hl(t,e),ml(e),c&4&&(br(3,e,e.return),Ju(3,e),br(5,e,e.return));break;case 1:hl(t,e),ml(e),c&512&&(Pn||a===null||Ka(a,a.return)),c&64&&Ai&&(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=va;if(hl(t,e),ml(e),c&512&&(Pn||a===null||Ka(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[vt]||f[yt]||f.namespaceURI==="http://www.w3.org/2000/svg"||f.hasAttribute("itemprop"))&&(f=d.createElement(c),d.head.insertBefore(f,d.querySelector("head > title"))),Ms(f,c,a),f[yt]=e,Ie(f),c=f;break e;case"link":var v=g_("link","href",d).get(c+(a.href||""));if(v){for(var S=0;S<v.length;S++)if(f=v[S],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)){v.splice(S,1);break t}}f=d.createElement(c),Ms(f,c,a),d.head.appendChild(f);break;case"meta":if(v=g_("meta","content",d).get(c+(a.content||""))){for(S=0;S<v.length;S++)if(f=v[S],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)){v.splice(S,1);break t}}f=d.createElement(c),Ms(f,c,a),d.head.appendChild(f);break;default:throw Error(r(468,c))}f[yt]=e,Ie(f),c=f}e.stateNode=c}else x_(d,e.type,e.stateNode);else e.stateNode=p_(d,c,e.memoizedProps);else f!==c?(f===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):f.count--,c===null?x_(d,e.type,e.stateNode):p_(d,c,e.memoizedProps)):c===null&&e.stateNode!==null&&Nm(e,e.memoizedProps,a.memoizedProps)}break;case 27:hl(t,e),ml(e),c&512&&(Pn||a===null||Ka(a,a.return)),a!==null&&c&4&&Nm(e,e.memoizedProps,a.memoizedProps);break;case 5:if(hl(t,e),ml(e),c&512&&(Pn||a===null||Ka(a,a.return)),e.flags&32){d=e.stateNode;try{Ps(d,"")}catch($e){Xt(e,e.return,$e)}}c&4&&e.stateNode!=null&&(d=e.memoizedProps,Nm(e,d,a!==null?a.memoizedProps:d)),c&1024&&(Sm=!0);break;case 6:if(hl(t,e),ml(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(qf=null,d=va,va=Bf(t.containerInfo),hl(t,e),va=d,ml(e),c&4&&a!==null&&a.memoizedState.isDehydrated)try{Ho(t.containerInfo)}catch($e){Xt(e,e.return,$e)}Sm&&(Sm=!1,xx(e));break;case 4:c=va,va=Bf(e.stateNode.containerInfo),hl(t,e),ml(e),va=c;break;case 12:hl(t,e),ml(e);break;case 31:hl(t,e),ml(e),c&4&&(c=e.updateQueue,c!==null&&(e.updateQueue=null,Sf(e,c)));break;case 13:hl(t,e),ml(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Cf=ot()),c&4&&(c=e.updateQueue,c!==null&&(e.updateQueue=null,Sf(e,c)));break;case 22:d=e.memoizedState!==null;var B=a!==null&&a.memoizedState!==null,oe=Ai,xe=Pn;if(Ai=oe||d,Pn=xe||B,hl(t,e),Pn=xe,Ai=oe,ml(e),c&8192)e:for(t=e.stateNode,t._visibility=d?t._visibility&-2:t._visibility|1,d&&(a===null||B||Ai||Pn||wc(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){B=a=t;try{if(f=B.stateNode,d)v=f.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{S=B.stateNode;var Ne=B.memoizedProps.style,ue=Ne!=null&&Ne.hasOwnProperty("display")?Ne.display:null;S.style.display=ue==null||typeof ue=="boolean"?"":(""+ue).trim()}}catch($e){Xt(B,B.return,$e)}}}else if(t.tag===6){if(a===null){B=t;try{B.stateNode.nodeValue=d?"":B.memoizedProps}catch($e){Xt(B,B.return,$e)}}}else if(t.tag===18){if(a===null){B=t;try{var he=B.stateNode;d?i_(he,!0):i_(B.stateNode,!1)}catch($e){Xt(B,B.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,Sf(e,a))));break;case 19:hl(t,e),ml(e),c&4&&(c=e.updateQueue,c!==null&&(e.updateQueue=null,Sf(e,c)));break;case 30:break;case 21:break;default:hl(t,e),ml(e)}}function ml(e){var t=e.flags;if(t&2){try{for(var a,c=e.return;c!==null;){if(cx(c)){a=c;break}c=c.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var d=a.stateNode,f=km(e);wf(e,f,d);break;case 5:var v=a.stateNode;a.flags&32&&(Ps(v,""),a.flags&=-33);var S=km(e);wf(e,S,v);break;case 3:case 4:var B=a.stateNode.containerInfo,oe=km(e);wm(e,oe,B);break;default:throw Error(r(161))}}catch(xe){Xt(e,e.return,xe)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function xx(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;xx(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Ri(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)dx(e,t.alternate,t),t=t.sibling}function wc(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:br(4,t,t.return),wc(t);break;case 1:Ka(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&ix(t,t.return,a),wc(t);break;case 27:od(t.stateNode);case 26:case 5:Ka(t,t.return),wc(t);break;case 22:t.memoizedState===null&&wc(t);break;case 30:wc(t);break;default:wc(t)}e=e.sibling}}function Di(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var c=t.alternate,d=e,f=t,v=f.flags;switch(f.tag){case 0:case 11:case 15:Di(d,f,a),Ju(4,f);break;case 1:if(Di(d,f,a),c=f,d=c.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch(oe){Xt(c,c.return,oe)}if(c=f,d=c.updateQueue,d!==null){var S=c.stateNode;try{var B=d.shared.hiddenCallbacks;if(B!==null)for(d.shared.hiddenCallbacks=null,d=0;d<B.length;d++)lf(B[d],S)}catch(oe){Xt(c,c.return,oe)}}a&&v&64&&ax(f),ed(f,f.return);break;case 27:ox(f);case 26:case 5:Di(d,f,a),a&&c===null&&v&4&&rx(f),ed(f,f.return);break;case 12:Di(d,f,a);break;case 31:Di(d,f,a),a&&v&4&&mx(d,f);break;case 13:Di(d,f,a),a&&v&4&&px(d,f);break;case 22:f.memoizedState===null&&Di(d,f,a),ed(f,f.return);break;case 30:break;default:Di(d,f,a)}t=t.sibling}}function Em(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&&ac(a))}function Cm(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ac(e))}function ja(e,t,a,c){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)_x(e,t,a,c),t=t.sibling}function _x(e,t,a,c){var d=t.flags;switch(t.tag){case 0:case 11:case 15:ja(e,t,a,c),d&2048&&Ju(9,t);break;case 1:ja(e,t,a,c);break;case 3:ja(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&&ac(e)));break;case 12:if(d&2048){ja(e,t,a,c),e=t.stateNode;try{var f=t.memoizedProps,v=f.id,S=f.onPostCommit;typeof S=="function"&&S(v,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(B){Xt(t,t.return,B)}}else ja(e,t,a,c);break;case 31:ja(e,t,a,c);break;case 13:ja(e,t,a,c);break;case 23:break;case 22:f=t.stateNode,v=t.alternate,t.memoizedState!==null?f._visibility&2?ja(e,t,a,c):td(e,t):f._visibility&2?ja(e,t,a,c):(f._visibility|=2,Ao(e,t,a,c,(t.subtreeFlags&10256)!==0||!1)),d&2048&&Em(v,t);break;case 24:ja(e,t,a,c),d&2048&&Cm(t.alternate,t);break;default:ja(e,t,a,c)}}function Ao(e,t,a,c,d){for(d=d&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var f=e,v=t,S=a,B=c,oe=v.flags;switch(v.tag){case 0:case 11:case 15:Ao(f,v,S,B,d),Ju(8,v);break;case 23:break;case 22:var xe=v.stateNode;v.memoizedState!==null?xe._visibility&2?Ao(f,v,S,B,d):td(f,v):(xe._visibility|=2,Ao(f,v,S,B,d)),d&&oe&2048&&Em(v.alternate,v);break;case 24:Ao(f,v,S,B,d),d&&oe&2048&&Cm(v.alternate,v);break;default:Ao(f,v,S,B,d)}t=t.sibling}}function td(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:td(a,c),d&2048&&Em(c.alternate,c);break;case 24:td(a,c),d&2048&&Cm(c.alternate,c);break;default:td(a,c)}t=t.sibling}}var nd=8192;function Mo(e,t,a){if(e.subtreeFlags&nd)for(e=e.child;e!==null;)bx(e,t,a),e=e.sibling}function bx(e,t,a){switch(e.tag){case 26:Mo(e,t,a),e.flags&nd&&e.memoizedState!==null&&gj(a,va,e.memoizedState,e.memoizedProps);break;case 5:Mo(e,t,a);break;case 3:case 4:var c=va;va=Bf(e.stateNode.containerInfo),Mo(e,t,a),va=c;break;case 22:e.memoizedState===null&&(c=e.alternate,c!==null&&c.memoizedState!==null?(c=nd,nd=16777216,Mo(e,t,a),nd=c):Mo(e,t,a));break;default:Mo(e,t,a)}}function yx(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 sd(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];bs=c,jx(c,e)}yx(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)vx(e),e=e.sibling}function vx(e){switch(e.tag){case 0:case 11:case 15:sd(e),e.flags&2048&&br(9,e,e.return);break;case 3:sd(e);break;case 12:sd(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ef(e)):sd(e);break;default:sd(e)}}function Ef(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];bs=c,jx(c,e)}yx(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:br(8,t,t.return),Ef(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,Ef(t));break;default:Ef(t)}e=e.sibling}}function jx(e,t){for(;bs!==null;){var a=bs;switch(a.tag){case 0:case 11:case 15:br(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:ac(a.memoizedState.cache)}if(c=a.child,c!==null)c.return=a,bs=c;else e:for(a=e;bs!==null;){c=bs;var d=c.sibling,f=c.return;if(fx(c),c===a){bs=null;break e}if(d!==null){d.return=f,bs=d;break e}bs=f}}}var Mv={getCacheForType:function(e){var t=rs($n),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return rs($n).controller.signal}},Rv=typeof WeakMap=="function"?WeakMap:Map,Lt=0,tn=null,mt=null,xt=0,Vt=0,Dl=null,yr=!1,Ro=!1,Tm=!1,Li=0,Hn=0,vr=0,Sc=0,Am=0,Ll=0,Do=0,ld=null,pl=null,Mm=!1,Cf=0,Nx=0,Tf=1/0,Af=null,jr=null,os=0,Nr=null,Lo=null,Oi=0,Rm=0,Dm=null,kx=null,ad=0,Lm=null;function Ol(){return(Lt&2)!==0&&xt!==0?xt&-xt:L.T!==null?Bm():cn()}function wx(){if(Ll===0)if((xt&536870912)===0||ht){var e=et;et<<=1,(et&3932160)===0&&(et=262144),Ll=e}else Ll=536870912;return e=tl.current,e!==null&&(e.flags|=32),Ll}function gl(e,t,a){(e===tn&&(Vt===2||Vt===9)||e.cancelPendingCommit!==null)&&(Oo(e,0),kr(e,xt,Ll,!1)),us(e,a),((Lt&2)===0||e!==tn)&&(e===tn&&((Lt&2)===0&&(Sc|=a),Hn===4&&kr(e,xt,Ll,!1)),Qa(e))}function Sx(e,t,a){if((Lt&6)!==0)throw Error(r(327));var c=!a&&(t&127)===0&&(t&e.expiredLanes)===0||ut(e,t),d=c?Ov(e,t):zm(e,t,!0),f=c;do{if(d===0){Ro&&!c&&kr(e,t,0,!1);break}else{if(a=e.current.alternate,f&&!Dv(a)){d=zm(e,t,!1),f=!1;continue}if(d===2){if(f=t,e.errorRecoveryDisabledLanes&f)var v=0;else v=e.pendingLanes&-536870913,v=v!==0?v:v&536870912?536870912:0;if(v!==0){t=v;e:{var S=e;d=ld;var B=S.current.memoizedState.isDehydrated;if(B&&(Oo(S,v).flags|=256),v=zm(S,v,!1),v!==2){if(Tm&&!B){S.errorRecoveryDisabledLanes|=f,Sc|=f,d=4;break e}f=pl,pl=d,f!==null&&(pl===null?pl=f:pl.push.apply(pl,f))}d=v}if(f=!1,d!==2)continue}}if(d===1){Oo(e,0),kr(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:kr(c,t,Ll,!yr);break e;case 2:pl=null;break;case 3:case 5:break;default:throw Error(r(329))}if((t&62914560)===t&&(d=Cf+300-ot(),10<d)){if(kr(c,t,Ll,!yr),st(c,0,!0)!==0)break e;Oi=t,c.timeoutHandle=s_(Ex.bind(null,c,a,pl,Af,Mm,t,Ll,Sc,Do,yr,f,"Throttled",-0,0),d);break e}Ex(c,a,pl,Af,Mm,t,Ll,Sc,Do,yr,f,null,-0,0)}}break}while(!0);Qa(e)}function Ex(e,t,a,c,d,f,v,S,B,oe,xe,Ne,ue,he){if(e.timeoutHandle=-1,Ne=t.subtreeFlags,Ne&8192||(Ne&16785408)===16785408){Ne={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:dt},bx(t,f,Ne);var $e=(f&62914560)===f?Cf-ot():(f&4194048)===f?Nx-ot():0;if($e=xj(Ne,$e),$e!==null){Oi=f,e.cancelPendingCommit=$e(Ox.bind(null,e,t,f,a,c,d,v,S,B,xe,Ne,null,ue,he)),kr(e,f,v,!oe);return}}Ox(e,t,f,a,c,d,v,S,B)}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(!ls(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 kr(e,t,a,c){t&=~Am,t&=~Sc,e.suspendedLanes|=t,e.pingedLanes&=~t,c&&(e.warmLanes|=t),c=e.expirationTimes;for(var d=t;0<d;){var f=31-Dt(d),v=1<<f;c[f]=-1,d&=~v}a!==0&&Ln(e,a,t)}function Mf(){return(Lt&6)===0?(id(0),!1):!0}function Om(){if(mt!==null){if(Vt===0)var e=mt.return;else e=mt,Yn=bi=null,Ou(e),ji=null,Ni=0,e=mt;for(;e!==null;)lx(e.alternate,e),e=e.return;mt=null}}function Oo(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,Jv(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Oi=0,Om(),tn=e,mt=a=Js(e.current,null),xt=t,Vt=0,Dl=null,yr=!1,Ro=ut(e,t),Tm=!1,Do=Ll=Am=Sc=vr=Hn=0,pl=ld=null,Mm=!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-Dt(c),f=1<<d;t|=e[d],c&=~f}return Li=t,za(),a}function Cx(e,t){Je=null,L.H=M,t===ur||t===cc?(t=fo(),Vt=3):t===uo?(t=fo(),Vt=4):Vt=t===ze?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Dl=t,mt===null&&(Hn=1,Vl(e,Cs(t,e.current)))}function Tx(){var e=tl.current;return e===null?!0:(xt&4194048)===xt?ul===null:(xt&62914560)===xt||(xt&536870912)!==0?e===ul:!1}function Ax(){var e=L.H;return L.H=M,e===null?M:e}function Mx(){var e=L.A;return L.A=Mv,e}function Rf(){Hn=4,yr||(xt&4194048)!==xt&&tl.current!==null||(Ro=!0),(vr&134217727)===0&&(Sc&134217727)===0||tn===null||kr(tn,xt,Ll,!1)}function zm(e,t,a){var c=Lt;Lt|=2;var d=Ax(),f=Mx();(tn!==e||xt!==t)&&(Af=null,Oo(e,t)),t=!1;var v=Hn;e:do try{if(Vt!==0&&mt!==null){var S=mt,B=Dl;switch(Vt){case 8:Om(),v=6;break e;case 3:case 2:case 9:case 6:tl.current===null&&(t=!0);var oe=Vt;if(Vt=0,Dl=null,zo(e,S,B,oe),a&&Ro){v=0;break e}break;default:oe=Vt,Vt=0,Dl=null,zo(e,S,B,oe)}}Lv(),v=Hn;break}catch(xe){Cx(e,xe)}while(!0);return t&&e.shellSuspendCounter++,Yn=bi=null,Lt=c,L.H=d,L.A=f,mt===null&&(tn=null,xt=0,za()),v}function Lv(){for(;mt!==null;)Rx(mt)}function Ov(e,t){var a=Lt;Lt|=2;var c=Ax(),d=Mx();tn!==e||xt!==t?(Af=null,Tf=ot()+500,Oo(e,t)):Ro=ut(e,t);e:do try{if(Vt!==0&&mt!==null){t=mt;var f=Dl;t:switch(Vt){case 1:Vt=0,Dl=null,zo(e,t,f,1);break;case 2:case 9:if(ef(f)){Vt=0,Dl=null,Dx(t);break}t=function(){Vt!==2&&Vt!==9||tn!==e||(Vt=7),Qa(e)},f.then(t,t);break e;case 3:Vt=7;break e;case 4:Vt=5;break e;case 7:ef(f)?(Vt=0,Dl=null,Dx(t)):(Vt=0,Dl=null,zo(e,t,f,7));break;case 5:var v=null;switch(mt.tag){case 26:v=mt.memoizedState;case 5:case 27:var S=mt;if(v?__(v):S.stateNode.complete){Vt=0,Dl=null;var B=S.sibling;if(B!==null)mt=B;else{var oe=S.return;oe!==null?(mt=oe,Df(oe)):mt=null}break t}}Vt=0,Dl=null,zo(e,t,f,5);break;case 6:Vt=0,Dl=null,zo(e,t,f,6);break;case 8:Om(),Hn=6;break e;default:throw Error(r(462))}}zv();break}catch(xe){Cx(e,xe)}while(!0);return Yn=bi=null,L.H=c,L.A=d,Lt=a,mt!==null?0:(tn=null,xt=0,za(),Hn)}function zv(){for(;mt!==null&&!kn();)Rx(mt)}function Rx(e){var t=nx(e.alternate,e,Li);e.memoizedProps=e.pendingProps,t===null?Df(e):mt=t}function Dx(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=Zg(a,t,t.pendingProps,t.type,void 0,xt);break;case 11:t=Zg(a,t,t.pendingProps,t.type.render,t.ref,xt);break;case 5:Ou(t);default:lx(a,t),t=mt=Sl(t,Li),t=nx(a,t,Li)}e.memoizedProps=e.pendingProps,t===null?Df(e):mt=t}function zo(e,t,a,c){Yn=bi=null,Ou(t),ji=null,Ni=0;var d=t.return;try{if(we(e,d,t,a,xt)){Hn=1,Vl(e,Cs(a,e.current)),mt=null;return}}catch(f){if(d!==null)throw mt=d,f;Hn=1,Vl(e,Cs(a,e.current)),mt=null;return}t.flags&32768?(ht||c===1?e=!0:Ro||(xt&536870912)!==0?e=!1:(yr=e=!0,(c===2||c===9||c===3||c===6)&&(c=tl.current,c!==null&&c.tag===13&&(c.flags|=16384))),Lx(t,e)):Df(t)}function Df(e){var t=e;do{if((t.flags&32768)!==0){Lx(t,yr);return}e=t.return;var a=Ev(t.alternate,t,Li);if(a!==null){mt=a;return}if(t=t.sibling,t!==null){mt=t;return}mt=t=e}while(t!==null);Hn===0&&(Hn=5)}function Lx(e,t){do{var a=Cv(e.alternate,e);if(a!==null){a.flags&=32767,mt=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){mt=e;return}mt=e=a}while(e!==null);Hn=6,mt=null}function Ox(e,t,a,c,d,f,v,S,B){e.cancelPendingCommit=null;do Lf();while(os!==0);if((Lt&6)!==0)throw Error(r(327));if(t!==null){if(t===e.current)throw Error(r(177));if(f=t.lanes|t.childLanes,f|=oa,wn(e,a,f,v,S,B),e===tn&&(mt=tn=null,xt=0),Lo=t,Nr=e,Oi=a,Rm=f,Dm=d,kx=c,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Bv(Mt,function(){return Bx(),null})):(e.callbackNode=null,e.callbackPriority=0),c=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||c){c=L.T,L.T=null,d=z.p,z.p=2,v=Lt,Lt|=4;try{Tv(e,t,a)}finally{Lt=v,z.p=d,L.T=c}}os=1,zx(),Ix(),Ux()}}function zx(){if(os===1){os=0;var e=Nr,t=Lo,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=L.T,L.T=null;var c=z.p;z.p=2;var d=Lt;Lt|=4;try{gx(t,e);var f=Km,v=pu(e.containerInfo),S=f.focusedElem,B=f.selectionRange;if(v!==S&&S&&S.ownerDocument&&Wc(S.ownerDocument.documentElement,S)){if(B!==null&&tr(S)){var oe=B.start,xe=B.end;if(xe===void 0&&(xe=oe),"selectionStart"in S)S.selectionStart=oe,S.selectionEnd=Math.min(xe,S.value.length);else{var Ne=S.ownerDocument||document,ue=Ne&&Ne.defaultView||window;if(ue.getSelection){var he=ue.getSelection(),$e=S.textContent.length,Fe=Math.min(B.start,$e),Kt=B.end===void 0?Fe:Math.min(B.end,$e);!he.extend&&Fe>Kt&&(v=Kt,Kt=Fe,Fe=v);var se=Jr(S,Fe),P=Jr(S,Kt);if(se&&P&&(he.rangeCount!==1||he.anchorNode!==se.node||he.anchorOffset!==se.offset||he.focusNode!==P.node||he.focusOffset!==P.offset)){var ce=Ne.createRange();ce.setStart(se.node,se.offset),he.removeAllRanges(),Fe>Kt?(he.addRange(ce),he.extend(P.node,P.offset)):(ce.setEnd(P.node,P.offset),he.addRange(ce))}}}}for(Ne=[],he=S;he=he.parentNode;)he.nodeType===1&&Ne.push({element:he,left:he.scrollLeft,top:he.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;S<Ne.length;S++){var be=Ne[S];be.element.scrollLeft=be.left,be.element.scrollTop=be.top}}Xf=!!Fm,Km=Fm=null}finally{Lt=d,z.p=c,L.T=a}}e.current=t,os=2}}function Ix(){if(os===2){os=0;var e=Nr,t=Lo,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=L.T,L.T=null;var c=z.p;z.p=2;var d=Lt;Lt|=4;try{dx(e,t.alternate,t)}finally{Lt=d,z.p=c,L.T=a}}os=3}}function Ux(){if(os===4||os===3){os=0,Ut();var e=Nr,t=Lo,a=Oi,c=kx;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?os=5:(os=0,Lo=Nr=null,$x(e,e.pendingLanes));var d=e.pendingLanes;if(d===0&&(jr=null),ts(a),t=t.stateNode,Zt&&typeof Zt.onCommitFiberRoot=="function")try{Zt.onCommitFiberRoot(nn,t,void 0,(t.current.flags&128)===128)}catch{}if(c!==null){t=L.T,d=z.p,z.p=2,L.T=null;try{for(var f=e.onRecoverableError,v=0;v<c.length;v++){var S=c[v];f(S.value,{componentStack:S.stack})}}finally{L.T=t,z.p=d}}(Oi&3)!==0&&Lf(),Qa(e),d=e.pendingLanes,(a&261930)!==0&&(d&42)!==0?e===Lm?ad++:(ad=0,Lm=e):ad=0,id(0)}}function $x(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ac(t)))}function Lf(){return zx(),Ix(),Ux(),Bx()}function Bx(){if(os!==5)return!1;var e=Nr,t=Rm;Rm=0;var a=ts(Oi),c=L.T,d=z.p;try{z.p=32>a?32:a,L.T=null,a=Dm,Dm=null;var f=Nr,v=Oi;if(os=0,Lo=Nr=null,Oi=0,(Lt&6)!==0)throw Error(r(331));var S=Lt;if(Lt|=4,vx(f.current),_x(f,f.current,v,a),Lt=S,id(0,!1),Zt&&typeof Zt.onPostCommitFiberRoot=="function")try{Zt.onPostCommitFiberRoot(nn,f)}catch{}return!0}finally{z.p=d,L.T=c,$x(e,t)}}function Hx(e,t,a){t=Cs(a,t),t=ya(e.stateNode,t,2),e=Gl(e,t,2),e!==null&&(us(e,2),Qa(e))}function Xt(e,t,a){if(e.tag===3)Hx(e,e,a);else for(;t!==null;){if(t.tag===3){Hx(t,e,a);break}else if(t.tag===1){var c=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(jr===null||!jr.has(c))){e=Cs(a,e),a=Zu(2),c=Gl(t,a,2),c!==null&&(_e(a,c,t,e),us(c,2),Qa(c));break}}t=t.return}}function Im(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)||(Tm=!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,tn===e&&(xt&a)===a&&(Hn===4||Hn===3&&(xt&62914560)===xt&&300>ot()-Cf?(Lt&2)===0&&Oo(e,0):Am|=a,Do===xt&&(Do=0)),Qa(e)}function qx(e,t){t===0&&(t=Dn()),e=xi(e,t),e!==null&&(us(e,t),Qa(e))}function Uv(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),qx(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),qx(e,a)}function Bv(e,t){return Se(e,t)}var Of=null,Io=null,Um=!1,zf=!1,$m=!1,wr=0;function Qa(e){e!==Io&&e.next===null&&(Io===null?Of=Io=e:Io=Io.next=e),zf=!0,Um||(Um=!0,qv())}function id(e,t){if(!$m&&zf){$m=!0;do for(var a=!1,c=Of;c!==null;){if(e!==0){var d=c.pendingLanes;if(d===0)var f=0;else{var v=c.suspendedLanes,S=c.pingedLanes;f=(1<<31-Dt(42|e)+1)-1,f&=d&~(v&~S),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(a=!0,Xx(c,f))}else f=xt,f=st(c,c===tn?f:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(f&3)===0||ut(c,f)||(a=!0,Xx(c,f));c=c.next}while(a);$m=!1}}function Hv(){Gx()}function Gx(){zf=Um=!1;var e=0;wr!==0&&Wv()&&(e=wr);for(var t=ot(),a=null,c=Of;c!==null;){var d=c.next,f=Yx(c,t);f===0?(c.next=null,a===null?Of=d:a.next=d,d===null&&(Io=a)):(a=c,(e!==0||(f&3)!==0)&&(zf=!0)),c=d}os!==0&&os!==5||id(e),wr!==0&&(wr=0)}function Yx(e,t){for(var a=e.suspendedLanes,c=e.pingedLanes,d=e.expirationTimes,f=e.pendingLanes&-62914561;0<f;){var v=31-Dt(f),S=1<<v,B=d[v];B===-1?((S&a)===0||(S&c)!==0)&&(d[v]=vs(S,t)):B<=t&&(e.expiredLanes|=S),f&=~S}if(t=tn,a=xt,a=st(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&&rt(c),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||ut(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(c!==null&&rt(c),ts(a)){case 2:case 8:a=Rn;break;case 32:a=Mt;break;case 268435456:a=an;break;default:a=Mt}return c=Vx.bind(null,e),a=Se(a,c),e.callbackPriority=t,e.callbackNode=a,t}return c!==null&&c!==null&&rt(c),e.callbackPriority=2,e.callbackNode=null,2}function Vx(e,t){if(os!==0&&os!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Lf()&&e.callbackNode!==a)return null;var c=xt;return c=st(e,e===tn?c:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),c===0?null:(Sx(e,c,t),Yx(e,ot()),e.callbackNode!=null&&e.callbackNode===a?Vx.bind(null,e):null)}function Xx(e,t){if(Lf())return null;Sx(e,t,!0)}function qv(){ej(function(){(Lt&6)!==0?Se(Vn,Hv):Gx()})}function Bm(){if(wr===0){var e=cr;e===0&&(e=Ve,Ve<<=1,(Ve&261888)===0&&(Ve=256)),wr=e}return wr}function Fx(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:sa(""+e)}function Kx(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=Fx((d[un]||null).action),v=c.submitter;v&&(t=(t=v[un]||null)?Fx(t.formAction):v.getAttribute("formAction"),t!==null&&(f=t,v=null));var S=new fn("action","action",null,c,d);e.push({event:S,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(wr!==0){var B=v?Kx(d,v):new FormData(d);Fu(a,{pending:!0,data:B,method:d.method,action:f},null,B)}}else typeof f=="function"&&(S.preventDefault(),B=v?Kx(d,v):new FormData(d),Fu(a,{pending:!0,data:B,method:d.method,action:f},f,B))},currentTarget:d}]})}}for(var Hm=0;Hm<no.length;Hm++){var qm=no[Hm],Yv=qm.toLowerCase(),Vv=qm[0].toUpperCase()+qm.slice(1);Us(Yv,"on"+Vv)}Us(Oa,"onAnimationEnd"),Us(tc,"onAnimationIteration"),Us(eo,"onAnimationStart"),Us("dblclick","onDoubleClick"),Us("focusin","onFocus"),Us("focusout","onBlur"),Us(im,"onTransitionRun"),Us(gi,"onTransitionStart"),Us(to,"onTransitionCancel"),Us(xu,"onTransitionEnd"),In("onMouseEnter",["mouseout","mouseover"]),In("onMouseLeave",["mouseout","mouseover"]),In("onPointerEnter",["pointerout","pointerover"]),In("onPointerLeave",["pointerout","pointerover"]),Nt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Nt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Nt("onBeforeInput",["compositionend","keypress","textInput","paste"]),Nt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Nt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Nt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var rd="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(rd));function Qx(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 v=c.length-1;0<=v;v--){var S=c[v],B=S.instance,oe=S.currentTarget;if(S=S.listener,B!==f&&d.isPropagationStopped())break e;f=S,d.currentTarget=oe;try{f(d)}catch(xe){rl(xe)}d.currentTarget=null,f=B}else for(v=0;v<c.length;v++){if(S=c[v],B=S.instance,oe=S.currentTarget,S=S.listener,B!==f&&d.isPropagationStopped())break e;f=S,d.currentTarget=oe;try{f(d)}catch(xe){rl(xe)}d.currentTarget=null,f=B}}}}function pt(e,t){var a=t[fs];a===void 0&&(a=t[fs]=new Set);var c=e+"__bubble";a.has(c)||(Zx(t,e,2,!1),a.add(c))}function Gm(e,t,a){var c=0;t&&(c|=4),Zx(a,e,c,t)}var If="_reactListening"+Math.random().toString(36).slice(2);function Ym(e){if(!e[If]){e[If]=!0,gt.forEach(function(a){a!=="selectionchange"&&(Xv.has(a)||Gm(a,!1,e),Gm(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[If]||(t[If]=!0,Gm("selectionchange",!1,t))}}function Zx(e,t,a,c){switch(w_(t)){case 2:var d=yj;break;case 8:d=vj;break;default:d=ap}a=d.bind(null,t,a,e),d=void 0,!ps||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 Vm(e,t,a,c,d){var f=c;if((t&1)===0&&(t&2)===0&&c!==null)e:for(;;){if(c===null)return;var v=c.tag;if(v===3||v===4){var S=c.stateNode.containerInfo;if(S===d)break;if(v===4)for(v=c.return;v!==null;){var B=v.tag;if((B===3||B===4)&&v.stateNode.containerInfo===d)return;v=v.return}for(;S!==null;){if(v=zn(S),v===null)return;if(B=v.tag,B===5||B===6||B===26||B===27){c=f=v;continue e}S=S.parentNode}}c=c.return}al(function(){var oe=f,xe=bn(a),Ne=[];e:{var ue=nc.get(e);if(ue!==void 0){var he=fn,$e=e;switch(e){case"keypress":if(Me(a)===0)break e;case"keydown":case"keyup":he=hu;break;case"focusin":$e="focus",he=Qi;break;case"focusout":$e="blur",he=Qi;break;case"beforeblur":case"afterblur":he=Qi;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=oi;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":he=Zh;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":he=em;break;case Oa:case tc:case eo:he=Xr;break;case xu:he=nm;break;case"scroll":case"scrollend":he=Ta;break;case"wheel":he=sm;break;case"copy":case"cut":case"paste":he=qd;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":he=Yd;break;case"toggle":case"beforetoggle":he=lm}var Fe=(t&4)!==0,Kt=!Fe&&(e==="scroll"||e==="scrollend"),se=Fe?ue!==null?ue+"Capture":null:ue;Fe=[];for(var P=oe,ce;P!==null;){var be=P;if(ce=be.stateNode,be=be.tag,be!==5&&be!==26&&be!==27||ce===null||se===null||(be=Ws(P,se),be!=null&&Fe.push(cd(P,be,ce))),Kt)break;P=P.return}0<Fe.length&&(ue=new he(ue,$e,null,a,xe),Ne.push({event:ue,listeners:Fe}))}}if((t&7)===0){e:{if(ue=e==="mouseover"||e==="pointerover",he=e==="mouseout"||e==="pointerout",ue&&a!==la&&($e=a.relatedTarget||a.fromElement)&&(zn($e)||$e[ds]))break e;if((he||ue)&&(ue=xe.window===xe?xe:(ue=xe.ownerDocument)?ue.defaultView||ue.parentWindow:window,he?($e=a.relatedTarget||a.toElement,he=oe,$e=$e?zn($e):null,$e!==null&&(Kt=u($e),Fe=$e.tag,$e!==Kt||Fe!==5&&Fe!==27&&Fe!==6)&&($e=null)):(he=null,$e=oe),he!==$e)){if(Fe=oi,be="onMouseLeave",se="onMouseEnter",P="mouse",(e==="pointerout"||e==="pointerover")&&(Fe=Yd,be="onPointerLeave",se="onPointerEnter",P="pointer"),Kt=he==null?ue:me(he),ce=$e==null?ue:me($e),ue=new Fe(be,P+"leave",he,a,xe),ue.target=Kt,ue.relatedTarget=ce,be=null,zn(xe)===oe&&(Fe=new Fe(se,P+"enter",$e,a,xe),Fe.target=ce,Fe.relatedTarget=Kt,be=Fe),Kt=be,he&&$e)t:{for(Fe=Fv,se=he,P=$e,ce=0,be=se;be;be=Fe(be))ce++;be=0;for(var qe=P;qe;qe=Fe(qe))be++;for(;0<ce-be;)se=Fe(se),ce--;for(;0<be-ce;)P=Fe(P),be--;for(;ce--;){if(se===P||P!==null&&se===P.alternate){Fe=se;break t}se=Fe(se),P=Fe(P)}Fe=null}else Fe=null;he!==null&&Px(Ne,ue,he,Fe,!1),$e!==null&&Kt!==null&&Px(Ne,Kt,$e,Fe,!0)}}e:{if(ue=oe?me(oe):window,he=ue.nodeName&&ue.nodeName.toLowerCase(),he==="select"||he==="input"&&ue.type==="file")var Tt=kl;else if(fi(ue))if(Ji)Tt=Kd;else{Tt=Fd;var He=Qc}else he=ue.nodeName,!he||he.toLowerCase()!=="input"||ue.type!=="checkbox"&&ue.type!=="radio"?oe&&na(oe.elementType)&&(Tt=kl):Tt=Zc;if(Tt&&(Tt=Tt(e,oe))){Zr(Ne,Tt,a,xe);break e}He&&He(e,ue,oe),e==="focusout"&&oe&&ue.type==="number"&&oe.memoizedProps.value!=null&&Jl(ue,"number",ue.value)}switch(He=oe?me(oe):window,e){case"focusin":(fi(He)||He.contentEditable==="true")&&(La=He,sr=oe,ra=null);break;case"focusout":ra=sr=La=null;break;case"mousedown":gu=!0;break;case"contextmenu":case"mouseup":case"dragend":gu=!1,ec(Ne,a,xe);break;case"selectionchange":if(nr)break;case"keydown":case"keyup":ec(Ne,a,xe)}var it;if(Ss)e:{switch(e){case"compositionstart":var _t="onCompositionStart";break e;case"compositionend":_t="onCompositionEnd";break e;case"compositionupdate":_t="onCompositionUpdate";break e}_t=void 0}else di?Aa(e,a)&&(_t="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(_t="onCompositionStart");_t&&(Pi&&a.locale!=="ko"&&(di||_t!=="onCompositionStart"?_t==="onCompositionEnd"&&di&&(it=re()):(y=xe,T="value"in y?y.value:y.textContent,di=!0)),He=Uf(oe,_t),0<He.length&&(_t=new Fr(_t,e,null,a,xe),Ne.push({event:_t,listeners:He}),it?_t.data=it:(it=Is(a),it!==null&&(_t.data=it)))),(it=ui?am(e,a):Vd(e,a))&&(_t=Uf(oe,"onBeforeInput"),0<_t.length&&(He=new Fr("onBeforeInput","beforeinput",null,a,xe),Ne.push({event:He,listeners:_t}),He.data=it)),Gv(Ne,e,oe,a,xe)}Qx(Ne,t)})}function cd(e,t,a){return{instance:e,listener:t,currentTarget:a}}function Uf(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=Ws(e,a),d!=null&&c.unshift(cd(e,d,f)),d=Ws(e,t),d!=null&&c.push(cd(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 Px(e,t,a,c,d){for(var f=t._reactName,v=[];a!==null&&a!==c;){var S=a,B=S.alternate,oe=S.stateNode;if(S=S.tag,B!==null&&B===c)break;S!==5&&S!==26&&S!==27||oe===null||(B=oe,d?(oe=Ws(a,f),oe!=null&&v.unshift(cd(a,oe,B))):d||(oe=Ws(a,f),oe!=null&&v.push(cd(a,oe,B)))),a=a.return}v.length!==0&&e.push({event:t,listeners:v})}var Kv=/\r\n?/g,Qv=/\u0000|\uFFFD/g;function Wx(e){return(typeof e=="string"?e:""+e).replace(Kv,`
50
+ `).replace(Qv,"")}function Jx(e,t){return t=Wx(t),Wx(e)===t}function Ft(e,t,a,c,d,f){switch(a){case"children":typeof c=="string"?t==="body"||t==="textarea"&&c===""||Ps(e,c):(typeof c=="number"||typeof c=="bigint")&&t!=="body"&&Ps(e,""+c);break;case"className":Nl(e,"class",c);break;case"tabIndex":Nl(e,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":Nl(e,a,c);break;case"style":Kn(e,c,f);break;case"data":if(t!=="object"){Nl(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=sa(""+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"&&Ft(e,t,"name",d.name,d,null),Ft(e,t,"formEncType",d.formEncType,d,null),Ft(e,t,"formMethod",d.formMethod,d,null),Ft(e,t,"formTarget",d.formTarget,d,null)):(Ft(e,t,"encType",d.encType,d,null),Ft(e,t,"method",d.method,d,null),Ft(e,t,"target",d.target,d,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){e.removeAttribute(a);break}c=sa(""+c),e.setAttribute(a,c);break;case"onClick":c!=null&&(e.onclick=dt);break;case"onScroll":c!=null&&pt("scroll",e);break;case"onScrollEnd":c!=null&&pt("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=sa(""+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":pt("beforetoggle",e),pt("toggle",e),jl(e,"popover",c);break;case"xlinkActuate":Fn(e,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":Fn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":Fn(e,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":Fn(e,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":Fn(e,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":Fn(e,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":Fn(e,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":Fn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":Fn(e,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":jl(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=Il.get(a)||a,jl(e,a,c))}}function Xm(e,t,a,c,d,f){switch(a){case"style":Kn(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"?Ps(e,c):(typeof c=="number"||typeof c=="bigint")&&Ps(e,""+c);break;case"onScroll":c!=null&&pt("scroll",e);break;case"onScrollEnd":c!=null&&pt("scrollend",e);break;case"onClick":c!=null&&(e.onclick=dt);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ln.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[un]||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,""):jl(e,a,c)}}}function Ms(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":pt("error",e),pt("load",e);var c=!1,d=!1,f;for(f in a)if(a.hasOwnProperty(f)){var v=a[f];if(v!=null)switch(f){case"src":c=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:Ft(e,t,f,v,a,null)}}d&&Ft(e,t,"srcSet",a.srcSet,a,null),c&&Ft(e,t,"src",a.src,a,null);return;case"input":pt("invalid",e);var S=f=v=d=null,B=null,oe=null;for(c in a)if(a.hasOwnProperty(c)){var xe=a[c];if(xe!=null)switch(c){case"name":d=xe;break;case"type":v=xe;break;case"checked":B=xe;break;case"defaultChecked":oe=xe;break;case"value":f=xe;break;case"defaultValue":S=xe;break;case"children":case"dangerouslySetInnerHTML":if(xe!=null)throw Error(r(137,t));break;default:Ft(e,t,c,xe,a,null)}}ri(e,f,S,B,oe,v,d,!1);return;case"select":pt("invalid",e),c=v=f=null;for(d in a)if(a.hasOwnProperty(d)&&(S=a[d],S!=null))switch(d){case"value":f=S;break;case"defaultValue":v=S;break;case"multiple":c=S;default:Ft(e,t,d,S,a,null)}t=f,a=v,e.multiple=!!c,t!=null?hs(e,!!c,t,!1):a!=null&&hs(e,!!c,a,!0);return;case"textarea":pt("invalid",e),f=d=c=null;for(v in a)if(a.hasOwnProperty(v)&&(S=a[v],S!=null))switch(v){case"value":c=S;break;case"defaultValue":d=S;break;case"children":f=S;break;case"dangerouslySetInnerHTML":if(S!=null)throw Error(r(91));break;default:Ft(e,t,v,S,a,null)}ta(e,c,d,f);return;case"option":for(B in a)if(a.hasOwnProperty(B)&&(c=a[B],c!=null))switch(B){case"selected":e.selected=c&&typeof c!="function"&&typeof c!="symbol";break;default:Ft(e,t,B,c,a,null)}return;case"dialog":pt("beforetoggle",e),pt("toggle",e),pt("cancel",e),pt("close",e);break;case"iframe":case"object":pt("load",e);break;case"video":case"audio":for(c=0;c<rd.length;c++)pt(rd[c],e);break;case"image":pt("error",e),pt("load",e);break;case"details":pt("toggle",e);break;case"embed":case"source":case"link":pt("error",e),pt("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(oe in a)if(a.hasOwnProperty(oe)&&(c=a[oe],c!=null))switch(oe){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:Ft(e,t,oe,c,a,null)}return;default:if(na(t)){for(xe in a)a.hasOwnProperty(xe)&&(c=a[xe],c!==void 0&&Xm(e,t,xe,c,a,void 0));return}}for(S in a)a.hasOwnProperty(S)&&(c=a[S],c!=null&&Ft(e,t,S,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,v=null,S=null,B=null,oe=null,xe=null;for(he in a){var Ne=a[he];if(a.hasOwnProperty(he)&&Ne!=null)switch(he){case"checked":break;case"value":break;case"defaultValue":B=Ne;default:c.hasOwnProperty(he)||Ft(e,t,he,null,c,Ne)}}for(var ue in c){var he=c[ue];if(Ne=a[ue],c.hasOwnProperty(ue)&&(he!=null||Ne!=null))switch(ue){case"type":f=he;break;case"name":d=he;break;case"checked":oe=he;break;case"defaultChecked":xe=he;break;case"value":v=he;break;case"defaultValue":S=he;break;case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(r(137,t));break;default:he!==Ne&&Ft(e,t,ue,he,c,Ne)}}Zs(e,v,S,B,oe,xe,f,d);return;case"select":he=v=S=ue=null;for(f in a)if(B=a[f],a.hasOwnProperty(f)&&B!=null)switch(f){case"value":break;case"multiple":he=B;default:c.hasOwnProperty(f)||Ft(e,t,f,null,c,B)}for(d in c)if(f=c[d],B=a[d],c.hasOwnProperty(d)&&(f!=null||B!=null))switch(d){case"value":ue=f;break;case"defaultValue":S=f;break;case"multiple":v=f;default:f!==B&&Ft(e,t,d,f,c,B)}t=S,a=v,c=he,ue!=null?hs(e,!!a,ue,!1):!!c!=!!a&&(t!=null?hs(e,!!a,t,!0):hs(e,!!a,a?[]:"",!1));return;case"textarea":he=ue=null;for(S in a)if(d=a[S],a.hasOwnProperty(S)&&d!=null&&!c.hasOwnProperty(S))switch(S){case"value":break;case"children":break;default:Ft(e,t,S,null,c,d)}for(v in c)if(d=c[v],f=a[v],c.hasOwnProperty(v)&&(d!=null||f!=null))switch(v){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&&Ft(e,t,v,d,c,f)}ea(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:Ft(e,t,$e,null,c,ue)}for(B in c)if(ue=c[B],he=a[B],c.hasOwnProperty(B)&&ue!==he&&(ue!=null||he!=null))switch(B){case"selected":e.selected=ue&&typeof ue!="function"&&typeof ue!="symbol";break;default:Ft(e,t,B,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 Fe in a)ue=a[Fe],a.hasOwnProperty(Fe)&&ue!=null&&!c.hasOwnProperty(Fe)&&Ft(e,t,Fe,null,c,ue);for(oe in c)if(ue=c[oe],he=a[oe],c.hasOwnProperty(oe)&&ue!==he&&(ue!=null||he!=null))switch(oe){case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(r(137,t));break;default:Ft(e,t,oe,ue,c,he)}return;default:if(na(t)){for(var Kt in a)ue=a[Kt],a.hasOwnProperty(Kt)&&ue!==void 0&&!c.hasOwnProperty(Kt)&&Xm(e,t,Kt,void 0,c,ue);for(xe in c)ue=c[xe],he=a[xe],!c.hasOwnProperty(xe)||ue===he||ue===void 0&&he===void 0||Xm(e,t,xe,ue,c,he);return}}for(var se in a)ue=a[se],a.hasOwnProperty(se)&&ue!=null&&!c.hasOwnProperty(se)&&Ft(e,t,se,null,c,ue);for(Ne in c)ue=c[Ne],he=a[Ne],!c.hasOwnProperty(Ne)||ue===he||ue==null&&he==null||Ft(e,t,Ne,ue,c,he)}function e_(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,v=d.initiatorType,S=d.duration;if(f&&S&&e_(v)){for(v=0,S=d.responseEnd,c+=1;c<a.length;c++){var B=a[c],oe=B.startTime;if(oe>S)break;var xe=B.transferSize,Ne=B.initiatorType;xe&&e_(Ne)&&(B=B.responseEnd,v+=xe*(B<S?1:(S-oe)/(B-oe)))}if(--c,t+=8*(f+v)/(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 Fm=null,Km=null;function $f(e){return e.nodeType===9?e:e.ownerDocument}function t_(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 n_(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 Qm(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 Zm=null;function Wv(){var e=window.event;return e&&e.type==="popstate"?e===Zm?!1:(Zm=e,!0):(Zm=null,!1)}var s_=typeof setTimeout=="function"?setTimeout:void 0,Jv=typeof clearTimeout=="function"?clearTimeout:void 0,l_=typeof Promise=="function"?Promise:void 0,ej=typeof queueMicrotask=="function"?queueMicrotask:typeof l_<"u"?function(e){return l_.resolve(null).then(e).catch(tj)}:s_;function tj(e){setTimeout(function(){throw e})}function Sr(e){return e==="head"}function a_(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),Ho(t);return}c--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")c++;else if(a==="html")od(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,od(a);for(var f=a.firstChild;f;){var v=f.nextSibling,S=f.nodeName;f[vt]||S==="SCRIPT"||S==="STYLE"||S==="LINK"&&f.rel.toLowerCase()==="stylesheet"||a.removeChild(f),f=v}}else a==="body"&&od(e.ownerDocument.body);a=d}while(a);Ho(t)}function i_(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 Pm(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":Pm(a),zs(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[vt])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=Xl(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=Xl(e.nextSibling),e===null))return null;return e}function r_(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Xl(e.nextSibling),e===null))return null;return e}function Wm(e){return e.data==="$?"||e.data==="$~"}function Jm(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 Xl(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 ep=null;function c_(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return Xl(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function o_(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 u_(e,t,a){switch(t=$f(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 od(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);zs(e)}var Fl=new Map,d_=new Set;function Bf(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var zi=z.d;z.d={f:aj,r:ij,D:rj,C:cj,L:oj,m:uj,X:fj,S:dj,M:hj};function aj(){var e=zi.f(),t=Mf();return e||t}function ij(e){var t=K(e);t!==null&&t.tag===5&&t.type==="form"?bf(t):zi.r(e)}var Uo=typeof document>"u"?null:document;function f_(e,t,a){var c=Uo;if(c&&typeof t=="string"&&t){var d=Wt(t);d='link[rel="'+e+'"][href="'+d+'"]',typeof a=="string"&&(d+='[crossorigin="'+a+'"]'),d_.has(d)||(d_.add(d),e={rel:e,crossOrigin:a,href:t},c.querySelector(d)===null&&(t=c.createElement("link"),Ms(t,"link",e),Ie(t),c.head.appendChild(t)))}}function rj(e){zi.D(e),f_("dns-prefetch",e,null)}function cj(e,t){zi.C(e,t),f_("preconnect",e,t)}function oj(e,t,a){zi.L(e,t,a);var c=Uo;if(c&&e&&t){var d='link[rel="preload"][as="'+Wt(t)+'"]';t==="image"&&a&&a.imageSrcSet?(d+='[imagesrcset="'+Wt(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(d+='[imagesizes="'+Wt(a.imageSizes)+'"]')):d+='[href="'+Wt(e)+'"]';var f=d;switch(t){case"style":f=$o(e);break;case"script":f=Bo(e)}Fl.has(f)||(e=j({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),Fl.set(f,e),c.querySelector(d)!==null||t==="style"&&c.querySelector(ud(f))||t==="script"&&c.querySelector(dd(f))||(t=c.createElement("link"),Ms(t,"link",e),Ie(t),c.head.appendChild(t)))}}function uj(e,t){zi.m(e,t);var a=Uo;if(a&&e){var c=t&&typeof t.as=="string"?t.as:"script",d='link[rel="modulepreload"][as="'+Wt(c)+'"][href="'+Wt(e)+'"]',f=d;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=Bo(e)}if(!Fl.has(f)&&(e=j({rel:"modulepreload",href:e},t),Fl.set(f,e),a.querySelector(d)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(dd(f)))return}c=a.createElement("link"),Ms(c,"link",e),Ie(c),a.head.appendChild(c)}}}function dj(e,t,a){zi.S(e,t,a);var c=Uo;if(c&&e){var d=Ce(c).hoistableStyles,f=$o(e);t=t||"default";var v=d.get(f);if(!v){var S={loading:0,preload:null};if(v=c.querySelector(ud(f)))S.loading=5;else{e=j({rel:"stylesheet",href:e,"data-precedence":t},a),(a=Fl.get(f))&&tp(e,a);var B=v=c.createElement("link");Ie(B),Ms(B,"link",e),B._p=new Promise(function(oe,xe){B.onload=oe,B.onerror=xe}),B.addEventListener("load",function(){S.loading|=1}),B.addEventListener("error",function(){S.loading|=2}),S.loading|=4,Hf(v,t,c)}v={type:"stylesheet",instance:v,count:1,state:S},d.set(f,v)}}}function fj(e,t){zi.X(e,t);var a=Uo;if(a&&e){var c=Ce(a).hoistableScripts,d=Bo(e),f=c.get(d);f||(f=a.querySelector(dd(d)),f||(e=j({src:e,async:!0},t),(t=Fl.get(d))&&np(e,t),f=a.createElement("script"),Ie(f),Ms(f,"link",e),a.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},c.set(d,f))}}function hj(e,t){zi.M(e,t);var a=Uo;if(a&&e){var c=Ce(a).hoistableScripts,d=Bo(e),f=c.get(d);f||(f=a.querySelector(dd(d)),f||(e=j({src:e,async:!0,type:"module"},t),(t=Fl.get(d))&&np(e,t),f=a.createElement("script"),Ie(f),Ms(f,"link",e),a.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},c.set(d,f))}}function h_(e,t,a,c){var d=(d=fe.current)?Bf(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=$o(a.href),a=Ce(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=$o(a.href);var f=Ce(d).hoistableStyles,v=f.get(e);if(v||(d=d.ownerDocument||d,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(e,v),(f=d.querySelector(ud(e)))&&!f._p&&(v.instance=f,v.state.loading=5),Fl.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},Fl.set(e,a),f||mj(d,e,a,v.state))),t&&c===null)throw Error(r(528,""));return v}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=Bo(a),a=Ce(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 $o(e){return'href="'+Wt(e)+'"'}function ud(e){return'link[rel="stylesheet"]['+e+"]"}function m_(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}),Ms(t,"link",a),Ie(t),e.head.appendChild(t))}function Bo(e){return'[src="'+Wt(e)+'"]'}function dd(e){return"script[async]"+e}function p_(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var c=e.querySelector('style[data-href~="'+Wt(a.href)+'"]');if(c)return t.instance=c,Ie(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"),Ie(c),Ms(c,"style",d),Hf(c,a.precedence,e),t.instance=c;case"stylesheet":d=$o(a.href);var f=e.querySelector(ud(d));if(f)return t.state.loading|=4,t.instance=f,Ie(f),f;c=m_(a),(d=Fl.get(d))&&tp(c,d),f=(e.ownerDocument||e).createElement("link"),Ie(f);var v=f;return v._p=new Promise(function(S,B){v.onload=S,v.onerror=B}),Ms(f,"link",c),t.state.loading|=4,Hf(f,a.precedence,e),t.instance=f;case"script":return f=Bo(a.src),(d=e.querySelector(dd(f)))?(t.instance=d,Ie(d),d):(c=a,(d=Fl.get(f))&&(c=j({},a),np(c,d)),e=e.ownerDocument||e,d=e.createElement("script"),Ie(d),Ms(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,Hf(c,a.precedence,e));return t.instance}function Hf(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,v=0;v<c.length;v++){var S=c[v];if(S.dataset.precedence===t)f=S;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 tp(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function np(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var qf=null;function g_(e,t,a){if(qf===null){var c=new Map,d=qf=new Map;d.set(a,c)}else d=qf,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[vt]||f[yt]||e==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var v=f.getAttribute(t)||"";v=e+v;var S=c.get(v);S?S.push(f):c.set(v,[f])}}return c}function x_(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 __(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=$o(c.href),f=t.querySelector(ud(d));if(f){t=f._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Gf.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=f,Ie(f);return}f=t.ownerDocument||t,c=m_(c),(d=Fl.get(d))&&tp(c,d),f=f.createElement("link"),Ie(f);var v=f;v._p=new Promise(function(S,B){v.onload=S,v.onerror=B}),Ms(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=Gf.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var sp=0;function xj(e,t){return e.stylesheets&&e.count===0&&Vf(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var c=setTimeout(function(){if(e.stylesheets&&Vf(e,e.stylesheets),e.unsuspend){var f=e.unsuspend;e.unsuspend=null,f()}},6e4+t);0<e.imgBytes&&sp===0&&(sp=62500*Pv());var d=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Vf(e,e.stylesheets),e.unsuspend)){var f=e.unsuspend;e.unsuspend=null,f()}},(e.imgBytes>sp?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(c),clearTimeout(d)}}:null}function Gf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Vf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Vf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(_j,e),Yf=null,Gf.call(e))}function _j(e,t){if(!(t.state.loading&4)){var a=Yf.get(e);if(a)var c=a.get(null);else{a=new Map,Yf.set(e,a);for(var d=e.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<d.length;f++){var v=d[f];(v.nodeName==="LINK"||v.getAttribute("media")!=="not all")&&(a.set(v.dataset.precedence,v),c=v)}c&&a.set(null,c)}d=t.instance,v=d.getAttribute("data-precedence"),f=a.get(v)||c,f===c&&a.set(null,d),a.set(v,d),this.count++,c=Gf.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 fd={$$typeof:H,Provider:null,Consumer:null,_currentValue:G,_currentValue2:G,_threadCount:0};function bj(e,t,a,c,d,f,v,S,B){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=Ls(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ls(0),this.hiddenUpdates=Ls(null),this.identifierPrefix=c,this.onUncaughtError=d,this.onCaughtError=f,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=B,this.incompleteTransitions=new Map}function b_(e,t,a,c,d,f,v,S,B,oe,xe,Ne){return e=new bj(e,t,a,v,B,oe,xe,Ne,S),t=1,f===!0&&(t|=24),f=gs(3,null,null,t),e.current=f,f.stateNode=e,t=ku(),t.refCount++,e.pooledCache=t,t.refCount++,f.memoizedState={element:c,isDehydrated:a,cache:t},fc(f),e}function y_(e){return e?(e=ua,e):ua}function v_(e,t,a,c,d,f){d=y_(d),c.context===null?c.context=d:c.pendingContext=d,c=ma(t),c.payload={element:a},f=f===void 0?null:f,f!==null&&(c.callback=f),a=Gl(e,c,t),a!==null&&(gl(a,e,t),hc(a,e,t))}function j_(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function lp(e,t){j_(e,t),(e=e.alternate)&&j_(e,t)}function N_(e){if(e.tag===13||e.tag===31){var t=xi(e,67108864);t!==null&&gl(t,e,67108864),lp(e,67108864)}}function k_(e){if(e.tag===13||e.tag===31){var t=Ol();t=rn(t);var a=xi(e,t);a!==null&&gl(a,e,t),lp(e,t)}}var Xf=!0;function yj(e,t,a,c){var d=L.T;L.T=null;var f=z.p;try{z.p=2,ap(e,t,a,c)}finally{z.p=f,L.T=d}}function vj(e,t,a,c){var d=L.T;L.T=null;var f=z.p;try{z.p=8,ap(e,t,a,c)}finally{z.p=f,L.T=d}}function ap(e,t,a,c){if(Xf){var d=ip(c);if(d===null)Vm(e,t,c,Ff,a),S_(e,c);else if(Nj(d,e,t,a,c))c.stopPropagation();else if(S_(e,c),t&4&&-1<jj.indexOf(e)){for(;d!==null;){var f=K(d);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var v=Pt(f.pendingLanes);if(v!==0){var S=f;for(S.pendingLanes|=2,S.entangledLanes|=2;v;){var B=1<<31-Dt(v);S.entanglements[1]|=B,v&=~B}Qa(f),(Lt&6)===0&&(Tf=ot()+500,id(0))}}break;case 31:case 13:S=xi(f,2),S!==null&&gl(S,f,2),Mf(),lp(f,2)}if(f=ip(c),f===null&&Vm(e,t,c,Ff,a),f===d)break;d=f}d!==null&&c.stopPropagation()}else Vm(e,t,c,null,a)}}function ip(e){return e=bn(e),rp(e)}var Ff=null;function rp(e){if(Ff=null,e=zn(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 Ff=e,null}function w_(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(Fs()){case Vn:return 2;case Rn:return 8;case Mt:case $t:return 32;case an:return 268435456;default:return 32}default:return 32}}var cp=!1,Er=null,Cr=null,Tr=null,hd=new Map,md=new Map,Ar=[],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 S_(e,t){switch(e){case"focusin":case"focusout":Er=null;break;case"dragenter":case"dragleave":Cr=null;break;case"mouseover":case"mouseout":Tr=null;break;case"pointerover":case"pointerout":hd.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":md.delete(t.pointerId)}}function pd(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=K(t),t!==null&&N_(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 Er=pd(Er,e,t,a,c,d),!0;case"dragenter":return Cr=pd(Cr,e,t,a,c,d),!0;case"mouseover":return Tr=pd(Tr,e,t,a,c,d),!0;case"pointerover":var f=d.pointerId;return hd.set(f,pd(hd.get(f)||null,e,t,a,c,d)),!0;case"gotpointercapture":return f=d.pointerId,md.set(f,pd(md.get(f)||null,e,t,a,c,d)),!0}return!1}function E_(e){var t=zn(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,On(e.priority,function(){k_(a)});return}}else if(t===31){if(t=p(a),t!==null){e.blockedOn=t,On(e.priority,function(){k_(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 Kf(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=ip(e.nativeEvent);if(a===null){a=e.nativeEvent;var c=new a.constructor(a.type,a);la=c,a.target.dispatchEvent(c),la=null}else return t=K(a),t!==null&&N_(t),e.blockedOn=a,!1;t.shift()}return!0}function C_(e,t,a){Kf(e)&&a.delete(t)}function kj(){cp=!1,Er!==null&&Kf(Er)&&(Er=null),Cr!==null&&Kf(Cr)&&(Cr=null),Tr!==null&&Kf(Tr)&&(Tr=null),hd.forEach(C_),md.forEach(C_)}function Qf(e,t){e.blockedOn===t&&(e.blockedOn=null,cp||(cp=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,kj)))}var Zf=null;function T_(e){Zf!==e&&(Zf=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Zf===e&&(Zf=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(rp(c||a)===null)continue;break}var f=K(a);f!==null&&(e.splice(t,3),t-=3,Fu(f,{pending:!0,data:d,method:a.method,action:c},c,d))}}))}function Ho(e){function t(B){return Qf(B,e)}Er!==null&&Qf(Er,e),Cr!==null&&Qf(Cr,e),Tr!==null&&Qf(Tr,e),hd.forEach(t),md.forEach(t);for(var a=0;a<Ar.length;a++){var c=Ar[a];c.blockedOn===e&&(c.blockedOn=null)}for(;0<Ar.length&&(a=Ar[0],a.blockedOn===null);)E_(a),a.blockedOn===null&&Ar.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],v=d[un]||null;if(typeof f=="function")v||T_(a);else if(v){var S=null;if(f&&f.hasAttribute("formAction")){if(d=f,v=f[un]||null)S=v.formAction;else if(rp(d)!==null)continue}else S=v.action;typeof S=="function"?a[c+1]=S:(a.splice(c,3),c-=3),T_(a)}}}function A_(){function e(f){f.canIntercept&&f.info==="react-transition"&&f.intercept({handler:function(){return new Promise(function(v){return d=v})},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 op(e){this._internalRoot=e}Pf.prototype.render=op.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));var a=t.current,c=Ol();v_(a,c,e,t,null,null)},Pf.prototype.unmount=op.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;v_(e.current,2,null,e,null,null),Mf(),t[ds]=null}};function Pf(e){this._internalRoot=e}Pf.prototype.unstable_scheduleHydration=function(e){if(e){var t=cn();e={blockedOn:null,target:e,priority:t};for(var a=0;a<Ar.length&&t!==0&&t<Ar[a].priority;a++);Ar.splice(a,0,e),a===0&&E_(e)}};var M_=l.version;if(M_!=="19.2.8")throw Error(r(527,M_,"19.2.8"));z.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:L,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Wf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wf.isDisabled&&Wf.supportsFiber)try{nn=Wf.inject(wj),Zt=Wf}catch{}}return xd.createRoot=function(e,t){if(!o(e))throw Error(r(299));var a=!1,c="",d=Rl,f=_a,v=ba;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&&(v=t.onRecoverableError)),t=b_(e,1,!1,null,null,a,c,null,d,f,v,A_),e[ds]=t.current,Ym(e),new op(t)},xd.hydrateRoot=function(e,t,a){if(!o(e))throw Error(r(299));var c=!1,d="",f=Rl,v=_a,S=ba,B=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&&(v=a.onCaughtError),a.onRecoverableError!==void 0&&(S=a.onRecoverableError),a.formState!==void 0&&(B=a.formState)),t=b_(e,1,!0,t,a??null,c,d,B,f,v,S,A_),t.context=y_(null),a=t.current,c=Ol(),c=rn(c),d=ma(c),d.callback=null,Gl(a,d,c),a=c,t.current.lanes=a,us(t,a),Qa(t),e[ds]=t.current,Ym(e),new Pf(t)},xd.version="19.2.8",xd}var q_;function zj(){if(q_)return hp.exports;q_=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(),hp.exports=Oj(),hp.exports}var Ij=zj();const Iy=1,$i="main",G_=["skills","agents","hooks","commands","plugins","output-styles","CLAUDE.md","settings.json","keybindings.json"],Gi=["orange","blue","green","purple","pink","teal"],qo={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 bg=x.createContext({accounts:[],auth:{},multi:!1});function yg(){return x.useContext(bg)}function Hj(n,l="claude"){const{accounts:i,multi:r}=x.useContext(bg);return!r||l!==void 0&&l!=="claude"||!n?null:i.find(o=>o.id===n)??null}const bh={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 Sa({account:n,size:l="sm",className:i}){const r=`Аккаунт «${n.name}», ${bh[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 Y_({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 qi,Jo,eu,tu,nu,Id,su,qh,qy;class Yj{constructor(l){An(this,qh);An(this,qi,null);An(this,Jo,new Set);An(this,eu,500);An(this,tu,null);An(this,nu,!1);An(this,Id,null);An(this,su,null);this.url=l}get statusText(){return this.connected?"Хост на связи":"Нет связи с хостом"}onStatus(l){Ot(this,su,l)}connect(){if(Ke(this,nu))return;const l=new WebSocket(this.url);Ot(this,qi,l),l.addEventListener("open",()=>{var i,r;Ot(this,eu,500),this.send({type:"hello",protocol:Iy,clientName:"ccv-web"}),(i=Ke(this,Id))==null||i.call(this),(r=Ke(this,su))==null||r.call(this)}),l.addEventListener("message",i=>{let r;try{r=JSON.parse(String(i.data))}catch{return}for(const o of Ke(this,Jo))o(r)}),l.addEventListener("close",()=>{var i;Ot(this,qi,null),(i=Ke(this,su))==null||i.call(this),Wn(this,qh,qy).call(this)}),l.addEventListener("error",()=>l.close())}onReconnect(l){Ot(this,Id,l)}on(l){return Ke(this,Jo).add(l),()=>Ke(this,Jo).delete(l)}send(l){var i;((i=Ke(this,qi))==null?void 0:i.readyState)===WebSocket.OPEN&&Ke(this,qi).send(JSON.stringify(l))}get connected(){var l;return((l=Ke(this,qi))==null?void 0:l.readyState)===WebSocket.OPEN}close(){var l;Ot(this,nu,!0),(l=Ke(this,qi))==null||l.close()}}qi=new WeakMap,Jo=new WeakMap,eu=new WeakMap,tu=new WeakMap,nu=new WeakMap,Id=new WeakMap,su=new WeakMap,qh=new WeakSet,qy=function(){if(Ke(this,nu)||Ke(this,tu)!==null)return;const l=Ke(this,eu);Ot(this,eu,Math.min(l*2,1e4)),Ot(this,tu,window.setTimeout(()=>{Ot(this,tu,null),this.connect()},l))};const Vj=1,Gy="ccv:relay",yh="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 si,lu,li,au,iu,Br,Dc,Lc,Hr,Oc,ru,zc,Ic,gn,Or,Yp,Vy,Cc,Vp;class Fj{constructor(l){An(this,gn);An(this,si,null);An(this,lu,new Set);An(this,li,null);An(this,au,null);An(this,iu,500);An(this,Br,null);An(this,Dc,!1);An(this,Lc,!1);An(this,Hr,!1);An(this,Oc,null);An(this,ru,"Подключаемся…");An(this,zc,0);An(this,Ic,[]);this.session=l}get connected(){return Ke(this,Lc)&&Ke(this,Hr)}get statusText(){return Ke(this,ru)}get hostId(){return Ke(this,Oc)}on(l){return Ke(this,lu).add(l),()=>Ke(this,lu).delete(l)}onReconnect(l){Ot(this,au,l)}onStatus(l){Ot(this,li,l)}connect(){Ke(this,Dc)||Wn(this,gn,Yp).call(this)}send(l){if(!Ke(this,Lc)){Ke(this,Ic).length<64&&Ke(this,Ic).push(l);return}Wn(this,gn,Cc).call(this,{t:"client.frame",body:l})}close(){var l;Ot(this,Dc,!0),Ke(this,Br)!==null&&window.clearTimeout(Ke(this,Br)),(l=Ke(this,si))==null||l.close()}}si=new WeakMap,lu=new WeakMap,li=new WeakMap,au=new WeakMap,iu=new WeakMap,Br=new WeakMap,Dc=new WeakMap,Lc=new WeakMap,Hr=new WeakMap,Oc=new WeakMap,ru=new WeakMap,zc=new WeakMap,Ic=new WeakMap,gn=new WeakSet,Or=function(l){var i;Ke(this,ru)!==l&&(Ot(this,ru,l),(i=Ke(this,li))==null||i.call(this))},Yp=async function(){if(Ke(this,si))return;if(!Ke(this,Oc))try{Ot(this,Oc,await Kj(this.session.token))}catch(r){Wn(this,gn,Or).call(this,r instanceof Error?r.message:String(r)),Wn(this,gn,Vp).call(this);return}const l=location.protocol==="https:"?"wss":"ws",i=new WebSocket(`${l}://${location.host}/relay/client`);Ot(this,si,i),i.addEventListener("open",()=>{Wn(this,gn,Cc).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}Wn(this,gn,Vy).call(this,o)}),i.addEventListener("close",()=>{var r;Ot(this,si,null),Ot(this,Lc,!1),Ot(this,Hr,!1),Wn(this,gn,Or).call(this,"Нет связи с сервером"),(r=Ke(this,li))==null||r.call(this),Wn(this,gn,Vp).call(this)}),i.addEventListener("error",()=>i.close())},Vy=function(l){var i,r,o,u,m,p,g;switch(l.t){case"client.ok":Ot(this,iu,500),Wn(this,gn,Cc).call(this,{t:"client.attach",hostId:Ke(this,Oc)??"",...Ke(this,zc)>0?{sinceRseq:Ke(this,zc)}:{}});return;case"client.attached":Ot(this,Lc,!0),Ot(this,Hr,l.online),Ot(this,zc,l.rseq),Wn(this,gn,Or).call(this,l.online?"Хост на связи":"Компьютер не на связи"),Wn(this,gn,Cc).call(this,{t:"client.frame",body:{type:"hello",protocol:Iy,clientName:"ccv-web-relay"}});const _=Ke(this,Ic);Ot(this,Ic,[]);for(const b of _)Wn(this,gn,Cc).call(this,{t:"client.frame",body:b});(i=Ke(this,au))==null||i.call(this),(r=Ke(this,li))==null||r.call(this);return;case"host.frame":{l.rseq>0&&Ot(this,zc,l.rseq);const b=l.body;for(const j of Ke(this,lu))j(b);return}case"host.online":Ot(this,Hr,!0),Wn(this,gn,Or).call(this,"Хост на связи"),(o=Ke(this,au))==null||o.call(this),(u=Ke(this,li))==null||u.call(this);return;case"host.offline":Ot(this,Hr,!1),Wn(this,gn,Or).call(this,"Компьютер не на связи"),(m=Ke(this,li))==null||m.call(this);return;case"ping":Wn(this,gn,Cc).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(yh),Wn(this,gn,Or).call(this,"Этот компьютер отвязан от аккаунта"),Ot(this,Dc,!0),(p=Ke(this,si))==null||p.close();return}l.code!=="offline"&&Wn(this,gn,Or).call(this,l.message),(g=Ke(this,li))==null||g.call(this);return}},Cc=function(l){var i;((i=Ke(this,si))==null?void 0:i.readyState)===WebSocket.OPEN&&Ke(this,si).send(JSON.stringify(l))},Vp=function(){if(Ke(this,Dc)||Ke(this,Br)!==null)return;const l=Ke(this,iu);Ot(this,iu,Math.min(l*2,1e4)),Ot(this,Br,window.setTimeout(()=>{Ot(this,Br,null),Wn(this,gn,Yp).call(this)},l))};async function Kj(n){const l=new URLSearchParams(location.search).get("host");if(l)return localStorage.setItem(yh,l),l;const i=localStorage.getItem(yh);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(yh,u[0].id),u[0].id;throw location.href="/hosts",new Error("выберите компьютер")}function vh(){return location.pathname==="/app"||location.pathname.startsWith("/app/")?"relay":"local"}const Qj=`${location.protocol==="https:"?"wss":"ws"}://${location.host}/ws`;function Zj(){if(vh()==="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 vg(){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 xp(n){return vg().get(n)??""}function Ky(n,l){const i=vg(),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=[...vg().keys(),...Ac.keys()];for(const i of l)n.add(i.startsWith("side:")?i.slice(5):i);return[...n].sort()}const Ac=new Map;function _p(n){return Ac.get(n)??{images:[],docs:[]}}function V_(n,l){for(Ac.delete(n),(l.images.length>0||l.docs.length>0)&&Ac.set(n,l);Ac.size>Fy;){const i=Ac.keys().next();if(i.done)break;Ac.delete(i.value)}Zy()}const Xp=new Set;let X_="";function Jj(n){return Xp.add(n),()=>Xp.delete(n)}function Zy(){const n=Qy(),l=n.join(`
51
+ `);if(l!==X_){X_=l;for(const i of Xp)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 Ys={items:[],pending:[],lastSeq:0,contextTokens:null},bp={entries:[],total:0,loading:!1};function Wy(n){var l;return((l=n.entries[0])==null?void 0:l.seq)??1}function yp(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 jh(Ys,n).items.map(l=>({...l,id:`h:${l.id}`}))}function jh(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 Za(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 Za(n,{id:l.blockId,kind:"assistant",text:l.text,streaming:!0});const p=r[m];return Go(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?Za(n,p):Go(n,m,p)}case"thinking.delta":{const m=r.findIndex(g=>g.id===l.blockId);if(m===-1)return Za(n,{id:l.blockId,kind:"thinking",text:l.text});const p=r[m];return Go(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?Za(n,p):Go(n,m,p)}case"tool.use":return Za(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 Go(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 Go({...n,pending:p},g,{..._,answers:l.answers})}}return l.decision==="allow"?{...n,pending:p}:Za({...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 Za({...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:Za(n,{id:`s${i}`,kind:"notice",tone:"info",text:"Контекст сжат"});case"error":return Za(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 Za(n,l){return{...n,items:[...n.items,l]}}function Go(n,l,i){const r=n.items.slice();return r[l]=i,{...n,items:r}}const Fp="ccv:theme",vp=["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(Fp,o)}catch{}l(o)},[]),r=x.useCallback(()=>{l(o=>{const u=vp[(vp.indexOf(o)+1)%vp.length];try{localStorage.setItem(Fp,u)}catch{}return u})},[]);return[n,i,r]}function r1(){try{const n=localStorage.getItem(Fp);if(n==="light"||n==="dark"||n==="system")return n}catch{}return"system"}const jg=[{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 Jn(n){return n==null||n==="claude"}function F_(n){return n==="antigravity"?"Antigravity":n==="codex"?"Codex":"Claude"}const Uc={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=Uc[n];return Math.round(Math.min(i.max,Math.max(i.min,l)))}function f1(){const n={};for(const l of Object.keys(Uc))n[l]=Uc[l].width;try{const l=localStorage.getItem(Jy);if(l){const i=JSON.parse(l);for(const r of Object.keys(Uc)){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]:Uc[m].width};return i(g),g})},[i]),u={};for(const m of Object.keys(Uc))u[d1(m)]=`${n[m]}px`;return{widths:n,style:u,setWidth:r,reset:o}}const jp=260,t0=120,m1=200,K_="ccv:terminal-h";function Q_(n,l){return Math.round(Math.min(l,Math.max(t0,n)))}function p1(){const[n,l]=x.useState(()=>{try{const u=localStorage.getItem(K_);if(u){const m=Number(u);if(Number.isFinite(m))return Q_(m,1/0)}}catch{}return jp}),i=x.useCallback(u=>{try{localStorage.setItem(K_,String(u))}catch{}},[]),r=x.useCallback((u,m)=>{const p=Q_(u,m);l(g=>g===p?g:(i(p),p))},[i]),o=x.useCallback(()=>{l(jp),i(jp)},[i]);return{height:n,setHeight:r,reset:o}}function Ud(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(C=>{if(i||C.button!==0)return;const E={timer:0,x:C.clientX,y:C.clientY,fired:!1};E.timer=window.setTimeout(()=>{E.fired=!0,p(!1),n()},r),u.current=E,p(!0)},[i,r,n]),b=x.useCallback(C=>{const E=u.current;!E||E.fired||Math.hypot(C.clientX-E.x,C.clientY-E.y)>o&&g()},[o,g]),j=x.useCallback(()=>{u.current&&!u.current.fired?g():p(!1)},[g]),N=x.useCallback(C=>{var E;if((E=u.current)!=null&&E.fired){u.current=null,C.preventDefault();return}if(!i){if(C.shiftKey){n();return}l()}},[i,l,n]),w=x.useCallback(C=>{C.preventDefault()},[]),k=x.useCallback(C=>{i||C.shiftKey&&(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),n())},[i,n]);return{holding:m,thresholdMs:r,handlers:{onPointerDown:_,onPointerMove:b,onPointerUp:j,onPointerCancel:j,onPointerLeave:j,onClick:N,onContextMenu:w,onKeyDown:k}}}const _1={height:0,offsetTop:0,offsetLeft:0};function Z_(){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(Z_);return x.useEffect(()=>{if(!n)return;const r=window.visualViewport,o=()=>{const u=Z_();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 Ng(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Hc=Ng();function s0(n){Hc=n}var Mc={exec:()=>null};function Yo(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 jt(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(Vs.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}})(),Vs={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:Yo(n=>new RegExp(`^ {0,${n}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Yo(n=>new RegExp(`^ {0,${n}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Yo(n=>new RegExp(`^ {0,${n}}(?:\`\`\`|~~~)`)),headingBeginRegex:Yo(n=>new RegExp(`^ {0,${n}}#`)),htmlBeginRegex:Yo(n=>new RegExp(`^ {0,${n}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Yo(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|$)|$)/,$d=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,k1=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,kg=/ {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=jt(l0).replace(/bull/g,kg).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=jt(l0).replace(/bull/g,kg).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(),wg=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,S1=/^[^\n]+/,Sg=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,E1=jt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Sg).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),C1=jt(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,kg).getRegex(),Gh="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",Eg=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,T1=jt("^ {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",Eg).replace("tag",Gh).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),i0=n=>jt(wg).replace("hr",$d).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",Gh).getRegex(),A1=i0(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),M1=i0(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),R1=jt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",M1).getRegex(),Cg={blockquote:R1,code:j1,def:E1,fences:N1,heading:k1,hr:$d,html:T1,lheading:a0,list:C1,newline:v1,paragraph:A1,table:Mc,text:S1},P_=jt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",$d).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",Gh).getRegex(),D1={...Cg,lheading:w1,table:P_,paragraph:jt(wg).replace("hr",$d).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",P_).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",Gh).getRegex()},L1={...Cg,html:jt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Eg).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:Mc,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:jt(wg).replace("hr",$d).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)))/,cu=/[\p{P}\p{S}]/u,Yh=/[\s\p{P}\p{S}]/u,Tg=/[^\s\p{P}\p{S}]/u,U1=jt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Yh).getRegex(),c0=/(?!~)[\p{P}\p{S}]/u,$1=/(?!~)[\s\p{P}\p{S}]/u,B1=/(?:[^\s\p{P}\p{S}]|~)/u,H1=jt(/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=jt(o0,"u").replace(/punct/g,cu).getRegex(),G1=jt(o0,"u").replace(/punct/g,c0).getRegex(),u0="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Y1=jt(u0,"gu").replace(/notPunctSpace/g,Tg).replace(/punctSpace/g,Yh).replace(/punct/g,cu).getRegex(),V1=jt(u0,"gu").replace(/notPunctSpace/g,B1).replace(/punctSpace/g,$1).replace(/punct/g,c0).getRegex(),X1=jt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Tg).replace(/punctSpace/g,Yh).replace(/punct/g,cu).getRegex(),F1=jt(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,cu).getRegex(),K1="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Q1=jt(K1,"gu").replace(/notPunctSpace/g,Tg).replace(/punctSpace/g,Yh).replace(/punct/g,cu).getRegex(),Z1=jt(/\\(punct)/,"gu").replace(/punct/g,cu).getRegex(),P1=jt(/^<(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=jt(Eg).replace("(?:-->|$)","-->").getRegex(),J1=jt("^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(),Th=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,eN=jt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Th).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),d0=jt(/^!?\[(label)\]\[(ref)\]/).replace("label",Th).replace("ref",Sg).getRegex(),f0=jt(/^!?\[(ref)\](?:\[\])?/).replace("ref",Sg).getRegex(),tN=jt("reflink|nolink(?!\\()","g").replace("reflink",d0).replace("nolink",f0).getRegex(),W_=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ag={_backpedal:Mc,anyPunctuation:Z1,autolink:P1,blockSkip:H1,br:r0,code:z1,del:Mc,delLDelim:Mc,delRDelim:Mc,emStrongLDelim:q1,emStrongRDelimAst:Y1,emStrongRDelimUnd:X1,escape:O1,link:eN,nolink:f0,punctuation:U1,reflink:d0,reflinkSearch:tN,tag:J1,text:I1,url:Mc},nN={...Ag,link:jt(/^!?\[(label)\]\((.*?)\)/).replace("label",Th).getRegex(),reflink:jt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Th).getRegex()},Kp={...Ag,emStrongRDelimAst:V1,emStrongLDelim:G1,delLDelim:F1,delRDelim:Q1,url:jt(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",W_).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:jt(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",W_).getRegex()},sN={...Kp,br:jt(r0).replace("{2,}","*").getRegex(),text:jt(Kp.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Jf={normal:Cg,gfm:D1,pedantic:L1},_d={normal:Ag,gfm:Kp,breaks:sN,pedantic:nN},lN={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},J_=n=>lN[n];function ei(n,l){if(l){if(Vs.escapeTest.test(n))return n.replace(Vs.escapeReplace,J_)}else if(Vs.escapeTestNoEncode.test(n))return n.replace(Vs.escapeReplaceNoEncode,J_);return n}function eb(n){try{n=encodeURI(n).replace(Vs.percentDecode,"%")}catch{return null}return n}function tb(n,l){var u;let i=n.replace(Vs.findPipe,(m,p,g)=>{let _=!1,b=p;for(;--b>=0&&g[b]==="\\";)_=!_;return _?"|":" |"}),r=i.split(Vs.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(Vs.slashPipe,"|");return r}function Rr(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 nb(n){let l=n.split(`
53
+ `),i=l.length-1;for(;i>=0&&Vs.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 sb(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 Ah=class{constructor(n){Qt(this,"options");Qt(this,"rules");Qt(this,"lexer");this.options=n||Hc}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]:nb(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=Rr(i,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(i=r.trim())}return{type:"heading",raw:Rr(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:Rr(l[0],`
58
+ `)}}blockquote(n){let l=this.rules.block.blockquote.exec(n);if(l){let i=Rr(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 N=u.at(-1);if((N==null?void 0:N.type)==="code")break;if((N==null?void 0:N.type)==="blockquote"){let w=N,k=w.raw+`
65
+ `+i.join(`
66
+ `),C=this.blockquote(k);u[u.length-1]=C,r=r.substring(0,r.length-w.raw.length)+C.raw,o=o.substring(0,o.length-w.text.length)+C.text;break}else if((N==null?void 0:N.type)==="list"){let w=N,k=w.raw+`
67
+ `+i.join(`
68
+ `),C=this.list(k);u[u.length-1]=C,r=r.substring(0,r.length-N.raw.length)+C.raw,o=o.substring(0,o.length-w.raw.length)+C.raw,i=k.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),N=n.split(`
71
+ `,1)[0],w=!j.trim(),k=0;if(this.options.pedantic?(k=2,b=j.trimStart()):w?k=l[1].length+1:(k=j.search(this.rules.other.nonSpaceChar),k=k>4?1:k,b=j.slice(k),k+=l[1].length),w&&this.rules.other.blankLine.test(N)&&(_+=N+`
72
+ `,n=n.substring(N.length+1),g=!0),!g){let C=this.rules.other.nextBulletRegex(k),E=this.rules.other.hrRegex(k),O=this.rules.other.fencesBeginRegex(k),R=this.rules.other.headingBeginRegex(k),H=this.rules.other.htmlBeginRegex(k),te=this.rules.other.blockquoteBeginRegex(k);for(;n;){let Q=n.split(`
73
+ `,1)[0],D;if(N=Q,this.options.pedantic?(N=N.replace(this.rules.other.listReplaceNesting," "),D=N):D=N.replace(this.rules.other.tabCharGlobal," "),O.test(N)||R.test(N)||H.test(N)||te.test(N)||C.test(N)||E.test(N))break;if(D.search(this.rules.other.nonSpaceChar)>=k||!N.trim())b+=`
74
+ `+D.slice(k);else{if(w||j.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||O.test(j)||R.test(j)||E.test(j))break;b+=`
75
+ `+N}w=!N.trim(),_+=Q+`
76
+ `,n=n.substring(Q.length+1),j=D.slice(k)}}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(N=>N.type==="space"),j=b.length>0&&b.some(N=>this.rules.other.anyLine.test(N.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=nb(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:Rr(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=tb(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:Rr(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(tb(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:Rr(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=Rr(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)),sb(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 sb(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 w=j.slice(1,-1);return{type:"em",raw:j,text:w,tokens:this.lexer.inlineTokens(w)}}let N=j.slice(2,-2);return{type:"strong",raw:j,text:N,tokens:this.lexer.inlineTokens(N)}}}}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}}}},ka=class Qp{constructor(l){Qt(this,"tokens");Qt(this,"options");Qt(this,"state");Qt(this,"inlineQueue");Qt(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=l||Hc,this.options.tokenizer=this.options.tokenizer||new Ah,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:Vs,block:Jf.normal,inline:_d.normal};this.options.pedantic?(i.block=Jf.pedantic,i.inline=_d.pedantic):this.options.gfm&&(i.block=Jf.gfm,this.options.breaks?i.inline=_d.breaks:i.inline=_d.gfm),this.tokenizer.rules=i}static get rules(){return{block:Jf,inline:_d}}static lex(l,i){return new Qp(i).lex(l)}static lexInline(l,i){return new Qp(i).inlineTokens(l)}lex(l){l=l.replace(Vs.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(Vs.tabCharGlobal," ").replace(Vs.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),N;this.options.extensions.startBlock.forEach(w=>{N=w.call({lexer:this},j),typeof N=="number"&&N>=0&&(b=Math.min(b,N))}),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 N=Object.keys(this.tokens.links);N.length>0&&(r=r.replace(this.tokenizer.rules.inline.reflinkSearch,w=>N.includes(w.slice(w.lastIndexOf("[")+1,-1))?"["+"a".repeat(w.length-2)+"]":w))}r=r.replace(this.tokenizer.rules.inline.anyPunctuation,"++"),r=r.replace(this.tokenizer.rules.inline.blockSkip,(N,w,k)=>{let C=k?k.length:0;return N.slice(0,C)+"["+"a".repeat(N.length-C-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 N;if((b=(_=this.options.extensions)==null?void 0:_.inline)!=null&&b.some(k=>(N=k.call({lexer:this},l,i))?(l=l.substring(N.raw.length),i.push(N),!0):!1))continue;if(N=this.tokenizer.escape(l)){l=l.substring(N.raw.length),i.push(N);continue}if(N=this.tokenizer.tag(l)){l=l.substring(N.raw.length),i.push(N);continue}if(N=this.tokenizer.link(l)){l=l.substring(N.raw.length),i.push(N);continue}if(N=this.tokenizer.reflink(l,this.tokens.links)){l=l.substring(N.raw.length);let k=i.at(-1);N.type==="text"&&(k==null?void 0:k.type)==="text"?(k.raw+=N.raw,k.text+=N.text):i.push(N);continue}if(N=this.tokenizer.emStrong(l,r,u)){l=l.substring(N.raw.length),i.push(N);continue}if(N=this.tokenizer.codespan(l)){l=l.substring(N.raw.length),i.push(N);continue}if(N=this.tokenizer.br(l)){l=l.substring(N.raw.length),i.push(N);continue}if(N=this.tokenizer.del(l,r,u)){l=l.substring(N.raw.length),i.push(N);continue}if(N=this.tokenizer.autolink(l)){l=l.substring(N.raw.length),i.push(N);continue}if(!this.state.inLink&&(N=this.tokenizer.url(l))){l=l.substring(N.raw.length),i.push(N);continue}let w=l;if((j=this.options.extensions)!=null&&j.startInline){let k=1/0,C=l.slice(1),E;this.options.extensions.startInline.forEach(O=>{E=O.call({lexer:this},C),typeof E=="number"&&E>=0&&(k=Math.min(k,E))}),k<1/0&&k>=0&&(w=l.substring(0,k+1))}if(N=this.tokenizer.inlineText(w)){l=l.substring(N.raw.length),N.raw.slice(-1)!=="_"&&(u=N.raw.slice(-1)),o=!0;let k=i.at(-1);(k==null?void 0:k.type)==="text"?(k.raw+=N.raw,k.text+=N.text):i.push(N);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)}},Mh=class{constructor(n){Qt(this,"options");Qt(this,"parser");this.options=n||Hc}space(n){return""}code({text:n,lang:l,escaped:i}){var u;let r=(u=(l||"").match(Vs.notSpaceStart))==null?void 0:u[0],o=n.replace(Vs.endingNewline,"")+`
96
+ `;return r?'<pre><code class="language-'+ei(r)+'">'+(i?o:ei(o,!0))+`</code></pre>
97
+ `:"<pre><code>"+(i?o:ei(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>${ei(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=eb(n);if(o===null)return r;n=o;let u='<a href="'+n+'"';return l&&(u+=' title="'+ei(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=eb(n);if(o===null)return ei(i);n=o;let u=`<img src="${n}" alt="${ei(i)}"`;return l&&(u+=` title="${ei(l)}"`),u+=">",u}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:ei(n.text)}},Mg=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}},wa=class Zp{constructor(l){Qt(this,"options");Qt(this,"renderer");Qt(this,"textRenderer");this.options=l||Hc,this.options.renderer=this.options.renderer||new Mh,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Mg}static parse(l,i){return new Zp(i).parse(l)}static parseInline(l,i){return new Zp(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}},_h,Sd=(_h=class{constructor(n){Qt(this,"options");Qt(this,"block");this.options=n||Hc}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(n=this.block){return n?ka.lex:ka.lexInline}provideParser(n=this.block){return n?wa.parse:wa.parseInline}},Qt(_h,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),Qt(_h,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),_h),cN=class{constructor(...n){Qt(this,"defaults",Ng());Qt(this,"options",this.setOptions);Qt(this,"parse",this.parseMarkdown(!0));Qt(this,"parseInline",this.parseMarkdown(!1));Qt(this,"Parser",wa);Qt(this,"Renderer",Mh);Qt(this,"TextRenderer",Mg);Qt(this,"Lexer",ka);Qt(this,"Tokenizer",Ah);Qt(this,"Hooks",Sd);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 Mh(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 Ah(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 Sd;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];Sd.passThroughHooks.has(u)?o[m]=_=>{if(this.defaults.async&&Sd.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 ka.lex(n,l??this.defaults)}parser(n,l){return wa.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?ka.lex:ka.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?wa.parse:wa.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?ka.lex:ka.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?wa.parse:wa.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>"+ei(i.message+"",!0)+"</pre>";return l?Promise.resolve(r):r}if(l)return Promise.reject(i);throw i}}},Bc=new cN;function zt(n,l){return Bc.parse(n,l)}zt.options=zt.setOptions=function(n){return Bc.setOptions(n),zt.defaults=Bc.defaults,s0(zt.defaults),zt};zt.getDefaults=Ng;zt.defaults=Hc;zt.use=function(...n){return Bc.use(...n),zt.defaults=Bc.defaults,s0(zt.defaults),zt};zt.walkTokens=function(n,l){return Bc.walkTokens(n,l)};zt.parseInline=Bc.parseInline;zt.Parser=wa;zt.parser=wa.parse;zt.Renderer=Mh;zt.TextRenderer=Mg;zt.Lexer=ka;zt.lexer=ka.lex;zt.Tokenizer=Ah;zt.Hooks=Sd;zt.parse=zt;zt.options;zt.setOptions;zt.use;zt.walkTokens;zt.parseInline;wa.parse;ka.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 lb(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 lb(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)?lb(n,l):void 0}}const h0=Object.entries,ab=Object.setPrototypeOf,mN=Object.isFrozen,m0=Object.getPrototypeOf,p0=Object.getOwnPropertyDescriptor;let ys=Object.freeze,Ds=Object.seal,Vo=Object.create,g0=typeof Reflect<"u"&&Reflect,Pp=g0.apply,Wp=g0.construct;ys||(ys=function(l){return l});Ds||(Ds=function(l){return l});Pp||(Pp=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)});Wp||(Wp=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 Ii=Nn(Array.prototype.forEach),pN=Nn(Array.prototype.lastIndexOf),ib=Nn(Array.prototype.pop),bd=Nn(Array.prototype.push),gN=Nn(Array.prototype.slice),xN=Nn(Array.prototype.splice),Zo=Array.isArray,Np=x0(Set),kp=Nn(Set.prototype.add),yd=Nn(Set.prototype.has),Tc=Nn(String.prototype.toLowerCase),wp=Nn(String.prototype.toString),rb=Nn(String.prototype.match),vd=Nn(String.prototype.replace),cb=Nn(String.prototype.indexOf),_N=Nn(String.prototype.trim),bN=Nn(Number.prototype.toString),yN=Nn(Boolean.prototype.toString),ob=typeof BigInt>"u"?null:Nn(BigInt.prototype.toString),ub=typeof Symbol>"u"?null:Nn(Symbol.prototype.toString),xl=Nn(Object.prototype.hasOwnProperty),jd=Nn(Object.prototype.toString),Rs=Nn(RegExp.prototype.test),Ui=x0(TypeError);function Nn(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 Pp(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 Wp(n,i)}}function wt(n,l){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Tc;if(ab&&ab(n,null),!Zo(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++)xl(n,l)||(n[l]=null);return n}function zl(n){const l=Vo(null);for(const r of h0(n)){var i=fN(r,2);const o=i[0],u=i[1];xl(n,o)&&(Zo(u)?l[o]=vN(u):u&&typeof u=="object"&&u.constructor===Object?l[o]=zl(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 ob?ob(n):"0";case"symbol":return ub?ub(n):"Symbol()";case"undefined":return jd(n);case"function":case"object":{if(n===null)return jd(n);const l=n,i=Kl(l,"toString");if(typeof i=="function"){const r=i(l);return typeof r=="string"?r:jd(r)}return jd(n)}default:return jd(n)}}function Kl(n,l){for(;n!==null;){const r=p0(n,l);if(r){if(r.get)return Nn(r.get);if(typeof r.value=="function")return Nn(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?Nn(i.get):null;n=m0(n)}return null}function kN(n){try{return Rs(n,""),!0}catch{return!1}}const db=ys(["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"]),Sp=ys(["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"]),Ep=ys(["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=ys(["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"]),Cp=ys(["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=ys(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),fb=ys(["#text"]),hb=ys(["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"]),Tp=ys(["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"]),mb=ys(["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"]),eh=ys(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),EN=Ds(/{{[\w\W]*|^[\w\W]*}}/g),CN=Ds(/<%[\w\W]*|^[\w\W]*%>/g),TN=Ds(/\${[\w\W]*/g),AN=Ds(/^data-[\-\w.\u00B7-\uFFFF]+$/),MN=Ds(/^aria-[\-\w]+$/),pb=Ds(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),RN=Ds(/^(?:\w+script|data):/i),DN=Ds(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),LN=Ds(/^html$/i),ON=Ds(/^[a-z][.\w]*(-[.\w]+)+$/i),Ap=Ds(/<[/\w!]/g),gb=Ds(/<[/\w]/g),zN=Ds(/<\/no(script|embed|frames)/i),xb=Ds(/\/>/i),es={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=ys(wt({},["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}},_b=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Dr=function(l,i,r,o){return xl(l,i)&&Zo(l[i])?wt(o.base?zl(o.base):{},l[i],o.transform):r},Mp=function(l,i,r){const o=xl(l,i)?l[i]:void 0;return o&&typeof o=="object"?zl(o):r()};function _0(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:UN();const l=je=>_0(je);if(l.version="3.4.17",l.removed=[],!n||!n.document||n.document.nodeType!==es.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,N=Kl(j,"cloneNode"),w=Kl(j,"remove"),k=Kl(j,"removeAttributeNode"),C=Kl(j,"nextSibling"),E=Kl(j,"childNodes"),O=Kl(j,"parentNode"),R=Kl(j,"shadowRoot"),H=Kl(j,"attributes"),te=m&&m.prototype?Kl(m.prototype,"nodeType"):null,Q=m&&m.prototype?Kl(m.prototype,"nodeName"):null,D=m&&m.prototype?Kl(m.prototype,"ownerDocument"):null,$=function(y){return te?te(y):y.nodeType},ne=function(y){return Q?Q(y):y.nodeName},Y=NN(j,"namespaceURI"),q=function(y){return Y?Y(y):y.namespaceURI};if(typeof u=="function"){const je=i.createElement("template");je.content&&je.content.ownerDocument&&(i=je.content.ownerDocument)}let I,V="",pe,J=!1,le=0;const L=function(){if(le>0)throw Ui('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.')},z=function(y){L(),le++;try{return I.createHTML(y)}finally{le--}},G=function(y){L(),le++;try{return I.createScriptURL(y)}finally{le--}},ie=function(){return J||(pe=$N(b,o),J=!0),pe},de=i,A=de.implementation,F=de.createNodeIterator,U=de.createDocumentFragment,ye=de.getElementsByTagName,W=r.importNode;let fe=_b();l.isSupported=typeof h0=="function"&&typeof O=="function"&&A&&A.createHTMLDocument!==void 0;const Le=EN,lt=CN,ke=TN,Be=AN,Ye=MN,Qe=RN,qn=DN,We=ON;let _n=pb,Ge=null;const ct=wt({},[...db,...Sp,...Ep,...Cp,...fb]);let nt=null;const It=wt({},[...hb,...Tp,...mb,...eh]);let Se=Object.seal(Vo(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}})),rt=null,kn=null;const Ut=Object.seal(Vo(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ot=!0,Fs=!0,Vn=!1,Rn=!0,Mt=!1,$t=!0,an=!1,bt=!1,Rt=null,nn=null,Zt=!1,St=!1,Dt=!1,Xn=!1,ge=!0,Ee=!1;const Ve="user-content-";let et=!0,Pe=!1,Pt=null,st={},ut=null;const vs=wt({},["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 Dn=null;const Ls=wt({},["audio","video","img","source","image","track"]);let us=null;const wn=wt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ln="http://www.w3.org/1998/Math/MathML",Os="http://www.w3.org/2000/svg",sn="http://www.w3.org/1999/xhtml";let rn=sn,ts=!1,cn=null;const On=wt({},[Ln,Os,sn],wp),on=ys(["mi","mo","mn","ms","mtext"]);let yt=wt({},on);const un=ys(["annotation-xml"]);let ds=wt({},un);const fs=wt({},["title","style","font","a","script"]);let Ks=null;const yl=["application/xhtml+xml","text/html"],vl="text/html";let vt=null,zs=null;const zn=i.createElement("form"),K=function(y){return y instanceof RegExp||y instanceof Function},me=function(){let y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(zs&&zs===y)return;(!y||typeof y!="object")&&(y={}),y=zl(y),Ks=yl.indexOf(y.PARSER_MEDIA_TYPE)===-1?vl:y.PARSER_MEDIA_TYPE,vt=Ks==="application/xhtml+xml"?wp:Tc,Ge=Dr(y,"ALLOWED_TAGS",ct,{transform:vt}),nt=Dr(y,"ALLOWED_ATTR",It,{transform:vt}),cn=Dr(y,"ALLOWED_NAMESPACES",On,{transform:wp}),us=Dr(y,"ADD_URI_SAFE_ATTR",wn,{transform:vt,base:wn}),Dn=Dr(y,"ADD_DATA_URI_TAGS",Ls,{transform:vt,base:Ls}),ut=Dr(y,"FORBID_CONTENTS",vs,{transform:vt}),rt=Dr(y,"FORBID_TAGS",zl({}),{transform:vt}),kn=Dr(y,"FORBID_ATTR",zl({}),{transform:vt}),st=xl(y,"USE_PROFILES")?y.USE_PROFILES&&typeof y.USE_PROFILES=="object"?zl(y.USE_PROFILES):y.USE_PROFILES:!1,ot=y.ALLOW_ARIA_ATTR!==!1,Fs=y.ALLOW_DATA_ATTR!==!1,Vn=y.ALLOW_UNKNOWN_PROTOCOLS||!1,Rn=y.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Mt=y.SAFE_FOR_TEMPLATES||!1,$t=y.SAFE_FOR_XML!==!1,an=y.WHOLE_DOCUMENT||!1,St=y.RETURN_DOM||!1,Dt=y.RETURN_DOM_FRAGMENT||!1,Xn=y.RETURN_TRUSTED_TYPE||!1,Zt=y.FORCE_BODY||!1,ge=y.SANITIZE_DOM!==!1,Ee=y.SANITIZE_NAMED_PROPS||!1,et=y.KEEP_CONTENT!==!1,Pe=y.IN_PLACE||!1,_n=kN(y.ALLOWED_URI_REGEXP)?y.ALLOWED_URI_REGEXP:pb,rn=typeof y.NAMESPACE=="string"?y.NAMESPACE:sn,yt=Mp(y,"MATHML_TEXT_INTEGRATION_POINTS",()=>wt({},on)),ds=Mp(y,"HTML_INTEGRATION_POINTS",()=>wt({},un));const T=Mp(y,"CUSTOM_ELEMENT_HANDLING",()=>Vo(null));if(Se=Vo(null),xl(T,"tagNameCheck")&&K(T.tagNameCheck)&&(Se.tagNameCheck=T.tagNameCheck),xl(T,"attributeNameCheck")&&K(T.attributeNameCheck)&&(Se.attributeNameCheck=T.attributeNameCheck),xl(T,"allowCustomizedBuiltInElements")&&typeof T.allowCustomizedBuiltInElements=="boolean"&&(Se.allowCustomizedBuiltInElements=T.allowCustomizedBuiltInElements),Ds(Se),Mt&&(Fs=!1),Dt&&(St=!0),st&&(Ge=wt({},fb),nt=Vo(null),st.html===!0&&(wt(Ge,db),wt(nt,hb)),st.svg===!0&&(wt(Ge,Sp),wt(nt,Tp),wt(nt,eh)),st.svgFilters===!0&&(wt(Ge,Ep),wt(nt,Tp),wt(nt,eh)),st.mathMl===!0&&(wt(Ge,Cp),wt(nt,mb),wt(nt,eh))),Ut.tagCheck=null,Ut.attributeCheck=null,xl(y,"ADD_TAGS")&&(typeof y.ADD_TAGS=="function"?Ut.tagCheck=y.ADD_TAGS:Zo(y.ADD_TAGS)&&(Ge===ct&&(Ge=zl(Ge)),wt(Ge,y.ADD_TAGS,vt))),xl(y,"ADD_ATTR")&&(typeof y.ADD_ATTR=="function"?Ut.attributeCheck=y.ADD_ATTR:Zo(y.ADD_ATTR)&&(nt===It&&(nt=zl(nt)),wt(nt,y.ADD_ATTR,vt))),xl(y,"ADD_FORBID_CONTENTS")&&Zo(y.ADD_FORBID_CONTENTS)&&(ut===vs&&(ut=zl(ut)),wt(ut,y.ADD_FORBID_CONTENTS,vt)),et&&(Ge["#text"]=!0),an&&wt(Ge,["html","head","body"]),Ge.table&&(wt(Ge,["tbody"]),delete rt.tbody),y.TRUSTED_TYPES_POLICY){if(typeof y.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ui('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof y.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ui('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const Z=I;I=y.TRUSTED_TYPES_POLICY;try{V=z("")}catch(re){throw I=Z,re}}else y.TRUSTED_TYPES_POLICY===null?(I=void 0,V=""):(I===void 0&&(I=ie()),I&&typeof V=="string"&&(V=z("")));ys&&ys(y),zs=y},Ce=wt({},[...Sp,...Ep,...wN]),Ie=wt({},[...Cp,...SN]),gt=function(y,T,Z){return T.namespaceURI===sn?y==="svg":T.namespaceURI===Ln?y==="svg"&&(Z==="annotation-xml"||yt[Z]):!!Ce[y]},ln=function(y,T,Z){return T.namespaceURI===sn?y==="math":T.namespaceURI===Os?y==="math"&&ds[Z]:!!Ie[y]},Nt=function(y,T,Z){return T.namespaceURI===Os&&!ds[Z]||T.namespaceURI===Ln&&!yt[Z]?!1:!Ie[y]&&(fs[y]||!Ce[y])},In=function(y){const T=q(y),Z=Tc(ne(y)),re=O(y);let Me,Ae;return re&&$(re)===es.element?(Me={namespaceURI:q(re)},Ae=Tc(ne(re))):(Me={namespaceURI:rn},Ae="template"),cn[T]?T===Os?gt(Z,Me,Ae):T===Ln?ln(Z,Me,Ae):T===sn?Nt(Z,Me,Ae):!!(Ks==="application/xhtml+xml"&&cn[T]):!1},Sn=function(y){bd(l.removed,{element:y});try{O(y).removeChild(y)}catch{if(w(y),!O(y))throw Ui("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},kt=function(y,T,Z){try{k(y,T)}catch{try{y.removeAttribute(Z)}catch{}}},Qs=function(y){Fn(y);const T=E(y);T&&Ii(gN(T),re=>{try{w(re)}catch{}});const Z=$(y)===es.element?H(y):null;if(Z)for(let re=Z.length-1;re>=0;--re){const Me=Z[re],Ae=Me&&Me.name;typeof Ae=="string"&&kt(y,Me,Ae)}},dn=function(y,T,Z){if(!Z)try{Z=T.getAttributeNode(y)}catch{Z=null}bd(l.removed,{attribute:Z||null,from:T});try{Z?k(T,Z):T.removeAttribute(y)}catch{try{T.removeAttribute(y)}catch{}}if(y==="is")if(St||Dt)try{Sn(T)}catch{}else try{T.setAttribute(y,"")}catch{}},jl=function(y){const T=H(y);if(T)for(let Z=T.length-1;Z>=0;--Z){const re=T[Z],Me=re&&re.name;typeof Me!="string"||nt[vt(Me)]||kt(y,re,Me)}},Nl=function(y,T){let Z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const re=[y];for(;re.length>0;){const Me=re.pop();if(T(Me)===!1)continue;if(Z&&$(Me)===es.element){const Xe=R(Me);ms(Xe)&&re.push(Xe)}const Ae=E(Me);if(Ae)for(let Xe=Ae.length-1;Xe>=0;--Xe)re.push(Ae[Xe])}},Fn=function(y){Nl(y,T=>{$(T)===es.element&&jl(T)})},Gt=function(y){const T=[];return Nl(y,Z=>{T.push(Z)},!0),T},Ca=function(y,T){const Z=Np();Ii(Gt(y),re=>{$(re)===es.element&&kp(Z,re)}),Ii(T,re=>{$(re)===es.element&&!yd(Z,re)&&jl(re)})},js=function(y,T){let Z=!1;return Ii(l.removed,re=>{re.element&&(Z=Z||re.element===y,Fn(re.element))}),Ca(y,T),Z},Wl=8,Ns=function(y,T){const Z=Pt;let re=null;const Me=()=>(re||(re=Np(),Ii(T,Ae=>{kp(re,Ae)})),re);for(let Ae=0;;Ae++){const Xe=Gt(y),ft=[y];let Qn=!1;if(Ii(Xe,fn=>{$(fn)===es.documentFragment?bd(ft,fn):!Qn&&!yd(Z,fn)&&(Qn=yd(Me(),fn))}),!Qn)return;if(Ae>=Wl)throw Ui("the tree kept changing during in-place sanitization; refusing to return it");Ii(ft,(fn,En)=>{ns(fn,En>0,y,Me())})}},ns=function(y,T,Z,re){const Me=Jl(y);let Ae;for(;Ae=Me.nextNode();)!yd(re,Ae)||yd(Pt,Ae)||(T&&Kn(fe.uponSanitizeShadowNode,Ae,null),la(Ae,Z),Ws(Ae,Z),ms(Ae.content)&&ss(Ae.content))},sl=function(y){Pt&&kp(Pt,y)},Wt=function(y,T){return $t?y==="patchsrc"?!0:y==="for"&&T!=="label"&&T!=="output":!1},Zs=function(y){$t&&Nl(y,T=>{const Z=$(T);if(Z===es.processingInstruction||Z===es.comment&&Rs(gb,T.data)){try{w(T)}catch{}return!1}if(Z===es.element){const re=T,Me=vt(ne(T));try{re.hasAttribute&&re.hasAttribute("patchsrc")&&re.removeAttribute("patchsrc"),re.hasAttribute&&re.hasAttribute("for")&&Wt("for",Me)&&re.removeAttribute("for")}catch{}}return!0})},ri=function(y){let T=null,Z=null;if(Zt)y="<remove></remove>"+y;else{const Ae=rb(y,/^[\r\n\t ]+/);Z=Ae&&Ae[0]}Ks==="application/xhtml+xml"&&rn===sn&&(y='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+y+"</body></html>");const re=I?z(y):y;if(rn===sn)try{T=new _().parseFromString(re,Ks)}catch{}if(!T||!T.documentElement){T=A.createDocument(rn,"template",null);try{T.documentElement.innerHTML=ts?V:re}catch{}}const Me=T.body||T.documentElement;return y&&Z&&Me.insertBefore(i.createTextNode(Z),Me.childNodes[0]||null),rn===sn?ye.call(T,an?"html":"body")[0]:an?T.documentElement:Me},Jl=function(y){const T=D?D(y):y.ownerDocument;return F.call(T||y,y,g.SHOW_ELEMENT|g.SHOW_COMMENT|g.SHOW_TEXT|g.SHOW_PROCESSING_INSTRUCTION|g.SHOW_CDATA_SECTION,null)},hs=function(y){return y=vd(y,Le," "),y=vd(y,lt," "),y=vd(y,ke," "),y},ea=function(y){var T;ta(y);const Z=(T=y.querySelectorAll)===null||T===void 0?void 0:T.call(y,"template");Z&&Ii(Z,re=>{ms(re.content)&&ea(re.content)})},ta=function(y){y.normalize();const T=D?D(y):y.ownerDocument,Z=F.call(T||y,y,g.SHOW_TEXT|g.SHOW_COMMENT|g.SHOW_CDATA_SECTION|g.SHOW_PROCESSING_INSTRUCTION,null);let re=Z.nextNode();for(;re;)re.data=hs(re.data),re=Z.nextNode()},Ps=function(y){const T=Q?Q(y):null;return typeof T!="string"||vt(T)!=="form"?!1:typeof y.nodeName!="string"||typeof y.textContent!="string"||typeof y.removeChild!="function"||y.attributes!==H(y)||typeof y.removeAttribute!="function"||typeof y.removeAttributeNode!="function"||typeof y.getAttributeNode!="function"||typeof y.setAttribute!="function"||typeof y.namespaceURI!="string"||typeof y.insertBefore!="function"||typeof y.hasChildNodes!="function"||y.nodeType!==te(y)||y.childNodes!==E(y)},ms=function(y){if(!te||typeof y!="object"||y===null)return!1;try{return te(y)===es.documentFragment}catch{return!1}},ll=function(y){if(!te||typeof y!="object"||y===null)return!1;try{return typeof te(y)=="number"}catch{return!1}};function Kn(je,y,T){je.length!==0&&Ii(je,Z=>{Z.call(l,y,T,zs)})}const na=function(y,T){return!!($t&&y.hasChildNodes()&&!ll(y.firstElementChild)&&Rs(Ap,y.textContent)&&Rs(Ap,y.innerHTML)||$t&&IN[T]&&$(y)===es.element&&q(y)===sn&&(ll(y.firstElementChild)||typeof y.textContent=="string"&&Rs(Ap,y.textContent))||y.nodeType===es.processingInstruction||$t&&y.nodeType===es.comment&&Rs(gb,y.data))},Il=function(y,T){if(y instanceof RegExp)return Rs(y,T);if(y instanceof Function){for(var Z=arguments.length,re=new Array(Z>2?Z-2:0),Me=2;Me<Z;Me++)re[Me-2]=arguments[Me];return!!y(T,...re)}return!1},Fi=function(y,T,Z){if(!rt[T]&&ks(T)&&Il(Se.tagNameCheck,T))return!1;if(et&&!ut[T]&&!ut[Tc(T)]){const re=O(y),Me=E(y);if(Me&&re){const Ae=Me.length;for(let Xe=Ae-1;Xe>=0;--Xe){const ft=y===Z?N(Me[Xe],!0):Me[Xe];re.insertBefore(ft,C(y))}}}return Sn(y),!0},sa=function(y,T,Z,re){return y.length===0?T:T===Z||T===re?zl(T):T},dt=function(y,T){return y===T||O(y)!==null?!1:(Pe&&Fn(y),!0)},la=function(y,T){if(sl(y),Kn(fe.beforeSanitizeElements,y,null),dt(y,T))return!0;if(Ps(y))return Sn(y),!0;const Z=vt(ne(y));if(Ge=sa(fe.uponSanitizeElement,Ge,ct,Rt),Kn(fe.uponSanitizeElement,y,{tagName:Z,allowedTags:Ge}),dt(y,T))return!0;if(na(y,Z))return Sn(y),!0;if(rt[Z]||!(Ut.tagCheck instanceof Function&&Ut.tagCheck(Z))&&!Ge[Z]){const re=Fi(y,Z,T);return re===!1&&(Kn(fe.afterSanitizeElements,y,null),dt(y,T))?!0:re}if($(y)===es.element&&!In(y)||(Z==="noscript"||Z==="noembed"||Z==="noframes")&&Rs(zN,y.innerHTML))return Sn(y),!0;if(Mt&&y.nodeType===es.text){const re=hs(y.textContent);y.textContent!==re&&(bd(l.removed,{element:y.cloneNode()}),y.textContent=re)}return Kn(fe.afterSanitizeElements,y,null),dt(y,T)},bn=function(y,T,Z){if(kn[T]||Wt(T,y)||ge&&(T==="id"||T==="name")&&(Z in i||Z in zn))return!1;const re=nt[T]||Ut.attributeCheck instanceof Function&&Ut.attributeCheck(T,y);return Fs&&Rs(Be,T)||ot&&Rs(Ye,T)?!0:re?us[T]||Rs(_n,vd(Z,qn,""))||(T==="src"||T==="xlink:href"||T==="href")&&y!=="script"&&cb(Z,"data:")===0&&Dn[y]||Vn&&!Rs(Qe,vd(Z,qn,""))?!0:!Z:ks(y)&&Il(Se.tagNameCheck,y)&&Il(Se.attributeNameCheck,T,y)||T==="is"&&Se.allowCustomizedBuiltInElements&&Il(Se.tagNameCheck,Z)},Ul=wt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),ks=function(y){return!Ul[Tc(y)]&&Rs(We,y)},Un=function(y,T,Z,re){if(I&&typeof b=="object"&&typeof b.getAttributeType=="function"&&!Z)switch(b.getAttributeType(y,T)){case"TrustedHTML":return z(re);case"TrustedScriptURL":return G(re)}return re},ci=function(y,T,Z,re){try{return Z?y.setAttributeNS(Z,T,re):y.setAttribute(T,re),Ps(y)?(Sn(y),!1):!0}catch{return dn(T,y),!1}},al=function(y,T){return $t&&Rs(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,T)?!0:Tc(y)==="attributename"&&rb(T,"href")!==null},Ws=function(y,T){if(Kn(fe.beforeSanitizeAttributes,y,null),dt(y,T))return;const Z=y.attributes;if(!Z||Ps(y))return;nt=sa(fe.uponSanitizeAttribute,nt,It,nn);const re={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:nt,forceKeepAttr:void 0};let Me=Z.length;const Ae=vt(y.nodeName);for(;Me--;){const Xe=Z[Me],ft=Xe.name,Qn=Xe.namespaceURI,fn=Xe.value,En=vt(ft),Ta=fn;let Bt=ft==="value"?Ta:_N(Ta),Ki=!1;if(re.attrName=En,re.attrValue=Bt,re.keepAttr=!0,re.forceKeepAttr=void 0,Kn(fe.uponSanitizeAttribute,y,re),Bt=re.attrValue,Ee&&(En==="id"||En==="name")&&cb(Bt,Ve)!==0&&(dn(ft,y,Xe),Bt=Ve+Bt,Ki=!0),al(ft,Bt)){dn(ft,y,Xe);continue}if(!re.forceKeepAttr){if(!re.keepAttr){dn(ft,y,Xe);continue}if(!Rn&&Rs(xb,Bt)){dn(ft,y,Xe);continue}if(Mt&&(Bt=hs(Bt)),!bn(Ae,En,Bt)){dn(ft,y,Xe);continue}Bt=Un(Ae,En,Qn,Bt),Bt!==Ta&&ci(y,ft,Qn,Bt)&&Ki&&ib(l.removed)}}Kn(fe.afterSanitizeAttributes,y,null),dt(y,T)},ss=function(y){let T=null;const Z=Jl(y);for(Kn(fe.beforeSanitizeShadowDOM,y,null);T=Z.nextNode();)if(Kn(fe.uponSanitizeShadowNode,T,null),la(T,y),Ws(T,y),ms(T.content)&&ss(T.content),$(T)===es.element){const re=R(T);ms(re)&&(ps(re),ss(re))}Mt&&ta(y),Kn(fe.afterSanitizeShadowDOM,y,null)},ps=function(y){const T=[{node:y,shadow:null}];for(;T.length>0;){const Z=T.pop();if(Z.shadow){ss(Z.shadow);continue}const re=Z.node,Me=$(re)===es.element,Ae=E(re);if(Ae)for(let Xe=Ae.length-1;Xe>=0;--Xe)T.push({node:Ae[Xe],shadow:null});if(Me){const Xe=Q?Q(re):null;if(typeof Xe=="string"&&vt(Xe)==="template"){const ft=re.content;ms(ft)&&T.push({node:ft,shadow:null})}}if(Me){const Xe=R(re);ms(Xe)&&T.push({node:null,shadow:Xe},{node:Xe,shadow:null})}}};return l.sanitize=function(je){let y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},T=null,Z=null,re=null,Me=null;if(ts=!je,ts&&(je="<!-->"),typeof je!="string"&&!ll(je)&&(je=jN(je),typeof je!="string"))throw Ui("dirty is not a string, aborting");if(!l.isSupported)return je;bt?(Ge=Rt,nt=nn):me(y),(fe.uponSanitizeElement.length>0||fe.uponSanitizeAttribute.length>0)&&(Ge=zl(Ge)),fe.uponSanitizeAttribute.length>0&&(nt=zl(nt)),l.removed=[];const Ae=Pe&&typeof je!="string"&&ll(je);let Xe=[];const ft=Pt;if(Ae){Zs(je);const En=ne(je);if(typeof En=="string"){const Ta=vt(En);if(!Ge[Ta]||rt[Ta])throw Qs(je),Ui("root node is forbidden and cannot be sanitized in-place")}if(Ps(je))throw Qs(je),Ui("root node is clobbered and cannot be sanitized in-place");Xe=Gt(je),Pt=Np()}else if(ll(je))T=ri("<!---->"),Z=T.ownerDocument.importNode(je,!0),Z.nodeType===es.element&&Z.nodeName==="BODY"||Z.nodeName==="HTML"?T=Z:T.appendChild(Z),ps(T);else{if(!St&&!Mt&&!an&&je.indexOf("<")===-1)return I&&Xn?z(je):je;if(T=ri(je),!T)return St?null:Xn?V:""}T&&Zt&&Sn(T.firstChild);const Qn=Ae?je:T;try{Ae&&ps(je);const En=Jl(Qn);for(;re=En.nextNode();)la(re,Qn),Ws(re,Qn),ms(re.content)&&ss(re.content);Ae&&Ns(je,Xe)}catch(En){throw Ae&&(Qs(je),js(je,Xe)),En}finally{Pt=ft}if(Ae){if(js(je,Xe))throw Ui("a node selected for removal could not be safely returned; refusing to sanitize in place");return Mt&&ea(je),je}if(St){if(Mt&&ea(T),Dt)for(Me=U.call(T.ownerDocument);T.firstChild;)Me.appendChild(T.firstChild);else Me=T;return(nt.shadowroot||nt.shadowrootmode)&&(Me=W.call(r,Me,!0)),Me}let fn=an?T.outerHTML:T.innerHTML;return an&&Ge["!doctype"]&&T.ownerDocument&&T.ownerDocument.doctype&&T.ownerDocument.doctype.name&&Rs(LN,T.ownerDocument.doctype.name)&&(fn="<!DOCTYPE "+T.ownerDocument.doctype.name+`>
116
+ `+fn),Mt&&(fn=hs(fn)),I&&Xn?z(fn):fn},l.setConfig=function(){let je=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};me(je),bt=!0,Rt=Ge,nn=nt},l.clearConfig=function(){zs=null,bt=!1,Rt=null,nn=null,I=pe,V=""},l.isValidAttribute=function(je,y,T){zs||me({});const Z=vt(je),re=vt(y);return typeof T=="string"&&(al(y,T)||!Rn&&Rs(xb,T))?!1:bn(Z,re,T)},l.addHook=function(je,y){typeof y=="function"&&xl(fe,je)&&bd(fe[je],y)},l.removeHook=function(je,y){if(xl(fe,je)){if(y!==void 0){const T=pN(fe[je],y);return T===-1?void 0:xN(fe[je],T,1)[0]}return ib(fe[je])}},l.removeHooks=function(je){xl(fe,je)&&(fe[je]=[])},l.removeAllHooks=function(){fe=_b()},l}var BN=_0();const HN=1024;let qN=0;class Pl{constructor(l,i){this.from=l,this.to=i}}class xn{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=Ea.match(l)),i=>{let r=l(i);return r===void 0?null:[this,r]}}}xn.closedBy=new xn({deserialize:n=>n.split(" ")});xn.openedBy=new xn({deserialize:n=>n.split(" ")});xn.group=new xn({deserialize:n=>n.split(" ")});xn.isolate=new xn({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});xn.contextHash=new xn({perNode:!0});xn.lookAhead=new xn({perNode:!0});xn.mounted=new xn({perNode:!0});class Po{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[xn.mounted.id]}}const GN=Object.create(null);class Ea{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 Ea(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(xn.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(xn.group),u=-1;u<(o?o.length:0);u++){let m=i[u<0?r.name:o[u]];if(m)return m}}}}Ea.none=new Ea("",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 Ea(r.name,o,r.id,r.flags):r)}return new b0(i)}}const th=new WeakMap,bb=new WeakMap;var pn;(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"})(pn||(pn={}));class bl{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=Po.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 Rh(this.topNode,l)}cursorAt(l,i=0,r=0){let o=th.get(this)||this.topNode,u=new Rh(o);return u.moveTo(l,i),th.set(this,u._tree),u}get topNode(){return new Xs(this,0,0,null)}resolve(l,i=0){let r=Rd(th.get(this)||this.topNode,l,i,!1);return th.set(this,r),r}resolveInner(l,i=0){let r=Rd(bb.get(this)||this.topNode,l,i,!0);return bb.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&pn.IncludeAnonymous)>0;for(let g=this.cursor(m|pn.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:Lg(Ea.none,this.children,this.positions,0,this.children.length,0,this.length,(i,r,o)=>new bl(this.type,i,r,o,this.propValues),l.makeTree||((i,r,o)=>new bl(Ea.none,i,r,o)))}static build(l){return FN(l)}}bl.empty=new bl(Ea.none,[],[],0);class Rg{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 Rg(this.buffer,this.index)}}class Gr{constructor(l,i,r){this.buffer=l,this.length=i,this.set=r}get type(){return Ea.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 Gr(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 Rd(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 Xs&&n.index<0?null:n.parent;if(!m)return n;n=m}let u=r?0:pn.IgnoreOverlays;if(r)for(let m=n,p=m.parent;p;m=p,p=m.parent)m instanceof Xs&&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 Rh(this,l)}getChild(l,i=null,r=null){let o=yb(this,l,i,r);return o.length?o[0]:null}getChildren(l,i=null,r=null){return yb(this,l,i,r)}resolve(l,i=0){return Rd(this,l,i,!1)}resolveInner(l,i=0){return Rd(this,l,i,!0)}matchContext(l){return Jp(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 Xs 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,N;if(!(!(u&pn.EnterBracketed&&b instanceof bl&&(N=Po.get(b))&&!N.overlay&&N.bracketed&&r>=j&&r<=j+b.length)&&!y0(o,r,j,j+b.length))){if(b instanceof Gr){if(u&pn.ExcludeBuffers)continue;let w=b.findChild(0,b.buffer.length,i,r-j,o);if(w>-1)return new ai(new YN(m,b,l,j),null,w)}else if(u&pn.IncludeAnonymous||!b.type.isAnonymous||Dg(b)){let w;if(!(u&pn.IgnoreMounts)&&(w=Po.get(b))&&!w.overlay)return new Xs(w.tree,j,l,m);let k=new Xs(b,j,l,m);return u&pn.IncludeAnonymous||!k.type.isAnonymous?k:k.nextChild(i<0?b.children.length-1:0,i,r,o,u)}}}if(u&pn.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&pn.IgnoreOverlays)&&(o=Po.get(this._tree))&&o.overlay){let u=l-this.from,m=r&pn.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 Xs(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 yb(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 Jp(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 ai 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 ai(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&pn.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 ai(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 ai(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 ai(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 bl(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 Xs&&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 Xs?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=Po.get(u.tree);if(m&&m.overlay&&m.overlay[0].from<=l&&m.overlay[m.overlay.length-1].to>=l){let p=new Xs(m.tree,m.overlay[0].from+u.from,-1,u);(o||(o=[r])).push(Rd(p,l,i,!1))}}return o?j0(o):r}class Rh{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&~pn.EnterBracketed,l instanceof Xs)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 Xs?(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&pn.ExcludeBuffers?!1:this.enterChild(1,l,i):this.yield(this._tree.enter(l,i,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&pn.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let l=this.mode&pn.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&pn.IncludeAnonymous||p instanceof Gr||!p.type.isAnonymous||Dg(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 ai(this.buffer,i,this.stack[o]);return this.bufferNode=new ai(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 Jp(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 Jp(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 Dg(n){return n.children.some(l=>l instanceof Gr||!l.type.isAnonymous||Dg(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 Rg(i,i.length):i,g=r.types,_=0,b=0;function j(Q,D,$,ne,Y,q){let{id:I,start:V,end:pe,size:J}=p,le=b,L=_;if(J<0)if(p.next(),J==-1){let A=u[I];$.push(A),ne.push(V-Q);return}else if(J==-3){_=I;return}else if(J==-4){b=I;return}else throw new RangeError(`Unrecognized record size: ${J}`);let z=g[I],G,ie,de=V-Q;if(pe-V<=o&&(ie=E(p.pos-D,Y))){let A=new Uint16Array(ie.size-ie.skip),F=p.pos-ie.size,U=A.length;for(;p.pos>F;)U=O(ie.start,A,U);G=new Gr(A,pe-ie.start,r),de=ie.start-Q}else{let A=p.pos-J;p.next();let F=[],U=[],ye=I>=m?I:-1,W=0,fe=pe;for(;p.pos>A;)ye>=0&&p.id==ye&&p.size>=0?(p.end<=fe-o&&(k(F,U,V,W,p.end,fe,ye,le,L),W=F.length,fe=p.end),p.next()):q>2500?N(V,A,F,U):j(V,A,F,U,ye,q+1);if(ye>=0&&W>0&&W<F.length&&k(F,U,V,W,V,fe,ye,le,L),F.reverse(),U.reverse(),ye>-1&&W>0){let Le=w(z,L);G=Lg(z,F,U,0,F.length,0,pe-V,Le,Le)}else G=C(z,F,U,pe-V,le-pe,L)}$.push(G),ne.push(de)}function N(Q,D,$,ne){let Y=[],q=0,I=-1;for(;p.pos>D;){let{id:V,start:pe,end:J,size:le}=p;if(le>4)p.next();else{if(I>-1&&pe<I)break;I<0&&(I=J-o),Y.push(V,pe,J),q++,p.next()}}if(q){let V=new Uint16Array(q*4),pe=Y[Y.length-2];for(let J=Y.length-3,le=0;J>=0;J-=3)V[le++]=Y[J],V[le++]=Y[J+1]-pe,V[le++]=Y[J+2]-pe,V[le++]=le;$.push(new Gr(V,Y[2]-pe,r)),ne.push(pe-Q)}}function w(Q,D){return($,ne,Y)=>{let q=0,I=$.length-1,V,pe;if(I>=0&&(V=$[I])instanceof bl){if(!I&&V.type==Q&&V.length==Y)return V;(pe=V.prop(xn.lookAhead))&&(q=ne[I]+V.length+pe)}return C(Q,$,ne,Y,q,D)}}function k(Q,D,$,ne,Y,q,I,V,pe){let J=[],le=[];for(;Q.length>ne;)J.push(Q.pop()),le.push(D.pop()+$-Y);Q.push(C(r.types[I],J,le,q-Y,V-q,pe)),D.push(Y-$)}function C(Q,D,$,ne,Y,q,I){if(q){let V=[xn.contextHash,q];I=I?[V].concat(I):[V]}if(Y>25){let V=[xn.lookAhead,Y];I=I?[V].concat(I):[V]}return new bl(Q,D,$,ne,I)}function E(Q,D){let $=p.fork(),ne=0,Y=0,q=0,I=$.end-o,V={size:0,start:0,skip:0};e:for(let pe=$.pos-Q;$.pos>pe;){let J=$.size;if($.id==D&&J>=0){V.size=ne,V.start=Y,V.skip=q,q+=4,ne+=4,$.next();continue}let le=$.pos-J;if(J<0||le<pe||$.start<I)break;let L=$.id>=m?4:0,z=$.start;for($.next();$.pos>le;){if($.size<0)if($.size==-3||$.size==-4)L+=4;else break e;else $.id>=m&&(L+=4);$.next()}Y=z,ne+=J,q+=L}return(D<0||ne==Q)&&(V.size=ne,V.start=Y,V.skip=q),V.size>4?V:void 0}function O(Q,D,$){let{id:ne,start:Y,end:q,size:I}=p;if(p.next(),I>=0&&ne<m){let V=$;if(I>4){let pe=p.pos-(I-4);for(;p.pos>pe;)$=O(Q,D,$)}D[--$]=V,D[--$]=q-Q,D[--$]=Y-Q,D[--$]=ne}else I==-3?_=ne:I==-4&&(b=ne);return $}let R=[],H=[];for(;p.pos>0;)j(n.start||0,n.bufferStart||0,R,H,-1,0);let te=(l=n.length)!==null&&l!==void 0?l:R.length?H[0]+R[0].length:0;return new bl(g[n.topID],R.reverse(),H.reverse(),te)}const vb=new WeakMap;function Nh(n,l){if(!n.isAnonymous||l instanceof Gr||l.type!=n)return 1;let i=vb.get(l);if(i==null){i=1;for(let r of l.children){if(r.type!=n||!(r instanceof bl)){i=1;break}i+=Nh(n,r)}vb.set(l,i)}return i}function Lg(n,l,i,r,o,u,m,p,g){let _=0;for(let k=r;k<o;k++)_+=Nh(n,l[k]);let b=Math.ceil(_*1.5/8),j=[],N=[];function w(k,C,E,O,R){for(let H=E;H<O;){let te=H,Q=C[H],D=Nh(n,k[H]);for(H++;H<O;H++){let $=Nh(n,k[H]);if(D+$>=b)break;D+=$}if(H==te+1){if(D>b){let $=k[te];w($.children,$.positions,0,$.children.length,C[te]+R);continue}j.push(k[te])}else{let $=C[H-1]+k[H-1].length-Q;j.push(Lg(n,k,C,te,H,Q,$,null,g))}N.push(Q+R-u)}}return w(l,i,r,o,0),(p||g)(j,N,m)}class NM{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 ai?this.setBuffer(l.context.buffer,l.index,i):l instanceof Xs&&this.map.set(l.tree,i)}get(l){return l instanceof ai?this.getBuffer(l.context.buffer,l.index):l instanceof Xs?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 Dd{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 Dd(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 N=m;if(g>=N.from||j<=N.to||_){let w=Math.max(N.from,g)-_,k=Math.min(N.to,j)-_;N=w>=k?null:new Dd(w,k,N.tree,N.offset+_,p>0,!!b)}if(N&&o.push(N),m.to>j)break;m=u<l.length?l[u++]:null}if(!b)break;g=b.toA,_=b.toA-b.toB}return o}}class kM{startParse(l,i,r){return typeof l=="string"&&(l=new KN(l)),r=r?r.length?r.map(o=>new Pl(o.from,o.to)):[new Pl(0,0)]:[new Pl(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 wM(n){return(l,i,r,o)=>new ZN(l,n,i,r,o)}class jb{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 Nb(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 eg=new xn({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 bl(r.type,r.children,r.positions,r.length,r.propValues.concat([[eg,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[xn.mounted.id]=new Po(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 Rh(new Xs(this.baseTree,this.ranges[0].from,0,null),pn.IncludeAnonymous|pn.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,N=b.to+_.pos;j>=o.from&&N<=o.to&&!i.ranges.some(w=>w.from<N&&w.to>j)&&i.ranges.push({from:j,to:N})}}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=Sb(this.ranges,u.overlay||(o.from<o.to?[new Pl(o.from,o.to)]:[]));b.length&&Nb(b),(b.length||!u.overlay)&&this.inner.push(new jb(u.parser,b.length?u.parser.startParse(this.input,Eb(_,b),b):u.parser.startParse(""),u.overlay?u.overlay.map(j=>new Pl(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 Pl(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 _=Sb(this.ranges,i.ranges);_.length&&(Nb(_),this.inner.splice(i.index,0,new jb(i.parser,i.parser.startParse(this.input,Eb(i.mounts,_),_),i.ranges.map(b=>new Pl(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 kb(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,N,w,k,C){let E=i[C],O=[],R=[];kb(m,b,E,O,R,w);let H=p[E+1],te=p[E+2];g.push(O.length);let Q=C?_(E+4,p[E+3],m.set.types[p[E]],H,te-H,C-1):l.toTree();return O.push(Q),R.push(H-w),kb(m,p[E+3],j,O,R,w),new bl(N,O,R,k)}o.children[u]=_(0,p.length,Ea.none,0,m.length,i.length-1);for(let b of g){let j=n.tree.children[b],N=n.tree.positions[b];n.yield(new Xs(j,N+n.from,b,n._tree))}}class wb{constructor(l,i){this.offset=i,this.done=!1,this.cursor=l.cursor(pn.IncludeAnonymous|pn.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,pn.IgnoreOverlays|pn.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 bl)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(eg))!==null&&i!==void 0?i:r.to,this.inner=new wb(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(eg))!==null&&l!==void 0?l:i.to,this.inner=new wb(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(xn.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 Sb(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 Pl(g.from,m),g.to>p&&i.splice(u+1,0,new Pl(p,g.to))):g.to>p?i[u--]=new Pl(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 N=Math.max(g,i),w=Math.min(b,j,r);N<w&&_.push(new Pl(N,w))}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 Eb(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(N=>new Pl(N.from+r,N.to+r)),j=ek(l,b,g,_);for(let N=0,w=g;;N++){let k=N==j.length,C=k?_:j[N].from;if(C>w&&i.push(new Dd(w,C,o.tree,-m,u.from>=w||u.openStart,u.to<=C||u.openEnd)),k)break;w=j[N].to}}else i.push(new Dd(g,_,o.tree,-m,u.from>=m||u.openStart,u.to<=p||u.openEnd))}return i}let tk=0;class Zl{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 Zl&&(i=l),i!=null&&i.base)throw new Error("Can not derive from a modified tag");let o=new Zl(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 Dh(l);return r=>r.modified.indexOf(i)>-1?r:Dh.get(r.base||r,r.modified.concat(i).sort((o,u)=>o.id-u.id))}}let nk=0;class Dh{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 Zl(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(Dh.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 SM(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 N=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(p);if(!N)throw new RangeError("Invalid path: "+o);if(u.push(N[0]=="*"?"":N[0][0]=='"'?JSON.parse(N[0]):N[0]),j+=N[0].length,j==o.length)break;let w=o[j++];if(j==o.length&&w=="!"){m=0;break}if(w!="/")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 Ld(r,m,g>0?u.slice(0,g):null);l[_]=b.sort(l[_])}}return N0.add(l)}const N0=new xn({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 Ld(o.tags,o.mode,o.context);i?i.next=u:r=u,i=u}return r}});class Ld{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}}Ld.empty=new Ld([],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,_),N=0;;){let w=j.indexOf(`
117
+ `,N),k=w<0?j.length:w;if(k>N&&r(j.slice(N,k),b),w<0)break;o(),N=w+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(w=>!w.scope||w.scope(m)));let _=o,b=ok(l)||Ld.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 N=l.tree&&l.tree.prop(xn.mounted);if(N&&N.overlay){let w=l.node.enter(N.overlay[0].from+p,1),k=this.highlighters.filter(E=>!E.scope||E.scope(N.tree.type)),C=l.firstChild();for(let E=0,O=p;;E++){let R=E<N.overlay.length?N.overlay[E]:null,H=R?R.from+p:g,te=Math.max(i,O),Q=Math.min(r,H);if(te<Q&&C)for(;l.from<Q&&(this.highlightRange(l,te,Q,o,u),this.startSpan(Math.min(Q,l.to),_),!(l.to>=H||!l.nextSibling())););if(!R||H>r)break;O=R.to+p,O>i&&(this.highlightRange(w.cursor(),Math.max(i,R.from+p),Math.min(r,O),"",k),this.startSpan(Math.min(r,O),_))}C&&l.parent()}else if(l.firstChild()){N&&(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=Zl.define,nh=De(),Ir=De(),Cb=De(Ir),Tb=De(Ir),Ur=De(),sh=De(Ur),Rp=De(Ur),ti=De(),Ec=De(ti),Pa=De(),Wa=De(),tg=De(),Nd=De(tg),lh=De(),Oe={comment:nh,lineComment:De(nh),blockComment:De(nh),docComment:De(nh),name:Ir,variableName:De(Ir),typeName:Cb,tagName:De(Cb),propertyName:Tb,attributeName:De(Tb),className:De(Ir),labelName:De(Ir),namespace:De(Ir),macroName:De(Ir),literal:Ur,string:sh,docString:De(sh),character:De(sh),attributeValue:De(sh),number:Rp,integer:De(Rp),float:De(Rp),bool:De(Ur),regexp:De(Ur),escape:De(Ur),color:De(Ur),url:De(Ur),keyword:Pa,self:De(Pa),null:De(Pa),atom:De(Pa),unit:De(Pa),modifier:De(Pa),operatorKeyword:De(Pa),controlKeyword:De(Pa),definitionKeyword:De(Pa),moduleKeyword:De(Pa),operator:Wa,derefOperator:De(Wa),arithmeticOperator:De(Wa),logicOperator:De(Wa),bitwiseOperator:De(Wa),compareOperator:De(Wa),updateOperator:De(Wa),definitionOperator:De(Wa),typeOperator:De(Wa),controlOperator:De(Wa),punctuation:tg,separator:De(tg),bracket:Nd,angleBracket:De(Nd),squareBracket:De(Nd),paren:De(Nd),brace:De(Nd),content:ti,heading:Ec,heading1:De(Ec),heading2:De(Ec),heading3:De(Ec),heading4:De(Ec),heading5:De(Ec),heading6:De(Ec),contentSeparator:De(ti),list:De(ti),quote:De(ti),emphasis:De(ti),strong:De(ti),link:De(ti),monospace:De(ti),strikethrough:De(ti),inserted:De(),deleted:De(),changed:De(),invalid:De(),meta:lh,documentMeta:De(lh),annotation:De(lh),processingInstruction:De(lh),definition:Zl.defineModifier("definition"),constant:Zl.defineModifier("constant"),function:Zl.defineModifier("function"),standard:Zl.defineModifier("standard"),local:Zl.defineModifier("local"),special:Zl.defineModifier("special")};for(let n in Oe){let l=Oe[n];l instanceof Zl&&(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},Ab={},Ze=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(N=>({status:"fulfilled",value:N}),N=>({status:"rejected",reason:N}))))};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 Ab)return;Ab[b]=!0;const j=b.endsWith(".css"),N=j?'[rel="stylesheet"]':"";if(!!r)for(let C=p.length-1;C>=0;C--){const E=p[C];if(E.href===b&&(!j||E.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${b}"]${N}`))return;const k=document.createElement("link");if(k.rel=j?"stylesheet":uk,j||(k.as="script"),k.crossOrigin="",k.href=b,_&&k.setAttribute("nonce",_),document.head.appendChild(k),j)return new Promise((C,E)=>{k.addEventListener("load",C),k.addEventListener("error",()=>E(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 Ze(async()=>{const{javascript:n}=await import("./index-D3KJ44QL.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).javascript({jsx:!0}),cjs:async()=>(await Ze(async()=>{const{javascript:n}=await import("./index-D3KJ44QL.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).javascript(),mjs:async()=>(await Ze(async()=>{const{javascript:n}=await import("./index-D3KJ44QL.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).javascript(),jsx:async()=>(await Ze(async()=>{const{javascript:n}=await import("./index-D3KJ44QL.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).javascript({jsx:!0}),ts:async()=>(await Ze(async()=>{const{javascript:n}=await import("./index-D3KJ44QL.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).javascript({typescript:!0}),mts:async()=>(await Ze(async()=>{const{javascript:n}=await import("./index-D3KJ44QL.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).javascript({typescript:!0}),cts:async()=>(await Ze(async()=>{const{javascript:n}=await import("./index-D3KJ44QL.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).javascript({typescript:!0}),tsx:async()=>(await Ze(async()=>{const{javascript:n}=await import("./index-D3KJ44QL.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).javascript({typescript:!0,jsx:!0}),json:async()=>(await Ze(async()=>{const{json:n}=await import("./index-BrzBT7tX.js");return{json:n}},__vite__mapDeps([7,1,2,3,4,5]),import.meta.url)).json(),jsonc:async()=>(await Ze(async()=>{const{json:n}=await import("./index-BrzBT7tX.js");return{json:n}},__vite__mapDeps([7,1,2,3,4,5]),import.meta.url)).json(),css:async()=>(await Ze(async()=>{const{css:n}=await import("./index-rnuYD-5b.js");return{css:n}},__vite__mapDeps([8,1,2,3,4,5]),import.meta.url)).css(),scss:async()=>(await Ze(async()=>{const{css:n}=await import("./index-rnuYD-5b.js");return{css:n}},__vite__mapDeps([8,1,2,3,4,5]),import.meta.url)).css(),less:async()=>(await Ze(async()=>{const{css:n}=await import("./index-rnuYD-5b.js");return{css:n}},__vite__mapDeps([8,1,2,3,4,5]),import.meta.url)).css(),html:async()=>(await Ze(async()=>{const{html:n}=await import("./index-CrIvEt3W.js");return{html:n}},__vite__mapDeps([9,1,8,2,3,4,5,0,6]),import.meta.url)).html(),htm:async()=>(await Ze(async()=>{const{html:n}=await import("./index-CrIvEt3W.js");return{html:n}},__vite__mapDeps([9,1,8,2,3,4,5,0,6]),import.meta.url)).html(),vue:async()=>(await Ze(async()=>{const{html:n}=await import("./index-CrIvEt3W.js");return{html:n}},__vite__mapDeps([9,1,8,2,3,4,5,0,6]),import.meta.url)).html(),svelte:async()=>(await Ze(async()=>{const{html:n}=await import("./index-CrIvEt3W.js");return{html:n}},__vite__mapDeps([9,1,8,2,3,4,5,0,6]),import.meta.url)).html(),md:async()=>(await Ze(async()=>{const{markdown:n}=await import("./index-6ji44meo.js");return{markdown:n}},__vite__mapDeps([10,3,4,5,2,6,9,1,8,0]),import.meta.url)).markdown(),markdown:async()=>(await Ze(async()=>{const{markdown:n}=await import("./index-6ji44meo.js");return{markdown:n}},__vite__mapDeps([10,3,4,5,2,6,9,1,8,0]),import.meta.url)).markdown(),py:async()=>(await Ze(async()=>{const{python:n}=await import("./index-CSlP1EYA.js");return{python:n}},__vite__mapDeps([11,1,2,3,4,5,6]),import.meta.url)).python(),pyi:async()=>(await Ze(async()=>{const{python:n}=await import("./index-CSlP1EYA.js");return{python:n}},__vite__mapDeps([11,1,2,3,4,5,6]),import.meta.url)).python(),yaml:async()=>(await Ze(async()=>{const{yaml:n}=await import("./index-Cec-XFvp.js");return{yaml:n}},__vite__mapDeps([12,1,2,3,4,5]),import.meta.url)).yaml(),yml:async()=>(await Ze(async()=>{const{yaml:n}=await import("./index-Cec-XFvp.js");return{yaml:n}},__vite__mapDeps([12,1,2,3,4,5]),import.meta.url)).yaml(),rs:async()=>(await Ze(async()=>{const{rust:n}=await import("./index-DPlaluO4.js");return{rust:n}},__vite__mapDeps([13,1,2,3,4,5]),import.meta.url)).rust(),c:async()=>(await Ze(async()=>{const{cpp:n}=await import("./index-DObAlG3d.js");return{cpp:n}},__vite__mapDeps([14,1,2,3,4,5]),import.meta.url)).cpp(),h:async()=>(await Ze(async()=>{const{cpp:n}=await import("./index-DObAlG3d.js");return{cpp:n}},__vite__mapDeps([14,1,2,3,4,5]),import.meta.url)).cpp(),cc:async()=>(await Ze(async()=>{const{cpp:n}=await import("./index-DObAlG3d.js");return{cpp:n}},__vite__mapDeps([14,1,2,3,4,5]),import.meta.url)).cpp(),cpp:async()=>(await Ze(async()=>{const{cpp:n}=await import("./index-DObAlG3d.js");return{cpp:n}},__vite__mapDeps([14,1,2,3,4,5]),import.meta.url)).cpp(),hpp:async()=>(await Ze(async()=>{const{cpp:n}=await import("./index-DObAlG3d.js");return{cpp:n}},__vite__mapDeps([14,1,2,3,4,5]),import.meta.url)).cpp(),java:async()=>(await Ze(async()=>{const{java:n}=await import("./index-D2m7bnfK.js");return{java:n}},__vite__mapDeps([15,1,2,3,4,5]),import.meta.url)).java(),go:async()=>(await Ze(async()=>{const{go:n}=await import("./index-BBJdr5JT.js");return{go:n}},__vite__mapDeps([16,1,2,3,4,5,6]),import.meta.url)).go(),php:async()=>(await Ze(async()=>{const{php:n}=await import("./index-CCcMvPPM.js");return{php:n}},__vite__mapDeps([17,1,9,8,2,3,4,5,0,6]),import.meta.url)).php(),sql:async()=>(await Ze(async()=>{const{sql:n}=await import("./index-6VtLhZfr.js");return{sql:n}},__vite__mapDeps([18,2,3,4,5,1,6]),import.meta.url)).sql(),xml:async()=>(await Ze(async()=>{const{xml:n}=await import("./index-DEQgVEIp.js");return{xml:n}},__vite__mapDeps([19,1,2,3,4,5]),import.meta.url)).xml(),svg:async()=>(await Ze(async()=>{const{xml:n}=await import("./index-DEQgVEIp.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 ah(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 ah(n);try{const r=i.language.parser.parse(n);let o="";return rk(n,r,gk,(u,m)=>{o+=m?`<span class="${m}">${ah(u)}</span>`:ah(u)},()=>{o+=`
118
+ `}),o}catch{return ah(n)}}zt.setOptions({gfm:!0,breaks:!1});function Od(n){var i;const l=(i=n.split(".").pop())==null?void 0:i.toLowerCase();return l==="md"||l==="markdown"}function Vh(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 Mb(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 Rb(n,l){return`<span class="math${l?" math--display":""}" data-tex="${Mb(n)}" data-display="${l?"1":"0"}">${Mb(n)}</span>`}zt.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=>Rb(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=>Rb(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 Bd(n){const l=await zt.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 Db(){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 Lb(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:Vh(n.path)||Od(n.path)&&Db()==="preview",textMode:Od(n.path)&&Db()==="text"}}function ni(n){return!n.binary&&!n.tooLarge&&n.text!==n.saved}function ng(n){return n.split("/").pop()??n}function qr(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 Ob(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="${Ob(n.src)}" alt="${Ob(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 Bi="application/x-ccv-fs-path",E0="application/x-ccv-fs-kind";function sg(n){return!!n&&Array.from(n.types).includes(Bi)}function C0(n){const l=n.getData(Bi);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 Yi({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 w=i.findIndex(k=>!k.disabled);return w===-1?0:w}),b=x.useRef(null);x.useLayoutEffect(()=>{const w=u.current;if(!w)return;b.current=document.elementsFromPoint(n,l).find(R=>!w.contains(R))??null;const k=w.getBoundingClientRect(),C=8,E=Math.max(C,Math.min(n,window.innerWidth-k.width-C)),O=Math.max(C,Math.min(l,window.innerHeight-k.height-C));p({left:E,top:O})},[n,l]),x.useLayoutEffect(()=>{var w;(w=u.current)==null||w.focus()},[]),x.useLayoutEffect(()=>{function w(C){var E;(E=u.current)!=null&&E.contains(C.target)||o()}function k(C){var R;const E=C.target;if(E===document||E===document.documentElement){o();return}if(!(E instanceof Node)||(R=u.current)!=null&&R.contains(E))return;const O=b.current;(!O||E.contains(O))&&o()}return document.addEventListener("mousedown",w),document.addEventListener("scroll",k,!0),()=>{document.removeEventListener("mousedown",w),document.removeEventListener("scroll",k,!0)}},[o]);function j(w){w.disabled||(w.onSelect(),o())}function N(w){if(w.key==="Escape"){w.preventDefault(),w.stopPropagation(),o();return}const k=i.map((C,E)=>({item:C,index:E})).filter(C=>!C.item.disabled);if(k.length!==0){if(w.key==="ArrowDown"||w.key==="ArrowUp"){w.preventDefault();const C=w.key==="ArrowDown"?1:-1,E=k.findIndex(R=>R.index===g),O=k[(((E===-1?0:E)+C)%k.length+k.length)%k.length];O&&_(O.index);return}if(w.key==="Enter"||w.key===" "){w.preventDefault();const C=i[g];C&&j(C)}}}return s.jsxs("div",{ref:u,className:"ctxmenu",style:{left:m.left,top:m.top},role:"menu",tabIndex:-1,onKeyDown:N,children:[r&&s.jsx("div",{className:"ctxmenu__note",children:r}),i.map((w,k)=>s.jsxs("button",{type:"button",role:"menuitem","aria-disabled":w.disabled,className:"ctxmenu__item"+(k===g?" is-cursor":""),onMouseEnter:()=>_(k),onClick:()=>j(w),children:[s.jsx("span",{className:"ctxmenu__label",children:w.label}),w.hint&&s.jsx("span",{className:"ctxmenu__hint",children:w.hint})]},w.id))]})}const Bk=3500,Hk=9e3,zb=220;function Yr({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+zb);return()=>{clearTimeout(g),clearTimeout(_)}},[n]),!i)return null;const m=()=>{u(!0),setTimeout(()=>{r(null),l==null||l()},zb)};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 Vi({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 ou({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:N,onRename:w,onMove:k,onCopy:C,onDelete:E,onRefresh:O,onClose:R,zoomed:H,onToggleZoom:te}){const[Q,D]=x.useState(""),[$,ne]=x.useState(null),[Y,q]=x.useState(null),[I,V]=x.useState(null),[pe,J]=x.useState(null),[le,L]=x.useState(null),[z,G]=x.useState(null),ie=Ud("(hover: hover)"),de=x.useRef(null),A=x.useMemo(()=>Fk(u),[u]);function F(ge){return!(!I||ge===I.path||I.kind==="dir"&&ge.startsWith(`${I.path}/`)||ge===qr(I.path))}function U(ge){return!(!le||ge===le.path||le.kind==="dir"&&ge.startsWith(`${le.path}/`)||le.mode==="cut"&&ge===qr(le.path))}function ye(ge){L({path:ge.path,kind:ge.kind,mode:"copy"})}function W(ge){L({path:ge.path,kind:ge.kind,mode:"cut"})}function fe(ge){!le||!U(ge)||(ge&&!i.has(ge)&&b(ge),le.mode==="cut"?(k(le.path,ge),L(null)):C(le.path,ge))}function Le(ge,Ee){const Ve=ge.touches[0];if(!Ve)return;const et={timer:0,x:Ve.clientX,y:Ve.clientY,el:ge.currentTarget,fired:!1};et.timer=window.setTimeout(()=>{et.fired=!0,Ee(et.x,et.y,et.el)},qk),de.current=et}function lt(ge){const Ee=de.current,Ve=ge.touches[0];!Ee||!Ve||Math.hypot(Ve.clientX-Ee.x,Ve.clientY-Ee.y)>10&&(window.clearTimeout(Ee.timer),de.current=null)}function ke(ge){const Ee=de.current;Ee&&(window.clearTimeout(Ee.timer),Ee.fired&&ge.preventDefault())}function Be(){var ge;return(ge=de.current)!=null&&ge.fired?(de.current=null,!0):!1}function Ye(ge,Ee,Ve,et){D((et==null?void 0:et.path)??""),G({x:ge,y:Ee,opener:Ve,entry:et})}function Qe(){const ge=z==null?void 0:z.opener;G(null),ge!=null&&ge.isConnected&&ge.focus()}function qn(ge){return{onContextMenu:Ee=>{Ee.preventDefault(),Ye(Ee.clientX,Ee.clientY,Ee.currentTarget,ge)},onTouchStart:Ee=>Le(Ee,(Ve,et,Pe)=>Ye(Ve,et,Pe,ge)),onTouchMove:lt,onTouchEnd:ke,onTouchCancel:ke}}function We(ge){ge.target===ge.currentTarget&&(ge.preventDefault(),Ye(ge.clientX,ge.clientY,ge.currentTarget,null))}function _n(ge){ge.target===ge.currentTarget&&Le(ge,(Ee,Ve,et)=>Ye(Ee,Ve,et,null))}function Ge(ge){if(!(ge.ctrlKey||ge.metaKey)||ge.target instanceof HTMLInputElement)return;const Ee=ge.key.toLowerCase();if(Ee==="v"){ge.preventDefault(),fe(Rt());return}if(!Q)return;const Ve=Ib(l,Q);Ve&&(Ee==="c"?(ge.preventDefault(),ye(Ve)):Ee==="x"&&(ge.preventDefault(),W(Ve)))}function ct(ge){return Ee=>{Ee.dataTransfer.effectAllowed="copyMove",Ee.dataTransfer.setData(Bi,ge.path),Ee.dataTransfer.setData(E0,ge.kind),V({path:ge.path,kind:ge.kind})}}function nt(){V(null),J(null)}function It(ge){return Ee=>{Ee.dataTransfer.types.includes(Bi)&&(Ee.stopPropagation(),!(ge.kind!=="dir"||!F(ge.path))&&(Ee.preventDefault(),Ee.dataTransfer.dropEffect="move",J(ge.path)))}}function Se(ge){return Ee=>{if(!Ee.dataTransfer.types.includes(Bi)||(Ee.stopPropagation(),ge.kind!=="dir"||!F(ge.path)))return;Ee.preventDefault();const Ve=Ee.dataTransfer.getData(Bi);J(null),Ve&&k(Ve,ge.path)}}function rt(ge){!ge.dataTransfer.types.includes(Bi)||!F("")||(ge.preventDefault(),ge.dataTransfer.dropEffect="move",J(""))}function kn(ge){if(!ge.dataTransfer.types.includes(Bi)||!F(""))return;ge.preventDefault();const Ee=ge.dataTransfer.getData(Bi);J(null),Ee&&k(Ee,"")}const[Ut,ot]=x.useState(""),Fs=Ut.trim(),Vn=Fs.length>0,Rn=x.useRef(null),Mt=x.useRef(g);Mt.current=g;function $t(ge){ot(ge),Rn.current&&clearTimeout(Rn.current);const Ee=ge.trim();if(!Ee){Mt.current("");return}Rn.current=setTimeout(()=>Mt.current(Ee),Gk)}function an(ge){Rn.current&&clearTimeout(Rn.current),ot(""),Mt.current(""),D(ge.path),_(ge)}const bt=Vn&&(p==null?void 0:p.query)===Fs?p:null;function Rt(){if(Q==="")return"";const ge=Ib(l,Q);if((ge==null?void 0:ge.kind)==="dir")return Q;const Ee=Q.lastIndexOf("/");return Ee===-1?"":Q.slice(0,Ee)}function nn(ge,Ee){const Ve=Ee??Rt();Ve&&!i.has(Ve)&&b(Ve),q({parent:Ve,kind:ge})}function Zt(){if(!z)return[];const ge=et=>ie?et:void 0;if(!z.entry)return[{id:"paste",label:"Вставить в корень проекта",hint:ge("Ctrl+V"),disabled:!U(""),onSelect:()=>fe("")},{id:"new-file",label:"Создать файл",onSelect:()=>nn("file","")},{id:"new-dir",label:"Создать каталог",onSelect:()=>nn("dir","")}];const Ee=z.entry,Ve=[Ee.kind==="file"?{id:"open",label:"Открыть",onSelect:()=>j(Ee.path)}:{id:"toggle",label:i.has(Ee.path)?"Свернуть":"Развернуть",onSelect:()=>b(Ee.path)},{id:"copy",label:"Копировать",hint:ge("Ctrl+C"),onSelect:()=>ye(Ee)},{id:"cut",label:"Вырезать",hint:ge("Ctrl+X"),onSelect:()=>W(Ee)}];return Ee.kind==="dir"&&(Ve.push({id:"paste",label:"Вставить",hint:ge("Ctrl+V"),disabled:!U(Ee.path),onSelect:()=>fe(Ee.path)}),Ve.push({id:"new-file",label:"Создать файл",onSelect:()=>nn("file",Ee.path)}),Ve.push({id:"new-dir",label:"Создать каталог",onSelect:()=>nn("dir",Ee.path)})),Ve.push({id:"rename",label:"Переименовать",onSelect:()=>ne(Ee.path)}),Ve.push({id:"delete",label:"Удалить",onSelect:()=>E(Ee)}),Ve}const St=Vn?[]:Dt("",0);function Dt(ge,Ee){const Ve=l[ge],et=[];if(Y&&Y.parent===ge&&et.push(s.jsxs("div",{className:"fsrow fsrow--draft",style:Hi(Ee),children:[s.jsx("span",{className:"fsrow__icon",children:Y.kind==="dir"?s.jsx(Oh,{}):s.jsx(zh,{})}),s.jsx(Vi,{className:"rename--file",value:"",placeholder:Y.kind==="dir"?"имя каталога":"имя файла",onCommit:Pe=>{q(null),N(ge,Y.kind,Pe)},onCancel:()=>q(null)})]},`draft:${ge}`)),!Ve)return et.push(s.jsx("p",{className:"fsrow__pending",style:Hi(Ee),children:"читаем…"},`wait:${ge}`)),et;Ve.length===0&&!Y&&et.push(s.jsx("p",{className:"fsrow__pending",style:Hi(Ee),children:"пусто"},`empty:${ge}`));for(const Pe of Ve){const Pt=Pe.kind==="dir"&&i.has(Pe.path);et.push($===Pe.path?s.jsxs("div",{className:"fsrow fsrow--draft",style:Hi(Ee),children:[s.jsx("span",{className:"fsrow__icon",children:Pe.kind==="dir"?s.jsx(Oh,{open:Pt}):s.jsx(zh,{})}),s.jsx(Vi,{className:"rename--file",value:Pe.name,placeholder:"новое имя",onCommit:st=>{ne(null),w(Pe.path,st)},onCancel:()=>ne(null)})]},Pe.path):s.jsx(Vk,{entry:Pe,depth:Ee,open:Pt,active:Pe.path===r,selected:Pe.path===Q,dirty:o.has(Pe.path),gitStatus:A.get(Pe.path),dragging:(I==null?void 0:I.path)===Pe.path,dropTarget:pe===Pe.path,cut:(le==null?void 0:le.mode)==="cut"&&le.path===Pe.path,onClick:()=>{Be()||(D(Pe.path),Pe.kind==="dir"?b(Pe.path):j(Pe.path))},onRename:()=>ne(Pe.path),onDelete:()=>E(Pe),onDragStart:ct(Pe),onDragEnd:nt,onDragOver:It(Pe),onDrop:Se(Pe),...qn(Pe)},Pe.path)),Pt&&et.push(...Dt(Pe.path,Ee+1))}return et}function Xn(){if(!bt)return[s.jsx("p",{className:"fsrow__pending",style:Hi(0),children:"ищем…"},"search:wait")];if(bt.entries.length===0)return[s.jsx("p",{className:"fsrow__pending",style:Hi(0),children:"ничего не найдено"},"search:empty")];const ge=bt.entries.map(Ee=>s.jsx(Xk,{entry:Ee,gitStatus:A.get(Ee.path),onClick:()=>an(Ee)},Ee.path));return bt.truncated&&ge.push(s.jsxs("p",{className:"fsrow__pending",style:Hi(0),children:["показаны первые ",bt.entries.length," — уточните запрос"]},"search:truncated")),ge}return s.jsxs("aside",{className:(n?"sidepane sidepane--files sidepane--open":"sidepane sidepane--files")+(H?" sidepane--zoomed":""),"aria-label":"Файлы проекта",onKeyDown:Ge,children:[s.jsxs("div",{className:"sidepane__head",onDoubleClick:ge=>{te&&(ge.target.closest("button")||te())},children:[s.jsx(Pk,{}),s.jsx("span",{className:"sidepane__title",children:"Файлы"}),s.jsx("button",{className:"sidepane__btn",title:"Новый файл","aria-label":"Новый файл",onClick:()=>nn("file"),children:s.jsx(Qk,{})}),s.jsx("button",{className:"sidepane__btn",title:"Новый каталог","aria-label":"Новый каталог",onClick:()=>nn("dir"),children:s.jsx(Zk,{})}),s.jsx("button",{className:"sidepane__btn",title:"Перечитать дерево","aria-label":"Перечитать дерево",onClick:O,children:"↻"}),te&&s.jsx("button",{className:"sidepane__btn",title:H?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":H?"Свернуть панель файлов":"Развернуть панель файлов на весь экран","aria-pressed":H,onClick:te,children:s.jsx(ou,{active:H})}),s.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель файлов",onClick:R,children:"✕"})]}),s.jsxs("div",{className:"fssearch",children:[s.jsx(Wk,{}),s.jsx("input",{className:"fssearch__input",type:"text",value:Ut,spellCheck:!1,placeholder:"Поиск файлов и папок…","aria-label":"Поиск файлов и папок",onChange:ge=>$t(ge.target.value),onKeyDown:ge=>{ge.stopPropagation(),ge.key==="Escape"&&(ge.preventDefault(),Ut?$t(""):ge.currentTarget.blur())}}),Ut&&s.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>$t(""),children:"✕"})]}),s.jsx("div",{className:"sidepane__scroll fstree"+(pe===""?" fstree--drop-target":""),tabIndex:-1,onDragOver:rt,onDrop:kn,onContextMenu:We,onTouchStart:_n,onTouchMove:lt,onTouchEnd:ke,onTouchCancel:ke,children:Vn?Xn():St}),s.jsx(Yr,{result:m}),z&&s.jsx(Yi,{x:z.x,y:z.y,items:Zt(),onClose:Qe})]})}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:N,onDragStart:w,onDragEnd:k,onDragOver:C,onDrop:E,onContextMenu:O,onTouchStart:R,onTouchMove:H,onTouchEnd:te,onTouchCancel:Q}){const D="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:D,style:Hi(l),draggable:!0,onDragStart:w,onDragEnd:k,onDragOver:C,onDrop:E,onContextMenu:O,onTouchStart:R,onTouchMove:H,onTouchEnd:te,onTouchCancel:Q,children:[s.jsxs("button",{className:"fsrow__main",onClick:b,title:T0(n),children:[s.jsx("span",{className:"fsrow__icon"+Lh("fsrow__icon",m),children:n.kind==="dir"?s.jsx(Oh,{open:i}):s.jsx(zh,{})}),s.jsx("span",{className:"fsrow__name"+Lh("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:N,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:Hi(0),onClick:i,title:T0(n),children:[s.jsx("span",{className:"fsrow__icon"+Lh("fsrow__icon",l),children:n.kind==="dir"?s.jsx(Oh,{}):s.jsx(zh,{})}),s.jsx("span",{className:"fsrow__name"+Lh("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 Hi(n){return{"--depth":n}}function Ib(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=qr(o.path);for(;r(m,u),!!m;)m=qr(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 Lh(n,l){return l?` ${n}--git-${l}`:""}function Oh({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 zh(){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),N=x.useRef(i);N.current=i;function w(E){g(E),j.current&&clearTimeout(j.current);const O=E.trim();if(!O){N.current("");return}j.current=setTimeout(()=>N.current(O),Jk)}const k=b&&(l==null?void 0:l.query)===_?l:null;function C(){if(!k)return[s.jsx("p",{className:"fsrow__pending",children:"ищем…"},"grep:wait")];if(k.matches.length===0)return[s.jsx("p",{className:"fsrow__pending",children:"ничего не найдено"},"grep:empty")];const E=[];let O="";for(const R of k.matches)R.path!==O&&(O=R.path,E.push(s.jsx("p",{className:"searchgroup__path",title:R.path,children:R.path},`path:${R.path}`))),E.push(s.jsx(tw,{match:R,onClick:()=>r(R)},`${R.path}:${R.line}:${R.column}`));return k.truncated&&E.push(s.jsxs("p",{className:"fsrow__pending",children:["показаны первые ",k.matches.length," — уточните запрос"]},"grep:truncated")),E}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:E=>{m&&(E.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(ou,{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:E=>w(E.target.value),onKeyDown:E=>{E.stopPropagation(),E.key==="Escape"&&(E.preventDefault(),p?w(""):E.currentTarget.blur())}}),p&&s.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>w(""),children:"✕"})]}),s.jsx("div",{className:"sidepane__scroll fstree",children:b?C():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 ih=null;function lw(){return ih||(ih=Promise.all([Ze(()=>import("./index-QlFQPxZP.js"),__vite__mapDeps([20,4,3,5,2,21,6]),import.meta.url),Ze(()=>import("./index-PAORgBv5.js").then(n=>n.v),__vite__mapDeps([4,3,5]),import.meta.url),Ze(()=>import("./index-BHot-lnj.js"),[],import.meta.url),Ze(()=>import("./index-DqN3Yjn2.js"),__vite__mapDeps([21,3,4,5,2]),import.meta.url),Ze(()=>import("./codemirror-C1bYpAmx.js"),__vite__mapDeps([22,2,3,4,5]),import.meta.url),Ze(()=>import("./codemirrorImages-MC8VsJDU.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 ih=null,n})),ih}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),N=x.useRef(new Map),w=x.useRef(new Map),k=x.useRef(new Set),C=x.useRef(null),E=x.useRef(o),O=x.useRef(u),R=x.useRef(n),H=x.useRef(i),te=x.useRef(l);E.current=o,O.current=u,R.current=n,H.current=i,te.current=l;const Q=x.useRef(m),D=x.useRef(p),$=x.useRef(g);Q.current=m,D.current=p,$.current=g;const[ne,Y]=x.useState("loading"),[q,I]=x.useState(!1);function V(z,G,ie){Od(ie)&&G.dispatch({effects:z.refreshImages.of(null)})}function pe(z,G,ie){const de=b.current,A=R.current===G&&de,F=A?de.state:N.current.get(G);if(!F)return;const U=F.doc.toString().indexOf(ie);if(U===-1)return;const ye={from:U,to:U+ie.length};if(A){de.dispatch({changes:ye});return}const W=F.update({changes:ye}).state;N.current.set(G,W),E.current(G,W.doc.toString())}function J(z,G){return[z.markdownImages({getDocPath:()=>G,getImage:ie=>Q.current[ie],requestImage:ie=>D.current(ie)}),z.EditorView.domEventHandlers({dragover(ie){return sg(ie.dataTransfer)?(ie.preventDefault(),ie.dataTransfer&&(ie.dataTransfer.dropEffect="copy"),!0):!1},drop(ie,de){if(!ie.dataTransfer||!sg(ie.dataTransfer))return!1;const A=C0(ie.dataTransfer);if(!A)return!1;ie.preventDefault();const F=de.posAtCoords({x:ie.clientX,y:ie.clientY})??de.state.selection.main.head,U=$k(G,A.path,A.kind),ye=de.state.doc.sliceString(Math.max(0,F-1),F),fe=(ye!==""&&!/\s/.test(ye)?" ":"")+U;return de.dispatch({changes:{from:F,insert:fe},selection:{anchor:F+fe.length},userEvent:"input.drop"}),de.focus(),!0},paste(ie,de){var U;const A=Array.from(((U=ie.clipboardData)==null?void 0:U.files)??[]).filter(ye=>ye.type.startsWith("image/"));if(A.length===0)return!1;ie.preventDefault();const F=[];for(const ye of A){const W=$.current(G,ye,()=>{W&&pe(z,G,W)});W&&F.push(W)}return F.length>0&&de.dispatch(de.state.replaceSelection(F.join(`
123
+ `))),!0}})]}function le(z,G,ie,de,A){const F=N.current.get(de),U=w.current.get(de)===A&&(F==null?void 0:F.doc.length)===te.current.length&&F.doc.toString()===te.current;if(F&&U)ie.setState(F),V(z,ie,de);else{const W=z.EditorState.create({doc:te.current,extensions:[z.basicSetup,z.Prec.highest(z.keymap.of([{key:"Mod-s",preventDefault:!0,run:()=>(O.current(R.current),!0)}])),z.keymap.of([z.indentWithTab]),G.of([]),iw(de)?z.EditorView.lineWrapping:[],Od(de)?J(z,de):[],z.editorTheme,z.editorHighlight,z.EditorView.updateListener.of(fe=>{fe.docChanged&&E.current(R.current,fe.state.doc.toString())})]});N.current.set(de,W),w.current.set(de,A),ie.setState(W),k.current.delete(de)}if(k.current.has(de))return()=>{};let ye=!1;return pk(de).then(W=>{ye||!W||R.current!==de||(ie.dispatch({effects:G.reconfigure(W)}),N.current.set(de,ie.state),k.current.add(de))}),()=>{ye=!0}}x.useEffect(()=>{if(!_.current)return;let G=!1,ie=null,de=null;Y("loading"),I(!1);const A=window.setTimeout(()=>{G||I(!0)},200);return(async()=>{let F;try{F=await lw()}catch{window.clearTimeout(A),G||Y("error");return}if(G||!_.current)return;window.clearTimeout(A);const U=new F.Compartment;C.current=U,j.current=F,de=new F.EditorView({parent:_.current}),b.current=de,ie=le(F,U,de,R.current,H.current),Y("ready")})(),()=>{G=!0,window.clearTimeout(A),ie==null||ie(),de==null||de.destroy(),b.current===de&&(b.current=null),j.current=null,C.current=null}},[]),x.useEffect(()=>{const z=j.current,G=b.current,ie=C.current;if(!(!z||!G||!ie))return le(z,ie,G,n,i)},[n,i]),x.useEffect(()=>{const z=b.current,G=j.current;z&&G&&V(G,z,R.current)},[m]);const L=x.useRef(0);return x.useEffect(()=>{const z=b.current,G=j.current;if(!z||!G||!r||r.token===L.current)return;L.current=r.token;const ie=z.state.doc.lines,de=Math.min(Math.max(r.line,1),ie),A=z.state.doc.line(de),F=Math.min(A.from+Math.max(r.column-1,0),A.to);z.dispatch({selection:G.EditorSelection.cursor(F),effects:G.EditorView.scrollIntoView(F,{y:"center"})}),z.focus()},[r]),x.useEffect(()=>()=>{const z=b.current;z&&N.current.set(n,z.state)},[n]),s.jsxs("div",{className:"editor__code",children:[s.jsx("div",{ref:_,className:"editor__code-surface"+(ne==="ready"?"":" is-hidden")}),ne==="loading"&&q&&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:"Загружается редактор…"})]}),ne==="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 rh=null,ch=null;function cw(){return rh||(rh=Promise.all([Ze(()=>import("./katex-DFbIS0RS.js"),[],import.meta.url),Ze(()=>Promise.resolve({}),__vite__mapDeps([24]),import.meta.url)]).then(([n])=>n.default).catch(n=>{throw rh=null,n})),rh}function ow(){return ch||(ch=Ze(()=>import("./mermaid.core-DjpUkD1z.js").then(n=>n.bb),__vite__mapDeps([25,26]),import.meta.url).then(n=>n.default).catch(n=>{throw ch=null,n})),ch}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,Ub=Promise.resolve();function fw(n,l){const i=Ub.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 Ub=i.catch(()=>{}),i}async function ii(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 lg(){try{return await navigator.clipboard.readText()}catch{return null}}const Og=1600,$c="Копировать",Wo="Скопировано";function Xi({text:n,hint:l,className:i}){const[r,o]=x.useState(!1);return x.useEffect(()=>{if(!r)return;const u=setTimeout(()=>o(!1),Og);return()=>clearTimeout(u)},[r]),x.useEffect(()=>o(!1),[n]),s.jsx("button",{type:"button",className:"copybtn"+(r?" copybtn--done":"")+(i?` ${i}`:""),"aria-label":r?Wo:`${$c} ${l}`,title:r?Wo:`${$c} ${l}`,onClick:()=>{ii(n).then(u=>{u&&o(!0)})},children:r?Wo:$c})}function Xh({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(Xh,{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 $b={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 k=!1;return b(null),fw(i,g).then(C=>{k||b({svg:C})},C=>{k||b({error:C instanceof Error?C.message:String(C)})}),()=>{k=!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(Xi,{text:i,hint:"код диаграммы"})]}),s.jsx("pre",{className:"embed__errtext",children:_.error}),j]});const N=`Превью ${$b[l]}`,w=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:$b[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(Xi,{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(Xh,{doc:w,title:N})}),m&&l!=="mermaid"&&s.jsx(D0,{doc:w,title:N,onClose:()=>p(!1)})]})}function _l({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),N=x.useRef(null),w=l.find(E=>E.value===n)??null;x.useEffect(()=>{if(!p)return;const E=l.findIndex(O=>O.value===n);b(E===-1?0:E)},[p]),x.useEffect(()=>{if(!p)return;function E(O){var R;(R=j.current)!=null&&R.contains(O.target)||g(!1)}return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[p]),x.useEffect(()=>{var E,O;p&&((O=(E=N.current)==null?void 0:E.querySelector(".is-cursor"))==null||O.scrollIntoView({block:"nearest"}))},[p,_]),x.useEffect(()=>{if(!p)return;const E=N.current,O=xw(j.current);if(!E||!O)return;const R=E.getBoundingClientRect().bottom-O.getBoundingClientRect().bottom;R>0&&(O.scrollTop+=Math.min(R+8,E.offsetHeight))},[p]);function k(E){g(!1),E.value!==n&&i(E.value)}function C(E){if(E.key==="Escape"){if(!p)return;E.preventDefault(),E.stopPropagation(),g(!1);return}if(E.key==="ArrowDown"||E.key==="ArrowUp"){if(E.preventDefault(),!p)return g(!0);const O=E.key==="ArrowDown"?1:l.length-1;return b(R=>(R+O)%l.length)}if(E.key==="Enter"||E.key===" "){if(E.preventDefault(),!p)return g(!0);const O=l[_];O&&k(O)}}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(E=>!E),onKeyDown:C,children:[s.jsx("span",{className:"select__value",children:(w==null?void 0:w.label)??m}),s.jsx(_w,{})]}),p&&s.jsx("div",{ref:N,className:"select__menu",role:"listbox","aria-label":u??o,children:l.map((E,O)=>s.jsxs("button",{type:"button",role:"option","aria-selected":E.value===n,className:"select__option"+(O===_?" is-cursor":"")+(E.value===n?" is-on":""),onMouseEnter:()=>b(O),onClick:()=>k(E),children:[s.jsx("span",{className:"select__check","aria-hidden":"true",children:E.value===n?"✓":""}),s.jsx("span",{className:"select__label",children:E.label}),E.hint&&s.jsx("span",{className:"select__hint",children:E.hint})]},E.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 zr=1,z0=8,oh=1.25;function Nw(n){return Math.min(z0,Math.max(zr,n))}function kw({url:n}){const[l,i]=x.useState({scale:zr,x:0,y:0}),[r,o]=x.useState(!1),u=x.useRef(null),m=x.useRef(null);function p(w,k,C){i(E=>{const O=Nw(E.scale*w);if(O===E.scale)return E;if(O<=zr)return{scale:zr,x:0,y:0};const R=(k-E.x)/E.scale,H=(C-E.y)/E.scale;return{scale:O,x:k-O*R,y:C-O*H}})}x.useEffect(()=>{const w=u.current;if(!w)return;function k(C){C.preventDefault();const E=w.getBoundingClientRect(),O=C.clientX-E.left-E.width/2,R=C.clientY-E.top-E.height/2;p(C.deltaY<0?oh:1/oh,O,R)}return w.addEventListener("wheel",k,{passive:!1}),()=>w.removeEventListener("wheel",k)},[]);function g(w){l.scale<=zr||(w.currentTarget.setPointerCapture(w.pointerId),m.current={pointerId:w.pointerId,startX:w.clientX,startY:w.clientY,origX:l.x,origY:l.y},o(!0))}function _(w){const k=m.current;!k||k.pointerId!==w.pointerId||i(C=>({...C,x:k.origX+(w.clientX-k.startX),y:k.origY+(w.clientY-k.startY)}))}function b(){m.current=null,o(!1)}const j=l.scale>zr,N=!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<=zr,title:"Уменьшить","aria-label":"Уменьшить",onClick:()=>p(1/oh,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(oh,0,0),children:s.jsx(bw,{})}),s.jsx("button",{className:"btn btn--sm",disabled:N,title:"Вписать в окно","aria-label":"Сбросить масштаб — вписать в окно",onClick:()=>i({scale:zr,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(_l,{className:"mediaview__speedselect",value:i,onChange:r,ariaLabel:"Скорость воспроизведения",options:ww})]})]})}const Bb=48;function Ew(n,l,i,r){n.addEventListener("pointerdown",o=>{var R;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,_=((R=l.parentElement)==null?void 0:R.clientWidth)||1/0,b=Math.max(Bb,Math.floor(_)),j=document.createElement("span");j.className="md-img__size",l.appendChild(j),l.classList.add("is-resizing"),n.setPointerCapture(o.pointerId);let N=Math.round(p);const w=()=>{j.textContent=`${N} px`};w();const k=H=>{N=Math.min(b,Math.max(Bb,Math.round(p+H.clientX-m))),u.style.width=`${N}px`,w()},C=H=>{n.removeEventListener("pointermove",k),n.removeEventListener("pointerup",E),n.removeEventListener("pointercancel",O),j.remove(),l.classList.remove("is-resizing"),H&&N!==Math.round(p)?r(N):u.style.width=g},E=()=>C(!0),O=()=>C(!1);n.addEventListener("pointermove",k),n.addEventListener("pointerup",E),n.addEventListener("pointercancel",O)})}const Cw=x.lazy(()=>Ze(()=>import("./MarkdownTextEditor-Dt2Iu87I.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:N,onPasteImage:w}){const k=ni(n),C=Od(n.path)&&!n.binary&&!n.tooLarge,E=Vh(n.path)&&!n.binary&&!n.tooLarge,O=Nk(n),R=E&&n.previewMode,[H,te]=x.useState(!1);x.useEffect(()=>{R&&b(n.path)},[R,n.path,n.mtime,b]);const Q=(_==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"]}),C&&s.jsx("div",{className:"editor__viewtoggle",role:"tablist","aria-label":"Режим просмотра",children:[["preview","Просмотр","Отрендеренный документ, только чтение"],["text","Текст","Писать как в обычном редакторе, без разметки на виду"],["code","Код","Исходник Markdown"]].map(([D,$,ne])=>s.jsx("button",{className:"btn btn--sm"+(O===D?" is-on":""),role:"tab",title:ne,"aria-selected":O===D,onClick:()=>O!==D&&g(n.path,D),children:$},D))}),E&&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:"Код"})]}),R&&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:Q===null,onClick:()=>te(!0),children:"Развернуть"})]}),s.jsx("button",{className:"btn btn--sm",disabled:!k,title:"Сохранить (Ctrl+S)",onClick:()=>r(n.path),children:k?"Сохранить":"Сохранено"})]}),n.stale&&s.jsxs("div",{className:"editor__warn",children:[s.jsxs("span",{children:["Файл изменился на диске",k?" — а здесь есть несохранённые правки.":"."]}),s.jsx("button",{className:"btn btn--sm",onClick:()=>o(n.path),children:"Взять с диска"}),k&&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),"). Такие правит агент, а не браузер."]}):R?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:[Q!==null?s.jsx(Xh,{doc:Q,title:`Превью ${ng(n.path)}`,className:"webpreview__frame"}):(_==null?void 0:_.error)===void 0?s.jsx("p",{className:"editor__empty",children:"Собираем превью…"}):null,(_==null?void 0:_.loading)&&Q!==null&&s.jsx("span",{className:"webpreview__busy",children:"Обновляем…"})]}),H&&Q!==null&&s.jsx(D0,{doc:Q,title:ng(n.path),onClose:()=>te(!1)})]}):C&&O==="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:N,onPasteImage:w},`${n.path}:${n.revision}`)}):C&&n.previewMode?s.jsx(Aw,{path:n.path,text:n.text,images:j,onRequestImage:N,onChange:i}):s.jsx(rw,{path:n.path,doc:n.text,revision:n.revision,goto:l,onChange:i,onSave:r,images:j,onRequestImage:N,onPasteImage:w})]})}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 N=!1;return Bd(l).then(w=>{N||m(w)}),()=>{N=!0}},[l]),x.useEffect(()=>{var w;const N=p.current;if(N){for(const k of Array.from(N.querySelectorAll("img"))){if((w=k.parentElement)!=null&&w.classList.contains("md-img"))continue;const C=document.createElement("span");C.className="md-img",C.dataset.src0=k.getAttribute("src")??"",k.replaceWith(C),C.appendChild(k);const E=document.createElement("span");E.className="md-img__grip",E.title="Потяните, чтобы изменить ширину",E.setAttribute("aria-label","Изменить ширину картинки"),C.appendChild(E),Ew(E,C,()=>C.querySelector("img"),O=>{var D;const R=Array.from(N.querySelectorAll(".md-img")),H=Ak(b.current),te=H[R.indexOf(C)];if(!te||H.length!==R.length){(D=C.querySelector("img"))==null||D.style.removeProperty("width");return}const Q=b.current;j.current(n,Q.slice(0,te.from)+Mk(te,O)+Q.slice(te.to))})}for(const k of Array.from(N.querySelectorAll(".md-img"))){const C=k.querySelector("img");if(!C)continue;const E=Rk(n,k.dataset.src0??"");let O="ok",R="";if(E.kind==="outside")O="blocked",R=`Путь вне проекта: ${k.dataset.src0}`;else if(E.kind==="project"){const te=i[E.path];if(!te)O="loading",R=`Загружается: ${E.path}`,r(E.path);else if("error"in te)O="missing",R=`Нет файла: ${E.path}`;else{const Q=kk(te);C.getAttribute("src")!==Q&&C.setAttribute("src",Q)}}k.dataset.state=O,C.hidden=O!=="ok";let H=k.querySelector(".md-img__ph");O==="ok"?H==null||H.remove():(H||(H=document.createElement("span"),H.className="md-img__ph",k.prepend(H)),H.textContent=R)}}},[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:ng(p.path)}),ni(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(ou,{active:u})})]})}function Ql(n){return n.claudeSessionId??n.id}function kh(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 Hb(n){return n.state!=="closed"}function I0(n){return[...n.filter(Hb),...n.filter(l=>!Hb(l))]}function uh(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 zd(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} ${zd(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} ${zd(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(N=>N.id)),j=new Set([..._].filter(N=>b.has(N)));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," ",zd(_.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 zg({className:n}){return s.jsx("img",{src:Iw,alt:"","aria-hidden":"true",className:n,style:{aspectRatio:"200 / 184"}})}function Ig({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 L;const{accounts:u,auth:m,multi:p}=yg(),g=["claude","antigravity","codex"].filter(z=>l.includes(z)).flatMap(z=>z==="claude"&&p?u.map(G=>{const ie=m[G.id],de=By(ie);return{key:`claude:${G.id}`,id:"claude",label:G.name,hint:de?`Claude Code, ${de}`:"Claude Code",account:G,isDefault:G.id===i,needsLogin:G.id!==$i&&ie!=null&&!ie.loggedIn}}):[{key:z,id:z,...Bw[z]}]),_=g.length>1,b=g.find(z=>z.isDefault)??g[0],j=Math.max(0,g.indexOf(b)),[N,w]=x.useState(!1),[k,C]=x.useState(0),[E,O]=x.useState({left:0,top:0}),R=x.useRef(null),H=x.useRef(null),te=x.useRef(null);function Q(){te.current&&window.clearTimeout(te.current.timer),te.current=null}function D(){Q(),C(j),w(!0)}function $(z){var G;w(!1),z&&((G=R.current)==null||G.focus())}function ne(z){if(n||!_||z.button!==0)return;const G={timer:0,x:z.clientX,y:z.clientY,fired:!1};G.timer=window.setTimeout(()=>{G.fired=!0,D()},Uw),te.current=G}function Y(z){const G=te.current;!G||G.fired||Math.hypot(z.clientX-G.x,z.clientY-G.y)>$w&&Q()}function q(){te.current&&!te.current.fired&&Q()}function I(z){var G;if((G=te.current)!=null&&G.fired){te.current=null,z.preventDefault();return}n||b&&J(b)}function V(z){_&&(z.preventDefault(),!n&&D())}function pe(z){if(n||!_)return;(z.key==="ArrowDown"||z.key==="ArrowUp"||z.key==="Enter"&&z.shiftKey)&&(z.preventDefault(),D())}x.useLayoutEffect(()=>{if(!N)return;const z=R.current,G=H.current;if(!z||!G)return;const ie=z.getBoundingClientRect(),de=G.getBoundingClientRect(),A=8,F=Math.max(A,Math.min(ie.right-de.width,window.innerWidth-de.width-A));let U=ie.top-de.height-8;U<A&&(U=Math.min(ie.bottom+8,window.innerHeight-de.height-A)),O({left:F,top:U})},[N]),x.useLayoutEffect(()=>{var z;N&&((z=H.current)==null||z.focus())},[N]),x.useLayoutEffect(()=>{if(!N)return;function z(G){var de,A;const ie=G.target;!((de=H.current)!=null&&de.contains(ie))&&!((A=R.current)!=null&&A.contains(ie))&&$(!1)}return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[N]);function J(z){var G;if($(!1),z.needsLogin&&z.account){o(z.account.id);return}r(z.id,(G=z.account)==null?void 0:G.id)}function le(z){if(z.key==="Escape"){z.preventDefault(),z.stopPropagation(),$(!0);return}if(z.key==="ArrowDown"||z.key==="ArrowUp"){z.preventDefault();const G=z.key==="ArrowDown"?1:-1;C(ie=>(ie+G+g.length)%g.length);return}if(z.key==="Enter"||z.key===" "){z.preventDefault();const G=g[k];G&&J(G);return}z.key==="Tab"&&$(!1)}return s.jsxs("div",{className:"newsession",children:[s.jsxs("button",{ref:R,type:"button",className:"btn btn--primary newsession__btn",disabled:n,title:_?p?`Новая сессия под «${((L=b==null?void 0:b.account)==null?void 0:L.name)??""}». Удерживайте, чтобы выбрать агента или аккаунт`:"Удерживайте, чтобы выбрать агента":void 0,"aria-label":p&&(b!=null&&b.account)?`Новая сессия, аккаунт «${b.account.name}»`:void 0,"aria-haspopup":_?"menu":void 0,"aria-expanded":_?N:void 0,onClick:I,onContextMenu:V,onPointerDown:ne,onPointerMove:Y,onPointerUp:q,onPointerCancel:q,onPointerLeave:q,onKeyDown:pe,children:["+ Сессия",p&&(b==null?void 0:b.account)&&s.jsx("span",{className:`newsession__acct acct--${b.account.color}`,"aria-hidden":"true"}),_&&s.jsx(qw,{})]}),N&&_&&s.jsx("div",{ref:H,className:"newsession__menu",style:{left:E.left,top:E.top},role:"menu","aria-label":p?"Выбрать агента и аккаунт для новой сессии":"Выбрать агента для новой сессии",tabIndex:-1,onKeyDown:le,children:g.map((z,G)=>{var ie;return s.jsxs("button",{type:"button",role:"menuitem",className:"newsession__item"+(G===k?" is-cursor":"")+(G>0&&((ie=g[G-1])==null?void 0:ie.id)!==z.id?" newsession__item--sep":""),onMouseEnter:()=>C(G),onClick:()=>J(z),children:[z.account?s.jsx("span",{className:"newsession__mark newsession__mark--account",children:s.jsx(Sa,{account:z.account,size:"md"})}):s.jsx("span",{className:`newsession__mark newsession__mark--${z.id}`,"aria-hidden":"true",children:z.id==="antigravity"?s.jsx(zg,{className:"newsession__mark-logo"}):z.id==="codex"?s.jsx(Ig,{className:"newsession__mark-logo"}):s.jsx(Gw,{})}),s.jsxs("span",{className:"newsession__text",children:[s.jsx("span",{className:"newsession__label",children:z.label}),s.jsx("span",{className:"newsession__hint",children:z.hint})]}),z.needsLogin?s.jsx("span",{className:"newsession__tag newsession__tag--login",children:"Войти"}):z.isDefault&&s.jsx("span",{className:"newsession__tag",children:"по клику"})]},z.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,Dp=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?Dp.format(Math.round(l/r),"minute"):i<1440*r?Dp.format(Math.round(l/(60*r)),"hour"):i<10080*r?Dp.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 N,w;const j=((N=l.find(k=>k.id===b.workspaceId))==null?void 0:N.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:((w=b.title)==null?void 0:w.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",qb="ccv:sidebar.expandedProjects",Gb="ccv:sidebar.expandedProjectArchives",q0=500,ag="транскрипт остаётся на диске — сессию можно вернуть из архива в любой момент.";function Qw({open:n,connected:l,status:i,workspaces:r,archivedWorkspaces:o,sessionFolders:u,pinnedFolders:m,projectSessions:p,onRequestSessions:g,pinned:_,live:b,listOrder:j,liveSessionsFirst:N,onReorder:w,activeWorkspaceId:k,activeSessionId:C,onSelectWorkspace:E,onRenameSession:O,onStopSession:R,onPinSessions:H,onSelectPinned:te,onCloseWorkspaces:Q,onRestoreWorkspaces:D,onUnmarkWorkspaces:$,onArchiveSessions:ne,onUnarchiveSessions:Y,onCreateFolder:q,onRenameFolder:I,onSetFolderColor:V,onAssignToFolder:pe,onOpenWorkspace:J,folderNotice:le,onDismissFolderNotice:L,onNewSession:z,enabledProviders:G,lastAccountId:ie,onSignInAccount:de,onOpenExtensions:A,account:F,onOpenAccount:U,relay:ye,onOpenRelay:W,onOpenSettings:fe,onOpenTasks:Le,onOpenSite:lt,onOpenVideo:ke,contentResults:Be,onSearchContent:Ye,onOpenContentHit:Qe,themeMode:qn,onCycleTheme:We}){var je;const _n=yg(),[Ge,ct]=x.useState(null),[nt,It]=x.useState(null),[Se,rt]=x.useState(null);function kn(y){return(Se==null?void 0:Se.folderId)===y.id?Se.color??void 0:y.color}function Ut(y){const T=y&&kn(y);return T?{"--folder-color":T}:void 0}const ot=x.useRef(void 0),[Fs,Vn]=x.useState(null),[Rn,Mt]=x.useState(null),[$t,an]=x.useState(""),[bt,Rt]=x.useState(dS),[nn,Zt]=x.useState(fS),[St,Dt]=x.useState(hS),[Xn,ge]=x.useState(()=>Vb(qb)),[Ee,Ve]=x.useState(()=>Vb(Gb)),[et,Pe]=x.useState([]);function Pt(y){Dt(y);try{localStorage.setItem(B0,y)}catch{}}const st=$t.trim().toLowerCase(),ut=st!=="",vs=x.useMemo(()=>kh(r,j==null?void 0:j.workspaces,y=>y.id,"bottom"),[r,j]),Dn=x.useMemo(()=>{const y=kh(_,j==null?void 0:j.pinned,Ql,"bottom");return N?I0(y):y},[_,j,N]),Ls=x.useMemo(()=>kh(b,j==null?void 0:j.live,Ql,"bottom"),[b,j]),us=x.useMemo(()=>{const y=new Map,T=new Map;for(const Z of b){const re=X0(Z);Zb(y,Z.workspaceId,re),Z.folderId&&Zb(T,Z.folderId,re)}return{byWorkspace:y,bySessionFolder:T}},[b]),wn=y=>y.name.toLowerCase().includes(st)||y.path.toLowerCase().includes(st),Ln=x.useMemo(()=>ut?vs.filter(y=>{if(wn(y))return!0;const T=p[y.id];return!!T&&(T.sessions.some(Z=>Md(Z,st))||T.archived.some(Z=>Md(Z,st)))}):vs,[vs,p,st,ut]),Os=x.useMemo(()=>ut?o.filter(wn):o,[o,st,ut]),sn=y=>{var T;return((T=r.find(Z=>Z.id===y))==null?void 0:T.name)??"—"},rn=y=>{var T;return(T=r.find(Z=>Z.id===y))==null?void 0:T.path},ts=x.useMemo(()=>ut?Dn.filter(y=>(y.title??"").toLowerCase().includes(st)||sn(y.workspaceId).toLowerCase().includes(st)):Dn,[Dn,r,st,ut]),cn=x.useMemo(()=>ut?Ls.filter(y=>(y.title??"").toLowerCase().includes(st)||sn(y.workspaceId).toLowerCase().includes(st)):Ls,[Ls,r,st,ut]),On=!ut;function on(y){Rt(T=>{const Z=T.includes(y)?T.filter(re=>re!==y):[...T,y];try{localStorage.setItem($0,JSON.stringify(Z))}catch{}return Z})}const yt=y=>!bt.includes(y);function un(y){Zt(T=>{const Z=T.includes(y)?T.filter(re=>re!==y):[...T,y];try{localStorage.setItem(H0,JSON.stringify(Z))}catch{}return Z})}const ds=y=>!nn.includes(y);function fs(y,T){ge(Z=>{if(Z.includes(y)===T)return Z;const re=T?[...Z,y]:Z.filter(Me=>Me!==y);return Xb(qb,re),re})}function Ks(y){Ve(T=>{const Z=T.includes(y)?T.filter(re=>re!==y):[...T,y];return Xb(Gb,Z),Z})}x.useEffect(()=>{k&&fs(k,!0)},[k]),x.useEffect(()=>Pe(y=>y.length?[]:y),[st]);const yl=x.useRef(new Set);x.useEffect(()=>{if(!l){yl.current.clear();return}for(const y of Xn)yl.current.has(y)||!r.some(T=>T.id===y)||(yl.current.add(y),y!==k&&g(y))},[l,Xn,r,k]);function vl(y){const T=p[y.id],Z=!ut||wn(y),re=!Z,Me=re?!et.includes(y.id):Xn.includes(y.id),Ae=T?Z?T.sessions.length:T.sessions.filter(Xe=>Md(Xe,st)).length:void 0;return{entry:T,showAll:Z,forced:re,open:Me,count:Ae}}function vt(y,T){if(T.forced){Pe(Z=>Z.includes(y.id)?Z.filter(re=>re!==y.id):[...Z,y.id]);return}fs(y.id,!T.open)}function zs(y,T){vt(y,T),!T.open&&y.id!==k&&E(y.id)}const zn=x.useMemo(()=>rg(ts,m,y=>y.pinnedFolderId,!ut),[ts,m,ut]),K=x.useMemo(()=>({groups:[],ungrouped:cn}),[cn]),me=((j==null?void 0:j.workspaces.length)??0)>0,Ce=((j==null?void 0:j.pinned.length)??0)>0,Ie=((j==null?void 0:j.live.length)??0)>0,gt=Sh({enabled:On,scope:"workspaces",itemKey:y=>y.id,groups:aS,ungrouped:Ln,onReorder:w}),ln=Sh({enabled:On,scope:"pinned",itemKey:Ql,groups:zn.groups,ungrouped:zn.ungrouped,onReorder:w}),Nt=Sh({enabled:On,scope:"live",itemKey:Ql,groups:K.groups,ungrouped:K.ungrouped,onReorder:w});x.useEffect(()=>{if(!Se)return;const y=[...m,...u].find(T=>T.id===Se.folderId);y&&y.color===(Se.color??void 0)&&rt(null)},[Se,m,u]),x.useEffect(()=>()=>window.clearTimeout(ot.current),[]);const In=og(Ln),Sn=og(Os),[kt,Qs]=x.useState(null),[dn,jl]=x.useState(null),[Nl,Fn]=x.useState(null),[Gt,Ca]=x.useState(null),[js,Wl]=x.useState(null),Ns=x.useRef(null);function ns(y,T){const Z=y.touches[0];if(!Z)return;const re={timer:0,x:Z.clientX,y:Z.clientY,el:y.currentTarget,fired:!1};re.timer=window.setTimeout(()=>{re.fired=!0,T(re.x,re.y,re.el)},q0),Ns.current=re}function sl(y){const T=Ns.current,Z=y.touches[0];!T||!Z||Math.hypot(Z.clientX-T.x,Z.clientY-T.y)>10&&(window.clearTimeout(T.timer),Ns.current=null)}function Wt(y){const T=Ns.current;T&&(window.clearTimeout(T.timer),T.fired&&y.preventDefault())}function Zs(){var y;return(y=Ns.current)!=null&&y.fired?(Ns.current=null,!0):!1}function ri(){const y=kt==null?void 0:kt.opener;Qs(null),y!=null&&y.isConnected&&y.focus()}function Jl(){const y=dn==null?void 0:dn.opener;jl(null),y!=null&&y.isConnected&&y.focus()}function hs(){const y=Gt==null?void 0:Gt.opener;Ca(null),y!=null&&y.isConnected&&y.focus()}function ea(){const y=js==null?void 0:js.opener;Wl(null),y!=null&&y.isConnected&&y.focus()}function ta(y){return{onContextMenu:T=>{T.preventDefault(),Qs({x:T.clientX,y:T.clientY,opener:T.currentTarget,ids:In.targetsFor(y)})},onTouchStart:T=>ns(T,(Z,re,Me)=>Qs({x:Z,y:re,opener:Me,ids:In.targetsFor(y)})),onTouchMove:sl,onTouchEnd:Wt,onTouchCancel:Wt}}function Ps(y){return{onContextMenu:T=>{T.preventDefault(),jl({x:T.clientX,y:T.clientY,opener:T.currentTarget,ids:Sn.targetsFor(y)})},onTouchStart:T=>ns(T,(Z,re,Me)=>jl({x:Z,y:re,opener:Me,ids:Sn.targetsFor(y)})),onTouchMove:sl,onTouchEnd:Wt,onTouchCancel:Wt}}function ms(y){return{onContextMenu:T=>{T.preventDefault(),Ca({x:T.clientX,y:T.clientY,opener:T.currentTarget,ids:[y.id]})},onTouchStart:T=>ns(T,(Z,re,Me)=>Ca({x:Z,y:re,opener:Me,ids:[y.id]})),onTouchMove:sl,onTouchEnd:Wt,onTouchCancel:Wt}}function ll(y){return{onContextMenu:T=>{T.preventDefault(),Wl({x:T.clientX,y:T.clientY,opener:T.currentTarget,ids:[y.id]})},onTouchStart:T=>ns(T,(Z,re,Me)=>Wl({x:Z,y:re,opener:Me,ids:[y.id]})),onTouchMove:sl,onTouchEnd:Wt,onTouchCancel:Wt}}const Kn=((k?(je=p[k])==null?void 0:je.sessions:void 0)??[]).filter(y=>y.state!=="closed").length,na=kt?[{id:"close",label:kt.ids.length>1?`Закрыть проекты (${kt.ids.length})`:"Закрыть проект",onSelect:()=>{Q(kt.ids),In.clear()}},...kt.ids.length===1?[{id:"new-session-folder",label:"Новая папка сессий",onSelect:()=>{const y=kt.ids[0];fs(y,!0),Mt(y)}}]:[],...kt.ids.length===1?[{id:"unmark",label:"Убрать из ccv",onSelect:()=>Fn(kt.ids[0])}]:[],...kt.ids.length===1&&On?gt.menuItems(kt.ids[0],me):[]]:[],Il=kt?"закрытие не удаляет проект: каталог и история сессий остаются на диске — открыть его снова можно кнопкой «+ Проект»."+(k&&kt.ids.includes(k)&&Kn>0?` в нём сейчас незавершённых сессий: ${Kn} — при закрытии они остановятся на хосте.`:""):void 0,Fi=dn?[{id:"restore",label:dn.ids.length>1?`Вернуть проекты (${dn.ids.length})`:"Вернуть проект",onSelect:()=>{D(dn.ids),Sn.clear()}},...dn.ids.length===1?[{id:"unmark",label:"Убрать из ccv",onSelect:()=>Fn(dn.ids[0])}]:[]]:[],sa=dn?"каталог и история сессий всё это время оставались на диске — восстановление их не трогает.":void 0,dt=Gt?ts.find(y=>y.id===Gt.ids[0]):void 0,la=Gt?[{id:"rename",label:"Переименовать",onSelect:()=>ct(Gt.ids[0])},{id:"unpin",label:"Открепить",onSelect:()=>{dt&&H(dt.workspaceId,[dt.id],!1)}},{id:"archive",label:"Убрать в архив",onSelect:()=>{dt&&ne(dt.workspaceId,[dt.id])}},...dt&&dt.workspaceId===k?cg({folders:u.filter(y=>y.workspaceId===dt.workspaceId),ids:[dt.id],hasFolder:dt.folderId!=null,assign:(y,T)=>pe("session",y,T,dt.workspaceId),onClear:()=>{},onNewFolder:()=>{fs(dt.workspaceId,!0),Mt(dt.workspaceId)}}):[],...eS(dt?cg({folders:m,ids:[dt.id],hasFolder:dt.pinnedFolderId!=null,assign:(y,T)=>pe("pinned",y,T),onClear:()=>{},onNewFolder:()=>Vn("pinned")}):[]),...On&&dt?ln.menuItems(Ql(dt),Ce):[]]:[],bn=js?cn.find(y=>y.id===js.ids[0]):void 0,Ul=js?[{id:"stop",label:"Остановить",onSelect:()=>{bn&&R(bn)}},{id:"rename",label:"Переименовать",onSelect:()=>ct(js.ids[0])},{id:"pin",label:(bn==null?void 0:bn.pinned)===!0?"Открепить":"Закрепить",onSelect:()=>{bn&&H(bn.workspaceId,[bn.id],bn.pinned!==!0)}},{id:"archive",label:"Убрать в архив",onSelect:()=>{bn&&ne(bn.workspaceId,[bn.id])}},...On&&bn?Nt.menuItems(Ql(bn),Ie):[]]:[],ks={start:ns,move:sl,end:Wt,consumed:Zs};function Un(y,T){return s.jsxs("div",{className:"row row--confirm",style:Ih(T),role:"alertdialog","aria-label":`Убрать из ccv «${y.name}»`,children:[s.jsx("p",{className:"row__confirm-text",children:`Убрать «${y.name}» из ccv? Проект исчезнет из списка, каталог, файлы и транскрипты останутся на диске, сессии проекта будут остановлены.`}),s.jsxs("div",{className:"row__confirm-bar",children:[s.jsx("button",{type:"button",className:"btn btn--sm",onClick:()=>Fn(null),children:"Отмена"}),s.jsx("button",{type:"button",className:"btn btn--danger btn--sm",autoFocus:!0,onClick:()=>{Fn(null),$([y.id])},children:"Убрать из ccv"})]})]},y.id)}function ci(y){var Me,Ae;if(Nl===y.id)return Un(y,0);const Z=vl(y),re=`ws-branch-${y.id}`;return s.jsxs(x.Fragment,{children:[s.jsxs("div",{"data-row-key":y.id,"data-row-scope":"workspaces",className:Xo(y.id===k,In.selected.includes(y.id))+" row--project"+gt.dropClass(y.id),style:$r(0),...ta(y),children:[On&&s.jsx("button",{type:"button",className:"row__grip",title:"Перетащить, чтобы изменить порядок","aria-label":"Перетащить проект на другое место в списке",...gt.gripHandlers(y.id),children:s.jsx(Eh,{})}),s.jsx("button",{type:"button",className:"row__chev","aria-expanded":Z.open,"aria-controls":re,"aria-label":`${Z.open?"Свернуть":"Развернуть"} проект «${y.name}»`,title:Z.open?"Свернуть сессии проекта":"Показать сессии проекта",onClick:()=>{Zs()||zs(y,Z)},children:s.jsx(Fh,{open:Z.open})}),s.jsxs("button",{className:"row__main",onClick:Xe=>{Zs()||In.click(Xe,y,()=>{E(y.id),fs(y.id,!0)})},onKeyDown:Xe=>gt.onKeyDown(y.id,Xe),children:[s.jsxs("span",{className:"row__title",children:[y.name,y.hasClaudeMd&&" ·"]}),s.jsx("span",{className:"row__meta",title:y.path,children:y.path})]}),s.jsx(F0,{agg:us.byWorkspace.get(y.id)}),Z.count!==void 0&&s.jsx("span",{className:"sidebar__count row__count",title:"Всего сессий в проекте, запущенных и нет",children:Z.count})]}),Z.open&&s.jsx("div",{id:re,role:"group","aria-label":`Сессии проекта «${y.name}»`,className:"tree__branch",style:$r(0),children:s.jsx(Zw,{workspace:y,baseDepth:1,loaded:Z.entry!==void 0,sessions:((Me=Z.entry)==null?void 0:Me.sessions)??Yb,archived:((Ae=Z.entry)==null?void 0:Ae.archived)??Yb,folders:u.filter(Xe=>Xe.workspaceId===y.id),needle:st,showAll:Z.showAll,reorderEnabled:On,listOrder:j,liveSessionsFirst:N,activeSessionId:C,archiveExpanded:Ee.includes(y.id),onToggleArchive:()=>Ks(y.id),creatingFolder:Rn===y.id,onStartCreateFolder:()=>Mt(y.id),onFinishCreateFolder:()=>Mt(null),renamingId:Ge,setRenamingId:ct,renderFolderHead:ps,liveInFolder:us.bySessionFolder,isFolderOpen:ds,folderRowStyle:Ut,longPress:ks,onOpenSession:te,onRenameSession:O,onPinSessions:H,onArchiveSessions:ne,onUnarchiveSessions:Y,onCreateFolder:q,onAssignToFolder:pe,onReorder:w})})]},y.id)}function al(y){return Nl===y.id?Un(y,0):s.jsxs("div",{className:Xo(y.id===k,Sn.selected.includes(y.id)),...Ps(y),children:[s.jsxs("button",{className:"row__main",onClick:T=>{Zs()||Sn.click(T,y,()=>E(y.id))},children:[s.jsxs("span",{className:"row__title",children:[y.name,y.hasClaudeMd&&" ·"]}),s.jsx("span",{className:"row__meta",children:yS(y)})]}),s.jsx("button",{className:"row__restore",title:"Вернуть проект из архива",onClick:()=>D([y.id]),children:"Вернуть"})]},y.id)}function Ws(y,T){const Z=Ql(y);return s.jsxs("div",{"data-row-key":Z,"data-row-scope":"pinned",className:Xo(y.id===C,!1,y.provider,!!T,!0)+ln.dropClass(Z),style:Ut(T),...Ge===y.id?{}:{title:"Действия со строкой — правый клик или долгое нажатие",...ms(y)},children:[ig(T),Ge===y.id?s.jsx("div",{className:"row__main",children:s.jsx(Vi,{value:y.title??"",onCommit:re=>{O(y,re),ct(null)},onCancel:()=>ct(null)})}):s.jsxs(s.Fragment,{children:[On&&s.jsx("button",{type:"button",className:"row__grip",title:"Перетащить, чтобы изменить порядок","aria-label":"Перетащить сессию, чтобы изменить порядок в списке",...ln.gripHandlers(Z),children:s.jsx(Eh,{})}),s.jsx("button",{className:"row__main row__main--session",onClick:()=>{Zs()||te(y)},onKeyDown:re=>ln.onKeyDown(Z,re),children:s.jsx(Uh,{session:y,pinned:!1,projectName:sn(y.workspaceId),projectPath:rn(y.workspaceId)})})]})]},y.id)}function ss(y){const T=Ql(y);return s.jsx("div",{"data-row-key":T,"data-row-scope":"live",className:Xo(y.id===C,!1,y.provider,!1,!0)+Nt.dropClass(T),...Ge===y.id?{}:{title:"Действия со строкой — правый клик или долгое нажатие",...ll(y)},children:Ge===y.id?s.jsx("div",{className:"row__main",children:s.jsx(Vi,{value:y.title??"",onCommit:Z=>{O(y,Z),ct(null)},onCancel:()=>ct(null)})}):s.jsxs(s.Fragment,{children:[On&&s.jsx("button",{type:"button",className:"row__grip",title:"Перетащить, чтобы изменить порядок","aria-label":"Перетащить сессию, чтобы изменить порядок в списке",...Nt.gripHandlers(T),children:s.jsx(Eh,{})}),s.jsx("button",{className:"row__main row__main--session",onClick:()=>{Zs()||te(y)},onKeyDown:Z=>Nt.onKeyDown(T,Z),children:s.jsx(Uh,{session:y,pinned:y.pinned===!0,projectName:sn(y.workspaceId),projectPath:rn(y.workspaceId)})}),s.jsx("button",{type:"button",className:"row__stop",title:"Остановить сессию","aria-label":"Остановить сессию",onClick:Z=>{Z.stopPropagation(),!Zs()&&R(y)},children:s.jsx(rS,{})})]})},y.id)}function ps(y,T,Z={}){return s.jsx(sS,{folder:y,count:T,live:Z.live,depth:Z.depth??0,open:ds(y.id),renaming:nt===y.id,onToggle:()=>un(y.id),onStartRename:()=>It(y.id),onCommitRename:re=>{I(y.id,re),It(null)},onCancelRename:()=>It(null),color:kn(y),onPreviewColor:re=>{window.clearTimeout(ot.current),rt({folderId:y.id,color:re})},onCommitColor:re=>{rt({folderId:y.id,color:re}),V(y.id,re),window.clearTimeout(ot.current),ot.current=window.setTimeout(()=>rt(null),4e3)},onResetColor:()=>{window.clearTimeout(ot.current),rt(null),V(y.id,null)}},y.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[qn]}`,"aria-label":`Тема: ${Fb[qn]}. Переключить`,onClick:We,children:s.jsx(mS,{mode:qn})})]}),s.jsxs("div",{className:"sidebar__tabs",role:"tablist","aria-label":"Что показывать в списке",children:[s.jsx("button",{type:"button",role:"tab","aria-selected":St==="default",className:St==="default"?"sidebar__tab is-active":"sidebar__tab",onClick:()=>Pt("default"),children:s.jsx("span",{className:"sidebar__tab-label",children:"Все"})}),s.jsx("button",{type:"button",role:"tab","aria-selected":St==="pinned",className:St==="pinned"?"sidebar__tab is-active":"sidebar__tab",onClick:()=>Pt("pinned"),children:s.jsx("span",{className:"sidebar__tab-label",children:"Закреплённые"})}),s.jsxs("button",{type:"button",role:"tab","aria-selected":St==="live",className:St==="live"?"sidebar__tab is-active":"sidebar__tab",onClick:()=>Pt("live"),children:[s.jsx("span",{className:"sidebar__tab-label",children:"Запущенные"}),b.length>0&&s.jsx("span",{className:"sidebar__tab-count",children:b.length})]})]}),s.jsxs("div",{className:"fssearch fssearch--sidebar",children:[s.jsx(oS,{}),s.jsx("input",{className:"fssearch__input",type:"text",value:$t,spellCheck:!1,placeholder:"Проект или сессия…","aria-label":"Поиск по проектам и сессиям",onChange:y=>an(y.target.value),onKeyDown:y=>{y.stopPropagation(),y.key==="Escape"&&(y.preventDefault(),$t?an(""):y.currentTarget.blur())}}),$t&&s.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>an(""),children:"✕"})]}),s.jsxs("div",{className:"sidebar__scroll",children:[le&&s.jsxs("div",{className:"sidebar__notice",role:"alert",children:[s.jsx("span",{children:le}),s.jsx("button",{type:"button",className:"sidebar__notice-close","aria-label":"Закрыть сообщение",onClick:L,children:"✕"})]}),St==="pinned"?s.jsxs(s.Fragment,{children:[s.jsx(dh,{title:"Закреплённые",count:ts.length,open:yt("pinned"),onToggle:()=>on("pinned"),action:{label:"Новая папка закреплённых",onClick:()=>{Vn("pinned"),yt("pinned")||on("pinned")}}}),yt("pinned")&&s.jsxs(s.Fragment,{children:[Fs==="pinned"&&s.jsx("div",{className:"row",children:s.jsx("div",{className:"row__main",children:s.jsx(Vi,{value:"",placeholder:"Название папки",onCommit:y=>{q("pinned",y),Vn(null)},onCancel:()=>Vn(null)})})}),ts.length===0&&s.jsx("div",{className:"row",children:s.jsx("span",{className:"row__meta",children:ut?"Ничего не найдено":"закрепите сессию через её меню (правый клик или долгое нажатие) — она останется под рукой из любого проекта"})}),zn.groups.map(y=>s.jsxs(x.Fragment,{children:[ps(y.folder,y.items.length),ds(y.folder.id)&&y.items.map(T=>Ws(T,y.folder))]},y.folder.id)),zn.ungrouped.map(y=>Ws(y))]})]}):St==="live"?s.jsxs(s.Fragment,{children:[s.jsx(dh,{title:"Запущенные",count:cn.length,open:yt("live"),onToggle:()=>on("live")}),yt("live")&&s.jsxs(s.Fragment,{children:[cn.length===0&&s.jsx("div",{className:"row",children:s.jsx("span",{className:"row__meta",children:ut?"Ничего не найдено":"Нет запущенных сессий"})}),cn.map(y=>ss(y))]})]}):s.jsxs(s.Fragment,{children:[s.jsx(dh,{title:"Проекты",count:Ln.length,open:yt("workspaces"),onToggle:()=>on("workspaces")}),yt("workspaces")&&s.jsxs(s.Fragment,{children:[Ln.length===0&&s.jsx("div",{className:"row",children:s.jsx("span",{className:"row__meta",children:ut?"Ничего не найдено":"Пока ни одного — добавьте проект кнопкой «+ Проект»"})}),Ln.map(y=>ci(y))]}),o.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(dh,{title:"Архив проектов",count:Os.length,open:yt("workspacesArchive"),onToggle:()=>on("workspacesArchive"),hint:"проект закрывают вручную; каталог и история сессий остаются на диске и открываются заново отсюда или через «+ Проект»"}),yt("workspacesArchive")&&s.jsxs(s.Fragment,{children:[Os.length===0&&s.jsx("div",{className:"row",children:s.jsx("span",{className:"row__meta",children:ut?"Ничего не найдено":"Пока пусто"})}),Os.map(y=>al(y))]})]})]}),s.jsx(Fw,{query:$t,workspaces:r,results:Be,onSearch:Ye,onOpen:Qe})]}),s.jsxs("div",{className:"sidebar__foot",children:[_n.multi?s.jsxs("button",{className:"account-btn",title:"Аккаунты Claude",onClick:U,children:[s.jsx("span",{className:"account-btn__marks",children:_n.accounts.map(y=>{var Z;const T=((Z=_n.auth[y.id])==null?void 0:Z.loggedIn)===!1;return s.jsx("span",{className:T?"account-btn__mark is-out":"account-btn__mark",children:s.jsx(Sa,{account:y})},y.id)})}),s.jsx("span",{className:"account-btn__id",children:"Аккаунты Claude"}),_n.accounts.some(y=>{var T;return((T=_n.auth[y.id])==null?void 0:T.loggedIn)===!1})&&s.jsx("span",{className:"chip chip--warn",children:"нет входа"})]}):s.jsxs("button",{className:"account-btn",title:"Аккаунт Claude",onClick:U,children:[s.jsx("span",{className:F!=null&&F.loggedIn?"dot dot--on":"dot"}),s.jsx("span",{className:"account-btn__id",children:F===null?"Аккаунт":F.loggedIn?F.email||"Вход выполнен":"Войти в аккаунт"}),(F==null?void 0:F.plan)&&s.jsx("span",{className:"chip",children:F.plan})]}),W&&s.jsxs("button",{className:"account-btn",title:"Доступ с телефона и из браузера",onClick:W,children:[s.jsx("span",{className:ye!=null&&ye.connected?"dot dot--on":"dot"}),s.jsx("span",{className:"account-btn__id",children:ye===null?"Удалённый доступ":ye.paired?ye.connected?ye.name||"Удалённый доступ включён":"Удалённый доступ · нет связи":"Удалённый доступ"}),(ye==null?void 0:ye.connected)&&ye.clients>0&&s.jsx("span",{className:"chip",children:ye.clients})]}),s.jsxs("div",{className:"sidebar__foot-row",children:[s.jsx("button",{className:"btn btn--ghost",disabled:!A,title:"MCP-серверы и плагины",onClick:()=>A==null?void 0:A(),children:"Расширения"}),s.jsx("button",{className:"btn btn--ghost",title:"Настройки приложения",onClick:fe,children:"Настройки"}),s.jsx("button",{className:"btn btn--ghost sidebar__tasks",title:"Запланированные задачи","aria-label":"Запланированные задачи",onClick:Le,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:!k,title:"Страница сайта с выбором элементов и правками",onClick:lt,children:"Сайт"}),s.jsx("button",{className:"btn btn--ghost",disabled:!k,title:"Видео, Remotion и анимации проекта",onClick:ke,children:"Видео"})]}),s.jsxs("div",{className:"sidebar__foot-row",children:[s.jsx("button",{className:"btn btn--ghost",onClick:J,children:"+ Проект"}),s.jsx(Hw,{disabled:!k,providers:G,lastAccountId:ie,onStart:z,onSignIn:de})]})]}),kt&&s.jsx(Yi,{x:kt.x,y:kt.y,items:na,note:Il,onClose:ri}),dn&&s.jsx(Yi,{x:dn.x,y:dn.y,items:Fi,note:sa,onClose:Jl}),Gt&&s.jsx(Yi,{x:Gt.x,y:Gt.y,items:la,note:ag,onClose:hs}),js&&s.jsx(Yi,{x:js.x,y:js.y,items:Ul,note:ag,onClose:ea})]})}const Yb=[];function Md(n,l){return(n.title??"").toLowerCase().includes(l)}function ig(n){return n?s.jsx("span",{className:"row__stripe","aria-hidden":"true"}):null}function $r(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:N,onToggleArchive:w,creatingFolder:k,onStartCreateFolder:C,onFinishCreateFolder:E,renamingId:O,setRenamingId:R,renderFolderHead:H,liveInFolder:te,isFolderOpen:Q,folderRowStyle:D,longPress:$,onOpenSession:ne,onRenameSession:Y,onPinSessions:q,onArchiveSessions:I,onUnarchiveSessions:V,onCreateFolder:pe,onAssignToFolder:J,onReorder:le}){var It;const L=n.id,z=m!=="",G=x.useMemo(()=>{const Se=kh(r,_==null?void 0:_.sessions[L],Ql,"top");return b?I0(Se):Se},[r,_,L,b]),ie=x.useMemo(()=>p?G:G.filter(Se=>Md(Se,m)),[G,p,m]),de=x.useMemo(()=>p?o:o.filter(Se=>Md(Se,m)),[o,p,m]),A=x.useMemo(()=>rg(ie,u,void 0,!z),[ie,u,z]),F=x.useMemo(()=>rg(de,u),[de,u]),U=(((It=_==null?void 0:_.sessions[L])==null?void 0:It.length)??0)>0,ye=Sh({enabled:g,scope:"sessions",workspaceId:L,itemKey:Ql,groups:A.groups,ungrouped:A.ungrouped,onReorder:le}),W=og(ie),[fe,Le]=x.useState(null),[lt,ke]=x.useState(!1);x.useEffect(()=>ke(!1),[m]);const Be=z&&de.length>0,Ye=Be?!lt:N;function Qe(){const Se=fe==null?void 0:fe.opener;Le(null),Se!=null&&Se.isConnected&&Se.focus()}function qn(Se){return{onContextMenu:rt=>{rt.preventDefault(),Le({x:rt.clientX,y:rt.clientY,opener:rt.currentTarget,ids:W.targetsFor(Se)})},onTouchStart:rt=>$.start(rt,(kn,Ut,ot)=>Le({x:kn,y:Ut,opener:ot,ids:W.targetsFor(Se)})),onTouchMove:$.move,onTouchEnd:$.end,onTouchCancel:$.end}}const We=fe?ie.find(Se=>Se.id===fe.ids[0]):void 0,_n=(We==null?void 0:We.pinned)!==!0,Ge=fe?[...fe.ids.length===1?[{id:"rename",label:"Переименовать",onSelect:()=>R(fe.ids[0])}]:[],{id:"pin",label:_n?fe.ids.length>1?`Закрепить (${fe.ids.length})`:"Закрепить":fe.ids.length>1?`Открепить (${fe.ids.length})`:"Открепить",onSelect:()=>{q(L,fe.ids,_n),W.clear()}},{id:"archive",label:fe.ids.length>1?`Убрать в архив (${fe.ids.length})`:"Убрать в архив",onSelect:()=>{I(L,fe.ids),W.clear()}},...cg({folders:u,ids:fe.ids,hasFolder:(We==null?void 0:We.folderId)!=null,assign:(Se,rt)=>J("session",Se,rt,L),onClear:()=>W.clear(),onNewFolder:C}),...fe.ids.length===1&&g&&We?ye.menuItems(Ql(We),U):[]]:[];function ct(Se,rt,kn){const Ut=Ql(Se);return s.jsxs("div",{"data-row-key":Ut,"data-row-scope":"sessions",className:Xo(Se.id===j,W.selected.includes(Se.id),Se.provider,!!kn,!0)+ye.dropClass(Ut),style:$r(rt,D(kn)),...O===Se.id?{}:qn(Se),children:[ig(kn),O===Se.id?s.jsx("div",{className:"row__main",children:s.jsx(Vi,{value:Se.title??"",onCommit:ot=>{Y(Se,ot),R(null)},onCancel:()=>R(null)})}):s.jsxs(s.Fragment,{children:[g&&s.jsx("button",{type:"button",className:"row__grip",title:"Перетащить, чтобы изменить порядок","aria-label":"Перетащить сессию, чтобы изменить порядок в списке",...ye.gripHandlers(Ut),children:s.jsx(Eh,{})}),s.jsx("button",{className:"row__main row__main--session",onClick:ot=>{$.consumed()||W.click(ot,Se,()=>ne(Se))},onKeyDown:ot=>ye.onKeyDown(Ut,ot),children:s.jsx(Uh,{session:Se,pinned:Se.pinned===!0})}),s.jsx("button",{className:"row__edit",title:"Переименовать","aria-label":"Переименовать сессию",onClick:()=>{$.consumed()||R(Se.id)},children:"✎"})]})]},Se.id)}function nt(Se,rt,kn){return s.jsxs("div",{className:Xo(Se.id===j,!1,Se.provider,!!kn,!0),style:$r(rt,D(kn)),children:[ig(kn),s.jsx("button",{className:"row__main row__main--session",onClick:()=>ne(Se),children:s.jsx(Uh,{session:Se,pinned:!1,archived:!0})}),s.jsx("button",{className:"row__restore",title:"Вернуть сессию из архива",onClick:()=>V(L,[Se.id]),children:"Вернуть"})]},Se.id)}return s.jsxs(s.Fragment,{children:[k&&s.jsx("div",{className:"row row--hint",style:$r(l,void 0),children:s.jsx("div",{className:"row__main",children:s.jsx(Vi,{value:"",placeholder:"Название папки",onCommit:Se=>{pe("session",Se,L),E()},onCancel:E})})}),i?ie.length===0&&s.jsx("div",{className:"row row--hint",style:$r(l,void 0),children:s.jsx("span",{className:"row__meta",children:"Пока ни одной"})}):s.jsx("div",{className:"row row--hint",style:$r(l,void 0),"aria-busy":"true",children:s.jsx("span",{className:"row__meta",children:"Загрузка…"})}),A.groups.map(Se=>s.jsxs(x.Fragment,{children:[H(Se.folder,Se.items.length,{depth:l,live:te.get(Se.folder.id)}),Q(Se.folder.id)&&Se.items.map(rt=>ct(rt,l+1,Se.folder))]},Se.folder.id)),A.ungrouped.map(Se=>ct(Se,l)),i&&o.length>0&&(!z||de.length>0)&&s.jsxs(s.Fragment,{children:[s.jsx(Pw,{title:"Архив",count:de.length,open:Ye,depth:l,hint:"сессии без обращения дольше двух суток уезжают сюда сами; ничего не удаляется",onToggle:()=>Be?ke(Se=>!Se):w()}),Ye&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"row row--hint",style:$r(l,void 0),children:s.jsx("span",{className:"row__meta",children:"сюда сами уезжают сессии без обращения дольше двух суток; транскрипт остаётся на диске, ничего не удаляется"})}),F.groups.map(Se=>s.jsxs(x.Fragment,{children:[H(Se.folder,Se.items.length,{depth:l}),Q(Se.folder.id)&&Se.items.map(rt=>nt(rt,l+1,Se.folder))]},Se.folder.id)),F.ungrouped.map(Se=>nt(Se,l))]})]}),fe&&s.jsx(Yi,{x:fe.x,y:fe.y,items:Ge,note:ag,onClose:Qe})]})}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:Ih(r),children:s.jsxs("button",{className:"row__main",style:G0,"aria-expanded":i,title:`${m} — ${o}`,onClick:u,children:[s.jsx(Fh,{open:i}),s.jsx("span",{style:V0,children:n}),s.jsx("span",{className:"sidebar__count",children:l})]})})}function Xo(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 rg(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 wh="\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),wh);return r}function Lp(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 Sh(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 N(){window.cancelAnimationFrame(b.current.raf),b.current.raf=0,b.current.el=null}function w(I){N();const V=b.current;if(V.el=I.closest(".sidebar__scroll"),!V.el)return;const pe=56,J=16,le=()=>{const L=V.el;if(!L)return;const z=L.getBoundingClientRect();let G=0;if(V.y<z.top+pe?G=-J*Math.min(1,(z.top+pe-V.y)/pe):V.y>z.bottom-pe&&(G=J*Math.min(1,(V.y-(z.bottom-pe))/pe)),G!==0){const ie=L.scrollTop;L.scrollTop=ie+G,L.scrollTop!==ie&&j.current(V.x,V.y)}V.raf=window.requestAnimationFrame(le)};V.raf=window.requestAnimationFrame(le)}x.useEffect(()=>N,[]);function k(){N(),i(null),o(null),m(null)}function C(I,V){n.enabled&&(V.preventDefault(),V.currentTarget.setPointerCapture(V.pointerId),b.current.x=V.clientX,b.current.y=V.clientY,w(V.currentTarget),i(I),o(null),m(null))}function E(I,V){if(!l)return;const pe=document.elementFromPoint(I,V),J=_.get(l);if(p){const de=pe==null?void 0:pe.closest("[data-drop-folder]"),A=de?null:pe==null?void 0:pe.closest("[data-drop-zone]");if(de||A){const F=de?de.dataset.dropFolder:null,U=F??wh;o(null),m(U===J?null:{folderId:F});return}}const le=pe==null?void 0:pe.closest("[data-row-key]"),L=(le==null?void 0:le.dataset.rowScope)===n.scope?le.dataset.rowKey:void 0,z=L?_.get(L):void 0;if(m(null),!L||L===l||z===void 0||!p&&z!==J){o(null);return}const G=le.getBoundingClientRect(),ie=V-G.top<G.height/2?"before":"after";o(de=>(de==null?void 0:de.key)===L&&de.position===ie?de:{key:L,position:ie})}j.current=E;function O(I){b.current.x=I.clientX,b.current.y=I.clientY,E(I.clientX,I.clientY)}function R(){if(l&&u&&p)p(l,{folderId:u.folderId,order:null});else if(l&&r){const I=uh(g,l,r.key,r.position),V=_.get(r.key);p&&V!==_.get(l)?p(l,{folderId:V===wh?null:V??null,order:I}):I&&n.onReorder(n.scope,I,n.workspaceId)}k()}function H(I,V){if(!n.enabled)return;const pe=Lp(I,n.groups,n.ungrouped,n.itemKey,V);if(!pe)return;const J=uh(g,I,pe.target,pe.position);J&&n.onReorder(n.scope,J,n.workspaceId)}function te(I,V){const pe=Lp(I,n.groups,n.ungrouped,n.itemKey,"up"),J=Lp(I,n.groups,n.ungrouped,n.itemKey,"down"),le=[{id:"move-up",label:"Переместить выше",disabled:!pe,onSelect:()=>{if(!pe)return;const L=uh(g,I,pe.target,pe.position);L&&n.onReorder(n.scope,L,n.workspaceId)}},{id:"move-down",label:"Переместить ниже",disabled:!J,onSelect:()=>{if(!J)return;const L=uh(g,I,J.target,J.position);L&&n.onReorder(n.scope,L,n.workspaceId)}}];return V&&le.push({id:"reset-order",label:"Сбросить порядок",onSelect:()=>n.onReorder(n.scope,null,n.workspaceId)}),le}function Q(I){return l===I?" row--dragging":(r==null?void 0:r.key)===I?r.position==="before"?" row--drop-before":" row--drop-after":""}function D(I){return{onPointerDown:V=>C(I,V),onPointerMove:O,onPointerUp:R,onPointerCancel:k,onLostPointerCapture:k}}function $(I,V){!V.altKey||V.key!=="ArrowUp"&&V.key!=="ArrowDown"||(V.preventDefault(),H(I,V.key==="ArrowUp"?"up":"down"))}const ne=I=>(u==null?void 0:u.folderId)===I,Y=!!p&&l!==null&&_.get(l)!==wh,q=u!==null&&u.folderId===null;return{dragging:l!==null,dropClass:Q,gripHandlers:D,onKeyDown:$,menuItems:te,isDropFolder:ne,canUngroup:Y,zoneActive:q}}function cg(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 og(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(N=>N.id===r.current),j=n.findIndex(N=>N.id===g.id);if(b!==-1&&j!==-1){const[N,w]=b<j?[b,j]:[j,b];i(n.slice(N,w+1).map(k=>k.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 dh({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(Fh,{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 Ih(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,color:_,onPreviewColor:b,onCommitColor:j,onResetColor:N,depth:w}){const k=x.useRef(null),[C,E]=x.useState(null),O=x.useRef(null);x.useEffect(()=>()=>{var Y;return window.clearTimeout((Y=O.current)==null?void 0:Y.timer)},[]);function R(Y){const q=Y.touches[0];if(!q)return;const I={timer:0,x:q.clientX,y:q.clientY,el:Y.currentTarget,fired:!1};I.timer=window.setTimeout(()=>{I.fired=!0,E({x:I.x,y:I.y,opener:I.el})},q0),O.current=I}function H(Y){const q=O.current,I=Y.touches[0];!q||!I||Math.hypot(I.clientX-q.x,I.clientY-q.y)>10&&(window.clearTimeout(q.timer),O.current=null)}function te(Y){const q=O.current;q&&(window.clearTimeout(q.timer),q.fired&&Y.preventDefault())}function Q(){const Y=C==null?void 0:C.opener;E(null),Y!=null&&Y.isConnected&&Y.focus()}function D(){const Y=k.current;if(Y)try{Y.showPicker()}catch{Y.click()}}const $=[{id:"rename",label:"Переименовать",onSelect:m},{id:"color",label:"Выбрать цвет…",onSelect:D},...n.color?[{id:"reset-color",label:"Сбросить цвет",onSelect:N}]:[]],ne=x.useRef(j);return ne.current=j,x.useEffect(()=>{const Y=k.current;if(!Y)return;const q=()=>ne.current(Y.value);return Y.addEventListener("change",q),()=>Y.removeEventListener("change",q)},[o]),o?s.jsx("div",{className:"row",style:Ih(w),children:s.jsx("div",{className:"row__main",children:s.jsx(Vi,{value:n.name,placeholder:"Название папки",onCommit:p,onCancel:g})})}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"row",style:Ih(w),onContextMenu:Y=>{Y.preventDefault(),E({x:Y.clientX,y:Y.clientY,opener:Y.currentTarget})},onTouchStart:R,onTouchMove:H,onTouchEnd:te,onTouchCancel:te,children:[s.jsxs("button",{className:"row__main",style:G0,"aria-expanded":r,title:r?`Свернуть папку «${n.name}»`:`Развернуть папку «${n.name}»`,onClick:u,children:[s.jsx(Fh,{open:r}),s.jsx("span",{style:w>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":C!==null,onClick:Y=>{const q=Y.currentTarget.getBoundingClientRect();E({x:q.left,y:q.bottom,opener:Y.currentTarget})},children:s.jsx(iS,{})}),s.jsx("input",{ref:k,className:"row__color-input",type:"color",tabIndex:-1,"aria-hidden":"true",value:_??lS(),onChange:Y=>b(Y.target.value)})]})]}),C&&s.jsx(Yi,{x:C.x,y:C.y,items:$,onClose:Q})]})}function lS(){const n=getComputedStyle(document.documentElement).getPropertyValue("--folder-default").trim();return/^#[0-9a-f]{6}$/i.test(n)?n.toLowerCase():"#9a978d"}const aS=[];function Fh({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 Eh(){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 Uh({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:` · ${Op(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"?Op(n.updatedAt):` · ${Op(n.updatedAt)}`})]})]})]})}const Qb=["waiting","error","running","reconnecting","background","starting","halted","ready","fresh","closed"];function Zb(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(Sa,{account:m,className:"row__acct"}),i==="antigravity"&&s.jsx(zg,{className:"row__provider"}),i==="codex"&&s.jsx(Ig,{className:"row__provider row__provider--codex"}),n]}),o!==void 0&&s.jsx("span",{className:"row__project",title:u,children:o})]})}function Op(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(`
124
+ `),""),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(`
125
+ `).replace(/\n{3,}/g,`
126
+
127
+ `).trimEnd()+`
128
+ `}const TS=/[\\/:*?"<>|\u0000-\u001f]/g;function Pb(n){return(n??"").replace(TS," ").replace(/\s+/g," ").trim().replace(/^\.+/,"").replace(/[. ]+$/,"").slice(0,80).trim()||"Разговор"}function Wb(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 $h(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||$h(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||$h(n.current)}const K0=1500;function Q0(n){const l=[];let i=!1;for(const r of n.patch.split(`
129
+ `)){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(`
130
+ `).filter(E=>!/^(diff --git |index |--- |\+\+\+ |new file mode|deleted file mode)/.test(E)),j=_.some(E=>/^(@@|\+|-)/.test(E))?_.join(`
131
+ `):p==="add"?_.map(E=>`+${E}`).join(`
132
+ `):p==="delete"?_.map(E=>`-${E}`).join(`
133
+ `):_.join(`
134
+ `);let N=0,w=0;for(const E of j.split(`
135
+ `))E.startsWith("+")?N++:E.startsWith("-")&&w++;const k=Q0({path:o,oldPath:"",status:p==="add"?"added":p==="delete"?"deleted":"modified",added:N,removed:w,binary:!1,patch:j}),C=LS[p];!k.note&&C&&p!=="update"&&(k.note=C),i.push(k)}return i.length>0?i:null}const Jb=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=zp(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(zp(i.old_string),zp(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 zp(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-Jb);p<=Math.min(n.length-1,m+Jb);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 ug(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}, ${ug(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],", ",ug(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",Ug="",J0=.75,ev=2,VS=200,ey={voice:Ug,rate:1},Ip={min:J0,max:ev,step:.05};function uu(){return typeof window<"u"&&"speechSynthesis"in window}function tv(){try{const n=window.localStorage.getItem(W0);if(!n)return ey;const l=JSON.parse(n),i=typeof l.rate=="number"?l.rate:1;return{voice:typeof l.voice=="string"?l.voice:Ug,rate:Math.min(ev,Math.max(J0,i))}}catch{return ey}}function XS(n){try{window.localStorage.setItem(W0,JSON.stringify(n))}catch{}}function FS(n){const l=n.replace(/\r\n?/g,`
136
+ `).split(`
137
+ `),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(`
138
+ `);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(`
139
+ `).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 uu()?window.speechSynthesis.getVoices():[]}function ZS(){const[n,l]=x.useState(nv);return x.useEffect(()=>{if(!uu())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!==Ug){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 dg=new Set;let fg=null,Ed=0;function Ch(n){fg=n;for(const l of dg)l()}function WS(n){return dg.add(n),()=>dg.delete(n)}function $g(){Ed+=1,uu()&&window.speechSynthesis.cancel(),Ch(null)}function sv(n,l,i=tv()){if(!uu())return;const r=FS(l);r!==""&&($g(),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;Ch(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&&Ch(null)},_.onerror=()=>{m===Ed&&(Ed+=1,r.cancel(),Ch(null))},r.speak(_)})}function lv(n){const[l,i]=x.useState(()=>fg===n);return x.useEffect(()=>{const r=()=>i(fg===n);return r(),WS(r)},[n]),l}function tE({id:n,text:l}){const i=lv(n);if(!uu())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?$g():sv(n,l),children:r})}function Bg({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 Mn({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],N=b[b.length-1];!j||!N||(g.shiftKey&&document.activeElement===j?(g.preventDefault(),N.focus()):!g.shiftKey&&document.activeElement===N&&(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(N=>{if(!u.current)return;const w=N.filesChanged??[];!N.canRewind||w.length===0?o({kind:"empty",message:N.error||sE}):o({kind:"preview",reply:N})},N=>{u.current&&o({kind:"empty",message:N instanceof Error?N.message:String(N)})}),()=>{u.current=!1}),[]);function p(){m.current||(m.current=!0,o({kind:"running"}),l(n,!1).then(N=>{var E;if(m.current=!1,!u.current)return;if(!N.canRewind||N.error){o({kind:"done",error:!0,message:N.error||"Не удалось откатить файлы."});return}const w=((E=N.filesChanged)==null?void 0:E.length)??0,k=N.skippedLinks??0,C=k>0?` Пропущено ссылок: ${k}.`:"";o({kind:"done",error:!1,message:`Восстановлено файлов: ${w}.${C}`})},N=>{m.current=!1,u.current&&o({kind:"done",error:!0,message:N instanceof Error?N.message:String(N)})}))}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 N=r.kind==="done"&&r.error;b=s.jsx("p",{className:N?"modal__error":"modal__text",role:N?"alert":"status",children:r.message}),j=s.jsx("button",{type:"button",className:"btn btn--primary",onClick:_,children:"Закрыть"})}else{const{reply:N}=r,w=N.filesChanged??[];b=s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"modal__text",children:"Файлы, которые агент менял после этой реплики, вернутся к состоянию на её момент. Разговор не изменится."}),s.jsx("ul",{className:"rewind__files","aria-label":"Файлы к откату",children:w.map(k=>s.jsx("li",{className:"rewind__file",title:k,children:s.jsx("span",{className:"rewind__path",children:k})},k))}),s.jsxs("p",{className:"rewind__summary",children:[w.length," ",lE(w.length),N.insertions!==void 0||N.deletions!==void 0?s.jsxs(s.Fragment,{children:[" · ",s.jsxs("span",{className:"rewind__add",children:["+",N.insertions??0]})," ",s.jsxs("span",{className:"rewind__del",children:["−",N.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(Mn,{title:"Откатить файлы?",onClose:_,actions:j,className:"modal--rewind",children:b})}function Hg({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 N=x.useRef(null),w=x.useRef(null),k=x.useRef(!0),C=x.useRef(null),E=x.useRef(null),O=x.useRef(!1),R=x.useRef(null),H=MS(N,()=>{var Y;return(Y=R.current)==null?void 0:Y.call(R)}),te=x.useRef(H);te.current=H,x.useEffect(()=>{k.current=!0,C.current=null,O.current=!1,E.current!==null&&(clearTimeout(E.current),E.current=null)},[p]),x.useEffect(()=>{const Y=N.current,q=w.current;if(!Y||!q)return;function I(J){!Y||J===Y.scrollTop||(O.current=!0,Y.scrollTop=J)}function V(){if(!Y)return;const J=C.current;if(J){const le=ny(Y,J.id);if(le){const L=le.getBoundingClientRect().top-Y.getBoundingClientRect().top;I(Y.scrollTop+(L-J.top))}E.current!==null&&clearTimeout(E.current),E.current=setTimeout(()=>{C.current=null},500);return}k.current&&!te.current()&&I(Y.scrollHeight)}R.current=V;const pe=new ResizeObserver(V);return pe.observe(q),()=>{R.current=null,pe.disconnect(),E.current!==null&&clearTimeout(E.current)}},[]);function Q(){const Y=N.current;if(Y){if(O.current){O.current=!1;return}k.current=Y.scrollHeight-Y.scrollTop-Y.clientHeight<80}}function D(){if(u)return;const Y=N.current,q=r[0];if(Y&&q){const I=ny(Y,q.id);I&&(C.current={id:q.id,top:I.getBoundingClientRect().top-Y.getBoundingClientRect().top})}m==null||m()}let $=0;function ne(Y){return Y.kind==="user"?$++:-1}return s.jsx("div",{className:"transcript",ref:N,onScroll:Q,children:s.jsxs("div",{className:"stream",ref:w,children:[o&&s.jsx("button",{type:"button",className:"transcript__more",onClick:D,disabled:u,children:u?"Загружаем…":"Показать более раннее"}),r.map(Y=>s.jsx(ty,{item:Y,userIndex:ne(Y),onEditMessage:g,onRewindFiles:_,onOpenPreview:b},Y.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(Y=>s.jsx(ty,{item:Y,userIndex:ne(Y),onEditMessage:g,onRewindFiles:_,onOpenPreview:b},Y.id)),l&&s.jsx(nE,{waiting:i})]})})}function ty({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(Xi,{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:["↑",ly(n.inputTokens)," ↓",ly(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),[N,w]=x.useState(!1),k=x.useRef(null),C=x.useRef(!1),E=Ud("(max-width: 860px)"),O=x.useRef(null);function R(J,le){u({x:J,y:le})}function H(J){J.preventDefault(),R(J.clientX,J.clientY)}function te(J){const le=J.touches[0];if(!le)return;const L={timer:0,x:le.clientX,y:le.clientY,fired:!1};L.timer=window.setTimeout(()=>{L.fired=!0,R(L.x,L.y)},iE),O.current=L}function Q(J){const le=O.current,L=J.touches[0];!le||!L||Math.hypot(L.clientX-le.x,L.clientY-le.y)>10&&(window.clearTimeout(le.timer),O.current=null)}function D(J){const le=O.current;le&&(window.clearTimeout(le.timer),le.fired&&J.preventDefault())}function $(){_(n.text),w(!1),p(!0)}function ne(){p(!1)}function Y(){const J=g.trim();if(J===""&&!(n.images&&n.images.length>0))return;const le=i==null?void 0:i(l,J,n.images,r&&N?{rewindFiles:!0}:void 0);if(le instanceof Promise){if(C.current)return;C.current=!0,le.then(L=>{C.current=!1,L&&p(!1)},()=>{C.current=!1});return}le!==!1&&p(!1)}x.useEffect(()=>{const J=k.current;!J||!m||(J.style.height="auto",J.style.height=`${J.scrollHeight}px`)},[g,m]),x.useEffect(()=>{if(!m)return;const J=k.current;J&&(J.focus(),J.setSelectionRange(J.value.length,J.value.length))},[m]);function q(J){if(J.key==="Escape"){J.preventDefault(),J.stopPropagation(),ne();return}J.key==="Enter"&&!J.shiftKey&&!E&&(J.preventDefault(),Y())}const I=n.images&&n.images.length>0&&s.jsx("div",{className:"msg--user__images",children:n.images.map((J,le)=>s.jsx("img",{className:"msg--user__image",src:`data:${J.mediaType};base64,${J.data}`,alt:"Вложение"},le))}),V=n.files&&n.files.length>0&&s.jsx("div",{className:"msg--user__files",children:n.files.map((J,le)=>s.jsx(P0,{file:J},le))});if(m){const J=g.trim()!==""||!!(n.images&&n.images.length>0);return s.jsxs("div",{className:"msg--user msg--user--editing","data-item-id":n.id,children:[I,V,s.jsxs("div",{className:"msg--user__edit",children:[s.jsx("textarea",{ref:k,className:"msg--user__edit-field",value:g,onChange:le=>_(le.target.value),onKeyDown:q,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:N,onChange:le=>w(le.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:ne,children:"Отмена"}),s.jsx("button",{type:"button",className:"btn btn--sm btn--primary",onClick:Y,disabled:!J,children:"Сохранить"})]})]})]})}const pe=[{id:"copy",label:"Копировать",onSelect:()=>void ii(n.text)},...i?[{id:"edit",label:"Изменить",onSelect:$}]:[],...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:H,onTouchStart:te,onTouchMove:Q,onTouchEnd:D,onTouchCancel:D,children:[I,V,n.text,o&&s.jsx(Yi,{x:o.x,y:o.y,items:pe,onClose:()=>u(null)})]}),b&&r&&s.jsx(aE,{userIndex:l,onRewindFiles:r,onClose:()=>j(!1)})]})}function ny(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 Bd(n).then(j=>{if(b)return;const N=oE(j);if($h(o.current)){g.current=N;return}g.current=null,r(N)}),()=>{b=!0}},[n]),x.useEffect(()=>{function b(){const j=g.current;j===null||$h(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 w,k;const j=b.target.closest(".codeblock__copy");if(!(j instanceof HTMLElement))return;const N=((k=(w=j.parentElement)==null?void 0:w.querySelector("pre"))==null?void 0:k.textContent)??"";N!==""&&ii(N).then(C=>{if(!C)return;j.textContent=Wo,j.setAttribute("aria-label",Wo),j.classList.add("copybtn--done");const E=window.setTimeout(()=>{j.isConnected&&(j.textContent=$c,j.setAttribute("aria-label",hg),j.classList.remove("copybtn--done"))},Og);p.current.push(E)})}return s.jsxs(s.Fragment,{children:[s.jsx("div",{ref:o,className:"markdown-preview msg--assistant__body",onClick:_,dangerouslySetInnerHTML:m}),u]})}const hg=`${$c} блок кода`;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",hg),o.title=hg,o.textContent=$c,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(Bg,{diff:g},_)):s.jsx(sy,{text:JSON.stringify(n.input,null,2),hint:"аргументы вызова"}),n.result!==null&&(!m||n.isError)&&s.jsx(sy,{text:n.result,hint:"результат вызова",style:{marginTop:10}})]})]})}function sy({text:n,hint:l,style:i}){return s.jsxs("div",{className:"codeblock",style:i,children:[s.jsx("pre",{className:"code",children:n}),s.jsx(Xi,{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"&&Vh(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:N}=_;if(typeof b!="string"||typeof j!="string")return null;g.push({label:b,description:j,...typeof N=="string"?{preview:N}:{}})}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 ly(n){return n>=1e3?`${(n/1e3).toFixed(1)}k`:String(n)}const gE="ccv.dictation.lang",ay="ru-RU";function xE(n){try{return Function.prototype.toString.call(n).includes("[native code]")}catch{return!1}}function iy(){const n=window,l=[n.SpeechRecognition,n.webkitSpeechRecognition].filter(r=>typeof r=="function"),i=l.find(xE);return!i&&l.length>0&&Na("распознавание подменено: родной реализации в странице нет"),i??l[0]??null}function av(){var n;try{return((n=localStorage.getItem(gE))==null?void 0:n.trim())||ay}catch{return ay}}function Na(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(()=>iy()!==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),N=x.useRef(!1),w=x.useRef(null),k=x.useCallback(()=>{w.current&&clearTimeout(w.current),w.current=null},[]),C=x.useCallback(()=>{k();const te=async Q=>{if(w.current=null,!(!p.current||N.current)){if(!Q&&!await kE()){if(Na("ждём ответа на запрос доступа к микрофону"),!p.current||N.current)return;w.current=setTimeout(()=>void te(!0),NE);return}Na("движок не ответил на start()"),p.current=!1,r(!1),u("Распознавание не отвечает — проверьте расширения браузера и доступ к микрофону")}};w.current=setTimeout(()=>void te(!1),jE)},[k]);x.useEffect(()=>{_.current=n}),x.useEffect(()=>{const te=iy();if(!te)return;const Q=new te;return Q.lang=av(),Q.continuous=!0,Q.interimResults=!0,Q.onstart=()=>{Na("сессия открыта"),N.current=!0,k(),r(!0)},Q.onaudiostart=()=>{Na("пошёл звук с микрофона"),b.current.audio=!0},Q.onresult=D=>{var q;if(g.current)return;let $="",ne="";for(let I=D.resultIndex;I<D.results.length;I++){const V=D.results[I];if(!V)continue;const pe=((q=V[0])==null?void 0:q.transcript)??"";V.isFinal?$+=pe:ne+=pe}const Y=b.current;Y.heard=!0,Y.everHeard=!0,Na("распознано",{final:$,interim:ne}),_.current($,ne)},Q.onerror=D=>{b.current.lastError=D.error,Na("ошибка движка",D.error),!(D.error==="no-speech"||D.error==="aborted")&&(p.current=!1,r(!1),u(wE[D.error]??`Распознавание не работает: ${D.error}`))},Q.onend=()=>{g.current=!1,N.current=!1;const D=b.current,$=Date.now()-D.openedAt;if(Na("сессия закрыта",{мс:$,звук:D.audio,слова:D.heard,ошибка:D.lastError||null}),!p.current){r(!1);return}if(D.dead=!D.audio&&$<bE?D.dead+1:0,D.dead>=yE){p.current=!1,r(!1),u(D.lastError?`Распознавание не работает: ${D.lastError}`:"Распознавание закрывается сразу после запуска — проверьте доступ к микрофону в настройках сайта");return}D.silent=D.heard?0:D.silent+1,!D.everHeard&&!D.warned&&D.silent>=_E&&(D.warned=!0,u(D.audio?"Микрофон слушает, но речь не распознаётся — проверьте язык диктовки и уровень звука":"С микрофона не идёт звук — проверьте устройство ввода в настройках сайта в браузере")),j.current=setTimeout(()=>{if(j.current=null,!!p.current){D.openedAt=Date.now(),D.audio=!1,D.heard=!1,D.lastError="",C();try{Q.start()}catch{}}},vE)},m.current=Q,()=>{p.current=!1,j.current&&clearTimeout(j.current),j.current=null,k(),Q.onend=null,Q.onresult=null,Q.onerror=null,Q.onstart=null,Q.onaudiostart=null,Q.abort(),m.current=null}},[]);const E=x.useCallback(()=>{var te;if(p.current){if(p.current=!1,Na("выключение микрофона"),j.current&&clearTimeout(j.current),j.current=null,k(),!N.current){r(!1);return}(te=m.current)==null||te.stop()}},[]),O=x.useCallback(()=>{const te=m.current;if(te){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),Na("включение микрофона",{язык:te.lang}),C();try{te.start()}catch(Q){Na("start() не прошёл",Q)}}},[C]),R=x.useCallback(()=>{p.current?E():O()},[O,E]),H=x.useCallback(()=>{var te;p.current&&N.current&&(g.current=!0,(te=m.current)==null||te.abort())},[]);return{supported:l,listening:i,error:o,toggle:R,stop:E,drop:H}}const EE="(max-width: 860px)",ry=/^\/(\S*)$/,CE=new Set(["model","permissions"]);function TE(n){return CE.has(n.name)||n.name.startsWith("__")}const AE=new Set(["clear","rename"]),cy=/(?:^|\s)@([^\s@]*)$/,ME=200,RE=100,DE=190,LE=20*1024*1024,OE=1568,zE=.85;let Bh=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 oy(n){const l=n.lastIndexOf(".");return l===-1?"":n.slice(l+1).toLowerCase()}function $E(n){return n.type==="application/pdf"||oy(n.name)==="pdf"?"pdf":UE.test(n.type)||IE.has(oy(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)})}const Up="Вставленный текст";function HE(n){const l=new Set(n);if(!l.has(`${Up}.md`))return`${Up}.md`;for(let i=2;;i+=1){const r=`${Up} ${i}.md`;if(!l.has(r))return r}}async function qE(n){const l=await BE(n);if(l===null)return null;const i=$E(n);return Bh+=1,{id:`att${Bh}`,kind:i,name:n.name||"файл",mediaType:n.type||(i==="text"?"text/plain":"application/octet-stream"),size:n.size,data:l}}async function GE(n){var j,N;if(!n.type.startsWith("image/")||n.size>LE)return null;const l=await YE(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),(N=(j=l.image).close)==null||N.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?(Bh+=1,{id:`att${Bh}`,mediaType:g,data:b,previewUrl:_}):null}async function YE(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,longPasteThreshold:N=0,queueWhileBusy:w=!1,insertRequest:k=null,onInsertConsumed:C,onContextSearch:E,onCommand:O,onSend:R,onInterrupt:H,onEscape:te}){var zn;const Q=Ud(EE),[D,$]=x.useState(()=>p?xp(p):""),[ne,Y]=x.useState(!1),[q,I]=x.useState(0),V=x.useRef(null),pe=x.useRef(null),J=x.useRef(!1),le=x.useRef(null),[L,z]=x.useState(()=>p?xp(p).length:0),[G,ie]=x.useState(()=>p?[..._p(p).images]:[]),[de,A]=x.useState(()=>p?[..._p(p).docs]:[]),F=x.useRef([]),U=x.useRef([]);F.current=G,U.current=de;const[ye,W]=x.useState(null),[fe,Le]=x.useState(!1),[lt,ke]=x.useState(!1),Be=x.useRef(0),Ye=x.useRef(null),Qe=x.useCallback(K=>{!b||K.length===0||(async()=>{const me=[],Ce=[];let Ie=!1;const gt=()=>F.current.length+U.current.length>=qo.maxCount;for(const Nt of K){if(gt()){Ie=!0;break}if(Nt.type.startsWith("image/")){const kt=await GE(Nt);if(!kt){me.push(Nt.name||"изображение");continue}F.current=[...F.current,kt],ie(F.current);continue}if(U.current.reduce((kt,Qs)=>kt+Qs.size,0)+Nt.size>qo.maxTotalBytes){Ce.push(Nt.name||"файл");continue}const Sn=await qE(Nt);if(!Sn){me.push(Nt.name||"файл");continue}U.current=[...U.current,Sn],A(U.current)}const ln=[];Ie&&ln.push(`К сообщению можно приложить не больше ${qo.maxCount} вложений.`),Ce.length>0&&ln.push(`Документы вместе не больше ${ug(qo.maxTotalBytes)}: не добавлено — ${Ce.join(", ")}.`),me.length>0&&ln.push(`Не удалось прочитать: ${me.join(", ")}.`),ln.length>0&&W({ok:!1,message:ln.join(" ")})})()},[b]);function qn(K){ie(me=>me.filter(Ce=>Ce.id!==K))}function We(K){A(me=>me.filter(Ce=>Ce.id!==K))}function _n(K){var Ie;if(!b)return;const me=(Ie=K.clipboardData)==null?void 0:Ie.items;if(!me)return;const Ce=[];for(const gt of me){if(gt.kind!=="file")continue;const ln=gt.getAsFile();ln&&Ce.push(ln)}if(Ce.length===0){Ge(K);return}K.preventDefault(),Qe(Ce)}function Ge(K){var ln;if(N<=0)return;const me=((ln=K.clipboardData)==null?void 0:ln.getData("text/plain"))??"";if(me.length<=N)return;const Ce=new File([me],HE(U.current.map(Nt=>Nt.name)),{type:"text/markdown"}),Ie=F.current.length+U.current.length,gt=U.current.reduce((Nt,In)=>Nt+In.size,0);if(Ie>=qo.maxCount||gt+Ce.size>qo.maxTotalBytes){W({ok:!1,message:"Длинная вставка не влезла в лимит вложений — вставлена в поле текстом."});return}K.preventDefault(),Qe([Ce])}function ct(K){const me=K.target.files?Array.from(K.target.files):[];K.target.value="",Qe(me)}const nt=K=>b&&!n&&Array.from(K.dataTransfer.types).includes("Files"),It=K=>!n&&sg(K.dataTransfer);function Se(K){if(It(K)){K.preventDefault(),Be.current+=1,ke(!0);return}nt(K)&&(K.preventDefault(),Be.current+=1,Le(!0))}function rt(K){if(It(K)){K.preventDefault(),K.dataTransfer.dropEffect="copy";return}nt(K)&&(K.preventDefault(),K.dataTransfer.dropEffect="copy")}function kn(K){!nt(K)&&!It(K)||(Be.current=Math.max(0,Be.current-1),Be.current===0&&(Le(!1),ke(!1)))}function Ut(K){if(It(K)){K.preventDefault(),Be.current=0,ke(!1);const me=C0(K.dataTransfer);me&&ds(me);return}nt(K)&&(K.preventDefault(),Be.current=0,Le(!1),Qe(Array.from(K.dataTransfer.files)))}x.useEffect(()=>{b||(ie([]),A([]))},[b]);const[ot,Fs]=x.useState([]),[Vn,Rn]=x.useState(-1),Mt=x.useRef(""),[$t,an]=x.useState(""),bt=SE(x.useCallback((K,me)=>{K&&$(Ce=>$p(Ce,K)),an(me.trim())},[])),Rt=$t?$p(D,$t):D;x.useEffect(()=>{bt.listening||$t===""||($(K=>$p(K,$t)),an(""))},[bt.listening,$t]),x.useEffect(()=>{var K;_&&((K=V.current)==null||K.focus())},[_]);const nn=x.useRef(new Map),Zt=x.useRef(new Map),St=x.useRef(p),Dt=x.useRef({text:D,caret:L});Dt.current={text:D,caret:L};const Xn=x.useCallback((K,me,Ce)=>{me===""?(nn.current.delete(K),Zt.current.delete(K)):(nn.current.set(K,me),Zt.current.set(K,Ce)),Ky(K,me)},[]),ge=bt.drop;x.useLayoutEffect(()=>{const K=St.current;if(K===p)return;St.current=p,K&&Xn(K,Dt.current.text,Dt.current.caret);const me=p?nn.current.get(p)??xp(p):"",Ce=p?Zt.current.get(p):void 0,Ie=Math.min(Ce??me.length,me.length);$(me),z(Ie),le.current=[Ie,Ie],K&&V_(K,{images:F.current,docs:U.current});const gt=p?_p(p):{images:[],docs:[]};F.current=[...gt.images],U.current=[...gt.docs],ie(F.current),A(U.current),an(""),I(0),Y(!1),Rn(-1),Mt.current="",ge()},[p,Xn,ge]),x.useEffect(()=>{p&&Xn(p,D,L)},[p,D,L,Xn]),x.useEffect(()=>{p&&(G!==F.current||de!==U.current||V_(p,{images:G,docs:de}))},[p,G,de]);const Ee=n?"Выберите сессию":j?"Нет VPN — отправка остановлена":m??"Опишите задачу… («/» — команды, «@» — файлы)",Ve=x.useRef(0),et=x.useCallback(K=>{const me=parseFloat(getComputedStyle(K).maxHeight),Ce=Number.isFinite(me)&&me>0?me:DE;K.style.height="auto";const Ie=K.scrollHeight;K.style.height=`${Math.min(Ie,Ce)}px`,K.style.overflowY=Ie>Ce?"auto":"hidden"},[]);x.useEffect(()=>{const K=V.current;K&&et(K)},[Rt,Ee,n,et]),x.useLayoutEffect(()=>{const K=V.current,me=le.current;!K||!me||(le.current=null,K.setSelectionRange(me[0],me[1]))}),x.useEffect(()=>{const K=V.current;if(!K)return;const me=new ResizeObserver(([Ce])=>{const Ie=Ce==null?void 0:Ce.contentRect.width;Ie===void 0||Math.abs(Ie-Ve.current)<1||(Ve.current=Ie,et(K))});return me.observe(K),()=>me.disconnect()},[et]);const Pe=bt.stop;x.useEffect(()=>{n&&Pe()},[n,Pe]);const Pt=x.useMemo(()=>bt.error?{ok:!1,message:bt.error}:null,[bt.error]),st=x.useMemo(()=>{var Ce;const K=(Ce=ry.exec(D))==null?void 0:Ce[1];if(K===void 0)return[];const me=K.toLowerCase();return i.filter(Ie=>!TE(Ie)&&Bp(Ie,me)<rv).sort((Ie,gt)=>Bp(Ie,me)-Bp(gt,me))},[D,i]),ut=!ne&&st.length>0,vs=Math.min(q,st.length-1),Dn=ne?null:((zn=cy.exec(Rt.slice(0,L)))==null?void 0:zn[1])??null,Ls=x.useRef(E);Ls.current=E,x.useEffect(()=>{if(Dn===null||Dn===""||Dn.endsWith("/")){Ls.current(Dn);return}const K=setTimeout(()=>Ls.current(Dn),ME);return()=>clearTimeout(K)},[Dn]);const us=Dn!==null&&(o==null?void 0:o.query)===Dn,wn=us?o.entries:[],Ln=Dn!==null,Os=Ln&&!us,sn=Math.min(q,Math.max(wn.length-1,0));x.useEffect(()=>{var me,Ce;if(!ut&&!Ln)return;const K=ut?vs:sn;(Ce=(me=pe.current)==null?void 0:me.children[K])==null||Ce.scrollIntoView({block:"nearest"})},[ut,Ln,vs,sn]);function rn(K,me){var Ce;$(K),z(me),le.current=[me,me],I(0),Y(!1),$t!==""&&(an(""),bt.drop()),(Ce=V.current)==null||Ce.focus()}const ts=(k==null?void 0:k.token)??null;x.useEffect(()=>{if(!k)return;const K=Dt.current.text,me=K.trim()?`${K.trimEnd()}
140
+
141
+ ${k.text}`:k.text;rn(me,me.length),C==null||C(k.token)},[ts]);function cn(){$(""),an(""),I(0),z(0),Y(!1),Rn(-1),Mt.current="",ie([]),A([]),bt.drop(),p&&Xn(p,"",0)}function On(K){const me=K.trim();if(me===""&&G.length===0&&de.length===0||n||j||J.current)return;const Ce=R(me,G.length>0?G.map(Ie=>({mediaType:Ie.mediaType,data:Ie.data})):void 0,de.length>0?de.map(({kind:Ie,name:gt,mediaType:ln,size:Nt,data:In})=>({kind:Ie,name:gt,mediaType:ln,size:Nt,data:In})):void 0);if(Ce instanceof Promise){J.current=!0,Ce.then(Ie=>{J.current=!1,Ie&&on(me)},()=>{J.current=!1});return}Ce!==!1&&on(me)}function on(K){K!==""&&Fs(me=>[K,...me.filter(Ce=>Ce!==K)].slice(0,RE)),cn()}function yt(K){if(K<-1||K>=ot.length)return;Vn===-1&&(Mt.current=D);const me=K===-1?Mt.current:ot[K]??"";Rn(K),rn(me,me.length)}function un(){var Ie;const K=((Ie=V.current)==null?void 0:Ie.selectionStart)??Rt.length,Ce=`${K>0&&!/\s$/.test(Rt.slice(0,K))?" ":""}@`;rn(Rt.slice(0,K)+Ce+Rt.slice(K),K+Ce.length)}function ds(K){const me=V.current,Ce=(me==null?void 0:me.selectionStart)??Rt.length,Ie=(me==null?void 0:me.selectionEnd)??Ce,gt=Rt.slice(0,Ce),Nt=`${gt!==""&&!/\s$/.test(gt)?" ":""}@${K.path}${K.kind==="dir"?"/":""} `;rn(gt+Nt+Rt.slice(Ie),Ce+Nt.length)}function fs(K){var gt;const me=(gt=cy.exec(Rt.slice(0,L)))==null?void 0:gt[1];if(me===void 0)return;const Ce=L-me.length-1,Ie=K.kind==="dir"?`@${K.path}/`:`@${K.path} `;rn(Rt.slice(0,Ce)+Ie+Rt.slice(L),Ce+Ie.length)}function Ks(){var me;if(j)return;const K=(me=ry.exec(Rt.trim()))==null?void 0:me[1];if(K&&O(K)){cn();return}On(Rt)}function yl(K,me){$(K),z(me),I(0),Y(!1),Rn(-1),$t!==""&&(an(""),bt.drop())}function vl(K){var Ie;const me=AE.has(K.name)?r:null,Ce=`/${K.name} `;$(Ce+(me??"")),z(Ce.length+((me==null?void 0:me.length)??0)),me&&(le.current=[Ce.length,Ce.length+me.length]),I(0),(Ie=V.current)==null||Ie.focus()}function vt(K){if(O(K.name)){$(""),I(0),Y(!1);return}K.argumentHint?vl(K):On(`/${K.name}`)}function zs(K){if(ut){if(K.key==="ArrowDown")return K.preventDefault(),I(me=>(Math.min(me,st.length-1)+1)%st.length);if(K.key==="ArrowUp"){K.preventDefault();const me=st.length-1;return I(Ce=>(Math.min(Ce,me)+me)%st.length)}if(K.key==="Enter"&&!K.shiftKey){K.preventDefault();const me=st[vs];me&&vt(me);return}if(K.key==="Tab"){K.preventDefault();const me=st[vs];me&&vl(me);return}if(K.key==="Escape"){K.preventDefault(),K.stopPropagation(),Y(!0);return}}if(Ln){if(K.key==="ArrowDown"&&wn.length>0)return K.preventDefault(),I(me=>(Math.min(me,wn.length-1)+1)%wn.length);if(K.key==="ArrowUp"&&wn.length>0){K.preventDefault();const me=wn.length-1;return I(Ce=>(Math.min(Ce,me)+me)%wn.length)}if(K.key==="Enter"&&!K.shiftKey||K.key==="Tab"){const me=wn[sn];if(me){K.preventDefault(),fs(me);return}if(K.key==="Tab")return}if(K.key==="Escape"){K.preventDefault(),K.stopPropagation(),Y(!0);return}}if((K.key==="ArrowUp"||K.key==="ArrowDown")&&!K.shiftKey){const me=K.currentTarget,Ce=me.selectionStart;if(me.selectionEnd===Ce){const gt=K.key==="ArrowUp"?Vn+1:Vn-1;gt>=-1&&gt<ot.length&&requestAnimationFrame(()=>{me.selectionStart===Ce&&me.selectionEnd===Ce&&yt(gt)})}}if(K.key==="Escape"&&te){K.preventDefault(),K.stopPropagation(),te();return}K.key==="Enter"&&!K.shiftKey&&!Q&&(K.preventDefault(),Ks())}return s.jsx("div",{className:(u?`composer ${u}`:"composer")+(fe||lt?" is-dragging":""),onDragEnter:Se,onDragOver:rt,onDragLeave:kn,onDrop:Ut,children:s.jsxs("div",{className:"composer__inner",children:[s.jsx(Yr,{result:Pt}),s.jsx(Yr,{result:ye}),fe&&s.jsx("div",{className:"composer__drop","aria-hidden":"true",children:"Отпустите, чтобы прикрепить"}),lt&&s.jsx("div",{className:"composer__drop","aria-hidden":"true",children:"Отпустите, чтобы упомянуть"}),Ln&&!ut&&s.jsxs("div",{className:"cmdmenu",role:"listbox",ref:pe,children:[wn.map((K,me)=>s.jsxs("button",{role:"option","aria-selected":me===sn,className:me===sn?"cmdmenu__row is-on":"cmdmenu__row",onMouseEnter:()=>I(me),onMouseDown:Ce=>{Ce.preventDefault(),fs(K)},children:[s.jsxs("span",{className:"cmdmenu__name",children:[K.name,K.kind==="dir"?"/":""]}),s.jsx("span",{className:"cmdmenu__desc",children:K.path}),K.ignored&&s.jsx("span",{className:"cmdmenu__tag",children:"git-ignore"})]},K.path)),wn.length===0&&s.jsx("div",{className:"cmdmenu__empty",children:Os?"ищем…":Dn?"Ничего не нашлось":"Наберите имя файла или каталога"})]}),ut&&s.jsx("div",{className:"cmdmenu",role:"listbox",ref:pe,children:st.map((K,me)=>s.jsxs("button",{role:"option","aria-selected":me===vs,className:me===vs?"cmdmenu__row is-on":"cmdmenu__row",onMouseEnter:()=>I(me),onMouseDown:Ce=>{Ce.preventDefault(),vt(K)},children:[s.jsxs("span",{className:"cmdmenu__name",children:["/",K.name]}),K.argumentHint&&s.jsx("span",{className:"cmdmenu__hint",children:K.argumentHint}),s.jsx("span",{className:"cmdmenu__desc",children:K.description})]},K.name))}),(G.length>0||de.length>0)&&s.jsxs("div",{className:"composer__attachments",children:[G.map(K=>s.jsxs("div",{className:"composer__thumb",children:[s.jsx("img",{src:K.previewUrl,alt:"Вложение"}),s.jsx("button",{type:"button",className:"composer__thumb-remove","aria-label":"Удалить вложение",onClick:()=>qn(K.id),children:s.jsx(ZE,{})})]},K.id)),de.map(K=>s.jsx(P0,{file:K,onRemove:()=>We(K.id)},K.id))]}),s.jsxs("div",{className:"composer__field",children:[s.jsx("button",{type:"button",className:"addbtn",title:"Добавить контекст — файл проекта («@»)","aria-label":"Добавить контекст",disabled:n,onClick:un,children:s.jsx(FE,{})}),b&&s.jsxs(s.Fragment,{children:[s.jsx("input",{ref:Ye,type:"file",multiple:!0,className:"composer__fileinput",tabIndex:-1,"aria-hidden":"true",onChange:ct}),s.jsx("button",{type:"button",className:"attachbtn",title:"Прикрепить файл или изображение","aria-label":"Прикрепить файл или изображение",disabled:n,onClick:()=>{var K;return(K=Ye.current)==null?void 0:K.click()},children:s.jsx(QE,{})})]}),s.jsx("textarea",{ref:V,value:Rt,disabled:n,placeholder:Ee,onChange:K=>yl(K.target.value,K.target.selectionStart),onSelect:K=>z(K.currentTarget.selectionStart),onKeyDown:zs,onPaste:_n}),bt.supported&&s.jsx("button",{type:"button",className:bt.listening?"micbtn is-on":"micbtn",title:bt.listening?"Остановить диктовку":"Продиктовать промпт","aria-label":bt.listening?"Остановить диктовку":"Продиктовать промпт","aria-pressed":bt.listening,disabled:n,onClick:bt.toggle,children:s.jsx(PE,{on:bt.listening})}),l&&w&&s.jsx("button",{type:"button",className:"btn",onClick:Ks,disabled:n||j||Rt.trim()===""&&G.length===0&&de.length===0,title:j?"Нет VPN — отправка остановлена":"Поставить в очередь (Enter)",children:"В очередь"}),l?s.jsx("button",{className:"btn",onClick:H,title:"Прервать (Esc)",children:"Стоп"}):s.jsxs("button",{className:"btn btn--primary sendbtn",onClick:Ks,disabled:n||j||Rt.trim()===""&&G.length===0&&de.length===0,"aria-label":g,title:j?"Нет VPN — отправка остановлена":g,children:[s.jsx("span",{className:"sendbtn__label",children:g}),s.jsx(KE,{})]})]})]})})}function $p(n,l){const i=l.trim();if(i==="")return n;const r=mg(i).slice(VE(n,i)).join(" ");return r===""?n:n===""||/\s$/.test(n)?n+r:`${n} ${r}`}function VE(n,l){const i=mg(n),r=mg(l);for(let o=Math.min(i.length,r.length);o>0;o--)if(i.slice(i.length-o).every((u,m)=>XE(u,r[m]??"")))return o;return 0}function mg(n){return n.split(/\s+/).filter(l=>l!=="")}function XE(n,l){const i=r=>r.toLowerCase().replace(/[.,!?;:…]+$/u,"");return i(n)===i(l)}function FE(){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 KE(){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 QE(){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 ZE(){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 PE({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 Bp(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 WE({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 N(){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(qg,{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(JE,{text:p}):s.jsx("textarea",{className:"plansheet__source",value:p,onChange:w=>g(w.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:N,children:"Одобрить план"})]})]})})}function JE({text:n}){const[l,i]=x.useState("");return x.useEffect(()=>{let r=!1;return Bd(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 eC({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 qg({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 tC({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(qg,{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(Bg,{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 nC({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,N]=x.useState(()=>uy(m));x.useEffect(()=>{g(m.map(()=>new Set)),b(m.map(()=>"")),N(uy(m))},[n.requestId]);const w=x.useMemo(()=>lC(m,p,_),[m,p,_]),k=w!==null;function C(Q,D){var $,ne;(ne=($=m[Q])==null?void 0:$.options[D])!=null&&ne.preview&&N(Y=>{const q=Y.slice();return q[Q]=D,q})}function E(Q,D,$){g(ne=>{const Y=ne.slice(),q=new Set(Y[Q]);return $?q.has(D)?q.delete(D):q.add(D):q.has(D)||(q.clear(),q.add(D)),Y[Q]=q,Y}),D!=="other"&&C(Q,D)}function O(Q,D){b($=>{const ne=$.slice();return ne[Q]=D,ne})}function R(){w&&o(n.requestId,w)}function H(Q){Q.key==="Enter"&&(Q.target.closest("button")||k&&(Q.preventDefault(),R()))}function te(Q){var Y;if(!["ArrowDown","ArrowUp","ArrowRight","ArrowLeft"].includes(Q.key))return;const D=Array.from(Q.currentTarget.querySelectorAll("button.qsheet__option")),$=D.indexOf(document.activeElement);if($===-1)return;Q.preventDefault();const ne=Q.key==="ArrowDown"||Q.key==="ArrowRight"?1:-1;(Y=D[($+ne+D.length)%D.length])==null||Y.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:H,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(qg,{onClick:r})]}),s.jsxs("div",{className:"qsheet__body",children:[n.reason&&s.jsx("p",{className:"qsheet__reason",children:n.reason}),m.map((Q,D)=>s.jsx(sC,{q:Q,qi:D,selected:p[D]??new Set,otherText:_[D]??"",previewIndex:j[D]??null,onToggle:E,onFocusOption:C,onOtherText:O,onOptionsKeyDown:te},D))]}),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:!k,onClick:R,children:"Ответить"})]})]})})}function sC({q:n,qi:l,selected:i,otherText:r,previewIndex:o,onToggle:u,onFocusOption:m,onOtherText:p,onOptionsKeyDown:g}){var w;const _=n.options.some(k=>k.preview),b=o!==null?(w=n.options[o])==null?void 0:w.preview:void 0,j=i.has("other"),N=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((k,C)=>{const E=i.has(C);return s.jsxs("button",{type:"button",role:N,"aria-checked":E,className:"qsheet__option"+(E?" is-selected":""),onClick:()=>u(l,C,n.multiSelect),onFocus:()=>m(l,C),onMouseEnter:()=>m(l,C),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:k.label}),s.jsx("span",{className:"qsheet__opt-desc",children:k.description})]})]},C)}),s.jsxs("div",{className:"qsheet__other",children:[s.jsxs("button",{type:"button",role:N,"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:k=>p(l,k.target.value),autoFocus:!0})]})]}),_&&s.jsx("pre",{className:"qsheet__preview",children:b??""})]})}function uy(n){return n.map(l=>{const i=l.options.findIndex(r=>r.preview);return i===-1?null:i})}function lC(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 aC(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),Og);return()=>clearTimeout(p)},[r]),x.useEffect(()=>i(!1),[n]);async function m(){await ii(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(iC,{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?Wo:$c})]})]})}function iC({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 rC=["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:N}){const[w,k]=x.useState(!1),[C,E]=x.useState(0),O=x.useRef(null),R=x.useRef(null),H=n.find(ne=>ne.value===l)??null,te=H&&H.supportsEffort?H.effortLevels.length>0?H.effortLevels:rC:[],Q=te.includes("xhigh");x.useEffect(()=>{if(!w)return;const ne=n.findIndex(Y=>Y.value===l);E(ne===-1?0:ne)},[w]),x.useEffect(()=>{if(!w)return;function ne(Y){var q;(q=O.current)!=null&&q.contains(Y.target)||k(!1)}return document.addEventListener("mousedown",ne),()=>document.removeEventListener("mousedown",ne)},[w]),x.useEffect(()=>{var ne,Y;w&&((Y=(ne=R.current)==null?void 0:ne.querySelector(".is-cursor"))==null||Y.scrollIntoView({block:"nearest"}))},[w,C]);function D(ne){k(!1),ne.value!==l&&g(ne.value)}function $(ne){if(ne.key==="Escape"){if(!w)return;ne.preventDefault(),ne.stopPropagation(),k(!1);return}if(ne.key==="ArrowDown"||ne.key==="ArrowUp"){if(ne.preventDefault(),!w)return k(!0);if(n.length===0)return;const Y=ne.key==="ArrowDown"?1:n.length-1;return E(q=>(q+Y)%n.length)}if(ne.key==="Enter"||ne.key===" "){if(ne.preventDefault(),!w)return k(!0);const Y=n[C];Y&&D(Y)}}return s.jsxs("div",{ref:O,className:"select"+(w?" select--open":"")+(p?` ${p}`:""),children:[s.jsxs("button",{type:"button",className:"select__trigger",title:"Модель, усилие и размышления","aria-label":"Модель, усилие и размышления","aria-haspopup":"menu","aria-expanded":w,onClick:()=>k(ne=>!ne),onKeyDown:$,children:[(H==null?void 0:H.displayName)??l?s.jsx("span",{className:"select__value",children:(H==null?void 0:H.displayName)??l}):s.jsx("span",{className:"select__value select__value--muted",children:"по умолчанию"}),r?s.jsx("span",{className:"select__suffix select__suffix--hot",children:"ultracode"}):te.length>0&&i&&s.jsx("span",{className:"select__suffix",children:i}),s.jsx(cC,{})]}),w&&s.jsxs("div",{ref:R,className:"select__menu modelmenu",role:"menu",children:[s.jsx("div",{className:"modelmenu__head",children:"Модель"}),n.map((ne,Y)=>s.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":ne.value===l,className:"select__option"+(Y===C?" is-cursor":"")+(ne.value===l?" is-on":""),onMouseEnter:()=>E(Y),onClick:()=>D(ne),children:[s.jsx("span",{className:"select__check","aria-hidden":"true",children:ne.value===l?"✓":""}),s.jsx("span",{className:"select__label",children:ne.displayName}),ne.description&&s.jsx("span",{className:"select__hint",children:ne.description})]},ne.value)),te.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:te.map(ne=>s.jsx("button",{type:"button",role:"menuitemradio","aria-checked":ne===i,className:ne===i?"modelmenu__level is-on":"modelmenu__level",onClick:()=>_(ne),children:ne},ne))})]}),Q&&s.jsx(Hp,{label:"Ultracode",desc:"xhigh и постоянная оркестрация подагентами",on:r,onToggle:()=>b(!r)})]}),s.jsx("div",{className:"modelmenu__sep",role:"separator"}),(H==null?void 0:H.supportsThinking)!==!1&&s.jsx(Hp,{label:"Размышления",desc:"расширенное обдумывание перед ответом",on:o,onToggle:()=>j(!o)}),m&&s.jsx(Hp,{label:"Менять модель по флагу",desc:"иначе помеченный ход встаёт на паузу",on:u,onToggle:()=>N(!u)})]})]})}function Hp({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 cC(){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 oC({candidates:n,searching:l,agentItems:i,agentBusy:r,error:o,roots:u,created:m,onSearch:p,onAskAgent:g,onInterrupt:_,onSubmit:b,onCreate:j,onClose:N}){const[w,k]=x.useState("open"),[C,E]=x.useState(""),[O,R]=x.useState(!1),[H,te]=x.useState(""),[Q,D]=x.useState(""),[$,ne]=x.useState({git:!0,claudeMd:!0,readme:!0}),Y=C.trim(),q=Y!=="",I=H.trim(),V=Q.trim(),pe=V!==""&&I!=="";x.useEffect(()=>{H===""&&u.length>0&&te(u[0])},[u]);const J=x.useRef(p);J.current=p,x.useEffect(()=>{if(w!=="open")return;const G=C.trim(),ie=setTimeout(()=>J.current(G),200);return()=>clearTimeout(ie)},[C,w]);function le(){q&&b(Y)}function L(){pe&&j(I,V,$)}function z(){q&&(R(!0),g(Y))}return m?s.jsxs(Mn,{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:m.path}),s.jsx("div",{className:"modal__error",children:s.jsx("ul",{className:"newproj__warnings",children:m.warnings.map(G=>s.jsx("li",{children:G},G))})}),s.jsx("p",{className:"modal__text modal__text--dim",children:"Проект открыт и работает — недостающее можно добавить руками, в дереве файлов или из терминала."})]}):s.jsxs(Mn,{title:"Новый проект",className:O&&w==="open"?"modal--wide":void 0,onClose:N,actions:s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn",onClick:N,children:"Отмена"}),w==="open"?s.jsxs(s.Fragment,{children:[r?s.jsx("button",{className:"btn",onClick:_,children:"Остановить"}):s.jsx("button",{className:"btn",disabled:!q,onClick:z,title:"Найти по описанию",children:"Попросить агента"}),s.jsx("button",{className:"btn btn--primary",disabled:!q,onClick:le,children:"Открыть"})]}):s.jsx("button",{className:"btn btn--primary",disabled:!pe,onClick:L,children:"Создать"})]}),children:[s.jsxs("div",{className:"tabs",children:[s.jsx(dy,{label:"Открыть",on:w==="open",onClick:()=>k("open")}),s.jsx(dy,{label:"Создать",on:w==="create",onClick:()=>k("create")})]}),w==="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:C,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"C:\\Projects\\my-app",onChange:G=>E(G.target.value),onKeyDown:G=>{G.key==="Enter"&&(G.preventDefault(),le())}}),o&&s.jsx("p",{className:"modal__error",children:o}),n.length>0&&s.jsx("ul",{className:"finds",children:n.map(G=>s.jsx("li",{children:s.jsxs("button",{className:"find",disabled:G.open,title:G.open?"Этот проект уже открыт":G.path,onClick:()=>E(G.path),onDoubleClick:()=>b(G.path),children:[s.jsx("span",{className:"find__name",children:G.name}),s.jsx("span",{className:"find__path",children:G.path}),s.jsx("span",{className:"find__note",children:fC(G)})]})},G.path))}),n.length===0&&q&&!l&&!O&&s.jsx("p",{className:"modal__text modal__text--dim",children:"Ничего похожего среди каталогов, где вы работали. Если помните не имя, а суть проекта — опишите его и нажмите «Попросить агента». Проекта ещё нет вовсе — рядом вкладка «Создать»."}),O&&s.jsx("div",{className:"finds__agent",children:s.jsx(Hg,{items:i,busy:r,waiting:!1,empty:"Агент ищет…"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"modal__text",children:"Пустой каталог для нового проекта. Дальше в нём работает агент — с первого промпта, без отдельной настройки."}),s.jsx("label",{className:"field",htmlFor:"workspace-parent",children:"Где создать"}),s.jsx("input",{id:"workspace-parent",className:"input input--mono",value:H,spellCheck:!1,autoComplete:"off",placeholder:"C:\\Projects",onChange:G=>te(G.target.value)}),u.length>0&&s.jsx("div",{className:"newproj__roots",children:u.map(G=>s.jsx("button",{type:"button",className:G===I?"newproj__root is-on":"newproj__root",title:G,onClick:()=>te(G),children:dC(G)},G))}),s.jsx("label",{className:"field newproj__field",htmlFor:"workspace-name",children:"Имя проекта"}),s.jsx("input",{id:"workspace-name",className:"input input--mono",value:Q,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"my-app",onChange:G=>D(G.target.value),onKeyDown:G=>{G.key==="Enter"&&(G.preventDefault(),L())}}),s.jsx("p",{className:"newproj__preview",children:pe?uC(I,V):"Каталог появится здесь"}),o&&s.jsx("p",{className:"modal__error",children:o}),s.jsxs("div",{className:"newproj__opts",children:[s.jsx(qp,{label:"git init",desc:"панель истории работает сразу",on:$.git,onToggle:()=>ne(G=>({...G,git:!G.git}))}),s.jsx(qp,{label:"CLAUDE.md",desc:"заготовка инструкций для агента",on:$.claudeMd,onToggle:()=>ne(G=>({...G,claudeMd:!G.claudeMd}))}),s.jsx(qp,{label:"README.md",desc:"по нему проект потом узнаёт поиск",on:$.readme,onToggle:()=>ne(G=>({...G,readme:!G.readme}))})]})]})]})}function dy({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 qp({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 uC(n,l){const i=n.includes("\\")?"\\":"/";return n.replace(/[\\/]+$/,"")+i+l}function dC(n){const l=n.includes("\\")?"\\":"/",i=n.split(/[\\/]/).filter(Boolean);return i.length<=2?n:`…${l}${i.slice(-2).join(l)}`}function fC(n){return n.open?"уже открыт":n.why?n.why:n.sessions===0?"рядом с вашими проектами":`${hC(n.sessions)}${mC(n.lastUsedAt)}`}function hC(n){const l=n%10,i=n%100;return i>=11&&i<=14?`${n} сессий`:l===1?`${n} сессия`:l>=2&&l<=4?`${n} сессии`:`${n} сессий`}function mC(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 Gg=7;function pC(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 N of g){let w=l.indexOf(N);w===-1&&(w=fy(l),l[w]=N),_.push({from:m,to:w})}const b=[];for(let N=0;N<u.length;N++)u[N]===o.hash&&(b.push({from:N,to:m}),N!==m&&(l[N]=null));const j=[];for(let N=0;N<u.length;N++){const w=u[N];!w||w===o.hash||N===m||l[N]===w&&j.push(N)}gC(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,Gg)}}function fy(n){const l=n.indexOf(null);return l!==-1?l:(n.push(null),n.length-1)}function gC(n){for(;n.length>0&&n[n.length-1]===null;)n.pop()}function xC({open:n,state:l,result:i,selected:r,busy:o,onRefresh:u,onShow:m,onCheckout:p,onPush:g,onPull:_,onPublish:b,onConnectRemote:j,onDismissResult:N,onClose:w,zoomed:k,onToggleZoom:C}){const E=pC((l==null?void 0:l.commits)??[]),O=[...l!=null&&l.detached?[{value:"",label:`отделён · ${l.head.slice(0,8)}`}]:[],...((l==null?void 0:l.branches)??[]).map(R=>({value:R.name,label:R.name,hint:R.hash.slice(0,8)}))];return s.jsxs("aside",{className:(n?"sidepane sidepane--git sidepane--open":"sidepane sidepane--git")+(k?" sidepane--zoomed":""),"aria-label":"История git",children:[s.jsxs("div",{className:"sidepane__head",onDoubleClick:R=>{C&&(R.target.closest("button")||C())},children:[s.jsx(NC,{}),s.jsx("span",{className:"sidepane__title",children:"История"}),s.jsx("button",{className:"sidepane__btn",title:"Обновить","aria-label":"Обновить историю",onClick:u,children:"↻"}),C&&s.jsx("button",{className:"sidepane__btn",title:k?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":k?"Свернуть панель истории":"Развернуть панель истории на весь экран","aria-pressed":k,onClick:C,children:s.jsx(ou,{active:k})}),s.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель истории",onClick:w,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(_l,{className:"gitbar__branch",title:"Ветка — выбрать значит переключиться",value:l.detached?"":l.branch,options:O,onChange:R=>{R&&p(R,`ветку ${R}`)}}),s.jsx(Xi,{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(EC,{}),o]}):l.hasRemote?s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button",className:"btn btn--sm",title:"Отправить текущую ветку в origin",onClick:g,children:[s.jsx(kC,{}),"Отправить",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(wC,{}),"Забрать",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(SC,{})})]})]}):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} ${MC(l.changed.length)}`:"Рабочее дерево чистое"}),s.jsx("span",{className:"gitrow__meta",children:l.changed.length>0?l.changed.slice(0,4).map(R=>AC(R.path)).join(", "):"незакоммиченных изменений нет"})]})}),E.rows.map(R=>s.jsx(bC,{row:R,columns:E.columns,head:R.commit.hash===l.head,local:l.hasRemote&&!R.commit.pushed,active:r===R.commit.hash,onOpen:()=>m(R.commit.hash)},R.commit.hash)),E.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(Yr,{result:i,onDismiss:N})]})}const kd=50,hy=13,_C=500;function bC({row:n,columns:l,head:i,local:r,active:o,onOpen:u}){const{commit:m}=n,p=m.refs.map(CC).filter(Boolean),[g,_]=x.useState(null),b=x.useRef(null);function j(C){const E=C.touches[0];if(!E)return;const O={timer:0,x:E.clientX,y:E.clientY,fired:!1};O.timer=window.setTimeout(()=>{O.fired=!0,_({x:O.x,y:O.y})},_C),b.current=O}function N(C){const E=b.current,O=C.touches[0];!E||!O||Math.hypot(O.clientX-E.x,O.clientY-E.y)>10&&(window.clearTimeout(E.timer),b.current=null)}function w(C){const E=b.current;E&&(window.clearTimeout(E.timer),E.fired&&C.preventDefault())}function k(){const C=[{id:"hash",label:"Копировать хеш",hint:m.shortHash,onSelect:()=>void ii(m.hash)},{id:"short",label:"Копировать короткий хеш",onSelect:()=>void ii(m.shortHash)},{id:"subject",label:"Копировать сообщение",onSelect:()=>void ii(m.subject)}],E=new Set;for(const O of m.refs){const R=O.startsWith("tag: "),H=TC(O);!H||E.has(H)||(E.add(H),C.push({id:`ref:${H}`,label:R?"Копировать тег":"Копировать ветку",hint:H,onSelect:()=>void ii(H)}))}return C}return s.jsxs(s.Fragment,{children:[s.jsxs("button",{className:"gitrow"+(o?" is-on":""),title:r?"Коммит ещё не отправлен на удалённый репозиторий":void 0,onClick:()=>{var C;if((C=b.current)!=null&&C.fired){b.current=null;return}u()},onContextMenu:C=>{C.preventDefault(),_({x:C.clientX,y:C.clientY})},onTouchStart:j,onTouchMove:N,onTouchEnd:w,onTouchCancel:w,children:[s.jsx(yC,{row:n,columns:l,head:i,local:r}),s.jsxs("span",{className:"gitrow__body",children:[s.jsxs("span",{className:"gitrow__subject",children:[p.map(C=>s.jsx("span",{className:"gitrow__ref",children:C},C)),m.subject]}),s.jsxs("span",{className:"gitrow__meta",children:[m.shortHash," · ",m.author," · ",RC(m.date),r&&s.jsx("span",{className:"gitrow__local",children:"· не отправлен"})]})]})]}),g&&s.jsx(Yi,{x:g.x,y:g.y,items:k(),onClose:()=>_(null)})]})}function yC({row:n,columns:l,head:i,local:r}){const o=l*hy+6,u=kd/2,m=_=>8+Math.min(_,Gg-1)*hy,p=r?"3.5 2.5":void 0,g=fh(n.col);return s.jsxs("svg",{className:"gitgraph",width:o,height:kd,viewBox:`0 0 ${o} ${kd}`,"aria-hidden":"true",children:[n.through.map(_=>s.jsx("line",{x1:m(_),y1:0,x2:m(_),y2:kd,style:{stroke:fh(_)}},`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:fh(_.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)} ${kd}`,fill:"none",style:{stroke:fh(_.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 fh(n){return`var(--lane-${n%Gg})`}function vC({detail:n,local:l,onCheckout:i,onClose:r}){const o=n.hash==="";return s.jsxs(Mn,{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(Xi,{text:n.subject,hint:"сообщение коммита"})]}),s.jsxs("p",{className:"commit__meta",children:[n.author,n.email&&` <${n.email}>`," · ",DC(n.date)]}),s.jsxs("div",{className:"commit__line commit__line--hash",children:[s.jsx("span",{className:"commit__hash",children:n.hash}),s.jsx(Xi,{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(jC,{file:u,defaultOpen:n.files.length<=3},u.path+u.oldPath))]})}function jC({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(Bg,{diff:Q0(n)})]})}function NC(){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 kC(){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 wC(){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 SC(){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 EC(){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 CC(n){return n.replace(/^HEAD -> /,"").replace(/^tag: /,"⌂ ").trim()}function TC(n){const l=n.replace(/^HEAD -> /,"").replace(/^tag: /,"").trim();return l==="HEAD"?"":l}function AC(n){const l=n.split("/");return l[l.length-1]??n}function MC(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 RC(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 DC(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 LC({status:n,owners:l,files:i,defaultName:r,hasCommits:o,busy:u,result:m,onRefreshStatus:p,onSaveToken:g,onPublish:_,onDismissResult:b,onClose:j}){var G;const[N,w]=x.useState(()=>py(r)),[k,C]=x.useState(""),[E,O]=x.useState(""),[R,H]=x.useState(!0),[te,Q]=x.useState("Первый коммит"),[D,$]=x.useState(null),[ne,Y]=x.useState("");x.useEffect(()=>{!k&&l.length>0&&C(l[0].login)},[k,l]),x.useEffect(()=>{i&&D===null&&$(new Set(i.files))},[i,D]);const q=(n==null?void 0:n.connected)===!0,I=l.map(ie=>({value:ie.login,label:ie.login,hint:ie.kind==="org"?"организация":void 0})),V=x.useMemo(()=>{if(!i)return[];const ie=ne.trim().toLowerCase();return ie?i.files.filter(de=>de.toLowerCase().includes(ie)):i.files},[i,ne]),pe=(D==null?void 0:D.size)??0,J=q&&N.trim()!==""&&k!==""&&u===""&&(o||pe>0);function le(ie){$(de=>{const A=new Set(de??[]);return A.has(ie)?A.delete(ie):A.add(ie),A})}function L(ie){$(de=>{const A=new Set(de??[]);for(const F of V)ie?A.add(F):A.delete(F);return A})}function z(){if(!J)return;const ie=(i==null?void 0:i.files)??[];_({owner:k,name:N.trim(),description:E.trim(),private:R,include:o?[]:ie.filter(de=>D==null?void 0:D.has(de)),ignore:o?[]:ie.filter(de=>!(D!=null&&D.has(de))),message:o?"":te.trim()||"Первый коммит"})}return s.jsxs(Mn,{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:!J,onClick:z,children:u||"Опубликовать"})]}),children:[s.jsx(OC,{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:N,spellCheck:!1,autoComplete:"off",onChange:ie=>w(py(ie.target.value))})]}),N.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(_l,{className:"settings__select",value:k,options:I,onChange:C,placeholder:"выберите владельца",ariaLabel:"Владелец репозитория"}):s.jsx("p",{className:"publish__static",children:((G=l[0])==null?void 0:G.login)??"—"})]}),s.jsxs("label",{className:"field publish__field",children:[s.jsx("span",{children:"Описание (необязательно)"}),s.jsx("input",{className:"input",value:E,placeholder:"о чём проект — одной строкой",onChange:ie=>O(ie.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:R,onClick:()=>H(!0)}),s.jsx(gy,{title:"Публичный",desc:"Виден всем в интернете — код, история коммитов, всё содержимое.",risky:!0,on:!R,onClick:()=>H(!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:[pe," из ",i.files.length," файлов"]}),s.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>L(!0),children:"Отметить все"}),s.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>L(!1),children:"Снять все"})]}),i.files.length>8&&s.jsx("input",{className:"input publish__filter",value:ne,placeholder:"Фильтр по пути…",spellCheck:!1,onChange:ie=>Y(ie.target.value)}),s.jsx("div",{className:"publish__filelist",children:V.length===0?s.jsx("p",{className:"modal__text publish__filesempty",children:"Ничего не найдено по фильтру."}):V.map(ie=>s.jsxs("button",{type:"button",role:"checkbox","aria-checked":(D==null?void 0:D.has(ie))===!0,className:"publish__file",onClick:()=>le(ie),children:[s.jsx("span",{className:"publish__box"+(D!=null&&D.has(ie)?" is-on":""),"aria-hidden":"true",children:(D==null?void 0:D.has(ie))&&"✓"}),s.jsx("span",{className:"publish__filepath",children:ie})]},ie))}),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:te,onChange:ie=>Q(ie.target.value)})]})]})]}),s.jsx(Yr,{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 OC({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(zC,{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 zC({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(UC,{}):s.jsx(IC,{})})]})}function IC(){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 UC(){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 $C({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(Mn,{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(Yr,{result:l,onDismiss:r})]})}function BC({open:n,items:l,busy:i,ready:r,sendBlocked:o,longPasteThreshold:u,commands:m,contextResult:p,draftKey:g,models:_,model:b,effort:j,ultracode:N,thinking:w,switchOnFlag:k,onContextSearch:C,onCommand:E,onModel:O,onEffort:R,onUltracode:H,onThinking:te,onSwitchOnFlag:Q,onAsk:D,onInterrupt:$,onReset:ne,onClose:Y,zoomed:q,onToggleZoom:I}){return s.jsxs("aside",{className:(n?"sidepane sidepane--ask sidepane--open":"sidepane sidepane--ask")+(q?" sidepane--zoomed":""),"aria-label":"Вопрос на полях",children:[s.jsxs("div",{className:"sidepane__head",onDoubleClick:V=>{I&&(V.target.closest("button")||I())},children:[s.jsx(HC,{}),s.jsx("span",{className:"sidepane__title",children:"Вопрос на полях"}),s.jsx("button",{className:"sidepane__btn",title:"Начать заново — следующий вопрос возьмёт свежий контекст","aria-label":"Начать боковой разговор заново",disabled:l.length===0,onClick:ne,children:"↻"}),I&&s.jsx("button",{className:"sidepane__btn",title:q?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":q?"Свернуть панель вопроса":"Развернуть панель вопроса на весь экран","aria-pressed":q,onClick:I,children:s.jsx(ou,{active:q})}),s.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель вопроса",onClick:Y,children:"✕"})]}),_.length>0&&s.jsxs("div",{className:"sidepane__tools",children:[s.jsx(uv,{className:"select--compact",models:_,value:b,effort:j,ultracode:N,thinking:w,switchOnFlag:k,onModel:O,onEffort:R,onUltracode:H,onThinking:te,onSwitchOnFlag:Q}),s.jsx("span",{className:"sidepane__note",title:"Боковой вопрос работает только на чтение",children:"только чтение"})]}),s.jsx(Hg,{items:l,busy:i,waiting:!1,empty:r?"Спросите о том, что происходит: вопрос уйдёт в сторону от основного разговора и не попадёт в его контекст. Отвечающий видит сессию и проект, но ничего не меняет.":"Откройте сессию — вопрос задаётся о ней."}),s.jsx(iv,{className:"composer--side",disabled:!r,busy:i,commands:m,sessionTitle:null,contextResult:p,draftKey:g?`side:${g}`:null,placeholder:"Спросить, не мешая работе…",sendLabel:"Спросить",autoFocus:n,sendBlocked:o,longPasteThreshold:u,onContextSearch:C,onCommand:E,onSend:D,onInterrupt:$,onEscape:i?$:Y})]})}function HC(){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 qC=75,GC=90;function Yg({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:XC(n,i),role:"group","aria-label":o,children:r.map(u=>s.jsx(YC,{label:u.label,window:u.window},u.key))})}function YC({label:n,window:l}){const i=Math.round(l.utilization),r=KC(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${VC(i)}`,style:{width:`${i}%`}})}),s.jsxs("span",{className:"usage__pct",children:[i,"%"]}),s.jsx("span",{className:"usage__reset",title:Vg(l.resetsAt)||void 0,children:r&&`↻ ${r}`})]})}function VC(n){return n>=GC?" usage__fill--over":n>=qC?" usage__fill--warn":""}function XC(n,l){if(l.length>0)return FC(l);const i=[n.plan?`Лимиты плана ${n.plan}`:"Лимиты плана"],r=(o,u)=>{if(!u)return;const m=Vg(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(`
142
+ `)}function dv(n){return n.some(l=>l.id.startsWith("codex:"))?"Лимиты Codex":"Квота Antigravity"}function FC(n){const l=[dv(n)];for(const i of n){const r=Vg(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(`
143
+ `)}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 KC(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 Vg(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:QC(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 QC(n){return n.toLocaleDateString(void 0,{weekday:"long",day:"numeric",month:"long",year:"numeric"})}function ZC({onClose:n,permission:l,model:i,account:r,usage:o,cwd:u,costLabel:m,onRefresh:p,refreshing:g,metersFetchedAt:_,onRename:b,onHandoff:j,onFreshSession:N,handoffWriting:w,handoffAccount:k,onMemory:C,onStop:E,onExportDownload:O,onExportSave:R}){const H=n0({onLongPress:()=>N==null?void 0:N(),onClick:()=>j==null?void 0:j(),disabled:w});return s.jsx(Mn,{title:"Настройки сессии",className:"modal--sheet",sheet:!0,onClose:n,children:s.jsxs("div",{className:"sessionmenu",children:[l&&s.jsx(Lr,{label:"Режим прав",children:l}),s.jsx(Lr,{label:"Модель",children:i}),r&&s.jsx(Lr,{label:"Аккаунт",children:r}),(o==null?void 0:o.available)&&(o.fiveHour||o.sevenDay||o.buckets&&o.buckets.length>0)&&s.jsx(Lr,{label:"Лимиты плана",children:s.jsx(Yg,{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(PC,{}),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(Lr,{label:"Время",children:s.jsx(mv,{})}),m&&s.jsx(Lr,{label:"Стоимость хода",children:s.jsx("span",{className:"badge badge--cost",children:m})}),u&&s.jsx(Lr,{label:"Каталог проекта",children:s.jsx(ov,{path:u})}),C&&s.jsx("button",{type:"button",className:"sessionmenu__rename",onClick:C,children:"Память и инструкции"}),O&&s.jsx(Lr,{label:"Экспорт",children:s.jsxs("div",{className:"sessionmenu__export",children:[s.jsx("button",{type:"button","aria-label":"Скачать разговор как Markdown",onClick:()=>{n(),O()},children:"Скачать .md"}),s.jsx("button",{type:"button",disabled:!R,"aria-label":"Сохранить разговор в проект",onClick:()=>{n(),R==null||R()},children:"В проект"})]})}),b&&s.jsx("button",{type:"button",className:"sessionmenu__rename",onClick:b,children:"Переименовать сессию"}),j&&s.jsxs("button",{type:"button",className:w?"sessionmenu__handoff is-busy":H.holding?"sessionmenu__handoff is-holding":"sessionmenu__handoff",style:{"--hold-ms":`${H.thresholdMs}ms`},"aria-busy":w,disabled:w,...H.handlers,children:[s.jsx("span",{className:"sessionmenu__handoff-hold","aria-hidden":"true"}),s.jsxs("span",{className:"sessionmenu__handoff-text",children:[w?"Пишется хэндофф…":"Хэндофф и новая сессия",!w&&s.jsx("span",{className:"sessionmenu__handoff-hint",children:"Зажмите — новая сессия без хэндоффа"})]})]}),j&&k,E&&s.jsx("button",{type:"button",className:"sessionmenu__stop",onClick:E,children:"Остановить сессию"})]})})}function Lr({label:n,children:l}){return s.jsxs("div",{className:"sessionmenu__row",children:[s.jsx("span",{className:"sessionmenu__label",children:n}),l]})}function PC(){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 WC={user:"Для всех проектов аккаунта",project:"Для всех, кто работает над проектом",local:"Только для вас, не для репозитория",memory:"Заметки, которые агент ведёт сам"};function JC(n){return new Date(n).toLocaleString("ru-RU",{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"})}function eT(n){return n<1024?`${n} Б`:`${(n/1024).toFixed(1).replace(".",",")} КБ`}function tT({workspaceId:n,workspaceName:l,accountId:i,stateAccountId:r,files:o,file:u,result:m,send:p,onClose:g}){const _=Ud("(max-width: 860px)"),[b,j]=x.useState(null),[N,w]=x.useState(!1),[k,C]=x.useState(""),[E,O]=x.useState(0),[R,H]=x.useState(!1),[te,Q]=x.useState(""),[D,$]=x.useState(null),[ne,Y]=x.useState(!1),[q,I]=x.useState(!1),V=x.useRef(!1),pe=x.useRef("");pe.current=k;const J=r??i,le=x.useRef(J);le.current=J,x.useEffect(()=>{p({type:"memory.list",workspaceId:n,accountId:i})},[n,i,p]);const L=(o==null?void 0:o.find(fe=>fe.id===b))??null;x.useEffect(()=>{if(!o||b||_)return;const fe=o.find(Le=>Le.exists)??o[0];fe&&z(fe,!1)},[o]),x.useEffect(()=>{o&&b&&!o.some(fe=>fe.id===b)&&(j(null),w(!1),I(!1))},[o,b]);function z(fe,Le=!0){j(fe.id),w(!1),Q(""),$(null),H(!1),Le&&I(!0),fe.exists&&p({type:"memory.read",workspaceId:n,id:fe.id,accountId:le.current})}function G(){L&&(C(L.exists&&(u==null?void 0:u.id)===L.id?u.content:""),O(L.exists&&(u==null?void 0:u.id)===L.id?u.mtime:L.mtime),Q(""),$(null),w(!0))}function ie(fe=E){L&&(H(!0),Q(""),p({type:"memory.write",workspaceId:n,id:L.id,content:pe.current,baseMtime:fe,accountId:le.current}))}x.useEffect(()=>{!u||u.id!==b||V.current&&(V.current=!1,O(u.mtime),$(null),ie(u.mtime))},[u]),x.useEffect(()=>{if(!(!m||m.id!==b)){if(H(!1),m.ok){$(null),Y(!1),N&&(w(!1),p({type:"memory.read",workspaceId:n,id:m.id,accountId:le.current}));return}if(m.conflict){$({mtime:m.mtime??null});return}Q(m.message??"Не удалось выполнить операцию"),Y(!1)}},[m]);function de(){L&&($(null),w(!1),p({type:"memory.read",workspaceId:n,id:L.id,accountId:le.current}))}function A(){if(L){if((D==null?void 0:D.mtime)!=null){O(D.mtime),$(null),ie(D.mtime);return}V.current=!0,p({type:"memory.read",workspaceId:n,id:L.id,accountId:le.current})}}const F=x.useMemo(()=>{const fe=o??[],Le=fe.filter(ke=>ke.scope!=="memory"),lt=fe.filter(ke=>ke.scope==="memory").sort((ke,Be)=>{const Ye=ke.label==="MEMORY.md"?0:1,Qe=Be.label==="MEMORY.md"?0:1;return Ye-Qe||ke.label.localeCompare(Be.label,"ru")});return{instructions:Le,memory:lt}},[o]),U=L&&(u==null?void 0:u.id)===L.id?u:null,ye=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:F.instructions,selectedId:b,onSelect:z}),s.jsx(xy,{title:"Автопамять проекта",files:F.memory,selectedId:b,onSelect:z,empty:"Агент пока ничего не записал в память этого проекта."})]})]}),W=s.jsxs("section",{className:"memory__detail",children:[!L&&s.jsx("p",{className:"memory__empty",children:"Выберите файл слева."}),L&&s.jsxs(s.Fragment,{children:[s.jsxs("header",{className:"memory__head",children:[_&&s.jsx("button",{type:"button",className:"memory__back",onClick:()=>I(!1),"aria-label":"К списку файлов",children:"‹"}),s.jsxs("div",{className:"memory__headtext",children:[s.jsx("h3",{className:"memory__name",children:L.label}),s.jsx("div",{className:"memory__path",title:L.path,children:L.path})]}),!N&&s.jsxs("div",{className:"memory__tools",children:[L.exists?s.jsx("button",{type:"button",className:"btn",onClick:G,disabled:!U,children:"Изменить"}):s.jsx("button",{type:"button",className:"btn btn--primary",onClick:G,children:"Создать"}),L.deletable&&L.exists&&s.jsx("button",{type:"button",className:"btn btn--danger-ghost",onClick:()=>Y(!0),children:"Удалить"})]})]}),D&&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:de,children:"Загрузить заново"}),s.jsx("button",{type:"button",className:"btn btn--warn",onClick:A,children:"Перезаписать"})]})]}),te&&s.jsx("p",{className:"modal__error",role:"alert",children:te}),N?s.jsxs(s.Fragment,{children:[s.jsx("textarea",{className:"input input--mono memory__editor",value:k,spellCheck:!1,autoFocus:!0,"aria-label":`Содержимое ${L.label}`,placeholder:L.exists?"":"Файл пока пуст. Напишите инструкции в Markdown.",onChange:fe=>C(fe.target.value),onKeyDown:fe=>{(fe.ctrlKey||fe.metaKey)&&fe.key==="s"&&(fe.preventDefault(),R||ie())}}),s.jsxs("div",{className:"memory__editactions",children:[s.jsx("button",{type:"button",className:"btn",disabled:R,onClick:()=>{w(!1),$(null),Q("")},children:"Отмена"}),s.jsx("button",{type:"button",className:"btn btn--primary",disabled:R,onClick:()=>ie(),children:R?"Сохраняю…":L.exists?"Сохранить":"Создать файл"})]})]}):L.exists?U?s.jsxs(s.Fragment,{children:[s.jsx(nT,{text:U.content}),s.jsxs("footer",{className:"memory__meta",children:[eT(L.size)," · изменён ",JC(L.mtime)]})]}):s.jsx("p",{className:"memory__empty",children:"Загрузка…"}):s.jsxs("div",{className:"memory__missing",children:[s.jsxs("p",{children:[WC[L.scope],"."]}),s.jsx("p",{children:"Файла пока нет. Создайте его, чтобы агент подхватил инструкции в следующей сессии."})]})]})]});return s.jsxs(Mn,{title:"Память и инструкции",className:"modal--memory",onClose:g,children:[s.jsxs("p",{className:"memory__lead",children:["Проект «",l,"». Агент читает эти файлы в начале каждой сессии."]}),s.jsxs("div",{className:"memory"+(_?q?" memory--detail":" memory--list":""),children:[(!_||!q)&&ye,(!_||q)&&W]}),ne&&L&&s.jsx(Mn,{title:"Удалить файл памяти?",onClose:()=>Y(!1),actions:s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"btn",onClick:()=>Y(!1),children:"Отмена"}),s.jsx("button",{type:"button",className:"btn btn--warn",onClick:()=>{p({type:"memory.delete",workspaceId:n,id:L.id,accountId:le.current}),Y(!1)},children:"Удалить"})]}),children:s.jsxs("p",{className:"modal__text",children:[L.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 nT({text:n}){const[l,i]=x.useState("");return x.useEffect(()=>{let r=!1;return Bd(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],Rc=15,sT={default:"По умолчанию (спрашивать)",acceptEdits:"Принимать правки",plan:"Только план",auto:"auto",bypassPermissions:"Без подтверждений"},lT=jg.map(n=>({value:n.value,label:sT[n.value]??n.value,hint:n.hint})),aT={day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"};function pg(n){return new Date(n).toLocaleString("ru-RU",aT).replace(" г.","")}function iT(n){if(n.kind==="once")return`Один раз ${pg(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 rT(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 cT(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 oT(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>=Rc)&&(l.minutes=`Не меньше ${Rc} минут`),n.kind==="once"&&!Number.isFinite(new Date(n.at).getTime())&&(l.at="Укажите дату и время"),l}function uT(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(Rc,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 dT({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),[N,w]=x.useState(!1);x.useEffect(()=>{N&&(w(!1),_(null))},[n]),x.useEffect(()=>{u&&w(!1)},[u]),x.useEffect(()=>{r({type:"schedule.list"})},[r]);const k=O=>{var R;return((R=l.find(H=>H.id===O))==null?void 0:R.name)??"проект закрыт"};if(g)return s.jsx(fT,{draft:g,workspaces:l,saving:N,error:u,onEdit:m,onBack:()=>{m(),_(null)},onSave:O=>{m(),w(!0),r({type:"schedule.save",task:uT(O)})},onClose:p});const C=O=>{m(),r(O)},E=()=>{var O;return _(_v(i??((O=l[0])==null?void 0:O.id)??""))};return s.jsxs(Mn,{title:"Запланированные задачи",className:"modal--tasks",onClose:p,actions:s.jsx("button",{type:"button",className:"btn btn--primary",onClick:E,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(O=>s.jsxs("li",{className:"stask"+(O.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:O.name}),s.jsx("button",{type:"button",role:"switch","aria-checked":O.enabled,"aria-label":O.enabled?`Выключить «${O.name}»`:`Включить «${O.name}»`,className:O.enabled?"switch is-on":"switch",onClick:()=>C({type:"schedule.save",task:cT(O,!O.enabled)}),children:s.jsx("span",{className:"switch__knob"})})]}),s.jsxs("div",{className:"stask__sub",children:[k(O.workspaceId)," · ",iT(O.schedule)]}),s.jsxs("dl",{className:"stask__facts",children:[s.jsxs("div",{children:[s.jsx("dt",{children:"Следующий запуск"}),s.jsx("dd",{children:O.enabled&&O.nextRunAt?pg(O.nextRunAt):"не запланирован"})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Последний"}),s.jsx("dd",{children:O.lastRunAt?pg(O.lastRunAt):"ещё не было"})]})]}),O.lastError&&s.jsxs("p",{className:"stask__error",role:"status",children:["Последний запуск не удался: ",O.lastError]})]}),s.jsxs("div",{className:"stask__actions",children:[s.jsx("button",{type:"button",className:"btn",onClick:()=>C({type:"schedule.run",id:O.id}),children:"Запустить сейчас"}),O.lastSessionId&&s.jsx("button",{type:"button",className:"btn",onClick:()=>o(O),children:"Открыть сессию"}),s.jsx("button",{type:"button",className:"btn btn--ghost",onClick:()=>_(rT(O)),children:"Изменить"}),s.jsx("button",{type:"button",className:"btn btn--danger-ghost",onClick:()=>j(O),children:"Удалить"})]})]},O.id))}),s.jsx("p",{className:"stasks__hint",children:"Задачи срабатывают только пока запущен ccv."})]}),b&&s.jsx(Mn,{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:()=>{C({type:"schedule.delete",id:b.id}),j(null)},children:"Удалить"})]}),children:s.jsxs("p",{className:"modal__text",children:["Задача «",b.name,"» больше не будет запускаться. Сессии прошлых запусков останутся."]})})]})}function fT({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),N=oT(g),w=R=>{r&&o(),_(H=>({...H,...R}))},k=R=>b?N[R]:void 0,C=l.map(R=>({value:R.id,label:R.name,hint:R.path}));function E(){i||(j(!0),Object.keys(N).length===0&&m(g))}function O(R){w({days:g.days.includes(R)?g.days.filter(H=>H!==R):[...g.days,R]})}return s.jsx(Mn,{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:E,disabled:i,children:i?"Сохраняем…":g.id?"Сохранить":"Создать задачу"})]}),children:s.jsxs("form",{className:"tform",onSubmit:R=>{R.preventDefault(),E()},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:R=>w({name:R.target.value}),"aria-invalid":!!k("name")}),k("name")&&s.jsx("p",{className:"tform__error",children:k("name")})]}),s.jsxs("div",{className:"tform__row",children:[s.jsx("span",{className:"field",children:"Проект"}),s.jsx(_l,{value:g.workspaceId,options:C,ariaLabel:"Проект",placeholder:"Выберите проект",onChange:R=>w({workspaceId:R})}),k("workspaceId")&&s.jsx("p",{className:"tform__error",children:k("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:R=>w({prompt:R.target.value}),"aria-invalid":!!k("prompt")}),k("prompt")&&s.jsx("p",{className:"tform__error",children:k("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(([R,H])=>s.jsx("button",{type:"button",role:"radio","aria-checked":g.kind===R,className:g.kind===R?"segmented__opt is-on":"segmented__opt",onClick:()=>w({kind:R}),children:H},R))}),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:R=>w({at:R.target.value})}),k("at")&&s.jsx("p",{className:"tform__error",children:k("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:R=>w({time:R.target.value})}),s.jsx("div",{className:"chips",role:"group","aria-label":"Дни недели",children:pv.map(R=>s.jsx("button",{type:"button",className:g.days.includes(R.day)?"chip-toggle is-on":"chip-toggle","aria-pressed":g.days.includes(R.day),title:R.full,onClick:()=>O(R.day),children:R.label},R.day))}),(k("days")||k("time"))&&s.jsx("p",{className:"tform__error",children:k("days")??k("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<=Rc,onClick:()=>w({minutes:Math.max(Rc,g.minutes-(g.minutes>60?30:15))}),children:"−"}),s.jsx("input",{type:"number",className:"input stepper__input","aria-label":"Интервал в минутах",min:Rc,value:Number.isFinite(g.minutes)?g.minutes:"",onChange:R=>w({minutes:R.target.value===""?NaN:Number(R.target.value)})}),s.jsx("span",{className:"stepper__unit",children:"мин"}),s.jsx("button",{type:"button",className:"stepper__btn","aria-label":"Больше",onClick:()=>w({minutes:(g.minutes||0)+(g.minutes>=60?30:15)}),children:"+"})]}),s.jsxs("p",{className:"tform__hint",children:["Не чаще, чем раз в ",Rc," минут."]}),k("minutes")&&s.jsx("p",{className:"tform__error",children:k("minutes")})]})]}),s.jsxs("div",{className:"tform__row",children:[s.jsx("span",{className:"field",children:"Права агента"}),s.jsx(_l,{value:g.permissionMode,options:lT,ariaLabel:"Режим прав",onChange:R=>w({permissionMode:R})}),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:R=>w({model:R.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:()=>w({enabled:!g.enabled}),children:s.jsx("span",{className:"switch__knob"})})]}),s.jsx("button",{type:"submit",hidden:!0})]})})}const gg=n=>`ccv.siteNotes.${n}`;function hT(n){try{const l=localStorage.getItem(gg(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 mT(n,l){try{!l.url&&l.notes.length===0?localStorage.removeItem(gg(n)):localStorage.setItem(gg(n),JSON.stringify(l))}catch{}}function hh(n){try{const l=new URL(n);return l.hash="",l.href}catch{return n}}function pT(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 xg(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=xg(n.text,60);return l?`${n.tag}, «${l}»`:n.tag}function gT(n){const l=n.filter(r=>r.comment.trim());return l.length===0?"":`Правки к сайту (выбраны элементы на странице):
144
+
145
+ `+l.map((r,o)=>{var p;const u=r.element,m=[`${o+1}. Страница: ${u.url}`];return m.push(` Элемент: \`${xg(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: \`${xg(u.html,200)}\``),m.push(` Правка: ${r.comment.trim().replace(/\n/g,`
146
+ `)}`),m.join(`
147
+ `)}).join(`
148
+
149
+ `)+`
150
+
151
+ Найди эти элементы в коде проекта и внеси правки. Если элемент не находится однозначно — скажи, какие варианты нашёл.`}const mh={width:15,height:15,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};function xT({workspaceId:n,workspaceName:l,remote:i,reply:r,send:o,hasSession:u,onInsertPrompt:m,onClose:p}){const g=x.useRef(hT(n)).current,[_,b]=x.useState(g.url),[j,N]=x.useState(g.url),[w,k]=x.useState(g.notes),[C,E]=x.useState({kind:"idle"}),[O,R]=x.useState(!1),[H,te]=x.useState(0),[Q,D]=x.useState(0),[$,ne]=x.useState(null),[Y,q]=x.useState(null),I=x.useRef(null),V=x.useRef(new Map),pe=x.useRef(!1),J=x.useRef([]),le=x.useRef(-1),L=x.useRef(null),z=x.useRef(O);z.current=O;const G=x.useRef(0),ie=x.useCallback(ke=>{const Be=pT(ke);!Be||i||(pe.current=!0,b(Be),E({kind:"loading",url:Be}),o({type:"site.open",url:Be}))},[i,o]);x.useEffect(()=>{!r||r.n===G.current||(G.current=r.n,pe.current&&(pe.current=!1,r.ok?(E({kind:"open",proxyUrl:r.proxyUrl}),N(r.url),b(r.url),te(ke=>ke+1)):E({kind:"failed",url:r.url,message:r.message})))},[r]),x.useEffect(()=>{mT(n,{url:j,notes:w})},[n,j,w]);const de=x.useCallback(ke=>{var Be,Ye;(Ye=(Be=I.current)==null?void 0:Be.contentWindow)==null||Ye.postMessage({source:"ccv-app",...ke},"*")},[]);x.useEffect(()=>{function ke(Be){var qn;const Ye=(qn=I.current)==null?void 0:qn.contentWindow;if(!Ye||Be.source!==Ye)return;const Qe=Be.data;if(!(!Qe||Qe.source!=="ccv-site"))if(Qe.type==="ready"||Qe.type==="location"){if(typeof Qe.url=="string"){const We=Qe.url;N(We),b(We),J.current[le.current]!==We&&(J.current=[...J.current.slice(0,le.current+1),We],le.current=J.current.length-1)}if(D(We=>We+1),Qe.type==="ready"&&(de({type:"mode",pick:z.current}),L.current)){const We=L.current;L.current=null,window.setTimeout(()=>de({type:"flash",selector:We}),250)}}else if(Qe.type==="picked"&&Qe.element){const We=Qe.element,_n={id:`${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`,element:We,comment:""};k(Ge=>[...Ge,_n]),ne(_n.id)}else Qe.type==="cancel"&&R(!1)}return window.addEventListener("message",ke),()=>window.removeEventListener("message",ke)},[de]),x.useEffect(()=>{de({type:"mode",pick:O})},[O,de]),x.useEffect(()=>{const ke=hh(j),Be=w.map((Ye,Qe)=>({n:Qe+1,selector:Ye.element.selector,url:Ye.element.url})).filter(Ye=>hh(Ye.url)===ke).map(({n:Ye,selector:Qe})=>({n:Ye,selector:Qe}));de({type:"marks",marks:Be})},[w,j,Q,de]),x.useEffect(()=>{var ke,Be;$&&((ke=V.current.get($))==null||ke.focus(),(Be=V.current.get($))==null||Be.scrollIntoView({block:"nearest"}),ne(null))},[$,w]),x.useEffect(()=>{function ke(Be){Be.key==="Escape"&&(Be.preventDefault(),Be.stopPropagation(),z.current?R(!1):p())}return document.addEventListener("keydown",ke,!0),()=>document.removeEventListener("keydown",ke,!0)},[p]),x.useEffect(()=>{!i&&g.url&&ie(g.url)},[]);function A(){if(le.current<=0)return;le.current-=1;const ke=J.current[le.current];ke&&ie(ke)}function F(){C.kind==="open"?te(ke=>ke+1):_&&ie(_)}function U(ke){C.kind==="open"&&(hh(ke.element.url)===hh(j)?de({type:"flash",selector:ke.element.selector}):(L.current=ke.element.selector,ie(ke.element.url)))}function ye(ke,Be){k(Ye=>Ye.map(Qe=>Qe.id===ke?{...Qe,comment:Be}:Qe))}function W(ke){V.current.delete(ke),k(Be=>Be.filter(Ye=>Ye.id!==ke))}const fe=gT(w);function Le(){fe&&(m(fe)?(q(null),p()):q(fe))}const lt=C.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:ke=>{ke.preventDefault(),ie(_)},children:[s.jsx("button",{type:"button",className:"iconbtn",title:"Назад","aria-label":"Назад",disabled:le.current<=0||C.kind!=="open",onClick:A,children:s.jsx("svg",{...mh,children:s.jsx("path",{d:"M10 3 5 8l5 5"})})}),s.jsx("button",{type:"button",className:"iconbtn",title:"Обновить","aria-label":"Обновить",disabled:C.kind==="idle",onClick:F,children:s.jsx("svg",{...mh,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:ke=>b(ke.target.value),placeholder:"localhost:5173 или адрес сайта","aria-label":"Адрес страницы",spellCheck:!1,autoCapitalize:"off",autoCorrect:"off"}),s.jsxs("button",{type:"button",className:"btn siteview__pick"+(O?" is-on":""),"aria-pressed":O,disabled:!lt,title:lt?"Клик по странице выбирает элемент; Esc выключает":"Сначала откройте страницу",onClick:()=>R(ke=>!ke),children:[s.jsx("svg",{...mh,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:[C.kind==="open"&&s.jsx("iframe",{ref:I,className:"siteview__frame",src:C.proxyUrl,title:`Сайт проекта ${l}`,allow:"clipboard-write"},H),C.kind==="idle"&&s.jsxs("div",{className:"workpanel__empty",children:[s.jsx("h3",{children:"Откройте страницу"}),s.jsxs("p",{children:["Введите адрес локального сервера (например, ",s.jsx("code",{children:"localhost:5173"}),") или любого сайта и нажмите Enter. Затем включите «Выбрать элемент», кликайте по нужным местам страницы и пишите к ним правки."]})]}),C.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:["Открываю ",C.url,"…"]})]}),C.kind==="failed"&&s.jsxs("div",{className:"workpanel__empty",role:"alert",children:[s.jsx("h3",{children:"Сайт не ответил"}),s.jsx("p",{children:C.url}),s.jsx("p",{className:"workpanel__error",children:C.message}),s.jsx("button",{className:"btn btn--sm",onClick:()=>ie(C.url),children:"Повторить"})]})]}),s.jsxs("aside",{className:"sitenotes","aria-label":"Правки",children:[s.jsx("div",{className:"sitenotes__list",children:w.length===0?s.jsx("p",{className:"sitenotes__hint",children:lt?"Включите «Выбрать элемент» и кликните по странице. Для каждого элемента появится карточка с полем для правки.":"Здесь появятся карточки выбранных элементов."}):w.map((ke,Be)=>{var Ye;return s.jsxs("article",{className:"sitenote",children:[s.jsxs("div",{className:"sitenote__head",children:[s.jsxs("button",{className:"sitenote__main",onClick:()=>U(ke),title:"Показать элемент на странице",children:[s.jsx("span",{className:"sitenote__n",children:Be+1}),s.jsxs("span",{className:"sitenote__desc",children:[s.jsx("span",{className:"sitenote__tag",children:bv(ke.element)}),s.jsx("span",{className:"sitenote__sel",children:ke.element.selector}),((Ye=ke.element.source)==null?void 0:Ye.file)&&s.jsxs("span",{className:"sitenote__src",children:[ke.element.source.file,ke.element.source.component?` · ${ke.element.source.component}`:""]})]})]}),s.jsx("button",{className:"iconbtn iconbtn--danger",title:"Удалить карточку","aria-label":`Удалить карточку ${Be+1}`,onClick:()=>W(ke.id),children:s.jsx("svg",{...mh,children:s.jsx("path",{d:"M3.5 4.5h9M6.5 4.5V3h3v1.5M5 4.5l.5 8h5l.5-8"})})})]}),s.jsx("textarea",{ref:Qe=>{Qe?V.current.set(ke.id,Qe):V.current.delete(ke.id)},className:"input input--area sitenote__comment",value:ke.comment,onChange:Qe=>ye(ke.id,Qe.target.value),placeholder:"Что здесь поменять","aria-label":`Правка к элементу ${Be+1}`,rows:2})]},ke.id)})}),Y&&s.jsxs("div",{className:"sitenotes__leftover",role:"status",children:[s.jsx("p",{children:u?"Промпт не удалось вставить в поле ввода.":"Откройте сессию, чтобы вставить промпт в поле ввода. Пока его можно скопировать."}),s.jsx(Xi,{text:Y,hint:"промпт с правками"})]}),s.jsxs("div",{className:"sitenotes__foot",children:[s.jsx("button",{className:"btn btn--primary",disabled:!fe,title:fe?"Положить правки в поле ввода сессии":"Напишите правку хотя бы в одной карточке",onClick:Le,children:"Собрать промпт"}),s.jsx("button",{className:"btn btn--ghost",disabled:w.length===0,onClick:()=>{k([]),q(null)},children:"Очистить"})]})]})]})]})}const _T=/\.(mp4|webm|mov|m4v|ogv)$/i,bT=/https?:\/\/[^\s"'<>)\]\\}]+/g;function yT(n){try{return _T.test(new URL(n).pathname)}catch{return!1}}function vT(n){const l=new Set,i=[],r=o=>{if(o)for(const u of o.matchAll(bT)){const m=u[0].replace(/[.,;:!?]+$/,"");!l.has(m)&&yT(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 jT(n){try{const l=new URL(n);return decodeURIComponent(l.pathname.split("/").filter(Boolean).pop()??"")||l.host}catch{return n}}const NT=64*1024*1024,kT={mp4:"video/mp4",m4v:"video/mp4",webm:"video/webm",mov:"video/quicktime",ogv:"video/ogg",mkv:"video/x-matroska"};function wT(n){var l;return kT[((l=n.split(".").pop())==null?void 0:l.toLowerCase())??""]??"video/mp4"}function ST(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 ET({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),[N,w]=x.useState(!0),[k,C]=x.useState(0),[E,O]=x.useState(null),R=i&&i.workspaceId===n?i:null,H=()=>{w(!0),p({type:"video.scan",workspaceId:n})};x.useEffect(()=>{H()},[n]),x.useEffect(()=>{R&&w(!1)},[R]);const te=x.useRef(_);te.current=_,x.useEffect(()=>{function J(le){le.key==="Escape"&&(le.preventDefault(),le.stopPropagation(),te.current())}return document.addEventListener("keydown",J,!0),()=>document.removeEventListener("keydown",J,!0)},[]);function Q(J){j(J),O(null),J.kind==="animation"&&(C(le=>le+1),p({type:"fs.preview",workspaceId:n,path:J.path}))}function D(J){p({type:"fs.preview",workspaceId:n,path:J}),C(le=>le+1)}const $=(R==null?void 0:R.videos)??[],ne=(R==null?void 0:R.animations)??[],Y=(R==null?void 0:R.remotion)??[],q=!!R&&o.length===0&&$.length===0&&ne.length===0&&Y.length===0,I=(J,le,L,z)=>s.jsx("li",{children:s.jsxs("button",{className:"vidrow"+(_y(b,J)?" is-on":""),"aria-pressed":_y(b,J),onClick:()=>Q(J),children:[s.jsx("span",{className:"vidrow__title",children:le}),L&&s.jsx("span",{className:"vidrow__meta",children:L})]})},z),V=J=>`${Ad(J.size)} · ${ST(J.mtime)}`;function pe(){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:()=>O(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:"Открыть по ссылке"})]}),E===b.url&&s.jsx("p",{className:"workpanel__error",role:"alert",children:"Не удалось проиграть видео. Ссылка могла устареть или сервер не разрешает встраивание."})]});if(b.kind==="file"){const le=$.find(G=>G.path===b.path),L=m[b.path],z=L&&"base64"in L?L:void 0;return s.jsxs("div",{className:"vidstage",children:[s.jsx("div",{className:"vidstage__media",children:s.jsx(O0,{path:b.path,mime:(z==null?void 0:z.mime)??wT(b.path),base64:z==null?void 0:z.base64,error:L&&"error"in L?L.error:void 0,tooLarge:((le==null?void 0:le.size)??0)>NT,size:(le==null?void 0:le.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 le=u[b.path];return s.jsxs("div",{className:"vidstage",children:[s.jsx("div",{className:"vidstage__media vidstage__media--page",children:le!=null&&le.error?s.jsx("p",{className:"workpanel__error",role:"alert",children:le.error}):(le==null?void 0:le.html)!==void 0?s.jsx(Xh,{doc:R0(b.path,le.html),title:b.path},k):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:()=>D(b.path),children:"Сначала"})]})]})}const J=Y.find(le=>le.root===b.root);return J?s.jsx(CT,{project:J,workspaceId:n,remote:l,state:r[J.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:N,onClick:H,children:N?"Ищу…":"Обновить"}),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:pe()}),s.jsxs("nav",{className:"vidlist","aria-label":"Найденное видео",children:[!R&&s.jsx("p",{className:"vidlist__hint",role:"status",children:"Ищу видео в проекте…"}),q&&s.jsxs("div",{className:"vidlist__empty",children:[s.jsx("h3",{children:"Видео пока нет"}),s.jsx("p",{children:"Раздел собирает видеофайлы проекта (mp4, webm, mov), проекты Remotion, HTML-страницы с анимацией и ссылки на видео из разговора. Когда агент что-нибудь сделает, нажмите «Обновить»."})]}),R&&!q&&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(J=>I({kind:"link",url:J},jT(J),new URL(J).host,J))})]}),s.jsxs("section",{className:"vidgroup",children:[s.jsx("h3",{className:"vidgroup__title",children:"Файлы проекта"}),$.length===0?s.jsx("p",{className:"vidgroup__none",children:"Видеофайлов нет."}):s.jsx("ul",{children:$.map(J=>I({kind:"file",path:J.path},J.path,V(J),J.path))})]}),s.jsxs("section",{className:"vidgroup",children:[s.jsx("h3",{className:"vidgroup__title",children:"Remotion"}),Y.length===0?s.jsx("p",{className:"vidgroup__none",children:"Проектов Remotion нет."}):s.jsx("ul",{children:Y.map(J=>{var z;const le=(z=r[J.root])==null?void 0:z.status,L=le==="ready"?"предпросмотр запущен":le==="starting"?"запускается…":J.root==="."?"корень проекта":J.root;return I({kind:"remotion",root:J.root},J.name,L,J.root)})})]}),s.jsxs("section",{className:"vidgroup",children:[s.jsx("h3",{className:"vidgroup__title",children:"HTML-анимации"}),ne.length===0?s.jsx("p",{className:"vidgroup__none",children:"Страниц с анимацией нет."}):s.jsx("ul",{children:ne.map(J=>I({kind:"animation",path:J.path},J.path,V(J),J.path))})]}),R.truncated&&s.jsx("p",{className:"vidlist__warn",role:"status",children:"Проект слишком большой: поиск остановился раньше, чем обошёл все файлы, и показано не всё."})]})]})]})]})}function CT({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(`
152
+ `)})]}),u==="stopped"&&!i&&s.jsx("div",{className:"workpanel__empty",children:s.jsx("p",{children:"Studio — это плеер композиции с перемоткой, пропсами и очередью рендера. Нажмите «Открыть предпросмотр»."})})]})}function TT({tab:n,servers:l,plugins:i,marketplaces:r,catalog:o,result:u,auth:m,duplicates:p,accounts:g,remote:_,actions:b,onTab:j,onClose:N}){const w=[{id:"mcp",label:"MCP-серверы",count:l.length},{id:"plugins",label:"Плагины",count:i.length},{id:"catalog",label:"Каталог",count:o.length}];return s.jsxs(Mn,{title:"Расширения",className:"modal--wide",onClose:N,children:[s.jsx("div",{className:"tabs",role:"tablist",children:w.map(k=>s.jsxs("button",{role:"tab","aria-selected":n===k.id,className:n===k.id?"tabs__tab is-on":"tabs__tab",onClick:()=>j(k.id),children:[k.label,s.jsx("span",{className:"tabs__count",children:k.count})]},k.id))}),n==="mcp"&&s.jsx(AT,{servers:l,auth:m,accounts:g,remote:_,actions:b,onPlugins:()=>j("plugins")}),n==="plugins"&&s.jsx(IT,{plugins:i,marketplaces:r,duplicates:p,actions:b}),n==="catalog"&&s.jsx(UT,{catalog:o,hasMarketplaces:r.length>0,actions:b,onMarketplaces:()=>j("plugins")}),s.jsx(Yr,{result:u})]})}function AT({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--${LT(g.status)}`,children:DT[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(MT,{auth:_,accounts:i,remote:r,actions:o,onPlugins:u})]},g.name)})}),m?s.jsx(OT,{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 MT({auth:n,accounts:l,remote:i,actions:r,onPlugins:o}){var w;const[u,m]=x.useState(""),p=l.find(k=>k.id===n.accountId)??null,g=l.length>1&&p?s.jsxs("div",{className:"extauth__account",children:[s.jsx(Sa,{account:p,size:"sm"}),s.jsxs("span",{children:["Вход для аккаунта ",s.jsxs("strong",{children:["«",p.name,"»"]})]})]}):null,_=n.otherAccounts.map(k=>l.find(C=>C.id===k)).find(k=>k!==void 0);function b(){const k=u.trim();k!==""&&(r.mcpAuthCallback(n.name,k),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:"Попробовать снова"}),((w=n.diagnostic)==null?void 0:w.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:k=>m(k.target.value),onKeyDown:k=>{k.key==="Enter"&&(k.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 — это нормально. Скопируйте адрес из его строки и вставьте сюда.":"Скопируйте адрес из строки браузера и вставьте сюда."})]}),N=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:"На этом компьютере окно обновится само, как только вы войдёте."})]}),N,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"}),RT[n.stage]]})]})}const RT={starting:"Запускаем вход…",waiting:"Ждём завершения входа…",exchanging:"Обмениваем код на токен…",finished:"Завершаем вход…"},DT={connected:"подключён",failed:"ошибка","needs-auth":"нужна авторизация",pending:"подключается",disabled:"выключен",unknown:"неизвестно"};function LT(n){return n==="connected"?"ok":n==="failed"?"bad":n==="needs-auth"?"warn":"mute"}function OT({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(""),N=o==="stdio",w=i.trim()!==""&&(N?m.trim()!=="":g.trim()!=="");function k(){if(w)if(N){const[C,...E]=zT(m);n(i.trim(),{transport:"stdio",command:C??"",args:E,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:C=>r(C.target.value)}),s.jsx("label",{className:"field",children:"Транспорт"}),s.jsx(_l,{title:"Транспорт",value:o,options:[{value:"stdio",label:"stdio",hint:"локальный процесс"},{value:"http",label:"http",hint:"удалённый сервер"},{value:"sse",label:"sse",hint:"удалённый, поток событий"}],onChange:C=>u(C)}),N?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:C=>p(C.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:C=>_(C.target.value)})]}),s.jsxs("label",{className:"field",htmlFor:"mcp-pairs",children:[N?"Переменные окружения":"Заголовки"," — по одной на строку, необязательно"]}),s.jsx("textarea",{id:"mcp-pairs",className:"input input--mono input--area",value:b,spellCheck:!1,placeholder:N?"API_KEY=xxx":"Authorization: Bearer xxx",onChange:C=>j(C.target.value)}),s.jsxs("div",{className:"extbar",children:[s.jsx("button",{className:"btn",onClick:l,children:"Отмена"}),s.jsx("button",{className:"btn btn--primary",disabled:!w,onClick:k,children:"Подключить"})]})]})}function by(n){const l={};for(const i of n.split(`
153
+ `)){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 zT(n){return(n.trim().match(/"[^"]*"|'[^']*'|\S+/g)??[]).map(l=>l.replace(/^["']|["']$/g,""))}function IT({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 wd=30;function UT({catalog:n,hasMarketplaces:l,actions:i,onMarketplaces:r}){const[o,u]=x.useState(""),[m,p]=x.useState(""),[g,_]=x.useState(wd),[b,j]=x.useState(""),N=x.useMemo(()=>[...new Set(n.map(C=>C.category).filter(Boolean))].sort(),[n]),w=x.useMemo(()=>{const k=o.trim().toLowerCase();return n.filter(C=>m&&C.category!==m?!1:k?`${C.name} ${C.displayName} ${C.description} ${C.author}`.toLowerCase().includes(k):!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:k=>{u(k.target.value),_(wd)}}),s.jsx(_l,{title:"Категория",value:m,options:[{value:"",label:"все категории"},...N.map(k=>({value:k,label:k}))],onChange:k=>{p(k),_(wd)}})]}),w.length===0?s.jsx("p",{className:"modal__text",children:"Ничего не нашлось."}):s.jsx("ul",{className:"extlist",children:w.slice(0,g).map(k=>s.jsxs("li",{className:"extlist__row",children:[s.jsxs("div",{className:"extlist__head",children:[s.jsx("span",{className:"extlist__name",children:k.name}),k.installed&&s.jsx("span",{className:"chip chip--ok",children:"установлен"}),k.version&&s.jsx("span",{className:"chip",children:k.version}),k.category&&s.jsx("span",{className:"chip",children:k.category})]}),k.description&&s.jsx("div",{className:"catalog__desc",children:k.description}),s.jsxs("div",{className:"extlist__meta",children:[k.author&&`${k.author} · `,k.marketplace]}),s.jsxs("div",{className:"extlist__actions",children:[s.jsx("button",{className:"btn btn--ghost btn--sm",disabled:k.installed,onClick:()=>i.pluginInstall(k.id),children:k.installed?"Уже стоит":"Установить"}),k.homepage&&s.jsx("a",{className:"btn btn--ghost btn--sm",href:k.homepage,target:"_blank",rel:"noreferrer",children:"Страница"})]})]},k.id))}),w.length>g&&s.jsx("div",{className:"extbar",children:s.jsxs("button",{className:"btn",onClick:()=>_(k=>k+wd),children:["Ещё ",Math.min(wd,w.length-g)," из ",w.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:k=>j(k.target.value),onKeyDown:k=>{k.key!=="Enter"||b.trim()===""||(k.preventDefault(),i.pluginInstall(b.trim()),j(""))}}),s.jsx("button",{className:"btn",disabled:b.trim()==="",onClick:()=>{i.pluginInstall(b.trim()),j("")},children:"Установить"})]})]})]})}function $T({accounts:n,auth:l,logins:i,candidates:r,usage:o,actions:u,activeAccountId:m,error:p,onReconnect:g,reconnectBlocked:_,reconnectHint:b,onOpenLogin:j,onClose:N}){const w=n.length>1,[k,C]=x.useState(!1),E=n.find(V=>V.main)??n[0],O=x.useRef(n.length);x.useEffect(()=>{n.length>O.current&&C(!1),O.current=n.length},[n.length]);const R=n.map(V=>`${V.id}:${V.dir}`).join("|"),H=x.useRef(u.discover);H.current=u.discover,x.useEffect(()=>{H.current()},[R]);const te=x.useRef(u.requestUsage);te.current=u.requestUsage;const[Q,D]=x.useState(!1);x.useEffect(()=>{te.current();const V=window.setInterval(()=>te.current(),9e4),pe=window.setTimeout(()=>D(!0),25e3);return()=>{window.clearInterval(V),window.clearTimeout(pe)}},[]);const[$,ne]=x.useState(null),Y=$!==null&&Object.values(o).some(V=>V!=null&&V.fetchedAt>=$),q=$!==null&&!Y;x.useEffect(()=>{if($===null)return;if(Y){ne(null);return}const V=window.setTimeout(()=>ne(null),25e3);return()=>window.clearTimeout(V)},[$,Y]);const I=(r??[]).filter(V=>V.accountId===null&&!n.some(pe=>pe.dir===V.configDir));return s.jsxs(Mn,{title:w?"Аккаунты":"Аккаунт",className:"modal--accounts",onClose:N,children:[s.jsxs("div",{className:"acctlimits",children:[s.jsx("span",{className:"acctlimits__title",children:"Лимиты плана"}),s.jsxs("button",{type:"button",className:q?"btn btn--ghost btn--sm acctlimits__btn is-busy":"btn btn--ghost btn--sm acctlimits__btn","aria-label":"Обновить лимиты","aria-busy":q,disabled:q,onClick:()=>{ne(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:q?"Обновляем…":"Обновить"})]})]}),n.map(V=>{var pe;return s.jsx(KT,{account:V,multi:w,status:l[V.id]??null,usage:o[V.id],usageSettled:Q,main:E,loginActive:((pe=i[V.id])==null?void 0:pe.active)===!0,actions:u,takenColors:n.filter(J=>J.id!==V.id).map(J=>J.color),onReconnect:V.id===m?g:null,reconnectBlocked:_,reconnectHint:b,onOpenLogin:()=>j(V.id)},V.id)}),p&&s.jsx("p",{className:"account__warn",role:"alert",children:p}),I.length>0&&E&&s.jsx(qT,{found:I,accounts:n,main:E,onConnect:(V,pe,J,le)=>u.add(pe,J,V.configDir,le),onMakeMain:V=>u.update(E.id,{configDir:V.configDir})}),k?s.jsx(PT,{accounts:n,onAdd:u.add,onCancel:()=>C(!1)}):s.jsx("button",{type:"button",className:"btn account__add",onClick:()=>C(!0),children:"+ Добавить аккаунт"})]})}function BT(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 HT(n){const l=n.split(/[\\/]+/).filter(Boolean);return(l[l.length-1]??"").replace(/^\.+/,"").slice(0,Kh)}function qT({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(GT,{candidate:u,accounts:l,main:i,onConnect:r,onMakeMain:o},u.configDir))})]})}function GT({candidate:n,accounts:l,main:i,onConnect:r,onMakeMain:o}){const[u,m]=x.useState(!1),[p,g]=x.useState(!1),[_,b]=x.useState(()=>HT(n.configDir)),[j,N]=x.useState(!0),w=_.trim(),k=l.some(H=>H.name.toLowerCase()===w.toLowerCase()),C=Gi.find(H=>!l.some(te=>te.color===H))??Gi[1],E=`found-${n.configDir.replace(/[^a-z0-9]/gi,"-")}`,O=i.liveSessions>0;function R(H){H.preventDefault(),w!==""&&r(n,w,C,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:BT(n.configDir)}),u?s.jsxs("form",{className:"found__form",onSubmit:R,children:[s.jsx("label",{className:"field",htmlFor:`${E}-name`,children:"Название аккаунта"}),s.jsx("input",{id:`${E}-name`,className:"input",value:_,maxLength:Kh,autoFocus:!0,autoComplete:"off","aria-describedby":k?`${E}-taken`:void 0,onChange:H=>b(H.target.value)}),k&&s.jsx("p",{className:"account__note",id:`${E}-taken`,children:"Такое имя уже есть — хост откажет. Выберите другое."}),s.jsxs("label",{className:"acctform__check",children:[s.jsx("input",{type:"checkbox",checked:j,onChange:H=>N(H.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:w==="",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":`${E}-more`,onClick:()=>g(H=>!H),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:`${E}-more`,children:[s.jsx("button",{type:"button",className:"btn btn--sm",disabled:O,onClick:()=>o(n),children:"Сделать основным"}),s.jsx("span",{className:"account__note found__why",children:O?`Сначала закройте сессии основного аккаунта (${i.liveSessions}).`:`Основной аккаунт «${i.name}» будет брать вход из этой папки.`})]})]})}const YT="Вход выполняется в Настройках → Вход и выход Claude Code.",VT=120*1e3;function XT(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 FT({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>VT;return s.jsxs("div",{className:"acctusage",children:[s.jsx(Yg,{usage:n,variant:"card"}),i&&s.jsxs("p",{className:"account__step acctusage__age",children:["Показания от ",XT(n.fetchedAt)]})]})}function KT({account:n,multi:l,status:i,usage:r,usageSettled:o,main:u,loginActive:m,actions:p,takenColors:g,onReconnect:_,reconnectBlocked:b,reconnectHint:j,onOpenLogin:N}){const[w,k]=x.useState(!1),C=n.id,E=_!==null&&(i==null?void 0:i.loggedIn)===!0,O=!l,R=!w&&s.jsx("button",{type:"button",className:"btn btn--ghost btn--sm",onClick:()=>k(!0),"aria-label":l?`Изменить аккаунт «${n.name}»`:"Изменить каталог аккаунта",children:l?"Изменить":"Изменить каталог"});return s.jsxs("section",{className:`acctcard acct--${n.color}${O?" acctcard--single":""}`,"aria-label":l?`Аккаунт «${n.name}»`:void 0,children:[l&&s.jsxs("header",{className:"acctcard__head",children:[s.jsx(Sa,{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:"основной"})]}),R]}),w?s.jsx(ZT,{account:n,multi:l,main:u,takenColors:g,onSave:H=>{p.update(C,H),k(!1)},onMakeMain:()=>{p.makeMain(C),k(!1)},onRemove:()=>p.remove(C),onCancel:()=>k(!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:QT[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(FT,{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?"Вход идёт — продолжите в Настройках.":YT}),s.jsx("button",{type:"button",className:"btn btn--sm",onClick:N,children:m?"Продолжить вход":"Открыть вход в Настройках"})]}),!w&&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:"унаследован из окружения"}),O&&s.jsx("div",{className:"acctdir__edit",children:R})]}),E&&!w&&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:`Переподключить сессию
154
+ ${j}`,"aria-label":"Переподключить сессию",disabled:b,onClick:_??void 0,children:[s.jsx(WT,{}),"Переподключить"]})})]})]})}const QT={"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=Gi.indexOf(n),p=Gi[(m+u+Gi.length)%Gi.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:Gi.map(o=>{const u=o===n;return s.jsx("button",{type:"button",role:"radio","aria-checked":u,"aria-label":bh[o],title:l.includes(o)?`${bh[o]} — уже у другого аккаунта`:bh[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 Kh=40;function ZT({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),[N,w]=x.useState(n.dir),[k,C]=x.useState(!1),[E,O]=x.useState(!1),R=g.trim(),H=N.trim(),te=H!==""&&H!==n.dir,Q=R!==n.name||b!==n.color||te,D=n.liveSessions,$=D>0,ne=`acct-edit-${n.id}`,Y=!n.main&&i!==void 0,q=D>0||((i==null?void 0:i.liveSessions)??0)>0,I=!n.main;function V(pe){pe.preventDefault(),!(l&&R===""||!Q)&&o({...R!==n.name?{name:R}:{},...b!==n.color?{color:b}:{},...te?{configDir:H}:{}})}return s.jsxs("div",{className:"acctform",children:[s.jsxs("form",{className:"extform acctform__fields",onSubmit:V,children:[l&&s.jsxs(s.Fragment,{children:[s.jsx("label",{className:"field",htmlFor:`${ne}-name`,children:"Имя"}),s.jsx("input",{id:`${ne}-name`,className:"input",value:g,maxLength:Kh,autoFocus:!0,autoComplete:"off",onChange:pe=>_(pe.target.value)}),s.jsx("span",{className:"field",children:"Цвет"}),s.jsx(yv,{value:b,taken:r,onChange:j})]}),s.jsx("label",{className:"field",htmlFor:`${ne}-dir`,children:"Каталог конфигурации"}),s.jsx("input",{id:`${ne}-dir`,className:"input input--mono",value:N,disabled:$,spellCheck:!1,autoComplete:"off",autoFocus:!l,placeholder:"~/.claude","aria-describedby":`${ne}-dirnote`,onChange:pe=>w(pe.target.value)}),s.jsx("p",{className:"account__step acctform__note",id:`${ne}-dirnote`,children:$?`Каталог нельзя менять, пока у аккаунта есть живые сессии (${D}) — сначала закройте их.`:"Здесь лежат вход, тариф и история аккаунта. Файлы не переносятся: аккаунт начнёт брать вход из новой папки."}),n.main&&n.configDir!==null&&s.jsx("button",{type:"button",className:"btn btn--sm acctform__inherit",disabled:$,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&&R===""||!Q,children:"Сохранить"})]})]}),Y&&s.jsxs("div",{className:"acctform__zone",children:[s.jsx("h4",{className:"acctform__zonetitle",children:"Основной аккаунт"}),s.jsx("p",{className:"account__note",children:`Аккаунты поменяются местами: «Основной» станет «${n.name}» и наоборот — каталог, имя и цвет. Файлы не переносятся.`}),q?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:D>0&&((i==null?void 0:i.liveSessions)??0)>0?`Сначала закройте сессии обоих аккаунтов: этого (${D}) и основного (${i==null?void 0:i.liveSessions}).`:D>0?`Сначала закройте сессии этого аккаунта (${D}).`:`Сначала закройте сессии основного аккаунта (${i==null?void 0:i.liveSessions}).`})]}):k?s.jsxs("div",{className:"extbar",children:[s.jsx("button",{type:"button",className:"btn btn--sm",onClick:()=>C(!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:()=>C(!0),children:"Сделать основным"})]}),I&&s.jsxs("div",{className:"acctform__zone",children:[s.jsx("h4",{className:"acctform__zonetitle",children:"Убрать аккаунт"}),D>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:`Сначала закройте сессии этого аккаунта (${D}).`})]}):E?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:()=>O(!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:()=>O(!0),children:"Убрать из списка"})]})]})}function PT({accounts:n,onAdd:l,onCancel:i}){const r=n.map(k=>k.color),[o,u]=x.useState(""),[m,p]=x.useState(()=>Gi.find(k=>!r.includes(k))??Gi[1]),[g,_]=x.useState(""),[b,j]=x.useState(!0),N=o.trim();function w(k){k.preventDefault(),N!==""&&l(N,m,g.trim()===""?null:g.trim(),b)}return s.jsxs("form",{className:"extform extform--card acctform",onSubmit:w,children:[s.jsx("label",{className:"field",htmlFor:"acct-new-name",children:"Название аккаунта"}),s.jsx("input",{id:"acct-new-name",className:"input",value:o,maxLength:Kh,placeholder:"Например, Работа",autoFocus:!0,autoComplete:"off",onChange:k=>u(k.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:k=>_(k.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:k=>j(k.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:N==="",children:"Добавить"})]})]})}function WT(){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 JT({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 w;j||(w=b.current)==null||w.focus()},[j]),x.useEffect(()=>{_(!1),j&&u("")},[j,n==null?void 0:n.error]);const N=(n==null?void 0:n.url)??"https://claudevisual.com";return s.jsx(Mn,{title:"Удалённый доступ",onClose:r,children:j?s.jsxs("div",{className:"relay",children:[s.jsxs("p",{className:"relay__lede",children:["Компьютер связан с аккаунтом на ",s.jsx("b",{children:yy(N)}),". Открывайте его оттуда с любого устройства — с телефона в том числе."]}),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(N)})," и войдите (или зарегистрируйтесь)."]}),s.jsxs("li",{children:["Нажмите ",s.jsx("b",{children:"«Подключить ПК»"})," — появится код из восьми знаков."]}),s.jsx("li",{children:"Введите его сюда."})]}),s.jsxs("form",{className:"relay__form",onSubmit:w=>{w.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:w=>u(w.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:w=>p(w.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 eA={active:!1,url:"",awaitingCode:!1,output:"",error:null},tA={"claude.ai":"подписка Claude",console:"Anthropic Console",apiKey:"API-ключ",none:"нет"};function nA({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(sA,{account:p,status:l[p.id]??null,login:i[p.id]??eA,actions:r,remote:o,running:u[p.id]??0,focused:p.id===m},p.id))})}function sA({account:n,status:l,login:i,actions:r,remote:o,running:u,focused:m}){const[p,g]=x.useState(""),[_,b]=x.useState(!1),[j,N]=x.useState(!1),w=x.useRef(null),k=n.id;x.useEffect(()=>{var H;m&&((H=w.current)==null||H.scrollIntoView({block:"nearest"}))},[m]);const C=x.useMemo(()=>{if(i.error)return{ok:!1,message:i.error};const H=i.output.trim();return H===""?null:{ok:!0,message:H}},[i.error,i.output]);function E(H=p){const te=H.trim();te!==""&&(r.submitCode(k,te),g(""))}function O(){if(u>0){b(!1),N(!0);return}r.login(k,"claudeai",!0)}const R=(l==null?void 0:l.loggedIn)===!0;return s.jsxs("section",{ref:w,className:`acctcard logincard acct--${n.color}${m?" is-focused":""}`,"aria-label":`Вход аккаунта «${n.name}»`,children:[s.jsxs("header",{className:"acctcard__head",children:[s.jsx(Sa,{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":R?"chip--ok":"chip--warn"}`,children:l===null?"проверяем":R?"вошёл":"не вошёл"})]}),R&&s.jsx("div",{className:"logincard__who",children:[l.email||"Вход выполнен",l.plan,tA[l.method]??l.method].filter(Boolean).join(" · ")}),i.active?s.jsx(aA,{login:i,remote:o,code:p,onCode:g,onSubmit:E,onCancel:()=>r.cancel(k),inputId:`auth-code-${k}`}):s.jsxs(s.Fragment,{children:[s.jsx(Yr,{result:C}),(j||_)&&u>0&&s.jsx("p",{className:"account__warn",role:"alert",children:lA(u)}),s.jsx("div",{className:"extbar logincard__bar",children:R?s.jsxs(s.Fragment,{children:[j?s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"btn",onClick:()=>N(!1),children:"Отмена"}),s.jsx("button",{type:"button",className:"btn btn--warn",autoFocus:!0,onClick:()=>{N(!1),r.login(k,"claudeai",!0)},children:"Всё равно сменить"})]}):s.jsx("button",{type:"button",className:"btn",onClick:O,children:"Сменить аккаунт"}),_?s.jsx("button",{type:"button",className:"btn btn--danger",autoFocus:!0,onClick:()=>{b(!1),r.logout(k)},children:"Точно выйти?"}):s.jsx("button",{type:"button",className:"btn",onClick:()=>{N(!1),b(!0)},children:"Выйти"})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"btn",onClick:()=>r.login(k,"console",!1),children:"Через Console"}),s.jsx("button",{type:"button",className:"btn btn--primary",onClick:()=>r.login(k,"claudeai",!1),children:"Войти"})]})})]})]})}function lA(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 aA({login:n,remote:l,code:i,onCode:r,onSubmit:o,onCancel:u,inputId:m}){var C;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 E=>{const{code:O,onCode:R,onSubmit:H}=b.current;if(E&&O.trim()!=="")return;const te=await lg();if(te===null){E||g("Не получилось прочитать буфер — вставьте код в поле руками.");return}const Q=te.trim();if(!vy(Q)){E||g("В буфере не похоже на код: нужен он целиком, вместе с частью после «#». Подойдёт и адрес страницы, на которую увёл браузер, — его тоже разберём.");return}if(E){if(_.current===Q)return;_.current=Q}g(null),R(Q),H(Q)},[]);x.useEffect(()=>{if(!n.awaitingCode)return;const E=()=>{document.visibilityState==="visible"&&j(!0)};return document.addEventListener("visibilitychange",E),()=>document.removeEventListener("visibilitychange",E)},[n.awaitingCode,j]);const N=typeof((C=navigator.clipboard)==null?void 0:C.readText)=="function",w=i.trim()!==""&&!vy(i),k=p??(w?"Похоже, скопирована только часть кода — нужен он целиком, вместе с частью после «#».":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(Xi,{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:E=>{g(null),r(E.target.value)},onKeyDown:E=>{E.key==="Enter"&&(E.preventDefault(),o())}}),N&&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:"Готово"})]}),k&&s.jsx("p",{className:"account__note account__note--code",children:k})]}),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 iA(){const n=uu(),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(_l,{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:Ip.min,max:Ip.max,step:Ip.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?$g():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"}],rA=[{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:"Сочетания клавиш."}],cA=[{label:"Вход и токены (.credentials.json)",why:"У каждого аккаунта свой."},{label:".claude.json",why:"В нём личность вошедшего и пользовательские MCP-серверы: общий файл смешал бы аккаунты."},{label:"История сессий и лимиты",why:"У каждого аккаунта своя."}],Gp="",oA=[{value:"opus",label:"Opus",hint:"полный список моделей виден, когда открыта сессия"},{value:"sonnet",label:"Sonnet",hint:"полный список моделей виден, когда открыта сессия"},{value:"haiku",label:"Haiku",hint:"полный список моделей виден, когда открыта сессия"}],uA=jg.map(n=>({value:n.value,label:n.value,hint:n.hint})),ph=3600*1e3,dA=[{value:"6h",label:"6 часов"},{value:"24h",label:"Сутки"},{value:"48h",label:"Двое суток"},{value:"168h",label:"Неделя"},{value:"never",label:"Никогда"}],Fo={"6h":6*ph,"24h":24*ph,"48h":48*ph,"168h":168*ph,never:0};function fA(n){return Fo[n]??Fo["48h"]}const hA=[{value:"5m",label:"5 минут"},{value:"10m",label:"10 минут"},{value:"30m",label:"30 минут"},{value:"60m",label:"Час"},{value:"never",label:"Никогда"}],gh=60*1e3,Ko={"5m":5*gh,"10m":10*gh,"30m":30*gh,"60m":60*gh,never:0};function mA(n){return Ko[n]??Ko["10m"]}function pA(n){const l=Object.entries(Ko).find(([,i])=>i===n);return l?l[0]:Object.keys(Ko).reduce((i,r)=>Math.abs(Ko[r]-n)<Math.abs(Ko[i]-n)?r:i)}function gA(n){const l=Object.entries(Fo).find(([,i])=>i===n);return l?l[0]:Object.keys(Fo).reduce((i,r)=>Math.abs(Fo[r]-n)<Math.abs(Fo[i]-n)?r:i)}const xA=[{value:"off",label:"Выключено"},{value:"500",label:"0.5 с"},{value:"1500",label:"1.5 с"},{value:"3000",label:"3 с"},{value:"10000",label:"10 с"}],Qo={off:0,500:500,1500:1500,3e3:3e3,1e4:1e4};function _A(n){return Qo[n]??Qo.off}function Ny(n){return Number.isFinite(n)?Math.min(100,Math.max(0,Math.round(n))):0}function bA(n){const l=Object.entries(Qo).find(([,i])=>i===n);return l?l[0]:Object.keys(Qo).reduce((i,r)=>Math.abs(Qo[r]-n)<Math.abs(Qo[i]-n)?r:i)}const yA=[{value:"project",title:"Только текущий проект",description:"Агент молча пишет файлы в открытом проекте и в ~/.claude — настройках самого Claude Code. Чужой проект и любая новая папка — только с явного разрешения."},{value:"projects",title:"Папка с проектами",description:"То же плюс каталог, где лежат открытые проекты, — то есть и соседний проект тоже. Всё остальное — с разрешения."},{value:"all",title:"Все папки на компьютере",description:"Агент пишет файлы куда угодно на диске — вопросов про место записи не будет.",risky:!0}];function vA({value:n,onCommit:l}){const[i,r]=x.useState(String(n));x.useEffect(()=>r(String(n)),[n]);const o=()=>{const u=Math.round(Number(i));if(i.trim()===""||!Number.isFinite(u)||u<0){r(String(n));return}const m=u===0?0:Math.max(200,u);r(String(m)),m!==n&&l(m)};return s.jsx("div",{className:"settings__pct",children:s.jsx("input",{type:"number",className:"input settings__pct-input settings__pct-input--wide",min:0,step:100,inputMode:"numeric",value:i,onChange:u=>r(u.target.value),onBlur:o,onKeyDown:u=>{u.key==="Enter"&&u.currentTarget.blur()},"aria-label":"Порог длинной вставки, символов"})})}function jA({settings:n,models:l,relayState:i,networkState:r,local:o,onChange:u,onEnableShell:m,onDisableShell:p,onOpenRelay:g,claudeLogin:_,onClose:b}){const j=x.useRef(null),N=n===null,w=_.focusAccountId!==null;x.useEffect(()=>{var q;w&&((q=j.current)==null||q.scrollIntoView({block:"start"}))},[w]);const[k,C]=x.useState(""),[E,O]=x.useState(null),R=!N&&n.networkGuardEnabled,H=(n==null?void 0:n.networkGuardBlockedCountries)??[];function te(){const q=k.trim().toUpperCase();if(q!==""){if(!/^[A-Z]{2}$/.test(q)){O("Нужен код из двух латинских букв, например RU или CN.");return}if(H.includes(q)){O(`Код ${q} уже в списке.`);return}O(null),C(""),u({networkGuardBlockedCountries:[...H,q]})}}const Q=!N&&n.terminalEnabled===!0,D=!N&&n.liveSessionsFirst===!0,$=!Q,ne=x.useMemo(()=>{const q=[{value:Gp,label:"Как в Claude Code",hint:"модель определят настройки самого Claude Code"},...l.length>0?l.map(I=>({value:I.value,label:I.displayName,hint:I.description})):oA];return n&&n.startModel!==null&&!q.some(I=>I.value===n.startModel)&&q.push({value:n.startModel,label:n.startModel}),q},[l,n]);function Y(){var q,I;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:$,onClick:g,children:"Связать компьютер"})]}):(q=i.shell)!=null&&q.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:$,onClick:p,children:"Запретить"})]}):(I=i.shell)!=null&&I.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:$,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:$,onClick:m,children:"Разрешить с телефона"})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"settings__hint",children:"Отсюда мгновенно не включится: на почту аккаунта уйдёт письмо, и терминал заработает только после перехода по ссылке из него."}),s.jsx("button",{type:"button",className:"btn",disabled:$,onClick:m,children:"Прислать письмо"})]})]})}return s.jsx(Mn,{title:"Настройки",onClose:b,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:"Сессия, к которой долго не возвращались, сама уезжает в архив — на диске ничего не удаляется, транскрипт остаётся, и её можно вернуть обратно в любой момент."}),N?s.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):s.jsx(_l,{className:"settings__select",value:gA(n.autoArchiveAfterMs),options:dA,onChange:q=>u({autoArchiveAfterMs:fA(q)}),ariaLabel:"Через сколько молчащая сессия уезжает в архив"})]}),s.jsxs("section",{className:"settings__section",children:[s.jsx("h3",{className:"settings__heading",children:"Останавливать простаивающие сессии через"}),s.jsx("p",{className:"settings__hint",children:"Простаивающая живая сессия сама отпускает процесс CLI — освобождает память компьютера, на котором стоит хост. Простой — это когда сессия ничего не делает (не работает, не ждёт разрешения, фоновых задач нет), в ней ничего не происходит и ни в одном открытом окне не висит недописанный черновик для неё. Разговор при этом никуда не девается: открытая заново сессия, как и отправленное в неё сообщение, продолжают с того же места."}),N?s.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):s.jsx(_l,{className:"settings__select",value:pA(n.autoStopAfterMs),options:hA,onChange:q=>u({autoStopAfterMs:mA(q)}),ariaLabel:"Останавливать простаивающие сессии через"})]}),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-часового лимита, %"}),N?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:q=>u({limitStopFiveHourPct:Ny(q.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:"Остановка у недельного лимита, %"}),N?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:q=>u({limitStopSevenDayPct:Ny(q.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-клиента это не заменяет — его тоже стоит включить."})]}),N?s.jsx("div",{className:"settings__switch-skeleton","aria-hidden":"true"}):s.jsx("button",{type:"button",role:"switch","aria-checked":R,"aria-label":"Kill switch: останавливать агентов, если упал VPN",className:R?"switch is-on":"switch",onClick:()=>u({networkGuardEnabled:!R}),children:s.jsx("span",{className:"switch__knob"})})]}),R&&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:R?"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:[H.map(q=>s.jsxs("li",{className:"countries__chip",children:[s.jsx("span",{children:q}),s.jsx("button",{type:"button",className:"countries__remove","aria-label":`Убрать ${q} из списка`,disabled:!R,onClick:()=>u({networkGuardBlockedCountries:H.filter(I=>I!==q)}),children:"×"})]},q)),H.length===0&&s.jsx("li",{className:"settings__hint",children:"Список пуст: блокировать будет только сбой проверки."})]}),s.jsxs("form",{className:"countries__add",onSubmit:q=>{q.preventDefault(),te()},children:[s.jsx("input",{type:"text",className:"input countries__input",value:k,maxLength:2,placeholder:"RU",autoCapitalize:"characters",spellCheck:!1,disabled:!R,"aria-label":"Код страны, две буквы","aria-invalid":E!==null,onChange:q=>{C(q.target.value.toUpperCase()),O(null)}}),s.jsx("button",{type:"submit",className:"btn",disabled:!R||k.trim()==="",children:"Добавить"})]}),E&&s.jsx("p",{className:"settings__hint countries__error",role:"alert",children:E})]})]}),s.jsxs("section",{className:"settings__section",children:[s.jsx("h3",{className:"settings__heading",children:"Автосохранение"}),s.jsx("p",{className:"settings__hint",children:"Открытый файл сам уезжает на диск, если немного постоять без ввода — ручное сохранение, кнопкой или Ctrl+S, при этом всегда работает как обычно, независимо от этой настройки."}),N?s.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):s.jsx(_l,{className:"settings__select",value:bA(n.autoSaveAfterPauseMs),options:xA,onChange:q=>u({autoSaveAfterPauseMs:_A(q)}),ariaLabel:"Пауза перед автосохранением открытого файла"})]}),s.jsxs("section",{className:"settings__section",children:[s.jsx("h3",{className:"settings__heading",children:"Длинная вставка"}),s.jsxs("div",{className:"settings__field",children:[s.jsx("span",{className:"settings__field-label",children:"Порог вставки, символов"}),N?s.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):s.jsx(vA,{value:n.longPasteThreshold,onCommit:q=>u({longPasteThreshold:q})}),s.jsx("p",{className:"settings__hint",children:"Вставка длиннее этого числа символов прикрепляется файлом .md. 0 — выключено."})]})]}),s.jsxs("section",{className:"settings__section",children:[s.jsx("h3",{className:"settings__heading",children:"Агенты"}),s.jsx("p",{className:"settings__hint",children:"Выключенный агент не предлагается при создании новой сессии. Уже открытые сессии с ним продолжают работать."}),jy.map(q=>{const I=(n==null?void 0:n.enabledProviders)??["claude","antigravity","codex"],V=!N&&I.includes(q.id),pe=V&&I.length<=1;return s.jsxs("div",{className:"settings__switch-row settings__agent",children:[s.jsx("span",{className:`newsession__mark newsession__mark--${q.id}`,"aria-hidden":"true",children:q.id==="antigravity"?s.jsx(zg,{className:"newsession__mark-logo"}):q.id==="codex"?s.jsx(Ig,{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:q.label}),s.jsx("span",{className:"settings__hint",children:pe?"Хотя бы один агент должен остаться включённым":q.hint})]}),N?s.jsx("div",{className:"settings__switch-skeleton","aria-hidden":"true"}):s.jsx("button",{type:"button",role:"switch","aria-checked":V,"aria-label":q.label,disabled:pe,title:pe?"Хотя бы один агент должен остаться включённым":void 0,className:V?"switch is-on":"switch",onClick:()=>{const J=jy.map(le=>le.id).filter(le=>le===q.id?!V:I.includes(le));u({enabledProviders:J})},children:s.jsx("span",{className:"switch__knob"})})]},q.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:"Выбор действует, когда аккаунт добавляется или подключается с включённым общим доступом. Уже существующие аккаунты не меняются, ссылки не удаляются."}),rA.map(q=>{const I=(n==null?void 0:n.sharedConfigItems)??G_,V=!N&&I.includes(q.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:q.label}),s.jsx("span",{className:"settings__hint",children:q.hint})]}),N?s.jsx("div",{className:"settings__switch-skeleton","aria-hidden":"true"}):s.jsx("button",{type:"button",role:"switch","aria-checked":V,"aria-label":q.label,className:V?"switch is-on":"switch",onClick:()=>u({sharedConfigItems:G_.filter(pe=>pe===q.id?!V:I.includes(pe))}),children:s.jsx("span",{className:"switch__knob"})})]},q.id)}),s.jsx("h4",{className:"settings__subheading",children:"Никогда не делится"}),s.jsx("ul",{className:"settings__never",children:cA.map(q=>s.jsxs("li",{children:[s.jsx("span",{className:"settings__never-name",children:q.label}),s.jsx("span",{className:"settings__hint",children:q.why})]},q.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:"Модель"}),N?s.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):s.jsx(_l,{className:"settings__select",value:n.startModel??Gp,options:ne,onChange:q=>u({startModel:q===Gp?null:q}),ariaLabel:"Модель, с которой поднимается новая сессия"})]}),s.jsxs("div",{className:"settings__field",children:[s.jsx("span",{className:"settings__field-label",children:"Режим прав при старте"}),N?s.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):s.jsx(_l,{className:"settings__select",value:n.startPermissionMode,options:uA,onChange:q=>u({startPermissionMode:q}),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:"Сессии, поднятые в хосте прямо сейчас — работают, готовы, ждут разрешения, работают в фоне, переподключаются, — показываются выше остальных в списке сессий проекта и в панели закреплённых. Порядок внутри каждой из двух частей остаётся тем, что задан руками."})]}),N?s.jsx("div",{className:"settings__switch-skeleton","aria-hidden":"true"}):s.jsx("button",{type:"button",role:"switch","aria-checked":D,"aria-label":"Запущенные сессии сверху",className:D?"switch is-on":"switch",onClick:()=>u({liveSessionsFirst:!D}),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:yA.map(q=>{const I=!N&&n.folderAccess===q.value;return s.jsxs("button",{type:"button",role:"radio","aria-checked":I,disabled:N,className:"access__card"+(I?" is-on":"")+(q.risky?" access__card--risky":""),onClick:()=>u({folderAccess:q.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:[q.title,q.risky&&s.jsx("span",{className:"access__risk",children:"самое широкое"})]}),s.jsx("span",{className:"access__desc",children:q.description})]})]},q.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-инструмент в разговоре. Выключите — и все открытые вкладки терминала закроются, а процессы в них не переживут закрытия."})]}),N?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({terminalEnabled:!Q}),children:s.jsx("span",{className:"switch__knob"})})]}),s.jsxs("div",{className:"settings__nested"+($?" is-disabled":""),children:[s.jsx("h4",{className:"settings__nested-heading",children:"Удалённый доступ к терминалу"}),N?s.jsx("p",{className:"settings__hint",children:"Загрузка…"}):s.jsxs(s.Fragment,{children:[$&&s.jsx("p",{className:"settings__hint",children:"Сначала включите терминал выше — удалённый доступ выдаётся к тому, что на этой машине уже разрешено, а не поверх выключенного рубильника."}),Y()]})]})]}),s.jsx(iA,{}),s.jsxs("details",{ref:j,className:"settings__section settings__advanced",open:w||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(nA,{..._})]})]})]})})}const Qh="Новая сессия начнётся с нуля: на другой аккаунт переходит только текст хэндоффа, прежний разговор под ним не открыть.";function vv({targets:n,selectedId:l,sourceId:i,onSelect:r,variant:o,className:u,disabled:m}){const{auth:p}=yg(),g=n.find(D=>D.id===l)??n[0],[_,b]=x.useState(!1),[j,N]=x.useState(0),[w,k]=x.useState({left:0,top:0}),C=x.useRef(null),E=x.useRef(null);function O(){N(Math.max(0,n.findIndex(D=>D.id===l))),b(!0)}function R(D){var $;b(!1),D&&(($=C.current)==null||$.focus())}function H(D){r(D.id),R(!0)}x.useLayoutEffect(()=>{if(!_)return;const D=C.current,$=E.current;if(!D||!$)return;const ne=D.getBoundingClientRect(),Y=$.getBoundingClientRect(),q=8,I=Math.max(q,Math.min(ne.right-Y.width,window.innerWidth-Y.width-q));let V=ne.bottom+6;V+Y.height>window.innerHeight-q&&(V=Math.max(q,ne.top-Y.height-6)),k({left:I,top:V}),$.focus()},[_]),x.useLayoutEffect(()=>{if(!_)return;function D($){var Y,q;const ne=$.target;!((Y=E.current)!=null&&Y.contains(ne))&&!((q=C.current)!=null&&q.contains(ne))&&R(!1)}return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[_]);function te(D){if(D.key==="Escape")D.preventDefault(),D.stopPropagation(),R(!0);else if(D.key==="ArrowDown"||D.key==="ArrowUp"){D.preventDefault();const $=D.key==="ArrowDown"?1:-1;N(ne=>(ne+$+n.length)%n.length)}else if(D.key==="Enter"||D.key===" "){D.preventDefault();const $=n[j];$&&H($)}else D.key==="Tab"&&R(!1)}if(!g)return null;const Q=`Аккаунт новой сессии: «${g.name}». Сменить`;return s.jsxs(s.Fragment,{children:[s.jsxs("button",{ref:C,type:"button",className:`${o==="split"?"splitbtn__caret":"pane-btn pane-btn--target"}${u?` ${u}`:""}`,title:Q,"aria-label":Q,"aria-haspopup":"menu","aria-expanded":_,disabled:m,onClick:()=>_?R(!1):O(),onKeyDown:D=>{(D.key==="ArrowDown"||D.key==="ArrowUp")&&(D.preventDefault(),O())},children:[o==="mark"&&s.jsx(Sa,{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:E,className:"newsession__menu targetmenu",style:{left:w.left,top:w.top},role:"menu","aria-label":"Аккаунт новой сессии",tabIndex:-1,onKeyDown:te,children:[s.jsx("p",{className:"targetmenu__note",children:Qh}),n.map((D,$)=>{const ne=By(p[D.id]);return s.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":D.id===l,className:"newsession__item"+($===j?" is-cursor":""),onMouseEnter:()=>N($),onClick:()=>H(D),children:[s.jsx("span",{className:"newsession__mark newsession__mark--account",children:s.jsx(Sa,{account:D,size:"md"})}),s.jsxs("span",{className:"newsession__text",children:[s.jsx("span",{className:"newsession__label",children:D.name}),ne&&s.jsx("span",{className:"newsession__hint",children:ne})]}),D.id===i&&s.jsx("span",{className:"newsession__tag",children:"прежняя"}),D.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"})})]},D.id)})]})]})}function NA({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(Sa,{account:r,size:"sm"}),s.jsx("span",{className:"targetchips__name",children:r.name})]},r.id))}),s.jsx("span",{className:"targetchips__note",children:Qh})]})}const ky={fiveHour:"5-часовой лимит",sevenDay:"недельный лимит"};function kA(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?Qh:`Новая сессия на том же аккаунте «${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 wA({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(Sa,{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(),". Окно сбросится: ",kA(n.resetsAt),"."]}),n.source==="journal"&&" Хэндофф собран автоматически из журнала."]})]}),u&&u.selectedId!==u.sourceId&&s.jsx("p",{className:"handoff__hint",children:Qh}),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 SA({handoff:n,onClose:l}){const[i,r]=x.useState("");return x.useEffect(()=>{let o=!1;return Bd(n.text).then(u=>{o||r(u)}),()=>{o=!0}},[n.text]),s.jsx(Mn,{title:"Хэндофф",className:"modal--wide",onClose:l,children:s.jsx("div",{className:"markdown-preview",dangerouslySetInnerHTML:{__html:i}})})}function EA({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 CA({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 Hh={fiveHour:"5-часовой лимит",sevenDay:"недельный лимит"},TA=12e3;function AA(n){const l=n%10,i=n%100;return l===1&&i!==11?"сессии":"сессиях"}function MA({notices:n,onDismiss:l}){return n.length===0?null:s.jsx("div",{className:"limittoasts",children:n.map(i=>s.jsx(RA,{notice:i,onDismiss:()=>l(i.id)},i.id))})}function RA({notice:n,onDismiss:l}){return x.useEffect(()=>{const i=window.setTimeout(l,TA);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:["Достигнут ",Hh[n.limit]," (",Math.round(n.utilization)," %): работа прервана в ",n.stopped," ",AA(n.stopped),", хэндоффов —"," ",n.handoffs,". Сессии остаются запущенными."]}):s.jsxs(s.Fragment,{children:["Достигнут ",Hh[n.limit]," (",Math.round(n.utilization)," %): занятых сессий не было — ничего не прервано."]})}),s.jsx("button",{type:"button",className:"limittoast__dismiss","aria-label":"Закрыть уведомление",onClick:l,children:"✕"})]})}function DA(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 LA(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 OA=16;function zA({pane:n,width:l,onResize:i,onReset:r}){const o=Uc[n],u=x.useRef(null);function m(b){if(b.button!==0)return;const j=document.querySelector(".main"),N=j?Math.max(0,j.getBoundingClientRect().width-u1):0;u.current={x:b.clientX,width:l,max:Math.min(o.max,l+N)},b.currentTarget.setPointerCapture(b.pointerId),document.body.classList.add("is-resizing"),b.preventDefault()}function p(b){const j=u.current;if(!j)return;const N=o.side==="left"?b.clientX-j.x:j.x-b.clientX;i(Math.min(j.max,j.width+N))}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*OA*(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 IA=16;function UA({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*IA,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=R=>l.getPropertyValue(R).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"),N=i("--warn"),w=i("--cm-fn"),k=i("--cm-key"),C=i("--cm-type"),E=Ey(o,r,55),O=R=>Ey(R,"#ffffff",25);return{background:r,foreground:o,cursor:p,cursorAccent:g,selectionBackground:_,black:E,brightBlack:m,red:b,brightRed:O(b),green:j,brightGreen:O(j),yellow:N,brightYellow:O(N),blue:w,brightBlue:O(w),magenta:k,brightMagenta:O(k),cyan:C,brightCyan:O(C),white:u,brightWhite:o}}function $A(){return getComputedStyle(document.documentElement).getPropertyValue("--mono").trim()}let Ja=null;function BA(n){return Ja||(Ja=document.createElement("span"),Ja.style.position="fixed",Ja.style.width="0",Ja.style.height="0",Ja.style.opacity="0",Ja.style.pointerEvents="none",document.body.appendChild(Ja)),Ja.style.color=n,getComputedStyle(Ja).color}function Ey(n,l,i){return BA(`color-mix(in srgb, ${n} ${100-i}%, ${l} ${i}%)`)}let xh=null;function HA(){return xh||(xh=Promise.all([Ze(()=>import("./xterm-D6Mng-DB.js").then(n=>n.x),__vite__mapDeps([28,26]),import.meta.url),Ze(()=>import("./addon-fit-CevVMrUA.js").then(n=>n.a),__vite__mapDeps([29,26]),import.meta.url),Ze(()=>import("./addon-web-links-CnB65OV_.js").then(n=>n.a),__vite__mapDeps([30,26]),import.meta.url),Ze(()=>Promise.resolve({}),__vite__mapDeps([31]),import.meta.url)]).then(([n,l,i])=>({Terminal:n.Terminal,FitAddon:l.FitAddon,WebLinksAddon:i.WebLinksAddon})).catch(n=>{throw xh=null,n})),xh}function qA({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:N,onInput:w,onResize:k,onAttach:C,onHide:E,registerSink:O}){const[R,H]=x.useState(()=>Sy());return x.useEffect(()=>{const te=new MutationObserver(()=>H(Sy()));return te.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>te.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:te=>{_&&(te.target.closest("button")||_())},children:[s.jsx("div",{className:"termpanel__tabs",role:"tablist","aria-label":"Открытые терминалы",children:n.map(te=>s.jsxs("div",{role:"tab","aria-selected":te.id===l,className:"termtab"+(te.id===l?" is-on":"")+(te.exitCode!==null?" termtab--exited":""),onDoubleClick:Q=>{_&&(Q.target.closest(".termtab__close")||_())},children:[s.jsx("button",{className:"termtab__name",title:te.cwd,onClick:()=>b(te.id),children:te.title}),te.exitCode!==null&&s.jsx("span",{className:"termtab__code",title:`Оболочка завершилась с кодом ${te.exitCode}`,children:te.exitCode}),s.jsx("button",{className:"termtab__close",title:"Закрыть терминал","aria-label":`Закрыть терминал «${te.title}»`,onClick:()=>N(te.id),children:"✕"})]},te.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(ou,{active:g})}),s.jsx("button",{className:"termpanel__hide",title:"Скрыть панель","aria-label":"Скрыть панель терминала",onClick:E,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(te=>s.jsx(YA,{id:te.id,exitCode:te.exitCode,active:te.id===l,theme:R,mobile:p,onInput:w,onResize:k,onAttach:C,registerSink:O},te.id))]})]})}function Cy({message:n,strip:l=!1,onRetry:i,onDismiss:r}){const{lede:o,hint:u,details:m}=GA(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 GA(n){const[l="",...i]=n.trim().split(`
155
+
156
+ `),r=l.split(`
157
+ `).map(o=>o.trim()).filter(o=>o!=="");return{lede:r[0]??n.trim(),hint:r.slice(1).join(" "),details:i.join(`
158
+
159
+ `).trim()}}function YA({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),N=x.useRef(o);N.current=o;const w=x.useRef(r),k=x.useRef(l),[C,E]=x.useState("loading"),[O,R]=x.useState(!1);return x.useEffect(()=>{if(!_.current)return;let te=!1,Q=null;E("loading"),R(!1);const D=window.setTimeout(()=>{te||R(!0)},200);return(async()=>{var de;let $;try{$=await HA()}catch{window.clearTimeout(D),te||E("error");return}if(te||!_.current)return;window.clearTimeout(D);const{Terminal:ne,FitAddon:Y,WebLinksAddon:q}=$,I=new ne({fontFamily:$A()||"monospace",fontSize:13,lineHeight:1.2,cursorBlink:!0,cursorStyle:"bar",scrollback:5e3,theme:w.current}),V=new Y;I.loadAddon(V),I.loadAddon(new q),I.open(_.current),b.current=I,I.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 U=I.getSelection();return U?(A.preventDefault(),ii(U),!1):!A.shiftKey}return A.key==="v"||A.key==="V"?(A.preventDefault(),lg().then(U=>{U&&I.paste(U)}),!1):!0});const pe=A=>{A.preventDefault();const F=I.getSelection();if(F){ii(F),I.clearSelection();return}lg().then(U=>{U&&I.paste(U)})};(de=I.element)==null||de.addEventListener("contextmenu",pe);const J=I.onData(A=>u(n,A));let le={cols:I.cols,rows:I.rows},L=null;const z=I.onResize(({cols:A,rows:F})=>{L!==null&&window.clearTimeout(L),L=window.setTimeout(()=>{L=null,!(A===le.cols&&F===le.rows)&&(le={cols:A,rows:F},m(n,A,F))},100)}),G=new ResizeObserver(()=>{try{V.fit()}catch{return}N.current&&I.scrollToBottom()});G.observe(_.current);const ie=g(n,A=>{A.kind==="buffer"&&I.reset(),I.write(A.data)});p(n),k.current!==null&&!j.current&&(j.current=!0,I.write(`\r
160
+ \x1B[2m— Процесс завершён (код ${k.current}) —\x1B[0m\r
161
+ `)),i&&I.focus(),Q=()=>{var A;L!==null&&window.clearTimeout(L),G.disconnect(),(A=I.element)==null||A.removeEventListener("contextmenu",pe),J.dispose(),z.dispose(),ie(),I.dispose(),b.current=null},E("ready")})(),()=>{te=!0,window.clearTimeout(D),Q==null||Q(),Q=null}},[n]),x.useEffect(()=>{if(!o)return;const H=_.current;if(!H)return;let te=null,Q=0,D=!1;const $=I=>{I.pointerType==="mouse"||te!==null||(te=I.pointerId,Q=I.clientY,D=!1)},ne=I=>{if(I.pointerId!==te)return;const V=Q-I.clientY;if(!D){if(Math.abs(V)<4)return;D=!0,H.setPointerCapture(I.pointerId)}Q=I.clientY;const pe=H.querySelector(".xterm-viewport");pe&&(pe.scrollTop+=V)},Y=I=>{I.pointerId===te&&(H.hasPointerCapture(I.pointerId)&&H.releasePointerCapture(I.pointerId),te=null,D=!1)},q=I=>I.stopPropagation();return H.addEventListener("pointerdown",$),H.addEventListener("pointermove",ne),H.addEventListener("pointerup",Y),H.addEventListener("pointercancel",Y),H.addEventListener("touchmove",q,{capture:!0}),()=>{H.removeEventListener("pointerdown",$),H.removeEventListener("pointermove",ne),H.removeEventListener("pointerup",Y),H.removeEventListener("pointercancel",Y),H.removeEventListener("touchmove",q,{capture:!0}),te!==null&&H.hasPointerCapture(te)&&H.releasePointerCapture(te)}},[o]),x.useEffect(()=>{w.current=r,b.current&&(b.current.options.theme=r)},[r]),x.useEffect(()=>{var H;i&&((H=b.current)==null||H.focus())},[i]),x.useEffect(()=>{if(k.current=l,l===null){j.current=!1;return}if(j.current)return;const H=b.current;H&&(j.current=!0,H.write(`\r
162
+ \x1B[2m— Процесс завершён (код ${l}) —\x1B[0m\r
163
+ `))},[l]),s.jsxs("div",{className:"termview"+(i?" is-active":""),children:[s.jsx("div",{ref:_,className:"termview__surface"+(C==="ready"?"":" is-hidden")}),C==="loading"&&O&&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:"Загружается терминал…"})]}),C==="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 VA=2e5,XA=75,FA=90;function KA({tokens:n,maxTokens:l,fetchedAt:i}){if(n===null)return null;const r=l??VA,o=Math.min(100,Math.round(n/r*100)),u=`${n.toLocaleString()} из ${r.toLocaleString()} токенов${i?`
164
+ обновлено в ${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${QA(o)}`,style:{width:`${o}%`}})}),s.jsxs("span",{className:"contextbar__pct",children:[o,"%"]})]})}function QA(n){return n>=FA?" contextbar__fill--over":n>=XA?" contextbar__fill--warn":""}const Hd={fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"};function ZA(){return s.jsx("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",...Hd,children:s.jsx("path",{d:"M10.5 3.5l2 2M3 13l.5-2.5 7-7 2 2-7 7L3 13z"})})}function PA(){return s.jsx("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",...Hd,children:s.jsx("path",{d:"M3 8h9M8.5 4L12.5 8l-4 4"})})}function WA(){return s.jsx("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",...Hd,children:s.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})}function JA(){return s.jsxs("svg",{viewBox:"0 0 16 16",width:"12",height:"12","aria-hidden":"true",...Hd,children:[s.jsx("rect",{x:"2",y:"3",width:"12",height:"10",rx:"1.5"}),s.jsx("path",{d:"M2.5 11.5l3-3 2.5 2.5 2-2 3.5 3"})]})}function eM(){return s.jsx("svg",{viewBox:"0 0 16 16",width:"12",height:"12","aria-hidden":"true",...Hd,children:s.jsx("path",{d:"M4 2h5l3 3v9H4V2zM9 2v3h3"})})}function tM({item:n,onUpdate:l,onSendNow:i,onRemove:r}){const[o,u]=x.useState(!1),[m,p]=x.useState(n.text),g=x.useRef(null);x.useEffect(()=>{if(!o)return;const w=g.current;w&&(w.focus(),w.setSelectionRange(w.value.length,w.value.length))},[o]);const _=()=>{p(n.text),u(!0)},b=()=>u(!1),j=()=>{const w=m.trim();w!==""&&w!==n.text&&l(w),u(!1)},N=n.files.length;return o?s.jsxs("li",{className:"pqueue__row is-editing",children:[s.jsx("textarea",{ref:g,className:"input pqueue__area",rows:2,value:m,"aria-label":"Текст промпта в очереди",onChange:w=>p(w.target.value),onKeyDown:w=>{w.key==="Escape"?(w.stopPropagation(),w.preventDefault(),b()):w.key==="Enter"&&!w.shiftKey&&!w.nativeEvent.isComposing&&(w.preventDefault(),j())}}),s.jsxs("div",{className:"pqueue__edit-actions",children:[s.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:b,children:"Отмена"}),s.jsx("button",{type:"button",className:"btn btn--sm btn--primary",onClick:j,children:"Сохранить"})]})]}):s.jsxs("li",{className:"pqueue__row",children:[s.jsxs("div",{className:"pqueue__main",children:[s.jsx("div",{className:"pqueue__text",title:n.text,children:n.text||"Только вложения"}),(n.imageCount>0||N>0)&&s.jsxs("div",{className:"pqueue__meta",children:[n.imageCount>0&&s.jsxs("span",{className:"pqueue__chip",title:`${n.imageCount} ${zd(n.imageCount,"картинка","картинки","картинок")}`,children:[s.jsx(JA,{}),n.imageCount]}),N>0&&s.jsxs("span",{className:"pqueue__chip",title:`${N} ${zd(N,"файл","файла","файлов")}`,children:[s.jsx(eM,{}),N]})]})]}),s.jsxs("div",{className:"pqueue__actions",children:[s.jsx("button",{type:"button",className:"iconbtn pqueue__btn",title:"Изменить","aria-label":"Изменить промпт в очереди",onClick:_,children:s.jsx(ZA,{})}),s.jsx("button",{type:"button",className:"iconbtn pqueue__btn",title:"Отправить сейчас","aria-label":"Отправить сейчас",onClick:i,children:s.jsx(PA,{})}),s.jsx("button",{type:"button",className:"iconbtn iconbtn--danger pqueue__btn",title:"Убрать из очереди","aria-label":"Убрать из очереди",onClick:r,children:s.jsx(WA,{})})]})]})}function nM({queue:n,onUpdate:l,onRemove:i,onSendNow:r,onResume:o}){const u=n.items.length;return s.jsxs("section",{className:n.paused?"pqueue is-paused":"pqueue","aria-label":"Очередь промптов",children:[s.jsxs("header",{className:"pqueue__head",children:[s.jsx("span",{className:"pqueue__dot","aria-hidden":"true"}),s.jsxs("span",{className:"pqueue__title",children:["В очереди: ",u]}),n.paused&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"pqueue__paused",children:"Очередь на паузе после «Стоп»"}),s.jsx("button",{type:"button",className:"btn btn--sm btn--primary",onClick:o,children:"Продолжить очередь"})]})]}),s.jsx("ul",{className:"pqueue__list",children:n.items.map(m=>s.jsx(tM,{item:m,onUpdate:p=>l(m.id,p),onSendNow:()=>r(m.id),onRemove:()=>i(m.id)},m.id))})]})}const jv="ccv:last-session",sM=300*1e3,lM=1e4;function aM(){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 iM(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 rM(n,l){return n.id===l.sessionId?!0:l.claudeSessionId?n.id===l.claudeSessionId||n.claudeSessionId===l.claudeSessionId:!1}const cM={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:$i,name:"Основной",color:"orange",configDir:null,dir:"",main:!0,liveSessions:0}],Nv="ccv.mcpAuthNoticeDismissed";function oM(){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 uM(){var Co,kc,Qu;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),N=x.useMemo(()=>vh()==="relay",[]),[w,k]=x.useState([]),[C,E]=x.useState([]),[O,R]=x.useState([]),[H,te]=x.useState([]),[Q,D]=x.useState([]),[$,ne]=x.useState([]),[Y,q]=x.useState({}),[I,V]=x.useState([]),[pe,J]=x.useState([]),[le,L]=x.useState({}),[z,G]=x.useState(null),[ie,de]=x.useState(null),[A,F]=x.useState(null),[U,ye]=x.useState(null),[W,fe]=x.useState(null),[Le,lt]=x.useState(null),[ke,Be]=x.useState(Ys),[Ye,Qe]=x.useState(bp),[qn,We]=x.useState(!1),[_n,Ge]=x.useState(!1),ct=Ud("(max-width: 860px)"),[nt,It]=x.useState(!1),[Se,rt]=x.useState(!1),[kn,Ut]=x.useState(null),[ot,Fs]=x.useState(null),[Vn,Rn]=x.useState(null),[Mt,$t]=x.useState(null),[an,bt]=x.useState(!1),[Rt,nn]=x.useState(!1),[Zt,St]=x.useState(null),Dt=x.useRef(0),[Xn,ge]=x.useState(null),Ee=x.useRef(0),[Ve,et]=x.useState(!1),[Pe,Pt]=x.useState(null),[st,ut]=x.useState({}),[vs,Dn]=x.useState(null),[Ls,us]=x.useState(null),[wn,Ln]=x.useState(null),[Os,sn]=x.useState(null),[rn,ts]=x.useState(null),cn=x.useRef(null);x.useEffect(()=>{ct||It(!1)},[ct]);const[On,on]=x.useState(!1),[yt,un]=x.useState([]),[ds,fs]=x.useState(!1),[Ks,yl]=x.useState(Ys),[vl,vt]=x.useState(null),[zs,zn]=x.useState(null),[K,me]=x.useState(null),[Ce,Ie]=x.useState({}),[gt,ln]=x.useState([]),[Nt,In]=x.useState(null),[Sn,kt]=x.useState(null),[Qs,dn]=x.useState([]),[jl,Nl]=x.useState([]),[Fn,Gt]=x.useState([]),[Ca,js]=x.useState([]),[Wl,Ns]=x.useState(null),[ns,sl]=x.useState(null),[Wt,Zs]=x.useState([]),[ri,Jl]=x.useState(oM),[hs,ea]=x.useState(null),[ta,Ps]=x.useState({}),[ms,ll]=x.useState(null),[Kn,na]=x.useState({}),[Il,Fi]=x.useState(null),[sa,dt]=x.useState({}),[la,bn]=x.useState([]),[Ul,ks]=x.useState(!1),[Un,ci]=x.useState(My),[al,Ws]=x.useState({}),[ss,ps]=x.useState(null),[je,y]=x.useState(null),[T,Z]=x.useState(null),[re,Me]=x.useState(()=>qj()??$i),[Ae,Xe]=x.useState(null),ft=(Ae==null?void 0:Ae.enabledProviders)??["claude","antigravity","codex"],[Qn,fn]=x.useState(!1),[En,Ta]=x.useState({}),[Bt,Ki]=x.useState(null),[Gn,Vr]=x.useState(null),[oi,qc]=x.useState(!1),[Zh,,Ph]=i1(),Qi=h1(),[aa,Xr]=x.useState(!1),[ws,qd]=x.useState(null),[du,Fr]=x.useState(null),[Wh,Gc]=x.useState(null),[fu,il]=x.useState(null),[Zi,Yc]=x.useState(null),[hu,Gd]=x.useState(""),[Yd,Jh]=x.useState(null),[em,tm]=x.useState([]),[nm,Vc]=x.useState(!1),[sm,mu]=x.useState(null),[lm,Xc]=x.useState(!1),[Ss,ia]=x.useState(!1),[ui,Pi]=x.useState({}),[Kr,Qr]=x.useState([""]),[Aa,Is]=x.useState([]),[di,am]=x.useState({}),[Vd,Wi]=x.useState({}),fi=x.useRef(new Map),Zr=x.useRef({}),Ma=h=>{Zr.current=h(Zr.current),am(Zr.current)},[Ra,Da]=x.useState(null),[Fc,kl]=x.useState(null),[Ji,er]=x.useState(null),[hi,Pr]=x.useState(null),[Xd,Kc]=x.useState(null),[Qc,Fd]=x.useState({}),[Zc,Kd]=x.useState({}),[mi,ls]=x.useState(!1),[Wr,Pc]=x.useState(null),[Jr,Wc]=x.useState(null),pu=x.useRef(0),tr=x.useRef(null),[nr,La]=x.useState(!1),[sr,ra]=x.useState([]),[gu,ec]=x.useState(null),[pi,ca]=x.useState(null),lr=p1(),Jc=b1(ct&&nr),wl=x.useRef(new Map),Oa=(Ae==null?void 0:Ae.terminalEnabled)===!0,tc=vh()==="relay"&&((Co=u==null?void 0:u.shell)==null?void 0:Co.enabled)!==!0,eo=x.useRef(!1),im=x.useCallback((h,M)=>(wl.current.set(h,M),()=>{wl.current.get(h)===M&&wl.current.delete(h)}),[]),[gi,to]=x.useState(!1),[xu,nc]=x.useState(null),[no,Us]=x.useState(Ys),[rl,Es]=x.useState(null),[$l,oa]=x.useState({}),za=x.useRef([]),[Jt,sc]=x.useState(null);function xi(h){sc(M=>M===h?null:h)}x.useEffect(()=>{(ct||Jt==="terminal"&&!nr||Jt==="files"&&!Ss||Jt==="search"&&!mi||Jt==="git"&&!aa||Jt==="ask"&&!gi||Jt==="main"&&Aa.length===0)&&sc(null)},[Jt,ct,nr,Ss,mi,aa,gi,Aa.length]);const[Qd]=x.useState(aM),ar=x.useRef(Qd),ua=x.useRef(!1),Zn=x.useRef(null),gs=x.useRef(new Map),_i=x.useRef(null),Js=x.useRef(null),Sl=x.useRef(null),lc=x.useRef(0),Et=x.useRef(null),so=x.useRef(0);Zn.current=W,Et.current=U,so.current=ke.lastSeq;const _u=x.useRef(Ye);_u.current=Ye;const El=x.useRef(null),bu=x.useRef(0);bu.current=no.lastSeq;const Cs=x.useRef(null),da=x.useRef(""),Bl=x.useRef(null),el=x.useRef([]),ir=x.useRef([""]);el.current=Aa,ir.current=Kr;const as=x.useRef(new Map),xs=x.useRef(new Set),cl=x.useRef(null),$s=x.useRef(null),Cl=x.useRef(0),Bs=x.useRef(new Set),yu=x.useRef(new Set);x.useEffect(()=>{const h=Zj();if(!h)return;n.current=h;const M=()=>{i(h.connected),o(h.statusText)};h.onStatus(M),h.onReconnect(()=>{M(),na({});const Re=Zn.current;Re&&h.send({type:"session.sync",sessionId:Re,sinceSeq:so.current});const at=El.current;at&&h.send({type:"session.sync",sessionId:at,sinceSeq:bu.current})});const ee=h.on(Re=>vu(Re));h.connect();const ve=window.setInterval(()=>{M(),h.connected&&h.send({type:"ping",nonce:Date.now()})},15e3);return()=>{ee(),window.clearInterval(ve),h.close()}},[]);const vu=x.useCallback(h=>{var M,ee,ve,Re,at,Ct,cs,xa,As,Rl,_a,ba,Vl,_s,ya,Zu;switch(h.type){case"hello.ok":i(!0);break;case"workspace.list":{k(Ty(h.workspaces)),E(Ty(h.archived)),ye(ze=>{var qt;if(ze)return ze;const Te=ar.current,Ue=Te&&iM(h.workspaces,Te.workspaceId);return Te&&Ue&&Ue.id!==Te.workspaceId&&(ar.current={...Te,workspaceId:Ue.id}),(Ue==null?void 0:Ue.id)??((qt=h.workspaces[0])==null?void 0:qt.id)??null});const _e=Bl.current;if(!_e)break;const we=h.workspaces.find(ze=>gM(ze.path,_e));if(!we)break;Bl.current=null,on(!1),we.id!==Et.current&&pr(),ye(we.id);break}case"workspace.candidates":if(h.query.trim()!==da.current)break;un(h.candidates),h.source==="host"&&fs(!1);break;case"finder.opened":Cs.current=h.sessionId;break;case"workspace.roots":ln(h.roots);break;case"workspace.created":if(h.workspace.id!==Et.current&&pr(),ye(h.workspace.id),h.warnings.length===0){on(!1),zn(null);break}In({path:h.workspace.path,warnings:h.warnings});break;case"session.list":if(q(_e=>({..._e,[h.workspaceId]:{sessions:h.sessions??[],archived:h.archived??[]}})),h.workspaceId!==Et.current)break;D(h.sessions),ne(h.archived);break;case"folder.list":R(h.sessionFolders),te(h.pinnedFolders??[]);break;case"session.pinned":V(h.sessions);break;case"session.live":J(h.sessions);break;case"session.filesRewound":{const _e=`${h.sessionId}:${h.userIndex}:${h.dryRun}`,we=gs.current.get(_e);gs.current.delete(_e),we==null||we(h);break}case"session.contentResults":sn({query:h.query,hits:h.hits});break;case"order.state":F(h.order);break;case"session.queue":L(_e=>{if(h.queue.items.length===0){if(!(h.sessionId in _e))return _e;const{[h.sessionId]:we,...ze}=_e;return ze}return{..._e,[h.sessionId]:h.queue}});break;case"session.summary":if(h.session.id===Cs.current){vt(h.session);break}if(h.session.parentSessionId){h.session.id===El.current&&Es(h.session);break}if(J(_e=>{const we=_e.findIndex(Te=>Te.id===h.session.id);if(h.session.state==="closed")return we===-1?_e:_e.filter(Te=>Te.id!==h.session.id);if(we===-1)return[..._e,h.session];const ze=_e.slice();return ze[we]=h.session,ze}),D(_e=>{const we=_e.findIndex(Te=>Te.id===h.session.id);if(we===-1)return h.session.workspaceId!==Et.current?_e:[h.session,..._e];const ze=_e.slice();return ze[we]=h.session,ze}),q(_e=>{const we=_e[h.session.workspaceId];if(!we)return _e;const ze=we.sessions.findIndex(Ue=>Ue.id===h.session.id);let Te;if(ze!==-1)Te=we.sessions.slice(),Te[ze]=h.session;else{if(we.archived.some(Ue=>Ue.id===h.session.id))return _e;Te=[h.session,...we.sessions]}return{..._e,[h.session.workspaceId]:{...we,sessions:Te}}}),V(_e=>{const we=_e.findIndex(Te=>Te.id===h.session.id);if(we===-1)return _e;const ze=_e.slice();return ze[we]={...h.session,pinned:!0,..._e[we].pinnedAt?{pinnedAt:_e[we].pinnedAt}:{}},ze}),Zn.current===null&&Js.current&&Js.current.workspaceId===h.session.workspaceId&&(Ky(h.session.id,Js.current.text),Js.current=null),Sl.current!==null&&Sl.current===h.session.workspaceId&&h.session.workspaceId===Et.current&&(Sl.current=null,fe(_e=>_e??h.session.id)),((M=_i.current)==null?void 0:M.sessionId)===h.session.id){const _e=_i.current;h.session.state==="error"?_i.current=null:h.session.state!=="closed"&&(_i.current=null,(ee=n.current)==null||ee.send({type:"prompt.send",sessionId:_e.sessionId,text:_e.text,images:_e.images,attachments:_e.attachments}))}break;case"usage.state":h.sessionId===Zn.current&&(Ki(h.usage),qc(!1));break;case"context.state":h.sessionId===Zn.current&&(Vr(h.context),qc(!1));break;case"session.capabilities":h.sessionId===Zn.current&&lt(h.capabilities);break;case"session.events":if(h.sessionId===El.current){Us(_e=>jh(_e,h.entries));break}if(h.sessionId===Cs.current){yl(_e=>jh(_e,h.entries));break}if(h.sessionId!==Zn.current)break;for(const _e of h.entries){if(_e.event.kind!=="rewound")continue;const we=_e.event.toUserIndex,ze=l1(_u.current.entries,we),Te=ze.reduce((Ue,qt)=>qt.event.kind==="user.message"?Ue+1:Ue,0);Qe(Ue=>({...Ue,entries:ze})),Be(Ue=>({...Ue,items:a1(Ue.items,we,Te)}))}Be(_e=>jh(_e,h.entries));break;case"session.history":if(h.sessionId!==Zn.current)break;Qe(_e=>t1(_e,h));break;case"side.opened":{if(h.parentSessionId!==Zn.current)break;El.current=h.sessionId,nc(h.sessionId);const _e=za.current;za.current=[];for(const we of _e)we(h.sessionId);break}case"side.closed":if(h.parentSessionId!==Zn.current)break;El.current=null,nc(null),Us(Ys),Es(null);break;case"git.state":if(h.workspaceId!==Et.current)break;qd(h.state);break;case"git.commit":if(h.workspaceId!==Et.current)break;Fr(h.detail);break;case"git.result":if(h.workspaceId!==Et.current)break;il({ok:h.ok,message:h.message,url:h.url}),h.ok&&(Fr(null),Gc(null),Vc(!1),Xc(!1));break;case"git.busy":if(h.workspaceId!==Et.current)break;Gd(h.label);break;case"git.files":if(h.workspaceId!==Et.current)break;mu({files:h.files,truncated:h.truncated});break;case"github.status":Jh(h.status);break;case"github.owners":tm(h.owners);break;case"fs.dir":if(h.workspaceId!==Et.current)break;Pi(_e=>({..._e,[h.path]:h.entries}));break;case"fs.search":if(h.workspaceId!==Et.current)break;if(h.scope!=="tree"){const _e=h.scope;Kd(we=>({...we,[_e]:{query:h.query,entries:h.entries}}));break}Kc({query:h.query,entries:h.entries,truncated:h.truncated});break;case"fs.grep":if(h.workspaceId!==Et.current)break;Pc({query:h.query,matches:h.matches,truncated:h.truncated});break;case"fs.file":{if(h.workspaceId!==Et.current)break;const _e=xs.current.delete(h.file.path);Is(ze=>{const Te=ze.findIndex(To=>To.path===h.file.path);if(Te===-1)return[...ze,Lb(h.file,++Cl.current)];const Ue=ze[Te],qt=ze.slice();return qt[Te]=Ue.saved===h.file.content&&!ni(Ue)?{...Ue,mtime:h.file.mtime,size:h.file.size,stale:!1}:{...Lb(h.file,++Cl.current),previewMode:Ue.previewMode,textMode:Ue.textMode},qt}),_e&&Da(h.file.path);const we=tr.current;we&&we.path===h.file.path&&(tr.current=null,Wc({...we,token:++pu.current}));break}case"fs.previewed":{if(h.workspaceId!==Et.current)break;Ma(_e=>{const we=_e[h.path];return{..._e,[h.path]:{forMtime:(we==null?void 0:we.forMtime)??h.mtime,loading:!1,html:h.html,missing:h.missing}}});break}case"fs.previewFailed":{if(h.workspaceId!==Et.current)break;Ma(_e=>{var we,ze;return{..._e,[h.path]:{forMtime:((we=_e[h.path])==null?void 0:we.forMtime)??0,loading:!1,html:(ze=_e[h.path])==null?void 0:ze.html,missing:[],error:h.message}}});break}case"fs.media":{if(h.workspaceId!==Et.current)break;Bs.current.delete(h.path),Wi(_e=>({..._e,[h.path]:{mime:h.mime,base64:h.base64}})),Is(_e=>_e.map(we=>we.path===h.path?{...we,mediaBase64:h.base64,mediaError:void 0}:we));break}case"fs.mediaFailed":{if(h.workspaceId!==Et.current)break;Bs.current.delete(h.path),Wi(_e=>({..._e,[h.path]:{error:h.message}})),Is(_e=>_e.map(we=>we.path===h.path?{...we,mediaError:h.message}:we));break}case"fs.saved":{if(h.workspaceId!==Et.current)break;if(((ve=cn.current)==null?void 0:ve.path)===h.path){const Ue=cn.current.path;cn.current=null,kl({ok:!0,message:`Разговор сохранён: ${Ue}`}),xs.current.add(Ue),(Re=n.current)==null||Re.send({type:"fs.read",workspaceId:h.workspaceId,path:Ue})}const _e=fi.current.get(h.path);fi.current.delete(h.path),Bs.current.delete(h.path),Wi(Ue=>{if(!_e&&!(h.path in Ue))return Ue;const qt={...Ue};return _e?qt[h.path]=_e.entry:delete qt[h.path],qt});const we=as.current.get(h.path);as.current.delete(h.path);const ze=we!==void 0;Is(Ue=>Ue.map(qt=>qt.path!==h.path?qt:ze?{...qt,saved:we,mtime:h.mtime,size:h.size,stale:!1}:{...qt,stale:!0}));const Te=el.current.find(Ue=>Ue.path===h.path);!ze&&Te&&!ni(Te)&&((at=n.current)==null||at.send({type:"fs.read",workspaceId:h.workspaceId,path:h.path})),(Ct=n.current)==null||Ct.send({type:"git.state",workspaceId:h.workspaceId});break}case"fs.result":{if(h.workspaceId!==Et.current)break;if(((cs=cn.current)==null?void 0:cs.path)===h.path&&!h.ok){const ze=cn.current;if(as.current.delete(h.path),h.conflict&&ze.attempt<50){const Te=ze.attempt+1,Ue=Wb(ze.base,Te);cn.current={...ze,attempt:Te,path:Ue},(xa=n.current)==null||xa.send({type:"fs.write",workspaceId:h.workspaceId,path:Ue,content:ze.content,eol:"lf",baseMtime:0})}else cn.current=null,kl({ok:!1,message:h.message});break}kl({ok:h.ok,message:h.message}),h.ok||as.current.delete(h.path);const _e=fi.current.get(h.path);if(!h.ok&&_e&&(fi.current.delete(h.path),Wi(ze=>{if(!(h.path in ze))return ze;const Te={...ze};return delete Te[h.path],Te}),_e.onFail(h.message)),h.conflict&&Is(ze=>ze.map(Te=>Te.path===h.path?{...Te,stale:!0}:Te)),$s.current===h.path){const ze=$s.current;$s.current=null,h.ok&&(xs.current.add(ze),(As=n.current)==null||As.send({type:"fs.read",workspaceId:h.workspaceId,path:ze}))}const we=cl.current;if(h.ok&&we&&we.to===h.path){cl.current=null;const ze=Te=>Te===we.from?we.to:Te.startsWith(`${we.from}/`)?we.to+Te.slice(we.from.length):Te;Is(Te=>Te.map(Ue=>({...Ue,path:ze(Ue.path)}))),Da(Te=>Te===null?null:ze(Te)),Qr(Te=>Te.map(ze)),Pi(Te=>{const Ue={};for(const[qt,To]of Object.entries(Te))qt===we.from||qt.startsWith(`${we.from}/`)||(Ue[qt]=To);return Ue})}h.ok&&((Rl=n.current)==null||Rl.send({type:"git.state",workspaceId:h.workspaceId}));break}case"term.list":if(h.workspaceId!==Et.current)break;ra(h.terminals);break;case"term.opened":if(h.terminal.workspaceId!==Et.current)break;ca(null),ra(_e=>{const we=_e.findIndex(Te=>Te.id===h.terminal.id);if(we===-1)return[..._e,h.terminal];const ze=_e.slice();return ze[we]=h.terminal,ze}),eo.current&&(eo.current=!1,ec(h.terminal.id));break;case"term.buffer":(_a=wl.current.get(h.id))==null||_a({kind:"buffer",data:h.data});break;case"term.data":(ba=wl.current.get(h.id))==null||ba({kind:"data",data:h.data});break;case"term.exit":ra(_e=>_e.map(we=>we.id===h.id?{...we,exitCode:h.exitCode}:we));break;case"term.closed":ra(_e=>_e.filter(we=>we.id!==h.id));break;case"mcp.list":h.sessionId===Zn.current&&dn(h.servers);break;case"mcp.auth":h.sessionId===Zn.current&&sl(h.state);break;case"plugin.list":if(h.sessionId!==Zn.current)break;Nl(h.plugins),Zs(h.duplicates),Gt(h.marketplaces),js(h.catalog);break;case"operation.result":h.sessionId===Zn.current&&Ns(h.result);break;case"auth.status":Ws(_e=>({..._e,[h.accountId]:h.status}));break;case"accounts.candidates":y(h.candidates);break;case"accounts.usage":Ie(_e=>{const we={..._e};for(const[ze,Te]of Object.entries(h.usage))(Te!==null||!(ze in we))&&(we[ze]=Te);return we});break;case"accounts.state":ci(h.accounts.length>0?h.accounts:My),ps(null),Ws(_e=>{const we={};for(const ze of h.accounts)we[ze.id]=h.auth[ze.id]??_e[ze.id]??null;return we});break;case"relay.state":m(h.state);break;case"memory.state":Ut(h.files),Fs(h.accountId);break;case"memory.file":Rn({id:h.id,content:h.content,mtime:h.mtime});break;case"memory.result":$t({id:h.id,ok:h.ok,message:h.message,conflict:h.conflict,mtime:h.mtime});break;case"site.opened":St({n:++Dt.current,ok:!0,url:h.url,proxyUrl:h.proxyUrl});break;case"site.failed":St({n:++Dt.current,ok:!1,url:h.url,message:h.message});break;case"video.catalog":{const{type:_e,...we}=h;Pt(we);break}case"video.studio":ut(_e=>({..._e,[`${h.state.workspaceId}
165
+ ${h.state.root}`]:h.state}));break;case"schedule.state":Dn(h.tasks);break;case"network.state":g(h.state);break;case"settings.state":Xe(h.settings);break;case"handoff.state":Ps(_e=>{if(!h.handoff){if(!(h.sessionId in _e))return _e;const we={..._e};return delete we[h.sessionId],we}return{..._e,[h.sessionId]:h.handoff}});break;case"handoff.written":na(_e=>{if(!(h.sessionId in _e))return _e;const we={..._e};return delete we[h.sessionId],we}),h.handoff&&Zn.current===h.sessionId?Fi(h.handoff):h.handoff||console.warn("[handoff] хост не смог записать хэндофф",h.sessionId);break;case"limit.stopped":lc.current+=1,bn(_e=>[..._e,{id:lc.current,limit:h.limit,utilization:h.utilization,stopped:h.stopped,handoffs:h.handoffs}]);break;case"auth.login":Ta(_e=>({..._e,[h.accountId]:h.state})),h.state.active&&ks(!0);break;case"session.closed":J(_e=>_e.filter(we=>we.id!==h.sessionId)),D(_e=>_e.map(we=>we.id===h.sessionId?{...we,state:"closed"}:we)),q(_e=>{let we=!1;const ze={};for(const[Te,Ue]of Object.entries(_e))Ue.sessions.some(qt=>qt.id===h.sessionId&&qt.state!=="closed")?(we=!0,ze[Te]={...Ue,sessions:Ue.sessions.map(qt=>qt.id===h.sessionId?{...qt,state:"closed"}:qt)}):ze[Te]=Ue;return we?ze:_e});break;case"error":console.error("[host]",h.message,h.context??""),(h.context==="workspace.open"||h.context==="workspace.create")&&(Bl.current=null,zn(h.message)),(Vl=h.context)!=null&&Vl.startsWith("term.")&&ca(h.message),(_s=h.context)!=null&&_s.startsWith("folder.")&&me(`${h.message} Ничего не изменилось.`),(ya=h.context)!=null&&ya.startsWith("accounts.")&&ps(h.message),(Zu=h.context)!=null&&Zu.startsWith("schedule.")&&us(h.message);break}},[]),ae=x.useCallback(h=>{var M;(M=n.current)==null||M.send(h)},[]),Zd=x.useCallback((h,M,ee)=>{const ve=`${h}:${M}:${ee}`;return new Promise(Re=>{const at=setTimeout(()=>{gs.current.delete(ve),Re({type:"session.filesRewound",sessionId:h,userIndex:M,dryRun:ee,canRewind:!1,error:"Хост не ответил."})},3e4);gs.current.set(ve,Ct=>{clearTimeout(at),Re(Ct)}),ae({type:"session.rewindFiles",sessionId:h,userIndex:M,dryRun:ee})})},[ae]);x.useEffect(()=>{U&&ae({type:"session.list",workspaceId:U})},[U,ae]),x.useEffect(()=>{l&&ae({type:"session.pins"})},[l,ae]),x.useEffect(()=>{l&&ae({type:"settings.get"})},[l,ae]),x.useEffect(()=>{if(l)return ae({type:"session.drafts",sessionIds:Qy()}),Jj(h=>ae({type:"session.drafts",sessionIds:h}))},[l,ae]),x.useEffect(()=>{if(ua.current)return;const h=ar.current;if(!h||!U)return;if(U!==h.workspaceId){ua.current=!0;return}if(W){ua.current=!0;return}if(Q.length===0)return;const M=Q.find(ee=>rM(ee,h));ua.current=!0,M&&M.state!=="closed"&&ql(M)},[Q,U,W]),x.useEffect(()=>{!U||tc||!Oa||ae({type:"term.list",workspaceId:U})},[U,tc,Oa,ae]),x.useEffect(()=>{ec(h=>{var M;return h&&sr.some(ee=>ee.id===h)?h:((M=sr[0])==null?void 0:M.id)??null})},[sr]),x.useEffect(()=>{On&&ae({type:"workspace.roots"})},[On,ae]);const yn=x.useCallback(()=>{const h=Zn.current;h&&(qc(!0),ae({type:"usage.get",sessionId:h}),ae({type:"context.get",sessionId:h}))},[ae]);x.useEffect(()=>{if(!oi)return;const h=window.setTimeout(()=>qc(!1),lM);return()=>window.clearTimeout(h)},[oi]);const Yt=x.useMemo(()=>{const h=Math.max((Bt==null?void 0:Bt.fetchedAt)??0,(Gn==null?void 0:Gn.fetchedAt)??0);return h>0?h:null},[Bt==null?void 0:Bt.fetchedAt,Gn==null?void 0:Gn.fetchedAt]);x.useEffect(()=>{if(Vr(null),!W)return;yn();const h=()=>{document.hidden||yn()},M=window.setInterval(h,sM),ee=()=>{document.hidden||yn()};return document.addEventListener("visibilitychange",ee),()=>{window.clearInterval(M),document.removeEventListener("visibilitychange",ee)}},[W,yn]),x.useEffect(()=>{if(!W){Qe(bp);return}Qe({...bp,loading:!0}),ae({type:"session.history",sessionId:W})},[W,ae]);const ht=x.useCallback(()=>{!W||Ye.loading||!yp(Ye)||(Qe(h=>({...h,loading:!0})),ae({type:"session.history",sessionId:W,before:Wy(Ye)}))},[W,Ye,ae]),Tl=x.useMemo(()=>n1(Ye.entries),[Ye.entries]),ol=x.useMemo(()=>Ve?vT([...Tl,...ke.items]):[],[Ve,Tl,ke.items]),ju=x.useMemo(()=>{const h={};for(const M of Object.values(st))M.workspaceId===U&&(h[M.root]=M);return h},[st,U]);function Ia(h){return W?(ge({token:++Ee.current,text:h}),Da(null),!0):!1}const X=x.useMemo(()=>Q.find(h=>h.id===W)??null,[Q,W]),lo=X!==null&&X.state!=="closed"&&Jn(X.provider)&&X.parentSessionId===null;x.useEffect(()=>{dn([]),sl(null),W&&lo&&ae({type:"mcp.list",sessionId:W})},[W,lo,ae]);const Hs=W?(X==null?void 0:X.claudeSessionId)??W:null,is=Hs?ta[Hs]??null:null;x.useEffect(()=>{Hs&&ae({type:"handoff.get",sessionId:Hs})},[Hs,ae]),x.useEffect(()=>{ms&&!(ms.sessionId in ta)&&ll(null)},[ta,ms]);const ao=x.useMemo(()=>{var ee;if(!Bt)return null;const h=(((ee=Bt.buckets)==null?void 0:ee.length)??0)>0,M=!Jn(X==null?void 0:X.provider);return h===M?Bt:null},[Bt,X==null?void 0:X.provider]),Ua=Un.length>1;function io(h){return Un.some(M=>M.id===h)?h:$i}const bi=x.useMemo(()=>({accounts:Un,auth:al,multi:Un.length>1}),[Un,al]),Yn=Ua&&X&&Jn(X.provider)?Un.find(h=>h.id===X.accountId)??null:null,$a=x.useMemo(()=>{const h={};for(const M of Q)Jn(M.provider)&&(M.state!=="running"&&M.state!=="waiting_permission"||(h[M.accountId]=(h[M.accountId]??0)+1));return h},[Q]),Hl="Обновить лимиты и контекст",Nu=Hl+(Yt?`
166
+ обновлено в ${new Date(Yt).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}`:"");x.useEffect(()=>{document.documentElement.dataset.provider=(X==null?void 0:X.provider)??"claude"},[X==null?void 0:X.provider]),x.useEffect(()=>{Jn(X==null?void 0:X.provider)||to(!1)},[X==null?void 0:X.provider]);const hn=w.find(h=>h.id===U)??C.find(h=>h.id===U)??null;x.useEffect(()=>{if(!U||!W)return;const h={workspaceId:U,sessionId:W,claudeSessionId:(X==null?void 0:X.claudeSessionId)??null};try{localStorage.setItem(jv,JSON.stringify(h))}catch{}},[U,W,X==null?void 0:X.claudeSessionId]);function rr(h){Bl.current=h,zn(null),ae({type:"workspace.open",path:h})}function ro(h,M,ee){zn(null),ae({type:"workspace.create",parent:h,name:M,init:ee})}function yi(h){if(da.current=h,!h){un([]),fs(!1);return}fs(!0),ae({type:"workspace.find",query:h})}function rs(h){da.current=h,yl(Ys),ae({type:"workspace.find.agent",query:h})}function co(){on(!1),zn(null),In(null),un([]),yl(Ys),vt(null),da.current="",Bl.current=null}function Ba(){const h=Zn.current;h&&El.current&&ae({type:"side.reset",sessionId:h}),El.current=null,nc(null),Us(Ys),Es(null),oa({}),za.current=[]}function rm(h){ae({type:"workspace.close",workspaceIds:h}),Pd(h)}function cm(h){ae({type:"workspace.unmark",workspaceIds:h}),Pd(h)}function Pd(h){!U||!h.includes(U)||(Ba(),ye(null),fe(null),D([]),ne([]),Be(Ys),lt(null),Ge(!1))}function $n(h,M){ae({type:"session.archive",workspaceId:h,sessionIds:M}),W&&(M.includes(W)||X!=null&&X.claudeSessionId&&M.includes(X.claudeSessionId))&&(Ba(),fe(null),Be(Ys),lt(null),Ge(!1))}function ku(h){ae({type:"workspace.restore",workspaceIds:h})}function ac(h,M,ee){me(null),ae({type:"folder.create",scope:h,name:M,workspaceId:ee})}function ic(h,M){me(null),ae({type:"folder.rename",folderId:h,name:M})}function wu(h,M){me(null),ae({type:"folder.setColor",folderId:h,color:M})}function cr(h,M,ee,ve){me(null),ae({type:"folder.assign",scope:h,itemId:M,folderId:ee,workspaceId:ve})}function or(h=ft[0]??"claude",M){if(!U)return;let ee;h==="claude"&&Ua&&(ee=M??io(re),Me(ee),Gj(ee)),Ba(),fe(null),lt(null),Be(Ys),Ge(!1),Sl.current=U,ae({type:"session.start",workspaceId:U,provider:h,...ee?{accountId:ee}:{}}),We(!1)}function rc(h){Sl.current=null,Ba(),pr(),ye(h),fe(null),Be(Ys),lt(null),Ge(!1),qd(null),Fr(null),Gc(null),il(null),Gd(""),Vc(!1),mu(null),Xc(!1),ra([]),ec(null)}function Wd(h,M,ee){ae({type:"session.pin",workspaceId:h,sessionIds:M,pinned:ee})}function om(h){return h.state==="running"||h.state==="waiting_permission"||h.state==="reconnecting"||h.backgroundWork}function oo(h){if(om(h)){G(h);return}ae({type:"session.close",sessionId:h.id})}function vi(h,M,ee){F(ve=>{const Re=ve??{workspaces:[],sessions:{},pinned:[],live:[]};if(h==="sessions"){if(!ee)return ve;const at={...Re.sessions};return M&&M.length>0?at[ee]=M:delete at[ee],{...Re,sessions:at}}return{...Re,[h]:M??[]}}),ae({type:"order.set",scope:h,ids:M,...ee?{workspaceId:ee}:{}})}function Su(h){h.workspaceId!==U&&rc(h.workspaceId),ql(h)}function ql(h){if(We(!1),Ba(),Be(Ys),lt(null),Ge(!1),h.state==="closed"){fe(null),Sl.current=h.workspaceId,ae({type:"session.start",workspaceId:h.workspaceId,resume:h.claudeSessionId??h.id});return}Sl.current=null,fe(h.id),ae({type:"session.sync",sessionId:h.id,sinceSeq:0})}function Jd(h){ae({type:"session.searchContent",query:h})}function ur(h){const M=Q.find(ee=>ee.id===h.sessionId||ee.claudeSessionId===h.sessionId);if(M&&M.workspaceId===h.workspaceId&&h.workspaceId===U){ql(M);return}if(h.workspaceId!==U){ts(h.sessionId),rc(h.workspaceId);return}We(!1),Ba(),Be(Ys),lt(null),Ge(!1),fe(null),Sl.current=h.workspaceId,ae({type:"session.start",workspaceId:h.workspaceId,resume:h.sessionId})}x.useEffect(()=>{if(!rn||!U)return;const h=Q.find(ve=>ve.workspaceId===U&&(ve.id===rn||ve.claudeSessionId===rn));if(h){ts(null),ql(h);return}const M=rn,ee=setTimeout(()=>{ts(ve=>ve===M?null:ve),Sl.current=U,fe(null),ae({type:"session.start",workspaceId:U,resume:M})},1200);return()=>clearTimeout(ee)},[Q,rn,U]);function uo(){return CS([...Tl,...ke.items],{title:(X==null?void 0:X.title)??null,project:(hn==null?void 0:hn.name)??null,agent:F_(X==null?void 0:X.provider),partial:yp(Ye)})}function cc(){AS(`${Pb((X==null?void 0:X.title)??null)}.md`,uo())}function oc(){if(!U)return;const h=Pb((X==null?void 0:X.title)??null),M=uo(),ee=Wb(h,1);cn.current={base:h,attempt:1,path:ee,content:M},ae({type:"fs.write",workspaceId:U,path:ee,content:M,eol:"lf",baseMtime:0})}function ef(h){if(!h.lastSessionId)return;bt(!1);const M=Q.find(ee=>ee.id===h.lastSessionId);if(M&&M.workspaceId===U){ql(M);return}Ln(h.lastSessionId),h.workspaceId!==U?rc(h.workspaceId):ae({type:"session.list",workspaceId:h.workspaceId})}x.useEffect(()=>{if(!wn)return;const h=Q.find(M=>M.id===wn);h&&(Ln(null),ql(h))},[Q,wn]);function tf(h,M,ee){if(!W||_)return!1;const ve=W,Re=X;return ji(()=>{if((Re==null?void 0:Re.state)==="closed"){_i.current={sessionId:Re.claudeSessionId??Re.id,text:h,images:M,attachments:ee},ql(Re);return}const at=(Re==null?void 0:Re.state)==="running"||(Re==null?void 0:Re.state)==="waiting_permission"||(Re==null?void 0:Re.state)==="reconnecting",Ct=le[ve];if(at||Ct&&Ct.items.length>0&&!Ct.paused){ae({type:"queue.add",sessionId:ve,text:h,images:M,attachments:ee});return}ae({type:"prompt.send",sessionId:ve,text:h,images:M,attachments:ee})})}const fa=ns!==null&&ns.active&&ns.accountId===(X==null?void 0:X.accountId);function Ha(){if(!fa||!ns)return Promise.resolve(!0);const h=ns.name;return new Promise(M=>{ea(ee=>(ee==null||ee.resolve(!1),{name:h,resolve:M}))})}function fo(h){hs&&(hs.resolve(h),ea(null))}function nf(h){Jl(M=>{const ee=[...new Set([...M,...h])];try{localStorage.setItem(Nv,JSON.stringify(ee))}catch{}return ee})}function ji(h){const M=Jn(X==null?void 0:X.provider)?DA(Bt,Ae):null;return M?new Promise(ee=>{de(ve=>(ve==null||ve.resolve(!1),{warning:M,resolve:ee}))}).then(ee=>(ee&&h(),ee)):(h(),!0)}function Ni(h){ie&&(ie.resolve(h),de(null))}function uc(h){const M=pe.find(Re=>(Re.claudeSessionId??Re.id)===h.sessionId&&Re.state!=="closed"),ee=ki(h.sessionId,h.workspaceId,h.limit!==null),ve=ee!=null&&ee.canChoose?ee.selectedId:(ee==null?void 0:ee.sourceId)??(M==null?void 0:M.accountId);Eu(h.workspaceId,h.sessionId,h.text,ve),M&&ae({type:"session.close",sessionId:M.id})}function ki(h,M,ee){var _a,ba,Vl;if(!Ua)return null;const ve=_s=>_s.id===h||_s.claudeSessionId===h,Re=pe.find(ve)??Q.find(ve)??((_a=Y[M])==null?void 0:_a.sessions.find(ve));if(Re&&!Jn(Re.provider))return null;const at=Re==null?void 0:Re.accountId,Ct=Un.filter(_s=>{var ya;return((ya=al[_s.id])==null?void 0:ya.loggedIn)!==!1}),cs=_s=>_s&&Ct.some(ya=>ya.id===_s)?_s:void 0,xa=cs(sa[h]),As=at?(ba=Ct.find(_s=>_s.id!==at))==null?void 0:ba.id:void 0,Rl=xa??(ee?As:void 0)??cs(at)??cs($i)??((Vl=Ct[0])==null?void 0:Vl.id)??$i;return{source:Un.find(_s=>_s.id===at)??null,sourceId:at,targets:Ct,selectedId:Rl,canChoose:Ct.length>1}}function dc(h){Eu(h.workspaceId,h.claudeSessionId??h.id,null,h.accountId)}function Eu(h,M,ee,ve){Js.current=ee===null?null:{workspaceId:h,text:ee},h!==U?rc(h):(Ba(),fe(null),lt(null),Be(Ys),Ge(!1)),Sl.current=h,ae({type:"session.start",workspaceId:h,provider:"claude",...Ua&&ve?{accountId:ve}:{},continuesFrom:M,...ee===null?{}:{fromHandoff:!0}}),We(!1)}x.useEffect(()=>{Il&&(Fi(null),uc(Il))},[Il]);function qa(h){Kn[h.id]||(na(M=>({...M,[h.id]:!0})),ae({type:"session.handoff",sessionId:h.id}))}function sf(h){ae({type:"handoff.dismiss",sessionId:h})}function ha(h,M){ae({type:"session.rename",sessionId:h.id,title:M,workspaceId:h.workspaceId}),D(ee=>ee.map(ve=>ve.id===h.id?{...ve,title:M}:ve)),q(ee=>{const ve=ee[h.workspaceId];return ve?{...ee,[h.workspaceId]:{...ve,sessions:ve.sessions.map(Re=>Re.id===h.id?{...Re,title:M}:Re)}}:ee})}function fc(h){W&&(We(!1),Ns(null),sl(null),kt(h),ae({type:"mcp.list",sessionId:W}),ae({type:"plugin.list",sessionId:W}))}const ho={mcpAction:(h,M)=>{W&&(Ns(null),ae({type:"mcp.action",sessionId:W,name:h,action:M}))},mcpAuth:(h,M)=>{if(!W)return;const ee=M??(X==null?void 0:X.accountId)??$i;Ns(null),sl({name:h,accountId:ee,stage:"starting",active:!0,url:"",callbackExpected:!1,done:!1,error:null,diagnostic:null,otherAccounts:[]}),ae({type:"mcp.auth",sessionId:W,name:h,...M&&M!==(X==null?void 0:X.accountId)?{accountId:M}:{}})},mcpAuthCallback:(h,M)=>{W&&ae({type:"mcp.auth_callback",sessionId:W,name:h,callbackUrl:M})},mcpAdd:(h,M)=>{W&&ae({type:"mcp.add",sessionId:W,name:h,draft:M})},mcpRemove:h=>{W&&ae({type:"mcp.remove",sessionId:W,name:h})},pluginInstall:h=>{W&&ae({type:"plugin.install",sessionId:W,spec:h})},pluginDedupe:h=>{W&&(Ns(null),ae({type:"plugin.dedupe",sessionId:W,id:h}))},pluginUninstall:h=>{W&&ae({type:"plugin.uninstall",sessionId:W,id:h})},pluginToggle:(h,M)=>{W&&ae({type:"plugin.toggle",sessionId:W,id:h,enabled:M})},marketplaceAdd:h=>{W&&ae({type:"marketplace.add",sessionId:W,source:h})},marketplaceRemove:h=>{W&&ae({type:"marketplace.remove",sessionId:W,name:h})}};function ma(){We(!1),ks(!0),ps(null);for(const h of Un)ae({type:"auth.status",accountId:h.id})}const Gl={login:(h,M,ee)=>ae({type:"auth.login",mode:M,switchAccount:ee,accountId:h}),submitCode:(h,M)=>ae({type:"auth.code",code:M,accountId:h}),cancel:h=>ae({type:"auth.cancel",accountId:h}),logout:h=>ae({type:"auth.logout",accountId:h})},hc={discover:()=>ae({type:"accounts.discover"}),requestUsage:()=>ae({type:"accounts.usage"}),add:(h,M,ee,ve)=>{ps(null),ae({type:"accounts.add",name:h,color:M,...ee?{configDir:ee}:{},...ve?{shareConfig:!0}:{}})},update:(h,M)=>{ps(null),ae({type:"accounts.update",accountId:h,...M})},remove:h=>{ps(null),ae({type:"accounts.remove",accountId:h})},makeMain:h=>{ps(null),ae({type:"accounts.makeMain",accountId:h})}};function mc(h){ks(!1),We(!1),Z(h),fn(!0),ae({type:"settings.get"});for(const M of Un)ae({type:"auth.status",accountId:M.id})}function Cu(){We(!1),Z(null),fn(!0),ae({type:"settings.get"});for(const h of Un)ae({type:"auth.status",accountId:h.id})}function pc(h){Xe(M=>M&&{...M,...h}),ae({type:"settings.update",settings:h})}function gc(h,M,ee){!W||_||ae({type:"side.ask",sessionId:W,text:h,images:M,attachments:ee})}function lf(){W&&(ae({type:"side.reset",sessionId:W}),El.current=null,nc(null),Us(Ys),Es(null),oa({}),za.current=[])}function dr(h){const M=El.current;if(M){h(M);return}const ee=Zn.current;ee&&(za.current.push(h),ae({type:"side.open",sessionId:ee}))}function wi(){U&&ae({type:"git.state",workspaceId:U})}function mo(h){U&&(Gc(h),ae({type:"git.show",workspaceId:U,ref:h}))}function Tu(h,M){il(null),Yc({target:h,label:M})}function Au(){!U||!Zi||(ae({type:"git.checkout",workspaceId:U,target:Zi.target}),Yc(null))}function Mu(){U&&(il(null),ae({type:"git.push",workspaceId:U}))}function tl(h){U&&(il(null),ae({type:"git.pull",workspaceId:U,merge:h}))}function ul(){U&&(il(null),mu(null),Vc(!0),ae({type:"github.status"}),ae({type:"github.owners"}),ae({type:"git.files",workspaceId:U}))}function Ga(h){U&&(il(null),ae({type:"git.publish",workspaceId:U,...h}))}function Ru(h){U&&(il(null),ae({type:"git.remote",workspaceId:U,url:h}))}function af(){il(null),Xc(!0)}function Ya(h){ae({type:"github.token",token:h}),ae({type:"github.owners"})}function nl(){ae({type:"github.status"}),ae({type:"github.owners"})}x.useEffect(()=>{if(!(!Ss||!U))for(const h of Kr)h in ui||ae({type:"fs.list",workspaceId:U,path:h})},[Ss,Kr,ui,U,ae]);function Cn(h){Qr(M=>M.includes(h)?M.filter(ee=>ee!==h):[...M,h])}function po(h){if(!h){Kc(null);return}U&&ae({type:"fs.search",workspaceId:U,query:h})}function pa(h){if(!h){Pc(null);return}U&&ae({type:"fs.grep",workspaceId:U,query:h})}const Je=x.useCallback((h,M)=>{Fd(Re=>({...Re,[h]:M}));const ee=Et.current;if(M===null||!ee)return;const ve=M.lastIndexOf("/");if(ve!==-1){ae({type:"fs.list",workspaceId:ee,path:M.slice(0,ve)});return}if(M===""){ae({type:"fs.list",workspaceId:ee,path:""});return}ae({type:"fs.search",workspaceId:ee,query:M,scope:h})},[ae]),Ht=x.useMemo(()=>Ry(Qc.mention??null,Zc.mention??null,ui),[Qc.mention,Zc.mention,ui]),Bn=x.useMemo(()=>Ry(Qc.side??null,Zc.side??null,ui),[Qc.side,Zc.side,ui]);function go(h){Yl(h.path,{line:h.line,column:h.column})}function fr(h){const M=[];let ee=qr(h.path);for(;M.push(ee),!!ee;)ee=qr(ee);Qr(ve=>{const Re=new Set(ve);for(const at of M)Re.add(at);return h.kind==="dir"&&Re.add(h.path),[...Re]}),h.kind==="file"&&Yl(h.path)}function Yl(h,M){if(el.current.find(ve=>ve.path===h)){Da(h),M&&Wc({path:h,...M,token:++pu.current});return}U&&(M&&(tr.current={path:h,...M}),xs.current.add(h),ae({type:"fs.read",workspaceId:U,path:h}))}function hr(h,M=!1){const ee=el.current,ve=ee.find(Ct=>Ct.path===h);if(ve&&ni(ve)&&!M){Pr(h);return}Pr(null);const Re=ee.findIndex(Ct=>Ct.path===h),at=ee.filter(Ct=>Ct.path!==h);Is(at),Da(Ct=>{var cs;return Ct===h?((cs=at[Math.min(Re,at.length-1)])==null?void 0:cs.path)??null:Ct})}function Va(h,M=!1){const ee=el.current.find(ve=>ve.path===h);!ee||!U||!M&&!ni(ee)||(as.current.set(h,ee.text),ae({type:"fs.write",workspaceId:U,path:h,content:ee.text,eol:ee.eol,encoding:ee.encoding,baseMtime:ee.mtime,...M?{force:!0}:{}}))}function mr(h,M=!1){if(!U)return;const ee=el.current.find(at=>at.path===h);if(!ee)return;const ve=Zr.current[h];if(!M&&ve&&ve.forMtime===ee.mtime)return;const Re={forMtime:ee.mtime,loading:!0,html:ve==null?void 0:ve.html,missing:[]};Ma(at=>({...at,[h]:Re})),ae({type:"fs.preview",workspaceId:U,path:h})}function rf(h){const M=Re=>Re.replaceAll("\\","/"),ee=M(h),ve=gr?M(gr).replace(/\/+$/,""):"";return ve&&ee.toLowerCase().startsWith(ve.toLowerCase()+"/")?ee.slice(ve.length+1):ee.replace(/^\.\//,"")}function vn(h){const M=rf(h),ee=el.current.find(ve=>ve.path===M);ee&&!ee.previewMode&&Is(ve=>ve.map(Re=>Re.path===M?{...Re,previewMode:!0,textMode:!1}:Re)),Yl(M)}const xo=x.useRef(new Set);x.useEffect(()=>{var h;if(U)for(const M of ke.items){if(M.kind!=="tool"||M.result===null||M.isError||!["Write","Edit","MultiEdit"].includes(M.name)||xo.current.has(M.toolUseId))continue;xo.current.add(M.toolUseId);const ee=(h=M.input)==null?void 0:h.file_path;if(typeof ee!="string"||!Vh(ee))continue;const ve=rf(ee),Re=el.current.find(at=>at.path===ve);Re&&!ni(Re)&&_o(ve)}},[ke.items,U]);function _o(h){U&&ae({type:"fs.read",workspaceId:U,path:h})}function bo(h){U&&(Bs.current.has(h)||(Bs.current.add(h),ae({type:"fs.readMedia",workspaceId:U,path:h})))}function cf(h){bo(h)}function um(h,M,ee){const ve=U;if(!ve)return null;const Re=qr(h),at=`${zk(h)}-${Ok()}`,Ct=Lk(M.type);let cs=`${at}.${Ct}`;for(let Rl=2;yu.current.has(`${Re}/${cs}`);Rl+=1)cs=`${at}-${Rl}.${Ct}`;const xa=Re?`${Re}/assets/${cs}`:`assets/${cs}`;yu.current.add(`${Re}/${cs}`);const As=new FileReader;return As.onload=()=>{const Rl=String(As.result),_a=Rl.slice(Rl.indexOf(",")+1),ba={mime:M.type,base64:_a};fi.current.set(xa,{entry:ba,onFail:ee}),Wi(Vl=>({...Vl,[xa]:ba})),ae({type:"fs.writeBinary",workspaceId:ve,path:xa,base64:_a})},As.onerror=()=>ee("Не удалось прочитать картинку из буфера обмена."),As.readAsDataURL(M),`![](assets/${cs})`}const Du=x.useRef(new Map);function Lu(h){const M=Du.current,ee=M.get(h);ee&&clearTimeout(ee);const ve=(Ae==null?void 0:Ae.autoSaveAfterPauseMs)??0;ve<=0||M.set(h,setTimeout(()=>{M.delete(h);const Re=el.current.find(at=>at.path===h);Re&&ni(Re)&&!Re.stale&&Va(h)},ve))}function Ou(h,M,ee){if(!U)return;const ve=h?`${h}/${ee}`:ee;kl(null),M==="file"&&($s.current=ve),ae({type:"fs.create",workspaceId:U,path:ve,kind:M})}function Ts(h,M){if(!U)return;const ee=qr(h),ve=ee?`${ee}/${M}`:M;kl(null),cl.current={from:h,to:ve},ae({type:"fs.rename",workspaceId:U,path:h,to:ve})}function Tn(h,M){if(!U)return;const ee=h.slice(h.lastIndexOf("/")+1),ve=M?`${M}/${ee}`:ee;ve!==h&&(kl(null),cl.current={from:h,to:ve},ae({type:"fs.rename",workspaceId:U,path:h,to:ve}))}function yo(h,M){U&&(kl(null),ae({type:"fs.copy",workspaceId:U,path:h,toDir:M}))}function xc(h){U&&(kl(null),er(null),ae({type:"fs.delete",workspaceId:U,path:h.path}),Is(M=>M.filter(ee=>ee.path!==h.path&&!ee.path.startsWith(`${h.path}/`))),Da(M=>M&&(M===h.path||M.startsWith(`${h.path}/`))?null:M))}function pr(){Pi({}),Qr([""]),Is([]),Ma(()=>({})),Da(null),kl(null),Kc(null),Pc(null),Fd({}),Kd({}),Wc(null),xs.current.clear(),as.current.clear(),Bs.current.clear(),fi.current.clear(),Wi({}),tr.current=null,cl.current=null,$s.current=null}function zu(){!U||tc||!Oa||(ca(null),eo.current=!0,ae({type:"term.open",workspaceId:U,cols:80,rows:24}))}function ga(h){ae({type:"term.close",id:h})}function vo(h,M){W&&ae({type:"permission.respond",sessionId:W,requestId:h,decision:M})}function Iu(h,M){W&&ae({type:"permission.respond",sessionId:W,requestId:h,decision:"allow",answers:M})}function Uu(h){W&&ae({type:"permission.respond",sessionId:W,requestId:h,decision:"deny",reason:"Пользователь не стал отвечать на вопросы"})}function of(h,M){W&&ae({type:"permission.respond",sessionId:W,requestId:h,decision:"allow",plan:M})}function uf(h){W&&ae({type:"permission.respond",sessionId:W,requestId:h,decision:"deny",reason:"Пользователь просит продолжить планирование"})}x.useEffect(()=>{function h(M){if(M.key!=="Escape")return;if(Jt!==null){const ve=M.target;if(!(ve instanceof HTMLElement&&ve.closest(".termview, .editor, .sidepane"))){sc(null);return}}if(!W||ke.pending.length>0)return;const ee=M.target;ee instanceof HTMLElement&&ee.closest(".sidepane, .editor")||ae({type:"control.interrupt",sessionId:W})}return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[W,ke.pending.length,ae,Jt]),x.useEffect(()=>{function h(M){M.key!=="`"||!(M.ctrlKey||M.metaKey)||Oa&&(M.preventDefault(),La(ee=>!ee))}return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[Oa]);const $u=x.useMemo(()=>{const h=(Le==null?void 0:Le.commands)??[];return h.length===0||!Jn(X==null?void 0:X.provider)?h:[...h,{name:"plugins",description:"Плагины и маркетплейсы — окно приложения",argumentHint:"",aliases:["plugin"]},...Ay]},[Le,X==null?void 0:X.provider]);function Bu(h){const M=cM[h];if(M&&Jn(X==null?void 0:X.provider))return fc(M),!0;if(!Jn(X==null?void 0:X.provider)||!Ay.some(ve=>ve.name===h))return!1;const ee=(X==null?void 0:X.accountId)??$i;return mc(ee),h==="logout"&&Gl.logout(ee),h==="switch-account"&&Gl.login(ee,"claudeai",!0),!0}const _c=(X==null?void 0:X.state)==="waiting_permission",dl=(X==null?void 0:X.state)==="reconnecting",qs=(X==null?void 0:X.state)==="running"||dl||_c,en=ke.pending[0]??null,Hu=en?aC(en.toolName,en.input):null,[df,ff]=x.useState(()=>new Set),bc=en?df.has(en.requestId):!1,jo=en?en.questions&&en.questions.length>0?"question":Hu!==null?"plan":"permission":null;function yc(h,M){ff(ee=>{if(ee.has(h)===M)return ee;const ve=new Set(ee);return M?ve.add(h):ve.delete(h),ve})}x.useEffect(()=>{!aa&&!Ss||!U||qs||ae({type:"git.state",workspaceId:U})},[aa,Ss,U,qs,ae]),x.useEffect(()=>{if(!(qs||!U)){Ss&&Pi(h=>{const M={};for(const[ee,ve]of Object.entries(h))ir.current.includes(ee)||(M[ee]=ve);return M});for(const h of el.current)ni(h)||ae({type:"fs.read",workspaceId:U,path:h.path})}},[qs,U,Ss,ae]);const gr=(X==null?void 0:X.cwd)??(Le==null?void 0:Le.cwd)??null,qu=(Le==null?void 0:Le.models)??[],vc=(X==null?void 0:X.model)??(Le==null?void 0:Le.model)??null,{rows:Gu,selected:dm}=Ly(qu,vc),xr=rl?{model:rl.model,effort:rl.effort,ultracode:rl.ultracode,thinking:rl.thinking,switchOnFlag:rl.switchModelsOnFlag}:{model:$l.model??vc,effort:$l.effort??(X==null?void 0:X.effort)??null,ultracode:$l.ultracode??(X==null?void 0:X.ultracode)??!1,thinking:$l.thinking??(X==null?void 0:X.thinking)??!0,switchOnFlag:$l.switchOnFlag??(X==null?void 0:X.switchModelsOnFlag)??!0},Si=Ly(qu,xr.model),hf=(rl==null?void 0:rl.state)==="running",Ei=Ra?Aa.find(h=>h.path===Ra)??null:null,No=new Set(Aa.filter(ni).map(h=>h.path)),_r=h=>s.jsx(zA,{pane:h,width:Qi.widths[h],onResize:M=>Qi.setWidth(h,M),onReset:()=>Qi.reset(h)}),Xa=h=>ct?null:()=>xi(h),fm=(X==null?void 0:X.provider)==="antigravity"?c1:(X==null?void 0:X.provider)==="codex"?o1:jg,Yu=Le&&s.jsx(_l,{title:"Режим прав",value:(X==null?void 0:X.permissionMode)??"default",options:fm.map(h=>({value:h.value,label:h.value,hint:h.hint})),onChange:h=>{W&&ae({type:"control.set_mode",sessionId:W,mode:h})}}),Vu=Gu.length>0?s.jsx(uv,{models:Gu,value:dm,effort:(X==null?void 0:X.effort)??null,ultracode:(X==null?void 0:X.ultracode)??!1,thinking:(X==null?void 0:X.thinking)??!0,switchOnFlag:(X==null?void 0:X.switchModelsOnFlag)??!0,showSwitchOnFlag:Jn(X==null?void 0:X.provider),onModel:h=>{!W||!h||ae({type:"control.set_model",sessionId:W,model:h})},onEffort:h=>{W&&ae({type:"control.set_effort",sessionId:W,effort:h})},onUltracode:h=>{W&&ae({type:"control.set_ultracode",sessionId:W,enabled:h})},onThinking:h=>{W&&ae({type:"control.set_thinking",sessionId:W,enabled:h})},onSwitchOnFlag:h=>{W&&ae({type:"control.set_flag_switch",sessionId:W,enabled:h})}}):vc&&s.jsx("span",{className:"badge",children:vc}),mf=qs&&s.jsx("span",{className:_c?"badge badge--wait":"badge badge--live",children:_c?"ждёт":dl?"переподключается":"работает"}),pf=(X==null?void 0:X.state)==="closed"&&s.jsx("span",{className:"badge",title:"Разговор сохранён — сессия поднимется заново, как только вы отправите сообщение",children:"остановлена"}),Xu=mf||pf,ko=()=>{if(!W)return;const h=W;Ha().then(M=>{M&&ae({type:"session.reconnect",sessionId:h,...fa?{force:!0}:{}})})},gf=dl?"Сессия уже поднимает новый процесс":qs?"Недоступно, пока идёт ход":"Поднять сессии новый процесс — разговор сохранён",xf=W&&(dl||(X==null?void 0:X.state)==="error")?s.jsxs("div",{className:dl?"relink":"relink relink--error",role:"status",children:[s.jsxs("span",{className:"relink__msg",children:[s.jsx("span",{className:"relink__dot","aria-hidden":"true"}),dl?"Связь оборвалась. Сессия поднимает новый процесс — разговор сохранён.":"Переподключиться не удалось. Разговор сохранён — сессия продолжит с этого места."]}),s.jsx("button",{className:"btn btn--sm",title:dl?"Не ждать паузы между попытками — попробовать сейчас":"Поднять сессии новый процесс и продолжить разговор",onClick:ko,children:dl?"Переподключить сейчас":"Переподключить"})]}):null,Al=is?ki(is.sessionId,is.workspaceId,is.limit!==null):null,_f=is&&(Al!=null&&Al.canChoose)?{targets:Al.targets,selectedId:Al.selectedId,sourceId:Al.sourceId,onSelect:h=>dt(M=>({...M,[is.sessionId]:h}))}:null,Ml=X&&X.state!=="closed"&&Jn(X.provider)&&Hs?ki(Hs,X.workspaceId,!1):null,wo=Ml!=null&&Ml.canChoose&&Hs?h=>dt(M=>({...M,[Hs]:h})):null,Fu=is?s.jsx(wA,{handoff:is,sourceAccount:(Al==null?void 0:Al.source)??null,accountChoice:_f,onContinue:()=>uc(is),onShow:()=>ll(is),onDismiss:()=>sf(is.sessionId)}):null,So=lo?Qs.filter(h=>h.status==="needs-auth"&&!ri.includes(h.name)).map(h=>h.name):[],bf=So.length>0&&!Sn?s.jsx(CA,{servers:So,onAuthorize:h=>{fc("mcp"),ho.mcpAuth(h)},onDismiss:()=>nf(So)}):null,jc=X&&X.totalCostUsd>0?`$${X.totalCostUsd.toFixed(3)}`:null,Ku=Jn(X==null?void 0:X.provider)&&s.jsx("button",{className:gi?"pane-btn is-on":"pane-btn",title:"Вопрос на полях — спросить, не мешая работе","aria-label":"Вопрос на полях","aria-pressed":gi,onClick:()=>to(h=>!h),children:s.jsx(_M,{})}),yf=hn&&s.jsx("button",{type:"button",className:"pane-btn",title:"Память и инструкции проекта","aria-label":"Память и инструкции",onClick:()=>rt(!0),children:s.jsx(bM,{})}),hm=X&&X.state!=="closed"&&s.jsx("button",{type:"button",className:"pane-btn pane-btn--stop",title:"Остановить сессию — освобождает память хоста, разговор остаётся на диске","aria-label":"Остановить сессию",onClick:()=>oo(X),children:s.jsx(mM,{})}),Fa=X?Kn[X.id]===!0:!1,Eo=n0({onLongPress:()=>{X&&dc(X)},onClick:()=>{X&&qa(X)},disabled:Fa}),Nc=X&&X.state!=="closed"&&Jn(X.provider)&&s.jsxs("button",{type:"button",className:Fa?"pane-btn pane-btn--handoff is-busy":Eo.holding?"pane-btn pane-btn--handoff is-holding":"pane-btn pane-btn--handoff",style:{"--hold-ms":`${Eo.thresholdMs}ms`},title:Fa?"Пишется хэндофф…":"Клик — хэндофф и новая сессия: агент запишет сводку, сессия остановится, работа продолжится в новой. Зажать (или Shift+клик) — новая пустая сессия без хэндоффа: закрепление переходит, старая сессия продолжает работать.","aria-label":"Хэндофф и новая сессия","aria-busy":Fa,disabled:Fa,...Eo.handlers,children:[s.jsx("span",{className:"pane-btn__hold","aria-hidden":"true"}),s.jsx(pM,{})]});return s.jsx(bg.Provider,{value:bi,children:s.jsxs("div",{className:"app",style:Qi.style,children:[s.jsx(Qw,{open:qn,connected:l,status:r,workspaces:w,archivedWorkspaces:C,sessionFolders:O,pinnedFolders:H,projectSessions:Y,onRequestSessions:h=>ae({type:"session.list",workspaceId:h}),pinned:I,live:pe,listOrder:A,liveSessionsFirst:(Ae==null?void 0:Ae.liveSessionsFirst)===!0,onReorder:vi,activeWorkspaceId:U,activeSessionId:W,onPinSessions:Wd,onSelectPinned:Su,contentResults:Os,onSearchContent:Jd,onOpenContentHit:ur,onCloseWorkspaces:rm,onRestoreWorkspaces:ku,onUnmarkWorkspaces:cm,onArchiveSessions:$n,onUnarchiveSessions:(h,M)=>{ae({type:"session.unarchive",workspaceId:h,sessionIds:M})},onCreateFolder:ac,onRenameFolder:ic,onSetFolderColor:wu,onAssignToFolder:cr,onSelectWorkspace:rc,onRenameSession:ha,onStopSession:oo,onOpenWorkspace:()=>on(!0),folderNotice:K,onDismissFolderNotice:()=>me(null),onNewSession:or,enabledProviders:ft,lastAccountId:io(re),onSignInAccount:mc,onOpenExtensions:W&&Jn(X==null?void 0:X.provider)?()=>fc("mcp"):null,account:al[$i]??null,onOpenAccount:ma,relay:u,onOpenRelay:N?null:()=>j(!0),onOpenSettings:Cu,onOpenTasks:()=>bt(!0),onOpenSite:()=>nn(!0),onOpenVideo:()=>et(!0),themeMode:Zh,onCycleTheme:Ph}),_r("sidebar"),qn&&s.jsx("div",{className:"scrim",onClick:()=>We(!1)}),s.jsx(Yk,{open:Ss,tree:ui,expanded:new Set(Kr),activePath:Ra,dirty:No,gitChanges:(ws==null?void 0:ws.changed)??[],result:Fc,searchResult:Xd,onSearch:po,onReveal:fr,onToggle:Cn,onOpen:Yl,onCreate:Ou,onRename:Ts,onMove:Tn,onCopy:yo,onDelete:er,onRefresh:()=>{kl(null),Pi({}),wi()},onClose:()=>ia(!1),zoomed:Jt==="files",onToggleZoom:Xa("files")}),Ss&&Jt!=="files"&&_r("files"),s.jsx(ew,{open:mi,result:Wr,onSearch:pa,onOpenMatch:go,onClose:()=>ls(!1),zoomed:Jt==="search",onToggleZoom:Xa("search")}),mi&&Jt!=="search"&&_r("search"),s.jsx(xC,{open:aa,state:ws,result:fu,selected:Wh,busy:hu,onRefresh:wi,onShow:mo,onCheckout:Tu,onPush:Mu,onPull:tl,onPublish:ul,onConnectRemote:af,onDismissResult:()=>il(null),onClose:()=>Xr(!1),zoomed:Jt==="git",onToggleZoom:Xa("git")}),aa&&Jt!=="git"&&_r("git"),s.jsxs("main",{className:(Jt==="main"||Jt==="terminal"?"main main--zoomed":"main")+(Yn?` main--acct acct--${Yn.color}`:""),children:[p&&_&&s.jsx(EA,{state:p}),s.jsxs("header",{className:"topbar",children:[s.jsx("button",{className:"btn btn--ghost menu-btn",onClick:()=>We(!0),children:"☰"}),s.jsx("button",{className:Ss?"pane-btn is-on":"pane-btn",title:"Файлы проекта","aria-label":"Файлы проекта","aria-pressed":Ss,onClick:()=>{ia(h=>!h),Xr(!1),ls(!1)},children:s.jsx(dM,{})}),s.jsx("button",{className:mi?"pane-btn is-on":"pane-btn",title:"Поиск по тексту в проекте","aria-label":"Поиск по тексту в проекте","aria-pressed":mi,onClick:()=>{ls(h=>!h),ia(!1),Xr(!1)},children:s.jsx(fM,{})}),s.jsx("button",{className:aa?"pane-btn is-on":"pane-btn",title:"История git","aria-label":"История git","aria-pressed":aa,onClick:()=>{Xr(h=>!h),ia(!1),ls(!1)},children:s.jsx(hM,{})}),Oa&&s.jsx("button",{className:nr?"pane-btn is-on":"pane-btn",title:"Терминал (Ctrl+`)","aria-label":"Терминал","aria-pressed":nr,onClick:()=>La(h=>!h),children:s.jsx(xM,{})}),ct&&Ku,ct&&s.jsx("button",{className:nt?"pane-btn is-on":"pane-btn",title:"Ещё","aria-label":"Ещё","aria-haspopup":"menu","aria-pressed":nt,onClick:()=>It(!0),children:s.jsx(yM,{})}),s.jsxs("div",{className:"topbar__id",children:[_n&&X?s.jsx(Vi,{className:"rename--title",value:X.title??"",onCommit:h=>{ha(X,h),Ge(!1)},onCancel:()=>Ge(!1)}):s.jsxs("div",{className:"topbar__head",children:[ct&&Yn&&s.jsx(Sa,{account:Yn}),s.jsx("button",{className:"topbar__title",disabled:!X||ct,title:X&&!ct?"Переименовать сессию":void 0,onClick:()=>Ge(!0),children:(X==null?void 0:X.title)??"Claude Code Visual"}),hn&&s.jsx("span",{className:"topbar__project",title:hn.path,children:hn.name})]}),ct?Xu:gr&&s.jsx(ov,{path:gr})]}),!ct&&s.jsxs("div",{className:"topbar__tools",children:[s.jsx(vS,{disabled:!X,saveDisabled:!U,onDownload:cc,onSave:oc}),s.jsx("button",{type:"button",className:oi?"meters-refresh is-busy":"meters-refresh",title:Nu,"aria-label":Hl,"aria-busy":oi,disabled:!W||oi,onClick:yn,children:s.jsx(vM,{})}),Yn&&s.jsx(Y_,{account:Yn,onClick:ma}),s.jsx(Yg,{usage:ao}),s.jsx(mv,{}),Yu,Vu,Xu,jc&&s.jsx("span",{className:"badge badge--cost",children:jc}),Nc,Ml&&wo&&!Fa&&s.jsx(vv,{variant:"mark",targets:Ml.targets,selectedId:Ml.selectedId,sourceId:Ml.sourceId,onSelect:wo}),hm,yf,Ku]})]}),s.jsx(KA,{tokens:(Gn==null?void 0:Gn.tokens)??ke.contextTokens,maxTokens:(Gn==null?void 0:Gn.maxTokens)??null,fetchedAt:(Gn==null?void 0:Gn.fetchedAt)??null}),ct&&nt&&s.jsx(ZC,{onClose:()=>It(!1),permission:Yu,model:Vu,account:Yn&&s.jsx(Y_,{account:Yn}),usage:ao,cwd:gr,costLabel:jc,onRefresh:yn,refreshing:oi,metersFetchedAt:Yt,onRename:X?()=>{Ge(!0),It(!1)}:null,onHandoff:X&&X.state!=="closed"&&Jn(X.provider)?()=>{qa(X),It(!1)}:null,onFreshSession:X&&X.state!=="closed"&&Jn(X.provider)?()=>{dc(X),It(!1)}:null,handoffWriting:Fa,handoffAccount:Ml&&wo&&!Fa?s.jsx(NA,{targets:Ml.targets,selectedId:Ml.selectedId,onSelect:wo}):null,onMemory:hn?()=>{rt(!0),It(!1)}:null,onExportDownload:X?cc:null,onExportSave:X&&U?oc:null,onStop:X&&X.state!=="closed"?()=>{oo(X),It(!1)}:null}),Aa.length>0&&s.jsx(Mw,{files:Aa,activePath:Ra,busy:qs,onSelect:Da,onClose:h=>hr(h),zoomed:Jt==="main",onToggleZoom:Xa("main")}),Ei?s.jsx(Tw,{file:Ei,goto:(Jr==null?void 0:Jr.path)===Ei.path?Jr:null,onChange:(h,M)=>{Is(ee=>ee.map(ve=>ve.path===h?{...ve,text:M}:ve)),Lu(h)},onSave:h=>Va(h),onReload:_o,onOverwrite:h=>Va(h,!0),onRequestMedia:bo,images:Vd,onRequestImage:cf,onPasteImage:um,preview:di[Ei.path],onRequestPreview:mr,onTogglePreview:h=>Is(M=>M.map(ee=>ee.path===h?{...ee,previewMode:!ee.previewMode}:ee)),onSetMarkdownMode:(h,M)=>{jk(M),Is(ee=>ee.map(ve=>ve.path===h?{...ve,previewMode:M==="preview",textMode:M==="text"}:ve))}}):s.jsxs(s.Fragment,{children:[s.jsx(Hg,{items:ke.items,busy:qs&&!dl,waiting:_c,empty:Jn(X==null?void 0:X.provider)?void 0:`Сессия пуста. Опишите задачу — ${F_(X==null?void 0:X.provider)} работает в каталоге проекта.`,onOpenPreview:vn,history:Tl,historyHasMore:yp(Ye),historyLoading:Ye.loading,onLoadHistory:ht,sessionId:W??void 0,onEditMessage:Jn(X==null?void 0:X.provider)?(h,M,ee,ve)=>{if(!W||_)return!1;const Re=W,at=fa;return Ha().then(Ct=>Ct?ji(()=>ae({type:"prompt.edit",sessionId:Re,userIndex:h,text:M,images:ee,...ve!=null&&ve.rewindFiles?{rewindFiles:!0}:{},...at?{force:!0}:{}})):!1)}:void 0,onRewindFiles:!Jn(X==null?void 0:X.provider)||!W?void 0:(h,M)=>Zd(W,h,M)}),xf,Fu,bf,W&&((kc=X==null?void 0:X.tasks)!=null&&kc.length)?s.jsx(zw,{tasks:X.tasks,onStop:h=>ae({type:"task.stop",sessionId:W,taskId:h})}):null,en&&jo&&bc&&s.jsx(eC,{kind:jo,toolName:en.toolName,queued:ke.pending.length-1,onExpand:()=>yc(en.requestId,!1)}),W&&(((Qu=le[W])==null?void 0:Qu.items.length)??0)>0?s.jsx(nM,{queue:le[W],onUpdate:(h,M)=>ae({type:"queue.update",sessionId:W,itemId:h,text:M}),onRemove:h=>ae({type:"queue.remove",sessionId:W,itemId:h}),onSendNow:h=>ae({type:"queue.send_now",sessionId:W,itemId:h}),onResume:()=>ae({type:"queue.resume",sessionId:W})}):null,s.jsx(iv,{disabled:!W,queueWhileBusy:!0,busy:qs&&!dl,sendBlocked:_,longPasteThreshold:(Ae==null?void 0:Ae.longPasteThreshold)??0,placeholder:dl?"Промпт уйдёт, как только связь вернётся":(X==null?void 0:X.state)==="closed"?"Остановлена — отправьте сообщение, чтобы продолжить":qs?"Агент работает — Enter поставит в очередь":void 0,commands:$u,sessionTitle:(X==null?void 0:X.title)??null,contextResult:Ht,draftKey:W,insertRequest:Xn,onInsertConsumed:h=>ge(M=>(M==null?void 0:M.token)===h?null:M),onContextSearch:h=>Je("mention",h),onCommand:Bu,onSend:tf,onInterrupt:()=>{W&&ae({type:"control.interrupt",sessionId:W})}})]}),nr&&Oa&&s.jsxs(s.Fragment,{children:[!ct&&Jt!=="terminal"&&s.jsx(UA,{height:lr.height,onResize:lr.setHeight,onReset:lr.reset}),s.jsx(qA,{mobile:ct,zoomed:Jt==="terminal",onToggleZoom:Xa("terminal"),terminals:sr,activeId:gu,blocked:tc,error:pi,onDismissError:()=>ca(null),height:ct?Jc.height:lr.height,offset:ct?{top:Jc.offsetTop,left:Jc.offsetLeft}:void 0,onSelect:ec,onOpen:zu,onClose:ga,onInput:(h,M)=>ae({type:"term.input",id:h,data:M}),onResize:(h,M,ee)=>ae({type:"term.resize",id:h,cols:M,rows:ee}),onAttach:h=>ae({type:"term.attach",id:h}),onHide:()=>La(!1),registerSink:im})]})]}),s.jsx(BC,{open:gi,items:no.items,busy:hf,ready:W!==null,sendBlocked:_,longPasteThreshold:(Ae==null?void 0:Ae.longPasteThreshold)??0,commands:$u,contextResult:Bn,draftKey:W,models:Si.rows,model:Si.selected,effort:xr.effort,ultracode:xr.ultracode,thinking:xr.thinking,switchOnFlag:xr.switchOnFlag,onContextSearch:h=>Je("side",h),onCommand:Bu,onModel:h=>{h&&(oa(M=>({...M,model:h})),dr(M=>ae({type:"control.set_model",sessionId:M,model:h})))},onEffort:h=>{oa(M=>({...M,effort:h,ultracode:!1})),dr(M=>ae({type:"control.set_effort",sessionId:M,effort:h}))},onUltracode:h=>{oa(M=>({...M,ultracode:h,...h?{effort:"xhigh"}:{}})),dr(M=>ae({type:"control.set_ultracode",sessionId:M,enabled:h}))},onThinking:h=>{oa(M=>({...M,thinking:h})),dr(M=>ae({type:"control.set_thinking",sessionId:M,enabled:h}))},onSwitchOnFlag:h=>{oa(M=>({...M,switchOnFlag:h})),dr(M=>ae({type:"control.set_flag_switch",sessionId:M,enabled:h}))},onAsk:gc,onInterrupt:()=>{xu&&ae({type:"control.interrupt",sessionId:xu})},onReset:lf,onClose:()=>to(!1),zoomed:Jt==="ask",onToggleZoom:Xa("ask")}),gi&&Jt!=="ask"&&_r("ask"),(aa||gi||Ss||mi)&&s.jsx("div",{className:"scrim scrim--pane",onClick:()=>{Xr(!1),to(!1),ia(!1),ls(!1)}}),du&&s.jsx(vC,{detail:du,local:((ws==null?void 0:ws.hasRemote)??!1)&&(ws==null?void 0:ws.commits.some(h=>h.hash===du.hash&&!h.pushed))===!0,onCheckout:Tu,onClose:()=>{Fr(null),Gc(null)}}),ie&&s.jsxs(Mn,{title:"Лимит плана почти исчерпан",onClose:()=>Ni(!1),actions:s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn",autoFocus:!0,onClick:()=>Ni(!1),children:"Отмена"}),s.jsx("button",{className:"btn btn--primary",onClick:()=>Ni(!0),children:"Отправить всё равно"})]}),children:[s.jsxs("p",{className:"modal__text",children:[Hh[ie.warning.limit][0].toUpperCase(),Hh[ie.warning.limit].slice(1)," использован на"," ",Math.round(ie.warning.utilization)," %, сброс в"," ",LA(ie.warning.resetsAt),". Сообщение может оборваться на полуслове, когда лимит дойдёт до 100 %."]}),s.jsx("p",{className:"modal__text modal__text--dim",children:"До сброса сессию повторно останавливать не будем."})]}),hs&&s.jsx(Mn,{title:"Прервать вход в MCP-сервер?",onClose:()=>fo(!1),actions:s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn",onClick:()=>fo(!1),children:"Отмена"}),s.jsx("button",{className:"btn btn--warn",onClick:()=>fo(!0),children:"Продолжить"})]}),children:s.jsxs("p",{className:"modal__text",children:["Идёт вход в MCP-сервер «",hs.name,"» — перезапуск процесса его прервёт. Продолжить?"]})}),z&&s.jsx(Mn,{title:"Остановить сессию?",onClose:()=>G(null),actions:s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn",onClick:()=>G(null),children:"Отмена"}),s.jsx("button",{className:"btn btn--warn",onClick:()=>{ae({type:"session.close",sessionId:z.id}),G(null)},children:"Остановить"})]}),children:s.jsx("p",{className:"modal__text",children:"Сессия сейчас работает — остановка прервёт текущий ход. Разговор останется на диске: открыть сессию заново или просто написать в неё снова можно в любой момент."})}),Zi&&s.jsxs(Mn,{title:"Переключить рабочее дерево?",onClose:()=>Yc(null),actions:s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn",onClick:()=>Yc(null),children:"Отмена"}),s.jsx("button",{className:"btn btn--warn",onClick:Au,children:"Переключиться"})]}),children:[s.jsxs("p",{className:"modal__text",children:["git переключится на ",Zi.label,". Файлы в каталоге проекта изменятся — это тот же каталог, в котором работает агент."]}),qs&&s.jsx("p",{className:"modal__text",children:"Сейчас идёт ход агента: он читает и правит файлы прямо сейчас."}),ws&&ws.changed.length>0&&s.jsxs("p",{className:"modal__text",children:["Незакоммиченных изменений: ",ws.changed.length,". Git откажется переключаться, если они будут затёрты."]})]}),nm&&s.jsx(LC,{status:Yd,owners:em,files:sm,defaultName:(hn==null?void 0:hn.name)??"",hasCommits:ws===null||ws.head!=="",busy:hu,result:fu,onRefreshStatus:nl,onSaveToken:Ya,onPublish:Ga,onDismissResult:()=>il(null),onClose:()=>Vc(!1)}),lm&&s.jsx($C,{busy:hu,result:fu,onSubmit:Ru,onDismissResult:()=>il(null),onClose:()=>Xc(!1)}),Ji&&s.jsx(Mn,{title:Ji.kind==="dir"?"Удалить каталог?":"Удалить файл?",onClose:()=>er(null),actions:s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn",onClick:()=>er(null),children:"Отмена"}),s.jsx("button",{className:"btn btn--warn",onClick:()=>xc(Ji),children:"Удалить"})]}),children:s.jsxs("p",{className:"modal__text",children:[Ji.path," будет удалён с диска",Ji.kind==="dir"?" вместе со всем содержимым":"",". Корзины здесь нет: это тот же каталог, в котором работает агент."]})}),hi&&s.jsx(Mn,{title:"Закрыть без сохранения?",onClose:()=>Pr(null),actions:s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn",onClick:()=>Pr(null),children:"Отмена"}),s.jsx("button",{className:"btn btn--warn",onClick:()=>hr(hi,!0),children:"Закрыть"}),s.jsx("button",{className:"btn btn--primary",onClick:()=>{Va(hi),hr(hi,!0)},children:"Сохранить и закрыть"})]}),children:s.jsxs("p",{className:"modal__text",children:["В ",hi," есть несохранённые правки."]})}),Se&&hn&&s.jsx(tT,{workspaceId:hn.id,workspaceName:hn.name,accountId:X==null?void 0:X.accountId,stateAccountId:ot,files:kn,file:Vn,result:Mt,send:ae,onClose:()=>{rt(!1),Ut(null),Fs(null),Rn(null),$t(null)}}),an&&s.jsx(dT,{tasks:vs,workspaces:w,activeWorkspaceId:U,send:ae,onOpenSession:ef,error:Ls,onClearError:()=>us(null),onClose:()=>{bt(!1),us(null)}}),Rt&&hn&&s.jsx(xT,{workspaceId:hn.id,workspaceName:hn.name,remote:N,reply:Zt,send:ae,hasSession:!!W,onInsertPrompt:Ia,onClose:()=>nn(!1)},hn.id),Ve&&hn&&s.jsx(ET,{workspaceId:hn.id,remote:N,catalog:Pe,studios:ju,links:ol,previews:di,mediaCache:Vd,send:ae,onRequestMedia:bo,onClose:()=>et(!1)},hn.id),Sn&&s.jsx(TT,{tab:Sn,servers:Qs,plugins:jl,marketplaces:Fn,catalog:Ca,result:Wl,auth:ns,duplicates:Wt,accounts:Un,remote:N,actions:ho,onTab:kt,onClose:()=>kt(null)}),Ul&&s.jsx($T,{accounts:Un,auth:al,logins:En,candidates:je,usage:Ce,actions:hc,onOpenLogin:mc,activeAccountId:(Yn==null?void 0:Yn.id)??null,error:ss,onReconnect:W?()=>{ko(),ks(!1)}:null,reconnectBlocked:qs,reconnectHint:gf,onClose:()=>ks(!1)}),b&&s.jsx(JT,{state:u,onPair:(h,M)=>ae({type:"relay.pair",code:h,...M?{name:M}:{}}),onUnpair:()=>ae({type:"relay.unpair"}),onClose:()=>j(!1)}),Qn&&s.jsx(jA,{settings:Ae,models:(Le==null?void 0:Le.models)??[],relayState:u,networkState:p,local:vh()==="local",onChange:pc,onEnableShell:()=>ae({type:"relay.shell.enable"}),onDisableShell:()=>ae({type:"relay.shell.disable"}),onOpenRelay:()=>{fn(!1),j(!0)},claudeLogin:{accounts:Un,auth:al,logins:En,actions:Gl,remote:N,runningByAccount:$a,focusAccountId:T},onClose:()=>{fn(!1),Z(null)}}),On&&s.jsx(oC,{candidates:yt,searching:ds,agentItems:Ks.items,agentBusy:(vl==null?void 0:vl.state)==="running",error:zs,roots:gt,created:Nt,onSearch:yi,onAskAgent:rs,onInterrupt:()=>{const h=Cs.current;h&&ae({type:"control.interrupt",sessionId:h})},onSubmit:rr,onCreate:ro,onClose:co}),en!=null&&en.questions&&en.questions.length>0?s.jsx(nC,{request:{...en,questions:en.questions},queued:ke.pending.length-1,collapsed:bc,onCollapse:()=>yc(en.requestId,!0),onAnswer:Iu,onDecline:Uu}):en&&Hu!==null?s.jsx(WE,{request:en,plan:Hu,queued:ke.pending.length-1,collapsed:bc,onCollapse:()=>yc(en.requestId,!0),onAccept:of,onDecline:uf}):en&&s.jsx(tC,{request:en,queued:ke.pending.length-1,collapsed:bc,onCollapse:()=>yc(en.requestId,!0),onDecide:vo}),ms&&s.jsx(SA,{handoff:ms,onClose:()=>ll(null)}),s.jsx(MA,{notices:la,onDismiss:h=>bn(M=>M.filter(ee=>ee.id!==h))})]})})}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:"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 fM(){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 hM(){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 mM(){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 pM(){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 gM(n,l){return Oy(n)===Oy(l)}function Oy(n){return n.replace(/[\\/]+/g,"/").replace(/\/+$/,"").toLowerCase()}function xM(){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 _M(){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 bM(){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 yM(){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 vM(){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(uM,{})}));export{HN as D,pn as I,b0 as N,kM as P,bl as T,Ze as _,Ea as a,xn as b,k0 as c,Dd as d,Ew as e,Mk as f,BN as g,ik as h,kk as i,Zl as j,wM as k,NM as l,x as m,A0 as n,s as o,Ak as p,sg as q,Rk as r,SM as s,Oe as t,C0 as u,$k as v};