@i14ks/ccv 0.24.0 → 0.24.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/package.json +1 -1
  2. package/web/assets/{codemirror-BABguQzY.js → codemirror-CVe_WI3e.js} +1 -1
  3. package/web/assets/index--b7aPip2.css +1 -0
  4. package/web/assets/{index-U9tL3Foh.js → index-BENS1Et2.js} +1 -1
  5. package/web/assets/{index-CIsgyM-R.js → index-BS_AsIEi.js} +1 -1
  6. package/web/assets/{index-BQiRpvdM.js → index-BTat2cjy.js} +1 -1
  7. package/web/assets/{index-BJQdUP7a.js → index-BVTKBCk1.js} +1 -1
  8. package/web/assets/{index-DXMZoXqv.js → index-BfpRxrlX.js} +3 -3
  9. package/web/assets/{index-DogVeywh.js → index-BnDGCTVR.js} +1 -1
  10. package/web/assets/{index-BnqCpVA0.js → index-Bt4DUbpM.js} +1 -1
  11. package/web/assets/{index-BRzmWdWn.js → index-BvJsiicf.js} +1 -1
  12. package/web/assets/{index-CZppS1t2.js → index-COgGuYuk.js} +1 -1
  13. package/web/assets/{index-DW1Fnc9x.js → index-CQpgnjUL.js} +1 -1
  14. package/web/assets/{index-BmRYCxGv.js → index-CaQnLaP1.js} +1 -1
  15. package/web/assets/{index-CxF-ndAb.js → index-CdS9TWKz.js} +1 -1
  16. package/web/assets/{index-dSYnVYDn.js → index-ChH2BaGk.js} +1 -1
  17. package/web/assets/{index-BWAAro79.js → index-ClcgV2Ok.js} +1 -1
  18. package/web/assets/{index-Bqjj9q2W.js → index-D3s6YlZz.js} +1 -1
  19. package/web/assets/{index-Di0Nghq9.js → index-DVlOSKL1.js} +1 -1
  20. package/web/assets/{index-Ck0zkLid.js → index-DaeDM5ye.js} +1 -1
  21. package/web/assets/{index-BHEVBqv1.js → index-EFEGjfDS.js} +1 -1
  22. package/web/assets/{index-DnlEeQVW.js → index-dESUNfha.js} +1 -1
  23. package/web/assets/{index-BaKf7c69.js → index-zhxDV4zv.js} +1 -1
  24. package/web/index.html +2 -2
  25. package/web/assets/index-DafZE925.css +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-U9tL3Foh.js","./index-Di0Nghq9.js","./index-DogVeywh.js","./index-BHot-lnj.js","./index-891wE-Rj.js","./index-BQiRpvdM.js","./index-CIsgyM-R.js","./index-dSYnVYDn.js","./index-DW1Fnc9x.js","./index-BHEVBqv1.js","./index-BWAAro79.js","./index-CZppS1t2.js","./index-Ck0zkLid.js","./index-BmRYCxGv.js","./index-BJQdUP7a.js","./index-BaKf7c69.js","./index-DnlEeQVW.js","./index-BRzmWdWn.js","./index-CxF-ndAb.js","./index-Bqjj9q2W.js","./index-BnqCpVA0.js","./codemirror-BABguQzY.js","./xterm-D6Mng-DB.js","./_commonjsHelpers-CqkleIqs.js","./addon-fit-CevVMrUA.js","./addon-web-links-CnB65OV_.js","./xterm-DYP7pi_n.css"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-BENS1Et2.js","./index-DVlOSKL1.js","./index-BnDGCTVR.js","./index-BHot-lnj.js","./index-891wE-Rj.js","./index-BTat2cjy.js","./index-BS_AsIEi.js","./index-ChH2BaGk.js","./index-CQpgnjUL.js","./index-EFEGjfDS.js","./index-ClcgV2Ok.js","./index-COgGuYuk.js","./index-DaeDM5ye.js","./index-CaQnLaP1.js","./index-BVTKBCk1.js","./index-zhxDV4zv.js","./index-dESUNfha.js","./index-BvJsiicf.js","./index-CdS9TWKz.js","./index-D3s6YlZz.js","./index-Bt4DUbpM.js","./codemirror-CVe_WI3e.js","./xterm-D6Mng-DB.js","./_commonjsHelpers-CqkleIqs.js","./addon-fit-CevVMrUA.js","./addon-web-links-CnB65OV_.js","./xterm-DYP7pi_n.css"])))=>i.map(i=>d[i]);
2
2
  var y0=Object.defineProperty;var Sx=l=>{throw TypeError(l)};var v0=(l,s,r)=>s in l?y0(l,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[s]=r;var $t=(l,s,r)=>v0(l,typeof s!="symbol"?s+"":s,r),Rh=(l,s,r)=>s.has(l)||Sx("Cannot "+r);var Qe=(l,s,r)=>(Rh(l,s,"read from private field"),r?r.call(l):s.get(l)),pn=(l,s,r)=>s.has(l)?Sx("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(l):s.set(l,r),Tt=(l,s,r,c)=>(Rh(l,s,"write to private field"),c?c.call(l,r):s.set(l,r),r),Bn=(l,s,r)=>(Rh(l,s,"access private method"),r);(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))c(o);new MutationObserver(o=>{for(const d of o)if(d.type==="childList")for(const h of d.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&c(h)}).observe(document,{childList:!0,subtree:!0});function r(o){const d={};return o.integrity&&(d.integrity=o.integrity),o.referrerPolicy&&(d.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?d.credentials="include":o.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function c(o){if(o.ep)return;o.ep=!0;const d=r(o);fetch(o.href,d)}})();var Dh={exports:{}},Go={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -114,8 +114,8 @@ ${l}</tr>
114
114
  Please report this to https://github.com/markedjs/marked.`,l){let c="<p>An error occurred:</p><pre>"+ia(r.message+"",!0)+"</pre>";return s?Promise.resolve(c):c}if(s)return Promise.reject(r);throw r}}},Er=new t1;function Rt(l,s){return Er.parse(l,s)}Rt.options=Rt.setOptions=function(l){return Er.setOptions(l),Rt.defaults=Er.defaults,y_(Rt.defaults),Rt};Rt.getDefaults=jp;Rt.defaults=Cr;Rt.use=function(...l){return Er.use(...l),Rt.defaults=Er.defaults,y_(Rt.defaults),Rt};Rt.walkTokens=function(l,s){return Er.walkTokens(l,s)};Rt.parseInline=Er.parseInline;Rt.Parser=Bs;Rt.parser=Bs.parse;Rt.Renderer=Qf;Rt.TextRenderer=Ap;Rt.Lexer=Hs;Rt.lexer=Hs.lex;Rt.Tokenizer=Vf;Rt.Hooks=Wo;Rt.parse=Rt;Rt.options;Rt.setOptions;Rt.use;Rt.walkTokens;Rt.parseInline;Bs.parse;Hs.lex;/*! @license DOMPurify 3.4.12 | (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.12/LICENSE */function Qx(l,s){(s==null||s>l.length)&&(s=l.length);for(var r=0,c=Array(s);r<s;r++)c[r]=l[r];return c}function n1(l){if(Array.isArray(l))return l}function l1(l,s){var r=l==null?null:typeof Symbol<"u"&&l[Symbol.iterator]||l["@@iterator"];if(r!=null){var c,o,d,h,p=[],g=!0,x=!1;try{if(d=(r=r.call(l)).next,s!==0)for(;!(g=(c=d.call(r)).done)&&(p.push(c.value),p.length!==s);g=!0);}catch(y){x=!0,o=y}finally{try{if(!g&&r.return!=null&&(h=r.return(),Object(h)!==h))return}finally{if(x)throw o}}return p}}function s1(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
115
115
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function a1(l,s){return n1(l)||l1(l,s)||i1(l,s)||s1()}function i1(l,s){if(l){if(typeof l=="string")return Qx(l,s);var r={}.toString.call(l).slice(8,-1);return r==="Object"&&l.constructor&&(r=l.constructor.name),r==="Map"||r==="Set"?Array.from(l):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Qx(l,s):void 0}}const A_=Object.entries,Kx=Object.setPrototypeOf,r1=Object.isFrozen,c1=Object.getPrototypeOf,o1=Object.getOwnPropertyDescriptor;let ol=Object.freeze,ul=Object.seal,wc=Object.create,M_=typeof Reflect<"u"&&Reflect,dp=M_.apply,hp=M_.construct;ol||(ol=function(s){return s});ul||(ul=function(s){return s});dp||(dp=function(s,r){for(var c=arguments.length,o=new Array(c>2?c-2:0),d=2;d<c;d++)o[d-2]=arguments[d];return s.apply(r,o)});hp||(hp=function(s){for(var r=arguments.length,c=new Array(r>1?r-1:0),o=1;o<r;o++)c[o-1]=arguments[o];return new s(...c)});const bc=In(Array.prototype.forEach),u1=In(Array.prototype.lastIndexOf),Zx=In(Array.prototype.pop),_c=In(Array.prototype.push),f1=In(Array.prototype.splice),Li=Array.isArray,Po=In(String.prototype.toLowerCase),Yh=In(String.prototype.toString),Fx=In(String.prototype.match),Xo=In(String.prototype.replace),Jx=In(String.prototype.indexOf),d1=In(String.prototype.trim),h1=In(Number.prototype.toString),p1=In(Boolean.prototype.toString),Wx=typeof BigInt>"u"?null:In(BigInt.prototype.toString),Px=typeof Symbol>"u"?null:In(Symbol.prototype.toString),Fn=In(Object.prototype.hasOwnProperty),Vo=In(Object.prototype.toString),Zn=In(RegExp.prototype.test),mr=m1(TypeError);function In(l){return function(s){s instanceof RegExp&&(s.lastIndex=0);for(var r=arguments.length,c=new Array(r>1?r-1:0),o=1;o<r;o++)c[o-1]=arguments[o];return dp(l,s,c)}}function m1(l){return function(){for(var s=arguments.length,r=new Array(s),c=0;c<s;c++)r[c]=arguments[c];return hp(l,r)}}function gt(l,s){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Po;if(Kx&&Kx(l,null),!Li(s))return l;let c=s.length;for(;c--;){let o=s[c];if(typeof o=="string"){const d=r(o);d!==o&&(r1(s)||(s[c]=d),o=d)}l[o]=!0}return l}function g1(l){for(let s=0;s<l.length;s++)Fn(l,s)||(l[s]=null);return l}function El(l){const s=wc(null);for(const c of A_(l)){var r=a1(c,2);const o=r[0],d=r[1];Fn(l,o)&&(Li(d)?s[o]=g1(d):d&&typeof d=="object"&&d.constructor===Object?s[o]=El(d):s[o]=d)}return s}function x1(l){switch(typeof l){case"string":return l;case"number":return h1(l);case"boolean":return p1(l);case"bigint":return Wx?Wx(l):"0";case"symbol":return Px?Px(l):"Symbol()";case"undefined":return Vo(l);case"function":case"object":{if(l===null)return Vo(l);const s=l,r=ra(s,"toString");if(typeof r=="function"){const c=r(s);return typeof c=="string"?c:Vo(c)}return Vo(l)}default:return Vo(l)}}function ra(l,s){for(;l!==null;){const c=o1(l,s);if(c){if(c.get)return In(c.get);if(typeof c.value=="function")return In(c.value)}l=c1(l)}function r(){return null}return r}function b1(l){try{return Zn(l,""),!0}catch{return!1}}const eb=ol(["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"]),$h=ol(["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"]),Xh=ol(["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"]),_1=ol(["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"]),Vh=ol(["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"]),y1=ol(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),tb=ol(["#text"]),nb=ol(["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"]),Qh=ol(["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","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","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"]),lb=ol(["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"]),jf=ol(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),v1=ul(/{{[\w\W]*|^[\w\W]*}}/g),j1=ul(/<%[\w\W]*|^[\w\W]*%>/g),w1=ul(/\${[\w\W]*/g),S1=ul(/^data-[\-\w.\u00B7-\uFFFF]+$/),N1=ul(/^aria-[\-\w]+$/),sb=ul(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),k1=ul(/^(?:\w+script|data):/i),T1=ul(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),E1=ul(/^html$/i),C1=ul(/^[a-z][.\w]*(-[.\w]+)+$/i),ab=ul(/<[/\w!]/g),ib=ul(/<[/\w]/g),A1=ul(/<\/no(script|embed|frames)/i),M1=ul(/\/>/i),ns={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},R1=function(){return typeof window>"u"?null:window},D1=function(s,r){if(typeof s!="object"||typeof s.createPolicy!="function")return null;let c=null;const o="data-tt-policy-suffix";r&&r.hasAttribute(o)&&(c=r.getAttribute(o));const d="dompurify"+(c?"#"+c:"");try{return s.createPolicy(d,{createHTML(h){return h},createScriptURL(h){return h}})}catch{return console.warn("TrustedTypes policy "+d+" could not be created."),null}},rb=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Ai=function(s,r,c,o){return Fn(s,r)&&Li(s[r])?gt(o.base?El(o.base):{},s[r],o.transform):c};function R_(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:R1();const s=me=>R_(me);if(s.version="3.4.12",s.removed=[],!l||!l.document||l.document.nodeType!==ns.document||!l.Element)return s.isSupported=!1,s;let r=l.document;const c=r,o=c.currentScript;l.DocumentFragment;const d=l.HTMLTemplateElement,h=l.Node,p=l.Element,g=l.NodeFilter,x=l.NamedNodeMap;x===void 0&&(l.NamedNodeMap||l.MozNamedAttrMap),l.HTMLFormElement;const y=l.DOMParser,j=l.trustedTypes,v=p.prototype,C=ra(v,"cloneNode"),k=ra(v,"remove"),E=ra(v,"nextSibling"),A=ra(v,"childNodes"),G=ra(v,"parentNode"),V=ra(v,"shadowRoot"),Z=ra(v,"attributes"),D=h&&h.prototype?ra(h.prototype,"nodeType"):null,$=h&&h.prototype?ra(h.prototype,"nodeName"):null;if(typeof d=="function"){const me=r.createElement("template");me.content&&me.content.ownerDocument&&(r=me.content.ownerDocument)}let z,R="",H,B=!1,le=0;const W=function(){if(le>0)throw mr('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.')},oe=function(T){W(),le++;try{return z.createHTML(T)}finally{le--}},se=function(T){W(),le++;try{return z.createScriptURL(T)}finally{le--}},ge=function(){return B||(H=D1(j,o),B=!0),H},ye=r,Y=ye.implementation,ce=ye.createNodeIterator,de=ye.createDocumentFragment,_e=ye.getElementsByTagName,Ce=c.importNode;let w=rb();s.isSupported=typeof A_=="function"&&typeof G=="function"&&Y&&Y.createHTMLDocument!==void 0;const Q=v1,L=j1,be=w1,we=S1,Me=N1,Oe=k1,Ue=T1,qe=C1;let an=sb,Ke=null;const Zt=gt({},[...eb,...$h,...Xh,...Vh,...tb]);let ct=null;const dt=gt({},[...nb,...Qh,...lb,...jf]);let Ge=Object.seal(wc(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}})),rn=null,jn=null;const st=Object.seal(wc(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let wn=!0,Jn=!0,cn=!1,Wn=!0,It=!1,tt=!0,Dt=!1,qn=!1,Et=null,nt=null,at=!1,hn=!1,mn=!1,Qn=!1,Pt=!0,vt=!1;const Ft="user-content-";let jt=!0,Pn=!1,ne={},xe=null;const Be=gt({},["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 Fe=null;const Ie=gt({},["audio","video","img","source","image","track"]);let Ct=null;const I=gt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),fe="http://www.w3.org/1998/Math/MathML",Ne="http://www.w3.org/2000/svg",Le="http://www.w3.org/1999/xhtml";let wt=Le,Sn=!1,fl=null;const _l=gt({},[fe,Ne,Le],Yh),gs=ol(["mi","mo","mn","ms","mtext"]);let ls=gt({},gs);const ss=ol(["annotation-xml"]);let as=gt({},ss);const Va=gt({},["title","style","font","a","script"]);let dl=null;const el=["application/xhtml+xml","text/html"],Ot="text/html";let Ze=null,gn=null;const Xt=r.createElement("form"),yl=function(T){return T instanceof RegExp||T instanceof Function},Jt=function(){let T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(gn&&gn===T)return;(!T||typeof T!="object")&&(T={}),T=El(T),dl=el.indexOf(T.PARSER_MEDIA_TYPE)===-1?Ot:T.PARSER_MEDIA_TYPE,Ze=dl==="application/xhtml+xml"?Yh:Po,Ke=Ai(T,"ALLOWED_TAGS",Zt,{transform:Ze}),ct=Ai(T,"ALLOWED_ATTR",dt,{transform:Ze}),fl=Ai(T,"ALLOWED_NAMESPACES",_l,{transform:Yh}),Ct=Ai(T,"ADD_URI_SAFE_ATTR",I,{transform:Ze,base:I}),Fe=Ai(T,"ADD_DATA_URI_TAGS",Ie,{transform:Ze,base:Ie}),xe=Ai(T,"FORBID_CONTENTS",Be,{transform:Ze}),rn=Ai(T,"FORBID_TAGS",El({}),{transform:Ze}),jn=Ai(T,"FORBID_ATTR",El({}),{transform:Ze}),ne=Fn(T,"USE_PROFILES")?T.USE_PROFILES&&typeof T.USE_PROFILES=="object"?El(T.USE_PROFILES):T.USE_PROFILES:!1,wn=T.ALLOW_ARIA_ATTR!==!1,Jn=T.ALLOW_DATA_ATTR!==!1,cn=T.ALLOW_UNKNOWN_PROTOCOLS||!1,Wn=T.ALLOW_SELF_CLOSE_IN_ATTR!==!1,It=T.SAFE_FOR_TEMPLATES||!1,tt=T.SAFE_FOR_XML!==!1,Dt=T.WHOLE_DOCUMENT||!1,hn=T.RETURN_DOM||!1,mn=T.RETURN_DOM_FRAGMENT||!1,Qn=T.RETURN_TRUSTED_TYPE||!1,at=T.FORCE_BODY||!1,Pt=T.SANITIZE_DOM!==!1,vt=T.SANITIZE_NAMED_PROPS||!1,jt=T.KEEP_CONTENT!==!1,Pn=T.IN_PLACE||!1,an=b1(T.ALLOWED_URI_REGEXP)?T.ALLOWED_URI_REGEXP:sb,wt=typeof T.NAMESPACE=="string"?T.NAMESPACE:Le,ls=Fn(T,"MATHML_TEXT_INTEGRATION_POINTS")&&T.MATHML_TEXT_INTEGRATION_POINTS&&typeof T.MATHML_TEXT_INTEGRATION_POINTS=="object"?El(T.MATHML_TEXT_INTEGRATION_POINTS):gt({},gs),as=Fn(T,"HTML_INTEGRATION_POINTS")&&T.HTML_INTEGRATION_POINTS&&typeof T.HTML_INTEGRATION_POINTS=="object"?El(T.HTML_INTEGRATION_POINTS):gt({},ss);const K=Fn(T,"CUSTOM_ELEMENT_HANDLING")&&T.CUSTOM_ELEMENT_HANDLING&&typeof T.CUSTOM_ELEMENT_HANDLING=="object"?El(T.CUSTOM_ELEMENT_HANDLING):wc(null);if(Ge=wc(null),Fn(K,"tagNameCheck")&&yl(K.tagNameCheck)&&(Ge.tagNameCheck=K.tagNameCheck),Fn(K,"attributeNameCheck")&&yl(K.attributeNameCheck)&&(Ge.attributeNameCheck=K.attributeNameCheck),Fn(K,"allowCustomizedBuiltInElements")&&typeof K.allowCustomizedBuiltInElements=="boolean"&&(Ge.allowCustomizedBuiltInElements=K.allowCustomizedBuiltInElements),ul(Ge),It&&(Jn=!1),mn&&(hn=!0),ne&&(Ke=gt({},tb),ct=wc(null),ne.html===!0&&(gt(Ke,eb),gt(ct,nb)),ne.svg===!0&&(gt(Ke,$h),gt(ct,Qh),gt(ct,jf)),ne.svgFilters===!0&&(gt(Ke,Xh),gt(ct,Qh),gt(ct,jf)),ne.mathMl===!0&&(gt(Ke,Vh),gt(ct,lb),gt(ct,jf))),st.tagCheck=null,st.attributeCheck=null,Fn(T,"ADD_TAGS")&&(typeof T.ADD_TAGS=="function"?st.tagCheck=T.ADD_TAGS:Li(T.ADD_TAGS)&&(Ke===Zt&&(Ke=El(Ke)),gt(Ke,T.ADD_TAGS,Ze))),Fn(T,"ADD_ATTR")&&(typeof T.ADD_ATTR=="function"?st.attributeCheck=T.ADD_ATTR:Li(T.ADD_ATTR)&&(ct===dt&&(ct=El(ct)),gt(ct,T.ADD_ATTR,Ze))),Fn(T,"ADD_URI_SAFE_ATTR")&&Li(T.ADD_URI_SAFE_ATTR)&&gt(Ct,T.ADD_URI_SAFE_ATTR,Ze),Fn(T,"FORBID_CONTENTS")&&Li(T.FORBID_CONTENTS)&&(xe===Be&&(xe=El(xe)),gt(xe,T.FORBID_CONTENTS,Ze)),Fn(T,"ADD_FORBID_CONTENTS")&&Li(T.ADD_FORBID_CONTENTS)&&(xe===Be&&(xe=El(xe)),gt(xe,T.ADD_FORBID_CONTENTS,Ze)),jt&&(Ke["#text"]=!0),Dt&&gt(Ke,["html","head","body"]),Ke.table&&(gt(Ke,["tbody"]),delete rn.tbody),T.TRUSTED_TYPES_POLICY){if(typeof T.TRUSTED_TYPES_POLICY.createHTML!="function")throw mr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof T.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw mr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const pe=z;z=T.TRUSTED_TYPES_POLICY;try{R=oe("")}catch(je){throw z=pe,je}}else T.TRUSTED_TYPES_POLICY===null?(z=void 0,R=""):(z===void 0&&(z=ge()),z&&typeof R=="string"&&(R=oe("")));ol&&ol(T),gn=T},xs=gt({},[...$h,...Xh,..._1]),Vt=gt({},[...Vh,...y1]),bs=function(T,K,pe){return K.namespaceURI===Le?T==="svg":K.namespaceURI===fe?T==="svg"&&(pe==="annotation-xml"||ls[pe]):!!xs[T]},bt=function(T,K,pe){return K.namespaceURI===Le?T==="math":K.namespaceURI===Ne?T==="math"&&as[pe]:!!Vt[T]},Rn=function(T,K,pe){return K.namespaceURI===Ne&&!as[pe]||K.namespaceURI===fe&&!ls[pe]?!1:!Vt[T]&&(Va[T]||!xs[T])},Dn=function(T){let K=G(T);(!K||!K.tagName)&&(K={namespaceURI:wt,tagName:"template"});const pe=Po(T.tagName),je=Po(K.tagName);return fl[T.namespaceURI]?T.namespaceURI===Ne?bs(pe,K,je):T.namespaceURI===fe?bt(pe,K,je):T.namespaceURI===Le?Rn(pe,K,je):!!(dl==="application/xhtml+xml"&&fl[T.namespaceURI]):!1},Nn=function(T){_c(s.removed,{element:T});try{G(T).removeChild(T)}catch{if(k(T),!G(T))throw mr("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},ot=function(T){on(T);const K=A(T);if(K){const je=[];bc(K,He=>{_c(je,He)}),bc(je,He=>{try{k(He)}catch{}})}const pe=Z(T);if(pe)for(let je=pe.length-1;je>=0;--je){const He=pe[je],Re=He&&He.name;if(typeof Re=="string")try{T.removeAttribute(Re)}catch{}}},At=function(T,K){try{_c(s.removed,{attribute:K.getAttributeNode(T),from:K})}catch{_c(s.removed,{attribute:null,from:K})}if(K.removeAttribute(T),T==="is")if(hn||mn)try{Nn(K)}catch{}else try{K.setAttribute(T,"")}catch{}},Cl=function(T){const K=Z(T);if(K)for(let pe=K.length-1;pe>=0;--pe){const je=K[pe],He=je&&je.name;if(!(typeof He!="string"||ct[Ze(He)]))try{T.removeAttribute(He)}catch{}}},on=function(T){const K=[T];for(;K.length>0;){const pe=K.pop();(D?D(pe):pe.nodeType)===ns.element&&Cl(pe);const He=A(pe);if(He)for(let Re=He.length-1;Re>=0;--Re)K.push(He[Re])}},Gn=function(T){if(!tt)return;const K=[T];for(;K.length>0;){const pe=K.pop(),je=D?D(pe):pe.nodeType;if(je===ns.processingInstruction||je===ns.comment&&Zn(ib,pe.data)){try{k(pe)}catch{}continue}if(je===ns.element){const Re=pe,St=Ze($?$(pe):pe.nodeName);try{Re.hasAttribute&&Re.hasAttribute("patchsrc")&&Re.removeAttribute("patchsrc"),Re.hasAttribute&&Re.hasAttribute("for")&&St!=="label"&&St!=="output"&&Re.removeAttribute("for")}catch{}}const He=A(pe);if(He)for(let Re=He.length-1;Re>=0;--Re)K.push(He[Re])}},tl=function(T){let K=null,pe=null;if(at)T="<remove></remove>"+T;else{const Re=Fx(T,/^[\r\n\t ]+/);pe=Re&&Re[0]}dl==="application/xhtml+xml"&&wt===Le&&(T='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+T+"</body></html>");const je=z?oe(T):T;if(wt===Le)try{K=new y().parseFromString(je,dl)}catch{}if(!K||!K.documentElement){K=Y.createDocument(wt,"template",null);try{K.documentElement.innerHTML=Sn?R:je}catch{}}const He=K.body||K.documentElement;return T&&pe&&He.insertBefore(r.createTextNode(pe),He.childNodes[0]||null),wt===Le?_e.call(K,Dt?"html":"body")[0]:Dt?K.documentElement:He},vl=function(T){return ce.call(T.ownerDocument||T,T,g.SHOW_ELEMENT|g.SHOW_COMMENT|g.SHOW_TEXT|g.SHOW_PROCESSING_INSTRUCTION|g.SHOW_CDATA_SECTION,null)},Al=function(T){return T=Xo(T,Q," "),T=Xo(T,L," "),T=Xo(T,be," "),T},nl=function(T){var K;T.normalize();const pe=ce.call(T.ownerDocument||T,T,g.SHOW_TEXT|g.SHOW_COMMENT|g.SHOW_CDATA_SECTION|g.SHOW_PROCESSING_INSTRUCTION,null);let je=pe.nextNode();for(;je;)je.data=Al(je.data),je=pe.nextNode();const He=(K=T.querySelectorAll)===null||K===void 0?void 0:K.call(T,"template");He&&bc(He,Re=>{Lt(Re.content)&&nl(Re.content)})},ll=function(T){const K=$?$(T):null;return typeof K!="string"||Ze(K)!=="form"?!1:typeof T.nodeName!="string"||typeof T.textContent!="string"||typeof T.removeChild!="function"||T.attributes!==Z(T)||typeof T.removeAttribute!="function"||typeof T.setAttribute!="function"||typeof T.namespaceURI!="string"||typeof T.insertBefore!="function"||typeof T.hasChildNodes!="function"||T.nodeType!==D(T)||T.childNodes!==A(T)},Lt=function(T){if(!D||typeof T!="object"||T===null)return!1;try{return D(T)===ns.documentFragment}catch{return!1}},On=function(T){if(!D||typeof T!="object"||T===null)return!1;try{return typeof D(T)=="number"}catch{return!1}};function zt(me,T,K){me.length!==0&&bc(me,pe=>{pe.call(s,T,K,gn)})}const _s=function(T,K){return!!(tt&&T.hasChildNodes()&&!On(T.firstElementChild)&&Zn(ab,T.textContent)&&Zn(ab,T.innerHTML)||tt&&T.namespaceURI===Le&&K==="style"&&On(T.firstElementChild)||T.nodeType===ns.processingInstruction||tt&&T.nodeType===ns.comment&&Zn(ib,T.data))},Ii=function(T,K){if(!rn[K]&&Xl(K)&&(Ge.tagNameCheck instanceof RegExp&&Zn(Ge.tagNameCheck,K)||Ge.tagNameCheck instanceof Function&&Ge.tagNameCheck(K)))return!1;if(jt&&!xe[K]){const pe=G(T),je=A(T);if(je&&pe){const He=je.length;for(let Re=He-1;Re>=0;--Re){const St=Pn?je[Re]:C(je[Re],!0);pe.insertBefore(St,E(T))}}}return Nn(T),!0},$l=function(T,K){if(zt(w.beforeSanitizeElements,T,null),T!==K&&G(T)===null)return!0;if(ll(T))return Nn(T),!0;const pe=Ze($?$(T):T.nodeName);if(zt(w.uponSanitizeElement,T,{tagName:pe,allowedTags:Ke}),T!==K&&G(T)===null)return!0;if(_s(T,pe))return Nn(T),!0;if(rn[pe]||!(st.tagCheck instanceof Function&&st.tagCheck(pe))&&!Ke[pe]){const He=Ii(T,pe);return He===!1&&zt(w.afterSanitizeElements,T,null),He}if((D?D(T):T.nodeType)===ns.element&&!Dn(T)||(pe==="noscript"||pe==="noembed"||pe==="noframes")&&Zn(A1,T.innerHTML))return Nn(T),!0;if(It&&T.nodeType===ns.text){const He=Al(T.textContent);T.textContent!==He&&(_c(s.removed,{element:T.cloneNode()}),T.textContent=He)}return zt(w.afterSanitizeElements,T,null),!1},ys=function(T,K,pe){if(jn[K]||tt&&K==="patchsrc"||tt&&K==="for"&&T!=="label"&&T!=="output"||Pt&&(K==="id"||K==="name")&&(pe in r||pe in Xt))return!1;const je=ct[K]||st.attributeCheck instanceof Function&&st.attributeCheck(K,T);if(!(Jn&&Zn(we,K))){if(!(wn&&Zn(Me,K))){if(je){if(!Ct[K]){if(!Zn(an,Xo(pe,Ue,""))){if(!((K==="src"||K==="xlink:href"||K==="href")&&T!=="script"&&Jx(pe,"data:")===0&&Fe[T])){if(!(cn&&!Zn(Oe,Xo(pe,Ue,"")))){if(pe)return!1}}}}}else if(!(Xl(T)&&(Ge.tagNameCheck instanceof RegExp&&Zn(Ge.tagNameCheck,T)||Ge.tagNameCheck instanceof Function&&Ge.tagNameCheck(T))&&(Ge.attributeNameCheck instanceof RegExp&&Zn(Ge.attributeNameCheck,K)||Ge.attributeNameCheck instanceof Function&&Ge.attributeNameCheck(K,T))||K==="is"&&Ge.allowCustomizedBuiltInElements&&(Ge.tagNameCheck instanceof RegExp&&Zn(Ge.tagNameCheck,pe)||Ge.tagNameCheck instanceof Function&&Ge.tagNameCheck(pe))))return!1}}return!0},xn=gt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Xl=function(T){return!xn[Po(T)]&&Zn(qe,T)},kn=function(T,K,pe,je){if(z&&typeof j=="object"&&typeof j.getAttributeType=="function"&&!pe)switch(j.getAttributeType(T,K)){case"TrustedHTML":return oe(je);case"TrustedScriptURL":return se(je)}return je},vs=function(T,K,pe,je){try{pe?T.setAttributeNS(pe,K,je):T.setAttribute(K,je),ll(T)?Nn(T):Zx(s.removed)}catch{At(K,T)}},is=function(T){zt(w.beforeSanitizeAttributes,T,null);const K=T.attributes;if(!K||ll(T))return;const pe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ct,forceKeepAttr:void 0};let je=K.length;const He=Ze(T.nodeName);for(;je--;){const Re=K[je],St=Re.name,ht=Re.namespaceURI,en=Re.value,pt=Ze(St),un=en;let Qt=St==="value"?un:d1(un);if(pe.attrName=pt,pe.attrValue=Qt,pe.keepAttr=!0,pe.forceKeepAttr=void 0,zt(w.uponSanitizeAttribute,T,pe),Qt=pe.attrValue,vt&&(pt==="id"||pt==="name")&&Jx(Qt,Ft)!==0&&(At(St,T),Qt=Ft+Qt),tt&&Zn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Qt)){At(St,T);continue}if(pt==="attributename"&&Fx(Qt,"href")){At(St,T);continue}if(!pe.forceKeepAttr){if(!pe.keepAttr){At(St,T);continue}if(!Wn&&Zn(M1,Qt)){At(St,T);continue}if(It&&(Qt=Al(Qt)),!ys(He,pt,Qt)){At(St,T);continue}Qt=kn(He,pt,ht,Qt),Qt!==un&&vs(T,St,ht,Qt)}}zt(w.afterSanitizeAttributes,T,null)},rs=function(T){let K=null;const pe=vl(T);for(zt(w.beforeSanitizeShadowDOM,T,null);K=pe.nextNode();)if(zt(w.uponSanitizeShadowNode,K,null),$l(K,T),is(K),Lt(K.content)&&rs(K.content),(D?D(K):K.nodeType)===ns.element){const He=V(K);Lt(He)&&(Ml(He),rs(He))}zt(w.afterSanitizeShadowDOM,T,null)},Ml=function(T){const K=[{node:T,shadow:null}];for(;K.length>0;){const pe=K.pop();if(pe.shadow){rs(pe.shadow);continue}const je=pe.node,Re=(D?D(je):je.nodeType)===ns.element,St=A(je);if(St)for(let ht=St.length-1;ht>=0;--ht)K.push({node:St[ht],shadow:null});if(Re){const ht=$?$(je):null;if(typeof ht=="string"&&Ze(ht)==="template"){const en=je.content;Lt(en)&&K.push({node:en,shadow:null})}}if(Re){const ht=V(je);Lt(ht)&&K.push({node:null,shadow:ht},{node:ht,shadow:null})}}};return s.sanitize=function(me){let T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},K=null,pe=null,je=null,He=null;if(Sn=!me,Sn&&(me="<!-->"),typeof me!="string"&&!On(me)&&(me=x1(me),typeof me!="string"))throw mr("dirty is not a string, aborting");if(!s.isSupported)return me;qn?(Ke=Et,ct=nt):Jt(T),(w.uponSanitizeElement.length>0||w.uponSanitizeAttribute.length>0)&&(Ke=El(Ke)),w.uponSanitizeAttribute.length>0&&(ct=El(ct)),s.removed=[];const Re=Pn&&typeof me!="string"&&On(me);if(Re){Gn(me);const pt=$?$(me):me.nodeName;if(typeof pt=="string"){const un=Ze(pt);if(!Ke[un]||rn[un])throw ot(me),mr("root node is forbidden and cannot be sanitized in-place")}if(ll(me))throw ot(me),mr("root node is clobbered and cannot be sanitized in-place");try{Ml(me)}catch(un){throw ot(me),un}}else if(On(me))K=tl("<!---->"),pe=K.ownerDocument.importNode(me,!0),pe.nodeType===ns.element&&pe.nodeName==="BODY"||pe.nodeName==="HTML"?K=pe:K.appendChild(pe),Ml(pe);else{if(!hn&&!It&&!Dt&&me.indexOf("<")===-1)return z&&Qn?oe(me):me;if(K=tl(me),!K)return hn?null:Qn?R:""}K&&at&&Nn(K.firstChild);const St=Re?me:K,ht=vl(St);try{for(;je=ht.nextNode();)$l(je,St),is(je),Lt(je.content)&&rs(je.content)}catch(pt){throw Re&&(ot(me),bc(s.removed,un=>{un.element&&on(un.element)})),pt}if(Re)return bc(s.removed,pt=>{pt.element&&on(pt.element)}),It&&nl(me),me;if(hn){if(It&&nl(K),mn)for(He=de.call(K.ownerDocument);K.firstChild;)He.appendChild(K.firstChild);else He=K;return(ct.shadowroot||ct.shadowrootmode)&&(He=Ce.call(c,He,!0)),He}let en=Dt?K.outerHTML:K.innerHTML;return Dt&&Ke["!doctype"]&&K.ownerDocument&&K.ownerDocument.doctype&&K.ownerDocument.doctype.name&&Zn(E1,K.ownerDocument.doctype.name)&&(en="<!DOCTYPE "+K.ownerDocument.doctype.name+`>
116
116
  `+en),It&&(en=Al(en)),z&&Qn?oe(en):en},s.setConfig=function(){let me=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Jt(me),qn=!0,Et=Ke,nt=ct},s.clearConfig=function(){gn=null,qn=!1,Et=null,nt=null,z=H,R=""},s.isValidAttribute=function(me,T,K){gn||Jt({});const pe=Ze(me),je=Ze(T);return ys(pe,je,K)},s.addHook=function(me,T){typeof T=="function"&&Fn(w,me)&&_c(w[me],T)},s.removeHook=function(me,T){if(Fn(w,me)){if(T!==void 0){const K=u1(w[me],T);return K===-1?void 0:f1(w[me],K,1)[0]}return Zx(w[me])}},s.removeHooks=function(me){Fn(w,me)&&(w[me]=[])},s.removeAllHooks=function(){w=rb()},s}var O1=R_();const L1=1024;let z1=0;class ms{constructor(s,r){this.from=s,this.to=r}}class sn{constructor(s={}){this.id=z1++,this.perNode=!!s.perNode,this.deserialize=s.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=s.combine||null}add(s){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof s!="function"&&(s=qs.match(s)),r=>{let c=s(r);return c===void 0?null:[this,c]}}}sn.closedBy=new sn({deserialize:l=>l.split(" ")});sn.openedBy=new sn({deserialize:l=>l.split(" ")});sn.group=new sn({deserialize:l=>l.split(" ")});sn.isolate=new sn({deserialize:l=>{if(l&&l!="rtl"&&l!="ltr"&&l!="auto")throw new RangeError("Invalid value for isolate: "+l);return l||"auto"}});sn.contextHash=new sn({perNode:!0});sn.lookAhead=new sn({perNode:!0});sn.mounted=new sn({perNode:!0});class Tc{constructor(s,r,c,o=!1){this.tree=s,this.overlay=r,this.parser=c,this.bracketed=o}static get(s){return s&&s.props&&s.props[sn.mounted.id]}}const U1=Object.create(null);class qs{constructor(s,r,c,o=0){this.name=s,this.props=r,this.id=c,this.flags=o}static define(s){let r=s.props&&s.props.length?Object.create(null):U1,c=(s.top?1:0)|(s.skipped?2:0)|(s.error?4:0)|(s.name==null?8:0),o=new qs(s.name||"",r,s.id,c);if(s.props){for(let d of s.props)if(Array.isArray(d)||(d=d(o)),d){if(d[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");r[d[0].id]=d[1]}}return o}prop(s){return this.props[s.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(s){if(typeof s=="string"){if(this.name==s)return!0;let r=this.prop(sn.group);return r?r.indexOf(s)>-1:!1}return this.id==s}static match(s){let r=Object.create(null);for(let c in s)for(let o of c.split(" "))r[o]=s[c];return c=>{for(let o=c.prop(sn.group),d=-1;d<(o?o.length:0);d++){let h=r[d<0?c.name:o[d]];if(h)return h}}}}qs.none=new qs("",Object.create(null),0,8);class D_{constructor(s){this.types=s;for(let r=0;r<s.length;r++)if(s[r].id!=r)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...s){let r=[];for(let c of this.types){let o=null;for(let d of s){let h=d(c);if(h){o||(o=Object.assign({},c.props));let p=h[1],g=h[0];g.combine&&g.id in o&&(p=g.combine(o[g.id],p)),o[g.id]=p}}r.push(o?new qs(c.name,o,c.id,c.flags):c)}return new D_(r)}}const wf=new WeakMap,cb=new WeakMap;var nn;(function(l){l[l.ExcludeBuffers=1]="ExcludeBuffers",l[l.IncludeAnonymous=2]="IncludeAnonymous",l[l.IgnoreMounts=4]="IgnoreMounts",l[l.IgnoreOverlays=8]="IgnoreOverlays",l[l.EnterBracketed=16]="EnterBracketed"})(nn||(nn={}));class Yl{constructor(s,r,c,o,d){if(this.type=s,this.children=r,this.positions=c,this.length=o,this.props=null,d&&d.length){this.props=Object.create(null);for(let[h,p]of d)this.props[typeof h=="number"?h:h.id]=p}}toString(){let s=Tc.get(this);if(s&&!s.overlay)return s.tree.toString();let r="";for(let c of this.children){let o=c.toString();o&&(r&&(r+=","),r+=o)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(r.length?"("+r+")":""):r}cursor(s=0){return new Kf(this.topNode,s)}cursorAt(s,r=0,c=0){let o=wf.get(this)||this.topNode,d=new Kf(o);return d.moveTo(s,r),wf.set(this,d._tree),d}get topNode(){return new bl(this,0,0,null)}resolve(s,r=0){let c=nu(wf.get(this)||this.topNode,s,r,!1);return wf.set(this,c),c}resolveInner(s,r=0){let c=nu(cb.get(this)||this.topNode,s,r,!0);return cb.set(this,c),c}resolveStack(s,r=0){return I1(this,s,r)}iterate(s){let{enter:r,leave:c,from:o=0,to:d=this.length}=s,h=s.mode||0,p=(h&nn.IncludeAnonymous)>0;for(let g=this.cursor(h|nn.IncludeAnonymous);;){let x=!1;if(g.from<=d&&g.to>=o&&(!p&&g.type.isAnonymous||r(g)!==!1)){if(g.firstChild())continue;x=!0}for(;x&&c&&(p||!g.type.isAnonymous)&&c(g),!g.nextSibling();){if(!g.parent())return;x=!0}}}prop(s){return s.perNode?this.props?this.props[s.id]:void 0:this.type.prop(s)}get propValues(){let s=[];if(this.props)for(let r in this.props)s.push([+r,this.props[r]]);return s}balance(s={}){return this.children.length<=8?this:Dp(qs.none,this.children,this.positions,0,this.children.length,0,this.length,(r,c,o)=>new Yl(this.type,r,c,o,this.propValues),s.makeTree||((r,c,o)=>new Yl(qs.none,r,c,o)))}static build(s){return q1(s)}}Yl.empty=new Yl(qs.none,[],[],0);class Mp{constructor(s,r){this.buffer=s,this.index=r}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 Mp(this.buffer,this.index)}}class Bi{constructor(s,r,c){this.buffer=s,this.length=r,this.set=c}get type(){return qs.none}toString(){let s=[];for(let r=0;r<this.buffer.length;)s.push(this.childString(r)),r=this.buffer[r+3];return s.join(",")}childString(s){let r=this.buffer[s],c=this.buffer[s+3],o=this.set.types[r],d=o.name;if(/\W/.test(d)&&!o.isError&&(d=JSON.stringify(d)),s+=4,c==s)return d;let h=[];for(;s<c;)h.push(this.childString(s)),s=this.buffer[s+3];return d+"("+h.join(",")+")"}findChild(s,r,c,o,d){let{buffer:h}=this,p=-1;for(let g=s;g!=r&&!(O_(d,o,h[g+1],h[g+2])&&(p=g,c>0));g=h[g+3]);return p}slice(s,r,c){let o=this.buffer,d=new Uint16Array(r-s),h=0;for(let p=s,g=0;p<r;){d[g++]=o[p++],d[g++]=o[p++]-c;let x=d[g++]=o[p++]-c;d[g++]=o[p++]-s,h=Math.max(h,x)}return new Bi(d,h,this.set)}}function O_(l,s,r,c){switch(l){case-2:return r<s;case-1:return c>=s&&r<s;case 0:return r<s&&c>s;case 1:return r<=s&&c>s;case 2:return c>s;case 4:return!0}}function nu(l,s,r,c){for(var o;l.from==l.to||(r<1?l.from>=s:l.from>s)||(r>-1?l.to<=s:l.to<s);){let h=!c&&l instanceof bl&&l.index<0?null:l.parent;if(!h)return l;l=h}let d=c?0:nn.IgnoreOverlays;if(c)for(let h=l,p=h.parent;p;h=p,p=h.parent)h instanceof bl&&h.index<0&&((o=p.enter(s,r,d))===null||o===void 0?void 0:o.from)!=h.from&&(l=p);for(;;){let h=l.enter(s,r,d);if(!h)return l;l=h}}class L_{cursor(s=0){return new Kf(this,s)}getChild(s,r=null,c=null){let o=ob(this,s,r,c);return o.length?o[0]:null}getChildren(s,r=null,c=null){return ob(this,s,r,c)}resolve(s,r=0){return nu(this,s,r,!1)}resolveInner(s,r=0){return nu(this,s,r,!0)}matchContext(s){return pp(this.parent,s)}enterUnfinishedNodesBefore(s){let r=this.childBefore(s),c=this;for(;r;){let o=r.lastChild;if(!o||o.to!=r.to)break;o.type.isError&&o.from==o.to?(c=r,r=o.prevSibling):r=o}return c}get node(){return this}get next(){return this.parent}}class bl extends L_{constructor(s,r,c,o){super(),this._tree=s,this.from=r,this.index=c,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(s,r,c,o,d=0){for(let h=this;;){for(let{children:p,positions:g}=h._tree,x=r>0?p.length:-1;s!=x;s+=r){let y=p[s],j=g[s]+h.from,v;if(!(!(d&nn.EnterBracketed&&y instanceof Yl&&(v=Tc.get(y))&&!v.overlay&&v.bracketed&&c>=j&&c<=j+y.length)&&!O_(o,c,j,j+y.length))){if(y instanceof Bi){if(d&nn.ExcludeBuffers)continue;let C=y.findChild(0,y.buffer.length,r,c-j,o);if(C>-1)return new da(new H1(h,y,s,j),null,C)}else if(d&nn.IncludeAnonymous||!y.type.isAnonymous||Rp(y)){let C;if(!(d&nn.IgnoreMounts)&&(C=Tc.get(y))&&!C.overlay)return new bl(C.tree,j,s,h);let k=new bl(y,j,s,h);return d&nn.IncludeAnonymous||!k.type.isAnonymous?k:k.nextChild(r<0?y.children.length-1:0,r,c,o,d)}}}if(d&nn.IncludeAnonymous||!h.type.isAnonymous||(h.index>=0?s=h.index+r:s=r<0?-1:h._parent._tree.children.length,h=h._parent,!h))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(s){return this.nextChild(0,1,s,2)}childBefore(s){return this.nextChild(this._tree.children.length-1,-1,s,-2)}prop(s){return this._tree.prop(s)}enter(s,r,c=0){let o;if(!(c&nn.IgnoreOverlays)&&(o=Tc.get(this._tree))&&o.overlay){let d=s-this.from,h=c&nn.EnterBracketed&&o.bracketed;for(let{from:p,to:g}of o.overlay)if((r>0||h?p<=d:p<d)&&(r<0||h?g>=d:g>d))return new bl(o.tree,o.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,s,r,c)}nextSignificantParent(){let s=this;for(;s.type.isAnonymous&&s._parent;)s=s._parent;return s}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 ob(l,s,r,c){let o=l.cursor(),d=[];if(!o.firstChild())return d;if(r!=null){for(let h=!1;!h;)if(h=o.type.is(r),!o.nextSibling())return d}for(;;){if(c!=null&&o.type.is(c))return d;if(o.type.is(s)&&d.push(o.node),!o.nextSibling())return c==null?d:[]}}function pp(l,s,r=s.length-1){for(let c=l;r>=0;c=c.parent){if(!c)return!1;if(!c.type.isAnonymous){if(s[r]&&s[r]!=c.name)return!1;r--}}return!0}class H1{constructor(s,r,c,o){this.parent=s,this.buffer=r,this.index=c,this.start=o}}class da extends L_{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(s,r,c){super(),this.context=s,this._parent=r,this.index=c,this.type=s.buffer.set.types[s.buffer.buffer[c]]}child(s,r,c){let{buffer:o}=this.context,d=o.findChild(this.index+4,o.buffer[this.index+3],s,r-this.context.start,c);return d<0?null:new da(this.context,this,d)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(s){return this.child(1,s,2)}childBefore(s){return this.child(-1,s,-2)}prop(s){return this.type.prop(s)}enter(s,r,c=0){if(c&nn.ExcludeBuffers)return null;let{buffer:o}=this.context,d=o.findChild(this.index+4,o.buffer[this.index+3],r>0?1:-1,s-this.context.start,r);return d<0?null:new da(this.context,this,d)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(s){return this._parent?null:this.context.parent.nextChild(this.context.index+s,s,0,4)}get nextSibling(){let{buffer:s}=this.context,r=s.buffer[this.index+3];return r<(this._parent?s.buffer[this._parent.index+3]:s.buffer.length)?new da(this.context,this._parent,r):this.externalSibling(1)}get prevSibling(){let{buffer:s}=this.context,r=this._parent?this._parent.index+4:0;return this.index==r?this.externalSibling(-1):new da(this.context,this._parent,s.findChild(r,this.index,-1,0,4))}get tree(){return null}toTree(){let s=[],r=[],{buffer:c}=this.context,o=this.index+4,d=c.buffer[this.index+3];if(d>o){let h=c.buffer[this.index+1];s.push(c.slice(o,d,h)),r.push(0)}return new Yl(this.type,s,r,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function z_(l){if(!l.length)return null;let s=0,r=l[0];for(let d=1;d<l.length;d++){let h=l[d];(h.from>r.from||h.to<r.to)&&(r=h,s=d)}let c=r instanceof bl&&r.index<0?null:r.parent,o=l.slice();return c?o[s]=c:o.splice(s,1),new B1(o,r)}class B1{constructor(s,r){this.heads=s,this.node=r}get next(){return z_(this.heads)}}function I1(l,s,r){let c=l.resolveInner(s,r),o=null;for(let d=c instanceof bl?c:c.context.parent;d;d=d.parent)if(d.index<0){let h=d.parent;(o||(o=[c])).push(h.resolve(s,r)),d=h}else{let h=Tc.get(d.tree);if(h&&h.overlay&&h.overlay[0].from<=s&&h.overlay[h.overlay.length-1].to>=s){let p=new bl(h.tree,h.overlay[0].from+d.from,-1,d);(o||(o=[c])).push(nu(p,s,r,!1))}}return o?z_(o):c}class Kf{get name(){return this.type.name}constructor(s,r=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=r&~nn.EnterBracketed,s instanceof bl)this.yieldNode(s);else{this._tree=s.context.parent,this.buffer=s.context;for(let c=s._parent;c;c=c._parent)this.stack.unshift(c.index);this.bufferNode=s,this.yieldBuf(s.index)}}yieldNode(s){return s?(this._tree=s,this.type=s.type,this.from=s.from,this.to=s.to,!0):!1}yieldBuf(s,r){this.index=s;let{start:c,buffer:o}=this.buffer;return this.type=r||o.set.types[o.buffer[s]],this.from=c+o.buffer[s+1],this.to=c+o.buffer[s+2],!0}yield(s){return s?s instanceof bl?(this.buffer=null,this.yieldNode(s)):(this.buffer=s.context,this.yieldBuf(s.index,s.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(s,r,c){if(!this.buffer)return this.yield(this._tree.nextChild(s<0?this._tree._tree.children.length-1:0,s,r,c,this.mode));let{buffer:o}=this.buffer,d=o.findChild(this.index+4,o.buffer[this.index+3],s,r-this.buffer.start,c);return d<0?!1:(this.stack.push(this.index),this.yieldBuf(d))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(s){return this.enterChild(1,s,2)}childBefore(s){return this.enterChild(-1,s,-2)}enter(s,r,c=this.mode){return this.buffer?c&nn.ExcludeBuffers?!1:this.enterChild(1,s,r):this.yield(this._tree.enter(s,r,c))}parent(){if(!this.buffer)return this.yieldNode(this.mode&nn.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let s=this.mode&nn.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(s)}sibling(s){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+s,s,0,4,this.mode)):!1;let{buffer:r}=this.buffer,c=this.stack.length-1;if(s<0){let o=c<0?0:this.stack[c]+4;if(this.index!=o)return this.yieldBuf(r.findChild(o,this.index,-1,0,4))}else{let o=r.buffer[this.index+3];if(o<(c<0?r.buffer.length:r.buffer[this.stack[c]+3]))return this.yieldBuf(o)}return c<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+s,s,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(s){let r,c,{buffer:o}=this;if(o){if(s>0){if(this.index<o.buffer.buffer.length)return!1}else for(let d=0;d<this.index;d++)if(o.buffer.buffer[d+3]<this.index)return!1;({index:r,parent:c}=o)}else({index:r,_parent:c}=this._tree);for(;c;{index:r,_parent:c}=c)if(r>-1)for(let d=r+s,h=s<0?-1:c._tree.children.length;d!=h;d+=s){let p=c._tree.children[d];if(this.mode&nn.IncludeAnonymous||p instanceof Bi||!p.type.isAnonymous||Rp(p))return!1}return!0}move(s,r){if(r&&this.enterChild(s,0,4))return!0;for(;;){if(this.sibling(s))return!0;if(this.atLastNode(s)||!this.parent())return!1}}next(s=!0){return this.move(1,s)}prev(s=!0){return this.move(-1,s)}moveTo(s,r=0){for(;(this.from==this.to||(r<1?this.from>=s:this.from>s)||(r>-1?this.to<=s:this.to<s))&&this.parent(););for(;this.enterChild(1,s,r););return this}get node(){if(!this.buffer)return this._tree;let s=this.bufferNode,r=null,c=0;if(s&&s.context==this.buffer)e:for(let o=this.index,d=this.stack.length;d>=0;){for(let h=s;h;h=h._parent)if(h.index==o){if(o==this.index)return h;r=h,c=d+1;break e}o=this.stack[--d]}for(let o=c;o<this.stack.length;o++)r=new da(this.buffer,r,this.stack[o]);return this.bufferNode=new da(this.buffer,r,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(s,r){for(let c=0;;){let o=!1;if(this.type.isAnonymous||s(this)!==!1){if(this.firstChild()){c++;continue}this.type.isAnonymous||(o=!0)}for(;;){if(o&&r&&r(this),o=this.type.isAnonymous,!c)return;if(this.nextSibling())break;this.parent(),c--,o=!0}}}matchContext(s){if(!this.buffer)return pp(this.node.parent,s);let{buffer:r}=this.buffer,{types:c}=r.set;for(let o=s.length-1,d=this.stack.length-1;o>=0;d--){if(d<0)return pp(this._tree,s,o);let h=c[r.buffer[this.stack[d]]];if(!h.isAnonymous){if(s[o]&&s[o]!=h.name)return!1;o--}}return!0}}function Rp(l){return l.children.some(s=>s instanceof Bi||!s.type.isAnonymous||Rp(s))}function q1(l){var s;let{buffer:r,nodeSet:c,maxBufferLength:o=L1,reused:d=[],minRepeatType:h=c.types.length}=l,p=Array.isArray(r)?new Mp(r,r.length):r,g=c.types,x=0,y=0;function j($,z,R,H,B,le){let{id:W,start:oe,end:se,size:ge}=p,ye=y,Y=x;if(ge<0)if(p.next(),ge==-1){let w=d[W];R.push(w),H.push(oe-$);return}else if(ge==-3){x=W;return}else if(ge==-4){y=W;return}else throw new RangeError(`Unrecognized record size: ${ge}`);let ce=g[W],de,_e,Ce=oe-$;if(se-oe<=o&&(_e=A(p.pos-z,B))){let w=new Uint16Array(_e.size-_e.skip),Q=p.pos-_e.size,L=w.length;for(;p.pos>Q;)L=G(_e.start,w,L);de=new Bi(w,se-_e.start,c),Ce=_e.start-$}else{let w=p.pos-ge;p.next();let Q=[],L=[],be=W>=h?W:-1,we=0,Me=se;for(;p.pos>w;)be>=0&&p.id==be&&p.size>=0?(p.end<=Me-o&&(k(Q,L,oe,we,p.end,Me,be,ye,Y),we=Q.length,Me=p.end),p.next()):le>2500?v(oe,w,Q,L):j(oe,w,Q,L,be,le+1);if(be>=0&&we>0&&we<Q.length&&k(Q,L,oe,we,oe,Me,be,ye,Y),Q.reverse(),L.reverse(),be>-1&&we>0){let Oe=C(ce,Y);de=Dp(ce,Q,L,0,Q.length,0,se-oe,Oe,Oe)}else de=E(ce,Q,L,se-oe,ye-se,Y)}R.push(de),H.push(Ce)}function v($,z,R,H){let B=[],le=0,W=-1;for(;p.pos>z;){let{id:oe,start:se,end:ge,size:ye}=p;if(ye>4)p.next();else{if(W>-1&&se<W)break;W<0&&(W=ge-o),B.push(oe,se,ge),le++,p.next()}}if(le){let oe=new Uint16Array(le*4),se=B[B.length-2];for(let ge=B.length-3,ye=0;ge>=0;ge-=3)oe[ye++]=B[ge],oe[ye++]=B[ge+1]-se,oe[ye++]=B[ge+2]-se,oe[ye++]=ye;R.push(new Bi(oe,B[2]-se,c)),H.push(se-$)}}function C($,z){return(R,H,B)=>{let le=0,W=R.length-1,oe,se;if(W>=0&&(oe=R[W])instanceof Yl){if(!W&&oe.type==$&&oe.length==B)return oe;(se=oe.prop(sn.lookAhead))&&(le=H[W]+oe.length+se)}return E($,R,H,B,le,z)}}function k($,z,R,H,B,le,W,oe,se){let ge=[],ye=[];for(;$.length>H;)ge.push($.pop()),ye.push(z.pop()+R-B);$.push(E(c.types[W],ge,ye,le-B,oe-le,se)),z.push(B-R)}function E($,z,R,H,B,le,W){if(le){let oe=[sn.contextHash,le];W=W?[oe].concat(W):[oe]}if(B>25){let oe=[sn.lookAhead,B];W=W?[oe].concat(W):[oe]}return new Yl($,z,R,H,W)}function A($,z){let R=p.fork(),H=0,B=0,le=0,W=R.end-o,oe={size:0,start:0,skip:0};e:for(let se=R.pos-$;R.pos>se;){let ge=R.size;if(R.id==z&&ge>=0){oe.size=H,oe.start=B,oe.skip=le,le+=4,H+=4,R.next();continue}let ye=R.pos-ge;if(ge<0||ye<se||R.start<W)break;let Y=R.id>=h?4:0,ce=R.start;for(R.next();R.pos>ye;){if(R.size<0)if(R.size==-3||R.size==-4)Y+=4;else break e;else R.id>=h&&(Y+=4);R.next()}B=ce,H+=ge,le+=Y}return(z<0||H==$)&&(oe.size=H,oe.start=B,oe.skip=le),oe.size>4?oe:void 0}function G($,z,R){let{id:H,start:B,end:le,size:W}=p;if(p.next(),W>=0&&H<h){let oe=R;if(W>4){let se=p.pos-(W-4);for(;p.pos>se;)R=G($,z,R)}z[--R]=oe,z[--R]=le-$,z[--R]=B-$,z[--R]=H}else W==-3?x=H:W==-4&&(y=H);return R}let V=[],Z=[];for(;p.pos>0;)j(l.start||0,l.bufferStart||0,V,Z,-1,0);let D=(s=l.length)!==null&&s!==void 0?s:V.length?Z[0]+V[0].length:0;return new Yl(g[l.topID],V.reverse(),Z.reverse(),D)}const ub=new WeakMap;function Yf(l,s){if(!l.isAnonymous||s instanceof Bi||s.type!=l)return 1;let r=ub.get(s);if(r==null){r=1;for(let c of s.children){if(c.type!=l||!(c instanceof Yl)){r=1;break}r+=Yf(l,c)}ub.set(s,r)}return r}function Dp(l,s,r,c,o,d,h,p,g){let x=0;for(let k=c;k<o;k++)x+=Yf(l,s[k]);let y=Math.ceil(x*1.5/8),j=[],v=[];function C(k,E,A,G,V){for(let Z=A;Z<G;){let D=Z,$=E[Z],z=Yf(l,k[Z]);for(Z++;Z<G;Z++){let R=Yf(l,k[Z]);if(z+R>=y)break;z+=R}if(Z==D+1){if(z>y){let R=k[D];C(R.children,R.positions,0,R.children.length,E[D]+V);continue}j.push(k[D])}else{let R=E[Z-1]+k[Z-1].length-$;j.push(Dp(l,k,E,D,Z,$,R,null,g))}v.push($+V-d)}}return C(s,r,c,o,0),(p||g)(j,v,h)}class Vk{constructor(){this.map=new WeakMap}setBuffer(s,r,c){let o=this.map.get(s);o||this.map.set(s,o=new Map),o.set(r,c)}getBuffer(s,r){let c=this.map.get(s);return c&&c.get(r)}set(s,r){s instanceof da?this.setBuffer(s.context.buffer,s.index,r):s instanceof bl&&this.map.set(s.tree,r)}get(s){return s instanceof da?this.getBuffer(s.context.buffer,s.index):s instanceof bl?this.map.get(s.tree):void 0}cursorSet(s,r){s.buffer?this.setBuffer(s.buffer.buffer,s.index,r):this.map.set(s.tree,r)}cursorGet(s){return s.buffer?this.getBuffer(s.buffer.buffer,s.index):this.map.get(s.tree)}}class lu{constructor(s,r,c,o,d=!1,h=!1){this.from=s,this.to=r,this.tree=c,this.offset=o,this.open=(d?1:0)|(h?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(s,r=[],c=!1){let o=[new lu(0,s.length,s,0,!1,c)];for(let d of r)d.to>s.length&&o.push(d);return o}static applyChanges(s,r,c=128){if(!r.length)return s;let o=[],d=1,h=s.length?s[0]:null;for(let p=0,g=0,x=0;;p++){let y=p<r.length?r[p]:null,j=y?y.fromA:1e9;if(j-g>=c)for(;h&&h.from<j;){let v=h;if(g>=v.from||j<=v.to||x){let C=Math.max(v.from,g)-x,k=Math.min(v.to,j)-x;v=C>=k?null:new lu(C,k,v.tree,v.offset+x,p>0,!!y)}if(v&&o.push(v),h.to>j)break;h=d<s.length?s[d++]:null}if(!y)break;g=y.toA,x=y.toA-y.toB}return o}}class Qk{startParse(s,r,c){return typeof s=="string"&&(s=new G1(s)),c=c?c.length?c.map(o=>new ms(o.from,o.to)):[new ms(0,0)]:[new ms(0,s.length)],this.createParse(s,r||[],c)}parse(s,r,c){let o=this.startParse(s,r,c);for(;;){let d=o.advance();if(d)return d}}}class G1{constructor(s){this.string=s}get length(){return this.string.length}chunk(s){return this.string.slice(s)}get lineChunks(){return!1}read(s,r){return this.string.slice(s,r)}}function Kk(l){return(s,r,c,o)=>new $1(s,l,r,c,o)}class fb{constructor(s,r,c,o,d,h){this.parser=s,this.parse=r,this.overlay=c,this.bracketed=o,this.target=d,this.from=h}}function db(l){if(!l.length||l.some(s=>s.from>=s.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(l))}class Y1{constructor(s,r,c,o,d,h,p,g){this.parser=s,this.predicate=r,this.mounts=c,this.index=o,this.start=d,this.bracketed=h,this.target=p,this.prev=g,this.depth=0,this.ranges=[]}}const mp=new sn({perNode:!0});class $1{constructor(s,r,c,o,d){this.nest=r,this.input=c,this.fragments=o,this.ranges=d,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=s}advance(){if(this.baseParse){let c=this.baseParse.advance();if(!c)return null;if(this.baseParse=null,this.baseTree=c,this.startInner(),this.stoppedAt!=null)for(let o of this.inner)o.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let c=this.baseTree;return this.stoppedAt!=null&&(c=new Yl(c.type,c.children,c.positions,c.length,c.propValues.concat([[mp,this.stoppedAt]]))),c}let s=this.inner[this.innerDone],r=s.parse.advance();if(r){this.innerDone++;let c=Object.assign(Object.create(null),s.target.props);c[sn.mounted.id]=new Tc(r,s.overlay,s.parser,s.bracketed),s.target.props=c}return null}get parsedPos(){if(this.baseParse)return 0;let s=this.input.length;for(let r=this.innerDone;r<this.inner.length;r++)this.inner[r].from<s&&(s=Math.min(s,this.inner[r].parse.parsedPos));return s}stopAt(s){if(this.stoppedAt=s,this.baseParse)this.baseParse.stopAt(s);else for(let r=this.innerDone;r<this.inner.length;r++)this.inner[r].parse.stopAt(s)}startInner(){let s=new Q1(this.fragments),r=null,c=null,o=new Kf(new bl(this.baseTree,this.ranges[0].from,0,null),nn.IncludeAnonymous|nn.IgnoreMounts);e:for(let d,h;;){let p=!0,g;if(this.stoppedAt!=null&&o.from>=this.stoppedAt)p=!1;else if(s.hasNode(o)){if(r){let x=r.mounts.find(y=>y.frag.from<=o.from&&y.frag.to>=o.to&&y.mount.overlay);if(x)for(let y of x.mount.overlay){let j=y.from+x.pos,v=y.to+x.pos;j>=o.from&&v<=o.to&&!r.ranges.some(C=>C.from<v&&C.to>j)&&r.ranges.push({from:j,to:v})}}p=!1}else if(c&&(h=X1(c.ranges,o.from,o.to)))p=h!=2;else if(!o.type.isAnonymous&&(d=this.nest(o,this.input))&&(o.from<o.to||!d.overlay)){o.tree||(V1(o),r&&r.depth++,c&&c.depth++);let x=s.findMounts(o.from,d.parser);if(typeof d.overlay=="function")r=new Y1(d.parser,d.overlay,x,this.inner.length,o.from,!!d.bracketed,o.tree,r);else{let y=mb(this.ranges,d.overlay||(o.from<o.to?[new ms(o.from,o.to)]:[]));y.length&&db(y),(y.length||!d.overlay)&&this.inner.push(new fb(d.parser,y.length?d.parser.startParse(this.input,gb(x,y),y):d.parser.startParse(""),d.overlay?d.overlay.map(j=>new ms(j.from-o.from,j.to-o.from)):null,!!d.bracketed,o.tree,y.length?y[0].from:o.from)),d.overlay?y.length&&(c={ranges:y,depth:0,prev:c}):p=!1}}else if(r&&(g=r.predicate(o))&&(g===!0&&(g=new ms(o.from,o.to)),g.from<g.to)){let x=r.ranges.length-1;x>=0&&r.ranges[x].to==g.from?r.ranges[x]={from:r.ranges[x].from,to:g.to}:r.ranges.push(g)}if(p&&o.firstChild())r&&r.depth++,c&&c.depth++;else for(;!o.nextSibling();){if(!o.parent())break e;if(r&&!--r.depth){let x=mb(this.ranges,r.ranges);x.length&&(db(x),this.inner.splice(r.index,0,new fb(r.parser,r.parser.startParse(this.input,gb(r.mounts,x),x),r.ranges.map(y=>new ms(y.from-r.start,y.to-r.start)),r.bracketed,r.target,x[0].from))),r=r.prev}c&&!--c.depth&&(c=c.prev)}}}}function X1(l,s,r){for(let c of l){if(c.from>=r)break;if(c.to>s)return c.from<=s&&c.to>=r?2:1}return 0}function hb(l,s,r,c,o,d){if(s<r){let h=l.buffer[s+1];c.push(l.slice(s,r,h)),o.push(h-d)}}function V1(l){let{node:s}=l,r=[],c=s.context.buffer;do r.push(l.index),l.parent();while(!l.tree);let o=l.tree,d=o.children.indexOf(c),h=o.children[d],p=h.buffer,g=[d];function x(y,j,v,C,k,E){let A=r[E],G=[],V=[];hb(h,y,A,G,V,C);let Z=p[A+1],D=p[A+2];g.push(G.length);let $=E?x(A+4,p[A+3],h.set.types[p[A]],Z,D-Z,E-1):s.toTree();return G.push($),V.push(Z-C),hb(h,p[A+3],j,G,V,C),new Yl(v,G,V,k)}o.children[d]=x(0,p.length,qs.none,0,h.length,r.length-1);for(let y of g){let j=l.tree.children[y],v=l.tree.positions[y];l.yield(new bl(j,v+l.from,y,l._tree))}}class pb{constructor(s,r){this.offset=r,this.done=!1,this.cursor=s.cursor(nn.IncludeAnonymous|nn.IgnoreMounts)}moveTo(s){let{cursor:r}=this,c=s-this.offset;for(;!this.done&&r.from<c;)if(!(r.to>=s&&r.enter(c,1,nn.IgnoreOverlays|nn.ExcludeBuffers)))if(r.to<=s)r.next(!1)||(this.done=!0);else break}hasNode(s){if(this.moveTo(s.from),!this.done&&this.cursor.from+this.offset==s.from&&this.cursor.tree)for(let r=this.cursor.tree;;){if(r==s.tree)return!0;if(r.children.length&&r.positions[0]==0&&r.children[0]instanceof Yl)r=r.children[0];else break}return!1}}class Q1{constructor(s){var r;if(this.fragments=s,this.curTo=0,this.fragI=0,s.length){let c=this.curFrag=s[0];this.curTo=(r=c.tree.prop(mp))!==null&&r!==void 0?r:c.to,this.inner=new pb(c.tree,-c.offset)}else this.curFrag=this.inner=null}hasNode(s){for(;this.curFrag&&s.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=s.from&&this.curTo>=s.to&&this.inner.hasNode(s)}nextFrag(){var s;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let r=this.curFrag=this.fragments[this.fragI];this.curTo=(s=r.tree.prop(mp))!==null&&s!==void 0?s:r.to,this.inner=new pb(r.tree,-r.offset)}}findMounts(s,r){var c;let o=[];if(this.inner){this.inner.cursor.moveTo(s,1);for(let d=this.inner.cursor.node;d;d=d.parent){let h=(c=d.tree)===null||c===void 0?void 0:c.prop(sn.mounted);if(h&&h.parser==r)for(let p=this.fragI;p<this.fragments.length;p++){let g=this.fragments[p];if(g.from>=d.to)break;g.tree==this.curFrag.tree&&o.push({frag:g,pos:d.from-g.offset,mount:h})}}}return o}}function mb(l,s){let r=null,c=s;for(let o=1,d=0;o<l.length;o++){let h=l[o-1].to,p=l[o].from;for(;d<c.length;d++){let g=c[d];if(g.from>=p)break;g.to<=h||(r||(c=r=s.slice()),g.from<h?(r[d]=new ms(g.from,h),g.to>p&&r.splice(d+1,0,new ms(p,g.to))):g.to>p?r[d--]=new ms(p,g.to):r.splice(d--,1))}}return c}function K1(l,s,r,c){let o=0,d=0,h=!1,p=!1,g=-1e9,x=[];for(;;){let y=o==l.length?1e9:h?l[o].to:l[o].from,j=d==s.length?1e9:p?s[d].to:s[d].from;if(h!=p){let v=Math.max(g,r),C=Math.min(y,j,c);v<C&&x.push(new ms(v,C))}if(g=Math.min(y,j),g==1e9)break;y==g&&(h?(h=!1,o++):h=!0),j==g&&(p?(p=!1,d++):p=!0)}return x}function gb(l,s){let r=[];for(let{pos:c,mount:o,frag:d}of l){let h=c+(o.overlay?o.overlay[0].from:0),p=h+o.tree.length,g=Math.max(d.from,h),x=Math.min(d.to,p);if(o.overlay){let y=o.overlay.map(v=>new ms(v.from+c,v.to+c)),j=K1(s,y,g,x);for(let v=0,C=g;;v++){let k=v==j.length,E=k?x:j[v].from;if(E>C&&r.push(new lu(C,E,o.tree,-h,d.from>=C||d.openStart,d.to<=E||d.openEnd)),k)break;C=j[v].to}}else r.push(new lu(g,x,o.tree,-h,d.from>=h||d.openStart,d.to<=p||d.openEnd))}return r}let Z1=0;class ps{constructor(s,r,c,o){this.name=s,this.set=r,this.base=c,this.modified=o,this.id=Z1++}toString(){let{name:s}=this;for(let r of this.modified)r.name&&(s=`${r.name}(${s})`);return s}static define(s,r){let c=typeof s=="string"?s:"?";if(s instanceof ps&&(r=s),r!=null&&r.base)throw new Error("Can not derive from a modified tag");let o=new ps(c,[],null,[]);if(o.set.push(o),r)for(let d of r.set)o.set.push(d);return o}static defineModifier(s){let r=new Zf(s);return c=>c.modified.indexOf(r)>-1?c:Zf.get(c.base||c,c.modified.concat(r).sort((o,d)=>o.id-d.id))}}let F1=0;class Zf{constructor(s){this.name=s,this.instances=[],this.id=F1++}static get(s,r){if(!r.length)return s;let c=r[0].instances.find(p=>p.base==s&&J1(r,p.modified));if(c)return c;let o=[],d=new ps(s.name,o,s,r);for(let p of r)p.instances.push(d);let h=W1(r);for(let p of s.set)if(!p.modified.length)for(let g of h)o.push(Zf.get(p,g));return d}}function J1(l,s){return l.length==s.length&&l.every((r,c)=>r==s[c])}function W1(l){let s=[[]];for(let r=0;r<l.length;r++)for(let c=0,o=s.length;c<o;c++)s.push(s[c].concat(l[r]));return s.sort((r,c)=>c.length-r.length)}function Zk(l){let s=Object.create(null);for(let r in l){let c=l[r];Array.isArray(c)||(c=[c]);for(let o of r.split(" "))if(o){let d=[],h=2,p=o;for(let j=0;;){if(p=="..."&&j>0&&j+3==o.length){h=1;break}let v=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(p);if(!v)throw new RangeError("Invalid path: "+o);if(d.push(v[0]=="*"?"":v[0][0]=='"'?JSON.parse(v[0]):v[0]),j+=v[0].length,j==o.length)break;let C=o[j++];if(j==o.length&&C=="!"){h=0;break}if(C!="/")throw new RangeError("Invalid path: "+o);p=o.slice(j)}let g=d.length-1,x=d[g];if(!x)throw new RangeError("Invalid path: "+o);let y=new su(c,h,g>0?d.slice(0,g):null);s[x]=y.sort(s[x])}}return U_.add(s)}const U_=new sn({combine(l,s){let r,c,o;for(;l||s;){if(!l||s&&l.depth>=s.depth?(o=s,s=s.next):(o=l,l=l.next),r&&r.mode==o.mode&&!o.context&&!r.context)continue;let d=new su(o.tags,o.mode,o.context);r?r.next=d:c=d,r=d}return c}});class su{constructor(s,r,c,o){this.tags=s,this.mode=r,this.context=c,this.next=o}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(s){return!s||s.depth<this.depth?(this.next=s,this):(s.next=this.sort(s.next),s)}get depth(){return this.context?this.context.length:0}}su.empty=new su([],2,null);function H_(l,s){let r=Object.create(null);for(let d of l)if(!Array.isArray(d.tag))r[d.tag.id]=d.class;else for(let h of d.tag)r[h.id]=d.class;let{scope:c,all:o=null}=s||{};return{style:d=>{let h=o;for(let p of d)for(let g of p.set){let x=r[g.id];if(x){h=h?h+" "+x:x;break}}return h},scope:c}}function P1(l,s){let r=null;for(let c of l){let o=c.style(s);o&&(r=r?r+" "+o:o)}return r}function ej(l,s,r,c=0,o=l.length){let d=new nj(c,Array.isArray(s)?s:[s],r);d.highlightRange(l.cursor(),c,o,"",d.highlighters),d.flush(o)}function tj(l,s,r,c,o,d=0,h=l.length){let p=d;function g(x,y){if(!(x<=p)){for(let j=l.slice(p,x),v=0;;){let C=j.indexOf(`
117
- `,v),k=C<0?j.length:C;if(k>v&&c(j.slice(v,k),y),C<0)break;o(),v=C+1}p=x}}ej(s,r,(x,y,j)=>{g(x,""),g(y,j)},d,h),g(h,"")}class nj{constructor(s,r,c){this.at=s,this.highlighters=r,this.span=c,this.class=""}startSpan(s,r){r!=this.class&&(this.flush(s),s>this.at&&(this.at=s),this.class=r)}flush(s){s>this.at&&this.class&&this.span(this.at,s,this.class)}highlightRange(s,r,c,o,d){let{type:h,from:p,to:g}=s;if(p>=c||g<=r)return;h.isTop&&(d=this.highlighters.filter(C=>!C.scope||C.scope(h)));let x=o,y=lj(s)||su.empty,j=P1(d,y.tags);if(j&&(x&&(x+=" "),x+=j,y.mode==1&&(o+=(o?" ":"")+j)),this.startSpan(Math.max(r,p),x),y.opaque)return;let v=s.tree&&s.tree.prop(sn.mounted);if(v&&v.overlay){let C=s.node.enter(v.overlay[0].from+p,1),k=this.highlighters.filter(A=>!A.scope||A.scope(v.tree.type)),E=s.firstChild();for(let A=0,G=p;;A++){let V=A<v.overlay.length?v.overlay[A]:null,Z=V?V.from+p:g,D=Math.max(r,G),$=Math.min(c,Z);if(D<$&&E)for(;s.from<$&&(this.highlightRange(s,D,$,o,d),this.startSpan(Math.min($,s.to),x),!(s.to>=Z||!s.nextSibling())););if(!V||Z>c)break;G=V.to+p,G>r&&(this.highlightRange(C.cursor(),Math.max(r,V.from+p),Math.min(c,G),"",k),this.startSpan(Math.min(c,G),x))}E&&s.parent()}else if(s.firstChild()){v&&(o="");do if(!(s.to<=r)){if(s.from>=c)break;this.highlightRange(s,r,c,o,d),this.startSpan(Math.min(c,s.to),x)}while(s.nextSibling());s.parent()}}}function lj(l){let s=l.type.prop(U_);for(;s&&s.context&&!l.matchContext(s.context);)s=s.next;return s||null}const Se=ps.define,Sf=Se(),Di=Se(),xb=Se(Di),bb=Se(Di),Oi=Se(),Nf=Se(Oi),Kh=Se(Oi),ca=Se(),gr=Se(ca),la=Se(),sa=Se(),gp=Se(),Qo=Se(gp),kf=Se(),Ee={comment:Sf,lineComment:Se(Sf),blockComment:Se(Sf),docComment:Se(Sf),name:Di,variableName:Se(Di),typeName:xb,tagName:Se(xb),propertyName:bb,attributeName:Se(bb),className:Se(Di),labelName:Se(Di),namespace:Se(Di),macroName:Se(Di),literal:Oi,string:Nf,docString:Se(Nf),character:Se(Nf),attributeValue:Se(Nf),number:Kh,integer:Se(Kh),float:Se(Kh),bool:Se(Oi),regexp:Se(Oi),escape:Se(Oi),color:Se(Oi),url:Se(Oi),keyword:la,self:Se(la),null:Se(la),atom:Se(la),unit:Se(la),modifier:Se(la),operatorKeyword:Se(la),controlKeyword:Se(la),definitionKeyword:Se(la),moduleKeyword:Se(la),operator:sa,derefOperator:Se(sa),arithmeticOperator:Se(sa),logicOperator:Se(sa),bitwiseOperator:Se(sa),compareOperator:Se(sa),updateOperator:Se(sa),definitionOperator:Se(sa),typeOperator:Se(sa),controlOperator:Se(sa),punctuation:gp,separator:Se(gp),bracket:Qo,angleBracket:Se(Qo),squareBracket:Se(Qo),paren:Se(Qo),brace:Se(Qo),content:ca,heading:gr,heading1:Se(gr),heading2:Se(gr),heading3:Se(gr),heading4:Se(gr),heading5:Se(gr),heading6:Se(gr),contentSeparator:Se(ca),list:Se(ca),quote:Se(ca),emphasis:Se(ca),strong:Se(ca),link:Se(ca),monospace:Se(ca),strikethrough:Se(ca),inserted:Se(),deleted:Se(),changed:Se(),invalid:Se(),meta:kf,documentMeta:Se(kf),annotation:Se(kf),processingInstruction:Se(kf),definition:ps.defineModifier("definition"),constant:ps.defineModifier("constant"),function:ps.defineModifier("function"),standard:ps.defineModifier("standard"),local:ps.defineModifier("local"),special:ps.defineModifier("special")};for(let l in Ee){let s=Ee[l];s instanceof ps&&(s.name=l)}H_([{tag:Ee.link,class:"tok-link"},{tag:Ee.heading,class:"tok-heading"},{tag:Ee.emphasis,class:"tok-emphasis"},{tag:Ee.strong,class:"tok-strong"},{tag:Ee.keyword,class:"tok-keyword"},{tag:Ee.atom,class:"tok-atom"},{tag:Ee.bool,class:"tok-bool"},{tag:Ee.url,class:"tok-url"},{tag:Ee.labelName,class:"tok-labelName"},{tag:Ee.inserted,class:"tok-inserted"},{tag:Ee.deleted,class:"tok-deleted"},{tag:Ee.literal,class:"tok-literal"},{tag:Ee.string,class:"tok-string"},{tag:Ee.number,class:"tok-number"},{tag:[Ee.regexp,Ee.escape,Ee.special(Ee.string)],class:"tok-string2"},{tag:Ee.variableName,class:"tok-variableName"},{tag:Ee.local(Ee.variableName),class:"tok-variableName tok-local"},{tag:Ee.definition(Ee.variableName),class:"tok-variableName tok-definition"},{tag:Ee.special(Ee.variableName),class:"tok-variableName2"},{tag:Ee.definition(Ee.propertyName),class:"tok-propertyName tok-definition"},{tag:Ee.typeName,class:"tok-typeName"},{tag:Ee.namespace,class:"tok-namespace"},{tag:Ee.className,class:"tok-className"},{tag:Ee.macroName,class:"tok-macroName"},{tag:Ee.propertyName,class:"tok-propertyName"},{tag:Ee.operator,class:"tok-operator"},{tag:Ee.comment,class:"tok-comment"},{tag:Ee.meta,class:"tok-meta"},{tag:Ee.invalid,class:"tok-invalid"},{tag:Ee.punctuation,class:"tok-punctuation"}]);const sj="modulepreload",aj=function(l,s){return new URL(l,s).href},_b={},We=function(s,r,c){let o=Promise.resolve();if(r&&r.length>0){let h=function(y){return Promise.all(y.map(j=>Promise.resolve(j).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};const p=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),x=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));o=h(r.map(y=>{if(y=aj(y,c),y in _b)return;_b[y]=!0;const j=y.endsWith(".css"),v=j?'[rel="stylesheet"]':"";if(!!c)for(let E=p.length-1;E>=0;E--){const A=p[E];if(A.href===y&&(!j||A.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${y}"]${v}`))return;const k=document.createElement("link");if(k.rel=j?"stylesheet":sj,j||(k.as="script"),k.crossOrigin="",k.href=y,x&&k.setAttribute("nonce",x),document.head.appendChild(k),j)return new Promise((E,A)=>{k.addEventListener("load",E),k.addEventListener("error",()=>A(new Error(`Unable to preload CSS for ${y}`)))})}))}function d(h){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=h,window.dispatchEvent(p),!p.defaultPrevented)throw h}return o.then(h=>{for(const p of h||[])p.status==="rejected"&&d(p.reason);return s().catch(d)})},B_={js:async()=>(await We(async()=>{const{javascript:l}=await import("./index-U9tL3Foh.js");return{javascript:l}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({jsx:!0}),cjs:async()=>(await We(async()=>{const{javascript:l}=await import("./index-U9tL3Foh.js");return{javascript:l}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript(),mjs:async()=>(await We(async()=>{const{javascript:l}=await import("./index-U9tL3Foh.js");return{javascript:l}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript(),jsx:async()=>(await We(async()=>{const{javascript:l}=await import("./index-U9tL3Foh.js");return{javascript:l}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({jsx:!0}),ts:async()=>(await We(async()=>{const{javascript:l}=await import("./index-U9tL3Foh.js");return{javascript:l}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({typescript:!0}),mts:async()=>(await We(async()=>{const{javascript:l}=await import("./index-U9tL3Foh.js");return{javascript:l}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({typescript:!0}),cts:async()=>(await We(async()=>{const{javascript:l}=await import("./index-U9tL3Foh.js");return{javascript:l}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({typescript:!0}),tsx:async()=>(await We(async()=>{const{javascript:l}=await import("./index-U9tL3Foh.js");return{javascript:l}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({typescript:!0,jsx:!0}),json:async()=>(await We(async()=>{const{json:l}=await import("./index-CIsgyM-R.js");return{json:l}},__vite__mapDeps([6,1,2,3,4]),import.meta.url)).json(),jsonc:async()=>(await We(async()=>{const{json:l}=await import("./index-CIsgyM-R.js");return{json:l}},__vite__mapDeps([6,1,2,3,4]),import.meta.url)).json(),css:async()=>(await We(async()=>{const{css:l}=await import("./index-dSYnVYDn.js");return{css:l}},__vite__mapDeps([7,1,2,3,4]),import.meta.url)).css(),scss:async()=>(await We(async()=>{const{css:l}=await import("./index-dSYnVYDn.js");return{css:l}},__vite__mapDeps([7,1,2,3,4]),import.meta.url)).css(),less:async()=>(await We(async()=>{const{css:l}=await import("./index-dSYnVYDn.js");return{css:l}},__vite__mapDeps([7,1,2,3,4]),import.meta.url)).css(),html:async()=>(await We(async()=>{const{html:l}=await import("./index-DW1Fnc9x.js");return{html:l}},__vite__mapDeps([8,1,7,2,3,4,0,5]),import.meta.url)).html(),htm:async()=>(await We(async()=>{const{html:l}=await import("./index-DW1Fnc9x.js");return{html:l}},__vite__mapDeps([8,1,7,2,3,4,0,5]),import.meta.url)).html(),vue:async()=>(await We(async()=>{const{html:l}=await import("./index-DW1Fnc9x.js");return{html:l}},__vite__mapDeps([8,1,7,2,3,4,0,5]),import.meta.url)).html(),svelte:async()=>(await We(async()=>{const{html:l}=await import("./index-DW1Fnc9x.js");return{html:l}},__vite__mapDeps([8,1,7,2,3,4,0,5]),import.meta.url)).html(),md:async()=>(await We(async()=>{const{markdown:l}=await import("./index-BHEVBqv1.js");return{markdown:l}},__vite__mapDeps([9,3,4,2,5,8,1,7,0]),import.meta.url)).markdown(),markdown:async()=>(await We(async()=>{const{markdown:l}=await import("./index-BHEVBqv1.js");return{markdown:l}},__vite__mapDeps([9,3,4,2,5,8,1,7,0]),import.meta.url)).markdown(),py:async()=>(await We(async()=>{const{python:l}=await import("./index-BWAAro79.js");return{python:l}},__vite__mapDeps([10,1,2,3,4,5]),import.meta.url)).python(),pyi:async()=>(await We(async()=>{const{python:l}=await import("./index-BWAAro79.js");return{python:l}},__vite__mapDeps([10,1,2,3,4,5]),import.meta.url)).python(),yaml:async()=>(await We(async()=>{const{yaml:l}=await import("./index-CZppS1t2.js");return{yaml:l}},__vite__mapDeps([11,1,2,3,4]),import.meta.url)).yaml(),yml:async()=>(await We(async()=>{const{yaml:l}=await import("./index-CZppS1t2.js");return{yaml:l}},__vite__mapDeps([11,1,2,3,4]),import.meta.url)).yaml(),rs:async()=>(await We(async()=>{const{rust:l}=await import("./index-Ck0zkLid.js");return{rust:l}},__vite__mapDeps([12,1,2,3,4]),import.meta.url)).rust(),c:async()=>(await We(async()=>{const{cpp:l}=await import("./index-BmRYCxGv.js");return{cpp:l}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),h:async()=>(await We(async()=>{const{cpp:l}=await import("./index-BmRYCxGv.js");return{cpp:l}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),cc:async()=>(await We(async()=>{const{cpp:l}=await import("./index-BmRYCxGv.js");return{cpp:l}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),cpp:async()=>(await We(async()=>{const{cpp:l}=await import("./index-BmRYCxGv.js");return{cpp:l}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),hpp:async()=>(await We(async()=>{const{cpp:l}=await import("./index-BmRYCxGv.js");return{cpp:l}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),java:async()=>(await We(async()=>{const{java:l}=await import("./index-BJQdUP7a.js");return{java:l}},__vite__mapDeps([14,1,2,3,4]),import.meta.url)).java(),go:async()=>(await We(async()=>{const{go:l}=await import("./index-BaKf7c69.js");return{go:l}},__vite__mapDeps([15,1,2,3,4,5]),import.meta.url)).go(),php:async()=>(await We(async()=>{const{php:l}=await import("./index-DnlEeQVW.js");return{php:l}},__vite__mapDeps([16,1,8,7,2,3,4,0,5]),import.meta.url)).php(),sql:async()=>(await We(async()=>{const{sql:l}=await import("./index-BRzmWdWn.js");return{sql:l}},__vite__mapDeps([17,2,3,4,1,5]),import.meta.url)).sql(),xml:async()=>(await We(async()=>{const{xml:l}=await import("./index-CxF-ndAb.js");return{xml:l}},__vite__mapDeps([18,1,2,3,4]),import.meta.url)).xml(),svg:async()=>(await We(async()=>{const{xml:l}=await import("./index-CxF-ndAb.js");return{xml:l}},__vite__mapDeps([18,1,2,3,4]),import.meta.url)).xml()},ij={".mcp.json":"json",dockerfile:"yaml",makefile:"yaml"},rj={javascript:"js",node:"js",typescript:"ts",python:"py",python3:"py",yml:"yaml",rust:"rs",golang:"go","c++":"cpp",cplusplus:"cpp"};async function cj(l){const s=rj[l.toLowerCase()]??l.toLowerCase(),r=B_[s];return r?r().catch(()=>null):null}async function oj(l){const s=(l.split("/").pop()??"").toLowerCase(),r=ij[s]??s.split(".").pop()??"",c=B_[r];return c?c().catch(()=>null):null}const uj=H_([{tag:[Ee.keyword,Ee.modifier,Ee.controlKeyword,Ee.moduleKeyword],class:"cmh-key"},{tag:[Ee.propertyName],class:"cmh-prop"},{tag:[Ee.function(Ee.variableName),Ee.labelName],class:"cmh-fn"},{tag:[Ee.color,Ee.constant(Ee.name),Ee.standard(Ee.name),Ee.bool],class:"cmh-const"},{tag:[Ee.typeName,Ee.className,Ee.changed,Ee.annotation,Ee.self,Ee.namespace],class:"cmh-type"},{tag:[Ee.number,Ee.integer,Ee.float],class:"cmh-num"},{tag:[Ee.string,Ee.special(Ee.string),Ee.regexp],class:"cmh-str"},{tag:[Ee.operator,Ee.operatorKeyword,Ee.escape],class:"cmh-op"},{tag:[Ee.meta,Ee.comment],class:"cmh-comment"},{tag:Ee.invalid,class:"cmh-invalid"}]);function Tf(l){return l.replace(/[&<>]/g,s=>s==="&"?"&amp;":s==="<"?"&lt;":"&gt;")}async function fj(l,s){const r=s?await cj(s):null;if(!r)return Tf(l);try{const c=r.language.parser.parse(l);let o="";return tj(l,c,uj,(d,h)=>{o+=h?`<span class="${h}">${Tf(d)}</span>`:Tf(d)},()=>{o+=`
118
- `}),o}catch{return Tf(l)}}Rt.setOptions({gfm:!0,breaks:!1});function I_(l){var r;const s=(r=l.split(".").pop())==null?void 0:r.toLowerCase();return s==="md"||s==="markdown"}async function sd(l){const s=await Rt.parse(l,{async:!0,walkTokens:async r=>{if(r.type!=="code")return;const c=r;c.text=await fj(c.text,c.lang??""),c.escaped=!0}});return O1.sanitize(s)}function yb(l,s){return{path:l.path,text:l.content,saved:l.content,eol:l.eol,encoding:l.encoding,mtime:l.mtime,size:l.size,binary:l.binary,tooLarge:l.tooLarge,mediaMime:l.mediaMime,mediaTooLarge:l.mediaTooLarge,stale:!1,revision:s,previewMode:I_(l.path)}}function Ya(l){return!l.binary&&!l.tooLarge&&l.text!==l.saved}function dj(l){return l.split("/").pop()??l}function kr(l){const s=l.lastIndexOf("/");return s===-1?"":l.slice(0,s)}function $f(l){return l<1024?`${l} Б`:l<1024*1024?`${(l/1024).toFixed(1)} КБ`:`${(l/1024/1024).toFixed(1)} МБ`}function zi({x:l,y:s,items:r,note:c,onClose:o}){const d=_.useRef(null),[h,p]=_.useState({left:l,top:s}),[g,x]=_.useState(()=>{const v=r.findIndex(C=>!C.disabled);return v===-1?0:v});_.useLayoutEffect(()=>{const v=d.current;if(!v)return;const C=v.getBoundingClientRect(),k=8,E=Math.max(k,Math.min(l,window.innerWidth-C.width-k)),A=Math.max(k,Math.min(s,window.innerHeight-C.height-k));p({left:E,top:A})},[l,s]),_.useLayoutEffect(()=>{var v;(v=d.current)==null||v.focus()},[]),_.useLayoutEffect(()=>{function v(k){var E;(E=d.current)!=null&&E.contains(k.target)||o()}function C(){o()}return document.addEventListener("mousedown",v),document.addEventListener("scroll",C,!0),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("scroll",C,!0)}},[o]);function y(v){v.disabled||(v.onSelect(),o())}function j(v){if(v.key==="Escape"){v.preventDefault(),v.stopPropagation(),o();return}const C=r.map((k,E)=>({item:k,index:E})).filter(k=>!k.item.disabled);if(C.length!==0){if(v.key==="ArrowDown"||v.key==="ArrowUp"){v.preventDefault();const k=v.key==="ArrowDown"?1:-1,E=C.findIndex(G=>G.index===g),A=C[(((E===-1?0:E)+k)%C.length+C.length)%C.length];A&&x(A.index);return}if(v.key==="Enter"||v.key===" "){v.preventDefault();const k=r[g];k&&y(k)}}}return a.jsxs("div",{ref:d,className:"ctxmenu",style:{left:h.left,top:h.top},role:"menu",tabIndex:-1,onKeyDown:j,children:[c&&a.jsx("div",{className:"ctxmenu__note",children:c}),r.map((v,C)=>a.jsxs("button",{type:"button",role:"menuitem","aria-disabled":v.disabled,className:"ctxmenu__item"+(C===g?" is-cursor":""),onMouseEnter:()=>x(C),onClick:()=>y(v),children:[a.jsx("span",{className:"ctxmenu__label",children:v.label}),v.hint&&a.jsx("span",{className:"ctxmenu__hint",children:v.hint})]},v.id))]})}const hj=3500,pj=9e3,vb=220;function Ar({result:l,onDismiss:s}){const[r,c]=_.useState(l),[o,d]=_.useState(!1);if(_.useEffect(()=>{if(!l){c(null),d(!1);return}if(c(l),d(!1),l.url)return;const p=l.ok?hj:pj,g=setTimeout(()=>d(!0),p),x=setTimeout(()=>c(null),p+vb);return()=>{clearTimeout(g),clearTimeout(x)}},[l]),!r)return null;const h=()=>{d(!0),setTimeout(()=>{c(null),s==null||s()},vb)};return a.jsxs("div",{className:"oplog "+(r.ok?"oplog--ok":"oplog--bad")+(o?" oplog--leaving":"")+(r.url?" oplog--dismissible":""),role:"status","aria-live":r.ok?"polite":"assertive",children:[r.message,r.url&&a.jsxs("a",{className:"oplog__link",href:r.url,target:"_blank",rel:"noreferrer",onClick:p=>p.stopPropagation(),children:[r.url.replace(/^https?:\/\//,"")," ↗"]}),r.url&&s&&a.jsx("button",{type:"button",className:"oplog__dismiss",title:"Закрыть","aria-label":"Закрыть сообщение",onClick:h,children:"✕"})]})}function fa({value:l,className:s,placeholder:r="Название сессии",onCommit:c,onCancel:o}){const[d,h]=_.useState(l),p=_.useRef(null);_.useEffect(()=>{var x;(x=p.current)==null||x.select()},[]);function g(){const x=d.trim();if(!x||x===l)return o();c(x)}return a.jsx("input",{ref:p,className:s?`rename ${s}`:"rename",value:d,autoFocus:!0,spellCheck:!1,placeholder:r,onChange:x=>h(x.target.value),onBlur:g,onKeyDown:x=>{x.stopPropagation(),x.key==="Enter"?(x.preventDefault(),g()):x.key==="Escape"&&(x.preventDefault(),o())}})}function Ic({active:l}){return l?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M2 5h3V2"}),a.jsx("path",{d:"M14 5h-3V2"}),a.jsx("path",{d:"M2 11h3v3"}),a.jsx("path",{d:"M14 11h-3v3"})]}):a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M5 2H2v3"}),a.jsx("path",{d:"M11 2h3v3"}),a.jsx("path",{d:"M2 11v3h3"}),a.jsx("path",{d:"M14 11v3h-3"})]})}const mj=500,xr="application/x-ccv-fs-path",gj=200;function xj({open:l,tree:s,expanded:r,activePath:c,dirty:o,gitChanges:d,result:h,searchResult:p,onSearch:g,onReveal:x,onToggle:y,onOpen:j,onCreate:v,onRename:C,onMove:k,onCopy:E,onDelete:A,onRefresh:G,onClose:V,zoomed:Z,onToggleZoom:D}){const[$,z]=_.useState(""),[R,H]=_.useState(null),[B,le]=_.useState(null),[W,oe]=_.useState(null),[se,ge]=_.useState(null),[ye,Y]=_.useState(null),[ce,de]=_.useState(null),_e=td("(hover: hover)"),Ce=_.useRef(null),w=_.useMemo(()=>yj(d),[d]);function Q(ne){return!(!W||ne===W.path||W.kind==="dir"&&ne.startsWith(`${W.path}/`)||ne===kr(W.path))}function L(ne){return!(!ye||ne===ye.path||ye.kind==="dir"&&ne.startsWith(`${ye.path}/`)||ye.mode==="cut"&&ne===kr(ye.path))}function be(ne){Y({path:ne.path,kind:ne.kind,mode:"copy"})}function we(ne){Y({path:ne.path,kind:ne.kind,mode:"cut"})}function Me(ne){!ye||!L(ne)||(ne&&!r.has(ne)&&y(ne),ye.mode==="cut"?(k(ye.path,ne),Y(null)):E(ye.path,ne))}function Oe(ne,xe){const Be=ne.touches[0];if(!Be)return;const Fe={timer:0,x:Be.clientX,y:Be.clientY,el:ne.currentTarget,fired:!1};Fe.timer=window.setTimeout(()=>{Fe.fired=!0,xe(Fe.x,Fe.y,Fe.el)},mj),Ce.current=Fe}function Ue(ne){const xe=Ce.current,Be=ne.touches[0];!xe||!Be||Math.hypot(Be.clientX-xe.x,Be.clientY-xe.y)>10&&(window.clearTimeout(xe.timer),Ce.current=null)}function qe(ne){const xe=Ce.current;xe&&(window.clearTimeout(xe.timer),xe.fired&&ne.preventDefault())}function an(){var ne;return(ne=Ce.current)!=null&&ne.fired?(Ce.current=null,!0):!1}function Ke(ne,xe,Be,Fe){z((Fe==null?void 0:Fe.path)??""),de({x:ne,y:xe,opener:Be,entry:Fe})}function Zt(){const ne=ce==null?void 0:ce.opener;de(null),ne!=null&&ne.isConnected&&ne.focus()}function ct(ne){return{onContextMenu:xe=>{xe.preventDefault(),Ke(xe.clientX,xe.clientY,xe.currentTarget,ne)},onTouchStart:xe=>Oe(xe,(Be,Fe,Ie)=>Ke(Be,Fe,Ie,ne)),onTouchMove:Ue,onTouchEnd:qe,onTouchCancel:qe}}function dt(ne){ne.target===ne.currentTarget&&(ne.preventDefault(),Ke(ne.clientX,ne.clientY,ne.currentTarget,null))}function Ge(ne){ne.target===ne.currentTarget&&Oe(ne,(xe,Be,Fe)=>Ke(xe,Be,Fe,null))}function rn(ne){if(!(ne.ctrlKey||ne.metaKey)||ne.target instanceof HTMLInputElement)return;const xe=ne.key.toLowerCase();if(xe==="v"){ne.preventDefault(),Me(Qn());return}if(!$)return;const Be=jb(s,$);Be&&(xe==="c"?(ne.preventDefault(),be(Be)):xe==="x"&&(ne.preventDefault(),we(Be)))}function jn(ne){return xe=>{xe.dataTransfer.effectAllowed="move",xe.dataTransfer.setData(xr,ne.path),oe({path:ne.path,kind:ne.kind})}}function st(){oe(null),ge(null)}function wn(ne){return xe=>{xe.dataTransfer.types.includes(xr)&&(xe.stopPropagation(),!(ne.kind!=="dir"||!Q(ne.path))&&(xe.preventDefault(),ge(ne.path)))}}function Jn(ne){return xe=>{if(!xe.dataTransfer.types.includes(xr)||(xe.stopPropagation(),ne.kind!=="dir"||!Q(ne.path)))return;xe.preventDefault();const Be=xe.dataTransfer.getData(xr);ge(null),Be&&k(Be,ne.path)}}function cn(ne){!ne.dataTransfer.types.includes(xr)||!Q("")||(ne.preventDefault(),ge(""))}function Wn(ne){if(!ne.dataTransfer.types.includes(xr)||!Q(""))return;ne.preventDefault();const xe=ne.dataTransfer.getData(xr);ge(null),xe&&k(xe,"")}const[It,tt]=_.useState(""),Dt=It.trim(),qn=Dt.length>0,Et=_.useRef(null),nt=_.useRef(g);nt.current=g;function at(ne){tt(ne),Et.current&&clearTimeout(Et.current);const xe=ne.trim();if(!xe){nt.current("");return}Et.current=setTimeout(()=>nt.current(xe),gj)}function hn(ne){Et.current&&clearTimeout(Et.current),tt(""),nt.current(""),z(ne.path),x(ne)}const mn=qn&&(p==null?void 0:p.query)===Dt?p:null;function Qn(){if($==="")return"";const ne=jb(s,$);if((ne==null?void 0:ne.kind)==="dir")return $;const xe=$.lastIndexOf("/");return xe===-1?"":$.slice(0,xe)}function Pt(ne,xe){const Be=xe??Qn();Be&&!r.has(Be)&&y(Be),le({parent:Be,kind:ne})}function vt(){if(!ce)return[];const ne=Fe=>_e?Fe:void 0;if(!ce.entry)return[{id:"paste",label:"Вставить в корень проекта",hint:ne("Ctrl+V"),disabled:!L(""),onSelect:()=>Me("")},{id:"new-file",label:"Создать файл",onSelect:()=>Pt("file","")},{id:"new-dir",label:"Создать каталог",onSelect:()=>Pt("dir","")}];const xe=ce.entry,Be=[xe.kind==="file"?{id:"open",label:"Открыть",onSelect:()=>j(xe.path)}:{id:"toggle",label:r.has(xe.path)?"Свернуть":"Развернуть",onSelect:()=>y(xe.path)},{id:"copy",label:"Копировать",hint:ne("Ctrl+C"),onSelect:()=>be(xe)},{id:"cut",label:"Вырезать",hint:ne("Ctrl+X"),onSelect:()=>we(xe)}];return xe.kind==="dir"&&(Be.push({id:"paste",label:"Вставить",hint:ne("Ctrl+V"),disabled:!L(xe.path),onSelect:()=>Me(xe.path)}),Be.push({id:"new-file",label:"Создать файл",onSelect:()=>Pt("file",xe.path)}),Be.push({id:"new-dir",label:"Создать каталог",onSelect:()=>Pt("dir",xe.path)})),Be.push({id:"rename",label:"Переименовать",onSelect:()=>H(xe.path)}),Be.push({id:"delete",label:"Удалить",onSelect:()=>A(xe)}),Be}const Ft=qn?[]:jt("",0);function jt(ne,xe){const Be=s[ne],Fe=[];if(B&&B.parent===ne&&Fe.push(a.jsxs("div",{className:"fsrow fsrow--draft",style:$a(xe),children:[a.jsx("span",{className:"fsrow__icon",children:B.kind==="dir"?a.jsx(Jf,{}):a.jsx(Wf,{})}),a.jsx(fa,{className:"rename--file",value:"",placeholder:B.kind==="dir"?"имя каталога":"имя файла",onCommit:Ie=>{le(null),v(ne,B.kind,Ie)},onCancel:()=>le(null)})]},`draft:${ne}`)),!Be)return Fe.push(a.jsx("p",{className:"fsrow__pending",style:$a(xe),children:"читаем…"},`wait:${ne}`)),Fe;Be.length===0&&!B&&Fe.push(a.jsx("p",{className:"fsrow__pending",style:$a(xe),children:"пусто"},`empty:${ne}`));for(const Ie of Be){const Ct=Ie.kind==="dir"&&r.has(Ie.path);Fe.push(R===Ie.path?a.jsxs("div",{className:"fsrow fsrow--draft",style:$a(xe),children:[a.jsx("span",{className:"fsrow__icon",children:Ie.kind==="dir"?a.jsx(Jf,{open:Ct}):a.jsx(Wf,{})}),a.jsx(fa,{className:"rename--file",value:Ie.name,placeholder:"новое имя",onCommit:I=>{H(null),C(Ie.path,I)},onCancel:()=>H(null)})]},Ie.path):a.jsx(bj,{entry:Ie,depth:xe,open:Ct,active:Ie.path===c,selected:Ie.path===$,dirty:o.has(Ie.path),gitStatus:w.get(Ie.path),dragging:(W==null?void 0:W.path)===Ie.path,dropTarget:se===Ie.path,cut:(ye==null?void 0:ye.mode)==="cut"&&ye.path===Ie.path,onClick:()=>{an()||(z(Ie.path),Ie.kind==="dir"?y(Ie.path):j(Ie.path))},onRename:()=>H(Ie.path),onDelete:()=>A(Ie),onDragStart:jn(Ie),onDragEnd:st,onDragOver:wn(Ie),onDrop:Jn(Ie),...ct(Ie)},Ie.path)),Ct&&Fe.push(...jt(Ie.path,xe+1))}return Fe}function Pn(){if(!mn)return[a.jsx("p",{className:"fsrow__pending",style:$a(0),children:"ищем…"},"search:wait")];if(mn.entries.length===0)return[a.jsx("p",{className:"fsrow__pending",style:$a(0),children:"ничего не найдено"},"search:empty")];const ne=mn.entries.map(xe=>a.jsx(_j,{entry:xe,gitStatus:w.get(xe.path),onClick:()=>hn(xe)},xe.path));return mn.truncated&&ne.push(a.jsxs("p",{className:"fsrow__pending",style:$a(0),children:["показаны первые ",mn.entries.length," — уточните запрос"]},"search:truncated")),ne}return a.jsxs("aside",{className:(l?"sidepane sidepane--files sidepane--open":"sidepane sidepane--files")+(Z?" sidepane--zoomed":""),"aria-label":"Файлы проекта",onKeyDown:rn,children:[a.jsxs("div",{className:"sidepane__head",onDoubleClick:ne=>{D&&(ne.target.closest("button")||D())},children:[a.jsx(Sj,{}),a.jsx("span",{className:"sidepane__title",children:"Файлы"}),a.jsx("button",{className:"sidepane__btn",title:"Новый файл","aria-label":"Новый файл",onClick:()=>Pt("file"),children:a.jsx(jj,{})}),a.jsx("button",{className:"sidepane__btn",title:"Новый каталог","aria-label":"Новый каталог",onClick:()=>Pt("dir"),children:a.jsx(wj,{})}),a.jsx("button",{className:"sidepane__btn",title:"Перечитать дерево","aria-label":"Перечитать дерево",onClick:G,children:"↻"}),D&&a.jsx("button",{className:"sidepane__btn",title:Z?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":Z?"Свернуть панель файлов":"Развернуть панель файлов на весь экран","aria-pressed":Z,onClick:D,children:a.jsx(Ic,{active:Z})}),a.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель файлов",onClick:V,children:"✕"})]}),a.jsxs("div",{className:"fssearch",children:[a.jsx(Nj,{}),a.jsx("input",{className:"fssearch__input",type:"text",value:It,spellCheck:!1,placeholder:"Поиск файлов и папок…","aria-label":"Поиск файлов и папок",onChange:ne=>at(ne.target.value),onKeyDown:ne=>{ne.stopPropagation(),ne.key==="Escape"&&(ne.preventDefault(),It?at(""):ne.currentTarget.blur())}}),It&&a.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>at(""),children:"✕"})]}),a.jsx("div",{className:"sidepane__scroll fstree"+(se===""?" fstree--drop-target":""),tabIndex:-1,onDragOver:cn,onDrop:Wn,onContextMenu:dt,onTouchStart:Ge,onTouchMove:Ue,onTouchEnd:qe,onTouchCancel:qe,children:qn?Pn():Ft}),a.jsx(Ar,{result:h}),ce&&a.jsx(zi,{x:ce.x,y:ce.y,items:vt(),onClose:Zt})]})}function bj({entry:l,depth:s,open:r,active:c,selected:o,dirty:d,gitStatus:h,dragging:p,dropTarget:g,cut:x,onClick:y,onRename:j,onDelete:v,onDragStart:C,onDragEnd:k,onDragOver:E,onDrop:A,onContextMenu:G,onTouchStart:V,onTouchMove:Z,onTouchEnd:D,onTouchCancel:$}){const z="fsrow"+(c?" is-open":"")+(o&&!c?" is-selected":"")+(l.ignored?" fsrow--ignored":"")+(p?" fsrow--dragging":"")+(g?" fsrow--drop-target":"")+(x?" fsrow--cut":"");return a.jsxs("div",{className:z,style:$a(s),draggable:!0,onDragStart:C,onDragEnd:k,onDragOver:E,onDrop:A,onContextMenu:G,onTouchStart:V,onTouchMove:Z,onTouchEnd:D,onTouchCancel:$,children:[a.jsxs("button",{className:"fsrow__main",onClick:y,title:q_(l),children:[a.jsx("span",{className:"fsrow__icon"+Ff("fsrow__icon",h),children:l.kind==="dir"?a.jsx(Jf,{open:r}):a.jsx(Wf,{})}),a.jsx("span",{className:"fsrow__name"+Ff("fsrow__name",h),children:l.name}),l.ignored&&a.jsx("span",{className:"fsrow__tag",title:"Игнорируется git (.gitignore)",children:"git-ignore"}),d&&a.jsx("span",{className:"fsrow__dot",title:"Есть несохранённые правки"})]}),a.jsx("button",{className:"fsrow__act",title:"Переименовать","aria-label":`Переименовать ${l.name}`,onClick:j,children:"✎"}),a.jsx("button",{className:"fsrow__act",title:"Удалить","aria-label":`Удалить ${l.name}`,onClick:v,children:"✕"})]})}function _j({entry:l,gitStatus:s,onClick:r}){const c=l.path.slice(0,l.path.length-l.name.length-1);return a.jsxs("button",{className:"fsrow fsrow--search"+(l.ignored?" fsrow--ignored":""),style:$a(0),onClick:r,title:q_(l),children:[a.jsx("span",{className:"fsrow__icon"+Ff("fsrow__icon",s),children:l.kind==="dir"?a.jsx(Jf,{}):a.jsx(Wf,{})}),a.jsx("span",{className:"fsrow__name"+Ff("fsrow__name",s),children:l.name}),l.ignored&&a.jsx("span",{className:"fsrow__tag",children:"git-ignore"}),c&&a.jsx("span",{className:"fsrow__path",children:c})]})}function q_(l){return l.ignored?`${l.path} — игнорируется git (.gitignore)`:l.path}function $a(l){return{"--depth":l}}function jb(l,s){var o;const r=s.lastIndexOf("/"),c=r===-1?"":s.slice(0,r);return((o=l[c])==null?void 0:o.find(d=>d.path===s))??null}function yj(l){const s=new Map,r={added:1,modified:2},c=(o,d)=>{const h=s.get(o);(!h||r[d]>r[h])&&s.set(o,d)};for(const o of l){const d=vj(o.status);if(!d)continue;c(o.path,d);let h=kr(o.path);for(;c(h,d),!!h;)h=kr(h)}return s}function vj(l){if(l==="??")return"added";const[s="",r=""]=l;return s==="A"||s==="R"||s==="C"?"added":s==="M"||r==="M"?"modified":null}function Ff(l,s){return s?` ${l}--git-${s}`:""}function Jf({open:l=!1}){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,"aria-hidden":"true",children:l?a.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"}):a.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 Wf(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,strokeLinejoin:"round","aria-hidden":"true",children:[a.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"}),a.jsx("path",{d:"M9 2v3.2h3.3"})]})}function jj(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,"aria-hidden":"true",children:[a.jsxs("g",{transform:"translate(-1.3,-1.6) scale(0.78)",strokeLinejoin:"round",children:[a.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"}),a.jsx("path",{d:"M9 2v3.2h3.3"})]}),a.jsx("path",{d:"M12.2 10.3v3.8M10.3 12.2h3.8",strokeLinecap:"round"})]})}function wj(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,"aria-hidden":"true",children:[a.jsx("g",{transform:"translate(-1.3,-1.6) scale(0.78)",children:a.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"})}),a.jsx("path",{d:"M12.2 10.3v3.8M10.3 12.2h3.8",strokeLinecap:"round"})]})}function Sj(){return a.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[a.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"}),a.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 Nj(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[a.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),a.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}const kj=200;function Tj({open:l,result:s,onSearch:r,onOpenMatch:c,onClose:o,zoomed:d,onToggleZoom:h}){const[p,g]=_.useState(""),x=p.trim(),y=x.length>0,j=_.useRef(null),v=_.useRef(r);v.current=r;function C(A){g(A),j.current&&clearTimeout(j.current);const G=A.trim();if(!G){v.current("");return}j.current=setTimeout(()=>v.current(G),kj)}const k=y&&(s==null?void 0:s.query)===x?s:null;function E(){if(!k)return[a.jsx("p",{className:"fsrow__pending",children:"ищем…"},"grep:wait")];if(k.matches.length===0)return[a.jsx("p",{className:"fsrow__pending",children:"ничего не найдено"},"grep:empty")];const A=[];let G="";for(const V of k.matches)V.path!==G&&(G=V.path,A.push(a.jsx("p",{className:"searchgroup__path",title:V.path,children:V.path},`path:${V.path}`))),A.push(a.jsx(Ej,{match:V,onClick:()=>c(V)},`${V.path}:${V.line}:${V.column}`));return k.truncated&&A.push(a.jsxs("p",{className:"fsrow__pending",children:["показаны первые ",k.matches.length," — уточните запрос"]},"grep:truncated")),A}return a.jsxs("aside",{className:(l?"sidepane sidepane--search sidepane--open":"sidepane sidepane--search")+(d?" sidepane--zoomed":""),"aria-label":"Поиск по тексту в проекте",children:[a.jsxs("div",{className:"sidepane__head",onDoubleClick:A=>{h&&(A.target.closest("button")||h())},children:[a.jsx(Cj,{}),a.jsx("span",{className:"sidepane__title",children:"Поиск по тексту"}),h&&a.jsx("button",{className:"sidepane__btn",title:d?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":d?"Свернуть панель поиска":"Развернуть панель поиска на весь экран","aria-pressed":d,onClick:h,children:a.jsx(Ic,{active:d})}),a.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель поиска",onClick:o,children:"✕"})]}),a.jsxs("div",{className:"fssearch",children:[a.jsx(Aj,{}),a.jsx("input",{className:"fssearch__input",type:"text",value:p,spellCheck:!1,placeholder:"Поиск по тексту во всех файлах…","aria-label":"Поиск по тексту во всех файлах",onChange:A=>C(A.target.value),onKeyDown:A=>{A.stopPropagation(),A.key==="Escape"&&(A.preventDefault(),p?C(""):A.currentTarget.blur())}}),p&&a.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>C(""),children:"✕"})]}),a.jsx("div",{className:"sidepane__scroll fstree",children:y?E():a.jsx("p",{className:"sidepane__empty",children:"Введите текст, чтобы найти его во всех файлах проекта."})})]})}function Ej({match:l,onClick:s}){const r=l.lineText.slice(0,l.column-1),c=l.lineText.slice(l.column-1,l.column-1+l.matchLength),o=l.lineText.slice(l.column-1+l.matchLength);return a.jsxs("button",{className:"searchmatch",onClick:s,title:`${l.path}:${l.line}`,children:[a.jsx("span",{className:"searchmatch__line",children:l.line}),a.jsxs("span",{className:"searchmatch__text",children:[r,a.jsx("mark",{children:c}),o]})]})}function Cj(){return a.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[a.jsx("circle",{cx:"6.8",cy:"6.8",r:"4.3"}),a.jsx("path",{d:"M13.2 13.2 10.1 10.1"})]})}function Aj(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[a.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),a.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}let Ef=null;function Mj(){return Ef||(Ef=Promise.all([We(()=>import("./index-Bqjj9q2W.js"),__vite__mapDeps([19,4,3,2,20,5]),import.meta.url),We(()=>import("./index-891wE-Rj.js").then(l=>l.v),__vite__mapDeps([4,3]),import.meta.url),We(()=>import("./index-BHot-lnj.js"),[],import.meta.url),We(()=>import("./index-BnqCpVA0.js"),__vite__mapDeps([20,3,4,2]),import.meta.url),We(()=>import("./codemirror-BABguQzY.js"),__vite__mapDeps([21,2,3,4]),import.meta.url)]).then(([l,s,r,c,o])=>({EditorView:s.EditorView,EditorState:r.EditorState,Compartment:r.Compartment,EditorSelection:r.EditorSelection,Prec:r.Prec,keymap:s.keymap,indentWithTab:c.indentWithTab,basicSetup:l.basicSetup,editorTheme:o.editorTheme,editorHighlight:o.editorHighlight})).catch(l=>{throw Ef=null,l})),Ef}function Rj({path:l,doc:s,revision:r,goto:c,onChange:o,onSave:d}){const h=_.useRef(null),p=_.useRef(null),g=_.useRef(null),x=_.useRef(new Map),y=_.useRef(new Map),j=_.useRef(new Set),v=_.useRef(null),C=_.useRef(o),k=_.useRef(d),E=_.useRef(l),A=_.useRef(r),G=_.useRef(s);C.current=o,k.current=d,E.current=l,A.current=r,G.current=s;const[V,Z]=_.useState("loading"),[D,$]=_.useState(!1);function z(H,B,le,W,oe){const se=x.current.get(W),ge=y.current.get(W)===oe;if(se&&ge)le.setState(se);else{const Y=H.EditorState.create({doc:G.current,extensions:[H.basicSetup,H.Prec.highest(H.keymap.of([{key:"Mod-s",preventDefault:!0,run:()=>(k.current(E.current),!0)}])),H.keymap.of([H.indentWithTab]),B.of([]),H.editorTheme,H.editorHighlight,H.EditorView.updateListener.of(ce=>{ce.docChanged&&C.current(E.current,ce.state.doc.toString())})]});x.current.set(W,Y),y.current.set(W,oe),le.setState(Y),j.current.delete(W)}if(j.current.has(W))return()=>{};let ye=!1;return oj(W).then(Y=>{ye||!Y||E.current!==W||(le.dispatch({effects:B.reconfigure(Y)}),x.current.set(W,le.state),j.current.add(W))}),()=>{ye=!0}}_.useEffect(()=>{if(!h.current)return;let B=!1,le=null,W=null;Z("loading"),$(!1);const oe=window.setTimeout(()=>{B||$(!0)},200);return(async()=>{let se;try{se=await Mj()}catch{window.clearTimeout(oe),B||Z("error");return}if(B||!h.current)return;window.clearTimeout(oe);const ge=new se.Compartment;v.current=ge,g.current=se,W=new se.EditorView({parent:h.current}),p.current=W,le=z(se,ge,W,E.current,A.current),Z("ready")})(),()=>{B=!0,window.clearTimeout(oe),le==null||le(),W==null||W.destroy(),p.current===W&&(p.current=null),g.current=null,v.current=null}},[]),_.useEffect(()=>{const H=g.current,B=p.current,le=v.current;if(!(!H||!B||!le))return z(H,le,B,l,r)},[l,r]);const R=_.useRef(0);return _.useEffect(()=>{const H=p.current,B=g.current;if(!H||!B||!c||c.token===R.current)return;R.current=c.token;const le=H.state.doc.lines,W=Math.min(Math.max(c.line,1),le),oe=H.state.doc.line(W),se=Math.min(oe.from+Math.max(c.column-1,0),oe.to);H.dispatch({selection:B.EditorSelection.cursor(se),effects:B.EditorView.scrollIntoView(se,{y:"center"})}),H.focus()},[c]),_.useEffect(()=>()=>{const H=p.current;H&&x.current.set(l,H.state)},[l]),a.jsxs("div",{className:"editor__code",children:[a.jsx("div",{ref:h,className:"editor__code-surface"+(V==="ready"?"":" is-hidden")}),V==="loading"&&D&&a.jsxs("div",{className:"editor__state work",role:"status",children:[a.jsxs("div",{className:"work__dots",children:[a.jsx("span",{className:"work__dot"}),a.jsx("span",{className:"work__dot"}),a.jsx("span",{className:"work__dot"})]}),a.jsx("span",{className:"work__label",children:"Загружается редактор…"})]}),V==="error"&&a.jsxs("div",{className:"editor__fallback",children:[a.jsxs("div",{className:"editor__fallback-banner",role:"alert",children:[a.jsx("span",{children:"Редактор не загрузился — ниже только просмотр, без сохранения правок."}),a.jsx("button",{className:"btn btn--sm btn--primary",onClick:()=>window.location.reload(),children:"Перезагрузить страницу"})]}),a.jsx("pre",{className:"editor__fallback-text",children:s})]})]})}function Is({value:l,options:s,onChange:r,className:c,title:o,ariaLabel:d,placeholder:h="—"}){const[p,g]=_.useState(!1),[x,y]=_.useState(0),j=_.useRef(null),v=_.useRef(null),C=s.find(A=>A.value===l)??null;_.useEffect(()=>{if(!p)return;const A=s.findIndex(G=>G.value===l);y(A===-1?0:A)},[p]),_.useEffect(()=>{if(!p)return;function A(G){var V;(V=j.current)!=null&&V.contains(G.target)||g(!1)}return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[p]),_.useEffect(()=>{var A,G;p&&((G=(A=v.current)==null?void 0:A.querySelector(".is-cursor"))==null||G.scrollIntoView({block:"nearest"}))},[p,x]),_.useEffect(()=>{if(!p)return;const A=v.current,G=Dj(j.current);if(!A||!G)return;const V=A.getBoundingClientRect().bottom-G.getBoundingClientRect().bottom;V>0&&(G.scrollTop+=Math.min(V+8,A.offsetHeight))},[p]);function k(A){g(!1),A.value!==l&&r(A.value)}function E(A){if(A.key==="Escape"){if(!p)return;A.preventDefault(),A.stopPropagation(),g(!1);return}if(A.key==="ArrowDown"||A.key==="ArrowUp"){if(A.preventDefault(),!p)return g(!0);const G=A.key==="ArrowDown"?1:s.length-1;return y(V=>(V+G)%s.length)}if(A.key==="Enter"||A.key===" "){if(A.preventDefault(),!p)return g(!0);const G=s[x];G&&k(G)}}return a.jsxs("div",{ref:j,className:"select"+(p?" select--open":"")+(c?` ${c}`:""),children:[a.jsxs("button",{type:"button",className:"select__trigger",title:o,"aria-label":d??o,"aria-haspopup":"listbox","aria-expanded":p,onClick:()=>g(A=>!A),onKeyDown:E,children:[a.jsx("span",{className:"select__value",children:(C==null?void 0:C.label)??h}),a.jsx(Oj,{})]}),p&&a.jsx("div",{ref:v,className:"select__menu",role:"listbox","aria-label":d??o,children:s.map((A,G)=>a.jsxs("button",{type:"button",role:"option","aria-selected":A.value===l,className:"select__option"+(G===x?" is-cursor":"")+(A.value===l?" is-on":""),onMouseEnter:()=>y(G),onClick:()=>k(A),children:[a.jsx("span",{className:"select__check","aria-hidden":"true",children:A.value===l?"✓":""}),a.jsx("span",{className:"select__label",children:A.label}),A.hint&&a.jsx("span",{className:"select__hint",children:A.hint})]},A.value))})]})}function Dj(l){let s=(l==null?void 0:l.parentElement)??null;for(;s;){if(s.scrollHeight>s.clientHeight&&getComputedStyle(s).overflowY!=="visible")return s;s=s.parentElement}return null}function Oj(){return a.jsx("svg",{className:"select__chev",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"M3 4.5 6 7.5 9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function Lj(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("circle",{cx:"6.6",cy:"6.6",r:"4.3"}),a.jsx("path",{d:"M9.7 9.7 14 14"}),a.jsx("path",{d:"M6.6 4.6v4M4.6 6.6h4"})]})}function zj(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("circle",{cx:"6.6",cy:"6.6",r:"4.3"}),a.jsx("path",{d:"M9.7 9.7 14 14"}),a.jsx("path",{d:"M4.6 6.6h4"})]})}function Uj(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M13 8a5 5 0 1 1-1.6-3.7"}),a.jsx("path",{d:"M13 2.5v3.3h-3.3"})]})}function Hj({path:l,mime:s,base64:r,error:c,tooLarge:o,size:d,onRequestMedia:h}){_.useEffect(()=>{!o&&r===void 0&&c===void 0&&h(l)},[]);const p=Bj(r,s);return o?a.jsx("div",{className:"mediaview mediaview--message",children:a.jsxs("p",{className:"mediaview__error",children:["Файл слишком велик для просмотра (",$f(d),"). Лимит — 64 МБ."]})}):c?a.jsxs("div",{className:"mediaview mediaview--message",role:"alert",children:[a.jsx("p",{className:"mediaview__error",children:c}),a.jsx("button",{className:"btn btn--sm btn--primary",onClick:()=>h(l),children:"Повторить"})]}):p?s.startsWith("image/")?a.jsx(qj,{url:p}):s.startsWith("video/")?a.jsx(Yj,{url:p}):null:a.jsxs("div",{className:"mediaview mediaview--message",role:"status",children:[a.jsx("div",{className:"mediaview__progress",children:a.jsx("div",{className:"mediaview__progress-fill"})}),a.jsx("span",{className:"mediaview__label",children:"Загружается…"})]})}function Bj(l,s){const[r,c]=_.useState(null);return _.useEffect(()=>{if(l===void 0){c(null);return}const o=atob(l),d=new Uint8Array(o.length);for(let p=0;p<o.length;p++)d[p]=o.charCodeAt(p);const h=URL.createObjectURL(new Blob([d],{type:s}));return c(h),()=>URL.revokeObjectURL(h)},[l,s]),r}const Ri=1,G_=8,Cf=1.25;function Ij(l){return Math.min(G_,Math.max(Ri,l))}function qj({url:l}){const[s,r]=_.useState({scale:Ri,x:0,y:0}),[c,o]=_.useState(!1),d=_.useRef(null),h=_.useRef(null);function p(C,k,E){r(A=>{const G=Ij(A.scale*C);if(G===A.scale)return A;if(G<=Ri)return{scale:Ri,x:0,y:0};const V=(k-A.x)/A.scale,Z=(E-A.y)/A.scale;return{scale:G,x:k-G*V,y:E-G*Z}})}_.useEffect(()=>{const C=d.current;if(!C)return;function k(E){E.preventDefault();const A=C.getBoundingClientRect(),G=E.clientX-A.left-A.width/2,V=E.clientY-A.top-A.height/2;p(E.deltaY<0?Cf:1/Cf,G,V)}return C.addEventListener("wheel",k,{passive:!1}),()=>C.removeEventListener("wheel",k)},[]);function g(C){s.scale<=Ri||(C.currentTarget.setPointerCapture(C.pointerId),h.current={pointerId:C.pointerId,startX:C.clientX,startY:C.clientY,origX:s.x,origY:s.y},o(!0))}function x(C){const k=h.current;!k||k.pointerId!==C.pointerId||r(E=>({...E,x:k.origX+(C.clientX-k.startX),y:k.origY+(C.clientY-k.startY)}))}function y(){h.current=null,o(!1)}const j=s.scale>Ri,v=!j&&s.x===0&&s.y===0;return a.jsxs("div",{className:"mediaview mediaview--image",children:[a.jsx("div",{ref:d,className:"mediaview__stage"+(j?c?" is-dragging":" is-zoomed":""),onPointerDown:g,onPointerMove:x,onPointerUp:y,onPointerCancel:y,children:a.jsx("img",{src:l,alt:"",className:"mediaview__image",draggable:!1,style:{transform:`translate(${s.x}px, ${s.y}px) scale(${s.scale})`}})}),a.jsxs("div",{className:"mediaview__toolbar",children:[a.jsx("button",{className:"btn btn--sm",disabled:s.scale<=Ri,title:"Уменьшить","aria-label":"Уменьшить",onClick:()=>p(1/Cf,0,0),children:a.jsx(zj,{})}),a.jsxs("span",{className:"mediaview__zoomlabel",children:[Math.round(s.scale*100),"%"]}),a.jsx("button",{className:"btn btn--sm",disabled:s.scale>=G_,title:"Увеличить","aria-label":"Увеличить",onClick:()=>p(Cf,0,0),children:a.jsx(Lj,{})}),a.jsx("button",{className:"btn btn--sm",disabled:v,title:"Вписать в окно","aria-label":"Сбросить масштаб — вписать в окно",onClick:()=>r({scale:Ri,x:0,y:0}),children:a.jsx(Uj,{})})]})]})}const Gj=[{value:"0.5",label:"0.5×"},{value:"0.75",label:"0.75×"},{value:"1",label:"1× — обычная"},{value:"1.25",label:"1.25×"},{value:"1.5",label:"1.5×"},{value:"2",label:"2×"}];function Yj({url:l}){const s=_.useRef(null),[r,c]=_.useState("1");return _.useEffect(()=>{s.current&&(s.current.playbackRate=Number(r))},[r]),a.jsxs("div",{className:"mediaview mediaview--video",children:[a.jsx("video",{ref:s,className:"mediaview__video",src:l,controls:!0}),a.jsxs("div",{className:"mediaview__speedbar",children:[a.jsx("span",{className:"mediaview__speedlabel",children:"Скорость"}),a.jsx(Is,{className:"mediaview__speedselect",value:r,onChange:c,ariaLabel:"Скорость воспроизведения",options:Gj})]})]})}function $j({file:l,goto:s,onChange:r,onSave:c,onReload:o,onOverwrite:d,onRequestMedia:h,onTogglePreview:p}){const g=Ya(l),x=I_(l.path)&&!l.binary&&!l.tooLarge;return a.jsxs("div",{className:"editor",children:[a.jsxs("div",{className:"editor__bar",children:[a.jsx("span",{className:"editor__path",title:l.path,children:l.path}),a.jsxs("span",{className:"editor__meta",children:[$f(l.size),l.eol==="crlf"&&" · CRLF"]}),x&&a.jsxs("div",{className:"editor__viewtoggle",role:"tablist","aria-label":"Режим просмотра",children:[a.jsx("button",{className:"btn btn--sm"+(l.previewMode?" is-on":""),role:"tab","aria-selected":l.previewMode,onClick:()=>!l.previewMode&&p(l.path),children:"Просмотр"}),a.jsx("button",{className:"btn btn--sm"+(l.previewMode?"":" is-on"),role:"tab","aria-selected":!l.previewMode,onClick:()=>l.previewMode&&p(l.path),children:"Код"})]}),a.jsx("button",{className:"btn btn--sm",disabled:!g,title:"Сохранить (Ctrl+S)",onClick:()=>c(l.path),children:g?"Сохранить":"Сохранено"})]}),l.stale&&a.jsxs("div",{className:"editor__warn",children:[a.jsxs("span",{children:["Файл изменился на диске",g?" — а здесь есть несохранённые правки.":"."]}),a.jsx("button",{className:"btn btn--sm",onClick:()=>o(l.path),children:"Взять с диска"}),g&&a.jsx("button",{className:"btn btn--sm btn--danger",onClick:()=>d(l.path),children:"Сохранить поверх"})]}),l.binary&&l.mediaMime?a.jsx(Hj,{path:l.path,mime:l.mediaMime,base64:l.mediaBase64,error:l.mediaError,tooLarge:l.mediaTooLarge,size:l.size,onRequestMedia:h},l.path):l.binary?a.jsxs("p",{className:"editor__empty",children:["Это не текстовый файл — редактировать его здесь нечем. ",$f(l.size)," на диске."]}):l.tooLarge?a.jsxs("p",{className:"editor__empty",children:["Файл слишком велик для редактора (",$f(l.size),"). Такие правит агент, а не браузер."]}):x&&l.previewMode?a.jsx(Xj,{text:l.text}):a.jsx(Rj,{path:l.path,doc:l.text,revision:l.revision,goto:s,onChange:r,onSave:c})]})}function Xj({text:l}){const[s,r]=_.useState("");return _.useEffect(()=>{let c=!1;return sd(l).then(o=>{c||r(o)}),()=>{c=!0}},[l]),a.jsx("div",{className:"markdown-preview",dangerouslySetInnerHTML:{__html:s}})}function Vj({files:l,activePath:s,busy:r,onSelect:c,onClose:o,zoomed:d,onToggleZoom:h}){return a.jsxs("div",{className:"worktabs",role:"tablist",onDoubleClick:p=>{h&&(p.target.closest("button")||h())},children:[a.jsxs("button",{className:"worktab"+(s===null?" is-on":""),role:"tab","aria-selected":s===null,onClick:()=>c(null),onDoubleClick:()=>h==null?void 0:h(),children:[a.jsx("span",{className:"worktab__name",children:"Разговор"}),r&&a.jsx("span",{className:"worktab__dot worktab__dot--busy",title:"Агент работает"})]}),l.map(p=>a.jsxs("div",{className:"worktab"+(p.path===s?" is-on":""),role:"tab","aria-selected":p.path===s,onDoubleClick:g=>{h&&(g.target.closest(".worktab__close, .worktab__dot")||h())},children:[a.jsx("button",{className:"worktab__name",title:p.path,onClick:()=>c(p.path),children:dj(p.path)}),Ya(p)?a.jsx("button",{className:"worktab__dot",title:"Не сохранено — закрыть","aria-label":`Закрыть ${p.path}`,onClick:()=>o(p.path)}):a.jsx("button",{className:"worktab__close",title:"Закрыть","aria-label":`Закрыть ${p.path}`,onClick:()=>o(p.path),children:"✕"})]},p.path)),a.jsx("div",{className:"worktabs__spacer"}),h&&a.jsx("button",{className:"worktabs__zoom",title:d?"Свернуть — то же самое, что двойной клик по вкладке":"Развернуть на весь экран — то же самое, что двойной клик по вкладке","aria-label":d?"Свернуть колонку разговора":"Развернуть колонку разговора на весь экран","aria-pressed":d,onClick:h,children:a.jsx(Ic,{active:d})})]})}function hs(l){return l.claudeSessionId??l.id}function Af(l,s,r,c){if(!s||s.length===0)return l;const o=new Map(s.map((p,g)=>[p,g])),d=[],h=[];for(const p of l)(o.has(r(p))?d:h).push(p);return d.sort((p,g)=>o.get(r(p))-o.get(r(g))),c==="top"?[...h,...d]:[...d,...h]}function wb(l){return l.state!=="closed"}function Sb(l){return[...l.filter(wb),...l.filter(s=>!wb(s))]}function Mf(l,s,r,c){if(s===r||!l.includes(s)||!l.includes(r))return null;const o=l.filter(p=>p!==s),d=o.indexOf(r)+(c==="after"?1:0),h=[...o.slice(0,d),s,...o.slice(d)];return h.every((p,g)=>p===l[g])?null:h}function Op(l,s,r,c){const o=l%10,d=l%100;return o===1&&d!==11?s:o>=2&&o<=4&&(d<12||d>14)?r:c}function Y_(l){return`${l} ${Op(l,"агент","агента","агентов")}`}function Qj(l){const s=l.filter(o=>o.kind==="agent").length,r=l.length-s,c=[];return s>0&&c.push(Y_(s)),r>0&&c.push(`${r} ${Op(r,"задача","задачи","задач")} в фоне`),c.join(" · ")}function Kj(l){switch(l.kind){case"agent":return l.agentType??"агент";case"shell":return"команда";case"workflow":return"сценарий";default:return"задача"}}function Zj(l){const s=Math.max(0,Math.floor(l/1e3)),r=Math.floor(s/3600),c=Math.floor(s%3600/60),o=s%60,d=String(o).padStart(2,"0");return r>0?`${r}:${String(c).padStart(2,"0")}:${d}`:`${c}:${d}`}function Fj(l){return l<1e3?`${l} ток.`:`${(l/1e3).toFixed(1).replace(".",",")} k ток.`}function Jj({tasks:l,onStop:s}){const[r,c]=_.useState(!1),[o,d]=_.useState(()=>Date.now()),[h,p]=_.useState(()=>new Set);_.useEffect(()=>{const x=window.setInterval(()=>d(Date.now()),1e3);return()=>window.clearInterval(x)},[]),_.useEffect(()=>{p(x=>{const y=new Set(l.map(v=>v.id)),j=new Set([...x].filter(v=>y.has(v)));return j.size===x.size?x:j})},[l]);const g=x=>{p(y=>new Set(y).add(x)),s(x),window.setTimeout(()=>{p(y=>{if(!y.has(x))return y;const j=new Set(y);return j.delete(x),j})},1e4)};return a.jsxs("div",{className:r?"tasks is-open":"tasks",children:[a.jsxs("button",{type:"button",className:"tasks__toggle","aria-expanded":r,"aria-controls":"tasks-list",onClick:()=>c(x=>!x),children:[a.jsx("span",{className:"tasks__dot","aria-hidden":"true"}),a.jsx("span",{className:"tasks__summary",children:Qj(l)}),a.jsx("svg",{className:"tasks__chev",viewBox:"0 0 16 16","aria-hidden":"true",children:a.jsx("path",{d:"M4 6.5l4 4 4-4",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})]}),r&&a.jsx("ul",{className:"tasks__list",id:"tasks-list",children:l.map(x=>{const y=h.has(x.id);return a.jsxs("li",{className:y?"task is-stopping":"task",children:[a.jsxs("div",{className:"task__main",children:[a.jsxs("div",{className:"task__head",children:[a.jsx("span",{className:"task__kind",children:Kj(x)}),x.background&&a.jsx("span",{className:"task__bg",children:"фон"}),a.jsx("span",{className:"task__time",children:Zj(o-x.startedAt)})]}),a.jsx("div",{className:"task__desc",title:x.description,children:x.description}),(x.activity||x.lastTool)&&a.jsx("div",{className:"task__activity",title:x.activity??x.lastTool??void 0,children:x.activity??x.lastTool}),a.jsxs("div",{className:"task__stats",children:[Fj(x.tokens)," · ",x.toolUses," ",Op(x.toolUses,"вызов","вызова","вызовов")]})]}),a.jsx("button",{type:"button",className:"btn btn--sm btn--danger task__stop",disabled:y,"aria-label":`Остановить: ${x.description}`,onClick:()=>g(x.id),children:y?"Останавливается":"Стоп"})]},x.id)})})]})}const Wj=""+new URL("antigravity-logo-DRKQga2U.png",import.meta.url).href;function Lp({className:l}){return a.jsx("img",{src:Wj,alt:"","aria-hidden":"true",className:l,style:{aspectRatio:"200 / 184"}})}function zp({className:l}){return a.jsx("svg",{className:l,viewBox:"0 0 20 20",fill:"none","aria-label":"Codex",role:"img",children:a.jsx("path",{d:"m6.5 5-5 5 5 5M13.5 5l5 5-5 5M11.5 3l-3 14",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}const Pj=450,ew=6,tw=[{id:"claude",label:"Claude",hint:"Claude Code — как обычно"},{id:"antigravity",label:"Antigravity",hint:"Google agy, отдельная палитра и права"},{id:"codex",label:"Codex",hint:"OpenAI Codex — локальный CLI"}];function nw({disabled:l,providers:s,onStart:r}){var W,oe;const c=tw.filter(se=>s.includes(se.id)),o=c.length>1,[d,h]=_.useState(!1),[p,g]=_.useState(0),[x,y]=_.useState({left:0,top:0}),j=_.useRef(null),v=_.useRef(null),C=_.useRef(null),k=_.useId(),E=_.useRef(null);function A(){E.current&&window.clearTimeout(E.current.timer),E.current=null}function G(){A(),g(0),h(!0)}function V(se){var ge;h(!1),se&&((ge=j.current)==null||ge.focus())}function Z(se){if(l||!o||se.button!==0)return;const ge={timer:0,x:se.clientX,y:se.clientY,fired:!1};ge.timer=window.setTimeout(()=>{ge.fired=!0,G(),E.current=ge},Pj),E.current=ge}function D(se){const ge=E.current;!ge||ge.fired||Math.hypot(se.clientX-ge.x,se.clientY-ge.y)>ew&&A()}function $(){E.current&&!E.current.fired&&A()}function z(se){var ye;if((ye=E.current)!=null&&ye.fired){E.current=null,se.preventDefault();return}if(l)return;const ge=c[0];ge&&r(ge.id)}function R(se){o&&(se.preventDefault(),!l&&G())}function H(se){if(l||!o)return;(se.key==="ArrowDown"||se.key==="ArrowUp"||se.key==="Enter"&&se.shiftKey)&&(se.preventDefault(),G())}_.useLayoutEffect(()=>{if(!d)return;const se=j.current,ge=C.current;if(!se||!ge)return;const ye=se.getBoundingClientRect(),Y=ge.getBoundingClientRect(),ce=8,de=Math.max(ce,Math.min(ye.right-Y.width,window.innerWidth-Y.width-ce));let _e=ye.top-Y.height-8;_e<ce&&(_e=Math.min(ye.bottom+8,window.innerHeight-Y.height-ce)),y({left:de,top:_e})},[d]),_.useLayoutEffect(()=>{var se;d&&((se=C.current)==null||se.focus())},[d]),_.useLayoutEffect(()=>{if(!d)return;function se(ge){var Y;const ye=ge.target;(Y=v.current)!=null&&Y.contains(ye)||V(!1)}return document.addEventListener("pointerdown",se),()=>document.removeEventListener("pointerdown",se)},[d]),_.useLayoutEffect(()=>{A(),h(!1)},[l,s.join(",")]);function B(se){V(!1),r(se.id)}function le(se){if(se.key==="Escape"){se.preventDefault(),se.stopPropagation(),V(!0);return}if(se.key==="ArrowDown"||se.key==="ArrowUp"){se.preventDefault();const ge=se.key==="ArrowDown"?1:-1;g(ye=>(ye+ge+c.length)%c.length);return}if(se.key==="Enter"||se.key===" "){se.preventDefault();const ge=c[p];ge&&B(ge);return}se.key==="Tab"&&V(!1)}return a.jsxs("div",{className:"newsession"+(o?" newsession--split":""),ref:v,children:[a.jsx("button",{ref:j,type:"button",className:"btn btn--primary newsession__btn",disabled:l,title:`Новая сессия: ${((W=c[0])==null?void 0:W.label)??"агент"}`,onClick:z,onContextMenu:R,onPointerDown:Z,onPointerMove:D,onPointerUp:$,onPointerCancel:$,onPointerLeave:$,onKeyDown:H,children:"+ Сессия"}),o&&a.jsx("button",{type:"button",className:"btn btn--primary newsession__choose",disabled:l,title:"Выбрать агента","aria-label":"Выбрать агента для новой сессии","aria-haspopup":"menu","aria-expanded":d,"aria-controls":d?k:void 0,onClick:()=>d?V(!0):G(),onKeyDown:H,children:a.jsx(lw,{})}),d&&o&&a.jsx("div",{ref:C,id:k,className:"newsession__menu",style:{left:x.left,top:x.top},role:"menu","aria-label":"Выбрать агента для новой сессии","aria-activedescendant":`${k}-${(oe=c[p])==null?void 0:oe.id}`,tabIndex:-1,onKeyDown:le,children:c.map((se,ge)=>a.jsxs("button",{id:`${k}-${se.id}`,type:"button",role:"menuitem",tabIndex:-1,className:"newsession__item"+(ge===p?" is-cursor":""),onMouseEnter:()=>g(ge),onClick:()=>B(se),children:[a.jsx("span",{className:`newsession__mark newsession__mark--${se.id}`,"aria-hidden":"true",children:se.id==="antigravity"?a.jsx(Lp,{className:"newsession__mark-logo"}):se.id==="codex"?a.jsx(zp,{}):a.jsx(sw,{})}),a.jsxs("span",{className:"newsession__text",children:[a.jsx("span",{className:"newsession__label",children:se.label}),a.jsx("span",{className:"newsession__hint",children:se.hint})]})]},se.id))})]})}function lw(){return a.jsx("svg",{className:"newsession__caret",viewBox:"0 0 10 6",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"M1 1.2 5 5 9 1.2",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function sw(){return a.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:a.jsx("circle",{cx:"8",cy:"8",r:"6",fill:"var(--accent)"})})}const $_="ccv:sidebar.collapsed",X_="ccv:sidebar.mode",V_="ccv:sidebar.foldersCollapsed",aw=500,Zh="транскрипт остаётся на диске — сессию можно вернуть из архива в любой момент.";function iw({open:l,connected:s,status:r,workspaces:c,archivedWorkspaces:o,workspaceFolders:d,sessionFolders:h,pinnedFolders:p,sessions:g,archived:x,pinned:y,live:j,listOrder:v,liveSessionsFirst:C,onReorder:k,activeWorkspaceId:E,activeSessionId:A,onSelectWorkspace:G,onSelectSession:V,onRenameSession:Z,onStopSession:D,onPinSessions:$,onSelectPinned:z,onCloseWorkspaces:R,onRestoreWorkspaces:H,onArchiveSessions:B,onUnarchiveSessions:le,onCreateFolder:W,onRenameFolder:oe,onSetFolderColor:se,onDeleteFolder:ge,onAssignToFolder:ye,onOpenWorkspace:Y,onNewSession:ce,enabledProviders:de,onOpenExtensions:_e,account:Ce,onOpenAccount:w,relay:Q,onOpenRelay:L,onOpenSettings:be,themeMode:we,onCycleTheme:Me}){var sl;const[Oe,Ue]=_.useState(null),[qe,an]=_.useState(null),[Ke,Zt]=_.useState(null);function ct(N){return(Ke==null?void 0:Ke.folderId)===N.id?Ke.color??void 0:N.color}function dt(N){const ie=N&&ct(N);return ie?{"--folder-color":ie}:void 0}function Ge(N){return N?a.jsx("span",{className:"row__stripe","aria-hidden":"true"}):null}const rn=_.useRef(void 0),[jn,st]=_.useState(null),[wn,Jn]=_.useState(""),[cn,Wn]=_.useState(vw),[It,tt]=_.useState(jw),[Dt,qn]=_.useState(ww);function Et(N){qn(N);try{localStorage.setItem(X_,N)}catch{}}const nt=wn.trim().toLowerCase(),at=nt!=="",hn=_.useMemo(()=>Af(c,v==null?void 0:v.workspaces,N=>N.id,"bottom"),[c,v]),mn=_.useMemo(()=>{const N=Af(g,E?v==null?void 0:v.sessions[E]:void 0,hs,"top");return C?Sb(N):N},[g,v,E,C]),Qn=_.useMemo(()=>{const N=Af(y,v==null?void 0:v.pinned,hs,"bottom");return C?Sb(N):N},[y,v,C]),Pt=_.useMemo(()=>Af(j,v==null?void 0:v.live,hs,"bottom"),[j,v]),vt=_.useMemo(()=>at?hn.filter(N=>N.name.toLowerCase().includes(nt)||N.path.toLowerCase().includes(nt)):hn,[hn,nt,at]),Ft=_.useMemo(()=>at?o.filter(N=>N.name.toLowerCase().includes(nt)||N.path.toLowerCase().includes(nt)):o,[o,nt,at]),jt=_.useMemo(()=>at?mn.filter(N=>(N.title??"").toLowerCase().includes(nt)):mn,[mn,nt,at]),Pn=_.useMemo(()=>at?x.filter(N=>(N.title??"").toLowerCase().includes(nt)):x,[x,nt,at]),ne=N=>{var ie;return((ie=c.find(Ae=>Ae.id===N))==null?void 0:ie.name)??"—"},xe=N=>{var ie;return(ie=c.find(Ae=>Ae.id===N))==null?void 0:ie.path},Be=_.useMemo(()=>at?Qn.filter(N=>(N.title??"").toLowerCase().includes(nt)||ne(N.workspaceId).toLowerCase().includes(nt)):Qn,[Qn,c,nt,at]),Fe=_.useMemo(()=>at?Pt.filter(N=>(N.title??"").toLowerCase().includes(nt)||ne(N.workspaceId).toLowerCase().includes(nt)):Pt,[Pt,c,nt,at]),Ie=!at;function Ct(N){Wn(ie=>{const Ae=ie.includes(N)?ie.filter($e=>$e!==N):[...ie,N];try{localStorage.setItem($_,JSON.stringify(Ae))}catch{}return Ae})}const I=N=>!cn.includes(N);function fe(N){tt(ie=>{const Ae=ie.includes(N)?ie.filter($e=>$e!==N):[...ie,N];try{localStorage.setItem(V_,JSON.stringify(Ae))}catch{}return Ae})}const Ne=N=>!It.includes(N),Le=_.useMemo(()=>Ko(vt,d),[vt,d]),wt=_.useMemo(()=>Ko(Ft,d),[Ft,d]),Sn=_.useMemo(()=>Ko(jt,h),[jt,h]),fl=_.useMemo(()=>Ko(Pn,h),[Pn,h]),_l=_.useMemo(()=>Ko(Be,p,N=>N.pinnedFolderId),[Be,p]),gs=_.useMemo(()=>({groups:[],ungrouped:Fe}),[Fe]),ls=((v==null?void 0:v.workspaces.length)??0)>0,ss=E?(((sl=v==null?void 0:v.sessions[E])==null?void 0:sl.length)??0)>0:!1,as=((v==null?void 0:v.pinned.length)??0)>0,Va=((v==null?void 0:v.live.length)??0)>0,dl=Rf({enabled:Ie,scope:"workspaces",itemKey:N=>N.id,groups:Le.groups,ungrouped:Le.ungrouped,onReorder:k}),el=Rf({enabled:Ie,scope:"sessions",workspaceId:E??void 0,itemKey:hs,groups:Sn.groups,ungrouped:Sn.ungrouped,onReorder:k}),Ot=Rf({enabled:Ie,scope:"pinned",itemKey:hs,groups:_l.groups,ungrouped:_l.ungrouped,onReorder:k}),Ze=Rf({enabled:Ie,scope:"live",itemKey:hs,groups:gs.groups,ungrouped:gs.ungrouped,onReorder:k});_.useEffect(()=>{var Ae;if(!Ke)return;const ie=(Ae=[..._l.groups,...Le.groups,...wt.groups,...Sn.groups,...fl.groups].find($e=>$e.folder.id===Ke.folderId))==null?void 0:Ae.folder;ie&&ie.color===(Ke.color??void 0)&&Zt(null)},[Ke,_l,Le,wt,Sn,fl]),_.useEffect(()=>()=>window.clearTimeout(rn.current),[]);const gn=Jh(vt),Xt=Jh(Ft),yl=Jh(jt),[Jt,xs]=_.useState(null),[Vt,bs]=_.useState(null),[bt,Rn]=_.useState(null),[Dn,Nn]=_.useState(null),[ot,At]=_.useState(null),Cl=_.useRef(null);function on(N,ie){const Ae=N.touches[0];if(!Ae)return;const $e={timer:0,x:Ae.clientX,y:Ae.clientY,el:N.currentTarget,fired:!1};$e.timer=window.setTimeout(()=>{$e.fired=!0,ie($e.x,$e.y,$e.el)},aw),Cl.current=$e}function Gn(N){const ie=Cl.current,Ae=N.touches[0];!ie||!Ae||Math.hypot(Ae.clientX-ie.x,Ae.clientY-ie.y)>10&&(window.clearTimeout(ie.timer),Cl.current=null)}function tl(N){const ie=Cl.current;ie&&(window.clearTimeout(ie.timer),ie.fired&&N.preventDefault())}function vl(){var N;return(N=Cl.current)!=null&&N.fired?(Cl.current=null,!0):!1}function Al(){const N=Jt==null?void 0:Jt.opener;xs(null),N!=null&&N.isConnected&&N.focus()}function nl(){const N=Vt==null?void 0:Vt.opener;bs(null),N!=null&&N.isConnected&&N.focus()}function ll(){const N=bt==null?void 0:bt.opener;Rn(null),N!=null&&N.isConnected&&N.focus()}function Lt(){const N=Dn==null?void 0:Dn.opener;Nn(null),N!=null&&N.isConnected&&N.focus()}function On(){const N=ot==null?void 0:ot.opener;At(null),N!=null&&N.isConnected&&N.focus()}function zt(N){return{onContextMenu:ie=>{ie.preventDefault(),xs({x:ie.clientX,y:ie.clientY,opener:ie.currentTarget,ids:gn.targetsFor(N)})},onTouchStart:ie=>on(ie,(Ae,$e,Yn)=>xs({x:Ae,y:$e,opener:Yn,ids:gn.targetsFor(N)})),onTouchMove:Gn,onTouchEnd:tl,onTouchCancel:tl}}function _s(N){return{onContextMenu:ie=>{ie.preventDefault(),bs({x:ie.clientX,y:ie.clientY,opener:ie.currentTarget,ids:Xt.targetsFor(N)})},onTouchStart:ie=>on(ie,(Ae,$e,Yn)=>bs({x:Ae,y:$e,opener:Yn,ids:Xt.targetsFor(N)})),onTouchMove:Gn,onTouchEnd:tl,onTouchCancel:tl}}function Ii(N){return{onContextMenu:ie=>{ie.preventDefault(),Rn({x:ie.clientX,y:ie.clientY,opener:ie.currentTarget,ids:yl.targetsFor(N)})},onTouchStart:ie=>on(ie,(Ae,$e,Yn)=>Rn({x:Ae,y:$e,opener:Yn,ids:yl.targetsFor(N)})),onTouchMove:Gn,onTouchEnd:tl,onTouchCancel:tl}}function $l(N){return{onContextMenu:ie=>{ie.preventDefault(),Nn({x:ie.clientX,y:ie.clientY,opener:ie.currentTarget,ids:[N.id]})},onTouchStart:ie=>on(ie,(Ae,$e,Yn)=>Nn({x:Ae,y:$e,opener:Yn,ids:[N.id]})),onTouchMove:Gn,onTouchEnd:tl,onTouchCancel:tl}}function ys(N){return{onContextMenu:ie=>{ie.preventDefault(),At({x:ie.clientX,y:ie.clientY,opener:ie.currentTarget,ids:[N.id]})},onTouchStart:ie=>on(ie,(Ae,$e,Yn)=>At({x:Ae,y:$e,opener:Yn,ids:[N.id]})),onTouchMove:Gn,onTouchEnd:tl,onTouchCancel:tl}}const xn=g.filter(N=>N.state!=="closed").length,Xl=Jt?vt.find(N=>N.id===Jt.ids[0]):void 0,kn=Jt?[{id:"close",label:Jt.ids.length>1?`Закрыть проекты (${Jt.ids.length})`:"Закрыть проект",onSelect:()=>{R(Jt.ids),gn.clear()}},...Zo({folders:d,ids:Jt.ids,hasFolder:(Xl==null?void 0:Xl.folderId)!=null,assign:(N,ie)=>ye("workspace",N,ie),onClear:()=>gn.clear(),onNewFolder:()=>st("workspace")}),...Jt.ids.length===1&&Ie?dl.menuItems(Jt.ids[0],ls):[]]:[],vs=Jt?"закрытие не удаляет проект: каталог и история сессий остаются на диске — открыть его снова можно кнопкой «+ Проект»."+(E&&Jt.ids.includes(E)&&xn>0?` в нём сейчас незавершённых сессий: ${xn} — при закрытии они остановятся на хосте.`:""):void 0,is=Vt?Ft.find(N=>N.id===Vt.ids[0]):void 0,rs=Vt?[{id:"restore",label:Vt.ids.length>1?`Вернуть проекты (${Vt.ids.length})`:"Вернуть проект",onSelect:()=>{H(Vt.ids),Xt.clear()}},...Zo({folders:d,ids:Vt.ids,hasFolder:(is==null?void 0:is.folderId)!=null,assign:(N,ie)=>ye("workspace",N,ie),onClear:()=>Xt.clear(),onNewFolder:()=>st("workspace")})]:[],Ml=Vt?"каталог и история сессий всё это время оставались на диске — восстановление их не трогает.":void 0,me=bt?jt.find(N=>N.id===bt.ids[0]):void 0,T=(me==null?void 0:me.pinned)!==!0,K=bt?[...bt.ids.length===1?[{id:"rename",label:"Переименовать",onSelect:()=>Ue(bt.ids[0])}]:[],{id:"pin",label:T?bt.ids.length>1?`Закрепить (${bt.ids.length})`:"Закрепить":bt.ids.length>1?`Открепить (${bt.ids.length})`:"Открепить",onSelect:()=>{me&&$(me.workspaceId,bt.ids,T),yl.clear()}},{id:"archive",label:bt.ids.length>1?`Убрать в архив (${bt.ids.length})`:"Убрать в архив",onSelect:()=>{B(E,bt.ids),yl.clear()}},...Zo({folders:h,ids:bt.ids,hasFolder:(me==null?void 0:me.folderId)!=null,assign:(N,ie)=>ye("session",N,ie,E),onClear:()=>yl.clear(),onNewFolder:()=>st("session")}),...bt.ids.length===1&&Ie&&me?el.menuItems(hs(me),ss):[]]:[],pe=bt?Zh:void 0,je=Dn?Be.find(N=>N.id===Dn.ids[0]):void 0,He=Dn?[{id:"rename",label:"Переименовать",onSelect:()=>Ue(Dn.ids[0])},{id:"unpin",label:"Открепить",onSelect:()=>{je&&$(je.workspaceId,[je.id],!1)}},{id:"archive",label:"Убрать в архив",onSelect:()=>{je&&B(je.workspaceId,[je.id])}},...je&&je.workspaceId===E?Zo({folders:h,ids:[je.id],hasFolder:je.folderId!=null,assign:(N,ie)=>ye("session",N,ie,je.workspaceId),onClear:()=>{},onNewFolder:()=>st("session")}):[],...uw(je?Zo({folders:p,ids:[je.id],hasFolder:je.pinnedFolderId!=null,assign:(N,ie)=>ye("pinned",N,ie),onClear:()=>{},onNewFolder:()=>st("pinned")}):[]),...Ie&&je?Ot.menuItems(hs(je),as):[]]:[],Re=ot?Fe.find(N=>N.id===ot.ids[0]):void 0,St=ot?[{id:"stop",label:"Остановить",onSelect:()=>{Re&&D(Re)}},{id:"rename",label:"Переименовать",onSelect:()=>Ue(ot.ids[0])},{id:"pin",label:(Re==null?void 0:Re.pinned)===!0?"Открепить":"Закрепить",onSelect:()=>{Re&&$(Re.workspaceId,[Re.id],Re.pinned!==!0)}},{id:"archive",label:"Убрать в архив",onSelect:()=>{Re&&B(Re.workspaceId,[Re.id])}},...Ie&&Re?Ze.menuItems(hs(Re),Va):[]]:[];function ht(N,ie){return a.jsxs("div",{"data-row-key":N.id,className:yc(N.id===E,gn.selected.includes(N.id),!1,!!ie)+dl.dropClass(N.id),style:dt(ie),...zt(N),children:[Ge(ie),Ie&&a.jsx("button",{type:"button",className:"row__grip",title:"Перетащить, чтобы изменить порядок","aria-label":"Перетащить проект, чтобы изменить порядок в списке",...dl.gripHandlers(N.id),children:a.jsx(Df,{})}),a.jsxs("button",{className:"row__main",onClick:Ae=>{vl()||gn.click(Ae,N,()=>G(N.id))},onKeyDown:Ae=>dl.onKeyDown(N.id,Ae),children:[a.jsxs("span",{className:"row__title",children:[N.name,N.hasClaudeMd&&" ·"]}),a.jsx("span",{className:"row__meta",title:N.path,children:N.path})]})]},N.id)}function en(N,ie){return a.jsxs("div",{className:yc(N.id===E,Xt.selected.includes(N.id),!1,!!ie),style:dt(ie),..._s(N),children:[Ge(ie),a.jsxs("button",{className:"row__main",onClick:Ae=>{vl()||Xt.click(Ae,N,()=>G(N.id))},children:[a.jsxs("span",{className:"row__title",children:[N.name,N.hasClaudeMd&&" ·"]}),a.jsx("span",{className:"row__meta",children:Mw(N)})]}),a.jsx("button",{className:"row__restore",title:"Вернуть проект из архива",onClick:()=>H([N.id]),children:"Вернуть"})]},N.id)}function pt(N,ie){const Ae=hs(N);return a.jsxs("div",{"data-row-key":Ae,className:yc(N.id===A,yl.selected.includes(N.id),N.provider,!!ie)+el.dropClass(Ae),style:dt(ie),...Oe===N.id?{}:Ii(N),children:[Ge(ie),Oe===N.id?a.jsx("div",{className:"row__main",children:a.jsx(fa,{value:N.title??"",onCommit:$e=>{Z(N,$e),Ue(null)},onCancel:()=>Ue(null)})}):a.jsxs(a.Fragment,{children:[Ie&&a.jsx("button",{type:"button",className:"row__grip",title:"Перетащить, чтобы изменить порядок","aria-label":"Перетащить сессию, чтобы изменить порядок в списке",...el.gripHandlers(Ae),children:a.jsx(Df,{})}),a.jsxs("button",{className:"row__main",onClick:$e=>{vl()||yl.click($e,N,()=>V(N))},onKeyDown:$e=>el.onKeyDown(Ae,$e),children:[a.jsx(Of,{title:N.title??"Без названия",pinned:N.pinned===!0,provider:N.provider,projectName:ne(N.workspaceId),projectPath:xe(N.workspaceId)}),a.jsx(Wh,{session:N,tail:new Date(N.updatedAt).toLocaleString()})]}),a.jsx("button",{className:"row__edit",title:"Переименовать","aria-label":"Переименовать сессию",onClick:()=>{vl()||Ue(N.id)},children:"✎"})]})]},N.id)}function un(N,ie){return a.jsxs("div",{className:yc(N.id===A,!1,N.provider,!!ie),style:dt(ie),children:[Ge(ie),a.jsxs("button",{className:"row__main",onClick:()=>V(N),children:[a.jsx(Of,{title:N.title??"Без названия",pinned:!1,provider:N.provider,projectName:ne(N.workspaceId),projectPath:xe(N.workspaceId)}),a.jsx("span",{className:"row__meta",children:Aw(N)})]}),a.jsx("button",{className:"row__restore",title:"Вернуть сессию из архива",onClick:()=>le([N.id]),children:"Вернуть"})]},N.id)}function Qt(N,ie){const Ae=hs(N);return a.jsxs("div",{"data-row-key":Ae,className:yc(N.id===A,!1,N.provider,!!ie)+Ot.dropClass(Ae),style:dt(ie),...Oe===N.id?{}:{title:"Действия со строкой — правый клик или долгое нажатие",...$l(N)},children:[Ge(ie),Oe===N.id?a.jsx("div",{className:"row__main",children:a.jsx(fa,{value:N.title??"",onCommit:$e=>{Z(N,$e),Ue(null)},onCancel:()=>Ue(null)})}):a.jsxs(a.Fragment,{children:[Ie&&a.jsx("button",{type:"button",className:"row__grip",title:"Перетащить, чтобы изменить порядок","aria-label":"Перетащить сессию, чтобы изменить порядок в списке",...Ot.gripHandlers(Ae),children:a.jsx(Df,{})}),a.jsxs("button",{className:"row__main",onClick:()=>{vl()||z(N)},onKeyDown:$e=>Ot.onKeyDown(Ae,$e),children:[a.jsx(Of,{title:N.title??"Без названия",pinned:!1,provider:N.provider,projectName:ne(N.workspaceId),projectPath:xe(N.workspaceId)}),a.jsx(Wh,{session:N,tail:new Date(N.updatedAt).toLocaleString()})]})]})]},N.id)}function Vl(N){const ie=hs(N);return a.jsx("div",{"data-row-key":ie,className:yc(N.id===A,!1,N.provider)+Ze.dropClass(ie),...Oe===N.id?{}:{title:"Действия со строкой — правый клик или долгое нажатие",...ys(N)},children:Oe===N.id?a.jsx("div",{className:"row__main",children:a.jsx(fa,{value:N.title??"",onCommit:Ae=>{Z(N,Ae),Ue(null)},onCancel:()=>Ue(null)})}):a.jsxs(a.Fragment,{children:[Ie&&a.jsx("button",{type:"button",className:"row__grip",title:"Перетащить, чтобы изменить порядок","aria-label":"Перетащить сессию, чтобы изменить порядок в списке",...Ze.gripHandlers(ie),children:a.jsx(Df,{})}),a.jsxs("button",{className:"row__main",onClick:()=>{vl()||z(N)},onKeyDown:Ae=>Ze.onKeyDown(ie,Ae),children:[a.jsx(Of,{title:N.title??"Без названия",pinned:N.pinned===!0,provider:N.provider,projectName:ne(N.workspaceId),projectPath:xe(N.workspaceId)}),a.jsx(Wh,{session:N,tail:new Date(N.updatedAt).toLocaleString()})]}),a.jsx("button",{type:"button",className:"row__stop",title:"Остановить сессию","aria-label":"Остановить сессию",onClick:Ae=>{Ae.stopPropagation(),!vl()&&D(N)},children:a.jsx(xw,{})})]})},N.id)}function Ln(N,ie){return a.jsx(mw,{folder:N,count:ie,open:Ne(N.id),renaming:qe===N.id,onToggle:()=>fe(N.id),onStartRename:()=>an(N.id),onCommitRename:Ae=>{oe(N.id,Ae),an(null)},onCancelRename:()=>an(null),onDelete:()=>ge(N.id),color:ct(N),onPreviewColor:Ae=>{window.clearTimeout(rn.current),Zt({folderId:N.id,color:Ae})},onCommitColor:Ae=>{Zt({folderId:N.id,color:Ae}),se(N.id,Ae),window.clearTimeout(rn.current),rn.current=window.setTimeout(()=>Zt(null),4e3)},onResetColor:()=>{window.clearTimeout(rn.current),Zt(null),se(N.id,null)}},N.id)}return a.jsxs("aside",{className:l?"sidebar sidebar--open":"sidebar",children:[a.jsxs("div",{className:"sidebar__head",children:[a.jsx("span",{className:s?"dot dot--on":"dot",title:r}),a.jsx("span",{className:"brand",children:"Claude Code Visual"}),a.jsx("button",{className:"theme-btn",title:`Тема: ${kb[we]}`,"aria-label":`Тема: ${kb[we]}. Переключить`,onClick:Me,children:a.jsx(Sw,{mode:we})})]}),a.jsxs("div",{className:"sidebar__tabs",role:"tablist","aria-label":"Что показывать в списке",children:[a.jsx("button",{type:"button",role:"tab","aria-selected":Dt==="default",className:Dt==="default"?"sidebar__tab is-active":"sidebar__tab",onClick:()=>Et("default"),children:a.jsx("span",{className:"sidebar__tab-label",children:"Все"})}),a.jsx("button",{type:"button",role:"tab","aria-selected":Dt==="pinned",className:Dt==="pinned"?"sidebar__tab is-active":"sidebar__tab",onClick:()=>Et("pinned"),children:a.jsx("span",{className:"sidebar__tab-label",children:"Закреплённые"})}),a.jsxs("button",{type:"button",role:"tab","aria-selected":Dt==="live",className:Dt==="live"?"sidebar__tab is-active":"sidebar__tab",onClick:()=>Et("live"),children:[a.jsx("span",{className:"sidebar__tab-label",children:"Запущенные"}),j.length>0&&a.jsx("span",{className:"sidebar__tab-count",children:j.length})]})]}),a.jsxs("div",{className:"fssearch fssearch--sidebar",children:[a.jsx(_w,{}),a.jsx("input",{className:"fssearch__input",type:"text",value:wn,spellCheck:!1,placeholder:"Проект или сессия…","aria-label":"Поиск по проектам и сессиям",onChange:N=>Jn(N.target.value),onKeyDown:N=>{N.stopPropagation(),N.key==="Escape"&&(N.preventDefault(),wn?Jn(""):N.currentTarget.blur())}}),wn&&a.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>Jn(""),children:"✕"})]}),a.jsx("div",{className:"sidebar__scroll",children:Dt==="pinned"?a.jsxs(a.Fragment,{children:[a.jsx(vc,{title:"Закреплённые",count:Be.length,open:I("pinned"),onToggle:()=>Ct("pinned"),action:{label:"Новая папка закреплённых",onClick:()=>{st("pinned"),I("pinned")||Ct("pinned")}}}),I("pinned")&&a.jsxs(a.Fragment,{children:[jn==="pinned"&&a.jsx("div",{className:"row",children:a.jsx("div",{className:"row__main",children:a.jsx(fa,{value:"",placeholder:"Название папки",onCommit:N=>{W("pinned",N),st(null)},onCancel:()=>st(null)})})}),Be.length===0&&a.jsx("div",{className:"row",children:a.jsx("span",{className:"row__meta",children:at?"Ничего не найдено":"закрепите сессию через её меню (правый клик или долгое нажатие) — она останется под рукой из любого проекта"})}),_l.groups.map(N=>a.jsxs(_.Fragment,{children:[Ln(N.folder,N.items.length),Ne(N.folder.id)&&N.items.map(ie=>Qt(ie,N.folder))]},N.folder.id)),_l.ungrouped.map(N=>Qt(N))]})]}):Dt==="live"?a.jsxs(a.Fragment,{children:[a.jsx(vc,{title:"Запущенные",count:Fe.length,open:I("live"),onToggle:()=>Ct("live")}),I("live")&&a.jsxs(a.Fragment,{children:[Fe.length===0&&a.jsx("div",{className:"row",children:a.jsx("span",{className:"row__meta",children:at?"Ничего не найдено":"Нет запущенных сессий"})}),Fe.map(N=>Vl(N))]})]}):a.jsxs(a.Fragment,{children:[a.jsx(vc,{title:"Проекты",count:vt.length,open:I("workspaces"),onToggle:()=>Ct("workspaces"),action:{label:"Новая папка проектов",onClick:()=>{st("workspace"),I("workspaces")||Ct("workspaces")}}}),I("workspaces")&&a.jsxs(a.Fragment,{children:[jn==="workspace"&&a.jsx("div",{className:"row",children:a.jsx("div",{className:"row__main",children:a.jsx(fa,{value:"",placeholder:"Название папки",onCommit:N=>{W("workspace",N),st(null)},onCancel:()=>st(null)})})}),vt.length===0&&a.jsx("div",{className:"row",children:a.jsx("span",{className:"row__meta",children:at?"Ничего не найдено":"Пока ни одного"})}),Le.groups.map(N=>a.jsxs(_.Fragment,{children:[Ln(N.folder,N.items.length),Ne(N.folder.id)&&N.items.map(ie=>ht(ie,N.folder))]},N.folder.id)),Le.ungrouped.map(N=>ht(N))]}),o.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(vc,{title:"Архив проектов",count:Ft.length,open:I("workspacesArchive"),onToggle:()=>Ct("workspacesArchive"),hint:"проект закрывают вручную; каталог и история сессий остаются на диске и открываются заново отсюда или через «+ Проект»"}),I("workspacesArchive")&&a.jsxs(a.Fragment,{children:[Ft.length===0&&a.jsx("div",{className:"row",children:a.jsx("span",{className:"row__meta",children:at?"Ничего не найдено":"Пока пусто"})}),wt.groups.map(N=>a.jsxs(_.Fragment,{children:[Ln(N.folder,N.items.length),Ne(N.folder.id)&&N.items.map(ie=>en(ie,N.folder))]},N.folder.id)),wt.ungrouped.map(N=>en(N))]})]}),E&&a.jsxs(a.Fragment,{children:[a.jsx(vc,{title:"Сессии",count:jt.length,open:I("sessions"),onToggle:()=>Ct("sessions"),action:{label:"Новая папка сессий",onClick:()=>{st("session"),I("sessions")||Ct("sessions")}}}),I("sessions")&&a.jsxs(a.Fragment,{children:[jn==="session"&&a.jsx("div",{className:"row",children:a.jsx("div",{className:"row__main",children:a.jsx(fa,{value:"",placeholder:"Название папки",onCommit:N=>{W("session",N,E),st(null)},onCancel:()=>st(null)})})}),jt.length===0&&a.jsx("div",{className:"row",children:a.jsx("span",{className:"row__meta",children:at?"Ничего не найдено":"Пока ни одной"})}),Sn.groups.map(N=>a.jsxs(_.Fragment,{children:[Ln(N.folder,N.items.length),Ne(N.folder.id)&&N.items.map(ie=>pt(ie,N.folder))]},N.folder.id)),Sn.ungrouped.map(N=>pt(N))]}),x.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(vc,{title:"Архив",count:Pn.length,open:I("archive"),onToggle:()=>Ct("archive"),hint:"сессии без обращения дольше двух суток уезжают сюда сами; ничего не удаляется"}),I("archive")&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"row",children:a.jsx("span",{className:"row__meta",children:"сюда сами уезжают сессии без обращения дольше двух суток; транскрипт остаётся на диске, ничего не удаляется"})}),Pn.length===0&&a.jsx("div",{className:"row",children:a.jsx("span",{className:"row__meta",children:at?"Ничего не найдено":"Пока пусто"})}),fl.groups.map(N=>a.jsxs(_.Fragment,{children:[Ln(N.folder,N.items.length),Ne(N.folder.id)&&N.items.map(ie=>un(ie,N.folder))]},N.folder.id)),fl.ungrouped.map(N=>un(N))]})]})]})]})}),a.jsxs("div",{className:"sidebar__foot",children:[w&&a.jsxs("button",{className:"account-btn",title:"Аккаунт Claude",onClick:w,children:[a.jsx("span",{className:Ce!=null&&Ce.loggedIn?"dot dot--on":"dot"}),a.jsx("span",{className:"account-btn__id",children:Ce===null?"Аккаунт":Ce.loggedIn?Ce.email||"Вход выполнен":"Войти в аккаунт"}),(Ce==null?void 0:Ce.plan)&&a.jsx("span",{className:"chip",children:Ce.plan})]}),L&&a.jsxs("button",{className:"account-btn",title:"Доступ с телефона и из браузера",onClick:L,children:[a.jsx("span",{className:Q!=null&&Q.connected?"dot dot--on":"dot"}),a.jsx("span",{className:"account-btn__id",children:Q===null?"Удалённый доступ":Q.paired?Q.connected?Q.name||"Удалённый доступ включён":"Удалённый доступ · нет связи":"Удалённый доступ"}),(Q==null?void 0:Q.connected)&&Q.clients>0&&a.jsx("span",{className:"chip",children:Q.clients})]}),a.jsxs("div",{className:"sidebar__foot-row",children:[a.jsx("button",{className:"btn btn--ghost",disabled:!_e,title:"MCP-серверы и плагины",onClick:()=>_e==null?void 0:_e(),children:"Расширения"}),a.jsx("button",{className:"btn btn--ghost",title:"Настройки приложения",onClick:be,children:"Настройки"})]}),a.jsxs("div",{className:"sidebar__foot-row",children:[a.jsx("button",{className:"btn btn--ghost",onClick:Y,children:"+ Проект"}),a.jsx(nw,{disabled:!E,providers:de,onStart:ce})]})]}),Jt&&a.jsx(zi,{x:Jt.x,y:Jt.y,items:kn,note:vs,onClose:Al}),Vt&&a.jsx(zi,{x:Vt.x,y:Vt.y,items:rs,note:Ml,onClose:nl}),bt&&a.jsx(zi,{x:bt.x,y:bt.y,items:K,note:pe,onClose:ll}),Dn&&a.jsx(zi,{x:Dn.x,y:Dn.y,items:He,note:Zh,onClose:Lt}),ot&&a.jsx(zi,{x:ot.x,y:ot.y,items:St,note:Zh,onClose:On})]})}function yc(l,s,r,c){const o=["row"];return c&&o.push("row--foldered"),l&&o.push("row--active"),s&&o.push("row--selected"),r==="antigravity"&&o.push("row--antigravity"),r==="codex"&&o.push("row--codex"),o.join(" ")}function Ko(l,s,r=c=>c.folderId){const c=new Map(s.map(p=>[p.id,p])),o=new Map,d=[];for(const p of l){const g=r(p),x=g?c.get(g):void 0;if(!x){d.push(p);continue}const y=o.get(x.id);y?y.push(p):o.set(x.id,[p])}return{groups:[...o.entries()].map(([p,g])=>({folder:c.get(p),items:g})).sort((p,g)=>p.folder.name.localeCompare(g.folder.name,"ru")),ungrouped:d}}function rw(l,s,r){return[...l.flatMap(c=>c.items.map(r)),...s.map(r)]}const cw="\0ungrouped";function ow(l,s,r){const c=new Map;for(const o of l)for(const d of o.items)c.set(r(d),o.folder.id);for(const o of s)c.set(r(o),cw);return c}function Fh(l,s,r,c,o){const d=[...s.map(p=>p.items),r].find(p=>p.some(g=>c(g)===l));if(!d)return null;const h=d.findIndex(p=>c(p)===l);return o==="up"?h<=0?null:{target:c(d[h-1]),position:"before"}:h===-1||h>=d.length-1?null:{target:c(d[h+1]),position:"after"}}function Rf(l){const[s,r]=_.useState(null),[c,o]=_.useState(null),d=_.useMemo(()=>rw(l.groups,l.ungrouped,l.itemKey),[l.groups,l.ungrouped,l.itemKey]),h=_.useMemo(()=>ow(l.groups,l.ungrouped,l.itemKey),[l.groups,l.ungrouped,l.itemKey]);function p(){r(null),o(null)}function g(G,V){l.enabled&&(V.preventDefault(),V.currentTarget.setPointerCapture(V.pointerId),r(G),o(null))}function x(G,V){var R;if(!s)return;const Z=(R=document.elementFromPoint(G,V))==null?void 0:R.closest("[data-row-key]"),D=Z==null?void 0:Z.dataset.rowKey;if(!D||D===s||h.get(D)!==h.get(s)){o(null);return}const $=Z.getBoundingClientRect(),z=V-$.top<$.height/2?"before":"after";o(H=>(H==null?void 0:H.key)===D&&H.position===z?H:{key:D,position:z})}function y(G){x(G.clientX,G.clientY)}function j(){if(s&&c){const G=Mf(d,s,c.key,c.position);G&&l.onReorder(l.scope,G,l.workspaceId)}p()}function v(G,V){if(!l.enabled)return;const Z=Fh(G,l.groups,l.ungrouped,l.itemKey,V);if(!Z)return;const D=Mf(d,G,Z.target,Z.position);D&&l.onReorder(l.scope,D,l.workspaceId)}function C(G,V){const Z=Fh(G,l.groups,l.ungrouped,l.itemKey,"up"),D=Fh(G,l.groups,l.ungrouped,l.itemKey,"down"),$=[{id:"move-up",label:"Переместить выше",disabled:!Z,onSelect:()=>{if(!Z)return;const z=Mf(d,G,Z.target,Z.position);z&&l.onReorder(l.scope,z,l.workspaceId)}},{id:"move-down",label:"Переместить ниже",disabled:!D,onSelect:()=>{if(!D)return;const z=Mf(d,G,D.target,D.position);z&&l.onReorder(l.scope,z,l.workspaceId)}}];return V&&$.push({id:"reset-order",label:"Сбросить порядок",onSelect:()=>l.onReorder(l.scope,null,l.workspaceId)}),$}function k(G){return s===G?" row--dragging":(c==null?void 0:c.key)===G?c.position==="before"?" row--drop-before":" row--drop-after":""}function E(G){return{onPointerDown:V=>g(G,V),onPointerMove:y,onPointerUp:j,onPointerCancel:p}}function A(G,V){!V.altKey||V.key!=="ArrowUp"&&V.key!=="ArrowDown"||(V.preventDefault(),v(G,V.key==="ArrowUp"?"up":"down"))}return{dragging:s!==null,dropClass:k,gripHandlers:E,onKeyDown:A,menuItems:C}}function Zo(l){return[...[...l.folders].sort((r,c)=>r.name.localeCompare(c.name,"ru")).map(r=>({id:`folder:${r.id}`,label:`В папку «${r.name}»`,onSelect:()=>{l.ids.forEach(c=>l.assign(c,r.id)),l.onClear()}})),...l.hasFolder?[{id:"folder:none",label:"Без папки",onSelect:()=>{l.ids.forEach(r=>l.assign(r,null)),l.onClear()}}]:[],{id:"folder:new",label:"Новая папка…",onSelect:l.onNewFolder}]}function uw(l){return l.map(s=>({...s,id:`pinned:${s.id}`,label:s.id==="folder:new"?"Новая папка закреплённых…":s.id==="folder:none"?"Без папки закреплённых":s.label}))}function Jh(l){const[s,r]=_.useState([]),c=_.useRef(null);function o(){r([]),c.current=null}function d(p,g,x){if(p.ctrlKey||p.metaKey){r(y=>y.includes(g.id)?y.filter(j=>j!==g.id):[...y,g.id]),c.current=g.id;return}if(p.shiftKey&&c.current){const y=l.findIndex(v=>v.id===c.current),j=l.findIndex(v=>v.id===g.id);if(y!==-1&&j!==-1){const[v,C]=y<j?[y,j]:[j,y];r(l.slice(v,C+1).map(k=>k.id));return}}o(),c.current=g.id,x()}function h(p){return s.includes(p.id)?s:(r([p.id]),c.current=p.id,[p.id])}return{selected:s,click:d,targetsFor:h,clear:o}}const fw={display:"flex",alignItems:"center",gap:6,flex:1,minWidth:0,textAlign:"left"},dw={width:22,height:22,borderRadius:6};function vc({title:l,count:s,open:r,onToggle:c,hint:o,action:d}){const h=r?`Свернуть «${l}»`:`Развернуть «${l}»`;return a.jsxs("div",{className:"sidebar__section",children:[a.jsxs("button",{className:"sidebar__section--btn",style:fw,"aria-expanded":r,title:o?`${h} — ${o}`:h,onClick:c,children:[a.jsx(Q_,{open:r}),a.jsx("span",{className:"sidebar__section-name",children:l}),a.jsx("span",{className:"sidebar__count",children:s})]}),d&&a.jsx("button",{className:"theme-btn",style:dw,title:d.label,"aria-label":d.label,onClick:d.onClick,children:a.jsx(yw,{})})]})}const Nb={paddingLeft:22},hw={display:"flex",alignItems:"center",gap:6,width:"100%"},pw={flex:1,minWidth:0,color:"var(--text-2)",fontWeight:500};function mw({folder:l,count:s,open:r,renaming:c,onToggle:o,onStartRename:d,onCommitRename:h,onCancelRename:p,onDelete:g,color:x,onPreviewColor:y,onCommitColor:j,onResetColor:v}){const C=_.useRef(null),k=_.useRef(j);return k.current=j,_.useEffect(()=>{const E=C.current;if(!E)return;const A=()=>k.current(E.value);return E.addEventListener("change",A),()=>E.removeEventListener("change",A)},[c]),c?a.jsx("div",{className:"row",style:Nb,children:a.jsx("div",{className:"row__main",children:a.jsx(fa,{value:l.name,placeholder:"Название папки",onCommit:h,onCancel:p})})}):a.jsxs("div",{className:"row",style:Nb,children:[a.jsxs("button",{className:"row__main",style:hw,"aria-expanded":r,title:r?`Свернуть папку «${l.name}»`:`Развернуть папку «${l.name}»`,onClick:o,children:[a.jsx(Q_,{open:r}),a.jsx("span",{style:pw,children:l.name}),a.jsx("span",{className:"sidebar__count",children:s})]}),a.jsx("button",{className:"row__edit",title:"Переименовать папку","aria-label":`Переименовать папку «${l.name}»`,onClick:d,children:"✎"}),a.jsxs("label",{className:x?"row__swatch row__swatch--set":"row__swatch",title:`Цвет папки «${l.name}»`,children:[a.jsx("span",{className:"row__swatch-dot",style:x?{background:x}:void 0}),a.jsx("input",{ref:C,type:"color",value:x??gw(),"aria-label":`Цвет папки «${l.name}»`,onChange:E=>y(E.target.value)})]}),l.color&&a.jsx("button",{className:"row__edit",title:"Сбросить цвет папки","aria-label":`Сбросить цвет папки «${l.name}»`,onClick:v,children:"↺"}),a.jsx("button",{className:"row__edit",title:"Удалить папку — содержимое останется, просто станет без папки","aria-label":`Удалить папку «${l.name}»`,onClick:g,children:"✕"})]})}function gw(){const l=getComputedStyle(document.documentElement).getPropertyValue("--folder-default").trim();return/^#[0-9a-f]{6}$/i.test(l)?l.toLowerCase():"#9a978d"}function Q_({open:l}){return a.jsx("svg",{className:l?"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:a.jsx("path",{d:"M6 3.5 10.5 8 6 12.5"})})}function Df(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:[a.jsx("circle",{cx:"5.5",cy:"4",r:"1.15"}),a.jsx("circle",{cx:"5.5",cy:"8",r:"1.15"}),a.jsx("circle",{cx:"5.5",cy:"12",r:"1.15"}),a.jsx("circle",{cx:"10.5",cy:"4",r:"1.15"}),a.jsx("circle",{cx:"10.5",cy:"8",r:"1.15"}),a.jsx("circle",{cx:"10.5",cy:"12",r:"1.15"})]})}function xw(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:a.jsx("rect",{x:"3.6",y:"3.6",width:"8.8",height:"8.8",rx:"1.8"})})}function bw({className:l}){return a.jsxs("svg",{className:l,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("rect",{x:"4.5",y:"2.4",width:"7",height:"4.2",rx:"1.6"}),a.jsx("path",{d:"M5.4 6.6 8 12.2 10.6 6.6"}),a.jsx("path",{d:"M8 12.2v1.4"})]})}function _w(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[a.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),a.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}function yw(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round","aria-hidden":"true",children:a.jsx("path",{d:"M8 3.2v9.6M3.2 8h9.6"})})}function vw(){try{const l=localStorage.getItem($_);if(l===null)return["archive","workspacesArchive"];const s=JSON.parse(l);return Array.isArray(s)?s.filter(r=>r==="workspaces"||r==="workspacesArchive"||r==="sessions"||r==="archive"||r==="pinned"||r==="live"):["archive","workspacesArchive"]}catch{return["archive","workspacesArchive"]}}function jw(){try{const l=localStorage.getItem(V_);if(l===null)return[];const s=JSON.parse(l);return Array.isArray(s)?s.filter(r=>typeof r=="string"):[]}catch{return[]}}function ww(){try{const l=localStorage.getItem(X_);return l==="pinned"||l==="live"?l:"default"}catch{return"default"}}const kb={system:"как в системе",light:"светлая",dark:"тёмная"};function Sw({mode:l}){const s={viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};return l==="dark"?a.jsx("svg",{...s,children:a.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"})}):l==="light"?a.jsxs("svg",{...s,children:[a.jsx("circle",{cx:"8",cy:"8",r:"3.1"}),a.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"})]}):a.jsxs("svg",{...s,children:[a.jsx("rect",{x:"1.8",y:"2.6",width:"12.4",height:"8.4",rx:"1.4"}),a.jsx("path",{d:"M5.6 13.4h4.8"})]})}function Nw(l){const s=kw(l),r=(l.tasks??[]).filter(c=>c.kind==="agent").length;return r>0?`${s} · ${Y_(r)}`:s}function kw(l){switch(l.state){case"running":return"работает";case"waiting_permission":return"ждёт разрешения";case"idle":return l.backgroundWork?"работает в фоне":Tw(l.lastTurn);case"starting":return"запускается";case"reconnecting":return"переподключается";case"error":return"ошибка";case"closed":return"на диске"}}function Tw(l){switch(l){case"interrupted":return"прервана";case"stopped":return"остановлена";case"failed":return"оборвалась";case"completed":return"готова";case null:return"ждёт задачу"}}function Ew(l){switch(l.state){case"running":return"running";case"starting":return"starting";case"reconnecting":return"reconnecting";case"waiting_permission":return"waiting";case"idle":return l.backgroundWork?"background":Cw(l.lastTurn);case"error":return"error";case"closed":return"closed"}}function Cw(l){switch(l){case"interrupted":case"stopped":return"halted";case"failed":return"error";case"completed":return"ready";case null:return"fresh"}}function Wh({session:l,tail:s}){return a.jsxs("span",{className:"row__meta",children:[a.jsxs("span",{className:`row__state row__state--${Ew(l)}`,children:[a.jsx("span",{className:"row__state-dot","aria-hidden":"true"}),Nw(l)]})," · ",s]})}function Of({title:l,pinned:s,provider:r,projectName:c,projectPath:o}){return a.jsxs("span",{className:"row__head",children:[a.jsxs("span",{className:"row__title",children:[s&&a.jsx(bw,{className:"row__pin"}),r==="antigravity"&&a.jsx(Lp,{className:"row__provider"}),r==="codex"&&a.jsx(zp,{className:"row__provider row__provider--codex"}),l]}),a.jsx("span",{className:"row__project",title:o,children:c})]})}function Aw(l){const s=l.archivedAuto?"сама, по сроку молчания":"убрана вручную";return l.archivedAt?`${new Date(l.archivedAt).toLocaleString()} · ${s}`:s}function Mw(l){return l.archivedAt?`закрыт ${new Date(l.archivedAt).toLocaleString()}`:"закрыт"}const K_=1500;function Z_(l){const s=[];let r=!1;for(const c of l.patch.split(`
117
+ `,v),k=C<0?j.length:C;if(k>v&&c(j.slice(v,k),y),C<0)break;o(),v=C+1}p=x}}ej(s,r,(x,y,j)=>{g(x,""),g(y,j)},d,h),g(h,"")}class nj{constructor(s,r,c){this.at=s,this.highlighters=r,this.span=c,this.class=""}startSpan(s,r){r!=this.class&&(this.flush(s),s>this.at&&(this.at=s),this.class=r)}flush(s){s>this.at&&this.class&&this.span(this.at,s,this.class)}highlightRange(s,r,c,o,d){let{type:h,from:p,to:g}=s;if(p>=c||g<=r)return;h.isTop&&(d=this.highlighters.filter(C=>!C.scope||C.scope(h)));let x=o,y=lj(s)||su.empty,j=P1(d,y.tags);if(j&&(x&&(x+=" "),x+=j,y.mode==1&&(o+=(o?" ":"")+j)),this.startSpan(Math.max(r,p),x),y.opaque)return;let v=s.tree&&s.tree.prop(sn.mounted);if(v&&v.overlay){let C=s.node.enter(v.overlay[0].from+p,1),k=this.highlighters.filter(A=>!A.scope||A.scope(v.tree.type)),E=s.firstChild();for(let A=0,G=p;;A++){let V=A<v.overlay.length?v.overlay[A]:null,Z=V?V.from+p:g,D=Math.max(r,G),$=Math.min(c,Z);if(D<$&&E)for(;s.from<$&&(this.highlightRange(s,D,$,o,d),this.startSpan(Math.min($,s.to),x),!(s.to>=Z||!s.nextSibling())););if(!V||Z>c)break;G=V.to+p,G>r&&(this.highlightRange(C.cursor(),Math.max(r,V.from+p),Math.min(c,G),"",k),this.startSpan(Math.min(c,G),x))}E&&s.parent()}else if(s.firstChild()){v&&(o="");do if(!(s.to<=r)){if(s.from>=c)break;this.highlightRange(s,r,c,o,d),this.startSpan(Math.min(c,s.to),x)}while(s.nextSibling());s.parent()}}}function lj(l){let s=l.type.prop(U_);for(;s&&s.context&&!l.matchContext(s.context);)s=s.next;return s||null}const Se=ps.define,Sf=Se(),Di=Se(),xb=Se(Di),bb=Se(Di),Oi=Se(),Nf=Se(Oi),Kh=Se(Oi),ca=Se(),gr=Se(ca),la=Se(),sa=Se(),gp=Se(),Qo=Se(gp),kf=Se(),Ee={comment:Sf,lineComment:Se(Sf),blockComment:Se(Sf),docComment:Se(Sf),name:Di,variableName:Se(Di),typeName:xb,tagName:Se(xb),propertyName:bb,attributeName:Se(bb),className:Se(Di),labelName:Se(Di),namespace:Se(Di),macroName:Se(Di),literal:Oi,string:Nf,docString:Se(Nf),character:Se(Nf),attributeValue:Se(Nf),number:Kh,integer:Se(Kh),float:Se(Kh),bool:Se(Oi),regexp:Se(Oi),escape:Se(Oi),color:Se(Oi),url:Se(Oi),keyword:la,self:Se(la),null:Se(la),atom:Se(la),unit:Se(la),modifier:Se(la),operatorKeyword:Se(la),controlKeyword:Se(la),definitionKeyword:Se(la),moduleKeyword:Se(la),operator:sa,derefOperator:Se(sa),arithmeticOperator:Se(sa),logicOperator:Se(sa),bitwiseOperator:Se(sa),compareOperator:Se(sa),updateOperator:Se(sa),definitionOperator:Se(sa),typeOperator:Se(sa),controlOperator:Se(sa),punctuation:gp,separator:Se(gp),bracket:Qo,angleBracket:Se(Qo),squareBracket:Se(Qo),paren:Se(Qo),brace:Se(Qo),content:ca,heading:gr,heading1:Se(gr),heading2:Se(gr),heading3:Se(gr),heading4:Se(gr),heading5:Se(gr),heading6:Se(gr),contentSeparator:Se(ca),list:Se(ca),quote:Se(ca),emphasis:Se(ca),strong:Se(ca),link:Se(ca),monospace:Se(ca),strikethrough:Se(ca),inserted:Se(),deleted:Se(),changed:Se(),invalid:Se(),meta:kf,documentMeta:Se(kf),annotation:Se(kf),processingInstruction:Se(kf),definition:ps.defineModifier("definition"),constant:ps.defineModifier("constant"),function:ps.defineModifier("function"),standard:ps.defineModifier("standard"),local:ps.defineModifier("local"),special:ps.defineModifier("special")};for(let l in Ee){let s=Ee[l];s instanceof ps&&(s.name=l)}H_([{tag:Ee.link,class:"tok-link"},{tag:Ee.heading,class:"tok-heading"},{tag:Ee.emphasis,class:"tok-emphasis"},{tag:Ee.strong,class:"tok-strong"},{tag:Ee.keyword,class:"tok-keyword"},{tag:Ee.atom,class:"tok-atom"},{tag:Ee.bool,class:"tok-bool"},{tag:Ee.url,class:"tok-url"},{tag:Ee.labelName,class:"tok-labelName"},{tag:Ee.inserted,class:"tok-inserted"},{tag:Ee.deleted,class:"tok-deleted"},{tag:Ee.literal,class:"tok-literal"},{tag:Ee.string,class:"tok-string"},{tag:Ee.number,class:"tok-number"},{tag:[Ee.regexp,Ee.escape,Ee.special(Ee.string)],class:"tok-string2"},{tag:Ee.variableName,class:"tok-variableName"},{tag:Ee.local(Ee.variableName),class:"tok-variableName tok-local"},{tag:Ee.definition(Ee.variableName),class:"tok-variableName tok-definition"},{tag:Ee.special(Ee.variableName),class:"tok-variableName2"},{tag:Ee.definition(Ee.propertyName),class:"tok-propertyName tok-definition"},{tag:Ee.typeName,class:"tok-typeName"},{tag:Ee.namespace,class:"tok-namespace"},{tag:Ee.className,class:"tok-className"},{tag:Ee.macroName,class:"tok-macroName"},{tag:Ee.propertyName,class:"tok-propertyName"},{tag:Ee.operator,class:"tok-operator"},{tag:Ee.comment,class:"tok-comment"},{tag:Ee.meta,class:"tok-meta"},{tag:Ee.invalid,class:"tok-invalid"},{tag:Ee.punctuation,class:"tok-punctuation"}]);const sj="modulepreload",aj=function(l,s){return new URL(l,s).href},_b={},We=function(s,r,c){let o=Promise.resolve();if(r&&r.length>0){let h=function(y){return Promise.all(y.map(j=>Promise.resolve(j).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};const p=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),x=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));o=h(r.map(y=>{if(y=aj(y,c),y in _b)return;_b[y]=!0;const j=y.endsWith(".css"),v=j?'[rel="stylesheet"]':"";if(!!c)for(let E=p.length-1;E>=0;E--){const A=p[E];if(A.href===y&&(!j||A.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${y}"]${v}`))return;const k=document.createElement("link");if(k.rel=j?"stylesheet":sj,j||(k.as="script"),k.crossOrigin="",k.href=y,x&&k.setAttribute("nonce",x),document.head.appendChild(k),j)return new Promise((E,A)=>{k.addEventListener("load",E),k.addEventListener("error",()=>A(new Error(`Unable to preload CSS for ${y}`)))})}))}function d(h){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=h,window.dispatchEvent(p),!p.defaultPrevented)throw h}return o.then(h=>{for(const p of h||[])p.status==="rejected"&&d(p.reason);return s().catch(d)})},B_={js:async()=>(await We(async()=>{const{javascript:l}=await import("./index-BENS1Et2.js");return{javascript:l}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({jsx:!0}),cjs:async()=>(await We(async()=>{const{javascript:l}=await import("./index-BENS1Et2.js");return{javascript:l}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript(),mjs:async()=>(await We(async()=>{const{javascript:l}=await import("./index-BENS1Et2.js");return{javascript:l}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript(),jsx:async()=>(await We(async()=>{const{javascript:l}=await import("./index-BENS1Et2.js");return{javascript:l}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({jsx:!0}),ts:async()=>(await We(async()=>{const{javascript:l}=await import("./index-BENS1Et2.js");return{javascript:l}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({typescript:!0}),mts:async()=>(await We(async()=>{const{javascript:l}=await import("./index-BENS1Et2.js");return{javascript:l}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({typescript:!0}),cts:async()=>(await We(async()=>{const{javascript:l}=await import("./index-BENS1Et2.js");return{javascript:l}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({typescript:!0}),tsx:async()=>(await We(async()=>{const{javascript:l}=await import("./index-BENS1Et2.js");return{javascript:l}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({typescript:!0,jsx:!0}),json:async()=>(await We(async()=>{const{json:l}=await import("./index-BS_AsIEi.js");return{json:l}},__vite__mapDeps([6,1,2,3,4]),import.meta.url)).json(),jsonc:async()=>(await We(async()=>{const{json:l}=await import("./index-BS_AsIEi.js");return{json:l}},__vite__mapDeps([6,1,2,3,4]),import.meta.url)).json(),css:async()=>(await We(async()=>{const{css:l}=await import("./index-ChH2BaGk.js");return{css:l}},__vite__mapDeps([7,1,2,3,4]),import.meta.url)).css(),scss:async()=>(await We(async()=>{const{css:l}=await import("./index-ChH2BaGk.js");return{css:l}},__vite__mapDeps([7,1,2,3,4]),import.meta.url)).css(),less:async()=>(await We(async()=>{const{css:l}=await import("./index-ChH2BaGk.js");return{css:l}},__vite__mapDeps([7,1,2,3,4]),import.meta.url)).css(),html:async()=>(await We(async()=>{const{html:l}=await import("./index-CQpgnjUL.js");return{html:l}},__vite__mapDeps([8,1,7,2,3,4,0,5]),import.meta.url)).html(),htm:async()=>(await We(async()=>{const{html:l}=await import("./index-CQpgnjUL.js");return{html:l}},__vite__mapDeps([8,1,7,2,3,4,0,5]),import.meta.url)).html(),vue:async()=>(await We(async()=>{const{html:l}=await import("./index-CQpgnjUL.js");return{html:l}},__vite__mapDeps([8,1,7,2,3,4,0,5]),import.meta.url)).html(),svelte:async()=>(await We(async()=>{const{html:l}=await import("./index-CQpgnjUL.js");return{html:l}},__vite__mapDeps([8,1,7,2,3,4,0,5]),import.meta.url)).html(),md:async()=>(await We(async()=>{const{markdown:l}=await import("./index-EFEGjfDS.js");return{markdown:l}},__vite__mapDeps([9,3,4,2,5,8,1,7,0]),import.meta.url)).markdown(),markdown:async()=>(await We(async()=>{const{markdown:l}=await import("./index-EFEGjfDS.js");return{markdown:l}},__vite__mapDeps([9,3,4,2,5,8,1,7,0]),import.meta.url)).markdown(),py:async()=>(await We(async()=>{const{python:l}=await import("./index-ClcgV2Ok.js");return{python:l}},__vite__mapDeps([10,1,2,3,4,5]),import.meta.url)).python(),pyi:async()=>(await We(async()=>{const{python:l}=await import("./index-ClcgV2Ok.js");return{python:l}},__vite__mapDeps([10,1,2,3,4,5]),import.meta.url)).python(),yaml:async()=>(await We(async()=>{const{yaml:l}=await import("./index-COgGuYuk.js");return{yaml:l}},__vite__mapDeps([11,1,2,3,4]),import.meta.url)).yaml(),yml:async()=>(await We(async()=>{const{yaml:l}=await import("./index-COgGuYuk.js");return{yaml:l}},__vite__mapDeps([11,1,2,3,4]),import.meta.url)).yaml(),rs:async()=>(await We(async()=>{const{rust:l}=await import("./index-DaeDM5ye.js");return{rust:l}},__vite__mapDeps([12,1,2,3,4]),import.meta.url)).rust(),c:async()=>(await We(async()=>{const{cpp:l}=await import("./index-CaQnLaP1.js");return{cpp:l}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),h:async()=>(await We(async()=>{const{cpp:l}=await import("./index-CaQnLaP1.js");return{cpp:l}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),cc:async()=>(await We(async()=>{const{cpp:l}=await import("./index-CaQnLaP1.js");return{cpp:l}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),cpp:async()=>(await We(async()=>{const{cpp:l}=await import("./index-CaQnLaP1.js");return{cpp:l}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),hpp:async()=>(await We(async()=>{const{cpp:l}=await import("./index-CaQnLaP1.js");return{cpp:l}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),java:async()=>(await We(async()=>{const{java:l}=await import("./index-BVTKBCk1.js");return{java:l}},__vite__mapDeps([14,1,2,3,4]),import.meta.url)).java(),go:async()=>(await We(async()=>{const{go:l}=await import("./index-zhxDV4zv.js");return{go:l}},__vite__mapDeps([15,1,2,3,4,5]),import.meta.url)).go(),php:async()=>(await We(async()=>{const{php:l}=await import("./index-dESUNfha.js");return{php:l}},__vite__mapDeps([16,1,8,7,2,3,4,0,5]),import.meta.url)).php(),sql:async()=>(await We(async()=>{const{sql:l}=await import("./index-BvJsiicf.js");return{sql:l}},__vite__mapDeps([17,2,3,4,1,5]),import.meta.url)).sql(),xml:async()=>(await We(async()=>{const{xml:l}=await import("./index-CdS9TWKz.js");return{xml:l}},__vite__mapDeps([18,1,2,3,4]),import.meta.url)).xml(),svg:async()=>(await We(async()=>{const{xml:l}=await import("./index-CdS9TWKz.js");return{xml:l}},__vite__mapDeps([18,1,2,3,4]),import.meta.url)).xml()},ij={".mcp.json":"json",dockerfile:"yaml",makefile:"yaml"},rj={javascript:"js",node:"js",typescript:"ts",python:"py",python3:"py",yml:"yaml",rust:"rs",golang:"go","c++":"cpp",cplusplus:"cpp"};async function cj(l){const s=rj[l.toLowerCase()]??l.toLowerCase(),r=B_[s];return r?r().catch(()=>null):null}async function oj(l){const s=(l.split("/").pop()??"").toLowerCase(),r=ij[s]??s.split(".").pop()??"",c=B_[r];return c?c().catch(()=>null):null}const uj=H_([{tag:[Ee.keyword,Ee.modifier,Ee.controlKeyword,Ee.moduleKeyword],class:"cmh-key"},{tag:[Ee.propertyName],class:"cmh-prop"},{tag:[Ee.function(Ee.variableName),Ee.labelName],class:"cmh-fn"},{tag:[Ee.color,Ee.constant(Ee.name),Ee.standard(Ee.name),Ee.bool],class:"cmh-const"},{tag:[Ee.typeName,Ee.className,Ee.changed,Ee.annotation,Ee.self,Ee.namespace],class:"cmh-type"},{tag:[Ee.number,Ee.integer,Ee.float],class:"cmh-num"},{tag:[Ee.string,Ee.special(Ee.string),Ee.regexp],class:"cmh-str"},{tag:[Ee.operator,Ee.operatorKeyword,Ee.escape],class:"cmh-op"},{tag:[Ee.meta,Ee.comment],class:"cmh-comment"},{tag:Ee.invalid,class:"cmh-invalid"}]);function Tf(l){return l.replace(/[&<>]/g,s=>s==="&"?"&amp;":s==="<"?"&lt;":"&gt;")}async function fj(l,s){const r=s?await cj(s):null;if(!r)return Tf(l);try{const c=r.language.parser.parse(l);let o="";return tj(l,c,uj,(d,h)=>{o+=h?`<span class="${h}">${Tf(d)}</span>`:Tf(d)},()=>{o+=`
118
+ `}),o}catch{return Tf(l)}}Rt.setOptions({gfm:!0,breaks:!1});function I_(l){var r;const s=(r=l.split(".").pop())==null?void 0:r.toLowerCase();return s==="md"||s==="markdown"}async function sd(l){const s=await Rt.parse(l,{async:!0,walkTokens:async r=>{if(r.type!=="code")return;const c=r;c.text=await fj(c.text,c.lang??""),c.escaped=!0}});return O1.sanitize(s)}function yb(l,s){return{path:l.path,text:l.content,saved:l.content,eol:l.eol,encoding:l.encoding,mtime:l.mtime,size:l.size,binary:l.binary,tooLarge:l.tooLarge,mediaMime:l.mediaMime,mediaTooLarge:l.mediaTooLarge,stale:!1,revision:s,previewMode:I_(l.path)}}function Ya(l){return!l.binary&&!l.tooLarge&&l.text!==l.saved}function dj(l){return l.split("/").pop()??l}function kr(l){const s=l.lastIndexOf("/");return s===-1?"":l.slice(0,s)}function $f(l){return l<1024?`${l} Б`:l<1024*1024?`${(l/1024).toFixed(1)} КБ`:`${(l/1024/1024).toFixed(1)} МБ`}function zi({x:l,y:s,items:r,note:c,onClose:o}){const d=_.useRef(null),[h,p]=_.useState({left:l,top:s}),[g,x]=_.useState(()=>{const v=r.findIndex(C=>!C.disabled);return v===-1?0:v});_.useLayoutEffect(()=>{const v=d.current;if(!v)return;const C=v.getBoundingClientRect(),k=8,E=Math.max(k,Math.min(l,window.innerWidth-C.width-k)),A=Math.max(k,Math.min(s,window.innerHeight-C.height-k));p({left:E,top:A})},[l,s]),_.useLayoutEffect(()=>{var v;(v=d.current)==null||v.focus()},[]),_.useLayoutEffect(()=>{function v(k){var E;(E=d.current)!=null&&E.contains(k.target)||o()}function C(){o()}return document.addEventListener("mousedown",v),document.addEventListener("scroll",C,!0),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("scroll",C,!0)}},[o]);function y(v){v.disabled||(v.onSelect(),o())}function j(v){if(v.key==="Escape"){v.preventDefault(),v.stopPropagation(),o();return}const C=r.map((k,E)=>({item:k,index:E})).filter(k=>!k.item.disabled);if(C.length!==0){if(v.key==="ArrowDown"||v.key==="ArrowUp"){v.preventDefault();const k=v.key==="ArrowDown"?1:-1,E=C.findIndex(G=>G.index===g),A=C[(((E===-1?0:E)+k)%C.length+C.length)%C.length];A&&x(A.index);return}if(v.key==="Enter"||v.key===" "){v.preventDefault();const k=r[g];k&&y(k)}}}return a.jsxs("div",{ref:d,className:"ctxmenu",style:{left:h.left,top:h.top},role:"menu",tabIndex:-1,onKeyDown:j,children:[c&&a.jsx("div",{className:"ctxmenu__note",children:c}),r.map((v,C)=>a.jsxs("button",{type:"button",role:"menuitem","aria-disabled":v.disabled,className:"ctxmenu__item"+(C===g?" is-cursor":""),onMouseEnter:()=>x(C),onClick:()=>y(v),children:[a.jsx("span",{className:"ctxmenu__label",children:v.label}),v.hint&&a.jsx("span",{className:"ctxmenu__hint",children:v.hint})]},v.id))]})}const hj=3500,pj=9e3,vb=220;function Ar({result:l,onDismiss:s}){const[r,c]=_.useState(l),[o,d]=_.useState(!1);if(_.useEffect(()=>{if(!l){c(null),d(!1);return}if(c(l),d(!1),l.url)return;const p=l.ok?hj:pj,g=setTimeout(()=>d(!0),p),x=setTimeout(()=>c(null),p+vb);return()=>{clearTimeout(g),clearTimeout(x)}},[l]),!r)return null;const h=()=>{d(!0),setTimeout(()=>{c(null),s==null||s()},vb)};return a.jsxs("div",{className:"oplog "+(r.ok?"oplog--ok":"oplog--bad")+(o?" oplog--leaving":"")+(r.url?" oplog--dismissible":""),role:"status","aria-live":r.ok?"polite":"assertive",children:[r.message,r.url&&a.jsxs("a",{className:"oplog__link",href:r.url,target:"_blank",rel:"noreferrer",onClick:p=>p.stopPropagation(),children:[r.url.replace(/^https?:\/\//,"")," ↗"]}),r.url&&s&&a.jsx("button",{type:"button",className:"oplog__dismiss",title:"Закрыть","aria-label":"Закрыть сообщение",onClick:h,children:"✕"})]})}function fa({value:l,className:s,placeholder:r="Название сессии",onCommit:c,onCancel:o}){const[d,h]=_.useState(l),p=_.useRef(null);_.useEffect(()=>{var x;(x=p.current)==null||x.select()},[]);function g(){const x=d.trim();if(!x||x===l)return o();c(x)}return a.jsx("input",{ref:p,className:s?`rename ${s}`:"rename",value:d,autoFocus:!0,spellCheck:!1,placeholder:r,onChange:x=>h(x.target.value),onBlur:g,onKeyDown:x=>{x.stopPropagation(),x.key==="Enter"?(x.preventDefault(),g()):x.key==="Escape"&&(x.preventDefault(),o())}})}function Ic({active:l}){return l?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M2 5h3V2"}),a.jsx("path",{d:"M14 5h-3V2"}),a.jsx("path",{d:"M2 11h3v3"}),a.jsx("path",{d:"M14 11h-3v3"})]}):a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M5 2H2v3"}),a.jsx("path",{d:"M11 2h3v3"}),a.jsx("path",{d:"M2 11v3h3"}),a.jsx("path",{d:"M14 11v3h-3"})]})}const mj=500,xr="application/x-ccv-fs-path",gj=200;function xj({open:l,tree:s,expanded:r,activePath:c,dirty:o,gitChanges:d,result:h,searchResult:p,onSearch:g,onReveal:x,onToggle:y,onOpen:j,onCreate:v,onRename:C,onMove:k,onCopy:E,onDelete:A,onRefresh:G,onClose:V,zoomed:Z,onToggleZoom:D}){const[$,z]=_.useState(""),[R,H]=_.useState(null),[B,le]=_.useState(null),[W,oe]=_.useState(null),[se,ge]=_.useState(null),[ye,Y]=_.useState(null),[ce,de]=_.useState(null),_e=td("(hover: hover)"),Ce=_.useRef(null),w=_.useMemo(()=>yj(d),[d]);function Q(ne){return!(!W||ne===W.path||W.kind==="dir"&&ne.startsWith(`${W.path}/`)||ne===kr(W.path))}function L(ne){return!(!ye||ne===ye.path||ye.kind==="dir"&&ne.startsWith(`${ye.path}/`)||ye.mode==="cut"&&ne===kr(ye.path))}function be(ne){Y({path:ne.path,kind:ne.kind,mode:"copy"})}function we(ne){Y({path:ne.path,kind:ne.kind,mode:"cut"})}function Me(ne){!ye||!L(ne)||(ne&&!r.has(ne)&&y(ne),ye.mode==="cut"?(k(ye.path,ne),Y(null)):E(ye.path,ne))}function Oe(ne,xe){const Be=ne.touches[0];if(!Be)return;const Fe={timer:0,x:Be.clientX,y:Be.clientY,el:ne.currentTarget,fired:!1};Fe.timer=window.setTimeout(()=>{Fe.fired=!0,xe(Fe.x,Fe.y,Fe.el)},mj),Ce.current=Fe}function Ue(ne){const xe=Ce.current,Be=ne.touches[0];!xe||!Be||Math.hypot(Be.clientX-xe.x,Be.clientY-xe.y)>10&&(window.clearTimeout(xe.timer),Ce.current=null)}function qe(ne){const xe=Ce.current;xe&&(window.clearTimeout(xe.timer),xe.fired&&ne.preventDefault())}function an(){var ne;return(ne=Ce.current)!=null&&ne.fired?(Ce.current=null,!0):!1}function Ke(ne,xe,Be,Fe){z((Fe==null?void 0:Fe.path)??""),de({x:ne,y:xe,opener:Be,entry:Fe})}function Zt(){const ne=ce==null?void 0:ce.opener;de(null),ne!=null&&ne.isConnected&&ne.focus()}function ct(ne){return{onContextMenu:xe=>{xe.preventDefault(),Ke(xe.clientX,xe.clientY,xe.currentTarget,ne)},onTouchStart:xe=>Oe(xe,(Be,Fe,Ie)=>Ke(Be,Fe,Ie,ne)),onTouchMove:Ue,onTouchEnd:qe,onTouchCancel:qe}}function dt(ne){ne.target===ne.currentTarget&&(ne.preventDefault(),Ke(ne.clientX,ne.clientY,ne.currentTarget,null))}function Ge(ne){ne.target===ne.currentTarget&&Oe(ne,(xe,Be,Fe)=>Ke(xe,Be,Fe,null))}function rn(ne){if(!(ne.ctrlKey||ne.metaKey)||ne.target instanceof HTMLInputElement)return;const xe=ne.key.toLowerCase();if(xe==="v"){ne.preventDefault(),Me(Qn());return}if(!$)return;const Be=jb(s,$);Be&&(xe==="c"?(ne.preventDefault(),be(Be)):xe==="x"&&(ne.preventDefault(),we(Be)))}function jn(ne){return xe=>{xe.dataTransfer.effectAllowed="move",xe.dataTransfer.setData(xr,ne.path),oe({path:ne.path,kind:ne.kind})}}function st(){oe(null),ge(null)}function wn(ne){return xe=>{xe.dataTransfer.types.includes(xr)&&(xe.stopPropagation(),!(ne.kind!=="dir"||!Q(ne.path))&&(xe.preventDefault(),ge(ne.path)))}}function Jn(ne){return xe=>{if(!xe.dataTransfer.types.includes(xr)||(xe.stopPropagation(),ne.kind!=="dir"||!Q(ne.path)))return;xe.preventDefault();const Be=xe.dataTransfer.getData(xr);ge(null),Be&&k(Be,ne.path)}}function cn(ne){!ne.dataTransfer.types.includes(xr)||!Q("")||(ne.preventDefault(),ge(""))}function Wn(ne){if(!ne.dataTransfer.types.includes(xr)||!Q(""))return;ne.preventDefault();const xe=ne.dataTransfer.getData(xr);ge(null),xe&&k(xe,"")}const[It,tt]=_.useState(""),Dt=It.trim(),qn=Dt.length>0,Et=_.useRef(null),nt=_.useRef(g);nt.current=g;function at(ne){tt(ne),Et.current&&clearTimeout(Et.current);const xe=ne.trim();if(!xe){nt.current("");return}Et.current=setTimeout(()=>nt.current(xe),gj)}function hn(ne){Et.current&&clearTimeout(Et.current),tt(""),nt.current(""),z(ne.path),x(ne)}const mn=qn&&(p==null?void 0:p.query)===Dt?p:null;function Qn(){if($==="")return"";const ne=jb(s,$);if((ne==null?void 0:ne.kind)==="dir")return $;const xe=$.lastIndexOf("/");return xe===-1?"":$.slice(0,xe)}function Pt(ne,xe){const Be=xe??Qn();Be&&!r.has(Be)&&y(Be),le({parent:Be,kind:ne})}function vt(){if(!ce)return[];const ne=Fe=>_e?Fe:void 0;if(!ce.entry)return[{id:"paste",label:"Вставить в корень проекта",hint:ne("Ctrl+V"),disabled:!L(""),onSelect:()=>Me("")},{id:"new-file",label:"Создать файл",onSelect:()=>Pt("file","")},{id:"new-dir",label:"Создать каталог",onSelect:()=>Pt("dir","")}];const xe=ce.entry,Be=[xe.kind==="file"?{id:"open",label:"Открыть",onSelect:()=>j(xe.path)}:{id:"toggle",label:r.has(xe.path)?"Свернуть":"Развернуть",onSelect:()=>y(xe.path)},{id:"copy",label:"Копировать",hint:ne("Ctrl+C"),onSelect:()=>be(xe)},{id:"cut",label:"Вырезать",hint:ne("Ctrl+X"),onSelect:()=>we(xe)}];return xe.kind==="dir"&&(Be.push({id:"paste",label:"Вставить",hint:ne("Ctrl+V"),disabled:!L(xe.path),onSelect:()=>Me(xe.path)}),Be.push({id:"new-file",label:"Создать файл",onSelect:()=>Pt("file",xe.path)}),Be.push({id:"new-dir",label:"Создать каталог",onSelect:()=>Pt("dir",xe.path)})),Be.push({id:"rename",label:"Переименовать",onSelect:()=>H(xe.path)}),Be.push({id:"delete",label:"Удалить",onSelect:()=>A(xe)}),Be}const Ft=qn?[]:jt("",0);function jt(ne,xe){const Be=s[ne],Fe=[];if(B&&B.parent===ne&&Fe.push(a.jsxs("div",{className:"fsrow fsrow--draft",style:$a(xe),children:[a.jsx("span",{className:"fsrow__icon",children:B.kind==="dir"?a.jsx(Jf,{}):a.jsx(Wf,{})}),a.jsx(fa,{className:"rename--file",value:"",placeholder:B.kind==="dir"?"имя каталога":"имя файла",onCommit:Ie=>{le(null),v(ne,B.kind,Ie)},onCancel:()=>le(null)})]},`draft:${ne}`)),!Be)return Fe.push(a.jsx("p",{className:"fsrow__pending",style:$a(xe),children:"читаем…"},`wait:${ne}`)),Fe;Be.length===0&&!B&&Fe.push(a.jsx("p",{className:"fsrow__pending",style:$a(xe),children:"пусто"},`empty:${ne}`));for(const Ie of Be){const Ct=Ie.kind==="dir"&&r.has(Ie.path);Fe.push(R===Ie.path?a.jsxs("div",{className:"fsrow fsrow--draft",style:$a(xe),children:[a.jsx("span",{className:"fsrow__icon",children:Ie.kind==="dir"?a.jsx(Jf,{open:Ct}):a.jsx(Wf,{})}),a.jsx(fa,{className:"rename--file",value:Ie.name,placeholder:"новое имя",onCommit:I=>{H(null),C(Ie.path,I)},onCancel:()=>H(null)})]},Ie.path):a.jsx(bj,{entry:Ie,depth:xe,open:Ct,active:Ie.path===c,selected:Ie.path===$,dirty:o.has(Ie.path),gitStatus:w.get(Ie.path),dragging:(W==null?void 0:W.path)===Ie.path,dropTarget:se===Ie.path,cut:(ye==null?void 0:ye.mode)==="cut"&&ye.path===Ie.path,onClick:()=>{an()||(z(Ie.path),Ie.kind==="dir"?y(Ie.path):j(Ie.path))},onRename:()=>H(Ie.path),onDelete:()=>A(Ie),onDragStart:jn(Ie),onDragEnd:st,onDragOver:wn(Ie),onDrop:Jn(Ie),...ct(Ie)},Ie.path)),Ct&&Fe.push(...jt(Ie.path,xe+1))}return Fe}function Pn(){if(!mn)return[a.jsx("p",{className:"fsrow__pending",style:$a(0),children:"ищем…"},"search:wait")];if(mn.entries.length===0)return[a.jsx("p",{className:"fsrow__pending",style:$a(0),children:"ничего не найдено"},"search:empty")];const ne=mn.entries.map(xe=>a.jsx(_j,{entry:xe,gitStatus:w.get(xe.path),onClick:()=>hn(xe)},xe.path));return mn.truncated&&ne.push(a.jsxs("p",{className:"fsrow__pending",style:$a(0),children:["показаны первые ",mn.entries.length," — уточните запрос"]},"search:truncated")),ne}return a.jsxs("aside",{className:(l?"sidepane sidepane--files sidepane--open":"sidepane sidepane--files")+(Z?" sidepane--zoomed":""),"aria-label":"Файлы проекта",onKeyDown:rn,children:[a.jsxs("div",{className:"sidepane__head",onDoubleClick:ne=>{D&&(ne.target.closest("button")||D())},children:[a.jsx(Sj,{}),a.jsx("span",{className:"sidepane__title",children:"Файлы"}),a.jsx("button",{className:"sidepane__btn",title:"Новый файл","aria-label":"Новый файл",onClick:()=>Pt("file"),children:a.jsx(jj,{})}),a.jsx("button",{className:"sidepane__btn",title:"Новый каталог","aria-label":"Новый каталог",onClick:()=>Pt("dir"),children:a.jsx(wj,{})}),a.jsx("button",{className:"sidepane__btn",title:"Перечитать дерево","aria-label":"Перечитать дерево",onClick:G,children:"↻"}),D&&a.jsx("button",{className:"sidepane__btn",title:Z?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":Z?"Свернуть панель файлов":"Развернуть панель файлов на весь экран","aria-pressed":Z,onClick:D,children:a.jsx(Ic,{active:Z})}),a.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель файлов",onClick:V,children:"✕"})]}),a.jsxs("div",{className:"fssearch",children:[a.jsx(Nj,{}),a.jsx("input",{className:"fssearch__input",type:"text",value:It,spellCheck:!1,placeholder:"Поиск файлов и папок…","aria-label":"Поиск файлов и папок",onChange:ne=>at(ne.target.value),onKeyDown:ne=>{ne.stopPropagation(),ne.key==="Escape"&&(ne.preventDefault(),It?at(""):ne.currentTarget.blur())}}),It&&a.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>at(""),children:"✕"})]}),a.jsx("div",{className:"sidepane__scroll fstree"+(se===""?" fstree--drop-target":""),tabIndex:-1,onDragOver:cn,onDrop:Wn,onContextMenu:dt,onTouchStart:Ge,onTouchMove:Ue,onTouchEnd:qe,onTouchCancel:qe,children:qn?Pn():Ft}),a.jsx(Ar,{result:h}),ce&&a.jsx(zi,{x:ce.x,y:ce.y,items:vt(),onClose:Zt})]})}function bj({entry:l,depth:s,open:r,active:c,selected:o,dirty:d,gitStatus:h,dragging:p,dropTarget:g,cut:x,onClick:y,onRename:j,onDelete:v,onDragStart:C,onDragEnd:k,onDragOver:E,onDrop:A,onContextMenu:G,onTouchStart:V,onTouchMove:Z,onTouchEnd:D,onTouchCancel:$}){const z="fsrow"+(c?" is-open":"")+(o&&!c?" is-selected":"")+(l.ignored?" fsrow--ignored":"")+(p?" fsrow--dragging":"")+(g?" fsrow--drop-target":"")+(x?" fsrow--cut":"");return a.jsxs("div",{className:z,style:$a(s),draggable:!0,onDragStart:C,onDragEnd:k,onDragOver:E,onDrop:A,onContextMenu:G,onTouchStart:V,onTouchMove:Z,onTouchEnd:D,onTouchCancel:$,children:[a.jsxs("button",{className:"fsrow__main",onClick:y,title:q_(l),children:[a.jsx("span",{className:"fsrow__icon"+Ff("fsrow__icon",h),children:l.kind==="dir"?a.jsx(Jf,{open:r}):a.jsx(Wf,{})}),a.jsx("span",{className:"fsrow__name"+Ff("fsrow__name",h),children:l.name}),l.ignored&&a.jsx("span",{className:"fsrow__tag",title:"Игнорируется git (.gitignore)",children:"git-ignore"}),d&&a.jsx("span",{className:"fsrow__dot",title:"Есть несохранённые правки"})]}),a.jsx("button",{className:"fsrow__act",title:"Переименовать","aria-label":`Переименовать ${l.name}`,onClick:j,children:"✎"}),a.jsx("button",{className:"fsrow__act",title:"Удалить","aria-label":`Удалить ${l.name}`,onClick:v,children:"✕"})]})}function _j({entry:l,gitStatus:s,onClick:r}){const c=l.path.slice(0,l.path.length-l.name.length-1);return a.jsxs("button",{className:"fsrow fsrow--search"+(l.ignored?" fsrow--ignored":""),style:$a(0),onClick:r,title:q_(l),children:[a.jsx("span",{className:"fsrow__icon"+Ff("fsrow__icon",s),children:l.kind==="dir"?a.jsx(Jf,{}):a.jsx(Wf,{})}),a.jsx("span",{className:"fsrow__name"+Ff("fsrow__name",s),children:l.name}),l.ignored&&a.jsx("span",{className:"fsrow__tag",children:"git-ignore"}),c&&a.jsx("span",{className:"fsrow__path",children:c})]})}function q_(l){return l.ignored?`${l.path} — игнорируется git (.gitignore)`:l.path}function $a(l){return{"--depth":l}}function jb(l,s){var o;const r=s.lastIndexOf("/"),c=r===-1?"":s.slice(0,r);return((o=l[c])==null?void 0:o.find(d=>d.path===s))??null}function yj(l){const s=new Map,r={added:1,modified:2},c=(o,d)=>{const h=s.get(o);(!h||r[d]>r[h])&&s.set(o,d)};for(const o of l){const d=vj(o.status);if(!d)continue;c(o.path,d);let h=kr(o.path);for(;c(h,d),!!h;)h=kr(h)}return s}function vj(l){if(l==="??")return"added";const[s="",r=""]=l;return s==="A"||s==="R"||s==="C"?"added":s==="M"||r==="M"?"modified":null}function Ff(l,s){return s?` ${l}--git-${s}`:""}function Jf({open:l=!1}){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,"aria-hidden":"true",children:l?a.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"}):a.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 Wf(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,strokeLinejoin:"round","aria-hidden":"true",children:[a.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"}),a.jsx("path",{d:"M9 2v3.2h3.3"})]})}function jj(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,"aria-hidden":"true",children:[a.jsxs("g",{transform:"translate(-1.3,-1.6) scale(0.78)",strokeLinejoin:"round",children:[a.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"}),a.jsx("path",{d:"M9 2v3.2h3.3"})]}),a.jsx("path",{d:"M12.2 10.3v3.8M10.3 12.2h3.8",strokeLinecap:"round"})]})}function wj(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,"aria-hidden":"true",children:[a.jsx("g",{transform:"translate(-1.3,-1.6) scale(0.78)",children:a.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"})}),a.jsx("path",{d:"M12.2 10.3v3.8M10.3 12.2h3.8",strokeLinecap:"round"})]})}function Sj(){return a.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[a.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"}),a.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 Nj(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[a.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),a.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}const kj=200;function Tj({open:l,result:s,onSearch:r,onOpenMatch:c,onClose:o,zoomed:d,onToggleZoom:h}){const[p,g]=_.useState(""),x=p.trim(),y=x.length>0,j=_.useRef(null),v=_.useRef(r);v.current=r;function C(A){g(A),j.current&&clearTimeout(j.current);const G=A.trim();if(!G){v.current("");return}j.current=setTimeout(()=>v.current(G),kj)}const k=y&&(s==null?void 0:s.query)===x?s:null;function E(){if(!k)return[a.jsx("p",{className:"fsrow__pending",children:"ищем…"},"grep:wait")];if(k.matches.length===0)return[a.jsx("p",{className:"fsrow__pending",children:"ничего не найдено"},"grep:empty")];const A=[];let G="";for(const V of k.matches)V.path!==G&&(G=V.path,A.push(a.jsx("p",{className:"searchgroup__path",title:V.path,children:V.path},`path:${V.path}`))),A.push(a.jsx(Ej,{match:V,onClick:()=>c(V)},`${V.path}:${V.line}:${V.column}`));return k.truncated&&A.push(a.jsxs("p",{className:"fsrow__pending",children:["показаны первые ",k.matches.length," — уточните запрос"]},"grep:truncated")),A}return a.jsxs("aside",{className:(l?"sidepane sidepane--search sidepane--open":"sidepane sidepane--search")+(d?" sidepane--zoomed":""),"aria-label":"Поиск по тексту в проекте",children:[a.jsxs("div",{className:"sidepane__head",onDoubleClick:A=>{h&&(A.target.closest("button")||h())},children:[a.jsx(Cj,{}),a.jsx("span",{className:"sidepane__title",children:"Поиск по тексту"}),h&&a.jsx("button",{className:"sidepane__btn",title:d?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":d?"Свернуть панель поиска":"Развернуть панель поиска на весь экран","aria-pressed":d,onClick:h,children:a.jsx(Ic,{active:d})}),a.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель поиска",onClick:o,children:"✕"})]}),a.jsxs("div",{className:"fssearch",children:[a.jsx(Aj,{}),a.jsx("input",{className:"fssearch__input",type:"text",value:p,spellCheck:!1,placeholder:"Поиск по тексту во всех файлах…","aria-label":"Поиск по тексту во всех файлах",onChange:A=>C(A.target.value),onKeyDown:A=>{A.stopPropagation(),A.key==="Escape"&&(A.preventDefault(),p?C(""):A.currentTarget.blur())}}),p&&a.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>C(""),children:"✕"})]}),a.jsx("div",{className:"sidepane__scroll fstree",children:y?E():a.jsx("p",{className:"sidepane__empty",children:"Введите текст, чтобы найти его во всех файлах проекта."})})]})}function Ej({match:l,onClick:s}){const r=l.lineText.slice(0,l.column-1),c=l.lineText.slice(l.column-1,l.column-1+l.matchLength),o=l.lineText.slice(l.column-1+l.matchLength);return a.jsxs("button",{className:"searchmatch",onClick:s,title:`${l.path}:${l.line}`,children:[a.jsx("span",{className:"searchmatch__line",children:l.line}),a.jsxs("span",{className:"searchmatch__text",children:[r,a.jsx("mark",{children:c}),o]})]})}function Cj(){return a.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[a.jsx("circle",{cx:"6.8",cy:"6.8",r:"4.3"}),a.jsx("path",{d:"M13.2 13.2 10.1 10.1"})]})}function Aj(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[a.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),a.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}let Ef=null;function Mj(){return Ef||(Ef=Promise.all([We(()=>import("./index-D3s6YlZz.js"),__vite__mapDeps([19,4,3,2,20,5]),import.meta.url),We(()=>import("./index-891wE-Rj.js").then(l=>l.v),__vite__mapDeps([4,3]),import.meta.url),We(()=>import("./index-BHot-lnj.js"),[],import.meta.url),We(()=>import("./index-Bt4DUbpM.js"),__vite__mapDeps([20,3,4,2]),import.meta.url),We(()=>import("./codemirror-CVe_WI3e.js"),__vite__mapDeps([21,2,3,4]),import.meta.url)]).then(([l,s,r,c,o])=>({EditorView:s.EditorView,EditorState:r.EditorState,Compartment:r.Compartment,EditorSelection:r.EditorSelection,Prec:r.Prec,keymap:s.keymap,indentWithTab:c.indentWithTab,basicSetup:l.basicSetup,editorTheme:o.editorTheme,editorHighlight:o.editorHighlight})).catch(l=>{throw Ef=null,l})),Ef}function Rj({path:l,doc:s,revision:r,goto:c,onChange:o,onSave:d}){const h=_.useRef(null),p=_.useRef(null),g=_.useRef(null),x=_.useRef(new Map),y=_.useRef(new Map),j=_.useRef(new Set),v=_.useRef(null),C=_.useRef(o),k=_.useRef(d),E=_.useRef(l),A=_.useRef(r),G=_.useRef(s);C.current=o,k.current=d,E.current=l,A.current=r,G.current=s;const[V,Z]=_.useState("loading"),[D,$]=_.useState(!1);function z(H,B,le,W,oe){const se=x.current.get(W),ge=y.current.get(W)===oe;if(se&&ge)le.setState(se);else{const Y=H.EditorState.create({doc:G.current,extensions:[H.basicSetup,H.Prec.highest(H.keymap.of([{key:"Mod-s",preventDefault:!0,run:()=>(k.current(E.current),!0)}])),H.keymap.of([H.indentWithTab]),B.of([]),H.editorTheme,H.editorHighlight,H.EditorView.updateListener.of(ce=>{ce.docChanged&&C.current(E.current,ce.state.doc.toString())})]});x.current.set(W,Y),y.current.set(W,oe),le.setState(Y),j.current.delete(W)}if(j.current.has(W))return()=>{};let ye=!1;return oj(W).then(Y=>{ye||!Y||E.current!==W||(le.dispatch({effects:B.reconfigure(Y)}),x.current.set(W,le.state),j.current.add(W))}),()=>{ye=!0}}_.useEffect(()=>{if(!h.current)return;let B=!1,le=null,W=null;Z("loading"),$(!1);const oe=window.setTimeout(()=>{B||$(!0)},200);return(async()=>{let se;try{se=await Mj()}catch{window.clearTimeout(oe),B||Z("error");return}if(B||!h.current)return;window.clearTimeout(oe);const ge=new se.Compartment;v.current=ge,g.current=se,W=new se.EditorView({parent:h.current}),p.current=W,le=z(se,ge,W,E.current,A.current),Z("ready")})(),()=>{B=!0,window.clearTimeout(oe),le==null||le(),W==null||W.destroy(),p.current===W&&(p.current=null),g.current=null,v.current=null}},[]),_.useEffect(()=>{const H=g.current,B=p.current,le=v.current;if(!(!H||!B||!le))return z(H,le,B,l,r)},[l,r]);const R=_.useRef(0);return _.useEffect(()=>{const H=p.current,B=g.current;if(!H||!B||!c||c.token===R.current)return;R.current=c.token;const le=H.state.doc.lines,W=Math.min(Math.max(c.line,1),le),oe=H.state.doc.line(W),se=Math.min(oe.from+Math.max(c.column-1,0),oe.to);H.dispatch({selection:B.EditorSelection.cursor(se),effects:B.EditorView.scrollIntoView(se,{y:"center"})}),H.focus()},[c]),_.useEffect(()=>()=>{const H=p.current;H&&x.current.set(l,H.state)},[l]),a.jsxs("div",{className:"editor__code",children:[a.jsx("div",{ref:h,className:"editor__code-surface"+(V==="ready"?"":" is-hidden")}),V==="loading"&&D&&a.jsxs("div",{className:"editor__state work",role:"status",children:[a.jsxs("div",{className:"work__dots",children:[a.jsx("span",{className:"work__dot"}),a.jsx("span",{className:"work__dot"}),a.jsx("span",{className:"work__dot"})]}),a.jsx("span",{className:"work__label",children:"Загружается редактор…"})]}),V==="error"&&a.jsxs("div",{className:"editor__fallback",children:[a.jsxs("div",{className:"editor__fallback-banner",role:"alert",children:[a.jsx("span",{children:"Редактор не загрузился — ниже только просмотр, без сохранения правок."}),a.jsx("button",{className:"btn btn--sm btn--primary",onClick:()=>window.location.reload(),children:"Перезагрузить страницу"})]}),a.jsx("pre",{className:"editor__fallback-text",children:s})]})]})}function Is({value:l,options:s,onChange:r,className:c,title:o,ariaLabel:d,placeholder:h="—"}){const[p,g]=_.useState(!1),[x,y]=_.useState(0),j=_.useRef(null),v=_.useRef(null),C=s.find(A=>A.value===l)??null;_.useEffect(()=>{if(!p)return;const A=s.findIndex(G=>G.value===l);y(A===-1?0:A)},[p]),_.useEffect(()=>{if(!p)return;function A(G){var V;(V=j.current)!=null&&V.contains(G.target)||g(!1)}return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[p]),_.useEffect(()=>{var A,G;p&&((G=(A=v.current)==null?void 0:A.querySelector(".is-cursor"))==null||G.scrollIntoView({block:"nearest"}))},[p,x]),_.useEffect(()=>{if(!p)return;const A=v.current,G=Dj(j.current);if(!A||!G)return;const V=A.getBoundingClientRect().bottom-G.getBoundingClientRect().bottom;V>0&&(G.scrollTop+=Math.min(V+8,A.offsetHeight))},[p]);function k(A){g(!1),A.value!==l&&r(A.value)}function E(A){if(A.key==="Escape"){if(!p)return;A.preventDefault(),A.stopPropagation(),g(!1);return}if(A.key==="ArrowDown"||A.key==="ArrowUp"){if(A.preventDefault(),!p)return g(!0);const G=A.key==="ArrowDown"?1:s.length-1;return y(V=>(V+G)%s.length)}if(A.key==="Enter"||A.key===" "){if(A.preventDefault(),!p)return g(!0);const G=s[x];G&&k(G)}}return a.jsxs("div",{ref:j,className:"select"+(p?" select--open":"")+(c?` ${c}`:""),children:[a.jsxs("button",{type:"button",className:"select__trigger",title:o,"aria-label":d??o,"aria-haspopup":"listbox","aria-expanded":p,onClick:()=>g(A=>!A),onKeyDown:E,children:[a.jsx("span",{className:"select__value",children:(C==null?void 0:C.label)??h}),a.jsx(Oj,{})]}),p&&a.jsx("div",{ref:v,className:"select__menu",role:"listbox","aria-label":d??o,children:s.map((A,G)=>a.jsxs("button",{type:"button",role:"option","aria-selected":A.value===l,className:"select__option"+(G===x?" is-cursor":"")+(A.value===l?" is-on":""),onMouseEnter:()=>y(G),onClick:()=>k(A),children:[a.jsx("span",{className:"select__check","aria-hidden":"true",children:A.value===l?"✓":""}),a.jsx("span",{className:"select__label",children:A.label}),A.hint&&a.jsx("span",{className:"select__hint",children:A.hint})]},A.value))})]})}function Dj(l){let s=(l==null?void 0:l.parentElement)??null;for(;s;){if(s.scrollHeight>s.clientHeight&&getComputedStyle(s).overflowY!=="visible")return s;s=s.parentElement}return null}function Oj(){return a.jsx("svg",{className:"select__chev",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"M3 4.5 6 7.5 9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function Lj(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("circle",{cx:"6.6",cy:"6.6",r:"4.3"}),a.jsx("path",{d:"M9.7 9.7 14 14"}),a.jsx("path",{d:"M6.6 4.6v4M4.6 6.6h4"})]})}function zj(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("circle",{cx:"6.6",cy:"6.6",r:"4.3"}),a.jsx("path",{d:"M9.7 9.7 14 14"}),a.jsx("path",{d:"M4.6 6.6h4"})]})}function Uj(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M13 8a5 5 0 1 1-1.6-3.7"}),a.jsx("path",{d:"M13 2.5v3.3h-3.3"})]})}function Hj({path:l,mime:s,base64:r,error:c,tooLarge:o,size:d,onRequestMedia:h}){_.useEffect(()=>{!o&&r===void 0&&c===void 0&&h(l)},[]);const p=Bj(r,s);return o?a.jsx("div",{className:"mediaview mediaview--message",children:a.jsxs("p",{className:"mediaview__error",children:["Файл слишком велик для просмотра (",$f(d),"). Лимит — 64 МБ."]})}):c?a.jsxs("div",{className:"mediaview mediaview--message",role:"alert",children:[a.jsx("p",{className:"mediaview__error",children:c}),a.jsx("button",{className:"btn btn--sm btn--primary",onClick:()=>h(l),children:"Повторить"})]}):p?s.startsWith("image/")?a.jsx(qj,{url:p}):s.startsWith("video/")?a.jsx(Yj,{url:p}):null:a.jsxs("div",{className:"mediaview mediaview--message",role:"status",children:[a.jsx("div",{className:"mediaview__progress",children:a.jsx("div",{className:"mediaview__progress-fill"})}),a.jsx("span",{className:"mediaview__label",children:"Загружается…"})]})}function Bj(l,s){const[r,c]=_.useState(null);return _.useEffect(()=>{if(l===void 0){c(null);return}const o=atob(l),d=new Uint8Array(o.length);for(let p=0;p<o.length;p++)d[p]=o.charCodeAt(p);const h=URL.createObjectURL(new Blob([d],{type:s}));return c(h),()=>URL.revokeObjectURL(h)},[l,s]),r}const Ri=1,G_=8,Cf=1.25;function Ij(l){return Math.min(G_,Math.max(Ri,l))}function qj({url:l}){const[s,r]=_.useState({scale:Ri,x:0,y:0}),[c,o]=_.useState(!1),d=_.useRef(null),h=_.useRef(null);function p(C,k,E){r(A=>{const G=Ij(A.scale*C);if(G===A.scale)return A;if(G<=Ri)return{scale:Ri,x:0,y:0};const V=(k-A.x)/A.scale,Z=(E-A.y)/A.scale;return{scale:G,x:k-G*V,y:E-G*Z}})}_.useEffect(()=>{const C=d.current;if(!C)return;function k(E){E.preventDefault();const A=C.getBoundingClientRect(),G=E.clientX-A.left-A.width/2,V=E.clientY-A.top-A.height/2;p(E.deltaY<0?Cf:1/Cf,G,V)}return C.addEventListener("wheel",k,{passive:!1}),()=>C.removeEventListener("wheel",k)},[]);function g(C){s.scale<=Ri||(C.currentTarget.setPointerCapture(C.pointerId),h.current={pointerId:C.pointerId,startX:C.clientX,startY:C.clientY,origX:s.x,origY:s.y},o(!0))}function x(C){const k=h.current;!k||k.pointerId!==C.pointerId||r(E=>({...E,x:k.origX+(C.clientX-k.startX),y:k.origY+(C.clientY-k.startY)}))}function y(){h.current=null,o(!1)}const j=s.scale>Ri,v=!j&&s.x===0&&s.y===0;return a.jsxs("div",{className:"mediaview mediaview--image",children:[a.jsx("div",{ref:d,className:"mediaview__stage"+(j?c?" is-dragging":" is-zoomed":""),onPointerDown:g,onPointerMove:x,onPointerUp:y,onPointerCancel:y,children:a.jsx("img",{src:l,alt:"",className:"mediaview__image",draggable:!1,style:{transform:`translate(${s.x}px, ${s.y}px) scale(${s.scale})`}})}),a.jsxs("div",{className:"mediaview__toolbar",children:[a.jsx("button",{className:"btn btn--sm",disabled:s.scale<=Ri,title:"Уменьшить","aria-label":"Уменьшить",onClick:()=>p(1/Cf,0,0),children:a.jsx(zj,{})}),a.jsxs("span",{className:"mediaview__zoomlabel",children:[Math.round(s.scale*100),"%"]}),a.jsx("button",{className:"btn btn--sm",disabled:s.scale>=G_,title:"Увеличить","aria-label":"Увеличить",onClick:()=>p(Cf,0,0),children:a.jsx(Lj,{})}),a.jsx("button",{className:"btn btn--sm",disabled:v,title:"Вписать в окно","aria-label":"Сбросить масштаб — вписать в окно",onClick:()=>r({scale:Ri,x:0,y:0}),children:a.jsx(Uj,{})})]})]})}const Gj=[{value:"0.5",label:"0.5×"},{value:"0.75",label:"0.75×"},{value:"1",label:"1× — обычная"},{value:"1.25",label:"1.25×"},{value:"1.5",label:"1.5×"},{value:"2",label:"2×"}];function Yj({url:l}){const s=_.useRef(null),[r,c]=_.useState("1");return _.useEffect(()=>{s.current&&(s.current.playbackRate=Number(r))},[r]),a.jsxs("div",{className:"mediaview mediaview--video",children:[a.jsx("video",{ref:s,className:"mediaview__video",src:l,controls:!0}),a.jsxs("div",{className:"mediaview__speedbar",children:[a.jsx("span",{className:"mediaview__speedlabel",children:"Скорость"}),a.jsx(Is,{className:"mediaview__speedselect",value:r,onChange:c,ariaLabel:"Скорость воспроизведения",options:Gj})]})]})}function $j({file:l,goto:s,onChange:r,onSave:c,onReload:o,onOverwrite:d,onRequestMedia:h,onTogglePreview:p}){const g=Ya(l),x=I_(l.path)&&!l.binary&&!l.tooLarge;return a.jsxs("div",{className:"editor",children:[a.jsxs("div",{className:"editor__bar",children:[a.jsx("span",{className:"editor__path",title:l.path,children:l.path}),a.jsxs("span",{className:"editor__meta",children:[$f(l.size),l.eol==="crlf"&&" · CRLF"]}),x&&a.jsxs("div",{className:"editor__viewtoggle",role:"tablist","aria-label":"Режим просмотра",children:[a.jsx("button",{className:"btn btn--sm"+(l.previewMode?" is-on":""),role:"tab","aria-selected":l.previewMode,onClick:()=>!l.previewMode&&p(l.path),children:"Просмотр"}),a.jsx("button",{className:"btn btn--sm"+(l.previewMode?"":" is-on"),role:"tab","aria-selected":!l.previewMode,onClick:()=>l.previewMode&&p(l.path),children:"Код"})]}),a.jsx("button",{className:"btn btn--sm",disabled:!g,title:"Сохранить (Ctrl+S)",onClick:()=>c(l.path),children:g?"Сохранить":"Сохранено"})]}),l.stale&&a.jsxs("div",{className:"editor__warn",children:[a.jsxs("span",{children:["Файл изменился на диске",g?" — а здесь есть несохранённые правки.":"."]}),a.jsx("button",{className:"btn btn--sm",onClick:()=>o(l.path),children:"Взять с диска"}),g&&a.jsx("button",{className:"btn btn--sm btn--danger",onClick:()=>d(l.path),children:"Сохранить поверх"})]}),l.binary&&l.mediaMime?a.jsx(Hj,{path:l.path,mime:l.mediaMime,base64:l.mediaBase64,error:l.mediaError,tooLarge:l.mediaTooLarge,size:l.size,onRequestMedia:h},l.path):l.binary?a.jsxs("p",{className:"editor__empty",children:["Это не текстовый файл — редактировать его здесь нечем. ",$f(l.size)," на диске."]}):l.tooLarge?a.jsxs("p",{className:"editor__empty",children:["Файл слишком велик для редактора (",$f(l.size),"). Такие правит агент, а не браузер."]}):x&&l.previewMode?a.jsx(Xj,{text:l.text}):a.jsx(Rj,{path:l.path,doc:l.text,revision:l.revision,goto:s,onChange:r,onSave:c})]})}function Xj({text:l}){const[s,r]=_.useState("");return _.useEffect(()=>{let c=!1;return sd(l).then(o=>{c||r(o)}),()=>{c=!0}},[l]),a.jsx("div",{className:"markdown-preview",dangerouslySetInnerHTML:{__html:s}})}function Vj({files:l,activePath:s,busy:r,onSelect:c,onClose:o,zoomed:d,onToggleZoom:h}){return a.jsxs("div",{className:"worktabs",role:"tablist",onDoubleClick:p=>{h&&(p.target.closest("button")||h())},children:[a.jsxs("button",{className:"worktab"+(s===null?" is-on":""),role:"tab","aria-selected":s===null,onClick:()=>c(null),onDoubleClick:()=>h==null?void 0:h(),children:[a.jsx("span",{className:"worktab__name",children:"Разговор"}),r&&a.jsx("span",{className:"worktab__dot worktab__dot--busy",title:"Агент работает"})]}),l.map(p=>a.jsxs("div",{className:"worktab"+(p.path===s?" is-on":""),role:"tab","aria-selected":p.path===s,onDoubleClick:g=>{h&&(g.target.closest(".worktab__close, .worktab__dot")||h())},children:[a.jsx("button",{className:"worktab__name",title:p.path,onClick:()=>c(p.path),children:dj(p.path)}),Ya(p)?a.jsx("button",{className:"worktab__dot",title:"Не сохранено — закрыть","aria-label":`Закрыть ${p.path}`,onClick:()=>o(p.path)}):a.jsx("button",{className:"worktab__close",title:"Закрыть","aria-label":`Закрыть ${p.path}`,onClick:()=>o(p.path),children:"✕"})]},p.path)),a.jsx("div",{className:"worktabs__spacer"}),h&&a.jsx("button",{className:"worktabs__zoom",title:d?"Свернуть — то же самое, что двойной клик по вкладке":"Развернуть на весь экран — то же самое, что двойной клик по вкладке","aria-label":d?"Свернуть колонку разговора":"Развернуть колонку разговора на весь экран","aria-pressed":d,onClick:h,children:a.jsx(Ic,{active:d})})]})}function hs(l){return l.claudeSessionId??l.id}function Af(l,s,r,c){if(!s||s.length===0)return l;const o=new Map(s.map((p,g)=>[p,g])),d=[],h=[];for(const p of l)(o.has(r(p))?d:h).push(p);return d.sort((p,g)=>o.get(r(p))-o.get(r(g))),c==="top"?[...h,...d]:[...d,...h]}function wb(l){return l.state!=="closed"}function Sb(l){return[...l.filter(wb),...l.filter(s=>!wb(s))]}function Mf(l,s,r,c){if(s===r||!l.includes(s)||!l.includes(r))return null;const o=l.filter(p=>p!==s),d=o.indexOf(r)+(c==="after"?1:0),h=[...o.slice(0,d),s,...o.slice(d)];return h.every((p,g)=>p===l[g])?null:h}function Op(l,s,r,c){const o=l%10,d=l%100;return o===1&&d!==11?s:o>=2&&o<=4&&(d<12||d>14)?r:c}function Y_(l){return`${l} ${Op(l,"агент","агента","агентов")}`}function Qj(l){const s=l.filter(o=>o.kind==="agent").length,r=l.length-s,c=[];return s>0&&c.push(Y_(s)),r>0&&c.push(`${r} ${Op(r,"задача","задачи","задач")} в фоне`),c.join(" · ")}function Kj(l){switch(l.kind){case"agent":return l.agentType??"агент";case"shell":return"команда";case"workflow":return"сценарий";default:return"задача"}}function Zj(l){const s=Math.max(0,Math.floor(l/1e3)),r=Math.floor(s/3600),c=Math.floor(s%3600/60),o=s%60,d=String(o).padStart(2,"0");return r>0?`${r}:${String(c).padStart(2,"0")}:${d}`:`${c}:${d}`}function Fj(l){return l<1e3?`${l} ток.`:`${(l/1e3).toFixed(1).replace(".",",")} k ток.`}function Jj({tasks:l,onStop:s}){const[r,c]=_.useState(!1),[o,d]=_.useState(()=>Date.now()),[h,p]=_.useState(()=>new Set);_.useEffect(()=>{const x=window.setInterval(()=>d(Date.now()),1e3);return()=>window.clearInterval(x)},[]),_.useEffect(()=>{p(x=>{const y=new Set(l.map(v=>v.id)),j=new Set([...x].filter(v=>y.has(v)));return j.size===x.size?x:j})},[l]);const g=x=>{p(y=>new Set(y).add(x)),s(x),window.setTimeout(()=>{p(y=>{if(!y.has(x))return y;const j=new Set(y);return j.delete(x),j})},1e4)};return a.jsxs("div",{className:r?"tasks is-open":"tasks",children:[a.jsxs("button",{type:"button",className:"tasks__toggle","aria-expanded":r,"aria-controls":"tasks-list",onClick:()=>c(x=>!x),children:[a.jsx("span",{className:"tasks__dot","aria-hidden":"true"}),a.jsx("span",{className:"tasks__summary",children:Qj(l)}),a.jsx("svg",{className:"tasks__chev",viewBox:"0 0 16 16","aria-hidden":"true",children:a.jsx("path",{d:"M4 6.5l4 4 4-4",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})]}),r&&a.jsx("ul",{className:"tasks__list",id:"tasks-list",children:l.map(x=>{const y=h.has(x.id);return a.jsxs("li",{className:y?"task is-stopping":"task",children:[a.jsxs("div",{className:"task__main",children:[a.jsxs("div",{className:"task__head",children:[a.jsx("span",{className:"task__kind",children:Kj(x)}),x.background&&a.jsx("span",{className:"task__bg",children:"фон"}),a.jsx("span",{className:"task__time",children:Zj(o-x.startedAt)})]}),a.jsx("div",{className:"task__desc",title:x.description,children:x.description}),(x.activity||x.lastTool)&&a.jsx("div",{className:"task__activity",title:x.activity??x.lastTool??void 0,children:x.activity??x.lastTool}),a.jsxs("div",{className:"task__stats",children:[Fj(x.tokens)," · ",x.toolUses," ",Op(x.toolUses,"вызов","вызова","вызовов")]})]}),a.jsx("button",{type:"button",className:"btn btn--sm btn--danger task__stop",disabled:y,"aria-label":`Остановить: ${x.description}`,onClick:()=>g(x.id),children:y?"Останавливается":"Стоп"})]},x.id)})})]})}const Wj=""+new URL("antigravity-logo-DRKQga2U.png",import.meta.url).href;function Lp({className:l}){return a.jsx("img",{src:Wj,alt:"","aria-hidden":"true",className:l,style:{aspectRatio:"200 / 184"}})}function zp({className:l}){return a.jsx("svg",{className:l,viewBox:"0 0 20 20",fill:"none","aria-label":"Codex",role:"img",children:a.jsx("path",{d:"m6.5 5-5 5 5 5M13.5 5l5 5-5 5M11.5 3l-3 14",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}const Pj=450,ew=6,tw=[{id:"claude",label:"Claude",hint:"Claude Code — как обычно"},{id:"antigravity",label:"Antigravity",hint:"Google agy, отдельная палитра и права"},{id:"codex",label:"Codex",hint:"OpenAI Codex — локальный CLI"}];function nw({disabled:l,providers:s,onStart:r}){var W,oe;const c=tw.filter(se=>s.includes(se.id)),o=c.length>1,[d,h]=_.useState(!1),[p,g]=_.useState(0),[x,y]=_.useState({left:0,top:0}),j=_.useRef(null),v=_.useRef(null),C=_.useRef(null),k=_.useId(),E=_.useRef(null);function A(){E.current&&window.clearTimeout(E.current.timer),E.current=null}function G(){A(),g(0),h(!0)}function V(se){var ge;h(!1),se&&((ge=j.current)==null||ge.focus())}function Z(se){if(l||!o||se.button!==0)return;const ge={timer:0,x:se.clientX,y:se.clientY,fired:!1};ge.timer=window.setTimeout(()=>{ge.fired=!0,G(),E.current=ge},Pj),E.current=ge}function D(se){const ge=E.current;!ge||ge.fired||Math.hypot(se.clientX-ge.x,se.clientY-ge.y)>ew&&A()}function $(){E.current&&!E.current.fired&&A()}function z(se){var ye;if((ye=E.current)!=null&&ye.fired){E.current=null,se.preventDefault();return}if(l)return;const ge=c[0];ge&&r(ge.id)}function R(se){o&&(se.preventDefault(),!l&&G())}function H(se){if(l||!o)return;(se.key==="ArrowDown"||se.key==="ArrowUp"||se.key==="Enter"&&se.shiftKey)&&(se.preventDefault(),G())}_.useLayoutEffect(()=>{if(!d)return;const se=j.current,ge=C.current;if(!se||!ge)return;const ye=se.getBoundingClientRect(),Y=ge.getBoundingClientRect(),ce=8,de=Math.max(ce,Math.min(ye.right-Y.width,window.innerWidth-Y.width-ce));let _e=ye.top-Y.height-8;_e<ce&&(_e=Math.min(ye.bottom+8,window.innerHeight-Y.height-ce)),y({left:de,top:_e})},[d]),_.useLayoutEffect(()=>{var se;d&&((se=C.current)==null||se.focus())},[d]),_.useLayoutEffect(()=>{if(!d)return;function se(ge){var Y;const ye=ge.target;(Y=v.current)!=null&&Y.contains(ye)||V(!1)}return document.addEventListener("pointerdown",se),()=>document.removeEventListener("pointerdown",se)},[d]),_.useLayoutEffect(()=>{A(),h(!1)},[l,s.join(",")]);function B(se){V(!1),r(se.id)}function le(se){if(se.key==="Escape"){se.preventDefault(),se.stopPropagation(),V(!0);return}if(se.key==="ArrowDown"||se.key==="ArrowUp"){se.preventDefault();const ge=se.key==="ArrowDown"?1:-1;g(ye=>(ye+ge+c.length)%c.length);return}if(se.key==="Enter"||se.key===" "){se.preventDefault();const ge=c[p];ge&&B(ge);return}se.key==="Tab"&&V(!1)}return a.jsxs("div",{className:"newsession"+(o?" newsession--split":""),ref:v,children:[a.jsx("button",{ref:j,type:"button",className:"btn btn--primary newsession__btn",disabled:l,title:`Новая сессия: ${((W=c[0])==null?void 0:W.label)??"агент"}`,onClick:z,onContextMenu:R,onPointerDown:Z,onPointerMove:D,onPointerUp:$,onPointerCancel:$,onPointerLeave:$,onKeyDown:H,children:"+ Сессия"}),o&&a.jsx("button",{type:"button",className:"btn btn--primary newsession__choose",disabled:l,title:"Выбрать агента","aria-label":"Выбрать агента для новой сессии","aria-haspopup":"menu","aria-expanded":d,"aria-controls":d?k:void 0,onClick:()=>d?V(!0):G(),onKeyDown:H,children:a.jsx(lw,{})}),d&&o&&a.jsx("div",{ref:C,id:k,className:"newsession__menu",style:{left:x.left,top:x.top},role:"menu","aria-label":"Выбрать агента для новой сессии","aria-activedescendant":`${k}-${(oe=c[p])==null?void 0:oe.id}`,tabIndex:-1,onKeyDown:le,children:c.map((se,ge)=>a.jsxs("button",{id:`${k}-${se.id}`,type:"button",role:"menuitem",tabIndex:-1,className:"newsession__item"+(ge===p?" is-cursor":""),onMouseEnter:()=>g(ge),onClick:()=>B(se),children:[a.jsx("span",{className:`newsession__mark newsession__mark--${se.id}`,"aria-hidden":"true",children:se.id==="antigravity"?a.jsx(Lp,{className:"newsession__mark-logo"}):se.id==="codex"?a.jsx(zp,{}):a.jsx(sw,{})}),a.jsxs("span",{className:"newsession__text",children:[a.jsx("span",{className:"newsession__label",children:se.label}),a.jsx("span",{className:"newsession__hint",children:se.hint})]})]},se.id))})]})}function lw(){return a.jsx("svg",{className:"newsession__caret",viewBox:"0 0 10 6",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"M1 1.2 5 5 9 1.2",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function sw(){return a.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:a.jsx("circle",{cx:"8",cy:"8",r:"6",fill:"var(--accent)"})})}const $_="ccv:sidebar.collapsed",X_="ccv:sidebar.mode",V_="ccv:sidebar.foldersCollapsed",aw=500,Zh="транскрипт остаётся на диске — сессию можно вернуть из архива в любой момент.";function iw({open:l,connected:s,status:r,workspaces:c,archivedWorkspaces:o,workspaceFolders:d,sessionFolders:h,pinnedFolders:p,sessions:g,archived:x,pinned:y,live:j,listOrder:v,liveSessionsFirst:C,onReorder:k,activeWorkspaceId:E,activeSessionId:A,onSelectWorkspace:G,onSelectSession:V,onRenameSession:Z,onStopSession:D,onPinSessions:$,onSelectPinned:z,onCloseWorkspaces:R,onRestoreWorkspaces:H,onArchiveSessions:B,onUnarchiveSessions:le,onCreateFolder:W,onRenameFolder:oe,onSetFolderColor:se,onDeleteFolder:ge,onAssignToFolder:ye,onOpenWorkspace:Y,onNewSession:ce,enabledProviders:de,onOpenExtensions:_e,account:Ce,onOpenAccount:w,relay:Q,onOpenRelay:L,onOpenSettings:be,themeMode:we,onCycleTheme:Me}){var sl;const[Oe,Ue]=_.useState(null),[qe,an]=_.useState(null),[Ke,Zt]=_.useState(null);function ct(N){return(Ke==null?void 0:Ke.folderId)===N.id?Ke.color??void 0:N.color}function dt(N){const ie=N&&ct(N);return ie?{"--folder-color":ie}:void 0}function Ge(N){return N?a.jsx("span",{className:"row__stripe","aria-hidden":"true"}):null}const rn=_.useRef(void 0),[jn,st]=_.useState(null),[wn,Jn]=_.useState(""),[cn,Wn]=_.useState(vw),[It,tt]=_.useState(jw),[Dt,qn]=_.useState(ww);function Et(N){qn(N);try{localStorage.setItem(X_,N)}catch{}}const nt=wn.trim().toLowerCase(),at=nt!=="",hn=_.useMemo(()=>Af(c,v==null?void 0:v.workspaces,N=>N.id,"bottom"),[c,v]),mn=_.useMemo(()=>{const N=Af(g,E?v==null?void 0:v.sessions[E]:void 0,hs,"top");return C?Sb(N):N},[g,v,E,C]),Qn=_.useMemo(()=>{const N=Af(y,v==null?void 0:v.pinned,hs,"bottom");return C?Sb(N):N},[y,v,C]),Pt=_.useMemo(()=>Af(j,v==null?void 0:v.live,hs,"bottom"),[j,v]),vt=_.useMemo(()=>at?hn.filter(N=>N.name.toLowerCase().includes(nt)||N.path.toLowerCase().includes(nt)):hn,[hn,nt,at]),Ft=_.useMemo(()=>at?o.filter(N=>N.name.toLowerCase().includes(nt)||N.path.toLowerCase().includes(nt)):o,[o,nt,at]),jt=_.useMemo(()=>at?mn.filter(N=>(N.title??"").toLowerCase().includes(nt)):mn,[mn,nt,at]),Pn=_.useMemo(()=>at?x.filter(N=>(N.title??"").toLowerCase().includes(nt)):x,[x,nt,at]),ne=N=>{var ie;return((ie=c.find(Ae=>Ae.id===N))==null?void 0:ie.name)??"—"},xe=N=>{var ie;return(ie=c.find(Ae=>Ae.id===N))==null?void 0:ie.path},Be=_.useMemo(()=>at?Qn.filter(N=>(N.title??"").toLowerCase().includes(nt)||ne(N.workspaceId).toLowerCase().includes(nt)):Qn,[Qn,c,nt,at]),Fe=_.useMemo(()=>at?Pt.filter(N=>(N.title??"").toLowerCase().includes(nt)||ne(N.workspaceId).toLowerCase().includes(nt)):Pt,[Pt,c,nt,at]),Ie=!at;function Ct(N){Wn(ie=>{const Ae=ie.includes(N)?ie.filter($e=>$e!==N):[...ie,N];try{localStorage.setItem($_,JSON.stringify(Ae))}catch{}return Ae})}const I=N=>!cn.includes(N);function fe(N){tt(ie=>{const Ae=ie.includes(N)?ie.filter($e=>$e!==N):[...ie,N];try{localStorage.setItem(V_,JSON.stringify(Ae))}catch{}return Ae})}const Ne=N=>!It.includes(N),Le=_.useMemo(()=>Ko(vt,d),[vt,d]),wt=_.useMemo(()=>Ko(Ft,d),[Ft,d]),Sn=_.useMemo(()=>Ko(jt,h),[jt,h]),fl=_.useMemo(()=>Ko(Pn,h),[Pn,h]),_l=_.useMemo(()=>Ko(Be,p,N=>N.pinnedFolderId),[Be,p]),gs=_.useMemo(()=>({groups:[],ungrouped:Fe}),[Fe]),ls=((v==null?void 0:v.workspaces.length)??0)>0,ss=E?(((sl=v==null?void 0:v.sessions[E])==null?void 0:sl.length)??0)>0:!1,as=((v==null?void 0:v.pinned.length)??0)>0,Va=((v==null?void 0:v.live.length)??0)>0,dl=Rf({enabled:Ie,scope:"workspaces",itemKey:N=>N.id,groups:Le.groups,ungrouped:Le.ungrouped,onReorder:k}),el=Rf({enabled:Ie,scope:"sessions",workspaceId:E??void 0,itemKey:hs,groups:Sn.groups,ungrouped:Sn.ungrouped,onReorder:k}),Ot=Rf({enabled:Ie,scope:"pinned",itemKey:hs,groups:_l.groups,ungrouped:_l.ungrouped,onReorder:k}),Ze=Rf({enabled:Ie,scope:"live",itemKey:hs,groups:gs.groups,ungrouped:gs.ungrouped,onReorder:k});_.useEffect(()=>{var Ae;if(!Ke)return;const ie=(Ae=[..._l.groups,...Le.groups,...wt.groups,...Sn.groups,...fl.groups].find($e=>$e.folder.id===Ke.folderId))==null?void 0:Ae.folder;ie&&ie.color===(Ke.color??void 0)&&Zt(null)},[Ke,_l,Le,wt,Sn,fl]),_.useEffect(()=>()=>window.clearTimeout(rn.current),[]);const gn=Jh(vt),Xt=Jh(Ft),yl=Jh(jt),[Jt,xs]=_.useState(null),[Vt,bs]=_.useState(null),[bt,Rn]=_.useState(null),[Dn,Nn]=_.useState(null),[ot,At]=_.useState(null),Cl=_.useRef(null);function on(N,ie){const Ae=N.touches[0];if(!Ae)return;const $e={timer:0,x:Ae.clientX,y:Ae.clientY,el:N.currentTarget,fired:!1};$e.timer=window.setTimeout(()=>{$e.fired=!0,ie($e.x,$e.y,$e.el)},aw),Cl.current=$e}function Gn(N){const ie=Cl.current,Ae=N.touches[0];!ie||!Ae||Math.hypot(Ae.clientX-ie.x,Ae.clientY-ie.y)>10&&(window.clearTimeout(ie.timer),Cl.current=null)}function tl(N){const ie=Cl.current;ie&&(window.clearTimeout(ie.timer),ie.fired&&N.preventDefault())}function vl(){var N;return(N=Cl.current)!=null&&N.fired?(Cl.current=null,!0):!1}function Al(){const N=Jt==null?void 0:Jt.opener;xs(null),N!=null&&N.isConnected&&N.focus()}function nl(){const N=Vt==null?void 0:Vt.opener;bs(null),N!=null&&N.isConnected&&N.focus()}function ll(){const N=bt==null?void 0:bt.opener;Rn(null),N!=null&&N.isConnected&&N.focus()}function Lt(){const N=Dn==null?void 0:Dn.opener;Nn(null),N!=null&&N.isConnected&&N.focus()}function On(){const N=ot==null?void 0:ot.opener;At(null),N!=null&&N.isConnected&&N.focus()}function zt(N){return{onContextMenu:ie=>{ie.preventDefault(),xs({x:ie.clientX,y:ie.clientY,opener:ie.currentTarget,ids:gn.targetsFor(N)})},onTouchStart:ie=>on(ie,(Ae,$e,Yn)=>xs({x:Ae,y:$e,opener:Yn,ids:gn.targetsFor(N)})),onTouchMove:Gn,onTouchEnd:tl,onTouchCancel:tl}}function _s(N){return{onContextMenu:ie=>{ie.preventDefault(),bs({x:ie.clientX,y:ie.clientY,opener:ie.currentTarget,ids:Xt.targetsFor(N)})},onTouchStart:ie=>on(ie,(Ae,$e,Yn)=>bs({x:Ae,y:$e,opener:Yn,ids:Xt.targetsFor(N)})),onTouchMove:Gn,onTouchEnd:tl,onTouchCancel:tl}}function Ii(N){return{onContextMenu:ie=>{ie.preventDefault(),Rn({x:ie.clientX,y:ie.clientY,opener:ie.currentTarget,ids:yl.targetsFor(N)})},onTouchStart:ie=>on(ie,(Ae,$e,Yn)=>Rn({x:Ae,y:$e,opener:Yn,ids:yl.targetsFor(N)})),onTouchMove:Gn,onTouchEnd:tl,onTouchCancel:tl}}function $l(N){return{onContextMenu:ie=>{ie.preventDefault(),Nn({x:ie.clientX,y:ie.clientY,opener:ie.currentTarget,ids:[N.id]})},onTouchStart:ie=>on(ie,(Ae,$e,Yn)=>Nn({x:Ae,y:$e,opener:Yn,ids:[N.id]})),onTouchMove:Gn,onTouchEnd:tl,onTouchCancel:tl}}function ys(N){return{onContextMenu:ie=>{ie.preventDefault(),At({x:ie.clientX,y:ie.clientY,opener:ie.currentTarget,ids:[N.id]})},onTouchStart:ie=>on(ie,(Ae,$e,Yn)=>At({x:Ae,y:$e,opener:Yn,ids:[N.id]})),onTouchMove:Gn,onTouchEnd:tl,onTouchCancel:tl}}const xn=g.filter(N=>N.state!=="closed").length,Xl=Jt?vt.find(N=>N.id===Jt.ids[0]):void 0,kn=Jt?[{id:"close",label:Jt.ids.length>1?`Закрыть проекты (${Jt.ids.length})`:"Закрыть проект",onSelect:()=>{R(Jt.ids),gn.clear()}},...Zo({folders:d,ids:Jt.ids,hasFolder:(Xl==null?void 0:Xl.folderId)!=null,assign:(N,ie)=>ye("workspace",N,ie),onClear:()=>gn.clear(),onNewFolder:()=>st("workspace")}),...Jt.ids.length===1&&Ie?dl.menuItems(Jt.ids[0],ls):[]]:[],vs=Jt?"закрытие не удаляет проект: каталог и история сессий остаются на диске — открыть его снова можно кнопкой «+ Проект»."+(E&&Jt.ids.includes(E)&&xn>0?` в нём сейчас незавершённых сессий: ${xn} — при закрытии они остановятся на хосте.`:""):void 0,is=Vt?Ft.find(N=>N.id===Vt.ids[0]):void 0,rs=Vt?[{id:"restore",label:Vt.ids.length>1?`Вернуть проекты (${Vt.ids.length})`:"Вернуть проект",onSelect:()=>{H(Vt.ids),Xt.clear()}},...Zo({folders:d,ids:Vt.ids,hasFolder:(is==null?void 0:is.folderId)!=null,assign:(N,ie)=>ye("workspace",N,ie),onClear:()=>Xt.clear(),onNewFolder:()=>st("workspace")})]:[],Ml=Vt?"каталог и история сессий всё это время оставались на диске — восстановление их не трогает.":void 0,me=bt?jt.find(N=>N.id===bt.ids[0]):void 0,T=(me==null?void 0:me.pinned)!==!0,K=bt?[...bt.ids.length===1?[{id:"rename",label:"Переименовать",onSelect:()=>Ue(bt.ids[0])}]:[],{id:"pin",label:T?bt.ids.length>1?`Закрепить (${bt.ids.length})`:"Закрепить":bt.ids.length>1?`Открепить (${bt.ids.length})`:"Открепить",onSelect:()=>{me&&$(me.workspaceId,bt.ids,T),yl.clear()}},{id:"archive",label:bt.ids.length>1?`Убрать в архив (${bt.ids.length})`:"Убрать в архив",onSelect:()=>{B(E,bt.ids),yl.clear()}},...Zo({folders:h,ids:bt.ids,hasFolder:(me==null?void 0:me.folderId)!=null,assign:(N,ie)=>ye("session",N,ie,E),onClear:()=>yl.clear(),onNewFolder:()=>st("session")}),...bt.ids.length===1&&Ie&&me?el.menuItems(hs(me),ss):[]]:[],pe=bt?Zh:void 0,je=Dn?Be.find(N=>N.id===Dn.ids[0]):void 0,He=Dn?[{id:"rename",label:"Переименовать",onSelect:()=>Ue(Dn.ids[0])},{id:"unpin",label:"Открепить",onSelect:()=>{je&&$(je.workspaceId,[je.id],!1)}},{id:"archive",label:"Убрать в архив",onSelect:()=>{je&&B(je.workspaceId,[je.id])}},...je&&je.workspaceId===E?Zo({folders:h,ids:[je.id],hasFolder:je.folderId!=null,assign:(N,ie)=>ye("session",N,ie,je.workspaceId),onClear:()=>{},onNewFolder:()=>st("session")}):[],...uw(je?Zo({folders:p,ids:[je.id],hasFolder:je.pinnedFolderId!=null,assign:(N,ie)=>ye("pinned",N,ie),onClear:()=>{},onNewFolder:()=>st("pinned")}):[]),...Ie&&je?Ot.menuItems(hs(je),as):[]]:[],Re=ot?Fe.find(N=>N.id===ot.ids[0]):void 0,St=ot?[{id:"stop",label:"Остановить",onSelect:()=>{Re&&D(Re)}},{id:"rename",label:"Переименовать",onSelect:()=>Ue(ot.ids[0])},{id:"pin",label:(Re==null?void 0:Re.pinned)===!0?"Открепить":"Закрепить",onSelect:()=>{Re&&$(Re.workspaceId,[Re.id],Re.pinned!==!0)}},{id:"archive",label:"Убрать в архив",onSelect:()=>{Re&&B(Re.workspaceId,[Re.id])}},...Ie&&Re?Ze.menuItems(hs(Re),Va):[]]:[];function ht(N,ie){return a.jsxs("div",{"data-row-key":N.id,className:yc(N.id===E,gn.selected.includes(N.id),!1,!!ie)+dl.dropClass(N.id),style:dt(ie),...zt(N),children:[Ge(ie),Ie&&a.jsx("button",{type:"button",className:"row__grip",title:"Перетащить, чтобы изменить порядок","aria-label":"Перетащить проект, чтобы изменить порядок в списке",...dl.gripHandlers(N.id),children:a.jsx(Df,{})}),a.jsxs("button",{className:"row__main",onClick:Ae=>{vl()||gn.click(Ae,N,()=>G(N.id))},onKeyDown:Ae=>dl.onKeyDown(N.id,Ae),children:[a.jsxs("span",{className:"row__title",children:[N.name,N.hasClaudeMd&&" ·"]}),a.jsx("span",{className:"row__meta",title:N.path,children:N.path})]})]},N.id)}function en(N,ie){return a.jsxs("div",{className:yc(N.id===E,Xt.selected.includes(N.id),!1,!!ie),style:dt(ie),..._s(N),children:[Ge(ie),a.jsxs("button",{className:"row__main",onClick:Ae=>{vl()||Xt.click(Ae,N,()=>G(N.id))},children:[a.jsxs("span",{className:"row__title",children:[N.name,N.hasClaudeMd&&" ·"]}),a.jsx("span",{className:"row__meta",children:Mw(N)})]}),a.jsx("button",{className:"row__restore",title:"Вернуть проект из архива",onClick:()=>H([N.id]),children:"Вернуть"})]},N.id)}function pt(N,ie){const Ae=hs(N);return a.jsxs("div",{"data-row-key":Ae,className:yc(N.id===A,yl.selected.includes(N.id),N.provider,!!ie)+el.dropClass(Ae),style:dt(ie),...Oe===N.id?{}:Ii(N),children:[Ge(ie),Oe===N.id?a.jsx("div",{className:"row__main",children:a.jsx(fa,{value:N.title??"",onCommit:$e=>{Z(N,$e),Ue(null)},onCancel:()=>Ue(null)})}):a.jsxs(a.Fragment,{children:[Ie&&a.jsx("button",{type:"button",className:"row__grip",title:"Перетащить, чтобы изменить порядок","aria-label":"Перетащить сессию, чтобы изменить порядок в списке",...el.gripHandlers(Ae),children:a.jsx(Df,{})}),a.jsxs("button",{className:"row__main",onClick:$e=>{vl()||yl.click($e,N,()=>V(N))},onKeyDown:$e=>el.onKeyDown(Ae,$e),children:[a.jsx(Of,{title:N.title??"Без названия",pinned:N.pinned===!0,provider:N.provider,projectName:ne(N.workspaceId),projectPath:xe(N.workspaceId)}),a.jsx(Wh,{session:N,tail:new Date(N.updatedAt).toLocaleString()})]}),a.jsx("button",{className:"row__edit",title:"Переименовать","aria-label":"Переименовать сессию",onClick:()=>{vl()||Ue(N.id)},children:"✎"})]})]},N.id)}function un(N,ie){return a.jsxs("div",{className:yc(N.id===A,!1,N.provider,!!ie),style:dt(ie),children:[Ge(ie),a.jsxs("button",{className:"row__main",onClick:()=>V(N),children:[a.jsx(Of,{title:N.title??"Без названия",pinned:!1,provider:N.provider,projectName:ne(N.workspaceId),projectPath:xe(N.workspaceId)}),a.jsx("span",{className:"row__meta",children:Aw(N)})]}),a.jsx("button",{className:"row__restore",title:"Вернуть сессию из архива",onClick:()=>le([N.id]),children:"Вернуть"})]},N.id)}function Qt(N,ie){const Ae=hs(N);return a.jsxs("div",{"data-row-key":Ae,className:yc(N.id===A,!1,N.provider,!!ie)+Ot.dropClass(Ae),style:dt(ie),...Oe===N.id?{}:{title:"Действия со строкой — правый клик или долгое нажатие",...$l(N)},children:[Ge(ie),Oe===N.id?a.jsx("div",{className:"row__main",children:a.jsx(fa,{value:N.title??"",onCommit:$e=>{Z(N,$e),Ue(null)},onCancel:()=>Ue(null)})}):a.jsxs(a.Fragment,{children:[Ie&&a.jsx("button",{type:"button",className:"row__grip",title:"Перетащить, чтобы изменить порядок","aria-label":"Перетащить сессию, чтобы изменить порядок в списке",...Ot.gripHandlers(Ae),children:a.jsx(Df,{})}),a.jsxs("button",{className:"row__main",onClick:()=>{vl()||z(N)},onKeyDown:$e=>Ot.onKeyDown(Ae,$e),children:[a.jsx(Of,{title:N.title??"Без названия",pinned:!1,provider:N.provider,projectName:ne(N.workspaceId),projectPath:xe(N.workspaceId)}),a.jsx(Wh,{session:N,tail:new Date(N.updatedAt).toLocaleString()})]})]})]},N.id)}function Vl(N){const ie=hs(N);return a.jsx("div",{"data-row-key":ie,className:yc(N.id===A,!1,N.provider)+Ze.dropClass(ie),...Oe===N.id?{}:{title:"Действия со строкой — правый клик или долгое нажатие",...ys(N)},children:Oe===N.id?a.jsx("div",{className:"row__main",children:a.jsx(fa,{value:N.title??"",onCommit:Ae=>{Z(N,Ae),Ue(null)},onCancel:()=>Ue(null)})}):a.jsxs(a.Fragment,{children:[Ie&&a.jsx("button",{type:"button",className:"row__grip",title:"Перетащить, чтобы изменить порядок","aria-label":"Перетащить сессию, чтобы изменить порядок в списке",...Ze.gripHandlers(ie),children:a.jsx(Df,{})}),a.jsxs("button",{className:"row__main",onClick:()=>{vl()||z(N)},onKeyDown:Ae=>Ze.onKeyDown(ie,Ae),children:[a.jsx(Of,{title:N.title??"Без названия",pinned:N.pinned===!0,provider:N.provider,projectName:ne(N.workspaceId),projectPath:xe(N.workspaceId)}),a.jsx(Wh,{session:N,tail:new Date(N.updatedAt).toLocaleString()})]}),a.jsx("button",{type:"button",className:"row__stop",title:"Остановить сессию","aria-label":"Остановить сессию",onClick:Ae=>{Ae.stopPropagation(),!vl()&&D(N)},children:a.jsx(xw,{})})]})},N.id)}function Ln(N,ie){return a.jsx(mw,{folder:N,count:ie,open:Ne(N.id),renaming:qe===N.id,onToggle:()=>fe(N.id),onStartRename:()=>an(N.id),onCommitRename:Ae=>{oe(N.id,Ae),an(null)},onCancelRename:()=>an(null),onDelete:()=>ge(N.id),color:ct(N),onPreviewColor:Ae=>{window.clearTimeout(rn.current),Zt({folderId:N.id,color:Ae})},onCommitColor:Ae=>{Zt({folderId:N.id,color:Ae}),se(N.id,Ae),window.clearTimeout(rn.current),rn.current=window.setTimeout(()=>Zt(null),4e3)},onResetColor:()=>{window.clearTimeout(rn.current),Zt(null),se(N.id,null)}},N.id)}return a.jsxs("aside",{className:l?"sidebar sidebar--open":"sidebar",children:[a.jsxs("div",{className:"sidebar__head",children:[a.jsx("span",{className:s?"dot dot--on":"dot",title:r}),a.jsx("span",{className:"brand",children:"Claude Code Visual"}),a.jsx("button",{className:"theme-btn",title:`Тема: ${kb[we]}`,"aria-label":`Тема: ${kb[we]}. Переключить`,onClick:Me,children:a.jsx(Sw,{mode:we})})]}),a.jsxs("div",{className:"sidebar__tabs",role:"tablist","aria-label":"Что показывать в списке",children:[a.jsx("button",{type:"button",role:"tab","aria-selected":Dt==="default",className:Dt==="default"?"sidebar__tab is-active":"sidebar__tab",onClick:()=>Et("default"),children:a.jsx("span",{className:"sidebar__tab-label",children:"Все"})}),a.jsx("button",{type:"button",role:"tab","aria-selected":Dt==="pinned",className:Dt==="pinned"?"sidebar__tab is-active":"sidebar__tab",onClick:()=>Et("pinned"),children:a.jsx("span",{className:"sidebar__tab-label",children:"Закреплённые"})}),a.jsxs("button",{type:"button",role:"tab","aria-selected":Dt==="live",className:Dt==="live"?"sidebar__tab is-active":"sidebar__tab",onClick:()=>Et("live"),children:[a.jsx("span",{className:"sidebar__tab-label",children:"Запущенные"}),j.length>0&&a.jsx("span",{className:"sidebar__tab-count",children:j.length})]})]}),a.jsxs("div",{className:"fssearch fssearch--sidebar",children:[a.jsx(_w,{}),a.jsx("input",{className:"fssearch__input",type:"text",value:wn,spellCheck:!1,placeholder:"Проект или сессия…","aria-label":"Поиск по проектам и сессиям",onChange:N=>Jn(N.target.value),onKeyDown:N=>{N.stopPropagation(),N.key==="Escape"&&(N.preventDefault(),wn?Jn(""):N.currentTarget.blur())}}),wn&&a.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>Jn(""),children:"✕"})]}),a.jsx("div",{className:"sidebar__scroll",children:Dt==="pinned"?a.jsxs(a.Fragment,{children:[a.jsx(vc,{title:"Закреплённые",count:Be.length,open:I("pinned"),onToggle:()=>Ct("pinned"),action:{label:"Новая папка закреплённых",onClick:()=>{st("pinned"),I("pinned")||Ct("pinned")}}}),I("pinned")&&a.jsxs(a.Fragment,{children:[jn==="pinned"&&a.jsx("div",{className:"row",children:a.jsx("div",{className:"row__main",children:a.jsx(fa,{value:"",placeholder:"Название папки",onCommit:N=>{W("pinned",N),st(null)},onCancel:()=>st(null)})})}),Be.length===0&&a.jsx("div",{className:"row",children:a.jsx("span",{className:"row__meta",children:at?"Ничего не найдено":"закрепите сессию через её меню (правый клик или долгое нажатие) — она останется под рукой из любого проекта"})}),_l.groups.map(N=>a.jsxs(_.Fragment,{children:[Ln(N.folder,N.items.length),Ne(N.folder.id)&&N.items.map(ie=>Qt(ie,N.folder))]},N.folder.id)),_l.ungrouped.map(N=>Qt(N))]})]}):Dt==="live"?a.jsxs(a.Fragment,{children:[a.jsx(vc,{title:"Запущенные",count:Fe.length,open:I("live"),onToggle:()=>Ct("live")}),I("live")&&a.jsxs(a.Fragment,{children:[Fe.length===0&&a.jsx("div",{className:"row",children:a.jsx("span",{className:"row__meta",children:at?"Ничего не найдено":"Нет запущенных сессий"})}),Fe.map(N=>Vl(N))]})]}):a.jsxs(a.Fragment,{children:[a.jsx(vc,{title:"Проекты",count:vt.length,open:I("workspaces"),onToggle:()=>Ct("workspaces"),action:{label:"Новая папка проектов",onClick:()=>{st("workspace"),I("workspaces")||Ct("workspaces")}}}),I("workspaces")&&a.jsxs(a.Fragment,{children:[jn==="workspace"&&a.jsx("div",{className:"row",children:a.jsx("div",{className:"row__main",children:a.jsx(fa,{value:"",placeholder:"Название папки",onCommit:N=>{W("workspace",N),st(null)},onCancel:()=>st(null)})})}),vt.length===0&&a.jsx("div",{className:"row",children:a.jsx("span",{className:"row__meta",children:at?"Ничего не найдено":"Пока ни одного"})}),Le.groups.map(N=>a.jsxs(_.Fragment,{children:[Ln(N.folder,N.items.length),Ne(N.folder.id)&&N.items.map(ie=>ht(ie,N.folder))]},N.folder.id)),Le.ungrouped.map(N=>ht(N))]}),o.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(vc,{title:"Архив проектов",count:Ft.length,open:I("workspacesArchive"),onToggle:()=>Ct("workspacesArchive"),hint:"проект закрывают вручную; каталог и история сессий остаются на диске и открываются заново отсюда или через «+ Проект»"}),I("workspacesArchive")&&a.jsxs(a.Fragment,{children:[Ft.length===0&&a.jsx("div",{className:"row",children:a.jsx("span",{className:"row__meta",children:at?"Ничего не найдено":"Пока пусто"})}),wt.groups.map(N=>a.jsxs(_.Fragment,{children:[Ln(N.folder,N.items.length),Ne(N.folder.id)&&N.items.map(ie=>en(ie,N.folder))]},N.folder.id)),wt.ungrouped.map(N=>en(N))]})]}),E&&a.jsxs(a.Fragment,{children:[a.jsx(vc,{title:"Сессии",count:jt.length,open:I("sessions"),onToggle:()=>Ct("sessions"),action:{label:"Новая папка сессий",onClick:()=>{st("session"),I("sessions")||Ct("sessions")}}}),I("sessions")&&a.jsxs(a.Fragment,{children:[jn==="session"&&a.jsx("div",{className:"row",children:a.jsx("div",{className:"row__main",children:a.jsx(fa,{value:"",placeholder:"Название папки",onCommit:N=>{W("session",N,E),st(null)},onCancel:()=>st(null)})})}),jt.length===0&&a.jsx("div",{className:"row",children:a.jsx("span",{className:"row__meta",children:at?"Ничего не найдено":"Пока ни одной"})}),Sn.groups.map(N=>a.jsxs(_.Fragment,{children:[Ln(N.folder,N.items.length),Ne(N.folder.id)&&N.items.map(ie=>pt(ie,N.folder))]},N.folder.id)),Sn.ungrouped.map(N=>pt(N))]}),x.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(vc,{title:"Архив",count:Pn.length,open:I("archive"),onToggle:()=>Ct("archive"),hint:"сессии без обращения дольше двух суток уезжают сюда сами; ничего не удаляется"}),I("archive")&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"row",children:a.jsx("span",{className:"row__meta",children:"сюда сами уезжают сессии без обращения дольше двух суток; транскрипт остаётся на диске, ничего не удаляется"})}),Pn.length===0&&a.jsx("div",{className:"row",children:a.jsx("span",{className:"row__meta",children:at?"Ничего не найдено":"Пока пусто"})}),fl.groups.map(N=>a.jsxs(_.Fragment,{children:[Ln(N.folder,N.items.length),Ne(N.folder.id)&&N.items.map(ie=>un(ie,N.folder))]},N.folder.id)),fl.ungrouped.map(N=>un(N))]})]})]})]})}),a.jsxs("div",{className:"sidebar__foot",children:[w&&a.jsxs("button",{className:"account-btn",title:"Аккаунт Claude",onClick:w,children:[a.jsx("span",{className:Ce!=null&&Ce.loggedIn?"dot dot--on":"dot"}),a.jsx("span",{className:"account-btn__id",children:Ce===null?"Аккаунт":Ce.loggedIn?Ce.email||"Вход выполнен":"Войти в аккаунт"}),(Ce==null?void 0:Ce.plan)&&a.jsx("span",{className:"chip",children:Ce.plan})]}),L&&a.jsxs("button",{className:"account-btn",title:"Доступ с телефона и из браузера",onClick:L,children:[a.jsx("span",{className:Q!=null&&Q.connected?"dot dot--on":"dot"}),a.jsx("span",{className:"account-btn__id",children:Q===null?"Удалённый доступ":Q.paired?Q.connected?Q.name||"Удалённый доступ включён":"Удалённый доступ · нет связи":"Удалённый доступ"}),(Q==null?void 0:Q.connected)&&Q.clients>0&&a.jsx("span",{className:"chip",children:Q.clients})]}),a.jsxs("div",{className:"sidebar__foot-row",children:[a.jsx("button",{className:"btn btn--ghost",disabled:!_e,title:"MCP-серверы и плагины",onClick:()=>_e==null?void 0:_e(),children:"Расширения"}),a.jsx("button",{className:"btn btn--ghost",title:"Настройки приложения",onClick:be,children:"Настройки"})]}),a.jsxs("div",{className:"sidebar__foot-row",children:[a.jsx("button",{className:"btn btn--ghost",onClick:Y,children:"+ Проект"}),a.jsx(nw,{disabled:!E,providers:de,onStart:ce})]})]}),Jt&&a.jsx(zi,{x:Jt.x,y:Jt.y,items:kn,note:vs,onClose:Al}),Vt&&a.jsx(zi,{x:Vt.x,y:Vt.y,items:rs,note:Ml,onClose:nl}),bt&&a.jsx(zi,{x:bt.x,y:bt.y,items:K,note:pe,onClose:ll}),Dn&&a.jsx(zi,{x:Dn.x,y:Dn.y,items:He,note:Zh,onClose:Lt}),ot&&a.jsx(zi,{x:ot.x,y:ot.y,items:St,note:Zh,onClose:On})]})}function yc(l,s,r,c){const o=["row"];return c&&o.push("row--foldered"),l&&o.push("row--active"),s&&o.push("row--selected"),r==="antigravity"&&o.push("row--antigravity"),r==="codex"&&o.push("row--codex"),o.join(" ")}function Ko(l,s,r=c=>c.folderId){const c=new Map(s.map(p=>[p.id,p])),o=new Map,d=[];for(const p of l){const g=r(p),x=g?c.get(g):void 0;if(!x){d.push(p);continue}const y=o.get(x.id);y?y.push(p):o.set(x.id,[p])}return{groups:[...o.entries()].map(([p,g])=>({folder:c.get(p),items:g})).sort((p,g)=>p.folder.name.localeCompare(g.folder.name,"ru")),ungrouped:d}}function rw(l,s,r){return[...l.flatMap(c=>c.items.map(r)),...s.map(r)]}const cw="\0ungrouped";function ow(l,s,r){const c=new Map;for(const o of l)for(const d of o.items)c.set(r(d),o.folder.id);for(const o of s)c.set(r(o),cw);return c}function Fh(l,s,r,c,o){const d=[...s.map(p=>p.items),r].find(p=>p.some(g=>c(g)===l));if(!d)return null;const h=d.findIndex(p=>c(p)===l);return o==="up"?h<=0?null:{target:c(d[h-1]),position:"before"}:h===-1||h>=d.length-1?null:{target:c(d[h+1]),position:"after"}}function Rf(l){const[s,r]=_.useState(null),[c,o]=_.useState(null),d=_.useMemo(()=>rw(l.groups,l.ungrouped,l.itemKey),[l.groups,l.ungrouped,l.itemKey]),h=_.useMemo(()=>ow(l.groups,l.ungrouped,l.itemKey),[l.groups,l.ungrouped,l.itemKey]);function p(){r(null),o(null)}function g(G,V){l.enabled&&(V.preventDefault(),V.currentTarget.setPointerCapture(V.pointerId),r(G),o(null))}function x(G,V){var R;if(!s)return;const Z=(R=document.elementFromPoint(G,V))==null?void 0:R.closest("[data-row-key]"),D=Z==null?void 0:Z.dataset.rowKey;if(!D||D===s||h.get(D)!==h.get(s)){o(null);return}const $=Z.getBoundingClientRect(),z=V-$.top<$.height/2?"before":"after";o(H=>(H==null?void 0:H.key)===D&&H.position===z?H:{key:D,position:z})}function y(G){x(G.clientX,G.clientY)}function j(){if(s&&c){const G=Mf(d,s,c.key,c.position);G&&l.onReorder(l.scope,G,l.workspaceId)}p()}function v(G,V){if(!l.enabled)return;const Z=Fh(G,l.groups,l.ungrouped,l.itemKey,V);if(!Z)return;const D=Mf(d,G,Z.target,Z.position);D&&l.onReorder(l.scope,D,l.workspaceId)}function C(G,V){const Z=Fh(G,l.groups,l.ungrouped,l.itemKey,"up"),D=Fh(G,l.groups,l.ungrouped,l.itemKey,"down"),$=[{id:"move-up",label:"Переместить выше",disabled:!Z,onSelect:()=>{if(!Z)return;const z=Mf(d,G,Z.target,Z.position);z&&l.onReorder(l.scope,z,l.workspaceId)}},{id:"move-down",label:"Переместить ниже",disabled:!D,onSelect:()=>{if(!D)return;const z=Mf(d,G,D.target,D.position);z&&l.onReorder(l.scope,z,l.workspaceId)}}];return V&&$.push({id:"reset-order",label:"Сбросить порядок",onSelect:()=>l.onReorder(l.scope,null,l.workspaceId)}),$}function k(G){return s===G?" row--dragging":(c==null?void 0:c.key)===G?c.position==="before"?" row--drop-before":" row--drop-after":""}function E(G){return{onPointerDown:V=>g(G,V),onPointerMove:y,onPointerUp:j,onPointerCancel:p}}function A(G,V){!V.altKey||V.key!=="ArrowUp"&&V.key!=="ArrowDown"||(V.preventDefault(),v(G,V.key==="ArrowUp"?"up":"down"))}return{dragging:s!==null,dropClass:k,gripHandlers:E,onKeyDown:A,menuItems:C}}function Zo(l){return[...[...l.folders].sort((r,c)=>r.name.localeCompare(c.name,"ru")).map(r=>({id:`folder:${r.id}`,label:`В папку «${r.name}»`,onSelect:()=>{l.ids.forEach(c=>l.assign(c,r.id)),l.onClear()}})),...l.hasFolder?[{id:"folder:none",label:"Без папки",onSelect:()=>{l.ids.forEach(r=>l.assign(r,null)),l.onClear()}}]:[],{id:"folder:new",label:"Новая папка…",onSelect:l.onNewFolder}]}function uw(l){return l.map(s=>({...s,id:`pinned:${s.id}`,label:s.id==="folder:new"?"Новая папка закреплённых…":s.id==="folder:none"?"Без папки закреплённых":s.label}))}function Jh(l){const[s,r]=_.useState([]),c=_.useRef(null);function o(){r([]),c.current=null}function d(p,g,x){if(p.ctrlKey||p.metaKey){r(y=>y.includes(g.id)?y.filter(j=>j!==g.id):[...y,g.id]),c.current=g.id;return}if(p.shiftKey&&c.current){const y=l.findIndex(v=>v.id===c.current),j=l.findIndex(v=>v.id===g.id);if(y!==-1&&j!==-1){const[v,C]=y<j?[y,j]:[j,y];r(l.slice(v,C+1).map(k=>k.id));return}}o(),c.current=g.id,x()}function h(p){return s.includes(p.id)?s:(r([p.id]),c.current=p.id,[p.id])}return{selected:s,click:d,targetsFor:h,clear:o}}const fw={display:"flex",alignItems:"center",gap:6,flex:1,minWidth:0,textAlign:"left"},dw={width:22,height:22,borderRadius:6};function vc({title:l,count:s,open:r,onToggle:c,hint:o,action:d}){const h=r?`Свернуть «${l}»`:`Развернуть «${l}»`;return a.jsxs("div",{className:"sidebar__section",children:[a.jsxs("button",{className:"sidebar__section--btn",style:fw,"aria-expanded":r,title:o?`${h} — ${o}`:h,onClick:c,children:[a.jsx(Q_,{open:r}),a.jsx("span",{className:"sidebar__section-name",children:l}),a.jsx("span",{className:"sidebar__count",children:s})]}),d&&a.jsx("button",{className:"theme-btn",style:dw,title:d.label,"aria-label":d.label,onClick:d.onClick,children:a.jsx(yw,{})})]})}const Nb={paddingLeft:22},hw={display:"flex",alignItems:"center",gap:6,width:"100%"},pw={flex:1,minWidth:0,color:"var(--text-2)",fontWeight:500};function mw({folder:l,count:s,open:r,renaming:c,onToggle:o,onStartRename:d,onCommitRename:h,onCancelRename:p,onDelete:g,color:x,onPreviewColor:y,onCommitColor:j,onResetColor:v}){const C=_.useRef(null),k=_.useRef(j);return k.current=j,_.useEffect(()=>{const E=C.current;if(!E)return;const A=()=>k.current(E.value);return E.addEventListener("change",A),()=>E.removeEventListener("change",A)},[c]),c?a.jsx("div",{className:"row",style:Nb,children:a.jsx("div",{className:"row__main",children:a.jsx(fa,{value:l.name,placeholder:"Название папки",onCommit:h,onCancel:p})})}):a.jsxs("div",{className:"row",style:Nb,children:[a.jsxs("button",{className:"row__main",style:hw,"aria-expanded":r,title:r?`Свернуть папку «${l.name}»`:`Развернуть папку «${l.name}»`,onClick:o,children:[a.jsx(Q_,{open:r}),a.jsx("span",{style:pw,children:l.name}),a.jsx("span",{className:"sidebar__count",children:s})]}),a.jsx("button",{className:"row__edit",title:"Переименовать папку","aria-label":`Переименовать папку «${l.name}»`,onClick:d,children:"✎"}),a.jsxs("label",{className:x?"row__swatch row__swatch--set":"row__swatch",title:`Цвет папки «${l.name}»`,children:[a.jsx("span",{className:"row__swatch-dot",style:x?{background:x}:void 0}),a.jsx("input",{ref:C,type:"color",value:x??gw(),"aria-label":`Цвет папки «${l.name}»`,onChange:E=>y(E.target.value)})]}),l.color&&a.jsx("button",{className:"row__edit",title:"Сбросить цвет папки","aria-label":`Сбросить цвет папки «${l.name}»`,onClick:v,children:"↺"}),a.jsx("button",{className:"row__edit",title:"Удалить папку — содержимое останется, просто станет без папки","aria-label":`Удалить папку «${l.name}»`,onClick:g,children:"✕"})]})}function gw(){const l=getComputedStyle(document.documentElement).getPropertyValue("--folder-default").trim();return/^#[0-9a-f]{6}$/i.test(l)?l.toLowerCase():"#9a978d"}function Q_({open:l}){return a.jsx("svg",{className:l?"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:a.jsx("path",{d:"M6 3.5 10.5 8 6 12.5"})})}function Df(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:[a.jsx("circle",{cx:"5.5",cy:"4",r:"1.15"}),a.jsx("circle",{cx:"5.5",cy:"8",r:"1.15"}),a.jsx("circle",{cx:"5.5",cy:"12",r:"1.15"}),a.jsx("circle",{cx:"10.5",cy:"4",r:"1.15"}),a.jsx("circle",{cx:"10.5",cy:"8",r:"1.15"}),a.jsx("circle",{cx:"10.5",cy:"12",r:"1.15"})]})}function xw(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:a.jsx("rect",{x:"3.6",y:"3.6",width:"8.8",height:"8.8",rx:"1.8"})})}function bw({className:l}){return a.jsxs("svg",{className:l,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("rect",{x:"4.5",y:"2.4",width:"7",height:"4.2",rx:"1.6"}),a.jsx("path",{d:"M5.4 6.6 8 12.2 10.6 6.6"}),a.jsx("path",{d:"M8 12.2v1.4"})]})}function _w(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[a.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),a.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}function yw(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round","aria-hidden":"true",children:a.jsx("path",{d:"M8 3.2v9.6M3.2 8h9.6"})})}function vw(){try{const l=localStorage.getItem($_);if(l===null)return["archive","workspacesArchive"];const s=JSON.parse(l);return Array.isArray(s)?s.filter(r=>r==="workspaces"||r==="workspacesArchive"||r==="sessions"||r==="archive"||r==="pinned"||r==="live"):["archive","workspacesArchive"]}catch{return["archive","workspacesArchive"]}}function jw(){try{const l=localStorage.getItem(V_);if(l===null)return[];const s=JSON.parse(l);return Array.isArray(s)?s.filter(r=>typeof r=="string"):[]}catch{return[]}}function ww(){try{const l=localStorage.getItem(X_);return l==="pinned"||l==="live"?l:"default"}catch{return"default"}}const kb={system:"как в системе",light:"светлая",dark:"тёмная"};function Sw({mode:l}){const s={viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};return l==="dark"?a.jsx("svg",{...s,children:a.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"})}):l==="light"?a.jsxs("svg",{...s,children:[a.jsx("circle",{cx:"8",cy:"8",r:"3.1"}),a.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"})]}):a.jsxs("svg",{...s,children:[a.jsx("rect",{x:"1.8",y:"2.6",width:"12.4",height:"8.4",rx:"1.4"}),a.jsx("path",{d:"M5.6 13.4h4.8"})]})}function Nw(l){const s=kw(l),r=(l.tasks??[]).filter(c=>c.kind==="agent").length;return r>0?`${s} · ${Y_(r)}`:s}function kw(l){switch(l.state){case"running":return"работает";case"waiting_permission":return"ждёт разрешения";case"idle":return l.backgroundWork?"работает в фоне":Tw(l.lastTurn);case"starting":return"запускается";case"reconnecting":return"переподключается";case"error":return"ошибка";case"closed":return"на диске"}}function Tw(l){switch(l){case"interrupted":return"прервана";case"stopped":return"остановлена";case"failed":return"оборвалась";case"completed":return"готова";case null:return"ждёт задачу"}}function Ew(l){switch(l.state){case"running":return"running";case"starting":return"starting";case"reconnecting":return"reconnecting";case"waiting_permission":return"waiting";case"idle":return l.backgroundWork?"background":Cw(l.lastTurn);case"error":return"error";case"closed":return"closed"}}function Cw(l){switch(l){case"interrupted":case"stopped":return"halted";case"failed":return"error";case"completed":return"ready";case null:return"fresh"}}function Wh({session:l,tail:s}){return a.jsxs("span",{className:"row__meta",children:[a.jsxs("span",{className:`row__state row__state--${Ew(l)}`,children:[a.jsx("span",{className:"row__state-dot","aria-hidden":"true"}),Nw(l)]})," · ",s]})}function Of({title:l,pinned:s,provider:r,projectName:c,projectPath:o}){return a.jsxs("span",{className:"row__head",children:[a.jsxs("span",{className:"row__title",children:[s&&a.jsx(bw,{className:"row__pin"}),r==="antigravity"&&a.jsx(Lp,{className:"row__provider"}),r==="codex"&&a.jsx(zp,{className:"row__provider row__provider--codex"}),l]}),a.jsx("span",{className:"row__project",title:o,children:c})]})}function Aw(l){const s=l.archivedAuto?"сама, по сроку молчания":"убрана вручную";return l.archivedAt?`${new Date(l.archivedAt).toLocaleString()} · ${s}`:s}function Mw(l){return l.archivedAt?`закрыт ${new Date(l.archivedAt).toLocaleString()}`:"закрыт"}const K_=1500;function Z_(l){const s=[];let r=!1;for(const c of l.patch.split(`
119
119
  `)){if(s.length>=K_){r=!0;break}if(c.startsWith("@@"))s.push({type:"gap",text:Rw(c)});else if(c.startsWith("+"))s.push({type:"add",text:c.slice(1)});else if(c.startsWith("-"))s.push({type:"del",text:c.slice(1)});else{if(c.startsWith("\\"))continue;(c!==""||s.length>0)&&s.push({type:"ctx",text:c.startsWith(" ")?c.slice(1):c})}}return{kind:"patch",filePath:l.path||l.oldPath,rows:s,added:l.added,removed:l.removed,note:Dw(l,r)}}function Rw(l){const s=/^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@ ?(.*)$/.exec(l);if(!s)return l;const r=Number(s[1]),c=s[2]===void 0?1:Number(s[2]),o=(s[3]??"").trim(),d=c>1?`строки ${r}–${r+c-1}`:`строка ${r}`;return o?`⋯ ${d} · ${o}`:`⋯ ${d}`}function Dw(l,s){const r=[];return l.status==="added"&&r.push("новый файл"),l.status==="deleted"&&r.push("файл удалён"),l.status==="renamed"&&r.push(`переименован из ${l.oldPath}`),l.binary?r.push("двоичный файл"):l.patch===""&&r.push("содержимое не показано"),s&&r.push(`показаны первые ${K_} строк`),r.length>0?r.join(" · "):null}function F_(l,s){if(l!=="apply_patch"||!s||typeof s!="object"){const c=Lw(l,s);return c?[c]:[]}const r=s.changes;return Array.isArray(r)?r.flatMap(c=>{if(!c||typeof c!="object")return[];const o=c;if(typeof o.path!="string"||typeof o.diff!="string")return[];const d=o.diff.split(`
120
120
  `).filter(p=>!/^(--- |\+\+\+ |diff --git |index )/.test(p)),h=typeof o.kind=="object"&&o.kind?o.kind.type:o.kind;return[Z_({path:o.path,oldPath:"",binary:!1,status:h==="add"?"added":h==="delete"?"deleted":"modified",added:d.filter(p=>p.startsWith("+")).length,removed:d.filter(p=>p.startsWith("-")).length,patch:d.join(`
121
121
  `)})]}):[]}const Tb=3,Ow=15e5;function Lw(l,s){if(!s||typeof s!="object")return null;const r=s,c=typeof r.file_path=="string"?r.file_path:"";if(!c)return null;if(l==="Write"){if(typeof r.content!="string")return null;const o=Ph(r.content).map(d=>({type:"add",text:d}));return{kind:"create",filePath:c,rows:o,added:o.length,removed:0,note:"файл записывается целиком"}}if(l==="Edit"){if(typeof r.old_string!="string"||typeof r.new_string!="string")return null;const o=Bw(zw(Ph(r.old_string),Ph(r.new_string)));return{kind:"edit",filePath:c,rows:o,added:o.filter(d=>d.type==="add").length,removed:o.filter(d=>d.type==="del").length,note:r.replace_all===!0?"все вхождения":null}}return null}function Ph(l){if(l==="")return[];const s=l.split(/\r?\n/);return s.length>1&&s[s.length-1]===""&&s.pop(),s}function zw(l,s){let r=0;for(;r<l.length&&r<s.length&&l[r]===s[r];)r++;let c=l.length,o=s.length;for(;c>r&&o>r&&l[c-1]===s[o-1];)c--,o--;const d=h=>({type:"ctx",text:h});return[...l.slice(0,r).map(d),...Uw(l.slice(r,c),s.slice(r,o)),...l.slice(c).map(d)]}function Uw(l,s){if(l.length===0&&s.length===0)return[];if(l.length===0)return s.map(y=>({type:"add",text:y}));if(s.length===0)return l.map(y=>({type:"del",text:y}));if((l.length+1)*(s.length+1)>Ow)return[...l.map(y=>({type:"del",text:y})),...s.map(y=>({type:"add",text:y}))];const r=l.length,c=s.length,o=c+1,d=new Uint32Array((r+1)*o),h=(y,j)=>d[y*o+j]??0;for(let y=r-1;y>=0;y--)for(let j=c-1;j>=0;j--)d[y*o+j]=l[y]===s[j]?h(y+1,j+1)+1:Math.max(h(y+1,j),h(y,j+1));const p=[];let g=0,x=0;for(;g<r&&x<c;){const y=l[g],j=s[x];y===j?(p.push({type:"ctx",text:y}),g++,x++):h(g+1,x)>=h(g,x+1)?(p.push({type:"del",text:y}),g++):(p.push({type:"add",text:j}),x++)}for(;g<r;)p.push({type:"del",text:l[g++]});for(;x<c;)p.push({type:"add",text:s[x++]});return Hw(p)}function Hw(l){const s=[];let r=[];function c(){s.push(...r.filter(o=>o.type==="del")),s.push(...r.filter(o=>o.type==="add")),r=[]}for(const o of l)o.type==="ctx"?(c(),s.push(o)):r.push(o);return c(),s}function Bw(l){if(!l.some(d=>d.type!=="ctx"))return l;const s=l.map(()=>!1);l.forEach((d,h)=>{if(d.type!=="ctx")for(let p=Math.max(0,h-Tb);p<=Math.min(l.length-1,h+Tb);p++)s[p]=!0});const r=[];let c=[];function o(){c.length===1?r.push(...c):c.length>1&&r.push({type:"gap",text:`⋯ ${c.length} ${Iw(c.length)} без изменений`}),c=[]}return l.forEach((d,h)=>{s[h]?(o(),r.push(d)):c.push(d)}),o(),r}function Iw(l){const s=l%100;if(s>=11&&s<=14)return"строк";switch(l%10){case 1:return"строка";case 2:case 3:case 4:return"строки";default:return"строк"}}async function ha(l){try{return await navigator.clipboard.writeText(l),!0}catch{}const s=document.createElement("textarea");s.value=l,s.setAttribute("readonly",""),s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s);try{return s.select(),document.execCommand("copy")}catch{return!1}finally{s.remove()}}async function xp(){try{return await navigator.clipboard.readText()}catch{return null}}const Up=1600,Tr="Копировать",Ec="Скопировано";function Hc({text:l,hint:s,className:r}){const[c,o]=_.useState(!1);return _.useEffect(()=>{if(!c)return;const d=setTimeout(()=>o(!1),Up);return()=>clearTimeout(d)},[c]),_.useEffect(()=>o(!1),[l]),a.jsx("button",{type:"button",className:"copybtn"+(c?" copybtn--done":"")+(r?` ${r}`:""),"aria-label":c?Ec:`${Tr} ${s}`,title:c?Ec:`${Tr} ${s}`,onClick:()=>{ha(l).then(d=>{d&&o(!0)})},children:c?Ec:Tr})}function Hp({diff:l}){return a.jsxs("div",{className:"diff",children:[a.jsxs("div",{className:"diff__head",children:[a.jsx("span",{className:"diff__path",title:l.filePath,children:l.filePath}),a.jsxs("span",{className:"diff__stat",children:[l.added>0&&a.jsxs("span",{className:"diff__stat--add",children:["+",l.added]}),l.removed>0&&a.jsxs("span",{className:"diff__stat--del",children:["−",l.removed]})]})]}),l.note&&a.jsx("div",{className:"diff__note",children:l.note}),a.jsx("div",{className:"diff__body",children:l.rows.length===0?a.jsx("div",{className:"diff__row diff__row--gap",children:a.jsx("span",{className:"diff__text",children:"пустое содержимое"})}):l.rows.map((s,r)=>a.jsxs("div",{className:`diff__row diff__row--${s.type}`,children:[a.jsx("span",{className:"diff__mark","aria-hidden":"true",children:s.type==="add"?"+":s.type==="del"?"−":""}),a.jsx("span",{className:"diff__text",children:s.text===""?" ":s.text})]},r))})]})}function qw({waiting:l}){const[s,r]=_.useState(0);return _.useEffect(()=>{const c=window.setInterval(()=>r(o=>o+1),1e3);return()=>window.clearInterval(c)},[]),a.jsxs("div",{className:l?"work work--wait":"work",children:[a.jsxs("span",{className:"work__dots","aria-hidden":"true",children:[a.jsx("span",{className:"work__dot"}),a.jsx("span",{className:"work__dot"}),a.jsx("span",{className:"work__dot"})]}),a.jsx("span",{className:"work__label",children:l?"ждёт разрешения":"думает"}),!l&&a.jsxs("span",{className:"work__time",children:[s," с"]})]})}function Bp({items:l,busy:s,waiting:r,history:c=[],historyHasMore:o=!1,historyLoading:d=!1,onLoadHistory:h,sessionId:p,onEditMessage:g,empty:x="Сессия пуста. Опишите задачу — Claude Code работает в каталоге проекта с полным набором инструментов."}){const y=_.useRef(null),j=_.useRef(null),v=_.useRef(!0),C=_.useRef(null),k=_.useRef(null),E=_.useRef(!1);_.useEffect(()=>{v.current=!0,C.current=null,E.current=!1,k.current!==null&&(clearTimeout(k.current),k.current=null)},[p]),_.useEffect(()=>{const D=y.current,$=j.current;if(!D||!$)return;function z(B){!D||B===D.scrollTop||(E.current=!0,D.scrollTop=B)}function R(){if(!D)return;const B=C.current;if(B){const le=Cb(D,B.id);if(le){const W=le.getBoundingClientRect().top-D.getBoundingClientRect().top;z(D.scrollTop+(W-B.top))}k.current!==null&&clearTimeout(k.current),k.current=setTimeout(()=>{C.current=null},500);return}v.current&&z(D.scrollHeight)}const H=new ResizeObserver(R);return H.observe($),()=>{H.disconnect(),k.current!==null&&clearTimeout(k.current)}},[]);function A(){const D=y.current;if(D){if(E.current){E.current=!1;return}v.current=D.scrollHeight-D.scrollTop-D.clientHeight<80}}function G(){if(d)return;const D=y.current,$=c[0];if(D&&$){const z=Cb(D,$.id);z&&(C.current={id:$.id,top:z.getBoundingClientRect().top-D.getBoundingClientRect().top})}h==null||h()}let V=0;function Z(D){return D.kind==="user"?V++:-1}return a.jsx("div",{className:"transcript",ref:y,onScroll:A,children:a.jsxs("div",{className:"stream",ref:j,children:[o&&a.jsx("button",{type:"button",className:"transcript__more",onClick:G,disabled:d,children:d?"Загружаем…":"Показать более раннее"}),c.map(D=>a.jsx(Eb,{item:D,userIndex:Z(D),onEditMessage:g},D.id)),c.length>0&&l.length>0&&a.jsx("div",{className:"transcript__divider",children:a.jsx("span",{children:"дальше — сессия открыта заново"})}),c.length===0&&l.length===0&&a.jsx("p",{className:"empty",children:x}),l.map(D=>a.jsx(Eb,{item:D,userIndex:Z(D),onEditMessage:g},D.id)),s&&a.jsx(qw,{waiting:r})]})})}function Eb({item:l,userIndex:s,onEditMessage:r}){switch(l.kind){case"user":return a.jsx(Yw,{item:l,userIndex:s,onEditMessage:r});case"assistant":return a.jsxs("div",{className:"msg--assistant","data-item-id":l.id,children:[a.jsx($w,{text:l.text}),l.streaming&&a.jsx("span",{className:"caret"}),l.text.trim()!==""&&a.jsx("div",{className:"msg--assistant__foot",children:a.jsx(Hc,{text:l.text,hint:"ответ целиком"})})]});case"thinking":return a.jsx("div",{className:"thinking","data-item-id":l.id,children:l.text});case"tool":return a.jsx(Vw,{item:l});case"result":return a.jsxs("div",{className:"result-line","data-item-id":l.id,children:[a.jsx("span",{children:l.isError?"✗ "+l.subtype:l.subtype==="interrupted"?"⏹ прервано":"✓ готово"}),a.jsxs("span",{children:[(l.durationMs/1e3).toFixed(1)," с"]}),l.costUsd!==null&&a.jsxs("span",{children:["$",l.costUsd.toFixed(4)]}),l.inputTokens!==null&&l.outputTokens!==null&&a.jsxs("span",{children:["↑",Mb(l.inputTokens)," ↓",Mb(l.outputTokens)]})]});case"notice":return a.jsx("div",{className:l.tone==="error"?"notice notice--error":"notice","data-item-id":l.id,children:l.text})}}const Gw=500;function Yw({item:l,userIndex:s,onEditMessage:r}){const[c,o]=_.useState(null),[d,h]=_.useState(!1),[p,g]=_.useState(l.text),x=_.useRef(null),y=_.useRef(!1),j=td("(max-width: 860px)"),v=_.useRef(null);function C(H,B){o({x:H,y:B})}function k(H){H.preventDefault(),C(H.clientX,H.clientY)}function E(H){const B=H.touches[0];if(!B)return;const le={timer:0,x:B.clientX,y:B.clientY,fired:!1};le.timer=window.setTimeout(()=>{le.fired=!0,C(le.x,le.y)},Gw),v.current=le}function A(H){const B=v.current,le=H.touches[0];!B||!le||Math.hypot(le.clientX-B.x,le.clientY-B.y)>10&&(window.clearTimeout(B.timer),v.current=null)}function G(H){const B=v.current;B&&(window.clearTimeout(B.timer),B.fired&&H.preventDefault())}function V(){g(l.text),h(!0)}function Z(){h(!1)}function D(){const H=p.trim();if(H===""&&!(l.images&&l.images.length>0))return;const B=r==null?void 0:r(s,H,l.images);if(B instanceof Promise){if(y.current)return;y.current=!0,B.then(le=>{y.current=!1,le&&h(!1)},()=>{y.current=!1});return}B!==!1&&h(!1)}_.useEffect(()=>{const H=x.current;!H||!d||(H.style.height="auto",H.style.height=`${H.scrollHeight}px`)},[p,d]),_.useEffect(()=>{if(!d)return;const H=x.current;H&&(H.focus(),H.setSelectionRange(H.value.length,H.value.length))},[d]);function $(H){if(H.key==="Escape"){H.preventDefault(),H.stopPropagation(),Z();return}H.key==="Enter"&&!H.shiftKey&&!j&&(H.preventDefault(),D())}const z=l.images&&l.images.length>0&&a.jsx("div",{className:"msg--user__images",children:l.images.map((H,B)=>a.jsx("img",{className:"msg--user__image",src:`data:${H.mediaType};base64,${H.data}`,alt:"Вложение"},B))});if(d){const H=p.trim()!==""||!!(l.images&&l.images.length>0);return a.jsxs("div",{className:"msg--user msg--user--editing","data-item-id":l.id,children:[z,a.jsxs("div",{className:"msg--user__edit",children:[a.jsx("textarea",{ref:x,className:"msg--user__edit-field",value:p,onChange:B=>g(B.target.value),onKeyDown:$,rows:1}),a.jsxs("div",{className:"msg--user__edit-actions",children:[a.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:Z,children:"Отмена"}),a.jsx("button",{type:"button",className:"btn btn--sm btn--primary",onClick:D,disabled:!H,children:"Сохранить"})]})]})]})}const R=[{id:"copy",label:"Копировать",onSelect:()=>void ha(l.text)},...r?[{id:"edit",label:"Изменить",onSelect:V}]:[]];return a.jsxs("div",{className:"msg--user","data-item-id":l.id,onContextMenu:k,onTouchStart:E,onTouchMove:A,onTouchEnd:G,onTouchCancel:G,children:[z,l.text,c&&a.jsx(zi,{x:c.x,y:c.y,items:R,onClose:()=>o(null)})]})}function Cb(l,s){const r=l.querySelectorAll("[data-item-id]");for(const c of r)if(c.dataset.itemId===s)return c;return null}function $w({text:l}){const[s,r]=_.useState(""),c=_.useRef([]);_.useEffect(()=>{let d=!1;return sd(l).then(h=>{d||r(Xw(h))}),()=>{d=!0}},[l]),_.useEffect(()=>{const d=c.current;return()=>d.forEach(h=>clearTimeout(h))},[]);function o(d){var g,x;const h=d.target.closest(".codeblock__copy");if(!(h instanceof HTMLElement))return;const p=((x=(g=h.parentElement)==null?void 0:g.querySelector("pre"))==null?void 0:x.textContent)??"";p!==""&&ha(p).then(y=>{if(!y)return;h.textContent=Ec,h.setAttribute("aria-label",Ec),h.classList.add("copybtn--done");const j=window.setTimeout(()=>{h.isConnected&&(h.textContent=Tr,h.setAttribute("aria-label",bp),h.classList.remove("copybtn--done"))},Up);c.current.push(j)})}return a.jsx("div",{className:"markdown-preview msg--assistant__body",onClick:o,dangerouslySetInnerHTML:{__html:s}})}const bp=`${Tr} блок кода`;function Xw(l){if(!l.includes("<pre"))return l;const s=new DOMParser().parseFromString(l,"text/html");for(const r of s.body.querySelectorAll("pre")){const c=s.createElement("div");c.className="codeblock",r.replaceWith(c),c.append(r);const o=s.createElement("button");o.type="button",o.className="copybtn codeblock__copy",o.setAttribute("aria-label",bp),o.title=bp,o.textContent=Tr,c.append(o)}return s.body.innerHTML}function Vw({item:l}){const[s,r]=_.useState(!1),c=l.result===null,o=F_(l.name,l.input),d=l.name==="AskUserQuestion"?Zw(l.input):null;return a.jsxs("div",{className:"tool"+(l.isError?" tool--error":"")+(l.awaitingPermission?" tool--wait":""),"data-item-id":l.id,children:[a.jsxs("button",{className:"tool__head",onClick:()=>r(h=>!h),children:[a.jsx("span",{className:"tool__name",children:l.name}),a.jsx("span",{className:"tool__arg",children:d?Kw(d):Qw(l.input)}),a.jsx("span",{className:"tool__status",children:c?"…":l.isError?"ошибка":s?"▴":"▾"})]}),s&&a.jsxs("div",{className:"tool__body",children:[d?a.jsx(Fw,{questions:d,answers:l.answers}):o.length>0?o.map((h,p)=>a.jsx(Hp,{diff:h},p)):a.jsx(Ab,{text:JSON.stringify(l.input,null,2),hint:"аргументы вызова"}),l.result!==null&&(!d||l.isError)&&a.jsx(Ab,{text:l.result,hint:"результат вызова",style:{marginTop:10}})]})]})}function Ab({text:l,hint:s,style:r}){return a.jsxs("div",{className:"codeblock",style:r,children:[a.jsx("pre",{className:"code",children:l}),a.jsx(Hc,{text:l,hint:s,className:"codeblock__copy"})]})}function Qw(l){if(!l||typeof l!="object")return"";const s=l;for(const r of["file_path","command","pattern","path","url","prompt"]){const c=s[r];if(typeof c=="string")return c.replace(/\s+/g," ").slice(0,160)}return JSON.stringify(s).slice(0,160)}function Kw(l){var r;const s=l.map(c=>c.header).filter(c=>c.length>0);return s.length===l.length?s.join(" · "):((r=l[0])==null?void 0:r.question.replace(/\s+/g," ").slice(0,160))??""}function Zw(l){if(typeof l!="object"||l===null)return null;const s=l.questions;if(!Array.isArray(s)||s.length===0)return null;const r=[];for(const c of s){if(typeof c!="object"||c===null)return null;const{question:o,header:d,options:h,multiSelect:p}=c;if(typeof o!="string"||!Array.isArray(h)||h.length===0)return null;const g=[];for(const x of h){if(typeof x!="object"||x===null)return null;const{label:y,description:j,preview:v}=x;if(typeof y!="string"||typeof j!="string")return null;g.push({label:y,description:j,...typeof v=="string"?{preview:v}:{}})}r.push({question:o,header:typeof d=="string"?d:"",options:g,multiSelect:p===!0})}return r}function Fw({questions:l,answers:s}){return a.jsx("div",{className:"tool__questions",children:l.map((r,c)=>a.jsxs("div",{className:"tool__question",children:[a.jsxs("div",{className:"tool__question-head",children:[r.header&&a.jsx("span",{className:"chip chip--accent",children:r.header}),a.jsx("span",{className:"tool__question-text",children:r.question})]}),a.jsx("div",{className:"tool__question-answer",children:s!=null&&s[r.question]?a.jsx("span",{className:"tool__answer-value",children:s[r.question]}):a.jsx("span",{className:"tool__answer-empty",children:"не отвечено"})})]},c))})}function Mb(l){return l>=1e3?`${(l/1e3).toFixed(1)}k`:String(l)}const Jw="ccv.dictation.lang",Rb="ru-RU";function Ww(l){try{return Function.prototype.toString.call(l).includes("[native code]")}catch{return!1}}function Db(){const l=window,s=[l.SpeechRecognition,l.webkitSpeechRecognition].filter(c=>typeof c=="function"),r=s.find(Ww);return!r&&s.length>0&&Us("распознавание подменено: родной реализации в странице нет"),r??s[0]??null}function J_(){var l;try{return((l=localStorage.getItem(Jw))==null?void 0:l.trim())||Rb}catch{return Rb}}function Us(l,s){s===void 0?console.debug(`[dictation] ${l}`):console.debug(`[dictation] ${l}`,s)}const Pw=3,eS=400,tS=5,nS=250,lS=2e3,sS=2e4;async function aS(){try{return(await navigator.permissions.query({name:"microphone"})).state==="granted"}catch{return!1}}const iS={"not-allowed":"Браузер не дал доступ к микрофону","service-not-allowed":"Браузер не дал доступ к микрофону","audio-capture":"Микрофон не найден",network:"Сервис распознавания недоступен","language-not-supported":`Распознавание не знает языка ${J_()}`};function rS(l){const[s]=_.useState(()=>Db()!==null),[r,c]=_.useState(!1),[o,d]=_.useState(null),h=_.useRef(null),p=_.useRef(!1),g=_.useRef(!1),x=_.useRef(l),y=_.useRef({openedAt:0,audio:!1,heard:!1,everHeard:!1,silent:0,dead:0,lastError:"",warned:!1}),j=_.useRef(null),v=_.useRef(!1),C=_.useRef(null),k=_.useCallback(()=>{C.current&&clearTimeout(C.current),C.current=null},[]),E=_.useCallback(()=>{k();const D=async $=>{if(C.current=null,!(!p.current||v.current)){if(!$&&!await aS()){if(Us("ждём ответа на запрос доступа к микрофону"),!p.current||v.current)return;C.current=setTimeout(()=>void D(!0),sS);return}Us("движок не ответил на start()"),p.current=!1,c(!1),d("Распознавание не отвечает — проверьте расширения браузера и доступ к микрофону")}};C.current=setTimeout(()=>void D(!1),lS)},[k]);_.useEffect(()=>{x.current=l}),_.useEffect(()=>{const D=Db();if(!D)return;const $=new D;return $.lang=J_(),$.continuous=!0,$.interimResults=!0,$.onstart=()=>{Us("сессия открыта"),v.current=!0,k(),c(!0)},$.onaudiostart=()=>{Us("пошёл звук с микрофона"),y.current.audio=!0},$.onresult=z=>{var le;if(g.current)return;let R="",H="";for(let W=z.resultIndex;W<z.results.length;W++){const oe=z.results[W];if(!oe)continue;const se=((le=oe[0])==null?void 0:le.transcript)??"";oe.isFinal?R+=se:H+=se}const B=y.current;B.heard=!0,B.everHeard=!0,Us("распознано",{final:R,interim:H}),x.current(R,H)},$.onerror=z=>{y.current.lastError=z.error,Us("ошибка движка",z.error),!(z.error==="no-speech"||z.error==="aborted")&&(p.current=!1,c(!1),d(iS[z.error]??`Распознавание не работает: ${z.error}`))},$.onend=()=>{g.current=!1,v.current=!1;const z=y.current,R=Date.now()-z.openedAt;if(Us("сессия закрыта",{мс:R,звук:z.audio,слова:z.heard,ошибка:z.lastError||null}),!p.current){c(!1);return}if(z.dead=!z.audio&&R<eS?z.dead+1:0,z.dead>=tS){p.current=!1,c(!1),d(z.lastError?`Распознавание не работает: ${z.lastError}`:"Распознавание закрывается сразу после запуска — проверьте доступ к микрофону в настройках сайта");return}z.silent=z.heard?0:z.silent+1,!z.everHeard&&!z.warned&&z.silent>=Pw&&(z.warned=!0,d(z.audio?"Микрофон слушает, но речь не распознаётся — проверьте язык диктовки и уровень звука":"С микрофона не идёт звук — проверьте устройство ввода в настройках сайта в браузере")),j.current=setTimeout(()=>{if(j.current=null,!!p.current){z.openedAt=Date.now(),z.audio=!1,z.heard=!1,z.lastError="",E();try{$.start()}catch{}}},nS)},h.current=$,()=>{p.current=!1,j.current&&clearTimeout(j.current),j.current=null,k(),$.onend=null,$.onresult=null,$.onerror=null,$.onstart=null,$.onaudiostart=null,$.abort(),h.current=null}},[]);const A=_.useCallback(()=>{var D;if(p.current){if(p.current=!1,Us("выключение микрофона"),j.current&&clearTimeout(j.current),j.current=null,k(),!v.current){c(!1);return}(D=h.current)==null||D.stop()}},[]),G=_.useCallback(()=>{const D=h.current;if(D){if(!window.isSecureContext){d("Микрофон доступен только по https или с localhost");return}d(null),p.current=!0,g.current=!1,j.current&&clearTimeout(j.current),j.current=null,y.current={openedAt:Date.now(),audio:!1,heard:!1,everHeard:!1,silent:0,dead:0,lastError:"",warned:!1},c(!0),Us("включение микрофона",{язык:D.lang}),E();try{D.start()}catch($){Us("start() не прошёл",$)}}},[E]),V=_.useCallback(()=>{p.current?A():G()},[G,A]),Z=_.useCallback(()=>{var D;p.current&&v.current&&(g.current=!0,(D=h.current)==null||D.abort())},[]);return{supported:s,listening:r,error:o,toggle:V,stop:A,drop:Z}}const cS="(max-width: 860px)",Ob=/^\/(\S*)$/,oS=new Set(["model","permissions"]);function uS(l){return oS.has(l.name)||l.name.startsWith("__")}const fS=new Set(["clear","rename"]),Lb=/(?:^|\s)@([^\s@]*)$/,dS=200,hS=100,pS=190,mS=5,gS=20*1024*1024,xS=1568,bS=.85;let zb=0;async function _S(l){var j,v;if(!l.type.startsWith("image/")||l.size>gS)return null;const s=await yS(l);if(!s)return null;const{width:r,height:c}=s;if(r<=0||c<=0)return null;const o=Math.min(1,xS/Math.max(r,c)),d=document.createElement("canvas");d.width=Math.max(1,Math.round(r*o)),d.height=Math.max(1,Math.round(c*o));const h=d.getContext("2d");if(!h)return null;h.drawImage(s.image,0,0,d.width,d.height),(v=(j=s.image).close)==null||v.call(j);const p=l.type==="image/png",g=p?"image/png":"image/jpeg",x=d.toDataURL(g,p?void 0:bS),y=x.slice(x.indexOf(",")+1);return y?(zb+=1,{id:`att${zb}`,mediaType:g,data:y,previewUrl:x}):null}async function yS(l){if(typeof createImageBitmap=="function")try{const s=await createImageBitmap(l);return{image:s,width:s.width,height:s.height}}catch{}return new Promise(s=>{const r=URL.createObjectURL(l),c=new Image;c.onload=()=>{URL.revokeObjectURL(r),s({image:c,width:c.naturalWidth,height:c.naturalHeight})},c.onerror=()=>{URL.revokeObjectURL(r),s(null)},c.src=r})}function W_({disabled:l,busy:s,commands:r,sessionTitle:c,contextResult:o,className:d,placeholder:h,draftKey:p,sendLabel:g="Отправить",autoFocus:x=!1,attachmentsEnabled:y=!0,sendBlocked:j=!1,onContextSearch:v,onCommand:C,onSend:k,onInterrupt:E,onEscape:A}){var Ct;const G=td(cS),[V,Z]=_.useState(()=>p?Bh(p):""),[D,$]=_.useState(!1),[z,R]=_.useState(0),H=_.useRef(null),B=_.useRef(null),le=_.useRef(!1),W=_.useRef(null),[oe,se]=_.useState(()=>p?Bh(p).length:0),[ge,ye]=_.useState([]),Y=_.useRef(null),ce=_.useCallback(I=>{!y||I.length===0||Promise.all(I.map(_S)).then(fe=>{const Ne=fe.filter(Le=>Le!==null);Ne.length!==0&&ye(Le=>[...Le,...Ne].slice(0,mS))})},[y]);function de(I){ye(fe=>fe.filter(Ne=>Ne.id!==I))}function _e(I){var Le;if(!y)return;const fe=(Le=I.clipboardData)==null?void 0:Le.items;if(!fe)return;const Ne=[];for(const wt of fe){if(!wt.type.startsWith("image/"))continue;const Sn=wt.getAsFile();Sn&&Ne.push(Sn)}Ne.length!==0&&(I.preventDefault(),ce(Ne))}function Ce(I){const fe=I.target.files?Array.from(I.target.files):[];I.target.value="",ce(fe)}_.useEffect(()=>{y||ye([])},[y]);const[w,Q]=_.useState([]),[L,be]=_.useState(-1),we=_.useRef(""),[Me,Oe]=_.useState(""),Ue=rS(_.useCallback((I,fe)=>{I&&Z(Ne=>ep(Ne,I)),Oe(fe.trim())},[])),qe=Me?ep(V,Me):V;_.useEffect(()=>{Ue.listening||Me===""||(Z(I=>ep(I,Me)),Oe(""))},[Ue.listening,Me]),_.useEffect(()=>{var I;x&&((I=H.current)==null||I.focus())},[x]);const an=_.useRef(new Map),Ke=_.useRef(new Map),Zt=_.useRef(p),ct=_.useRef({text:V,caret:oe});ct.current={text:V,caret:oe};const dt=_.useCallback((I,fe,Ne)=>{fe===""?(an.current.delete(I),Ke.current.delete(I)):(an.current.set(I,fe),Ke.current.set(I,Ne)),f_(I,fe)},[]),Ge=Ue.drop;_.useLayoutEffect(()=>{const I=Zt.current;if(I===p)return;Zt.current=p,I&&dt(I,ct.current.text,ct.current.caret);const fe=p?an.current.get(p)??Bh(p):"",Ne=p?Ke.current.get(p):void 0,Le=Math.min(Ne??fe.length,fe.length);Z(fe),se(Le),W.current=[Le,Le],Oe(""),R(0),$(!1),be(-1),we.current="",ye([]),Ge()},[p,dt,Ge]),_.useEffect(()=>{p&&dt(p,V,oe)},[p,V,oe,dt]);const rn=l?"Выберите сессию":j?"Нет VPN — отправка остановлена":h??"Опишите задачу… («/» — команды, «@» — файлы)",jn=_.useRef(0),st=_.useCallback(I=>{const fe=parseFloat(getComputedStyle(I).maxHeight),Ne=Number.isFinite(fe)&&fe>0?fe:pS;I.style.height="auto";const Le=I.scrollHeight;I.style.height=`${Math.min(Le,Ne)}px`,I.style.overflowY=Le>Ne?"auto":"hidden"},[]);_.useEffect(()=>{const I=H.current;I&&st(I)},[qe,rn,l,st]),_.useLayoutEffect(()=>{const I=H.current,fe=W.current;!I||!fe||(W.current=null,I.setSelectionRange(fe[0],fe[1]))}),_.useEffect(()=>{const I=H.current;if(!I)return;const fe=new ResizeObserver(([Ne])=>{const Le=Ne==null?void 0:Ne.contentRect.width;Le===void 0||Math.abs(Le-jn.current)<1||(jn.current=Le,st(I))});return fe.observe(I),()=>fe.disconnect()},[st]);const wn=Ue.stop;_.useEffect(()=>{l&&wn()},[l,wn]);const Jn=_.useMemo(()=>Ue.error?{ok:!1,message:Ue.error}:null,[Ue.error]),cn=_.useMemo(()=>{var Ne;const I=(Ne=Ob.exec(V))==null?void 0:Ne[1];if(I===void 0)return[];const fe=I.toLowerCase();return r.filter(Le=>!uS(Le)&&tp(Le,fe)<P_).sort((Le,wt)=>tp(Le,fe)-tp(wt,fe))},[V,r]),Wn=!D&&cn.length>0,It=Math.min(z,cn.length-1),tt=D?null:((Ct=Lb.exec(qe.slice(0,oe)))==null?void 0:Ct[1])??null,Dt=_.useRef(v);Dt.current=v,_.useEffect(()=>{if(tt===null||tt===""||tt.endsWith("/")){Dt.current(tt);return}const I=setTimeout(()=>Dt.current(tt),dS);return()=>clearTimeout(I)},[tt]);const qn=tt!==null&&(o==null?void 0:o.query)===tt,Et=qn?o.entries:[],nt=tt!==null,at=nt&&!qn,hn=Math.min(z,Math.max(Et.length-1,0));_.useEffect(()=>{var fe,Ne;if(!Wn&&!nt)return;const I=Wn?It:hn;(Ne=(fe=B.current)==null?void 0:fe.children[I])==null||Ne.scrollIntoView({block:"nearest"})},[Wn,nt,It,hn]);function mn(I,fe){var Ne;Z(I),se(fe),W.current=[fe,fe],R(0),$(!1),Me!==""&&(Oe(""),Ue.drop()),(Ne=H.current)==null||Ne.focus()}function Qn(){Z(""),Oe(""),R(0),se(0),$(!1),be(-1),we.current="",ye([]),Ue.drop(),p&&dt(p,"",0)}function Pt(I){const fe=I.trim();if(fe===""&&ge.length===0||l||j||le.current)return;const Ne=k(fe,ge.length>0?ge.map(Le=>({mediaType:Le.mediaType,data:Le.data})):void 0);if(Ne instanceof Promise){le.current=!0,Ne.then(Le=>{le.current=!1,Le&&vt(fe)},()=>{le.current=!1});return}Ne!==!1&&vt(fe)}function vt(I){I!==""&&Q(fe=>[I,...fe.filter(Ne=>Ne!==I)].slice(0,hS)),Qn()}function Ft(I){if(I<-1||I>=w.length)return;L===-1&&(we.current=V);const fe=I===-1?we.current:w[I]??"";be(I),mn(fe,fe.length)}function jt(){var Le;const I=((Le=H.current)==null?void 0:Le.selectionStart)??qe.length,Ne=`${I>0&&!/\s$/.test(qe.slice(0,I))?" ":""}@`;mn(qe.slice(0,I)+Ne+qe.slice(I),I+Ne.length)}function Pn(I){var wt;const fe=(wt=Lb.exec(qe.slice(0,oe)))==null?void 0:wt[1];if(fe===void 0)return;const Ne=oe-fe.length-1,Le=I.kind==="dir"?`@${I.path}/`:`@${I.path} `;mn(qe.slice(0,Ne)+Le+qe.slice(oe),Ne+Le.length)}function ne(){var fe;if(j)return;const I=(fe=Ob.exec(qe.trim()))==null?void 0:fe[1];if(I&&C(I)){Qn();return}Pt(qe)}function xe(I,fe){Z(I),se(fe),R(0),$(!1),be(-1),Me!==""&&(Oe(""),Ue.drop())}function Be(I){var Le;const fe=fS.has(I.name)?c:null,Ne=`/${I.name} `;Z(Ne+(fe??"")),se(Ne.length+((fe==null?void 0:fe.length)??0)),fe&&(W.current=[Ne.length,Ne.length+fe.length]),R(0),(Le=H.current)==null||Le.focus()}function Fe(I){if(C(I.name)){Z(""),R(0),$(!1);return}I.argumentHint?Be(I):Pt(`/${I.name}`)}function Ie(I){if(Wn){if(I.key==="ArrowDown")return I.preventDefault(),R(fe=>(Math.min(fe,cn.length-1)+1)%cn.length);if(I.key==="ArrowUp"){I.preventDefault();const fe=cn.length-1;return R(Ne=>(Math.min(Ne,fe)+fe)%cn.length)}if(I.key==="Enter"&&!I.shiftKey){I.preventDefault();const fe=cn[It];fe&&Fe(fe);return}if(I.key==="Tab"){I.preventDefault();const fe=cn[It];fe&&Be(fe);return}if(I.key==="Escape"){I.preventDefault(),I.stopPropagation(),$(!0);return}}if(nt){if(I.key==="ArrowDown"&&Et.length>0)return I.preventDefault(),R(fe=>(Math.min(fe,Et.length-1)+1)%Et.length);if(I.key==="ArrowUp"&&Et.length>0){I.preventDefault();const fe=Et.length-1;return R(Ne=>(Math.min(Ne,fe)+fe)%Et.length)}if(I.key==="Enter"&&!I.shiftKey||I.key==="Tab"){const fe=Et[hn];if(fe){I.preventDefault(),Pn(fe);return}if(I.key==="Tab")return}if(I.key==="Escape"){I.preventDefault(),I.stopPropagation(),$(!0);return}}if((I.key==="ArrowUp"||I.key==="ArrowDown")&&!I.shiftKey){const fe=I.currentTarget,Ne=fe.selectionStart;if(fe.selectionEnd===Ne){const wt=I.key==="ArrowUp"?L+1:L-1;wt>=-1&&wt<w.length&&requestAnimationFrame(()=>{fe.selectionStart===Ne&&fe.selectionEnd===Ne&&Ft(wt)})}}if(I.key==="Escape"&&A){I.preventDefault(),I.stopPropagation(),A();return}I.key==="Enter"&&!I.shiftKey&&!G&&(I.preventDefault(),ne())}return a.jsx("div",{className:d?`composer ${d}`:"composer",children:a.jsxs("div",{className:"composer__inner",children:[a.jsx(Ar,{result:Jn}),nt&&!Wn&&a.jsxs("div",{className:"cmdmenu",role:"listbox",ref:B,children:[Et.map((I,fe)=>a.jsxs("button",{role:"option","aria-selected":fe===hn,className:fe===hn?"cmdmenu__row is-on":"cmdmenu__row",onMouseEnter:()=>R(fe),onMouseDown:Ne=>{Ne.preventDefault(),Pn(I)},children:[a.jsxs("span",{className:"cmdmenu__name",children:[I.name,I.kind==="dir"?"/":""]}),a.jsx("span",{className:"cmdmenu__desc",children:I.path}),I.ignored&&a.jsx("span",{className:"cmdmenu__tag",children:"git-ignore"})]},I.path)),Et.length===0&&a.jsx("div",{className:"cmdmenu__empty",children:at?"ищем…":tt?"Ничего не нашлось":"Наберите имя файла или каталога"})]}),Wn&&a.jsx("div",{className:"cmdmenu",role:"listbox",ref:B,children:cn.map((I,fe)=>a.jsxs("button",{role:"option","aria-selected":fe===It,className:fe===It?"cmdmenu__row is-on":"cmdmenu__row",onMouseEnter:()=>R(fe),onMouseDown:Ne=>{Ne.preventDefault(),Fe(I)},children:[a.jsxs("span",{className:"cmdmenu__name",children:["/",I.name]}),I.argumentHint&&a.jsx("span",{className:"cmdmenu__hint",children:I.argumentHint}),a.jsx("span",{className:"cmdmenu__desc",children:I.description})]},I.name))}),ge.length>0&&a.jsx("div",{className:"composer__attachments",children:ge.map(I=>a.jsxs("div",{className:"composer__thumb",children:[a.jsx("img",{src:I.previewUrl,alt:"Вложение"}),a.jsx("button",{type:"button",className:"composer__thumb-remove","aria-label":"Удалить вложение",onClick:()=>de(I.id),children:a.jsx(kS,{})})]},I.id))}),a.jsxs("div",{className:"composer__field",children:[a.jsx("button",{type:"button",className:"addbtn",title:"Добавить контекст — файл проекта («@»)","aria-label":"Добавить контекст",disabled:l,onClick:jt,children:a.jsx(wS,{})}),y&&a.jsxs(a.Fragment,{children:[a.jsx("input",{ref:Y,type:"file",accept:"image/*",multiple:!0,className:"composer__fileinput",tabIndex:-1,"aria-hidden":"true",onChange:Ce}),a.jsx("button",{type:"button",className:"attachbtn",title:"Прикрепить изображение","aria-label":"Прикрепить изображение",disabled:l,onClick:()=>{var I;return(I=Y.current)==null?void 0:I.click()},children:a.jsx(NS,{})})]}),a.jsx("textarea",{ref:H,value:qe,disabled:l,placeholder:rn,onChange:I=>xe(I.target.value,I.target.selectionStart),onSelect:I=>se(I.currentTarget.selectionStart),onKeyDown:Ie,onPaste:_e}),Ue.supported&&a.jsx("button",{type:"button",className:Ue.listening?"micbtn is-on":"micbtn",title:Ue.listening?"Остановить диктовку":"Продиктовать промпт","aria-label":Ue.listening?"Остановить диктовку":"Продиктовать промпт","aria-pressed":Ue.listening,disabled:l,onClick:Ue.toggle,children:a.jsx(TS,{on:Ue.listening})}),s?a.jsx("button",{className:"btn",onClick:E,title:"Прервать (Esc)",children:"Стоп"}):a.jsxs("button",{className:"btn btn--primary sendbtn",onClick:ne,disabled:l||j||qe.trim()===""&&ge.length===0,"aria-label":g,title:j?"Нет VPN — отправка остановлена":g,children:[a.jsx("span",{className:"sendbtn__label",children:g}),a.jsx(SS,{})]})]})]})})}function ep(l,s){const r=s.trim();if(r==="")return l;const c=_p(r).slice(vS(l,r)).join(" ");return c===""?l:l===""||/\s$/.test(l)?l+c:`${l} ${c}`}function vS(l,s){const r=_p(l),c=_p(s);for(let o=Math.min(r.length,c.length);o>0;o--)if(r.slice(r.length-o).every((d,h)=>jS(d,c[h]??"")))return o;return 0}function _p(l){return l.split(/\s+/).filter(s=>s!=="")}function jS(l,s){const r=c=>c.toLowerCase().replace(/[.,!?;:…]+$/u,"");return r(l)===r(s)}function wS(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round","aria-hidden":"true",children:a.jsx("path",{d:"M8 3.4v9.2M3.4 8h9.2"})})}function SS(){return a.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:a.jsx("path",{d:"M8 12.5V3.5M4 7.5 8 3.5l4 4"})})}function NS(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.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 kS(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round","aria-hidden":"true",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})}function TS({on:l}){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("rect",{x:"5.9",y:"1.7",width:"4.2",height:"7.6",rx:"2.1",fill:l?"currentColor":"none"}),a.jsx("path",{d:"M3.3 7.3v.8a4.7 4.7 0 0 0 9.4 0v-.8"}),a.jsx("path",{d:"M8 12.8v1.5"})]})}const P_=4;function tp(l,s){const r=l.name.toLowerCase();return r===s?0:r.startsWith(s)?1:l.aliases.some(c=>c.toLowerCase().startsWith(s))?2:r.includes(s)?3:P_}function ES({request:l,plan:s,queued:r,collapsed:c,onCollapse:o,onAccept:d,onDecline:h}){const[p,g]=_.useState(s),[x,y]=_.useState("preview");_.useEffect(()=>{g(s),y("preview")},[l.requestId,s]);const j=p.trim().length>0;function v(){j&&d(l.requestId,p)}return a.jsx("div",{className:"modal-backdrop modal-backdrop--sheet",hidden:c,children:a.jsxs("div",{className:"plansheet",role:"dialog","aria-modal":"true","aria-label":"План агента",children:[a.jsxs("div",{className:"plansheet__head",children:[a.jsx("span",{className:"plansheet__head-icon","aria-hidden":"true",children:a.jsx(ey,{})}),a.jsxs("span",{className:"plansheet__head-text",children:["План на согласование",r>0&&` — ещё ${r} в очереди`]}),a.jsxs("div",{className:"plansheet__viewtoggle",role:"tablist","aria-label":"Режим просмотра",children:[a.jsx("button",{className:"btn btn--sm"+(x==="preview"?" is-on":""),role:"tab","aria-selected":x==="preview",onClick:()=>y("preview"),children:"Просмотр"}),a.jsx("button",{className:"btn btn--sm"+(x==="source"?" is-on":""),role:"tab","aria-selected":x==="source",onClick:()=>y("source"),children:"Код"})]}),a.jsx(Ip,{onClick:o})]}),a.jsxs("div",{className:"plansheet__body",children:[l.reason&&a.jsx("p",{className:"plansheet__reason",children:l.reason}),a.jsx("div",{className:"plansheet__content",children:x==="preview"?a.jsx(CS,{text:p}):a.jsx("textarea",{className:"plansheet__source",value:p,onChange:C=>g(C.target.value),spellCheck:!1,"aria-label":"Текст плана — можно отредактировать перед тем, как согласиться",autoFocus:!0})})]}),a.jsxs("div",{className:"plansheet__actions",children:[a.jsx("button",{className:"btn",onClick:()=>h(l.requestId),children:"Доработать"}),a.jsx("button",{className:"btn btn--ok",disabled:!j,autoFocus:!0,onClick:v,children:"Одобрить план"})]})]})})}function CS({text:l}){const[s,r]=_.useState("");return _.useEffect(()=>{let c=!1;return sd(l).then(o=>{c||r(o)}),()=>{c=!0}},[l]),a.jsx("div",{className:"markdown-preview plansheet__preview",dangerouslySetInnerHTML:{__html:s}})}function ey(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.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"}),a.jsx("path",{d:"M9.5 2.5v2.5a.5.5 0 0 0 .5.5h3"}),a.jsx("path",{d:"M5.6 8.6 7 10l3-3.2"})]})}function AS({kind:l,toolName:s,queued:r,onExpand:c}){const o=l==="question"?"Уточняющий вопрос":l==="plan"?"План на согласование":`Разрешить действие: ${s}`;return a.jsxs("button",{type:"button",className:`decision-bar decision-bar--${l}`,onClick:c,children:[a.jsx("span",{className:"decision-bar__icon","aria-hidden":"true",children:l==="question"?"?":l==="plan"?a.jsx(ey,{}):"!"}),a.jsxs("span",{className:"decision-bar__text",children:[a.jsx("span",{className:"decision-bar__title",children:o}),a.jsxs("span",{className:"decision-bar__sub",children:["ждёт вашего решения",r>0&&` — ещё ${r} в очереди`]})]}),a.jsxs("span",{className:"decision-bar__action",children:["Развернуть",a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"m4 10 4-4 4 4"})})]})]})}function Ip({onClick:l}){return a.jsxs("button",{type:"button",className:"decision-collapse",onClick:l,title:"Свернуть — агент продолжит ждать","aria-label":"Свернуть",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"m4 6 4 4 4-4"})}),a.jsx("span",{className:"decision-collapse__label",children:"Свернуть"})]})}function MS({request:l,queued:s,collapsed:r,onCollapse:c,onDecide:o}){const d=F_(l.toolName,l.input);return a.jsx("div",{className:"modal-backdrop modal-backdrop--sheet",hidden:r,children:a.jsxs("div",{className:"sheet",role:"dialog","aria-modal":"true","aria-label":"Запрос разрешения",children:[a.jsxs("div",{className:"sheet__head",children:[a.jsxs("span",{className:"sheet__head-text",children:["Разрешить действие?",s>0&&` (ещё ${s} в очереди)`]}),a.jsx(Ip,{onClick:c})]}),a.jsxs("div",{className:"sheet__body",children:[a.jsx("div",{className:"sheet__tool",children:l.toolName}),l.reason&&a.jsx("p",{className:"sheet__reason",children:l.reason}),d.length>0?d.map((h,p)=>a.jsx(Hp,{diff:h},p)):a.jsx("pre",{className:"code",children:JSON.stringify(l.input,null,2)})]}),a.jsxs("div",{className:"sheet__actions",children:[a.jsx("button",{className:"btn",onClick:()=>o(l.requestId,"deny"),children:"Отклонить"}),a.jsx("button",{className:"btn btn--warn",autoFocus:!0,onClick:()=>o(l.requestId,"allow"),children:"Разрешить"})]})]})})}function RS({request:l,queued:s,collapsed:r,onCollapse:c,onAnswer:o,onDecline:d}){const{questions:h}=l,[p,g]=_.useState(()=>h.map(()=>new Set)),[x,y]=_.useState(()=>h.map(()=>"")),[j,v]=_.useState(()=>Ub(h));_.useEffect(()=>{g(h.map(()=>new Set)),y(h.map(()=>"")),v(Ub(h))},[l.requestId]);const C=_.useMemo(()=>OS(h,p,x),[h,p,x]),k=C!==null;function E($,z){var R,H;(H=(R=h[$])==null?void 0:R.options[z])!=null&&H.preview&&v(B=>{const le=B.slice();return le[$]=z,le})}function A($,z,R){g(H=>{const B=H.slice(),le=new Set(B[$]);return R?le.has(z)?le.delete(z):le.add(z):le.has(z)||(le.clear(),le.add(z)),B[$]=le,B}),z!=="other"&&E($,z)}function G($,z){y(R=>{const H=R.slice();return H[$]=z,H})}function V(){C&&o(l.requestId,C)}function Z($){$.key==="Enter"&&($.target.closest("button")||k&&($.preventDefault(),V()))}function D($){var B;if(!["ArrowDown","ArrowUp","ArrowRight","ArrowLeft"].includes($.key))return;const z=Array.from($.currentTarget.querySelectorAll("button.qsheet__option")),R=z.indexOf(document.activeElement);if(R===-1)return;$.preventDefault();const H=$.key==="ArrowDown"||$.key==="ArrowRight"?1:-1;(B=z[(R+H+z.length)%z.length])==null||B.focus()}return a.jsx("div",{className:"modal-backdrop modal-backdrop--sheet",hidden:r,children:a.jsxs("div",{className:"qsheet",role:"dialog","aria-modal":"true","aria-label":"Вопрос от Claude",onKeyDown:Z,children:[a.jsxs("div",{className:"qsheet__head",children:[a.jsx("span",{className:"qsheet__head-icon","aria-hidden":"true",children:"?"}),a.jsxs("span",{className:"qsheet__head-text",children:[h.length===1?"Уточняющий вопрос":`Уточняющие вопросы (${h.length})`,s>0&&` — ещё ${s} в очереди`]}),a.jsx(Ip,{onClick:c})]}),a.jsxs("div",{className:"qsheet__body",children:[l.reason&&a.jsx("p",{className:"qsheet__reason",children:l.reason}),h.map(($,z)=>a.jsx(DS,{q:$,qi:z,selected:p[z]??new Set,otherText:x[z]??"",previewIndex:j[z]??null,onToggle:A,onFocusOption:E,onOtherText:G,onOptionsKeyDown:D},z))]}),a.jsxs("div",{className:"qsheet__actions",children:[a.jsx("button",{className:"btn",onClick:()=>d(l.requestId),children:"Не отвечать"}),a.jsx("button",{className:"btn btn--primary",disabled:!k,onClick:V,children:"Ответить"})]})]})})}function DS({q:l,qi:s,selected:r,otherText:c,previewIndex:o,onToggle:d,onFocusOption:h,onOtherText:p,onOptionsKeyDown:g}){var C;const x=l.options.some(k=>k.preview),y=o!==null?(C=l.options[o])==null?void 0:C.preview:void 0,j=r.has("other"),v=l.multiSelect?"checkbox":"radio";return a.jsxs("div",{className:"qsheet__question",children:[a.jsxs("div",{className:"qsheet__qhead",children:[a.jsx("span",{className:"chip chip--accent",children:l.header}),a.jsx("span",{className:"qsheet__qtext",children:l.question})]}),a.jsxs("div",{className:"qsheet__options"+(l.multiSelect?"":" qsheet__options--radio"),role:l.multiSelect?"group":"radiogroup","aria-label":l.question,onKeyDown:g,children:[l.options.map((k,E)=>{const A=r.has(E);return a.jsxs("button",{type:"button",role:v,"aria-checked":A,className:"qsheet__option"+(A?" is-selected":""),onClick:()=>d(s,E,l.multiSelect),onFocus:()=>h(s,E),onMouseEnter:()=>h(s,E),children:[a.jsx("span",{className:"qsheet__opt-mark","aria-hidden":"true"}),a.jsxs("span",{className:"qsheet__opt-body",children:[a.jsx("span",{className:"qsheet__opt-label",children:k.label}),a.jsx("span",{className:"qsheet__opt-desc",children:k.description})]})]},E)}),a.jsxs("div",{className:"qsheet__other",children:[a.jsxs("button",{type:"button",role:v,"aria-checked":j,className:"qsheet__option qsheet__option--other"+(j?" is-selected":""),onClick:()=>d(s,"other",l.multiSelect),children:[a.jsx("span",{className:"qsheet__opt-mark","aria-hidden":"true"}),a.jsxs("span",{className:"qsheet__opt-body",children:[a.jsx("span",{className:"qsheet__opt-label",children:"Другое"}),a.jsx("span",{className:"qsheet__opt-desc",children:"Свой вариант ответа"})]})]}),j&&a.jsx("input",{type:"text",className:"qsheet__other-input",placeholder:"Впишите свой вариант…","aria-label":`Свой вариант ответа на вопрос «${l.question}»`,value:c,onChange:k=>p(s,k.target.value),autoFocus:!0})]})]}),x&&a.jsx("pre",{className:"qsheet__preview",children:y??""})]})}function Ub(l){return l.map(s=>{const r=s.options.findIndex(c=>c.preview);return r===-1?null:r})}function OS(l,s,r){const c={};for(let o=0;o<l.length;o++){const d=l[o];if(!d)continue;const h=s[o]??new Set,p=[];for(let g=0;g<d.options.length;g++){const x=d.options[g];x&&h.has(g)&&p.push(x.label)}if(h.has("other")){const g=(r[o]??"").trim();g&&p.push(g)}if(p.length===0)return null;c[d.question]=p.join(", ")}return c}function LS(l,s){if(l!=="ExitPlanMode"||!s||typeof s!="object")return null;const r=s.plan;return typeof r=="string"?r:null}function ty({path:l}){const[s,r]=_.useState(!1),[c,o]=_.useState(!1),d=_.useRef(null);_.useEffect(()=>{if(!s)return;function p(g){var x;(x=d.current)!=null&&x.contains(g.target)||r(!1)}return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]),_.useEffect(()=>{if(!c)return;const p=setTimeout(()=>o(!1),Up);return()=>clearTimeout(p)},[c]),_.useEffect(()=>r(!1),[l]);async function h(){await ha(l)&&o(!0)}return a.jsxs("div",{ref:d,className:"cwd",children:[a.jsxs("button",{type:"button",className:"cwd__toggle","aria-expanded":s,title:s?"Свернуть путь":`Полный путь: ${l}`,onClick:()=>r(p=>!p),onKeyDown:p=>{p.key!=="Escape"||!s||(p.preventDefault(),p.stopPropagation(),r(!1))},children:[a.jsx(zS,{open:s}),a.jsx("span",{className:"cwd__short",children:l})]}),s&&a.jsxs("div",{className:"cwd__pop",children:[a.jsx("span",{className:"cwd__full",children:l}),a.jsx("button",{type:"button",className:"btn btn--ghost cwd__copy",onClick:()=>void h(),children:c?Ec:Tr})]})]})}function zS({open:l}){return a.jsx("svg",{className:l?"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:a.jsx("path",{d:"M6 3.5 10.5 8 6 12.5"})})}const US=["low","medium","high"];function ny({models:l,value:s,effort:r,ultracode:c,thinking:o,switchOnFlag:d,showSwitchOnFlag:h=!0,showUltracode:p=!0,className:g,onModel:x,onEffort:y,onUltracode:j,onThinking:v,onSwitchOnFlag:C}){const[k,E]=_.useState(!1),[A,G]=_.useState(0),V=_.useRef(null),Z=_.useRef(null),D=l.find(B=>B.value===s)??null,$=D&&D.supportsEffort?D.effortLevels.length>0?D.effortLevels:US:[],z=p&&$.includes("xhigh");_.useEffect(()=>{if(!k)return;const B=l.findIndex(le=>le.value===s);G(B===-1?0:B)},[k]),_.useEffect(()=>{if(!k)return;function B(le){var W;(W=V.current)!=null&&W.contains(le.target)||E(!1)}return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[k]),_.useEffect(()=>{var B,le;k&&((le=(B=Z.current)==null?void 0:B.querySelector(".is-cursor"))==null||le.scrollIntoView({block:"nearest"}))},[k,A]);function R(B){E(!1),B.value!==s&&x(B.value)}function H(B){if(B.key==="Escape"){if(!k)return;B.preventDefault(),B.stopPropagation(),E(!1);return}if(B.key==="ArrowDown"||B.key==="ArrowUp"){if(B.preventDefault(),!k)return E(!0);if(l.length===0)return;const le=B.key==="ArrowDown"?1:l.length-1;return G(W=>(W+le)%l.length)}if(B.key==="Enter"||B.key===" "){if(B.preventDefault(),!k)return E(!0);const le=l[A];le&&R(le)}}return a.jsxs("div",{ref:V,className:"select"+(k?" select--open":"")+(g?` ${g}`:""),children:[a.jsxs("button",{type:"button",className:"select__trigger",title:"Модель, усилие и размышления","aria-label":"Модель, усилие и размышления","aria-haspopup":"menu","aria-expanded":k,onClick:()=>E(B=>!B),onKeyDown:H,children:[(D==null?void 0:D.displayName)??s?a.jsx("span",{className:"select__value",children:(D==null?void 0:D.displayName)??s}):a.jsx("span",{className:"select__value select__value--muted",children:"по умолчанию"}),c?a.jsx("span",{className:"select__suffix select__suffix--hot",children:"ultracode"}):$.length>0&&r&&a.jsx("span",{className:"select__suffix",children:r}),a.jsx(HS,{})]}),k&&a.jsxs("div",{ref:Z,className:"select__menu modelmenu",role:"menu",children:[a.jsx("div",{className:"modelmenu__head",children:"Модель"}),l.map((B,le)=>a.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":B.value===s,className:"select__option"+(le===A?" is-cursor":"")+(B.value===s?" is-on":""),onMouseEnter:()=>G(le),onClick:()=>R(B),children:[a.jsx("span",{className:"select__check","aria-hidden":"true",children:B.value===s?"✓":""}),a.jsx("span",{className:"select__label",children:B.displayName}),B.description&&a.jsx("span",{className:"select__hint",children:B.description})]},B.value)),$.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"modelmenu__sep",role:"separator"}),a.jsxs("div",{className:"modelmenu__row",children:[a.jsxs("span",{className:"modelmenu__label",children:["Усилие",a.jsx("span",{className:"modelmenu__desc",children:"насколько усердно модель думает"})]}),a.jsx("span",{className:"modelmenu__levels",children:$.map(B=>a.jsx("button",{type:"button",role:"menuitemradio","aria-checked":B===r,className:B===r?"modelmenu__level is-on":"modelmenu__level",onClick:()=>y(B),children:B},B))})]}),z&&a.jsx(np,{label:"Ultracode",desc:"xhigh и постоянная оркестрация подагентами",on:c,onToggle:()=>j(!c)})]}),a.jsx("div",{className:"modelmenu__sep",role:"separator"}),(D==null?void 0:D.supportsThinking)!==!1&&a.jsx(np,{label:"Размышления",desc:"расширенное обдумывание перед ответом",on:o,onToggle:()=>v(!o)}),h&&a.jsx(np,{label:"Менять модель по флагу",desc:"иначе помеченный ход встаёт на паузу",on:d,onToggle:()=>C(!d)})]})]})}function np({label:l,desc:s,on:r,onToggle:c}){return a.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":r,className:"modelmenu__row modelmenu__row--btn",onClick:c,children:[a.jsxs("span",{className:"modelmenu__label",children:[l,a.jsx("span",{className:"modelmenu__desc",children:s})]}),a.jsx("span",{className:r?"switch is-on":"switch","aria-hidden":"true",children:a.jsx("span",{className:"switch__knob"})})]})}function HS(){return a.jsx("svg",{className:"select__chev",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"M3 4.5 6 7.5 9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function gl({title:l,children:s,actions:r,className:c,sheet:o=!1,onClose:d}){const h=_.useRef(null);return _.useEffect(()=>{function p(g){if(g.key==="Escape"){g.preventDefault(),g.stopPropagation(),d();return}if(g.key!=="Tab")return;const x=h.current;if(!x)return;const y=x.querySelectorAll('button, input, textarea, select, a[href], [tabindex]:not([tabindex="-1"])'),j=y[0],v=y[y.length-1];!j||!v||(g.shiftKey&&document.activeElement===j?(g.preventDefault(),v.focus()):!g.shiftKey&&document.activeElement===v&&(g.preventDefault(),j.focus()))}return document.addEventListener("keydown",p,!0),()=>document.removeEventListener("keydown",p,!0)},[d]),a.jsx("div",{className:o?"modal-backdrop modal-backdrop--sheet":"modal-backdrop",onMouseDown:p=>{p.target===p.currentTarget&&d()},children:a.jsxs("div",{ref:h,className:c?`modal ${c}`:"modal",role:"dialog","aria-modal":"true","aria-label":l,children:[a.jsxs("div",{className:"modal__head",children:[a.jsx("h2",{className:"modal__title",children:l}),a.jsx("button",{className:"modal__close","aria-label":"Закрыть",onClick:d,children:"✕"})]}),a.jsx("div",{className:"modal__body",children:s}),r&&a.jsx("div",{className:"modal__actions",children:r})]})})}function BS({candidates:l,searching:s,agentItems:r,agentBusy:c,error:o,roots:d,created:h,onSearch:p,onAskAgent:g,onInterrupt:x,onSubmit:y,onCreate:j,onClose:v}){const[C,k]=_.useState("open"),[E,A]=_.useState(""),[G,V]=_.useState(!1),[Z,D]=_.useState(""),[$,z]=_.useState(""),[R,H]=_.useState({git:!0,claudeMd:!0,readme:!0}),B=E.trim(),le=B!=="",W=Z.trim(),oe=$.trim(),se=W!==""&&oe!=="";_.useEffect(()=>{Z===""&&d.length>0&&D(d[0])},[d]);const ge=_.useRef(p);ge.current=p,_.useEffect(()=>{if(C!=="open")return;const de=E.trim(),_e=setTimeout(()=>ge.current(de),200);return()=>clearTimeout(_e)},[E,C]);function ye(){le&&y(B)}function Y(){se&&j(W,oe,R)}function ce(){le&&(V(!0),g(B))}return h?a.jsxs(gl,{title:"Новый проект",onClose:v,actions:a.jsx("button",{className:"btn btn--primary",onClick:v,autoFocus:!0,children:"Понятно"}),children:[a.jsx("p",{className:"modal__text",children:"Каталог создан и открыт как проект, но часть шагов не удалась."}),a.jsx("p",{className:"newproj__preview",children:h.path}),a.jsx("div",{className:"modal__error",children:a.jsx("ul",{className:"newproj__warnings",children:h.warnings.map(de=>a.jsx("li",{children:de},de))})}),a.jsx("p",{className:"modal__text modal__text--dim",children:"Проект открыт и работает — недостающее можно добавить руками, в дереве файлов или из терминала."})]}):a.jsxs(gl,{title:"Новый проект",className:G&&C==="open"?"modal--wide":void 0,onClose:v,actions:a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"btn",onClick:v,children:"Отмена"}),C==="open"?a.jsxs(a.Fragment,{children:[c?a.jsx("button",{className:"btn",onClick:x,children:"Остановить"}):a.jsx("button",{className:"btn",disabled:!le,onClick:ce,title:"Найти по описанию",children:"Попросить агента"}),a.jsx("button",{className:"btn btn--primary",disabled:!le,onClick:ye,children:"Открыть"})]}):a.jsx("button",{className:"btn btn--primary",disabled:!se,onClick:Y,children:"Создать"})]}),children:[a.jsxs("div",{className:"tabs",children:[a.jsx(Hb,{label:"Открыть",on:C==="open",onClick:()=>k("open")}),a.jsx(Hb,{label:"Создать",on:C==="create",onClick:()=>k("create")})]}),C==="open"?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"modal__text",children:"Каталог, в котором будет работать агент. Введите путь или часть имени — подходящие каталоги появятся ниже."}),a.jsx("label",{className:"field",htmlFor:"workspace-path",children:"Путь или название"}),a.jsx("input",{id:"workspace-path",className:"input input--mono",value:E,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"C:\\Projects\\my-app",onChange:de=>A(de.target.value),onKeyDown:de=>{de.key==="Enter"&&(de.preventDefault(),ye())}}),o&&a.jsx("p",{className:"modal__error",children:o}),l.length>0&&a.jsx("ul",{className:"finds",children:l.map(de=>a.jsx("li",{children:a.jsxs("button",{className:"find",disabled:de.open,title:de.open?"Этот проект уже открыт":de.path,onClick:()=>A(de.path),onDoubleClick:()=>y(de.path),children:[a.jsx("span",{className:"find__name",children:de.name}),a.jsx("span",{className:"find__path",children:de.path}),a.jsx("span",{className:"find__note",children:GS(de)})]})},de.path))}),l.length===0&&le&&!s&&!G&&a.jsx("p",{className:"modal__text modal__text--dim",children:"Ничего похожего среди каталогов, где вы работали. Если помните не имя, а суть проекта — опишите его и нажмите «Попросить агента». Проекта ещё нет вовсе — рядом вкладка «Создать»."}),G&&a.jsx("div",{className:"finds__agent",children:a.jsx(Bp,{items:r,busy:c,waiting:!1,empty:"Агент ищет…"})})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"modal__text",children:"Пустой каталог для нового проекта. Дальше в нём работает агент — с первого промпта, без отдельной настройки."}),a.jsx("label",{className:"field",htmlFor:"workspace-parent",children:"Где создать"}),a.jsx("input",{id:"workspace-parent",className:"input input--mono",value:Z,spellCheck:!1,autoComplete:"off",placeholder:"C:\\Projects",onChange:de=>D(de.target.value)}),d.length>0&&a.jsx("div",{className:"newproj__roots",children:d.map(de=>a.jsx("button",{type:"button",className:de===W?"newproj__root is-on":"newproj__root",title:de,onClick:()=>D(de),children:qS(de)},de))}),a.jsx("label",{className:"field newproj__field",htmlFor:"workspace-name",children:"Имя проекта"}),a.jsx("input",{id:"workspace-name",className:"input input--mono",value:$,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"my-app",onChange:de=>z(de.target.value),onKeyDown:de=>{de.key==="Enter"&&(de.preventDefault(),Y())}}),a.jsx("p",{className:"newproj__preview",children:se?IS(W,oe):"Каталог появится здесь"}),o&&a.jsx("p",{className:"modal__error",children:o}),a.jsxs("div",{className:"newproj__opts",children:[a.jsx(lp,{label:"git init",desc:"панель истории работает сразу",on:R.git,onToggle:()=>H(de=>({...de,git:!de.git}))}),a.jsx(lp,{label:"CLAUDE.md",desc:"заготовка инструкций для агента",on:R.claudeMd,onToggle:()=>H(de=>({...de,claudeMd:!de.claudeMd}))}),a.jsx(lp,{label:"README.md",desc:"по нему проект потом узнаёт поиск",on:R.readme,onToggle:()=>H(de=>({...de,readme:!de.readme}))})]})]})]})}function Hb({label:l,on:s,onClick:r}){return a.jsx("button",{type:"button",className:s?"tabs__tab is-on":"tabs__tab","aria-pressed":s,onClick:r,children:l})}function lp({label:l,desc:s,on:r,onToggle:c}){return a.jsxs("button",{type:"button",role:"checkbox","aria-checked":r,className:"newproj__opt",onClick:c,children:[a.jsxs("span",{className:"newproj__optlabel",children:[l,a.jsx("span",{className:"newproj__optdesc",children:s})]}),a.jsx("span",{className:r?"switch is-on":"switch","aria-hidden":"true",children:a.jsx("span",{className:"switch__knob"})})]})}function IS(l,s){const r=l.includes("\\")?"\\":"/";return l.replace(/[\\/]+$/,"")+r+s}function qS(l){const s=l.includes("\\")?"\\":"/",r=l.split(/[\\/]/).filter(Boolean);return r.length<=2?l:`…${s}${r.slice(-2).join(s)}`}function GS(l){return l.open?"уже открыт":l.why?l.why:l.sessions===0?"рядом с вашими проектами":`${YS(l.sessions)}${$S(l.lastUsedAt)}`}function YS(l){const s=l%10,r=l%100;return r>=11&&r<=14?`${l} сессий`:s===1?`${l} сессия`:s>=2&&s<=4?`${l} сессии`:`${l} сессий`}function $S(l){if(!l)return"";const s=Math.floor((Date.now()-l)/864e5);return s<=0?" · сегодня":s===1?" · вчера":s<30?` · ${s} дн. назад`:` · ${new Date(l).toLocaleDateString("ru-RU")}`}const qp=7;function XS(l){const s=[],r=[];let c=1;for(const o of l){const d=s.slice();let h=s.indexOf(o.hash);h===-1&&(h=Bb(s),s[h]=o.hash);const[p,...g]=o.parents;s[h]=p??null;const x=[];p!==void 0&&x.push({from:h,to:h});for(const v of g){let C=s.indexOf(v);C===-1&&(C=Bb(s),s[C]=v),x.push({from:h,to:C})}const y=[];for(let v=0;v<d.length;v++)d[v]===o.hash&&(y.push({from:v,to:h}),v!==h&&(s[v]=null));const j=[];for(let v=0;v<d.length;v++){const C=d[v];!C||C===o.hash||v===h||s[v]===C&&j.push(v)}VS(s),c=Math.max(c,s.length,h+1),r.push({commit:o,col:h,up:y,down:x,through:j})}return{rows:r,columns:Math.min(c,qp)}}function Bb(l){const s=l.indexOf(null);return s!==-1?s:(l.push(null),l.length-1)}function VS(l){for(;l.length>0&&l[l.length-1]===null;)l.pop()}function QS({open:l,state:s,result:r,selected:c,busy:o,onRefresh:d,onShow:h,onCheckout:p,onPush:g,onPull:x,onPublish:y,onConnectRemote:j,onDismissResult:v,onClose:C,zoomed:k,onToggleZoom:E}){const A=XS((s==null?void 0:s.commits)??[]),G=[...s!=null&&s.detached?[{value:"",label:`отделён · ${s.head.slice(0,8)}`}]:[],...((s==null?void 0:s.branches)??[]).map(V=>({value:V.name,label:V.name,hint:V.hash.slice(0,8)}))];return a.jsxs("aside",{className:(l?"sidepane sidepane--git sidepane--open":"sidepane sidepane--git")+(k?" sidepane--zoomed":""),"aria-label":"История git",children:[a.jsxs("div",{className:"sidepane__head",onDoubleClick:V=>{E&&(V.target.closest("button")||E())},children:[a.jsx(PS,{}),a.jsx("span",{className:"sidepane__title",children:"История"}),a.jsx("button",{className:"sidepane__btn",title:"Обновить","aria-label":"Обновить историю",onClick:d,children:"↻"}),E&&a.jsx("button",{className:"sidepane__btn",title:k?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":k?"Свернуть панель истории":"Развернуть панель истории на весь экран","aria-pressed":k,onClick:E,children:a.jsx(Ic,{active:k})}),a.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель истории",onClick:C,children:"✕"})]}),s===null?a.jsx("p",{className:"sidepane__empty",children:"Читаем репозиторий…"}):s.available?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"gitbar",children:[a.jsx(Is,{className:"gitbar__branch",title:"Ветка — выбрать значит переключиться",value:s.detached?"":s.branch,options:G,onChange:V=>{V&&p(V,`ветку ${V}`)}}),a.jsx(Hc,{text:s.detached?s.head:s.branch,hint:s.detached?"хеш HEAD":"имя ветки"})]}),s.detached&&a.jsx("p",{className:"gitbar__note",children:"HEAD отделён от ветки. Выберите ветку в списке, чтобы вернуться."}),a.jsx("div",{className:"gitbar__actions",children:o?a.jsxs("p",{className:"gitbar__busy",children:[a.jsx(lN,{}),o]}):s.hasRemote?a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:"btn btn--sm",title:"Отправить текущую ветку в origin",onClick:g,children:[a.jsx(eN,{}),"Отправить",s.ahead>0&&a.jsx("span",{className:"gitbar__count",children:s.ahead})]}),a.jsxs("div",{className:"gitbar__group",children:[a.jsxs("button",{type:"button",className:"btn btn--sm",title:"Забрать с origin и перемотать вперёд (git pull --ff-only)",onClick:()=>x(!0),children:[a.jsx(tN,{}),"Забрать",s.behind>0&&a.jsx("span",{className:"gitbar__count",children:s.behind})]}),a.jsx("button",{type:"button",className:"btn btn--sm btn--ghost gitbar__check",title:"Только проверить — git fetch, рабочее дерево не меняется","aria-label":"Проверить, что нового на origin, без изменений на диске",onClick:()=>x(!1),children:a.jsx(nN,{})})]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:"btn btn--sm btn--primary",title:"Создать репозиторий на GitHub и отправить в него ветку",onClick:y,children:[a.jsx(qb,{}),"Опубликовать на GitHub"]}),a.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",title:"Прописать origin на уже существующий репозиторий",onClick:j,children:"уже есть репозиторий"})]})}),a.jsxs("div",{className:"sidepane__scroll",children:[a.jsx("button",{className:"gitrow gitrow--work"+(c===""?" is-on":""),onClick:()=>h(""),children:a.jsxs("span",{className:"gitrow__body",children:[a.jsx("span",{className:"gitrow__subject",children:s.changed.length>0?`Рабочее дерево · ${s.changed.length} ${rN(s.changed.length)}`:"Рабочее дерево чистое"}),a.jsx("span",{className:"gitrow__meta",children:s.changed.length>0?s.changed.slice(0,4).map(V=>iN(V.path)).join(", "):"незакоммиченных изменений нет"})]})}),A.rows.map(V=>a.jsx(ZS,{row:V,columns:A.columns,head:V.commit.hash===s.head,local:s.hasRemote&&!V.commit.pushed,active:c===V.commit.hash,onOpen:()=>h(V.commit.hash)},V.commit.hash)),A.rows.length===0&&a.jsx("p",{className:"sidepane__empty",children:"В репозитории ещё нет коммитов"})]})]}):a.jsxs("div",{className:"gitempty",children:[a.jsx("p",{className:"gitempty__text",children:s.message||"Это не git-репозиторий"}),s.noRepo&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:"btn btn--sm btn--primary gitempty__btn",onClick:y,children:[a.jsx(qb,{}),"Опубликовать на GitHub"]}),a.jsx("p",{className:"gitempty__hint",children:"Заведёт репозиторий, сделает первый коммит и отправит его на GitHub."})]})]}),a.jsx(Ar,{result:r,onDismiss:v})]})}const Fo=50,Ib=13,KS=500;function ZS({row:l,columns:s,head:r,local:c,active:o,onOpen:d}){const{commit:h}=l,p=h.refs.map(sN).filter(Boolean),[g,x]=_.useState(null),y=_.useRef(null);function j(E){const A=E.touches[0];if(!A)return;const G={timer:0,x:A.clientX,y:A.clientY,fired:!1};G.timer=window.setTimeout(()=>{G.fired=!0,x({x:G.x,y:G.y})},KS),y.current=G}function v(E){const A=y.current,G=E.touches[0];!A||!G||Math.hypot(G.clientX-A.x,G.clientY-A.y)>10&&(window.clearTimeout(A.timer),y.current=null)}function C(E){const A=y.current;A&&(window.clearTimeout(A.timer),A.fired&&E.preventDefault())}function k(){const E=[{id:"hash",label:"Копировать хеш",hint:h.shortHash,onSelect:()=>void ha(h.hash)},{id:"short",label:"Копировать короткий хеш",onSelect:()=>void ha(h.shortHash)},{id:"subject",label:"Копировать сообщение",onSelect:()=>void ha(h.subject)}],A=new Set;for(const G of h.refs){const V=G.startsWith("tag: "),Z=aN(G);!Z||A.has(Z)||(A.add(Z),E.push({id:`ref:${Z}`,label:V?"Копировать тег":"Копировать ветку",hint:Z,onSelect:()=>void ha(Z)}))}return E}return a.jsxs(a.Fragment,{children:[a.jsxs("button",{className:"gitrow"+(o?" is-on":""),title:c?"Коммит ещё не отправлен на удалённый репозиторий":void 0,onClick:()=>{var E;if((E=y.current)!=null&&E.fired){y.current=null;return}d()},onContextMenu:E=>{E.preventDefault(),x({x:E.clientX,y:E.clientY})},onTouchStart:j,onTouchMove:v,onTouchEnd:C,onTouchCancel:C,children:[a.jsx(FS,{row:l,columns:s,head:r,local:c}),a.jsxs("span",{className:"gitrow__body",children:[a.jsxs("span",{className:"gitrow__subject",children:[p.map(E=>a.jsx("span",{className:"gitrow__ref",children:E},E)),h.subject]}),a.jsxs("span",{className:"gitrow__meta",children:[h.shortHash," · ",h.author," · ",cN(h.date),c&&a.jsx("span",{className:"gitrow__local",children:"· не отправлен"})]})]})]}),g&&a.jsx(zi,{x:g.x,y:g.y,items:k(),onClose:()=>x(null)})]})}function FS({row:l,columns:s,head:r,local:c}){const o=s*Ib+6,d=Fo/2,h=x=>8+Math.min(x,qp-1)*Ib,p=c?"3.5 2.5":void 0,g=Lf(l.col);return a.jsxs("svg",{className:"gitgraph",width:o,height:Fo,viewBox:`0 0 ${o} ${Fo}`,"aria-hidden":"true",children:[l.through.map(x=>a.jsx("line",{x1:h(x),y1:0,x2:h(x),y2:Fo,style:{stroke:Lf(x)}},`t${x}`)),l.up.map((x,y)=>a.jsx("path",{d:`M${h(x.from)} 0 L${h(x.from)} ${d-12} L${h(x.to)} ${d}`,fill:"none",style:{stroke:Lf(x.from),strokeDasharray:p}},`u${y}`)),l.down.map((x,y)=>a.jsx("path",{d:`M${h(x.from)} ${d} L${h(x.to)} ${d+12} L${h(x.to)} ${Fo}`,fill:"none",style:{stroke:Lf(x.to),strokeDasharray:p}},`d${y}`)),r&&a.jsx("circle",{className:"gitgraph__head",cx:h(l.col),cy:d,r:l.commit.parents.length>1?7.4:6.6}),a.jsx("circle",{className:"gitgraph__dot",cx:h(l.col),cy:d,r:l.commit.parents.length>1?4.6:3.6,style:{stroke:g,fill:c?void 0:g}})]})}function Lf(l){return`var(--lane-${l%qp})`}function JS({detail:l,local:s,onCheckout:r,onClose:c}){const o=l.hash==="";return a.jsxs(gl,{className:"modal--wide",title:o?"Незакоммиченные изменения":`Коммит ${l.shortHash}`,onClose:c,actions:a.jsxs(a.Fragment,{children:[!o&&a.jsx("button",{className:"btn",onClick:()=>r(l.hash,`коммит ${l.shortHash} (HEAD отделится от ветки)`),children:"Переключиться сюда"}),a.jsx("button",{className:"btn btn--primary",onClick:c,children:"Закрыть"})]}),children:[!o&&a.jsxs("div",{className:"commit__head",children:[a.jsxs("div",{className:"commit__line",children:[a.jsx("p",{className:"commit__subject",children:l.subject}),a.jsx(Hc,{text:l.subject,hint:"сообщение коммита"})]}),a.jsxs("p",{className:"commit__meta",children:[l.author,l.email&&` <${l.email}>`," · ",oN(l.date)]}),a.jsxs("div",{className:"commit__line commit__line--hash",children:[a.jsx("span",{className:"commit__hash",children:l.hash}),a.jsx(Hc,{text:l.hash,hint:"хеш коммита"})]}),s&&a.jsx("p",{className:"commit__meta commit__meta--local",children:"Не отправлен: этого коммита нет ни в одной удалённой ветке."}),l.parents.length>0&&a.jsxs("p",{className:"commit__meta",children:[l.parents.length>1?"слияние: ":"родитель: ",l.parents.map(d=>d.slice(0,8)).join(", ")]}),l.body&&a.jsx("pre",{className:"commit__body",children:l.body})]}),l.truncated&&a.jsx("p",{className:"modal__text",children:"Изменения слишком велики — часть патча не показана."}),l.files.length===0?a.jsx("p",{className:"modal__text",children:"Изменений нет."}):l.files.map(d=>a.jsx(WS,{file:d,defaultOpen:l.files.length<=3},d.path+d.oldPath))]})}function WS({file:l,defaultOpen:s}){const[r,c]=_.useState(s);return a.jsxs("div",{className:"commit__file",children:[a.jsxs("button",{className:"commit__filehead",onClick:()=>c(o=>!o),children:[a.jsx("span",{className:"commit__filepath",children:l.path||l.oldPath}),a.jsxs("span",{className:"diff__stat",children:[l.added>0&&a.jsxs("span",{className:"diff__stat--add",children:["+",l.added]}),l.removed>0&&a.jsxs("span",{className:"diff__stat--del",children:["−",l.removed]})]}),a.jsx("span",{className:"tool__status",children:r?"▴":"▾"})]}),r&&a.jsx(Hp,{diff:Z_(l)})]})}function PS(){return a.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[a.jsx("circle",{cx:"4.5",cy:"3.5",r:"1.9"}),a.jsx("circle",{cx:"4.5",cy:"12.5",r:"1.9"}),a.jsx("circle",{cx:"11.5",cy:"8",r:"1.9"}),a.jsx("path",{d:"M4.5 5.4v5.2M6.4 3.9h2.2a1.6 1.6 0 0 1 1.6 1.6v.8"})]})}function eN(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M8 13V3M4.5 6.5 8 3l3.5 3.5"})})}function tN(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M8 3v10M4.5 9.5 8 13l3.5-3.5"})})}function nN(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("circle",{cx:"7",cy:"7",r:"4"}),a.jsx("path",{d:"m13 13-2.6-2.6"})]})}function qb(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:a.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 lN(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M14 8a6 6 0 1 1-6-6c1.68 0 3.29.67 4.49 1.83L14 5.33"}),a.jsx("path",{d:"M14 2v3.33h-3.33"})]})}function sN(l){return l.replace(/^HEAD -> /,"").replace(/^tag: /,"⌂ ").trim()}function aN(l){const s=l.replace(/^HEAD -> /,"").replace(/^tag: /,"").trim();return s==="HEAD"?"":s}function iN(l){const s=l.split("/");return s[s.length-1]??l}function rN(l){const s=l%100;if(s>=11&&s<=14)return"файлов";switch(l%10){case 1:return"файл";case 2:case 3:case 4:return"файла";default:return"файлов"}}function cN(l){const s=Date.parse(l);if(Number.isNaN(s))return l;const r=Math.round((Date.now()-s)/6e4);if(r<1)return"только что";if(r<60)return`${r} мин назад`;const c=Math.round(r/60);if(c<24)return`${c} ч назад`;const o=Math.round(c/24);return o<30?`${o} дн назад`:new Date(s).toLocaleDateString()}function oN(l){const s=Date.parse(l);return Number.isNaN(s)?l:new Date(s).toLocaleString()}function Gb(l){return l.replace(/[^A-Za-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"")}function uN({status:l,owners:s,files:r,defaultName:c,hasCommits:o,busy:d,result:h,onRefreshStatus:p,onSaveToken:g,onPublish:x,onDismissResult:y,onClose:j}){var de;const[v,C]=_.useState(()=>Gb(c)),[k,E]=_.useState(""),[A,G]=_.useState(""),[V,Z]=_.useState(!0),[D,$]=_.useState("Первый коммит"),[z,R]=_.useState(null),[H,B]=_.useState("");_.useEffect(()=>{!k&&s.length>0&&E(s[0].login)},[k,s]),_.useEffect(()=>{r&&z===null&&R(new Set(r.files))},[r,z]);const le=(l==null?void 0:l.connected)===!0,W=s.map(_e=>({value:_e.login,label:_e.login,hint:_e.kind==="org"?"организация":void 0})),oe=_.useMemo(()=>{if(!r)return[];const _e=H.trim().toLowerCase();return _e?r.files.filter(Ce=>Ce.toLowerCase().includes(_e)):r.files},[r,H]),se=(z==null?void 0:z.size)??0,ge=le&&v.trim()!==""&&k!==""&&d===""&&(o||se>0);function ye(_e){R(Ce=>{const w=new Set(Ce??[]);return w.has(_e)?w.delete(_e):w.add(_e),w})}function Y(_e){R(Ce=>{const w=new Set(Ce??[]);for(const Q of oe)_e?w.add(Q):w.delete(Q);return w})}function ce(){if(!ge)return;const _e=(r==null?void 0:r.files)??[];x({owner:k,name:v.trim(),description:A.trim(),private:V,include:o?[]:_e.filter(Ce=>z==null?void 0:z.has(Ce)),ignore:o?[]:_e.filter(Ce=>!(z!=null&&z.has(Ce))),message:o?"":D.trim()||"Первый коммит"})}return a.jsxs(gl,{className:"modal--wide",title:"Опубликовать на GitHub",onClose:j,actions:a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"btn",onClick:j,children:"Отмена"}),a.jsx("button",{type:"button",className:"btn btn--primary",disabled:!ge,onClick:ce,children:d||"Опубликовать"})]}),children:[a.jsx(fN,{status:l,onRefreshStatus:p,onSaveToken:g}),a.jsxs("div",{className:"publish__section",children:[a.jsx("h3",{className:"publish__heading",children:"Репозиторий"}),a.jsxs("label",{className:"field publish__field",children:[a.jsx("span",{children:"Имя"}),a.jsx("input",{className:"input input--mono",value:v,spellCheck:!1,autoComplete:"off",onChange:_e=>C(Gb(_e.target.value))})]}),v.trim()===""&&a.jsx("p",{className:"modal__error",children:"Имя репозитория не может быть пустым."}),a.jsxs("label",{className:"field publish__field",children:[a.jsx("span",{children:"Владелец"}),s.length>1?a.jsx(Is,{className:"settings__select",value:k,options:W,onChange:E,placeholder:"выберите владельца",ariaLabel:"Владелец репозитория"}):a.jsx("p",{className:"publish__static",children:((de=s[0])==null?void 0:de.login)??"—"})]}),a.jsxs("label",{className:"field publish__field",children:[a.jsx("span",{children:"Описание (необязательно)"}),a.jsx("input",{className:"input",value:A,placeholder:"о чём проект — одной строкой",onChange:_e=>G(_e.target.value)})]}),a.jsxs("div",{className:"field publish__field",children:[a.jsx("span",{children:"Видимость"}),a.jsxs("div",{className:"access",role:"radiogroup","aria-label":"Видимость репозитория",children:[a.jsx(Yb,{title:"Приватный",desc:"Виден только вам и тем, кого вы пригласите. Стоит по умолчанию: репозиторий с чужим кодом, случайно ставший публичным, потом не отозвать.",on:V,onClick:()=>Z(!0)}),a.jsx(Yb,{title:"Публичный",desc:"Виден всем в интернете — код, история коммитов, всё содержимое.",risky:!0,on:!V,onClick:()=>Z(!1)})]})]})]}),!o&&a.jsxs("div",{className:"publish__section",children:[a.jsx("h3",{className:"publish__heading",children:"Файлы первого коммита"}),r===null?a.jsx("p",{className:"modal__text",children:"Читаем файлы…"}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"publish__filehead",children:[a.jsxs("span",{className:"publish__filecount",children:[se," из ",r.files.length," файлов"]}),a.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>Y(!0),children:"Отметить все"}),a.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>Y(!1),children:"Снять все"})]}),r.files.length>8&&a.jsx("input",{className:"input publish__filter",value:H,placeholder:"Фильтр по пути…",spellCheck:!1,onChange:_e=>B(_e.target.value)}),a.jsx("div",{className:"publish__filelist",children:oe.length===0?a.jsx("p",{className:"modal__text publish__filesempty",children:"Ничего не найдено по фильтру."}):oe.map(_e=>a.jsxs("button",{type:"button",role:"checkbox","aria-checked":(z==null?void 0:z.has(_e))===!0,className:"publish__file",onClick:()=>ye(_e),children:[a.jsx("span",{className:"publish__box"+(z!=null&&z.has(_e)?" is-on":""),"aria-hidden":"true",children:(z==null?void 0:z.has(_e))&&"✓"}),a.jsx("span",{className:"publish__filepath",children:_e})]},_e))}),r.truncated&&a.jsx("p",{className:"publish__truncated",children:"Каталог больше, чем показано здесь, — часть файлов в список не попала. Их всё равно можно закоммитить потом обычным образом."}),a.jsxs("label",{className:"field publish__field",children:[a.jsx("span",{children:"Сообщение коммита"}),a.jsx("input",{className:"input",value:D,onChange:_e=>$(_e.target.value)})]})]})]}),a.jsx(Ar,{result:h,onDismiss:y})]})}function Yb({title:l,desc:s,on:r,risky:c,onClick:o}){return a.jsxs("button",{type:"button",role:"radio","aria-checked":r,className:"access__card"+(r?" is-on":"")+(c?" access__card--risky":""),onClick:o,children:[a.jsx("span",{className:"access__radio","aria-hidden":"true"}),a.jsxs("span",{className:"access__body",children:[a.jsxs("span",{className:"access__title",children:[l,c&&a.jsx("span",{className:"access__risk",children:"видно всем"})]}),a.jsx("span",{className:"access__desc",children:s})]})]})}function fN({status:l,onRefreshStatus:s,onSaveToken:r}){const[c,o]=_.useState(""),[d,h]=_.useState(!1);return a.jsxs("div",{className:"publish__section publish__section--first",children:[a.jsx("h3",{className:"publish__heading",children:"Учётная запись GitHub"}),l===null?a.jsx("p",{className:"modal__text",children:"Проверяем подключение…"}):l.connected?a.jsxs("div",{className:"publish__account",children:[a.jsx("span",{className:"chip chip--ok",children:l.login}),a.jsx("span",{className:"publish__accountvia",children:l.source==="gh"?"через GitHub CLI":"по личному токену"}),l.source==="token"&&a.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>r(""),children:"Отключить токен"})]}):a.jsxs("div",{className:"publish__connect",children:[l.ghInstalled&&a.jsxs("p",{className:"modal__text",children:["В системе установлен ",a.jsx("code",{children:"gh"}),", но вход в нём не выполнен. Можно вместо токена выполнить ",a.jsx("code",{children:"gh auth login"})," в панели терминала и нажать «Проверить снова» — либо ввести личный токен ниже."]}),a.jsxs("label",{className:"field publish__field",children:[a.jsx("span",{children:"Личный токен GitHub"}),a.jsx(dN,{value:c,onChange:o,visible:d,onToggleVisible:()=>h(p=>!p),placeholder:"ghp_…"})]}),a.jsxs("p",{className:"publish__tokenhint",children:["Нужен токен с доступом ",a.jsx("code",{children:"repo"})," — им приложение создаст репозиторий и отправит в него код."," ",a.jsx("a",{href:"https://github.com/settings/tokens/new?scopes=repo&description=Claude%20Code%20Visual",target:"_blank",rel:"noreferrer",children:"Создать токен на GitHub ↗"})]}),l.message&&a.jsx("p",{className:"modal__error",children:l.message}),a.jsxs("div",{className:"extbar",children:[a.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:s,children:"Проверить снова"}),a.jsx("button",{type:"button",className:"btn btn--sm btn--primary",disabled:c.trim()==="",onClick:()=>r(c.trim()),children:"Сохранить токен"})]})]})]})}function dN({value:l,onChange:s,visible:r,onToggleVisible:c,placeholder:o,autoFocus:d}){return a.jsxs("div",{className:"pwfield",children:[a.jsx("input",{className:"input input--mono pwfield__input",type:r?"text":"password",value:l,placeholder:o,spellCheck:!1,autoComplete:"off",autoFocus:d,onChange:h=>s(h.target.value)}),a.jsx("button",{type:"button",className:"pwfield__toggle","aria-label":r?"Скрыть токен":"Показать токен","aria-pressed":r,onClick:c,children:r?a.jsx(pN,{}):a.jsx(hN,{})})]})}function hN(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M1 8s2.5-5 7-5 7 5 7 5-2.5 5-7 5-7-5-7-5Z"}),a.jsx("circle",{cx:"8",cy:"8",r:"2.1"})]})}function pN(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M1 8s2.5-5 7-5 7 5 7 5-2.5 5-7 5-7-5-7-5Z"}),a.jsx("circle",{cx:"8",cy:"8",r:"2.1"}),a.jsx("path",{d:"M2 14 14 2"})]})}function mN({busy:l,result:s,onSubmit:r,onDismissResult:c,onClose:o}){const[d,h]=_.useState(""),p=/^(https?|ssh|git):\/\/\S+/i.test(d.trim())||/^[\w.-]+@[\w.-]+:.+/.test(d.trim());return a.jsxs(gl,{title:"Подключить существующий репозиторий",onClose:o,actions:a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"btn",onClick:o,children:"Отмена"}),a.jsx("button",{type:"button",className:"btn btn--primary",disabled:!p||l!=="",onClick:()=>r(d.trim()),children:l||"Подключить"})]}),children:[a.jsxs("p",{className:"modal__text",children:["Пропишет этот адрес как ",a.jsx("code",{children:"origin"})," текущего репозитория. Ничего не отправляется само — после этого в панели появятся обычные «Отправить» и «Забрать»."]}),a.jsxs("label",{className:"field",children:[a.jsx("span",{children:"Адрес репозитория"}),a.jsx("input",{className:"input input--mono",value:d,placeholder:"https://github.com/owner/name.git",spellCheck:!1,autoComplete:"off",autoFocus:!0,onChange:g=>h(g.target.value),onKeyDown:g=>{g.key==="Enter"&&p&&l===""&&r(d.trim())}})]}),a.jsxs("p",{className:"modal__text modal__text--dim",children:["Подходят адреса вида ",a.jsx("code",{children:"https://…"}),", ",a.jsx("code",{children:"ssh://…"}),", ",a.jsx("code",{children:"git://…"})," и"," ",a.jsx("code",{children:"git@host:path"}),"."]}),a.jsx(Ar,{result:s,onDismiss:c})]})}function gN({open:l,items:s,busy:r,ready:c,sendBlocked:o,commands:d,contextResult:h,draftKey:p,models:g,model:x,effort:y,ultracode:j,thinking:v,switchOnFlag:C,onContextSearch:k,onCommand:E,onModel:A,onEffort:G,onUltracode:V,onThinking:Z,onSwitchOnFlag:D,onAsk:$,onInterrupt:z,onReset:R,onClose:H,zoomed:B,onToggleZoom:le}){return a.jsxs("aside",{className:(l?"sidepane sidepane--ask sidepane--open":"sidepane sidepane--ask")+(B?" sidepane--zoomed":""),"aria-label":"Вопрос на полях",children:[a.jsxs("div",{className:"sidepane__head",onDoubleClick:W=>{le&&(W.target.closest("button")||le())},children:[a.jsx(xN,{}),a.jsx("span",{className:"sidepane__title",children:"Вопрос на полях"}),a.jsx("button",{className:"sidepane__btn",title:"Начать заново — следующий вопрос возьмёт свежий контекст","aria-label":"Начать боковой разговор заново",disabled:s.length===0,onClick:R,children:"↻"}),le&&a.jsx("button",{className:"sidepane__btn",title:B?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":B?"Свернуть панель вопроса":"Развернуть панель вопроса на весь экран","aria-pressed":B,onClick:le,children:a.jsx(Ic,{active:B})}),a.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель вопроса",onClick:H,children:"✕"})]}),g.length>0&&a.jsxs("div",{className:"sidepane__tools",children:[a.jsx(ny,{className:"select--compact",models:g,value:x,effort:y,ultracode:j,thinking:v,switchOnFlag:C,onModel:A,onEffort:G,onUltracode:V,onThinking:Z,onSwitchOnFlag:D}),a.jsx("span",{className:"sidepane__note",title:"Боковой вопрос работает только на чтение",children:"только чтение"})]}),a.jsx(Bp,{items:s,busy:r,waiting:!1,empty:c?"Спросите о том, что происходит: вопрос уйдёт в сторону от основного разговора и не попадёт в его контекст. Отвечающий видит сессию и проект, но ничего не меняет.":"Откройте сессию — вопрос задаётся о ней."}),a.jsx(W_,{className:"composer--side",disabled:!c,busy:r,commands:d,sessionTitle:null,contextResult:h,draftKey:p?`side:${p}`:null,placeholder:"Спросить, не мешая работе…",sendLabel:"Спросить",autoFocus:l,attachmentsEnabled:!1,sendBlocked:o,onContextSearch:k,onCommand:E,onSend:$,onInterrupt:z,onEscape:r?z:H})]})}function xN(){return a.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:[a.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"}),a.jsx("path",{d:"M8.4 8.5v-.3c0-.7.9-.9.9-1.7a1 1 0 0 0-1.9-.4"})]})}const bN=75,_N=90;function ly({usage:l}){if(!(l!=null&&l.available))return null;const s=l.buckets??[],r=s.length>0?s.map(o=>({key:o.id,label:o.label,window:o.window})):[...l.fiveHour?[{key:"five",label:"5 ч",window:l.fiveHour}]:[],...l.sevenDay?[{key:"week",label:"нед",window:l.sevenDay}]:[]];if(r.length===0)return null;const c=s.length>0?"Квота Antigravity":`Расход лимитов плана${l.plan?` ${l.plan}`:""}`;return a.jsx("div",{className:"usage",title:jN(l,s),"aria-label":c,children:r.map(o=>a.jsx(yN,{label:o.label,window:o.window},o.key))})}function yN({label:l,window:s}){const r=Math.round(s.utilization),c=SN(s.resetsAt);return a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"usage__label",children:l}),a.jsx("span",{className:"usage__track",role:"progressbar","aria-label":l,"aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,children:a.jsx("span",{className:`usage__fill${vN(r)}`,style:{width:`${r}%`}})}),a.jsxs("span",{className:"usage__pct",children:[r,"%"]}),a.jsx("span",{className:"usage__reset",title:Gp(s.resetsAt)||void 0,children:c&&`↻ ${c}`})]})}function vN(l){return l>=_N?" usage__fill--over":l>=bN?" usage__fill--warn":""}function jN(l,s){if(s.length>0)return wN(s);const r=[l.plan?`Лимиты плана ${l.plan}`:"Лимиты плана"],c=(o,d)=>{if(!d)return;const h=Gp(d.resetsAt);r.push(`${o}: ${Math.round(d.utilization)}%${h?`, ${h}`:""}`)};return c("5 часов",l.fiveHour),c("Неделя",l.sevenDay),c("Неделя, Opus",l.sevenDayOpus),r.join(`