@i14ks/ccv 0.6.1 → 0.6.2

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 (24) hide show
  1. package/package.json +1 -1
  2. package/web/assets/{codemirror-YAsAN8OM.js → codemirror-02hKfv-c.js} +1 -1
  3. package/web/assets/{index-bVu7H3ZX.js → index-B5hgDwts.js} +1 -1
  4. package/web/assets/{index-DwCBmVAn.js → index-BBkJ4cEk.js} +1 -1
  5. package/web/assets/{index-khA8Gu_K.js → index-BC8gj6P7.js} +1 -1
  6. package/web/assets/{index-CStpUyOa.js → index-Bm6PUpXb.js} +1 -1
  7. package/web/assets/{index-CbXyt5BH.js → index-BorlqgNX.js} +1 -1
  8. package/web/assets/{index-BqaOf3lL.js → index-BxcnR7Nj.js} +1 -1
  9. package/web/assets/{index-Dr7O0ILC.js → index-BybHqs37.js} +1 -1
  10. package/web/assets/{index-DSWJFoDR.js → index-C-8irjwh.js} +1 -1
  11. package/web/assets/{index-YTb4ol7S.js → index-C2nhZ-ID.js} +1 -1
  12. package/web/assets/{index-C6bp7gLM.js → index-ChKrBnaf.js} +1 -1
  13. package/web/assets/{index-CaI4eesN.js → index-Clyg5z5Z.js} +1 -1
  14. package/web/assets/{index-CbkTwf-a.js → index-D0UkSEon.js} +1 -1
  15. package/web/assets/{index-05EaTJ2I.js → index-DFJbTCVa.js} +5 -5
  16. package/web/assets/{index-Bj-McB2J.js → index-DRMnPfA3.js} +1 -1
  17. package/web/assets/{index-DQD2YqR9.js → index-DZXdWq9L.js} +1 -1
  18. package/web/assets/{index-po851PkX.js → index-DpZcQOqI.js} +1 -1
  19. package/web/assets/{index-BANX3gfG.js → index-KEWrG50i.js} +1 -1
  20. package/web/assets/{index-Cw0TSvLQ.js → index-VSDVirVT.js} +1 -1
  21. package/web/assets/{index-JfSeUxQA.js → index-i-F6wQDa.js} +1 -1
  22. package/web/assets/{index-CJKd_3HV.css → index-sQrmYdbi.css} +1 -1
  23. package/web/assets/{index-DWdTnlsP.js → index-zDoB4KM7.js} +1 -1
  24. package/web/index.html +2 -2
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-Dr7O0ILC.js","./index-Bj-McB2J.js","./index-YTb4ol7S.js","./index-BHot-lnj.js","./index-891wE-Rj.js","./index-CStpUyOa.js","./index-CbXyt5BH.js","./index-BqaOf3lL.js","./index-C6bp7gLM.js","./index-DwCBmVAn.js","./index-CaI4eesN.js","./index-Cw0TSvLQ.js","./index-DSWJFoDR.js","./index-khA8Gu_K.js","./index-CbkTwf-a.js","./index-DWdTnlsP.js","./index-bVu7H3ZX.js","./index-po851PkX.js","./index-JfSeUxQA.js","./index-DQD2YqR9.js","./index-BANX3gfG.js","./codemirror-YAsAN8OM.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-BybHqs37.js","./index-DRMnPfA3.js","./index-C2nhZ-ID.js","./index-BHot-lnj.js","./index-891wE-Rj.js","./index-Bm6PUpXb.js","./index-BorlqgNX.js","./index-BxcnR7Nj.js","./index-ChKrBnaf.js","./index-BBkJ4cEk.js","./index-Clyg5z5Z.js","./index-VSDVirVT.js","./index-C-8irjwh.js","./index-BC8gj6P7.js","./index-D0UkSEon.js","./index-zDoB4KM7.js","./index-B5hgDwts.js","./index-DpZcQOqI.js","./index-i-F6wQDa.js","./index-DZXdWq9L.js","./index-KEWrG50i.js","./codemirror-02hKfv-c.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 N0=Object.defineProperty;var Ig=s=>{throw TypeError(s)};var T0=(s,l,i)=>l in s?N0(s,l,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[l]=i;var wt=(s,l,i)=>T0(s,typeof l!="symbol"?l+"":l,i),Bd=(s,l,i)=>l.has(s)||Ig("Cannot "+i);var Ue=(s,l,i)=>(Bd(s,l,"read from private field"),i?i.call(s):l.get(s)),$t=(s,l,i)=>l.has(s)?Ig("Cannot add the same private member more than once"):l instanceof WeakSet?l.add(s):l.set(s,i),ft=(s,l,i,r)=>(Bd(s,l,"write to private field"),r?r.call(s,i):l.set(s,i),i),un=(s,l,i)=>(Bd(s,l,"access private method"),i);(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const d of o)if(d.type==="childList")for(const h of d.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&r(h)}).observe(document,{childList:!0,subtree:!0});function i(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 r(o){if(o.ep)return;o.ep=!0;const d=i(o);fetch(o.href,d)}})();var qd={exports:{}},vc={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -113,14 +113,14 @@ ${s}</tr>
113
113
  Please report this to https://github.com/markedjs/marked.`,s){let r="<p>An error occurred:</p><pre>"+ya(i.message+"",!0)+"</pre>";return l?Promise.resolve(r):r}if(l)return Promise.reject(i);throw i}}},ji=new Q_;function ht(s,l){return ji.parse(s,l)}ht.options=ht.setOptions=function(s){return ji.setOptions(s),ht.defaults=ji.defaults,kb(ht.defaults),ht};ht.getDefaults=jh;ht.defaults=Ni;ht.use=function(...s){return ji.use(...s),ht.defaults=ji.defaults,kb(ht.defaults),ht};ht.walkTokens=function(s,l){return ji.walkTokens(s,l)};ht.parseInline=ji.parseInline;ht.Parser=Wl;ht.parser=Wl.parse;ht.Renderer=jo;ht.TextRenderer=Oh;ht.Lexer=Fl;ht.lexer=Fl.lex;ht.Tokenizer=wo;ht.Hooks=Ac;ht.parse=ht;ht.options;ht.setOptions;ht.use;ht.walkTokens;ht.parseInline;Wl.parse;Fl.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 fy(s,l){(l==null||l>s.length)&&(l=s.length);for(var i=0,r=Array(l);i<l;i++)r[i]=s[i];return r}function $_(s){if(Array.isArray(s))return s}function Z_(s,l){var i=s==null?null:typeof Symbol<"u"&&s[Symbol.iterator]||s["@@iterator"];if(i!=null){var r,o,d,h,g=[],m=!0,b=!1;try{if(d=(i=i.call(s)).next,l!==0)for(;!(m=(r=d.call(i)).done)&&(g.push(r.value),g.length!==l);m=!0);}catch(x){b=!0,o=x}finally{try{if(!m&&i.return!=null&&(h=i.return(),Object(h)!==h))return}finally{if(b)throw o}}return g}}function K_(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
114
114
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function J_(s,l){return $_(s)||Z_(s,l)||F_(s,l)||K_()}function F_(s,l){if(s){if(typeof s=="string")return fy(s,l);var i={}.toString.call(s).slice(8,-1);return i==="Object"&&s.constructor&&(i=s.constructor.name),i==="Map"||i==="Set"?Array.from(s):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?fy(s,l):void 0}}const Ob=Object.entries,dy=Object.setPrototypeOf,W_=Object.isFrozen,P_=Object.getPrototypeOf,ev=Object.getOwnPropertyDescriptor;let zn=Object.freeze,Ln=Object.seal,dr=Object.create,Db=typeof Reflect<"u"&&Reflect,gh=Db.apply,yh=Db.construct;zn||(zn=function(l){return l});Ln||(Ln=function(l){return l});gh||(gh=function(l,i){for(var r=arguments.length,o=new Array(r>2?r-2:0),d=2;d<r;d++)o[d-2]=arguments[d];return l.apply(i,o)});yh||(yh=function(l){for(var i=arguments.length,r=new Array(i>1?i-1:0),o=1;o<i;o++)r[o-1]=arguments[o];return new l(...r)});const ur=on(Array.prototype.forEach),tv=on(Array.prototype.lastIndexOf),hy=on(Array.prototype.pop),or=on(Array.prototype.push),nv=on(Array.prototype.splice),Us=Array.isArray,Cc=on(String.prototype.toLowerCase),Kd=on(String.prototype.toString),py=on(String.prototype.match),wc=on(String.prototype.replace),my=on(String.prototype.indexOf),lv=on(String.prototype.trim),av=on(Number.prototype.toString),sv=on(Boolean.prototype.toString),gy=typeof BigInt>"u"?null:on(BigInt.prototype.toString),yy=typeof Symbol>"u"?null:on(Symbol.prototype.toString),Nn=on(Object.prototype.hasOwnProperty),jc=on(Object.prototype.toString),jn=on(RegExp.prototype.test),di=iv(TypeError);function on(s){return function(l){l instanceof RegExp&&(l.lastIndex=0);for(var i=arguments.length,r=new Array(i>1?i-1:0),o=1;o<i;o++)r[o-1]=arguments[o];return gh(s,l,r)}}function iv(s){return function(){for(var l=arguments.length,i=new Array(l),r=0;r<l;r++)i[r]=arguments[r];return yh(s,i)}}function lt(s,l){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Cc;if(dy&&dy(s,null),!Us(l))return s;let r=l.length;for(;r--;){let o=l[r];if(typeof o=="string"){const d=i(o);d!==o&&(W_(l)||(l[r]=d),o=d)}s[o]=!0}return s}function rv(s){for(let l=0;l<s.length;l++)Nn(s,l)||(s[l]=null);return s}function Fn(s){const l=dr(null);for(const r of Ob(s)){var i=J_(r,2);const o=i[0],d=i[1];Nn(s,o)&&(Us(d)?l[o]=rv(d):d&&typeof d=="object"&&d.constructor===Object?l[o]=Fn(d):l[o]=d)}return l}function cv(s){switch(typeof s){case"string":return s;case"number":return av(s);case"boolean":return sv(s);case"bigint":return gy?gy(s):"0";case"symbol":return yy?yy(s):"Symbol()";case"undefined":return jc(s);case"function":case"object":{if(s===null)return jc(s);const l=s,i=ba(l,"toString");if(typeof i=="function"){const r=i(l);return typeof r=="string"?r:jc(r)}return jc(s)}default:return jc(s)}}function ba(s,l){for(;s!==null;){const r=ev(s,l);if(r){if(r.get)return on(r.get);if(typeof r.value=="function")return on(r.value)}s=P_(s)}function i(){return null}return i}function uv(s){try{return jn(s,""),!0}catch{return!1}}const by=zn(["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"]),Jd=zn(["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"]),Fd=zn(["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"]),ov=zn(["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"]),Wd=zn(["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"]),fv=zn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),xy=zn(["#text"]),_y=zn(["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"]),Pd=zn(["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"]),vy=zn(["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"]),io=zn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),dv=Ln(/{{[\w\W]*|^[\w\W]*}}/g),hv=Ln(/<%[\w\W]*|^[\w\W]*%>/g),pv=Ln(/\${[\w\W]*/g),mv=Ln(/^data-[\-\w.\u00B7-\uFFFF]+$/),gv=Ln(/^aria-[\-\w]+$/),Sy=Ln(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),yv=Ln(/^(?:\w+script|data):/i),bv=Ln(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),xv=Ln(/^html$/i),_v=Ln(/^[a-z][.\w]*(-[.\w]+)+$/i),ky=Ln(/<[/\w!]/g),wy=Ln(/<[/\w]/g),vv=Ln(/<\/no(script|embed|frames)/i),Sv=Ln(/\/>/i),Nl={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},kv=function(){return typeof window>"u"?null:window},wv=function(l,i){if(typeof l!="object"||typeof l.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";i&&i.hasAttribute(o)&&(r=i.getAttribute(o));const d="dompurify"+(r?"#"+r:"");try{return l.createPolicy(d,{createHTML(h){return h},createScriptURL(h){return h}})}catch{return console.warn("TrustedTypes policy "+d+" could not be created."),null}},jy=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Os=function(l,i,r,o){return Nn(l,i)&&Us(l[i])?lt(o.base?Fn(o.base):{},l[i],o.transform):r};function zb(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:kv();const l=ue=>zb(ue);if(l.version="3.4.12",l.removed=[],!s||!s.document||s.document.nodeType!==Nl.document||!s.Element)return l.isSupported=!1,l;let i=s.document;const r=i,o=r.currentScript;s.DocumentFragment;const d=s.HTMLTemplateElement,h=s.Node,g=s.Element,m=s.NodeFilter,b=s.NamedNodeMap;b===void 0&&(s.NamedNodeMap||s.MozNamedAttrMap),s.HTMLFormElement;const x=s.DOMParser,k=s.trustedTypes,_=g.prototype,C=ba(_,"cloneNode"),N=ba(_,"remove"),H=ba(_,"nextSibling"),B=ba(_,"childNodes"),K=ba(_,"parentNode"),O=ba(_,"shadowRoot"),$=ba(_,"attributes"),A=h&&h.prototype?ba(h.prototype,"nodeType"):null,Q=h&&h.prototype?ba(h.prototype,"nodeName"):null;if(typeof d=="function"){const ue=i.createElement("template");ue.content&&ue.content.ownerDocument&&(i=ue.content.ownerDocument)}let L,M="",W,re=!1,he=0;const F=function(){if(he>0)throw di('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.')},ae=function(w){F(),he++;try{return L.createHTML(w)}finally{he--}},me=function(w){F(),he++;try{return L.createScriptURL(w)}finally{he--}},Ne=function(){return re||(W=wv(k,o),re=!0),W},pe=i,z=pe.implementation,P=pe.createNodeIterator,te=pe.createDocumentFragment,xe=pe.getElementsByTagName,we=r.importNode;let j=jy();l.isSupported=typeof Ob=="function"&&typeof K=="function"&&z&&z.createHTMLDocument!==void 0;const V=dv,ce=hv,oe=pv,ve=mv,Te=gv,Re=yv,it=bv,Ze=_v;let st=Sy,He=null;const Ct=lt({},[...by,...Jd,...Fd,...Wd,...xy]);let Je=null;const Ke=lt({},[..._y,...Pd,...vy,...io]);let Fe=Object.seal(dr(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}})),dt=null,Wn=null;const Bt=Object.seal(dr(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Tn=!0,bn=!0,fn=!1,Un=!0,Zt=!1,ut=!0,dn=!1,J=!1,fe=null,Ee=null,Qe=!1,Tt=!1,Et=!1,xn=!1,en=!0,qt=!1;const En="user-content-";let pt=!0,_n=!1,T={},I=null;const _e=lt({},["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 Me=null;const Le=lt({},["audio","video","img","source","image","track"]);let An=null;const Gl=lt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Yn="http://www.w3.org/1998/Math/MathML",Hn="http://www.w3.org/2000/svg",hn="http://www.w3.org/1999/xhtml";let Gt=hn,Tl=!1,ka=null;const wa=lt({},[Yn,Hn,hn],Kd),Ys=zn(["mi","mo","mn","ms","mtext"]);let Yl=lt({},Ys);const Pa=zn(["annotation-xml"]);let Il=lt({},Pa);const ja=lt({},["title","style","font","a","script"]);let fl=null;const Yt=["application/xhtml+xml","text/html"],Rt="text/html";let Be=null,pn=null;const ta=i.createElement("form"),Na=function(w){return w instanceof RegExp||w instanceof Function},dl=function(){let w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(pn&&pn===w)return;(!w||typeof w!="object")&&(w={}),w=Fn(w),fl=Yt.indexOf(w.PARSER_MEDIA_TYPE)===-1?Rt:w.PARSER_MEDIA_TYPE,Be=fl==="application/xhtml+xml"?Kd:Cc,He=Os(w,"ALLOWED_TAGS",Ct,{transform:Be}),Je=Os(w,"ALLOWED_ATTR",Ke,{transform:Be}),ka=Os(w,"ALLOWED_NAMESPACES",wa,{transform:Kd}),An=Os(w,"ADD_URI_SAFE_ATTR",Gl,{transform:Be,base:Gl}),Me=Os(w,"ADD_DATA_URI_TAGS",Le,{transform:Be,base:Le}),I=Os(w,"FORBID_CONTENTS",_e,{transform:Be}),dt=Os(w,"FORBID_TAGS",Fn({}),{transform:Be}),Wn=Os(w,"FORBID_ATTR",Fn({}),{transform:Be}),T=Nn(w,"USE_PROFILES")?w.USE_PROFILES&&typeof w.USE_PROFILES=="object"?Fn(w.USE_PROFILES):w.USE_PROFILES:!1,Tn=w.ALLOW_ARIA_ATTR!==!1,bn=w.ALLOW_DATA_ATTR!==!1,fn=w.ALLOW_UNKNOWN_PROTOCOLS||!1,Un=w.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Zt=w.SAFE_FOR_TEMPLATES||!1,ut=w.SAFE_FOR_XML!==!1,dn=w.WHOLE_DOCUMENT||!1,Tt=w.RETURN_DOM||!1,Et=w.RETURN_DOM_FRAGMENT||!1,xn=w.RETURN_TRUSTED_TYPE||!1,Qe=w.FORCE_BODY||!1,en=w.SANITIZE_DOM!==!1,qt=w.SANITIZE_NAMED_PROPS||!1,pt=w.KEEP_CONTENT!==!1,_n=w.IN_PLACE||!1,st=uv(w.ALLOWED_URI_REGEXP)?w.ALLOWED_URI_REGEXP:Sy,Gt=typeof w.NAMESPACE=="string"?w.NAMESPACE:hn,Yl=Nn(w,"MATHML_TEXT_INTEGRATION_POINTS")&&w.MATHML_TEXT_INTEGRATION_POINTS&&typeof w.MATHML_TEXT_INTEGRATION_POINTS=="object"?Fn(w.MATHML_TEXT_INTEGRATION_POINTS):lt({},Ys),Il=Nn(w,"HTML_INTEGRATION_POINTS")&&w.HTML_INTEGRATION_POINTS&&typeof w.HTML_INTEGRATION_POINTS=="object"?Fn(w.HTML_INTEGRATION_POINTS):lt({},Pa);const U=Nn(w,"CUSTOM_ELEMENT_HANDLING")&&w.CUSTOM_ELEMENT_HANDLING&&typeof w.CUSTOM_ELEMENT_HANDLING=="object"?Fn(w.CUSTOM_ELEMENT_HANDLING):dr(null);if(Fe=dr(null),Nn(U,"tagNameCheck")&&Na(U.tagNameCheck)&&(Fe.tagNameCheck=U.tagNameCheck),Nn(U,"attributeNameCheck")&&Na(U.attributeNameCheck)&&(Fe.attributeNameCheck=U.attributeNameCheck),Nn(U,"allowCustomizedBuiltInElements")&&typeof U.allowCustomizedBuiltInElements=="boolean"&&(Fe.allowCustomizedBuiltInElements=U.allowCustomizedBuiltInElements),Ln(Fe),Zt&&(bn=!1),Et&&(Tt=!0),T&&(He=lt({},xy),Je=dr(null),T.html===!0&&(lt(He,by),lt(Je,_y)),T.svg===!0&&(lt(He,Jd),lt(Je,Pd),lt(Je,io)),T.svgFilters===!0&&(lt(He,Fd),lt(Je,Pd),lt(Je,io)),T.mathMl===!0&&(lt(He,Wd),lt(Je,vy),lt(Je,io))),Bt.tagCheck=null,Bt.attributeCheck=null,Nn(w,"ADD_TAGS")&&(typeof w.ADD_TAGS=="function"?Bt.tagCheck=w.ADD_TAGS:Us(w.ADD_TAGS)&&(He===Ct&&(He=Fn(He)),lt(He,w.ADD_TAGS,Be))),Nn(w,"ADD_ATTR")&&(typeof w.ADD_ATTR=="function"?Bt.attributeCheck=w.ADD_ATTR:Us(w.ADD_ATTR)&&(Je===Ke&&(Je=Fn(Je)),lt(Je,w.ADD_ATTR,Be))),Nn(w,"ADD_URI_SAFE_ATTR")&&Us(w.ADD_URI_SAFE_ATTR)&&lt(An,w.ADD_URI_SAFE_ATTR,Be),Nn(w,"FORBID_CONTENTS")&&Us(w.FORBID_CONTENTS)&&(I===_e&&(I=Fn(I)),lt(I,w.FORBID_CONTENTS,Be)),Nn(w,"ADD_FORBID_CONTENTS")&&Us(w.ADD_FORBID_CONTENTS)&&(I===_e&&(I=Fn(I)),lt(I,w.ADD_FORBID_CONTENTS,Be)),pt&&(He["#text"]=!0),dn&&lt(He,["html","head","body"]),He.table&&(lt(He,["tbody"]),delete dt.tbody),w.TRUSTED_TYPES_POLICY){if(typeof w.TRUSTED_TYPES_POLICY.createHTML!="function")throw di('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof w.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw di('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const se=L;L=w.TRUSTED_TYPES_POLICY;try{M=ae("")}catch(Se){throw L=se,Se}}else w.TRUSTED_TYPES_POLICY===null?(L=void 0,M=""):(L===void 0&&(L=Ne()),L&&typeof M=="string"&&(M=ae("")));zn&&zn(w),pn=w},In=lt({},[...Jd,...Fd,...ov]),hl=lt({},[...Wd,...fv]),pl=function(w,U,se){return U.namespaceURI===hn?w==="svg":U.namespaceURI===Yn?w==="svg"&&(se==="annotation-xml"||Yl[se]):!!In[w]},na=function(w,U,se){return U.namespaceURI===hn?w==="math":U.namespaceURI===Hn?w==="math"&&Il[se]:!!hl[w]},Cn=function(w,U,se){return U.namespaceURI===Hn&&!Il[se]||U.namespaceURI===Yn&&!Yl[se]?!1:!hl[w]&&(ja[w]||!In[w])},ml=function(w){let U=K(w);(!U||!U.tagName)&&(U={namespaceURI:Gt,tagName:"template"});const se=Cc(w.tagName),Se=Cc(U.tagName);return ka[w.namespaceURI]?w.namespaceURI===Hn?pl(se,U,Se):w.namespaceURI===Yn?na(se,U,Se):w.namespaceURI===hn?Cn(se,U,Se):!!(fl==="application/xhtml+xml"&&ka[w.namespaceURI]):!1},tn=function(w){or(l.removed,{element:w});try{K(w).removeChild(w)}catch{if(N(w),!K(w))throw di("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},mt=function(w){Vn(w);const U=B(w);if(U){const Se=[];ur(U,Ce=>{or(Se,Ce)}),ur(Se,Ce=>{try{N(Ce)}catch{}})}const se=$(w);if(se)for(let Se=se.length-1;Se>=0;--Se){const Ce=se[Se],De=Ce&&Ce.name;if(typeof De=="string")try{w.removeAttribute(De)}catch{}}},Xn=function(w,U){try{or(l.removed,{attribute:U.getAttributeNode(w),from:U})}catch{or(l.removed,{attribute:null,from:U})}if(U.removeAttribute(w),w==="is")if(Tt||Et)try{tn(U)}catch{}else try{U.setAttribute(w,"")}catch{}},Ti=function(w){const U=$(w);if(U)for(let se=U.length-1;se>=0;--se){const Se=U[se],Ce=Se&&Se.name;if(!(typeof Ce!="string"||Je[Be(Ce)]))try{w.removeAttribute(Ce)}catch{}}},Vn=function(w){const U=[w];for(;U.length>0;){const se=U.pop();(A?A(se):se.nodeType)===Nl.element&&Ti(se);const Ce=B(se);if(Ce)for(let De=Ce.length-1;De>=0;--De)U.push(Ce[De])}},gl=function(w){if(!ut)return;const U=[w];for(;U.length>0;){const se=U.pop(),Se=A?A(se):se.nodeType;if(Se===Nl.processingInstruction||Se===Nl.comment&&jn(wy,se.data)){try{N(se)}catch{}continue}if(Se===Nl.element){const De=se,jt=Be(Q?Q(se):se.nodeName);try{De.hasAttribute&&De.hasAttribute("patchsrc")&&De.removeAttribute("patchsrc"),De.hasAttribute&&De.hasAttribute("for")&&jt!=="label"&&jt!=="output"&&De.removeAttribute("for")}catch{}}const Ce=B(se);if(Ce)for(let De=Ce.length-1;De>=0;--De)U.push(Ce[De])}},Is=function(w){let U=null,se=null;if(Qe)w="<remove></remove>"+w;else{const De=py(w,/^[\r\n\t ]+/);se=De&&De[0]}fl==="application/xhtml+xml"&&Gt===hn&&(w='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+w+"</body></html>");const Se=L?ae(w):w;if(Gt===hn)try{U=new x().parseFromString(Se,fl)}catch{}if(!U||!U.documentElement){U=z.createDocument(Gt,"template",null);try{U.documentElement.innerHTML=Tl?M:Se}catch{}}const Ce=U.body||U.documentElement;return w&&se&&Ce.insertBefore(i.createTextNode(se),Ce.childNodes[0]||null),Gt===hn?xe.call(U,dn?"html":"body")[0]:dn?U.documentElement:Ce},la=function(w){return P.call(w.ownerDocument||w,w,m.SHOW_ELEMENT|m.SHOW_COMMENT|m.SHOW_TEXT|m.SHOW_PROCESSING_INSTRUCTION|m.SHOW_CDATA_SECTION,null)},aa=function(w){return w=wc(w,V," "),w=wc(w,ce," "),w=wc(w,oe," "),w},yl=function(w){var U;w.normalize();const se=P.call(w.ownerDocument||w,w,m.SHOW_TEXT|m.SHOW_COMMENT|m.SHOW_CDATA_SECTION|m.SHOW_PROCESSING_INSTRUCTION,null);let Se=se.nextNode();for(;Se;)Se.data=aa(Se.data),Se=se.nextNode();const Ce=(U=w.querySelectorAll)===null||U===void 0?void 0:U.call(w,"template");Ce&&ur(Ce,De=>{bl(De.content)&&yl(De.content)})},Qn=function(w){const U=Q?Q(w):null;return typeof U!="string"||Be(U)!=="form"?!1:typeof w.nodeName!="string"||typeof w.textContent!="string"||typeof w.removeChild!="function"||w.attributes!==$(w)||typeof w.removeAttribute!="function"||typeof w.setAttribute!="function"||typeof w.namespaceURI!="string"||typeof w.insertBefore!="function"||typeof w.hasChildNodes!="function"||w.nodeType!==A(w)||w.childNodes!==B(w)},bl=function(w){if(!A||typeof w!="object"||w===null)return!1;try{return A(w)===Nl.documentFragment}catch{return!1}},mn=function(w){if(!A||typeof w!="object"||w===null)return!1;try{return typeof A(w)=="number"}catch{return!1}};function _t(ue,w,U){ue.length!==0&&ur(ue,se=>{se.call(l,w,U,pn)})}const es=function(w,U){return!!(ut&&w.hasChildNodes()&&!mn(w.firstElementChild)&&jn(ky,w.textContent)&&jn(ky,w.innerHTML)||ut&&w.namespaceURI===hn&&U==="style"&&mn(w.firstElementChild)||w.nodeType===Nl.processingInstruction||ut&&w.nodeType===Nl.comment&&jn(wy,w.data))},Ei=function(w,U){if(!dt[U]&&Ta(U)&&(Fe.tagNameCheck instanceof RegExp&&jn(Fe.tagNameCheck,U)||Fe.tagNameCheck instanceof Function&&Fe.tagNameCheck(U)))return!1;if(pt&&!I[U]){const se=K(w),Se=B(w);if(Se&&se){const Ce=Se.length;for(let De=Ce-1;De>=0;--De){const jt=_n?Se[De]:C(Se[De],!0);se.insertBefore(jt,H(w))}}}return tn(w),!0},Xl=function(w,U){if(_t(j.beforeSanitizeElements,w,null),w!==U&&K(w)===null)return!0;if(Qn(w))return tn(w),!0;const se=Be(Q?Q(w):w.nodeName);if(_t(j.uponSanitizeElement,w,{tagName:se,allowedTags:He}),w!==U&&K(w)===null)return!0;if(es(w,se))return tn(w),!0;if(dt[se]||!(Bt.tagCheck instanceof Function&&Bt.tagCheck(se))&&!He[se]){const Ce=Ei(w,se);return Ce===!1&&_t(j.afterSanitizeElements,w,null),Ce}if((A?A(w):w.nodeType)===Nl.element&&!ml(w)||(se==="noscript"||se==="noembed"||se==="noframes")&&jn(vv,w.innerHTML))return tn(w),!0;if(Zt&&w.nodeType===Nl.text){const Ce=aa(w.textContent);w.textContent!==Ce&&(or(l.removed,{element:w.cloneNode()}),w.textContent=Ce)}return _t(j.afterSanitizeElements,w,null),!1},El=function(w,U,se){if(Wn[U]||ut&&U==="patchsrc"||ut&&U==="for"&&w!=="label"&&w!=="output"||en&&(U==="id"||U==="name")&&(se in i||se in ta))return!1;const Se=Je[U]||Bt.attributeCheck instanceof Function&&Bt.attributeCheck(U,w);if(!(bn&&jn(ve,U))){if(!(Tn&&jn(Te,U))){if(Se){if(!An[U]){if(!jn(st,wc(se,it,""))){if(!((U==="src"||U==="xlink:href"||U==="href")&&w!=="script"&&my(se,"data:")===0&&Me[w])){if(!(fn&&!jn(Re,wc(se,it,"")))){if(se)return!1}}}}}else if(!(Ta(w)&&(Fe.tagNameCheck instanceof RegExp&&jn(Fe.tagNameCheck,w)||Fe.tagNameCheck instanceof Function&&Fe.tagNameCheck(w))&&(Fe.attributeNameCheck instanceof RegExp&&jn(Fe.attributeNameCheck,U)||Fe.attributeNameCheck instanceof Function&&Fe.attributeNameCheck(U,w))||U==="is"&&Fe.allowCustomizedBuiltInElements&&(Fe.tagNameCheck instanceof RegExp&&jn(Fe.tagNameCheck,se)||Fe.tagNameCheck instanceof Function&&Fe.tagNameCheck(se))))return!1}}return!0},sa=lt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ta=function(w){return!sa[Cc(w)]&&jn(Ze,w)},nn=function(w,U,se,Se){if(L&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!se)switch(k.getAttributeType(w,U)){case"TrustedHTML":return ae(Se);case"TrustedScriptURL":return me(Se)}return Se},Xs=function(w,U,se,Se){try{se?w.setAttributeNS(se,U,Se):w.setAttribute(U,Se),Qn(w)?tn(w):hy(l.removed)}catch{Xn(U,w)}},ia=function(w){_t(j.beforeSanitizeAttributes,w,null);const U=w.attributes;if(!U||Qn(w))return;const se={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Je,forceKeepAttr:void 0};let Se=U.length;const Ce=Be(w.nodeName);for(;Se--;){const De=U[Se],jt=De.name,Qt=De.namespaceURI,gn=De.value,gt=Be(jt),Mt=gn;let It=jt==="value"?Mt:lv(Mt);if(se.attrName=gt,se.attrValue=It,se.keepAttr=!0,se.forceKeepAttr=void 0,_t(j.uponSanitizeAttribute,w,se),It=se.attrValue,qt&&(gt==="id"||gt==="name")&&my(It,En)!==0&&(Xn(jt,w),It=En+It),ut&&jn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,It)){Xn(jt,w);continue}if(gt==="attributename"&&py(It,"href")){Xn(jt,w);continue}if(!se.forceKeepAttr){if(!se.keepAttr){Xn(jt,w);continue}if(!Un&&jn(Sv,It)){Xn(jt,w);continue}if(Zt&&(It=aa(It)),!El(Ce,gt,It)){Xn(jt,w);continue}It=nn(Ce,gt,Qt,It),It!==Mt&&Xs(w,jt,Qt,It)}}_t(j.afterSanitizeAttributes,w,null)},xl=function(w){let U=null;const se=la(w);for(_t(j.beforeSanitizeShadowDOM,w,null);U=se.nextNode();)if(_t(j.uponSanitizeShadowNode,U,null),Xl(U,w),ia(U),bl(U.content)&&xl(U.content),(A?A(U):U.nodeType)===Nl.element){const Ce=O(U);bl(Ce)&&(Pn(Ce),xl(Ce))}_t(j.afterSanitizeShadowDOM,w,null)},Pn=function(w){const U=[{node:w,shadow:null}];for(;U.length>0;){const se=U.pop();if(se.shadow){xl(se.shadow);continue}const Se=se.node,De=(A?A(Se):Se.nodeType)===Nl.element,jt=B(Se);if(jt)for(let Qt=jt.length-1;Qt>=0;--Qt)U.push({node:jt[Qt],shadow:null});if(De){const Qt=Q?Q(Se):null;if(typeof Qt=="string"&&Be(Qt)==="template"){const gn=Se.content;bl(gn)&&U.push({node:gn,shadow:null})}}if(De){const Qt=O(Se);bl(Qt)&&U.push({node:null,shadow:Qt},{node:Qt,shadow:null})}}};return l.sanitize=function(ue){let w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},U=null,se=null,Se=null,Ce=null;if(Tl=!ue,Tl&&(ue="<!-->"),typeof ue!="string"&&!mn(ue)&&(ue=cv(ue),typeof ue!="string"))throw di("dirty is not a string, aborting");if(!l.isSupported)return ue;J?(He=fe,Je=Ee):dl(w),(j.uponSanitizeElement.length>0||j.uponSanitizeAttribute.length>0)&&(He=Fn(He)),j.uponSanitizeAttribute.length>0&&(Je=Fn(Je)),l.removed=[];const De=_n&&typeof ue!="string"&&mn(ue);if(De){gl(ue);const gt=Q?Q(ue):ue.nodeName;if(typeof gt=="string"){const Mt=Be(gt);if(!He[Mt]||dt[Mt])throw mt(ue),di("root node is forbidden and cannot be sanitized in-place")}if(Qn(ue))throw mt(ue),di("root node is clobbered and cannot be sanitized in-place");try{Pn(ue)}catch(Mt){throw mt(ue),Mt}}else if(mn(ue))U=Is("<!---->"),se=U.ownerDocument.importNode(ue,!0),se.nodeType===Nl.element&&se.nodeName==="BODY"||se.nodeName==="HTML"?U=se:U.appendChild(se),Pn(se);else{if(!Tt&&!Zt&&!dn&&ue.indexOf("<")===-1)return L&&xn?ae(ue):ue;if(U=Is(ue),!U)return Tt?null:xn?M:""}U&&Qe&&tn(U.firstChild);const jt=De?ue:U,Qt=la(jt);try{for(;Se=Qt.nextNode();)Xl(Se,jt),ia(Se),bl(Se.content)&&xl(Se.content)}catch(gt){throw De&&(mt(ue),ur(l.removed,Mt=>{Mt.element&&Vn(Mt.element)})),gt}if(De)return ur(l.removed,gt=>{gt.element&&Vn(gt.element)}),Zt&&yl(ue),ue;if(Tt){if(Zt&&yl(U),Et)for(Ce=te.call(U.ownerDocument);U.firstChild;)Ce.appendChild(U.firstChild);else Ce=U;return(Je.shadowroot||Je.shadowrootmode)&&(Ce=we.call(r,Ce,!0)),Ce}let gn=dn?U.outerHTML:U.innerHTML;return dn&&He["!doctype"]&&U.ownerDocument&&U.ownerDocument.doctype&&U.ownerDocument.doctype.name&&jn(xv,U.ownerDocument.doctype.name)&&(gn="<!DOCTYPE "+U.ownerDocument.doctype.name+`>
115
115
  `+gn),Zt&&(gn=aa(gn)),L&&xn?ae(gn):gn},l.setConfig=function(){let ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};dl(ue),J=!0,fe=He,Ee=Je},l.clearConfig=function(){pn=null,J=!1,fe=null,Ee=null,L=W,M=""},l.isValidAttribute=function(ue,w,U){pn||dl({});const se=Be(ue),Se=Be(w);return El(se,Se,U)},l.addHook=function(ue,w){typeof w=="function"&&Nn(j,ue)&&or(j[ue],w)},l.removeHook=function(ue,w){if(Nn(j,ue)){if(w!==void 0){const U=tv(j[ue],w);return U===-1?void 0:nv(j[ue],U,1)[0]}return hy(j[ue])}},l.removeHooks=function(ue){Nn(j,ue)&&(j[ue]=[])},l.removeAllHooks=function(){j=jy()},l}var jv=zb();const Nv=1024;let Tv=0;class ql{constructor(l,i){this.from=l,this.to=i}}class Ht{constructor(l={}){this.id=Tv++,this.perNode=!!l.perNode,this.deserialize=l.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=l.combine||null}add(l){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof l!="function"&&(l=ea.match(l)),i=>{let r=l(i);return r===void 0?null:[this,r]}}}Ht.closedBy=new Ht({deserialize:s=>s.split(" ")});Ht.openedBy=new Ht({deserialize:s=>s.split(" ")});Ht.group=new Ht({deserialize:s=>s.split(" ")});Ht.isolate=new Ht({deserialize:s=>{if(s&&s!="rtl"&&s!="ltr"&&s!="auto")throw new RangeError("Invalid value for isolate: "+s);return s||"auto"}});Ht.contextHash=new Ht({perNode:!0});Ht.lookAhead=new Ht({perNode:!0});Ht.mounted=new Ht({perNode:!0});class mr{constructor(l,i,r,o=!1){this.tree=l,this.overlay=i,this.parser=r,this.bracketed=o}static get(l){return l&&l.props&&l.props[Ht.mounted.id]}}const Ev=Object.create(null);class ea{constructor(l,i,r,o=0){this.name=l,this.props=i,this.id=r,this.flags=o}static define(l){let i=l.props&&l.props.length?Object.create(null):Ev,r=(l.top?1:0)|(l.skipped?2:0)|(l.error?4:0)|(l.name==null?8:0),o=new ea(l.name||"",i,l.id,r);if(l.props){for(let d of l.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");i[d[0].id]=d[1]}}return o}prop(l){return this.props[l.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(l){if(typeof l=="string"){if(this.name==l)return!0;let i=this.prop(Ht.group);return i?i.indexOf(l)>-1:!1}return this.id==l}static match(l){let i=Object.create(null);for(let r in l)for(let o of r.split(" "))i[o]=l[r];return r=>{for(let o=r.prop(Ht.group),d=-1;d<(o?o.length:0);d++){let h=i[d<0?r.name:o[d]];if(h)return h}}}}ea.none=new ea("",Object.create(null),0,8);class Lb{constructor(l){this.types=l;for(let i=0;i<l.length;i++)if(l[i].id!=i)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...l){let i=[];for(let r of this.types){let o=null;for(let d of l){let h=d(r);if(h){o||(o=Object.assign({},r.props));let g=h[1],m=h[0];m.combine&&m.id in o&&(g=m.combine(o[m.id],g)),o[m.id]=g}}i.push(o?new ea(r.name,o,r.id,r.flags):r)}return new Lb(i)}}const ro=new WeakMap,Ny=new WeakMap;var Lt;(function(s){s[s.ExcludeBuffers=1]="ExcludeBuffers",s[s.IncludeAnonymous=2]="IncludeAnonymous",s[s.IgnoreMounts=4]="IgnoreMounts",s[s.IgnoreOverlays=8]="IgnoreOverlays",s[s.EnterBracketed=16]="EnterBracketed"})(Lt||(Lt={}));class ol{constructor(l,i,r,o,d){if(this.type=l,this.children=i,this.positions=r,this.length=o,this.props=null,d&&d.length){this.props=Object.create(null);for(let[h,g]of d)this.props[typeof h=="number"?h:h.id]=g}}toString(){let l=mr.get(this);if(l&&!l.overlay)return l.tree.toString();let i="";for(let r of this.children){let o=r.toString();o&&(i&&(i+=","),i+=o)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(i.length?"("+i+")":""):i}cursor(l=0){return new No(this.topNode,l)}cursorAt(l,i=0,r=0){let o=ro.get(this)||this.topNode,d=new No(o);return d.moveTo(l,i),ro.set(this,d._tree),d}get topNode(){return new Gn(this,0,0,null)}resolve(l,i=0){let r=Rc(ro.get(this)||this.topNode,l,i,!1);return ro.set(this,r),r}resolveInner(l,i=0){let r=Rc(Ny.get(this)||this.topNode,l,i,!0);return Ny.set(this,r),r}resolveStack(l,i=0){return Rv(this,l,i)}iterate(l){let{enter:i,leave:r,from:o=0,to:d=this.length}=l,h=l.mode||0,g=(h&Lt.IncludeAnonymous)>0;for(let m=this.cursor(h|Lt.IncludeAnonymous);;){let b=!1;if(m.from<=d&&m.to>=o&&(!g&&m.type.isAnonymous||i(m)!==!1)){if(m.firstChild())continue;b=!0}for(;b&&r&&(g||!m.type.isAnonymous)&&r(m),!m.nextSibling();){if(!m.parent())return;b=!0}}}prop(l){return l.perNode?this.props?this.props[l.id]:void 0:this.type.prop(l)}get propValues(){let l=[];if(this.props)for(let i in this.props)l.push([+i,this.props[i]]);return l}balance(l={}){return this.children.length<=8?this:Lh(ea.none,this.children,this.positions,0,this.children.length,0,this.length,(i,r,o)=>new ol(this.type,i,r,o,this.propValues),l.makeTree||((i,r,o)=>new ol(ea.none,i,r,o)))}static build(l){return Mv(l)}}ol.empty=new ol(ea.none,[],[],0);class Dh{constructor(l,i){this.buffer=l,this.index=i}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Dh(this.buffer,this.index)}}class Gs{constructor(l,i,r){this.buffer=l,this.length=i,this.set=r}get type(){return ea.none}toString(){let l=[];for(let i=0;i<this.buffer.length;)l.push(this.childString(i)),i=this.buffer[i+3];return l.join(",")}childString(l){let i=this.buffer[l],r=this.buffer[l+3],o=this.set.types[i],d=o.name;if(/\W/.test(d)&&!o.isError&&(d=JSON.stringify(d)),l+=4,r==l)return d;let h=[];for(;l<r;)h.push(this.childString(l)),l=this.buffer[l+3];return d+"("+h.join(",")+")"}findChild(l,i,r,o,d){let{buffer:h}=this,g=-1;for(let m=l;m!=i&&!(Ub(d,o,h[m+1],h[m+2])&&(g=m,r>0));m=h[m+3]);return g}slice(l,i,r){let o=this.buffer,d=new Uint16Array(i-l),h=0;for(let g=l,m=0;g<i;){d[m++]=o[g++],d[m++]=o[g++]-r;let b=d[m++]=o[g++]-r;d[m++]=o[g++]-l,h=Math.max(h,b)}return new Gs(d,h,this.set)}}function Ub(s,l,i,r){switch(s){case-2:return i<l;case-1:return r>=l&&i<l;case 0:return i<l&&r>l;case 1:return i<=l&&r>l;case 2:return r>l;case 4:return!0}}function Rc(s,l,i,r){for(var o;s.from==s.to||(i<1?s.from>=l:s.from>l)||(i>-1?s.to<=l:s.to<l);){let h=!r&&s instanceof Gn&&s.index<0?null:s.parent;if(!h)return s;s=h}let d=r?0:Lt.IgnoreOverlays;if(r)for(let h=s,g=h.parent;g;h=g,g=h.parent)h instanceof Gn&&h.index<0&&((o=g.enter(l,i,d))===null||o===void 0?void 0:o.from)!=h.from&&(s=g);for(;;){let h=s.enter(l,i,d);if(!h)return s;s=h}}class Hb{cursor(l=0){return new No(this,l)}getChild(l,i=null,r=null){let o=Ty(this,l,i,r);return o.length?o[0]:null}getChildren(l,i=null,r=null){return Ty(this,l,i,r)}resolve(l,i=0){return Rc(this,l,i,!1)}resolveInner(l,i=0){return Rc(this,l,i,!0)}matchContext(l){return bh(this.parent,l)}enterUnfinishedNodesBefore(l){let i=this.childBefore(l),r=this;for(;i;){let o=i.lastChild;if(!o||o.to!=i.to)break;o.type.isError&&o.from==o.to?(r=i,i=o.prevSibling):i=o}return r}get node(){return this}get next(){return this.parent}}class Gn extends Hb{constructor(l,i,r,o){super(),this._tree=l,this.from=i,this.index=r,this._parent=o}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(l,i,r,o,d=0){for(let h=this;;){for(let{children:g,positions:m}=h._tree,b=i>0?g.length:-1;l!=b;l+=i){let x=g[l],k=m[l]+h.from,_;if(!(!(d&Lt.EnterBracketed&&x instanceof ol&&(_=mr.get(x))&&!_.overlay&&_.bracketed&&r>=k&&r<=k+x.length)&&!Ub(o,r,k,k+x.length))){if(x instanceof Gs){if(d&Lt.ExcludeBuffers)continue;let C=x.findChild(0,x.buffer.length,i,r-k,o);if(C>-1)return new Sa(new Av(h,x,l,k),null,C)}else if(d&Lt.IncludeAnonymous||!x.type.isAnonymous||zh(x)){let C;if(!(d&Lt.IgnoreMounts)&&(C=mr.get(x))&&!C.overlay)return new Gn(C.tree,k,l,h);let N=new Gn(x,k,l,h);return d&Lt.IncludeAnonymous||!N.type.isAnonymous?N:N.nextChild(i<0?x.children.length-1:0,i,r,o,d)}}}if(d&Lt.IncludeAnonymous||!h.type.isAnonymous||(h.index>=0?l=h.index+i:l=i<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(l){return this.nextChild(0,1,l,2)}childBefore(l){return this.nextChild(this._tree.children.length-1,-1,l,-2)}prop(l){return this._tree.prop(l)}enter(l,i,r=0){let o;if(!(r&Lt.IgnoreOverlays)&&(o=mr.get(this._tree))&&o.overlay){let d=l-this.from,h=r&Lt.EnterBracketed&&o.bracketed;for(let{from:g,to:m}of o.overlay)if((i>0||h?g<=d:g<d)&&(i<0||h?m>=d:m>d))return new Gn(o.tree,o.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,l,i,r)}nextSignificantParent(){let l=this;for(;l.type.isAnonymous&&l._parent;)l=l._parent;return l}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Ty(s,l,i,r){let o=s.cursor(),d=[];if(!o.firstChild())return d;if(i!=null){for(let h=!1;!h;)if(h=o.type.is(i),!o.nextSibling())return d}for(;;){if(r!=null&&o.type.is(r))return d;if(o.type.is(l)&&d.push(o.node),!o.nextSibling())return r==null?d:[]}}function bh(s,l,i=l.length-1){for(let r=s;i>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(l[i]&&l[i]!=r.name)return!1;i--}}return!0}class Av{constructor(l,i,r,o){this.parent=l,this.buffer=i,this.index=r,this.start=o}}class Sa extends Hb{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(l,i,r){super(),this.context=l,this._parent=i,this.index=r,this.type=l.buffer.set.types[l.buffer.buffer[r]]}child(l,i,r){let{buffer:o}=this.context,d=o.findChild(this.index+4,o.buffer[this.index+3],l,i-this.context.start,r);return d<0?null:new Sa(this.context,this,d)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(l){return this.child(1,l,2)}childBefore(l){return this.child(-1,l,-2)}prop(l){return this.type.prop(l)}enter(l,i,r=0){if(r&Lt.ExcludeBuffers)return null;let{buffer:o}=this.context,d=o.findChild(this.index+4,o.buffer[this.index+3],i>0?1:-1,l-this.context.start,i);return d<0?null:new Sa(this.context,this,d)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(l){return this._parent?null:this.context.parent.nextChild(this.context.index+l,l,0,4)}get nextSibling(){let{buffer:l}=this.context,i=l.buffer[this.index+3];return i<(this._parent?l.buffer[this._parent.index+3]:l.buffer.length)?new Sa(this.context,this._parent,i):this.externalSibling(1)}get prevSibling(){let{buffer:l}=this.context,i=this._parent?this._parent.index+4:0;return this.index==i?this.externalSibling(-1):new Sa(this.context,this._parent,l.findChild(i,this.index,-1,0,4))}get tree(){return null}toTree(){let l=[],i=[],{buffer:r}=this.context,o=this.index+4,d=r.buffer[this.index+3];if(d>o){let h=r.buffer[this.index+1];l.push(r.slice(o,d,h)),i.push(0)}return new ol(this.type,l,i,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Bb(s){if(!s.length)return null;let l=0,i=s[0];for(let d=1;d<s.length;d++){let h=s[d];(h.from>i.from||h.to<i.to)&&(i=h,l=d)}let r=i instanceof Gn&&i.index<0?null:i.parent,o=s.slice();return r?o[l]=r:o.splice(l,1),new Cv(o,i)}class Cv{constructor(l,i){this.heads=l,this.node=i}get next(){return Bb(this.heads)}}function Rv(s,l,i){let r=s.resolveInner(l,i),o=null;for(let d=r instanceof Gn?r:r.context.parent;d;d=d.parent)if(d.index<0){let h=d.parent;(o||(o=[r])).push(h.resolve(l,i)),d=h}else{let h=mr.get(d.tree);if(h&&h.overlay&&h.overlay[0].from<=l&&h.overlay[h.overlay.length-1].to>=l){let g=new Gn(h.tree,h.overlay[0].from+d.from,-1,d);(o||(o=[r])).push(Rc(g,l,i,!1))}}return o?Bb(o):r}class No{get name(){return this.type.name}constructor(l,i=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=i&~Lt.EnterBracketed,l instanceof Gn)this.yieldNode(l);else{this._tree=l.context.parent,this.buffer=l.context;for(let r=l._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=l,this.yieldBuf(l.index)}}yieldNode(l){return l?(this._tree=l,this.type=l.type,this.from=l.from,this.to=l.to,!0):!1}yieldBuf(l,i){this.index=l;let{start:r,buffer:o}=this.buffer;return this.type=i||o.set.types[o.buffer[l]],this.from=r+o.buffer[l+1],this.to=r+o.buffer[l+2],!0}yield(l){return l?l instanceof Gn?(this.buffer=null,this.yieldNode(l)):(this.buffer=l.context,this.yieldBuf(l.index,l.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(l,i,r){if(!this.buffer)return this.yield(this._tree.nextChild(l<0?this._tree._tree.children.length-1:0,l,i,r,this.mode));let{buffer:o}=this.buffer,d=o.findChild(this.index+4,o.buffer[this.index+3],l,i-this.buffer.start,r);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(l){return this.enterChild(1,l,2)}childBefore(l){return this.enterChild(-1,l,-2)}enter(l,i,r=this.mode){return this.buffer?r&Lt.ExcludeBuffers?!1:this.enterChild(1,l,i):this.yield(this._tree.enter(l,i,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Lt.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let l=this.mode&Lt.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(l)}sibling(l){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+l,l,0,4,this.mode)):!1;let{buffer:i}=this.buffer,r=this.stack.length-1;if(l<0){let o=r<0?0:this.stack[r]+4;if(this.index!=o)return this.yieldBuf(i.findChild(o,this.index,-1,0,4))}else{let o=i.buffer[this.index+3];if(o<(r<0?i.buffer.length:i.buffer[this.stack[r]+3]))return this.yieldBuf(o)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+l,l,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(l){let i,r,{buffer:o}=this;if(o){if(l>0){if(this.index<o.buffer.buffer.length)return!1}else for(let d=0;d<this.index;d++)if(o.buffer.buffer[d+3]<this.index)return!1;({index:i,parent:r}=o)}else({index:i,_parent:r}=this._tree);for(;r;{index:i,_parent:r}=r)if(i>-1)for(let d=i+l,h=l<0?-1:r._tree.children.length;d!=h;d+=l){let g=r._tree.children[d];if(this.mode&Lt.IncludeAnonymous||g instanceof Gs||!g.type.isAnonymous||zh(g))return!1}return!0}move(l,i){if(i&&this.enterChild(l,0,4))return!0;for(;;){if(this.sibling(l))return!0;if(this.atLastNode(l)||!this.parent())return!1}}next(l=!0){return this.move(1,l)}prev(l=!0){return this.move(-1,l)}moveTo(l,i=0){for(;(this.from==this.to||(i<1?this.from>=l:this.from>l)||(i>-1?this.to<=l:this.to<l))&&this.parent(););for(;this.enterChild(1,l,i););return this}get node(){if(!this.buffer)return this._tree;let l=this.bufferNode,i=null,r=0;if(l&&l.context==this.buffer)e:for(let o=this.index,d=this.stack.length;d>=0;){for(let h=l;h;h=h._parent)if(h.index==o){if(o==this.index)return h;i=h,r=d+1;break e}o=this.stack[--d]}for(let o=r;o<this.stack.length;o++)i=new Sa(this.buffer,i,this.stack[o]);return this.bufferNode=new Sa(this.buffer,i,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(l,i){for(let r=0;;){let o=!1;if(this.type.isAnonymous||l(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(o=!0)}for(;;){if(o&&i&&i(this),o=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,o=!0}}}matchContext(l){if(!this.buffer)return bh(this.node.parent,l);let{buffer:i}=this.buffer,{types:r}=i.set;for(let o=l.length-1,d=this.stack.length-1;o>=0;d--){if(d<0)return bh(this._tree,l,o);let h=r[i.buffer[this.stack[d]]];if(!h.isAnonymous){if(l[o]&&l[o]!=h.name)return!1;o--}}return!0}}function zh(s){return s.children.some(l=>l instanceof Gs||!l.type.isAnonymous||zh(l))}function Mv(s){var l;let{buffer:i,nodeSet:r,maxBufferLength:o=Nv,reused:d=[],minRepeatType:h=r.types.length}=s,g=Array.isArray(i)?new Dh(i,i.length):i,m=r.types,b=0,x=0;function k(Q,L,M,W,re,he){let{id:F,start:ae,end:me,size:Ne}=g,pe=x,z=b;if(Ne<0)if(g.next(),Ne==-1){let j=d[F];M.push(j),W.push(ae-Q);return}else if(Ne==-3){b=F;return}else if(Ne==-4){x=F;return}else throw new RangeError(`Unrecognized record size: ${Ne}`);let P=m[F],te,xe,we=ae-Q;if(me-ae<=o&&(xe=B(g.pos-L,re))){let j=new Uint16Array(xe.size-xe.skip),V=g.pos-xe.size,ce=j.length;for(;g.pos>V;)ce=K(xe.start,j,ce);te=new Gs(j,me-xe.start,r),we=xe.start-Q}else{let j=g.pos-Ne;g.next();let V=[],ce=[],oe=F>=h?F:-1,ve=0,Te=me;for(;g.pos>j;)oe>=0&&g.id==oe&&g.size>=0?(g.end<=Te-o&&(N(V,ce,ae,ve,g.end,Te,oe,pe,z),ve=V.length,Te=g.end),g.next()):he>2500?_(ae,j,V,ce):k(ae,j,V,ce,oe,he+1);if(oe>=0&&ve>0&&ve<V.length&&N(V,ce,ae,ve,ae,Te,oe,pe,z),V.reverse(),ce.reverse(),oe>-1&&ve>0){let Re=C(P,z);te=Lh(P,V,ce,0,V.length,0,me-ae,Re,Re)}else te=H(P,V,ce,me-ae,pe-me,z)}M.push(te),W.push(we)}function _(Q,L,M,W){let re=[],he=0,F=-1;for(;g.pos>L;){let{id:ae,start:me,end:Ne,size:pe}=g;if(pe>4)g.next();else{if(F>-1&&me<F)break;F<0&&(F=Ne-o),re.push(ae,me,Ne),he++,g.next()}}if(he){let ae=new Uint16Array(he*4),me=re[re.length-2];for(let Ne=re.length-3,pe=0;Ne>=0;Ne-=3)ae[pe++]=re[Ne],ae[pe++]=re[Ne+1]-me,ae[pe++]=re[Ne+2]-me,ae[pe++]=pe;M.push(new Gs(ae,re[2]-me,r)),W.push(me-Q)}}function C(Q,L){return(M,W,re)=>{let he=0,F=M.length-1,ae,me;if(F>=0&&(ae=M[F])instanceof ol){if(!F&&ae.type==Q&&ae.length==re)return ae;(me=ae.prop(Ht.lookAhead))&&(he=W[F]+ae.length+me)}return H(Q,M,W,re,he,L)}}function N(Q,L,M,W,re,he,F,ae,me){let Ne=[],pe=[];for(;Q.length>W;)Ne.push(Q.pop()),pe.push(L.pop()+M-re);Q.push(H(r.types[F],Ne,pe,he-re,ae-he,me)),L.push(re-M)}function H(Q,L,M,W,re,he,F){if(he){let ae=[Ht.contextHash,he];F=F?[ae].concat(F):[ae]}if(re>25){let ae=[Ht.lookAhead,re];F=F?[ae].concat(F):[ae]}return new ol(Q,L,M,W,F)}function B(Q,L){let M=g.fork(),W=0,re=0,he=0,F=M.end-o,ae={size:0,start:0,skip:0};e:for(let me=M.pos-Q;M.pos>me;){let Ne=M.size;if(M.id==L&&Ne>=0){ae.size=W,ae.start=re,ae.skip=he,he+=4,W+=4,M.next();continue}let pe=M.pos-Ne;if(Ne<0||pe<me||M.start<F)break;let z=M.id>=h?4:0,P=M.start;for(M.next();M.pos>pe;){if(M.size<0)if(M.size==-3||M.size==-4)z+=4;else break e;else M.id>=h&&(z+=4);M.next()}re=P,W+=Ne,he+=z}return(L<0||W==Q)&&(ae.size=W,ae.start=re,ae.skip=he),ae.size>4?ae:void 0}function K(Q,L,M){let{id:W,start:re,end:he,size:F}=g;if(g.next(),F>=0&&W<h){let ae=M;if(F>4){let me=g.pos-(F-4);for(;g.pos>me;)M=K(Q,L,M)}L[--M]=ae,L[--M]=he-Q,L[--M]=re-Q,L[--M]=W}else F==-3?b=W:F==-4&&(x=W);return M}let O=[],$=[];for(;g.pos>0;)k(s.start||0,s.bufferStart||0,O,$,-1,0);let A=(l=s.length)!==null&&l!==void 0?l:O.length?$[0]+O[0].length:0;return new ol(m[s.topID],O.reverse(),$.reverse(),A)}const Ey=new WeakMap;function vo(s,l){if(!s.isAnonymous||l instanceof Gs||l.type!=s)return 1;let i=Ey.get(l);if(i==null){i=1;for(let r of l.children){if(r.type!=s||!(r instanceof ol)){i=1;break}i+=vo(s,r)}Ey.set(l,i)}return i}function Lh(s,l,i,r,o,d,h,g,m){let b=0;for(let N=r;N<o;N++)b+=vo(s,l[N]);let x=Math.ceil(b*1.5/8),k=[],_=[];function C(N,H,B,K,O){for(let $=B;$<K;){let A=$,Q=H[$],L=vo(s,N[$]);for($++;$<K;$++){let M=vo(s,N[$]);if(L+M>=x)break;L+=M}if($==A+1){if(L>x){let M=N[A];C(M.children,M.positions,0,M.children.length,H[A]+O);continue}k.push(N[A])}else{let M=H[$-1]+N[$-1].length-Q;k.push(Lh(s,N,H,A,$,Q,M,null,m))}_.push(Q+O-d)}}return C(l,i,r,o,0),(g||m)(k,_,h)}class fw{constructor(){this.map=new WeakMap}setBuffer(l,i,r){let o=this.map.get(l);o||this.map.set(l,o=new Map),o.set(i,r)}getBuffer(l,i){let r=this.map.get(l);return r&&r.get(i)}set(l,i){l instanceof Sa?this.setBuffer(l.context.buffer,l.index,i):l instanceof Gn&&this.map.set(l.tree,i)}get(l){return l instanceof Sa?this.getBuffer(l.context.buffer,l.index):l instanceof Gn?this.map.get(l.tree):void 0}cursorSet(l,i){l.buffer?this.setBuffer(l.buffer.buffer,l.index,i):this.map.set(l.tree,i)}cursorGet(l){return l.buffer?this.getBuffer(l.buffer.buffer,l.index):this.map.get(l.tree)}}class Mc{constructor(l,i,r,o,d=!1,h=!1){this.from=l,this.to=i,this.tree=r,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(l,i=[],r=!1){let o=[new Mc(0,l.length,l,0,!1,r)];for(let d of i)d.to>l.length&&o.push(d);return o}static applyChanges(l,i,r=128){if(!i.length)return l;let o=[],d=1,h=l.length?l[0]:null;for(let g=0,m=0,b=0;;g++){let x=g<i.length?i[g]:null,k=x?x.fromA:1e9;if(k-m>=r)for(;h&&h.from<k;){let _=h;if(m>=_.from||k<=_.to||b){let C=Math.max(_.from,m)-b,N=Math.min(_.to,k)-b;_=C>=N?null:new Mc(C,N,_.tree,_.offset+b,g>0,!!x)}if(_&&o.push(_),h.to>k)break;h=d<l.length?l[d++]:null}if(!x)break;m=x.toA,b=x.toA-x.toB}return o}}class dw{startParse(l,i,r){return typeof l=="string"&&(l=new Ov(l)),r=r?r.length?r.map(o=>new ql(o.from,o.to)):[new ql(0,0)]:[new ql(0,l.length)],this.createParse(l,i||[],r)}parse(l,i,r){let o=this.startParse(l,i,r);for(;;){let d=o.advance();if(d)return d}}}class Ov{constructor(l){this.string=l}get length(){return this.string.length}chunk(l){return this.string.slice(l)}get lineChunks(){return!1}read(l,i){return this.string.slice(l,i)}}function hw(s){return(l,i,r,o)=>new zv(l,s,i,r,o)}class Ay{constructor(l,i,r,o,d,h){this.parser=l,this.parse=i,this.overlay=r,this.bracketed=o,this.target=d,this.from=h}}function Cy(s){if(!s.length||s.some(l=>l.from>=l.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(s))}class Dv{constructor(l,i,r,o,d,h,g,m){this.parser=l,this.predicate=i,this.mounts=r,this.index=o,this.start=d,this.bracketed=h,this.target=g,this.prev=m,this.depth=0,this.ranges=[]}}const xh=new Ht({perNode:!0});class zv{constructor(l,i,r,o,d){this.nest=i,this.input=r,this.fragments=o,this.ranges=d,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=l}advance(){if(this.baseParse){let r=this.baseParse.advance();if(!r)return null;if(this.baseParse=null,this.baseTree=r,this.startInner(),this.stoppedAt!=null)for(let o of this.inner)o.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let r=this.baseTree;return this.stoppedAt!=null&&(r=new ol(r.type,r.children,r.positions,r.length,r.propValues.concat([[xh,this.stoppedAt]]))),r}let l=this.inner[this.innerDone],i=l.parse.advance();if(i){this.innerDone++;let r=Object.assign(Object.create(null),l.target.props);r[Ht.mounted.id]=new mr(i,l.overlay,l.parser,l.bracketed),l.target.props=r}return null}get parsedPos(){if(this.baseParse)return 0;let l=this.input.length;for(let i=this.innerDone;i<this.inner.length;i++)this.inner[i].from<l&&(l=Math.min(l,this.inner[i].parse.parsedPos));return l}stopAt(l){if(this.stoppedAt=l,this.baseParse)this.baseParse.stopAt(l);else for(let i=this.innerDone;i<this.inner.length;i++)this.inner[i].parse.stopAt(l)}startInner(){let l=new Hv(this.fragments),i=null,r=null,o=new No(new Gn(this.baseTree,this.ranges[0].from,0,null),Lt.IncludeAnonymous|Lt.IgnoreMounts);e:for(let d,h;;){let g=!0,m;if(this.stoppedAt!=null&&o.from>=this.stoppedAt)g=!1;else if(l.hasNode(o)){if(i){let b=i.mounts.find(x=>x.frag.from<=o.from&&x.frag.to>=o.to&&x.mount.overlay);if(b)for(let x of b.mount.overlay){let k=x.from+b.pos,_=x.to+b.pos;k>=o.from&&_<=o.to&&!i.ranges.some(C=>C.from<_&&C.to>k)&&i.ranges.push({from:k,to:_})}}g=!1}else if(r&&(h=Lv(r.ranges,o.from,o.to)))g=h!=2;else if(!o.type.isAnonymous&&(d=this.nest(o,this.input))&&(o.from<o.to||!d.overlay)){o.tree||(Uv(o),i&&i.depth++,r&&r.depth++);let b=l.findMounts(o.from,d.parser);if(typeof d.overlay=="function")i=new Dv(d.parser,d.overlay,b,this.inner.length,o.from,!!d.bracketed,o.tree,i);else{let x=Oy(this.ranges,d.overlay||(o.from<o.to?[new ql(o.from,o.to)]:[]));x.length&&Cy(x),(x.length||!d.overlay)&&this.inner.push(new Ay(d.parser,x.length?d.parser.startParse(this.input,Dy(b,x),x):d.parser.startParse(""),d.overlay?d.overlay.map(k=>new ql(k.from-o.from,k.to-o.from)):null,!!d.bracketed,o.tree,x.length?x[0].from:o.from)),d.overlay?x.length&&(r={ranges:x,depth:0,prev:r}):g=!1}}else if(i&&(m=i.predicate(o))&&(m===!0&&(m=new ql(o.from,o.to)),m.from<m.to)){let b=i.ranges.length-1;b>=0&&i.ranges[b].to==m.from?i.ranges[b]={from:i.ranges[b].from,to:m.to}:i.ranges.push(m)}if(g&&o.firstChild())i&&i.depth++,r&&r.depth++;else for(;!o.nextSibling();){if(!o.parent())break e;if(i&&!--i.depth){let b=Oy(this.ranges,i.ranges);b.length&&(Cy(b),this.inner.splice(i.index,0,new Ay(i.parser,i.parser.startParse(this.input,Dy(i.mounts,b),b),i.ranges.map(x=>new ql(x.from-i.start,x.to-i.start)),i.bracketed,i.target,b[0].from))),i=i.prev}r&&!--r.depth&&(r=r.prev)}}}}function Lv(s,l,i){for(let r of s){if(r.from>=i)break;if(r.to>l)return r.from<=l&&r.to>=i?2:1}return 0}function Ry(s,l,i,r,o,d){if(l<i){let h=s.buffer[l+1];r.push(s.slice(l,i,h)),o.push(h-d)}}function Uv(s){let{node:l}=s,i=[],r=l.context.buffer;do i.push(s.index),s.parent();while(!s.tree);let o=s.tree,d=o.children.indexOf(r),h=o.children[d],g=h.buffer,m=[d];function b(x,k,_,C,N,H){let B=i[H],K=[],O=[];Ry(h,x,B,K,O,C);let $=g[B+1],A=g[B+2];m.push(K.length);let Q=H?b(B+4,g[B+3],h.set.types[g[B]],$,A-$,H-1):l.toTree();return K.push(Q),O.push($-C),Ry(h,g[B+3],k,K,O,C),new ol(_,K,O,N)}o.children[d]=b(0,g.length,ea.none,0,h.length,i.length-1);for(let x of m){let k=s.tree.children[x],_=s.tree.positions[x];s.yield(new Gn(k,_+s.from,x,s._tree))}}class My{constructor(l,i){this.offset=i,this.done=!1,this.cursor=l.cursor(Lt.IncludeAnonymous|Lt.IgnoreMounts)}moveTo(l){let{cursor:i}=this,r=l-this.offset;for(;!this.done&&i.from<r;)if(!(i.to>=l&&i.enter(r,1,Lt.IgnoreOverlays|Lt.ExcludeBuffers)))if(i.to<=l)i.next(!1)||(this.done=!0);else break}hasNode(l){if(this.moveTo(l.from),!this.done&&this.cursor.from+this.offset==l.from&&this.cursor.tree)for(let i=this.cursor.tree;;){if(i==l.tree)return!0;if(i.children.length&&i.positions[0]==0&&i.children[0]instanceof ol)i=i.children[0];else break}return!1}}class Hv{constructor(l){var i;if(this.fragments=l,this.curTo=0,this.fragI=0,l.length){let r=this.curFrag=l[0];this.curTo=(i=r.tree.prop(xh))!==null&&i!==void 0?i:r.to,this.inner=new My(r.tree,-r.offset)}else this.curFrag=this.inner=null}hasNode(l){for(;this.curFrag&&l.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=l.from&&this.curTo>=l.to&&this.inner.hasNode(l)}nextFrag(){var l;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let i=this.curFrag=this.fragments[this.fragI];this.curTo=(l=i.tree.prop(xh))!==null&&l!==void 0?l:i.to,this.inner=new My(i.tree,-i.offset)}}findMounts(l,i){var r;let o=[];if(this.inner){this.inner.cursor.moveTo(l,1);for(let d=this.inner.cursor.node;d;d=d.parent){let h=(r=d.tree)===null||r===void 0?void 0:r.prop(Ht.mounted);if(h&&h.parser==i)for(let g=this.fragI;g<this.fragments.length;g++){let m=this.fragments[g];if(m.from>=d.to)break;m.tree==this.curFrag.tree&&o.push({frag:m,pos:d.from-m.offset,mount:h})}}}return o}}function Oy(s,l){let i=null,r=l;for(let o=1,d=0;o<s.length;o++){let h=s[o-1].to,g=s[o].from;for(;d<r.length;d++){let m=r[d];if(m.from>=g)break;m.to<=h||(i||(r=i=l.slice()),m.from<h?(i[d]=new ql(m.from,h),m.to>g&&i.splice(d+1,0,new ql(g,m.to))):m.to>g?i[d--]=new ql(g,m.to):i.splice(d--,1))}}return r}function Bv(s,l,i,r){let o=0,d=0,h=!1,g=!1,m=-1e9,b=[];for(;;){let x=o==s.length?1e9:h?s[o].to:s[o].from,k=d==l.length?1e9:g?l[d].to:l[d].from;if(h!=g){let _=Math.max(m,i),C=Math.min(x,k,r);_<C&&b.push(new ql(_,C))}if(m=Math.min(x,k),m==1e9)break;x==m&&(h?(h=!1,o++):h=!0),k==m&&(g?(g=!1,d++):g=!0)}return b}function Dy(s,l){let i=[];for(let{pos:r,mount:o,frag:d}of s){let h=r+(o.overlay?o.overlay[0].from:0),g=h+o.tree.length,m=Math.max(d.from,h),b=Math.min(d.to,g);if(o.overlay){let x=o.overlay.map(_=>new ql(_.from+r,_.to+r)),k=Bv(l,x,m,b);for(let _=0,C=m;;_++){let N=_==k.length,H=N?b:k[_].from;if(H>C&&i.push(new Mc(C,H,o.tree,-h,d.from>=C||d.openStart,d.to<=H||d.openEnd)),N)break;C=k[_].to}}else i.push(new Mc(m,b,o.tree,-h,d.from>=h||d.openStart,d.to<=g||d.openEnd))}return i}let qv=0;class Bl{constructor(l,i,r,o){this.name=l,this.set=i,this.base=r,this.modified=o,this.id=qv++}toString(){let{name:l}=this;for(let i of this.modified)i.name&&(l=`${i.name}(${l})`);return l}static define(l,i){let r=typeof l=="string"?l:"?";if(l instanceof Bl&&(i=l),i!=null&&i.base)throw new Error("Can not derive from a modified tag");let o=new Bl(r,[],null,[]);if(o.set.push(o),i)for(let d of i.set)o.set.push(d);return o}static defineModifier(l){let i=new To(l);return r=>r.modified.indexOf(i)>-1?r:To.get(r.base||r,r.modified.concat(i).sort((o,d)=>o.id-d.id))}}let Gv=0;class To{constructor(l){this.name=l,this.instances=[],this.id=Gv++}static get(l,i){if(!i.length)return l;let r=i[0].instances.find(g=>g.base==l&&Yv(i,g.modified));if(r)return r;let o=[],d=new Bl(l.name,o,l,i);for(let g of i)g.instances.push(d);let h=Iv(i);for(let g of l.set)if(!g.modified.length)for(let m of h)o.push(To.get(g,m));return d}}function Yv(s,l){return s.length==l.length&&s.every((i,r)=>i==l[r])}function Iv(s){let l=[[]];for(let i=0;i<s.length;i++)for(let r=0,o=l.length;r<o;r++)l.push(l[r].concat(s[i]));return l.sort((i,r)=>r.length-i.length)}function pw(s){let l=Object.create(null);for(let i in s){let r=s[i];Array.isArray(r)||(r=[r]);for(let o of i.split(" "))if(o){let d=[],h=2,g=o;for(let k=0;;){if(g=="..."&&k>0&&k+3==o.length){h=1;break}let _=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(g);if(!_)throw new RangeError("Invalid path: "+o);if(d.push(_[0]=="*"?"":_[0][0]=='"'?JSON.parse(_[0]):_[0]),k+=_[0].length,k==o.length)break;let C=o[k++];if(k==o.length&&C=="!"){h=0;break}if(C!="/")throw new RangeError("Invalid path: "+o);g=o.slice(k)}let m=d.length-1,b=d[m];if(!b)throw new RangeError("Invalid path: "+o);let x=new Oc(r,h,m>0?d.slice(0,m):null);l[b]=x.sort(l[b])}}return qb.add(l)}const qb=new Ht({combine(s,l){let i,r,o;for(;s||l;){if(!s||l&&s.depth>=l.depth?(o=l,l=l.next):(o=s,s=s.next),i&&i.mode==o.mode&&!o.context&&!i.context)continue;let d=new Oc(o.tags,o.mode,o.context);i?i.next=d:r=d,i=d}return r}});class Oc{constructor(l,i,r,o){this.tags=l,this.mode=i,this.context=r,this.next=o}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(l){return!l||l.depth<this.depth?(this.next=l,this):(l.next=this.sort(l.next),l)}get depth(){return this.context?this.context.length:0}}Oc.empty=new Oc([],2,null);function Gb(s,l){let i=Object.create(null);for(let d of s)if(!Array.isArray(d.tag))i[d.tag.id]=d.class;else for(let h of d.tag)i[h.id]=d.class;let{scope:r,all:o=null}=l||{};return{style:d=>{let h=o;for(let g of d)for(let m of g.set){let b=i[m.id];if(b){h=h?h+" "+b:b;break}}return h},scope:r}}function Xv(s,l){let i=null;for(let r of s){let o=r.style(l);o&&(i=i?i+" "+o:o)}return i}function Vv(s,l,i,r=0,o=s.length){let d=new $v(r,Array.isArray(l)?l:[l],i);d.highlightRange(s.cursor(),r,o,"",d.highlighters),d.flush(o)}function Qv(s,l,i,r,o,d=0,h=s.length){let g=d;function m(b,x){if(!(b<=g)){for(let k=s.slice(g,b),_=0;;){let C=k.indexOf(`
116
- `,_),N=C<0?k.length:C;if(N>_&&r(k.slice(_,N),x),C<0)break;o(),_=C+1}g=b}}Vv(l,i,(b,x,k)=>{m(b,""),m(x,k)},d,h),m(h,"")}class $v{constructor(l,i,r){this.at=l,this.highlighters=i,this.span=r,this.class=""}startSpan(l,i){i!=this.class&&(this.flush(l),l>this.at&&(this.at=l),this.class=i)}flush(l){l>this.at&&this.class&&this.span(this.at,l,this.class)}highlightRange(l,i,r,o,d){let{type:h,from:g,to:m}=l;if(g>=r||m<=i)return;h.isTop&&(d=this.highlighters.filter(C=>!C.scope||C.scope(h)));let b=o,x=Zv(l)||Oc.empty,k=Xv(d,x.tags);if(k&&(b&&(b+=" "),b+=k,x.mode==1&&(o+=(o?" ":"")+k)),this.startSpan(Math.max(i,g),b),x.opaque)return;let _=l.tree&&l.tree.prop(Ht.mounted);if(_&&_.overlay){let C=l.node.enter(_.overlay[0].from+g,1),N=this.highlighters.filter(B=>!B.scope||B.scope(_.tree.type)),H=l.firstChild();for(let B=0,K=g;;B++){let O=B<_.overlay.length?_.overlay[B]:null,$=O?O.from+g:m,A=Math.max(i,K),Q=Math.min(r,$);if(A<Q&&H)for(;l.from<Q&&(this.highlightRange(l,A,Q,o,d),this.startSpan(Math.min(Q,l.to),b),!(l.to>=$||!l.nextSibling())););if(!O||$>r)break;K=O.to+g,K>i&&(this.highlightRange(C.cursor(),Math.max(i,O.from+g),Math.min(r,K),"",N),this.startSpan(Math.min(r,K),b))}H&&l.parent()}else if(l.firstChild()){_&&(o="");do if(!(l.to<=i)){if(l.from>=r)break;this.highlightRange(l,i,r,o,d),this.startSpan(Math.min(r,l.to),b)}while(l.nextSibling());l.parent()}}}function Zv(s){let l=s.type.prop(qb);for(;l&&l.context&&!s.matchContext(l.context);)l=l.next;return l||null}const ge=Bl.define,co=ge(),zs=ge(),zy=ge(zs),Ly=ge(zs),Ls=ge(),uo=ge(Ls),eh=ge(Ls),xa=ge(),hi=ge(xa),pa=ge(),ma=ge(),_h=ge(),Nc=ge(_h),oo=ge(),be={comment:co,lineComment:ge(co),blockComment:ge(co),docComment:ge(co),name:zs,variableName:ge(zs),typeName:zy,tagName:ge(zy),propertyName:Ly,attributeName:ge(Ly),className:ge(zs),labelName:ge(zs),namespace:ge(zs),macroName:ge(zs),literal:Ls,string:uo,docString:ge(uo),character:ge(uo),attributeValue:ge(uo),number:eh,integer:ge(eh),float:ge(eh),bool:ge(Ls),regexp:ge(Ls),escape:ge(Ls),color:ge(Ls),url:ge(Ls),keyword:pa,self:ge(pa),null:ge(pa),atom:ge(pa),unit:ge(pa),modifier:ge(pa),operatorKeyword:ge(pa),controlKeyword:ge(pa),definitionKeyword:ge(pa),moduleKeyword:ge(pa),operator:ma,derefOperator:ge(ma),arithmeticOperator:ge(ma),logicOperator:ge(ma),bitwiseOperator:ge(ma),compareOperator:ge(ma),updateOperator:ge(ma),definitionOperator:ge(ma),typeOperator:ge(ma),controlOperator:ge(ma),punctuation:_h,separator:ge(_h),bracket:Nc,angleBracket:ge(Nc),squareBracket:ge(Nc),paren:ge(Nc),brace:ge(Nc),content:xa,heading:hi,heading1:ge(hi),heading2:ge(hi),heading3:ge(hi),heading4:ge(hi),heading5:ge(hi),heading6:ge(hi),contentSeparator:ge(xa),list:ge(xa),quote:ge(xa),emphasis:ge(xa),strong:ge(xa),link:ge(xa),monospace:ge(xa),strikethrough:ge(xa),inserted:ge(),deleted:ge(),changed:ge(),invalid:ge(),meta:oo,documentMeta:ge(oo),annotation:ge(oo),processingInstruction:ge(oo),definition:Bl.defineModifier("definition"),constant:Bl.defineModifier("constant"),function:Bl.defineModifier("function"),standard:Bl.defineModifier("standard"),local:Bl.defineModifier("local"),special:Bl.defineModifier("special")};for(let s in be){let l=be[s];l instanceof Bl&&(l.name=s)}Gb([{tag:be.link,class:"tok-link"},{tag:be.heading,class:"tok-heading"},{tag:be.emphasis,class:"tok-emphasis"},{tag:be.strong,class:"tok-strong"},{tag:be.keyword,class:"tok-keyword"},{tag:be.atom,class:"tok-atom"},{tag:be.bool,class:"tok-bool"},{tag:be.url,class:"tok-url"},{tag:be.labelName,class:"tok-labelName"},{tag:be.inserted,class:"tok-inserted"},{tag:be.deleted,class:"tok-deleted"},{tag:be.literal,class:"tok-literal"},{tag:be.string,class:"tok-string"},{tag:be.number,class:"tok-number"},{tag:[be.regexp,be.escape,be.special(be.string)],class:"tok-string2"},{tag:be.variableName,class:"tok-variableName"},{tag:be.local(be.variableName),class:"tok-variableName tok-local"},{tag:be.definition(be.variableName),class:"tok-variableName tok-definition"},{tag:be.special(be.variableName),class:"tok-variableName2"},{tag:be.definition(be.propertyName),class:"tok-propertyName tok-definition"},{tag:be.typeName,class:"tok-typeName"},{tag:be.namespace,class:"tok-namespace"},{tag:be.className,class:"tok-className"},{tag:be.macroName,class:"tok-macroName"},{tag:be.propertyName,class:"tok-propertyName"},{tag:be.operator,class:"tok-operator"},{tag:be.comment,class:"tok-comment"},{tag:be.meta,class:"tok-meta"},{tag:be.invalid,class:"tok-invalid"},{tag:be.punctuation,class:"tok-punctuation"}]);const Kv="modulepreload",Jv=function(s,l){return new URL(s,l).href},Uy={},Xe=function(l,i,r){let o=Promise.resolve();if(i&&i.length>0){let h=function(x){return Promise.all(x.map(k=>Promise.resolve(k).then(_=>({status:"fulfilled",value:_}),_=>({status:"rejected",reason:_}))))};const g=document.getElementsByTagName("link"),m=document.querySelector("meta[property=csp-nonce]"),b=(m==null?void 0:m.nonce)||(m==null?void 0:m.getAttribute("nonce"));o=h(i.map(x=>{if(x=Jv(x,r),x in Uy)return;Uy[x]=!0;const k=x.endsWith(".css"),_=k?'[rel="stylesheet"]':"";if(!!r)for(let H=g.length-1;H>=0;H--){const B=g[H];if(B.href===x&&(!k||B.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${x}"]${_}`))return;const N=document.createElement("link");if(N.rel=k?"stylesheet":Kv,k||(N.as="script"),N.crossOrigin="",N.href=x,b&&N.setAttribute("nonce",b),document.head.appendChild(N),k)return new Promise((H,B)=>{N.addEventListener("load",H),N.addEventListener("error",()=>B(new Error(`Unable to preload CSS for ${x}`)))})}))}function d(h){const g=new Event("vite:preloadError",{cancelable:!0});if(g.payload=h,window.dispatchEvent(g),!g.defaultPrevented)throw h}return o.then(h=>{for(const g of h||[])g.status==="rejected"&&d(g.reason);return l().catch(d)})},Yb={js:async()=>(await Xe(async()=>{const{javascript:s}=await import("./index-Dr7O0ILC.js");return{javascript:s}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({jsx:!0}),cjs:async()=>(await Xe(async()=>{const{javascript:s}=await import("./index-Dr7O0ILC.js");return{javascript:s}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript(),mjs:async()=>(await Xe(async()=>{const{javascript:s}=await import("./index-Dr7O0ILC.js");return{javascript:s}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript(),jsx:async()=>(await Xe(async()=>{const{javascript:s}=await import("./index-Dr7O0ILC.js");return{javascript:s}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({jsx:!0}),ts:async()=>(await Xe(async()=>{const{javascript:s}=await import("./index-Dr7O0ILC.js");return{javascript:s}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({typescript:!0}),mts:async()=>(await Xe(async()=>{const{javascript:s}=await import("./index-Dr7O0ILC.js");return{javascript:s}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({typescript:!0}),cts:async()=>(await Xe(async()=>{const{javascript:s}=await import("./index-Dr7O0ILC.js");return{javascript:s}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({typescript:!0}),tsx:async()=>(await Xe(async()=>{const{javascript:s}=await import("./index-Dr7O0ILC.js");return{javascript:s}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({typescript:!0,jsx:!0}),json:async()=>(await Xe(async()=>{const{json:s}=await import("./index-CbXyt5BH.js");return{json:s}},__vite__mapDeps([6,1,2,3,4]),import.meta.url)).json(),jsonc:async()=>(await Xe(async()=>{const{json:s}=await import("./index-CbXyt5BH.js");return{json:s}},__vite__mapDeps([6,1,2,3,4]),import.meta.url)).json(),css:async()=>(await Xe(async()=>{const{css:s}=await import("./index-BqaOf3lL.js");return{css:s}},__vite__mapDeps([7,1,2,3,4]),import.meta.url)).css(),scss:async()=>(await Xe(async()=>{const{css:s}=await import("./index-BqaOf3lL.js");return{css:s}},__vite__mapDeps([7,1,2,3,4]),import.meta.url)).css(),less:async()=>(await Xe(async()=>{const{css:s}=await import("./index-BqaOf3lL.js");return{css:s}},__vite__mapDeps([7,1,2,3,4]),import.meta.url)).css(),html:async()=>(await Xe(async()=>{const{html:s}=await import("./index-C6bp7gLM.js");return{html:s}},__vite__mapDeps([8,1,7,2,3,4,0,5]),import.meta.url)).html(),htm:async()=>(await Xe(async()=>{const{html:s}=await import("./index-C6bp7gLM.js");return{html:s}},__vite__mapDeps([8,1,7,2,3,4,0,5]),import.meta.url)).html(),vue:async()=>(await Xe(async()=>{const{html:s}=await import("./index-C6bp7gLM.js");return{html:s}},__vite__mapDeps([8,1,7,2,3,4,0,5]),import.meta.url)).html(),svelte:async()=>(await Xe(async()=>{const{html:s}=await import("./index-C6bp7gLM.js");return{html:s}},__vite__mapDeps([8,1,7,2,3,4,0,5]),import.meta.url)).html(),md:async()=>(await Xe(async()=>{const{markdown:s}=await import("./index-DwCBmVAn.js");return{markdown:s}},__vite__mapDeps([9,3,4,2,5,8,1,7,0]),import.meta.url)).markdown(),markdown:async()=>(await Xe(async()=>{const{markdown:s}=await import("./index-DwCBmVAn.js");return{markdown:s}},__vite__mapDeps([9,3,4,2,5,8,1,7,0]),import.meta.url)).markdown(),py:async()=>(await Xe(async()=>{const{python:s}=await import("./index-CaI4eesN.js");return{python:s}},__vite__mapDeps([10,1,2,3,4,5]),import.meta.url)).python(),pyi:async()=>(await Xe(async()=>{const{python:s}=await import("./index-CaI4eesN.js");return{python:s}},__vite__mapDeps([10,1,2,3,4,5]),import.meta.url)).python(),yaml:async()=>(await Xe(async()=>{const{yaml:s}=await import("./index-Cw0TSvLQ.js");return{yaml:s}},__vite__mapDeps([11,1,2,3,4]),import.meta.url)).yaml(),yml:async()=>(await Xe(async()=>{const{yaml:s}=await import("./index-Cw0TSvLQ.js");return{yaml:s}},__vite__mapDeps([11,1,2,3,4]),import.meta.url)).yaml(),rs:async()=>(await Xe(async()=>{const{rust:s}=await import("./index-DSWJFoDR.js");return{rust:s}},__vite__mapDeps([12,1,2,3,4]),import.meta.url)).rust(),c:async()=>(await Xe(async()=>{const{cpp:s}=await import("./index-khA8Gu_K.js");return{cpp:s}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),h:async()=>(await Xe(async()=>{const{cpp:s}=await import("./index-khA8Gu_K.js");return{cpp:s}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),cc:async()=>(await Xe(async()=>{const{cpp:s}=await import("./index-khA8Gu_K.js");return{cpp:s}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),cpp:async()=>(await Xe(async()=>{const{cpp:s}=await import("./index-khA8Gu_K.js");return{cpp:s}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),hpp:async()=>(await Xe(async()=>{const{cpp:s}=await import("./index-khA8Gu_K.js");return{cpp:s}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),java:async()=>(await Xe(async()=>{const{java:s}=await import("./index-CbkTwf-a.js");return{java:s}},__vite__mapDeps([14,1,2,3,4]),import.meta.url)).java(),go:async()=>(await Xe(async()=>{const{go:s}=await import("./index-DWdTnlsP.js");return{go:s}},__vite__mapDeps([15,1,2,3,4,5]),import.meta.url)).go(),php:async()=>(await Xe(async()=>{const{php:s}=await import("./index-bVu7H3ZX.js");return{php:s}},__vite__mapDeps([16,1,8,7,2,3,4,0,5]),import.meta.url)).php(),sql:async()=>(await Xe(async()=>{const{sql:s}=await import("./index-po851PkX.js");return{sql:s}},__vite__mapDeps([17,2,3,4,1,5]),import.meta.url)).sql(),xml:async()=>(await Xe(async()=>{const{xml:s}=await import("./index-JfSeUxQA.js");return{xml:s}},__vite__mapDeps([18,1,2,3,4]),import.meta.url)).xml(),svg:async()=>(await Xe(async()=>{const{xml:s}=await import("./index-JfSeUxQA.js");return{xml:s}},__vite__mapDeps([18,1,2,3,4]),import.meta.url)).xml()},Fv={".mcp.json":"json",dockerfile:"yaml",makefile:"yaml"},Wv={javascript:"js",node:"js",typescript:"ts",python:"py",python3:"py",yml:"yaml",rust:"rs",golang:"go","c++":"cpp",cplusplus:"cpp"};async function Pv(s){const l=Wv[s.toLowerCase()]??s.toLowerCase(),i=Yb[l];return i?i().catch(()=>null):null}async function e1(s){const l=(s.split("/").pop()??"").toLowerCase(),i=Fv[l]??l.split(".").pop()??"",r=Yb[i];return r?r().catch(()=>null):null}const t1=Gb([{tag:[be.keyword,be.modifier,be.controlKeyword,be.moduleKeyword],class:"cmh-key"},{tag:[be.propertyName],class:"cmh-prop"},{tag:[be.function(be.variableName),be.labelName],class:"cmh-fn"},{tag:[be.color,be.constant(be.name),be.standard(be.name),be.bool],class:"cmh-const"},{tag:[be.typeName,be.className,be.changed,be.annotation,be.self,be.namespace],class:"cmh-type"},{tag:[be.number,be.integer,be.float],class:"cmh-num"},{tag:[be.string,be.special(be.string),be.regexp],class:"cmh-str"},{tag:[be.operator,be.operatorKeyword,be.escape],class:"cmh-op"},{tag:[be.meta,be.comment],class:"cmh-comment"},{tag:be.invalid,class:"cmh-invalid"}]);function fo(s){return s.replace(/[&<>]/g,l=>l==="&"?"&amp;":l==="<"?"&lt;":"&gt;")}async function n1(s,l){const i=l?await Pv(l):null;if(!i)return fo(s);try{const r=i.language.parser.parse(s);let o="";return Qv(s,r,t1,(d,h)=>{o+=h?`<span class="${h}">${fo(d)}</span>`:fo(d)},()=>{o+=`
117
- `}),o}catch{return fo(s)}}ht.setOptions({gfm:!0,breaks:!1});function Ib(s){var i;const l=(i=s.split(".").pop())==null?void 0:i.toLowerCase();return l==="md"||l==="markdown"}async function Xb(s){const l=await ht.parse(s,{async:!0,walkTokens:async i=>{if(i.type!=="code")return;const r=i;r.text=await n1(r.text,r.lang??""),r.escaped=!0}});return jv.sanitize(l)}function Hy(s,l){return{path:s.path,text:s.content,saved:s.content,eol:s.eol,encoding:s.encoding,mtime:s.mtime,size:s.size,binary:s.binary,tooLarge:s.tooLarge,stale:!1,revision:l,previewMode:Ib(s.path)}}function Ja(s){return!s.binary&&!s.tooLarge&&s.text!==s.saved}function l1(s){return s.split("/").pop()??s}function ki(s){const l=s.lastIndexOf("/");return l===-1?"":s.slice(0,l)}function th(s){return s<1024?`${s} Б`:s<1024*1024?`${(s/1024).toFixed(1)} КБ`:`${(s/1024/1024).toFixed(1)} МБ`}function So({x:s,y:l,items:i,note:r,onClose:o}){const d=S.useRef(null),[h,g]=S.useState({left:s,top:l}),[m,b]=S.useState(()=>{const _=i.findIndex(C=>!C.disabled);return _===-1?0:_});S.useLayoutEffect(()=>{const _=d.current;if(!_)return;const C=_.getBoundingClientRect(),N=8,H=Math.max(N,Math.min(s,window.innerWidth-C.width-N)),B=Math.max(N,Math.min(l,window.innerHeight-C.height-N));g({left:H,top:B})},[s,l]),S.useLayoutEffect(()=>{var _;(_=d.current)==null||_.focus()},[]),S.useLayoutEffect(()=>{function _(N){var H;(H=d.current)!=null&&H.contains(N.target)||o()}function C(){o()}return document.addEventListener("mousedown",_),document.addEventListener("scroll",C,!0),()=>{document.removeEventListener("mousedown",_),document.removeEventListener("scroll",C,!0)}},[o]);function x(_){_.disabled||(_.onSelect(),o())}function k(_){if(_.key==="Escape"){_.preventDefault(),_.stopPropagation(),o();return}const C=i.map((N,H)=>({item:N,index:H})).filter(N=>!N.item.disabled);if(C.length!==0){if(_.key==="ArrowDown"||_.key==="ArrowUp"){_.preventDefault();const N=_.key==="ArrowDown"?1:-1,H=C.findIndex(K=>K.index===m),B=C[(((H===-1?0:H)+N)%C.length+C.length)%C.length];B&&b(B.index);return}if(_.key==="Enter"||_.key===" "){_.preventDefault();const N=i[m];N&&x(N)}}}return c.jsxs("div",{ref:d,className:"ctxmenu",style:{left:h.left,top:h.top},role:"menu",tabIndex:-1,onKeyDown:k,children:[r&&c.jsx("div",{className:"ctxmenu__note",children:r}),i.map((_,C)=>c.jsxs("button",{type:"button",role:"menuitem","aria-disabled":_.disabled,className:"ctxmenu__item"+(C===m?" is-cursor":""),onMouseEnter:()=>b(C),onClick:()=>x(_),children:[c.jsx("span",{className:"ctxmenu__label",children:_.label}),_.hint&&c.jsx("span",{className:"ctxmenu__hint",children:_.hint})]},_.id))]})}const a1=3500,s1=9e3,i1=220;function Uc({result:s}){const[l,i]=S.useState(s),[r,o]=S.useState(!1);return S.useEffect(()=>{if(!s){i(null),o(!1);return}i(s),o(!1);const d=s.ok?a1:s1,h=setTimeout(()=>o(!0),d),g=setTimeout(()=>i(null),d+i1);return()=>{clearTimeout(h),clearTimeout(g)}},[s]),l?c.jsx("div",{className:"oplog "+(l.ok?"oplog--ok":"oplog--bad")+(r?" oplog--leaving":""),role:"status","aria-live":l.ok?"polite":"assertive",children:l.message}):null}function Dc({value:s,className:l,placeholder:i="Название сессии",onCommit:r,onCancel:o}){const[d,h]=S.useState(s),g=S.useRef(null);S.useEffect(()=>{var b;(b=g.current)==null||b.select()},[]);function m(){const b=d.trim();if(!b||b===s)return o();r(b)}return c.jsx("input",{ref:g,className:l?`rename ${l}`:"rename",value:d,autoFocus:!0,spellCheck:!1,placeholder:i,onChange:b=>h(b.target.value),onBlur:m,onKeyDown:b=>{b.stopPropagation(),b.key==="Enter"?(b.preventDefault(),m()):b.key==="Escape"&&(b.preventDefault(),o())}})}function Tr({active:s}){return s?c.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("path",{d:"M2 5h3V2"}),c.jsx("path",{d:"M14 5h-3V2"}),c.jsx("path",{d:"M2 11h3v3"}),c.jsx("path",{d:"M14 11h-3v3"})]}):c.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("path",{d:"M5 2H2v3"}),c.jsx("path",{d:"M11 2h3v3"}),c.jsx("path",{d:"M2 11v3h3"}),c.jsx("path",{d:"M14 11v3h-3"})]})}const r1=500,pi="application/x-ccv-fs-path",c1=200;function u1({open:s,tree:l,expanded:i,activePath:r,dirty:o,gitChanges:d,result:h,searchResult:g,onSearch:m,onReveal:b,onToggle:x,onOpen:k,onCreate:_,onRename:C,onMove:N,onCopy:H,onDelete:B,onRefresh:K,onClose:O,zoomed:$,onToggleZoom:A}){const[Q,L]=S.useState(""),[M,W]=S.useState(null),[re,he]=S.useState(null),[F,ae]=S.useState(null),[me,Ne]=S.useState(null),[pe,z]=S.useState(null),[P,te]=S.useState(null),xe=wh("(hover: hover)"),we=S.useRef(null),j=S.useMemo(()=>d1(d),[d]);function V(T){return!(!F||T===F.path||F.kind==="dir"&&T.startsWith(`${F.path}/`)||T===ki(F.path))}function ce(T){return!(!pe||T===pe.path||pe.kind==="dir"&&T.startsWith(`${pe.path}/`)||pe.mode==="cut"&&T===ki(pe.path))}function oe(T){z({path:T.path,kind:T.kind,mode:"copy"})}function ve(T){z({path:T.path,kind:T.kind,mode:"cut"})}function Te(T){!pe||!ce(T)||(T&&!i.has(T)&&x(T),pe.mode==="cut"?(N(pe.path,T),z(null)):H(pe.path,T))}function Re(T,I){const _e=T.touches[0];if(!_e)return;const Me={timer:0,x:_e.clientX,y:_e.clientY,el:T.currentTarget,fired:!1};Me.timer=window.setTimeout(()=>{Me.fired=!0,I(Me.x,Me.y,Me.el)},r1),we.current=Me}function it(T){const I=we.current,_e=T.touches[0];!I||!_e||Math.hypot(_e.clientX-I.x,_e.clientY-I.y)>10&&(window.clearTimeout(I.timer),we.current=null)}function Ze(T){const I=we.current;I&&(window.clearTimeout(I.timer),I.fired&&T.preventDefault())}function st(){var T;return(T=we.current)!=null&&T.fired?(we.current=null,!0):!1}function He(T,I,_e,Me){L((Me==null?void 0:Me.path)??""),te({x:T,y:I,opener:_e,entry:Me})}function Ct(){const T=P==null?void 0:P.opener;te(null),T!=null&&T.isConnected&&T.focus()}function Je(T){return{onContextMenu:I=>{I.preventDefault(),He(I.clientX,I.clientY,I.currentTarget,T)},onTouchStart:I=>Re(I,(_e,Me,Le)=>He(_e,Me,Le,T)),onTouchMove:it,onTouchEnd:Ze,onTouchCancel:Ze}}function Ke(T){T.target===T.currentTarget&&(T.preventDefault(),He(T.clientX,T.clientY,T.currentTarget,null))}function Fe(T){T.target===T.currentTarget&&Re(T,(I,_e,Me)=>He(I,_e,Me,null))}function dt(T){if(!(T.ctrlKey||T.metaKey)||T.target instanceof HTMLInputElement)return;const I=T.key.toLowerCase();if(I==="v"){T.preventDefault(),Te(xn());return}if(!Q)return;const _e=By(l,Q);_e&&(I==="c"?(T.preventDefault(),oe(_e)):I==="x"&&(T.preventDefault(),ve(_e)))}function Wn(T){return I=>{I.dataTransfer.effectAllowed="move",I.dataTransfer.setData(pi,T.path),ae({path:T.path,kind:T.kind})}}function Bt(){ae(null),Ne(null)}function Tn(T){return I=>{I.dataTransfer.types.includes(pi)&&(I.stopPropagation(),!(T.kind!=="dir"||!V(T.path))&&(I.preventDefault(),Ne(T.path)))}}function bn(T){return I=>{if(!I.dataTransfer.types.includes(pi)||(I.stopPropagation(),T.kind!=="dir"||!V(T.path)))return;I.preventDefault();const _e=I.dataTransfer.getData(pi);Ne(null),_e&&N(_e,T.path)}}function fn(T){!T.dataTransfer.types.includes(pi)||!V("")||(T.preventDefault(),Ne(""))}function Un(T){if(!T.dataTransfer.types.includes(pi)||!V(""))return;T.preventDefault();const I=T.dataTransfer.getData(pi);Ne(null),I&&N(I,"")}const[Zt,ut]=S.useState(""),dn=Zt.trim(),J=dn.length>0,fe=S.useRef(null),Ee=S.useRef(m);Ee.current=m;function Qe(T){ut(T),fe.current&&clearTimeout(fe.current);const I=T.trim();if(!I){Ee.current("");return}fe.current=setTimeout(()=>Ee.current(I),c1)}function Tt(T){fe.current&&clearTimeout(fe.current),ut(""),Ee.current(""),L(T.path),b(T)}const Et=J&&(g==null?void 0:g.query)===dn?g:null;function xn(){if(Q==="")return"";const T=By(l,Q);if((T==null?void 0:T.kind)==="dir")return Q;const I=Q.lastIndexOf("/");return I===-1?"":Q.slice(0,I)}function en(T,I){const _e=I??xn();_e&&!i.has(_e)&&x(_e),he({parent:_e,kind:T})}function qt(){if(!P)return[];const T=Me=>xe?Me:void 0;if(!P.entry)return[{id:"paste",label:"Вставить в корень проекта",hint:T("Ctrl+V"),disabled:!ce(""),onSelect:()=>Te("")},{id:"new-file",label:"Создать файл",onSelect:()=>en("file","")},{id:"new-dir",label:"Создать каталог",onSelect:()=>en("dir","")}];const I=P.entry,_e=[I.kind==="file"?{id:"open",label:"Открыть",onSelect:()=>k(I.path)}:{id:"toggle",label:i.has(I.path)?"Свернуть":"Развернуть",onSelect:()=>x(I.path)},{id:"copy",label:"Копировать",hint:T("Ctrl+C"),onSelect:()=>oe(I)},{id:"cut",label:"Вырезать",hint:T("Ctrl+X"),onSelect:()=>ve(I)}];return I.kind==="dir"&&(_e.push({id:"paste",label:"Вставить",hint:T("Ctrl+V"),disabled:!ce(I.path),onSelect:()=>Te(I.path)}),_e.push({id:"new-file",label:"Создать файл",onSelect:()=>en("file",I.path)}),_e.push({id:"new-dir",label:"Создать каталог",onSelect:()=>en("dir",I.path)})),_e.push({id:"rename",label:"Переименовать",onSelect:()=>W(I.path)}),_e.push({id:"delete",label:"Удалить",onSelect:()=>B(I)}),_e}const En=J?[]:pt("",0);function pt(T,I){const _e=l[T],Me=[];if(re&&re.parent===T&&Me.push(c.jsxs("div",{className:"fsrow fsrow--draft",style:Fa(I),children:[c.jsx("span",{className:"fsrow__icon",children:re.kind==="dir"?c.jsx(Ao,{}):c.jsx(Co,{})}),c.jsx(Dc,{className:"rename--file",value:"",placeholder:re.kind==="dir"?"имя каталога":"имя файла",onCommit:Le=>{he(null),_(T,re.kind,Le)},onCancel:()=>he(null)})]},`draft:${T}`)),!_e)return Me.push(c.jsx("p",{className:"fsrow__pending",style:Fa(I),children:"читаем…"},`wait:${T}`)),Me;_e.length===0&&!re&&Me.push(c.jsx("p",{className:"fsrow__pending",style:Fa(I),children:"пусто"},`empty:${T}`));for(const Le of _e){const An=Le.kind==="dir"&&i.has(Le.path);Me.push(M===Le.path?c.jsxs("div",{className:"fsrow fsrow--draft",style:Fa(I),children:[c.jsx("span",{className:"fsrow__icon",children:Le.kind==="dir"?c.jsx(Ao,{open:An}):c.jsx(Co,{})}),c.jsx(Dc,{className:"rename--file",value:Le.name,placeholder:"новое имя",onCommit:Gl=>{W(null),C(Le.path,Gl)},onCancel:()=>W(null)})]},Le.path):c.jsx(o1,{entry:Le,depth:I,open:An,active:Le.path===r,selected:Le.path===Q,dirty:o.has(Le.path),gitStatus:j.get(Le.path),dragging:(F==null?void 0:F.path)===Le.path,dropTarget:me===Le.path,cut:(pe==null?void 0:pe.mode)==="cut"&&pe.path===Le.path,onClick:()=>{st()||(L(Le.path),Le.kind==="dir"?x(Le.path):k(Le.path))},onRename:()=>W(Le.path),onDelete:()=>B(Le),onDragStart:Wn(Le),onDragEnd:Bt,onDragOver:Tn(Le),onDrop:bn(Le),...Je(Le)},Le.path)),An&&Me.push(...pt(Le.path,I+1))}return Me}function _n(){if(!Et)return[c.jsx("p",{className:"fsrow__pending",style:Fa(0),children:"ищем…"},"search:wait")];if(Et.entries.length===0)return[c.jsx("p",{className:"fsrow__pending",style:Fa(0),children:"ничего не найдено"},"search:empty")];const T=Et.entries.map(I=>c.jsx(f1,{entry:I,gitStatus:j.get(I.path),onClick:()=>Tt(I)},I.path));return Et.truncated&&T.push(c.jsxs("p",{className:"fsrow__pending",style:Fa(0),children:["показаны первые ",Et.entries.length," — уточните запрос"]},"search:truncated")),T}return c.jsxs("aside",{className:(s?"sidepane sidepane--files sidepane--open":"sidepane sidepane--files")+($?" sidepane--zoomed":""),"aria-label":"Файлы проекта",onKeyDown:dt,children:[c.jsxs("div",{className:"sidepane__head",onDoubleClick:T=>{A&&(T.target.closest("button")||A())},children:[c.jsx(g1,{}),c.jsx("span",{className:"sidepane__title",children:"Файлы"}),c.jsx("button",{className:"sidepane__btn",title:"Новый файл","aria-label":"Новый файл",onClick:()=>en("file"),children:c.jsx(p1,{})}),c.jsx("button",{className:"sidepane__btn",title:"Новый каталог","aria-label":"Новый каталог",onClick:()=>en("dir"),children:c.jsx(m1,{})}),c.jsx("button",{className:"sidepane__btn",title:"Перечитать дерево","aria-label":"Перечитать дерево",onClick:K,children:"↻"}),A&&c.jsx("button",{className:"sidepane__btn",title:$?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":$?"Свернуть панель файлов":"Развернуть панель файлов на весь экран","aria-pressed":$,onClick:A,children:c.jsx(Tr,{active:$})}),c.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель файлов",onClick:O,children:"✕"})]}),c.jsxs("div",{className:"fssearch",children:[c.jsx(y1,{}),c.jsx("input",{className:"fssearch__input",type:"text",value:Zt,spellCheck:!1,placeholder:"Поиск файлов и папок…","aria-label":"Поиск файлов и папок",onChange:T=>Qe(T.target.value),onKeyDown:T=>{T.stopPropagation(),T.key==="Escape"&&(T.preventDefault(),Zt?Qe(""):T.currentTarget.blur())}}),Zt&&c.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>Qe(""),children:"✕"})]}),c.jsx("div",{className:"sidepane__scroll fstree"+(me===""?" fstree--drop-target":""),tabIndex:-1,onDragOver:fn,onDrop:Un,onContextMenu:Ke,onTouchStart:Fe,onTouchMove:it,onTouchEnd:Ze,onTouchCancel:Ze,children:J?_n():En}),c.jsx(Uc,{result:h}),P&&c.jsx(So,{x:P.x,y:P.y,items:qt(),onClose:Ct})]})}function o1({entry:s,depth:l,open:i,active:r,selected:o,dirty:d,gitStatus:h,dragging:g,dropTarget:m,cut:b,onClick:x,onRename:k,onDelete:_,onDragStart:C,onDragEnd:N,onDragOver:H,onDrop:B,onContextMenu:K,onTouchStart:O,onTouchMove:$,onTouchEnd:A,onTouchCancel:Q}){const L="fsrow"+(r?" is-open":"")+(o&&!r?" is-selected":"")+(s.ignored?" fsrow--ignored":"")+(g?" fsrow--dragging":"")+(m?" fsrow--drop-target":"")+(b?" fsrow--cut":"");return c.jsxs("div",{className:L,style:Fa(l),draggable:!0,onDragStart:C,onDragEnd:N,onDragOver:H,onDrop:B,onContextMenu:K,onTouchStart:O,onTouchMove:$,onTouchEnd:A,onTouchCancel:Q,children:[c.jsxs("button",{className:"fsrow__main",onClick:x,title:Vb(s),children:[c.jsx("span",{className:"fsrow__icon"+Eo("fsrow__icon",h),children:s.kind==="dir"?c.jsx(Ao,{open:i}):c.jsx(Co,{})}),c.jsx("span",{className:"fsrow__name"+Eo("fsrow__name",h),children:s.name}),s.ignored&&c.jsx("span",{className:"fsrow__tag",title:"Игнорируется git (.gitignore)",children:"git-ignore"}),d&&c.jsx("span",{className:"fsrow__dot",title:"Есть несохранённые правки"})]}),c.jsx("button",{className:"fsrow__act",title:"Переименовать","aria-label":`Переименовать ${s.name}`,onClick:k,children:"✎"}),c.jsx("button",{className:"fsrow__act",title:"Удалить","aria-label":`Удалить ${s.name}`,onClick:_,children:"✕"})]})}function f1({entry:s,gitStatus:l,onClick:i}){const r=s.path.slice(0,s.path.length-s.name.length-1);return c.jsxs("button",{className:"fsrow fsrow--search"+(s.ignored?" fsrow--ignored":""),style:Fa(0),onClick:i,title:Vb(s),children:[c.jsx("span",{className:"fsrow__icon"+Eo("fsrow__icon",l),children:s.kind==="dir"?c.jsx(Ao,{}):c.jsx(Co,{})}),c.jsx("span",{className:"fsrow__name"+Eo("fsrow__name",l),children:s.name}),s.ignored&&c.jsx("span",{className:"fsrow__tag",children:"git-ignore"}),r&&c.jsx("span",{className:"fsrow__path",children:r})]})}function Vb(s){return s.ignored?`${s.path} — игнорируется git (.gitignore)`:s.path}function Fa(s){return{"--depth":s}}function By(s,l){var o;const i=l.lastIndexOf("/"),r=i===-1?"":l.slice(0,i);return((o=s[r])==null?void 0:o.find(d=>d.path===l))??null}function d1(s){const l=new Map,i={added:1,modified:2},r=(o,d)=>{const h=l.get(o);(!h||i[d]>i[h])&&l.set(o,d)};for(const o of s){const d=h1(o.status);if(!d)continue;r(o.path,d);let h=ki(o.path);for(;r(h,d),!!h;)h=ki(h)}return l}function h1(s){if(s==="??")return"added";const[l="",i=""]=s;return l==="A"||l==="R"||l==="C"?"added":l==="M"||i==="M"?"modified":null}function Eo(s,l){return l?` ${s}--git-${l}`:""}function Ao({open:s=!1}){return c.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,"aria-hidden":"true",children:s?c.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"}):c.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 Co(){return c.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,strokeLinejoin:"round","aria-hidden":"true",children:[c.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"}),c.jsx("path",{d:"M9 2v3.2h3.3"})]})}function p1(){return c.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,"aria-hidden":"true",children:[c.jsxs("g",{transform:"translate(-1.3,-1.6) scale(0.78)",strokeLinejoin:"round",children:[c.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"}),c.jsx("path",{d:"M9 2v3.2h3.3"})]}),c.jsx("path",{d:"M12.2 10.3v3.8M10.3 12.2h3.8",strokeLinecap:"round"})]})}function m1(){return c.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,"aria-hidden":"true",children:[c.jsx("g",{transform:"translate(-1.3,-1.6) scale(0.78)",children:c.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"})}),c.jsx("path",{d:"M12.2 10.3v3.8M10.3 12.2h3.8",strokeLinecap:"round"})]})}function g1(){return c.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[c.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"}),c.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 y1(){return c.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[c.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),c.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}const b1=200;function x1({open:s,result:l,onSearch:i,onOpenMatch:r,onClose:o,zoomed:d,onToggleZoom:h}){const[g,m]=S.useState(""),b=g.trim(),x=b.length>0,k=S.useRef(null),_=S.useRef(i);_.current=i;function C(B){m(B),k.current&&clearTimeout(k.current);const K=B.trim();if(!K){_.current("");return}k.current=setTimeout(()=>_.current(K),b1)}const N=x&&(l==null?void 0:l.query)===b?l:null;function H(){if(!N)return[c.jsx("p",{className:"fsrow__pending",children:"ищем…"},"grep:wait")];if(N.matches.length===0)return[c.jsx("p",{className:"fsrow__pending",children:"ничего не найдено"},"grep:empty")];const B=[];let K="";for(const O of N.matches)O.path!==K&&(K=O.path,B.push(c.jsx("p",{className:"searchgroup__path",title:O.path,children:O.path},`path:${O.path}`))),B.push(c.jsx(_1,{match:O,onClick:()=>r(O)},`${O.path}:${O.line}:${O.column}`));return N.truncated&&B.push(c.jsxs("p",{className:"fsrow__pending",children:["показаны первые ",N.matches.length," — уточните запрос"]},"grep:truncated")),B}return c.jsxs("aside",{className:(s?"sidepane sidepane--search sidepane--open":"sidepane sidepane--search")+(d?" sidepane--zoomed":""),"aria-label":"Поиск по тексту в проекте",children:[c.jsxs("div",{className:"sidepane__head",onDoubleClick:B=>{h&&(B.target.closest("button")||h())},children:[c.jsx(v1,{}),c.jsx("span",{className:"sidepane__title",children:"Поиск по тексту"}),h&&c.jsx("button",{className:"sidepane__btn",title:d?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":d?"Свернуть панель поиска":"Развернуть панель поиска на весь экран","aria-pressed":d,onClick:h,children:c.jsx(Tr,{active:d})}),c.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель поиска",onClick:o,children:"✕"})]}),c.jsxs("div",{className:"fssearch",children:[c.jsx(S1,{}),c.jsx("input",{className:"fssearch__input",type:"text",value:g,spellCheck:!1,placeholder:"Поиск по тексту во всех файлах…","aria-label":"Поиск по тексту во всех файлах",onChange:B=>C(B.target.value),onKeyDown:B=>{B.stopPropagation(),B.key==="Escape"&&(B.preventDefault(),g?C(""):B.currentTarget.blur())}}),g&&c.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>C(""),children:"✕"})]}),c.jsx("div",{className:"sidepane__scroll fstree",children:x?H():c.jsx("p",{className:"sidepane__empty",children:"Введите текст, чтобы найти его во всех файлах проекта."})})]})}function _1({match:s,onClick:l}){const i=s.lineText.slice(0,s.column-1),r=s.lineText.slice(s.column-1,s.column-1+s.matchLength),o=s.lineText.slice(s.column-1+s.matchLength);return c.jsxs("button",{className:"searchmatch",onClick:l,title:`${s.path}:${s.line}`,children:[c.jsx("span",{className:"searchmatch__line",children:s.line}),c.jsxs("span",{className:"searchmatch__text",children:[i,c.jsx("mark",{children:r}),o]})]})}function v1(){return c.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[c.jsx("circle",{cx:"6.8",cy:"6.8",r:"4.3"}),c.jsx("path",{d:"M13.2 13.2 10.1 10.1"})]})}function S1(){return c.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[c.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),c.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}let ho=null;function k1(){return ho||(ho=Promise.all([Xe(()=>import("./index-DQD2YqR9.js"),__vite__mapDeps([19,4,3,2,20,5]),import.meta.url),Xe(()=>import("./index-891wE-Rj.js").then(s=>s.v),__vite__mapDeps([4,3]),import.meta.url),Xe(()=>import("./index-BHot-lnj.js"),[],import.meta.url),Xe(()=>import("./index-BANX3gfG.js"),__vite__mapDeps([20,3,4,2]),import.meta.url),Xe(()=>import("./codemirror-YAsAN8OM.js"),__vite__mapDeps([21,2,3,4]),import.meta.url)]).then(([s,l,i,r,o])=>({EditorView:l.EditorView,EditorState:i.EditorState,Compartment:i.Compartment,EditorSelection:i.EditorSelection,Prec:i.Prec,keymap:l.keymap,indentWithTab:r.indentWithTab,basicSetup:s.basicSetup,editorTheme:o.editorTheme,editorHighlight:o.editorHighlight})).catch(s=>{throw ho=null,s})),ho}function w1({path:s,doc:l,revision:i,goto:r,onChange:o,onSave:d}){const h=S.useRef(null),g=S.useRef(null),m=S.useRef(null),b=S.useRef(new Map),x=S.useRef(new Map),k=S.useRef(new Set),_=S.useRef(null),C=S.useRef(o),N=S.useRef(d),H=S.useRef(s),B=S.useRef(i),K=S.useRef(l);C.current=o,N.current=d,H.current=s,B.current=i,K.current=l;const[O,$]=S.useState("loading"),[A,Q]=S.useState(!1);function L(W,re,he,F,ae){const me=b.current.get(F),Ne=x.current.get(F)===ae;if(me&&Ne)he.setState(me);else{const z=W.EditorState.create({doc:K.current,extensions:[W.basicSetup,W.Prec.highest(W.keymap.of([{key:"Mod-s",preventDefault:!0,run:()=>(N.current(H.current),!0)}])),W.keymap.of([W.indentWithTab]),re.of([]),W.editorTheme,W.editorHighlight,W.EditorView.updateListener.of(P=>{P.docChanged&&C.current(H.current,P.state.doc.toString())})]});b.current.set(F,z),x.current.set(F,ae),he.setState(z),k.current.delete(F)}if(k.current.has(F))return()=>{};let pe=!1;return e1(F).then(z=>{pe||!z||H.current!==F||(he.dispatch({effects:re.reconfigure(z)}),b.current.set(F,he.state),k.current.add(F))}),()=>{pe=!0}}S.useEffect(()=>{if(!h.current)return;let re=!1,he=null,F=null;$("loading"),Q(!1);const ae=window.setTimeout(()=>{re||Q(!0)},200);return(async()=>{let me;try{me=await k1()}catch{window.clearTimeout(ae),re||$("error");return}if(re||!h.current)return;window.clearTimeout(ae);const Ne=new me.Compartment;_.current=Ne,m.current=me,F=new me.EditorView({parent:h.current}),g.current=F,he=L(me,Ne,F,H.current,B.current),$("ready")})(),()=>{re=!0,window.clearTimeout(ae),he==null||he(),F==null||F.destroy(),g.current===F&&(g.current=null),m.current=null,_.current=null}},[]),S.useEffect(()=>{const W=m.current,re=g.current,he=_.current;if(!(!W||!re||!he))return L(W,he,re,s,i)},[s,i]);const M=S.useRef(0);return S.useEffect(()=>{const W=g.current,re=m.current;if(!W||!re||!r||r.token===M.current)return;M.current=r.token;const he=W.state.doc.lines,F=Math.min(Math.max(r.line,1),he),ae=W.state.doc.line(F),me=Math.min(ae.from+Math.max(r.column-1,0),ae.to);W.dispatch({selection:re.EditorSelection.cursor(me),effects:re.EditorView.scrollIntoView(me,{y:"center"})}),W.focus()},[r]),S.useEffect(()=>()=>{const W=g.current;W&&b.current.set(s,W.state)},[s]),c.jsxs("div",{className:"editor__code",children:[c.jsx("div",{ref:h,className:"editor__code-surface"+(O==="ready"?"":" is-hidden")}),O==="loading"&&A&&c.jsxs("div",{className:"editor__state work",role:"status",children:[c.jsxs("div",{className:"work__dots",children:[c.jsx("span",{className:"work__dot"}),c.jsx("span",{className:"work__dot"}),c.jsx("span",{className:"work__dot"})]}),c.jsx("span",{className:"work__label",children:"Загружается редактор…"})]}),O==="error"&&c.jsxs("div",{className:"editor__fallback",children:[c.jsxs("div",{className:"editor__fallback-banner",role:"alert",children:[c.jsx("span",{children:"Редактор не загрузился — ниже только просмотр, без сохранения правок."}),c.jsx("button",{className:"btn btn--sm btn--primary",onClick:()=>window.location.reload(),children:"Перезагрузить страницу"})]}),c.jsx("pre",{className:"editor__fallback-text",children:l})]})]})}function j1({file:s,goto:l,onChange:i,onSave:r,onReload:o,onOverwrite:d,onTogglePreview:h}){const g=Ja(s),m=Ib(s.path)&&!s.binary&&!s.tooLarge;return c.jsxs("div",{className:"editor",children:[c.jsxs("div",{className:"editor__bar",children:[c.jsx("span",{className:"editor__path",title:s.path,children:s.path}),c.jsxs("span",{className:"editor__meta",children:[th(s.size),s.eol==="crlf"&&" · CRLF"]}),m&&c.jsxs("div",{className:"editor__viewtoggle",role:"tablist","aria-label":"Режим просмотра",children:[c.jsx("button",{className:"btn btn--sm"+(s.previewMode?" is-on":""),role:"tab","aria-selected":s.previewMode,onClick:()=>!s.previewMode&&h(s.path),children:"Просмотр"}),c.jsx("button",{className:"btn btn--sm"+(s.previewMode?"":" is-on"),role:"tab","aria-selected":!s.previewMode,onClick:()=>s.previewMode&&h(s.path),children:"Код"})]}),c.jsx("button",{className:"btn btn--sm",disabled:!g,title:"Сохранить (Ctrl+S)",onClick:()=>r(s.path),children:g?"Сохранить":"Сохранено"})]}),s.stale&&c.jsxs("div",{className:"editor__warn",children:[c.jsxs("span",{children:["Файл изменился на диске",g?" — а здесь есть несохранённые правки.":"."]}),c.jsx("button",{className:"btn btn--sm",onClick:()=>o(s.path),children:"Взять с диска"}),g&&c.jsx("button",{className:"btn btn--sm btn--danger",onClick:()=>d(s.path),children:"Сохранить поверх"})]}),s.binary?c.jsxs("p",{className:"editor__empty",children:["Это не текстовый файл — редактировать его здесь нечем. ",th(s.size)," на диске."]}):s.tooLarge?c.jsxs("p",{className:"editor__empty",children:["Файл слишком велик для редактора (",th(s.size),"). Такие правит агент, а не браузер."]}):m&&s.previewMode?c.jsx(N1,{text:s.text}):c.jsx(w1,{path:s.path,doc:s.text,revision:s.revision,goto:l,onChange:i,onSave:r})]})}function N1({text:s}){const[l,i]=S.useState("");return S.useEffect(()=>{let r=!1;return Xb(s).then(o=>{r||i(o)}),()=>{r=!0}},[s]),c.jsx("div",{className:"markdown-preview",dangerouslySetInnerHTML:{__html:l}})}function T1({files:s,activePath:l,busy:i,onSelect:r,onClose:o,zoomed:d,onToggleZoom:h}){return c.jsxs("div",{className:"worktabs",role:"tablist",onDoubleClick:g=>{h&&(g.target.closest("button")||h())},children:[c.jsxs("button",{className:"worktab"+(l===null?" is-on":""),role:"tab","aria-selected":l===null,onClick:()=>r(null),onDoubleClick:()=>h==null?void 0:h(),children:[c.jsx("span",{className:"worktab__name",children:"Разговор"}),i&&c.jsx("span",{className:"worktab__dot worktab__dot--busy",title:"Агент работает"})]}),s.map(g=>c.jsxs("div",{className:"worktab"+(g.path===l?" is-on":""),role:"tab","aria-selected":g.path===l,onDoubleClick:m=>{h&&(m.target.closest(".worktab__close, .worktab__dot")||h())},children:[c.jsx("button",{className:"worktab__name",title:g.path,onClick:()=>r(g.path),children:l1(g.path)}),Ja(g)?c.jsx("button",{className:"worktab__dot",title:"Не сохранено — закрыть","aria-label":`Закрыть ${g.path}`,onClick:()=>o(g.path)}):c.jsx("button",{className:"worktab__close",title:"Закрыть","aria-label":`Закрыть ${g.path}`,onClick:()=>o(g.path),children:"✕"})]},g.path)),c.jsx("div",{className:"worktabs__spacer"}),h&&c.jsx("button",{className:"worktabs__zoom",title:d?"Свернуть — то же самое, что двойной клик по вкладке":"Развернуть на весь экран — то же самое, что двойной клик по вкладке","aria-label":d?"Свернуть колонку разговора":"Развернуть колонку разговора на весь экран","aria-pressed":d,onClick:h,children:c.jsx(Tr,{active:d})})]})}const Qb="ccv:sidebar.collapsed",$b="ccv:sidebar.mode",E1=500,qy="транскрипт остаётся на диске — сессию можно вернуть из архива в любой момент.";function A1({open:s,connected:l,status:i,workspaces:r,sessions:o,archived:d,pinned:h,activeWorkspaceId:g,activeSessionId:m,onSelectWorkspace:b,onSelectSession:x,onRenameSession:k,onPinSessions:_,onSelectPinned:C,onCloseWorkspaces:N,onArchiveSessions:H,onUnarchiveSessions:B,onOpenWorkspace:K,onNewSession:O,onOpenExtensions:$,account:A,onOpenAccount:Q,relay:L,onOpenRelay:M,onOpenSettings:W,themeMode:re,onCycleTheme:he}){const[F,ae]=S.useState(null),[me,Ne]=S.useState(""),[pe,z]=S.useState(M1),[P,te]=S.useState(O1);function xe(){te(T=>{const I=T==="pinned"?"default":"pinned";try{localStorage.setItem($b,I)}catch{}return I})}const we=me.trim().toLowerCase(),j=we!=="",V=S.useMemo(()=>j?r.filter(T=>T.name.toLowerCase().includes(we)||T.path.toLowerCase().includes(we)):r,[r,we,j]),ce=S.useMemo(()=>j?o.filter(T=>(T.title??"").toLowerCase().includes(we)):o,[o,we,j]),oe=S.useMemo(()=>j?d.filter(T=>(T.title??"").toLowerCase().includes(we)):d,[d,we,j]),ve=T=>{var I;return((I=r.find(_e=>_e.id===T))==null?void 0:I.name)??"—"},Te=T=>{var I;return(I=r.find(_e=>_e.id===T))==null?void 0:I.path},Re=S.useMemo(()=>j?h.filter(T=>(T.title??"").toLowerCase().includes(we)||ve(T.workspaceId).toLowerCase().includes(we)):h,[h,r,we,j]);function it(T){z(I=>{const _e=I.includes(T)?I.filter(Me=>Me!==T):[...I,T];try{localStorage.setItem(Qb,JSON.stringify(_e))}catch{}return _e})}const Ze=T=>!pe.includes(T),st=Yy(V),He=Yy(ce),[Ct,Je]=S.useState(null),[Ke,Fe]=S.useState(null),[dt,Wn]=S.useState(null),Bt=S.useRef(null);function Tn(T,I){const _e=T.touches[0];if(!_e)return;const Me={timer:0,x:_e.clientX,y:_e.clientY,el:T.currentTarget,fired:!1};Me.timer=window.setTimeout(()=>{Me.fired=!0,I(Me.x,Me.y,Me.el)},E1),Bt.current=Me}function bn(T){const I=Bt.current,_e=T.touches[0];!I||!_e||Math.hypot(_e.clientX-I.x,_e.clientY-I.y)>10&&(window.clearTimeout(I.timer),Bt.current=null)}function fn(T){const I=Bt.current;I&&(window.clearTimeout(I.timer),I.fired&&T.preventDefault())}function Un(){var T;return(T=Bt.current)!=null&&T.fired?(Bt.current=null,!0):!1}function Zt(){const T=Ct==null?void 0:Ct.opener;Je(null),T!=null&&T.isConnected&&T.focus()}function ut(){const T=Ke==null?void 0:Ke.opener;Fe(null),T!=null&&T.isConnected&&T.focus()}function dn(){const T=dt==null?void 0:dt.opener;Wn(null),T!=null&&T.isConnected&&T.focus()}function J(T){return{onContextMenu:I=>{I.preventDefault(),Je({x:I.clientX,y:I.clientY,opener:I.currentTarget,ids:st.targetsFor(T)})},onTouchStart:I=>Tn(I,(_e,Me,Le)=>Je({x:_e,y:Me,opener:Le,ids:st.targetsFor(T)})),onTouchMove:bn,onTouchEnd:fn,onTouchCancel:fn}}function fe(T){return{onContextMenu:I=>{I.preventDefault(),Fe({x:I.clientX,y:I.clientY,opener:I.currentTarget,ids:He.targetsFor(T)})},onTouchStart:I=>Tn(I,(_e,Me,Le)=>Fe({x:_e,y:Me,opener:Le,ids:He.targetsFor(T)})),onTouchMove:bn,onTouchEnd:fn,onTouchCancel:fn}}function Ee(T){return{onContextMenu:I=>{I.preventDefault(),Wn({x:I.clientX,y:I.clientY,opener:I.currentTarget,ids:[T.id]})},onTouchStart:I=>Tn(I,(_e,Me,Le)=>Wn({x:_e,y:Me,opener:Le,ids:[T.id]})),onTouchMove:bn,onTouchEnd:fn,onTouchCancel:fn}}const Qe=o.filter(T=>T.state!=="closed").length,Tt=Ct?[{id:"close",label:Ct.ids.length>1?`Закрыть проекты (${Ct.ids.length})`:"Закрыть проект",onSelect:()=>{N(Ct.ids),st.clear()}}]:[],Et=Ct?"закрытие не удаляет проект: каталог и история сессий остаются на диске — открыть его снова можно кнопкой «+ Проект»."+(g&&Ct.ids.includes(g)&&Qe>0?` в нём сейчас незавершённых сессий: ${Qe} — при закрытии они остановятся на хосте.`:""):void 0,xn=Ke?ce.find(T=>T.id===Ke.ids[0]):void 0,en=(xn==null?void 0:xn.pinned)!==!0,qt=Ke?[...Ke.ids.length===1?[{id:"rename",label:"Переименовать",onSelect:()=>ae(Ke.ids[0])}]:[],{id:"pin",label:en?Ke.ids.length>1?`Закрепить (${Ke.ids.length})`:"Закрепить":Ke.ids.length>1?`Открепить (${Ke.ids.length})`:"Открепить",onSelect:()=>{xn&&_(xn.workspaceId,Ke.ids,en),He.clear()}},{id:"archive",label:Ke.ids.length>1?`Убрать в архив (${Ke.ids.length})`:"Убрать в архив",onSelect:()=>{H(g,Ke.ids),He.clear()}}]:[],En=Ke?qy:void 0,pt=dt?Re.find(T=>T.id===dt.ids[0]):void 0,_n=dt?[{id:"rename",label:"Переименовать",onSelect:()=>ae(dt.ids[0])},{id:"unpin",label:"Открепить",onSelect:()=>{pt&&_(pt.workspaceId,[pt.id],!1)}},{id:"archive",label:"Убрать в архив",onSelect:()=>{pt&&H(pt.workspaceId,[pt.id])}}]:[];return c.jsxs("aside",{className:s?"sidebar sidebar--open":"sidebar",children:[c.jsxs("div",{className:"sidebar__head",children:[c.jsx("span",{className:l?"dot dot--on":"dot",title:i}),c.jsx("span",{className:"brand",children:"Claude Code Visual"}),c.jsx("button",{className:"theme-btn","aria-pressed":P==="pinned",title:P==="pinned"?"Показать все проекты и сессии":"Показать только закреплённые","aria-label":P==="pinned"?"Панель закреплённых сессий включена. Показать все проекты и сессии":"Показать только закреплённые сессии",onClick:xe,children:c.jsx(Zb,{})}),c.jsx("button",{className:"theme-btn",title:`Тема: ${Iy[re]}`,"aria-label":`Тема: ${Iy[re]}. Переключить`,onClick:he,children:c.jsx(D1,{mode:re})})]}),c.jsxs("div",{className:"fssearch fssearch--sidebar",children:[c.jsx(R1,{}),c.jsx("input",{className:"fssearch__input",type:"text",value:me,spellCheck:!1,placeholder:"Проект или сессия…","aria-label":"Поиск по проектам и сессиям",onChange:T=>Ne(T.target.value),onKeyDown:T=>{T.stopPropagation(),T.key==="Escape"&&(T.preventDefault(),me?Ne(""):T.currentTarget.blur())}}),me&&c.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>Ne(""),children:"✕"})]}),c.jsx("div",{className:"sidebar__scroll",children:P==="pinned"?c.jsxs(c.Fragment,{children:[Re.length===0&&c.jsx("div",{className:"row",children:c.jsx("span",{className:"row__meta",children:j?"Ничего не найдено":"закрепите сессию через её меню (правый клик или долгое нажатие) — она останется под рукой из любого проекта"})}),Re.map(T=>c.jsx("div",{className:T.id===m?"row row--active":"row",...F===T.id?{}:{title:"Действия со строкой — правый клик или долгое нажатие",...Ee(T)},children:F===T.id?c.jsx("div",{className:"row__main",children:c.jsx(Dc,{value:T.title??"",onCommit:I=>{k(T,I),ae(null)},onCancel:()=>ae(null)})}):c.jsxs("button",{className:"row__main",onClick:()=>{Un()||C(T)},children:[c.jsx(lh,{title:T.title??"Без названия",pinned:!1,projectName:ve(T.workspaceId),projectPath:Te(T.workspaceId)}),c.jsx(Xy,{session:T,tail:new Date(T.updatedAt).toLocaleString()})]})},T.id))]}):c.jsxs(c.Fragment,{children:[c.jsx(nh,{title:"Проекты",count:V.length,open:Ze("workspaces"),onToggle:()=>it("workspaces")}),Ze("workspaces")&&c.jsxs(c.Fragment,{children:[V.length===0&&c.jsx("div",{className:"row",children:c.jsx("span",{className:"row__meta",children:j?"Ничего не найдено":"Пока ни одного"})}),V.map(T=>c.jsx("div",{className:Gy(T.id===g,st.selected.includes(T.id)),...J(T),children:c.jsxs("button",{className:"row__main",onClick:I=>{Un()||st.click(I,T,()=>b(T.id))},children:[c.jsxs("span",{className:"row__title",children:[T.name,T.hasClaudeMd&&" ·"]}),c.jsx("span",{className:"row__meta",title:T.path,children:T.path})]})},T.id))]}),g&&c.jsxs(c.Fragment,{children:[c.jsx(nh,{title:"Сессии",count:ce.length,open:Ze("sessions"),onToggle:()=>it("sessions")}),Ze("sessions")&&c.jsxs(c.Fragment,{children:[ce.length===0&&c.jsx("div",{className:"row",children:c.jsx("span",{className:"row__meta",children:j?"Ничего не найдено":"Пока ни одной"})}),ce.map(T=>c.jsx("div",{className:Gy(T.id===m,He.selected.includes(T.id)),...F===T.id?{}:fe(T),children:F===T.id?c.jsx("div",{className:"row__main",children:c.jsx(Dc,{value:T.title??"",onCommit:I=>{k(T,I),ae(null)},onCancel:()=>ae(null)})}):c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:"row__main",onClick:I=>{Un()||He.click(I,T,()=>x(T))},children:[c.jsx(lh,{title:T.title??"Без названия",pinned:T.pinned===!0,projectName:ve(T.workspaceId),projectPath:Te(T.workspaceId)}),c.jsx(Xy,{session:T,tail:new Date(T.updatedAt).toLocaleString()})]}),c.jsx("button",{className:"row__edit",title:"Переименовать","aria-label":"Переименовать сессию",onClick:()=>{Un()||ae(T.id)},children:"✎"})]})},T.id))]}),d.length>0&&c.jsxs(c.Fragment,{children:[c.jsx(nh,{title:"Архив",count:oe.length,open:Ze("archive"),onToggle:()=>it("archive"),hint:"сессии без обращения дольше двух суток уезжают сюда сами; ничего не удаляется"}),Ze("archive")&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"row",children:c.jsx("span",{className:"row__meta",children:"сюда сами уезжают сессии без обращения дольше двух суток; транскрипт остаётся на диске, ничего не удаляется"})}),oe.length===0&&c.jsx("div",{className:"row",children:c.jsx("span",{className:"row__meta",children:j?"Ничего не найдено":"Пока пусто"})}),oe.map(T=>c.jsxs("div",{className:T.id===m?"row row--active":"row",children:[c.jsxs("button",{className:"row__main",onClick:()=>x(T),children:[c.jsx(lh,{title:T.title??"Без названия",pinned:!1,projectName:ve(T.workspaceId),projectPath:Te(T.workspaceId)}),c.jsx("span",{className:"row__meta",children:B1(T)})]}),c.jsx("button",{className:"row__restore",title:"Вернуть сессию из архива",onClick:()=>B([T.id]),children:"Вернуть"})]},T.id))]})]})]})]})}),c.jsxs("div",{className:"sidebar__foot",children:[c.jsxs("button",{className:"account-btn sidebar__wide",title:"Аккаунт Claude",onClick:Q,children:[c.jsx("span",{className:A!=null&&A.loggedIn?"dot dot--on":"dot"}),c.jsx("span",{className:"account-btn__id",children:A===null?"Аккаунт":A.loggedIn?A.email||"Вход выполнен":"Войти в аккаунт"}),(A==null?void 0:A.plan)&&c.jsx("span",{className:"chip",children:A.plan})]}),M&&c.jsxs("button",{className:"account-btn sidebar__wide",title:"Доступ с телефона и из браузера",onClick:M,children:[c.jsx("span",{className:L!=null&&L.connected?"dot dot--on":"dot"}),c.jsx("span",{className:"account-btn__id",children:L===null?"Удалённый доступ":L.paired?L.connected?L.name||"Удалённый доступ включён":"Удалённый доступ · нет связи":"Удалённый доступ"}),(L==null?void 0:L.connected)&&L.clients>0&&c.jsx("span",{className:"chip",children:L.clients})]}),c.jsx("button",{className:"btn btn--ghost sidebar__wide",disabled:!$,title:"MCP-серверы и плагины",onClick:()=>$==null?void 0:$(),children:"Расширения"}),c.jsx("button",{className:"btn btn--ghost sidebar__wide",title:"Настройки приложения",onClick:W,children:"Настройки"}),c.jsx("button",{className:"btn btn--ghost",onClick:K,children:"+ Проект"}),c.jsx("button",{className:"btn btn--primary",onClick:O,disabled:!g,children:"+ Сессия"})]}),Ct&&c.jsx(So,{x:Ct.x,y:Ct.y,items:Tt,note:Et,onClose:Zt}),Ke&&c.jsx(So,{x:Ke.x,y:Ke.y,items:qt,note:En,onClose:ut}),dt&&c.jsx(So,{x:dt.x,y:dt.y,items:_n,note:qy,onClose:dn})]})}function Gy(s,l){const i=["row"];return s&&i.push("row--active"),l&&i.push("row--selected"),i.join(" ")}function Yy(s){const[l,i]=S.useState([]),r=S.useRef(null);function o(){i([]),r.current=null}function d(g,m,b){if(g.ctrlKey||g.metaKey){i(x=>x.includes(m.id)?x.filter(k=>k!==m.id):[...x,m.id]),r.current=m.id;return}if(g.shiftKey&&r.current){const x=s.findIndex(_=>_.id===r.current),k=s.findIndex(_=>_.id===m.id);if(x!==-1&&k!==-1){const[_,C]=x<k?[x,k]:[k,x];i(s.slice(_,C+1).map(N=>N.id));return}}o(),r.current=m.id,b()}function h(g){return l.includes(g.id)?l:(i([g.id]),r.current=g.id,[g.id])}return{selected:l,click:d,targetsFor:h,clear:o}}function nh({title:s,count:l,open:i,onToggle:r,hint:o}){const d=i?`Свернуть «${s}»`:`Развернуть «${s}»`;return c.jsxs("button",{className:"sidebar__section sidebar__section--btn","aria-expanded":i,title:o?`${d} — ${o}`:d,onClick:r,children:[c.jsx(C1,{open:i}),c.jsx("span",{className:"sidebar__section-name",children:s}),c.jsx("span",{className:"sidebar__count",children:l})]})}function C1({open:s}){return c.jsx("svg",{className:s?"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:c.jsx("path",{d:"M6 3.5 10.5 8 6 12.5"})})}function Zb({className:s}){return c.jsxs("svg",{className:s,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("rect",{x:"4.5",y:"2.4",width:"7",height:"4.2",rx:"1.6"}),c.jsx("path",{d:"M5.4 6.6 8 12.2 10.6 6.6"}),c.jsx("path",{d:"M8 12.2v1.4"})]})}function R1(){return c.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[c.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),c.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}function M1(){try{const s=localStorage.getItem(Qb);if(s===null)return["archive"];const l=JSON.parse(s);return Array.isArray(l)?l.filter(i=>i==="workspaces"||i==="sessions"||i==="archive"):["archive"]}catch{return["archive"]}}function O1(){try{return localStorage.getItem($b)==="pinned"?"pinned":"default"}catch{return"default"}}const Iy={system:"как в системе",light:"светлая",dark:"тёмная"};function D1({mode:s}){const l={viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};return s==="dark"?c.jsx("svg",{...l,children:c.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"})}):s==="light"?c.jsxs("svg",{...l,children:[c.jsx("circle",{cx:"8",cy:"8",r:"3.1"}),c.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"})]}):c.jsxs("svg",{...l,children:[c.jsx("rect",{x:"1.8",y:"2.6",width:"12.4",height:"8.4",rx:"1.4"}),c.jsx("path",{d:"M5.6 13.4h4.8"})]})}function z1(s){switch(s.state){case"running":return"работает";case"waiting_permission":return"ждёт разрешения";case"idle":return L1(s.lastTurn);case"starting":return"запускается";case"reconnecting":return"переподключается";case"error":return"ошибка";case"closed":return"на диске"}}function L1(s){switch(s){case"interrupted":return"прервана";case"stopped":return"остановлена";case"failed":return"оборвалась";case"completed":return"готова";case null:return"ждёт задачу"}}function U1(s){switch(s.state){case"running":return"running";case"starting":return"starting";case"reconnecting":return"reconnecting";case"waiting_permission":return"waiting";case"idle":return H1(s.lastTurn);case"error":return"error";case"closed":return"closed"}}function H1(s){switch(s){case"interrupted":case"stopped":return"halted";case"failed":return"error";case"completed":return"ready";case null:return"fresh"}}function Xy({session:s,tail:l}){return c.jsxs("span",{className:"row__meta",children:[c.jsxs("span",{className:`row__state row__state--${U1(s)}`,children:[c.jsx("span",{className:"row__state-dot","aria-hidden":"true"}),z1(s)]})," · ",l]})}function lh({title:s,pinned:l,projectName:i,projectPath:r}){return c.jsxs("span",{className:"row__head",children:[c.jsxs("span",{className:"row__title",children:[l&&c.jsx(Zb,{className:"row__pin"}),s]}),c.jsx("span",{className:"row__project",title:r,children:i})]})}function B1(s){const l=s.archivedAuto?"сама, по сроку молчания":"убрана вручную";return s.archivedAt?`${new Date(s.archivedAt).toLocaleString()} · ${l}`:l}const Vy=3,q1=15e5;function Kb(s,l){if(!l||typeof l!="object")return null;const i=l,r=typeof i.file_path=="string"?i.file_path:"";if(!r)return null;if(s==="Write"){if(typeof i.content!="string")return null;const o=ah(i.content).map(d=>({type:"add",text:d}));return{kind:"create",filePath:r,rows:o,added:o.length,removed:0,note:"файл записывается целиком"}}if(s==="Edit"){if(typeof i.old_string!="string"||typeof i.new_string!="string")return null;const o=X1(G1(ah(i.old_string),ah(i.new_string)));return{kind:"edit",filePath:r,rows:o,added:o.filter(d=>d.type==="add").length,removed:o.filter(d=>d.type==="del").length,note:i.replace_all===!0?"все вхождения":null}}return null}function ah(s){if(s==="")return[];const l=s.split(/\r?\n/);return l.length>1&&l[l.length-1]===""&&l.pop(),l}function G1(s,l){let i=0;for(;i<s.length&&i<l.length&&s[i]===l[i];)i++;let r=s.length,o=l.length;for(;r>i&&o>i&&s[r-1]===l[o-1];)r--,o--;const d=h=>({type:"ctx",text:h});return[...s.slice(0,i).map(d),...Y1(s.slice(i,r),l.slice(i,o)),...s.slice(r).map(d)]}function Y1(s,l){if(s.length===0&&l.length===0)return[];if(s.length===0)return l.map(x=>({type:"add",text:x}));if(l.length===0)return s.map(x=>({type:"del",text:x}));if((s.length+1)*(l.length+1)>q1)return[...s.map(x=>({type:"del",text:x})),...l.map(x=>({type:"add",text:x}))];const i=s.length,r=l.length,o=r+1,d=new Uint32Array((i+1)*o),h=(x,k)=>d[x*o+k]??0;for(let x=i-1;x>=0;x--)for(let k=r-1;k>=0;k--)d[x*o+k]=s[x]===l[k]?h(x+1,k+1)+1:Math.max(h(x+1,k),h(x,k+1));const g=[];let m=0,b=0;for(;m<i&&b<r;){const x=s[m],k=l[b];x===k?(g.push({type:"ctx",text:x}),m++,b++):h(m+1,b)>=h(m,b+1)?(g.push({type:"del",text:x}),m++):(g.push({type:"add",text:k}),b++)}for(;m<i;)g.push({type:"del",text:s[m++]});for(;b<r;)g.push({type:"add",text:l[b++]});return I1(g)}function I1(s){const l=[];let i=[];function r(){l.push(...i.filter(o=>o.type==="del")),l.push(...i.filter(o=>o.type==="add")),i=[]}for(const o of s)o.type==="ctx"?(r(),l.push(o)):i.push(o);return r(),l}function X1(s){if(!s.some(d=>d.type!=="ctx"))return s;const l=s.map(()=>!1);s.forEach((d,h)=>{if(d.type!=="ctx")for(let g=Math.max(0,h-Vy);g<=Math.min(s.length-1,h+Vy);g++)l[g]=!0});const i=[];let r=[];function o(){r.length===1?i.push(...r):r.length>1&&i.push({type:"gap",text:`⋯ ${r.length} ${V1(r.length)} без изменений`}),r=[]}return s.forEach((d,h)=>{l[h]?(o(),i.push(d)):r.push(d)}),o(),i}function V1(s){const l=s%100;if(l>=11&&l<=14)return"строк";switch(s%10){case 1:return"строка";case 2:case 3:case 4:return"строки";default:return"строк"}}async function Uh(s){try{return await navigator.clipboard.writeText(s),!0}catch{}const l=document.createElement("textarea");l.value=s,l.setAttribute("readonly",""),l.style.position="fixed",l.style.opacity="0",document.body.appendChild(l);try{return l.select(),document.execCommand("copy")}catch{return!1}finally{l.remove()}}const Hh=1600,wi="Копировать",gr="Скопировано";function Jb({text:s,hint:l,className:i}){const[r,o]=S.useState(!1);return S.useEffect(()=>{if(!r)return;const d=setTimeout(()=>o(!1),Hh);return()=>clearTimeout(d)},[r]),S.useEffect(()=>o(!1),[s]),c.jsx("button",{type:"button",className:"copybtn"+(r?" copybtn--done":"")+(i?` ${i}`:""),"aria-label":r?gr:`${wi} ${l}`,title:r?gr:`${wi} ${l}`,onClick:()=>{Uh(s).then(d=>{d&&o(!0)})},children:r?gr:wi})}function Bh({diff:s}){return c.jsxs("div",{className:"diff",children:[c.jsxs("div",{className:"diff__head",children:[c.jsx("span",{className:"diff__path",title:s.filePath,children:s.filePath}),c.jsxs("span",{className:"diff__stat",children:[s.added>0&&c.jsxs("span",{className:"diff__stat--add",children:["+",s.added]}),s.removed>0&&c.jsxs("span",{className:"diff__stat--del",children:["−",s.removed]})]})]}),s.note&&c.jsx("div",{className:"diff__note",children:s.note}),c.jsx("div",{className:"diff__body",children:s.rows.length===0?c.jsx("div",{className:"diff__row diff__row--gap",children:c.jsx("span",{className:"diff__text",children:"пустое содержимое"})}):s.rows.map((l,i)=>c.jsxs("div",{className:`diff__row diff__row--${l.type}`,children:[c.jsx("span",{className:"diff__mark","aria-hidden":"true",children:l.type==="add"?"+":l.type==="del"?"−":""}),c.jsx("span",{className:"diff__text",children:l.text===""?" ":l.text})]},i))})]})}function Q1({waiting:s}){const[l,i]=S.useState(0);return S.useEffect(()=>{const r=window.setInterval(()=>i(o=>o+1),1e3);return()=>window.clearInterval(r)},[]),c.jsxs("div",{className:s?"work work--wait":"work",children:[c.jsxs("span",{className:"work__dots","aria-hidden":"true",children:[c.jsx("span",{className:"work__dot"}),c.jsx("span",{className:"work__dot"}),c.jsx("span",{className:"work__dot"})]}),c.jsx("span",{className:"work__label",children:s?"ждёт разрешения":"думает"}),!s&&c.jsxs("span",{className:"work__time",children:[l," с"]})]})}function qh({items:s,busy:l,waiting:i,history:r=[],historyHasMore:o=!1,historyLoading:d=!1,onLoadHistory:h,sessionId:g,empty:m="Сессия пуста. Опишите задачу — Claude Code работает в каталоге проекта с полным набором инструментов."}){const b=S.useRef(null),x=S.useRef(null),k=S.useRef(!0),_=S.useRef(null),C=S.useRef(null),N=S.useRef(!1);S.useEffect(()=>{k.current=!0,_.current=null,N.current=!1,C.current!==null&&(clearTimeout(C.current),C.current=null)},[g]),S.useEffect(()=>{const K=b.current,O=x.current;if(!K||!O)return;function $(L){!K||L===K.scrollTop||(N.current=!0,K.scrollTop=L)}function A(){if(!K)return;const L=_.current;if(L){const M=$y(K,L.id);if(M){const W=M.getBoundingClientRect().top-K.getBoundingClientRect().top;$(K.scrollTop+(W-L.top))}C.current!==null&&clearTimeout(C.current),C.current=setTimeout(()=>{_.current=null},500);return}k.current&&$(K.scrollHeight)}const Q=new ResizeObserver(A);return Q.observe(O),()=>{Q.disconnect(),C.current!==null&&clearTimeout(C.current)}},[]);function H(){const K=b.current;if(K){if(N.current){N.current=!1;return}k.current=K.scrollHeight-K.scrollTop-K.clientHeight<80}}function B(){if(d)return;const K=b.current,O=r[0];if(K&&O){const $=$y(K,O.id);$&&(_.current={id:O.id,top:$.getBoundingClientRect().top-K.getBoundingClientRect().top})}h==null||h()}return c.jsx("div",{className:"transcript",ref:b,onScroll:H,children:c.jsxs("div",{className:"stream",ref:x,children:[o&&c.jsx("button",{type:"button",className:"transcript__more",onClick:B,disabled:d,children:d?"Загружаем…":"Показать более раннее"}),r.map(K=>c.jsx(Qy,{item:K},K.id)),r.length>0&&s.length>0&&c.jsx("div",{className:"transcript__divider",children:c.jsx("span",{children:"дальше — сессия открыта заново"})}),r.length===0&&s.length===0&&c.jsx("p",{className:"empty",children:m}),s.map(K=>c.jsx(Qy,{item:K},K.id)),l&&c.jsx(Q1,{waiting:i})]})})}function Qy({item:s}){switch(s.kind){case"user":return c.jsx("div",{className:"msg--user","data-item-id":s.id,children:s.text});case"assistant":return c.jsxs("div",{className:"msg--assistant","data-item-id":s.id,children:[c.jsx($1,{text:s.text}),s.streaming&&c.jsx("span",{className:"caret"}),s.text.trim()!==""&&c.jsx("div",{className:"msg--assistant__foot",children:c.jsx(Jb,{text:s.text,hint:"ответ целиком"})})]});case"thinking":return c.jsx("div",{className:"thinking","data-item-id":s.id,children:s.text});case"tool":return c.jsx(K1,{item:s});case"result":return c.jsxs("div",{className:"result-line","data-item-id":s.id,children:[c.jsx("span",{children:s.isError?"✗ "+s.subtype:"✓ готово"}),c.jsxs("span",{children:[(s.durationMs/1e3).toFixed(1)," с"]}),s.costUsd!==null&&c.jsxs("span",{children:["$",s.costUsd.toFixed(4)]}),c.jsxs("span",{children:["↑",Ky(s.inputTokens)," ↓",Ky(s.outputTokens)]})]});case"notice":return c.jsx("div",{className:s.tone==="error"?"notice notice--error":"notice","data-item-id":s.id,children:s.text})}}function $y(s,l){const i=s.querySelectorAll("[data-item-id]");for(const r of i)if(r.dataset.itemId===l)return r;return null}function $1({text:s}){const[l,i]=S.useState(""),r=S.useRef([]);S.useEffect(()=>{let d=!1;return Xb(s).then(h=>{d||i(Z1(h))}),()=>{d=!0}},[s]),S.useEffect(()=>{const d=r.current;return()=>d.forEach(h=>clearTimeout(h))},[]);function o(d){var m,b;const h=d.target.closest(".codeblock__copy");if(!(h instanceof HTMLElement))return;const g=((b=(m=h.parentElement)==null?void 0:m.querySelector("pre"))==null?void 0:b.textContent)??"";g!==""&&Uh(g).then(x=>{if(!x)return;h.textContent=gr,h.setAttribute("aria-label",gr),h.classList.add("copybtn--done");const k=window.setTimeout(()=>{h.isConnected&&(h.textContent=wi,h.setAttribute("aria-label",vh),h.classList.remove("copybtn--done"))},Hh);r.current.push(k)})}return c.jsx("div",{className:"markdown-preview msg--assistant__body",onClick:o,dangerouslySetInnerHTML:{__html:l}})}const vh=`${wi} блок кода`;function Z1(s){if(!s.includes("<pre"))return s;const l=new DOMParser().parseFromString(s,"text/html");for(const i of l.body.querySelectorAll("pre")){const r=l.createElement("div");r.className="codeblock",i.replaceWith(r),r.append(i);const o=l.createElement("button");o.type="button",o.className="copybtn codeblock__copy",o.setAttribute("aria-label",vh),o.title=vh,o.textContent=wi,r.append(o)}return l.body.innerHTML}function K1({item:s}){const[l,i]=S.useState(!1),r=s.result===null,o=Kb(s.name,s.input),d=s.name==="AskUserQuestion"?W1(s.input):null;return c.jsxs("div",{className:"tool"+(s.isError?" tool--error":"")+(s.awaitingPermission?" tool--wait":""),"data-item-id":s.id,children:[c.jsxs("button",{className:"tool__head",onClick:()=>i(h=>!h),children:[c.jsx("span",{className:"tool__name",children:s.name}),c.jsx("span",{className:"tool__arg",children:d?F1(d):J1(s.input)}),c.jsx("span",{className:"tool__status",children:r?"…":s.isError?"ошибка":l?"▴":"▾"})]}),l&&c.jsxs("div",{className:"tool__body",children:[d?c.jsx(P1,{questions:d,answers:s.answers}):o?c.jsx(Bh,{diff:o}):c.jsx(Zy,{text:JSON.stringify(s.input,null,2),hint:"аргументы вызова"}),s.result!==null&&(!d||s.isError)&&c.jsx(Zy,{text:s.result,hint:"результат вызова",style:{marginTop:10}})]})]})}function Zy({text:s,hint:l,style:i}){return c.jsxs("div",{className:"codeblock",style:i,children:[c.jsx("pre",{className:"code",children:s}),c.jsx(Jb,{text:s,hint:l,className:"codeblock__copy"})]})}function J1(s){if(!s||typeof s!="object")return"";const l=s;for(const i of["file_path","command","pattern","path","url","prompt"]){const r=l[i];if(typeof r=="string")return r.replace(/\s+/g," ").slice(0,160)}return JSON.stringify(l).slice(0,160)}function F1(s){var i;const l=s.map(r=>r.header).filter(r=>r.length>0);return l.length===s.length?l.join(" · "):((i=s[0])==null?void 0:i.question.replace(/\s+/g," ").slice(0,160))??""}function W1(s){if(typeof s!="object"||s===null)return null;const l=s.questions;if(!Array.isArray(l)||l.length===0)return null;const i=[];for(const r of l){if(typeof r!="object"||r===null)return null;const{question:o,header:d,options:h,multiSelect:g}=r;if(typeof o!="string"||!Array.isArray(h)||h.length===0)return null;const m=[];for(const b of h){if(typeof b!="object"||b===null)return null;const{label:x,description:k,preview:_}=b;if(typeof x!="string"||typeof k!="string")return null;m.push({label:x,description:k,...typeof _=="string"?{preview:_}:{}})}i.push({question:o,header:typeof d=="string"?d:"",options:m,multiSelect:g===!0})}return i}function P1({questions:s,answers:l}){return c.jsx("div",{className:"tool__questions",children:s.map((i,r)=>c.jsxs("div",{className:"tool__question",children:[c.jsxs("div",{className:"tool__question-head",children:[i.header&&c.jsx("span",{className:"chip chip--accent",children:i.header}),c.jsx("span",{className:"tool__question-text",children:i.question})]}),c.jsx("div",{className:"tool__question-answer",children:l!=null&&l[i.question]?c.jsx("span",{className:"tool__answer-value",children:l[i.question]}):c.jsx("span",{className:"tool__answer-empty",children:"не отвечено"})})]},r))})}function Ky(s){return s>=1e3?`${(s/1e3).toFixed(1)}k`:String(s)}const eS="ccv.dictation.lang",Jy="ru-RU";function tS(s){try{return Function.prototype.toString.call(s).includes("[native code]")}catch{return!1}}function Fy(){const s=window,l=[s.SpeechRecognition,s.webkitSpeechRecognition].filter(r=>typeof r=="function"),i=l.find(tS);return!i&&l.length>0&&Jl("распознавание подменено: родной реализации в странице нет"),i??l[0]??null}function Fb(){var s;try{return((s=localStorage.getItem(eS))==null?void 0:s.trim())||Jy}catch{return Jy}}function Jl(s,l){l===void 0?console.debug(`[dictation] ${s}`):console.debug(`[dictation] ${s}`,l)}const nS=3,lS=400,aS=5,sS=250,iS=2e3,rS=2e4;async function cS(){try{return(await navigator.permissions.query({name:"microphone"})).state==="granted"}catch{return!1}}const uS={"not-allowed":"Браузер не дал доступ к микрофону","service-not-allowed":"Браузер не дал доступ к микрофону","audio-capture":"Микрофон не найден",network:"Сервис распознавания недоступен","language-not-supported":`Распознавание не знает языка ${Fb()}`};function oS(s){const[l]=S.useState(()=>Fy()!==null),[i,r]=S.useState(!1),[o,d]=S.useState(null),h=S.useRef(null),g=S.useRef(!1),m=S.useRef(!1),b=S.useRef(s),x=S.useRef({openedAt:0,audio:!1,heard:!1,everHeard:!1,silent:0,dead:0,lastError:"",warned:!1}),k=S.useRef(null),_=S.useRef(!1),C=S.useRef(null),N=S.useCallback(()=>{C.current&&clearTimeout(C.current),C.current=null},[]),H=S.useCallback(()=>{N();const A=async Q=>{if(C.current=null,!(!g.current||_.current)){if(!Q&&!await cS()){if(Jl("ждём ответа на запрос доступа к микрофону"),!g.current||_.current)return;C.current=setTimeout(()=>void A(!0),rS);return}Jl("движок не ответил на start()"),g.current=!1,r(!1),d("Распознавание не отвечает — проверьте расширения браузера и доступ к микрофону")}};C.current=setTimeout(()=>void A(!1),iS)},[N]);S.useEffect(()=>{b.current=s}),S.useEffect(()=>{const A=Fy();if(!A)return;const Q=new A;return Q.lang=Fb(),Q.continuous=!0,Q.interimResults=!0,Q.onstart=()=>{Jl("сессия открыта"),_.current=!0,N(),r(!0)},Q.onaudiostart=()=>{Jl("пошёл звук с микрофона"),x.current.audio=!0},Q.onresult=L=>{var he;if(m.current)return;let M="",W="";for(let F=L.resultIndex;F<L.results.length;F++){const ae=L.results[F];if(!ae)continue;const me=((he=ae[0])==null?void 0:he.transcript)??"";ae.isFinal?M+=me:W+=me}const re=x.current;re.heard=!0,re.everHeard=!0,Jl("распознано",{final:M,interim:W}),b.current(M,W)},Q.onerror=L=>{x.current.lastError=L.error,Jl("ошибка движка",L.error),!(L.error==="no-speech"||L.error==="aborted")&&(g.current=!1,r(!1),d(uS[L.error]??`Распознавание не работает: ${L.error}`))},Q.onend=()=>{m.current=!1,_.current=!1;const L=x.current,M=Date.now()-L.openedAt;if(Jl("сессия закрыта",{мс:M,звук:L.audio,слова:L.heard,ошибка:L.lastError||null}),!g.current){r(!1);return}if(L.dead=!L.audio&&M<lS?L.dead+1:0,L.dead>=aS){g.current=!1,r(!1),d(L.lastError?`Распознавание не работает: ${L.lastError}`:"Распознавание закрывается сразу после запуска — проверьте доступ к микрофону в настройках сайта");return}L.silent=L.heard?0:L.silent+1,!L.everHeard&&!L.warned&&L.silent>=nS&&(L.warned=!0,d(L.audio?"Микрофон слушает, но речь не распознаётся — проверьте язык диктовки и уровень звука":"С микрофона не идёт звук — проверьте устройство ввода в настройках сайта в браузере")),k.current=setTimeout(()=>{if(k.current=null,!!g.current){L.openedAt=Date.now(),L.audio=!1,L.heard=!1,L.lastError="",H();try{Q.start()}catch{}}},sS)},h.current=Q,()=>{g.current=!1,k.current&&clearTimeout(k.current),k.current=null,N(),Q.onend=null,Q.onresult=null,Q.onerror=null,Q.onstart=null,Q.onaudiostart=null,Q.abort(),h.current=null}},[]);const B=S.useCallback(()=>{var A;if(g.current){if(g.current=!1,Jl("выключение микрофона"),k.current&&clearTimeout(k.current),k.current=null,N(),!_.current){r(!1);return}(A=h.current)==null||A.stop()}},[]),K=S.useCallback(()=>{const A=h.current;if(A){if(!window.isSecureContext){d("Микрофон доступен только по https или с localhost");return}d(null),g.current=!0,m.current=!1,k.current&&clearTimeout(k.current),k.current=null,x.current={openedAt:Date.now(),audio:!1,heard:!1,everHeard:!1,silent:0,dead:0,lastError:"",warned:!1},r(!0),Jl("включение микрофона",{язык:A.lang}),H();try{A.start()}catch(Q){Jl("start() не прошёл",Q)}}},[H]),O=S.useCallback(()=>{g.current?B():K()},[K,B]),$=S.useCallback(()=>{var A;g.current&&_.current&&(m.current=!0,(A=h.current)==null||A.abort())},[]);return{supported:l,listening:i,error:o,toggle:O,stop:B,drop:$}}const fS="(max-width: 860px)",Wy=/^\/(\S*)$/,dS=new Set(["model","permissions"]);function hS(s){return dS.has(s.name)||s.name.startsWith("__")}const pS=new Set(["clear","rename"]),Py=/(?:^|\s)@([^\s@]*)$/,mS=200,gS=100,yS=190;function Wb({disabled:s,busy:l,commands:i,sessionTitle:r,contextResult:o,className:d,placeholder:h,sendLabel:g="Отправить",autoFocus:m=!1,onContextSearch:b,onCommand:x,onSend:k,onInterrupt:_,onEscape:C}){var dn;const N=wh(fS),[H,B]=S.useState(""),[K,O]=S.useState(!1),[$,A]=S.useState(0),Q=S.useRef(null),L=S.useRef(null),M=S.useRef(null),[W,re]=S.useState(0),[he,F]=S.useState([]),[ae,me]=S.useState(-1),Ne=S.useRef(""),[pe,z]=S.useState(""),P=oS(S.useCallback((J,fe)=>{J&&B(Ee=>sh(Ee,J)),z(fe.trim())},[])),te=pe?sh(H,pe):H;S.useEffect(()=>{P.listening||pe===""||(B(J=>sh(J,pe)),z(""))},[P.listening,pe]),S.useEffect(()=>{var J;m&&((J=Q.current)==null||J.focus())},[m]);const xe=s?"Выберите сессию":h??"Опишите задачу… («/» — команды, «@» — файлы)",we=S.useRef(0),j=S.useCallback(J=>{const fe=parseFloat(getComputedStyle(J).maxHeight),Ee=Number.isFinite(fe)&&fe>0?fe:yS;J.style.height="auto";const Qe=J.scrollHeight;J.style.height=`${Math.min(Qe,Ee)}px`,J.style.overflowY=Qe>Ee?"auto":"hidden";const Tt=M.current;Tt&&(M.current=null,J.setSelectionRange(Tt[0],Tt[1]))},[]);S.useEffect(()=>{const J=Q.current;J&&j(J)},[te,xe,s,j]),S.useEffect(()=>{const J=Q.current;if(!J)return;const fe=new ResizeObserver(([Ee])=>{const Qe=Ee==null?void 0:Ee.contentRect.width;Qe===void 0||Math.abs(Qe-we.current)<1||(we.current=Qe,j(J))});return fe.observe(J),()=>fe.disconnect()},[j]);const V=P.stop;S.useEffect(()=>{s&&V()},[s,V]);const ce=S.useMemo(()=>P.error?{ok:!1,message:P.error}:null,[P.error]),oe=S.useMemo(()=>{var Ee;const J=(Ee=Wy.exec(H))==null?void 0:Ee[1];if(J===void 0)return[];const fe=J.toLowerCase();return i.filter(Qe=>!hS(Qe)&&ih(Qe,fe)<Pb).sort((Qe,Tt)=>ih(Qe,fe)-ih(Tt,fe))},[H,i]),ve=!K&&oe.length>0,Te=Math.min($,oe.length-1),Re=K?null:((dn=Py.exec(te.slice(0,W)))==null?void 0:dn[1])??null,it=S.useRef(b);it.current=b,S.useEffect(()=>{if(Re===null||Re===""||Re.endsWith("/")){it.current(Re);return}const J=setTimeout(()=>it.current(Re),mS);return()=>clearTimeout(J)},[Re]);const Ze=Re!==null&&(o==null?void 0:o.query)===Re,st=Ze?o.entries:[],He=Re!==null,Ct=He&&!Ze,Je=Math.min($,Math.max(st.length-1,0));S.useEffect(()=>{var fe,Ee;if(!ve&&!He)return;const J=ve?Te:Je;(Ee=(fe=L.current)==null?void 0:fe.children[J])==null||Ee.scrollIntoView({block:"nearest"})},[ve,He,Te,Je]);function Ke(J,fe){var Ee;B(J),re(fe),M.current=[fe,fe],A(0),O(!1),pe!==""&&(z(""),P.drop()),(Ee=Q.current)==null||Ee.focus()}function Fe(){B(""),z(""),A(0),re(0),O(!1),me(-1),Ne.current="",P.drop()}function dt(J){const fe=J.trim();!fe||s||(k(fe),F(Ee=>[fe,...Ee.filter(Qe=>Qe!==fe)].slice(0,gS)),Fe())}function Wn(J){if(J<-1||J>=he.length)return;ae===-1&&(Ne.current=H);const fe=J===-1?Ne.current:he[J]??"";me(J),Ke(fe,fe.length)}function Bt(){var Qe;const J=((Qe=Q.current)==null?void 0:Qe.selectionStart)??te.length,Ee=`${J>0&&!/\s$/.test(te.slice(0,J))?" ":""}@`;Ke(te.slice(0,J)+Ee+te.slice(J),J+Ee.length)}function Tn(J){var Tt;const fe=(Tt=Py.exec(te.slice(0,W)))==null?void 0:Tt[1];if(fe===void 0)return;const Ee=W-fe.length-1,Qe=J.kind==="dir"?`@${J.path}/`:`@${J.path} `;Ke(te.slice(0,Ee)+Qe+te.slice(W),Ee+Qe.length)}function bn(){var fe;const J=(fe=Wy.exec(te.trim()))==null?void 0:fe[1];if(J&&x(J)){Fe();return}dt(te)}function fn(J,fe){B(J),re(fe),A(0),O(!1),me(-1),pe!==""&&(z(""),P.drop())}function Un(J){var Qe;const fe=pS.has(J.name)?r:null,Ee=`/${J.name} `;B(Ee+(fe??"")),re(Ee.length+((fe==null?void 0:fe.length)??0)),fe&&(M.current=[Ee.length,Ee.length+fe.length]),A(0),(Qe=Q.current)==null||Qe.focus()}function Zt(J){if(x(J.name)){B(""),A(0),O(!1);return}J.argumentHint?Un(J):dt(`/${J.name}`)}function ut(J){if(ve){if(J.key==="ArrowDown")return J.preventDefault(),A(fe=>(Math.min(fe,oe.length-1)+1)%oe.length);if(J.key==="ArrowUp"){J.preventDefault();const fe=oe.length-1;return A(Ee=>(Math.min(Ee,fe)+fe)%oe.length)}if(J.key==="Enter"&&!J.shiftKey){J.preventDefault();const fe=oe[Te];fe&&Zt(fe);return}if(J.key==="Tab"){J.preventDefault();const fe=oe[Te];fe&&Un(fe);return}if(J.key==="Escape"){J.preventDefault(),J.stopPropagation(),O(!0);return}}if(He){if(J.key==="ArrowDown"&&st.length>0)return J.preventDefault(),A(fe=>(Math.min(fe,st.length-1)+1)%st.length);if(J.key==="ArrowUp"&&st.length>0){J.preventDefault();const fe=st.length-1;return A(Ee=>(Math.min(Ee,fe)+fe)%st.length)}if(J.key==="Enter"&&!J.shiftKey||J.key==="Tab"){const fe=st[Je];if(fe){J.preventDefault(),Tn(fe);return}if(J.key==="Tab")return}if(J.key==="Escape"){J.preventDefault(),J.stopPropagation(),O(!0);return}}if((J.key==="ArrowUp"||J.key==="ArrowDown")&&!J.shiftKey){const fe=J.currentTarget,Ee=fe.selectionStart;if(fe.selectionEnd===Ee){const Qe=J.key==="ArrowUp",Tt=Qe?!te.slice(0,Ee).includes(`
116
+ `,_),N=C<0?k.length:C;if(N>_&&r(k.slice(_,N),x),C<0)break;o(),_=C+1}g=b}}Vv(l,i,(b,x,k)=>{m(b,""),m(x,k)},d,h),m(h,"")}class $v{constructor(l,i,r){this.at=l,this.highlighters=i,this.span=r,this.class=""}startSpan(l,i){i!=this.class&&(this.flush(l),l>this.at&&(this.at=l),this.class=i)}flush(l){l>this.at&&this.class&&this.span(this.at,l,this.class)}highlightRange(l,i,r,o,d){let{type:h,from:g,to:m}=l;if(g>=r||m<=i)return;h.isTop&&(d=this.highlighters.filter(C=>!C.scope||C.scope(h)));let b=o,x=Zv(l)||Oc.empty,k=Xv(d,x.tags);if(k&&(b&&(b+=" "),b+=k,x.mode==1&&(o+=(o?" ":"")+k)),this.startSpan(Math.max(i,g),b),x.opaque)return;let _=l.tree&&l.tree.prop(Ht.mounted);if(_&&_.overlay){let C=l.node.enter(_.overlay[0].from+g,1),N=this.highlighters.filter(B=>!B.scope||B.scope(_.tree.type)),H=l.firstChild();for(let B=0,K=g;;B++){let O=B<_.overlay.length?_.overlay[B]:null,$=O?O.from+g:m,A=Math.max(i,K),Q=Math.min(r,$);if(A<Q&&H)for(;l.from<Q&&(this.highlightRange(l,A,Q,o,d),this.startSpan(Math.min(Q,l.to),b),!(l.to>=$||!l.nextSibling())););if(!O||$>r)break;K=O.to+g,K>i&&(this.highlightRange(C.cursor(),Math.max(i,O.from+g),Math.min(r,K),"",N),this.startSpan(Math.min(r,K),b))}H&&l.parent()}else if(l.firstChild()){_&&(o="");do if(!(l.to<=i)){if(l.from>=r)break;this.highlightRange(l,i,r,o,d),this.startSpan(Math.min(r,l.to),b)}while(l.nextSibling());l.parent()}}}function Zv(s){let l=s.type.prop(qb);for(;l&&l.context&&!s.matchContext(l.context);)l=l.next;return l||null}const ge=Bl.define,co=ge(),zs=ge(),zy=ge(zs),Ly=ge(zs),Ls=ge(),uo=ge(Ls),eh=ge(Ls),xa=ge(),hi=ge(xa),pa=ge(),ma=ge(),_h=ge(),Nc=ge(_h),oo=ge(),be={comment:co,lineComment:ge(co),blockComment:ge(co),docComment:ge(co),name:zs,variableName:ge(zs),typeName:zy,tagName:ge(zy),propertyName:Ly,attributeName:ge(Ly),className:ge(zs),labelName:ge(zs),namespace:ge(zs),macroName:ge(zs),literal:Ls,string:uo,docString:ge(uo),character:ge(uo),attributeValue:ge(uo),number:eh,integer:ge(eh),float:ge(eh),bool:ge(Ls),regexp:ge(Ls),escape:ge(Ls),color:ge(Ls),url:ge(Ls),keyword:pa,self:ge(pa),null:ge(pa),atom:ge(pa),unit:ge(pa),modifier:ge(pa),operatorKeyword:ge(pa),controlKeyword:ge(pa),definitionKeyword:ge(pa),moduleKeyword:ge(pa),operator:ma,derefOperator:ge(ma),arithmeticOperator:ge(ma),logicOperator:ge(ma),bitwiseOperator:ge(ma),compareOperator:ge(ma),updateOperator:ge(ma),definitionOperator:ge(ma),typeOperator:ge(ma),controlOperator:ge(ma),punctuation:_h,separator:ge(_h),bracket:Nc,angleBracket:ge(Nc),squareBracket:ge(Nc),paren:ge(Nc),brace:ge(Nc),content:xa,heading:hi,heading1:ge(hi),heading2:ge(hi),heading3:ge(hi),heading4:ge(hi),heading5:ge(hi),heading6:ge(hi),contentSeparator:ge(xa),list:ge(xa),quote:ge(xa),emphasis:ge(xa),strong:ge(xa),link:ge(xa),monospace:ge(xa),strikethrough:ge(xa),inserted:ge(),deleted:ge(),changed:ge(),invalid:ge(),meta:oo,documentMeta:ge(oo),annotation:ge(oo),processingInstruction:ge(oo),definition:Bl.defineModifier("definition"),constant:Bl.defineModifier("constant"),function:Bl.defineModifier("function"),standard:Bl.defineModifier("standard"),local:Bl.defineModifier("local"),special:Bl.defineModifier("special")};for(let s in be){let l=be[s];l instanceof Bl&&(l.name=s)}Gb([{tag:be.link,class:"tok-link"},{tag:be.heading,class:"tok-heading"},{tag:be.emphasis,class:"tok-emphasis"},{tag:be.strong,class:"tok-strong"},{tag:be.keyword,class:"tok-keyword"},{tag:be.atom,class:"tok-atom"},{tag:be.bool,class:"tok-bool"},{tag:be.url,class:"tok-url"},{tag:be.labelName,class:"tok-labelName"},{tag:be.inserted,class:"tok-inserted"},{tag:be.deleted,class:"tok-deleted"},{tag:be.literal,class:"tok-literal"},{tag:be.string,class:"tok-string"},{tag:be.number,class:"tok-number"},{tag:[be.regexp,be.escape,be.special(be.string)],class:"tok-string2"},{tag:be.variableName,class:"tok-variableName"},{tag:be.local(be.variableName),class:"tok-variableName tok-local"},{tag:be.definition(be.variableName),class:"tok-variableName tok-definition"},{tag:be.special(be.variableName),class:"tok-variableName2"},{tag:be.definition(be.propertyName),class:"tok-propertyName tok-definition"},{tag:be.typeName,class:"tok-typeName"},{tag:be.namespace,class:"tok-namespace"},{tag:be.className,class:"tok-className"},{tag:be.macroName,class:"tok-macroName"},{tag:be.propertyName,class:"tok-propertyName"},{tag:be.operator,class:"tok-operator"},{tag:be.comment,class:"tok-comment"},{tag:be.meta,class:"tok-meta"},{tag:be.invalid,class:"tok-invalid"},{tag:be.punctuation,class:"tok-punctuation"}]);const Kv="modulepreload",Jv=function(s,l){return new URL(s,l).href},Uy={},Xe=function(l,i,r){let o=Promise.resolve();if(i&&i.length>0){let h=function(x){return Promise.all(x.map(k=>Promise.resolve(k).then(_=>({status:"fulfilled",value:_}),_=>({status:"rejected",reason:_}))))};const g=document.getElementsByTagName("link"),m=document.querySelector("meta[property=csp-nonce]"),b=(m==null?void 0:m.nonce)||(m==null?void 0:m.getAttribute("nonce"));o=h(i.map(x=>{if(x=Jv(x,r),x in Uy)return;Uy[x]=!0;const k=x.endsWith(".css"),_=k?'[rel="stylesheet"]':"";if(!!r)for(let H=g.length-1;H>=0;H--){const B=g[H];if(B.href===x&&(!k||B.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${x}"]${_}`))return;const N=document.createElement("link");if(N.rel=k?"stylesheet":Kv,k||(N.as="script"),N.crossOrigin="",N.href=x,b&&N.setAttribute("nonce",b),document.head.appendChild(N),k)return new Promise((H,B)=>{N.addEventListener("load",H),N.addEventListener("error",()=>B(new Error(`Unable to preload CSS for ${x}`)))})}))}function d(h){const g=new Event("vite:preloadError",{cancelable:!0});if(g.payload=h,window.dispatchEvent(g),!g.defaultPrevented)throw h}return o.then(h=>{for(const g of h||[])g.status==="rejected"&&d(g.reason);return l().catch(d)})},Yb={js:async()=>(await Xe(async()=>{const{javascript:s}=await import("./index-BybHqs37.js");return{javascript:s}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({jsx:!0}),cjs:async()=>(await Xe(async()=>{const{javascript:s}=await import("./index-BybHqs37.js");return{javascript:s}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript(),mjs:async()=>(await Xe(async()=>{const{javascript:s}=await import("./index-BybHqs37.js");return{javascript:s}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript(),jsx:async()=>(await Xe(async()=>{const{javascript:s}=await import("./index-BybHqs37.js");return{javascript:s}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({jsx:!0}),ts:async()=>(await Xe(async()=>{const{javascript:s}=await import("./index-BybHqs37.js");return{javascript:s}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({typescript:!0}),mts:async()=>(await Xe(async()=>{const{javascript:s}=await import("./index-BybHqs37.js");return{javascript:s}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({typescript:!0}),cts:async()=>(await Xe(async()=>{const{javascript:s}=await import("./index-BybHqs37.js");return{javascript:s}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({typescript:!0}),tsx:async()=>(await Xe(async()=>{const{javascript:s}=await import("./index-BybHqs37.js");return{javascript:s}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({typescript:!0,jsx:!0}),json:async()=>(await Xe(async()=>{const{json:s}=await import("./index-BorlqgNX.js");return{json:s}},__vite__mapDeps([6,1,2,3,4]),import.meta.url)).json(),jsonc:async()=>(await Xe(async()=>{const{json:s}=await import("./index-BorlqgNX.js");return{json:s}},__vite__mapDeps([6,1,2,3,4]),import.meta.url)).json(),css:async()=>(await Xe(async()=>{const{css:s}=await import("./index-BxcnR7Nj.js");return{css:s}},__vite__mapDeps([7,1,2,3,4]),import.meta.url)).css(),scss:async()=>(await Xe(async()=>{const{css:s}=await import("./index-BxcnR7Nj.js");return{css:s}},__vite__mapDeps([7,1,2,3,4]),import.meta.url)).css(),less:async()=>(await Xe(async()=>{const{css:s}=await import("./index-BxcnR7Nj.js");return{css:s}},__vite__mapDeps([7,1,2,3,4]),import.meta.url)).css(),html:async()=>(await Xe(async()=>{const{html:s}=await import("./index-ChKrBnaf.js");return{html:s}},__vite__mapDeps([8,1,7,2,3,4,0,5]),import.meta.url)).html(),htm:async()=>(await Xe(async()=>{const{html:s}=await import("./index-ChKrBnaf.js");return{html:s}},__vite__mapDeps([8,1,7,2,3,4,0,5]),import.meta.url)).html(),vue:async()=>(await Xe(async()=>{const{html:s}=await import("./index-ChKrBnaf.js");return{html:s}},__vite__mapDeps([8,1,7,2,3,4,0,5]),import.meta.url)).html(),svelte:async()=>(await Xe(async()=>{const{html:s}=await import("./index-ChKrBnaf.js");return{html:s}},__vite__mapDeps([8,1,7,2,3,4,0,5]),import.meta.url)).html(),md:async()=>(await Xe(async()=>{const{markdown:s}=await import("./index-BBkJ4cEk.js");return{markdown:s}},__vite__mapDeps([9,3,4,2,5,8,1,7,0]),import.meta.url)).markdown(),markdown:async()=>(await Xe(async()=>{const{markdown:s}=await import("./index-BBkJ4cEk.js");return{markdown:s}},__vite__mapDeps([9,3,4,2,5,8,1,7,0]),import.meta.url)).markdown(),py:async()=>(await Xe(async()=>{const{python:s}=await import("./index-Clyg5z5Z.js");return{python:s}},__vite__mapDeps([10,1,2,3,4,5]),import.meta.url)).python(),pyi:async()=>(await Xe(async()=>{const{python:s}=await import("./index-Clyg5z5Z.js");return{python:s}},__vite__mapDeps([10,1,2,3,4,5]),import.meta.url)).python(),yaml:async()=>(await Xe(async()=>{const{yaml:s}=await import("./index-VSDVirVT.js");return{yaml:s}},__vite__mapDeps([11,1,2,3,4]),import.meta.url)).yaml(),yml:async()=>(await Xe(async()=>{const{yaml:s}=await import("./index-VSDVirVT.js");return{yaml:s}},__vite__mapDeps([11,1,2,3,4]),import.meta.url)).yaml(),rs:async()=>(await Xe(async()=>{const{rust:s}=await import("./index-C-8irjwh.js");return{rust:s}},__vite__mapDeps([12,1,2,3,4]),import.meta.url)).rust(),c:async()=>(await Xe(async()=>{const{cpp:s}=await import("./index-BC8gj6P7.js");return{cpp:s}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),h:async()=>(await Xe(async()=>{const{cpp:s}=await import("./index-BC8gj6P7.js");return{cpp:s}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),cc:async()=>(await Xe(async()=>{const{cpp:s}=await import("./index-BC8gj6P7.js");return{cpp:s}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),cpp:async()=>(await Xe(async()=>{const{cpp:s}=await import("./index-BC8gj6P7.js");return{cpp:s}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),hpp:async()=>(await Xe(async()=>{const{cpp:s}=await import("./index-BC8gj6P7.js");return{cpp:s}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),java:async()=>(await Xe(async()=>{const{java:s}=await import("./index-D0UkSEon.js");return{java:s}},__vite__mapDeps([14,1,2,3,4]),import.meta.url)).java(),go:async()=>(await Xe(async()=>{const{go:s}=await import("./index-zDoB4KM7.js");return{go:s}},__vite__mapDeps([15,1,2,3,4,5]),import.meta.url)).go(),php:async()=>(await Xe(async()=>{const{php:s}=await import("./index-B5hgDwts.js");return{php:s}},__vite__mapDeps([16,1,8,7,2,3,4,0,5]),import.meta.url)).php(),sql:async()=>(await Xe(async()=>{const{sql:s}=await import("./index-DpZcQOqI.js");return{sql:s}},__vite__mapDeps([17,2,3,4,1,5]),import.meta.url)).sql(),xml:async()=>(await Xe(async()=>{const{xml:s}=await import("./index-i-F6wQDa.js");return{xml:s}},__vite__mapDeps([18,1,2,3,4]),import.meta.url)).xml(),svg:async()=>(await Xe(async()=>{const{xml:s}=await import("./index-i-F6wQDa.js");return{xml:s}},__vite__mapDeps([18,1,2,3,4]),import.meta.url)).xml()},Fv={".mcp.json":"json",dockerfile:"yaml",makefile:"yaml"},Wv={javascript:"js",node:"js",typescript:"ts",python:"py",python3:"py",yml:"yaml",rust:"rs",golang:"go","c++":"cpp",cplusplus:"cpp"};async function Pv(s){const l=Wv[s.toLowerCase()]??s.toLowerCase(),i=Yb[l];return i?i().catch(()=>null):null}async function e1(s){const l=(s.split("/").pop()??"").toLowerCase(),i=Fv[l]??l.split(".").pop()??"",r=Yb[i];return r?r().catch(()=>null):null}const t1=Gb([{tag:[be.keyword,be.modifier,be.controlKeyword,be.moduleKeyword],class:"cmh-key"},{tag:[be.propertyName],class:"cmh-prop"},{tag:[be.function(be.variableName),be.labelName],class:"cmh-fn"},{tag:[be.color,be.constant(be.name),be.standard(be.name),be.bool],class:"cmh-const"},{tag:[be.typeName,be.className,be.changed,be.annotation,be.self,be.namespace],class:"cmh-type"},{tag:[be.number,be.integer,be.float],class:"cmh-num"},{tag:[be.string,be.special(be.string),be.regexp],class:"cmh-str"},{tag:[be.operator,be.operatorKeyword,be.escape],class:"cmh-op"},{tag:[be.meta,be.comment],class:"cmh-comment"},{tag:be.invalid,class:"cmh-invalid"}]);function fo(s){return s.replace(/[&<>]/g,l=>l==="&"?"&amp;":l==="<"?"&lt;":"&gt;")}async function n1(s,l){const i=l?await Pv(l):null;if(!i)return fo(s);try{const r=i.language.parser.parse(s);let o="";return Qv(s,r,t1,(d,h)=>{o+=h?`<span class="${h}">${fo(d)}</span>`:fo(d)},()=>{o+=`
117
+ `}),o}catch{return fo(s)}}ht.setOptions({gfm:!0,breaks:!1});function Ib(s){var i;const l=(i=s.split(".").pop())==null?void 0:i.toLowerCase();return l==="md"||l==="markdown"}async function Xb(s){const l=await ht.parse(s,{async:!0,walkTokens:async i=>{if(i.type!=="code")return;const r=i;r.text=await n1(r.text,r.lang??""),r.escaped=!0}});return jv.sanitize(l)}function Hy(s,l){return{path:s.path,text:s.content,saved:s.content,eol:s.eol,encoding:s.encoding,mtime:s.mtime,size:s.size,binary:s.binary,tooLarge:s.tooLarge,stale:!1,revision:l,previewMode:Ib(s.path)}}function Ja(s){return!s.binary&&!s.tooLarge&&s.text!==s.saved}function l1(s){return s.split("/").pop()??s}function ki(s){const l=s.lastIndexOf("/");return l===-1?"":s.slice(0,l)}function th(s){return s<1024?`${s} Б`:s<1024*1024?`${(s/1024).toFixed(1)} КБ`:`${(s/1024/1024).toFixed(1)} МБ`}function So({x:s,y:l,items:i,note:r,onClose:o}){const d=S.useRef(null),[h,g]=S.useState({left:s,top:l}),[m,b]=S.useState(()=>{const _=i.findIndex(C=>!C.disabled);return _===-1?0:_});S.useLayoutEffect(()=>{const _=d.current;if(!_)return;const C=_.getBoundingClientRect(),N=8,H=Math.max(N,Math.min(s,window.innerWidth-C.width-N)),B=Math.max(N,Math.min(l,window.innerHeight-C.height-N));g({left:H,top:B})},[s,l]),S.useLayoutEffect(()=>{var _;(_=d.current)==null||_.focus()},[]),S.useLayoutEffect(()=>{function _(N){var H;(H=d.current)!=null&&H.contains(N.target)||o()}function C(){o()}return document.addEventListener("mousedown",_),document.addEventListener("scroll",C,!0),()=>{document.removeEventListener("mousedown",_),document.removeEventListener("scroll",C,!0)}},[o]);function x(_){_.disabled||(_.onSelect(),o())}function k(_){if(_.key==="Escape"){_.preventDefault(),_.stopPropagation(),o();return}const C=i.map((N,H)=>({item:N,index:H})).filter(N=>!N.item.disabled);if(C.length!==0){if(_.key==="ArrowDown"||_.key==="ArrowUp"){_.preventDefault();const N=_.key==="ArrowDown"?1:-1,H=C.findIndex(K=>K.index===m),B=C[(((H===-1?0:H)+N)%C.length+C.length)%C.length];B&&b(B.index);return}if(_.key==="Enter"||_.key===" "){_.preventDefault();const N=i[m];N&&x(N)}}}return c.jsxs("div",{ref:d,className:"ctxmenu",style:{left:h.left,top:h.top},role:"menu",tabIndex:-1,onKeyDown:k,children:[r&&c.jsx("div",{className:"ctxmenu__note",children:r}),i.map((_,C)=>c.jsxs("button",{type:"button",role:"menuitem","aria-disabled":_.disabled,className:"ctxmenu__item"+(C===m?" is-cursor":""),onMouseEnter:()=>b(C),onClick:()=>x(_),children:[c.jsx("span",{className:"ctxmenu__label",children:_.label}),_.hint&&c.jsx("span",{className:"ctxmenu__hint",children:_.hint})]},_.id))]})}const a1=3500,s1=9e3,i1=220;function Uc({result:s}){const[l,i]=S.useState(s),[r,o]=S.useState(!1);return S.useEffect(()=>{if(!s){i(null),o(!1);return}i(s),o(!1);const d=s.ok?a1:s1,h=setTimeout(()=>o(!0),d),g=setTimeout(()=>i(null),d+i1);return()=>{clearTimeout(h),clearTimeout(g)}},[s]),l?c.jsx("div",{className:"oplog "+(l.ok?"oplog--ok":"oplog--bad")+(r?" oplog--leaving":""),role:"status","aria-live":l.ok?"polite":"assertive",children:l.message}):null}function Dc({value:s,className:l,placeholder:i="Название сессии",onCommit:r,onCancel:o}){const[d,h]=S.useState(s),g=S.useRef(null);S.useEffect(()=>{var b;(b=g.current)==null||b.select()},[]);function m(){const b=d.trim();if(!b||b===s)return o();r(b)}return c.jsx("input",{ref:g,className:l?`rename ${l}`:"rename",value:d,autoFocus:!0,spellCheck:!1,placeholder:i,onChange:b=>h(b.target.value),onBlur:m,onKeyDown:b=>{b.stopPropagation(),b.key==="Enter"?(b.preventDefault(),m()):b.key==="Escape"&&(b.preventDefault(),o())}})}function Tr({active:s}){return s?c.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("path",{d:"M2 5h3V2"}),c.jsx("path",{d:"M14 5h-3V2"}),c.jsx("path",{d:"M2 11h3v3"}),c.jsx("path",{d:"M14 11h-3v3"})]}):c.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("path",{d:"M5 2H2v3"}),c.jsx("path",{d:"M11 2h3v3"}),c.jsx("path",{d:"M2 11v3h3"}),c.jsx("path",{d:"M14 11v3h-3"})]})}const r1=500,pi="application/x-ccv-fs-path",c1=200;function u1({open:s,tree:l,expanded:i,activePath:r,dirty:o,gitChanges:d,result:h,searchResult:g,onSearch:m,onReveal:b,onToggle:x,onOpen:k,onCreate:_,onRename:C,onMove:N,onCopy:H,onDelete:B,onRefresh:K,onClose:O,zoomed:$,onToggleZoom:A}){const[Q,L]=S.useState(""),[M,W]=S.useState(null),[re,he]=S.useState(null),[F,ae]=S.useState(null),[me,Ne]=S.useState(null),[pe,z]=S.useState(null),[P,te]=S.useState(null),xe=wh("(hover: hover)"),we=S.useRef(null),j=S.useMemo(()=>d1(d),[d]);function V(T){return!(!F||T===F.path||F.kind==="dir"&&T.startsWith(`${F.path}/`)||T===ki(F.path))}function ce(T){return!(!pe||T===pe.path||pe.kind==="dir"&&T.startsWith(`${pe.path}/`)||pe.mode==="cut"&&T===ki(pe.path))}function oe(T){z({path:T.path,kind:T.kind,mode:"copy"})}function ve(T){z({path:T.path,kind:T.kind,mode:"cut"})}function Te(T){!pe||!ce(T)||(T&&!i.has(T)&&x(T),pe.mode==="cut"?(N(pe.path,T),z(null)):H(pe.path,T))}function Re(T,I){const _e=T.touches[0];if(!_e)return;const Me={timer:0,x:_e.clientX,y:_e.clientY,el:T.currentTarget,fired:!1};Me.timer=window.setTimeout(()=>{Me.fired=!0,I(Me.x,Me.y,Me.el)},r1),we.current=Me}function it(T){const I=we.current,_e=T.touches[0];!I||!_e||Math.hypot(_e.clientX-I.x,_e.clientY-I.y)>10&&(window.clearTimeout(I.timer),we.current=null)}function Ze(T){const I=we.current;I&&(window.clearTimeout(I.timer),I.fired&&T.preventDefault())}function st(){var T;return(T=we.current)!=null&&T.fired?(we.current=null,!0):!1}function He(T,I,_e,Me){L((Me==null?void 0:Me.path)??""),te({x:T,y:I,opener:_e,entry:Me})}function Ct(){const T=P==null?void 0:P.opener;te(null),T!=null&&T.isConnected&&T.focus()}function Je(T){return{onContextMenu:I=>{I.preventDefault(),He(I.clientX,I.clientY,I.currentTarget,T)},onTouchStart:I=>Re(I,(_e,Me,Le)=>He(_e,Me,Le,T)),onTouchMove:it,onTouchEnd:Ze,onTouchCancel:Ze}}function Ke(T){T.target===T.currentTarget&&(T.preventDefault(),He(T.clientX,T.clientY,T.currentTarget,null))}function Fe(T){T.target===T.currentTarget&&Re(T,(I,_e,Me)=>He(I,_e,Me,null))}function dt(T){if(!(T.ctrlKey||T.metaKey)||T.target instanceof HTMLInputElement)return;const I=T.key.toLowerCase();if(I==="v"){T.preventDefault(),Te(xn());return}if(!Q)return;const _e=By(l,Q);_e&&(I==="c"?(T.preventDefault(),oe(_e)):I==="x"&&(T.preventDefault(),ve(_e)))}function Wn(T){return I=>{I.dataTransfer.effectAllowed="move",I.dataTransfer.setData(pi,T.path),ae({path:T.path,kind:T.kind})}}function Bt(){ae(null),Ne(null)}function Tn(T){return I=>{I.dataTransfer.types.includes(pi)&&(I.stopPropagation(),!(T.kind!=="dir"||!V(T.path))&&(I.preventDefault(),Ne(T.path)))}}function bn(T){return I=>{if(!I.dataTransfer.types.includes(pi)||(I.stopPropagation(),T.kind!=="dir"||!V(T.path)))return;I.preventDefault();const _e=I.dataTransfer.getData(pi);Ne(null),_e&&N(_e,T.path)}}function fn(T){!T.dataTransfer.types.includes(pi)||!V("")||(T.preventDefault(),Ne(""))}function Un(T){if(!T.dataTransfer.types.includes(pi)||!V(""))return;T.preventDefault();const I=T.dataTransfer.getData(pi);Ne(null),I&&N(I,"")}const[Zt,ut]=S.useState(""),dn=Zt.trim(),J=dn.length>0,fe=S.useRef(null),Ee=S.useRef(m);Ee.current=m;function Qe(T){ut(T),fe.current&&clearTimeout(fe.current);const I=T.trim();if(!I){Ee.current("");return}fe.current=setTimeout(()=>Ee.current(I),c1)}function Tt(T){fe.current&&clearTimeout(fe.current),ut(""),Ee.current(""),L(T.path),b(T)}const Et=J&&(g==null?void 0:g.query)===dn?g:null;function xn(){if(Q==="")return"";const T=By(l,Q);if((T==null?void 0:T.kind)==="dir")return Q;const I=Q.lastIndexOf("/");return I===-1?"":Q.slice(0,I)}function en(T,I){const _e=I??xn();_e&&!i.has(_e)&&x(_e),he({parent:_e,kind:T})}function qt(){if(!P)return[];const T=Me=>xe?Me:void 0;if(!P.entry)return[{id:"paste",label:"Вставить в корень проекта",hint:T("Ctrl+V"),disabled:!ce(""),onSelect:()=>Te("")},{id:"new-file",label:"Создать файл",onSelect:()=>en("file","")},{id:"new-dir",label:"Создать каталог",onSelect:()=>en("dir","")}];const I=P.entry,_e=[I.kind==="file"?{id:"open",label:"Открыть",onSelect:()=>k(I.path)}:{id:"toggle",label:i.has(I.path)?"Свернуть":"Развернуть",onSelect:()=>x(I.path)},{id:"copy",label:"Копировать",hint:T("Ctrl+C"),onSelect:()=>oe(I)},{id:"cut",label:"Вырезать",hint:T("Ctrl+X"),onSelect:()=>ve(I)}];return I.kind==="dir"&&(_e.push({id:"paste",label:"Вставить",hint:T("Ctrl+V"),disabled:!ce(I.path),onSelect:()=>Te(I.path)}),_e.push({id:"new-file",label:"Создать файл",onSelect:()=>en("file",I.path)}),_e.push({id:"new-dir",label:"Создать каталог",onSelect:()=>en("dir",I.path)})),_e.push({id:"rename",label:"Переименовать",onSelect:()=>W(I.path)}),_e.push({id:"delete",label:"Удалить",onSelect:()=>B(I)}),_e}const En=J?[]:pt("",0);function pt(T,I){const _e=l[T],Me=[];if(re&&re.parent===T&&Me.push(c.jsxs("div",{className:"fsrow fsrow--draft",style:Fa(I),children:[c.jsx("span",{className:"fsrow__icon",children:re.kind==="dir"?c.jsx(Ao,{}):c.jsx(Co,{})}),c.jsx(Dc,{className:"rename--file",value:"",placeholder:re.kind==="dir"?"имя каталога":"имя файла",onCommit:Le=>{he(null),_(T,re.kind,Le)},onCancel:()=>he(null)})]},`draft:${T}`)),!_e)return Me.push(c.jsx("p",{className:"fsrow__pending",style:Fa(I),children:"читаем…"},`wait:${T}`)),Me;_e.length===0&&!re&&Me.push(c.jsx("p",{className:"fsrow__pending",style:Fa(I),children:"пусто"},`empty:${T}`));for(const Le of _e){const An=Le.kind==="dir"&&i.has(Le.path);Me.push(M===Le.path?c.jsxs("div",{className:"fsrow fsrow--draft",style:Fa(I),children:[c.jsx("span",{className:"fsrow__icon",children:Le.kind==="dir"?c.jsx(Ao,{open:An}):c.jsx(Co,{})}),c.jsx(Dc,{className:"rename--file",value:Le.name,placeholder:"новое имя",onCommit:Gl=>{W(null),C(Le.path,Gl)},onCancel:()=>W(null)})]},Le.path):c.jsx(o1,{entry:Le,depth:I,open:An,active:Le.path===r,selected:Le.path===Q,dirty:o.has(Le.path),gitStatus:j.get(Le.path),dragging:(F==null?void 0:F.path)===Le.path,dropTarget:me===Le.path,cut:(pe==null?void 0:pe.mode)==="cut"&&pe.path===Le.path,onClick:()=>{st()||(L(Le.path),Le.kind==="dir"?x(Le.path):k(Le.path))},onRename:()=>W(Le.path),onDelete:()=>B(Le),onDragStart:Wn(Le),onDragEnd:Bt,onDragOver:Tn(Le),onDrop:bn(Le),...Je(Le)},Le.path)),An&&Me.push(...pt(Le.path,I+1))}return Me}function _n(){if(!Et)return[c.jsx("p",{className:"fsrow__pending",style:Fa(0),children:"ищем…"},"search:wait")];if(Et.entries.length===0)return[c.jsx("p",{className:"fsrow__pending",style:Fa(0),children:"ничего не найдено"},"search:empty")];const T=Et.entries.map(I=>c.jsx(f1,{entry:I,gitStatus:j.get(I.path),onClick:()=>Tt(I)},I.path));return Et.truncated&&T.push(c.jsxs("p",{className:"fsrow__pending",style:Fa(0),children:["показаны первые ",Et.entries.length," — уточните запрос"]},"search:truncated")),T}return c.jsxs("aside",{className:(s?"sidepane sidepane--files sidepane--open":"sidepane sidepane--files")+($?" sidepane--zoomed":""),"aria-label":"Файлы проекта",onKeyDown:dt,children:[c.jsxs("div",{className:"sidepane__head",onDoubleClick:T=>{A&&(T.target.closest("button")||A())},children:[c.jsx(g1,{}),c.jsx("span",{className:"sidepane__title",children:"Файлы"}),c.jsx("button",{className:"sidepane__btn",title:"Новый файл","aria-label":"Новый файл",onClick:()=>en("file"),children:c.jsx(p1,{})}),c.jsx("button",{className:"sidepane__btn",title:"Новый каталог","aria-label":"Новый каталог",onClick:()=>en("dir"),children:c.jsx(m1,{})}),c.jsx("button",{className:"sidepane__btn",title:"Перечитать дерево","aria-label":"Перечитать дерево",onClick:K,children:"↻"}),A&&c.jsx("button",{className:"sidepane__btn",title:$?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":$?"Свернуть панель файлов":"Развернуть панель файлов на весь экран","aria-pressed":$,onClick:A,children:c.jsx(Tr,{active:$})}),c.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель файлов",onClick:O,children:"✕"})]}),c.jsxs("div",{className:"fssearch",children:[c.jsx(y1,{}),c.jsx("input",{className:"fssearch__input",type:"text",value:Zt,spellCheck:!1,placeholder:"Поиск файлов и папок…","aria-label":"Поиск файлов и папок",onChange:T=>Qe(T.target.value),onKeyDown:T=>{T.stopPropagation(),T.key==="Escape"&&(T.preventDefault(),Zt?Qe(""):T.currentTarget.blur())}}),Zt&&c.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>Qe(""),children:"✕"})]}),c.jsx("div",{className:"sidepane__scroll fstree"+(me===""?" fstree--drop-target":""),tabIndex:-1,onDragOver:fn,onDrop:Un,onContextMenu:Ke,onTouchStart:Fe,onTouchMove:it,onTouchEnd:Ze,onTouchCancel:Ze,children:J?_n():En}),c.jsx(Uc,{result:h}),P&&c.jsx(So,{x:P.x,y:P.y,items:qt(),onClose:Ct})]})}function o1({entry:s,depth:l,open:i,active:r,selected:o,dirty:d,gitStatus:h,dragging:g,dropTarget:m,cut:b,onClick:x,onRename:k,onDelete:_,onDragStart:C,onDragEnd:N,onDragOver:H,onDrop:B,onContextMenu:K,onTouchStart:O,onTouchMove:$,onTouchEnd:A,onTouchCancel:Q}){const L="fsrow"+(r?" is-open":"")+(o&&!r?" is-selected":"")+(s.ignored?" fsrow--ignored":"")+(g?" fsrow--dragging":"")+(m?" fsrow--drop-target":"")+(b?" fsrow--cut":"");return c.jsxs("div",{className:L,style:Fa(l),draggable:!0,onDragStart:C,onDragEnd:N,onDragOver:H,onDrop:B,onContextMenu:K,onTouchStart:O,onTouchMove:$,onTouchEnd:A,onTouchCancel:Q,children:[c.jsxs("button",{className:"fsrow__main",onClick:x,title:Vb(s),children:[c.jsx("span",{className:"fsrow__icon"+Eo("fsrow__icon",h),children:s.kind==="dir"?c.jsx(Ao,{open:i}):c.jsx(Co,{})}),c.jsx("span",{className:"fsrow__name"+Eo("fsrow__name",h),children:s.name}),s.ignored&&c.jsx("span",{className:"fsrow__tag",title:"Игнорируется git (.gitignore)",children:"git-ignore"}),d&&c.jsx("span",{className:"fsrow__dot",title:"Есть несохранённые правки"})]}),c.jsx("button",{className:"fsrow__act",title:"Переименовать","aria-label":`Переименовать ${s.name}`,onClick:k,children:"✎"}),c.jsx("button",{className:"fsrow__act",title:"Удалить","aria-label":`Удалить ${s.name}`,onClick:_,children:"✕"})]})}function f1({entry:s,gitStatus:l,onClick:i}){const r=s.path.slice(0,s.path.length-s.name.length-1);return c.jsxs("button",{className:"fsrow fsrow--search"+(s.ignored?" fsrow--ignored":""),style:Fa(0),onClick:i,title:Vb(s),children:[c.jsx("span",{className:"fsrow__icon"+Eo("fsrow__icon",l),children:s.kind==="dir"?c.jsx(Ao,{}):c.jsx(Co,{})}),c.jsx("span",{className:"fsrow__name"+Eo("fsrow__name",l),children:s.name}),s.ignored&&c.jsx("span",{className:"fsrow__tag",children:"git-ignore"}),r&&c.jsx("span",{className:"fsrow__path",children:r})]})}function Vb(s){return s.ignored?`${s.path} — игнорируется git (.gitignore)`:s.path}function Fa(s){return{"--depth":s}}function By(s,l){var o;const i=l.lastIndexOf("/"),r=i===-1?"":l.slice(0,i);return((o=s[r])==null?void 0:o.find(d=>d.path===l))??null}function d1(s){const l=new Map,i={added:1,modified:2},r=(o,d)=>{const h=l.get(o);(!h||i[d]>i[h])&&l.set(o,d)};for(const o of s){const d=h1(o.status);if(!d)continue;r(o.path,d);let h=ki(o.path);for(;r(h,d),!!h;)h=ki(h)}return l}function h1(s){if(s==="??")return"added";const[l="",i=""]=s;return l==="A"||l==="R"||l==="C"?"added":l==="M"||i==="M"?"modified":null}function Eo(s,l){return l?` ${s}--git-${l}`:""}function Ao({open:s=!1}){return c.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,"aria-hidden":"true",children:s?c.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"}):c.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 Co(){return c.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,strokeLinejoin:"round","aria-hidden":"true",children:[c.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"}),c.jsx("path",{d:"M9 2v3.2h3.3"})]})}function p1(){return c.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,"aria-hidden":"true",children:[c.jsxs("g",{transform:"translate(-1.3,-1.6) scale(0.78)",strokeLinejoin:"round",children:[c.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"}),c.jsx("path",{d:"M9 2v3.2h3.3"})]}),c.jsx("path",{d:"M12.2 10.3v3.8M10.3 12.2h3.8",strokeLinecap:"round"})]})}function m1(){return c.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,"aria-hidden":"true",children:[c.jsx("g",{transform:"translate(-1.3,-1.6) scale(0.78)",children:c.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"})}),c.jsx("path",{d:"M12.2 10.3v3.8M10.3 12.2h3.8",strokeLinecap:"round"})]})}function g1(){return c.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[c.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"}),c.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 y1(){return c.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[c.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),c.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}const b1=200;function x1({open:s,result:l,onSearch:i,onOpenMatch:r,onClose:o,zoomed:d,onToggleZoom:h}){const[g,m]=S.useState(""),b=g.trim(),x=b.length>0,k=S.useRef(null),_=S.useRef(i);_.current=i;function C(B){m(B),k.current&&clearTimeout(k.current);const K=B.trim();if(!K){_.current("");return}k.current=setTimeout(()=>_.current(K),b1)}const N=x&&(l==null?void 0:l.query)===b?l:null;function H(){if(!N)return[c.jsx("p",{className:"fsrow__pending",children:"ищем…"},"grep:wait")];if(N.matches.length===0)return[c.jsx("p",{className:"fsrow__pending",children:"ничего не найдено"},"grep:empty")];const B=[];let K="";for(const O of N.matches)O.path!==K&&(K=O.path,B.push(c.jsx("p",{className:"searchgroup__path",title:O.path,children:O.path},`path:${O.path}`))),B.push(c.jsx(_1,{match:O,onClick:()=>r(O)},`${O.path}:${O.line}:${O.column}`));return N.truncated&&B.push(c.jsxs("p",{className:"fsrow__pending",children:["показаны первые ",N.matches.length," — уточните запрос"]},"grep:truncated")),B}return c.jsxs("aside",{className:(s?"sidepane sidepane--search sidepane--open":"sidepane sidepane--search")+(d?" sidepane--zoomed":""),"aria-label":"Поиск по тексту в проекте",children:[c.jsxs("div",{className:"sidepane__head",onDoubleClick:B=>{h&&(B.target.closest("button")||h())},children:[c.jsx(v1,{}),c.jsx("span",{className:"sidepane__title",children:"Поиск по тексту"}),h&&c.jsx("button",{className:"sidepane__btn",title:d?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":d?"Свернуть панель поиска":"Развернуть панель поиска на весь экран","aria-pressed":d,onClick:h,children:c.jsx(Tr,{active:d})}),c.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель поиска",onClick:o,children:"✕"})]}),c.jsxs("div",{className:"fssearch",children:[c.jsx(S1,{}),c.jsx("input",{className:"fssearch__input",type:"text",value:g,spellCheck:!1,placeholder:"Поиск по тексту во всех файлах…","aria-label":"Поиск по тексту во всех файлах",onChange:B=>C(B.target.value),onKeyDown:B=>{B.stopPropagation(),B.key==="Escape"&&(B.preventDefault(),g?C(""):B.currentTarget.blur())}}),g&&c.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>C(""),children:"✕"})]}),c.jsx("div",{className:"sidepane__scroll fstree",children:x?H():c.jsx("p",{className:"sidepane__empty",children:"Введите текст, чтобы найти его во всех файлах проекта."})})]})}function _1({match:s,onClick:l}){const i=s.lineText.slice(0,s.column-1),r=s.lineText.slice(s.column-1,s.column-1+s.matchLength),o=s.lineText.slice(s.column-1+s.matchLength);return c.jsxs("button",{className:"searchmatch",onClick:l,title:`${s.path}:${s.line}`,children:[c.jsx("span",{className:"searchmatch__line",children:s.line}),c.jsxs("span",{className:"searchmatch__text",children:[i,c.jsx("mark",{children:r}),o]})]})}function v1(){return c.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[c.jsx("circle",{cx:"6.8",cy:"6.8",r:"4.3"}),c.jsx("path",{d:"M13.2 13.2 10.1 10.1"})]})}function S1(){return c.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[c.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),c.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}let ho=null;function k1(){return ho||(ho=Promise.all([Xe(()=>import("./index-DZXdWq9L.js"),__vite__mapDeps([19,4,3,2,20,5]),import.meta.url),Xe(()=>import("./index-891wE-Rj.js").then(s=>s.v),__vite__mapDeps([4,3]),import.meta.url),Xe(()=>import("./index-BHot-lnj.js"),[],import.meta.url),Xe(()=>import("./index-KEWrG50i.js"),__vite__mapDeps([20,3,4,2]),import.meta.url),Xe(()=>import("./codemirror-02hKfv-c.js"),__vite__mapDeps([21,2,3,4]),import.meta.url)]).then(([s,l,i,r,o])=>({EditorView:l.EditorView,EditorState:i.EditorState,Compartment:i.Compartment,EditorSelection:i.EditorSelection,Prec:i.Prec,keymap:l.keymap,indentWithTab:r.indentWithTab,basicSetup:s.basicSetup,editorTheme:o.editorTheme,editorHighlight:o.editorHighlight})).catch(s=>{throw ho=null,s})),ho}function w1({path:s,doc:l,revision:i,goto:r,onChange:o,onSave:d}){const h=S.useRef(null),g=S.useRef(null),m=S.useRef(null),b=S.useRef(new Map),x=S.useRef(new Map),k=S.useRef(new Set),_=S.useRef(null),C=S.useRef(o),N=S.useRef(d),H=S.useRef(s),B=S.useRef(i),K=S.useRef(l);C.current=o,N.current=d,H.current=s,B.current=i,K.current=l;const[O,$]=S.useState("loading"),[A,Q]=S.useState(!1);function L(W,re,he,F,ae){const me=b.current.get(F),Ne=x.current.get(F)===ae;if(me&&Ne)he.setState(me);else{const z=W.EditorState.create({doc:K.current,extensions:[W.basicSetup,W.Prec.highest(W.keymap.of([{key:"Mod-s",preventDefault:!0,run:()=>(N.current(H.current),!0)}])),W.keymap.of([W.indentWithTab]),re.of([]),W.editorTheme,W.editorHighlight,W.EditorView.updateListener.of(P=>{P.docChanged&&C.current(H.current,P.state.doc.toString())})]});b.current.set(F,z),x.current.set(F,ae),he.setState(z),k.current.delete(F)}if(k.current.has(F))return()=>{};let pe=!1;return e1(F).then(z=>{pe||!z||H.current!==F||(he.dispatch({effects:re.reconfigure(z)}),b.current.set(F,he.state),k.current.add(F))}),()=>{pe=!0}}S.useEffect(()=>{if(!h.current)return;let re=!1,he=null,F=null;$("loading"),Q(!1);const ae=window.setTimeout(()=>{re||Q(!0)},200);return(async()=>{let me;try{me=await k1()}catch{window.clearTimeout(ae),re||$("error");return}if(re||!h.current)return;window.clearTimeout(ae);const Ne=new me.Compartment;_.current=Ne,m.current=me,F=new me.EditorView({parent:h.current}),g.current=F,he=L(me,Ne,F,H.current,B.current),$("ready")})(),()=>{re=!0,window.clearTimeout(ae),he==null||he(),F==null||F.destroy(),g.current===F&&(g.current=null),m.current=null,_.current=null}},[]),S.useEffect(()=>{const W=m.current,re=g.current,he=_.current;if(!(!W||!re||!he))return L(W,he,re,s,i)},[s,i]);const M=S.useRef(0);return S.useEffect(()=>{const W=g.current,re=m.current;if(!W||!re||!r||r.token===M.current)return;M.current=r.token;const he=W.state.doc.lines,F=Math.min(Math.max(r.line,1),he),ae=W.state.doc.line(F),me=Math.min(ae.from+Math.max(r.column-1,0),ae.to);W.dispatch({selection:re.EditorSelection.cursor(me),effects:re.EditorView.scrollIntoView(me,{y:"center"})}),W.focus()},[r]),S.useEffect(()=>()=>{const W=g.current;W&&b.current.set(s,W.state)},[s]),c.jsxs("div",{className:"editor__code",children:[c.jsx("div",{ref:h,className:"editor__code-surface"+(O==="ready"?"":" is-hidden")}),O==="loading"&&A&&c.jsxs("div",{className:"editor__state work",role:"status",children:[c.jsxs("div",{className:"work__dots",children:[c.jsx("span",{className:"work__dot"}),c.jsx("span",{className:"work__dot"}),c.jsx("span",{className:"work__dot"})]}),c.jsx("span",{className:"work__label",children:"Загружается редактор…"})]}),O==="error"&&c.jsxs("div",{className:"editor__fallback",children:[c.jsxs("div",{className:"editor__fallback-banner",role:"alert",children:[c.jsx("span",{children:"Редактор не загрузился — ниже только просмотр, без сохранения правок."}),c.jsx("button",{className:"btn btn--sm btn--primary",onClick:()=>window.location.reload(),children:"Перезагрузить страницу"})]}),c.jsx("pre",{className:"editor__fallback-text",children:l})]})]})}function j1({file:s,goto:l,onChange:i,onSave:r,onReload:o,onOverwrite:d,onTogglePreview:h}){const g=Ja(s),m=Ib(s.path)&&!s.binary&&!s.tooLarge;return c.jsxs("div",{className:"editor",children:[c.jsxs("div",{className:"editor__bar",children:[c.jsx("span",{className:"editor__path",title:s.path,children:s.path}),c.jsxs("span",{className:"editor__meta",children:[th(s.size),s.eol==="crlf"&&" · CRLF"]}),m&&c.jsxs("div",{className:"editor__viewtoggle",role:"tablist","aria-label":"Режим просмотра",children:[c.jsx("button",{className:"btn btn--sm"+(s.previewMode?" is-on":""),role:"tab","aria-selected":s.previewMode,onClick:()=>!s.previewMode&&h(s.path),children:"Просмотр"}),c.jsx("button",{className:"btn btn--sm"+(s.previewMode?"":" is-on"),role:"tab","aria-selected":!s.previewMode,onClick:()=>s.previewMode&&h(s.path),children:"Код"})]}),c.jsx("button",{className:"btn btn--sm",disabled:!g,title:"Сохранить (Ctrl+S)",onClick:()=>r(s.path),children:g?"Сохранить":"Сохранено"})]}),s.stale&&c.jsxs("div",{className:"editor__warn",children:[c.jsxs("span",{children:["Файл изменился на диске",g?" — а здесь есть несохранённые правки.":"."]}),c.jsx("button",{className:"btn btn--sm",onClick:()=>o(s.path),children:"Взять с диска"}),g&&c.jsx("button",{className:"btn btn--sm btn--danger",onClick:()=>d(s.path),children:"Сохранить поверх"})]}),s.binary?c.jsxs("p",{className:"editor__empty",children:["Это не текстовый файл — редактировать его здесь нечем. ",th(s.size)," на диске."]}):s.tooLarge?c.jsxs("p",{className:"editor__empty",children:["Файл слишком велик для редактора (",th(s.size),"). Такие правит агент, а не браузер."]}):m&&s.previewMode?c.jsx(N1,{text:s.text}):c.jsx(w1,{path:s.path,doc:s.text,revision:s.revision,goto:l,onChange:i,onSave:r})]})}function N1({text:s}){const[l,i]=S.useState("");return S.useEffect(()=>{let r=!1;return Xb(s).then(o=>{r||i(o)}),()=>{r=!0}},[s]),c.jsx("div",{className:"markdown-preview",dangerouslySetInnerHTML:{__html:l}})}function T1({files:s,activePath:l,busy:i,onSelect:r,onClose:o,zoomed:d,onToggleZoom:h}){return c.jsxs("div",{className:"worktabs",role:"tablist",onDoubleClick:g=>{h&&(g.target.closest("button")||h())},children:[c.jsxs("button",{className:"worktab"+(l===null?" is-on":""),role:"tab","aria-selected":l===null,onClick:()=>r(null),onDoubleClick:()=>h==null?void 0:h(),children:[c.jsx("span",{className:"worktab__name",children:"Разговор"}),i&&c.jsx("span",{className:"worktab__dot worktab__dot--busy",title:"Агент работает"})]}),s.map(g=>c.jsxs("div",{className:"worktab"+(g.path===l?" is-on":""),role:"tab","aria-selected":g.path===l,onDoubleClick:m=>{h&&(m.target.closest(".worktab__close, .worktab__dot")||h())},children:[c.jsx("button",{className:"worktab__name",title:g.path,onClick:()=>r(g.path),children:l1(g.path)}),Ja(g)?c.jsx("button",{className:"worktab__dot",title:"Не сохранено — закрыть","aria-label":`Закрыть ${g.path}`,onClick:()=>o(g.path)}):c.jsx("button",{className:"worktab__close",title:"Закрыть","aria-label":`Закрыть ${g.path}`,onClick:()=>o(g.path),children:"✕"})]},g.path)),c.jsx("div",{className:"worktabs__spacer"}),h&&c.jsx("button",{className:"worktabs__zoom",title:d?"Свернуть — то же самое, что двойной клик по вкладке":"Развернуть на весь экран — то же самое, что двойной клик по вкладке","aria-label":d?"Свернуть колонку разговора":"Развернуть колонку разговора на весь экран","aria-pressed":d,onClick:h,children:c.jsx(Tr,{active:d})})]})}const Qb="ccv:sidebar.collapsed",$b="ccv:sidebar.mode",E1=500,qy="транскрипт остаётся на диске — сессию можно вернуть из архива в любой момент.";function A1({open:s,connected:l,status:i,workspaces:r,sessions:o,archived:d,pinned:h,activeWorkspaceId:g,activeSessionId:m,onSelectWorkspace:b,onSelectSession:x,onRenameSession:k,onPinSessions:_,onSelectPinned:C,onCloseWorkspaces:N,onArchiveSessions:H,onUnarchiveSessions:B,onOpenWorkspace:K,onNewSession:O,onOpenExtensions:$,account:A,onOpenAccount:Q,relay:L,onOpenRelay:M,onOpenSettings:W,themeMode:re,onCycleTheme:he}){const[F,ae]=S.useState(null),[me,Ne]=S.useState(""),[pe,z]=S.useState(M1),[P,te]=S.useState(O1);function xe(){te(T=>{const I=T==="pinned"?"default":"pinned";try{localStorage.setItem($b,I)}catch{}return I})}const we=me.trim().toLowerCase(),j=we!=="",V=S.useMemo(()=>j?r.filter(T=>T.name.toLowerCase().includes(we)||T.path.toLowerCase().includes(we)):r,[r,we,j]),ce=S.useMemo(()=>j?o.filter(T=>(T.title??"").toLowerCase().includes(we)):o,[o,we,j]),oe=S.useMemo(()=>j?d.filter(T=>(T.title??"").toLowerCase().includes(we)):d,[d,we,j]),ve=T=>{var I;return((I=r.find(_e=>_e.id===T))==null?void 0:I.name)??"—"},Te=T=>{var I;return(I=r.find(_e=>_e.id===T))==null?void 0:I.path},Re=S.useMemo(()=>j?h.filter(T=>(T.title??"").toLowerCase().includes(we)||ve(T.workspaceId).toLowerCase().includes(we)):h,[h,r,we,j]);function it(T){z(I=>{const _e=I.includes(T)?I.filter(Me=>Me!==T):[...I,T];try{localStorage.setItem(Qb,JSON.stringify(_e))}catch{}return _e})}const Ze=T=>!pe.includes(T),st=Yy(V),He=Yy(ce),[Ct,Je]=S.useState(null),[Ke,Fe]=S.useState(null),[dt,Wn]=S.useState(null),Bt=S.useRef(null);function Tn(T,I){const _e=T.touches[0];if(!_e)return;const Me={timer:0,x:_e.clientX,y:_e.clientY,el:T.currentTarget,fired:!1};Me.timer=window.setTimeout(()=>{Me.fired=!0,I(Me.x,Me.y,Me.el)},E1),Bt.current=Me}function bn(T){const I=Bt.current,_e=T.touches[0];!I||!_e||Math.hypot(_e.clientX-I.x,_e.clientY-I.y)>10&&(window.clearTimeout(I.timer),Bt.current=null)}function fn(T){const I=Bt.current;I&&(window.clearTimeout(I.timer),I.fired&&T.preventDefault())}function Un(){var T;return(T=Bt.current)!=null&&T.fired?(Bt.current=null,!0):!1}function Zt(){const T=Ct==null?void 0:Ct.opener;Je(null),T!=null&&T.isConnected&&T.focus()}function ut(){const T=Ke==null?void 0:Ke.opener;Fe(null),T!=null&&T.isConnected&&T.focus()}function dn(){const T=dt==null?void 0:dt.opener;Wn(null),T!=null&&T.isConnected&&T.focus()}function J(T){return{onContextMenu:I=>{I.preventDefault(),Je({x:I.clientX,y:I.clientY,opener:I.currentTarget,ids:st.targetsFor(T)})},onTouchStart:I=>Tn(I,(_e,Me,Le)=>Je({x:_e,y:Me,opener:Le,ids:st.targetsFor(T)})),onTouchMove:bn,onTouchEnd:fn,onTouchCancel:fn}}function fe(T){return{onContextMenu:I=>{I.preventDefault(),Fe({x:I.clientX,y:I.clientY,opener:I.currentTarget,ids:He.targetsFor(T)})},onTouchStart:I=>Tn(I,(_e,Me,Le)=>Fe({x:_e,y:Me,opener:Le,ids:He.targetsFor(T)})),onTouchMove:bn,onTouchEnd:fn,onTouchCancel:fn}}function Ee(T){return{onContextMenu:I=>{I.preventDefault(),Wn({x:I.clientX,y:I.clientY,opener:I.currentTarget,ids:[T.id]})},onTouchStart:I=>Tn(I,(_e,Me,Le)=>Wn({x:_e,y:Me,opener:Le,ids:[T.id]})),onTouchMove:bn,onTouchEnd:fn,onTouchCancel:fn}}const Qe=o.filter(T=>T.state!=="closed").length,Tt=Ct?[{id:"close",label:Ct.ids.length>1?`Закрыть проекты (${Ct.ids.length})`:"Закрыть проект",onSelect:()=>{N(Ct.ids),st.clear()}}]:[],Et=Ct?"закрытие не удаляет проект: каталог и история сессий остаются на диске — открыть его снова можно кнопкой «+ Проект»."+(g&&Ct.ids.includes(g)&&Qe>0?` в нём сейчас незавершённых сессий: ${Qe} — при закрытии они остановятся на хосте.`:""):void 0,xn=Ke?ce.find(T=>T.id===Ke.ids[0]):void 0,en=(xn==null?void 0:xn.pinned)!==!0,qt=Ke?[...Ke.ids.length===1?[{id:"rename",label:"Переименовать",onSelect:()=>ae(Ke.ids[0])}]:[],{id:"pin",label:en?Ke.ids.length>1?`Закрепить (${Ke.ids.length})`:"Закрепить":Ke.ids.length>1?`Открепить (${Ke.ids.length})`:"Открепить",onSelect:()=>{xn&&_(xn.workspaceId,Ke.ids,en),He.clear()}},{id:"archive",label:Ke.ids.length>1?`Убрать в архив (${Ke.ids.length})`:"Убрать в архив",onSelect:()=>{H(g,Ke.ids),He.clear()}}]:[],En=Ke?qy:void 0,pt=dt?Re.find(T=>T.id===dt.ids[0]):void 0,_n=dt?[{id:"rename",label:"Переименовать",onSelect:()=>ae(dt.ids[0])},{id:"unpin",label:"Открепить",onSelect:()=>{pt&&_(pt.workspaceId,[pt.id],!1)}},{id:"archive",label:"Убрать в архив",onSelect:()=>{pt&&H(pt.workspaceId,[pt.id])}}]:[];return c.jsxs("aside",{className:s?"sidebar sidebar--open":"sidebar",children:[c.jsxs("div",{className:"sidebar__head",children:[c.jsx("span",{className:l?"dot dot--on":"dot",title:i}),c.jsx("span",{className:"brand",children:"Claude Code Visual"}),c.jsx("button",{className:"theme-btn","aria-pressed":P==="pinned",title:P==="pinned"?"Показать все проекты и сессии":"Показать только закреплённые","aria-label":P==="pinned"?"Панель закреплённых сессий включена. Показать все проекты и сессии":"Показать только закреплённые сессии",onClick:xe,children:c.jsx(Zb,{})}),c.jsx("button",{className:"theme-btn",title:`Тема: ${Iy[re]}`,"aria-label":`Тема: ${Iy[re]}. Переключить`,onClick:he,children:c.jsx(D1,{mode:re})})]}),c.jsxs("div",{className:"fssearch fssearch--sidebar",children:[c.jsx(R1,{}),c.jsx("input",{className:"fssearch__input",type:"text",value:me,spellCheck:!1,placeholder:"Проект или сессия…","aria-label":"Поиск по проектам и сессиям",onChange:T=>Ne(T.target.value),onKeyDown:T=>{T.stopPropagation(),T.key==="Escape"&&(T.preventDefault(),me?Ne(""):T.currentTarget.blur())}}),me&&c.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>Ne(""),children:"✕"})]}),c.jsx("div",{className:"sidebar__scroll",children:P==="pinned"?c.jsxs(c.Fragment,{children:[Re.length===0&&c.jsx("div",{className:"row",children:c.jsx("span",{className:"row__meta",children:j?"Ничего не найдено":"закрепите сессию через её меню (правый клик или долгое нажатие) — она останется под рукой из любого проекта"})}),Re.map(T=>c.jsx("div",{className:T.id===m?"row row--active":"row",...F===T.id?{}:{title:"Действия со строкой — правый клик или долгое нажатие",...Ee(T)},children:F===T.id?c.jsx("div",{className:"row__main",children:c.jsx(Dc,{value:T.title??"",onCommit:I=>{k(T,I),ae(null)},onCancel:()=>ae(null)})}):c.jsxs("button",{className:"row__main",onClick:()=>{Un()||C(T)},children:[c.jsx(lh,{title:T.title??"Без названия",pinned:!1,projectName:ve(T.workspaceId),projectPath:Te(T.workspaceId)}),c.jsx(Xy,{session:T,tail:new Date(T.updatedAt).toLocaleString()})]})},T.id))]}):c.jsxs(c.Fragment,{children:[c.jsx(nh,{title:"Проекты",count:V.length,open:Ze("workspaces"),onToggle:()=>it("workspaces")}),Ze("workspaces")&&c.jsxs(c.Fragment,{children:[V.length===0&&c.jsx("div",{className:"row",children:c.jsx("span",{className:"row__meta",children:j?"Ничего не найдено":"Пока ни одного"})}),V.map(T=>c.jsx("div",{className:Gy(T.id===g,st.selected.includes(T.id)),...J(T),children:c.jsxs("button",{className:"row__main",onClick:I=>{Un()||st.click(I,T,()=>b(T.id))},children:[c.jsxs("span",{className:"row__title",children:[T.name,T.hasClaudeMd&&" ·"]}),c.jsx("span",{className:"row__meta",title:T.path,children:T.path})]})},T.id))]}),g&&c.jsxs(c.Fragment,{children:[c.jsx(nh,{title:"Сессии",count:ce.length,open:Ze("sessions"),onToggle:()=>it("sessions")}),Ze("sessions")&&c.jsxs(c.Fragment,{children:[ce.length===0&&c.jsx("div",{className:"row",children:c.jsx("span",{className:"row__meta",children:j?"Ничего не найдено":"Пока ни одной"})}),ce.map(T=>c.jsx("div",{className:Gy(T.id===m,He.selected.includes(T.id)),...F===T.id?{}:fe(T),children:F===T.id?c.jsx("div",{className:"row__main",children:c.jsx(Dc,{value:T.title??"",onCommit:I=>{k(T,I),ae(null)},onCancel:()=>ae(null)})}):c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:"row__main",onClick:I=>{Un()||He.click(I,T,()=>x(T))},children:[c.jsx(lh,{title:T.title??"Без названия",pinned:T.pinned===!0,projectName:ve(T.workspaceId),projectPath:Te(T.workspaceId)}),c.jsx(Xy,{session:T,tail:new Date(T.updatedAt).toLocaleString()})]}),c.jsx("button",{className:"row__edit",title:"Переименовать","aria-label":"Переименовать сессию",onClick:()=>{Un()||ae(T.id)},children:"✎"})]})},T.id))]}),d.length>0&&c.jsxs(c.Fragment,{children:[c.jsx(nh,{title:"Архив",count:oe.length,open:Ze("archive"),onToggle:()=>it("archive"),hint:"сессии без обращения дольше двух суток уезжают сюда сами; ничего не удаляется"}),Ze("archive")&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"row",children:c.jsx("span",{className:"row__meta",children:"сюда сами уезжают сессии без обращения дольше двух суток; транскрипт остаётся на диске, ничего не удаляется"})}),oe.length===0&&c.jsx("div",{className:"row",children:c.jsx("span",{className:"row__meta",children:j?"Ничего не найдено":"Пока пусто"})}),oe.map(T=>c.jsxs("div",{className:T.id===m?"row row--active":"row",children:[c.jsxs("button",{className:"row__main",onClick:()=>x(T),children:[c.jsx(lh,{title:T.title??"Без названия",pinned:!1,projectName:ve(T.workspaceId),projectPath:Te(T.workspaceId)}),c.jsx("span",{className:"row__meta",children:B1(T)})]}),c.jsx("button",{className:"row__restore",title:"Вернуть сессию из архива",onClick:()=>B([T.id]),children:"Вернуть"})]},T.id))]})]})]})]})}),c.jsxs("div",{className:"sidebar__foot",children:[c.jsxs("button",{className:"account-btn sidebar__wide",title:"Аккаунт Claude",onClick:Q,children:[c.jsx("span",{className:A!=null&&A.loggedIn?"dot dot--on":"dot"}),c.jsx("span",{className:"account-btn__id",children:A===null?"Аккаунт":A.loggedIn?A.email||"Вход выполнен":"Войти в аккаунт"}),(A==null?void 0:A.plan)&&c.jsx("span",{className:"chip",children:A.plan})]}),M&&c.jsxs("button",{className:"account-btn sidebar__wide",title:"Доступ с телефона и из браузера",onClick:M,children:[c.jsx("span",{className:L!=null&&L.connected?"dot dot--on":"dot"}),c.jsx("span",{className:"account-btn__id",children:L===null?"Удалённый доступ":L.paired?L.connected?L.name||"Удалённый доступ включён":"Удалённый доступ · нет связи":"Удалённый доступ"}),(L==null?void 0:L.connected)&&L.clients>0&&c.jsx("span",{className:"chip",children:L.clients})]}),c.jsx("button",{className:"btn btn--ghost sidebar__wide",disabled:!$,title:"MCP-серверы и плагины",onClick:()=>$==null?void 0:$(),children:"Расширения"}),c.jsx("button",{className:"btn btn--ghost sidebar__wide",title:"Настройки приложения",onClick:W,children:"Настройки"}),c.jsx("button",{className:"btn btn--ghost",onClick:K,children:"+ Проект"}),c.jsx("button",{className:"btn btn--primary",onClick:O,disabled:!g,children:"+ Сессия"})]}),Ct&&c.jsx(So,{x:Ct.x,y:Ct.y,items:Tt,note:Et,onClose:Zt}),Ke&&c.jsx(So,{x:Ke.x,y:Ke.y,items:qt,note:En,onClose:ut}),dt&&c.jsx(So,{x:dt.x,y:dt.y,items:_n,note:qy,onClose:dn})]})}function Gy(s,l){const i=["row"];return s&&i.push("row--active"),l&&i.push("row--selected"),i.join(" ")}function Yy(s){const[l,i]=S.useState([]),r=S.useRef(null);function o(){i([]),r.current=null}function d(g,m,b){if(g.ctrlKey||g.metaKey){i(x=>x.includes(m.id)?x.filter(k=>k!==m.id):[...x,m.id]),r.current=m.id;return}if(g.shiftKey&&r.current){const x=s.findIndex(_=>_.id===r.current),k=s.findIndex(_=>_.id===m.id);if(x!==-1&&k!==-1){const[_,C]=x<k?[x,k]:[k,x];i(s.slice(_,C+1).map(N=>N.id));return}}o(),r.current=m.id,b()}function h(g){return l.includes(g.id)?l:(i([g.id]),r.current=g.id,[g.id])}return{selected:l,click:d,targetsFor:h,clear:o}}function nh({title:s,count:l,open:i,onToggle:r,hint:o}){const d=i?`Свернуть «${s}»`:`Развернуть «${s}»`;return c.jsxs("button",{className:"sidebar__section sidebar__section--btn","aria-expanded":i,title:o?`${d} — ${o}`:d,onClick:r,children:[c.jsx(C1,{open:i}),c.jsx("span",{className:"sidebar__section-name",children:s}),c.jsx("span",{className:"sidebar__count",children:l})]})}function C1({open:s}){return c.jsx("svg",{className:s?"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:c.jsx("path",{d:"M6 3.5 10.5 8 6 12.5"})})}function Zb({className:s}){return c.jsxs("svg",{className:s,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("rect",{x:"4.5",y:"2.4",width:"7",height:"4.2",rx:"1.6"}),c.jsx("path",{d:"M5.4 6.6 8 12.2 10.6 6.6"}),c.jsx("path",{d:"M8 12.2v1.4"})]})}function R1(){return c.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[c.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),c.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}function M1(){try{const s=localStorage.getItem(Qb);if(s===null)return["archive"];const l=JSON.parse(s);return Array.isArray(l)?l.filter(i=>i==="workspaces"||i==="sessions"||i==="archive"):["archive"]}catch{return["archive"]}}function O1(){try{return localStorage.getItem($b)==="pinned"?"pinned":"default"}catch{return"default"}}const Iy={system:"как в системе",light:"светлая",dark:"тёмная"};function D1({mode:s}){const l={viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};return s==="dark"?c.jsx("svg",{...l,children:c.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"})}):s==="light"?c.jsxs("svg",{...l,children:[c.jsx("circle",{cx:"8",cy:"8",r:"3.1"}),c.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"})]}):c.jsxs("svg",{...l,children:[c.jsx("rect",{x:"1.8",y:"2.6",width:"12.4",height:"8.4",rx:"1.4"}),c.jsx("path",{d:"M5.6 13.4h4.8"})]})}function z1(s){switch(s.state){case"running":return"работает";case"waiting_permission":return"ждёт разрешения";case"idle":return L1(s.lastTurn);case"starting":return"запускается";case"reconnecting":return"переподключается";case"error":return"ошибка";case"closed":return"на диске"}}function L1(s){switch(s){case"interrupted":return"прервана";case"stopped":return"остановлена";case"failed":return"оборвалась";case"completed":return"готова";case null:return"ждёт задачу"}}function U1(s){switch(s.state){case"running":return"running";case"starting":return"starting";case"reconnecting":return"reconnecting";case"waiting_permission":return"waiting";case"idle":return H1(s.lastTurn);case"error":return"error";case"closed":return"closed"}}function H1(s){switch(s){case"interrupted":case"stopped":return"halted";case"failed":return"error";case"completed":return"ready";case null:return"fresh"}}function Xy({session:s,tail:l}){return c.jsxs("span",{className:"row__meta",children:[c.jsxs("span",{className:`row__state row__state--${U1(s)}`,children:[c.jsx("span",{className:"row__state-dot","aria-hidden":"true"}),z1(s)]})," · ",l]})}function lh({title:s,pinned:l,projectName:i,projectPath:r}){return c.jsxs("span",{className:"row__head",children:[c.jsxs("span",{className:"row__title",children:[l&&c.jsx(Zb,{className:"row__pin"}),s]}),c.jsx("span",{className:"row__project",title:r,children:i})]})}function B1(s){const l=s.archivedAuto?"сама, по сроку молчания":"убрана вручную";return s.archivedAt?`${new Date(s.archivedAt).toLocaleString()} · ${l}`:l}const Vy=3,q1=15e5;function Kb(s,l){if(!l||typeof l!="object")return null;const i=l,r=typeof i.file_path=="string"?i.file_path:"";if(!r)return null;if(s==="Write"){if(typeof i.content!="string")return null;const o=ah(i.content).map(d=>({type:"add",text:d}));return{kind:"create",filePath:r,rows:o,added:o.length,removed:0,note:"файл записывается целиком"}}if(s==="Edit"){if(typeof i.old_string!="string"||typeof i.new_string!="string")return null;const o=X1(G1(ah(i.old_string),ah(i.new_string)));return{kind:"edit",filePath:r,rows:o,added:o.filter(d=>d.type==="add").length,removed:o.filter(d=>d.type==="del").length,note:i.replace_all===!0?"все вхождения":null}}return null}function ah(s){if(s==="")return[];const l=s.split(/\r?\n/);return l.length>1&&l[l.length-1]===""&&l.pop(),l}function G1(s,l){let i=0;for(;i<s.length&&i<l.length&&s[i]===l[i];)i++;let r=s.length,o=l.length;for(;r>i&&o>i&&s[r-1]===l[o-1];)r--,o--;const d=h=>({type:"ctx",text:h});return[...s.slice(0,i).map(d),...Y1(s.slice(i,r),l.slice(i,o)),...s.slice(r).map(d)]}function Y1(s,l){if(s.length===0&&l.length===0)return[];if(s.length===0)return l.map(x=>({type:"add",text:x}));if(l.length===0)return s.map(x=>({type:"del",text:x}));if((s.length+1)*(l.length+1)>q1)return[...s.map(x=>({type:"del",text:x})),...l.map(x=>({type:"add",text:x}))];const i=s.length,r=l.length,o=r+1,d=new Uint32Array((i+1)*o),h=(x,k)=>d[x*o+k]??0;for(let x=i-1;x>=0;x--)for(let k=r-1;k>=0;k--)d[x*o+k]=s[x]===l[k]?h(x+1,k+1)+1:Math.max(h(x+1,k),h(x,k+1));const g=[];let m=0,b=0;for(;m<i&&b<r;){const x=s[m],k=l[b];x===k?(g.push({type:"ctx",text:x}),m++,b++):h(m+1,b)>=h(m,b+1)?(g.push({type:"del",text:x}),m++):(g.push({type:"add",text:k}),b++)}for(;m<i;)g.push({type:"del",text:s[m++]});for(;b<r;)g.push({type:"add",text:l[b++]});return I1(g)}function I1(s){const l=[];let i=[];function r(){l.push(...i.filter(o=>o.type==="del")),l.push(...i.filter(o=>o.type==="add")),i=[]}for(const o of s)o.type==="ctx"?(r(),l.push(o)):i.push(o);return r(),l}function X1(s){if(!s.some(d=>d.type!=="ctx"))return s;const l=s.map(()=>!1);s.forEach((d,h)=>{if(d.type!=="ctx")for(let g=Math.max(0,h-Vy);g<=Math.min(s.length-1,h+Vy);g++)l[g]=!0});const i=[];let r=[];function o(){r.length===1?i.push(...r):r.length>1&&i.push({type:"gap",text:`⋯ ${r.length} ${V1(r.length)} без изменений`}),r=[]}return s.forEach((d,h)=>{l[h]?(o(),i.push(d)):r.push(d)}),o(),i}function V1(s){const l=s%100;if(l>=11&&l<=14)return"строк";switch(s%10){case 1:return"строка";case 2:case 3:case 4:return"строки";default:return"строк"}}async function Uh(s){try{return await navigator.clipboard.writeText(s),!0}catch{}const l=document.createElement("textarea");l.value=s,l.setAttribute("readonly",""),l.style.position="fixed",l.style.opacity="0",document.body.appendChild(l);try{return l.select(),document.execCommand("copy")}catch{return!1}finally{l.remove()}}const Hh=1600,wi="Копировать",gr="Скопировано";function Jb({text:s,hint:l,className:i}){const[r,o]=S.useState(!1);return S.useEffect(()=>{if(!r)return;const d=setTimeout(()=>o(!1),Hh);return()=>clearTimeout(d)},[r]),S.useEffect(()=>o(!1),[s]),c.jsx("button",{type:"button",className:"copybtn"+(r?" copybtn--done":"")+(i?` ${i}`:""),"aria-label":r?gr:`${wi} ${l}`,title:r?gr:`${wi} ${l}`,onClick:()=>{Uh(s).then(d=>{d&&o(!0)})},children:r?gr:wi})}function Bh({diff:s}){return c.jsxs("div",{className:"diff",children:[c.jsxs("div",{className:"diff__head",children:[c.jsx("span",{className:"diff__path",title:s.filePath,children:s.filePath}),c.jsxs("span",{className:"diff__stat",children:[s.added>0&&c.jsxs("span",{className:"diff__stat--add",children:["+",s.added]}),s.removed>0&&c.jsxs("span",{className:"diff__stat--del",children:["−",s.removed]})]})]}),s.note&&c.jsx("div",{className:"diff__note",children:s.note}),c.jsx("div",{className:"diff__body",children:s.rows.length===0?c.jsx("div",{className:"diff__row diff__row--gap",children:c.jsx("span",{className:"diff__text",children:"пустое содержимое"})}):s.rows.map((l,i)=>c.jsxs("div",{className:`diff__row diff__row--${l.type}`,children:[c.jsx("span",{className:"diff__mark","aria-hidden":"true",children:l.type==="add"?"+":l.type==="del"?"−":""}),c.jsx("span",{className:"diff__text",children:l.text===""?" ":l.text})]},i))})]})}function Q1({waiting:s}){const[l,i]=S.useState(0);return S.useEffect(()=>{const r=window.setInterval(()=>i(o=>o+1),1e3);return()=>window.clearInterval(r)},[]),c.jsxs("div",{className:s?"work work--wait":"work",children:[c.jsxs("span",{className:"work__dots","aria-hidden":"true",children:[c.jsx("span",{className:"work__dot"}),c.jsx("span",{className:"work__dot"}),c.jsx("span",{className:"work__dot"})]}),c.jsx("span",{className:"work__label",children:s?"ждёт разрешения":"думает"}),!s&&c.jsxs("span",{className:"work__time",children:[l," с"]})]})}function qh({items:s,busy:l,waiting:i,history:r=[],historyHasMore:o=!1,historyLoading:d=!1,onLoadHistory:h,sessionId:g,empty:m="Сессия пуста. Опишите задачу — Claude Code работает в каталоге проекта с полным набором инструментов."}){const b=S.useRef(null),x=S.useRef(null),k=S.useRef(!0),_=S.useRef(null),C=S.useRef(null),N=S.useRef(!1);S.useEffect(()=>{k.current=!0,_.current=null,N.current=!1,C.current!==null&&(clearTimeout(C.current),C.current=null)},[g]),S.useEffect(()=>{const K=b.current,O=x.current;if(!K||!O)return;function $(L){!K||L===K.scrollTop||(N.current=!0,K.scrollTop=L)}function A(){if(!K)return;const L=_.current;if(L){const M=$y(K,L.id);if(M){const W=M.getBoundingClientRect().top-K.getBoundingClientRect().top;$(K.scrollTop+(W-L.top))}C.current!==null&&clearTimeout(C.current),C.current=setTimeout(()=>{_.current=null},500);return}k.current&&$(K.scrollHeight)}const Q=new ResizeObserver(A);return Q.observe(O),()=>{Q.disconnect(),C.current!==null&&clearTimeout(C.current)}},[]);function H(){const K=b.current;if(K){if(N.current){N.current=!1;return}k.current=K.scrollHeight-K.scrollTop-K.clientHeight<80}}function B(){if(d)return;const K=b.current,O=r[0];if(K&&O){const $=$y(K,O.id);$&&(_.current={id:O.id,top:$.getBoundingClientRect().top-K.getBoundingClientRect().top})}h==null||h()}return c.jsx("div",{className:"transcript",ref:b,onScroll:H,children:c.jsxs("div",{className:"stream",ref:x,children:[o&&c.jsx("button",{type:"button",className:"transcript__more",onClick:B,disabled:d,children:d?"Загружаем…":"Показать более раннее"}),r.map(K=>c.jsx(Qy,{item:K},K.id)),r.length>0&&s.length>0&&c.jsx("div",{className:"transcript__divider",children:c.jsx("span",{children:"дальше — сессия открыта заново"})}),r.length===0&&s.length===0&&c.jsx("p",{className:"empty",children:m}),s.map(K=>c.jsx(Qy,{item:K},K.id)),l&&c.jsx(Q1,{waiting:i})]})})}function Qy({item:s}){switch(s.kind){case"user":return c.jsx("div",{className:"msg--user","data-item-id":s.id,children:s.text});case"assistant":return c.jsxs("div",{className:"msg--assistant","data-item-id":s.id,children:[c.jsx($1,{text:s.text}),s.streaming&&c.jsx("span",{className:"caret"}),s.text.trim()!==""&&c.jsx("div",{className:"msg--assistant__foot",children:c.jsx(Jb,{text:s.text,hint:"ответ целиком"})})]});case"thinking":return c.jsx("div",{className:"thinking","data-item-id":s.id,children:s.text});case"tool":return c.jsx(K1,{item:s});case"result":return c.jsxs("div",{className:"result-line","data-item-id":s.id,children:[c.jsx("span",{children:s.isError?"✗ "+s.subtype:"✓ готово"}),c.jsxs("span",{children:[(s.durationMs/1e3).toFixed(1)," с"]}),s.costUsd!==null&&c.jsxs("span",{children:["$",s.costUsd.toFixed(4)]}),c.jsxs("span",{children:["↑",Ky(s.inputTokens)," ↓",Ky(s.outputTokens)]})]});case"notice":return c.jsx("div",{className:s.tone==="error"?"notice notice--error":"notice","data-item-id":s.id,children:s.text})}}function $y(s,l){const i=s.querySelectorAll("[data-item-id]");for(const r of i)if(r.dataset.itemId===l)return r;return null}function $1({text:s}){const[l,i]=S.useState(""),r=S.useRef([]);S.useEffect(()=>{let d=!1;return Xb(s).then(h=>{d||i(Z1(h))}),()=>{d=!0}},[s]),S.useEffect(()=>{const d=r.current;return()=>d.forEach(h=>clearTimeout(h))},[]);function o(d){var m,b;const h=d.target.closest(".codeblock__copy");if(!(h instanceof HTMLElement))return;const g=((b=(m=h.parentElement)==null?void 0:m.querySelector("pre"))==null?void 0:b.textContent)??"";g!==""&&Uh(g).then(x=>{if(!x)return;h.textContent=gr,h.setAttribute("aria-label",gr),h.classList.add("copybtn--done");const k=window.setTimeout(()=>{h.isConnected&&(h.textContent=wi,h.setAttribute("aria-label",vh),h.classList.remove("copybtn--done"))},Hh);r.current.push(k)})}return c.jsx("div",{className:"markdown-preview msg--assistant__body",onClick:o,dangerouslySetInnerHTML:{__html:l}})}const vh=`${wi} блок кода`;function Z1(s){if(!s.includes("<pre"))return s;const l=new DOMParser().parseFromString(s,"text/html");for(const i of l.body.querySelectorAll("pre")){const r=l.createElement("div");r.className="codeblock",i.replaceWith(r),r.append(i);const o=l.createElement("button");o.type="button",o.className="copybtn codeblock__copy",o.setAttribute("aria-label",vh),o.title=vh,o.textContent=wi,r.append(o)}return l.body.innerHTML}function K1({item:s}){const[l,i]=S.useState(!1),r=s.result===null,o=Kb(s.name,s.input),d=s.name==="AskUserQuestion"?W1(s.input):null;return c.jsxs("div",{className:"tool"+(s.isError?" tool--error":"")+(s.awaitingPermission?" tool--wait":""),"data-item-id":s.id,children:[c.jsxs("button",{className:"tool__head",onClick:()=>i(h=>!h),children:[c.jsx("span",{className:"tool__name",children:s.name}),c.jsx("span",{className:"tool__arg",children:d?F1(d):J1(s.input)}),c.jsx("span",{className:"tool__status",children:r?"…":s.isError?"ошибка":l?"▴":"▾"})]}),l&&c.jsxs("div",{className:"tool__body",children:[d?c.jsx(P1,{questions:d,answers:s.answers}):o?c.jsx(Bh,{diff:o}):c.jsx(Zy,{text:JSON.stringify(s.input,null,2),hint:"аргументы вызова"}),s.result!==null&&(!d||s.isError)&&c.jsx(Zy,{text:s.result,hint:"результат вызова",style:{marginTop:10}})]})]})}function Zy({text:s,hint:l,style:i}){return c.jsxs("div",{className:"codeblock",style:i,children:[c.jsx("pre",{className:"code",children:s}),c.jsx(Jb,{text:s,hint:l,className:"codeblock__copy"})]})}function J1(s){if(!s||typeof s!="object")return"";const l=s;for(const i of["file_path","command","pattern","path","url","prompt"]){const r=l[i];if(typeof r=="string")return r.replace(/\s+/g," ").slice(0,160)}return JSON.stringify(l).slice(0,160)}function F1(s){var i;const l=s.map(r=>r.header).filter(r=>r.length>0);return l.length===s.length?l.join(" · "):((i=s[0])==null?void 0:i.question.replace(/\s+/g," ").slice(0,160))??""}function W1(s){if(typeof s!="object"||s===null)return null;const l=s.questions;if(!Array.isArray(l)||l.length===0)return null;const i=[];for(const r of l){if(typeof r!="object"||r===null)return null;const{question:o,header:d,options:h,multiSelect:g}=r;if(typeof o!="string"||!Array.isArray(h)||h.length===0)return null;const m=[];for(const b of h){if(typeof b!="object"||b===null)return null;const{label:x,description:k,preview:_}=b;if(typeof x!="string"||typeof k!="string")return null;m.push({label:x,description:k,...typeof _=="string"?{preview:_}:{}})}i.push({question:o,header:typeof d=="string"?d:"",options:m,multiSelect:g===!0})}return i}function P1({questions:s,answers:l}){return c.jsx("div",{className:"tool__questions",children:s.map((i,r)=>c.jsxs("div",{className:"tool__question",children:[c.jsxs("div",{className:"tool__question-head",children:[i.header&&c.jsx("span",{className:"chip chip--accent",children:i.header}),c.jsx("span",{className:"tool__question-text",children:i.question})]}),c.jsx("div",{className:"tool__question-answer",children:l!=null&&l[i.question]?c.jsx("span",{className:"tool__answer-value",children:l[i.question]}):c.jsx("span",{className:"tool__answer-empty",children:"не отвечено"})})]},r))})}function Ky(s){return s>=1e3?`${(s/1e3).toFixed(1)}k`:String(s)}const eS="ccv.dictation.lang",Jy="ru-RU";function tS(s){try{return Function.prototype.toString.call(s).includes("[native code]")}catch{return!1}}function Fy(){const s=window,l=[s.SpeechRecognition,s.webkitSpeechRecognition].filter(r=>typeof r=="function"),i=l.find(tS);return!i&&l.length>0&&Jl("распознавание подменено: родной реализации в странице нет"),i??l[0]??null}function Fb(){var s;try{return((s=localStorage.getItem(eS))==null?void 0:s.trim())||Jy}catch{return Jy}}function Jl(s,l){l===void 0?console.debug(`[dictation] ${s}`):console.debug(`[dictation] ${s}`,l)}const nS=3,lS=400,aS=5,sS=250,iS=2e3,rS=2e4;async function cS(){try{return(await navigator.permissions.query({name:"microphone"})).state==="granted"}catch{return!1}}const uS={"not-allowed":"Браузер не дал доступ к микрофону","service-not-allowed":"Браузер не дал доступ к микрофону","audio-capture":"Микрофон не найден",network:"Сервис распознавания недоступен","language-not-supported":`Распознавание не знает языка ${Fb()}`};function oS(s){const[l]=S.useState(()=>Fy()!==null),[i,r]=S.useState(!1),[o,d]=S.useState(null),h=S.useRef(null),g=S.useRef(!1),m=S.useRef(!1),b=S.useRef(s),x=S.useRef({openedAt:0,audio:!1,heard:!1,everHeard:!1,silent:0,dead:0,lastError:"",warned:!1}),k=S.useRef(null),_=S.useRef(!1),C=S.useRef(null),N=S.useCallback(()=>{C.current&&clearTimeout(C.current),C.current=null},[]),H=S.useCallback(()=>{N();const A=async Q=>{if(C.current=null,!(!g.current||_.current)){if(!Q&&!await cS()){if(Jl("ждём ответа на запрос доступа к микрофону"),!g.current||_.current)return;C.current=setTimeout(()=>void A(!0),rS);return}Jl("движок не ответил на start()"),g.current=!1,r(!1),d("Распознавание не отвечает — проверьте расширения браузера и доступ к микрофону")}};C.current=setTimeout(()=>void A(!1),iS)},[N]);S.useEffect(()=>{b.current=s}),S.useEffect(()=>{const A=Fy();if(!A)return;const Q=new A;return Q.lang=Fb(),Q.continuous=!0,Q.interimResults=!0,Q.onstart=()=>{Jl("сессия открыта"),_.current=!0,N(),r(!0)},Q.onaudiostart=()=>{Jl("пошёл звук с микрофона"),x.current.audio=!0},Q.onresult=L=>{var he;if(m.current)return;let M="",W="";for(let F=L.resultIndex;F<L.results.length;F++){const ae=L.results[F];if(!ae)continue;const me=((he=ae[0])==null?void 0:he.transcript)??"";ae.isFinal?M+=me:W+=me}const re=x.current;re.heard=!0,re.everHeard=!0,Jl("распознано",{final:M,interim:W}),b.current(M,W)},Q.onerror=L=>{x.current.lastError=L.error,Jl("ошибка движка",L.error),!(L.error==="no-speech"||L.error==="aborted")&&(g.current=!1,r(!1),d(uS[L.error]??`Распознавание не работает: ${L.error}`))},Q.onend=()=>{m.current=!1,_.current=!1;const L=x.current,M=Date.now()-L.openedAt;if(Jl("сессия закрыта",{мс:M,звук:L.audio,слова:L.heard,ошибка:L.lastError||null}),!g.current){r(!1);return}if(L.dead=!L.audio&&M<lS?L.dead+1:0,L.dead>=aS){g.current=!1,r(!1),d(L.lastError?`Распознавание не работает: ${L.lastError}`:"Распознавание закрывается сразу после запуска — проверьте доступ к микрофону в настройках сайта");return}L.silent=L.heard?0:L.silent+1,!L.everHeard&&!L.warned&&L.silent>=nS&&(L.warned=!0,d(L.audio?"Микрофон слушает, но речь не распознаётся — проверьте язык диктовки и уровень звука":"С микрофона не идёт звук — проверьте устройство ввода в настройках сайта в браузере")),k.current=setTimeout(()=>{if(k.current=null,!!g.current){L.openedAt=Date.now(),L.audio=!1,L.heard=!1,L.lastError="",H();try{Q.start()}catch{}}},sS)},h.current=Q,()=>{g.current=!1,k.current&&clearTimeout(k.current),k.current=null,N(),Q.onend=null,Q.onresult=null,Q.onerror=null,Q.onstart=null,Q.onaudiostart=null,Q.abort(),h.current=null}},[]);const B=S.useCallback(()=>{var A;if(g.current){if(g.current=!1,Jl("выключение микрофона"),k.current&&clearTimeout(k.current),k.current=null,N(),!_.current){r(!1);return}(A=h.current)==null||A.stop()}},[]),K=S.useCallback(()=>{const A=h.current;if(A){if(!window.isSecureContext){d("Микрофон доступен только по https или с localhost");return}d(null),g.current=!0,m.current=!1,k.current&&clearTimeout(k.current),k.current=null,x.current={openedAt:Date.now(),audio:!1,heard:!1,everHeard:!1,silent:0,dead:0,lastError:"",warned:!1},r(!0),Jl("включение микрофона",{язык:A.lang}),H();try{A.start()}catch(Q){Jl("start() не прошёл",Q)}}},[H]),O=S.useCallback(()=>{g.current?B():K()},[K,B]),$=S.useCallback(()=>{var A;g.current&&_.current&&(m.current=!0,(A=h.current)==null||A.abort())},[]);return{supported:l,listening:i,error:o,toggle:O,stop:B,drop:$}}const fS="(max-width: 860px)",Wy=/^\/(\S*)$/,dS=new Set(["model","permissions"]);function hS(s){return dS.has(s.name)||s.name.startsWith("__")}const pS=new Set(["clear","rename"]),Py=/(?:^|\s)@([^\s@]*)$/,mS=200,gS=100,yS=190;function Wb({disabled:s,busy:l,commands:i,sessionTitle:r,contextResult:o,className:d,placeholder:h,sendLabel:g="Отправить",autoFocus:m=!1,onContextSearch:b,onCommand:x,onSend:k,onInterrupt:_,onEscape:C}){var dn;const N=wh(fS),[H,B]=S.useState(""),[K,O]=S.useState(!1),[$,A]=S.useState(0),Q=S.useRef(null),L=S.useRef(null),M=S.useRef(null),[W,re]=S.useState(0),[he,F]=S.useState([]),[ae,me]=S.useState(-1),Ne=S.useRef(""),[pe,z]=S.useState(""),P=oS(S.useCallback((J,fe)=>{J&&B(Ee=>sh(Ee,J)),z(fe.trim())},[])),te=pe?sh(H,pe):H;S.useEffect(()=>{P.listening||pe===""||(B(J=>sh(J,pe)),z(""))},[P.listening,pe]),S.useEffect(()=>{var J;m&&((J=Q.current)==null||J.focus())},[m]);const xe=s?"Выберите сессию":h??"Опишите задачу… («/» — команды, «@» — файлы)",we=S.useRef(0),j=S.useCallback(J=>{const fe=parseFloat(getComputedStyle(J).maxHeight),Ee=Number.isFinite(fe)&&fe>0?fe:yS;J.style.height="auto";const Qe=J.scrollHeight;J.style.height=`${Math.min(Qe,Ee)}px`,J.style.overflowY=Qe>Ee?"auto":"hidden";const Tt=M.current;Tt&&(M.current=null,J.setSelectionRange(Tt[0],Tt[1]))},[]);S.useEffect(()=>{const J=Q.current;J&&j(J)},[te,xe,s,j]),S.useEffect(()=>{const J=Q.current;if(!J)return;const fe=new ResizeObserver(([Ee])=>{const Qe=Ee==null?void 0:Ee.contentRect.width;Qe===void 0||Math.abs(Qe-we.current)<1||(we.current=Qe,j(J))});return fe.observe(J),()=>fe.disconnect()},[j]);const V=P.stop;S.useEffect(()=>{s&&V()},[s,V]);const ce=S.useMemo(()=>P.error?{ok:!1,message:P.error}:null,[P.error]),oe=S.useMemo(()=>{var Ee;const J=(Ee=Wy.exec(H))==null?void 0:Ee[1];if(J===void 0)return[];const fe=J.toLowerCase();return i.filter(Qe=>!hS(Qe)&&ih(Qe,fe)<Pb).sort((Qe,Tt)=>ih(Qe,fe)-ih(Tt,fe))},[H,i]),ve=!K&&oe.length>0,Te=Math.min($,oe.length-1),Re=K?null:((dn=Py.exec(te.slice(0,W)))==null?void 0:dn[1])??null,it=S.useRef(b);it.current=b,S.useEffect(()=>{if(Re===null||Re===""||Re.endsWith("/")){it.current(Re);return}const J=setTimeout(()=>it.current(Re),mS);return()=>clearTimeout(J)},[Re]);const Ze=Re!==null&&(o==null?void 0:o.query)===Re,st=Ze?o.entries:[],He=Re!==null,Ct=He&&!Ze,Je=Math.min($,Math.max(st.length-1,0));S.useEffect(()=>{var fe,Ee;if(!ve&&!He)return;const J=ve?Te:Je;(Ee=(fe=L.current)==null?void 0:fe.children[J])==null||Ee.scrollIntoView({block:"nearest"})},[ve,He,Te,Je]);function Ke(J,fe){var Ee;B(J),re(fe),M.current=[fe,fe],A(0),O(!1),pe!==""&&(z(""),P.drop()),(Ee=Q.current)==null||Ee.focus()}function Fe(){B(""),z(""),A(0),re(0),O(!1),me(-1),Ne.current="",P.drop()}function dt(J){const fe=J.trim();!fe||s||(k(fe),F(Ee=>[fe,...Ee.filter(Qe=>Qe!==fe)].slice(0,gS)),Fe())}function Wn(J){if(J<-1||J>=he.length)return;ae===-1&&(Ne.current=H);const fe=J===-1?Ne.current:he[J]??"";me(J),Ke(fe,fe.length)}function Bt(){var Qe;const J=((Qe=Q.current)==null?void 0:Qe.selectionStart)??te.length,Ee=`${J>0&&!/\s$/.test(te.slice(0,J))?" ":""}@`;Ke(te.slice(0,J)+Ee+te.slice(J),J+Ee.length)}function Tn(J){var Tt;const fe=(Tt=Py.exec(te.slice(0,W)))==null?void 0:Tt[1];if(fe===void 0)return;const Ee=W-fe.length-1,Qe=J.kind==="dir"?`@${J.path}/`:`@${J.path} `;Ke(te.slice(0,Ee)+Qe+te.slice(W),Ee+Qe.length)}function bn(){var fe;const J=(fe=Wy.exec(te.trim()))==null?void 0:fe[1];if(J&&x(J)){Fe();return}dt(te)}function fn(J,fe){B(J),re(fe),A(0),O(!1),me(-1),pe!==""&&(z(""),P.drop())}function Un(J){var Qe;const fe=pS.has(J.name)?r:null,Ee=`/${J.name} `;B(Ee+(fe??"")),re(Ee.length+((fe==null?void 0:fe.length)??0)),fe&&(M.current=[Ee.length,Ee.length+fe.length]),A(0),(Qe=Q.current)==null||Qe.focus()}function Zt(J){if(x(J.name)){B(""),A(0),O(!1);return}J.argumentHint?Un(J):dt(`/${J.name}`)}function ut(J){if(ve){if(J.key==="ArrowDown")return J.preventDefault(),A(fe=>(Math.min(fe,oe.length-1)+1)%oe.length);if(J.key==="ArrowUp"){J.preventDefault();const fe=oe.length-1;return A(Ee=>(Math.min(Ee,fe)+fe)%oe.length)}if(J.key==="Enter"&&!J.shiftKey){J.preventDefault();const fe=oe[Te];fe&&Zt(fe);return}if(J.key==="Tab"){J.preventDefault();const fe=oe[Te];fe&&Un(fe);return}if(J.key==="Escape"){J.preventDefault(),J.stopPropagation(),O(!0);return}}if(He){if(J.key==="ArrowDown"&&st.length>0)return J.preventDefault(),A(fe=>(Math.min(fe,st.length-1)+1)%st.length);if(J.key==="ArrowUp"&&st.length>0){J.preventDefault();const fe=st.length-1;return A(Ee=>(Math.min(Ee,fe)+fe)%st.length)}if(J.key==="Enter"&&!J.shiftKey||J.key==="Tab"){const fe=st[Je];if(fe){J.preventDefault(),Tn(fe);return}if(J.key==="Tab")return}if(J.key==="Escape"){J.preventDefault(),J.stopPropagation(),O(!0);return}}if((J.key==="ArrowUp"||J.key==="ArrowDown")&&!J.shiftKey){const fe=J.currentTarget,Ee=fe.selectionStart;if(fe.selectionEnd===Ee){const Qe=J.key==="ArrowUp",Tt=Qe?!te.slice(0,Ee).includes(`
118
118
  `):!te.slice(Ee).includes(`
119
119
  `),Et=Qe?ae+1:ae-1;if(Tt&&Et>=-1&&Et<he.length){J.preventDefault(),Wn(Et);return}}}if(J.key==="Escape"&&C){J.preventDefault(),J.stopPropagation(),C();return}J.key==="Enter"&&!J.shiftKey&&!N&&(J.preventDefault(),bn())}return c.jsx("div",{className:d?`composer ${d}`:"composer",children:c.jsxs("div",{className:"composer__inner",children:[c.jsx(Uc,{result:ce}),He&&!ve&&c.jsxs("div",{className:"cmdmenu",role:"listbox",ref:L,children:[st.map((J,fe)=>c.jsxs("button",{role:"option","aria-selected":fe===Je,className:fe===Je?"cmdmenu__row is-on":"cmdmenu__row",onMouseEnter:()=>A(fe),onMouseDown:Ee=>{Ee.preventDefault(),Tn(J)},children:[c.jsxs("span",{className:"cmdmenu__name",children:[J.name,J.kind==="dir"?"/":""]}),c.jsx("span",{className:"cmdmenu__desc",children:J.path}),J.ignored&&c.jsx("span",{className:"cmdmenu__tag",children:"git-ignore"})]},J.path)),st.length===0&&c.jsx("div",{className:"cmdmenu__empty",children:Ct?"ищем…":Re?"Ничего не нашлось":"Наберите имя файла или каталога"})]}),ve&&c.jsx("div",{className:"cmdmenu",role:"listbox",ref:L,children:oe.map((J,fe)=>c.jsxs("button",{role:"option","aria-selected":fe===Te,className:fe===Te?"cmdmenu__row is-on":"cmdmenu__row",onMouseEnter:()=>A(fe),onMouseDown:Ee=>{Ee.preventDefault(),Zt(J)},children:[c.jsxs("span",{className:"cmdmenu__name",children:["/",J.name]}),J.argumentHint&&c.jsx("span",{className:"cmdmenu__hint",children:J.argumentHint}),c.jsx("span",{className:"cmdmenu__desc",children:J.description})]},J.name))}),c.jsxs("div",{className:"composer__field",children:[c.jsx("button",{type:"button",className:"addbtn",title:"Добавить контекст — файл проекта («@»)","aria-label":"Добавить контекст",disabled:s,onClick:Bt,children:c.jsx(_S,{})}),c.jsx("textarea",{ref:Q,value:te,disabled:s,placeholder:xe,onChange:J=>fn(J.target.value,J.target.selectionStart),onSelect:J=>re(J.currentTarget.selectionStart),onKeyDown:ut}),P.supported&&c.jsx("button",{type:"button",className:P.listening?"micbtn is-on":"micbtn",title:P.listening?"Остановить диктовку":"Продиктовать промпт","aria-label":P.listening?"Остановить диктовку":"Продиктовать промпт","aria-pressed":P.listening,disabled:s,onClick:P.toggle,children:c.jsx(SS,{on:P.listening})}),l?c.jsx("button",{className:"btn",onClick:_,title:"Прервать (Esc)",children:"Стоп"}):c.jsxs("button",{className:"btn btn--primary sendbtn",onClick:bn,disabled:s||te.trim()==="","aria-label":g,title:g,children:[c.jsx("span",{className:"sendbtn__label",children:g}),c.jsx(vS,{})]})]})]})})}function sh(s,l){const i=l.trim();if(i==="")return s;const r=Sh(i).slice(bS(s,i)).join(" ");return r===""?s:s===""||/\s$/.test(s)?s+r:`${s} ${r}`}function bS(s,l){const i=Sh(s),r=Sh(l);for(let o=Math.min(i.length,r.length);o>0;o--)if(i.slice(i.length-o).every((d,h)=>xS(d,r[h]??"")))return o;return 0}function Sh(s){return s.split(/\s+/).filter(l=>l!=="")}function xS(s,l){const i=r=>r.toLowerCase().replace(/[.,!?;:…]+$/u,"");return i(s)===i(l)}function _S(){return c.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round","aria-hidden":"true",children:c.jsx("path",{d:"M8 3.4v9.2M3.4 8h9.2"})})}function vS(){return c.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:c.jsx("path",{d:"M8 12.5V3.5M4 7.5 8 3.5l4 4"})})}function SS({on:s}){return c.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("rect",{x:"5.9",y:"1.7",width:"4.2",height:"7.6",rx:"2.1",fill:s?"currentColor":"none"}),c.jsx("path",{d:"M3.3 7.3v.8a4.7 4.7 0 0 0 9.4 0v-.8"}),c.jsx("path",{d:"M8 12.8v1.5"})]})}const Pb=4;function ih(s,l){const i=s.name.toLowerCase();return i===l?0:i.startsWith(l)?1:s.aliases.some(r=>r.toLowerCase().startsWith(l))?2:i.includes(l)?3:Pb}function kS({request:s,queued:l,onDecide:i}){const r=Kb(s.toolName,s.input);return c.jsx("div",{className:"modal-backdrop modal-backdrop--sheet",children:c.jsxs("div",{className:"sheet",role:"dialog","aria-modal":"true",children:[c.jsxs("div",{className:"sheet__head",children:["Разрешить действие?",l>0&&` (ещё ${l} в очереди)`]}),c.jsxs("div",{className:"sheet__body",children:[c.jsx("div",{className:"sheet__tool",children:s.toolName}),s.reason&&c.jsx("p",{className:"sheet__reason",children:s.reason}),r?c.jsx(Bh,{diff:r}):c.jsx("pre",{className:"code",children:JSON.stringify(s.input,null,2)})]}),c.jsxs("div",{className:"sheet__actions",children:[c.jsx("button",{className:"btn",onClick:()=>i(s.requestId,"deny"),children:"Отклонить"}),c.jsx("button",{className:"btn btn--warn",autoFocus:!0,onClick:()=>i(s.requestId,"allow"),children:"Разрешить"})]})]})})}function wS({request:s,queued:l,onAnswer:i,onDecline:r}){const{questions:o}=s,[d,h]=S.useState(()=>o.map(()=>new Set)),[g,m]=S.useState(()=>o.map(()=>"")),[b,x]=S.useState(()=>eb(o));S.useEffect(()=>{h(o.map(()=>new Set)),m(o.map(()=>"")),x(eb(o))},[s.requestId]);const k=S.useMemo(()=>NS(o,d,g),[o,d,g]),_=k!==null;function C($,A){var Q,L;(L=(Q=o[$])==null?void 0:Q.options[A])!=null&&L.preview&&x(M=>{const W=M.slice();return W[$]=A,W})}function N($,A,Q){h(L=>{const M=L.slice(),W=new Set(M[$]);return Q?W.has(A)?W.delete(A):W.add(A):W.has(A)||(W.clear(),W.add(A)),M[$]=W,M}),A!=="other"&&C($,A)}function H($,A){m(Q=>{const L=Q.slice();return L[$]=A,L})}function B(){k&&i(s.requestId,k)}function K($){$.key==="Enter"&&($.target.closest("button")||_&&($.preventDefault(),B()))}function O($){var M;if(!["ArrowDown","ArrowUp","ArrowRight","ArrowLeft"].includes($.key))return;const A=Array.from($.currentTarget.querySelectorAll("button.qsheet__option")),Q=A.indexOf(document.activeElement);if(Q===-1)return;$.preventDefault();const L=$.key==="ArrowDown"||$.key==="ArrowRight"?1:-1;(M=A[(Q+L+A.length)%A.length])==null||M.focus()}return c.jsx("div",{className:"modal-backdrop modal-backdrop--sheet",children:c.jsxs("div",{className:"qsheet",role:"dialog","aria-modal":"true","aria-label":"Вопрос от Claude",onKeyDown:K,children:[c.jsxs("div",{className:"qsheet__head",children:[c.jsx("span",{className:"qsheet__head-icon","aria-hidden":"true",children:"?"}),c.jsxs("span",{children:[o.length===1?"Уточняющий вопрос":`Уточняющие вопросы (${o.length})`,l>0&&` — ещё ${l} в очереди`]})]}),c.jsxs("div",{className:"qsheet__body",children:[s.reason&&c.jsx("p",{className:"qsheet__reason",children:s.reason}),o.map(($,A)=>c.jsx(jS,{q:$,qi:A,selected:d[A]??new Set,otherText:g[A]??"",previewIndex:b[A]??null,onToggle:N,onFocusOption:C,onOtherText:H,onOptionsKeyDown:O},A))]}),c.jsxs("div",{className:"qsheet__actions",children:[c.jsx("button",{className:"btn",onClick:()=>r(s.requestId),children:"Не отвечать"}),c.jsx("button",{className:"btn btn--primary",disabled:!_,onClick:B,children:"Ответить"})]})]})})}function jS({q:s,qi:l,selected:i,otherText:r,previewIndex:o,onToggle:d,onFocusOption:h,onOtherText:g,onOptionsKeyDown:m}){var C;const b=s.options.some(N=>N.preview),x=o!==null?(C=s.options[o])==null?void 0:C.preview:void 0,k=i.has("other"),_=s.multiSelect?"checkbox":"radio";return c.jsxs("div",{className:"qsheet__question",children:[c.jsxs("div",{className:"qsheet__qhead",children:[c.jsx("span",{className:"chip chip--accent",children:s.header}),c.jsx("span",{className:"qsheet__qtext",children:s.question})]}),c.jsxs("div",{className:"qsheet__options"+(s.multiSelect?"":" qsheet__options--radio"),role:s.multiSelect?"group":"radiogroup","aria-label":s.question,onKeyDown:m,children:[s.options.map((N,H)=>{const B=i.has(H);return c.jsxs("button",{type:"button",role:_,"aria-checked":B,className:"qsheet__option"+(B?" is-selected":""),onClick:()=>d(l,H,s.multiSelect),onFocus:()=>h(l,H),onMouseEnter:()=>h(l,H),children:[c.jsx("span",{className:"qsheet__opt-mark","aria-hidden":"true"}),c.jsxs("span",{className:"qsheet__opt-body",children:[c.jsx("span",{className:"qsheet__opt-label",children:N.label}),c.jsx("span",{className:"qsheet__opt-desc",children:N.description})]})]},H)}),c.jsxs("div",{className:"qsheet__other",children:[c.jsxs("button",{type:"button",role:_,"aria-checked":k,className:"qsheet__option qsheet__option--other"+(k?" is-selected":""),onClick:()=>d(l,"other",s.multiSelect),children:[c.jsx("span",{className:"qsheet__opt-mark","aria-hidden":"true"}),c.jsxs("span",{className:"qsheet__opt-body",children:[c.jsx("span",{className:"qsheet__opt-label",children:"Другое"}),c.jsx("span",{className:"qsheet__opt-desc",children:"Свой вариант ответа"})]})]}),k&&c.jsx("input",{type:"text",className:"qsheet__other-input",placeholder:"Впишите свой вариант…","aria-label":`Свой вариант ответа на вопрос «${s.question}»`,value:r,onChange:N=>g(l,N.target.value),autoFocus:!0})]})]}),b&&c.jsx("pre",{className:"qsheet__preview",children:x??""})]})}function eb(s){return s.map(l=>{const i=l.options.findIndex(r=>r.preview);return i===-1?null:i})}function NS(s,l,i){const r={};for(let o=0;o<s.length;o++){const d=s[o];if(!d)continue;const h=l[o]??new Set,g=[];for(let m=0;m<d.options.length;m++){const b=d.options[m];b&&h.has(m)&&g.push(b.label)}if(h.has("other")){const m=(i[o]??"").trim();m&&g.push(m)}if(g.length===0)return null;r[d.question]=g.join(", ")}return r}function ex({path:s}){const[l,i]=S.useState(!1),[r,o]=S.useState(!1),d=S.useRef(null);S.useEffect(()=>{if(!l)return;function g(m){var b;(b=d.current)!=null&&b.contains(m.target)||i(!1)}return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[l]),S.useEffect(()=>{if(!r)return;const g=setTimeout(()=>o(!1),Hh);return()=>clearTimeout(g)},[r]),S.useEffect(()=>i(!1),[s]);async function h(){await Uh(s)&&o(!0)}return c.jsxs("div",{ref:d,className:"cwd",children:[c.jsxs("button",{type:"button",className:"cwd__toggle","aria-expanded":l,title:l?"Свернуть путь":`Полный путь: ${s}`,onClick:()=>i(g=>!g),onKeyDown:g=>{g.key!=="Escape"||!l||(g.preventDefault(),g.stopPropagation(),i(!1))},children:[c.jsx(TS,{open:l}),c.jsx("span",{className:"cwd__short",children:s})]}),l&&c.jsxs("div",{className:"cwd__pop",children:[c.jsx("span",{className:"cwd__full",children:s}),c.jsx("button",{type:"button",className:"btn btn--ghost cwd__copy",onClick:()=>void h(),children:r?gr:wi})]})]})}function TS({open:s}){return c.jsx("svg",{className:s?"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:c.jsx("path",{d:"M6 3.5 10.5 8 6 12.5"})})}function qs({value:s,options:l,onChange:i,className:r,title:o,ariaLabel:d,placeholder:h="—"}){const[g,m]=S.useState(!1),[b,x]=S.useState(0),k=S.useRef(null),_=S.useRef(null),C=l.find(B=>B.value===s)??null;S.useEffect(()=>{if(!g)return;const B=l.findIndex(K=>K.value===s);x(B===-1?0:B)},[g]),S.useEffect(()=>{if(!g)return;function B(K){var O;(O=k.current)!=null&&O.contains(K.target)||m(!1)}return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[g]),S.useEffect(()=>{var B,K;g&&((K=(B=_.current)==null?void 0:B.querySelector(".is-cursor"))==null||K.scrollIntoView({block:"nearest"}))},[g,b]),S.useEffect(()=>{if(!g)return;const B=_.current,K=ES(k.current);if(!B||!K)return;const O=B.getBoundingClientRect().bottom-K.getBoundingClientRect().bottom;O>0&&(K.scrollTop+=Math.min(O+8,B.offsetHeight))},[g]);function N(B){m(!1),B.value!==s&&i(B.value)}function H(B){if(B.key==="Escape"){if(!g)return;B.preventDefault(),B.stopPropagation(),m(!1);return}if(B.key==="ArrowDown"||B.key==="ArrowUp"){if(B.preventDefault(),!g)return m(!0);const K=B.key==="ArrowDown"?1:l.length-1;return x(O=>(O+K)%l.length)}if(B.key==="Enter"||B.key===" "){if(B.preventDefault(),!g)return m(!0);const K=l[b];K&&N(K)}}return c.jsxs("div",{ref:k,className:"select"+(g?" select--open":"")+(r?` ${r}`:""),children:[c.jsxs("button",{type:"button",className:"select__trigger",title:o,"aria-label":d??o,"aria-haspopup":"listbox","aria-expanded":g,onClick:()=>m(B=>!B),onKeyDown:H,children:[c.jsx("span",{className:"select__value",children:(C==null?void 0:C.label)??h}),c.jsx(AS,{})]}),g&&c.jsx("div",{ref:_,className:"select__menu",role:"listbox","aria-label":d??o,children:l.map((B,K)=>c.jsxs("button",{type:"button",role:"option","aria-selected":B.value===s,className:"select__option"+(K===b?" is-cursor":"")+(B.value===s?" is-on":""),onMouseEnter:()=>x(K),onClick:()=>N(B),children:[c.jsx("span",{className:"select__check","aria-hidden":"true",children:B.value===s?"✓":""}),c.jsx("span",{className:"select__label",children:B.label}),B.hint&&c.jsx("span",{className:"select__hint",children:B.hint})]},B.value))})]})}function ES(s){let l=(s==null?void 0:s.parentElement)??null;for(;l;){if(l.scrollHeight>l.clientHeight&&getComputedStyle(l).overflowY!=="visible")return l;l=l.parentElement}return null}function AS(){return c.jsx("svg",{className:"select__chev",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:c.jsx("path",{d:"M3 4.5 6 7.5 9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}const CS=["low","medium","high"];function tx({models:s,value:l,effort:i,ultracode:r,thinking:o,switchOnFlag:d,className:h,onModel:g,onEffort:m,onUltracode:b,onThinking:x,onSwitchOnFlag:k}){const[_,C]=S.useState(!1),[N,H]=S.useState(0),B=S.useRef(null),K=S.useRef(null),O=s.find(M=>M.value===l)??null,$=O&&O.supportsEffort?O.effortLevels.length>0?O.effortLevels:CS:[],A=$.includes("xhigh");S.useEffect(()=>{if(!_)return;const M=s.findIndex(W=>W.value===l);H(M===-1?0:M)},[_]),S.useEffect(()=>{if(!_)return;function M(W){var re;(re=B.current)!=null&&re.contains(W.target)||C(!1)}return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[_]),S.useEffect(()=>{var M,W;_&&((W=(M=K.current)==null?void 0:M.querySelector(".is-cursor"))==null||W.scrollIntoView({block:"nearest"}))},[_,N]);function Q(M){C(!1),M.value!==l&&g(M.value)}function L(M){if(M.key==="Escape"){if(!_)return;M.preventDefault(),M.stopPropagation(),C(!1);return}if(M.key==="ArrowDown"||M.key==="ArrowUp"){if(M.preventDefault(),!_)return C(!0);if(s.length===0)return;const W=M.key==="ArrowDown"?1:s.length-1;return H(re=>(re+W)%s.length)}if(M.key==="Enter"||M.key===" "){if(M.preventDefault(),!_)return C(!0);const W=s[N];W&&Q(W)}}return c.jsxs("div",{ref:B,className:"select"+(_?" select--open":"")+(h?` ${h}`:""),children:[c.jsxs("button",{type:"button",className:"select__trigger",title:"Модель, усилие и размышления","aria-label":"Модель, усилие и размышления","aria-haspopup":"menu","aria-expanded":_,onClick:()=>C(M=>!M),onKeyDown:L,children:[c.jsx("span",{className:"select__value",children:(O==null?void 0:O.displayName)??l??"—"}),r?c.jsx("span",{className:"select__suffix select__suffix--hot",children:"ultracode"}):$.length>0&&i&&c.jsx("span",{className:"select__suffix",children:i}),c.jsx(RS,{})]}),_&&c.jsxs("div",{ref:K,className:"select__menu modelmenu",role:"menu",children:[c.jsx("div",{className:"modelmenu__head",children:"Модель"}),s.map((M,W)=>c.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":M.value===l,className:"select__option"+(W===N?" is-cursor":"")+(M.value===l?" is-on":""),onMouseEnter:()=>H(W),onClick:()=>Q(M),children:[c.jsx("span",{className:"select__check","aria-hidden":"true",children:M.value===l?"✓":""}),c.jsx("span",{className:"select__label",children:M.displayName}),M.description&&c.jsx("span",{className:"select__hint",children:M.description})]},M.value)),$.length>0&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"modelmenu__sep",role:"separator"}),c.jsxs("div",{className:"modelmenu__row",children:[c.jsxs("span",{className:"modelmenu__label",children:["Усилие",c.jsx("span",{className:"modelmenu__desc",children:"насколько усердно модель думает"})]}),c.jsx("span",{className:"modelmenu__levels",children:$.map(M=>c.jsx("button",{type:"button",role:"menuitemradio","aria-checked":M===i,className:M===i?"modelmenu__level is-on":"modelmenu__level",onClick:()=>m(M),children:M},M))})]}),A&&c.jsx(rh,{label:"Ultracode",desc:"xhigh и постоянная оркестрация подагентами",on:r,onToggle:()=>b(!r)})]}),c.jsx("div",{className:"modelmenu__sep",role:"separator"}),(O==null?void 0:O.supportsThinking)!==!1&&c.jsx(rh,{label:"Размышления",desc:"расширенное обдумывание перед ответом",on:o,onToggle:()=>x(!o)}),c.jsx(rh,{label:"Менять модель по флагу",desc:"иначе помеченный ход встаёт на паузу",on:d,onToggle:()=>k(!d)})]})]})}function rh({label:s,desc:l,on:i,onToggle:r}){return c.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":i,className:"modelmenu__row modelmenu__row--btn",onClick:r,children:[c.jsxs("span",{className:"modelmenu__label",children:[s,c.jsx("span",{className:"modelmenu__desc",children:l})]}),c.jsx("span",{className:i?"switch is-on":"switch","aria-hidden":"true",children:c.jsx("span",{className:"switch__knob"})})]})}function RS(){return c.jsx("svg",{className:"select__chev",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:c.jsx("path",{d:"M3 4.5 6 7.5 9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function Pl({title:s,children:l,actions:i,className:r,sheet:o=!1,onClose:d}){const h=S.useRef(null);return S.useEffect(()=>{function g(m){if(m.key==="Escape"){m.preventDefault(),m.stopPropagation(),d();return}if(m.key!=="Tab")return;const b=h.current;if(!b)return;const x=b.querySelectorAll('button, input, textarea, select, a[href], [tabindex]:not([tabindex="-1"])'),k=x[0],_=x[x.length-1];!k||!_||(m.shiftKey&&document.activeElement===k?(m.preventDefault(),_.focus()):!m.shiftKey&&document.activeElement===_&&(m.preventDefault(),k.focus()))}return document.addEventListener("keydown",g,!0),()=>document.removeEventListener("keydown",g,!0)},[d]),c.jsx("div",{className:o?"modal-backdrop modal-backdrop--sheet":"modal-backdrop",onMouseDown:g=>{g.target===g.currentTarget&&d()},children:c.jsxs("div",{ref:h,className:r?`modal ${r}`:"modal",role:"dialog","aria-modal":"true","aria-label":s,children:[c.jsxs("div",{className:"modal__head",children:[c.jsx("h2",{className:"modal__title",children:s}),c.jsx("button",{className:"modal__close","aria-label":"Закрыть",onClick:d,children:"✕"})]}),c.jsx("div",{className:"modal__body",children:l}),i&&c.jsx("div",{className:"modal__actions",children:i})]})})}function MS({candidates:s,searching:l,agentItems:i,agentBusy:r,error:o,roots:d,created:h,onSearch:g,onAskAgent:m,onInterrupt:b,onSubmit:x,onCreate:k,onClose:_}){const[C,N]=S.useState("open"),[H,B]=S.useState(""),[K,O]=S.useState(!1),[$,A]=S.useState(""),[Q,L]=S.useState(""),[M,W]=S.useState({git:!0,claudeMd:!0,readme:!0}),re=H.trim(),he=re!=="",F=$.trim(),ae=Q.trim(),me=F!==""&&ae!=="";S.useEffect(()=>{$===""&&d.length>0&&A(d[0])},[d]);const Ne=S.useRef(g);Ne.current=g,S.useEffect(()=>{if(C!=="open")return;const te=H.trim(),xe=setTimeout(()=>Ne.current(te),200);return()=>clearTimeout(xe)},[H,C]);function pe(){he&&x(re)}function z(){me&&k(F,ae,M)}function P(){he&&(O(!0),m(re))}return h?c.jsxs(Pl,{title:"Новый проект",onClose:_,actions:c.jsx("button",{className:"btn btn--primary",onClick:_,autoFocus:!0,children:"Понятно"}),children:[c.jsx("p",{className:"modal__text",children:"Каталог создан и открыт как проект, но часть шагов не удалась."}),c.jsx("p",{className:"newproj__preview",children:h.path}),c.jsx("div",{className:"modal__error",children:c.jsx("ul",{className:"newproj__warnings",children:h.warnings.map(te=>c.jsx("li",{children:te},te))})}),c.jsx("p",{className:"modal__text modal__text--dim",children:"Проект открыт и работает — недостающее можно добавить руками, в дереве файлов или из терминала."})]}):c.jsxs(Pl,{title:"Новый проект",className:K&&C==="open"?"modal--wide":void 0,onClose:_,actions:c.jsxs(c.Fragment,{children:[c.jsx("button",{className:"btn",onClick:_,children:"Отмена"}),C==="open"?c.jsxs(c.Fragment,{children:[r?c.jsx("button",{className:"btn",onClick:b,children:"Остановить"}):c.jsx("button",{className:"btn",disabled:!he,onClick:P,title:"Найти по описанию",children:"Попросить агента"}),c.jsx("button",{className:"btn btn--primary",disabled:!he,onClick:pe,children:"Открыть"})]}):c.jsx("button",{className:"btn btn--primary",disabled:!me,onClick:z,children:"Создать"})]}),children:[c.jsxs("div",{className:"tabs",children:[c.jsx(tb,{label:"Открыть",on:C==="open",onClick:()=>N("open")}),c.jsx(tb,{label:"Создать",on:C==="create",onClick:()=>N("create")})]}),C==="open"?c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"modal__text",children:"Каталог, в котором будет работать агент. Введите путь или часть имени — подходящие каталоги появятся ниже."}),c.jsx("label",{className:"field",htmlFor:"workspace-path",children:"Путь или название"}),c.jsx("input",{id:"workspace-path",className:"input input--mono",value:H,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"C:\\Projects\\my-app",onChange:te=>B(te.target.value),onKeyDown:te=>{te.key==="Enter"&&(te.preventDefault(),pe())}}),o&&c.jsx("p",{className:"modal__error",children:o}),s.length>0&&c.jsx("ul",{className:"finds",children:s.map(te=>c.jsx("li",{children:c.jsxs("button",{className:"find",disabled:te.open,title:te.open?"Этот проект уже открыт":te.path,onClick:()=>B(te.path),onDoubleClick:()=>x(te.path),children:[c.jsx("span",{className:"find__name",children:te.name}),c.jsx("span",{className:"find__path",children:te.path}),c.jsx("span",{className:"find__note",children:zS(te)})]})},te.path))}),s.length===0&&he&&!l&&!K&&c.jsx("p",{className:"modal__text modal__text--dim",children:"Ничего похожего среди каталогов, где вы работали. Если помните не имя, а суть проекта — опишите его и нажмите «Попросить агента». Проекта ещё нет вовсе — рядом вкладка «Создать»."}),K&&c.jsx("div",{className:"finds__agent",children:c.jsx(qh,{items:i,busy:r,waiting:!1,empty:"Агент ищет…"})})]}):c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"modal__text",children:"Пустой каталог для нового проекта. Дальше в нём работает агент — с первого промпта, без отдельной настройки."}),c.jsx("label",{className:"field",htmlFor:"workspace-parent",children:"Где создать"}),c.jsx("input",{id:"workspace-parent",className:"input input--mono",value:$,spellCheck:!1,autoComplete:"off",placeholder:"C:\\Projects",onChange:te=>A(te.target.value)}),d.length>0&&c.jsx("div",{className:"newproj__roots",children:d.map(te=>c.jsx("button",{type:"button",className:te===F?"newproj__root is-on":"newproj__root",title:te,onClick:()=>A(te),children:DS(te)},te))}),c.jsx("label",{className:"field newproj__field",htmlFor:"workspace-name",children:"Имя проекта"}),c.jsx("input",{id:"workspace-name",className:"input input--mono",value:Q,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"my-app",onChange:te=>L(te.target.value),onKeyDown:te=>{te.key==="Enter"&&(te.preventDefault(),z())}}),c.jsx("p",{className:"newproj__preview",children:me?OS(F,ae):"Каталог появится здесь"}),o&&c.jsx("p",{className:"modal__error",children:o}),c.jsxs("div",{className:"newproj__opts",children:[c.jsx(ch,{label:"git init",desc:"панель истории работает сразу",on:M.git,onToggle:()=>W(te=>({...te,git:!te.git}))}),c.jsx(ch,{label:"CLAUDE.md",desc:"заготовка инструкций для агента",on:M.claudeMd,onToggle:()=>W(te=>({...te,claudeMd:!te.claudeMd}))}),c.jsx(ch,{label:"README.md",desc:"по нему проект потом узнаёт поиск",on:M.readme,onToggle:()=>W(te=>({...te,readme:!te.readme}))})]})]})]})}function tb({label:s,on:l,onClick:i}){return c.jsx("button",{type:"button",className:l?"tabs__tab is-on":"tabs__tab","aria-pressed":l,onClick:i,children:s})}function ch({label:s,desc:l,on:i,onToggle:r}){return c.jsxs("button",{type:"button",role:"checkbox","aria-checked":i,className:"newproj__opt",onClick:r,children:[c.jsxs("span",{className:"newproj__optlabel",children:[s,c.jsx("span",{className:"newproj__optdesc",children:l})]}),c.jsx("span",{className:i?"switch is-on":"switch","aria-hidden":"true",children:c.jsx("span",{className:"switch__knob"})})]})}function OS(s,l){const i=s.includes("\\")?"\\":"/";return s.replace(/[\\/]+$/,"")+i+l}function DS(s){const l=s.includes("\\")?"\\":"/",i=s.split(/[\\/]/).filter(Boolean);return i.length<=2?s:`…${l}${i.slice(-2).join(l)}`}function zS(s){return s.open?"уже открыт":s.why?s.why:s.sessions===0?"рядом с вашими проектами":`${LS(s.sessions)}${US(s.lastUsedAt)}`}function LS(s){const l=s%10,i=s%100;return i>=11&&i<=14?`${s} сессий`:l===1?`${s} сессия`:l>=2&&l<=4?`${s} сессии`:`${s} сессий`}function US(s){if(!s)return"";const l=Math.floor((Date.now()-s)/864e5);return l<=0?" · сегодня":l===1?" · вчера":l<30?` · ${l} дн. назад`:` · ${new Date(s).toLocaleDateString("ru-RU")}`}const Gh=7;function HS(s){const l=[],i=[];let r=1;for(const o of s){const d=l.slice();let h=l.indexOf(o.hash);h===-1&&(h=nb(l),l[h]=o.hash);const[g,...m]=o.parents;l[h]=g??null;const b=[];g!==void 0&&b.push({from:h,to:h});for(const _ of m){let C=l.indexOf(_);C===-1&&(C=nb(l),l[C]=_),b.push({from:h,to:C})}const x=[];for(let _=0;_<d.length;_++)d[_]===o.hash&&(x.push({from:_,to:h}),_!==h&&(l[_]=null));const k=[];for(let _=0;_<d.length;_++){const C=d[_];!C||C===o.hash||_===h||l[_]===C&&k.push(_)}BS(l),r=Math.max(r,l.length,h+1),i.push({commit:o,col:h,up:x,down:b,through:k})}return{rows:i,columns:Math.min(r,Gh)}}function nb(s){const l=s.indexOf(null);return l!==-1?l:(s.push(null),s.length-1)}function BS(s){for(;s.length>0&&s[s.length-1]===null;)s.pop()}const nx=1500;function qS(s){const l=[];let i=!1;for(const r of s.patch.split(`
120
120
  `)){if(l.length>=nx){i=!0;break}if(r.startsWith("@@"))l.push({type:"gap",text:GS(r)});else if(r.startsWith("+"))l.push({type:"add",text:r.slice(1)});else if(r.startsWith("-"))l.push({type:"del",text:r.slice(1)});else{if(r.startsWith("\\"))continue;(r!==""||l.length>0)&&l.push({type:"ctx",text:r.startsWith(" ")?r.slice(1):r})}}return{kind:"patch",filePath:s.path||s.oldPath,rows:l,added:s.added,removed:s.removed,note:YS(s,i)}}function GS(s){const l=/^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@ ?(.*)$/.exec(s);if(!l)return s;const i=Number(l[1]),r=l[2]===void 0?1:Number(l[2]),o=(l[3]??"").trim(),d=r>1?`строки ${i}–${i+r-1}`:`строка ${i}`;return o?`⋯ ${d} · ${o}`:`⋯ ${d}`}function YS(s,l){const i=[];return s.status==="added"&&i.push("новый файл"),s.status==="deleted"&&i.push("файл удалён"),s.status==="renamed"&&i.push(`переименован из ${s.oldPath}`),s.binary?i.push("двоичный файл"):s.patch===""&&i.push("содержимое не показано"),l&&i.push(`показаны первые ${nx} строк`),i.length>0?i.join(" · "):null}function IS({open:s,state:l,result:i,selected:r,onRefresh:o,onShow:d,onCheckout:h,onClose:g,zoomed:m,onToggleZoom:b}){const x=HS((l==null?void 0:l.commits)??[]),k=[...l!=null&&l.detached?[{value:"",label:`отделён · ${l.head.slice(0,8)}`}]:[],...((l==null?void 0:l.branches)??[]).map(_=>({value:_.name,label:_.name,hint:_.hash.slice(0,8)}))];return c.jsxs("aside",{className:(s?"sidepane sidepane--git sidepane--open":"sidepane sidepane--git")+(m?" sidepane--zoomed":""),"aria-label":"История git",children:[c.jsxs("div",{className:"sidepane__head",onDoubleClick:_=>{b&&(_.target.closest("button")||b())},children:[c.jsx(ZS,{}),c.jsx("span",{className:"sidepane__title",children:"История"}),c.jsx("button",{className:"sidepane__btn",title:"Обновить","aria-label":"Обновить историю",onClick:o,children:"↻"}),b&&c.jsx("button",{className:"sidepane__btn",title:m?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":m?"Свернуть панель истории":"Развернуть панель истории на весь экран","aria-pressed":m,onClick:b,children:c.jsx(Tr,{active:m})}),c.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель истории",onClick:g,children:"✕"})]}),l===null?c.jsx("p",{className:"sidepane__empty",children:"Читаем репозиторий…"}):l.available?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"gitbar",children:[c.jsx(qs,{className:"gitbar__branch",title:"Ветка — выбрать значит переключиться",value:l.detached?"":l.branch,options:k,onChange:_=>{_&&h(_,`ветку ${_}`)}}),l.ahead>0&&c.jsxs("span",{className:"chip",title:`${l.ahead} — столько коммитов не отправлено`,children:["↑",l.ahead]}),l.behind>0&&c.jsxs("span",{className:"chip",title:`${l.behind} — столько коммитов не забрано`,children:["↓",l.behind]})]}),l.detached&&c.jsx("p",{className:"gitbar__note",children:"HEAD отделён от ветки. Выберите ветку в списке, чтобы вернуться."}),c.jsxs("div",{className:"sidepane__scroll",children:[c.jsx("button",{className:"gitrow gitrow--work"+(r===""?" is-on":""),onClick:()=>d(""),children:c.jsxs("span",{className:"gitrow__body",children:[c.jsx("span",{className:"gitrow__subject",children:l.changed.length>0?`Рабочее дерево · ${l.changed.length} ${FS(l.changed.length)}`:"Рабочее дерево чистое"}),c.jsx("span",{className:"gitrow__meta",children:l.changed.length>0?l.changed.slice(0,4).map(_=>JS(_.path)).join(", "):"незакоммиченных изменений нет"})]})}),x.rows.map(_=>c.jsx(XS,{row:_,columns:x.columns,head:_.commit.hash===l.head,local:l.hasRemote&&!_.commit.pushed,active:r===_.commit.hash,onOpen:()=>d(_.commit.hash)},_.commit.hash)),x.rows.length===0&&c.jsx("p",{className:"sidepane__empty",children:"В репозитории ещё нет коммитов"})]})]}):c.jsx("p",{className:"sidepane__empty",children:l.message||"Это не git-репозиторий"}),c.jsx(Uc,{result:i})]})}const Tc=50,lb=13;function XS({row:s,columns:l,head:i,local:r,active:o,onOpen:d}){const{commit:h}=s,g=h.refs.map(KS).filter(Boolean);return c.jsxs("button",{className:"gitrow"+(o?" is-on":""),title:r?"Коммит ещё не отправлен на удалённый репозиторий":void 0,onClick:d,children:[c.jsx(VS,{row:s,columns:l,head:i,local:r}),c.jsxs("span",{className:"gitrow__body",children:[c.jsxs("span",{className:"gitrow__subject",children:[g.map(m=>c.jsx("span",{className:"gitrow__ref",children:m},m)),h.subject]}),c.jsxs("span",{className:"gitrow__meta",children:[h.shortHash," · ",h.author," · ",WS(h.date),r&&c.jsx("span",{className:"gitrow__local",children:"· не отправлен"})]})]})]})}function VS({row:s,columns:l,head:i,local:r}){const o=l*lb+6,d=Tc/2,h=b=>8+Math.min(b,Gh-1)*lb,g=r?"3.5 2.5":void 0,m=po(s.col);return c.jsxs("svg",{className:"gitgraph",width:o,height:Tc,viewBox:`0 0 ${o} ${Tc}`,"aria-hidden":"true",children:[s.through.map(b=>c.jsx("line",{x1:h(b),y1:0,x2:h(b),y2:Tc,style:{stroke:po(b)}},`t${b}`)),s.up.map((b,x)=>c.jsx("path",{d:`M${h(b.from)} 0 L${h(b.from)} ${d-12} L${h(b.to)} ${d}`,fill:"none",style:{stroke:po(b.from),strokeDasharray:g}},`u${x}`)),s.down.map((b,x)=>c.jsx("path",{d:`M${h(b.from)} ${d} L${h(b.to)} ${d+12} L${h(b.to)} ${Tc}`,fill:"none",style:{stroke:po(b.to),strokeDasharray:g}},`d${x}`)),i&&c.jsx("circle",{className:"gitgraph__head",cx:h(s.col),cy:d,r:s.commit.parents.length>1?7.4:6.6}),c.jsx("circle",{className:"gitgraph__dot",cx:h(s.col),cy:d,r:s.commit.parents.length>1?4.6:3.6,style:{stroke:m,fill:r?void 0:m}})]})}function po(s){return`var(--lane-${s%Gh})`}function QS({detail:s,local:l,onCheckout:i,onClose:r}){const o=s.hash==="";return c.jsxs(Pl,{className:"modal--wide",title:o?"Незакоммиченные изменения":`Коммит ${s.shortHash}`,onClose:r,actions:c.jsxs(c.Fragment,{children:[!o&&c.jsx("button",{className:"btn",onClick:()=>i(s.hash,`коммит ${s.shortHash} (HEAD отделится от ветки)`),children:"Переключиться сюда"}),c.jsx("button",{className:"btn btn--primary",onClick:r,children:"Закрыть"})]}),children:[!o&&c.jsxs("div",{className:"commit__head",children:[c.jsx("p",{className:"commit__subject",children:s.subject}),c.jsxs("p",{className:"commit__meta",children:[s.author,s.email&&` <${s.email}>`," · ",PS(s.date)," ·"," ",c.jsx("span",{className:"commit__hash",children:s.hash})]}),l&&c.jsx("p",{className:"commit__meta commit__meta--local",children:"Не отправлен: этого коммита нет ни в одной удалённой ветке."}),s.parents.length>0&&c.jsxs("p",{className:"commit__meta",children:[s.parents.length>1?"слияние: ":"родитель: ",s.parents.map(d=>d.slice(0,8)).join(", ")]}),s.body&&c.jsx("pre",{className:"commit__body",children:s.body})]}),s.truncated&&c.jsx("p",{className:"modal__text",children:"Изменения слишком велики — часть патча не показана."}),s.files.length===0?c.jsx("p",{className:"modal__text",children:"Изменений нет."}):s.files.map(d=>c.jsx($S,{file:d,defaultOpen:s.files.length<=3},d.path+d.oldPath))]})}function $S({file:s,defaultOpen:l}){const[i,r]=S.useState(l);return c.jsxs("div",{className:"commit__file",children:[c.jsxs("button",{className:"commit__filehead",onClick:()=>r(o=>!o),children:[c.jsx("span",{className:"commit__filepath",children:s.path||s.oldPath}),c.jsxs("span",{className:"diff__stat",children:[s.added>0&&c.jsxs("span",{className:"diff__stat--add",children:["+",s.added]}),s.removed>0&&c.jsxs("span",{className:"diff__stat--del",children:["−",s.removed]})]}),c.jsx("span",{className:"tool__status",children:i?"▴":"▾"})]}),i&&c.jsx(Bh,{diff:qS(s)})]})}function ZS(){return c.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[c.jsx("circle",{cx:"4.5",cy:"3.5",r:"1.9"}),c.jsx("circle",{cx:"4.5",cy:"12.5",r:"1.9"}),c.jsx("circle",{cx:"11.5",cy:"8",r:"1.9"}),c.jsx("path",{d:"M4.5 5.4v5.2M6.4 3.9h2.2a1.6 1.6 0 0 1 1.6 1.6v.8"})]})}function KS(s){return s.replace(/^HEAD -> /,"").replace(/^tag: /,"⌂ ").trim()}function JS(s){const l=s.split("/");return l[l.length-1]??s}function FS(s){const l=s%100;if(l>=11&&l<=14)return"файлов";switch(s%10){case 1:return"файл";case 2:case 3:case 4:return"файла";default:return"файлов"}}function WS(s){const l=Date.parse(s);if(Number.isNaN(l))return s;const i=Math.round((Date.now()-l)/6e4);if(i<1)return"только что";if(i<60)return`${i} мин назад`;const r=Math.round(i/60);if(r<24)return`${r} ч назад`;const o=Math.round(r/24);return o<30?`${o} дн назад`:new Date(l).toLocaleDateString()}function PS(s){const l=Date.parse(s);return Number.isNaN(l)?s:new Date(l).toLocaleString()}function ek({open:s,items:l,busy:i,ready:r,commands:o,contextResult:d,models:h,model:g,effort:m,ultracode:b,thinking:x,switchOnFlag:k,onContextSearch:_,onCommand:C,onModel:N,onEffort:H,onUltracode:B,onThinking:K,onSwitchOnFlag:O,onAsk:$,onInterrupt:A,onReset:Q,onClose:L,zoomed:M,onToggleZoom:W}){return c.jsxs("aside",{className:(s?"sidepane sidepane--ask sidepane--open":"sidepane sidepane--ask")+(M?" sidepane--zoomed":""),"aria-label":"Вопрос на полях",children:[c.jsxs("div",{className:"sidepane__head",onDoubleClick:re=>{W&&(re.target.closest("button")||W())},children:[c.jsx(tk,{}),c.jsx("span",{className:"sidepane__title",children:"Вопрос на полях"}),c.jsx("button",{className:"sidepane__btn",title:"Начать заново — следующий вопрос возьмёт свежий контекст","aria-label":"Начать боковой разговор заново",disabled:l.length===0,onClick:Q,children:"↻"}),W&&c.jsx("button",{className:"sidepane__btn",title:M?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":M?"Свернуть панель вопроса":"Развернуть панель вопроса на весь экран","aria-pressed":M,onClick:W,children:c.jsx(Tr,{active:M})}),c.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель вопроса",onClick:L,children:"✕"})]}),h.length>0&&c.jsxs("div",{className:"sidepane__tools",children:[c.jsx(tx,{className:"select--compact",models:h,value:g,effort:m,ultracode:b,thinking:x,switchOnFlag:k,onModel:N,onEffort:H,onUltracode:B,onThinking:K,onSwitchOnFlag:O}),c.jsx("span",{className:"sidepane__note",title:"Боковой вопрос работает только на чтение",children:"только чтение"})]}),c.jsx(qh,{items:l,busy:i,waiting:!1,empty:r?"Спросите о том, что происходит: вопрос уйдёт в сторону от основного разговора и не попадёт в его контекст. Отвечающий видит сессию и проект, но ничего не меняет.":"Откройте сессию — вопрос задаётся о ней."}),c.jsx(Wb,{className:"composer--side",disabled:!r,busy:i,commands:o,sessionTitle:null,contextResult:d,placeholder:"Спросить, не мешая работе…",sendLabel:"Спросить",autoFocus:s,onContextSearch:_,onCommand:C,onSend:$,onInterrupt:A,onEscape:i?A:L})]})}function tk(){return c.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:[c.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"}),c.jsx("path",{d:"M8.4 8.5v-.3c0-.7.9-.9.9-1.7a1 1 0 0 0-1.9-.4"})]})}const nk=75,lk=90;function lx({usage:s}){if(!(s!=null&&s.available))return null;const l=[];return s.fiveHour&&l.push({key:"five",label:"5 ч",window:s.fiveHour}),s.sevenDay&&l.push({key:"week",label:"нед",window:s.sevenDay}),l.length===0?null:c.jsx("div",{className:"usage",title:ik(s),"aria-label":`Расход лимитов плана${s.plan?` ${s.plan}`:""}`,children:l.map(i=>c.jsx(ak,{label:i.label,window:i.window},i.key))})}function ak({label:s,window:l}){const i=Math.round(l.utilization),r=rk(l.resetsAt);return c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"usage__label",children:s}),c.jsx("span",{className:"usage__track",role:"progressbar","aria-label":s,"aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":100,children:c.jsx("span",{className:`usage__fill${sk(i)}`,style:{width:`${i}%`}})}),c.jsxs("span",{className:"usage__pct",children:[i,"%"]}),c.jsx("span",{className:"usage__reset",title:ix(l.resetsAt)||void 0,children:r&&`↻ ${r}`})]})}function sk(s){return s>=lk?" usage__fill--over":s>=nk?" usage__fill--warn":""}function ik(s){const l=[s.plan?`Лимиты плана ${s.plan}`:"Лимиты плана"],i=(r,o)=>{if(!o)return;const d=ix(o.resetsAt);l.push(`${r}: ${Math.round(o.utilization)}%${d?`, ${d}`:""}`)};return i("5 часов",s.fiveHour),i("Неделя",s.sevenDay),i("Неделя, Opus",s.sevenDayOpus),l.join(`
121
121
  `)}function ax(s){if(!s)return null;const l=new Date(s);return Number.isNaN(l.getTime())?null:l}function sx(s){return s.getTime()-Date.now()<1440*60*1e3}function rk(s){const l=ax(s);return l?sx(l)?l.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):l.toLocaleDateString(void 0,{day:"numeric",month:"short"}):""}function ix(s){const l=ax(s);return l?`обнулится ${sx(l)?`в ${l.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}`:l.toLocaleDateString(void 0,{day:"numeric",month:"long"})}`:""}function rx(){const[s,l]=S.useState(()=>new Date);return S.useEffect(()=>{let i=0;const r=()=>{const d=new Date;l(d),i=window.setTimeout(r,6e4-(d.getSeconds()*1e3+d.getMilliseconds()))};r();const o=()=>{document.hidden||(window.clearTimeout(i),r())};return document.addEventListener("visibilitychange",o),()=>{window.clearTimeout(i),document.removeEventListener("visibilitychange",o)}},[]),c.jsxs("time",{className:"clock",dateTime:s.toISOString(),title:ck(s),children:[c.jsx("span",{className:"clock__time",children:s.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}),c.jsx("span",{className:"clock__date",children:s.toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})})]})}function ck(s){return s.toLocaleDateString(void 0,{weekday:"long",day:"numeric",month:"long",year:"numeric"})}function uk({onClose:s,permission:l,model:i,usage:r,cwd:o,costLabel:d,onRefresh:h,refreshing:g,metersFetchedAt:m,onRename:b}){return c.jsx(Pl,{title:"Настройки сессии",className:"modal--sheet",sheet:!0,onClose:s,children:c.jsxs("div",{className:"sessionmenu",children:[l&&c.jsx(fr,{label:"Режим прав",children:l}),c.jsx(fr,{label:"Модель",children:i}),(r==null?void 0:r.available)&&(r.fiveHour||r.sevenDay)&&c.jsx(fr,{label:"Лимиты плана",children:c.jsx(lx,{usage:r})}),c.jsxs("button",{type:"button",className:g?"sessionmenu__refresh is-busy":"sessionmenu__refresh","aria-busy":g,disabled:g,onClick:h,children:[c.jsx(ok,{}),c.jsxs("span",{className:"sessionmenu__refresh-text",children:["Обновить показания",m&&c.jsxs("span",{className:"sessionmenu__refresh-time",children:["обновлено в"," ",new Date(m).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})]})]})]}),c.jsx(fr,{label:"Время",children:c.jsx(rx,{})}),d&&c.jsx(fr,{label:"Стоимость хода",children:c.jsx("span",{className:"badge badge--cost",children:d})}),o&&c.jsx(fr,{label:"Каталог проекта",children:c.jsx(ex,{path:o})}),b&&c.jsx("button",{type:"button",className:"sessionmenu__rename",onClick:b,children:"Переименовать сессию"})]})})}function fr({label:s,children:l}){return c.jsxs("div",{className:"sessionmenu__row",children:[c.jsx("span",{className:"sessionmenu__label",children:s}),l]})}function ok(){return c.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("path",{d:"M14 8a6 6 0 1 1-6-6c1.68 0 3.29.67 4.49 1.83L14 5.33"}),c.jsx("path",{d:"M14 2v3.33h-3.33"})]})}function fk({tab:s,servers:l,plugins:i,marketplaces:r,catalog:o,result:d,actions:h,onTab:g,onClose:m}){const b=[{id:"mcp",label:"MCP-серверы",count:l.length},{id:"plugins",label:"Плагины",count:i.length},{id:"catalog",label:"Каталог",count:o.length}];return c.jsxs(Pl,{title:"Расширения",className:"modal--wide",onClose:m,children:[c.jsx("div",{className:"tabs",role:"tablist",children:b.map(x=>c.jsxs("button",{role:"tab","aria-selected":s===x.id,className:s===x.id?"tabs__tab is-on":"tabs__tab",onClick:()=>g(x.id),children:[x.label,c.jsx("span",{className:"tabs__count",children:x.count})]},x.id))}),s==="mcp"&&c.jsx(dk,{servers:l,actions:h}),s==="plugins"&&c.jsx(yk,{plugins:i,marketplaces:r,actions:h}),s==="catalog"&&c.jsx(bk,{catalog:o,hasMarketplaces:r.length>0,actions:h,onMarketplaces:()=>g("plugins")}),c.jsx(Uc,{result:d})]})}function dk({servers:s,actions:l}){const[i,r]=S.useState(!1);return c.jsxs(c.Fragment,{children:[s.length===0&&!i&&c.jsxs("p",{className:"modal__text",children:["Ни одного MCP-сервера. Добавленный здесь попадёт в ",c.jsx("code",{children:".mcp.json"})," ","проекта — его увидит и консольный ",c.jsx("code",{children:"claude mcp list"}),"."]}),c.jsx("ul",{className:"extlist",children:s.map(o=>c.jsxs("li",{className:"extlist__row",children:[c.jsxs("div",{className:"extlist__head",children:[c.jsx("span",{className:"extlist__name",children:o.name}),c.jsx("span",{className:`chip chip--${pk(o.status)}`,children:hk[o.status]}),o.scope&&c.jsx("span",{className:"chip",children:o.scope}),o.transport&&c.jsx("span",{className:"chip",children:o.transport})]}),o.target&&c.jsx("div",{className:"extlist__meta",title:o.target,children:o.target}),o.error&&c.jsx("div",{className:"extlist__error",children:o.error}),o.tools.length>0&&c.jsxs("div",{className:"extlist__meta",children:["Инструментов: ",o.tools.length," · ",o.tools.slice(0,6).join(", "),o.tools.length>6&&"…"]}),c.jsxs("div",{className:"extlist__actions",children:[c.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>l.mcpAction(o.name,"reconnect"),children:"Переподключить"}),o.status==="disabled"?c.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>l.mcpAction(o.name,"enable"),children:"Включить"}):c.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>l.mcpAction(o.name,"disable"),children:"Выключить"}),o.editable&&c.jsx("button",{className:"btn btn--ghost btn--sm btn--danger",onClick:()=>l.mcpRemove(o.name),children:"Удалить"})]})]},o.name))}),i?c.jsx(mk,{onCancel:()=>r(!1),onSubmit:(o,d)=>{l.mcpAdd(o,d),r(!1)}}):c.jsx("div",{className:"extbar",children:c.jsx("button",{className:"btn btn--primary",onClick:()=>r(!0),children:"+ Сервер"})})]})}const hk={connected:"подключён",failed:"ошибка","needs-auth":"нужна авторизация",pending:"подключается",disabled:"выключен",unknown:"неизвестно"};function pk(s){return s==="connected"?"ok":s==="failed"?"bad":s==="needs-auth"?"warn":"mute"}function mk({onSubmit:s,onCancel:l}){const[i,r]=S.useState(""),[o,d]=S.useState("stdio"),[h,g]=S.useState(""),[m,b]=S.useState(""),[x,k]=S.useState(""),_=o==="stdio",C=i.trim()!==""&&(_?h.trim()!=="":m.trim()!=="");function N(){if(C)if(_){const[H,...B]=gk(h);s(i.trim(),{transport:"stdio",command:H??"",args:B,env:ab(x)})}else s(i.trim(),{transport:o,url:m.trim(),headers:ab(x)})}return c.jsxs("div",{className:"extform extform--card",children:[c.jsx("label",{className:"field",htmlFor:"mcp-name",children:"Имя сервера"}),c.jsx("input",{id:"mcp-name",className:"input input--mono",value:i,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"context7",onChange:H=>r(H.target.value)}),c.jsx("label",{className:"field",children:"Транспорт"}),c.jsx(qs,{title:"Транспорт",value:o,options:[{value:"stdio",label:"stdio",hint:"локальный процесс"},{value:"http",label:"http",hint:"удалённый сервер"},{value:"sse",label:"sse",hint:"удалённый, поток событий"}],onChange:H=>d(H)}),_?c.jsxs(c.Fragment,{children:[c.jsx("label",{className:"field",htmlFor:"mcp-command",children:"Команда с аргументами"}),c.jsx("input",{id:"mcp-command",className:"input input--mono",value:h,spellCheck:!1,autoComplete:"off",placeholder:"npx -y @upstash/context7-mcp",onChange:H=>g(H.target.value)})]}):c.jsxs(c.Fragment,{children:[c.jsx("label",{className:"field",htmlFor:"mcp-url",children:"URL"}),c.jsx("input",{id:"mcp-url",className:"input input--mono",value:m,spellCheck:!1,autoComplete:"off",placeholder:"https://mcp.example.dev/mcp",onChange:H=>b(H.target.value)})]}),c.jsxs("label",{className:"field",htmlFor:"mcp-pairs",children:[_?"Переменные окружения":"Заголовки"," — по одной на строку, необязательно"]}),c.jsx("textarea",{id:"mcp-pairs",className:"input input--mono input--area",value:x,spellCheck:!1,placeholder:_?"API_KEY=xxx":"Authorization: Bearer xxx",onChange:H=>k(H.target.value)}),c.jsxs("div",{className:"extbar",children:[c.jsx("button",{className:"btn",onClick:l,children:"Отмена"}),c.jsx("button",{className:"btn btn--primary",disabled:!C,onClick:N,children:"Подключить"})]})]})}function ab(s){const l={};for(const i of s.split(`
122
- `)){const r=i.trim();if(!r)continue;const o=r.indexOf("="),d=r.indexOf(":"),h=o===-1?d:d===-1?o:Math.min(o,d);h<=0||(l[r.slice(0,h).trim()]=r.slice(h+1).trim())}return l}function gk(s){return(s.trim().match(/"[^"]*"|'[^']*'|\S+/g)??[]).map(l=>l.replace(/^["']|["']$/g,""))}function yk({plugins:s,marketplaces:l,actions:i}){const[r,o]=S.useState("");return c.jsxs(c.Fragment,{children:[s.length===0&&c.jsx("p",{className:"modal__text",children:"Ни одного установленного плагина. Что можно поставить — на вкладке «Каталог»."}),c.jsx("ul",{className:"extlist",children:s.map(d=>c.jsxs("li",{className:"extlist__row",children:[c.jsxs("div",{className:"extlist__head",children:[c.jsx("span",{className:"extlist__name",children:d.name}),c.jsx("span",{className:d.enabled?"chip chip--ok":"chip chip--mute",children:d.enabled?"включён":"выключен"}),d.version&&d.version!=="unknown"&&c.jsx("span",{className:"chip",children:d.version}),d.scope&&c.jsx("span",{className:"chip",children:d.scope})]}),d.marketplace&&c.jsx("div",{className:"extlist__meta",children:d.marketplace}),d.mcpServers.length>0&&c.jsxs("div",{className:"extlist__meta",children:["MCP-серверы: ",d.mcpServers.join(", ")]}),c.jsxs("div",{className:"extlist__actions",children:[c.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>i.pluginToggle(d.id,!d.enabled),children:d.enabled?"Выключить":"Включить"}),c.jsx("button",{className:"btn btn--ghost btn--sm btn--danger",onClick:()=>i.pluginUninstall(d.id),children:"Удалить"})]})]},d.id))}),c.jsx("div",{className:"sidebar__section",children:"Маркетплейсы"}),c.jsx("ul",{className:"extlist",children:l.map(d=>c.jsxs("li",{className:"extlist__row",children:[c.jsx("div",{className:"extlist__head",children:c.jsx("span",{className:"extlist__name",children:d.name})}),d.source&&c.jsx("div",{className:"extlist__meta",children:d.source}),c.jsx("div",{className:"extlist__actions",children:c.jsx("button",{className:"btn btn--ghost btn--sm btn--danger",onClick:()=>i.marketplaceRemove(d.name),children:"Отключить"})})]},d.name))}),c.jsxs("div",{className:"extform__row",children:[c.jsx("input",{className:"input input--mono",value:r,spellCheck:!1,autoComplete:"off","aria-label":"Источник маркетплейса",placeholder:"owner/repo, URL или путь",onChange:d=>o(d.target.value),onKeyDown:d=>{d.key!=="Enter"||r.trim()===""||(d.preventDefault(),i.marketplaceAdd(r.trim()),o(""))}}),c.jsx("button",{className:"btn",disabled:r.trim()==="",onClick:()=>{i.marketplaceAdd(r.trim()),o("")},children:"Добавить"})]})]})}const Ec=30;function bk({catalog:s,hasMarketplaces:l,actions:i,onMarketplaces:r}){const[o,d]=S.useState(""),[h,g]=S.useState(""),[m,b]=S.useState(Ec),[x,k]=S.useState(""),_=S.useMemo(()=>[...new Set(s.map(H=>H.category).filter(Boolean))].sort(),[s]),C=S.useMemo(()=>{const N=o.trim().toLowerCase();return s.filter(H=>h&&H.category!==h?!1:N?`${H.name} ${H.displayName} ${H.description} ${H.author}`.toLowerCase().includes(N):!0)},[s,o,h]);return s.length===0?c.jsxs("p",{className:"modal__text",children:[l?"Маркетплейсы подключены, но их каталог ещё не выкачан. Попробуйте открыть окно ещё раз через минуту.":"Ни одного маркетплейса — ставить нечего."," ",c.jsx("button",{className:"linkish",onClick:r,children:"Подключить маркетплейс"})]}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"catalog__filters",children:[c.jsx("input",{className:"input",value:o,spellCheck:!1,autoComplete:"off","aria-label":"Поиск по каталогу",placeholder:"Поиск: имя, описание, автор",onChange:N=>{d(N.target.value),b(Ec)}}),c.jsx(qs,{title:"Категория",value:h,options:[{value:"",label:"все категории"},..._.map(N=>({value:N,label:N}))],onChange:N=>{g(N),b(Ec)}})]}),C.length===0?c.jsx("p",{className:"modal__text",children:"Ничего не нашлось."}):c.jsx("ul",{className:"extlist",children:C.slice(0,m).map(N=>c.jsxs("li",{className:"extlist__row",children:[c.jsxs("div",{className:"extlist__head",children:[c.jsx("span",{className:"extlist__name",children:N.name}),N.installed&&c.jsx("span",{className:"chip chip--ok",children:"установлен"}),N.version&&c.jsx("span",{className:"chip",children:N.version}),N.category&&c.jsx("span",{className:"chip",children:N.category})]}),N.description&&c.jsx("div",{className:"catalog__desc",children:N.description}),c.jsxs("div",{className:"extlist__meta",children:[N.author&&`${N.author} · `,N.marketplace]}),c.jsxs("div",{className:"extlist__actions",children:[c.jsx("button",{className:"btn btn--ghost btn--sm",disabled:N.installed,onClick:()=>i.pluginInstall(N.id),children:N.installed?"Уже стоит":"Установить"}),N.homepage&&c.jsx("a",{className:"btn btn--ghost btn--sm",href:N.homepage,target:"_blank",rel:"noreferrer",children:"Страница"})]})]},N.id))}),C.length>m&&c.jsx("div",{className:"extbar",children:c.jsxs("button",{className:"btn",onClick:()=>b(N=>N+Ec),children:["Ещё ",Math.min(Ec,C.length-m)," из ",C.length-m]})}),c.jsxs("div",{className:"extform",children:[c.jsx("label",{className:"field",htmlFor:"plugin-spec",children:"Или установить по имени — если нужного в каталоге нет"}),c.jsxs("div",{className:"extform__row",children:[c.jsx("input",{id:"plugin-spec",className:"input input--mono",value:x,spellCheck:!1,autoComplete:"off",placeholder:"имя или имя@маркетплейс",onChange:N=>k(N.target.value),onKeyDown:N=>{N.key!=="Enter"||x.trim()===""||(N.preventDefault(),i.pluginInstall(x.trim()),k(""))}}),c.jsx("button",{className:"btn",disabled:x.trim()==="",onClick:()=>{i.pluginInstall(x.trim()),k("")},children:"Установить"})]})]})]})}function xk({status:s,login:l,actions:i,runningSessions:r,onReconnect:o,reconnectBlocked:d,reconnectHint:h,onClose:g}){const[m,b]=S.useState(""),[x,k]=S.useState(!1),[_,C]=S.useState(!1),N=o!==null&&(s==null?void 0:s.loggedIn)===!0&&!_&&!x,H=S.useMemo(()=>{if(l.error)return{ok:!1,message:l.error};const O=l.output.trim();return O===""?null:{ok:!0,message:O}},[l.error,l.output]);function B(){m.trim()!==""&&(i.submitCode(m.trim()),b(""))}function K(){if(r>0){k(!1),C(!0);return}i.login("claudeai",!0)}return c.jsxs(Pl,{title:"Аккаунт",onClose:g,children:[s===null?c.jsx("p",{className:"modal__text",children:"Спрашиваем у хоста…"}):s.loggedIn?c.jsxs("div",{className:"account",children:[c.jsx("div",{className:"account__id",children:s.email||"Вход выполнен"}),c.jsxs("div",{className:"account__chips",children:[c.jsx("span",{className:"chip chip--ok",children:Sk[s.method]??s.method}),s.plan&&c.jsx("span",{className:"chip",children:s.plan})]}),s.organization&&c.jsx("div",{className:"extlist__meta",children:s.organization})]}):c.jsxs("p",{className:"modal__text",children:["Вход не выполнен. Сессии не запустятся, пока аккаунт не подключён — или пока в окружении хоста нет ",c.jsx("code",{children:"ANTHROPIC_API_KEY"}),"."]}),l.active?c.jsx(kk,{login:l,code:m,onCode:b,onSubmit:B,onCancel:i.cancel}):c.jsxs(c.Fragment,{children:[c.jsx(Uc,{result:H}),_&&c.jsx("p",{className:"account__warn",role:"alert",children:_k(r)}),N&&d&&c.jsx("p",{className:"account__note",children:h}),N&&c.jsx("div",{className:"extbar extbar--start",children:c.jsxs("button",{type:"button",className:"btn account__relink",title:`Переподключить сессию
123
- ${h}`,disabled:d,onClick:o,children:[c.jsx(vk,{}),"Переподключить сессию"]})}),c.jsx("div",{className:"extbar",children:s!=null&&s.loggedIn?c.jsxs(c.Fragment,{children:[_?c.jsxs(c.Fragment,{children:[c.jsx("button",{className:"btn",onClick:()=>C(!1),children:"Отмена"}),c.jsx("button",{className:"btn btn--warn",autoFocus:!0,onClick:()=>{C(!1),i.login("claudeai",!0)},children:"Всё равно сменить"})]}):c.jsx("button",{className:"btn",onClick:K,children:"Сменить аккаунт"}),x?c.jsx("button",{className:"btn btn--danger",autoFocus:!0,onClick:()=>{k(!1),i.logout()},children:"Точно выйти?"}):c.jsx("button",{className:"btn",onClick:()=>{C(!1),k(!0)},children:"Выйти"})]}):c.jsxs(c.Fragment,{children:[c.jsx("button",{className:"btn",onClick:()=>i.login("console",!1),children:"Через Console"}),c.jsx("button",{className:"btn btn--primary",onClick:()=>i.login("claudeai",!1),children:"Войти"})]})})]})]})}function _k(s){const l=s%10,i=s%100,r=l===1&&i!==11,o=r?"сессия":l>=2&&l<=4&&(i<12||i>14)?"сессии":"сессий";return`${s} ${o} сейчас ${r?"работает":"работают"} — смена аккаунта может ${r?"её":"их"} прервать.`}function vk(){return c.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("path",{d:"M14 8a6 6 0 1 1-6-6c1.68 0 3.29.67 4.49 1.83L14 5.33"}),c.jsx("path",{d:"M14 2v3.33h-3.33"})]})}const Sk={"claude.ai":"подписка Claude",console:"Anthropic Console",apiKey:"API-ключ",none:"нет"};function kk({login:s,code:l,onCode:i,onSubmit:r,onCancel:o}){return c.jsxs("div",{className:"account__flow",children:[s.url?c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"field",children:"Откройте ссылку и подтвердите вход"}),c.jsx("a",{className:"account__link",href:s.url,target:"_blank",rel:"noreferrer",children:s.url})]}):c.jsx("p",{className:"modal__text",children:"Запускаем вход…"}),s.awaitingCode&&c.jsxs(c.Fragment,{children:[c.jsx("label",{className:"field",htmlFor:"auth-code",children:"Код со страницы авторизации"}),c.jsxs("div",{className:"extform__row",children:[c.jsx("input",{id:"auth-code",className:"input input--mono",value:l,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"вставьте код",onChange:d=>i(d.target.value),onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),r())}}),c.jsx("button",{className:"btn btn--primary",disabled:l.trim()==="",onClick:r,children:"Готово"})]})]}),s.output.trim()!==""&&c.jsx("pre",{className:"account__log",children:s.output.trim()}),c.jsx("div",{className:"extbar",children:c.jsx("button",{className:"btn",onClick:o,children:"Отменить вход"})})]})}function wk({state:s,onPair:l,onUnpair:i,onClose:r}){const[o,d]=S.useState(""),[h,g]=S.useState(""),[m,b]=S.useState(!1),x=S.useRef(null),k=(s==null?void 0:s.paired)===!0;S.useEffect(()=>{var C;k||(C=x.current)==null||C.focus()},[k]),S.useEffect(()=>{b(!1),k&&d("")},[k,s==null?void 0:s.error]);const _=(s==null?void 0:s.url)??"https://claudevisual.com";return c.jsx(Pl,{title:"Удалённый доступ",onClose:r,children:k?c.jsxs("div",{className:"relay",children:[c.jsxs("p",{className:"relay__lede",children:["Компьютер связан с аккаунтом на ",c.jsx("b",{children:sb(_)}),". Открывайте его оттуда с любого устройства — с телефона в том числе."]}),c.jsxs("dl",{className:"relay__facts",children:[c.jsxs("div",{children:[c.jsx("dt",{children:"Имя"}),c.jsx("dd",{children:(s==null?void 0:s.name)??"—"})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"Связь"}),c.jsxs("dd",{children:[c.jsx("span",{className:s!=null&&s.connected?"dot dot--on":"dot"})," ",s!=null&&s.connected?"на связи":"нет связи, пробуем переподключиться"]})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"Подключено"}),c.jsxs("dd",{children:[(s==null?void 0:s.clients)??0," вкладок"]})]})]}),(s==null?void 0:s.error)&&c.jsx("p",{className:"relay__error",children:s.error}),c.jsx("p",{className:"relay__note",children:"Терминал с удалённых устройств настраивается в настройках приложения, раздел «Терминал»."}),c.jsx("p",{className:"relay__note",children:"Отвязка гасит токен этой машины: чтобы вернуть доступ, понадобится новый код. Сессии Claude Code это не трогает."}),c.jsx("button",{className:"btn btn--danger",onClick:i,children:"Отвязать компьютер"})]}):c.jsxs("div",{className:"relay",children:[c.jsx("p",{className:"relay__lede",children:"Чтобы работать с этим компьютером из браузера и с телефона, свяжите его с аккаунтом."}),c.jsxs("ol",{className:"relay__steps",children:[c.jsxs("li",{children:["Откройте ",c.jsx("b",{children:sb(_)})," и войдите (или зарегистрируйтесь)."]}),c.jsxs("li",{children:["Нажмите ",c.jsx("b",{children:"«Подключить ПК»"})," — появится код из восьми знаков."]}),c.jsx("li",{children:"Введите его сюда."})]}),c.jsxs("form",{className:"relay__form",onSubmit:C=>{C.preventDefault(),o.trim()&&(b(!0),l(o.trim(),h.trim()))},children:[c.jsxs("label",{className:"field",children:[c.jsx("span",{children:"Код сопряжения"}),c.jsx("input",{ref:x,className:"input relay__code",value:o,onChange:C=>d(C.target.value.toUpperCase()),placeholder:"XXXX-XXXX",autoComplete:"off",spellCheck:!1,maxLength:12})]}),c.jsxs("label",{className:"field",children:[c.jsx("span",{children:"Как назвать этот компьютер"}),c.jsx("input",{className:"input",value:h,onChange:C=>g(C.target.value),placeholder:"имя машины",autoComplete:"off",maxLength:64})]}),(s==null?void 0:s.error)&&c.jsx("p",{className:"relay__error",children:s.error}),c.jsx("button",{className:"btn btn--primary",type:"submit",disabled:!o.trim()||m,children:m?"Связываем…":"Связать"})]})]})})}function sb(s){try{return new URL(s).host}catch{return s}}const uh="",jk=[{value:"opus",label:"Opus",hint:"полный список моделей виден, когда открыта сессия"},{value:"sonnet",label:"Sonnet",hint:"полный список моделей виден, когда открыта сессия"},{value:"haiku",label:"Haiku",hint:"полный список моделей виден, когда открыта сессия"}],Nk=xb.map(s=>({value:s.value,label:s.value,hint:s.hint})),mo=3600*1e3,Tk=[{value:"6h",label:"6 часов"},{value:"24h",label:"Сутки"},{value:"48h",label:"Двое суток"},{value:"168h",label:"Неделя"},{value:"never",label:"Никогда"}],hr={"6h":6*mo,"24h":24*mo,"48h":48*mo,"168h":168*mo,never:0};function Ek(s){return hr[s]??hr["48h"]}function Ak(s){const l=Object.entries(hr).find(([,i])=>i===s);return l?l[0]:Object.keys(hr).reduce((i,r)=>Math.abs(hr[r]-s)<Math.abs(hr[i]-s)?r:i)}const Ck=[{value:"off",label:"Выключено"},{value:"500",label:"0.5 с"},{value:"1500",label:"1.5 с"},{value:"3000",label:"3 с"},{value:"10000",label:"10 с"}],pr={off:0,500:500,1500:1500,3e3:3e3,1e4:1e4};function Rk(s){return pr[s]??pr.off}function Mk(s){const l=Object.entries(pr).find(([,i])=>i===s);return l?l[0]:Object.keys(pr).reduce((i,r)=>Math.abs(pr[r]-s)<Math.abs(pr[i]-s)?r:i)}const Ok=[{value:"project",title:"Только текущий проект",description:"Агент молча пишет файлы в открытом проекте и в ~/.claude — настройках самого Claude Code. Чужой проект и любая новая папка — только с явного разрешения."},{value:"projects",title:"Папка с проектами",description:"То же плюс каталог, где лежат открытые проекты, — то есть и соседний проект тоже. Всё остальное — с разрешения."},{value:"all",title:"Все папки на компьютере",description:"Агент пишет файлы куда угодно на диске — вопросов про место записи не будет.",risky:!0}];function Dk({settings:s,models:l,relayState:i,local:r,onChange:o,onEnableShell:d,onDisableShell:h,onOpenRelay:g,onClose:m}){const b=s===null,x=!b&&s.terminalEnabled===!0,k=!x,_=S.useMemo(()=>{const N=[{value:uh,label:"Как в Claude Code",hint:"модель определят настройки самого Claude Code"},...l.length>0?l.map(H=>({value:H.value,label:H.displayName,hint:H.description})):jk];return s&&s.startModel!==null&&!N.some(H=>H.value===s.startModel)&&N.push({value:s.startModel,label:s.startModel}),N},[l,s]);function C(){var N,H;return(i==null?void 0:i.paired)!==!0?c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"settings__hint",children:"Компьютер не связан с аккаунтом — включать удалённый доступ пока не к чему: без пары ни телефон, ни другое устройство этот компьютер вообще не видят."}),c.jsx("button",{type:"button",className:"btn",disabled:k,onClick:g,children:"Связать компьютер"})]}):(N=i.shell)!=null&&N.enabled?c.jsxs(c.Fragment,{children:[c.jsxs("p",{className:"settings__hint",children:["Разрешён: с телефона и любого другого устройства этого аккаунта можно открыть терминал и выполнить на этом компьютере что угодно — как если бы сидели за ним.",i.shell.confirmedAt&&` Включено ${new Date(i.shell.confirmedAt).toLocaleString()}.`]}),c.jsx("button",{type:"button",className:"btn btn--danger",disabled:k,onClick:h,children:"Запретить"})]}):(H=i.shell)!=null&&H.pending?c.jsxs(c.Fragment,{children:[c.jsxs("p",{className:"settings__hint",children:["Письмо ушло на ",c.jsx("b",{children:i.shell.email}),". Перейдите по ссылке из него — терминал заработает удалённо."]}),c.jsx("p",{className:"settings__hint",children:"Повторная отправка ограничена раз в минуту — если жали кнопку только что, письмо не придёт и от повторного нажатия тоже. Если сейчас доберётесь до самого компьютера, там разрешение включится сразу, без письма."}),c.jsx("button",{type:"button",className:"btn",disabled:k,onClick:d,children:"Отправить письмо ещё раз"})]}):c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"settings__hint",children:"Сейчас с телефона можно смотреть разговоры и файлы, но не запускать команды. Разрешение даёт полный доступ к терминалу этого компьютера: с телефона станет можно выполнить любую команду, как в обычной консоли за этой машиной."}),r?c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"settings__hint",children:"Включится сразу — вы уже за этим компьютером, подтверждать доступ к нему нечем и незачем."}),c.jsx("button",{type:"button",className:"btn",disabled:k,onClick:d,children:"Разрешить с телефона"})]}):c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"settings__hint",children:"Отсюда мгновенно не включится: на почту аккаунта уйдёт письмо, и терминал заработает только после перехода по ссылке из него."}),c.jsx("button",{type:"button",className:"btn",disabled:k,onClick:d,children:"Прислать письмо"})]})]})}return c.jsx(Pl,{title:"Настройки",onClose:m,children:c.jsxs("div",{className:"settings",children:[c.jsxs("section",{className:"settings__section",children:[c.jsx("h3",{className:"settings__heading",children:"Архивация молчащих сессий"}),c.jsx("p",{className:"settings__hint",children:"Сессия, к которой долго не возвращались, сама уезжает в архив — на диске ничего не удаляется, транскрипт остаётся, и её можно вернуть обратно в любой момент."}),b?c.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):c.jsx(qs,{className:"settings__select",value:Ak(s.autoArchiveAfterMs),options:Tk,onChange:N=>o({autoArchiveAfterMs:Ek(N)}),ariaLabel:"Через сколько молчащая сессия уезжает в архив"})]}),c.jsxs("section",{className:"settings__section",children:[c.jsx("h3",{className:"settings__heading",children:"Автосохранение"}),c.jsx("p",{className:"settings__hint",children:"Открытый файл сам уезжает на диск, если немного постоять без ввода — ручное сохранение, кнопкой или Ctrl+S, при этом всегда работает как обычно, независимо от этой настройки."}),b?c.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):c.jsx(qs,{className:"settings__select",value:Mk(s.autoSaveAfterPauseMs),options:Ck,onChange:N=>o({autoSaveAfterPauseMs:Rk(N)}),ariaLabel:"Пауза перед автосохранением открытого файла"})]}),c.jsxs("section",{className:"settings__section",children:[c.jsx("h3",{className:"settings__heading",children:"Старт новой сессии"}),c.jsx("p",{className:"settings__hint",children:"Модель и режим прав, с которыми поднимается новая сессия. Уже открытую это не меняет — у неё свои переключатели в шапке."}),c.jsxs("div",{className:"settings__field",children:[c.jsx("span",{className:"settings__field-label",children:"Модель"}),b?c.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):c.jsx(qs,{className:"settings__select",value:s.startModel??uh,options:_,onChange:N=>o({startModel:N===uh?null:N}),ariaLabel:"Модель, с которой поднимается новая сессия"})]}),c.jsxs("div",{className:"settings__field",children:[c.jsx("span",{className:"settings__field-label",children:"Режим прав при старте"}),b?c.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):c.jsx(qs,{className:"settings__select",value:s.startPermissionMode,options:Nk,onChange:N=>o({startPermissionMode:N}),ariaLabel:"Режим прав, с которым поднимается новая сессия"})]})]}),c.jsxs("section",{className:"settings__section",children:[c.jsx("h3",{className:"settings__heading",children:"Доступ к папкам"}),c.jsx("p",{className:"settings__hint",children:"Это про то, где агент пишет файлы (Write, Edit, NotebookEdit), не спрашивая разрешения, — не про чтение: читает он в любом случае. Ничего не запрещается наглухо — выход за выбранную границу просто превращается в обычный запрос прав, который остаётся подтвердить или отклонить."}),c.jsx("div",{className:"access",role:"radiogroup","aria-label":"Доступ к папкам",children:Ok.map(N=>{const H=!b&&s.folderAccess===N.value;return c.jsxs("button",{type:"button",role:"radio","aria-checked":H,disabled:b,className:"access__card"+(H?" is-on":"")+(N.risky?" access__card--risky":""),onClick:()=>o({folderAccess:N.value}),children:[c.jsx("span",{className:"access__radio","aria-hidden":"true"}),c.jsxs("span",{className:"access__body",children:[c.jsxs("span",{className:"access__title",children:[N.title,N.risky&&c.jsx("span",{className:"access__risk",children:"самое широкое"})]}),c.jsx("span",{className:"access__desc",children:N.description})]})]},N.value)})})]}),c.jsxs("section",{className:"settings__section",children:[c.jsxs("div",{className:"settings__switch-row",children:[c.jsxs("div",{className:"settings__switch-copy",children:[c.jsx("h3",{className:"settings__heading",children:"Терминал"}),c.jsx("p",{className:"settings__hint",children:"Панель терминала под лентой разговора: команда, которую там набрали, выполняется прямо на этом компьютере с правами вашего пользователя — не в песочнице агента, как Bash-инструмент в разговоре. Выключите — и все открытые вкладки терминала закроются, а процессы в них не переживут закрытия."})]}),b?c.jsx("div",{className:"settings__switch-skeleton","aria-hidden":"true"}):c.jsx("button",{type:"button",role:"switch","aria-checked":x,"aria-label":"Терминал",className:x?"switch is-on":"switch",onClick:()=>o({terminalEnabled:!x}),children:c.jsx("span",{className:"switch__knob"})})]}),c.jsxs("div",{className:"settings__nested"+(k?" is-disabled":""),children:[c.jsx("h4",{className:"settings__nested-heading",children:"Удалённый доступ к терминалу"}),b?c.jsx("p",{className:"settings__hint",children:"Загрузка…"}):c.jsxs(c.Fragment,{children:[k&&c.jsx("p",{className:"settings__hint",children:"Сначала включите терминал выше — удалённый доступ выдаётся к тому, что на этой машине уже разрешено, а не поверх выключенного рубильника."}),C()]})]})]})]})})}const zk=16;function Lk({pane:s,width:l,onResize:i,onReset:r}){const o=Si[s],d=S.useRef(null);function h(x){if(x.button!==0)return;const k=document.querySelector(".main"),_=k?Math.max(0,k.getBoundingClientRect().width-J0):0;d.current={x:x.clientX,width:l,max:Math.min(o.max,l+_)},x.currentTarget.setPointerCapture(x.pointerId),document.body.classList.add("is-resizing"),x.preventDefault()}function g(x){const k=d.current;if(!k)return;const _=o.side==="left"?x.clientX-k.x:k.x-x.clientX;i(Math.min(k.max,k.width+_))}function m(x){d.current&&(d.current=null,x.currentTarget.hasPointerCapture(x.pointerId)&&x.currentTarget.releasePointerCapture(x.pointerId),document.body.classList.remove("is-resizing"))}function b(x){const k=x.key==="ArrowRight"?1:x.key==="ArrowLeft"?-1:0;k!==0&&(x.preventDefault(),i(l+k*zk*(o.side==="left"?1:-1)))}return c.jsx("div",{className:`pane-resizer pane-resizer--${s} pane-resizer--${o.side}`,role:"separator","aria-orientation":"vertical","aria-label":`Ширина панели ${o.label}`,"aria-valuenow":l,"aria-valuemin":o.min,"aria-valuemax":o.max,tabIndex:0,title:"Потяните, чтобы изменить ширину; двойной щелчок — ширина по умолчанию",onPointerDown:h,onPointerMove:g,onPointerUp:m,onPointerCancel:m,onDoubleClick:r,onKeyDown:b,children:c.jsx("span",{className:"pane-resizer__line","aria-hidden":"true"})})}const Uk=16;function Hk({height:s,onResize:l,onReset:i}){const r=S.useRef(null);function o(){const b=document.querySelector(".main .transcript, .main .editor");if(!b)return 1/0;const x=b.getBoundingClientRect().height-e_;return Math.round(s+Math.max(0,x))}function d(b){b.button===0&&(r.current={y:b.clientY,height:s,max:o()},b.currentTarget.setPointerCapture(b.pointerId),document.body.classList.add("is-resizing-row"),b.preventDefault())}function h(b){const x=r.current;if(!x)return;const k=x.y-b.clientY;l(x.height+k,x.max)}function g(b){r.current&&(r.current=null,b.currentTarget.hasPointerCapture(b.pointerId)&&b.currentTarget.releasePointerCapture(b.pointerId),document.body.classList.remove("is-resizing-row"))}function m(b){const x=b.key==="ArrowUp"?1:b.key==="ArrowDown"?-1:0;x!==0&&(b.preventDefault(),l(s+x*Uk,o()))}return c.jsx("div",{className:"term-resizer",role:"separator","aria-orientation":"horizontal","aria-label":"Высота панели терминала","aria-valuenow":s,"aria-valuemin":Sb,tabIndex:0,title:"Потяните, чтобы изменить высоту; двойной щелчок — высота по умолчанию",onPointerDown:d,onPointerMove:h,onPointerUp:g,onPointerCancel:g,onDoubleClick:i,onKeyDown:m,children:c.jsx("span",{className:"term-resizer__line","aria-hidden":"true"})})}function ib(){const s=document.documentElement,l=getComputedStyle(s),i=O=>l.getPropertyValue(O).trim(),r=i("--surface"),o=i("--text"),d=i("--text-2"),h=i("--muted"),g=i("--accent"),m=i("--accent-fg"),b=i("--select"),x=i("--danger"),k=i("--ok"),_=i("--warn"),C=i("--cm-fn"),N=i("--cm-key"),H=i("--cm-type"),B=rb(o,r,55),K=O=>rb(O,"#ffffff",25);return{background:r,foreground:o,cursor:g,cursorAccent:m,selectionBackground:b,black:B,brightBlack:h,red:x,brightRed:K(x),green:k,brightGreen:K(k),yellow:_,brightYellow:K(_),blue:C,brightBlue:K(C),magenta:N,brightMagenta:K(N),cyan:H,brightCyan:K(H),white:d,brightWhite:o}}function Bk(){return getComputedStyle(document.documentElement).getPropertyValue("--mono").trim()}let ga=null;function qk(s){return ga||(ga=document.createElement("span"),ga.style.position="fixed",ga.style.width="0",ga.style.height="0",ga.style.opacity="0",ga.style.pointerEvents="none",document.body.appendChild(ga)),ga.style.color=s,getComputedStyle(ga).color}function rb(s,l,i){return qk(`color-mix(in srgb, ${s} ${100-i}%, ${l} ${i}%)`)}let go=null;function Gk(){return go||(go=Promise.all([Xe(()=>import("./xterm-D6Mng-DB.js").then(s=>s.x),__vite__mapDeps([22,23]),import.meta.url),Xe(()=>import("./addon-fit-CevVMrUA.js").then(s=>s.a),__vite__mapDeps([24,23]),import.meta.url),Xe(()=>import("./addon-web-links-CnB65OV_.js").then(s=>s.a),__vite__mapDeps([25,23]),import.meta.url),Xe(()=>Promise.resolve({}),__vite__mapDeps([26]),import.meta.url)]).then(([s,l,i])=>({Terminal:s.Terminal,FitAddon:l.FitAddon,WebLinksAddon:i.WebLinksAddon})).catch(s=>{throw go=null,s})),go}function Yk({terminals:s,activeId:l,blocked:i,height:r,offset:o,mobile:d=!1,zoomed:h,onToggleZoom:g,onSelect:m,onOpen:b,onClose:x,onInput:k,onResize:_,onAttach:C,onHide:N,registerSink:H}){const[B,K]=S.useState(()=>ib());return S.useEffect(()=>{const O=new MutationObserver(()=>K(ib()));return O.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>O.disconnect()},[]),c.jsxs("div",{className:"termpanel"+(d?" termpanel--mobile":"")+(!d&&h?" termpanel--zoomed":""),style:d?{height:r,top:(o==null?void 0:o.top)??0,left:(o==null?void 0:o.left)??0}:h?void 0:{height:r},children:[c.jsxs("div",{className:"termpanel__tabbar",onDoubleClick:O=>{g&&(O.target.closest("button")||g())},children:[c.jsx("div",{className:"termpanel__tabs",role:"tablist","aria-label":"Открытые терминалы",children:s.map(O=>c.jsxs("div",{role:"tab","aria-selected":O.id===l,className:"termtab"+(O.id===l?" is-on":"")+(O.exitCode!==null?" termtab--exited":""),onDoubleClick:$=>{g&&($.target.closest(".termtab__close")||g())},children:[c.jsx("button",{className:"termtab__name",title:O.cwd,onClick:()=>m(O.id),children:O.title}),O.exitCode!==null&&c.jsx("span",{className:"termtab__code",title:`Оболочка завершилась с кодом ${O.exitCode}`,children:O.exitCode}),c.jsx("button",{className:"termtab__close",title:"Закрыть терминал","aria-label":`Закрыть терминал «${O.title}»`,onClick:()=>x(O.id),children:"✕"})]},O.id))}),c.jsx("button",{className:"termpanel__add",title:"Новый терминал","aria-label":"Новый терминал",disabled:i,onClick:b,children:"+"}),c.jsx("div",{className:"termpanel__spacer"}),g&&c.jsx("button",{className:"termpanel__zoom",title:h?"Свернуть терминал — то же самое, что двойной клик по вкладке":"Развернуть терминал на весь экран — то же самое, что двойной клик по вкладке","aria-label":h?"Свернуть терминал":"Развернуть терминал на весь экран","aria-pressed":h,onClick:g,children:c.jsx(Tr,{active:h})}),c.jsx("button",{className:"termpanel__hide",title:"Скрыть панель","aria-label":"Скрыть панель терминала",onClick:N,children:"✕"})]}),c.jsxs("div",{className:"termpanel__body",children:[i?c.jsxs("div",{className:"termpanel__empty",children:[c.jsx("p",{children:"Терминал с удалённых устройств выключен"}),c.jsx("p",{className:"termpanel__hint",children:"Откройте «Удалённый доступ» → «Прислать письмо»: на почту аккаунта придёт ссылка, и после перехода по ней терминал заработает прямо здесь. Если сейчас доберётесь до самого компьютера — там разрешение включается сразу, без письма."})]}):s.length===0&&c.jsxs("div",{className:"termpanel__empty",children:[c.jsx("p",{children:"Терминалов не открыто"}),c.jsx("button",{className:"btn btn--primary",onClick:b,children:"Открыть терминал"})]}),s.map(O=>c.jsx(Ik,{id:O.id,exitCode:O.exitCode,active:O.id===l,theme:B,mobile:d,onInput:k,onResize:_,onAttach:C,registerSink:H},O.id))]})]})}function Ik({id:s,exitCode:l,active:i,theme:r,mobile:o,onInput:d,onResize:h,onAttach:g,registerSink:m}){const b=S.useRef(null),x=S.useRef(null),k=S.useRef(!1),_=S.useRef(o);_.current=o;const C=S.useRef(r),N=S.useRef(l),[H,B]=S.useState("loading"),[K,O]=S.useState(!1);return S.useEffect(()=>{if(!b.current)return;let A=!1,Q=null;B("loading"),O(!1);const L=window.setTimeout(()=>{A||O(!0)},200);return(async()=>{let M;try{M=await Gk()}catch{window.clearTimeout(L),A||B("error");return}if(A||!b.current)return;window.clearTimeout(L);const{Terminal:W,FitAddon:re,WebLinksAddon:he}=M,F=new W({fontFamily:Bk()||"monospace",fontSize:13,lineHeight:1.2,cursorBlink:!0,cursorStyle:"bar",scrollback:5e3,theme:C.current}),ae=new re;F.loadAddon(ae),F.loadAddon(new he),F.open(b.current),x.current=F,F.attachCustomKeyEventHandler(xe=>{if(xe.type!=="keydown"||!(xe.ctrlKey||xe.metaKey))return!0;if(xe.key==="`")return!1;if(xe.key==="c"||xe.key==="C"){const j=F.getSelection();return j?(navigator.clipboard.writeText(j),!1):!xe.shiftKey}return xe.shiftKey&&(xe.key==="v"||xe.key==="V")?(navigator.clipboard.readText().then(j=>{j&&F.paste(j)}),!1):!0});const me=F.onData(xe=>d(s,xe));let Ne={cols:F.cols,rows:F.rows},pe=null;const z=F.onResize(({cols:xe,rows:we})=>{pe!==null&&window.clearTimeout(pe),pe=window.setTimeout(()=>{pe=null,!(xe===Ne.cols&&we===Ne.rows)&&(Ne={cols:xe,rows:we},h(s,xe,we))},100)}),P=new ResizeObserver(()=>{try{ae.fit()}catch{return}_.current&&F.scrollToBottom()});P.observe(b.current);const te=m(s,xe=>{xe.kind==="buffer"&&F.reset(),F.write(xe.data)});g(s),N.current!==null&&!k.current&&(k.current=!0,F.write(`\r
122
+ `)){const r=i.trim();if(!r)continue;const o=r.indexOf("="),d=r.indexOf(":"),h=o===-1?d:d===-1?o:Math.min(o,d);h<=0||(l[r.slice(0,h).trim()]=r.slice(h+1).trim())}return l}function gk(s){return(s.trim().match(/"[^"]*"|'[^']*'|\S+/g)??[]).map(l=>l.replace(/^["']|["']$/g,""))}function yk({plugins:s,marketplaces:l,actions:i}){const[r,o]=S.useState("");return c.jsxs(c.Fragment,{children:[s.length===0&&c.jsx("p",{className:"modal__text",children:"Ни одного установленного плагина. Что можно поставить — на вкладке «Каталог»."}),c.jsx("ul",{className:"extlist",children:s.map(d=>c.jsxs("li",{className:"extlist__row",children:[c.jsxs("div",{className:"extlist__head",children:[c.jsx("span",{className:"extlist__name",children:d.name}),c.jsx("span",{className:d.enabled?"chip chip--ok":"chip chip--mute",children:d.enabled?"включён":"выключен"}),d.version&&d.version!=="unknown"&&c.jsx("span",{className:"chip",children:d.version}),d.scope&&c.jsx("span",{className:"chip",children:d.scope})]}),d.marketplace&&c.jsx("div",{className:"extlist__meta",children:d.marketplace}),d.mcpServers.length>0&&c.jsxs("div",{className:"extlist__meta",children:["MCP-серверы: ",d.mcpServers.join(", ")]}),c.jsxs("div",{className:"extlist__actions",children:[c.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>i.pluginToggle(d.id,!d.enabled),children:d.enabled?"Выключить":"Включить"}),c.jsx("button",{className:"btn btn--ghost btn--sm btn--danger",onClick:()=>i.pluginUninstall(d.id),children:"Удалить"})]})]},d.id))}),c.jsx("div",{className:"sidebar__section",children:"Маркетплейсы"}),c.jsx("ul",{className:"extlist",children:l.map(d=>c.jsxs("li",{className:"extlist__row",children:[c.jsx("div",{className:"extlist__head",children:c.jsx("span",{className:"extlist__name",children:d.name})}),d.source&&c.jsx("div",{className:"extlist__meta",children:d.source}),c.jsx("div",{className:"extlist__actions",children:c.jsx("button",{className:"btn btn--ghost btn--sm btn--danger",onClick:()=>i.marketplaceRemove(d.name),children:"Отключить"})})]},d.name))}),c.jsxs("div",{className:"extform__row",children:[c.jsx("input",{className:"input input--mono",value:r,spellCheck:!1,autoComplete:"off","aria-label":"Источник маркетплейса",placeholder:"owner/repo, URL или путь",onChange:d=>o(d.target.value),onKeyDown:d=>{d.key!=="Enter"||r.trim()===""||(d.preventDefault(),i.marketplaceAdd(r.trim()),o(""))}}),c.jsx("button",{className:"btn",disabled:r.trim()==="",onClick:()=>{i.marketplaceAdd(r.trim()),o("")},children:"Добавить"})]})]})}const Ec=30;function bk({catalog:s,hasMarketplaces:l,actions:i,onMarketplaces:r}){const[o,d]=S.useState(""),[h,g]=S.useState(""),[m,b]=S.useState(Ec),[x,k]=S.useState(""),_=S.useMemo(()=>[...new Set(s.map(H=>H.category).filter(Boolean))].sort(),[s]),C=S.useMemo(()=>{const N=o.trim().toLowerCase();return s.filter(H=>h&&H.category!==h?!1:N?`${H.name} ${H.displayName} ${H.description} ${H.author}`.toLowerCase().includes(N):!0)},[s,o,h]);return s.length===0?c.jsxs("p",{className:"modal__text",children:[l?"Маркетплейсы подключены, но их каталог ещё не выкачан. Попробуйте открыть окно ещё раз через минуту.":"Ни одного маркетплейса — ставить нечего."," ",c.jsx("button",{className:"linkish",onClick:r,children:"Подключить маркетплейс"})]}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"catalog__filters",children:[c.jsx("input",{className:"input",value:o,spellCheck:!1,autoComplete:"off","aria-label":"Поиск по каталогу",placeholder:"Поиск: имя, описание, автор",onChange:N=>{d(N.target.value),b(Ec)}}),c.jsx(qs,{title:"Категория",value:h,options:[{value:"",label:"все категории"},..._.map(N=>({value:N,label:N}))],onChange:N=>{g(N),b(Ec)}})]}),C.length===0?c.jsx("p",{className:"modal__text",children:"Ничего не нашлось."}):c.jsx("ul",{className:"extlist",children:C.slice(0,m).map(N=>c.jsxs("li",{className:"extlist__row",children:[c.jsxs("div",{className:"extlist__head",children:[c.jsx("span",{className:"extlist__name",children:N.name}),N.installed&&c.jsx("span",{className:"chip chip--ok",children:"установлен"}),N.version&&c.jsx("span",{className:"chip",children:N.version}),N.category&&c.jsx("span",{className:"chip",children:N.category})]}),N.description&&c.jsx("div",{className:"catalog__desc",children:N.description}),c.jsxs("div",{className:"extlist__meta",children:[N.author&&`${N.author} · `,N.marketplace]}),c.jsxs("div",{className:"extlist__actions",children:[c.jsx("button",{className:"btn btn--ghost btn--sm",disabled:N.installed,onClick:()=>i.pluginInstall(N.id),children:N.installed?"Уже стоит":"Установить"}),N.homepage&&c.jsx("a",{className:"btn btn--ghost btn--sm",href:N.homepage,target:"_blank",rel:"noreferrer",children:"Страница"})]})]},N.id))}),C.length>m&&c.jsx("div",{className:"extbar",children:c.jsxs("button",{className:"btn",onClick:()=>b(N=>N+Ec),children:["Ещё ",Math.min(Ec,C.length-m)," из ",C.length-m]})}),c.jsxs("div",{className:"extform",children:[c.jsx("label",{className:"field",htmlFor:"plugin-spec",children:"Или установить по имени — если нужного в каталоге нет"}),c.jsxs("div",{className:"extform__row",children:[c.jsx("input",{id:"plugin-spec",className:"input input--mono",value:x,spellCheck:!1,autoComplete:"off",placeholder:"имя или имя@маркетплейс",onChange:N=>k(N.target.value),onKeyDown:N=>{N.key!=="Enter"||x.trim()===""||(N.preventDefault(),i.pluginInstall(x.trim()),k(""))}}),c.jsx("button",{className:"btn",disabled:x.trim()==="",onClick:()=>{i.pluginInstall(x.trim()),k("")},children:"Установить"})]})]})]})}function xk({status:s,login:l,actions:i,runningSessions:r,onReconnect:o,reconnectBlocked:d,reconnectHint:h,onClose:g}){const[m,b]=S.useState(""),[x,k]=S.useState(!1),[_,C]=S.useState(!1),N=o!==null&&(s==null?void 0:s.loggedIn)===!0&&!_&&!x,H=S.useMemo(()=>{if(l.error)return{ok:!1,message:l.error};const O=l.output.trim();return O===""?null:{ok:!0,message:O}},[l.error,l.output]);function B(){m.trim()!==""&&(i.submitCode(m.trim()),b(""))}function K(){if(r>0){k(!1),C(!0);return}i.login("claudeai",!0)}return c.jsxs(Pl,{title:"Аккаунт",onClose:g,children:[s===null?c.jsx("p",{className:"modal__text",children:"Спрашиваем у хоста…"}):s.loggedIn?c.jsxs("div",{className:"account",children:[c.jsx("div",{className:"account__id",children:s.email||"Вход выполнен"}),c.jsxs("div",{className:"account__chips",children:[c.jsx("span",{className:"chip chip--ok",children:Sk[s.method]??s.method}),s.plan&&c.jsx("span",{className:"chip",children:s.plan})]}),s.organization&&c.jsx("div",{className:"extlist__meta",children:s.organization})]}):c.jsxs("p",{className:"modal__text",children:["Вход не выполнен. Сессии не запустятся, пока аккаунт не подключён — или пока в окружении хоста нет ",c.jsx("code",{children:"ANTHROPIC_API_KEY"}),"."]}),l.active?c.jsx(kk,{login:l,code:m,onCode:b,onSubmit:B,onCancel:i.cancel}):c.jsxs(c.Fragment,{children:[c.jsx(Uc,{result:H}),_&&c.jsx("p",{className:"account__warn",role:"alert",children:_k(r)}),N&&d&&c.jsx("p",{className:"account__note",children:h}),c.jsx("div",{className:`extbar${s!=null&&s.loggedIn?" account__bar":""}`,children:s!=null&&s.loggedIn?c.jsxs(c.Fragment,{children:[N&&c.jsxs("button",{type:"button",className:"btn account__relink",title:`Переподключить сессию
123
+ ${h}`,"aria-label":"Переподключить сессию",disabled:d,onClick:o,children:[c.jsx(vk,{}),"Переподключить"]}),_?c.jsxs(c.Fragment,{children:[c.jsx("button",{className:"btn",onClick:()=>C(!1),children:"Отмена"}),c.jsx("button",{className:"btn btn--warn",autoFocus:!0,onClick:()=>{C(!1),i.login("claudeai",!0)},children:"Всё равно сменить"})]}):c.jsx("button",{className:"btn",onClick:K,children:"Сменить аккаунт"}),x?c.jsx("button",{className:"btn btn--danger",autoFocus:!0,onClick:()=>{k(!1),i.logout()},children:"Точно выйти?"}):c.jsx("button",{className:"btn",onClick:()=>{C(!1),k(!0)},children:"Выйти"})]}):c.jsxs(c.Fragment,{children:[c.jsx("button",{className:"btn",onClick:()=>i.login("console",!1),children:"Через Console"}),c.jsx("button",{className:"btn btn--primary",onClick:()=>i.login("claudeai",!1),children:"Войти"})]})})]})]})}function _k(s){const l=s%10,i=s%100,r=l===1&&i!==11,o=r?"сессия":l>=2&&l<=4&&(i<12||i>14)?"сессии":"сессий";return`${s} ${o} сейчас ${r?"работает":"работают"} — смена аккаунта может ${r?"её":"их"} прервать.`}function vk(){return c.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("path",{d:"M14 8a6 6 0 1 1-6-6c1.68 0 3.29.67 4.49 1.83L14 5.33"}),c.jsx("path",{d:"M14 2v3.33h-3.33"})]})}const Sk={"claude.ai":"подписка Claude",console:"Anthropic Console",apiKey:"API-ключ",none:"нет"};function kk({login:s,code:l,onCode:i,onSubmit:r,onCancel:o}){return c.jsxs("div",{className:"account__flow",children:[s.url?c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"field",children:"Откройте ссылку и подтвердите вход"}),c.jsx("a",{className:"account__link",href:s.url,target:"_blank",rel:"noreferrer",children:s.url})]}):c.jsx("p",{className:"modal__text",children:"Запускаем вход…"}),s.awaitingCode&&c.jsxs(c.Fragment,{children:[c.jsx("label",{className:"field",htmlFor:"auth-code",children:"Код со страницы авторизации"}),c.jsxs("div",{className:"extform__row",children:[c.jsx("input",{id:"auth-code",className:"input input--mono",value:l,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"вставьте код",onChange:d=>i(d.target.value),onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),r())}}),c.jsx("button",{className:"btn btn--primary",disabled:l.trim()==="",onClick:r,children:"Готово"})]})]}),s.output.trim()!==""&&c.jsx("pre",{className:"account__log",children:s.output.trim()}),c.jsx("div",{className:"extbar",children:c.jsx("button",{className:"btn",onClick:o,children:"Отменить вход"})})]})}function wk({state:s,onPair:l,onUnpair:i,onClose:r}){const[o,d]=S.useState(""),[h,g]=S.useState(""),[m,b]=S.useState(!1),x=S.useRef(null),k=(s==null?void 0:s.paired)===!0;S.useEffect(()=>{var C;k||(C=x.current)==null||C.focus()},[k]),S.useEffect(()=>{b(!1),k&&d("")},[k,s==null?void 0:s.error]);const _=(s==null?void 0:s.url)??"https://claudevisual.com";return c.jsx(Pl,{title:"Удалённый доступ",onClose:r,children:k?c.jsxs("div",{className:"relay",children:[c.jsxs("p",{className:"relay__lede",children:["Компьютер связан с аккаунтом на ",c.jsx("b",{children:sb(_)}),". Открывайте его оттуда с любого устройства — с телефона в том числе."]}),c.jsxs("dl",{className:"relay__facts",children:[c.jsxs("div",{children:[c.jsx("dt",{children:"Имя"}),c.jsx("dd",{children:(s==null?void 0:s.name)??"—"})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"Связь"}),c.jsxs("dd",{children:[c.jsx("span",{className:s!=null&&s.connected?"dot dot--on":"dot"})," ",s!=null&&s.connected?"на связи":"нет связи, пробуем переподключиться"]})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"Подключено"}),c.jsxs("dd",{children:[(s==null?void 0:s.clients)??0," вкладок"]})]})]}),(s==null?void 0:s.error)&&c.jsx("p",{className:"relay__error",children:s.error}),c.jsx("p",{className:"relay__note",children:"Терминал с удалённых устройств настраивается в настройках приложения, раздел «Терминал»."}),c.jsx("p",{className:"relay__note",children:"Отвязка гасит токен этой машины: чтобы вернуть доступ, понадобится новый код. Сессии Claude Code это не трогает."}),c.jsx("button",{className:"btn btn--danger",onClick:i,children:"Отвязать компьютер"})]}):c.jsxs("div",{className:"relay",children:[c.jsx("p",{className:"relay__lede",children:"Чтобы работать с этим компьютером из браузера и с телефона, свяжите его с аккаунтом."}),c.jsxs("ol",{className:"relay__steps",children:[c.jsxs("li",{children:["Откройте ",c.jsx("b",{children:sb(_)})," и войдите (или зарегистрируйтесь)."]}),c.jsxs("li",{children:["Нажмите ",c.jsx("b",{children:"«Подключить ПК»"})," — появится код из восьми знаков."]}),c.jsx("li",{children:"Введите его сюда."})]}),c.jsxs("form",{className:"relay__form",onSubmit:C=>{C.preventDefault(),o.trim()&&(b(!0),l(o.trim(),h.trim()))},children:[c.jsxs("label",{className:"field",children:[c.jsx("span",{children:"Код сопряжения"}),c.jsx("input",{ref:x,className:"input relay__code",value:o,onChange:C=>d(C.target.value.toUpperCase()),placeholder:"XXXX-XXXX",autoComplete:"off",spellCheck:!1,maxLength:12})]}),c.jsxs("label",{className:"field",children:[c.jsx("span",{children:"Как назвать этот компьютер"}),c.jsx("input",{className:"input",value:h,onChange:C=>g(C.target.value),placeholder:"имя машины",autoComplete:"off",maxLength:64})]}),(s==null?void 0:s.error)&&c.jsx("p",{className:"relay__error",children:s.error}),c.jsx("button",{className:"btn btn--primary",type:"submit",disabled:!o.trim()||m,children:m?"Связываем…":"Связать"})]})]})})}function sb(s){try{return new URL(s).host}catch{return s}}const uh="",jk=[{value:"opus",label:"Opus",hint:"полный список моделей виден, когда открыта сессия"},{value:"sonnet",label:"Sonnet",hint:"полный список моделей виден, когда открыта сессия"},{value:"haiku",label:"Haiku",hint:"полный список моделей виден, когда открыта сессия"}],Nk=xb.map(s=>({value:s.value,label:s.value,hint:s.hint})),mo=3600*1e3,Tk=[{value:"6h",label:"6 часов"},{value:"24h",label:"Сутки"},{value:"48h",label:"Двое суток"},{value:"168h",label:"Неделя"},{value:"never",label:"Никогда"}],hr={"6h":6*mo,"24h":24*mo,"48h":48*mo,"168h":168*mo,never:0};function Ek(s){return hr[s]??hr["48h"]}function Ak(s){const l=Object.entries(hr).find(([,i])=>i===s);return l?l[0]:Object.keys(hr).reduce((i,r)=>Math.abs(hr[r]-s)<Math.abs(hr[i]-s)?r:i)}const Ck=[{value:"off",label:"Выключено"},{value:"500",label:"0.5 с"},{value:"1500",label:"1.5 с"},{value:"3000",label:"3 с"},{value:"10000",label:"10 с"}],pr={off:0,500:500,1500:1500,3e3:3e3,1e4:1e4};function Rk(s){return pr[s]??pr.off}function Mk(s){const l=Object.entries(pr).find(([,i])=>i===s);return l?l[0]:Object.keys(pr).reduce((i,r)=>Math.abs(pr[r]-s)<Math.abs(pr[i]-s)?r:i)}const Ok=[{value:"project",title:"Только текущий проект",description:"Агент молча пишет файлы в открытом проекте и в ~/.claude — настройках самого Claude Code. Чужой проект и любая новая папка — только с явного разрешения."},{value:"projects",title:"Папка с проектами",description:"То же плюс каталог, где лежат открытые проекты, — то есть и соседний проект тоже. Всё остальное — с разрешения."},{value:"all",title:"Все папки на компьютере",description:"Агент пишет файлы куда угодно на диске — вопросов про место записи не будет.",risky:!0}];function Dk({settings:s,models:l,relayState:i,local:r,onChange:o,onEnableShell:d,onDisableShell:h,onOpenRelay:g,onClose:m}){const b=s===null,x=!b&&s.terminalEnabled===!0,k=!x,_=S.useMemo(()=>{const N=[{value:uh,label:"Как в Claude Code",hint:"модель определят настройки самого Claude Code"},...l.length>0?l.map(H=>({value:H.value,label:H.displayName,hint:H.description})):jk];return s&&s.startModel!==null&&!N.some(H=>H.value===s.startModel)&&N.push({value:s.startModel,label:s.startModel}),N},[l,s]);function C(){var N,H;return(i==null?void 0:i.paired)!==!0?c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"settings__hint",children:"Компьютер не связан с аккаунтом — включать удалённый доступ пока не к чему: без пары ни телефон, ни другое устройство этот компьютер вообще не видят."}),c.jsx("button",{type:"button",className:"btn",disabled:k,onClick:g,children:"Связать компьютер"})]}):(N=i.shell)!=null&&N.enabled?c.jsxs(c.Fragment,{children:[c.jsxs("p",{className:"settings__hint",children:["Разрешён: с телефона и любого другого устройства этого аккаунта можно открыть терминал и выполнить на этом компьютере что угодно — как если бы сидели за ним.",i.shell.confirmedAt&&` Включено ${new Date(i.shell.confirmedAt).toLocaleString()}.`]}),c.jsx("button",{type:"button",className:"btn btn--danger",disabled:k,onClick:h,children:"Запретить"})]}):(H=i.shell)!=null&&H.pending?c.jsxs(c.Fragment,{children:[c.jsxs("p",{className:"settings__hint",children:["Письмо ушло на ",c.jsx("b",{children:i.shell.email}),". Перейдите по ссылке из него — терминал заработает удалённо."]}),c.jsx("p",{className:"settings__hint",children:"Повторная отправка ограничена раз в минуту — если жали кнопку только что, письмо не придёт и от повторного нажатия тоже. Если сейчас доберётесь до самого компьютера, там разрешение включится сразу, без письма."}),c.jsx("button",{type:"button",className:"btn",disabled:k,onClick:d,children:"Отправить письмо ещё раз"})]}):c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"settings__hint",children:"Сейчас с телефона можно смотреть разговоры и файлы, но не запускать команды. Разрешение даёт полный доступ к терминалу этого компьютера: с телефона станет можно выполнить любую команду, как в обычной консоли за этой машиной."}),r?c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"settings__hint",children:"Включится сразу — вы уже за этим компьютером, подтверждать доступ к нему нечем и незачем."}),c.jsx("button",{type:"button",className:"btn",disabled:k,onClick:d,children:"Разрешить с телефона"})]}):c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"settings__hint",children:"Отсюда мгновенно не включится: на почту аккаунта уйдёт письмо, и терминал заработает только после перехода по ссылке из него."}),c.jsx("button",{type:"button",className:"btn",disabled:k,onClick:d,children:"Прислать письмо"})]})]})}return c.jsx(Pl,{title:"Настройки",onClose:m,children:c.jsxs("div",{className:"settings",children:[c.jsxs("section",{className:"settings__section",children:[c.jsx("h3",{className:"settings__heading",children:"Архивация молчащих сессий"}),c.jsx("p",{className:"settings__hint",children:"Сессия, к которой долго не возвращались, сама уезжает в архив — на диске ничего не удаляется, транскрипт остаётся, и её можно вернуть обратно в любой момент."}),b?c.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):c.jsx(qs,{className:"settings__select",value:Ak(s.autoArchiveAfterMs),options:Tk,onChange:N=>o({autoArchiveAfterMs:Ek(N)}),ariaLabel:"Через сколько молчащая сессия уезжает в архив"})]}),c.jsxs("section",{className:"settings__section",children:[c.jsx("h3",{className:"settings__heading",children:"Автосохранение"}),c.jsx("p",{className:"settings__hint",children:"Открытый файл сам уезжает на диск, если немного постоять без ввода — ручное сохранение, кнопкой или Ctrl+S, при этом всегда работает как обычно, независимо от этой настройки."}),b?c.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):c.jsx(qs,{className:"settings__select",value:Mk(s.autoSaveAfterPauseMs),options:Ck,onChange:N=>o({autoSaveAfterPauseMs:Rk(N)}),ariaLabel:"Пауза перед автосохранением открытого файла"})]}),c.jsxs("section",{className:"settings__section",children:[c.jsx("h3",{className:"settings__heading",children:"Старт новой сессии"}),c.jsx("p",{className:"settings__hint",children:"Модель и режим прав, с которыми поднимается новая сессия. Уже открытую это не меняет — у неё свои переключатели в шапке."}),c.jsxs("div",{className:"settings__field",children:[c.jsx("span",{className:"settings__field-label",children:"Модель"}),b?c.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):c.jsx(qs,{className:"settings__select",value:s.startModel??uh,options:_,onChange:N=>o({startModel:N===uh?null:N}),ariaLabel:"Модель, с которой поднимается новая сессия"})]}),c.jsxs("div",{className:"settings__field",children:[c.jsx("span",{className:"settings__field-label",children:"Режим прав при старте"}),b?c.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):c.jsx(qs,{className:"settings__select",value:s.startPermissionMode,options:Nk,onChange:N=>o({startPermissionMode:N}),ariaLabel:"Режим прав, с которым поднимается новая сессия"})]})]}),c.jsxs("section",{className:"settings__section",children:[c.jsx("h3",{className:"settings__heading",children:"Доступ к папкам"}),c.jsx("p",{className:"settings__hint",children:"Это про то, где агент пишет файлы (Write, Edit, NotebookEdit), не спрашивая разрешения, — не про чтение: читает он в любом случае. Ничего не запрещается наглухо — выход за выбранную границу просто превращается в обычный запрос прав, который остаётся подтвердить или отклонить."}),c.jsx("div",{className:"access",role:"radiogroup","aria-label":"Доступ к папкам",children:Ok.map(N=>{const H=!b&&s.folderAccess===N.value;return c.jsxs("button",{type:"button",role:"radio","aria-checked":H,disabled:b,className:"access__card"+(H?" is-on":"")+(N.risky?" access__card--risky":""),onClick:()=>o({folderAccess:N.value}),children:[c.jsx("span",{className:"access__radio","aria-hidden":"true"}),c.jsxs("span",{className:"access__body",children:[c.jsxs("span",{className:"access__title",children:[N.title,N.risky&&c.jsx("span",{className:"access__risk",children:"самое широкое"})]}),c.jsx("span",{className:"access__desc",children:N.description})]})]},N.value)})})]}),c.jsxs("section",{className:"settings__section",children:[c.jsxs("div",{className:"settings__switch-row",children:[c.jsxs("div",{className:"settings__switch-copy",children:[c.jsx("h3",{className:"settings__heading",children:"Терминал"}),c.jsx("p",{className:"settings__hint",children:"Панель терминала под лентой разговора: команда, которую там набрали, выполняется прямо на этом компьютере с правами вашего пользователя — не в песочнице агента, как Bash-инструмент в разговоре. Выключите — и все открытые вкладки терминала закроются, а процессы в них не переживут закрытия."})]}),b?c.jsx("div",{className:"settings__switch-skeleton","aria-hidden":"true"}):c.jsx("button",{type:"button",role:"switch","aria-checked":x,"aria-label":"Терминал",className:x?"switch is-on":"switch",onClick:()=>o({terminalEnabled:!x}),children:c.jsx("span",{className:"switch__knob"})})]}),c.jsxs("div",{className:"settings__nested"+(k?" is-disabled":""),children:[c.jsx("h4",{className:"settings__nested-heading",children:"Удалённый доступ к терминалу"}),b?c.jsx("p",{className:"settings__hint",children:"Загрузка…"}):c.jsxs(c.Fragment,{children:[k&&c.jsx("p",{className:"settings__hint",children:"Сначала включите терминал выше — удалённый доступ выдаётся к тому, что на этой машине уже разрешено, а не поверх выключенного рубильника."}),C()]})]})]})]})})}const zk=16;function Lk({pane:s,width:l,onResize:i,onReset:r}){const o=Si[s],d=S.useRef(null);function h(x){if(x.button!==0)return;const k=document.querySelector(".main"),_=k?Math.max(0,k.getBoundingClientRect().width-J0):0;d.current={x:x.clientX,width:l,max:Math.min(o.max,l+_)},x.currentTarget.setPointerCapture(x.pointerId),document.body.classList.add("is-resizing"),x.preventDefault()}function g(x){const k=d.current;if(!k)return;const _=o.side==="left"?x.clientX-k.x:k.x-x.clientX;i(Math.min(k.max,k.width+_))}function m(x){d.current&&(d.current=null,x.currentTarget.hasPointerCapture(x.pointerId)&&x.currentTarget.releasePointerCapture(x.pointerId),document.body.classList.remove("is-resizing"))}function b(x){const k=x.key==="ArrowRight"?1:x.key==="ArrowLeft"?-1:0;k!==0&&(x.preventDefault(),i(l+k*zk*(o.side==="left"?1:-1)))}return c.jsx("div",{className:`pane-resizer pane-resizer--${s} pane-resizer--${o.side}`,role:"separator","aria-orientation":"vertical","aria-label":`Ширина панели ${o.label}`,"aria-valuenow":l,"aria-valuemin":o.min,"aria-valuemax":o.max,tabIndex:0,title:"Потяните, чтобы изменить ширину; двойной щелчок — ширина по умолчанию",onPointerDown:h,onPointerMove:g,onPointerUp:m,onPointerCancel:m,onDoubleClick:r,onKeyDown:b,children:c.jsx("span",{className:"pane-resizer__line","aria-hidden":"true"})})}const Uk=16;function Hk({height:s,onResize:l,onReset:i}){const r=S.useRef(null);function o(){const b=document.querySelector(".main .transcript, .main .editor");if(!b)return 1/0;const x=b.getBoundingClientRect().height-e_;return Math.round(s+Math.max(0,x))}function d(b){b.button===0&&(r.current={y:b.clientY,height:s,max:o()},b.currentTarget.setPointerCapture(b.pointerId),document.body.classList.add("is-resizing-row"),b.preventDefault())}function h(b){const x=r.current;if(!x)return;const k=x.y-b.clientY;l(x.height+k,x.max)}function g(b){r.current&&(r.current=null,b.currentTarget.hasPointerCapture(b.pointerId)&&b.currentTarget.releasePointerCapture(b.pointerId),document.body.classList.remove("is-resizing-row"))}function m(b){const x=b.key==="ArrowUp"?1:b.key==="ArrowDown"?-1:0;x!==0&&(b.preventDefault(),l(s+x*Uk,o()))}return c.jsx("div",{className:"term-resizer",role:"separator","aria-orientation":"horizontal","aria-label":"Высота панели терминала","aria-valuenow":s,"aria-valuemin":Sb,tabIndex:0,title:"Потяните, чтобы изменить высоту; двойной щелчок — высота по умолчанию",onPointerDown:d,onPointerMove:h,onPointerUp:g,onPointerCancel:g,onDoubleClick:i,onKeyDown:m,children:c.jsx("span",{className:"term-resizer__line","aria-hidden":"true"})})}function ib(){const s=document.documentElement,l=getComputedStyle(s),i=O=>l.getPropertyValue(O).trim(),r=i("--surface"),o=i("--text"),d=i("--text-2"),h=i("--muted"),g=i("--accent"),m=i("--accent-fg"),b=i("--select"),x=i("--danger"),k=i("--ok"),_=i("--warn"),C=i("--cm-fn"),N=i("--cm-key"),H=i("--cm-type"),B=rb(o,r,55),K=O=>rb(O,"#ffffff",25);return{background:r,foreground:o,cursor:g,cursorAccent:m,selectionBackground:b,black:B,brightBlack:h,red:x,brightRed:K(x),green:k,brightGreen:K(k),yellow:_,brightYellow:K(_),blue:C,brightBlue:K(C),magenta:N,brightMagenta:K(N),cyan:H,brightCyan:K(H),white:d,brightWhite:o}}function Bk(){return getComputedStyle(document.documentElement).getPropertyValue("--mono").trim()}let ga=null;function qk(s){return ga||(ga=document.createElement("span"),ga.style.position="fixed",ga.style.width="0",ga.style.height="0",ga.style.opacity="0",ga.style.pointerEvents="none",document.body.appendChild(ga)),ga.style.color=s,getComputedStyle(ga).color}function rb(s,l,i){return qk(`color-mix(in srgb, ${s} ${100-i}%, ${l} ${i}%)`)}let go=null;function Gk(){return go||(go=Promise.all([Xe(()=>import("./xterm-D6Mng-DB.js").then(s=>s.x),__vite__mapDeps([22,23]),import.meta.url),Xe(()=>import("./addon-fit-CevVMrUA.js").then(s=>s.a),__vite__mapDeps([24,23]),import.meta.url),Xe(()=>import("./addon-web-links-CnB65OV_.js").then(s=>s.a),__vite__mapDeps([25,23]),import.meta.url),Xe(()=>Promise.resolve({}),__vite__mapDeps([26]),import.meta.url)]).then(([s,l,i])=>({Terminal:s.Terminal,FitAddon:l.FitAddon,WebLinksAddon:i.WebLinksAddon})).catch(s=>{throw go=null,s})),go}function Yk({terminals:s,activeId:l,blocked:i,height:r,offset:o,mobile:d=!1,zoomed:h,onToggleZoom:g,onSelect:m,onOpen:b,onClose:x,onInput:k,onResize:_,onAttach:C,onHide:N,registerSink:H}){const[B,K]=S.useState(()=>ib());return S.useEffect(()=>{const O=new MutationObserver(()=>K(ib()));return O.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>O.disconnect()},[]),c.jsxs("div",{className:"termpanel"+(d?" termpanel--mobile":"")+(!d&&h?" termpanel--zoomed":""),style:d?{height:r,top:(o==null?void 0:o.top)??0,left:(o==null?void 0:o.left)??0}:h?void 0:{height:r},children:[c.jsxs("div",{className:"termpanel__tabbar",onDoubleClick:O=>{g&&(O.target.closest("button")||g())},children:[c.jsx("div",{className:"termpanel__tabs",role:"tablist","aria-label":"Открытые терминалы",children:s.map(O=>c.jsxs("div",{role:"tab","aria-selected":O.id===l,className:"termtab"+(O.id===l?" is-on":"")+(O.exitCode!==null?" termtab--exited":""),onDoubleClick:$=>{g&&($.target.closest(".termtab__close")||g())},children:[c.jsx("button",{className:"termtab__name",title:O.cwd,onClick:()=>m(O.id),children:O.title}),O.exitCode!==null&&c.jsx("span",{className:"termtab__code",title:`Оболочка завершилась с кодом ${O.exitCode}`,children:O.exitCode}),c.jsx("button",{className:"termtab__close",title:"Закрыть терминал","aria-label":`Закрыть терминал «${O.title}»`,onClick:()=>x(O.id),children:"✕"})]},O.id))}),c.jsx("button",{className:"termpanel__add",title:"Новый терминал","aria-label":"Новый терминал",disabled:i,onClick:b,children:"+"}),c.jsx("div",{className:"termpanel__spacer"}),g&&c.jsx("button",{className:"termpanel__zoom",title:h?"Свернуть терминал — то же самое, что двойной клик по вкладке":"Развернуть терминал на весь экран — то же самое, что двойной клик по вкладке","aria-label":h?"Свернуть терминал":"Развернуть терминал на весь экран","aria-pressed":h,onClick:g,children:c.jsx(Tr,{active:h})}),c.jsx("button",{className:"termpanel__hide",title:"Скрыть панель","aria-label":"Скрыть панель терминала",onClick:N,children:"✕"})]}),c.jsxs("div",{className:"termpanel__body",children:[i?c.jsxs("div",{className:"termpanel__empty",children:[c.jsx("p",{children:"Терминал с удалённых устройств выключен"}),c.jsx("p",{className:"termpanel__hint",children:"Откройте «Удалённый доступ» → «Прислать письмо»: на почту аккаунта придёт ссылка, и после перехода по ней терминал заработает прямо здесь. Если сейчас доберётесь до самого компьютера — там разрешение включается сразу, без письма."})]}):s.length===0&&c.jsxs("div",{className:"termpanel__empty",children:[c.jsx("p",{children:"Терминалов не открыто"}),c.jsx("button",{className:"btn btn--primary",onClick:b,children:"Открыть терминал"})]}),s.map(O=>c.jsx(Ik,{id:O.id,exitCode:O.exitCode,active:O.id===l,theme:B,mobile:d,onInput:k,onResize:_,onAttach:C,registerSink:H},O.id))]})]})}function Ik({id:s,exitCode:l,active:i,theme:r,mobile:o,onInput:d,onResize:h,onAttach:g,registerSink:m}){const b=S.useRef(null),x=S.useRef(null),k=S.useRef(!1),_=S.useRef(o);_.current=o;const C=S.useRef(r),N=S.useRef(l),[H,B]=S.useState("loading"),[K,O]=S.useState(!1);return S.useEffect(()=>{if(!b.current)return;let A=!1,Q=null;B("loading"),O(!1);const L=window.setTimeout(()=>{A||O(!0)},200);return(async()=>{let M;try{M=await Gk()}catch{window.clearTimeout(L),A||B("error");return}if(A||!b.current)return;window.clearTimeout(L);const{Terminal:W,FitAddon:re,WebLinksAddon:he}=M,F=new W({fontFamily:Bk()||"monospace",fontSize:13,lineHeight:1.2,cursorBlink:!0,cursorStyle:"bar",scrollback:5e3,theme:C.current}),ae=new re;F.loadAddon(ae),F.loadAddon(new he),F.open(b.current),x.current=F,F.attachCustomKeyEventHandler(xe=>{if(xe.type!=="keydown"||!(xe.ctrlKey||xe.metaKey))return!0;if(xe.key==="`")return!1;if(xe.key==="c"||xe.key==="C"){const j=F.getSelection();return j?(navigator.clipboard.writeText(j),!1):!xe.shiftKey}return xe.shiftKey&&(xe.key==="v"||xe.key==="V")?(navigator.clipboard.readText().then(j=>{j&&F.paste(j)}),!1):!0});const me=F.onData(xe=>d(s,xe));let Ne={cols:F.cols,rows:F.rows},pe=null;const z=F.onResize(({cols:xe,rows:we})=>{pe!==null&&window.clearTimeout(pe),pe=window.setTimeout(()=>{pe=null,!(xe===Ne.cols&&we===Ne.rows)&&(Ne={cols:xe,rows:we},h(s,xe,we))},100)}),P=new ResizeObserver(()=>{try{ae.fit()}catch{return}_.current&&F.scrollToBottom()});P.observe(b.current);const te=m(s,xe=>{xe.kind==="buffer"&&F.reset(),F.write(xe.data)});g(s),N.current!==null&&!k.current&&(k.current=!0,F.write(`\r
124
124
  \x1B[2m— Процесс завершён (код ${N.current}) —\x1B[0m\r
125
125
  `)),i&&F.focus(),Q=()=>{pe!==null&&window.clearTimeout(pe),P.disconnect(),me.dispose(),z.dispose(),te(),F.dispose(),x.current=null},B("ready")})(),()=>{A=!0,window.clearTimeout(L),Q==null||Q(),Q=null}},[s]),S.useEffect(()=>{if(!o)return;const $=b.current;if(!$)return;let A=null,Q=0,L=!1;const M=F=>{F.pointerType==="mouse"||A!==null||(A=F.pointerId,Q=F.clientY,L=!1)},W=F=>{if(F.pointerId!==A)return;const ae=Q-F.clientY;if(!L){if(Math.abs(ae)<4)return;L=!0,$.setPointerCapture(F.pointerId)}Q=F.clientY;const me=$.querySelector(".xterm-viewport");me&&(me.scrollTop+=ae)},re=F=>{F.pointerId===A&&($.hasPointerCapture(F.pointerId)&&$.releasePointerCapture(F.pointerId),A=null,L=!1)},he=F=>F.stopPropagation();return $.addEventListener("pointerdown",M),$.addEventListener("pointermove",W),$.addEventListener("pointerup",re),$.addEventListener("pointercancel",re),$.addEventListener("touchmove",he,{capture:!0}),()=>{$.removeEventListener("pointerdown",M),$.removeEventListener("pointermove",W),$.removeEventListener("pointerup",re),$.removeEventListener("pointercancel",re),$.removeEventListener("touchmove",he,{capture:!0}),A!==null&&$.hasPointerCapture(A)&&$.releasePointerCapture(A)}},[o]),S.useEffect(()=>{C.current=r,x.current&&(x.current.options.theme=r)},[r]),S.useEffect(()=>{var $;i&&(($=x.current)==null||$.focus())},[i]),S.useEffect(()=>{if(N.current=l,l===null){k.current=!1;return}if(k.current)return;const $=x.current;$&&(k.current=!0,$.write(`\r
126
126
  \x1B[2m— Процесс завершён (код ${l}) —\x1B[0m\r