@i14ks/ccv 0.9.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. package/package.json +1 -1
  2. package/web/assets/{codemirror-B5gQkzI5.js → codemirror-BlfaJp7t.js} +1 -1
  3. package/web/assets/{index-De0BMDU7.css → index-BKioROlx.css} +1 -1
  4. package/web/assets/{index-D2kgCnsK.js → index-BNVOt0Er.js} +1 -1
  5. package/web/assets/{index-DwKlMv7y.js → index-BrHxnl17.js} +1 -1
  6. package/web/assets/{index-BhMOqhie.js → index-BuNEEiXu.js} +1 -1
  7. package/web/assets/{index-ddiuUAWC.js → index-C5b0Bkhr.js} +1 -1
  8. package/web/assets/{index-oyQoijyw.js → index-CDHH9Lyv.js} +1 -1
  9. package/web/assets/{index-btSVHsjz.js → index-CGA_fGck.js} +1 -1
  10. package/web/assets/{index-BqBuIlqo.js → index-CR5imSsQ.js} +1 -1
  11. package/web/assets/{index-Ad2PF-Rq.js → index-CUva-2wH.js} +1 -1
  12. package/web/assets/{index-CRw2q1Gv.js → index-CiBOLsj6.js} +1 -1
  13. package/web/assets/{index-DCBC0-5s.js → index-D3uHnHOQ.js} +1 -1
  14. package/web/assets/{index-D3_uFnMm.js → index-D5Dmgo1w.js} +3 -3
  15. package/web/assets/{index-2TX05R9q.js → index-DB2nshSr.js} +1 -1
  16. package/web/assets/{index-BSSlnGXY.js → index-DOB2UBvs.js} +1 -1
  17. package/web/assets/{index-CUHxmW2C.js → index-DYKV4X3G.js} +1 -1
  18. package/web/assets/{index-CjrFyEQW.js → index-DmzmUXZ6.js} +1 -1
  19. package/web/assets/{index-7kIwIZTG.js → index-DtGGM1Mo.js} +1 -1
  20. package/web/assets/{index-BkW026LB.js → index-UL9tmS_d.js} +1 -1
  21. package/web/assets/{index-0HmmQWlg.js → index-jFtLq_ca.js} +1 -1
  22. package/web/assets/{index-CXwcriib.js → index-tQ5Xudmz.js} +1 -1
  23. package/web/assets/{index-DSNfNkTB.js → index-y4j9izne.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-BkW026LB.js","./index-CjrFyEQW.js","./index-CXwcriib.js","./index-BHot-lnj.js","./index-891wE-Rj.js","./index-oyQoijyw.js","./index-BSSlnGXY.js","./index-BhMOqhie.js","./index-DwKlMv7y.js","./index-Ad2PF-Rq.js","./index-0HmmQWlg.js","./index-DCBC0-5s.js","./index-DSNfNkTB.js","./index-7kIwIZTG.js","./index-2TX05R9q.js","./index-ddiuUAWC.js","./index-btSVHsjz.js","./index-CUHxmW2C.js","./index-D2kgCnsK.js","./index-CRw2q1Gv.js","./index-BqBuIlqo.js","./codemirror-B5gQkzI5.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-UL9tmS_d.js","./index-DmzmUXZ6.js","./index-tQ5Xudmz.js","./index-BHot-lnj.js","./index-891wE-Rj.js","./index-CDHH9Lyv.js","./index-DOB2UBvs.js","./index-BuNEEiXu.js","./index-BrHxnl17.js","./index-CUva-2wH.js","./index-jFtLq_ca.js","./index-D3uHnHOQ.js","./index-y4j9izne.js","./index-DtGGM1Mo.js","./index-DB2nshSr.js","./index-C5b0Bkhr.js","./index-CGA_fGck.js","./index-DYKV4X3G.js","./index-BNVOt0Er.js","./index-CiBOLsj6.js","./index-CR5imSsQ.js","./codemirror-BlfaJp7t.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 B_=Object.defineProperty;var Zg=a=>{throw TypeError(a)};var q_=(a,l,i)=>l in a?B_(a,l,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[l]=i;var wt=(a,l,i)=>q_(a,typeof l!="symbol"?l+"":l,i),Zd=(a,l,i)=>l.has(a)||Zg("Cannot "+i);var He=(a,l,i)=>(Zd(a,l,"read from private field"),i?i.call(a):l.get(a)),Zt=(a,l,i)=>l.has(a)?Zg("Cannot add the same private member more than once"):l instanceof WeakSet?l.add(a):l.set(a,i),mt=(a,l,i,c)=>(Zd(a,l,"write to private field"),c?c.call(a,i):l.set(a,i),i),Sn=(a,l,i)=>(Zd(a,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"]'))c(o);new MutationObserver(o=>{for(const d of o)if(d.type==="childList")for(const h of d.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&c(h)}).observe(document,{childList:!0,subtree:!0});function 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 c(o){if(o.ep)return;o.ep=!0;const d=i(o);fetch(o.href,d)}})();var Kd={exports:{}},Mc={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -113,8 +113,8 @@ ${a}</tr>
113
113
  Please report this to https://github.com/markedjs/marked.`,a){let c="<p>An error occurred:</p><pre>"+ga(i.message+"",!0)+"</pre>";return l?Promise.resolve(c):c}if(l)return Promise.reject(i);throw i}}},zi=new rv;function xt(a,l){return zi.parse(a,l)}xt.options=xt.setOptions=function(a){return zi.setOptions(a),xt.defaults=zi.defaults,zx(xt.defaults),xt};xt.getDefaults=Dh;xt.defaults=Li;xt.use=function(...a){return zi.use(...a),xt.defaults=zi.defaults,zx(xt.defaults),xt};xt.walkTokens=function(a,l){return zi.walkTokens(a,l)};xt.parseInline=zi.parseInline;xt.Parser=Ql;xt.parser=Ql.parse;xt.Renderer=Ho;xt.TextRenderer=Gh;xt.Lexer=$l;xt.lexer=$l.lex;xt.Tokenizer=Uo;xt.Hooks=qc;xt.parse=xt;xt.options;xt.setOptions;xt.use;xt.walkTokens;xt.parseInline;Ql.parse;$l.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 gb(a,l){(l==null||l>a.length)&&(l=a.length);for(var i=0,c=Array(l);i<l;i++)c[i]=a[i];return c}function cv(a){if(Array.isArray(a))return a}function uv(a,l){var i=a==null?null:typeof Symbol<"u"&&a[Symbol.iterator]||a["@@iterator"];if(i!=null){var c,o,d,h,p=[],m=!0,x=!1;try{if(d=(i=i.call(a)).next,l!==0)for(;!(m=(c=d.call(i)).done)&&(p.push(c.value),p.length!==l);m=!0);}catch(y){x=!0,o=y}finally{try{if(!m&&i.return!=null&&(h=i.return(),Object(h)!==h))return}finally{if(x)throw o}}return p}}function ov(){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 fv(a,l){return cv(a)||uv(a,l)||dv(a,l)||ov()}function dv(a,l){if(a){if(typeof a=="string")return gb(a,l);var i={}.toString.call(a).slice(8,-1);return i==="Object"&&a.constructor&&(i=a.constructor.name),i==="Map"||i==="Set"?Array.from(a):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?gb(a,l):void 0}}const Vx=Object.entries,bb=Object.setPrototypeOf,hv=Object.isFrozen,pv=Object.getPrototypeOf,mv=Object.getOwnPropertyDescriptor;let Gn=Object.freeze,Yn=Object.seal,Sr=Object.create,$x=typeof Reflect<"u"&&Reflect,wh=$x.apply,Th=$x.construct;Gn||(Gn=function(l){return l});Yn||(Yn=function(l){return l});wh||(wh=function(l,i){for(var c=arguments.length,o=new Array(c>2?c-2:0),d=2;d<c;d++)o[d-2]=arguments[d];return l.apply(i,o)});Th||(Th=function(l){for(var i=arguments.length,c=new Array(i>1?i-1:0),o=1;o<i;o++)c[o-1]=arguments[o];return new l(...c)});const yr=jn(Array.prototype.forEach),gv=jn(Array.prototype.lastIndexOf),xb=jn(Array.prototype.pop),_r=jn(Array.prototype.push),bv=jn(Array.prototype.splice),Hs=Array.isArray,Ic=jn(String.prototype.toLowerCase),ah=jn(String.prototype.toString),yb=jn(String.prototype.match),zc=jn(String.prototype.replace),_b=jn(String.prototype.indexOf),xv=jn(String.prototype.trim),yv=jn(Number.prototype.toString),_v=jn(Boolean.prototype.toString),vb=typeof BigInt>"u"?null:jn(BigInt.prototype.toString),Sb=typeof Symbol>"u"?null:jn(Symbol.prototype.toString),Dn=jn(Object.prototype.hasOwnProperty),Lc=jn(Object.prototype.toString),On=jn(RegExp.prototype.test),Si=vv(TypeError);function jn(a){return function(l){l instanceof RegExp&&(l.lastIndex=0);for(var i=arguments.length,c=new Array(i>1?i-1:0),o=1;o<i;o++)c[o-1]=arguments[o];return wh(a,l,c)}}function vv(a){return function(){for(var l=arguments.length,i=new Array(l),c=0;c<l;c++)i[c]=arguments[c];return Th(a,i)}}function lt(a,l){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ic;if(bb&&bb(a,null),!Hs(l))return a;let c=l.length;for(;c--;){let o=l[c];if(typeof o=="string"){const d=i(o);d!==o&&(hv(l)||(l[c]=d),o=d)}a[o]=!0}return a}function Sv(a){for(let l=0;l<a.length;l++)Dn(a,l)||(a[l]=null);return a}function nl(a){const l=Sr(null);for(const c of Vx(a)){var i=fv(c,2);const o=i[0],d=i[1];Dn(a,o)&&(Hs(d)?l[o]=Sv(d):d&&typeof d=="object"&&d.constructor===Object?l[o]=nl(d):l[o]=d)}return l}function jv(a){switch(typeof a){case"string":return a;case"number":return yv(a);case"boolean":return _v(a);case"bigint":return vb?vb(a):"0";case"symbol":return Sb?Sb(a):"Symbol()";case"undefined":return Lc(a);case"function":case"object":{if(a===null)return Lc(a);const l=a,i=ba(l,"toString");if(typeof i=="function"){const c=i(l);return typeof c=="string"?c:Lc(c)}return Lc(a)}default:return Lc(a)}}function ba(a,l){for(;a!==null;){const c=mv(a,l);if(c){if(c.get)return jn(c.get);if(typeof c.value=="function")return jn(c.value)}a=pv(a)}function i(){return null}return i}function kv(a){try{return On(a,""),!0}catch{return!1}}const jb=Gn(["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"]),sh=Gn(["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"]),ih=Gn(["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"]),Nv=Gn(["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"]),rh=Gn(["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"]),wv=Gn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),kb=Gn(["#text"]),Nb=Gn(["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"]),ch=Gn(["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"]),wb=Gn(["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"]),vo=Gn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Tv=Yn(/{{[\w\W]*|^[\w\W]*}}/g),Ev=Yn(/<%[\w\W]*|^[\w\W]*%>/g),Av=Yn(/\${[\w\W]*/g),Cv=Yn(/^data-[\-\w.\u00B7-\uFFFF]+$/),Rv=Yn(/^aria-[\-\w]+$/),Tb=Yn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Mv=Yn(/^(?:\w+script|data):/i),Ov=Yn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Dv=Yn(/^html$/i),zv=Yn(/^[a-z][.\w]*(-[.\w]+)+$/i),Eb=Yn(/<[/\w!]/g),Ab=Yn(/<[/\w]/g),Lv=Yn(/<\/no(script|embed|frames)/i),Uv=Yn(/\/>/i),kl={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Hv=function(){return typeof window>"u"?null:window},Bv=function(l,i){if(typeof l!="object"||typeof l.createPolicy!="function")return null;let c=null;const o="data-tt-policy-suffix";i&&i.hasAttribute(o)&&(c=i.getAttribute(o));const d="dompurify"+(c?"#"+c:"");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}},Cb=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Ds=function(l,i,c,o){return Dn(l,i)&&Hs(l[i])?lt(o.base?nl(o.base):{},l[i],o.transform):c};function Qx(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Hv();const l=he=>Qx(he);if(l.version="3.4.12",l.removed=[],!a||!a.document||a.document.nodeType!==kl.document||!a.Element)return l.isSupported=!1,l;let i=a.document;const c=i,o=c.currentScript;a.DocumentFragment;const d=a.HTMLTemplateElement,h=a.Node,p=a.Element,m=a.NodeFilter,x=a.NamedNodeMap;x===void 0&&(a.NamedNodeMap||a.MozNamedAttrMap),a.HTMLFormElement;const y=a.DOMParser,j=a.trustedTypes,v=p.prototype,R=ba(v,"cloneNode"),w=ba(v,"remove"),L=ba(v,"nextSibling"),B=ba(v,"childNodes"),P=ba(v,"parentNode"),M=ba(v,"shadowRoot"),Q=ba(v,"attributes"),k=h&&h.prototype?ba(h.prototype,"nodeType"):null,Z=h&&h.prototype?ba(h.prototype,"nodeName"):null;if(typeof d=="function"){const he=i.createElement("template");he.content&&he.content.ownerDocument&&(i=he.content.ownerDocument)}let z,A="",V,te=!1,fe=0;const F=function(){if(fe>0)throw Si('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(N){F(),fe++;try{return z.createHTML(N)}finally{fe--}},me=function(N){F(),fe++;try{return z.createScriptURL(N)}finally{fe--}},we=function(){return te||(V=Bv(j,o),te=!0),V},ge=i,H=ge.implementation,ie=ge.createNodeIterator,re=ge.createDocumentFragment,ue=ge.getElementsByTagName,_e=c.importNode;let T=Cb();l.isSupported=typeof Vx=="function"&&typeof P=="function"&&H&&H.createHTMLDocument!==void 0;const K=Tv,oe=Ev,pe=Av,Ne=Cv,ye=Rv,Ae=Mv,st=Ov,Qe=zv;let Ot=Tb,qe=null;const yt=lt({},[...jb,...sh,...ih,...rh,...kb]);let et=null;const Je=lt({},[...Nb,...ch,...wb,...vo]);let Fe=Object.seal(Sr(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}})),it=null,Jn=null;const Bt=Object.seal(Sr(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let qt=!0,Kt=!0,It=!1,Gt=!0,Qt=!1,rt=!0,Tt=!1,en=!1,En=null,Ct=null,kn=!1,An=!1,Dt=!1,fn=!1,Jt=!0,Et=!1;const dn="user-content-";let ot=!0,tn=!1,E={},Y=null;const ve=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 D=null;const J=lt({},["audio","video","img","source","image","track"]);let xe=null;const Be=lt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ft="http://www.w3.org/1998/Math/MathML",Nn="http://www.w3.org/2000/svg",wn="http://www.w3.org/1999/xhtml";let Rt=wn,wl=!1,Sa=null;const ja=lt({},[ft,Nn,wn],ah),Gs=Gn(["mi","mo","mn","ms","mtext"]);let Hl=lt({},Gs);const Kl=Gn(["annotation-xml"]);let hn=lt({},Kl);const ka=lt({},["title","style","font","a","script"]);let ml=null;const ll=["application/xhtml+xml","text/html"],Ft="text/html";let Ke=null,Fn=null;const Ys=i.createElement("form"),Hi=function(N){return N instanceof RegExp||N instanceof Function},Xs=function(){let N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Fn&&Fn===N)return;(!N||typeof N!="object")&&(N={}),N=nl(N),ml=ll.indexOf(N.PARSER_MEDIA_TYPE)===-1?Ft:N.PARSER_MEDIA_TYPE,Ke=ml==="application/xhtml+xml"?ah:Ic,qe=Ds(N,"ALLOWED_TAGS",yt,{transform:Ke}),et=Ds(N,"ALLOWED_ATTR",Je,{transform:Ke}),Sa=Ds(N,"ALLOWED_NAMESPACES",ja,{transform:ah}),xe=Ds(N,"ADD_URI_SAFE_ATTR",Be,{transform:Ke,base:Be}),D=Ds(N,"ADD_DATA_URI_TAGS",J,{transform:Ke,base:J}),Y=Ds(N,"FORBID_CONTENTS",ve,{transform:Ke}),it=Ds(N,"FORBID_TAGS",nl({}),{transform:Ke}),Jn=Ds(N,"FORBID_ATTR",nl({}),{transform:Ke}),E=Dn(N,"USE_PROFILES")?N.USE_PROFILES&&typeof N.USE_PROFILES=="object"?nl(N.USE_PROFILES):N.USE_PROFILES:!1,qt=N.ALLOW_ARIA_ATTR!==!1,Kt=N.ALLOW_DATA_ATTR!==!1,It=N.ALLOW_UNKNOWN_PROTOCOLS||!1,Gt=N.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Qt=N.SAFE_FOR_TEMPLATES||!1,rt=N.SAFE_FOR_XML!==!1,Tt=N.WHOLE_DOCUMENT||!1,An=N.RETURN_DOM||!1,Dt=N.RETURN_DOM_FRAGMENT||!1,fn=N.RETURN_TRUSTED_TYPE||!1,kn=N.FORCE_BODY||!1,Jt=N.SANITIZE_DOM!==!1,Et=N.SANITIZE_NAMED_PROPS||!1,ot=N.KEEP_CONTENT!==!1,tn=N.IN_PLACE||!1,Ot=kv(N.ALLOWED_URI_REGEXP)?N.ALLOWED_URI_REGEXP:Tb,Rt=typeof N.NAMESPACE=="string"?N.NAMESPACE:wn,Hl=Dn(N,"MATHML_TEXT_INTEGRATION_POINTS")&&N.MATHML_TEXT_INTEGRATION_POINTS&&typeof N.MATHML_TEXT_INTEGRATION_POINTS=="object"?nl(N.MATHML_TEXT_INTEGRATION_POINTS):lt({},Gs),hn=Dn(N,"HTML_INTEGRATION_POINTS")&&N.HTML_INTEGRATION_POINTS&&typeof N.HTML_INTEGRATION_POINTS=="object"?nl(N.HTML_INTEGRATION_POINTS):lt({},Kl);const I=Dn(N,"CUSTOM_ELEMENT_HANDLING")&&N.CUSTOM_ELEMENT_HANDLING&&typeof N.CUSTOM_ELEMENT_HANDLING=="object"?nl(N.CUSTOM_ELEMENT_HANDLING):Sr(null);if(Fe=Sr(null),Dn(I,"tagNameCheck")&&Hi(I.tagNameCheck)&&(Fe.tagNameCheck=I.tagNameCheck),Dn(I,"attributeNameCheck")&&Hi(I.attributeNameCheck)&&(Fe.attributeNameCheck=I.attributeNameCheck),Dn(I,"allowCustomizedBuiltInElements")&&typeof I.allowCustomizedBuiltInElements=="boolean"&&(Fe.allowCustomizedBuiltInElements=I.allowCustomizedBuiltInElements),Yn(Fe),Qt&&(Kt=!1),Dt&&(An=!0),E&&(qe=lt({},kb),et=Sr(null),E.html===!0&&(lt(qe,jb),lt(et,Nb)),E.svg===!0&&(lt(qe,sh),lt(et,ch),lt(et,vo)),E.svgFilters===!0&&(lt(qe,ih),lt(et,ch),lt(et,vo)),E.mathMl===!0&&(lt(qe,rh),lt(et,wb),lt(et,vo))),Bt.tagCheck=null,Bt.attributeCheck=null,Dn(N,"ADD_TAGS")&&(typeof N.ADD_TAGS=="function"?Bt.tagCheck=N.ADD_TAGS:Hs(N.ADD_TAGS)&&(qe===yt&&(qe=nl(qe)),lt(qe,N.ADD_TAGS,Ke))),Dn(N,"ADD_ATTR")&&(typeof N.ADD_ATTR=="function"?Bt.attributeCheck=N.ADD_ATTR:Hs(N.ADD_ATTR)&&(et===Je&&(et=nl(et)),lt(et,N.ADD_ATTR,Ke))),Dn(N,"ADD_URI_SAFE_ATTR")&&Hs(N.ADD_URI_SAFE_ATTR)&&lt(xe,N.ADD_URI_SAFE_ATTR,Ke),Dn(N,"FORBID_CONTENTS")&&Hs(N.FORBID_CONTENTS)&&(Y===ve&&(Y=nl(Y)),lt(Y,N.FORBID_CONTENTS,Ke)),Dn(N,"ADD_FORBID_CONTENTS")&&Hs(N.ADD_FORBID_CONTENTS)&&(Y===ve&&(Y=nl(Y)),lt(Y,N.ADD_FORBID_CONTENTS,Ke)),ot&&(qe["#text"]=!0),Tt&&lt(qe,["html","head","body"]),qe.table&&(lt(qe,["tbody"]),delete it.tbody),N.TRUSTED_TYPES_POLICY){if(typeof N.TRUSTED_TYPES_POLICY.createHTML!="function")throw Si('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof N.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Si('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const ce=z;z=N.TRUSTED_TYPES_POLICY;try{A=ae("")}catch(Se){throw z=ce,Se}}else N.TRUSTED_TYPES_POLICY===null?(z=void 0,A=""):(z===void 0&&(z=we()),z&&typeof A=="string"&&(A=ae("")));Gn&&Gn(N),Fn=N},Jl=lt({},[...sh,...ih,...Nv]),Fl=lt({},[...rh,...wv]),Na=function(N,I,ce){return I.namespaceURI===wn?N==="svg":I.namespaceURI===ft?N==="svg"&&(ce==="annotation-xml"||Hl[ce]):!!Jl[N]},Wl=function(N,I,ce){return I.namespaceURI===wn?N==="math":I.namespaceURI===Nn?N==="math"&&hn[ce]:!!Fl[N]},gl=function(N,I,ce){return I.namespaceURI===Nn&&!hn[ce]||I.namespaceURI===ft&&!Hl[ce]?!1:!Fl[N]&&(ka[N]||!Jl[N])},nn=function(N){let I=P(N);(!I||!I.tagName)&&(I={namespaceURI:Rt,tagName:"template"});const ce=Ic(N.tagName),Se=Ic(I.tagName);return Sa[N.namespaceURI]?N.namespaceURI===Nn?Na(ce,I,Se):N.namespaceURI===ft?Wl(ce,I,Se):N.namespaceURI===wn?gl(ce,I,Se):!!(ml==="application/xhtml+xml"&&Sa[N.namespaceURI]):!1},ln=function(N){_r(l.removed,{element:N});try{P(N).removeChild(N)}catch{if(w(N),!P(N))throw Si("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},dt=function(N){Vn(N);const I=B(N);if(I){const Se=[];yr(I,Re=>{_r(Se,Re)}),yr(Se,Re=>{try{w(Re)}catch{}})}const ce=Q(N);if(ce)for(let Se=ce.length-1;Se>=0;--Se){const Re=ce[Se],Oe=Re&&Re.name;if(typeof Oe=="string")try{N.removeAttribute(Oe)}catch{}}},Xn=function(N,I){try{_r(l.removed,{attribute:I.getAttributeNode(N),from:I})}catch{_r(l.removed,{attribute:null,from:I})}if(I.removeAttribute(N),N==="is")if(An||Dt)try{ln(I)}catch{}else try{I.setAttribute(N,"")}catch{}},wa=function(N){const I=Q(N);if(I)for(let ce=I.length-1;ce>=0;--ce){const Se=I[ce],Re=Se&&Se.name;if(!(typeof Re!="string"||et[Ke(Re)]))try{N.removeAttribute(Re)}catch{}}},Vn=function(N){const I=[N];for(;I.length>0;){const ce=I.pop();(k?k(ce):ce.nodeType)===kl.element&&wa(ce);const Re=B(ce);if(Re)for(let Oe=Re.length-1;Oe>=0;--Oe)I.push(Re[Oe])}},$n=function(N){if(!rt)return;const I=[N];for(;I.length>0;){const ce=I.pop(),Se=k?k(ce):ce.nodeType;if(Se===kl.processingInstruction||Se===kl.comment&&On(Ab,ce.data)){try{w(ce)}catch{}continue}if(Se===kl.element){const Oe=ce,gt=Ke(Z?Z(ce):ce.nodeName);try{Oe.hasAttribute&&Oe.hasAttribute("patchsrc")&&Oe.removeAttribute("patchsrc"),Oe.hasAttribute&&Oe.hasAttribute("for")&&gt!=="label"&&gt!=="output"&&Oe.removeAttribute("for")}catch{}}const Re=B(ce);if(Re)for(let Oe=Re.length-1;Oe>=0;--Oe)I.push(Re[Oe])}},al=function(N){let I=null,ce=null;if(kn)N="<remove></remove>"+N;else{const Oe=yb(N,/^[\r\n\t ]+/);ce=Oe&&Oe[0]}ml==="application/xhtml+xml"&&Rt===wn&&(N='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+N+"</body></html>");const Se=z?ae(N):N;if(Rt===wn)try{I=new y().parseFromString(Se,ml)}catch{}if(!I||!I.documentElement){I=H.createDocument(Rt,"template",null);try{I.documentElement.innerHTML=wl?A:Se}catch{}}const Re=I.body||I.documentElement;return N&&ce&&Re.insertBefore(i.createTextNode(ce),Re.childNodes[0]||null),Rt===wn?ue.call(I,Tt?"html":"body")[0]:Tt?I.documentElement:Re},Pl=function(N){return ie.call(N.ownerDocument||N,N,m.SHOW_ELEMENT|m.SHOW_COMMENT|m.SHOW_TEXT|m.SHOW_PROCESSING_INSTRUCTION|m.SHOW_CDATA_SECTION,null)},Wn=function(N){return N=zc(N,K," "),N=zc(N,oe," "),N=zc(N,pe," "),N},Vs=function(N){var I;N.normalize();const ce=ie.call(N.ownerDocument||N,N,m.SHOW_TEXT|m.SHOW_COMMENT|m.SHOW_CDATA_SECTION|m.SHOW_PROCESSING_INSTRUCTION,null);let Se=ce.nextNode();for(;Se;)Se.data=Wn(Se.data),Se=ce.nextNode();const Re=(I=N.querySelectorAll)===null||I===void 0?void 0:I.call(N,"template");Re&&yr(Re,Oe=>{zn(Oe.content)&&Vs(Oe.content)})},Cn=function(N){const I=Z?Z(N):null;return typeof I!="string"||Ke(I)!=="form"?!1:typeof N.nodeName!="string"||typeof N.textContent!="string"||typeof N.removeChild!="function"||N.attributes!==Q(N)||typeof N.removeAttribute!="function"||typeof N.setAttribute!="function"||typeof N.namespaceURI!="string"||typeof N.insertBefore!="function"||typeof N.hasChildNodes!="function"||N.nodeType!==k(N)||N.childNodes!==B(N)},zn=function(N){if(!k||typeof N!="object"||N===null)return!1;try{return k(N)===kl.documentFragment}catch{return!1}},pn=function(N){if(!k||typeof N!="object"||N===null)return!1;try{return typeof k(N)=="number"}catch{return!1}};function _t(he,N,I){he.length!==0&&yr(he,ce=>{ce.call(l,N,I,Fn)})}const Ta=function(N,I){return!!(rt&&N.hasChildNodes()&&!pn(N.firstElementChild)&&On(Eb,N.textContent)&&On(Eb,N.innerHTML)||rt&&N.namespaceURI===wn&&I==="style"&&pn(N.firstElementChild)||N.nodeType===kl.processingInstruction||rt&&N.nodeType===kl.comment&&On(Ab,N.data))},Hr=function(N,I){if(!it[I]&&Aa(I)&&(Fe.tagNameCheck instanceof RegExp&&On(Fe.tagNameCheck,I)||Fe.tagNameCheck instanceof Function&&Fe.tagNameCheck(I)))return!1;if(ot&&!Y[I]){const ce=P(N),Se=B(N);if(Se&&ce){const Re=Se.length;for(let Oe=Re-1;Oe>=0;--Oe){const gt=tn?Se[Oe]:R(Se[Oe],!0);ce.insertBefore(gt,L(N))}}}return ln(N),!0},ea=function(N,I){if(_t(T.beforeSanitizeElements,N,null),N!==I&&P(N)===null)return!0;if(Cn(N))return ln(N),!0;const ce=Ke(Z?Z(N):N.nodeName);if(_t(T.uponSanitizeElement,N,{tagName:ce,allowedTags:qe}),N!==I&&P(N)===null)return!0;if(Ta(N,ce))return ln(N),!0;if(it[ce]||!(Bt.tagCheck instanceof Function&&Bt.tagCheck(ce))&&!qe[ce]){const Re=Hr(N,ce);return Re===!1&&_t(T.afterSanitizeElements,N,null),Re}if((k?k(N):N.nodeType)===kl.element&&!nn(N)||(ce==="noscript"||ce==="noembed"||ce==="noframes")&&On(Lv,N.innerHTML))return ln(N),!0;if(Qt&&N.nodeType===kl.text){const Re=Wn(N.textContent);N.textContent!==Re&&(_r(l.removed,{element:N.cloneNode()}),N.textContent=Re)}return _t(T.afterSanitizeElements,N,null),!1},ta=function(N,I,ce){if(Jn[I]||rt&&I==="patchsrc"||rt&&I==="for"&&N!=="label"&&N!=="output"||Jt&&(I==="id"||I==="name")&&(ce in i||ce in Ys))return!1;const Se=et[I]||Bt.attributeCheck instanceof Function&&Bt.attributeCheck(I,N);if(!(Kt&&On(Ne,I))){if(!(qt&&On(ye,I))){if(Se){if(!xe[I]){if(!On(Ot,zc(ce,st,""))){if(!((I==="src"||I==="xlink:href"||I==="href")&&N!=="script"&&_b(ce,"data:")===0&&D[N])){if(!(It&&!On(Ae,zc(ce,st,"")))){if(ce)return!1}}}}}else if(!(Aa(N)&&(Fe.tagNameCheck instanceof RegExp&&On(Fe.tagNameCheck,N)||Fe.tagNameCheck instanceof Function&&Fe.tagNameCheck(N))&&(Fe.attributeNameCheck instanceof RegExp&&On(Fe.attributeNameCheck,I)||Fe.attributeNameCheck instanceof Function&&Fe.attributeNameCheck(I,N))||I==="is"&&Fe.allowCustomizedBuiltInElements&&(Fe.tagNameCheck instanceof RegExp&&On(Fe.tagNameCheck,ce)||Fe.tagNameCheck instanceof Function&&Fe.tagNameCheck(ce))))return!1}}return!0},Ea=lt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Aa=function(N){return!Ea[Ic(N)]&&On(Qe,N)},Ln=function(N,I,ce,Se){if(z&&typeof j=="object"&&typeof j.getAttributeType=="function"&&!ce)switch(j.getAttributeType(N,I)){case"TrustedHTML":return ae(Se);case"TrustedScriptURL":return me(Se)}return Se},bl=function(N,I,ce,Se){try{ce?N.setAttributeNS(ce,I,Se):N.setAttribute(I,Se),Cn(N)?ln(N):xb(l.removed)}catch{Xn(I,N)}},Bl=function(N){_t(T.beforeSanitizeAttributes,N,null);const I=N.attributes;if(!I||Cn(N))return;const ce={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:et,forceKeepAttr:void 0};let Se=I.length;const Re=Ke(N.nodeName);for(;Se--;){const Oe=I[Se],gt=Oe.name,mn=Oe.namespaceURI,an=Oe.value,Mt=Ke(gt),gn=an;let Yt=gt==="value"?gn:xv(gn);if(ce.attrName=Mt,ce.attrValue=Yt,ce.keepAttr=!0,ce.forceKeepAttr=void 0,_t(T.uponSanitizeAttribute,N,ce),Yt=ce.attrValue,Et&&(Mt==="id"||Mt==="name")&&_b(Yt,dn)!==0&&(Xn(gt,N),Yt=dn+Yt),rt&&On(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Yt)){Xn(gt,N);continue}if(Mt==="attributename"&&yb(Yt,"href")){Xn(gt,N);continue}if(!ce.forceKeepAttr){if(!ce.keepAttr){Xn(gt,N);continue}if(!Gt&&On(Uv,Yt)){Xn(gt,N);continue}if(Qt&&(Yt=Wn(Yt)),!ta(Re,Mt,Yt)){Xn(gt,N);continue}Yt=Ln(Re,Mt,mn,Yt),Yt!==gn&&bl(N,gt,mn,Yt)}}_t(T.afterSanitizeAttributes,N,null)},na=function(N){let I=null;const ce=Pl(N);for(_t(T.beforeSanitizeShadowDOM,N,null);I=ce.nextNode();)if(_t(T.uponSanitizeShadowNode,I,null),ea(I,N),Bl(I),zn(I.content)&&na(I.content),(k?k(I):I.nodeType)===kl.element){const Re=M(I);zn(Re)&&(sl(Re),na(Re))}_t(T.afterSanitizeShadowDOM,N,null)},sl=function(N){const I=[{node:N,shadow:null}];for(;I.length>0;){const ce=I.pop();if(ce.shadow){na(ce.shadow);continue}const Se=ce.node,Oe=(k?k(Se):Se.nodeType)===kl.element,gt=B(Se);if(gt)for(let mn=gt.length-1;mn>=0;--mn)I.push({node:gt[mn],shadow:null});if(Oe){const mn=Z?Z(Se):null;if(typeof mn=="string"&&Ke(mn)==="template"){const an=Se.content;zn(an)&&I.push({node:an,shadow:null})}}if(Oe){const mn=M(Se);zn(mn)&&I.push({node:null,shadow:mn},{node:mn,shadow:null})}}};return l.sanitize=function(he){let N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},I=null,ce=null,Se=null,Re=null;if(wl=!he,wl&&(he="<!-->"),typeof he!="string"&&!pn(he)&&(he=jv(he),typeof he!="string"))throw Si("dirty is not a string, aborting");if(!l.isSupported)return he;en?(qe=En,et=Ct):Xs(N),(T.uponSanitizeElement.length>0||T.uponSanitizeAttribute.length>0)&&(qe=nl(qe)),T.uponSanitizeAttribute.length>0&&(et=nl(et)),l.removed=[];const Oe=tn&&typeof he!="string"&&pn(he);if(Oe){$n(he);const Mt=Z?Z(he):he.nodeName;if(typeof Mt=="string"){const gn=Ke(Mt);if(!qe[gn]||it[gn])throw dt(he),Si("root node is forbidden and cannot be sanitized in-place")}if(Cn(he))throw dt(he),Si("root node is clobbered and cannot be sanitized in-place");try{sl(he)}catch(gn){throw dt(he),gn}}else if(pn(he))I=al("<!---->"),ce=I.ownerDocument.importNode(he,!0),ce.nodeType===kl.element&&ce.nodeName==="BODY"||ce.nodeName==="HTML"?I=ce:I.appendChild(ce),sl(ce);else{if(!An&&!Qt&&!Tt&&he.indexOf("<")===-1)return z&&fn?ae(he):he;if(I=al(he),!I)return An?null:fn?A:""}I&&kn&&ln(I.firstChild);const gt=Oe?he:I,mn=Pl(gt);try{for(;Se=mn.nextNode();)ea(Se,gt),Bl(Se),zn(Se.content)&&na(Se.content)}catch(Mt){throw Oe&&(dt(he),yr(l.removed,gn=>{gn.element&&Vn(gn.element)})),Mt}if(Oe)return yr(l.removed,Mt=>{Mt.element&&Vn(Mt.element)}),Qt&&Vs(he),he;if(An){if(Qt&&Vs(I),Dt)for(Re=re.call(I.ownerDocument);I.firstChild;)Re.appendChild(I.firstChild);else Re=I;return(et.shadowroot||et.shadowrootmode)&&(Re=_e.call(c,Re,!0)),Re}let an=Tt?I.outerHTML:I.innerHTML;return Tt&&qe["!doctype"]&&I.ownerDocument&&I.ownerDocument.doctype&&I.ownerDocument.doctype.name&&On(Dv,I.ownerDocument.doctype.name)&&(an="<!DOCTYPE "+I.ownerDocument.doctype.name+`>
115
115
  `+an),Qt&&(an=Wn(an)),z&&fn?ae(an):an},l.setConfig=function(){let he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Xs(he),en=!0,En=qe,Ct=et},l.clearConfig=function(){Fn=null,en=!1,En=null,Ct=null,z=V,A=""},l.isValidAttribute=function(he,N,I){Fn||Xs({});const ce=Ke(he),Se=Ke(N);return ta(ce,Se,I)},l.addHook=function(he,N){typeof N=="function"&&Dn(T,he)&&_r(T[he],N)},l.removeHook=function(he,N){if(Dn(T,he)){if(N!==void 0){const I=gv(T[he],N);return I===-1?void 0:bv(T[he],I,1)[0]}return xb(T[he])}},l.removeHooks=function(he){Dn(T,he)&&(T[he]=[])},l.removeAllHooks=function(){T=Cb()},l}var qv=Qx();const Iv=1024;let Gv=0;class Ul{constructor(l,i){this.from=l,this.to=i}}class Ht{constructor(l={}){this.id=Gv++,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=Zl.match(l)),i=>{let c=l(i);return c===void 0?null:[this,c]}}}Ht.closedBy=new Ht({deserialize:a=>a.split(" ")});Ht.openedBy=new Ht({deserialize:a=>a.split(" ")});Ht.group=new Ht({deserialize:a=>a.split(" ")});Ht.isolate=new Ht({deserialize:a=>{if(a&&a!="rtl"&&a!="ltr"&&a!="auto")throw new RangeError("Invalid value for isolate: "+a);return a||"auto"}});Ht.contextHash=new Ht({perNode:!0});Ht.lookAhead=new Ht({perNode:!0});Ht.mounted=new Ht({perNode:!0});class Nr{constructor(l,i,c,o=!1){this.tree=l,this.overlay=i,this.parser=c,this.bracketed=o}static get(l){return l&&l.props&&l.props[Ht.mounted.id]}}const Yv=Object.create(null);class Zl{constructor(l,i,c,o=0){this.name=l,this.props=i,this.id=c,this.flags=o}static define(l){let i=l.props&&l.props.length?Object.create(null):Yv,c=(l.top?1:0)|(l.skipped?2:0)|(l.error?4:0)|(l.name==null?8:0),o=new Zl(l.name||"",i,l.id,c);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 c in l)for(let o of c.split(" "))i[o]=l[c];return c=>{for(let o=c.prop(Ht.group),d=-1;d<(o?o.length:0);d++){let h=i[d<0?c.name:o[d]];if(h)return h}}}}Zl.none=new Zl("",Object.create(null),0,8);class Zx{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 c of this.types){let o=null;for(let d of l){let h=d(c);if(h){o||(o=Object.assign({},c.props));let p=h[1],m=h[0];m.combine&&m.id in o&&(p=m.combine(o[m.id],p)),o[m.id]=p}}i.push(o?new Zl(c.name,o,c.id,c.flags):c)}return new Zx(i)}}const So=new WeakMap,Rb=new WeakMap;var Lt;(function(a){a[a.ExcludeBuffers=1]="ExcludeBuffers",a[a.IncludeAnonymous=2]="IncludeAnonymous",a[a.IgnoreMounts=4]="IgnoreMounts",a[a.IgnoreOverlays=8]="IgnoreOverlays",a[a.EnterBracketed=16]="EnterBracketed"})(Lt||(Lt={}));class pl{constructor(l,i,c,o,d){if(this.type=l,this.children=i,this.positions=c,this.length=o,this.props=null,d&&d.length){this.props=Object.create(null);for(let[h,p]of d)this.props[typeof h=="number"?h:h.id]=p}}toString(){let l=Nr.get(this);if(l&&!l.overlay)return l.tree.toString();let i="";for(let c of this.children){let o=c.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 Bo(this.topNode,l)}cursorAt(l,i=0,c=0){let o=So.get(this)||this.topNode,d=new Bo(o);return d.moveTo(l,i),So.set(this,d._tree),d}get topNode(){return new Kn(this,0,0,null)}resolve(l,i=0){let c=Vc(So.get(this)||this.topNode,l,i,!1);return So.set(this,c),c}resolveInner(l,i=0){let c=Vc(Rb.get(this)||this.topNode,l,i,!0);return Rb.set(this,c),c}resolveStack(l,i=0){return $v(this,l,i)}iterate(l){let{enter:i,leave:c,from:o=0,to:d=this.length}=l,h=l.mode||0,p=(h&Lt.IncludeAnonymous)>0;for(let m=this.cursor(h|Lt.IncludeAnonymous);;){let x=!1;if(m.from<=d&&m.to>=o&&(!p&&m.type.isAnonymous||i(m)!==!1)){if(m.firstChild())continue;x=!0}for(;x&&c&&(p||!m.type.isAnonymous)&&c(m),!m.nextSibling();){if(!m.parent())return;x=!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:Vh(Zl.none,this.children,this.positions,0,this.children.length,0,this.length,(i,c,o)=>new pl(this.type,i,c,o,this.propValues),l.makeTree||((i,c,o)=>new pl(Zl.none,i,c,o)))}static build(l){return Qv(l)}}pl.empty=new pl(Zl.none,[],[],0);class Yh{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 Yh(this.buffer,this.index)}}class Is{constructor(l,i,c){this.buffer=l,this.length=i,this.set=c}get type(){return Zl.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],c=this.buffer[l+3],o=this.set.types[i],d=o.name;if(/\W/.test(d)&&!o.isError&&(d=JSON.stringify(d)),l+=4,c==l)return d;let h=[];for(;l<c;)h.push(this.childString(l)),l=this.buffer[l+3];return d+"("+h.join(",")+")"}findChild(l,i,c,o,d){let{buffer:h}=this,p=-1;for(let m=l;m!=i&&!(Kx(d,o,h[m+1],h[m+2])&&(p=m,c>0));m=h[m+3]);return p}slice(l,i,c){let o=this.buffer,d=new Uint16Array(i-l),h=0;for(let p=l,m=0;p<i;){d[m++]=o[p++],d[m++]=o[p++]-c;let x=d[m++]=o[p++]-c;d[m++]=o[p++]-l,h=Math.max(h,x)}return new Is(d,h,this.set)}}function Kx(a,l,i,c){switch(a){case-2:return i<l;case-1:return c>=l&&i<l;case 0:return i<l&&c>l;case 1:return i<=l&&c>l;case 2:return c>l;case 4:return!0}}function Vc(a,l,i,c){for(var o;a.from==a.to||(i<1?a.from>=l:a.from>l)||(i>-1?a.to<=l:a.to<l);){let h=!c&&a instanceof Kn&&a.index<0?null:a.parent;if(!h)return a;a=h}let d=c?0:Lt.IgnoreOverlays;if(c)for(let h=a,p=h.parent;p;h=p,p=h.parent)h instanceof Kn&&h.index<0&&((o=p.enter(l,i,d))===null||o===void 0?void 0:o.from)!=h.from&&(a=p);for(;;){let h=a.enter(l,i,d);if(!h)return a;a=h}}class Jx{cursor(l=0){return new Bo(this,l)}getChild(l,i=null,c=null){let o=Mb(this,l,i,c);return o.length?o[0]:null}getChildren(l,i=null,c=null){return Mb(this,l,i,c)}resolve(l,i=0){return Vc(this,l,i,!1)}resolveInner(l,i=0){return Vc(this,l,i,!0)}matchContext(l){return Eh(this.parent,l)}enterUnfinishedNodesBefore(l){let i=this.childBefore(l),c=this;for(;i;){let o=i.lastChild;if(!o||o.to!=i.to)break;o.type.isError&&o.from==o.to?(c=i,i=o.prevSibling):i=o}return c}get node(){return this}get next(){return this.parent}}class Kn extends Jx{constructor(l,i,c,o){super(),this._tree=l,this.from=i,this.index=c,this._parent=o}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(l,i,c,o,d=0){for(let h=this;;){for(let{children:p,positions:m}=h._tree,x=i>0?p.length:-1;l!=x;l+=i){let y=p[l],j=m[l]+h.from,v;if(!(!(d&Lt.EnterBracketed&&y instanceof pl&&(v=Nr.get(y))&&!v.overlay&&v.bracketed&&c>=j&&c<=j+y.length)&&!Kx(o,c,j,j+y.length))){if(y instanceof Is){if(d&Lt.ExcludeBuffers)continue;let R=y.findChild(0,y.buffer.length,i,c-j,o);if(R>-1)return new va(new Xv(h,y,l,j),null,R)}else if(d&Lt.IncludeAnonymous||!y.type.isAnonymous||Xh(y)){let R;if(!(d&Lt.IgnoreMounts)&&(R=Nr.get(y))&&!R.overlay)return new Kn(R.tree,j,l,h);let w=new Kn(y,j,l,h);return d&Lt.IncludeAnonymous||!w.type.isAnonymous?w:w.nextChild(i<0?y.children.length-1:0,i,c,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,c=0){let o;if(!(c&Lt.IgnoreOverlays)&&(o=Nr.get(this._tree))&&o.overlay){let d=l-this.from,h=c&Lt.EnterBracketed&&o.bracketed;for(let{from:p,to:m}of o.overlay)if((i>0||h?p<=d:p<d)&&(i<0||h?m>=d:m>d))return new Kn(o.tree,o.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,l,i,c)}nextSignificantParent(){let l=this;for(;l.type.isAnonymous&&l._parent;)l=l._parent;return l}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Mb(a,l,i,c){let o=a.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(c!=null&&o.type.is(c))return d;if(o.type.is(l)&&d.push(o.node),!o.nextSibling())return c==null?d:[]}}function Eh(a,l,i=l.length-1){for(let c=a;i>=0;c=c.parent){if(!c)return!1;if(!c.type.isAnonymous){if(l[i]&&l[i]!=c.name)return!1;i--}}return!0}class Xv{constructor(l,i,c,o){this.parent=l,this.buffer=i,this.index=c,this.start=o}}class va extends Jx{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,c){super(),this.context=l,this._parent=i,this.index=c,this.type=l.buffer.set.types[l.buffer.buffer[c]]}child(l,i,c){let{buffer:o}=this.context,d=o.findChild(this.index+4,o.buffer[this.index+3],l,i-this.context.start,c);return d<0?null:new va(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,c=0){if(c&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 va(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 va(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 va(this.context,this._parent,l.findChild(i,this.index,-1,0,4))}get tree(){return null}toTree(){let l=[],i=[],{buffer:c}=this.context,o=this.index+4,d=c.buffer[this.index+3];if(d>o){let h=c.buffer[this.index+1];l.push(c.slice(o,d,h)),i.push(0)}return new pl(this.type,l,i,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Fx(a){if(!a.length)return null;let l=0,i=a[0];for(let d=1;d<a.length;d++){let h=a[d];(h.from>i.from||h.to<i.to)&&(i=h,l=d)}let c=i instanceof Kn&&i.index<0?null:i.parent,o=a.slice();return c?o[l]=c:o.splice(l,1),new Vv(o,i)}class Vv{constructor(l,i){this.heads=l,this.node=i}get next(){return Fx(this.heads)}}function $v(a,l,i){let c=a.resolveInner(l,i),o=null;for(let d=c instanceof Kn?c:c.context.parent;d;d=d.parent)if(d.index<0){let h=d.parent;(o||(o=[c])).push(h.resolve(l,i)),d=h}else{let h=Nr.get(d.tree);if(h&&h.overlay&&h.overlay[0].from<=l&&h.overlay[h.overlay.length-1].to>=l){let p=new Kn(h.tree,h.overlay[0].from+d.from,-1,d);(o||(o=[c])).push(Vc(p,l,i,!1))}}return o?Fx(o):c}class Bo{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 Kn)this.yieldNode(l);else{this._tree=l.context.parent,this.buffer=l.context;for(let c=l._parent;c;c=c._parent)this.stack.unshift(c.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:c,buffer:o}=this.buffer;return this.type=i||o.set.types[o.buffer[l]],this.from=c+o.buffer[l+1],this.to=c+o.buffer[l+2],!0}yield(l){return l?l instanceof Kn?(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,c){if(!this.buffer)return this.yield(this._tree.nextChild(l<0?this._tree._tree.children.length-1:0,l,i,c,this.mode));let{buffer:o}=this.buffer,d=o.findChild(this.index+4,o.buffer[this.index+3],l,i-this.buffer.start,c);return d<0?!1:(this.stack.push(this.index),this.yieldBuf(d))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(l){return this.enterChild(1,l,2)}childBefore(l){return this.enterChild(-1,l,-2)}enter(l,i,c=this.mode){return this.buffer?c&Lt.ExcludeBuffers?!1:this.enterChild(1,l,i):this.yield(this._tree.enter(l,i,c))}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,c=this.stack.length-1;if(l<0){let o=c<0?0:this.stack[c]+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<(c<0?i.buffer.length:i.buffer[this.stack[c]+3]))return this.yieldBuf(o)}return c<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,c,{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:c}=o)}else({index:i,_parent:c}=this._tree);for(;c;{index:i,_parent:c}=c)if(i>-1)for(let d=i+l,h=l<0?-1:c._tree.children.length;d!=h;d+=l){let p=c._tree.children[d];if(this.mode&Lt.IncludeAnonymous||p instanceof Is||!p.type.isAnonymous||Xh(p))return!1}return!0}move(l,i){if(i&&this.enterChild(l,0,4))return!0;for(;;){if(this.sibling(l))return!0;if(this.atLastNode(l)||!this.parent())return!1}}next(l=!0){return this.move(1,l)}prev(l=!0){return this.move(-1,l)}moveTo(l,i=0){for(;(this.from==this.to||(i<1?this.from>=l:this.from>l)||(i>-1?this.to<=l:this.to<l))&&this.parent(););for(;this.enterChild(1,l,i););return this}get node(){if(!this.buffer)return this._tree;let l=this.bufferNode,i=null,c=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,c=d+1;break e}o=this.stack[--d]}for(let o=c;o<this.stack.length;o++)i=new va(this.buffer,i,this.stack[o]);return this.bufferNode=new va(this.buffer,i,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(l,i){for(let c=0;;){let o=!1;if(this.type.isAnonymous||l(this)!==!1){if(this.firstChild()){c++;continue}this.type.isAnonymous||(o=!0)}for(;;){if(o&&i&&i(this),o=this.type.isAnonymous,!c)return;if(this.nextSibling())break;this.parent(),c--,o=!0}}}matchContext(l){if(!this.buffer)return Eh(this.node.parent,l);let{buffer:i}=this.buffer,{types:c}=i.set;for(let o=l.length-1,d=this.stack.length-1;o>=0;d--){if(d<0)return Eh(this._tree,l,o);let h=c[i.buffer[this.stack[d]]];if(!h.isAnonymous){if(l[o]&&l[o]!=h.name)return!1;o--}}return!0}}function Xh(a){return a.children.some(l=>l instanceof Is||!l.type.isAnonymous||Xh(l))}function Qv(a){var l;let{buffer:i,nodeSet:c,maxBufferLength:o=Iv,reused:d=[],minRepeatType:h=c.types.length}=a,p=Array.isArray(i)?new Yh(i,i.length):i,m=c.types,x=0,y=0;function j(Z,z,A,V,te,fe){let{id:F,start:ae,end:me,size:we}=p,ge=y,H=x;if(we<0)if(p.next(),we==-1){let T=d[F];A.push(T),V.push(ae-Z);return}else if(we==-3){x=F;return}else if(we==-4){y=F;return}else throw new RangeError(`Unrecognized record size: ${we}`);let ie=m[F],re,ue,_e=ae-Z;if(me-ae<=o&&(ue=B(p.pos-z,te))){let T=new Uint16Array(ue.size-ue.skip),K=p.pos-ue.size,oe=T.length;for(;p.pos>K;)oe=P(ue.start,T,oe);re=new Is(T,me-ue.start,c),_e=ue.start-Z}else{let T=p.pos-we;p.next();let K=[],oe=[],pe=F>=h?F:-1,Ne=0,ye=me;for(;p.pos>T;)pe>=0&&p.id==pe&&p.size>=0?(p.end<=ye-o&&(w(K,oe,ae,Ne,p.end,ye,pe,ge,H),Ne=K.length,ye=p.end),p.next()):fe>2500?v(ae,T,K,oe):j(ae,T,K,oe,pe,fe+1);if(pe>=0&&Ne>0&&Ne<K.length&&w(K,oe,ae,Ne,ae,ye,pe,ge,H),K.reverse(),oe.reverse(),pe>-1&&Ne>0){let Ae=R(ie,H);re=Vh(ie,K,oe,0,K.length,0,me-ae,Ae,Ae)}else re=L(ie,K,oe,me-ae,ge-me,H)}A.push(re),V.push(_e)}function v(Z,z,A,V){let te=[],fe=0,F=-1;for(;p.pos>z;){let{id:ae,start:me,end:we,size:ge}=p;if(ge>4)p.next();else{if(F>-1&&me<F)break;F<0&&(F=we-o),te.push(ae,me,we),fe++,p.next()}}if(fe){let ae=new Uint16Array(fe*4),me=te[te.length-2];for(let we=te.length-3,ge=0;we>=0;we-=3)ae[ge++]=te[we],ae[ge++]=te[we+1]-me,ae[ge++]=te[we+2]-me,ae[ge++]=ge;A.push(new Is(ae,te[2]-me,c)),V.push(me-Z)}}function R(Z,z){return(A,V,te)=>{let fe=0,F=A.length-1,ae,me;if(F>=0&&(ae=A[F])instanceof pl){if(!F&&ae.type==Z&&ae.length==te)return ae;(me=ae.prop(Ht.lookAhead))&&(fe=V[F]+ae.length+me)}return L(Z,A,V,te,fe,z)}}function w(Z,z,A,V,te,fe,F,ae,me){let we=[],ge=[];for(;Z.length>V;)we.push(Z.pop()),ge.push(z.pop()+A-te);Z.push(L(c.types[F],we,ge,fe-te,ae-fe,me)),z.push(te-A)}function L(Z,z,A,V,te,fe,F){if(fe){let ae=[Ht.contextHash,fe];F=F?[ae].concat(F):[ae]}if(te>25){let ae=[Ht.lookAhead,te];F=F?[ae].concat(F):[ae]}return new pl(Z,z,A,V,F)}function B(Z,z){let A=p.fork(),V=0,te=0,fe=0,F=A.end-o,ae={size:0,start:0,skip:0};e:for(let me=A.pos-Z;A.pos>me;){let we=A.size;if(A.id==z&&we>=0){ae.size=V,ae.start=te,ae.skip=fe,fe+=4,V+=4,A.next();continue}let ge=A.pos-we;if(we<0||ge<me||A.start<F)break;let H=A.id>=h?4:0,ie=A.start;for(A.next();A.pos>ge;){if(A.size<0)if(A.size==-3||A.size==-4)H+=4;else break e;else A.id>=h&&(H+=4);A.next()}te=ie,V+=we,fe+=H}return(z<0||V==Z)&&(ae.size=V,ae.start=te,ae.skip=fe),ae.size>4?ae:void 0}function P(Z,z,A){let{id:V,start:te,end:fe,size:F}=p;if(p.next(),F>=0&&V<h){let ae=A;if(F>4){let me=p.pos-(F-4);for(;p.pos>me;)A=P(Z,z,A)}z[--A]=ae,z[--A]=fe-Z,z[--A]=te-Z,z[--A]=V}else F==-3?x=V:F==-4&&(y=V);return A}let M=[],Q=[];for(;p.pos>0;)j(a.start||0,a.bufferStart||0,M,Q,-1,0);let k=(l=a.length)!==null&&l!==void 0?l:M.length?Q[0]+M[0].length:0;return new pl(m[a.topID],M.reverse(),Q.reverse(),k)}const Ob=new WeakMap;function zo(a,l){if(!a.isAnonymous||l instanceof Is||l.type!=a)return 1;let i=Ob.get(l);if(i==null){i=1;for(let c of l.children){if(c.type!=a||!(c instanceof pl)){i=1;break}i+=zo(a,c)}Ob.set(l,i)}return i}function Vh(a,l,i,c,o,d,h,p,m){let x=0;for(let w=c;w<o;w++)x+=zo(a,l[w]);let y=Math.ceil(x*1.5/8),j=[],v=[];function R(w,L,B,P,M){for(let Q=B;Q<P;){let k=Q,Z=L[Q],z=zo(a,w[Q]);for(Q++;Q<P;Q++){let A=zo(a,w[Q]);if(z+A>=y)break;z+=A}if(Q==k+1){if(z>y){let A=w[k];R(A.children,A.positions,0,A.children.length,L[k]+M);continue}j.push(w[k])}else{let A=L[Q-1]+w[Q-1].length-Z;j.push(Vh(a,w,L,k,Q,Z,A,null,m))}v.push(Z+M-d)}}return R(l,i,c,o,0),(p||m)(j,v,h)}class nN{constructor(){this.map=new WeakMap}setBuffer(l,i,c){let o=this.map.get(l);o||this.map.set(l,o=new Map),o.set(i,c)}getBuffer(l,i){let c=this.map.get(l);return c&&c.get(i)}set(l,i){l instanceof va?this.setBuffer(l.context.buffer,l.index,i):l instanceof Kn&&this.map.set(l.tree,i)}get(l){return l instanceof va?this.getBuffer(l.context.buffer,l.index):l instanceof Kn?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 $c{constructor(l,i,c,o,d=!1,h=!1){this.from=l,this.to=i,this.tree=c,this.offset=o,this.open=(d?1:0)|(h?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(l,i=[],c=!1){let o=[new $c(0,l.length,l,0,!1,c)];for(let d of i)d.to>l.length&&o.push(d);return o}static applyChanges(l,i,c=128){if(!i.length)return l;let o=[],d=1,h=l.length?l[0]:null;for(let p=0,m=0,x=0;;p++){let y=p<i.length?i[p]:null,j=y?y.fromA:1e9;if(j-m>=c)for(;h&&h.from<j;){let v=h;if(m>=v.from||j<=v.to||x){let R=Math.max(v.from,m)-x,w=Math.min(v.to,j)-x;v=R>=w?null:new $c(R,w,v.tree,v.offset+x,p>0,!!y)}if(v&&o.push(v),h.to>j)break;h=d<l.length?l[d++]:null}if(!y)break;m=y.toA,x=y.toA-y.toB}return o}}class lN{startParse(l,i,c){return typeof l=="string"&&(l=new Zv(l)),c=c?c.length?c.map(o=>new Ul(o.from,o.to)):[new Ul(0,0)]:[new Ul(0,l.length)],this.createParse(l,i||[],c)}parse(l,i,c){let o=this.startParse(l,i,c);for(;;){let d=o.advance();if(d)return d}}}class Zv{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 aN(a){return(l,i,c,o)=>new Jv(l,a,i,c,o)}class Db{constructor(l,i,c,o,d,h){this.parser=l,this.parse=i,this.overlay=c,this.bracketed=o,this.target=d,this.from=h}}function zb(a){if(!a.length||a.some(l=>l.from>=l.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(a))}class Kv{constructor(l,i,c,o,d,h,p,m){this.parser=l,this.predicate=i,this.mounts=c,this.index=o,this.start=d,this.bracketed=h,this.target=p,this.prev=m,this.depth=0,this.ranges=[]}}const Ah=new Ht({perNode:!0});class Jv{constructor(l,i,c,o,d){this.nest=i,this.input=c,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 c=this.baseParse.advance();if(!c)return null;if(this.baseParse=null,this.baseTree=c,this.startInner(),this.stoppedAt!=null)for(let o of this.inner)o.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let c=this.baseTree;return this.stoppedAt!=null&&(c=new pl(c.type,c.children,c.positions,c.length,c.propValues.concat([[Ah,this.stoppedAt]]))),c}let l=this.inner[this.innerDone],i=l.parse.advance();if(i){this.innerDone++;let c=Object.assign(Object.create(null),l.target.props);c[Ht.mounted.id]=new Nr(i,l.overlay,l.parser,l.bracketed),l.target.props=c}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 Pv(this.fragments),i=null,c=null,o=new Bo(new Kn(this.baseTree,this.ranges[0].from,0,null),Lt.IncludeAnonymous|Lt.IgnoreMounts);e:for(let d,h;;){let p=!0,m;if(this.stoppedAt!=null&&o.from>=this.stoppedAt)p=!1;else if(l.hasNode(o)){if(i){let x=i.mounts.find(y=>y.frag.from<=o.from&&y.frag.to>=o.to&&y.mount.overlay);if(x)for(let y of x.mount.overlay){let j=y.from+x.pos,v=y.to+x.pos;j>=o.from&&v<=o.to&&!i.ranges.some(R=>R.from<v&&R.to>j)&&i.ranges.push({from:j,to:v})}}p=!1}else if(c&&(h=Fv(c.ranges,o.from,o.to)))p=h!=2;else if(!o.type.isAnonymous&&(d=this.nest(o,this.input))&&(o.from<o.to||!d.overlay)){o.tree||(Wv(o),i&&i.depth++,c&&c.depth++);let x=l.findMounts(o.from,d.parser);if(typeof d.overlay=="function")i=new Kv(d.parser,d.overlay,x,this.inner.length,o.from,!!d.bracketed,o.tree,i);else{let y=Hb(this.ranges,d.overlay||(o.from<o.to?[new Ul(o.from,o.to)]:[]));y.length&&zb(y),(y.length||!d.overlay)&&this.inner.push(new Db(d.parser,y.length?d.parser.startParse(this.input,Bb(x,y),y):d.parser.startParse(""),d.overlay?d.overlay.map(j=>new Ul(j.from-o.from,j.to-o.from)):null,!!d.bracketed,o.tree,y.length?y[0].from:o.from)),d.overlay?y.length&&(c={ranges:y,depth:0,prev:c}):p=!1}}else if(i&&(m=i.predicate(o))&&(m===!0&&(m=new Ul(o.from,o.to)),m.from<m.to)){let x=i.ranges.length-1;x>=0&&i.ranges[x].to==m.from?i.ranges[x]={from:i.ranges[x].from,to:m.to}:i.ranges.push(m)}if(p&&o.firstChild())i&&i.depth++,c&&c.depth++;else for(;!o.nextSibling();){if(!o.parent())break e;if(i&&!--i.depth){let x=Hb(this.ranges,i.ranges);x.length&&(zb(x),this.inner.splice(i.index,0,new Db(i.parser,i.parser.startParse(this.input,Bb(i.mounts,x),x),i.ranges.map(y=>new Ul(y.from-i.start,y.to-i.start)),i.bracketed,i.target,x[0].from))),i=i.prev}c&&!--c.depth&&(c=c.prev)}}}}function Fv(a,l,i){for(let c of a){if(c.from>=i)break;if(c.to>l)return c.from<=l&&c.to>=i?2:1}return 0}function Lb(a,l,i,c,o,d){if(l<i){let h=a.buffer[l+1];c.push(a.slice(l,i,h)),o.push(h-d)}}function Wv(a){let{node:l}=a,i=[],c=l.context.buffer;do i.push(a.index),a.parent();while(!a.tree);let o=a.tree,d=o.children.indexOf(c),h=o.children[d],p=h.buffer,m=[d];function x(y,j,v,R,w,L){let B=i[L],P=[],M=[];Lb(h,y,B,P,M,R);let Q=p[B+1],k=p[B+2];m.push(P.length);let Z=L?x(B+4,p[B+3],h.set.types[p[B]],Q,k-Q,L-1):l.toTree();return P.push(Z),M.push(Q-R),Lb(h,p[B+3],j,P,M,R),new pl(v,P,M,w)}o.children[d]=x(0,p.length,Zl.none,0,h.length,i.length-1);for(let y of m){let j=a.tree.children[y],v=a.tree.positions[y];a.yield(new Kn(j,v+a.from,y,a._tree))}}class Ub{constructor(l,i){this.offset=i,this.done=!1,this.cursor=l.cursor(Lt.IncludeAnonymous|Lt.IgnoreMounts)}moveTo(l){let{cursor:i}=this,c=l-this.offset;for(;!this.done&&i.from<c;)if(!(i.to>=l&&i.enter(c,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 pl)i=i.children[0];else break}return!1}}class Pv{constructor(l){var i;if(this.fragments=l,this.curTo=0,this.fragI=0,l.length){let c=this.curFrag=l[0];this.curTo=(i=c.tree.prop(Ah))!==null&&i!==void 0?i:c.to,this.inner=new Ub(c.tree,-c.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(Ah))!==null&&l!==void 0?l:i.to,this.inner=new Ub(i.tree,-i.offset)}}findMounts(l,i){var c;let o=[];if(this.inner){this.inner.cursor.moveTo(l,1);for(let d=this.inner.cursor.node;d;d=d.parent){let h=(c=d.tree)===null||c===void 0?void 0:c.prop(Ht.mounted);if(h&&h.parser==i)for(let p=this.fragI;p<this.fragments.length;p++){let m=this.fragments[p];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 Hb(a,l){let i=null,c=l;for(let o=1,d=0;o<a.length;o++){let h=a[o-1].to,p=a[o].from;for(;d<c.length;d++){let m=c[d];if(m.from>=p)break;m.to<=h||(i||(c=i=l.slice()),m.from<h?(i[d]=new Ul(m.from,h),m.to>p&&i.splice(d+1,0,new Ul(p,m.to))):m.to>p?i[d--]=new Ul(p,m.to):i.splice(d--,1))}}return c}function e1(a,l,i,c){let o=0,d=0,h=!1,p=!1,m=-1e9,x=[];for(;;){let y=o==a.length?1e9:h?a[o].to:a[o].from,j=d==l.length?1e9:p?l[d].to:l[d].from;if(h!=p){let v=Math.max(m,i),R=Math.min(y,j,c);v<R&&x.push(new Ul(v,R))}if(m=Math.min(y,j),m==1e9)break;y==m&&(h?(h=!1,o++):h=!0),j==m&&(p?(p=!1,d++):p=!0)}return x}function Bb(a,l){let i=[];for(let{pos:c,mount:o,frag:d}of a){let h=c+(o.overlay?o.overlay[0].from:0),p=h+o.tree.length,m=Math.max(d.from,h),x=Math.min(d.to,p);if(o.overlay){let y=o.overlay.map(v=>new Ul(v.from+c,v.to+c)),j=e1(l,y,m,x);for(let v=0,R=m;;v++){let w=v==j.length,L=w?x:j[v].from;if(L>R&&i.push(new $c(R,L,o.tree,-h,d.from>=R||d.openStart,d.to<=L||d.openEnd)),w)break;R=j[v].to}}else i.push(new $c(m,x,o.tree,-h,d.from>=h||d.openStart,d.to<=p||d.openEnd))}return i}let t1=0;class Ll{constructor(l,i,c,o){this.name=l,this.set=i,this.base=c,this.modified=o,this.id=t1++}toString(){let{name:l}=this;for(let i of this.modified)i.name&&(l=`${i.name}(${l})`);return l}static define(l,i){let c=typeof l=="string"?l:"?";if(l instanceof Ll&&(i=l),i!=null&&i.base)throw new Error("Can not derive from a modified tag");let o=new Ll(c,[],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 qo(l);return c=>c.modified.indexOf(i)>-1?c:qo.get(c.base||c,c.modified.concat(i).sort((o,d)=>o.id-d.id))}}let n1=0;class qo{constructor(l){this.name=l,this.instances=[],this.id=n1++}static get(l,i){if(!i.length)return l;let c=i[0].instances.find(p=>p.base==l&&l1(i,p.modified));if(c)return c;let o=[],d=new Ll(l.name,o,l,i);for(let p of i)p.instances.push(d);let h=a1(i);for(let p of l.set)if(!p.modified.length)for(let m of h)o.push(qo.get(p,m));return d}}function l1(a,l){return a.length==l.length&&a.every((i,c)=>i==l[c])}function a1(a){let l=[[]];for(let i=0;i<a.length;i++)for(let c=0,o=l.length;c<o;c++)l.push(l[c].concat(a[i]));return l.sort((i,c)=>c.length-i.length)}function sN(a){let l=Object.create(null);for(let i in a){let c=a[i];Array.isArray(c)||(c=[c]);for(let o of i.split(" "))if(o){let d=[],h=2,p=o;for(let j=0;;){if(p=="..."&&j>0&&j+3==o.length){h=1;break}let v=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(p);if(!v)throw new RangeError("Invalid path: "+o);if(d.push(v[0]=="*"?"":v[0][0]=='"'?JSON.parse(v[0]):v[0]),j+=v[0].length,j==o.length)break;let R=o[j++];if(j==o.length&&R=="!"){h=0;break}if(R!="/")throw new RangeError("Invalid path: "+o);p=o.slice(j)}let m=d.length-1,x=d[m];if(!x)throw new RangeError("Invalid path: "+o);let y=new Qc(c,h,m>0?d.slice(0,m):null);l[x]=y.sort(l[x])}}return Wx.add(l)}const Wx=new Ht({combine(a,l){let i,c,o;for(;a||l;){if(!a||l&&a.depth>=l.depth?(o=l,l=l.next):(o=a,a=a.next),i&&i.mode==o.mode&&!o.context&&!i.context)continue;let d=new Qc(o.tags,o.mode,o.context);i?i.next=d:c=d,i=d}return c}});class Qc{constructor(l,i,c,o){this.tags=l,this.mode=i,this.context=c,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}}Qc.empty=new Qc([],2,null);function Px(a,l){let i=Object.create(null);for(let d of a)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:c,all:o=null}=l||{};return{style:d=>{let h=o;for(let p of d)for(let m of p.set){let x=i[m.id];if(x){h=h?h+" "+x:x;break}}return h},scope:c}}function s1(a,l){let i=null;for(let c of a){let o=c.style(l);o&&(i=i?i+" "+o:o)}return i}function i1(a,l,i,c=0,o=a.length){let d=new c1(c,Array.isArray(l)?l:[l],i);d.highlightRange(a.cursor(),c,o,"",d.highlighters),d.flush(o)}function r1(a,l,i,c,o,d=0,h=a.length){let p=d;function m(x,y){if(!(x<=p)){for(let j=a.slice(p,x),v=0;;){let R=j.indexOf(`
116
- `,v),w=R<0?j.length:R;if(w>v&&c(j.slice(v,w),y),R<0)break;o(),v=R+1}p=x}}i1(l,i,(x,y,j)=>{m(x,""),m(y,j)},d,h),m(h,"")}class c1{constructor(l,i,c){this.at=l,this.highlighters=i,this.span=c,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,c,o,d){let{type:h,from:p,to:m}=l;if(p>=c||m<=i)return;h.isTop&&(d=this.highlighters.filter(R=>!R.scope||R.scope(h)));let x=o,y=u1(l)||Qc.empty,j=s1(d,y.tags);if(j&&(x&&(x+=" "),x+=j,y.mode==1&&(o+=(o?" ":"")+j)),this.startSpan(Math.max(i,p),x),y.opaque)return;let v=l.tree&&l.tree.prop(Ht.mounted);if(v&&v.overlay){let R=l.node.enter(v.overlay[0].from+p,1),w=this.highlighters.filter(B=>!B.scope||B.scope(v.tree.type)),L=l.firstChild();for(let B=0,P=p;;B++){let M=B<v.overlay.length?v.overlay[B]:null,Q=M?M.from+p:m,k=Math.max(i,P),Z=Math.min(c,Q);if(k<Z&&L)for(;l.from<Z&&(this.highlightRange(l,k,Z,o,d),this.startSpan(Math.min(Z,l.to),x),!(l.to>=Q||!l.nextSibling())););if(!M||Q>c)break;P=M.to+p,P>i&&(this.highlightRange(R.cursor(),Math.max(i,M.from+p),Math.min(c,P),"",w),this.startSpan(Math.min(c,P),x))}L&&l.parent()}else if(l.firstChild()){v&&(o="");do if(!(l.to<=i)){if(l.from>=c)break;this.highlightRange(l,i,c,o,d),this.startSpan(Math.min(c,l.to),x)}while(l.nextSibling());l.parent()}}}function u1(a){let l=a.type.prop(Wx);for(;l&&l.context&&!a.matchContext(l.context);)l=l.next;return l||null}const be=Ll.define,jo=be(),Ls=be(),qb=be(Ls),Ib=be(Ls),Us=be(),ko=be(Us),uh=be(Us),xa=be(),ji=be(xa),ha=be(),pa=be(),Ch=be(),Uc=be(Ch),No=be(),ke={comment:jo,lineComment:be(jo),blockComment:be(jo),docComment:be(jo),name:Ls,variableName:be(Ls),typeName:qb,tagName:be(qb),propertyName:Ib,attributeName:be(Ib),className:be(Ls),labelName:be(Ls),namespace:be(Ls),macroName:be(Ls),literal:Us,string:ko,docString:be(ko),character:be(ko),attributeValue:be(ko),number:uh,integer:be(uh),float:be(uh),bool:be(Us),regexp:be(Us),escape:be(Us),color:be(Us),url:be(Us),keyword:ha,self:be(ha),null:be(ha),atom:be(ha),unit:be(ha),modifier:be(ha),operatorKeyword:be(ha),controlKeyword:be(ha),definitionKeyword:be(ha),moduleKeyword:be(ha),operator:pa,derefOperator:be(pa),arithmeticOperator:be(pa),logicOperator:be(pa),bitwiseOperator:be(pa),compareOperator:be(pa),updateOperator:be(pa),definitionOperator:be(pa),typeOperator:be(pa),controlOperator:be(pa),punctuation:Ch,separator:be(Ch),bracket:Uc,angleBracket:be(Uc),squareBracket:be(Uc),paren:be(Uc),brace:be(Uc),content:xa,heading:ji,heading1:be(ji),heading2:be(ji),heading3:be(ji),heading4:be(ji),heading5:be(ji),heading6:be(ji),contentSeparator:be(xa),list:be(xa),quote:be(xa),emphasis:be(xa),strong:be(xa),link:be(xa),monospace:be(xa),strikethrough:be(xa),inserted:be(),deleted:be(),changed:be(),invalid:be(),meta:No,documentMeta:be(No),annotation:be(No),processingInstruction:be(No),definition:Ll.defineModifier("definition"),constant:Ll.defineModifier("constant"),function:Ll.defineModifier("function"),standard:Ll.defineModifier("standard"),local:Ll.defineModifier("local"),special:Ll.defineModifier("special")};for(let a in ke){let l=ke[a];l instanceof Ll&&(l.name=a)}Px([{tag:ke.link,class:"tok-link"},{tag:ke.heading,class:"tok-heading"},{tag:ke.emphasis,class:"tok-emphasis"},{tag:ke.strong,class:"tok-strong"},{tag:ke.keyword,class:"tok-keyword"},{tag:ke.atom,class:"tok-atom"},{tag:ke.bool,class:"tok-bool"},{tag:ke.url,class:"tok-url"},{tag:ke.labelName,class:"tok-labelName"},{tag:ke.inserted,class:"tok-inserted"},{tag:ke.deleted,class:"tok-deleted"},{tag:ke.literal,class:"tok-literal"},{tag:ke.string,class:"tok-string"},{tag:ke.number,class:"tok-number"},{tag:[ke.regexp,ke.escape,ke.special(ke.string)],class:"tok-string2"},{tag:ke.variableName,class:"tok-variableName"},{tag:ke.local(ke.variableName),class:"tok-variableName tok-local"},{tag:ke.definition(ke.variableName),class:"tok-variableName tok-definition"},{tag:ke.special(ke.variableName),class:"tok-variableName2"},{tag:ke.definition(ke.propertyName),class:"tok-propertyName tok-definition"},{tag:ke.typeName,class:"tok-typeName"},{tag:ke.namespace,class:"tok-namespace"},{tag:ke.className,class:"tok-className"},{tag:ke.macroName,class:"tok-macroName"},{tag:ke.propertyName,class:"tok-propertyName"},{tag:ke.operator,class:"tok-operator"},{tag:ke.comment,class:"tok-comment"},{tag:ke.meta,class:"tok-meta"},{tag:ke.invalid,class:"tok-invalid"},{tag:ke.punctuation,class:"tok-punctuation"}]);const o1="modulepreload",f1=function(a,l){return new URL(a,l).href},Gb={},Xe=function(l,i,c){let o=Promise.resolve();if(i&&i.length>0){let h=function(y){return Promise.all(y.map(j=>Promise.resolve(j).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};const p=document.getElementsByTagName("link"),m=document.querySelector("meta[property=csp-nonce]"),x=(m==null?void 0:m.nonce)||(m==null?void 0:m.getAttribute("nonce"));o=h(i.map(y=>{if(y=f1(y,c),y in Gb)return;Gb[y]=!0;const j=y.endsWith(".css"),v=j?'[rel="stylesheet"]':"";if(!!c)for(let L=p.length-1;L>=0;L--){const B=p[L];if(B.href===y&&(!j||B.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${y}"]${v}`))return;const w=document.createElement("link");if(w.rel=j?"stylesheet":o1,j||(w.as="script"),w.crossOrigin="",w.href=y,x&&w.setAttribute("nonce",x),document.head.appendChild(w),j)return new Promise((L,B)=>{w.addEventListener("load",L),w.addEventListener("error",()=>B(new Error(`Unable to preload CSS for ${y}`)))})}))}function d(h){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=h,window.dispatchEvent(p),!p.defaultPrevented)throw h}return o.then(h=>{for(const p of h||[])p.status==="rejected"&&d(p.reason);return l().catch(d)})},ey={js:async()=>(await Xe(async()=>{const{javascript:a}=await import("./index-BkW026LB.js");return{javascript:a}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({jsx:!0}),cjs:async()=>(await Xe(async()=>{const{javascript:a}=await import("./index-BkW026LB.js");return{javascript:a}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript(),mjs:async()=>(await Xe(async()=>{const{javascript:a}=await import("./index-BkW026LB.js");return{javascript:a}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript(),jsx:async()=>(await Xe(async()=>{const{javascript:a}=await import("./index-BkW026LB.js");return{javascript:a}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({jsx:!0}),ts:async()=>(await Xe(async()=>{const{javascript:a}=await import("./index-BkW026LB.js");return{javascript:a}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({typescript:!0}),mts:async()=>(await Xe(async()=>{const{javascript:a}=await import("./index-BkW026LB.js");return{javascript:a}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({typescript:!0}),cts:async()=>(await Xe(async()=>{const{javascript:a}=await import("./index-BkW026LB.js");return{javascript:a}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({typescript:!0}),tsx:async()=>(await Xe(async()=>{const{javascript:a}=await import("./index-BkW026LB.js");return{javascript:a}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({typescript:!0,jsx:!0}),json:async()=>(await Xe(async()=>{const{json:a}=await import("./index-BSSlnGXY.js");return{json:a}},__vite__mapDeps([6,1,2,3,4]),import.meta.url)).json(),jsonc:async()=>(await Xe(async()=>{const{json:a}=await import("./index-BSSlnGXY.js");return{json:a}},__vite__mapDeps([6,1,2,3,4]),import.meta.url)).json(),css:async()=>(await Xe(async()=>{const{css:a}=await import("./index-BhMOqhie.js");return{css:a}},__vite__mapDeps([7,1,2,3,4]),import.meta.url)).css(),scss:async()=>(await Xe(async()=>{const{css:a}=await import("./index-BhMOqhie.js");return{css:a}},__vite__mapDeps([7,1,2,3,4]),import.meta.url)).css(),less:async()=>(await Xe(async()=>{const{css:a}=await import("./index-BhMOqhie.js");return{css:a}},__vite__mapDeps([7,1,2,3,4]),import.meta.url)).css(),html:async()=>(await Xe(async()=>{const{html:a}=await import("./index-DwKlMv7y.js");return{html:a}},__vite__mapDeps([8,1,7,2,3,4,0,5]),import.meta.url)).html(),htm:async()=>(await Xe(async()=>{const{html:a}=await import("./index-DwKlMv7y.js");return{html:a}},__vite__mapDeps([8,1,7,2,3,4,0,5]),import.meta.url)).html(),vue:async()=>(await Xe(async()=>{const{html:a}=await import("./index-DwKlMv7y.js");return{html:a}},__vite__mapDeps([8,1,7,2,3,4,0,5]),import.meta.url)).html(),svelte:async()=>(await Xe(async()=>{const{html:a}=await import("./index-DwKlMv7y.js");return{html:a}},__vite__mapDeps([8,1,7,2,3,4,0,5]),import.meta.url)).html(),md:async()=>(await Xe(async()=>{const{markdown:a}=await import("./index-Ad2PF-Rq.js");return{markdown:a}},__vite__mapDeps([9,3,4,2,5,8,1,7,0]),import.meta.url)).markdown(),markdown:async()=>(await Xe(async()=>{const{markdown:a}=await import("./index-Ad2PF-Rq.js");return{markdown:a}},__vite__mapDeps([9,3,4,2,5,8,1,7,0]),import.meta.url)).markdown(),py:async()=>(await Xe(async()=>{const{python:a}=await import("./index-0HmmQWlg.js");return{python:a}},__vite__mapDeps([10,1,2,3,4,5]),import.meta.url)).python(),pyi:async()=>(await Xe(async()=>{const{python:a}=await import("./index-0HmmQWlg.js");return{python:a}},__vite__mapDeps([10,1,2,3,4,5]),import.meta.url)).python(),yaml:async()=>(await Xe(async()=>{const{yaml:a}=await import("./index-DCBC0-5s.js");return{yaml:a}},__vite__mapDeps([11,1,2,3,4]),import.meta.url)).yaml(),yml:async()=>(await Xe(async()=>{const{yaml:a}=await import("./index-DCBC0-5s.js");return{yaml:a}},__vite__mapDeps([11,1,2,3,4]),import.meta.url)).yaml(),rs:async()=>(await Xe(async()=>{const{rust:a}=await import("./index-DSNfNkTB.js");return{rust:a}},__vite__mapDeps([12,1,2,3,4]),import.meta.url)).rust(),c:async()=>(await Xe(async()=>{const{cpp:a}=await import("./index-7kIwIZTG.js");return{cpp:a}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),h:async()=>(await Xe(async()=>{const{cpp:a}=await import("./index-7kIwIZTG.js");return{cpp:a}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),cc:async()=>(await Xe(async()=>{const{cpp:a}=await import("./index-7kIwIZTG.js");return{cpp:a}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),cpp:async()=>(await Xe(async()=>{const{cpp:a}=await import("./index-7kIwIZTG.js");return{cpp:a}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),hpp:async()=>(await Xe(async()=>{const{cpp:a}=await import("./index-7kIwIZTG.js");return{cpp:a}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),java:async()=>(await Xe(async()=>{const{java:a}=await import("./index-2TX05R9q.js");return{java:a}},__vite__mapDeps([14,1,2,3,4]),import.meta.url)).java(),go:async()=>(await Xe(async()=>{const{go:a}=await import("./index-ddiuUAWC.js");return{go:a}},__vite__mapDeps([15,1,2,3,4,5]),import.meta.url)).go(),php:async()=>(await Xe(async()=>{const{php:a}=await import("./index-btSVHsjz.js");return{php:a}},__vite__mapDeps([16,1,8,7,2,3,4,0,5]),import.meta.url)).php(),sql:async()=>(await Xe(async()=>{const{sql:a}=await import("./index-CUHxmW2C.js");return{sql:a}},__vite__mapDeps([17,2,3,4,1,5]),import.meta.url)).sql(),xml:async()=>(await Xe(async()=>{const{xml:a}=await import("./index-D2kgCnsK.js");return{xml:a}},__vite__mapDeps([18,1,2,3,4]),import.meta.url)).xml(),svg:async()=>(await Xe(async()=>{const{xml:a}=await import("./index-D2kgCnsK.js");return{xml:a}},__vite__mapDeps([18,1,2,3,4]),import.meta.url)).xml()},d1={".mcp.json":"json",dockerfile:"yaml",makefile:"yaml"},h1={javascript:"js",node:"js",typescript:"ts",python:"py",python3:"py",yml:"yaml",rust:"rs",golang:"go","c++":"cpp",cplusplus:"cpp"};async function p1(a){const l=h1[a.toLowerCase()]??a.toLowerCase(),i=ey[l];return i?i().catch(()=>null):null}async function m1(a){const l=(a.split("/").pop()??"").toLowerCase(),i=d1[l]??l.split(".").pop()??"",c=ey[i];return c?c().catch(()=>null):null}const g1=Px([{tag:[ke.keyword,ke.modifier,ke.controlKeyword,ke.moduleKeyword],class:"cmh-key"},{tag:[ke.propertyName],class:"cmh-prop"},{tag:[ke.function(ke.variableName),ke.labelName],class:"cmh-fn"},{tag:[ke.color,ke.constant(ke.name),ke.standard(ke.name),ke.bool],class:"cmh-const"},{tag:[ke.typeName,ke.className,ke.changed,ke.annotation,ke.self,ke.namespace],class:"cmh-type"},{tag:[ke.number,ke.integer,ke.float],class:"cmh-num"},{tag:[ke.string,ke.special(ke.string),ke.regexp],class:"cmh-str"},{tag:[ke.operator,ke.operatorKeyword,ke.escape],class:"cmh-op"},{tag:[ke.meta,ke.comment],class:"cmh-comment"},{tag:ke.invalid,class:"cmh-invalid"}]);function wo(a){return a.replace(/[&<>]/g,l=>l==="&"?"&amp;":l==="<"?"&lt;":"&gt;")}async function b1(a,l){const i=l?await p1(l):null;if(!i)return wo(a);try{const c=i.language.parser.parse(a);let o="";return r1(a,c,g1,(d,h)=>{o+=h?`<span class="${h}">${wo(d)}</span>`:wo(d)},()=>{o+=`
117
- `}),o}catch{return wo(a)}}xt.setOptions({gfm:!0,breaks:!1});function ty(a){var i;const l=(i=a.split(".").pop())==null?void 0:i.toLowerCase();return l==="md"||l==="markdown"}async function $h(a){const l=await xt.parse(a,{async:!0,walkTokens:async i=>{if(i.type!=="code")return;const c=i;c.text=await b1(c.text,c.lang??""),c.escaped=!0}});return qv.sanitize(l)}function Yb(a,l){return{path:a.path,text:a.content,saved:a.content,eol:a.eol,encoding:a.encoding,mtime:a.mtime,size:a.size,binary:a.binary,tooLarge:a.tooLarge,stale:!1,revision:l,previewMode:ty(a.path)}}function Fa(a){return!a.binary&&!a.tooLarge&&a.text!==a.saved}function x1(a){return a.split("/").pop()??a}function Oi(a){const l=a.lastIndexOf("/");return l===-1?"":a.slice(0,l)}function oh(a){return a<1024?`${a} Б`:a<1024*1024?`${(a/1024).toFixed(1)} КБ`:`${(a/1024/1024).toFixed(1)} МБ`}function Gc({x:a,y:l,items:i,note:c,onClose:o}){const d=_.useRef(null),[h,p]=_.useState({left:a,top:l}),[m,x]=_.useState(()=>{const v=i.findIndex(R=>!R.disabled);return v===-1?0:v});_.useLayoutEffect(()=>{const v=d.current;if(!v)return;const R=v.getBoundingClientRect(),w=8,L=Math.max(w,Math.min(a,window.innerWidth-R.width-w)),B=Math.max(w,Math.min(l,window.innerHeight-R.height-w));p({left:L,top:B})},[a,l]),_.useLayoutEffect(()=>{var v;(v=d.current)==null||v.focus()},[]),_.useLayoutEffect(()=>{function v(w){var L;(L=d.current)!=null&&L.contains(w.target)||o()}function R(){o()}return document.addEventListener("mousedown",v),document.addEventListener("scroll",R,!0),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("scroll",R,!0)}},[o]);function y(v){v.disabled||(v.onSelect(),o())}function j(v){if(v.key==="Escape"){v.preventDefault(),v.stopPropagation(),o();return}const R=i.map((w,L)=>({item:w,index:L})).filter(w=>!w.item.disabled);if(R.length!==0){if(v.key==="ArrowDown"||v.key==="ArrowUp"){v.preventDefault();const w=v.key==="ArrowDown"?1:-1,L=R.findIndex(P=>P.index===m),B=R[(((L===-1?0:L)+w)%R.length+R.length)%R.length];B&&x(B.index);return}if(v.key==="Enter"||v.key===" "){v.preventDefault();const w=i[m];w&&y(w)}}}return r.jsxs("div",{ref:d,className:"ctxmenu",style:{left:h.left,top:h.top},role:"menu",tabIndex:-1,onKeyDown:j,children:[c&&r.jsx("div",{className:"ctxmenu__note",children:c}),i.map((v,R)=>r.jsxs("button",{type:"button",role:"menuitem","aria-disabled":v.disabled,className:"ctxmenu__item"+(R===m?" is-cursor":""),onMouseEnter:()=>x(R),onClick:()=>y(v),children:[r.jsx("span",{className:"ctxmenu__label",children:v.label}),v.hint&&r.jsx("span",{className:"ctxmenu__hint",children:v.hint})]},v.id))]})}const y1=3500,_1=9e3,Xb=220;function Ui({result:a,onDismiss:l}){const[i,c]=_.useState(a),[o,d]=_.useState(!1);if(_.useEffect(()=>{if(!a){c(null),d(!1);return}if(c(a),d(!1),a.url)return;const p=a.ok?y1:_1,m=setTimeout(()=>d(!0),p),x=setTimeout(()=>c(null),p+Xb);return()=>{clearTimeout(m),clearTimeout(x)}},[a]),!i)return null;const h=()=>{d(!0),setTimeout(()=>{c(null),l==null||l()},Xb)};return r.jsxs("div",{className:"oplog "+(i.ok?"oplog--ok":"oplog--bad")+(o?" oplog--leaving":"")+(i.url?" oplog--dismissible":""),role:"status","aria-live":i.ok?"polite":"assertive",children:[i.message,i.url&&r.jsxs("a",{className:"oplog__link",href:i.url,target:"_blank",rel:"noreferrer",onClick:p=>p.stopPropagation(),children:[i.url.replace(/^https?:\/\//,"")," ↗"]}),i.url&&l&&r.jsx("button",{type:"button",className:"oplog__dismiss",title:"Закрыть","aria-label":"Закрыть сообщение",onClick:h,children:"✕"})]})}function Zc({value:a,className:l,placeholder:i="Название сессии",onCommit:c,onCancel:o}){const[d,h]=_.useState(a),p=_.useRef(null);_.useEffect(()=>{var x;(x=p.current)==null||x.select()},[]);function m(){const x=d.trim();if(!x||x===a)return o();c(x)}return r.jsx("input",{ref:p,className:l?`rename ${l}`:"rename",value:d,autoFocus:!0,spellCheck:!1,placeholder:i,onChange:x=>h(x.target.value),onBlur:m,onKeyDown:x=>{x.stopPropagation(),x.key==="Enter"?(x.preventDefault(),m()):x.key==="Escape"&&(x.preventDefault(),o())}})}function Ur({active:a}){return a?r.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M2 5h3V2"}),r.jsx("path",{d:"M14 5h-3V2"}),r.jsx("path",{d:"M2 11h3v3"}),r.jsx("path",{d:"M14 11h-3v3"})]}):r.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M5 2H2v3"}),r.jsx("path",{d:"M11 2h3v3"}),r.jsx("path",{d:"M2 11v3h3"}),r.jsx("path",{d:"M14 11v3h-3"})]})}const v1=500,ki="application/x-ccv-fs-path",S1=200;function j1({open:a,tree:l,expanded:i,activePath:c,dirty:o,gitChanges:d,result:h,searchResult:p,onSearch:m,onReveal:x,onToggle:y,onOpen:j,onCreate:v,onRename:R,onMove:w,onCopy:L,onDelete:B,onRefresh:P,onClose:M,zoomed:Q,onToggleZoom:k}){const[Z,z]=_.useState(""),[A,V]=_.useState(null),[te,fe]=_.useState(null),[F,ae]=_.useState(null),[me,we]=_.useState(null),[ge,H]=_.useState(null),[ie,re]=_.useState(null),ue=Vo("(hover: hover)"),_e=_.useRef(null),T=_.useMemo(()=>w1(d),[d]);function K(E){return!(!F||E===F.path||F.kind==="dir"&&E.startsWith(`${F.path}/`)||E===Oi(F.path))}function oe(E){return!(!ge||E===ge.path||ge.kind==="dir"&&E.startsWith(`${ge.path}/`)||ge.mode==="cut"&&E===Oi(ge.path))}function pe(E){H({path:E.path,kind:E.kind,mode:"copy"})}function Ne(E){H({path:E.path,kind:E.kind,mode:"cut"})}function ye(E){!ge||!oe(E)||(E&&!i.has(E)&&y(E),ge.mode==="cut"?(w(ge.path,E),H(null)):L(ge.path,E))}function Ae(E,Y){const ve=E.touches[0];if(!ve)return;const D={timer:0,x:ve.clientX,y:ve.clientY,el:E.currentTarget,fired:!1};D.timer=window.setTimeout(()=>{D.fired=!0,Y(D.x,D.y,D.el)},v1),_e.current=D}function st(E){const Y=_e.current,ve=E.touches[0];!Y||!ve||Math.hypot(ve.clientX-Y.x,ve.clientY-Y.y)>10&&(window.clearTimeout(Y.timer),_e.current=null)}function Qe(E){const Y=_e.current;Y&&(window.clearTimeout(Y.timer),Y.fired&&E.preventDefault())}function Ot(){var E;return(E=_e.current)!=null&&E.fired?(_e.current=null,!0):!1}function qe(E,Y,ve,D){z((D==null?void 0:D.path)??""),re({x:E,y:Y,opener:ve,entry:D})}function yt(){const E=ie==null?void 0:ie.opener;re(null),E!=null&&E.isConnected&&E.focus()}function et(E){return{onContextMenu:Y=>{Y.preventDefault(),qe(Y.clientX,Y.clientY,Y.currentTarget,E)},onTouchStart:Y=>Ae(Y,(ve,D,J)=>qe(ve,D,J,E)),onTouchMove:st,onTouchEnd:Qe,onTouchCancel:Qe}}function Je(E){E.target===E.currentTarget&&(E.preventDefault(),qe(E.clientX,E.clientY,E.currentTarget,null))}function Fe(E){E.target===E.currentTarget&&Ae(E,(Y,ve,D)=>qe(Y,ve,D,null))}function it(E){if(!(E.ctrlKey||E.metaKey)||E.target instanceof HTMLInputElement)return;const Y=E.key.toLowerCase();if(Y==="v"){E.preventDefault(),ye(fn());return}if(!Z)return;const ve=Vb(l,Z);ve&&(Y==="c"?(E.preventDefault(),pe(ve)):Y==="x"&&(E.preventDefault(),Ne(ve)))}function Jn(E){return Y=>{Y.dataTransfer.effectAllowed="move",Y.dataTransfer.setData(ki,E.path),ae({path:E.path,kind:E.kind})}}function Bt(){ae(null),we(null)}function qt(E){return Y=>{Y.dataTransfer.types.includes(ki)&&(Y.stopPropagation(),!(E.kind!=="dir"||!K(E.path))&&(Y.preventDefault(),we(E.path)))}}function Kt(E){return Y=>{if(!Y.dataTransfer.types.includes(ki)||(Y.stopPropagation(),E.kind!=="dir"||!K(E.path)))return;Y.preventDefault();const ve=Y.dataTransfer.getData(ki);we(null),ve&&w(ve,E.path)}}function It(E){!E.dataTransfer.types.includes(ki)||!K("")||(E.preventDefault(),we(""))}function Gt(E){if(!E.dataTransfer.types.includes(ki)||!K(""))return;E.preventDefault();const Y=E.dataTransfer.getData(ki);we(null),Y&&w(Y,"")}const[Qt,rt]=_.useState(""),Tt=Qt.trim(),en=Tt.length>0,En=_.useRef(null),Ct=_.useRef(m);Ct.current=m;function kn(E){rt(E),En.current&&clearTimeout(En.current);const Y=E.trim();if(!Y){Ct.current("");return}En.current=setTimeout(()=>Ct.current(Y),S1)}function An(E){En.current&&clearTimeout(En.current),rt(""),Ct.current(""),z(E.path),x(E)}const Dt=en&&(p==null?void 0:p.query)===Tt?p:null;function fn(){if(Z==="")return"";const E=Vb(l,Z);if((E==null?void 0:E.kind)==="dir")return Z;const Y=Z.lastIndexOf("/");return Y===-1?"":Z.slice(0,Y)}function Jt(E,Y){const ve=Y??fn();ve&&!i.has(ve)&&y(ve),fe({parent:ve,kind:E})}function Et(){if(!ie)return[];const E=D=>ue?D:void 0;if(!ie.entry)return[{id:"paste",label:"Вставить в корень проекта",hint:E("Ctrl+V"),disabled:!oe(""),onSelect:()=>ye("")},{id:"new-file",label:"Создать файл",onSelect:()=>Jt("file","")},{id:"new-dir",label:"Создать каталог",onSelect:()=>Jt("dir","")}];const Y=ie.entry,ve=[Y.kind==="file"?{id:"open",label:"Открыть",onSelect:()=>j(Y.path)}:{id:"toggle",label:i.has(Y.path)?"Свернуть":"Развернуть",onSelect:()=>y(Y.path)},{id:"copy",label:"Копировать",hint:E("Ctrl+C"),onSelect:()=>pe(Y)},{id:"cut",label:"Вырезать",hint:E("Ctrl+X"),onSelect:()=>Ne(Y)}];return Y.kind==="dir"&&(ve.push({id:"paste",label:"Вставить",hint:E("Ctrl+V"),disabled:!oe(Y.path),onSelect:()=>ye(Y.path)}),ve.push({id:"new-file",label:"Создать файл",onSelect:()=>Jt("file",Y.path)}),ve.push({id:"new-dir",label:"Создать каталог",onSelect:()=>Jt("dir",Y.path)})),ve.push({id:"rename",label:"Переименовать",onSelect:()=>V(Y.path)}),ve.push({id:"delete",label:"Удалить",onSelect:()=>B(Y)}),ve}const dn=en?[]:ot("",0);function ot(E,Y){const ve=l[E],D=[];if(te&&te.parent===E&&D.push(r.jsxs("div",{className:"fsrow fsrow--draft",style:Wa(Y),children:[r.jsx("span",{className:"fsrow__icon",children:te.kind==="dir"?r.jsx(Go,{}):r.jsx(Yo,{})}),r.jsx(Zc,{className:"rename--file",value:"",placeholder:te.kind==="dir"?"имя каталога":"имя файла",onCommit:J=>{fe(null),v(E,te.kind,J)},onCancel:()=>fe(null)})]},`draft:${E}`)),!ve)return D.push(r.jsx("p",{className:"fsrow__pending",style:Wa(Y),children:"читаем…"},`wait:${E}`)),D;ve.length===0&&!te&&D.push(r.jsx("p",{className:"fsrow__pending",style:Wa(Y),children:"пусто"},`empty:${E}`));for(const J of ve){const xe=J.kind==="dir"&&i.has(J.path);D.push(A===J.path?r.jsxs("div",{className:"fsrow fsrow--draft",style:Wa(Y),children:[r.jsx("span",{className:"fsrow__icon",children:J.kind==="dir"?r.jsx(Go,{open:xe}):r.jsx(Yo,{})}),r.jsx(Zc,{className:"rename--file",value:J.name,placeholder:"новое имя",onCommit:Be=>{V(null),R(J.path,Be)},onCancel:()=>V(null)})]},J.path):r.jsx(k1,{entry:J,depth:Y,open:xe,active:J.path===c,selected:J.path===Z,dirty:o.has(J.path),gitStatus:T.get(J.path),dragging:(F==null?void 0:F.path)===J.path,dropTarget:me===J.path,cut:(ge==null?void 0:ge.mode)==="cut"&&ge.path===J.path,onClick:()=>{Ot()||(z(J.path),J.kind==="dir"?y(J.path):j(J.path))},onRename:()=>V(J.path),onDelete:()=>B(J),onDragStart:Jn(J),onDragEnd:Bt,onDragOver:qt(J),onDrop:Kt(J),...et(J)},J.path)),xe&&D.push(...ot(J.path,Y+1))}return D}function tn(){if(!Dt)return[r.jsx("p",{className:"fsrow__pending",style:Wa(0),children:"ищем…"},"search:wait")];if(Dt.entries.length===0)return[r.jsx("p",{className:"fsrow__pending",style:Wa(0),children:"ничего не найдено"},"search:empty")];const E=Dt.entries.map(Y=>r.jsx(N1,{entry:Y,gitStatus:T.get(Y.path),onClick:()=>An(Y)},Y.path));return Dt.truncated&&E.push(r.jsxs("p",{className:"fsrow__pending",style:Wa(0),children:["показаны первые ",Dt.entries.length," — уточните запрос"]},"search:truncated")),E}return r.jsxs("aside",{className:(a?"sidepane sidepane--files sidepane--open":"sidepane sidepane--files")+(Q?" sidepane--zoomed":""),"aria-label":"Файлы проекта",onKeyDown:it,children:[r.jsxs("div",{className:"sidepane__head",onDoubleClick:E=>{k&&(E.target.closest("button")||k())},children:[r.jsx(C1,{}),r.jsx("span",{className:"sidepane__title",children:"Файлы"}),r.jsx("button",{className:"sidepane__btn",title:"Новый файл","aria-label":"Новый файл",onClick:()=>Jt("file"),children:r.jsx(E1,{})}),r.jsx("button",{className:"sidepane__btn",title:"Новый каталог","aria-label":"Новый каталог",onClick:()=>Jt("dir"),children:r.jsx(A1,{})}),r.jsx("button",{className:"sidepane__btn",title:"Перечитать дерево","aria-label":"Перечитать дерево",onClick:P,children:"↻"}),k&&r.jsx("button",{className:"sidepane__btn",title:Q?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":Q?"Свернуть панель файлов":"Развернуть панель файлов на весь экран","aria-pressed":Q,onClick:k,children:r.jsx(Ur,{active:Q})}),r.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель файлов",onClick:M,children:"✕"})]}),r.jsxs("div",{className:"fssearch",children:[r.jsx(R1,{}),r.jsx("input",{className:"fssearch__input",type:"text",value:Qt,spellCheck:!1,placeholder:"Поиск файлов и папок…","aria-label":"Поиск файлов и папок",onChange:E=>kn(E.target.value),onKeyDown:E=>{E.stopPropagation(),E.key==="Escape"&&(E.preventDefault(),Qt?kn(""):E.currentTarget.blur())}}),Qt&&r.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>kn(""),children:"✕"})]}),r.jsx("div",{className:"sidepane__scroll fstree"+(me===""?" fstree--drop-target":""),tabIndex:-1,onDragOver:It,onDrop:Gt,onContextMenu:Je,onTouchStart:Fe,onTouchMove:st,onTouchEnd:Qe,onTouchCancel:Qe,children:en?tn():dn}),r.jsx(Ui,{result:h}),ie&&r.jsx(Gc,{x:ie.x,y:ie.y,items:Et(),onClose:yt})]})}function k1({entry:a,depth:l,open:i,active:c,selected:o,dirty:d,gitStatus:h,dragging:p,dropTarget:m,cut:x,onClick:y,onRename:j,onDelete:v,onDragStart:R,onDragEnd:w,onDragOver:L,onDrop:B,onContextMenu:P,onTouchStart:M,onTouchMove:Q,onTouchEnd:k,onTouchCancel:Z}){const z="fsrow"+(c?" is-open":"")+(o&&!c?" is-selected":"")+(a.ignored?" fsrow--ignored":"")+(p?" fsrow--dragging":"")+(m?" fsrow--drop-target":"")+(x?" fsrow--cut":"");return r.jsxs("div",{className:z,style:Wa(l),draggable:!0,onDragStart:R,onDragEnd:w,onDragOver:L,onDrop:B,onContextMenu:P,onTouchStart:M,onTouchMove:Q,onTouchEnd:k,onTouchCancel:Z,children:[r.jsxs("button",{className:"fsrow__main",onClick:y,title:ny(a),children:[r.jsx("span",{className:"fsrow__icon"+Io("fsrow__icon",h),children:a.kind==="dir"?r.jsx(Go,{open:i}):r.jsx(Yo,{})}),r.jsx("span",{className:"fsrow__name"+Io("fsrow__name",h),children:a.name}),a.ignored&&r.jsx("span",{className:"fsrow__tag",title:"Игнорируется git (.gitignore)",children:"git-ignore"}),d&&r.jsx("span",{className:"fsrow__dot",title:"Есть несохранённые правки"})]}),r.jsx("button",{className:"fsrow__act",title:"Переименовать","aria-label":`Переименовать ${a.name}`,onClick:j,children:"✎"}),r.jsx("button",{className:"fsrow__act",title:"Удалить","aria-label":`Удалить ${a.name}`,onClick:v,children:"✕"})]})}function N1({entry:a,gitStatus:l,onClick:i}){const c=a.path.slice(0,a.path.length-a.name.length-1);return r.jsxs("button",{className:"fsrow fsrow--search"+(a.ignored?" fsrow--ignored":""),style:Wa(0),onClick:i,title:ny(a),children:[r.jsx("span",{className:"fsrow__icon"+Io("fsrow__icon",l),children:a.kind==="dir"?r.jsx(Go,{}):r.jsx(Yo,{})}),r.jsx("span",{className:"fsrow__name"+Io("fsrow__name",l),children:a.name}),a.ignored&&r.jsx("span",{className:"fsrow__tag",children:"git-ignore"}),c&&r.jsx("span",{className:"fsrow__path",children:c})]})}function ny(a){return a.ignored?`${a.path} — игнорируется git (.gitignore)`:a.path}function Wa(a){return{"--depth":a}}function Vb(a,l){var o;const i=l.lastIndexOf("/"),c=i===-1?"":l.slice(0,i);return((o=a[c])==null?void 0:o.find(d=>d.path===l))??null}function w1(a){const l=new Map,i={added:1,modified:2},c=(o,d)=>{const h=l.get(o);(!h||i[d]>i[h])&&l.set(o,d)};for(const o of a){const d=T1(o.status);if(!d)continue;c(o.path,d);let h=Oi(o.path);for(;c(h,d),!!h;)h=Oi(h)}return l}function T1(a){if(a==="??")return"added";const[l="",i=""]=a;return l==="A"||l==="R"||l==="C"?"added":l==="M"||i==="M"?"modified":null}function Io(a,l){return l?` ${a}--git-${l}`:""}function Go({open:a=!1}){return r.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,"aria-hidden":"true",children:a?r.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"}):r.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 Yo(){return r.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,strokeLinejoin:"round","aria-hidden":"true",children:[r.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"}),r.jsx("path",{d:"M9 2v3.2h3.3"})]})}function E1(){return r.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,"aria-hidden":"true",children:[r.jsxs("g",{transform:"translate(-1.3,-1.6) scale(0.78)",strokeLinejoin:"round",children:[r.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"}),r.jsx("path",{d:"M9 2v3.2h3.3"})]}),r.jsx("path",{d:"M12.2 10.3v3.8M10.3 12.2h3.8",strokeLinecap:"round"})]})}function A1(){return r.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,"aria-hidden":"true",children:[r.jsx("g",{transform:"translate(-1.3,-1.6) scale(0.78)",children:r.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"})}),r.jsx("path",{d:"M12.2 10.3v3.8M10.3 12.2h3.8",strokeLinecap:"round"})]})}function C1(){return r.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[r.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"}),r.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 R1(){return r.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[r.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),r.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}const M1=200;function O1({open:a,result:l,onSearch:i,onOpenMatch:c,onClose:o,zoomed:d,onToggleZoom:h}){const[p,m]=_.useState(""),x=p.trim(),y=x.length>0,j=_.useRef(null),v=_.useRef(i);v.current=i;function R(B){m(B),j.current&&clearTimeout(j.current);const P=B.trim();if(!P){v.current("");return}j.current=setTimeout(()=>v.current(P),M1)}const w=y&&(l==null?void 0:l.query)===x?l:null;function L(){if(!w)return[r.jsx("p",{className:"fsrow__pending",children:"ищем…"},"grep:wait")];if(w.matches.length===0)return[r.jsx("p",{className:"fsrow__pending",children:"ничего не найдено"},"grep:empty")];const B=[];let P="";for(const M of w.matches)M.path!==P&&(P=M.path,B.push(r.jsx("p",{className:"searchgroup__path",title:M.path,children:M.path},`path:${M.path}`))),B.push(r.jsx(D1,{match:M,onClick:()=>c(M)},`${M.path}:${M.line}:${M.column}`));return w.truncated&&B.push(r.jsxs("p",{className:"fsrow__pending",children:["показаны первые ",w.matches.length," — уточните запрос"]},"grep:truncated")),B}return r.jsxs("aside",{className:(a?"sidepane sidepane--search sidepane--open":"sidepane sidepane--search")+(d?" sidepane--zoomed":""),"aria-label":"Поиск по тексту в проекте",children:[r.jsxs("div",{className:"sidepane__head",onDoubleClick:B=>{h&&(B.target.closest("button")||h())},children:[r.jsx(z1,{}),r.jsx("span",{className:"sidepane__title",children:"Поиск по тексту"}),h&&r.jsx("button",{className:"sidepane__btn",title:d?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":d?"Свернуть панель поиска":"Развернуть панель поиска на весь экран","aria-pressed":d,onClick:h,children:r.jsx(Ur,{active:d})}),r.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель поиска",onClick:o,children:"✕"})]}),r.jsxs("div",{className:"fssearch",children:[r.jsx(L1,{}),r.jsx("input",{className:"fssearch__input",type:"text",value:p,spellCheck:!1,placeholder:"Поиск по тексту во всех файлах…","aria-label":"Поиск по тексту во всех файлах",onChange:B=>R(B.target.value),onKeyDown:B=>{B.stopPropagation(),B.key==="Escape"&&(B.preventDefault(),p?R(""):B.currentTarget.blur())}}),p&&r.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>R(""),children:"✕"})]}),r.jsx("div",{className:"sidepane__scroll fstree",children:y?L():r.jsx("p",{className:"sidepane__empty",children:"Введите текст, чтобы найти его во всех файлах проекта."})})]})}function D1({match:a,onClick:l}){const i=a.lineText.slice(0,a.column-1),c=a.lineText.slice(a.column-1,a.column-1+a.matchLength),o=a.lineText.slice(a.column-1+a.matchLength);return r.jsxs("button",{className:"searchmatch",onClick:l,title:`${a.path}:${a.line}`,children:[r.jsx("span",{className:"searchmatch__line",children:a.line}),r.jsxs("span",{className:"searchmatch__text",children:[i,r.jsx("mark",{children:c}),o]})]})}function z1(){return r.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[r.jsx("circle",{cx:"6.8",cy:"6.8",r:"4.3"}),r.jsx("path",{d:"M13.2 13.2 10.1 10.1"})]})}function L1(){return r.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[r.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),r.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}let To=null;function U1(){return To||(To=Promise.all([Xe(()=>import("./index-CRw2q1Gv.js"),__vite__mapDeps([19,4,3,2,20,5]),import.meta.url),Xe(()=>import("./index-891wE-Rj.js").then(a=>a.v),__vite__mapDeps([4,3]),import.meta.url),Xe(()=>import("./index-BHot-lnj.js"),[],import.meta.url),Xe(()=>import("./index-BqBuIlqo.js"),__vite__mapDeps([20,3,4,2]),import.meta.url),Xe(()=>import("./codemirror-B5gQkzI5.js"),__vite__mapDeps([21,2,3,4]),import.meta.url)]).then(([a,l,i,c,o])=>({EditorView:l.EditorView,EditorState:i.EditorState,Compartment:i.Compartment,EditorSelection:i.EditorSelection,Prec:i.Prec,keymap:l.keymap,indentWithTab:c.indentWithTab,basicSetup:a.basicSetup,editorTheme:o.editorTheme,editorHighlight:o.editorHighlight})).catch(a=>{throw To=null,a})),To}function H1({path:a,doc:l,revision:i,goto:c,onChange:o,onSave:d}){const h=_.useRef(null),p=_.useRef(null),m=_.useRef(null),x=_.useRef(new Map),y=_.useRef(new Map),j=_.useRef(new Set),v=_.useRef(null),R=_.useRef(o),w=_.useRef(d),L=_.useRef(a),B=_.useRef(i),P=_.useRef(l);R.current=o,w.current=d,L.current=a,B.current=i,P.current=l;const[M,Q]=_.useState("loading"),[k,Z]=_.useState(!1);function z(V,te,fe,F,ae){const me=x.current.get(F),we=y.current.get(F)===ae;if(me&&we)fe.setState(me);else{const H=V.EditorState.create({doc:P.current,extensions:[V.basicSetup,V.Prec.highest(V.keymap.of([{key:"Mod-s",preventDefault:!0,run:()=>(w.current(L.current),!0)}])),V.keymap.of([V.indentWithTab]),te.of([]),V.editorTheme,V.editorHighlight,V.EditorView.updateListener.of(ie=>{ie.docChanged&&R.current(L.current,ie.state.doc.toString())})]});x.current.set(F,H),y.current.set(F,ae),fe.setState(H),j.current.delete(F)}if(j.current.has(F))return()=>{};let ge=!1;return m1(F).then(H=>{ge||!H||L.current!==F||(fe.dispatch({effects:te.reconfigure(H)}),x.current.set(F,fe.state),j.current.add(F))}),()=>{ge=!0}}_.useEffect(()=>{if(!h.current)return;let te=!1,fe=null,F=null;Q("loading"),Z(!1);const ae=window.setTimeout(()=>{te||Z(!0)},200);return(async()=>{let me;try{me=await U1()}catch{window.clearTimeout(ae),te||Q("error");return}if(te||!h.current)return;window.clearTimeout(ae);const we=new me.Compartment;v.current=we,m.current=me,F=new me.EditorView({parent:h.current}),p.current=F,fe=z(me,we,F,L.current,B.current),Q("ready")})(),()=>{te=!0,window.clearTimeout(ae),fe==null||fe(),F==null||F.destroy(),p.current===F&&(p.current=null),m.current=null,v.current=null}},[]),_.useEffect(()=>{const V=m.current,te=p.current,fe=v.current;if(!(!V||!te||!fe))return z(V,fe,te,a,i)},[a,i]);const A=_.useRef(0);return _.useEffect(()=>{const V=p.current,te=m.current;if(!V||!te||!c||c.token===A.current)return;A.current=c.token;const fe=V.state.doc.lines,F=Math.min(Math.max(c.line,1),fe),ae=V.state.doc.line(F),me=Math.min(ae.from+Math.max(c.column-1,0),ae.to);V.dispatch({selection:te.EditorSelection.cursor(me),effects:te.EditorView.scrollIntoView(me,{y:"center"})}),V.focus()},[c]),_.useEffect(()=>()=>{const V=p.current;V&&x.current.set(a,V.state)},[a]),r.jsxs("div",{className:"editor__code",children:[r.jsx("div",{ref:h,className:"editor__code-surface"+(M==="ready"?"":" is-hidden")}),M==="loading"&&k&&r.jsxs("div",{className:"editor__state work",role:"status",children:[r.jsxs("div",{className:"work__dots",children:[r.jsx("span",{className:"work__dot"}),r.jsx("span",{className:"work__dot"}),r.jsx("span",{className:"work__dot"})]}),r.jsx("span",{className:"work__label",children:"Загружается редактор…"})]}),M==="error"&&r.jsxs("div",{className:"editor__fallback",children:[r.jsxs("div",{className:"editor__fallback-banner",role:"alert",children:[r.jsx("span",{children:"Редактор не загрузился — ниже только просмотр, без сохранения правок."}),r.jsx("button",{className:"btn btn--sm btn--primary",onClick:()=>window.location.reload(),children:"Перезагрузить страницу"})]}),r.jsx("pre",{className:"editor__fallback-text",children:l})]})]})}function B1({file:a,goto:l,onChange:i,onSave:c,onReload:o,onOverwrite:d,onTogglePreview:h}){const p=Fa(a),m=ty(a.path)&&!a.binary&&!a.tooLarge;return r.jsxs("div",{className:"editor",children:[r.jsxs("div",{className:"editor__bar",children:[r.jsx("span",{className:"editor__path",title:a.path,children:a.path}),r.jsxs("span",{className:"editor__meta",children:[oh(a.size),a.eol==="crlf"&&" · CRLF"]}),m&&r.jsxs("div",{className:"editor__viewtoggle",role:"tablist","aria-label":"Режим просмотра",children:[r.jsx("button",{className:"btn btn--sm"+(a.previewMode?" is-on":""),role:"tab","aria-selected":a.previewMode,onClick:()=>!a.previewMode&&h(a.path),children:"Просмотр"}),r.jsx("button",{className:"btn btn--sm"+(a.previewMode?"":" is-on"),role:"tab","aria-selected":!a.previewMode,onClick:()=>a.previewMode&&h(a.path),children:"Код"})]}),r.jsx("button",{className:"btn btn--sm",disabled:!p,title:"Сохранить (Ctrl+S)",onClick:()=>c(a.path),children:p?"Сохранить":"Сохранено"})]}),a.stale&&r.jsxs("div",{className:"editor__warn",children:[r.jsxs("span",{children:["Файл изменился на диске",p?" — а здесь есть несохранённые правки.":"."]}),r.jsx("button",{className:"btn btn--sm",onClick:()=>o(a.path),children:"Взять с диска"}),p&&r.jsx("button",{className:"btn btn--sm btn--danger",onClick:()=>d(a.path),children:"Сохранить поверх"})]}),a.binary?r.jsxs("p",{className:"editor__empty",children:["Это не текстовый файл — редактировать его здесь нечем. ",oh(a.size)," на диске."]}):a.tooLarge?r.jsxs("p",{className:"editor__empty",children:["Файл слишком велик для редактора (",oh(a.size),"). Такие правит агент, а не браузер."]}):m&&a.previewMode?r.jsx(q1,{text:a.text}):r.jsx(H1,{path:a.path,doc:a.text,revision:a.revision,goto:l,onChange:i,onSave:c})]})}function q1({text:a}){const[l,i]=_.useState("");return _.useEffect(()=>{let c=!1;return $h(a).then(o=>{c||i(o)}),()=>{c=!0}},[a]),r.jsx("div",{className:"markdown-preview",dangerouslySetInnerHTML:{__html:l}})}function I1({files:a,activePath:l,busy:i,onSelect:c,onClose:o,zoomed:d,onToggleZoom:h}){return r.jsxs("div",{className:"worktabs",role:"tablist",onDoubleClick:p=>{h&&(p.target.closest("button")||h())},children:[r.jsxs("button",{className:"worktab"+(l===null?" is-on":""),role:"tab","aria-selected":l===null,onClick:()=>c(null),onDoubleClick:()=>h==null?void 0:h(),children:[r.jsx("span",{className:"worktab__name",children:"Разговор"}),i&&r.jsx("span",{className:"worktab__dot worktab__dot--busy",title:"Агент работает"})]}),a.map(p=>r.jsxs("div",{className:"worktab"+(p.path===l?" is-on":""),role:"tab","aria-selected":p.path===l,onDoubleClick:m=>{h&&(m.target.closest(".worktab__close, .worktab__dot")||h())},children:[r.jsx("button",{className:"worktab__name",title:p.path,onClick:()=>c(p.path),children:x1(p.path)}),Fa(p)?r.jsx("button",{className:"worktab__dot",title:"Не сохранено — закрыть","aria-label":`Закрыть ${p.path}`,onClick:()=>o(p.path)}):r.jsx("button",{className:"worktab__close",title:"Закрыть","aria-label":`Закрыть ${p.path}`,onClick:()=>o(p.path),children:"✕"})]},p.path)),r.jsx("div",{className:"worktabs__spacer"}),h&&r.jsx("button",{className:"worktabs__zoom",title:d?"Свернуть — то же самое, что двойной клик по вкладке":"Развернуть на весь экран — то же самое, что двойной клик по вкладке","aria-label":d?"Свернуть колонку разговора":"Развернуть колонку разговора на весь экран","aria-pressed":d,onClick:h,children:r.jsx(Ur,{active:d})})]})}const ly="ccv:sidebar.collapsed",ay="ccv:sidebar.mode",G1=500,$b="транскрипт остаётся на диске — сессию можно вернуть из архива в любой момент.";function Y1({open:a,connected:l,status:i,workspaces:c,sessions:o,archived:d,pinned:h,activeWorkspaceId:p,activeSessionId:m,onSelectWorkspace:x,onSelectSession:y,onRenameSession:j,onPinSessions:v,onSelectPinned:R,onCloseWorkspaces:w,onArchiveSessions:L,onUnarchiveSessions:B,onOpenWorkspace:P,onNewSession:M,onOpenExtensions:Q,account:k,onOpenAccount:Z,relay:z,onOpenRelay:A,onOpenSettings:V,themeMode:te,onCycleTheme:fe}){const[F,ae]=_.useState(null),[me,we]=_.useState(""),[ge,H]=_.useState($1),[ie,re]=_.useState(Q1);function ue(){re(E=>{const Y=E==="pinned"?"default":"pinned";try{localStorage.setItem(ay,Y)}catch{}return Y})}const _e=me.trim().toLowerCase(),T=_e!=="",K=_.useMemo(()=>T?c.filter(E=>E.name.toLowerCase().includes(_e)||E.path.toLowerCase().includes(_e)):c,[c,_e,T]),oe=_.useMemo(()=>T?o.filter(E=>(E.title??"").toLowerCase().includes(_e)):o,[o,_e,T]),pe=_.useMemo(()=>T?d.filter(E=>(E.title??"").toLowerCase().includes(_e)):d,[d,_e,T]),Ne=E=>{var Y;return((Y=c.find(ve=>ve.id===E))==null?void 0:Y.name)??"—"},ye=E=>{var Y;return(Y=c.find(ve=>ve.id===E))==null?void 0:Y.path},Ae=_.useMemo(()=>T?h.filter(E=>(E.title??"").toLowerCase().includes(_e)||Ne(E.workspaceId).toLowerCase().includes(_e)):h,[h,c,_e,T]);function st(E){H(Y=>{const ve=Y.includes(E)?Y.filter(D=>D!==E):[...Y,E];try{localStorage.setItem(ly,JSON.stringify(ve))}catch{}return ve})}const Qe=E=>!ge.includes(E),Ot=Zb(K),qe=Zb(oe),[yt,et]=_.useState(null),[Je,Fe]=_.useState(null),[it,Jn]=_.useState(null),Bt=_.useRef(null);function qt(E,Y){const ve=E.touches[0];if(!ve)return;const D={timer:0,x:ve.clientX,y:ve.clientY,el:E.currentTarget,fired:!1};D.timer=window.setTimeout(()=>{D.fired=!0,Y(D.x,D.y,D.el)},G1),Bt.current=D}function Kt(E){const Y=Bt.current,ve=E.touches[0];!Y||!ve||Math.hypot(ve.clientX-Y.x,ve.clientY-Y.y)>10&&(window.clearTimeout(Y.timer),Bt.current=null)}function It(E){const Y=Bt.current;Y&&(window.clearTimeout(Y.timer),Y.fired&&E.preventDefault())}function Gt(){var E;return(E=Bt.current)!=null&&E.fired?(Bt.current=null,!0):!1}function Qt(){const E=yt==null?void 0:yt.opener;et(null),E!=null&&E.isConnected&&E.focus()}function rt(){const E=Je==null?void 0:Je.opener;Fe(null),E!=null&&E.isConnected&&E.focus()}function Tt(){const E=it==null?void 0:it.opener;Jn(null),E!=null&&E.isConnected&&E.focus()}function en(E){return{onContextMenu:Y=>{Y.preventDefault(),et({x:Y.clientX,y:Y.clientY,opener:Y.currentTarget,ids:Ot.targetsFor(E)})},onTouchStart:Y=>qt(Y,(ve,D,J)=>et({x:ve,y:D,opener:J,ids:Ot.targetsFor(E)})),onTouchMove:Kt,onTouchEnd:It,onTouchCancel:It}}function En(E){return{onContextMenu:Y=>{Y.preventDefault(),Fe({x:Y.clientX,y:Y.clientY,opener:Y.currentTarget,ids:qe.targetsFor(E)})},onTouchStart:Y=>qt(Y,(ve,D,J)=>Fe({x:ve,y:D,opener:J,ids:qe.targetsFor(E)})),onTouchMove:Kt,onTouchEnd:It,onTouchCancel:It}}function Ct(E){return{onContextMenu:Y=>{Y.preventDefault(),Jn({x:Y.clientX,y:Y.clientY,opener:Y.currentTarget,ids:[E.id]})},onTouchStart:Y=>qt(Y,(ve,D,J)=>Jn({x:ve,y:D,opener:J,ids:[E.id]})),onTouchMove:Kt,onTouchEnd:It,onTouchCancel:It}}const kn=o.filter(E=>E.state!=="closed").length,An=yt?[{id:"close",label:yt.ids.length>1?`Закрыть проекты (${yt.ids.length})`:"Закрыть проект",onSelect:()=>{w(yt.ids),Ot.clear()}}]:[],Dt=yt?"закрытие не удаляет проект: каталог и история сессий остаются на диске — открыть его снова можно кнопкой «+ Проект»."+(p&&yt.ids.includes(p)&&kn>0?` в нём сейчас незавершённых сессий: ${kn} — при закрытии они остановятся на хосте.`:""):void 0,fn=Je?oe.find(E=>E.id===Je.ids[0]):void 0,Jt=(fn==null?void 0:fn.pinned)!==!0,Et=Je?[...Je.ids.length===1?[{id:"rename",label:"Переименовать",onSelect:()=>ae(Je.ids[0])}]:[],{id:"pin",label:Jt?Je.ids.length>1?`Закрепить (${Je.ids.length})`:"Закрепить":Je.ids.length>1?`Открепить (${Je.ids.length})`:"Открепить",onSelect:()=>{fn&&v(fn.workspaceId,Je.ids,Jt),qe.clear()}},{id:"archive",label:Je.ids.length>1?`Убрать в архив (${Je.ids.length})`:"Убрать в архив",onSelect:()=>{L(p,Je.ids),qe.clear()}}]:[],dn=Je?$b:void 0,ot=it?Ae.find(E=>E.id===it.ids[0]):void 0,tn=it?[{id:"rename",label:"Переименовать",onSelect:()=>ae(it.ids[0])},{id:"unpin",label:"Открепить",onSelect:()=>{ot&&v(ot.workspaceId,[ot.id],!1)}},{id:"archive",label:"Убрать в архив",onSelect:()=>{ot&&L(ot.workspaceId,[ot.id])}}]:[];return r.jsxs("aside",{className:a?"sidebar sidebar--open":"sidebar",children:[r.jsxs("div",{className:"sidebar__head",children:[r.jsx("span",{className:l?"dot dot--on":"dot",title:i}),r.jsx("span",{className:"brand",children:"Claude Code Visual"}),r.jsx("button",{className:"theme-btn","aria-pressed":ie==="pinned",title:ie==="pinned"?"Показать все проекты и сессии":"Показать только закреплённые","aria-label":ie==="pinned"?"Панель закреплённых сессий включена. Показать все проекты и сессии":"Показать только закреплённые сессии",onClick:ue,children:r.jsx(sy,{})}),r.jsx("button",{className:"theme-btn",title:`Тема: ${Kb[te]}`,"aria-label":`Тема: ${Kb[te]}. Переключить`,onClick:fe,children:r.jsx(Z1,{mode:te})})]}),r.jsxs("div",{className:"fssearch fssearch--sidebar",children:[r.jsx(V1,{}),r.jsx("input",{className:"fssearch__input",type:"text",value:me,spellCheck:!1,placeholder:"Проект или сессия…","aria-label":"Поиск по проектам и сессиям",onChange:E=>we(E.target.value),onKeyDown:E=>{E.stopPropagation(),E.key==="Escape"&&(E.preventDefault(),me?we(""):E.currentTarget.blur())}}),me&&r.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>we(""),children:"✕"})]}),r.jsx("div",{className:"sidebar__scroll",children:ie==="pinned"?r.jsxs(r.Fragment,{children:[Ae.length===0&&r.jsx("div",{className:"row",children:r.jsx("span",{className:"row__meta",children:T?"Ничего не найдено":"закрепите сессию через её меню (правый клик или долгое нажатие) — она останется под рукой из любого проекта"})}),Ae.map(E=>r.jsx("div",{className:E.id===m?"row row--active":"row",...F===E.id?{}:{title:"Действия со строкой — правый клик или долгое нажатие",...Ct(E)},children:F===E.id?r.jsx("div",{className:"row__main",children:r.jsx(Zc,{value:E.title??"",onCommit:Y=>{j(E,Y),ae(null)},onCancel:()=>ae(null)})}):r.jsxs("button",{className:"row__main",onClick:()=>{Gt()||R(E)},children:[r.jsx(dh,{title:E.title??"Без названия",pinned:!1,projectName:Ne(E.workspaceId),projectPath:ye(E.workspaceId)}),r.jsx(Jb,{session:E,tail:new Date(E.updatedAt).toLocaleString()})]})},E.id))]}):r.jsxs(r.Fragment,{children:[r.jsx(fh,{title:"Проекты",count:K.length,open:Qe("workspaces"),onToggle:()=>st("workspaces")}),Qe("workspaces")&&r.jsxs(r.Fragment,{children:[K.length===0&&r.jsx("div",{className:"row",children:r.jsx("span",{className:"row__meta",children:T?"Ничего не найдено":"Пока ни одного"})}),K.map(E=>r.jsx("div",{className:Qb(E.id===p,Ot.selected.includes(E.id)),...en(E),children:r.jsxs("button",{className:"row__main",onClick:Y=>{Gt()||Ot.click(Y,E,()=>x(E.id))},children:[r.jsxs("span",{className:"row__title",children:[E.name,E.hasClaudeMd&&" ·"]}),r.jsx("span",{className:"row__meta",title:E.path,children:E.path})]})},E.id))]}),p&&r.jsxs(r.Fragment,{children:[r.jsx(fh,{title:"Сессии",count:oe.length,open:Qe("sessions"),onToggle:()=>st("sessions")}),Qe("sessions")&&r.jsxs(r.Fragment,{children:[oe.length===0&&r.jsx("div",{className:"row",children:r.jsx("span",{className:"row__meta",children:T?"Ничего не найдено":"Пока ни одной"})}),oe.map(E=>r.jsx("div",{className:Qb(E.id===m,qe.selected.includes(E.id)),...F===E.id?{}:En(E),children:F===E.id?r.jsx("div",{className:"row__main",children:r.jsx(Zc,{value:E.title??"",onCommit:Y=>{j(E,Y),ae(null)},onCancel:()=>ae(null)})}):r.jsxs(r.Fragment,{children:[r.jsxs("button",{className:"row__main",onClick:Y=>{Gt()||qe.click(Y,E,()=>y(E))},children:[r.jsx(dh,{title:E.title??"Без названия",pinned:E.pinned===!0,projectName:Ne(E.workspaceId),projectPath:ye(E.workspaceId)}),r.jsx(Jb,{session:E,tail:new Date(E.updatedAt).toLocaleString()})]}),r.jsx("button",{className:"row__edit",title:"Переименовать","aria-label":"Переименовать сессию",onClick:()=>{Gt()||ae(E.id)},children:"✎"})]})},E.id))]}),d.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(fh,{title:"Архив",count:pe.length,open:Qe("archive"),onToggle:()=>st("archive"),hint:"сессии без обращения дольше двух суток уезжают сюда сами; ничего не удаляется"}),Qe("archive")&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"row",children:r.jsx("span",{className:"row__meta",children:"сюда сами уезжают сессии без обращения дольше двух суток; транскрипт остаётся на диске, ничего не удаляется"})}),pe.length===0&&r.jsx("div",{className:"row",children:r.jsx("span",{className:"row__meta",children:T?"Ничего не найдено":"Пока пусто"})}),pe.map(E=>r.jsxs("div",{className:E.id===m?"row row--active":"row",children:[r.jsxs("button",{className:"row__main",onClick:()=>y(E),children:[r.jsx(dh,{title:E.title??"Без названия",pinned:!1,projectName:Ne(E.workspaceId),projectPath:ye(E.workspaceId)}),r.jsx("span",{className:"row__meta",children:P1(E)})]}),r.jsx("button",{className:"row__restore",title:"Вернуть сессию из архива",onClick:()=>B([E.id]),children:"Вернуть"})]},E.id))]})]})]})]})}),r.jsxs("div",{className:"sidebar__foot",children:[r.jsxs("button",{className:"account-btn sidebar__wide",title:"Аккаунт Claude",onClick:Z,children:[r.jsx("span",{className:k!=null&&k.loggedIn?"dot dot--on":"dot"}),r.jsx("span",{className:"account-btn__id",children:k===null?"Аккаунт":k.loggedIn?k.email||"Вход выполнен":"Войти в аккаунт"}),(k==null?void 0:k.plan)&&r.jsx("span",{className:"chip",children:k.plan})]}),A&&r.jsxs("button",{className:"account-btn sidebar__wide",title:"Доступ с телефона и из браузера",onClick:A,children:[r.jsx("span",{className:z!=null&&z.connected?"dot dot--on":"dot"}),r.jsx("span",{className:"account-btn__id",children:z===null?"Удалённый доступ":z.paired?z.connected?z.name||"Удалённый доступ включён":"Удалённый доступ · нет связи":"Удалённый доступ"}),(z==null?void 0:z.connected)&&z.clients>0&&r.jsx("span",{className:"chip",children:z.clients})]}),r.jsx("button",{className:"btn btn--ghost sidebar__wide",disabled:!Q,title:"MCP-серверы и плагины",onClick:()=>Q==null?void 0:Q(),children:"Расширения"}),r.jsx("button",{className:"btn btn--ghost sidebar__wide",title:"Настройки приложения",onClick:V,children:"Настройки"}),r.jsx("button",{className:"btn btn--ghost",onClick:P,children:"+ Проект"}),r.jsx("button",{className:"btn btn--primary",onClick:M,disabled:!p,children:"+ Сессия"})]}),yt&&r.jsx(Gc,{x:yt.x,y:yt.y,items:An,note:Dt,onClose:Qt}),Je&&r.jsx(Gc,{x:Je.x,y:Je.y,items:Et,note:dn,onClose:rt}),it&&r.jsx(Gc,{x:it.x,y:it.y,items:tn,note:$b,onClose:Tt})]})}function Qb(a,l){const i=["row"];return a&&i.push("row--active"),l&&i.push("row--selected"),i.join(" ")}function Zb(a){const[l,i]=_.useState([]),c=_.useRef(null);function o(){i([]),c.current=null}function d(p,m,x){if(p.ctrlKey||p.metaKey){i(y=>y.includes(m.id)?y.filter(j=>j!==m.id):[...y,m.id]),c.current=m.id;return}if(p.shiftKey&&c.current){const y=a.findIndex(v=>v.id===c.current),j=a.findIndex(v=>v.id===m.id);if(y!==-1&&j!==-1){const[v,R]=y<j?[y,j]:[j,y];i(a.slice(v,R+1).map(w=>w.id));return}}o(),c.current=m.id,x()}function h(p){return l.includes(p.id)?l:(i([p.id]),c.current=p.id,[p.id])}return{selected:l,click:d,targetsFor:h,clear:o}}function fh({title:a,count:l,open:i,onToggle:c,hint:o}){const d=i?`Свернуть «${a}»`:`Развернуть «${a}»`;return r.jsxs("button",{className:"sidebar__section sidebar__section--btn","aria-expanded":i,title:o?`${d} — ${o}`:d,onClick:c,children:[r.jsx(X1,{open:i}),r.jsx("span",{className:"sidebar__section-name",children:a}),r.jsx("span",{className:"sidebar__count",children:l})]})}function X1({open:a}){return r.jsx("svg",{className:a?"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:r.jsx("path",{d:"M6 3.5 10.5 8 6 12.5"})})}function sy({className:a}){return r.jsxs("svg",{className:a,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("rect",{x:"4.5",y:"2.4",width:"7",height:"4.2",rx:"1.6"}),r.jsx("path",{d:"M5.4 6.6 8 12.2 10.6 6.6"}),r.jsx("path",{d:"M8 12.2v1.4"})]})}function V1(){return r.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[r.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),r.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}function $1(){try{const a=localStorage.getItem(ly);if(a===null)return["archive"];const l=JSON.parse(a);return Array.isArray(l)?l.filter(i=>i==="workspaces"||i==="sessions"||i==="archive"):["archive"]}catch{return["archive"]}}function Q1(){try{return localStorage.getItem(ay)==="pinned"?"pinned":"default"}catch{return"default"}}const Kb={system:"как в системе",light:"светлая",dark:"тёмная"};function Z1({mode:a}){const l={viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};return a==="dark"?r.jsx("svg",{...l,children:r.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"})}):a==="light"?r.jsxs("svg",{...l,children:[r.jsx("circle",{cx:"8",cy:"8",r:"3.1"}),r.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"})]}):r.jsxs("svg",{...l,children:[r.jsx("rect",{x:"1.8",y:"2.6",width:"12.4",height:"8.4",rx:"1.4"}),r.jsx("path",{d:"M5.6 13.4h4.8"})]})}function K1(a){switch(a.state){case"running":return"работает";case"waiting_permission":return"ждёт разрешения";case"idle":return J1(a.lastTurn);case"starting":return"запускается";case"reconnecting":return"переподключается";case"error":return"ошибка";case"closed":return"на диске"}}function J1(a){switch(a){case"interrupted":return"прервана";case"stopped":return"остановлена";case"failed":return"оборвалась";case"completed":return"готова";case null:return"ждёт задачу"}}function F1(a){switch(a.state){case"running":return"running";case"starting":return"starting";case"reconnecting":return"reconnecting";case"waiting_permission":return"waiting";case"idle":return W1(a.lastTurn);case"error":return"error";case"closed":return"closed"}}function W1(a){switch(a){case"interrupted":case"stopped":return"halted";case"failed":return"error";case"completed":return"ready";case null:return"fresh"}}function Jb({session:a,tail:l}){return r.jsxs("span",{className:"row__meta",children:[r.jsxs("span",{className:`row__state row__state--${F1(a)}`,children:[r.jsx("span",{className:"row__state-dot","aria-hidden":"true"}),K1(a)]})," · ",l]})}function dh({title:a,pinned:l,projectName:i,projectPath:c}){return r.jsxs("span",{className:"row__head",children:[r.jsxs("span",{className:"row__title",children:[l&&r.jsx(sy,{className:"row__pin"}),a]}),r.jsx("span",{className:"row__project",title:c,children:i})]})}function P1(a){const l=a.archivedAuto?"сама, по сроку молчания":"убрана вручную";return a.archivedAt?`${new Date(a.archivedAt).toLocaleString()} · ${l}`:l}const Fb=3,eS=15e5;function iy(a,l){if(!l||typeof l!="object")return null;const i=l,c=typeof i.file_path=="string"?i.file_path:"";if(!c)return null;if(a==="Write"){if(typeof i.content!="string")return null;const o=hh(i.content).map(d=>({type:"add",text:d}));return{kind:"create",filePath:c,rows:o,added:o.length,removed:0,note:"файл записывается целиком"}}if(a==="Edit"){if(typeof i.old_string!="string"||typeof i.new_string!="string")return null;const o=aS(tS(hh(i.old_string),hh(i.new_string)));return{kind:"edit",filePath:c,rows:o,added:o.filter(d=>d.type==="add").length,removed:o.filter(d=>d.type==="del").length,note:i.replace_all===!0?"все вхождения":null}}return null}function hh(a){if(a==="")return[];const l=a.split(/\r?\n/);return l.length>1&&l[l.length-1]===""&&l.pop(),l}function tS(a,l){let i=0;for(;i<a.length&&i<l.length&&a[i]===l[i];)i++;let c=a.length,o=l.length;for(;c>i&&o>i&&a[c-1]===l[o-1];)c--,o--;const d=h=>({type:"ctx",text:h});return[...a.slice(0,i).map(d),...nS(a.slice(i,c),l.slice(i,o)),...a.slice(c).map(d)]}function nS(a,l){if(a.length===0&&l.length===0)return[];if(a.length===0)return l.map(y=>({type:"add",text:y}));if(l.length===0)return a.map(y=>({type:"del",text:y}));if((a.length+1)*(l.length+1)>eS)return[...a.map(y=>({type:"del",text:y})),...l.map(y=>({type:"add",text:y}))];const i=a.length,c=l.length,o=c+1,d=new Uint32Array((i+1)*o),h=(y,j)=>d[y*o+j]??0;for(let y=i-1;y>=0;y--)for(let j=c-1;j>=0;j--)d[y*o+j]=a[y]===l[j]?h(y+1,j+1)+1:Math.max(h(y+1,j),h(y,j+1));const p=[];let m=0,x=0;for(;m<i&&x<c;){const y=a[m],j=l[x];y===j?(p.push({type:"ctx",text:y}),m++,x++):h(m+1,x)>=h(m,x+1)?(p.push({type:"del",text:y}),m++):(p.push({type:"add",text:j}),x++)}for(;m<i;)p.push({type:"del",text:a[m++]});for(;x<c;)p.push({type:"add",text:l[x++]});return lS(p)}function lS(a){const l=[];let i=[];function c(){l.push(...i.filter(o=>o.type==="del")),l.push(...i.filter(o=>o.type==="add")),i=[]}for(const o of a)o.type==="ctx"?(c(),l.push(o)):i.push(o);return c(),l}function aS(a){if(!a.some(d=>d.type!=="ctx"))return a;const l=a.map(()=>!1);a.forEach((d,h)=>{if(d.type!=="ctx")for(let p=Math.max(0,h-Fb);p<=Math.min(a.length-1,h+Fb);p++)l[p]=!0});const i=[];let c=[];function o(){c.length===1?i.push(...c):c.length>1&&i.push({type:"gap",text:`⋯ ${c.length} ${sS(c.length)} без изменений`}),c=[]}return a.forEach((d,h)=>{l[h]?(o(),i.push(d)):c.push(d)}),o(),i}function sS(a){const l=a%100;if(l>=11&&l<=14)return"строк";switch(a%10){case 1:return"строка";case 2:case 3:case 4:return"строки";default:return"строк"}}async function Zo(a){try{return await navigator.clipboard.writeText(a),!0}catch{}const l=document.createElement("textarea");l.value=a,l.setAttribute("readonly",""),l.style.position="fixed",l.style.opacity="0",document.body.appendChild(l);try{return l.select(),document.execCommand("copy")}catch{return!1}finally{l.remove()}}async function iS(){try{return await navigator.clipboard.readText()}catch{return null}}const Qh=1600,Di="Копировать",wr="Скопировано";function Zh({text:a,hint:l,className:i}){const[c,o]=_.useState(!1);return _.useEffect(()=>{if(!c)return;const d=setTimeout(()=>o(!1),Qh);return()=>clearTimeout(d)},[c]),_.useEffect(()=>o(!1),[a]),r.jsx("button",{type:"button",className:"copybtn"+(c?" copybtn--done":"")+(i?` ${i}`:""),"aria-label":c?wr:`${Di} ${l}`,title:c?wr:`${Di} ${l}`,onClick:()=>{Zo(a).then(d=>{d&&o(!0)})},children:c?wr:Di})}function Kh({diff:a}){return r.jsxs("div",{className:"diff",children:[r.jsxs("div",{className:"diff__head",children:[r.jsx("span",{className:"diff__path",title:a.filePath,children:a.filePath}),r.jsxs("span",{className:"diff__stat",children:[a.added>0&&r.jsxs("span",{className:"diff__stat--add",children:["+",a.added]}),a.removed>0&&r.jsxs("span",{className:"diff__stat--del",children:["−",a.removed]})]})]}),a.note&&r.jsx("div",{className:"diff__note",children:a.note}),r.jsx("div",{className:"diff__body",children:a.rows.length===0?r.jsx("div",{className:"diff__row diff__row--gap",children:r.jsx("span",{className:"diff__text",children:"пустое содержимое"})}):a.rows.map((l,i)=>r.jsxs("div",{className:`diff__row diff__row--${l.type}`,children:[r.jsx("span",{className:"diff__mark","aria-hidden":"true",children:l.type==="add"?"+":l.type==="del"?"−":""}),r.jsx("span",{className:"diff__text",children:l.text===""?" ":l.text})]},i))})]})}function rS({waiting:a}){const[l,i]=_.useState(0);return _.useEffect(()=>{const c=window.setInterval(()=>i(o=>o+1),1e3);return()=>window.clearInterval(c)},[]),r.jsxs("div",{className:a?"work work--wait":"work",children:[r.jsxs("span",{className:"work__dots","aria-hidden":"true",children:[r.jsx("span",{className:"work__dot"}),r.jsx("span",{className:"work__dot"}),r.jsx("span",{className:"work__dot"})]}),r.jsx("span",{className:"work__label",children:a?"ждёт разрешения":"думает"}),!a&&r.jsxs("span",{className:"work__time",children:[l," с"]})]})}function Jh({items:a,busy:l,waiting:i,history:c=[],historyHasMore:o=!1,historyLoading:d=!1,onLoadHistory:h,sessionId:p,onEditMessage:m,empty:x="Сессия пуста. Опишите задачу — Claude Code работает в каталоге проекта с полным набором инструментов."}){const y=_.useRef(null),j=_.useRef(null),v=_.useRef(!0),R=_.useRef(null),w=_.useRef(null),L=_.useRef(!1);_.useEffect(()=>{v.current=!0,R.current=null,L.current=!1,w.current!==null&&(clearTimeout(w.current),w.current=null)},[p]),_.useEffect(()=>{const k=y.current,Z=j.current;if(!k||!Z)return;function z(te){!k||te===k.scrollTop||(L.current=!0,k.scrollTop=te)}function A(){if(!k)return;const te=R.current;if(te){const fe=Pb(k,te.id);if(fe){const F=fe.getBoundingClientRect().top-k.getBoundingClientRect().top;z(k.scrollTop+(F-te.top))}w.current!==null&&clearTimeout(w.current),w.current=setTimeout(()=>{R.current=null},500);return}v.current&&z(k.scrollHeight)}const V=new ResizeObserver(A);return V.observe(Z),()=>{V.disconnect(),w.current!==null&&clearTimeout(w.current)}},[]);function B(){const k=y.current;if(k){if(L.current){L.current=!1;return}v.current=k.scrollHeight-k.scrollTop-k.clientHeight<80}}function P(){if(d)return;const k=y.current,Z=c[0];if(k&&Z){const z=Pb(k,Z.id);z&&(R.current={id:Z.id,top:z.getBoundingClientRect().top-k.getBoundingClientRect().top})}h==null||h()}let M=0;function Q(k){return k.kind==="user"?M++:-1}return r.jsx("div",{className:"transcript",ref:y,onScroll:B,children:r.jsxs("div",{className:"stream",ref:j,children:[o&&r.jsx("button",{type:"button",className:"transcript__more",onClick:P,disabled:d,children:d?"Загружаем…":"Показать более раннее"}),c.map(k=>r.jsx(Wb,{item:k,userIndex:Q(k),onEditMessage:m},k.id)),c.length>0&&a.length>0&&r.jsx("div",{className:"transcript__divider",children:r.jsx("span",{children:"дальше — сессия открыта заново"})}),c.length===0&&a.length===0&&r.jsx("p",{className:"empty",children:x}),a.map(k=>r.jsx(Wb,{item:k,userIndex:Q(k),onEditMessage:m},k.id)),l&&r.jsx(rS,{waiting:i})]})})}function Wb({item:a,userIndex:l,onEditMessage:i}){switch(a.kind){case"user":return r.jsx(uS,{item:a,userIndex:l,onEditMessage:i});case"assistant":return r.jsxs("div",{className:"msg--assistant","data-item-id":a.id,children:[r.jsx(oS,{text:a.text}),a.streaming&&r.jsx("span",{className:"caret"}),a.text.trim()!==""&&r.jsx("div",{className:"msg--assistant__foot",children:r.jsx(Zh,{text:a.text,hint:"ответ целиком"})})]});case"thinking":return r.jsx("div",{className:"thinking","data-item-id":a.id,children:a.text});case"tool":return r.jsx(dS,{item:a});case"result":return r.jsxs("div",{className:"result-line","data-item-id":a.id,children:[r.jsx("span",{children:a.isError?"✗ "+a.subtype:"✓ готово"}),r.jsxs("span",{children:[(a.durationMs/1e3).toFixed(1)," с"]}),a.costUsd!==null&&r.jsxs("span",{children:["$",a.costUsd.toFixed(4)]}),r.jsxs("span",{children:["↑",tx(a.inputTokens)," ↓",tx(a.outputTokens)]})]});case"notice":return r.jsx("div",{className:a.tone==="error"?"notice notice--error":"notice","data-item-id":a.id,children:a.text})}}const cS=500;function uS({item:a,userIndex:l,onEditMessage:i}){const[c,o]=_.useState(null),[d,h]=_.useState(!1),[p,m]=_.useState(a.text),x=_.useRef(null),y=Vo("(max-width: 860px)"),j=_.useRef(null);function v(A,V){o({x:A,y:V})}function R(A){A.preventDefault(),v(A.clientX,A.clientY)}function w(A){const V=A.touches[0];if(!V)return;const te={timer:0,x:V.clientX,y:V.clientY,fired:!1};te.timer=window.setTimeout(()=>{te.fired=!0,v(te.x,te.y)},cS),j.current=te}function L(A){const V=j.current,te=A.touches[0];!V||!te||Math.hypot(te.clientX-V.x,te.clientY-V.y)>10&&(window.clearTimeout(V.timer),j.current=null)}function B(A){const V=j.current;V&&(window.clearTimeout(V.timer),V.fired&&A.preventDefault())}function P(){m(a.text),h(!0)}function M(){h(!1)}function Q(){const A=p.trim();A===""&&!(a.images&&a.images.length>0)||(i==null||i(l,A,a.images),h(!1))}_.useEffect(()=>{const A=x.current;!A||!d||(A.style.height="auto",A.style.height=`${A.scrollHeight}px`)},[p,d]),_.useEffect(()=>{if(!d)return;const A=x.current;A&&(A.focus(),A.setSelectionRange(A.value.length,A.value.length))},[d]);function k(A){if(A.key==="Escape"){A.preventDefault(),A.stopPropagation(),M();return}A.key==="Enter"&&!A.shiftKey&&!y&&(A.preventDefault(),Q())}const Z=a.images&&a.images.length>0&&r.jsx("div",{className:"msg--user__images",children:a.images.map((A,V)=>r.jsx("img",{className:"msg--user__image",src:`data:${A.mediaType};base64,${A.data}`,alt:"Вложение"},V))});if(d){const A=p.trim()!==""||!!(a.images&&a.images.length>0);return r.jsxs("div",{className:"msg--user msg--user--editing","data-item-id":a.id,children:[Z,r.jsxs("div",{className:"msg--user__edit",children:[r.jsx("textarea",{ref:x,className:"msg--user__edit-field",value:p,onChange:V=>m(V.target.value),onKeyDown:k,rows:1}),r.jsxs("div",{className:"msg--user__edit-actions",children:[r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:M,children:"Отмена"}),r.jsx("button",{type:"button",className:"btn btn--sm btn--primary",onClick:Q,disabled:!A,children:"Сохранить"})]})]})]})}const z=[{id:"copy",label:"Копировать",onSelect:()=>void Zo(a.text)},...i?[{id:"edit",label:"Изменить",onSelect:P}]:[]];return r.jsxs("div",{className:"msg--user","data-item-id":a.id,onContextMenu:R,onTouchStart:w,onTouchMove:L,onTouchEnd:B,onTouchCancel:B,children:[Z,a.text,c&&r.jsx(Gc,{x:c.x,y:c.y,items:z,onClose:()=>o(null)})]})}function Pb(a,l){const i=a.querySelectorAll("[data-item-id]");for(const c of i)if(c.dataset.itemId===l)return c;return null}function oS({text:a}){const[l,i]=_.useState(""),c=_.useRef([]);_.useEffect(()=>{let d=!1;return $h(a).then(h=>{d||i(fS(h))}),()=>{d=!0}},[a]),_.useEffect(()=>{const d=c.current;return()=>d.forEach(h=>clearTimeout(h))},[]);function o(d){var m,x;const h=d.target.closest(".codeblock__copy");if(!(h instanceof HTMLElement))return;const p=((x=(m=h.parentElement)==null?void 0:m.querySelector("pre"))==null?void 0:x.textContent)??"";p!==""&&Zo(p).then(y=>{if(!y)return;h.textContent=wr,h.setAttribute("aria-label",wr),h.classList.add("copybtn--done");const j=window.setTimeout(()=>{h.isConnected&&(h.textContent=Di,h.setAttribute("aria-label",Rh),h.classList.remove("copybtn--done"))},Qh);c.current.push(j)})}return r.jsx("div",{className:"markdown-preview msg--assistant__body",onClick:o,dangerouslySetInnerHTML:{__html:l}})}const Rh=`${Di} блок кода`;function fS(a){if(!a.includes("<pre"))return a;const l=new DOMParser().parseFromString(a,"text/html");for(const i of l.body.querySelectorAll("pre")){const c=l.createElement("div");c.className="codeblock",i.replaceWith(c),c.append(i);const o=l.createElement("button");o.type="button",o.className="copybtn codeblock__copy",o.setAttribute("aria-label",Rh),o.title=Rh,o.textContent=Di,c.append(o)}return l.body.innerHTML}function dS({item:a}){const[l,i]=_.useState(!1),c=a.result===null,o=iy(a.name,a.input),d=a.name==="AskUserQuestion"?mS(a.input):null;return r.jsxs("div",{className:"tool"+(a.isError?" tool--error":"")+(a.awaitingPermission?" tool--wait":""),"data-item-id":a.id,children:[r.jsxs("button",{className:"tool__head",onClick:()=>i(h=>!h),children:[r.jsx("span",{className:"tool__name",children:a.name}),r.jsx("span",{className:"tool__arg",children:d?pS(d):hS(a.input)}),r.jsx("span",{className:"tool__status",children:c?"…":a.isError?"ошибка":l?"▴":"▾"})]}),l&&r.jsxs("div",{className:"tool__body",children:[d?r.jsx(gS,{questions:d,answers:a.answers}):o?r.jsx(Kh,{diff:o}):r.jsx(ex,{text:JSON.stringify(a.input,null,2),hint:"аргументы вызова"}),a.result!==null&&(!d||a.isError)&&r.jsx(ex,{text:a.result,hint:"результат вызова",style:{marginTop:10}})]})]})}function ex({text:a,hint:l,style:i}){return r.jsxs("div",{className:"codeblock",style:i,children:[r.jsx("pre",{className:"code",children:a}),r.jsx(Zh,{text:a,hint:l,className:"codeblock__copy"})]})}function hS(a){if(!a||typeof a!="object")return"";const l=a;for(const i of["file_path","command","pattern","path","url","prompt"]){const c=l[i];if(typeof c=="string")return c.replace(/\s+/g," ").slice(0,160)}return JSON.stringify(l).slice(0,160)}function pS(a){var i;const l=a.map(c=>c.header).filter(c=>c.length>0);return l.length===a.length?l.join(" · "):((i=a[0])==null?void 0:i.question.replace(/\s+/g," ").slice(0,160))??""}function mS(a){if(typeof a!="object"||a===null)return null;const l=a.questions;if(!Array.isArray(l)||l.length===0)return null;const i=[];for(const c of l){if(typeof c!="object"||c===null)return null;const{question:o,header:d,options:h,multiSelect:p}=c;if(typeof o!="string"||!Array.isArray(h)||h.length===0)return null;const m=[];for(const x of h){if(typeof x!="object"||x===null)return null;const{label:y,description:j,preview:v}=x;if(typeof y!="string"||typeof j!="string")return null;m.push({label:y,description:j,...typeof v=="string"?{preview:v}:{}})}i.push({question:o,header:typeof d=="string"?d:"",options:m,multiSelect:p===!0})}return i}function gS({questions:a,answers:l}){return r.jsx("div",{className:"tool__questions",children:a.map((i,c)=>r.jsxs("div",{className:"tool__question",children:[r.jsxs("div",{className:"tool__question-head",children:[i.header&&r.jsx("span",{className:"chip chip--accent",children:i.header}),r.jsx("span",{className:"tool__question-text",children:i.question})]}),r.jsx("div",{className:"tool__question-answer",children:l!=null&&l[i.question]?r.jsx("span",{className:"tool__answer-value",children:l[i.question]}):r.jsx("span",{className:"tool__answer-empty",children:"не отвечено"})})]},c))})}function tx(a){return a>=1e3?`${(a/1e3).toFixed(1)}k`:String(a)}const bS="ccv.dictation.lang",nx="ru-RU";function xS(a){try{return Function.prototype.toString.call(a).includes("[native code]")}catch{return!1}}function lx(){const a=window,l=[a.SpeechRecognition,a.webkitSpeechRecognition].filter(c=>typeof c=="function"),i=l.find(xS);return!i&&l.length>0&&Vl("распознавание подменено: родной реализации в странице нет"),i??l[0]??null}function ry(){var a;try{return((a=localStorage.getItem(bS))==null?void 0:a.trim())||nx}catch{return nx}}function Vl(a,l){l===void 0?console.debug(`[dictation] ${a}`):console.debug(`[dictation] ${a}`,l)}const yS=3,_S=400,vS=5,SS=250,jS=2e3,kS=2e4;async function NS(){try{return(await navigator.permissions.query({name:"microphone"})).state==="granted"}catch{return!1}}const wS={"not-allowed":"Браузер не дал доступ к микрофону","service-not-allowed":"Браузер не дал доступ к микрофону","audio-capture":"Микрофон не найден",network:"Сервис распознавания недоступен","language-not-supported":`Распознавание не знает языка ${ry()}`};function TS(a){const[l]=_.useState(()=>lx()!==null),[i,c]=_.useState(!1),[o,d]=_.useState(null),h=_.useRef(null),p=_.useRef(!1),m=_.useRef(!1),x=_.useRef(a),y=_.useRef({openedAt:0,audio:!1,heard:!1,everHeard:!1,silent:0,dead:0,lastError:"",warned:!1}),j=_.useRef(null),v=_.useRef(!1),R=_.useRef(null),w=_.useCallback(()=>{R.current&&clearTimeout(R.current),R.current=null},[]),L=_.useCallback(()=>{w();const k=async Z=>{if(R.current=null,!(!p.current||v.current)){if(!Z&&!await NS()){if(Vl("ждём ответа на запрос доступа к микрофону"),!p.current||v.current)return;R.current=setTimeout(()=>void k(!0),kS);return}Vl("движок не ответил на start()"),p.current=!1,c(!1),d("Распознавание не отвечает — проверьте расширения браузера и доступ к микрофону")}};R.current=setTimeout(()=>void k(!1),jS)},[w]);_.useEffect(()=>{x.current=a}),_.useEffect(()=>{const k=lx();if(!k)return;const Z=new k;return Z.lang=ry(),Z.continuous=!0,Z.interimResults=!0,Z.onstart=()=>{Vl("сессия открыта"),v.current=!0,w(),c(!0)},Z.onaudiostart=()=>{Vl("пошёл звук с микрофона"),y.current.audio=!0},Z.onresult=z=>{var fe;if(m.current)return;let A="",V="";for(let F=z.resultIndex;F<z.results.length;F++){const ae=z.results[F];if(!ae)continue;const me=((fe=ae[0])==null?void 0:fe.transcript)??"";ae.isFinal?A+=me:V+=me}const te=y.current;te.heard=!0,te.everHeard=!0,Vl("распознано",{final:A,interim:V}),x.current(A,V)},Z.onerror=z=>{y.current.lastError=z.error,Vl("ошибка движка",z.error),!(z.error==="no-speech"||z.error==="aborted")&&(p.current=!1,c(!1),d(wS[z.error]??`Распознавание не работает: ${z.error}`))},Z.onend=()=>{m.current=!1,v.current=!1;const z=y.current,A=Date.now()-z.openedAt;if(Vl("сессия закрыта",{мс:A,звук:z.audio,слова:z.heard,ошибка:z.lastError||null}),!p.current){c(!1);return}if(z.dead=!z.audio&&A<_S?z.dead+1:0,z.dead>=vS){p.current=!1,c(!1),d(z.lastError?`Распознавание не работает: ${z.lastError}`:"Распознавание закрывается сразу после запуска — проверьте доступ к микрофону в настройках сайта");return}z.silent=z.heard?0:z.silent+1,!z.everHeard&&!z.warned&&z.silent>=yS&&(z.warned=!0,d(z.audio?"Микрофон слушает, но речь не распознаётся — проверьте язык диктовки и уровень звука":"С микрофона не идёт звук — проверьте устройство ввода в настройках сайта в браузере")),j.current=setTimeout(()=>{if(j.current=null,!!p.current){z.openedAt=Date.now(),z.audio=!1,z.heard=!1,z.lastError="",L();try{Z.start()}catch{}}},SS)},h.current=Z,()=>{p.current=!1,j.current&&clearTimeout(j.current),j.current=null,w(),Z.onend=null,Z.onresult=null,Z.onerror=null,Z.onstart=null,Z.onaudiostart=null,Z.abort(),h.current=null}},[]);const B=_.useCallback(()=>{var k;if(p.current){if(p.current=!1,Vl("выключение микрофона"),j.current&&clearTimeout(j.current),j.current=null,w(),!v.current){c(!1);return}(k=h.current)==null||k.stop()}},[]),P=_.useCallback(()=>{const k=h.current;if(k){if(!window.isSecureContext){d("Микрофон доступен только по https или с localhost");return}d(null),p.current=!0,m.current=!1,j.current&&clearTimeout(j.current),j.current=null,y.current={openedAt:Date.now(),audio:!1,heard:!1,everHeard:!1,silent:0,dead:0,lastError:"",warned:!1},c(!0),Vl("включение микрофона",{язык:k.lang}),L();try{k.start()}catch(Z){Vl("start() не прошёл",Z)}}},[L]),M=_.useCallback(()=>{p.current?B():P()},[P,B]),Q=_.useCallback(()=>{var k;p.current&&v.current&&(m.current=!0,(k=h.current)==null||k.abort())},[]);return{supported:l,listening:i,error:o,toggle:M,stop:B,drop:Q}}const cy="ccv:drafts",ES=40,AS=2e4,CS=500;let Yc=null,Xc=null;function uy(){if(Yc)return Yc;const a=new Map;try{const l=localStorage.getItem(cy);if(l){const i=JSON.parse(l);if(typeof i=="object"&&i!==null)for(const[c,o]of Object.entries(i))typeof o=="string"&&o!==""&&a.set(c,o)}}catch{}return Yc=a,window.addEventListener("pagehide",oy),a}function ph(a){return uy().get(a)??""}function RS(a,l){const i=uy(),c=l.slice(0,AS),o=i.has(a);if(o&&i.delete(a),c!=="")i.set(a,c);else if(!o)return;for(;i.size>ES;){const d=i.keys().next();if(d.done)break;i.delete(d.value)}MS()}function MS(){Xc===null&&(Xc=window.setTimeout(oy,CS))}function oy(){if(Xc!==null&&window.clearTimeout(Xc),Xc=null,!!Yc)try{localStorage.setItem(cy,JSON.stringify(Object.fromEntries(Yc)))}catch{}}const OS="(max-width: 860px)",ax=/^\/(\S*)$/,DS=new Set(["model","permissions"]);function zS(a){return DS.has(a.name)||a.name.startsWith("__")}const LS=new Set(["clear","rename"]),sx=/(?:^|\s)@([^\s@]*)$/,US=200,HS=100,BS=190,qS=5,IS=20*1024*1024,GS=1568,YS=.85;let ix=0;async function XS(a){var j,v;if(!a.type.startsWith("image/")||a.size>IS)return null;const l=await VS(a);if(!l)return null;const{width:i,height:c}=l;if(i<=0||c<=0)return null;const o=Math.min(1,GS/Math.max(i,c)),d=document.createElement("canvas");d.width=Math.max(1,Math.round(i*o)),d.height=Math.max(1,Math.round(c*o));const h=d.getContext("2d");if(!h)return null;h.drawImage(l.image,0,0,d.width,d.height),(v=(j=l.image).close)==null||v.call(j);const p=a.type==="image/png",m=p?"image/png":"image/jpeg",x=d.toDataURL(m,p?void 0:YS),y=x.slice(x.indexOf(",")+1);return y?(ix+=1,{id:`att${ix}`,mediaType:m,data:y,previewUrl:x}):null}async function VS(a){if(typeof createImageBitmap=="function")try{const l=await createImageBitmap(a);return{image:l,width:l.width,height:l.height}}catch{}return new Promise(l=>{const i=URL.createObjectURL(a),c=new Image;c.onload=()=>{URL.revokeObjectURL(i),l({image:c,width:c.naturalWidth,height:c.naturalHeight})},c.onerror=()=>{URL.revokeObjectURL(i),l(null)},c.src=i})}function fy({disabled:a,busy:l,commands:i,sessionTitle:c,contextResult:o,className:d,placeholder:h,draftKey:p,sendLabel:m="Отправить",autoFocus:x=!1,attachmentsEnabled:y=!0,onContextSearch:j,onCommand:v,onSend:R,onInterrupt:w,onEscape:L}){var ve;const B=Vo(OS),[P,M]=_.useState(()=>p?ph(p):""),[Q,k]=_.useState(!1),[Z,z]=_.useState(0),A=_.useRef(null),V=_.useRef(null),te=_.useRef(null),[fe,F]=_.useState(()=>p?ph(p).length:0),[ae,me]=_.useState([]),we=_.useRef(null),ge=_.useCallback(D=>{!y||D.length===0||Promise.all(D.map(XS)).then(J=>{const xe=J.filter(Be=>Be!==null);xe.length!==0&&me(Be=>[...Be,...xe].slice(0,qS))})},[y]);function H(D){me(J=>J.filter(xe=>xe.id!==D))}function ie(D){var Be;if(!y)return;const J=(Be=D.clipboardData)==null?void 0:Be.items;if(!J)return;const xe=[];for(const ft of J){if(!ft.type.startsWith("image/"))continue;const Nn=ft.getAsFile();Nn&&xe.push(Nn)}xe.length!==0&&(D.preventDefault(),ge(xe))}function re(D){const J=D.target.files?Array.from(D.target.files):[];D.target.value="",ge(J)}_.useEffect(()=>{y||me([])},[y]);const[ue,_e]=_.useState([]),[T,K]=_.useState(-1),oe=_.useRef(""),[pe,Ne]=_.useState(""),ye=TS(_.useCallback((D,J)=>{D&&M(xe=>mh(xe,D)),Ne(J.trim())},[])),Ae=pe?mh(P,pe):P;_.useEffect(()=>{ye.listening||pe===""||(M(D=>mh(D,pe)),Ne(""))},[ye.listening,pe]),_.useEffect(()=>{var D;x&&((D=A.current)==null||D.focus())},[x]);const st=_.useRef(new Map),Qe=_.useRef(new Map),Ot=_.useRef(p),qe=_.useRef({text:P,caret:fe});qe.current={text:P,caret:fe};const yt=_.useCallback((D,J,xe)=>{J===""?(st.current.delete(D),Qe.current.delete(D)):(st.current.set(D,J),Qe.current.set(D,xe)),RS(D,J)},[]),et=ye.drop;_.useLayoutEffect(()=>{const D=Ot.current;if(D===p)return;Ot.current=p,D&&yt(D,qe.current.text,qe.current.caret);const J=p?st.current.get(p)??ph(p):"",xe=p?Qe.current.get(p):void 0,Be=Math.min(xe??J.length,J.length);M(J),F(Be),te.current=[Be,Be],Ne(""),z(0),k(!1),K(-1),oe.current="",me([]),et()},[p,yt,et]),_.useEffect(()=>{p&&yt(p,P,fe)},[p,P,fe,yt]);const Je=a?"Выберите сессию":h??"Опишите задачу… («/» — команды, «@» — файлы)",Fe=_.useRef(0),it=_.useCallback(D=>{const J=parseFloat(getComputedStyle(D).maxHeight),xe=Number.isFinite(J)&&J>0?J:BS;D.style.height="auto";const Be=D.scrollHeight;D.style.height=`${Math.min(Be,xe)}px`,D.style.overflowY=Be>xe?"auto":"hidden";const ft=te.current;ft&&(te.current=null,D.setSelectionRange(ft[0],ft[1]))},[]);_.useEffect(()=>{const D=A.current;D&&it(D)},[Ae,Je,a,it]),_.useEffect(()=>{const D=A.current;if(!D)return;const J=new ResizeObserver(([xe])=>{const Be=xe==null?void 0:xe.contentRect.width;Be===void 0||Math.abs(Be-Fe.current)<1||(Fe.current=Be,it(D))});return J.observe(D),()=>J.disconnect()},[it]);const Jn=ye.stop;_.useEffect(()=>{a&&Jn()},[a,Jn]);const Bt=_.useMemo(()=>ye.error?{ok:!1,message:ye.error}:null,[ye.error]),qt=_.useMemo(()=>{var xe;const D=(xe=ax.exec(P))==null?void 0:xe[1];if(D===void 0)return[];const J=D.toLowerCase();return i.filter(Be=>!zS(Be)&&gh(Be,J)<dy).sort((Be,ft)=>gh(Be,J)-gh(ft,J))},[P,i]),Kt=!Q&&qt.length>0,It=Math.min(Z,qt.length-1),Gt=Q?null:((ve=sx.exec(Ae.slice(0,fe)))==null?void 0:ve[1])??null,Qt=_.useRef(j);Qt.current=j,_.useEffect(()=>{if(Gt===null||Gt===""||Gt.endsWith("/")){Qt.current(Gt);return}const D=setTimeout(()=>Qt.current(Gt),US);return()=>clearTimeout(D)},[Gt]);const rt=Gt!==null&&(o==null?void 0:o.query)===Gt,Tt=rt?o.entries:[],en=Gt!==null,En=en&&!rt,Ct=Math.min(Z,Math.max(Tt.length-1,0));_.useEffect(()=>{var J,xe;if(!Kt&&!en)return;const D=Kt?It:Ct;(xe=(J=V.current)==null?void 0:J.children[D])==null||xe.scrollIntoView({block:"nearest"})},[Kt,en,It,Ct]);function kn(D,J){var xe;M(D),F(J),te.current=[J,J],z(0),k(!1),pe!==""&&(Ne(""),ye.drop()),(xe=A.current)==null||xe.focus()}function An(){M(""),Ne(""),z(0),F(0),k(!1),K(-1),oe.current="",me([]),ye.drop(),p&&yt(p,"",0)}function Dt(D){const J=D.trim();J===""&&ae.length===0||a||(R(J,ae.length>0?ae.map(xe=>({mediaType:xe.mediaType,data:xe.data})):void 0),J!==""&&_e(xe=>[J,...xe.filter(Be=>Be!==J)].slice(0,HS)),An())}function fn(D){if(D<-1||D>=ue.length)return;T===-1&&(oe.current=P);const J=D===-1?oe.current:ue[D]??"";K(D),kn(J,J.length)}function Jt(){var Be;const D=((Be=A.current)==null?void 0:Be.selectionStart)??Ae.length,xe=`${D>0&&!/\s$/.test(Ae.slice(0,D))?" ":""}@`;kn(Ae.slice(0,D)+xe+Ae.slice(D),D+xe.length)}function Et(D){var ft;const J=(ft=sx.exec(Ae.slice(0,fe)))==null?void 0:ft[1];if(J===void 0)return;const xe=fe-J.length-1,Be=D.kind==="dir"?`@${D.path}/`:`@${D.path} `;kn(Ae.slice(0,xe)+Be+Ae.slice(fe),xe+Be.length)}function dn(){var J;const D=(J=ax.exec(Ae.trim()))==null?void 0:J[1];if(D&&v(D)){An();return}Dt(Ae)}function ot(D,J){M(D),F(J),z(0),k(!1),K(-1),pe!==""&&(Ne(""),ye.drop())}function tn(D){var Be;const J=LS.has(D.name)?c:null,xe=`/${D.name} `;M(xe+(J??"")),F(xe.length+((J==null?void 0:J.length)??0)),J&&(te.current=[xe.length,xe.length+J.length]),z(0),(Be=A.current)==null||Be.focus()}function E(D){if(v(D.name)){M(""),z(0),k(!1);return}D.argumentHint?tn(D):Dt(`/${D.name}`)}function Y(D){if(Kt){if(D.key==="ArrowDown")return D.preventDefault(),z(J=>(Math.min(J,qt.length-1)+1)%qt.length);if(D.key==="ArrowUp"){D.preventDefault();const J=qt.length-1;return z(xe=>(Math.min(xe,J)+J)%qt.length)}if(D.key==="Enter"&&!D.shiftKey){D.preventDefault();const J=qt[It];J&&E(J);return}if(D.key==="Tab"){D.preventDefault();const J=qt[It];J&&tn(J);return}if(D.key==="Escape"){D.preventDefault(),D.stopPropagation(),k(!0);return}}if(en){if(D.key==="ArrowDown"&&Tt.length>0)return D.preventDefault(),z(J=>(Math.min(J,Tt.length-1)+1)%Tt.length);if(D.key==="ArrowUp"&&Tt.length>0){D.preventDefault();const J=Tt.length-1;return z(xe=>(Math.min(xe,J)+J)%Tt.length)}if(D.key==="Enter"&&!D.shiftKey||D.key==="Tab"){const J=Tt[Ct];if(J){D.preventDefault(),Et(J);return}if(D.key==="Tab")return}if(D.key==="Escape"){D.preventDefault(),D.stopPropagation(),k(!0);return}}if((D.key==="ArrowUp"||D.key==="ArrowDown")&&!D.shiftKey){const J=D.currentTarget,xe=J.selectionStart;if(J.selectionEnd===xe){const ft=D.key==="ArrowUp"?T+1:T-1;ft>=-1&&ft<ue.length&&requestAnimationFrame(()=>{J.selectionStart===xe&&J.selectionEnd===xe&&fn(ft)})}}if(D.key==="Escape"&&L){D.preventDefault(),D.stopPropagation(),L();return}D.key==="Enter"&&!D.shiftKey&&!B&&(D.preventDefault(),dn())}return r.jsx("div",{className:d?`composer ${d}`:"composer",children:r.jsxs("div",{className:"composer__inner",children:[r.jsx(Ui,{result:Bt}),en&&!Kt&&r.jsxs("div",{className:"cmdmenu",role:"listbox",ref:V,children:[Tt.map((D,J)=>r.jsxs("button",{role:"option","aria-selected":J===Ct,className:J===Ct?"cmdmenu__row is-on":"cmdmenu__row",onMouseEnter:()=>z(J),onMouseDown:xe=>{xe.preventDefault(),Et(D)},children:[r.jsxs("span",{className:"cmdmenu__name",children:[D.name,D.kind==="dir"?"/":""]}),r.jsx("span",{className:"cmdmenu__desc",children:D.path}),D.ignored&&r.jsx("span",{className:"cmdmenu__tag",children:"git-ignore"})]},D.path)),Tt.length===0&&r.jsx("div",{className:"cmdmenu__empty",children:En?"ищем…":Gt?"Ничего не нашлось":"Наберите имя файла или каталога"})]}),Kt&&r.jsx("div",{className:"cmdmenu",role:"listbox",ref:V,children:qt.map((D,J)=>r.jsxs("button",{role:"option","aria-selected":J===It,className:J===It?"cmdmenu__row is-on":"cmdmenu__row",onMouseEnter:()=>z(J),onMouseDown:xe=>{xe.preventDefault(),E(D)},children:[r.jsxs("span",{className:"cmdmenu__name",children:["/",D.name]}),D.argumentHint&&r.jsx("span",{className:"cmdmenu__hint",children:D.argumentHint}),r.jsx("span",{className:"cmdmenu__desc",children:D.description})]},D.name))}),ae.length>0&&r.jsx("div",{className:"composer__attachments",children:ae.map(D=>r.jsxs("div",{className:"composer__thumb",children:[r.jsx("img",{src:D.previewUrl,alt:"Вложение"}),r.jsx("button",{type:"button",className:"composer__thumb-remove","aria-label":"Удалить вложение",onClick:()=>H(D.id),children:r.jsx(FS,{})})]},D.id))}),r.jsxs("div",{className:"composer__field",children:[r.jsx("button",{type:"button",className:"addbtn",title:"Добавить контекст — файл проекта («@»)","aria-label":"Добавить контекст",disabled:a,onClick:Jt,children:r.jsx(ZS,{})}),y&&r.jsxs(r.Fragment,{children:[r.jsx("input",{ref:we,type:"file",accept:"image/*",multiple:!0,className:"composer__fileinput",tabIndex:-1,"aria-hidden":"true",onChange:re}),r.jsx("button",{type:"button",className:"attachbtn",title:"Прикрепить изображение","aria-label":"Прикрепить изображение",disabled:a,onClick:()=>{var D;return(D=we.current)==null?void 0:D.click()},children:r.jsx(JS,{})})]}),r.jsx("textarea",{ref:A,value:Ae,disabled:a,placeholder:Je,onChange:D=>ot(D.target.value,D.target.selectionStart),onSelect:D=>F(D.currentTarget.selectionStart),onKeyDown:Y,onPaste:ie}),ye.supported&&r.jsx("button",{type:"button",className:ye.listening?"micbtn is-on":"micbtn",title:ye.listening?"Остановить диктовку":"Продиктовать промпт","aria-label":ye.listening?"Остановить диктовку":"Продиктовать промпт","aria-pressed":ye.listening,disabled:a,onClick:ye.toggle,children:r.jsx(WS,{on:ye.listening})}),l?r.jsx("button",{className:"btn",onClick:w,title:"Прервать (Esc)",children:"Стоп"}):r.jsxs("button",{className:"btn btn--primary sendbtn",onClick:dn,disabled:a||Ae.trim()===""&&ae.length===0,"aria-label":m,title:m,children:[r.jsx("span",{className:"sendbtn__label",children:m}),r.jsx(KS,{})]})]})]})})}function mh(a,l){const i=l.trim();if(i==="")return a;const c=Mh(i).slice($S(a,i)).join(" ");return c===""?a:a===""||/\s$/.test(a)?a+c:`${a} ${c}`}function $S(a,l){const i=Mh(a),c=Mh(l);for(let o=Math.min(i.length,c.length);o>0;o--)if(i.slice(i.length-o).every((d,h)=>QS(d,c[h]??"")))return o;return 0}function Mh(a){return a.split(/\s+/).filter(l=>l!=="")}function QS(a,l){const i=c=>c.toLowerCase().replace(/[.,!?;:…]+$/u,"");return i(a)===i(l)}function ZS(){return r.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round","aria-hidden":"true",children:r.jsx("path",{d:"M8 3.4v9.2M3.4 8h9.2"})})}function KS(){return r.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:r.jsx("path",{d:"M8 12.5V3.5M4 7.5 8 3.5l4 4"})})}function JS(){return r.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:r.jsx("path",{d:"M10.8 4.2 5.9 9.1a2 2 0 0 0 2.8 2.8l4.6-4.6a3.3 3.3 0 0 0-4.7-4.7L3.9 7.3a4.6 4.6 0 0 0 6.5 6.5l4.4-4.4"})})}function FS(){return r.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round","aria-hidden":"true",children:r.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})}function WS({on:a}){return r.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("rect",{x:"5.9",y:"1.7",width:"4.2",height:"7.6",rx:"2.1",fill:a?"currentColor":"none"}),r.jsx("path",{d:"M3.3 7.3v.8a4.7 4.7 0 0 0 9.4 0v-.8"}),r.jsx("path",{d:"M8 12.8v1.5"})]})}const dy=4;function gh(a,l){const i=a.name.toLowerCase();return i===l?0:i.startsWith(l)?1:a.aliases.some(c=>c.toLowerCase().startsWith(l))?2:i.includes(l)?3:dy}function PS({request:a,queued:l,onDecide:i}){const c=iy(a.toolName,a.input);return r.jsx("div",{className:"modal-backdrop modal-backdrop--sheet",children:r.jsxs("div",{className:"sheet",role:"dialog","aria-modal":"true",children:[r.jsxs("div",{className:"sheet__head",children:["Разрешить действие?",l>0&&` (ещё ${l} в очереди)`]}),r.jsxs("div",{className:"sheet__body",children:[r.jsx("div",{className:"sheet__tool",children:a.toolName}),a.reason&&r.jsx("p",{className:"sheet__reason",children:a.reason}),c?r.jsx(Kh,{diff:c}):r.jsx("pre",{className:"code",children:JSON.stringify(a.input,null,2)})]}),r.jsxs("div",{className:"sheet__actions",children:[r.jsx("button",{className:"btn",onClick:()=>i(a.requestId,"deny"),children:"Отклонить"}),r.jsx("button",{className:"btn btn--warn",autoFocus:!0,onClick:()=>i(a.requestId,"allow"),children:"Разрешить"})]})]})})}function ej({request:a,queued:l,onAnswer:i,onDecline:c}){const{questions:o}=a,[d,h]=_.useState(()=>o.map(()=>new Set)),[p,m]=_.useState(()=>o.map(()=>"")),[x,y]=_.useState(()=>rx(o));_.useEffect(()=>{h(o.map(()=>new Set)),m(o.map(()=>"")),y(rx(o))},[a.requestId]);const j=_.useMemo(()=>nj(o,d,p),[o,d,p]),v=j!==null;function R(Q,k){var Z,z;(z=(Z=o[Q])==null?void 0:Z.options[k])!=null&&z.preview&&y(A=>{const V=A.slice();return V[Q]=k,V})}function w(Q,k,Z){h(z=>{const A=z.slice(),V=new Set(A[Q]);return Z?V.has(k)?V.delete(k):V.add(k):V.has(k)||(V.clear(),V.add(k)),A[Q]=V,A}),k!=="other"&&R(Q,k)}function L(Q,k){m(Z=>{const z=Z.slice();return z[Q]=k,z})}function B(){j&&i(a.requestId,j)}function P(Q){Q.key==="Enter"&&(Q.target.closest("button")||v&&(Q.preventDefault(),B()))}function M(Q){var A;if(!["ArrowDown","ArrowUp","ArrowRight","ArrowLeft"].includes(Q.key))return;const k=Array.from(Q.currentTarget.querySelectorAll("button.qsheet__option")),Z=k.indexOf(document.activeElement);if(Z===-1)return;Q.preventDefault();const z=Q.key==="ArrowDown"||Q.key==="ArrowRight"?1:-1;(A=k[(Z+z+k.length)%k.length])==null||A.focus()}return r.jsx("div",{className:"modal-backdrop modal-backdrop--sheet",children:r.jsxs("div",{className:"qsheet",role:"dialog","aria-modal":"true","aria-label":"Вопрос от Claude",onKeyDown:P,children:[r.jsxs("div",{className:"qsheet__head",children:[r.jsx("span",{className:"qsheet__head-icon","aria-hidden":"true",children:"?"}),r.jsxs("span",{children:[o.length===1?"Уточняющий вопрос":`Уточняющие вопросы (${o.length})`,l>0&&` — ещё ${l} в очереди`]})]}),r.jsxs("div",{className:"qsheet__body",children:[a.reason&&r.jsx("p",{className:"qsheet__reason",children:a.reason}),o.map((Q,k)=>r.jsx(tj,{q:Q,qi:k,selected:d[k]??new Set,otherText:p[k]??"",previewIndex:x[k]??null,onToggle:w,onFocusOption:R,onOtherText:L,onOptionsKeyDown:M},k))]}),r.jsxs("div",{className:"qsheet__actions",children:[r.jsx("button",{className:"btn",onClick:()=>c(a.requestId),children:"Не отвечать"}),r.jsx("button",{className:"btn btn--primary",disabled:!v,onClick:B,children:"Ответить"})]})]})})}function tj({q:a,qi:l,selected:i,otherText:c,previewIndex:o,onToggle:d,onFocusOption:h,onOtherText:p,onOptionsKeyDown:m}){var R;const x=a.options.some(w=>w.preview),y=o!==null?(R=a.options[o])==null?void 0:R.preview:void 0,j=i.has("other"),v=a.multiSelect?"checkbox":"radio";return r.jsxs("div",{className:"qsheet__question",children:[r.jsxs("div",{className:"qsheet__qhead",children:[r.jsx("span",{className:"chip chip--accent",children:a.header}),r.jsx("span",{className:"qsheet__qtext",children:a.question})]}),r.jsxs("div",{className:"qsheet__options"+(a.multiSelect?"":" qsheet__options--radio"),role:a.multiSelect?"group":"radiogroup","aria-label":a.question,onKeyDown:m,children:[a.options.map((w,L)=>{const B=i.has(L);return r.jsxs("button",{type:"button",role:v,"aria-checked":B,className:"qsheet__option"+(B?" is-selected":""),onClick:()=>d(l,L,a.multiSelect),onFocus:()=>h(l,L),onMouseEnter:()=>h(l,L),children:[r.jsx("span",{className:"qsheet__opt-mark","aria-hidden":"true"}),r.jsxs("span",{className:"qsheet__opt-body",children:[r.jsx("span",{className:"qsheet__opt-label",children:w.label}),r.jsx("span",{className:"qsheet__opt-desc",children:w.description})]})]},L)}),r.jsxs("div",{className:"qsheet__other",children:[r.jsxs("button",{type:"button",role:v,"aria-checked":j,className:"qsheet__option qsheet__option--other"+(j?" is-selected":""),onClick:()=>d(l,"other",a.multiSelect),children:[r.jsx("span",{className:"qsheet__opt-mark","aria-hidden":"true"}),r.jsxs("span",{className:"qsheet__opt-body",children:[r.jsx("span",{className:"qsheet__opt-label",children:"Другое"}),r.jsx("span",{className:"qsheet__opt-desc",children:"Свой вариант ответа"})]})]}),j&&r.jsx("input",{type:"text",className:"qsheet__other-input",placeholder:"Впишите свой вариант…","aria-label":`Свой вариант ответа на вопрос «${a.question}»`,value:c,onChange:w=>p(l,w.target.value),autoFocus:!0})]})]}),x&&r.jsx("pre",{className:"qsheet__preview",children:y??""})]})}function rx(a){return a.map(l=>{const i=l.options.findIndex(c=>c.preview);return i===-1?null:i})}function nj(a,l,i){const c={};for(let o=0;o<a.length;o++){const d=a[o];if(!d)continue;const h=l[o]??new Set,p=[];for(let m=0;m<d.options.length;m++){const x=d.options[m];x&&h.has(m)&&p.push(x.label)}if(h.has("other")){const m=(i[o]??"").trim();m&&p.push(m)}if(p.length===0)return null;c[d.question]=p.join(", ")}return c}function lj({request:a,plan:l,queued:i,onAccept:c,onDecline:o}){const[d,h]=_.useState(l),[p,m]=_.useState("preview");_.useEffect(()=>{h(l),m("preview")},[a.requestId,l]);const x=d.trim().length>0;function y(){x&&c(a.requestId,d)}return r.jsx("div",{className:"modal-backdrop modal-backdrop--sheet",children:r.jsxs("div",{className:"plansheet",role:"dialog","aria-modal":"true","aria-label":"План агента",children:[r.jsxs("div",{className:"plansheet__head",children:[r.jsx("span",{className:"plansheet__head-icon","aria-hidden":"true",children:r.jsx(sj,{})}),r.jsxs("span",{className:"plansheet__head-text",children:["План на согласование",i>0&&` — ещё ${i} в очереди`]}),r.jsxs("div",{className:"plansheet__viewtoggle",role:"tablist","aria-label":"Режим просмотра",children:[r.jsx("button",{className:"btn btn--sm"+(p==="preview"?" is-on":""),role:"tab","aria-selected":p==="preview",onClick:()=>m("preview"),children:"Просмотр"}),r.jsx("button",{className:"btn btn--sm"+(p==="source"?" is-on":""),role:"tab","aria-selected":p==="source",onClick:()=>m("source"),children:"Код"})]})]}),r.jsxs("div",{className:"plansheet__body",children:[a.reason&&r.jsx("p",{className:"plansheet__reason",children:a.reason}),r.jsx("div",{className:"plansheet__content",children:p==="preview"?r.jsx(aj,{text:d}):r.jsx("textarea",{className:"plansheet__source",value:d,onChange:j=>h(j.target.value),spellCheck:!1,"aria-label":"Текст плана — можно отредактировать перед тем, как согласиться",autoFocus:!0})})]}),r.jsxs("div",{className:"plansheet__actions",children:[r.jsx("button",{className:"btn",onClick:()=>o(a.requestId),children:"Доработать"}),r.jsx("button",{className:"btn btn--ok",disabled:!x,autoFocus:!0,onClick:y,children:"Одобрить план"})]})]})})}function aj({text:a}){const[l,i]=_.useState("");return _.useEffect(()=>{let c=!1;return $h(a).then(o=>{c||i(o)}),()=>{c=!0}},[a]),r.jsx("div",{className:"markdown-preview plansheet__preview",dangerouslySetInnerHTML:{__html:l}})}function sj(){return r.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M4.4 2.5h5.6L13 5.5v7.4a.6.6 0 0 1-.6.6H4.4a.6.6 0 0 1-.6-.6V3.1a.6.6 0 0 1 .6-.6Z"}),r.jsx("path",{d:"M9.5 2.5v2.5a.5.5 0 0 0 .5.5h3"}),r.jsx("path",{d:"M5.6 8.6 7 10l3-3.2"})]})}function ij(a,l){if(a!=="ExitPlanMode"||!l||typeof l!="object")return null;const i=l.plan;return typeof i=="string"?i:null}function hy({path:a}){const[l,i]=_.useState(!1),[c,o]=_.useState(!1),d=_.useRef(null);_.useEffect(()=>{if(!l)return;function p(m){var x;(x=d.current)!=null&&x.contains(m.target)||i(!1)}return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[l]),_.useEffect(()=>{if(!c)return;const p=setTimeout(()=>o(!1),Qh);return()=>clearTimeout(p)},[c]),_.useEffect(()=>i(!1),[a]);async function h(){await Zo(a)&&o(!0)}return r.jsxs("div",{ref:d,className:"cwd",children:[r.jsxs("button",{type:"button",className:"cwd__toggle","aria-expanded":l,title:l?"Свернуть путь":`Полный путь: ${a}`,onClick:()=>i(p=>!p),onKeyDown:p=>{p.key!=="Escape"||!l||(p.preventDefault(),p.stopPropagation(),i(!1))},children:[r.jsx(rj,{open:l}),r.jsx("span",{className:"cwd__short",children:a})]}),l&&r.jsxs("div",{className:"cwd__pop",children:[r.jsx("span",{className:"cwd__full",children:a}),r.jsx("button",{type:"button",className:"btn btn--ghost cwd__copy",onClick:()=>void h(),children:c?wr:Di})]})]})}function rj({open:a}){return r.jsx("svg",{className:a?"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:r.jsx("path",{d:"M6 3.5 10.5 8 6 12.5"})})}function es({value:a,options:l,onChange:i,className:c,title:o,ariaLabel:d,placeholder:h="—"}){const[p,m]=_.useState(!1),[x,y]=_.useState(0),j=_.useRef(null),v=_.useRef(null),R=l.find(B=>B.value===a)??null;_.useEffect(()=>{if(!p)return;const B=l.findIndex(P=>P.value===a);y(B===-1?0:B)},[p]),_.useEffect(()=>{if(!p)return;function B(P){var M;(M=j.current)!=null&&M.contains(P.target)||m(!1)}return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[p]),_.useEffect(()=>{var B,P;p&&((P=(B=v.current)==null?void 0:B.querySelector(".is-cursor"))==null||P.scrollIntoView({block:"nearest"}))},[p,x]),_.useEffect(()=>{if(!p)return;const B=v.current,P=cj(j.current);if(!B||!P)return;const M=B.getBoundingClientRect().bottom-P.getBoundingClientRect().bottom;M>0&&(P.scrollTop+=Math.min(M+8,B.offsetHeight))},[p]);function w(B){m(!1),B.value!==a&&i(B.value)}function L(B){if(B.key==="Escape"){if(!p)return;B.preventDefault(),B.stopPropagation(),m(!1);return}if(B.key==="ArrowDown"||B.key==="ArrowUp"){if(B.preventDefault(),!p)return m(!0);const P=B.key==="ArrowDown"?1:l.length-1;return y(M=>(M+P)%l.length)}if(B.key==="Enter"||B.key===" "){if(B.preventDefault(),!p)return m(!0);const P=l[x];P&&w(P)}}return r.jsxs("div",{ref:j,className:"select"+(p?" select--open":"")+(c?` ${c}`:""),children:[r.jsxs("button",{type:"button",className:"select__trigger",title:o,"aria-label":d??o,"aria-haspopup":"listbox","aria-expanded":p,onClick:()=>m(B=>!B),onKeyDown:L,children:[r.jsx("span",{className:"select__value",children:(R==null?void 0:R.label)??h}),r.jsx(uj,{})]}),p&&r.jsx("div",{ref:v,className:"select__menu",role:"listbox","aria-label":d??o,children:l.map((B,P)=>r.jsxs("button",{type:"button",role:"option","aria-selected":B.value===a,className:"select__option"+(P===x?" is-cursor":"")+(B.value===a?" is-on":""),onMouseEnter:()=>y(P),onClick:()=>w(B),children:[r.jsx("span",{className:"select__check","aria-hidden":"true",children:B.value===a?"✓":""}),r.jsx("span",{className:"select__label",children:B.label}),B.hint&&r.jsx("span",{className:"select__hint",children:B.hint})]},B.value))})]})}function cj(a){let l=(a==null?void 0:a.parentElement)??null;for(;l;){if(l.scrollHeight>l.clientHeight&&getComputedStyle(l).overflowY!=="visible")return l;l=l.parentElement}return null}function uj(){return r.jsx("svg",{className:"select__chev",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:r.jsx("path",{d:"M3 4.5 6 7.5 9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}const oj=["low","medium","high"];function py({models:a,value:l,effort:i,ultracode:c,thinking:o,switchOnFlag:d,className:h,onModel:p,onEffort:m,onUltracode:x,onThinking:y,onSwitchOnFlag:j}){const[v,R]=_.useState(!1),[w,L]=_.useState(0),B=_.useRef(null),P=_.useRef(null),M=a.find(A=>A.value===l)??null,Q=M&&M.supportsEffort?M.effortLevels.length>0?M.effortLevels:oj:[],k=Q.includes("xhigh");_.useEffect(()=>{if(!v)return;const A=a.findIndex(V=>V.value===l);L(A===-1?0:A)},[v]),_.useEffect(()=>{if(!v)return;function A(V){var te;(te=B.current)!=null&&te.contains(V.target)||R(!1)}return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[v]),_.useEffect(()=>{var A,V;v&&((V=(A=P.current)==null?void 0:A.querySelector(".is-cursor"))==null||V.scrollIntoView({block:"nearest"}))},[v,w]);function Z(A){R(!1),A.value!==l&&p(A.value)}function z(A){if(A.key==="Escape"){if(!v)return;A.preventDefault(),A.stopPropagation(),R(!1);return}if(A.key==="ArrowDown"||A.key==="ArrowUp"){if(A.preventDefault(),!v)return R(!0);if(a.length===0)return;const V=A.key==="ArrowDown"?1:a.length-1;return L(te=>(te+V)%a.length)}if(A.key==="Enter"||A.key===" "){if(A.preventDefault(),!v)return R(!0);const V=a[w];V&&Z(V)}}return r.jsxs("div",{ref:B,className:"select"+(v?" select--open":"")+(h?` ${h}`:""),children:[r.jsxs("button",{type:"button",className:"select__trigger",title:"Модель, усилие и размышления","aria-label":"Модель, усилие и размышления","aria-haspopup":"menu","aria-expanded":v,onClick:()=>R(A=>!A),onKeyDown:z,children:[r.jsx("span",{className:"select__value",children:(M==null?void 0:M.displayName)??l??"—"}),c?r.jsx("span",{className:"select__suffix select__suffix--hot",children:"ultracode"}):Q.length>0&&i&&r.jsx("span",{className:"select__suffix",children:i}),r.jsx(fj,{})]}),v&&r.jsxs("div",{ref:P,className:"select__menu modelmenu",role:"menu",children:[r.jsx("div",{className:"modelmenu__head",children:"Модель"}),a.map((A,V)=>r.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":A.value===l,className:"select__option"+(V===w?" is-cursor":"")+(A.value===l?" is-on":""),onMouseEnter:()=>L(V),onClick:()=>Z(A),children:[r.jsx("span",{className:"select__check","aria-hidden":"true",children:A.value===l?"✓":""}),r.jsx("span",{className:"select__label",children:A.displayName}),A.description&&r.jsx("span",{className:"select__hint",children:A.description})]},A.value)),Q.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"modelmenu__sep",role:"separator"}),r.jsxs("div",{className:"modelmenu__row",children:[r.jsxs("span",{className:"modelmenu__label",children:["Усилие",r.jsx("span",{className:"modelmenu__desc",children:"насколько усердно модель думает"})]}),r.jsx("span",{className:"modelmenu__levels",children:Q.map(A=>r.jsx("button",{type:"button",role:"menuitemradio","aria-checked":A===i,className:A===i?"modelmenu__level is-on":"modelmenu__level",onClick:()=>m(A),children:A},A))})]}),k&&r.jsx(bh,{label:"Ultracode",desc:"xhigh и постоянная оркестрация подагентами",on:c,onToggle:()=>x(!c)})]}),r.jsx("div",{className:"modelmenu__sep",role:"separator"}),(M==null?void 0:M.supportsThinking)!==!1&&r.jsx(bh,{label:"Размышления",desc:"расширенное обдумывание перед ответом",on:o,onToggle:()=>y(!o)}),r.jsx(bh,{label:"Менять модель по флагу",desc:"иначе помеченный ход встаёт на паузу",on:d,onToggle:()=>j(!d)})]})]})}function bh({label:a,desc:l,on:i,onToggle:c}){return r.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":i,className:"modelmenu__row modelmenu__row--btn",onClick:c,children:[r.jsxs("span",{className:"modelmenu__label",children:[a,r.jsx("span",{className:"modelmenu__desc",children:l})]}),r.jsx("span",{className:i?"switch is-on":"switch","aria-hidden":"true",children:r.jsx("span",{className:"switch__knob"})})]})}function fj(){return r.jsx("svg",{className:"select__chev",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:r.jsx("path",{d:"M3 4.5 6 7.5 9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function Nl({title:a,children:l,actions:i,className:c,sheet:o=!1,onClose:d}){const h=_.useRef(null);return _.useEffect(()=>{function p(m){if(m.key==="Escape"){m.preventDefault(),m.stopPropagation(),d();return}if(m.key!=="Tab")return;const x=h.current;if(!x)return;const y=x.querySelectorAll('button, input, textarea, select, a[href], [tabindex]:not([tabindex="-1"])'),j=y[0],v=y[y.length-1];!j||!v||(m.shiftKey&&document.activeElement===j?(m.preventDefault(),v.focus()):!m.shiftKey&&document.activeElement===v&&(m.preventDefault(),j.focus()))}return document.addEventListener("keydown",p,!0),()=>document.removeEventListener("keydown",p,!0)},[d]),r.jsx("div",{className:o?"modal-backdrop modal-backdrop--sheet":"modal-backdrop",onMouseDown:p=>{p.target===p.currentTarget&&d()},children:r.jsxs("div",{ref:h,className:c?`modal ${c}`:"modal",role:"dialog","aria-modal":"true","aria-label":a,children:[r.jsxs("div",{className:"modal__head",children:[r.jsx("h2",{className:"modal__title",children:a}),r.jsx("button",{className:"modal__close","aria-label":"Закрыть",onClick:d,children:"✕"})]}),r.jsx("div",{className:"modal__body",children:l}),i&&r.jsx("div",{className:"modal__actions",children:i})]})})}function dj({candidates:a,searching:l,agentItems:i,agentBusy:c,error:o,roots:d,created:h,onSearch:p,onAskAgent:m,onInterrupt:x,onSubmit:y,onCreate:j,onClose:v}){const[R,w]=_.useState("open"),[L,B]=_.useState(""),[P,M]=_.useState(!1),[Q,k]=_.useState(""),[Z,z]=_.useState(""),[A,V]=_.useState({git:!0,claudeMd:!0,readme:!0}),te=L.trim(),fe=te!=="",F=Q.trim(),ae=Z.trim(),me=F!==""&&ae!=="";_.useEffect(()=>{Q===""&&d.length>0&&k(d[0])},[d]);const we=_.useRef(p);we.current=p,_.useEffect(()=>{if(R!=="open")return;const re=L.trim(),ue=setTimeout(()=>we.current(re),200);return()=>clearTimeout(ue)},[L,R]);function ge(){fe&&y(te)}function H(){me&&j(F,ae,A)}function ie(){fe&&(M(!0),m(te))}return h?r.jsxs(Nl,{title:"Новый проект",onClose:v,actions:r.jsx("button",{className:"btn btn--primary",onClick:v,autoFocus:!0,children:"Понятно"}),children:[r.jsx("p",{className:"modal__text",children:"Каталог создан и открыт как проект, но часть шагов не удалась."}),r.jsx("p",{className:"newproj__preview",children:h.path}),r.jsx("div",{className:"modal__error",children:r.jsx("ul",{className:"newproj__warnings",children:h.warnings.map(re=>r.jsx("li",{children:re},re))})}),r.jsx("p",{className:"modal__text modal__text--dim",children:"Проект открыт и работает — недостающее можно добавить руками, в дереве файлов или из терминала."})]}):r.jsxs(Nl,{title:"Новый проект",className:P&&R==="open"?"modal--wide":void 0,onClose:v,actions:r.jsxs(r.Fragment,{children:[r.jsx("button",{className:"btn",onClick:v,children:"Отмена"}),R==="open"?r.jsxs(r.Fragment,{children:[c?r.jsx("button",{className:"btn",onClick:x,children:"Остановить"}):r.jsx("button",{className:"btn",disabled:!fe,onClick:ie,title:"Найти по описанию",children:"Попросить агента"}),r.jsx("button",{className:"btn btn--primary",disabled:!fe,onClick:ge,children:"Открыть"})]}):r.jsx("button",{className:"btn btn--primary",disabled:!me,onClick:H,children:"Создать"})]}),children:[r.jsxs("div",{className:"tabs",children:[r.jsx(cx,{label:"Открыть",on:R==="open",onClick:()=>w("open")}),r.jsx(cx,{label:"Создать",on:R==="create",onClick:()=>w("create")})]}),R==="open"?r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"modal__text",children:"Каталог, в котором будет работать агент. Введите путь или часть имени — подходящие каталоги появятся ниже."}),r.jsx("label",{className:"field",htmlFor:"workspace-path",children:"Путь или название"}),r.jsx("input",{id:"workspace-path",className:"input input--mono",value:L,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"C:\\Projects\\my-app",onChange:re=>B(re.target.value),onKeyDown:re=>{re.key==="Enter"&&(re.preventDefault(),ge())}}),o&&r.jsx("p",{className:"modal__error",children:o}),a.length>0&&r.jsx("ul",{className:"finds",children:a.map(re=>r.jsx("li",{children:r.jsxs("button",{className:"find",disabled:re.open,title:re.open?"Этот проект уже открыт":re.path,onClick:()=>B(re.path),onDoubleClick:()=>y(re.path),children:[r.jsx("span",{className:"find__name",children:re.name}),r.jsx("span",{className:"find__path",children:re.path}),r.jsx("span",{className:"find__note",children:mj(re)})]})},re.path))}),a.length===0&&fe&&!l&&!P&&r.jsx("p",{className:"modal__text modal__text--dim",children:"Ничего похожего среди каталогов, где вы работали. Если помните не имя, а суть проекта — опишите его и нажмите «Попросить агента». Проекта ещё нет вовсе — рядом вкладка «Создать»."}),P&&r.jsx("div",{className:"finds__agent",children:r.jsx(Jh,{items:i,busy:c,waiting:!1,empty:"Агент ищет…"})})]}):r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"modal__text",children:"Пустой каталог для нового проекта. Дальше в нём работает агент — с первого промпта, без отдельной настройки."}),r.jsx("label",{className:"field",htmlFor:"workspace-parent",children:"Где создать"}),r.jsx("input",{id:"workspace-parent",className:"input input--mono",value:Q,spellCheck:!1,autoComplete:"off",placeholder:"C:\\Projects",onChange:re=>k(re.target.value)}),d.length>0&&r.jsx("div",{className:"newproj__roots",children:d.map(re=>r.jsx("button",{type:"button",className:re===F?"newproj__root is-on":"newproj__root",title:re,onClick:()=>k(re),children:pj(re)},re))}),r.jsx("label",{className:"field newproj__field",htmlFor:"workspace-name",children:"Имя проекта"}),r.jsx("input",{id:"workspace-name",className:"input input--mono",value:Z,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"my-app",onChange:re=>z(re.target.value),onKeyDown:re=>{re.key==="Enter"&&(re.preventDefault(),H())}}),r.jsx("p",{className:"newproj__preview",children:me?hj(F,ae):"Каталог появится здесь"}),o&&r.jsx("p",{className:"modal__error",children:o}),r.jsxs("div",{className:"newproj__opts",children:[r.jsx(xh,{label:"git init",desc:"панель истории работает сразу",on:A.git,onToggle:()=>V(re=>({...re,git:!re.git}))}),r.jsx(xh,{label:"CLAUDE.md",desc:"заготовка инструкций для агента",on:A.claudeMd,onToggle:()=>V(re=>({...re,claudeMd:!re.claudeMd}))}),r.jsx(xh,{label:"README.md",desc:"по нему проект потом узнаёт поиск",on:A.readme,onToggle:()=>V(re=>({...re,readme:!re.readme}))})]})]})]})}function cx({label:a,on:l,onClick:i}){return r.jsx("button",{type:"button",className:l?"tabs__tab is-on":"tabs__tab","aria-pressed":l,onClick:i,children:a})}function xh({label:a,desc:l,on:i,onToggle:c}){return r.jsxs("button",{type:"button",role:"checkbox","aria-checked":i,className:"newproj__opt",onClick:c,children:[r.jsxs("span",{className:"newproj__optlabel",children:[a,r.jsx("span",{className:"newproj__optdesc",children:l})]}),r.jsx("span",{className:i?"switch is-on":"switch","aria-hidden":"true",children:r.jsx("span",{className:"switch__knob"})})]})}function hj(a,l){const i=a.includes("\\")?"\\":"/";return a.replace(/[\\/]+$/,"")+i+l}function pj(a){const l=a.includes("\\")?"\\":"/",i=a.split(/[\\/]/).filter(Boolean);return i.length<=2?a:`…${l}${i.slice(-2).join(l)}`}function mj(a){return a.open?"уже открыт":a.why?a.why:a.sessions===0?"рядом с вашими проектами":`${gj(a.sessions)}${bj(a.lastUsedAt)}`}function gj(a){const l=a%10,i=a%100;return i>=11&&i<=14?`${a} сессий`:l===1?`${a} сессия`:l>=2&&l<=4?`${a} сессии`:`${a} сессий`}function bj(a){if(!a)return"";const l=Math.floor((Date.now()-a)/864e5);return l<=0?" · сегодня":l===1?" · вчера":l<30?` · ${l} дн. назад`:` · ${new Date(a).toLocaleDateString("ru-RU")}`}const Fh=7;function xj(a){const l=[],i=[];let c=1;for(const o of a){const d=l.slice();let h=l.indexOf(o.hash);h===-1&&(h=ux(l),l[h]=o.hash);const[p,...m]=o.parents;l[h]=p??null;const x=[];p!==void 0&&x.push({from:h,to:h});for(const v of m){let R=l.indexOf(v);R===-1&&(R=ux(l),l[R]=v),x.push({from:h,to:R})}const y=[];for(let v=0;v<d.length;v++)d[v]===o.hash&&(y.push({from:v,to:h}),v!==h&&(l[v]=null));const j=[];for(let v=0;v<d.length;v++){const R=d[v];!R||R===o.hash||v===h||l[v]===R&&j.push(v)}yj(l),c=Math.max(c,l.length,h+1),i.push({commit:o,col:h,up:y,down:x,through:j})}return{rows:i,columns:Math.min(c,Fh)}}function ux(a){const l=a.indexOf(null);return l!==-1?l:(a.push(null),a.length-1)}function yj(a){for(;a.length>0&&a[a.length-1]===null;)a.pop()}const my=1500;function _j(a){const l=[];let i=!1;for(const c of a.patch.split(`
116
+ `,v),w=R<0?j.length:R;if(w>v&&c(j.slice(v,w),y),R<0)break;o(),v=R+1}p=x}}i1(l,i,(x,y,j)=>{m(x,""),m(y,j)},d,h),m(h,"")}class c1{constructor(l,i,c){this.at=l,this.highlighters=i,this.span=c,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,c,o,d){let{type:h,from:p,to:m}=l;if(p>=c||m<=i)return;h.isTop&&(d=this.highlighters.filter(R=>!R.scope||R.scope(h)));let x=o,y=u1(l)||Qc.empty,j=s1(d,y.tags);if(j&&(x&&(x+=" "),x+=j,y.mode==1&&(o+=(o?" ":"")+j)),this.startSpan(Math.max(i,p),x),y.opaque)return;let v=l.tree&&l.tree.prop(Ht.mounted);if(v&&v.overlay){let R=l.node.enter(v.overlay[0].from+p,1),w=this.highlighters.filter(B=>!B.scope||B.scope(v.tree.type)),L=l.firstChild();for(let B=0,P=p;;B++){let M=B<v.overlay.length?v.overlay[B]:null,Q=M?M.from+p:m,k=Math.max(i,P),Z=Math.min(c,Q);if(k<Z&&L)for(;l.from<Z&&(this.highlightRange(l,k,Z,o,d),this.startSpan(Math.min(Z,l.to),x),!(l.to>=Q||!l.nextSibling())););if(!M||Q>c)break;P=M.to+p,P>i&&(this.highlightRange(R.cursor(),Math.max(i,M.from+p),Math.min(c,P),"",w),this.startSpan(Math.min(c,P),x))}L&&l.parent()}else if(l.firstChild()){v&&(o="");do if(!(l.to<=i)){if(l.from>=c)break;this.highlightRange(l,i,c,o,d),this.startSpan(Math.min(c,l.to),x)}while(l.nextSibling());l.parent()}}}function u1(a){let l=a.type.prop(Wx);for(;l&&l.context&&!a.matchContext(l.context);)l=l.next;return l||null}const be=Ll.define,jo=be(),Ls=be(),qb=be(Ls),Ib=be(Ls),Us=be(),ko=be(Us),uh=be(Us),xa=be(),ji=be(xa),ha=be(),pa=be(),Ch=be(),Uc=be(Ch),No=be(),ke={comment:jo,lineComment:be(jo),blockComment:be(jo),docComment:be(jo),name:Ls,variableName:be(Ls),typeName:qb,tagName:be(qb),propertyName:Ib,attributeName:be(Ib),className:be(Ls),labelName:be(Ls),namespace:be(Ls),macroName:be(Ls),literal:Us,string:ko,docString:be(ko),character:be(ko),attributeValue:be(ko),number:uh,integer:be(uh),float:be(uh),bool:be(Us),regexp:be(Us),escape:be(Us),color:be(Us),url:be(Us),keyword:ha,self:be(ha),null:be(ha),atom:be(ha),unit:be(ha),modifier:be(ha),operatorKeyword:be(ha),controlKeyword:be(ha),definitionKeyword:be(ha),moduleKeyword:be(ha),operator:pa,derefOperator:be(pa),arithmeticOperator:be(pa),logicOperator:be(pa),bitwiseOperator:be(pa),compareOperator:be(pa),updateOperator:be(pa),definitionOperator:be(pa),typeOperator:be(pa),controlOperator:be(pa),punctuation:Ch,separator:be(Ch),bracket:Uc,angleBracket:be(Uc),squareBracket:be(Uc),paren:be(Uc),brace:be(Uc),content:xa,heading:ji,heading1:be(ji),heading2:be(ji),heading3:be(ji),heading4:be(ji),heading5:be(ji),heading6:be(ji),contentSeparator:be(xa),list:be(xa),quote:be(xa),emphasis:be(xa),strong:be(xa),link:be(xa),monospace:be(xa),strikethrough:be(xa),inserted:be(),deleted:be(),changed:be(),invalid:be(),meta:No,documentMeta:be(No),annotation:be(No),processingInstruction:be(No),definition:Ll.defineModifier("definition"),constant:Ll.defineModifier("constant"),function:Ll.defineModifier("function"),standard:Ll.defineModifier("standard"),local:Ll.defineModifier("local"),special:Ll.defineModifier("special")};for(let a in ke){let l=ke[a];l instanceof Ll&&(l.name=a)}Px([{tag:ke.link,class:"tok-link"},{tag:ke.heading,class:"tok-heading"},{tag:ke.emphasis,class:"tok-emphasis"},{tag:ke.strong,class:"tok-strong"},{tag:ke.keyword,class:"tok-keyword"},{tag:ke.atom,class:"tok-atom"},{tag:ke.bool,class:"tok-bool"},{tag:ke.url,class:"tok-url"},{tag:ke.labelName,class:"tok-labelName"},{tag:ke.inserted,class:"tok-inserted"},{tag:ke.deleted,class:"tok-deleted"},{tag:ke.literal,class:"tok-literal"},{tag:ke.string,class:"tok-string"},{tag:ke.number,class:"tok-number"},{tag:[ke.regexp,ke.escape,ke.special(ke.string)],class:"tok-string2"},{tag:ke.variableName,class:"tok-variableName"},{tag:ke.local(ke.variableName),class:"tok-variableName tok-local"},{tag:ke.definition(ke.variableName),class:"tok-variableName tok-definition"},{tag:ke.special(ke.variableName),class:"tok-variableName2"},{tag:ke.definition(ke.propertyName),class:"tok-propertyName tok-definition"},{tag:ke.typeName,class:"tok-typeName"},{tag:ke.namespace,class:"tok-namespace"},{tag:ke.className,class:"tok-className"},{tag:ke.macroName,class:"tok-macroName"},{tag:ke.propertyName,class:"tok-propertyName"},{tag:ke.operator,class:"tok-operator"},{tag:ke.comment,class:"tok-comment"},{tag:ke.meta,class:"tok-meta"},{tag:ke.invalid,class:"tok-invalid"},{tag:ke.punctuation,class:"tok-punctuation"}]);const o1="modulepreload",f1=function(a,l){return new URL(a,l).href},Gb={},Xe=function(l,i,c){let o=Promise.resolve();if(i&&i.length>0){let h=function(y){return Promise.all(y.map(j=>Promise.resolve(j).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};const p=document.getElementsByTagName("link"),m=document.querySelector("meta[property=csp-nonce]"),x=(m==null?void 0:m.nonce)||(m==null?void 0:m.getAttribute("nonce"));o=h(i.map(y=>{if(y=f1(y,c),y in Gb)return;Gb[y]=!0;const j=y.endsWith(".css"),v=j?'[rel="stylesheet"]':"";if(!!c)for(let L=p.length-1;L>=0;L--){const B=p[L];if(B.href===y&&(!j||B.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${y}"]${v}`))return;const w=document.createElement("link");if(w.rel=j?"stylesheet":o1,j||(w.as="script"),w.crossOrigin="",w.href=y,x&&w.setAttribute("nonce",x),document.head.appendChild(w),j)return new Promise((L,B)=>{w.addEventListener("load",L),w.addEventListener("error",()=>B(new Error(`Unable to preload CSS for ${y}`)))})}))}function d(h){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=h,window.dispatchEvent(p),!p.defaultPrevented)throw h}return o.then(h=>{for(const p of h||[])p.status==="rejected"&&d(p.reason);return l().catch(d)})},ey={js:async()=>(await Xe(async()=>{const{javascript:a}=await import("./index-UL9tmS_d.js");return{javascript:a}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({jsx:!0}),cjs:async()=>(await Xe(async()=>{const{javascript:a}=await import("./index-UL9tmS_d.js");return{javascript:a}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript(),mjs:async()=>(await Xe(async()=>{const{javascript:a}=await import("./index-UL9tmS_d.js");return{javascript:a}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript(),jsx:async()=>(await Xe(async()=>{const{javascript:a}=await import("./index-UL9tmS_d.js");return{javascript:a}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({jsx:!0}),ts:async()=>(await Xe(async()=>{const{javascript:a}=await import("./index-UL9tmS_d.js");return{javascript:a}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({typescript:!0}),mts:async()=>(await Xe(async()=>{const{javascript:a}=await import("./index-UL9tmS_d.js");return{javascript:a}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({typescript:!0}),cts:async()=>(await Xe(async()=>{const{javascript:a}=await import("./index-UL9tmS_d.js");return{javascript:a}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({typescript:!0}),tsx:async()=>(await Xe(async()=>{const{javascript:a}=await import("./index-UL9tmS_d.js");return{javascript:a}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({typescript:!0,jsx:!0}),json:async()=>(await Xe(async()=>{const{json:a}=await import("./index-DOB2UBvs.js");return{json:a}},__vite__mapDeps([6,1,2,3,4]),import.meta.url)).json(),jsonc:async()=>(await Xe(async()=>{const{json:a}=await import("./index-DOB2UBvs.js");return{json:a}},__vite__mapDeps([6,1,2,3,4]),import.meta.url)).json(),css:async()=>(await Xe(async()=>{const{css:a}=await import("./index-BuNEEiXu.js");return{css:a}},__vite__mapDeps([7,1,2,3,4]),import.meta.url)).css(),scss:async()=>(await Xe(async()=>{const{css:a}=await import("./index-BuNEEiXu.js");return{css:a}},__vite__mapDeps([7,1,2,3,4]),import.meta.url)).css(),less:async()=>(await Xe(async()=>{const{css:a}=await import("./index-BuNEEiXu.js");return{css:a}},__vite__mapDeps([7,1,2,3,4]),import.meta.url)).css(),html:async()=>(await Xe(async()=>{const{html:a}=await import("./index-BrHxnl17.js");return{html:a}},__vite__mapDeps([8,1,7,2,3,4,0,5]),import.meta.url)).html(),htm:async()=>(await Xe(async()=>{const{html:a}=await import("./index-BrHxnl17.js");return{html:a}},__vite__mapDeps([8,1,7,2,3,4,0,5]),import.meta.url)).html(),vue:async()=>(await Xe(async()=>{const{html:a}=await import("./index-BrHxnl17.js");return{html:a}},__vite__mapDeps([8,1,7,2,3,4,0,5]),import.meta.url)).html(),svelte:async()=>(await Xe(async()=>{const{html:a}=await import("./index-BrHxnl17.js");return{html:a}},__vite__mapDeps([8,1,7,2,3,4,0,5]),import.meta.url)).html(),md:async()=>(await Xe(async()=>{const{markdown:a}=await import("./index-CUva-2wH.js");return{markdown:a}},__vite__mapDeps([9,3,4,2,5,8,1,7,0]),import.meta.url)).markdown(),markdown:async()=>(await Xe(async()=>{const{markdown:a}=await import("./index-CUva-2wH.js");return{markdown:a}},__vite__mapDeps([9,3,4,2,5,8,1,7,0]),import.meta.url)).markdown(),py:async()=>(await Xe(async()=>{const{python:a}=await import("./index-jFtLq_ca.js");return{python:a}},__vite__mapDeps([10,1,2,3,4,5]),import.meta.url)).python(),pyi:async()=>(await Xe(async()=>{const{python:a}=await import("./index-jFtLq_ca.js");return{python:a}},__vite__mapDeps([10,1,2,3,4,5]),import.meta.url)).python(),yaml:async()=>(await Xe(async()=>{const{yaml:a}=await import("./index-D3uHnHOQ.js");return{yaml:a}},__vite__mapDeps([11,1,2,3,4]),import.meta.url)).yaml(),yml:async()=>(await Xe(async()=>{const{yaml:a}=await import("./index-D3uHnHOQ.js");return{yaml:a}},__vite__mapDeps([11,1,2,3,4]),import.meta.url)).yaml(),rs:async()=>(await Xe(async()=>{const{rust:a}=await import("./index-y4j9izne.js");return{rust:a}},__vite__mapDeps([12,1,2,3,4]),import.meta.url)).rust(),c:async()=>(await Xe(async()=>{const{cpp:a}=await import("./index-DtGGM1Mo.js");return{cpp:a}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),h:async()=>(await Xe(async()=>{const{cpp:a}=await import("./index-DtGGM1Mo.js");return{cpp:a}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),cc:async()=>(await Xe(async()=>{const{cpp:a}=await import("./index-DtGGM1Mo.js");return{cpp:a}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),cpp:async()=>(await Xe(async()=>{const{cpp:a}=await import("./index-DtGGM1Mo.js");return{cpp:a}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),hpp:async()=>(await Xe(async()=>{const{cpp:a}=await import("./index-DtGGM1Mo.js");return{cpp:a}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),java:async()=>(await Xe(async()=>{const{java:a}=await import("./index-DB2nshSr.js");return{java:a}},__vite__mapDeps([14,1,2,3,4]),import.meta.url)).java(),go:async()=>(await Xe(async()=>{const{go:a}=await import("./index-C5b0Bkhr.js");return{go:a}},__vite__mapDeps([15,1,2,3,4,5]),import.meta.url)).go(),php:async()=>(await Xe(async()=>{const{php:a}=await import("./index-CGA_fGck.js");return{php:a}},__vite__mapDeps([16,1,8,7,2,3,4,0,5]),import.meta.url)).php(),sql:async()=>(await Xe(async()=>{const{sql:a}=await import("./index-DYKV4X3G.js");return{sql:a}},__vite__mapDeps([17,2,3,4,1,5]),import.meta.url)).sql(),xml:async()=>(await Xe(async()=>{const{xml:a}=await import("./index-BNVOt0Er.js");return{xml:a}},__vite__mapDeps([18,1,2,3,4]),import.meta.url)).xml(),svg:async()=>(await Xe(async()=>{const{xml:a}=await import("./index-BNVOt0Er.js");return{xml:a}},__vite__mapDeps([18,1,2,3,4]),import.meta.url)).xml()},d1={".mcp.json":"json",dockerfile:"yaml",makefile:"yaml"},h1={javascript:"js",node:"js",typescript:"ts",python:"py",python3:"py",yml:"yaml",rust:"rs",golang:"go","c++":"cpp",cplusplus:"cpp"};async function p1(a){const l=h1[a.toLowerCase()]??a.toLowerCase(),i=ey[l];return i?i().catch(()=>null):null}async function m1(a){const l=(a.split("/").pop()??"").toLowerCase(),i=d1[l]??l.split(".").pop()??"",c=ey[i];return c?c().catch(()=>null):null}const g1=Px([{tag:[ke.keyword,ke.modifier,ke.controlKeyword,ke.moduleKeyword],class:"cmh-key"},{tag:[ke.propertyName],class:"cmh-prop"},{tag:[ke.function(ke.variableName),ke.labelName],class:"cmh-fn"},{tag:[ke.color,ke.constant(ke.name),ke.standard(ke.name),ke.bool],class:"cmh-const"},{tag:[ke.typeName,ke.className,ke.changed,ke.annotation,ke.self,ke.namespace],class:"cmh-type"},{tag:[ke.number,ke.integer,ke.float],class:"cmh-num"},{tag:[ke.string,ke.special(ke.string),ke.regexp],class:"cmh-str"},{tag:[ke.operator,ke.operatorKeyword,ke.escape],class:"cmh-op"},{tag:[ke.meta,ke.comment],class:"cmh-comment"},{tag:ke.invalid,class:"cmh-invalid"}]);function wo(a){return a.replace(/[&<>]/g,l=>l==="&"?"&amp;":l==="<"?"&lt;":"&gt;")}async function b1(a,l){const i=l?await p1(l):null;if(!i)return wo(a);try{const c=i.language.parser.parse(a);let o="";return r1(a,c,g1,(d,h)=>{o+=h?`<span class="${h}">${wo(d)}</span>`:wo(d)},()=>{o+=`
117
+ `}),o}catch{return wo(a)}}xt.setOptions({gfm:!0,breaks:!1});function ty(a){var i;const l=(i=a.split(".").pop())==null?void 0:i.toLowerCase();return l==="md"||l==="markdown"}async function $h(a){const l=await xt.parse(a,{async:!0,walkTokens:async i=>{if(i.type!=="code")return;const c=i;c.text=await b1(c.text,c.lang??""),c.escaped=!0}});return qv.sanitize(l)}function Yb(a,l){return{path:a.path,text:a.content,saved:a.content,eol:a.eol,encoding:a.encoding,mtime:a.mtime,size:a.size,binary:a.binary,tooLarge:a.tooLarge,stale:!1,revision:l,previewMode:ty(a.path)}}function Fa(a){return!a.binary&&!a.tooLarge&&a.text!==a.saved}function x1(a){return a.split("/").pop()??a}function Oi(a){const l=a.lastIndexOf("/");return l===-1?"":a.slice(0,l)}function oh(a){return a<1024?`${a} Б`:a<1024*1024?`${(a/1024).toFixed(1)} КБ`:`${(a/1024/1024).toFixed(1)} МБ`}function Gc({x:a,y:l,items:i,note:c,onClose:o}){const d=_.useRef(null),[h,p]=_.useState({left:a,top:l}),[m,x]=_.useState(()=>{const v=i.findIndex(R=>!R.disabled);return v===-1?0:v});_.useLayoutEffect(()=>{const v=d.current;if(!v)return;const R=v.getBoundingClientRect(),w=8,L=Math.max(w,Math.min(a,window.innerWidth-R.width-w)),B=Math.max(w,Math.min(l,window.innerHeight-R.height-w));p({left:L,top:B})},[a,l]),_.useLayoutEffect(()=>{var v;(v=d.current)==null||v.focus()},[]),_.useLayoutEffect(()=>{function v(w){var L;(L=d.current)!=null&&L.contains(w.target)||o()}function R(){o()}return document.addEventListener("mousedown",v),document.addEventListener("scroll",R,!0),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("scroll",R,!0)}},[o]);function y(v){v.disabled||(v.onSelect(),o())}function j(v){if(v.key==="Escape"){v.preventDefault(),v.stopPropagation(),o();return}const R=i.map((w,L)=>({item:w,index:L})).filter(w=>!w.item.disabled);if(R.length!==0){if(v.key==="ArrowDown"||v.key==="ArrowUp"){v.preventDefault();const w=v.key==="ArrowDown"?1:-1,L=R.findIndex(P=>P.index===m),B=R[(((L===-1?0:L)+w)%R.length+R.length)%R.length];B&&x(B.index);return}if(v.key==="Enter"||v.key===" "){v.preventDefault();const w=i[m];w&&y(w)}}}return r.jsxs("div",{ref:d,className:"ctxmenu",style:{left:h.left,top:h.top},role:"menu",tabIndex:-1,onKeyDown:j,children:[c&&r.jsx("div",{className:"ctxmenu__note",children:c}),i.map((v,R)=>r.jsxs("button",{type:"button",role:"menuitem","aria-disabled":v.disabled,className:"ctxmenu__item"+(R===m?" is-cursor":""),onMouseEnter:()=>x(R),onClick:()=>y(v),children:[r.jsx("span",{className:"ctxmenu__label",children:v.label}),v.hint&&r.jsx("span",{className:"ctxmenu__hint",children:v.hint})]},v.id))]})}const y1=3500,_1=9e3,Xb=220;function Ui({result:a,onDismiss:l}){const[i,c]=_.useState(a),[o,d]=_.useState(!1);if(_.useEffect(()=>{if(!a){c(null),d(!1);return}if(c(a),d(!1),a.url)return;const p=a.ok?y1:_1,m=setTimeout(()=>d(!0),p),x=setTimeout(()=>c(null),p+Xb);return()=>{clearTimeout(m),clearTimeout(x)}},[a]),!i)return null;const h=()=>{d(!0),setTimeout(()=>{c(null),l==null||l()},Xb)};return r.jsxs("div",{className:"oplog "+(i.ok?"oplog--ok":"oplog--bad")+(o?" oplog--leaving":"")+(i.url?" oplog--dismissible":""),role:"status","aria-live":i.ok?"polite":"assertive",children:[i.message,i.url&&r.jsxs("a",{className:"oplog__link",href:i.url,target:"_blank",rel:"noreferrer",onClick:p=>p.stopPropagation(),children:[i.url.replace(/^https?:\/\//,"")," ↗"]}),i.url&&l&&r.jsx("button",{type:"button",className:"oplog__dismiss",title:"Закрыть","aria-label":"Закрыть сообщение",onClick:h,children:"✕"})]})}function Zc({value:a,className:l,placeholder:i="Название сессии",onCommit:c,onCancel:o}){const[d,h]=_.useState(a),p=_.useRef(null);_.useEffect(()=>{var x;(x=p.current)==null||x.select()},[]);function m(){const x=d.trim();if(!x||x===a)return o();c(x)}return r.jsx("input",{ref:p,className:l?`rename ${l}`:"rename",value:d,autoFocus:!0,spellCheck:!1,placeholder:i,onChange:x=>h(x.target.value),onBlur:m,onKeyDown:x=>{x.stopPropagation(),x.key==="Enter"?(x.preventDefault(),m()):x.key==="Escape"&&(x.preventDefault(),o())}})}function Ur({active:a}){return a?r.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M2 5h3V2"}),r.jsx("path",{d:"M14 5h-3V2"}),r.jsx("path",{d:"M2 11h3v3"}),r.jsx("path",{d:"M14 11h-3v3"})]}):r.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M5 2H2v3"}),r.jsx("path",{d:"M11 2h3v3"}),r.jsx("path",{d:"M2 11v3h3"}),r.jsx("path",{d:"M14 11v3h-3"})]})}const v1=500,ki="application/x-ccv-fs-path",S1=200;function j1({open:a,tree:l,expanded:i,activePath:c,dirty:o,gitChanges:d,result:h,searchResult:p,onSearch:m,onReveal:x,onToggle:y,onOpen:j,onCreate:v,onRename:R,onMove:w,onCopy:L,onDelete:B,onRefresh:P,onClose:M,zoomed:Q,onToggleZoom:k}){const[Z,z]=_.useState(""),[A,V]=_.useState(null),[te,fe]=_.useState(null),[F,ae]=_.useState(null),[me,we]=_.useState(null),[ge,H]=_.useState(null),[ie,re]=_.useState(null),ue=Vo("(hover: hover)"),_e=_.useRef(null),T=_.useMemo(()=>w1(d),[d]);function K(E){return!(!F||E===F.path||F.kind==="dir"&&E.startsWith(`${F.path}/`)||E===Oi(F.path))}function oe(E){return!(!ge||E===ge.path||ge.kind==="dir"&&E.startsWith(`${ge.path}/`)||ge.mode==="cut"&&E===Oi(ge.path))}function pe(E){H({path:E.path,kind:E.kind,mode:"copy"})}function Ne(E){H({path:E.path,kind:E.kind,mode:"cut"})}function ye(E){!ge||!oe(E)||(E&&!i.has(E)&&y(E),ge.mode==="cut"?(w(ge.path,E),H(null)):L(ge.path,E))}function Ae(E,Y){const ve=E.touches[0];if(!ve)return;const D={timer:0,x:ve.clientX,y:ve.clientY,el:E.currentTarget,fired:!1};D.timer=window.setTimeout(()=>{D.fired=!0,Y(D.x,D.y,D.el)},v1),_e.current=D}function st(E){const Y=_e.current,ve=E.touches[0];!Y||!ve||Math.hypot(ve.clientX-Y.x,ve.clientY-Y.y)>10&&(window.clearTimeout(Y.timer),_e.current=null)}function Qe(E){const Y=_e.current;Y&&(window.clearTimeout(Y.timer),Y.fired&&E.preventDefault())}function Ot(){var E;return(E=_e.current)!=null&&E.fired?(_e.current=null,!0):!1}function qe(E,Y,ve,D){z((D==null?void 0:D.path)??""),re({x:E,y:Y,opener:ve,entry:D})}function yt(){const E=ie==null?void 0:ie.opener;re(null),E!=null&&E.isConnected&&E.focus()}function et(E){return{onContextMenu:Y=>{Y.preventDefault(),qe(Y.clientX,Y.clientY,Y.currentTarget,E)},onTouchStart:Y=>Ae(Y,(ve,D,J)=>qe(ve,D,J,E)),onTouchMove:st,onTouchEnd:Qe,onTouchCancel:Qe}}function Je(E){E.target===E.currentTarget&&(E.preventDefault(),qe(E.clientX,E.clientY,E.currentTarget,null))}function Fe(E){E.target===E.currentTarget&&Ae(E,(Y,ve,D)=>qe(Y,ve,D,null))}function it(E){if(!(E.ctrlKey||E.metaKey)||E.target instanceof HTMLInputElement)return;const Y=E.key.toLowerCase();if(Y==="v"){E.preventDefault(),ye(fn());return}if(!Z)return;const ve=Vb(l,Z);ve&&(Y==="c"?(E.preventDefault(),pe(ve)):Y==="x"&&(E.preventDefault(),Ne(ve)))}function Jn(E){return Y=>{Y.dataTransfer.effectAllowed="move",Y.dataTransfer.setData(ki,E.path),ae({path:E.path,kind:E.kind})}}function Bt(){ae(null),we(null)}function qt(E){return Y=>{Y.dataTransfer.types.includes(ki)&&(Y.stopPropagation(),!(E.kind!=="dir"||!K(E.path))&&(Y.preventDefault(),we(E.path)))}}function Kt(E){return Y=>{if(!Y.dataTransfer.types.includes(ki)||(Y.stopPropagation(),E.kind!=="dir"||!K(E.path)))return;Y.preventDefault();const ve=Y.dataTransfer.getData(ki);we(null),ve&&w(ve,E.path)}}function It(E){!E.dataTransfer.types.includes(ki)||!K("")||(E.preventDefault(),we(""))}function Gt(E){if(!E.dataTransfer.types.includes(ki)||!K(""))return;E.preventDefault();const Y=E.dataTransfer.getData(ki);we(null),Y&&w(Y,"")}const[Qt,rt]=_.useState(""),Tt=Qt.trim(),en=Tt.length>0,En=_.useRef(null),Ct=_.useRef(m);Ct.current=m;function kn(E){rt(E),En.current&&clearTimeout(En.current);const Y=E.trim();if(!Y){Ct.current("");return}En.current=setTimeout(()=>Ct.current(Y),S1)}function An(E){En.current&&clearTimeout(En.current),rt(""),Ct.current(""),z(E.path),x(E)}const Dt=en&&(p==null?void 0:p.query)===Tt?p:null;function fn(){if(Z==="")return"";const E=Vb(l,Z);if((E==null?void 0:E.kind)==="dir")return Z;const Y=Z.lastIndexOf("/");return Y===-1?"":Z.slice(0,Y)}function Jt(E,Y){const ve=Y??fn();ve&&!i.has(ve)&&y(ve),fe({parent:ve,kind:E})}function Et(){if(!ie)return[];const E=D=>ue?D:void 0;if(!ie.entry)return[{id:"paste",label:"Вставить в корень проекта",hint:E("Ctrl+V"),disabled:!oe(""),onSelect:()=>ye("")},{id:"new-file",label:"Создать файл",onSelect:()=>Jt("file","")},{id:"new-dir",label:"Создать каталог",onSelect:()=>Jt("dir","")}];const Y=ie.entry,ve=[Y.kind==="file"?{id:"open",label:"Открыть",onSelect:()=>j(Y.path)}:{id:"toggle",label:i.has(Y.path)?"Свернуть":"Развернуть",onSelect:()=>y(Y.path)},{id:"copy",label:"Копировать",hint:E("Ctrl+C"),onSelect:()=>pe(Y)},{id:"cut",label:"Вырезать",hint:E("Ctrl+X"),onSelect:()=>Ne(Y)}];return Y.kind==="dir"&&(ve.push({id:"paste",label:"Вставить",hint:E("Ctrl+V"),disabled:!oe(Y.path),onSelect:()=>ye(Y.path)}),ve.push({id:"new-file",label:"Создать файл",onSelect:()=>Jt("file",Y.path)}),ve.push({id:"new-dir",label:"Создать каталог",onSelect:()=>Jt("dir",Y.path)})),ve.push({id:"rename",label:"Переименовать",onSelect:()=>V(Y.path)}),ve.push({id:"delete",label:"Удалить",onSelect:()=>B(Y)}),ve}const dn=en?[]:ot("",0);function ot(E,Y){const ve=l[E],D=[];if(te&&te.parent===E&&D.push(r.jsxs("div",{className:"fsrow fsrow--draft",style:Wa(Y),children:[r.jsx("span",{className:"fsrow__icon",children:te.kind==="dir"?r.jsx(Go,{}):r.jsx(Yo,{})}),r.jsx(Zc,{className:"rename--file",value:"",placeholder:te.kind==="dir"?"имя каталога":"имя файла",onCommit:J=>{fe(null),v(E,te.kind,J)},onCancel:()=>fe(null)})]},`draft:${E}`)),!ve)return D.push(r.jsx("p",{className:"fsrow__pending",style:Wa(Y),children:"читаем…"},`wait:${E}`)),D;ve.length===0&&!te&&D.push(r.jsx("p",{className:"fsrow__pending",style:Wa(Y),children:"пусто"},`empty:${E}`));for(const J of ve){const xe=J.kind==="dir"&&i.has(J.path);D.push(A===J.path?r.jsxs("div",{className:"fsrow fsrow--draft",style:Wa(Y),children:[r.jsx("span",{className:"fsrow__icon",children:J.kind==="dir"?r.jsx(Go,{open:xe}):r.jsx(Yo,{})}),r.jsx(Zc,{className:"rename--file",value:J.name,placeholder:"новое имя",onCommit:Be=>{V(null),R(J.path,Be)},onCancel:()=>V(null)})]},J.path):r.jsx(k1,{entry:J,depth:Y,open:xe,active:J.path===c,selected:J.path===Z,dirty:o.has(J.path),gitStatus:T.get(J.path),dragging:(F==null?void 0:F.path)===J.path,dropTarget:me===J.path,cut:(ge==null?void 0:ge.mode)==="cut"&&ge.path===J.path,onClick:()=>{Ot()||(z(J.path),J.kind==="dir"?y(J.path):j(J.path))},onRename:()=>V(J.path),onDelete:()=>B(J),onDragStart:Jn(J),onDragEnd:Bt,onDragOver:qt(J),onDrop:Kt(J),...et(J)},J.path)),xe&&D.push(...ot(J.path,Y+1))}return D}function tn(){if(!Dt)return[r.jsx("p",{className:"fsrow__pending",style:Wa(0),children:"ищем…"},"search:wait")];if(Dt.entries.length===0)return[r.jsx("p",{className:"fsrow__pending",style:Wa(0),children:"ничего не найдено"},"search:empty")];const E=Dt.entries.map(Y=>r.jsx(N1,{entry:Y,gitStatus:T.get(Y.path),onClick:()=>An(Y)},Y.path));return Dt.truncated&&E.push(r.jsxs("p",{className:"fsrow__pending",style:Wa(0),children:["показаны первые ",Dt.entries.length," — уточните запрос"]},"search:truncated")),E}return r.jsxs("aside",{className:(a?"sidepane sidepane--files sidepane--open":"sidepane sidepane--files")+(Q?" sidepane--zoomed":""),"aria-label":"Файлы проекта",onKeyDown:it,children:[r.jsxs("div",{className:"sidepane__head",onDoubleClick:E=>{k&&(E.target.closest("button")||k())},children:[r.jsx(C1,{}),r.jsx("span",{className:"sidepane__title",children:"Файлы"}),r.jsx("button",{className:"sidepane__btn",title:"Новый файл","aria-label":"Новый файл",onClick:()=>Jt("file"),children:r.jsx(E1,{})}),r.jsx("button",{className:"sidepane__btn",title:"Новый каталог","aria-label":"Новый каталог",onClick:()=>Jt("dir"),children:r.jsx(A1,{})}),r.jsx("button",{className:"sidepane__btn",title:"Перечитать дерево","aria-label":"Перечитать дерево",onClick:P,children:"↻"}),k&&r.jsx("button",{className:"sidepane__btn",title:Q?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":Q?"Свернуть панель файлов":"Развернуть панель файлов на весь экран","aria-pressed":Q,onClick:k,children:r.jsx(Ur,{active:Q})}),r.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель файлов",onClick:M,children:"✕"})]}),r.jsxs("div",{className:"fssearch",children:[r.jsx(R1,{}),r.jsx("input",{className:"fssearch__input",type:"text",value:Qt,spellCheck:!1,placeholder:"Поиск файлов и папок…","aria-label":"Поиск файлов и папок",onChange:E=>kn(E.target.value),onKeyDown:E=>{E.stopPropagation(),E.key==="Escape"&&(E.preventDefault(),Qt?kn(""):E.currentTarget.blur())}}),Qt&&r.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>kn(""),children:"✕"})]}),r.jsx("div",{className:"sidepane__scroll fstree"+(me===""?" fstree--drop-target":""),tabIndex:-1,onDragOver:It,onDrop:Gt,onContextMenu:Je,onTouchStart:Fe,onTouchMove:st,onTouchEnd:Qe,onTouchCancel:Qe,children:en?tn():dn}),r.jsx(Ui,{result:h}),ie&&r.jsx(Gc,{x:ie.x,y:ie.y,items:Et(),onClose:yt})]})}function k1({entry:a,depth:l,open:i,active:c,selected:o,dirty:d,gitStatus:h,dragging:p,dropTarget:m,cut:x,onClick:y,onRename:j,onDelete:v,onDragStart:R,onDragEnd:w,onDragOver:L,onDrop:B,onContextMenu:P,onTouchStart:M,onTouchMove:Q,onTouchEnd:k,onTouchCancel:Z}){const z="fsrow"+(c?" is-open":"")+(o&&!c?" is-selected":"")+(a.ignored?" fsrow--ignored":"")+(p?" fsrow--dragging":"")+(m?" fsrow--drop-target":"")+(x?" fsrow--cut":"");return r.jsxs("div",{className:z,style:Wa(l),draggable:!0,onDragStart:R,onDragEnd:w,onDragOver:L,onDrop:B,onContextMenu:P,onTouchStart:M,onTouchMove:Q,onTouchEnd:k,onTouchCancel:Z,children:[r.jsxs("button",{className:"fsrow__main",onClick:y,title:ny(a),children:[r.jsx("span",{className:"fsrow__icon"+Io("fsrow__icon",h),children:a.kind==="dir"?r.jsx(Go,{open:i}):r.jsx(Yo,{})}),r.jsx("span",{className:"fsrow__name"+Io("fsrow__name",h),children:a.name}),a.ignored&&r.jsx("span",{className:"fsrow__tag",title:"Игнорируется git (.gitignore)",children:"git-ignore"}),d&&r.jsx("span",{className:"fsrow__dot",title:"Есть несохранённые правки"})]}),r.jsx("button",{className:"fsrow__act",title:"Переименовать","aria-label":`Переименовать ${a.name}`,onClick:j,children:"✎"}),r.jsx("button",{className:"fsrow__act",title:"Удалить","aria-label":`Удалить ${a.name}`,onClick:v,children:"✕"})]})}function N1({entry:a,gitStatus:l,onClick:i}){const c=a.path.slice(0,a.path.length-a.name.length-1);return r.jsxs("button",{className:"fsrow fsrow--search"+(a.ignored?" fsrow--ignored":""),style:Wa(0),onClick:i,title:ny(a),children:[r.jsx("span",{className:"fsrow__icon"+Io("fsrow__icon",l),children:a.kind==="dir"?r.jsx(Go,{}):r.jsx(Yo,{})}),r.jsx("span",{className:"fsrow__name"+Io("fsrow__name",l),children:a.name}),a.ignored&&r.jsx("span",{className:"fsrow__tag",children:"git-ignore"}),c&&r.jsx("span",{className:"fsrow__path",children:c})]})}function ny(a){return a.ignored?`${a.path} — игнорируется git (.gitignore)`:a.path}function Wa(a){return{"--depth":a}}function Vb(a,l){var o;const i=l.lastIndexOf("/"),c=i===-1?"":l.slice(0,i);return((o=a[c])==null?void 0:o.find(d=>d.path===l))??null}function w1(a){const l=new Map,i={added:1,modified:2},c=(o,d)=>{const h=l.get(o);(!h||i[d]>i[h])&&l.set(o,d)};for(const o of a){const d=T1(o.status);if(!d)continue;c(o.path,d);let h=Oi(o.path);for(;c(h,d),!!h;)h=Oi(h)}return l}function T1(a){if(a==="??")return"added";const[l="",i=""]=a;return l==="A"||l==="R"||l==="C"?"added":l==="M"||i==="M"?"modified":null}function Io(a,l){return l?` ${a}--git-${l}`:""}function Go({open:a=!1}){return r.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,"aria-hidden":"true",children:a?r.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"}):r.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 Yo(){return r.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,strokeLinejoin:"round","aria-hidden":"true",children:[r.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"}),r.jsx("path",{d:"M9 2v3.2h3.3"})]})}function E1(){return r.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,"aria-hidden":"true",children:[r.jsxs("g",{transform:"translate(-1.3,-1.6) scale(0.78)",strokeLinejoin:"round",children:[r.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"}),r.jsx("path",{d:"M9 2v3.2h3.3"})]}),r.jsx("path",{d:"M12.2 10.3v3.8M10.3 12.2h3.8",strokeLinecap:"round"})]})}function A1(){return r.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,"aria-hidden":"true",children:[r.jsx("g",{transform:"translate(-1.3,-1.6) scale(0.78)",children:r.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"})}),r.jsx("path",{d:"M12.2 10.3v3.8M10.3 12.2h3.8",strokeLinecap:"round"})]})}function C1(){return r.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[r.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"}),r.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 R1(){return r.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[r.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),r.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}const M1=200;function O1({open:a,result:l,onSearch:i,onOpenMatch:c,onClose:o,zoomed:d,onToggleZoom:h}){const[p,m]=_.useState(""),x=p.trim(),y=x.length>0,j=_.useRef(null),v=_.useRef(i);v.current=i;function R(B){m(B),j.current&&clearTimeout(j.current);const P=B.trim();if(!P){v.current("");return}j.current=setTimeout(()=>v.current(P),M1)}const w=y&&(l==null?void 0:l.query)===x?l:null;function L(){if(!w)return[r.jsx("p",{className:"fsrow__pending",children:"ищем…"},"grep:wait")];if(w.matches.length===0)return[r.jsx("p",{className:"fsrow__pending",children:"ничего не найдено"},"grep:empty")];const B=[];let P="";for(const M of w.matches)M.path!==P&&(P=M.path,B.push(r.jsx("p",{className:"searchgroup__path",title:M.path,children:M.path},`path:${M.path}`))),B.push(r.jsx(D1,{match:M,onClick:()=>c(M)},`${M.path}:${M.line}:${M.column}`));return w.truncated&&B.push(r.jsxs("p",{className:"fsrow__pending",children:["показаны первые ",w.matches.length," — уточните запрос"]},"grep:truncated")),B}return r.jsxs("aside",{className:(a?"sidepane sidepane--search sidepane--open":"sidepane sidepane--search")+(d?" sidepane--zoomed":""),"aria-label":"Поиск по тексту в проекте",children:[r.jsxs("div",{className:"sidepane__head",onDoubleClick:B=>{h&&(B.target.closest("button")||h())},children:[r.jsx(z1,{}),r.jsx("span",{className:"sidepane__title",children:"Поиск по тексту"}),h&&r.jsx("button",{className:"sidepane__btn",title:d?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":d?"Свернуть панель поиска":"Развернуть панель поиска на весь экран","aria-pressed":d,onClick:h,children:r.jsx(Ur,{active:d})}),r.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель поиска",onClick:o,children:"✕"})]}),r.jsxs("div",{className:"fssearch",children:[r.jsx(L1,{}),r.jsx("input",{className:"fssearch__input",type:"text",value:p,spellCheck:!1,placeholder:"Поиск по тексту во всех файлах…","aria-label":"Поиск по тексту во всех файлах",onChange:B=>R(B.target.value),onKeyDown:B=>{B.stopPropagation(),B.key==="Escape"&&(B.preventDefault(),p?R(""):B.currentTarget.blur())}}),p&&r.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>R(""),children:"✕"})]}),r.jsx("div",{className:"sidepane__scroll fstree",children:y?L():r.jsx("p",{className:"sidepane__empty",children:"Введите текст, чтобы найти его во всех файлах проекта."})})]})}function D1({match:a,onClick:l}){const i=a.lineText.slice(0,a.column-1),c=a.lineText.slice(a.column-1,a.column-1+a.matchLength),o=a.lineText.slice(a.column-1+a.matchLength);return r.jsxs("button",{className:"searchmatch",onClick:l,title:`${a.path}:${a.line}`,children:[r.jsx("span",{className:"searchmatch__line",children:a.line}),r.jsxs("span",{className:"searchmatch__text",children:[i,r.jsx("mark",{children:c}),o]})]})}function z1(){return r.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[r.jsx("circle",{cx:"6.8",cy:"6.8",r:"4.3"}),r.jsx("path",{d:"M13.2 13.2 10.1 10.1"})]})}function L1(){return r.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[r.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),r.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}let To=null;function U1(){return To||(To=Promise.all([Xe(()=>import("./index-CiBOLsj6.js"),__vite__mapDeps([19,4,3,2,20,5]),import.meta.url),Xe(()=>import("./index-891wE-Rj.js").then(a=>a.v),__vite__mapDeps([4,3]),import.meta.url),Xe(()=>import("./index-BHot-lnj.js"),[],import.meta.url),Xe(()=>import("./index-CR5imSsQ.js"),__vite__mapDeps([20,3,4,2]),import.meta.url),Xe(()=>import("./codemirror-BlfaJp7t.js"),__vite__mapDeps([21,2,3,4]),import.meta.url)]).then(([a,l,i,c,o])=>({EditorView:l.EditorView,EditorState:i.EditorState,Compartment:i.Compartment,EditorSelection:i.EditorSelection,Prec:i.Prec,keymap:l.keymap,indentWithTab:c.indentWithTab,basicSetup:a.basicSetup,editorTheme:o.editorTheme,editorHighlight:o.editorHighlight})).catch(a=>{throw To=null,a})),To}function H1({path:a,doc:l,revision:i,goto:c,onChange:o,onSave:d}){const h=_.useRef(null),p=_.useRef(null),m=_.useRef(null),x=_.useRef(new Map),y=_.useRef(new Map),j=_.useRef(new Set),v=_.useRef(null),R=_.useRef(o),w=_.useRef(d),L=_.useRef(a),B=_.useRef(i),P=_.useRef(l);R.current=o,w.current=d,L.current=a,B.current=i,P.current=l;const[M,Q]=_.useState("loading"),[k,Z]=_.useState(!1);function z(V,te,fe,F,ae){const me=x.current.get(F),we=y.current.get(F)===ae;if(me&&we)fe.setState(me);else{const H=V.EditorState.create({doc:P.current,extensions:[V.basicSetup,V.Prec.highest(V.keymap.of([{key:"Mod-s",preventDefault:!0,run:()=>(w.current(L.current),!0)}])),V.keymap.of([V.indentWithTab]),te.of([]),V.editorTheme,V.editorHighlight,V.EditorView.updateListener.of(ie=>{ie.docChanged&&R.current(L.current,ie.state.doc.toString())})]});x.current.set(F,H),y.current.set(F,ae),fe.setState(H),j.current.delete(F)}if(j.current.has(F))return()=>{};let ge=!1;return m1(F).then(H=>{ge||!H||L.current!==F||(fe.dispatch({effects:te.reconfigure(H)}),x.current.set(F,fe.state),j.current.add(F))}),()=>{ge=!0}}_.useEffect(()=>{if(!h.current)return;let te=!1,fe=null,F=null;Q("loading"),Z(!1);const ae=window.setTimeout(()=>{te||Z(!0)},200);return(async()=>{let me;try{me=await U1()}catch{window.clearTimeout(ae),te||Q("error");return}if(te||!h.current)return;window.clearTimeout(ae);const we=new me.Compartment;v.current=we,m.current=me,F=new me.EditorView({parent:h.current}),p.current=F,fe=z(me,we,F,L.current,B.current),Q("ready")})(),()=>{te=!0,window.clearTimeout(ae),fe==null||fe(),F==null||F.destroy(),p.current===F&&(p.current=null),m.current=null,v.current=null}},[]),_.useEffect(()=>{const V=m.current,te=p.current,fe=v.current;if(!(!V||!te||!fe))return z(V,fe,te,a,i)},[a,i]);const A=_.useRef(0);return _.useEffect(()=>{const V=p.current,te=m.current;if(!V||!te||!c||c.token===A.current)return;A.current=c.token;const fe=V.state.doc.lines,F=Math.min(Math.max(c.line,1),fe),ae=V.state.doc.line(F),me=Math.min(ae.from+Math.max(c.column-1,0),ae.to);V.dispatch({selection:te.EditorSelection.cursor(me),effects:te.EditorView.scrollIntoView(me,{y:"center"})}),V.focus()},[c]),_.useEffect(()=>()=>{const V=p.current;V&&x.current.set(a,V.state)},[a]),r.jsxs("div",{className:"editor__code",children:[r.jsx("div",{ref:h,className:"editor__code-surface"+(M==="ready"?"":" is-hidden")}),M==="loading"&&k&&r.jsxs("div",{className:"editor__state work",role:"status",children:[r.jsxs("div",{className:"work__dots",children:[r.jsx("span",{className:"work__dot"}),r.jsx("span",{className:"work__dot"}),r.jsx("span",{className:"work__dot"})]}),r.jsx("span",{className:"work__label",children:"Загружается редактор…"})]}),M==="error"&&r.jsxs("div",{className:"editor__fallback",children:[r.jsxs("div",{className:"editor__fallback-banner",role:"alert",children:[r.jsx("span",{children:"Редактор не загрузился — ниже только просмотр, без сохранения правок."}),r.jsx("button",{className:"btn btn--sm btn--primary",onClick:()=>window.location.reload(),children:"Перезагрузить страницу"})]}),r.jsx("pre",{className:"editor__fallback-text",children:l})]})]})}function B1({file:a,goto:l,onChange:i,onSave:c,onReload:o,onOverwrite:d,onTogglePreview:h}){const p=Fa(a),m=ty(a.path)&&!a.binary&&!a.tooLarge;return r.jsxs("div",{className:"editor",children:[r.jsxs("div",{className:"editor__bar",children:[r.jsx("span",{className:"editor__path",title:a.path,children:a.path}),r.jsxs("span",{className:"editor__meta",children:[oh(a.size),a.eol==="crlf"&&" · CRLF"]}),m&&r.jsxs("div",{className:"editor__viewtoggle",role:"tablist","aria-label":"Режим просмотра",children:[r.jsx("button",{className:"btn btn--sm"+(a.previewMode?" is-on":""),role:"tab","aria-selected":a.previewMode,onClick:()=>!a.previewMode&&h(a.path),children:"Просмотр"}),r.jsx("button",{className:"btn btn--sm"+(a.previewMode?"":" is-on"),role:"tab","aria-selected":!a.previewMode,onClick:()=>a.previewMode&&h(a.path),children:"Код"})]}),r.jsx("button",{className:"btn btn--sm",disabled:!p,title:"Сохранить (Ctrl+S)",onClick:()=>c(a.path),children:p?"Сохранить":"Сохранено"})]}),a.stale&&r.jsxs("div",{className:"editor__warn",children:[r.jsxs("span",{children:["Файл изменился на диске",p?" — а здесь есть несохранённые правки.":"."]}),r.jsx("button",{className:"btn btn--sm",onClick:()=>o(a.path),children:"Взять с диска"}),p&&r.jsx("button",{className:"btn btn--sm btn--danger",onClick:()=>d(a.path),children:"Сохранить поверх"})]}),a.binary?r.jsxs("p",{className:"editor__empty",children:["Это не текстовый файл — редактировать его здесь нечем. ",oh(a.size)," на диске."]}):a.tooLarge?r.jsxs("p",{className:"editor__empty",children:["Файл слишком велик для редактора (",oh(a.size),"). Такие правит агент, а не браузер."]}):m&&a.previewMode?r.jsx(q1,{text:a.text}):r.jsx(H1,{path:a.path,doc:a.text,revision:a.revision,goto:l,onChange:i,onSave:c})]})}function q1({text:a}){const[l,i]=_.useState("");return _.useEffect(()=>{let c=!1;return $h(a).then(o=>{c||i(o)}),()=>{c=!0}},[a]),r.jsx("div",{className:"markdown-preview",dangerouslySetInnerHTML:{__html:l}})}function I1({files:a,activePath:l,busy:i,onSelect:c,onClose:o,zoomed:d,onToggleZoom:h}){return r.jsxs("div",{className:"worktabs",role:"tablist",onDoubleClick:p=>{h&&(p.target.closest("button")||h())},children:[r.jsxs("button",{className:"worktab"+(l===null?" is-on":""),role:"tab","aria-selected":l===null,onClick:()=>c(null),onDoubleClick:()=>h==null?void 0:h(),children:[r.jsx("span",{className:"worktab__name",children:"Разговор"}),i&&r.jsx("span",{className:"worktab__dot worktab__dot--busy",title:"Агент работает"})]}),a.map(p=>r.jsxs("div",{className:"worktab"+(p.path===l?" is-on":""),role:"tab","aria-selected":p.path===l,onDoubleClick:m=>{h&&(m.target.closest(".worktab__close, .worktab__dot")||h())},children:[r.jsx("button",{className:"worktab__name",title:p.path,onClick:()=>c(p.path),children:x1(p.path)}),Fa(p)?r.jsx("button",{className:"worktab__dot",title:"Не сохранено — закрыть","aria-label":`Закрыть ${p.path}`,onClick:()=>o(p.path)}):r.jsx("button",{className:"worktab__close",title:"Закрыть","aria-label":`Закрыть ${p.path}`,onClick:()=>o(p.path),children:"✕"})]},p.path)),r.jsx("div",{className:"worktabs__spacer"}),h&&r.jsx("button",{className:"worktabs__zoom",title:d?"Свернуть — то же самое, что двойной клик по вкладке":"Развернуть на весь экран — то же самое, что двойной клик по вкладке","aria-label":d?"Свернуть колонку разговора":"Развернуть колонку разговора на весь экран","aria-pressed":d,onClick:h,children:r.jsx(Ur,{active:d})})]})}const ly="ccv:sidebar.collapsed",ay="ccv:sidebar.mode",G1=500,$b="транскрипт остаётся на диске — сессию можно вернуть из архива в любой момент.";function Y1({open:a,connected:l,status:i,workspaces:c,sessions:o,archived:d,pinned:h,activeWorkspaceId:p,activeSessionId:m,onSelectWorkspace:x,onSelectSession:y,onRenameSession:j,onPinSessions:v,onSelectPinned:R,onCloseWorkspaces:w,onArchiveSessions:L,onUnarchiveSessions:B,onOpenWorkspace:P,onNewSession:M,onOpenExtensions:Q,account:k,onOpenAccount:Z,relay:z,onOpenRelay:A,onOpenSettings:V,themeMode:te,onCycleTheme:fe}){const[F,ae]=_.useState(null),[me,we]=_.useState(""),[ge,H]=_.useState($1),[ie,re]=_.useState(Q1);function ue(){re(E=>{const Y=E==="pinned"?"default":"pinned";try{localStorage.setItem(ay,Y)}catch{}return Y})}const _e=me.trim().toLowerCase(),T=_e!=="",K=_.useMemo(()=>T?c.filter(E=>E.name.toLowerCase().includes(_e)||E.path.toLowerCase().includes(_e)):c,[c,_e,T]),oe=_.useMemo(()=>T?o.filter(E=>(E.title??"").toLowerCase().includes(_e)):o,[o,_e,T]),pe=_.useMemo(()=>T?d.filter(E=>(E.title??"").toLowerCase().includes(_e)):d,[d,_e,T]),Ne=E=>{var Y;return((Y=c.find(ve=>ve.id===E))==null?void 0:Y.name)??"—"},ye=E=>{var Y;return(Y=c.find(ve=>ve.id===E))==null?void 0:Y.path},Ae=_.useMemo(()=>T?h.filter(E=>(E.title??"").toLowerCase().includes(_e)||Ne(E.workspaceId).toLowerCase().includes(_e)):h,[h,c,_e,T]);function st(E){H(Y=>{const ve=Y.includes(E)?Y.filter(D=>D!==E):[...Y,E];try{localStorage.setItem(ly,JSON.stringify(ve))}catch{}return ve})}const Qe=E=>!ge.includes(E),Ot=Zb(K),qe=Zb(oe),[yt,et]=_.useState(null),[Je,Fe]=_.useState(null),[it,Jn]=_.useState(null),Bt=_.useRef(null);function qt(E,Y){const ve=E.touches[0];if(!ve)return;const D={timer:0,x:ve.clientX,y:ve.clientY,el:E.currentTarget,fired:!1};D.timer=window.setTimeout(()=>{D.fired=!0,Y(D.x,D.y,D.el)},G1),Bt.current=D}function Kt(E){const Y=Bt.current,ve=E.touches[0];!Y||!ve||Math.hypot(ve.clientX-Y.x,ve.clientY-Y.y)>10&&(window.clearTimeout(Y.timer),Bt.current=null)}function It(E){const Y=Bt.current;Y&&(window.clearTimeout(Y.timer),Y.fired&&E.preventDefault())}function Gt(){var E;return(E=Bt.current)!=null&&E.fired?(Bt.current=null,!0):!1}function Qt(){const E=yt==null?void 0:yt.opener;et(null),E!=null&&E.isConnected&&E.focus()}function rt(){const E=Je==null?void 0:Je.opener;Fe(null),E!=null&&E.isConnected&&E.focus()}function Tt(){const E=it==null?void 0:it.opener;Jn(null),E!=null&&E.isConnected&&E.focus()}function en(E){return{onContextMenu:Y=>{Y.preventDefault(),et({x:Y.clientX,y:Y.clientY,opener:Y.currentTarget,ids:Ot.targetsFor(E)})},onTouchStart:Y=>qt(Y,(ve,D,J)=>et({x:ve,y:D,opener:J,ids:Ot.targetsFor(E)})),onTouchMove:Kt,onTouchEnd:It,onTouchCancel:It}}function En(E){return{onContextMenu:Y=>{Y.preventDefault(),Fe({x:Y.clientX,y:Y.clientY,opener:Y.currentTarget,ids:qe.targetsFor(E)})},onTouchStart:Y=>qt(Y,(ve,D,J)=>Fe({x:ve,y:D,opener:J,ids:qe.targetsFor(E)})),onTouchMove:Kt,onTouchEnd:It,onTouchCancel:It}}function Ct(E){return{onContextMenu:Y=>{Y.preventDefault(),Jn({x:Y.clientX,y:Y.clientY,opener:Y.currentTarget,ids:[E.id]})},onTouchStart:Y=>qt(Y,(ve,D,J)=>Jn({x:ve,y:D,opener:J,ids:[E.id]})),onTouchMove:Kt,onTouchEnd:It,onTouchCancel:It}}const kn=o.filter(E=>E.state!=="closed").length,An=yt?[{id:"close",label:yt.ids.length>1?`Закрыть проекты (${yt.ids.length})`:"Закрыть проект",onSelect:()=>{w(yt.ids),Ot.clear()}}]:[],Dt=yt?"закрытие не удаляет проект: каталог и история сессий остаются на диске — открыть его снова можно кнопкой «+ Проект»."+(p&&yt.ids.includes(p)&&kn>0?` в нём сейчас незавершённых сессий: ${kn} — при закрытии они остановятся на хосте.`:""):void 0,fn=Je?oe.find(E=>E.id===Je.ids[0]):void 0,Jt=(fn==null?void 0:fn.pinned)!==!0,Et=Je?[...Je.ids.length===1?[{id:"rename",label:"Переименовать",onSelect:()=>ae(Je.ids[0])}]:[],{id:"pin",label:Jt?Je.ids.length>1?`Закрепить (${Je.ids.length})`:"Закрепить":Je.ids.length>1?`Открепить (${Je.ids.length})`:"Открепить",onSelect:()=>{fn&&v(fn.workspaceId,Je.ids,Jt),qe.clear()}},{id:"archive",label:Je.ids.length>1?`Убрать в архив (${Je.ids.length})`:"Убрать в архив",onSelect:()=>{L(p,Je.ids),qe.clear()}}]:[],dn=Je?$b:void 0,ot=it?Ae.find(E=>E.id===it.ids[0]):void 0,tn=it?[{id:"rename",label:"Переименовать",onSelect:()=>ae(it.ids[0])},{id:"unpin",label:"Открепить",onSelect:()=>{ot&&v(ot.workspaceId,[ot.id],!1)}},{id:"archive",label:"Убрать в архив",onSelect:()=>{ot&&L(ot.workspaceId,[ot.id])}}]:[];return r.jsxs("aside",{className:a?"sidebar sidebar--open":"sidebar",children:[r.jsxs("div",{className:"sidebar__head",children:[r.jsx("span",{className:l?"dot dot--on":"dot",title:i}),r.jsx("span",{className:"brand",children:"Claude Code Visual"}),r.jsx("button",{className:"theme-btn","aria-pressed":ie==="pinned",title:ie==="pinned"?"Показать все проекты и сессии":"Показать только закреплённые","aria-label":ie==="pinned"?"Панель закреплённых сессий включена. Показать все проекты и сессии":"Показать только закреплённые сессии",onClick:ue,children:r.jsx(sy,{})}),r.jsx("button",{className:"theme-btn",title:`Тема: ${Kb[te]}`,"aria-label":`Тема: ${Kb[te]}. Переключить`,onClick:fe,children:r.jsx(Z1,{mode:te})})]}),r.jsxs("div",{className:"fssearch fssearch--sidebar",children:[r.jsx(V1,{}),r.jsx("input",{className:"fssearch__input",type:"text",value:me,spellCheck:!1,placeholder:"Проект или сессия…","aria-label":"Поиск по проектам и сессиям",onChange:E=>we(E.target.value),onKeyDown:E=>{E.stopPropagation(),E.key==="Escape"&&(E.preventDefault(),me?we(""):E.currentTarget.blur())}}),me&&r.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>we(""),children:"✕"})]}),r.jsx("div",{className:"sidebar__scroll",children:ie==="pinned"?r.jsxs(r.Fragment,{children:[Ae.length===0&&r.jsx("div",{className:"row",children:r.jsx("span",{className:"row__meta",children:T?"Ничего не найдено":"закрепите сессию через её меню (правый клик или долгое нажатие) — она останется под рукой из любого проекта"})}),Ae.map(E=>r.jsx("div",{className:E.id===m?"row row--active":"row",...F===E.id?{}:{title:"Действия со строкой — правый клик или долгое нажатие",...Ct(E)},children:F===E.id?r.jsx("div",{className:"row__main",children:r.jsx(Zc,{value:E.title??"",onCommit:Y=>{j(E,Y),ae(null)},onCancel:()=>ae(null)})}):r.jsxs("button",{className:"row__main",onClick:()=>{Gt()||R(E)},children:[r.jsx(dh,{title:E.title??"Без названия",pinned:!1,projectName:Ne(E.workspaceId),projectPath:ye(E.workspaceId)}),r.jsx(Jb,{session:E,tail:new Date(E.updatedAt).toLocaleString()})]})},E.id))]}):r.jsxs(r.Fragment,{children:[r.jsx(fh,{title:"Проекты",count:K.length,open:Qe("workspaces"),onToggle:()=>st("workspaces")}),Qe("workspaces")&&r.jsxs(r.Fragment,{children:[K.length===0&&r.jsx("div",{className:"row",children:r.jsx("span",{className:"row__meta",children:T?"Ничего не найдено":"Пока ни одного"})}),K.map(E=>r.jsx("div",{className:Qb(E.id===p,Ot.selected.includes(E.id)),...en(E),children:r.jsxs("button",{className:"row__main",onClick:Y=>{Gt()||Ot.click(Y,E,()=>x(E.id))},children:[r.jsxs("span",{className:"row__title",children:[E.name,E.hasClaudeMd&&" ·"]}),r.jsx("span",{className:"row__meta",title:E.path,children:E.path})]})},E.id))]}),p&&r.jsxs(r.Fragment,{children:[r.jsx(fh,{title:"Сессии",count:oe.length,open:Qe("sessions"),onToggle:()=>st("sessions")}),Qe("sessions")&&r.jsxs(r.Fragment,{children:[oe.length===0&&r.jsx("div",{className:"row",children:r.jsx("span",{className:"row__meta",children:T?"Ничего не найдено":"Пока ни одной"})}),oe.map(E=>r.jsx("div",{className:Qb(E.id===m,qe.selected.includes(E.id)),...F===E.id?{}:En(E),children:F===E.id?r.jsx("div",{className:"row__main",children:r.jsx(Zc,{value:E.title??"",onCommit:Y=>{j(E,Y),ae(null)},onCancel:()=>ae(null)})}):r.jsxs(r.Fragment,{children:[r.jsxs("button",{className:"row__main",onClick:Y=>{Gt()||qe.click(Y,E,()=>y(E))},children:[r.jsx(dh,{title:E.title??"Без названия",pinned:E.pinned===!0,projectName:Ne(E.workspaceId),projectPath:ye(E.workspaceId)}),r.jsx(Jb,{session:E,tail:new Date(E.updatedAt).toLocaleString()})]}),r.jsx("button",{className:"row__edit",title:"Переименовать","aria-label":"Переименовать сессию",onClick:()=>{Gt()||ae(E.id)},children:"✎"})]})},E.id))]}),d.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(fh,{title:"Архив",count:pe.length,open:Qe("archive"),onToggle:()=>st("archive"),hint:"сессии без обращения дольше двух суток уезжают сюда сами; ничего не удаляется"}),Qe("archive")&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"row",children:r.jsx("span",{className:"row__meta",children:"сюда сами уезжают сессии без обращения дольше двух суток; транскрипт остаётся на диске, ничего не удаляется"})}),pe.length===0&&r.jsx("div",{className:"row",children:r.jsx("span",{className:"row__meta",children:T?"Ничего не найдено":"Пока пусто"})}),pe.map(E=>r.jsxs("div",{className:E.id===m?"row row--active":"row",children:[r.jsxs("button",{className:"row__main",onClick:()=>y(E),children:[r.jsx(dh,{title:E.title??"Без названия",pinned:!1,projectName:Ne(E.workspaceId),projectPath:ye(E.workspaceId)}),r.jsx("span",{className:"row__meta",children:P1(E)})]}),r.jsx("button",{className:"row__restore",title:"Вернуть сессию из архива",onClick:()=>B([E.id]),children:"Вернуть"})]},E.id))]})]})]})]})}),r.jsxs("div",{className:"sidebar__foot",children:[r.jsxs("button",{className:"account-btn sidebar__wide",title:"Аккаунт Claude",onClick:Z,children:[r.jsx("span",{className:k!=null&&k.loggedIn?"dot dot--on":"dot"}),r.jsx("span",{className:"account-btn__id",children:k===null?"Аккаунт":k.loggedIn?k.email||"Вход выполнен":"Войти в аккаунт"}),(k==null?void 0:k.plan)&&r.jsx("span",{className:"chip",children:k.plan})]}),A&&r.jsxs("button",{className:"account-btn sidebar__wide",title:"Доступ с телефона и из браузера",onClick:A,children:[r.jsx("span",{className:z!=null&&z.connected?"dot dot--on":"dot"}),r.jsx("span",{className:"account-btn__id",children:z===null?"Удалённый доступ":z.paired?z.connected?z.name||"Удалённый доступ включён":"Удалённый доступ · нет связи":"Удалённый доступ"}),(z==null?void 0:z.connected)&&z.clients>0&&r.jsx("span",{className:"chip",children:z.clients})]}),r.jsx("button",{className:"btn btn--ghost sidebar__wide",disabled:!Q,title:"MCP-серверы и плагины",onClick:()=>Q==null?void 0:Q(),children:"Расширения"}),r.jsx("button",{className:"btn btn--ghost sidebar__wide",title:"Настройки приложения",onClick:V,children:"Настройки"}),r.jsx("button",{className:"btn btn--ghost",onClick:P,children:"+ Проект"}),r.jsx("button",{className:"btn btn--primary",onClick:M,disabled:!p,children:"+ Сессия"})]}),yt&&r.jsx(Gc,{x:yt.x,y:yt.y,items:An,note:Dt,onClose:Qt}),Je&&r.jsx(Gc,{x:Je.x,y:Je.y,items:Et,note:dn,onClose:rt}),it&&r.jsx(Gc,{x:it.x,y:it.y,items:tn,note:$b,onClose:Tt})]})}function Qb(a,l){const i=["row"];return a&&i.push("row--active"),l&&i.push("row--selected"),i.join(" ")}function Zb(a){const[l,i]=_.useState([]),c=_.useRef(null);function o(){i([]),c.current=null}function d(p,m,x){if(p.ctrlKey||p.metaKey){i(y=>y.includes(m.id)?y.filter(j=>j!==m.id):[...y,m.id]),c.current=m.id;return}if(p.shiftKey&&c.current){const y=a.findIndex(v=>v.id===c.current),j=a.findIndex(v=>v.id===m.id);if(y!==-1&&j!==-1){const[v,R]=y<j?[y,j]:[j,y];i(a.slice(v,R+1).map(w=>w.id));return}}o(),c.current=m.id,x()}function h(p){return l.includes(p.id)?l:(i([p.id]),c.current=p.id,[p.id])}return{selected:l,click:d,targetsFor:h,clear:o}}function fh({title:a,count:l,open:i,onToggle:c,hint:o}){const d=i?`Свернуть «${a}»`:`Развернуть «${a}»`;return r.jsxs("button",{className:"sidebar__section sidebar__section--btn","aria-expanded":i,title:o?`${d} — ${o}`:d,onClick:c,children:[r.jsx(X1,{open:i}),r.jsx("span",{className:"sidebar__section-name",children:a}),r.jsx("span",{className:"sidebar__count",children:l})]})}function X1({open:a}){return r.jsx("svg",{className:a?"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:r.jsx("path",{d:"M6 3.5 10.5 8 6 12.5"})})}function sy({className:a}){return r.jsxs("svg",{className:a,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("rect",{x:"4.5",y:"2.4",width:"7",height:"4.2",rx:"1.6"}),r.jsx("path",{d:"M5.4 6.6 8 12.2 10.6 6.6"}),r.jsx("path",{d:"M8 12.2v1.4"})]})}function V1(){return r.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[r.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),r.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}function $1(){try{const a=localStorage.getItem(ly);if(a===null)return["archive"];const l=JSON.parse(a);return Array.isArray(l)?l.filter(i=>i==="workspaces"||i==="sessions"||i==="archive"):["archive"]}catch{return["archive"]}}function Q1(){try{return localStorage.getItem(ay)==="pinned"?"pinned":"default"}catch{return"default"}}const Kb={system:"как в системе",light:"светлая",dark:"тёмная"};function Z1({mode:a}){const l={viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};return a==="dark"?r.jsx("svg",{...l,children:r.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"})}):a==="light"?r.jsxs("svg",{...l,children:[r.jsx("circle",{cx:"8",cy:"8",r:"3.1"}),r.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"})]}):r.jsxs("svg",{...l,children:[r.jsx("rect",{x:"1.8",y:"2.6",width:"12.4",height:"8.4",rx:"1.4"}),r.jsx("path",{d:"M5.6 13.4h4.8"})]})}function K1(a){switch(a.state){case"running":return"работает";case"waiting_permission":return"ждёт разрешения";case"idle":return J1(a.lastTurn);case"starting":return"запускается";case"reconnecting":return"переподключается";case"error":return"ошибка";case"closed":return"на диске"}}function J1(a){switch(a){case"interrupted":return"прервана";case"stopped":return"остановлена";case"failed":return"оборвалась";case"completed":return"готова";case null:return"ждёт задачу"}}function F1(a){switch(a.state){case"running":return"running";case"starting":return"starting";case"reconnecting":return"reconnecting";case"waiting_permission":return"waiting";case"idle":return W1(a.lastTurn);case"error":return"error";case"closed":return"closed"}}function W1(a){switch(a){case"interrupted":case"stopped":return"halted";case"failed":return"error";case"completed":return"ready";case null:return"fresh"}}function Jb({session:a,tail:l}){return r.jsxs("span",{className:"row__meta",children:[r.jsxs("span",{className:`row__state row__state--${F1(a)}`,children:[r.jsx("span",{className:"row__state-dot","aria-hidden":"true"}),K1(a)]})," · ",l]})}function dh({title:a,pinned:l,projectName:i,projectPath:c}){return r.jsxs("span",{className:"row__head",children:[r.jsxs("span",{className:"row__title",children:[l&&r.jsx(sy,{className:"row__pin"}),a]}),r.jsx("span",{className:"row__project",title:c,children:i})]})}function P1(a){const l=a.archivedAuto?"сама, по сроку молчания":"убрана вручную";return a.archivedAt?`${new Date(a.archivedAt).toLocaleString()} · ${l}`:l}const Fb=3,eS=15e5;function iy(a,l){if(!l||typeof l!="object")return null;const i=l,c=typeof i.file_path=="string"?i.file_path:"";if(!c)return null;if(a==="Write"){if(typeof i.content!="string")return null;const o=hh(i.content).map(d=>({type:"add",text:d}));return{kind:"create",filePath:c,rows:o,added:o.length,removed:0,note:"файл записывается целиком"}}if(a==="Edit"){if(typeof i.old_string!="string"||typeof i.new_string!="string")return null;const o=aS(tS(hh(i.old_string),hh(i.new_string)));return{kind:"edit",filePath:c,rows:o,added:o.filter(d=>d.type==="add").length,removed:o.filter(d=>d.type==="del").length,note:i.replace_all===!0?"все вхождения":null}}return null}function hh(a){if(a==="")return[];const l=a.split(/\r?\n/);return l.length>1&&l[l.length-1]===""&&l.pop(),l}function tS(a,l){let i=0;for(;i<a.length&&i<l.length&&a[i]===l[i];)i++;let c=a.length,o=l.length;for(;c>i&&o>i&&a[c-1]===l[o-1];)c--,o--;const d=h=>({type:"ctx",text:h});return[...a.slice(0,i).map(d),...nS(a.slice(i,c),l.slice(i,o)),...a.slice(c).map(d)]}function nS(a,l){if(a.length===0&&l.length===0)return[];if(a.length===0)return l.map(y=>({type:"add",text:y}));if(l.length===0)return a.map(y=>({type:"del",text:y}));if((a.length+1)*(l.length+1)>eS)return[...a.map(y=>({type:"del",text:y})),...l.map(y=>({type:"add",text:y}))];const i=a.length,c=l.length,o=c+1,d=new Uint32Array((i+1)*o),h=(y,j)=>d[y*o+j]??0;for(let y=i-1;y>=0;y--)for(let j=c-1;j>=0;j--)d[y*o+j]=a[y]===l[j]?h(y+1,j+1)+1:Math.max(h(y+1,j),h(y,j+1));const p=[];let m=0,x=0;for(;m<i&&x<c;){const y=a[m],j=l[x];y===j?(p.push({type:"ctx",text:y}),m++,x++):h(m+1,x)>=h(m,x+1)?(p.push({type:"del",text:y}),m++):(p.push({type:"add",text:j}),x++)}for(;m<i;)p.push({type:"del",text:a[m++]});for(;x<c;)p.push({type:"add",text:l[x++]});return lS(p)}function lS(a){const l=[];let i=[];function c(){l.push(...i.filter(o=>o.type==="del")),l.push(...i.filter(o=>o.type==="add")),i=[]}for(const o of a)o.type==="ctx"?(c(),l.push(o)):i.push(o);return c(),l}function aS(a){if(!a.some(d=>d.type!=="ctx"))return a;const l=a.map(()=>!1);a.forEach((d,h)=>{if(d.type!=="ctx")for(let p=Math.max(0,h-Fb);p<=Math.min(a.length-1,h+Fb);p++)l[p]=!0});const i=[];let c=[];function o(){c.length===1?i.push(...c):c.length>1&&i.push({type:"gap",text:`⋯ ${c.length} ${sS(c.length)} без изменений`}),c=[]}return a.forEach((d,h)=>{l[h]?(o(),i.push(d)):c.push(d)}),o(),i}function sS(a){const l=a%100;if(l>=11&&l<=14)return"строк";switch(a%10){case 1:return"строка";case 2:case 3:case 4:return"строки";default:return"строк"}}async function Zo(a){try{return await navigator.clipboard.writeText(a),!0}catch{}const l=document.createElement("textarea");l.value=a,l.setAttribute("readonly",""),l.style.position="fixed",l.style.opacity="0",document.body.appendChild(l);try{return l.select(),document.execCommand("copy")}catch{return!1}finally{l.remove()}}async function iS(){try{return await navigator.clipboard.readText()}catch{return null}}const Qh=1600,Di="Копировать",wr="Скопировано";function Zh({text:a,hint:l,className:i}){const[c,o]=_.useState(!1);return _.useEffect(()=>{if(!c)return;const d=setTimeout(()=>o(!1),Qh);return()=>clearTimeout(d)},[c]),_.useEffect(()=>o(!1),[a]),r.jsx("button",{type:"button",className:"copybtn"+(c?" copybtn--done":"")+(i?` ${i}`:""),"aria-label":c?wr:`${Di} ${l}`,title:c?wr:`${Di} ${l}`,onClick:()=>{Zo(a).then(d=>{d&&o(!0)})},children:c?wr:Di})}function Kh({diff:a}){return r.jsxs("div",{className:"diff",children:[r.jsxs("div",{className:"diff__head",children:[r.jsx("span",{className:"diff__path",title:a.filePath,children:a.filePath}),r.jsxs("span",{className:"diff__stat",children:[a.added>0&&r.jsxs("span",{className:"diff__stat--add",children:["+",a.added]}),a.removed>0&&r.jsxs("span",{className:"diff__stat--del",children:["−",a.removed]})]})]}),a.note&&r.jsx("div",{className:"diff__note",children:a.note}),r.jsx("div",{className:"diff__body",children:a.rows.length===0?r.jsx("div",{className:"diff__row diff__row--gap",children:r.jsx("span",{className:"diff__text",children:"пустое содержимое"})}):a.rows.map((l,i)=>r.jsxs("div",{className:`diff__row diff__row--${l.type}`,children:[r.jsx("span",{className:"diff__mark","aria-hidden":"true",children:l.type==="add"?"+":l.type==="del"?"−":""}),r.jsx("span",{className:"diff__text",children:l.text===""?" ":l.text})]},i))})]})}function rS({waiting:a}){const[l,i]=_.useState(0);return _.useEffect(()=>{const c=window.setInterval(()=>i(o=>o+1),1e3);return()=>window.clearInterval(c)},[]),r.jsxs("div",{className:a?"work work--wait":"work",children:[r.jsxs("span",{className:"work__dots","aria-hidden":"true",children:[r.jsx("span",{className:"work__dot"}),r.jsx("span",{className:"work__dot"}),r.jsx("span",{className:"work__dot"})]}),r.jsx("span",{className:"work__label",children:a?"ждёт разрешения":"думает"}),!a&&r.jsxs("span",{className:"work__time",children:[l," с"]})]})}function Jh({items:a,busy:l,waiting:i,history:c=[],historyHasMore:o=!1,historyLoading:d=!1,onLoadHistory:h,sessionId:p,onEditMessage:m,empty:x="Сессия пуста. Опишите задачу — Claude Code работает в каталоге проекта с полным набором инструментов."}){const y=_.useRef(null),j=_.useRef(null),v=_.useRef(!0),R=_.useRef(null),w=_.useRef(null),L=_.useRef(!1);_.useEffect(()=>{v.current=!0,R.current=null,L.current=!1,w.current!==null&&(clearTimeout(w.current),w.current=null)},[p]),_.useEffect(()=>{const k=y.current,Z=j.current;if(!k||!Z)return;function z(te){!k||te===k.scrollTop||(L.current=!0,k.scrollTop=te)}function A(){if(!k)return;const te=R.current;if(te){const fe=Pb(k,te.id);if(fe){const F=fe.getBoundingClientRect().top-k.getBoundingClientRect().top;z(k.scrollTop+(F-te.top))}w.current!==null&&clearTimeout(w.current),w.current=setTimeout(()=>{R.current=null},500);return}v.current&&z(k.scrollHeight)}const V=new ResizeObserver(A);return V.observe(Z),()=>{V.disconnect(),w.current!==null&&clearTimeout(w.current)}},[]);function B(){const k=y.current;if(k){if(L.current){L.current=!1;return}v.current=k.scrollHeight-k.scrollTop-k.clientHeight<80}}function P(){if(d)return;const k=y.current,Z=c[0];if(k&&Z){const z=Pb(k,Z.id);z&&(R.current={id:Z.id,top:z.getBoundingClientRect().top-k.getBoundingClientRect().top})}h==null||h()}let M=0;function Q(k){return k.kind==="user"?M++:-1}return r.jsx("div",{className:"transcript",ref:y,onScroll:B,children:r.jsxs("div",{className:"stream",ref:j,children:[o&&r.jsx("button",{type:"button",className:"transcript__more",onClick:P,disabled:d,children:d?"Загружаем…":"Показать более раннее"}),c.map(k=>r.jsx(Wb,{item:k,userIndex:Q(k),onEditMessage:m},k.id)),c.length>0&&a.length>0&&r.jsx("div",{className:"transcript__divider",children:r.jsx("span",{children:"дальше — сессия открыта заново"})}),c.length===0&&a.length===0&&r.jsx("p",{className:"empty",children:x}),a.map(k=>r.jsx(Wb,{item:k,userIndex:Q(k),onEditMessage:m},k.id)),l&&r.jsx(rS,{waiting:i})]})})}function Wb({item:a,userIndex:l,onEditMessage:i}){switch(a.kind){case"user":return r.jsx(uS,{item:a,userIndex:l,onEditMessage:i});case"assistant":return r.jsxs("div",{className:"msg--assistant","data-item-id":a.id,children:[r.jsx(oS,{text:a.text}),a.streaming&&r.jsx("span",{className:"caret"}),a.text.trim()!==""&&r.jsx("div",{className:"msg--assistant__foot",children:r.jsx(Zh,{text:a.text,hint:"ответ целиком"})})]});case"thinking":return r.jsx("div",{className:"thinking","data-item-id":a.id,children:a.text});case"tool":return r.jsx(dS,{item:a});case"result":return r.jsxs("div",{className:"result-line","data-item-id":a.id,children:[r.jsx("span",{children:a.isError?"✗ "+a.subtype:"✓ готово"}),r.jsxs("span",{children:[(a.durationMs/1e3).toFixed(1)," с"]}),a.costUsd!==null&&r.jsxs("span",{children:["$",a.costUsd.toFixed(4)]}),r.jsxs("span",{children:["↑",tx(a.inputTokens)," ↓",tx(a.outputTokens)]})]});case"notice":return r.jsx("div",{className:a.tone==="error"?"notice notice--error":"notice","data-item-id":a.id,children:a.text})}}const cS=500;function uS({item:a,userIndex:l,onEditMessage:i}){const[c,o]=_.useState(null),[d,h]=_.useState(!1),[p,m]=_.useState(a.text),x=_.useRef(null),y=Vo("(max-width: 860px)"),j=_.useRef(null);function v(A,V){o({x:A,y:V})}function R(A){A.preventDefault(),v(A.clientX,A.clientY)}function w(A){const V=A.touches[0];if(!V)return;const te={timer:0,x:V.clientX,y:V.clientY,fired:!1};te.timer=window.setTimeout(()=>{te.fired=!0,v(te.x,te.y)},cS),j.current=te}function L(A){const V=j.current,te=A.touches[0];!V||!te||Math.hypot(te.clientX-V.x,te.clientY-V.y)>10&&(window.clearTimeout(V.timer),j.current=null)}function B(A){const V=j.current;V&&(window.clearTimeout(V.timer),V.fired&&A.preventDefault())}function P(){m(a.text),h(!0)}function M(){h(!1)}function Q(){const A=p.trim();A===""&&!(a.images&&a.images.length>0)||(i==null||i(l,A,a.images),h(!1))}_.useEffect(()=>{const A=x.current;!A||!d||(A.style.height="auto",A.style.height=`${A.scrollHeight}px`)},[p,d]),_.useEffect(()=>{if(!d)return;const A=x.current;A&&(A.focus(),A.setSelectionRange(A.value.length,A.value.length))},[d]);function k(A){if(A.key==="Escape"){A.preventDefault(),A.stopPropagation(),M();return}A.key==="Enter"&&!A.shiftKey&&!y&&(A.preventDefault(),Q())}const Z=a.images&&a.images.length>0&&r.jsx("div",{className:"msg--user__images",children:a.images.map((A,V)=>r.jsx("img",{className:"msg--user__image",src:`data:${A.mediaType};base64,${A.data}`,alt:"Вложение"},V))});if(d){const A=p.trim()!==""||!!(a.images&&a.images.length>0);return r.jsxs("div",{className:"msg--user msg--user--editing","data-item-id":a.id,children:[Z,r.jsxs("div",{className:"msg--user__edit",children:[r.jsx("textarea",{ref:x,className:"msg--user__edit-field",value:p,onChange:V=>m(V.target.value),onKeyDown:k,rows:1}),r.jsxs("div",{className:"msg--user__edit-actions",children:[r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:M,children:"Отмена"}),r.jsx("button",{type:"button",className:"btn btn--sm btn--primary",onClick:Q,disabled:!A,children:"Сохранить"})]})]})]})}const z=[{id:"copy",label:"Копировать",onSelect:()=>void Zo(a.text)},...i?[{id:"edit",label:"Изменить",onSelect:P}]:[]];return r.jsxs("div",{className:"msg--user","data-item-id":a.id,onContextMenu:R,onTouchStart:w,onTouchMove:L,onTouchEnd:B,onTouchCancel:B,children:[Z,a.text,c&&r.jsx(Gc,{x:c.x,y:c.y,items:z,onClose:()=>o(null)})]})}function Pb(a,l){const i=a.querySelectorAll("[data-item-id]");for(const c of i)if(c.dataset.itemId===l)return c;return null}function oS({text:a}){const[l,i]=_.useState(""),c=_.useRef([]);_.useEffect(()=>{let d=!1;return $h(a).then(h=>{d||i(fS(h))}),()=>{d=!0}},[a]),_.useEffect(()=>{const d=c.current;return()=>d.forEach(h=>clearTimeout(h))},[]);function o(d){var m,x;const h=d.target.closest(".codeblock__copy");if(!(h instanceof HTMLElement))return;const p=((x=(m=h.parentElement)==null?void 0:m.querySelector("pre"))==null?void 0:x.textContent)??"";p!==""&&Zo(p).then(y=>{if(!y)return;h.textContent=wr,h.setAttribute("aria-label",wr),h.classList.add("copybtn--done");const j=window.setTimeout(()=>{h.isConnected&&(h.textContent=Di,h.setAttribute("aria-label",Rh),h.classList.remove("copybtn--done"))},Qh);c.current.push(j)})}return r.jsx("div",{className:"markdown-preview msg--assistant__body",onClick:o,dangerouslySetInnerHTML:{__html:l}})}const Rh=`${Di} блок кода`;function fS(a){if(!a.includes("<pre"))return a;const l=new DOMParser().parseFromString(a,"text/html");for(const i of l.body.querySelectorAll("pre")){const c=l.createElement("div");c.className="codeblock",i.replaceWith(c),c.append(i);const o=l.createElement("button");o.type="button",o.className="copybtn codeblock__copy",o.setAttribute("aria-label",Rh),o.title=Rh,o.textContent=Di,c.append(o)}return l.body.innerHTML}function dS({item:a}){const[l,i]=_.useState(!1),c=a.result===null,o=iy(a.name,a.input),d=a.name==="AskUserQuestion"?mS(a.input):null;return r.jsxs("div",{className:"tool"+(a.isError?" tool--error":"")+(a.awaitingPermission?" tool--wait":""),"data-item-id":a.id,children:[r.jsxs("button",{className:"tool__head",onClick:()=>i(h=>!h),children:[r.jsx("span",{className:"tool__name",children:a.name}),r.jsx("span",{className:"tool__arg",children:d?pS(d):hS(a.input)}),r.jsx("span",{className:"tool__status",children:c?"…":a.isError?"ошибка":l?"▴":"▾"})]}),l&&r.jsxs("div",{className:"tool__body",children:[d?r.jsx(gS,{questions:d,answers:a.answers}):o?r.jsx(Kh,{diff:o}):r.jsx(ex,{text:JSON.stringify(a.input,null,2),hint:"аргументы вызова"}),a.result!==null&&(!d||a.isError)&&r.jsx(ex,{text:a.result,hint:"результат вызова",style:{marginTop:10}})]})]})}function ex({text:a,hint:l,style:i}){return r.jsxs("div",{className:"codeblock",style:i,children:[r.jsx("pre",{className:"code",children:a}),r.jsx(Zh,{text:a,hint:l,className:"codeblock__copy"})]})}function hS(a){if(!a||typeof a!="object")return"";const l=a;for(const i of["file_path","command","pattern","path","url","prompt"]){const c=l[i];if(typeof c=="string")return c.replace(/\s+/g," ").slice(0,160)}return JSON.stringify(l).slice(0,160)}function pS(a){var i;const l=a.map(c=>c.header).filter(c=>c.length>0);return l.length===a.length?l.join(" · "):((i=a[0])==null?void 0:i.question.replace(/\s+/g," ").slice(0,160))??""}function mS(a){if(typeof a!="object"||a===null)return null;const l=a.questions;if(!Array.isArray(l)||l.length===0)return null;const i=[];for(const c of l){if(typeof c!="object"||c===null)return null;const{question:o,header:d,options:h,multiSelect:p}=c;if(typeof o!="string"||!Array.isArray(h)||h.length===0)return null;const m=[];for(const x of h){if(typeof x!="object"||x===null)return null;const{label:y,description:j,preview:v}=x;if(typeof y!="string"||typeof j!="string")return null;m.push({label:y,description:j,...typeof v=="string"?{preview:v}:{}})}i.push({question:o,header:typeof d=="string"?d:"",options:m,multiSelect:p===!0})}return i}function gS({questions:a,answers:l}){return r.jsx("div",{className:"tool__questions",children:a.map((i,c)=>r.jsxs("div",{className:"tool__question",children:[r.jsxs("div",{className:"tool__question-head",children:[i.header&&r.jsx("span",{className:"chip chip--accent",children:i.header}),r.jsx("span",{className:"tool__question-text",children:i.question})]}),r.jsx("div",{className:"tool__question-answer",children:l!=null&&l[i.question]?r.jsx("span",{className:"tool__answer-value",children:l[i.question]}):r.jsx("span",{className:"tool__answer-empty",children:"не отвечено"})})]},c))})}function tx(a){return a>=1e3?`${(a/1e3).toFixed(1)}k`:String(a)}const bS="ccv.dictation.lang",nx="ru-RU";function xS(a){try{return Function.prototype.toString.call(a).includes("[native code]")}catch{return!1}}function lx(){const a=window,l=[a.SpeechRecognition,a.webkitSpeechRecognition].filter(c=>typeof c=="function"),i=l.find(xS);return!i&&l.length>0&&Vl("распознавание подменено: родной реализации в странице нет"),i??l[0]??null}function ry(){var a;try{return((a=localStorage.getItem(bS))==null?void 0:a.trim())||nx}catch{return nx}}function Vl(a,l){l===void 0?console.debug(`[dictation] ${a}`):console.debug(`[dictation] ${a}`,l)}const yS=3,_S=400,vS=5,SS=250,jS=2e3,kS=2e4;async function NS(){try{return(await navigator.permissions.query({name:"microphone"})).state==="granted"}catch{return!1}}const wS={"not-allowed":"Браузер не дал доступ к микрофону","service-not-allowed":"Браузер не дал доступ к микрофону","audio-capture":"Микрофон не найден",network:"Сервис распознавания недоступен","language-not-supported":`Распознавание не знает языка ${ry()}`};function TS(a){const[l]=_.useState(()=>lx()!==null),[i,c]=_.useState(!1),[o,d]=_.useState(null),h=_.useRef(null),p=_.useRef(!1),m=_.useRef(!1),x=_.useRef(a),y=_.useRef({openedAt:0,audio:!1,heard:!1,everHeard:!1,silent:0,dead:0,lastError:"",warned:!1}),j=_.useRef(null),v=_.useRef(!1),R=_.useRef(null),w=_.useCallback(()=>{R.current&&clearTimeout(R.current),R.current=null},[]),L=_.useCallback(()=>{w();const k=async Z=>{if(R.current=null,!(!p.current||v.current)){if(!Z&&!await NS()){if(Vl("ждём ответа на запрос доступа к микрофону"),!p.current||v.current)return;R.current=setTimeout(()=>void k(!0),kS);return}Vl("движок не ответил на start()"),p.current=!1,c(!1),d("Распознавание не отвечает — проверьте расширения браузера и доступ к микрофону")}};R.current=setTimeout(()=>void k(!1),jS)},[w]);_.useEffect(()=>{x.current=a}),_.useEffect(()=>{const k=lx();if(!k)return;const Z=new k;return Z.lang=ry(),Z.continuous=!0,Z.interimResults=!0,Z.onstart=()=>{Vl("сессия открыта"),v.current=!0,w(),c(!0)},Z.onaudiostart=()=>{Vl("пошёл звук с микрофона"),y.current.audio=!0},Z.onresult=z=>{var fe;if(m.current)return;let A="",V="";for(let F=z.resultIndex;F<z.results.length;F++){const ae=z.results[F];if(!ae)continue;const me=((fe=ae[0])==null?void 0:fe.transcript)??"";ae.isFinal?A+=me:V+=me}const te=y.current;te.heard=!0,te.everHeard=!0,Vl("распознано",{final:A,interim:V}),x.current(A,V)},Z.onerror=z=>{y.current.lastError=z.error,Vl("ошибка движка",z.error),!(z.error==="no-speech"||z.error==="aborted")&&(p.current=!1,c(!1),d(wS[z.error]??`Распознавание не работает: ${z.error}`))},Z.onend=()=>{m.current=!1,v.current=!1;const z=y.current,A=Date.now()-z.openedAt;if(Vl("сессия закрыта",{мс:A,звук:z.audio,слова:z.heard,ошибка:z.lastError||null}),!p.current){c(!1);return}if(z.dead=!z.audio&&A<_S?z.dead+1:0,z.dead>=vS){p.current=!1,c(!1),d(z.lastError?`Распознавание не работает: ${z.lastError}`:"Распознавание закрывается сразу после запуска — проверьте доступ к микрофону в настройках сайта");return}z.silent=z.heard?0:z.silent+1,!z.everHeard&&!z.warned&&z.silent>=yS&&(z.warned=!0,d(z.audio?"Микрофон слушает, но речь не распознаётся — проверьте язык диктовки и уровень звука":"С микрофона не идёт звук — проверьте устройство ввода в настройках сайта в браузере")),j.current=setTimeout(()=>{if(j.current=null,!!p.current){z.openedAt=Date.now(),z.audio=!1,z.heard=!1,z.lastError="",L();try{Z.start()}catch{}}},SS)},h.current=Z,()=>{p.current=!1,j.current&&clearTimeout(j.current),j.current=null,w(),Z.onend=null,Z.onresult=null,Z.onerror=null,Z.onstart=null,Z.onaudiostart=null,Z.abort(),h.current=null}},[]);const B=_.useCallback(()=>{var k;if(p.current){if(p.current=!1,Vl("выключение микрофона"),j.current&&clearTimeout(j.current),j.current=null,w(),!v.current){c(!1);return}(k=h.current)==null||k.stop()}},[]),P=_.useCallback(()=>{const k=h.current;if(k){if(!window.isSecureContext){d("Микрофон доступен только по https или с localhost");return}d(null),p.current=!0,m.current=!1,j.current&&clearTimeout(j.current),j.current=null,y.current={openedAt:Date.now(),audio:!1,heard:!1,everHeard:!1,silent:0,dead:0,lastError:"",warned:!1},c(!0),Vl("включение микрофона",{язык:k.lang}),L();try{k.start()}catch(Z){Vl("start() не прошёл",Z)}}},[L]),M=_.useCallback(()=>{p.current?B():P()},[P,B]),Q=_.useCallback(()=>{var k;p.current&&v.current&&(m.current=!0,(k=h.current)==null||k.abort())},[]);return{supported:l,listening:i,error:o,toggle:M,stop:B,drop:Q}}const cy="ccv:drafts",ES=40,AS=2e4,CS=500;let Yc=null,Xc=null;function uy(){if(Yc)return Yc;const a=new Map;try{const l=localStorage.getItem(cy);if(l){const i=JSON.parse(l);if(typeof i=="object"&&i!==null)for(const[c,o]of Object.entries(i))typeof o=="string"&&o!==""&&a.set(c,o)}}catch{}return Yc=a,window.addEventListener("pagehide",oy),a}function ph(a){return uy().get(a)??""}function RS(a,l){const i=uy(),c=l.slice(0,AS),o=i.has(a);if(o&&i.delete(a),c!=="")i.set(a,c);else if(!o)return;for(;i.size>ES;){const d=i.keys().next();if(d.done)break;i.delete(d.value)}MS()}function MS(){Xc===null&&(Xc=window.setTimeout(oy,CS))}function oy(){if(Xc!==null&&window.clearTimeout(Xc),Xc=null,!!Yc)try{localStorage.setItem(cy,JSON.stringify(Object.fromEntries(Yc)))}catch{}}const OS="(max-width: 860px)",ax=/^\/(\S*)$/,DS=new Set(["model","permissions"]);function zS(a){return DS.has(a.name)||a.name.startsWith("__")}const LS=new Set(["clear","rename"]),sx=/(?:^|\s)@([^\s@]*)$/,US=200,HS=100,BS=190,qS=5,IS=20*1024*1024,GS=1568,YS=.85;let ix=0;async function XS(a){var j,v;if(!a.type.startsWith("image/")||a.size>IS)return null;const l=await VS(a);if(!l)return null;const{width:i,height:c}=l;if(i<=0||c<=0)return null;const o=Math.min(1,GS/Math.max(i,c)),d=document.createElement("canvas");d.width=Math.max(1,Math.round(i*o)),d.height=Math.max(1,Math.round(c*o));const h=d.getContext("2d");if(!h)return null;h.drawImage(l.image,0,0,d.width,d.height),(v=(j=l.image).close)==null||v.call(j);const p=a.type==="image/png",m=p?"image/png":"image/jpeg",x=d.toDataURL(m,p?void 0:YS),y=x.slice(x.indexOf(",")+1);return y?(ix+=1,{id:`att${ix}`,mediaType:m,data:y,previewUrl:x}):null}async function VS(a){if(typeof createImageBitmap=="function")try{const l=await createImageBitmap(a);return{image:l,width:l.width,height:l.height}}catch{}return new Promise(l=>{const i=URL.createObjectURL(a),c=new Image;c.onload=()=>{URL.revokeObjectURL(i),l({image:c,width:c.naturalWidth,height:c.naturalHeight})},c.onerror=()=>{URL.revokeObjectURL(i),l(null)},c.src=i})}function fy({disabled:a,busy:l,commands:i,sessionTitle:c,contextResult:o,className:d,placeholder:h,draftKey:p,sendLabel:m="Отправить",autoFocus:x=!1,attachmentsEnabled:y=!0,onContextSearch:j,onCommand:v,onSend:R,onInterrupt:w,onEscape:L}){var ve;const B=Vo(OS),[P,M]=_.useState(()=>p?ph(p):""),[Q,k]=_.useState(!1),[Z,z]=_.useState(0),A=_.useRef(null),V=_.useRef(null),te=_.useRef(null),[fe,F]=_.useState(()=>p?ph(p).length:0),[ae,me]=_.useState([]),we=_.useRef(null),ge=_.useCallback(D=>{!y||D.length===0||Promise.all(D.map(XS)).then(J=>{const xe=J.filter(Be=>Be!==null);xe.length!==0&&me(Be=>[...Be,...xe].slice(0,qS))})},[y]);function H(D){me(J=>J.filter(xe=>xe.id!==D))}function ie(D){var Be;if(!y)return;const J=(Be=D.clipboardData)==null?void 0:Be.items;if(!J)return;const xe=[];for(const ft of J){if(!ft.type.startsWith("image/"))continue;const Nn=ft.getAsFile();Nn&&xe.push(Nn)}xe.length!==0&&(D.preventDefault(),ge(xe))}function re(D){const J=D.target.files?Array.from(D.target.files):[];D.target.value="",ge(J)}_.useEffect(()=>{y||me([])},[y]);const[ue,_e]=_.useState([]),[T,K]=_.useState(-1),oe=_.useRef(""),[pe,Ne]=_.useState(""),ye=TS(_.useCallback((D,J)=>{D&&M(xe=>mh(xe,D)),Ne(J.trim())},[])),Ae=pe?mh(P,pe):P;_.useEffect(()=>{ye.listening||pe===""||(M(D=>mh(D,pe)),Ne(""))},[ye.listening,pe]),_.useEffect(()=>{var D;x&&((D=A.current)==null||D.focus())},[x]);const st=_.useRef(new Map),Qe=_.useRef(new Map),Ot=_.useRef(p),qe=_.useRef({text:P,caret:fe});qe.current={text:P,caret:fe};const yt=_.useCallback((D,J,xe)=>{J===""?(st.current.delete(D),Qe.current.delete(D)):(st.current.set(D,J),Qe.current.set(D,xe)),RS(D,J)},[]),et=ye.drop;_.useLayoutEffect(()=>{const D=Ot.current;if(D===p)return;Ot.current=p,D&&yt(D,qe.current.text,qe.current.caret);const J=p?st.current.get(p)??ph(p):"",xe=p?Qe.current.get(p):void 0,Be=Math.min(xe??J.length,J.length);M(J),F(Be),te.current=[Be,Be],Ne(""),z(0),k(!1),K(-1),oe.current="",me([]),et()},[p,yt,et]),_.useEffect(()=>{p&&yt(p,P,fe)},[p,P,fe,yt]);const Je=a?"Выберите сессию":h??"Опишите задачу… («/» — команды, «@» — файлы)",Fe=_.useRef(0),it=_.useCallback(D=>{const J=parseFloat(getComputedStyle(D).maxHeight),xe=Number.isFinite(J)&&J>0?J:BS;D.style.height="auto";const Be=D.scrollHeight;D.style.height=`${Math.min(Be,xe)}px`,D.style.overflowY=Be>xe?"auto":"hidden";const ft=te.current;ft&&(te.current=null,D.setSelectionRange(ft[0],ft[1]))},[]);_.useEffect(()=>{const D=A.current;D&&it(D)},[Ae,Je,a,it]),_.useEffect(()=>{const D=A.current;if(!D)return;const J=new ResizeObserver(([xe])=>{const Be=xe==null?void 0:xe.contentRect.width;Be===void 0||Math.abs(Be-Fe.current)<1||(Fe.current=Be,it(D))});return J.observe(D),()=>J.disconnect()},[it]);const Jn=ye.stop;_.useEffect(()=>{a&&Jn()},[a,Jn]);const Bt=_.useMemo(()=>ye.error?{ok:!1,message:ye.error}:null,[ye.error]),qt=_.useMemo(()=>{var xe;const D=(xe=ax.exec(P))==null?void 0:xe[1];if(D===void 0)return[];const J=D.toLowerCase();return i.filter(Be=>!zS(Be)&&gh(Be,J)<dy).sort((Be,ft)=>gh(Be,J)-gh(ft,J))},[P,i]),Kt=!Q&&qt.length>0,It=Math.min(Z,qt.length-1),Gt=Q?null:((ve=sx.exec(Ae.slice(0,fe)))==null?void 0:ve[1])??null,Qt=_.useRef(j);Qt.current=j,_.useEffect(()=>{if(Gt===null||Gt===""||Gt.endsWith("/")){Qt.current(Gt);return}const D=setTimeout(()=>Qt.current(Gt),US);return()=>clearTimeout(D)},[Gt]);const rt=Gt!==null&&(o==null?void 0:o.query)===Gt,Tt=rt?o.entries:[],en=Gt!==null,En=en&&!rt,Ct=Math.min(Z,Math.max(Tt.length-1,0));_.useEffect(()=>{var J,xe;if(!Kt&&!en)return;const D=Kt?It:Ct;(xe=(J=V.current)==null?void 0:J.children[D])==null||xe.scrollIntoView({block:"nearest"})},[Kt,en,It,Ct]);function kn(D,J){var xe;M(D),F(J),te.current=[J,J],z(0),k(!1),pe!==""&&(Ne(""),ye.drop()),(xe=A.current)==null||xe.focus()}function An(){M(""),Ne(""),z(0),F(0),k(!1),K(-1),oe.current="",me([]),ye.drop(),p&&yt(p,"",0)}function Dt(D){const J=D.trim();J===""&&ae.length===0||a||(R(J,ae.length>0?ae.map(xe=>({mediaType:xe.mediaType,data:xe.data})):void 0),J!==""&&_e(xe=>[J,...xe.filter(Be=>Be!==J)].slice(0,HS)),An())}function fn(D){if(D<-1||D>=ue.length)return;T===-1&&(oe.current=P);const J=D===-1?oe.current:ue[D]??"";K(D),kn(J,J.length)}function Jt(){var Be;const D=((Be=A.current)==null?void 0:Be.selectionStart)??Ae.length,xe=`${D>0&&!/\s$/.test(Ae.slice(0,D))?" ":""}@`;kn(Ae.slice(0,D)+xe+Ae.slice(D),D+xe.length)}function Et(D){var ft;const J=(ft=sx.exec(Ae.slice(0,fe)))==null?void 0:ft[1];if(J===void 0)return;const xe=fe-J.length-1,Be=D.kind==="dir"?`@${D.path}/`:`@${D.path} `;kn(Ae.slice(0,xe)+Be+Ae.slice(fe),xe+Be.length)}function dn(){var J;const D=(J=ax.exec(Ae.trim()))==null?void 0:J[1];if(D&&v(D)){An();return}Dt(Ae)}function ot(D,J){M(D),F(J),z(0),k(!1),K(-1),pe!==""&&(Ne(""),ye.drop())}function tn(D){var Be;const J=LS.has(D.name)?c:null,xe=`/${D.name} `;M(xe+(J??"")),F(xe.length+((J==null?void 0:J.length)??0)),J&&(te.current=[xe.length,xe.length+J.length]),z(0),(Be=A.current)==null||Be.focus()}function E(D){if(v(D.name)){M(""),z(0),k(!1);return}D.argumentHint?tn(D):Dt(`/${D.name}`)}function Y(D){if(Kt){if(D.key==="ArrowDown")return D.preventDefault(),z(J=>(Math.min(J,qt.length-1)+1)%qt.length);if(D.key==="ArrowUp"){D.preventDefault();const J=qt.length-1;return z(xe=>(Math.min(xe,J)+J)%qt.length)}if(D.key==="Enter"&&!D.shiftKey){D.preventDefault();const J=qt[It];J&&E(J);return}if(D.key==="Tab"){D.preventDefault();const J=qt[It];J&&tn(J);return}if(D.key==="Escape"){D.preventDefault(),D.stopPropagation(),k(!0);return}}if(en){if(D.key==="ArrowDown"&&Tt.length>0)return D.preventDefault(),z(J=>(Math.min(J,Tt.length-1)+1)%Tt.length);if(D.key==="ArrowUp"&&Tt.length>0){D.preventDefault();const J=Tt.length-1;return z(xe=>(Math.min(xe,J)+J)%Tt.length)}if(D.key==="Enter"&&!D.shiftKey||D.key==="Tab"){const J=Tt[Ct];if(J){D.preventDefault(),Et(J);return}if(D.key==="Tab")return}if(D.key==="Escape"){D.preventDefault(),D.stopPropagation(),k(!0);return}}if((D.key==="ArrowUp"||D.key==="ArrowDown")&&!D.shiftKey){const J=D.currentTarget,xe=J.selectionStart;if(J.selectionEnd===xe){const ft=D.key==="ArrowUp"?T+1:T-1;ft>=-1&&ft<ue.length&&requestAnimationFrame(()=>{J.selectionStart===xe&&J.selectionEnd===xe&&fn(ft)})}}if(D.key==="Escape"&&L){D.preventDefault(),D.stopPropagation(),L();return}D.key==="Enter"&&!D.shiftKey&&!B&&(D.preventDefault(),dn())}return r.jsx("div",{className:d?`composer ${d}`:"composer",children:r.jsxs("div",{className:"composer__inner",children:[r.jsx(Ui,{result:Bt}),en&&!Kt&&r.jsxs("div",{className:"cmdmenu",role:"listbox",ref:V,children:[Tt.map((D,J)=>r.jsxs("button",{role:"option","aria-selected":J===Ct,className:J===Ct?"cmdmenu__row is-on":"cmdmenu__row",onMouseEnter:()=>z(J),onMouseDown:xe=>{xe.preventDefault(),Et(D)},children:[r.jsxs("span",{className:"cmdmenu__name",children:[D.name,D.kind==="dir"?"/":""]}),r.jsx("span",{className:"cmdmenu__desc",children:D.path}),D.ignored&&r.jsx("span",{className:"cmdmenu__tag",children:"git-ignore"})]},D.path)),Tt.length===0&&r.jsx("div",{className:"cmdmenu__empty",children:En?"ищем…":Gt?"Ничего не нашлось":"Наберите имя файла или каталога"})]}),Kt&&r.jsx("div",{className:"cmdmenu",role:"listbox",ref:V,children:qt.map((D,J)=>r.jsxs("button",{role:"option","aria-selected":J===It,className:J===It?"cmdmenu__row is-on":"cmdmenu__row",onMouseEnter:()=>z(J),onMouseDown:xe=>{xe.preventDefault(),E(D)},children:[r.jsxs("span",{className:"cmdmenu__name",children:["/",D.name]}),D.argumentHint&&r.jsx("span",{className:"cmdmenu__hint",children:D.argumentHint}),r.jsx("span",{className:"cmdmenu__desc",children:D.description})]},D.name))}),ae.length>0&&r.jsx("div",{className:"composer__attachments",children:ae.map(D=>r.jsxs("div",{className:"composer__thumb",children:[r.jsx("img",{src:D.previewUrl,alt:"Вложение"}),r.jsx("button",{type:"button",className:"composer__thumb-remove","aria-label":"Удалить вложение",onClick:()=>H(D.id),children:r.jsx(FS,{})})]},D.id))}),r.jsxs("div",{className:"composer__field",children:[r.jsx("button",{type:"button",className:"addbtn",title:"Добавить контекст — файл проекта («@»)","aria-label":"Добавить контекст",disabled:a,onClick:Jt,children:r.jsx(ZS,{})}),y&&r.jsxs(r.Fragment,{children:[r.jsx("input",{ref:we,type:"file",accept:"image/*",multiple:!0,className:"composer__fileinput",tabIndex:-1,"aria-hidden":"true",onChange:re}),r.jsx("button",{type:"button",className:"attachbtn",title:"Прикрепить изображение","aria-label":"Прикрепить изображение",disabled:a,onClick:()=>{var D;return(D=we.current)==null?void 0:D.click()},children:r.jsx(JS,{})})]}),r.jsx("textarea",{ref:A,value:Ae,disabled:a,placeholder:Je,onChange:D=>ot(D.target.value,D.target.selectionStart),onSelect:D=>F(D.currentTarget.selectionStart),onKeyDown:Y,onPaste:ie}),ye.supported&&r.jsx("button",{type:"button",className:ye.listening?"micbtn is-on":"micbtn",title:ye.listening?"Остановить диктовку":"Продиктовать промпт","aria-label":ye.listening?"Остановить диктовку":"Продиктовать промпт","aria-pressed":ye.listening,disabled:a,onClick:ye.toggle,children:r.jsx(WS,{on:ye.listening})}),l?r.jsx("button",{className:"btn",onClick:w,title:"Прервать (Esc)",children:"Стоп"}):r.jsxs("button",{className:"btn btn--primary sendbtn",onClick:dn,disabled:a||Ae.trim()===""&&ae.length===0,"aria-label":m,title:m,children:[r.jsx("span",{className:"sendbtn__label",children:m}),r.jsx(KS,{})]})]})]})})}function mh(a,l){const i=l.trim();if(i==="")return a;const c=Mh(i).slice($S(a,i)).join(" ");return c===""?a:a===""||/\s$/.test(a)?a+c:`${a} ${c}`}function $S(a,l){const i=Mh(a),c=Mh(l);for(let o=Math.min(i.length,c.length);o>0;o--)if(i.slice(i.length-o).every((d,h)=>QS(d,c[h]??"")))return o;return 0}function Mh(a){return a.split(/\s+/).filter(l=>l!=="")}function QS(a,l){const i=c=>c.toLowerCase().replace(/[.,!?;:…]+$/u,"");return i(a)===i(l)}function ZS(){return r.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round","aria-hidden":"true",children:r.jsx("path",{d:"M8 3.4v9.2M3.4 8h9.2"})})}function KS(){return r.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:r.jsx("path",{d:"M8 12.5V3.5M4 7.5 8 3.5l4 4"})})}function JS(){return r.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:r.jsx("path",{d:"M10.8 4.2 5.9 9.1a2 2 0 0 0 2.8 2.8l4.6-4.6a3.3 3.3 0 0 0-4.7-4.7L3.9 7.3a4.6 4.6 0 0 0 6.5 6.5l4.4-4.4"})})}function FS(){return r.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round","aria-hidden":"true",children:r.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})}function WS({on:a}){return r.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("rect",{x:"5.9",y:"1.7",width:"4.2",height:"7.6",rx:"2.1",fill:a?"currentColor":"none"}),r.jsx("path",{d:"M3.3 7.3v.8a4.7 4.7 0 0 0 9.4 0v-.8"}),r.jsx("path",{d:"M8 12.8v1.5"})]})}const dy=4;function gh(a,l){const i=a.name.toLowerCase();return i===l?0:i.startsWith(l)?1:a.aliases.some(c=>c.toLowerCase().startsWith(l))?2:i.includes(l)?3:dy}function PS({request:a,queued:l,onDecide:i}){const c=iy(a.toolName,a.input);return r.jsx("div",{className:"modal-backdrop modal-backdrop--sheet",children:r.jsxs("div",{className:"sheet",role:"dialog","aria-modal":"true",children:[r.jsxs("div",{className:"sheet__head",children:["Разрешить действие?",l>0&&` (ещё ${l} в очереди)`]}),r.jsxs("div",{className:"sheet__body",children:[r.jsx("div",{className:"sheet__tool",children:a.toolName}),a.reason&&r.jsx("p",{className:"sheet__reason",children:a.reason}),c?r.jsx(Kh,{diff:c}):r.jsx("pre",{className:"code",children:JSON.stringify(a.input,null,2)})]}),r.jsxs("div",{className:"sheet__actions",children:[r.jsx("button",{className:"btn",onClick:()=>i(a.requestId,"deny"),children:"Отклонить"}),r.jsx("button",{className:"btn btn--warn",autoFocus:!0,onClick:()=>i(a.requestId,"allow"),children:"Разрешить"})]})]})})}function ej({request:a,queued:l,onAnswer:i,onDecline:c}){const{questions:o}=a,[d,h]=_.useState(()=>o.map(()=>new Set)),[p,m]=_.useState(()=>o.map(()=>"")),[x,y]=_.useState(()=>rx(o));_.useEffect(()=>{h(o.map(()=>new Set)),m(o.map(()=>"")),y(rx(o))},[a.requestId]);const j=_.useMemo(()=>nj(o,d,p),[o,d,p]),v=j!==null;function R(Q,k){var Z,z;(z=(Z=o[Q])==null?void 0:Z.options[k])!=null&&z.preview&&y(A=>{const V=A.slice();return V[Q]=k,V})}function w(Q,k,Z){h(z=>{const A=z.slice(),V=new Set(A[Q]);return Z?V.has(k)?V.delete(k):V.add(k):V.has(k)||(V.clear(),V.add(k)),A[Q]=V,A}),k!=="other"&&R(Q,k)}function L(Q,k){m(Z=>{const z=Z.slice();return z[Q]=k,z})}function B(){j&&i(a.requestId,j)}function P(Q){Q.key==="Enter"&&(Q.target.closest("button")||v&&(Q.preventDefault(),B()))}function M(Q){var A;if(!["ArrowDown","ArrowUp","ArrowRight","ArrowLeft"].includes(Q.key))return;const k=Array.from(Q.currentTarget.querySelectorAll("button.qsheet__option")),Z=k.indexOf(document.activeElement);if(Z===-1)return;Q.preventDefault();const z=Q.key==="ArrowDown"||Q.key==="ArrowRight"?1:-1;(A=k[(Z+z+k.length)%k.length])==null||A.focus()}return r.jsx("div",{className:"modal-backdrop modal-backdrop--sheet",children:r.jsxs("div",{className:"qsheet",role:"dialog","aria-modal":"true","aria-label":"Вопрос от Claude",onKeyDown:P,children:[r.jsxs("div",{className:"qsheet__head",children:[r.jsx("span",{className:"qsheet__head-icon","aria-hidden":"true",children:"?"}),r.jsxs("span",{children:[o.length===1?"Уточняющий вопрос":`Уточняющие вопросы (${o.length})`,l>0&&` — ещё ${l} в очереди`]})]}),r.jsxs("div",{className:"qsheet__body",children:[a.reason&&r.jsx("p",{className:"qsheet__reason",children:a.reason}),o.map((Q,k)=>r.jsx(tj,{q:Q,qi:k,selected:d[k]??new Set,otherText:p[k]??"",previewIndex:x[k]??null,onToggle:w,onFocusOption:R,onOtherText:L,onOptionsKeyDown:M},k))]}),r.jsxs("div",{className:"qsheet__actions",children:[r.jsx("button",{className:"btn",onClick:()=>c(a.requestId),children:"Не отвечать"}),r.jsx("button",{className:"btn btn--primary",disabled:!v,onClick:B,children:"Ответить"})]})]})})}function tj({q:a,qi:l,selected:i,otherText:c,previewIndex:o,onToggle:d,onFocusOption:h,onOtherText:p,onOptionsKeyDown:m}){var R;const x=a.options.some(w=>w.preview),y=o!==null?(R=a.options[o])==null?void 0:R.preview:void 0,j=i.has("other"),v=a.multiSelect?"checkbox":"radio";return r.jsxs("div",{className:"qsheet__question",children:[r.jsxs("div",{className:"qsheet__qhead",children:[r.jsx("span",{className:"chip chip--accent",children:a.header}),r.jsx("span",{className:"qsheet__qtext",children:a.question})]}),r.jsxs("div",{className:"qsheet__options"+(a.multiSelect?"":" qsheet__options--radio"),role:a.multiSelect?"group":"radiogroup","aria-label":a.question,onKeyDown:m,children:[a.options.map((w,L)=>{const B=i.has(L);return r.jsxs("button",{type:"button",role:v,"aria-checked":B,className:"qsheet__option"+(B?" is-selected":""),onClick:()=>d(l,L,a.multiSelect),onFocus:()=>h(l,L),onMouseEnter:()=>h(l,L),children:[r.jsx("span",{className:"qsheet__opt-mark","aria-hidden":"true"}),r.jsxs("span",{className:"qsheet__opt-body",children:[r.jsx("span",{className:"qsheet__opt-label",children:w.label}),r.jsx("span",{className:"qsheet__opt-desc",children:w.description})]})]},L)}),r.jsxs("div",{className:"qsheet__other",children:[r.jsxs("button",{type:"button",role:v,"aria-checked":j,className:"qsheet__option qsheet__option--other"+(j?" is-selected":""),onClick:()=>d(l,"other",a.multiSelect),children:[r.jsx("span",{className:"qsheet__opt-mark","aria-hidden":"true"}),r.jsxs("span",{className:"qsheet__opt-body",children:[r.jsx("span",{className:"qsheet__opt-label",children:"Другое"}),r.jsx("span",{className:"qsheet__opt-desc",children:"Свой вариант ответа"})]})]}),j&&r.jsx("input",{type:"text",className:"qsheet__other-input",placeholder:"Впишите свой вариант…","aria-label":`Свой вариант ответа на вопрос «${a.question}»`,value:c,onChange:w=>p(l,w.target.value),autoFocus:!0})]})]}),x&&r.jsx("pre",{className:"qsheet__preview",children:y??""})]})}function rx(a){return a.map(l=>{const i=l.options.findIndex(c=>c.preview);return i===-1?null:i})}function nj(a,l,i){const c={};for(let o=0;o<a.length;o++){const d=a[o];if(!d)continue;const h=l[o]??new Set,p=[];for(let m=0;m<d.options.length;m++){const x=d.options[m];x&&h.has(m)&&p.push(x.label)}if(h.has("other")){const m=(i[o]??"").trim();m&&p.push(m)}if(p.length===0)return null;c[d.question]=p.join(", ")}return c}function lj({request:a,plan:l,queued:i,onAccept:c,onDecline:o}){const[d,h]=_.useState(l),[p,m]=_.useState("preview");_.useEffect(()=>{h(l),m("preview")},[a.requestId,l]);const x=d.trim().length>0;function y(){x&&c(a.requestId,d)}return r.jsx("div",{className:"modal-backdrop modal-backdrop--sheet",children:r.jsxs("div",{className:"plansheet",role:"dialog","aria-modal":"true","aria-label":"План агента",children:[r.jsxs("div",{className:"plansheet__head",children:[r.jsx("span",{className:"plansheet__head-icon","aria-hidden":"true",children:r.jsx(sj,{})}),r.jsxs("span",{className:"plansheet__head-text",children:["План на согласование",i>0&&` — ещё ${i} в очереди`]}),r.jsxs("div",{className:"plansheet__viewtoggle",role:"tablist","aria-label":"Режим просмотра",children:[r.jsx("button",{className:"btn btn--sm"+(p==="preview"?" is-on":""),role:"tab","aria-selected":p==="preview",onClick:()=>m("preview"),children:"Просмотр"}),r.jsx("button",{className:"btn btn--sm"+(p==="source"?" is-on":""),role:"tab","aria-selected":p==="source",onClick:()=>m("source"),children:"Код"})]})]}),r.jsxs("div",{className:"plansheet__body",children:[a.reason&&r.jsx("p",{className:"plansheet__reason",children:a.reason}),r.jsx("div",{className:"plansheet__content",children:p==="preview"?r.jsx(aj,{text:d}):r.jsx("textarea",{className:"plansheet__source",value:d,onChange:j=>h(j.target.value),spellCheck:!1,"aria-label":"Текст плана — можно отредактировать перед тем, как согласиться",autoFocus:!0})})]}),r.jsxs("div",{className:"plansheet__actions",children:[r.jsx("button",{className:"btn",onClick:()=>o(a.requestId),children:"Доработать"}),r.jsx("button",{className:"btn btn--ok",disabled:!x,autoFocus:!0,onClick:y,children:"Одобрить план"})]})]})})}function aj({text:a}){const[l,i]=_.useState("");return _.useEffect(()=>{let c=!1;return $h(a).then(o=>{c||i(o)}),()=>{c=!0}},[a]),r.jsx("div",{className:"markdown-preview plansheet__preview",dangerouslySetInnerHTML:{__html:l}})}function sj(){return r.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M4.4 2.5h5.6L13 5.5v7.4a.6.6 0 0 1-.6.6H4.4a.6.6 0 0 1-.6-.6V3.1a.6.6 0 0 1 .6-.6Z"}),r.jsx("path",{d:"M9.5 2.5v2.5a.5.5 0 0 0 .5.5h3"}),r.jsx("path",{d:"M5.6 8.6 7 10l3-3.2"})]})}function ij(a,l){if(a!=="ExitPlanMode"||!l||typeof l!="object")return null;const i=l.plan;return typeof i=="string"?i:null}function hy({path:a}){const[l,i]=_.useState(!1),[c,o]=_.useState(!1),d=_.useRef(null);_.useEffect(()=>{if(!l)return;function p(m){var x;(x=d.current)!=null&&x.contains(m.target)||i(!1)}return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[l]),_.useEffect(()=>{if(!c)return;const p=setTimeout(()=>o(!1),Qh);return()=>clearTimeout(p)},[c]),_.useEffect(()=>i(!1),[a]);async function h(){await Zo(a)&&o(!0)}return r.jsxs("div",{ref:d,className:"cwd",children:[r.jsxs("button",{type:"button",className:"cwd__toggle","aria-expanded":l,title:l?"Свернуть путь":`Полный путь: ${a}`,onClick:()=>i(p=>!p),onKeyDown:p=>{p.key!=="Escape"||!l||(p.preventDefault(),p.stopPropagation(),i(!1))},children:[r.jsx(rj,{open:l}),r.jsx("span",{className:"cwd__short",children:a})]}),l&&r.jsxs("div",{className:"cwd__pop",children:[r.jsx("span",{className:"cwd__full",children:a}),r.jsx("button",{type:"button",className:"btn btn--ghost cwd__copy",onClick:()=>void h(),children:c?wr:Di})]})]})}function rj({open:a}){return r.jsx("svg",{className:a?"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:r.jsx("path",{d:"M6 3.5 10.5 8 6 12.5"})})}function es({value:a,options:l,onChange:i,className:c,title:o,ariaLabel:d,placeholder:h="—"}){const[p,m]=_.useState(!1),[x,y]=_.useState(0),j=_.useRef(null),v=_.useRef(null),R=l.find(B=>B.value===a)??null;_.useEffect(()=>{if(!p)return;const B=l.findIndex(P=>P.value===a);y(B===-1?0:B)},[p]),_.useEffect(()=>{if(!p)return;function B(P){var M;(M=j.current)!=null&&M.contains(P.target)||m(!1)}return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[p]),_.useEffect(()=>{var B,P;p&&((P=(B=v.current)==null?void 0:B.querySelector(".is-cursor"))==null||P.scrollIntoView({block:"nearest"}))},[p,x]),_.useEffect(()=>{if(!p)return;const B=v.current,P=cj(j.current);if(!B||!P)return;const M=B.getBoundingClientRect().bottom-P.getBoundingClientRect().bottom;M>0&&(P.scrollTop+=Math.min(M+8,B.offsetHeight))},[p]);function w(B){m(!1),B.value!==a&&i(B.value)}function L(B){if(B.key==="Escape"){if(!p)return;B.preventDefault(),B.stopPropagation(),m(!1);return}if(B.key==="ArrowDown"||B.key==="ArrowUp"){if(B.preventDefault(),!p)return m(!0);const P=B.key==="ArrowDown"?1:l.length-1;return y(M=>(M+P)%l.length)}if(B.key==="Enter"||B.key===" "){if(B.preventDefault(),!p)return m(!0);const P=l[x];P&&w(P)}}return r.jsxs("div",{ref:j,className:"select"+(p?" select--open":"")+(c?` ${c}`:""),children:[r.jsxs("button",{type:"button",className:"select__trigger",title:o,"aria-label":d??o,"aria-haspopup":"listbox","aria-expanded":p,onClick:()=>m(B=>!B),onKeyDown:L,children:[r.jsx("span",{className:"select__value",children:(R==null?void 0:R.label)??h}),r.jsx(uj,{})]}),p&&r.jsx("div",{ref:v,className:"select__menu",role:"listbox","aria-label":d??o,children:l.map((B,P)=>r.jsxs("button",{type:"button",role:"option","aria-selected":B.value===a,className:"select__option"+(P===x?" is-cursor":"")+(B.value===a?" is-on":""),onMouseEnter:()=>y(P),onClick:()=>w(B),children:[r.jsx("span",{className:"select__check","aria-hidden":"true",children:B.value===a?"✓":""}),r.jsx("span",{className:"select__label",children:B.label}),B.hint&&r.jsx("span",{className:"select__hint",children:B.hint})]},B.value))})]})}function cj(a){let l=(a==null?void 0:a.parentElement)??null;for(;l;){if(l.scrollHeight>l.clientHeight&&getComputedStyle(l).overflowY!=="visible")return l;l=l.parentElement}return null}function uj(){return r.jsx("svg",{className:"select__chev",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:r.jsx("path",{d:"M3 4.5 6 7.5 9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}const oj=["low","medium","high"];function py({models:a,value:l,effort:i,ultracode:c,thinking:o,switchOnFlag:d,className:h,onModel:p,onEffort:m,onUltracode:x,onThinking:y,onSwitchOnFlag:j}){const[v,R]=_.useState(!1),[w,L]=_.useState(0),B=_.useRef(null),P=_.useRef(null),M=a.find(A=>A.value===l)??null,Q=M&&M.supportsEffort?M.effortLevels.length>0?M.effortLevels:oj:[],k=Q.includes("xhigh");_.useEffect(()=>{if(!v)return;const A=a.findIndex(V=>V.value===l);L(A===-1?0:A)},[v]),_.useEffect(()=>{if(!v)return;function A(V){var te;(te=B.current)!=null&&te.contains(V.target)||R(!1)}return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[v]),_.useEffect(()=>{var A,V;v&&((V=(A=P.current)==null?void 0:A.querySelector(".is-cursor"))==null||V.scrollIntoView({block:"nearest"}))},[v,w]);function Z(A){R(!1),A.value!==l&&p(A.value)}function z(A){if(A.key==="Escape"){if(!v)return;A.preventDefault(),A.stopPropagation(),R(!1);return}if(A.key==="ArrowDown"||A.key==="ArrowUp"){if(A.preventDefault(),!v)return R(!0);if(a.length===0)return;const V=A.key==="ArrowDown"?1:a.length-1;return L(te=>(te+V)%a.length)}if(A.key==="Enter"||A.key===" "){if(A.preventDefault(),!v)return R(!0);const V=a[w];V&&Z(V)}}return r.jsxs("div",{ref:B,className:"select"+(v?" select--open":"")+(h?` ${h}`:""),children:[r.jsxs("button",{type:"button",className:"select__trigger",title:"Модель, усилие и размышления","aria-label":"Модель, усилие и размышления","aria-haspopup":"menu","aria-expanded":v,onClick:()=>R(A=>!A),onKeyDown:z,children:[r.jsx("span",{className:"select__value",children:(M==null?void 0:M.displayName)??l??"—"}),c?r.jsx("span",{className:"select__suffix select__suffix--hot",children:"ultracode"}):Q.length>0&&i&&r.jsx("span",{className:"select__suffix",children:i}),r.jsx(fj,{})]}),v&&r.jsxs("div",{ref:P,className:"select__menu modelmenu",role:"menu",children:[r.jsx("div",{className:"modelmenu__head",children:"Модель"}),a.map((A,V)=>r.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":A.value===l,className:"select__option"+(V===w?" is-cursor":"")+(A.value===l?" is-on":""),onMouseEnter:()=>L(V),onClick:()=>Z(A),children:[r.jsx("span",{className:"select__check","aria-hidden":"true",children:A.value===l?"✓":""}),r.jsx("span",{className:"select__label",children:A.displayName}),A.description&&r.jsx("span",{className:"select__hint",children:A.description})]},A.value)),Q.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"modelmenu__sep",role:"separator"}),r.jsxs("div",{className:"modelmenu__row",children:[r.jsxs("span",{className:"modelmenu__label",children:["Усилие",r.jsx("span",{className:"modelmenu__desc",children:"насколько усердно модель думает"})]}),r.jsx("span",{className:"modelmenu__levels",children:Q.map(A=>r.jsx("button",{type:"button",role:"menuitemradio","aria-checked":A===i,className:A===i?"modelmenu__level is-on":"modelmenu__level",onClick:()=>m(A),children:A},A))})]}),k&&r.jsx(bh,{label:"Ultracode",desc:"xhigh и постоянная оркестрация подагентами",on:c,onToggle:()=>x(!c)})]}),r.jsx("div",{className:"modelmenu__sep",role:"separator"}),(M==null?void 0:M.supportsThinking)!==!1&&r.jsx(bh,{label:"Размышления",desc:"расширенное обдумывание перед ответом",on:o,onToggle:()=>y(!o)}),r.jsx(bh,{label:"Менять модель по флагу",desc:"иначе помеченный ход встаёт на паузу",on:d,onToggle:()=>j(!d)})]})]})}function bh({label:a,desc:l,on:i,onToggle:c}){return r.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":i,className:"modelmenu__row modelmenu__row--btn",onClick:c,children:[r.jsxs("span",{className:"modelmenu__label",children:[a,r.jsx("span",{className:"modelmenu__desc",children:l})]}),r.jsx("span",{className:i?"switch is-on":"switch","aria-hidden":"true",children:r.jsx("span",{className:"switch__knob"})})]})}function fj(){return r.jsx("svg",{className:"select__chev",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:r.jsx("path",{d:"M3 4.5 6 7.5 9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function Nl({title:a,children:l,actions:i,className:c,sheet:o=!1,onClose:d}){const h=_.useRef(null);return _.useEffect(()=>{function p(m){if(m.key==="Escape"){m.preventDefault(),m.stopPropagation(),d();return}if(m.key!=="Tab")return;const x=h.current;if(!x)return;const y=x.querySelectorAll('button, input, textarea, select, a[href], [tabindex]:not([tabindex="-1"])'),j=y[0],v=y[y.length-1];!j||!v||(m.shiftKey&&document.activeElement===j?(m.preventDefault(),v.focus()):!m.shiftKey&&document.activeElement===v&&(m.preventDefault(),j.focus()))}return document.addEventListener("keydown",p,!0),()=>document.removeEventListener("keydown",p,!0)},[d]),r.jsx("div",{className:o?"modal-backdrop modal-backdrop--sheet":"modal-backdrop",onMouseDown:p=>{p.target===p.currentTarget&&d()},children:r.jsxs("div",{ref:h,className:c?`modal ${c}`:"modal",role:"dialog","aria-modal":"true","aria-label":a,children:[r.jsxs("div",{className:"modal__head",children:[r.jsx("h2",{className:"modal__title",children:a}),r.jsx("button",{className:"modal__close","aria-label":"Закрыть",onClick:d,children:"✕"})]}),r.jsx("div",{className:"modal__body",children:l}),i&&r.jsx("div",{className:"modal__actions",children:i})]})})}function dj({candidates:a,searching:l,agentItems:i,agentBusy:c,error:o,roots:d,created:h,onSearch:p,onAskAgent:m,onInterrupt:x,onSubmit:y,onCreate:j,onClose:v}){const[R,w]=_.useState("open"),[L,B]=_.useState(""),[P,M]=_.useState(!1),[Q,k]=_.useState(""),[Z,z]=_.useState(""),[A,V]=_.useState({git:!0,claudeMd:!0,readme:!0}),te=L.trim(),fe=te!=="",F=Q.trim(),ae=Z.trim(),me=F!==""&&ae!=="";_.useEffect(()=>{Q===""&&d.length>0&&k(d[0])},[d]);const we=_.useRef(p);we.current=p,_.useEffect(()=>{if(R!=="open")return;const re=L.trim(),ue=setTimeout(()=>we.current(re),200);return()=>clearTimeout(ue)},[L,R]);function ge(){fe&&y(te)}function H(){me&&j(F,ae,A)}function ie(){fe&&(M(!0),m(te))}return h?r.jsxs(Nl,{title:"Новый проект",onClose:v,actions:r.jsx("button",{className:"btn btn--primary",onClick:v,autoFocus:!0,children:"Понятно"}),children:[r.jsx("p",{className:"modal__text",children:"Каталог создан и открыт как проект, но часть шагов не удалась."}),r.jsx("p",{className:"newproj__preview",children:h.path}),r.jsx("div",{className:"modal__error",children:r.jsx("ul",{className:"newproj__warnings",children:h.warnings.map(re=>r.jsx("li",{children:re},re))})}),r.jsx("p",{className:"modal__text modal__text--dim",children:"Проект открыт и работает — недостающее можно добавить руками, в дереве файлов или из терминала."})]}):r.jsxs(Nl,{title:"Новый проект",className:P&&R==="open"?"modal--wide":void 0,onClose:v,actions:r.jsxs(r.Fragment,{children:[r.jsx("button",{className:"btn",onClick:v,children:"Отмена"}),R==="open"?r.jsxs(r.Fragment,{children:[c?r.jsx("button",{className:"btn",onClick:x,children:"Остановить"}):r.jsx("button",{className:"btn",disabled:!fe,onClick:ie,title:"Найти по описанию",children:"Попросить агента"}),r.jsx("button",{className:"btn btn--primary",disabled:!fe,onClick:ge,children:"Открыть"})]}):r.jsx("button",{className:"btn btn--primary",disabled:!me,onClick:H,children:"Создать"})]}),children:[r.jsxs("div",{className:"tabs",children:[r.jsx(cx,{label:"Открыть",on:R==="open",onClick:()=>w("open")}),r.jsx(cx,{label:"Создать",on:R==="create",onClick:()=>w("create")})]}),R==="open"?r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"modal__text",children:"Каталог, в котором будет работать агент. Введите путь или часть имени — подходящие каталоги появятся ниже."}),r.jsx("label",{className:"field",htmlFor:"workspace-path",children:"Путь или название"}),r.jsx("input",{id:"workspace-path",className:"input input--mono",value:L,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"C:\\Projects\\my-app",onChange:re=>B(re.target.value),onKeyDown:re=>{re.key==="Enter"&&(re.preventDefault(),ge())}}),o&&r.jsx("p",{className:"modal__error",children:o}),a.length>0&&r.jsx("ul",{className:"finds",children:a.map(re=>r.jsx("li",{children:r.jsxs("button",{className:"find",disabled:re.open,title:re.open?"Этот проект уже открыт":re.path,onClick:()=>B(re.path),onDoubleClick:()=>y(re.path),children:[r.jsx("span",{className:"find__name",children:re.name}),r.jsx("span",{className:"find__path",children:re.path}),r.jsx("span",{className:"find__note",children:mj(re)})]})},re.path))}),a.length===0&&fe&&!l&&!P&&r.jsx("p",{className:"modal__text modal__text--dim",children:"Ничего похожего среди каталогов, где вы работали. Если помните не имя, а суть проекта — опишите его и нажмите «Попросить агента». Проекта ещё нет вовсе — рядом вкладка «Создать»."}),P&&r.jsx("div",{className:"finds__agent",children:r.jsx(Jh,{items:i,busy:c,waiting:!1,empty:"Агент ищет…"})})]}):r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"modal__text",children:"Пустой каталог для нового проекта. Дальше в нём работает агент — с первого промпта, без отдельной настройки."}),r.jsx("label",{className:"field",htmlFor:"workspace-parent",children:"Где создать"}),r.jsx("input",{id:"workspace-parent",className:"input input--mono",value:Q,spellCheck:!1,autoComplete:"off",placeholder:"C:\\Projects",onChange:re=>k(re.target.value)}),d.length>0&&r.jsx("div",{className:"newproj__roots",children:d.map(re=>r.jsx("button",{type:"button",className:re===F?"newproj__root is-on":"newproj__root",title:re,onClick:()=>k(re),children:pj(re)},re))}),r.jsx("label",{className:"field newproj__field",htmlFor:"workspace-name",children:"Имя проекта"}),r.jsx("input",{id:"workspace-name",className:"input input--mono",value:Z,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"my-app",onChange:re=>z(re.target.value),onKeyDown:re=>{re.key==="Enter"&&(re.preventDefault(),H())}}),r.jsx("p",{className:"newproj__preview",children:me?hj(F,ae):"Каталог появится здесь"}),o&&r.jsx("p",{className:"modal__error",children:o}),r.jsxs("div",{className:"newproj__opts",children:[r.jsx(xh,{label:"git init",desc:"панель истории работает сразу",on:A.git,onToggle:()=>V(re=>({...re,git:!re.git}))}),r.jsx(xh,{label:"CLAUDE.md",desc:"заготовка инструкций для агента",on:A.claudeMd,onToggle:()=>V(re=>({...re,claudeMd:!re.claudeMd}))}),r.jsx(xh,{label:"README.md",desc:"по нему проект потом узнаёт поиск",on:A.readme,onToggle:()=>V(re=>({...re,readme:!re.readme}))})]})]})]})}function cx({label:a,on:l,onClick:i}){return r.jsx("button",{type:"button",className:l?"tabs__tab is-on":"tabs__tab","aria-pressed":l,onClick:i,children:a})}function xh({label:a,desc:l,on:i,onToggle:c}){return r.jsxs("button",{type:"button",role:"checkbox","aria-checked":i,className:"newproj__opt",onClick:c,children:[r.jsxs("span",{className:"newproj__optlabel",children:[a,r.jsx("span",{className:"newproj__optdesc",children:l})]}),r.jsx("span",{className:i?"switch is-on":"switch","aria-hidden":"true",children:r.jsx("span",{className:"switch__knob"})})]})}function hj(a,l){const i=a.includes("\\")?"\\":"/";return a.replace(/[\\/]+$/,"")+i+l}function pj(a){const l=a.includes("\\")?"\\":"/",i=a.split(/[\\/]/).filter(Boolean);return i.length<=2?a:`…${l}${i.slice(-2).join(l)}`}function mj(a){return a.open?"уже открыт":a.why?a.why:a.sessions===0?"рядом с вашими проектами":`${gj(a.sessions)}${bj(a.lastUsedAt)}`}function gj(a){const l=a%10,i=a%100;return i>=11&&i<=14?`${a} сессий`:l===1?`${a} сессия`:l>=2&&l<=4?`${a} сессии`:`${a} сессий`}function bj(a){if(!a)return"";const l=Math.floor((Date.now()-a)/864e5);return l<=0?" · сегодня":l===1?" · вчера":l<30?` · ${l} дн. назад`:` · ${new Date(a).toLocaleDateString("ru-RU")}`}const Fh=7;function xj(a){const l=[],i=[];let c=1;for(const o of a){const d=l.slice();let h=l.indexOf(o.hash);h===-1&&(h=ux(l),l[h]=o.hash);const[p,...m]=o.parents;l[h]=p??null;const x=[];p!==void 0&&x.push({from:h,to:h});for(const v of m){let R=l.indexOf(v);R===-1&&(R=ux(l),l[R]=v),x.push({from:h,to:R})}const y=[];for(let v=0;v<d.length;v++)d[v]===o.hash&&(y.push({from:v,to:h}),v!==h&&(l[v]=null));const j=[];for(let v=0;v<d.length;v++){const R=d[v];!R||R===o.hash||v===h||l[v]===R&&j.push(v)}yj(l),c=Math.max(c,l.length,h+1),i.push({commit:o,col:h,up:y,down:x,through:j})}return{rows:i,columns:Math.min(c,Fh)}}function ux(a){const l=a.indexOf(null);return l!==-1?l:(a.push(null),a.length-1)}function yj(a){for(;a.length>0&&a[a.length-1]===null;)a.pop()}const my=1500;function _j(a){const l=[];let i=!1;for(const c of a.patch.split(`
118
118
  `)){if(l.length>=my){i=!0;break}if(c.startsWith("@@"))l.push({type:"gap",text:vj(c)});else if(c.startsWith("+"))l.push({type:"add",text:c.slice(1)});else if(c.startsWith("-"))l.push({type:"del",text:c.slice(1)});else{if(c.startsWith("\\"))continue;(c!==""||l.length>0)&&l.push({type:"ctx",text:c.startsWith(" ")?c.slice(1):c})}}return{kind:"patch",filePath:a.path||a.oldPath,rows:l,added:a.added,removed:a.removed,note:Sj(a,i)}}function vj(a){const l=/^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@ ?(.*)$/.exec(a);if(!l)return a;const i=Number(l[1]),c=l[2]===void 0?1:Number(l[2]),o=(l[3]??"").trim(),d=c>1?`строки ${i}–${i+c-1}`:`строка ${i}`;return o?`⋯ ${d} · ${o}`:`⋯ ${d}`}function Sj(a,l){const i=[];return a.status==="added"&&i.push("новый файл"),a.status==="deleted"&&i.push("файл удалён"),a.status==="renamed"&&i.push(`переименован из ${a.oldPath}`),a.binary?i.push("двоичный файл"):a.patch===""&&i.push("содержимое не показано"),l&&i.push(`показаны первые ${my} строк`),i.length>0?i.join(" · "):null}function jj({open:a,state:l,result:i,selected:c,busy:o,onRefresh:d,onShow:h,onCheckout:p,onPush:m,onPull:x,onPublish:y,onConnectRemote:j,onDismissResult:v,onClose:R,zoomed:w,onToggleZoom:L}){const B=xj((l==null?void 0:l.commits)??[]),P=[...l!=null&&l.detached?[{value:"",label:`отделён · ${l.head.slice(0,8)}`}]:[],...((l==null?void 0:l.branches)??[]).map(M=>({value:M.name,label:M.name,hint:M.hash.slice(0,8)}))];return r.jsxs("aside",{className:(a?"sidepane sidepane--git sidepane--open":"sidepane sidepane--git")+(w?" sidepane--zoomed":""),"aria-label":"История git",children:[r.jsxs("div",{className:"sidepane__head",onDoubleClick:M=>{L&&(M.target.closest("button")||L())},children:[r.jsx(Ej,{}),r.jsx("span",{className:"sidepane__title",children:"История"}),r.jsx("button",{className:"sidepane__btn",title:"Обновить","aria-label":"Обновить историю",onClick:d,children:"↻"}),L&&r.jsx("button",{className:"sidepane__btn",title:w?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":w?"Свернуть панель истории":"Развернуть панель истории на весь экран","aria-pressed":w,onClick:L,children:r.jsx(Ur,{active:w})}),r.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель истории",onClick:R,children:"✕"})]}),l===null?r.jsx("p",{className:"sidepane__empty",children:"Читаем репозиторий…"}):l.available?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"gitbar",children:r.jsx(es,{className:"gitbar__branch",title:"Ветка — выбрать значит переключиться",value:l.detached?"":l.branch,options:P,onChange:M=>{M&&p(M,`ветку ${M}`)}})}),l.detached&&r.jsx("p",{className:"gitbar__note",children:"HEAD отделён от ветки. Выберите ветку в списке, чтобы вернуться."}),r.jsx("div",{className:"gitbar__actions",children:o?r.jsxs("p",{className:"gitbar__busy",children:[r.jsx(Mj,{}),o]}):l.hasRemote?r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",className:"btn btn--sm",title:"Отправить текущую ветку в origin",onClick:m,children:[r.jsx(Aj,{}),"Отправить",l.ahead>0&&r.jsx("span",{className:"gitbar__count",children:l.ahead})]}),r.jsxs("div",{className:"gitbar__group",children:[r.jsxs("button",{type:"button",className:"btn btn--sm",title:"Забрать с origin и перемотать вперёд (git pull --ff-only)",onClick:()=>x(!0),children:[r.jsx(Cj,{}),"Забрать",l.behind>0&&r.jsx("span",{className:"gitbar__count",children:l.behind})]}),r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost gitbar__check",title:"Только проверить — git fetch, рабочее дерево не меняется","aria-label":"Проверить, что нового на origin, без изменений на диске",onClick:()=>x(!1),children:r.jsx(Rj,{})})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",className:"btn btn--sm btn--primary",title:"Создать репозиторий на GitHub и отправить в него ветку",onClick:y,children:[r.jsx(fx,{}),"Опубликовать на GitHub"]}),r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",title:"Прописать origin на уже существующий репозиторий",onClick:j,children:"уже есть репозиторий"})]})}),r.jsxs("div",{className:"sidepane__scroll",children:[r.jsx("button",{className:"gitrow gitrow--work"+(c===""?" is-on":""),onClick:()=>h(""),children:r.jsxs("span",{className:"gitrow__body",children:[r.jsx("span",{className:"gitrow__subject",children:l.changed.length>0?`Рабочее дерево · ${l.changed.length} ${zj(l.changed.length)}`:"Рабочее дерево чистое"}),r.jsx("span",{className:"gitrow__meta",children:l.changed.length>0?l.changed.slice(0,4).map(M=>Dj(M.path)).join(", "):"незакоммиченных изменений нет"})]})}),B.rows.map(M=>r.jsx(kj,{row:M,columns:B.columns,head:M.commit.hash===l.head,local:l.hasRemote&&!M.commit.pushed,active:c===M.commit.hash,onOpen:()=>h(M.commit.hash)},M.commit.hash)),B.rows.length===0&&r.jsx("p",{className:"sidepane__empty",children:"В репозитории ещё нет коммитов"})]})]}):r.jsxs("div",{className:"gitempty",children:[r.jsx("p",{className:"gitempty__text",children:l.message||"Это не git-репозиторий"}),l.noRepo&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",className:"btn btn--sm btn--primary gitempty__btn",onClick:y,children:[r.jsx(fx,{}),"Опубликовать на GitHub"]}),r.jsx("p",{className:"gitempty__hint",children:"Заведёт репозиторий, сделает первый коммит и отправит его на GitHub."})]})]}),r.jsx(Ui,{result:i,onDismiss:v})]})}const Hc=50,ox=13;function kj({row:a,columns:l,head:i,local:c,active:o,onOpen:d}){const{commit:h}=a,p=h.refs.map(Oj).filter(Boolean);return r.jsxs("button",{className:"gitrow"+(o?" is-on":""),title:c?"Коммит ещё не отправлен на удалённый репозиторий":void 0,onClick:d,children:[r.jsx(Nj,{row:a,columns:l,head:i,local:c}),r.jsxs("span",{className:"gitrow__body",children:[r.jsxs("span",{className:"gitrow__subject",children:[p.map(m=>r.jsx("span",{className:"gitrow__ref",children:m},m)),h.subject]}),r.jsxs("span",{className:"gitrow__meta",children:[h.shortHash," · ",h.author," · ",Lj(h.date),c&&r.jsx("span",{className:"gitrow__local",children:"· не отправлен"})]})]})]})}function Nj({row:a,columns:l,head:i,local:c}){const o=l*ox+6,d=Hc/2,h=x=>8+Math.min(x,Fh-1)*ox,p=c?"3.5 2.5":void 0,m=Eo(a.col);return r.jsxs("svg",{className:"gitgraph",width:o,height:Hc,viewBox:`0 0 ${o} ${Hc}`,"aria-hidden":"true",children:[a.through.map(x=>r.jsx("line",{x1:h(x),y1:0,x2:h(x),y2:Hc,style:{stroke:Eo(x)}},`t${x}`)),a.up.map((x,y)=>r.jsx("path",{d:`M${h(x.from)} 0 L${h(x.from)} ${d-12} L${h(x.to)} ${d}`,fill:"none",style:{stroke:Eo(x.from),strokeDasharray:p}},`u${y}`)),a.down.map((x,y)=>r.jsx("path",{d:`M${h(x.from)} ${d} L${h(x.to)} ${d+12} L${h(x.to)} ${Hc}`,fill:"none",style:{stroke:Eo(x.to),strokeDasharray:p}},`d${y}`)),i&&r.jsx("circle",{className:"gitgraph__head",cx:h(a.col),cy:d,r:a.commit.parents.length>1?7.4:6.6}),r.jsx("circle",{className:"gitgraph__dot",cx:h(a.col),cy:d,r:a.commit.parents.length>1?4.6:3.6,style:{stroke:m,fill:c?void 0:m}})]})}function Eo(a){return`var(--lane-${a%Fh})`}function wj({detail:a,local:l,onCheckout:i,onClose:c}){const o=a.hash==="";return r.jsxs(Nl,{className:"modal--wide",title:o?"Незакоммиченные изменения":`Коммит ${a.shortHash}`,onClose:c,actions:r.jsxs(r.Fragment,{children:[!o&&r.jsx("button",{className:"btn",onClick:()=>i(a.hash,`коммит ${a.shortHash} (HEAD отделится от ветки)`),children:"Переключиться сюда"}),r.jsx("button",{className:"btn btn--primary",onClick:c,children:"Закрыть"})]}),children:[!o&&r.jsxs("div",{className:"commit__head",children:[r.jsx("p",{className:"commit__subject",children:a.subject}),r.jsxs("p",{className:"commit__meta",children:[a.author,a.email&&` <${a.email}>`," · ",Uj(a.date)," ·"," ",r.jsx("span",{className:"commit__hash",children:a.hash})]}),l&&r.jsx("p",{className:"commit__meta commit__meta--local",children:"Не отправлен: этого коммита нет ни в одной удалённой ветке."}),a.parents.length>0&&r.jsxs("p",{className:"commit__meta",children:[a.parents.length>1?"слияние: ":"родитель: ",a.parents.map(d=>d.slice(0,8)).join(", ")]}),a.body&&r.jsx("pre",{className:"commit__body",children:a.body})]}),a.truncated&&r.jsx("p",{className:"modal__text",children:"Изменения слишком велики — часть патча не показана."}),a.files.length===0?r.jsx("p",{className:"modal__text",children:"Изменений нет."}):a.files.map(d=>r.jsx(Tj,{file:d,defaultOpen:a.files.length<=3},d.path+d.oldPath))]})}function Tj({file:a,defaultOpen:l}){const[i,c]=_.useState(l);return r.jsxs("div",{className:"commit__file",children:[r.jsxs("button",{className:"commit__filehead",onClick:()=>c(o=>!o),children:[r.jsx("span",{className:"commit__filepath",children:a.path||a.oldPath}),r.jsxs("span",{className:"diff__stat",children:[a.added>0&&r.jsxs("span",{className:"diff__stat--add",children:["+",a.added]}),a.removed>0&&r.jsxs("span",{className:"diff__stat--del",children:["−",a.removed]})]}),r.jsx("span",{className:"tool__status",children:i?"▴":"▾"})]}),i&&r.jsx(Kh,{diff:_j(a)})]})}function Ej(){return r.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[r.jsx("circle",{cx:"4.5",cy:"3.5",r:"1.9"}),r.jsx("circle",{cx:"4.5",cy:"12.5",r:"1.9"}),r.jsx("circle",{cx:"11.5",cy:"8",r:"1.9"}),r.jsx("path",{d:"M4.5 5.4v5.2M6.4 3.9h2.2a1.6 1.6 0 0 1 1.6 1.6v.8"})]})}function Aj(){return r.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:r.jsx("path",{d:"M8 13V3M4.5 6.5 8 3l3.5 3.5"})})}function Cj(){return r.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:r.jsx("path",{d:"M8 3v10M4.5 9.5 8 13l3.5-3.5"})})}function Rj(){return r.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("circle",{cx:"7",cy:"7",r:"4"}),r.jsx("path",{d:"m13 13-2.6-2.6"})]})}function fx(){return r.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:r.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8Z"})})}function Mj(){return r.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M14 8a6 6 0 1 1-6-6c1.68 0 3.29.67 4.49 1.83L14 5.33"}),r.jsx("path",{d:"M14 2v3.33h-3.33"})]})}function Oj(a){return a.replace(/^HEAD -> /,"").replace(/^tag: /,"⌂ ").trim()}function Dj(a){const l=a.split("/");return l[l.length-1]??a}function zj(a){const l=a%100;if(l>=11&&l<=14)return"файлов";switch(a%10){case 1:return"файл";case 2:case 3:case 4:return"файла";default:return"файлов"}}function Lj(a){const l=Date.parse(a);if(Number.isNaN(l))return a;const i=Math.round((Date.now()-l)/6e4);if(i<1)return"только что";if(i<60)return`${i} мин назад`;const c=Math.round(i/60);if(c<24)return`${c} ч назад`;const o=Math.round(c/24);return o<30?`${o} дн назад`:new Date(l).toLocaleDateString()}function Uj(a){const l=Date.parse(a);return Number.isNaN(l)?a:new Date(l).toLocaleString()}function dx(a){return a.replace(/[^A-Za-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"")}function Hj({status:a,owners:l,files:i,defaultName:c,hasCommits:o,busy:d,result:h,onRefreshStatus:p,onSaveToken:m,onPublish:x,onDismissResult:y,onClose:j}){var re;const[v,R]=_.useState(()=>dx(c)),[w,L]=_.useState(""),[B,P]=_.useState(""),[M,Q]=_.useState(!0),[k,Z]=_.useState("Первый коммит"),[z,A]=_.useState(null),[V,te]=_.useState("");_.useEffect(()=>{!w&&l.length>0&&L(l[0].login)},[w,l]),_.useEffect(()=>{i&&z===null&&A(new Set(i.files))},[i,z]);const fe=(a==null?void 0:a.connected)===!0,F=l.map(ue=>({value:ue.login,label:ue.login,hint:ue.kind==="org"?"организация":void 0})),ae=_.useMemo(()=>{if(!i)return[];const ue=V.trim().toLowerCase();return ue?i.files.filter(_e=>_e.toLowerCase().includes(ue)):i.files},[i,V]),me=(z==null?void 0:z.size)??0,we=fe&&v.trim()!==""&&w!==""&&d===""&&(o||me>0);function ge(ue){A(_e=>{const T=new Set(_e??[]);return T.has(ue)?T.delete(ue):T.add(ue),T})}function H(ue){A(_e=>{const T=new Set(_e??[]);for(const K of ae)ue?T.add(K):T.delete(K);return T})}function ie(){if(!we)return;const ue=(i==null?void 0:i.files)??[];x({owner:w,name:v.trim(),description:B.trim(),private:M,include:o?[]:ue.filter(_e=>z==null?void 0:z.has(_e)),ignore:o?[]:ue.filter(_e=>!(z!=null&&z.has(_e))),message:o?"":k.trim()||"Первый коммит"})}return r.jsxs(Nl,{className:"modal--wide",title:"Опубликовать на GitHub",onClose:j,actions:r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",className:"btn",onClick:j,children:"Отмена"}),r.jsx("button",{type:"button",className:"btn btn--primary",disabled:!we,onClick:ie,children:d||"Опубликовать"})]}),children:[r.jsx(Bj,{status:a,onRefreshStatus:p,onSaveToken:m}),r.jsxs("div",{className:"publish__section",children:[r.jsx("h3",{className:"publish__heading",children:"Репозиторий"}),r.jsxs("label",{className:"field publish__field",children:[r.jsx("span",{children:"Имя"}),r.jsx("input",{className:"input input--mono",value:v,spellCheck:!1,autoComplete:"off",onChange:ue=>R(dx(ue.target.value))})]}),v.trim()===""&&r.jsx("p",{className:"modal__error",children:"Имя репозитория не может быть пустым."}),r.jsxs("label",{className:"field publish__field",children:[r.jsx("span",{children:"Владелец"}),l.length>1?r.jsx(es,{className:"settings__select",value:w,options:F,onChange:L,placeholder:"выберите владельца",ariaLabel:"Владелец репозитория"}):r.jsx("p",{className:"publish__static",children:((re=l[0])==null?void 0:re.login)??"—"})]}),r.jsxs("label",{className:"field publish__field",children:[r.jsx("span",{children:"Описание (необязательно)"}),r.jsx("input",{className:"input",value:B,placeholder:"о чём проект — одной строкой",onChange:ue=>P(ue.target.value)})]}),r.jsxs("div",{className:"field publish__field",children:[r.jsx("span",{children:"Видимость"}),r.jsxs("div",{className:"access",role:"radiogroup","aria-label":"Видимость репозитория",children:[r.jsx(hx,{title:"Приватный",desc:"Виден только вам и тем, кого вы пригласите. Стоит по умолчанию: репозиторий с чужим кодом, случайно ставший публичным, потом не отозвать.",on:M,onClick:()=>Q(!0)}),r.jsx(hx,{title:"Публичный",desc:"Виден всем в интернете — код, история коммитов, всё содержимое.",risky:!0,on:!M,onClick:()=>Q(!1)})]})]})]}),!o&&r.jsxs("div",{className:"publish__section",children:[r.jsx("h3",{className:"publish__heading",children:"Файлы первого коммита"}),i===null?r.jsx("p",{className:"modal__text",children:"Читаем файлы…"}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"publish__filehead",children:[r.jsxs("span",{className:"publish__filecount",children:[me," из ",i.files.length," файлов"]}),r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>H(!0),children:"Отметить все"}),r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>H(!1),children:"Снять все"})]}),i.files.length>8&&r.jsx("input",{className:"input publish__filter",value:V,placeholder:"Фильтр по пути…",spellCheck:!1,onChange:ue=>te(ue.target.value)}),r.jsx("div",{className:"publish__filelist",children:ae.length===0?r.jsx("p",{className:"modal__text publish__filesempty",children:"Ничего не найдено по фильтру."}):ae.map(ue=>r.jsxs("button",{type:"button",role:"checkbox","aria-checked":(z==null?void 0:z.has(ue))===!0,className:"publish__file",onClick:()=>ge(ue),children:[r.jsx("span",{className:"publish__box"+(z!=null&&z.has(ue)?" is-on":""),"aria-hidden":"true",children:(z==null?void 0:z.has(ue))&&"✓"}),r.jsx("span",{className:"publish__filepath",children:ue})]},ue))}),i.truncated&&r.jsx("p",{className:"publish__truncated",children:"Каталог больше, чем показано здесь, — часть файлов в список не попала. Их всё равно можно закоммитить потом обычным образом."}),r.jsxs("label",{className:"field publish__field",children:[r.jsx("span",{children:"Сообщение коммита"}),r.jsx("input",{className:"input",value:k,onChange:ue=>Z(ue.target.value)})]})]})]}),r.jsx(Ui,{result:h,onDismiss:y})]})}function hx({title:a,desc:l,on:i,risky:c,onClick:o}){return r.jsxs("button",{type:"button",role:"radio","aria-checked":i,className:"access__card"+(i?" is-on":"")+(c?" access__card--risky":""),onClick:o,children:[r.jsx("span",{className:"access__radio","aria-hidden":"true"}),r.jsxs("span",{className:"access__body",children:[r.jsxs("span",{className:"access__title",children:[a,c&&r.jsx("span",{className:"access__risk",children:"видно всем"})]}),r.jsx("span",{className:"access__desc",children:l})]})]})}function Bj({status:a,onRefreshStatus:l,onSaveToken:i}){const[c,o]=_.useState(""),[d,h]=_.useState(!1);return r.jsxs("div",{className:"publish__section publish__section--first",children:[r.jsx("h3",{className:"publish__heading",children:"Учётная запись GitHub"}),a===null?r.jsx("p",{className:"modal__text",children:"Проверяем подключение…"}):a.connected?r.jsxs("div",{className:"publish__account",children:[r.jsx("span",{className:"chip chip--ok",children:a.login}),r.jsx("span",{className:"publish__accountvia",children:a.source==="gh"?"через GitHub CLI":"по личному токену"}),a.source==="token"&&r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>i(""),children:"Отключить токен"})]}):r.jsxs("div",{className:"publish__connect",children:[a.ghInstalled&&r.jsxs("p",{className:"modal__text",children:["В системе установлен ",r.jsx("code",{children:"gh"}),", но вход в нём не выполнен. Можно вместо токена выполнить ",r.jsx("code",{children:"gh auth login"})," в панели терминала и нажать «Проверить снова» — либо ввести личный токен ниже."]}),r.jsxs("label",{className:"field publish__field",children:[r.jsx("span",{children:"Личный токен GitHub"}),r.jsx(qj,{value:c,onChange:o,visible:d,onToggleVisible:()=>h(p=>!p),placeholder:"ghp_…"})]}),r.jsxs("p",{className:"publish__tokenhint",children:["Нужен токен с доступом ",r.jsx("code",{children:"repo"})," — им приложение создаст репозиторий и отправит в него код."," ",r.jsx("a",{href:"https://github.com/settings/tokens/new?scopes=repo&description=Claude%20Code%20Visual",target:"_blank",rel:"noreferrer",children:"Создать токен на GitHub ↗"})]}),a.message&&r.jsx("p",{className:"modal__error",children:a.message}),r.jsxs("div",{className:"extbar",children:[r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:l,children:"Проверить снова"}),r.jsx("button",{type:"button",className:"btn btn--sm btn--primary",disabled:c.trim()==="",onClick:()=>i(c.trim()),children:"Сохранить токен"})]})]})]})}function qj({value:a,onChange:l,visible:i,onToggleVisible:c,placeholder:o,autoFocus:d}){return r.jsxs("div",{className:"pwfield",children:[r.jsx("input",{className:"input input--mono pwfield__input",type:i?"text":"password",value:a,placeholder:o,spellCheck:!1,autoComplete:"off",autoFocus:d,onChange:h=>l(h.target.value)}),r.jsx("button",{type:"button",className:"pwfield__toggle","aria-label":i?"Скрыть токен":"Показать токен","aria-pressed":i,onClick:c,children:i?r.jsx(Gj,{}):r.jsx(Ij,{})})]})}function Ij(){return r.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M1 8s2.5-5 7-5 7 5 7 5-2.5 5-7 5-7-5-7-5Z"}),r.jsx("circle",{cx:"8",cy:"8",r:"2.1"})]})}function Gj(){return r.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M1 8s2.5-5 7-5 7 5 7 5-2.5 5-7 5-7-5-7-5Z"}),r.jsx("circle",{cx:"8",cy:"8",r:"2.1"}),r.jsx("path",{d:"M2 14 14 2"})]})}function Yj({busy:a,result:l,onSubmit:i,onDismissResult:c,onClose:o}){const[d,h]=_.useState(""),p=/^(https?|ssh|git):\/\/\S+/i.test(d.trim())||/^[\w.-]+@[\w.-]+:.+/.test(d.trim());return r.jsxs(Nl,{title:"Подключить существующий репозиторий",onClose:o,actions:r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",className:"btn",onClick:o,children:"Отмена"}),r.jsx("button",{type:"button",className:"btn btn--primary",disabled:!p||a!=="",onClick:()=>i(d.trim()),children:a||"Подключить"})]}),children:[r.jsxs("p",{className:"modal__text",children:["Пропишет этот адрес как ",r.jsx("code",{children:"origin"})," текущего репозитория. Ничего не отправляется само — после этого в панели появятся обычные «Отправить» и «Забрать»."]}),r.jsxs("label",{className:"field",children:[r.jsx("span",{children:"Адрес репозитория"}),r.jsx("input",{className:"input input--mono",value:d,placeholder:"https://github.com/owner/name.git",spellCheck:!1,autoComplete:"off",autoFocus:!0,onChange:m=>h(m.target.value),onKeyDown:m=>{m.key==="Enter"&&p&&a===""&&i(d.trim())}})]}),r.jsxs("p",{className:"modal__text modal__text--dim",children:["Подходят адреса вида ",r.jsx("code",{children:"https://…"}),", ",r.jsx("code",{children:"ssh://…"}),", ",r.jsx("code",{children:"git://…"})," и"," ",r.jsx("code",{children:"git@host:path"}),"."]}),r.jsx(Ui,{result:l,onDismiss:c})]})}function Xj({open:a,items:l,busy:i,ready:c,commands:o,contextResult:d,draftKey:h,models:p,model:m,effort:x,ultracode:y,thinking:j,switchOnFlag:v,onContextSearch:R,onCommand:w,onModel:L,onEffort:B,onUltracode:P,onThinking:M,onSwitchOnFlag:Q,onAsk:k,onInterrupt:Z,onReset:z,onClose:A,zoomed:V,onToggleZoom:te}){return r.jsxs("aside",{className:(a?"sidepane sidepane--ask sidepane--open":"sidepane sidepane--ask")+(V?" sidepane--zoomed":""),"aria-label":"Вопрос на полях",children:[r.jsxs("div",{className:"sidepane__head",onDoubleClick:fe=>{te&&(fe.target.closest("button")||te())},children:[r.jsx(Vj,{}),r.jsx("span",{className:"sidepane__title",children:"Вопрос на полях"}),r.jsx("button",{className:"sidepane__btn",title:"Начать заново — следующий вопрос возьмёт свежий контекст","aria-label":"Начать боковой разговор заново",disabled:l.length===0,onClick:z,children:"↻"}),te&&r.jsx("button",{className:"sidepane__btn",title:V?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":V?"Свернуть панель вопроса":"Развернуть панель вопроса на весь экран","aria-pressed":V,onClick:te,children:r.jsx(Ur,{active:V})}),r.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель вопроса",onClick:A,children:"✕"})]}),p.length>0&&r.jsxs("div",{className:"sidepane__tools",children:[r.jsx(py,{className:"select--compact",models:p,value:m,effort:x,ultracode:y,thinking:j,switchOnFlag:v,onModel:L,onEffort:B,onUltracode:P,onThinking:M,onSwitchOnFlag:Q}),r.jsx("span",{className:"sidepane__note",title:"Боковой вопрос работает только на чтение",children:"только чтение"})]}),r.jsx(Jh,{items:l,busy:i,waiting:!1,empty:c?"Спросите о том, что происходит: вопрос уйдёт в сторону от основного разговора и не попадёт в его контекст. Отвечающий видит сессию и проект, но ничего не меняет.":"Откройте сессию — вопрос задаётся о ней."}),r.jsx(fy,{className:"composer--side",disabled:!c,busy:i,commands:o,sessionTitle:null,contextResult:d,draftKey:h?`side:${h}`:null,placeholder:"Спросить, не мешая работе…",sendLabel:"Спросить",autoFocus:a,attachmentsEnabled:!1,onContextSearch:R,onCommand:w,onSend:k,onInterrupt:Z,onEscape:i?Z:A})]})}function Vj(){return r.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:[r.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"}),r.jsx("path",{d:"M8.4 8.5v-.3c0-.7.9-.9.9-1.7a1 1 0 0 0-1.9-.4"})]})}const $j=75,Qj=90;function gy({usage:a}){if(!(a!=null&&a.available))return null;const l=[];return a.fiveHour&&l.push({key:"five",label:"5 ч",window:a.fiveHour}),a.sevenDay&&l.push({key:"week",label:"нед",window:a.sevenDay}),l.length===0?null:r.jsx("div",{className:"usage",title:Jj(a),"aria-label":`Расход лимитов плана${a.plan?` ${a.plan}`:""}`,children:l.map(i=>r.jsx(Zj,{label:i.label,window:i.window},i.key))})}function Zj({label:a,window:l}){const i=Math.round(l.utilization),c=Fj(l.resetsAt);return r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"usage__label",children:a}),r.jsx("span",{className:"usage__track",role:"progressbar","aria-label":a,"aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":100,children:r.jsx("span",{className:`usage__fill${Kj(i)}`,style:{width:`${i}%`}})}),r.jsxs("span",{className:"usage__pct",children:[i,"%"]}),r.jsx("span",{className:"usage__reset",title:yy(l.resetsAt)||void 0,children:c&&`↻ ${c}`})]})}function Kj(a){return a>=Qj?" usage__fill--over":a>=$j?" usage__fill--warn":""}function Jj(a){const l=[a.plan?`Лимиты плана ${a.plan}`:"Лимиты плана"],i=(c,o)=>{if(!o)return;const d=yy(o.resetsAt);l.push(`${c}: ${Math.round(o.utilization)}%${d?`, ${d}`:""}`)};return i("5 часов",a.fiveHour),i("Неделя",a.sevenDay),i("Неделя, Opus",a.sevenDayOpus),l.join(`
119
119
  `)}function by(a){if(!a)return null;const l=new Date(a);return Number.isNaN(l.getTime())?null:l}function xy(a){return a.getTime()-Date.now()<1440*60*1e3}function Fj(a){const l=by(a);return l?xy(l)?l.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):l.toLocaleDateString(void 0,{day:"numeric",month:"short"}):""}function yy(a){const l=by(a);return l?`обнулится ${xy(l)?`в ${l.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}`:l.toLocaleDateString(void 0,{day:"numeric",month:"long"})}`:""}function _y(){const[a,l]=_.useState(()=>new Date);return _.useEffect(()=>{let i=0;const c=()=>{const d=new Date;l(d),i=window.setTimeout(c,6e4-(d.getSeconds()*1e3+d.getMilliseconds()))};c();const o=()=>{document.hidden||(window.clearTimeout(i),c())};return document.addEventListener("visibilitychange",o),()=>{window.clearTimeout(i),document.removeEventListener("visibilitychange",o)}},[]),r.jsxs("time",{className:"clock",dateTime:a.toISOString(),title:Wj(a),children:[r.jsx("span",{className:"clock__time",children:a.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}),r.jsx("span",{className:"clock__date",children:a.toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})})]})}function Wj(a){return a.toLocaleDateString(void 0,{weekday:"long",day:"numeric",month:"long",year:"numeric"})}function Pj({onClose:a,permission:l,model:i,usage:c,cwd:o,costLabel:d,onRefresh:h,refreshing:p,metersFetchedAt:m,onRename:x}){return r.jsx(Nl,{title:"Настройки сессии",className:"modal--sheet",sheet:!0,onClose:a,children:r.jsxs("div",{className:"sessionmenu",children:[l&&r.jsx(vr,{label:"Режим прав",children:l}),r.jsx(vr,{label:"Модель",children:i}),(c==null?void 0:c.available)&&(c.fiveHour||c.sevenDay)&&r.jsx(vr,{label:"Лимиты плана",children:r.jsx(gy,{usage:c})}),r.jsxs("button",{type:"button",className:p?"sessionmenu__refresh is-busy":"sessionmenu__refresh","aria-busy":p,disabled:p,onClick:h,children:[r.jsx(ek,{}),r.jsxs("span",{className:"sessionmenu__refresh-text",children:["Обновить показания",m&&r.jsxs("span",{className:"sessionmenu__refresh-time",children:["обновлено в"," ",new Date(m).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})]})]})]}),r.jsx(vr,{label:"Время",children:r.jsx(_y,{})}),d&&r.jsx(vr,{label:"Стоимость хода",children:r.jsx("span",{className:"badge badge--cost",children:d})}),o&&r.jsx(vr,{label:"Каталог проекта",children:r.jsx(hy,{path:o})}),x&&r.jsx("button",{type:"button",className:"sessionmenu__rename",onClick:x,children:"Переименовать сессию"})]})})}function vr({label:a,children:l}){return r.jsxs("div",{className:"sessionmenu__row",children:[r.jsx("span",{className:"sessionmenu__label",children:a}),l]})}function ek(){return r.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("path",{d:"M14 8a6 6 0 1 1-6-6c1.68 0 3.29.67 4.49 1.83L14 5.33"}),r.jsx("path",{d:"M14 2v3.33h-3.33"})]})}function tk({tab:a,servers:l,plugins:i,marketplaces:c,catalog:o,result:d,actions:h,onTab:p,onClose:m}){const x=[{id:"mcp",label:"MCP-серверы",count:l.length},{id:"plugins",label:"Плагины",count:i.length},{id:"catalog",label:"Каталог",count:o.length}];return r.jsxs(Nl,{title:"Расширения",className:"modal--wide",onClose:m,children:[r.jsx("div",{className:"tabs",role:"tablist",children:x.map(y=>r.jsxs("button",{role:"tab","aria-selected":a===y.id,className:a===y.id?"tabs__tab is-on":"tabs__tab",onClick:()=>p(y.id),children:[y.label,r.jsx("span",{className:"tabs__count",children:y.count})]},y.id))}),a==="mcp"&&r.jsx(nk,{servers:l,actions:h}),a==="plugins"&&r.jsx(rk,{plugins:i,marketplaces:c,actions:h}),a==="catalog"&&r.jsx(ck,{catalog:o,hasMarketplaces:c.length>0,actions:h,onMarketplaces:()=>p("plugins")}),r.jsx(Ui,{result:d})]})}function nk({servers:a,actions:l}){const[i,c]=_.useState(!1);return r.jsxs(r.Fragment,{children:[a.length===0&&!i&&r.jsxs("p",{className:"modal__text",children:["Ни одного MCP-сервера. Добавленный здесь попадёт в ",r.jsx("code",{children:".mcp.json"})," ","проекта — его увидит и консольный ",r.jsx("code",{children:"claude mcp list"}),"."]}),r.jsx("ul",{className:"extlist",children:a.map(o=>r.jsxs("li",{className:"extlist__row",children:[r.jsxs("div",{className:"extlist__head",children:[r.jsx("span",{className:"extlist__name",children:o.name}),r.jsx("span",{className:`chip chip--${ak(o.status)}`,children:lk[o.status]}),o.scope&&r.jsx("span",{className:"chip",children:o.scope}),o.transport&&r.jsx("span",{className:"chip",children:o.transport})]}),o.target&&r.jsx("div",{className:"extlist__meta",title:o.target,children:o.target}),o.error&&r.jsx("div",{className:"extlist__error",children:o.error}),o.tools.length>0&&r.jsxs("div",{className:"extlist__meta",children:["Инструментов: ",o.tools.length," · ",o.tools.slice(0,6).join(", "),o.tools.length>6&&"…"]}),r.jsxs("div",{className:"extlist__actions",children:[r.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>l.mcpAction(o.name,"reconnect"),children:"Переподключить"}),o.status==="disabled"?r.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>l.mcpAction(o.name,"enable"),children:"Включить"}):r.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>l.mcpAction(o.name,"disable"),children:"Выключить"}),o.editable&&r.jsx("button",{className:"btn btn--ghost btn--sm btn--danger",onClick:()=>l.mcpRemove(o.name),children:"Удалить"})]})]},o.name))}),i?r.jsx(sk,{onCancel:()=>c(!1),onSubmit:(o,d)=>{l.mcpAdd(o,d),c(!1)}}):r.jsx("div",{className:"extbar",children:r.jsx("button",{className:"btn btn--primary",onClick:()=>c(!0),children:"+ Сервер"})})]})}const lk={connected:"подключён",failed:"ошибка","needs-auth":"нужна авторизация",pending:"подключается",disabled:"выключен",unknown:"неизвестно"};function ak(a){return a==="connected"?"ok":a==="failed"?"bad":a==="needs-auth"?"warn":"mute"}function sk({onSubmit:a,onCancel:l}){const[i,c]=_.useState(""),[o,d]=_.useState("stdio"),[h,p]=_.useState(""),[m,x]=_.useState(""),[y,j]=_.useState(""),v=o==="stdio",R=i.trim()!==""&&(v?h.trim()!=="":m.trim()!=="");function w(){if(R)if(v){const[L,...B]=ik(h);a(i.trim(),{transport:"stdio",command:L??"",args:B,env:px(y)})}else a(i.trim(),{transport:o,url:m.trim(),headers:px(y)})}return r.jsxs("div",{className:"extform extform--card",children:[r.jsx("label",{className:"field",htmlFor:"mcp-name",children:"Имя сервера"}),r.jsx("input",{id:"mcp-name",className:"input input--mono",value:i,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"context7",onChange:L=>c(L.target.value)}),r.jsx("label",{className:"field",children:"Транспорт"}),r.jsx(es,{title:"Транспорт",value:o,options:[{value:"stdio",label:"stdio",hint:"локальный процесс"},{value:"http",label:"http",hint:"удалённый сервер"},{value:"sse",label:"sse",hint:"удалённый, поток событий"}],onChange:L=>d(L)}),v?r.jsxs(r.Fragment,{children:[r.jsx("label",{className:"field",htmlFor:"mcp-command",children:"Команда с аргументами"}),r.jsx("input",{id:"mcp-command",className:"input input--mono",value:h,spellCheck:!1,autoComplete:"off",placeholder:"npx -y @upstash/context7-mcp",onChange:L=>p(L.target.value)})]}):r.jsxs(r.Fragment,{children:[r.jsx("label",{className:"field",htmlFor:"mcp-url",children:"URL"}),r.jsx("input",{id:"mcp-url",className:"input input--mono",value:m,spellCheck:!1,autoComplete:"off",placeholder:"https://mcp.example.dev/mcp",onChange:L=>x(L.target.value)})]}),r.jsxs("label",{className:"field",htmlFor:"mcp-pairs",children:[v?"Переменные окружения":"Заголовки"," — по одной на строку, необязательно"]}),r.jsx("textarea",{id:"mcp-pairs",className:"input input--mono input--area",value:y,spellCheck:!1,placeholder:v?"API_KEY=xxx":"Authorization: Bearer xxx",onChange:L=>j(L.target.value)}),r.jsxs("div",{className:"extbar",children:[r.jsx("button",{className:"btn",onClick:l,children:"Отмена"}),r.jsx("button",{className:"btn btn--primary",disabled:!R,onClick:w,children:"Подключить"})]})]})}function px(a){const l={};for(const i of a.split(`
120
120
  `)){const c=i.trim();if(!c)continue;const o=c.indexOf("="),d=c.indexOf(":"),h=o===-1?d:d===-1?o:Math.min(o,d);h<=0||(l[c.slice(0,h).trim()]=c.slice(h+1).trim())}return l}function ik(a){return(a.trim().match(/"[^"]*"|'[^']*'|\S+/g)??[]).map(l=>l.replace(/^["']|["']$/g,""))}function rk({plugins:a,marketplaces:l,actions:i}){const[c,o]=_.useState("");return r.jsxs(r.Fragment,{children:[a.length===0&&r.jsx("p",{className:"modal__text",children:"Ни одного установленного плагина. Что можно поставить — на вкладке «Каталог»."}),r.jsx("ul",{className:"extlist",children:a.map(d=>r.jsxs("li",{className:"extlist__row",children:[r.jsxs("div",{className:"extlist__head",children:[r.jsx("span",{className:"extlist__name",children:d.name}),r.jsx("span",{className:d.enabled?"chip chip--ok":"chip chip--mute",children:d.enabled?"включён":"выключен"}),d.version&&d.version!=="unknown"&&r.jsx("span",{className:"chip",children:d.version}),d.scope&&r.jsx("span",{className:"chip",children:d.scope})]}),d.marketplace&&r.jsx("div",{className:"extlist__meta",children:d.marketplace}),d.mcpServers.length>0&&r.jsxs("div",{className:"extlist__meta",children:["MCP-серверы: ",d.mcpServers.join(", ")]}),r.jsxs("div",{className:"extlist__actions",children:[r.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>i.pluginToggle(d.id,!d.enabled),children:d.enabled?"Выключить":"Включить"}),r.jsx("button",{className:"btn btn--ghost btn--sm btn--danger",onClick:()=>i.pluginUninstall(d.id),children:"Удалить"})]})]},d.id))}),r.jsx("div",{className:"sidebar__section",children:"Маркетплейсы"}),r.jsx("ul",{className:"extlist",children:l.map(d=>r.jsxs("li",{className:"extlist__row",children:[r.jsx("div",{className:"extlist__head",children:r.jsx("span",{className:"extlist__name",children:d.name})}),d.source&&r.jsx("div",{className:"extlist__meta",children:d.source}),r.jsx("div",{className:"extlist__actions",children:r.jsx("button",{className:"btn btn--ghost btn--sm btn--danger",onClick:()=>i.marketplaceRemove(d.name),children:"Отключить"})})]},d.name))}),r.jsxs("div",{className:"extform__row",children:[r.jsx("input",{className:"input input--mono",value:c,spellCheck:!1,autoComplete:"off","aria-label":"Источник маркетплейса",placeholder:"owner/repo, URL или путь",onChange:d=>o(d.target.value),onKeyDown:d=>{d.key!=="Enter"||c.trim()===""||(d.preventDefault(),i.marketplaceAdd(c.trim()),o(""))}}),r.jsx("button",{className:"btn",disabled:c.trim()==="",onClick:()=>{i.marketplaceAdd(c.trim()),o("")},children:"Добавить"})]})]})}const Bc=30;function ck({catalog:a,hasMarketplaces:l,actions:i,onMarketplaces:c}){const[o,d]=_.useState(""),[h,p]=_.useState(""),[m,x]=_.useState(Bc),[y,j]=_.useState(""),v=_.useMemo(()=>[...new Set(a.map(L=>L.category).filter(Boolean))].sort(),[a]),R=_.useMemo(()=>{const w=o.trim().toLowerCase();return a.filter(L=>h&&L.category!==h?!1:w?`${L.name} ${L.displayName} ${L.description} ${L.author}`.toLowerCase().includes(w):!0)},[a,o,h]);return a.length===0?r.jsxs("p",{className:"modal__text",children:[l?"Маркетплейсы подключены, но их каталог ещё не выкачан. Попробуйте открыть окно ещё раз через минуту.":"Ни одного маркетплейса — ставить нечего."," ",r.jsx("button",{className:"linkish",onClick:c,children:"Подключить маркетплейс"})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"catalog__filters",children:[r.jsx("input",{className:"input",value:o,spellCheck:!1,autoComplete:"off","aria-label":"Поиск по каталогу",placeholder:"Поиск: имя, описание, автор",onChange:w=>{d(w.target.value),x(Bc)}}),r.jsx(es,{title:"Категория",value:h,options:[{value:"",label:"все категории"},...v.map(w=>({value:w,label:w}))],onChange:w=>{p(w),x(Bc)}})]}),R.length===0?r.jsx("p",{className:"modal__text",children:"Ничего не нашлось."}):r.jsx("ul",{className:"extlist",children:R.slice(0,m).map(w=>r.jsxs("li",{className:"extlist__row",children:[r.jsxs("div",{className:"extlist__head",children:[r.jsx("span",{className:"extlist__name",children:w.name}),w.installed&&r.jsx("span",{className:"chip chip--ok",children:"установлен"}),w.version&&r.jsx("span",{className:"chip",children:w.version}),w.category&&r.jsx("span",{className:"chip",children:w.category})]}),w.description&&r.jsx("div",{className:"catalog__desc",children:w.description}),r.jsxs("div",{className:"extlist__meta",children:[w.author&&`${w.author} · `,w.marketplace]}),r.jsxs("div",{className:"extlist__actions",children:[r.jsx("button",{className:"btn btn--ghost btn--sm",disabled:w.installed,onClick:()=>i.pluginInstall(w.id),children:w.installed?"Уже стоит":"Установить"}),w.homepage&&r.jsx("a",{className:"btn btn--ghost btn--sm",href:w.homepage,target:"_blank",rel:"noreferrer",children:"Страница"})]})]},w.id))}),R.length>m&&r.jsx("div",{className:"extbar",children:r.jsxs("button",{className:"btn",onClick:()=>x(w=>w+Bc),children:["Ещё ",Math.min(Bc,R.length-m)," из ",R.length-m]})}),r.jsxs("div",{className:"extform",children:[r.jsx("label",{className:"field",htmlFor:"plugin-spec",children:"Или установить по имени — если нужного в каталоге нет"}),r.jsxs("div",{className:"extform__row",children:[r.jsx("input",{id:"plugin-spec",className:"input input--mono",value:y,spellCheck:!1,autoComplete:"off",placeholder:"имя или имя@маркетплейс",onChange:w=>j(w.target.value),onKeyDown:w=>{w.key!=="Enter"||y.trim()===""||(w.preventDefault(),i.pluginInstall(y.trim()),j(""))}}),r.jsx("button",{className:"btn",disabled:y.trim()==="",onClick:()=>{i.pluginInstall(y.trim()),j("")},children:"Установить"})]})]})]})}function uk({status:a,login:l,actions:i,remote:c,runningSessions:o,onReconnect:d,reconnectBlocked:h,reconnectHint:p,onClose:m}){const[x,y]=_.useState(""),[j,v]=_.useState(!1),[R,w]=_.useState(!1),L=d!==null&&(a==null?void 0:a.loggedIn)===!0&&!R&&!j,B=_.useMemo(()=>{if(l.error)return{ok:!1,message:l.error};const Q=l.output.trim();return Q===""?null:{ok:!0,message:Q}},[l.error,l.output]);function P(Q=x){const k=Q.trim();k!==""&&(i.submitCode(k),y(""))}function M(){if(o>0){v(!1),w(!0);return}i.login("claudeai",!0)}return r.jsxs(Nl,{title:"Аккаунт",onClose:m,children:[a===null?r.jsx("p",{className:"modal__text",children:"Спрашиваем у хоста…"}):a.loggedIn?r.jsxs("div",{className:"account",children:[r.jsx("div",{className:"account__id",children:a.email||"Вход выполнен"}),r.jsxs("div",{className:"account__chips",children:[r.jsx("span",{className:"chip chip--ok",children:dk[a.method]??a.method}),a.plan&&r.jsx("span",{className:"chip",children:a.plan})]}),a.organization&&r.jsx("div",{className:"extlist__meta",children:a.organization})]}):r.jsxs("p",{className:"modal__text",children:["Вход не выполнен. Сессии не запустятся, пока аккаунт не подключён — или пока в окружении хоста нет ",r.jsx("code",{children:"ANTHROPIC_API_KEY"}),"."]}),l.active?r.jsx(hk,{login:l,remote:c,code:x,onCode:y,onSubmit:P,onCancel:i.cancel}):r.jsxs(r.Fragment,{children:[r.jsx(Ui,{result:B}),R&&r.jsx("p",{className:"account__warn",role:"alert",children:ok(o)}),L&&h&&r.jsx("p",{className:"account__note",children:p}),r.jsx("div",{className:`extbar${a!=null&&a.loggedIn?" account__bar":""}`,children:a!=null&&a.loggedIn?r.jsxs(r.Fragment,{children:[L&&r.jsxs("button",{type:"button",className:"btn account__relink",title:`Переподключить сессию