@i14ks/ccv 0.48.0 → 0.50.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.
- package/bundle/ccv.mjs +403 -563
- package/package.json +1 -1
- package/web/assets/MarkdownTextEditor-DoP0b52_.js +60 -0
- package/web/assets/{abnfDiagram-S7VZAUFO-DJLBYC4E.js → abnfDiagram-S7VZAUFO-CApqnaGR.js} +1 -1
- package/web/assets/{architectureDiagram-YGSQEFNW-CjOULv4y.js → architectureDiagram-YGSQEFNW-jwCcwggk.js} +1 -1
- package/web/assets/{blockDiagram-APKKGZFW-BxtAGaqL.js → blockDiagram-APKKGZFW-Bji4PkTF.js} +1 -1
- package/web/assets/{c4Diagram-KJ2TOQU5-DixwjD35.js → c4Diagram-KJ2TOQU5-BFRf3dTO.js} +1 -1
- package/web/assets/{chunk-2Q5K7J3B-D5RSYb7c.js → chunk-2Q5K7J3B-DUFwqu3B.js} +1 -1
- package/web/assets/{chunk-5VM5RSS4-Zw9KRmHP.js → chunk-5VM5RSS4-BNCdpRtw.js} +1 -1
- package/web/assets/{chunk-HFQBQIA3-Dz3Jqjvc.js → chunk-HFQBQIA3-D8sImu8E.js} +1 -1
- package/web/assets/{chunk-JWPE2WC7-CYC8lXvq.js → chunk-JWPE2WC7-BhL2yBgo.js} +1 -1
- package/web/assets/{chunk-KQLB2F66-BpsntY2B.js → chunk-KQLB2F66-pFBglgtP.js} +2 -2
- package/web/assets/{chunk-KS47KZWR-CIw-CgK1.js → chunk-KS47KZWR-BrLOmWWS.js} +1 -1
- package/web/assets/{chunk-OY52VR5R-DyNxKUIK.js → chunk-OY52VR5R-Cgk3JXPf.js} +1 -1
- package/web/assets/{chunk-TU62E6Q5-CHgxHE0R.js → chunk-TU62E6Q5-e2yCDokg.js} +1 -1
- package/web/assets/{chunk-XXDRQBXY-CQ0zLLMg.js → chunk-XXDRQBXY-DU6jFvHG.js} +1 -1
- package/web/assets/{classDiagram-v2-L25IHNXF-DyN77x6F.js → classDiagram-v2-L25IHNXF-Bt1zi6CS.js} +1 -1
- package/web/assets/{codemirror-Dh-4cMdO.js → codemirror-CNxAt-Eg.js} +1 -1
- package/web/assets/{codemirrorImages-BHHbVBQN.js → codemirrorImages-C30a2wIG.js} +1 -1
- package/web/assets/{cose-bilkent-JH36ORCC-D1H3X9ot.js → cose-bilkent-JH36ORCC-CYITjt4m.js} +1 -1
- package/web/assets/{cynefin-EF2NZ3EQ-B4SsJI8I.js → cynefin-EF2NZ3EQ-BiYmPyip.js} +1 -1
- package/web/assets/{cynefinDiagram-L36ESFBY-D543PDJ4.js → cynefinDiagram-L36ESFBY-DiITK0W-.js} +1 -1
- package/web/assets/{dagre-SPEB5RXH-CksMpjx8.js → dagre-SPEB5RXH-BnOvnJrY.js} +1 -1
- package/web/assets/{diagram-3B7GL73J-DywKf_aW.js → diagram-3B7GL73J-DnFw5yRA.js} +1 -1
- package/web/assets/{diagram-DNEMPZML-QaEKUl5W.js → diagram-DNEMPZML-CLe-W-8E.js} +1 -1
- package/web/assets/{diagram-L3MUGCDN-51y_ny8R.js → diagram-L3MUGCDN-xhFV1YT8.js} +1 -1
- package/web/assets/{diagram-LA4NIPWU-Cg_nbBL_.js → diagram-LA4NIPWU-S58Cgi0K.js} +1 -1
- package/web/assets/{diagram-MHCOC4E2-DFHCPZYb.js → diagram-MHCOC4E2-fbSbD-Tu.js} +1 -1
- package/web/assets/{diagram-XPFHEONP-dBKRRNZa.js → diagram-XPFHEONP-C3K_xR1q.js} +1 -1
- package/web/assets/{ebnfDiagram-UZSYDL2S-BwTgNIAm.js → ebnfDiagram-UZSYDL2S-BG_udZa4.js} +1 -1
- package/web/assets/{elk-XV6XMXQE-BR-xb3ob.js → elk-XV6XMXQE-DE6K1qve.js} +1 -1
- package/web/assets/{erDiagram-EYBAPDEH-BB1wg_fV.js → erDiagram-EYBAPDEH-xkeusKpC.js} +1 -1
- package/web/assets/{flowDiagram-MALGAFMO-CRDw4nX3.js → flowDiagram-MALGAFMO-OisK-T0f.js} +1 -1
- package/web/assets/{ganttDiagram-23REXITY-MYQEYJ-I.js → ganttDiagram-23REXITY-DmQVS3ZV.js} +1 -1
- package/web/assets/{gitGraphDiagram-STJD7YCW-Dhn0_pRI.js → gitGraphDiagram-STJD7YCW-Cll-SkVb.js} +1 -1
- package/web/assets/{index-DRJgyVu5.js → index-B2l2owfY.js} +1 -1
- package/web/assets/{index-BJdwUs7I.js → index-BTQSusTZ.js} +1 -1
- package/web/assets/{index-Bod45-bM.js → index-B_jwjnO_.js} +1 -1
- package/web/assets/{index-v-BrSiuM.js → index-Bta4Smbo.js} +1 -1
- package/web/assets/{index-CaL1Ugw4.js → index-BzBiXh1K.js} +1 -1
- package/web/assets/index-C0GRVSmD.css +1 -0
- package/web/assets/{index-7ivf0ID5.js → index-CJzQgsOc.js} +1 -1
- package/web/assets/index-CM1F7OtV.js +172 -0
- package/web/assets/{index-BJHr8-zK.js → index-CUm9rUfI.js} +1 -1
- package/web/assets/{index-DIouQVG8.js → index-CXbAKkq5.js} +1 -1
- package/web/assets/{index-DaBTH0ea.js → index-CYTyvY7n.js} +1 -1
- package/web/assets/{index-DqLAItfN.js → index-CcKihMD9.js} +1 -1
- package/web/assets/{index-DtR2v4RD.js → index-CkV2xkfY.js} +1 -1
- package/web/assets/{index-BLLxsupM.js → index-CkpIGiUh.js} +1 -1
- package/web/assets/{index-BK9FAkRg.js → index-D5xJiVmD.js} +1 -1
- package/web/assets/{index-Cbs1XkJa.js → index-DM3T56Jf.js} +1 -1
- package/web/assets/{index-C13EW7hw.js → index-DXCiYt0O.js} +1 -1
- package/web/assets/{index-DtwnaAnT.js → index-Zq9V5ZB9.js} +1 -1
- package/web/assets/{index-DqxhStF7.js → index-cu8Fcww3.js} +1 -1
- package/web/assets/{index-CE1Pd4z7.js → index-fF3dLvWP.js} +1 -1
- package/web/assets/{index-DlMbLAnE.js → index-qOoKNKZw.js} +1 -1
- package/web/assets/{infoDiagram-KBXO4MBG-By-j1Q2z.js → infoDiagram-KBXO4MBG-CFnvxUDW.js} +1 -1
- package/web/assets/{ishikawaDiagram-M35NCXHK-Cj7pfKCW.js → ishikawaDiagram-M35NCXHK-CjJXkiZb.js} +1 -1
- package/web/assets/{journeyDiagram-OPLOXDXO-B7acuJLi.js → journeyDiagram-OPLOXDXO-CYBHLPC5.js} +1 -1
- package/web/assets/{kanban-definition-BZKZHSQY-B0N1FM8N.js → kanban-definition-BZKZHSQY-BzNwzCFX.js} +1 -1
- package/web/assets/{mermaid.core-Rt-JZroF.js → mermaid.core-CFBl9TP8.js} +4 -4
- package/web/assets/{mindmap-definition-I2QAS2VK-Du6Bq1D4.js → mindmap-definition-I2QAS2VK-X8WzviFV.js} +1 -1
- package/web/assets/{pegDiagram-FD4XPPHP-Cx3y_VAW.js → pegDiagram-FD4XPPHP-kvO-a_98.js} +1 -1
- package/web/assets/{pieDiagram-J4AKIIQI-DrpfcCiI.js → pieDiagram-J4AKIIQI-BEiN8l-e.js} +1 -1
- package/web/assets/{quadrantDiagram-XTYBLID2-BbJ2d8x8.js → quadrantDiagram-XTYBLID2-Cf-t2xpS.js} +1 -1
- package/web/assets/{railroadDiagram-MRQ6NCDL-C8B9eHMq.js → railroadDiagram-MRQ6NCDL-Bou3xfYm.js} +1 -1
- package/web/assets/{requirementDiagram-Y7LWUY3S--8FcyGsP.js → requirementDiagram-Y7LWUY3S-Ch1ghejU.js} +1 -1
- package/web/assets/{sankeyDiagram-WGJFYUXA-CYq-mQmD.js → sankeyDiagram-WGJFYUXA-DCjH5hxL.js} +1 -1
- package/web/assets/{sequenceDiagram-5NDRBG5M-C-Llg4wI.js → sequenceDiagram-5NDRBG5M-DrspJAAy.js} +1 -1
- package/web/assets/{sizeCapture-INFHLROL-80lnJyWe.js → sizeCapture-INFHLROL-BpOJNwe1.js} +1 -1
- package/web/assets/{stateDiagram-v2-FJ4FJNEA-QZyfUycB.js → stateDiagram-v2-FJ4FJNEA-RkYUtnsy.js} +1 -1
- package/web/assets/{swimlanes-UMQ2AFYF-BxT8Ql8H.js → swimlanes-UMQ2AFYF-BR4cicEg.js} +1 -1
- package/web/assets/swimlanesDiagram-OMPLPG4O-DGwvhioW.js +8 -0
- package/web/assets/{timeline-definition-SEUHKTQE-DWywP4r0.js → timeline-definition-SEUHKTQE-Bq2VoDLH.js} +1 -1
- package/web/assets/{usecaseDiagram-AFA6YXN4-BgmSQD90.js → usecaseDiagram-AFA6YXN4-BsB6aBKf.js} +1 -1
- package/web/assets/{vennDiagram-NNMJR3RB-B9ikZp8F.js → vennDiagram-NNMJR3RB-8pOZirDr.js} +1 -1
- package/web/assets/{wardleyDiagram-S7YFUSEH-CptNVfVi.js → wardleyDiagram-S7YFUSEH-Dx-je9ls.js} +1 -1
- package/web/assets/{xychartDiagram-GGNKY7IX-DV4TDhUT.js → xychartDiagram-GGNKY7IX-mpETY7ui.js} +1 -1
- package/web/index.html +2 -2
- package/web/assets/MarkdownTextEditor-B3B8_rFw.js +0 -60
- package/web/assets/index-eIS20v-m.css +0 -1
- package/web/assets/index-gy3hTMSD.js +0 -167
- package/web/assets/swimlanesDiagram-OMPLPG4O-BZDLC88s.js +0 -8
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-CkpIGiUh.js","./index-BTQSusTZ.js","./index-CJzQgsOc.js","./index-BHot-lnj.js","./index-PAORgBv5.js","./index-Vcq4gwWv.js","./index-BzBiXh1K.js","./index-CXbAKkq5.js","./index-cu8Fcww3.js","./index-CcKihMD9.js","./index-qOoKNKZw.js","./index-DXCiYt0O.js","./index-D5xJiVmD.js","./index-DM3T56Jf.js","./index-CYTyvY7n.js","./index-Bta4Smbo.js","./index-fF3dLvWP.js","./index-B2l2owfY.js","./index-B_jwjnO_.js","./index-CkV2xkfY.js","./index-Zq9V5ZB9.js","./index-CUm9rUfI.js","./codemirror-CNxAt-Eg.js","./codemirrorImages-C30a2wIG.js","./katex-DxB02YXk.css","./mermaid.core-CFBl9TP8.js","./_commonjsHelpers-CqkleIqs.js","./MarkdownTextEditor-DoP0b52_.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 Xj=Object.defineProperty;var G_=n=>{throw TypeError(n)};var Kj=(n,l,i)=>l in n?Xj(n,l,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[l]=i;var Jt=(n,l,i)=>Kj(n,typeof l!="symbol"?l+"":l,i),_p=(n,l,i)=>l.has(n)||G_("Cannot "+i);var lt=(n,l,i)=>(_p(n,l,"read from private field"),i?i.call(n):l.get(n)),Ln=(n,l,i)=>l.has(n)?G_("Cannot add the same private member more than once"):l instanceof WeakSet?l.add(n):l.set(n,i),qt=(n,l,i,r)=>(_p(n,l,"write to private field"),r?r.call(n,i):l.set(n,i),i),Jn=(n,l,i)=>(_p(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 f of u.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&r(f)}).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 bp={exports:{}},_d={};/**
|
|
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 Y_;function Qj(){if(Y_)return _d;Y_=1;var n=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function i(r,o,u){var f=null;if(u!==void 0&&(f=""+u),o.key!==void 0&&(f=""+o.key),"key"in o){u={};for(var g in o)g!=="key"&&(u[g]=o[g])}else u=o;return o=u.ref,{$$typeof:n,type:r,key:f,ref:o!==void 0?o:null,props:u}}return _d.Fragment=l,_d.jsx=i,_d.jsxs=i,_d}var V_;function Pj(){return V_||(V_=1,bp.exports=Qj()),bp.exports}var s=Pj(),yp={exports:{}},ut={};/**
|
|
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 F_;function Zj(){if(F_)return ut;F_=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"),f=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),_=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),j=Symbol.for("react.activity"),N=Symbol.iterator;function k(A){return A===null||typeof A!="object"?null:(A=N&&A[N]||A["@@iterator"],typeof A=="function"?A:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,C={};function T(A,V,U){this.props=A,this.context=V,this.refs=C,this.updater=U||w}T.prototype.isReactComponent={},T.prototype.setState=function(A,V){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,V,"setState")},T.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function z(){}z.prototype=T.prototype;function q(A,V,U){this.props=A,this.context=V,this.refs=C,this.updater=U||w}var te=q.prototype=new z;te.constructor=q,E(te,T.prototype),te.isPureReactComponent=!0;var I=Array.isArray;function R(){}var $={H:null,A:null,T:null,S:null},Q=Object.prototype.hasOwnProperty;function ee(A,V,U){var be=U.ref;return{$$typeof:n,type:A,key:V,ref:be!==void 0?be:null,props:U}}function G(A,V){return ee(A.type,V,A.props)}function B(A){return typeof A=="object"&&A!==null&&A.$$typeof===n}function F(A){var V={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(U){return V[U]})}var le=/\/+/g;function ue(A,V){return typeof A=="object"&&A!==null&&A.key!=null?F(""+A.key):V.toString(36)}function ce(A){switch(A.status){case"fulfilled":return A.value;case"rejected":throw A.reason;default:switch(typeof A.status=="string"?A.then(R,R):(A.status="pending",A.then(function(V){A.status==="pending"&&(A.status="fulfilled",A.value=V)},function(V){A.status==="pending"&&(A.status="rejected",A.reason=V)})),A.status){case"fulfilled":return A.value;case"rejected":throw A.reason}}throw A}function D(A,V,U,be,P){var ie=typeof A;(ie==="undefined"||ie==="boolean")&&(A=null);var Me=!1;if(A===null)Me=!0;else switch(ie){case"bigint":case"string":case"number":Me=!0;break;case"object":switch(A.$$typeof){case n:case l:Me=!0;break;case b:return Me=A._init,D(Me(A._payload),V,U,be,P)}}if(Me)return P=P(A),Me=be===""?"."+ue(A,0):be,I(P)?(U="",Me!=null&&(U=Me.replace(le,"$&/")+"/"),D(P,V,U,"",function(Be){return Be})):P!=null&&(B(P)&&(P=G(P,U+(P.key==null||A&&A.key===P.key?"":(""+P.key).replace(le,"$&/")+"/")+Me)),V.push(P)),1;Me=0;var Ke=be===""?".":be+":";if(I(A))for(var Ne=0;Ne<A.length;Ne++)be=A[Ne],ie=Ke+ue(be,Ne),Me+=D(be,V,U,ie,P);else if(Ne=k(A),typeof Ne=="function")for(A=Ne.call(A),Ne=0;!(be=A.next()).done;)be=be.value,ie=Ke+ue(be,Ne++),Me+=D(be,V,U,ie,P);else if(ie==="object"){if(typeof A.then=="function")return D(ce(A),V,U,be,P);throw V=String(A),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return Me}function O(A,V,U){if(A==null)return A;var be=[],P=0;return D(A,be,"","",function(ie){return V.call(U,ie,P++)}),be}function H(A){if(A._status===-1){var V=A._result;V=V(),V.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=V)}if(A._status===1)return A._result.default;throw A._result}var J=typeof reportError=="function"?reportError:function(A){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=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(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",A);return}console.error(A)},re={map:O,forEach:function(A,V,U){O(A,function(){V.apply(this,arguments)},U)},count:function(A){var V=0;return O(A,function(){V++}),V},toArray:function(A){return O(A,function(V){return V})||[]},only:function(A){if(!B(A))throw Error("React.Children.only expected to receive a single React element child.");return A}};return ut.Activity=j,ut.Children=re,ut.Component=T,ut.Fragment=i,ut.Profiler=o,ut.PureComponent=q,ut.StrictMode=r,ut.Suspense=x,ut.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=$,ut.__COMPILER_RUNTIME={__proto__:null,c:function(A){return $.H.useMemoCache(A)}},ut.cache=function(A){return function(){return A.apply(null,arguments)}},ut.cacheSignal=function(){return null},ut.cloneElement=function(A,V,U){if(A==null)throw Error("The argument must be a React element, but you passed "+A+".");var be=E({},A.props),P=A.key;if(V!=null)for(ie in V.key!==void 0&&(P=""+V.key),V)!Q.call(V,ie)||ie==="key"||ie==="__self"||ie==="__source"||ie==="ref"&&V.ref===void 0||(be[ie]=V[ie]);var ie=arguments.length-2;if(ie===1)be.children=U;else if(1<ie){for(var Me=Array(ie),Ke=0;Ke<ie;Ke++)Me[Ke]=arguments[Ke+2];be.children=Me}return ee(A.type,P,be)},ut.createContext=function(A){return A={$$typeof:f,_currentValue:A,_currentValue2:A,_threadCount:0,Provider:null,Consumer:null},A.Provider=A,A.Consumer={$$typeof:u,_context:A},A},ut.createElement=function(A,V,U){var be,P={},ie=null;if(V!=null)for(be in V.key!==void 0&&(ie=""+V.key),V)Q.call(V,be)&&be!=="key"&&be!=="__self"&&be!=="__source"&&(P[be]=V[be]);var Me=arguments.length-2;if(Me===1)P.children=U;else if(1<Me){for(var Ke=Array(Me),Ne=0;Ne<Me;Ne++)Ke[Ne]=arguments[Ne+2];P.children=Ke}if(A&&A.defaultProps)for(be in Me=A.defaultProps,Me)P[be]===void 0&&(P[be]=Me[be]);return ee(A,ie,P)},ut.createRef=function(){return{current:null}},ut.forwardRef=function(A){return{$$typeof:g,render:A}},ut.isValidElement=B,ut.lazy=function(A){return{$$typeof:b,_payload:{_status:-1,_result:A},_init:H}},ut.memo=function(A,V){return{$$typeof:_,type:A,compare:V===void 0?null:V}},ut.startTransition=function(A){var V=$.T,U={};$.T=U;try{var be=A(),P=$.S;P!==null&&P(U,be),typeof be=="object"&&be!==null&&typeof be.then=="function"&&be.then(R,J)}catch(ie){J(ie)}finally{V!==null&&U.types!==null&&(V.types=U.types),$.T=V}},ut.unstable_useCacheRefresh=function(){return $.H.useCacheRefresh()},ut.use=function(A){return $.H.use(A)},ut.useActionState=function(A,V,U){return $.H.useActionState(A,V,U)},ut.useCallback=function(A,V){return $.H.useCallback(A,V)},ut.useContext=function(A){return $.H.useContext(A)},ut.useDebugValue=function(){},ut.useDeferredValue=function(A,V){return $.H.useDeferredValue(A,V)},ut.useEffect=function(A,V){return $.H.useEffect(A,V)},ut.useEffectEvent=function(A){return $.H.useEffectEvent(A)},ut.useId=function(){return $.H.useId()},ut.useImperativeHandle=function(A,V,U){return $.H.useImperativeHandle(A,V,U)},ut.useInsertionEffect=function(A,V){return $.H.useInsertionEffect(A,V)},ut.useLayoutEffect=function(A,V){return $.H.useLayoutEffect(A,V)},ut.useMemo=function(A,V){return $.H.useMemo(A,V)},ut.useOptimistic=function(A,V){return $.H.useOptimistic(A,V)},ut.useReducer=function(A,V,U){return $.H.useReducer(A,V,U)},ut.useRef=function(A){return $.H.useRef(A)},ut.useState=function(A){return $.H.useState(A)},ut.useSyncExternalStore=function(A,V,U){return $.H.useSyncExternalStore(A,V,U)},ut.useTransition=function(){return $.H.useTransition()},ut.version="19.2.8",ut}var X_;function Mg(){return X_||(X_=1,yp.exports=Zj()),yp.exports}var p=Mg(),vp={exports:{}},bd={},jp={exports:{}},Np={};/**
|
|
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 K_;function Wj(){return K_||(K_=1,(function(n){function l(D,O){var H=D.length;D.push(O);e:for(;0<H;){var J=H-1>>>1,re=D[J];if(0<o(re,O))D[J]=O,D[H]=re,H=J;else break e}}function i(D){return D.length===0?null:D[0]}function r(D){if(D.length===0)return null;var O=D[0],H=D.pop();if(H!==O){D[0]=H;e:for(var J=0,re=D.length,A=re>>>1;J<A;){var V=2*(J+1)-1,U=D[V],be=V+1,P=D[be];if(0>o(U,H))be<re&&0>o(P,U)?(D[J]=P,D[be]=H,J=be):(D[J]=U,D[V]=H,J=V);else if(be<re&&0>o(P,H))D[J]=P,D[be]=H,J=be;else break e}}return O}function o(D,O){var H=D.sortIndex-O.sortIndex;return H!==0?H:D.id-O.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;n.unstable_now=function(){return u.now()}}else{var f=Date,g=f.now();n.unstable_now=function(){return f.now()-g}}var x=[],_=[],b=1,j=null,N=3,k=!1,w=!1,E=!1,C=!1,T=typeof setTimeout=="function"?setTimeout:null,z=typeof clearTimeout=="function"?clearTimeout:null,q=typeof setImmediate<"u"?setImmediate:null;function te(D){for(var O=i(_);O!==null;){if(O.callback===null)r(_);else if(O.startTime<=D)r(_),O.sortIndex=O.expirationTime,l(x,O);else break;O=i(_)}}function I(D){if(E=!1,te(D),!w)if(i(x)!==null)w=!0,R||(R=!0,F());else{var O=i(_);O!==null&&ce(I,O.startTime-D)}}var R=!1,$=-1,Q=5,ee=-1;function G(){return C?!0:!(n.unstable_now()-ee<Q)}function B(){if(C=!1,R){var D=n.unstable_now();ee=D;var O=!0;try{e:{w=!1,E&&(E=!1,z($),$=-1),k=!0;var H=N;try{t:{for(te(D),j=i(x);j!==null&&!(j.expirationTime>D&&G());){var J=j.callback;if(typeof J=="function"){j.callback=null,N=j.priorityLevel;var re=J(j.expirationTime<=D);if(D=n.unstable_now(),typeof re=="function"){j.callback=re,te(D),O=!0;break t}j===i(x)&&r(x),te(D)}else r(x);j=i(x)}if(j!==null)O=!0;else{var A=i(_);A!==null&&ce(I,A.startTime-D),O=!1}}break e}finally{j=null,N=H,k=!1}O=void 0}}finally{O?F():R=!1}}}var F;if(typeof q=="function")F=function(){q(B)};else if(typeof MessageChannel<"u"){var le=new MessageChannel,ue=le.port2;le.port1.onmessage=B,F=function(){ue.postMessage(null)}}else F=function(){T(B,0)};function ce(D,O){$=T(function(){D(n.unstable_now())},O)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(D){D.callback=null},n.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Q=0<D?Math.floor(1e3/D):5},n.unstable_getCurrentPriorityLevel=function(){return N},n.unstable_next=function(D){switch(N){case 1:case 2:case 3:var O=3;break;default:O=N}var H=N;N=O;try{return D()}finally{N=H}},n.unstable_requestPaint=function(){C=!0},n.unstable_runWithPriority=function(D,O){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var H=N;N=D;try{return O()}finally{N=H}},n.unstable_scheduleCallback=function(D,O,H){var J=n.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?J+H:J):H=J,D){case 1:var re=-1;break;case 2:re=250;break;case 5:re=1073741823;break;case 4:re=1e4;break;default:re=5e3}return re=H+re,D={id:b++,callback:O,priorityLevel:D,startTime:H,expirationTime:re,sortIndex:-1},H>J?(D.sortIndex=H,l(_,D),i(x)===null&&D===i(_)&&(E?(z($),$=-1):E=!0,ce(I,H-J))):(D.sortIndex=re,l(x,D),w||k||(w=!0,R||(R=!0,F()))),D},n.unstable_shouldYield=G,n.unstable_wrapCallback=function(D){var O=N;return function(){var H=N;N=O;try{return D.apply(this,arguments)}finally{N=H}}}})(Np)),Np}var Q_;function Jj(){return Q_||(Q_=1,jp.exports=Wj()),jp.exports}var kp={exports:{}},Is={};/**
|
|
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 P_;function eN(){if(P_)return Is;P_=1;var n=Mg();function l(x){var _="https://react.dev/errors/"+x;if(1<arguments.length){_+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)_+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+x+"; 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(x,_,b){var j=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:j==null?null:""+j,children:x,containerInfo:_,implementation:b}}var f=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function g(x,_){if(x==="font")return"";if(typeof _=="string")return _==="use-credentials"?_:""}return Is.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Is.createPortal=function(x,_){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(x,_,null,b)},Is.flushSync=function(x){var _=f.T,b=r.p;try{if(f.T=null,r.p=2,x)return x()}finally{f.T=_,r.p=b,r.d.f()}},Is.preconnect=function(x,_){typeof x=="string"&&(_?(_=_.crossOrigin,_=typeof _=="string"?_==="use-credentials"?_:"":void 0):_=null,r.d.C(x,_))},Is.prefetchDNS=function(x){typeof x=="string"&&r.d.D(x)},Is.preinit=function(x,_){if(typeof x=="string"&&_&&typeof _.as=="string"){var b=_.as,j=g(b,_.crossOrigin),N=typeof _.integrity=="string"?_.integrity:void 0,k=typeof _.fetchPriority=="string"?_.fetchPriority:void 0;b==="style"?r.d.S(x,typeof _.precedence=="string"?_.precedence:void 0,{crossOrigin:j,integrity:N,fetchPriority:k}):b==="script"&&r.d.X(x,{crossOrigin:j,integrity:N,fetchPriority:k,nonce:typeof _.nonce=="string"?_.nonce:void 0})}},Is.preinitModule=function(x,_){if(typeof x=="string")if(typeof _=="object"&&_!==null){if(_.as==null||_.as==="script"){var b=g(_.as,_.crossOrigin);r.d.M(x,{crossOrigin:b,integrity:typeof _.integrity=="string"?_.integrity:void 0,nonce:typeof _.nonce=="string"?_.nonce:void 0})}}else _==null&&r.d.M(x)},Is.preload=function(x,_){if(typeof x=="string"&&typeof _=="object"&&_!==null&&typeof _.as=="string"){var b=_.as,j=g(b,_.crossOrigin);r.d.L(x,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})}},Is.preloadModule=function(x,_){if(typeof x=="string")if(_){var b=g(_.as,_.crossOrigin);r.d.m(x,{as:typeof _.as=="string"&&_.as!=="script"?_.as:void 0,crossOrigin:b,integrity:typeof _.integrity=="string"?_.integrity:void 0})}else r.d.m(x)},Is.requestFormReset=function(x){r.d.r(x)},Is.unstable_batchedUpdates=function(x,_){return x(_)},Is.useFormState=function(x,_,b){return f.H.useFormState(x,_,b)},Is.useFormStatus=function(){return f.H.useHostTransitionStatus()},Is.version="19.2.8",Is}var Z_;function Zy(){if(Z_)return kp.exports;Z_=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(),kp.exports=eN(),kp.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 W_;function tN(){if(W_)return bd;W_=1;var n=Jj(),l=Mg(),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 f(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 g(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 x(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 h=d.alternate;if(h===null){if(c=d.return,c!==null){a=c;continue}break}if(d.child===h.child){for(h=d.child;h;){if(h===a)return x(d),e;if(h===c)return x(d),t;h=h.sibling}throw Error(r(188))}if(a.return!==c.return)a=d,c=h;else{for(var v=!1,S=d.child;S;){if(S===a){v=!0,a=d,c=h;break}if(S===c){v=!0,c=d,a=h;break}S=S.sibling}if(!v){for(S=h.child;S;){if(S===a){v=!0,a=h,c=d;break}if(S===c){v=!0,c=h,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"),k=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),z=Symbol.for("react.consumer"),q=Symbol.for("react.context"),te=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),Q=Symbol.for("react.lazy"),ee=Symbol.for("react.activity"),G=Symbol.for("react.memo_cache_sentinel"),B=Symbol.iterator;function F(e){return e===null||typeof e!="object"?null:(e=B&&e[B]||e["@@iterator"],typeof e=="function"?e:null)}var le=Symbol.for("react.client.reference");function ue(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===le?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case E:return"Fragment";case T:return"Profiler";case C:return"StrictMode";case I:return"Suspense";case R:return"SuspenseList";case ee:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case w:return"Portal";case q:return e.displayName||"Context";case z: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:ue(e.type)||"Memo";case Q:t=e._payload,e=e._init;try{return ue(e(t))}catch{}}return null}var ce=Array.isArray,D=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H={pending:!1,data:null,method:null,action:null},J=[],re=-1;function A(e){return{current:e}}function V(e){0>re||(e.current=J[re],J[re]=null,re--)}function U(e,t){re++,J[re]=e.current,e.current=t}var be=A(null),P=A(null),ie=A(null),Me=A(null);function Ke(e,t){switch(U(ie,t),U(P,e),U(be,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?f_(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=f_(t),e=h_(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}V(be),U(be,e)}function Ne(){V(be),V(P),V(ie)}function Be(e){e.memoizedState!==null&&U(Me,e);var t=be.current,a=h_(t,e.type);t!==a&&(U(P,e),U(be,a))}function Xe(e){P.current===e&&(V(be),V(P)),Me.current===e&&(V(Me),md._currentValue=H)}var Ze,an;function We(e){if(Ze===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);Ze=t&&t[1]||"",an=-1<a.stack.indexOf(`
|
|
43
|
+
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
+
`+Ze+e+an}var Bt=!1;function Ye(e,t){if(!e||Bt)return"";Bt=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(t){var Ee=function(){throw Error()};if(Object.defineProperty(Ee.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ee,[])}catch(pe){var he=pe}Reflect.construct(e,[],Ee)}else{try{Ee.call()}catch(pe){he=pe}e.call(Ee.prototype)}}else{try{throw Error()}catch(pe){he=pe}(Ee=e())&&typeof Ee.catch=="function"&&Ee.catch(function(){})}}catch(pe){if(pe&&he&&typeof pe.stack=="string")return[pe.stack,he.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 h=c.DetermineComponentFrameRoot(),v=h[0],S=h[1];if(v&&S){var Y=v.split(`
|
|
45
|
+
`),fe=S.split(`
|
|
46
|
+
`);for(d=c=0;c<Y.length&&!Y[c].includes("DetermineComponentFrameRoot");)c++;for(;d<fe.length&&!fe[d].includes("DetermineComponentFrameRoot");)d++;if(c===Y.length||d===fe.length)for(c=Y.length-1,d=fe.length-1;1<=c&&0<=d&&Y[c]!==fe[d];)d--;for(;1<=c&&0<=d;c--,d--)if(Y[c]!==fe[d]){if(c!==1||d!==1)do if(c--,d--,0>d||Y[c]!==fe[d]){var je=`
|
|
47
|
+
`+Y[c].replace(" at new "," at ");return e.displayName&&je.includes("<anonymous>")&&(je=je.replace("<anonymous>",e.displayName)),je}while(1<=c&&0<=d);break}}}finally{Bt=!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 Ye(e.type,!1);case 11:return Ye(e.type.render,!1);case 1:return Ye(e.type,!0);case 31:return We("Activity");default:return""}}function xe(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 $e=Object.prototype.hasOwnProperty,ye=n.unstable_scheduleCallback,Qe=n.unstable_cancelCallback,rn=n.unstable_shouldYield,kt=n.unstable_requestPaint,ht=n.unstable_now,_s=n.unstable_getCurrentPriorityLevel,On=n.unstable_ImmediatePriority,fn=n.unstable_UserBlockingPriority,Mt=n.unstable_NormalPriority,zt=n.unstable_LowPriority,Ce=n.unstable_IdlePriority,Te=n.log,Ie=n.unstable_setDisableYieldValue,st=null,_t=null;function bt(e){if(typeof Te=="function"&&Ie(e),_t&&typeof _t.setStrictMode=="function")try{_t.setStrictMode(st,e)}catch{}}var yt=Math.clz32?Math.clz32:Ae,zn=Math.log,_e=Math.LN2;function Ae(e){return e>>>=0,e===0?32:31-(zn(e)/_e|0)|0}var Je=256,rt=262144,it=4194304;function en(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 dt(e,t,a){var c=e.pendingLanes;if(c===0)return 0;var d=0,h=e.suspendedLanes,v=e.pingedLanes;e=e.warmLanes;var S=c&134217727;return S!==0?(c=S&~h,c!==0?d=en(c):(v&=S,v!==0?d=en(v):a||(a=S&~e,a!==0&&(d=en(a))))):(S=c&~h,S!==0?d=en(S):v!==0?d=en(v):a||(a=c&~e,a!==0&&(d=en(a)))),d===0?0:t!==0&&t!==d&&(t&h)===0&&(h=d&-d,a=t&-t,h>=a||h===32&&(a&4194048)!==0)?t:d}function gt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function bs(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 In(){var e=it;return it<<=1,(it&62914560)===0&&(it=4194304),e}function As(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function cs(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Cn(e,t,a,c,d,h){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,Y=e.expirationTimes,fe=e.hiddenUpdates;for(a=v&~a;0<a;){var je=31-yt(a),Ee=1<<je;S[je]=0,Y[je]=-1;var he=fe[je];if(he!==null)for(fe[je]=null,je=0;je<he.length;je++){var pe=he[je];pe!==null&&(pe.lane&=-536870913)}a&=~Ee}c!==0&&$n(e,c,0),h!==0&&d===0&&e.tag!==0&&(e.suspendedLanes|=h&~(v&~t))}function $n(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var c=31-yt(t);e.entangledLanes|=t,e.entanglements[c]=e.entanglements[c]|1073741824|a&261930}function Ms(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var c=31-yt(a),d=1<<c;d&t|e[c]&t&&(e[c]|=t),a&=~d}}function cn(e,t){var a=t&-t;return a=(a&42)!==0?1:hn(a),(a&(e.suspendedLanes|t))!==0?0:a}function hn(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 ns(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function mn(){var e=O.p;return e!==0?e:(e=window.event,e===void 0?32:z_(e.type))}function Un(e,t){var a=O.p;try{return O.p=e,t()}finally{O.p=a}}var pn=Math.random().toString(36).slice(2),Tt="__reactFiber$"+pn,gn="__reactProps$"+pn,os="__reactContainer$"+pn,us="__reactEvents$"+pn,Hs="__reactListeners$"+pn,xl="__reactHandles$"+pn,_l="__reactResources$"+pn,At="__reactMarker$"+pn;function Rs(e){delete e[Tt],delete e[gn],delete e[us],delete e[Hs],delete e[xl]}function Bn(e){var t=e[Tt];if(t)return t;for(var a=e.parentNode;a;){if(t=a[os]||a[Tt]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=y_(e);e!==null;){if(a=e[Tt])return a;e=y_(e)}return t}e=a,a=e.parentNode}return null}function K(e){if(e=e[Tt]||e[os]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ge(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(r(33))}function Re(e){var t=e[_l];return t||(t=e[_l]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function He(e){e[At]=!0}var wt=new Set,on={};function Dt(e,t){Hn(e,t),Hn(e+"Capture",t)}function Hn(e,t){for(on[e]=t,e=0;e<t.length;e++)wt.add(t[e])}var Tn=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]*$"),Lt={},qs={};function xn(e){return $e.call(qs,e)?!0:$e.call(Lt,e)?!1:Tn.test(e)?qs[e]=!0:(Lt[e]=!0,!1)}function bl(e,t,a){if(xn(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 yl(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 Qn(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 Xt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ta(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ys(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,h=c.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return d.call(this)},set:function(v){a=""+v,h.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 Zl(e){if(!e._valueTracker){var t=Ta(e)?"checked":"value";e._valueTracker=ys(e,t,""+e[t])}}function vs(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),c="";return e&&(c=Ta(e)?e.checked?"true":"false":e.value),e=c,e!==a?(t.setValue(e),!0):!1}function ss(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 tl=/[\n"\\]/g;function tn(e){return e.replace(tl,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Gs(e,t,a,c,d,h,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=""+Xt(t)):e.value!==""+Xt(t)&&(e.value=""+Xt(t)):v!=="submit"&&v!=="reset"||e.removeAttribute("value"),t!=null?Wl(e,v,Xt(t)):a!=null?Wl(e,v,Xt(a)):c!=null&&e.removeAttribute("value"),d==null&&h!=null&&(e.defaultChecked=!!h),d!=null&&(e.checked=d&&typeof d!="function"&&typeof d!="symbol"),S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?e.name=""+Xt(S):e.removeAttribute("name")}function ui(e,t,a,c,d,h,v,S){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.type=h),t!=null||a!=null){if(!(h!=="submit"&&h!=="reset"||t!=null)){Zl(e);return}a=a!=null?""+Xt(a):"",t=t!=null?""+Xt(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),Zl(e)}function Wl(e,t,a){t==="number"&&ss(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function ds(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=""+Xt(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 Jl(e,t,a){if(t!=null&&(t=""+Xt(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+Xt(a):""}function ea(e,t,a,c){if(t==null){if(c!=null){if(a!=null)throw Error(r(92));if(ce(c)){if(1<c.length)throw Error(r(93));c=c[0]}a=c}a==null&&(a=""),t=a}a=Xt(t),e.defaultValue=a,c=e.textContent,c===a&&c!==""&&c!==null&&(e.value=c),Zl(e)}function Ys(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var fs=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 nl(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||fs.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function Pn(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&&nl(e,d,c)}else for(var h in t)t.hasOwnProperty(h)&&nl(e,h,t[h])}function ta(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 Rl=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"]]),Zi=/^[\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 na(e){return Zi.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function xt(){}var sa=null;function Nn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Dl=null,js=null;function qn(e){var t=K(e);if(t&&(e=t.stateNode)){var a=e[gn]||null;e:switch(e=t.stateNode,t.type){case"input":if(Gs(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="'+tn(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var c=a[t];if(c!==e&&c.form===e.form){var d=c[gn]||null;if(!d)throw Error(r(90));Gs(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&&vs(c)}break e;case"textarea":Jl(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&ds(e,!!a.multiple,t,!1)}}}var di=!1;function sl(e,t,a){if(di)return e(t,a);di=!0;try{var c=e(t);return c}finally{if(di=!1,(Dl!==null||js!==null)&&(Uf(),Dl&&(t=Dl,e=js,js=Dl=null,qn(t),e)))for(t=0;t<e.length;t++)qn(e[t])}}function Vs(e,t){var a=e.stateNode;if(a===null)return null;var c=a[gn]||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 ls=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),hs=!1;if(ls)try{var Se={};Object.defineProperty(Se,"passive",{get:function(){hs=!0}}),window.addEventListener("test",Se,Se),window.removeEventListener("test",Se,Se)}catch{hs=!1}var y=null,M=null,Z=null;function oe(){if(Z)return Z;var e,t=M,a=t.length,c,d="value"in y?y.value:y.textContent,h=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[h-c];c++);return Z=d.slice(e,1<c?1-c:void 0)}function Oe(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 Le(){return!0}function tt(){return!1}function vt(e){function t(a,c,d,h,v){this._reactName=a,this._targetInst=d,this.type=c,this.nativeEvent=h,this.target=v,this.currentTarget=null;for(var S in e)e.hasOwnProperty(S)&&(a=e[S],this[S]=a?a(h):h[S]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?Le:tt,this.isPropagationStopped=tt,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=Le)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Le)},persist:function(){},isPersistent:Le}),t}var Zn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},_n=vt(Zn),An=j({},Zn,{view:0,detail:0}),Aa=vt(An),Yt,Wi,Fn,Zr=j({},An,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:er,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!==Fn&&(Fn&&e.type==="mousemove"?(Yt=e.screenX-Fn.screenX,Wi=e.screenY-Fn.screenY):Wi=Yt=0,Fn=e),Yt)},movementY:function(e){return"movementY"in e?e.movementY:Wi}}),fi=vt(Zr),Vc=j({},Zr,{dataTransfer:0}),rm=vt(Vc),cm=j({},An,{relatedTarget:0}),Ji=vt(cm),la=j({},Zn,{animationName:0,elapsedTime:0,pseudoElement:0}),Wr=vt(la),Ns=j({},Zn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Vd=vt(Ns),du=j({},Zn,{data:0}),Jr=vt(du),om={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Fc={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 ll(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=fu[e])?!!t[e]:!1}function er(){return ll}var Xc=j({},An,{key:function(e){if(e.key){var t=om[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Oe(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Fc[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:er,charCode:function(e){return e.type==="keypress"?Oe(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Oe(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),hu=vt(Xc),Fd=j({},Zr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Xd=vt(Fd),um=j({},An,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:er}),dm=vt(um),fm=j({},Zn,{propertyName:0,elapsedTime:0,pseudoElement:0}),hm=vt(fm),Kc=j({},Zr,{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}),mm=vt(Kc),mu=j({},Zn,{newState:0,oldState:0}),pm=vt(mu),Qc=[9,13,27,32],ks=ls&&"CompositionEvent"in window,aa=null;ls&&"documentMode"in document&&(aa=document.documentMode);var hi=ls&&"TextEvent"in window&&!aa,tr=ls&&(!ks||aa&&8<aa&&11>=aa),ec=" ",tc=!1;function Ma(e,t){switch(e){case"keyup":return Qc.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ds(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var mi=!1;function gm(e,t){switch(e){case"compositionend":return Ds(t);case"keypress":return t.which!==32?null:(tc=!0,ec);case"textInput":return e=t.data,e===ec&&tc?null:e;default:return null}}function Kd(e,t){if(mi)return e==="compositionend"||!ks&&Ma(e,t)?(e=oe(),Z=M=y=null,mi=!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 tr&&t.locale!=="ko"?null:t.data;default:return null}}var nr={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 pi(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!nr[e.type]:t==="textarea"}function nc(e,t,a,c){Dl?js?js.push(c):js=[c]:Dl=c,t=Ff(t,"onChange"),0<t.length&&(a=new _n("onChange","change",null,a,c),e.push({event:a,listeners:t}))}var Ra=null,ia=null;function Da(e){i_(e,0)}function sc(e){var t=ge(e);if(vs(t))return e}function Qd(e,t){if(e==="change")return t}var vl=!1;if(ls){var gi;if(ls){var sr="oninput"in document;if(!sr){var lr=document.createElement("div");lr.setAttribute("oninput","return;"),sr=typeof lr.oninput=="function"}gi=sr}else gi=!1;vl=gi&&(!document.documentMode||9<document.documentMode)}function lc(){Ra&&(Ra.detachEvent("onpropertychange",Pd),ia=Ra=null)}function Pd(e){if(e.propertyName==="value"&&sc(ia)){var t=[];nc(t,ia,e,Nn(e)),sl(Da,t)}}function pu(e,t,a){e==="focusin"?(lc(),Ra=t,ia=a,Ra.attachEvent("onpropertychange",Pd)):e==="focusout"&&lc()}function Pc(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return sc(ia)}function Zd(e,t){if(e==="click")return sc(t)}function Zc(e,t){if(e==="input"||e==="change")return sc(t)}function Wd(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Xn=typeof Object.is=="function"?Object.is:Wd;function ra(e,t){if(Xn(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(!$e.call(t,d)||!Xn(e[d],t[d]))return!1}return!0}function Jd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Wc(e,t){var a=Jd(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=Jd(a)}}function ac(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ac(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Jc(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=ss(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=ss(e.document)}return t}function eo(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 to=ls&&"documentMode"in document&&11>=document.documentMode,jl=null,ar=null,La=null,xi=!1;function ef(e,t,a){var c=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;xi||jl==null||jl!==ss(c)||(c=jl,"selectionStart"in c&&eo(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}),La&&ra(La,c)||(La=c,c=Ff(ar,"onSelect"),0<c.length&&(t=new _n("onSelect","select",null,t,a),e.push({event:t,listeners:c}),t.target=jl)))}function Ll(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var ir={animationend:Ll("Animation","AnimationEnd"),animationiteration:Ll("Animation","AnimationIteration"),animationstart:Ll("Animation","AnimationStart"),transitionrun:Ll("Transition","TransitionRun"),transitionstart:Ll("Transition","TransitionStart"),transitioncancel:Ll("Transition","TransitionCancel"),transitionend:Ll("Transition","TransitionEnd")},rr={},ic={};ls&&(ic=document.createElement("div").style,"AnimationEvent"in window||(delete ir.animationend.animation,delete ir.animationiteration.animation,delete ir.animationstart.animation),"TransitionEvent"in window||delete ir.transitionend.transition);function ca(e){if(rr[e])return rr[e];if(!ir[e])return e;var t=ir[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in ic)return rr[e]=t[a];return e}var cr=ca("animationend"),oa=ca("animationiteration"),or=ca("animationstart"),gu=ca("transitionrun"),xm=ca("transitionstart"),_i=ca("transitioncancel"),rc=ca("transitionend"),xu=new Map,ur="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(" ");ur.push("scrollEnd");function al(e,t){xu.set(e,t),Dt(t,[e])}var bi=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)},Gn=[],ua=0,yi=0;function Ol(){for(var e=ua,t=yi=ua=0;t<e;){var a=Gn[t];Gn[t++]=null;var c=Gn[t];Gn[t++]=null;var d=Gn[t];Gn[t++]=null;var h=Gn[t];if(Gn[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}h!==0&&tf(a,d,h)}}function Oa(e,t,a,c){Gn[ua++]=e,Gn[ua++]=t,Gn[ua++]=a,Gn[ua++]=c,yi|=c,e.lanes|=c,e=e.alternate,e!==null&&(e.lanes|=c)}function un(e,t,a,c){return Oa(e,t,a,c),no(e)}function da(e,t){return Oa(e,null,null,t),no(e)}function tf(e,t,a){e.lanes|=a;var c=e.alternate;c!==null&&(c.lanes|=a);for(var d=!1,h=e.return;h!==null;)h.childLanes|=a,c=h.alternate,c!==null&&(c.childLanes|=a),h.tag===22&&(e=h.stateNode,e===null||e._visibility&1||(d=!0)),e=h,h=h.return;return e.tag===3?(h=e.stateNode,d&&t!==null&&(d=31-yt(a),e=h.hiddenUpdates,c=e[d],c===null?e[d]=[t]:c.push(t),t.lane=a|536870912),h):null}function no(e){if(50<rd)throw rd=0,qm=null,Error(r(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var za={};function so(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 It(e,t,a,c){return new so(e,t,a,c)}function dr(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Fs(e,t){var a=e.alternate;return a===null?(a=It(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 fr(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 Xs(e,t,a,c,d,h){var v=0;if(c=e,typeof e=="function")dr(e)&&(v=1);else if(typeof e=="string")v=Oj(e,a,be.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case ee:return e=It(31,a,t,d),e.elementType=ee,e.lanes=h,e;case E:return Ia(a.children,d,h,t);case C:v=8,d|=24;break;case T:return e=It(12,a,t,d|2),e.elementType=T,e.lanes=h,e;case I:return e=It(13,a,t,d),e.elementType=I,e.lanes=h,e;case R:return e=It(19,a,t,d),e.elementType=R,e.lanes=h,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case q:v=10;break e;case z:v=9;break e;case te:v=11;break e;case $:v=14;break e;case Q:v=16,c=null;break e}v=29,a=Error(r(130,e===null?"null":typeof e,"")),c=null}return t=It(v,a,t,d),t.elementType=e,t.type=c,t.lanes=h,t}function Ia(e,t,a,c){return e=It(7,e,c,t),e.lanes=a,e}function Kt(e,t,a){return e=It(6,e,null,t),e.lanes=a,e}function _u(e){var t=It(18,null,null,0);return t.stateNode=e,t}function lo(e,t,a){return t=It(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var zl=new WeakMap;function Ks(e,t){if(typeof e=="object"&&e!==null){var a=zl.get(e);return a!==void 0?a:(t={value:e,source:t,stack:xe(t)},zl.set(e,t),t)}return{value:e,source:t,stack:xe(t)}}var fa=[],ha=0,$a=null,ms=0,Ls=[],il=0,Qs=null,Os=1,zs="";function Ps(e,t){fa[ha++]=ms,fa[ha++]=$a,$a=e,ms=t}function bu(e,t,a){Ls[il++]=Os,Ls[il++]=zs,Ls[il++]=Qs,Qs=e;var c=Os;e=zs;var d=32-yt(c)-1;c&=~(1<<d),a+=1;var h=32-yt(t)+d;if(30<h){var v=d-d%5;h=(c&(1<<v)-1).toString(32),c>>=v,d-=v,Os=1<<32-yt(t)+d|a<<d|c,zs=h+e}else Os=1<<h|a<<d|c,zs=e}function Ua(e){e.return!==null&&(Ps(e,1),bu(e,1,0))}function ao(e){for(;e===$a;)$a=fa[--ha],fa[ha]=null,ms=fa[--ha],fa[ha]=null;for(;e===Qs;)Qs=Ls[--il],Ls[il]=null,zs=Ls[--il],Ls[il]=null,Os=Ls[--il],Ls[il]=null}function nf(e,t){Ls[il++]=Os,Ls[il++]=zs,Ls[il++]=Qs,Os=t.id,zs=t.overflow,Qs=e}var se=null,nn=null,ft=!1,Il=null,rl=!1,hr=Error(r(519));function Ba(e){var t=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ws(Ks(t,e)),hr}function sf(e){var t=e.stateNode,a=e.type,c=e.memoizedProps;switch(t[Tt]=e,t[gn]=c,a){case"dialog":Nt("cancel",t),Nt("close",t);break;case"iframe":case"object":case"embed":Nt("load",t);break;case"video":case"audio":for(a=0;a<od.length;a++)Nt(od[a],t);break;case"source":Nt("error",t);break;case"img":case"image":case"link":Nt("error",t),Nt("load",t);break;case"details":Nt("toggle",t);break;case"input":Nt("invalid",t),ui(t,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0);break;case"select":Nt("invalid",t);break;case"textarea":Nt("invalid",t),ea(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||u_(t.textContent,a)?(c.popover!=null&&(Nt("beforetoggle",t),Nt("toggle",t)),c.onScroll!=null&&Nt("scroll",t),c.onScrollEnd!=null&&Nt("scrollend",t),c.onClick!=null&&(t.onclick=xt),t=!0):t=!1,t||Ba(e,!0)}function yu(e){for(se=e.return;se;)switch(se.tag){case 5:case 31:case 13:rl=!1;return;case 27:case 3:rl=!0;return;default:se=se.return}}function X(e){if(e!==se)return!1;if(!ft)return yu(e),ft=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||sp(e.type,e.memoizedProps)),a=!a),a&&nn&&Ba(e),yu(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));nn=b_(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));nn=b_(e)}else t===27?(t=nn,Rr(e.type)?(e=cp,cp=null,nn=e):nn=t):nn=se?Yl(e.stateNode.nextSibling):null;return!0}function ma(){nn=se=null,ft=!1}function Nl(){var e=Il;return e!==null&&(hl===null?hl=e:hl.push.apply(hl,e),Il=null),e}function ws(e){Il===null?Il=[e]:Il.push(e)}var io=A(null),$l=null,Ul=null;function Ha(e,t,a){U(io,t._currentValue),t._currentValue=a}function Kn(e){e._currentValue=io.current,V(io)}function vu(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 ro(e,t,a,c){var d=e.child;for(d!==null&&(d.return=e);d!==null;){var h=d.dependencies;if(h!==null){var v=d.child;h=h.firstContext;e:for(;h!==null;){var S=h;h=d;for(var Y=0;Y<t.length;Y++)if(S.context===t[Y]){h.lanes|=a,S=h.alternate,S!==null&&(S.lanes|=a),vu(h.return,a,e),c||(v=null);break e}h=S.next}}else if(d.tag===18){if(v=d.return,v===null)throw Error(r(341));v.lanes|=a,h=v.alternate,h!==null&&(h.lanes|=a),vu(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 mr(e,t,a,c){e=null;for(var d=t,h=!1;d!==null;){if(!h){if((d.flags&524288)!==0)h=!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;Xn(d.pendingProps.value,v.value)||(e!==null?e.push(S):e=[S])}}else if(d===Me.current){if(v=d.alternate,v===null)throw Error(r(387));v.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(e!==null?e.push(md):e=[md])}d=d.return}e!==null&&ro(t,e,a,c),t.flags|=262144}function dn(e){for(e=e.firstContext;e!==null;){if(!Xn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function vi(e){$l=e,Ul=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function as(e){return lf($l,e)}function co(e,t){return $l===null&&vi(e),lf(e,t)}function lf(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},Ul===null){if(e===null)throw Error(r(308));Ul=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ul=Ul.next=t;return a}var _m=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()})}},ji=n.unstable_scheduleCallback,bm=n.unstable_NormalPriority,Yn={$$typeof:q,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function oo(){return{controller:new _m,data:new Map,refCount:0}}function cc(e){e.refCount--,e.refCount===0&&ji(bm,function(){e.controller.abort()})}var oc=null,ju=0,pr=0,gr=null;function ym(e,t){if(oc===null){var a=oc=[];ju=0,pr=Km(),gr={status:"pending",value:void 0,then:function(c){a.push(c)}}}return ju++,t.then(af,af),t}function af(){if(--ju===0&&oc!==null){gr!==null&&(gr.status="fulfilled");var e=oc;oc=null,pr=0,gr=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function uc(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 rf=D.S;D.S=function(e,t){Lx=ht(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&ym(e,t),rf!==null&&rf(e,t)};var Ni=A(null);function dc(){var e=Ni.current;return e!==null?e:ln.pooledCache}function uo(e,t){t===null?U(Ni,Ni.current):U(Ni,t.pool)}function cf(){var e=dc();return e===null?null:{parent:Yn._currentValue,pool:e}}var cl=Error(r(460)),Nu=Error(r(474)),fo=Error(r(542)),fc={then:function(){}};function ku(e){return e=e.status,e==="fulfilled"||e==="rejected"}function wu(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(xt,xt),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Su(e),e;default:if(typeof t.status=="string")t.then(xt,xt);else{if(e=ln,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,Su(e),e}throw wi=t,cl}}function ki(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(wi=a,cl):a}}var wi=null;function ho(){if(wi===null)throw Error(r(459));var e=wi;return wi=null,e}function Su(e){if(e===cl||e===fo)throw Error(r(483))}var qa=null,hc=0;function mc(e){var t=hc;return hc+=1,qa===null&&(qa=[]),wu(qa,e,t)}function Si(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function pc(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 mo(e){function t(ae,W){if(e){var de=ae.deletions;de===null?(ae.deletions=[W],ae.flags|=16):de.push(W)}}function a(ae,W){if(!e)return null;for(;W!==null;)t(ae,W),W=W.sibling;return null}function c(ae){for(var W=new Map;ae!==null;)ae.key!==null?W.set(ae.key,ae):W.set(ae.index,ae),ae=ae.sibling;return W}function d(ae,W){return ae=Fs(ae,W),ae.index=0,ae.sibling=null,ae}function h(ae,W,de){return ae.index=de,e?(de=ae.alternate,de!==null?(de=de.index,de<W?(ae.flags|=67108866,W):de):(ae.flags|=67108866,W)):(ae.flags|=1048576,W)}function v(ae){return e&&ae.alternate===null&&(ae.flags|=67108866),ae}function S(ae,W,de,ke){return W===null||W.tag!==6?(W=Kt(de,ae.mode,ke),W.return=ae,W):(W=d(W,de),W.return=ae,W)}function Y(ae,W,de,ke){var Pe=de.type;return Pe===E?je(ae,W,de.props.children,ke,de.key):W!==null&&(W.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===Q&&ki(Pe)===W.type)?(W=d(W,de.props),Si(W,de),W.return=ae,W):(W=Xs(de.type,de.key,de.props,null,ae.mode,ke),Si(W,de),W.return=ae,W)}function fe(ae,W,de,ke){return W===null||W.tag!==4||W.stateNode.containerInfo!==de.containerInfo||W.stateNode.implementation!==de.implementation?(W=lo(de,ae.mode,ke),W.return=ae,W):(W=d(W,de.children||[]),W.return=ae,W)}function je(ae,W,de,ke,Pe){return W===null||W.tag!==7?(W=Ia(de,ae.mode,ke,Pe),W.return=ae,W):(W=d(W,de),W.return=ae,W)}function Ee(ae,W,de){if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return W=Kt(""+W,ae.mode,de),W.return=ae,W;if(typeof W=="object"&&W!==null){switch(W.$$typeof){case k:return de=Xs(W.type,W.key,W.props,null,ae.mode,de),Si(de,W),de.return=ae,de;case w:return W=lo(W,ae.mode,de),W.return=ae,W;case Q:return W=ki(W),Ee(ae,W,de)}if(ce(W)||F(W))return W=Ia(W,ae.mode,de,null),W.return=ae,W;if(typeof W.then=="function")return Ee(ae,mc(W),de);if(W.$$typeof===q)return Ee(ae,co(ae,W),de);pc(ae,W)}return null}function he(ae,W,de,ke){var Pe=W!==null?W.key:null;if(typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint")return Pe!==null?null:S(ae,W,""+de,ke);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case k:return de.key===Pe?Y(ae,W,de,ke):null;case w:return de.key===Pe?fe(ae,W,de,ke):null;case Q:return de=ki(de),he(ae,W,de,ke)}if(ce(de)||F(de))return Pe!==null?null:je(ae,W,de,ke,null);if(typeof de.then=="function")return he(ae,W,mc(de),ke);if(de.$$typeof===q)return he(ae,W,co(ae,de),ke);pc(ae,de)}return null}function pe(ae,W,de,ke,Pe){if(typeof ke=="string"&&ke!==""||typeof ke=="number"||typeof ke=="bigint")return ae=ae.get(de)||null,S(W,ae,""+ke,Pe);if(typeof ke=="object"&&ke!==null){switch(ke.$$typeof){case k:return ae=ae.get(ke.key===null?de:ke.key)||null,Y(W,ae,ke,Pe);case w:return ae=ae.get(ke.key===null?de:ke.key)||null,fe(W,ae,ke,Pe);case Q:return ke=ki(ke),pe(ae,W,de,ke,Pe)}if(ce(ke)||F(ke))return ae=ae.get(de)||null,je(W,ae,ke,Pe,null);if(typeof ke.then=="function")return pe(ae,W,de,mc(ke),Pe);if(ke.$$typeof===q)return pe(ae,W,de,co(W,ke),Pe);pc(W,ke)}return null}function Ge(ae,W,de,ke){for(var Pe=null,$t=null,Fe=W,pt=W=0,Ct=null;Fe!==null&&pt<de.length;pt++){Fe.index>pt?(Ct=Fe,Fe=null):Ct=Fe.sibling;var Ut=he(ae,Fe,de[pt],ke);if(Ut===null){Fe===null&&(Fe=Ct);break}e&&Fe&&Ut.alternate===null&&t(ae,Fe),W=h(Ut,W,pt),$t===null?Pe=Ut:$t.sibling=Ut,$t=Ut,Fe=Ct}if(pt===de.length)return a(ae,Fe),ft&&Ps(ae,pt),Pe;if(Fe===null){for(;pt<de.length;pt++)Fe=Ee(ae,de[pt],ke),Fe!==null&&(W=h(Fe,W,pt),$t===null?Pe=Fe:$t.sibling=Fe,$t=Fe);return ft&&Ps(ae,pt),Pe}for(Fe=c(Fe);pt<de.length;pt++)Ct=pe(Fe,ae,pt,de[pt],ke),Ct!==null&&(e&&Ct.alternate!==null&&Fe.delete(Ct.key===null?pt:Ct.key),W=h(Ct,W,pt),$t===null?Pe=Ct:$t.sibling=Ct,$t=Ct);return e&&Fe.forEach(function(Ir){return t(ae,Ir)}),ft&&Ps(ae,pt),Pe}function nt(ae,W,de,ke){if(de==null)throw Error(r(151));for(var Pe=null,$t=null,Fe=W,pt=W=0,Ct=null,Ut=de.next();Fe!==null&&!Ut.done;pt++,Ut=de.next()){Fe.index>pt?(Ct=Fe,Fe=null):Ct=Fe.sibling;var Ir=he(ae,Fe,Ut.value,ke);if(Ir===null){Fe===null&&(Fe=Ct);break}e&&Fe&&Ir.alternate===null&&t(ae,Fe),W=h(Ir,W,pt),$t===null?Pe=Ir:$t.sibling=Ir,$t=Ir,Fe=Ct}if(Ut.done)return a(ae,Fe),ft&&Ps(ae,pt),Pe;if(Fe===null){for(;!Ut.done;pt++,Ut=de.next())Ut=Ee(ae,Ut.value,ke),Ut!==null&&(W=h(Ut,W,pt),$t===null?Pe=Ut:$t.sibling=Ut,$t=Ut);return ft&&Ps(ae,pt),Pe}for(Fe=c(Fe);!Ut.done;pt++,Ut=de.next())Ut=pe(Fe,ae,pt,Ut.value,ke),Ut!==null&&(e&&Ut.alternate!==null&&Fe.delete(Ut.key===null?pt:Ut.key),W=h(Ut,W,pt),$t===null?Pe=Ut:$t.sibling=Ut,$t=Ut);return e&&Fe.forEach(function(Fj){return t(ae,Fj)}),ft&&Ps(ae,pt),Pe}function Wt(ae,W,de,ke){if(typeof de=="object"&&de!==null&&de.type===E&&de.key===null&&(de=de.props.children),typeof de=="object"&&de!==null){switch(de.$$typeof){case k:e:{for(var Pe=de.key;W!==null;){if(W.key===Pe){if(Pe=de.type,Pe===E){if(W.tag===7){a(ae,W.sibling),ke=d(W,de.props.children),ke.return=ae,ae=ke;break e}}else if(W.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===Q&&ki(Pe)===W.type){a(ae,W.sibling),ke=d(W,de.props),Si(ke,de),ke.return=ae,ae=ke;break e}a(ae,W);break}else t(ae,W);W=W.sibling}de.type===E?(ke=Ia(de.props.children,ae.mode,ke,de.key),ke.return=ae,ae=ke):(ke=Xs(de.type,de.key,de.props,null,ae.mode,ke),Si(ke,de),ke.return=ae,ae=ke)}return v(ae);case w:e:{for(Pe=de.key;W!==null;){if(W.key===Pe)if(W.tag===4&&W.stateNode.containerInfo===de.containerInfo&&W.stateNode.implementation===de.implementation){a(ae,W.sibling),ke=d(W,de.children||[]),ke.return=ae,ae=ke;break e}else{a(ae,W);break}else t(ae,W);W=W.sibling}ke=lo(de,ae.mode,ke),ke.return=ae,ae=ke}return v(ae);case Q:return de=ki(de),Wt(ae,W,de,ke)}if(ce(de))return Ge(ae,W,de,ke);if(F(de)){if(Pe=F(de),typeof Pe!="function")throw Error(r(150));return de=Pe.call(de),nt(ae,W,de,ke)}if(typeof de.then=="function")return Wt(ae,W,mc(de),ke);if(de.$$typeof===q)return Wt(ae,W,co(ae,de),ke);pc(ae,de)}return typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint"?(de=""+de,W!==null&&W.tag===6?(a(ae,W.sibling),ke=d(W,de),ke.return=ae,ae=ke):(a(ae,W),ke=Kt(de,ae.mode,ke),ke.return=ae,ae=ke),v(ae)):a(ae,W)}return function(ae,W,de,ke){try{hc=0;var Pe=Wt(ae,W,de,ke);return qa=null,Pe}catch(Fe){if(Fe===cl||Fe===fo)throw Fe;var $t=It(29,Fe,null,ae.mode);return $t.lanes=ke,$t.return=ae,$t}finally{}}}var Ga=mo(!0),Eu=mo(!1),pa=!1;function Cu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function po(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 Bl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ga(e,t,a){var c=e.updateQueue;if(c===null)return null;if(c=c.shared,(Ht&2)!==0){var d=c.pending;return d===null?t.next=t:(t.next=d.next,d.next=t),c.pending=t,t=no(e),tf(e,null,a),t}return Oa(e,c,t,a),no(e)}function xr(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,Ms(e,a)}}function gc(e,t){var a=e.updateQueue,c=e.alternate;if(c!==null&&(c=c.updateQueue,a===c)){var d=null,h=null;if(a=a.firstBaseUpdate,a!==null){do{var v={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};h===null?d=h=v:h=h.next=v,a=a.next}while(a!==null);h===null?d=h=t:h=h.next=t}else d=h=t;a={baseState:c.baseState,firstBaseUpdate:d,lastBaseUpdate:h,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 Tu=!1;function Ei(){if(Tu){var e=gr;if(e!==null)throw e}}function xc(e,t,a,c){Tu=!1;var d=e.updateQueue;pa=!1;var h=d.firstBaseUpdate,v=d.lastBaseUpdate,S=d.shared.pending;if(S!==null){d.shared.pending=null;var Y=S,fe=Y.next;Y.next=null,v===null?h=fe:v.next=fe,v=Y;var je=e.alternate;je!==null&&(je=je.updateQueue,S=je.lastBaseUpdate,S!==v&&(S===null?je.firstBaseUpdate=fe:S.next=fe,je.lastBaseUpdate=Y))}if(h!==null){var Ee=d.baseState;v=0,je=fe=Y=null,S=h;do{var he=S.lane&-536870913,pe=he!==S.lane;if(pe?(Et&he)===he:(c&he)===he){he!==0&&he===pr&&(Tu=!0),je!==null&&(je=je.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var Ge=e,nt=S;he=t;var Wt=a;switch(nt.tag){case 1:if(Ge=nt.payload,typeof Ge=="function"){Ee=Ge.call(Wt,Ee,he);break e}Ee=Ge;break e;case 3:Ge.flags=Ge.flags&-65537|128;case 0:if(Ge=nt.payload,he=typeof Ge=="function"?Ge.call(Wt,Ee,he):Ge,he==null)break e;Ee=j({},Ee,he);break e;case 2:pa=!0}}he=S.callback,he!==null&&(e.flags|=64,pe&&(e.flags|=8192),pe=d.callbacks,pe===null?d.callbacks=[he]:pe.push(he))}else pe={lane:he,tag:S.tag,payload:S.payload,callback:S.callback,next:null},je===null?(fe=je=pe,Y=Ee):je=je.next=pe,v|=he;if(S=S.next,S===null){if(S=d.shared.pending,S===null)break;pe=S,S=pe.next,pe.next=null,d.lastBaseUpdate=pe,d.shared.pending=null}}while(!0);je===null&&(Y=Ee),d.baseState=Y,d.firstBaseUpdate=fe,d.lastBaseUpdate=je,h===null&&(d.shared.lanes=0),Er|=v,e.lanes=v,e.memoizedState=Ee}}function of(e,t){if(typeof e!="function")throw Error(r(191,e));e.call(t)}function uf(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)of(a[e],t)}var _r=A(null),Ya=A(0);function Au(e,t){e=Ui,U(Ya,e),U(_r,t),Ui=e|t.baseLanes}function Mu(){U(Ya,Ui),U(_r,_r.current)}function go(){Ui=Ya.current,V(_r),V(Ya)}var Zs=A(null),ol=null;function Va(e){var t=e.alternate;U(Mn,Mn.current&1),U(Zs,e),ol===null&&(t===null||_r.current!==null||t.memoizedState!==null)&&(ol=e)}function Ru(e){U(Mn,Mn.current),U(Zs,e),ol===null&&(ol=e)}function df(e){e.tag===22?(U(Mn,Mn.current),U(Zs,e),ol===null&&(ol=e)):Fa()}function Fa(){U(Mn,Mn.current),U(Zs,Zs.current)}function Ws(e){V(Zs),ol===e&&(ol=null),V(Mn)}var Mn=A(0);function xo(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||ip(a)||rp(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 xa=0,ot=null,Vt=null,Rn=null,_o=!1,br=!1,Ci=!1,bo=0,Xa=0,Ka=null,yo=0;function kn(){throw Error(r(321))}function vo(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!Xn(e[a],t[a]))return!1;return!0}function Du(e,t,a,c,d,h){return xa=h,ot=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,D.H=e===null||e.memoizedState===null?Ju:m,Ci=!1,h=a(c,d),Ci=!1,br&&(h=Ou(t,a,c,d)),Lu(e),h}function Lu(e){D.H=kr;var t=Vt!==null&&Vt.next!==null;if(xa=0,Rn=Vt=ot=null,_o=!1,Xa=0,Ka=null,t)throw Error(r(300));e===null||me||(e=e.dependencies,e!==null&&dn(e)&&(me=!0))}function Ou(e,t,a,c){ot=e;var d=0;do{if(br&&(Ka=null),Xa=0,br=!1,25<=d)throw Error(r(301));if(d+=1,Rn=Vt=null,e.updateQueue!=null){var h=e.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}D.H=L,h=t(a,c)}while(br);return h}function zu(){var e=D.H,t=e.useState()[0];return t=typeof t.then=="function"?bc(t):t,e=e.useState()[0],(Vt!==null?Vt.memoizedState:null)!==e&&(ot.flags|=1024),t}function Iu(){var e=bo!==0;return bo=0,e}function $u(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function _c(e){if(_o){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}_o=!1}xa=0,Rn=Vt=ot=null,br=!1,Xa=bo=0,Ka=null}function Ss(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Rn===null?ot.memoizedState=Rn=e:Rn=Rn.next=e,Rn}function Dn(){if(Vt===null){var e=ot.alternate;e=e!==null?e.memoizedState:null}else e=Vt.next;var t=Rn===null?ot.memoizedState:Rn.next;if(t!==null)Rn=t,Vt=e;else{if(e===null)throw ot.alternate===null?Error(r(467)):Error(r(310));Vt=e,e={memoizedState:Vt.memoizedState,baseState:Vt.baseState,baseQueue:Vt.baseQueue,queue:Vt.queue,next:null},Rn===null?ot.memoizedState=Rn=e:Rn=Rn.next=e}return Rn}function jo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function bc(e){var t=Xa;return Xa+=1,Ka===null&&(Ka=[]),e=wu(Ka,e,t),t=ot,(Rn===null?t.memoizedState:Rn.next)===null&&(t=t.alternate,D.H=t===null||t.memoizedState===null?Ju:m),e}function No(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return bc(e);if(e.$$typeof===q)return as(e)}throw Error(r(438,String(e)))}function Uu(e){var t=null,a=ot.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var c=ot.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=jo(),ot.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]=G;return t.index++,a}function kl(e,t){return typeof t=="function"?t(e):t}function yc(e){var t=Dn();return Bu(t,Vt,e)}function Bu(e,t,a){var c=e.queue;if(c===null)throw Error(r(311));c.lastRenderedReducer=a;var d=e.baseQueue,h=c.pending;if(h!==null){if(d!==null){var v=d.next;d.next=h.next,h.next=v}t.baseQueue=d=h,c.pending=null}if(h=e.baseState,d===null)e.memoizedState=h;else{t=d.next;var S=v=null,Y=null,fe=t,je=!1;do{var Ee=fe.lane&-536870913;if(Ee!==fe.lane?(Et&Ee)===Ee:(xa&Ee)===Ee){var he=fe.revertLane;if(he===0)Y!==null&&(Y=Y.next={lane:0,revertLane:0,gesture:null,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null}),Ee===pr&&(je=!0);else if((xa&he)===he){fe=fe.next,he===pr&&(je=!0);continue}else Ee={lane:0,revertLane:fe.revertLane,gesture:null,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null},Y===null?(S=Y=Ee,v=h):Y=Y.next=Ee,ot.lanes|=he,Er|=he;Ee=fe.action,Ci&&a(h,Ee),h=fe.hasEagerState?fe.eagerState:a(h,Ee)}else he={lane:Ee,revertLane:fe.revertLane,gesture:fe.gesture,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null},Y===null?(S=Y=he,v=h):Y=Y.next=he,ot.lanes|=Ee,Er|=Ee;fe=fe.next}while(fe!==null&&fe!==t);if(Y===null?v=h:Y.next=S,!Xn(h,e.memoizedState)&&(me=!0,je&&(a=gr,a!==null)))throw a;e.memoizedState=h,e.baseState=v,e.baseQueue=Y,c.lastRenderedState=h}return d===null&&(c.lanes=0),[e.memoizedState,c.dispatch]}function Hu(e){var t=Dn(),a=t.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=e;var c=a.dispatch,d=a.pending,h=t.memoizedState;if(d!==null){a.pending=null;var v=d=d.next;do h=e(h,v.action),v=v.next;while(v!==d);Xn(h,t.memoizedState)||(me=!0),t.memoizedState=h,t.baseQueue===null&&(t.baseState=h),a.lastRenderedState=h}return[h,c]}function ff(e,t,a){var c=ot,d=Dn(),h=ft;if(h){if(a===void 0)throw Error(r(407));a=a()}else a=t();var v=!Xn((Vt||d).memoizedState,a);if(v&&(d.memoizedState=a,me=!0),d=d.queue,vr(pf.bind(null,c,d,e),[e]),d.getSnapshot!==t||v||Rn!==null&&Rn.memoizedState.tag&1){if(c.flags|=2048,Ti(9,{destroy:void 0},mf.bind(null,c,d,a,t),null),ln===null)throw Error(r(349));h||(xa&127)!==0||hf(c,t,a)}return a}function hf(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=ot.updateQueue,t===null?(t=jo(),ot.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function mf(e,t,a,c){t.value=a,t.getSnapshot=c,gf(t)&&qu(e)}function pf(e,t,a){return a(function(){gf(t)&&qu(e)})}function gf(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!Xn(e,a)}catch{return!0}}function qu(e){var t=da(e,2);t!==null&&ml(t,e,2)}function ko(e){var t=Ss();if(typeof e=="function"){var a=e;if(e=a(),Ci){bt(!0);try{a()}finally{bt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:kl,lastRenderedState:e},t}function vc(e,t,a,c){return e.baseState=a,Bu(e,Vt,typeof c=="function"?c:kl)}function wl(e,t,a,c,d){if(Nr(e))throw Error(r(485));if(e=t.action,e!==null){var h={payload:d,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(v){h.listeners.push(v)}};D.T!==null?a(!0):h.isTransition=!1,c(h),a=t.pending,a===null?(h.next=t.pending=h,Js(t,h)):(h.next=a.next,t.pending=a.next=h)}}function Js(e,t){var a=t.action,c=t.payload,d=e.state;if(t.isTransition){var h=D.T,v={};D.T=v;try{var S=a(d,c),Y=D.S;Y!==null&&Y(v,S),sn(e,t,S)}catch(fe){Gu(e,t,fe)}finally{h!==null&&v.types!==null&&(h.types=v.types),D.T=h}}else try{h=a(d,c),sn(e,t,h)}catch(fe){Gu(e,t,fe)}}function sn(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(c){wo(e,t,c)},function(c){return Gu(e,t,c)}):wo(e,t,a)}function wo(e,t,a){t.status="fulfilled",t.value=a,xf(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,Js(e,a)))}function Gu(e,t,a){var c=e.pending;if(e.pending=null,c!==null){c=c.next;do t.status="rejected",t.reason=a,xf(t),t=t.next;while(t!==c)}e.action=null}function xf(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function jc(e,t){return t}function Yu(e,t){if(ft){var a=ln.formState;if(a!==null){e:{var c=ot;if(ft){if(nn){t:{for(var d=nn,h=rl;d.nodeType!==8;){if(!h){d=null;break t}if(d=Yl(d.nextSibling),d===null){d=null;break t}}h=d.data,d=h==="F!"||h==="F"?d:null}if(d){nn=Yl(d.nextSibling),c=d.data==="F!";break e}}Ba(c)}c=!1}c&&(t=a[0])}}return a=Ss(),a.memoizedState=a.baseState=t,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:jc,lastRenderedState:t},a.queue=c,a=Ef.bind(null,ot,c),c.dispatch=a,c=ko(!1),h=Hl.bind(null,ot,!1,c.queue),c=Ss(),d={state:t,dispatch:null,action:e,pending:null},c.queue=d,a=wl.bind(null,ot,d,h,a),d.dispatch=a,c.memoizedState=e,[t,a,!1]}function Nc(e){var t=Dn();return yr(t,Vt,e)}function yr(e,t,a){if(t=Bu(e,t,jc)[0],e=yc(kl)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var c=bc(t)}catch(v){throw v===cl?fo:v}else c=t;t=Dn();var d=t.queue,h=d.dispatch;return a!==t.memoizedState&&(ot.flags|=2048,Ti(9,{destroy:void 0},_f.bind(null,d,a),null)),[c,h,e]}function _f(e,t){e.action=t}function kc(e){var t=Dn(),a=Vt;if(a!==null)return yr(t,a,e);Dn(),t=t.memoizedState,a=Dn();var c=a.queue.dispatch;return a.memoizedState=e,[t,c,!1]}function Ti(e,t,a,c){return e={tag:e,create:a,deps:c,inst:t,next:null},t=ot.updateQueue,t===null&&(t=jo(),ot.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 bf(){return Dn().memoizedState}function Qa(e,t,a,c){var d=Ss();ot.flags|=e,d.memoizedState=Ti(1|t,{destroy:void 0},a,c===void 0?null:c)}function wc(e,t,a,c){var d=Dn();c=c===void 0?null:c;var h=d.memoizedState.inst;Vt!==null&&c!==null&&vo(c,Vt.memoizedState.deps)?d.memoizedState=Ti(t,h,a,c):(ot.flags|=e,d.memoizedState=Ti(1|t,h,a,c))}function yf(e,t){Qa(8390656,8,e,t)}function vr(e,t){wc(2048,8,e,t)}function vm(e){ot.flags|=4;var t=ot.updateQueue;if(t===null)t=jo(),ot.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function jr(e){var t=Dn().memoizedState;return vm({ref:t,nextImpl:e}),function(){if((Ht&2)!==0)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function Ai(e,t){return wc(4,2,e,t)}function vf(e,t){return wc(4,4,e,t)}function Vu(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 Fu(e,t,a){a=a!=null?a.concat([e]):null,wc(4,4,Vu.bind(null,t,e),a)}function Xu(){}function jf(e,t){var a=Dn();t=t===void 0?null:t;var c=a.memoizedState;return t!==null&&vo(t,c[1])?c[0]:(a.memoizedState=[e,t],e)}function Ku(e,t){var a=Dn();t=t===void 0?null:t;var c=a.memoizedState;if(t!==null&&vo(t,c[1]))return c[0];if(c=e(),Ci){bt(!0);try{e()}finally{bt(!1)}}return a.memoizedState=[c,t],c}function So(e,t,a){return a===void 0||(xa&1073741824)!==0&&(Et&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=zx(),ot.lanes|=e,Er|=e,a)}function Nf(e,t,a,c){return Xn(a,t)?a:_r.current!==null?(e=So(e,a,c),Xn(e,t)||(me=!0),e):(xa&42)===0||(xa&1073741824)!==0&&(Et&261930)===0?(me=!0,e.memoizedState=a):(e=zx(),ot.lanes|=e,Er|=e,t)}function kf(e,t,a,c,d){var h=O.p;O.p=h!==0&&8>h?h:8;var v=D.T,S={};D.T=S,Hl(e,!1,t,a);try{var Y=d(),fe=D.S;if(fe!==null&&fe(S,Y),Y!==null&&typeof Y=="object"&&typeof Y.then=="function"){var je=uc(Y,c);Ec(e,t,je,Tl(e))}else Ec(e,t,c,Tl(e))}catch(Ee){Ec(e,t,{then:function(){},status:"rejected",reason:Ee},Tl())}finally{O.p=h,v!==null&&S.types!==null&&(v.types=S.types),D.T=v}}function _a(){}function Qu(e,t,a,c){if(e.tag!==5)throw Error(r(476));var d=Sl(e).queue;kf(e,d,t,H,a===null?_a:function(){return Sc(e),a(c)})}function Sl(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:H,baseState:H,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:kl,lastRenderedState:H},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:kl,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Sc(e){var t=Sl(e);t.next===null&&(t=e.alternate.memoizedState),Ec(e,t.next.queue,{},Tl())}function Pu(){return as(md)}function Eo(){return Dn().memoizedState}function wf(){return Dn().memoizedState}function Zu(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=Tl();e=Bl(a);var c=ga(t,e,a);c!==null&&(ml(c,t,a),xr(c,t,a)),t={cache:oo()},e.payload=t;return}t=t.return}}function Sf(e,t,a){var c=Tl();a={lane:c,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Nr(e)?Cf(t,a):(a=un(e,t,a,c),a!==null&&(ml(a,e,c),Wu(a,t,c)))}function Ef(e,t,a){var c=Tl();Ec(e,t,a,c)}function Ec(e,t,a,c){var d={lane:c,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Nr(e))Cf(t,d);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=t.lastRenderedReducer,h!==null))try{var v=t.lastRenderedState,S=h(v,a);if(d.hasEagerState=!0,d.eagerState=S,Xn(S,v))return Oa(e,t,d,0),ln===null&&Ol(),!1}catch{}finally{}if(a=un(e,t,d,c),a!==null)return ml(a,e,c),Wu(a,t,c),!0}return!1}function Hl(e,t,a,c){if(c={lane:2,revertLane:Km(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Nr(e)){if(t)throw Error(r(479))}else t=un(e,a,c,2),t!==null&&ml(t,e,2)}function Nr(e){var t=e.alternate;return e===ot||t!==null&&t===ot}function Cf(e,t){br=_o=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function Wu(e,t,a){if((a&4194048)!==0){var c=t.lanes;c&=e.pendingLanes,a|=c,t.lanes=a,Ms(e,a)}}var kr={readContext:as,use:No,useCallback:kn,useContext:kn,useEffect:kn,useImperativeHandle:kn,useLayoutEffect:kn,useInsertionEffect:kn,useMemo:kn,useReducer:kn,useRef:kn,useState:kn,useDebugValue:kn,useDeferredValue:kn,useTransition:kn,useSyncExternalStore:kn,useId:kn,useHostTransitionStatus:kn,useFormState:kn,useActionState:kn,useOptimistic:kn,useMemoCache:kn,useCacheRefresh:kn};kr.useEffectEvent=kn;var Ju={readContext:as,use:No,useCallback:function(e,t){return Ss().memoizedState=[e,t===void 0?null:t],e},useContext:as,useEffect:yf,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Qa(4194308,4,Vu.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Qa(4194308,4,e,t)},useInsertionEffect:function(e,t){Qa(4,2,e,t)},useMemo:function(e,t){var a=Ss();t=t===void 0?null:t;var c=e();if(Ci){bt(!0);try{e()}finally{bt(!1)}}return a.memoizedState=[c,t],c},useReducer:function(e,t,a){var c=Ss();if(a!==void 0){var d=a(t);if(Ci){bt(!0);try{a(t)}finally{bt(!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=Sf.bind(null,ot,e),[c.memoizedState,e]},useRef:function(e){var t=Ss();return e={current:e},t.memoizedState=e},useState:function(e){e=ko(e);var t=e.queue,a=Ef.bind(null,ot,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:Xu,useDeferredValue:function(e,t){var a=Ss();return So(a,e,t)},useTransition:function(){var e=ko(!1);return e=kf.bind(null,ot,e.queue,!0,!1),Ss().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var c=ot,d=Ss();if(ft){if(a===void 0)throw Error(r(407));a=a()}else{if(a=t(),ln===null)throw Error(r(349));(Et&127)!==0||hf(c,t,a)}d.memoizedState=a;var h={value:a,getSnapshot:t};return d.queue=h,yf(pf.bind(null,c,h,e),[e]),c.flags|=2048,Ti(9,{destroy:void 0},mf.bind(null,c,h,a,t),null),a},useId:function(){var e=Ss(),t=ln.identifierPrefix;if(ft){var a=zs,c=Os;a=(c&~(1<<32-yt(c)-1)).toString(32)+a,t="_"+t+"R_"+a,a=bo++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=yo++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Pu,useFormState:Yu,useActionState:Yu,useOptimistic:function(e){var t=Ss();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=Hl.bind(null,ot,!0,a),a.dispatch=t,[e,t]},useMemoCache:Uu,useCacheRefresh:function(){return Ss().memoizedState=Zu.bind(null,ot)},useEffectEvent:function(e){var t=Ss(),a={impl:e};return t.memoizedState=a,function(){if((Ht&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}},m={readContext:as,use:No,useCallback:jf,useContext:as,useEffect:vr,useImperativeHandle:Fu,useInsertionEffect:Ai,useLayoutEffect:vf,useMemo:Ku,useReducer:yc,useRef:bf,useState:function(){return yc(kl)},useDebugValue:Xu,useDeferredValue:function(e,t){var a=Dn();return Nf(a,Vt.memoizedState,e,t)},useTransition:function(){var e=yc(kl)[0],t=Dn().memoizedState;return[typeof e=="boolean"?e:bc(e),t]},useSyncExternalStore:ff,useId:Eo,useHostTransitionStatus:Pu,useFormState:Nc,useActionState:Nc,useOptimistic:function(e,t){var a=Dn();return vc(a,Vt,e,t)},useMemoCache:Uu,useCacheRefresh:wf};m.useEffectEvent=jr;var L={readContext:as,use:No,useCallback:jf,useContext:as,useEffect:vr,useImperativeHandle:Fu,useInsertionEffect:Ai,useLayoutEffect:vf,useMemo:Ku,useReducer:Hu,useRef:bf,useState:function(){return Hu(kl)},useDebugValue:Xu,useDeferredValue:function(e,t){var a=Dn();return Vt===null?So(a,e,t):Nf(a,Vt.memoizedState,e,t)},useTransition:function(){var e=Hu(kl)[0],t=Dn().memoizedState;return[typeof e=="boolean"?e:bc(e),t]},useSyncExternalStore:ff,useId:Eo,useHostTransitionStatus:Pu,useFormState:kc,useActionState:kc,useOptimistic:function(e,t){var a=Dn();return Vt!==null?vc(a,Vt,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Uu,useCacheRefresh:wf};L.useEffectEvent=jr;function ne(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 ve={enqueueSetState:function(e,t,a){e=e._reactInternals;var c=Tl(),d=Bl(c);d.payload=t,a!=null&&(d.callback=a),t=ga(e,d,c),t!==null&&(ml(t,e,c),xr(t,e,c))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var c=Tl(),d=Bl(c);d.tag=1,d.payload=t,a!=null&&(d.callback=a),t=ga(e,d,c),t!==null&&(ml(t,e,c),xr(t,e,c))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=Tl(),c=Bl(a);c.tag=2,t!=null&&(c.callback=t),t=ga(e,c,a),t!==null&&(ml(t,e,a),xr(t,e,a))}};function De(e,t,a,c,d,h,v){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(c,h,v):t.prototype&&t.prototype.isPureReactComponent?!ra(a,c)||!ra(d,h):!0}function mt(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&&ve.enqueueReplaceState(t,t.state,null)}function St(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 is(e){bi(e)}function ba(e){console.error(e)}function ql(e){bi(e)}function el(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(c){setTimeout(function(){throw c})}}function ya(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 Gl(e,t,a){return a=Bl(a),a.tag=3,a.payload={element:null},a.callback=function(){el(e,t)},a}function Pa(e){return e=Bl(e),e.tag=3,e}function ps(e,t,a,c){var d=a.type.getDerivedStateFromError;if(typeof d=="function"){var h=c.value;e.payload=function(){return d(h)},e.callback=function(){ya(t,a,c)}}var v=a.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(e.callback=function(){ya(t,a,c),typeof d!="function"&&(Cr===null?Cr=new Set([this]):Cr.add(this));var S=c.stack;this.componentDidCatch(c.value,{componentStack:S!==null?S:""})})}function Mi(e,t,a,c,d){if(a.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(t=a.alternate,t!==null&&mr(t,a,d,!0),a=Zs.current,a!==null){switch(a.tag){case 31:case 13:return ol===null?Bf():a.alternate===null&&Vn===0&&(Vn=3),a.flags&=-257,a.flags|=65536,a.lanes=d,c===fc?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([c]):t.add(c),Vm(e,c,d)),!1;case 22:return a.flags|=65536,c===fc?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)),Vm(e,c,d)),!1}throw Error(r(435,a.tag))}return Vm(e,c,d),Bf(),!1}if(ft)return t=Zs.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=d,c!==hr&&(e=Error(r(422),{cause:c}),ws(Ks(e,a)))):(c!==hr&&(t=Error(r(423),{cause:c}),ws(Ks(t,a))),e=e.current.alternate,e.flags|=65536,d&=-d,e.lanes|=d,c=Ks(c,a),d=Gl(e.stateNode,c,d),gc(e,d),Vn!==4&&(Vn=2)),!1;var h=Error(r(520),{cause:c});if(h=Ks(h,a),id===null?id=[h]:id.push(h),Vn!==4&&(Vn=2),t===null)return!0;c=Ks(c,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=d&-d,a.lanes|=e,e=Gl(a.stateNode,c,e),gc(a,e),!1;case 1:if(t=a.type,h=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(Cr===null||!Cr.has(h))))return a.flags|=65536,d&=-d,a.lanes|=d,d=Pa(d),ps(d,e,a,c),gc(a,d),!1}a=a.return}while(a!==null);return!1}var Co=Error(r(461)),me=!1;function we(e,t,a,c){t.child=e===null?Eu(t,null,a,c):Ga(t,e.child,a,c)}function qe(e,t,a,c,d){a=a.render;var h=t.ref;if("ref"in c){var v={};for(var S in c)S!=="ref"&&(v[S]=c[S])}else v=c;return vi(t),c=Du(e,t,a,v,h,d),S=Iu(),e!==null&&!me?($u(e,t,d),Di(e,t,d)):(ft&&S&&Ua(t),t.flags|=1,we(e,t,c,d),t.child)}function Ve(e,t,a,c,d){if(e===null){var h=a.type;return typeof h=="function"&&!dr(h)&&h.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=h,et(e,t,h,c,d)):(e=Xs(a.type,null,c,t,t.mode,d),e.ref=t.ref,e.return=t,t.child=e)}if(h=e.child,!Tm(e,d)){var v=h.memoizedProps;if(a=a.compare,a=a!==null?a:ra,a(v,c)&&e.ref===t.ref)return Di(e,t,d)}return t.flags|=1,e=Fs(h,c),e.ref=t.ref,e.return=t,t.child=e}function et(e,t,a,c,d){if(e!==null){var h=e.memoizedProps;if(ra(h,c)&&e.ref===t.ref)if(me=!1,t.pendingProps=c=h,Tm(e,d))(e.flags&131072)!==0&&(me=!0);else return t.lanes=e.lanes,Di(e,t,d)}return jm(e,t,a,c,d)}function Ft(e,t,a,c){var d=c.children,h=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(h=h!==null?h.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&~h}else c=0,t.child=null;return ax(e,t,h,a,c)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&uo(t,h!==null?h.cachePool:null),h!==null?Au(t,h):Mu(),df(t);else return c=t.lanes=536870912,ax(e,t,h!==null?h.baseLanes|a:a,a,c)}else h!==null?(uo(t,h.cachePool),Au(t,h),Fa(),t.memoizedState=null):(e!==null&&uo(t,null),Mu(),Fa());return we(e,t,d,a),t.child}function Ri(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function ax(e,t,a,c,d){var h=dc();return h=h===null?null:{parent:Yn._currentValue,pool:h},t.memoizedState={baseLanes:a,cachePool:h},e!==null&&uo(t,null),Mu(),df(t),e!==null&&mr(e,t,c,!0),t.childLanes=d,null}function Tf(e,t){return t=Mf({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function ix(e,t,a){return Ga(t,e.child,null,a),e=Tf(t,t.pendingProps),e.flags|=2,Ws(t),t.memoizedState=null,e}function Vv(e,t,a){var c=t.pendingProps,d=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(ft){if(c.mode==="hidden")return e=Tf(t,c),t.lanes=536870912,Ri(null,e);if(Ru(t),(e=nn)?(e=__(e,rl),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Qs!==null?{id:Os,overflow:zs}:null,retryLane:536870912,hydrationErrors:null},a=_u(e),a.return=t,t.child=a,se=t,nn=null)):e=null,e===null)throw Ba(t);return t.lanes=536870912,null}return Tf(t,c)}var h=e.memoizedState;if(h!==null){var v=h.dehydrated;if(Ru(t),d)if(t.flags&256)t.flags&=-257,t=ix(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(r(558));else if(me||mr(e,t,a,!1),d=(a&e.childLanes)!==0,me||d){if(c=ln,c!==null&&(v=cn(c,a),v!==0&&v!==h.retryLane))throw h.retryLane=v,da(e,v),ml(c,e,v),Co;Bf(),t=ix(e,t,a)}else e=h.treeContext,nn=Yl(v.nextSibling),se=t,ft=!0,Il=null,rl=!1,e!==null&&nf(t,e),t=Tf(t,c),t.flags|=4096;return t}return e=Fs(e.child,{mode:c.mode,children:c.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Af(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 jm(e,t,a,c,d){return vi(t),a=Du(e,t,a,c,void 0,d),c=Iu(),e!==null&&!me?($u(e,t,d),Di(e,t,d)):(ft&&c&&Ua(t),t.flags|=1,we(e,t,a,d),t.child)}function rx(e,t,a,c,d,h){return vi(t),t.updateQueue=null,a=Ou(t,c,a,d),Lu(e),c=Iu(),e!==null&&!me?($u(e,t,h),Di(e,t,h)):(ft&&c&&Ua(t),t.flags|=1,we(e,t,a,h),t.child)}function cx(e,t,a,c,d){if(vi(t),t.stateNode===null){var h=za,v=a.contextType;typeof v=="object"&&v!==null&&(h=as(v)),h=new a(c,h),t.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=ve,t.stateNode=h,h._reactInternals=t,h=t.stateNode,h.props=c,h.state=t.memoizedState,h.refs={},Cu(t),v=a.contextType,h.context=typeof v=="object"&&v!==null?as(v):za,h.state=t.memoizedState,v=a.getDerivedStateFromProps,typeof v=="function"&&(ne(t,a,v,c),h.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(v=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),v!==h.state&&ve.enqueueReplaceState(h,h.state,null),xc(t,c,h,d),Ei(),h.state=t.memoizedState),typeof h.componentDidMount=="function"&&(t.flags|=4194308),c=!0}else if(e===null){h=t.stateNode;var S=t.memoizedProps,Y=St(a,S);h.props=Y;var fe=h.context,je=a.contextType;v=za,typeof je=="object"&&je!==null&&(v=as(je));var Ee=a.getDerivedStateFromProps;je=typeof Ee=="function"||typeof h.getSnapshotBeforeUpdate=="function",S=t.pendingProps!==S,je||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(S||fe!==v)&&mt(t,h,c,v),pa=!1;var he=t.memoizedState;h.state=he,xc(t,c,h,d),Ei(),fe=t.memoizedState,S||he!==fe||pa?(typeof Ee=="function"&&(ne(t,a,Ee,c),fe=t.memoizedState),(Y=pa||De(t,a,Y,c,he,fe,v))?(je||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(t.flags|=4194308)):(typeof h.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=c,t.memoizedState=fe),h.props=c,h.state=fe,h.context=v,c=Y):(typeof h.componentDidMount=="function"&&(t.flags|=4194308),c=!1)}else{h=t.stateNode,po(e,t),v=t.memoizedProps,je=St(a,v),h.props=je,Ee=t.pendingProps,he=h.context,fe=a.contextType,Y=za,typeof fe=="object"&&fe!==null&&(Y=as(fe)),S=a.getDerivedStateFromProps,(fe=typeof S=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(v!==Ee||he!==Y)&&mt(t,h,c,Y),pa=!1,he=t.memoizedState,h.state=he,xc(t,c,h,d),Ei();var pe=t.memoizedState;v!==Ee||he!==pe||pa||e!==null&&e.dependencies!==null&&dn(e.dependencies)?(typeof S=="function"&&(ne(t,a,S,c),pe=t.memoizedState),(je=pa||De(t,a,je,c,he,pe,Y)||e!==null&&e.dependencies!==null&&dn(e.dependencies))?(fe||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(c,pe,Y),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(c,pe,Y)),typeof h.componentDidUpdate=="function"&&(t.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof h.componentDidUpdate!="function"||v===e.memoizedProps&&he===e.memoizedState||(t.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||v===e.memoizedProps&&he===e.memoizedState||(t.flags|=1024),t.memoizedProps=c,t.memoizedState=pe),h.props=c,h.state=pe,h.context=Y,c=je):(typeof h.componentDidUpdate!="function"||v===e.memoizedProps&&he===e.memoizedState||(t.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||v===e.memoizedProps&&he===e.memoizedState||(t.flags|=1024),c=!1)}return h=c,Af(e,t),c=(t.flags&128)!==0,h||c?(h=t.stateNode,a=c&&typeof a.getDerivedStateFromError!="function"?null:h.render(),t.flags|=1,e!==null&&c?(t.child=Ga(t,e.child,null,d),t.child=Ga(t,null,a,d)):we(e,t,a,d),t.memoizedState=h.state,e=t.child):e=Di(e,t,d),e}function ox(e,t,a,c){return ma(),t.flags|=256,we(e,t,a,c),t.child}var Nm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function km(e){return{baseLanes:e,cachePool:cf()}}function wm(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=Cl),e}function ux(e,t,a){var c=t.pendingProps,d=!1,h=(t.flags&128)!==0,v;if((v=h)||(v=e!==null&&e.memoizedState===null?!1:(Mn.current&2)!==0),v&&(d=!0,t.flags&=-129),v=(t.flags&32)!==0,t.flags&=-33,e===null){if(ft){if(d?Va(t):Fa(),(e=nn)?(e=__(e,rl),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Qs!==null?{id:Os,overflow:zs}:null,retryLane:536870912,hydrationErrors:null},a=_u(e),a.return=t,t.child=a,se=t,nn=null)):e=null,e===null)throw Ba(t);return rp(e)?t.lanes=32:t.lanes=536870912,null}var S=c.children;return c=c.fallback,d?(Fa(),d=t.mode,S=Mf({mode:"hidden",children:S},d),c=Ia(c,d,a,null),S.return=t,c.return=t,S.sibling=c,t.child=S,c=t.child,c.memoizedState=km(a),c.childLanes=wm(e,v,a),t.memoizedState=Nm,Ri(null,c)):(Va(t),Sm(t,S))}var Y=e.memoizedState;if(Y!==null&&(S=Y.dehydrated,S!==null)){if(h)t.flags&256?(Va(t),t.flags&=-257,t=Em(e,t,a)):t.memoizedState!==null?(Fa(),t.child=e.child,t.flags|=128,t=null):(Fa(),S=c.fallback,d=t.mode,c=Mf({mode:"visible",children:c.children},d),S=Ia(S,d,a,null),S.flags|=2,c.return=t,S.return=t,c.sibling=S,t.child=c,Ga(t,e.child,null,a),c=t.child,c.memoizedState=km(a),c.childLanes=wm(e,v,a),t.memoizedState=Nm,t=Ri(null,c));else if(Va(t),rp(S)){if(v=S.nextSibling&&S.nextSibling.dataset,v)var fe=v.dgst;v=fe,c=Error(r(419)),c.stack="",c.digest=v,ws({value:c,source:null,stack:null}),t=Em(e,t,a)}else if(me||mr(e,t,a,!1),v=(a&e.childLanes)!==0,me||v){if(v=ln,v!==null&&(c=cn(v,a),c!==0&&c!==Y.retryLane))throw Y.retryLane=c,da(e,c),ml(v,e,c),Co;ip(S)||Bf(),t=Em(e,t,a)}else ip(S)?(t.flags|=192,t.child=e.child,t=null):(e=Y.treeContext,nn=Yl(S.nextSibling),se=t,ft=!0,Il=null,rl=!1,e!==null&&nf(t,e),t=Sm(t,c.children),t.flags|=4096);return t}return d?(Fa(),S=c.fallback,d=t.mode,Y=e.child,fe=Y.sibling,c=Fs(Y,{mode:"hidden",children:c.children}),c.subtreeFlags=Y.subtreeFlags&65011712,fe!==null?S=Fs(fe,S):(S=Ia(S,d,a,null),S.flags|=2),S.return=t,c.return=t,c.sibling=S,t.child=c,Ri(null,c),c=t.child,S=e.child.memoizedState,S===null?S=km(a):(d=S.cachePool,d!==null?(Y=Yn._currentValue,d=d.parent!==Y?{parent:Y,pool:Y}:d):d=cf(),S={baseLanes:S.baseLanes|a,cachePool:d}),c.memoizedState=S,c.childLanes=wm(e,v,a),t.memoizedState=Nm,Ri(e.child,c)):(Va(t),a=e.child,e=a.sibling,a=Fs(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 Sm(e,t){return t=Mf({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Mf(e,t){return e=It(22,e,null,t),e.lanes=0,e}function Em(e,t,a){return Ga(t,e.child,null,a),e=Sm(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function dx(e,t,a){e.lanes|=t;var c=e.alternate;c!==null&&(c.lanes|=t),vu(e.return,t,a)}function Cm(e,t,a,c,d,h){var v=e.memoizedState;v===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:c,tail:a,tailMode:d,treeForkCount:h}:(v.isBackwards=t,v.rendering=null,v.renderingStartTime=0,v.last=c,v.tail=a,v.tailMode=d,v.treeForkCount=h)}function fx(e,t,a){var c=t.pendingProps,d=c.revealOrder,h=c.tail;c=c.children;var v=Mn.current,S=(v&2)!==0;if(S?(v=v&1|2,t.flags|=128):v&=1,U(Mn,v),we(e,t,c,a),c=ft?ms:0,!S&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&dx(e,a,t);else if(e.tag===19)dx(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&&xo(e)===null&&(d=a),a=a.sibling;a=d,a===null?(d=t.child,t.child=null):(d=a.sibling,a.sibling=null),Cm(t,!1,d,a,h,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&&xo(e)===null){t.child=d;break}e=d.sibling,d.sibling=a,a=d,d=e}Cm(t,!0,a,null,h,c);break;case"together":Cm(t,!1,null,null,void 0,c);break;default:t.memoizedState=null}return t.child}function Di(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),Er|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(mr(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=Fs(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=Fs(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function Tm(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&dn(e)))}function Fv(e,t,a){switch(t.tag){case 3:Ke(t,t.stateNode.containerInfo),Ha(t,Yn,e.memoizedState.cache),ma();break;case 27:case 5:Be(t);break;case 4:Ke(t,t.stateNode.containerInfo);break;case 10:Ha(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?(Va(t),t.flags|=128,null):(a&t.child.childLanes)!==0?ux(e,t,a):(Va(t),e=Di(e,t,a),e!==null?e.sibling:null);Va(t);break;case 19:var d=(e.flags&128)!==0;if(c=(a&t.childLanes)!==0,c||(mr(e,t,a,!1),c=(a&t.childLanes)!==0),d){if(c)return fx(e,t,a);t.flags|=128}if(d=t.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),U(Mn,Mn.current),c)break;return null;case 22:return t.lanes=0,Ft(e,t,a,t.pendingProps);case 24:Ha(t,Yn,e.memoizedState.cache)}return Di(e,t,a)}function hx(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)me=!0;else{if(!Tm(e,a)&&(t.flags&128)===0)return me=!1,Fv(e,t,a);me=(e.flags&131072)!==0}else me=!1,ft&&(t.flags&1048576)!==0&&bu(t,ms,t.index);switch(t.lanes=0,t.tag){case 16:e:{var c=t.pendingProps;if(e=ki(t.elementType),t.type=e,typeof e=="function")dr(e)?(c=St(e,c),t.tag=1,t=cx(null,t,e,c,a)):(t.tag=0,t=jm(null,t,e,c,a));else{if(e!=null){var d=e.$$typeof;if(d===te){t.tag=11,t=qe(null,t,e,c,a);break e}else if(d===$){t.tag=14,t=Ve(null,t,e,c,a);break e}}throw t=ue(e)||e,Error(r(306,t,""))}}return t;case 0:return jm(e,t,t.type,t.pendingProps,a);case 1:return c=t.type,d=St(c,t.pendingProps),cx(e,t,c,d,a);case 3:e:{if(Ke(t,t.stateNode.containerInfo),e===null)throw Error(r(387));c=t.pendingProps;var h=t.memoizedState;d=h.element,po(e,t),xc(t,c,null,a);var v=t.memoizedState;if(c=v.cache,Ha(t,Yn,c),c!==h.cache&&ro(t,[Yn],a,!0),Ei(),c=v.element,h.isDehydrated)if(h={element:c,isDehydrated:!1,cache:v.cache},t.updateQueue.baseState=h,t.memoizedState=h,t.flags&256){t=ox(e,t,c,a);break e}else if(c!==d){d=Ks(Error(r(424)),t),ws(d),t=ox(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(nn=Yl(e.firstChild),se=t,ft=!0,Il=null,rl=!0,a=Eu(t,null,c,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(ma(),c===d){t=Di(e,t,a);break e}we(e,t,c,a)}t=t.child}return t;case 26:return Af(e,t),e===null?(a=k_(t.type,null,t.pendingProps,null))?t.memoizedState=a:ft||(a=t.type,e=t.pendingProps,c=Xf(ie.current).createElement(a),c[Tt]=t,c[gn]=e,Es(c,a,e),He(c),t.stateNode=c):t.memoizedState=k_(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Be(t),e===null&&ft&&(c=t.stateNode=v_(t.type,t.pendingProps,ie.current),se=t,rl=!0,d=nn,Rr(t.type)?(cp=d,nn=Yl(c.firstChild)):nn=d),we(e,t,t.pendingProps.children,a),Af(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ft&&((d=c=nn)&&(c=jj(c,t.type,t.pendingProps,rl),c!==null?(t.stateNode=c,se=t,nn=Yl(c.firstChild),rl=!1,d=!0):d=!1),d||Ba(t)),Be(t),d=t.type,h=t.pendingProps,v=e!==null?e.memoizedProps:null,c=h.children,sp(d,h)?c=null:v!==null&&sp(d,v)&&(t.flags|=32),t.memoizedState!==null&&(d=Du(e,t,zu,null,null,a),md._currentValue=d),Af(e,t),we(e,t,c,a),t.child;case 6:return e===null&&ft&&((e=a=nn)&&(a=Nj(a,t.pendingProps,rl),a!==null?(t.stateNode=a,se=t,nn=null,e=!0):e=!1),e||Ba(t)),null;case 13:return ux(e,t,a);case 4:return Ke(t,t.stateNode.containerInfo),c=t.pendingProps,e===null?t.child=Ga(t,null,c,a):we(e,t,c,a),t.child;case 11:return qe(e,t,t.type,t.pendingProps,a);case 7:return we(e,t,t.pendingProps,a),t.child;case 8:return we(e,t,t.pendingProps.children,a),t.child;case 12:return we(e,t,t.pendingProps.children,a),t.child;case 10:return c=t.pendingProps,Ha(t,t.type,c.value),we(e,t,c.children,a),t.child;case 9:return d=t.type._context,c=t.pendingProps.children,vi(t),d=as(d),c=c(d),t.flags|=1,we(e,t,c,a),t.child;case 14:return Ve(e,t,t.type,t.pendingProps,a);case 15:return et(e,t,t.type,t.pendingProps,a);case 19:return fx(e,t,a);case 31:return Vv(e,t,a);case 22:return Ft(e,t,a,t.pendingProps);case 24:return vi(t),c=as(Yn),e===null?(d=dc(),d===null&&(d=ln,h=oo(),d.pooledCache=h,h.refCount++,h!==null&&(d.pooledCacheLanes|=a),d=h),t.memoizedState={parent:c,cache:d},Cu(t),Ha(t,Yn,d)):((e.lanes&a)!==0&&(po(e,t),xc(t,null,null,a),Ei()),d=e.memoizedState,h=t.memoizedState,d.parent!==c?(d={parent:c,cache:c},t.memoizedState=d,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=d),Ha(t,Yn,c)):(c=h.cache,Ha(t,Yn,c),c!==d.cache&&ro(t,[Yn],a,!0))),we(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(r(156,t.tag))}function Li(e){e.flags|=4}function Am(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(Bx())e.flags|=8192;else throw wi=fc,Nu}else e.flags&=-16777217}function mx(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!T_(t))if(Bx())e.flags|=8192;else throw wi=fc,Nu}function Rf(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?In():536870912,e.lanes|=t,Ro|=t)}function ed(e,t){if(!ft)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 bn(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 Xv(e,t,a){var c=t.pendingProps;switch(ao(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return bn(t),null;case 1:return bn(t),null;case 3:return a=t.stateNode,c=null,e!==null&&(c=e.memoizedState.cache),t.memoizedState.cache!==c&&(t.flags|=2048),Kn(Yn),Ne(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(X(t)?Li(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Nl())),bn(t),null;case 26:var d=t.type,h=t.memoizedState;return e===null?(Li(t),h!==null?(bn(t),mx(t,h)):(bn(t),Am(t,d,null,c,a))):h?h!==e.memoizedState?(Li(t),bn(t),mx(t,h)):(bn(t),t.flags&=-16777217):(e=e.memoizedProps,e!==c&&Li(t),bn(t),Am(t,d,e,c,a)),null;case 27:if(Xe(t),a=ie.current,d=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==c&&Li(t);else{if(!c){if(t.stateNode===null)throw Error(r(166));return bn(t),null}e=be.current,X(t)?sf(t):(e=v_(d,c,a),t.stateNode=e,Li(t))}return bn(t),null;case 5:if(Xe(t),d=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==c&&Li(t);else{if(!c){if(t.stateNode===null)throw Error(r(166));return bn(t),null}if(h=be.current,X(t))sf(t);else{var v=Xf(ie.current);switch(h){case 1:h=v.createElementNS("http://www.w3.org/2000/svg",d);break;case 2:h=v.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;default:switch(d){case"svg":h=v.createElementNS("http://www.w3.org/2000/svg",d);break;case"math":h=v.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;case"script":h=v.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof c.is=="string"?v.createElement("select",{is:c.is}):v.createElement("select"),c.multiple?h.multiple=!0:c.size&&(h.size=c.size);break;default:h=typeof c.is=="string"?v.createElement(d,{is:c.is}):v.createElement(d)}}h[Tt]=t,h[gn]=c;e:for(v=t.child;v!==null;){if(v.tag===5||v.tag===6)h.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=h;e:switch(Es(h,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&&Li(t)}}return bn(t),Am(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==c&&Li(t);else{if(typeof c!="string"&&t.stateNode===null)throw Error(r(166));if(e=ie.current,X(t)){if(e=t.stateNode,a=t.memoizedProps,c=null,d=se,d!==null)switch(d.tag){case 27:case 5:c=d.memoizedProps}e[Tt]=t,e=!!(e.nodeValue===a||c!==null&&c.suppressHydrationWarning===!0||u_(e.nodeValue,a)),e||Ba(t,!0)}else e=Xf(e).createTextNode(c),e[Tt]=t,t.stateNode=e}return bn(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(c=X(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[Tt]=t}else ma(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;bn(t),e=!1}else a=Nl(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(Ws(t),t):(Ws(t),null);if((t.flags&128)!==0)throw Error(r(558))}return bn(t),null;case 13:if(c=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(d=X(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[Tt]=t}else ma(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;bn(t),d=!1}else d=Nl(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=d),d=!0;if(!d)return t.flags&256?(Ws(t),t):(Ws(t),null)}return Ws(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),h=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(h=c.memoizedState.cachePool.pool),h!==d&&(c.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),Rf(t,t.updateQueue),bn(t),null);case 4:return Ne(),e===null&&Wm(t.stateNode.containerInfo),bn(t),null;case 10:return Kn(t.type),bn(t),null;case 19:if(V(Mn),c=t.memoizedState,c===null)return bn(t),null;if(d=(t.flags&128)!==0,h=c.rendering,h===null)if(d)ed(c,!1);else{if(Vn!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(h=xo(e),h!==null){for(t.flags|=128,ed(c,!1),e=h.updateQueue,t.updateQueue=e,Rf(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)fr(a,e),a=a.sibling;return U(Mn,Mn.current&1|2),ft&&Ps(t,c.treeForkCount),t.child}e=e.sibling}c.tail!==null&&ht()>If&&(t.flags|=128,d=!0,ed(c,!1),t.lanes=4194304)}else{if(!d)if(e=xo(h),e!==null){if(t.flags|=128,d=!0,e=e.updateQueue,t.updateQueue=e,Rf(t,e),ed(c,!0),c.tail===null&&c.tailMode==="hidden"&&!h.alternate&&!ft)return bn(t),null}else 2*ht()-c.renderingStartTime>If&&a!==536870912&&(t.flags|=128,d=!0,ed(c,!1),t.lanes=4194304);c.isBackwards?(h.sibling=t.child,t.child=h):(e=c.last,e!==null?e.sibling=h:t.child=h,c.last=h)}return c.tail!==null?(e=c.tail,c.rendering=e,c.tail=e.sibling,c.renderingStartTime=ht(),e.sibling=null,a=Mn.current,U(Mn,d?a&1|2:a&1),ft&&Ps(t,c.treeForkCount),e):(bn(t),null);case 22:case 23:return Ws(t),go(),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&&(bn(t),t.subtreeFlags&6&&(t.flags|=8192)):bn(t),a=t.updateQueue,a!==null&&Rf(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&&V(Ni),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Kn(Yn),bn(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function Kv(e,t){switch(ao(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Kn(Yn),Ne(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Xe(t),null;case 31:if(t.memoizedState!==null){if(Ws(t),t.alternate===null)throw Error(r(340));ma()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Ws(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));ma()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(Mn),null;case 4:return Ne(),null;case 10:return Kn(t.type),null;case 22:case 23:return Ws(t),go(),e!==null&&V(Ni),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Kn(Yn),null;case 25:return null;default:return null}}function px(e,t){switch(ao(t),t.tag){case 3:Kn(Yn),Ne();break;case 26:case 27:case 5:Xe(t);break;case 4:Ne();break;case 31:t.memoizedState!==null&&Ws(t);break;case 13:Ws(t);break;case 19:V(Mn);break;case 10:Kn(t.type);break;case 22:case 23:Ws(t),go(),e!==null&&V(Ni);break;case 24:Kn(Yn)}}function td(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 h=a.create,v=a.inst;c=h(),v.destroy=c}a=a.next}while(a!==d)}}catch(S){Pt(t,t.return,S)}}function wr(e,t,a){try{var c=t.updateQueue,d=c!==null?c.lastEffect:null;if(d!==null){var h=d.next;c=h;do{if((c.tag&e)===e){var v=c.inst,S=v.destroy;if(S!==void 0){v.destroy=void 0,d=t;var Y=a,fe=S;try{fe()}catch(je){Pt(d,Y,je)}}}c=c.next}while(c!==h)}}catch(je){Pt(t,t.return,je)}}function gx(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{uf(t,a)}catch(c){Pt(e,e.return,c)}}}function xx(e,t,a){a.props=St(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(c){Pt(e,t,c)}}function nd(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){Pt(e,t,d)}}function Za(e,t){var a=e.ref,c=e.refCleanup;if(a!==null)if(typeof c=="function")try{c()}catch(d){Pt(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){Pt(e,t,d)}else a.current=null}function _x(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){Pt(e,e.return,d)}}function Mm(e,t,a){try{var c=e.stateNode;gj(c,e.type,a,t),c[gn]=t}catch(d){Pt(e,e.return,d)}}function bx(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Rr(e.type)||e.tag===4}function Rm(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||bx(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&&Rr(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 Dm(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=xt));else if(c!==4&&(c===27&&Rr(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(Dm(e,t,a),e=e.sibling;e!==null;)Dm(e,t,a),e=e.sibling}function Df(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&&Rr(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Df(e,t,a),e=e.sibling;e!==null;)Df(e,t,a),e=e.sibling}function yx(e){var t=e.stateNode,a=e.memoizedProps;try{for(var c=e.type,d=t.attributes;d.length;)t.removeAttributeNode(d[0]);Es(t,c,a),t[Tt]=e,t[gn]=a}catch(h){Pt(e,e.return,h)}}var Oi=!1,Wn=!1,Lm=!1,vx=typeof WeakSet=="function"?WeakSet:Set,gs=null;function Qv(e,t){if(e=e.containerInfo,tp=eh,e=Jc(e),eo(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,h=c.focusNode;c=c.focusOffset;try{a.nodeType,h.nodeType}catch{a=null;break e}var v=0,S=-1,Y=-1,fe=0,je=0,Ee=e,he=null;t:for(;;){for(var pe;Ee!==a||d!==0&&Ee.nodeType!==3||(S=v+d),Ee!==h||c!==0&&Ee.nodeType!==3||(Y=v+c),Ee.nodeType===3&&(v+=Ee.nodeValue.length),(pe=Ee.firstChild)!==null;)he=Ee,Ee=pe;for(;;){if(Ee===e)break t;if(he===a&&++fe===d&&(S=v),he===h&&++je===c&&(Y=v),(pe=Ee.nextSibling)!==null)break;Ee=he,he=Ee.parentNode}Ee=pe}a=S===-1||Y===-1?null:{start:S,end:Y}}else a=null}a=a||{start:0,end:0}}else a=null;for(np={focusedElem:e,selectionRange:a},eh=!1,gs=t;gs!==null;)if(t=gs,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,gs=e;else for(;gs!==null;){switch(t=gs,h=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&&h!==null){e=void 0,a=t,d=h.memoizedProps,h=h.memoizedState,c=a.stateNode;try{var Ge=St(a.type,d);e=c.getSnapshotBeforeUpdate(Ge,h),c.__reactInternalSnapshotBeforeUpdate=e}catch(nt){Pt(a,a.return,nt)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)ap(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":ap(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,gs=e;break}gs=t.return}}function jx(e,t,a){var c=a.flags;switch(a.tag){case 0:case 11:case 15:Ii(e,a),c&4&&td(5,a);break;case 1:if(Ii(e,a),c&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(v){Pt(a,a.return,v)}else{var d=St(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(d,t,e.__reactInternalSnapshotBeforeUpdate)}catch(v){Pt(a,a.return,v)}}c&64&&gx(a),c&512&&nd(a,a.return);break;case 3:if(Ii(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{uf(e,t)}catch(v){Pt(a,a.return,v)}}break;case 27:t===null&&c&4&&yx(a);case 26:case 5:Ii(e,a),t===null&&c&4&&_x(a),c&512&&nd(a,a.return);break;case 12:Ii(e,a);break;case 31:Ii(e,a),c&4&&wx(e,a);break;case 13:Ii(e,a),c&4&&Sx(e,a),c&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=lj.bind(null,a),kj(e,a))));break;case 22:if(c=a.memoizedState!==null||Oi,!c){t=t!==null&&t.memoizedState!==null||Wn,d=Oi;var h=Wn;Oi=c,(Wn=t)&&!h?$i(e,a,(a.subtreeFlags&8772)!==0):Ii(e,a),Oi=d,Wn=h}break;case 30:break;default:Ii(e,a)}}function Nx(e){var t=e.alternate;t!==null&&(e.alternate=null,Nx(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Rs(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 wn=null,ul=!1;function zi(e,t,a){for(a=a.child;a!==null;)kx(e,t,a),a=a.sibling}function kx(e,t,a){if(_t&&typeof _t.onCommitFiberUnmount=="function")try{_t.onCommitFiberUnmount(st,a)}catch{}switch(a.tag){case 26:Wn||Za(a,t),zi(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Wn||Za(a,t);var c=wn,d=ul;Rr(a.type)&&(wn=a.stateNode,ul=!1),zi(e,t,a),dd(a.stateNode),wn=c,ul=d;break;case 5:Wn||Za(a,t);case 6:if(c=wn,d=ul,wn=null,zi(e,t,a),wn=c,ul=d,wn!==null)if(ul)try{(wn.nodeType===9?wn.body:wn.nodeName==="HTML"?wn.ownerDocument.body:wn).removeChild(a.stateNode)}catch(h){Pt(a,t,h)}else try{wn.removeChild(a.stateNode)}catch(h){Pt(a,t,h)}break;case 18:wn!==null&&(ul?(e=wn,g_(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),Bo(e)):g_(wn,a.stateNode));break;case 4:c=wn,d=ul,wn=a.stateNode.containerInfo,ul=!0,zi(e,t,a),wn=c,ul=d;break;case 0:case 11:case 14:case 15:wr(2,a,t),Wn||wr(4,a,t),zi(e,t,a);break;case 1:Wn||(Za(a,t),c=a.stateNode,typeof c.componentWillUnmount=="function"&&xx(a,t,c)),zi(e,t,a);break;case 21:zi(e,t,a);break;case 22:Wn=(c=Wn)||a.memoizedState!==null,zi(e,t,a),Wn=c;break;default:zi(e,t,a)}}function wx(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Bo(e)}catch(a){Pt(t,t.return,a)}}}function Sx(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Bo(e)}catch(a){Pt(t,t.return,a)}}function Pv(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new vx),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new vx),t;default:throw Error(r(435,e.tag))}}function Lf(e,t){var a=Pv(e);t.forEach(function(c){if(!a.has(c)){a.add(c);var d=aj.bind(null,e,c);c.then(d,d)}})}function dl(e,t){var a=t.deletions;if(a!==null)for(var c=0;c<a.length;c++){var d=a[c],h=e,v=t,S=v;e:for(;S!==null;){switch(S.tag){case 27:if(Rr(S.type)){wn=S.stateNode,ul=!1;break e}break;case 5:wn=S.stateNode,ul=!1;break e;case 3:case 4:wn=S.stateNode.containerInfo,ul=!0;break e}S=S.return}if(wn===null)throw Error(r(160));kx(h,v,d),wn=null,ul=!1,h=d.alternate,h!==null&&(h.return=null),d.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Ex(t,e),t=t.sibling}var va=null;function Ex(e,t){var a=e.alternate,c=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:dl(t,e),fl(e),c&4&&(wr(3,e,e.return),td(3,e),wr(5,e,e.return));break;case 1:dl(t,e),fl(e),c&512&&(Wn||a===null||Za(a,a.return)),c&64&&Oi&&(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(dl(t,e),fl(e),c&512&&(Wn||a===null||Za(a,a.return)),c&4){var h=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":h=d.getElementsByTagName("title")[0],(!h||h[At]||h[Tt]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=d.createElement(c),d.head.insertBefore(h,d.querySelector("head > title"))),Es(h,c,a),h[Tt]=e,He(h),c=h;break e;case"link":var v=E_("link","href",d).get(c+(a.href||""));if(v){for(var S=0;S<v.length;S++)if(h=v[S],h.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&h.getAttribute("rel")===(a.rel==null?null:a.rel)&&h.getAttribute("title")===(a.title==null?null:a.title)&&h.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){v.splice(S,1);break t}}h=d.createElement(c),Es(h,c,a),d.head.appendChild(h);break;case"meta":if(v=E_("meta","content",d).get(c+(a.content||""))){for(S=0;S<v.length;S++)if(h=v[S],h.getAttribute("content")===(a.content==null?null:""+a.content)&&h.getAttribute("name")===(a.name==null?null:a.name)&&h.getAttribute("property")===(a.property==null?null:a.property)&&h.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&h.getAttribute("charset")===(a.charSet==null?null:a.charSet)){v.splice(S,1);break t}}h=d.createElement(c),Es(h,c,a),d.head.appendChild(h);break;default:throw Error(r(468,c))}h[Tt]=e,He(h),c=h}e.stateNode=c}else C_(d,e.type,e.stateNode);else e.stateNode=S_(d,c,e.memoizedProps);else h!==c?(h===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):h.count--,c===null?C_(d,e.type,e.stateNode):S_(d,c,e.memoizedProps)):c===null&&e.stateNode!==null&&Mm(e,e.memoizedProps,a.memoizedProps)}break;case 27:dl(t,e),fl(e),c&512&&(Wn||a===null||Za(a,a.return)),a!==null&&c&4&&Mm(e,e.memoizedProps,a.memoizedProps);break;case 5:if(dl(t,e),fl(e),c&512&&(Wn||a===null||Za(a,a.return)),e.flags&32){d=e.stateNode;try{Ys(d,"")}catch(Ge){Pt(e,e.return,Ge)}}c&4&&e.stateNode!=null&&(d=e.memoizedProps,Mm(e,d,a!==null?a.memoizedProps:d)),c&1024&&(Lm=!0);break;case 6:if(dl(t,e),fl(e),c&4){if(e.stateNode===null)throw Error(r(162));c=e.memoizedProps,a=e.stateNode;try{a.nodeValue=c}catch(Ge){Pt(e,e.return,Ge)}}break;case 3:if(Pf=null,d=va,va=Kf(t.containerInfo),dl(t,e),va=d,fl(e),c&4&&a!==null&&a.memoizedState.isDehydrated)try{Bo(t.containerInfo)}catch(Ge){Pt(e,e.return,Ge)}Lm&&(Lm=!1,Cx(e));break;case 4:c=va,va=Kf(e.stateNode.containerInfo),dl(t,e),fl(e),va=c;break;case 12:dl(t,e),fl(e);break;case 31:dl(t,e),fl(e),c&4&&(c=e.updateQueue,c!==null&&(e.updateQueue=null,Lf(e,c)));break;case 13:dl(t,e),fl(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(zf=ht()),c&4&&(c=e.updateQueue,c!==null&&(e.updateQueue=null,Lf(e,c)));break;case 22:d=e.memoizedState!==null;var Y=a!==null&&a.memoizedState!==null,fe=Oi,je=Wn;if(Oi=fe||d,Wn=je||Y,dl(t,e),Wn=je,Oi=fe,fl(e),c&8192)e:for(t=e.stateNode,t._visibility=d?t._visibility&-2:t._visibility|1,d&&(a===null||Y||Oi||Wn||Cc(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){Y=a=t;try{if(h=Y.stateNode,d)v=h.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{S=Y.stateNode;var Ee=Y.memoizedProps.style,he=Ee!=null&&Ee.hasOwnProperty("display")?Ee.display:null;S.style.display=he==null||typeof he=="boolean"?"":(""+he).trim()}}catch(Ge){Pt(Y,Y.return,Ge)}}}else if(t.tag===6){if(a===null){Y=t;try{Y.stateNode.nodeValue=d?"":Y.memoizedProps}catch(Ge){Pt(Y,Y.return,Ge)}}}else if(t.tag===18){if(a===null){Y=t;try{var pe=Y.stateNode;d?x_(pe,!0):x_(Y.stateNode,!1)}catch(Ge){Pt(Y,Y.return,Ge)}}}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,Lf(e,a))));break;case 19:dl(t,e),fl(e),c&4&&(c=e.updateQueue,c!==null&&(e.updateQueue=null,Lf(e,c)));break;case 30:break;case 21:break;default:dl(t,e),fl(e)}}function fl(e){var t=e.flags;if(t&2){try{for(var a,c=e.return;c!==null;){if(bx(c)){a=c;break}c=c.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var d=a.stateNode,h=Rm(e);Df(e,h,d);break;case 5:var v=a.stateNode;a.flags&32&&(Ys(v,""),a.flags&=-33);var S=Rm(e);Df(e,S,v);break;case 3:case 4:var Y=a.stateNode.containerInfo,fe=Rm(e);Dm(e,fe,Y);break;default:throw Error(r(161))}}catch(je){Pt(e,e.return,je)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Cx(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Cx(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Ii(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)jx(e,t.alternate,t),t=t.sibling}function Cc(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:wr(4,t,t.return),Cc(t);break;case 1:Za(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&xx(t,t.return,a),Cc(t);break;case 27:dd(t.stateNode);case 26:case 5:Za(t,t.return),Cc(t);break;case 22:t.memoizedState===null&&Cc(t);break;case 30:Cc(t);break;default:Cc(t)}e=e.sibling}}function $i(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var c=t.alternate,d=e,h=t,v=h.flags;switch(h.tag){case 0:case 11:case 15:$i(d,h,a),td(4,h);break;case 1:if($i(d,h,a),c=h,d=c.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch(fe){Pt(c,c.return,fe)}if(c=h,d=c.updateQueue,d!==null){var S=c.stateNode;try{var Y=d.shared.hiddenCallbacks;if(Y!==null)for(d.shared.hiddenCallbacks=null,d=0;d<Y.length;d++)of(Y[d],S)}catch(fe){Pt(c,c.return,fe)}}a&&v&64&&gx(h),nd(h,h.return);break;case 27:yx(h);case 26:case 5:$i(d,h,a),a&&c===null&&v&4&&_x(h),nd(h,h.return);break;case 12:$i(d,h,a);break;case 31:$i(d,h,a),a&&v&4&&wx(d,h);break;case 13:$i(d,h,a),a&&v&4&&Sx(d,h);break;case 22:h.memoizedState===null&&$i(d,h,a),nd(h,h.return);break;case 30:break;default:$i(d,h,a)}t=t.sibling}}function Om(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&&cc(a))}function zm(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&cc(e))}function ja(e,t,a,c){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Tx(e,t,a,c),t=t.sibling}function Tx(e,t,a,c){var d=t.flags;switch(t.tag){case 0:case 11:case 15:ja(e,t,a,c),d&2048&&td(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&&cc(e)));break;case 12:if(d&2048){ja(e,t,a,c),e=t.stateNode;try{var h=t.memoizedProps,v=h.id,S=h.onPostCommit;typeof S=="function"&&S(v,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(Y){Pt(t,t.return,Y)}}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:h=t.stateNode,v=t.alternate,t.memoizedState!==null?h._visibility&2?ja(e,t,a,c):sd(e,t):h._visibility&2?ja(e,t,a,c):(h._visibility|=2,To(e,t,a,c,(t.subtreeFlags&10256)!==0||!1)),d&2048&&Om(v,t);break;case 24:ja(e,t,a,c),d&2048&&zm(t.alternate,t);break;default:ja(e,t,a,c)}}function To(e,t,a,c,d){for(d=d&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var h=e,v=t,S=a,Y=c,fe=v.flags;switch(v.tag){case 0:case 11:case 15:To(h,v,S,Y,d),td(8,v);break;case 23:break;case 22:var je=v.stateNode;v.memoizedState!==null?je._visibility&2?To(h,v,S,Y,d):sd(h,v):(je._visibility|=2,To(h,v,S,Y,d)),d&&fe&2048&&Om(v.alternate,v);break;case 24:To(h,v,S,Y,d),d&&fe&2048&&zm(v.alternate,v);break;default:To(h,v,S,Y,d)}t=t.sibling}}function sd(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:sd(a,c),d&2048&&Om(c.alternate,c);break;case 24:sd(a,c),d&2048&&zm(c.alternate,c);break;default:sd(a,c)}t=t.sibling}}var ld=8192;function Ao(e,t,a){if(e.subtreeFlags&ld)for(e=e.child;e!==null;)Ax(e,t,a),e=e.sibling}function Ax(e,t,a){switch(e.tag){case 26:Ao(e,t,a),e.flags&ld&&e.memoizedState!==null&&zj(a,va,e.memoizedState,e.memoizedProps);break;case 5:Ao(e,t,a);break;case 3:case 4:var c=va;va=Kf(e.stateNode.containerInfo),Ao(e,t,a),va=c;break;case 22:e.memoizedState===null&&(c=e.alternate,c!==null&&c.memoizedState!==null?(c=ld,ld=16777216,Ao(e,t,a),ld=c):Ao(e,t,a));break;default:Ao(e,t,a)}}function Mx(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 ad(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];gs=c,Dx(c,e)}Mx(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Rx(e),e=e.sibling}function Rx(e){switch(e.tag){case 0:case 11:case 15:ad(e),e.flags&2048&&wr(9,e,e.return);break;case 3:ad(e);break;case 12:ad(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Of(e)):ad(e);break;default:ad(e)}}function Of(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];gs=c,Dx(c,e)}Mx(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:wr(8,t,t.return),Of(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,Of(t));break;default:Of(t)}e=e.sibling}}function Dx(e,t){for(;gs!==null;){var a=gs;switch(a.tag){case 0:case 11:case 15:wr(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:cc(a.memoizedState.cache)}if(c=a.child,c!==null)c.return=a,gs=c;else e:for(a=e;gs!==null;){c=gs;var d=c.sibling,h=c.return;if(Nx(c),c===a){gs=null;break e}if(d!==null){d.return=h,gs=d;break e}gs=h}}}var Zv={getCacheForType:function(e){var t=as(Yn),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return as(Yn).controller.signal}},Wv=typeof WeakMap=="function"?WeakMap:Map,Ht=0,ln=null,jt=null,Et=0,Qt=0,El=null,Sr=!1,Mo=!1,Im=!1,Ui=0,Vn=0,Er=0,Tc=0,$m=0,Cl=0,Ro=0,id=null,hl=null,Um=!1,zf=0,Lx=0,If=1/0,$f=null,Cr=null,rs=0,Tr=null,Do=null,Bi=0,Bm=0,Hm=null,Ox=null,rd=0,qm=null;function Tl(){return(Ht&2)!==0&&Et!==0?Et&-Et:D.T!==null?Km():mn()}function zx(){if(Cl===0)if((Et&536870912)===0||ft){var e=rt;rt<<=1,(rt&3932160)===0&&(rt=262144),Cl=e}else Cl=536870912;return e=Zs.current,e!==null&&(e.flags|=32),Cl}function ml(e,t,a){(e===ln&&(Qt===2||Qt===9)||e.cancelPendingCommit!==null)&&(Lo(e,0),Ar(e,Et,Cl,!1)),cs(e,a),((Ht&2)===0||e!==ln)&&(e===ln&&((Ht&2)===0&&(Tc|=a),Vn===4&&Ar(e,Et,Cl,!1)),Wa(e))}function Ix(e,t,a){if((Ht&6)!==0)throw Error(r(327));var c=!a&&(t&127)===0&&(t&e.expiredLanes)===0||gt(e,t),d=c?tj(e,t):Ym(e,t,!0),h=c;do{if(d===0){Mo&&!c&&Ar(e,t,0,!1);break}else{if(a=e.current.alternate,h&&!Jv(a)){d=Ym(e,t,!1),h=!1;continue}if(d===2){if(h=t,e.errorRecoveryDisabledLanes&h)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=id;var Y=S.current.memoizedState.isDehydrated;if(Y&&(Lo(S,v).flags|=256),v=Ym(S,v,!1),v!==2){if(Im&&!Y){S.errorRecoveryDisabledLanes|=h,Tc|=h,d=4;break e}h=hl,hl=d,h!==null&&(hl===null?hl=h:hl.push.apply(hl,h))}d=v}if(h=!1,d!==2)continue}}if(d===1){Lo(e,0),Ar(e,t,0,!0);break}e:{switch(c=e,h=d,h){case 0:case 1:throw Error(r(345));case 4:if((t&4194048)!==t)break;case 6:Ar(c,t,Cl,!Sr);break e;case 2:hl=null;break;case 3:case 5:break;default:throw Error(r(329))}if((t&62914560)===t&&(d=zf+300-ht(),10<d)){if(Ar(c,t,Cl,!Sr),dt(c,0,!0)!==0)break e;Bi=t,c.timeoutHandle=m_($x.bind(null,c,a,hl,$f,Um,t,Cl,Tc,Ro,Sr,h,"Throttled",-0,0),d);break e}$x(c,a,hl,$f,Um,t,Cl,Tc,Ro,Sr,h,null,-0,0)}}break}while(!0);Wa(e)}function $x(e,t,a,c,d,h,v,S,Y,fe,je,Ee,he,pe){if(e.timeoutHandle=-1,Ee=t.subtreeFlags,Ee&8192||(Ee&16785408)===16785408){Ee={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:xt},Ax(t,h,Ee);var Ge=(h&62914560)===h?zf-ht():(h&4194048)===h?Lx-ht():0;if(Ge=Ij(Ee,Ge),Ge!==null){Bi=h,e.cancelPendingCommit=Ge(Fx.bind(null,e,t,h,a,c,d,v,S,Y,je,Ee,null,he,pe)),Ar(e,h,v,!fe);return}}Fx(e,t,h,a,c,d,v,S,Y)}function Jv(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],h=d.getSnapshot;d=d.value;try{if(!Xn(h(),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 Ar(e,t,a,c){t&=~$m,t&=~Tc,e.suspendedLanes|=t,e.pingedLanes&=~t,c&&(e.warmLanes|=t),c=e.expirationTimes;for(var d=t;0<d;){var h=31-yt(d),v=1<<h;c[h]=-1,d&=~v}a!==0&&$n(e,a,t)}function Uf(){return(Ht&6)===0?(cd(0),!1):!0}function Gm(){if(jt!==null){if(Qt===0)var e=jt.return;else e=jt,Ul=$l=null,_c(e),qa=null,hc=0,e=jt;for(;e!==null;)px(e.alternate,e),e=e.return;jt=null}}function Lo(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,bj(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Bi=0,Gm(),ln=e,jt=a=Fs(e.current,null),Et=t,Qt=0,El=null,Sr=!1,Mo=gt(e,t),Im=!1,Ro=Cl=$m=Tc=Er=Vn=0,hl=id=null,Um=!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-yt(c),h=1<<d;t|=e[d],c&=~h}return Ui=t,Ol(),a}function Ux(e,t){ot=null,D.H=kr,t===cl||t===fo?(t=ho(),Qt=3):t===Nu?(t=ho(),Qt=4):Qt=t===Co?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,El=t,jt===null&&(Vn=1,el(e,Ks(t,e.current)))}function Bx(){var e=Zs.current;return e===null?!0:(Et&4194048)===Et?ol===null:(Et&62914560)===Et||(Et&536870912)!==0?e===ol:!1}function Hx(){var e=D.H;return D.H=kr,e===null?kr:e}function qx(){var e=D.A;return D.A=Zv,e}function Bf(){Vn=4,Sr||(Et&4194048)!==Et&&Zs.current!==null||(Mo=!0),(Er&134217727)===0&&(Tc&134217727)===0||ln===null||Ar(ln,Et,Cl,!1)}function Ym(e,t,a){var c=Ht;Ht|=2;var d=Hx(),h=qx();(ln!==e||Et!==t)&&($f=null,Lo(e,t)),t=!1;var v=Vn;e:do try{if(Qt!==0&&jt!==null){var S=jt,Y=El;switch(Qt){case 8:Gm(),v=6;break e;case 3:case 2:case 9:case 6:Zs.current===null&&(t=!0);var fe=Qt;if(Qt=0,El=null,Oo(e,S,Y,fe),a&&Mo){v=0;break e}break;default:fe=Qt,Qt=0,El=null,Oo(e,S,Y,fe)}}ej(),v=Vn;break}catch(je){Ux(e,je)}while(!0);return t&&e.shellSuspendCounter++,Ul=$l=null,Ht=c,D.H=d,D.A=h,jt===null&&(ln=null,Et=0,Ol()),v}function ej(){for(;jt!==null;)Gx(jt)}function tj(e,t){var a=Ht;Ht|=2;var c=Hx(),d=qx();ln!==e||Et!==t?($f=null,If=ht()+500,Lo(e,t)):Mo=gt(e,t);e:do try{if(Qt!==0&&jt!==null){t=jt;var h=El;t:switch(Qt){case 1:Qt=0,El=null,Oo(e,t,h,1);break;case 2:case 9:if(ku(h)){Qt=0,El=null,Yx(t);break}t=function(){Qt!==2&&Qt!==9||ln!==e||(Qt=7),Wa(e)},h.then(t,t);break e;case 3:Qt=7;break e;case 4:Qt=5;break e;case 7:ku(h)?(Qt=0,El=null,Yx(t)):(Qt=0,El=null,Oo(e,t,h,7));break;case 5:var v=null;switch(jt.tag){case 26:v=jt.memoizedState;case 5:case 27:var S=jt;if(v?T_(v):S.stateNode.complete){Qt=0,El=null;var Y=S.sibling;if(Y!==null)jt=Y;else{var fe=S.return;fe!==null?(jt=fe,Hf(fe)):jt=null}break t}}Qt=0,El=null,Oo(e,t,h,5);break;case 6:Qt=0,El=null,Oo(e,t,h,6);break;case 8:Gm(),Vn=6;break e;default:throw Error(r(462))}}nj();break}catch(je){Ux(e,je)}while(!0);return Ul=$l=null,D.H=c,D.A=d,Ht=a,jt!==null?0:(ln=null,Et=0,Ol(),Vn)}function nj(){for(;jt!==null&&!rn();)Gx(jt)}function Gx(e){var t=hx(e.alternate,e,Ui);e.memoizedProps=e.pendingProps,t===null?Hf(e):jt=t}function Yx(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=rx(a,t,t.pendingProps,t.type,void 0,Et);break;case 11:t=rx(a,t,t.pendingProps,t.type.render,t.ref,Et);break;case 5:_c(t);default:px(a,t),t=jt=fr(t,Ui),t=hx(a,t,Ui)}e.memoizedProps=e.pendingProps,t===null?Hf(e):jt=t}function Oo(e,t,a,c){Ul=$l=null,_c(t),qa=null,hc=0;var d=t.return;try{if(Mi(e,d,t,a,Et)){Vn=1,el(e,Ks(a,e.current)),jt=null;return}}catch(h){if(d!==null)throw jt=d,h;Vn=1,el(e,Ks(a,e.current)),jt=null;return}t.flags&32768?(ft||c===1?e=!0:Mo||(Et&536870912)!==0?e=!1:(Sr=e=!0,(c===2||c===9||c===3||c===6)&&(c=Zs.current,c!==null&&c.tag===13&&(c.flags|=16384))),Vx(t,e)):Hf(t)}function Hf(e){var t=e;do{if((t.flags&32768)!==0){Vx(t,Sr);return}e=t.return;var a=Xv(t.alternate,t,Ui);if(a!==null){jt=a;return}if(t=t.sibling,t!==null){jt=t;return}jt=t=e}while(t!==null);Vn===0&&(Vn=5)}function Vx(e,t){do{var a=Kv(e.alternate,e);if(a!==null){a.flags&=32767,jt=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){jt=e;return}jt=e=a}while(e!==null);Vn=6,jt=null}function Fx(e,t,a,c,d,h,v,S,Y){e.cancelPendingCommit=null;do qf();while(rs!==0);if((Ht&6)!==0)throw Error(r(327));if(t!==null){if(t===e.current)throw Error(r(177));if(h=t.lanes|t.childLanes,h|=yi,Cn(e,a,h,v,S,Y),e===ln&&(jt=ln=null,Et=0),Do=t,Tr=e,Bi=a,Bm=h,Hm=d,Ox=c,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,ij(Mt,function(){return Zx(),null})):(e.callbackNode=null,e.callbackPriority=0),c=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||c){c=D.T,D.T=null,d=O.p,O.p=2,v=Ht,Ht|=4;try{Qv(e,t,a)}finally{Ht=v,O.p=d,D.T=c}}rs=1,Xx(),Kx(),Qx()}}function Xx(){if(rs===1){rs=0;var e=Tr,t=Do,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=D.T,D.T=null;var c=O.p;O.p=2;var d=Ht;Ht|=4;try{Ex(t,e);var h=np,v=Jc(e.containerInfo),S=h.focusedElem,Y=h.selectionRange;if(v!==S&&S&&S.ownerDocument&&ac(S.ownerDocument.documentElement,S)){if(Y!==null&&eo(S)){var fe=Y.start,je=Y.end;if(je===void 0&&(je=fe),"selectionStart"in S)S.selectionStart=fe,S.selectionEnd=Math.min(je,S.value.length);else{var Ee=S.ownerDocument||document,he=Ee&&Ee.defaultView||window;if(he.getSelection){var pe=he.getSelection(),Ge=S.textContent.length,nt=Math.min(Y.start,Ge),Wt=Y.end===void 0?nt:Math.min(Y.end,Ge);!pe.extend&&nt>Wt&&(v=Wt,Wt=nt,nt=v);var ae=Wc(S,nt),W=Wc(S,Wt);if(ae&&W&&(pe.rangeCount!==1||pe.anchorNode!==ae.node||pe.anchorOffset!==ae.offset||pe.focusNode!==W.node||pe.focusOffset!==W.offset)){var de=Ee.createRange();de.setStart(ae.node,ae.offset),pe.removeAllRanges(),nt>Wt?(pe.addRange(de),pe.extend(W.node,W.offset)):(de.setEnd(W.node,W.offset),pe.addRange(de))}}}}for(Ee=[],pe=S;pe=pe.parentNode;)pe.nodeType===1&&Ee.push({element:pe,left:pe.scrollLeft,top:pe.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;S<Ee.length;S++){var ke=Ee[S];ke.element.scrollLeft=ke.left,ke.element.scrollTop=ke.top}}eh=!!tp,np=tp=null}finally{Ht=d,O.p=c,D.T=a}}e.current=t,rs=2}}function Kx(){if(rs===2){rs=0;var e=Tr,t=Do,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=D.T,D.T=null;var c=O.p;O.p=2;var d=Ht;Ht|=4;try{jx(e,t.alternate,t)}finally{Ht=d,O.p=c,D.T=a}}rs=3}}function Qx(){if(rs===4||rs===3){rs=0,kt();var e=Tr,t=Do,a=Bi,c=Ox;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?rs=5:(rs=0,Do=Tr=null,Px(e,e.pendingLanes));var d=e.pendingLanes;if(d===0&&(Cr=null),ns(a),t=t.stateNode,_t&&typeof _t.onCommitFiberRoot=="function")try{_t.onCommitFiberRoot(st,t,void 0,(t.current.flags&128)===128)}catch{}if(c!==null){t=D.T,d=O.p,O.p=2,D.T=null;try{for(var h=e.onRecoverableError,v=0;v<c.length;v++){var S=c[v];h(S.value,{componentStack:S.stack})}}finally{D.T=t,O.p=d}}(Bi&3)!==0&&qf(),Wa(e),d=e.pendingLanes,(a&261930)!==0&&(d&42)!==0?e===qm?rd++:(rd=0,qm=e):rd=0,cd(0)}}function Px(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,cc(t)))}function qf(){return Xx(),Kx(),Qx(),Zx()}function Zx(){if(rs!==5)return!1;var e=Tr,t=Bm;Bm=0;var a=ns(Bi),c=D.T,d=O.p;try{O.p=32>a?32:a,D.T=null,a=Hm,Hm=null;var h=Tr,v=Bi;if(rs=0,Do=Tr=null,Bi=0,(Ht&6)!==0)throw Error(r(331));var S=Ht;if(Ht|=4,Rx(h.current),Tx(h,h.current,v,a),Ht=S,cd(0,!1),_t&&typeof _t.onPostCommitFiberRoot=="function")try{_t.onPostCommitFiberRoot(st,h)}catch{}return!0}finally{O.p=d,D.T=c,Px(e,t)}}function Wx(e,t,a){t=Ks(a,t),t=Gl(e.stateNode,t,2),e=ga(e,t,2),e!==null&&(cs(e,2),Wa(e))}function Pt(e,t,a){if(e.tag===3)Wx(e,e,a);else for(;t!==null;){if(t.tag===3){Wx(t,e,a);break}else if(t.tag===1){var c=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(Cr===null||!Cr.has(c))){e=Ks(a,e),a=Pa(2),c=ga(t,a,2),c!==null&&(ps(a,c,t,e),cs(c,2),Wa(c));break}}t=t.return}}function Vm(e,t,a){var c=e.pingCache;if(c===null){c=e.pingCache=new Wv;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)||(Im=!0,d.add(a),e=sj.bind(null,e,t,a),t.then(e,e))}function sj(e,t,a){var c=e.pingCache;c!==null&&c.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,ln===e&&(Et&a)===a&&(Vn===4||Vn===3&&(Et&62914560)===Et&&300>ht()-zf?(Ht&2)===0&&Lo(e,0):$m|=a,Ro===Et&&(Ro=0)),Wa(e)}function Jx(e,t){t===0&&(t=In()),e=da(e,t),e!==null&&(cs(e,t),Wa(e))}function lj(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),Jx(e,a)}function aj(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),Jx(e,a)}function ij(e,t){return ye(e,t)}var Gf=null,zo=null,Fm=!1,Yf=!1,Xm=!1,Mr=0;function Wa(e){e!==zo&&e.next===null&&(zo===null?Gf=zo=e:zo=zo.next=e),Yf=!0,Fm||(Fm=!0,cj())}function cd(e,t){if(!Xm&&Yf){Xm=!0;do for(var a=!1,c=Gf;c!==null;){if(e!==0){var d=c.pendingLanes;if(d===0)var h=0;else{var v=c.suspendedLanes,S=c.pingedLanes;h=(1<<31-yt(42|e)+1)-1,h&=d&~(v&~S),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(a=!0,s_(c,h))}else h=Et,h=dt(c,c===ln?h:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(h&3)===0||gt(c,h)||(a=!0,s_(c,h));c=c.next}while(a);Xm=!1}}function rj(){e_()}function e_(){Yf=Fm=!1;var e=0;Mr!==0&&_j()&&(e=Mr);for(var t=ht(),a=null,c=Gf;c!==null;){var d=c.next,h=t_(c,t);h===0?(c.next=null,a===null?Gf=d:a.next=d,d===null&&(zo=a)):(a=c,(e!==0||(h&3)!==0)&&(Yf=!0)),c=d}rs!==0&&rs!==5||cd(e),Mr!==0&&(Mr=0)}function t_(e,t){for(var a=e.suspendedLanes,c=e.pingedLanes,d=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var v=31-yt(h),S=1<<v,Y=d[v];Y===-1?((S&a)===0||(S&c)!==0)&&(d[v]=bs(S,t)):Y<=t&&(e.expiredLanes|=S),h&=~S}if(t=ln,a=Et,a=dt(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),c=e.callbackNode,a===0||e===t&&(Qt===2||Qt===9)||e.cancelPendingCommit!==null)return c!==null&&c!==null&&Qe(c),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||gt(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(c!==null&&Qe(c),ns(a)){case 2:case 8:a=fn;break;case 32:a=Mt;break;case 268435456:a=Ce;break;default:a=Mt}return c=n_.bind(null,e),a=ye(a,c),e.callbackPriority=t,e.callbackNode=a,t}return c!==null&&c!==null&&Qe(c),e.callbackPriority=2,e.callbackNode=null,2}function n_(e,t){if(rs!==0&&rs!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(qf()&&e.callbackNode!==a)return null;var c=Et;return c=dt(e,e===ln?c:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),c===0?null:(Ix(e,c,t),t_(e,ht()),e.callbackNode!=null&&e.callbackNode===a?n_.bind(null,e):null)}function s_(e,t){if(qf())return null;Ix(e,t,!0)}function cj(){yj(function(){(Ht&6)!==0?ye(On,rj):e_()})}function Km(){if(Mr===0){var e=pr;e===0&&(e=Je,Je<<=1,(Je&261888)===0&&(Je=256)),Mr=e}return Mr}function l_(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:na(""+e)}function a_(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 oj(e,t,a,c,d){if(t==="submit"&&a&&a.stateNode===d){var h=l_((d[gn]||null).action),v=c.submitter;v&&(t=(t=v[gn]||null)?l_(t.formAction):v.getAttribute("formAction"),t!==null&&(h=t,v=null));var S=new _n("action","action",null,c,d);e.push({event:S,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(Mr!==0){var Y=v?a_(d,v):new FormData(d);Qu(a,{pending:!0,data:Y,method:d.method,action:h},null,Y)}}else typeof h=="function"&&(S.preventDefault(),Y=v?a_(d,v):new FormData(d),Qu(a,{pending:!0,data:Y,method:d.method,action:h},h,Y))},currentTarget:d}]})}}for(var Qm=0;Qm<ur.length;Qm++){var Pm=ur[Qm],uj=Pm.toLowerCase(),dj=Pm[0].toUpperCase()+Pm.slice(1);al(uj,"on"+dj)}al(cr,"onAnimationEnd"),al(oa,"onAnimationIteration"),al(or,"onAnimationStart"),al("dblclick","onDoubleClick"),al("focusin","onFocus"),al("focusout","onBlur"),al(gu,"onTransitionRun"),al(xm,"onTransitionStart"),al(_i,"onTransitionCancel"),al(rc,"onTransitionEnd"),Hn("onMouseEnter",["mouseout","mouseover"]),Hn("onMouseLeave",["mouseout","mouseover"]),Hn("onPointerEnter",["pointerout","pointerover"]),Hn("onPointerLeave",["pointerout","pointerover"]),Dt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Dt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Dt("onBeforeInput",["compositionend","keypress","textInput","paste"]),Dt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Dt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Dt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var od="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(" "),fj=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(od));function i_(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 h=void 0;if(t)for(var v=c.length-1;0<=v;v--){var S=c[v],Y=S.instance,fe=S.currentTarget;if(S=S.listener,Y!==h&&d.isPropagationStopped())break e;h=S,d.currentTarget=fe;try{h(d)}catch(je){bi(je)}d.currentTarget=null,h=Y}else for(v=0;v<c.length;v++){if(S=c[v],Y=S.instance,fe=S.currentTarget,S=S.listener,Y!==h&&d.isPropagationStopped())break e;h=S,d.currentTarget=fe;try{h(d)}catch(je){bi(je)}d.currentTarget=null,h=Y}}}}function Nt(e,t){var a=t[us];a===void 0&&(a=t[us]=new Set);var c=e+"__bubble";a.has(c)||(r_(t,e,2,!1),a.add(c))}function Zm(e,t,a){var c=0;t&&(c|=4),r_(a,e,c,t)}var Vf="_reactListening"+Math.random().toString(36).slice(2);function Wm(e){if(!e[Vf]){e[Vf]=!0,wt.forEach(function(a){a!=="selectionchange"&&(fj.has(a)||Zm(a,!1,e),Zm(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Vf]||(t[Vf]=!0,Zm("selectionchange",!1,t))}}function r_(e,t,a,c){switch(z_(t)){case 2:var d=Bj;break;case 8:d=Hj;break;default:d=hp}a=d.bind(null,t,a,e),d=void 0,!hs||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 Jm(e,t,a,c,d){var h=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 Y=v.tag;if((Y===3||Y===4)&&v.stateNode.containerInfo===d)return;v=v.return}for(;S!==null;){if(v=Bn(S),v===null)return;if(Y=v.tag,Y===5||Y===6||Y===26||Y===27){c=h=v;continue e}S=S.parentNode}}c=c.return}sl(function(){var fe=h,je=Nn(a),Ee=[];e:{var he=xu.get(e);if(he!==void 0){var pe=_n,Ge=e;switch(e){case"keypress":if(Oe(a)===0)break e;case"keydown":case"keyup":pe=hu;break;case"focusin":Ge="focus",pe=Ji;break;case"focusout":Ge="blur",pe=Ji;break;case"beforeblur":case"afterblur":pe=Ji;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":pe=fi;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":pe=rm;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":pe=dm;break;case cr:case oa:case or:pe=Wr;break;case rc:pe=hm;break;case"scroll":case"scrollend":pe=Aa;break;case"wheel":pe=mm;break;case"copy":case"cut":case"paste":pe=Vd;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":pe=Xd;break;case"toggle":case"beforetoggle":pe=pm}var nt=(t&4)!==0,Wt=!nt&&(e==="scroll"||e==="scrollend"),ae=nt?he!==null?he+"Capture":null:he;nt=[];for(var W=fe,de;W!==null;){var ke=W;if(de=ke.stateNode,ke=ke.tag,ke!==5&&ke!==26&&ke!==27||de===null||ae===null||(ke=Vs(W,ae),ke!=null&&nt.push(ud(W,ke,de))),Wt)break;W=W.return}0<nt.length&&(he=new pe(he,Ge,null,a,je),Ee.push({event:he,listeners:nt}))}}if((t&7)===0){e:{if(he=e==="mouseover"||e==="pointerover",pe=e==="mouseout"||e==="pointerout",he&&a!==sa&&(Ge=a.relatedTarget||a.fromElement)&&(Bn(Ge)||Ge[os]))break e;if((pe||he)&&(he=je.window===je?je:(he=je.ownerDocument)?he.defaultView||he.parentWindow:window,pe?(Ge=a.relatedTarget||a.toElement,pe=fe,Ge=Ge?Bn(Ge):null,Ge!==null&&(Wt=u(Ge),nt=Ge.tag,Ge!==Wt||nt!==5&&nt!==27&&nt!==6)&&(Ge=null)):(pe=null,Ge=fe),pe!==Ge)){if(nt=fi,ke="onMouseLeave",ae="onMouseEnter",W="mouse",(e==="pointerout"||e==="pointerover")&&(nt=Xd,ke="onPointerLeave",ae="onPointerEnter",W="pointer"),Wt=pe==null?he:ge(pe),de=Ge==null?he:ge(Ge),he=new nt(ke,W+"leave",pe,a,je),he.target=Wt,he.relatedTarget=de,ke=null,Bn(je)===fe&&(nt=new nt(ae,W+"enter",Ge,a,je),nt.target=de,nt.relatedTarget=Wt,ke=nt),Wt=ke,pe&&Ge)t:{for(nt=hj,ae=pe,W=Ge,de=0,ke=ae;ke;ke=nt(ke))de++;ke=0;for(var Pe=W;Pe;Pe=nt(Pe))ke++;for(;0<de-ke;)ae=nt(ae),de--;for(;0<ke-de;)W=nt(W),ke--;for(;de--;){if(ae===W||W!==null&&ae===W.alternate){nt=ae;break t}ae=nt(ae),W=nt(W)}nt=null}else nt=null;pe!==null&&c_(Ee,he,pe,nt,!1),Ge!==null&&Wt!==null&&c_(Ee,Wt,Ge,nt,!0)}}e:{if(he=fe?ge(fe):window,pe=he.nodeName&&he.nodeName.toLowerCase(),pe==="select"||pe==="input"&&he.type==="file")var $t=Qd;else if(pi(he))if(vl)$t=Zc;else{$t=Pc;var Fe=pu}else pe=he.nodeName,!pe||pe.toLowerCase()!=="input"||he.type!=="checkbox"&&he.type!=="radio"?fe&&ta(fe.elementType)&&($t=Qd):$t=Zd;if($t&&($t=$t(e,fe))){nc(Ee,$t,a,je);break e}Fe&&Fe(e,he,fe),e==="focusout"&&fe&&he.type==="number"&&fe.memoizedProps.value!=null&&Wl(he,"number",he.value)}switch(Fe=fe?ge(fe):window,e){case"focusin":(pi(Fe)||Fe.contentEditable==="true")&&(jl=Fe,ar=fe,La=null);break;case"focusout":La=ar=jl=null;break;case"mousedown":xi=!0;break;case"contextmenu":case"mouseup":case"dragend":xi=!1,ef(Ee,a,je);break;case"selectionchange":if(to)break;case"keydown":case"keyup":ef(Ee,a,je)}var pt;if(ks)e:{switch(e){case"compositionstart":var Ct="onCompositionStart";break e;case"compositionend":Ct="onCompositionEnd";break e;case"compositionupdate":Ct="onCompositionUpdate";break e}Ct=void 0}else mi?Ma(e,a)&&(Ct="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Ct="onCompositionStart");Ct&&(tr&&a.locale!=="ko"&&(mi||Ct!=="onCompositionStart"?Ct==="onCompositionEnd"&&mi&&(pt=oe()):(y=je,M="value"in y?y.value:y.textContent,mi=!0)),Fe=Ff(fe,Ct),0<Fe.length&&(Ct=new Jr(Ct,e,null,a,je),Ee.push({event:Ct,listeners:Fe}),pt?Ct.data=pt:(pt=Ds(a),pt!==null&&(Ct.data=pt)))),(pt=hi?gm(e,a):Kd(e,a))&&(Ct=Ff(fe,"onBeforeInput"),0<Ct.length&&(Fe=new Jr("onBeforeInput","beforeinput",null,a,je),Ee.push({event:Fe,listeners:Ct}),Fe.data=pt)),oj(Ee,e,fe,a,je)}i_(Ee,t)})}function ud(e,t,a){return{instance:e,listener:t,currentTarget:a}}function Ff(e,t){for(var a=t+"Capture",c=[];e!==null;){var d=e,h=d.stateNode;if(d=d.tag,d!==5&&d!==26&&d!==27||h===null||(d=Vs(e,a),d!=null&&c.unshift(ud(e,d,h)),d=Vs(e,t),d!=null&&c.push(ud(e,d,h))),e.tag===3)return c;e=e.return}return[]}function hj(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function c_(e,t,a,c,d){for(var h=t._reactName,v=[];a!==null&&a!==c;){var S=a,Y=S.alternate,fe=S.stateNode;if(S=S.tag,Y!==null&&Y===c)break;S!==5&&S!==26&&S!==27||fe===null||(Y=fe,d?(fe=Vs(a,h),fe!=null&&v.unshift(ud(a,fe,Y))):d||(fe=Vs(a,h),fe!=null&&v.push(ud(a,fe,Y)))),a=a.return}v.length!==0&&e.push({event:t,listeners:v})}var mj=/\r\n?/g,pj=/\u0000|\uFFFD/g;function o_(e){return(typeof e=="string"?e:""+e).replace(mj,`
|
|
50
|
+
`).replace(pj,"")}function u_(e,t){return t=o_(t),o_(e)===t}function Zt(e,t,a,c,d,h){switch(a){case"children":typeof c=="string"?t==="body"||t==="textarea"&&c===""||Ys(e,c):(typeof c=="number"||typeof c=="bigint")&&t!=="body"&&Ys(e,""+c);break;case"className":yl(e,"class",c);break;case"tabIndex":yl(e,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":yl(e,a,c);break;case"style":Pn(e,c,h);break;case"data":if(t!=="object"){yl(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=na(""+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 h=="function"&&(a==="formAction"?(t!=="input"&&Zt(e,t,"name",d.name,d,null),Zt(e,t,"formEncType",d.formEncType,d,null),Zt(e,t,"formMethod",d.formMethod,d,null),Zt(e,t,"formTarget",d.formTarget,d,null)):(Zt(e,t,"encType",d.encType,d,null),Zt(e,t,"method",d.method,d,null),Zt(e,t,"target",d.target,d,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){e.removeAttribute(a);break}c=na(""+c),e.setAttribute(a,c);break;case"onClick":c!=null&&(e.onclick=xt);break;case"onScroll":c!=null&&Nt("scroll",e);break;case"onScrollEnd":c!=null&&Nt("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=na(""+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":Nt("beforetoggle",e),Nt("toggle",e),bl(e,"popover",c);break;case"xlinkActuate":Qn(e,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":Qn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":Qn(e,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":Qn(e,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":Qn(e,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":Qn(e,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":Qn(e,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":Qn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":Qn(e,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":bl(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=Rl.get(a)||a,bl(e,a,c))}}function ep(e,t,a,c,d,h){switch(a){case"style":Pn(e,c,h);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"?Ys(e,c):(typeof c=="number"||typeof c=="bigint")&&Ys(e,""+c);break;case"onScroll":c!=null&&Nt("scroll",e);break;case"onScrollEnd":c!=null&&Nt("scrollend",e);break;case"onClick":c!=null&&(e.onclick=xt);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!on.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(d=a.endsWith("Capture"),t=a.slice(2,d?a.length-7:void 0),h=e[gn]||null,h=h!=null?h[a]:null,typeof h=="function"&&e.removeEventListener(t,h,d),typeof c=="function")){typeof h!="function"&&h!==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,""):bl(e,a,c)}}}function Es(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Nt("error",e),Nt("load",e);var c=!1,d=!1,h;for(h in a)if(a.hasOwnProperty(h)){var v=a[h];if(v!=null)switch(h){case"src":c=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:Zt(e,t,h,v,a,null)}}d&&Zt(e,t,"srcSet",a.srcSet,a,null),c&&Zt(e,t,"src",a.src,a,null);return;case"input":Nt("invalid",e);var S=h=v=d=null,Y=null,fe=null;for(c in a)if(a.hasOwnProperty(c)){var je=a[c];if(je!=null)switch(c){case"name":d=je;break;case"type":v=je;break;case"checked":Y=je;break;case"defaultChecked":fe=je;break;case"value":h=je;break;case"defaultValue":S=je;break;case"children":case"dangerouslySetInnerHTML":if(je!=null)throw Error(r(137,t));break;default:Zt(e,t,c,je,a,null)}}ui(e,h,S,Y,fe,v,d,!1);return;case"select":Nt("invalid",e),c=v=h=null;for(d in a)if(a.hasOwnProperty(d)&&(S=a[d],S!=null))switch(d){case"value":h=S;break;case"defaultValue":v=S;break;case"multiple":c=S;default:Zt(e,t,d,S,a,null)}t=h,a=v,e.multiple=!!c,t!=null?ds(e,!!c,t,!1):a!=null&&ds(e,!!c,a,!0);return;case"textarea":Nt("invalid",e),h=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":h=S;break;case"dangerouslySetInnerHTML":if(S!=null)throw Error(r(91));break;default:Zt(e,t,v,S,a,null)}ea(e,c,d,h);return;case"option":for(Y in a)if(a.hasOwnProperty(Y)&&(c=a[Y],c!=null))switch(Y){case"selected":e.selected=c&&typeof c!="function"&&typeof c!="symbol";break;default:Zt(e,t,Y,c,a,null)}return;case"dialog":Nt("beforetoggle",e),Nt("toggle",e),Nt("cancel",e),Nt("close",e);break;case"iframe":case"object":Nt("load",e);break;case"video":case"audio":for(c=0;c<od.length;c++)Nt(od[c],e);break;case"image":Nt("error",e),Nt("load",e);break;case"details":Nt("toggle",e);break;case"embed":case"source":case"link":Nt("error",e),Nt("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(fe in a)if(a.hasOwnProperty(fe)&&(c=a[fe],c!=null))switch(fe){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:Zt(e,t,fe,c,a,null)}return;default:if(ta(t)){for(je in a)a.hasOwnProperty(je)&&(c=a[je],c!==void 0&&ep(e,t,je,c,a,void 0));return}}for(S in a)a.hasOwnProperty(S)&&(c=a[S],c!=null&&Zt(e,t,S,c,a,null))}function gj(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,h=null,v=null,S=null,Y=null,fe=null,je=null;for(pe in a){var Ee=a[pe];if(a.hasOwnProperty(pe)&&Ee!=null)switch(pe){case"checked":break;case"value":break;case"defaultValue":Y=Ee;default:c.hasOwnProperty(pe)||Zt(e,t,pe,null,c,Ee)}}for(var he in c){var pe=c[he];if(Ee=a[he],c.hasOwnProperty(he)&&(pe!=null||Ee!=null))switch(he){case"type":h=pe;break;case"name":d=pe;break;case"checked":fe=pe;break;case"defaultChecked":je=pe;break;case"value":v=pe;break;case"defaultValue":S=pe;break;case"children":case"dangerouslySetInnerHTML":if(pe!=null)throw Error(r(137,t));break;default:pe!==Ee&&Zt(e,t,he,pe,c,Ee)}}Gs(e,v,S,Y,fe,je,h,d);return;case"select":pe=v=S=he=null;for(h in a)if(Y=a[h],a.hasOwnProperty(h)&&Y!=null)switch(h){case"value":break;case"multiple":pe=Y;default:c.hasOwnProperty(h)||Zt(e,t,h,null,c,Y)}for(d in c)if(h=c[d],Y=a[d],c.hasOwnProperty(d)&&(h!=null||Y!=null))switch(d){case"value":he=h;break;case"defaultValue":S=h;break;case"multiple":v=h;default:h!==Y&&Zt(e,t,d,h,c,Y)}t=S,a=v,c=pe,he!=null?ds(e,!!a,he,!1):!!c!=!!a&&(t!=null?ds(e,!!a,t,!0):ds(e,!!a,a?[]:"",!1));return;case"textarea":pe=he=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:Zt(e,t,S,null,c,d)}for(v in c)if(d=c[v],h=a[v],c.hasOwnProperty(v)&&(d!=null||h!=null))switch(v){case"value":he=d;break;case"defaultValue":pe=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(r(91));break;default:d!==h&&Zt(e,t,v,d,c,h)}Jl(e,he,pe);return;case"option":for(var Ge in a)if(he=a[Ge],a.hasOwnProperty(Ge)&&he!=null&&!c.hasOwnProperty(Ge))switch(Ge){case"selected":e.selected=!1;break;default:Zt(e,t,Ge,null,c,he)}for(Y in c)if(he=c[Y],pe=a[Y],c.hasOwnProperty(Y)&&he!==pe&&(he!=null||pe!=null))switch(Y){case"selected":e.selected=he&&typeof he!="function"&&typeof he!="symbol";break;default:Zt(e,t,Y,he,c,pe)}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 nt in a)he=a[nt],a.hasOwnProperty(nt)&&he!=null&&!c.hasOwnProperty(nt)&&Zt(e,t,nt,null,c,he);for(fe in c)if(he=c[fe],pe=a[fe],c.hasOwnProperty(fe)&&he!==pe&&(he!=null||pe!=null))switch(fe){case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(r(137,t));break;default:Zt(e,t,fe,he,c,pe)}return;default:if(ta(t)){for(var Wt in a)he=a[Wt],a.hasOwnProperty(Wt)&&he!==void 0&&!c.hasOwnProperty(Wt)&&ep(e,t,Wt,void 0,c,he);for(je in c)he=c[je],pe=a[je],!c.hasOwnProperty(je)||he===pe||he===void 0&&pe===void 0||ep(e,t,je,he,c,pe);return}}for(var ae in a)he=a[ae],a.hasOwnProperty(ae)&&he!=null&&!c.hasOwnProperty(ae)&&Zt(e,t,ae,null,c,he);for(Ee in c)he=c[Ee],pe=a[Ee],!c.hasOwnProperty(Ee)||he===pe||he==null&&pe==null||Zt(e,t,Ee,he,c,pe)}function d_(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function xj(){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],h=d.transferSize,v=d.initiatorType,S=d.duration;if(h&&S&&d_(v)){for(v=0,S=d.responseEnd,c+=1;c<a.length;c++){var Y=a[c],fe=Y.startTime;if(fe>S)break;var je=Y.transferSize,Ee=Y.initiatorType;je&&d_(Ee)&&(Y=Y.responseEnd,v+=je*(Y<S?1:(S-fe)/(Y-fe)))}if(--c,t+=8*(h+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 tp=null,np=null;function Xf(e){return e.nodeType===9?e:e.ownerDocument}function f_(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 h_(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 sp(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 lp=null;function _j(){var e=window.event;return e&&e.type==="popstate"?e===lp?!1:(lp=e,!0):(lp=null,!1)}var m_=typeof setTimeout=="function"?setTimeout:void 0,bj=typeof clearTimeout=="function"?clearTimeout:void 0,p_=typeof Promise=="function"?Promise:void 0,yj=typeof queueMicrotask=="function"?queueMicrotask:typeof p_<"u"?function(e){return p_.resolve(null).then(e).catch(vj)}:m_;function vj(e){setTimeout(function(){throw e})}function Rr(e){return e==="head"}function g_(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),Bo(t);return}c--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")c++;else if(a==="html")dd(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,dd(a);for(var h=a.firstChild;h;){var v=h.nextSibling,S=h.nodeName;h[At]||S==="SCRIPT"||S==="STYLE"||S==="LINK"&&h.rel.toLowerCase()==="stylesheet"||a.removeChild(h),h=v}}else a==="body"&&dd(e.ownerDocument.body);a=d}while(a);Bo(t)}function x_(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 ap(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":ap(a),Rs(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function jj(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[At])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(h=e.getAttribute("rel"),h==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(h!==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(h=e.getAttribute("src"),(h!==(d.src==null?null:d.src)||e.getAttribute("type")!==(d.type==null?null:d.type)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&h&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var h=d.name==null?null:""+d.name;if(d.type==="hidden"&&e.getAttribute("name")===h)return e}else return e;if(e=Yl(e.nextSibling),e===null)break}return null}function Nj(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=Yl(e.nextSibling),e===null))return null;return e}function __(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Yl(e.nextSibling),e===null))return null;return e}function ip(e){return e.data==="$?"||e.data==="$~"}function rp(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function kj(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 Yl(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 cp=null;function b_(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return Yl(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function y_(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 v_(e,t,a){switch(t=Xf(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 dd(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Rs(e)}var Vl=new Map,j_=new Set;function Kf(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Hi=O.d;O.d={f:wj,r:Sj,D:Ej,C:Cj,L:Tj,m:Aj,X:Rj,S:Mj,M:Dj};function wj(){var e=Hi.f(),t=Uf();return e||t}function Sj(e){var t=K(e);t!==null&&t.tag===5&&t.type==="form"?Sc(t):Hi.r(e)}var Io=typeof document>"u"?null:document;function N_(e,t,a){var c=Io;if(c&&typeof t=="string"&&t){var d=tn(t);d='link[rel="'+e+'"][href="'+d+'"]',typeof a=="string"&&(d+='[crossorigin="'+a+'"]'),j_.has(d)||(j_.add(d),e={rel:e,crossOrigin:a,href:t},c.querySelector(d)===null&&(t=c.createElement("link"),Es(t,"link",e),He(t),c.head.appendChild(t)))}}function Ej(e){Hi.D(e),N_("dns-prefetch",e,null)}function Cj(e,t){Hi.C(e,t),N_("preconnect",e,t)}function Tj(e,t,a){Hi.L(e,t,a);var c=Io;if(c&&e&&t){var d='link[rel="preload"][as="'+tn(t)+'"]';t==="image"&&a&&a.imageSrcSet?(d+='[imagesrcset="'+tn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(d+='[imagesizes="'+tn(a.imageSizes)+'"]')):d+='[href="'+tn(e)+'"]';var h=d;switch(t){case"style":h=$o(e);break;case"script":h=Uo(e)}Vl.has(h)||(e=j({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),Vl.set(h,e),c.querySelector(d)!==null||t==="style"&&c.querySelector(fd(h))||t==="script"&&c.querySelector(hd(h))||(t=c.createElement("link"),Es(t,"link",e),He(t),c.head.appendChild(t)))}}function Aj(e,t){Hi.m(e,t);var a=Io;if(a&&e){var c=t&&typeof t.as=="string"?t.as:"script",d='link[rel="modulepreload"][as="'+tn(c)+'"][href="'+tn(e)+'"]',h=d;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=Uo(e)}if(!Vl.has(h)&&(e=j({rel:"modulepreload",href:e},t),Vl.set(h,e),a.querySelector(d)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(hd(h)))return}c=a.createElement("link"),Es(c,"link",e),He(c),a.head.appendChild(c)}}}function Mj(e,t,a){Hi.S(e,t,a);var c=Io;if(c&&e){var d=Re(c).hoistableStyles,h=$o(e);t=t||"default";var v=d.get(h);if(!v){var S={loading:0,preload:null};if(v=c.querySelector(fd(h)))S.loading=5;else{e=j({rel:"stylesheet",href:e,"data-precedence":t},a),(a=Vl.get(h))&&op(e,a);var Y=v=c.createElement("link");He(Y),Es(Y,"link",e),Y._p=new Promise(function(fe,je){Y.onload=fe,Y.onerror=je}),Y.addEventListener("load",function(){S.loading|=1}),Y.addEventListener("error",function(){S.loading|=2}),S.loading|=4,Qf(v,t,c)}v={type:"stylesheet",instance:v,count:1,state:S},d.set(h,v)}}}function Rj(e,t){Hi.X(e,t);var a=Io;if(a&&e){var c=Re(a).hoistableScripts,d=Uo(e),h=c.get(d);h||(h=a.querySelector(hd(d)),h||(e=j({src:e,async:!0},t),(t=Vl.get(d))&&up(e,t),h=a.createElement("script"),He(h),Es(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},c.set(d,h))}}function Dj(e,t){Hi.M(e,t);var a=Io;if(a&&e){var c=Re(a).hoistableScripts,d=Uo(e),h=c.get(d);h||(h=a.querySelector(hd(d)),h||(e=j({src:e,async:!0,type:"module"},t),(t=Vl.get(d))&&up(e,t),h=a.createElement("script"),He(h),Es(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},c.set(d,h))}}function k_(e,t,a,c){var d=(d=ie.current)?Kf(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=Re(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 h=Re(d).hoistableStyles,v=h.get(e);if(v||(d=d.ownerDocument||d,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,v),(h=d.querySelector(fd(e)))&&!h._p&&(v.instance=h,v.state.loading=5),Vl.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},Vl.set(e,a),h||Lj(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=Uo(a),a=Re(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="'+tn(e)+'"'}function fd(e){return'link[rel="stylesheet"]['+e+"]"}function w_(e){return j({},e,{"data-precedence":e.precedence,precedence:null})}function Lj(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}),Es(t,"link",a),He(t),e.head.appendChild(t))}function Uo(e){return'[src="'+tn(e)+'"]'}function hd(e){return"script[async]"+e}function S_(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var c=e.querySelector('style[data-href~="'+tn(a.href)+'"]');if(c)return t.instance=c,He(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"),He(c),Es(c,"style",d),Qf(c,a.precedence,e),t.instance=c;case"stylesheet":d=$o(a.href);var h=e.querySelector(fd(d));if(h)return t.state.loading|=4,t.instance=h,He(h),h;c=w_(a),(d=Vl.get(d))&&op(c,d),h=(e.ownerDocument||e).createElement("link"),He(h);var v=h;return v._p=new Promise(function(S,Y){v.onload=S,v.onerror=Y}),Es(h,"link",c),t.state.loading|=4,Qf(h,a.precedence,e),t.instance=h;case"script":return h=Uo(a.src),(d=e.querySelector(hd(h)))?(t.instance=d,He(d),d):(c=a,(d=Vl.get(h))&&(c=j({},a),up(c,d)),e=e.ownerDocument||e,d=e.createElement("script"),He(d),Es(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,Qf(c,a.precedence,e));return t.instance}function Qf(e,t,a){for(var c=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=c.length?c[c.length-1]:null,h=d,v=0;v<c.length;v++){var S=c[v];if(S.dataset.precedence===t)h=S;else if(h!==d)break}h?h.parentNode.insertBefore(e,h.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function op(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function up(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Pf=null;function E_(e,t,a){if(Pf===null){var c=new Map,d=Pf=new Map;d.set(a,c)}else d=Pf,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 h=a[d];if(!(h[At]||h[Tt]||e==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var v=h.getAttribute(t)||"";v=e+v;var S=c.get(v);S?S.push(h):c.set(v,[h])}}return c}function C_(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function Oj(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 T_(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function zj(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),h=t.querySelector(fd(d));if(h){t=h._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Zf.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=h,He(h);return}h=t.ownerDocument||t,c=w_(c),(d=Vl.get(d))&&op(c,d),h=h.createElement("link"),He(h);var v=h;v._p=new Promise(function(S,Y){v.onload=S,v.onerror=Y}),Es(h,"link",c),a.instance=h}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Zf.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var dp=0;function Ij(e,t){return e.stylesheets&&e.count===0&&Jf(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var c=setTimeout(function(){if(e.stylesheets&&Jf(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+t);0<e.imgBytes&&dp===0&&(dp=62500*xj());var d=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Jf(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>dp?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(c),clearTimeout(d)}}:null}function Zf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Jf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Wf=null;function Jf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Wf=new Map,t.forEach($j,e),Wf=null,Zf.call(e))}function $j(e,t){if(!(t.state.loading&4)){var a=Wf.get(e);if(a)var c=a.get(null);else{a=new Map,Wf.set(e,a);for(var d=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<d.length;h++){var v=d[h];(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"),h=a.get(v)||c,h===c&&a.set(null,d),a.set(v,d),this.count++,c=Zf.bind(this),d.addEventListener("load",c),d.addEventListener("error",c),h?h.parentNode.insertBefore(d,h.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(d,e.firstChild)),t.state.loading|=4}}var md={$$typeof:q,Provider:null,Consumer:null,_currentValue:H,_currentValue2:H,_threadCount:0};function Uj(e,t,a,c,d,h,v,S,Y){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=As(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=As(0),this.hiddenUpdates=As(null),this.identifierPrefix=c,this.onUncaughtError=d,this.onCaughtError=h,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Y,this.incompleteTransitions=new Map}function A_(e,t,a,c,d,h,v,S,Y,fe,je,Ee){return e=new Uj(e,t,a,v,Y,fe,je,Ee,S),t=1,h===!0&&(t|=24),h=It(3,null,null,t),e.current=h,h.stateNode=e,t=oo(),t.refCount++,e.pooledCache=t,t.refCount++,h.memoizedState={element:c,isDehydrated:a,cache:t},Cu(h),e}function M_(e){return e?(e=za,e):za}function R_(e,t,a,c,d,h){d=M_(d),c.context===null?c.context=d:c.pendingContext=d,c=Bl(t),c.payload={element:a},h=h===void 0?null:h,h!==null&&(c.callback=h),a=ga(e,c,t),a!==null&&(ml(a,e,t),xr(a,e,t))}function D_(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function fp(e,t){D_(e,t),(e=e.alternate)&&D_(e,t)}function L_(e){if(e.tag===13||e.tag===31){var t=da(e,67108864);t!==null&&ml(t,e,67108864),fp(e,67108864)}}function O_(e){if(e.tag===13||e.tag===31){var t=Tl();t=hn(t);var a=da(e,t);a!==null&&ml(a,e,t),fp(e,t)}}var eh=!0;function Bj(e,t,a,c){var d=D.T;D.T=null;var h=O.p;try{O.p=2,hp(e,t,a,c)}finally{O.p=h,D.T=d}}function Hj(e,t,a,c){var d=D.T;D.T=null;var h=O.p;try{O.p=8,hp(e,t,a,c)}finally{O.p=h,D.T=d}}function hp(e,t,a,c){if(eh){var d=mp(c);if(d===null)Jm(e,t,c,th,a),I_(e,c);else if(Gj(d,e,t,a,c))c.stopPropagation();else if(I_(e,c),t&4&&-1<qj.indexOf(e)){for(;d!==null;){var h=K(d);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var v=en(h.pendingLanes);if(v!==0){var S=h;for(S.pendingLanes|=2,S.entangledLanes|=2;v;){var Y=1<<31-yt(v);S.entanglements[1]|=Y,v&=~Y}Wa(h),(Ht&6)===0&&(If=ht()+500,cd(0))}}break;case 31:case 13:S=da(h,2),S!==null&&ml(S,h,2),Uf(),fp(h,2)}if(h=mp(c),h===null&&Jm(e,t,c,th,a),h===d)break;d=h}d!==null&&c.stopPropagation()}else Jm(e,t,c,null,a)}}function mp(e){return e=Nn(e),pp(e)}var th=null;function pp(e){if(th=null,e=Bn(e),e!==null){var t=u(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=f(t),e!==null)return e;e=null}else if(a===31){if(e=g(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 th=e,null}function z_(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(_s()){case On:return 2;case fn:return 8;case Mt:case zt:return 32;case Ce:return 268435456;default:return 32}default:return 32}}var gp=!1,Dr=null,Lr=null,Or=null,pd=new Map,gd=new Map,zr=[],qj="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 I_(e,t){switch(e){case"focusin":case"focusout":Dr=null;break;case"dragenter":case"dragleave":Lr=null;break;case"mouseover":case"mouseout":Or=null;break;case"pointerover":case"pointerout":pd.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":gd.delete(t.pointerId)}}function xd(e,t,a,c,d,h){return e===null||e.nativeEvent!==h?(e={blockedOn:t,domEventName:a,eventSystemFlags:c,nativeEvent:h,targetContainers:[d]},t!==null&&(t=K(t),t!==null&&L_(t)),e):(e.eventSystemFlags|=c,t=e.targetContainers,d!==null&&t.indexOf(d)===-1&&t.push(d),e)}function Gj(e,t,a,c,d){switch(t){case"focusin":return Dr=xd(Dr,e,t,a,c,d),!0;case"dragenter":return Lr=xd(Lr,e,t,a,c,d),!0;case"mouseover":return Or=xd(Or,e,t,a,c,d),!0;case"pointerover":var h=d.pointerId;return pd.set(h,xd(pd.get(h)||null,e,t,a,c,d)),!0;case"gotpointercapture":return h=d.pointerId,gd.set(h,xd(gd.get(h)||null,e,t,a,c,d)),!0}return!1}function $_(e){var t=Bn(e.target);if(t!==null){var a=u(t);if(a!==null){if(t=a.tag,t===13){if(t=f(a),t!==null){e.blockedOn=t,Un(e.priority,function(){O_(a)});return}}else if(t===31){if(t=g(a),t!==null){e.blockedOn=t,Un(e.priority,function(){O_(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 nh(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=mp(e.nativeEvent);if(a===null){a=e.nativeEvent;var c=new a.constructor(a.type,a);sa=c,a.target.dispatchEvent(c),sa=null}else return t=K(a),t!==null&&L_(t),e.blockedOn=a,!1;t.shift()}return!0}function U_(e,t,a){nh(e)&&a.delete(t)}function Yj(){gp=!1,Dr!==null&&nh(Dr)&&(Dr=null),Lr!==null&&nh(Lr)&&(Lr=null),Or!==null&&nh(Or)&&(Or=null),pd.forEach(U_),gd.forEach(U_)}function sh(e,t){e.blockedOn===t&&(e.blockedOn=null,gp||(gp=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,Yj)))}var lh=null;function B_(e){lh!==e&&(lh=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){lh===e&&(lh=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(pp(c||a)===null)continue;break}var h=K(a);h!==null&&(e.splice(t,3),t-=3,Qu(h,{pending:!0,data:d,method:a.method,action:c},c,d))}}))}function Bo(e){function t(Y){return sh(Y,e)}Dr!==null&&sh(Dr,e),Lr!==null&&sh(Lr,e),Or!==null&&sh(Or,e),pd.forEach(t),gd.forEach(t);for(var a=0;a<zr.length;a++){var c=zr[a];c.blockedOn===e&&(c.blockedOn=null)}for(;0<zr.length&&(a=zr[0],a.blockedOn===null);)$_(a),a.blockedOn===null&&zr.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(c=0;c<a.length;c+=3){var d=a[c],h=a[c+1],v=d[gn]||null;if(typeof h=="function")v||B_(a);else if(v){var S=null;if(h&&h.hasAttribute("formAction")){if(d=h,v=h[gn]||null)S=v.formAction;else if(pp(d)!==null)continue}else S=v.action;typeof S=="function"?a[c+1]=S:(a.splice(c,3),c-=3),B_(a)}}}function H_(){function e(h){h.canIntercept&&h.info==="react-transition"&&h.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 h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.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 xp(e){this._internalRoot=e}ah.prototype.render=xp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));var a=t.current,c=Tl();R_(a,c,e,t,null,null)},ah.prototype.unmount=xp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;R_(e.current,2,null,e,null,null),Uf(),t[os]=null}};function ah(e){this._internalRoot=e}ah.prototype.unstable_scheduleHydration=function(e){if(e){var t=mn();e={blockedOn:null,target:e,priority:t};for(var a=0;a<zr.length&&t!==0&&t<zr[a].priority;a++);zr.splice(a,0,e),a===0&&$_(e)}};var q_=l.version;if(q_!=="19.2.8")throw Error(r(527,q_,"19.2.8"));O.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=_(t),e=e!==null?b(e):null,e=e===null?null:e.stateNode,e};var Vj={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:D,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ih=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ih.isDisabled&&ih.supportsFiber)try{st=ih.inject(Vj),_t=ih}catch{}}return bd.createRoot=function(e,t){if(!o(e))throw Error(r(299));var a=!1,c="",d=is,h=ba,v=ql;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&&(h=t.onCaughtError),t.onRecoverableError!==void 0&&(v=t.onRecoverableError)),t=A_(e,1,!1,null,null,a,c,null,d,h,v,H_),e[os]=t.current,Wm(e),new xp(t)},bd.hydrateRoot=function(e,t,a){if(!o(e))throw Error(r(299));var c=!1,d="",h=is,v=ba,S=ql,Y=null;return a!=null&&(a.unstable_strictMode===!0&&(c=!0),a.identifierPrefix!==void 0&&(d=a.identifierPrefix),a.onUncaughtError!==void 0&&(h=a.onUncaughtError),a.onCaughtError!==void 0&&(v=a.onCaughtError),a.onRecoverableError!==void 0&&(S=a.onRecoverableError),a.formState!==void 0&&(Y=a.formState)),t=A_(e,1,!0,t,a??null,c,d,Y,h,v,S,H_),t.context=M_(null),a=t.current,c=Tl(),c=hn(c),d=Bl(c),d.callback=null,ga(a,d,c),a=c,t.current.lanes=a,cs(t,a),Wa(t),e[os]=t.current,Wm(e),new ah(t)},bd.version="19.2.8",bd}var J_;function nN(){if(J_)return vp.exports;J_=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(),vp.exports=tN(),vp.exports}var sN=nN();const Wy=1,Yi="main",eb=["skills","agents","hooks","commands","plugins","output-styles","CLAUDE.md","settings.json","keybindings.json"],Ki=["orange","blue","green","purple","pink","teal"],Ho={maxCount:5,maxTotalBytes:5*1024*1024};function lN(n){return`${n.replace(/[^\p{L}\p{N}\p{M}]/gu,"-").replace(/-+/g,"-").toLowerCase().replace(/^-|-$/g,"")||"project"}-${Jy(n)}`}function aN(n){const l=n.replace(/[^a-zA-Z0-9]/g,"-").replace(/-+/g,"-").toLowerCase(),i=`${l.replace(/^-+|-+$/g,"")||"project"}-${Jy(n)}`,r=lN(n);return[l,i].filter(o=>o!==r)}function Jy(n){const l=/^[a-zA-Z]:[\\/]|^\\\\/.test(n);return iN(l?n.toLowerCase():n)}function iN(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 Rg=p.createContext({accounts:[],auth:{},multi:!1});function Dg(){return p.useContext(Rg)}function rN(n,l="claude"){const{accounts:i,multi:r}=p.useContext(Rg);return!r||l!==void 0&&l!=="claude"||!n?null:i.find(o=>o.id===n)??null}const Ch={orange:"оранжевый",blue:"синий",green:"зелёный",purple:"фиолетовый",pink:"розовый",teal:"бирюзовый"};function e0(n){const l=Array.from(n.trim())[0];return l?l.toUpperCase():"?"}function t0(n){return n?n.loggedIn?n.plan||"вход выполнен":"вход не выполнен":""}const n0="ccv:last-account";function cN(){try{return localStorage.getItem(n0)}catch{return null}}function oN(n){try{localStorage.setItem(n0,n)}catch{}}function Sa({account:n,size:l="sm",className:i}){const r=`Аккаунт «${n.name}», ${Ch[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:e0(n.name)})})}function tb({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:e0(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 Xi,Wo,Jo,eu,tu,Hd,nu,Wh,s0;class uN{constructor(l){Ln(this,Wh);Ln(this,Xi,null);Ln(this,Wo,new Set);Ln(this,Jo,500);Ln(this,eu,null);Ln(this,tu,!1);Ln(this,Hd,null);Ln(this,nu,null);this.url=l}get statusText(){return this.connected?"Хост на связи":"Нет связи с хостом"}onStatus(l){qt(this,nu,l)}connect(){if(lt(this,tu))return;const l=new WebSocket(this.url);qt(this,Xi,l),l.addEventListener("open",()=>{var i,r;qt(this,Jo,500),this.send({type:"hello",protocol:Wy,clientName:"ccv-web"}),(i=lt(this,Hd))==null||i.call(this),(r=lt(this,nu))==null||r.call(this)}),l.addEventListener("message",i=>{let r;try{r=JSON.parse(String(i.data))}catch{return}for(const o of lt(this,Wo))o(r)}),l.addEventListener("close",()=>{var i;qt(this,Xi,null),(i=lt(this,nu))==null||i.call(this),Jn(this,Wh,s0).call(this)}),l.addEventListener("error",()=>l.close())}onReconnect(l){qt(this,Hd,l)}on(l){return lt(this,Wo).add(l),()=>lt(this,Wo).delete(l)}send(l){var i;((i=lt(this,Xi))==null?void 0:i.readyState)===WebSocket.OPEN&<(this,Xi).send(JSON.stringify(l))}get connected(){var l;return((l=lt(this,Xi))==null?void 0:l.readyState)===WebSocket.OPEN}close(){var l;qt(this,tu,!0),(l=lt(this,Xi))==null||l.close()}}Xi=new WeakMap,Wo=new WeakMap,Jo=new WeakMap,eu=new WeakMap,tu=new WeakMap,Hd=new WeakMap,nu=new WeakMap,Wh=new WeakSet,s0=function(){if(lt(this,tu)||lt(this,eu)!==null)return;const l=lt(this,Jo);qt(this,Jo,Math.min(l*2,1e4)),qt(this,eu,window.setTimeout(()=>{qt(this,eu,null),this.connect()},l))};const dN=1,l0="ccv:relay",Th="ccv:relay.host";function fN(){try{const n=localStorage.getItem(l0);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 a0(){localStorage.removeItem(l0)}var ii,su,ri,lu,au,Fr,zc,Ic,Xr,$c,iu,Uc,Bc,vn,Hr,eg,i0,Mc,tg;class hN{constructor(l){Ln(this,vn);Ln(this,ii,null);Ln(this,su,new Set);Ln(this,ri,null);Ln(this,lu,null);Ln(this,au,500);Ln(this,Fr,null);Ln(this,zc,!1);Ln(this,Ic,!1);Ln(this,Xr,!1);Ln(this,$c,null);Ln(this,iu,"Подключаемся…");Ln(this,Uc,0);Ln(this,Bc,[]);this.session=l}get connected(){return lt(this,Ic)&<(this,Xr)}get statusText(){return lt(this,iu)}get hostId(){return lt(this,$c)}on(l){return lt(this,su).add(l),()=>lt(this,su).delete(l)}onReconnect(l){qt(this,lu,l)}onStatus(l){qt(this,ri,l)}connect(){lt(this,zc)||Jn(this,vn,eg).call(this)}send(l){if(!lt(this,Ic)){lt(this,Bc).length<64&<(this,Bc).push(l);return}Jn(this,vn,Mc).call(this,{t:"client.frame",body:l})}close(){var l;qt(this,zc,!0),lt(this,Fr)!==null&&window.clearTimeout(lt(this,Fr)),(l=lt(this,ii))==null||l.close()}}ii=new WeakMap,su=new WeakMap,ri=new WeakMap,lu=new WeakMap,au=new WeakMap,Fr=new WeakMap,zc=new WeakMap,Ic=new WeakMap,Xr=new WeakMap,$c=new WeakMap,iu=new WeakMap,Uc=new WeakMap,Bc=new WeakMap,vn=new WeakSet,Hr=function(l){var i;lt(this,iu)!==l&&(qt(this,iu,l),(i=lt(this,ri))==null||i.call(this))},eg=async function(){if(lt(this,ii))return;if(!lt(this,$c))try{qt(this,$c,await mN(this.session.token))}catch(r){Jn(this,vn,Hr).call(this,r instanceof Error?r.message:String(r)),Jn(this,vn,tg).call(this);return}const l=location.protocol==="https:"?"wss":"ws",i=new WebSocket(`${l}://${location.host}/relay/client`);qt(this,ii,i),i.addEventListener("open",()=>{Jn(this,vn,Mc).call(this,{t:"client.hello",protocol:dN,token:this.session.token})}),i.addEventListener("message",r=>{let o;try{o=JSON.parse(String(r.data))}catch{return}Jn(this,vn,i0).call(this,o)}),i.addEventListener("close",()=>{var r;qt(this,ii,null),qt(this,Ic,!1),qt(this,Xr,!1),Jn(this,vn,Hr).call(this,"Нет связи с сервером"),(r=lt(this,ri))==null||r.call(this),Jn(this,vn,tg).call(this)}),i.addEventListener("error",()=>i.close())},i0=function(l){var i,r,o,u,f,g,x;switch(l.t){case"client.ok":qt(this,au,500),Jn(this,vn,Mc).call(this,{t:"client.attach",hostId:lt(this,$c)??"",...lt(this,Uc)>0?{sinceRseq:lt(this,Uc)}:{}});return;case"client.attached":qt(this,Ic,!0),qt(this,Xr,l.online),qt(this,Uc,l.rseq),Jn(this,vn,Hr).call(this,l.online?"Хост на связи":"Компьютер не на связи"),Jn(this,vn,Mc).call(this,{t:"client.frame",body:{type:"hello",protocol:Wy,clientName:"ccv-web-relay"}});const _=lt(this,Bc);qt(this,Bc,[]);for(const b of _)Jn(this,vn,Mc).call(this,{t:"client.frame",body:b});(i=lt(this,lu))==null||i.call(this),(r=lt(this,ri))==null||r.call(this);return;case"host.frame":{l.rseq>0&&qt(this,Uc,l.rseq);const b=l.body;for(const j of lt(this,su))j(b);return}case"host.online":qt(this,Xr,!0),Jn(this,vn,Hr).call(this,"Хост на связи"),(o=lt(this,lu))==null||o.call(this),(u=lt(this,ri))==null||u.call(this);return;case"host.offline":qt(this,Xr,!1),Jn(this,vn,Hr).call(this,"Компьютер не на связи"),(f=lt(this,ri))==null||f.call(this);return;case"ping":Jn(this,vn,Mc).call(this,{t:"pong",nonce:l.nonce});return;case"error":if(l.code==="auth"){a0(),location.href="/login";return}if(l.code==="not_found"){localStorage.removeItem(Th),Jn(this,vn,Hr).call(this,"Этот компьютер отвязан от аккаунта"),qt(this,zc,!0),(g=lt(this,ii))==null||g.close();return}l.code!=="offline"&&Jn(this,vn,Hr).call(this,l.message),(x=lt(this,ri))==null||x.call(this);return}},Mc=function(l){var i;((i=lt(this,ii))==null?void 0:i.readyState)===WebSocket.OPEN&<(this,ii).send(JSON.stringify(l))},tg=function(){if(lt(this,zc)||lt(this,Fr)!==null)return;const l=lt(this,au);qt(this,au,Math.min(l*2,1e4)),qt(this,Fr,window.setTimeout(()=>{qt(this,Fr,null),Jn(this,vn,eg).call(this)},l))};async function mN(n){const l=new URLSearchParams(location.search).get("host");if(l)return localStorage.setItem(Th,l),l;const i=localStorage.getItem(Th);if(i)return i;const r=await fetch("/api/hosts",{headers:{authorization:`Bearer ${n}`}});if(r.status===401)throw a0(),location.href="/login",new Error("нужен вход");const u=(await r.json()).hosts??[];if(u.length===1&&u[0])return localStorage.setItem(Th,u[0].id),u[0].id;throw location.href="/hosts",new Error("выберите компьютер")}function Ah(){return location.pathname==="/app"||location.pathname.startsWith("/app/")?"relay":"local"}const pN=`${location.protocol==="https:"?"wss":"ws"}://${location.host}/ws`;function gN(){if(Ah()==="local")return new uN(pN);const n=fN();return n?new hN(n):(location.replace(`/login?next=${encodeURIComponent(location.pathname+location.search)}`),null)}const r0="ccv:drafts",c0=40,xN=2e4,_N=500;let Rd=null,Dd=null;function Lg(){if(Rd)return Rd;const n=new Map;try{const l=localStorage.getItem(r0);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 Rd=n,window.addEventListener("pagehide",f0),n}function wp(n){return Lg().get(n)??""}function o0(n,l){const i=Lg(),r=l.slice(0,xN),o=i.has(n);if(o&&i.delete(n),r!=="")i.set(n,r);else if(!o)return;for(;i.size>c0;){const u=i.keys().next();if(u.done)break;i.delete(u.value)}yN(),d0()}function u0(){const n=new Set,l=[...Lg().keys(),...Dc.keys()];for(const i of l)n.add(i.startsWith("side:")?i.slice(5):i);return[...n].sort()}const Dc=new Map;function Sp(n){return Dc.get(n)??{images:[],docs:[]}}function nb(n,l){for(Dc.delete(n),(l.images.length>0||l.docs.length>0)&&Dc.set(n,l);Dc.size>c0;){const i=Dc.keys().next();if(i.done)break;Dc.delete(i.value)}d0()}const ng=new Set;let sb="";function bN(n){return ng.add(n),()=>ng.delete(n)}function d0(){const n=u0(),l=n.join(`
|
|
51
|
+
`);if(l!==sb){sb=l;for(const i of ng)i(n)}}function yN(){Dd===null&&(Dd=window.setTimeout(f0,_N))}function f0(){if(Dd!==null&&window.clearTimeout(Dd),Dd=null,!!Rd)try{localStorage.setItem(r0,JSON.stringify(Object.fromEntries(Rd)))}catch{}}const $s={items:[],pending:[],lastSeq:0,contextTokens:null},Ep={entries:[],total:0,loading:!1};function h0(n){var l;return((l=n.entries[0])==null?void 0:l.seq)??1}function Cp(n){return n.total>0&&h0(n)>1}function vN(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 jN(n){return Mh($s,n).items.map(l=>({...l,id:`h:${l.id}`}))}function Mh(n,l){let i=n;for(const r of l)r.seq<=i.lastSeq||(i={...NN(i,r.event,r.seq),lastSeq:r.seq});return i}function NN(n,l,i){var o,u;const r=n.items;switch(l.kind){case"user.message":return Ja(n,{id:`u${i}`,kind:"user",text:l.text,images:l.images,files:l.files});case"assistant.delta":{const f=r.findIndex(x=>x.id===l.blockId);if(f===-1)return Ja(n,{id:l.blockId,kind:"assistant",text:l.text,streaming:!0});const g=r[f];return qo(n,f,{...g,text:g.text+l.text})}case"assistant.text":{const f=r.findIndex(x=>x.id===l.blockId),g={id:l.blockId,kind:"assistant",text:l.text,streaming:!1};return f===-1?Ja(n,g):qo(n,f,g)}case"thinking.delta":{const f=r.findIndex(x=>x.id===l.blockId);if(f===-1)return Ja(n,{id:l.blockId,kind:"thinking",text:l.text});const g=r[f];return qo(n,f,{...g,text:g.text+l.text})}case"assistant.thinking":{const f=r.findIndex(x=>x.id===l.blockId),g={id:l.blockId,kind:"thinking",text:l.text};return f===-1?Ja(n,g):qo(n,f,g)}case"tool.use":return Ja(n,{id:`t${l.toolUseId}`,kind:"tool",toolUseId:l.toolUseId,name:l.name,input:l.input,result:null,isError:!1,awaitingPermission:!1});case"tool.result":{const f=r.findIndex(x=>x.kind==="tool"&&x.toolUseId===l.toolUseId);if(f===-1)return n;const g=r[f];return qo(n,f,{...g,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 f=n.pending.find(x=>x.requestId===l.requestId),g=n.pending.filter(x=>x.requestId!==l.requestId);if(l.answers&&(f!=null&&f.toolUseId)){const x=r.findIndex(_=>_.kind==="tool"&&_.toolUseId===f.toolUseId);if(x!==-1){const _=r[x];return qo({...n,pending:g},x,{..._,answers:l.answers})}}return l.decision==="allow"?{...n,pending:g}:Ja({...n,pending:g},{id:`p${i}`,kind:"notice",tone:"info",text:`Отклонено${l.reason?`: ${l.reason}`:""}`})}case"result":{const f=n.items.map(x=>x.kind==="assistant"&&x.streaming?{...x,streaming:!1}:x),g=l.contextTokens??n.contextTokens;return Ja({...n,items:f,contextTokens:g},{id:`r${i}`,kind:"result",subtype:l.subtype,isError:l.isError,durationMs:l.durationMs,costUsd:l.costUsd,inputTokens:((o=l.usage)==null?void 0:o.inputTokens)??0,outputTokens:((u=l.usage)==null?void 0:u.outputTokens)??0})}case"system":return l.subtype!=="compact_boundary"?n:Ja(n,{id:`s${i}`,kind:"notice",tone:"info",text:"Контекст сжат"});case"error":return Ja(n,{id:`e${i}`,kind:"notice",tone:"error",text:l.message});case"state":return n;case"rewound":return n;default:return n}}function kN(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 wN(n,l,i){const r=l-i;if(r<=0)return[];let o=0;for(let u=0;u<n.length;u++)if(n[u].kind==="user"){if(o===r)return n.slice(0,u);o++}return n}function Ja(n,l){return{...n,items:[...n.items,l]}}function qo(n,l,i){const r=n.items.slice();return r[l]=i,{...n,items:r}}const sg="ccv:theme",Tp=["system","light","dark"];function SN(){const[n,l]=p.useState(EN);p.useEffect(()=>{const o=window.matchMedia("(prefers-color-scheme: dark)"),u=()=>{const f=n==="dark"||n==="system"&&o.matches;document.documentElement.dataset.theme=f?"dark":"light"};return u(),o.addEventListener("change",u),()=>o.removeEventListener("change",u)},[n]);const i=p.useCallback(o=>{try{localStorage.setItem(sg,o)}catch{}l(o)},[]),r=p.useCallback(()=>{l(o=>{const u=Tp[(Tp.indexOf(o)+1)%Tp.length];try{localStorage.setItem(sg,u)}catch{}return u})},[]);return[n,i,r]}function EN(){try{const n=localStorage.getItem(sg);if(n==="light"||n==="dark"||n==="system")return n}catch{}return"system"}const Og=[{value:"default",hint:"спрашивать перед каждым действием"},{value:"acceptEdits",hint:"правки файлов без подтверждения"},{value:"plan",hint:"только чтение и план, без изменений"},{value:"auto",hint:"спрашивать только о рискованном — решает сам"},{value:"bypassPermissions",hint:"ничего не спрашивать"}],CN=[{value:"default",hint:"рискованное agy отклоняет сам: спросить он не может"},{value:"acceptEdits",hint:"правки файлов без подтверждения, команды — нет"},{value:"plan",hint:"только план, без изменений"},{value:"bypassPermissions",hint:"разрешено всё, включая команды"}],TN=[{value:"default",hint:"спрашивать перед командами и правками"},{value:"acceptEdits",hint:"правки файлов без подтверждения, команды — с вопросом"},{value:"plan",hint:"только чтение и план, без изменений"},{value:"dontAsk",hint:"не спрашивать: что вне песочницы, отклоняется"},{value:"bypassPermissions",hint:"ничего не спрашивать, без песочницы"}];function es(n){return n==null||n==="claude"}function lb(n){return n==="antigravity"?"Antigravity":n==="codex"?"Codex":"Claude"}const Hc={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:"вопроса"}},AN=320,m0="ccv:panes";function MN(n){return`--${n}-w`}function p0(n,l){const i=Hc[n];return Math.round(Math.min(i.max,Math.max(i.min,l)))}function RN(){const n={};for(const l of Object.keys(Hc))n[l]=Hc[l].width;try{const l=localStorage.getItem(m0);if(l){const i=JSON.parse(l);for(const r of Object.keys(Hc)){const o=i[r];typeof o=="number"&&Number.isFinite(o)&&(n[r]=p0(r,o))}}}catch{}return n}function DN(){const[n,l]=p.useState(RN),i=p.useCallback(f=>{try{localStorage.setItem(m0,JSON.stringify(f))}catch{}},[]),r=p.useCallback((f,g)=>{l(x=>{const _=p0(f,g);if(x[f]===_)return x;const b={...x,[f]:_};return i(b),b})},[i]),o=p.useCallback(f=>{l(g=>{const x={...g,[f]:Hc[f].width};return i(x),x})},[i]),u={};for(const f of Object.keys(Hc))u[MN(f)]=`${n[f]}px`;return{widths:n,style:u,setWidth:r,reset:o}}const Ap=260,g0=120,LN=200,ab="ccv:terminal-h";function ib(n,l){return Math.round(Math.min(l,Math.max(g0,n)))}function ON(){const[n,l]=p.useState(()=>{try{const u=localStorage.getItem(ab);if(u){const f=Number(u);if(Number.isFinite(f))return ib(f,1/0)}}catch{}return Ap}),i=p.useCallback(u=>{try{localStorage.setItem(ab,String(u))}catch{}},[]),r=p.useCallback((u,f)=>{const g=ib(u,f);l(x=>x===g?x:(i(g),g))},[i]),o=p.useCallback(()=>{l(Ap),i(Ap)},[i]);return{height:n,setHeight:r,reset:o}}function ru(n){const[l,i]=p.useState(()=>typeof window>"u"?!1:window.matchMedia(n).matches);return p.useEffect(()=>{const r=window.matchMedia(n),o=()=>i(r.matches);return o(),r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[n]),l}const zN=500,IN=6;function x0({onLongPress:n,onClick:l,disabled:i=!1,thresholdMs:r=zN,moveCancelPx:o=IN}){const u=p.useRef(null),[f,g]=p.useState(!1),x=p.useCallback(()=>{u.current&&window.clearTimeout(u.current.timer),u.current=null,g(!1)},[]),_=p.useCallback(E=>{if(i||E.button!==0)return;const C={timer:0,x:E.clientX,y:E.clientY,fired:!1};C.timer=window.setTimeout(()=>{C.fired=!0,g(!1),n()},r),u.current=C,g(!0)},[i,r,n]),b=p.useCallback(E=>{const C=u.current;!C||C.fired||Math.hypot(E.clientX-C.x,E.clientY-C.y)>o&&x()},[o,x]),j=p.useCallback(()=>{u.current&&!u.current.fired?x():g(!1)},[x]),N=p.useCallback(E=>{var C;if((C=u.current)!=null&&C.fired){u.current=null,E.preventDefault();return}if(!i){if(E.shiftKey){n();return}l()}},[i,l,n]),k=p.useCallback(E=>{E.preventDefault()},[]),w=p.useCallback(E=>{i||E.shiftKey&&(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),n())},[i,n]);return{holding:f,thresholdMs:r,handlers:{onPointerDown:_,onPointerMove:b,onPointerUp:j,onPointerCancel:j,onPointerLeave:j,onClick:N,onContextMenu:k,onKeyDown:w}}}const $N={height:0,offsetTop:0,offsetLeft:0};function rb(){if(typeof window>"u")return $N;const n=window.visualViewport;return n?{height:n.height,offsetTop:n.offsetTop,offsetLeft:n.offsetLeft}:{height:window.innerHeight,offsetTop:0,offsetLeft:0}}function UN(n){const[l,i]=p.useState(rb);return p.useEffect(()=>{if(!n)return;const r=window.visualViewport,o=()=>{const u=rb();i(f=>f.height===u.height&&f.offsetTop===u.offsetTop&&f.offsetLeft===u.offsetLeft?f: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 zg(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Yc=zg();function _0(n){Yc=n}var Lc={exec:()=>null};function Go(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 Rt(n,l=""){let i=typeof n=="string"?n:n.source,r={replace:(o,u)=>{let f=typeof u=="string"?u:u.source;return f=f.replace(Us.caret,"$1"),i=i.replace(o,f),r},getRegex:()=>new RegExp(i,l)};return r}var BN=((n="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+n)}catch{return!1}})(),Us={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:Go(n=>new RegExp(`^ {0,${n}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Go(n=>new RegExp(`^ {0,${n}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Go(n=>new RegExp(`^ {0,${n}}(?:\`\`\`|~~~)`)),headingBeginRegex:Go(n=>new RegExp(`^ {0,${n}}#`)),htmlBeginRegex:Go(n=>new RegExp(`^ {0,${n}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Go(n=>new RegExp(`^ {0,${n}}>`))},HN=/^(?:[ \t]*(?:\n|$))+/,qN=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,GN=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,qd=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,YN=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ig=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,b0=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,y0=Rt(b0).replace(/bull/g,Ig).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(),VN=Rt(b0).replace(/bull/g,Ig).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(),$g=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,FN=/^[^\n]+/,Ug=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,XN=Rt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ug).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),KN=Rt(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Ig).getRegex(),Jh="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",Bg=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,QN=Rt("^ {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",Bg).replace("tag",Jh).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),v0=n=>Rt($g).replace("hr",qd).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",Jh).getRegex(),PN=v0(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),ZN=v0(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),WN=Rt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ZN).getRegex(),Hg={blockquote:WN,code:qN,def:XN,fences:GN,heading:YN,hr:qd,html:QN,lheading:y0,list:KN,newline:HN,paragraph:PN,table:Lc,text:FN},cb=Rt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",qd).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",Jh).getRegex(),JN={...Hg,lheading:VN,table:cb,paragraph:Rt($g).replace("hr",qd).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",cb).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",Jh).getRegex()},e1={...Hg,html:Rt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Bg).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:Lc,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Rt($g).replace("hr",qd).replace("heading",` *#{1,6} *[^
|
|
52
|
+
]`).replace("lheading",y0).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},t1=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,n1=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,j0=/^( {2,}|\\)\n(?!\s*$)/,s1=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,cu=/[\p{P}\p{S}]/u,em=/[\s\p{P}\p{S}]/u,qg=/[^\s\p{P}\p{S}]/u,l1=Rt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,em).getRegex(),N0=/(?!~)[\p{P}\p{S}]/u,a1=/(?!~)[\s\p{P}\p{S}]/u,i1=/(?:[^\s\p{P}\p{S}]|~)/u,r1=Rt(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",BN?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),k0=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,c1=Rt(k0,"u").replace(/punct/g,cu).getRegex(),o1=Rt(k0,"u").replace(/punct/g,N0).getRegex(),w0="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",u1=Rt(w0,"gu").replace(/notPunctSpace/g,qg).replace(/punctSpace/g,em).replace(/punct/g,cu).getRegex(),d1=Rt(w0,"gu").replace(/notPunctSpace/g,i1).replace(/punctSpace/g,a1).replace(/punct/g,N0).getRegex(),f1=Rt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,qg).replace(/punctSpace/g,em).replace(/punct/g,cu).getRegex(),h1=Rt(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,cu).getRegex(),m1="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",p1=Rt(m1,"gu").replace(/notPunctSpace/g,qg).replace(/punctSpace/g,em).replace(/punct/g,cu).getRegex(),g1=Rt(/\\(punct)/,"gu").replace(/punct/g,cu).getRegex(),x1=Rt(/^<(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(),_1=Rt(Bg).replace("(?:-->|$)","-->").getRegex(),b1=Rt("^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",_1).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),$h=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,y1=Rt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",$h).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),S0=Rt(/^!?\[(label)\]\[(ref)\]/).replace("label",$h).replace("ref",Ug).getRegex(),E0=Rt(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ug).getRegex(),v1=Rt("reflink|nolink(?!\\()","g").replace("reflink",S0).replace("nolink",E0).getRegex(),ob=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Gg={_backpedal:Lc,anyPunctuation:g1,autolink:x1,blockSkip:r1,br:j0,code:n1,del:Lc,delLDelim:Lc,delRDelim:Lc,emStrongLDelim:c1,emStrongRDelimAst:u1,emStrongRDelimUnd:f1,escape:t1,link:y1,nolink:E0,punctuation:l1,reflink:S0,reflinkSearch:v1,tag:b1,text:s1,url:Lc},j1={...Gg,link:Rt(/^!?\[(label)\]\((.*?)\)/).replace("label",$h).getRegex(),reflink:Rt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",$h).getRegex()},lg={...Gg,emStrongRDelimAst:d1,emStrongLDelim:o1,delLDelim:h1,delRDelim:p1,url:Rt(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",ob).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:Rt(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",ob).getRegex()},N1={...lg,br:Rt(j0).replace("{2,}","*").getRegex(),text:Rt(lg.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},rh={normal:Hg,gfm:JN,pedantic:e1},yd={normal:Gg,gfm:lg,breaks:N1,pedantic:j1},k1={"&":"&","<":"<",">":">",'"':""","'":"'"},ub=n=>k1[n];function si(n,l){if(l){if(Us.escapeTest.test(n))return n.replace(Us.escapeReplace,ub)}else if(Us.escapeTestNoEncode.test(n))return n.replace(Us.escapeReplaceNoEncode,ub);return n}function db(n){try{n=encodeURI(n).replace(Us.percentDecode,"%")}catch{return null}return n}function fb(n,l){var u;let i=n.replace(Us.findPipe,(f,g,x)=>{let _=!1,b=g;for(;--b>=0&&x[b]==="\\";)_=!_;return _?"|":" |"}),r=i.split(Us.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(Us.slashPipe,"|");return r}function $r(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 hb(n){let l=n.split(`
|
|
53
|
+
`),i=l.length-1;for(;i>=0&&Us.blankLine.test(l[i]);)i--;return l.length-i<=2?n:l.slice(0,i+1).join(`
|
|
54
|
+
`)}function w1(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 S1(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 mb(n,l,i,r,o){let u=l.href,f=l.title||null,g=n[1].replace(o.other.outputLinkReplace,"$1");r.state.inLink=!0;let x={type:n[0].charAt(0)==="!"?"image":"link",raw:i,href:u,title:f,text:g,tokens:r.inlineTokens(g)};return r.state.inLink=!1,x}function E1(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 f=u.match(i.other.beginningSpace);if(f===null)return u;let[g]=f;return g.length>=o.length?u.slice(o.length):u}).join(`
|
|
56
|
+
`)}var Uh=class{constructor(n){Jt(this,"options");Jt(this,"rules");Jt(this,"lexer");this.options=n||Yc}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]:hb(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=E1(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=$r(i,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(i=r.trim())}return{type:"heading",raw:$r(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:$r(l[0],`
|
|
58
|
+
`)}}blockquote(n){let l=this.rules.block.blockquote.exec(n);if(l){let i=$r(l[0],`
|
|
59
|
+
`).split(`
|
|
60
|
+
`),r="",o="",u=[];for(;i.length>0;){let f=!1,g=[],x;for(x=0;x<i.length;x++)if(this.rules.other.blockquoteStart.test(i[x]))g.push(i[x]),f=!0;else if(!f)g.push(i[x]);else break;i=i.slice(x);let _=g.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 k=N,w=k.raw+`
|
|
65
|
+
`+i.join(`
|
|
66
|
+
`),E=this.blockquote(w);u[u.length-1]=E,r=r.substring(0,r.length-k.raw.length)+E.raw,o=o.substring(0,o.length-k.text.length)+E.text;break}else if((N==null?void 0:N.type)==="list"){let k=N,w=k.raw+`
|
|
67
|
+
`+i.join(`
|
|
68
|
+
`),E=this.list(w);u[u.length-1]=E,r=r.substring(0,r.length-N.raw.length)+E.raw,o=o.substring(0,o.length-k.raw.length)+E.raw,i=w.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),f=!1;for(;n;){let x=!1,_="",b="";if(!(l=u.exec(n))||this.rules.block.hr.test(n))break;_=l[0],n=n.substring(_.length);let j=S1(l[2].split(`
|
|
70
|
+
`,1)[0],l[1].length),N=n.split(`
|
|
71
|
+
`,1)[0],k=!j.trim(),w=0;if(this.options.pedantic?(w=2,b=j.trimStart()):k?w=l[1].length+1:(w=j.search(this.rules.other.nonSpaceChar),w=w>4?1:w,b=j.slice(w),w+=l[1].length),k&&this.rules.other.blankLine.test(N)&&(_+=N+`
|
|
72
|
+
`,n=n.substring(N.length+1),x=!0),!x){let E=this.rules.other.nextBulletRegex(w),C=this.rules.other.hrRegex(w),T=this.rules.other.fencesBeginRegex(w),z=this.rules.other.headingBeginRegex(w),q=this.rules.other.htmlBeginRegex(w),te=this.rules.other.blockquoteBeginRegex(w);for(;n;){let I=n.split(`
|
|
73
|
+
`,1)[0],R;if(N=I,this.options.pedantic?(N=N.replace(this.rules.other.listReplaceNesting," "),R=N):R=N.replace(this.rules.other.tabCharGlobal," "),T.test(N)||z.test(N)||q.test(N)||te.test(N)||E.test(N)||C.test(N))break;if(R.search(this.rules.other.nonSpaceChar)>=w||!N.trim())b+=`
|
|
74
|
+
`+R.slice(w);else{if(k||j.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||T.test(j)||z.test(j)||C.test(j))break;b+=`
|
|
75
|
+
`+N}k=!N.trim(),_+=I+`
|
|
76
|
+
`,n=n.substring(I.length+1),j=R.slice(w)}}o.loose||(f?o.loose=!0:this.rules.other.doubleBlankLine.test(_)&&(f=!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 g=o.items.at(-1);if(g)g.raw=g.raw.trimEnd(),g.text=g.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let x of o.items){this.lexer.state.top=!1,x.tokens=this.lexer.blockTokens(x.text,[]);let _=x.tokens[0];if(x.task&&((_==null?void 0:_.type)==="text"||(_==null?void 0:_.type)==="paragraph")){x.text=x.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(x.raw);if(b){let j={type:"checkbox",raw:b[0]+" ",checked:b[0]!=="[ ]"};x.checked=j.checked,o.loose?x.tokens[0]&&["paragraph","text"].includes(x.tokens[0].type)&&"tokens"in x.tokens[0]&&x.tokens[0].tokens?(x.tokens[0].raw=j.raw+x.tokens[0].raw,x.tokens[0].text=j.raw+x.tokens[0].text,x.tokens[0].tokens.unshift(j)):x.tokens.unshift({type:"paragraph",raw:j.raw,text:j.raw,tokens:[j]}):x.tokens.unshift(j)}}else x.task&&(x.task=!1);if(!o.loose){let b=x.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 x of o.items){x.loose=!0;for(let _ of x.tokens)_.type==="text"&&(_.type="paragraph")}return o}}html(n){let l=this.rules.block.html.exec(n);if(l){let i=hb(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:$r(l[0],`
|
|
77
|
+
`),href:r,title:o}}}table(n){var f;let l=this.rules.block.table.exec(n);if(!l||!this.rules.other.tableDelimiter.test(l[2]))return;let i=fb(l[1]),r=l[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=(f=l[3])!=null&&f.trim()?l[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
78
|
+
`):[],u={type:"table",raw:$r(l[0],`
|
|
79
|
+
`),header:[],align:[],rows:[]};if(i.length===r.length){for(let g of r)this.rules.other.tableAlignRight.test(g)?u.align.push("right"):this.rules.other.tableAlignCenter.test(g)?u.align.push("center"):this.rules.other.tableAlignLeft.test(g)?u.align.push("left"):u.align.push(null);for(let g=0;g<i.length;g++)u.header.push({text:i[g],tokens:this.lexer.inline(i[g]),header:!0,align:u.align[g]});for(let g of o)u.rows.push(fb(g,u.header.length).map((x,_)=>({text:x,tokens:this.lexer.inline(x),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:$r(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=$r(i.slice(0,-1),"\\");if((i.length-u.length)%2===0)return}else{let u=w1(l[2],"()");if(u===-2)return;if(u>-1){let f=(l[0].indexOf("!")===0?5:4)+l[1].length+u;l[2]=l[2].substring(0,u),l[0]=l[0].substring(0,f).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)),mb(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 mb(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,f,g=o,x=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(f=[...u].length,r[3]||r[4]){g+=f;continue}else if((r[5]||r[6])&&o%3&&!((o+f)%3)){x+=f;continue}if(g-=f,g>0)continue;f=Math.min(f,f+g+x);let b=[...r[0]][0].length,j=n.slice(0,o+r.index+b+f);if(Math.min(o,f)%2){let k=j.slice(1,-1);return{type:"em",raw:j,text:k,tokens:this.lexer.inlineTokens(k)}}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,f,g=o,x=this.rules.inline.delRDelim;for(x.lastIndex=0,l=l.slice(-1*n.length+o);(r=x.exec(l))!==null;){if(u=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!u||(f=[...u].length,f!==o))continue;if(r[3]||r[4]){g+=f;continue}if(g-=f,g>0)continue;f=Math.min(f,f+g);let _=[...r[0]][0].length,b=n.slice(0,o+r.index+_+f),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 ag{constructor(l){Jt(this,"tokens");Jt(this,"options");Jt(this,"state");Jt(this,"inlineQueue");Jt(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=l||Yc,this.options.tokenizer=this.options.tokenizer||new Uh,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:Us,block:rh.normal,inline:yd.normal};this.options.pedantic?(i.block=rh.pedantic,i.inline=yd.pedantic):this.options.gfm&&(i.block=rh.gfm,this.options.breaks?i.inline=yd.breaks:i.inline=yd.gfm),this.tokenizer.rules=i}static get rules(){return{block:rh,inline:yd}}static lex(l,i){return new ag(i).lex(l)}static lexInline(l,i){return new ag(i).inlineTokens(l)}lex(l){l=l.replace(Us.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,f,g;this.tokenizer.lexer=this,this.options.pedantic&&(l=l.replace(Us.tabCharGlobal," ").replace(Us.spaceLine,""));let o=1/0;for(;l;){if(l.length<o)o=l.length;else{this.infiniteLoopError(l.charCodeAt(0));break}let x;if((f=(u=this.options.extensions)==null?void 0:u.block)!=null&&f.some(b=>(x=b.call({lexer:this},l,i))?(l=l.substring(x.raw.length),i.push(x),!0):!1))continue;if(x=this.tokenizer.space(l)){l=l.substring(x.raw.length);let b=i.at(-1);x.raw.length===1&&b!==void 0?b.raw+=`
|
|
83
|
+
`:i.push(x);continue}if(x=this.tokenizer.code(l)){l=l.substring(x.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
|
+
`)+x.raw,b.text+=`
|
|
86
|
+
`+x.text,this.inlineQueue.at(-1).src=b.text):i.push(x);continue}if(x=this.tokenizer.fences(l)){l=l.substring(x.raw.length),i.push(x);continue}if(x=this.tokenizer.heading(l)){l=l.substring(x.raw.length),i.push(x);continue}if(x=this.tokenizer.hr(l)){l=l.substring(x.raw.length),i.push(x);continue}if(x=this.tokenizer.blockquote(l)){l=l.substring(x.raw.length),i.push(x);continue}if(x=this.tokenizer.list(l)){l=l.substring(x.raw.length),i.push(x);continue}if(x=this.tokenizer.html(l)){l=l.substring(x.raw.length),i.push(x);continue}if(x=this.tokenizer.def(l)){l=l.substring(x.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
|
+
`)+x.raw,b.text+=`
|
|
89
|
+
`+x.raw,this.inlineQueue.at(-1).src=b.text):this.tokens.links[x.tag]||(this.tokens.links[x.tag]={href:x.href,title:x.title},i.push(x));continue}if(x=this.tokenizer.table(l)){l=l.substring(x.raw.length),i.push(x);continue}if(x=this.tokenizer.lheading(l)){l=l.substring(x.raw.length),i.push(x);continue}let _=l;if((g=this.options.extensions)!=null&&g.startBlock){let b=1/0,j=l.slice(1),N;this.options.extensions.startBlock.forEach(k=>{N=k.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&&(x=this.tokenizer.paragraph(_))){let b=i.at(-1);r&&(b==null?void 0:b.type)==="paragraph"?(b.raw+=(b.raw.endsWith(`
|
|
90
|
+
`)?"":`
|
|
91
|
+
`)+x.raw,b.text+=`
|
|
92
|
+
`+x.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=b.text):i.push(x),r=_.length!==l.length,l=l.substring(x.raw.length);continue}if(x=this.tokenizer.text(l)){l=l.substring(x.raw.length);let b=i.at(-1);(b==null?void 0:b.type)==="text"?(b.raw+=(b.raw.endsWith(`
|
|
93
|
+
`)?"":`
|
|
94
|
+
`)+x.raw,b.text+=`
|
|
95
|
+
`+x.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=b.text):i.push(x);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 g,x,_,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,k=>N.includes(k.slice(k.lastIndexOf("[")+1,-1))?"["+"a".repeat(k.length-2)+"]":k))}r=r.replace(this.tokenizer.rules.inline.anyPunctuation,"++"),r=r.replace(this.tokenizer.rules.inline.blockSkip,(N,k,w)=>{let E=w?w.length:0;return N.slice(0,E)+"["+"a".repeat(N.length-E-2)+"]"}),r=((x=(g=this.options.hooks)==null?void 0:g.emStrongMask)==null?void 0:x.call({lexer:this},r))??r;let o=!1,u="",f=1/0;for(;l;){if(l.length<f)f=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(w=>(N=w.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 w=i.at(-1);N.type==="text"&&(w==null?void 0:w.type)==="text"?(w.raw+=N.raw,w.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 k=l;if((j=this.options.extensions)!=null&&j.startInline){let w=1/0,E=l.slice(1),C;this.options.extensions.startInline.forEach(T=>{C=T.call({lexer:this},E),typeof C=="number"&&C>=0&&(w=Math.min(w,C))}),w<1/0&&w>=0&&(k=l.substring(0,w+1))}if(N=this.tokenizer.inlineText(k)){l=l.substring(N.raw.length),N.raw.slice(-1)!=="_"&&(u=N.raw.slice(-1)),o=!0;let w=i.at(-1);(w==null?void 0:w.type)==="text"?(w.raw+=N.raw,w.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)}},Bh=class{constructor(n){Jt(this,"options");Jt(this,"parser");this.options=n||Yc}space(n){return""}code({text:n,lang:l,escaped:i}){var u;let r=(u=(l||"").match(Us.notSpaceStart))==null?void 0:u[0],o=n.replace(Us.endingNewline,"")+`
|
|
96
|
+
`;return r?'<pre><code class="language-'+si(r)+'">'+(i?o:si(o,!0))+`</code></pre>
|
|
97
|
+
`:"<pre><code>"+(i?o:si(o,!0))+`</code></pre>
|
|
98
|
+
`}blockquote({tokens:n}){return`<blockquote>
|
|
99
|
+
${this.parser.parse(n)}</blockquote>
|
|
100
|
+
`}html({text:n}){return n}def(n){return""}heading({tokens:n,depth:l}){return`<h${l}>${this.parser.parseInline(n)}</h${l}>
|
|
101
|
+
`}hr(n){return`<hr>
|
|
102
|
+
`}list(n){let l=n.ordered,i=n.start,r="";for(let f=0;f<n.items.length;f++){let g=n.items[f];r+=this.listitem(g)}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 f=0;f<u.length;f++)i+=this.tablecell(u[f]);r+=this.tablerow({text:i})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
|
|
107
|
+
<thead>
|
|
108
|
+
`+l+`</thead>
|
|
109
|
+
`+r+`</table>
|
|
110
|
+
`}tablerow({text:n}){return`<tr>
|
|
111
|
+
${n}</tr>
|
|
112
|
+
`}tablecell(n){let l=this.parser.parseInline(n.tokens),i=n.header?"th":"td";return(n.align?`<${i} align="${n.align}">`:`<${i}>`)+l+`</${i}>
|
|
113
|
+
`}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${si(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:l,tokens:i}){let r=this.parser.parseInline(i),o=db(n);if(o===null)return r;n=o;let u='<a href="'+n+'"';return l&&(u+=' title="'+si(l)+'"'),u+=">"+r+"</a>",u}image({href:n,title:l,text:i,tokens:r}){r&&(i=this.parser.parseInline(r,this.parser.textRenderer));let o=db(n);if(o===null)return si(i);n=o;let u=`<img src="${n}" alt="${si(i)}"`;return l&&(u+=` title="${si(l)}"`),u+=">",u}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:si(n.text)}},Yg=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 ig{constructor(l){Jt(this,"options");Jt(this,"renderer");Jt(this,"textRenderer");this.options=l||Yc,this.options.renderer=this.options.renderer||new Bh,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Yg}static parse(l,i){return new ig(i).parse(l)}static parseInline(l,i){return new ig(i).parseInline(l)}parse(l){var r,o;this.renderer.parser=this;let i="";for(let u=0;u<l.length;u++){let f=l[u];if((o=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&o[f.type]){let x=f,_=this.options.extensions.renderers[x.type].call({parser:this},x);if(_!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(x.type)){i+=_||"";continue}}let g=f;switch(g.type){case"space":{i+=this.renderer.space(g);break}case"hr":{i+=this.renderer.hr(g);break}case"heading":{i+=this.renderer.heading(g);break}case"code":{i+=this.renderer.code(g);break}case"table":{i+=this.renderer.table(g);break}case"blockquote":{i+=this.renderer.blockquote(g);break}case"list":{i+=this.renderer.list(g);break}case"checkbox":{i+=this.renderer.checkbox(g);break}case"html":{i+=this.renderer.html(g);break}case"def":{i+=this.renderer.def(g);break}case"paragraph":{i+=this.renderer.paragraph(g);break}case"text":{i+=this.renderer.text(g);break}default:{let x='Token with "'+g.type+'" type was not found.';if(this.options.silent)return console.error(x),"";throw new Error(x)}}}return i}parseInline(l,i=this.renderer){var o,u;this.renderer.parser=this;let r="";for(let f=0;f<l.length;f++){let g=l[f];if((u=(o=this.options.extensions)==null?void 0:o.renderers)!=null&&u[g.type]){let _=this.options.extensions.renderers[g.type].call({parser:this},g);if(_!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(g.type)){r+=_||"";continue}}let x=g;switch(x.type){case"escape":{r+=i.text(x);break}case"html":{r+=i.html(x);break}case"link":{r+=i.link(x);break}case"image":{r+=i.image(x);break}case"checkbox":{r+=i.checkbox(x);break}case"strong":{r+=i.strong(x);break}case"em":{r+=i.em(x);break}case"codespan":{r+=i.codespan(x);break}case"br":{r+=i.br(x);break}case"del":{r+=i.del(x);break}case"text":{r+=i.text(x);break}default:{let _='Token with "'+x.type+'" type was not found.';if(this.options.silent)return console.error(_),"";throw new Error(_)}}}return r}},Eh,Ad=(Eh=class{constructor(n){Jt(this,"options");Jt(this,"block");this.options=n||Yc}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}},Jt(Eh,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),Jt(Eh,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Eh),C1=class{constructor(...n){Jt(this,"defaults",zg());Jt(this,"options",this.setOptions);Jt(this,"parse",this.parseMarkdown(!0));Jt(this,"parseInline",this.parseMarkdown(!1));Jt(this,"Parser",wa);Jt(this,"Renderer",Bh);Jt(this,"TextRenderer",Yg);Jt(this,"Lexer",ka);Jt(this,"Tokenizer",Uh);Jt(this,"Hooks",Ad);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 f=u;for(let g of f.header)i=i.concat(this.walkTokens(g.tokens,l));for(let g of f.rows)for(let x of g)i=i.concat(this.walkTokens(x.tokens,l));break}case"list":{let f=u;i=i.concat(this.walkTokens(f.items,l));break}default:{let f=u;(o=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&o[f.type]?this.defaults.extensions.childTokens[f.type].forEach(g=>{let x=f[g].flat(1/0);i=i.concat(this.walkTokens(x,l))}):f.tokens&&(i=i.concat(this.walkTokens(f.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(...f){let g=o.renderer.apply(this,f);return g===!1&&(g=u.apply(this,f)),g}: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 Bh(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 f=u,g=i.renderer[f],x=o[f];o[f]=(..._)=>{let b=g.apply(o,_);return b===!1&&(b=x.apply(o,_)),b||""}}r.renderer=o}if(i.tokenizer){let o=this.defaults.tokenizer||new Uh(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 f=u,g=i.tokenizer[f],x=o[f];o[f]=(..._)=>{let b=g.apply(o,_);return b===!1&&(b=x.apply(o,_)),b}}r.tokenizer=o}if(i.hooks){let o=this.defaults.hooks||new Ad;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 f=u,g=i.hooks[f],x=o[f];Ad.passThroughHooks.has(u)?o[f]=_=>{if(this.defaults.async&&Ad.passThroughHooksRespectAsync.has(u))return(async()=>{let j=await g.call(o,_);return x.call(o,j)})();let b=g.call(o,_);return x.call(o,b)}:o[f]=(..._)=>{if(this.defaults.async)return(async()=>{let j=await g.apply(o,_);return j===!1&&(j=await x.apply(o,_)),j})();let b=g.apply(o,_);return b===!1&&(b=x.apply(o,_)),b}}r.hooks=o}if(i.walkTokens){let o=this.defaults.walkTokens,u=i.walkTokens;r.walkTokens=function(f){let g=[];return g.push(u.call(this,f)),o&&(g=g.concat(o.call(this,f))),g}}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 f=o.hooks?await o.hooks.preprocess(l):l,g=await(o.hooks?await o.hooks.provideLexer(n):n?ka.lex:ka.lexInline)(f,o),x=o.hooks?await o.hooks.processAllTokens(g):g;o.walkTokens&&await Promise.all(this.walkTokens(x,o.walkTokens));let _=await(o.hooks?await o.hooks.provideParser(n):n?wa.parse:wa.parseInline)(x,o);return o.hooks?await o.hooks.postprocess(_):_})().catch(u);try{o.hooks&&(l=o.hooks.preprocess(l));let f=(o.hooks?o.hooks.provideLexer(n):n?ka.lex:ka.lexInline)(l,o);o.hooks&&(f=o.hooks.processAllTokens(f)),o.walkTokens&&this.walkTokens(f,o.walkTokens);let g=(o.hooks?o.hooks.provideParser(n):n?wa.parse:wa.parseInline)(f,o);return o.hooks&&(g=o.hooks.postprocess(g)),g}catch(f){return u(f)}}}onError(n,l){return i=>{if(i.message+=`
|
|
114
|
+
Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error occurred:</p><pre>"+si(i.message+"",!0)+"</pre>";return l?Promise.resolve(r):r}if(l)return Promise.reject(i);throw i}}},Gc=new C1;function Gt(n,l){return Gc.parse(n,l)}Gt.options=Gt.setOptions=function(n){return Gc.setOptions(n),Gt.defaults=Gc.defaults,_0(Gt.defaults),Gt};Gt.getDefaults=zg;Gt.defaults=Yc;Gt.use=function(...n){return Gc.use(...n),Gt.defaults=Gc.defaults,_0(Gt.defaults),Gt};Gt.walkTokens=function(n,l){return Gc.walkTokens(n,l)};Gt.parseInline=Gc.parseInline;Gt.Parser=wa;Gt.parser=wa.parse;Gt.Renderer=Bh;Gt.TextRenderer=Yg;Gt.Lexer=ka;Gt.lexer=ka.lex;Gt.Tokenizer=Uh;Gt.Hooks=Ad;Gt.parse=Gt;Gt.options;Gt.setOptions;Gt.use;Gt.walkTokens;Gt.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 pb(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 T1(n){if(Array.isArray(n))return n}function A1(n,l){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var r,o,u,f,g=[],x=!0,_=!1;try{if(u=(i=i.call(n)).next,l!==0)for(;!(x=(r=u.call(i)).done)&&(g.push(r.value),g.length!==l);x=!0);}catch(b){_=!0,o=b}finally{try{if(!x&&i.return!=null&&(f=i.return(),Object(f)!==f))return}finally{if(_)throw o}}return g}}function M1(){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 R1(n,l){return T1(n)||A1(n,l)||D1(n,l)||M1()}function D1(n,l){if(n){if(typeof n=="string")return pb(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)?pb(n,l):void 0}}const C0=Object.entries,gb=Object.setPrototypeOf,L1=Object.isFrozen,T0=Object.getPrototypeOf,A0=Object.getOwnPropertyDescriptor;let xs=Object.freeze,Ts=Object.seal,Yo=Object.create,M0=typeof Reflect<"u"&&Reflect,rg=M0.apply,cg=M0.construct;xs||(xs=function(l){return l});Ts||(Ts=function(l){return l});rg||(rg=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)});cg||(cg=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 qi=En(Array.prototype.forEach),O1=En(Array.prototype.lastIndexOf),xb=En(Array.prototype.pop),vd=En(Array.prototype.push),z1=En(Array.prototype.slice),I1=En(Array.prototype.splice),Qo=Array.isArray,Mp=R0(Set),Rp=En(Set.prototype.add),jd=En(Set.prototype.has),Rc=En(String.prototype.toLowerCase),Dp=En(String.prototype.toString),_b=En(String.prototype.match),Nd=En(String.prototype.replace),bb=En(String.prototype.indexOf),$1=En(String.prototype.trim),U1=En(Number.prototype.toString),B1=En(Boolean.prototype.toString),yb=typeof BigInt>"u"?null:En(BigInt.prototype.toString),vb=typeof Symbol>"u"?null:En(Symbol.prototype.toString),pl=En(Object.prototype.hasOwnProperty),kd=En(Object.prototype.toString),Cs=En(RegExp.prototype.test),Gi=R0(TypeError);function En(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 rg(n,l,r)}}function R0(n){return function(){for(var l=arguments.length,i=new Array(l),r=0;r<l;r++)i[r]=arguments[r];return cg(n,i)}}function Ot(n,l){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Rc;if(gb&&gb(n,null),!Qo(l))return n;let r=l.length;for(;r--;){let o=l[r];if(typeof o=="string"){const u=i(o);u!==o&&(L1(l)||(l[r]=u),o=u)}n[o]=!0}return n}function H1(n){for(let l=0;l<n.length;l++)pl(n,l)||(n[l]=null);return n}function Al(n){const l=Yo(null);for(const r of C0(n)){var i=R1(r,2);const o=i[0],u=i[1];pl(n,o)&&(Qo(u)?l[o]=H1(u):u&&typeof u=="object"&&u.constructor===Object?l[o]=Al(u):l[o]=u)}return l}function q1(n){switch(typeof n){case"string":return n;case"number":return U1(n);case"boolean":return B1(n);case"bigint":return yb?yb(n):"0";case"symbol":return vb?vb(n):"Symbol()";case"undefined":return kd(n);case"function":case"object":{if(n===null)return kd(n);const l=n,i=Xl(l,"toString");if(typeof i=="function"){const r=i(l);return typeof r=="string"?r:kd(r)}return kd(n)}default:return kd(n)}}function Xl(n,l){for(;n!==null;){const r=A0(n,l);if(r){if(r.get)return En(r.get);if(typeof r.value=="function")return En(r.value)}n=T0(n)}function i(){return null}return i}function G1(n,l){for(;n!==null;){const i=A0(n,l);if(i)return i.get?En(i.get):null;n=T0(n)}return null}function Y1(n){try{return Cs(n,""),!0}catch{return!1}}const jb=xs(["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"]),Lp=xs(["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"]),Op=xs(["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"]),V1=xs(["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"]),zp=xs(["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"]),F1=xs(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Nb=xs(["#text"]),kb=xs(["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"]),Ip=xs(["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"]),wb=xs(["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"]),ch=xs(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),X1=Ts(/{{[\w\W]*|^[\w\W]*}}/g),K1=Ts(/<%[\w\W]*|^[\w\W]*%>/g),Q1=Ts(/\${[\w\W]*/g),P1=Ts(/^data-[\-\w.\u00B7-\uFFFF]+$/),Z1=Ts(/^aria-[\-\w]+$/),Sb=Ts(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),W1=Ts(/^(?:\w+script|data):/i),J1=Ts(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ek=Ts(/^html$/i),tk=Ts(/^[a-z][.\w]*(-[.\w]+)+$/i),$p=Ts(/<[/\w!]/g),Eb=Ts(/<[/\w]/g),nk=Ts(/<\/no(script|embed|frames)/i),Cb=Ts(/\/>/i),ts={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},sk=xs(Ot({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),lk=function(){return typeof window>"u"?null:window},ak=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(f){return f},createScriptURL(f){return f}})}catch{return console.warn("TrustedTypes policy "+u+" could not be created."),null}},Tb=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Ur=function(l,i,r,o){return pl(l,i)&&Qo(l[i])?Ot(o.base?Al(o.base):{},l[i],o.transform):r},Up=function(l,i,r){const o=pl(l,i)?l[i]:void 0;return o&&typeof o=="object"?Al(o):r()};function D0(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:lk();const l=Se=>D0(Se);if(l.version="3.4.17",l.removed=[],!n||!n.document||n.document.nodeType!==ts.document||!n.Element)return l.isSupported=!1,l;let i=n.document;const r=i,o=r.currentScript;n.DocumentFragment;const u=n.HTMLTemplateElement,f=n.Node,g=n.Element,x=n.NodeFilter;n.NamedNodeMap===void 0&&(n.NamedNodeMap||n.MozNamedAttrMap),n.HTMLFormElement;const _=n.DOMParser,b=n.trustedTypes,j=g.prototype,N=Xl(j,"cloneNode"),k=Xl(j,"remove"),w=Xl(j,"removeAttributeNode"),E=Xl(j,"nextSibling"),C=Xl(j,"childNodes"),T=Xl(j,"parentNode"),z=Xl(j,"shadowRoot"),q=Xl(j,"attributes"),te=f&&f.prototype?Xl(f.prototype,"nodeType"):null,I=f&&f.prototype?Xl(f.prototype,"nodeName"):null,R=f&&f.prototype?Xl(f.prototype,"ownerDocument"):null,$=function(y){return te?te(y):y.nodeType},Q=function(y){return I?I(y):y.nodeName},ee=G1(j,"namespaceURI"),G=function(y){return ee?ee(y):y.namespaceURI};if(typeof u=="function"){const Se=i.createElement("template");Se.content&&Se.content.ownerDocument&&(i=Se.content.ownerDocument)}let B,F="",le,ue=!1,ce=0;const D=function(){if(ce>0)throw Gi('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},O=function(y){D(),ce++;try{return B.createHTML(y)}finally{ce--}},H=function(y){D(),ce++;try{return B.createScriptURL(y)}finally{ce--}},J=function(){return ue||(le=ak(b,o),ue=!0),le},re=i,A=re.implementation,V=re.createNodeIterator,U=re.createDocumentFragment,be=re.getElementsByTagName,P=r.importNode;let ie=Tb();l.isSupported=typeof C0=="function"&&typeof T=="function"&&A&&A.createHTMLDocument!==void 0;const Me=X1,Ke=K1,Ne=Q1,Be=P1,Xe=Z1,Ze=W1,an=J1,We=tk;let Bt=Sb,Ye=null;const ct=Ot({},[...jb,...Lp,...Op,...zp,...Nb]);let xe=null;const $e=Ot({},[...kb,...Ip,...wb,...ch]);let ye=Object.seal(Yo(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}})),Qe=null,rn=null;const kt=Object.seal(Yo(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ht=!0,_s=!0,On=!1,fn=!0,Mt=!1,zt=!0,Ce=!1,Te=!1,Ie=null,st=null,_t=!1,bt=!1,yt=!1,zn=!1,_e=!0,Ae=!1;const Je="user-content-";let rt=!0,it=!1,en=null,dt={},gt=null;const bs=Ot({},["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 In=null;const As=Ot({},["audio","video","img","source","image","track"]);let cs=null;const Cn=Ot({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),$n="http://www.w3.org/1998/Math/MathML",Ms="http://www.w3.org/2000/svg",cn="http://www.w3.org/1999/xhtml";let hn=cn,ns=!1,mn=null;const Un=Ot({},[$n,Ms,cn],Dp),pn=xs(["mi","mo","mn","ms","mtext"]);let Tt=Ot({},pn);const gn=xs(["annotation-xml"]);let os=Ot({},gn);const us=Ot({},["title","style","font","a","script"]);let Hs=null;const xl=["application/xhtml+xml","text/html"],_l="text/html";let At=null,Rs=null;const Bn=i.createElement("form"),K=function(y){return y instanceof RegExp||y instanceof Function},ge=function(){let y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Rs&&Rs===y)return;(!y||typeof y!="object")&&(y={}),y=Al(y),Hs=xl.indexOf(y.PARSER_MEDIA_TYPE)===-1?_l:y.PARSER_MEDIA_TYPE,At=Hs==="application/xhtml+xml"?Dp:Rc,Ye=Ur(y,"ALLOWED_TAGS",ct,{transform:At}),xe=Ur(y,"ALLOWED_ATTR",$e,{transform:At}),mn=Ur(y,"ALLOWED_NAMESPACES",Un,{transform:Dp}),cs=Ur(y,"ADD_URI_SAFE_ATTR",Cn,{transform:At,base:Cn}),In=Ur(y,"ADD_DATA_URI_TAGS",As,{transform:At,base:As}),gt=Ur(y,"FORBID_CONTENTS",bs,{transform:At}),Qe=Ur(y,"FORBID_TAGS",Al({}),{transform:At}),rn=Ur(y,"FORBID_ATTR",Al({}),{transform:At}),dt=pl(y,"USE_PROFILES")?y.USE_PROFILES&&typeof y.USE_PROFILES=="object"?Al(y.USE_PROFILES):y.USE_PROFILES:!1,ht=y.ALLOW_ARIA_ATTR!==!1,_s=y.ALLOW_DATA_ATTR!==!1,On=y.ALLOW_UNKNOWN_PROTOCOLS||!1,fn=y.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Mt=y.SAFE_FOR_TEMPLATES||!1,zt=y.SAFE_FOR_XML!==!1,Ce=y.WHOLE_DOCUMENT||!1,bt=y.RETURN_DOM||!1,yt=y.RETURN_DOM_FRAGMENT||!1,zn=y.RETURN_TRUSTED_TYPE||!1,_t=y.FORCE_BODY||!1,_e=y.SANITIZE_DOM!==!1,Ae=y.SANITIZE_NAMED_PROPS||!1,rt=y.KEEP_CONTENT!==!1,it=y.IN_PLACE||!1,Bt=Y1(y.ALLOWED_URI_REGEXP)?y.ALLOWED_URI_REGEXP:Sb,hn=typeof y.NAMESPACE=="string"?y.NAMESPACE:cn,Tt=Up(y,"MATHML_TEXT_INTEGRATION_POINTS",()=>Ot({},pn)),os=Up(y,"HTML_INTEGRATION_POINTS",()=>Ot({},gn));const M=Up(y,"CUSTOM_ELEMENT_HANDLING",()=>Yo(null));if(ye=Yo(null),pl(M,"tagNameCheck")&&K(M.tagNameCheck)&&(ye.tagNameCheck=M.tagNameCheck),pl(M,"attributeNameCheck")&&K(M.attributeNameCheck)&&(ye.attributeNameCheck=M.attributeNameCheck),pl(M,"allowCustomizedBuiltInElements")&&typeof M.allowCustomizedBuiltInElements=="boolean"&&(ye.allowCustomizedBuiltInElements=M.allowCustomizedBuiltInElements),Ts(ye),Mt&&(_s=!1),yt&&(bt=!0),dt&&(Ye=Ot({},Nb),xe=Yo(null),dt.html===!0&&(Ot(Ye,jb),Ot(xe,kb)),dt.svg===!0&&(Ot(Ye,Lp),Ot(xe,Ip),Ot(xe,ch)),dt.svgFilters===!0&&(Ot(Ye,Op),Ot(xe,Ip),Ot(xe,ch)),dt.mathMl===!0&&(Ot(Ye,zp),Ot(xe,wb),Ot(xe,ch))),kt.tagCheck=null,kt.attributeCheck=null,pl(y,"ADD_TAGS")&&(typeof y.ADD_TAGS=="function"?kt.tagCheck=y.ADD_TAGS:Qo(y.ADD_TAGS)&&(Ye===ct&&(Ye=Al(Ye)),Ot(Ye,y.ADD_TAGS,At))),pl(y,"ADD_ATTR")&&(typeof y.ADD_ATTR=="function"?kt.attributeCheck=y.ADD_ATTR:Qo(y.ADD_ATTR)&&(xe===$e&&(xe=Al(xe)),Ot(xe,y.ADD_ATTR,At))),pl(y,"ADD_FORBID_CONTENTS")&&Qo(y.ADD_FORBID_CONTENTS)&&(gt===bs&&(gt=Al(gt)),Ot(gt,y.ADD_FORBID_CONTENTS,At)),rt&&(Ye["#text"]=!0),Ce&&Ot(Ye,["html","head","body"]),Ye.table&&(Ot(Ye,["tbody"]),delete Qe.tbody),y.TRUSTED_TYPES_POLICY){if(typeof y.TRUSTED_TYPES_POLICY.createHTML!="function")throw Gi('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof y.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Gi('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const Z=B;B=y.TRUSTED_TYPES_POLICY;try{F=O("")}catch(oe){throw B=Z,oe}}else y.TRUSTED_TYPES_POLICY===null?(B=void 0,F=""):(B===void 0&&(B=J()),B&&typeof F=="string"&&(F=O("")));xs&&xs(y),Rs=y},Re=Ot({},[...Lp,...Op,...V1]),He=Ot({},[...zp,...F1]),wt=function(y,M,Z){return M.namespaceURI===cn?y==="svg":M.namespaceURI===$n?y==="svg"&&(Z==="annotation-xml"||Tt[Z]):!!Re[y]},on=function(y,M,Z){return M.namespaceURI===cn?y==="math":M.namespaceURI===Ms?y==="math"&&os[Z]:!!He[y]},Dt=function(y,M,Z){return M.namespaceURI===Ms&&!os[Z]||M.namespaceURI===$n&&!Tt[Z]?!1:!He[y]&&(us[y]||!Re[y])},Hn=function(y){const M=G(y),Z=Rc(Q(y)),oe=T(y);let Oe,Le;return oe&&$(oe)===ts.element?(Oe={namespaceURI:G(oe)},Le=Rc(Q(oe))):(Oe={namespaceURI:hn},Le="template"),mn[M]?M===Ms?wt(Z,Oe,Le):M===$n?on(Z,Oe,Le):M===cn?Dt(Z,Oe,Le):!!(Hs==="application/xhtml+xml"&&mn[M]):!1},Tn=function(y){vd(l.removed,{element:y});try{T(y).removeChild(y)}catch{if(k(y),!T(y))throw Gi("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Lt=function(y,M,Z){try{w(y,M)}catch{try{y.removeAttribute(Z)}catch{}}},qs=function(y){Qn(y);const M=C(y);M&&qi(z1(M),oe=>{try{k(oe)}catch{}});const Z=$(y)===ts.element?q(y):null;if(Z)for(let oe=Z.length-1;oe>=0;--oe){const Oe=Z[oe],Le=Oe&&Oe.name;typeof Le=="string"&&Lt(y,Oe,Le)}},xn=function(y,M,Z){if(!Z)try{Z=M.getAttributeNode(y)}catch{Z=null}vd(l.removed,{attribute:Z||null,from:M});try{Z?w(M,Z):M.removeAttribute(y)}catch{try{M.removeAttribute(y)}catch{}}if(y==="is")if(bt||yt)try{Tn(M)}catch{}else try{M.setAttribute(y,"")}catch{}},bl=function(y){const M=q(y);if(M)for(let Z=M.length-1;Z>=0;--Z){const oe=M[Z],Oe=oe&&oe.name;typeof Oe!="string"||xe[At(Oe)]||Lt(y,oe,Oe)}},yl=function(y,M){let Z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const oe=[y];for(;oe.length>0;){const Oe=oe.pop();if(M(Oe)===!1)continue;if(Z&&$(Oe)===ts.element){const tt=z(Oe);fs(tt)&&oe.push(tt)}const Le=C(Oe);if(Le)for(let tt=Le.length-1;tt>=0;--tt)oe.push(Le[tt])}},Qn=function(y){yl(y,M=>{$(M)===ts.element&&bl(M)})},Xt=function(y){const M=[];return yl(y,Z=>{M.push(Z)},!0),M},Ta=function(y,M){const Z=Mp();qi(Xt(y),oe=>{$(oe)===ts.element&&Rp(Z,oe)}),qi(M,oe=>{$(oe)===ts.element&&!jd(Z,oe)&&bl(oe)})},ys=function(y,M){let Z=!1;return qi(l.removed,oe=>{oe.element&&(Z=Z||oe.element===y,Qn(oe.element))}),Ta(y,M),Z},Zl=8,vs=function(y,M){const Z=en;let oe=null;const Oe=()=>(oe||(oe=Mp(),qi(M,Le=>{Rp(oe,Le)})),oe);for(let Le=0;;Le++){const tt=Xt(y),vt=[y];let Zn=!1;if(qi(tt,_n=>{$(_n)===ts.documentFragment?vd(vt,_n):!Zn&&!jd(Z,_n)&&(Zn=jd(Oe(),_n))}),!Zn)return;if(Le>=Zl)throw Gi("the tree kept changing during in-place sanitization; refusing to return it");qi(vt,(_n,An)=>{ss(_n,An>0,y,Oe())})}},ss=function(y,M,Z,oe){const Oe=Wl(y);let Le;for(;Le=Oe.nextNode();)!jd(oe,Le)||jd(en,Le)||(M&&Pn(ie.uponSanitizeShadowNode,Le,null),sa(Le,Z),Vs(Le,Z),fs(Le.content)&&ls(Le.content))},tl=function(y){en&&Rp(en,y)},tn=function(y,M){return zt?y==="patchsrc"?!0:y==="for"&&M!=="label"&&M!=="output":!1},Gs=function(y){zt&&yl(y,M=>{const Z=$(M);if(Z===ts.processingInstruction||Z===ts.comment&&Cs(Eb,M.data)){try{k(M)}catch{}return!1}if(Z===ts.element){const oe=M,Oe=At(Q(M));try{oe.hasAttribute&&oe.hasAttribute("patchsrc")&&oe.removeAttribute("patchsrc"),oe.hasAttribute&&oe.hasAttribute("for")&&tn("for",Oe)&&oe.removeAttribute("for")}catch{}}return!0})},ui=function(y){let M=null,Z=null;if(_t)y="<remove></remove>"+y;else{const Le=_b(y,/^[\r\n\t ]+/);Z=Le&&Le[0]}Hs==="application/xhtml+xml"&&hn===cn&&(y='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+y+"</body></html>");const oe=B?O(y):y;if(hn===cn)try{M=new _().parseFromString(oe,Hs)}catch{}if(!M||!M.documentElement){M=A.createDocument(hn,"template",null);try{M.documentElement.innerHTML=ns?F:oe}catch{}}const Oe=M.body||M.documentElement;return y&&Z&&Oe.insertBefore(i.createTextNode(Z),Oe.childNodes[0]||null),hn===cn?be.call(M,Ce?"html":"body")[0]:Ce?M.documentElement:Oe},Wl=function(y){const M=R?R(y):y.ownerDocument;return V.call(M||y,y,x.SHOW_ELEMENT|x.SHOW_COMMENT|x.SHOW_TEXT|x.SHOW_PROCESSING_INSTRUCTION|x.SHOW_CDATA_SECTION,null)},ds=function(y){return y=Nd(y,Me," "),y=Nd(y,Ke," "),y=Nd(y,Ne," "),y},Jl=function(y){var M;ea(y);const Z=(M=y.querySelectorAll)===null||M===void 0?void 0:M.call(y,"template");Z&&qi(Z,oe=>{fs(oe.content)&&Jl(oe.content)})},ea=function(y){y.normalize();const M=R?R(y):y.ownerDocument,Z=V.call(M||y,y,x.SHOW_TEXT|x.SHOW_COMMENT|x.SHOW_CDATA_SECTION|x.SHOW_PROCESSING_INSTRUCTION,null);let oe=Z.nextNode();for(;oe;)oe.data=ds(oe.data),oe=Z.nextNode()},Ys=function(y){const M=I?I(y):null;return typeof M!="string"||At(M)!=="form"?!1:typeof y.nodeName!="string"||typeof y.textContent!="string"||typeof y.removeChild!="function"||y.attributes!==q(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!==C(y)},fs=function(y){if(!te||typeof y!="object"||y===null)return!1;try{return te(y)===ts.documentFragment}catch{return!1}},nl=function(y){if(!te||typeof y!="object"||y===null)return!1;try{return typeof te(y)=="number"}catch{return!1}};function Pn(Se,y,M){Se.length!==0&&qi(Se,Z=>{Z.call(l,y,M,Rs)})}const ta=function(y,M){return!!(zt&&y.hasChildNodes()&&!nl(y.firstElementChild)&&Cs($p,y.textContent)&&Cs($p,y.innerHTML)||zt&&sk[M]&&$(y)===ts.element&&G(y)===cn&&(nl(y.firstElementChild)||typeof y.textContent=="string"&&Cs($p,y.textContent))||y.nodeType===ts.processingInstruction||zt&&y.nodeType===ts.comment&&Cs(Eb,y.data))},Rl=function(y,M){if(y instanceof RegExp)return Cs(y,M);if(y instanceof Function){for(var Z=arguments.length,oe=new Array(Z>2?Z-2:0),Oe=2;Oe<Z;Oe++)oe[Oe-2]=arguments[Oe];return!!y(M,...oe)}return!1},Zi=function(y,M,Z){if(!Qe[M]&&js(M)&&Rl(ye.tagNameCheck,M))return!1;if(rt&&!gt[M]&&!gt[Rc(M)]){const oe=T(y),Oe=C(y);if(Oe&&oe){const Le=Oe.length;for(let tt=Le-1;tt>=0;--tt){const vt=y===Z?N(Oe[tt],!0):Oe[tt];oe.insertBefore(vt,E(y))}}}return Tn(y),!0},na=function(y,M,Z,oe){return y.length===0?M:M===Z||M===oe?Al(M):M},xt=function(y,M){return y===M||T(y)!==null?!1:(it&&Qn(y),!0)},sa=function(y,M){if(tl(y),Pn(ie.beforeSanitizeElements,y,null),xt(y,M))return!0;if(Ys(y))return Tn(y),!0;const Z=At(Q(y));if(Ye=na(ie.uponSanitizeElement,Ye,ct,Ie),Pn(ie.uponSanitizeElement,y,{tagName:Z,allowedTags:Ye}),xt(y,M))return!0;if(ta(y,Z))return Tn(y),!0;if(Qe[Z]||!(kt.tagCheck instanceof Function&&kt.tagCheck(Z))&&!Ye[Z]){const oe=Zi(y,Z,M);return oe===!1&&(Pn(ie.afterSanitizeElements,y,null),xt(y,M))?!0:oe}if($(y)===ts.element&&!Hn(y)||(Z==="noscript"||Z==="noembed"||Z==="noframes")&&Cs(nk,y.innerHTML))return Tn(y),!0;if(Mt&&y.nodeType===ts.text){const oe=ds(y.textContent);y.textContent!==oe&&(vd(l.removed,{element:y.cloneNode()}),y.textContent=oe)}return Pn(ie.afterSanitizeElements,y,null),xt(y,M)},Nn=function(y,M,Z){if(rn[M]||tn(M,y)||_e&&(M==="id"||M==="name")&&(Z in i||Z in Bn))return!1;const oe=xe[M]||kt.attributeCheck instanceof Function&&kt.attributeCheck(M,y);return _s&&Cs(Be,M)||ht&&Cs(Xe,M)?!0:oe?cs[M]||Cs(Bt,Nd(Z,an,""))||(M==="src"||M==="xlink:href"||M==="href")&&y!=="script"&&bb(Z,"data:")===0&&In[y]||On&&!Cs(Ze,Nd(Z,an,""))?!0:!Z:js(y)&&Rl(ye.tagNameCheck,y)&&Rl(ye.attributeNameCheck,M,y)||M==="is"&&ye.allowCustomizedBuiltInElements&&Rl(ye.tagNameCheck,Z)},Dl=Ot({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),js=function(y){return!Dl[Rc(y)]&&Cs(We,y)},qn=function(y,M,Z,oe){if(B&&typeof b=="object"&&typeof b.getAttributeType=="function"&&!Z)switch(b.getAttributeType(y,M)){case"TrustedHTML":return O(oe);case"TrustedScriptURL":return H(oe)}return oe},di=function(y,M,Z,oe){try{return Z?y.setAttributeNS(Z,M,oe):y.setAttribute(M,oe),Ys(y)?(Tn(y),!1):!0}catch{return xn(M,y),!1}},sl=function(y,M){return zt&&Cs(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,M)?!0:Rc(y)==="attributename"&&_b(M,"href")!==null},Vs=function(y,M){if(Pn(ie.beforeSanitizeAttributes,y,null),xt(y,M))return;const Z=y.attributes;if(!Z||Ys(y))return;xe=na(ie.uponSanitizeAttribute,xe,$e,st);const oe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:xe,forceKeepAttr:void 0};let Oe=Z.length;const Le=At(y.nodeName);for(;Oe--;){const tt=Z[Oe],vt=tt.name,Zn=tt.namespaceURI,_n=tt.value,An=At(vt),Aa=_n;let Yt=vt==="value"?Aa:$1(Aa),Wi=!1;if(oe.attrName=An,oe.attrValue=Yt,oe.keepAttr=!0,oe.forceKeepAttr=void 0,Pn(ie.uponSanitizeAttribute,y,oe),Yt=oe.attrValue,Ae&&(An==="id"||An==="name")&&bb(Yt,Je)!==0&&(xn(vt,y,tt),Yt=Je+Yt,Wi=!0),sl(vt,Yt)){xn(vt,y,tt);continue}if(!oe.forceKeepAttr){if(!oe.keepAttr){xn(vt,y,tt);continue}if(!fn&&Cs(Cb,Yt)){xn(vt,y,tt);continue}if(Mt&&(Yt=ds(Yt)),!Nn(Le,An,Yt)){xn(vt,y,tt);continue}Yt=qn(Le,An,Zn,Yt),Yt!==Aa&&di(y,vt,Zn,Yt)&&Wi&&xb(l.removed)}}Pn(ie.afterSanitizeAttributes,y,null),xt(y,M)},ls=function(y){let M=null;const Z=Wl(y);for(Pn(ie.beforeSanitizeShadowDOM,y,null);M=Z.nextNode();)if(Pn(ie.uponSanitizeShadowNode,M,null),sa(M,y),Vs(M,y),fs(M.content)&&ls(M.content),$(M)===ts.element){const oe=z(M);fs(oe)&&(hs(oe),ls(oe))}Mt&&ea(y),Pn(ie.afterSanitizeShadowDOM,y,null)},hs=function(y){const M=[{node:y,shadow:null}];for(;M.length>0;){const Z=M.pop();if(Z.shadow){ls(Z.shadow);continue}const oe=Z.node,Oe=$(oe)===ts.element,Le=C(oe);if(Le)for(let tt=Le.length-1;tt>=0;--tt)M.push({node:Le[tt],shadow:null});if(Oe){const tt=I?I(oe):null;if(typeof tt=="string"&&At(tt)==="template"){const vt=oe.content;fs(vt)&&M.push({node:vt,shadow:null})}}if(Oe){const tt=z(oe);fs(tt)&&M.push({node:null,shadow:tt},{node:tt,shadow:null})}}};return l.sanitize=function(Se){let y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},M=null,Z=null,oe=null,Oe=null;if(ns=!Se,ns&&(Se="<!-->"),typeof Se!="string"&&!nl(Se)&&(Se=q1(Se),typeof Se!="string"))throw Gi("dirty is not a string, aborting");if(!l.isSupported)return Se;Te?(Ye=Ie,xe=st):ge(y),(ie.uponSanitizeElement.length>0||ie.uponSanitizeAttribute.length>0)&&(Ye=Al(Ye)),ie.uponSanitizeAttribute.length>0&&(xe=Al(xe)),l.removed=[];const Le=it&&typeof Se!="string"&&nl(Se);let tt=[];const vt=en;if(Le){Gs(Se);const An=Q(Se);if(typeof An=="string"){const Aa=At(An);if(!Ye[Aa]||Qe[Aa])throw qs(Se),Gi("root node is forbidden and cannot be sanitized in-place")}if(Ys(Se))throw qs(Se),Gi("root node is clobbered and cannot be sanitized in-place");tt=Xt(Se),en=Mp()}else if(nl(Se))M=ui("<!---->"),Z=M.ownerDocument.importNode(Se,!0),Z.nodeType===ts.element&&Z.nodeName==="BODY"||Z.nodeName==="HTML"?M=Z:M.appendChild(Z),hs(M);else{if(!bt&&!Mt&&!Ce&&Se.indexOf("<")===-1)return B&&zn?O(Se):Se;if(M=ui(Se),!M)return bt?null:zn?F:""}M&&_t&&Tn(M.firstChild);const Zn=Le?Se:M;try{Le&&hs(Se);const An=Wl(Zn);for(;oe=An.nextNode();)sa(oe,Zn),Vs(oe,Zn),fs(oe.content)&&ls(oe.content);Le&&vs(Se,tt)}catch(An){throw Le&&(qs(Se),ys(Se,tt)),An}finally{en=vt}if(Le){if(ys(Se,tt))throw Gi("a node selected for removal could not be safely returned; refusing to sanitize in place");return Mt&&Jl(Se),Se}if(bt){if(Mt&&Jl(M),yt)for(Oe=U.call(M.ownerDocument);M.firstChild;)Oe.appendChild(M.firstChild);else Oe=M;return(xe.shadowroot||xe.shadowrootmode)&&(Oe=P.call(r,Oe,!0)),Oe}let _n=Ce?M.outerHTML:M.innerHTML;return Ce&&Ye["!doctype"]&&M.ownerDocument&&M.ownerDocument.doctype&&M.ownerDocument.doctype.name&&Cs(ek,M.ownerDocument.doctype.name)&&(_n="<!DOCTYPE "+M.ownerDocument.doctype.name+`>
|
|
116
|
+
`+_n),Mt&&(_n=ds(_n)),B&&zn?O(_n):_n},l.setConfig=function(){let Se=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ge(Se),Te=!0,Ie=Ye,st=xe},l.clearConfig=function(){Rs=null,Te=!1,Ie=null,st=null,B=le,F=""},l.isValidAttribute=function(Se,y,M){Rs||ge({});const Z=At(Se),oe=At(y);return typeof M=="string"&&(sl(y,M)||!fn&&Cs(Cb,M))?!1:Nn(Z,oe,M)},l.addHook=function(Se,y){typeof y=="function"&&pl(ie,Se)&&vd(ie[Se],y)},l.removeHook=function(Se,y){if(pl(ie,Se)){if(y!==void 0){const M=O1(ie[Se],y);return M===-1?void 0:I1(ie[Se],M,1)[0]}return xb(ie[Se])}},l.removeHooks=function(Se){pl(ie,Se)&&(ie[Se]=[])},l.removeAllHooks=function(){ie=Tb()},l}var ik=D0();const rk=1024;let ck=0;class Pl{constructor(l,i){this.from=l,this.to=i}}class jn{constructor(l={}){this.id=ck++,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]}}}jn.closedBy=new jn({deserialize:n=>n.split(" ")});jn.openedBy=new jn({deserialize:n=>n.split(" ")});jn.group=new jn({deserialize:n=>n.split(" ")});jn.isolate=new jn({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});jn.contextHash=new jn({perNode:!0});jn.lookAhead=new jn({perNode:!0});jn.mounted=new jn({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[jn.mounted.id]}}const ok=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):ok,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(jn.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(jn.group),u=-1;u<(o?o.length:0);u++){let f=i[u<0?r.name:o[u]];if(f)return f}}}}Ea.none=new Ea("",Object.create(null),0,8);class L0{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 f=u(r);if(f){o||(o=Object.assign({},r.props));let g=f[1],x=f[0];x.combine&&x.id in o&&(g=x.combine(o[x.id],g)),o[x.id]=g}}i.push(o?new Ea(r.name,o,r.id,r.flags):r)}return new L0(i)}}const oh=new WeakMap,Ab=new WeakMap;var yn;(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"})(yn||(yn={}));class gl{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[f,g]of u)this.props[typeof f=="number"?f:f.id]=g}}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 Hh(this.topNode,l)}cursorAt(l,i=0,r=0){let o=oh.get(this)||this.topNode,u=new Hh(o);return u.moveTo(l,i),oh.set(this,u._tree),u}get topNode(){return new Bs(this,0,0,null)}resolve(l,i=0){let r=zd(oh.get(this)||this.topNode,l,i,!1);return oh.set(this,r),r}resolveInner(l,i=0){let r=zd(Ab.get(this)||this.topNode,l,i,!0);return Ab.set(this,r),r}resolveStack(l,i=0){return fk(this,l,i)}iterate(l){let{enter:i,leave:r,from:o=0,to:u=this.length}=l,f=l.mode||0,g=(f&yn.IncludeAnonymous)>0;for(let x=this.cursor(f|yn.IncludeAnonymous);;){let _=!1;if(x.from<=u&&x.to>=o&&(!g&&x.type.isAnonymous||i(x)!==!1)){if(x.firstChild())continue;_=!0}for(;_&&r&&(g||!x.type.isAnonymous)&&r(x),!x.nextSibling();){if(!x.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:Xg(Ea.none,this.children,this.positions,0,this.children.length,0,this.length,(i,r,o)=>new gl(this.type,i,r,o,this.propValues),l.makeTree||((i,r,o)=>new gl(Ea.none,i,r,o)))}static build(l){return hk(l)}}gl.empty=new gl(Ea.none,[],[],0);class Vg{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 Vg(this.buffer,this.index)}}class Qr{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 f=[];for(;l<r;)f.push(this.childString(l)),l=this.buffer[l+3];return u+"("+f.join(",")+")"}findChild(l,i,r,o,u){let{buffer:f}=this,g=-1;for(let x=l;x!=i&&!(O0(u,o,f[x+1],f[x+2])&&(g=x,r>0));x=f[x+3]);return g}slice(l,i,r){let o=this.buffer,u=new Uint16Array(i-l),f=0;for(let g=l,x=0;g<i;){u[x++]=o[g++],u[x++]=o[g++]-r;let _=u[x++]=o[g++]-r;u[x++]=o[g++]-l,f=Math.max(f,_)}return new Qr(u,f,this.set)}}function O0(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 zd(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 f=!r&&n instanceof Bs&&n.index<0?null:n.parent;if(!f)return n;n=f}let u=r?0:yn.IgnoreOverlays;if(r)for(let f=n,g=f.parent;g;f=g,g=f.parent)f instanceof Bs&&f.index<0&&((o=g.enter(l,i,u))===null||o===void 0?void 0:o.from)!=f.from&&(n=g);for(;;){let f=n.enter(l,i,u);if(!f)return n;n=f}}class z0{cursor(l=0){return new Hh(this,l)}getChild(l,i=null,r=null){let o=Mb(this,l,i,r);return o.length?o[0]:null}getChildren(l,i=null,r=null){return Mb(this,l,i,r)}resolve(l,i=0){return zd(this,l,i,!1)}resolveInner(l,i=0){return zd(this,l,i,!0)}matchContext(l){return og(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 Bs extends z0{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 f=this;;){for(let{children:g,positions:x}=f._tree,_=i>0?g.length:-1;l!=_;l+=i){let b=g[l],j=x[l]+f.from,N;if(!(!(u&yn.EnterBracketed&&b instanceof gl&&(N=Po.get(b))&&!N.overlay&&N.bracketed&&r>=j&&r<=j+b.length)&&!O0(o,r,j,j+b.length))){if(b instanceof Qr){if(u&yn.ExcludeBuffers)continue;let k=b.findChild(0,b.buffer.length,i,r-j,o);if(k>-1)return new ci(new uk(f,b,l,j),null,k)}else if(u&yn.IncludeAnonymous||!b.type.isAnonymous||Fg(b)){let k;if(!(u&yn.IgnoreMounts)&&(k=Po.get(b))&&!k.overlay)return new Bs(k.tree,j,l,f);let w=new Bs(b,j,l,f);return u&yn.IncludeAnonymous||!w.type.isAnonymous?w:w.nextChild(i<0?b.children.length-1:0,i,r,o,u)}}}if(u&yn.IncludeAnonymous||!f.type.isAnonymous||(f.index>=0?l=f.index+i:l=i<0?-1:f._parent._tree.children.length,f=f._parent,!f))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&yn.IgnoreOverlays)&&(o=Po.get(this._tree))&&o.overlay){let u=l-this.from,f=r&yn.EnterBracketed&&o.bracketed;for(let{from:g,to:x}of o.overlay)if((i>0||f?g<=u:g<u)&&(i<0||f?x>=u:x>u))return new Bs(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 Mb(n,l,i,r){let o=n.cursor(),u=[];if(!o.firstChild())return u;if(i!=null){for(let f=!1;!f;)if(f=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 og(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 uk{constructor(l,i,r,o){this.parent=l,this.buffer=i,this.index=r,this.start=o}}class ci extends z0{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(l,i,r){super(),this.context=l,this._parent=i,this.index=r,this.type=l.buffer.set.types[l.buffer.buffer[r]]}child(l,i,r){let{buffer:o}=this.context,u=o.findChild(this.index+4,o.buffer[this.index+3],l,i-this.context.start,r);return u<0?null:new ci(this.context,this,u)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(l){return this.child(1,l,2)}childBefore(l){return this.child(-1,l,-2)}prop(l){return this.type.prop(l)}enter(l,i,r=0){if(r&yn.ExcludeBuffers)return null;let{buffer:o}=this.context,u=o.findChild(this.index+4,o.buffer[this.index+3],i>0?1:-1,l-this.context.start,i);return u<0?null:new ci(this.context,this,u)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(l){return this._parent?null:this.context.parent.nextChild(this.context.index+l,l,0,4)}get nextSibling(){let{buffer:l}=this.context,i=l.buffer[this.index+3];return i<(this._parent?l.buffer[this._parent.index+3]:l.buffer.length)?new ci(this.context,this._parent,i):this.externalSibling(1)}get prevSibling(){let{buffer:l}=this.context,i=this._parent?this._parent.index+4:0;return this.index==i?this.externalSibling(-1):new ci(this.context,this._parent,l.findChild(i,this.index,-1,0,4))}get tree(){return null}toTree(){let l=[],i=[],{buffer:r}=this.context,o=this.index+4,u=r.buffer[this.index+3];if(u>o){let f=r.buffer[this.index+1];l.push(r.slice(o,u,f)),i.push(0)}return new gl(this.type,l,i,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function I0(n){if(!n.length)return null;let l=0,i=n[0];for(let u=1;u<n.length;u++){let f=n[u];(f.from>i.from||f.to<i.to)&&(i=f,l=u)}let r=i instanceof Bs&&i.index<0?null:i.parent,o=n.slice();return r?o[l]=r:o.splice(l,1),new dk(o,i)}class dk{constructor(l,i){this.heads=l,this.node=i}get next(){return I0(this.heads)}}function fk(n,l,i){let r=n.resolveInner(l,i),o=null;for(let u=r instanceof Bs?r:r.context.parent;u;u=u.parent)if(u.index<0){let f=u.parent;(o||(o=[r])).push(f.resolve(l,i)),u=f}else{let f=Po.get(u.tree);if(f&&f.overlay&&f.overlay[0].from<=l&&f.overlay[f.overlay.length-1].to>=l){let g=new Bs(f.tree,f.overlay[0].from+u.from,-1,u);(o||(o=[r])).push(zd(g,l,i,!1))}}return o?I0(o):r}class Hh{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&~yn.EnterBracketed,l instanceof Bs)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 Bs?(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&yn.ExcludeBuffers?!1:this.enterChild(1,l,i):this.yield(this._tree.enter(l,i,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&yn.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let l=this.mode&yn.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,f=l<0?-1:r._tree.children.length;u!=f;u+=l){let g=r._tree.children[u];if(this.mode&yn.IncludeAnonymous||g instanceof Qr||!g.type.isAnonymous||Fg(g))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 f=l;f;f=f._parent)if(f.index==o){if(o==this.index)return f;i=f,r=u+1;break e}o=this.stack[--u]}for(let o=r;o<this.stack.length;o++)i=new ci(this.buffer,i,this.stack[o]);return this.bufferNode=new ci(this.buffer,i,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(l,i){for(let r=0;;){let o=!1;if(this.type.isAnonymous||l(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(o=!0)}for(;;){if(o&&i&&i(this),o=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,o=!0}}}matchContext(l){if(!this.buffer)return og(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 og(this._tree,l,o);let f=r[i.buffer[this.stack[u]]];if(!f.isAnonymous){if(l[o]&&l[o]!=f.name)return!1;o--}}return!0}}function Fg(n){return n.children.some(l=>l instanceof Qr||!l.type.isAnonymous||Fg(l))}function hk(n){var l;let{buffer:i,nodeSet:r,maxBufferLength:o=rk,reused:u=[],minRepeatType:f=r.types.length}=n,g=Array.isArray(i)?new Vg(i,i.length):i,x=r.types,_=0,b=0;function j(I,R,$,Q,ee,G){let{id:B,start:F,end:le,size:ue}=g,ce=b,D=_;if(ue<0)if(g.next(),ue==-1){let A=u[B];$.push(A),Q.push(F-I);return}else if(ue==-3){_=B;return}else if(ue==-4){b=B;return}else throw new RangeError(`Unrecognized record size: ${ue}`);let O=x[B],H,J,re=F-I;if(le-F<=o&&(J=C(g.pos-R,ee))){let A=new Uint16Array(J.size-J.skip),V=g.pos-J.size,U=A.length;for(;g.pos>V;)U=T(J.start,A,U);H=new Qr(A,le-J.start,r),re=J.start-I}else{let A=g.pos-ue;g.next();let V=[],U=[],be=B>=f?B:-1,P=0,ie=le;for(;g.pos>A;)be>=0&&g.id==be&&g.size>=0?(g.end<=ie-o&&(w(V,U,F,P,g.end,ie,be,ce,D),P=V.length,ie=g.end),g.next()):G>2500?N(F,A,V,U):j(F,A,V,U,be,G+1);if(be>=0&&P>0&&P<V.length&&w(V,U,F,P,F,ie,be,ce,D),V.reverse(),U.reverse(),be>-1&&P>0){let Me=k(O,D);H=Xg(O,V,U,0,V.length,0,le-F,Me,Me)}else H=E(O,V,U,le-F,ce-le,D)}$.push(H),Q.push(re)}function N(I,R,$,Q){let ee=[],G=0,B=-1;for(;g.pos>R;){let{id:F,start:le,end:ue,size:ce}=g;if(ce>4)g.next();else{if(B>-1&&le<B)break;B<0&&(B=ue-o),ee.push(F,le,ue),G++,g.next()}}if(G){let F=new Uint16Array(G*4),le=ee[ee.length-2];for(let ue=ee.length-3,ce=0;ue>=0;ue-=3)F[ce++]=ee[ue],F[ce++]=ee[ue+1]-le,F[ce++]=ee[ue+2]-le,F[ce++]=ce;$.push(new Qr(F,ee[2]-le,r)),Q.push(le-I)}}function k(I,R){return($,Q,ee)=>{let G=0,B=$.length-1,F,le;if(B>=0&&(F=$[B])instanceof gl){if(!B&&F.type==I&&F.length==ee)return F;(le=F.prop(jn.lookAhead))&&(G=Q[B]+F.length+le)}return E(I,$,Q,ee,G,R)}}function w(I,R,$,Q,ee,G,B,F,le){let ue=[],ce=[];for(;I.length>Q;)ue.push(I.pop()),ce.push(R.pop()+$-ee);I.push(E(r.types[B],ue,ce,G-ee,F-G,le)),R.push(ee-$)}function E(I,R,$,Q,ee,G,B){if(G){let F=[jn.contextHash,G];B=B?[F].concat(B):[F]}if(ee>25){let F=[jn.lookAhead,ee];B=B?[F].concat(B):[F]}return new gl(I,R,$,Q,B)}function C(I,R){let $=g.fork(),Q=0,ee=0,G=0,B=$.end-o,F={size:0,start:0,skip:0};e:for(let le=$.pos-I;$.pos>le;){let ue=$.size;if($.id==R&&ue>=0){F.size=Q,F.start=ee,F.skip=G,G+=4,Q+=4,$.next();continue}let ce=$.pos-ue;if(ue<0||ce<le||$.start<B)break;let D=$.id>=f?4:0,O=$.start;for($.next();$.pos>ce;){if($.size<0)if($.size==-3||$.size==-4)D+=4;else break e;else $.id>=f&&(D+=4);$.next()}ee=O,Q+=ue,G+=D}return(R<0||Q==I)&&(F.size=Q,F.start=ee,F.skip=G),F.size>4?F:void 0}function T(I,R,$){let{id:Q,start:ee,end:G,size:B}=g;if(g.next(),B>=0&&Q<f){let F=$;if(B>4){let le=g.pos-(B-4);for(;g.pos>le;)$=T(I,R,$)}R[--$]=F,R[--$]=G-I,R[--$]=ee-I,R[--$]=Q}else B==-3?_=Q:B==-4&&(b=Q);return $}let z=[],q=[];for(;g.pos>0;)j(n.start||0,n.bufferStart||0,z,q,-1,0);let te=(l=n.length)!==null&&l!==void 0?l:z.length?q[0]+z[0].length:0;return new gl(x[n.topID],z.reverse(),q.reverse(),te)}const Rb=new WeakMap;function Rh(n,l){if(!n.isAnonymous||l instanceof Qr||l.type!=n)return 1;let i=Rb.get(l);if(i==null){i=1;for(let r of l.children){if(r.type!=n||!(r instanceof gl)){i=1;break}i+=Rh(n,r)}Rb.set(l,i)}return i}function Xg(n,l,i,r,o,u,f,g,x){let _=0;for(let w=r;w<o;w++)_+=Rh(n,l[w]);let b=Math.ceil(_*1.5/8),j=[],N=[];function k(w,E,C,T,z){for(let q=C;q<T;){let te=q,I=E[q],R=Rh(n,w[q]);for(q++;q<T;q++){let $=Rh(n,w[q]);if(R+$>=b)break;R+=$}if(q==te+1){if(R>b){let $=w[te];k($.children,$.positions,0,$.children.length,E[te]+z);continue}j.push(w[te])}else{let $=E[q-1]+w[q-1].length-I;j.push(Xg(n,w,E,te,q,I,$,null,x))}N.push(I+z-u)}}return k(l,i,r,o,0),(g||x)(j,N,f)}class b2{constructor(){this.map=new WeakMap}setBuffer(l,i,r){let o=this.map.get(l);o||this.map.set(l,o=new Map),o.set(i,r)}getBuffer(l,i){let r=this.map.get(l);return r&&r.get(i)}set(l,i){l instanceof ci?this.setBuffer(l.context.buffer,l.index,i):l instanceof Bs&&this.map.set(l.tree,i)}get(l){return l instanceof ci?this.getBuffer(l.context.buffer,l.index):l instanceof Bs?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 Id{constructor(l,i,r,o,u=!1,f=!1){this.from=l,this.to=i,this.tree=r,this.offset=o,this.open=(u?1:0)|(f?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 Id(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,f=l.length?l[0]:null;for(let g=0,x=0,_=0;;g++){let b=g<i.length?i[g]:null,j=b?b.fromA:1e9;if(j-x>=r)for(;f&&f.from<j;){let N=f;if(x>=N.from||j<=N.to||_){let k=Math.max(N.from,x)-_,w=Math.min(N.to,j)-_;N=k>=w?null:new Id(k,w,N.tree,N.offset+_,g>0,!!b)}if(N&&o.push(N),f.to>j)break;f=u<l.length?l[u++]:null}if(!b)break;x=b.toA,_=b.toA-b.toB}return o}}class y2{startParse(l,i,r){return typeof l=="string"&&(l=new mk(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 mk{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 v2(n){return(l,i,r,o)=>new gk(l,n,i,r,o)}class Db{constructor(l,i,r,o,u,f){this.parser=l,this.parse=i,this.overlay=r,this.bracketed=o,this.target=u,this.from=f}}function Lb(n){if(!n.length||n.some(l=>l.from>=l.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(n))}class pk{constructor(l,i,r,o,u,f,g,x){this.parser=l,this.predicate=i,this.mounts=r,this.index=o,this.start=u,this.bracketed=f,this.target=g,this.prev=x,this.depth=0,this.ranges=[]}}const ug=new jn({perNode:!0});class gk{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 gl(r.type,r.children,r.positions,r.length,r.propValues.concat([[ug,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[jn.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 bk(this.fragments),i=null,r=null,o=new Hh(new Bs(this.baseTree,this.ranges[0].from,0,null),yn.IncludeAnonymous|yn.IgnoreMounts);e:for(let u,f;;){let g=!0,x;if(this.stoppedAt!=null&&o.from>=this.stoppedAt)g=!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(k=>k.from<N&&k.to>j)&&i.ranges.push({from:j,to:N})}}g=!1}else if(r&&(f=xk(r.ranges,o.from,o.to)))g=f!=2;else if(!o.type.isAnonymous&&(u=this.nest(o,this.input))&&(o.from<o.to||!u.overlay)){o.tree||(_k(o),i&&i.depth++,r&&r.depth++);let _=l.findMounts(o.from,u.parser);if(typeof u.overlay=="function")i=new pk(u.parser,u.overlay,_,this.inner.length,o.from,!!u.bracketed,o.tree,i);else{let b=Ib(this.ranges,u.overlay||(o.from<o.to?[new Pl(o.from,o.to)]:[]));b.length&&Lb(b),(b.length||!u.overlay)&&this.inner.push(new Db(u.parser,b.length?u.parser.startParse(this.input,$b(_,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}):g=!1}}else if(i&&(x=i.predicate(o))&&(x===!0&&(x=new Pl(o.from,o.to)),x.from<x.to)){let _=i.ranges.length-1;_>=0&&i.ranges[_].to==x.from?i.ranges[_]={from:i.ranges[_].from,to:x.to}:i.ranges.push(x)}if(g&&o.firstChild())i&&i.depth++,r&&r.depth++;else for(;!o.nextSibling();){if(!o.parent())break e;if(i&&!--i.depth){let _=Ib(this.ranges,i.ranges);_.length&&(Lb(_),this.inner.splice(i.index,0,new Db(i.parser,i.parser.startParse(this.input,$b(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 xk(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 Ob(n,l,i,r,o,u){if(l<i){let f=n.buffer[l+1];r.push(n.slice(l,i,f)),o.push(f-u)}}function _k(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),f=o.children[u],g=f.buffer,x=[u];function _(b,j,N,k,w,E){let C=i[E],T=[],z=[];Ob(f,b,C,T,z,k);let q=g[C+1],te=g[C+2];x.push(T.length);let I=E?_(C+4,g[C+3],f.set.types[g[C]],q,te-q,E-1):l.toTree();return T.push(I),z.push(q-k),Ob(f,g[C+3],j,T,z,k),new gl(N,T,z,w)}o.children[u]=_(0,g.length,Ea.none,0,f.length,i.length-1);for(let b of x){let j=n.tree.children[b],N=n.tree.positions[b];n.yield(new Bs(j,N+n.from,b,n._tree))}}class zb{constructor(l,i){this.offset=i,this.done=!1,this.cursor=l.cursor(yn.IncludeAnonymous|yn.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,yn.IgnoreOverlays|yn.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 gl)i=i.children[0];else break}return!1}}class bk{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(ug))!==null&&i!==void 0?i:r.to,this.inner=new zb(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(ug))!==null&&l!==void 0?l:i.to,this.inner=new zb(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 f=(r=u.tree)===null||r===void 0?void 0:r.prop(jn.mounted);if(f&&f.parser==i)for(let g=this.fragI;g<this.fragments.length;g++){let x=this.fragments[g];if(x.from>=u.to)break;x.tree==this.curFrag.tree&&o.push({frag:x,pos:u.from-x.offset,mount:f})}}}return o}}function Ib(n,l){let i=null,r=l;for(let o=1,u=0;o<n.length;o++){let f=n[o-1].to,g=n[o].from;for(;u<r.length;u++){let x=r[u];if(x.from>=g)break;x.to<=f||(i||(r=i=l.slice()),x.from<f?(i[u]=new Pl(x.from,f),x.to>g&&i.splice(u+1,0,new Pl(g,x.to))):x.to>g?i[u--]=new Pl(g,x.to):i.splice(u--,1))}}return r}function yk(n,l,i,r){let o=0,u=0,f=!1,g=!1,x=-1e9,_=[];for(;;){let b=o==n.length?1e9:f?n[o].to:n[o].from,j=u==l.length?1e9:g?l[u].to:l[u].from;if(f!=g){let N=Math.max(x,i),k=Math.min(b,j,r);N<k&&_.push(new Pl(N,k))}if(x=Math.min(b,j),x==1e9)break;b==x&&(f?(f=!1,o++):f=!0),j==x&&(g?(g=!1,u++):g=!0)}return _}function $b(n,l){let i=[];for(let{pos:r,mount:o,frag:u}of n){let f=r+(o.overlay?o.overlay[0].from:0),g=f+o.tree.length,x=Math.max(u.from,f),_=Math.min(u.to,g);if(o.overlay){let b=o.overlay.map(N=>new Pl(N.from+r,N.to+r)),j=yk(l,b,x,_);for(let N=0,k=x;;N++){let w=N==j.length,E=w?_:j[N].from;if(E>k&&i.push(new Id(k,E,o.tree,-f,u.from>=k||u.openStart,u.to<=E||u.openEnd)),w)break;k=j[N].to}}else i.push(new Id(x,_,o.tree,-f,u.from>=f||u.openStart,u.to<=g||u.openEnd))}return i}let vk=0;class Ql{constructor(l,i,r,o){this.name=l,this.set=i,this.base=r,this.modified=o,this.id=vk++}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 Ql&&(i=l),i!=null&&i.base)throw new Error("Can not derive from a modified tag");let o=new Ql(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 qh(l);return r=>r.modified.indexOf(i)>-1?r:qh.get(r.base||r,r.modified.concat(i).sort((o,u)=>o.id-u.id))}}let jk=0;class qh{constructor(l){this.name=l,this.instances=[],this.id=jk++}static get(l,i){if(!i.length)return l;let r=i[0].instances.find(g=>g.base==l&&Nk(i,g.modified));if(r)return r;let o=[],u=new Ql(l.name,o,l,i);for(let g of i)g.instances.push(u);let f=kk(i);for(let g of l.set)if(!g.modified.length)for(let x of f)o.push(qh.get(g,x));return u}}function Nk(n,l){return n.length==l.length&&n.every((i,r)=>i==l[r])}function kk(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 j2(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=[],f=2,g=o;for(let j=0;;){if(g=="..."&&j>0&&j+3==o.length){f=1;break}let N=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(g);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 k=o[j++];if(j==o.length&&k=="!"){f=0;break}if(k!="/")throw new RangeError("Invalid path: "+o);g=o.slice(j)}let x=u.length-1,_=u[x];if(!_)throw new RangeError("Invalid path: "+o);let b=new $d(r,f,x>0?u.slice(0,x):null);l[_]=b.sort(l[_])}}return $0.add(l)}const $0=new jn({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 $d(o.tags,o.mode,o.context);i?i.next=u:r=u,i=u}return r}});class $d{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}}$d.empty=new $d([],2,null);function U0(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 f of u.tag)i[f.id]=u.class;let{scope:r,all:o=null}=l||{};return{style:u=>{let f=o;for(let g of u)for(let x of g.set){let _=i[x.id];if(_){f=f?f+" "+_:_;break}}return f},scope:r}}function wk(n,l){let i=null;for(let r of n){let o=r.style(l);o&&(i=i?i+" "+o:o)}return i}function Sk(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 Ek(n,l,i,r,o,u=0,f=n.length){let g=u;function x(_,b){if(!(_<=g)){for(let j=n.slice(g,_),N=0;;){let k=j.indexOf(`
|
|
117
|
+
`,N),w=k<0?j.length:k;if(w>N&&r(j.slice(N,w),b),k<0)break;o(),N=k+1}g=_}}Sk(l,i,(_,b,j)=>{x(_,""),x(b,j)},u,f),x(f,"")}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:f,from:g,to:x}=l;if(g>=r||x<=i)return;f.isTop&&(u=this.highlighters.filter(k=>!k.scope||k.scope(f)));let _=o,b=Tk(l)||$d.empty,j=wk(u,b.tags);if(j&&(_&&(_+=" "),_+=j,b.mode==1&&(o+=(o?" ":"")+j)),this.startSpan(Math.max(i,g),_),b.opaque)return;let N=l.tree&&l.tree.prop(jn.mounted);if(N&&N.overlay){let k=l.node.enter(N.overlay[0].from+g,1),w=this.highlighters.filter(C=>!C.scope||C.scope(N.tree.type)),E=l.firstChild();for(let C=0,T=g;;C++){let z=C<N.overlay.length?N.overlay[C]:null,q=z?z.from+g:x,te=Math.max(i,T),I=Math.min(r,q);if(te<I&&E)for(;l.from<I&&(this.highlightRange(l,te,I,o,u),this.startSpan(Math.min(I,l.to),_),!(l.to>=q||!l.nextSibling())););if(!z||q>r)break;T=z.to+g,T>i&&(this.highlightRange(k.cursor(),Math.max(i,z.from+g),Math.min(r,T),"",w),this.startSpan(Math.min(r,T),_))}E&&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 Tk(n){let l=n.type.prop($0);for(;l&&l.context&&!n.matchContext(l.context);)l=l.next;return l||null}const ze=Ql.define,uh=ze(),Gr=ze(),Ub=ze(Gr),Bb=ze(Gr),Yr=ze(),dh=ze(Yr),Bp=ze(Yr),li=ze(),Ac=ze(li),ei=ze(),ti=ze(),dg=ze(),wd=ze(dg),fh=ze(),Ue={comment:uh,lineComment:ze(uh),blockComment:ze(uh),docComment:ze(uh),name:Gr,variableName:ze(Gr),typeName:Ub,tagName:ze(Ub),propertyName:Bb,attributeName:ze(Bb),className:ze(Gr),labelName:ze(Gr),namespace:ze(Gr),macroName:ze(Gr),literal:Yr,string:dh,docString:ze(dh),character:ze(dh),attributeValue:ze(dh),number:Bp,integer:ze(Bp),float:ze(Bp),bool:ze(Yr),regexp:ze(Yr),escape:ze(Yr),color:ze(Yr),url:ze(Yr),keyword:ei,self:ze(ei),null:ze(ei),atom:ze(ei),unit:ze(ei),modifier:ze(ei),operatorKeyword:ze(ei),controlKeyword:ze(ei),definitionKeyword:ze(ei),moduleKeyword:ze(ei),operator:ti,derefOperator:ze(ti),arithmeticOperator:ze(ti),logicOperator:ze(ti),bitwiseOperator:ze(ti),compareOperator:ze(ti),updateOperator:ze(ti),definitionOperator:ze(ti),typeOperator:ze(ti),controlOperator:ze(ti),punctuation:dg,separator:ze(dg),bracket:wd,angleBracket:ze(wd),squareBracket:ze(wd),paren:ze(wd),brace:ze(wd),content:li,heading:Ac,heading1:ze(Ac),heading2:ze(Ac),heading3:ze(Ac),heading4:ze(Ac),heading5:ze(Ac),heading6:ze(Ac),contentSeparator:ze(li),list:ze(li),quote:ze(li),emphasis:ze(li),strong:ze(li),link:ze(li),monospace:ze(li),strikethrough:ze(li),inserted:ze(),deleted:ze(),changed:ze(),invalid:ze(),meta:fh,documentMeta:ze(fh),annotation:ze(fh),processingInstruction:ze(fh),definition:Ql.defineModifier("definition"),constant:Ql.defineModifier("constant"),function:Ql.defineModifier("function"),standard:Ql.defineModifier("standard"),local:Ql.defineModifier("local"),special:Ql.defineModifier("special")};for(let n in Ue){let l=Ue[n];l instanceof Ql&&(l.name=n)}U0([{tag:Ue.link,class:"tok-link"},{tag:Ue.heading,class:"tok-heading"},{tag:Ue.emphasis,class:"tok-emphasis"},{tag:Ue.strong,class:"tok-strong"},{tag:Ue.keyword,class:"tok-keyword"},{tag:Ue.atom,class:"tok-atom"},{tag:Ue.bool,class:"tok-bool"},{tag:Ue.url,class:"tok-url"},{tag:Ue.labelName,class:"tok-labelName"},{tag:Ue.inserted,class:"tok-inserted"},{tag:Ue.deleted,class:"tok-deleted"},{tag:Ue.literal,class:"tok-literal"},{tag:Ue.string,class:"tok-string"},{tag:Ue.number,class:"tok-number"},{tag:[Ue.regexp,Ue.escape,Ue.special(Ue.string)],class:"tok-string2"},{tag:Ue.variableName,class:"tok-variableName"},{tag:Ue.local(Ue.variableName),class:"tok-variableName tok-local"},{tag:Ue.definition(Ue.variableName),class:"tok-variableName tok-definition"},{tag:Ue.special(Ue.variableName),class:"tok-variableName2"},{tag:Ue.definition(Ue.propertyName),class:"tok-propertyName tok-definition"},{tag:Ue.typeName,class:"tok-typeName"},{tag:Ue.namespace,class:"tok-namespace"},{tag:Ue.className,class:"tok-className"},{tag:Ue.macroName,class:"tok-macroName"},{tag:Ue.propertyName,class:"tok-propertyName"},{tag:Ue.operator,class:"tok-operator"},{tag:Ue.comment,class:"tok-comment"},{tag:Ue.meta,class:"tok-meta"},{tag:Ue.invalid,class:"tok-invalid"},{tag:Ue.punctuation,class:"tok-punctuation"}]);const Ak="modulepreload",Mk=function(n,l){return new URL(n,l).href},Hb={},at=function(l,i,r){let o=Promise.resolve();if(i&&i.length>0){let f=function(b){return Promise.all(b.map(j=>Promise.resolve(j).then(N=>({status:"fulfilled",value:N}),N=>({status:"rejected",reason:N}))))};const g=document.getElementsByTagName("link"),x=document.querySelector("meta[property=csp-nonce]"),_=(x==null?void 0:x.nonce)||(x==null?void 0:x.getAttribute("nonce"));o=f(i.map(b=>{if(b=Mk(b,r),b in Hb)return;Hb[b]=!0;const j=b.endsWith(".css"),N=j?'[rel="stylesheet"]':"";if(!!r)for(let E=g.length-1;E>=0;E--){const C=g[E];if(C.href===b&&(!j||C.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${b}"]${N}`))return;const w=document.createElement("link");if(w.rel=j?"stylesheet":Ak,j||(w.as="script"),w.crossOrigin="",w.href=b,_&&w.setAttribute("nonce",_),document.head.appendChild(w),j)return new Promise((E,C)=>{w.addEventListener("load",E),w.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${b}`)))})}))}function u(f){const g=new Event("vite:preloadError",{cancelable:!0});if(g.payload=f,window.dispatchEvent(g),!g.defaultPrevented)throw f}return o.then(f=>{for(const g of f||[])g.status==="rejected"&&u(g.reason);return l().catch(u)})},B0={js:async()=>(await at(async()=>{const{javascript:n}=await import("./index-CkpIGiUh.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).javascript({jsx:!0}),cjs:async()=>(await at(async()=>{const{javascript:n}=await import("./index-CkpIGiUh.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).javascript(),mjs:async()=>(await at(async()=>{const{javascript:n}=await import("./index-CkpIGiUh.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).javascript(),jsx:async()=>(await at(async()=>{const{javascript:n}=await import("./index-CkpIGiUh.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).javascript({jsx:!0}),ts:async()=>(await at(async()=>{const{javascript:n}=await import("./index-CkpIGiUh.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).javascript({typescript:!0}),mts:async()=>(await at(async()=>{const{javascript:n}=await import("./index-CkpIGiUh.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).javascript({typescript:!0}),cts:async()=>(await at(async()=>{const{javascript:n}=await import("./index-CkpIGiUh.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).javascript({typescript:!0}),tsx:async()=>(await at(async()=>{const{javascript:n}=await import("./index-CkpIGiUh.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).javascript({typescript:!0,jsx:!0}),json:async()=>(await at(async()=>{const{json:n}=await import("./index-CXbAKkq5.js");return{json:n}},__vite__mapDeps([7,1,2,3,4,5]),import.meta.url)).json(),jsonc:async()=>(await at(async()=>{const{json:n}=await import("./index-CXbAKkq5.js");return{json:n}},__vite__mapDeps([7,1,2,3,4,5]),import.meta.url)).json(),css:async()=>(await at(async()=>{const{css:n}=await import("./index-cu8Fcww3.js");return{css:n}},__vite__mapDeps([8,1,2,3,4,5]),import.meta.url)).css(),scss:async()=>(await at(async()=>{const{css:n}=await import("./index-cu8Fcww3.js");return{css:n}},__vite__mapDeps([8,1,2,3,4,5]),import.meta.url)).css(),less:async()=>(await at(async()=>{const{css:n}=await import("./index-cu8Fcww3.js");return{css:n}},__vite__mapDeps([8,1,2,3,4,5]),import.meta.url)).css(),html:async()=>(await at(async()=>{const{html:n}=await import("./index-CcKihMD9.js");return{html:n}},__vite__mapDeps([9,1,8,2,3,4,5,0,6]),import.meta.url)).html(),htm:async()=>(await at(async()=>{const{html:n}=await import("./index-CcKihMD9.js");return{html:n}},__vite__mapDeps([9,1,8,2,3,4,5,0,6]),import.meta.url)).html(),vue:async()=>(await at(async()=>{const{html:n}=await import("./index-CcKihMD9.js");return{html:n}},__vite__mapDeps([9,1,8,2,3,4,5,0,6]),import.meta.url)).html(),svelte:async()=>(await at(async()=>{const{html:n}=await import("./index-CcKihMD9.js");return{html:n}},__vite__mapDeps([9,1,8,2,3,4,5,0,6]),import.meta.url)).html(),md:async()=>(await at(async()=>{const{markdown:n}=await import("./index-qOoKNKZw.js");return{markdown:n}},__vite__mapDeps([10,3,4,5,2,6,9,1,8,0]),import.meta.url)).markdown(),markdown:async()=>(await at(async()=>{const{markdown:n}=await import("./index-qOoKNKZw.js");return{markdown:n}},__vite__mapDeps([10,3,4,5,2,6,9,1,8,0]),import.meta.url)).markdown(),py:async()=>(await at(async()=>{const{python:n}=await import("./index-DXCiYt0O.js");return{python:n}},__vite__mapDeps([11,1,2,3,4,5,6]),import.meta.url)).python(),pyi:async()=>(await at(async()=>{const{python:n}=await import("./index-DXCiYt0O.js");return{python:n}},__vite__mapDeps([11,1,2,3,4,5,6]),import.meta.url)).python(),yaml:async()=>(await at(async()=>{const{yaml:n}=await import("./index-D5xJiVmD.js");return{yaml:n}},__vite__mapDeps([12,1,2,3,4,5]),import.meta.url)).yaml(),yml:async()=>(await at(async()=>{const{yaml:n}=await import("./index-D5xJiVmD.js");return{yaml:n}},__vite__mapDeps([12,1,2,3,4,5]),import.meta.url)).yaml(),rs:async()=>(await at(async()=>{const{rust:n}=await import("./index-DM3T56Jf.js");return{rust:n}},__vite__mapDeps([13,1,2,3,4,5]),import.meta.url)).rust(),c:async()=>(await at(async()=>{const{cpp:n}=await import("./index-CYTyvY7n.js");return{cpp:n}},__vite__mapDeps([14,1,2,3,4,5]),import.meta.url)).cpp(),h:async()=>(await at(async()=>{const{cpp:n}=await import("./index-CYTyvY7n.js");return{cpp:n}},__vite__mapDeps([14,1,2,3,4,5]),import.meta.url)).cpp(),cc:async()=>(await at(async()=>{const{cpp:n}=await import("./index-CYTyvY7n.js");return{cpp:n}},__vite__mapDeps([14,1,2,3,4,5]),import.meta.url)).cpp(),cpp:async()=>(await at(async()=>{const{cpp:n}=await import("./index-CYTyvY7n.js");return{cpp:n}},__vite__mapDeps([14,1,2,3,4,5]),import.meta.url)).cpp(),hpp:async()=>(await at(async()=>{const{cpp:n}=await import("./index-CYTyvY7n.js");return{cpp:n}},__vite__mapDeps([14,1,2,3,4,5]),import.meta.url)).cpp(),java:async()=>(await at(async()=>{const{java:n}=await import("./index-Bta4Smbo.js");return{java:n}},__vite__mapDeps([15,1,2,3,4,5]),import.meta.url)).java(),go:async()=>(await at(async()=>{const{go:n}=await import("./index-fF3dLvWP.js");return{go:n}},__vite__mapDeps([16,1,2,3,4,5,6]),import.meta.url)).go(),php:async()=>(await at(async()=>{const{php:n}=await import("./index-B2l2owfY.js");return{php:n}},__vite__mapDeps([17,1,9,8,2,3,4,5,0,6]),import.meta.url)).php(),sql:async()=>(await at(async()=>{const{sql:n}=await import("./index-B_jwjnO_.js");return{sql:n}},__vite__mapDeps([18,2,3,4,5,1,6]),import.meta.url)).sql(),xml:async()=>(await at(async()=>{const{xml:n}=await import("./index-CkV2xkfY.js");return{xml:n}},__vite__mapDeps([19,1,2,3,4,5]),import.meta.url)).xml(),svg:async()=>(await at(async()=>{const{xml:n}=await import("./index-CkV2xkfY.js");return{xml:n}},__vite__mapDeps([19,1,2,3,4,5]),import.meta.url)).xml()},Rk={".mcp.json":"json",dockerfile:"yaml",makefile:"yaml"},Dk={javascript:"js",node:"js",typescript:"ts",python:"py",python3:"py",yml:"yaml",rust:"rs",golang:"go","c++":"cpp",cplusplus:"cpp"};async function Lk(n){const l=Dk[n.toLowerCase()]??n.toLowerCase(),i=B0[l];return i?i().catch(()=>null):null}async function Ok(n){const l=(n.split("/").pop()??"").toLowerCase(),i=Rk[l]??l.split(".").pop()??"",r=B0[i];return r?r().catch(()=>null):null}const zk=U0([{tag:[Ue.keyword,Ue.modifier,Ue.controlKeyword,Ue.moduleKeyword],class:"cmh-key"},{tag:[Ue.propertyName],class:"cmh-prop"},{tag:[Ue.function(Ue.variableName),Ue.labelName],class:"cmh-fn"},{tag:[Ue.color,Ue.constant(Ue.name),Ue.standard(Ue.name),Ue.bool],class:"cmh-const"},{tag:[Ue.typeName,Ue.className,Ue.changed,Ue.annotation,Ue.self,Ue.namespace],class:"cmh-type"},{tag:[Ue.number,Ue.integer,Ue.float],class:"cmh-num"},{tag:[Ue.string,Ue.special(Ue.string),Ue.regexp],class:"cmh-str"},{tag:[Ue.operator,Ue.operatorKeyword,Ue.escape],class:"cmh-op"},{tag:[Ue.meta,Ue.comment],class:"cmh-comment"},{tag:Ue.invalid,class:"cmh-invalid"}]);function hh(n){return n.replace(/[&<>]/g,l=>l==="&"?"&":l==="<"?"<":">")}async function Ik(n,l){const i=l?await Lk(l):null;if(!i)return hh(n);try{const r=i.language.parser.parse(n);let o="";return Ek(n,r,zk,(u,f)=>{o+=f?`<span class="${f}">${hh(u)}</span>`:hh(u)},()=>{o+=`
|
|
118
|
+
`}),o}catch{return hh(n)}}Gt.setOptions({gfm:!0,breaks:!1});function Ud(n){var i;const l=(i=n.split(".").pop())==null?void 0:i.toLowerCase();return l==="md"||l==="markdown"}function tm(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 qb(n){return n.replace(/[&<>"']/g,l=>l==="&"?"&":l==="<"?"<":l===">"?">":l==='"'?""":"'")}const Uk=/^\$\$(?!\s)((?:[^$\n]|\$(?!\$))+?)\$\$/,Bk=new RegExp("^\\$(?!\\s|\\$)((?:\\.|[^$\\\\n])+?)(?<!\\s)\\$(?!\\d)"),Hk=/^ {0,3}\$\$[ \t]*\n?([\s\S]+?)\n?[ \t]*\$\$[ \t]*(?:\n|$)/;function Gb(n,l){return`<span class="math${l?" math--display":""}" data-tex="${qb(n)}" data-display="${l?"1":"0"}">${qb(n)}</span>`}Gt.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=Hk.exec(n);if(l)return{type:"blockMath",raw:l[0],text:l[1].trim()}},renderer:n=>Gb(n.text,!0)+`
|
|
119
|
+
`},{name:"inlineMath",level:"inline",start:n=>n.indexOf("$"),tokenizer(n){const l=Uk.exec(n);if(l)return{type:"inlineMath",raw:l[0],text:l[1],display:!0};const i=Bk.exec(n);if(i)return{type:"inlineMath",raw:i[0],text:i[1],display:!1}},renderer:n=>Gb(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 Gd(n){const l=await Gt.parse(n,{async:!0,walkTokens:async i=>{if(i.type!=="code")return;const r=i;r.source=r.text,r.text=await Ik(r.text,r.lang??""),r.escaped=!0}});return ik.sanitize(l)}const H0="ccv.markdownMode";function Yb(){try{const n=localStorage.getItem(H0);if(n==="text"||n==="code"||n==="preview")return n}catch{}return"preview"}function qk(n){try{localStorage.setItem(H0,n)}catch{}}function Gk(n){return n.previewMode?"preview":n.textMode?"text":"code"}function Vb(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:tm(n.path)||Ud(n.path)&&Yb()==="preview",textMode:Ud(n.path)&&Yb()==="text"}}function ai(n){return!n.binary&&!n.tooLarge&&n.text!==n.saved}function fg(n){return n.split("/").pop()??n}function Kr(n){const l=n.lastIndexOf("/");return l===-1?"":n.slice(0,l)}function Ld(n){return n<1024?`${n} Б`:n<1024*1024?`${(n/1024).toFixed(1)} КБ`:`${(n/1024/1024).toFixed(1)} МБ`}function Yk(n){return`data:${n.mime};base64,${n.base64}`}const Vk=/!\[([^\]\n]*)\]\(\s*(<[^>\n]*>|[^)\s]*)(?:\s+(?:"[^"\n]*"|'[^'\n]*'))?\s*\)/g,Fk=/<img\b(?:"[^"]*"|'[^']*'|[^>"'])*>/gi,Xk=/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))/g;function Kk(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 Qk(n){return n.replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")}function Fb(n){return n.replace(/&/g,"&").replace(/"/g,""")}function Pk(n){const l=Kk(n),i=[];for(const r of l.matchAll(Vk)){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(Fk)){const o=n.slice(r.index,r.index+r[0].length),u={};for(const g of o.matchAll(Xk))u[g[1].toLowerCase()]=Qk(g[2]??g[3]??g[4]??"");const f=/^\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:f})}return i.sort((r,o)=>r.from-o.from)}function Zk(n,l){if(n.kind==="md")return`<img src="${Fb(n.src)}" alt="${Fb(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 Wk(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 Jk={"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/webp":"webp","image/bmp":"bmp","image/svg+xml":"svg","image/avif":"avif"};function ew(n){return Jk[n]??((n.split("/")[1]??"").replace(/[^a-z0-9]/gi,"").toLowerCase()||"png")}function tw(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 nw(n){return((n.split("/").pop()??n).replace(/\.[^.]*$/,"")||"image").replace(/[^\p{L}\p{N}_.-]+/gu,"-").replace(/^-+|-+$/g,"")||"image"}const Vi="application/x-ccv-fs-path",q0="application/x-ccv-fs-kind";function hg(n){return!!n&&Array.from(n.types).includes(Vi)}function G0(n){const l=n.getData(Vi);return l?{path:l,kind:n.getData(q0)==="dir"?"dir":"file"}:null}const sw=/\.(png|jpe?g|gif|webp|svg|avif|bmp)$/i;function lw(n){return sw.test(n)}function aw(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 g=[...Array(r.length-u).fill(".."),...o.slice(u)].map(_=>_===".."?_:encodeURIComponent(_)).join("/"),x=o[o.length-1]??l;return i==="dir"?`[${x}/](${g}/)`:lw(x)?``:`[${x}](${g})`}function Qi({x:n,y:l,items:i,note:r,onClose:o}){const u=p.useRef(null),[f,g]=p.useState({left:n,top:l}),[x,_]=p.useState(()=>{const k=i.findIndex(w=>!w.disabled);return k===-1?0:k}),b=p.useRef(null);p.useLayoutEffect(()=>{const k=u.current;if(!k)return;b.current=document.elementsFromPoint(n,l).find(z=>!k.contains(z))??null;const w=k.getBoundingClientRect(),E=8,C=Math.max(E,Math.min(n,window.innerWidth-w.width-E)),T=Math.max(E,Math.min(l,window.innerHeight-w.height-E));g({left:C,top:T})},[n,l]),p.useLayoutEffect(()=>{var k;(k=u.current)==null||k.focus()},[]),p.useLayoutEffect(()=>{function k(E){var C;(C=u.current)!=null&&C.contains(E.target)||o()}function w(E){var z;const C=E.target;if(C===document||C===document.documentElement){o();return}if(!(C instanceof Node)||(z=u.current)!=null&&z.contains(C))return;const T=b.current;(!T||C.contains(T))&&o()}return document.addEventListener("mousedown",k),document.addEventListener("scroll",w,!0),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("scroll",w,!0)}},[o]);function j(k){k.disabled||(k.onSelect(),o())}function N(k){if(k.key==="Escape"){k.preventDefault(),k.stopPropagation(),o();return}const w=i.map((E,C)=>({item:E,index:C})).filter(E=>!E.item.disabled);if(w.length!==0){if(k.key==="ArrowDown"||k.key==="ArrowUp"){k.preventDefault();const E=k.key==="ArrowDown"?1:-1,C=w.findIndex(z=>z.index===x),T=w[(((C===-1?0:C)+E)%w.length+w.length)%w.length];T&&_(T.index);return}if(k.key==="Enter"||k.key===" "){k.preventDefault();const E=i[x];E&&j(E)}}}return s.jsxs("div",{ref:u,className:"ctxmenu",style:{left:f.left,top:f.top},role:"menu",tabIndex:-1,onKeyDown:N,children:[r&&s.jsx("div",{className:"ctxmenu__note",children:r}),i.map((k,w)=>s.jsxs("button",{type:"button",role:"menuitem","aria-disabled":k.disabled,className:"ctxmenu__item"+(w===x?" is-cursor":""),onMouseEnter:()=>_(w),onClick:()=>j(k),children:[s.jsx("span",{className:"ctxmenu__label",children:k.label}),k.hint&&s.jsx("span",{className:"ctxmenu__hint",children:k.hint})]},k.id))]})}const iw=3500,rw=9e3,Xb=220;function Pr({result:n,onDismiss:l}){const[i,r]=p.useState(n),[o,u]=p.useState(!1);if(p.useEffect(()=>{if(!n){r(null),u(!1);return}if(r(n),u(!1),n.url)return;const g=n.ok?iw:rw,x=setTimeout(()=>u(!0),g),_=setTimeout(()=>r(null),g+Xb);return()=>{clearTimeout(x),clearTimeout(_)}},[n]),!i)return null;const f=()=>{u(!0),setTimeout(()=>{r(null),l==null||l()},Xb)};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:g=>g.stopPropagation(),children:[i.url.replace(/^https?:\/\//,"")," ↗"]}),i.url&&l&&s.jsx("button",{type:"button",className:"oplog__dismiss",title:"Закрыть","aria-label":"Закрыть сообщение",onClick:f,children:"✕"})]})}function Pi({value:n,className:l,placeholder:i="Название сессии",onCommit:r,onCancel:o}){const[u,f]=p.useState(n),g=p.useRef(null);p.useEffect(()=>{var _;(_=g.current)==null||_.select()},[]);function x(){const _=u.trim();if(!_||_===n)return o();r(_)}return s.jsx("input",{ref:g,className:l?`rename ${l}`:"rename",value:u,autoFocus:!0,spellCheck:!1,placeholder:i,onChange:_=>f(_.target.value),onBlur:x,onKeyDown:_=>{_.stopPropagation(),_.key==="Enter"?(_.preventDefault(),x()):_.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 cw=500,ow=200;function uw({open:n,tree:l,expanded:i,activePath:r,dirty:o,gitChanges:u,result:f,searchResult:g,onSearch:x,onReveal:_,onToggle:b,onOpen:j,onCreate:N,onRename:k,onMove:w,onCopy:E,onDelete:C,onRefresh:T,onClose:z,zoomed:q,onToggleZoom:te}){const[I,R]=p.useState(""),[$,Q]=p.useState(null),[ee,G]=p.useState(null),[B,F]=p.useState(null),[le,ue]=p.useState(null),[ce,D]=p.useState(null),[O,H]=p.useState(null),J=ru("(hover: hover)"),re=p.useRef(null),A=p.useMemo(()=>hw(u),[u]);function V(_e){return!(!B||_e===B.path||B.kind==="dir"&&_e.startsWith(`${B.path}/`)||_e===Kr(B.path))}function U(_e){return!(!ce||_e===ce.path||ce.kind==="dir"&&_e.startsWith(`${ce.path}/`)||ce.mode==="cut"&&_e===Kr(ce.path))}function be(_e){D({path:_e.path,kind:_e.kind,mode:"copy"})}function P(_e){D({path:_e.path,kind:_e.kind,mode:"cut"})}function ie(_e){!ce||!U(_e)||(_e&&!i.has(_e)&&b(_e),ce.mode==="cut"?(w(ce.path,_e),D(null)):E(ce.path,_e))}function Me(_e,Ae){const Je=_e.touches[0];if(!Je)return;const rt={timer:0,x:Je.clientX,y:Je.clientY,el:_e.currentTarget,fired:!1};rt.timer=window.setTimeout(()=>{rt.fired=!0,Ae(rt.x,rt.y,rt.el)},cw),re.current=rt}function Ke(_e){const Ae=re.current,Je=_e.touches[0];!Ae||!Je||Math.hypot(Je.clientX-Ae.x,Je.clientY-Ae.y)>10&&(window.clearTimeout(Ae.timer),re.current=null)}function Ne(_e){const Ae=re.current;Ae&&(window.clearTimeout(Ae.timer),Ae.fired&&_e.preventDefault())}function Be(){var _e;return(_e=re.current)!=null&&_e.fired?(re.current=null,!0):!1}function Xe(_e,Ae,Je,rt){R((rt==null?void 0:rt.path)??""),H({x:_e,y:Ae,opener:Je,entry:rt})}function Ze(){const _e=O==null?void 0:O.opener;H(null),_e!=null&&_e.isConnected&&_e.focus()}function an(_e){return{onContextMenu:Ae=>{Ae.preventDefault(),Xe(Ae.clientX,Ae.clientY,Ae.currentTarget,_e)},onTouchStart:Ae=>Me(Ae,(Je,rt,it)=>Xe(Je,rt,it,_e)),onTouchMove:Ke,onTouchEnd:Ne,onTouchCancel:Ne}}function We(_e){_e.target===_e.currentTarget&&(_e.preventDefault(),Xe(_e.clientX,_e.clientY,_e.currentTarget,null))}function Bt(_e){_e.target===_e.currentTarget&&Me(_e,(Ae,Je,rt)=>Xe(Ae,Je,rt,null))}function Ye(_e){if(!(_e.ctrlKey||_e.metaKey)||_e.target instanceof HTMLInputElement)return;const Ae=_e.key.toLowerCase();if(Ae==="v"){_e.preventDefault(),ie(Ie());return}if(!I)return;const Je=Kb(l,I);Je&&(Ae==="c"?(_e.preventDefault(),be(Je)):Ae==="x"&&(_e.preventDefault(),P(Je)))}function ct(_e){return Ae=>{Ae.dataTransfer.effectAllowed="copyMove",Ae.dataTransfer.setData(Vi,_e.path),Ae.dataTransfer.setData(q0,_e.kind),F({path:_e.path,kind:_e.kind})}}function xe(){F(null),ue(null)}function $e(_e){return Ae=>{Ae.dataTransfer.types.includes(Vi)&&(Ae.stopPropagation(),!(_e.kind!=="dir"||!V(_e.path))&&(Ae.preventDefault(),Ae.dataTransfer.dropEffect="move",ue(_e.path)))}}function ye(_e){return Ae=>{if(!Ae.dataTransfer.types.includes(Vi)||(Ae.stopPropagation(),_e.kind!=="dir"||!V(_e.path)))return;Ae.preventDefault();const Je=Ae.dataTransfer.getData(Vi);ue(null),Je&&w(Je,_e.path)}}function Qe(_e){!_e.dataTransfer.types.includes(Vi)||!V("")||(_e.preventDefault(),_e.dataTransfer.dropEffect="move",ue(""))}function rn(_e){if(!_e.dataTransfer.types.includes(Vi)||!V(""))return;_e.preventDefault();const Ae=_e.dataTransfer.getData(Vi);ue(null),Ae&&w(Ae,"")}const[kt,ht]=p.useState(""),_s=kt.trim(),On=_s.length>0,fn=p.useRef(null),Mt=p.useRef(x);Mt.current=x;function zt(_e){ht(_e),fn.current&&clearTimeout(fn.current);const Ae=_e.trim();if(!Ae){Mt.current("");return}fn.current=setTimeout(()=>Mt.current(Ae),ow)}function Ce(_e){fn.current&&clearTimeout(fn.current),ht(""),Mt.current(""),R(_e.path),_(_e)}const Te=On&&(g==null?void 0:g.query)===_s?g:null;function Ie(){if(I==="")return"";const _e=Kb(l,I);if((_e==null?void 0:_e.kind)==="dir")return I;const Ae=I.lastIndexOf("/");return Ae===-1?"":I.slice(0,Ae)}function st(_e,Ae){const Je=Ae??Ie();Je&&!i.has(Je)&&b(Je),G({parent:Je,kind:_e})}function _t(){if(!O)return[];const _e=rt=>J?rt:void 0;if(!O.entry)return[{id:"paste",label:"Вставить в корень проекта",hint:_e("Ctrl+V"),disabled:!U(""),onSelect:()=>ie("")},{id:"new-file",label:"Создать файл",onSelect:()=>st("file","")},{id:"new-dir",label:"Создать каталог",onSelect:()=>st("dir","")}];const Ae=O.entry,Je=[Ae.kind==="file"?{id:"open",label:"Открыть",onSelect:()=>j(Ae.path)}:{id:"toggle",label:i.has(Ae.path)?"Свернуть":"Развернуть",onSelect:()=>b(Ae.path)},{id:"copy",label:"Копировать",hint:_e("Ctrl+C"),onSelect:()=>be(Ae)},{id:"cut",label:"Вырезать",hint:_e("Ctrl+X"),onSelect:()=>P(Ae)}];return Ae.kind==="dir"&&(Je.push({id:"paste",label:"Вставить",hint:_e("Ctrl+V"),disabled:!U(Ae.path),onSelect:()=>ie(Ae.path)}),Je.push({id:"new-file",label:"Создать файл",onSelect:()=>st("file",Ae.path)}),Je.push({id:"new-dir",label:"Создать каталог",onSelect:()=>st("dir",Ae.path)})),Je.push({id:"rename",label:"Переименовать",onSelect:()=>Q(Ae.path)}),Je.push({id:"delete",label:"Удалить",onSelect:()=>C(Ae)}),Je}const bt=On?[]:yt("",0);function yt(_e,Ae){const Je=l[_e],rt=[];if(ee&&ee.parent===_e&&rt.push(s.jsxs("div",{className:"fsrow fsrow--draft",style:Fi(Ae),children:[s.jsx("span",{className:"fsrow__icon",children:ee.kind==="dir"?s.jsx(Yh,{}):s.jsx(Vh,{})}),s.jsx(Pi,{className:"rename--file",value:"",placeholder:ee.kind==="dir"?"имя каталога":"имя файла",onCommit:it=>{G(null),N(_e,ee.kind,it)},onCancel:()=>G(null)})]},`draft:${_e}`)),!Je)return rt.push(s.jsx("p",{className:"fsrow__pending",style:Fi(Ae),children:"читаем…"},`wait:${_e}`)),rt;Je.length===0&&!ee&&rt.push(s.jsx("p",{className:"fsrow__pending",style:Fi(Ae),children:"пусто"},`empty:${_e}`));for(const it of Je){const en=it.kind==="dir"&&i.has(it.path);rt.push($===it.path?s.jsxs("div",{className:"fsrow fsrow--draft",style:Fi(Ae),children:[s.jsx("span",{className:"fsrow__icon",children:it.kind==="dir"?s.jsx(Yh,{open:en}):s.jsx(Vh,{})}),s.jsx(Pi,{className:"rename--file",value:it.name,placeholder:"новое имя",onCommit:dt=>{Q(null),k(it.path,dt)},onCancel:()=>Q(null)})]},it.path):s.jsx(dw,{entry:it,depth:Ae,open:en,active:it.path===r,selected:it.path===I,dirty:o.has(it.path),gitStatus:A.get(it.path),dragging:(B==null?void 0:B.path)===it.path,dropTarget:le===it.path,cut:(ce==null?void 0:ce.mode)==="cut"&&ce.path===it.path,onClick:()=>{Be()||(R(it.path),it.kind==="dir"?b(it.path):j(it.path))},onRename:()=>Q(it.path),onDelete:()=>C(it),onDragStart:ct(it),onDragEnd:xe,onDragOver:$e(it),onDrop:ye(it),...an(it)},it.path)),en&&rt.push(...yt(it.path,Ae+1))}return rt}function zn(){if(!Te)return[s.jsx("p",{className:"fsrow__pending",style:Fi(0),children:"ищем…"},"search:wait")];if(Te.entries.length===0)return[s.jsx("p",{className:"fsrow__pending",style:Fi(0),children:"ничего не найдено"},"search:empty")];const _e=Te.entries.map(Ae=>s.jsx(fw,{entry:Ae,gitStatus:A.get(Ae.path),onClick:()=>Ce(Ae)},Ae.path));return Te.truncated&&_e.push(s.jsxs("p",{className:"fsrow__pending",style:Fi(0),children:["показаны первые ",Te.entries.length," — уточните запрос"]},"search:truncated")),_e}return s.jsxs("aside",{className:(n?"sidepane sidepane--files sidepane--open":"sidepane sidepane--files")+(q?" sidepane--zoomed":""),"aria-label":"Файлы проекта",onKeyDown:Ye,children:[s.jsxs("div",{className:"sidepane__head",onDoubleClick:_e=>{te&&(_e.target.closest("button")||te())},children:[s.jsx(xw,{}),s.jsx("span",{className:"sidepane__title",children:"Файлы"}),s.jsx("button",{className:"sidepane__btn",title:"Новый файл","aria-label":"Новый файл",onClick:()=>st("file"),children:s.jsx(pw,{})}),s.jsx("button",{className:"sidepane__btn",title:"Новый каталог","aria-label":"Новый каталог",onClick:()=>st("dir"),children:s.jsx(gw,{})}),s.jsx("button",{className:"sidepane__btn",title:"Перечитать дерево","aria-label":"Перечитать дерево",onClick:T,children:"↻"}),te&&s.jsx("button",{className:"sidepane__btn",title:q?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":q?"Свернуть панель файлов":"Развернуть панель файлов на весь экран","aria-pressed":q,onClick:te,children:s.jsx(ou,{active:q})}),s.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель файлов",onClick:z,children:"✕"})]}),s.jsxs("div",{className:"fssearch",children:[s.jsx(_w,{}),s.jsx("input",{className:"fssearch__input",type:"text",value:kt,spellCheck:!1,placeholder:"Поиск файлов и папок…","aria-label":"Поиск файлов и папок",onChange:_e=>zt(_e.target.value),onKeyDown:_e=>{_e.stopPropagation(),_e.key==="Escape"&&(_e.preventDefault(),kt?zt(""):_e.currentTarget.blur())}}),kt&&s.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>zt(""),children:"✕"})]}),s.jsx("div",{className:"sidepane__scroll fstree"+(le===""?" fstree--drop-target":""),tabIndex:-1,onDragOver:Qe,onDrop:rn,onContextMenu:We,onTouchStart:Bt,onTouchMove:Ke,onTouchEnd:Ne,onTouchCancel:Ne,children:On?zn():bt}),s.jsx(Pr,{result:f}),O&&s.jsx(Qi,{x:O.x,y:O.y,items:_t(),onClose:Ze})]})}function dw({entry:n,depth:l,open:i,active:r,selected:o,dirty:u,gitStatus:f,dragging:g,dropTarget:x,cut:_,onClick:b,onRename:j,onDelete:N,onDragStart:k,onDragEnd:w,onDragOver:E,onDrop:C,onContextMenu:T,onTouchStart:z,onTouchMove:q,onTouchEnd:te,onTouchCancel:I}){const R="fsrow"+(r?" is-open":"")+(o&&!r?" is-selected":"")+(n.ignored?" fsrow--ignored":"")+(g?" fsrow--dragging":"")+(x?" fsrow--drop-target":"")+(_?" fsrow--cut":"");return s.jsxs("div",{className:R,style:Fi(l),draggable:!0,onDragStart:k,onDragEnd:w,onDragOver:E,onDrop:C,onContextMenu:T,onTouchStart:z,onTouchMove:q,onTouchEnd:te,onTouchCancel:I,children:[s.jsxs("button",{className:"fsrow__main",onClick:b,title:Y0(n),children:[s.jsx("span",{className:"fsrow__icon"+Gh("fsrow__icon",f),children:n.kind==="dir"?s.jsx(Yh,{open:i}):s.jsx(Vh,{})}),s.jsx("span",{className:"fsrow__name"+Gh("fsrow__name",f),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 fw({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:Fi(0),onClick:i,title:Y0(n),children:[s.jsx("span",{className:"fsrow__icon"+Gh("fsrow__icon",l),children:n.kind==="dir"?s.jsx(Yh,{}):s.jsx(Vh,{})}),s.jsx("span",{className:"fsrow__name"+Gh("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 Y0(n){return n.ignored?`${n.path} — игнорируется git (.gitignore)`:n.path}function Fi(n){return{"--depth":n}}function Kb(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 hw(n){const l=new Map,i={added:1,modified:2},r=(o,u)=>{const f=l.get(o);(!f||i[u]>i[f])&&l.set(o,u)};for(const o of n){const u=mw(o.status);if(!u)continue;r(o.path,u);let f=Kr(o.path);for(;r(f,u),!!f;)f=Kr(f)}return l}function mw(n){if(n==="??")return"added";const[l="",i=""]=n;return l==="A"||l==="R"||l==="C"?"added":l==="M"||i==="M"?"modified":null}function Gh(n,l){return l?` ${n}--git-${l}`:""}function Yh({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 Vh(){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 pw(){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 gw(){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 xw(){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 _w(){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 bw=200;function yw({open:n,result:l,onSearch:i,onOpenMatch:r,onClose:o,zoomed:u,onToggleZoom:f}){const[g,x]=p.useState(""),_=g.trim(),b=_.length>0,j=p.useRef(null),N=p.useRef(i);N.current=i;function k(C){x(C),j.current&&clearTimeout(j.current);const T=C.trim();if(!T){N.current("");return}j.current=setTimeout(()=>N.current(T),bw)}const w=b&&(l==null?void 0:l.query)===_?l:null;function E(){if(!w)return[s.jsx("p",{className:"fsrow__pending",children:"ищем…"},"grep:wait")];if(w.matches.length===0)return[s.jsx("p",{className:"fsrow__pending",children:"ничего не найдено"},"grep:empty")];const C=[];let T="";for(const z of w.matches)z.path!==T&&(T=z.path,C.push(s.jsx("p",{className:"searchgroup__path",title:z.path,children:z.path},`path:${z.path}`))),C.push(s.jsx(vw,{match:z,onClick:()=>r(z)},`${z.path}:${z.line}:${z.column}`));return w.truncated&&C.push(s.jsxs("p",{className:"fsrow__pending",children:["показаны первые ",w.matches.length," — уточните запрос"]},"grep:truncated")),C}return s.jsxs("aside",{className:(n?"sidepane sidepane--search sidepane--open":"sidepane sidepane--search")+(u?" sidepane--zoomed":""),"aria-label":"Поиск по тексту в проекте",children:[s.jsxs("div",{className:"sidepane__head",onDoubleClick:C=>{f&&(C.target.closest("button")||f())},children:[s.jsx(jw,{}),s.jsx("span",{className:"sidepane__title",children:"Поиск по тексту"}),f&&s.jsx("button",{className:"sidepane__btn",title:u?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":u?"Свернуть панель поиска":"Развернуть панель поиска на весь экран","aria-pressed":u,onClick:f,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(Nw,{}),s.jsx("input",{className:"fssearch__input",type:"text",value:g,spellCheck:!1,placeholder:"Поиск по тексту во всех файлах…","aria-label":"Поиск по тексту во всех файлах",onChange:C=>k(C.target.value),onKeyDown:C=>{C.stopPropagation(),C.key==="Escape"&&(C.preventDefault(),g?k(""):C.currentTarget.blur())}}),g&&s.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>k(""),children:"✕"})]}),s.jsx("div",{className:"sidepane__scroll fstree",children:b?E():s.jsx("p",{className:"sidepane__empty",children:"Введите текст, чтобы найти его во всех файлах проекта."})})]})}function vw({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 jw(){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 Nw(){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 mh=null;function kw(){return mh||(mh=Promise.all([at(()=>import("./index-Zq9V5ZB9.js"),__vite__mapDeps([20,4,3,5,2,21,6]),import.meta.url),at(()=>import("./index-PAORgBv5.js").then(n=>n.v),__vite__mapDeps([4,3,5]),import.meta.url),at(()=>import("./index-BHot-lnj.js"),[],import.meta.url),at(()=>import("./index-CUm9rUfI.js"),__vite__mapDeps([21,3,4,5,2]),import.meta.url),at(()=>import("./codemirror-CNxAt-Eg.js"),__vite__mapDeps([22,2,3,4,5]),import.meta.url),at(()=>import("./codemirrorImages-C30a2wIG.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 mh=null,n})),mh}const ww=new Set(["md","markdown","txt","rst","adoc"]);function Sw(n){var l;return ww.has(((l=n.split(".").pop())==null?void 0:l.toLowerCase())??"")}function Ew({path:n,doc:l,revision:i,goto:r,onChange:o,onSave:u,images:f,onRequestImage:g,onPasteImage:x}){const _=p.useRef(null),b=p.useRef(null),j=p.useRef(null),N=p.useRef(new Map),k=p.useRef(new Map),w=p.useRef(new Set),E=p.useRef(null),C=p.useRef(o),T=p.useRef(u),z=p.useRef(n),q=p.useRef(i),te=p.useRef(l);C.current=o,T.current=u,z.current=n,q.current=i,te.current=l;const I=p.useRef(f),R=p.useRef(g),$=p.useRef(x);I.current=f,R.current=g,$.current=x;const[Q,ee]=p.useState("loading"),[G,B]=p.useState(!1);function F(O,H,J){Ud(J)&&H.dispatch({effects:O.refreshImages.of(null)})}function le(O,H,J){const re=b.current,A=z.current===H&&re,V=A?re.state:N.current.get(H);if(!V)return;const U=V.doc.toString().indexOf(J);if(U===-1)return;const be={from:U,to:U+J.length};if(A){re.dispatch({changes:be});return}const P=V.update({changes:be}).state;N.current.set(H,P),C.current(H,P.doc.toString())}function ue(O,H){return[O.markdownImages({getDocPath:()=>H,getImage:J=>I.current[J],requestImage:J=>R.current(J)}),O.EditorView.domEventHandlers({dragover(J){return hg(J.dataTransfer)?(J.preventDefault(),J.dataTransfer&&(J.dataTransfer.dropEffect="copy"),!0):!1},drop(J,re){if(!J.dataTransfer||!hg(J.dataTransfer))return!1;const A=G0(J.dataTransfer);if(!A)return!1;J.preventDefault();const V=re.posAtCoords({x:J.clientX,y:J.clientY})??re.state.selection.main.head,U=aw(H,A.path,A.kind),be=re.state.doc.sliceString(Math.max(0,V-1),V),ie=(be!==""&&!/\s/.test(be)?" ":"")+U;return re.dispatch({changes:{from:V,insert:ie},selection:{anchor:V+ie.length},userEvent:"input.drop"}),re.focus(),!0},paste(J,re){var U;const A=Array.from(((U=J.clipboardData)==null?void 0:U.files)??[]).filter(be=>be.type.startsWith("image/"));if(A.length===0)return!1;J.preventDefault();const V=[];for(const be of A){const P=$.current(H,be,()=>{P&&le(O,H,P)});P&&V.push(P)}return V.length>0&&re.dispatch(re.state.replaceSelection(V.join(`
|
|
123
|
+
`))),!0}})]}function ce(O,H,J,re,A){const V=N.current.get(re),U=k.current.get(re)===A&&(V==null?void 0:V.doc.length)===te.current.length&&V.doc.toString()===te.current;if(V&&U)J.setState(V),F(O,J,re);else{const P=O.EditorState.create({doc:te.current,extensions:[O.basicSetup,O.Prec.highest(O.keymap.of([{key:"Mod-s",preventDefault:!0,run:()=>(T.current(z.current),!0)}])),O.keymap.of([O.indentWithTab]),H.of([]),Sw(re)?O.EditorView.lineWrapping:[],Ud(re)?ue(O,re):[],O.editorTheme,O.editorHighlight,O.EditorView.updateListener.of(ie=>{ie.docChanged&&C.current(z.current,ie.state.doc.toString())})]});N.current.set(re,P),k.current.set(re,A),J.setState(P),w.current.delete(re)}if(w.current.has(re))return()=>{};let be=!1;return Ok(re).then(P=>{be||!P||z.current!==re||(J.dispatch({effects:H.reconfigure(P)}),N.current.set(re,J.state),w.current.add(re))}),()=>{be=!0}}p.useEffect(()=>{if(!_.current)return;let H=!1,J=null,re=null;ee("loading"),B(!1);const A=window.setTimeout(()=>{H||B(!0)},200);return(async()=>{let V;try{V=await kw()}catch{window.clearTimeout(A),H||ee("error");return}if(H||!_.current)return;window.clearTimeout(A);const U=new V.Compartment;E.current=U,j.current=V,re=new V.EditorView({parent:_.current}),b.current=re,J=ce(V,U,re,z.current,q.current),ee("ready")})(),()=>{H=!0,window.clearTimeout(A),J==null||J(),re==null||re.destroy(),b.current===re&&(b.current=null),j.current=null,E.current=null}},[]),p.useEffect(()=>{const O=j.current,H=b.current,J=E.current;if(!(!O||!H||!J))return ce(O,J,H,n,i)},[n,i]),p.useEffect(()=>{const O=b.current,H=j.current;O&&H&&F(H,O,z.current)},[f]);const D=p.useRef(0);return p.useEffect(()=>{const O=b.current,H=j.current;if(!O||!H||!r||r.token===D.current)return;D.current=r.token;const J=O.state.doc.lines,re=Math.min(Math.max(r.line,1),J),A=O.state.doc.line(re),V=Math.min(A.from+Math.max(r.column-1,0),A.to);O.dispatch({selection:H.EditorSelection.cursor(V),effects:H.EditorView.scrollIntoView(V,{y:"center"})}),O.focus()},[r]),p.useEffect(()=>()=>{const O=b.current;O&&N.current.set(n,O.state)},[n]),s.jsxs("div",{className:"editor__code",children:[s.jsx("div",{ref:_,className:"editor__code-surface"+(Q==="ready"?"":" is-hidden")}),Q==="loading"&&G&&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:"Загружается редактор…"})]}),Q==="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 V0=Zy();let ph=null,gh=null;function Cw(){return ph||(ph=Promise.all([at(()=>import("./katex-DFbIS0RS.js"),[],import.meta.url),at(()=>Promise.resolve({}),__vite__mapDeps([24]),import.meta.url)]).then(([n])=>n.default).catch(n=>{throw ph=null,n})),ph}function Tw(){return gh||(gh=at(()=>import("./mermaid.core-CFBl9TP8.js").then(n=>n.bb),__vite__mapDeps([25,26]),import.meta.url).then(n=>n.default).catch(n=>{throw gh=null,n})),gh}async function Aw(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 Mw=0,Qb=Promise.resolve();function Rw(n,l){const i=Qb.then(async()=>{var u,f;const r=await Tw();r.initialize({startOnLoad:!1,securityLevel:"strict",theme:l?"dark":"default",layout:"dagre"});const o=`ccv-mermaid-${++Mw}`;try{const{svg:g}=await r.render(o,n);return g}finally{(u=document.getElementById(o))==null||u.remove(),(f=document.getElementById(`d${o}`))==null||f.remove()}});return Qb=i.catch(()=>{}),i}async function oi(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 mg(){try{return await navigator.clipboard.readText()}catch{return null}}const Kg=1600,qc="Копировать",Zo="Скопировано";function Ca({text:n,hint:l,className:i}){const[r,o]=p.useState(!1);return p.useEffect(()=>{if(!r)return;const u=setTimeout(()=>o(!1),Kg);return()=>clearTimeout(u)},[r]),p.useEffect(()=>o(!1),[n]),s.jsx("button",{type:"button",className:"copybtn"+(r?" copybtn--done":"")+(i?` ${i}`:""),"aria-label":r?Zo:`${qc} ${l}`,title:r?Zo:`${qc} ${l}`,onClick:()=>{oi(n).then(u=>{u&&o(!0)})},children:r?Zo:qc})}function nm({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 F0(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 Dw(n,l){return n==="svg"?F0(l):l}function X0(n,l){return n.toLowerCase().endsWith(".svg")?F0(l):l}function K0({doc:n,title:l,onClose:i}){return p.useEffect(()=>{const r=o=>{o.key==="Escape"&&i()};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[i]),V0.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(nm,{doc:n,title:l,className:"pvfull__frame"})]}),document.body)}function Lw(n){try{return decodeURIComponent(n)}catch{return n}}function Q0(n,l,i){const[r,o]=p.useState([]);return p.useLayoutEffect(()=>{var g;const u=n.current;if(!u)return;if(Aw(u),i){o([]);return}const f=[];for(const x of u.querySelectorAll(".embed[data-embed]")){const _=x.dataset.embed,b=Lw(x.dataset.source??""),j=((g=x.querySelector("pre"))==null?void 0:g.outerHTML)??"";x.replaceChildren(),x.classList.add("embed--live"),f.push({node:x,kind:_,source:b,codeHtml:j})}o(f)},[n,l,i]),r.map((u,f)=>V0.createPortal(s.jsx(zw,{slot:u}),u.node,`${f}:${u.source.length}`))}function Ow(){const[n,l]=p.useState(()=>document.documentElement.dataset.theme==="dark");return p.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 Pb={html:"HTML",svg:"SVG",mermaid:"Диаграмма"};function zw({slot:n}){const{kind:l,source:i,codeHtml:r}=n,[o,u]=p.useState(!1),[f,g]=p.useState(!1),x=Ow(),[_,b]=p.useState(null);p.useEffect(()=>{if(l!=="mermaid")return;let w=!1;return b(null),Rw(i,x).then(E=>{w||b({svg:E})},E=>{w||b({error:E instanceof Error?E.message:String(E)})}),()=>{w=!0}},[l,i,x]);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(Ca,{text:i,hint:"код диаграммы"})]}),s.jsx("pre",{className:"embed__errtext",children:_.error}),j]});const N=`Превью ${Pb[l]}`,k=l==="mermaid"?"":Dw(l,i);return s.jsxs("div",{className:"embed__card",children:[s.jsxs("div",{className:"embed__bar",children:[s.jsx("span",{className:"embed__kind",children:Pb[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(Ca,{text:i,hint:"код блока"}),l!=="mermaid"&&s.jsx("button",{type:"button",className:"copybtn","aria-label":"Развернуть превью на весь экран",title:"Развернуть на весь экран",onClick:()=>g(!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(nm,{doc:k,title:N})}),f&&l!=="mermaid"&&s.jsx(K0,{doc:k,title:N,onClose:()=>g(!1)})]})}const Hp="#ffd23f",xh="#1b1a17",Iw=.25,pg=(n,l)=>`ccv.videoNotes.${n}.${l}`;function $w(n){const l=n;return!!l&&typeof l.x=="number"&&typeof l.y=="number"}function Uw(n){const l=n;return l?l.kind==="point"?typeof l.x=="number"&&typeof l.y=="number":l.kind==="area"?Array.isArray(l.points)&&l.points.length>=3&&l.points.every($w):!1:!1}function Bw(n,l){try{const i=localStorage.getItem(pg(n,l));if(!i)return[];const r=JSON.parse(i);return Array.isArray(r)?r.filter(o=>!!o&&typeof o.id=="string"&&typeof o.n=="number"&&typeof o.time=="number"&&typeof o.comment=="string"&&Uw(o.shape)):[]}catch{return[]}}function Hw(n,l,i){try{i.length===0?localStorage.removeItem(pg(n,l)):localStorage.setItem(pg(n,l),JSON.stringify(i))}catch{}}function qw(n){return n.reduce((l,i)=>Math.max(l,i.n),0)+1}function P0(n){return[...n].sort((l,i)=>l.time-i.time||l.n-i.n)}function Fh(n){const l=Math.max(0,Math.round(n*100)),i=Math.floor(l/6e3),r=l%6e3/100;return`${i}:${r.toFixed(2).padStart(5,"0")}`}function Sd(n){if(!Number.isFinite(n)||n<0)return"0:00";const l=Math.floor(n),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 Z0(n){let l=1,i=1,r=0,o=0;for(const u of n)l=Math.min(l,u.x),i=Math.min(i,u.y),r=Math.max(r,u.x),o=Math.max(o,u.y);return{x0:l,y0:i,x1:r,y1:o}}function W0(n){if(n.kind==="point")return{x:n.x,y:n.y};const l=Z0(n.points),i=(l.x0+l.x1)/2,r=(l.y0+l.y1)/2;let o=n.points[0],u=1/0;for(const f of n.points){const g=(f.x-i)**2+(f.y-r)**2;g<u&&(u=g,o=f)}return o}function Gw(n,l,i){const r=i.x-l.x,o=i.y-l.y,u=Math.hypot(r,o);return u===0?Math.hypot(n.x-l.x,n.y-l.y):Math.abs(o*n.x-r*n.y+i.x*l.y-i.y*l.x)/u}function gg(n,l){if(n.length<3)return n;const i=n[0],r=n[n.length-1];let o=0,u=0;for(let x=1;x<n.length-1;x++){const _=Gw(n[x],i,r);_>u&&(u=_,o=x)}if(u<=l)return[i,r];const f=gg(n.slice(0,o+1),l),g=gg(n.slice(o),l);return[...f.slice(0,-1),...g]}function Yw(n,l){if(n.length<=l)return n;let i=.002,r=n;for(let o=0;o<24&&r.length>l;o++)r=gg(n,i),i*=1.6;if(r.length>l){const o=r.length/l;r=Array.from({length:l},(u,f)=>r[Math.floor(f*o)])}return r}const Zb=12,Vw=".ccv/video-notes";function Fw(n){let l=n;try{/^[a-z][a-z0-9+.-]*:\/\//i.test(n)&&(l=decodeURIComponent(new URL(n).pathname))}catch{}return((l.split(/[\\/]/).filter(Boolean).pop()??"").replace(/\.[^.]+$/,"").replace(/[^\p{L}\p{N}_-]+/gu,"_").replace(/^_+|_+$/g,"")||"video").slice(0,60)}function Xw(n,l,i){return`${Vw}/${Fw(n)}-${l.n}-${Math.round(l.time*1e3)}-${i}.png`}function Kw(n,l,i){return new Promise((r,o)=>{const u=setTimeout(()=>{n.removeEventListener(l,f),o(new Error("Видео не перемотал"))},i);function f(){clearTimeout(u),r()}n.addEventListener(l,f,{once:!0})})}async function J0(n,l){if(Math.abs(n.currentTime-l)<.001&&n.readyState>=2)return;const i=Kw(n,"seeked",6e3);n.currentTime=l,await i}function Qw(n,l,i,r){const o=Math.max(i,r)/900;if(n.save(),n.lineJoin="round",n.lineCap="round",l.shape.kind==="area"){const _=new Path2D;l.shape.points.forEach((b,j)=>j===0?_.moveTo(b.x*i,b.y*r):_.lineTo(b.x*i,b.y*r)),_.closePath(),n.fillStyle="rgba(255, 210, 63, 0.18)",n.fill(_),n.strokeStyle=xh,n.lineWidth=5*o,n.stroke(_),n.strokeStyle=Hp,n.lineWidth=2.5*o,n.stroke(_)}const u=W0(l.shape),f=13*o,g=Math.min(Math.max(u.x*i,f),i-f),x=Math.min(Math.max(u.y*r,f),r-f);l.shape.kind==="point"&&(n.beginPath(),n.arc(g,x,f*1.9,0,Math.PI*2),n.strokeStyle=xh,n.lineWidth=5*o,n.stroke(),n.strokeStyle=Hp,n.lineWidth=2.5*o,n.stroke()),n.beginPath(),n.arc(g,x,f,0,Math.PI*2),n.fillStyle=Hp,n.fill(),n.strokeStyle=xh,n.lineWidth=2*o,n.stroke(),n.fillStyle=xh,n.font=`700 ${Math.round(f*1.25)}px system-ui, sans-serif`,n.textAlign="center",n.textBaseline="middle",n.fillText(String(l.n),g,x+o*.5),n.restore()}async function Pw(n,l){await J0(n,l.time);const i=n.videoWidth,r=n.videoHeight;if(!i||!r)throw new Error("У видео нет размера кадра");const o=document.createElement("canvas");o.width=i,o.height=r;const u=o.getContext("2d");if(!u)throw new Error("Холст недоступен");u.drawImage(n,0,0,i,r),Qw(u,l,i,r);const f=o.toDataURL("image/png");return f.slice(f.indexOf(",")+1)}const Fl=n=>`${Math.round(n*100)}%`;function Zw(n,l,i){const r=(_,b)=>Math.round(_*b),o=l&&i?` из ${l}×${i}`:"";if(n.kind==="point"){const _=`x ${Fl(n.x)}, y ${Fl(n.y)}`;return[l&&i?`Место: точка, ${_} (${r(n.x,l)}, ${r(n.y,i)} px${o})`:`Место: точка, ${_}`]}const u=Z0(n.points),f=[l&&i?`Место: область, рамка x ${Fl(u.x0)}–${Fl(u.x1)}, y ${Fl(u.y0)}–${Fl(u.y1)} (${r(u.x0,l)}–${r(u.x1,l)} × ${r(u.y0,i)}–${r(u.y1,i)} px${o})`:`Место: область, рамка x ${Fl(u.x0)}–${Fl(u.x1)}, y ${Fl(u.y0)}–${Fl(u.y1)}`],g=Yw(n.points,24),x=g.length<n.points.length?", упрощён":"";return f.push(`Контур (${g.length} вершин${x}): ${g.map(_=>`(${Fl(_.x)}, ${Fl(_.y)})`).join(" ")}`),f}function Ww(n){var j;const{source:l,width:i,height:r,duration:o,frames:u}=n,f=P0(n.notes.filter(N=>N.comment.trim()));if(f.length===0)return"";const g=["Правки к видео (отмечены места и моменты на кадре):",""];g.push(l.kind==="file"?`Видео: ${l.value}`:`Видео по ссылке: ${l.value}`);const x=[];i&&r&&x.push(`разрешение ${i}×${r}`),Number.isFinite(o)&&o>0&&x.push(`длительность ${Fh(o)} (${o.toFixed(2)} с)`),x.length&&g.push(x.join(", ")),g.push("Координаты — доля видимого кадра: x вправо, y вниз, от левого верхнего угла.");const _=f.map(N=>{const k=[`${N.n}. Время: ${Fh(N.time)} (${N.time.toFixed(2)} с)`];for(const E of Zw(N.shape,i,r))k.push(` ${E}`);k.push(` Правка: ${N.comment.trim().replace(/\n/g,`
|
|
124
|
+
`)}`);const w=u.paths[N.id];return w&&k.push(` Кадр с меткой: ${w}`),k.join(`
|
|
125
|
+
`)}),b=[];if(u.skipped&&b.push(`Кадры не сохранены: ${u.skipped}.`),(j=n.ffmpeg)!=null&&j.available&&l.kind==="file"){const N=f[0];b.push(`ffmpeg на машине есть, нужный кадр можно вынуть так: ffmpeg -ss ${N.time.toFixed(2)} -i "${l.value}" -frames:v 1 frame.png`)}return b.push(l.kind==="file"?"Найди в проекте то, что даёт эти моменты видео (исходники, композицию, ассеты), и внеси правки. Если место определяется неоднозначно — скажи, какие варианты нашёл.":"Это видео по чужой ссылке. Если оно получено из проекта, найди исходники и внеси правки; если нет — скажи, что именно нужно поменять и где."),[...g,"",_.join(`
|
|
126
|
+
|
|
127
|
+
`),"",...b].join(`
|
|
128
|
+
`)}const Jw=[.5,.75,1,1.25,1.5,2],Wb=5,Jb=1/30,xg=n=>`${n}×`,sm={viewBox:"0 0 16 16",width:16,height:16,fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};function eS(){return s.jsx("svg",{...sm,fill:"currentColor",stroke:"none",children:s.jsx("path",{d:"M4.5 2.8v10.4a.6.6 0 0 0 .9.5l8.2-5.2a.6.6 0 0 0 0-1L5.4 2.3a.6.6 0 0 0-.9.5z"})})}function tS(){return s.jsxs("svg",{...sm,fill:"currentColor",stroke:"none",children:[s.jsx("rect",{x:"3.5",y:"2.5",width:"3.2",height:"11",rx:"0.8"}),s.jsx("rect",{x:"9.3",y:"2.5",width:"3.2",height:"11",rx:"0.8"})]})}function nS({level:n}){return s.jsxs("svg",{...sm,children:[s.jsx("path",{d:"M2.5 6.2h2.2L8 3.4v9.2L4.7 9.8H2.5z",fill:"currentColor",stroke:"none"}),n==="off"?s.jsx("path",{d:"m10.6 6 3 4m0-4-3 4"}):s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M10.4 6.2a2.6 2.6 0 0 1 0 3.6"}),n==="high"&&s.jsx("path",{d:"M12.2 4.6a5 5 0 0 1 0 6.8"})]})]})}function sS({on:n}){return s.jsx("svg",{...sm,children:n?s.jsx("path",{d:"M6 2.5V6H2.5M10 2.5V6h3.5M6 13.5V10H2.5M10 13.5V10h3.5"}):s.jsx("path",{d:"M2.5 6V2.5H6M10 2.5h3.5V6M13.5 10v3.5H10M6 13.5H2.5V10"})})}function ev({src:n,crossOrigin:l,autoPlay:i,videoRef:r,onError:o,ticks:u,onTickClick:f,overlay:g,controlsExtra:x,className:_}){const b=p.useRef(null),j=p.useRef(null),N=p.useRef(null),k=p.useRef(null),w=p.useRef(!1),[E,C]=p.useState(0),[T,z]=p.useState(0),[q,te]=p.useState(!0),[I,R]=p.useState(1),[$,Q]=p.useState(!1),[ee,G]=p.useState(1),[B,F]=p.useState({w:0,h:0}),[le,ue]=p.useState({w:0,h:0}),[ce,D]=p.useState(null),[O,H]=p.useState(!1),[J,re]=p.useState(!1),A=p.useCallback(xe=>{N.current=xe,r&&(r.current=xe)},[r]),V=p.useCallback(()=>{const xe=N.current;xe&&(C(xe.currentTime),z(Number.isFinite(xe.duration)?xe.duration:0),te(xe.paused),R(xe.volume),Q(xe.muted),G(xe.playbackRate),ue({w:xe.videoWidth,h:xe.videoHeight}))},[]);p.useEffect(()=>{if(q)return;let xe=0;const $e=()=>{const ye=N.current;ye&&C(ye.currentTime),xe=requestAnimationFrame($e)};return xe=requestAnimationFrame($e),()=>cancelAnimationFrame(xe)},[q]),p.useLayoutEffect(()=>{const xe=j.current;if(!xe)return;const $e=()=>F({w:xe.clientWidth,h:xe.clientHeight});$e();const ye=new ResizeObserver($e);return ye.observe(xe),()=>ye.disconnect()},[]),p.useEffect(()=>{const xe=()=>H(document.fullscreenElement===b.current);return document.addEventListener("fullscreenchange",xe),()=>document.removeEventListener("fullscreenchange",xe)},[]),p.useEffect(()=>{if(!J)return;const xe=$e=>{var ye;(ye=$e.target)!=null&&ye.closest(".vplayer__speed")||re(!1)};return document.addEventListener("mousedown",xe),()=>document.removeEventListener("mousedown",xe)},[J]);let U=null;if(B.w>0&&B.h>0&&le.w>0&&le.h>0){const xe=Math.min(B.w/le.w,B.h/le.h),$e=le.w*xe,ye=le.h*xe;U={left:(B.w-$e)/2,top:(B.h-ye)/2,width:$e,height:ye}}function be(){return N.current}function P(){const xe=be();xe&&(xe.paused?xe.play().catch(()=>{}):xe.pause())}function ie(xe){const $e=be();if(!$e)return;const ye=T||$e.duration||0,Qe=Math.min(Math.max(0,xe),ye>0?ye:xe);$e.currentTime=Qe,C(Qe)}function Me(){var $e;const xe=b.current;xe&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):($e=xe.requestFullscreen)==null||$e.call(xe).catch(()=>{}))}function Ke(xe){const $e=be();$e&&($e.playbackRate=xe),G(xe),re(!1)}function Ne(xe){if(xe.ctrlKey||xe.metaKey||xe.altKey)return;const $e=xe.target;if(["INPUT","TEXTAREA","SELECT"].includes($e.tagName)||$e.isContentEditable)return;const ye=xe.key.toLowerCase(),Qe=be();if(Qe)if(ye===" "||ye==="k"||ye==="л"){if(ye===" "&&$e.tagName==="BUTTON")return;xe.preventDefault(),P()}else ye==="arrowleft"?(xe.preventDefault(),ie(Qe.currentTime-Wb)):ye==="arrowright"?(xe.preventDefault(),ie(Qe.currentTime+Wb)):(ye===","||ye==="б")&&Qe.paused?(xe.preventDefault(),ie(Qe.currentTime-Jb)):(ye==="."||ye==="ю")&&Qe.paused?(xe.preventDefault(),ie(Qe.currentTime+Jb)):ye==="f"||ye==="а"?(xe.preventDefault(),Me()):(ye==="m"||ye==="ь")&&(xe.preventDefault(),Qe.muted=!Qe.muted)}function Be(xe){const $e=k.current.getBoundingClientRect(),ye=Math.min(Math.max(xe-$e.left,0),$e.width);return{x:ye,t:$e.width>0?ye/$e.width*T:0}}function Xe(xe){!T||xe.button!==0||(xe.currentTarget.setPointerCapture(xe.pointerId),w.current=!0,ie(Be(xe.clientX).t))}function Ze(xe){if(!T)return;const $e=Be(xe.clientX);D($e),w.current&&ie($e.t)}function an(){w.current=!1}const We={time:E,duration:T,paused:q,box:U,videoWidth:le.w,videoHeight:le.h},Bt=T>0?Math.min(1,E/T):0,Ye=$||I===0?"off":I<.5?"low":"high",ct=typeof document<"u"&&!!document.documentElement.requestFullscreen;return s.jsxs("div",{ref:b,className:"vplayer"+(O?" is-fullscreen":"")+(_?` ${_}`:""),tabIndex:0,onKeyDown:Ne,"aria-label":"Видеоплеер",children:[s.jsxs("div",{ref:j,className:"vplayer__stage",children:[s.jsx("video",{ref:A,className:"vplayer__video",src:n,crossOrigin:l,autoPlay:i,playsInline:!0,preload:"metadata",onClick:P,onDoubleClick:Me,onLoadedMetadata:V,onDurationChange:V,onTimeUpdate:V,onSeeked:V,onPlay:V,onPause:V,onEnded:V,onVolumeChange:V,onRateChange:V,onError:o}),g&&s.jsx("div",{className:"vplayer__overlay",children:g(We)})]}),s.jsxs("div",{className:"vplayer__bar",children:[s.jsxs("div",{ref:k,className:"vplayer__seek"+(T?"":" is-idle"),role:"slider","aria-label":"Перемотка","aria-valuemin":0,"aria-valuemax":Math.round(T),"aria-valuenow":Math.round(E),"aria-valuetext":`${Sd(E)} из ${Sd(T)}`,onPointerDown:Xe,onPointerMove:Ze,onPointerUp:an,onPointerCancel:an,onPointerLeave:()=>!w.current&&D(null),children:[s.jsx("div",{className:"vplayer__rail",children:s.jsx("div",{className:"vplayer__played",style:{width:`${Bt*100}%`}})}),T>0&&(u==null?void 0:u.map(xe=>s.jsx("button",{type:"button",className:"vplayer__tick"+(xe.active?" is-active":""),style:{left:`${Math.min(1,xe.time/T)*100}%`},title:xe.label,"aria-label":xe.label,onPointerDown:$e=>$e.stopPropagation(),onClick:()=>f==null?void 0:f(xe.id)},xe.id))),s.jsx("div",{className:"vplayer__thumb",style:{left:`${Bt*100}%`}}),ce&&T>0&&s.jsx("div",{className:"vplayer__hover",style:{left:ce.x},children:Sd(ce.t)})]}),s.jsxs("div",{className:"vplayer__row",children:[s.jsx("button",{type:"button",className:"vplayer__btn",onClick:P,title:q?"Воспроизвести (Пробел)":"Пауза (Пробел)","aria-label":q?"Воспроизвести":"Пауза",children:q?s.jsx(eS,{}):s.jsx(tS,{})}),s.jsxs("span",{className:"vplayer__time",children:[Sd(E),s.jsx("span",{className:"vplayer__time-sep",children:" / "}),Sd(T)]}),s.jsx("span",{className:"vplayer__spacer"}),x,s.jsxs("div",{className:"vplayer__volume",children:[s.jsx("button",{type:"button",className:"vplayer__btn",onClick:()=>{const xe=be();xe&&(xe.muted=!xe.muted)},title:Ye==="off"?"Включить звук (M)":"Выключить звук (M)","aria-label":Ye==="off"?"Включить звук":"Выключить звук","aria-pressed":Ye==="off",children:s.jsx(nS,{level:Ye})}),s.jsx("input",{type:"range",className:"vplayer__range",min:0,max:1,step:.02,value:$?0:I,"aria-label":"Громкость",style:{"--fill":`${($?0:I)*100}%`},onChange:xe=>{const $e=be();$e&&($e.volume=Number(xe.target.value),$e.muted=Number(xe.target.value)===0)}})]}),s.jsxs("div",{className:"vplayer__speed",children:[s.jsx("button",{type:"button",className:"vplayer__btn vplayer__btn--text","aria-haspopup":"menu","aria-expanded":J,"aria-label":`Скорость воспроизведения, сейчас ${xg(ee)}`,title:"Скорость воспроизведения",onClick:()=>re(xe=>!xe),children:xg(ee)}),J&&s.jsx(lS,{rate:ee,onPick:Ke,onClose:()=>re(!1)})]}),ct&&s.jsx("button",{type:"button",className:"vplayer__btn",onClick:Me,title:O?"Выйти из полного экрана (F)":"На весь экран (F)","aria-label":O?"Выйти из полного экрана":"На весь экран",children:s.jsx(sS,{on:O})})]})]})]})}function lS({rate:n,onPick:l,onClose:i}){const r=p.useRef(null);p.useEffect(()=>{var u,f;(f=(u=r.current)==null?void 0:u.querySelector('[aria-checked="true"]'))==null||f.focus()},[]);function o(u){var f,g,x,_,b;if(u.stopPropagation(),u.key==="Escape")u.preventDefault(),i(),(x=(g=(f=r.current)==null?void 0:f.parentElement)==null?void 0:g.querySelector(".vplayer__btn"))==null||x.focus();else if(u.key==="ArrowUp"||u.key==="ArrowDown"){u.preventDefault();const j=[...((_=r.current)==null?void 0:_.querySelectorAll('[role="menuitemradio"]'))??[]],k=(j.indexOf(document.activeElement)+(u.key==="ArrowDown"?1:j.length-1))%j.length;(b=j[k])==null||b.focus()}}return s.jsx("div",{ref:r,className:"vplayer__menu",role:"menu","aria-label":"Скорость",onKeyDown:o,children:Jw.map(u=>s.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":u===n,className:"vplayer__menuitem"+(u===n?" is-on":""),onClick:()=>l(u),children:[s.jsx("span",{className:"vplayer__check","aria-hidden":"true",children:u===n?"✓":""}),u===1?"1× — обычная":xg(u)]},u))})}function aS(){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 iS(){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 rS(){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 tv({path:n,mime:l,base64:i,error:r,tooLarge:o,size:u,onRequestMedia:f,renderVideo:g}){p.useEffect(()=>{!o&&i===void 0&&r===void 0&&f(n)},[]);const x=cS(i,l);return o?s.jsx("div",{className:"mediaview mediaview--message",children:s.jsxs("p",{className:"mediaview__error",children:["Файл слишком велик для просмотра (",Ld(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:()=>f(n),children:"Повторить"})]}):x?l.startsWith("image/")?s.jsx(uS,{url:x}):l.startsWith("video/")?g?s.jsx("div",{className:"mediaview mediaview--video",children:g(x)}):s.jsx(dS,{url:x}):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 cS(n,l){const[i,r]=p.useState(null);return p.useEffect(()=>{if(n===void 0){r(null);return}const o=atob(n),u=new Uint8Array(o.length);for(let g=0;g<o.length;g++)u[g]=o.charCodeAt(g);const f=URL.createObjectURL(new Blob([u],{type:l}));return r(f),()=>URL.revokeObjectURL(f)},[n,l]),i}const qr=1,nv=8,_h=1.25;function oS(n){return Math.min(nv,Math.max(qr,n))}function uS({url:n}){const[l,i]=p.useState({scale:qr,x:0,y:0}),[r,o]=p.useState(!1),u=p.useRef(null),f=p.useRef(null);function g(k,w,E){i(C=>{const T=oS(C.scale*k);if(T===C.scale)return C;if(T<=qr)return{scale:qr,x:0,y:0};const z=(w-C.x)/C.scale,q=(E-C.y)/C.scale;return{scale:T,x:w-T*z,y:E-T*q}})}p.useEffect(()=>{const k=u.current;if(!k)return;function w(E){E.preventDefault();const C=k.getBoundingClientRect(),T=E.clientX-C.left-C.width/2,z=E.clientY-C.top-C.height/2;g(E.deltaY<0?_h:1/_h,T,z)}return k.addEventListener("wheel",w,{passive:!1}),()=>k.removeEventListener("wheel",w)},[]);function x(k){l.scale<=qr||(k.currentTarget.setPointerCapture(k.pointerId),f.current={pointerId:k.pointerId,startX:k.clientX,startY:k.clientY,origX:l.x,origY:l.y},o(!0))}function _(k){const w=f.current;!w||w.pointerId!==k.pointerId||i(E=>({...E,x:w.origX+(k.clientX-w.startX),y:w.origY+(k.clientY-w.startY)}))}function b(){f.current=null,o(!1)}const j=l.scale>qr,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:x,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<=qr,title:"Уменьшить","aria-label":"Уменьшить",onClick:()=>g(1/_h,0,0),children:s.jsx(iS,{})}),s.jsxs("span",{className:"mediaview__zoomlabel",children:[Math.round(l.scale*100),"%"]}),s.jsx("button",{className:"btn btn--sm",disabled:l.scale>=nv,title:"Увеличить","aria-label":"Увеличить",onClick:()=>g(_h,0,0),children:s.jsx(aS,{})}),s.jsx("button",{className:"btn btn--sm",disabled:N,title:"Вписать в окно","aria-label":"Сбросить масштаб — вписать в окно",onClick:()=>i({scale:qr,x:0,y:0}),children:s.jsx(rS,{})})]})]})}function dS({url:n}){return s.jsx("div",{className:"mediaview mediaview--video",children:s.jsx(ev,{src:n})})}const ey=48;function fS(n,l,i,r){n.addEventListener("pointerdown",o=>{var z;const u=i();if(!u||o.button!==0)return;o.preventDefault(),o.stopPropagation();const f=o.clientX,g=u.getBoundingClientRect().width,x=u.style.width,_=((z=l.parentElement)==null?void 0:z.clientWidth)||1/0,b=Math.max(ey,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(g);const k=()=>{j.textContent=`${N} px`};k();const w=q=>{N=Math.min(b,Math.max(ey,Math.round(g+q.clientX-f))),u.style.width=`${N}px`,k()},E=q=>{n.removeEventListener("pointermove",w),n.removeEventListener("pointerup",C),n.removeEventListener("pointercancel",T),j.remove(),l.classList.remove("is-resizing"),q&&N!==Math.round(g)?r(N):u.style.width=x},C=()=>E(!0),T=()=>E(!1);n.addEventListener("pointermove",w),n.addEventListener("pointerup",C),n.addEventListener("pointercancel",T)})}const hS=p.lazy(()=>at(()=>import("./MarkdownTextEditor-DoP0b52_.js"),__vite__mapDeps([27,5,26]),import.meta.url));function mS({file:n,goto:l,onChange:i,onSave:r,onReload:o,onOverwrite:u,onRequestMedia:f,onTogglePreview:g,onSetMarkdownMode:x,preview:_,onRequestPreview:b,images:j,onRequestImage:N,onPasteImage:k}){const w=ai(n),E=Ud(n.path)&&!n.binary&&!n.tooLarge,C=tm(n.path)&&!n.binary&&!n.tooLarge,T=Gk(n),z=C&&n.previewMode,[q,te]=p.useState(!1);p.useEffect(()=>{z&&b(n.path)},[z,n.path,n.mtime,b]);const I=(_==null?void 0:_.html)!==void 0?X0(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:s.jsx("bdi",{dir:"ltr",children:n.path})}),s.jsxs("span",{className:"editor__meta",children:[Ld(n.size),n.eol==="crlf"&&" · CRLF"]}),E&&s.jsx("div",{className:"editor__viewtoggle",role:"tablist","aria-label":"Режим просмотра",children:[["preview","Просмотр","Отрендеренный документ, только чтение"],["text","Текст","Писать как в обычном редакторе, без разметки на виду"],["code","Код","Исходник Markdown"]].map(([R,$,Q])=>s.jsx("button",{className:"btn btn--sm"+(T===R?" is-on":""),role:"tab",title:Q,"aria-selected":T===R,onClick:()=>T!==R&&x(n.path,R),children:$},R))}),C&&s.jsxs("div",{className:"editor__viewtoggle",role:"tablist","aria-label":"Режим просмотра",children:[s.jsx("button",{className:"btn btn--sm"+(n.previewMode?" is-on":""),role:"tab","aria-selected":n.previewMode,onClick:()=>!n.previewMode&&g(n.path),children:"Превью"}),s.jsx("button",{className:"btn btn--sm"+(n.previewMode?"":" is-on"),role:"tab","aria-selected":!n.previewMode,onClick:()=>n.previewMode&&g(n.path),children:"Код"})]}),z&&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:I===null,onClick:()=>te(!0),children:"Развернуть"})]}),s.jsx("button",{className:"btn btn--sm",disabled:!w,title:"Сохранить (Ctrl+S)",onClick:()=>r(n.path),children:w?"Сохранить":"Сохранено"})]}),n.stale&&s.jsxs("div",{className:"editor__warn",children:[s.jsxs("span",{children:["Файл изменился на диске",w?" — а здесь есть несохранённые правки.":"."]}),s.jsx("button",{className:"btn btn--sm",onClick:()=>o(n.path),children:"Взять с диска"}),w&&s.jsx("button",{className:"btn btn--sm btn--danger",onClick:()=>u(n.path),children:"Сохранить поверх"})]}),n.binary&&n.mediaMime?s.jsx(tv,{path:n.path,mime:n.mediaMime,base64:n.mediaBase64,error:n.mediaError,tooLarge:n.mediaTooLarge,size:n.size,onRequestMedia:f},n.path):n.binary?s.jsxs("p",{className:"editor__empty",children:["Это не текстовый файл — редактировать его здесь нечем. ",Ld(n.size)," на диске."]}):n.tooLarge?s.jsxs("p",{className:"editor__empty",children:["Файл слишком велик для редактора (",Ld(n.size),"). Такие правит агент, а не браузер."]}):z?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:[I!==null?s.jsx(nm,{doc:I,title:`Превью ${fg(n.path)}`,className:"webpreview__frame"}):(_==null?void 0:_.error)===void 0?s.jsx("p",{className:"editor__empty",children:"Собираем превью…"}):null,(_==null?void 0:_.loading)&&I!==null&&s.jsx("span",{className:"webpreview__busy",children:"Обновляем…"})]}),q&&I!==null&&s.jsx(K0,{doc:I,title:fg(n.path),onClose:()=>te(!1)})]}):E&&T==="text"?s.jsx(p.Suspense,{fallback:s.jsx("p",{className:"editor__empty",children:"Открываем редактор…"}),children:s.jsx(hS,{path:n.path,doc:n.text,onChange:i,onSave:r,images:j,onRequestImage:N,onPasteImage:k},`${n.path}:${n.revision}`)}):E&&n.previewMode?s.jsx(pS,{path:n.path,text:n.text,images:j,onRequestImage:N,onChange:i}):s.jsx(Ew,{path:n.path,doc:n.text,revision:n.revision,goto:l,onChange:i,onSave:r,images:j,onRequestImage:N,onPasteImage:k})]})}function pS({path:n,text:l,images:i,onRequestImage:r,onChange:o}){const[u,f]=p.useState(""),g=p.useRef(null),x=Q0(g,u,!1),_=p.useMemo(()=>({__html:u}),[u]),b=p.useRef(l),j=p.useRef(o);return b.current=l,j.current=o,p.useEffect(()=>{let N=!1;return Gd(l).then(k=>{N||f(k)}),()=>{N=!0}},[l]),p.useEffect(()=>{var k;const N=g.current;if(N){for(const w of Array.from(N.querySelectorAll("img"))){if((k=w.parentElement)!=null&&k.classList.contains("md-img"))continue;const E=document.createElement("span");E.className="md-img",E.dataset.src0=w.getAttribute("src")??"",w.replaceWith(E),E.appendChild(w);const C=document.createElement("span");C.className="md-img__grip",C.title="Потяните, чтобы изменить ширину",C.setAttribute("aria-label","Изменить ширину картинки"),E.appendChild(C),fS(C,E,()=>E.querySelector("img"),T=>{var R;const z=Array.from(N.querySelectorAll(".md-img")),q=Pk(b.current),te=q[z.indexOf(E)];if(!te||q.length!==z.length){(R=E.querySelector("img"))==null||R.style.removeProperty("width");return}const I=b.current;j.current(n,I.slice(0,te.from)+Zk(te,T)+I.slice(te.to))})}for(const w of Array.from(N.querySelectorAll(".md-img"))){const E=w.querySelector("img");if(!E)continue;const C=Wk(n,w.dataset.src0??"");let T="ok",z="";if(C.kind==="outside")T="blocked",z=`Путь вне проекта: ${w.dataset.src0}`;else if(C.kind==="project"){const te=i[C.path];if(!te)T="loading",z=`Загружается: ${C.path}`,r(C.path);else if("error"in te)T="missing",z=`Нет файла: ${C.path}`;else{const I=Yk(te);E.getAttribute("src")!==I&&E.setAttribute("src",I)}}w.dataset.state=T,E.hidden=T!=="ok";let q=w.querySelector(".md-img__ph");T==="ok"?q==null||q.remove():(q||(q=document.createElement("span"),q.className="md-img__ph",w.prepend(q)),q.textContent=z)}}},[u,i,n,r]),s.jsxs(s.Fragment,{children:[s.jsx("div",{ref:g,className:"markdown-preview",dangerouslySetInnerHTML:_}),x]})}function gS({files:n,activePath:l,busy:i,onSelect:r,onClose:o,zoomed:u,onToggleZoom:f}){return s.jsxs("div",{className:"worktabs",role:"tablist",onDoubleClick:g=>{f&&(g.target.closest("button")||f())},children:[s.jsxs("button",{className:"worktab"+(l===null?" is-on":""),role:"tab","aria-selected":l===null,onClick:()=>r(null),onDoubleClick:()=>f==null?void 0:f(),children:[s.jsx("span",{className:"worktab__name",children:"Разговор"}),i&&s.jsx("span",{className:"worktab__dot worktab__dot--busy",title:"Агент работает"})]}),n.map(g=>s.jsxs("div",{className:"worktab"+(g.path===l?" is-on":""),role:"tab","aria-selected":g.path===l,onDoubleClick:x=>{f&&(x.target.closest(".worktab__close, .worktab__dot")||f())},children:[s.jsx("button",{className:"worktab__name",title:g.path,onClick:()=>r(g.path),children:fg(g.path)}),ai(g)?s.jsx("button",{className:"worktab__dot",title:"Не сохранено — закрыть","aria-label":`Закрыть ${g.path}`,onClick:()=>o(g.path)}):s.jsx("button",{className:"worktab__close",title:"Закрыть","aria-label":`Закрыть ${g.path}`,onClick:()=>o(g.path),children:"✕"})]},g.path)),s.jsx("div",{className:"worktabs__spacer"}),f&&s.jsx("button",{className:"worktabs__zoom",title:u?"Свернуть — то же самое, что двойной клик по вкладке":"Развернуть на весь экран — то же самое, что двойной клик по вкладке","aria-label":u?"Свернуть колонку разговора":"Развернуть колонку разговора на весь экран","aria-pressed":u,onClick:f,children:s.jsx(ou,{active:u})})]})}function Kl(n){return n.claudeSessionId??n.id}function Dh(n,l,i,r){if(!l||l.length===0)return n;const o=new Map(l.map((g,x)=>[g,x])),u=[],f=[];for(const g of n)(o.has(i(g))?u:f).push(g);return u.sort((g,x)=>o.get(i(g))-o.get(i(x))),r==="top"?[...f,...u]:[...u,...f]}function ty(n){return n.state!=="closed"}function sv(n){return[...n.filter(ty),...n.filter(l=>!ty(l))]}function bh(n,l,i,r){if(l===i||!n.includes(l)||!n.includes(i))return null;const o=n.filter(g=>g!==l),u=o.indexOf(i)+(r==="after"?1:0),f=[...o.slice(0,u),l,...o.slice(u)];return f.every((g,x)=>g===n[x])?null:f}function Bd(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 lv(n){return`${n} ${Bd(n,"агент","агента","агентов")}`}function xS(n){const l=n.filter(o=>o.kind==="agent").length,i=n.length-l,r=[];return l>0&&r.push(lv(l)),i>0&&r.push(`${i} ${Bd(i,"задача","задачи","задач")} в фоне`),r.join(" · ")}function _S(n){switch(n.kind){case"agent":return n.agentType??"агент";case"shell":return"команда";case"workflow":return"сценарий";default:return"задача"}}function bS(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 yS(n){return n<1e3?`${n} ток.`:`${(n/1e3).toFixed(1).replace(".",",")} k ток.`}function vS({tasks:n,onStop:l}){const[i,r]=p.useState(!1),[o,u]=p.useState(()=>Date.now()),[f,g]=p.useState(()=>new Set);p.useEffect(()=>{const _=window.setInterval(()=>u(Date.now()),1e3);return()=>window.clearInterval(_)},[]),p.useEffect(()=>{g(_=>{const b=new Set(n.map(N=>N.id)),j=new Set([..._].filter(N=>b.has(N)));return j.size===_.size?_:j})},[n]);const x=_=>{g(b=>new Set(b).add(_)),l(_),window.setTimeout(()=>{g(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:xS(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=f.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:_S(_)}),_.background&&s.jsx("span",{className:"task__bg",children:"фон"}),s.jsx("span",{className:"task__time",children:bS(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:[yS(_.tokens)," · ",_.toolUses," ",Bd(_.toolUses,"вызов","вызова","вызовов")]})]}),s.jsx("button",{type:"button",className:"btn btn--sm btn--danger task__stop",disabled:b,"aria-label":`Остановить: ${_.description}`,onClick:()=>x(_.id),children:b?"Останавливается":"Стоп"})]},_.id)})})]})}const jS=""+new URL("antigravity-logo-DRKQga2U.png",import.meta.url).href;function Qg({className:n}){return s.jsx("img",{src:jS,alt:"","aria-hidden":"true",className:n,style:{aspectRatio:"200 / 184"}})}function Pg({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 NS=450,kS=6,wS={claude:{label:"Claude",hint:"Claude Code — как обычно"},antigravity:{label:"Antigravity",hint:"Google agy, отдельная палитра и права"},codex:{label:"Codex",hint:"OpenAI Codex, отдельная палитра и права"}};function SS({disabled:n,providers:l,lastAccountId:i,onStart:r,onSignIn:o}){var D;const{accounts:u,auth:f,multi:g}=Dg(),x=["claude","antigravity","codex"].filter(O=>l.includes(O)).flatMap(O=>O==="claude"&&g?u.map(H=>{const J=f[H.id],re=t0(J);return{key:`claude:${H.id}`,id:"claude",label:H.name,hint:re?`Claude Code, ${re}`:"Claude Code",account:H,isDefault:H.id===i,needsLogin:H.id!==Yi&&J!=null&&!J.loggedIn}}):[{key:O,id:O,...wS[O]}]),_=x.length>1,b=x.find(O=>O.isDefault)??x[0],j=Math.max(0,x.indexOf(b)),[N,k]=p.useState(!1),[w,E]=p.useState(0),[C,T]=p.useState({left:0,top:0}),z=p.useRef(null),q=p.useRef(null),te=p.useRef(null);function I(){te.current&&window.clearTimeout(te.current.timer),te.current=null}function R(){I(),E(j),k(!0)}function $(O){var H;k(!1),O&&((H=z.current)==null||H.focus())}function Q(O){if(n||!_||O.button!==0)return;const H={timer:0,x:O.clientX,y:O.clientY,fired:!1};H.timer=window.setTimeout(()=>{H.fired=!0,R()},NS),te.current=H}function ee(O){const H=te.current;!H||H.fired||Math.hypot(O.clientX-H.x,O.clientY-H.y)>kS&&I()}function G(){te.current&&!te.current.fired&&I()}function B(O){var H;if((H=te.current)!=null&&H.fired){te.current=null,O.preventDefault();return}n||b&&ue(b)}function F(O){_&&(O.preventDefault(),!n&&R())}function le(O){if(n||!_)return;(O.key==="ArrowDown"||O.key==="ArrowUp"||O.key==="Enter"&&O.shiftKey)&&(O.preventDefault(),R())}p.useLayoutEffect(()=>{if(!N)return;const O=z.current,H=q.current;if(!O||!H)return;const J=O.getBoundingClientRect(),re=H.getBoundingClientRect(),A=8,V=Math.max(A,Math.min(J.right-re.width,window.innerWidth-re.width-A));let U=J.top-re.height-8;U<A&&(U=Math.min(J.bottom+8,window.innerHeight-re.height-A)),T({left:V,top:U})},[N]),p.useLayoutEffect(()=>{var O;N&&((O=q.current)==null||O.focus())},[N]),p.useLayoutEffect(()=>{if(!N)return;function O(H){var re,A;const J=H.target;!((re=q.current)!=null&&re.contains(J))&&!((A=z.current)!=null&&A.contains(J))&&$(!1)}return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[N]);function ue(O){var H;if($(!1),O.needsLogin&&O.account){o(O.account.id);return}r(O.id,(H=O.account)==null?void 0:H.id)}function ce(O){if(O.key==="Escape"){O.preventDefault(),O.stopPropagation(),$(!0);return}if(O.key==="ArrowDown"||O.key==="ArrowUp"){O.preventDefault();const H=O.key==="ArrowDown"?1:-1;E(J=>(J+H+x.length)%x.length);return}if(O.key==="Enter"||O.key===" "){O.preventDefault();const H=x[w];H&&ue(H);return}O.key==="Tab"&&$(!1)}return s.jsxs("div",{className:"newsession",children:[s.jsxs("button",{ref:z,type:"button",className:"btn btn--primary newsession__btn",disabled:n,title:_?g?`Новая сессия под «${((D=b==null?void 0:b.account)==null?void 0:D.name)??""}». Удерживайте, чтобы выбрать агента или аккаунт`:"Удерживайте, чтобы выбрать агента":void 0,"aria-label":g&&(b!=null&&b.account)?`Новая сессия, аккаунт «${b.account.name}»`:void 0,"aria-haspopup":_?"menu":void 0,"aria-expanded":_?N:void 0,onClick:B,onContextMenu:F,onPointerDown:Q,onPointerMove:ee,onPointerUp:G,onPointerCancel:G,onPointerLeave:G,onKeyDown:le,children:["+ Сессия",g&&(b==null?void 0:b.account)&&s.jsx("span",{className:`newsession__acct acct--${b.account.color}`,"aria-hidden":"true"}),_&&s.jsx(ES,{})]}),N&&_&&s.jsx("div",{ref:q,className:"newsession__menu",style:{left:C.left,top:C.top},role:"menu","aria-label":g?"Выбрать агента и аккаунт для новой сессии":"Выбрать агента для новой сессии",tabIndex:-1,onKeyDown:ce,children:x.map((O,H)=>{var J;return s.jsxs("button",{type:"button",role:"menuitem",className:"newsession__item"+(H===w?" is-cursor":"")+(H>0&&((J=x[H-1])==null?void 0:J.id)!==O.id?" newsession__item--sep":""),onMouseEnter:()=>E(H),onClick:()=>ue(O),children:[O.account?s.jsx("span",{className:"newsession__mark newsession__mark--account",children:s.jsx(Sa,{account:O.account,size:"md"})}):s.jsx("span",{className:`newsession__mark newsession__mark--${O.id}`,"aria-hidden":"true",children:O.id==="antigravity"?s.jsx(Qg,{className:"newsession__mark-logo"}):O.id==="codex"?s.jsx(Pg,{className:"newsession__mark-logo"}):s.jsx(CS,{})}),s.jsxs("span",{className:"newsession__text",children:[s.jsx("span",{className:"newsession__label",children:O.label}),s.jsx("span",{className:"newsession__hint",children:O.hint})]}),O.needsLogin?s.jsx("span",{className:"newsession__tag newsession__tag--login",children:"Войти"}):O.isDefault&&s.jsx("span",{className:"newsession__tag",children:"по клику"})]},O.key)})})]})}function ES(){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 CS(){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 TS=300,AS=3,qp=new Intl.RelativeTimeFormat("ru",{numeric:"auto"});function MS(n){const l=n-Date.now(),i=Math.abs(l),r=6e4;return i<r?"только что":i<60*r?qp.format(Math.round(l/r),"minute"):i<1440*r?qp.format(Math.round(l/(60*r)),"hour"):i<10080*r?qp.format(Math.round(l/(1440*r)),"day"):new Date(n).toLocaleDateString("ru",{day:"numeric",month:"short",year:"numeric"})}function RS({query:n,workspaces:l,results:i,onSearch:r,onOpen:o}){const u=n.trim(),f=u.length>=AS,g=p.useRef(r);if(g.current=r,p.useEffect(()=>{if(!f)return;const b=setTimeout(()=>g.current(u),TS);return()=>clearTimeout(b)},[f,u]),!f)return null;const x=i!==null&&i.query===u,_=x?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:"В разговорах"}),x&&s.jsx("span",{className:"sidebar__count",children:_.length})]}),!x&&s.jsxs("div",{className:"contentsearch__state",children:[s.jsx("span",{className:"contentsearch__spinner","aria-hidden":"true"}),"Ищем в разговорах…"]}),x&&_.length===0&&s.jsx("div",{className:"contentsearch__state",children:"В разговорах ничего не нашлось"}),_.map(b=>{var N,k;const j=((N=l.find(w=>w.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:((k=b.title)==null?void 0:k.trim())||"Без названия"}),b.timestamp!==null&&s.jsx("span",{className:"contentsearch__when",children:MS(b.timestamp)})]}),j&&s.jsx("span",{className:"contentsearch__project",children:j}),s.jsx(DS,{hit:b})]},`${b.workspaceId}:${b.sessionId}`)})]})}function DS({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 av="ccv:sidebar.collapsed",iv="ccv:sidebar.mode",rv="ccv:sidebar.foldersCollapsed",ny="ccv:sidebar.expandedProjects",sy="ccv:sidebar.expandedProjectArchives",cv=500,_g="транскрипт остаётся на диске — сессию можно вернуть из архива в любой момент.";function LS({open:n,connected:l,status:i,workspaces:r,archivedWorkspaces:o,sessionFolders:u,pinnedFolders:f,projectSessions:g,onRequestSessions:x,pinned:_,live:b,listOrder:j,liveSessionsFirst:N,onReorder:k,activeWorkspaceId:w,activeSessionId:E,onSelectWorkspace:C,onRenameSession:T,onStopSession:z,onPinSessions:q,onSelectPinned:te,onCloseWorkspaces:I,onRestoreWorkspaces:R,onUnmarkWorkspaces:$,onArchiveSessions:Q,onUnarchiveSessions:ee,onCreateFolder:G,onRenameFolder:B,onSetFolderColor:F,onAssignToFolder:le,onOpenWorkspace:ue,folderNotice:ce,onDismissFolderNotice:D,onNewSession:O,enabledProviders:H,lastAccountId:J,onSignInAccount:re,onOpenExtensions:A,account:V,onOpenAccount:U,relay:be,onOpenRelay:P,onOpenSettings:ie,onOpenTasks:Me,onOpenSite:Ke,onOpenVideo:Ne,contentResults:Be,onSearchContent:Xe,onOpenContentHit:Ze,themeMode:an,onCycleTheme:We}){var Se;const Bt=Dg(),[Ye,ct]=p.useState(null),[xe,$e]=p.useState(null),[ye,Qe]=p.useState(null);function rn(y){return(ye==null?void 0:ye.folderId)===y.id?ye.color??void 0:y.color}function kt(y){const M=y&&rn(y);return M?{"--folder-color":M}:void 0}const ht=p.useRef(void 0),[_s,On]=p.useState(null),[fn,Mt]=p.useState(null),[zt,Ce]=p.useState(""),[Te,Ie]=p.useState(PS),[st,_t]=p.useState(ZS),[bt,yt]=p.useState(WS),[zn,_e]=p.useState(()=>ay(ny)),[Ae,Je]=p.useState(()=>ay(sy)),[rt,it]=p.useState([]);function en(y){yt(y);try{localStorage.setItem(iv,y)}catch{}}const dt=zt.trim().toLowerCase(),gt=dt!=="",bs=p.useMemo(()=>Dh(r,j==null?void 0:j.workspaces,y=>y.id,"bottom"),[r,j]),In=p.useMemo(()=>{const y=Dh(_,j==null?void 0:j.pinned,Kl,"bottom");return N?sv(y):y},[_,j,N]),As=p.useMemo(()=>Dh(b,j==null?void 0:j.live,Kl,"bottom"),[b,j]),cs=p.useMemo(()=>{const y=new Map,M=new Map;for(const Z of b){const oe=fv(Z);uy(y,Z.workspaceId,oe),Z.folderId&&uy(M,Z.folderId,oe)}return{byWorkspace:y,bySessionFolder:M}},[b]),Cn=y=>y.name.toLowerCase().includes(dt)||y.path.toLowerCase().includes(dt),$n=p.useMemo(()=>gt?bs.filter(y=>{if(Cn(y))return!0;const M=g[y.id];return!!M&&(M.sessions.some(Z=>Od(Z,dt))||M.archived.some(Z=>Od(Z,dt)))}):bs,[bs,g,dt,gt]),Ms=p.useMemo(()=>gt?o.filter(Cn):o,[o,dt,gt]),cn=y=>{var M;return((M=r.find(Z=>Z.id===y))==null?void 0:M.name)??"—"},hn=y=>{var M;return(M=r.find(Z=>Z.id===y))==null?void 0:M.path},ns=p.useMemo(()=>gt?In.filter(y=>(y.title??"").toLowerCase().includes(dt)||cn(y.workspaceId).toLowerCase().includes(dt)):In,[In,r,dt,gt]),mn=p.useMemo(()=>gt?As.filter(y=>(y.title??"").toLowerCase().includes(dt)||cn(y.workspaceId).toLowerCase().includes(dt)):As,[As,r,dt,gt]),Un=!gt;function pn(y){Ie(M=>{const Z=M.includes(y)?M.filter(oe=>oe!==y):[...M,y];try{localStorage.setItem(av,JSON.stringify(Z))}catch{}return Z})}const Tt=y=>!Te.includes(y);function gn(y){_t(M=>{const Z=M.includes(y)?M.filter(oe=>oe!==y):[...M,y];try{localStorage.setItem(rv,JSON.stringify(Z))}catch{}return Z})}const os=y=>!st.includes(y);function us(y,M){_e(Z=>{if(Z.includes(y)===M)return Z;const oe=M?[...Z,y]:Z.filter(Oe=>Oe!==y);return iy(ny,oe),oe})}function Hs(y){Je(M=>{const Z=M.includes(y)?M.filter(oe=>oe!==y):[...M,y];return iy(sy,Z),Z})}p.useEffect(()=>{w&&us(w,!0)},[w]),p.useEffect(()=>it(y=>y.length?[]:y),[dt]);const xl=p.useRef(new Set);p.useEffect(()=>{if(!l){xl.current.clear();return}for(const y of zn)xl.current.has(y)||!r.some(M=>M.id===y)||(xl.current.add(y),y!==w&&x(y))},[l,zn,r,w]);function _l(y){const M=g[y.id],Z=!gt||Cn(y),oe=!Z,Oe=oe?!rt.includes(y.id):zn.includes(y.id),Le=M?Z?M.sessions.length:M.sessions.filter(tt=>Od(tt,dt)).length:void 0;return{entry:M,showAll:Z,forced:oe,open:Oe,count:Le}}function At(y,M){if(M.forced){it(Z=>Z.includes(y.id)?Z.filter(oe=>oe!==y.id):[...Z,y.id]);return}us(y.id,!M.open)}function Rs(y,M){At(y,M),!M.open&&y.id!==w&&C(y.id)}const Bn=p.useMemo(()=>yg(ns,f,y=>y.pinnedFolderId,!gt),[ns,f,gt]),K=p.useMemo(()=>({groups:[],ungrouped:mn}),[mn]),ge=((j==null?void 0:j.workspaces.length)??0)>0,Re=((j==null?void 0:j.pinned.length)??0)>0,He=((j==null?void 0:j.live.length)??0)>0,wt=Oh({enabled:Un,scope:"workspaces",itemKey:y=>y.id,groups:YS,ungrouped:$n,onReorder:k}),on=Oh({enabled:Un,scope:"pinned",itemKey:Kl,groups:Bn.groups,ungrouped:Bn.ungrouped,onReorder:k}),Dt=Oh({enabled:Un,scope:"live",itemKey:Kl,groups:K.groups,ungrouped:K.ungrouped,onReorder:k});p.useEffect(()=>{if(!ye)return;const y=[...f,...u].find(M=>M.id===ye.folderId);y&&y.color===(ye.color??void 0)&&Qe(null)},[ye,f,u]),p.useEffect(()=>()=>window.clearTimeout(ht.current),[]);const Hn=jg($n),Tn=jg(Ms),[Lt,qs]=p.useState(null),[xn,bl]=p.useState(null),[yl,Qn]=p.useState(null),[Xt,Ta]=p.useState(null),[ys,Zl]=p.useState(null),vs=p.useRef(null);function ss(y,M){const Z=y.touches[0];if(!Z)return;const oe={timer:0,x:Z.clientX,y:Z.clientY,el:y.currentTarget,fired:!1};oe.timer=window.setTimeout(()=>{oe.fired=!0,M(oe.x,oe.y,oe.el)},cv),vs.current=oe}function tl(y){const M=vs.current,Z=y.touches[0];!M||!Z||Math.hypot(Z.clientX-M.x,Z.clientY-M.y)>10&&(window.clearTimeout(M.timer),vs.current=null)}function tn(y){const M=vs.current;M&&(window.clearTimeout(M.timer),M.fired&&y.preventDefault())}function Gs(){var y;return(y=vs.current)!=null&&y.fired?(vs.current=null,!0):!1}function ui(){const y=Lt==null?void 0:Lt.opener;qs(null),y!=null&&y.isConnected&&y.focus()}function Wl(){const y=xn==null?void 0:xn.opener;bl(null),y!=null&&y.isConnected&&y.focus()}function ds(){const y=Xt==null?void 0:Xt.opener;Ta(null),y!=null&&y.isConnected&&y.focus()}function Jl(){const y=ys==null?void 0:ys.opener;Zl(null),y!=null&&y.isConnected&&y.focus()}function ea(y){return{onContextMenu:M=>{M.preventDefault(),qs({x:M.clientX,y:M.clientY,opener:M.currentTarget,ids:Hn.targetsFor(y)})},onTouchStart:M=>ss(M,(Z,oe,Oe)=>qs({x:Z,y:oe,opener:Oe,ids:Hn.targetsFor(y)})),onTouchMove:tl,onTouchEnd:tn,onTouchCancel:tn}}function Ys(y){return{onContextMenu:M=>{M.preventDefault(),bl({x:M.clientX,y:M.clientY,opener:M.currentTarget,ids:Tn.targetsFor(y)})},onTouchStart:M=>ss(M,(Z,oe,Oe)=>bl({x:Z,y:oe,opener:Oe,ids:Tn.targetsFor(y)})),onTouchMove:tl,onTouchEnd:tn,onTouchCancel:tn}}function fs(y){return{onContextMenu:M=>{M.preventDefault(),Ta({x:M.clientX,y:M.clientY,opener:M.currentTarget,ids:[y.id]})},onTouchStart:M=>ss(M,(Z,oe,Oe)=>Ta({x:Z,y:oe,opener:Oe,ids:[y.id]})),onTouchMove:tl,onTouchEnd:tn,onTouchCancel:tn}}function nl(y){return{onContextMenu:M=>{M.preventDefault(),Zl({x:M.clientX,y:M.clientY,opener:M.currentTarget,ids:[y.id]})},onTouchStart:M=>ss(M,(Z,oe,Oe)=>Zl({x:Z,y:oe,opener:Oe,ids:[y.id]})),onTouchMove:tl,onTouchEnd:tn,onTouchCancel:tn}}const Pn=((w?(Se=g[w])==null?void 0:Se.sessions:void 0)??[]).filter(y=>y.state!=="closed").length,ta=Lt?[{id:"close",label:Lt.ids.length>1?`Закрыть проекты (${Lt.ids.length})`:"Закрыть проект",onSelect:()=>{I(Lt.ids),Hn.clear()}},...Lt.ids.length===1?[{id:"new-session-folder",label:"Новая папка сессий",onSelect:()=>{const y=Lt.ids[0];us(y,!0),Mt(y)}}]:[],...Lt.ids.length===1?[{id:"unmark",label:"Убрать из ccv",onSelect:()=>Qn(Lt.ids[0])}]:[],...Lt.ids.length===1&&Un?wt.menuItems(Lt.ids[0],ge):[]]:[],Rl=Lt?"закрытие не удаляет проект: каталог и история сессий остаются на диске — открыть его снова можно кнопкой «+ Проект»."+(w&&Lt.ids.includes(w)&&Pn>0?` в нём сейчас незавершённых сессий: ${Pn} — при закрытии они остановятся на хосте.`:""):void 0,Zi=xn?[{id:"restore",label:xn.ids.length>1?`Вернуть проекты (${xn.ids.length})`:"Вернуть проект",onSelect:()=>{R(xn.ids),Tn.clear()}},...xn.ids.length===1?[{id:"unmark",label:"Убрать из ccv",onSelect:()=>Qn(xn.ids[0])}]:[]]:[],na=xn?"каталог и история сессий всё это время оставались на диске — восстановление их не трогает.":void 0,xt=Xt?ns.find(y=>y.id===Xt.ids[0]):void 0,sa=Xt?[{id:"rename",label:"Переименовать",onSelect:()=>ct(Xt.ids[0])},{id:"unpin",label:"Открепить",onSelect:()=>{xt&&q(xt.workspaceId,[xt.id],!1)}},{id:"archive",label:"Убрать в архив",onSelect:()=>{xt&&Q(xt.workspaceId,[xt.id])}},...xt&&xt.workspaceId===w?vg({folders:u.filter(y=>y.workspaceId===xt.workspaceId),ids:[xt.id],hasFolder:xt.folderId!=null,assign:(y,M)=>le("session",y,M,xt.workspaceId),onClear:()=>{},onNewFolder:()=>{us(xt.workspaceId,!0),Mt(xt.workspaceId)}}):[],...US(xt?vg({folders:f,ids:[xt.id],hasFolder:xt.pinnedFolderId!=null,assign:(y,M)=>le("pinned",y,M),onClear:()=>{},onNewFolder:()=>On("pinned")}):[]),...Un&&xt?on.menuItems(Kl(xt),Re):[]]:[],Nn=ys?mn.find(y=>y.id===ys.ids[0]):void 0,Dl=ys?[{id:"stop",label:"Остановить",onSelect:()=>{Nn&&z(Nn)}},{id:"rename",label:"Переименовать",onSelect:()=>ct(ys.ids[0])},{id:"pin",label:(Nn==null?void 0:Nn.pinned)===!0?"Открепить":"Закрепить",onSelect:()=>{Nn&&q(Nn.workspaceId,[Nn.id],Nn.pinned!==!0)}},{id:"archive",label:"Убрать в архив",onSelect:()=>{Nn&&Q(Nn.workspaceId,[Nn.id])}},...Un&&Nn?Dt.menuItems(Kl(Nn),He):[]]:[],js={start:ss,move:tl,end:tn,consumed:Gs};function qn(y,M){return s.jsxs("div",{className:"row row--confirm",style:Xh(M),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:()=>Qn(null),children:"Отмена"}),s.jsx("button",{type:"button",className:"btn btn--danger btn--sm",autoFocus:!0,onClick:()=>{Qn(null),$([y.id])},children:"Убрать из ccv"})]})]},y.id)}function di(y){var Oe,Le;if(yl===y.id)return qn(y,0);const Z=_l(y),oe=`ws-branch-${y.id}`;return s.jsxs(p.Fragment,{children:[s.jsxs("div",{"data-row-key":y.id,"data-row-scope":"workspaces",className:Vo(y.id===w,Hn.selected.includes(y.id))+" row--project"+wt.dropClass(y.id),style:Vr(0),...ea(y),children:[Un&&s.jsx("button",{type:"button",className:"row__grip",title:"Перетащить, чтобы изменить порядок","aria-label":"Перетащить проект на другое место в списке",...wt.gripHandlers(y.id),children:s.jsx(zh,{})}),s.jsx("button",{type:"button",className:"row__chev","aria-expanded":Z.open,"aria-controls":oe,"aria-label":`${Z.open?"Свернуть":"Развернуть"} проект «${y.name}»`,title:Z.open?"Свернуть сессии проекта":"Показать сессии проекта",onClick:()=>{Gs()||Rs(y,Z)},children:s.jsx(lm,{open:Z.open})}),s.jsxs("button",{className:"row__main",onClick:tt=>{Gs()||Hn.click(tt,y,()=>{C(y.id),us(y.id,!0)})},onKeyDown:tt=>wt.onKeyDown(y.id,tt),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(hv,{agg:cs.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:oe,role:"group","aria-label":`Сессии проекта «${y.name}»`,className:"tree__branch",style:Vr(0),children:s.jsx(OS,{workspace:y,baseDepth:1,loaded:Z.entry!==void 0,sessions:((Oe=Z.entry)==null?void 0:Oe.sessions)??ly,archived:((Le=Z.entry)==null?void 0:Le.archived)??ly,folders:u.filter(tt=>tt.workspaceId===y.id),needle:dt,showAll:Z.showAll,reorderEnabled:Un,listOrder:j,liveSessionsFirst:N,activeSessionId:E,archiveExpanded:Ae.includes(y.id),onToggleArchive:()=>Hs(y.id),creatingFolder:fn===y.id,onStartCreateFolder:()=>Mt(y.id),onFinishCreateFolder:()=>Mt(null),renamingId:Ye,setRenamingId:ct,renderFolderHead:hs,liveInFolder:cs.bySessionFolder,isFolderOpen:os,folderRowStyle:kt,longPress:js,onOpenSession:te,onRenameSession:T,onPinSessions:q,onArchiveSessions:Q,onUnarchiveSessions:ee,onCreateFolder:G,onAssignToFolder:le,onReorder:k})})]},y.id)}function sl(y){return yl===y.id?qn(y,0):s.jsxs("div",{className:Vo(y.id===w,Tn.selected.includes(y.id)),...Ys(y),children:[s.jsxs("button",{className:"row__main",onClick:M=>{Gs()||Tn.click(M,y,()=>C(y.id))},children:[s.jsxs("span",{className:"row__title",children:[y.name,y.hasClaudeMd&&" ·"]}),s.jsx("span",{className:"row__meta",children:aE(y)})]}),s.jsx("button",{className:"row__restore",title:"Вернуть проект из архива",onClick:()=>R([y.id]),children:"Вернуть"})]},y.id)}function Vs(y,M){const Z=Kl(y);return s.jsxs("div",{"data-row-key":Z,"data-row-scope":"pinned",className:Vo(y.id===E,!1,y.provider,!!M,!0)+on.dropClass(Z),style:kt(M),...Ye===y.id?{}:{title:"Действия со строкой — правый клик или долгое нажатие",...fs(y)},children:[bg(M),Ye===y.id?s.jsx("div",{className:"row__main",children:s.jsx(Pi,{value:y.title??"",onCommit:oe=>{T(y,oe),ct(null)},onCancel:()=>ct(null)})}):s.jsxs(s.Fragment,{children:[Un&&s.jsx("button",{type:"button",className:"row__grip",title:"Перетащить, чтобы изменить порядок","aria-label":"Перетащить сессию, чтобы изменить порядок в списке",...on.gripHandlers(Z),children:s.jsx(zh,{})}),s.jsx("button",{className:"row__main row__main--session",onClick:()=>{Gs()||te(y)},onKeyDown:oe=>on.onKeyDown(Z,oe),children:s.jsx(Kh,{session:y,pinned:!1,projectName:cn(y.workspaceId),projectPath:hn(y.workspaceId)})})]})]},y.id)}function ls(y){const M=Kl(y);return s.jsx("div",{"data-row-key":M,"data-row-scope":"live",className:Vo(y.id===E,!1,y.provider,!1,!0)+Dt.dropClass(M),...Ye===y.id?{}:{title:"Действия со строкой — правый клик или долгое нажатие",...nl(y)},children:Ye===y.id?s.jsx("div",{className:"row__main",children:s.jsx(Pi,{value:y.title??"",onCommit:Z=>{T(y,Z),ct(null)},onCancel:()=>ct(null)})}):s.jsxs(s.Fragment,{children:[Un&&s.jsx("button",{type:"button",className:"row__grip",title:"Перетащить, чтобы изменить порядок","aria-label":"Перетащить сессию, чтобы изменить порядок в списке",...Dt.gripHandlers(M),children:s.jsx(zh,{})}),s.jsx("button",{className:"row__main row__main--session",onClick:()=>{Gs()||te(y)},onKeyDown:Z=>Dt.onKeyDown(M,Z),children:s.jsx(Kh,{session:y,pinned:y.pinned===!0,projectName:cn(y.workspaceId),projectPath:hn(y.workspaceId)})}),s.jsx("button",{type:"button",className:"row__stop",title:"Остановить сессию","aria-label":"Остановить сессию",onClick:Z=>{Z.stopPropagation(),!Gs()&&z(y)},children:s.jsx(FS,{})})]})},y.id)}function hs(y,M,Z={}){return s.jsx(qS,{folder:y,count:M,live:Z.live,depth:Z.depth??0,open:os(y.id),renaming:xe===y.id,onToggle:()=>gn(y.id),onStartRename:()=>$e(y.id),onCommitRename:oe=>{B(y.id,oe),$e(null)},onCancelRename:()=>$e(null),color:rn(y),onPreviewColor:oe=>{window.clearTimeout(ht.current),Qe({folderId:y.id,color:oe})},onCommitColor:oe=>{Qe({folderId:y.id,color:oe}),F(y.id,oe),window.clearTimeout(ht.current),ht.current=window.setTimeout(()=>Qe(null),4e3)},onResetColor:()=>{window.clearTimeout(ht.current),Qe(null),F(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:`Тема: ${ry[an]}`,"aria-label":`Тема: ${ry[an]}. Переключить`,onClick:We,children:s.jsx(JS,{mode:an})})]}),s.jsxs("div",{className:"sidebar__tabs",role:"tablist","aria-label":"Что показывать в списке",children:[s.jsx("button",{type:"button",role:"tab","aria-selected":bt==="default",className:bt==="default"?"sidebar__tab is-active":"sidebar__tab",onClick:()=>en("default"),children:s.jsx("span",{className:"sidebar__tab-label",children:"Все"})}),s.jsx("button",{type:"button",role:"tab","aria-selected":bt==="pinned",className:bt==="pinned"?"sidebar__tab is-active":"sidebar__tab",onClick:()=>en("pinned"),children:s.jsx("span",{className:"sidebar__tab-label",children:"Закреплённые"})}),s.jsxs("button",{type:"button",role:"tab","aria-selected":bt==="live",className:bt==="live"?"sidebar__tab is-active":"sidebar__tab",onClick:()=>en("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(KS,{}),s.jsx("input",{className:"fssearch__input",type:"text",value:zt,spellCheck:!1,placeholder:"Проект или сессия…","aria-label":"Поиск по проектам и сессиям",onChange:y=>Ce(y.target.value),onKeyDown:y=>{y.stopPropagation(),y.key==="Escape"&&(y.preventDefault(),zt?Ce(""):y.currentTarget.blur())}}),zt&&s.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>Ce(""),children:"✕"})]}),s.jsxs("div",{className:"sidebar__scroll",children:[ce&&s.jsxs("div",{className:"sidebar__notice",role:"alert",children:[s.jsx("span",{children:ce}),s.jsx("button",{type:"button",className:"sidebar__notice-close","aria-label":"Закрыть сообщение",onClick:D,children:"✕"})]}),bt==="pinned"?s.jsxs(s.Fragment,{children:[s.jsx(yh,{title:"Закреплённые",count:ns.length,open:Tt("pinned"),onToggle:()=>pn("pinned"),action:{label:"Новая папка закреплённых",onClick:()=>{On("pinned"),Tt("pinned")||pn("pinned")}}}),Tt("pinned")&&s.jsxs(s.Fragment,{children:[_s==="pinned"&&s.jsx("div",{className:"row",children:s.jsx("div",{className:"row__main",children:s.jsx(Pi,{value:"",placeholder:"Название папки",onCommit:y=>{G("pinned",y),On(null)},onCancel:()=>On(null)})})}),ns.length===0&&s.jsx("div",{className:"row",children:s.jsx("span",{className:"row__meta row__meta--wrap",children:gt?"Ничего не найдено":"закрепите сессию через её меню (правый клик или долгое нажатие) — она останется под рукой из любого проекта"})}),Bn.groups.map(y=>s.jsxs(p.Fragment,{children:[hs(y.folder,y.items.length),os(y.folder.id)&&y.items.map(M=>Vs(M,y.folder))]},y.folder.id)),Bn.ungrouped.map(y=>Vs(y))]})]}):bt==="live"?s.jsxs(s.Fragment,{children:[s.jsx(yh,{title:"Запущенные",count:mn.length,open:Tt("live"),onToggle:()=>pn("live")}),Tt("live")&&s.jsxs(s.Fragment,{children:[mn.length===0&&s.jsx("div",{className:"row",children:s.jsx("span",{className:"row__meta",children:gt?"Ничего не найдено":"Нет запущенных сессий"})}),mn.map(y=>ls(y))]})]}):s.jsxs(s.Fragment,{children:[s.jsx(yh,{title:"Проекты",count:$n.length,open:Tt("workspaces"),onToggle:()=>pn("workspaces")}),Tt("workspaces")&&s.jsxs(s.Fragment,{children:[$n.length===0&&s.jsx("div",{className:"row",children:s.jsx("span",{className:"row__meta",children:gt?"Ничего не найдено":"Пока ни одного — добавьте проект кнопкой «+ Проект»"})}),$n.map(y=>di(y))]}),o.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(yh,{title:"Архив проектов",count:Ms.length,open:Tt("workspacesArchive"),onToggle:()=>pn("workspacesArchive"),hint:"проект закрывают вручную; каталог и история сессий остаются на диске и открываются заново отсюда или через «+ Проект»"}),Tt("workspacesArchive")&&s.jsxs(s.Fragment,{children:[Ms.length===0&&s.jsx("div",{className:"row",children:s.jsx("span",{className:"row__meta",children:gt?"Ничего не найдено":"Пока пусто"})}),Ms.map(y=>sl(y))]})]})]}),s.jsx(RS,{query:zt,workspaces:r,results:Be,onSearch:Xe,onOpen:Ze})]}),s.jsxs("div",{className:"sidebar__foot",children:[Bt.multi?s.jsxs("button",{className:"account-btn",title:"Аккаунты Claude",onClick:U,children:[s.jsx("span",{className:"account-btn__marks",children:Bt.accounts.map(y=>{var Z;const M=((Z=Bt.auth[y.id])==null?void 0:Z.loggedIn)===!1;return s.jsx("span",{className:M?"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"}),Bt.accounts.some(y=>{var M;return((M=Bt.auth[y.id])==null?void 0:M.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:V!=null&&V.loggedIn?"dot dot--on":"dot"}),s.jsx("span",{className:"account-btn__id",children:V===null?"Аккаунт":V.loggedIn?V.email||"Вход выполнен":"Войти в аккаунт"}),(V==null?void 0:V.plan)&&s.jsx("span",{className:"chip",children:V.plan})]}),P&&s.jsxs("button",{className:"account-btn",title:"Доступ с телефона и из браузера",onClick:P,children:[s.jsx("span",{className:be!=null&&be.connected?"dot dot--on":"dot"}),s.jsx("span",{className:"account-btn__id",children:be===null?"Удалённый доступ":be.paired?be.connected?be.name||"Удалённый доступ включён":"Удалённый доступ · нет связи":"Удалённый доступ"}),(be==null?void 0:be.connected)&&be.clients>0&&s.jsx("span",{className:"chip",children:be.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:ie,children:"Настройки"}),s.jsx("button",{className:"btn btn--ghost sidebar__tasks",title:"Запланированные задачи","aria-label":"Запланированные задачи",onClick:Me,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:!w,title:"Страница сайта с выбором элементов и правками",onClick:Ke,children:"Сайт"}),s.jsx("button",{className:"btn btn--ghost",disabled:!w,title:"Видео, Remotion и анимации проекта",onClick:Ne,children:"Видео"})]}),s.jsxs("div",{className:"sidebar__foot-row",children:[s.jsx("button",{className:"btn btn--ghost",onClick:ue,children:"+ Проект"}),s.jsx(SS,{disabled:!w,providers:H,lastAccountId:J,onStart:O,onSignIn:re})]})]}),Lt&&s.jsx(Qi,{x:Lt.x,y:Lt.y,items:ta,note:Rl,onClose:ui}),xn&&s.jsx(Qi,{x:xn.x,y:xn.y,items:Zi,note:na,onClose:Wl}),Xt&&s.jsx(Qi,{x:Xt.x,y:Xt.y,items:sa,note:_g,onClose:ds}),ys&&s.jsx(Qi,{x:ys.x,y:ys.y,items:Dl,note:_g,onClose:Jl})]})}const ly=[];function Od(n,l){return(n.title??"").toLowerCase().includes(l)}function bg(n){return n?s.jsx("span",{className:"row__stripe","aria-hidden":"true"}):null}function Vr(n,l){return{"--depth":n,...l}}function OS({workspace:n,baseDepth:l,loaded:i,sessions:r,archived:o,folders:u,needle:f,showAll:g,reorderEnabled:x,listOrder:_,liveSessionsFirst:b,activeSessionId:j,archiveExpanded:N,onToggleArchive:k,creatingFolder:w,onStartCreateFolder:E,onFinishCreateFolder:C,renamingId:T,setRenamingId:z,renderFolderHead:q,liveInFolder:te,isFolderOpen:I,folderRowStyle:R,longPress:$,onOpenSession:Q,onRenameSession:ee,onPinSessions:G,onArchiveSessions:B,onUnarchiveSessions:F,onCreateFolder:le,onAssignToFolder:ue,onReorder:ce}){var $e;const D=n.id,O=f!=="",H=p.useMemo(()=>{const ye=Dh(r,_==null?void 0:_.sessions[D],Kl,"top");return b?sv(ye):ye},[r,_,D,b]),J=p.useMemo(()=>g?H:H.filter(ye=>Od(ye,f)),[H,g,f]),re=p.useMemo(()=>g?o:o.filter(ye=>Od(ye,f)),[o,g,f]),A=p.useMemo(()=>yg(J,u,void 0,!O),[J,u,O]),V=p.useMemo(()=>yg(re,u),[re,u]),U=((($e=_==null?void 0:_.sessions[D])==null?void 0:$e.length)??0)>0,be=Oh({enabled:x,scope:"sessions",workspaceId:D,itemKey:Kl,groups:A.groups,ungrouped:A.ungrouped,onReorder:ce}),P=jg(J),[ie,Me]=p.useState(null),[Ke,Ne]=p.useState(!1);p.useEffect(()=>Ne(!1),[f]);const Be=O&&re.length>0,Xe=Be?!Ke:N;function Ze(){const ye=ie==null?void 0:ie.opener;Me(null),ye!=null&&ye.isConnected&&ye.focus()}function an(ye){return{onContextMenu:Qe=>{Qe.preventDefault(),Me({x:Qe.clientX,y:Qe.clientY,opener:Qe.currentTarget,ids:P.targetsFor(ye)})},onTouchStart:Qe=>$.start(Qe,(rn,kt,ht)=>Me({x:rn,y:kt,opener:ht,ids:P.targetsFor(ye)})),onTouchMove:$.move,onTouchEnd:$.end,onTouchCancel:$.end}}const We=ie?J.find(ye=>ye.id===ie.ids[0]):void 0,Bt=(We==null?void 0:We.pinned)!==!0,Ye=ie?[...ie.ids.length===1?[{id:"rename",label:"Переименовать",onSelect:()=>z(ie.ids[0])}]:[],{id:"pin",label:Bt?ie.ids.length>1?`Закрепить (${ie.ids.length})`:"Закрепить":ie.ids.length>1?`Открепить (${ie.ids.length})`:"Открепить",onSelect:()=>{G(D,ie.ids,Bt),P.clear()}},{id:"archive",label:ie.ids.length>1?`Убрать в архив (${ie.ids.length})`:"Убрать в архив",onSelect:()=>{B(D,ie.ids),P.clear()}},...vg({folders:u,ids:ie.ids,hasFolder:(We==null?void 0:We.folderId)!=null,assign:(ye,Qe)=>ue("session",ye,Qe,D),onClear:()=>P.clear(),onNewFolder:E}),...ie.ids.length===1&&x&&We?be.menuItems(Kl(We),U):[]]:[];function ct(ye,Qe,rn){const kt=Kl(ye);return s.jsxs("div",{"data-row-key":kt,"data-row-scope":"sessions",className:Vo(ye.id===j,P.selected.includes(ye.id),ye.provider,!!rn,!0)+be.dropClass(kt),style:Vr(Qe,R(rn)),...T===ye.id?{}:an(ye),children:[bg(rn),T===ye.id?s.jsx("div",{className:"row__main",children:s.jsx(Pi,{value:ye.title??"",onCommit:ht=>{ee(ye,ht),z(null)},onCancel:()=>z(null)})}):s.jsxs(s.Fragment,{children:[x&&s.jsx("button",{type:"button",className:"row__grip",title:"Перетащить, чтобы изменить порядок","aria-label":"Перетащить сессию, чтобы изменить порядок в списке",...be.gripHandlers(kt),children:s.jsx(zh,{})}),s.jsx("button",{className:"row__main row__main--session",onClick:ht=>{$.consumed()||P.click(ht,ye,()=>Q(ye))},onKeyDown:ht=>be.onKeyDown(kt,ht),children:s.jsx(Kh,{session:ye,pinned:ye.pinned===!0})}),s.jsx("button",{className:"row__edit",title:"Переименовать","aria-label":"Переименовать сессию",onClick:()=>{$.consumed()||z(ye.id)},children:"✎"})]})]},ye.id)}function xe(ye,Qe,rn){return s.jsxs("div",{className:Vo(ye.id===j,!1,ye.provider,!!rn,!0),style:Vr(Qe,R(rn)),children:[bg(rn),s.jsx("button",{className:"row__main row__main--session",onClick:()=>Q(ye),children:s.jsx(Kh,{session:ye,pinned:!1,archived:!0})}),s.jsx("button",{className:"row__restore",title:"Вернуть сессию из архива",onClick:()=>F(D,[ye.id]),children:"Вернуть"})]},ye.id)}return s.jsxs(s.Fragment,{children:[w&&s.jsx("div",{className:"row row--hint",style:Vr(l,void 0),children:s.jsx("div",{className:"row__main",children:s.jsx(Pi,{value:"",placeholder:"Название папки",onCommit:ye=>{le("session",ye,D),C()},onCancel:C})})}),i?J.length===0&&s.jsx("div",{className:"row row--hint",style:Vr(l,void 0),children:s.jsx("span",{className:"row__meta",children:"Пока ни одной"})}):s.jsx("div",{className:"row row--hint",style:Vr(l,void 0),"aria-busy":"true",children:s.jsx("span",{className:"row__meta",children:"Загрузка…"})}),A.groups.map(ye=>s.jsxs(p.Fragment,{children:[q(ye.folder,ye.items.length,{depth:l,live:te.get(ye.folder.id)}),I(ye.folder.id)&&ye.items.map(Qe=>ct(Qe,l+1,ye.folder))]},ye.folder.id)),A.ungrouped.map(ye=>ct(ye,l)),i&&o.length>0&&(!O||re.length>0)&&s.jsxs(s.Fragment,{children:[s.jsx(zS,{title:"Архив",count:re.length,open:Xe,depth:l,hint:"сессии без обращения дольше двух суток уезжают сюда сами; ничего не удаляется",onToggle:()=>Be?Ne(ye=>!ye):k()}),Xe&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"row row--hint",style:Vr(l,void 0),children:s.jsx("span",{className:"row__meta",children:"сюда сами уезжают сессии без обращения дольше двух суток; транскрипт остаётся на диске, ничего не удаляется"})}),V.groups.map(ye=>s.jsxs(p.Fragment,{children:[q(ye.folder,ye.items.length,{depth:l}),I(ye.folder.id)&&ye.items.map(Qe=>xe(Qe,l+1,ye.folder))]},ye.folder.id)),V.ungrouped.map(ye=>xe(ye,l))]})]}),ie&&s.jsx(Qi,{x:ie.x,y:ie.y,items:Ye,note:_g,onClose:Ze})]})}function zS({title:n,count:l,open:i,depth:r,hint:o,onToggle:u}){const f=i?`Свернуть «${n}»`:`Развернуть «${n}»`;return s.jsx("div",{className:"row",style:Xh(r),children:s.jsxs("button",{className:"row__main",style:ov,"aria-expanded":i,title:`${f} — ${o}`,onClick:u,children:[s.jsx(lm,{open:i}),s.jsx("span",{style:dv,children:n}),s.jsx("span",{className:"sidebar__count",children:l})]})})}function Vo(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 yg(n,l,i=o=>o.folderId,r=!1){const o=new Map(l.map(x=>[x.id,x])),u=new Map,f=[];for(const x of n){const _=i(x),b=_?o.get(_):void 0;if(!b){f.push(x);continue}const j=u.get(b.id);j?j.push(x):u.set(b.id,[x])}if(r)for(const x of l)u.has(x.id)||u.set(x.id,[]);return{groups:[...u.entries()].map(([x,_])=>({folder:o.get(x),items:_})).sort((x,_)=>x.folder.name.localeCompare(_.folder.name,"ru")),ungrouped:f}}function IS(n,l,i){return[...n.flatMap(r=>r.items.map(i)),...l.map(i)]}const Lh="\0ungrouped";function $S(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),Lh);return r}function Gp(n,l,i,r,o){const u=[...l.map(g=>g.items),i].find(g=>g.some(x=>r(x)===n));if(!u)return null;const f=u.findIndex(g=>r(g)===n);return o==="up"?f<=0?null:{target:r(u[f-1]),position:"before"}:f===-1||f>=u.length-1?null:{target:r(u[f+1]),position:"after"}}function Oh(n){const[l,i]=p.useState(null),[r,o]=p.useState(null),[u,f]=p.useState(null),g=n.onMoveToGroup,x=p.useMemo(()=>IS(n.groups,n.ungrouped,n.itemKey),[n.groups,n.ungrouped,n.itemKey]),_=p.useMemo(()=>$S(n.groups,n.ungrouped,n.itemKey),[n.groups,n.ungrouped,n.itemKey]),b=p.useRef({raf:0,el:null,x:0,y:0}),j=p.useRef(()=>{});function N(){window.cancelAnimationFrame(b.current.raf),b.current.raf=0,b.current.el=null}function k(B){N();const F=b.current;if(F.el=B.closest(".sidebar__scroll"),!F.el)return;const le=56,ue=16,ce=()=>{const D=F.el;if(!D)return;const O=D.getBoundingClientRect();let H=0;if(F.y<O.top+le?H=-ue*Math.min(1,(O.top+le-F.y)/le):F.y>O.bottom-le&&(H=ue*Math.min(1,(F.y-(O.bottom-le))/le)),H!==0){const J=D.scrollTop;D.scrollTop=J+H,D.scrollTop!==J&&j.current(F.x,F.y)}F.raf=window.requestAnimationFrame(ce)};F.raf=window.requestAnimationFrame(ce)}p.useEffect(()=>N,[]);function w(){N(),i(null),o(null),f(null)}function E(B,F){n.enabled&&(F.preventDefault(),F.currentTarget.setPointerCapture(F.pointerId),b.current.x=F.clientX,b.current.y=F.clientY,k(F.currentTarget),i(B),o(null),f(null))}function C(B,F){if(!l)return;const le=document.elementFromPoint(B,F),ue=_.get(l);if(g){const re=le==null?void 0:le.closest("[data-drop-folder]"),A=re?null:le==null?void 0:le.closest("[data-drop-zone]");if(re||A){const V=re?re.dataset.dropFolder:null,U=V??Lh;o(null),f(U===ue?null:{folderId:V});return}}const ce=le==null?void 0:le.closest("[data-row-key]"),D=(ce==null?void 0:ce.dataset.rowScope)===n.scope?ce.dataset.rowKey:void 0,O=D?_.get(D):void 0;if(f(null),!D||D===l||O===void 0||!g&&O!==ue){o(null);return}const H=ce.getBoundingClientRect(),J=F-H.top<H.height/2?"before":"after";o(re=>(re==null?void 0:re.key)===D&&re.position===J?re:{key:D,position:J})}j.current=C;function T(B){b.current.x=B.clientX,b.current.y=B.clientY,C(B.clientX,B.clientY)}function z(){if(l&&u&&g)g(l,{folderId:u.folderId,order:null});else if(l&&r){const B=bh(x,l,r.key,r.position),F=_.get(r.key);g&&F!==_.get(l)?g(l,{folderId:F===Lh?null:F??null,order:B}):B&&n.onReorder(n.scope,B,n.workspaceId)}w()}function q(B,F){if(!n.enabled)return;const le=Gp(B,n.groups,n.ungrouped,n.itemKey,F);if(!le)return;const ue=bh(x,B,le.target,le.position);ue&&n.onReorder(n.scope,ue,n.workspaceId)}function te(B,F){const le=Gp(B,n.groups,n.ungrouped,n.itemKey,"up"),ue=Gp(B,n.groups,n.ungrouped,n.itemKey,"down"),ce=[{id:"move-up",label:"Переместить выше",disabled:!le,onSelect:()=>{if(!le)return;const D=bh(x,B,le.target,le.position);D&&n.onReorder(n.scope,D,n.workspaceId)}},{id:"move-down",label:"Переместить ниже",disabled:!ue,onSelect:()=>{if(!ue)return;const D=bh(x,B,ue.target,ue.position);D&&n.onReorder(n.scope,D,n.workspaceId)}}];return F&&ce.push({id:"reset-order",label:"Сбросить порядок",onSelect:()=>n.onReorder(n.scope,null,n.workspaceId)}),ce}function I(B){return l===B?" row--dragging":(r==null?void 0:r.key)===B?r.position==="before"?" row--drop-before":" row--drop-after":""}function R(B){return{onPointerDown:F=>E(B,F),onPointerMove:T,onPointerUp:z,onPointerCancel:w,onLostPointerCapture:w}}function $(B,F){!F.altKey||F.key!=="ArrowUp"&&F.key!=="ArrowDown"||(F.preventDefault(),q(B,F.key==="ArrowUp"?"up":"down"))}const Q=B=>(u==null?void 0:u.folderId)===B,ee=!!g&&l!==null&&_.get(l)!==Lh,G=u!==null&&u.folderId===null;return{dragging:l!==null,dropClass:I,gripHandlers:R,onKeyDown:$,menuItems:te,isDropFolder:Q,canUngroup:ee,zoneActive:G}}function vg(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 US(n){return n.map(l=>({...l,id:`pinned:${l.id}`,label:l.id==="folder:new"?"Новая папка закреплённых…":l.id==="folder:none"?"Без папки закреплённых":l.label}))}function jg(n){const[l,i]=p.useState([]),r=p.useRef(null);function o(){i([]),r.current=null}function u(g,x,_){if(g.ctrlKey||g.metaKey){i(b=>b.includes(x.id)?b.filter(j=>j!==x.id):[...b,x.id]),r.current=x.id;return}if(g.shiftKey&&r.current){const b=n.findIndex(N=>N.id===r.current),j=n.findIndex(N=>N.id===x.id);if(b!==-1&&j!==-1){const[N,k]=b<j?[b,j]:[j,b];i(n.slice(N,k+1).map(w=>w.id));return}}o(),r.current=x.id,_()}function f(g){return l.includes(g.id)?l:(i([g.id]),r.current=g.id,[g.id])}return{selected:l,click:u,targetsFor:f,clear:o}}const BS={display:"flex",alignItems:"center",gap:6,flex:1,minWidth:0,textAlign:"left"},HS={width:22,height:22,borderRadius:6};function yh({title:n,count:l,open:i,onToggle:r,hint:o,action:u}){const f=i?`Свернуть «${n}»`:`Развернуть «${n}»`;return s.jsxs("div",{className:"sidebar__section",children:[s.jsxs("button",{className:"sidebar__section--btn",style:BS,"aria-expanded":i,title:o?`${f} — ${o}`:f,onClick:r,children:[s.jsx(lm,{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:HS,title:u.label,"aria-label":u.label,onClick:u.onClick,children:s.jsx(QS,{})})]})}function Xh(n){return{paddingLeft:`calc(37px + ${n} * var(--tree-indent, 24px))`}}const ov={display:"flex",alignItems:"center",gap:6,width:"100%"},uv={flex:1,minWidth:0,color:"var(--text-2)",fontWeight:500},dv={...uv,color:"var(--muted)",fontSize:12.5};function qS({folder:n,count:l,live:i,open:r,renaming:o,onToggle:u,onStartRename:f,onCommitRename:g,onCancelRename:x,color:_,onPreviewColor:b,onCommitColor:j,onResetColor:N,depth:k}){const w=p.useRef(null),[E,C]=p.useState(null),T=p.useRef(null);p.useEffect(()=>()=>{var ee;return window.clearTimeout((ee=T.current)==null?void 0:ee.timer)},[]);function z(ee){const G=ee.touches[0];if(!G)return;const B={timer:0,x:G.clientX,y:G.clientY,el:ee.currentTarget,fired:!1};B.timer=window.setTimeout(()=>{B.fired=!0,C({x:B.x,y:B.y,opener:B.el})},cv),T.current=B}function q(ee){const G=T.current,B=ee.touches[0];!G||!B||Math.hypot(B.clientX-G.x,B.clientY-G.y)>10&&(window.clearTimeout(G.timer),T.current=null)}function te(ee){const G=T.current;G&&(window.clearTimeout(G.timer),G.fired&&ee.preventDefault())}function I(){const ee=E==null?void 0:E.opener;C(null),ee!=null&&ee.isConnected&&ee.focus()}function R(){const ee=w.current;if(ee)try{ee.showPicker()}catch{ee.click()}}const $=[{id:"rename",label:"Переименовать",onSelect:f},{id:"color",label:"Выбрать цвет…",onSelect:R},...n.color?[{id:"reset-color",label:"Сбросить цвет",onSelect:N}]:[]],Q=p.useRef(j);return Q.current=j,p.useEffect(()=>{const ee=w.current;if(!ee)return;const G=()=>Q.current(ee.value);return ee.addEventListener("change",G),()=>ee.removeEventListener("change",G)},[o]),o?s.jsx("div",{className:"row",style:Xh(k),children:s.jsx("div",{className:"row__main",children:s.jsx(Pi,{value:n.name,placeholder:"Название папки",onCommit:g,onCancel:x})})}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"row",style:Xh(k),onContextMenu:ee=>{ee.preventDefault(),C({x:ee.clientX,y:ee.clientY,opener:ee.currentTarget})},onTouchStart:z,onTouchMove:q,onTouchEnd:te,onTouchCancel:te,children:[s.jsxs("button",{className:"row__main",style:ov,"aria-expanded":r,title:r?`Свернуть папку «${n.name}»`:`Развернуть папку «${n.name}»`,onClick:u,children:[s.jsx(lm,{open:r}),s.jsx("span",{style:k>0?dv:uv,children:n.name}),!r&&s.jsx(hv,{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":E!==null,onClick:ee=>{const G=ee.currentTarget.getBoundingClientRect();C({x:G.left,y:G.bottom,opener:ee.currentTarget})},children:s.jsx(VS,{})}),s.jsx("input",{ref:w,className:"row__color-input",type:"color",tabIndex:-1,"aria-hidden":"true",value:_??GS(),onChange:ee=>b(ee.target.value)})]})]}),E&&s.jsx(Qi,{x:E.x,y:E.y,items:$,onClose:I})]})}function GS(){const n=getComputedStyle(document.documentElement).getPropertyValue("--folder-default").trim();return/^#[0-9a-f]{6}$/i.test(n)?n.toLowerCase():"#9a978d"}const YS=[];function lm({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 VS(){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 zh(){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 FS(){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 XS({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 KS(){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 QS(){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 PS(){try{const n=localStorage.getItem(av);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 ay(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 iy(n,l){try{localStorage.setItem(n,JSON.stringify(l))}catch{}}function ZS(){try{const n=localStorage.getItem(rv);if(n===null)return[];const l=JSON.parse(n);return Array.isArray(l)?l.filter(i=>typeof i=="string"):[]}catch{return[]}}function WS(){try{const n=localStorage.getItem(iv);return n==="pinned"||n==="live"?n:"default"}catch{return"default"}}const ry={system:"как в системе",light:"светлая",dark:"тёмная"};function JS({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 cy(n){const l=eE(n),i=(n.tasks??[]).filter(r=>r.kind==="agent").length;return i>0?`${l} · ${lv(i)}`:l}function eE(n){switch(n.state){case"running":return"работает";case"waiting_permission":return"ждёт разрешения";case"idle":return n.backgroundWork?"работает в фоне":tE(n.lastTurn);case"starting":return"запускается";case"reconnecting":return"переподключается";case"error":return"ошибка";case"closed":return"на диске"}}function tE(n){switch(n){case"interrupted":return"прервана";case"stopped":return"остановлена";case"failed":return"оборвалась";case"completed":return"готова";case null:return"ждёт задачу"}}function fv(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":nE(n.lastTurn);case"error":return"error";case"closed":return"closed"}}function nE(n){switch(n){case"interrupted":case"stopped":return"halted";case"failed":return"error";case"completed":return"ready";case null:return"fresh"}}function Kh({session:n,pinned:l,projectName:i,projectPath:r,archived:o}){const u=o?"closed":fv(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?lE(n):`${cy(n)} · ${new Date(n.updatedAt).toLocaleString()}`,children:[s.jsx(sE,{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:` · ${Yp(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:cy(n)}),i===void 0&&s.jsx("span",{className:"row__time",children:u==="closed"?Yp(n.updatedAt):` · ${Yp(n.updatedAt)}`})]})]})]})}const oy=["waiting","error","running","reconnecting","background","starting","halted","ready","fresh","closed"];function uy(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),oy.indexOf(i)<oy.indexOf(r.tone)&&(r.tone=i)}function hv({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 sE({title:n,pinned:l,provider:i,accountId:r,projectName:o,projectPath:u}){const f=rN(r,i);return s.jsxs("span",{className:"row__head",children:[s.jsxs("span",{className:"row__title",children:[l&&s.jsx(XS,{className:"row__pin"}),f&&s.jsx(Sa,{account:f,className:"row__acct"}),i==="antigravity"&&s.jsx(Qg,{className:"row__provider"}),i==="codex"&&s.jsx(Pg,{className:"row__provider row__provider--codex"}),n]}),o!==void 0&&s.jsx("span",{className:"row__project",title:u,children:o})]})}function Yp(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 lE(n){const l=n.archivedAuto?"сама, по сроку молчания":"убрана вручную";return n.archivedAt?`${new Date(n.archivedAt).toLocaleString()} · ${l}`:l}function aE(n){return n.archivedAt?`закрыт ${new Date(n.archivedAt).toLocaleString()}`:"закрыт"}function iE({disabled:n,onDownload:l,onSave:i,saveDisabled:r}){const[o,u]=p.useState(!1),f=p.useRef(null);p.useEffect(()=>{if(!o)return;function x(b){var j;(j=f.current)!=null&&j.contains(b.target)||u(!1)}function _(b){b.key==="Escape"&&(b.stopPropagation(),u(!1))}return document.addEventListener("mousedown",x),document.addEventListener("keydown",_,!0),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",_,!0)}},[o]);function g(x){u(!1),x()}return s.jsxs("div",{className:"select exportmenu",ref:f,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(x=>!x),children:s.jsx(rE,{})}),o&&s.jsxs("div",{className:"select__menu exportmenu__menu",role:"menu",children:[s.jsxs("button",{type:"button",role:"menuitem",className:"exportmenu__item",onClick:()=>g(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:()=>g(i),children:[s.jsx("span",{className:"exportmenu__label",children:"Сохранить в проект"}),s.jsx("span",{className:"exportmenu__hint",children:"Файл .md в корне проекта"})]})]})]})}function rE(){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 cE="Без названия",oE=["file_path","notebook_path","path","command","pattern","url","query","description","prompt"];function uE(n){if(!n||typeof n!="object")return"";const l=n;for(const i of oE){const r=l[i];if(typeof r=="string"&&r.trim()!=="")return r.replace(/\s+/g," ").trim().slice(0,160)}return""}function dE(n){const l=uE(n.input);return`> 🔧 ${n.name}${l?` ${l}`:""}`}function fE(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 hE(n,l){var f;const i=l.agent??"Claude",r=[];r.push(`# ${((f=l.title)==null?void 0:f.trim())||cE}`,""),l.project&&r.push(`**Проект:** ${l.project} `),r.push(`**Экспортировано:** ${fE(l.now??new Date)}`,""),l.partial&&r.push("_Показана только загруженная часть разговора: более ранние реплики не подгружены._",""),r.push("---","");let o=[];const u=()=>{o.length!==0&&(r.push(o.join(`
|
|
129
|
+
`),""),o=[])};for(const g of n)switch(g.kind){case"user":{u(),r.push("## Вы","");const x=g.text.trim();x&&r.push(x,"");const _=[...(g.files??[]).map(b=>b.name),...g.images&&g.images.length>0?[`изображений: ${g.images.length}`]:[]];_.length>0&&r.push(`_Вложения: ${_.join(", ")}_`,"");break}case"assistant":{u();const x=g.text.trim();if(!x)break;r.push(`## ${i}`,"",x,"");break}case"tool":o.push(dE(g));break}return u(),r.join(`
|
|
130
|
+
`).replace(/\n{3,}/g,`
|
|
131
|
+
|
|
132
|
+
`).trimEnd()+`
|
|
133
|
+
`}const mE=/[\\/:*?"<>|\u0000-\u001f]/g;function dy(n){return(n??"").replace(mE," ").replace(/\s+/g," ").trim().replace(/^\.+/,"").replace(/[. ]+$/,"").slice(0,80).trim()||"Разговор"}function fy(n,l){return l<=1?`${n}.md`:`${n} (${l}).md`}function pE(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 Qh(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 gE(n,l){const i=p.useRef(!1),r=p.useRef(!1),o=p.useRef(l);return o.current=l,p.useEffect(()=>{const u=n.current;if(!u)return;function f(){const _=i.current||Qh(n.current);r.current&&!_?(r.current=!1,o.current()):r.current=_}function g(_){_.button===0&&(i.current=!0,r.current=!0)}function x(){i.current&&(i.current=!1,f())}return u.addEventListener("pointerdown",g),window.addEventListener("pointerup",x),window.addEventListener("pointercancel",x),document.addEventListener("selectionchange",f),()=>{u.removeEventListener("pointerdown",g),window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",x),document.removeEventListener("selectionchange",f)}},[n]),()=>i.current||Qh(n.current)}const mv=1500;function pv(n){const l=[];let i=!1;for(const r of n.patch.split(`
|
|
134
|
+
`)){if(l.length>=mv){i=!0;break}if(r.startsWith("@@"))l.push({type:"gap",text:xE(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:_E(n,i)}}function xE(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 _E(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(`показаны первые ${mv} строк`),i.length>0?i.join(" · "):null}const bE={add:"новый файл",delete:"файл удалён",update:"правка файла"};function yE(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:f}=r;if(typeof o!="string"||o==="")continue;const g=typeof u=="string"?u:"update",_=(typeof f=="string"?f:"").split(`
|
|
135
|
+
`).filter(C=>!/^(diff --git |index |--- |\+\+\+ |new file mode|deleted file mode)/.test(C)),j=_.some(C=>/^(@@|\+|-)/.test(C))?_.join(`
|
|
136
|
+
`):g==="add"?_.map(C=>`+${C}`).join(`
|
|
137
|
+
`):g==="delete"?_.map(C=>`-${C}`).join(`
|
|
138
|
+
`):_.join(`
|
|
139
|
+
`);let N=0,k=0;for(const C of j.split(`
|
|
140
|
+
`))C.startsWith("+")?N++:C.startsWith("-")&&k++;const w=pv({path:o,oldPath:"",status:g==="add"?"added":g==="delete"?"deleted":"modified",added:N,removed:k,binary:!1,patch:j}),E=bE[g];!w.note&&E&&g!=="update"&&(w.note=E),i.push(w)}return i.length>0?i:null}const hy=3,vE=15e5;function jE(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=Vp(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=SE(NE(Vp(i.old_string),Vp(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 Vp(n){if(n==="")return[];const l=n.split(/\r?\n/);return l.length>1&&l[l.length-1]===""&&l.pop(),l}function NE(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=f=>({type:"ctx",text:f});return[...n.slice(0,i).map(u),...kE(n.slice(i,r),l.slice(i,o)),...n.slice(r).map(u)]}function kE(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)>vE)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),f=(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]?f(b+1,j+1)+1:Math.max(f(b+1,j),f(b,j+1));const g=[];let x=0,_=0;for(;x<i&&_<r;){const b=n[x],j=l[_];b===j?(g.push({type:"ctx",text:b}),x++,_++):f(x+1,_)>=f(x,_+1)?(g.push({type:"del",text:b}),x++):(g.push({type:"add",text:j}),_++)}for(;x<i;)g.push({type:"del",text:n[x++]});for(;_<r;)g.push({type:"add",text:l[_++]});return wE(g)}function wE(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 SE(n){if(!n.some(u=>u.type!=="ctx"))return n;const l=n.map(()=>!1);n.forEach((u,f)=>{if(u.type!=="ctx")for(let g=Math.max(0,f-hy);g<=Math.min(n.length-1,f+hy);g++)l[g]=!0});const i=[];let r=[];function o(){r.length===1?i.push(...r):r.length>1&&i.push({type:"gap",text:`⋯ ${r.length} ${EE(r.length)} без изменений`}),r=[]}return n.forEach((u,f)=>{l[f]?(o(),i.push(u)):r.push(u)}),o(),i}function EE(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 gv(n,l){if(n==="apply_patch")return yE(l);const i=jE(n,l);return i?[i]:null}function Sn({title:n,children:l,actions:i,className:r,sheet:o=!1,onClose:u}){const f=p.useRef(null);return p.useEffect(()=>{function g(x){if(x.key==="Escape"){x.preventDefault(),x.stopPropagation(),u();return}if(x.key!=="Tab")return;const _=f.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||(x.shiftKey&&document.activeElement===j?(x.preventDefault(),N.focus()):!x.shiftKey&&document.activeElement===N&&(x.preventDefault(),j.focus()))}return document.addEventListener("keydown",g,!0),()=>document.removeEventListener("keydown",g,!0)},[u]),s.jsx("div",{className:o?"modal-backdrop modal-backdrop--sheet":"modal-backdrop",onMouseDown:g=>{g.target===g.currentTarget&&u()},children:s.jsxs("div",{ref:f,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 my=880,py=60;function CE(n){var i,r;const l=n.text.split(`
|
|
141
|
+
`).map(o=>o.trim()).find(Boolean);return l?l.length>py?`${l.slice(0,py-1).trimEnd()}…`:l:(i=n.images)!=null&&i.length?"Изображение":(r=n.files)!=null&&r.length?"Файл":"Пустой запрос"}function TE({prompts:n,containerRef:l,hasMore:i,loading:r,onLoadEarlier:o,onJump:u}){const f=ru("(hover: none)"),[g,x]=p.useState(()=>window.innerWidth<my),[_,b]=p.useState(null),[j,N]=p.useState(!1),k=p.useRef(null);p.useEffect(()=>{var Q;const I=(Q=l.current)==null?void 0:Q.parentElement;if(!I)return;const R=()=>x(I.clientWidth<my);R();const $=new ResizeObserver(R);return $.observe(I),()=>$.disconnect()},[l]);const w=g||f,E=p.useMemo(()=>n.map(I=>I.id),[n]),C=p.useCallback(()=>{const I=l.current;if(!I||E.length===0)return;const R=new Set(E),$=I.getBoundingClientRect().top+24;let Q=null;for(const ee of I.querySelectorAll("[data-item-id]")){const G=ee.dataset.itemId;if(!(!G||!R.has(G)))if(Q===null&&(Q=G),ee.getBoundingClientRect().top<=$)Q=G;else break}b(Q)},[l,E]);if(p.useEffect(()=>{const I=l.current;if(!I)return;let R=0;const $=()=>{R||(R=requestAnimationFrame(()=>{R=0,C()}))};return C(),I.addEventListener("scroll",$,{passive:!0}),()=>{I.removeEventListener("scroll",$),R&&cancelAnimationFrame(R)}},[l,C]),n.length<2)return null;const T=n.findIndex(I=>I.id===_);function z(){const I=k.current,R=I==null?void 0:I.querySelector('[aria-current="true"]');!I||!R||(I.scrollTop=R.offsetTop-I.clientHeight/2+R.offsetHeight/2)}function q(I){var ee,G;if(I.key==="Escape"){(ee=document.activeElement)==null||ee.blur();return}if(!["ArrowDown","ArrowUp","Home","End"].includes(I.key))return;const R=Array.from(I.currentTarget.querySelectorAll("button:not(:disabled)"));if(R.length===0)return;I.preventDefault();const $=R.indexOf(document.activeElement);let Q;I.key==="ArrowDown"?Q=Math.min(R.length-1,$+1):I.key==="ArrowUp"?Q=Math.max(0,$-1):I.key==="Home"?Q=0:Q=R.length-1,(G=R[Q])==null||G.focus()}function te(I){return s.jsxs(s.Fragment,{children:[i&&s.jsx("button",{type:"button",className:"outline__more",disabled:r,onClick:o,children:r?"Загружаем…":"Показать более раннее"}),s.jsx("ol",{className:"outline__list",children:n.map((R,$)=>s.jsx("li",{children:s.jsxs("button",{type:"button",className:"outline__item"+(R.id===_?" is-current":""),"aria-current":R.id===_?"true":void 0,onClick:()=>{u(R.id),I==null||I()},children:[s.jsx("span",{className:"outline__num",children:$+1}),s.jsx("span",{className:"outline__text",children:R.excerpt})]})},R.id))})]})}return w?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"outline-bar",children:s.jsxs("button",{type:"button",className:"outline-bar__btn","aria-label":"Список ваших запросов","aria-haspopup":"dialog",onClick:()=>N(!0),children:[s.jsx("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",children:s.jsx("path",{d:"M2 4h12M2 8h8M2 12h10",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),s.jsxs("span",{children:[T>=0?T+1:n.length," из ",n.length]})]})}),j&&s.jsx(Sn,{title:"Ваши запросы",className:"modal--sheet modal--outline",sheet:!0,onClose:()=>N(!1),children:s.jsx("nav",{className:"outline outline--sheet","aria-label":"Ваши запросы",onKeyDown:q,children:te(()=>N(!1))})})]}):s.jsxs("nav",{className:"outline outline--rail","aria-label":"Ваши запросы",onKeyDown:q,onMouseEnter:z,onFocus:z,children:[s.jsx("div",{className:"outline__marks","aria-hidden":"true",children:n.map(I=>s.jsx("span",{className:"outline__mark"+(I.id===_?" is-current":"")},I.id))}),s.jsx("div",{className:"outline__panel",ref:k,children:te()})]})}function Ng(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 AE={pdf:"PDF",text:"Текст",file:"Файл"};function xv({file:n,onRemove:l}){return s.jsxs("div",{className:`filechip filechip--${n.kind}`,title:`${n.name}, ${Ng(n.size)}`,children:[s.jsx("span",{className:"filechip__icon",children:s.jsx(ME,{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:[AE[n.kind],", ",Ng(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 ME({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 _v="ccv.speech",Zg="",bv=.75,yv=2,RE=200,gy={voice:Zg,rate:1},Fp={min:bv,max:yv,step:.05};function uu(){return typeof window<"u"&&"speechSynthesis"in window}function vv(){try{const n=window.localStorage.getItem(_v);if(!n)return gy;const l=JSON.parse(n),i=typeof l.rate=="number"?l.rate:1;return{voice:typeof l.voice=="string"?l.voice:Zg,rate:Math.min(yv,Math.max(bv,i))}}catch{return gy}}function DE(n){try{window.localStorage.setItem(_v,JSON.stringify(n))}catch{}}function LE(n){const l=n.replace(/\r\n?/g,`
|
|
142
|
+
`).split(`
|
|
143
|
+
`),i=[];let r=null;for(const u of l){const f=/^\s*(`{3,}|~{3,})/.exec(u);if(f){const g=f[1];r===null?(r=g[0],i.push("блок кода.")):g[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(`
|
|
144
|
+
`);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(`
|
|
145
|
+
`).map(u=>u.trim()).filter(u=>u!=="").map(u=>/[.!?…:;]$/.test(u)?u:`${u}.`).join(" "),o.replace(/\s+/g," ").trim()}function OE(n,l=RE){const i=n.match(/[^.!?…]+[.!?…]*\s*/g)??[n],r=[];let o="";const u=()=>{o.trim()!==""&&r.push(o.trim()),o=""};for(const f of i){if(f.length>l){u();for(const g of zE(f,l))r.push(g);continue}(o+f).length>l&&u(),o+=f}return u(),r}function zE(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 jv(){return uu()?window.speechSynthesis.getVoices():[]}function IE(){const[n,l]=p.useState(jv);return p.useEffect(()=>{if(!uu())return;const i=window.speechSynthesis,r=()=>l(i.getVoices());return r(),i.addEventListener("voiceschanged",r),()=>i.removeEventListener("voiceschanged",r)},[]),n}function $E(n,l){const i=jv();if(l.voice!==Zg){const g=i.find(x=>x.voiceURI===l.voice);if(g)return g}const r=(n.match(/[Ѐ-ӿ]/g)??[]).length,o=(n.match(/[A-Za-z]/g)??[]).length,u=r>=o?"ru":"en",f=i.filter(g=>g.lang.toLowerCase().startsWith(u));return f.find(g=>g.localService)??f[0]??null}const kg=new Set;let wg=null,Md=0;function Ih(n){wg=n;for(const l of kg)l()}function UE(n){return kg.add(n),()=>kg.delete(n)}function Wg(){Md+=1,uu()&&window.speechSynthesis.cancel(),Ih(null)}function Nv(n,l,i=vv()){if(!uu())return;const r=LE(l);r!==""&&(Wg(),HE(n,r,i))}function BE(n){Nv("sample","Так звучит выбранный голос. This is how the selected voice sounds.",n)}function HE(n,l,i){const r=window.speechSynthesis,o=OE(l),u=$E(l,i),f=Md;Ih(n),o.forEach((g,x)=>{const _=new SpeechSynthesisUtterance(g);u?(_.voice=u,_.lang=u.lang):_.lang=/[Ѐ-ӿ]/.test(g)?"ru-RU":"en-US",_.rate=i.rate;const b=x===o.length-1;_.onend=()=>{b&&f===Md&&Ih(null)},_.onerror=()=>{f===Md&&(Md+=1,r.cancel(),Ih(null))},r.speak(_)})}function kv(n){const[l,i]=p.useState(()=>wg===n);return p.useEffect(()=>{const r=()=>i(wg===n);return r(),UE(r)},[n]),l}function qE({id:n,text:l}){const i=kv(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?Wg():Nv(n,l),children:r})}function Jg({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 GE({waiting:n}){const[l,i]=p.useState(0);return p.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," с"]})]})}const YE="После этой реплики агент не менял файлов.";function VE(n){const l=n%10,i=n%100;return l===1&&i!==11?"файл":l>=2&&l<=4&&(i<12||i>14)?"файла":"файлов"}function FE({userIndex:n,onRewindFiles:l,onClose:i}){const[r,o]=p.useState({kind:"loading"}),u=p.useRef(!0),f=p.useRef(!1);p.useEffect(()=>(u.current=!0,l(n,!0).then(N=>{if(!u.current)return;const k=N.filesChanged??[];!N.canRewind||k.length===0?o({kind:"empty",message:N.error||YE}):o({kind:"preview",reply:N})},N=>{u.current&&o({kind:"empty",message:N instanceof Error?N.message:String(N)})}),()=>{u.current=!1}),[]);function g(){f.current||(f.current=!0,o({kind:"running"}),l(n,!1).then(N=>{var C;if(f.current=!1,!u.current)return;if(!N.canRewind||N.error){o({kind:"done",error:!0,message:N.error||"Не удалось откатить файлы."});return}const k=((C=N.filesChanged)==null?void 0:C.length)??0,w=N.skippedLinks??0,E=w>0?` Пропущено ссылок: ${w}.`:"";o({kind:"done",error:!1,message:`Восстановлено файлов: ${k}.${E}`})},N=>{f.current=!1,u.current&&o({kind:"done",error:!0,message:N instanceof Error?N.message:String(N)})}))}const x=r.kind==="running",_=()=>{x||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:x,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,k=N.filesChanged??[];b=s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"modal__text",children:"Файлы, которые агент менял после этой реплики, вернутся к состоянию на её момент. Разговор не изменится."}),s.jsx("ul",{className:"rewind__files","aria-label":"Файлы к откату",children:k.map(w=>s.jsx("li",{className:"rewind__file",title:w,children:s.jsx("span",{className:"rewind__path",children:s.jsx("bdi",{dir:"ltr",children:w})})},w))}),s.jsxs("p",{className:"rewind__summary",children:[k.length," ",VE(k.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:g,children:"Откатить"})]})}return s.jsx(Sn,{title:"Откатить файлы?",onClose:_,actions:j,className:"modal--rewind",children:b})}function ex({items:n,busy:l,waiting:i,history:r=[],historyHasMore:o=!1,historyLoading:u=!1,onLoadHistory:f,outline:g=!1,sessionId:x,onEditMessage:_,onRewindFiles:b,onOpenPreview:j,empty:N="Сессия пуста. Опишите задачу — Claude Code работает в каталоге проекта с полным набором инструментов."}){const k=p.useRef(null),w=p.useRef(null),E=p.useRef(!0),C=p.useRef(null),T=p.useRef(null),z=p.useRef(!1),q=p.useRef(null),te=gE(k,()=>{var le;return(le=q.current)==null?void 0:le.call(q)}),I=p.useRef(te);I.current=te,p.useEffect(()=>{E.current=!0,C.current=null,z.current=!1,T.current!==null&&(clearTimeout(T.current),T.current=null)},[x]),p.useEffect(()=>{const le=k.current,ue=w.current;if(!le||!ue)return;function ce(H){!le||H===le.scrollTop||(z.current=!0,le.scrollTop=H)}function D(){if(!le)return;const H=C.current;if(H){const J=Xp(le,H.id);if(J){const re=J.getBoundingClientRect().top-le.getBoundingClientRect().top;ce(le.scrollTop+(re-H.top))}T.current!==null&&clearTimeout(T.current),T.current=setTimeout(()=>{C.current=null},500);return}E.current&&!I.current()&&ce(le.scrollHeight)}q.current=D;const O=new ResizeObserver(D);return O.observe(ue),()=>{q.current=null,O.disconnect(),T.current!==null&&clearTimeout(T.current)}},[]);function R(){const le=k.current;if(le){if(z.current){z.current=!1;return}E.current=le.scrollHeight-le.scrollTop-le.clientHeight<80}}function $(){if(u)return;const le=k.current,ue=r[0];if(le&&ue){const ce=Xp(le,ue.id);ce&&(C.current={id:ue.id,top:ce.getBoundingClientRect().top-le.getBoundingClientRect().top})}f==null||f()}function Q(le){const ue=k.current;if(!ue)return;const ce=Xp(ue,le);if(!ce)return;E.current=!1,C.current=null;const D=ce.getBoundingClientRect().top-ue.getBoundingClientRect().top+ue.scrollTop,O=window.matchMedia("(prefers-reduced-motion: reduce)").matches;ue.scrollTo({top:Math.max(0,D-16),behavior:O?"auto":"smooth"}),ce.classList.remove("is-flash"),ce.offsetWidth,ce.classList.add("is-flash"),window.setTimeout(()=>ce.classList.remove("is-flash"),1600)}const ee=p.useMemo(()=>g?[...r,...n].filter(le=>le.kind==="user").map(le=>({id:le.id,excerpt:CE(le)})):[],[g,r,n]);let G=0;function B(le){return le.kind==="user"?G++:-1}const F=s.jsx("div",{className:"transcript",ref:k,onScroll:R,children:s.jsxs("div",{className:"stream",ref:w,children:[o&&s.jsx("button",{type:"button",className:"transcript__more",onClick:$,disabled:u,children:u?"Загружаем…":"Показать более раннее"}),r.map(le=>s.jsx(xy,{item:le,userIndex:B(le),onEditMessage:_,onRewindFiles:b,onOpenPreview:j},le.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:N}),n.map(le=>s.jsx(xy,{item:le,userIndex:B(le),onEditMessage:_,onRewindFiles:b,onOpenPreview:j},le.id)),l&&s.jsx(GE,{waiting:i})]})});return g?s.jsxs("div",{className:"transcript-host",children:[s.jsx(TE,{prompts:ee,containerRef:k,hasMore:o,loading:u,onLoadEarlier:$,onJump:Q}),F]}):F}function xy({item:n,userIndex:l,onEditMessage:i,onRewindFiles:r,onOpenPreview:o}){switch(n.kind){case"user":return s.jsx(KE,{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(QE,{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(qE,{id:n.id,text:n.text}),s.jsx(Ca,{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(ZE,{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:["↑",by(n.inputTokens)," ↓",by(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 XE=500;function KE({item:n,userIndex:l,onEditMessage:i,onRewindFiles:r}){const[o,u]=p.useState(null),[f,g]=p.useState(!1),[x,_]=p.useState(n.text),[b,j]=p.useState(!1),[N,k]=p.useState(!1),w=p.useRef(null),E=p.useRef(!1),C=ru("(max-width: 860px)"),T=p.useRef(null);function z(ue,ce){u({x:ue,y:ce})}function q(ue){ue.preventDefault(),z(ue.clientX,ue.clientY)}function te(ue){const ce=ue.touches[0];if(!ce)return;const D={timer:0,x:ce.clientX,y:ce.clientY,fired:!1};D.timer=window.setTimeout(()=>{D.fired=!0,z(D.x,D.y)},XE),T.current=D}function I(ue){const ce=T.current,D=ue.touches[0];!ce||!D||Math.hypot(D.clientX-ce.x,D.clientY-ce.y)>10&&(window.clearTimeout(ce.timer),T.current=null)}function R(ue){const ce=T.current;ce&&(window.clearTimeout(ce.timer),ce.fired&&ue.preventDefault())}function $(){_(n.text),k(!1),g(!0)}function Q(){g(!1)}function ee(){const ue=x.trim();if(ue===""&&!(n.images&&n.images.length>0))return;const ce=i==null?void 0:i(l,ue,n.images,r&&N?{rewindFiles:!0}:void 0);if(ce instanceof Promise){if(E.current)return;E.current=!0,ce.then(D=>{E.current=!1,D&&g(!1)},()=>{E.current=!1});return}ce!==!1&&g(!1)}p.useEffect(()=>{const ue=w.current;!ue||!f||(ue.style.height="auto",ue.style.height=`${ue.scrollHeight}px`)},[x,f]),p.useEffect(()=>{if(!f)return;const ue=w.current;ue&&(ue.focus(),ue.setSelectionRange(ue.value.length,ue.value.length))},[f]);function G(ue){if(ue.key==="Escape"){ue.preventDefault(),ue.stopPropagation(),Q();return}ue.key==="Enter"&&!ue.shiftKey&&!C&&(ue.preventDefault(),ee())}const B=n.images&&n.images.length>0&&s.jsx("div",{className:"msg--user__images",children:n.images.map((ue,ce)=>s.jsx("img",{className:"msg--user__image",src:`data:${ue.mediaType};base64,${ue.data}`,alt:"Вложение"},ce))}),F=n.files&&n.files.length>0&&s.jsx("div",{className:"msg--user__files",children:n.files.map((ue,ce)=>s.jsx(xv,{file:ue},ce))});if(f){const ue=x.trim()!==""||!!(n.images&&n.images.length>0);return s.jsxs("div",{className:"msg--user msg--user--editing","data-item-id":n.id,children:[B,F,s.jsxs("div",{className:"msg--user__edit",children:[s.jsx("textarea",{ref:w,className:"msg--user__edit-field",value:x,onChange:ce=>_(ce.target.value),onKeyDown:G,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:ce=>k(ce.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:Q,children:"Отмена"}),s.jsx("button",{type:"button",className:"btn btn--sm btn--primary",onClick:ee,disabled:!ue,children:"Сохранить"})]})]})]})}const le=[{id:"copy",label:"Копировать",onSelect:()=>void oi(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:q,onTouchStart:te,onTouchMove:I,onTouchEnd:R,onTouchCancel:R,children:[B,F,n.text,o&&s.jsx(Qi,{x:o.x,y:o.y,items:le,onClose:()=>u(null)})]}),b&&r&&s.jsx(FE,{userIndex:l,onRewindFiles:r,onClose:()=>j(!1)})]})}function Xp(n,l){const i=n.querySelectorAll("[data-item-id]");for(const r of i)if(r.dataset.itemId===l)return r;return null}function QE({text:n,streaming:l}){const[i,r]=p.useState(""),o=p.useRef(null),u=Q0(o,i,l),f=p.useMemo(()=>({__html:i}),[i]),g=p.useRef([]),x=p.useRef(null);p.useEffect(()=>{let b=!1;return Gd(n).then(j=>{if(b)return;const N=PE(j);if(Qh(o.current)){x.current=N;return}x.current=null,r(N)}),()=>{b=!0}},[n]),p.useEffect(()=>{function b(){const j=x.current;j===null||Qh(o.current)||(x.current=null,r(j))}return document.addEventListener("selectionchange",b),()=>document.removeEventListener("selectionchange",b)},[]),p.useEffect(()=>{const b=g.current;return()=>b.forEach(j=>clearTimeout(j))},[]);function _(b){var k,w;const j=b.target.closest(".codeblock__copy");if(!(j instanceof HTMLElement))return;const N=((w=(k=j.parentElement)==null?void 0:k.querySelector("pre"))==null?void 0:w.textContent)??"";N!==""&&oi(N).then(E=>{if(!E)return;j.textContent=Zo,j.setAttribute("aria-label",Zo),j.classList.add("copybtn--done");const C=window.setTimeout(()=>{j.isConnected&&(j.textContent=qc,j.setAttribute("aria-label",Sg),j.classList.remove("copybtn--done"))},Kg);g.current.push(C)})}return s.jsxs(s.Fragment,{children:[s.jsx("div",{ref:o,className:"markdown-preview msg--assistant__body",onClick:_,dangerouslySetInnerHTML:f}),u]})}const Sg=`${qc} блок кода`;function PE(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",Sg),o.title=Sg,o.textContent=qc,r.append(o)}return l.body.innerHTML}function ZE({item:n,onOpenPreview:l}){const[i,r]=p.useState(!1),o=n.result===null,u=gv(n.name,n.input),f=n.name==="AskUserQuestion"?tC(n.input):null,g=l&&(n.name==="Write"||n.name==="Edit")&&!n.isError?WE(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(x=>!x),children:[s.jsx("span",{className:"tool__name",children:n.name}),s.jsx("span",{className:"tool__arg",children:f?eC(f):JE(n.input)}),s.jsx("span",{className:"tool__status",children:o?"…":n.isError?"ошибка":i?"▴":"▾"})]}),g&&s.jsx("div",{className:"tool__actions",children:s.jsx("button",{type:"button",className:"btn btn--sm",onClick:()=>l==null?void 0:l(g),children:"Открыть превью"})}),i&&s.jsxs("div",{className:"tool__body",children:[f?s.jsx(nC,{questions:f,answers:n.answers}):u?u.map((x,_)=>s.jsx(Jg,{diff:x},_)):s.jsx(_y,{text:JSON.stringify(n.input,null,2),hint:"аргументы вызова"}),n.result!==null&&(!f||n.isError)&&s.jsx(_y,{text:n.result,hint:"результат вызова",style:{marginTop:10}})]})]})}function _y({text:n,hint:l,style:i}){return s.jsxs("div",{className:"codeblock",style:i,children:[s.jsx("pre",{className:"code",children:n}),s.jsx(Ca,{text:n,hint:l,className:"codeblock__copy"})]})}function WE(n){if(typeof n!="object"||n===null)return null;const l=n.file_path;return typeof l=="string"&&tm(l)?l:null}function JE(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 eC(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 tC(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:f,multiSelect:g}=r;if(typeof o!="string"||!Array.isArray(f)||f.length===0)return null;const x=[];for(const _ of f){if(typeof _!="object"||_===null)return null;const{label:b,description:j,preview:N}=_;if(typeof b!="string"||typeof j!="string")return null;x.push({label:b,description:j,...typeof N=="string"?{preview:N}:{}})}i.push({question:o,header:typeof u=="string"?u:"",options:x,multiSelect:g===!0})}return i}function nC({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 by(n){return n>=1e3?`${(n/1e3).toFixed(1)}k`:String(n)}const sC="ccv.dictation.lang",yy="ru-RU";function lC(n){try{return Function.prototype.toString.call(n).includes("[native code]")}catch{return!1}}function vy(){const n=window,l=[n.SpeechRecognition,n.webkitSpeechRecognition].filter(r=>typeof r=="function"),i=l.find(lC);return!i&&l.length>0&&Na("распознавание подменено: родной реализации в странице нет"),i??l[0]??null}function wv(){var n;try{return((n=localStorage.getItem(sC))==null?void 0:n.trim())||yy}catch{return yy}}function Na(n,l){l===void 0?console.debug(`[dictation] ${n}`):console.debug(`[dictation] ${n}`,l)}const aC=3,iC=400,rC=5,cC=250,oC=2e3,uC=2e4;async function dC(){try{return(await navigator.permissions.query({name:"microphone"})).state==="granted"}catch{return!1}}const fC={"not-allowed":"Браузер не дал доступ к микрофону","service-not-allowed":"Браузер не дал доступ к микрофону","audio-capture":"Микрофон не найден",network:"Сервис распознавания недоступен","language-not-supported":`Распознавание не знает языка ${wv()}`};function hC(n){const[l]=p.useState(()=>vy()!==null),[i,r]=p.useState(!1),[o,u]=p.useState(null),f=p.useRef(null),g=p.useRef(!1),x=p.useRef(!1),_=p.useRef(n),b=p.useRef({openedAt:0,audio:!1,heard:!1,everHeard:!1,silent:0,dead:0,lastError:"",warned:!1}),j=p.useRef(null),N=p.useRef(!1),k=p.useRef(null),w=p.useCallback(()=>{k.current&&clearTimeout(k.current),k.current=null},[]),E=p.useCallback(()=>{w();const te=async I=>{if(k.current=null,!(!g.current||N.current)){if(!I&&!await dC()){if(Na("ждём ответа на запрос доступа к микрофону"),!g.current||N.current)return;k.current=setTimeout(()=>void te(!0),uC);return}Na("движок не ответил на start()"),g.current=!1,r(!1),u("Распознавание не отвечает — проверьте расширения браузера и доступ к микрофону")}};k.current=setTimeout(()=>void te(!1),oC)},[w]);p.useEffect(()=>{_.current=n}),p.useEffect(()=>{const te=vy();if(!te)return;const I=new te;return I.lang=wv(),I.continuous=!0,I.interimResults=!0,I.onstart=()=>{Na("сессия открыта"),N.current=!0,w(),r(!0)},I.onaudiostart=()=>{Na("пошёл звук с микрофона"),b.current.audio=!0},I.onresult=R=>{var G;if(x.current)return;let $="",Q="";for(let B=R.resultIndex;B<R.results.length;B++){const F=R.results[B];if(!F)continue;const le=((G=F[0])==null?void 0:G.transcript)??"";F.isFinal?$+=le:Q+=le}const ee=b.current;ee.heard=!0,ee.everHeard=!0,Na("распознано",{final:$,interim:Q}),_.current($,Q)},I.onerror=R=>{b.current.lastError=R.error,Na("ошибка движка",R.error),!(R.error==="no-speech"||R.error==="aborted")&&(g.current=!1,r(!1),u(fC[R.error]??`Распознавание не работает: ${R.error}`))},I.onend=()=>{x.current=!1,N.current=!1;const R=b.current,$=Date.now()-R.openedAt;if(Na("сессия закрыта",{мс:$,звук:R.audio,слова:R.heard,ошибка:R.lastError||null}),!g.current){r(!1);return}if(R.dead=!R.audio&&$<iC?R.dead+1:0,R.dead>=rC){g.current=!1,r(!1),u(R.lastError?`Распознавание не работает: ${R.lastError}`:"Распознавание закрывается сразу после запуска — проверьте доступ к микрофону в настройках сайта");return}R.silent=R.heard?0:R.silent+1,!R.everHeard&&!R.warned&&R.silent>=aC&&(R.warned=!0,u(R.audio?"Микрофон слушает, но речь не распознаётся — проверьте язык диктовки и уровень звука":"С микрофона не идёт звук — проверьте устройство ввода в настройках сайта в браузере")),j.current=setTimeout(()=>{if(j.current=null,!!g.current){R.openedAt=Date.now(),R.audio=!1,R.heard=!1,R.lastError="",E();try{I.start()}catch{}}},cC)},f.current=I,()=>{g.current=!1,j.current&&clearTimeout(j.current),j.current=null,w(),I.onend=null,I.onresult=null,I.onerror=null,I.onstart=null,I.onaudiostart=null,I.abort(),f.current=null}},[]);const C=p.useCallback(()=>{var te;if(g.current){if(g.current=!1,Na("выключение микрофона"),j.current&&clearTimeout(j.current),j.current=null,w(),!N.current){r(!1);return}(te=f.current)==null||te.stop()}},[]),T=p.useCallback(()=>{const te=f.current;if(te){if(!window.isSecureContext){u("Микрофон доступен только по https или с localhost");return}u(null),g.current=!0,x.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}),E();try{te.start()}catch(I){Na("start() не прошёл",I)}}},[E]),z=p.useCallback(()=>{g.current?C():T()},[T,C]),q=p.useCallback(()=>{var te;g.current&&N.current&&(x.current=!0,(te=f.current)==null||te.abort())},[]);return{supported:l,listening:i,error:o,toggle:z,stop:C,drop:q}}const mC="(max-width: 860px)",jy=/^\/(\S*)$/,pC=new Set(["model","permissions"]);function gC(n){return pC.has(n.name)||n.name.startsWith("__")}const xC=new Set(["clear","rename"]),Ny=/(?:^|\s)@([^\s@]*)$/,_C=200,bC=100,yC=190,vC=20*1024*1024,jC=1568,NC=.85;let Ph=0;const kC=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"]),wC=/^(text\/|application\/(json|xml|x-yaml|yaml|toml|x-sh|javascript|typescript|sql|x-ndjson))/;function ky(n){const l=n.lastIndexOf(".");return l===-1?"":n.slice(l+1).toLowerCase()}function SC(n){return n.type==="application/pdf"||ky(n.name)==="pdf"?"pdf":wC.test(n.type)||kC.has(ky(n.name))?"text":"file"}function EC(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 Kp="Вставленный текст";function CC(n){const l=new Set(n);if(!l.has(`${Kp}.md`))return`${Kp}.md`;for(let i=2;;i+=1){const r=`${Kp} ${i}.md`;if(!l.has(r))return r}}async function TC(n){const l=await EC(n);if(l===null)return null;const i=SC(n);return Ph+=1,{id:`att${Ph}`,kind:i,name:n.name||"файл",mediaType:n.type||(i==="text"?"text/plain":"application/octet-stream"),size:n.size,data:l}}async function AC(n){var j,N;if(!n.type.startsWith("image/")||n.size>vC)return null;const l=await MC(n);if(!l)return null;const{width:i,height:r}=l;if(i<=0||r<=0)return null;const o=Math.min(1,jC/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 f=u.getContext("2d");if(!f)return null;f.drawImage(l.image,0,0,u.width,u.height),(N=(j=l.image).close)==null||N.call(j);const g=n.type==="image/png",x=g?"image/png":"image/jpeg",_=u.toDataURL(x,g?void 0:NC),b=_.slice(_.indexOf(",")+1);return b?(Ph+=1,{id:`att${Ph}`,mediaType:x,data:b,previewUrl:_}):null}async function MC(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 Sv({disabled:n,busy:l,commands:i,sessionTitle:r,contextResult:o,className:u,placeholder:f,draftKey:g,sendLabel:x="Отправить",autoFocus:_=!1,attachmentsEnabled:b=!0,sendBlocked:j=!1,longPasteThreshold:N=0,queueWhileBusy:k=!1,insertRequest:w=null,onInsertConsumed:E,onContextSearch:C,onCommand:T,onSend:z,onInterrupt:q,onEscape:te}){var Bn;const I=ru(mC),[R,$]=p.useState(()=>g?wp(g):""),[Q,ee]=p.useState(!1),[G,B]=p.useState(0),F=p.useRef(null),le=p.useRef(null),ue=p.useRef(!1),ce=p.useRef(null),[D,O]=p.useState(()=>g?wp(g).length:0),[H,J]=p.useState(()=>g?[...Sp(g).images]:[]),[re,A]=p.useState(()=>g?[...Sp(g).docs]:[]),V=p.useRef([]),U=p.useRef([]);V.current=H,U.current=re;const[be,P]=p.useState(null),[ie,Me]=p.useState(!1),[Ke,Ne]=p.useState(!1),Be=p.useRef(0),Xe=p.useRef(null),Ze=p.useCallback(K=>{!b||K.length===0||(async()=>{const ge=[],Re=[];let He=!1;const wt=()=>V.current.length+U.current.length>=Ho.maxCount;for(const Dt of K){if(wt()){He=!0;break}if(Dt.type.startsWith("image/")){const Lt=await AC(Dt);if(!Lt){ge.push(Dt.name||"изображение");continue}V.current=[...V.current,Lt],J(V.current);continue}if(U.current.reduce((Lt,qs)=>Lt+qs.size,0)+Dt.size>Ho.maxTotalBytes){Re.push(Dt.name||"файл");continue}const Tn=await TC(Dt);if(!Tn){ge.push(Dt.name||"файл");continue}U.current=[...U.current,Tn],A(U.current)}const on=[];He&&on.push(`К сообщению можно приложить не больше ${Ho.maxCount} вложений.`),Re.length>0&&on.push(`Документы вместе не больше ${Ng(Ho.maxTotalBytes)}: не добавлено — ${Re.join(", ")}.`),ge.length>0&&on.push(`Не удалось прочитать: ${ge.join(", ")}.`),on.length>0&&P({ok:!1,message:on.join(" ")})})()},[b]);function an(K){J(ge=>ge.filter(Re=>Re.id!==K))}function We(K){A(ge=>ge.filter(Re=>Re.id!==K))}function Bt(K){var He;if(!b)return;const ge=(He=K.clipboardData)==null?void 0:He.items;if(!ge)return;const Re=[];for(const wt of ge){if(wt.kind!=="file")continue;const on=wt.getAsFile();on&&Re.push(on)}if(Re.length===0){Ye(K);return}K.preventDefault(),Ze(Re)}function Ye(K){var on;if(N<=0)return;const ge=((on=K.clipboardData)==null?void 0:on.getData("text/plain"))??"";if(ge.length<=N)return;const Re=new File([ge],CC(U.current.map(Dt=>Dt.name)),{type:"text/markdown"}),He=V.current.length+U.current.length,wt=U.current.reduce((Dt,Hn)=>Dt+Hn.size,0);if(He>=Ho.maxCount||wt+Re.size>Ho.maxTotalBytes){P({ok:!1,message:"Длинная вставка не влезла в лимит вложений — вставлена в поле текстом."});return}K.preventDefault(),Ze([Re])}function ct(K){const ge=K.target.files?Array.from(K.target.files):[];K.target.value="",Ze(ge)}const xe=K=>b&&!n&&Array.from(K.dataTransfer.types).includes("Files"),$e=K=>!n&&hg(K.dataTransfer);function ye(K){if($e(K)){K.preventDefault(),Be.current+=1,Ne(!0);return}xe(K)&&(K.preventDefault(),Be.current+=1,Me(!0))}function Qe(K){if($e(K)){K.preventDefault(),K.dataTransfer.dropEffect="copy";return}xe(K)&&(K.preventDefault(),K.dataTransfer.dropEffect="copy")}function rn(K){!xe(K)&&!$e(K)||(Be.current=Math.max(0,Be.current-1),Be.current===0&&(Me(!1),Ne(!1)))}function kt(K){if($e(K)){K.preventDefault(),Be.current=0,Ne(!1);const ge=G0(K.dataTransfer);ge&&os(ge);return}xe(K)&&(K.preventDefault(),Be.current=0,Me(!1),Ze(Array.from(K.dataTransfer.files)))}p.useEffect(()=>{b||(J([]),A([]))},[b]);const[ht,_s]=p.useState([]),[On,fn]=p.useState(-1),Mt=p.useRef(""),[zt,Ce]=p.useState(""),Te=hC(p.useCallback((K,ge)=>{K&&$(Re=>Qp(Re,K)),Ce(ge.trim())},[])),Ie=zt?Qp(R,zt):R;p.useEffect(()=>{Te.listening||zt===""||($(K=>Qp(K,zt)),Ce(""))},[Te.listening,zt]),p.useEffect(()=>{var K;_&&((K=F.current)==null||K.focus())},[_]);const st=p.useRef(new Map),_t=p.useRef(new Map),bt=p.useRef(g),yt=p.useRef({text:R,caret:D});yt.current={text:R,caret:D};const zn=p.useCallback((K,ge,Re)=>{ge===""?(st.current.delete(K),_t.current.delete(K)):(st.current.set(K,ge),_t.current.set(K,Re)),o0(K,ge)},[]),_e=Te.drop;p.useLayoutEffect(()=>{const K=bt.current;if(K===g)return;bt.current=g,K&&zn(K,yt.current.text,yt.current.caret);const ge=g?st.current.get(g)??wp(g):"",Re=g?_t.current.get(g):void 0,He=Math.min(Re??ge.length,ge.length);$(ge),O(He),ce.current=[He,He],K&&nb(K,{images:V.current,docs:U.current});const wt=g?Sp(g):{images:[],docs:[]};V.current=[...wt.images],U.current=[...wt.docs],J(V.current),A(U.current),Ce(""),B(0),ee(!1),fn(-1),Mt.current="",_e()},[g,zn,_e]),p.useEffect(()=>{g&&zn(g,R,D)},[g,R,D,zn]),p.useEffect(()=>{g&&(H!==V.current||re!==U.current||nb(g,{images:H,docs:re}))},[g,H,re]);const Ae=n?"Выберите сессию":j?"Нет VPN — отправка остановлена":f??"Опишите задачу… («/» — команды, «@» — файлы)",Je=p.useRef(0),rt=p.useCallback(K=>{const ge=parseFloat(getComputedStyle(K).maxHeight),Re=Number.isFinite(ge)&&ge>0?ge:yC;K.style.height="auto";const He=K.scrollHeight;K.style.height=`${Math.min(He,Re)}px`,K.style.overflowY=He>Re?"auto":"hidden"},[]);p.useEffect(()=>{const K=F.current;K&&rt(K)},[Ie,Ae,n,rt]),p.useLayoutEffect(()=>{const K=F.current,ge=ce.current;!K||!ge||(ce.current=null,K.setSelectionRange(ge[0],ge[1]))}),p.useEffect(()=>{const K=F.current;if(!K)return;const ge=new ResizeObserver(([Re])=>{const He=Re==null?void 0:Re.contentRect.width;He===void 0||Math.abs(He-Je.current)<1||(Je.current=He,rt(K))});return ge.observe(K),()=>ge.disconnect()},[rt]);const it=Te.stop;p.useEffect(()=>{n&&it()},[n,it]);const en=p.useMemo(()=>Te.error?{ok:!1,message:Te.error}:null,[Te.error]),dt=p.useMemo(()=>{var Re;const K=(Re=jy.exec(R))==null?void 0:Re[1];if(K===void 0)return[];const ge=K.toLowerCase();return i.filter(He=>!gC(He)&&Pp(He,ge)<Ev).sort((He,wt)=>Pp(He,ge)-Pp(wt,ge))},[R,i]),gt=!Q&&dt.length>0,bs=Math.min(G,dt.length-1),In=Q?null:((Bn=Ny.exec(Ie.slice(0,D)))==null?void 0:Bn[1])??null,As=p.useRef(C);As.current=C,p.useEffect(()=>{if(In===null||In===""||In.endsWith("/")){As.current(In);return}const K=setTimeout(()=>As.current(In),_C);return()=>clearTimeout(K)},[In]);const cs=In!==null&&(o==null?void 0:o.query)===In,Cn=cs?o.entries:[],$n=In!==null,Ms=$n&&!cs,cn=Math.min(G,Math.max(Cn.length-1,0));p.useEffect(()=>{var ge,Re;if(!gt&&!$n)return;const K=gt?bs:cn;(Re=(ge=le.current)==null?void 0:ge.children[K])==null||Re.scrollIntoView({block:"nearest"})},[gt,$n,bs,cn]);function hn(K,ge){var Re;$(K),O(ge),ce.current=[ge,ge],B(0),ee(!1),zt!==""&&(Ce(""),Te.drop()),(Re=F.current)==null||Re.focus()}const ns=(w==null?void 0:w.token)??null;p.useEffect(()=>{if(!w)return;const K=yt.current.text,ge=K.trim()?`${K.trimEnd()}
|
|
146
|
+
|
|
147
|
+
${w.text}`:w.text;hn(ge,ge.length),E==null||E(w.token)},[ns]);function mn(){$(""),Ce(""),B(0),O(0),ee(!1),fn(-1),Mt.current="",J([]),A([]),Te.drop(),g&&zn(g,"",0)}function Un(K){const ge=K.trim();if(ge===""&&H.length===0&&re.length===0||n||j||ue.current)return;const Re=z(ge,H.length>0?H.map(He=>({mediaType:He.mediaType,data:He.data})):void 0,re.length>0?re.map(({kind:He,name:wt,mediaType:on,size:Dt,data:Hn})=>({kind:He,name:wt,mediaType:on,size:Dt,data:Hn})):void 0);if(Re instanceof Promise){ue.current=!0,Re.then(He=>{ue.current=!1,He&&pn(ge)},()=>{ue.current=!1});return}Re!==!1&&pn(ge)}function pn(K){K!==""&&_s(ge=>[K,...ge.filter(Re=>Re!==K)].slice(0,bC)),mn()}function Tt(K){if(K<-1||K>=ht.length)return;On===-1&&(Mt.current=R);const ge=K===-1?Mt.current:ht[K]??"";fn(K),hn(ge,ge.length)}function gn(){var He;const K=((He=F.current)==null?void 0:He.selectionStart)??Ie.length,Re=`${K>0&&!/\s$/.test(Ie.slice(0,K))?" ":""}@`;hn(Ie.slice(0,K)+Re+Ie.slice(K),K+Re.length)}function os(K){const ge=F.current,Re=(ge==null?void 0:ge.selectionStart)??Ie.length,He=(ge==null?void 0:ge.selectionEnd)??Re,wt=Ie.slice(0,Re),Dt=`${wt!==""&&!/\s$/.test(wt)?" ":""}@${K.path}${K.kind==="dir"?"/":""} `;hn(wt+Dt+Ie.slice(He),Re+Dt.length)}function us(K){var wt;const ge=(wt=Ny.exec(Ie.slice(0,D)))==null?void 0:wt[1];if(ge===void 0)return;const Re=D-ge.length-1,He=K.kind==="dir"?`@${K.path}/`:`@${K.path} `;hn(Ie.slice(0,Re)+He+Ie.slice(D),Re+He.length)}function Hs(){var ge;if(j)return;const K=(ge=jy.exec(Ie.trim()))==null?void 0:ge[1];if(K&&T(K)){mn();return}Un(Ie)}function xl(K,ge){$(K),O(ge),B(0),ee(!1),fn(-1),zt!==""&&(Ce(""),Te.drop())}function _l(K){var He;const ge=xC.has(K.name)?r:null,Re=`/${K.name} `;$(Re+(ge??"")),O(Re.length+((ge==null?void 0:ge.length)??0)),ge&&(ce.current=[Re.length,Re.length+ge.length]),B(0),(He=F.current)==null||He.focus()}function At(K){if(T(K.name)){$(""),B(0),ee(!1);return}K.argumentHint?_l(K):Un(`/${K.name}`)}function Rs(K){if(gt){if(K.key==="ArrowDown")return K.preventDefault(),B(ge=>(Math.min(ge,dt.length-1)+1)%dt.length);if(K.key==="ArrowUp"){K.preventDefault();const ge=dt.length-1;return B(Re=>(Math.min(Re,ge)+ge)%dt.length)}if(K.key==="Enter"&&!K.shiftKey){K.preventDefault();const ge=dt[bs];ge&&At(ge);return}if(K.key==="Tab"){K.preventDefault();const ge=dt[bs];ge&&_l(ge);return}if(K.key==="Escape"){K.preventDefault(),K.stopPropagation(),ee(!0);return}}if($n){if(K.key==="ArrowDown"&&Cn.length>0)return K.preventDefault(),B(ge=>(Math.min(ge,Cn.length-1)+1)%Cn.length);if(K.key==="ArrowUp"&&Cn.length>0){K.preventDefault();const ge=Cn.length-1;return B(Re=>(Math.min(Re,ge)+ge)%Cn.length)}if(K.key==="Enter"&&!K.shiftKey||K.key==="Tab"){const ge=Cn[cn];if(ge){K.preventDefault(),us(ge);return}if(K.key==="Tab")return}if(K.key==="Escape"){K.preventDefault(),K.stopPropagation(),ee(!0);return}}if((K.key==="ArrowUp"||K.key==="ArrowDown")&&!K.shiftKey){const ge=K.currentTarget,Re=ge.selectionStart;if(ge.selectionEnd===Re){const wt=K.key==="ArrowUp"?On+1:On-1;wt>=-1&&wt<ht.length&&requestAnimationFrame(()=>{ge.selectionStart===Re&&ge.selectionEnd===Re&&Tt(wt)})}}if(K.key==="Escape"&&te){K.preventDefault(),K.stopPropagation(),te();return}K.key==="Enter"&&!K.shiftKey&&!I&&(K.preventDefault(),Hs())}return s.jsx("div",{className:(u?`composer ${u}`:"composer")+(ie||Ke?" is-dragging":""),onDragEnter:ye,onDragOver:Qe,onDragLeave:rn,onDrop:kt,children:s.jsxs("div",{className:"composer__inner",children:[s.jsx(Pr,{result:en}),s.jsx(Pr,{result:be}),ie&&s.jsx("div",{className:"composer__drop","aria-hidden":"true",children:"Отпустите, чтобы прикрепить"}),Ke&&s.jsx("div",{className:"composer__drop","aria-hidden":"true",children:"Отпустите, чтобы упомянуть"}),$n&&!gt&&s.jsxs("div",{className:"cmdmenu",role:"listbox",ref:le,children:[Cn.map((K,ge)=>s.jsxs("button",{role:"option","aria-selected":ge===cn,className:ge===cn?"cmdmenu__row is-on":"cmdmenu__row",onMouseEnter:()=>B(ge),onMouseDown:Re=>{Re.preventDefault(),us(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)),Cn.length===0&&s.jsx("div",{className:"cmdmenu__empty",children:Ms?"ищем…":In?"Ничего не нашлось":"Наберите имя файла или каталога"})]}),gt&&s.jsx("div",{className:"cmdmenu",role:"listbox",ref:le,children:dt.map((K,ge)=>s.jsxs("button",{role:"option","aria-selected":ge===bs,className:ge===bs?"cmdmenu__row is-on":"cmdmenu__row",onMouseEnter:()=>B(ge),onMouseDown:Re=>{Re.preventDefault(),At(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))}),(H.length>0||re.length>0)&&s.jsxs("div",{className:"composer__attachments",children:[H.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:()=>an(K.id),children:s.jsx(IC,{})})]},K.id)),re.map(K=>s.jsx(xv,{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:gn,children:s.jsx(LC,{})}),b&&s.jsxs(s.Fragment,{children:[s.jsx("input",{ref:Xe,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=Xe.current)==null?void 0:K.click()},children:s.jsx(zC,{})})]}),s.jsx("textarea",{ref:F,value:Ie,disabled:n,placeholder:Ae,onChange:K=>xl(K.target.value,K.target.selectionStart),onSelect:K=>O(K.currentTarget.selectionStart),onKeyDown:Rs,onPaste:Bt}),Te.supported&&s.jsx("button",{type:"button",className:Te.listening?"micbtn is-on":"micbtn",title:Te.listening?"Остановить диктовку":"Продиктовать промпт","aria-label":Te.listening?"Остановить диктовку":"Продиктовать промпт","aria-pressed":Te.listening,disabled:n,onClick:Te.toggle,children:s.jsx($C,{on:Te.listening})}),l&&k&&s.jsx("button",{type:"button",className:"btn",onClick:Hs,disabled:n||j||Ie.trim()===""&&H.length===0&&re.length===0,title:j?"Нет VPN — отправка остановлена":"Поставить в очередь (Enter)",children:"В очередь"}),l?s.jsx("button",{className:"btn",onClick:q,title:"Прервать (Esc)",children:"Стоп"}):s.jsxs("button",{className:"btn btn--primary sendbtn",onClick:Hs,disabled:n||j||Ie.trim()===""&&H.length===0&&re.length===0,"aria-label":x,title:j?"Нет VPN — отправка остановлена":x,children:[s.jsx("span",{className:"sendbtn__label",children:x}),s.jsx(OC,{})]})]})]})})}function Qp(n,l){const i=l.trim();if(i==="")return n;const r=Eg(i).slice(RC(n,i)).join(" ");return r===""?n:n===""||/\s$/.test(n)?n+r:`${n} ${r}`}function RC(n,l){const i=Eg(n),r=Eg(l);for(let o=Math.min(i.length,r.length);o>0;o--)if(i.slice(i.length-o).every((u,f)=>DC(u,r[f]??"")))return o;return 0}function Eg(n){return n.split(/\s+/).filter(l=>l!=="")}function DC(n,l){const i=r=>r.toLowerCase().replace(/[.,!?;:…]+$/u,"");return i(n)===i(l)}function LC(){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 OC(){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 zC(){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 IC(){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 $C({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 Ev=4;function Pp(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:Ev}function UC({request:n,plan:l,queued:i,collapsed:r,onCollapse:o,onAccept:u,onDecline:f}){const[g,x]=p.useState(l),[_,b]=p.useState("preview");p.useEffect(()=>{x(l),b("preview")},[n.requestId,l]);const j=g.trim().length>0;function N(){j&&u(n.requestId,g)}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(tx,{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(BC,{text:g}):s.jsx("textarea",{className:"plansheet__source",value:g,onChange:k=>x(k.target.value),spellCheck:!1,"aria-label":"Текст плана — можно отредактировать перед тем, как согласиться",autoFocus:!0})})]}),s.jsxs("div",{className:"plansheet__actions",children:[s.jsx("button",{className:"btn",onClick:()=>f(n.requestId),children:"Доработать"}),s.jsx("button",{className:"btn btn--ok",disabled:!j,autoFocus:!0,onClick:N,children:"Одобрить план"})]})]})})}function BC({text:n}){const[l,i]=p.useState("");return p.useEffect(()=>{let r=!1;return Gd(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 HC({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 tx({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 qC({request:n,queued:l,collapsed:i,onCollapse:r,onDecide:o}){const u=gv(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(tx,{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((f,g)=>s.jsx(Jg,{diff:f},g)):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 GC({request:n,queued:l,collapsed:i,onCollapse:r,onAnswer:o,onDecline:u}){const{questions:f}=n,[g,x]=p.useState(()=>f.map(()=>new Set)),[_,b]=p.useState(()=>f.map(()=>"")),[j,N]=p.useState(()=>wy(f));p.useEffect(()=>{x(f.map(()=>new Set)),b(f.map(()=>"")),N(wy(f))},[n.requestId]);const k=p.useMemo(()=>VC(f,g,_),[f,g,_]),w=k!==null;function E(I,R){var $,Q;(Q=($=f[I])==null?void 0:$.options[R])!=null&&Q.preview&&N(ee=>{const G=ee.slice();return G[I]=R,G})}function C(I,R,$){x(Q=>{const ee=Q.slice(),G=new Set(ee[I]);return $?G.has(R)?G.delete(R):G.add(R):G.has(R)||(G.clear(),G.add(R)),ee[I]=G,ee}),R!=="other"&&E(I,R)}function T(I,R){b($=>{const Q=$.slice();return Q[I]=R,Q})}function z(){k&&o(n.requestId,k)}function q(I){I.key==="Enter"&&(I.target.closest("button")||w&&(I.preventDefault(),z()))}function te(I){var ee;if(!["ArrowDown","ArrowUp","ArrowRight","ArrowLeft"].includes(I.key))return;const R=Array.from(I.currentTarget.querySelectorAll("button.qsheet__option")),$=R.indexOf(document.activeElement);if($===-1)return;I.preventDefault();const Q=I.key==="ArrowDown"||I.key==="ArrowRight"?1:-1;(ee=R[($+Q+R.length)%R.length])==null||ee.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:q,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:[f.length===1?"Уточняющий вопрос":`Уточняющие вопросы (${f.length})`,l>0&&` — ещё ${l} в очереди`]}),s.jsx(tx,{onClick:r})]}),s.jsxs("div",{className:"qsheet__body",children:[n.reason&&s.jsx("p",{className:"qsheet__reason",children:n.reason}),f.map((I,R)=>s.jsx(YC,{q:I,qi:R,selected:g[R]??new Set,otherText:_[R]??"",previewIndex:j[R]??null,onToggle:C,onFocusOption:E,onOtherText:T,onOptionsKeyDown:te},R))]}),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:!w,onClick:z,children:"Ответить"})]})]})})}function YC({q:n,qi:l,selected:i,otherText:r,previewIndex:o,onToggle:u,onFocusOption:f,onOtherText:g,onOptionsKeyDown:x}){var k;const _=n.options.some(w=>w.preview),b=o!==null?(k=n.options[o])==null?void 0:k.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:x,children:[n.options.map((w,E)=>{const C=i.has(E);return s.jsxs("button",{type:"button",role:N,"aria-checked":C,className:"qsheet__option"+(C?" is-selected":""),onClick:()=>u(l,E,n.multiSelect),onFocus:()=>f(l,E),onMouseEnter:()=>f(l,E),children:[s.jsx("span",{className:"qsheet__opt-mark","aria-hidden":"true"}),s.jsxs("span",{className:"qsheet__opt-body",children:[s.jsx("span",{className:"qsheet__opt-label",children:w.label}),s.jsx("span",{className:"qsheet__opt-desc",children:w.description})]})]},E)}),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:w=>g(l,w.target.value),autoFocus:!0})]})]}),_&&s.jsx("pre",{className:"qsheet__preview",children:b??""})]})}function wy(n){return n.map(l=>{const i=l.options.findIndex(r=>r.preview);return i===-1?null:i})}function VC(n,l,i){const r={};for(let o=0;o<n.length;o++){const u=n[o];if(!u)continue;const f=l[o]??new Set,g=[];for(let x=0;x<u.options.length;x++){const _=u.options[x];_&&f.has(x)&&g.push(_.label)}if(f.has("other")){const x=(i[o]??"").trim();x&&g.push(x)}if(g.length===0)return null;r[u.question]=g.join(", ")}return r}function FC(n,l){if(n!=="ExitPlanMode"||!l||typeof l!="object")return null;const i=l.plan;return typeof i=="string"?i:null}function Tv({path:n}){const[l,i]=p.useState(!1),[r,o]=p.useState(!1),u=p.useRef(null);p.useEffect(()=>{if(!l)return;function g(x){var _;(_=u.current)!=null&&_.contains(x.target)||i(!1)}return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[l]),p.useEffect(()=>{if(!r)return;const g=setTimeout(()=>o(!1),Kg);return()=>clearTimeout(g)},[r]),p.useEffect(()=>i(!1),[n]);async function f(){await oi(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(g=>!g),onKeyDown:g=>{g.key!=="Escape"||!l||(g.preventDefault(),g.stopPropagation(),i(!1))},children:[s.jsx(XC,{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 f(),children:r?Zo:qc})]})]})}function XC({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"})})}function Ml({value:n,options:l,onChange:i,className:r,title:o,ariaLabel:u,placeholder:f="—"}){const[g,x]=p.useState(!1),[_,b]=p.useState(0),j=p.useRef(null),N=p.useRef(null),k=l.find(C=>C.value===n)??null;p.useEffect(()=>{if(!g)return;const C=l.findIndex(T=>T.value===n);b(C===-1?0:C)},[g]),p.useEffect(()=>{if(!g)return;function C(T){var z;(z=j.current)!=null&&z.contains(T.target)||x(!1)}return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[g]),p.useEffect(()=>{var C,T;g&&((T=(C=N.current)==null?void 0:C.querySelector(".is-cursor"))==null||T.scrollIntoView({block:"nearest"}))},[g,_]),p.useEffect(()=>{if(!g)return;const C=N.current,T=KC(j.current);if(!C||!T)return;const z=C.getBoundingClientRect().bottom-T.getBoundingClientRect().bottom;z>0&&(T.scrollTop+=Math.min(z+8,C.offsetHeight))},[g]);function w(C){x(!1),C.value!==n&&i(C.value)}function E(C){if(C.key==="Escape"){if(!g)return;C.preventDefault(),C.stopPropagation(),x(!1);return}if(C.key==="ArrowDown"||C.key==="ArrowUp"){if(C.preventDefault(),!g)return x(!0);const T=C.key==="ArrowDown"?1:l.length-1;return b(z=>(z+T)%l.length)}if(C.key==="Enter"||C.key===" "){if(C.preventDefault(),!g)return x(!0);const T=l[_];T&&w(T)}}return s.jsxs("div",{ref:j,className:"select"+(g?" select--open":"")+(r?` ${r}`:""),children:[s.jsxs("button",{type:"button",className:"select__trigger",title:o,"aria-label":u??o,"aria-haspopup":"listbox","aria-expanded":g,onClick:()=>x(C=>!C),onKeyDown:E,children:[s.jsx("span",{className:"select__value",children:(k==null?void 0:k.label)??f}),s.jsx(QC,{})]}),g&&s.jsx("div",{ref:N,className:"select__menu",role:"listbox","aria-label":u??o,children:l.map((C,T)=>s.jsxs("button",{type:"button",role:"option","aria-selected":C.value===n,className:"select__option"+(T===_?" is-cursor":"")+(C.value===n?" is-on":""),onMouseEnter:()=>b(T),onClick:()=>w(C),children:[s.jsx("span",{className:"select__check","aria-hidden":"true",children:C.value===n?"✓":""}),s.jsx("span",{className:"select__label",children:C.label}),C.hint&&s.jsx("span",{className:"select__hint",children:C.hint})]},C.value))})]})}function KC(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 QC(){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"})})}const PC=["low","medium","high"];function Av({models:n,value:l,effort:i,ultracode:r,thinking:o,switchOnFlag:u,showSwitchOnFlag:f=!0,className:g,onModel:x,onEffort:_,onUltracode:b,onThinking:j,onSwitchOnFlag:N}){const[k,w]=p.useState(!1),[E,C]=p.useState(0),T=p.useRef(null),z=p.useRef(null),q=n.find(Q=>Q.value===l)??null,te=q&&q.supportsEffort?q.effortLevels.length>0?q.effortLevels:PC:[],I=te.includes("xhigh");p.useEffect(()=>{if(!k)return;const Q=n.findIndex(ee=>ee.value===l);C(Q===-1?0:Q)},[k]),p.useEffect(()=>{if(!k)return;function Q(ee){var G;(G=T.current)!=null&&G.contains(ee.target)||w(!1)}return document.addEventListener("mousedown",Q),()=>document.removeEventListener("mousedown",Q)},[k]),p.useEffect(()=>{var Q,ee;k&&((ee=(Q=z.current)==null?void 0:Q.querySelector(".is-cursor"))==null||ee.scrollIntoView({block:"nearest"}))},[k,E]);function R(Q){w(!1),Q.value!==l&&x(Q.value)}function $(Q){if(Q.key==="Escape"){if(!k)return;Q.preventDefault(),Q.stopPropagation(),w(!1);return}if(Q.key==="ArrowDown"||Q.key==="ArrowUp"){if(Q.preventDefault(),!k)return w(!0);if(n.length===0)return;const ee=Q.key==="ArrowDown"?1:n.length-1;return C(G=>(G+ee)%n.length)}if(Q.key==="Enter"||Q.key===" "){if(Q.preventDefault(),!k)return w(!0);const ee=n[E];ee&&R(ee)}}return s.jsxs("div",{ref:T,className:"select"+(k?" select--open":"")+(g?` ${g}`:""),children:[s.jsxs("button",{type:"button",className:"select__trigger",title:"Модель, усилие и размышления","aria-label":"Модель, усилие и размышления","aria-haspopup":"menu","aria-expanded":k,onClick:()=>w(Q=>!Q),onKeyDown:$,children:[(q==null?void 0:q.displayName)??l?s.jsx("span",{className:"select__value",children:(q==null?void 0:q.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(ZC,{})]}),k&&s.jsxs("div",{ref:z,className:"select__menu modelmenu",role:"menu",children:[s.jsx("div",{className:"modelmenu__head",children:"Модель"}),n.map((Q,ee)=>s.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":Q.value===l,className:"select__option"+(ee===E?" is-cursor":"")+(Q.value===l?" is-on":""),onMouseEnter:()=>C(ee),onClick:()=>R(Q),children:[s.jsx("span",{className:"select__check","aria-hidden":"true",children:Q.value===l?"✓":""}),s.jsx("span",{className:"select__label",children:Q.displayName}),Q.description&&s.jsx("span",{className:"select__hint",children:Q.description})]},Q.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(Q=>s.jsx("button",{type:"button",role:"menuitemradio","aria-checked":Q===i,className:Q===i?"modelmenu__level is-on":"modelmenu__level",onClick:()=>_(Q),children:Q},Q))})]}),I&&s.jsx(Zp,{label:"Ultracode",desc:"xhigh и постоянная оркестрация подагентами",on:r,onToggle:()=>b(!r)})]}),s.jsx("div",{className:"modelmenu__sep",role:"separator"}),(q==null?void 0:q.supportsThinking)!==!1&&s.jsx(Zp,{label:"Размышления",desc:"расширенное обдумывание перед ответом",on:o,onToggle:()=>j(!o)}),f&&s.jsx(Zp,{label:"Менять модель по флагу",desc:"иначе помеченный ход встаёт на паузу",on:u,onToggle:()=>N(!u)})]})]})}function Zp({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 ZC(){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 WC({candidates:n,searching:l,agentItems:i,agentBusy:r,error:o,roots:u,created:f,onSearch:g,onAskAgent:x,onInterrupt:_,onSubmit:b,onCreate:j,onClose:N}){const[k,w]=p.useState("open"),[E,C]=p.useState(""),[T,z]=p.useState(!1),[q,te]=p.useState(""),[I,R]=p.useState(""),[$,Q]=p.useState({git:!0,claudeMd:!0,readme:!0}),ee=E.trim(),G=ee!=="",B=q.trim(),F=I.trim(),le=F!==""&&B!=="";p.useEffect(()=>{q===""&&u.length>0&&te(u[0])},[u]);const ue=p.useRef(g);ue.current=g,p.useEffect(()=>{if(k!=="open")return;const H=E.trim(),J=setTimeout(()=>ue.current(H),200);return()=>clearTimeout(J)},[E,k]);function ce(){G&&b(ee)}function D(){le&&j(B,F,$)}function O(){G&&(z(!0),x(ee))}return f?s.jsxs(Sn,{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:f.path}),s.jsx("div",{className:"modal__error",children:s.jsx("ul",{className:"newproj__warnings",children:f.warnings.map(H=>s.jsx("li",{children:H},H))})}),s.jsx("p",{className:"modal__text modal__text--dim",children:"Проект открыт и работает — недостающее можно добавить руками, в дереве файлов или из терминала."})]}):s.jsxs(Sn,{title:"Новый проект",className:T&&k==="open"?"modal--wide":void 0,onClose:N,actions:s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn",onClick:N,children:"Отмена"}),k==="open"?s.jsxs(s.Fragment,{children:[r?s.jsx("button",{className:"btn",onClick:_,children:"Остановить"}):s.jsx("button",{className:"btn",disabled:!G,onClick:O,title:"Найти по описанию",children:"Попросить агента"}),s.jsx("button",{className:"btn btn--primary",disabled:!G,onClick:ce,children:"Открыть"})]}):s.jsx("button",{className:"btn btn--primary",disabled:!le,onClick:D,children:"Создать"})]}),children:[s.jsxs("div",{className:"tabs",children:[s.jsx(Sy,{label:"Открыть",on:k==="open",onClick:()=>w("open")}),s.jsx(Sy,{label:"Создать",on:k==="create",onClick:()=>w("create")})]}),k==="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:E,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"C:\\Projects\\my-app",onChange:H=>C(H.target.value),onKeyDown:H=>{H.key==="Enter"&&(H.preventDefault(),ce())}}),o&&s.jsx("p",{className:"modal__error",children:o}),n.length>0&&s.jsx("ul",{className:"finds",children:n.map(H=>s.jsx("li",{children:s.jsxs("button",{className:"find",disabled:H.open,title:H.open?"Этот проект уже открыт":H.path,onClick:()=>C(H.path),onDoubleClick:()=>b(H.path),children:[s.jsx("span",{className:"find__name",children:H.name}),s.jsx("span",{className:"find__path",children:H.path}),s.jsx("span",{className:"find__note",children:tT(H)})]})},H.path))}),n.length===0&&G&&!l&&!T&&s.jsx("p",{className:"modal__text modal__text--dim",children:"Ничего похожего среди каталогов, где вы работали. Если помните не имя, а суть проекта — опишите его и нажмите «Попросить агента». Проекта ещё нет вовсе — рядом вкладка «Создать»."}),T&&s.jsx("div",{className:"finds__agent",children:s.jsx(ex,{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:q,spellCheck:!1,autoComplete:"off",placeholder:"C:\\Projects",onChange:H=>te(H.target.value)}),u.length>0&&s.jsx("div",{className:"newproj__roots",children:u.map(H=>s.jsx("button",{type:"button",className:H===B?"newproj__root is-on":"newproj__root",title:H,onClick:()=>te(H),children:eT(H)},H))}),s.jsx("label",{className:"field newproj__field",htmlFor:"workspace-name",children:"Имя проекта"}),s.jsx("input",{id:"workspace-name",className:"input input--mono",value:I,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"my-app",onChange:H=>R(H.target.value),onKeyDown:H=>{H.key==="Enter"&&(H.preventDefault(),D())}}),s.jsx("p",{className:"newproj__preview",children:le?JC(B,F):"Каталог появится здесь"}),o&&s.jsx("p",{className:"modal__error",children:o}),s.jsxs("div",{className:"newproj__opts",children:[s.jsx(Wp,{label:"git init",desc:"панель истории работает сразу",on:$.git,onToggle:()=>Q(H=>({...H,git:!H.git}))}),s.jsx(Wp,{label:"CLAUDE.md",desc:"заготовка инструкций для агента",on:$.claudeMd,onToggle:()=>Q(H=>({...H,claudeMd:!H.claudeMd}))}),s.jsx(Wp,{label:"README.md",desc:"по нему проект потом узнаёт поиск",on:$.readme,onToggle:()=>Q(H=>({...H,readme:!H.readme}))})]})]})]})}function Sy({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 Wp({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 JC(n,l){const i=n.includes("\\")?"\\":"/";return n.replace(/[\\/]+$/,"")+i+l}function eT(n){const l=n.includes("\\")?"\\":"/",i=n.split(/[\\/]/).filter(Boolean);return i.length<=2?n:`…${l}${i.slice(-2).join(l)}`}function tT(n){return n.open?"уже открыт":n.why?n.why:n.sessions===0?"рядом с вашими проектами":`${nT(n.sessions)}${sT(n.lastUsedAt)}`}function nT(n){const l=n%10,i=n%100;return i>=11&&i<=14?`${n} сессий`:l===1?`${n} сессия`:l>=2&&l<=4?`${n} сессии`:`${n} сессий`}function sT(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 nx=7;function lT(n){const l=[],i=[];let r=1;for(const o of n){const u=l.slice();let f=l.indexOf(o.hash);f===-1&&(f=Ey(l),l[f]=o.hash);const[g,...x]=o.parents;l[f]=g??null;const _=[];g!==void 0&&_.push({from:f,to:f});for(const N of x){let k=l.indexOf(N);k===-1&&(k=Ey(l),l[k]=N),_.push({from:f,to:k})}const b=[];for(let N=0;N<u.length;N++)u[N]===o.hash&&(b.push({from:N,to:f}),N!==f&&(l[N]=null));const j=[];for(let N=0;N<u.length;N++){const k=u[N];!k||k===o.hash||N===f||l[N]===k&&j.push(N)}aT(l),r=Math.max(r,l.length,f+1),i.push({commit:o,col:f,up:b,down:_,through:j})}return{rows:i,columns:Math.min(r,nx)}}function Ey(n){const l=n.indexOf(null);return l!==-1?l:(n.push(null),n.length-1)}function aT(n){for(;n.length>0&&n[n.length-1]===null;)n.pop()}function iT({open:n,state:l,result:i,selected:r,busy:o,onRefresh:u,onShow:f,onCheckout:g,onPush:x,onPull:_,onPublish:b,onConnectRemote:j,onDismissResult:N,onClose:k,zoomed:w,onToggleZoom:E}){const C=lT((l==null?void 0:l.commits)??[]),T=[...l!=null&&l.detached?[{value:"",label:`отделён · ${l.head.slice(0,8)}`}]:[],...((l==null?void 0:l.branches)??[]).map(z=>({value:z.name,label:z.name,hint:z.hash.slice(0,8)}))];return s.jsxs("aside",{className:(n?"sidepane sidepane--git sidepane--open":"sidepane sidepane--git")+(w?" sidepane--zoomed":""),"aria-label":"История git",children:[s.jsxs("div",{className:"sidepane__head",onDoubleClick:z=>{E&&(z.target.closest("button")||E())},children:[s.jsx(fT,{}),s.jsx("span",{className:"sidepane__title",children:"История"}),s.jsx("button",{className:"sidepane__btn",title:"Обновить","aria-label":"Обновить историю",onClick:u,children:"↻"}),E&&s.jsx("button",{className:"sidepane__btn",title:w?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":w?"Свернуть панель истории":"Развернуть панель истории на весь экран","aria-pressed":w,onClick:E,children:s.jsx(ou,{active:w})}),s.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель истории",onClick:k,children:"✕"})]}),l===null?s.jsx("p",{className:"sidepane__empty",children:"Читаем репозиторий…"}):l.available?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"gitbar",children:[s.jsx(Ml,{className:"gitbar__branch",title:"Ветка — выбрать значит переключиться",value:l.detached?"":l.branch,options:T,onChange:z=>{z&&g(z,`ветку ${z}`)}}),s.jsx(Ca,{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(gT,{}),o]}):l.hasRemote?s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button",className:"btn btn--sm",title:"Отправить текущую ветку в origin",onClick:x,children:[s.jsx(hT,{}),"Отправить",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(mT,{}),"Забрать",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(pT,{})})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button",className:"btn btn--sm btn--primary",title:"Создать репозиторий на GitHub и отправить в него ветку",onClick:b,children:[s.jsx(Ty,{}),"Опубликовать на 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:()=>f(""),children:s.jsxs("span",{className:"gitrow__body",children:[s.jsx("span",{className:"gitrow__subject",children:l.changed.length>0?`Рабочее дерево · ${l.changed.length} ${yT(l.changed.length)}`:"Рабочее дерево чистое"}),s.jsx("span",{className:"gitrow__meta",children:l.changed.length>0?l.changed.slice(0,4).map(z=>bT(z.path)).join(", "):"незакоммиченных изменений нет"})]})}),C.rows.map(z=>s.jsx(cT,{row:z,columns:C.columns,head:z.commit.hash===l.head,local:l.hasRemote&&!z.commit.pushed,active:r===z.commit.hash,onOpen:()=>f(z.commit.hash)},z.commit.hash)),C.rows.length===0&&s.jsx("p",{className:"sidepane__empty",children:"В репозитории ещё нет коммитов"})]})]}):s.jsxs("div",{className:"gitempty",children:[s.jsx("p",{className:"gitempty__text",children:l.message||"Это не git-репозиторий"}),l.noRepo&&s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button",className:"btn btn--sm btn--primary gitempty__btn",onClick:b,children:[s.jsx(Ty,{}),"Опубликовать на GitHub"]}),s.jsx("p",{className:"gitempty__hint",children:"Заведёт репозиторий, сделает первый коммит и отправит его на GitHub."})]})]}),s.jsx(Pr,{result:i,onDismiss:N})]})}const Ed=50,Cy=13,rT=500;function cT({row:n,columns:l,head:i,local:r,active:o,onOpen:u}){const{commit:f}=n,g=f.refs.map(xT).filter(Boolean),[x,_]=p.useState(null),b=p.useRef(null);function j(E){const C=E.touches[0];if(!C)return;const T={timer:0,x:C.clientX,y:C.clientY,fired:!1};T.timer=window.setTimeout(()=>{T.fired=!0,_({x:T.x,y:T.y})},rT),b.current=T}function N(E){const C=b.current,T=E.touches[0];!C||!T||Math.hypot(T.clientX-C.x,T.clientY-C.y)>10&&(window.clearTimeout(C.timer),b.current=null)}function k(E){const C=b.current;C&&(window.clearTimeout(C.timer),C.fired&&E.preventDefault())}function w(){const E=[{id:"hash",label:"Копировать хеш",hint:f.shortHash,onSelect:()=>void oi(f.hash)},{id:"short",label:"Копировать короткий хеш",onSelect:()=>void oi(f.shortHash)},{id:"subject",label:"Копировать сообщение",onSelect:()=>void oi(f.subject)}],C=new Set;for(const T of f.refs){const z=T.startsWith("tag: "),q=_T(T);!q||C.has(q)||(C.add(q),E.push({id:`ref:${q}`,label:z?"Копировать тег":"Копировать ветку",hint:q,onSelect:()=>void oi(q)}))}return E}return s.jsxs(s.Fragment,{children:[s.jsxs("button",{className:"gitrow"+(o?" is-on":""),title:r?"Коммит ещё не отправлен на удалённый репозиторий":void 0,onClick:()=>{var E;if((E=b.current)!=null&&E.fired){b.current=null;return}u()},onContextMenu:E=>{E.preventDefault(),_({x:E.clientX,y:E.clientY})},onTouchStart:j,onTouchMove:N,onTouchEnd:k,onTouchCancel:k,children:[s.jsx(oT,{row:n,columns:l,head:i,local:r}),s.jsxs("span",{className:"gitrow__body",children:[s.jsxs("span",{className:"gitrow__subject",children:[g.map(E=>s.jsx("span",{className:"gitrow__ref",children:E},E)),f.subject]}),s.jsxs("span",{className:"gitrow__meta",children:[f.shortHash," · ",f.author," · ",vT(f.date),r&&s.jsx("span",{className:"gitrow__local",children:"· не отправлен"})]})]})]}),x&&s.jsx(Qi,{x:x.x,y:x.y,items:w(),onClose:()=>_(null)})]})}function oT({row:n,columns:l,head:i,local:r}){const o=l*Cy+6,u=Ed/2,f=_=>8+Math.min(_,nx-1)*Cy,g=r?"3.5 2.5":void 0,x=vh(n.col);return s.jsxs("svg",{className:"gitgraph",width:o,height:Ed,viewBox:`0 0 ${o} ${Ed}`,"aria-hidden":"true",children:[n.through.map(_=>s.jsx("line",{x1:f(_),y1:0,x2:f(_),y2:Ed,style:{stroke:vh(_)}},`t${_}`)),n.up.map((_,b)=>s.jsx("path",{d:`M${f(_.from)} 0 L${f(_.from)} ${u-12} L${f(_.to)} ${u}`,fill:"none",style:{stroke:vh(_.from),strokeDasharray:g}},`u${b}`)),n.down.map((_,b)=>s.jsx("path",{d:`M${f(_.from)} ${u} L${f(_.to)} ${u+12} L${f(_.to)} ${Ed}`,fill:"none",style:{stroke:vh(_.to),strokeDasharray:g}},`d${b}`)),i&&s.jsx("circle",{className:"gitgraph__head",cx:f(n.col),cy:u,r:n.commit.parents.length>1?7.4:6.6}),s.jsx("circle",{className:"gitgraph__dot",cx:f(n.col),cy:u,r:n.commit.parents.length>1?4.6:3.6,style:{stroke:x,fill:r?void 0:x}})]})}function vh(n){return`var(--lane-${n%nx})`}function uT({detail:n,local:l,onCheckout:i,onClose:r}){const o=n.hash==="";return s.jsxs(Sn,{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(Ca,{text:n.subject,hint:"сообщение коммита"})]}),s.jsxs("p",{className:"commit__meta",children:[n.author,n.email&&` <${n.email}>`," · ",jT(n.date)]}),s.jsxs("div",{className:"commit__line commit__line--hash",children:[s.jsx("span",{className:"commit__hash",children:n.hash}),s.jsx(Ca,{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(dT,{file:u,defaultOpen:n.files.length<=3},u.path+u.oldPath))]})}function dT({file:n,defaultOpen:l}){const[i,r]=p.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(Jg,{diff:pv(n)})]})}function fT(){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 hT(){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 mT(){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 pT(){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 Ty(){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 gT(){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 xT(n){return n.replace(/^HEAD -> /,"").replace(/^tag: /,"⌂ ").trim()}function _T(n){const l=n.replace(/^HEAD -> /,"").replace(/^tag: /,"").trim();return l==="HEAD"?"":l}function bT(n){const l=n.split("/");return l[l.length-1]??n}function yT(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 vT(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 jT(n){const l=Date.parse(n);return Number.isNaN(l)?n:new Date(l).toLocaleString()}function Ay(n){return n.replace(/[^A-Za-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"")}function NT({status:n,owners:l,files:i,defaultName:r,hasCommits:o,busy:u,result:f,onRefreshStatus:g,onSaveToken:x,onPublish:_,onDismissResult:b,onClose:j}){var H;const[N,k]=p.useState(()=>Ay(r)),[w,E]=p.useState(""),[C,T]=p.useState(""),[z,q]=p.useState(!0),[te,I]=p.useState("Первый коммит"),[R,$]=p.useState(null),[Q,ee]=p.useState("");p.useEffect(()=>{!w&&l.length>0&&E(l[0].login)},[w,l]),p.useEffect(()=>{i&&R===null&&$(new Set(i.files))},[i,R]);const G=(n==null?void 0:n.connected)===!0,B=l.map(J=>({value:J.login,label:J.login,hint:J.kind==="org"?"организация":void 0})),F=p.useMemo(()=>{if(!i)return[];const J=Q.trim().toLowerCase();return J?i.files.filter(re=>re.toLowerCase().includes(J)):i.files},[i,Q]),le=(R==null?void 0:R.size)??0,ue=G&&N.trim()!==""&&w!==""&&u===""&&(o||le>0);function ce(J){$(re=>{const A=new Set(re??[]);return A.has(J)?A.delete(J):A.add(J),A})}function D(J){$(re=>{const A=new Set(re??[]);for(const V of F)J?A.add(V):A.delete(V);return A})}function O(){if(!ue)return;const J=(i==null?void 0:i.files)??[];_({owner:w,name:N.trim(),description:C.trim(),private:z,include:o?[]:J.filter(re=>R==null?void 0:R.has(re)),ignore:o?[]:J.filter(re=>!(R!=null&&R.has(re))),message:o?"":te.trim()||"Первый коммит"})}return s.jsxs(Sn,{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:!ue,onClick:O,children:u||"Опубликовать"})]}),children:[s.jsx(kT,{status:n,onRefreshStatus:g,onSaveToken:x}),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:J=>k(Ay(J.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(Ml,{className:"settings__select",value:w,options:B,onChange:E,placeholder:"выберите владельца",ariaLabel:"Владелец репозитория"}):s.jsx("p",{className:"publish__static",children:((H=l[0])==null?void 0:H.login)??"—"})]}),s.jsxs("label",{className:"field publish__field",children:[s.jsx("span",{children:"Описание (необязательно)"}),s.jsx("input",{className:"input",value:C,placeholder:"о чём проект — одной строкой",onChange:J=>T(J.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(My,{title:"Приватный",desc:"Виден только вам и тем, кого вы пригласите. Стоит по умолчанию: репозиторий с чужим кодом, случайно ставший публичным, потом не отозвать.",on:z,onClick:()=>q(!0)}),s.jsx(My,{title:"Публичный",desc:"Виден всем в интернете — код, история коммитов, всё содержимое.",risky:!0,on:!z,onClick:()=>q(!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:[le," из ",i.files.length," файлов"]}),s.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>D(!0),children:"Отметить все"}),s.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>D(!1),children:"Снять все"})]}),i.files.length>8&&s.jsx("input",{className:"input publish__filter",value:Q,placeholder:"Фильтр по пути…",spellCheck:!1,onChange:J=>ee(J.target.value)}),s.jsx("div",{className:"publish__filelist",children:F.length===0?s.jsx("p",{className:"modal__text publish__filesempty",children:"Ничего не найдено по фильтру."}):F.map(J=>s.jsxs("button",{type:"button",role:"checkbox","aria-checked":(R==null?void 0:R.has(J))===!0,className:"publish__file",onClick:()=>ce(J),children:[s.jsx("span",{className:"publish__box"+(R!=null&&R.has(J)?" is-on":""),"aria-hidden":"true",children:(R==null?void 0:R.has(J))&&"✓"}),s.jsx("span",{className:"publish__filepath",children:J})]},J))}),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:J=>I(J.target.value)})]})]})]}),s.jsx(Pr,{result:f,onDismiss:b})]})}function My({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 kT({status:n,onRefreshStatus:l,onSaveToken:i}){const[r,o]=p.useState(""),[u,f]=p.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(wT,{value:r,onChange:o,visible:u,onToggleVisible:()=>f(g=>!g),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 wT({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:f=>l(f.target.value)}),s.jsx("button",{type:"button",className:"pwfield__toggle","aria-label":i?"Скрыть токен":"Показать токен","aria-pressed":i,onClick:r,children:i?s.jsx(ET,{}):s.jsx(ST,{})})]})}function ST(){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 ET(){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 CT({busy:n,result:l,onSubmit:i,onDismissResult:r,onClose:o}){const[u,f]=p.useState(""),g=/^(https?|ssh|git):\/\/\S+/i.test(u.trim())||/^[\w.-]+@[\w.-]+:.+/.test(u.trim());return s.jsxs(Sn,{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:!g||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:x=>f(x.target.value),onKeyDown:x=>{x.key==="Enter"&&g&&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(Pr,{result:l,onDismiss:r})]})}function TT({open:n,items:l,busy:i,ready:r,sendBlocked:o,longPasteThreshold:u,commands:f,contextResult:g,draftKey:x,models:_,model:b,effort:j,ultracode:N,thinking:k,switchOnFlag:w,onContextSearch:E,onCommand:C,onModel:T,onEffort:z,onUltracode:q,onThinking:te,onSwitchOnFlag:I,onAsk:R,onInterrupt:$,onReset:Q,onClose:ee,zoomed:G,onToggleZoom:B}){return s.jsxs("aside",{className:(n?"sidepane sidepane--ask sidepane--open":"sidepane sidepane--ask")+(G?" sidepane--zoomed":""),"aria-label":"Вопрос на полях",children:[s.jsxs("div",{className:"sidepane__head",onDoubleClick:F=>{B&&(F.target.closest("button")||B())},children:[s.jsx(AT,{}),s.jsx("span",{className:"sidepane__title",children:"Вопрос на полях"}),s.jsx("button",{className:"sidepane__btn",title:"Начать заново — следующий вопрос возьмёт свежий контекст","aria-label":"Начать боковой разговор заново",disabled:l.length===0,onClick:Q,children:"↻"}),B&&s.jsx("button",{className:"sidepane__btn",title:G?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":G?"Свернуть панель вопроса":"Развернуть панель вопроса на весь экран","aria-pressed":G,onClick:B,children:s.jsx(ou,{active:G})}),s.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель вопроса",onClick:ee,children:"✕"})]}),_.length>0&&s.jsxs("div",{className:"sidepane__tools",children:[s.jsx(Av,{className:"select--compact",models:_,value:b,effort:j,ultracode:N,thinking:k,switchOnFlag:w,onModel:T,onEffort:z,onUltracode:q,onThinking:te,onSwitchOnFlag:I}),s.jsx("span",{className:"sidepane__note",title:"Боковой вопрос работает только на чтение",children:"только чтение"})]}),s.jsx(ex,{items:l,busy:i,waiting:!1,empty:r?"Спросите о том, что происходит: вопрос уйдёт в сторону от основного разговора и не попадёт в его контекст. Отвечающий видит сессию и проект, но ничего не меняет.":"Откройте сессию — вопрос задаётся о ней."}),s.jsx(Sv,{className:"composer--side",disabled:!r,busy:i,commands:f,sessionTitle:null,contextResult:g,draftKey:x?`side:${x}`:null,placeholder:"Спросить, не мешая работе…",sendLabel:"Спросить",autoFocus:n,sendBlocked:o,longPasteThreshold:u,onContextSearch:E,onCommand:C,onSend:R,onInterrupt:$,onEscape:i?$:ee})]})}function AT(){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 MT=75,RT=90;function sx({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?Mv(i):`Расход лимитов плана${n.plan?` ${n.plan}`:""}`;return s.jsx("div",{className:l==="card"?"usage usage--card":"usage",title:OT(n,i),role:"group","aria-label":o,children:r.map(u=>s.jsx(DT,{label:u.label,window:u.window},u.key))})}function DT({label:n,window:l}){const i=Math.round(l.utilization),r=IT(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${LT(i)}`,style:{width:`${i}%`}})}),s.jsxs("span",{className:"usage__pct",children:[i,"%"]}),s.jsx("span",{className:"usage__reset",title:lx(l.resetsAt)||void 0,children:r&&`↻ ${r}`})]})}function LT(n){return n>=RT?" usage__fill--over":n>=MT?" usage__fill--warn":""}function OT(n,l){if(l.length>0)return zT(l);const i=[n.plan?`Лимиты плана ${n.plan}`:"Лимиты плана"],r=(o,u)=>{if(!u)return;const f=lx(u.resetsAt);i.push(`${o}: ${Math.round(u.utilization)}%${f?`, ${f}`:""}`)};return r("5 часов",n.fiveHour),r("Неделя",n.sevenDay),r("Неделя, Opus",n.sevenDayOpus),i.join(`
|
|
148
|
+
`)}function Mv(n){return n.some(l=>l.id.startsWith("codex:"))?"Лимиты Codex":"Квота Antigravity"}function zT(n){const l=[Mv(n)];for(const i of n){const r=lx(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(`
|
|
149
|
+
`)}function Rv(n){if(!n)return null;const l=new Date(n);return Number.isNaN(l.getTime())?null:l}function Dv(n){return n.getTime()-Date.now()<1440*60*1e3}function IT(n){const l=Rv(n);return l?Dv(l)?l.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):l.toLocaleDateString(void 0,{day:"numeric",month:"short"}):""}function lx(n){const l=Rv(n);return l?`обнулится ${Dv(l)?`в ${l.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}`:l.toLocaleDateString(void 0,{day:"numeric",month:"long"})}`:""}function Lv(){const[n,l]=p.useState(()=>new Date);return p.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:$T(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 $T(n){return n.toLocaleDateString(void 0,{weekday:"long",day:"numeric",month:"long",year:"numeric"})}function UT({onClose:n,permission:l,model:i,account:r,usage:o,cwd:u,costLabel:f,onRefresh:g,refreshing:x,metersFetchedAt:_,onRename:b,onHandoff:j,onFreshSession:N,handoffWriting:k,handoffAccount:w,onMemory:E,onStop:C,onExportDownload:T,onExportSave:z}){const q=x0({onLongPress:()=>N==null?void 0:N(),onClick:()=>j==null?void 0:j(),disabled:k});return s.jsx(Sn,{title:"Настройки сессии",className:"modal--sheet",sheet:!0,onClose:n,children:s.jsxs("div",{className:"sessionmenu",children:[l&&s.jsx(Br,{label:"Режим прав",children:l}),s.jsx(Br,{label:"Модель",children:i}),r&&s.jsx(Br,{label:"Аккаунт",children:r}),(o==null?void 0:o.available)&&(o.fiveHour||o.sevenDay||o.buckets&&o.buckets.length>0)&&s.jsx(Br,{label:"Лимиты плана",children:s.jsx(sx,{usage:o})}),s.jsxs("button",{type:"button",className:x?"sessionmenu__refresh is-busy":"sessionmenu__refresh","aria-busy":x,disabled:x,onClick:g,children:[s.jsx(BT,{}),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(Br,{label:"Время",children:s.jsx(Lv,{})}),f&&s.jsx(Br,{label:"Стоимость хода",children:s.jsx("span",{className:"badge badge--cost",children:f})}),u&&s.jsx(Br,{label:"Каталог проекта",children:s.jsx(Tv,{path:u})}),E&&s.jsx("button",{type:"button",className:"sessionmenu__rename",onClick:E,children:"Память и инструкции"}),T&&s.jsx(Br,{label:"Экспорт",children:s.jsxs("div",{className:"sessionmenu__export",children:[s.jsx("button",{type:"button","aria-label":"Скачать разговор как Markdown",onClick:()=>{n(),T()},children:"Скачать .md"}),s.jsx("button",{type:"button",disabled:!z,"aria-label":"Сохранить разговор в проект",onClick:()=>{n(),z==null||z()},children:"В проект"})]})}),b&&s.jsx("button",{type:"button",className:"sessionmenu__rename",onClick:b,children:"Переименовать сессию"}),j&&s.jsxs("button",{type:"button",className:k?"sessionmenu__handoff is-busy":q.holding?"sessionmenu__handoff is-holding":"sessionmenu__handoff",style:{"--hold-ms":`${q.thresholdMs}ms`},"aria-busy":k,disabled:k,...q.handlers,children:[s.jsx("span",{className:"sessionmenu__handoff-hold","aria-hidden":"true"}),s.jsxs("span",{className:"sessionmenu__handoff-text",children:[k?"Пишется хэндофф…":"Хэндофф и новая сессия",!k&&s.jsx("span",{className:"sessionmenu__handoff-hint",children:"Зажмите — новая сессия без хэндоффа"})]})]}),j&&w,C&&s.jsx("button",{type:"button",className:"sessionmenu__stop",onClick:C,children:"Остановить сессию"})]})})}function Br({label:n,children:l}){return s.jsxs("div",{className:"sessionmenu__row",children:[s.jsx("span",{className:"sessionmenu__label",children:n}),l]})}function BT(){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 HT={user:"Для всех проектов аккаунта",project:"Для всех, кто работает над проектом",local:"Только для вас, не для репозитория",memory:"Заметки, которые агент ведёт сам"};function qT(n){return new Date(n).toLocaleString("ru-RU",{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"})}function GT(n){return n<1024?`${n} Б`:`${(n/1024).toFixed(1).replace(".",",")} КБ`}function YT({workspaceId:n,workspaceName:l,accountId:i,stateAccountId:r,files:o,file:u,result:f,send:g,onClose:x}){const _=ru("(max-width: 860px)"),[b,j]=p.useState(null),[N,k]=p.useState(!1),[w,E]=p.useState(""),[C,T]=p.useState(0),[z,q]=p.useState(!1),[te,I]=p.useState(""),[R,$]=p.useState(null),[Q,ee]=p.useState(!1),[G,B]=p.useState(!1),F=p.useRef(!1),le=p.useRef("");le.current=w;const ue=r??i,ce=p.useRef(ue);ce.current=ue,p.useEffect(()=>{g({type:"memory.list",workspaceId:n,accountId:i})},[n,i,g]);const D=(o==null?void 0:o.find(ie=>ie.id===b))??null;p.useEffect(()=>{if(!o||b||_)return;const ie=o.find(Me=>Me.exists)??o[0];ie&&O(ie,!1)},[o]),p.useEffect(()=>{o&&b&&!o.some(ie=>ie.id===b)&&(j(null),k(!1),B(!1))},[o,b]);function O(ie,Me=!0){j(ie.id),k(!1),I(""),$(null),q(!1),Me&&B(!0),ie.exists&&g({type:"memory.read",workspaceId:n,id:ie.id,accountId:ce.current})}function H(){D&&(E(D.exists&&(u==null?void 0:u.id)===D.id?u.content:""),T(D.exists&&(u==null?void 0:u.id)===D.id?u.mtime:D.mtime),I(""),$(null),k(!0))}function J(ie=C){D&&(q(!0),I(""),g({type:"memory.write",workspaceId:n,id:D.id,content:le.current,baseMtime:ie,accountId:ce.current}))}p.useEffect(()=>{!u||u.id!==b||F.current&&(F.current=!1,T(u.mtime),$(null),J(u.mtime))},[u]),p.useEffect(()=>{if(!(!f||f.id!==b)){if(q(!1),f.ok){$(null),ee(!1),N&&(k(!1),g({type:"memory.read",workspaceId:n,id:f.id,accountId:ce.current}));return}if(f.conflict){$({mtime:f.mtime??null});return}I(f.message??"Не удалось выполнить операцию"),ee(!1)}},[f]);function re(){D&&($(null),k(!1),g({type:"memory.read",workspaceId:n,id:D.id,accountId:ce.current}))}function A(){if(D){if((R==null?void 0:R.mtime)!=null){T(R.mtime),$(null),J(R.mtime);return}F.current=!0,g({type:"memory.read",workspaceId:n,id:D.id,accountId:ce.current})}}const V=p.useMemo(()=>{const ie=o??[],Me=ie.filter(Ne=>Ne.scope!=="memory"),Ke=ie.filter(Ne=>Ne.scope==="memory").sort((Ne,Be)=>{const Xe=Ne.label==="MEMORY.md"?0:1,Ze=Be.label==="MEMORY.md"?0:1;return Xe-Ze||Ne.label.localeCompare(Be.label,"ru")});return{instructions:Me,memory:Ke}},[o]),U=D&&(u==null?void 0:u.id)===D.id?u:null,be=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(Ry,{title:"Инструкции",files:V.instructions,selectedId:b,onSelect:O}),s.jsx(Ry,{title:"Автопамять проекта",files:V.memory,selectedId:b,onSelect:O,empty:"Агент пока ничего не записал в память этого проекта."})]})]}),P=s.jsxs("section",{className:"memory__detail",children:[!D&&s.jsx("p",{className:"memory__empty",children:"Выберите файл слева."}),D&&s.jsxs(s.Fragment,{children:[s.jsxs("header",{className:"memory__head",children:[_&&s.jsx("button",{type:"button",className:"memory__back",onClick:()=>B(!1),"aria-label":"К списку файлов",children:"‹"}),s.jsxs("div",{className:"memory__headtext",children:[s.jsx("h3",{className:"memory__name",children:D.label}),s.jsx("div",{className:"memory__path",title:D.path,children:D.path})]}),!N&&s.jsxs("div",{className:"memory__tools",children:[D.exists?s.jsx("button",{type:"button",className:"btn",onClick:H,disabled:!U,children:"Изменить"}):s.jsx("button",{type:"button",className:"btn btn--primary",onClick:H,children:"Создать"}),D.deletable&&D.exists&&s.jsx("button",{type:"button",className:"btn btn--danger-ghost",onClick:()=>ee(!0),children:"Удалить"})]})]}),R&&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:re,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:w,spellCheck:!1,autoFocus:!0,"aria-label":`Содержимое ${D.label}`,placeholder:D.exists?"":"Файл пока пуст. Напишите инструкции в Markdown.",onChange:ie=>E(ie.target.value),onKeyDown:ie=>{(ie.ctrlKey||ie.metaKey)&&ie.key==="s"&&(ie.preventDefault(),z||J())}}),s.jsxs("div",{className:"memory__editactions",children:[s.jsx("button",{type:"button",className:"btn",disabled:z,onClick:()=>{k(!1),$(null),I("")},children:"Отмена"}),s.jsx("button",{type:"button",className:"btn btn--primary",disabled:z,onClick:()=>J(),children:z?"Сохраняю…":D.exists?"Сохранить":"Создать файл"})]})]}):D.exists?U?s.jsxs(s.Fragment,{children:[s.jsx(VT,{text:U.content}),s.jsxs("footer",{className:"memory__meta",children:[GT(D.size)," · изменён ",qT(D.mtime)]})]}):s.jsx("p",{className:"memory__empty",children:"Загрузка…"}):s.jsxs("div",{className:"memory__missing",children:[s.jsxs("p",{children:[HT[D.scope],"."]}),s.jsx("p",{children:"Файла пока нет. Создайте его, чтобы агент подхватил инструкции в следующей сессии."})]})]})]});return s.jsxs(Sn,{title:"Память и инструкции",className:"modal--memory",onClose:x,children:[s.jsxs("p",{className:"memory__lead",children:["Проект «",l,"». Агент читает эти файлы в начале каждой сессии."]}),s.jsxs("div",{className:"memory"+(_?G?" memory--detail":" memory--list":""),children:[(!_||!G)&&be,(!_||G)&&P]}),Q&&D&&s.jsx(Sn,{title:"Удалить файл памяти?",onClose:()=>ee(!1),actions:s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"btn",onClick:()=>ee(!1),children:"Отмена"}),s.jsx("button",{type:"button",className:"btn btn--warn",onClick:()=>{g({type:"memory.delete",workspaceId:n,id:D.id,accountId:ce.current}),ee(!1)},children:"Удалить"})]}),children:s.jsxs("p",{className:"modal__text",children:[D.label," будет удалён с диска. Агент больше не увидит эту запись."]})})]})}function Ry({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:s.jsx("bdi",{dir:"ltr",children:u.path})})]},u.id))]})}function VT({text:n}){const[l,i]=p.useState("");return p.useEffect(()=>{let r=!1;return Gd(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 Ov=[{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:"воскресенье"}],zv=[1,2,3,4,5],Oc=15,FT={default:"По умолчанию (спрашивать)",acceptEdits:"Принимать правки",plan:"Только план",auto:"auto",bypassPermissions:"Без подтверждений"},XT=Og.map(n=>({value:n.value,label:FT[n.value]??n.value,hint:n.hint})),KT={day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"};function Cg(n){return new Date(n).toLocaleString("ru-RU",KT).replace(" г.","")}function QT(n){if(n.kind==="once")return`Один раз ${Cg(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="":zv.every(r=>l.has(r))&&l.size===5?i=", пн–пт":l.size===2&&l.has(0)&&l.has(6)?i=", сб–вс":i=", "+Ov.filter(r=>l.has(r.day)).map(r=>r.label).join(", "),`Каждый день в ${n.time}${i}`}function Iv(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:Iv(l.getTime()),time:"09:00",days:zv,minutes:60,permissionMode:"default",model:"",enabled:!0}}function PT(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"?Iv(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 ZT(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 WT(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>=Oc)&&(l.minutes=`Не меньше ${Oc} минут`),n.kind==="once"&&!Number.isFinite(new Date(n.at).getTime())&&(l.at="Укажите дату и время"),l}function JT(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(Oc,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 eA({tasks:n,workspaces:l,activeWorkspaceId:i,send:r,onOpenSession:o,error:u,onClearError:f,onClose:g}){const[x,_]=p.useState(null),[b,j]=p.useState(null),[N,k]=p.useState(!1);p.useEffect(()=>{N&&(k(!1),_(null))},[n]),p.useEffect(()=>{u&&k(!1)},[u]),p.useEffect(()=>{r({type:"schedule.list"})},[r]);const w=T=>{var z;return((z=l.find(q=>q.id===T))==null?void 0:z.name)??"проект закрыт"};if(x)return s.jsx(tA,{draft:x,workspaces:l,saving:N,error:u,onEdit:f,onBack:()=>{f(),_(null)},onSave:T=>{f(),k(!0),r({type:"schedule.save",task:JT(T)})},onClose:g});const E=T=>{f(),r(T)},C=()=>{var T;return _($v(i??((T=l[0])==null?void 0:T.id)??""))};return s.jsxs(Sn,{title:"Запланированные задачи",className:"modal--tasks",onClose:g,actions:s.jsx("button",{type:"button",className:"btn btn--primary",onClick:C,disabled:l.length===0,children:"Новая задача"}),children:[u&&s.jsx("p",{className:"stasks__error",role:"alert",children:u}),n&&n.length===0&&s.jsxs("div",{className:"stasks__empty",children:[s.jsx("h3",{children:"Регулярная работа без вашего участия"}),s.jsx("p",{children:"Задача по расписанию запускает в проекте новую сессию с вашим промптом: отчёт каждое утро, проверку зависимостей, ночной прогон тестов."}),s.jsx("p",{className:"stasks__hint",children:"Задачи срабатывают только пока запущен ccv. Пропущенные запуски не догоняются."})]}),!n&&s.jsx("p",{className:"modal__text",children:"Загрузка…"}),n&&n.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("ul",{className:"stasks",children:n.map(T=>s.jsxs("li",{className:"stask"+(T.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:T.name}),s.jsx("button",{type:"button",role:"switch","aria-checked":T.enabled,"aria-label":T.enabled?`Выключить «${T.name}»`:`Включить «${T.name}»`,className:T.enabled?"switch is-on":"switch",onClick:()=>E({type:"schedule.save",task:ZT(T,!T.enabled)}),children:s.jsx("span",{className:"switch__knob"})})]}),s.jsxs("div",{className:"stask__sub",children:[w(T.workspaceId)," · ",QT(T.schedule)]}),s.jsxs("dl",{className:"stask__facts",children:[s.jsxs("div",{children:[s.jsx("dt",{children:"Следующий запуск"}),s.jsx("dd",{children:T.enabled&&T.nextRunAt?Cg(T.nextRunAt):"не запланирован"})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Последний"}),s.jsx("dd",{children:T.lastRunAt?Cg(T.lastRunAt):"ещё не было"})]})]}),T.lastError&&s.jsxs("p",{className:"stask__error",role:"status",children:["Последний запуск не удался: ",T.lastError]})]}),s.jsxs("div",{className:"stask__actions",children:[s.jsx("button",{type:"button",className:"btn",onClick:()=>E({type:"schedule.run",id:T.id}),children:"Запустить сейчас"}),T.lastSessionId&&s.jsx("button",{type:"button",className:"btn",onClick:()=>o(T),children:"Открыть сессию"}),s.jsx("button",{type:"button",className:"btn btn--ghost",onClick:()=>_(PT(T)),children:"Изменить"}),s.jsx("button",{type:"button",className:"btn btn--danger-ghost",onClick:()=>j(T),children:"Удалить"})]})]},T.id))}),s.jsx("p",{className:"stasks__hint",children:"Задачи срабатывают только пока запущен ccv."})]}),b&&s.jsx(Sn,{title:"Удалить задачу?",onClose:()=>j(null),actions:s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"btn",onClick:()=>j(null),children:"Отмена"}),s.jsx("button",{type:"button",className:"btn btn--warn",onClick:()=>{E({type:"schedule.delete",id:b.id}),j(null)},children:"Удалить"})]}),children:s.jsxs("p",{className:"modal__text",children:["Задача «",b.name,"» больше не будет запускаться. Сессии прошлых запусков останутся."]})})]})}function tA({draft:n,workspaces:l,saving:i,error:r,onEdit:o,onBack:u,onSave:f,onClose:g}){const[x,_]=p.useState(n),[b,j]=p.useState(!1),N=WT(x),k=z=>{r&&o(),_(q=>({...q,...z}))},w=z=>b?N[z]:void 0,E=l.map(z=>({value:z.id,label:z.name,hint:z.path}));function C(){i||(j(!0),Object.keys(N).length===0&&f(x))}function T(z){k({days:x.days.includes(z)?x.days.filter(q=>q!==z):[...x.days,z]})}return s.jsx(Sn,{title:x.id?"Изменить задачу":"Новая задача",className:"modal--tasks",onClose:g,actions:s.jsxs(s.Fragment,{children:[r&&s.jsx("p",{className:"tform__error tform__error--host",role:"alert",children:r}),s.jsx("button",{type:"button",className:"btn",onClick:u,disabled:i,children:"Отмена"}),s.jsx("button",{type:"button",className:"btn btn--primary",onClick:C,disabled:i,children:i?"Сохраняем…":x.id?"Сохранить":"Создать задачу"})]}),children:s.jsxs("form",{className:"tform",onSubmit:z=>{z.preventDefault(),C()},children:[s.jsxs("div",{className:"tform__row",children:[s.jsx("label",{className:"field",htmlFor:"task-name",children:"Название"}),s.jsx("input",{id:"task-name",className:"input",value:x.name,placeholder:"Например, утренний отчёт",onChange:z=>k({name:z.target.value}),"aria-invalid":!!w("name")}),w("name")&&s.jsx("p",{className:"tform__error",children:w("name")})]}),s.jsxs("div",{className:"tform__row",children:[s.jsx("span",{className:"field",children:"Проект"}),s.jsx(Ml,{value:x.workspaceId,options:E,ariaLabel:"Проект",placeholder:"Выберите проект",onChange:z=>k({workspaceId:z})}),w("workspaceId")&&s.jsx("p",{className:"tform__error",children:w("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:x.prompt,placeholder:"Соберите коммиты за вчера и напишите короткий отчёт",onChange:z=>k({prompt:z.target.value}),"aria-invalid":!!w("prompt")}),w("prompt")&&s.jsx("p",{className:"tform__error",children:w("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(([z,q])=>s.jsx("button",{type:"button",role:"radio","aria-checked":x.kind===z,className:x.kind===z?"segmented__opt is-on":"segmented__opt",onClick:()=>k({kind:z}),children:q},z))}),x.kind==="once"&&s.jsxs("div",{className:"tform__sched",children:[s.jsx("input",{type:"datetime-local",className:"input tform__when","aria-label":"Дата и время запуска",value:x.at,onChange:z=>k({at:z.target.value})}),w("at")&&s.jsx("p",{className:"tform__error",children:w("at")})]}),x.kind==="daily"&&s.jsxs("div",{className:"tform__sched",children:[s.jsx("input",{type:"time",className:"input tform__time","aria-label":"Время запуска",value:x.time,onChange:z=>k({time:z.target.value})}),s.jsx("div",{className:"chips",role:"group","aria-label":"Дни недели",children:Ov.map(z=>s.jsx("button",{type:"button",className:x.days.includes(z.day)?"chip-toggle is-on":"chip-toggle","aria-pressed":x.days.includes(z.day),title:z.full,onClick:()=>T(z.day),children:z.label},z.day))}),(w("days")||w("time"))&&s.jsx("p",{className:"tform__error",children:w("days")??w("time")})]}),x.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:x.minutes<=Oc,onClick:()=>k({minutes:Math.max(Oc,x.minutes-(x.minutes>60?30:15))}),children:"−"}),s.jsx("input",{type:"number",className:"input stepper__input","aria-label":"Интервал в минутах",min:Oc,value:Number.isFinite(x.minutes)?x.minutes:"",onChange:z=>k({minutes:z.target.value===""?NaN:Number(z.target.value)})}),s.jsx("span",{className:"stepper__unit",children:"мин"}),s.jsx("button",{type:"button",className:"stepper__btn","aria-label":"Больше",onClick:()=>k({minutes:(x.minutes||0)+(x.minutes>=60?30:15)}),children:"+"})]}),s.jsxs("p",{className:"tform__hint",children:["Не чаще, чем раз в ",Oc," минут."]}),w("minutes")&&s.jsx("p",{className:"tform__error",children:w("minutes")})]})]}),s.jsxs("div",{className:"tform__row",children:[s.jsx("span",{className:"field",children:"Права агента"}),s.jsx(Ml,{value:x.permissionMode,options:XT,ariaLabel:"Режим прав",onChange:z=>k({permissionMode:z})}),x.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:x.model,placeholder:"По умолчанию (например, sonnet или opus)",onChange:z=>k({model:z.target.value})})]}),s.jsxs("div",{className:"tform__switch",children:[s.jsx("span",{children:"Включена"}),s.jsx("button",{type:"button",role:"switch","aria-checked":x.enabled,"aria-label":"Задача включена",className:x.enabled?"switch is-on":"switch",onClick:()=>k({enabled:!x.enabled}),children:s.jsx("span",{className:"switch__knob"})})]}),s.jsx("button",{type:"submit",hidden:!0})]})})}const Tg=n=>`ccv.siteNotes.${n}`;function nA(n){try{const l=localStorage.getItem(Tg(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 sA(n,l){try{!l.url&&l.notes.length===0?localStorage.removeItem(Tg(n)):localStorage.setItem(Tg(n),JSON.stringify(l))}catch{}}function jh(n){try{const l=new URL(n);return l.hash="",l.href}catch{return n}}function lA(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 Ag(n,l){const i=n.replace(/\s+/g," ").trim().replaceAll("`","'");return i.length>l?`${i.slice(0,l-1)}…`:i}function Uv(n){const l=Ag(n.text,60);return l?`${n.tag}, «${l}»`:n.tag}function aA(n){const l=n.filter(r=>r.comment.trim());return l.length===0?"":`Правки к сайту (выбраны элементы на странице):
|
|
150
|
+
|
|
151
|
+
`+l.map((r,o)=>{var g;const u=r.element,f=[`${o+1}. Страница: ${u.url}`];return f.push(` Элемент: \`${Ag(u.selector,300)}\` — ${Uv(u)}`),(g=u.source)!=null&&g.file&&f.push(` Исходник: ${u.source.file}${u.source.component?` (${u.source.component})`:""}`),f.push(` Размер: ${Math.round(u.rect.width)}×${Math.round(u.rect.height)}, окно ${u.viewport.width}×${u.viewport.height}`),f.push(` HTML: \`${Ag(u.html,200)}\``),f.push(` Правка: ${r.comment.trim().replace(/\n/g,`
|
|
152
|
+
`)}`),f.join(`
|
|
153
|
+
`)}).join(`
|
|
154
|
+
|
|
155
|
+
`)+`
|
|
156
|
+
|
|
157
|
+
Найди эти элементы в коде проекта и внеси правки. Если элемент не находится однозначно — скажи, какие варианты нашёл.`}const Nh={width:15,height:15,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};function iA({workspaceId:n,workspaceName:l,remote:i,reply:r,send:o,hasSession:u,onInsertPrompt:f,onClose:g}){const x=p.useRef(nA(n)).current,[_,b]=p.useState(x.url),[j,N]=p.useState(x.url),[k,w]=p.useState(x.notes),[E,C]=p.useState({kind:"idle"}),[T,z]=p.useState(!1),[q,te]=p.useState(0),[I,R]=p.useState(0),[$,Q]=p.useState(null),[ee,G]=p.useState(null),B=p.useRef(null),F=p.useRef(new Map),le=p.useRef(!1),ue=p.useRef([]),ce=p.useRef(-1),D=p.useRef(null),O=p.useRef(T);O.current=T;const H=p.useRef(0),J=p.useCallback(Ne=>{const Be=lA(Ne);!Be||i||(le.current=!0,b(Be),C({kind:"loading",url:Be}),o({type:"site.open",url:Be}))},[i,o]);p.useEffect(()=>{!r||r.n===H.current||(H.current=r.n,le.current&&(le.current=!1,r.ok?(C({kind:"open",proxyUrl:r.proxyUrl}),N(r.url),b(r.url),te(Ne=>Ne+1)):C({kind:"failed",url:r.url,message:r.message})))},[r]),p.useEffect(()=>{sA(n,{url:j,notes:k})},[n,j,k]);const re=p.useCallback(Ne=>{var Be,Xe;(Xe=(Be=B.current)==null?void 0:Be.contentWindow)==null||Xe.postMessage({source:"ccv-app",...Ne},"*")},[]);p.useEffect(()=>{function Ne(Be){var an;const Xe=(an=B.current)==null?void 0:an.contentWindow;if(!Xe||Be.source!==Xe)return;const Ze=Be.data;if(!(!Ze||Ze.source!=="ccv-site"))if(Ze.type==="ready"||Ze.type==="location"){if(typeof Ze.url=="string"){const We=Ze.url;N(We),b(We),ue.current[ce.current]!==We&&(ue.current=[...ue.current.slice(0,ce.current+1),We],ce.current=ue.current.length-1)}if(R(We=>We+1),Ze.type==="ready"&&(re({type:"mode",pick:O.current}),D.current)){const We=D.current;D.current=null,window.setTimeout(()=>re({type:"flash",selector:We}),250)}}else if(Ze.type==="picked"&&Ze.element){const We=Ze.element,Bt={id:`${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`,element:We,comment:""};w(Ye=>[...Ye,Bt]),Q(Bt.id)}else Ze.type==="cancel"&&z(!1)}return window.addEventListener("message",Ne),()=>window.removeEventListener("message",Ne)},[re]),p.useEffect(()=>{re({type:"mode",pick:T})},[T,re]),p.useEffect(()=>{const Ne=jh(j),Be=k.map((Xe,Ze)=>({n:Ze+1,selector:Xe.element.selector,url:Xe.element.url})).filter(Xe=>jh(Xe.url)===Ne).map(({n:Xe,selector:Ze})=>({n:Xe,selector:Ze}));re({type:"marks",marks:Be})},[k,j,I,re]),p.useEffect(()=>{var Ne,Be;$&&((Ne=F.current.get($))==null||Ne.focus(),(Be=F.current.get($))==null||Be.scrollIntoView({block:"nearest"}),Q(null))},[$,k]),p.useEffect(()=>{function Ne(Be){Be.key==="Escape"&&(Be.preventDefault(),Be.stopPropagation(),O.current?z(!1):g())}return document.addEventListener("keydown",Ne,!0),()=>document.removeEventListener("keydown",Ne,!0)},[g]),p.useEffect(()=>{!i&&x.url&&J(x.url)},[]);function A(){if(ce.current<=0)return;ce.current-=1;const Ne=ue.current[ce.current];Ne&&J(Ne)}function V(){E.kind==="open"?te(Ne=>Ne+1):_&&J(_)}function U(Ne){E.kind==="open"&&(jh(Ne.element.url)===jh(j)?re({type:"flash",selector:Ne.element.selector}):(D.current=Ne.element.selector,J(Ne.element.url)))}function be(Ne,Be){w(Xe=>Xe.map(Ze=>Ze.id===Ne?{...Ze,comment:Be}:Ze))}function P(Ne){F.current.delete(Ne),w(Be=>Be.filter(Xe=>Xe.id!==Ne))}const ie=aA(k);function Me(){ie&&(f(ie)?(G(null),g()):G(ie))}const Ke=E.kind==="open";return s.jsxs("div",{className:"workpanel",role:"dialog","aria-modal":"true","aria-label":"Сайт",children:[s.jsxs("header",{className:"workpanel__bar",children:[s.jsx("h2",{className:"workpanel__title",children:"Сайт"}),!i&&s.jsxs("form",{className:"siteview__nav",onSubmit:Ne=>{Ne.preventDefault(),J(_)},children:[s.jsx("button",{type:"button",className:"iconbtn",title:"Назад","aria-label":"Назад",disabled:ce.current<=0||E.kind!=="open",onClick:A,children:s.jsx("svg",{...Nh,children:s.jsx("path",{d:"M10 3 5 8l5 5"})})}),s.jsx("button",{type:"button",className:"iconbtn",title:"Обновить","aria-label":"Обновить",disabled:E.kind==="idle",onClick:V,children:s.jsx("svg",{...Nh,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:Ne=>b(Ne.target.value),placeholder:"localhost:5173 или адрес сайта","aria-label":"Адрес страницы",spellCheck:!1,autoCapitalize:"off",autoCorrect:"off"}),s.jsxs("button",{type:"button",className:"btn siteview__pick"+(T?" is-on":""),"aria-pressed":T,disabled:!Ke,"aria-label":"Выбрать элемент",title:Ke?"Клик по странице выбирает элемент; Esc выключает":"Сначала откройте страницу",onClick:()=>z(Ne=>!Ne),children:[s.jsx("svg",{...Nh,children:s.jsx("path",{d:"M3 3l4 10 1.6-4.4L13 7 3 3Z"})}),s.jsx("span",{className:"siteview__pick-label",children:"Выбрать элемент"})]})]}),s.jsx("button",{className:"btn btn--ghost workpanel__close",onClick:g,children:"Закрыть"})]}),i?s.jsxs("div",{className:"workpanel__empty",children:[s.jsx("h3",{children:"Окно «Сайт» работает только на компьютере с хостом"}),s.jsx("p",{children:"Страницу открывает прокси, который слушает только 127.0.0.1 машины, где запущен хост. Через удалённый доступ до него не добраться. Откройте Claude Code Visual на этом компьютере."})]}):s.jsxs("div",{className:"siteview",children:[s.jsxs("div",{className:"siteview__stage",children:[E.kind==="open"&&s.jsx("iframe",{ref:B,className:"siteview__frame",src:E.proxyUrl,title:`Сайт проекта ${l}`,allow:"clipboard-write"},q),E.kind==="idle"&&s.jsxs("div",{className:"workpanel__empty",children:[s.jsx("h3",{children:"Откройте страницу"}),s.jsxs("p",{children:["Введите адрес локального сервера (например, ",s.jsx("code",{children:"localhost:5173"}),") или любого сайта и нажмите Enter. Затем включите «Выбрать элемент», кликайте по нужным местам страницы и пишите к ним правки."]})]}),E.kind==="loading"&&s.jsxs("div",{className:"workpanel__empty",role:"status",children:[s.jsx("div",{className:"mediaview__progress",children:s.jsx("div",{className:"mediaview__progress-fill"})}),s.jsxs("p",{children:["Открываю ",E.url,"…"]})]}),E.kind==="failed"&&s.jsxs("div",{className:"workpanel__empty",role:"alert",children:[s.jsx("h3",{children:"Сайт не ответил"}),s.jsx("p",{children:E.url}),s.jsx("p",{className:"workpanel__error",children:E.message}),s.jsx("button",{className:"btn btn--sm",onClick:()=>J(E.url),children:"Повторить"})]})]}),s.jsxs("aside",{className:"sitenotes","aria-label":"Правки",children:[s.jsx("div",{className:"sitenotes__list",children:k.length===0?s.jsx("p",{className:"sitenotes__hint",children:Ke?"Включите «Выбрать элемент» и кликните по странице. Для каждого элемента появится карточка с полем для правки.":"Здесь появятся карточки выбранных элементов."}):k.map((Ne,Be)=>{var Xe;return s.jsxs("article",{className:"sitenote",children:[s.jsxs("div",{className:"sitenote__head",children:[s.jsxs("button",{className:"sitenote__main",onClick:()=>U(Ne),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:Uv(Ne.element)}),s.jsx("span",{className:"sitenote__sel",children:Ne.element.selector}),((Xe=Ne.element.source)==null?void 0:Xe.file)&&s.jsxs("span",{className:"sitenote__src",children:[Ne.element.source.file,Ne.element.source.component?` · ${Ne.element.source.component}`:""]})]})]}),s.jsx("button",{className:"iconbtn iconbtn--danger",title:"Удалить карточку","aria-label":`Удалить карточку ${Be+1}`,onClick:()=>P(Ne.id),children:s.jsx("svg",{...Nh,children:s.jsx("path",{d:"M3.5 4.5h9M6.5 4.5V3h3v1.5M5 4.5l.5 8h5l.5-8"})})})]}),s.jsx("textarea",{ref:Ze=>{Ze?F.current.set(Ne.id,Ze):F.current.delete(Ne.id)},className:"input input--area sitenote__comment",value:Ne.comment,onChange:Ze=>be(Ne.id,Ze.target.value),placeholder:"Что здесь поменять","aria-label":`Правка к элементу ${Be+1}`,rows:2})]},Ne.id)})}),ee&&s.jsxs("div",{className:"sitenotes__leftover",role:"status",children:[s.jsx("p",{children:u?"Промпт не удалось вставить в поле ввода.":"Откройте сессию, чтобы вставить промпт в поле ввода. Пока его можно скопировать."}),s.jsx(Ca,{text:ee,hint:"промпт с правками"})]}),s.jsxs("div",{className:"sitenotes__foot",children:[s.jsx("button",{className:"btn btn--primary",disabled:!ie,title:ie?"Положить правки в поле ввода сессии":"Напишите правку хотя бы в одной карточке",onClick:Me,children:"Собрать промпт"}),s.jsx("button",{className:"btn btn--ghost",disabled:k.length===0,onClick:()=>{w([]),G(null)},children:"Очистить"})]})]})]})]})}const rA=5,cA=4,oA=4,Cd=n=>n.map(l=>`${l.x},${l.y}`).join(" ");function uA({state:n,notes:l,annotating:i,tool:r,activeId:o,escRef:u,onAdd:f,onSelect:g,onExit:x}){const _=p.useRef(null),[b,j]=p.useState([]),[N,k]=p.useState(null),[w,E]=p.useState(null),C=p.useRef(null),T=n.box;p.useEffect(()=>{j([]),k(null),E(null),C.current=null},[r,i]);const z=b.length>0||N!==null,q=p.useRef(z);q.current=z;function te(){j([]),k(null),E(null),C.current=null}function I(D){D.length>=3&&f({kind:"area",points:D}),te()}const R=p.useRef(b);R.current=b;const $=p.useRef(I);$.current=I;const Q=p.useRef(x);if(Q.current=x,p.useEffect(()=>{if(!i){u.current=null;return}u.current=()=>q.current?(te(),!0):(Q.current(),!0);function D(O){const H=O.target;["INPUT","TEXTAREA","SELECT"].includes(H.tagName)||H.isContentEditable||(O.key==="Enter"&&R.current.length>=3?(O.preventDefault(),$.current(R.current)):O.key==="Backspace"&&R.current.length>0&&(O.preventDefault(),j(J=>J.slice(0,-1))))}return document.addEventListener("keydown",D),()=>{document.removeEventListener("keydown",D),u.current=null}},[i]),!T)return null;const ee=l.filter(D=>Math.abs(D.time-n.time)<=Iw||D.id===o);function G(D){const O=_.current.getBoundingClientRect(),H={x:Math.min(Math.max(D.clientX-O.left,0),O.width),y:Math.min(Math.max(D.clientY-O.top,0),O.height)};return{pt:{x:H.x/O.width,y:H.y/O.height},px:H}}function B(D){if(D.button!==0)return;D.currentTarget.setPointerCapture(D.pointerId);const{px:O}=G(D);C.current={x:O.x,y:O.y,moved:!1}}function F(D){const{pt:O,px:H}=G(D),J=C.current;if(r==="area"&&J&&b.length===0){if(!J.moved&&Math.hypot(H.x-J.x,H.y-J.y)>=rA){J.moved=!0,k([{x:J.x/T.width,y:J.y/T.height},O]);return}if(J.moved){k(re=>{if(!re)return re;const A=re[re.length-1];return Math.hypot((O.x-A.x)*T.width,(O.y-A.y)*T.height)>=cA?[...re,O]:re});return}}r==="area"&&b.length>0&&E(O)}function le(D){const O=C.current;if(C.current=null,!O)return;const{pt:H}=G(D);if(r==="point"){f({kind:"point",x:H.x,y:H.y});return}if(O.moved){I(N??[]);return}const J=A=>Math.hypot((A.x-H.x)*T.width,(A.y-H.y)*T.height);if(b.length>=3&&J(b[0])<=Zb)return I(b);const re=b[b.length-1];if(re&&J(re)<=oA){b.length>=3&&I(b);return}j([...b,H]),E(H)}const ue=b.length>=3&&w&&Math.hypot((w.x-b[0].x)*T.width,(w.y-b[0].y)*T.height)<=Zb,ce=N??b;return s.jsxs("div",{className:"vmarks",style:{left:T.left,top:T.top,width:T.width,height:T.height},children:[s.jsxs("svg",{className:"vmarks__svg",viewBox:"0 0 1 1",preserveAspectRatio:"none","aria-hidden":"true",children:[ee.map(D=>D.shape.kind==="area"?s.jsxs("g",{className:"vmarks__area"+(D.id===o?" is-active":""),children:[s.jsx("polygon",{className:"vmarks__halo",points:Cd(D.shape.points),vectorEffect:"non-scaling-stroke"}),s.jsx("polygon",{className:"vmarks__line",points:Cd(D.shape.points),vectorEffect:"non-scaling-stroke"})]},D.id):null),ce.length>1&&s.jsxs(s.Fragment,{children:[s.jsx("polyline",{className:"vmarks__halo",points:Cd(ce),vectorEffect:"non-scaling-stroke",fill:"none"}),s.jsx("polyline",{className:"vmarks__line",points:Cd(ce),vectorEffect:"non-scaling-stroke",fill:"none"})]}),N===null&&b.length>0&&w&&s.jsx("polyline",{className:"vmarks__rubber",points:Cd([b[b.length-1],w]),vectorEffect:"non-scaling-stroke",fill:"none"})]}),ee.map(D=>{const O=W0(D.shape);return s.jsx("button",{type:"button",className:"vmarks__badge"+(D.shape.kind==="point"?" vmarks__badge--point":"")+(D.id===o?" is-active":""),style:{left:`${O.x*100}%`,top:`${O.y*100}%`},title:`Метка ${D.n}`,"aria-label":`Метка ${D.n}`,tabIndex:i?-1:0,onClick:()=>g(D.id),children:D.n},D.id)}),i&&b.map((D,O)=>s.jsx("span",{className:"vmarks__vertex"+(O===0?" is-first":"")+(O===0&&ue?" is-closing":""),style:{left:`${D.x*100}%`,top:`${D.y*100}%`},"aria-hidden":"true"},O)),i&&s.jsx("div",{ref:_,className:"vmarks__capture vmarks__capture--"+r,onPointerDown:B,onPointerMove:F,onPointerUp:le,onPointerCancel:te,onPointerLeave:()=>E(null),"aria-hidden":"true"})]})}const dA={width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};function fA({notes:n,activeId:l,focusRequest:i,annotating:r,canBuild:o,building:u,leftover:f,hasSession:g,frameNote:x,onSelect:_,onComment:b,onDelete:j,onClear:N,onBuild:k,onStartAnnotate:w}){const E=p.useRef(new Map),C=P0(n);return p.useEffect(()=>{var T;i&&((T=E.current.get(i.id))==null||T.focus())},[i]),s.jsxs("div",{className:"vidnotes",children:[s.jsx("div",{className:"vidnotes__list",children:C.length===0?s.jsxs("div",{className:"vidnotes__hint",children:[s.jsx("p",{children:r?"Щёлкните по кадру или обведите область — появится карточка с полем для комментария.":"Поставьте видео на нужный момент, включите «Комментарий» и отметьте место на кадре. Для каждой метки появится карточка."}),!r&&s.jsx("button",{className:"btn btn--sm",onClick:w,children:"Комментарий"})]}):C.map(T=>s.jsxs("article",{className:"vidnote"+(T.id===l?" is-active":""),children:[s.jsxs("div",{className:"vidnote__head",children:[s.jsxs("button",{className:"vidnote__main",onClick:()=>_(T.id),title:"Перемотать к этому кадру",children:[s.jsx("span",{className:"vidnote__n",children:T.n}),s.jsx("span",{className:"vidnote__time",children:Fh(T.time)}),s.jsx("span",{className:"vidnote__kind",children:T.shape.kind==="point"?"точка":"область"})]}),s.jsx("button",{className:"iconbtn iconbtn--danger",title:"Удалить метку","aria-label":`Удалить метку ${T.n}`,onClick:()=>j(T.id),children:s.jsx("svg",{...dA,children:s.jsx("path",{d:"M3.5 4.5h9M6.5 4.5V3h3v1.5M5 4.5l.5 8h5l.5-8"})})})]}),s.jsx("textarea",{ref:z=>{z?E.current.set(T.id,z):E.current.delete(T.id)},className:"input input--area vidnote__comment",value:T.comment,onChange:z=>b(T.id,z.target.value),placeholder:"Что здесь поменять","aria-label":`Комментарий к метке ${T.n}`,rows:2})]},T.id))}),x&&n.length>0&&s.jsx("p",{className:"vidnotes__note",children:x}),f&&s.jsxs("div",{className:"sitenotes__leftover",role:"status",children:[s.jsx("p",{children:g?"Промпт не удалось вставить в поле ввода.":"Откройте сессию, чтобы вставить промпт в поле ввода. Пока его можно скопировать."}),s.jsx(Ca,{text:f,hint:"промпт с комментариями к видео"})]}),s.jsxs("div",{className:"sitenotes__foot",children:[s.jsx("button",{className:"btn btn--primary",disabled:!o||u,title:o?"Положить комментарии в поле ввода сессии":"Напишите комментарий хотя бы в одной метке",onClick:k,children:u?"Снимаю кадры…":"Собрать промпт"}),s.jsx("button",{className:"btn btn--ghost",disabled:n.length===0||u,onClick:N,children:"Очистить"})]})]})}const hA=/\.(mp4|webm|mov|m4v|ogv)$/i,mA=/https?:\/\/[^\s"'<>)\]\\}]+/g;function pA(n){try{return hA.test(new URL(n).pathname)}catch{return!1}}function gA(n){const l=new Set,i=[],r=o=>{if(o)for(const u of o.matchAll(mA)){const f=u[0].replace(/[.,;:!?]+$/,"");!l.has(f)&&pA(f)&&(l.add(f),i.push(f))}};for(const o of n)o.kind==="assistant"||o.kind==="user"?r(o.text):o.kind==="tool"&&r(o.result);return i}function xA(n){try{const l=new URL(n);return decodeURIComponent(l.pathname.split("/").filter(Boolean).pop()??"")||l.host}catch{return n}}const _A=64*1024*1024,bA={mp4:"video/mp4",m4v:"video/mp4",webm:"video/webm",mov:"video/quicktime",ogv:"video/ogg",mkv:"video/x-matroska"};function yA(n){var l;return bA[((l=n.split(".").pop())==null?void 0:l.toLowerCase())??""]??"video/mp4"}function vA(n){return new Date(n).toLocaleString("ru-RU",{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}).replace(" г.","")}function Dy(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 jA({workspaceId:n,remote:l,catalog:i,studios:r,links:o,previews:u,mediaCache:f,send:g,onRequestMedia:x,hasSession:_,onInsertPrompt:b,onInstallFfmpeg:j,onClose:N}){const[k,w]=p.useState(null),[E,C]=p.useState(!0),[T,z]=p.useState(0),[q,te]=p.useState(null),[I,R]=p.useState("list"),[$,Q]=p.useState(!1),[ee,G]=p.useState("point"),[B,F]=p.useState(null),[le,ue]=p.useState(null),[ce,D]=p.useState(!1),[O,H]=p.useState(null),[J,re]=p.useState(!0),[A,V]=p.useState({key:null,list:[]}),U=p.useRef(null),be=p.useRef(null),P=p.useRef(0),ie=i&&i.workspaceId===n?i:null,Me=(k==null?void 0:k.kind)==="file"?k.path:(k==null?void 0:k.kind)==="link"?k.url:null,Ke=A.key===Me?A.list:[];p.useEffect(()=>{V({key:Me,list:Me?Bw(n,Me):[]}),Q(!1),F(null),H(null),Me||R("list")},[Me]);function Ne(Ce){V(Te=>{if(!Te.key)return Te;const Ie=Ce(Te.list);return Hw(n,Te.key,Ie),{key:Te.key,list:Ie}})}const Be=()=>{C(!0),g({type:"video.scan",workspaceId:n})};p.useEffect(()=>{Be()},[n]),p.useEffect(()=>{ie&&C(!1)},[ie]);const Xe=p.useRef(N);Xe.current=N,p.useEffect(()=>{function Ce(Te){var Ie;if(Te.key==="Escape"&&!(document.fullscreenElement||document.querySelector(".vplayer__menu"))){if((Ie=be.current)!=null&&Ie.call(be)){Te.preventDefault(),Te.stopPropagation();return}Te.preventDefault(),Te.stopPropagation(),Xe.current()}}return document.addEventListener("keydown",Ce,!0),()=>document.removeEventListener("keydown",Ce,!0)},[]);function Ze(Ce){w(Ce),te(null),re(!0),Ce.kind==="animation"&&(z(Te=>Te+1),g({type:"fs.preview",workspaceId:n,path:Ce.path}))}function an(Ce){g({type:"fs.preview",workspaceId:n,path:Ce}),z(Te=>Te+1)}const We=(ie==null?void 0:ie.videos)??[],Bt=(ie==null?void 0:ie.animations)??[],Ye=(ie==null?void 0:ie.remotion)??[],ct=!!ie&&o.length===0&&We.length===0&&Bt.length===0&&Ye.length===0,xe=(Ce,Te,Ie,st)=>s.jsx("li",{children:s.jsxs("button",{className:"vidrow"+(Dy(k,Ce)?" is-on":""),"aria-pressed":Dy(k,Ce),onClick:()=>Ze(Ce),children:[s.jsx("span",{className:"vidrow__title",children:Te}),Ie&&s.jsx("span",{className:"vidrow__meta",children:Ie})]})},st);function $e(Ce){const Te=U.current;Te&&(Te.pause(),Te.currentTime=Ce.time),F(Ce.id)}function ye(Ce){const Te=Ke.find(Ie=>Ie.id===Ce);Te&&($e(Te),R("notes"),ue({id:Ce,seq:++P.current}))}function Qe(Ce){const Te=U.current;if(!Te)return;const Ie=`${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`;Ne(st=>[...st,{id:Ie,n:qw(st),time:Te.currentTime,shape:Ce,comment:""}]),F(Ie),R("notes"),ue({id:Ie,seq:++P.current})}function rn(){var Ce;if($){Q(!1);return}(Ce=U.current)==null||Ce.pause(),Q(!0)}const kt=(k==null?void 0:k.kind)==="file"?{kind:"file",value:k.path}:(k==null?void 0:k.kind)==="link"?{kind:"link",value:k.url}:null,ht=Ke.some(Ce=>Ce.comment.trim()),_s=(k==null?void 0:k.kind)==="link"&&!J?"Видео по чужой ссылке: сервер не даёт читать его кадры, поэтому в промпте будут время и место, но без картинки.":null;async function On(){const Ce=U.current;if(!Ce||!kt||ce)return;D(!0),H(null);const Te={time:Ce.currentTime,playing:!Ce.paused};Ce.pause();const Ie={paths:{}},st=Date.now().toString(36).slice(-4);try{const bt=Ke.filter(yt=>yt.comment.trim());for(const yt of bt){const zn=await Pw(Ce,yt),_e=Xw(kt.value,yt,st);g({type:"fs.writeBinary",workspaceId:n,path:_e,base64:zn}),Ie.paths[yt.id]=_e}}catch(bt){Ie.skipped=bt instanceof DOMException&&bt.name==="SecurityError"?"сервер видео не разрешает читать его кадры":"не удалось снять кадр"}try{await J0(Ce,Te.time),Te.playing&&Ce.play().catch(()=>{})}catch{}const _t=Ww({source:kt,width:Ce.videoWidth,height:Ce.videoHeight,duration:Ce.duration,notes:Ke,frames:Ie,ffmpeg:ie==null?void 0:ie.ffmpeg});D(!1),_t&&(b(_t)?N():H(_t))}function fn(Ce,Te){return s.jsx(ev,{src:Ce,crossOrigin:Te.crossOrigin,autoPlay:Te.autoPlay,onError:Te.onError,videoRef:U,ticks:Ke.map(Ie=>({id:Ie.id,time:Ie.time,label:`Метка ${Ie.n}, ${Fh(Ie.time)}`,active:Ie.id===B})),onTickClick:Ie=>{const st=Ke.find(_t=>_t.id===Ie);st&&$e(st)},controlsExtra:s.jsxs("div",{className:"vidmark",children:[s.jsx("button",{type:"button",className:"vplayer__btn vplayer__btn--text"+($?" is-on":""),"aria-pressed":$,title:"Отметить место на кадре и написать к нему комментарий",onClick:rn,children:"Комментарий"}),$&&s.jsxs("div",{className:"vidmark__tools",role:"group","aria-label":"Что отметить",children:[s.jsx("button",{type:"button",className:"vidmark__tool"+(ee==="point"?" is-on":""),"aria-pressed":ee==="point",onClick:()=>G("point"),children:"Точка"}),s.jsx("button",{type:"button",className:"vidmark__tool"+(ee==="area"?" is-on":""),"aria-pressed":ee==="area",title:"Обведите от руки или ставьте вершины щелчками; замкнуть — щелчок у первой вершины, двойной щелчок или Enter",onClick:()=>G("area"),children:"Область"})]})]}),overlay:Ie=>s.jsx(uA,{state:Ie,notes:Ke,annotating:$,tool:ee,activeId:B,escRef:be,onAdd:Qe,onSelect:ye,onExit:()=>Q(!1)})})}const Mt=Ce=>`${Ld(Ce.size)} · ${vA(Ce.mtime)}`;function zt(){if(!k)return s.jsxs("div",{className:"workpanel__empty",children:[s.jsx("h3",{children:"Выберите видео в списке"}),s.jsx("p",{children:"Файл, ссылка или анимация проиграются здесь. Для проекта Remotion откроется Studio."})]});if(k.kind==="link")return s.jsxs("div",{className:"vidstage",children:[s.jsx("div",{className:"vidstage__media",children:s.jsx("div",{className:"mediaview mediaview--video",children:fn(k.url,{crossOrigin:J?"anonymous":void 0,autoPlay:!0,onError:()=>J?re(!1):te(k.url)})},`${k.url}|${J}`)}),s.jsxs("div",{className:"vidstage__bar",children:[s.jsx("span",{className:"vidstage__name",title:k.url,children:k.url}),s.jsx("a",{className:"btn btn--sm",href:k.url,target:"_blank",rel:"noreferrer noopener",children:"Открыть по ссылке"})]}),q===k.url&&s.jsx("p",{className:"workpanel__error",role:"alert",children:"Не удалось проиграть видео. Ссылка могла устареть или сервер не разрешает встраивание."})]});if(k.kind==="file"){const Te=We.find(_t=>_t.path===k.path),Ie=f[k.path],st=Ie&&"base64"in Ie?Ie:void 0;return s.jsxs("div",{className:"vidstage",children:[s.jsx("div",{className:"vidstage__media",children:s.jsx(tv,{path:k.path,mime:(st==null?void 0:st.mime)??yA(k.path),base64:st==null?void 0:st.base64,error:Ie&&"error"in Ie?Ie.error:void 0,tooLarge:((Te==null?void 0:Te.size)??0)>_A,size:(Te==null?void 0:Te.size)??0,onRequestMedia:x,renderVideo:_t=>fn(_t,{})},k.path)}),s.jsx("div",{className:"vidstage__bar",children:s.jsx("span",{className:"vidstage__name",title:k.path,children:k.path})})]})}if(k.kind==="animation"){const Te=u[k.path];return s.jsxs("div",{className:"vidstage",children:[s.jsx("div",{className:"vidstage__media vidstage__media--page",children:Te!=null&&Te.error?s.jsx("p",{className:"workpanel__error",role:"alert",children:Te.error}):(Te==null?void 0:Te.html)!==void 0?s.jsx(nm,{doc:X0(k.path,Te.html),title:k.path},T):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:k.path,children:k.path}),s.jsx("button",{className:"btn btn--sm",onClick:()=>an(k.path),children:"Сначала"})]})]})}const Ce=Ye.find(Te=>Te.root===k.root);return Ce?s.jsx(kA,{project:Ce,workspaceId:n,remote:l,state:r[Ce.root],send:g}):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:E,onClick:Be,children:E?"Ищу…":"Обновить"}),ie&&s.jsx(NA,{status:ie.ffmpeg,onInstall:j}),s.jsx("span",{className:"workpanel__spacer"}),s.jsx("button",{className:"btn btn--ghost workpanel__close",onClick:N,children:"Закрыть"})]}),s.jsxs("div",{className:"vidview",children:[s.jsx("div",{className:"vidview__stage",children:zt()}),s.jsxs("aside",{className:"vidside",children:[kt&&s.jsxs("div",{className:"vidtabs",role:"tablist","aria-label":"Правая колонка",children:[s.jsx("button",{role:"tab","aria-selected":I==="list",className:"vidtab"+(I==="list"?" is-on":""),onClick:()=>R("list"),children:"Список"}),s.jsxs("button",{role:"tab","aria-selected":I==="notes",className:"vidtab"+(I==="notes"?" is-on":""),onClick:()=>R("notes"),children:["Комментарии",Ke.length>0&&s.jsx("span",{className:"vidtab__count",children:Ke.length})]})]}),kt&&I==="notes"?s.jsx(fA,{notes:Ke,activeId:B,focusRequest:le,annotating:$,canBuild:ht,building:ce,leftover:O,hasSession:_,frameNote:_s,onSelect:ye,onComment:(Ce,Te)=>Ne(Ie=>Ie.map(st=>st.id===Ce?{...st,comment:Te}:st)),onDelete:Ce=>{Ne(Te=>Te.filter(Ie=>Ie.id!==Ce)),F(Te=>Te===Ce?null:Te)},onClear:()=>{Ne(()=>[]),F(null),H(null)},onBuild:()=>void On(),onStartAnnotate:rn}):s.jsxs("nav",{className:"vidlist","aria-label":"Найденное видео",children:[!ie&&s.jsx("p",{className:"vidlist__hint",role:"status",children:"Ищу видео в проекте…"}),ct&&s.jsxs("div",{className:"vidlist__empty",children:[s.jsx("h3",{children:"Видео пока нет"}),s.jsx("p",{children:"Раздел собирает видеофайлы проекта (mp4, webm, mov), проекты Remotion, HTML-страницы с анимацией и ссылки на видео из разговора. Когда агент что-нибудь сделает, нажмите «Обновить»."})]}),ie&&!ct&&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(Ce=>xe({kind:"link",url:Ce},xA(Ce),new URL(Ce).host,Ce))})]}),s.jsxs("section",{className:"vidgroup",children:[s.jsx("h3",{className:"vidgroup__title",children:"Файлы проекта"}),We.length===0?s.jsx("p",{className:"vidgroup__none",children:"Видеофайлов нет."}):s.jsx("ul",{children:We.map(Ce=>xe({kind:"file",path:Ce.path},Ce.path,Mt(Ce),Ce.path))})]}),s.jsxs("section",{className:"vidgroup",children:[s.jsx("h3",{className:"vidgroup__title",children:"Remotion"}),Ye.length===0?s.jsx("p",{className:"vidgroup__none",children:"Проектов Remotion нет."}):s.jsx("ul",{children:Ye.map(Ce=>{var st;const Te=(st=r[Ce.root])==null?void 0:st.status,Ie=Te==="ready"?"предпросмотр запущен":Te==="starting"?"запускается…":Ce.root==="."?"корень проекта":Ce.root;return xe({kind:"remotion",root:Ce.root},Ce.name,Ie,Ce.root)})})]}),s.jsxs("section",{className:"vidgroup",children:[s.jsx("h3",{className:"vidgroup__title",children:"HTML-анимации"}),Bt.length===0?s.jsx("p",{className:"vidgroup__none",children:"Страниц с анимацией нет."}):s.jsx("ul",{children:Bt.map(Ce=>xe({kind:"animation",path:Ce.path},Ce.path,Mt(Ce),Ce.path))})]}),ie.truncated&&s.jsx("p",{className:"vidlist__warn",role:"status",children:"Проект слишком большой: поиск остановился раньше, чем обошёл все файлы, и показано не всё."})]})]})]})]})]})}function NA({status:n,onInstall:l}){return n.available?s.jsxs("span",{className:"vidffmpeg",title:n.version?`ffmpeg ${n.version}`:"ffmpeg найден",children:[s.jsx("span",{className:"vidffmpeg__dot","aria-hidden":"true"}),s.jsxs("span",{className:"vidffmpeg__text",children:["ffmpeg",n.version?` ${n.version}`:""]})]}):s.jsxs("span",{className:"vidffmpeg vidffmpeg--missing",role:"status",children:[s.jsx("span",{className:"vidffmpeg__dot","aria-hidden":"true"}),s.jsx("span",{className:"vidffmpeg__text",children:"ffmpeg не найден — агент не сможет вынимать кадры"}),n.install&&(l?s.jsx("button",{className:"btn btn--sm",onClick:()=>l(n.install),title:n.install,children:"Установить"}):s.jsxs(s.Fragment,{children:[s.jsx("code",{className:"vidffmpeg__cmd",title:n.install,children:n.install}),s.jsx(Ca,{text:n.install,hint:"команду установки ffmpeg"})]}))]})}function kA({project:n,workspaceId:l,remote:i,state:r,send:o}){const u=(r==null?void 0:r.status)??"stopped",f=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:f?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(`
|
|
158
|
+
`)})]}),u==="stopped"&&!i&&s.jsx("div",{className:"workpanel__empty",children:s.jsx("p",{children:"Studio — это плеер композиции с перемоткой, пропсами и очередью рендера. Нажмите «Открыть предпросмотр»."})})]})}function wA({tab:n,servers:l,plugins:i,marketplaces:r,catalog:o,result:u,auth:f,duplicates:g,accounts:x,remote:_,actions:b,onTab:j,onClose:N}){const k=[{id:"mcp",label:"MCP-серверы",count:l.length},{id:"plugins",label:"Плагины",count:i.length},{id:"catalog",label:"Каталог",count:o.length}];return s.jsxs(Sn,{title:"Расширения",className:"modal--wide",onClose:N,children:[s.jsx("div",{className:"tabs",role:"tablist",children:k.map(w=>s.jsxs("button",{role:"tab","aria-selected":n===w.id,className:n===w.id?"tabs__tab is-on":"tabs__tab",onClick:()=>j(w.id),children:[w.label,s.jsx("span",{className:"tabs__count",children:w.count})]},w.id))}),n==="mcp"&&s.jsx(SA,{servers:l,auth:f,accounts:x,remote:_,actions:b,onPlugins:()=>j("plugins")}),n==="plugins"&&s.jsx(DA,{plugins:i,marketplaces:r,duplicates:g,actions:b}),n==="catalog"&&s.jsx(LA,{catalog:o,hasMarketplaces:r.length>0,actions:b,onMarketplaces:()=>j("plugins")}),s.jsx(Pr,{result:u})]})}function SA({servers:n,auth:l,accounts:i,remote:r,actions:o,onPlugins:u}){const[f,g]=p.useState(!1);return s.jsxs(s.Fragment,{children:[n.length===0&&!f&&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(x=>{const _=(l==null?void 0:l.name)===x.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:x.name}),s.jsx("span",{className:`chip chip--${AA(x.status)}`,children:TA[x.status]}),x.scope&&s.jsx("span",{className:"chip",children:x.scope}),x.transport&&s.jsx("span",{className:"chip",children:x.transport})]}),x.target&&s.jsx("div",{className:"extlist__meta",title:x.target,children:x.target}),x.error&&s.jsx("div",{className:"extlist__error",children:x.error}),x.tools.length>0&&s.jsxs("div",{className:"extlist__meta",children:["Инструментов: ",x.tools.length," · ",x.tools.slice(0,6).join(", "),x.tools.length>6&&"…"]}),s.jsxs("div",{className:"extlist__actions",children:[x.status==="needs-auth"&&s.jsx("button",{className:j?"btn btn--ghost btn--sm":"btn btn--primary btn--sm",disabled:b,onClick:()=>o.mcpAuth(x.name),children:b?"Запускаем вход…":j?"Начать заново":"Авторизовать"}),s.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>o.mcpAction(x.name,"reconnect"),children:"Переподключить"}),x.status==="disabled"?s.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>o.mcpAction(x.name,"enable"),children:"Включить"}):s.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>o.mcpAction(x.name,"disable"),children:"Выключить"}),x.editable&&s.jsx("button",{className:"btn btn--ghost btn--sm btn--danger",onClick:()=>o.mcpRemove(x.name),children:"Удалить"})]}),_&&s.jsx(EA,{auth:_,accounts:i,remote:r,actions:o,onPlugins:u})]},x.name)})}),f?s.jsx(MA,{onCancel:()=>g(!1),onSubmit:(x,_)=>{o.mcpAdd(x,_),g(!1)}}):s.jsx("div",{className:"extbar",children:s.jsx("button",{className:"btn btn--primary",onClick:()=>g(!0),children:"+ Сервер"})})]})}function EA({auth:n,accounts:l,remote:i,actions:r,onPlugins:o}){var k;const[u,f]=p.useState(""),g=l.find(w=>w.id===n.accountId)??null,x=l.length>1&&g?s.jsxs("div",{className:"extauth__account",children:[s.jsx(Sa,{account:g,size:"sm"}),s.jsxs("span",{children:["Вход для аккаунта ",s.jsxs("strong",{children:["«",g.name,"»"]})]})]}):null,_=n.otherAccounts.map(w=>l.find(E=>E.id===w)).find(w=>w!==void 0);function b(){const w=u.trim();w!==""&&(r.mcpAuthCallback(n.name,w),f(""))}if(!n.active)return n.error||!n.done&&n.diagnostic?s.jsxs("div",{className:"extauth",role:"alert",children:[x,n.error&&s.jsx("div",{className:"extlist__error",children:n.error}),n.diagnostic&&s.jsx("p",{className:"extauth__why",children:n.diagnostic.message}),s.jsxs("div",{className:"extlist__actions",children:[s.jsx("button",{className:"btn btn--primary btn--sm",onClick:()=>r.mcpAuth(n.name,n.accountId),children:"Попробовать снова"}),((k=n.diagnostic)==null?void 0:k.kind)==="token-under-other-key"&&s.jsx("button",{className:"btn btn--ghost btn--sm",onClick:o,children:"Открыть вкладку «Плагины»"})]})]}):n.done?s.jsxs("div",{className:"extauth",role:"status",children:[s.jsxs("div",{className:"extauth--done",children:[s.jsx("span",{className:"extauth__tick","aria-hidden":"true",children:"✓"}),"Вход выполнен",x&&g?` для аккаунта «${g.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:w=>f(w.target.value),onKeyDown:w=>{w.key==="Enter"&&(w.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:[x,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"}),CA[n.stage]]})]})}const CA={starting:"Запускаем вход…",waiting:"Ждём завершения входа…",exchanging:"Обмениваем код на токен…",finished:"Завершаем вход…"},TA={connected:"подключён",failed:"ошибка","needs-auth":"нужна авторизация",pending:"подключается",disabled:"выключен",unknown:"неизвестно"};function AA(n){return n==="connected"?"ok":n==="failed"?"bad":n==="needs-auth"?"warn":"mute"}function MA({onSubmit:n,onCancel:l}){const[i,r]=p.useState(""),[o,u]=p.useState("stdio"),[f,g]=p.useState(""),[x,_]=p.useState(""),[b,j]=p.useState(""),N=o==="stdio",k=i.trim()!==""&&(N?f.trim()!=="":x.trim()!=="");function w(){if(k)if(N){const[E,...C]=RA(f);n(i.trim(),{transport:"stdio",command:E??"",args:C,env:Ly(b)})}else n(i.trim(),{transport:o,url:x.trim(),headers:Ly(b)})}return s.jsxs("div",{className:"extform extform--card",children:[s.jsx("label",{className:"field",htmlFor:"mcp-name",children:"Имя сервера"}),s.jsx("input",{id:"mcp-name",className:"input input--mono",value:i,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"context7",onChange:E=>r(E.target.value)}),s.jsx("label",{className:"field",children:"Транспорт"}),s.jsx(Ml,{title:"Транспорт",value:o,options:[{value:"stdio",label:"stdio",hint:"локальный процесс"},{value:"http",label:"http",hint:"удалённый сервер"},{value:"sse",label:"sse",hint:"удалённый, поток событий"}],onChange:E=>u(E)}),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:f,spellCheck:!1,autoComplete:"off",placeholder:"npx -y @upstash/context7-mcp",onChange:E=>g(E.target.value)})]}):s.jsxs(s.Fragment,{children:[s.jsx("label",{className:"field",htmlFor:"mcp-url",children:"URL"}),s.jsx("input",{id:"mcp-url",className:"input input--mono",value:x,spellCheck:!1,autoComplete:"off",placeholder:"https://mcp.example.dev/mcp",onChange:E=>_(E.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:E=>j(E.target.value)}),s.jsxs("div",{className:"extbar",children:[s.jsx("button",{className:"btn",onClick:l,children:"Отмена"}),s.jsx("button",{className:"btn btn--primary",disabled:!k,onClick:w,children:"Подключить"})]})]})}function Ly(n){const l={};for(const i of n.split(`
|
|
159
|
+
`)){const r=i.trim();if(!r)continue;const o=r.indexOf("="),u=r.indexOf(":"),f=o===-1?u:u===-1?o:Math.min(o,u);f<=0||(l[r.slice(0,f).trim()]=r.slice(f+1).trim())}return l}function RA(n){return(n.trim().match(/"[^"]*"|'[^']*'|\S+/g)??[]).map(l=>l.replace(/^["']|["']$/g,""))}function DA({plugins:n,marketplaces:l,duplicates:i,actions:r}){const[o,u]=p.useState("");return s.jsxs(s.Fragment,{children:[i.map(f=>s.jsxs("div",{className:"extwarn",role:"alert",children:[s.jsxs("div",{className:"extwarn__title",children:["«",f.id,"» записан в реестре ",f.records.length," раз"]}),s.jsx("ul",{className:"extwarn__records",children:f.records.map((g,x)=>s.jsxs("li",{title:g.installPath,children:[g.scope,g.version&&g.version!=="unknown"?`, версия ${g.version}`:""]},`${g.scope}-${g.installPath}-${x}`))}),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(f.id),children:"Оставить одну запись"})})]},f.id)),n.length===0&&s.jsx("p",{className:"modal__text",children:"Ни одного установленного плагина. Что можно поставить — на вкладке «Каталог»."}),s.jsx("ul",{className:"extlist",children:n.map(f=>s.jsxs("li",{className:"extlist__row",children:[s.jsxs("div",{className:"extlist__head",children:[s.jsx("span",{className:"extlist__name",children:f.name}),s.jsx("span",{className:f.enabled?"chip chip--ok":"chip chip--mute",children:f.enabled?"включён":"выключен"}),f.version&&f.version!=="unknown"&&s.jsx("span",{className:"chip",children:f.version}),f.scope&&s.jsx("span",{className:"chip",children:f.scope})]}),f.marketplace&&s.jsx("div",{className:"extlist__meta",children:f.marketplace}),f.mcpServers.length>0&&s.jsxs("div",{className:"extlist__meta",children:["MCP-серверы: ",f.mcpServers.join(", ")]}),s.jsxs("div",{className:"extlist__actions",children:[s.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>r.pluginToggle(f.id,!f.enabled),children:f.enabled?"Выключить":"Включить"}),s.jsx("button",{className:"btn btn--ghost btn--sm btn--danger",onClick:()=>r.pluginUninstall(f.id),children:"Удалить"})]})]},f.id))}),s.jsx("div",{className:"sidebar__section",children:"Маркетплейсы"}),s.jsx("ul",{className:"extlist",children:l.map(f=>s.jsxs("li",{className:"extlist__row",children:[s.jsx("div",{className:"extlist__head",children:s.jsx("span",{className:"extlist__name",children:f.name})}),f.source&&s.jsx("div",{className:"extlist__meta",children:f.source}),s.jsx("div",{className:"extlist__actions",children:s.jsx("button",{className:"btn btn--ghost btn--sm btn--danger",onClick:()=>r.marketplaceRemove(f.name),children:"Отключить"})})]},f.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:f=>u(f.target.value),onKeyDown:f=>{f.key!=="Enter"||o.trim()===""||(f.preventDefault(),r.marketplaceAdd(o.trim()),u(""))}}),s.jsx("button",{className:"btn",disabled:o.trim()==="",onClick:()=>{r.marketplaceAdd(o.trim()),u("")},children:"Добавить"})]})]})}const Td=30;function LA({catalog:n,hasMarketplaces:l,actions:i,onMarketplaces:r}){const[o,u]=p.useState(""),[f,g]=p.useState(""),[x,_]=p.useState(Td),[b,j]=p.useState(""),N=p.useMemo(()=>[...new Set(n.map(E=>E.category).filter(Boolean))].sort(),[n]),k=p.useMemo(()=>{const w=o.trim().toLowerCase();return n.filter(E=>f&&E.category!==f?!1:w?`${E.name} ${E.displayName} ${E.description} ${E.author}`.toLowerCase().includes(w):!0)},[n,o,f]);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:w=>{u(w.target.value),_(Td)}}),s.jsx(Ml,{title:"Категория",value:f,options:[{value:"",label:"все категории"},...N.map(w=>({value:w,label:w}))],onChange:w=>{g(w),_(Td)}})]}),k.length===0?s.jsx("p",{className:"modal__text",children:"Ничего не нашлось."}):s.jsx("ul",{className:"extlist",children:k.slice(0,x).map(w=>s.jsxs("li",{className:"extlist__row",children:[s.jsxs("div",{className:"extlist__head",children:[s.jsx("span",{className:"extlist__name",children:w.name}),w.installed&&s.jsx("span",{className:"chip chip--ok",children:"установлен"}),w.version&&s.jsx("span",{className:"chip",children:w.version}),w.category&&s.jsx("span",{className:"chip",children:w.category})]}),w.description&&s.jsx("div",{className:"catalog__desc",children:w.description}),s.jsxs("div",{className:"extlist__meta",children:[w.author&&`${w.author} · `,w.marketplace]}),s.jsxs("div",{className:"extlist__actions",children:[s.jsx("button",{className:"btn btn--ghost btn--sm",disabled:w.installed,onClick:()=>i.pluginInstall(w.id),children:w.installed?"Уже стоит":"Установить"}),w.homepage&&s.jsx("a",{className:"btn btn--ghost btn--sm",href:w.homepage,target:"_blank",rel:"noreferrer",children:"Страница"})]})]},w.id))}),k.length>x&&s.jsx("div",{className:"extbar",children:s.jsxs("button",{className:"btn",onClick:()=>_(w=>w+Td),children:["Ещё ",Math.min(Td,k.length-x)," из ",k.length-x]})}),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:w=>j(w.target.value),onKeyDown:w=>{w.key!=="Enter"||b.trim()===""||(w.preventDefault(),i.pluginInstall(b.trim()),j(""))}}),s.jsx("button",{className:"btn",disabled:b.trim()==="",onClick:()=>{i.pluginInstall(b.trim()),j("")},children:"Установить"})]})]})]})}function OA({accounts:n,auth:l,logins:i,candidates:r,usage:o,actions:u,activeAccountId:f,error:g,onReconnect:x,reconnectBlocked:_,reconnectHint:b,onOpenLogin:j,onClose:N}){const k=n.length>1,[w,E]=p.useState(!1),C=n.find(F=>F.main)??n[0],T=p.useRef(n.length);p.useEffect(()=>{n.length>T.current&&E(!1),T.current=n.length},[n.length]);const z=n.map(F=>`${F.id}:${F.dir}`).join("|"),q=p.useRef(u.discover);q.current=u.discover,p.useEffect(()=>{q.current()},[z]);const te=p.useRef(u.requestUsage);te.current=u.requestUsage;const[I,R]=p.useState(!1);p.useEffect(()=>{te.current();const F=window.setInterval(()=>te.current(),9e4),le=window.setTimeout(()=>R(!0),25e3);return()=>{window.clearInterval(F),window.clearTimeout(le)}},[]);const[$,Q]=p.useState(null),ee=$!==null&&Object.values(o).some(F=>F!=null&&F.fetchedAt>=$),G=$!==null&&!ee;p.useEffect(()=>{if($===null)return;if(ee){Q(null);return}const F=window.setTimeout(()=>Q(null),25e3);return()=>window.clearTimeout(F)},[$,ee]);const B=(r??[]).filter(F=>F.accountId===null&&!n.some(le=>le.dir===F.configDir));return s.jsxs(Sn,{title:k?"Аккаунты":"Аккаунт",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:G?"btn btn--ghost btn--sm acctlimits__btn is-busy":"btn btn--ghost btn--sm acctlimits__btn","aria-label":"Обновить лимиты","aria-busy":G,disabled:G,onClick:()=>{Q(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:G?"Обновляем…":"Обновить"})]})]}),n.map(F=>{var le;return s.jsx(YA,{account:F,multi:k,status:l[F.id]??null,usage:o[F.id],usageSettled:I,main:C,loginActive:((le=i[F.id])==null?void 0:le.active)===!0,actions:u,takenColors:n.filter(ue=>ue.id!==F.id).map(ue=>ue.color),onReconnect:F.id===f?x:null,reconnectBlocked:_,reconnectHint:b,onOpenLogin:()=>j(F.id)},F.id)}),g&&s.jsx("p",{className:"account__warn",role:"alert",children:g}),B.length>0&&C&&s.jsx($A,{found:B,accounts:n,main:C,onConnect:(F,le,ue,ce)=>u.add(le,ue,F.configDir,ce),onMakeMain:F=>u.update(C.id,{configDir:F.configDir})}),w?s.jsx(XA,{accounts:n,onAdd:u.add,onCancel:()=>E(!1)}):s.jsx("button",{type:"button",className:"btn account__add",onClick:()=>E(!0),children:"+ Добавить аккаунт"})]})}function zA(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 IA(n){const l=n.split(/[\\/]+/).filter(Boolean);return(l[l.length-1]??"").replace(/^\.+/,"").slice(0,am)}function $A({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(UA,{candidate:u,accounts:l,main:i,onConnect:r,onMakeMain:o},u.configDir))})]})}function UA({candidate:n,accounts:l,main:i,onConnect:r,onMakeMain:o}){const[u,f]=p.useState(!1),[g,x]=p.useState(!1),[_,b]=p.useState(()=>IA(n.configDir)),[j,N]=p.useState(!0),k=_.trim(),w=l.some(q=>q.name.toLowerCase()===k.toLowerCase()),E=Ki.find(q=>!l.some(te=>te.color===q))??Ki[1],C=`found-${n.configDir.replace(/[^a-z0-9]/gi,"-")}`,T=i.liveSessions>0;function z(q){q.preventDefault(),k!==""&&r(n,k,E,j)}return s.jsxs("li",{className:"found__row",children:[s.jsxs("div",{className:"found__id",children:[s.jsx("span",{className:"found__email",children:n.email||"Вход выполнен"}),n.plan&&s.jsx("span",{className:"chip",children:n.plan})]}),n.organization&&s.jsx("div",{className:"extlist__meta",children:n.organization}),s.jsx("div",{className:"acctcard__dir found__dir",title:n.configDir,children:zA(n.configDir)}),u?s.jsxs("form",{className:"found__form",onSubmit:z,children:[s.jsx("label",{className:"field",htmlFor:`${C}-name`,children:"Название аккаунта"}),s.jsx("input",{id:`${C}-name`,className:"input",value:_,maxLength:am,autoFocus:!0,autoComplete:"off","aria-describedby":w?`${C}-taken`:void 0,onChange:q=>b(q.target.value)}),w&&s.jsx("p",{className:"account__note",id:`${C}-taken`,children:"Такое имя уже есть — хост откажет. Выберите другое."}),s.jsxs("label",{className:"acctform__check",children:[s.jsx("input",{type:"checkbox",checked:j,onChange:q=>N(q.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:()=>f(!1),children:"Отмена"}),s.jsx("button",{type:"submit",className:"btn btn--primary",disabled:k==="",children:"Подключить"})]})]}):s.jsxs("div",{className:"found__actions",children:[s.jsx("button",{type:"button",className:"btn btn--primary btn--sm",onClick:()=>f(!0),children:"Подключить"}),s.jsxs("button",{type:"button",className:"btn btn--ghost btn--sm found__more","aria-expanded":g,"aria-controls":`${C}-more`,onClick:()=>x(q=>!q),children:["Ещё",s.jsx("svg",{viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",className:g?"is-open":"",children:s.jsx("path",{d:"m3 4.5 3 3 3-3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]})]}),g&&!u&&s.jsxs("div",{className:"found__menu",id:`${C}-more`,children:[s.jsx("button",{type:"button",className:"btn btn--sm",disabled:T,onClick:()=>o(n),children:"Сделать основным"}),s.jsx("span",{className:"account__note found__why",children:T?`Сначала закройте сессии основного аккаунта (${i.liveSessions}).`:`Основной аккаунт «${i.name}» будет брать вход из этой папки.`})]})]})}const BA="Вход выполняется в Настройках → Вход и выход Claude Code.",HA=120*1e3;function qA(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 GA({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>HA;return s.jsxs("div",{className:"acctusage",children:[s.jsx(sx,{usage:n,variant:"card"}),i&&s.jsxs("p",{className:"account__step acctusage__age",children:["Показания от ",qA(n.fetchedAt)]})]})}function YA({account:n,multi:l,status:i,usage:r,usageSettled:o,main:u,loginActive:f,actions:g,takenColors:x,onReconnect:_,reconnectBlocked:b,reconnectHint:j,onOpenLogin:N}){const[k,w]=p.useState(!1),E=n.id,C=_!==null&&(i==null?void 0:i.loggedIn)===!0,T=!l,z=!k&&s.jsx("button",{type:"button",className:"btn btn--ghost btn--sm",onClick:()=>w(!0),"aria-label":l?`Изменить аккаунт «${n.name}»`:"Изменить каталог аккаунта",children:l?"Изменить":"Изменить каталог"});return s.jsxs("section",{className:`acctcard acct--${n.color}${T?" 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:"основной"})]}),z]}),k?s.jsx(FA,{account:n,multi:l,main:u,takenColors:x,onSave:q=>{g.update(E,q),w(!1)},onMakeMain:()=>{g.makeMain(E),w(!1)},onRemove:()=>g.remove(E),onCancel:()=>w(!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:VA[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(GA,{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:f?"Вход идёт — продолжите в Настройках.":BA}),s.jsx("button",{type:"button",className:"btn btn--sm",onClick:N,children:f?"Продолжить вход":"Открыть вход в Настройках"})]}),!k&&n.dir!==""&&s.jsxs("div",{className:"acctdir",children:[s.jsx("div",{className:"acctcard__dir",title:"Каталог конфигурации: вход, тариф, лимиты и транскрипты этого аккаунта",children:n.dir}),n.main&&n.configDir===null&&s.jsx("span",{className:"account__step",children:"унаследован из окружения"}),T&&s.jsx("div",{className:"acctdir__edit",children:z})]}),C&&!k&&s.jsxs(s.Fragment,{children:[b&&s.jsx("p",{className:"account__note",children:j}),s.jsx("div",{className:"extbar account__bar",children:s.jsxs("button",{type:"button",className:"btn account__relink",title:`Переподключить сессию
|
|
160
|
+
${j}`,"aria-label":"Переподключить сессию",disabled:b,onClick:_??void 0,children:[s.jsx(KA,{}),"Переподключить"]})})]})]})}const VA={"claude.ai":"подписка Claude",console:"Anthropic Console",apiKey:"API-ключ",none:"нет"};function Bv({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 f=Ki.indexOf(n),g=Ki[(f+u+Ki.length)%Ki.length];if(g){i(g);const x=o.currentTarget;window.requestAnimationFrame(()=>{var _;return(_=x.querySelector(`[data-color="${g}"]`))==null?void 0:_.focus()})}}return s.jsx("div",{className:"colorpick",role:"radiogroup","aria-label":"Цвет аккаунта",onKeyDown:r,children:Ki.map(o=>{const u=o===n;return s.jsx("button",{type:"button",role:"radio","aria-checked":u,"aria-label":Ch[o],title:l.includes(o)?`${Ch[o]} — уже у другого аккаунта`:Ch[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 am=40;function FA({account:n,multi:l,main:i,takenColors:r,onSave:o,onMakeMain:u,onRemove:f,onCancel:g}){const[x,_]=p.useState(n.name),[b,j]=p.useState(n.color),[N,k]=p.useState(n.dir),[w,E]=p.useState(!1),[C,T]=p.useState(!1),z=x.trim(),q=N.trim(),te=q!==""&&q!==n.dir,I=z!==n.name||b!==n.color||te,R=n.liveSessions,$=R>0,Q=`acct-edit-${n.id}`,ee=!n.main&&i!==void 0,G=R>0||((i==null?void 0:i.liveSessions)??0)>0,B=!n.main;function F(le){le.preventDefault(),!(l&&z===""||!I)&&o({...z!==n.name?{name:z}:{},...b!==n.color?{color:b}:{},...te?{configDir:q}:{}})}return s.jsxs("div",{className:"acctform",children:[s.jsxs("form",{className:"extform acctform__fields",onSubmit:F,children:[l&&s.jsxs(s.Fragment,{children:[s.jsx("label",{className:"field",htmlFor:`${Q}-name`,children:"Имя"}),s.jsx("input",{id:`${Q}-name`,className:"input",value:x,maxLength:am,autoFocus:!0,autoComplete:"off",onChange:le=>_(le.target.value)}),s.jsx("span",{className:"field",children:"Цвет"}),s.jsx(Bv,{value:b,taken:r,onChange:j})]}),s.jsx("label",{className:"field",htmlFor:`${Q}-dir`,children:"Каталог конфигурации"}),s.jsx("input",{id:`${Q}-dir`,className:"input input--mono",value:N,disabled:$,spellCheck:!1,autoComplete:"off",autoFocus:!l,placeholder:"~/.claude","aria-describedby":`${Q}-dirnote`,onChange:le=>k(le.target.value)}),s.jsx("p",{className:"account__step acctform__note",id:`${Q}-dirnote`,children:$?`Каталог нельзя менять, пока у аккаунта есть живые сессии (${R}) — сначала закройте их.`:"Здесь лежат вход, тариф и история аккаунта. Файлы не переносятся: аккаунт начнёт брать вход из новой папки."}),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:g,children:"Отмена"}),s.jsx("button",{type:"submit",className:"btn btn--primary",disabled:l&&z===""||!I,children:"Сохранить"})]})]}),ee&&s.jsxs("div",{className:"acctform__zone",children:[s.jsx("h4",{className:"acctform__zonetitle",children:"Основной аккаунт"}),s.jsx("p",{className:"account__note",children:`Аккаунты поменяются местами: «Основной» станет «${n.name}» и наоборот — каталог, имя и цвет. Файлы не переносятся.`}),G?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:R>0&&((i==null?void 0:i.liveSessions)??0)>0?`Сначала закройте сессии обоих аккаунтов: этого (${R}) и основного (${i==null?void 0:i.liveSessions}).`:R>0?`Сначала закройте сессии этого аккаунта (${R}).`:`Сначала закройте сессии основного аккаунта (${i==null?void 0:i.liveSessions}).`})]}):w?s.jsxs("div",{className:"extbar",children:[s.jsx("button",{type:"button",className:"btn btn--sm",onClick:()=>E(!1),children:"Отмена"}),s.jsx("button",{type:"button",className:"btn btn--primary btn--sm",autoFocus:!0,onClick:u,children:"Поменять местами"})]}):s.jsx("button",{type:"button",className:"btn btn--sm",onClick:()=>E(!0),children:"Сделать основным"})]}),B&&s.jsxs("div",{className:"acctform__zone",children:[s.jsx("h4",{className:"acctform__zonetitle",children:"Убрать аккаунт"}),R>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:`Сначала закройте сессии этого аккаунта (${R}).`})]}):C?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"account__note",role:"alert",children:`Убрать аккаунт «${n.name}» из списка? Его каталог ${n.dir} останется на диске, вход в нём сохранится.`}),s.jsxs("div",{className:"extbar",children:[s.jsx("button",{type:"button",className:"btn btn--sm",onClick:()=>T(!1),children:"Отмена"}),s.jsx("button",{type:"button",className:"btn btn--danger btn--sm",autoFocus:!0,onClick:f,children:"Убрать из списка"})]})]}):s.jsx("button",{type:"button",className:"btn btn--danger btn--sm",onClick:()=>T(!0),children:"Убрать из списка"})]})]})}function XA({accounts:n,onAdd:l,onCancel:i}){const r=n.map(w=>w.color),[o,u]=p.useState(""),[f,g]=p.useState(()=>Ki.find(w=>!r.includes(w))??Ki[1]),[x,_]=p.useState(""),[b,j]=p.useState(!0),N=o.trim();function k(w){w.preventDefault(),N!==""&&l(N,f,x.trim()===""?null:x.trim(),b)}return s.jsxs("form",{className:"extform extform--card acctform",onSubmit:k,children:[s.jsx("label",{className:"field",htmlFor:"acct-new-name",children:"Название аккаунта"}),s.jsx("input",{id:"acct-new-name",className:"input",value:o,maxLength:am,placeholder:"Например, Работа",autoFocus:!0,autoComplete:"off",onChange:w=>u(w.target.value)}),s.jsx("span",{className:"field",children:"Цвет"}),s.jsx(Bv,{value:f,taken:r,onChange:g}),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:x,spellCheck:!1,autoComplete:"off",placeholder:"~/.claude-ccv-…",onChange:w=>_(w.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:w=>j(w.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 KA(){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 QA({state:n,onPair:l,onUnpair:i,onClose:r}){const[o,u]=p.useState(""),[f,g]=p.useState(""),[x,_]=p.useState(!1),b=p.useRef(null),j=(n==null?void 0:n.paired)===!0;p.useEffect(()=>{var k;j||(k=b.current)==null||k.focus()},[j]),p.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(Sn,{title:"Удалённый доступ",onClose:r,children:j?s.jsxs("div",{className:"relay",children:[s.jsxs("p",{className:"relay__lede",children:["Компьютер связан с аккаунтом на ",s.jsx("b",{children:Oy(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:Oy(N)})," и войдите (или зарегистрируйтесь)."]}),s.jsxs("li",{children:["Нажмите ",s.jsx("b",{children:"«Подключить ПК»"})," — появится код из восьми знаков."]}),s.jsx("li",{children:"Введите его сюда."})]}),s.jsxs("form",{className:"relay__form",onSubmit:k=>{k.preventDefault(),o.trim()&&(_(!0),l(o.trim(),f.trim()))},children:[s.jsxs("label",{className:"field",children:[s.jsx("span",{children:"Код сопряжения"}),s.jsx("input",{ref:b,className:"input relay__code",value:o,onChange:k=>u(k.target.value.toUpperCase()),placeholder:"XXXX-XXXX",autoComplete:"off",spellCheck:!1,maxLength:12})]}),s.jsxs("label",{className:"field",children:[s.jsx("span",{children:"Как назвать этот компьютер"}),s.jsx("input",{className:"input",value:f,onChange:k=>g(k.target.value),placeholder:"имя машины",autoComplete:"off",maxLength:64})]}),(n==null?void 0:n.error)&&s.jsx("p",{className:"relay__error",children:n.error}),s.jsx("button",{className:"btn btn--primary",type:"submit",disabled:!o.trim()||x,children:x?"Связываем…":"Связать"})]})]})})}function Oy(n){try{return new URL(n).host}catch{return n}}const PA={active:!1,url:"",awaitingCode:!1,output:"",error:null},ZA={"claude.ai":"подписка Claude",console:"Anthropic Console",apiKey:"API-ключ",none:"нет"};function WA({accounts:n,auth:l,logins:i,actions:r,remote:o,runningByAccount:u,focusAccountId:f}){return s.jsx("div",{className:"loginlist",children:n.map(g=>s.jsx(JA,{account:g,status:l[g.id]??null,login:i[g.id]??PA,actions:r,remote:o,running:u[g.id]??0,focused:g.id===f},g.id))})}function JA({account:n,status:l,login:i,actions:r,remote:o,running:u,focused:f}){const[g,x]=p.useState(""),[_,b]=p.useState(!1),[j,N]=p.useState(!1),k=p.useRef(null),w=n.id;p.useEffect(()=>{var q;f&&((q=k.current)==null||q.scrollIntoView({block:"nearest"}))},[f]);const E=p.useMemo(()=>{if(i.error)return{ok:!1,message:i.error};const q=i.output.trim();return q===""?null:{ok:!0,message:q}},[i.error,i.output]);function C(q=g){const te=q.trim();te!==""&&(r.submitCode(w,te),x(""))}function T(){if(u>0){b(!1),N(!0);return}r.login(w,"claudeai",!0)}const z=(l==null?void 0:l.loggedIn)===!0;return s.jsxs("section",{ref:k,className:`acctcard logincard acct--${n.color}${f?" 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":z?"chip--ok":"chip--warn"}`,children:l===null?"проверяем":z?"вошёл":"не вошёл"})]}),z&&s.jsx("div",{className:"logincard__who",children:[l.email||"Вход выполнен",l.plan,ZA[l.method]??l.method].filter(Boolean).join(" · ")}),i.active?s.jsx(tM,{login:i,remote:o,code:g,onCode:x,onSubmit:C,onCancel:()=>r.cancel(w),inputId:`auth-code-${w}`}):s.jsxs(s.Fragment,{children:[s.jsx(Pr,{result:E}),(j||_)&&u>0&&s.jsx("p",{className:"account__warn",role:"alert",children:eM(u)}),s.jsx("div",{className:"extbar logincard__bar",children:z?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(w,"claudeai",!0)},children:"Всё равно сменить"})]}):s.jsx("button",{type:"button",className:"btn",onClick:T,children:"Сменить аккаунт"}),_?s.jsx("button",{type:"button",className:"btn btn--danger",autoFocus:!0,onClick:()=>{b(!1),r.logout(w)},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(w,"console",!1),children:"Через Console"}),s.jsx("button",{type:"button",className:"btn btn--primary",onClick:()=>r.login(w,"claudeai",!1),children:"Войти"})]})})]})]})}function eM(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 tM({login:n,remote:l,code:i,onCode:r,onSubmit:o,onCancel:u,inputId:f}){var E;const[g,x]=p.useState(null),_=p.useRef(""),b=p.useRef({code:i,onCode:r,onSubmit:o});b.current={code:i,onCode:r,onSubmit:o};const j=p.useCallback(async C=>{const{code:T,onCode:z,onSubmit:q}=b.current;if(C&&T.trim()!=="")return;const te=await mg();if(te===null){C||x("Не получилось прочитать буфер — вставьте код в поле руками.");return}const I=te.trim();if(!zy(I)){C||x("В буфере не похоже на код: нужен он целиком, вместе с частью после «#». Подойдёт и адрес страницы, на которую увёл браузер, — его тоже разберём.");return}if(C){if(_.current===I)return;_.current=I}x(null),z(I),q(I)},[]);p.useEffect(()=>{if(!n.awaitingCode)return;const C=()=>{document.visibilityState==="visible"&&j(!0)};return document.addEventListener("visibilitychange",C),()=>document.removeEventListener("visibilitychange",C)},[n.awaitingCode,j]);const N=typeof((E=navigator.clipboard)==null?void 0:E.readText)=="function",k=i.trim()!==""&&!zy(i),w=g??(k?"Похоже, скопирована только часть кода — нужен он целиком, вместе с частью после «#».":null);return s.jsxs("div",{className:"account__flow",children:[n.url?l?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"field",children:"Подтвердите вход на странице Anthropic"}),s.jsx("a",{className:"btn btn--primary account__go",href:n.url,target:"_blank",rel:"noreferrer",children:"Открыть страницу входа"}),s.jsx("p",{className:"account__step",children:"После кнопки «Authorize» там появится код — скопируйте его и вернитесь сюда."}),s.jsxs("div",{className:"account__raw",children:[s.jsx("span",{className:"account__rawurl",children:n.url}),s.jsx(Ca,{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:f,children:"Код со страницы авторизации"}),s.jsxs("div",{className:"extform__row account__coderow",children:[s.jsx("input",{id:f,className:"input input--mono",value:i,autoFocus:!l,spellCheck:!1,autoComplete:"off",placeholder:"код#state",onChange:C=>{x(null),r(C.target.value)},onKeyDown:C=>{C.key==="Enter"&&(C.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:"Готово"})]}),w&&s.jsx("p",{className:"account__note account__note--code",children:w})]}),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 zy(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 nM(){const n=uu(),l=IE(),[i,r]=p.useState(vv),o=kv("sample"),u=p.useMemo(()=>{const g=_=>_.toLowerCase().startsWith("ru")?0:_.toLowerCase().startsWith("en")?1:2,x=[...l].sort((_,b)=>g(_.lang)-g(b.lang)||_.name.localeCompare(b.name));return[{value:"",label:"Автоматически",hint:"Русский или английский — по языку текста"},...x.map(_=>({value:_.voiceURI,label:_.name,hint:_.lang}))]},[l]);function f(g){const x={...i,...g};r(x),DE(x)}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(Ml,{className:"settings__select",value:i.voice,options:u,onChange:g=>f({voice:g}),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:Fp.min,max:Fp.max,step:Fp.step,value:i.rate,"aria-label":"Скорость озвучки",onChange:g=>f({rate:Number(g.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?Wg():BE(i),children:o?"Остановить":"Проверить"})})]}):s.jsx("p",{className:"settings__hint",children:"Этот браузер не умеет синтезировать речь."})]})}const Iy=[{id:"claude",label:"Claude",hint:"Claude Code"},{id:"antigravity",label:"Antigravity",hint:"Google agy"},{id:"codex",label:"Codex",hint:"OpenAI Codex"}],sM=[{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:"Сочетания клавиш."}],lM=[{label:"Вход и токены (.credentials.json)",why:"У каждого аккаунта свой."},{label:".claude.json",why:"В нём личность вошедшего и пользовательские MCP-серверы: общий файл смешал бы аккаунты."},{label:"История сессий и лимиты",why:"У каждого аккаунта своя."}],Jp="",aM=[{value:"opus",label:"Opus",hint:"полный список моделей виден, когда открыта сессия"},{value:"sonnet",label:"Sonnet",hint:"полный список моделей виден, когда открыта сессия"},{value:"haiku",label:"Haiku",hint:"полный список моделей виден, когда открыта сессия"}],iM=Og.map(n=>({value:n.value,label:n.value,hint:n.hint})),kh=3600*1e3,rM=[{value:"6h",label:"6 часов"},{value:"24h",label:"Сутки"},{value:"48h",label:"Двое суток"},{value:"168h",label:"Неделя"},{value:"never",label:"Никогда"}],Fo={"6h":6*kh,"24h":24*kh,"48h":48*kh,"168h":168*kh,never:0};function cM(n){return Fo[n]??Fo["48h"]}const oM=[{value:"5m",label:"5 минут"},{value:"10m",label:"10 минут"},{value:"30m",label:"30 минут"},{value:"60m",label:"Час"},{value:"never",label:"Никогда"}],wh=60*1e3,Xo={"5m":5*wh,"10m":10*wh,"30m":30*wh,"60m":60*wh,never:0};function uM(n){return Xo[n]??Xo["10m"]}function dM(n){const l=Object.entries(Xo).find(([,i])=>i===n);return l?l[0]:Object.keys(Xo).reduce((i,r)=>Math.abs(Xo[r]-n)<Math.abs(Xo[i]-n)?r:i)}function fM(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 hM=[{value:"off",label:"Выключено"},{value:"500",label:"0.5 с"},{value:"1500",label:"1.5 с"},{value:"3000",label:"3 с"},{value:"10000",label:"10 с"}],Ko={off:0,500:500,1500:1500,3e3:3e3,1e4:1e4};function mM(n){return Ko[n]??Ko.off}function $y(n){return Number.isFinite(n)?Math.min(100,Math.max(0,Math.round(n))):0}function pM(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)}const gM=[{value:"project",title:"Только текущий проект",description:"Агент молча пишет файлы в открытом проекте и в ~/.claude — настройках самого Claude Code. Чужой проект и любая новая папка — только с явного разрешения."},{value:"projects",title:"Папка с проектами",description:"То же плюс каталог, где лежат открытые проекты, — то есть и соседний проект тоже. Всё остальное — с разрешения."},{value:"all",title:"Все папки на компьютере",description:"Агент пишет файлы куда угодно на диске — вопросов про место записи не будет.",risky:!0}];function xM({value:n,onCommit:l}){const[i,r]=p.useState(String(n));p.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 f=u===0?0:Math.max(200,u);r(String(f)),f!==n&&l(f)};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 _M({settings:n,models:l,relayState:i,networkState:r,local:o,onChange:u,onEnableShell:f,onDisableShell:g,onOpenRelay:x,claudeLogin:_,onClose:b}){const j=p.useRef(null),N=n===null,k=_.focusAccountId!==null;p.useEffect(()=>{var G;k&&((G=j.current)==null||G.scrollIntoView({block:"start"}))},[k]);const[w,E]=p.useState(""),[C,T]=p.useState(null),z=!N&&n.networkGuardEnabled,q=(n==null?void 0:n.networkGuardBlockedCountries)??[];function te(){const G=w.trim().toUpperCase();if(G!==""){if(!/^[A-Z]{2}$/.test(G)){T("Нужен код из двух латинских букв, например RU или CN.");return}if(q.includes(G)){T(`Код ${G} уже в списке.`);return}T(null),E(""),u({networkGuardBlockedCountries:[...q,G]})}}const I=!N&&n.terminalEnabled===!0,R=!N&&n.liveSessionsFirst===!0,$=!I,Q=p.useMemo(()=>{const G=[{value:Jp,label:"Как в Claude Code",hint:"модель определят настройки самого Claude Code"},...l.length>0?l.map(B=>({value:B.value,label:B.displayName,hint:B.description})):aM];return n&&n.startModel!==null&&!G.some(B=>B.value===n.startModel)&&G.push({value:n.startModel,label:n.startModel}),G},[l,n]);function ee(){var G,B;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:x,children:"Связать компьютер"})]}):(G=i.shell)!=null&&G.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:g,children:"Запретить"})]}):(B=i.shell)!=null&&B.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:f,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:f,children:"Разрешить с телефона"})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"settings__hint",children:"Отсюда мгновенно не включится: на почту аккаунта уйдёт письмо, и терминал заработает только после перехода по ссылке из него."}),s.jsx("button",{type:"button",className:"btn",disabled:$,onClick:f,children:"Прислать письмо"})]})]})}return s.jsx(Sn,{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(Ml,{className:"settings__select",value:fM(n.autoArchiveAfterMs),options:rM,onChange:G=>u({autoArchiveAfterMs:cM(G)}),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(Ml,{className:"settings__select",value:dM(n.autoStopAfterMs),options:oM,onChange:G=>u({autoStopAfterMs:uM(G)}),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:G=>u({limitStopFiveHourPct:$y(G.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:G=>u({limitStopSevenDayPct:$y(G.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":z,"aria-label":"Kill switch: останавливать агентов, если упал VPN",className:z?"switch is-on":"switch",onClick:()=>u({networkGuardEnabled:!z}),children:s.jsx("span",{className:"switch__knob"})})]}),z&&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:z?"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:[q.map(G=>s.jsxs("li",{className:"countries__chip",children:[s.jsx("span",{children:G}),s.jsx("button",{type:"button",className:"countries__remove","aria-label":`Убрать ${G} из списка`,disabled:!z,onClick:()=>u({networkGuardBlockedCountries:q.filter(B=>B!==G)}),children:"×"})]},G)),q.length===0&&s.jsx("li",{className:"settings__hint",children:"Список пуст: блокировать будет только сбой проверки."})]}),s.jsxs("form",{className:"countries__add",onSubmit:G=>{G.preventDefault(),te()},children:[s.jsx("input",{type:"text",className:"input countries__input",value:w,maxLength:2,placeholder:"RU",autoCapitalize:"characters",spellCheck:!1,disabled:!z,"aria-label":"Код страны, две буквы","aria-invalid":C!==null,onChange:G=>{E(G.target.value.toUpperCase()),T(null)}}),s.jsx("button",{type:"submit",className:"btn",disabled:!z||w.trim()==="",children:"Добавить"})]}),C&&s.jsx("p",{className:"settings__hint countries__error",role:"alert",children:C})]})]}),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(Ml,{className:"settings__select",value:pM(n.autoSaveAfterPauseMs),options:hM,onChange:G=>u({autoSaveAfterPauseMs:mM(G)}),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(xM,{value:n.longPasteThreshold,onCommit:G=>u({longPasteThreshold:G})}),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:"Выключенный агент не предлагается при создании новой сессии. Уже открытые сессии с ним продолжают работать."}),Iy.map(G=>{const B=(n==null?void 0:n.enabledProviders)??["claude","antigravity","codex"],F=!N&&B.includes(G.id),le=F&&B.length<=1;return s.jsxs("div",{className:"settings__switch-row settings__agent",children:[s.jsx("span",{className:`newsession__mark newsession__mark--${G.id}`,"aria-hidden":"true",children:G.id==="antigravity"?s.jsx(Qg,{className:"newsession__mark-logo"}):G.id==="codex"?s.jsx(Pg,{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:G.label}),s.jsx("span",{className:"settings__hint",children:le?"Хотя бы один агент должен остаться включённым":G.hint})]}),N?s.jsx("div",{className:"settings__switch-skeleton","aria-hidden":"true"}):s.jsx("button",{type:"button",role:"switch","aria-checked":F,"aria-label":G.label,disabled:le,title:le?"Хотя бы один агент должен остаться включённым":void 0,className:F?"switch is-on":"switch",onClick:()=>{const ue=Iy.map(ce=>ce.id).filter(ce=>ce===G.id?!F:B.includes(ce));u({enabledProviders:ue})},children:s.jsx("span",{className:"switch__knob"})})]},G.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:"Выбор действует, когда аккаунт добавляется или подключается с включённым общим доступом. Уже существующие аккаунты не меняются, ссылки не удаляются."}),sM.map(G=>{const B=(n==null?void 0:n.sharedConfigItems)??eb,F=!N&&B.includes(G.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:G.label}),s.jsx("span",{className:"settings__hint",children:G.hint})]}),N?s.jsx("div",{className:"settings__switch-skeleton","aria-hidden":"true"}):s.jsx("button",{type:"button",role:"switch","aria-checked":F,"aria-label":G.label,className:F?"switch is-on":"switch",onClick:()=>u({sharedConfigItems:eb.filter(le=>le===G.id?!F:B.includes(le))}),children:s.jsx("span",{className:"switch__knob"})})]},G.id)}),s.jsx("h4",{className:"settings__subheading",children:"Никогда не делится"}),s.jsx("ul",{className:"settings__never",children:lM.map(G=>s.jsxs("li",{children:[s.jsx("span",{className:"settings__never-name",children:G.label}),s.jsx("span",{className:"settings__hint",children:G.why})]},G.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(Ml,{className:"settings__select",value:n.startModel??Jp,options:Q,onChange:G=>u({startModel:G===Jp?null:G}),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(Ml,{className:"settings__select",value:n.startPermissionMode,options:iM,onChange:G=>u({startPermissionMode:G}),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":R,"aria-label":"Запущенные сессии сверху",className:R?"switch is-on":"switch",onClick:()=>u({liveSessionsFirst:!R}),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:gM.map(G=>{const B=!N&&n.folderAccess===G.value;return s.jsxs("button",{type:"button",role:"radio","aria-checked":B,disabled:N,className:"access__card"+(B?" is-on":"")+(G.risky?" access__card--risky":""),onClick:()=>u({folderAccess:G.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:[G.title,G.risky&&s.jsx("span",{className:"access__risk",children:"самое широкое"})]}),s.jsx("span",{className:"access__desc",children:G.description})]})]},G.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":I,"aria-label":"Терминал",className:I?"switch is-on":"switch",onClick:()=>u({terminalEnabled:!I}),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:"Сначала включите терминал выше — удалённый доступ выдаётся к тому, что на этой машине уже разрешено, а не поверх выключенного рубильника."}),ee()]})]})]}),s.jsx(nM,{}),s.jsxs("details",{ref:j,className:"settings__section settings__advanced",open:k||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(WA,{..._})]})]})]})})}const im="Новая сессия начнётся с нуля: на другой аккаунт переходит только текст хэндоффа, прежний разговор под ним не открыть.";function Hv({targets:n,selectedId:l,sourceId:i,onSelect:r,variant:o,className:u,disabled:f}){const{auth:g}=Dg(),x=n.find(R=>R.id===l)??n[0],[_,b]=p.useState(!1),[j,N]=p.useState(0),[k,w]=p.useState({left:0,top:0}),E=p.useRef(null),C=p.useRef(null);function T(){N(Math.max(0,n.findIndex(R=>R.id===l))),b(!0)}function z(R){var $;b(!1),R&&(($=E.current)==null||$.focus())}function q(R){r(R.id),z(!0)}p.useLayoutEffect(()=>{if(!_)return;const R=E.current,$=C.current;if(!R||!$)return;const Q=R.getBoundingClientRect(),ee=$.getBoundingClientRect(),G=8,B=Math.max(G,Math.min(Q.right-ee.width,window.innerWidth-ee.width-G));let F=Q.bottom+6;F+ee.height>window.innerHeight-G&&(F=Math.max(G,Q.top-ee.height-6)),w({left:B,top:F}),$.focus()},[_]),p.useLayoutEffect(()=>{if(!_)return;function R($){var ee,G;const Q=$.target;!((ee=C.current)!=null&&ee.contains(Q))&&!((G=E.current)!=null&&G.contains(Q))&&z(!1)}return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[_]);function te(R){if(R.key==="Escape")R.preventDefault(),R.stopPropagation(),z(!0);else if(R.key==="ArrowDown"||R.key==="ArrowUp"){R.preventDefault();const $=R.key==="ArrowDown"?1:-1;N(Q=>(Q+$+n.length)%n.length)}else if(R.key==="Enter"||R.key===" "){R.preventDefault();const $=n[j];$&&q($)}else R.key==="Tab"&&z(!1)}if(!x)return null;const I=`Аккаунт новой сессии: «${x.name}». Сменить`;return s.jsxs(s.Fragment,{children:[s.jsxs("button",{ref:E,type:"button",className:`${o==="split"?"splitbtn__caret":"pane-btn pane-btn--target"}${u?` ${u}`:""}`,title:I,"aria-label":I,"aria-haspopup":"menu","aria-expanded":_,disabled:f,onClick:()=>_?z(!1):T(),onKeyDown:R=>{(R.key==="ArrowDown"||R.key==="ArrowUp")&&(R.preventDefault(),T())},children:[o==="mark"&&s.jsx(Sa,{account:x,size:"sm",className:"pane-btn__mark"}),s.jsx("svg",{className:"splitbtn__icon",viewBox:"0 0 10 6",fill:"none","aria-hidden":"true",children:s.jsx("path",{d:"M1 1.2 5 5 9 1.2",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})]}),_&&s.jsxs("div",{ref:C,className:"newsession__menu targetmenu",style:{left:k.left,top:k.top},role:"menu","aria-label":"Аккаунт новой сессии",tabIndex:-1,onKeyDown:te,children:[s.jsx("p",{className:"targetmenu__note",children:im}),n.map((R,$)=>{const Q=t0(g[R.id]);return s.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":R.id===l,className:"newsession__item"+($===j?" is-cursor":""),onMouseEnter:()=>N($),onClick:()=>q(R),children:[s.jsx("span",{className:"newsession__mark newsession__mark--account",children:s.jsx(Sa,{account:R,size:"md"})}),s.jsxs("span",{className:"newsession__text",children:[s.jsx("span",{className:"newsession__label",children:R.name}),Q&&s.jsx("span",{className:"newsession__hint",children:Q})]}),R.id===i&&s.jsx("span",{className:"newsession__tag",children:"прежняя"}),R.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"})})]},R.id)})]})]})}function bM({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:im})]})}const Uy={fiveHour:"5-часовой лимит",sevenDay:"недельный лимит"};function yM(n){if(!n)return"срок неизвестен";const l=new Date(n);return Number.isNaN(l.getTime())?"срок неизвестен":l.toLocaleString()}function By({label:n,primary:l,choice:i,onContinue:r}){const o=`btn btn--sm${l?" btn--primary":""}`,u=i==null?void 0:i.targets.find(g=>g.id===i.selectedId);if(!i||!u)return s.jsx("button",{type:"button",className:o,onClick:r,children:n});const f=u.id!==i.sourceId;return s.jsxs("span",{className:`splitbtn${l?" splitbtn--primary":""}`,children:[s.jsxs("button",{type:"button",className:`${o} splitbtn__main`,title:f?im:`Новая сессия на том же аккаунте «${u.name}»`,onClick:r,children:[s.jsx("span",{className:`newsession__acct acct--${u.color}`,"aria-hidden":"true"}),n," на «",u.name,"»"]}),s.jsx(Hv,{variant:"split",className:o,targets:i.targets,selectedId:i.selectedId,sourceId:i.sourceId,onSelect:i.onSelect})]})}function vM({handoff:n,onContinue:l,onShow:i,onDismiss:r,sourceAccount:o=null,accountChoice:u=null}){if(n.continuedAt!==void 0){const f=n.limit===null?`Хэндофф записан вручную ${new Date(n.stoppedAt).toLocaleString()}`:`${Uy[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(),"."]})," ",f,".",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(By,{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,"»"]}),":"," "]}),Uy[n.limit]," (",Math.round(n.utilization)," %) — работа прервана"," ",new Date(n.stoppedAt).toLocaleString(),". Окно сбросится: ",yM(n.resetsAt),"."]}),n.source==="journal"&&" Хэндофф собран автоматически из журнала."]})]}),u&&u.selectedId!==u.sourceId&&s.jsx("p",{className:"handoff__hint",children:im}),s.jsxs("div",{className:"handoff__actions",children:[s.jsx(By,{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 jM({handoff:n,onClose:l}){const[i,r]=p.useState("");return p.useEffect(()=>{let o=!1;return Gd(n.text).then(u=>{o||r(u)}),()=>{o=!0}},[n.text]),s.jsx(Sn,{title:"Хэндофф",className:"modal--wide",onClose:l,children:s.jsx("div",{className:"markdown-preview",dangerouslySetInnerHTML:{__html:i}})})}function NM({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 kM({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 Zh={fiveHour:"5-часовой лимит",sevenDay:"недельный лимит"},wM=12e3;function SM(n){const l=n%10,i=n%100;return l===1&&i!==11?"сессии":"сессиях"}function EM({notices:n,onDismiss:l}){return n.length===0?null:s.jsx("div",{className:"limittoasts",children:n.map(i=>s.jsx(CM,{notice:i,onDismiss:()=>l(i.id)},i.id))})}function CM({notice:n,onDismiss:l}){return p.useEffect(()=>{const i=window.setTimeout(l,wM);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:["Достигнут ",Zh[n.limit]," (",Math.round(n.utilization)," %): работа прервана в ",n.stopped," ",SM(n.stopped),", хэндоффов —"," ",n.handoffs,". Сессии остаются запущенными."]}):s.jsxs(s.Fragment,{children:["Достигнут ",Zh[n.limit]," (",Math.round(n.utilization)," %): занятых сессий не было — ничего не прервано."]})}),s.jsx("button",{type:"button",className:"limittoast__dismiss","aria-label":"Закрыть уведомление",onClick:l,children:"✕"})]})}function TM(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,f]of r){if(!u||f<=0||u.utilization<f)continue;const g=Date.parse(u.resetsAt);if(!(!Number.isFinite(g)||g<=i))return{limit:o,utilization:u.utilization,resetsAt:g}}return null}function AM(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 MM=16;function RM({pane:n,width:l,onResize:i,onReset:r}){const o=Hc[n],u=p.useRef(null);function f(b){if(b.button!==0)return;const j=document.querySelector(".main"),N=j?Math.max(0,j.getBoundingClientRect().width-AN):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 g(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 x(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*MM*(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:f,onPointerMove:g,onPointerUp:x,onPointerCancel:x,onDoubleClick:r,onKeyDown:_,children:s.jsx("span",{className:"pane-resizer__line","aria-hidden":"true"})})}const DM=16;function LM({height:n,onResize:l,onReset:i}){const r=p.useRef(null);function o(){const _=document.querySelector(".main .transcript, .main .editor");if(!_)return 1/0;const b=_.getBoundingClientRect().height-LN;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 f(_){const b=r.current;if(!b)return;const j=b.y-_.clientY;l(b.height+j,b.max)}function g(_){r.current&&(r.current=null,_.currentTarget.hasPointerCapture(_.pointerId)&&_.currentTarget.releasePointerCapture(_.pointerId),document.body.classList.remove("is-resizing-row"))}function x(_){const b=_.key==="ArrowUp"?1:_.key==="ArrowDown"?-1:0;b!==0&&(_.preventDefault(),l(n+b*DM,o()))}return s.jsx("div",{className:"term-resizer",role:"separator","aria-orientation":"horizontal","aria-label":"Высота панели терминала","aria-valuenow":n,"aria-valuemin":g0,tabIndex:0,title:"Потяните, чтобы изменить высоту; двойной щелчок — высота по умолчанию",onPointerDown:u,onPointerMove:f,onPointerUp:g,onPointerCancel:g,onDoubleClick:i,onKeyDown:x,children:s.jsx("span",{className:"term-resizer__line","aria-hidden":"true"})})}function Hy(){const n=document.documentElement,l=getComputedStyle(n),i=z=>l.getPropertyValue(z).trim(),r=i("--surface"),o=i("--text"),u=i("--text-2"),f=i("--muted"),g=i("--accent"),x=i("--accent-fg"),_=i("--select"),b=i("--danger"),j=i("--ok"),N=i("--warn"),k=i("--cm-fn"),w=i("--cm-key"),E=i("--cm-type"),C=qy(o,r,55),T=z=>qy(z,"#ffffff",25);return{background:r,foreground:o,cursor:g,cursorAccent:x,selectionBackground:_,black:C,brightBlack:f,red:b,brightRed:T(b),green:j,brightGreen:T(j),yellow:N,brightYellow:T(N),blue:k,brightBlue:T(k),magenta:w,brightMagenta:T(w),cyan:E,brightCyan:T(E),white:u,brightWhite:o}}function OM(){return getComputedStyle(document.documentElement).getPropertyValue("--mono").trim()}let ni=null;function zM(n){return ni||(ni=document.createElement("span"),ni.style.position="fixed",ni.style.width="0",ni.style.height="0",ni.style.opacity="0",ni.style.pointerEvents="none",document.body.appendChild(ni)),ni.style.color=n,getComputedStyle(ni).color}function qy(n,l,i){return zM(`color-mix(in srgb, ${n} ${100-i}%, ${l} ${i}%)`)}let Sh=null;function IM(){return Sh||(Sh=Promise.all([at(()=>import("./xterm-D6Mng-DB.js").then(n=>n.x),__vite__mapDeps([28,26]),import.meta.url),at(()=>import("./addon-fit-CevVMrUA.js").then(n=>n.a),__vite__mapDeps([29,26]),import.meta.url),at(()=>import("./addon-web-links-CnB65OV_.js").then(n=>n.a),__vite__mapDeps([30,26]),import.meta.url),at(()=>Promise.resolve({}),__vite__mapDeps([31]),import.meta.url)]).then(([n,l,i])=>({Terminal:n.Terminal,FitAddon:l.FitAddon,WebLinksAddon:i.WebLinksAddon})).catch(n=>{throw Sh=null,n})),Sh}function $M({terminals:n,activeId:l,blocked:i,error:r,onDismissError:o,height:u,offset:f,mobile:g=!1,zoomed:x,onToggleZoom:_,onSelect:b,onOpen:j,onClose:N,onInput:k,onResize:w,onAttach:E,onHide:C,registerSink:T}){const[z,q]=p.useState(()=>Hy());return p.useEffect(()=>{const te=new MutationObserver(()=>q(Hy()));return te.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>te.disconnect()},[]),s.jsxs("div",{className:"termpanel"+(g?" termpanel--mobile":"")+(!g&&x?" termpanel--zoomed":""),style:g?{height:u,top:(f==null?void 0:f.top)??0,left:(f==null?void 0:f.left)??0}:x?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:I=>{_&&(I.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:x?"Свернуть терминал — то же самое, что двойной клик по вкладке":"Развернуть терминал на весь экран — то же самое, что двойной клик по вкладке","aria-label":x?"Свернуть терминал":"Развернуть терминал на весь экран","aria-pressed":x,onClick:_,children:s.jsx(ou,{active:x})}),s.jsx("button",{className:"termpanel__hide",title:"Скрыть панель","aria-label":"Скрыть панель терминала",onClick:C,children:"✕"})]}),r&&n.length>0&&s.jsx(Gy,{message:r,strip:!0,onRetry:null,onDismiss:o}),s.jsxs("div",{className:"termpanel__body",children:[r&&n.length===0?s.jsx(Gy,{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(BM,{id:te.id,exitCode:te.exitCode,active:te.id===l,theme:z,mobile:g,onInput:k,onResize:w,onAttach:E,registerSink:T},te.id))]})]})}function Gy({message:n,strip:l=!1,onRetry:i,onDismiss:r}){const{lede:o,hint:u,details:f}=UM(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}),f&&s.jsxs("details",{className:"termfail__details",children:[s.jsx("summary",{children:"Подробности"}),s.jsx("pre",{children:f})]})]}),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 UM(n){const[l="",...i]=n.trim().split(`
|
|
161
|
+
|
|
162
|
+
`),r=l.split(`
|
|
163
|
+
`).map(o=>o.trim()).filter(o=>o!=="");return{lede:r[0]??n.trim(),hint:r.slice(1).join(" "),details:i.join(`
|
|
164
|
+
|
|
165
|
+
`).trim()}}function BM({id:n,exitCode:l,active:i,theme:r,mobile:o,onInput:u,onResize:f,onAttach:g,registerSink:x}){const _=p.useRef(null),b=p.useRef(null),j=p.useRef(!1),N=p.useRef(o);N.current=o;const k=p.useRef(r),w=p.useRef(l),[E,C]=p.useState("loading"),[T,z]=p.useState(!1);return p.useEffect(()=>{if(!_.current)return;let te=!1,I=null;C("loading"),z(!1);const R=window.setTimeout(()=>{te||z(!0)},200);return(async()=>{var re;let $;try{$=await IM()}catch{window.clearTimeout(R),te||C("error");return}if(te||!_.current)return;window.clearTimeout(R);const{Terminal:Q,FitAddon:ee,WebLinksAddon:G}=$,B=new Q({fontFamily:OM()||"monospace",fontSize:13,lineHeight:1.2,cursorBlink:!0,cursorStyle:"bar",scrollback:5e3,theme:k.current}),F=new ee;B.loadAddon(F),B.loadAddon(new G),B.open(_.current),b.current=B,B.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=B.getSelection();return U?(A.preventDefault(),oi(U),!1):!A.shiftKey}return A.key==="v"||A.key==="V"?(A.preventDefault(),mg().then(U=>{U&&B.paste(U)}),!1):!0});const le=A=>{A.preventDefault();const V=B.getSelection();if(V){oi(V),B.clearSelection();return}mg().then(U=>{U&&B.paste(U)})};(re=B.element)==null||re.addEventListener("contextmenu",le);const ue=B.onData(A=>u(n,A));let ce={cols:B.cols,rows:B.rows},D=null;const O=B.onResize(({cols:A,rows:V})=>{D!==null&&window.clearTimeout(D),D=window.setTimeout(()=>{D=null,!(A===ce.cols&&V===ce.rows)&&(ce={cols:A,rows:V},f(n,A,V))},100)}),H=new ResizeObserver(()=>{try{F.fit()}catch{return}N.current&&B.scrollToBottom()});H.observe(_.current);const J=x(n,A=>{A.kind==="buffer"&&B.reset(),B.write(A.data)});g(n),w.current!==null&&!j.current&&(j.current=!0,B.write(`\r
|
|
166
|
+
\x1B[2m— Процесс завершён (код ${w.current}) —\x1B[0m\r
|
|
167
|
+
`)),i&&B.focus(),I=()=>{var A;D!==null&&window.clearTimeout(D),H.disconnect(),(A=B.element)==null||A.removeEventListener("contextmenu",le),ue.dispose(),O.dispose(),J(),B.dispose(),b.current=null},C("ready")})(),()=>{te=!0,window.clearTimeout(R),I==null||I(),I=null}},[n]),p.useEffect(()=>{if(!o)return;const q=_.current;if(!q)return;let te=null,I=0,R=!1;const $=B=>{B.pointerType==="mouse"||te!==null||(te=B.pointerId,I=B.clientY,R=!1)},Q=B=>{if(B.pointerId!==te)return;const F=I-B.clientY;if(!R){if(Math.abs(F)<4)return;R=!0,q.setPointerCapture(B.pointerId)}I=B.clientY;const le=q.querySelector(".xterm-viewport");le&&(le.scrollTop+=F)},ee=B=>{B.pointerId===te&&(q.hasPointerCapture(B.pointerId)&&q.releasePointerCapture(B.pointerId),te=null,R=!1)},G=B=>B.stopPropagation();return q.addEventListener("pointerdown",$),q.addEventListener("pointermove",Q),q.addEventListener("pointerup",ee),q.addEventListener("pointercancel",ee),q.addEventListener("touchmove",G,{capture:!0}),()=>{q.removeEventListener("pointerdown",$),q.removeEventListener("pointermove",Q),q.removeEventListener("pointerup",ee),q.removeEventListener("pointercancel",ee),q.removeEventListener("touchmove",G,{capture:!0}),te!==null&&q.hasPointerCapture(te)&&q.releasePointerCapture(te)}},[o]),p.useEffect(()=>{k.current=r,b.current&&(b.current.options.theme=r)},[r]),p.useEffect(()=>{var q;i&&((q=b.current)==null||q.focus())},[i]),p.useEffect(()=>{if(w.current=l,l===null){j.current=!1;return}if(j.current)return;const q=b.current;q&&(j.current=!0,q.write(`\r
|
|
168
|
+
\x1B[2m— Процесс завершён (код ${l}) —\x1B[0m\r
|
|
169
|
+
`))},[l]),s.jsxs("div",{className:"termview"+(i?" is-active":""),children:[s.jsx("div",{ref:_,className:"termview__surface"+(E==="ready"?"":" is-hidden")}),E==="loading"&&T&&s.jsxs("div",{className:"termview__state work",role:"status",children:[s.jsxs("div",{className:"work__dots",children:[s.jsx("span",{className:"work__dot"}),s.jsx("span",{className:"work__dot"}),s.jsx("span",{className:"work__dot"})]}),s.jsx("span",{className:"work__label",children:"Загружается терминал…"})]}),E==="error"&&s.jsxs("div",{className:"termview__state termview__state--error",role:"alert",children:[s.jsx("p",{children:"Не удалось загрузить терминал"}),s.jsx("p",{className:"termpanel__hint",children:"Соединение оборвалось раньше, чем приехал нужный модуль — на мобильном relay это обычное дело на слабой сети. Ниже — перезагрузка страницы, а не тихий повтор: открытые терминалы и их содержимое приедут обратно с хоста, а вот черновик в поле ввода внизу — нет."}),s.jsx("button",{className:"btn btn--primary",onClick:()=>window.location.reload(),children:"Перезагрузить страницу"})]})]})}const HM=2e5,qM=75,GM=90;function YM({tokens:n,maxTokens:l,fetchedAt:i}){if(n===null)return null;const r=l??HM,o=Math.min(100,Math.round(n/r*100)),u=`${n.toLocaleString()} из ${r.toLocaleString()} токенов${i?`
|
|
170
|
+
обновлено в ${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${VM(o)}`,style:{width:`${o}%`}})}),s.jsxs("span",{className:"contextbar__pct",children:[o,"%"]})]})}function VM(n){return n>=GM?" contextbar__fill--over":n>=qM?" contextbar__fill--warn":""}const Yd={fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"};function FM(){return s.jsx("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",...Yd,children:s.jsx("path",{d:"M10.5 3.5l2 2M3 13l.5-2.5 7-7 2 2-7 7L3 13z"})})}function XM(){return s.jsx("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",...Yd,children:s.jsx("path",{d:"M3 8h9M8.5 4L12.5 8l-4 4"})})}function KM(){return s.jsx("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",...Yd,children:s.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})}function QM(){return s.jsxs("svg",{viewBox:"0 0 16 16",width:"12",height:"12","aria-hidden":"true",...Yd,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 PM(){return s.jsx("svg",{viewBox:"0 0 16 16",width:"12",height:"12","aria-hidden":"true",...Yd,children:s.jsx("path",{d:"M4 2h5l3 3v9H4V2zM9 2v3h3"})})}function ZM({item:n,onUpdate:l,onSendNow:i,onRemove:r}){const[o,u]=p.useState(!1),[f,g]=p.useState(n.text),x=p.useRef(null);p.useEffect(()=>{if(!o)return;const k=x.current;k&&(k.focus(),k.setSelectionRange(k.value.length,k.value.length))},[o]);const _=()=>{g(n.text),u(!0)},b=()=>u(!1),j=()=>{const k=f.trim();k!==""&&k!==n.text&&l(k),u(!1)},N=n.files.length;return o?s.jsxs("li",{className:"pqueue__row is-editing",children:[s.jsx("textarea",{ref:x,className:"input pqueue__area",rows:2,value:f,"aria-label":"Текст промпта в очереди",onChange:k=>g(k.target.value),onKeyDown:k=>{k.key==="Escape"?(k.stopPropagation(),k.preventDefault(),b()):k.key==="Enter"&&!k.shiftKey&&!k.nativeEvent.isComposing&&(k.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} ${Bd(n.imageCount,"картинка","картинки","картинок")}`,children:[s.jsx(QM,{}),n.imageCount]}),N>0&&s.jsxs("span",{className:"pqueue__chip",title:`${N} ${Bd(N,"файл","файла","файлов")}`,children:[s.jsx(PM,{}),N]})]})]}),s.jsxs("div",{className:"pqueue__actions",children:[s.jsx("button",{type:"button",className:"iconbtn pqueue__btn",title:"Изменить","aria-label":"Изменить промпт в очереди",onClick:_,children:s.jsx(FM,{})}),s.jsx("button",{type:"button",className:"iconbtn pqueue__btn",title:"Отправить сейчас","aria-label":"Отправить сейчас",onClick:i,children:s.jsx(XM,{})}),s.jsx("button",{type:"button",className:"iconbtn iconbtn--danger pqueue__btn",title:"Убрать из очереди","aria-label":"Убрать из очереди",onClick:r,children:s.jsx(KM,{})})]})]})}function WM({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(f=>s.jsx(ZM,{item:f,onUpdate:g=>l(f.id,g),onSendNow:()=>r(f.id),onRemove:()=>i(f.id)},f.id))})]})}const qv="ccv:last-session",JM=300*1e3,e2=1e4;function t2(){try{const n=localStorage.getItem(qv);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 Yy(n){const l=new Set;return n.filter(i=>l.has(i.id)?!1:(l.add(i.id),!0))}function n2(n,l){const i=n.find(o=>o.id===l);if(i)return i;const r=n.filter(o=>aN(o.path).includes(l));return r.length===1?r[0]:void 0}function s2(n,l){return n.id===l.sessionId?!0:l.claudeSessionId?n.id===l.claudeSessionId||n.claudeSessionId===l.claudeSessionId:!1}const l2={mcp:"mcp",plugins:"plugins",plugin:"plugins"},Vy=[{name:"login",description:"Войти в аккаунт Claude — Настройки, раздел входа",argumentHint:"",aliases:["signin","вход"]},{name:"switch-account",description:"Сменить аккаунт: выйти и войти заново (Настройки)",argumentHint:"",aliases:["account","аккаунт"]},{name:"logout",description:"Выйти из аккаунта Claude (Настройки)",argumentHint:"",aliases:["signout","выход"]}],Fy=[{id:Yi,name:"Основной",color:"orange",configDir:null,dir:"",main:!0,liveSessions:0}],Gv="ccv.mcpAuthNoticeDismissed";function a2(){try{const n=JSON.parse(localStorage.getItem(Gv)??"[]");return Array.isArray(n)?n.filter(l=>typeof l=="string"):[]}catch{return[]}}function Xy(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(f=>f.name.toLowerCase().includes(u)).sort((f,g)=>Ky(f.name,u)-Ky(g.name,u))}}function Ky(n,l){return n.toLowerCase().startsWith(l)?0:1}function Qy(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 i2(){var Wu,kr,Ju;const n=p.useRef(null),[l,i]=p.useState(!1),[r,o]=p.useState("Нет связи с хостом"),[u,f]=p.useState(null),[g,x]=p.useState(null),_=(g==null?void 0:g.status)==="blocked",[b,j]=p.useState(!1),N=p.useMemo(()=>Ah()==="relay",[]),[k,w]=p.useState([]),[E,C]=p.useState([]),[T,z]=p.useState([]),[q,te]=p.useState([]),[I,R]=p.useState([]),[$,Q]=p.useState([]),[ee,G]=p.useState({}),[B,F]=p.useState([]),[le,ue]=p.useState([]),[ce,D]=p.useState({}),[O,H]=p.useState(null),[J,re]=p.useState(null),[A,V]=p.useState(null),[U,be]=p.useState(null),[P,ie]=p.useState(null),[Me,Ke]=p.useState(null),[Ne,Be]=p.useState($s),[Xe,Ze]=p.useState(Ep),[an,We]=p.useState(!1),[Bt,Ye]=p.useState(!1),ct=ru("(max-width: 860px)"),[xe,$e]=p.useState(!1),[ye,Qe]=p.useState(!1),[rn,kt]=p.useState(null),[ht,_s]=p.useState(null),[On,fn]=p.useState(null),[Mt,zt]=p.useState(null),[Ce,Te]=p.useState(!1),[Ie,st]=p.useState(!1),[_t,bt]=p.useState(null),yt=p.useRef(0),[zn,_e]=p.useState(null),Ae=p.useRef(0),[Je,rt]=p.useState(!1),[it,en]=p.useState(null),[dt,gt]=p.useState({}),[bs,In]=p.useState(null),[As,cs]=p.useState(null),[Cn,$n]=p.useState(null),[Ms,cn]=p.useState(null),[hn,ns]=p.useState(null),mn=p.useRef(null);p.useEffect(()=>{ct||$e(!1)},[ct]);const[Un,pn]=p.useState(!1),[Tt,gn]=p.useState([]),[os,us]=p.useState(!1),[Hs,xl]=p.useState($s),[_l,At]=p.useState(null),[Rs,Bn]=p.useState(null),[K,ge]=p.useState(null),[Re,He]=p.useState({}),[wt,on]=p.useState([]),[Dt,Hn]=p.useState(null),[Tn,Lt]=p.useState(null),[qs,xn]=p.useState([]),[bl,yl]=p.useState([]),[Qn,Xt]=p.useState([]),[Ta,ys]=p.useState([]),[Zl,vs]=p.useState(null),[ss,tl]=p.useState(null),[tn,Gs]=p.useState([]),[ui,Wl]=p.useState(a2),[ds,Jl]=p.useState(null),[ea,Ys]=p.useState({}),[fs,nl]=p.useState(null),[Pn,ta]=p.useState({}),[Rl,Zi]=p.useState(null),[na,xt]=p.useState({}),[sa,Nn]=p.useState([]),[Dl,js]=p.useState(!1),[qn,di]=p.useState(Fy),[sl,Vs]=p.useState({}),[ls,hs]=p.useState(null),[Se,y]=p.useState(null),[M,Z]=p.useState(null),[oe,Oe]=p.useState(()=>cN()??Yi),[Le,tt]=p.useState(null),vt=(Le==null?void 0:Le.enabledProviders)??["claude","antigravity","codex"],[Zn,_n]=p.useState(!1),[An,Aa]=p.useState({}),[Yt,Wi]=p.useState(null),[Fn,Zr]=p.useState(null),[fi,Vc]=p.useState(!1),[rm,,cm]=SN(),Ji=DN(),[la,Wr]=p.useState(!1),[Ns,Vd]=p.useState(null),[du,Jr]=p.useState(null),[om,Fc]=p.useState(null),[fu,ll]=p.useState(null),[er,Xc]=p.useState(null),[hu,Fd]=p.useState(""),[Xd,um]=p.useState(null),[dm,fm]=p.useState([]),[hm,Kc]=p.useState(!1),[mm,mu]=p.useState(null),[pm,Qc]=p.useState(!1),[ks,aa]=p.useState(!1),[hi,tr]=p.useState({}),[ec,tc]=p.useState([""]),[Ma,Ds]=p.useState([]),[mi,gm]=p.useState({}),[Kd,nr]=p.useState({}),pi=p.useRef(new Map),nc=p.useRef({}),Ra=m=>{nc.current=m(nc.current),gm(nc.current)},[ia,Da]=p.useState(null),sc=p.useRef(null);sc.current=ia;const[Qd,vl]=p.useState(null),[gi,sr]=p.useState(null),[lr,lc]=p.useState(null),[Pd,pu]=p.useState(null),[Pc,Zd]=p.useState({}),[Zc,Wd]=p.useState({}),[Xn,ra]=p.useState(!1),[Jd,Wc]=p.useState(null),[ac,Jc]=p.useState(null),eo=p.useRef(0),to=p.useRef(null),[jl,ar]=p.useState(!1),[La,xi]=p.useState([]),[ef,Ll]=p.useState(null),[ir,rr]=p.useState(null),ic=ON(),ca=UN(ct&&jl),cr=p.useRef(new Map),oa=(Le==null?void 0:Le.terminalEnabled)===!0,or=Ah()==="relay"&&((Wu=u==null?void 0:u.shell)==null?void 0:Wu.enabled)!==!0,gu=p.useRef(!1),xm=p.useCallback((m,L)=>(cr.current.set(m,L),()=>{cr.current.get(m)===L&&cr.current.delete(m)}),[]),[_i,rc]=p.useState(!1),[xu,ur]=p.useState(null),[al,bi]=p.useState($s),[Gn,ua]=p.useState(null),[yi,Ol]=p.useState({}),Oa=p.useRef([]),[un,da]=p.useState(null);function tf(m){da(L=>L===m?null:m)}p.useEffect(()=>{(ct||un==="terminal"&&!jl||un==="files"&&!ks||un==="search"&&!Xn||un==="git"&&!la||un==="ask"&&!_i||un==="main"&&Ma.length===0)&&da(null)},[un,ct,jl,ks,Xn,la,_i,Ma.length]);const[no]=p.useState(t2),za=p.useRef(no),so=p.useRef(!1),It=p.useRef(null),dr=p.useRef(new Map),Fs=p.useRef(null),fr=p.useRef(null),Xs=p.useRef(null),Ia=p.useRef(0),Kt=p.useRef(null),_u=p.useRef(0);It.current=P,Kt.current=U,_u.current=Ne.lastSeq;const lo=p.useRef(Xe);lo.current=Xe;const zl=p.useRef(null),Ks=p.useRef(0);Ks.current=al.lastSeq;const fa=p.useRef(null),ha=p.useRef(""),$a=p.useRef(null),ms=p.useRef([]),Ls=p.useRef([""]);ms.current=Ma,Ls.current=ec;const il=p.useRef(new Map),Qs=p.useRef(new Map),Os=p.useRef(new Set),zs=p.useRef(null),Ps=p.useRef(null),bu=p.useRef(0),Ua=p.useRef(new Set),ao=p.useRef(new Set);p.useEffect(()=>{const m=gN();if(!m)return;n.current=m;const L=()=>{i(m.connected),o(m.statusText)};m.onStatus(L),m.onReconnect(()=>{L(),ta({});const De=It.current;De&&m.send({type:"session.sync",sessionId:De,sinceSeq:_u.current});const mt=zl.current;mt&&m.send({type:"session.sync",sessionId:mt,sinceSeq:Ks.current})});const ne=m.on(De=>nf(De));m.connect();const ve=window.setInterval(()=>{L(),m.connected&&m.send({type:"ping",nonce:Date.now()})},15e3);return()=>{ne(),window.clearInterval(ve),m.close()}},[]);const nf=p.useCallback(m=>{var L,ne,ve,De,mt,St,is,ba,ql,el,ya,Gl,Pa,ps,Mi,Co;switch(m.type){case"hello.ok":i(!0);break;case"workspace.list":{w(Yy(m.workspaces)),C(Yy(m.archived)),be(qe=>{var Ft;if(qe)return qe;const Ve=za.current,et=Ve&&n2(m.workspaces,Ve.workspaceId);return Ve&&et&&et.id!==Ve.workspaceId&&(za.current={...Ve,workspaceId:et.id}),(et==null?void 0:et.id)??((Ft=m.workspaces[0])==null?void 0:Ft.id)??null});const me=$a.current;if(!me)break;const we=m.workspaces.find(qe=>f2(qe.path,me));if(!we)break;$a.current=null,pn(!1),we.id!==Kt.current&&kl(we.id),be(we.id);break}case"workspace.candidates":if(m.query.trim()!==ha.current)break;gn(m.candidates),m.source==="host"&&us(!1);break;case"finder.opened":fa.current=m.sessionId;break;case"workspace.roots":on(m.roots);break;case"workspace.created":if(m.workspace.id!==Kt.current&&kl(m.workspace.id),be(m.workspace.id),m.warnings.length===0){pn(!1),Bn(null);break}Hn({path:m.workspace.path,warnings:m.warnings});break;case"session.list":if(G(me=>({...me,[m.workspaceId]:{sessions:m.sessions??[],archived:m.archived??[]}})),m.workspaceId!==Kt.current)break;R(m.sessions),Q(m.archived);break;case"folder.list":z(m.sessionFolders),te(m.pinnedFolders??[]);break;case"session.pinned":F(m.sessions);break;case"session.live":ue(m.sessions);break;case"session.filesRewound":{const me=`${m.sessionId}:${m.userIndex}:${m.dryRun}`,we=dr.current.get(me);dr.current.delete(me),we==null||we(m);break}case"session.contentResults":cn({query:m.query,hits:m.hits});break;case"order.state":V(m.order);break;case"session.queue":D(me=>{if(m.queue.items.length===0){if(!(m.sessionId in me))return me;const{[m.sessionId]:we,...qe}=me;return qe}return{...me,[m.sessionId]:m.queue}});break;case"session.summary":if(m.session.id===fa.current){At(m.session);break}if(m.session.parentSessionId){m.session.id===zl.current&&ua(m.session);break}if(ue(me=>{const we=me.findIndex(Ve=>Ve.id===m.session.id);if(m.session.state==="closed")return we===-1?me:me.filter(Ve=>Ve.id!==m.session.id);if(we===-1)return[...me,m.session];const qe=me.slice();return qe[we]=m.session,qe}),R(me=>{const we=me.findIndex(Ve=>Ve.id===m.session.id);if(we===-1)return m.session.workspaceId!==Kt.current?me:[m.session,...me];const qe=me.slice();return qe[we]=m.session,qe}),G(me=>{const we=me[m.session.workspaceId];if(!we)return me;const qe=we.sessions.findIndex(et=>et.id===m.session.id);let Ve;if(qe!==-1)Ve=we.sessions.slice(),Ve[qe]=m.session;else{if(we.archived.some(et=>et.id===m.session.id))return me;Ve=[m.session,...we.sessions]}return{...me,[m.session.workspaceId]:{...we,sessions:Ve}}}),F(me=>{const we=me.findIndex(Ve=>Ve.id===m.session.id);if(we===-1)return me;const qe=me.slice();return qe[we]={...m.session,pinned:!0,...me[we].pinnedAt?{pinnedAt:me[we].pinnedAt}:{}},qe}),It.current===null&&fr.current&&fr.current.workspaceId===m.session.workspaceId&&(o0(m.session.id,fr.current.text),fr.current=null),Xs.current!==null&&Xs.current===m.session.workspaceId&&m.session.workspaceId===Kt.current&&(Xs.current=null,ie(me=>me??m.session.id)),((L=Fs.current)==null?void 0:L.sessionId)===m.session.id){const me=Fs.current;m.session.state==="error"?Fs.current=null:m.session.state!=="closed"&&(Fs.current=null,(ne=n.current)==null||ne.send({type:"prompt.send",sessionId:me.sessionId,text:me.text,images:me.images,attachments:me.attachments}))}break;case"usage.state":m.sessionId===It.current&&(Wi(m.usage),Vc(!1));break;case"context.state":m.sessionId===It.current&&(Zr(m.context),Vc(!1));break;case"session.capabilities":m.sessionId===It.current&&Ke(m.capabilities);break;case"session.events":if(m.sessionId===zl.current){bi(me=>Mh(me,m.entries));break}if(m.sessionId===fa.current){xl(me=>Mh(me,m.entries));break}if(m.sessionId!==It.current)break;for(const me of m.entries){if(me.event.kind!=="rewound")continue;const we=me.event.toUserIndex,qe=kN(lo.current.entries,we),Ve=qe.reduce((et,Ft)=>Ft.event.kind==="user.message"?et+1:et,0);Ze(et=>({...et,entries:qe})),Be(et=>({...et,items:wN(et.items,we,Ve)}))}Be(me=>Mh(me,m.entries));break;case"session.history":if(m.sessionId!==It.current)break;Ze(me=>vN(me,m));break;case"side.opened":{if(m.parentSessionId!==It.current)break;zl.current=m.sessionId,ur(m.sessionId);const me=Oa.current;Oa.current=[];for(const we of me)we(m.sessionId);break}case"side.closed":if(m.parentSessionId!==It.current)break;zl.current=null,ur(null),bi($s),ua(null);break;case"git.state":if(m.workspaceId!==Kt.current)break;Vd(m.state);break;case"git.commit":if(m.workspaceId!==Kt.current)break;Jr(m.detail);break;case"git.result":if(m.workspaceId!==Kt.current)break;ll({ok:m.ok,message:m.message,url:m.url}),m.ok&&(Jr(null),Fc(null),Kc(!1),Qc(!1));break;case"git.busy":if(m.workspaceId!==Kt.current)break;Fd(m.label);break;case"git.files":if(m.workspaceId!==Kt.current)break;mu({files:m.files,truncated:m.truncated});break;case"github.status":um(m.status);break;case"github.owners":fm(m.owners);break;case"fs.dir":if(m.workspaceId!==Kt.current)break;tr(me=>({...me,[m.path]:m.entries}));break;case"fs.search":if(m.workspaceId!==Kt.current)break;if(m.scope!=="tree"){const me=m.scope;Wd(we=>({...we,[me]:{query:m.query,entries:m.entries}}));break}pu({query:m.query,entries:m.entries,truncated:m.truncated});break;case"fs.grep":if(m.workspaceId!==Kt.current)break;Wc({query:m.query,matches:m.matches,truncated:m.truncated});break;case"fs.file":{if(m.workspaceId!==Kt.current)break;const me=Os.current.delete(m.file.path);Ds(qe=>{const Ve=qe.findIndex(Ri=>Ri.path===m.file.path);if(Ve===-1)return[...qe,Vb(m.file,++bu.current)];const et=qe[Ve],Ft=qe.slice();return Ft[Ve]=et.saved===m.file.content&&!ai(et)?{...et,mtime:m.file.mtime,size:m.file.size,stale:!1}:{...Vb(m.file,++bu.current),previewMode:et.previewMode,textMode:et.textMode},Ft}),me&&Da(m.file.path);const we=to.current;we&&we.path===m.file.path&&(to.current=null,Jc({...we,token:++eo.current}));break}case"fs.previewed":{if(m.workspaceId!==Kt.current)break;Ra(me=>{const we=me[m.path];return{...me,[m.path]:{forMtime:(we==null?void 0:we.forMtime)??m.mtime,loading:!1,html:m.html,missing:m.missing}}});break}case"fs.previewFailed":{if(m.workspaceId!==Kt.current)break;Ra(me=>{var we,qe;return{...me,[m.path]:{forMtime:((we=me[m.path])==null?void 0:we.forMtime)??0,loading:!1,html:(qe=me[m.path])==null?void 0:qe.html,missing:[],error:m.message}}});break}case"fs.media":{if(m.workspaceId!==Kt.current)break;Ua.current.delete(m.path),nr(me=>({...me,[m.path]:{mime:m.mime,base64:m.base64}})),Ds(me=>me.map(we=>we.path===m.path?{...we,mediaBase64:m.base64,mediaError:void 0}:we));break}case"fs.mediaFailed":{if(m.workspaceId!==Kt.current)break;Ua.current.delete(m.path),nr(me=>({...me,[m.path]:{error:m.message}})),Ds(me=>me.map(we=>we.path===m.path?{...we,mediaError:m.message}:we));break}case"fs.saved":{if(m.workspaceId!==Kt.current)break;if(((ve=mn.current)==null?void 0:ve.path)===m.path){const et=mn.current.path;mn.current=null,vl({ok:!0,message:`Разговор сохранён: ${et}`}),Os.current.add(et),(De=n.current)==null||De.send({type:"fs.read",workspaceId:m.workspaceId,path:et})}const me=pi.current.get(m.path);pi.current.delete(m.path),Ua.current.delete(m.path),nr(et=>{if(!me&&!(m.path in et))return et;const Ft={...et};return me?Ft[m.path]=me.entry:delete Ft[m.path],Ft});const we=Qs.current.get(m.path);Qs.current.delete(m.path);const qe=we!==void 0;Ds(et=>et.map(Ft=>Ft.path!==m.path?Ft:qe?{...Ft,saved:we,mtime:m.mtime,size:m.size,stale:!1}:{...Ft,stale:!0}));const Ve=ms.current.find(et=>et.path===m.path);!qe&&Ve&&!ai(Ve)&&((mt=n.current)==null||mt.send({type:"fs.read",workspaceId:m.workspaceId,path:m.path})),(St=n.current)==null||St.send({type:"git.state",workspaceId:m.workspaceId});break}case"fs.result":{if(m.workspaceId!==Kt.current)break;if(((is=mn.current)==null?void 0:is.path)===m.path&&!m.ok){const qe=mn.current;if(Qs.current.delete(m.path),m.conflict&&qe.attempt<50){const Ve=qe.attempt+1,et=fy(qe.base,Ve);mn.current={...qe,attempt:Ve,path:et},(ba=n.current)==null||ba.send({type:"fs.write",workspaceId:m.workspaceId,path:et,content:qe.content,eol:"lf",baseMtime:0})}else mn.current=null,vl({ok:!1,message:m.message});break}vl({ok:m.ok,message:m.message}),m.ok||Qs.current.delete(m.path);const me=pi.current.get(m.path);if(!m.ok&&me&&(pi.current.delete(m.path),nr(qe=>{if(!(m.path in qe))return qe;const Ve={...qe};return delete Ve[m.path],Ve}),me.onFail(m.message)),m.conflict&&Ds(qe=>qe.map(Ve=>Ve.path===m.path?{...Ve,stale:!0}:Ve)),Ps.current===m.path){const qe=Ps.current;Ps.current=null,m.ok&&(Os.current.add(qe),(ql=n.current)==null||ql.send({type:"fs.read",workspaceId:m.workspaceId,path:qe}))}const we=zs.current;if(m.ok&&we&&we.to===m.path){zs.current=null;const qe=Ve=>Ve===we.from?we.to:Ve.startsWith(`${we.from}/`)?we.to+Ve.slice(we.from.length):Ve;Ds(Ve=>Ve.map(et=>({...et,path:qe(et.path)}))),Da(Ve=>Ve===null?null:qe(Ve)),tc(Ve=>Ve.map(qe)),tr(Ve=>{const et={};for(const[Ft,Ri]of Object.entries(Ve))Ft===we.from||Ft.startsWith(`${we.from}/`)||(et[Ft]=Ri);return et})}m.ok&&((el=n.current)==null||el.send({type:"git.state",workspaceId:m.workspaceId}));break}case"term.list":if(m.workspaceId!==Kt.current)break;xi(m.terminals);break;case"term.opened":if(m.terminal.workspaceId!==Kt.current)break;rr(null),xi(me=>{const we=me.findIndex(Ve=>Ve.id===m.terminal.id);if(we===-1)return[...me,m.terminal];const qe=me.slice();return qe[we]=m.terminal,qe}),gu.current&&(gu.current=!1,Ll(m.terminal.id));break;case"term.buffer":(ya=cr.current.get(m.id))==null||ya({kind:"buffer",data:m.data});break;case"term.data":(Gl=cr.current.get(m.id))==null||Gl({kind:"data",data:m.data});break;case"term.exit":xi(me=>me.map(we=>we.id===m.id?{...we,exitCode:m.exitCode}:we));break;case"term.closed":xi(me=>me.filter(we=>we.id!==m.id));break;case"mcp.list":m.sessionId===It.current&&xn(m.servers);break;case"mcp.auth":m.sessionId===It.current&&tl(m.state);break;case"plugin.list":if(m.sessionId!==It.current)break;yl(m.plugins),Gs(m.duplicates),Xt(m.marketplaces),ys(m.catalog);break;case"operation.result":m.sessionId===It.current&&vs(m.result);break;case"auth.status":Vs(me=>({...me,[m.accountId]:m.status}));break;case"accounts.candidates":y(m.candidates);break;case"accounts.usage":He(me=>{const we={...me};for(const[qe,Ve]of Object.entries(m.usage))(Ve!==null||!(qe in we))&&(we[qe]=Ve);return we});break;case"accounts.state":di(m.accounts.length>0?m.accounts:Fy),hs(null),Vs(me=>{const we={};for(const qe of m.accounts)we[qe.id]=m.auth[qe.id]??me[qe.id]??null;return we});break;case"relay.state":f(m.state);break;case"memory.state":kt(m.files),_s(m.accountId);break;case"memory.file":fn({id:m.id,content:m.content,mtime:m.mtime});break;case"memory.result":zt({id:m.id,ok:m.ok,message:m.message,conflict:m.conflict,mtime:m.mtime});break;case"site.opened":bt({n:++yt.current,ok:!0,url:m.url,proxyUrl:m.proxyUrl});break;case"site.failed":bt({n:++yt.current,ok:!1,url:m.url,message:m.message});break;case"video.catalog":{const{type:me,...we}=m;en(we);break}case"video.studio":gt(me=>({...me,[`${m.state.workspaceId}
|
|
171
|
+
${m.state.root}`]:m.state}));break;case"schedule.state":In(m.tasks);break;case"network.state":x(m.state);break;case"settings.state":tt(m.settings);break;case"handoff.state":Ys(me=>{if(!m.handoff){if(!(m.sessionId in me))return me;const we={...me};return delete we[m.sessionId],we}return{...me,[m.sessionId]:m.handoff}});break;case"handoff.written":ta(me=>{if(!(m.sessionId in me))return me;const we={...me};return delete we[m.sessionId],we}),m.handoff&&It.current===m.sessionId?Zi(m.handoff):m.handoff||console.warn("[handoff] хост не смог записать хэндофф",m.sessionId);break;case"limit.stopped":Ia.current+=1,Nn(me=>[...me,{id:Ia.current,limit:m.limit,utilization:m.utilization,stopped:m.stopped,handoffs:m.handoffs}]);break;case"auth.login":Aa(me=>({...me,[m.accountId]:m.state})),m.state.active&&js(!0);break;case"session.closed":ue(me=>me.filter(we=>we.id!==m.sessionId)),R(me=>me.map(we=>we.id===m.sessionId?{...we,state:"closed"}:we)),G(me=>{let we=!1;const qe={};for(const[Ve,et]of Object.entries(me))et.sessions.some(Ft=>Ft.id===m.sessionId&&Ft.state!=="closed")?(we=!0,qe[Ve]={...et,sessions:et.sessions.map(Ft=>Ft.id===m.sessionId?{...Ft,state:"closed"}:Ft)}):qe[Ve]=et;return we?qe:me});break;case"error":console.error("[host]",m.message,m.context??""),(m.context==="workspace.open"||m.context==="workspace.create")&&($a.current=null,Bn(m.message)),(Pa=m.context)!=null&&Pa.startsWith("term.")&&rr(m.message),(ps=m.context)!=null&&ps.startsWith("folder.")&&ge(`${m.message} Ничего не изменилось.`),(Mi=m.context)!=null&&Mi.startsWith("accounts.")&&hs(m.message),(Co=m.context)!=null&&Co.startsWith("schedule.")&&cs(m.message);break}},[]),se=p.useCallback(m=>{var L;(L=n.current)==null||L.send(m)},[]),nn=p.useCallback((m,L,ne)=>{const ve=`${m}:${L}:${ne}`;return new Promise(De=>{const mt=setTimeout(()=>{dr.current.delete(ve),De({type:"session.filesRewound",sessionId:m,userIndex:L,dryRun:ne,canRewind:!1,error:"Хост не ответил."})},3e4);dr.current.set(ve,St=>{clearTimeout(mt),De(St)}),se({type:"session.rewindFiles",sessionId:m,userIndex:L,dryRun:ne})})},[se]);p.useEffect(()=>{U&&se({type:"session.list",workspaceId:U})},[U,se]),p.useEffect(()=>{l&&se({type:"session.pins"})},[l,se]),p.useEffect(()=>{l&&se({type:"settings.get"})},[l,se]),p.useEffect(()=>{if(l)return se({type:"session.drafts",sessionIds:u0()}),bN(m=>se({type:"session.drafts",sessionIds:m}))},[l,se]),p.useEffect(()=>{if(so.current)return;const m=za.current;if(!m||!U)return;if(U!==m.workspaceId){so.current=!0;return}if(P){so.current=!0;return}if(I.length===0)return;const L=I.find(ne=>s2(ne,m));so.current=!0,L&&L.state!=="closed"&&cl(L)},[I,U,P]),p.useEffect(()=>{!U||or||!oa||se({type:"term.list",workspaceId:U})},[U,or,oa,se]),p.useEffect(()=>{Ll(m=>{var L;return m&&La.some(ne=>ne.id===m)?m:((L=La[0])==null?void 0:L.id)??null})},[La]),p.useEffect(()=>{Un&&se({type:"workspace.roots"})},[Un,se]);const ft=p.useCallback(()=>{const m=It.current;m&&(Vc(!0),se({type:"usage.get",sessionId:m}),se({type:"context.get",sessionId:m}))},[se]);p.useEffect(()=>{if(!fi)return;const m=window.setTimeout(()=>Vc(!1),e2);return()=>window.clearTimeout(m)},[fi]);const Il=p.useMemo(()=>{const m=Math.max((Yt==null?void 0:Yt.fetchedAt)??0,(Fn==null?void 0:Fn.fetchedAt)??0);return m>0?m:null},[Yt==null?void 0:Yt.fetchedAt,Fn==null?void 0:Fn.fetchedAt]);p.useEffect(()=>{if(Zr(null),!P)return;ft();const m=()=>{document.hidden||ft()},L=window.setInterval(m,JM),ne=()=>{document.hidden||ft()};return document.addEventListener("visibilitychange",ne),()=>{window.clearInterval(L),document.removeEventListener("visibilitychange",ne)}},[P,ft]),p.useEffect(()=>{if(!P){Ze(Ep);return}Ze({...Ep,loading:!0}),se({type:"session.history",sessionId:P})},[P,se]);const rl=p.useCallback(()=>{!P||Xe.loading||!Cp(Xe)||(Ze(m=>({...m,loading:!0})),se({type:"session.history",sessionId:P,before:h0(Xe)}))},[P,Xe,se]),hr=p.useMemo(()=>jN(Xe.entries),[Xe.entries]),Ba=p.useMemo(()=>Je?gA([...hr,...Ne.items]):[],[Je,hr,Ne.items]),sf=p.useMemo(()=>{const m={};for(const L of Object.values(dt))L.workspaceId===U&&(m[L.root]=L);return m},[dt,U]);function yu(m){return P?(_e({token:++Ae.current,text:m}),Da(null),!0):!1}const X=p.useMemo(()=>I.find(m=>m.id===P)??null,[I,P]),ma=X!==null&&X.state!=="closed"&&es(X.provider)&&X.parentSessionId===null;p.useEffect(()=>{xn([]),tl(null),P&&ma&&se({type:"mcp.list",sessionId:P})},[P,ma,se]);const Nl=P?(X==null?void 0:X.claudeSessionId)??P:null,ws=Nl?ea[Nl]??null:null;p.useEffect(()=>{Nl&&se({type:"handoff.get",sessionId:Nl})},[Nl,se]),p.useEffect(()=>{fs&&!(fs.sessionId in ea)&&nl(null)},[ea,fs]);const io=p.useMemo(()=>{var ne;if(!Yt)return null;const m=(((ne=Yt.buckets)==null?void 0:ne.length)??0)>0,L=!es(X==null?void 0:X.provider);return m===L?Yt:null},[Yt,X==null?void 0:X.provider]),$l=qn.length>1;function Ul(m){return qn.some(L=>L.id===m)?m:Yi}const Ha=p.useMemo(()=>({accounts:qn,auth:sl,multi:qn.length>1}),[qn,sl]),Kn=$l&&X&&es(X.provider)?qn.find(m=>m.id===X.accountId)??null:null,vu=p.useMemo(()=>{const m={};for(const L of I)es(L.provider)&&(L.state!=="running"&&L.state!=="waiting_permission"||(m[L.accountId]=(m[L.accountId]??0)+1));return m},[I]),ro="Обновить лимиты и контекст",mr=ro+(Il?`
|
|
172
|
+
обновлено в ${new Date(Il).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}`:"");p.useEffect(()=>{document.documentElement.dataset.provider=(X==null?void 0:X.provider)??"claude"},[X==null?void 0:X.provider]),p.useEffect(()=>{es(X==null?void 0:X.provider)||rc(!1)},[X==null?void 0:X.provider]);const dn=k.find(m=>m.id===U)??E.find(m=>m.id===U)??null;p.useEffect(()=>{if(!U||!P)return;const m={workspaceId:U,sessionId:P,claudeSessionId:(X==null?void 0:X.claudeSessionId)??null};try{localStorage.setItem(qv,JSON.stringify(m))}catch{}},[U,P,X==null?void 0:X.claudeSessionId]);function vi(m){$a.current=m,Bn(null),se({type:"workspace.open",path:m})}function as(m,L,ne){Bn(null),se({type:"workspace.create",parent:m,name:L,init:ne})}function co(m){if(ha.current=m,!m){gn([]),us(!1);return}us(!0),se({type:"workspace.find",query:m})}function lf(m){ha.current=m,xl($s),se({type:"workspace.find.agent",query:m})}function _m(){pn(!1),Bn(null),Hn(null),gn([]),xl($s),At(null),ha.current="",$a.current=null}function ji(){const m=It.current;m&&zl.current&&se({type:"side.reset",sessionId:m}),zl.current=null,ur(null),bi($s),ua(null),Ol({}),Oa.current=[]}function bm(m){se({type:"workspace.close",workspaceIds:m}),oo(m)}function Yn(m){se({type:"workspace.unmark",workspaceIds:m}),oo(m)}function oo(m){!U||!m.includes(U)||(ji(),be(null),ie(null),R([]),Q([]),Be($s),Ke(null),Ye(!1))}function cc(m,L){se({type:"session.archive",workspaceId:m,sessionIds:L}),P&&(L.includes(P)||X!=null&&X.claudeSessionId&&L.includes(X.claudeSessionId))&&(ji(),ie(null),Be($s),Ke(null),Ye(!1))}function oc(m){se({type:"workspace.restore",workspaceIds:m})}function ju(m,L,ne){ge(null),se({type:"folder.create",scope:m,name:L,workspaceId:ne})}function pr(m,L){ge(null),se({type:"folder.rename",folderId:m,name:L})}function gr(m,L){ge(null),se({type:"folder.setColor",folderId:m,color:L})}function ym(m,L,ne,ve){ge(null),se({type:"folder.assign",scope:m,itemId:L,folderId:ne,workspaceId:ve})}function af(m=vt[0]??"claude",L){if(!U)return;let ne;m==="claude"&&$l&&(ne=L??Ul(oe),Oe(ne),oN(ne)),ji(),ie(null),Ke(null),Be($s),Ye(!1),Xs.current=U,se({type:"session.start",workspaceId:U,provider:m,...ne?{accountId:ne}:{}}),We(!1)}function uc(m){Xs.current=null,ji(),kl(m),be(m),ie(null),Be($s),Ke(null),Ye(!1),Vd(null),Jr(null),Fc(null),ll(null),Fd(""),Kc(!1),mu(null),Qc(!1),xi([]),Ll(null)}function rf(m,L,ne){se({type:"session.pin",workspaceId:m,sessionIds:L,pinned:ne})}function Ni(m){return m.state==="running"||m.state==="waiting_permission"||m.state==="reconnecting"||m.backgroundWork}function dc(m){if(Ni(m)){H(m);return}se({type:"session.close",sessionId:m.id})}function uo(m,L,ne){V(ve=>{const De=ve??{workspaces:[],sessions:{},pinned:[],live:[]};if(m==="sessions"){if(!ne)return ve;const mt={...De.sessions};return L&&L.length>0?mt[ne]=L:delete mt[ne],{...De,sessions:mt}}return{...De,[m]:L??[]}}),se({type:"order.set",scope:m,ids:L,...ne?{workspaceId:ne}:{}})}function cf(m){m.workspaceId!==U&&uc(m.workspaceId),cl(m)}function cl(m){if(We(!1),ji(),Be($s),Ke(null),Ye(!1),m.state==="closed"){ie(null),Xs.current=m.workspaceId,se({type:"session.start",workspaceId:m.workspaceId,resume:m.claudeSessionId??m.id});return}Xs.current=null,ie(m.id),se({type:"session.sync",sessionId:m.id,sinceSeq:0})}function Nu(m){se({type:"session.searchContent",query:m})}function fo(m){const L=I.find(ne=>ne.id===m.sessionId||ne.claudeSessionId===m.sessionId);if(L&&L.workspaceId===m.workspaceId&&m.workspaceId===U){cl(L);return}if(m.workspaceId!==U){ns(m.sessionId),uc(m.workspaceId);return}We(!1),ji(),Be($s),Ke(null),Ye(!1),ie(null),Xs.current=m.workspaceId,se({type:"session.start",workspaceId:m.workspaceId,resume:m.sessionId})}p.useEffect(()=>{if(!hn||!U)return;const m=I.find(ve=>ve.workspaceId===U&&(ve.id===hn||ve.claudeSessionId===hn));if(m){ns(null),cl(m);return}const L=hn,ne=setTimeout(()=>{ns(ve=>ve===L?null:ve),Xs.current=U,ie(null),se({type:"session.start",workspaceId:U,resume:L})},1200);return()=>clearTimeout(ne)},[I,hn,U]);function fc(){return hE([...hr,...Ne.items],{title:(X==null?void 0:X.title)??null,project:(dn==null?void 0:dn.name)??null,agent:lb(X==null?void 0:X.provider),partial:Cp(Xe)})}function ku(){pE(`${dy((X==null?void 0:X.title)??null)}.md`,fc())}function wu(){if(!U)return;const m=dy((X==null?void 0:X.title)??null),L=fc(),ne=fy(m,1);mn.current={base:m,attempt:1,path:ne,content:L},se({type:"fs.write",workspaceId:U,path:ne,content:L,eol:"lf",baseMtime:0})}function ki(m){if(!m.lastSessionId)return;Te(!1);const L=I.find(ne=>ne.id===m.lastSessionId);if(L&&L.workspaceId===U){cl(L);return}$n(m.lastSessionId),m.workspaceId!==U?uc(m.workspaceId):se({type:"session.list",workspaceId:m.workspaceId})}p.useEffect(()=>{if(!Cn)return;const m=I.find(L=>L.id===Cn);m&&($n(null),cl(m))},[I,Cn]);function wi(m,L,ne){if(!P||_)return!1;const ve=P,De=X;return mc(()=>{if((De==null?void 0:De.state)==="closed"){Fs.current={sessionId:De.claudeSessionId??De.id,text:m,images:L,attachments:ne},cl(De);return}const mt=(De==null?void 0:De.state)==="running"||(De==null?void 0:De.state)==="waiting_permission"||(De==null?void 0:De.state)==="reconnecting",St=ce[ve];if(mt||St&&St.items.length>0&&!St.paused){se({type:"queue.add",sessionId:ve,text:m,images:L,attachments:ne});return}se({type:"prompt.send",sessionId:ve,text:m,images:L,attachments:ne})})}const ho=ss!==null&&ss.active&&ss.accountId===(X==null?void 0:X.accountId);function Su(){if(!ho||!ss)return Promise.resolve(!0);const m=ss.name;return new Promise(L=>{Jl(ne=>(ne==null||ne.resolve(!1),{name:m,resolve:L}))})}function qa(m){ds&&(ds.resolve(m),Jl(null))}function hc(m){Wl(L=>{const ne=[...new Set([...L,...m])];try{localStorage.setItem(Gv,JSON.stringify(ne))}catch{}return ne})}function mc(m){const L=es(X==null?void 0:X.provider)?TM(Yt,Le):null;return L?new Promise(ne=>{re(ve=>(ve==null||ve.resolve(!1),{warning:L,resolve:ne}))}).then(ne=>(ne&&m(),ne)):(m(),!0)}function Si(m){J&&(J.resolve(m),re(null))}function pc(m){const L=le.find(De=>(De.claudeSessionId??De.id)===m.sessionId&&De.state!=="closed"),ne=mo(m.sessionId,m.workspaceId,m.limit!==null),ve=ne!=null&&ne.canChoose?ne.selectedId:(ne==null?void 0:ne.sourceId)??(L==null?void 0:L.accountId);Eu(m.workspaceId,m.sessionId,m.text,ve),L&&se({type:"session.close",sessionId:L.id})}function mo(m,L,ne){var ya,Gl,Pa;if(!$l)return null;const ve=ps=>ps.id===m||ps.claudeSessionId===m,De=le.find(ve)??I.find(ve)??((ya=ee[L])==null?void 0:ya.sessions.find(ve));if(De&&!es(De.provider))return null;const mt=De==null?void 0:De.accountId,St=qn.filter(ps=>{var Mi;return((Mi=sl[ps.id])==null?void 0:Mi.loggedIn)!==!1}),is=ps=>ps&&St.some(Mi=>Mi.id===ps)?ps:void 0,ba=is(na[m]),ql=mt?(Gl=St.find(ps=>ps.id!==mt))==null?void 0:Gl.id:void 0,el=ba??(ne?ql:void 0)??is(mt)??is(Yi)??((Pa=St[0])==null?void 0:Pa.id)??Yi;return{source:qn.find(ps=>ps.id===mt)??null,sourceId:mt,targets:St,selectedId:el,canChoose:St.length>1}}function Ga(m){Eu(m.workspaceId,m.claudeSessionId??m.id,null,m.accountId)}function Eu(m,L,ne,ve){fr.current=ne===null?null:{workspaceId:m,text:ne},m!==U?uc(m):(ji(),ie(null),Ke(null),Be($s),Ye(!1)),Xs.current=m,se({type:"session.start",workspaceId:m,provider:"claude",...$l&&ve?{accountId:ve}:{},continuesFrom:L,...ne===null?{}:{fromHandoff:!0}}),We(!1)}p.useEffect(()=>{Rl&&(Zi(null),pc(Rl))},[Rl]);function pa(m){Pn[m.id]||(ta(L=>({...L,[m.id]:!0})),se({type:"session.handoff",sessionId:m.id}))}function Cu(m){se({type:"handoff.dismiss",sessionId:m})}function po(m,L){se({type:"session.rename",sessionId:m.id,title:L,workspaceId:m.workspaceId}),R(ne=>ne.map(ve=>ve.id===m.id?{...ve,title:L}:ve)),G(ne=>{const ve=ne[m.workspaceId];return ve?{...ne,[m.workspaceId]:{...ve,sessions:ve.sessions.map(De=>De.id===m.id?{...De,title:L}:De)}}:ne})}function Bl(m){P&&(We(!1),vs(null),tl(null),Lt(m),se({type:"mcp.list",sessionId:P}),se({type:"plugin.list",sessionId:P}))}const ga={mcpAction:(m,L)=>{P&&(vs(null),se({type:"mcp.action",sessionId:P,name:m,action:L}))},mcpAuth:(m,L)=>{if(!P)return;const ne=L??(X==null?void 0:X.accountId)??Yi;vs(null),tl({name:m,accountId:ne,stage:"starting",active:!0,url:"",callbackExpected:!1,done:!1,error:null,diagnostic:null,otherAccounts:[]}),se({type:"mcp.auth",sessionId:P,name:m,...L&&L!==(X==null?void 0:X.accountId)?{accountId:L}:{}})},mcpAuthCallback:(m,L)=>{P&&se({type:"mcp.auth_callback",sessionId:P,name:m,callbackUrl:L})},mcpAdd:(m,L)=>{P&&se({type:"mcp.add",sessionId:P,name:m,draft:L})},mcpRemove:m=>{P&&se({type:"mcp.remove",sessionId:P,name:m})},pluginInstall:m=>{P&&se({type:"plugin.install",sessionId:P,spec:m})},pluginDedupe:m=>{P&&(vs(null),se({type:"plugin.dedupe",sessionId:P,id:m}))},pluginUninstall:m=>{P&&se({type:"plugin.uninstall",sessionId:P,id:m})},pluginToggle:(m,L)=>{P&&se({type:"plugin.toggle",sessionId:P,id:m,enabled:L})},marketplaceAdd:m=>{P&&se({type:"marketplace.add",sessionId:P,source:m})},marketplaceRemove:m=>{P&&se({type:"marketplace.remove",sessionId:P,name:m})}};function xr(){We(!1),js(!0),hs(null);for(const m of qn)se({type:"auth.status",accountId:m.id})}const gc={login:(m,L,ne)=>se({type:"auth.login",mode:L,switchAccount:ne,accountId:m}),submitCode:(m,L)=>se({type:"auth.code",code:L,accountId:m}),cancel:m=>se({type:"auth.cancel",accountId:m}),logout:m=>se({type:"auth.logout",accountId:m})},Tu={discover:()=>se({type:"accounts.discover"}),requestUsage:()=>se({type:"accounts.usage"}),add:(m,L,ne,ve)=>{hs(null),se({type:"accounts.add",name:m,color:L,...ne?{configDir:ne}:{},...ve?{shareConfig:!0}:{}})},update:(m,L)=>{hs(null),se({type:"accounts.update",accountId:m,...L})},remove:m=>{hs(null),se({type:"accounts.remove",accountId:m})},makeMain:m=>{hs(null),se({type:"accounts.makeMain",accountId:m})}};function Ei(m){js(!1),We(!1),Z(m),_n(!0),se({type:"settings.get"});for(const L of qn)se({type:"auth.status",accountId:L.id})}function xc(){We(!1),Z(null),_n(!0),se({type:"settings.get"});for(const m of qn)se({type:"auth.status",accountId:m.id})}function of(m){tt(L=>L&&{...L,...m}),se({type:"settings.update",settings:m})}function uf(m,L,ne){!P||_||se({type:"side.ask",sessionId:P,text:m,images:L,attachments:ne})}function _r(){P&&(se({type:"side.reset",sessionId:P}),zl.current=null,ur(null),bi($s),ua(null),Ol({}),Oa.current=[])}function Ya(m){const L=zl.current;if(L){m(L);return}const ne=It.current;ne&&(Oa.current.push(m),se({type:"side.open",sessionId:ne}))}function Au(){U&&se({type:"git.state",workspaceId:U})}function Mu(m){U&&(Fc(m),se({type:"git.show",workspaceId:U,ref:m}))}function go(m,L){ll(null),Xc({target:m,label:L})}function Zs(){!U||!er||(se({type:"git.checkout",workspaceId:U,target:er.target}),Xc(null))}function ol(){U&&(ll(null),se({type:"git.push",workspaceId:U}))}function Va(m){U&&(ll(null),se({type:"git.pull",workspaceId:U,merge:m}))}function Ru(){U&&(ll(null),mu(null),Kc(!0),se({type:"github.status"}),se({type:"github.owners"}),se({type:"git.files",workspaceId:U}))}function df(m){U&&(ll(null),se({type:"git.publish",workspaceId:U,...m}))}function Fa(m){U&&(ll(null),se({type:"git.remote",workspaceId:U,url:m}))}function Ws(){ll(null),Qc(!0)}function Mn(m){se({type:"github.token",token:m}),se({type:"github.owners"})}function xo(){se({type:"github.status"}),se({type:"github.owners"})}p.useEffect(()=>{if(!(!ks||!U))for(const m of ec)m in hi||se({type:"fs.list",workspaceId:U,path:m})},[ks,ec,hi,U,se]);function xa(m){tc(L=>L.includes(m)?L.filter(ne=>ne!==m):[...L,m])}function ot(m){if(!m){pu(null);return}U&&se({type:"fs.search",workspaceId:U,query:m})}function Vt(m){if(!m){Wc(null);return}U&&se({type:"fs.grep",workspaceId:U,query:m})}const Rn=p.useCallback((m,L)=>{Zd(De=>({...De,[m]:L}));const ne=Kt.current;if(L===null||!ne)return;const ve=L.lastIndexOf("/");if(ve!==-1){se({type:"fs.list",workspaceId:ne,path:L.slice(0,ve)});return}if(L===""){se({type:"fs.list",workspaceId:ne,path:""});return}se({type:"fs.search",workspaceId:ne,query:L,scope:m})},[se]),_o=p.useMemo(()=>Xy(Pc.mention??null,Zc.mention??null,hi),[Pc.mention,Zc.mention,hi]),br=p.useMemo(()=>Xy(Pc.side??null,Zc.side??null,hi),[Pc.side,Zc.side,hi]);function Ci(m){Xa(m.path,{line:m.line,column:m.column})}function bo(m){const L=[];let ne=Kr(m.path);for(;L.push(ne),!!ne;)ne=Kr(ne);tc(ve=>{const De=new Set(ve);for(const mt of L)De.add(mt);return m.kind==="dir"&&De.add(m.path),[...De]}),m.kind==="file"&&Xa(m.path)}function Xa(m,L){if(ms.current.find(ve=>ve.path===m)){Da(m),L&&Jc({path:m,...L,token:++eo.current});return}U&&(L&&(to.current={path:m,...L}),Os.current.add(m),se({type:"fs.read",workspaceId:U,path:m}))}function Ka(m,L=!1){const ne=ms.current,ve=ne.find(St=>St.path===m);if(ve&&ai(ve)&&!L){lc(m);return}lc(null);const De=ne.findIndex(St=>St.path===m),mt=ne.filter(St=>St.path!==m);Ds(mt),Da(St=>{var is;return St===m?((is=mt[Math.min(De,mt.length-1)])==null?void 0:is.path)??null:St})}function yo(m,L=!1){const ne=ms.current.find(ve=>ve.path===m);!ne||!U||!L&&!ai(ne)||(Qs.current.set(m,ne.text),se({type:"fs.write",workspaceId:U,path:m,content:ne.text,eol:ne.eol,encoding:ne.encoding,baseMtime:ne.mtime,...L?{force:!0}:{}}))}function kn(m,L=!1){if(!U)return;const ne=ms.current.find(mt=>mt.path===m);if(!ne)return;const ve=nc.current[m];if(!L&&ve&&ve.forMtime===ne.mtime)return;const De={forMtime:ne.mtime,loading:!0,html:ve==null?void 0:ve.html,missing:[]};Ra(mt=>({...mt,[m]:De})),se({type:"fs.preview",workspaceId:U,path:m})}function vo(m){const L=De=>De.replaceAll("\\","/"),ne=L(m),ve=yr?L(yr).replace(/\/+$/,""):"";return ve&&ne.toLowerCase().startsWith(ve.toLowerCase()+"/")?ne.slice(ve.length+1):ne.replace(/^\.\//,"")}function Du(m){const L=vo(m),ne=ms.current.find(ve=>ve.path===L);ne&&!ne.previewMode&&Ds(ve=>ve.map(De=>De.path===L?{...De,previewMode:!0,textMode:!1}:De)),Xa(L)}const Lu=p.useRef(new Set);p.useEffect(()=>{var m;if(U)for(const L of Ne.items){if(L.kind!=="tool"||L.result===null||L.isError||!["Write","Edit","MultiEdit"].includes(L.name)||Lu.current.has(L.toolUseId))continue;Lu.current.add(L.toolUseId);const ne=(m=L.input)==null?void 0:m.file_path;if(typeof ne!="string"||!tm(ne))continue;const ve=vo(ne),De=ms.current.find(mt=>mt.path===ve);De&&!ai(De)&&Ou(ve)}},[Ne.items,U]);function Ou(m){U&&se({type:"fs.read",workspaceId:U,path:m})}function zu(m){U&&(Ua.current.has(m)||(Ua.current.add(m),se({type:"fs.readMedia",workspaceId:U,path:m})))}function Iu(m){zu(m)}function $u(m,L,ne){const ve=U;if(!ve)return null;const De=Kr(m),mt=`${nw(m)}-${tw()}`,St=ew(L.type);let is=`${mt}.${St}`;for(let el=2;ao.current.has(`${De}/${is}`);el+=1)is=`${mt}-${el}.${St}`;const ba=De?`${De}/assets/${is}`:`assets/${is}`;ao.current.add(`${De}/${is}`);const ql=new FileReader;return ql.onload=()=>{const el=String(ql.result),ya=el.slice(el.indexOf(",")+1),Gl={mime:L.type,base64:ya};pi.current.set(ba,{entry:Gl,onFail:ne}),nr(Pa=>({...Pa,[ba]:Gl})),se({type:"fs.writeBinary",workspaceId:ve,path:ba,base64:ya})},ql.onerror=()=>ne("Не удалось прочитать картинку из буфера обмена."),ql.readAsDataURL(L),``}const _c=p.useRef(new Map);function Ss(m){const L=_c.current,ne=L.get(m);ne&&clearTimeout(ne);const ve=(Le==null?void 0:Le.autoSaveAfterPauseMs)??0;ve<=0||L.set(m,setTimeout(()=>{L.delete(m);const De=ms.current.find(mt=>mt.path===m);De&&ai(De)&&!De.stale&&yo(m)},ve))}function Dn(m,L,ne){if(!U)return;const ve=m?`${m}/${ne}`:ne;vl(null),L==="file"&&(Ps.current=ve),se({type:"fs.create",workspaceId:U,path:ve,kind:L})}function jo(m,L){if(!U)return;const ne=Kr(m),ve=ne?`${ne}/${L}`:L;vl(null),zs.current={from:m,to:ve},se({type:"fs.rename",workspaceId:U,path:m,to:ve})}function bc(m,L){if(!U)return;const ne=m.slice(m.lastIndexOf("/")+1),ve=L?`${L}/${ne}`:ne;ve!==m&&(vl(null),zs.current={from:m,to:ve},se({type:"fs.rename",workspaceId:U,path:m,to:ve}))}function No(m,L){U&&(vl(null),se({type:"fs.copy",workspaceId:U,path:m,toDir:L}))}function Uu(m){U&&(vl(null),sr(null),se({type:"fs.delete",workspaceId:U,path:m.path}),Ds(L=>L.filter(ne=>ne.path!==m.path&&!ne.path.startsWith(`${m.path}/`))),Da(L=>L&&(L===m.path||L.startsWith(`${m.path}/`))?null:L))}function kl(m){const L=Kt.current,ne=il.current;L&&L!==m&&(ms.current.length>0?ne.set(L,{files:ms.current,active:sc.current,expanded:Ls.current}):ne.delete(L));for(const De of _c.current.values())clearTimeout(De);_c.current.clear();const ve=m?ne.get(m):void 0;m&&ne.delete(m),tr({}),tc((ve==null?void 0:ve.expanded)??[""]),Ds((ve==null?void 0:ve.files)??[]),Ra(()=>({})),Da((ve==null?void 0:ve.active)??null),vl(null),pu(null),Wc(null),Zd({}),Wd({}),Jc(null),Os.current.clear(),Qs.current.clear(),Ua.current.clear(),pi.current.clear(),nr({}),to.current=null,zs.current=null,Ps.current=null}function yc(m){!U||or||!oa||(rr(null),gu.current=!0,se({type:"term.open",workspaceId:U,cols:80,rows:24,...m?{input:m}:{}}))}function Bu(m){yc(m),ar(!0),rt(!1)}function Hu(m){se({type:"term.close",id:m})}function ff(m,L){P&&se({type:"permission.respond",sessionId:P,requestId:m,decision:L})}function hf(m,L){P&&se({type:"permission.respond",sessionId:P,requestId:m,decision:"allow",answers:L})}function mf(m){P&&se({type:"permission.respond",sessionId:P,requestId:m,decision:"deny",reason:"Пользователь не стал отвечать на вопросы"})}function pf(m,L){P&&se({type:"permission.respond",sessionId:P,requestId:m,decision:"allow",plan:L})}function gf(m){P&&se({type:"permission.respond",sessionId:P,requestId:m,decision:"deny",reason:"Пользователь просит продолжить планирование"})}p.useEffect(()=>{function m(L){if(L.key!=="Escape")return;if(un!==null){const ve=L.target;if(!(ve instanceof HTMLElement&&ve.closest(".termview, .editor, .sidepane"))){da(null);return}}if(!P||Ne.pending.length>0)return;const ne=L.target;ne instanceof HTMLElement&&ne.closest(".sidepane, .editor")||se({type:"control.interrupt",sessionId:P})}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[P,Ne.pending.length,se,un]),p.useEffect(()=>{function m(L){L.key!=="`"||!(L.ctrlKey||L.metaKey)||oa&&(L.preventDefault(),ar(ne=>!ne))}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[oa]);const qu=p.useMemo(()=>{const m=(Me==null?void 0:Me.commands)??[];return m.length===0||!es(X==null?void 0:X.provider)?m:[...m,{name:"plugins",description:"Плагины и маркетплейсы — окно приложения",argumentHint:"",aliases:["plugin"]},...Vy]},[Me,X==null?void 0:X.provider]);function ko(m){const L=l2[m];if(L&&es(X==null?void 0:X.provider))return Bl(L),!0;if(!es(X==null?void 0:X.provider)||!Vy.some(ve=>ve.name===m))return!1;const ne=(X==null?void 0:X.accountId)??Yi;return Ei(ne),m==="logout"&&gc.logout(ne),m==="switch-account"&&gc.login(ne,"claudeai",!0),!0}const vc=(X==null?void 0:X.state)==="waiting_permission",wl=(X==null?void 0:X.state)==="reconnecting",Js=(X==null?void 0:X.state)==="running"||wl||vc,sn=Ne.pending[0]??null,wo=sn?FC(sn.toolName,sn.input):null,[Gu,xf]=p.useState(()=>new Set),jc=sn?Gu.has(sn.requestId):!1,Yu=sn?sn.questions&&sn.questions.length>0?"question":wo!==null?"plan":"permission":null;function Nc(m,L){xf(ne=>{if(ne.has(m)===L)return ne;const ve=new Set(ne);return L?ve.add(m):ve.delete(m),ve})}p.useEffect(()=>{!la&&!ks||!U||Js||se({type:"git.state",workspaceId:U})},[la,ks,U,Js,se]),p.useEffect(()=>{if(!(Js||!U)){ks&&tr(m=>{const L={};for(const[ne,ve]of Object.entries(m))Ls.current.includes(ne)||(L[ne]=ve);return L});for(const m of ms.current)ai(m)||se({type:"fs.read",workspaceId:U,path:m.path})}},[Js,U,ks,se]);const yr=(X==null?void 0:X.cwd)??(Me==null?void 0:Me.cwd)??null,_f=(Me==null?void 0:Me.models)??[],kc=(X==null?void 0:X.model)??(Me==null?void 0:Me.model)??null,{rows:Ti,selected:bf}=Qy(_f,kc),Qa=Gn?{model:Gn.model,effort:Gn.effort,ultracode:Gn.ultracode,thinking:Gn.thinking,switchOnFlag:Gn.switchModelsOnFlag}:{model:yi.model??kc,effort:yi.effort??(X==null?void 0:X.effort)??null,ultracode:yi.ultracode??(X==null?void 0:X.ultracode)??!1,thinking:yi.thinking??(X==null?void 0:X.thinking)??!0,switchOnFlag:yi.switchOnFlag??(X==null?void 0:X.switchModelsOnFlag)??!0},wc=Qy(_f,Qa.model),yf=(Gn==null?void 0:Gn.state)==="running",vr=ia?Ma.find(m=>m.path===ia)??null:null,vm=new Set(Ma.filter(ai).map(m=>m.path)),jr=m=>s.jsx(RM,{pane:m,width:Ji.widths[m],onResize:L=>Ji.setWidth(m,L),onReset:()=>Ji.reset(m)}),Ai=m=>ct?null:()=>tf(m),vf=(X==null?void 0:X.provider)==="antigravity"?CN:(X==null?void 0:X.provider)==="codex"?TN:Og,Vu=Me&&s.jsx(Ml,{title:"Режим прав",value:(X==null?void 0:X.permissionMode)??"default",options:vf.map(m=>({value:m.value,label:m.value,hint:m.hint})),onChange:m=>{P&&se({type:"control.set_mode",sessionId:P,mode:m})}}),Fu=Ti.length>0?s.jsx(Av,{models:Ti,value:bf,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:es(X==null?void 0:X.provider),onModel:m=>{!P||!m||se({type:"control.set_model",sessionId:P,model:m})},onEffort:m=>{P&&se({type:"control.set_effort",sessionId:P,effort:m})},onUltracode:m=>{P&&se({type:"control.set_ultracode",sessionId:P,enabled:m})},onThinking:m=>{P&&se({type:"control.set_thinking",sessionId:P,enabled:m})},onSwitchOnFlag:m=>{P&&se({type:"control.set_flag_switch",sessionId:P,enabled:m})}}):kc&&s.jsx("span",{className:"badge",children:kc}),Xu=Js&&s.jsx("span",{className:vc?"badge badge--wait":"badge badge--live",children:vc?"ждёт":wl?"переподключается":"работает"}),jf=(X==null?void 0:X.state)==="closed"&&s.jsx("span",{className:"badge",title:"Разговор сохранён — сессия поднимется заново, как только вы отправите сообщение",children:"остановлена"}),Ku=Xu||jf,So=()=>{if(!P)return;const m=P;Su().then(L=>{L&&se({type:"session.reconnect",sessionId:m,...ho?{force:!0}:{}})})},Nf=wl?"Сессия уже поднимает новый процесс":Js?"Недоступно, пока идёт ход":"Поднять сессии новый процесс — разговор сохранён",kf=P&&(wl||(X==null?void 0:X.state)==="error")?s.jsxs("div",{className:wl?"relink":"relink relink--error",role:"status",children:[s.jsxs("span",{className:"relink__msg",children:[s.jsx("span",{className:"relink__dot","aria-hidden":"true"}),wl?"Связь оборвалась. Сессия поднимает новый процесс — разговор сохранён.":"Переподключиться не удалось. Разговор сохранён — сессия продолжит с этого места."]}),s.jsx("button",{className:"btn btn--sm",title:wl?"Не ждать паузы между попытками — попробовать сейчас":"Поднять сессии новый процесс и продолжить разговор",onClick:So,children:wl?"Переподключить сейчас":"Переподключить"})]}):null,_a=ws?mo(ws.sessionId,ws.workspaceId,ws.limit!==null):null,Qu=ws&&(_a!=null&&_a.canChoose)?{targets:_a.targets,selectedId:_a.selectedId,sourceId:_a.sourceId,onSelect:m=>xt(L=>({...L,[ws.sessionId]:m}))}:null,Sl=X&&X.state!=="closed"&&es(X.provider)&&Nl?mo(Nl,X.workspaceId,!1):null,Sc=Sl!=null&&Sl.canChoose&&Nl?m=>xt(L=>({...L,[Nl]:m})):null,Pu=ws?s.jsx(vM,{handoff:ws,sourceAccount:(_a==null?void 0:_a.source)??null,accountChoice:Qu,onContinue:()=>pc(ws),onShow:()=>nl(ws),onDismiss:()=>Cu(ws.sessionId)}):null,Eo=ma?qs.filter(m=>m.status==="needs-auth"&&!ui.includes(m.name)).map(m=>m.name):[],wf=Eo.length>0&&!Tn?s.jsx(kM,{servers:Eo,onAuthorize:m=>{Bl("mcp"),ga.mcpAuth(m)},onDismiss:()=>hc(Eo)}):null,Zu=X&&X.totalCostUsd>0?`$${X.totalCostUsd.toFixed(3)}`:null,Sf=es(X==null?void 0:X.provider)&&s.jsx("button",{className:_i?"pane-btn is-on":"pane-btn",title:"Вопрос на полях — спросить, не мешая работе","aria-label":"Вопрос на полях","aria-pressed":_i,onClick:()=>rc(m=>!m),children:s.jsx(m2,{})}),Ef=dn&&s.jsx("button",{type:"button",className:"pane-btn",title:"Память и инструкции проекта","aria-label":"Память и инструкции",onClick:()=>Qe(!0),children:s.jsx(p2,{})}),Ec=X&&X.state!=="closed"&&s.jsx("button",{type:"button",className:"pane-btn pane-btn--stop",title:"Остановить сессию — освобождает память хоста, разговор остаётся на диске","aria-label":"Остановить сессию",onClick:()=>dc(X),children:s.jsx(u2,{})}),Hl=X?Pn[X.id]===!0:!1,Nr=x0({onLongPress:()=>{X&&Ga(X)},onClick:()=>{X&&pa(X)},disabled:Hl}),Cf=X&&X.state!=="closed"&&es(X.provider)&&s.jsxs("button",{type:"button",className:Hl?"pane-btn pane-btn--handoff is-busy":Nr.holding?"pane-btn pane-btn--handoff is-holding":"pane-btn pane-btn--handoff",style:{"--hold-ms":`${Nr.thresholdMs}ms`},title:Hl?"Пишется хэндофф…":"Клик — хэндофф и новая сессия: агент запишет сводку, сессия остановится, работа продолжится в новой. Зажать (или Shift+клик) — новая пустая сессия без хэндоффа: закрепление переходит, старая сессия продолжает работать.","aria-label":"Хэндофф и новая сессия","aria-busy":Hl,disabled:Hl,...Nr.handlers,children:[s.jsx("span",{className:"pane-btn__hold","aria-hidden":"true"}),s.jsx(d2,{})]});return s.jsx(Rg.Provider,{value:Ha,children:s.jsxs("div",{className:"app",style:Ji.style,children:[s.jsx(LS,{open:an,connected:l,status:r,workspaces:k,archivedWorkspaces:E,sessionFolders:T,pinnedFolders:q,projectSessions:ee,onRequestSessions:m=>se({type:"session.list",workspaceId:m}),pinned:B,live:le,listOrder:A,liveSessionsFirst:(Le==null?void 0:Le.liveSessionsFirst)===!0,onReorder:uo,activeWorkspaceId:U,activeSessionId:P,onPinSessions:rf,onSelectPinned:cf,contentResults:Ms,onSearchContent:Nu,onOpenContentHit:fo,onCloseWorkspaces:bm,onRestoreWorkspaces:oc,onUnmarkWorkspaces:Yn,onArchiveSessions:cc,onUnarchiveSessions:(m,L)=>{se({type:"session.unarchive",workspaceId:m,sessionIds:L})},onCreateFolder:ju,onRenameFolder:pr,onSetFolderColor:gr,onAssignToFolder:ym,onSelectWorkspace:uc,onRenameSession:po,onStopSession:dc,onOpenWorkspace:()=>pn(!0),folderNotice:K,onDismissFolderNotice:()=>ge(null),onNewSession:af,enabledProviders:vt,lastAccountId:Ul(oe),onSignInAccount:Ei,onOpenExtensions:P&&es(X==null?void 0:X.provider)?()=>Bl("mcp"):null,account:sl[Yi]??null,onOpenAccount:xr,relay:u,onOpenRelay:N?null:()=>j(!0),onOpenSettings:xc,onOpenTasks:()=>Te(!0),onOpenSite:()=>st(!0),onOpenVideo:()=>rt(!0),themeMode:rm,onCycleTheme:cm}),jr("sidebar"),an&&s.jsx("div",{className:"scrim",onClick:()=>We(!1)}),s.jsx(uw,{open:ks,tree:hi,expanded:new Set(ec),activePath:ia,dirty:vm,gitChanges:(Ns==null?void 0:Ns.changed)??[],result:Qd,searchResult:Pd,onSearch:ot,onReveal:bo,onToggle:xa,onOpen:Xa,onCreate:Dn,onRename:jo,onMove:bc,onCopy:No,onDelete:sr,onRefresh:()=>{vl(null),tr({}),Au()},onClose:()=>aa(!1),zoomed:un==="files",onToggleZoom:Ai("files")}),ks&&un!=="files"&&jr("files"),s.jsx(yw,{open:Xn,result:Jd,onSearch:Vt,onOpenMatch:Ci,onClose:()=>ra(!1),zoomed:un==="search",onToggleZoom:Ai("search")}),Xn&&un!=="search"&&jr("search"),s.jsx(iT,{open:la,state:Ns,result:fu,selected:om,busy:hu,onRefresh:Au,onShow:Mu,onCheckout:go,onPush:ol,onPull:Va,onPublish:Ru,onConnectRemote:Ws,onDismissResult:()=>ll(null),onClose:()=>Wr(!1),zoomed:un==="git",onToggleZoom:Ai("git")}),la&&un!=="git"&&jr("git"),s.jsxs("main",{className:(un==="main"||un==="terminal"?"main main--zoomed":"main")+(Kn?` main--acct acct--${Kn.color}`:""),children:[g&&_&&s.jsx(NM,{state:g}),s.jsxs("header",{className:"topbar",children:[s.jsx("button",{className:"btn btn--ghost menu-btn",onClick:()=>We(!0),children:"☰"}),s.jsx("button",{className:ks?"pane-btn is-on":"pane-btn",title:"Файлы проекта","aria-label":"Файлы проекта","aria-pressed":ks,onClick:()=>{aa(m=>!m),Wr(!1),ra(!1)},children:s.jsx(r2,{})}),s.jsx("button",{className:Xn?"pane-btn is-on":"pane-btn",title:"Поиск по тексту в проекте","aria-label":"Поиск по тексту в проекте","aria-pressed":Xn,onClick:()=>{ra(m=>!m),aa(!1),Wr(!1)},children:s.jsx(c2,{})}),s.jsx("button",{className:la?"pane-btn is-on":"pane-btn",title:"История git","aria-label":"История git","aria-pressed":la,onClick:()=>{Wr(m=>!m),aa(!1),ra(!1)},children:s.jsx(o2,{})}),oa&&s.jsx("button",{className:jl?"pane-btn is-on":"pane-btn",title:"Терминал (Ctrl+`)","aria-label":"Терминал","aria-pressed":jl,onClick:()=>ar(m=>!m),children:s.jsx(h2,{})}),ct&&Sf,ct&&s.jsx("button",{className:xe?"pane-btn is-on":"pane-btn",title:"Ещё","aria-label":"Ещё","aria-haspopup":"menu","aria-pressed":xe,onClick:()=>$e(!0),children:s.jsx(g2,{})}),s.jsxs("div",{className:"topbar__id",children:[Bt&&X?s.jsx(Pi,{className:"rename--title",value:X.title??"",onCommit:m=>{po(X,m),Ye(!1)},onCancel:()=>Ye(!1)}):s.jsxs("div",{className:"topbar__head",children:[ct&&Kn&&s.jsx(Sa,{account:Kn}),s.jsx("button",{className:"topbar__title",disabled:!X||ct,title:X&&!ct?"Переименовать сессию":void 0,onClick:()=>Ye(!0),children:(X==null?void 0:X.title)??"Claude Code Visual"}),dn&&s.jsx("span",{className:"topbar__project",title:dn.path,children:dn.name})]}),ct?Ku:yr&&s.jsx(Tv,{path:yr})]}),!ct&&s.jsxs("div",{className:"topbar__tools",children:[s.jsx(iE,{disabled:!X,saveDisabled:!U,onDownload:ku,onSave:wu}),s.jsx("button",{type:"button",className:fi?"meters-refresh is-busy":"meters-refresh",title:mr,"aria-label":ro,"aria-busy":fi,disabled:!P||fi,onClick:ft,children:s.jsx(x2,{})}),Kn&&s.jsx(tb,{account:Kn,onClick:xr}),s.jsx(sx,{usage:io}),s.jsx(Lv,{}),Vu,Fu,Ku,Zu&&s.jsx("span",{className:"badge badge--cost",children:Zu}),Cf,Sl&&Sc&&!Hl&&s.jsx(Hv,{variant:"mark",targets:Sl.targets,selectedId:Sl.selectedId,sourceId:Sl.sourceId,onSelect:Sc}),Ec,Ef,Sf]})]}),s.jsx(YM,{tokens:(Fn==null?void 0:Fn.tokens)??Ne.contextTokens,maxTokens:(Fn==null?void 0:Fn.maxTokens)??null,fetchedAt:(Fn==null?void 0:Fn.fetchedAt)??null}),ct&&xe&&s.jsx(UT,{onClose:()=>$e(!1),permission:Vu,model:Fu,account:Kn&&s.jsx(tb,{account:Kn}),usage:io,cwd:yr,costLabel:Zu,onRefresh:ft,refreshing:fi,metersFetchedAt:Il,onRename:X?()=>{Ye(!0),$e(!1)}:null,onHandoff:X&&X.state!=="closed"&&es(X.provider)?()=>{pa(X),$e(!1)}:null,onFreshSession:X&&X.state!=="closed"&&es(X.provider)?()=>{Ga(X),$e(!1)}:null,handoffWriting:Hl,handoffAccount:Sl&&Sc&&!Hl?s.jsx(bM,{targets:Sl.targets,selectedId:Sl.selectedId,onSelect:Sc}):null,onMemory:dn?()=>{Qe(!0),$e(!1)}:null,onExportDownload:X?ku:null,onExportSave:X&&U?wu:null,onStop:X&&X.state!=="closed"?()=>{dc(X),$e(!1)}:null}),Ma.length>0&&s.jsx(gS,{files:Ma,activePath:ia,busy:Js,onSelect:Da,onClose:m=>Ka(m),zoomed:un==="main",onToggleZoom:Ai("main")}),vr?s.jsx(mS,{file:vr,goto:(ac==null?void 0:ac.path)===vr.path?ac:null,onChange:(m,L)=>{Ds(ne=>ne.map(ve=>ve.path===m?{...ve,text:L}:ve)),Ss(m)},onSave:m=>yo(m),onReload:Ou,onOverwrite:m=>yo(m,!0),onRequestMedia:zu,images:Kd,onRequestImage:Iu,onPasteImage:$u,preview:mi[vr.path],onRequestPreview:kn,onTogglePreview:m=>Ds(L=>L.map(ne=>ne.path===m?{...ne,previewMode:!ne.previewMode}:ne)),onSetMarkdownMode:(m,L)=>{qk(L),Ds(ne=>ne.map(ve=>ve.path===m?{...ve,previewMode:L==="preview",textMode:L==="text"}:ve))}}):s.jsxs(s.Fragment,{children:[s.jsx(ex,{items:Ne.items,busy:Js&&!wl,waiting:vc,empty:es(X==null?void 0:X.provider)?void 0:`Сессия пуста. Опишите задачу — ${lb(X==null?void 0:X.provider)} работает в каталоге проекта.`,onOpenPreview:Du,history:hr,historyHasMore:Cp(Xe),historyLoading:Xe.loading,onLoadHistory:rl,outline:!0,sessionId:P??void 0,onEditMessage:es(X==null?void 0:X.provider)?(m,L,ne,ve)=>{if(!P||_)return!1;const De=P,mt=ho;return Su().then(St=>St?mc(()=>se({type:"prompt.edit",sessionId:De,userIndex:m,text:L,images:ne,...ve!=null&&ve.rewindFiles?{rewindFiles:!0}:{},...mt?{force:!0}:{}})):!1)}:void 0,onRewindFiles:!es(X==null?void 0:X.provider)||!P?void 0:(m,L)=>nn(P,m,L)}),kf,Pu,wf,P&&((kr=X==null?void 0:X.tasks)!=null&&kr.length)?s.jsx(vS,{tasks:X.tasks,onStop:m=>se({type:"task.stop",sessionId:P,taskId:m})}):null,sn&&Yu&&jc&&s.jsx(HC,{kind:Yu,toolName:sn.toolName,queued:Ne.pending.length-1,onExpand:()=>Nc(sn.requestId,!1)}),P&&(((Ju=ce[P])==null?void 0:Ju.items.length)??0)>0?s.jsx(WM,{queue:ce[P],onUpdate:(m,L)=>se({type:"queue.update",sessionId:P,itemId:m,text:L}),onRemove:m=>se({type:"queue.remove",sessionId:P,itemId:m}),onSendNow:m=>se({type:"queue.send_now",sessionId:P,itemId:m}),onResume:()=>se({type:"queue.resume",sessionId:P})}):null,s.jsx(Sv,{disabled:!P,queueWhileBusy:!0,busy:Js&&!wl,sendBlocked:_,longPasteThreshold:(Le==null?void 0:Le.longPasteThreshold)??0,placeholder:wl?"Промпт уйдёт, как только связь вернётся":(X==null?void 0:X.state)==="closed"?"Остановлена — отправьте сообщение, чтобы продолжить":Js?"Агент работает — Enter поставит в очередь":void 0,commands:qu,sessionTitle:(X==null?void 0:X.title)??null,contextResult:_o,draftKey:P,insertRequest:zn,onInsertConsumed:m=>_e(L=>(L==null?void 0:L.token)===m?null:L),onContextSearch:m=>Rn("mention",m),onCommand:ko,onSend:wi,onInterrupt:()=>{P&&se({type:"control.interrupt",sessionId:P})}})]}),jl&&oa&&s.jsxs(s.Fragment,{children:[!ct&&un!=="terminal"&&s.jsx(LM,{height:ic.height,onResize:ic.setHeight,onReset:ic.reset}),s.jsx($M,{mobile:ct,zoomed:un==="terminal",onToggleZoom:Ai("terminal"),terminals:La,activeId:ef,blocked:or,error:ir,onDismissError:()=>rr(null),height:ct?ca.height:ic.height,offset:ct?{top:ca.offsetTop,left:ca.offsetLeft}:void 0,onSelect:Ll,onOpen:()=>yc(),onClose:Hu,onInput:(m,L)=>se({type:"term.input",id:m,data:L}),onResize:(m,L,ne)=>se({type:"term.resize",id:m,cols:L,rows:ne}),onAttach:m=>se({type:"term.attach",id:m}),onHide:()=>ar(!1),registerSink:xm})]})]}),s.jsx(TT,{open:_i,items:al.items,busy:yf,ready:P!==null,sendBlocked:_,longPasteThreshold:(Le==null?void 0:Le.longPasteThreshold)??0,commands:qu,contextResult:br,draftKey:P,models:wc.rows,model:wc.selected,effort:Qa.effort,ultracode:Qa.ultracode,thinking:Qa.thinking,switchOnFlag:Qa.switchOnFlag,onContextSearch:m=>Rn("side",m),onCommand:ko,onModel:m=>{m&&(Ol(L=>({...L,model:m})),Ya(L=>se({type:"control.set_model",sessionId:L,model:m})))},onEffort:m=>{Ol(L=>({...L,effort:m,ultracode:!1})),Ya(L=>se({type:"control.set_effort",sessionId:L,effort:m}))},onUltracode:m=>{Ol(L=>({...L,ultracode:m,...m?{effort:"xhigh"}:{}})),Ya(L=>se({type:"control.set_ultracode",sessionId:L,enabled:m}))},onThinking:m=>{Ol(L=>({...L,thinking:m})),Ya(L=>se({type:"control.set_thinking",sessionId:L,enabled:m}))},onSwitchOnFlag:m=>{Ol(L=>({...L,switchOnFlag:m})),Ya(L=>se({type:"control.set_flag_switch",sessionId:L,enabled:m}))},onAsk:uf,onInterrupt:()=>{xu&&se({type:"control.interrupt",sessionId:xu})},onReset:_r,onClose:()=>rc(!1),zoomed:un==="ask",onToggleZoom:Ai("ask")}),_i&&un!=="ask"&&jr("ask"),(la||_i||ks||Xn)&&s.jsx("div",{className:"scrim scrim--pane",onClick:()=>{Wr(!1),rc(!1),aa(!1),ra(!1)}}),du&&s.jsx(uT,{detail:du,local:((Ns==null?void 0:Ns.hasRemote)??!1)&&(Ns==null?void 0:Ns.commits.some(m=>m.hash===du.hash&&!m.pushed))===!0,onCheckout:go,onClose:()=>{Jr(null),Fc(null)}}),J&&s.jsxs(Sn,{title:"Лимит плана почти исчерпан",onClose:()=>Si(!1),actions:s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn",autoFocus:!0,onClick:()=>Si(!1),children:"Отмена"}),s.jsx("button",{className:"btn btn--primary",onClick:()=>Si(!0),children:"Отправить всё равно"})]}),children:[s.jsxs("p",{className:"modal__text",children:[Zh[J.warning.limit][0].toUpperCase(),Zh[J.warning.limit].slice(1)," использован на"," ",Math.round(J.warning.utilization)," %, сброс в"," ",AM(J.warning.resetsAt),". Сообщение может оборваться на полуслове, когда лимит дойдёт до 100 %."]}),s.jsx("p",{className:"modal__text modal__text--dim",children:"До сброса сессию повторно останавливать не будем."})]}),ds&&s.jsx(Sn,{title:"Прервать вход в MCP-сервер?",onClose:()=>qa(!1),actions:s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn",onClick:()=>qa(!1),children:"Отмена"}),s.jsx("button",{className:"btn btn--warn",onClick:()=>qa(!0),children:"Продолжить"})]}),children:s.jsxs("p",{className:"modal__text",children:["Идёт вход в MCP-сервер «",ds.name,"» — перезапуск процесса его прервёт. Продолжить?"]})}),O&&s.jsx(Sn,{title:"Остановить сессию?",onClose:()=>H(null),actions:s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn",onClick:()=>H(null),children:"Отмена"}),s.jsx("button",{className:"btn btn--warn",onClick:()=>{se({type:"session.close",sessionId:O.id}),H(null)},children:"Остановить"})]}),children:s.jsx("p",{className:"modal__text",children:"Сессия сейчас работает — остановка прервёт текущий ход. Разговор останется на диске: открыть сессию заново или просто написать в неё снова можно в любой момент."})}),er&&s.jsxs(Sn,{title:"Переключить рабочее дерево?",onClose:()=>Xc(null),actions:s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn",onClick:()=>Xc(null),children:"Отмена"}),s.jsx("button",{className:"btn btn--warn",onClick:Zs,children:"Переключиться"})]}),children:[s.jsxs("p",{className:"modal__text",children:["git переключится на ",er.label,". Файлы в каталоге проекта изменятся — это тот же каталог, в котором работает агент."]}),Js&&s.jsx("p",{className:"modal__text",children:"Сейчас идёт ход агента: он читает и правит файлы прямо сейчас."}),Ns&&Ns.changed.length>0&&s.jsxs("p",{className:"modal__text",children:["Незакоммиченных изменений: ",Ns.changed.length,". Git откажется переключаться, если они будут затёрты."]})]}),hm&&s.jsx(NT,{status:Xd,owners:dm,files:mm,defaultName:(dn==null?void 0:dn.name)??"",hasCommits:Ns===null||Ns.head!=="",busy:hu,result:fu,onRefreshStatus:xo,onSaveToken:Mn,onPublish:df,onDismissResult:()=>ll(null),onClose:()=>Kc(!1)}),pm&&s.jsx(CT,{busy:hu,result:fu,onSubmit:Fa,onDismissResult:()=>ll(null),onClose:()=>Qc(!1)}),gi&&s.jsx(Sn,{title:gi.kind==="dir"?"Удалить каталог?":"Удалить файл?",onClose:()=>sr(null),actions:s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn",onClick:()=>sr(null),children:"Отмена"}),s.jsx("button",{className:"btn btn--warn",onClick:()=>Uu(gi),children:"Удалить"})]}),children:s.jsxs("p",{className:"modal__text",children:[gi.path," будет удалён с диска",gi.kind==="dir"?" вместе со всем содержимым":"",". Корзины здесь нет: это тот же каталог, в котором работает агент."]})}),lr&&s.jsx(Sn,{title:"Закрыть без сохранения?",onClose:()=>lc(null),actions:s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn",onClick:()=>lc(null),children:"Отмена"}),s.jsx("button",{className:"btn btn--warn",onClick:()=>Ka(lr,!0),children:"Закрыть"}),s.jsx("button",{className:"btn btn--primary",onClick:()=>{yo(lr),Ka(lr,!0)},children:"Сохранить и закрыть"})]}),children:s.jsxs("p",{className:"modal__text",children:["В ",lr," есть несохранённые правки."]})}),ye&&dn&&s.jsx(YT,{workspaceId:dn.id,workspaceName:dn.name,accountId:X==null?void 0:X.accountId,stateAccountId:ht,files:rn,file:On,result:Mt,send:se,onClose:()=>{Qe(!1),kt(null),_s(null),fn(null),zt(null)}}),Ce&&s.jsx(eA,{tasks:bs,workspaces:k,activeWorkspaceId:U,send:se,onOpenSession:ki,error:As,onClearError:()=>cs(null),onClose:()=>{Te(!1),cs(null)}}),Ie&&dn&&s.jsx(iA,{workspaceId:dn.id,workspaceName:dn.name,remote:N,reply:_t,send:se,hasSession:!!P,onInsertPrompt:yu,onClose:()=>st(!1)},dn.id),Je&&dn&&s.jsx(jA,{workspaceId:dn.id,remote:N,catalog:it,studios:sf,links:Ba,previews:mi,mediaCache:Kd,send:se,onRequestMedia:zu,hasSession:!!P,onInsertPrompt:yu,onInstallFfmpeg:oa&&!or?Bu:void 0,onClose:()=>rt(!1)},dn.id),Tn&&s.jsx(wA,{tab:Tn,servers:qs,plugins:bl,marketplaces:Qn,catalog:Ta,result:Zl,auth:ss,duplicates:tn,accounts:qn,remote:N,actions:ga,onTab:Lt,onClose:()=>Lt(null)}),Dl&&s.jsx(OA,{accounts:qn,auth:sl,logins:An,candidates:Se,usage:Re,actions:Tu,onOpenLogin:Ei,activeAccountId:(Kn==null?void 0:Kn.id)??null,error:ls,onReconnect:P?()=>{So(),js(!1)}:null,reconnectBlocked:Js,reconnectHint:Nf,onClose:()=>js(!1)}),b&&s.jsx(QA,{state:u,onPair:(m,L)=>se({type:"relay.pair",code:m,...L?{name:L}:{}}),onUnpair:()=>se({type:"relay.unpair"}),onClose:()=>j(!1)}),Zn&&s.jsx(_M,{settings:Le,models:(Me==null?void 0:Me.models)??[],relayState:u,networkState:g,local:Ah()==="local",onChange:of,onEnableShell:()=>se({type:"relay.shell.enable"}),onDisableShell:()=>se({type:"relay.shell.disable"}),onOpenRelay:()=>{_n(!1),j(!0)},claudeLogin:{accounts:qn,auth:sl,logins:An,actions:gc,remote:N,runningByAccount:vu,focusAccountId:M},onClose:()=>{_n(!1),Z(null)}}),Un&&s.jsx(WC,{candidates:Tt,searching:os,agentItems:Hs.items,agentBusy:(_l==null?void 0:_l.state)==="running",error:Rs,roots:wt,created:Dt,onSearch:co,onAskAgent:lf,onInterrupt:()=>{const m=fa.current;m&&se({type:"control.interrupt",sessionId:m})},onSubmit:vi,onCreate:as,onClose:_m}),sn!=null&&sn.questions&&sn.questions.length>0?s.jsx(GC,{request:{...sn,questions:sn.questions},queued:Ne.pending.length-1,collapsed:jc,onCollapse:()=>Nc(sn.requestId,!0),onAnswer:hf,onDecline:mf}):sn&&wo!==null?s.jsx(UC,{request:sn,plan:wo,queued:Ne.pending.length-1,collapsed:jc,onCollapse:()=>Nc(sn.requestId,!0),onAccept:pf,onDecline:gf}):sn&&s.jsx(qC,{request:sn,queued:Ne.pending.length-1,collapsed:jc,onCollapse:()=>Nc(sn.requestId,!0),onDecide:ff}),fs&&s.jsx(jM,{handoff:fs,onClose:()=>nl(null)}),s.jsx(EM,{notices:sa,onDismiss:m=>Nn(L=>L.filter(ne=>ne.id!==m))})]})})}function r2(){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 c2(){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 o2(){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 u2(){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 d2(){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 f2(n,l){return Py(n)===Py(l)}function Py(n){return n.replace(/[\\/]+/g,"/").replace(/\/+$/,"").toLowerCase()}function h2(){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 m2(){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 p2(){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 g2(){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 x2(){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 Yv=document.getElementById("root");if(!Yv)throw new Error("#root not found");sN.createRoot(Yv).render(s.jsx(p.StrictMode,{children:s.jsx(i2,{})}));export{rk as D,yn as I,L0 as N,y2 as P,Ml as S,gl as T,at as _,Ea as a,jn as b,U0 as c,Id as d,fS as e,Zk as f,ik as g,Sk as h,Yk as i,Ql as j,v2 as k,b2 as l,p as m,V0 as n,s as o,Pk as p,aw as q,Wk as r,j2 as s,Ue as t,hg as u,G0 as v};
|